fixed refacto of this.buildosUrl

This commit is contained in:
STEINNI
2026-03-21 19:01:42 +00:00
parent e58ff43014
commit 4122545cff
6 changed files with 63 additions and 14 deletions

View File

@@ -10,8 +10,6 @@
* This code is free to use and modify,
* as long as the copyright notice and license are kept.
*/
const scriptUrl = document.currentScript.src
class BZgraflow extends Buildoz{
dirVect = {
n: { x: 0, y: -1 },
@@ -37,10 +35,10 @@ class BZgraflow extends Buildoz{
static _coreCssPromise = null
static async getCoreCss(){
async getCoreCss(){
if(BZgraflow._coreCssPromise) return(await BZgraflow._coreCssPromise)
BZgraflow._coreCssPromise = (async() => {
const url = new URL('./buildoz.css', scriptUrl)
const url = new URL('./buildoz.css', this.buildozUrl)
const res = await fetch(url)
const css = await res.text()
const m = css.match(/\/\*\s*BZGRAFLOW_CORE_START\s*\*\/([\s\S]*?)\/\*\s*BZGRAFLOW_CORE_END\s*\*\//)
@@ -54,7 +52,7 @@ class BZgraflow extends Buildoz{
if(!this.hasAttribute('isolated')) return
if(this._isolatedCoreInjected) return
this._isolatedCoreInjected = true
const core = await BZgraflow.getCoreCss()
const core = await this.getCoreCss()
// Convert light-dom selectors (`bz-graflow ...`) to shadow-dom selectors (`:host ...`)
const shadowCss = core.replaceAll('bz-graflow', ':host')
const style = document.createElement('style')