@stencil/core 5.0.0-beta.30 → 5.0.0-beta.31
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/{client-BYvfR_Hx.mjs → client-DIvBaMnB.mjs} +55 -2
- package/dist/compiler/browser.js +11 -4
- package/dist/compiler/index.mjs +2 -2
- package/dist/{compiler-6RhuOkQ0.mjs → compiler-BI12oAIV.mjs} +15 -8
- package/dist/declarations/stencil-public-runtime.d.ts +2 -0
- package/dist/{index-BHciXst1.d.ts → index-CicD4Pgn.d.ts} +2 -0
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-CvPPhnWO.mjs → node-D-21Ykxi.mjs} +1 -1
- package/dist/runtime/client/lazy.js +69 -11
- package/dist/runtime/client/runtime.d.ts +2 -0
- package/dist/runtime/client/runtime.js +69 -11
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +69 -11
- package/dist/runtime/server/index.mjs +69 -11
- package/dist/sys/node/index.mjs +1 -1
- package/dist/sys/node/worker.mjs +2 -2
- package/dist/testing/index.mjs +70 -12
- package/package.json +4 -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-CicD4Pgn.js";
|
|
2
2
|
export { BUILD, Env, NAMESPACE };
|
|
@@ -459,6 +459,50 @@ function findSlotFromSlottedNode(slottedNode, parentHost) {
|
|
|
459
459
|
//#endregion
|
|
460
460
|
//#region src/runtime/dom-extras.ts
|
|
461
461
|
/**
|
|
462
|
+
* Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
|
|
463
|
+
* - `parentNode` returns the host element
|
|
464
|
+
* - `remove()` fires `slotchange` on the node's slot
|
|
465
|
+
*
|
|
466
|
+
* @param node the slotted node to be patched
|
|
467
|
+
*/
|
|
468
|
+
const patchSlottedNode = (node) => {
|
|
469
|
+
patchParentNode(node);
|
|
470
|
+
patchSlottedRemove(node);
|
|
471
|
+
};
|
|
472
|
+
/**
|
|
473
|
+
* Detaches a slotted node from where it physically sits in the component's rendered DOM, through
|
|
474
|
+
* the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
|
|
475
|
+
* `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
|
|
476
|
+
* `removeChild()` would come straight back here.
|
|
477
|
+
*
|
|
478
|
+
* @param node the slotted node to detach
|
|
479
|
+
*/
|
|
480
|
+
const removeSlottedNode = (node) => {
|
|
481
|
+
const parent = internalCall(node, "parentNode");
|
|
482
|
+
if (parent) internalCall(parent, "removeChild")(node);
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
|
|
486
|
+
* `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
|
|
487
|
+
* does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
|
|
488
|
+
*
|
|
489
|
+
* @param node the slotted node to patch
|
|
490
|
+
*/
|
|
491
|
+
const patchSlottedRemove = (node) => {
|
|
492
|
+
const child = node;
|
|
493
|
+
if (!child || child.__remove || typeof child.remove !== "function") return;
|
|
494
|
+
child.__remove = child.remove;
|
|
495
|
+
child.remove = function() {
|
|
496
|
+
const host = this["s-ol"]?.parentElement;
|
|
497
|
+
const { slotNode } = findSlotFromSlottedNode(this);
|
|
498
|
+
removeSlottedNode(this);
|
|
499
|
+
if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
|
|
500
|
+
dispatchSlotChangeEvent(slotNode);
|
|
501
|
+
updateFallbackSlotVisibility(host);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
/**
|
|
462
506
|
* Patches the `parentNode` accessor of a non-shadow slotted node
|
|
463
507
|
*
|
|
464
508
|
* @param node the slotted node to be patched
|
|
@@ -1020,6 +1064,7 @@ let isSvgMode = false;
|
|
|
1020
1064
|
* These ensure that ref callbacks are called in the correct order:
|
|
1021
1065
|
* first all removal callbacks (with null), then all attachment callbacks (with elements).
|
|
1022
1066
|
*/
|
|
1067
|
+
const initialSlotChanges = /* @__PURE__ */ new Set();
|
|
1023
1068
|
const refCallbacksToRemove = [];
|
|
1024
1069
|
const refCallbacksToAttach = [];
|
|
1025
1070
|
/** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
|
|
@@ -1574,10 +1619,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
1574
1619
|
if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
1575
1620
|
else if (typeof newNode["s-sn"] === "string") {
|
|
1576
1621
|
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
1577
|
-
if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE)
|
|
1622
|
+
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);
|
|
1578
1623
|
parent.insertBefore(newNode, reference);
|
|
1579
1624
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
1580
|
-
if (slotNode
|
|
1625
|
+
if (slotNode) {
|
|
1626
|
+
if (isInitialLoad) initialSlotChanges.add(slotNode);
|
|
1627
|
+
else dispatchSlotChangeEvent(slotNode);
|
|
1628
|
+
}
|
|
1581
1629
|
return newNode;
|
|
1582
1630
|
}
|
|
1583
1631
|
}
|
|
@@ -1733,6 +1781,11 @@ render() {
|
|
|
1733
1781
|
if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
1734
1782
|
plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
|
|
1735
1783
|
relocateNodes.length = 0;
|
|
1784
|
+
if (initialSlotChanges.size) {
|
|
1785
|
+
const slotNodes = [...initialSlotChanges];
|
|
1786
|
+
initialSlotChanges.clear();
|
|
1787
|
+
nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
|
|
1788
|
+
}
|
|
1736
1789
|
}
|
|
1737
1790
|
if (BUILD.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
|
|
1738
1791
|
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
package/dist/compiler/browser.js
CHANGED
|
@@ -1843,7 +1843,7 @@ const validateComponentTag = (tag) => {
|
|
|
1843
1843
|
};
|
|
1844
1844
|
//#endregion
|
|
1845
1845
|
//#region src/version.ts
|
|
1846
|
-
const version = "5.0.0-beta.
|
|
1846
|
+
const version = "5.0.0-beta.31";
|
|
1847
1847
|
//#endregion
|
|
1848
1848
|
//#region src/compiler/events.ts
|
|
1849
1849
|
const buildEvents = () => {
|
|
@@ -12829,7 +12829,8 @@ const parseMethodDecorator = (config, diagnostics, tsSourceFile, typeChecker, pr
|
|
|
12829
12829
|
const returnTypeNode = typeChecker.typeToTypeNode(returnType, method, ts$1.NodeBuilderFlags.NoTruncation | ts$1.NodeBuilderFlags.NoTypeReduction);
|
|
12830
12830
|
let returnString = typeToString(typeChecker, returnType);
|
|
12831
12831
|
let signatureString = typeChecker.signatureToString(signature, method, flags, ts$1.SignatureKind.Call);
|
|
12832
|
-
|
|
12832
|
+
const isAsync = !!method.modifiers?.some((m) => m.kind === ts$1.SyntaxKind.AsyncKeyword);
|
|
12833
|
+
if (!config._isTesting && !isAsync) {
|
|
12833
12834
|
if (returnString === "void") {
|
|
12834
12835
|
const warn = buildWarn(diagnostics);
|
|
12835
12836
|
warn.header = "@Method requires async";
|
|
@@ -15044,6 +15045,8 @@ function extractAncestorMeta(ancestor, cmpSourceFile, resolveImport, config) {
|
|
|
15044
15045
|
"events",
|
|
15045
15046
|
"listeners",
|
|
15046
15047
|
"watchers",
|
|
15048
|
+
"serializers",
|
|
15049
|
+
"deserializers",
|
|
15047
15050
|
"methods"
|
|
15048
15051
|
].includes(m.name.text));
|
|
15049
15052
|
if (!hasUsableStaticMembers && className) {
|
|
@@ -15063,6 +15066,8 @@ function extractAncestorMeta(ancestor, cmpSourceFile, resolveImport, config) {
|
|
|
15063
15066
|
events: reanchorInheritedTypeReferences(reclassifyGlobalTypeReferences(parseStaticEvents(resolvedStaticMembers) ?? [], parentSf, resolvedPath, resolveImport), resolvedPath, cmpSourceFile.fileName),
|
|
15064
15067
|
listeners: parseStaticListeners(resolvedStaticMembers) ?? [],
|
|
15065
15068
|
watchers: parseStaticWatchers(resolvedStaticMembers) ?? [],
|
|
15069
|
+
serializers: parseStaticSerializers(resolvedStaticMembers, "serializers") ?? [],
|
|
15070
|
+
deserializers: parseStaticSerializers(resolvedStaticMembers, "deserializers") ?? [],
|
|
15066
15071
|
methodNames: resolvedClassNode.members.filter(ts$1.isMethodDeclaration).map((m) => ts$1.isIdentifier(m.name) ? m.name.text : "").filter(Boolean)
|
|
15067
15072
|
};
|
|
15068
15073
|
}
|
|
@@ -15092,8 +15097,8 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
|
|
|
15092
15097
|
let events = parseStaticEvents(staticMembers);
|
|
15093
15098
|
let watchers = parseStaticWatchers(staticMembers);
|
|
15094
15099
|
let classMethods = cmpNode.members.filter(ts$1.isMethodDeclaration).map((m) => ts$1.isIdentifier(m.name) ? m.name.text : "").filter(Boolean);
|
|
15095
|
-
|
|
15096
|
-
|
|
15100
|
+
let serializers = parseStaticSerializers(staticMembers, "serializers");
|
|
15101
|
+
let deserializers = parseStaticSerializers(staticMembers, "deserializers");
|
|
15097
15102
|
const ancestors = [];
|
|
15098
15103
|
resolveAncestors(cmpNode, sourceFile, sourceFile.fileName, resolveImport, /* @__PURE__ */ new Set(), ancestors, cmpNode, buildCtx);
|
|
15099
15104
|
ancestors.forEach((ancestor) => {
|
|
@@ -15107,6 +15112,8 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
|
|
|
15107
15112
|
events = [...deDupeMembers(parentMeta.events, events), ...events];
|
|
15108
15113
|
listeners = [...deDupeMembers(parentMeta.listeners, listeners), ...listeners];
|
|
15109
15114
|
watchers = [...deDupeMembers(parentMeta.watchers, watchers), ...watchers];
|
|
15115
|
+
serializers = [...deDupeMembers(parentMeta.serializers ?? [], serializers), ...serializers];
|
|
15116
|
+
deserializers = [...deDupeMembers(parentMeta.deserializers ?? [], deserializers), ...deserializers];
|
|
15110
15117
|
classMethods = [...classMethods, ...parentMeta.methodNames];
|
|
15111
15118
|
});
|
|
15112
15119
|
return {
|
package/dist/compiler/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-
|
|
2
|
-
import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-
|
|
1
|
+
import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-BI12oAIV.mjs";
|
|
2
|
+
import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-D-21Ykxi.mjs";
|
|
3
3
|
export { CustomElementsExportBehaviorOptions, LOG_LEVELS, buildHydrateCss, buildId, cmpMetaToDocsComponent, createCompiler, createPrerenderer, createSystem, createWorkerContext, createWorkerMessageHandler, foldBuildFlags, generateComponentTypesFile, generateManifest, getScopeId, hasStencilCssComponentsImport, hasStencilGlobalsImport, hasStencilHydrateImport, loadConfig, nodeRequire, optimizeCss, optimizeJs, parseCssOnlyComponents, replaceStencilCssComponentsImport, replaceStencilGlobalsImport, replaceStencilHydrateImport, scopeCss, transpile, transpileSync, ts, validateConfig, validateHydrated, vermoji, version, versions };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import { E as SERVER_BUILD_FLAGS, T as HYDRATED_CSS, w as CLIENT_BUILD_FLAGS } from "./client-
|
|
2
|
+
import { E as SERVER_BUILD_FLAGS, T as HYDRATED_CSS, w as CLIENT_BUILD_FLAGS } from "./client-DIvBaMnB.mjs";
|
|
3
3
|
import { $ as VALID_CONFIG_OUTPUT_TARGETS, A as DIST_LAZY, D as COPY, E as COLLECTION_MANIFEST_FILE_NAME, J as STANDALONE, L as EVENT_FLAGS, P as DOCS_JSON, Q as TYPES, R as GENERATED_DTS, S as ASSETS, T as COLLECTION_APP_DATA_FILE_NAME, U as LOADER_BUNDLE, X as STYLE_EXT, Y as STATS, a as isBoolean$1, b as unique, c as isFunction, d as isObject, et as WATCH_FLAGS, f as isString$1, g as sortBy, i as fromEntries, l as isIterable, m as noop, p as mergeIntoWith, r as flatOne, t as dashToPascalCase, u as isNumber$1, v as toDashCase, w as COLLECTION, y as toTitleCase, z as GLOBAL_STYLE } from "./helpers-Cpp3qc3u.mjs";
|
|
4
4
|
import { E as escapeRegExpSpecialCharacters, S as formatComponentRuntimeMeta, T as byteSize, _ as loadRolldownDiagnostics, a as getSourceMappingUrlForEndOfFile, b as splitLineBreaks, c as err, f as augmentDiagnosticWithNode, g as isRolldownError, h as createOnWarnFn, i as getInlineSourceMappingUrlLinker, l as map, m as loadTypeScriptDiagnostics, n as validateComponentTag, p as loadTypeScriptDiagnostic, r as isRemoteUrl, s as rolldownToStencilSourceMap, t as validateComponentModes, u as ok, w as stringifyRuntimeData, x as isRootPath, y as normalizeDiagnostics } from "./validation-DAdGTrys.mjs";
|
|
5
5
|
import { $ as catchError, A as isOutputTargetDocsVscode, B as relativeImport, C as isOutputTargetDistLazy, D as isOutputTargetDocsCustomElementsManifest, E as isOutputTargetDocsCustom, F as isOutputTargetStandalone, G as normalizeFsPathQuery, H as join$2, I as isOutputTargetStats, J as resolve$2, K as normalizePath, L as isOutputTargetTypes, M as isOutputTargetLoaderBundle, N as isOutputTargetSsr, O as isOutputTargetDocsJson, P as isOutputTargetSsrWasm, Q as buildWarn, R as isOutputTargetWww, S as isOutputTargetCustom, T as isOutputTargetDocsAgentSkill, V as shouldExcludeComponent, W as normalizeFsPath, X as buildError, Z as buildJsonFileError, a as hasDependency, b as isOutputTargetCollection, d as parsePackageJson, et as hasError, f as readOnlyArrayHasStringMember, g as getComponentsDtsSrcFilePath, h as filterExcludedComponents, i as getTextDocs, j as isOutputTargetGlobalStyle, k as isOutputTargetDocsReadme, l as isTsFile, m as filterActiveTargets, n as createJsVarName, o as isDtsFile, p as readPackageJson, q as relative$1, r as generatePreamble, rt as isGlob, t as addDocBlock, tt as hasWarning, u as isTsxFile, v as getComponentsFromModules, w as isOutputTargetDocs, x as isOutputTargetCopy, y as isOutputTargetAssets, z as isValidConfigOutputTarget } from "./util-IKfWWLJo.mjs";
|
|
6
|
-
import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-
|
|
6
|
+
import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-D-21Ykxi.mjs";
|
|
7
7
|
import ts, { default as ts$1 } from "typescript";
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
@@ -461,9 +461,9 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
461
461
|
};
|
|
462
462
|
//#endregion
|
|
463
463
|
//#region src/version.ts
|
|
464
|
-
const version = "5.0.0-beta.
|
|
465
|
-
const buildId = "
|
|
466
|
-
const vermoji = "
|
|
464
|
+
const version = "5.0.0-beta.31";
|
|
465
|
+
const buildId = "1793811862";
|
|
466
|
+
const vermoji = "🤘";
|
|
467
467
|
/**
|
|
468
468
|
* Get the installed version of a tool/dependency.
|
|
469
469
|
* Handles packages with exports maps that point to subdirectories.
|
|
@@ -16107,7 +16107,8 @@ const parseMethodDecorator = (config, diagnostics, tsSourceFile, typeChecker, pr
|
|
|
16107
16107
|
const returnTypeNode = typeChecker.typeToTypeNode(returnType, method, ts.NodeBuilderFlags.NoTruncation | ts.NodeBuilderFlags.NoTypeReduction);
|
|
16108
16108
|
let returnString = typeToString(typeChecker, returnType);
|
|
16109
16109
|
let signatureString = typeChecker.signatureToString(signature, method, flags, ts.SignatureKind.Call);
|
|
16110
|
-
|
|
16110
|
+
const isAsync = !!method.modifiers?.some((m) => m.kind === ts.SyntaxKind.AsyncKeyword);
|
|
16111
|
+
if (!config._isTesting && !isAsync) {
|
|
16111
16112
|
if (returnString === "void") {
|
|
16112
16113
|
const warn = buildWarn(diagnostics);
|
|
16113
16114
|
warn.header = "@Method requires async";
|
|
@@ -17893,6 +17894,8 @@ function extractAncestorMeta(ancestor, cmpSourceFile, resolveImport, config) {
|
|
|
17893
17894
|
"events",
|
|
17894
17895
|
"listeners",
|
|
17895
17896
|
"watchers",
|
|
17897
|
+
"serializers",
|
|
17898
|
+
"deserializers",
|
|
17896
17899
|
"methods"
|
|
17897
17900
|
].includes(m.name.text));
|
|
17898
17901
|
if (!hasUsableStaticMembers && className) {
|
|
@@ -17912,6 +17915,8 @@ function extractAncestorMeta(ancestor, cmpSourceFile, resolveImport, config) {
|
|
|
17912
17915
|
events: reanchorInheritedTypeReferences(reclassifyGlobalTypeReferences(parseStaticEvents(resolvedStaticMembers) ?? [], parentSf, resolvedPath, resolveImport), resolvedPath, cmpSourceFile.fileName),
|
|
17913
17916
|
listeners: parseStaticListeners(resolvedStaticMembers) ?? [],
|
|
17914
17917
|
watchers: parseStaticWatchers(resolvedStaticMembers) ?? [],
|
|
17918
|
+
serializers: parseStaticSerializers(resolvedStaticMembers, "serializers") ?? [],
|
|
17919
|
+
deserializers: parseStaticSerializers(resolvedStaticMembers, "deserializers") ?? [],
|
|
17915
17920
|
methodNames: resolvedClassNode.members.filter(ts.isMethodDeclaration).map((m) => ts.isIdentifier(m.name) ? m.name.text : "").filter(Boolean)
|
|
17916
17921
|
};
|
|
17917
17922
|
}
|
|
@@ -17941,8 +17946,8 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
|
|
|
17941
17946
|
let events = parseStaticEvents(staticMembers);
|
|
17942
17947
|
let watchers = parseStaticWatchers(staticMembers);
|
|
17943
17948
|
let classMethods = cmpNode.members.filter(ts.isMethodDeclaration).map((m) => ts.isIdentifier(m.name) ? m.name.text : "").filter(Boolean);
|
|
17944
|
-
|
|
17945
|
-
|
|
17949
|
+
let serializers = parseStaticSerializers(staticMembers, "serializers");
|
|
17950
|
+
let deserializers = parseStaticSerializers(staticMembers, "deserializers");
|
|
17946
17951
|
const ancestors = [];
|
|
17947
17952
|
resolveAncestors(cmpNode, sourceFile, sourceFile.fileName, resolveImport, /* @__PURE__ */ new Set(), ancestors, cmpNode, buildCtx);
|
|
17948
17953
|
ancestors.forEach((ancestor) => {
|
|
@@ -17956,6 +17961,8 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
|
|
|
17956
17961
|
events = [...deDupeMembers(parentMeta.events, events), ...events];
|
|
17957
17962
|
listeners = [...deDupeMembers(parentMeta.listeners, listeners), ...listeners];
|
|
17958
17963
|
watchers = [...deDupeMembers(parentMeta.watchers, watchers), ...watchers];
|
|
17964
|
+
serializers = [...deDupeMembers(parentMeta.serializers ?? [], serializers), ...serializers];
|
|
17965
|
+
deserializers = [...deDupeMembers(parentMeta.deserializers ?? [], deserializers), ...deserializers];
|
|
17959
17966
|
classMethods = [...classMethods, ...parentMeta.methodNames];
|
|
17960
17967
|
});
|
|
17961
17968
|
return {
|
|
@@ -2069,6 +2069,8 @@ interface JSXAttributes<T = globalThis.Element> {
|
|
|
2069
2069
|
key?: string | number;
|
|
2070
2070
|
ref?: (elm?: T) => void;
|
|
2071
2071
|
children?: any;
|
|
2072
|
+
[key: `attr:${string}`]: any;
|
|
2073
|
+
[key: `prop:${string}`]: any;
|
|
2072
2074
|
}
|
|
2073
2075
|
interface CustomElementsDefineOptions {
|
|
2074
2076
|
exclude?: string[];
|
|
@@ -1336,6 +1336,8 @@ interface JSXAttributes<T = globalThis.Element> {
|
|
|
1336
1336
|
key?: string | number;
|
|
1337
1337
|
ref?: (elm?: T) => void;
|
|
1338
1338
|
children?: any;
|
|
1339
|
+
[key: `attr:${string}`]: any;
|
|
1340
|
+
[key: `prop:${string}`]: any;
|
|
1339
1341
|
}
|
|
1340
1342
|
interface CustomElementsDefineOptions {
|
|
1341
1343
|
exclude?: string[];
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Build, S as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, x as setPlatformHelpers, y as readTask } from "./client-
|
|
1
|
+
import { C as Build, S as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, x as setPlatformHelpers, y as readTask } from "./client-DIvBaMnB.mjs";
|
|
2
2
|
import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
|
|
3
3
|
//#region src/client/client-decorators.ts
|
|
4
4
|
/**
|
package/dist/jsx-runtime.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import "./client-
|
|
2
|
+
import "./client-DIvBaMnB.mjs";
|
|
3
3
|
import { c as isFunction, f as isString, m as noop, r as flatOne } from "./helpers-Cpp3qc3u.mjs";
|
|
4
4
|
import { $ as catchError, K as normalizePath, X as buildError, Y as TASK_CANCELED_MSG, nt as shouldIgnoreError, rt as isGlob } from "./util-IKfWWLJo.mjs";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -978,6 +978,7 @@ const patchSlotAppendChild = (HostElementPrototype) => {
|
|
|
978
978
|
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
979
979
|
if (slotNode) {
|
|
980
980
|
addSlotRelocateNode(newChild, slotNode);
|
|
981
|
+
patchSlottedNode(newChild);
|
|
981
982
|
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
982
983
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
983
984
|
const insertedNode = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, appendAfter.nextSibling);
|
|
@@ -1000,8 +1001,10 @@ const patchSlotRemoveChild = (ElementPrototype) => {
|
|
|
1000
1001
|
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
|
1001
1002
|
ElementPrototype.removeChild = function(toRemove) {
|
|
1002
1003
|
if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
|
|
1003
|
-
|
|
1004
|
-
|
|
1004
|
+
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, toRemove["s-sn"]);
|
|
1005
|
+
if (slotNode && toRemove.isConnected) {
|
|
1006
|
+
removeSlottedNode(toRemove);
|
|
1007
|
+
if (slotNode[0]) dispatchSlotChangeEvent(slotNode[0]);
|
|
1005
1008
|
updateFallbackSlotVisibility(this);
|
|
1006
1009
|
return;
|
|
1007
1010
|
}
|
|
@@ -1024,6 +1027,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
|
|
|
1024
1027
|
const slotNode = getHostSlotNodes(internalCall(this, "childNodes"), this.tagName, slotName)[0];
|
|
1025
1028
|
if (slotNode) {
|
|
1026
1029
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
1030
|
+
patchSlottedNode(newChild);
|
|
1027
1031
|
const appendAfter = getSlotChildSiblings(slotNode, slotName)[0];
|
|
1028
1032
|
const toReturn = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
1029
1033
|
dispatchSlotChangeEvent(slotNode);
|
|
@@ -1099,6 +1103,7 @@ const patchInsertBefore = (HostElementPrototype) => {
|
|
|
1099
1103
|
}
|
|
1100
1104
|
if (slotName === currentChild["s-sn"]) {
|
|
1101
1105
|
addSlotRelocateNode(newChild, slotNode);
|
|
1106
|
+
patchSlottedNode(newChild);
|
|
1102
1107
|
internalCall(internalCall(currentChild, "parentNode"), "insertBefore")(newChild, currentChild);
|
|
1103
1108
|
dispatchSlotChangeEvent(slotNode);
|
|
1104
1109
|
}
|
|
@@ -1177,10 +1182,21 @@ const patchChildSlotNodes = (elm) => {
|
|
|
1177
1182
|
} });
|
|
1178
1183
|
};
|
|
1179
1184
|
/**
|
|
1180
|
-
* Patches
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1185
|
+
* Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
|
|
1186
|
+
* - `parentNode` returns the host element
|
|
1187
|
+
* - `remove()` fires `slotchange` on the node's slot
|
|
1188
|
+
*
|
|
1189
|
+
* @param node the slotted node to be patched
|
|
1190
|
+
*/
|
|
1191
|
+
const patchSlottedNode = (node) => {
|
|
1192
|
+
patchParentNode(node);
|
|
1193
|
+
patchSlottedRemove(node);
|
|
1194
|
+
};
|
|
1195
|
+
/**
|
|
1196
|
+
* Patches a slotted node from SSR markup: everything {@link patchSlottedNode} does, plus its
|
|
1197
|
+
* sibling accessors, so whilst stepping through a non-shadow element's nodes only the mock
|
|
1198
|
+
* 'lightDOM' nodes are returned. Frameworks hydrating SSR output often reconcile their VDOM with
|
|
1199
|
+
* the real DOM by stepping through nodes with 'nextSibling' et al.
|
|
1184
1200
|
* - `nextSibling`
|
|
1185
1201
|
* - `nextElementSibling`
|
|
1186
1202
|
* - `previousSibling`
|
|
@@ -1188,11 +1204,11 @@ const patchChildSlotNodes = (elm) => {
|
|
|
1188
1204
|
*
|
|
1189
1205
|
* @param node the slotted node to be patched
|
|
1190
1206
|
*/
|
|
1191
|
-
const
|
|
1207
|
+
const patchSsrSlottedNode = (node) => {
|
|
1192
1208
|
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
1193
1209
|
patchNextSibling(node);
|
|
1194
1210
|
patchPreviousSibling(node);
|
|
1195
|
-
|
|
1211
|
+
patchSlottedNode(node);
|
|
1196
1212
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
1197
1213
|
patchNextElementSibling(node);
|
|
1198
1214
|
patchPreviousElementSibling(node);
|
|
@@ -1259,6 +1275,39 @@ const patchPreviousElementSibling = (element) => {
|
|
|
1259
1275
|
} });
|
|
1260
1276
|
};
|
|
1261
1277
|
/**
|
|
1278
|
+
* Detaches a slotted node from where it physically sits in the component's rendered DOM, through
|
|
1279
|
+
* the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
|
|
1280
|
+
* `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
|
|
1281
|
+
* `removeChild()` would come straight back here.
|
|
1282
|
+
*
|
|
1283
|
+
* @param node the slotted node to detach
|
|
1284
|
+
*/
|
|
1285
|
+
const removeSlottedNode = (node) => {
|
|
1286
|
+
const parent = internalCall(node, "parentNode");
|
|
1287
|
+
if (parent) internalCall(parent, "removeChild")(node);
|
|
1288
|
+
};
|
|
1289
|
+
/**
|
|
1290
|
+
* Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
|
|
1291
|
+
* `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
|
|
1292
|
+
* does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
|
|
1293
|
+
*
|
|
1294
|
+
* @param node the slotted node to patch
|
|
1295
|
+
*/
|
|
1296
|
+
const patchSlottedRemove = (node) => {
|
|
1297
|
+
const child = node;
|
|
1298
|
+
if (!child || child.__remove || typeof child.remove !== "function") return;
|
|
1299
|
+
child.__remove = child.remove;
|
|
1300
|
+
child.remove = function() {
|
|
1301
|
+
const host = this["s-ol"]?.parentElement;
|
|
1302
|
+
const { slotNode } = findSlotFromSlottedNode(this);
|
|
1303
|
+
removeSlottedNode(this);
|
|
1304
|
+
if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
|
|
1305
|
+
dispatchSlotChangeEvent(slotNode);
|
|
1306
|
+
updateFallbackSlotVisibility(host);
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
};
|
|
1310
|
+
/**
|
|
1262
1311
|
* Patches the `parentNode` accessor of a non-shadow slotted node
|
|
1263
1312
|
*
|
|
1264
1313
|
* @param node the slotted node to be patched
|
|
@@ -1997,6 +2046,7 @@ let isSvgMode = false;
|
|
|
1997
2046
|
* These ensure that ref callbacks are called in the correct order:
|
|
1998
2047
|
* first all removal callbacks (with null), then all attachment callbacks (with elements).
|
|
1999
2048
|
*/
|
|
2049
|
+
const initialSlotChanges = /* @__PURE__ */ new Set();
|
|
2000
2050
|
const refCallbacksToRemove = [];
|
|
2001
2051
|
const refCallbacksToAttach = [];
|
|
2002
2052
|
/** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
|
|
@@ -2551,10 +2601,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
2551
2601
|
if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2552
2602
|
else if (typeof newNode["s-sn"] === "string") {
|
|
2553
2603
|
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
2554
|
-
if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE)
|
|
2604
|
+
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);
|
|
2555
2605
|
parent.insertBefore(newNode, reference);
|
|
2556
2606
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2557
|
-
if (slotNode
|
|
2607
|
+
if (slotNode) {
|
|
2608
|
+
if (isInitialLoad) initialSlotChanges.add(slotNode);
|
|
2609
|
+
else dispatchSlotChangeEvent(slotNode);
|
|
2610
|
+
}
|
|
2558
2611
|
return newNode;
|
|
2559
2612
|
}
|
|
2560
2613
|
}
|
|
@@ -2710,6 +2763,11 @@ render() {
|
|
|
2710
2763
|
if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
2711
2764
|
plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
|
|
2712
2765
|
relocateNodes.length = 0;
|
|
2766
|
+
if (initialSlotChanges.size) {
|
|
2767
|
+
const slotNodes = [...initialSlotChanges];
|
|
2768
|
+
initialSlotChanges.clear();
|
|
2769
|
+
nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
|
|
2770
|
+
}
|
|
2713
2771
|
}
|
|
2714
2772
|
if (BUILD.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
|
|
2715
2773
|
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
@@ -3462,7 +3520,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
3462
3520
|
}
|
|
3463
3521
|
addSlotRelocateNode(siNode, siSlot, false, siNode["s-oo"] || currentPos);
|
|
3464
3522
|
if (siNode.parentElement?.shadowRoot && siNode["getAttribute"] && siNode.getAttribute("slot")) siNode.removeAttribute("slot");
|
|
3465
|
-
if (BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)
|
|
3523
|
+
if (BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSsrSlottedNode(siNode);
|
|
3466
3524
|
}
|
|
3467
3525
|
currentPos = (siNode["s-oo"] || currentPos) + 1;
|
|
3468
3526
|
}
|
|
@@ -1347,6 +1347,8 @@ interface JSXAttributes<T = globalThis.Element> {
|
|
|
1347
1347
|
key?: string | number;
|
|
1348
1348
|
ref?: (elm?: T) => void;
|
|
1349
1349
|
children?: any;
|
|
1350
|
+
[key: `attr:${string}`]: any;
|
|
1351
|
+
[key: `prop:${string}`]: any;
|
|
1350
1352
|
}
|
|
1351
1353
|
interface CustomElementsDefineOptions {
|
|
1352
1354
|
exclude?: string[];
|
|
@@ -972,6 +972,7 @@ const patchSlotAppendChild = (HostElementPrototype) => {
|
|
|
972
972
|
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
973
973
|
if (slotNode) {
|
|
974
974
|
addSlotRelocateNode(newChild, slotNode);
|
|
975
|
+
patchSlottedNode(newChild);
|
|
975
976
|
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
976
977
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
977
978
|
const insertedNode = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, appendAfter.nextSibling);
|
|
@@ -994,8 +995,10 @@ const patchSlotRemoveChild = (ElementPrototype) => {
|
|
|
994
995
|
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
|
995
996
|
ElementPrototype.removeChild = function(toRemove) {
|
|
996
997
|
if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
|
|
997
|
-
|
|
998
|
-
|
|
998
|
+
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, toRemove["s-sn"]);
|
|
999
|
+
if (slotNode && toRemove.isConnected) {
|
|
1000
|
+
removeSlottedNode(toRemove);
|
|
1001
|
+
if (slotNode[0]) dispatchSlotChangeEvent(slotNode[0]);
|
|
999
1002
|
updateFallbackSlotVisibility(this);
|
|
1000
1003
|
return;
|
|
1001
1004
|
}
|
|
@@ -1018,6 +1021,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
|
|
|
1018
1021
|
const slotNode = getHostSlotNodes(internalCall(this, "childNodes"), this.tagName, slotName)[0];
|
|
1019
1022
|
if (slotNode) {
|
|
1020
1023
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
1024
|
+
patchSlottedNode(newChild);
|
|
1021
1025
|
const appendAfter = getSlotChildSiblings(slotNode, slotName)[0];
|
|
1022
1026
|
const toReturn = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
1023
1027
|
dispatchSlotChangeEvent(slotNode);
|
|
@@ -1093,6 +1097,7 @@ const patchInsertBefore = (HostElementPrototype) => {
|
|
|
1093
1097
|
}
|
|
1094
1098
|
if (slotName === currentChild["s-sn"]) {
|
|
1095
1099
|
addSlotRelocateNode(newChild, slotNode);
|
|
1100
|
+
patchSlottedNode(newChild);
|
|
1096
1101
|
internalCall(internalCall(currentChild, "parentNode"), "insertBefore")(newChild, currentChild);
|
|
1097
1102
|
dispatchSlotChangeEvent(slotNode);
|
|
1098
1103
|
}
|
|
@@ -1171,10 +1176,21 @@ const patchChildSlotNodes = (elm) => {
|
|
|
1171
1176
|
} });
|
|
1172
1177
|
};
|
|
1173
1178
|
/**
|
|
1174
|
-
* Patches
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1179
|
+
* Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
|
|
1180
|
+
* - `parentNode` returns the host element
|
|
1181
|
+
* - `remove()` fires `slotchange` on the node's slot
|
|
1182
|
+
*
|
|
1183
|
+
* @param node the slotted node to be patched
|
|
1184
|
+
*/
|
|
1185
|
+
const patchSlottedNode = (node) => {
|
|
1186
|
+
patchParentNode(node);
|
|
1187
|
+
patchSlottedRemove(node);
|
|
1188
|
+
};
|
|
1189
|
+
/**
|
|
1190
|
+
* Patches a slotted node from SSR markup: everything {@link patchSlottedNode} does, plus its
|
|
1191
|
+
* sibling accessors, so whilst stepping through a non-shadow element's nodes only the mock
|
|
1192
|
+
* 'lightDOM' nodes are returned. Frameworks hydrating SSR output often reconcile their VDOM with
|
|
1193
|
+
* the real DOM by stepping through nodes with 'nextSibling' et al.
|
|
1178
1194
|
* - `nextSibling`
|
|
1179
1195
|
* - `nextElementSibling`
|
|
1180
1196
|
* - `previousSibling`
|
|
@@ -1182,11 +1198,11 @@ const patchChildSlotNodes = (elm) => {
|
|
|
1182
1198
|
*
|
|
1183
1199
|
* @param node the slotted node to be patched
|
|
1184
1200
|
*/
|
|
1185
|
-
const
|
|
1201
|
+
const patchSsrSlottedNode = (node) => {
|
|
1186
1202
|
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
1187
1203
|
patchNextSibling(node);
|
|
1188
1204
|
patchPreviousSibling(node);
|
|
1189
|
-
|
|
1205
|
+
patchSlottedNode(node);
|
|
1190
1206
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
1191
1207
|
patchNextElementSibling(node);
|
|
1192
1208
|
patchPreviousElementSibling(node);
|
|
@@ -1253,6 +1269,39 @@ const patchPreviousElementSibling = (element) => {
|
|
|
1253
1269
|
} });
|
|
1254
1270
|
};
|
|
1255
1271
|
/**
|
|
1272
|
+
* Detaches a slotted node from where it physically sits in the component's rendered DOM, through
|
|
1273
|
+
* the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
|
|
1274
|
+
* `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
|
|
1275
|
+
* `removeChild()` would come straight back here.
|
|
1276
|
+
*
|
|
1277
|
+
* @param node the slotted node to detach
|
|
1278
|
+
*/
|
|
1279
|
+
const removeSlottedNode = (node) => {
|
|
1280
|
+
const parent = internalCall(node, "parentNode");
|
|
1281
|
+
if (parent) internalCall(parent, "removeChild")(node);
|
|
1282
|
+
};
|
|
1283
|
+
/**
|
|
1284
|
+
* Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
|
|
1285
|
+
* `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
|
|
1286
|
+
* does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
|
|
1287
|
+
*
|
|
1288
|
+
* @param node the slotted node to patch
|
|
1289
|
+
*/
|
|
1290
|
+
const patchSlottedRemove = (node) => {
|
|
1291
|
+
const child = node;
|
|
1292
|
+
if (!child || child.__remove || typeof child.remove !== "function") return;
|
|
1293
|
+
child.__remove = child.remove;
|
|
1294
|
+
child.remove = function() {
|
|
1295
|
+
const host = this["s-ol"]?.parentElement;
|
|
1296
|
+
const { slotNode } = findSlotFromSlottedNode(this);
|
|
1297
|
+
removeSlottedNode(this);
|
|
1298
|
+
if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
|
|
1299
|
+
dispatchSlotChangeEvent(slotNode);
|
|
1300
|
+
updateFallbackSlotVisibility(host);
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1303
|
+
};
|
|
1304
|
+
/**
|
|
1256
1305
|
* Patches the `parentNode` accessor of a non-shadow slotted node
|
|
1257
1306
|
*
|
|
1258
1307
|
* @param node the slotted node to be patched
|
|
@@ -1991,6 +2040,7 @@ let isSvgMode = false;
|
|
|
1991
2040
|
* These ensure that ref callbacks are called in the correct order:
|
|
1992
2041
|
* first all removal callbacks (with null), then all attachment callbacks (with elements).
|
|
1993
2042
|
*/
|
|
2043
|
+
const initialSlotChanges = /* @__PURE__ */ new Set();
|
|
1994
2044
|
const refCallbacksToRemove = [];
|
|
1995
2045
|
const refCallbacksToAttach = [];
|
|
1996
2046
|
/** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
|
|
@@ -2545,10 +2595,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
2545
2595
|
if (BUILD$1.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2546
2596
|
else if (typeof newNode["s-sn"] === "string") {
|
|
2547
2597
|
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
2548
|
-
if ((BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE)
|
|
2598
|
+
if ((BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
|
|
2549
2599
|
parent.insertBefore(newNode, reference);
|
|
2550
2600
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2551
|
-
if (slotNode
|
|
2601
|
+
if (slotNode) {
|
|
2602
|
+
if (isInitialLoad) initialSlotChanges.add(slotNode);
|
|
2603
|
+
else dispatchSlotChangeEvent(slotNode);
|
|
2604
|
+
}
|
|
2552
2605
|
return newNode;
|
|
2553
2606
|
}
|
|
2554
2607
|
}
|
|
@@ -2704,6 +2757,11 @@ render() {
|
|
|
2704
2757
|
if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
2705
2758
|
plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
|
|
2706
2759
|
relocateNodes.length = 0;
|
|
2760
|
+
if (initialSlotChanges.size) {
|
|
2761
|
+
const slotNodes = [...initialSlotChanges];
|
|
2762
|
+
initialSlotChanges.clear();
|
|
2763
|
+
nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
|
|
2764
|
+
}
|
|
2707
2765
|
}
|
|
2708
2766
|
if (BUILD$1.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
|
|
2709
2767
|
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
@@ -3456,7 +3514,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
3456
3514
|
}
|
|
3457
3515
|
addSlotRelocateNode(siNode, siSlot, false, siNode["s-oo"] || currentPos);
|
|
3458
3516
|
if (siNode.parentElement?.shadowRoot && siNode["getAttribute"] && siNode.getAttribute("slot")) siNode.removeAttribute("slot");
|
|
3459
|
-
if (BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)
|
|
3517
|
+
if (BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSsrSlottedNode(siNode);
|
|
3460
3518
|
}
|
|
3461
3519
|
currentPos = (siNode["s-oo"] || currentPos) + 1;
|
|
3462
3520
|
}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ReactiveControllerHostInterface, E as VNode, S as MixedInCtor, T as TagTransformer, _ as ComponentInterface, a as ComponentConstructor, b as HTMLStencilElement, c as ComponentRuntimeMeta, d as HostRef, f as LazyBundlesRuntimeData, g as RuntimeRef, h as RenderNode, i as ChildType, l as ComponentRuntimeMetaCompact, m as PropsType, o as ComponentConstructorChangeHandlers, p as PlatformRuntime, s as ComponentRuntimeHostListener, u as HostElement, v as CustomElementsDefineOptions, w as ResolutionHandler, x as JSXBase, y as FunctionalComponent } from "../index-
|
|
1
|
+
import { C as ReactiveControllerHostInterface, E as VNode, S as MixedInCtor, T as TagTransformer, _ as ComponentInterface, a as ComponentConstructor, b as HTMLStencilElement, c as ComponentRuntimeMeta, d as HostRef, f as LazyBundlesRuntimeData, g as RuntimeRef, h as RenderNode, i as ChildType, l as ComponentRuntimeMetaCompact, m as PropsType, o as ComponentConstructorChangeHandlers, p as PlatformRuntime, s as ComponentRuntimeHostListener, u as HostElement, v as CustomElementsDefineOptions, w as ResolutionHandler, x as JSXBase, y as FunctionalComponent } from "../index-CicD4Pgn.js";
|
|
2
2
|
//#region src/runtime/asset-path.d.ts
|
|
3
3
|
declare const getAssetPath: (path: string) => string;
|
|
4
4
|
declare const setAssetPath: (path: string) => string;
|
package/dist/runtime/index.js
CHANGED
|
@@ -844,6 +844,7 @@ const patchSlotAppendChild = (HostElementPrototype) => {
|
|
|
844
844
|
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
845
845
|
if (slotNode) {
|
|
846
846
|
addSlotRelocateNode(newChild, slotNode);
|
|
847
|
+
patchSlottedNode(newChild);
|
|
847
848
|
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
848
849
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
849
850
|
const insertedNode = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, appendAfter.nextSibling);
|
|
@@ -866,8 +867,10 @@ const patchSlotRemoveChild = (ElementPrototype) => {
|
|
|
866
867
|
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
|
867
868
|
ElementPrototype.removeChild = function(toRemove) {
|
|
868
869
|
if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
|
|
869
|
-
|
|
870
|
-
|
|
870
|
+
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, toRemove["s-sn"]);
|
|
871
|
+
if (slotNode && toRemove.isConnected) {
|
|
872
|
+
removeSlottedNode(toRemove);
|
|
873
|
+
if (slotNode[0]) dispatchSlotChangeEvent(slotNode[0]);
|
|
871
874
|
updateFallbackSlotVisibility(this);
|
|
872
875
|
return;
|
|
873
876
|
}
|
|
@@ -890,6 +893,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
|
|
|
890
893
|
const slotNode = getHostSlotNodes(internalCall(this, "childNodes"), this.tagName, slotName)[0];
|
|
891
894
|
if (slotNode) {
|
|
892
895
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
896
|
+
patchSlottedNode(newChild);
|
|
893
897
|
const appendAfter = getSlotChildSiblings(slotNode, slotName)[0];
|
|
894
898
|
const toReturn = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
895
899
|
dispatchSlotChangeEvent(slotNode);
|
|
@@ -965,6 +969,7 @@ const patchInsertBefore = (HostElementPrototype) => {
|
|
|
965
969
|
}
|
|
966
970
|
if (slotName === currentChild["s-sn"]) {
|
|
967
971
|
addSlotRelocateNode(newChild, slotNode);
|
|
972
|
+
patchSlottedNode(newChild);
|
|
968
973
|
internalCall(internalCall(currentChild, "parentNode"), "insertBefore")(newChild, currentChild);
|
|
969
974
|
dispatchSlotChangeEvent(slotNode);
|
|
970
975
|
}
|
|
@@ -1043,10 +1048,21 @@ const patchChildSlotNodes = (elm) => {
|
|
|
1043
1048
|
} });
|
|
1044
1049
|
};
|
|
1045
1050
|
/**
|
|
1046
|
-
* Patches
|
|
1047
|
-
*
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1051
|
+
* Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
|
|
1052
|
+
* - `parentNode` returns the host element
|
|
1053
|
+
* - `remove()` fires `slotchange` on the node's slot
|
|
1054
|
+
*
|
|
1055
|
+
* @param node the slotted node to be patched
|
|
1056
|
+
*/
|
|
1057
|
+
const patchSlottedNode = (node) => {
|
|
1058
|
+
patchParentNode(node);
|
|
1059
|
+
patchSlottedRemove(node);
|
|
1060
|
+
};
|
|
1061
|
+
/**
|
|
1062
|
+
* Patches a slotted node from SSR markup: everything {@link patchSlottedNode} does, plus its
|
|
1063
|
+
* sibling accessors, so whilst stepping through a non-shadow element's nodes only the mock
|
|
1064
|
+
* 'lightDOM' nodes are returned. Frameworks hydrating SSR output often reconcile their VDOM with
|
|
1065
|
+
* the real DOM by stepping through nodes with 'nextSibling' et al.
|
|
1050
1066
|
* - `nextSibling`
|
|
1051
1067
|
* - `nextElementSibling`
|
|
1052
1068
|
* - `previousSibling`
|
|
@@ -1054,11 +1070,11 @@ const patchChildSlotNodes = (elm) => {
|
|
|
1054
1070
|
*
|
|
1055
1071
|
* @param node the slotted node to be patched
|
|
1056
1072
|
*/
|
|
1057
|
-
const
|
|
1073
|
+
const patchSsrSlottedNode = (node) => {
|
|
1058
1074
|
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
1059
1075
|
patchNextSibling(node);
|
|
1060
1076
|
patchPreviousSibling(node);
|
|
1061
|
-
|
|
1077
|
+
patchSlottedNode(node);
|
|
1062
1078
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
1063
1079
|
patchNextElementSibling(node);
|
|
1064
1080
|
patchPreviousElementSibling(node);
|
|
@@ -1125,6 +1141,39 @@ const patchPreviousElementSibling = (element) => {
|
|
|
1125
1141
|
} });
|
|
1126
1142
|
};
|
|
1127
1143
|
/**
|
|
1144
|
+
* Detaches a slotted node from where it physically sits in the component's rendered DOM, through
|
|
1145
|
+
* the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
|
|
1146
|
+
* `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
|
|
1147
|
+
* `removeChild()` would come straight back here.
|
|
1148
|
+
*
|
|
1149
|
+
* @param node the slotted node to detach
|
|
1150
|
+
*/
|
|
1151
|
+
const removeSlottedNode = (node) => {
|
|
1152
|
+
const parent = internalCall(node, "parentNode");
|
|
1153
|
+
if (parent) internalCall(parent, "removeChild")(node);
|
|
1154
|
+
};
|
|
1155
|
+
/**
|
|
1156
|
+
* Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
|
|
1157
|
+
* `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
|
|
1158
|
+
* does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
|
|
1159
|
+
*
|
|
1160
|
+
* @param node the slotted node to patch
|
|
1161
|
+
*/
|
|
1162
|
+
const patchSlottedRemove = (node) => {
|
|
1163
|
+
const child = node;
|
|
1164
|
+
if (!child || child.__remove || typeof child.remove !== "function") return;
|
|
1165
|
+
child.__remove = child.remove;
|
|
1166
|
+
child.remove = function() {
|
|
1167
|
+
const host = this["s-ol"]?.parentElement;
|
|
1168
|
+
const { slotNode } = findSlotFromSlottedNode(this);
|
|
1169
|
+
removeSlottedNode(this);
|
|
1170
|
+
if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
|
|
1171
|
+
dispatchSlotChangeEvent(slotNode);
|
|
1172
|
+
updateFallbackSlotVisibility(host);
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1175
|
+
};
|
|
1176
|
+
/**
|
|
1128
1177
|
* Patches the `parentNode` accessor of a non-shadow slotted node
|
|
1129
1178
|
*
|
|
1130
1179
|
* @param node the slotted node to be patched
|
|
@@ -1863,6 +1912,7 @@ let isSvgMode = false;
|
|
|
1863
1912
|
* These ensure that ref callbacks are called in the correct order:
|
|
1864
1913
|
* first all removal callbacks (with null), then all attachment callbacks (with elements).
|
|
1865
1914
|
*/
|
|
1915
|
+
const initialSlotChanges = /* @__PURE__ */ new Set();
|
|
1866
1916
|
const refCallbacksToRemove = [];
|
|
1867
1917
|
const refCallbacksToAttach = [];
|
|
1868
1918
|
/** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
|
|
@@ -2417,10 +2467,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
2417
2467
|
if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2418
2468
|
else if (typeof newNode["s-sn"] === "string") {
|
|
2419
2469
|
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
2420
|
-
if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE)
|
|
2470
|
+
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);
|
|
2421
2471
|
parent.insertBefore(newNode, reference);
|
|
2422
2472
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2423
|
-
if (slotNode
|
|
2473
|
+
if (slotNode) {
|
|
2474
|
+
if (isInitialLoad) initialSlotChanges.add(slotNode);
|
|
2475
|
+
else dispatchSlotChangeEvent(slotNode);
|
|
2476
|
+
}
|
|
2424
2477
|
return newNode;
|
|
2425
2478
|
}
|
|
2426
2479
|
}
|
|
@@ -2576,6 +2629,11 @@ render() {
|
|
|
2576
2629
|
if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
2577
2630
|
plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
|
|
2578
2631
|
relocateNodes.length = 0;
|
|
2632
|
+
if (initialSlotChanges.size) {
|
|
2633
|
+
const slotNodes = [...initialSlotChanges];
|
|
2634
|
+
initialSlotChanges.clear();
|
|
2635
|
+
nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
|
|
2636
|
+
}
|
|
2579
2637
|
}
|
|
2580
2638
|
if (BUILD.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
|
|
2581
2639
|
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
@@ -3328,7 +3386,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
3328
3386
|
}
|
|
3329
3387
|
addSlotRelocateNode(siNode, siSlot, false, siNode["s-oo"] || currentPos);
|
|
3330
3388
|
if (siNode.parentElement?.shadowRoot && siNode["getAttribute"] && siNode.getAttribute("slot")) siNode.removeAttribute("slot");
|
|
3331
|
-
if (BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)
|
|
3389
|
+
if (BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSsrSlottedNode(siNode);
|
|
3332
3390
|
}
|
|
3333
3391
|
currentPos = (siNode["s-oo"] || currentPos) + 1;
|
|
3334
3392
|
}
|
|
@@ -640,6 +640,7 @@ const patchSlotAppendChild = (HostElementPrototype) => {
|
|
|
640
640
|
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
641
641
|
if (slotNode) {
|
|
642
642
|
addSlotRelocateNode(newChild, slotNode);
|
|
643
|
+
patchSlottedNode(newChild);
|
|
643
644
|
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
644
645
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
645
646
|
const insertedNode = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, appendAfter.nextSibling);
|
|
@@ -662,8 +663,10 @@ const patchSlotRemoveChild = (ElementPrototype) => {
|
|
|
662
663
|
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
|
663
664
|
ElementPrototype.removeChild = function(toRemove) {
|
|
664
665
|
if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
|
|
665
|
-
|
|
666
|
-
|
|
666
|
+
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, toRemove["s-sn"]);
|
|
667
|
+
if (slotNode && toRemove.isConnected) {
|
|
668
|
+
removeSlottedNode(toRemove);
|
|
669
|
+
if (slotNode[0]) dispatchSlotChangeEvent(slotNode[0]);
|
|
667
670
|
updateFallbackSlotVisibility(this);
|
|
668
671
|
return;
|
|
669
672
|
}
|
|
@@ -686,6 +689,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
|
|
|
686
689
|
const slotNode = getHostSlotNodes(internalCall(this, "childNodes"), this.tagName, slotName)[0];
|
|
687
690
|
if (slotNode) {
|
|
688
691
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
692
|
+
patchSlottedNode(newChild);
|
|
689
693
|
const appendAfter = getSlotChildSiblings(slotNode, slotName)[0];
|
|
690
694
|
const toReturn = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
691
695
|
dispatchSlotChangeEvent(slotNode);
|
|
@@ -761,6 +765,7 @@ const patchInsertBefore = (HostElementPrototype) => {
|
|
|
761
765
|
}
|
|
762
766
|
if (slotName === currentChild["s-sn"]) {
|
|
763
767
|
addSlotRelocateNode(newChild, slotNode);
|
|
768
|
+
patchSlottedNode(newChild);
|
|
764
769
|
internalCall(internalCall(currentChild, "parentNode"), "insertBefore")(newChild, currentChild);
|
|
765
770
|
dispatchSlotChangeEvent(slotNode);
|
|
766
771
|
}
|
|
@@ -839,10 +844,21 @@ const patchChildSlotNodes = (elm) => {
|
|
|
839
844
|
} });
|
|
840
845
|
};
|
|
841
846
|
/**
|
|
842
|
-
* Patches
|
|
843
|
-
*
|
|
844
|
-
*
|
|
845
|
-
*
|
|
847
|
+
* Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
|
|
848
|
+
* - `parentNode` returns the host element
|
|
849
|
+
* - `remove()` fires `slotchange` on the node's slot
|
|
850
|
+
*
|
|
851
|
+
* @param node the slotted node to be patched
|
|
852
|
+
*/
|
|
853
|
+
const patchSlottedNode = (node) => {
|
|
854
|
+
patchParentNode(node);
|
|
855
|
+
patchSlottedRemove(node);
|
|
856
|
+
};
|
|
857
|
+
/**
|
|
858
|
+
* Patches a slotted node from SSR markup: everything {@link patchSlottedNode} does, plus its
|
|
859
|
+
* sibling accessors, so whilst stepping through a non-shadow element's nodes only the mock
|
|
860
|
+
* 'lightDOM' nodes are returned. Frameworks hydrating SSR output often reconcile their VDOM with
|
|
861
|
+
* the real DOM by stepping through nodes with 'nextSibling' et al.
|
|
846
862
|
* - `nextSibling`
|
|
847
863
|
* - `nextElementSibling`
|
|
848
864
|
* - `previousSibling`
|
|
@@ -850,11 +866,11 @@ const patchChildSlotNodes = (elm) => {
|
|
|
850
866
|
*
|
|
851
867
|
* @param node the slotted node to be patched
|
|
852
868
|
*/
|
|
853
|
-
const
|
|
869
|
+
const patchSsrSlottedNode = (node) => {
|
|
854
870
|
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
855
871
|
patchNextSibling(node);
|
|
856
872
|
patchPreviousSibling(node);
|
|
857
|
-
|
|
873
|
+
patchSlottedNode(node);
|
|
858
874
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
859
875
|
patchNextElementSibling(node);
|
|
860
876
|
patchPreviousElementSibling(node);
|
|
@@ -921,6 +937,39 @@ const patchPreviousElementSibling = (element) => {
|
|
|
921
937
|
} });
|
|
922
938
|
};
|
|
923
939
|
/**
|
|
940
|
+
* Detaches a slotted node from where it physically sits in the component's rendered DOM, through
|
|
941
|
+
* the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
|
|
942
|
+
* `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
|
|
943
|
+
* `removeChild()` would come straight back here.
|
|
944
|
+
*
|
|
945
|
+
* @param node the slotted node to detach
|
|
946
|
+
*/
|
|
947
|
+
const removeSlottedNode = (node) => {
|
|
948
|
+
const parent = internalCall(node, "parentNode");
|
|
949
|
+
if (parent) internalCall(parent, "removeChild")(node);
|
|
950
|
+
};
|
|
951
|
+
/**
|
|
952
|
+
* Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
|
|
953
|
+
* `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
|
|
954
|
+
* does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
|
|
955
|
+
*
|
|
956
|
+
* @param node the slotted node to patch
|
|
957
|
+
*/
|
|
958
|
+
const patchSlottedRemove = (node) => {
|
|
959
|
+
const child = node;
|
|
960
|
+
if (!child || child.__remove || typeof child.remove !== "function") return;
|
|
961
|
+
child.__remove = child.remove;
|
|
962
|
+
child.remove = function() {
|
|
963
|
+
const host = this["s-ol"]?.parentElement;
|
|
964
|
+
const { slotNode } = findSlotFromSlottedNode(this);
|
|
965
|
+
removeSlottedNode(this);
|
|
966
|
+
if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
|
|
967
|
+
dispatchSlotChangeEvent(slotNode);
|
|
968
|
+
updateFallbackSlotVisibility(host);
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
};
|
|
972
|
+
/**
|
|
924
973
|
* Patches the `parentNode` accessor of a non-shadow slotted node
|
|
925
974
|
*
|
|
926
975
|
* @param node the slotted node to be patched
|
|
@@ -1627,6 +1676,7 @@ let isSvgMode = false;
|
|
|
1627
1676
|
* These ensure that ref callbacks are called in the correct order:
|
|
1628
1677
|
* first all removal callbacks (with null), then all attachment callbacks (with elements).
|
|
1629
1678
|
*/
|
|
1679
|
+
const initialSlotChanges = /* @__PURE__ */ new Set();
|
|
1630
1680
|
const refCallbacksToRemove = [];
|
|
1631
1681
|
const refCallbacksToAttach = [];
|
|
1632
1682
|
/** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
|
|
@@ -2181,10 +2231,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
2181
2231
|
if (BUILD$1.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2182
2232
|
else if (typeof newNode["s-sn"] === "string") {
|
|
2183
2233
|
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
2184
|
-
if ((BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE)
|
|
2234
|
+
if ((BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
|
|
2185
2235
|
parent.insertBefore(newNode, reference);
|
|
2186
2236
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2187
|
-
if (slotNode
|
|
2237
|
+
if (slotNode) {
|
|
2238
|
+
if (isInitialLoad) initialSlotChanges.add(slotNode);
|
|
2239
|
+
else dispatchSlotChangeEvent(slotNode);
|
|
2240
|
+
}
|
|
2188
2241
|
return newNode;
|
|
2189
2242
|
}
|
|
2190
2243
|
}
|
|
@@ -2340,6 +2393,11 @@ render() {
|
|
|
2340
2393
|
if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
2341
2394
|
plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
|
|
2342
2395
|
relocateNodes.length = 0;
|
|
2396
|
+
if (initialSlotChanges.size) {
|
|
2397
|
+
const slotNodes = [...initialSlotChanges];
|
|
2398
|
+
initialSlotChanges.clear();
|
|
2399
|
+
nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
|
|
2400
|
+
}
|
|
2343
2401
|
}
|
|
2344
2402
|
if (BUILD$1.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
|
|
2345
2403
|
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
@@ -3090,7 +3148,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
3090
3148
|
}
|
|
3091
3149
|
addSlotRelocateNode(siNode, siSlot, false, siNode["s-oo"] || currentPos);
|
|
3092
3150
|
if (siNode.parentElement?.shadowRoot && siNode["getAttribute"] && siNode.getAttribute("slot")) siNode.removeAttribute("slot");
|
|
3093
|
-
if (BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)
|
|
3151
|
+
if (BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSsrSlottedNode(siNode);
|
|
3094
3152
|
}
|
|
3095
3153
|
currentPos = (siNode["s-oo"] || currentPos) + 1;
|
|
3096
3154
|
}
|
package/dist/sys/node/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-
|
|
1
|
+
import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-D-21Ykxi.mjs";
|
|
2
2
|
export { createNodeLogger, createNodeSys, setupNodeProcess };
|
package/dist/sys/node/worker.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as createWorkerMessageHandler } from "../../compiler-
|
|
2
|
-
import { t as createNodeSys } from "../../node-
|
|
1
|
+
import { l as createWorkerMessageHandler } from "../../compiler-BI12oAIV.mjs";
|
|
2
|
+
import { t as createNodeSys } from "../../node-D-21Ykxi.mjs";
|
|
3
3
|
//#region src/sys/node/node-worker-thread.ts
|
|
4
4
|
/**
|
|
5
5
|
* Initialize a worker thread, setting up various machinery for managing
|
package/dist/testing/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ import "@rollup/pluginutils";
|
|
|
33
33
|
import { createHash } from "crypto";
|
|
34
34
|
import { afterAll, vi } from "vitest";
|
|
35
35
|
//#region src/version.ts
|
|
36
|
-
const version = "5.0.0-beta.
|
|
36
|
+
const version = "5.0.0-beta.31";
|
|
37
37
|
const MEMBER_FLAGS = {
|
|
38
38
|
String: 1,
|
|
39
39
|
Number: 2,
|
|
@@ -1472,6 +1472,7 @@ const patchSlotAppendChild = (HostElementPrototype) => {
|
|
|
1472
1472
|
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
1473
1473
|
if (slotNode) {
|
|
1474
1474
|
addSlotRelocateNode(newChild, slotNode);
|
|
1475
|
+
patchSlottedNode(newChild);
|
|
1475
1476
|
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
1476
1477
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
1477
1478
|
const insertedNode = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, appendAfter.nextSibling);
|
|
@@ -1494,8 +1495,10 @@ const patchSlotRemoveChild = (ElementPrototype) => {
|
|
|
1494
1495
|
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
|
1495
1496
|
ElementPrototype.removeChild = function(toRemove) {
|
|
1496
1497
|
if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
|
|
1497
|
-
|
|
1498
|
-
|
|
1498
|
+
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, toRemove["s-sn"]);
|
|
1499
|
+
if (slotNode && toRemove.isConnected) {
|
|
1500
|
+
removeSlottedNode(toRemove);
|
|
1501
|
+
if (slotNode[0]) dispatchSlotChangeEvent(slotNode[0]);
|
|
1499
1502
|
updateFallbackSlotVisibility(this);
|
|
1500
1503
|
return;
|
|
1501
1504
|
}
|
|
@@ -1518,6 +1521,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
|
|
|
1518
1521
|
const slotNode = getHostSlotNodes(internalCall(this, "childNodes"), this.tagName, slotName)[0];
|
|
1519
1522
|
if (slotNode) {
|
|
1520
1523
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
1524
|
+
patchSlottedNode(newChild);
|
|
1521
1525
|
const appendAfter = getSlotChildSiblings(slotNode, slotName)[0];
|
|
1522
1526
|
const toReturn = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
1523
1527
|
dispatchSlotChangeEvent(slotNode);
|
|
@@ -1593,6 +1597,7 @@ const patchInsertBefore = (HostElementPrototype) => {
|
|
|
1593
1597
|
}
|
|
1594
1598
|
if (slotName === currentChild["s-sn"]) {
|
|
1595
1599
|
addSlotRelocateNode(newChild, slotNode);
|
|
1600
|
+
patchSlottedNode(newChild);
|
|
1596
1601
|
internalCall(internalCall(currentChild, "parentNode"), "insertBefore")(newChild, currentChild);
|
|
1597
1602
|
dispatchSlotChangeEvent(slotNode);
|
|
1598
1603
|
}
|
|
@@ -1671,10 +1676,21 @@ const patchChildSlotNodes = (elm) => {
|
|
|
1671
1676
|
} });
|
|
1672
1677
|
};
|
|
1673
1678
|
/**
|
|
1674
|
-
* Patches
|
|
1675
|
-
*
|
|
1676
|
-
*
|
|
1677
|
-
*
|
|
1679
|
+
* Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
|
|
1680
|
+
* - `parentNode` returns the host element
|
|
1681
|
+
* - `remove()` fires `slotchange` on the node's slot
|
|
1682
|
+
*
|
|
1683
|
+
* @param node the slotted node to be patched
|
|
1684
|
+
*/
|
|
1685
|
+
const patchSlottedNode = (node) => {
|
|
1686
|
+
patchParentNode(node);
|
|
1687
|
+
patchSlottedRemove(node);
|
|
1688
|
+
};
|
|
1689
|
+
/**
|
|
1690
|
+
* Patches a slotted node from SSR markup: everything {@link patchSlottedNode} does, plus its
|
|
1691
|
+
* sibling accessors, so whilst stepping through a non-shadow element's nodes only the mock
|
|
1692
|
+
* 'lightDOM' nodes are returned. Frameworks hydrating SSR output often reconcile their VDOM with
|
|
1693
|
+
* the real DOM by stepping through nodes with 'nextSibling' et al.
|
|
1678
1694
|
* - `nextSibling`
|
|
1679
1695
|
* - `nextElementSibling`
|
|
1680
1696
|
* - `previousSibling`
|
|
@@ -1682,11 +1698,11 @@ const patchChildSlotNodes = (elm) => {
|
|
|
1682
1698
|
*
|
|
1683
1699
|
* @param node the slotted node to be patched
|
|
1684
1700
|
*/
|
|
1685
|
-
const
|
|
1701
|
+
const patchSsrSlottedNode = (node) => {
|
|
1686
1702
|
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
1687
1703
|
patchNextSibling(node);
|
|
1688
1704
|
patchPreviousSibling(node);
|
|
1689
|
-
|
|
1705
|
+
patchSlottedNode(node);
|
|
1690
1706
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
1691
1707
|
patchNextElementSibling(node);
|
|
1692
1708
|
patchPreviousElementSibling(node);
|
|
@@ -1753,6 +1769,39 @@ const patchPreviousElementSibling = (element) => {
|
|
|
1753
1769
|
} });
|
|
1754
1770
|
};
|
|
1755
1771
|
/**
|
|
1772
|
+
* Detaches a slotted node from where it physically sits in the component's rendered DOM, through
|
|
1773
|
+
* the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
|
|
1774
|
+
* `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
|
|
1775
|
+
* `removeChild()` would come straight back here.
|
|
1776
|
+
*
|
|
1777
|
+
* @param node the slotted node to detach
|
|
1778
|
+
*/
|
|
1779
|
+
const removeSlottedNode = (node) => {
|
|
1780
|
+
const parent = internalCall(node, "parentNode");
|
|
1781
|
+
if (parent) internalCall(parent, "removeChild")(node);
|
|
1782
|
+
};
|
|
1783
|
+
/**
|
|
1784
|
+
* Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
|
|
1785
|
+
* `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
|
|
1786
|
+
* does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
|
|
1787
|
+
*
|
|
1788
|
+
* @param node the slotted node to patch
|
|
1789
|
+
*/
|
|
1790
|
+
const patchSlottedRemove = (node) => {
|
|
1791
|
+
const child = node;
|
|
1792
|
+
if (!child || child.__remove || typeof child.remove !== "function") return;
|
|
1793
|
+
child.__remove = child.remove;
|
|
1794
|
+
child.remove = function() {
|
|
1795
|
+
const host = this["s-ol"]?.parentElement;
|
|
1796
|
+
const { slotNode } = findSlotFromSlottedNode(this);
|
|
1797
|
+
removeSlottedNode(this);
|
|
1798
|
+
if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
|
|
1799
|
+
dispatchSlotChangeEvent(slotNode);
|
|
1800
|
+
updateFallbackSlotVisibility(host);
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
};
|
|
1804
|
+
/**
|
|
1756
1805
|
* Patches the `parentNode` accessor of a non-shadow slotted node
|
|
1757
1806
|
*
|
|
1758
1807
|
* @param node the slotted node to be patched
|
|
@@ -2382,6 +2431,7 @@ let isSvgMode = false;
|
|
|
2382
2431
|
* These ensure that ref callbacks are called in the correct order:
|
|
2383
2432
|
* first all removal callbacks (with null), then all attachment callbacks (with elements).
|
|
2384
2433
|
*/
|
|
2434
|
+
const initialSlotChanges = /* @__PURE__ */ new Set();
|
|
2385
2435
|
const refCallbacksToRemove = [];
|
|
2386
2436
|
const refCallbacksToAttach = [];
|
|
2387
2437
|
/** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
|
|
@@ -2936,10 +2986,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
2936
2986
|
if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2937
2987
|
else if (typeof newNode["s-sn"] === "string") {
|
|
2938
2988
|
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
2939
|
-
if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE)
|
|
2989
|
+
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);
|
|
2940
2990
|
parent.insertBefore(newNode, reference);
|
|
2941
2991
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2942
|
-
if (slotNode
|
|
2992
|
+
if (slotNode) {
|
|
2993
|
+
if (isInitialLoad) initialSlotChanges.add(slotNode);
|
|
2994
|
+
else dispatchSlotChangeEvent(slotNode);
|
|
2995
|
+
}
|
|
2943
2996
|
return newNode;
|
|
2944
2997
|
}
|
|
2945
2998
|
}
|
|
@@ -3095,6 +3148,11 @@ render() {
|
|
|
3095
3148
|
if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
3096
3149
|
plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
|
|
3097
3150
|
relocateNodes.length = 0;
|
|
3151
|
+
if (initialSlotChanges.size) {
|
|
3152
|
+
const slotNodes = [...initialSlotChanges];
|
|
3153
|
+
initialSlotChanges.clear();
|
|
3154
|
+
nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
|
|
3155
|
+
}
|
|
3098
3156
|
}
|
|
3099
3157
|
if (BUILD.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
|
|
3100
3158
|
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
@@ -3847,7 +3905,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
3847
3905
|
}
|
|
3848
3906
|
addSlotRelocateNode(siNode, siSlot, false, siNode["s-oo"] || currentPos);
|
|
3849
3907
|
if (siNode.parentElement?.shadowRoot && siNode["getAttribute"] && siNode.getAttribute("slot")) siNode.removeAttribute("slot");
|
|
3850
|
-
if (BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)
|
|
3908
|
+
if (BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSsrSlottedNode(siNode);
|
|
3851
3909
|
}
|
|
3852
3910
|
currentPos = (siNode["s-oo"] || currentPos) + 1;
|
|
3853
3911
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.31",
|
|
4
4
|
"description": "A Compiler for Web Components and Progressive Web Apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -126,9 +126,9 @@
|
|
|
126
126
|
"terser": "^5.50.0",
|
|
127
127
|
"tinyglobby": "^0.2.17",
|
|
128
128
|
"typescript": ">5.0.0 <7.0.0",
|
|
129
|
-
"@stencil/
|
|
130
|
-
"@stencil/
|
|
131
|
-
"@stencil/dev-server": "5.0.0-beta.
|
|
129
|
+
"@stencil/mock-doc": "5.0.0-beta.31",
|
|
130
|
+
"@stencil/cli": "5.0.0-beta.31",
|
|
131
|
+
"@stencil/dev-server": "5.0.0-beta.31"
|
|
132
132
|
},
|
|
133
133
|
"devDependencies": {
|
|
134
134
|
"@ionic/prettier-config": "^4.0.0",
|