@stencil/core 5.0.0-beta.9 → 5.0.0-rc.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/dist/app-data/index.d.ts +1 -1
- package/dist/app-data/index.js +1 -0
- package/dist/{client-BRu0GtRn.mjs → client-ClM4H9-P.mjs} +204 -76
- package/dist/compiler/browser.d.ts +120 -81
- package/dist/compiler/browser.js +964 -402
- package/dist/compiler/index.d.mts +110 -2
- package/dist/compiler/index.mjs +3 -3
- package/dist/compiler/utils/index.d.mts +2 -2
- package/dist/compiler/utils/index.mjs +3 -3
- package/dist/{compiler-wLrjuSOK.mjs → compiler-DFanjq9z.mjs} +5300 -3005
- package/dist/declarations/stencil-public-compiler.d.ts +178 -133
- package/dist/declarations/stencil-public-docs.d.ts +23 -0
- package/dist/declarations/stencil-public-runtime.d.ts +81 -59
- package/dist/{index-BvF31nqP.d.mts → index-DvfFOkiJ.d.mts} +220 -133
- package/dist/{index-BXAcVN2j.d.ts → index-XQHZl0MW.d.ts} +70 -57
- package/dist/{index-BAP9T4CB.d.mts → index-aBMJC5F9.d.mts} +6 -2
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.d.mts +6 -0
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-75gQKkFz.mjs → node-DJP8JuAS.mjs} +42 -48
- package/dist/runtime/client/lazy.js +522 -262
- package/dist/runtime/client/runtime.d.ts +100 -68
- package/dist/runtime/client/runtime.js +522 -262
- package/dist/runtime/index.d.ts +6 -6
- package/dist/runtime/index.js +521 -261
- package/dist/runtime/server/index.d.mts +36 -12
- package/dist/runtime/server/index.mjs +635 -304
- package/dist/runtime/server/runner.d.mts +49 -6
- package/dist/runtime/server/runner.mjs +385 -87
- package/dist/signals/index.d.ts +11 -2
- package/dist/signals/index.js +15 -35
- 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 +152 -124
- package/dist/testing/index.mjs +535 -269
- package/dist/{util-IKfWWLJo.mjs → util-C-H1H84W.mjs} +8 -1
- package/dist/{validation-DAdGTrys.mjs → validation-ByYYKvnS.mjs} +37 -3
- package/package.json +8 -4
package/dist/app-data/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Env, r as NAMESPACE, t as BUILD } from "../index-
|
|
1
|
+
import { n as Env, r as NAMESPACE, t as BUILD } from "../index-XQHZl0MW.js";
|
|
2
2
|
export { BUILD, Env, NAMESPACE };
|
package/dist/app-data/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { B as HOST_FLAGS, C as CMP_FLAGS, G as NODE_TYPES, Z as SVG_NS, o as isComplexType, s as isDef, x as queryNonceMetaTagContent } from "./helpers-Cpp3qc3u.mjs";
|
|
2
|
-
import
|
|
2
|
+
import * as SignalsCore from "@preact/signals-core";
|
|
3
3
|
//#region src/app-data/index.ts
|
|
4
4
|
/**
|
|
5
5
|
* A collection of default build flags for a Stencil project.
|
|
@@ -99,46 +99,12 @@ const BUILD = {
|
|
|
99
99
|
shadowSlotAssignmentManual: false,
|
|
100
100
|
shadowClonable: true,
|
|
101
101
|
shadowSerializable: true,
|
|
102
|
+
shadowReferenceTarget: true,
|
|
102
103
|
initializeNextTick: false,
|
|
103
104
|
asyncLoading: true,
|
|
104
105
|
asyncQueue: false
|
|
105
106
|
};
|
|
106
107
|
//#endregion
|
|
107
|
-
//#region src/client/client-build.ts
|
|
108
|
-
const Build = {
|
|
109
|
-
isDev: BUILD.isDev,
|
|
110
|
-
isBrowser: true,
|
|
111
|
-
isServer: false,
|
|
112
|
-
isTesting: BUILD.isTesting
|
|
113
|
-
};
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/client/client-host-ref.ts
|
|
116
|
-
/**
|
|
117
|
-
* Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
|
|
118
|
-
*
|
|
119
|
-
* @param ref the runtime ref of interest
|
|
120
|
-
* @returns the Host reference (if found) or undefined
|
|
121
|
-
*/
|
|
122
|
-
const getHostRef = (ref) => {
|
|
123
|
-
if (ref.__s_ghr) return ref.__s_ghr();
|
|
124
|
-
};
|
|
125
|
-
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
126
|
-
//#endregion
|
|
127
|
-
//#region src/client/client-log.ts
|
|
128
|
-
let customError;
|
|
129
|
-
const consoleError = (e, el) => (customError || console.error)(e, el);
|
|
130
|
-
const STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : ["%cstencil", "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"];
|
|
131
|
-
const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
|
|
132
|
-
const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
|
|
133
|
-
const setErrorHandler = (handler) => customError = handler;
|
|
134
|
-
//#endregion
|
|
135
|
-
//#region src/client/client-load-module.ts
|
|
136
|
-
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
137
|
-
//#endregion
|
|
138
|
-
//#region src/client/client-style.ts
|
|
139
|
-
const styles = /*@__PURE__*/ new Map();
|
|
140
|
-
const modeResolutionChain = [];
|
|
141
|
-
//#endregion
|
|
142
108
|
//#region src/runtime/runtime-constants.ts
|
|
143
109
|
/**
|
|
144
110
|
* Bit flags for recording various properties of VDom nodes
|
|
@@ -181,7 +147,16 @@ const NODE_TYPE = {
|
|
|
181
147
|
DocumentTypeNode: 10,
|
|
182
148
|
DocumentFragment: 11
|
|
183
149
|
};
|
|
150
|
+
const HYDRATE_ID = "s-id";
|
|
184
151
|
const HYDRATED_STYLE_ID = "sty-id";
|
|
152
|
+
const HYDRATE_CHILD_ID = "c-id";
|
|
153
|
+
/**
|
|
154
|
+
* Starts an attribute value written by the `ssr` output's `ssrProp()` on a server: a reference to
|
|
155
|
+
* a value it put in the registry below, for the SSR runtime to take out and set as the prop.
|
|
156
|
+
*/
|
|
157
|
+
const SSR_PROP_REF_PREFIX = "__stencil_ssr_ref:";
|
|
158
|
+
/** `Symbol.for()` key of the `ssrProp()` registry on the server's real global object. */
|
|
159
|
+
const SSR_PROPS_REGISTRY_KEY = "stencil.ssrProps";
|
|
185
160
|
const HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
186
161
|
/**
|
|
187
162
|
* Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
|
|
@@ -191,6 +166,62 @@ const HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
|
191
166
|
*/
|
|
192
167
|
const SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
193
168
|
const XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
169
|
+
/**
|
|
170
|
+
* `Build` values fixed per platform. Shared by each runtime's `Build` export and the compiler's
|
|
171
|
+
* `Build.*` folding (`compiler/bundle/build-flags-plugin.ts`), so the two can't disagree.
|
|
172
|
+
*/
|
|
173
|
+
const CLIENT_BUILD_FLAGS = {
|
|
174
|
+
isBrowser: true,
|
|
175
|
+
isServer: false
|
|
176
|
+
};
|
|
177
|
+
const SERVER_BUILD_FLAGS = {
|
|
178
|
+
isBrowser: false,
|
|
179
|
+
isServer: true,
|
|
180
|
+
isDev: false,
|
|
181
|
+
isTesting: false
|
|
182
|
+
};
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/client/client-build.ts
|
|
185
|
+
/**
|
|
186
|
+
* `isDev` / `isTesting` are getters, not copies: the transpile path (e.g. `@stencil/unplugin`)
|
|
187
|
+
* sets `BUILD.*` overrides from each component module, which runs after this module is evaluated.
|
|
188
|
+
*/
|
|
189
|
+
const Build = {
|
|
190
|
+
...CLIENT_BUILD_FLAGS,
|
|
191
|
+
get isDev() {
|
|
192
|
+
return BUILD.isDev;
|
|
193
|
+
},
|
|
194
|
+
get isTesting() {
|
|
195
|
+
return BUILD.isTesting;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/client/client-host-ref.ts
|
|
200
|
+
/**
|
|
201
|
+
* Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
|
|
202
|
+
*
|
|
203
|
+
* @param ref the runtime ref of interest
|
|
204
|
+
* @returns the Host reference (if found) or undefined
|
|
205
|
+
*/
|
|
206
|
+
const getHostRef = (ref) => {
|
|
207
|
+
if (ref.__s_ghr) return ref.__s_ghr();
|
|
208
|
+
};
|
|
209
|
+
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/client/client-log.ts
|
|
212
|
+
let customError;
|
|
213
|
+
const consoleError = (e, el) => (customError || console.error)(e, el);
|
|
214
|
+
const STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : ["%cstencil", "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"];
|
|
215
|
+
const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
|
|
216
|
+
const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
|
|
217
|
+
const setErrorHandler = (handler) => customError = handler;
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/client/client-load-module.ts
|
|
220
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/client/client-style.ts
|
|
223
|
+
const styles = /*@__PURE__*/ new Map();
|
|
224
|
+
const modeResolver = [];
|
|
194
225
|
//#endregion
|
|
195
226
|
//#region src/client/client-window.ts
|
|
196
227
|
const win = typeof window !== "undefined" ? window : {};
|
|
@@ -223,7 +254,7 @@ let queuePending = false;
|
|
|
223
254
|
const queueDomReads = [];
|
|
224
255
|
const queueDomWrites = [];
|
|
225
256
|
const queueDomWritesLow = [];
|
|
226
|
-
const scheduleFlush = () => win.document?.hidden ?
|
|
257
|
+
const scheduleFlush = () => win.document?.hidden ? setTimeout(flush, 16) : plt.raf(flush);
|
|
227
258
|
const queueTask = (queue, write) => (cb) => {
|
|
228
259
|
queue.push(cb);
|
|
229
260
|
if (!queuePending) {
|
|
@@ -345,6 +376,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
345
376
|
if (typeof slotName !== "undefined") return slottedNodes;
|
|
346
377
|
}
|
|
347
378
|
slottedNodes = [...slottedNodes, ...getHostSlotNodes(internalCall(childNode, "childNodes"), hostName, slotName)];
|
|
379
|
+
if (typeof slotName !== "undefined" && slottedNodes.length) return slottedNodes;
|
|
348
380
|
}
|
|
349
381
|
return slottedNodes;
|
|
350
382
|
}
|
|
@@ -438,6 +470,50 @@ function findSlotFromSlottedNode(slottedNode, parentHost) {
|
|
|
438
470
|
//#endregion
|
|
439
471
|
//#region src/runtime/dom-extras.ts
|
|
440
472
|
/**
|
|
473
|
+
* Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
|
|
474
|
+
* - `parentNode` returns the host element
|
|
475
|
+
* - `remove()` fires `slotchange` on the node's slot
|
|
476
|
+
*
|
|
477
|
+
* @param node the slotted node to be patched
|
|
478
|
+
*/
|
|
479
|
+
const patchSlottedNode = (node) => {
|
|
480
|
+
patchParentNode(node);
|
|
481
|
+
patchSlottedRemove(node);
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
484
|
+
* Detaches a slotted node from where it physically sits in the component's rendered DOM, through
|
|
485
|
+
* the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
|
|
486
|
+
* `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
|
|
487
|
+
* `removeChild()` would come straight back here.
|
|
488
|
+
*
|
|
489
|
+
* @param node the slotted node to detach
|
|
490
|
+
*/
|
|
491
|
+
const removeSlottedNode = (node) => {
|
|
492
|
+
const parent = internalCall(node, "parentNode");
|
|
493
|
+
if (parent) internalCall(parent, "removeChild")(node);
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
|
|
497
|
+
* `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
|
|
498
|
+
* does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
|
|
499
|
+
*
|
|
500
|
+
* @param node the slotted node to patch
|
|
501
|
+
*/
|
|
502
|
+
const patchSlottedRemove = (node) => {
|
|
503
|
+
const child = node;
|
|
504
|
+
if (!child || child.__remove || typeof child.remove !== "function") return;
|
|
505
|
+
child.__remove = child.remove;
|
|
506
|
+
child.remove = function() {
|
|
507
|
+
const host = this["s-ol"]?.parentElement;
|
|
508
|
+
const { slotNode } = findSlotFromSlottedNode(this);
|
|
509
|
+
removeSlottedNode(this);
|
|
510
|
+
if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
|
|
511
|
+
dispatchSlotChangeEvent(slotNode);
|
|
512
|
+
updateFallbackSlotVisibility(host);
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
/**
|
|
441
517
|
* Patches the `parentNode` accessor of a non-shadow slotted node
|
|
442
518
|
*
|
|
443
519
|
* @param node the slotted node to be patched
|
|
@@ -616,13 +692,15 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
616
692
|
const appliedStyles = getAppliedStyles(styleContainerNode);
|
|
617
693
|
let styleElm;
|
|
618
694
|
const existingStyleElm = (BUILD.hydrateClientSide || BUILD.hotModuleReplacement) && styleContainerNode.querySelector(`[sty-id="${scopeId}"]`);
|
|
619
|
-
if (existingStyleElm)
|
|
620
|
-
|
|
695
|
+
if (existingStyleElm) {
|
|
696
|
+
if (BUILD.hotModuleReplacement) existingStyleElm.textContent = style;
|
|
697
|
+
appliedStyles.add(scopeId);
|
|
698
|
+
} else if (!appliedStyles.has(scopeId)) {
|
|
621
699
|
styleElm = win.document.createElement("style");
|
|
622
700
|
styleElm.textContent = style;
|
|
623
701
|
const nonce = plt.$nonce$ ?? queryNonceMetaTagContent(win.document);
|
|
624
702
|
if (nonce != null) styleElm.setAttribute("nonce", nonce);
|
|
625
|
-
if (BUILD.hydrateServerSide
|
|
703
|
+
if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
|
|
626
704
|
if (BUILD.hotModuleReplacement && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation) styleElm.setAttribute("data-slot-fb", "");
|
|
627
705
|
/**
|
|
628
706
|
* attach styles at the end of the head tag if we render scoped components
|
|
@@ -722,6 +800,10 @@ const attachStyles = (hostRef) => {
|
|
|
722
800
|
*/
|
|
723
801
|
const getScopeId = (cmp, mode) => "sc-" + (BUILD.mode && mode && cmp.$flags$ & CMP_FLAGS.hasMode ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
724
802
|
//#endregion
|
|
803
|
+
//#region src/runtime/signals-core.ts
|
|
804
|
+
const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
|
|
805
|
+
const effect = (fn, options) => getCore().effect(fn, options);
|
|
806
|
+
//#endregion
|
|
725
807
|
//#region src/runtime/event-emitter.ts
|
|
726
808
|
/**
|
|
727
809
|
* Helper function to create & dispatch a custom Event on a provided target
|
|
@@ -735,7 +817,12 @@ const emitEvent = (elm, name, opts) => {
|
|
|
735
817
|
elm.dispatchEvent(ev);
|
|
736
818
|
return ev;
|
|
737
819
|
};
|
|
738
|
-
const getRegistry = () => customElements;
|
|
820
|
+
const getRegistry = () => globalThis.customElements;
|
|
821
|
+
/**
|
|
822
|
+
* @param elm a defined component host
|
|
823
|
+
* @returns the registry the host's class was defined in, else the active registry
|
|
824
|
+
*/
|
|
825
|
+
const getHostRegistry = (elm) => elm.constructor._registry ?? getRegistry();
|
|
739
826
|
//#endregion
|
|
740
827
|
//#region src/runtime/vdom/set-accessor.ts
|
|
741
828
|
/**
|
|
@@ -859,10 +946,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
859
946
|
const isComplex = isComplexType(newValue);
|
|
860
947
|
if (!BUILD.lazyLoad) {
|
|
861
948
|
const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
|
|
862
|
-
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" &&
|
|
949
|
+
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
|
|
863
950
|
if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
|
|
864
951
|
elm["s-pp"].set(memberName, newValue);
|
|
865
|
-
return;
|
|
952
|
+
if (isComplex || /[A-Z]/.test(memberName)) return;
|
|
866
953
|
}
|
|
867
954
|
}
|
|
868
955
|
if ((isProp || isComplex && newValue !== null) && !isSvg) try {
|
|
@@ -889,7 +976,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
889
976
|
xlink = true;
|
|
890
977
|
}
|
|
891
978
|
}
|
|
892
|
-
if (newValue == null || newValue === false) {
|
|
979
|
+
if (newValue == null || newValue === false || isComplex) {
|
|
893
980
|
if (newValue !== false || elm.getAttribute(memberName) === "" || flags & VNODE_FLAGS.isHost && !isEnumeratedAttribute(memberName)) {
|
|
894
981
|
if (BUILD.vdomXlink && xlink) elm.removeAttributeNS(XLINK_NS, memberName);
|
|
895
982
|
else elm.removeAttribute(memberName);
|
|
@@ -980,8 +1067,10 @@ function sortedAttrNames(attrNames) {
|
|
|
980
1067
|
let scopeId;
|
|
981
1068
|
let contentRef;
|
|
982
1069
|
let hostTagName;
|
|
1070
|
+
let hostRegistry;
|
|
983
1071
|
let useNativeShadowDom = false;
|
|
984
1072
|
let checkSlotFallbackVisibility = false;
|
|
1073
|
+
/** Whether the current render has slotted content to relocate. Set at the start of each render. */
|
|
985
1074
|
let checkSlotRelocate = false;
|
|
986
1075
|
let isSvgMode = false;
|
|
987
1076
|
/**
|
|
@@ -989,6 +1078,7 @@ let isSvgMode = false;
|
|
|
989
1078
|
* These ensure that ref callbacks are called in the correct order:
|
|
990
1079
|
* first all removal callbacks (with null), then all attachment callbacks (with elements).
|
|
991
1080
|
*/
|
|
1081
|
+
const initialSlotChanges = /* @__PURE__ */ new Set();
|
|
992
1082
|
const refCallbacksToRemove = [];
|
|
993
1083
|
const refCallbacksToAttach = [];
|
|
994
1084
|
/** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
|
|
@@ -996,16 +1086,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
|
|
|
996
1086
|
const disposeSignalVNode = (vnode) => {
|
|
997
1087
|
const elm = vnode.$elm$;
|
|
998
1088
|
if (elm) {
|
|
999
|
-
|
|
1000
|
-
if (dispose) {
|
|
1001
|
-
dispose();
|
|
1002
|
-
signalNodeDisposers.delete(elm);
|
|
1003
|
-
}
|
|
1089
|
+
disposeTextSignal(elm);
|
|
1004
1090
|
disposeAllSignalAttrs(elm);
|
|
1005
1091
|
}
|
|
1006
1092
|
vnode.$children$?.forEach(disposeSignalVNode);
|
|
1007
1093
|
};
|
|
1008
1094
|
/**
|
|
1095
|
+
* Tear down a text node's signal subscription, if it has one.
|
|
1096
|
+
* @param textNode the text node to unsubscribe
|
|
1097
|
+
*/
|
|
1098
|
+
const disposeTextSignal = (textNode) => {
|
|
1099
|
+
const dispose = signalNodeDisposers.get(textNode);
|
|
1100
|
+
if (dispose) {
|
|
1101
|
+
dispose();
|
|
1102
|
+
signalNodeDisposers.delete(textNode);
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
/**
|
|
1106
|
+
* Subscribe a text node to a signal, keeping its `data` in sync on every change.
|
|
1107
|
+
* @param textNode the text node to keep in sync
|
|
1108
|
+
* @param textSig the signal to subscribe to
|
|
1109
|
+
*/
|
|
1110
|
+
const wireTextSignal = (textNode, textSig) => {
|
|
1111
|
+
signalNodeDisposers.set(textNode, effect(() => {
|
|
1112
|
+
textNode.data = String(textSig.value);
|
|
1113
|
+
}));
|
|
1114
|
+
};
|
|
1115
|
+
/**
|
|
1009
1116
|
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
1010
1117
|
*
|
|
1011
1118
|
* @param oldParentVNode the parent VNode from the previous render
|
|
@@ -1027,13 +1134,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1027
1134
|
if (BUILD.isDev && newVNode.$elm$) consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${String(newVNode.$tag$)}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
|
|
1028
1135
|
if (BUILD.vdomText && newVNode.$text$ != null) {
|
|
1029
1136
|
elm = newVNode.$elm$ = win.document.createTextNode(newVNode.$text$);
|
|
1030
|
-
if (BUILD.vdomSignals && newVNode.$signal$)
|
|
1031
|
-
const textSig = newVNode.$signal$;
|
|
1032
|
-
const textNode = elm;
|
|
1033
|
-
signalNodeDisposers.set(textNode, effect(() => {
|
|
1034
|
-
textNode.data = String(textSig.value);
|
|
1035
|
-
}));
|
|
1036
|
-
}
|
|
1137
|
+
if (BUILD.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
|
|
1037
1138
|
} else if (BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
|
|
1038
1139
|
elm = newVNode.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
|
|
1039
1140
|
if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
|
|
@@ -1042,8 +1143,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1042
1143
|
if (BUILD.svg && !isSvgMode) isSvgMode = newVNode.$tag$ === "svg";
|
|
1043
1144
|
if (!win.document) throw new Error("No DOM environment available for rendering.");
|
|
1044
1145
|
const tag = !useNativeShadowDom && BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotFallback ? "slot-fb" : newVNode.$tag$;
|
|
1045
|
-
const
|
|
1046
|
-
const registryOpts = _reg !== win.customElements && tag.includes("-") ? { customElementRegistry: _reg } : void 0;
|
|
1146
|
+
const registryOpts = hostRegistry !== win.customElements && tag.includes("-") ? { customElementRegistry: hostRegistry } : void 0;
|
|
1047
1147
|
elm = newVNode.$elm$ = BUILD.svg && isSvgMode ? win.document.createElementNS(SVG_NS, tag) : win.document.createElement(tag, registryOpts);
|
|
1048
1148
|
if (BUILD.svg && isSvgMode && newVNode.$tag$ === "foreignObject") isSvgMode = false;
|
|
1049
1149
|
if (BUILD.vdomAttribute) updateElement(null, newVNode, isSvgMode);
|
|
@@ -1301,7 +1401,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
1301
1401
|
}
|
|
1302
1402
|
if (BUILD.vdomKey && idxInOld >= 0) {
|
|
1303
1403
|
elmToMove = oldCh[idxInOld];
|
|
1304
|
-
if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode,
|
|
1404
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
1305
1405
|
else {
|
|
1306
1406
|
patch(elmToMove, newStartVnode, isInitialRender);
|
|
1307
1407
|
oldCh[idxInOld] = void 0;
|
|
@@ -1394,7 +1494,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
1394
1494
|
else if (BUILD.hydrateClientSide && isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
|
|
1395
1495
|
if (BUILD.svg && isSvgMode && tag === "svg") isSvgMode = false;
|
|
1396
1496
|
} else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) defaultHolder.parentNode.textContent = text;
|
|
1397
|
-
else if (BUILD.vdomText
|
|
1497
|
+
else if (BUILD.vdomText) {
|
|
1498
|
+
if (BUILD.vdomSignals && newVNode.$signal$) {
|
|
1499
|
+
if (newVNode.$signal$ !== oldVNode.$signal$) {
|
|
1500
|
+
disposeTextSignal(elm);
|
|
1501
|
+
wireTextSignal(elm, newVNode.$signal$);
|
|
1502
|
+
}
|
|
1503
|
+
} else {
|
|
1504
|
+
if (BUILD.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
|
|
1505
|
+
if (oldVNode.$text$ !== text) elm.data = text;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1398
1508
|
};
|
|
1399
1509
|
/**
|
|
1400
1510
|
* Component-global information about nodes which are either currently being
|
|
@@ -1520,13 +1630,17 @@ const flushQueuedRefCallbacks = () => {
|
|
|
1520
1630
|
*/
|
|
1521
1631
|
const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
1522
1632
|
if (BUILD.slotRelocation) {
|
|
1633
|
+
if (parent?.["s-cr"]) checkSlotRelocate = true;
|
|
1523
1634
|
if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
1524
1635
|
else if (typeof newNode["s-sn"] === "string") {
|
|
1525
1636
|
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
1526
|
-
if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE)
|
|
1637
|
+
if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
|
|
1527
1638
|
parent.insertBefore(newNode, reference);
|
|
1528
1639
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
1529
|
-
if (slotNode
|
|
1640
|
+
if (slotNode) {
|
|
1641
|
+
if (isInitialLoad) initialSlotChanges.add(slotNode);
|
|
1642
|
+
else dispatchSlotChangeEvent(slotNode);
|
|
1643
|
+
}
|
|
1530
1644
|
return newNode;
|
|
1531
1645
|
}
|
|
1532
1646
|
}
|
|
@@ -1582,6 +1696,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
1582
1696
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1583
1697
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
1584
1698
|
hostTagName = hostElm.tagName;
|
|
1699
|
+
hostRegistry = getHostRegistry(hostElm);
|
|
1585
1700
|
if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) throw new Error(`The <Host> must be the single root component.
|
|
1586
1701
|
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
1587
1702
|
|
|
@@ -1618,6 +1733,7 @@ render() {
|
|
|
1618
1733
|
if (BUILD.slotRelocation) {
|
|
1619
1734
|
contentRef = hostElm["s-cr"];
|
|
1620
1735
|
checkSlotFallbackVisibility = false;
|
|
1736
|
+
checkSlotRelocate = !useNativeShadowDom && !!(cmpMeta.$flags$ & CMP_FLAGS.hasSlot);
|
|
1621
1737
|
}
|
|
1622
1738
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
1623
1739
|
if (BUILD.slotRelocation) {
|
|
@@ -1681,8 +1797,13 @@ render() {
|
|
|
1681
1797
|
if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
1682
1798
|
plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
|
|
1683
1799
|
relocateNodes.length = 0;
|
|
1800
|
+
if (initialSlotChanges.size) {
|
|
1801
|
+
const slotNodes = [...initialSlotChanges];
|
|
1802
|
+
initialSlotChanges.clear();
|
|
1803
|
+
nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
|
|
1804
|
+
}
|
|
1684
1805
|
}
|
|
1685
|
-
if (BUILD.slotRelocation && !
|
|
1806
|
+
if (BUILD.slotRelocation && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
|
|
1686
1807
|
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
1687
1808
|
for (const childNode of children) if (childNode["s-hn"] !== hostTagName && childNode["s-sh"] !== hostTagName) {
|
|
1688
1809
|
if (isInitialLoad && childNode["s-ih"] == null) childNode["s-ih"] = childNode.hidden ?? false;
|
|
@@ -2097,9 +2218,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
2097
2218
|
if (classData && !(BUILD.vdomSignals && isSignalLike(classData))) vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
|
|
2098
2219
|
}
|
|
2099
2220
|
}
|
|
2100
|
-
if (BUILD.isDev && vNodeChildren.some(isHost)) consoleDevError(`The <Host> must be the single root component
|
|
2101
|
-
- You are NOT using hostData() and <Host> in the same component.
|
|
2102
|
-
- <Host> is used once, and it's the single root component of the render() function.`);
|
|
2221
|
+
if (BUILD.isDev && vNodeChildren.some(isHost)) consoleDevError(`The <Host> must be used once, and be the single root component of the render() function.`);
|
|
2103
2222
|
if (BUILD.vdomFunctional && typeof nodeName === "function") return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
2104
2223
|
const vnode = newVNode(nodeName, null);
|
|
2105
2224
|
vnode.$attrs$ = vnodeData;
|
|
@@ -2152,17 +2271,23 @@ const vdomFnUtils = {
|
|
|
2152
2271
|
* Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
|
|
2153
2272
|
* friendlier public interface (hence, 'convertToPublic').
|
|
2154
2273
|
*
|
|
2155
|
-
*
|
|
2274
|
+
* Functional components receive primitive children unwrapped, so those
|
|
2275
|
+
* become text-only child nodes.
|
|
2276
|
+
*
|
|
2277
|
+
* @param node the virtual DOM node (or primitive child) to convert
|
|
2156
2278
|
* @returns a converted child node
|
|
2157
2279
|
*/
|
|
2158
|
-
const convertToPublic = (node) =>
|
|
2280
|
+
const convertToPublic = (node) => typeof node !== "object" ? {
|
|
2281
|
+
vtag: null,
|
|
2282
|
+
vtext: String(node)
|
|
2283
|
+
} : {
|
|
2159
2284
|
vattrs: node.$attrs$,
|
|
2160
2285
|
vchildren: node.$children$,
|
|
2161
2286
|
vkey: node.$key$,
|
|
2162
2287
|
vname: node.$name$,
|
|
2163
2288
|
vtag: node.$tag$,
|
|
2164
2289
|
vtext: node.$text$
|
|
2165
|
-
}
|
|
2290
|
+
};
|
|
2166
2291
|
/**
|
|
2167
2292
|
* Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
|
|
2168
2293
|
* order to use the resulting object in the virtual DOM. The initial object was
|
|
@@ -2179,11 +2304,11 @@ const convertToPrivate = (node) => {
|
|
|
2179
2304
|
if (node.vname) vnodeData.name = node.vname;
|
|
2180
2305
|
return h(node.vtag, vnodeData, ...node.vchildren || []);
|
|
2181
2306
|
}
|
|
2182
|
-
const vnode = newVNode(node.vtag, node.vtext);
|
|
2183
|
-
vnode.$attrs$ = node.vattrs;
|
|
2184
|
-
vnode.$children$ = node.vchildren;
|
|
2185
|
-
vnode.$key$ = node.vkey;
|
|
2186
|
-
vnode.$name$ = node.vname;
|
|
2307
|
+
const vnode = newVNode(node.vtag ?? null, node.vtext);
|
|
2308
|
+
vnode.$attrs$ = node.vattrs ?? null;
|
|
2309
|
+
vnode.$children$ = node.vchildren ?? null;
|
|
2310
|
+
vnode.$key$ = node.vkey ?? null;
|
|
2311
|
+
vnode.$name$ = node.vname ?? null;
|
|
2187
2312
|
return vnode;
|
|
2188
2313
|
};
|
|
2189
2314
|
/**
|
|
@@ -2203,7 +2328,10 @@ const validateInputProperties = (inputElm) => {
|
|
|
2203
2328
|
};
|
|
2204
2329
|
//#endregion
|
|
2205
2330
|
//#region src/runtime/mode.ts
|
|
2206
|
-
const setMode = (handler) =>
|
|
2331
|
+
const setMode = (handler) => {
|
|
2332
|
+
modeResolver.length = 0;
|
|
2333
|
+
modeResolver.push(handler);
|
|
2334
|
+
};
|
|
2207
2335
|
const getMode = (ref) => getHostRef(ref)?.$modeName$;
|
|
2208
2336
|
//#endregion
|
|
2209
2337
|
//#region src/runtime/mixin.ts
|
|
@@ -2365,4 +2493,4 @@ function hasKeys(obj) {
|
|
|
2365
2493
|
return false;
|
|
2366
2494
|
}
|
|
2367
2495
|
//#endregion
|
|
2368
|
-
export {
|
|
2496
|
+
export { SSR_PROP_REF_PREFIX as A, Build as C, HYDRATE_ID as D, HYDRATE_CHILD_ID as E, SERVER_BUILD_FLAGS as O, setErrorHandler as S, HYDRATED_CSS as T, getAssetPath as _, transformTag as a, writeTask as b, Mixin as c, Host as d, h as f, getShadowRoot as g, getElement as h, setTagTransformer as i, SSR_PROPS_REGISTRY_KEY as k, getMode as l, getRenderingRef as m, jsxDEV as n, render as o, forceUpdate as p, jsxs as r, ReactiveControllerHost as s, jsx as t, setMode as u, setAssetPath as v, CLIENT_BUILD_FLAGS as w, setPlatformHelpers as x, readTask as y };
|