@taggor/runtime 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/compat/before-compat.d.ts +5 -0
- package/dist/compat/before-compat.d.ts.map +1 -0
- package/dist/compat/before-compat.js +15 -0
- package/dist/compat/before-compat.js.map +1 -0
- package/dist/compat/index.d.ts +90 -0
- package/dist/compat/index.d.ts.map +1 -0
- package/dist/compat/index.js +67 -0
- package/dist/compat/index.js.map +1 -0
- package/dist/compat/scope.d.ts +81 -0
- package/dist/compat/scope.d.ts.map +1 -0
- package/dist/compat/scope.js +107 -0
- package/dist/compat/scope.js.map +1 -0
- package/dist/element/attributes.d.ts +103 -0
- package/dist/element/attributes.d.ts.map +1 -0
- package/dist/element/attributes.js +153 -0
- package/dist/element/attributes.js.map +1 -0
- package/dist/element/component-controller.d.ts +98 -0
- package/dist/element/component-controller.d.ts.map +1 -0
- package/dist/element/component-controller.js +472 -0
- package/dist/element/component-controller.js.map +1 -0
- package/dist/element/contract-gate.d.ts +29 -0
- package/dist/element/contract-gate.d.ts.map +1 -0
- package/dist/element/contract-gate.js +37 -0
- package/dist/element/contract-gate.js.map +1 -0
- package/dist/element/create-component-element.d.ts +93 -0
- package/dist/element/create-component-element.d.ts.map +1 -0
- package/dist/element/create-component-element.js +302 -0
- package/dist/element/create-component-element.js.map +1 -0
- package/dist/element/define-element.d.ts +43 -0
- package/dist/element/define-element.d.ts.map +1 -0
- package/dist/element/define-element.js +61 -0
- package/dist/element/define-element.js.map +1 -0
- package/dist/element/diagnostics.d.ts +35 -0
- package/dist/element/diagnostics.d.ts.map +1 -0
- package/dist/element/diagnostics.js +52 -0
- package/dist/element/diagnostics.js.map +1 -0
- package/dist/element/error-boundary.d.ts +41 -0
- package/dist/element/error-boundary.d.ts.map +1 -0
- package/dist/element/error-boundary.js +36 -0
- package/dist/element/error-boundary.js.map +1 -0
- package/dist/element/error-report.d.ts +9 -0
- package/dist/element/error-report.d.ts.map +1 -0
- package/dist/element/error-report.js +51 -0
- package/dist/element/error-report.js.map +1 -0
- package/dist/element/events.d.ts +69 -0
- package/dist/element/events.d.ts.map +1 -0
- package/dist/element/events.js +115 -0
- package/dist/element/events.js.map +1 -0
- package/dist/element/handler-guard.d.ts +54 -0
- package/dist/element/handler-guard.d.ts.map +1 -0
- package/dist/element/handler-guard.js +162 -0
- package/dist/element/handler-guard.js.map +1 -0
- package/dist/element/index.d.ts +9 -0
- package/dist/element/index.d.ts.map +1 -0
- package/dist/element/index.js +9 -0
- package/dist/element/index.js.map +1 -0
- package/dist/element/props-script.d.ts +37 -0
- package/dist/element/props-script.d.ts.map +1 -0
- package/dist/element/props-script.js +63 -0
- package/dist/element/props-script.js.map +1 -0
- package/dist/element/styles.d.ts +45 -0
- package/dist/element/styles.d.ts.map +1 -0
- package/dist/element/styles.js +66 -0
- package/dist/element/styles.js.map +1 -0
- package/dist/element/types.d.ts +148 -0
- package/dist/element/types.d.ts.map +1 -0
- package/dist/element/types.js +3 -0
- package/dist/element/types.js.map +1 -0
- package/dist/host/api.d.ts +40 -0
- package/dist/host/api.d.ts.map +1 -0
- package/dist/host/api.js +144 -0
- package/dist/host/api.js.map +1 -0
- package/dist/host/barrier.d.ts +27 -0
- package/dist/host/barrier.d.ts.map +1 -0
- package/dist/host/barrier.js +47 -0
- package/dist/host/barrier.js.map +1 -0
- package/dist/host/index.d.ts +11 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +9 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/registry.d.ts +21 -0
- package/dist/host/registry.d.ts.map +1 -0
- package/dist/host/registry.js +29 -0
- package/dist/host/registry.js.map +1 -0
- package/dist/host/types.d.ts +54 -0
- package/dist/host/types.d.ts.map +1 -0
- package/dist/host/types.js +11 -0
- package/dist/host/types.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/loader/config.d.ts +63 -0
- package/dist/loader/config.d.ts.map +1 -0
- package/dist/loader/config.js +115 -0
- package/dist/loader/config.js.map +1 -0
- package/dist/loader/entry.d.ts +2 -0
- package/dist/loader/entry.d.ts.map +1 -0
- package/dist/loader/entry.js +37 -0
- package/dist/loader/entry.js.map +1 -0
- package/dist/loader/lazy-transport.d.ts +26 -0
- package/dist/loader/lazy-transport.d.ts.map +1 -0
- package/dist/loader/lazy-transport.js +59 -0
- package/dist/loader/lazy-transport.js.map +1 -0
- package/dist/loader/loader-code.d.ts +2 -0
- package/dist/loader/loader-code.js +2 -0
- package/dist/loader/loading.d.ts +24 -0
- package/dist/loader/loading.d.ts.map +1 -0
- package/dist/loader/loading.js +29 -0
- package/dist/loader/loading.js.map +1 -0
- package/dist/loader/page-state.d.ts +66 -0
- package/dist/loader/page-state.d.ts.map +1 -0
- package/dist/loader/page-state.js +73 -0
- package/dist/loader/page-state.js.map +1 -0
- package/dist/loader/resilient-import.d.ts +32 -0
- package/dist/loader/resilient-import.d.ts.map +1 -0
- package/dist/loader/resilient-import.js +42 -0
- package/dist/loader/resilient-import.js.map +1 -0
- package/dist/loader/run.d.ts +45 -0
- package/dist/loader/run.d.ts.map +1 -0
- package/dist/loader/run.js +217 -0
- package/dist/loader/run.js.map +1 -0
- package/dist/loader/script-url.d.ts +50 -0
- package/dist/loader/script-url.d.ts.map +1 -0
- package/dist/loader/script-url.js +71 -0
- package/dist/loader/script-url.js.map +1 -0
- package/dist/loader/script.d.ts +31 -0
- package/dist/loader/script.d.ts.map +1 -0
- package/dist/loader/script.js +40 -0
- package/dist/loader/script.js.map +1 -0
- package/dist/server/render-fragment.d.ts +57 -0
- package/dist/server/render-fragment.d.ts.map +1 -0
- package/dist/server/render-fragment.js +182 -0
- package/dist/server/render-fragment.js.map +1 -0
- package/dist/server/ssr-code.d.ts +4 -0
- package/dist/server/ssr-code.js +3 -0
- package/dist/server/worker.d.ts +37 -0
- package/dist/server/worker.d.ts.map +1 -0
- package/dist/server/worker.js +71 -0
- package/dist/server/worker.js.map +1 -0
- package/package.json +86 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-url.js","sourceRoot":"","sources":["../../src/loader/script-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAyBH,+FAA+F;AAC/F,MAAM,gBAAgB,GAAG,mCAAmC,CAAC;AAE7D,8DAA8D;AAC9D,SAAS,UAAU,CAAC,GAAW,EAAE,MAAc;IAC7C,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,SAAS,CAAC,sCAAsC,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAkC,EAClC,IAA+B,EAC/B,QAAqB,EAAE;IAEvB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACrB,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACxC,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAClD,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC;gBACH,0FAA0F;gBAC1F,0FAA0F;gBAC1F,4DAA4D;gBAC5D,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;gBAC3C,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE;oBAC5C,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;wBACzB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;wBACxC,OAAO,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBAC/D,CAAC;iBACF,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACP,IAAI,CACF,wFAAwF,CACzF,CAAC;YACJ,CAAC;QACH,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC;QAC/C,IAAI,CAAC;YACH,OAAO,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvD,CAAC;QAAC,MAAM,CAAC;YACP,2FAA2F;YAC3F,4FAA4F;YAC5F,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the text of `/s/<siteKey>.js` (TAG-301): the built loader code with the site's
|
|
3
|
+
* configuration embedded. Pure string work, safe to import in a Worker; the loader code itself
|
|
4
|
+
* comes from `dist/loader-code.js` (`scripts/build-loader.ts`), exported as `LOADER_CODE` by
|
|
5
|
+
* `@taggor/runtime/loader-script`.
|
|
6
|
+
*/
|
|
7
|
+
/** The name the loader code reads its embedded configuration from (a function parameter). */
|
|
8
|
+
export declare const LOADER_CONFIG_NAME = "__TAGGOR_LOADER_CONFIG__";
|
|
9
|
+
/**
|
|
10
|
+
* `JSON.stringify` made safe to place in a classic script (the same escaping `renderLoaderScript`
|
|
11
|
+
* applies to the configuration). Errors: `TypeError` when the value is not serializable.
|
|
12
|
+
*/
|
|
13
|
+
export declare function scriptJson(value: unknown): string;
|
|
14
|
+
/**
|
|
15
|
+
* Wraps the loader code in a function called with the configuration, so nothing leaks to the
|
|
16
|
+
* page's globals.
|
|
17
|
+
*
|
|
18
|
+
* Inputs: the built loader code and a JSON-serializable configuration (`origin`, `runtimeUrl`,
|
|
19
|
+
* `manifest`). Output: a classic script. The JSON is escaped for `<`, `>`, `&` and the line
|
|
20
|
+
* separators U+2028/U+2029, so a value in the manifest can never end the script early or be read
|
|
21
|
+
* as markup if the file is ever inlined. Errors: `TypeError` when the configuration is not
|
|
22
|
+
* serializable. Side effects: none.
|
|
23
|
+
*
|
|
24
|
+
* `prepare` (TAG-607, optional): the source of a function expression the SERVER wrote, called in
|
|
25
|
+
* the browser with the configuration object before the loader reads it (the edge's domain gate,
|
|
26
|
+
* which empties the components on a hostname outside the allowed domains). It must return the
|
|
27
|
+
* configuration; it is never built from request data. The loader bundle does not contain this file,
|
|
28
|
+
* so it costs the loader no bytes.
|
|
29
|
+
*/
|
|
30
|
+
export declare function renderLoaderScript(code: string, config: unknown, prepare?: string): string;
|
|
31
|
+
//# sourceMappingURL=script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../src/loader/script.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6FAA6F;AAC7F,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOjD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAI1F"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the text of `/s/<siteKey>.js` (TAG-301): the built loader code with the site's
|
|
3
|
+
* configuration embedded. Pure string work, safe to import in a Worker; the loader code itself
|
|
4
|
+
* comes from `dist/loader-code.js` (`scripts/build-loader.ts`), exported as `LOADER_CODE` by
|
|
5
|
+
* `@taggor/runtime/loader-script`.
|
|
6
|
+
*/
|
|
7
|
+
/** The name the loader code reads its embedded configuration from (a function parameter). */
|
|
8
|
+
export const LOADER_CONFIG_NAME = "__TAGGOR_LOADER_CONFIG__";
|
|
9
|
+
/**
|
|
10
|
+
* `JSON.stringify` made safe to place in a classic script (the same escaping `renderLoaderScript`
|
|
11
|
+
* applies to the configuration). Errors: `TypeError` when the value is not serializable.
|
|
12
|
+
*/
|
|
13
|
+
export function scriptJson(value) {
|
|
14
|
+
const json = JSON.stringify(value);
|
|
15
|
+
if (json === undefined)
|
|
16
|
+
throw new TypeError("loader configuration is not serializable");
|
|
17
|
+
return json.replace(/[<>&\u2028\u2029]/g, (char) => `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Wraps the loader code in a function called with the configuration, so nothing leaks to the
|
|
21
|
+
* page's globals.
|
|
22
|
+
*
|
|
23
|
+
* Inputs: the built loader code and a JSON-serializable configuration (`origin`, `runtimeUrl`,
|
|
24
|
+
* `manifest`). Output: a classic script. The JSON is escaped for `<`, `>`, `&` and the line
|
|
25
|
+
* separators U+2028/U+2029, so a value in the manifest can never end the script early or be read
|
|
26
|
+
* as markup if the file is ever inlined. Errors: `TypeError` when the configuration is not
|
|
27
|
+
* serializable. Side effects: none.
|
|
28
|
+
*
|
|
29
|
+
* `prepare` (TAG-607, optional): the source of a function expression the SERVER wrote, called in
|
|
30
|
+
* the browser with the configuration object before the loader reads it (the edge's domain gate,
|
|
31
|
+
* which empties the components on a hostname outside the allowed domains). It must return the
|
|
32
|
+
* configuration; it is never built from request data. The loader bundle does not contain this file,
|
|
33
|
+
* so it costs the loader no bytes.
|
|
34
|
+
*/
|
|
35
|
+
export function renderLoaderScript(code, config, prepare) {
|
|
36
|
+
const safe = scriptJson(config);
|
|
37
|
+
const argument = prepare === undefined ? safe : `(${prepare})(${safe})`;
|
|
38
|
+
return `(function(${LOADER_CONFIG_NAME}){${code}})(${argument});\n`;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script.js","sourceRoot":"","sources":["../../src/loader/script.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6FAA6F;AAC7F,MAAM,CAAC,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAE7D;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAuB,CAAC;IACzD,IAAI,IAAI,KAAK,SAAS;QAAE,MAAM,IAAI,SAAS,CAAC,0CAA0C,CAAC,CAAC;IACxF,OAAO,IAAI,CAAC,OAAO,CACjB,oBAAoB,EACpB,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CACnE,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,MAAe,EAAE,OAAgB;IAChF,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,OAAO,KAAK,IAAI,GAAG,CAAC;IACxE,OAAO,aAAa,kBAAkB,KAAK,IAAI,MAAM,QAAQ,MAAM,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host attribute that carries the version a fragment was rendered from. The browser runtime
|
|
3
|
+
* reads the same literal (it cannot import this module: every byte there is budgeted).
|
|
4
|
+
*/
|
|
5
|
+
export declare const SSR_STAMP_ATTRIBUTE = "ssr";
|
|
6
|
+
/**
|
|
7
|
+
* Host attributes copied to the fragment besides the component's own props: the language ones the
|
|
8
|
+
* SDK reads and the two a page styles a tag by. Any other attribute of the request is dropped,
|
|
9
|
+
* so a request can never write an event handler or an unknown attribute into the HTML.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PASSTHROUGH_ATTRIBUTES: readonly string[];
|
|
12
|
+
/** What a render needs besides the definition. */
|
|
13
|
+
export interface FragmentRequest {
|
|
14
|
+
/** The element's attributes as a page writes them; only bound props and the passthrough ones are used. */
|
|
15
|
+
readonly attributes: Readonly<Record<string, string>>;
|
|
16
|
+
/** The published version hash, stamped on the host; letters, digits, `.`, `_`, `:` and `-` only. */
|
|
17
|
+
readonly version: string;
|
|
18
|
+
/** The published manifest's contract version (falls back to the definition's own). */
|
|
19
|
+
readonly contractVersion?: unknown;
|
|
20
|
+
/** The ISO day the edge serves on, for the contract's support window (as the loader stamps it). */
|
|
21
|
+
readonly servedOn?: string | undefined;
|
|
22
|
+
/** The site's saved prop defaults (TAG-613), as the loader gives them to the wrapper. */
|
|
23
|
+
readonly siteDefaults?: unknown;
|
|
24
|
+
}
|
|
25
|
+
/** Why no fragment was produced; the caller then serves the bare tag (the page renders it itself). */
|
|
26
|
+
export type FragmentRefusal =
|
|
27
|
+
/** Not an object `defineTaggorComponent` made, or a tag that is not a custom element name. */
|
|
28
|
+
"invalid-definition"
|
|
29
|
+
/** A version that cannot be written as an attribute value. */
|
|
30
|
+
| "invalid-version"
|
|
31
|
+
/** A contract version this runtime cannot mount (the browser would not mount it either). */
|
|
32
|
+
| "unsupported-contract"
|
|
33
|
+
/** The component binds a prop to the `ssr` attribute, which would be read as the stamp. */
|
|
34
|
+
| "stamp-collision"
|
|
35
|
+
/** The component threw while rendering without a DOM. */
|
|
36
|
+
| "render-failed";
|
|
37
|
+
/** The outcome of a render. */
|
|
38
|
+
export type FragmentResult = {
|
|
39
|
+
readonly ok: true;
|
|
40
|
+
readonly html: string;
|
|
41
|
+
} | {
|
|
42
|
+
readonly ok: false;
|
|
43
|
+
readonly reason: FragmentRefusal;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Renders a component definition to its Declarative Shadow DOM fragment.
|
|
47
|
+
*
|
|
48
|
+
* Inputs: the default export of a published bundle (any value) and a `FragmentRequest`. Output:
|
|
49
|
+
* `{ ok: true, html }` with the whole element, or `{ ok: false, reason }`. The host carries the
|
|
50
|
+
* bound attributes the request gave (in declaration order), then the passthrough ones, then the
|
|
51
|
+
* stamp; values are escaped. Errors: never throws, whatever the definition does (a throw while
|
|
52
|
+
* rendering is `render-failed`). Side effects: runs the component's render function; reads the
|
|
53
|
+
* `document` and `navigator` globals only through the component's own code (the render Worker
|
|
54
|
+
* sets them first).
|
|
55
|
+
*/
|
|
56
|
+
export declare function renderComponentFragment(definition: unknown, request: FragmentRequest): FragmentResult;
|
|
57
|
+
//# sourceMappingURL=render-fragment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-fragment.d.ts","sourceRoot":"","sources":["../../src/server/render-fragment.ts"],"names":[],"mappings":"AAgCA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAKlD,CAAC;AAEH,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,0GAA0G;IAC1G,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,oGAAoG;IACpG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sFAAsF;IACtF,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,mGAAmG;IACnG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,yFAAyF;IACzF,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,sGAAsG;AACtG,MAAM,MAAM,eAAe;AACzB,8FAA8F;AAC5F,oBAAoB;AACtB,8DAA8D;GAC5D,iBAAiB;AACnB,4FAA4F;GAC1F,sBAAsB;AACxB,2FAA2F;GACzF,iBAAiB;AACnB,yDAAyD;GACvD,eAAe,CAAC;AAEpB,+BAA+B;AAC/B,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC;AA6E7D;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,eAAe,GACvB,cAAc,CAqEhB"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server rendering of a component to a Declarative Shadow DOM fragment (SSR spike, ADR 0066).
|
|
3
|
+
*
|
|
4
|
+
* The browser wrapper (`element/`) needs a DOM; this module does not. It reuses the wrapper's pure
|
|
5
|
+
* parts, the contract gate (`checkComponentContract`) and the attribute coercion (`bindProps`,
|
|
6
|
+
* `readProps`), so the props a component gets on the server are the ones it gets in the page, and
|
|
7
|
+
* renders the component to a string with `preact-render-to-string`. The output is the element as
|
|
8
|
+
* a server writes it into its HTML:
|
|
9
|
+
*
|
|
10
|
+
* <tag …attributes ssr="<version>">
|
|
11
|
+
* <template shadowrootmode="open"><style>…</style>…component HTML…</template>
|
|
12
|
+
* </tag>
|
|
13
|
+
*
|
|
14
|
+
* The `ssr` attribute is the stamp the browser runtime compares with the version it mounts
|
|
15
|
+
* (`component-controller.ts`, `attach`): equal, Preact adopts the nodes; different, the root is
|
|
16
|
+
* emptied and rendered from nothing. The CSS goes in `<style>` elements, one per text with the
|
|
17
|
+
* host reset first, exactly what the error boundary renders in a browser without constructable
|
|
18
|
+
* stylesheets, because adopted stylesheets cannot be written in HTML.
|
|
19
|
+
*
|
|
20
|
+
* Runs only inside the isolated render Worker the edge loads (`server/worker.ts`), next to the
|
|
21
|
+
* customer's bundle: never in the edge Worker itself and never in a page. Effects do not run in a
|
|
22
|
+
* string render, so the component only executes its render function once.
|
|
23
|
+
*/
|
|
24
|
+
import { CUSTOM_ELEMENT_MEMBERS, RESERVED_PROP_NAMES, deepFreeze } from "@taggor/contract/zod-free";
|
|
25
|
+
import { h } from "preact";
|
|
26
|
+
import { renderToString } from "preact-render-to-string";
|
|
27
|
+
import { bindProps, readProps } from "../element/attributes.js";
|
|
28
|
+
import { checkComponentContract } from "../element/contract-gate.js";
|
|
29
|
+
import { HOST_RESET } from "../element/styles.js";
|
|
30
|
+
import { COMPONENT_KIND } from "../element/types.js";
|
|
31
|
+
/**
|
|
32
|
+
* The host attribute that carries the version a fragment was rendered from. The browser runtime
|
|
33
|
+
* reads the same literal (it cannot import this module: every byte there is budgeted).
|
|
34
|
+
*/
|
|
35
|
+
export const SSR_STAMP_ATTRIBUTE = "ssr";
|
|
36
|
+
/**
|
|
37
|
+
* Host attributes copied to the fragment besides the component's own props: the language ones the
|
|
38
|
+
* SDK reads and the two a page styles a tag by. Any other attribute of the request is dropped,
|
|
39
|
+
* so a request can never write an event handler or an unknown attribute into the HTML.
|
|
40
|
+
*/
|
|
41
|
+
export const PASSTHROUGH_ATTRIBUTES = Object.freeze([
|
|
42
|
+
"locale",
|
|
43
|
+
"lang",
|
|
44
|
+
"id",
|
|
45
|
+
"class",
|
|
46
|
+
]);
|
|
47
|
+
const TAG_NAME = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/;
|
|
48
|
+
const VERSION = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
49
|
+
const escapeAttribute = (value) => value
|
|
50
|
+
.replaceAll("&", "&")
|
|
51
|
+
.replaceAll('"', """)
|
|
52
|
+
.replaceAll("<", "<")
|
|
53
|
+
.replaceAll(">", ">");
|
|
54
|
+
/** CSS as the text of a `<style>` element: nothing in it can close the element early. */
|
|
55
|
+
const styleText = (css) => css.replace(/<\/(?=style)/gi, "<\\/");
|
|
56
|
+
function isRenderable(value) {
|
|
57
|
+
if (typeof value !== "object" || value === null)
|
|
58
|
+
return false;
|
|
59
|
+
const candidate = value;
|
|
60
|
+
const manifest = candidate.manifest;
|
|
61
|
+
return (candidate.kind === COMPONENT_KIND &&
|
|
62
|
+
typeof candidate.component === "function" &&
|
|
63
|
+
Array.isArray(candidate.styles) &&
|
|
64
|
+
candidate.styles.every((css) => typeof css === "string") &&
|
|
65
|
+
typeof manifest === "object" &&
|
|
66
|
+
manifest !== null &&
|
|
67
|
+
typeof manifest["tag"] === "string" &&
|
|
68
|
+
TAG_NAME.test(manifest["tag"]) &&
|
|
69
|
+
typeof manifest["name"] === "string" &&
|
|
70
|
+
(manifest["props"] === undefined ||
|
|
71
|
+
(typeof manifest["props"] === "object" && manifest["props"] !== null)));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The host a component gets on the server: what the SDK reads while rendering, with listeners and
|
|
75
|
+
* events as no-ops. Anything else a component touches is missing on purpose: it throws, the render
|
|
76
|
+
* is refused and the page renders the component itself.
|
|
77
|
+
*/
|
|
78
|
+
function serverHost(tag, attributes) {
|
|
79
|
+
const read = (name) => Object.hasOwn(attributes, name) ? (attributes[name] ?? null) : null;
|
|
80
|
+
const noop = () => undefined;
|
|
81
|
+
const element = {
|
|
82
|
+
localName: tag,
|
|
83
|
+
tagName: tag.toUpperCase(),
|
|
84
|
+
isConnected: true,
|
|
85
|
+
// No light DOM (the SDK's slot hooks see no content) and a document with nothing in it (the
|
|
86
|
+
// font and consent hooks read `fonts`, `defaultView` and `location` from it, all optional).
|
|
87
|
+
childNodes: [],
|
|
88
|
+
ownerDocument: {},
|
|
89
|
+
getAttribute: read,
|
|
90
|
+
hasAttribute: (name) => read(name) !== null,
|
|
91
|
+
// The SDK asks for the nearest `[lang]`, the element itself included.
|
|
92
|
+
closest: (selector) => selector === "[lang]" && read("lang") !== null ? element : null,
|
|
93
|
+
addEventListener: noop,
|
|
94
|
+
removeEventListener: noop,
|
|
95
|
+
dispatchEvent: () => true,
|
|
96
|
+
};
|
|
97
|
+
const shadowRoot = {
|
|
98
|
+
host: element,
|
|
99
|
+
addEventListener: noop,
|
|
100
|
+
removeEventListener: noop,
|
|
101
|
+
querySelector: () => null,
|
|
102
|
+
querySelectorAll: () => [],
|
|
103
|
+
};
|
|
104
|
+
return Object.freeze({
|
|
105
|
+
element,
|
|
106
|
+
shadowRoot,
|
|
107
|
+
emit: noop,
|
|
108
|
+
signal: undefined,
|
|
109
|
+
internals: undefined,
|
|
110
|
+
transport: undefined,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Renders a component definition to its Declarative Shadow DOM fragment.
|
|
115
|
+
*
|
|
116
|
+
* Inputs: the default export of a published bundle (any value) and a `FragmentRequest`. Output:
|
|
117
|
+
* `{ ok: true, html }` with the whole element, or `{ ok: false, reason }`. The host carries the
|
|
118
|
+
* bound attributes the request gave (in declaration order), then the passthrough ones, then the
|
|
119
|
+
* stamp; values are escaped. Errors: never throws, whatever the definition does (a throw while
|
|
120
|
+
* rendering is `render-failed`). Side effects: runs the component's render function; reads the
|
|
121
|
+
* `document` and `navigator` globals only through the component's own code (the render Worker
|
|
122
|
+
* sets them first).
|
|
123
|
+
*/
|
|
124
|
+
export function renderComponentFragment(definition, request) {
|
|
125
|
+
try {
|
|
126
|
+
if (!isRenderable(definition))
|
|
127
|
+
return { ok: false, reason: "invalid-definition" };
|
|
128
|
+
if (!VERSION.test(request.version))
|
|
129
|
+
return { ok: false, reason: "invalid-version" };
|
|
130
|
+
const { manifest } = definition;
|
|
131
|
+
const contract = checkComponentContract(request.contractVersion ?? manifest.contractVersion, request.servedOn);
|
|
132
|
+
if (!contract.usable)
|
|
133
|
+
return { ok: false, reason: "unsupported-contract" };
|
|
134
|
+
// The browser leaves out a prop named like a member of `HTMLElement.prototype`; there is no
|
|
135
|
+
// prototype here, so the contract's snapshot of those names stands in for it.
|
|
136
|
+
const members = CUSTOM_ELEMENT_MEMBERS;
|
|
137
|
+
const { bindings } = bindProps(manifest, (prop) => RESERVED_PROP_NAMES.includes(prop) || members.includes(prop), request.siteDefaults);
|
|
138
|
+
if (bindings.some((binding) => binding.attribute === SSR_STAMP_ATTRIBUTE)) {
|
|
139
|
+
return { ok: false, reason: "stamp-collision" };
|
|
140
|
+
}
|
|
141
|
+
const given = request.attributes;
|
|
142
|
+
const read = (name) => (Object.hasOwn(given, name) ? (given[name] ?? null) : null);
|
|
143
|
+
const { props } = readProps(bindings, read);
|
|
144
|
+
let html;
|
|
145
|
+
try {
|
|
146
|
+
html = renderToString(h(definition.component, {
|
|
147
|
+
host: serverHost(manifest.tag, given),
|
|
148
|
+
// Frozen in depth, as in the page (component-controller.ts, `currentProps`).
|
|
149
|
+
props: deepFreeze({ ...props }),
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return { ok: false, reason: "render-failed" };
|
|
154
|
+
}
|
|
155
|
+
const names = [
|
|
156
|
+
...bindings.map((binding) => binding.attribute),
|
|
157
|
+
...PASSTHROUGH_ATTRIBUTES.filter((name) => !bindings.some((binding) => binding.attribute === name)),
|
|
158
|
+
];
|
|
159
|
+
const attributes = names
|
|
160
|
+
.map((name) => [name, read(name)])
|
|
161
|
+
.filter((entry) => typeof entry[1] === "string")
|
|
162
|
+
.map(([name, value]) => ` ${name}="${escapeAttribute(value)}"`)
|
|
163
|
+
.join("");
|
|
164
|
+
const delegates = typeof manifest.delegatesFocus === "boolean"
|
|
165
|
+
? manifest.delegatesFocus
|
|
166
|
+
: manifest.formAssociated === true;
|
|
167
|
+
const styles = [HOST_RESET, ...definition.styles]
|
|
168
|
+
.map((css) => `<style>${styleText(css)}</style>`)
|
|
169
|
+
.join("");
|
|
170
|
+
return {
|
|
171
|
+
ok: true,
|
|
172
|
+
html: `<${manifest.tag}${attributes} ${SSR_STAMP_ATTRIBUTE}="${request.version}">` +
|
|
173
|
+
`<template shadowrootmode="open"${delegates ? " shadowrootdelegatesfocus" : ""}>` +
|
|
174
|
+
`${styles}${html}</template></${manifest.tag}>`,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// A hostile definition (a getter that throws, a proxy): refused like any other.
|
|
179
|
+
return { ok: false, reason: "invalid-definition" };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=render-fragment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-fragment.js","sourceRoot":"","sources":["../../src/server/render-fragment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACpG,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAA2B,MAAM,qBAAqB,CAAC;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB,MAAM,CAAC,MAAM,CAAC;IACrE,QAAQ;IACR,MAAM;IACN,IAAI;IACJ,OAAO;CACR,CAAC,CAAC;AAkCH,MAAM,QAAQ,GAAG,iCAAiC,CAAC;AACnD,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAE3C,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE,CACxC,KAAK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AAK,CAAC,GAAG,CAAC;aAC9D,IAAI,CAAC,EAAE,CAAC,CAAC;QACZ,MAAM,SAAS,GACb,OAAO,QAAQ,CAAC,cAAc,KAAK,SAAS;YAC1C,CAAC,CAAC,QAAQ,CAAC,cAAc;YACzB,CAAC,CAAC,QAAQ,CAAC,cAAc,KAAK,IAAI,CAAC;QACvC,MAAM,MAAM,GAAG,CAAC,UAAU,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;aAC9C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;aAChD,IAAI,CAAC,EAAE,CAAC,CAAC;QACZ,OAAO;YACL,EAAE,EAAE,IAAI;YACR,IAAI,EACF,IAAI,QAAQ,CAAC,GAAG,GAAG,UAAU,IAAI,mBAAmB,KAAK,OAAO,CAAC,OAAO,IAAI;gBAC5E,kCAAkC,SAAS,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,GAAG;gBACjF,GAAG,MAAM,GAAG,IAAI,gBAAgB,QAAQ,CAAC,GAAG,GAAG;SAClD,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,gFAAgF;QAChF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The module name the render Worker imports Preact by; the edge supplies it per Worker. */
|
|
2
|
+
export declare const SSR_PREACT_MODULE: string;
|
|
3
|
+
/** The built render Worker: an ES module exporting `createRenderWorker` (src/server/worker.ts). */
|
|
4
|
+
export declare const SSR_WORKER_CODE: string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// Generated by scripts/build-ssr.ts (SSR spike, ADR 0066); do not edit.
|
|
2
|
+
export const SSR_PREACT_MODULE = "taggor-preact.js";
|
|
3
|
+
export const SSR_WORKER_CODE = "function x(e){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null||Object.isFrozen(e))return e;Object.freeze(e);for(let t of Reflect.ownKeys(e)){let n=Object.getOwnPropertyDescriptor(e,t);n!==void 0&&\"value\"in n&&x(n.value)}return e}var g=Object.freeze({maxJsonLength:65536,nameMaxLength:64,titleMaxLength:80,descriptionMaxLength:500,memberDescriptionMaxLength:300,memberNameMaxLength:40,cssVarNameMaxLength:64,cssValueMaxLength:100,maxProps:50,maxEvents:20,maxSlots:10,maxParts:30,maxCssVars:30,maxCollections:10,maxCollectionFields:50,maxTrackEvents:30,maxTrackProps:8,maxEnumValues:50,enumValueMaxLength:64,maxObjectFields:50,stringMaxLength:1e4,arrayMaxItems:1e3,valueSchemaDepth:3,colorMaxLength:64,urlMaxLength:2048,numberTextMaxLength:32,propJsonMaxLength:32768,maxConnectOrigins:10,sizeMaxPixels:4e3,aspectRatioMaxTerm:100});var Mn=Object.freeze({submitBodyMaxBytes:32768,trackBodyMaxBytes:2048,submitDataMaxKeys:50,idempotencyKeyMinLength:16,idempotencyKeyMaxLength:64,turnstileTokenMaxLength:2048,honeypotMaxLength:256,readPageMax:100,readPageDefault:20,cursorMaxLength:512,errorMessageMaxLength:500,maxErrorFields:50});var bt=`${String(1)}.${String(10)}.0`;var j=Object.freeze({major:1,minor:10,majors:Object.freeze([Object.freeze({major:1})])}),se=\"(0|[1-9]\\\\d{0,5})\",At=new RegExp(`^${se}\\\\.${se}\\\\.${se}$`);var Ot=/^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\d|3[01])$/;function xe(e){if(typeof e!=\"string\")return;let t=At.exec(e);if(t!==null)return{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}}function Me(e,t=j){if(e===void 0)return{kind:\"missing\",version:void 0};let n=xe(e);return n===void 0?{kind:\"malformed\",version:n}:n.major>t.major?{kind:\"newer-major\",version:n}:n.major<t.major?{kind:\"older-major\",version:n}:n.minor>t.minor?{kind:\"newer-minor\",version:n}:{kind:\"current\",version:n}}function Rt(e){return e===void 0?\"\":`${String(e.major)}.${String(e.minor)}.${String(e.patch)}`}function Ct(e){return`${String(e.major)}.${String(e.minor)}.x`}function Ie(e,t,n=j,r){let a=Ct(n),o=Rt(t),i=String(t?.major??\"\");switch(e){case\"missing\":return`contractVersion is missing: declare the contract version the manifest was written for (newest supported: ${a})`;case\"malformed\":return`contractVersion must be a semantic version major.minor.patch such as \"${String(n.major)}.${String(n.minor)}.0\" (digits only, no suffix)`;case\"newer-minor\":return`contractVersion ${o} is newer than the newest supported (${a}): update the Taggor toolchain that reads this manifest`;case\"newer-major\":return`contractVersion ${o} is contract v${i}, newer than the newest supported (${a})`;case\"older-major\":return`contractVersion ${o} is contract v${i}: migrate it with migrateManifest to v${String(n.major)} before parsing`;case\"deprecated-major\":return`contract v${i} is deprecated since ${r?.deprecatedOn??\"?\"} and supported until ${r?.supportedUntil??\"?\"}: migrate the component to v${String(n.major)}`;case\"unsupported-major\":return r?.supportedUntil===void 0?`contract v${i} is not supported (newest supported: ${a})`:`contract v${i} is no longer supported (support ended ${r.supportedUntil}): migrate the component to v${String(n.major)}`}}function q(e,t,n,r,a){let o=e!==\"deprecated-major\";return{code:e,severity:t.consumer===\"builder\"&&o?\"error\":\"warning\",message:Ie(e,n,r,a)}}function Z(e,t,n=j){if(!Ot.test(t.today))throw new RangeError(`today must be an ISO day (YYYY-MM-DD), got \"${t.today}\"`);let{kind:r,version:a}=Me(e,n);switch(r){case\"current\":return{usable:!0,version:a,problem:void 0};case\"newer-minor\":return{usable:t.consumer===\"runtime\",version:a,problem:q(r,t,a,n)};case\"older-major\":{let o=n.majors.find(s=>s.major===a?.major),i=o?.supportedUntil;return o===void 0||i===void 0||t.today>i?{usable:!1,version:a,problem:q(\"unsupported-major\",t,a,n,o)}:{usable:!0,version:a,problem:t.consumer===\"builder\"?q(\"deprecated-major\",t,a,n,o):void 0}}case\"newer-major\":case\"malformed\":case\"missing\":return{usable:!1,version:a,problem:q(r,t,a,n)}}}var Le=x({browser:\"Google Chrome 156.0.0.0\",takenOn:\"2026-10-30\",prototypes:{HTMLElement:[\"accessKey\",\"attachInternals\",\"attributeStyleMap\",\"autocapitalize\",\"autocorrect\",\"autofocus\",\"blur\",\"click\",\"constructor\",\"contentEditable\",\"dataset\",\"dir\",\"draggable\",\"editContext\",\"enterKeyHint\",\"focus\",\"focusGroup\",\"focusGroupStart\",\"hidden\",\"hidePopover\",\"inert\",\"innerText\",\"inputMode\",\"isContentEditable\",\"lang\",\"nonce\",\"offsetHeight\",\"offsetLeft\",\"offsetParent\",\"offsetTop\",\"offsetWidth\",\"onabort\",\"onanimationcancel\",\"onanimationend\",\"onanimationiteration\",\"onanimationstart\",\"onauxclick\",\"onbeforeinput\",\"onbeforematch\",\"onbeforetoggle\",\"onbeforexrselect\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncommand\",\"oncontentvisibilityautostatechange\",\"oncontextlost\",\"oncontextmenu\",\"oncontextrestored\",\"oncopy\",\"oncuechange\",\"oncut\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"onformdata\",\"ongotpointercapture\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onlostpointercapture\",\"onmousedown\",\"onmouseenter\",\"onmouseleave\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpaste\",\"onpause\",\"onplay\",\"onplaying\",\"onpointercancel\",\"onpointerdown\",\"onpointerenter\",\"onpointerleave\",\"onpointermove\",\"onpointerout\",\"onpointerover\",\"onpointerrawupdate\",\"onpointerup\",\"onprogress\",\"onratechange\",\"onreset\",\"onresize\",\"onscroll\",\"onscrollend\",\"onscrollsnapchange\",\"onscrollsnapchanging\",\"onsecuritypolicyviolation\",\"onseeked\",\"onseeking\",\"onselect\",\"onselectionchange\",\"onselectstart\",\"onslotchange\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"ontoggle\",\"ontransitioncancel\",\"ontransitionend\",\"ontransitionrun\",\"ontransitionstart\",\"onvolumechange\",\"onwaiting\",\"onwebkitanimationend\",\"onwebkitanimationiteration\",\"onwebkitanimationstart\",\"onwebkittransitionend\",\"onwheel\",\"outerText\",\"popover\",\"showPopover\",\"spellcheck\",\"style\",\"tabIndex\",\"title\",\"togglePopover\",\"translate\",\"virtualKeyboardPolicy\",\"writingSuggestions\"],Element:[\"activeViewTransition\",\"after\",\"animate\",\"append\",\"ariaActionsElements\",\"ariaActiveDescendantElement\",\"ariaAtomic\",\"ariaAutoComplete\",\"ariaBrailleLabel\",\"ariaBrailleRoleDescription\",\"ariaBusy\",\"ariaChecked\",\"ariaColCount\",\"ariaColIndex\",\"ariaColIndexText\",\"ariaColSpan\",\"ariaControlsElements\",\"ariaCurrent\",\"ariaDescribedByElements\",\"ariaDescription\",\"ariaDetailsElements\",\"ariaDisabled\",\"ariaErrorMessageElements\",\"ariaExpanded\",\"ariaFlowToElements\",\"ariaHasPopup\",\"ariaHidden\",\"ariaInvalid\",\"ariaKeyShortcuts\",\"ariaLabel\",\"ariaLabelledByElements\",\"ariaLevel\",\"ariaLive\",\"ariaModal\",\"ariaMultiLine\",\"ariaMultiSelectable\",\"ariaNotify\",\"ariaOrientation\",\"ariaPlaceholder\",\"ariaPosInSet\",\"ariaPressed\",\"ariaReadOnly\",\"ariaRelevant\",\"ariaRequired\",\"ariaRoleDescription\",\"ariaRowCount\",\"ariaRowIndex\",\"ariaRowIndexText\",\"ariaRowSpan\",\"ariaSelected\",\"ariaSetSize\",\"ariaSort\",\"ariaValueMax\",\"ariaValueMin\",\"ariaValueNow\",\"ariaValueText\",\"assignedSlot\",\"attachShadow\",\"attributes\",\"before\",\"checkVisibility\",\"childElementCount\",\"children\",\"classList\",\"className\",\"clientHeight\",\"clientLeft\",\"clientTop\",\"clientWidth\",\"closest\",\"computedStyleMap\",\"constructor\",\"currentCSSZoom\",\"customElementRegistry\",\"elementTiming\",\"firstElementChild\",\"getAnimations\",\"getAttribute\",\"getAttributeNS\",\"getAttributeNames\",\"getAttributeNode\",\"getAttributeNodeNS\",\"getBoundingClientRect\",\"getClientRects\",\"getElementsByClassName\",\"getElementsByTagName\",\"getElementsByTagNameNS\",\"getHTML\",\"hasAttribute\",\"hasAttributeNS\",\"hasAttributes\",\"hasPointerCapture\",\"id\",\"innerHTML\",\"insertAdjacentElement\",\"insertAdjacentHTML\",\"insertAdjacentText\",\"lastElementChild\",\"localName\",\"matches\",\"moveBefore\",\"namespaceURI\",\"nextElementSibling\",\"onbeforecopy\",\"onbeforecut\",\"onbeforepaste\",\"onfullscreenchange\",\"onfullscreenerror\",\"onsearch\",\"onwebkitfullscreenchange\",\"onwebkitfullscreenerror\",\"outerHTML\",\"part\",\"prefix\",\"prepend\",\"previousElementSibling\",\"pseudo\",\"querySelector\",\"querySelectorAll\",\"releasePointerCapture\",\"remove\",\"removeAttribute\",\"removeAttributeNS\",\"removeAttributeNode\",\"replaceChildren\",\"replaceWith\",\"requestFullscreen\",\"requestPointerLock\",\"role\",\"scroll\",\"scrollBy\",\"scrollHeight\",\"scrollIntoView\",\"scrollIntoViewIfNeeded\",\"scrollLeft\",\"scrollTo\",\"scrollTop\",\"scrollWidth\",\"setAttribute\",\"setAttributeNS\",\"setAttributeNode\",\"setAttributeNodeNS\",\"setHTML\",\"setHTMLUnsafe\",\"setPointerCapture\",\"shadowRoot\",\"slot\",\"startViewTransition\",\"tagName\",\"toggleAttribute\",\"webkitMatchesSelector\",\"webkitRequestFullScreen\",\"webkitRequestFullscreen\"],Node:[\"ATTRIBUTE_NODE\",\"CDATA_SECTION_NODE\",\"COMMENT_NODE\",\"DOCUMENT_FRAGMENT_NODE\",\"DOCUMENT_NODE\",\"DOCUMENT_POSITION_CONTAINED_BY\",\"DOCUMENT_POSITION_CONTAINS\",\"DOCUMENT_POSITION_DISCONNECTED\",\"DOCUMENT_POSITION_FOLLOWING\",\"DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC\",\"DOCUMENT_POSITION_PRECEDING\",\"DOCUMENT_TYPE_NODE\",\"ELEMENT_NODE\",\"ENTITY_NODE\",\"ENTITY_REFERENCE_NODE\",\"NOTATION_NODE\",\"PROCESSING_INSTRUCTION_NODE\",\"TEXT_NODE\",\"appendChild\",\"baseURI\",\"childNodes\",\"cloneNode\",\"compareDocumentPosition\",\"constructor\",\"contains\",\"firstChild\",\"getRootNode\",\"hasChildNodes\",\"insertBefore\",\"isConnected\",\"isDefaultNamespace\",\"isEqualNode\",\"isSameNode\",\"lastChild\",\"lookupNamespaceURI\",\"lookupPrefix\",\"nextSibling\",\"nodeName\",\"nodeType\",\"nodeValue\",\"normalize\",\"ownerDocument\",\"parentElement\",\"parentNode\",\"previousSibling\",\"removeChild\",\"replaceChild\",\"textContent\"],EventTarget:[\"addEventListener\",\"constructor\",\"dispatchEvent\",\"removeEventListener\",\"when\"],Object:[\"__defineGetter__\",\"__defineSetter__\",\"__lookupGetter__\",\"__lookupSetter__\",\"__proto__\",\"constructor\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"toLocaleString\",\"toString\",\"valueOf\"]}}),Pe=x({browser:\"Mozilla Firefox 151.0\",takenOn:\"2026-10-30\",prototypes:{HTMLElement:[\"accessKey\",\"accessKeyLabel\",\"attachInternals\",\"autocapitalize\",\"autocorrect\",\"autofocus\",\"blur\",\"click\",\"constructor\",\"contentEditable\",\"dataset\",\"dir\",\"draggable\",\"enterKeyHint\",\"focus\",\"hidden\",\"hidePopover\",\"inert\",\"innerText\",\"inputMode\",\"isContentEditable\",\"lang\",\"nonce\",\"offsetHeight\",\"offsetLeft\",\"offsetParent\",\"offsetTop\",\"offsetWidth\",\"onabort\",\"onanimationcancel\",\"onanimationend\",\"onanimationiteration\",\"onanimationstart\",\"onauxclick\",\"onbeforeinput\",\"onbeforematch\",\"onbeforetoggle\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncommand\",\"oncontentvisibilityautostatechange\",\"oncontextlost\",\"oncontextmenu\",\"oncontextrestored\",\"oncopy\",\"oncuechange\",\"oncut\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragexit\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"onformdata\",\"ongotpointercapture\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onlostpointercapture\",\"onmousedown\",\"onmouseenter\",\"onmouseleave\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmozfullscreenchange\",\"onmozfullscreenerror\",\"onpaste\",\"onpause\",\"onplay\",\"onplaying\",\"onpointercancel\",\"onpointerdown\",\"onpointerenter\",\"onpointerleave\",\"onpointermove\",\"onpointerout\",\"onpointerover\",\"onpointerrawupdate\",\"onpointerup\",\"onprogress\",\"onratechange\",\"onreset\",\"onresize\",\"onscroll\",\"onscrollend\",\"onsecuritypolicyviolation\",\"onseeked\",\"onseeking\",\"onselect\",\"onselectionchange\",\"onselectstart\",\"onslotchange\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"ontoggle\",\"ontransitioncancel\",\"ontransitionend\",\"ontransitionrun\",\"ontransitionstart\",\"onvolumechange\",\"onwaiting\",\"onwebkitanimationend\",\"onwebkitanimationiteration\",\"onwebkitanimationstart\",\"onwebkittransitionend\",\"onwheel\",\"outerText\",\"popover\",\"showPopover\",\"spellcheck\",\"style\",\"tabIndex\",\"title\",\"togglePopover\",\"translate\"],Element:[\"after\",\"animate\",\"append\",\"ariaActiveDescendantElement\",\"ariaAtomic\",\"ariaAutoComplete\",\"ariaBrailleLabel\",\"ariaBrailleRoleDescription\",\"ariaBusy\",\"ariaChecked\",\"ariaColCount\",\"ariaColIndex\",\"ariaColIndexText\",\"ariaColSpan\",\"ariaControlsElements\",\"ariaCurrent\",\"ariaDescribedByElements\",\"ariaDescription\",\"ariaDetailsElements\",\"ariaDisabled\",\"ariaErrorMessageElements\",\"ariaExpanded\",\"ariaFlowToElements\",\"ariaHasPopup\",\"ariaHidden\",\"ariaInvalid\",\"ariaKeyShortcuts\",\"ariaLabel\",\"ariaLabelledByElements\",\"ariaLevel\",\"ariaLive\",\"ariaModal\",\"ariaMultiLine\",\"ariaMultiSelectable\",\"ariaNotify\",\"ariaOrientation\",\"ariaOwnsElements\",\"ariaPlaceholder\",\"ariaPosInSet\",\"ariaPressed\",\"ariaReadOnly\",\"ariaRelevant\",\"ariaRequired\",\"ariaRoleDescription\",\"ariaRowCount\",\"ariaRowIndex\",\"ariaRowIndexText\",\"ariaRowSpan\",\"ariaSelected\",\"ariaSetSize\",\"ariaSort\",\"ariaValueMax\",\"ariaValueMin\",\"ariaValueNow\",\"ariaValueText\",\"assignedSlot\",\"attachShadow\",\"attributes\",\"before\",\"checkVisibility\",\"childElementCount\",\"children\",\"classList\",\"className\",\"clientHeight\",\"clientLeft\",\"clientTop\",\"clientWidth\",\"closest\",\"constructor\",\"currentCSSZoom\",\"firstElementChild\",\"getAnimations\",\"getAttribute\",\"getAttributeNS\",\"getAttributeNames\",\"getAttributeNode\",\"getAttributeNodeNS\",\"getBoundingClientRect\",\"getClientRects\",\"getElementsByClassName\",\"getElementsByTagName\",\"getElementsByTagNameNS\",\"getHTML\",\"hasAttribute\",\"hasAttributeNS\",\"hasAttributes\",\"hasPointerCapture\",\"id\",\"innerHTML\",\"insertAdjacentElement\",\"insertAdjacentHTML\",\"insertAdjacentText\",\"lastElementChild\",\"localName\",\"matches\",\"moveBefore\",\"mozMatchesSelector\",\"mozRequestFullScreen\",\"namespaceURI\",\"nextElementSibling\",\"onfullscreenchange\",\"onfullscreenerror\",\"outerHTML\",\"part\",\"prefix\",\"prepend\",\"previousElementSibling\",\"querySelector\",\"querySelectorAll\",\"releaseCapture\",\"releasePointerCapture\",\"remove\",\"removeAttribute\",\"removeAttributeNS\",\"removeAttributeNode\",\"replaceChildren\",\"replaceWith\",\"requestFullscreen\",\"requestPointerLock\",\"role\",\"scroll\",\"scrollBy\",\"scrollHeight\",\"scrollIntoView\",\"scrollLeft\",\"scrollLeftMax\",\"scrollTo\",\"scrollTop\",\"scrollTopMax\",\"scrollWidth\",\"setAttribute\",\"setAttributeNS\",\"setAttributeNode\",\"setAttributeNodeNS\",\"setCapture\",\"setHTML\",\"setHTMLUnsafe\",\"setPointerCapture\",\"shadowRoot\",\"slot\",\"tagName\",\"toggleAttribute\",\"webkitMatchesSelector\"],Node:[\"ATTRIBUTE_NODE\",\"CDATA_SECTION_NODE\",\"COMMENT_NODE\",\"DOCUMENT_FRAGMENT_NODE\",\"DOCUMENT_NODE\",\"DOCUMENT_POSITION_CONTAINED_BY\",\"DOCUMENT_POSITION_CONTAINS\",\"DOCUMENT_POSITION_DISCONNECTED\",\"DOCUMENT_POSITION_FOLLOWING\",\"DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC\",\"DOCUMENT_POSITION_PRECEDING\",\"DOCUMENT_TYPE_NODE\",\"ELEMENT_NODE\",\"ENTITY_NODE\",\"ENTITY_REFERENCE_NODE\",\"NOTATION_NODE\",\"PROCESSING_INSTRUCTION_NODE\",\"TEXT_NODE\",\"appendChild\",\"baseURI\",\"childNodes\",\"cloneNode\",\"compareDocumentPosition\",\"constructor\",\"contains\",\"firstChild\",\"getRootNode\",\"hasChildNodes\",\"insertBefore\",\"isConnected\",\"isDefaultNamespace\",\"isEqualNode\",\"isSameNode\",\"lastChild\",\"lookupNamespaceURI\",\"lookupPrefix\",\"nextSibling\",\"nodeName\",\"nodeType\",\"nodeValue\",\"normalize\",\"ownerDocument\",\"parentElement\",\"parentNode\",\"previousSibling\",\"removeChild\",\"replaceChild\",\"textContent\"],EventTarget:[\"addEventListener\",\"constructor\",\"dispatchEvent\",\"removeEventListener\"],Object:[\"__defineGetter__\",\"__defineSetter__\",\"__lookupGetter__\",\"__lookupSetter__\",\"__proto__\",\"constructor\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"toLocaleString\",\"toString\",\"valueOf\"]}});var Y=Object.freeze([\"adoptedCallback\",\"attributeChangedCallback\",\"connectedCallback\",\"connectedMoveCallback\",\"disabledFeatures\",\"disconnectedCallback\",\"formAssociated\",\"formAssociatedCallback\",\"formDisabledCallback\",\"formResetCallback\",\"formStateRestoreCallback\",\"observedAttributes\"]),xt=Object.freeze([\"value\",\"form\",\"validationMessage\",\"validity\"]),Mt=Object.freeze([\"checkValidity\",\"reportValidity\"]),we=Object.freeze([\"accesskey\",\"autocapitalize\",\"autocorrect\",\"autofocus\",\"class\",\"contenteditable\",\"dir\",\"draggable\",\"enterkeyhint\",\"exportparts\",\"focusgroup\",\"headingoffset\",\"headingreset\",\"hidden\",\"id\",\"inert\",\"inputmode\",\"is\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"nonce\",\"part\",\"popover\",\"role\",\"slot\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\",\"virtualkeyboardpolicy\",\"writingsuggestions\"]),It=/^[a-z][a-zA-Z0-9]*$/,Lt=/^(?:on|(?:aria|data)[A-Z0-9])/;function le(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ve(e){return e.replace(/-([a-z0-9])/g,(t,n)=>n.toUpperCase())}function Pt(e){return Object.values(e.prototypes).flat()}function wt(){let t=[...[Le,Pe].flatMap(Pt),...Y,...we.map(ve)].filter(n=>It.test(n)&&!Lt.test(n));return Object.freeze([...new Set(t)].sort())}var ce=wt();var vt=Object.freeze([\"rgb\",\"rgba\",\"hsl\",\"hsla\",\"hwb\",\"lab\",\"lch\",\"oklab\",\"oklch\",\"color\",\"color-mix\",\"calc\",\"min\",\"max\",\"clamp\",\"var\"]),kt=[...vt].sort((e,t)=>t.length-e.length).join(\"|\"),ke=new RegExp(`^(?:(?:${kt})\\\\(|[a-zA-Z-][a-zA-Z0-9-]*(?![a-zA-Z0-9(-])|[#0-9,.%/+\\\\s)])+$`);function Dt(e){let t=0;for(let n of e)if(n===\"(\")t+=1;else if(n===\")\"&&(t-=1,t<0))return!1;return t===0}function De(e,t,n){return e.length>0&&e.length<=t&&n.test(e)&&Dt(e)}var je=\"(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))\",jt=\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d(?:\\\\.\\\\d+)?(?:Z|([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d))\",J=new RegExp(`^${je}$`),Ue=new RegExp(`^${je}T(?:${jt})$`),Q=/^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,He=/^\\+?[0-9][0-9 ()-]{2,31}$/;var Fe=Object.freeze([\"https\",\"http\",\"mailto\"]),Ve=Object.freeze([\"https\"]),Ut=Object.freeze([\"https\",\"http\"]),Ht=\"[!#-&(-;=?-\\\\[\\\\]-_a-z{-~]\";function Ft(e){return e===\"mailto\"?\"mailto:\":`${e}://`}function $e(e){return new RegExp(`^(?:${e.map(Ft).join(\"|\")})${Ht}+$`)}var Fn=$e(Fe);function Vt(e){let t=globalThis.URL;if(t!==void 0)try{return new t(e)}catch{return}}var $t=new Set([\"subject\",\"body\"]),Bt=/%0[ad]/i;function zt(e){let t=e.indexOf(\"=\"),n=(t===-1?e:e.slice(0,t)).toLowerCase(),r=t===-1?\"\":e.slice(t+1);return!$t.has(n)||r.includes(\";\")?!1:n===\"body\"||!Bt.test(r)}function Kt(e){let t=e.slice(7);if(t.includes(\"#\"))return!1;let[n=\"\",r,...a]=t.split(\"?\");return a.length>0||!Q.test(n)?!1:r===void 0||r.split(\"&\").every(zt)}function Be(e,t){return!(e.slice(e.indexOf(\"://\")+3).split(/[/?#]/,1)[0]??\"\").includes(\"@\")&&t.username===\"\"&&t.password===\"\"}function Gt(e){return Fe.includes(e)}function ze(e,t){if(typeof e!=\"string\"||e.length>2048)return;let n=t.filter(Gt);if(n.length===0||!$e(n).test(e))return;let r=Vt(e);return r!==void 0&&n.some(a=>`${a}:`===r.protocol)?r:void 0}function Ke(e,t){let n=ze(e,t);return n===void 0?!1:n.protocol===\"mailto:\"?Kt(e):Be(e,n)}function Ge(e){let t=ze(e,Ut);return t!==void 0&&Be(e,t)}function y(e){return{ok:!0,value:e}}function l(e){return{ok:!1,problem:e}}function Wt(e,t){switch(t){case void 0:return!0;case\"email\":return Q.test(e);case\"url\":return Ge(e);case\"tel\":return He.test(e);case\"date\":return J.test(e);case\"date-time\":return Ue.test(e);default:return!1}}function Xt(e){return e.replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\"_\").length}function qt(e,t){if(typeof t!=\"string\")return l(\"wrong-type\");let n=e.maxLength??1e4,r=t.length>2*n?t.length:Xt(t);return r>n?l(\"too-long\"):r<(e.minLength??0)?l(\"too-short\"):Wt(t,e.format)?y(t):l(\"malformed\")}function Zt(e,t){return typeof t!=\"number\"||!Number.isFinite(t)?l(\"wrong-type\"):e.integer===!0&&!Number.isSafeInteger(t)?l(\"not-integer\"):e.min!==void 0&&t<e.min?l(\"below-min\"):e.max!==void 0&&t>e.max?l(\"above-max\"):y(t)}var Yt=/^[a-zA-Z][a-zA-Z0-9_]*$/;function Jt(e){return typeof e==\"object\"&&e!==null&&!Array.isArray(e)}function U(e,t){let n=65536,r=(a,o)=>{if((n-=typeof o==\"string\"?1+o.length:1)<0)return l(\"too-large\");switch(a.type){case\"string\":return qt(a,o);case\"number\":return Zt(a,o);case\"boolean\":return typeof o==\"boolean\"?y(o):l(\"wrong-type\");case\"enum\":return typeof o!=\"string\"?l(\"wrong-type\"):a.values.includes(o)?y(o):l(\"not-allowed\");case\"array\":{if(!Array.isArray(o))return l(\"wrong-type\");let i=o.length;if(typeof i!=\"number\")return l(\"wrong-type\");if(!(i<=(a.maxItems??1e3)))return l(\"too-long\");if(i<(a.minItems??0))return l(\"too-short\");let s=[];for(let _=0;_<i;_+=1){let p=r(a.items,o[_]);if(!p.ok)return p;s.push(p.value)}return y(s)}case\"object\":{if(!Jt(o))return l(\"wrong-type\");let i=new Set(a.required),s=[],_=Object.entries(a.fields);if((n-=_.length)<0)return l(\"too-large\");for(let[p,b]of _){if(!Yt.test(p))return l(\"not-allowed\");if(!Object.hasOwn(o,p)){if(i.has(p))return l(\"missing-field\");continue}let I=r(b,o[p]);if(!I.ok)return I;s.push([p,I.value])}return y(Object.fromEntries(s))}default:return l(\"not-allowed\")}};return r(e,t)}function Qt(e,t){let n=0,r=!1;for(let a=0;a<e.length;a+=1){let o=e.charCodeAt(a);if(r)o===92?a+=1:o===34&&(r=!1);else if(o===34)r=!0;else if(o===91||o===123){if(n+=1,n>t)return!0}else(o===93||o===125)&&(n-=1)}return!1}function ue(e,t,n){if(e.length>t)return l(\"too-long\");if(Qt(e,n))return l(\"too-deep\");try{return y(JSON.parse(e))}catch{return l(\"malformed\")}}var en=/^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/,We=2*g.enumValueMaxLength,Xe=(e,t)=>e.length>t?l(\"too-long\"):y(e);function qe(e,t){return e.ok?t(e.value):e}function Ze(e,t){return typeof e!=\"string\"?l(\"wrong-type\"):J.test(e)?t.min!==void 0&&e<t.min?l(\"below-min\"):t.max!==void 0&&e>t.max?l(\"above-max\"):y(e):l(\"malformed\")}var K=e=>e,Ye=g.valueSchemaDepth;function Qe(e){if(e===0)return 0;if(typeof e==\"object\"&&e!==null){let t=e;for(let n of Object.keys(t))t[n]=Qe(t[n])}return e}function de(e,t){let n=U(t,e);return n.ok?y(Qe(n.value)):n}function Je(e){let t=JSON.stringify(e);return t.length>g.propJsonMaxLength?null:t}var O=x({string:{type:\"string\",attribute:\"text\",reflect:!0,maxAttributeLength:e=>2*(e.maxLength??g.stringMaxLength),parse:(e,t)=>U(t,e),accept:(e,t)=>U(t,e),serialize:K},number:{type:\"number\",attribute:\"text\",reflect:!0,maxAttributeLength:()=>g.numberTextMaxLength,parse:(e,t)=>qe(Xe(e,g.numberTextMaxLength),n=>en.test(n)?O.number.accept(Number(n),t):l(\"malformed\")),accept:de,serialize:e=>String(e)},boolean:{type:\"boolean\",attribute:\"presence\",reflect:!0,maxAttributeLength:()=>Number.POSITIVE_INFINITY,parse:()=>y(!0),accept:e=>typeof e==\"boolean\"?y(e):l(\"wrong-type\"),serialize:e=>e?\"\":null},enum:{type:\"enum\",attribute:\"text\",reflect:!0,maxAttributeLength:()=>We,parse:(e,t)=>qe(Xe(e,We),n=>U(t,n)),accept:(e,t)=>U(t,e),serialize:K},color:{type:\"color\",attribute:\"text\",reflect:!0,maxAttributeLength:()=>g.colorMaxLength,parse:e=>O.color.accept(e,{type:\"color\"}),accept:e=>typeof e!=\"string\"?l(\"wrong-type\"):e.length>g.colorMaxLength?l(\"too-long\"):De(e,g.colorMaxLength,ke)?y(e):l(\"not-allowed\"),serialize:K},url:{type:\"url\",attribute:\"text\",reflect:!0,maxAttributeLength:()=>g.urlMaxLength,parse:(e,t)=>O.url.accept(e,t),accept:(e,t)=>typeof e!=\"string\"?l(\"wrong-type\"):e.length>g.urlMaxLength?l(\"too-long\"):Ke(e,t.protocols??Ve)?y(e):l(\"not-allowed\"),serialize:K},date:{type:\"date\",attribute:\"text\",reflect:!0,maxAttributeLength:()=>10,parse:(e,t)=>Ze(e,t),accept:Ze,serialize:K},array:{type:\"array\",attribute:\"json\",reflect:!1,maxAttributeLength:()=>g.propJsonMaxLength,parse:(e,t)=>{let n=ue(e,g.propJsonMaxLength,Ye);return n.ok?O.array.accept(n.value,t):n},accept:de,serialize:Je},object:{type:\"object\",attribute:\"json\",reflect:!1,maxAttributeLength:()=>g.propJsonMaxLength,parse:(e,t)=>{let n=ue(e,g.propJsonMaxLength,Ye);return n.ok?O.object.accept(n.value,t):n},accept:de,serialize:Je}});function et(e){if(Object.hasOwn(O,e.type))return O[e.type]}function pe(e,t){if(e.type===\"boolean\")return e.default??!1;try{let n=t.accept(e.default,e);if(n.ok)return n.value}catch{}return e.default}function ee(e,t,n){return{value:pe(e,t),problem:n}}var tt=Object.freeze({value:void 0,problem:\"not-allowed\"});function fe(e,t){let n=et(e);if(n===void 0)return tt;if(t===null)return{value:pe(e,n)};try{let r=n.parse(t,e);return r.ok?{value:r.value}:ee(e,n,r.problem)}catch{return ee(e,n,\"malformed\")}}function me(e,t){let n=et(e);if(n===void 0)return tt;if(t==null)return{value:pe(e,n)};try{let r=n.accept(t,e);return r.ok?{value:r.value}:ee(e,n,r.problem)}catch{return ee(e,n,\"malformed\")}}import{h as En}from\"taggor-preact.js\";import{h as tn,Fragment as G,options as N,isValidElement as nt}from\"taggor-preact.js\";var ge=\"__s\",F=\"__c\",Ee=\"__k\",Se=\"__d\",H=\"__s\",rt=/[\\s\\n\\\\/='\"\\0<>]/,ot=/^(xlink|xmlns|xml)([A-Z])/,nn=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,rn=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,on=new Set([\"draggable\",\"spellcheck\"]);function ut(e){e.__g!==void 0?e.__g|=8:e[Se]=!0}function an(e){e.__g!==void 0?e.__g&=-9:e[Se]=!1}function at(e){return e.__g!==void 0?!!(8&e.__g):e[Se]===!0}var sn=/[\"&<]/;function te(e){if(e.length===0||sn.test(e)===!1)return e;for(var t=0,n=0,r=\"\",a=\"\";n<e.length;n++){switch(e.charCodeAt(n)){case 34:a=\""\";break;case 38:a=\"&\";break;case 60:a=\"<\";break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=a,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var it={},ln=new Set([\"animation-iteration-count\",\"border-image-outset\",\"border-image-slice\",\"border-image-width\",\"box-flex\",\"box-flex-group\",\"box-ordinal-group\",\"column-count\",\"fill-opacity\",\"flex\",\"flex-grow\",\"flex-negative\",\"flex-order\",\"flex-positive\",\"flex-shrink\",\"flood-opacity\",\"font-weight\",\"grid-column\",\"grid-row\",\"line-clamp\",\"line-height\",\"opacity\",\"order\",\"orphans\",\"stop-opacity\",\"stroke-dasharray\",\"stroke-dashoffset\",\"stroke-miterlimit\",\"stroke-opacity\",\"stroke-width\",\"tab-size\",\"widows\",\"z-index\",\"zoom\"]),cn=/[A-Z]/g;function un(e){var t=\"\";for(var n in e){var r=e[n];if(r!=null&&r!==\"\"){var a=n[0]==\"-\"?n:it[n]||(it[n]=n.replace(cn,\"-$&\").toLowerCase()),o=\";\";typeof r!=\"number\"||a.startsWith(\"--\")||ln.has(a)||(o=\"px;\"),t=t+a+\":\"+r+o}}return t||void 0}function st(){this.__d=!0}function dn(e,t){return{__v:e,context:t,props:e.props,setState:st,forceUpdate:st,__d:!0,__h:new Array(0)}}var Ne={},lt=[],v=Array.isArray,Te=Object.assign,h=\"\",he=\"<!--$s-->\",_e=\"<!--/$s-->\";function ye(e){return typeof e==\"string\"?he+e+_e:v(e)?(e.unshift(he),e.push(_e),e):e&&typeof e.then==\"function\"?e.then(ye):he+e+_e}function pn(){return{beforeDiff:N.__b,afterDiff:N.diffed,renderHook:N.__r,unmountHook:N.unmount,rootHook:N.__,commitHook:N.__c,catchError:N.__e,errorBoundaries:N.errorBoundaries}}function ne(e){var t=N[ge];N[ge]=!0;try{return e()}finally{N[ge]=t}}function dt(e,t,n){var r=pn();try{var a=ne(function(){var o,i=tn(G,null);return i[Ee]=[e],r.rootHook&&r.rootHook(e,((o={})[Ee]=i,o.nodeType=1,o)),M(e,t||Ne,!1,void 0,i,!1,n,r)});return v(a)?a.join(h):a}catch(o){throw o.then?new Error('Use \"renderToStringAsync\" for suspenseful rendering.'):o}finally{r.commitHook&&ne(function(){return r.commitHook(e,lt)}),lt.length=0}}function ct(e,t,n){var r,a=e.type,o=!0;return e[F]?(o=!1,(r=e[F]).state=r[H]):r=new a(e.props,t),e[F]=r,r.__v=e,r.props=e.props,r.context=t,ut(r),r.state==null&&(r.state=Ne),r[H]==null&&(r[H]=r.state),a.getDerivedStateFromProps?r.state=Te({},r.state,a.getDerivedStateFromProps(r.props,r.state)):o&&r.componentWillMount?(r.componentWillMount(),r.state=r[H]!==r.state?r[H]:r.state):!o&&r.componentWillUpdate&&r.componentWillUpdate(),n.renderHook&&n.renderHook(e),r.render(r.props,r.state,t)}function M(e,t,n,r,a,o,i,s){if(e==null||e===!0||e===!1||e===h)return h;var _=typeof e;if(_!=\"object\")return _==\"function\"?h:_==\"string\"?te(e):e+h;if(v(e)){var p,b=h;a[Ee]=e;for(var I=e.length,V=0;V<I;V++){var $=e[V];if($!=null&&typeof $!=\"boolean\"){var d,R=M($,t,n,r,a,o,i,s);typeof R==\"string\"?b+=R:(p||(p=new Array(I)),b&&p.push(b),b=h,v(R)?(d=p).push.apply(d,R):p.push(R))}}return p?(b&&p.push(b),p):b}if(!nt(e))return h;e.__=a,s.beforeDiff&&s.beforeDiff(e);var m=e.type,E=e.props;if(typeof m==\"function\"){var re,c,T,W=t;if(m===G){if(\"tpl\"in E){for(var L,C=h,B=0;B<E.tpl.length;B++)if(C+=E.tpl[B],E.exprs&&B<E.exprs.length){var k=E.exprs[B];if(k==null)continue;if(typeof k==\"object\"&&(nt(k)||v(k))){var be,z=M(k,t,n,r,e,o,i,s);typeof z==\"string\"?C+=z:(L||(L=[]),C&&L.push(C),C=h,v(z)?(be=L).push.apply(be,z):L.push(z))}else C+=k}return L?(C&&L.push(C),L):C}if(\"UNSTABLE_comment\"in E)return\"<!--\"+te(E.UNSTABLE_comment)+\"-->\";c=E.children}else{if((re=m.contextType)!=null){var Ae=t[re.__c];W=Ae?Ae.props.value:re.__}var Oe=m.prototype&&typeof m.prototype.render==\"function\";if(Oe)c=ct(e,W,s),T=e[F];else{e[F]=T=dn(e,W);for(var yt=0;at(T)&&yt++<25;){an(T),s.renderHook&&s.renderHook(e);try{c=m.call(T,E,W)}catch(S){throw o&&S&&typeof S.then==\"function\"&&(e._suspended=!0),S}}ut(T)}if(T.getChildContext!=null&&(t=Te({},t,T.getChildContext())),Oe&&s.errorBoundaries&&(m.getDerivedStateFromError||T.componentDidCatch)){c=c!=null&&c.type===G&&c.key==null&&c.props.tpl==null?c.props.children:c;try{return M(c,t,n,r,e,o,!1,s)}catch(S){return m.getDerivedStateFromError&&(T[H]=m.getDerivedStateFromError(S)),T.componentDidCatch&&T.componentDidCatch(S,Ne),at(T)?(c=ct(e,t,s),(T=e[F]).getChildContext!=null&&(t=Te({},t,T.getChildContext())),M(c=c!=null&&c.type===G&&c.key==null&&c.props.tpl==null?c.props.children:c,t,n,r,e,o,i,s)):h}finally{s.afterDiff&&s.afterDiff(e),s.unmountHook&&s.unmountHook(e)}}}c=c!=null&&c.type===G&&c.key==null&&c.props.tpl==null?c.props.children:c;try{var Re=M(c,t,n,r,e,o,i,s);return s.afterDiff&&s.afterDiff(e),s.unmountHook&&s.unmountHook(e),e._suspended?ye(Re):Re}catch(S){if(!o&&i&&i.onError){var Ce=(function ie(X){return i.onError(X,e,function(D,St){try{return ne(function(){return M(D,t,n,r,St,o,i,s)})}catch(Nt){return ie(Nt)}})})(S);return Ce!==void 0?Ce:(s.catchError&&s.catchError(S,e),h)}if(!o||!S||typeof S.then!=\"function\")throw S;return S.then(function ie(){try{var X=ne(function(){return M(c,t,n,r,e,o,i,s)});return e._suspended?ye(X):X}catch(D){if(!D||typeof D.then!=\"function\")throw D;return D.then(ie)}})}}var P,w=\"<\"+m,A=h;for(var u in E){var f=E[u];if(typeof(f=mn(f)?f.value:f)!=\"function\"||u===\"class\"||u===\"className\"){switch(u){case\"children\":P=f;continue;case\"key\":case\"ref\":case\"__self\":case\"__source\":continue;case\"htmlFor\":if(\"for\"in E)continue;u=\"for\";break;case\"className\":if(\"class\"in E)continue;u=\"class\";break;case\"defaultChecked\":u=\"checked\";break;case\"defaultSelected\":u=\"selected\";break;case\"defaultValue\":case\"value\":switch(u=\"value\",m){case\"textarea\":P=f;continue;case\"select\":r=f;continue;case\"option\":r!=f||\"selected\"in E||(w+=\" selected\")}break;case\"dangerouslySetInnerHTML\":A=f&&f.__html;continue;case\"style\":typeof f==\"object\"&&(f=un(f));break;case\"acceptCharset\":u=\"accept-charset\";break;case\"httpEquiv\":u=\"http-equiv\";break;default:if(rt.test(u))continue;ot.test(u)?u=u.replace(ot,\"$1:$2\").toLowerCase():u[4]!==\"-\"&&!on.has(u)||f==null?n?rn.test(u)&&(u=u===\"panose1\"?\"panose-1\":u.replace(/([A-Z])/g,\"-$1\").toLowerCase()):nn.test(u)&&(u=u.toLowerCase()):f+=h}f!=null&&f!==!1&&(w=f===!0||f===h?w+\" \"+u:w+\" \"+u+'=\"'+te(f+h)+'\"')}}if(rt.test(m))throw new Error(m+\" is not a valid HTML tag name in \"+w+\">\");if(A||(typeof P==\"string\"?A=te(P):P!=null&&P!==!1&&P!==!0&&(A=M(P,t,m===\"svg\"||m!==\"foreignObject\"&&n,r,e,o,i,s))),s.afterDiff&&s.afterDiff(e),s.unmountHook&&s.unmountHook(e),!A&&fn.has(m))return w+\"/>\";var oe=\"</\"+m+\">\",ae=w+\">\";return v(A)?[ae].concat(A,[oe]):typeof A!=\"string\"?[ae,A,oe]:ae+A+oe}var fn=new Set([\"area\",\"base\",\"br\",\"col\",\"command\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"]);function mn(e){return e!==null&&typeof e==\"object\"&&typeof e.peek==\"function\"&&\"value\"in e}function gn(e){if(typeof e!=\"object\"||e===null)return!1;let t=e.type;return typeof t==\"string\"&&Object.hasOwn(O,t)}function pt(e,t=()=>!1,n){let r=e.props??{},a=[],o=[];for(let i of Object.keys(r)){let s=r[i];!t(i)&&gn(s)?a.push(Object.freeze({prop:i,attribute:le(i),declaration:{...s,default:me(s,n?.[i]).value}})):o.push(i)}return Object.freeze({bindings:Object.freeze(a),unknown:Object.freeze(o)})}var hn=()=>!0;function _n(e,t,n,r){return!(\"problem\"in t)&&n&&e.declaration.type===\"color\"&&!r(t.value)?{value:e.declaration.default,problem:\"not-allowed\"}:t}function ft(e,t,n=hn){let r=[],a=e.map(o=>{let i=t(o.attribute),{value:s,problem:_}=_n(o,fe(o.declaration,i),i!==null,n);return _!==void 0&&i!==null&&r.push(Object.freeze({prop:o.prop,attribute:o.attribute,problem:_,text:i})),[o.prop,s]});return Object.freeze({props:Object.freeze(Object.fromEntries(a)),problems:Object.freeze(r)})}var mt=\"0000-01-01\";function gt(e,t,n=j){try{return Z(e,{consumer:\"runtime\",today:t??mt},n)}catch{return Z(e,{consumer:\"runtime\",today:mt},n)}}var ht=\":host{display:block;contain:content}:host([hidden]){display:none}\";var _t=\"taggor.component\";var Et=\"ssr\",Tn=Object.freeze([\"locale\",\"lang\",\"id\",\"class\"]),yn=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/,Sn=/^[A-Za-z0-9._:-]{1,128}$/,Nn=e=>e.replaceAll(\"&\",\"&\").replaceAll('\"',\""\").replaceAll(\"<\",\"<\").replaceAll(\">\",\">\"),bn=e=>e.replace(/<\\/(?=style)/gi,\"<\\\\/\");function An(e){if(typeof e!=\"object\"||e===null)return!1;let t=e,n=t.manifest;return t.kind===_t&&typeof t.component==\"function\"&&Array.isArray(t.styles)&&t.styles.every(r=>typeof r==\"string\")&&typeof n==\"object\"&&n!==null&&typeof n.tag==\"string\"&&yn.test(n.tag)&&typeof n.name==\"string\"&&(n.props===void 0||typeof n.props==\"object\"&&n.props!==null)}function On(e,t){let n=i=>Object.hasOwn(t,i)?t[i]??null:null,r=()=>{},a={localName:e,tagName:e.toUpperCase(),isConnected:!0,childNodes:[],ownerDocument:{},getAttribute:n,hasAttribute:i=>n(i)!==null,closest:i=>i===\"[lang]\"&&n(\"lang\")!==null?a:null,addEventListener:r,removeEventListener:r,dispatchEvent:()=>!0};return Object.freeze({element:a,shadowRoot:{host:a,addEventListener:r,removeEventListener:r,querySelector:()=>null,querySelectorAll:()=>[]},emit:r,signal:void 0,internals:void 0,transport:void 0})}function Tt(e,t){try{if(!An(e))return{ok:!1,reason:\"invalid-definition\"};if(!Sn.test(t.version))return{ok:!1,reason:\"invalid-version\"};let{manifest:n}=e;if(!gt(t.contractVersion??n.contractVersion,t.servedOn).usable)return{ok:!1,reason:\"unsupported-contract\"};let a=Y,{bindings:o}=pt(n,d=>ce.includes(d)||a.includes(d),t.siteDefaults);if(o.some(d=>d.attribute===Et))return{ok:!1,reason:\"stamp-collision\"};let i=t.attributes,s=d=>Object.hasOwn(i,d)?i[d]??null:null,{props:_}=ft(o,s),p;try{p=dt(En(e.component,{host:On(n.tag,i),props:x({..._})}))}catch{return{ok:!1,reason:\"render-failed\"}}let I=[...o.map(d=>d.attribute),...Tn.filter(d=>!o.some(R=>R.attribute===d))].map(d=>[d,s(d)]).filter(d=>typeof d[1]==\"string\").map(([d,R])=>` ${d}=\"${Nn(R)}\"`).join(\"\"),V=typeof n.delegatesFocus==\"boolean\"?n.delegatesFocus:n.formAssociated===!0,$=[ht,...e.styles].map(d=>`<style>${bn(d)}</style>`).join(\"\");return{ok:!0,html:`<${n.tag}${I} ${Et}=\"${t.version}\"><template shadowrootmode=\"open\"${V?\" shadowrootdelegatesfocus\":\"\"}>${$}${p}</template></${n.tag}>`}}catch{return{ok:!1,reason:\"invalid-definition\"}}}function Rn(e){let t=globalThis;t.document={documentElement:{lang:e}};try{Object.defineProperty(t.navigator??(t.navigator={}),\"language\",{value:void 0,configurable:!0})}catch{}}function Cn(e){if(typeof e!=\"object\"||e===null)return!1;let{attributes:t,version:n,lang:r}=e;return typeof n==\"string\"&&typeof t==\"object\"&&t!==null&&Object.values(t).every(a=>typeof a==\"string\")&&(r===void 0||typeof r==\"string\")}function Mr(e){return{fetch:async t=>{let n={ok:!1,reason:\"invalid-definition\"};try{let r=await t.json();Cn(r)&&(Rn(r.lang??\"\"),n=Tt(e,r))}catch{}return Response.json(n)}}}export{Mr as createRenderWorker};";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entry of the isolated render Worker (SSR spike, ADR 0066): the code the edge loads next to
|
|
3
|
+
* one published component bundle, in a Worker with no bindings and no network.
|
|
4
|
+
*
|
|
5
|
+
* `scripts/build-ssr.ts` bundles this file (with `render-fragment.ts`, the contract's zod-free
|
|
6
|
+
* part and `preact-render-to-string`) into one ES module exported as text, `SSR_WORKER_CODE` of
|
|
7
|
+
* `@taggor/runtime/ssr-code`; Preact stays an import of `SSR_PREACT_MODULE`, which the edge points
|
|
8
|
+
* at the same Preact file the component bundle imports, so both use one copy. The edge writes the
|
|
9
|
+
* few lines of the main module itself: it imports the bundle's default export and calls
|
|
10
|
+
* `createRenderWorker` with it.
|
|
11
|
+
*
|
|
12
|
+
* The request and the answer are JSON over the Worker's `fetch`, the one call the edge makes.
|
|
13
|
+
*/
|
|
14
|
+
import { type FragmentRequest } from "./render-fragment.js";
|
|
15
|
+
/** What the edge sends: a `FragmentRequest` plus, optionally, the language of the page. */
|
|
16
|
+
export interface RenderWorkerRequest extends FragmentRequest {
|
|
17
|
+
/**
|
|
18
|
+
* The page's `<html lang>`. The edge does NOT send it today (the route only knows the query,
|
|
19
|
+
* review finding 19, TAG-635), so `document.documentElement.lang` is empty in a render and the
|
|
20
|
+
* language comes from the element's own `locale` and `lang` attributes, which are in
|
|
21
|
+
* `attributes` and which the SDK reads first. The field stays for a caller that has the page
|
|
22
|
+
* language; nothing else relies on it.
|
|
23
|
+
*/
|
|
24
|
+
readonly lang?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Makes the render Worker of one component definition.
|
|
28
|
+
*
|
|
29
|
+
* Inputs: the default export of the component bundle (any value). Output: a Worker handler whose
|
|
30
|
+
* `fetch` reads a `RenderWorkerRequest` as JSON and answers a `FragmentResult` as JSON, always
|
|
31
|
+
* with status 200 (a body that is not a request is `invalid-definition`). Errors: never throws.
|
|
32
|
+
* Side effects: per call, the globals of `installRenderGlobals` and one render of the component.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createRenderWorker(definition: unknown): {
|
|
35
|
+
fetch: (request: Request) => Promise<Response>;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/server/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,sBAAsB,CAAC;AAE9B,2FAA2F;AAC3F,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAkCD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,OAAO,GAAG;IACvD,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAChD,CAgBA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entry of the isolated render Worker (SSR spike, ADR 0066): the code the edge loads next to
|
|
3
|
+
* one published component bundle, in a Worker with no bindings and no network.
|
|
4
|
+
*
|
|
5
|
+
* `scripts/build-ssr.ts` bundles this file (with `render-fragment.ts`, the contract's zod-free
|
|
6
|
+
* part and `preact-render-to-string`) into one ES module exported as text, `SSR_WORKER_CODE` of
|
|
7
|
+
* `@taggor/runtime/ssr-code`; Preact stays an import of `SSR_PREACT_MODULE`, which the edge points
|
|
8
|
+
* at the same Preact file the component bundle imports, so both use one copy. The edge writes the
|
|
9
|
+
* few lines of the main module itself: it imports the bundle's default export and calls
|
|
10
|
+
* `createRenderWorker` with it.
|
|
11
|
+
*
|
|
12
|
+
* The request and the answer are JSON over the Worker's `fetch`, the one call the edge makes.
|
|
13
|
+
*/
|
|
14
|
+
import { renderComponentFragment, } from "./render-fragment.js";
|
|
15
|
+
/**
|
|
16
|
+
* Sets the two globals the SDK reads while rendering (`localeCandidates` of `@taggor/component`):
|
|
17
|
+
* `document.documentElement.lang`, the page language the request gave (empty when it gave none,
|
|
18
|
+
* which is every request of the edge today), and `navigator.language`,
|
|
19
|
+
* emptied because the Worker's own value says nothing about the visitor (the component then uses
|
|
20
|
+
* its declared default, and the browser corrects it if the visitor's language differs).
|
|
21
|
+
*/
|
|
22
|
+
function installRenderGlobals(lang) {
|
|
23
|
+
const globals = globalThis;
|
|
24
|
+
globals["document"] = { documentElement: { lang } };
|
|
25
|
+
try {
|
|
26
|
+
Object.defineProperty(globals["navigator"] ?? (globals["navigator"] = {}), "language", {
|
|
27
|
+
value: undefined,
|
|
28
|
+
configurable: true,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// A navigator that cannot be changed: the language may differ from the page's, never unsafe.
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function isRequest(value) {
|
|
36
|
+
if (typeof value !== "object" || value === null)
|
|
37
|
+
return false;
|
|
38
|
+
const { attributes, version, lang } = value;
|
|
39
|
+
return (typeof version === "string" &&
|
|
40
|
+
typeof attributes === "object" &&
|
|
41
|
+
attributes !== null &&
|
|
42
|
+
Object.values(attributes).every((text) => typeof text === "string") &&
|
|
43
|
+
(lang === undefined || typeof lang === "string"));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Makes the render Worker of one component definition.
|
|
47
|
+
*
|
|
48
|
+
* Inputs: the default export of the component bundle (any value). Output: a Worker handler whose
|
|
49
|
+
* `fetch` reads a `RenderWorkerRequest` as JSON and answers a `FragmentResult` as JSON, always
|
|
50
|
+
* with status 200 (a body that is not a request is `invalid-definition`). Errors: never throws.
|
|
51
|
+
* Side effects: per call, the globals of `installRenderGlobals` and one render of the component.
|
|
52
|
+
*/
|
|
53
|
+
export function createRenderWorker(definition) {
|
|
54
|
+
return {
|
|
55
|
+
fetch: async (request) => {
|
|
56
|
+
let result = { ok: false, reason: "invalid-definition" };
|
|
57
|
+
try {
|
|
58
|
+
const input = await request.json();
|
|
59
|
+
if (isRequest(input)) {
|
|
60
|
+
installRenderGlobals(input.lang ?? "");
|
|
61
|
+
result = renderComponentFragment(definition, input);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// Not JSON: answered as refused.
|
|
66
|
+
}
|
|
67
|
+
return Response.json(result);
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/server/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,uBAAuB,GAGxB,MAAM,sBAAsB,CAAC;AAc9B;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,IAAY;IACxC,MAAM,OAAO,GAAG,UAAqC,CAAC;IACtD,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;I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