@stencil/core 5.0.0-alpha.7 → 5.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-data/index.d.ts +2 -0
- package/dist/{runtime/app-data → app-data}/index.js +1 -1
- package/dist/{client-Dd-NB5Ei.mjs → client-aTQ7xHxx.mjs} +2 -157
- package/dist/compiler/index.d.mts +1 -1
- package/dist/compiler/index.mjs +2 -2
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/{compiler-BmT_yLHU.mjs → compiler-C0qmPoKu.mjs} +161 -21
- package/dist/declarations/stencil-public-compiler.d.ts +4 -0
- package/dist/{index-ch-cf-bZ.d.mts → index-BvkyxSY6.d.mts} +1 -1
- package/dist/{index-CVhWFUM0.d.mts → index-vY35H18z.d.mts} +4 -0
- package/dist/{index-BuveMLxy.d.ts → index-xAkMgLX_.d.ts} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-10UamZmn.mjs → node--akYC-sG.mjs} +1 -1
- package/dist/runtime/client/lazy.js +3 -164
- package/dist/runtime/client/runtime.d.ts +2 -30
- package/dist/runtime/client/runtime.js +3 -164
- package/dist/runtime/index.d.ts +2 -30
- package/dist/runtime/index.js +3 -164
- package/dist/runtime/server/index.d.mts +1 -1
- package/dist/runtime/server/index.mjs +16 -16
- package/dist/runtime/server/runner.mjs +1 -1
- package/dist/signals/index.js +1 -1
- package/dist/sys/node/index.d.mts +1 -1
- package/dist/sys/node/index.mjs +1 -1
- package/dist/sys/node/worker.mjs +2 -2
- package/dist/testing/index.d.mts +2 -2
- package/dist/testing/index.mjs +160 -3
- package/package.json +10 -10
- package/dist/runtime/app-data/index.d.ts +0 -2
- /package/dist/{runtime/app-globals → app-globals}/index.d.ts +0 -0
- /package/dist/{runtime/app-globals → app-globals}/index.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __require } from "./chunk-z9aeyW2b.mjs";
|
|
2
|
-
import "./client-
|
|
2
|
+
import "./client-aTQ7xHxx.mjs";
|
|
3
3
|
import { h as noop, i as flatOne, l as isFunction, p as isString } from "./regular-expression-CFVJOTUh.mjs";
|
|
4
4
|
import { St as isGlob, _t as catchError, bt as shouldIgnoreError, it as normalizePath, mt as buildError, pt as TASK_CANCELED_MSG } from "./validation-ByxKj8bC.mjs";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BUILD as BUILD$1, Env, NAMESPACE } from "@stencil/core/
|
|
2
|
-
import { globalStyles } from "@stencil/core/
|
|
1
|
+
import { BUILD as BUILD$1, Env, NAMESPACE } from "@stencil/core/app-data";
|
|
2
|
+
import { globalStyles } from "@stencil/core/app-globals";
|
|
3
3
|
import { effect, effect as effect$1, signal } from "@preact/signals-core";
|
|
4
4
|
//#region src/app-data/lazy.ts
|
|
5
5
|
const BUILD = {
|
|
@@ -508,12 +508,6 @@ const HYDRATE_ID = "s-id";
|
|
|
508
508
|
const HYDRATED_STYLE_ID = "sty-id";
|
|
509
509
|
const HYDRATE_CHILD_ID = "c-id";
|
|
510
510
|
const HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
511
|
-
const STENCIL_DOC_DATA = "_stencilDocData";
|
|
512
|
-
const DEFAULT_DOC_DATA = {
|
|
513
|
-
hostIds: 0,
|
|
514
|
-
rootLevelIds: 0,
|
|
515
|
-
staticComponents: /* @__PURE__ */ new Set()
|
|
516
|
-
};
|
|
517
511
|
/**
|
|
518
512
|
* Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
|
|
519
513
|
*
|
|
@@ -4933,159 +4927,4 @@ function hasKeys(obj) {
|
|
|
4933
4927
|
return false;
|
|
4934
4928
|
}
|
|
4935
4929
|
//#endregion
|
|
4936
|
-
|
|
4937
|
-
/**
|
|
4938
|
-
* Updates the DOM generated on the server with annotations such as node attributes and
|
|
4939
|
-
* comment nodes to facilitate future client-side hydration. These annotations are used for things
|
|
4940
|
-
* like moving elements back to their original hosts if using Shadow DOM on the client, and for quickly
|
|
4941
|
-
* reconstructing the vNode representations of the DOM.
|
|
4942
|
-
*
|
|
4943
|
-
* @param doc The DOM generated by the server.
|
|
4944
|
-
* @param staticComponents Any components that should be considered static and do not need client-side hydration.
|
|
4945
|
-
*/
|
|
4946
|
-
const insertVdomAnnotations = (doc, staticComponents) => {
|
|
4947
|
-
if (doc != null) {
|
|
4948
|
-
/**
|
|
4949
|
-
* Initiated `docData` object from the document if it exists to ensure we
|
|
4950
|
-
* maintain the same `docData` object across multiple hydration hydration runs.
|
|
4951
|
-
*/
|
|
4952
|
-
const docData = "_stencilDocData" in doc ? doc[STENCIL_DOC_DATA] : { ...DEFAULT_DOC_DATA };
|
|
4953
|
-
docData.staticComponents = new Set(staticComponents);
|
|
4954
|
-
const orgLocationNodes = [];
|
|
4955
|
-
parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
|
|
4956
|
-
orgLocationNodes.forEach((orgLocationNode) => {
|
|
4957
|
-
if (orgLocationNode != null && orgLocationNode["s-nr"]) {
|
|
4958
|
-
const nodeRef = orgLocationNode["s-nr"];
|
|
4959
|
-
let hostId = nodeRef["s-host-id"];
|
|
4960
|
-
let nodeId = nodeRef["s-node-id"];
|
|
4961
|
-
let childId = `${hostId}.${nodeId}`;
|
|
4962
|
-
if (hostId == null) {
|
|
4963
|
-
hostId = 0;
|
|
4964
|
-
docData.rootLevelIds++;
|
|
4965
|
-
nodeId = docData.rootLevelIds;
|
|
4966
|
-
childId = `${hostId}.${nodeId}`;
|
|
4967
|
-
if (nodeRef.nodeType === NODE_TYPE.ElementNode) {
|
|
4968
|
-
nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
4969
|
-
if (typeof nodeRef["s-sn"] === "string" && !nodeRef.getAttribute("slot")) nodeRef.setAttribute("s-sn", nodeRef["s-sn"]);
|
|
4970
|
-
} else if (nodeRef.nodeType === NODE_TYPE.TextNode) {
|
|
4971
|
-
if (hostId === 0) {
|
|
4972
|
-
if (nodeRef.nodeValue?.trim() === "") {
|
|
4973
|
-
orgLocationNode.remove();
|
|
4974
|
-
return;
|
|
4975
|
-
}
|
|
4976
|
-
}
|
|
4977
|
-
const commentBeforeTextNode = doc.createComment(childId);
|
|
4978
|
-
commentBeforeTextNode.nodeValue = `t.${childId}`;
|
|
4979
|
-
insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
|
|
4980
|
-
} else if (nodeRef.nodeType === NODE_TYPE.CommentNode) {
|
|
4981
|
-
const commentBeforeTextNode = doc.createComment(childId);
|
|
4982
|
-
commentBeforeTextNode.nodeValue = `c.${childId}`;
|
|
4983
|
-
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
|
4984
|
-
}
|
|
4985
|
-
}
|
|
4986
|
-
let orgLocationNodeId = `o.${childId}`;
|
|
4987
|
-
const orgLocationParentNode = orgLocationNode.parentElement;
|
|
4988
|
-
if (orgLocationParentNode) {
|
|
4989
|
-
if (orgLocationParentNode["s-en"] === "") orgLocationNodeId += `.`;
|
|
4990
|
-
else if (orgLocationParentNode["s-en"] === "c") orgLocationNodeId += `.c`;
|
|
4991
|
-
}
|
|
4992
|
-
orgLocationNode.nodeValue = orgLocationNodeId;
|
|
4993
|
-
}
|
|
4994
|
-
});
|
|
4995
|
-
}
|
|
4996
|
-
};
|
|
4997
|
-
/**
|
|
4998
|
-
* Recursively parses a node generated by the server and its children to set host and child id
|
|
4999
|
-
* attributes read during client-side hydration. This function also tracks whether each node is
|
|
5000
|
-
* an original location reference node meaning that a node has been moved via slot relocation.
|
|
5001
|
-
*
|
|
5002
|
-
* @param doc The DOM generated by the server.
|
|
5003
|
-
* @param node The node to parse.
|
|
5004
|
-
* @param docData An object containing metadata about the document.
|
|
5005
|
-
* @param orgLocationNodes An array of nodes that have been moved via slot relocation.
|
|
5006
|
-
*/
|
|
5007
|
-
const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
|
|
5008
|
-
if (node == null) return;
|
|
5009
|
-
if (node["s-nr"] != null) orgLocationNodes.push(node);
|
|
5010
|
-
if (node.nodeType === NODE_TYPE.ElementNode) [...Array.from(node.childNodes), ...Array.from(node.shadowRoot?.childNodes || [])].forEach((childNode) => {
|
|
5011
|
-
const hostRef = getHostRef(childNode);
|
|
5012
|
-
if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, { nodeIds: 0 });
|
|
5013
|
-
parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
|
|
5014
|
-
});
|
|
5015
|
-
};
|
|
5016
|
-
/**
|
|
5017
|
-
* Insert attribute annotations on an element for its host ID and, potentially, its child ID.
|
|
5018
|
-
* Also makes calls to insert annotations on the element's children, keeping track of the depth of
|
|
5019
|
-
* the component tree.
|
|
5020
|
-
*
|
|
5021
|
-
* @param doc The DOM generated by the server.
|
|
5022
|
-
* @param hostElm The element to insert annotations for.
|
|
5023
|
-
* @param vnode The vNode representation of the element.
|
|
5024
|
-
* @param docData An object containing metadata about the document.
|
|
5025
|
-
* @param cmpData An object containing metadata about the component.
|
|
5026
|
-
*/
|
|
5027
|
-
const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
|
|
5028
|
-
if (vnode != null) {
|
|
5029
|
-
const hostId = ++docData.hostIds;
|
|
5030
|
-
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
5031
|
-
if (hostElm["s-cr"] != null) hostElm["s-cr"].nodeValue = `r.${hostId}`;
|
|
5032
|
-
if (vnode.$children$ != null) {
|
|
5033
|
-
const depth = 0;
|
|
5034
|
-
vnode.$children$.forEach((vnodeChild, index) => {
|
|
5035
|
-
insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
|
|
5036
|
-
});
|
|
5037
|
-
}
|
|
5038
|
-
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute("c-id")) {
|
|
5039
|
-
const parent = hostElm.parentElement;
|
|
5040
|
-
if (parent && parent.childNodes) {
|
|
5041
|
-
const parentChildNodes = Array.from(parent.childNodes);
|
|
5042
|
-
const comment = parentChildNodes.find((node) => node.nodeType === NODE_TYPE.CommentNode && node["s-sr"]);
|
|
5043
|
-
if (comment) {
|
|
5044
|
-
const index = parentChildNodes.indexOf(hostElm) - 1;
|
|
5045
|
-
vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment["s-host-id"]}.${comment["s-node-id"]}.0.${index}`);
|
|
5046
|
-
}
|
|
5047
|
-
}
|
|
5048
|
-
}
|
|
5049
|
-
}
|
|
5050
|
-
};
|
|
5051
|
-
/**
|
|
5052
|
-
* Recursively analyzes the type of a child vNode and inserts annotations on the vNodes's element based on its type.
|
|
5053
|
-
* Element nodes receive a child ID attribute, text nodes have a comment with the child ID inserted before them,
|
|
5054
|
-
* and comment nodes representing a slot have their node value set to a slot node ID containing the child ID.
|
|
5055
|
-
*
|
|
5056
|
-
* @param doc The DOM generated by the server.
|
|
5057
|
-
* @param vnodeChild The vNode to insert annotations for.
|
|
5058
|
-
* @param cmpData An object containing metadata about the component.
|
|
5059
|
-
* @param hostId The host ID of this element's parent.
|
|
5060
|
-
* @param depth How deep this element sits in the component tree relative to its parent.
|
|
5061
|
-
* @param index The index of this element in its parent's children array.
|
|
5062
|
-
*/
|
|
5063
|
-
const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
|
|
5064
|
-
const childElm = vnodeChild.$elm$;
|
|
5065
|
-
if (childElm == null) return;
|
|
5066
|
-
const nodeId = cmpData.nodeIds++;
|
|
5067
|
-
const childId = `${hostId}.${nodeId}.${depth}.${index}`;
|
|
5068
|
-
childElm["s-host-id"] = hostId;
|
|
5069
|
-
childElm["s-node-id"] = nodeId;
|
|
5070
|
-
if (childElm.nodeType === NODE_TYPE.ElementNode) {
|
|
5071
|
-
childElm.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
5072
|
-
if (typeof childElm["s-sn"] === "string" && !childElm.getAttribute("slot")) childElm.setAttribute("s-sn", childElm["s-sn"]);
|
|
5073
|
-
} else if (childElm.nodeType === NODE_TYPE.TextNode) {
|
|
5074
|
-
const parentNode = childElm.parentNode;
|
|
5075
|
-
const nodeName = parentNode?.nodeName;
|
|
5076
|
-
if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
|
|
5077
|
-
const textNodeId = `t.${childId}`;
|
|
5078
|
-
insertBefore(parentNode, doc.createComment(textNodeId), childElm);
|
|
5079
|
-
}
|
|
5080
|
-
} else if (childElm.nodeType === NODE_TYPE.CommentNode) {
|
|
5081
|
-
if (childElm["s-sr"]) childElm.nodeValue = `s.${childId}.${childElm["s-sn"] || ""}`;
|
|
5082
|
-
}
|
|
5083
|
-
if (vnodeChild.$children$ != null) {
|
|
5084
|
-
const childDepth = depth + 1;
|
|
5085
|
-
vnodeChild.$children$.forEach((vnode, childIndex) => {
|
|
5086
|
-
insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, childIndex);
|
|
5087
|
-
});
|
|
5088
|
-
}
|
|
5089
|
-
};
|
|
5090
|
-
//#endregion
|
|
5091
|
-
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, renderVdom, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };
|
|
4930
|
+
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BUILD, Env, NAMESPACE } from "@stencil/core/
|
|
1
|
+
import { BUILD, Env, NAMESPACE } from "@stencil/core/app-data";
|
|
2
2
|
//#region src/declarations/stencil-public-runtime.d.ts
|
|
3
3
|
interface ElementDecorator {
|
|
4
4
|
(): PropertyDecorator;
|
|
@@ -2383,32 +2383,4 @@ declare const jsxs: typeof jsx;
|
|
|
2383
2383
|
*/
|
|
2384
2384
|
declare const jsxDEV: typeof jsx;
|
|
2385
2385
|
//#endregion
|
|
2386
|
-
|
|
2387
|
-
/**
|
|
2388
|
-
* Updates the DOM generated on the server with annotations such as node attributes and
|
|
2389
|
-
* comment nodes to facilitate future client-side hydration. These annotations are used for things
|
|
2390
|
-
* like moving elements back to their original hosts if using Shadow DOM on the client, and for quickly
|
|
2391
|
-
* reconstructing the vNode representations of the DOM.
|
|
2392
|
-
*
|
|
2393
|
-
* @param doc The DOM generated by the server.
|
|
2394
|
-
* @param staticComponents Any components that should be considered static and do not need client-side hydration.
|
|
2395
|
-
*/
|
|
2396
|
-
declare const insertVdomAnnotations: (doc: Document, staticComponents: string[]) => void;
|
|
2397
|
-
//#endregion
|
|
2398
|
-
//#region src/runtime/vdom/vdom-render.d.ts
|
|
2399
|
-
/**
|
|
2400
|
-
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
2401
|
-
*
|
|
2402
|
-
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
|
2403
|
-
* function will handle creating a virtual DOM tree with a single root, patching
|
|
2404
|
-
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
|
2405
|
-
* relocation, and reflecting attributes.
|
|
2406
|
-
*
|
|
2407
|
-
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
2408
|
-
* the DOM node into which it should be rendered.
|
|
2409
|
-
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
2410
|
-
* @param isInitialLoad whether or not this is the first call after page load
|
|
2411
|
-
*/
|
|
2412
|
-
declare const renderVdom: (hostRef: HostRef, renderFnResults: VNode | VNode[], isInitialLoad?: boolean) => void;
|
|
2413
|
-
//#endregion
|
|
2414
|
-
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, renderVdom, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };
|
|
2386
|
+
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BUILD, BUILD as BUILD$1, Env, NAMESPACE, NAMESPACE as NAMESPACE$1 } from "@stencil/core/
|
|
2
|
-
import { globalStyles } from "@stencil/core/
|
|
1
|
+
import { BUILD, BUILD as BUILD$1, Env, NAMESPACE, NAMESPACE as NAMESPACE$1 } from "@stencil/core/app-data";
|
|
2
|
+
import { globalStyles } from "@stencil/core/app-globals";
|
|
3
3
|
import { effect, effect as effect$1, signal } from "@preact/signals-core";
|
|
4
4
|
//#region src/client/client-build.ts
|
|
5
5
|
const Build = {
|
|
@@ -502,12 +502,6 @@ const HYDRATE_ID = "s-id";
|
|
|
502
502
|
const HYDRATED_STYLE_ID = "sty-id";
|
|
503
503
|
const HYDRATE_CHILD_ID = "c-id";
|
|
504
504
|
const HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
505
|
-
const STENCIL_DOC_DATA = "_stencilDocData";
|
|
506
|
-
const DEFAULT_DOC_DATA = {
|
|
507
|
-
hostIds: 0,
|
|
508
|
-
rootLevelIds: 0,
|
|
509
|
-
staticComponents: /* @__PURE__ */ new Set()
|
|
510
|
-
};
|
|
511
505
|
/**
|
|
512
506
|
* Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
|
|
513
507
|
*
|
|
@@ -4927,159 +4921,4 @@ function hasKeys(obj) {
|
|
|
4927
4921
|
return false;
|
|
4928
4922
|
}
|
|
4929
4923
|
//#endregion
|
|
4930
|
-
|
|
4931
|
-
/**
|
|
4932
|
-
* Updates the DOM generated on the server with annotations such as node attributes and
|
|
4933
|
-
* comment nodes to facilitate future client-side hydration. These annotations are used for things
|
|
4934
|
-
* like moving elements back to their original hosts if using Shadow DOM on the client, and for quickly
|
|
4935
|
-
* reconstructing the vNode representations of the DOM.
|
|
4936
|
-
*
|
|
4937
|
-
* @param doc The DOM generated by the server.
|
|
4938
|
-
* @param staticComponents Any components that should be considered static and do not need client-side hydration.
|
|
4939
|
-
*/
|
|
4940
|
-
const insertVdomAnnotations = (doc, staticComponents) => {
|
|
4941
|
-
if (doc != null) {
|
|
4942
|
-
/**
|
|
4943
|
-
* Initiated `docData` object from the document if it exists to ensure we
|
|
4944
|
-
* maintain the same `docData` object across multiple hydration hydration runs.
|
|
4945
|
-
*/
|
|
4946
|
-
const docData = "_stencilDocData" in doc ? doc[STENCIL_DOC_DATA] : { ...DEFAULT_DOC_DATA };
|
|
4947
|
-
docData.staticComponents = new Set(staticComponents);
|
|
4948
|
-
const orgLocationNodes = [];
|
|
4949
|
-
parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
|
|
4950
|
-
orgLocationNodes.forEach((orgLocationNode) => {
|
|
4951
|
-
if (orgLocationNode != null && orgLocationNode["s-nr"]) {
|
|
4952
|
-
const nodeRef = orgLocationNode["s-nr"];
|
|
4953
|
-
let hostId = nodeRef["s-host-id"];
|
|
4954
|
-
let nodeId = nodeRef["s-node-id"];
|
|
4955
|
-
let childId = `${hostId}.${nodeId}`;
|
|
4956
|
-
if (hostId == null) {
|
|
4957
|
-
hostId = 0;
|
|
4958
|
-
docData.rootLevelIds++;
|
|
4959
|
-
nodeId = docData.rootLevelIds;
|
|
4960
|
-
childId = `${hostId}.${nodeId}`;
|
|
4961
|
-
if (nodeRef.nodeType === NODE_TYPE.ElementNode) {
|
|
4962
|
-
nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
4963
|
-
if (typeof nodeRef["s-sn"] === "string" && !nodeRef.getAttribute("slot")) nodeRef.setAttribute("s-sn", nodeRef["s-sn"]);
|
|
4964
|
-
} else if (nodeRef.nodeType === NODE_TYPE.TextNode) {
|
|
4965
|
-
if (hostId === 0) {
|
|
4966
|
-
if (nodeRef.nodeValue?.trim() === "") {
|
|
4967
|
-
orgLocationNode.remove();
|
|
4968
|
-
return;
|
|
4969
|
-
}
|
|
4970
|
-
}
|
|
4971
|
-
const commentBeforeTextNode = doc.createComment(childId);
|
|
4972
|
-
commentBeforeTextNode.nodeValue = `t.${childId}`;
|
|
4973
|
-
insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
|
|
4974
|
-
} else if (nodeRef.nodeType === NODE_TYPE.CommentNode) {
|
|
4975
|
-
const commentBeforeTextNode = doc.createComment(childId);
|
|
4976
|
-
commentBeforeTextNode.nodeValue = `c.${childId}`;
|
|
4977
|
-
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
|
4978
|
-
}
|
|
4979
|
-
}
|
|
4980
|
-
let orgLocationNodeId = `o.${childId}`;
|
|
4981
|
-
const orgLocationParentNode = orgLocationNode.parentElement;
|
|
4982
|
-
if (orgLocationParentNode) {
|
|
4983
|
-
if (orgLocationParentNode["s-en"] === "") orgLocationNodeId += `.`;
|
|
4984
|
-
else if (orgLocationParentNode["s-en"] === "c") orgLocationNodeId += `.c`;
|
|
4985
|
-
}
|
|
4986
|
-
orgLocationNode.nodeValue = orgLocationNodeId;
|
|
4987
|
-
}
|
|
4988
|
-
});
|
|
4989
|
-
}
|
|
4990
|
-
};
|
|
4991
|
-
/**
|
|
4992
|
-
* Recursively parses a node generated by the server and its children to set host and child id
|
|
4993
|
-
* attributes read during client-side hydration. This function also tracks whether each node is
|
|
4994
|
-
* an original location reference node meaning that a node has been moved via slot relocation.
|
|
4995
|
-
*
|
|
4996
|
-
* @param doc The DOM generated by the server.
|
|
4997
|
-
* @param node The node to parse.
|
|
4998
|
-
* @param docData An object containing metadata about the document.
|
|
4999
|
-
* @param orgLocationNodes An array of nodes that have been moved via slot relocation.
|
|
5000
|
-
*/
|
|
5001
|
-
const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
|
|
5002
|
-
if (node == null) return;
|
|
5003
|
-
if (node["s-nr"] != null) orgLocationNodes.push(node);
|
|
5004
|
-
if (node.nodeType === NODE_TYPE.ElementNode) [...Array.from(node.childNodes), ...Array.from(node.shadowRoot?.childNodes || [])].forEach((childNode) => {
|
|
5005
|
-
const hostRef = getHostRef(childNode);
|
|
5006
|
-
if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, { nodeIds: 0 });
|
|
5007
|
-
parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
|
|
5008
|
-
});
|
|
5009
|
-
};
|
|
5010
|
-
/**
|
|
5011
|
-
* Insert attribute annotations on an element for its host ID and, potentially, its child ID.
|
|
5012
|
-
* Also makes calls to insert annotations on the element's children, keeping track of the depth of
|
|
5013
|
-
* the component tree.
|
|
5014
|
-
*
|
|
5015
|
-
* @param doc The DOM generated by the server.
|
|
5016
|
-
* @param hostElm The element to insert annotations for.
|
|
5017
|
-
* @param vnode The vNode representation of the element.
|
|
5018
|
-
* @param docData An object containing metadata about the document.
|
|
5019
|
-
* @param cmpData An object containing metadata about the component.
|
|
5020
|
-
*/
|
|
5021
|
-
const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
|
|
5022
|
-
if (vnode != null) {
|
|
5023
|
-
const hostId = ++docData.hostIds;
|
|
5024
|
-
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
5025
|
-
if (hostElm["s-cr"] != null) hostElm["s-cr"].nodeValue = `r.${hostId}`;
|
|
5026
|
-
if (vnode.$children$ != null) {
|
|
5027
|
-
const depth = 0;
|
|
5028
|
-
vnode.$children$.forEach((vnodeChild, index) => {
|
|
5029
|
-
insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
|
|
5030
|
-
});
|
|
5031
|
-
}
|
|
5032
|
-
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute("c-id")) {
|
|
5033
|
-
const parent = hostElm.parentElement;
|
|
5034
|
-
if (parent && parent.childNodes) {
|
|
5035
|
-
const parentChildNodes = Array.from(parent.childNodes);
|
|
5036
|
-
const comment = parentChildNodes.find((node) => node.nodeType === NODE_TYPE.CommentNode && node["s-sr"]);
|
|
5037
|
-
if (comment) {
|
|
5038
|
-
const index = parentChildNodes.indexOf(hostElm) - 1;
|
|
5039
|
-
vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment["s-host-id"]}.${comment["s-node-id"]}.0.${index}`);
|
|
5040
|
-
}
|
|
5041
|
-
}
|
|
5042
|
-
}
|
|
5043
|
-
}
|
|
5044
|
-
};
|
|
5045
|
-
/**
|
|
5046
|
-
* Recursively analyzes the type of a child vNode and inserts annotations on the vNodes's element based on its type.
|
|
5047
|
-
* Element nodes receive a child ID attribute, text nodes have a comment with the child ID inserted before them,
|
|
5048
|
-
* and comment nodes representing a slot have their node value set to a slot node ID containing the child ID.
|
|
5049
|
-
*
|
|
5050
|
-
* @param doc The DOM generated by the server.
|
|
5051
|
-
* @param vnodeChild The vNode to insert annotations for.
|
|
5052
|
-
* @param cmpData An object containing metadata about the component.
|
|
5053
|
-
* @param hostId The host ID of this element's parent.
|
|
5054
|
-
* @param depth How deep this element sits in the component tree relative to its parent.
|
|
5055
|
-
* @param index The index of this element in its parent's children array.
|
|
5056
|
-
*/
|
|
5057
|
-
const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
|
|
5058
|
-
const childElm = vnodeChild.$elm$;
|
|
5059
|
-
if (childElm == null) return;
|
|
5060
|
-
const nodeId = cmpData.nodeIds++;
|
|
5061
|
-
const childId = `${hostId}.${nodeId}.${depth}.${index}`;
|
|
5062
|
-
childElm["s-host-id"] = hostId;
|
|
5063
|
-
childElm["s-node-id"] = nodeId;
|
|
5064
|
-
if (childElm.nodeType === NODE_TYPE.ElementNode) {
|
|
5065
|
-
childElm.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
5066
|
-
if (typeof childElm["s-sn"] === "string" && !childElm.getAttribute("slot")) childElm.setAttribute("s-sn", childElm["s-sn"]);
|
|
5067
|
-
} else if (childElm.nodeType === NODE_TYPE.TextNode) {
|
|
5068
|
-
const parentNode = childElm.parentNode;
|
|
5069
|
-
const nodeName = parentNode?.nodeName;
|
|
5070
|
-
if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
|
|
5071
|
-
const textNodeId = `t.${childId}`;
|
|
5072
|
-
insertBefore(parentNode, doc.createComment(textNodeId), childElm);
|
|
5073
|
-
}
|
|
5074
|
-
} else if (childElm.nodeType === NODE_TYPE.CommentNode) {
|
|
5075
|
-
if (childElm["s-sr"]) childElm.nodeValue = `s.${childId}.${childElm["s-sn"] || ""}`;
|
|
5076
|
-
}
|
|
5077
|
-
if (vnodeChild.$children$ != null) {
|
|
5078
|
-
const childDepth = depth + 1;
|
|
5079
|
-
vnodeChild.$children$.forEach((vnode, childIndex) => {
|
|
5080
|
-
insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, childIndex);
|
|
5081
|
-
});
|
|
5082
|
-
}
|
|
5083
|
-
};
|
|
5084
|
-
//#endregion
|
|
5085
|
-
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, renderVdom, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };
|
|
4924
|
+
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as VNode, _ as FunctionalComponent, a as ComponentConstructor, b as ResolutionHandler, c as ComponentRuntimeMeta, d as HostRef, f as LazyBundlesRuntimeData, g as CustomElementsDefineOptions, h as RuntimeRef, i as ChildType, l as ComponentRuntimeMetaCompact, m as RenderNode, o as ComponentConstructorChangeHandlers, p as PlatformRuntime, s as ComponentRuntimeHostListener, u as HostElement, v as HTMLStencilElement, x as TagTransformer, y as JSXBase } from "../index-
|
|
1
|
+
import { S as VNode, _ as FunctionalComponent, a as ComponentConstructor, b as ResolutionHandler, c as ComponentRuntimeMeta, d as HostRef, f as LazyBundlesRuntimeData, g as CustomElementsDefineOptions, h as RuntimeRef, i as ChildType, l as ComponentRuntimeMetaCompact, m as RenderNode, o as ComponentConstructorChangeHandlers, p as PlatformRuntime, s as ComponentRuntimeHostListener, u as HostElement, v as HTMLStencilElement, x as TagTransformer, y as JSXBase } from "../index-xAkMgLX_.js";
|
|
2
2
|
|
|
3
3
|
//#region src/runtime/asset-path.d.ts
|
|
4
4
|
declare const getAssetPath: (path: string) => string;
|
|
@@ -208,32 +208,4 @@ declare const jsxs: typeof jsx;
|
|
|
208
208
|
*/
|
|
209
209
|
declare const jsxDEV: typeof jsx;
|
|
210
210
|
//#endregion
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Updates the DOM generated on the server with annotations such as node attributes and
|
|
214
|
-
* comment nodes to facilitate future client-side hydration. These annotations are used for things
|
|
215
|
-
* like moving elements back to their original hosts if using Shadow DOM on the client, and for quickly
|
|
216
|
-
* reconstructing the vNode representations of the DOM.
|
|
217
|
-
*
|
|
218
|
-
* @param doc The DOM generated by the server.
|
|
219
|
-
* @param staticComponents Any components that should be considered static and do not need client-side hydration.
|
|
220
|
-
*/
|
|
221
|
-
declare const insertVdomAnnotations: (doc: Document, staticComponents: string[]) => void;
|
|
222
|
-
//#endregion
|
|
223
|
-
//#region src/runtime/vdom/vdom-render.d.ts
|
|
224
|
-
/**
|
|
225
|
-
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
226
|
-
*
|
|
227
|
-
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
|
228
|
-
* function will handle creating a virtual DOM tree with a single root, patching
|
|
229
|
-
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
|
230
|
-
* relocation, and reflecting attributes.
|
|
231
|
-
*
|
|
232
|
-
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
233
|
-
* the DOM node into which it should be rendered.
|
|
234
|
-
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
235
|
-
* @param isInitialLoad whether or not this is the first call after page load
|
|
236
|
-
*/
|
|
237
|
-
declare const renderVdom: (hostRef: HostRef, renderFnResults: VNode | VNode[], isInitialLoad?: boolean) => void;
|
|
238
|
-
//#endregion
|
|
239
|
-
export { Fragment, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, Mixin, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, jsx, jsxDEV, jsxs, normalizeWatchers, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, render, renderVdom, setAssetPath, setMode, setNonce, setPlatformOptions, setRegistry, setTagTransformer, setValue, transformTag };
|
|
211
|
+
export { Fragment, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, Mixin, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, jsx, jsxDEV, jsxs, normalizeWatchers, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, render, setAssetPath, setMode, setNonce, setPlatformOptions, setRegistry, setTagTransformer, setValue, transformTag };
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BUILD } from "
|
|
2
|
-
import "
|
|
1
|
+
import { BUILD } from "../app-data/index.js";
|
|
2
|
+
import "../app-globals/index.js";
|
|
3
3
|
import { effect, effect as effect$1, signal } from "@preact/signals-core";
|
|
4
4
|
//#region src/client/client-build.ts
|
|
5
5
|
const Build = {
|
|
@@ -384,12 +384,6 @@ const HYDRATE_ID = "s-id";
|
|
|
384
384
|
const HYDRATED_STYLE_ID = "sty-id";
|
|
385
385
|
const HYDRATE_CHILD_ID = "c-id";
|
|
386
386
|
const HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
387
|
-
const STENCIL_DOC_DATA = "_stencilDocData";
|
|
388
|
-
const DEFAULT_DOC_DATA = {
|
|
389
|
-
hostIds: 0,
|
|
390
|
-
rootLevelIds: 0,
|
|
391
|
-
staticComponents: /* @__PURE__ */ new Set()
|
|
392
|
-
};
|
|
393
387
|
/**
|
|
394
388
|
* Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
|
|
395
389
|
*
|
|
@@ -4798,159 +4792,4 @@ function hasKeys(obj) {
|
|
|
4798
4792
|
return false;
|
|
4799
4793
|
}
|
|
4800
4794
|
//#endregion
|
|
4801
|
-
|
|
4802
|
-
/**
|
|
4803
|
-
* Updates the DOM generated on the server with annotations such as node attributes and
|
|
4804
|
-
* comment nodes to facilitate future client-side hydration. These annotations are used for things
|
|
4805
|
-
* like moving elements back to their original hosts if using Shadow DOM on the client, and for quickly
|
|
4806
|
-
* reconstructing the vNode representations of the DOM.
|
|
4807
|
-
*
|
|
4808
|
-
* @param doc The DOM generated by the server.
|
|
4809
|
-
* @param staticComponents Any components that should be considered static and do not need client-side hydration.
|
|
4810
|
-
*/
|
|
4811
|
-
const insertVdomAnnotations = (doc, staticComponents) => {
|
|
4812
|
-
if (doc != null) {
|
|
4813
|
-
/**
|
|
4814
|
-
* Initiated `docData` object from the document if it exists to ensure we
|
|
4815
|
-
* maintain the same `docData` object across multiple hydration hydration runs.
|
|
4816
|
-
*/
|
|
4817
|
-
const docData = "_stencilDocData" in doc ? doc[STENCIL_DOC_DATA] : { ...DEFAULT_DOC_DATA };
|
|
4818
|
-
docData.staticComponents = new Set(staticComponents);
|
|
4819
|
-
const orgLocationNodes = [];
|
|
4820
|
-
parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
|
|
4821
|
-
orgLocationNodes.forEach((orgLocationNode) => {
|
|
4822
|
-
if (orgLocationNode != null && orgLocationNode["s-nr"]) {
|
|
4823
|
-
const nodeRef = orgLocationNode["s-nr"];
|
|
4824
|
-
let hostId = nodeRef["s-host-id"];
|
|
4825
|
-
let nodeId = nodeRef["s-node-id"];
|
|
4826
|
-
let childId = `${hostId}.${nodeId}`;
|
|
4827
|
-
if (hostId == null) {
|
|
4828
|
-
hostId = 0;
|
|
4829
|
-
docData.rootLevelIds++;
|
|
4830
|
-
nodeId = docData.rootLevelIds;
|
|
4831
|
-
childId = `${hostId}.${nodeId}`;
|
|
4832
|
-
if (nodeRef.nodeType === NODE_TYPE.ElementNode) {
|
|
4833
|
-
nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
4834
|
-
if (typeof nodeRef["s-sn"] === "string" && !nodeRef.getAttribute("slot")) nodeRef.setAttribute("s-sn", nodeRef["s-sn"]);
|
|
4835
|
-
} else if (nodeRef.nodeType === NODE_TYPE.TextNode) {
|
|
4836
|
-
if (hostId === 0) {
|
|
4837
|
-
if (nodeRef.nodeValue?.trim() === "") {
|
|
4838
|
-
orgLocationNode.remove();
|
|
4839
|
-
return;
|
|
4840
|
-
}
|
|
4841
|
-
}
|
|
4842
|
-
const commentBeforeTextNode = doc.createComment(childId);
|
|
4843
|
-
commentBeforeTextNode.nodeValue = `t.${childId}`;
|
|
4844
|
-
insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
|
|
4845
|
-
} else if (nodeRef.nodeType === NODE_TYPE.CommentNode) {
|
|
4846
|
-
const commentBeforeTextNode = doc.createComment(childId);
|
|
4847
|
-
commentBeforeTextNode.nodeValue = `c.${childId}`;
|
|
4848
|
-
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
|
4849
|
-
}
|
|
4850
|
-
}
|
|
4851
|
-
let orgLocationNodeId = `o.${childId}`;
|
|
4852
|
-
const orgLocationParentNode = orgLocationNode.parentElement;
|
|
4853
|
-
if (orgLocationParentNode) {
|
|
4854
|
-
if (orgLocationParentNode["s-en"] === "") orgLocationNodeId += `.`;
|
|
4855
|
-
else if (orgLocationParentNode["s-en"] === "c") orgLocationNodeId += `.c`;
|
|
4856
|
-
}
|
|
4857
|
-
orgLocationNode.nodeValue = orgLocationNodeId;
|
|
4858
|
-
}
|
|
4859
|
-
});
|
|
4860
|
-
}
|
|
4861
|
-
};
|
|
4862
|
-
/**
|
|
4863
|
-
* Recursively parses a node generated by the server and its children to set host and child id
|
|
4864
|
-
* attributes read during client-side hydration. This function also tracks whether each node is
|
|
4865
|
-
* an original location reference node meaning that a node has been moved via slot relocation.
|
|
4866
|
-
*
|
|
4867
|
-
* @param doc The DOM generated by the server.
|
|
4868
|
-
* @param node The node to parse.
|
|
4869
|
-
* @param docData An object containing metadata about the document.
|
|
4870
|
-
* @param orgLocationNodes An array of nodes that have been moved via slot relocation.
|
|
4871
|
-
*/
|
|
4872
|
-
const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
|
|
4873
|
-
if (node == null) return;
|
|
4874
|
-
if (node["s-nr"] != null) orgLocationNodes.push(node);
|
|
4875
|
-
if (node.nodeType === NODE_TYPE.ElementNode) [...Array.from(node.childNodes), ...Array.from(node.shadowRoot?.childNodes || [])].forEach((childNode) => {
|
|
4876
|
-
const hostRef = getHostRef(childNode);
|
|
4877
|
-
if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, { nodeIds: 0 });
|
|
4878
|
-
parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
|
|
4879
|
-
});
|
|
4880
|
-
};
|
|
4881
|
-
/**
|
|
4882
|
-
* Insert attribute annotations on an element for its host ID and, potentially, its child ID.
|
|
4883
|
-
* Also makes calls to insert annotations on the element's children, keeping track of the depth of
|
|
4884
|
-
* the component tree.
|
|
4885
|
-
*
|
|
4886
|
-
* @param doc The DOM generated by the server.
|
|
4887
|
-
* @param hostElm The element to insert annotations for.
|
|
4888
|
-
* @param vnode The vNode representation of the element.
|
|
4889
|
-
* @param docData An object containing metadata about the document.
|
|
4890
|
-
* @param cmpData An object containing metadata about the component.
|
|
4891
|
-
*/
|
|
4892
|
-
const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
|
|
4893
|
-
if (vnode != null) {
|
|
4894
|
-
const hostId = ++docData.hostIds;
|
|
4895
|
-
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
4896
|
-
if (hostElm["s-cr"] != null) hostElm["s-cr"].nodeValue = `r.${hostId}`;
|
|
4897
|
-
if (vnode.$children$ != null) {
|
|
4898
|
-
const depth = 0;
|
|
4899
|
-
vnode.$children$.forEach((vnodeChild, index) => {
|
|
4900
|
-
insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
|
|
4901
|
-
});
|
|
4902
|
-
}
|
|
4903
|
-
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute("c-id")) {
|
|
4904
|
-
const parent = hostElm.parentElement;
|
|
4905
|
-
if (parent && parent.childNodes) {
|
|
4906
|
-
const parentChildNodes = Array.from(parent.childNodes);
|
|
4907
|
-
const comment = parentChildNodes.find((node) => node.nodeType === NODE_TYPE.CommentNode && node["s-sr"]);
|
|
4908
|
-
if (comment) {
|
|
4909
|
-
const index = parentChildNodes.indexOf(hostElm) - 1;
|
|
4910
|
-
vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment["s-host-id"]}.${comment["s-node-id"]}.0.${index}`);
|
|
4911
|
-
}
|
|
4912
|
-
}
|
|
4913
|
-
}
|
|
4914
|
-
}
|
|
4915
|
-
};
|
|
4916
|
-
/**
|
|
4917
|
-
* Recursively analyzes the type of a child vNode and inserts annotations on the vNodes's element based on its type.
|
|
4918
|
-
* Element nodes receive a child ID attribute, text nodes have a comment with the child ID inserted before them,
|
|
4919
|
-
* and comment nodes representing a slot have their node value set to a slot node ID containing the child ID.
|
|
4920
|
-
*
|
|
4921
|
-
* @param doc The DOM generated by the server.
|
|
4922
|
-
* @param vnodeChild The vNode to insert annotations for.
|
|
4923
|
-
* @param cmpData An object containing metadata about the component.
|
|
4924
|
-
* @param hostId The host ID of this element's parent.
|
|
4925
|
-
* @param depth How deep this element sits in the component tree relative to its parent.
|
|
4926
|
-
* @param index The index of this element in its parent's children array.
|
|
4927
|
-
*/
|
|
4928
|
-
const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
|
|
4929
|
-
const childElm = vnodeChild.$elm$;
|
|
4930
|
-
if (childElm == null) return;
|
|
4931
|
-
const nodeId = cmpData.nodeIds++;
|
|
4932
|
-
const childId = `${hostId}.${nodeId}.${depth}.${index}`;
|
|
4933
|
-
childElm["s-host-id"] = hostId;
|
|
4934
|
-
childElm["s-node-id"] = nodeId;
|
|
4935
|
-
if (childElm.nodeType === NODE_TYPE.ElementNode) {
|
|
4936
|
-
childElm.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
4937
|
-
if (typeof childElm["s-sn"] === "string" && !childElm.getAttribute("slot")) childElm.setAttribute("s-sn", childElm["s-sn"]);
|
|
4938
|
-
} else if (childElm.nodeType === NODE_TYPE.TextNode) {
|
|
4939
|
-
const parentNode = childElm.parentNode;
|
|
4940
|
-
const nodeName = parentNode?.nodeName;
|
|
4941
|
-
if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
|
|
4942
|
-
const textNodeId = `t.${childId}`;
|
|
4943
|
-
insertBefore(parentNode, doc.createComment(textNodeId), childElm);
|
|
4944
|
-
}
|
|
4945
|
-
} else if (childElm.nodeType === NODE_TYPE.CommentNode) {
|
|
4946
|
-
if (childElm["s-sr"]) childElm.nodeValue = `s.${childId}.${childElm["s-sn"] || ""}`;
|
|
4947
|
-
}
|
|
4948
|
-
if (vnodeChild.$children$ != null) {
|
|
4949
|
-
const childDepth = depth + 1;
|
|
4950
|
-
vnodeChild.$children$.forEach((vnode, childIndex) => {
|
|
4951
|
-
insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, childIndex);
|
|
4952
|
-
});
|
|
4953
|
-
}
|
|
4954
|
-
};
|
|
4955
|
-
//#endregion
|
|
4956
|
-
export { Fragment, HYDRATED_STYLE_ID, Host, Mixin, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, insertVdomAnnotations, jsx, jsxDEV, jsxs, normalizeWatchers, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, render, renderVdom, setAssetPath, setMode, setNonce, setPlatformOptions, setRegistry, setTagTransformer, setValue, transformTag };
|
|
4795
|
+
export { Fragment, HYDRATED_STYLE_ID, Host, Mixin, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, jsx, jsxDEV, jsxs, normalizeWatchers, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, render, setAssetPath, setMode, setNonce, setPlatformOptions, setRegistry, setTagTransformer, setValue, transformTag };
|