@burger-editor/client 4.0.0-alpha.61 → 4.0.0-alpha.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -3
- package/dist/client.js +1276 -1279
- package/dist/client.js.map +1 -1
- package/dist/engine-state.svelte.d.ts +42 -0
- package/dist/engine-state.svelte.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/initial-insertion-button.svelte.d.ts +1 -0
- package/package.json +9 -9
package/dist/client.js
CHANGED
|
@@ -383,7 +383,7 @@ function kebabCase(str) {
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
/**
|
|
386
|
-
* marked v17.0.
|
|
386
|
+
* marked v17.0.3 - a markdown parser
|
|
387
387
|
* Copyright (c) 2018-2026, MarkedJS. (MIT License)
|
|
388
388
|
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
389
389
|
* https://github.com/markedjs/marked
|
|
@@ -451,7 +451,7 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
451
451
|
`}tablerow({text:e}){return `<tr>
|
|
452
452
|
${e}</tr>
|
|
453
453
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return (e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
454
|
-
`}strong({tokens:e}){return `<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return `<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return `<code>${O(e,true)}</code>`}br(e){return "<br>"}del({tokens:e}){return `<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=X(e);if(i===null)return r;e=i;let s='<a href="'+e+'"';return t&&(s+=' title="'+O(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=X(e);if(i===null)return O(n);e=i;let s=`<img src="${e}" alt="${n}"`;return t&&(s+=` title="${O(t)}"`),s+=">",s}text(e){return "tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:O(e.text)}};var $=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return ""+e}image({text:e}){return ""+e}br(){return ""}checkbox({raw:e}){return e}};var b=class u{options;renderer;textRenderer;constructor(e){this.options=e||T,this.options.renderer=this.options.renderer||new y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $;}static parse(e,t){return new u(t).parse(e)}static parseInline(e,t){return new u(t).parseInline(e)}parse(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let s=r,a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==false||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(s.type)){t+=a||"";continue}}let i=r;switch(i.type){case "space":{t+=this.renderer.space(i);break}case "hr":{t+=this.renderer.hr(i);break}case "heading":{t+=this.renderer.heading(i);break}case "code":{t+=this.renderer.code(i);break}case "table":{t+=this.renderer.table(i);break}case "blockquote":{t+=this.renderer.blockquote(i);break}case "list":{t+=this.renderer.list(i);break}case "checkbox":{t+=this.renderer.checkbox(i);break}case "html":{t+=this.renderer.html(i);break}case "def":{t+=this.renderer.def(i);break}case "paragraph":{t+=this.renderer.paragraph(i);break}case "text":{t+=this.renderer.text(i);break}default:{let s='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==false||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=a||"";continue}}let s=i;switch(s.type){case "escape":{n+=t.text(s);break}case "html":{n+=t.html(s);break}case "link":{n+=t.link(s);break}case "image":{n+=t.image(s);break}case "checkbox":{n+=t.checkbox(s);break}case "strong":{n+=t.strong(s);break}case "em":{n+=t.em(s);break}case "codespan":{n+=t.codespan(s);break}case "br":{n+=t.br(s);break}case "del":{n+=t.del(s);break}case "text":{n+=t.text(s);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}};var P=class{options;block;constructor(e){this.options=e||T;}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?x.lex:x.lexInline}provideParser(){return this.block?b.parse:b.parseInline}};var B=class{defaults=M();options=this.setOptions;parse=this.parseMarkdown(true);parseInline=this.parseMarkdown(false);Parser=b;Renderer=y;TextRenderer=$;Lexer=x;Tokenizer=w;Hooks=P;constructor(...e){this.use(...e);}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case "table":{let i=r;for(let s of i.header)n=n.concat(this.walkTokens(s.tokens,t));for(let s of i.rows)for(let a of s)n=n.concat(this.walkTokens(a.tokens,t));break}case "list":{let i=r;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let a=i[s].flat(1/0);n=n.concat(this.walkTokens(a,t));}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)));}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||false,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===false&&(o=s.apply(this,a)),o}:t.renderers[i.name]=i.renderer;}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]));}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens);}),r.extensions=t),n.renderer){let i=this.defaults.renderer||new y(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=n.renderer[a],l=i[a];i[a]=(...p)=>{let c=o.apply(i,p);return c===false&&(c=l.apply(i,p)),c||""};}r.renderer=i;}if(n.tokenizer){let i=this.defaults.tokenizer||new w(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=n.tokenizer[a],l=i[a];i[a]=(...p)=>{let c=o.apply(i,p);return c===false&&(c=l.apply(i,p)),c};}r.tokenizer=i;}if(n.hooks){let i=this.defaults.hooks||new P;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=n.hooks[a],l=i[a];P.passThroughHooks.has(s)?i[a]=p=>{if(this.defaults.async&&P.passThroughHooksRespectAsync.has(s))return (async()=>{let d=await o.call(i,p);return l.call(i,d)})();let c=o.call(i,p);return l.call(i,c)}:i[a]=(...p)=>{if(this.defaults.async)return (async()=>{let d=await o.apply(i,p);return d===false&&(d=await l.apply(i,p)),d})();let c=o.apply(i,p);return c===false&&(c=l.apply(i,p)),c};}r.hooks=i;}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(a){let o=[];return o.push(s.call(this,a)),i&&(o=o.concat(i.call(this,a))),o};}this.defaults={...this.defaults,...r};}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return x.lex(e,t??this.defaults)}parser(e,t){return b.parse(e,t??this.defaults)}parseMarkdown(e){return (n,r)=>{let i={...r},s={...this.defaults,...i},a=this.onError(!!s.silent,!!s.async);if(this.defaults.async===true&&i.async===false)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return (async()=>{let o=s.hooks?await s.hooks.preprocess(n):n,p=await(s.hooks?await s.hooks.provideLexer():e?x.lex:x.lexInline)(o,s),c=s.hooks?await s.hooks.processAllTokens(p):p;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let h=await(s.hooks?await s.hooks.provideParser():e?b.parse:b.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(h):h})().catch(a);try{s.hooks&&(n=s.hooks.preprocess(n));let l=(s.hooks?s.hooks.provideLexer():e?x.lex:x.lexInline)(n,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let c=(s.hooks?s.hooks.provideParser():e?b.parse:b.parseInline)(l,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
|
|
454
|
+
`}strong({tokens:e}){return `<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return `<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return `<code>${O(e,true)}</code>`}br(e){return "<br>"}del({tokens:e}){return `<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=X(e);if(i===null)return r;e=i;let s='<a href="'+e+'"';return t&&(s+=' title="'+O(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=X(e);if(i===null)return O(n);e=i;let s=`<img src="${e}" alt="${O(n)}"`;return t&&(s+=` title="${O(t)}"`),s+=">",s}text(e){return "tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:O(e.text)}};var $=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return ""+e}image({text:e}){return ""+e}br(){return ""}checkbox({raw:e}){return e}};var b=class u{options;renderer;textRenderer;constructor(e){this.options=e||T,this.options.renderer=this.options.renderer||new y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $;}static parse(e,t){return new u(t).parse(e)}static parseInline(e,t){return new u(t).parseInline(e)}parse(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let s=r,a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==false||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(s.type)){t+=a||"";continue}}let i=r;switch(i.type){case "space":{t+=this.renderer.space(i);break}case "hr":{t+=this.renderer.hr(i);break}case "heading":{t+=this.renderer.heading(i);break}case "code":{t+=this.renderer.code(i);break}case "table":{t+=this.renderer.table(i);break}case "blockquote":{t+=this.renderer.blockquote(i);break}case "list":{t+=this.renderer.list(i);break}case "checkbox":{t+=this.renderer.checkbox(i);break}case "html":{t+=this.renderer.html(i);break}case "def":{t+=this.renderer.def(i);break}case "paragraph":{t+=this.renderer.paragraph(i);break}case "text":{t+=this.renderer.text(i);break}default:{let s='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let a=this.options.extensions.renderers[i.type].call({parser:this},i);if(a!==false||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=a||"";continue}}let s=i;switch(s.type){case "escape":{n+=t.text(s);break}case "html":{n+=t.html(s);break}case "link":{n+=t.link(s);break}case "image":{n+=t.image(s);break}case "checkbox":{n+=t.checkbox(s);break}case "strong":{n+=t.strong(s);break}case "em":{n+=t.em(s);break}case "codespan":{n+=t.codespan(s);break}case "br":{n+=t.br(s);break}case "del":{n+=t.del(s);break}case "text":{n+=t.text(s);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}};var P=class{options;block;constructor(e){this.options=e||T;}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?x.lex:x.lexInline}provideParser(){return this.block?b.parse:b.parseInline}};var B=class{defaults=M();options=this.setOptions;parse=this.parseMarkdown(true);parseInline=this.parseMarkdown(false);Parser=b;Renderer=y;TextRenderer=$;Lexer=x;Tokenizer=w;Hooks=P;constructor(...e){this.use(...e);}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case "table":{let i=r;for(let s of i.header)n=n.concat(this.walkTokens(s.tokens,t));for(let s of i.rows)for(let a of s)n=n.concat(this.walkTokens(a.tokens,t));break}case "list":{let i=r;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let a=i[s].flat(1/0);n=n.concat(this.walkTokens(a,t));}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)));}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||false,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===false&&(o=s.apply(this,a)),o}:t.renderers[i.name]=i.renderer;}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]));}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens);}),r.extensions=t),n.renderer){let i=this.defaults.renderer||new y(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=n.renderer[a],l=i[a];i[a]=(...p)=>{let c=o.apply(i,p);return c===false&&(c=l.apply(i,p)),c||""};}r.renderer=i;}if(n.tokenizer){let i=this.defaults.tokenizer||new w(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=n.tokenizer[a],l=i[a];i[a]=(...p)=>{let c=o.apply(i,p);return c===false&&(c=l.apply(i,p)),c};}r.tokenizer=i;}if(n.hooks){let i=this.defaults.hooks||new P;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=n.hooks[a],l=i[a];P.passThroughHooks.has(s)?i[a]=p=>{if(this.defaults.async&&P.passThroughHooksRespectAsync.has(s))return (async()=>{let d=await o.call(i,p);return l.call(i,d)})();let c=o.call(i,p);return l.call(i,c)}:i[a]=(...p)=>{if(this.defaults.async)return (async()=>{let d=await o.apply(i,p);return d===false&&(d=await l.apply(i,p)),d})();let c=o.apply(i,p);return c===false&&(c=l.apply(i,p)),c};}r.hooks=i;}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(a){let o=[];return o.push(s.call(this,a)),i&&(o=o.concat(i.call(this,a))),o};}this.defaults={...this.defaults,...r};}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return x.lex(e,t??this.defaults)}parser(e,t){return b.parse(e,t??this.defaults)}parseMarkdown(e){return (n,r)=>{let i={...r},s={...this.defaults,...i},a=this.onError(!!s.silent,!!s.async);if(this.defaults.async===true&&i.async===false)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return (async()=>{let o=s.hooks?await s.hooks.preprocess(n):n,p=await(s.hooks?await s.hooks.provideLexer():e?x.lex:x.lexInline)(o,s),c=s.hooks?await s.hooks.processAllTokens(p):p;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let h=await(s.hooks?await s.hooks.provideParser():e?b.parse:b.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(h):h})().catch(a);try{s.hooks&&(n=s.hooks.preprocess(n));let l=(s.hooks?s.hooks.provideLexer():e?x.lex:x.lexInline)(n,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let c=(s.hooks?s.hooks.provideParser():e?b.parse:b.parseInline)(l,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(o){return a(o)}}}onError(e,t){return n=>{if(n.message+=`
|
|
455
455
|
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+O(n.message+"",true)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}};var L=new B;function g(u,e){return L.parse(u,e)}g.options=g.setOptions=function(u){return L.setOptions(u),g.defaults=L.defaults,H(g.defaults),g};g.getDefaults=M;g.defaults=T;g.use=function(...u){return L.use(...u),g.defaults=L.defaults,H(g.defaults),g};g.walkTokens=function(u,e){return L.walkTokens(u,e)};g.parseInline=L.parseInline;g.Parser=b;g.parser=b.parse;g.Renderer=y;g.TextRenderer=$;g.Lexer=x;g.lexer=x.lex;g.Tokenizer=w;g.Hooks=P;g.parse=g;g.options;g.setOptions;g.use;g.walkTokens;g.parseInline;b.parse;x.lex;
|
|
456
456
|
|
|
457
457
|
/*
|
|
@@ -2915,43 +2915,24 @@ class EditorUI {
|
|
|
2915
2915
|
}
|
|
2916
2916
|
|
|
2917
2917
|
class EditorDialog extends EditorUI {
|
|
2918
|
-
#body = document.createElement('div');
|
|
2919
2918
|
#cleanUpHooks = [];
|
|
2920
2919
|
#createEditorComponent;
|
|
2921
|
-
#dialog
|
|
2920
|
+
#dialog;
|
|
2922
2921
|
#el;
|
|
2923
|
-
#
|
|
2924
|
-
#form = document.createElement('form');
|
|
2922
|
+
#form;
|
|
2925
2923
|
#onClosed;
|
|
2926
2924
|
#onOpen;
|
|
2927
|
-
constructor(name,
|
|
2928
|
-
|
|
2929
|
-
|
|
2925
|
+
constructor(name, settings, options) {
|
|
2926
|
+
const shell = settings.createDialogShell
|
|
2927
|
+
? settings.createDialogShell({ name, buttons: options.buttons })
|
|
2928
|
+
: createDefaultDialogShell(name, options);
|
|
2929
|
+
super(`${name}-dialog`, shell.containerElement);
|
|
2930
|
+
this.#el = shell.containerElement;
|
|
2931
|
+
this.#dialog = shell.dialogElement;
|
|
2932
|
+
this.#form = shell.formElement;
|
|
2930
2933
|
this.#onClosed = settings.onClosed;
|
|
2931
2934
|
this.#onOpen = settings.onOpen;
|
|
2932
2935
|
this.#createEditorComponent = settings.createEditorComponent;
|
|
2933
|
-
this.#form.noValidate = true;
|
|
2934
|
-
this.#form.id = `${name}-dialog-form`;
|
|
2935
|
-
this.#form.append(this.#el);
|
|
2936
|
-
this.#body.append(this.#form);
|
|
2937
|
-
if (options.buttons?.close) {
|
|
2938
|
-
const button = document.createElement('button');
|
|
2939
|
-
button.textContent = options.buttons.close;
|
|
2940
|
-
button.type = 'button';
|
|
2941
|
-
button.addEventListener('click', () => {
|
|
2942
|
-
this.close();
|
|
2943
|
-
});
|
|
2944
|
-
this.#footer.append(button);
|
|
2945
|
-
}
|
|
2946
|
-
if (options.buttons?.complete) {
|
|
2947
|
-
const button = document.createElement('button');
|
|
2948
|
-
button.textContent = options.buttons.complete;
|
|
2949
|
-
button.type = 'submit';
|
|
2950
|
-
button.setAttribute('form', this.#form.id);
|
|
2951
|
-
this.#footer.append(button);
|
|
2952
|
-
}
|
|
2953
|
-
this.#dialog.append(this.#body, this.#footer);
|
|
2954
|
-
this.#form.method = 'dialog';
|
|
2955
2936
|
this.#form.addEventListener('submit', (e) => {
|
|
2956
2937
|
const submitter = this.#form.ownerDocument.activeElement;
|
|
2957
2938
|
const cancel = this.onSubmit(e, submitter);
|
|
@@ -2965,8 +2946,6 @@ class EditorDialog extends EditorUI {
|
|
|
2965
2946
|
return;
|
|
2966
2947
|
});
|
|
2967
2948
|
this.#sanitize(this.#el);
|
|
2968
|
-
document.body.append(this.#dialog);
|
|
2969
|
-
this.#dialog.classList.add('bge-dialog');
|
|
2970
2949
|
this.#dialog.addEventListener('close', this.closed.bind(this));
|
|
2971
2950
|
}
|
|
2972
2951
|
clearTemplate() {
|
|
@@ -3068,12 +3047,58 @@ class EditorDialog extends EditorUI {
|
|
|
3068
3047
|
}
|
|
3069
3048
|
}
|
|
3070
3049
|
}
|
|
3050
|
+
/**
|
|
3051
|
+
*
|
|
3052
|
+
* @param name
|
|
3053
|
+
* @param options
|
|
3054
|
+
*/
|
|
3055
|
+
function createDefaultDialogShell(name, options) {
|
|
3056
|
+
const dialogId = `${name}-dialog`;
|
|
3057
|
+
const formId = `${name}-dialog-form`;
|
|
3058
|
+
const dialog = document.createElement('dialog');
|
|
3059
|
+
dialog.id = dialogId;
|
|
3060
|
+
dialog.classList.add('bge-dialog');
|
|
3061
|
+
dialog.setAttribute('closedby', 'any');
|
|
3062
|
+
const body = document.createElement('div');
|
|
3063
|
+
const form = document.createElement('form');
|
|
3064
|
+
form.noValidate = true;
|
|
3065
|
+
form.method = 'dialog';
|
|
3066
|
+
form.id = formId;
|
|
3067
|
+
const container = document.createElement('div');
|
|
3068
|
+
form.append(container);
|
|
3069
|
+
body.append(form);
|
|
3070
|
+
const footer = document.createElement('footer');
|
|
3071
|
+
if (options.buttons?.close) {
|
|
3072
|
+
const button = document.createElement('button');
|
|
3073
|
+
button.textContent = options.buttons.close;
|
|
3074
|
+
button.type = 'button';
|
|
3075
|
+
button.setAttribute('command', 'close');
|
|
3076
|
+
button.setAttribute('commandfor', dialogId);
|
|
3077
|
+
// Fallback for environments without Invoker Commands support
|
|
3078
|
+
button.addEventListener('click', () => dialog.close());
|
|
3079
|
+
footer.append(button);
|
|
3080
|
+
}
|
|
3081
|
+
if (options.buttons?.complete) {
|
|
3082
|
+
const button = document.createElement('button');
|
|
3083
|
+
button.textContent = options.buttons.complete;
|
|
3084
|
+
button.type = 'submit';
|
|
3085
|
+
button.setAttribute('form', formId);
|
|
3086
|
+
footer.append(button);
|
|
3087
|
+
}
|
|
3088
|
+
dialog.append(body, footer);
|
|
3089
|
+
document.body.append(dialog);
|
|
3090
|
+
return {
|
|
3091
|
+
dialogElement: dialog,
|
|
3092
|
+
containerElement: container,
|
|
3093
|
+
formElement: form,
|
|
3094
|
+
};
|
|
3095
|
+
}
|
|
3071
3096
|
|
|
3072
3097
|
class BlockCatalogDialog extends EditorDialog {
|
|
3073
3098
|
catalog;
|
|
3074
3099
|
#addBlock;
|
|
3075
3100
|
constructor(catalog, settings) {
|
|
3076
|
-
super('catalog',
|
|
3101
|
+
super('catalog', settings, {
|
|
3077
3102
|
buttons: {
|
|
3078
3103
|
close: 'キャンセル',
|
|
3079
3104
|
},
|
|
@@ -3098,7 +3123,7 @@ class BlockOptionsDialog extends EditorDialog {
|
|
|
3098
3123
|
#getCurrentBlock;
|
|
3099
3124
|
#onChangeBlock;
|
|
3100
3125
|
constructor(settings) {
|
|
3101
|
-
super('options',
|
|
3126
|
+
super('options', settings, {
|
|
3102
3127
|
buttons: {
|
|
3103
3128
|
close: 'キャンセル',
|
|
3104
3129
|
complete: '決定',
|
|
@@ -3296,13 +3321,15 @@ function comparePriority(a, b) {
|
|
|
3296
3321
|
|
|
3297
3322
|
/**
|
|
3298
3323
|
* Get all custom properties from document
|
|
3299
|
-
* @param scope
|
|
3300
|
-
* @param containerType
|
|
3324
|
+
* @param scope - Document to scan for CSS custom properties
|
|
3325
|
+
* @param containerType - Container type to filter container-scoped properties (prefixed with `_`)
|
|
3326
|
+
* @returns Categorized map of custom properties grouped by property name
|
|
3301
3327
|
*/
|
|
3302
3328
|
function getCustomProperties(scope, containerType) {
|
|
3303
3329
|
const categories = new Map();
|
|
3304
3330
|
const defaultValues = new Map();
|
|
3305
|
-
|
|
3331
|
+
const nestedDefaultValues = new Map();
|
|
3332
|
+
searchCustomProperty(scope, (cssProperty, value, layers, isNested) => {
|
|
3306
3333
|
if (!cssProperty.startsWith(BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX)) {
|
|
3307
3334
|
return;
|
|
3308
3335
|
}
|
|
@@ -3338,8 +3365,12 @@ function getCustomProperties(scope, containerType) {
|
|
|
3338
3365
|
isDefault: true,
|
|
3339
3366
|
priority: layers.map((layer) => layer.priority),
|
|
3340
3367
|
};
|
|
3341
|
-
|
|
3342
|
-
|
|
3368
|
+
// Direct selectors take precedence over nested selectors for default.
|
|
3369
|
+
// Nested selectors (e.g. `.parent [data-bge-container]`) are context-specific
|
|
3370
|
+
// overrides; they are used as fallback when no direct selector defines a default.
|
|
3371
|
+
const targetMap = isNested ? nestedDefaultValues : defaultValues;
|
|
3372
|
+
const currentDefaultValue = targetMap.get(propName);
|
|
3373
|
+
targetMap.set(propName, currentDefaultValue
|
|
3343
3374
|
? compareCustomPropertyByLayerPriority(currentDefaultValue, newDefaultValue)
|
|
3344
3375
|
: newDefaultValue);
|
|
3345
3376
|
}
|
|
@@ -3356,6 +3387,13 @@ function getCustomProperties(scope, containerType) {
|
|
|
3356
3387
|
}
|
|
3357
3388
|
}
|
|
3358
3389
|
}
|
|
3390
|
+
// Merge nested defaults as fallback: use nested default only when
|
|
3391
|
+
// no direct (non-nested) default exists for a category.
|
|
3392
|
+
for (const [category, property] of nestedDefaultValues.entries()) {
|
|
3393
|
+
if (!defaultValues.has(category)) {
|
|
3394
|
+
defaultValues.set(category, property);
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3359
3397
|
for (const [category, property] of defaultValues.entries()) {
|
|
3360
3398
|
const currentMap = categories.get(category);
|
|
3361
3399
|
if (!currentMap) {
|
|
@@ -3371,9 +3409,10 @@ function getCustomProperties(scope, containerType) {
|
|
|
3371
3409
|
return categories;
|
|
3372
3410
|
}
|
|
3373
3411
|
/**
|
|
3374
|
-
*
|
|
3375
|
-
* @param scope
|
|
3376
|
-
* @param property
|
|
3412
|
+
* Get a single custom property value from document
|
|
3413
|
+
* @param scope - Document to scan for CSS custom properties
|
|
3414
|
+
* @param property - Property name or pattern to match against
|
|
3415
|
+
* @returns The property value with the highest cascade priority, or `null` if not found
|
|
3377
3416
|
*/
|
|
3378
3417
|
function getCustomProperty(scope, property) {
|
|
3379
3418
|
let resultValue = null;
|
|
@@ -3455,9 +3494,9 @@ function collectGlobalTopLevelLayerOrder(scope) {
|
|
|
3455
3494
|
/**
|
|
3456
3495
|
* Get all CSSStyleRule from CSSRule array recursively
|
|
3457
3496
|
* @param rules - CSSRule array
|
|
3458
|
-
* @param layers
|
|
3459
|
-
* @param scope - Document
|
|
3460
|
-
* @param scopeRoot
|
|
3497
|
+
* @param layers - Accumulated layer priority chain from parent rules
|
|
3498
|
+
* @param scope - Document providing CSSOM constructors
|
|
3499
|
+
* @param scopeRoot - Selector from enclosing `@scope` rule, if any
|
|
3461
3500
|
* @param topLevelLayerOrder - Global layer order from collectGlobalTopLevelLayerOrder (top-level calls only)
|
|
3462
3501
|
* @returns CSSStyleRule array
|
|
3463
3502
|
*/
|
|
@@ -3528,9 +3567,9 @@ function getStyleRules(rules, layers, scope, scopeRoot = null, topLevelLayerOrde
|
|
|
3528
3567
|
return styleRules;
|
|
3529
3568
|
}
|
|
3530
3569
|
/**
|
|
3531
|
-
*
|
|
3532
|
-
* @param scope
|
|
3533
|
-
* @param found
|
|
3570
|
+
* Search all stylesheets for custom properties on the block option scope selector
|
|
3571
|
+
* @param scope - Document to scan
|
|
3572
|
+
* @param found - Callback invoked for each custom property found
|
|
3534
3573
|
*/
|
|
3535
3574
|
function searchCustomProperty(scope, found) {
|
|
3536
3575
|
const globalLayerOrder = collectGlobalTopLevelLayerOrder(scope);
|
|
@@ -3538,15 +3577,18 @@ function searchCustomProperty(scope, found) {
|
|
|
3538
3577
|
try {
|
|
3539
3578
|
const styleRules = getStyleRules(styleSheet.cssRules, [], scope, null, globalLayerOrder);
|
|
3540
3579
|
for (const cssRule of styleRules) {
|
|
3541
|
-
const
|
|
3580
|
+
const rawSelector = cssRule.rule.selectorText.trim();
|
|
3581
|
+
const selector = rawSelector.replace(/^&/, '').trim();
|
|
3542
3582
|
if (selector === BLOCK_OPTION_SCOPE_SELECTOR ||
|
|
3543
3583
|
(selector === ':scope' && cssRule.scopeRoot === BLOCK_OPTION_SCOPE_SELECTOR)) {
|
|
3584
|
+
// Detect nested selectors: `& [data-bge-container]` has a parent context
|
|
3585
|
+
const isNested = rawSelector !== selector;
|
|
3544
3586
|
for (const cssProperty of cssRule.rule.style) {
|
|
3545
3587
|
if (!cssProperty.startsWith('--')) {
|
|
3546
3588
|
continue;
|
|
3547
3589
|
}
|
|
3548
3590
|
const value = cssRule.rule.style.getPropertyValue(cssProperty);
|
|
3549
|
-
found(cssProperty, value, cssRule.layers);
|
|
3591
|
+
found(cssProperty, value, cssRule.layers, isNested);
|
|
3550
3592
|
}
|
|
3551
3593
|
}
|
|
3552
3594
|
}
|
|
@@ -3561,7 +3603,8 @@ function searchCustomProperty(scope, found) {
|
|
|
3561
3603
|
}
|
|
3562
3604
|
/**
|
|
3563
3605
|
* Get repeat-min-inline-size variant definitions from document
|
|
3564
|
-
* @param scope
|
|
3606
|
+
* @param scope - Document to scan for `--bge-repeat-min-inline-size` variants
|
|
3607
|
+
* @returns Category containing variant properties, or `null` if no variants found
|
|
3565
3608
|
*/
|
|
3566
3609
|
function getRepeatMinInlineSizeVariants(scope) {
|
|
3567
3610
|
const PREFIX = '--bge-repeat-min-inline-size';
|
|
@@ -3612,8 +3655,8 @@ function getRepeatMinInlineSizeVariants(scope) {
|
|
|
3612
3655
|
* - レイヤーの数が少ないほど優先度が高い
|
|
3613
3656
|
* - レイヤーの数が同じ場合は、レイヤーの優先度の値が小さいほど優先度が高い
|
|
3614
3657
|
* - 全てのレイヤーの優先度が同じ場合は、bを返す
|
|
3615
|
-
* @param a
|
|
3616
|
-
* @param b
|
|
3658
|
+
* @param a - First candidate property
|
|
3659
|
+
* @param b - Second candidate property (wins on equal priority)
|
|
3617
3660
|
*/
|
|
3618
3661
|
function compareCustomPropertyByLayerPriority(a, b) {
|
|
3619
3662
|
const result = comparePriority(a.priority, b.priority);
|
|
@@ -3623,124 +3666,6 @@ function compareCustomPropertyByLayerPriority(a, b) {
|
|
|
3623
3666
|
return b;
|
|
3624
3667
|
}
|
|
3625
3668
|
|
|
3626
|
-
const getCSSPropertyAsNumberCache = new Map();
|
|
3627
|
-
/**
|
|
3628
|
-
*
|
|
3629
|
-
* @param el
|
|
3630
|
-
* @param property
|
|
3631
|
-
*/
|
|
3632
|
-
function getCSSPropertyAsNumber(el, property) {
|
|
3633
|
-
const value = window.getComputedStyle(el).getPropertyValue(property);
|
|
3634
|
-
if (value === '') {
|
|
3635
|
-
return 0;
|
|
3636
|
-
}
|
|
3637
|
-
const cached = getCSSPropertyAsNumberCache.get(value);
|
|
3638
|
-
if (cached !== undefined) {
|
|
3639
|
-
return cached;
|
|
3640
|
-
}
|
|
3641
|
-
const i_or_nan = Number.parseInt(value, 10);
|
|
3642
|
-
const result = Number.isNaN(i_or_nan) ? 0 : i_or_nan;
|
|
3643
|
-
getCSSPropertyAsNumberCache.set(value, result);
|
|
3644
|
-
return result;
|
|
3645
|
-
}
|
|
3646
|
-
|
|
3647
|
-
class BlockMenu extends EditorUI {
|
|
3648
|
-
#engine;
|
|
3649
|
-
#mouseX = 0;
|
|
3650
|
-
#mouseY = 0;
|
|
3651
|
-
#raf = 0;
|
|
3652
|
-
constructor(engine, el, create) {
|
|
3653
|
-
super('block-menu', el, {
|
|
3654
|
-
stylesheet: `
|
|
3655
|
-
[data-bge-component='block-menu'] {
|
|
3656
|
-
position: absolute;
|
|
3657
|
-
z-index: 2147483647;
|
|
3658
|
-
pointer-events: none;
|
|
3659
|
-
}
|
|
3660
|
-
`,
|
|
3661
|
-
});
|
|
3662
|
-
create(this.el);
|
|
3663
|
-
this.#engine = engine;
|
|
3664
|
-
const update = () => {
|
|
3665
|
-
cancelAnimationFrame(this.#raf);
|
|
3666
|
-
if (engine.isProcessed) {
|
|
3667
|
-
this.hide();
|
|
3668
|
-
return;
|
|
3669
|
-
}
|
|
3670
|
-
this.#raf = requestAnimationFrame(() => {
|
|
3671
|
-
this.#updatePosition();
|
|
3672
|
-
});
|
|
3673
|
-
};
|
|
3674
|
-
this.el.ownerDocument.body.addEventListener('mousemove', (e) => {
|
|
3675
|
-
this.#mouseX = e.pageX;
|
|
3676
|
-
this.#mouseY = e.pageY;
|
|
3677
|
-
update();
|
|
3678
|
-
});
|
|
3679
|
-
globalThis.addEventListener('resize', this.hide.bind(this));
|
|
3680
|
-
this.el.ownerDocument.body.addEventListener('mouseleave', this.hide.bind(this));
|
|
3681
|
-
this.el.ownerDocument.addEventListener('mouseleave', this.hide.bind(this));
|
|
3682
|
-
this.el.ownerDocument.defaultView?.addEventListener('mouseleave', this.hide.bind(this));
|
|
3683
|
-
const observer = new MutationObserver((mutations) => {
|
|
3684
|
-
for (const mutation of mutations) {
|
|
3685
|
-
for (const node of mutation.addedNodes) {
|
|
3686
|
-
if (!(node instanceof HTMLElement)) {
|
|
3687
|
-
continue;
|
|
3688
|
-
}
|
|
3689
|
-
const images = node.querySelectorAll('img');
|
|
3690
|
-
for (const img of images) {
|
|
3691
|
-
img.addEventListener('load', update, { once: true });
|
|
3692
|
-
img.addEventListener('error', update, { once: true });
|
|
3693
|
-
img.addEventListener('abort', update, { once: true });
|
|
3694
|
-
}
|
|
3695
|
-
}
|
|
3696
|
-
}
|
|
3697
|
-
});
|
|
3698
|
-
observer.observe(this.el.ownerDocument, { childList: true, subtree: true });
|
|
3699
|
-
engine.el.addEventListener('bge:saved', update);
|
|
3700
|
-
}
|
|
3701
|
-
#getSelectedBlock() {
|
|
3702
|
-
const $blocks = [
|
|
3703
|
-
...this.el.ownerDocument.body.querySelectorAll('[data-bge-container]'),
|
|
3704
|
-
];
|
|
3705
|
-
for (const $block of $blocks) {
|
|
3706
|
-
const rect = $block.getBoundingClientRect();
|
|
3707
|
-
const marginBlockEnd = getCSSPropertyAsNumber($block, 'margin-block-end');
|
|
3708
|
-
const onMouse = rect.left <= this.#mouseX &&
|
|
3709
|
-
this.#mouseX <= rect.right &&
|
|
3710
|
-
rect.top <= this.#mouseY &&
|
|
3711
|
-
this.#mouseY <= rect.bottom + marginBlockEnd;
|
|
3712
|
-
if (onMouse) {
|
|
3713
|
-
const block = BurgerBlock.getBlock($block);
|
|
3714
|
-
return { block, rect, marginBlockEnd };
|
|
3715
|
-
}
|
|
3716
|
-
}
|
|
3717
|
-
return null;
|
|
3718
|
-
}
|
|
3719
|
-
#updatePosition() {
|
|
3720
|
-
const selected = this.#getSelectedBlock();
|
|
3721
|
-
if (!selected) {
|
|
3722
|
-
this.hide();
|
|
3723
|
-
return;
|
|
3724
|
-
}
|
|
3725
|
-
this.show();
|
|
3726
|
-
const { block, rect, marginBlockEnd } = selected;
|
|
3727
|
-
this.#engine.componentObserver.notify('select-block', {
|
|
3728
|
-
block,
|
|
3729
|
-
width: rect.width,
|
|
3730
|
-
height: rect.height,
|
|
3731
|
-
x: rect.left,
|
|
3732
|
-
y: rect.top,
|
|
3733
|
-
marginBlockEnd,
|
|
3734
|
-
});
|
|
3735
|
-
}
|
|
3736
|
-
hide() {
|
|
3737
|
-
super.hide();
|
|
3738
|
-
this.#mouseX = 0;
|
|
3739
|
-
this.#mouseY = 0;
|
|
3740
|
-
this.#engine.clearCurrentBlock();
|
|
3741
|
-
}
|
|
3742
|
-
}
|
|
3743
|
-
|
|
3744
3669
|
class InitialInsertionButton extends EditorUI {
|
|
3745
3670
|
#afterInsert;
|
|
3746
3671
|
#engine;
|
|
@@ -3849,46 +3774,74 @@ class EditableArea extends EditorUI {
|
|
|
3849
3774
|
get isVisualMode() {
|
|
3850
3775
|
return this.#isVisualMode;
|
|
3851
3776
|
}
|
|
3852
|
-
constructor(type, initialContent, engine, createBlockMenu, stylesheets = [], classList = []) {
|
|
3853
|
-
const
|
|
3854
|
-
|
|
3777
|
+
constructor(type, initialContent, engine, createBlockMenu, createInitialInsertionButton, stylesheets = [], classList = [], createShell) {
|
|
3778
|
+
const shell = createShell
|
|
3779
|
+
? createShell({ type, initialContent, stylesheets, classList })
|
|
3780
|
+
: createDefaultEditableAreaShell(initialContent, classList);
|
|
3781
|
+
super(`${type}-editable-area`, shell.viewNode);
|
|
3855
3782
|
this.type = type;
|
|
3856
3783
|
this.#engine = engine;
|
|
3857
|
-
this.#engine.viewArea.append(viewNode);
|
|
3858
|
-
this.#sourceTextarea =
|
|
3859
|
-
this.#
|
|
3860
|
-
|
|
3861
|
-
this.#frameElement = document.createElement('iframe');
|
|
3862
|
-
this.#frameElement.setAttribute('width', '100%;');
|
|
3863
|
-
this.#frameElement.setAttribute('scrolling', 'no');
|
|
3864
|
-
viewNode.append(this.#frameElement);
|
|
3784
|
+
this.#engine.viewArea.append(shell.viewNode);
|
|
3785
|
+
this.#sourceTextarea = shell.sourceTextarea;
|
|
3786
|
+
this.#frameElement = shell.frameElement;
|
|
3787
|
+
this.#containerElement = shell.containerElement;
|
|
3865
3788
|
if (!this.#frameElement.contentWindow) {
|
|
3866
3789
|
throw new Error('Impossible error: The contentWindow of created iframe is null.');
|
|
3867
3790
|
}
|
|
3868
|
-
this.#frameElement.contentWindow.document
|
|
3869
|
-
|
|
3791
|
+
const frameDoc = this.#frameElement.contentWindow.document;
|
|
3792
|
+
frameDoc.open();
|
|
3793
|
+
frameDoc.close();
|
|
3870
3794
|
for (const { path, id } of stylesheets) {
|
|
3871
|
-
appendStylesheetTo(
|
|
3872
|
-
}
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
this
|
|
3884
|
-
|
|
3795
|
+
appendStylesheetTo(frameDoc, path, id);
|
|
3796
|
+
}
|
|
3797
|
+
frameDoc.body.setAttribute('style', 'margin: 0; border: 0;');
|
|
3798
|
+
const blockMenuEl = frameDoc.createElement('div');
|
|
3799
|
+
blockMenuEl.dataset.bgeComponent = 'block-menu';
|
|
3800
|
+
const blockMenuStylesheetUrl = createStylesheet(`[data-bge-component='block-menu'] {
|
|
3801
|
+
position: absolute;
|
|
3802
|
+
z-index: 2147483647;
|
|
3803
|
+
pointer-events: none;
|
|
3804
|
+
}`, CSS_LAYER.ui);
|
|
3805
|
+
appendStylesheetTo(frameDoc, blockMenuStylesheetUrl, `block-menu-${CSS_LAYER.ui}`);
|
|
3806
|
+
const { hide: blockMenuHide } = createBlockMenu(blockMenuEl, engine);
|
|
3807
|
+
this.blockMenu = {
|
|
3808
|
+
el: blockMenuEl,
|
|
3809
|
+
hide: () => {
|
|
3810
|
+
blockMenuEl.hidden = true;
|
|
3811
|
+
blockMenuHide();
|
|
3812
|
+
},
|
|
3813
|
+
};
|
|
3885
3814
|
this.insertionPoint = new InsertionPoint(this.#engine);
|
|
3886
|
-
|
|
3887
|
-
|
|
3815
|
+
const onInsert = () => {
|
|
3816
|
+
if (this.#engine.isProcessed) {
|
|
3817
|
+
return;
|
|
3818
|
+
}
|
|
3819
|
+
this.#insertionButton.hide();
|
|
3820
|
+
this.insertionPoint.set(null, false);
|
|
3821
|
+
this.#engine.blockCatalogDialog.open();
|
|
3822
|
+
};
|
|
3823
|
+
if (createInitialInsertionButton) {
|
|
3824
|
+
const buttonEl = frameDoc.createElement('div');
|
|
3825
|
+
buttonEl.dataset.bgeComponent = 'initial-insertion';
|
|
3826
|
+
createInitialInsertionButton(buttonEl, onInsert);
|
|
3827
|
+
this.#insertionButton = {
|
|
3828
|
+
el: buttonEl,
|
|
3829
|
+
show: () => {
|
|
3830
|
+
buttonEl.hidden = false;
|
|
3831
|
+
},
|
|
3832
|
+
hide: () => {
|
|
3833
|
+
buttonEl.hidden = true;
|
|
3834
|
+
},
|
|
3835
|
+
};
|
|
3836
|
+
}
|
|
3837
|
+
else {
|
|
3838
|
+
this.#insertionButton = new InitialInsertionButton(this.insertionPoint, this.#engine, () => this.#engine.blockCatalogDialog.open());
|
|
3839
|
+
}
|
|
3840
|
+
const els = frameDoc.createDocumentFragment();
|
|
3888
3841
|
els.append(this.blockMenu.el);
|
|
3889
3842
|
els.append(this.#insertionButton.el);
|
|
3890
3843
|
els.append(this.#containerElement);
|
|
3891
|
-
|
|
3844
|
+
frameDoc.body.append(els);
|
|
3892
3845
|
window.addEventListener('resize', this.#setHeightTrigger.bind(this), true);
|
|
3893
3846
|
// eslint-disable-next-line no-restricted-syntax
|
|
3894
3847
|
window.addEventListener('DOMContentLoaded', this.#setHeightTrigger.bind(this), false);
|
|
@@ -3896,7 +3849,7 @@ class EditableArea extends EditorUI {
|
|
|
3896
3849
|
this.#frameElement.contentWindow.addEventListener('resize', this.#setHeightTrigger.bind(this), true);
|
|
3897
3850
|
// eslint-disable-next-line no-restricted-syntax
|
|
3898
3851
|
this.#frameElement.contentWindow.addEventListener('DOMContentLoaded', this.#setHeightTrigger.bind(this), false);
|
|
3899
|
-
|
|
3852
|
+
frameDoc.addEventListener('load', this.#setHeightTrigger.bind(this), true);
|
|
3900
3853
|
this.#sourceTextarea.addEventListener('blur', this.#saveSource.bind(this), false);
|
|
3901
3854
|
}
|
|
3902
3855
|
async copyTo(editableArea) {
|
|
@@ -3987,12 +3940,42 @@ class EditableArea extends EditorUI {
|
|
|
3987
3940
|
this.#sourceTextarea.hidden = !!visualMode;
|
|
3988
3941
|
this.#sourceTextarea.disabled = !!visualMode;
|
|
3989
3942
|
}
|
|
3990
|
-
static async new(type, initialContent, engine, createBlockMenu, stylesheets, classList) {
|
|
3991
|
-
const editableArea = new EditableArea(type, initialContent, engine, createBlockMenu, stylesheets, classList);
|
|
3943
|
+
static async new(type, initialContent, engine, createBlockMenu, createInitialInsertionButton, stylesheets, classList, createShell) {
|
|
3944
|
+
const editableArea = new EditableArea(type, initialContent, engine, createBlockMenu, createInitialInsertionButton, stylesheets, classList, createShell);
|
|
3992
3945
|
await editableArea.#init();
|
|
3993
3946
|
return editableArea;
|
|
3994
3947
|
}
|
|
3995
3948
|
}
|
|
3949
|
+
/**
|
|
3950
|
+
*
|
|
3951
|
+
* @param initialContent
|
|
3952
|
+
* @param classList
|
|
3953
|
+
*/
|
|
3954
|
+
function createDefaultEditableAreaShell(initialContent, classList) {
|
|
3955
|
+
const viewNode = document.createElement('div');
|
|
3956
|
+
const sourceTextarea = document.createElement('textarea');
|
|
3957
|
+
sourceTextarea.spellcheck = false;
|
|
3958
|
+
viewNode.append(sourceTextarea);
|
|
3959
|
+
const frameElement = document.createElement('iframe');
|
|
3960
|
+
frameElement.setAttribute('width', '100%;');
|
|
3961
|
+
frameElement.setAttribute('scrolling', 'no');
|
|
3962
|
+
viewNode.append(frameElement);
|
|
3963
|
+
const containerElement = document.createElement('div');
|
|
3964
|
+
containerElement.id = CONTENT_ID;
|
|
3965
|
+
containerElement.style.setProperty('padding', `${CONTAINER_PADDING}px`, 'important');
|
|
3966
|
+
containerElement.style.setProperty('overflow', 'hidden', 'important');
|
|
3967
|
+
containerElement.style.setProperty('margin', '0', 'important');
|
|
3968
|
+
containerElement.style.setProperty('box-sizing', 'border-box', 'important');
|
|
3969
|
+
containerElement.classList.add(...classList);
|
|
3970
|
+
containerElement.innerHTML = initialContent;
|
|
3971
|
+
containerElement.dataset.bgeComponent = 'editable-area';
|
|
3972
|
+
return {
|
|
3973
|
+
viewNode,
|
|
3974
|
+
frameElement,
|
|
3975
|
+
sourceTextarea,
|
|
3976
|
+
containerElement,
|
|
3977
|
+
};
|
|
3978
|
+
}
|
|
3996
3979
|
|
|
3997
3980
|
/**
|
|
3998
3981
|
*
|
|
@@ -4219,7 +4202,7 @@ class ItemEditorDialog extends EditorDialog {
|
|
|
4219
4202
|
return this.#componentObserver();
|
|
4220
4203
|
}
|
|
4221
4204
|
constructor(settings) {
|
|
4222
|
-
super('item-editor',
|
|
4205
|
+
super('item-editor', settings, {
|
|
4223
4206
|
buttons: {
|
|
4224
4207
|
close: 'キャンセル',
|
|
4225
4208
|
complete: '決定',
|
|
@@ -4513,6 +4496,7 @@ class BurgerEditorEngine {
|
|
|
4513
4496
|
}
|
|
4514
4497
|
return;
|
|
4515
4498
|
},
|
|
4499
|
+
createDialogShell: options.dialogShell,
|
|
4516
4500
|
};
|
|
4517
4501
|
this.blockCatalogDialog = new BlockCatalogDialog(options.catalog, {
|
|
4518
4502
|
...dialogSettings,
|
|
@@ -4776,13 +4760,13 @@ class BurgerEditorEngine {
|
|
|
4776
4760
|
// @ts-ignore force assign to readonly property
|
|
4777
4761
|
engine.#main =
|
|
4778
4762
|
//
|
|
4779
|
-
await EditableArea.new('main', mainInitialContent, engine, options.blockMenu, stylesheets, options.config.classList);
|
|
4763
|
+
await EditableArea.new('main', mainInitialContent, engine, options.blockMenu, options.initialInsertionButton, stylesheets, options.config.classList, options.editableAreaShell);
|
|
4780
4764
|
const draftInitialContent = typeof options.initialContents === 'string' ? null : options.initialContents.draft;
|
|
4781
4765
|
// @ts-ignore force assign to readonly property
|
|
4782
4766
|
engine.#draft =
|
|
4783
4767
|
draftInitialContent == null
|
|
4784
4768
|
? null
|
|
4785
|
-
: await EditableArea.new('draft', draftInitialContent, engine, options.blockMenu, stylesheets, options.config.classList);
|
|
4769
|
+
: await EditableArea.new('draft', draftInitialContent, engine, options.blockMenu, options.initialInsertionButton, stylesheets, options.config.classList, options.editableAreaShell);
|
|
4786
4770
|
engine.#current = engine.#main;
|
|
4787
4771
|
engine.showMain();
|
|
4788
4772
|
engine.save();
|
|
@@ -4799,6 +4783,50 @@ class BurgerEditorEngine {
|
|
|
4799
4783
|
}
|
|
4800
4784
|
}
|
|
4801
4785
|
|
|
4786
|
+
const getCSSPropertyAsNumberCache = new Map();
|
|
4787
|
+
/**
|
|
4788
|
+
*
|
|
4789
|
+
* @param el
|
|
4790
|
+
* @param property
|
|
4791
|
+
*/
|
|
4792
|
+
function getCSSPropertyAsNumber(el, property) {
|
|
4793
|
+
const value = window.getComputedStyle(el).getPropertyValue(property);
|
|
4794
|
+
if (value === '') {
|
|
4795
|
+
return 0;
|
|
4796
|
+
}
|
|
4797
|
+
const cached = getCSSPropertyAsNumberCache.get(value);
|
|
4798
|
+
if (cached !== undefined) {
|
|
4799
|
+
return cached;
|
|
4800
|
+
}
|
|
4801
|
+
const i_or_nan = Number.parseInt(value, 10);
|
|
4802
|
+
const result = Number.isNaN(i_or_nan) ? 0 : i_or_nan;
|
|
4803
|
+
getCSSPropertyAsNumberCache.set(value, result);
|
|
4804
|
+
return result;
|
|
4805
|
+
}
|
|
4806
|
+
|
|
4807
|
+
/**
|
|
4808
|
+
*
|
|
4809
|
+
* @param doc
|
|
4810
|
+
* @param x
|
|
4811
|
+
* @param y
|
|
4812
|
+
*/
|
|
4813
|
+
function getBlockAtPosition(doc, x, y) {
|
|
4814
|
+
const blocks = doc.body.querySelectorAll('[data-bge-container]');
|
|
4815
|
+
for (const $block of blocks) {
|
|
4816
|
+
const rect = $block.getBoundingClientRect();
|
|
4817
|
+
const marginBlockEnd = getCSSPropertyAsNumber($block, 'margin-block-end');
|
|
4818
|
+
const onMouse = rect.left <= x &&
|
|
4819
|
+
x <= rect.right &&
|
|
4820
|
+
rect.top <= y &&
|
|
4821
|
+
y <= rect.bottom + marginBlockEnd;
|
|
4822
|
+
if (onMouse) {
|
|
4823
|
+
const block = BurgerBlock.getBlock($block);
|
|
4824
|
+
return { block, rect, marginBlockEnd };
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4827
|
+
return null;
|
|
4828
|
+
}
|
|
4829
|
+
|
|
4802
4830
|
const IconAlignBoxCenterStretch = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-align-box-center-stretch\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M3 19v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2\" />\n <path d=\"M11 17h2\" />\n <path d=\"M9 12h6\" />\n <path d=\"M10 7h4\" />\n</svg>";
|
|
4803
4831
|
|
|
4804
4832
|
const IconAlignCenter = "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-align-center\"\n>\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M4 6l16 0\" />\n <path d=\"M8 12l8 0\" />\n <path d=\"M6 18l12 0\" />\n</svg>";
|
|
@@ -19777,6 +19805,9 @@ function getAttributesFromExtensions(extensions) {
|
|
|
19777
19805
|
keepOnSplit: true,
|
|
19778
19806
|
isRequired: false
|
|
19779
19807
|
};
|
|
19808
|
+
const nodeExtensionTypes = nodeExtensions.filter((ext) => ext.name !== "text").map((ext) => ext.name);
|
|
19809
|
+
const markExtensionTypes = markExtensions.map((ext) => ext.name);
|
|
19810
|
+
const allExtensionTypes = [...nodeExtensionTypes, ...markExtensionTypes];
|
|
19780
19811
|
extensions.forEach((extension) => {
|
|
19781
19812
|
const context = {
|
|
19782
19813
|
name: extension.name,
|
|
@@ -19794,7 +19825,19 @@ function getAttributesFromExtensions(extensions) {
|
|
|
19794
19825
|
}
|
|
19795
19826
|
const globalAttributes = addGlobalAttributes();
|
|
19796
19827
|
globalAttributes.forEach((globalAttribute) => {
|
|
19797
|
-
|
|
19828
|
+
let resolvedTypes;
|
|
19829
|
+
if (Array.isArray(globalAttribute.types)) {
|
|
19830
|
+
resolvedTypes = globalAttribute.types;
|
|
19831
|
+
} else if (globalAttribute.types === "*") {
|
|
19832
|
+
resolvedTypes = allExtensionTypes;
|
|
19833
|
+
} else if (globalAttribute.types === "nodes") {
|
|
19834
|
+
resolvedTypes = nodeExtensionTypes;
|
|
19835
|
+
} else if (globalAttribute.types === "marks") {
|
|
19836
|
+
resolvedTypes = markExtensionTypes;
|
|
19837
|
+
} else {
|
|
19838
|
+
resolvedTypes = [];
|
|
19839
|
+
}
|
|
19840
|
+
resolvedTypes.forEach((type) => {
|
|
19798
19841
|
Object.entries(globalAttribute.attributes).forEach(([name, attribute]) => {
|
|
19799
19842
|
extensionAttributes.push({
|
|
19800
19843
|
type,
|
|
@@ -20334,6 +20377,9 @@ function isMarkActive(state, typeOrName, attributes = {}) {
|
|
|
20334
20377
|
const from = $from.pos;
|
|
20335
20378
|
const to = $to.pos;
|
|
20336
20379
|
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
20380
|
+
if (type && node.inlineContent && !node.type.allowsMarkType(type)) {
|
|
20381
|
+
return false;
|
|
20382
|
+
}
|
|
20337
20383
|
if (!node.isText && !node.marks.length) {
|
|
20338
20384
|
return;
|
|
20339
20385
|
}
|
|
@@ -21894,6 +21940,39 @@ var ExtensionManager = class {
|
|
|
21894
21940
|
};
|
|
21895
21941
|
}, baseDispatch);
|
|
21896
21942
|
}
|
|
21943
|
+
/**
|
|
21944
|
+
* Get the composed transformPastedHTML function from all extensions.
|
|
21945
|
+
* @param baseTransform The base transform function (e.g. from the editor props)
|
|
21946
|
+
* @returns A composed transform function that chains all extension transforms
|
|
21947
|
+
*/
|
|
21948
|
+
transformPastedHTML(baseTransform) {
|
|
21949
|
+
const { editor } = this;
|
|
21950
|
+
const extensions = sortExtensions([...this.extensions]);
|
|
21951
|
+
return extensions.reduce(
|
|
21952
|
+
(transform, extension) => {
|
|
21953
|
+
const context = {
|
|
21954
|
+
name: extension.name,
|
|
21955
|
+
options: extension.options,
|
|
21956
|
+
storage: this.editor.extensionStorage[extension.name],
|
|
21957
|
+
editor,
|
|
21958
|
+
type: getSchemaTypeByName(extension.name, this.schema)
|
|
21959
|
+
};
|
|
21960
|
+
const extensionTransform = getExtensionField(
|
|
21961
|
+
extension,
|
|
21962
|
+
"transformPastedHTML",
|
|
21963
|
+
context
|
|
21964
|
+
);
|
|
21965
|
+
if (!extensionTransform) {
|
|
21966
|
+
return transform;
|
|
21967
|
+
}
|
|
21968
|
+
return (html, view) => {
|
|
21969
|
+
const transformedHtml = transform(html, view);
|
|
21970
|
+
return extensionTransform.call(context, transformedHtml);
|
|
21971
|
+
};
|
|
21972
|
+
},
|
|
21973
|
+
baseTransform || ((html) => html)
|
|
21974
|
+
);
|
|
21975
|
+
}
|
|
21897
21976
|
get markViews() {
|
|
21898
21977
|
const { editor } = this;
|
|
21899
21978
|
const { markExtensions } = splitExtensions(this.extensions);
|
|
@@ -22889,7 +22968,7 @@ var Editor = class extends EventEmitter {
|
|
|
22889
22968
|
return this.options.editable && this.view && this.view.editable;
|
|
22890
22969
|
}
|
|
22891
22970
|
/**
|
|
22892
|
-
* Returns the editor
|
|
22971
|
+
* Returns the editor view.
|
|
22893
22972
|
*/
|
|
22894
22973
|
get view() {
|
|
22895
22974
|
if (this.editorView) {
|
|
@@ -23057,6 +23136,8 @@ var Editor = class extends EventEmitter {
|
|
|
23057
23136
|
const { editorProps, enableExtensionDispatchTransaction } = this.options;
|
|
23058
23137
|
const baseDispatch = editorProps.dispatchTransaction || this.dispatchTransaction.bind(this);
|
|
23059
23138
|
const dispatch = enableExtensionDispatchTransaction ? this.extensionManager.dispatchTransaction(baseDispatch) : baseDispatch;
|
|
23139
|
+
const baseTransformPastedHTML = editorProps.transformPastedHTML;
|
|
23140
|
+
const transformPastedHTML = this.extensionManager.transformPastedHTML(baseTransformPastedHTML);
|
|
23060
23141
|
this.editorView = new EditorView(element, {
|
|
23061
23142
|
...editorProps,
|
|
23062
23143
|
attributes: {
|
|
@@ -23065,6 +23146,7 @@ var Editor = class extends EventEmitter {
|
|
|
23065
23146
|
...editorProps == null ? void 0 : editorProps.attributes
|
|
23066
23147
|
},
|
|
23067
23148
|
dispatchTransaction: dispatch,
|
|
23149
|
+
transformPastedHTML,
|
|
23068
23150
|
state: this.editorState,
|
|
23069
23151
|
markViews: this.extensionManager.markViews,
|
|
23070
23152
|
nodeViews: this.extensionManager.nodeViews
|
|
@@ -34703,18 +34785,6 @@ if (typeof window !== 'undefined') {
|
|
|
34703
34785
|
((window.__svelte ??= {}).v ??= new Set()).add(PUBLIC_VERSION);
|
|
34704
34786
|
}
|
|
34705
34787
|
|
|
34706
|
-
/** True if experimental.async=true */
|
|
34707
|
-
/** True if we're not certain that we only have Svelte 5 code in the compilation */
|
|
34708
|
-
let legacy_mode_flag = false;
|
|
34709
|
-
/** True if $inspect.trace is used */
|
|
34710
|
-
let tracing_mode_flag = false;
|
|
34711
|
-
|
|
34712
|
-
function enable_legacy_mode_flag() {
|
|
34713
|
-
legacy_mode_flag = true;
|
|
34714
|
-
}
|
|
34715
|
-
|
|
34716
|
-
enable_legacy_mode_flag();
|
|
34717
|
-
|
|
34718
34788
|
const EACH_ITEM_REACTIVE = 1;
|
|
34719
34789
|
const EACH_INDEX_REACTIVE = 1 << 1;
|
|
34720
34790
|
/** See EachBlock interface metadata.is_controlled for an explanation what this is */
|
|
@@ -34735,6 +34805,7 @@ const UNINITIALIZED = Symbol();
|
|
|
34735
34805
|
|
|
34736
34806
|
const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml';
|
|
34737
34807
|
const NAMESPACE_SVG = 'http://www.w3.org/2000/svg';
|
|
34808
|
+
const NAMESPACE_MATHML = 'http://www.w3.org/1998/Math/MathML';
|
|
34738
34809
|
|
|
34739
34810
|
const ATTACHMENT_KEY = '@attach';
|
|
34740
34811
|
|
|
@@ -34900,21 +34971,10 @@ const STALE_REACTION = new (class StaleReactionError extends Error {
|
|
|
34900
34971
|
message = 'The reaction that called `getAbortSignal()` was re-run or destroyed';
|
|
34901
34972
|
})();
|
|
34902
34973
|
|
|
34903
|
-
const IS_XHTML =
|
|
34904
|
-
|
|
34905
|
-
|
|
34906
|
-
|
|
34907
|
-
|
|
34908
|
-
/**
|
|
34909
|
-
* `%name%(...)` can only be used during component initialisation
|
|
34910
|
-
* @param {string} name
|
|
34911
|
-
* @returns {never}
|
|
34912
|
-
*/
|
|
34913
|
-
function lifecycle_outside_component(name) {
|
|
34914
|
-
{
|
|
34915
|
-
throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
|
|
34916
|
-
}
|
|
34917
|
-
}
|
|
34974
|
+
const IS_XHTML =
|
|
34975
|
+
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
|
|
34976
|
+
!!globalThis.document?.contentType &&
|
|
34977
|
+
/* @__PURE__ */ globalThis.document.contentType.includes('xml');
|
|
34918
34978
|
|
|
34919
34979
|
/* This file is generated by scripts/process-messages/index.js. Do not edit! */
|
|
34920
34980
|
|
|
@@ -35079,6 +35139,16 @@ function safe_equals(value) {
|
|
|
35079
35139
|
return !safe_not_equal(value, this.v);
|
|
35080
35140
|
}
|
|
35081
35141
|
|
|
35142
|
+
/** True if experimental.async=true */
|
|
35143
|
+
/** True if we're not certain that we only have Svelte 5 code in the compilation */
|
|
35144
|
+
let legacy_mode_flag = false;
|
|
35145
|
+
/** True if $inspect.trace is used */
|
|
35146
|
+
let tracing_mode_flag = false;
|
|
35147
|
+
|
|
35148
|
+
function enable_legacy_mode_flag() {
|
|
35149
|
+
legacy_mode_flag = true;
|
|
35150
|
+
}
|
|
35151
|
+
|
|
35082
35152
|
/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
|
|
35083
35153
|
|
|
35084
35154
|
/** @type {ComponentContext | null} */
|
|
@@ -35295,7 +35365,6 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
|
|
|
35295
35365
|
|
|
35296
35366
|
/** @import { Fork } from 'svelte' */
|
|
35297
35367
|
/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
|
|
35298
|
-
/** @import { Boundary } from '../dom/blocks/boundary' */
|
|
35299
35368
|
|
|
35300
35369
|
/** @type {Set<Batch>} */
|
|
35301
35370
|
const batches = new Set();
|
|
@@ -35325,12 +35394,17 @@ let queued_root_effects = [];
|
|
|
35325
35394
|
/** @type {Effect | null} */
|
|
35326
35395
|
let last_scheduled_effect = null;
|
|
35327
35396
|
|
|
35328
|
-
let is_flushing = false;
|
|
35329
35397
|
let is_flushing_sync = false;
|
|
35330
35398
|
|
|
35331
|
-
|
|
35332
|
-
|
|
35399
|
+
/**
|
|
35400
|
+
* During traversal, this is an array. Newly created effects are (if not immediately
|
|
35401
|
+
* executed) pushed to this array, rather than going through the scheduling
|
|
35402
|
+
* rigamarole that would cause another turn of the flush loop.
|
|
35403
|
+
* @type {Effect[] | null}
|
|
35404
|
+
*/
|
|
35405
|
+
let collected_effects = null;
|
|
35333
35406
|
|
|
35407
|
+
class Batch {
|
|
35334
35408
|
/**
|
|
35335
35409
|
* The current values of any sources that are updated in this batch
|
|
35336
35410
|
* They keys of this map are identical to `this.#previous`
|
|
@@ -35348,7 +35422,7 @@ class Batch {
|
|
|
35348
35422
|
/**
|
|
35349
35423
|
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
35350
35424
|
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
35351
|
-
* @type {Set<() => void>}
|
|
35425
|
+
* @type {Set<(batch: Batch) => void>}
|
|
35352
35426
|
*/
|
|
35353
35427
|
#commit_callbacks = new Set();
|
|
35354
35428
|
|
|
@@ -35400,7 +35474,7 @@ class Batch {
|
|
|
35400
35474
|
|
|
35401
35475
|
#decrement_queued = false;
|
|
35402
35476
|
|
|
35403
|
-
is_deferred() {
|
|
35477
|
+
#is_deferred() {
|
|
35404
35478
|
return this.is_fork || this.#blocking_pending > 0;
|
|
35405
35479
|
}
|
|
35406
35480
|
|
|
@@ -35446,7 +35520,7 @@ class Batch {
|
|
|
35446
35520
|
this.apply();
|
|
35447
35521
|
|
|
35448
35522
|
/** @type {Effect[]} */
|
|
35449
|
-
var effects = [];
|
|
35523
|
+
var effects = (collected_effects = []);
|
|
35450
35524
|
|
|
35451
35525
|
/** @type {Effect[]} */
|
|
35452
35526
|
var render_effects = [];
|
|
@@ -35460,7 +35534,9 @@ class Batch {
|
|
|
35460
35534
|
// log_inconsistent_branches(root);
|
|
35461
35535
|
}
|
|
35462
35536
|
|
|
35463
|
-
|
|
35537
|
+
collected_effects = null;
|
|
35538
|
+
|
|
35539
|
+
if (this.#is_deferred()) {
|
|
35464
35540
|
this.#defer_effects(render_effects);
|
|
35465
35541
|
this.#defer_effects(effects);
|
|
35466
35542
|
|
|
@@ -35468,22 +35544,26 @@ class Batch {
|
|
|
35468
35544
|
reset_branch(e, t);
|
|
35469
35545
|
}
|
|
35470
35546
|
} else {
|
|
35547
|
+
// If sources are written to, then work needs to happen in a separate batch, else prior sources would be mixed with
|
|
35548
|
+
// newly updated sources, which could lead to infinite loops when effects run over and over again.
|
|
35549
|
+
previous_batch = this;
|
|
35550
|
+
current_batch = null;
|
|
35551
|
+
|
|
35471
35552
|
// append/remove branches
|
|
35472
|
-
for (const fn of this.#commit_callbacks) fn();
|
|
35553
|
+
for (const fn of this.#commit_callbacks) fn(this);
|
|
35473
35554
|
this.#commit_callbacks.clear();
|
|
35474
35555
|
|
|
35475
35556
|
if (this.#pending === 0) {
|
|
35476
35557
|
this.#commit();
|
|
35477
35558
|
}
|
|
35478
35559
|
|
|
35479
|
-
// If sources are written to, then work needs to happen in a separate batch, else prior sources would be mixed with
|
|
35480
|
-
// newly updated sources, which could lead to infinite loops when effects run over and over again.
|
|
35481
|
-
previous_batch = this;
|
|
35482
|
-
current_batch = null;
|
|
35483
|
-
|
|
35484
35560
|
flush_queued_effects(render_effects);
|
|
35485
35561
|
flush_queued_effects(effects);
|
|
35486
35562
|
|
|
35563
|
+
// Clear effects. Those that are still needed will be rescheduled through unskipping the skipped branches.
|
|
35564
|
+
this.#dirty_effects.clear();
|
|
35565
|
+
this.#maybe_dirty_effects.clear();
|
|
35566
|
+
|
|
35487
35567
|
previous_batch = null;
|
|
35488
35568
|
|
|
35489
35569
|
this.#deferred?.resolve();
|
|
@@ -35504,9 +35584,6 @@ class Batch {
|
|
|
35504
35584
|
|
|
35505
35585
|
var effect = root.first;
|
|
35506
35586
|
|
|
35507
|
-
/** @type {Effect | null} */
|
|
35508
|
-
var pending_boundary = null;
|
|
35509
|
-
|
|
35510
35587
|
while (effect !== null) {
|
|
35511
35588
|
var flags = effect.f;
|
|
35512
35589
|
var is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
|
|
@@ -35517,11 +35594,6 @@ class Batch {
|
|
|
35517
35594
|
if (!skip && effect.fn !== null) {
|
|
35518
35595
|
if (is_branch) {
|
|
35519
35596
|
effect.f ^= CLEAN;
|
|
35520
|
-
} else if (
|
|
35521
|
-
pending_boundary !== null &&
|
|
35522
|
-
(flags & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0
|
|
35523
|
-
) {
|
|
35524
|
-
/** @type {Boundary} */ (pending_boundary.b).defer_effect(effect);
|
|
35525
35597
|
} else if ((flags & EFFECT) !== 0) {
|
|
35526
35598
|
effects.push(effect);
|
|
35527
35599
|
} else if (is_dirty(effect)) {
|
|
@@ -35537,16 +35609,15 @@ class Batch {
|
|
|
35537
35609
|
}
|
|
35538
35610
|
}
|
|
35539
35611
|
|
|
35540
|
-
|
|
35541
|
-
|
|
35612
|
+
while (effect !== null) {
|
|
35613
|
+
var next = effect.next;
|
|
35542
35614
|
|
|
35543
|
-
|
|
35544
|
-
|
|
35545
|
-
|
|
35615
|
+
if (next !== null) {
|
|
35616
|
+
effect = next;
|
|
35617
|
+
break;
|
|
35546
35618
|
}
|
|
35547
35619
|
|
|
35548
|
-
effect = parent
|
|
35549
|
-
parent = parent.parent;
|
|
35620
|
+
effect = effect.parent;
|
|
35550
35621
|
}
|
|
35551
35622
|
}
|
|
35552
35623
|
}
|
|
@@ -35593,17 +35664,16 @@ class Batch {
|
|
|
35593
35664
|
}
|
|
35594
35665
|
|
|
35595
35666
|
flush() {
|
|
35596
|
-
this.activate();
|
|
35597
|
-
|
|
35598
35667
|
if (queued_root_effects.length > 0) {
|
|
35668
|
+
current_batch = this;
|
|
35599
35669
|
flush_effects();
|
|
35670
|
+
} else if (this.#pending === 0 && !this.is_fork) {
|
|
35671
|
+
// append/remove branches
|
|
35672
|
+
for (const fn of this.#commit_callbacks) fn(this);
|
|
35673
|
+
this.#commit_callbacks.clear();
|
|
35600
35674
|
|
|
35601
|
-
|
|
35602
|
-
|
|
35603
|
-
return;
|
|
35604
|
-
}
|
|
35605
|
-
} else if (this.#pending === 0) {
|
|
35606
|
-
this.process([]); // TODO this feels awkward
|
|
35675
|
+
this.#commit();
|
|
35676
|
+
this.#deferred?.resolve();
|
|
35607
35677
|
}
|
|
35608
35678
|
|
|
35609
35679
|
this.deactivate();
|
|
@@ -35622,6 +35692,7 @@ class Batch {
|
|
|
35622
35692
|
if (batches.size > 1) {
|
|
35623
35693
|
this.previous.clear();
|
|
35624
35694
|
|
|
35695
|
+
var previous_batch = current_batch;
|
|
35625
35696
|
var previous_batch_values = batch_values;
|
|
35626
35697
|
var is_earlier = true;
|
|
35627
35698
|
|
|
@@ -35685,11 +35756,11 @@ class Batch {
|
|
|
35685
35756
|
}
|
|
35686
35757
|
}
|
|
35687
35758
|
|
|
35688
|
-
current_batch =
|
|
35759
|
+
current_batch = previous_batch;
|
|
35689
35760
|
batch_values = previous_batch_values;
|
|
35690
35761
|
}
|
|
35691
35762
|
|
|
35692
|
-
this.
|
|
35763
|
+
this.#skipped_branches.clear();
|
|
35693
35764
|
batches.delete(this);
|
|
35694
35765
|
}
|
|
35695
35766
|
|
|
@@ -35716,7 +35787,7 @@ class Batch {
|
|
|
35716
35787
|
queue_micro_task(() => {
|
|
35717
35788
|
this.#decrement_queued = false;
|
|
35718
35789
|
|
|
35719
|
-
if (!this
|
|
35790
|
+
if (!this.#is_deferred()) {
|
|
35720
35791
|
// we only reschedule previously-deferred effects if we expect
|
|
35721
35792
|
// to be able to run them after processing the batch
|
|
35722
35793
|
this.revive();
|
|
@@ -35743,7 +35814,7 @@ class Batch {
|
|
|
35743
35814
|
this.flush();
|
|
35744
35815
|
}
|
|
35745
35816
|
|
|
35746
|
-
/** @param {() => void} fn */
|
|
35817
|
+
/** @param {(batch: Batch) => void} fn */
|
|
35747
35818
|
oncommit(fn) {
|
|
35748
35819
|
this.#commit_callbacks.add(fn);
|
|
35749
35820
|
}
|
|
@@ -35822,8 +35893,6 @@ function flushSync(fn) {
|
|
|
35822
35893
|
}
|
|
35823
35894
|
|
|
35824
35895
|
function flush_effects() {
|
|
35825
|
-
is_flushing = true;
|
|
35826
|
-
|
|
35827
35896
|
var source_stacks = null;
|
|
35828
35897
|
|
|
35829
35898
|
try {
|
|
@@ -35846,8 +35915,8 @@ function flush_effects() {
|
|
|
35846
35915
|
} finally {
|
|
35847
35916
|
queued_root_effects = [];
|
|
35848
35917
|
|
|
35849
|
-
is_flushing = false;
|
|
35850
35918
|
last_scheduled_effect = null;
|
|
35919
|
+
collected_effects = null;
|
|
35851
35920
|
}
|
|
35852
35921
|
}
|
|
35853
35922
|
|
|
@@ -36001,6 +36070,19 @@ function depends_on(reaction, sources, checked) {
|
|
|
36001
36070
|
function schedule_effect(signal) {
|
|
36002
36071
|
var effect = (last_scheduled_effect = signal);
|
|
36003
36072
|
|
|
36073
|
+
var boundary = effect.b;
|
|
36074
|
+
|
|
36075
|
+
// defer render effects inside a pending boundary
|
|
36076
|
+
// TODO the `REACTION_RAN` check is only necessary because of legacy `$:` effects AFAICT — we can remove later
|
|
36077
|
+
if (
|
|
36078
|
+
boundary?.is_pending &&
|
|
36079
|
+
(signal.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 &&
|
|
36080
|
+
(signal.f & REACTION_RAN) === 0
|
|
36081
|
+
) {
|
|
36082
|
+
boundary.defer_effect(signal);
|
|
36083
|
+
return;
|
|
36084
|
+
}
|
|
36085
|
+
|
|
36004
36086
|
while (effect.parent !== null) {
|
|
36005
36087
|
effect = effect.parent;
|
|
36006
36088
|
var flags = effect.f;
|
|
@@ -36008,17 +36090,21 @@ function schedule_effect(signal) {
|
|
|
36008
36090
|
// if the effect is being scheduled because a parent (each/await/etc) block
|
|
36009
36091
|
// updated an internal source, or because a branch is being unskipped,
|
|
36010
36092
|
// bail out or we'll cause a second flush
|
|
36011
|
-
if (
|
|
36012
|
-
|
|
36013
|
-
|
|
36014
|
-
|
|
36015
|
-
(
|
|
36016
|
-
|
|
36017
|
-
|
|
36093
|
+
if (collected_effects !== null && effect === active_effect) {
|
|
36094
|
+
// in sync mode, render effects run during traversal. in an extreme edge case
|
|
36095
|
+
// they can be made dirty after they have already been visited, in which
|
|
36096
|
+
// case we shouldn't bail out
|
|
36097
|
+
if ((signal.f & RENDER_EFFECT) === 0) {
|
|
36098
|
+
return;
|
|
36099
|
+
}
|
|
36018
36100
|
}
|
|
36019
36101
|
|
|
36020
36102
|
if ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
|
|
36021
|
-
if ((flags & CLEAN) === 0)
|
|
36103
|
+
if ((flags & CLEAN) === 0) {
|
|
36104
|
+
// branch is already dirty, bail
|
|
36105
|
+
return;
|
|
36106
|
+
}
|
|
36107
|
+
|
|
36022
36108
|
effect.f ^= CLEAN;
|
|
36023
36109
|
}
|
|
36024
36110
|
}
|
|
@@ -36149,16 +36235,17 @@ function createSubscriber(start) {
|
|
|
36149
36235
|
* }} BoundaryProps
|
|
36150
36236
|
*/
|
|
36151
36237
|
|
|
36152
|
-
var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED
|
|
36238
|
+
var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
|
|
36153
36239
|
|
|
36154
36240
|
/**
|
|
36155
36241
|
* @param {TemplateNode} node
|
|
36156
36242
|
* @param {BoundaryProps} props
|
|
36157
36243
|
* @param {((anchor: Node) => void)} children
|
|
36244
|
+
* @param {((error: unknown) => unknown) | undefined} [transform_error]
|
|
36158
36245
|
* @returns {void}
|
|
36159
36246
|
*/
|
|
36160
|
-
function boundary(node, props, children) {
|
|
36161
|
-
new Boundary(node, props, children);
|
|
36247
|
+
function boundary(node, props, children, transform_error) {
|
|
36248
|
+
new Boundary(node, props, children, transform_error);
|
|
36162
36249
|
}
|
|
36163
36250
|
|
|
36164
36251
|
class Boundary {
|
|
@@ -36167,6 +36254,13 @@ class Boundary {
|
|
|
36167
36254
|
|
|
36168
36255
|
is_pending = false;
|
|
36169
36256
|
|
|
36257
|
+
/**
|
|
36258
|
+
* API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
|
|
36259
|
+
* Inherited from parent boundary, or defaults to identity.
|
|
36260
|
+
* @type {(error: unknown) => unknown}
|
|
36261
|
+
*/
|
|
36262
|
+
transform_error;
|
|
36263
|
+
|
|
36170
36264
|
/** @type {TemplateNode} */
|
|
36171
36265
|
#anchor;
|
|
36172
36266
|
|
|
@@ -36194,15 +36288,10 @@ class Boundary {
|
|
|
36194
36288
|
/** @type {DocumentFragment | null} */
|
|
36195
36289
|
#offscreen_fragment = null;
|
|
36196
36290
|
|
|
36197
|
-
/** @type {TemplateNode | null} */
|
|
36198
|
-
#pending_anchor = null;
|
|
36199
|
-
|
|
36200
36291
|
#local_pending_count = 0;
|
|
36201
36292
|
#pending_count = 0;
|
|
36202
36293
|
#pending_count_update_queued = false;
|
|
36203
36294
|
|
|
36204
|
-
#is_creating_fallback = false;
|
|
36205
|
-
|
|
36206
36295
|
/** @type {Set<Effect>} */
|
|
36207
36296
|
#dirty_effects = new Set();
|
|
36208
36297
|
|
|
@@ -36230,38 +36319,30 @@ class Boundary {
|
|
|
36230
36319
|
* @param {TemplateNode} node
|
|
36231
36320
|
* @param {BoundaryProps} props
|
|
36232
36321
|
* @param {((anchor: Node) => void)} children
|
|
36322
|
+
* @param {((error: unknown) => unknown) | undefined} [transform_error]
|
|
36233
36323
|
*/
|
|
36234
|
-
constructor(node, props, children) {
|
|
36324
|
+
constructor(node, props, children, transform_error) {
|
|
36235
36325
|
this.#anchor = node;
|
|
36236
36326
|
this.#props = props;
|
|
36237
|
-
this.#children = children;
|
|
36238
36327
|
|
|
36239
|
-
this
|
|
36328
|
+
this.#children = (anchor) => {
|
|
36329
|
+
var effect = /** @type {Effect} */ (active_effect);
|
|
36240
36330
|
|
|
36241
|
-
|
|
36331
|
+
effect.b = this;
|
|
36332
|
+
effect.f |= BOUNDARY_EFFECT;
|
|
36242
36333
|
|
|
36243
|
-
|
|
36244
|
-
|
|
36334
|
+
children(anchor);
|
|
36335
|
+
};
|
|
36245
36336
|
|
|
36246
|
-
|
|
36247
|
-
var anchor = this.#get_anchor();
|
|
36337
|
+
this.parent = /** @type {Effect} */ (active_effect).b;
|
|
36248
36338
|
|
|
36249
|
-
|
|
36250
|
-
|
|
36251
|
-
} catch (error) {
|
|
36252
|
-
this.error(error);
|
|
36253
|
-
}
|
|
36339
|
+
// Inherit transform_error from parent boundary, or use the provided one, or default to identity
|
|
36340
|
+
this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
|
|
36254
36341
|
|
|
36255
|
-
|
|
36256
|
-
|
|
36257
|
-
|
|
36258
|
-
this.is_pending = false;
|
|
36259
|
-
}
|
|
36342
|
+
this.#effect = block(() => {
|
|
36343
|
+
{
|
|
36344
|
+
this.#render();
|
|
36260
36345
|
}
|
|
36261
|
-
|
|
36262
|
-
return () => {
|
|
36263
|
-
this.#pending_anchor?.remove();
|
|
36264
|
-
};
|
|
36265
36346
|
}, flags);
|
|
36266
36347
|
}
|
|
36267
36348
|
|
|
@@ -36273,43 +36354,95 @@ class Boundary {
|
|
|
36273
36354
|
}
|
|
36274
36355
|
}
|
|
36275
36356
|
|
|
36357
|
+
/**
|
|
36358
|
+
* @param {unknown} error The deserialized error from the server's hydration comment
|
|
36359
|
+
*/
|
|
36360
|
+
#hydrate_failed_content(error) {
|
|
36361
|
+
const failed = this.#props.failed;
|
|
36362
|
+
if (!failed) return;
|
|
36363
|
+
|
|
36364
|
+
this.#failed_effect = branch(() => {
|
|
36365
|
+
failed(
|
|
36366
|
+
this.#anchor,
|
|
36367
|
+
() => error,
|
|
36368
|
+
() => () => {}
|
|
36369
|
+
);
|
|
36370
|
+
});
|
|
36371
|
+
}
|
|
36372
|
+
|
|
36276
36373
|
#hydrate_pending_content() {
|
|
36277
36374
|
const pending = this.#props.pending;
|
|
36278
36375
|
if (!pending) return;
|
|
36279
36376
|
|
|
36377
|
+
this.is_pending = true;
|
|
36280
36378
|
this.#pending_effect = branch(() => pending(this.#anchor));
|
|
36281
36379
|
|
|
36282
36380
|
queue_micro_task(() => {
|
|
36283
|
-
var
|
|
36381
|
+
var fragment = (this.#offscreen_fragment = document.createDocumentFragment());
|
|
36382
|
+
var anchor = create_text();
|
|
36383
|
+
|
|
36384
|
+
fragment.append(anchor);
|
|
36284
36385
|
|
|
36285
36386
|
this.#main_effect = this.#run(() => {
|
|
36286
36387
|
Batch.ensure();
|
|
36287
36388
|
return branch(() => this.#children(anchor));
|
|
36288
36389
|
});
|
|
36289
36390
|
|
|
36290
|
-
if (this.#pending_count
|
|
36291
|
-
this.#
|
|
36292
|
-
|
|
36391
|
+
if (this.#pending_count === 0) {
|
|
36392
|
+
this.#anchor.before(fragment);
|
|
36393
|
+
this.#offscreen_fragment = null;
|
|
36394
|
+
|
|
36293
36395
|
pause_effect(/** @type {Effect} */ (this.#pending_effect), () => {
|
|
36294
36396
|
this.#pending_effect = null;
|
|
36295
36397
|
});
|
|
36296
36398
|
|
|
36297
|
-
this
|
|
36399
|
+
this.#resolve();
|
|
36298
36400
|
}
|
|
36299
36401
|
});
|
|
36300
36402
|
}
|
|
36301
36403
|
|
|
36302
|
-
#
|
|
36303
|
-
|
|
36404
|
+
#render() {
|
|
36405
|
+
try {
|
|
36406
|
+
this.is_pending = this.has_pending_snippet();
|
|
36407
|
+
this.#pending_count = 0;
|
|
36408
|
+
this.#local_pending_count = 0;
|
|
36409
|
+
|
|
36410
|
+
this.#main_effect = branch(() => {
|
|
36411
|
+
this.#children(this.#anchor);
|
|
36412
|
+
});
|
|
36304
36413
|
|
|
36305
|
-
|
|
36306
|
-
|
|
36307
|
-
|
|
36414
|
+
if (this.#pending_count > 0) {
|
|
36415
|
+
var fragment = (this.#offscreen_fragment = document.createDocumentFragment());
|
|
36416
|
+
move_effect(this.#main_effect, fragment);
|
|
36308
36417
|
|
|
36309
|
-
|
|
36418
|
+
const pending = /** @type {(anchor: Node) => void} */ (this.#props.pending);
|
|
36419
|
+
this.#pending_effect = branch(() => pending(this.#anchor));
|
|
36420
|
+
} else {
|
|
36421
|
+
this.#resolve();
|
|
36422
|
+
}
|
|
36423
|
+
} catch (error) {
|
|
36424
|
+
this.error(error);
|
|
36425
|
+
}
|
|
36426
|
+
}
|
|
36427
|
+
|
|
36428
|
+
#resolve() {
|
|
36429
|
+
this.is_pending = false;
|
|
36430
|
+
|
|
36431
|
+
// any effects that were previously deferred should be rescheduled —
|
|
36432
|
+
// after the next traversal (which will happen immediately, due to the
|
|
36433
|
+
// same update that brought us here) the effects will be flushed
|
|
36434
|
+
for (const e of this.#dirty_effects) {
|
|
36435
|
+
set_signal_status(e, DIRTY);
|
|
36436
|
+
schedule_effect(e);
|
|
36437
|
+
}
|
|
36438
|
+
|
|
36439
|
+
for (const e of this.#maybe_dirty_effects) {
|
|
36440
|
+
set_signal_status(e, MAYBE_DIRTY);
|
|
36441
|
+
schedule_effect(e);
|
|
36310
36442
|
}
|
|
36311
36443
|
|
|
36312
|
-
|
|
36444
|
+
this.#dirty_effects.clear();
|
|
36445
|
+
this.#maybe_dirty_effects.clear();
|
|
36313
36446
|
}
|
|
36314
36447
|
|
|
36315
36448
|
/**
|
|
@@ -36333,7 +36466,8 @@ class Boundary {
|
|
|
36333
36466
|
}
|
|
36334
36467
|
|
|
36335
36468
|
/**
|
|
36336
|
-
* @
|
|
36469
|
+
* @template T
|
|
36470
|
+
* @param {() => T} fn
|
|
36337
36471
|
*/
|
|
36338
36472
|
#run(fn) {
|
|
36339
36473
|
var previous_effect = active_effect;
|
|
@@ -36356,20 +36490,6 @@ class Boundary {
|
|
|
36356
36490
|
}
|
|
36357
36491
|
}
|
|
36358
36492
|
|
|
36359
|
-
#show_pending_snippet() {
|
|
36360
|
-
const pending = /** @type {(anchor: Node) => void} */ (this.#props.pending);
|
|
36361
|
-
|
|
36362
|
-
if (this.#main_effect !== null) {
|
|
36363
|
-
this.#offscreen_fragment = document.createDocumentFragment();
|
|
36364
|
-
this.#offscreen_fragment.append(/** @type {TemplateNode} */ (this.#pending_anchor));
|
|
36365
|
-
move_effect(this.#main_effect, this.#offscreen_fragment);
|
|
36366
|
-
}
|
|
36367
|
-
|
|
36368
|
-
if (this.#pending_effect === null) {
|
|
36369
|
-
this.#pending_effect = branch(() => pending(this.#anchor));
|
|
36370
|
-
}
|
|
36371
|
-
}
|
|
36372
|
-
|
|
36373
36493
|
/**
|
|
36374
36494
|
* Updates the pending count associated with the currently visible pending snippet,
|
|
36375
36495
|
* if any, such that we can replace the snippet with content once work is done
|
|
@@ -36388,24 +36508,7 @@ class Boundary {
|
|
|
36388
36508
|
this.#pending_count += d;
|
|
36389
36509
|
|
|
36390
36510
|
if (this.#pending_count === 0) {
|
|
36391
|
-
this
|
|
36392
|
-
|
|
36393
|
-
// any effects that were encountered and deferred during traversal
|
|
36394
|
-
// should be rescheduled — after the next traversal (which will happen
|
|
36395
|
-
// immediately, due to the same update that brought us here)
|
|
36396
|
-
// the effects will be flushed
|
|
36397
|
-
for (const e of this.#dirty_effects) {
|
|
36398
|
-
set_signal_status(e, DIRTY);
|
|
36399
|
-
schedule_effect(e);
|
|
36400
|
-
}
|
|
36401
|
-
|
|
36402
|
-
for (const e of this.#maybe_dirty_effects) {
|
|
36403
|
-
set_signal_status(e, MAYBE_DIRTY);
|
|
36404
|
-
schedule_effect(e);
|
|
36405
|
-
}
|
|
36406
|
-
|
|
36407
|
-
this.#dirty_effects.clear();
|
|
36408
|
-
this.#maybe_dirty_effects.clear();
|
|
36511
|
+
this.#resolve();
|
|
36409
36512
|
|
|
36410
36513
|
if (this.#pending_effect) {
|
|
36411
36514
|
pause_effect(this.#pending_effect, () => {
|
|
@@ -36454,7 +36557,7 @@ class Boundary {
|
|
|
36454
36557
|
|
|
36455
36558
|
// If we have nothing to capture the error, or if we hit an error while
|
|
36456
36559
|
// rendering the fallback, re-throw for another boundary to handle
|
|
36457
|
-
if (
|
|
36560
|
+
if (!onerror && !failed) {
|
|
36458
36561
|
throw error;
|
|
36459
36562
|
}
|
|
36460
36563
|
|
|
@@ -36488,37 +36591,25 @@ class Boundary {
|
|
|
36488
36591
|
svelte_boundary_reset_onerror();
|
|
36489
36592
|
}
|
|
36490
36593
|
|
|
36491
|
-
// If the failure happened while flushing effects, current_batch can be null
|
|
36492
|
-
Batch.ensure();
|
|
36493
|
-
|
|
36494
|
-
this.#local_pending_count = 0;
|
|
36495
|
-
|
|
36496
36594
|
if (this.#failed_effect !== null) {
|
|
36497
36595
|
pause_effect(this.#failed_effect, () => {
|
|
36498
36596
|
this.#failed_effect = null;
|
|
36499
36597
|
});
|
|
36500
36598
|
}
|
|
36501
36599
|
|
|
36502
|
-
|
|
36503
|
-
|
|
36504
|
-
|
|
36600
|
+
this.#run(() => {
|
|
36601
|
+
// If the failure happened while flushing effects, current_batch can be null
|
|
36602
|
+
Batch.ensure();
|
|
36505
36603
|
|
|
36506
|
-
|
|
36507
|
-
this.#is_creating_fallback = false;
|
|
36508
|
-
return branch(() => this.#children(this.#anchor));
|
|
36604
|
+
this.#render();
|
|
36509
36605
|
});
|
|
36510
|
-
|
|
36511
|
-
if (this.#pending_count > 0) {
|
|
36512
|
-
this.#show_pending_snippet();
|
|
36513
|
-
} else {
|
|
36514
|
-
this.is_pending = false;
|
|
36515
|
-
}
|
|
36516
36606
|
};
|
|
36517
36607
|
|
|
36518
|
-
|
|
36608
|
+
/** @param {unknown} transformed_error */
|
|
36609
|
+
const handle_error_result = (transformed_error) => {
|
|
36519
36610
|
try {
|
|
36520
36611
|
calling_on_error = true;
|
|
36521
|
-
onerror?.(
|
|
36612
|
+
onerror?.(transformed_error, reset);
|
|
36522
36613
|
calling_on_error = false;
|
|
36523
36614
|
} catch (error) {
|
|
36524
36615
|
invoke_error_boundary(error, this.#effect && this.#effect.parent);
|
|
@@ -36527,24 +36618,56 @@ class Boundary {
|
|
|
36527
36618
|
if (failed) {
|
|
36528
36619
|
this.#failed_effect = this.#run(() => {
|
|
36529
36620
|
Batch.ensure();
|
|
36530
|
-
this.#is_creating_fallback = true;
|
|
36531
36621
|
|
|
36532
36622
|
try {
|
|
36533
36623
|
return branch(() => {
|
|
36624
|
+
// errors in `failed` snippets cause the boundary to error again
|
|
36625
|
+
// TODO Svelte 6: revisit this decision, most likely better to go to parent boundary instead
|
|
36626
|
+
var effect = /** @type {Effect} */ (active_effect);
|
|
36627
|
+
|
|
36628
|
+
effect.b = this;
|
|
36629
|
+
effect.f |= BOUNDARY_EFFECT;
|
|
36630
|
+
|
|
36534
36631
|
failed(
|
|
36535
36632
|
this.#anchor,
|
|
36536
|
-
() =>
|
|
36633
|
+
() => transformed_error,
|
|
36537
36634
|
() => reset
|
|
36538
36635
|
);
|
|
36539
36636
|
});
|
|
36540
36637
|
} catch (error) {
|
|
36541
36638
|
invoke_error_boundary(error, /** @type {Effect} */ (this.#effect.parent));
|
|
36542
36639
|
return null;
|
|
36543
|
-
} finally {
|
|
36544
|
-
this.#is_creating_fallback = false;
|
|
36545
36640
|
}
|
|
36546
36641
|
});
|
|
36547
36642
|
}
|
|
36643
|
+
};
|
|
36644
|
+
|
|
36645
|
+
queue_micro_task(() => {
|
|
36646
|
+
// Run the error through the API-level transformError transform (e.g. SvelteKit's handleError)
|
|
36647
|
+
/** @type {unknown} */
|
|
36648
|
+
var result;
|
|
36649
|
+
try {
|
|
36650
|
+
result = this.transform_error(error);
|
|
36651
|
+
} catch (e) {
|
|
36652
|
+
invoke_error_boundary(e, this.#effect && this.#effect.parent);
|
|
36653
|
+
return;
|
|
36654
|
+
}
|
|
36655
|
+
|
|
36656
|
+
if (
|
|
36657
|
+
result !== null &&
|
|
36658
|
+
typeof result === 'object' &&
|
|
36659
|
+
typeof (/** @type {any} */ (result).then) === 'function'
|
|
36660
|
+
) {
|
|
36661
|
+
// transformError returned a Promise — wait for it
|
|
36662
|
+
/** @type {any} */ (result).then(
|
|
36663
|
+
handle_error_result,
|
|
36664
|
+
/** @param {unknown} e */
|
|
36665
|
+
(e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)
|
|
36666
|
+
);
|
|
36667
|
+
} else {
|
|
36668
|
+
// Synchronous result — handle immediately
|
|
36669
|
+
handle_error_result(result);
|
|
36670
|
+
}
|
|
36548
36671
|
});
|
|
36549
36672
|
}
|
|
36550
36673
|
}
|
|
@@ -36567,8 +36690,6 @@ function flatten(blockers, sync, async, fn) {
|
|
|
36567
36690
|
fn(sync.map(d));
|
|
36568
36691
|
return;
|
|
36569
36692
|
}
|
|
36570
|
-
|
|
36571
|
-
var batch = current_batch;
|
|
36572
36693
|
var parent = /** @type {Effect} */ (active_effect);
|
|
36573
36694
|
|
|
36574
36695
|
var restore = capture();
|
|
@@ -36591,7 +36712,6 @@ function flatten(blockers, sync, async, fn) {
|
|
|
36591
36712
|
}
|
|
36592
36713
|
}
|
|
36593
36714
|
|
|
36594
|
-
batch?.deactivate();
|
|
36595
36715
|
unset_context();
|
|
36596
36716
|
}
|
|
36597
36717
|
|
|
@@ -36635,10 +36755,25 @@ function capture() {
|
|
|
36635
36755
|
};
|
|
36636
36756
|
}
|
|
36637
36757
|
|
|
36638
|
-
function unset_context() {
|
|
36758
|
+
function unset_context(deactivate_batch = true) {
|
|
36639
36759
|
set_active_effect(null);
|
|
36640
36760
|
set_active_reaction(null);
|
|
36641
36761
|
set_component_context(null);
|
|
36762
|
+
if (deactivate_batch) current_batch?.deactivate();
|
|
36763
|
+
}
|
|
36764
|
+
|
|
36765
|
+
function increment_pending() {
|
|
36766
|
+
var boundary = /** @type {Boundary} */ (/** @type {Effect} */ (active_effect).b);
|
|
36767
|
+
var batch = /** @type {Batch} */ (current_batch);
|
|
36768
|
+
var blocking = boundary.is_rendered();
|
|
36769
|
+
|
|
36770
|
+
boundary.update_pending_count(1);
|
|
36771
|
+
batch.increment(blocking);
|
|
36772
|
+
|
|
36773
|
+
return () => {
|
|
36774
|
+
boundary.update_pending_count(-1);
|
|
36775
|
+
batch.decrement(blocking);
|
|
36776
|
+
};
|
|
36642
36777
|
}
|
|
36643
36778
|
|
|
36644
36779
|
/** @import { Derived, Effect, Source } from '#client' */
|
|
@@ -36697,8 +36832,6 @@ function async_derived(fn, label, location) {
|
|
|
36697
36832
|
async_derived_orphan();
|
|
36698
36833
|
}
|
|
36699
36834
|
|
|
36700
|
-
var boundary = /** @type {Boundary} */ (parent.b);
|
|
36701
|
-
|
|
36702
36835
|
var promise = /** @type {Promise<V>} */ (/** @type {unknown} */ (undefined));
|
|
36703
36836
|
var signal = source(/** @type {V} */ (UNINITIALIZED));
|
|
36704
36837
|
|
|
@@ -36718,17 +36851,7 @@ function async_derived(fn, label, location) {
|
|
|
36718
36851
|
// If this code is changed at some point, make sure to still access the then property
|
|
36719
36852
|
// of fn() to read any signals it might access, so that we track them as dependencies.
|
|
36720
36853
|
// We call `unset_context` to undo any `save` calls that happen inside `fn()`
|
|
36721
|
-
Promise.resolve(fn())
|
|
36722
|
-
.then(d.resolve, d.reject)
|
|
36723
|
-
.then(() => {
|
|
36724
|
-
if (batch === current_batch && batch.committed) {
|
|
36725
|
-
// if the batch was rejected as stale, we need to cleanup
|
|
36726
|
-
// after any `$.save(...)` calls inside `fn()`
|
|
36727
|
-
batch.deactivate();
|
|
36728
|
-
}
|
|
36729
|
-
|
|
36730
|
-
unset_context();
|
|
36731
|
-
});
|
|
36854
|
+
Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);
|
|
36732
36855
|
} catch (error) {
|
|
36733
36856
|
d.reject(error);
|
|
36734
36857
|
unset_context();
|
|
@@ -36737,10 +36860,7 @@ function async_derived(fn, label, location) {
|
|
|
36737
36860
|
var batch = /** @type {Batch} */ (current_batch);
|
|
36738
36861
|
|
|
36739
36862
|
if (should_suspend) {
|
|
36740
|
-
var
|
|
36741
|
-
|
|
36742
|
-
boundary.update_pending_count(1);
|
|
36743
|
-
batch.increment(blocking);
|
|
36863
|
+
var decrement_pending = increment_pending();
|
|
36744
36864
|
|
|
36745
36865
|
deferreds.get(batch)?.reject(STALE_REACTION);
|
|
36746
36866
|
deferreds.delete(batch); // delete to ensure correct order in Map iteration below
|
|
@@ -36777,9 +36897,8 @@ function async_derived(fn, label, location) {
|
|
|
36777
36897
|
}
|
|
36778
36898
|
}
|
|
36779
36899
|
|
|
36780
|
-
if (
|
|
36781
|
-
|
|
36782
|
-
batch.decrement(blocking);
|
|
36900
|
+
if (decrement_pending) {
|
|
36901
|
+
decrement_pending();
|
|
36783
36902
|
}
|
|
36784
36903
|
};
|
|
36785
36904
|
|
|
@@ -37046,19 +37165,6 @@ function mutable_source(initial_value, immutable = false, trackable = true) {
|
|
|
37046
37165
|
return s;
|
|
37047
37166
|
}
|
|
37048
37167
|
|
|
37049
|
-
/**
|
|
37050
|
-
* @template V
|
|
37051
|
-
* @param {Value<V>} source
|
|
37052
|
-
* @param {V} value
|
|
37053
|
-
*/
|
|
37054
|
-
function mutate(source, value) {
|
|
37055
|
-
set(
|
|
37056
|
-
source,
|
|
37057
|
-
untrack(() => get(source))
|
|
37058
|
-
);
|
|
37059
|
-
return value;
|
|
37060
|
-
}
|
|
37061
|
-
|
|
37062
37168
|
/**
|
|
37063
37169
|
* @template V
|
|
37064
37170
|
* @param {Source<V>} source
|
|
@@ -37827,10 +37933,9 @@ function push_effect(effect, parent_effect) {
|
|
|
37827
37933
|
/**
|
|
37828
37934
|
* @param {number} type
|
|
37829
37935
|
* @param {null | (() => void | (() => void))} fn
|
|
37830
|
-
* @param {boolean} sync
|
|
37831
37936
|
* @returns {Effect}
|
|
37832
37937
|
*/
|
|
37833
|
-
function create_effect(type, fn
|
|
37938
|
+
function create_effect(type, fn) {
|
|
37834
37939
|
var parent = active_effect;
|
|
37835
37940
|
|
|
37836
37941
|
if (parent !== null && (parent.f & INERT) !== 0) {
|
|
@@ -37855,34 +37960,39 @@ function create_effect(type, fn, sync) {
|
|
|
37855
37960
|
ac: null
|
|
37856
37961
|
};
|
|
37857
37962
|
|
|
37858
|
-
|
|
37963
|
+
/** @type {Effect | null} */
|
|
37964
|
+
var e = effect;
|
|
37965
|
+
|
|
37966
|
+
if ((type & EFFECT) !== 0) {
|
|
37967
|
+
if (collected_effects !== null) {
|
|
37968
|
+
// created during traversal — collect and run afterwards
|
|
37969
|
+
collected_effects.push(effect);
|
|
37970
|
+
} else {
|
|
37971
|
+
// schedule for later
|
|
37972
|
+
schedule_effect(effect);
|
|
37973
|
+
}
|
|
37974
|
+
} else if (fn !== null) {
|
|
37859
37975
|
try {
|
|
37860
37976
|
update_effect(effect);
|
|
37861
37977
|
} catch (e) {
|
|
37862
37978
|
destroy_effect(effect);
|
|
37863
37979
|
throw e;
|
|
37864
37980
|
}
|
|
37865
|
-
} else if (fn !== null) {
|
|
37866
|
-
schedule_effect(effect);
|
|
37867
|
-
}
|
|
37868
37981
|
|
|
37869
|
-
|
|
37870
|
-
|
|
37871
|
-
|
|
37872
|
-
|
|
37873
|
-
|
|
37874
|
-
|
|
37875
|
-
|
|
37876
|
-
|
|
37877
|
-
|
|
37878
|
-
|
|
37879
|
-
|
|
37880
|
-
|
|
37881
|
-
|
|
37882
|
-
|
|
37883
|
-
e = e.first;
|
|
37884
|
-
if ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {
|
|
37885
|
-
e.f |= EFFECT_TRANSPARENT;
|
|
37982
|
+
// if an effect doesn't need to be kept in the tree (because it
|
|
37983
|
+
// won't re-run, has no DOM, and has no teardown etc)
|
|
37984
|
+
// then we skip it and go to its child (if any)
|
|
37985
|
+
if (
|
|
37986
|
+
e.deps === null &&
|
|
37987
|
+
e.teardown === null &&
|
|
37988
|
+
e.nodes === null &&
|
|
37989
|
+
e.first === e.last && // either `null`, or a singular child
|
|
37990
|
+
(e.f & EFFECT_PRESERVED) === 0
|
|
37991
|
+
) {
|
|
37992
|
+
e = e.first;
|
|
37993
|
+
if ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {
|
|
37994
|
+
e.f |= EFFECT_TRANSPARENT;
|
|
37995
|
+
}
|
|
37886
37996
|
}
|
|
37887
37997
|
}
|
|
37888
37998
|
|
|
@@ -37919,7 +38029,7 @@ function effect_tracking() {
|
|
|
37919
38029
|
* @param {() => void} fn
|
|
37920
38030
|
*/
|
|
37921
38031
|
function teardown(fn) {
|
|
37922
|
-
const effect = create_effect(RENDER_EFFECT, null
|
|
38032
|
+
const effect = create_effect(RENDER_EFFECT, null);
|
|
37923
38033
|
set_signal_status(effect, CLEAN);
|
|
37924
38034
|
effect.teardown = fn;
|
|
37925
38035
|
return effect;
|
|
@@ -37951,7 +38061,7 @@ function user_effect(fn) {
|
|
|
37951
38061
|
* @param {() => void | (() => void)} fn
|
|
37952
38062
|
*/
|
|
37953
38063
|
function create_user_effect(fn) {
|
|
37954
|
-
return create_effect(EFFECT | USER_EFFECT, fn
|
|
38064
|
+
return create_effect(EFFECT | USER_EFFECT, fn);
|
|
37955
38065
|
}
|
|
37956
38066
|
|
|
37957
38067
|
/**
|
|
@@ -37961,7 +38071,7 @@ function create_user_effect(fn) {
|
|
|
37961
38071
|
*/
|
|
37962
38072
|
function user_pre_effect(fn) {
|
|
37963
38073
|
validate_effect();
|
|
37964
|
-
return create_effect(RENDER_EFFECT | USER_EFFECT, fn
|
|
38074
|
+
return create_effect(RENDER_EFFECT | USER_EFFECT, fn);
|
|
37965
38075
|
}
|
|
37966
38076
|
|
|
37967
38077
|
/**
|
|
@@ -37971,7 +38081,7 @@ function user_pre_effect(fn) {
|
|
|
37971
38081
|
*/
|
|
37972
38082
|
function component_root(fn) {
|
|
37973
38083
|
Batch.ensure();
|
|
37974
|
-
const effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn
|
|
38084
|
+
const effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);
|
|
37975
38085
|
|
|
37976
38086
|
return (options = {}) => {
|
|
37977
38087
|
return new Promise((fulfil) => {
|
|
@@ -37993,57 +38103,7 @@ function component_root(fn) {
|
|
|
37993
38103
|
* @returns {Effect}
|
|
37994
38104
|
*/
|
|
37995
38105
|
function effect(fn) {
|
|
37996
|
-
return create_effect(EFFECT, fn
|
|
37997
|
-
}
|
|
37998
|
-
|
|
37999
|
-
/**
|
|
38000
|
-
* Internal representation of `$: ..`
|
|
38001
|
-
* @param {() => any} deps
|
|
38002
|
-
* @param {() => void | (() => void)} fn
|
|
38003
|
-
*/
|
|
38004
|
-
function legacy_pre_effect(deps, fn) {
|
|
38005
|
-
var context = /** @type {ComponentContextLegacy} */ (component_context);
|
|
38006
|
-
|
|
38007
|
-
/** @type {{ effect: null | Effect, ran: boolean, deps: () => any }} */
|
|
38008
|
-
var token = { effect: null, ran: false, deps };
|
|
38009
|
-
|
|
38010
|
-
context.l.$.push(token);
|
|
38011
|
-
|
|
38012
|
-
token.effect = render_effect(() => {
|
|
38013
|
-
deps();
|
|
38014
|
-
|
|
38015
|
-
// If this legacy pre effect has already run before the end of the reset, then
|
|
38016
|
-
// bail out to emulate the same behavior.
|
|
38017
|
-
if (token.ran) return;
|
|
38018
|
-
|
|
38019
|
-
token.ran = true;
|
|
38020
|
-
untrack(fn);
|
|
38021
|
-
});
|
|
38022
|
-
}
|
|
38023
|
-
|
|
38024
|
-
function legacy_pre_effect_reset() {
|
|
38025
|
-
var context = /** @type {ComponentContextLegacy} */ (component_context);
|
|
38026
|
-
|
|
38027
|
-
render_effect(() => {
|
|
38028
|
-
// Run dirty `$:` statements
|
|
38029
|
-
for (var token of context.l.$) {
|
|
38030
|
-
token.deps();
|
|
38031
|
-
|
|
38032
|
-
var effect = token.effect;
|
|
38033
|
-
|
|
38034
|
-
// If the effect is CLEAN, then make it MAYBE_DIRTY. This ensures we traverse through
|
|
38035
|
-
// the effects dependencies and correctly ensure each dependency is up-to-date.
|
|
38036
|
-
if ((effect.f & CLEAN) !== 0 && effect.deps !== null) {
|
|
38037
|
-
set_signal_status(effect, MAYBE_DIRTY);
|
|
38038
|
-
}
|
|
38039
|
-
|
|
38040
|
-
if (is_dirty(effect)) {
|
|
38041
|
-
update_effect(effect);
|
|
38042
|
-
}
|
|
38043
|
-
|
|
38044
|
-
token.ran = false;
|
|
38045
|
-
}
|
|
38046
|
-
});
|
|
38106
|
+
return create_effect(EFFECT, fn);
|
|
38047
38107
|
}
|
|
38048
38108
|
|
|
38049
38109
|
/**
|
|
@@ -38051,7 +38111,7 @@ function legacy_pre_effect_reset() {
|
|
|
38051
38111
|
* @returns {Effect}
|
|
38052
38112
|
*/
|
|
38053
38113
|
function async_effect(fn) {
|
|
38054
|
-
return create_effect(ASYNC | EFFECT_PRESERVED, fn
|
|
38114
|
+
return create_effect(ASYNC | EFFECT_PRESERVED, fn);
|
|
38055
38115
|
}
|
|
38056
38116
|
|
|
38057
38117
|
/**
|
|
@@ -38059,7 +38119,7 @@ function async_effect(fn) {
|
|
|
38059
38119
|
* @returns {Effect}
|
|
38060
38120
|
*/
|
|
38061
38121
|
function render_effect(fn, flags = 0) {
|
|
38062
|
-
return create_effect(RENDER_EFFECT | flags, fn
|
|
38122
|
+
return create_effect(RENDER_EFFECT | flags, fn);
|
|
38063
38123
|
}
|
|
38064
38124
|
|
|
38065
38125
|
/**
|
|
@@ -38070,7 +38130,7 @@ function render_effect(fn, flags = 0) {
|
|
|
38070
38130
|
*/
|
|
38071
38131
|
function template_effect(fn, sync = [], async = [], blockers = []) {
|
|
38072
38132
|
flatten(blockers, sync, async, (values) => {
|
|
38073
|
-
create_effect(RENDER_EFFECT, () => fn(...values.map(get))
|
|
38133
|
+
create_effect(RENDER_EFFECT, () => fn(...values.map(get)));
|
|
38074
38134
|
});
|
|
38075
38135
|
}
|
|
38076
38136
|
|
|
@@ -38079,7 +38139,7 @@ function template_effect(fn, sync = [], async = [], blockers = []) {
|
|
|
38079
38139
|
* @param {number} flags
|
|
38080
38140
|
*/
|
|
38081
38141
|
function block(fn, flags = 0) {
|
|
38082
|
-
var effect = create_effect(BLOCK_EFFECT | flags, fn
|
|
38142
|
+
var effect = create_effect(BLOCK_EFFECT | flags, fn);
|
|
38083
38143
|
return effect;
|
|
38084
38144
|
}
|
|
38085
38145
|
|
|
@@ -38088,7 +38148,7 @@ function block(fn, flags = 0) {
|
|
|
38088
38148
|
* @param {number} flags
|
|
38089
38149
|
*/
|
|
38090
38150
|
function managed(fn, flags = 0) {
|
|
38091
|
-
var effect = create_effect(MANAGED_EFFECT | flags, fn
|
|
38151
|
+
var effect = create_effect(MANAGED_EFFECT | flags, fn);
|
|
38092
38152
|
return effect;
|
|
38093
38153
|
}
|
|
38094
38154
|
|
|
@@ -38096,7 +38156,7 @@ function managed(fn, flags = 0) {
|
|
|
38096
38156
|
* @param {(() => void)} fn
|
|
38097
38157
|
*/
|
|
38098
38158
|
function branch(fn) {
|
|
38099
|
-
return create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn
|
|
38159
|
+
return create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn);
|
|
38100
38160
|
}
|
|
38101
38161
|
|
|
38102
38162
|
/**
|
|
@@ -38388,51 +38448,6 @@ function move_effect(effect, fragment) {
|
|
|
38388
38448
|
}
|
|
38389
38449
|
}
|
|
38390
38450
|
|
|
38391
|
-
/** @import { Value } from '#client' */
|
|
38392
|
-
|
|
38393
|
-
/**
|
|
38394
|
-
* @type {Set<Value> | null}
|
|
38395
|
-
* @deprecated
|
|
38396
|
-
*/
|
|
38397
|
-
let captured_signals = null;
|
|
38398
|
-
|
|
38399
|
-
/**
|
|
38400
|
-
* Capture an array of all the signals that are read when `fn` is called
|
|
38401
|
-
* @template T
|
|
38402
|
-
* @param {() => T} fn
|
|
38403
|
-
*/
|
|
38404
|
-
function capture_signals(fn) {
|
|
38405
|
-
var previous_captured_signals = captured_signals;
|
|
38406
|
-
|
|
38407
|
-
try {
|
|
38408
|
-
captured_signals = new Set();
|
|
38409
|
-
|
|
38410
|
-
untrack(fn);
|
|
38411
|
-
|
|
38412
|
-
if (previous_captured_signals !== null) {
|
|
38413
|
-
for (var signal of captured_signals) {
|
|
38414
|
-
previous_captured_signals.add(signal);
|
|
38415
|
-
}
|
|
38416
|
-
}
|
|
38417
|
-
|
|
38418
|
-
return captured_signals;
|
|
38419
|
-
} finally {
|
|
38420
|
-
captured_signals = previous_captured_signals;
|
|
38421
|
-
}
|
|
38422
|
-
}
|
|
38423
|
-
|
|
38424
|
-
/**
|
|
38425
|
-
* Invokes a function and captures all signals that are read during the invocation,
|
|
38426
|
-
* then invalidates them.
|
|
38427
|
-
* @param {() => any} fn
|
|
38428
|
-
* @deprecated
|
|
38429
|
-
*/
|
|
38430
|
-
function invalidate_inner_signals(fn) {
|
|
38431
|
-
for (var signal of capture_signals(fn)) {
|
|
38432
|
-
internal_set(signal, signal.v);
|
|
38433
|
-
}
|
|
38434
|
-
}
|
|
38435
|
-
|
|
38436
38451
|
/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
|
|
38437
38452
|
|
|
38438
38453
|
let is_updating_effect = false;
|
|
@@ -38860,8 +38875,6 @@ function get(signal) {
|
|
|
38860
38875
|
var flags = signal.f;
|
|
38861
38876
|
var is_derived = (flags & DERIVED) !== 0;
|
|
38862
38877
|
|
|
38863
|
-
captured_signals?.add(signal);
|
|
38864
|
-
|
|
38865
38878
|
// Register the dependency on the current reaction signal.
|
|
38866
38879
|
if (active_reaction !== null && !untracking) {
|
|
38867
38880
|
// if we're in a derived that is being read inside an _async_ derived,
|
|
@@ -39104,96 +39117,9 @@ function deep_read(value, visited = new Set()) {
|
|
|
39104
39117
|
}
|
|
39105
39118
|
|
|
39106
39119
|
/**
|
|
39107
|
-
*
|
|
39108
|
-
|
|
39109
|
-
function is_capture_event(name) {
|
|
39110
|
-
return name.endsWith('capture') && name !== 'gotpointercapture' && name !== 'lostpointercapture';
|
|
39111
|
-
}
|
|
39112
|
-
|
|
39113
|
-
/** List of Element events that will be delegated */
|
|
39114
|
-
const DELEGATED_EVENTS = [
|
|
39115
|
-
'beforeinput',
|
|
39116
|
-
'click',
|
|
39117
|
-
'change',
|
|
39118
|
-
'dblclick',
|
|
39119
|
-
'contextmenu',
|
|
39120
|
-
'focusin',
|
|
39121
|
-
'focusout',
|
|
39122
|
-
'input',
|
|
39123
|
-
'keydown',
|
|
39124
|
-
'keyup',
|
|
39125
|
-
'mousedown',
|
|
39126
|
-
'mousemove',
|
|
39127
|
-
'mouseout',
|
|
39128
|
-
'mouseover',
|
|
39129
|
-
'mouseup',
|
|
39130
|
-
'pointerdown',
|
|
39131
|
-
'pointermove',
|
|
39132
|
-
'pointerout',
|
|
39133
|
-
'pointerover',
|
|
39134
|
-
'pointerup',
|
|
39135
|
-
'touchend',
|
|
39136
|
-
'touchmove',
|
|
39137
|
-
'touchstart'
|
|
39138
|
-
];
|
|
39139
|
-
|
|
39140
|
-
/**
|
|
39141
|
-
* Returns `true` if `event_name` is a delegated event
|
|
39142
|
-
* @param {string} event_name
|
|
39120
|
+
* Used on elements, as a map of event type -> event handler,
|
|
39121
|
+
* and on events themselves to track which element handled an event
|
|
39143
39122
|
*/
|
|
39144
|
-
function can_delegate_event(event_name) {
|
|
39145
|
-
return DELEGATED_EVENTS.includes(event_name);
|
|
39146
|
-
}
|
|
39147
|
-
|
|
39148
|
-
/**
|
|
39149
|
-
* @type {Record<string, string>}
|
|
39150
|
-
* List of attribute names that should be aliased to their property names
|
|
39151
|
-
* because they behave differently between setting them as an attribute and
|
|
39152
|
-
* setting them as a property.
|
|
39153
|
-
*/
|
|
39154
|
-
const ATTRIBUTE_ALIASES = {
|
|
39155
|
-
// no `class: 'className'` because we handle that separately
|
|
39156
|
-
formnovalidate: 'formNoValidate',
|
|
39157
|
-
ismap: 'isMap',
|
|
39158
|
-
nomodule: 'noModule',
|
|
39159
|
-
playsinline: 'playsInline',
|
|
39160
|
-
readonly: 'readOnly',
|
|
39161
|
-
defaultvalue: 'defaultValue',
|
|
39162
|
-
defaultchecked: 'defaultChecked',
|
|
39163
|
-
srcobject: 'srcObject',
|
|
39164
|
-
novalidate: 'noValidate',
|
|
39165
|
-
allowfullscreen: 'allowFullscreen',
|
|
39166
|
-
disablepictureinpicture: 'disablePictureInPicture',
|
|
39167
|
-
disableremoteplayback: 'disableRemotePlayback'
|
|
39168
|
-
};
|
|
39169
|
-
|
|
39170
|
-
/**
|
|
39171
|
-
* @param {string} name
|
|
39172
|
-
*/
|
|
39173
|
-
function normalize_attribute(name) {
|
|
39174
|
-
name = name.toLowerCase();
|
|
39175
|
-
return ATTRIBUTE_ALIASES[name] ?? name;
|
|
39176
|
-
}
|
|
39177
|
-
|
|
39178
|
-
/**
|
|
39179
|
-
* Subset of delegated events which should be passive by default.
|
|
39180
|
-
* These two are already passive via browser defaults on window, document and body.
|
|
39181
|
-
* But since
|
|
39182
|
-
* - we're delegating them
|
|
39183
|
-
* - they happen often
|
|
39184
|
-
* - they apply to mobile which is generally less performant
|
|
39185
|
-
* we're marking them as passive by default for other elements, too.
|
|
39186
|
-
*/
|
|
39187
|
-
const PASSIVE_EVENTS = ['touchstart', 'touchmove'];
|
|
39188
|
-
|
|
39189
|
-
/**
|
|
39190
|
-
* Returns `true` if `name` is a passive event
|
|
39191
|
-
* @param {string} name
|
|
39192
|
-
*/
|
|
39193
|
-
function is_passive_event(name) {
|
|
39194
|
-
return PASSIVE_EVENTS.includes(name);
|
|
39195
|
-
}
|
|
39196
|
-
|
|
39197
39123
|
const event_symbol = Symbol('events');
|
|
39198
39124
|
|
|
39199
39125
|
/** @type {Set<string>} */
|
|
@@ -39317,8 +39243,8 @@ function handle_event_propagation(event) {
|
|
|
39317
39243
|
last_propagated_event = event;
|
|
39318
39244
|
|
|
39319
39245
|
// composedPath contains list of nodes the event has propagated through.
|
|
39320
|
-
// We check
|
|
39321
|
-
// parent of the
|
|
39246
|
+
// We check `event_symbol` to skip all nodes below it in case this is a
|
|
39247
|
+
// parent of the `event_symbol` node, which indicates that there's nested
|
|
39322
39248
|
// mounted apps. In this case we don't want to trigger events multiple times.
|
|
39323
39249
|
var path_idx = 0;
|
|
39324
39250
|
|
|
@@ -39326,7 +39252,7 @@ function handle_event_propagation(event) {
|
|
|
39326
39252
|
// without it the variable will be DCE'd and things will
|
|
39327
39253
|
// fail mysteriously in Firefox
|
|
39328
39254
|
// @ts-expect-error is added below
|
|
39329
|
-
var handled_at = last_propagated_event === event && event
|
|
39255
|
+
var handled_at = last_propagated_event === event && event[event_symbol];
|
|
39330
39256
|
|
|
39331
39257
|
if (handled_at) {
|
|
39332
39258
|
var at_idx = path.indexOf(handled_at);
|
|
@@ -39338,7 +39264,7 @@ function handle_event_propagation(event) {
|
|
|
39338
39264
|
// -> ignore, but set handle_at to document/window so that we're resetting the event
|
|
39339
39265
|
// chain in case someone manually dispatches the same event object again.
|
|
39340
39266
|
// @ts-expect-error
|
|
39341
|
-
event
|
|
39267
|
+
event[event_symbol] = handler_element;
|
|
39342
39268
|
return;
|
|
39343
39269
|
}
|
|
39344
39270
|
|
|
@@ -39438,7 +39364,7 @@ function handle_event_propagation(event) {
|
|
|
39438
39364
|
}
|
|
39439
39365
|
} finally {
|
|
39440
39366
|
// @ts-expect-error is used above
|
|
39441
|
-
event
|
|
39367
|
+
event[event_symbol] = handler_element;
|
|
39442
39368
|
// @ts-ignore remove proxy on currentTarget
|
|
39443
39369
|
delete event.currentTarget;
|
|
39444
39370
|
set_active_reaction(previous_reaction);
|
|
@@ -39446,18 +39372,15 @@ function handle_event_propagation(event) {
|
|
|
39446
39372
|
}
|
|
39447
39373
|
}
|
|
39448
39374
|
|
|
39449
|
-
|
|
39450
|
-
|
|
39451
|
-
|
|
39452
|
-
|
|
39453
|
-
'svelte-trusted-html',
|
|
39454
|
-
{
|
|
39375
|
+
const policy =
|
|
39376
|
+
// We gotta write it like this because after downleveling the pure comment may end up in the wrong location
|
|
39377
|
+
globalThis?.window?.trustedTypes &&
|
|
39378
|
+
/* @__PURE__ */ globalThis.window.trustedTypes.createPolicy('svelte-trusted-html', {
|
|
39455
39379
|
/** @param {string} html */
|
|
39456
39380
|
createHTML: (html) => {
|
|
39457
39381
|
return html;
|
|
39458
39382
|
}
|
|
39459
|
-
}
|
|
39460
|
-
);
|
|
39383
|
+
});
|
|
39461
39384
|
|
|
39462
39385
|
/** @param {string} html */
|
|
39463
39386
|
function create_trusted_html(html) {
|
|
@@ -39466,12 +39389,10 @@ function create_trusted_html(html) {
|
|
|
39466
39389
|
|
|
39467
39390
|
/**
|
|
39468
39391
|
* @param {string} html
|
|
39469
|
-
* @param {boolean} trusted
|
|
39470
39392
|
*/
|
|
39471
|
-
function create_fragment_from_html(html
|
|
39393
|
+
function create_fragment_from_html(html) {
|
|
39472
39394
|
var elem = create_element('template');
|
|
39473
|
-
|
|
39474
|
-
elem.innerHTML = trusted ? create_trusted_html(html) : html;
|
|
39395
|
+
elem.innerHTML = create_trusted_html(html.replaceAll('<!>', '<!---->')); // XHTML compliance
|
|
39475
39396
|
return elem.content;
|
|
39476
39397
|
}
|
|
39477
39398
|
|
|
@@ -39511,7 +39432,7 @@ function from_html(content, flags) {
|
|
|
39511
39432
|
return () => {
|
|
39512
39433
|
|
|
39513
39434
|
if (node === undefined) {
|
|
39514
|
-
node = create_fragment_from_html(has_start ? content : '<!>' + content
|
|
39435
|
+
node = create_fragment_from_html(has_start ? content : '<!>' + content);
|
|
39515
39436
|
if (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));
|
|
39516
39437
|
}
|
|
39517
39438
|
|
|
@@ -39553,7 +39474,7 @@ function from_namespace(content, flags, ns = 'svg') {
|
|
|
39553
39474
|
return () => {
|
|
39554
39475
|
|
|
39555
39476
|
if (!node) {
|
|
39556
|
-
var fragment = /** @type {DocumentFragment} */ (create_fragment_from_html(wrapped
|
|
39477
|
+
var fragment = /** @type {DocumentFragment} */ (create_fragment_from_html(wrapped));
|
|
39557
39478
|
var root = /** @type {Element} */ (get_first_child(fragment));
|
|
39558
39479
|
|
|
39559
39480
|
{
|
|
@@ -39635,6 +39556,97 @@ function props_id() {
|
|
|
39635
39556
|
return `c${window.__svelte.uid++}`;
|
|
39636
39557
|
}
|
|
39637
39558
|
|
|
39559
|
+
/**
|
|
39560
|
+
* @param {string} name
|
|
39561
|
+
*/
|
|
39562
|
+
function is_capture_event(name) {
|
|
39563
|
+
return name.endsWith('capture') && name !== 'gotpointercapture' && name !== 'lostpointercapture';
|
|
39564
|
+
}
|
|
39565
|
+
|
|
39566
|
+
/** List of Element events that will be delegated */
|
|
39567
|
+
const DELEGATED_EVENTS = [
|
|
39568
|
+
'beforeinput',
|
|
39569
|
+
'click',
|
|
39570
|
+
'change',
|
|
39571
|
+
'dblclick',
|
|
39572
|
+
'contextmenu',
|
|
39573
|
+
'focusin',
|
|
39574
|
+
'focusout',
|
|
39575
|
+
'input',
|
|
39576
|
+
'keydown',
|
|
39577
|
+
'keyup',
|
|
39578
|
+
'mousedown',
|
|
39579
|
+
'mousemove',
|
|
39580
|
+
'mouseout',
|
|
39581
|
+
'mouseover',
|
|
39582
|
+
'mouseup',
|
|
39583
|
+
'pointerdown',
|
|
39584
|
+
'pointermove',
|
|
39585
|
+
'pointerout',
|
|
39586
|
+
'pointerover',
|
|
39587
|
+
'pointerup',
|
|
39588
|
+
'touchend',
|
|
39589
|
+
'touchmove',
|
|
39590
|
+
'touchstart'
|
|
39591
|
+
];
|
|
39592
|
+
|
|
39593
|
+
/**
|
|
39594
|
+
* Returns `true` if `event_name` is a delegated event
|
|
39595
|
+
* @param {string} event_name
|
|
39596
|
+
*/
|
|
39597
|
+
function can_delegate_event(event_name) {
|
|
39598
|
+
return DELEGATED_EVENTS.includes(event_name);
|
|
39599
|
+
}
|
|
39600
|
+
|
|
39601
|
+
/**
|
|
39602
|
+
* @type {Record<string, string>}
|
|
39603
|
+
* List of attribute names that should be aliased to their property names
|
|
39604
|
+
* because they behave differently between setting them as an attribute and
|
|
39605
|
+
* setting them as a property.
|
|
39606
|
+
*/
|
|
39607
|
+
const ATTRIBUTE_ALIASES = {
|
|
39608
|
+
// no `class: 'className'` because we handle that separately
|
|
39609
|
+
formnovalidate: 'formNoValidate',
|
|
39610
|
+
ismap: 'isMap',
|
|
39611
|
+
nomodule: 'noModule',
|
|
39612
|
+
playsinline: 'playsInline',
|
|
39613
|
+
readonly: 'readOnly',
|
|
39614
|
+
defaultvalue: 'defaultValue',
|
|
39615
|
+
defaultchecked: 'defaultChecked',
|
|
39616
|
+
srcobject: 'srcObject',
|
|
39617
|
+
novalidate: 'noValidate',
|
|
39618
|
+
allowfullscreen: 'allowFullscreen',
|
|
39619
|
+
disablepictureinpicture: 'disablePictureInPicture',
|
|
39620
|
+
disableremoteplayback: 'disableRemotePlayback'
|
|
39621
|
+
};
|
|
39622
|
+
|
|
39623
|
+
/**
|
|
39624
|
+
* @param {string} name
|
|
39625
|
+
*/
|
|
39626
|
+
function normalize_attribute(name) {
|
|
39627
|
+
name = name.toLowerCase();
|
|
39628
|
+
return ATTRIBUTE_ALIASES[name] ?? name;
|
|
39629
|
+
}
|
|
39630
|
+
|
|
39631
|
+
/**
|
|
39632
|
+
* Subset of delegated events which should be passive by default.
|
|
39633
|
+
* These two are already passive via browser defaults on window, document and body.
|
|
39634
|
+
* But since
|
|
39635
|
+
* - we're delegating them
|
|
39636
|
+
* - they happen often
|
|
39637
|
+
* - they apply to mobile which is generally less performant
|
|
39638
|
+
* we're marking them as passive by default for other elements, too.
|
|
39639
|
+
*/
|
|
39640
|
+
const PASSIVE_EVENTS = ['touchstart', 'touchmove'];
|
|
39641
|
+
|
|
39642
|
+
/**
|
|
39643
|
+
* Returns `true` if `name` is a passive event
|
|
39644
|
+
* @param {string} name
|
|
39645
|
+
*/
|
|
39646
|
+
function is_passive_event(name) {
|
|
39647
|
+
return PASSIVE_EVENTS.includes(name);
|
|
39648
|
+
}
|
|
39649
|
+
|
|
39638
39650
|
/** @import { ComponentContext, Effect, EffectNodes, TemplateNode } from '#client' */
|
|
39639
39651
|
/** @import { Component, ComponentType, SvelteComponent, MountOptions } from '../../index.js' */
|
|
39640
39652
|
|
|
@@ -39645,12 +39657,12 @@ function props_id() {
|
|
|
39645
39657
|
*/
|
|
39646
39658
|
function set_text(text, value) {
|
|
39647
39659
|
// For objects, we apply string coercion (which might make things like $state array references in the template reactive) before diffing
|
|
39648
|
-
var str = value == null ? '' : typeof value === 'object' ? value
|
|
39660
|
+
var str = value == null ? '' : typeof value === 'object' ? `${value}` : value;
|
|
39649
39661
|
// @ts-expect-error
|
|
39650
39662
|
if (str !== (text.__t ??= text.nodeValue)) {
|
|
39651
39663
|
// @ts-expect-error
|
|
39652
39664
|
text.__t = str;
|
|
39653
|
-
text.nodeValue = str
|
|
39665
|
+
text.nodeValue = `${str}`;
|
|
39654
39666
|
}
|
|
39655
39667
|
}
|
|
39656
39668
|
|
|
@@ -39677,51 +39689,12 @@ const listeners = new Map();
|
|
|
39677
39689
|
* @param {MountOptions} options
|
|
39678
39690
|
* @returns {Exports}
|
|
39679
39691
|
*/
|
|
39680
|
-
function _mount(
|
|
39692
|
+
function _mount(
|
|
39693
|
+
Component,
|
|
39694
|
+
{ target, anchor, props = {}, events, context, intro = true, transformError }
|
|
39695
|
+
) {
|
|
39681
39696
|
init_operations();
|
|
39682
39697
|
|
|
39683
|
-
/** @type {Set<string>} */
|
|
39684
|
-
var registered_events = new Set();
|
|
39685
|
-
|
|
39686
|
-
/** @param {Array<string>} events */
|
|
39687
|
-
var event_handle = (events) => {
|
|
39688
|
-
for (var i = 0; i < events.length; i++) {
|
|
39689
|
-
var event_name = events[i];
|
|
39690
|
-
|
|
39691
|
-
if (registered_events.has(event_name)) continue;
|
|
39692
|
-
registered_events.add(event_name);
|
|
39693
|
-
|
|
39694
|
-
var passive = is_passive_event(event_name);
|
|
39695
|
-
|
|
39696
|
-
// Add the event listener to both the container and the document.
|
|
39697
|
-
// The container listener ensures we catch events from within in case
|
|
39698
|
-
// the outer content stops propagation of the event.
|
|
39699
|
-
//
|
|
39700
|
-
// The document listener ensures we catch events that originate from elements that were
|
|
39701
|
-
// manually moved outside of the container (e.g. via manual portals).
|
|
39702
|
-
for (const node of [target, document]) {
|
|
39703
|
-
var counts = listeners.get(node);
|
|
39704
|
-
|
|
39705
|
-
if (counts === undefined) {
|
|
39706
|
-
counts = new Map();
|
|
39707
|
-
listeners.set(node, counts);
|
|
39708
|
-
}
|
|
39709
|
-
|
|
39710
|
-
var count = counts.get(event_name);
|
|
39711
|
-
|
|
39712
|
-
if (count === undefined) {
|
|
39713
|
-
node.addEventListener(event_name, handle_event_propagation, { passive });
|
|
39714
|
-
counts.set(event_name, 1);
|
|
39715
|
-
} else {
|
|
39716
|
-
counts.set(event_name, count + 1);
|
|
39717
|
-
}
|
|
39718
|
-
}
|
|
39719
|
-
}
|
|
39720
|
-
};
|
|
39721
|
-
|
|
39722
|
-
event_handle(array_from(all_registered_events));
|
|
39723
|
-
root_event_handles.add(event_handle);
|
|
39724
|
-
|
|
39725
39698
|
/** @type {Exports} */
|
|
39726
39699
|
// @ts-expect-error will be defined because the render effect runs synchronously
|
|
39727
39700
|
var component = undefined;
|
|
@@ -39747,9 +39720,53 @@ function _mount(Component, { target, anchor, props = {}, events, context, intro
|
|
|
39747
39720
|
component = Component(anchor_node, props) || {};
|
|
39748
39721
|
|
|
39749
39722
|
pop();
|
|
39750
|
-
}
|
|
39723
|
+
},
|
|
39724
|
+
transformError
|
|
39751
39725
|
);
|
|
39752
39726
|
|
|
39727
|
+
// Setup event delegation _after_ component is mounted - if an error would happen during mount, it would otherwise not be cleaned up
|
|
39728
|
+
/** @type {Set<string>} */
|
|
39729
|
+
var registered_events = new Set();
|
|
39730
|
+
|
|
39731
|
+
/** @param {Array<string>} events */
|
|
39732
|
+
var event_handle = (events) => {
|
|
39733
|
+
for (var i = 0; i < events.length; i++) {
|
|
39734
|
+
var event_name = events[i];
|
|
39735
|
+
|
|
39736
|
+
if (registered_events.has(event_name)) continue;
|
|
39737
|
+
registered_events.add(event_name);
|
|
39738
|
+
|
|
39739
|
+
var passive = is_passive_event(event_name);
|
|
39740
|
+
|
|
39741
|
+
// Add the event listener to both the container and the document.
|
|
39742
|
+
// The container listener ensures we catch events from within in case
|
|
39743
|
+
// the outer content stops propagation of the event.
|
|
39744
|
+
//
|
|
39745
|
+
// The document listener ensures we catch events that originate from elements that were
|
|
39746
|
+
// manually moved outside of the container (e.g. via manual portals).
|
|
39747
|
+
for (const node of [target, document]) {
|
|
39748
|
+
var counts = listeners.get(node);
|
|
39749
|
+
|
|
39750
|
+
if (counts === undefined) {
|
|
39751
|
+
counts = new Map();
|
|
39752
|
+
listeners.set(node, counts);
|
|
39753
|
+
}
|
|
39754
|
+
|
|
39755
|
+
var count = counts.get(event_name);
|
|
39756
|
+
|
|
39757
|
+
if (count === undefined) {
|
|
39758
|
+
node.addEventListener(event_name, handle_event_propagation, { passive });
|
|
39759
|
+
counts.set(event_name, 1);
|
|
39760
|
+
} else {
|
|
39761
|
+
counts.set(event_name, count + 1);
|
|
39762
|
+
}
|
|
39763
|
+
}
|
|
39764
|
+
}
|
|
39765
|
+
};
|
|
39766
|
+
|
|
39767
|
+
event_handle(array_from(all_registered_events));
|
|
39768
|
+
root_event_handles.add(event_handle);
|
|
39769
|
+
|
|
39753
39770
|
return () => {
|
|
39754
39771
|
for (var event_name of registered_events) {
|
|
39755
39772
|
for (const node of [target, document]) {
|
|
@@ -39878,9 +39895,10 @@ class BranchManager {
|
|
|
39878
39895
|
this.#transition = transition;
|
|
39879
39896
|
}
|
|
39880
39897
|
|
|
39881
|
-
|
|
39882
|
-
|
|
39883
|
-
|
|
39898
|
+
/**
|
|
39899
|
+
* @param {Batch} batch
|
|
39900
|
+
*/
|
|
39901
|
+
#commit = (batch) => {
|
|
39884
39902
|
// if this batch was made obsolete, bail
|
|
39885
39903
|
if (!this.#batches.has(batch)) return;
|
|
39886
39904
|
|
|
@@ -40028,7 +40046,7 @@ class BranchManager {
|
|
|
40028
40046
|
batch.ondiscard(this.#discard);
|
|
40029
40047
|
} else {
|
|
40030
40048
|
|
|
40031
|
-
this.#commit();
|
|
40049
|
+
this.#commit(batch);
|
|
40032
40050
|
}
|
|
40033
40051
|
}
|
|
40034
40052
|
}
|
|
@@ -40054,48 +40072,6 @@ function snippet(node, get_snippet, ...args) {
|
|
|
40054
40072
|
}, EFFECT_TRANSPARENT);
|
|
40055
40073
|
}
|
|
40056
40074
|
|
|
40057
|
-
/** @import { ComponentContext, ComponentContextLegacy } from '#client' */
|
|
40058
|
-
/** @import { EventDispatcher } from './index.js' */
|
|
40059
|
-
/** @import { NotFunction } from './internal/types.js' */
|
|
40060
|
-
|
|
40061
|
-
/**
|
|
40062
|
-
* `onMount`, like [`$effect`](https://svelte.dev/docs/svelte/$effect), schedules a function to run as soon as the component has been mounted to the DOM.
|
|
40063
|
-
* Unlike `$effect`, the provided function only runs once.
|
|
40064
|
-
*
|
|
40065
|
-
* It must be called during the component's initialisation (but doesn't need to live _inside_ the component;
|
|
40066
|
-
* it can be called from an external module). If a function is returned _synchronously_ from `onMount`,
|
|
40067
|
-
* it will be called when the component is unmounted.
|
|
40068
|
-
*
|
|
40069
|
-
* `onMount` functions do not run during [server-side rendering](https://svelte.dev/docs/svelte/svelte-server#render).
|
|
40070
|
-
*
|
|
40071
|
-
* @template T
|
|
40072
|
-
* @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn
|
|
40073
|
-
* @returns {void}
|
|
40074
|
-
*/
|
|
40075
|
-
function onMount(fn) {
|
|
40076
|
-
if (component_context === null) {
|
|
40077
|
-
lifecycle_outside_component();
|
|
40078
|
-
}
|
|
40079
|
-
|
|
40080
|
-
if (legacy_mode_flag && component_context.l !== null) {
|
|
40081
|
-
init_update_callbacks(component_context).m.push(fn);
|
|
40082
|
-
} else {
|
|
40083
|
-
user_effect(() => {
|
|
40084
|
-
const cleanup = untrack(fn);
|
|
40085
|
-
if (typeof cleanup === 'function') return /** @type {() => void} */ (cleanup);
|
|
40086
|
-
});
|
|
40087
|
-
}
|
|
40088
|
-
}
|
|
40089
|
-
|
|
40090
|
-
/**
|
|
40091
|
-
* Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate
|
|
40092
|
-
* @param {ComponentContext} context
|
|
40093
|
-
*/
|
|
40094
|
-
function init_update_callbacks(context) {
|
|
40095
|
-
var l = /** @type {ComponentContextLegacy} */ (context).l;
|
|
40096
|
-
return (l.u ??= { a: [], b: [], m: [] });
|
|
40097
|
-
}
|
|
40098
|
-
|
|
40099
40075
|
/** @import { TemplateNode } from '#client' */
|
|
40100
40076
|
|
|
40101
40077
|
/**
|
|
@@ -40723,10 +40699,11 @@ function link(state, prev, next) {
|
|
|
40723
40699
|
}
|
|
40724
40700
|
|
|
40725
40701
|
/** @import { Effect, TemplateNode } from '#client' */
|
|
40702
|
+
/** @import {} from 'trusted-types' */
|
|
40726
40703
|
|
|
40727
40704
|
/**
|
|
40728
40705
|
* @param {Element | Text | Comment} node
|
|
40729
|
-
* @param {() => string} get_value
|
|
40706
|
+
* @param {() => string | TrustedHTML} get_value
|
|
40730
40707
|
* @param {boolean} [svg]
|
|
40731
40708
|
* @param {boolean} [mathml]
|
|
40732
40709
|
* @param {boolean} [skip_warning]
|
|
@@ -40735,6 +40712,7 @@ function link(state, prev, next) {
|
|
|
40735
40712
|
function html(node, get_value, svg = false, mathml = false, skip_warning = false) {
|
|
40736
40713
|
var anchor = node;
|
|
40737
40714
|
|
|
40715
|
+
/** @type {string | TrustedHTML} */
|
|
40738
40716
|
var value = '';
|
|
40739
40717
|
|
|
40740
40718
|
template_effect(() => {
|
|
@@ -40751,18 +40729,18 @@ function html(node, get_value, svg = false, mathml = false, skip_warning = false
|
|
|
40751
40729
|
|
|
40752
40730
|
if (value === '') return;
|
|
40753
40731
|
|
|
40754
|
-
var html = value + '';
|
|
40755
|
-
if (svg) html = `<svg>${html}</svg>`;
|
|
40756
|
-
else if (mathml) html = `<math>${html}</math>`;
|
|
40757
|
-
|
|
40758
40732
|
// Don't use create_fragment_with_script_from_html here because that would mean script tags are executed.
|
|
40759
40733
|
// @html is basically `.innerHTML = ...` and that doesn't execute scripts either due to security reasons.
|
|
40760
|
-
|
|
40761
|
-
|
|
40734
|
+
// Use a <template>, <svg>, or <math> wrapper depending on context. If value is a TrustedHTML object,
|
|
40735
|
+
// it will be assigned directly to innerHTML without coercion — this allows {@html policy.createHTML(...)} to work.
|
|
40736
|
+
var ns = svg ? NAMESPACE_SVG : mathml ? NAMESPACE_MATHML : undefined;
|
|
40737
|
+
var wrapper = /** @type {HTMLTemplateElement | SVGElement | MathMLElement} */ (
|
|
40738
|
+
create_element(svg ? 'svg' : mathml ? 'math' : 'template', ns)
|
|
40739
|
+
);
|
|
40740
|
+
wrapper.innerHTML = /** @type {any} */ (value);
|
|
40762
40741
|
|
|
40763
|
-
|
|
40764
|
-
|
|
40765
|
-
}
|
|
40742
|
+
/** @type {DocumentFragment | Element} */
|
|
40743
|
+
var node = svg || mathml ? wrapper : /** @type {HTMLTemplateElement} */ (wrapper).content;
|
|
40766
40744
|
|
|
40767
40745
|
assign_nodes(
|
|
40768
40746
|
/** @type {TemplateNode} */ (get_first_child(node)),
|
|
@@ -40929,7 +40907,7 @@ function to_class(value, hash, directives) {
|
|
|
40929
40907
|
}
|
|
40930
40908
|
|
|
40931
40909
|
if (directives) {
|
|
40932
|
-
for (var key
|
|
40910
|
+
for (var key of Object.keys(directives)) {
|
|
40933
40911
|
if (directives[key]) {
|
|
40934
40912
|
classname = classname ? classname + ' ' + key : key;
|
|
40935
40913
|
} else if (classname.length) {
|
|
@@ -40964,7 +40942,7 @@ function append_styles(styles, important = false) {
|
|
|
40964
40942
|
var separator = important ? ' !important;' : ';';
|
|
40965
40943
|
var css = '';
|
|
40966
40944
|
|
|
40967
|
-
for (var key
|
|
40945
|
+
for (var key of Object.keys(styles)) {
|
|
40968
40946
|
var value = styles[key];
|
|
40969
40947
|
if (value != null && value !== '') {
|
|
40970
40948
|
css += ' ' + key + ': ' + value + separator;
|
|
@@ -42280,6 +42258,8 @@ function prop(props, key, flags, fallback) {
|
|
|
42280
42258
|
);
|
|
42281
42259
|
}
|
|
42282
42260
|
|
|
42261
|
+
enable_legacy_mode_flag();
|
|
42262
|
+
|
|
42283
42263
|
const defaultAttributes = {
|
|
42284
42264
|
outline: {
|
|
42285
42265
|
xmlns: 'http://www.w3.org/2000/svg',
|
|
@@ -42395,29 +42375,25 @@ function Clipboard($$anchor, $$props) {
|
|
|
42395
42375
|
}));
|
|
42396
42376
|
}
|
|
42397
42377
|
|
|
42398
|
-
var root_1$
|
|
42399
|
-
var root_5$
|
|
42378
|
+
var root_1$7 = from_html(`<div class="paste-section svelte-1hna6ki"><button type="button" class="paste-button svelte-1hna6ki"><!> <span class="svelte-1hna6ki">クリップボードから貼り付け</span></button></div>`);
|
|
42379
|
+
var root_5$3 = from_html(`<img alt="" loading="lazy" class="svelte-1hna6ki"/>`);
|
|
42400
42380
|
var root_4$4 = from_html(`<figure class="svelte-1hna6ki"><div class="img svelte-1hna6ki"><!></div> <figcaption class="svelte-1hna6ki"> </figcaption></figure>`);
|
|
42401
42381
|
var root_3$4 = from_html(`<dd class="svelte-1hna6ki"><button type="button" class="svelte-1hna6ki"><!></button></dd>`);
|
|
42402
42382
|
var root_2$5 = from_html(`<dt class="svelte-1hna6ki"> </dt> <div class="svelte-1hna6ki"></div>`, 1);
|
|
42403
42383
|
var root$a = from_html(`<div class="block-catalog"><!> <dl class="svelte-1hna6ki"></dl></div>`);
|
|
42404
42384
|
|
|
42405
42385
|
function Block_catalog($$anchor, $$props) {
|
|
42406
|
-
push($$props,
|
|
42407
|
-
|
|
42408
|
-
let engine = prop($$props, 'engine', 8);
|
|
42409
|
-
let hasCopiedBlock = mutable_source(false);
|
|
42386
|
+
push($$props, true);
|
|
42410
42387
|
|
|
42411
|
-
|
|
42412
|
-
set(hasCopiedBlock, !!sessionStorage.getItem(engine().storageKey.blockClipboard));
|
|
42388
|
+
const hasCopiedBlock = !!sessionStorage.getItem($$props.engine.storageKey.blockClipboard);
|
|
42413
42389
|
|
|
42414
42390
|
/**
|
|
42415
42391
|
*
|
|
42416
42392
|
* @param blockData
|
|
42417
42393
|
*/
|
|
42418
42394
|
function addBlock(blockData) {
|
|
42419
|
-
engine
|
|
42420
|
-
engine
|
|
42395
|
+
$$props.engine.blockCatalogDialog.close();
|
|
42396
|
+
$$props.engine.addBlock(blockData);
|
|
42421
42397
|
}
|
|
42422
42398
|
|
|
42423
42399
|
/**
|
|
@@ -42425,7 +42401,7 @@ function Block_catalog($$anchor, $$props) {
|
|
|
42425
42401
|
*/
|
|
42426
42402
|
async function pasteBlock() {
|
|
42427
42403
|
// 1. sessionStorageから取得
|
|
42428
|
-
const jsonString = sessionStorage.getItem(engine
|
|
42404
|
+
const jsonString = sessionStorage.getItem($$props.engine.storageKey.blockClipboard);
|
|
42429
42405
|
|
|
42430
42406
|
if (!jsonString) {
|
|
42431
42407
|
alert('クリップボードにブロックデータがありません。');
|
|
@@ -42448,133 +42424,107 @@ function Block_catalog($$anchor, $$props) {
|
|
|
42448
42424
|
}
|
|
42449
42425
|
|
|
42450
42426
|
// 3. ダイアログを閉じる
|
|
42451
|
-
engine
|
|
42427
|
+
$$props.engine.blockCatalogDialog.close();
|
|
42452
42428
|
|
|
42453
42429
|
// 4. ブロックを追加(既存のaddBlock関数と同じ)
|
|
42454
|
-
await engine
|
|
42430
|
+
await $$props.engine.addBlock(blockData);
|
|
42455
42431
|
|
|
42456
42432
|
// 5. sessionStorageをクリア
|
|
42457
|
-
sessionStorage.removeItem(engine
|
|
42433
|
+
sessionStorage.removeItem($$props.engine.storageKey.blockClipboard);
|
|
42458
42434
|
}
|
|
42459
42435
|
|
|
42460
|
-
init();
|
|
42461
|
-
|
|
42462
42436
|
var div = root$a();
|
|
42463
42437
|
var node = child(div);
|
|
42464
42438
|
|
|
42465
42439
|
{
|
|
42466
42440
|
var consequent = ($$anchor) => {
|
|
42467
|
-
var div_1 = root_1$
|
|
42441
|
+
var div_1 = root_1$7();
|
|
42468
42442
|
var button = child(div_1);
|
|
42469
42443
|
var node_1 = child(button);
|
|
42470
42444
|
|
|
42471
42445
|
Clipboard(node_1, {});
|
|
42472
|
-
|
|
42446
|
+
delegated('click', button, pasteBlock);
|
|
42473
42447
|
append($$anchor, div_1);
|
|
42474
42448
|
};
|
|
42475
42449
|
|
|
42476
42450
|
if_block(node, ($$render) => {
|
|
42477
|
-
if (
|
|
42451
|
+
if (hasCopiedBlock) $$render(consequent);
|
|
42478
42452
|
});
|
|
42479
42453
|
}
|
|
42480
42454
|
|
|
42481
42455
|
var dl = sibling(node, 2);
|
|
42482
42456
|
|
|
42483
|
-
each(
|
|
42484
|
-
|
|
42485
|
-
|
|
42486
|
-
() => (
|
|
42487
|
-
|
|
42488
|
-
|
|
42489
|
-
)
|
|
42490
|
-
([category, blocks]) => category,
|
|
42491
|
-
($$anchor, $$item) => {
|
|
42492
|
-
var $$array = user_derived(() => to_array(get($$item), 2));
|
|
42493
|
-
let category = () => get($$array)[0];
|
|
42494
|
-
let blocks = () => get($$array)[1];
|
|
42495
|
-
var fragment = root_2$5();
|
|
42496
|
-
var dt = first_child(fragment);
|
|
42497
|
-
var text$1 = child(dt);
|
|
42498
|
-
|
|
42499
|
-
var div_2 = sibling(dt, 2);
|
|
42500
|
-
|
|
42501
|
-
each(div_2, 5, blocks, (blockInfo) => category() + blockInfo.label + blockInfo.definition.name, ($$anchor, blockInfo) => {
|
|
42502
|
-
var dd = root_3$4();
|
|
42503
|
-
var button_1 = child(dd);
|
|
42504
|
-
var node_2 = child(button_1);
|
|
42457
|
+
each(dl, 21, () => $$props.engine.blockCatalogDialog.catalog, ([category, blocks]) => category, ($$anchor, $$item) => {
|
|
42458
|
+
var $$array = user_derived(() => to_array(get($$item), 2));
|
|
42459
|
+
let category = () => get($$array)[0];
|
|
42460
|
+
let blocks = () => get($$array)[1];
|
|
42461
|
+
var fragment = root_2$5();
|
|
42462
|
+
var dt = first_child(fragment);
|
|
42463
|
+
var text$1 = child(dt);
|
|
42505
42464
|
|
|
42506
|
-
|
|
42507
|
-
var consequent_3 = ($$anchor) => {
|
|
42508
|
-
var figure = root_4$4();
|
|
42509
|
-
var div_3 = child(figure);
|
|
42510
|
-
var node_3 = child(div_3);
|
|
42511
|
-
|
|
42512
|
-
{
|
|
42513
|
-
var consequent_1 = ($$anchor) => {
|
|
42514
|
-
var img = root_5$4();
|
|
42515
|
-
|
|
42516
|
-
template_effect(() => set_attribute(img, 'src', (
|
|
42517
|
-
get(blockInfo),
|
|
42518
|
-
untrack(() => get(blockInfo).definition.img)
|
|
42519
|
-
)));
|
|
42520
|
-
|
|
42521
|
-
append($$anchor, img);
|
|
42522
|
-
};
|
|
42523
|
-
|
|
42524
|
-
var consequent_2 = ($$anchor) => {
|
|
42525
|
-
var fragment_1 = comment();
|
|
42526
|
-
var node_4 = first_child(fragment_1);
|
|
42527
|
-
|
|
42528
|
-
html(node_4, () => (
|
|
42529
|
-
get(blockInfo),
|
|
42530
|
-
untrack(() => get(blockInfo).definition.svg)
|
|
42531
|
-
));
|
|
42532
|
-
|
|
42533
|
-
append($$anchor, fragment_1);
|
|
42534
|
-
};
|
|
42535
|
-
|
|
42536
|
-
if_block(node_3, ($$render) => {
|
|
42537
|
-
if ((
|
|
42538
|
-
get(blockInfo),
|
|
42539
|
-
untrack(() => get(blockInfo).definition.img)
|
|
42540
|
-
)) $$render(consequent_1); else if ((
|
|
42541
|
-
get(blockInfo),
|
|
42542
|
-
untrack(() => get(blockInfo).definition.svg)
|
|
42543
|
-
)) $$render(consequent_2, 1);
|
|
42544
|
-
});
|
|
42545
|
-
}
|
|
42465
|
+
var div_2 = sibling(dt, 2);
|
|
42546
42466
|
|
|
42547
|
-
|
|
42548
|
-
|
|
42549
|
-
|
|
42550
|
-
|
|
42551
|
-
};
|
|
42467
|
+
each(div_2, 21, blocks, (blockInfo) => category() + blockInfo.label + blockInfo.definition.name, ($$anchor, blockInfo) => {
|
|
42468
|
+
var dd = root_3$4();
|
|
42469
|
+
var button_1 = child(dd);
|
|
42470
|
+
var node_2 = child(button_1);
|
|
42552
42471
|
|
|
42553
|
-
|
|
42554
|
-
|
|
42472
|
+
{
|
|
42473
|
+
var consequent_3 = ($$anchor) => {
|
|
42474
|
+
var figure = root_4$4();
|
|
42475
|
+
var div_3 = child(figure);
|
|
42476
|
+
var node_3 = child(div_3);
|
|
42555
42477
|
|
|
42556
|
-
|
|
42557
|
-
|
|
42558
|
-
|
|
42478
|
+
{
|
|
42479
|
+
var consequent_1 = ($$anchor) => {
|
|
42480
|
+
var img = root_5$3();
|
|
42559
42481
|
|
|
42560
|
-
|
|
42561
|
-
|
|
42562
|
-
|
|
42563
|
-
|
|
42564
|
-
|
|
42565
|
-
|
|
42566
|
-
|
|
42567
|
-
|
|
42568
|
-
|
|
42569
|
-
|
|
42570
|
-
|
|
42571
|
-
|
|
42572
|
-
|
|
42573
|
-
|
|
42482
|
+
template_effect(() => set_attribute(img, 'src', get(blockInfo).definition.img));
|
|
42483
|
+
append($$anchor, img);
|
|
42484
|
+
};
|
|
42485
|
+
|
|
42486
|
+
var consequent_2 = ($$anchor) => {
|
|
42487
|
+
var fragment_1 = comment();
|
|
42488
|
+
var node_4 = first_child(fragment_1);
|
|
42489
|
+
|
|
42490
|
+
html(node_4, () => get(blockInfo).definition.svg);
|
|
42491
|
+
append($$anchor, fragment_1);
|
|
42492
|
+
};
|
|
42493
|
+
|
|
42494
|
+
if_block(node_3, ($$render) => {
|
|
42495
|
+
if (get(blockInfo).definition.img) $$render(consequent_1); else if (get(blockInfo).definition.svg) $$render(consequent_2, 1);
|
|
42496
|
+
});
|
|
42497
|
+
}
|
|
42498
|
+
|
|
42499
|
+
var figcaption = sibling(div_3, 2);
|
|
42500
|
+
var text_1 = child(figcaption);
|
|
42501
|
+
template_effect(() => set_text(text_1, get(blockInfo).label));
|
|
42502
|
+
append($$anchor, figure);
|
|
42503
|
+
};
|
|
42504
|
+
|
|
42505
|
+
var alternate = ($$anchor) => {
|
|
42506
|
+
var text_2 = text();
|
|
42507
|
+
|
|
42508
|
+
template_effect(() => set_text(text_2, get(blockInfo).label));
|
|
42509
|
+
append($$anchor, text_2);
|
|
42510
|
+
};
|
|
42511
|
+
|
|
42512
|
+
if_block(node_2, ($$render) => {
|
|
42513
|
+
if (get(blockInfo).definition.img || get(blockInfo).definition.svg) $$render(consequent_3); else $$render(alternate, false);
|
|
42514
|
+
});
|
|
42515
|
+
}
|
|
42516
|
+
delegated('click', button_1, () => addBlock(get(blockInfo).definition));
|
|
42517
|
+
append($$anchor, dd);
|
|
42518
|
+
});
|
|
42519
|
+
template_effect(() => set_text(text$1, category()));
|
|
42520
|
+
append($$anchor, fragment);
|
|
42521
|
+
});
|
|
42574
42522
|
append($$anchor, div);
|
|
42575
42523
|
pop();
|
|
42576
42524
|
}
|
|
42577
42525
|
|
|
42526
|
+
delegate(['click']);
|
|
42527
|
+
|
|
42578
42528
|
function Arrow_big_down_line($$anchor, $$props) {
|
|
42579
42529
|
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
42580
42530
|
|
|
@@ -42974,34 +42924,142 @@ async function replaceElement(elA, elB, duration = 600) {
|
|
|
42974
42924
|
}
|
|
42975
42925
|
}
|
|
42976
42926
|
|
|
42977
|
-
var
|
|
42978
|
-
var
|
|
42927
|
+
var root_6$2 = from_html(`<!> <!>`, 1);
|
|
42928
|
+
var root_1$6 = from_html(`<div class="bge-menu-base svelte-1fv4q6w"><div class="bge-menu svelte-1fv4q6w"><div class="bge-move-group svelte-1fv4q6w"><!> <!></div> <div class="bge-standard-group svelte-1fv4q6w"><!> <!> <!> <!> <!> <!></div></div> <div class="bge-menu-margin svelte-1fv4q6w"><span class="svelte-1fv4q6w"> </span></div></div>`);
|
|
42979
42929
|
|
|
42980
42930
|
function Block_menu($$anchor, $$props) {
|
|
42981
|
-
push($$props,
|
|
42931
|
+
push($$props, true);
|
|
42982
42932
|
|
|
42983
|
-
const
|
|
42984
|
-
let
|
|
42985
|
-
let
|
|
42986
|
-
|
|
42987
|
-
let
|
|
42988
|
-
let
|
|
42989
|
-
let
|
|
42990
|
-
let
|
|
42991
|
-
let
|
|
42933
|
+
const engine = prop($$props, 'engine', 7);
|
|
42934
|
+
let currentBlock = state(null);
|
|
42935
|
+
let visible = state(false);
|
|
42936
|
+
const isMutable = user_derived(() => get(currentBlock)?.isMutable());
|
|
42937
|
+
let _width = state(0);
|
|
42938
|
+
let _height = state(0);
|
|
42939
|
+
let _x = state(0);
|
|
42940
|
+
let _y = state(0);
|
|
42941
|
+
let _marginBlockEnd = state(0);
|
|
42942
|
+
let marginBlockEndValue = state('0px');
|
|
42992
42943
|
|
|
42993
42944
|
engine().blockOptionsDialog.onChangeBlock((block) => {
|
|
42994
|
-
set(currentBlock, block);
|
|
42945
|
+
set(currentBlock, block, true);
|
|
42995
42946
|
});
|
|
42996
42947
|
|
|
42997
|
-
|
|
42998
|
-
|
|
42999
|
-
|
|
43000
|
-
|
|
43001
|
-
set(
|
|
43002
|
-
set(
|
|
43003
|
-
|
|
43004
|
-
|
|
42948
|
+
/**
|
|
42949
|
+
*
|
|
42950
|
+
*/
|
|
42951
|
+
function hide() {
|
|
42952
|
+
set(visible, false);
|
|
42953
|
+
set(currentBlock, null);
|
|
42954
|
+
$$props.onHide();
|
|
42955
|
+
}
|
|
42956
|
+
|
|
42957
|
+
let mouseX = 0;
|
|
42958
|
+
let mouseY = 0;
|
|
42959
|
+
let raf = 0;
|
|
42960
|
+
|
|
42961
|
+
/**
|
|
42962
|
+
*
|
|
42963
|
+
*/
|
|
42964
|
+
function updatePosition() {
|
|
42965
|
+
const doc = $$props.container.ownerDocument;
|
|
42966
|
+
const selected = getBlockAtPosition(doc, mouseX, mouseY);
|
|
42967
|
+
|
|
42968
|
+
if (!selected) {
|
|
42969
|
+
hide();
|
|
42970
|
+
|
|
42971
|
+
return;
|
|
42972
|
+
}
|
|
42973
|
+
|
|
42974
|
+
set(visible, true);
|
|
42975
|
+
|
|
42976
|
+
const { block, rect, marginBlockEnd } = selected;
|
|
42977
|
+
|
|
42978
|
+
set(currentBlock, block, true);
|
|
42979
|
+
set(_width, rect.width, true);
|
|
42980
|
+
set(_height, rect.height, true);
|
|
42981
|
+
set(_x, rect.left, true);
|
|
42982
|
+
set(_y, rect.top, true);
|
|
42983
|
+
set(_marginBlockEnd, marginBlockEnd, true);
|
|
42984
|
+
set(marginBlockEndValue, window.getComputedStyle(block.el).getPropertyValue('--bge-block-margin'), true);
|
|
42985
|
+
|
|
42986
|
+
engine().componentObserver.notify('select-block', {
|
|
42987
|
+
block,
|
|
42988
|
+
width: rect.width,
|
|
42989
|
+
height: rect.height,
|
|
42990
|
+
x: rect.left,
|
|
42991
|
+
y: rect.top,
|
|
42992
|
+
marginBlockEnd
|
|
42993
|
+
});
|
|
42994
|
+
}
|
|
42995
|
+
|
|
42996
|
+
/**
|
|
42997
|
+
*
|
|
42998
|
+
*/
|
|
42999
|
+
function scheduleUpdate() {
|
|
43000
|
+
cancelAnimationFrame(raf);
|
|
43001
|
+
|
|
43002
|
+
if (engine().isProcessed) {
|
|
43003
|
+
hide();
|
|
43004
|
+
|
|
43005
|
+
return;
|
|
43006
|
+
}
|
|
43007
|
+
|
|
43008
|
+
raf = requestAnimationFrame(() => {
|
|
43009
|
+
updatePosition();
|
|
43010
|
+
});
|
|
43011
|
+
}
|
|
43012
|
+
|
|
43013
|
+
user_effect(() => {
|
|
43014
|
+
const doc = $$props.container.ownerDocument;
|
|
43015
|
+
const body = doc.body;
|
|
43016
|
+
const win = doc.defaultView;
|
|
43017
|
+
|
|
43018
|
+
const onMouseMove = (e) => {
|
|
43019
|
+
mouseX = e.pageX;
|
|
43020
|
+
mouseY = e.pageY;
|
|
43021
|
+
scheduleUpdate();
|
|
43022
|
+
};
|
|
43023
|
+
|
|
43024
|
+
const onHideEvent = () => hide();
|
|
43025
|
+
|
|
43026
|
+
body.addEventListener('mousemove', onMouseMove);
|
|
43027
|
+
body.addEventListener('mouseleave', onHideEvent);
|
|
43028
|
+
doc.addEventListener('mouseleave', onHideEvent);
|
|
43029
|
+
win?.addEventListener('mouseleave', onHideEvent);
|
|
43030
|
+
globalThis.addEventListener('resize', onHideEvent);
|
|
43031
|
+
engine().el.addEventListener('bge:saved', scheduleUpdate);
|
|
43032
|
+
|
|
43033
|
+
const observer = new MutationObserver((mutations) => {
|
|
43034
|
+
for (const mutation of mutations) {
|
|
43035
|
+
for (const node of mutation.addedNodes) {
|
|
43036
|
+
if (!(node instanceof HTMLElement)) {
|
|
43037
|
+
continue;
|
|
43038
|
+
}
|
|
43039
|
+
|
|
43040
|
+
const images = node.querySelectorAll('img');
|
|
43041
|
+
|
|
43042
|
+
for (const img of images) {
|
|
43043
|
+
img.addEventListener('load', scheduleUpdate, { once: true });
|
|
43044
|
+
img.addEventListener('error', scheduleUpdate, { once: true });
|
|
43045
|
+
img.addEventListener('abort', scheduleUpdate, { once: true });
|
|
43046
|
+
}
|
|
43047
|
+
}
|
|
43048
|
+
}
|
|
43049
|
+
});
|
|
43050
|
+
|
|
43051
|
+
observer.observe(doc, { childList: true, subtree: true });
|
|
43052
|
+
|
|
43053
|
+
return () => {
|
|
43054
|
+
body.removeEventListener('mousemove', onMouseMove);
|
|
43055
|
+
body.removeEventListener('mouseleave', onHideEvent);
|
|
43056
|
+
doc.removeEventListener('mouseleave', onHideEvent);
|
|
43057
|
+
win?.removeEventListener('mouseleave', onHideEvent);
|
|
43058
|
+
globalThis.removeEventListener('resize', onHideEvent);
|
|
43059
|
+
engine().el.removeEventListener('bge:saved', scheduleUpdate);
|
|
43060
|
+
observer.disconnect();
|
|
43061
|
+
cancelAnimationFrame(raf);
|
|
43062
|
+
};
|
|
43005
43063
|
});
|
|
43006
43064
|
|
|
43007
43065
|
/**
|
|
@@ -43033,24 +43091,24 @@ function Block_menu($$anchor, $$props) {
|
|
|
43033
43091
|
return;
|
|
43034
43092
|
}
|
|
43035
43093
|
|
|
43036
|
-
let
|
|
43037
|
-
let
|
|
43094
|
+
let fromEl;
|
|
43095
|
+
let toEl;
|
|
43038
43096
|
|
|
43039
43097
|
if (toTop) {
|
|
43040
|
-
|
|
43041
|
-
|
|
43098
|
+
fromEl = get(currentBlock).el.previousElementSibling;
|
|
43099
|
+
toEl = get(currentBlock).el;
|
|
43042
43100
|
} else {
|
|
43043
|
-
|
|
43044
|
-
|
|
43101
|
+
fromEl = get(currentBlock).el;
|
|
43102
|
+
toEl = get(currentBlock).el.nextElementSibling;
|
|
43045
43103
|
}
|
|
43046
43104
|
|
|
43047
|
-
if (
|
|
43105
|
+
if (!fromEl || !toEl) {
|
|
43048
43106
|
return;
|
|
43049
43107
|
}
|
|
43050
43108
|
|
|
43051
|
-
engine(
|
|
43052
|
-
await replaceElement(
|
|
43053
|
-
engine(
|
|
43109
|
+
engine().isProcessed = true;
|
|
43110
|
+
await replaceElement(fromEl, toEl);
|
|
43111
|
+
engine().isProcessed = false;
|
|
43054
43112
|
engine().save();
|
|
43055
43113
|
}
|
|
43056
43114
|
|
|
@@ -43066,11 +43124,11 @@ function Block_menu($$anchor, $$props) {
|
|
|
43066
43124
|
return;
|
|
43067
43125
|
}
|
|
43068
43126
|
|
|
43069
|
-
engine(
|
|
43127
|
+
engine().isProcessed = true;
|
|
43070
43128
|
await Promise.resolve();
|
|
43071
43129
|
get(currentBlock).remove();
|
|
43072
43130
|
set(currentBlock, null);
|
|
43073
|
-
engine(
|
|
43131
|
+
engine().isProcessed = false;
|
|
43074
43132
|
engine().save();
|
|
43075
43133
|
}
|
|
43076
43134
|
|
|
@@ -43111,127 +43169,133 @@ function Block_menu($$anchor, $$props) {
|
|
|
43111
43169
|
alert('ブロックをコピーしました。\nブロックの追加ボタンからペースト(貼り付け)することができます。');
|
|
43112
43170
|
}
|
|
43113
43171
|
|
|
43114
|
-
|
|
43115
|
-
|
|
43116
|
-
});
|
|
43117
|
-
|
|
43118
|
-
legacy_pre_effect_reset();
|
|
43119
|
-
init();
|
|
43120
|
-
|
|
43121
|
-
var div = root$8();
|
|
43122
|
-
var div_1 = child(div);
|
|
43123
|
-
var div_2 = child(div_1);
|
|
43124
|
-
var node = child(div_2);
|
|
43125
|
-
|
|
43126
|
-
Block_menu_button(node, {
|
|
43127
|
-
label: 'ひとつ上へ移動',
|
|
43128
|
-
action: () => move(true),
|
|
43129
|
-
children: ($$anchor, $$slotProps) => {
|
|
43130
|
-
Arrow_big_up_line($$anchor, {});
|
|
43131
|
-
}});
|
|
43132
|
-
|
|
43133
|
-
var node_1 = sibling(node, 2);
|
|
43134
|
-
|
|
43135
|
-
Block_menu_button(node_1, {
|
|
43136
|
-
label: 'ひとつ下へ移動',
|
|
43137
|
-
action: () => move(false),
|
|
43138
|
-
children: ($$anchor, $$slotProps) => {
|
|
43139
|
-
Arrow_big_down_line($$anchor, {});
|
|
43140
|
-
}});
|
|
43172
|
+
var fragment = comment();
|
|
43173
|
+
var node_1 = first_child(fragment);
|
|
43141
43174
|
|
|
43142
|
-
|
|
43143
|
-
|
|
43175
|
+
{
|
|
43176
|
+
var consequent_1 = ($$anchor) => {
|
|
43177
|
+
var div = root_1$6();
|
|
43178
|
+
var div_1 = child(div);
|
|
43179
|
+
var div_2 = child(div_1);
|
|
43180
|
+
var node_2 = child(div_2);
|
|
43181
|
+
|
|
43182
|
+
Block_menu_button(node_2, {
|
|
43183
|
+
label: 'ひとつ上へ移動',
|
|
43184
|
+
action: () => move(true),
|
|
43185
|
+
children: ($$anchor, $$slotProps) => {
|
|
43186
|
+
Arrow_big_up_line($$anchor, {});
|
|
43187
|
+
}});
|
|
43144
43188
|
|
|
43145
|
-
|
|
43146
|
-
label: '上にブロックを追加',
|
|
43147
|
-
action: () => insert(true),
|
|
43148
|
-
children: ($$anchor, $$slotProps) => {
|
|
43149
|
-
Row_insert_top($$anchor, {});
|
|
43150
|
-
}});
|
|
43189
|
+
var node_3 = sibling(node_2, 2);
|
|
43151
43190
|
|
|
43152
|
-
|
|
43191
|
+
Block_menu_button(node_3, {
|
|
43192
|
+
label: 'ひとつ下へ移動',
|
|
43193
|
+
action: () => move(false),
|
|
43194
|
+
children: ($$anchor, $$slotProps) => {
|
|
43195
|
+
Arrow_big_down_line($$anchor, {});
|
|
43196
|
+
}});
|
|
43153
43197
|
|
|
43154
|
-
|
|
43155
|
-
|
|
43156
|
-
action: () => insert(false),
|
|
43157
|
-
children: ($$anchor, $$slotProps) => {
|
|
43158
|
-
Row_insert_bottom($$anchor, {});
|
|
43159
|
-
}});
|
|
43198
|
+
var div_3 = sibling(div_2, 2);
|
|
43199
|
+
var node_4 = child(div_3);
|
|
43160
43200
|
|
|
43161
|
-
|
|
43201
|
+
Block_menu_button(node_4, {
|
|
43202
|
+
label: '上にブロックを追加',
|
|
43203
|
+
action: () => insert(true),
|
|
43204
|
+
children: ($$anchor, $$slotProps) => {
|
|
43205
|
+
Row_insert_top($$anchor, {});
|
|
43206
|
+
}});
|
|
43162
43207
|
|
|
43163
|
-
|
|
43164
|
-
var consequent = ($$anchor) => {
|
|
43165
|
-
var fragment_4 = root_5$3();
|
|
43166
|
-
var node_5 = first_child(fragment_4);
|
|
43208
|
+
var node_5 = sibling(node_4, 2);
|
|
43167
43209
|
|
|
43168
43210
|
Block_menu_button(node_5, {
|
|
43169
|
-
label: '
|
|
43170
|
-
action: () =>
|
|
43211
|
+
label: '下にブロックを追加',
|
|
43212
|
+
action: () => insert(false),
|
|
43171
43213
|
children: ($$anchor, $$slotProps) => {
|
|
43172
|
-
|
|
43214
|
+
Row_insert_bottom($$anchor, {});
|
|
43173
43215
|
}});
|
|
43174
43216
|
|
|
43175
43217
|
var node_6 = sibling(node_5, 2);
|
|
43176
43218
|
|
|
43177
|
-
|
|
43178
|
-
|
|
43179
|
-
|
|
43180
|
-
|
|
43181
|
-
|
|
43182
|
-
|
|
43183
|
-
|
|
43184
|
-
|
|
43185
|
-
|
|
43219
|
+
{
|
|
43220
|
+
var consequent = ($$anchor) => {
|
|
43221
|
+
var fragment_5 = root_6$2();
|
|
43222
|
+
var node_7 = first_child(fragment_5);
|
|
43223
|
+
|
|
43224
|
+
Block_menu_button(node_7, {
|
|
43225
|
+
label: 'ブロック内に要素を追加',
|
|
43226
|
+
action: () => updateGridItems(1),
|
|
43227
|
+
children: ($$anchor, $$slotProps) => {
|
|
43228
|
+
Layout_grid_add($$anchor, {});
|
|
43229
|
+
}});
|
|
43230
|
+
|
|
43231
|
+
var node_8 = sibling(node_7, 2);
|
|
43232
|
+
|
|
43233
|
+
Block_menu_button(node_8, {
|
|
43234
|
+
label: 'ブロック内の要素を削除',
|
|
43235
|
+
action: () => updateGridItems(-1),
|
|
43236
|
+
children: ($$anchor, $$slotProps) => {
|
|
43237
|
+
Layout_grid_remove($$anchor, {});
|
|
43238
|
+
}});
|
|
43239
|
+
|
|
43240
|
+
append($$anchor, fragment_5);
|
|
43241
|
+
};
|
|
43186
43242
|
|
|
43187
|
-
|
|
43188
|
-
|
|
43189
|
-
|
|
43190
|
-
|
|
43243
|
+
if_block(node_6, ($$render) => {
|
|
43244
|
+
if (get(isMutable)) $$render(consequent);
|
|
43245
|
+
});
|
|
43246
|
+
}
|
|
43191
43247
|
|
|
43192
|
-
|
|
43248
|
+
var node_9 = sibling(node_6, 2);
|
|
43193
43249
|
|
|
43194
|
-
|
|
43195
|
-
|
|
43196
|
-
|
|
43197
|
-
|
|
43198
|
-
|
|
43199
|
-
|
|
43250
|
+
Block_menu_button(node_9, {
|
|
43251
|
+
label: 'オプション設定',
|
|
43252
|
+
action: () => openConfig(),
|
|
43253
|
+
children: ($$anchor, $$slotProps) => {
|
|
43254
|
+
Settings($$anchor, {});
|
|
43255
|
+
}});
|
|
43200
43256
|
|
|
43201
|
-
|
|
43257
|
+
var node_10 = sibling(node_9, 2);
|
|
43202
43258
|
|
|
43203
|
-
|
|
43204
|
-
|
|
43205
|
-
|
|
43206
|
-
|
|
43207
|
-
|
|
43208
|
-
|
|
43259
|
+
Block_menu_button(node_10, {
|
|
43260
|
+
label: 'ブロックをコピー',
|
|
43261
|
+
action: () => copy(),
|
|
43262
|
+
children: ($$anchor, $$slotProps) => {
|
|
43263
|
+
Clipboard_plus($$anchor, {});
|
|
43264
|
+
}});
|
|
43209
43265
|
|
|
43210
|
-
|
|
43266
|
+
var node_11 = sibling(node_10, 2);
|
|
43211
43267
|
|
|
43212
|
-
|
|
43213
|
-
|
|
43214
|
-
|
|
43215
|
-
|
|
43216
|
-
|
|
43217
|
-
|
|
43268
|
+
Block_menu_button(node_11, {
|
|
43269
|
+
label: 'ブロックを削除',
|
|
43270
|
+
action: () => remove(),
|
|
43271
|
+
children: ($$anchor, $$slotProps) => {
|
|
43272
|
+
Trash($$anchor, {});
|
|
43273
|
+
}});
|
|
43218
43274
|
|
|
43219
|
-
|
|
43220
|
-
|
|
43221
|
-
|
|
43275
|
+
var div_4 = sibling(div_1, 2);
|
|
43276
|
+
var span = child(div_4);
|
|
43277
|
+
var text = child(span);
|
|
43222
43278
|
|
|
43223
|
-
|
|
43224
|
-
|
|
43279
|
+
template_effect(() => {
|
|
43280
|
+
set_style(div, `
|
|
43225
43281
|
--width:${get(_width)}px;
|
|
43226
43282
|
--height:${get(_height)}px;
|
|
43227
43283
|
--x:${get(_x)}px;
|
|
43228
43284
|
--y:${get(_y)}px;
|
|
43229
43285
|
--margin-block-end:${get(_marginBlockEnd) ?? '0'}px`);
|
|
43230
43286
|
|
|
43231
|
-
|
|
43232
|
-
|
|
43287
|
+
set_text(text, `余白: ${get(marginBlockEndValue) ?? ''} (${get(_marginBlockEnd) ?? ''}px)`);
|
|
43288
|
+
});
|
|
43233
43289
|
|
|
43234
|
-
|
|
43290
|
+
append($$anchor, div);
|
|
43291
|
+
};
|
|
43292
|
+
|
|
43293
|
+
if_block(node_1, ($$render) => {
|
|
43294
|
+
if (get(visible)) $$render(consequent_1);
|
|
43295
|
+
});
|
|
43296
|
+
}
|
|
43297
|
+
|
|
43298
|
+
append($$anchor, fragment);
|
|
43235
43299
|
pop();
|
|
43236
43300
|
}
|
|
43237
43301
|
|
|
@@ -43249,7 +43313,7 @@ var root_1$5 = from_html(`<fieldset><legend>コンテナ特性</legend> <!> <!>
|
|
|
43249
43313
|
var root_15 = from_html(`<option> </option>`);
|
|
43250
43314
|
var root_14 = from_html(`<label><span> </span> <select></select></label>`);
|
|
43251
43315
|
var root_13 = from_html(`<fieldset><legend>ブロックのスタイル拡張</legend> <!></fieldset>`);
|
|
43252
|
-
var root$
|
|
43316
|
+
var root$8 = from_html(`<!> <!> <label><span>独自class設定</span> <input type="text" name="bge-options-classes" aria-describedby="block-option-classes-desc"/></label> <small id="block-option-classes-desc">複数指定する場合はスペース(空白文字)で区切ってください。</small> <label><span>ID設定: <code>bge-</code></span> <input name="bge-options-id" type="text" aria-describedby="block-option-id-desc"/></label> <small id="block-option-id-desc">アンカーリンク用のID属性を設定します。実際のIDは<code>bge-</code>が自動的に先頭に付加されます。</small>`, 1);
|
|
43253
43317
|
|
|
43254
43318
|
function Block_options($$anchor, $$props) {
|
|
43255
43319
|
push($$props, true);
|
|
@@ -43313,7 +43377,7 @@ function Block_options($$anchor, $$props) {
|
|
|
43313
43377
|
set(currentFrameSemantics, newSemantics, true);
|
|
43314
43378
|
}
|
|
43315
43379
|
|
|
43316
|
-
var fragment = root$
|
|
43380
|
+
var fragment = root$8();
|
|
43317
43381
|
var node = first_child(fragment);
|
|
43318
43382
|
|
|
43319
43383
|
{
|
|
@@ -43681,30 +43745,27 @@ var root_1$4 = from_html(`<span class="svelte-17zpf86">ソース表示</span>`);
|
|
|
43681
43745
|
var root_2$3 = from_html(`<span class="svelte-17zpf86">ソース表示</span>`);
|
|
43682
43746
|
var root_3$2 = from_html(`<button type="button" class="svelte-17zpf86">本稿を下書きにコピー</button>`);
|
|
43683
43747
|
var root_4$2 = from_html(`<button type="button" class="svelte-17zpf86">下書きを本稿にコピー</button>`);
|
|
43684
|
-
var root$
|
|
43748
|
+
var root$7 = from_html(`<div class="draft-btn svelte-17zpf86"><div class="draft-tab-btn svelte-17zpf86"><button type="button" class="svelte-17zpf86">本稿モード <!></button> <button type="button" class="svelte-17zpf86">下書きモード <!></button></div> <div class="draft-copy-btn svelte-17zpf86"><!></div></div>`);
|
|
43685
43749
|
|
|
43686
43750
|
function Draft_switcher($$anchor, $$props) {
|
|
43687
|
-
push($$props,
|
|
43688
|
-
|
|
43689
|
-
let engine = prop($$props, 'engine', 8);
|
|
43690
|
-
let isMain = mutable_source();
|
|
43691
|
-
let isVisualMode = mutable_source();
|
|
43751
|
+
push($$props, true);
|
|
43692
43752
|
|
|
43693
|
-
|
|
43753
|
+
let isMain = state($$props.engine.content.type === 'main');
|
|
43754
|
+
let isVisualMode = state(proxy($$props.engine.content.isVisualMode));
|
|
43694
43755
|
|
|
43695
43756
|
/**
|
|
43696
43757
|
*
|
|
43697
43758
|
*/
|
|
43698
43759
|
function update() {
|
|
43699
|
-
set(isMain, engine
|
|
43700
|
-
set(isVisualMode, engine
|
|
43760
|
+
set(isMain, $$props.engine.content.type === 'main');
|
|
43761
|
+
set(isVisualMode, $$props.engine.content.isVisualMode, true);
|
|
43701
43762
|
}
|
|
43702
43763
|
|
|
43703
43764
|
/**
|
|
43704
43765
|
*
|
|
43705
43766
|
*/
|
|
43706
43767
|
function onClickMain() {
|
|
43707
|
-
engine
|
|
43768
|
+
$$props.engine.showMain();
|
|
43708
43769
|
update();
|
|
43709
43770
|
}
|
|
43710
43771
|
|
|
@@ -43712,7 +43773,7 @@ function Draft_switcher($$anchor, $$props) {
|
|
|
43712
43773
|
*
|
|
43713
43774
|
*/
|
|
43714
43775
|
function onClickDraft() {
|
|
43715
|
-
engine
|
|
43776
|
+
$$props.engine.showDraft();
|
|
43716
43777
|
update();
|
|
43717
43778
|
}
|
|
43718
43779
|
|
|
@@ -43720,7 +43781,7 @@ function Draft_switcher($$anchor, $$props) {
|
|
|
43720
43781
|
*
|
|
43721
43782
|
*/
|
|
43722
43783
|
async function onClickDraftToMain() {
|
|
43723
|
-
if (await engine
|
|
43784
|
+
if (await $$props.engine.draftToMain(() => confirm('下書き内容を本稿へ上書きしてもよろしいですか?'))) {
|
|
43724
43785
|
onClickMain();
|
|
43725
43786
|
}
|
|
43726
43787
|
}
|
|
@@ -43729,7 +43790,7 @@ function Draft_switcher($$anchor, $$props) {
|
|
|
43729
43790
|
*
|
|
43730
43791
|
*/
|
|
43731
43792
|
async function onClickMainToDraft() {
|
|
43732
|
-
if (await engine
|
|
43793
|
+
if (await $$props.engine.mainToDraft(() => confirm('本稿内容を下書きへ上書きしてもよろしいですか?'))) {
|
|
43733
43794
|
onClickDraft();
|
|
43734
43795
|
}
|
|
43735
43796
|
}
|
|
@@ -43738,7 +43799,7 @@ function Draft_switcher($$anchor, $$props) {
|
|
|
43738
43799
|
*
|
|
43739
43800
|
*/
|
|
43740
43801
|
function toggleDisplayMode() {
|
|
43741
|
-
engine
|
|
43802
|
+
$$props.engine.content.toggleDisplayMode();
|
|
43742
43803
|
update();
|
|
43743
43804
|
}
|
|
43744
43805
|
|
|
@@ -43751,7 +43812,7 @@ function Draft_switcher($$anchor, $$props) {
|
|
|
43751
43812
|
return;
|
|
43752
43813
|
}
|
|
43753
43814
|
|
|
43754
|
-
engine
|
|
43815
|
+
$$props.engine.showMain();
|
|
43755
43816
|
toggleDisplayMode();
|
|
43756
43817
|
}
|
|
43757
43818
|
|
|
@@ -43764,13 +43825,11 @@ function Draft_switcher($$anchor, $$props) {
|
|
|
43764
43825
|
return;
|
|
43765
43826
|
}
|
|
43766
43827
|
|
|
43767
|
-
engine
|
|
43828
|
+
$$props.engine.showDraft();
|
|
43768
43829
|
toggleDisplayMode();
|
|
43769
43830
|
}
|
|
43770
43831
|
|
|
43771
|
-
|
|
43772
|
-
|
|
43773
|
-
var div = root$6();
|
|
43832
|
+
var div = root$7();
|
|
43774
43833
|
var div_1 = child(div);
|
|
43775
43834
|
var button = child(div_1);
|
|
43776
43835
|
var node = sibling(child(button));
|
|
@@ -43809,14 +43868,14 @@ function Draft_switcher($$anchor, $$props) {
|
|
|
43809
43868
|
var consequent_2 = ($$anchor) => {
|
|
43810
43869
|
var button_2 = root_3$2();
|
|
43811
43870
|
|
|
43812
|
-
|
|
43871
|
+
delegated('click', button_2, onClickMainToDraft);
|
|
43813
43872
|
append($$anchor, button_2);
|
|
43814
43873
|
};
|
|
43815
43874
|
|
|
43816
43875
|
var alternate = ($$anchor) => {
|
|
43817
43876
|
var button_3 = root_4$2();
|
|
43818
43877
|
|
|
43819
|
-
|
|
43878
|
+
delegated('click', button_3, onClickDraftToMain);
|
|
43820
43879
|
append($$anchor, button_3);
|
|
43821
43880
|
};
|
|
43822
43881
|
|
|
@@ -43830,14 +43889,16 @@ function Draft_switcher($$anchor, $$props) {
|
|
|
43830
43889
|
set_attribute(button_1, 'aria-pressed', !get(isMain));
|
|
43831
43890
|
});
|
|
43832
43891
|
|
|
43833
|
-
|
|
43834
|
-
|
|
43835
|
-
|
|
43836
|
-
|
|
43892
|
+
delegated('click', button, onClickMain);
|
|
43893
|
+
delegated('dblclick', button, onDblClickMain);
|
|
43894
|
+
delegated('click', button_1, onClickDraft);
|
|
43895
|
+
delegated('dblclick', button_1, onDblClickDraft);
|
|
43837
43896
|
append($$anchor, div);
|
|
43838
43897
|
pop();
|
|
43839
43898
|
}
|
|
43840
43899
|
|
|
43900
|
+
delegate(['click', 'dblclick']);
|
|
43901
|
+
|
|
43841
43902
|
function File($$anchor, $$props) {
|
|
43842
43903
|
const $$sanitized_props = legacy_rest_props($$props, ['children', '$$slots', '$$events', '$$legacy']);
|
|
43843
43904
|
|
|
@@ -44094,25 +44155,21 @@ function getExt(src) {
|
|
|
44094
44155
|
|
|
44095
44156
|
var root_1$3 = from_html(`<img alt="画像のプレビュー" loading="lazy" class="svelte-by6cmj"/>`);
|
|
44096
44157
|
var root_2$2 = from_html(`<video playsinline="" class="svelte-by6cmj"><source/> <track kind="captions" src=""/> <!></video>`, 2);
|
|
44097
|
-
var root$
|
|
44158
|
+
var root$6 = from_html(`<span data-bge-editor-ui-component="thumbnail" class="svelte-by6cmj"><!></span>`);
|
|
44098
44159
|
|
|
44099
44160
|
function Thumbnail($$anchor, $$props) {
|
|
44100
|
-
push($$props,
|
|
44101
|
-
|
|
44102
|
-
let src = prop($$props, 'src', 8);
|
|
44103
|
-
let isLoaded = mutable_source(false);
|
|
44104
|
-
const file = getExt(src());
|
|
44105
|
-
|
|
44106
|
-
init();
|
|
44161
|
+
push($$props, true);
|
|
44107
44162
|
|
|
44108
|
-
|
|
44163
|
+
let isLoaded = state(false);
|
|
44164
|
+
const file = getExt($$props.src);
|
|
44165
|
+
var span = root$6();
|
|
44109
44166
|
var node = child(span);
|
|
44110
44167
|
|
|
44111
44168
|
{
|
|
44112
44169
|
var consequent = ($$anchor) => {
|
|
44113
44170
|
var img = root_1$3();
|
|
44114
44171
|
|
|
44115
|
-
template_effect(() => set_attribute(img, 'src', src
|
|
44172
|
+
template_effect(() => set_attribute(img, 'src', $$props.src));
|
|
44116
44173
|
event('load', img, () => set(isLoaded, true));
|
|
44117
44174
|
append($$anchor, img);
|
|
44118
44175
|
};
|
|
@@ -44128,8 +44185,8 @@ function Thumbnail($$anchor, $$props) {
|
|
|
44128
44185
|
Video(node_1, {});
|
|
44129
44186
|
|
|
44130
44187
|
template_effect(() => {
|
|
44131
|
-
set_attribute(source, 'src', src
|
|
44132
|
-
set_attribute(source, 'type',
|
|
44188
|
+
set_attribute(source, 'src', $$props.src);
|
|
44189
|
+
set_attribute(source, 'type', `video/${file.ext}`);
|
|
44133
44190
|
});
|
|
44134
44191
|
|
|
44135
44192
|
append($$anchor, video);
|
|
@@ -44160,7 +44217,7 @@ function Thumbnail($$anchor, $$props) {
|
|
|
44160
44217
|
};
|
|
44161
44218
|
|
|
44162
44219
|
if_block(node, ($$render) => {
|
|
44163
|
-
if (
|
|
44220
|
+
if (file.isImage) $$render(consequent); else if (file.isVideo) $$render(consequent_1, 1); else if (file.isAudio) $$render(consequent_2, 2); else if (file.isDoc) $$render(consequent_3, 3); else if (file.isPpt) $$render(consequent_4, 4); else if (file.isXls) $$render(consequent_5, 5); else if (file.isPdf) $$render(consequent_6, 6); else $$render(alternate, false);
|
|
44164
44221
|
});
|
|
44165
44222
|
}
|
|
44166
44223
|
template_effect(() => set_attribute(span, 'data-loaded', get(isLoaded)));
|
|
@@ -44174,10 +44231,10 @@ var root_5$1 = from_html(`<span class="svelte-6hu200">アップロード中... <
|
|
|
44174
44231
|
var root_6$1 = from_html(`<span class="attr svelte-6hu200"><span class="svelte-6hu200">ID</span><span class="svelte-6hu200"><!></span> <span class="svelte-6hu200">名称</span><span class="svelte-6hu200"><!></span> <span class="svelte-6hu200">更新</span><span class="svelte-6hu200"> </span> <span class="svelte-6hu200">サイズ</span><span class="svelte-6hu200"> </span></span>`);
|
|
44175
44232
|
var root_7$1 = from_html(`<button class="delete svelte-6hu200" type="button">削除</button>`);
|
|
44176
44233
|
var root_4$1 = from_html(`<li class="svelte-6hu200"><button class="file svelte-6hu200" type="button"><span class="thumbnail svelte-6hu200"><!></span> <!></button> <!></li>`);
|
|
44177
|
-
var root$
|
|
44234
|
+
var root$5 = from_html(`<div class="ctrl svelte-6hu200"><div class="pagination svelte-6hu200"><button type="button" class="svelte-6hu200">前へ</button> <div class="page svelte-6hu200"><span><input type="number" min="1" aria-label="ページ番号"/></span> <span>/</span> <span> </span></div> <button type="button" class="svelte-6hu200">次へ</button></div> <input type="search" placeholder="検索"/></div> <ul class="list svelte-6hu200"></ul>`, 1);
|
|
44178
44235
|
|
|
44179
44236
|
function File_list($$anchor, $$props) {
|
|
44180
|
-
push($$props,
|
|
44237
|
+
push($$props, true);
|
|
44181
44238
|
|
|
44182
44239
|
const // On initial mount
|
|
44183
44240
|
/**
|
|
@@ -44201,7 +44258,7 @@ function File_list($$anchor, $$props) {
|
|
|
44201
44258
|
var fragment = comment();
|
|
44202
44259
|
var node = first_child(fragment);
|
|
44203
44260
|
|
|
44204
|
-
each(node,
|
|
44261
|
+
each(node, 19, chars, (char, i) => char + i, ($$anchor, char, i) => {
|
|
44205
44262
|
var fragment_1 = root_2$1();
|
|
44206
44263
|
var node_1 = first_child(fragment_1);
|
|
44207
44264
|
|
|
@@ -44227,43 +44284,45 @@ function File_list($$anchor, $$props) {
|
|
|
44227
44284
|
append($$anchor, fragment);
|
|
44228
44285
|
};
|
|
44229
44286
|
|
|
44230
|
-
|
|
44231
|
-
|
|
44232
|
-
|
|
44233
|
-
|
|
44234
|
-
let
|
|
44235
|
-
let
|
|
44236
|
-
let
|
|
44237
|
-
let
|
|
44238
|
-
let
|
|
44239
|
-
let uploaded = mutable_source(0);
|
|
44240
|
-
let total = mutable_source(100);
|
|
44287
|
+
const getFileList = $$props.engine.serverAPI.getFileList;
|
|
44288
|
+
const deleteFile = $$props.engine.serverAPI.deleteFile;
|
|
44289
|
+
let fileList = state(proxy([]));
|
|
44290
|
+
let selectedPath = state('');
|
|
44291
|
+
let searchWord = state('');
|
|
44292
|
+
let currentPage = state(0);
|
|
44293
|
+
let totalPage = state(1);
|
|
44294
|
+
let uploaded = state(0);
|
|
44295
|
+
let total = state(100);
|
|
44241
44296
|
let requestDebounce = -1;
|
|
44242
44297
|
|
|
44243
|
-
engine
|
|
44244
|
-
set(selectedPath, path);
|
|
44298
|
+
$$props.engine.componentObserver.on('file-select', async ({ path, isMounted }) => {
|
|
44299
|
+
set(selectedPath, path, true);
|
|
44245
44300
|
|
|
44246
44301
|
if (!isMounted && // On initial mount
|
|
44247
44302
|
getFileList) {
|
|
44248
|
-
const result = await getFileList(fileType
|
|
44303
|
+
const result = await getFileList($$props.fileType, { filter: '', page: 0, selected: get(selectedPath) });
|
|
44249
44304
|
|
|
44250
|
-
set(fileList, result.data);
|
|
44251
|
-
set(currentPage, result.pagination.current);
|
|
44252
|
-
set(totalPage, result.pagination.total);
|
|
44305
|
+
set(fileList, result.data, true);
|
|
44306
|
+
set(currentPage, result.pagination.current, true);
|
|
44307
|
+
set(totalPage, result.pagination.total, true);
|
|
44253
44308
|
}
|
|
44254
44309
|
|
|
44255
44310
|
if (path.startsWith('blob:')) {
|
|
44256
|
-
set(
|
|
44257
|
-
|
|
44258
|
-
|
|
44259
|
-
|
|
44260
|
-
|
|
44261
|
-
|
|
44262
|
-
|
|
44263
|
-
|
|
44264
|
-
|
|
44265
|
-
|
|
44266
|
-
|
|
44311
|
+
set(
|
|
44312
|
+
fileList,
|
|
44313
|
+
[
|
|
44314
|
+
{
|
|
44315
|
+
fileId: '',
|
|
44316
|
+
name: '',
|
|
44317
|
+
size: 0,
|
|
44318
|
+
timestamp: Date.now(),
|
|
44319
|
+
url: path,
|
|
44320
|
+
sizes: {}
|
|
44321
|
+
},
|
|
44322
|
+
...get(fileList).filter((file) => !file.url.startsWith('blob:'))
|
|
44323
|
+
],
|
|
44324
|
+
true
|
|
44325
|
+
);
|
|
44267
44326
|
}
|
|
44268
44327
|
|
|
44269
44328
|
const selectedButton = await awaitUntilFound(() => document.querySelector(`button[aria-pressed="true"]:has(img[src="${path}"])`));
|
|
@@ -44273,15 +44332,15 @@ function File_list($$anchor, $$props) {
|
|
|
44273
44332
|
}
|
|
44274
44333
|
});
|
|
44275
44334
|
|
|
44276
|
-
engine
|
|
44335
|
+
$$props.engine.componentObserver.on('file-upload-progress', (progress) => {
|
|
44277
44336
|
if (progress.blob === get(selectedPath)) {
|
|
44278
|
-
set(uploaded, progress.uploaded);
|
|
44279
|
-
set(total, progress.total);
|
|
44337
|
+
set(uploaded, progress.uploaded, true);
|
|
44338
|
+
set(total, progress.total, true);
|
|
44280
44339
|
}
|
|
44281
44340
|
});
|
|
44282
44341
|
|
|
44283
|
-
engine
|
|
44284
|
-
set(fileList, data);
|
|
44342
|
+
$$props.engine.componentObserver.on('file-listup', ({ data }) => {
|
|
44343
|
+
set(fileList, data, true);
|
|
44285
44344
|
});
|
|
44286
44345
|
|
|
44287
44346
|
/**
|
|
@@ -44295,17 +44354,17 @@ function File_list($$anchor, $$props) {
|
|
|
44295
44354
|
return;
|
|
44296
44355
|
}
|
|
44297
44356
|
|
|
44298
|
-
set(currentPage, page);
|
|
44357
|
+
set(currentPage, page, true);
|
|
44299
44358
|
window.clearTimeout(requestDebounce);
|
|
44300
44359
|
|
|
44301
44360
|
requestDebounce = window.setTimeout(
|
|
44302
44361
|
async () => {
|
|
44303
|
-
const result = await getFileList?.(fileType
|
|
44362
|
+
const result = await getFileList?.($$props.fileType, { page });
|
|
44304
44363
|
|
|
44305
44364
|
if (result) {
|
|
44306
|
-
set(fileList, result.data);
|
|
44307
|
-
set(currentPage, result.pagination.current);
|
|
44308
|
-
set(totalPage, result.pagination.total);
|
|
44365
|
+
set(fileList, result.data, true);
|
|
44366
|
+
set(currentPage, result.pagination.current, true);
|
|
44367
|
+
set(totalPage, result.pagination.total, true);
|
|
44309
44368
|
}
|
|
44310
44369
|
},
|
|
44311
44370
|
100
|
|
@@ -44321,17 +44380,17 @@ function File_list($$anchor, $$props) {
|
|
|
44321
44380
|
return;
|
|
44322
44381
|
}
|
|
44323
44382
|
|
|
44324
|
-
set(searchWord, value);
|
|
44383
|
+
set(searchWord, value, true);
|
|
44325
44384
|
window.clearTimeout(requestDebounce);
|
|
44326
44385
|
|
|
44327
44386
|
requestDebounce = window.setTimeout(
|
|
44328
44387
|
async () => {
|
|
44329
|
-
const result = await getFileList?.(fileType
|
|
44388
|
+
const result = await getFileList?.($$props.fileType, { filter: get(searchWord) });
|
|
44330
44389
|
|
|
44331
44390
|
if (result) {
|
|
44332
|
-
set(fileList, result.data);
|
|
44333
|
-
set(currentPage, result.pagination.current);
|
|
44334
|
-
set(totalPage, result.pagination.total);
|
|
44391
|
+
set(fileList, result.data, true);
|
|
44392
|
+
set(currentPage, result.pagination.current, true);
|
|
44393
|
+
set(totalPage, result.pagination.total, true);
|
|
44335
44394
|
}
|
|
44336
44395
|
},
|
|
44337
44396
|
300
|
|
@@ -44344,7 +44403,7 @@ function File_list($$anchor, $$props) {
|
|
|
44344
44403
|
* @param fileSize
|
|
44345
44404
|
*/
|
|
44346
44405
|
function selectFile(path, fileSize) {
|
|
44347
|
-
engine
|
|
44406
|
+
$$props.engine.componentObserver.notify('file-select', { path, fileSize, isEmpty: false, isMounted: true });
|
|
44348
44407
|
}
|
|
44349
44408
|
|
|
44350
44409
|
/**
|
|
@@ -44365,9 +44424,7 @@ function File_list($$anchor, $$props) {
|
|
|
44365
44424
|
return awaitUntilFound(callback);
|
|
44366
44425
|
}
|
|
44367
44426
|
|
|
44368
|
-
|
|
44369
|
-
|
|
44370
|
-
var fragment_2 = root$4();
|
|
44427
|
+
var fragment_2 = root$5();
|
|
44371
44428
|
var div = first_child(fragment_2);
|
|
44372
44429
|
var div_1 = child(div);
|
|
44373
44430
|
var button = child(div_1);
|
|
@@ -44384,7 +44441,7 @@ function File_list($$anchor, $$props) {
|
|
|
44384
44441
|
|
|
44385
44442
|
var ul = sibling(div, 2);
|
|
44386
44443
|
|
|
44387
|
-
each(ul,
|
|
44444
|
+
each(ul, 21, () => get(fileList), (file) => file.url, ($$anchor, file) => {
|
|
44388
44445
|
var li = root_4$1();
|
|
44389
44446
|
var button_2 = child(li);
|
|
44390
44447
|
var span_2 = child(button_2);
|
|
@@ -44392,7 +44449,7 @@ function File_list($$anchor, $$props) {
|
|
|
44392
44449
|
|
|
44393
44450
|
Thumbnail(node_2, {
|
|
44394
44451
|
get src() {
|
|
44395
|
-
return
|
|
44452
|
+
return get(file).url;
|
|
44396
44453
|
}
|
|
44397
44454
|
});
|
|
44398
44455
|
|
|
@@ -44403,22 +44460,11 @@ function File_list($$anchor, $$props) {
|
|
|
44403
44460
|
var span_3 = root_5$1();
|
|
44404
44461
|
var span_4 = sibling(child(span_3));
|
|
44405
44462
|
var text_3 = child(span_4);
|
|
44406
|
-
|
|
44407
|
-
template_effect(($0) => set_text(text_3, `${$0 ?? ''}%`), [
|
|
44408
|
-
() => (
|
|
44409
|
-
get(uploaded),
|
|
44410
|
-
get(total),
|
|
44411
|
-
untrack(() => Math.floor(get(uploaded) / get(total) * 100))
|
|
44412
|
-
)
|
|
44413
|
-
]);
|
|
44414
|
-
|
|
44463
|
+
template_effect(($0) => set_text(text_3, `${$0 ?? ''}%`), [() => Math.floor(get(uploaded) / get(total) * 100)]);
|
|
44415
44464
|
append($$anchor, span_3);
|
|
44416
44465
|
};
|
|
44417
44466
|
|
|
44418
|
-
var d = user_derived(() => (
|
|
44419
|
-
get(file),
|
|
44420
|
-
untrack(() => get(file).url.startsWith('blob:'))
|
|
44421
|
-
));
|
|
44467
|
+
var d = user_derived(() => get(file).url.startsWith('blob:'));
|
|
44422
44468
|
|
|
44423
44469
|
var alternate = ($$anchor) => {
|
|
44424
44470
|
var span_5 = root_6$1();
|
|
@@ -44426,11 +44472,7 @@ function File_list($$anchor, $$props) {
|
|
|
44426
44472
|
var node_4 = child(span_6);
|
|
44427
44473
|
|
|
44428
44474
|
{
|
|
44429
|
-
let $0 =
|
|
44430
|
-
get(file),
|
|
44431
|
-
get(searchWord),
|
|
44432
|
-
untrack(() => get(file).fileId.split(get(searchWord)))
|
|
44433
|
-
));
|
|
44475
|
+
let $0 = user_derived(() => get(file).fileId.split(get(searchWord)));
|
|
44434
44476
|
|
|
44435
44477
|
marked(node_4, () => get($0));
|
|
44436
44478
|
}
|
|
@@ -44439,11 +44481,7 @@ function File_list($$anchor, $$props) {
|
|
|
44439
44481
|
var node_5 = child(span_7);
|
|
44440
44482
|
|
|
44441
44483
|
{
|
|
44442
|
-
let $0 =
|
|
44443
|
-
get(file),
|
|
44444
|
-
get(searchWord),
|
|
44445
|
-
untrack(() => get(file).name.split(get(searchWord)))
|
|
44446
|
-
));
|
|
44484
|
+
let $0 = user_derived(() => get(file).name.split(get(searchWord)));
|
|
44447
44485
|
|
|
44448
44486
|
marked(node_5, () => get($0));
|
|
44449
44487
|
}
|
|
@@ -44460,17 +44498,8 @@ function File_list($$anchor, $$props) {
|
|
|
44460
44498
|
set_text(text_5, $1);
|
|
44461
44499
|
},
|
|
44462
44500
|
[
|
|
44463
|
-
() => (
|
|
44464
|
-
|
|
44465
|
-
get(file),
|
|
44466
|
-
untrack(() => formatDate(get(file).timestamp / 1000, 'YYYY-MM-DD HH:mm'))
|
|
44467
|
-
),
|
|
44468
|
-
|
|
44469
|
-
() => (
|
|
44470
|
-
deep_read_state(formatByteSize),
|
|
44471
|
-
get(file),
|
|
44472
|
-
untrack(() => formatByteSize(get(file).size))
|
|
44473
|
-
)
|
|
44501
|
+
() => formatDate(get(file).timestamp / 1000, 'YYYY-MM-DD HH:mm'),
|
|
44502
|
+
() => formatByteSize(get(file).size)
|
|
44474
44503
|
]
|
|
44475
44504
|
);
|
|
44476
44505
|
|
|
@@ -44488,27 +44517,18 @@ function File_list($$anchor, $$props) {
|
|
|
44488
44517
|
var consequent_2 = ($$anchor) => {
|
|
44489
44518
|
var button_3 = root_7$1();
|
|
44490
44519
|
|
|
44491
|
-
|
|
44520
|
+
delegated('click', button_3, () => deleteFile('image', get(file).url));
|
|
44492
44521
|
append($$anchor, button_3);
|
|
44493
44522
|
};
|
|
44494
44523
|
|
|
44495
|
-
var d_1 = user_derived(() => (
|
|
44496
|
-
get(file),
|
|
44497
|
-
untrack(() => !get(file).url.startsWith('blob:') && deleteFile)
|
|
44498
|
-
));
|
|
44524
|
+
var d_1 = user_derived(() => !get(file).url.startsWith('blob:') && deleteFile);
|
|
44499
44525
|
|
|
44500
44526
|
if_block(node_6, ($$render) => {
|
|
44501
44527
|
if (get(d_1)) $$render(consequent_2);
|
|
44502
44528
|
});
|
|
44503
44529
|
}
|
|
44504
|
-
|
|
44505
|
-
|
|
44506
|
-
get(file),
|
|
44507
|
-
get(selectedPath),
|
|
44508
|
-
untrack(() => get(file).url === get(selectedPath))
|
|
44509
|
-
)));
|
|
44510
|
-
|
|
44511
|
-
event('click', button_2, () => selectFile(get(file).url, get(file).size));
|
|
44530
|
+
template_effect(() => set_attribute(button_2, 'aria-pressed', get(file).url === get(selectedPath)));
|
|
44531
|
+
delegated('click', button_2, () => selectFile(get(file).url, get(file).size));
|
|
44512
44532
|
append($$anchor, li);
|
|
44513
44533
|
});
|
|
44514
44534
|
|
|
@@ -44521,36 +44541,36 @@ function File_list($$anchor, $$props) {
|
|
|
44521
44541
|
set_value(input_1, get(searchWord));
|
|
44522
44542
|
});
|
|
44523
44543
|
|
|
44524
|
-
|
|
44525
|
-
|
|
44526
|
-
|
|
44527
|
-
|
|
44544
|
+
delegated('click', button, () => paginate(get(currentPage) - 1));
|
|
44545
|
+
delegated('change', input, (e) => paginate(e.currentTarget.valueAsNumber - 1));
|
|
44546
|
+
delegated('click', button_1, () => paginate(get(currentPage) + 1));
|
|
44547
|
+
delegated('input', input_1, (e) => search(e.currentTarget.value));
|
|
44528
44548
|
append($$anchor, fragment_2);
|
|
44529
44549
|
pop();
|
|
44530
44550
|
}
|
|
44531
44551
|
|
|
44532
|
-
|
|
44552
|
+
delegate(['click', 'change', 'input']);
|
|
44553
|
+
|
|
44554
|
+
var root$4 = from_html(`<div><input type="file" class="svelte-uefuli"/> <button type="button">ファイルを追加アップロードする</button></div>`);
|
|
44533
44555
|
|
|
44534
44556
|
function File_uploader($$anchor, $$props) {
|
|
44535
|
-
push($$props,
|
|
44557
|
+
push($$props, true);
|
|
44536
44558
|
|
|
44537
|
-
|
|
44538
|
-
let
|
|
44539
|
-
const accept = fileType() === 'image' ? 'image/*' : '*';
|
|
44540
|
-
let inputFile = mutable_source();
|
|
44559
|
+
const accept = $$props.fileType === 'image' ? 'image/*' : '*';
|
|
44560
|
+
let inputFile;
|
|
44541
44561
|
|
|
44542
44562
|
/**
|
|
44543
44563
|
*
|
|
44544
44564
|
*/
|
|
44545
44565
|
function openFile() {
|
|
44546
|
-
|
|
44566
|
+
inputFile.click();
|
|
44547
44567
|
}
|
|
44548
44568
|
|
|
44549
44569
|
/**
|
|
44550
44570
|
*
|
|
44551
44571
|
*/
|
|
44552
44572
|
async function stageFile() {
|
|
44553
|
-
const file =
|
|
44573
|
+
const file = inputFile.files?.[0];
|
|
44554
44574
|
|
|
44555
44575
|
if (!file) {
|
|
44556
44576
|
return;
|
|
@@ -44558,40 +44578,54 @@ function File_uploader($$anchor, $$props) {
|
|
|
44558
44578
|
|
|
44559
44579
|
const path = URL.createObjectURL(file);
|
|
44560
44580
|
|
|
44561
|
-
engine
|
|
44581
|
+
$$props.engine.componentObserver.notify('file-select', { path, fileSize: file.size, isEmpty: false });
|
|
44562
44582
|
|
|
44563
|
-
const res = await engine
|
|
44564
|
-
engine
|
|
44583
|
+
const res = await $$props.engine.serverAPI.postFile?.($$props.fileType, file, (uploaded, total) => {
|
|
44584
|
+
$$props.engine.componentObserver.notify('file-upload-progress', { blob: path, uploaded, total });
|
|
44565
44585
|
});
|
|
44566
44586
|
|
|
44567
44587
|
if (!res) {
|
|
44568
44588
|
throw new Error(`Failed to upload file: ${file.name}`);
|
|
44569
44589
|
}
|
|
44570
44590
|
|
|
44571
|
-
engine
|
|
44591
|
+
$$props.engine.componentObserver.notify('file-listup', { fileType: $$props.fileType, data: [res.uploaded] });
|
|
44572
44592
|
|
|
44573
|
-
engine
|
|
44593
|
+
$$props.engine.componentObserver.notify('file-select', {
|
|
44574
44594
|
path: res.uploaded.url,
|
|
44575
44595
|
fileSize: res.uploaded.size,
|
|
44576
44596
|
isEmpty: false
|
|
44577
44597
|
});
|
|
44578
44598
|
}
|
|
44579
44599
|
|
|
44580
|
-
|
|
44581
|
-
|
|
44582
|
-
var div = root$3();
|
|
44600
|
+
var div = root$4();
|
|
44583
44601
|
var input = child(div);
|
|
44584
44602
|
|
|
44585
|
-
bind_this(input, ($$value) =>
|
|
44603
|
+
bind_this(input, ($$value) => inputFile = $$value, () => inputFile);
|
|
44586
44604
|
|
|
44587
44605
|
var button = sibling(input, 2);
|
|
44588
44606
|
template_effect(() => set_attribute(input, 'accept', accept));
|
|
44589
|
-
|
|
44590
|
-
|
|
44607
|
+
delegated('change', input, stageFile);
|
|
44608
|
+
delegated('click', button, openFile);
|
|
44591
44609
|
append($$anchor, div);
|
|
44592
44610
|
pop();
|
|
44593
44611
|
}
|
|
44594
44612
|
|
|
44613
|
+
delegate(['change', 'click']);
|
|
44614
|
+
|
|
44615
|
+
var root$3 = from_html(`<button class="insert_after" type="button">下に要素を追加</button>`);
|
|
44616
|
+
|
|
44617
|
+
function Initial_insertion_button($$anchor, $$props) {
|
|
44618
|
+
var button = root$3();
|
|
44619
|
+
|
|
44620
|
+
delegated('click', button, function (...$$args) {
|
|
44621
|
+
$$props.onInsert?.apply(this, $$args);
|
|
44622
|
+
});
|
|
44623
|
+
|
|
44624
|
+
append($$anchor, button);
|
|
44625
|
+
}
|
|
44626
|
+
|
|
44627
|
+
delegate(['click']);
|
|
44628
|
+
|
|
44595
44629
|
var root_1$2 = from_html(`<img alt="画像プレビュー" class="svelte-1sdkkhr"/>`);
|
|
44596
44630
|
var root_2 = from_html(`<video controls="" playsinline="" class="svelte-1sdkkhr"><source/> <track kind="captions" src=""/></video>`, 2);
|
|
44597
44631
|
var root_3 = from_html(`<audio controls="" class="svelte-1sdkkhr"><source/> <track kind="metadata" src=""/></audio>`);
|
|
@@ -44604,36 +44638,31 @@ var root_9 = from_html(`<li class="dimension svelte-1sdkkhr"> </li>`);
|
|
|
44604
44638
|
var root$2 = from_html(`<div><div><!> <!></div> <ul class="svelte-1sdkkhr"><!> <!></ul></div>`);
|
|
44605
44639
|
|
|
44606
44640
|
function Preview($$anchor, $$props) {
|
|
44607
|
-
push($$props,
|
|
44641
|
+
push($$props, true);
|
|
44608
44642
|
|
|
44609
|
-
|
|
44610
|
-
let
|
|
44611
|
-
let
|
|
44612
|
-
let
|
|
44613
|
-
let
|
|
44614
|
-
let
|
|
44615
|
-
|
|
44616
|
-
|
|
44617
|
-
|
|
44618
|
-
|
|
44619
|
-
set(
|
|
44620
|
-
set(file, getExt(path));
|
|
44643
|
+
let selectedPath = state('');
|
|
44644
|
+
let width = state(proxy(Number.NaN));
|
|
44645
|
+
let height = state(proxy(Number.NaN));
|
|
44646
|
+
let file = state(null);
|
|
44647
|
+
let uploaded = state(0);
|
|
44648
|
+
let total = state(100);
|
|
44649
|
+
const isUploadingMode = user_derived(() => get(selectedPath).startsWith('blob:'));
|
|
44650
|
+
|
|
44651
|
+
$$props.engine.componentObserver.on('file-select', ({ path }) => {
|
|
44652
|
+
set(selectedPath, path, true);
|
|
44653
|
+
set(file, getExt(path), true);
|
|
44621
44654
|
});
|
|
44622
44655
|
|
|
44623
|
-
engine
|
|
44656
|
+
$$props.engine.componentObserver.on('file-upload-progress', (progress) => {
|
|
44624
44657
|
if (progress.blob === get(selectedPath)) {
|
|
44625
|
-
set(uploaded, progress.uploaded);
|
|
44626
|
-
set(total, progress.total);
|
|
44658
|
+
set(uploaded, progress.uploaded, true);
|
|
44659
|
+
set(total, progress.total, true);
|
|
44627
44660
|
}
|
|
44628
44661
|
});
|
|
44629
44662
|
|
|
44630
|
-
|
|
44631
|
-
set(
|
|
44632
|
-
|
|
44633
|
-
|
|
44634
|
-
legacy_pre_effect(() => (get(file), get(selectedPath)), () => {
|
|
44635
|
-
set(width, Number.NaN);
|
|
44636
|
-
set(height, Number.NaN);
|
|
44663
|
+
user_effect(() => {
|
|
44664
|
+
set(width, Number.NaN, true);
|
|
44665
|
+
set(height, Number.NaN, true);
|
|
44637
44666
|
|
|
44638
44667
|
if (get(file)?.isImage) {
|
|
44639
44668
|
const image = new Image();
|
|
@@ -44643,8 +44672,8 @@ function Preview($$anchor, $$props) {
|
|
|
44643
44672
|
image.addEventListener(
|
|
44644
44673
|
'load',
|
|
44645
44674
|
() => {
|
|
44646
|
-
set(width, image.naturalWidth);
|
|
44647
|
-
set(height, image.naturalHeight);
|
|
44675
|
+
set(width, image.naturalWidth, true);
|
|
44676
|
+
set(height, image.naturalHeight, true);
|
|
44648
44677
|
},
|
|
44649
44678
|
{ once: true }
|
|
44650
44679
|
);
|
|
@@ -44656,17 +44685,14 @@ function Preview($$anchor, $$props) {
|
|
|
44656
44685
|
video.addEventListener(
|
|
44657
44686
|
'loadedmetadata',
|
|
44658
44687
|
() => {
|
|
44659
|
-
set(width, video.videoWidth);
|
|
44660
|
-
set(height, video.videoHeight);
|
|
44688
|
+
set(width, video.videoWidth, true);
|
|
44689
|
+
set(height, video.videoHeight, true);
|
|
44661
44690
|
},
|
|
44662
44691
|
{ once: true }
|
|
44663
44692
|
);
|
|
44664
44693
|
}
|
|
44665
44694
|
});
|
|
44666
44695
|
|
|
44667
|
-
legacy_pre_effect_reset();
|
|
44668
|
-
init();
|
|
44669
|
-
|
|
44670
44696
|
var div = root$2();
|
|
44671
44697
|
var div_1 = child(div);
|
|
44672
44698
|
let classes;
|
|
@@ -44686,7 +44712,7 @@ function Preview($$anchor, $$props) {
|
|
|
44686
44712
|
|
|
44687
44713
|
template_effect(() => {
|
|
44688
44714
|
set_attribute(source, 'src', get(selectedPath));
|
|
44689
|
-
set_attribute(source, 'type',
|
|
44715
|
+
set_attribute(source, 'type', `video/${get(file).ext}`);
|
|
44690
44716
|
});
|
|
44691
44717
|
|
|
44692
44718
|
append($$anchor, video_1);
|
|
@@ -44698,7 +44724,7 @@ function Preview($$anchor, $$props) {
|
|
|
44698
44724
|
|
|
44699
44725
|
template_effect(() => {
|
|
44700
44726
|
set_attribute(source_1, 'src', get(selectedPath));
|
|
44701
|
-
set_attribute(source_1, 'type',
|
|
44727
|
+
set_attribute(source_1, 'type', `audio/${get(file).ext}`);
|
|
44702
44728
|
});
|
|
44703
44729
|
|
|
44704
44730
|
append($$anchor, audio);
|
|
@@ -44709,13 +44735,8 @@ function Preview($$anchor, $$props) {
|
|
|
44709
44735
|
|
|
44710
44736
|
template_effect(() => {
|
|
44711
44737
|
set_attribute(object, 'data', get(selectedPath));
|
|
44712
|
-
|
|
44713
|
-
set_attribute(object, '
|
|
44714
|
-
get(file),
|
|
44715
|
-
untrack(() => `application/${get(file).ext}`)
|
|
44716
|
-
));
|
|
44717
|
-
|
|
44718
|
-
set_attribute(object, 'title', (get(file), untrack(() => `${get(file).ext}ファイルのプレビュー`)));
|
|
44738
|
+
set_attribute(object, 'type', `application/${get(file).ext}`);
|
|
44739
|
+
set_attribute(object, 'title', `${get(file).ext}ファイルのプレビュー`);
|
|
44719
44740
|
});
|
|
44720
44741
|
|
|
44721
44742
|
append($$anchor, object);
|
|
@@ -44728,10 +44749,7 @@ function Preview($$anchor, $$props) {
|
|
|
44728
44749
|
};
|
|
44729
44750
|
|
|
44730
44751
|
if_block(node, ($$render) => {
|
|
44731
|
-
if (
|
|
44732
|
-
get(file),
|
|
44733
|
-
untrack(() => get(file)?.isDoc || get(file)?.isPpt || get(file)?.isXls || get(file)?.isPdf)
|
|
44734
|
-
)) $$render(consequent_3, 3); else $$render(alternate, false);
|
|
44752
|
+
if (get(file)?.isImage) $$render(consequent); else if (get(file)?.isVideo) $$render(consequent_1, 1); else if (get(file)?.isAudio) $$render(consequent_2, 2); else if (get(file)?.isDoc || get(file)?.isPpt || get(file)?.isXls || get(file)?.isPdf) $$render(consequent_3, 3); else $$render(alternate, false);
|
|
44735
44753
|
});
|
|
44736
44754
|
}
|
|
44737
44755
|
|
|
@@ -44759,15 +44777,7 @@ function Preview($$anchor, $$props) {
|
|
|
44759
44777
|
var li = root_7();
|
|
44760
44778
|
var span = sibling(child(li), 2);
|
|
44761
44779
|
var text = child(span);
|
|
44762
|
-
|
|
44763
|
-
template_effect(($0) => set_text(text, `${$0 ?? ''}% (${get(uploaded) ?? ''}/${get(total) ?? ''})`), [
|
|
44764
|
-
() => (
|
|
44765
|
-
get(uploaded),
|
|
44766
|
-
get(total),
|
|
44767
|
-
untrack(() => Math.round(get(uploaded) / get(total) * 100))
|
|
44768
|
-
)
|
|
44769
|
-
]);
|
|
44770
|
-
|
|
44780
|
+
template_effect(($0) => set_text(text, `${$0 ?? ''}% (${get(uploaded) ?? ''}/${get(total) ?? ''})`), [() => Math.round(get(uploaded) / get(total) * 100)]);
|
|
44771
44781
|
append($$anchor, li);
|
|
44772
44782
|
};
|
|
44773
44783
|
|
|
@@ -44799,11 +44809,7 @@ function Preview($$anchor, $$props) {
|
|
|
44799
44809
|
append($$anchor, li_2);
|
|
44800
44810
|
};
|
|
44801
44811
|
|
|
44802
|
-
var d = user_derived(() => (
|
|
44803
|
-
get(width),
|
|
44804
|
-
get(height),
|
|
44805
|
-
untrack(() => !Number.isNaN(get(width)) && !Number.isNaN(get(height)))
|
|
44806
|
-
));
|
|
44812
|
+
var d = user_derived(() => !Number.isNaN(get(width)) && !Number.isNaN(get(height)));
|
|
44807
44813
|
|
|
44808
44814
|
if_block(node_3, ($$render) => {
|
|
44809
44815
|
if (get(d)) $$render(consequent_6);
|
|
@@ -44855,15 +44861,14 @@ var root_1$1 = from_html(`<div class="row svelte-sj6f65"><div class="th"><textar
|
|
|
44855
44861
|
var root$1 = from_html(`<div class="table svelte-sj6f65"></div>`);
|
|
44856
44862
|
|
|
44857
44863
|
function Table_editor($$anchor, $$props) {
|
|
44858
|
-
push($$props,
|
|
44864
|
+
push($$props, true);
|
|
44859
44865
|
|
|
44860
|
-
let
|
|
44861
|
-
let table = mutable_source([]);
|
|
44866
|
+
let table = state(proxy([]));
|
|
44862
44867
|
|
|
44863
|
-
engine
|
|
44868
|
+
$$props.engine.componentObserver.on('open-editor', ({ data }) => {
|
|
44864
44869
|
const { th, td } = data;
|
|
44865
44870
|
|
|
44866
|
-
set(table, th.map((th, i) => [th, td[i] ?? '']));
|
|
44871
|
+
set(table, th.map((th, i) => [th, td[i] ?? '']), true);
|
|
44867
44872
|
updateDataEl();
|
|
44868
44873
|
});
|
|
44869
44874
|
|
|
@@ -44872,7 +44877,7 @@ function Table_editor($$anchor, $$props) {
|
|
|
44872
44877
|
* @param index
|
|
44873
44878
|
*/
|
|
44874
44879
|
function add(index) {
|
|
44875
|
-
set(table, get(table).toSpliced(index + 1, 0, ['', '']));
|
|
44880
|
+
set(table, get(table).toSpliced(index + 1, 0, ['', '']), true);
|
|
44876
44881
|
updateDataEl();
|
|
44877
44882
|
}
|
|
44878
44883
|
|
|
@@ -44881,7 +44886,7 @@ function Table_editor($$anchor, $$props) {
|
|
|
44881
44886
|
* @param index
|
|
44882
44887
|
*/
|
|
44883
44888
|
function remove(index) {
|
|
44884
|
-
set(table, get(table).toSpliced(index, 1));
|
|
44889
|
+
set(table, get(table).toSpliced(index, 1), true);
|
|
44885
44890
|
updateDataEl();
|
|
44886
44891
|
}
|
|
44887
44892
|
|
|
@@ -44891,11 +44896,11 @@ function Table_editor($$anchor, $$props) {
|
|
|
44891
44896
|
* @param to
|
|
44892
44897
|
*/
|
|
44893
44898
|
function move(from, to) {
|
|
44894
|
-
const
|
|
44895
|
-
const
|
|
44899
|
+
const fromRow = get(table)[from];
|
|
44900
|
+
const toRow = get(table)[to];
|
|
44896
44901
|
|
|
44897
|
-
set(table, get(table).toSpliced(from, 1,
|
|
44898
|
-
set(table, get(table).toSpliced(to, 1,
|
|
44902
|
+
set(table, get(table).toSpliced(from, 1, toRow), true);
|
|
44903
|
+
set(table, get(table).toSpliced(to, 1, fromRow), true);
|
|
44899
44904
|
updateDataEl();
|
|
44900
44905
|
}
|
|
44901
44906
|
|
|
@@ -44905,7 +44910,7 @@ function Table_editor($$anchor, $$props) {
|
|
|
44905
44910
|
* based on the provided logic or parameters.
|
|
44906
44911
|
*/
|
|
44907
44912
|
function updateDataEl() {
|
|
44908
|
-
const dataEl = engine
|
|
44913
|
+
const dataEl = $$props.engine.itemEditorDialog.find('[name=bge]');
|
|
44909
44914
|
|
|
44910
44915
|
if (!dataEl) {
|
|
44911
44916
|
throw new Error('dataEl not found');
|
|
@@ -44919,11 +44924,9 @@ function Table_editor($$anchor, $$props) {
|
|
|
44919
44924
|
dataEl.value = JSON.stringify(data);
|
|
44920
44925
|
}
|
|
44921
44926
|
|
|
44922
|
-
init();
|
|
44923
|
-
|
|
44924
44927
|
var div = root$1();
|
|
44925
44928
|
|
|
44926
|
-
each(div,
|
|
44929
|
+
each(div, 21, () => get(table), index, ($$anchor, row, i) => {
|
|
44927
44930
|
var div_1 = root_1$1();
|
|
44928
44931
|
var div_2 = child(div_1);
|
|
44929
44932
|
var textarea = child(div_2);
|
|
@@ -44956,28 +44959,14 @@ function Table_editor($$anchor, $$props) {
|
|
|
44956
44959
|
Arrows_transfer_down(node_2, { class: 'icon' });
|
|
44957
44960
|
|
|
44958
44961
|
template_effect(() => {
|
|
44959
|
-
button_1.disabled =
|
|
44960
|
-
|
|
44961
|
-
button_2.disabled = (
|
|
44962
|
-
get(table),
|
|
44963
|
-
untrack(() => i === get(table).length - 1)
|
|
44964
|
-
);
|
|
44962
|
+
button_1.disabled = get(table).length === 1;
|
|
44963
|
+
button_2.disabled = i === get(table).length - 1;
|
|
44965
44964
|
});
|
|
44966
44965
|
|
|
44967
44966
|
delegated('input', textarea, updateDataEl);
|
|
44968
|
-
|
|
44969
|
-
bind_value(textarea, () => get(row)[0], ($$value) => (
|
|
44970
|
-
get(row)[0] = $$value,
|
|
44971
|
-
invalidate_inner_signals(() => (get(table)))
|
|
44972
|
-
));
|
|
44973
|
-
|
|
44967
|
+
bind_value(textarea, () => get(row)[0], ($$value) => (get(row)[0] = $$value));
|
|
44974
44968
|
delegated('input', textarea_1, updateDataEl);
|
|
44975
|
-
|
|
44976
|
-
bind_value(textarea_1, () => get(row)[1], ($$value) => (
|
|
44977
|
-
get(row)[1] = $$value,
|
|
44978
|
-
invalidate_inner_signals(() => (get(table)))
|
|
44979
|
-
));
|
|
44980
|
-
|
|
44969
|
+
bind_value(textarea_1, () => get(row)[1], ($$value) => (get(row)[1] = $$value));
|
|
44981
44970
|
delegated('click', button, () => add(i));
|
|
44982
44971
|
delegated('click', button_1, () => remove(i));
|
|
44983
44972
|
delegated('click', button_2, () => move(i, i + 1));
|
|
@@ -44993,18 +44982,16 @@ var root_1 = from_html(`<button type="button" role="tab" class="svelte-ruvo7f">
|
|
|
44993
44982
|
var root = from_html(`<div role="tablist" class="svelte-ruvo7f"></div>`);
|
|
44994
44983
|
|
|
44995
44984
|
function Tabs($$anchor, $$props) {
|
|
44996
|
-
push($$props,
|
|
44985
|
+
push($$props, true);
|
|
44997
44986
|
|
|
44998
|
-
|
|
44999
|
-
let contentId = prop($$props, 'contentId', 8);
|
|
45000
|
-
const refs = mutable_source([]);
|
|
44987
|
+
const refs = [];
|
|
45001
44988
|
let tabPanel = null;
|
|
45002
44989
|
const length = 2;
|
|
45003
|
-
let currentIndex =
|
|
44990
|
+
let currentIndex = state(0);
|
|
45004
44991
|
|
|
45005
|
-
engine
|
|
45006
|
-
set(currentIndex, index);
|
|
45007
|
-
|
|
44992
|
+
$$props.engine.componentObserver.on('select-tab-in-item-editor', ({ index }) => {
|
|
44993
|
+
set(currentIndex, index, true);
|
|
44994
|
+
refs[get(currentIndex)]?.focus();
|
|
45008
44995
|
});
|
|
45009
44996
|
|
|
45010
44997
|
const onKeyDown = (event) => {
|
|
@@ -45034,42 +45021,38 @@ function Tabs($$anchor, $$props) {
|
|
|
45034
45021
|
* @param index
|
|
45035
45022
|
*/
|
|
45036
45023
|
function update(index) {
|
|
45037
|
-
set(currentIndex, index);
|
|
45038
|
-
|
|
45039
|
-
engine
|
|
45024
|
+
set(currentIndex, index, true);
|
|
45025
|
+
refs[get(currentIndex)]?.focus();
|
|
45026
|
+
$$props.engine.componentObserver.notify('select-tab-in-item-editor', { index: get(currentIndex) });
|
|
45040
45027
|
tabPanel?.setAttribute('aria-label', createLabel(get(currentIndex)));
|
|
45041
45028
|
}
|
|
45042
45029
|
|
|
45043
|
-
|
|
45044
|
-
tabPanel = document.getElementById(contentId
|
|
45030
|
+
user_effect(() => {
|
|
45031
|
+
tabPanel = document.getElementById($$props.contentId);
|
|
45045
45032
|
|
|
45046
45033
|
if (!tabPanel) {
|
|
45047
45034
|
throw new Error('Tab panel not found');
|
|
45048
45035
|
}
|
|
45049
45036
|
});
|
|
45050
45037
|
|
|
45051
|
-
init();
|
|
45052
|
-
|
|
45053
45038
|
var div = root();
|
|
45054
45039
|
|
|
45055
|
-
each(div,
|
|
45040
|
+
each(div, 20, () => Array.from({ length }, (_, index) => index), (index) => index, ($$anchor, index) => {
|
|
45056
45041
|
var button = root_1();
|
|
45057
45042
|
var text = child(button);
|
|
45058
|
-
bind_this(button, ($$value, index) =>
|
|
45043
|
+
bind_this(button, ($$value, index) => refs[index] = $$value, (index) => refs?.[index], () => [index]);
|
|
45059
45044
|
|
|
45060
45045
|
template_effect(
|
|
45061
45046
|
($0) => {
|
|
45062
|
-
set_attribute(button, 'aria-controls', contentId
|
|
45063
|
-
set_attribute(button, 'aria-selected', get(currentIndex) ===
|
|
45064
|
-
set_attribute(button, 'tabindex', get(currentIndex) ===
|
|
45047
|
+
set_attribute(button, 'aria-controls', $$props.contentId);
|
|
45048
|
+
set_attribute(button, 'aria-selected', get(currentIndex) === index);
|
|
45049
|
+
set_attribute(button, 'tabindex', get(currentIndex) === index ? 0 : -1);
|
|
45065
45050
|
set_text(text, $0);
|
|
45066
45051
|
},
|
|
45067
|
-
[
|
|
45068
|
-
() => (get(index), untrack(() => createLabel(get(index))))
|
|
45069
|
-
]
|
|
45052
|
+
[() => createLabel(index)]
|
|
45070
45053
|
);
|
|
45071
45054
|
|
|
45072
|
-
delegated('click', button, () => onClick(
|
|
45055
|
+
delegated('click', button, () => onClick(index));
|
|
45073
45056
|
delegated('keydown', button, onKeyDown);
|
|
45074
45057
|
append($$anchor, button);
|
|
45075
45058
|
});
|
|
@@ -45116,7 +45099,7 @@ function parseConfig(config) {
|
|
|
45116
45099
|
}
|
|
45117
45100
|
}
|
|
45118
45101
|
|
|
45119
|
-
const version = "4.0.0-alpha.
|
|
45102
|
+
const version = "4.0.0-alpha.61";
|
|
45120
45103
|
function attachDraftSwitcher(engine) {
|
|
45121
45104
|
if (engine.hasDraft()) {
|
|
45122
45105
|
const container = document.createElement("div");
|
|
@@ -45134,13 +45117,27 @@ function attachDraftSwitcher(engine) {
|
|
|
45134
45117
|
async function createBurgerEditorClient(options) {
|
|
45135
45118
|
const engine = await BurgerEditorEngine.new({
|
|
45136
45119
|
...options,
|
|
45137
|
-
|
|
45138
|
-
return svelteMount(
|
|
45139
|
-
target:
|
|
45120
|
+
initialInsertionButton: (container, onInsert) => {
|
|
45121
|
+
return svelteMount(Initial_insertion_button, {
|
|
45122
|
+
target: container,
|
|
45123
|
+
props: {
|
|
45124
|
+
onInsert
|
|
45125
|
+
}
|
|
45126
|
+
});
|
|
45127
|
+
},
|
|
45128
|
+
blockMenu: (container, engine2) => {
|
|
45129
|
+
const { cleanUp } = svelteMount(Block_menu, {
|
|
45130
|
+
target: container,
|
|
45140
45131
|
props: {
|
|
45141
|
-
engine: engine2
|
|
45132
|
+
engine: engine2,
|
|
45133
|
+
container,
|
|
45134
|
+
onHide: () => engine2.clearCurrentBlock()
|
|
45142
45135
|
}
|
|
45143
45136
|
});
|
|
45137
|
+
return {
|
|
45138
|
+
hide: () => engine2.clearCurrentBlock(),
|
|
45139
|
+
cleanUp
|
|
45140
|
+
};
|
|
45144
45141
|
},
|
|
45145
45142
|
ui: {
|
|
45146
45143
|
blockCatalog: (el, engine2) => {
|