@context-action/lit-ui 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,18 @@
1
+ import { LitElement } from "lit";
2
+ import "@lit-labs/ssr-client/lit-element-hydrate-support.js";
3
+ /**
4
+ * Hydrates server-produced markup on the client.
5
+ *
6
+ * Supported modes:
7
+ * 1. `root` is an element's own shadow root (or contains the Lit template
8
+ * markers produced by `renderLitTemplate`): the element's current template is
9
+ * hydrated into that root, preserving existing DOM and attaching event parts.
10
+ * 2. `root` contains a server-rendered custom element host for the same tag:
11
+ * the host is upgraded so its controllers and attributes connect.
12
+ * 3. `root` is empty: the element is mounted and rendered normally.
13
+ *
14
+ * The function never reads a global `document`; it operates only on the supplied
15
+ * root and element.
16
+ */
17
+ export declare function hydrateLit(root: Element | ShadowRoot, element: LitElement): void;
18
+ //# sourceMappingURL=hydrate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydrate.d.ts","names":[],"sources":["../src/hydrate.ts"],"mappings":";;;;;;;;;;;;;;;;wBAsRgB,WAAW,MAAM,UAAU,YAAY,SAAS"}
@@ -0,0 +1,206 @@
1
+ import { LitElement } from "lit";
2
+ import "@lit-labs/ssr-client/lit-element-hydrate-support.js";
3
+ import { hydrate } from "@lit-labs/ssr-client";
4
+ // src/hydrate.ts
5
+ const COMMENT_NODE = 8;
6
+ const DOCUMENT_FRAGMENT_NODE = 11;
7
+ function hasLitPartMarker(root) {
8
+ const document = root.ownerDocument ?? root.host?.ownerDocument ?? null;
9
+ if (document && typeof document.createTreeWalker === "function") {
10
+ const walker = document.createTreeWalker(root, 128);
11
+ while (walker.nextNode()) if (walker.currentNode.data.startsWith("lit-part")) return true;
12
+ return false;
13
+ }
14
+ for (let node = root.firstChild; node; node = node.nextSibling) {
15
+ if (node.nodeType === COMMENT_NODE && node.data.startsWith("lit-part")) return true;
16
+ if (node.nodeType === 1 && hasLitPartMarker(node)) return true;
17
+ }
18
+ return false;
19
+ }
20
+ function findServerHost(root, element) {
21
+ const tagName = element.localName;
22
+ if (!tagName) return null;
23
+ if (root.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in root && root.host === element) return null;
24
+ if (root.nodeType === 1 && root.localName === tagName) return root;
25
+ return root.querySelector?.(tagName) ?? null;
26
+ }
27
+ function isHydrationSupportInstalled() {
28
+ const shadow = {};
29
+ const probe = { shadowRoot: shadow };
30
+ const createRenderRoot = LitElement.prototype.createRenderRoot;
31
+ try {
32
+ return createRenderRoot.call(probe) === shadow;
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
37
+ function partStartNode(part) {
38
+ return part?._$startNode ?? part?._$AA ?? null;
39
+ }
40
+ function isServerRootPart(part) {
41
+ const start = partStartNode(part);
42
+ return start?.nodeType === COMMENT_NODE && start.data.startsWith("lit-part");
43
+ }
44
+ /**
45
+ * When a client render appended a separate tree beside the server DSD tree,
46
+ * keep only the server root part (plus preceding static style tags), remove the
47
+ * client anchors/children, and re-adopt the surviving server tree.
48
+ */
49
+ function isolateServerTree(shadow) {
50
+ const children = Array.from(shadow.childNodes);
51
+ const rootIndex = children.findIndex((node) => node.nodeType === COMMENT_NODE && node.data.startsWith("lit-part"));
52
+ if (rootIndex < 0) return false;
53
+ let beginIndex = rootIndex;
54
+ while (beginIndex > 0) {
55
+ const previous = children[beginIndex - 1];
56
+ if (previous.nodeType === 1 && previous.localName === "style") {
57
+ beginIndex -= 1;
58
+ continue;
59
+ }
60
+ break;
61
+ }
62
+ let depth = 0;
63
+ let endIndex = -1;
64
+ for (let index = rootIndex; index < children.length; index += 1) {
65
+ const node = children[index];
66
+ if (node.nodeType !== COMMENT_NODE) continue;
67
+ const data = node.data;
68
+ if (data.startsWith("lit-part")) depth += 1;
69
+ else if (data.startsWith("/lit-part")) {
70
+ depth -= 1;
71
+ if (depth === 0) {
72
+ endIndex = index;
73
+ break;
74
+ }
75
+ }
76
+ }
77
+ if (endIndex < 0) return false;
78
+ for (let index = children.length - 1; index > endIndex; index -= 1) children[index].parentNode?.removeChild(children[index]);
79
+ for (let index = 0; index < beginIndex; index += 1) children[index].parentNode?.removeChild(children[index]);
80
+ return true;
81
+ }
82
+ function adoptServerShadow(host, shadow) {
83
+ host._$needsHydration = false;
84
+ host._$AG = false;
85
+ if (isolateServerTree(shadow)) {
86
+ delete shadow._$litPart$;
87
+ try {
88
+ const rendered = host.render();
89
+ hydrate(rendered, shadow);
90
+ host.requestUpdate();
91
+ return;
92
+ } catch {}
93
+ }
94
+ shadow.replaceChildren();
95
+ delete shadow._$litPart$;
96
+ host.requestUpdate();
97
+ }
98
+ function hydrateHost(host) {
99
+ const shadow = host.shadowRoot;
100
+ if (!shadow) {
101
+ host.requestUpdate();
102
+ return;
103
+ }
104
+ const hydrationSupportInstalled = isHydrationSupportInstalled();
105
+ if (!hydrationSupportInstalled) Object.defineProperty(host, "createRenderRoot", {
106
+ configurable: true,
107
+ value: () => shadow
108
+ });
109
+ const livePart = shadow._$litPart$;
110
+ if (livePart !== void 0) {
111
+ if (hasLitPartMarker(shadow) && !isServerRootPart(livePart)) {
112
+ adoptServerShadow(host, shadow);
113
+ return;
114
+ }
115
+ host.requestUpdate();
116
+ return;
117
+ }
118
+ if (!hasLitPartMarker(shadow)) {
119
+ shadow.replaceChildren();
120
+ host.requestUpdate();
121
+ return;
122
+ }
123
+ if (hydrationSupportInstalled) {
124
+ host.requestUpdate();
125
+ return;
126
+ }
127
+ const rendered = host.render();
128
+ hydrate(rendered, shadow);
129
+ host.requestUpdate();
130
+ }
131
+ function upgradeServerHost(host, element) {
132
+ const tagName = element.localName;
133
+ const registry = globalThis.customElements;
134
+ if (!registry) throw new Error("hydrateLit() requires a DOM environment with customElements.");
135
+ if (!registry.get(tagName)) registry.define(tagName, element.constructor);
136
+ const existingShadow = host.shadowRoot;
137
+ if (existingShadow && !isHydrationSupportInstalled()) Object.defineProperty(host, "createRenderRoot", {
138
+ configurable: true,
139
+ value: () => existingShadow
140
+ });
141
+ const elementConstructor = element.constructor;
142
+ if (host instanceof elementConstructor) {
143
+ hydrateHost(host);
144
+ return;
145
+ }
146
+ registry.upgrade(host);
147
+ if (host instanceof elementConstructor) hydrateHost(host);
148
+ }
149
+ /**
150
+ * Hydrates server-produced markup on the client.
151
+ *
152
+ * Supported modes:
153
+ * 1. `root` is an element's own shadow root (or contains the Lit template
154
+ * markers produced by `renderLitTemplate`): the element's current template is
155
+ * hydrated into that root, preserving existing DOM and attaching event parts.
156
+ * 2. `root` contains a server-rendered custom element host for the same tag:
157
+ * the host is upgraded so its controllers and attributes connect.
158
+ * 3. `root` is empty: the element is mounted and rendered normally.
159
+ *
160
+ * The function never reads a global `document`; it operates only on the supplied
161
+ * root and element.
162
+ */
163
+ function hydrateLit(root, element) {
164
+ if (!root || typeof root !== "object") throw new TypeError("hydrateLit() requires an Element or ShadowRoot.");
165
+ if (!element || typeof element !== "object") throw new TypeError("hydrateLit() requires a LitElement instance.");
166
+ const serverHost = findServerHost(root, element);
167
+ if (serverHost && serverHost !== element) {
168
+ upgradeServerHost(serverHost, element);
169
+ return;
170
+ }
171
+ if (root.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in root && root.host === element) {
172
+ const shadow = root;
173
+ const livePart = shadow._$litPart$;
174
+ if (livePart === void 0) {
175
+ Object.defineProperty(element, "createRenderRoot", {
176
+ configurable: true,
177
+ value: () => shadow
178
+ });
179
+ if (hasLitPartMarker(shadow)) {
180
+ const rendered = element.render();
181
+ hydrate(rendered, shadow);
182
+ } else shadow.replaceChildren();
183
+ } else if (hasLitPartMarker(shadow) && !isServerRootPart(livePart)) {
184
+ adoptServerShadow(element, shadow);
185
+ return;
186
+ }
187
+ element._$needsHydration = false;
188
+ element._$AG = false;
189
+ element.requestUpdate();
190
+ return;
191
+ }
192
+ if (hasLitPartMarker(root)) {
193
+ if (root._$litPart$ !== void 0) {
194
+ element.requestUpdate();
195
+ return;
196
+ }
197
+ const rendered = element.render();
198
+ hydrate(rendered, root);
199
+ return;
200
+ }
201
+ if (root !== element && !element.isConnected) root.append(element);
202
+ element.requestUpdate();
203
+ }
204
+ export { hydrateLit };
205
+
206
+ //# sourceMappingURL=hydrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydrate.js","names":[],"sources":["../src/hydrate.ts"],"sourcesContent":["/**\n * @fileoverview Client-only hydration entry (`@context-action/lit-ui/hydrate`).\n *\n * This module intentionally imports only `@lit-labs/ssr-client` and the Lit\n * runtime, never the server renderer. Client bundles that only need\n * `hydrateLit()` can avoid pulling `@lit-labs/ssr` into the browser graph.\n *\n * @implements view-layer\n * @implements web-component-primitive\n * @memberof core-concepts\n */\n\nimport '@lit-labs/ssr-client/lit-element-hydrate-support.js';\nimport { LitElement } from 'lit';\nimport { hydrate } from '@lit-labs/ssr-client';\n\nconst COMMENT_NODE = 8;\nconst DOCUMENT_FRAGMENT_NODE = 11;\n\nfunction hasLitPartMarker(root: Element | ShadowRoot): boolean {\n const document = root.ownerDocument\n ?? (root as ShadowRoot).host?.ownerDocument\n ?? null;\n if (document && typeof document.createTreeWalker === 'function') {\n const walker = document.createTreeWalker(root, 128 /* NodeFilter.SHOW_COMMENT */);\n while (walker.nextNode()) {\n if ((walker.currentNode as Comment).data.startsWith('lit-part')) {\n return true;\n }\n }\n return false;\n }\n\n // Defensive fallback for environments without TreeWalker.\n for (let node = root.firstChild; node; node = node.nextSibling) {\n if (\n node.nodeType === COMMENT_NODE &&\n (node as Comment).data.startsWith('lit-part')\n ) {\n return true;\n }\n if (node.nodeType === 1 && hasLitPartMarker(node as Element)) {\n return true;\n }\n }\n return false;\n}\n\nfunction findServerHost(\n root: Element | ShadowRoot,\n element: LitElement,\n): Element | null {\n const tagName = element.localName;\n if (!tagName) return null;\n\n // A ShadowRoot owned by the element is a render target, not a host container.\n if (\n root.nodeType === DOCUMENT_FRAGMENT_NODE &&\n 'host' in root &&\n root.host === element\n ) {\n return null;\n }\n\n if (root.nodeType === 1 && (root as Element).localName === tagName) {\n return root as Element;\n }\n\n return root.querySelector?.(tagName) ?? null;\n}\n\nfunction isHydrationSupportInstalled(): boolean {\n const shadow = {};\n const probe = { shadowRoot: shadow } as unknown as LitElement;\n const createRenderRoot = (\n LitElement.prototype as unknown as {\n createRenderRoot(this: LitElement): unknown;\n }\n ).createRenderRoot;\n try {\n return createRenderRoot.call(probe) === shadow;\n } catch {\n return false;\n }\n}\n\ninterface LitPartLike {\n _$startNode?: Node | null;\n _$endNode?: Node | null;\n _$AA?: Node | null;\n _$AB?: Node | null;\n}\n\nfunction partStartNode(part: LitPartLike | undefined): Node | null {\n return part?._$startNode ?? part?._$AA ?? null;\n}\n\nfunction partEndNode(part: LitPartLike | undefined): Node | null {\n return part?._$endNode ?? part?._$AB ?? null;\n}\n\nfunction isServerRootPart(part: LitPartLike | undefined): boolean {\n const start = partStartNode(part);\n return (\n start?.nodeType === COMMENT_NODE &&\n (start as Comment).data.startsWith('lit-part')\n );\n}\n\n/**\n * When a client render appended a separate tree beside the server DSD tree,\n * keep only the server root part (plus preceding static style tags), remove the\n * client anchors/children, and re-adopt the surviving server tree.\n */\nfunction isolateServerTree(shadow: ShadowRoot): boolean {\n const children = Array.from(shadow.childNodes);\n const rootIndex = children.findIndex(\n node => node.nodeType === COMMENT_NODE && (node as Comment).data.startsWith('lit-part'),\n );\n if (rootIndex < 0) return false;\n\n let beginIndex = rootIndex;\n while (beginIndex > 0) {\n const previous = children[beginIndex - 1]!;\n if (previous.nodeType === 1 && (previous as Element).localName === 'style') {\n beginIndex -= 1;\n continue;\n }\n break;\n }\n\n let depth = 0;\n let endIndex = -1;\n for (let index = rootIndex; index < children.length; index += 1) {\n const node = children[index]!;\n if (node.nodeType !== COMMENT_NODE) continue;\n const data = (node as Comment).data;\n if (data.startsWith('lit-part')) {\n depth += 1;\n } else if (data.startsWith('/lit-part')) {\n depth -= 1;\n if (depth === 0) {\n endIndex = index;\n break;\n }\n }\n }\n if (endIndex < 0) return false;\n\n for (let index = children.length - 1; index > endIndex; index -= 1) {\n children[index]!.parentNode?.removeChild(children[index]!);\n }\n for (let index = 0; index < beginIndex; index += 1) {\n children[index]!.parentNode?.removeChild(children[index]!);\n }\n return true;\n}\n\nfunction adoptServerShadow(host: LitElement, shadow: ShadowRoot): void {\n // Clear Lit hydration support flags so the following requestUpdate does not\n // adopt the same tree a second time.\n (host as unknown as { _$needsHydration?: boolean })._$needsHydration = false;\n (host as unknown as { _$AG?: boolean })._$AG = false;\n\n if (isolateServerTree(shadow)) {\n delete (shadow as ShadowRoot & { _$litPart$?: unknown })._$litPart$;\n try {\n const rendered = (host as unknown as { render(): unknown }).render();\n hydrate(rendered, shadow);\n host.requestUpdate();\n return;\n } catch {\n // Fall through to a clean client render when the server tree cannot be\n // adopted (for example after an incompatible template change).\n }\n }\n\n shadow.replaceChildren();\n delete (shadow as ShadowRoot & { _$litPart$?: unknown })._$litPart$;\n host.requestUpdate();\n}\n\nfunction hydrateHost(host: LitElement): void {\n const shadow = host.shadowRoot;\n if (!shadow) {\n host.requestUpdate();\n return;\n }\n\n const hydrationSupportInstalled = isHydrationSupportInstalled();\n if (!hydrationSupportInstalled) {\n Object.defineProperty(host, 'createRenderRoot', {\n configurable: true,\n value: () => shadow,\n });\n }\n\n const livePart = (shadow as ShadowRoot & { _$litPart$?: LitPartLike })._$litPart$;\n if (livePart !== undefined) {\n if (hasLitPartMarker(shadow) && !isServerRootPart(livePart)) {\n adoptServerShadow(host, shadow);\n return;\n }\n host.requestUpdate();\n return;\n }\n\n if (!hasLitPartMarker(shadow)) {\n // Server markup without lit-html markers cannot be hydrated. Clear it and\n // force the first client render into this shadow root without asking Lit's\n // hydration support to adopt a non-lit tree.\n shadow.replaceChildren();\n host.requestUpdate();\n return;\n }\n\n // Lit's official hydration support patches createRenderRoot/update and\n // adopts the declarative shadow root on the first update. Running hydrate()\n // ourselves would make support hydrate the same container twice.\n if (hydrationSupportInstalled) {\n host.requestUpdate();\n return;\n }\n\n const rendered = (host as unknown as { render(): unknown }).render();\n hydrate(rendered, shadow);\n host.requestUpdate();\n}\n\nfunction upgradeServerHost(host: Element, element: LitElement): void {\n const tagName = element.localName;\n const registry = globalThis.customElements;\n if (!registry) {\n throw new Error('hydrateLit() requires a DOM environment with customElements.');\n }\n\n if (!registry.get(tagName)) {\n registry.define(tagName, element.constructor as CustomElementConstructor);\n }\n\n // A declarative shadow root already contains the server template. When Lit's\n // hydration support is not installed, prevent the first update from calling\n // attachShadow() on the same host. When support is installed, its patched\n // createRenderRoot already does this and must remain in control.\n const existingShadow = host.shadowRoot;\n if (existingShadow && !isHydrationSupportInstalled()) {\n Object.defineProperty(host, 'createRenderRoot', {\n configurable: true,\n value: () => existingShadow,\n });\n }\n\n const elementConstructor = element.constructor as unknown as { new (): LitElement };\n if (host instanceof elementConstructor) {\n hydrateHost(host);\n return;\n }\n\n registry.upgrade(host);\n if (host instanceof elementConstructor) {\n hydrateHost(host);\n }\n}\n\n/**\n * Hydrates server-produced markup on the client.\n *\n * Supported modes:\n * 1. `root` is an element's own shadow root (or contains the Lit template\n * markers produced by `renderLitTemplate`): the element's current template is\n * hydrated into that root, preserving existing DOM and attaching event parts.\n * 2. `root` contains a server-rendered custom element host for the same tag:\n * the host is upgraded so its controllers and attributes connect.\n * 3. `root` is empty: the element is mounted and rendered normally.\n *\n * The function never reads a global `document`; it operates only on the supplied\n * root and element.\n */\nexport function hydrateLit(root: Element | ShadowRoot, element: LitElement): void {\n if (!root || typeof root !== 'object') {\n throw new TypeError('hydrateLit() requires an Element or ShadowRoot.');\n }\n if (!element || typeof element !== 'object') {\n throw new TypeError('hydrateLit() requires a LitElement instance.');\n }\n\n const serverHost = findServerHost(root, element);\n if (serverHost && serverHost !== element) {\n upgradeServerHost(serverHost, element);\n return;\n }\n\n // The element's own shadow root is managed by its Lit update lifecycle.\n // Hydrate it explicitly and bypass the support flag so the first update does\n // not adopt the same container a second time.\n if (\n root.nodeType === DOCUMENT_FRAGMENT_NODE &&\n 'host' in root &&\n root.host === element\n ) {\n const shadow = root as ShadowRoot;\n const livePart = (shadow as ShadowRoot & { _$litPart$?: LitPartLike })._$litPart$;\n if (livePart === undefined) {\n Object.defineProperty(element, 'createRenderRoot', {\n configurable: true,\n value: () => shadow,\n });\n if (hasLitPartMarker(shadow)) {\n const rendered = (element as unknown as { render(): unknown }).render();\n hydrate(rendered, shadow);\n } else {\n shadow.replaceChildren();\n }\n } else if (hasLitPartMarker(shadow) && !isServerRootPart(livePart)) {\n adoptServerShadow(element, shadow);\n return;\n }\n // Support uses `_$needsHydration` in development and a minified field in\n // production. Clearing both is harmless when support is absent.\n (element as unknown as { _$needsHydration?: boolean })._$needsHydration = false;\n (element as unknown as { _$AG?: boolean })._$AG = false;\n element.requestUpdate();\n return;\n }\n\n if (hasLitPartMarker(root)) {\n const livePart = (root as ShadowRoot & { _$litPart$?: unknown })._$litPart$;\n if (livePart !== undefined) {\n element.requestUpdate();\n return;\n }\n const rendered = (element as unknown as { render(): unknown }).render();\n hydrate(rendered, root);\n return;\n }\n\n if (root !== element && !element.isConnected) {\n root.append(element);\n }\n element.requestUpdate();\n}\n"],"mappings":";;;;AAgBA,MAAM,eAAe;AACrB,MAAM,yBAAyB;AAE/B,SAAS,iBAAiB,MAAqC;CAC7D,MAAM,WAAW,KAAK,iBAChB,KAAoB,MAAM,iBAC3B;CACL,IAAI,YAAY,OAAO,SAAS,qBAAqB,YAAY;EAC/D,MAAM,SAAS,SAAS,iBAAiB,MAAM,GAAiC;EAChF,OAAO,OAAO,SAAS,GACrB,IAAK,OAAO,YAAwB,KAAK,WAAW,UAAU,GAC5D,OAAO;EAGX,OAAO;CACT;CAGA,KAAK,IAAI,OAAO,KAAK,YAAY,MAAM,OAAO,KAAK,aAAa;EAC9D,IACE,KAAK,aAAa,gBACjB,KAAiB,KAAK,WAAW,UAAU,GAE5C,OAAO;EAET,IAAI,KAAK,aAAa,KAAK,iBAAiB,IAAe,GACzD,OAAO;CAEX;CACA,OAAO;AACT;AAEA,SAAS,eACP,MACA,SACgB;CAChB,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