@absolutejs/absolute 0.19.0-beta.795 → 0.19.0-beta.797
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/dist/angular/index.js +4 -4
- package/dist/angular/server.js +4 -4
- package/dist/build.js +3 -3
- package/dist/{chunk-ygzd5s4z.js → chunk-1x82dcw0.js} +3 -3
- package/dist/{chunk-krwg77ek.js → chunk-2ds7qnyw.js} +4 -4
- package/dist/{chunk-3qswe70c.js → chunk-8xf58ka4.js} +2 -2
- package/dist/{chunk-8fyk6cpc.js → chunk-9eab59st.js} +7 -7
- package/dist/{chunk-8fyk6cpc.js.map → chunk-9eab59st.js.map} +1 -1
- package/dist/chunk-aaa985m2.js +194 -0
- package/dist/chunk-aaa985m2.js.map +11 -0
- package/dist/{chunk-8cyvzcmc.js → chunk-azqk45e4.js} +2 -2
- package/dist/{chunk-hza0n8qm.js → chunk-cs95jp8a.js} +4 -4
- package/dist/{chunk-97572s32.js → chunk-jmfv960b.js} +8 -63
- package/dist/{chunk-97572s32.js.map → chunk-jmfv960b.js.map} +3 -4
- package/dist/{chunk-qmgbpvyb.js → chunk-xt1p33fr.js} +2 -2
- package/dist/client/index.js +3 -3
- package/dist/index.js +6 -5
- package/dist/index.js.map +2 -2
- package/dist/islands/index.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/svelte/index.js +1 -1
- package/dist/vue/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-pnscgw95.js +0 -90
- package/dist/chunk-pnscgw95.js.map +0 -10
- /package/dist/{chunk-ygzd5s4z.js.map → chunk-1x82dcw0.js.map} +0 -0
- /package/dist/{chunk-krwg77ek.js.map → chunk-2ds7qnyw.js.map} +0 -0
- /package/dist/{chunk-3qswe70c.js.map → chunk-8xf58ka4.js.map} +0 -0
- /package/dist/{chunk-8cyvzcmc.js.map → chunk-azqk45e4.js.map} +0 -0
- /package/dist/{chunk-hza0n8qm.js.map → chunk-cs95jp8a.js.map} +0 -0
- /package/dist/{chunk-qmgbpvyb.js.map → chunk-xt1p33fr.js.map} +0 -0
package/dist/islands/index.js
CHANGED
package/dist/react/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import"../chunk-s6defjk2.js";
|
|
|
22
22
|
import"../chunk-p5504p14.js";
|
|
23
23
|
import {
|
|
24
24
|
renderIslandResult
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-azqk45e4.js";
|
|
26
26
|
import"../chunk-9ve9jq72.js";
|
|
27
27
|
import"../chunk-7fw6x3js.js";
|
|
28
28
|
import"../chunk-mbazhahf.js";
|
package/dist/src/index.d.ts
CHANGED
package/dist/svelte/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import"../chunk-s6defjk2.js";
|
|
|
25
25
|
import"../chunk-p5504p14.js";
|
|
26
26
|
import {
|
|
27
27
|
renderIslandMarkup
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-azqk45e4.js";
|
|
29
29
|
import"../chunk-9ve9jq72.js";
|
|
30
30
|
import"../chunk-7fw6x3js.js";
|
|
31
31
|
import"../chunk-mbazhahf.js";
|
package/dist/vue/index.js
CHANGED
|
@@ -33,7 +33,7 @@ import"../chunk-s6defjk2.js";
|
|
|
33
33
|
import"../chunk-p5504p14.js";
|
|
34
34
|
import {
|
|
35
35
|
renderIslandResult
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-azqk45e4.js";
|
|
37
37
|
import"../chunk-9ve9jq72.js";
|
|
38
38
|
import"../chunk-7fw6x3js.js";
|
|
39
39
|
import"../chunk-mbazhahf.js";
|
package/package.json
CHANGED
package/dist/chunk-pnscgw95.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/utils/registerClientScript.ts
|
|
3
|
-
var scriptRegistry = new Map;
|
|
4
|
-
var requestCounter = 0;
|
|
5
|
-
var getRequestId = () => `req_${Date.now()}_${++requestCounter}`;
|
|
6
|
-
var ssrContextGetter = null;
|
|
7
|
-
var getSsrContextId = () => ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value;
|
|
8
|
-
var registerClientScript = (script, requestId) => {
|
|
9
|
-
const id = requestId || getSsrContextId() || getRequestId();
|
|
10
|
-
if (!scriptRegistry.has(id)) {
|
|
11
|
-
scriptRegistry.set(id, new Set);
|
|
12
|
-
}
|
|
13
|
-
scriptRegistry.get(id)?.add(script);
|
|
14
|
-
return id;
|
|
15
|
-
};
|
|
16
|
-
var setSsrContextGetter = (getter) => {
|
|
17
|
-
ssrContextGetter = getter;
|
|
18
|
-
};
|
|
19
|
-
if (typeof globalThis !== "undefined") {
|
|
20
|
-
Object.assign(globalThis, { registerClientScript });
|
|
21
|
-
}
|
|
22
|
-
var clearAllClientScripts = () => {
|
|
23
|
-
scriptRegistry.clear();
|
|
24
|
-
};
|
|
25
|
-
var generateClientScriptCode = (scripts) => {
|
|
26
|
-
if (scripts.length === 0) {
|
|
27
|
-
return "";
|
|
28
|
-
}
|
|
29
|
-
const scriptCode = scripts.map((script, index) => {
|
|
30
|
-
const funcString = script.toString();
|
|
31
|
-
const bodyMatch = funcString.match(/\{([\s\S]*)\}/);
|
|
32
|
-
if (!bodyMatch || !bodyMatch[1]) {
|
|
33
|
-
return "";
|
|
34
|
-
}
|
|
35
|
-
const body = bodyMatch[1].trim();
|
|
36
|
-
return `
|
|
37
|
-
(function() {
|
|
38
|
-
var executed = false;
|
|
39
|
-
function executeScript_${index}() {
|
|
40
|
-
if (executed) return;
|
|
41
|
-
executed = true;
|
|
42
|
-
${body}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
|
46
|
-
executeScript_${index}();
|
|
47
|
-
} else {
|
|
48
|
-
document.addEventListener('DOMContentLoaded', executeScript_${index});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Watch for hydration-added elements
|
|
52
|
-
var observer = new MutationObserver(function() {
|
|
53
|
-
executeScript_${index}();
|
|
54
|
-
if (executed) observer.disconnect();
|
|
55
|
-
});
|
|
56
|
-
if (!executed) {
|
|
57
|
-
observer.observe(document.body || document.documentElement, { childList: true, subtree: true });
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Single fallback timeout
|
|
61
|
-
setTimeout(function() {
|
|
62
|
-
executeScript_${index}();
|
|
63
|
-
observer.disconnect();
|
|
64
|
-
}, 1000);
|
|
65
|
-
})();`;
|
|
66
|
-
}).join(`
|
|
67
|
-
`);
|
|
68
|
-
return `<script>
|
|
69
|
-
(function() {
|
|
70
|
-
${scriptCode}
|
|
71
|
-
})();
|
|
72
|
-
</script>`;
|
|
73
|
-
};
|
|
74
|
-
var getAndClearClientScripts = (requestId) => {
|
|
75
|
-
const id = requestId || ssrContextGetter?.();
|
|
76
|
-
if (!id)
|
|
77
|
-
return [];
|
|
78
|
-
const scripts = scriptRegistry.get(id);
|
|
79
|
-
if (!scripts) {
|
|
80
|
-
return [];
|
|
81
|
-
}
|
|
82
|
-
const scriptArray = Array.from(scripts);
|
|
83
|
-
scriptRegistry.delete(id);
|
|
84
|
-
return scriptArray;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export { getSsrContextId, registerClientScript, setSsrContextGetter, clearAllClientScripts, generateClientScriptCode, getAndClearClientScripts };
|
|
88
|
-
|
|
89
|
-
//# debugId=9DFF481135ABC22A64756E2164756E21
|
|
90
|
-
//# sourceMappingURL=chunk-pnscgw95.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/utils/registerClientScript.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"/**\n * Utility for registering client-side scripts that need to run after Angular SSR hydration.\n *\n * This is necessary because Angular's lifecycle hooks don't always run reliably on the client\n * after SSR hydration, especially for event listeners attached to DOM elements.\n *\n * Usage in Angular components:\n * ```typescript\n * import { registerClientScript } from '@absolutejs/absolute';\n *\n * // Register an event listener script\n * registerClientScript(() => {\n * const element = document.querySelector('.my-element');\n * if (element) {\n * element.addEventListener('click', () => {\n * console.log('Clicked!');\n * });\n * }\n * });\n * ```\n *\n * The script will be automatically injected into the HTML response and executed on the client.\n */\n\n// Request-scoped registry for client scripts\n// Each request gets its own set of scripts to inject\nconst scriptRegistry = new Map<string, Set<() => void>>();\n\n// Generate a unique request ID for tracking scripts per request\nlet requestCounter = 0;\nconst getRequestId = () => `req_${Date.now()}_${++requestCounter}`;\n\n// Allow SSR frameworks to inject a request context getter (e.g. AsyncLocalStorage)\nlet ssrContextGetter: (() => string | undefined) | null = null;\nexport const getSsrContextId = () =>\n\tssrContextGetter?.() ||\n\tObject.getOwnPropertyDescriptor(globalThis, '__absolutejs_requestId')\n\t\t?.value;\nexport const registerClientScript = (\n\tscript: () => void,\n\trequestId?: string\n) => {\n\t// Try to get requestId from explicit arg, then Async Context, then global fallback\n\tconst id = requestId || getSsrContextId() || getRequestId();\n\n\tif (!scriptRegistry.has(id)) {\n\t\tscriptRegistry.set(id, new Set());\n\t}\n\n\tscriptRegistry.get(id)?.add(script);\n\n\treturn id;\n};\nexport const setSsrContextGetter = (getter: () => string | undefined) => {\n\tssrContextGetter = getter;\n};\n\n// Make registerClientScript available globally during SSR for Angular components\n// Using type assertion for globalThis extension\nif (typeof globalThis !== 'undefined') {\n\tObject.assign(globalThis, { registerClientScript });\n}\n\n/**\n * Get all registered scripts for a request and clear them.\n * This is called by the page handler after rendering.\n *\n * @param requestId - The request ID to get scripts for\n * @returns Array of script functions, or empty array if none registered\n */\nexport const clearAllClientScripts = () => {\n\tscriptRegistry.clear();\n};\nexport const generateClientScriptCode = (scripts: (() => void)[]) => {\n\tif (scripts.length === 0) {\n\t\treturn '';\n\t}\n\n\t// Convert functions to strings and wrap in IIFE\n\tconst scriptCode = scripts\n\t\t.map((script, index) => {\n\t\t\t// Get the function body as a string\n\t\t\tconst funcString = script.toString();\n\n\t\t\t// Extract the body (everything between { and })\n\t\t\tconst bodyMatch = funcString.match(/\\{([\\s\\S]*)\\}/);\n\t\t\tif (!bodyMatch || !bodyMatch[1]) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst body = bodyMatch[1].trim();\n\n\t\t\t// Wrap in IIFE with MutationObserver for DOM readiness\n\t\t\treturn `\n\t(function() {\n\t\tvar executed = false;\n\t\tfunction executeScript_${index}() {\n\t\t\tif (executed) return;\n\t\t\texecuted = true;\n\t\t\t${body}\n\t\t}\n\n\t\tif (document.readyState === 'complete' || document.readyState === 'interactive') {\n\t\t\texecuteScript_${index}();\n\t\t} else {\n\t\t\tdocument.addEventListener('DOMContentLoaded', executeScript_${index});\n\t\t}\n\n\t\t// Watch for hydration-added elements\n\t\tvar observer = new MutationObserver(function() {\n\t\t\texecuteScript_${index}();\n\t\t\tif (executed) observer.disconnect();\n\t\t});\n\t\tif (!executed) {\n\t\t\tobserver.observe(document.body || document.documentElement, { childList: true, subtree: true });\n\t\t}\n\n\t\t// Single fallback timeout\n\t\tsetTimeout(function() {\n\t\t\texecuteScript_${index}();\n\t\t\tobserver.disconnect();\n\t\t}, 1000);\n\t})();`;\n\t\t})\n\t\t.join('\\n');\n\n\treturn `<script>\n(function() {\n${scriptCode}\n})();\n</script>`;\n};\nexport const getAndClearClientScripts = (requestId?: string) => {\n\tconst id = requestId || ssrContextGetter?.();\n\tif (!id) return [];\n\n\tconst scripts = scriptRegistry.get(id);\n\tif (!scripts) {\n\t\treturn [];\n\t}\n\n\tconst scriptArray = Array.from(scripts);\n\tscriptRegistry.delete(id);\n\n\treturn scriptArray;\n};\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;AA0BA,IAAM,iBAAiB,IAAI;AAG3B,IAAI,iBAAiB;AACrB,IAAM,eAAe,MAAM,OAAO,KAAK,IAAI,KAAK,EAAE;AAGlD,IAAI,mBAAsD;AACnD,IAAM,kBAAkB,MAC9B,mBAAmB,KACnB,OAAO,yBAAyB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aAAa,mBAAmB;AAAA,EAC3C,IAAI,CAAC;AAAA,IAAI,OAAO,CAAC;AAAA,EAEjB,MAAM,UAAU,eAAe,IAAI,EAAE;AAAA,EACrC,IAAI,CAAC,SAAS;AAAA,IACb,OAAO,CAAC;AAAA,EACT;AAAA,EAEA,MAAM,cAAc,MAAM,KAAK,OAAO;AAAA,EACtC,eAAe,OAAO,EAAE;AAAA,EAExB,OAAO;AAAA;",
|
|
8
|
-
"debugId": "9DFF481135ABC22A64756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|