@fictjs/ssr 0.26.0 → 0.28.0

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.
@@ -1,15 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/stream-runtime.ts
3
- /**
4
- * Create the browser-side streaming patch runtime as classic-script JavaScript.
5
- *
6
- * The generated package asset `@fictjs/ssr/fict-stream-runtime.js` is built from
7
- * this helper with `observerMode: true`.
8
- */
9
- function createStreamRuntimeCode(options = {}) {
10
- return "(function(){if(window.__FICT_STREAM)return;var cache=new Map();function find(id){var hit=cache.get(id);if(hit)return hit;var start=null,end=null;var w=document.createTreeWalker(document,NodeFilter.SHOW_COMMENT);while(w.nextNode()){var n=w.currentNode;var d=n.data;if(d===\"fict:suspense-start:\"+id)start=n;else if(d===\"fict:suspense-end:\"+id)end=n;if(start&&end)break;}if(start&&end){hit={start:start,end:end};cache.set(id,hit);}return hit;}function apply(id){var tpl=document.querySelector('template[data-fict-suspense=\"' + id + '\"]');if(!tpl)return;var b=find(id);if(!b)return;var node=b.start.nextSibling;while(node&&node!==b.end){var next=node.nextSibling;node.parentNode&&node.parentNode.removeChild(node);node=next;}b.end.parentNode&&b.end.parentNode.insertBefore(tpl.content,b.end);tpl.parentNode&&tpl.parentNode.removeChild(tpl);}window.__FICT_STREAM={apply:apply};" + (options.observerMode ?? true ? "function scan(root){var list=(root&&root.querySelectorAll?root:document).querySelectorAll(\"template[data-fict-suspense]\");for(var i=0;i<list.length;i++){apply(list[i].getAttribute(\"data-fict-suspense\"));}}if(typeof MutationObserver===\"function\"){new MutationObserver(function(muts){for(var i=0;i<muts.length;i++){for(var j=0;j<muts[i].addedNodes.length;j++){var n=muts[i].addedNodes[j];if(n.nodeType===1){if(n.matches&&n.matches(\"template[data-fict-suspense]\"))apply(n.getAttribute(\"data-fict-suspense\"));scan(n);}}}}).observe(document.documentElement||document,{childList:true,subtree:true});}if(document.readyState===\"loading\"){document.addEventListener(\"DOMContentLoaded\",function(){scan(document);},{once:true});}else{scan(document);}" : "") + "})();";
11
- }
12
- const FICT_STREAM_RUNTIME_CODE = createStreamRuntimeCode({ observerMode: true });
13
- //#endregion
14
- exports.FICT_STREAM_RUNTIME_CODE = FICT_STREAM_RUNTIME_CODE;
15
- exports.createStreamRuntimeCode = createStreamRuntimeCode;
@@ -1,18 +0,0 @@
1
- //#region src/stream-runtime.d.ts
2
- interface StreamRuntimeCodeOptions {
3
- /**
4
- * Enable observer mode so patch templates are applied without per-chunk inline scripts.
5
- */
6
- observerMode?: boolean;
7
- }
8
- /**
9
- * Create the browser-side streaming patch runtime as classic-script JavaScript.
10
- *
11
- * The generated package asset `@fictjs/ssr/fict-stream-runtime.js` is built from
12
- * this helper with `observerMode: true`.
13
- */
14
- declare function createStreamRuntimeCode(options?: StreamRuntimeCodeOptions): string;
15
- declare const FICT_STREAM_RUNTIME_CODE: string;
16
- //#endregion
17
- export { FICT_STREAM_RUNTIME_CODE, StreamRuntimeCodeOptions, createStreamRuntimeCode };
18
- //# sourceMappingURL=stream-runtime.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-runtime.d.cts","names":[],"sources":["../src/stream-runtime.ts"],"mappings":";UAAiB,wBAAA;EAAA;;;EAIf,YAAY;AAAA;AASd;;;;AAA8E;AAqC9E;AArCA,iBAAgB,uBAAA,CAAwB,OAAsC,GAA7B,wBAA6B;AAAA,cAqCjE,wBAAA"}
@@ -1,18 +0,0 @@
1
- //#region src/stream-runtime.d.ts
2
- interface StreamRuntimeCodeOptions {
3
- /**
4
- * Enable observer mode so patch templates are applied without per-chunk inline scripts.
5
- */
6
- observerMode?: boolean;
7
- }
8
- /**
9
- * Create the browser-side streaming patch runtime as classic-script JavaScript.
10
- *
11
- * The generated package asset `@fictjs/ssr/fict-stream-runtime.js` is built from
12
- * this helper with `observerMode: true`.
13
- */
14
- declare function createStreamRuntimeCode(options?: StreamRuntimeCodeOptions): string;
15
- declare const FICT_STREAM_RUNTIME_CODE: string;
16
- //#endregion
17
- export { FICT_STREAM_RUNTIME_CODE, StreamRuntimeCodeOptions, createStreamRuntimeCode };
18
- //# sourceMappingURL=stream-runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-runtime.d.ts","names":[],"sources":["../src/stream-runtime.ts"],"mappings":";UAAiB,wBAAA;EAAA;;;EAIf,YAAY;AAAA;AASd;;;;AAA8E;AAqC9E;AArCA,iBAAgB,uBAAA,CAAwB,OAAsC,GAA7B,wBAA6B;AAAA,cAqCjE,wBAAA"}
@@ -1,15 +0,0 @@
1
- //#region src/stream-runtime.ts
2
- /**
3
- * Create the browser-side streaming patch runtime as classic-script JavaScript.
4
- *
5
- * The generated package asset `@fictjs/ssr/fict-stream-runtime.js` is built from
6
- * this helper with `observerMode: true`.
7
- */
8
- function createStreamRuntimeCode(options = {}) {
9
- return "(function(){if(window.__FICT_STREAM)return;var cache=new Map();function find(id){var hit=cache.get(id);if(hit)return hit;var start=null,end=null;var w=document.createTreeWalker(document,NodeFilter.SHOW_COMMENT);while(w.nextNode()){var n=w.currentNode;var d=n.data;if(d===\"fict:suspense-start:\"+id)start=n;else if(d===\"fict:suspense-end:\"+id)end=n;if(start&&end)break;}if(start&&end){hit={start:start,end:end};cache.set(id,hit);}return hit;}function apply(id){var tpl=document.querySelector('template[data-fict-suspense=\"' + id + '\"]');if(!tpl)return;var b=find(id);if(!b)return;var node=b.start.nextSibling;while(node&&node!==b.end){var next=node.nextSibling;node.parentNode&&node.parentNode.removeChild(node);node=next;}b.end.parentNode&&b.end.parentNode.insertBefore(tpl.content,b.end);tpl.parentNode&&tpl.parentNode.removeChild(tpl);}window.__FICT_STREAM={apply:apply};" + (options.observerMode ?? true ? "function scan(root){var list=(root&&root.querySelectorAll?root:document).querySelectorAll(\"template[data-fict-suspense]\");for(var i=0;i<list.length;i++){apply(list[i].getAttribute(\"data-fict-suspense\"));}}if(typeof MutationObserver===\"function\"){new MutationObserver(function(muts){for(var i=0;i<muts.length;i++){for(var j=0;j<muts[i].addedNodes.length;j++){var n=muts[i].addedNodes[j];if(n.nodeType===1){if(n.matches&&n.matches(\"template[data-fict-suspense]\"))apply(n.getAttribute(\"data-fict-suspense\"));scan(n);}}}}).observe(document.documentElement||document,{childList:true,subtree:true});}if(document.readyState===\"loading\"){document.addEventListener(\"DOMContentLoaded\",function(){scan(document);},{once:true});}else{scan(document);}" : "") + "})();";
10
- }
11
- const FICT_STREAM_RUNTIME_CODE = createStreamRuntimeCode({ observerMode: true });
12
- //#endregion
13
- export { FICT_STREAM_RUNTIME_CODE, createStreamRuntimeCode };
14
-
15
- //# sourceMappingURL=stream-runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-runtime.js","names":[],"sources":["../src/stream-runtime.ts"],"sourcesContent":["export interface StreamRuntimeCodeOptions {\n /**\n * Enable observer mode so patch templates are applied without per-chunk inline scripts.\n */\n observerMode?: boolean\n}\n\n/**\n * Create the browser-side streaming patch runtime as classic-script JavaScript.\n *\n * The generated package asset `@fictjs/ssr/fict-stream-runtime.js` is built from\n * this helper with `observerMode: true`.\n */\nexport function createStreamRuntimeCode(options: StreamRuntimeCodeOptions = {}): string {\n const observerMode = options.observerMode ?? true\n return (\n '(function(){' +\n 'if(window.__FICT_STREAM)return;' +\n 'var cache=new Map();' +\n 'function find(id){' +\n 'var hit=cache.get(id);if(hit)return hit;' +\n 'var start=null,end=null;' +\n 'var w=document.createTreeWalker(document,NodeFilter.SHOW_COMMENT);' +\n 'while(w.nextNode()){' +\n 'var n=w.currentNode;var d=n.data;' +\n 'if(d===\"fict:suspense-start:\"+id)start=n;' +\n 'else if(d===\"fict:suspense-end:\"+id)end=n;' +\n 'if(start&&end)break;' +\n '}' +\n 'if(start&&end){hit={start:start,end:end};cache.set(id,hit);}return hit;' +\n '}' +\n 'function apply(id){' +\n \"var tpl=document.querySelector('template[data-fict-suspense=\\\"' + id + '\\\"]');\" +\n 'if(!tpl)return;' +\n 'var b=find(id);if(!b)return;' +\n 'var node=b.start.nextSibling;' +\n 'while(node&&node!==b.end){var next=node.nextSibling;node.parentNode&&node.parentNode.removeChild(node);node=next;}' +\n 'b.end.parentNode&&b.end.parentNode.insertBefore(tpl.content,b.end);' +\n 'tpl.parentNode&&tpl.parentNode.removeChild(tpl);' +\n '}' +\n 'window.__FICT_STREAM={apply:apply};' +\n (observerMode\n ? 'function scan(root){var list=(root&&root.querySelectorAll?root:document).querySelectorAll(\"template[data-fict-suspense]\");for(var i=0;i<list.length;i++){apply(list[i].getAttribute(\"data-fict-suspense\"));}}' +\n 'if(typeof MutationObserver===\"function\"){new MutationObserver(function(muts){for(var i=0;i<muts.length;i++){for(var j=0;j<muts[i].addedNodes.length;j++){var n=muts[i].addedNodes[j];if(n.nodeType===1){if(n.matches&&n.matches(\"template[data-fict-suspense]\"))apply(n.getAttribute(\"data-fict-suspense\"));scan(n);}}}}).observe(document.documentElement||document,{childList:true,subtree:true});}' +\n 'if(document.readyState===\"loading\"){document.addEventListener(\"DOMContentLoaded\",function(){scan(document);},{once:true});}else{scan(document);}'\n : '') +\n '})();'\n )\n}\n\nexport const FICT_STREAM_RUNTIME_CODE = createStreamRuntimeCode({ observerMode: true })\n"],"mappings":";;;;;;;AAaA,SAAgB,wBAAwB,UAAoC,CAAC,GAAW;CAEtF,OACE,o3BAFmB,QAAQ,gBAAgB,OA4BvC,qvBAGA,MACJ;AAEJ;AAEA,MAAa,2BAA2B,wBAAwB,EAAE,cAAc,KAAK,CAAC"}