@uh-design-system/component-library 0.4.1 → 0.4.2
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/cjs/component-library.cjs.js +3 -3
- package/dist/cjs/ds-accordion_3.cjs.entry.js +1 -1
- package/dist/cjs/ds-checkbox-group.cjs.entry.js +2 -2
- package/dist/cjs/ds-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/ds-input-validity.cjs.entry.js +3 -3
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +4 -4
- package/dist/cjs/ds-link.cjs.entry.js +4 -4
- package/dist/cjs/ds-text-input.cjs.entry.js +1 -1
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +1 -1
- package/dist/cjs/{index-b1d61146.js → index-b2bddcf4.js} +221 -134
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +0 -171
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +1 -1
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +3 -3
- package/dist/collection/components/01-base-components/ds-link/ds-link.css +0 -138
- package/dist/collection/components/01-base-components/ds-link/ds-link.js +3 -3
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +4 -1
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +0 -138
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +3 -3
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.stories.js +4 -1
- package/dist/component-library/component-library.esm.js +1 -1
- package/dist/component-library/ds-accordion_3.entry.js +1 -1
- package/dist/component-library/ds-checkbox-group.entry.js +1 -1
- package/dist/component-library/ds-checkbox.entry.js +1 -1
- package/dist/component-library/ds-input-validity.entry.js +1 -1
- package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
- package/dist/component-library/ds-link.entry.js +1 -1
- package/dist/component-library/ds-text-input.entry.js +1 -1
- package/dist/component-library/ds-visually-hidden.entry.js +1 -1
- package/dist/component-library/index-50783b0c.js +2 -0
- package/dist/components/ds-checkbox-group.js +1 -1
- package/dist/components/ds-checkbox2.js +1 -1
- package/dist/components/ds-input-validity2.js +3 -3
- package/dist/components/ds-link-with-arrow.js +4 -4
- package/dist/components/ds-link.js +4 -4
- package/dist/components/index2.js +203 -135
- package/dist/esm/component-library.js +4 -4
- package/dist/esm/ds-accordion_3.entry.js +1 -1
- package/dist/esm/ds-checkbox-group.entry.js +2 -2
- package/dist/esm/ds-checkbox.entry.js +2 -2
- package/dist/esm/ds-input-validity.entry.js +3 -3
- package/dist/esm/ds-link-with-arrow.entry.js +4 -4
- package/dist/esm/ds-link.entry.js +4 -4
- package/dist/esm/ds-text-input.entry.js +1 -1
- package/dist/esm/ds-visually-hidden.entry.js +1 -1
- package/dist/esm/{index-aaccd233.js → index-50783b0c.js} +221 -134
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +1 -1
- package/dist/types/components.d.ts +6 -6
- package/package.json +18 -18
- package/dist/component-library/index-aaccd233.js +0 -2
|
@@ -21,10 +21,10 @@ function _interopNamespace(e) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const NAMESPACE = 'component-library';
|
|
24
|
-
const BUILD = /* component-library */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false,
|
|
24
|
+
const BUILD = /* component-library */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, constructableCSS: true, cssAnnotations: true, devTools: false, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: true, hasRenderFn: true, hostListener: true, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, modernPropertyDecls: true, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: false, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
|
|
25
25
|
|
|
26
26
|
/*
|
|
27
|
-
Stencil Client Platform v4.
|
|
27
|
+
Stencil Client Platform v4.27.2 | MIT Licensed | https://stenciljs.com
|
|
28
28
|
*/
|
|
29
29
|
var __defProp = Object.defineProperty;
|
|
30
30
|
var __export = (target, all) => {
|
|
@@ -57,10 +57,15 @@ var reWireGetterSetter = (instance, hostRef) => {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
// src/client/client-host-ref.ts
|
|
60
|
-
var
|
|
61
|
-
|
|
60
|
+
var getHostRef = (ref) => {
|
|
61
|
+
if (ref.__stencil__getHostRef) {
|
|
62
|
+
return ref.__stencil__getHostRef();
|
|
63
|
+
}
|
|
64
|
+
return void 0;
|
|
65
|
+
};
|
|
62
66
|
var registerInstance = (lazyInstance, hostRef) => {
|
|
63
|
-
|
|
67
|
+
lazyInstance.__stencil__getHostRef = () => hostRef;
|
|
68
|
+
hostRef.$lazyInstance$ = lazyInstance;
|
|
64
69
|
{
|
|
65
70
|
reWireGetterSetter(lazyInstance, hostRef);
|
|
66
71
|
}
|
|
@@ -80,7 +85,8 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
80
85
|
hostElement["s-p"] = [];
|
|
81
86
|
hostElement["s-rc"] = [];
|
|
82
87
|
}
|
|
83
|
-
const ref =
|
|
88
|
+
const ref = hostRef;
|
|
89
|
+
hostElement.__stencil__getHostRef = () => ref;
|
|
84
90
|
return ref;
|
|
85
91
|
};
|
|
86
92
|
var isMemberInElement = (elm, memberName) => memberName in elm;
|
|
@@ -131,7 +137,6 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
|
131
137
|
"formStateRestoreCallback"
|
|
132
138
|
];
|
|
133
139
|
var win = typeof window !== "undefined" ? window : {};
|
|
134
|
-
var doc = win.document || { head: {} };
|
|
135
140
|
var plt = {
|
|
136
141
|
$flags$: 0,
|
|
137
142
|
$resourcesUrl$: "",
|
|
@@ -142,9 +147,10 @@ var plt = {
|
|
|
142
147
|
ce: (eventName, opts) => new CustomEvent(eventName, opts)
|
|
143
148
|
};
|
|
144
149
|
var supportsListenerOptions = /* @__PURE__ */ (() => {
|
|
150
|
+
var _a;
|
|
145
151
|
let supportsListenerOptions2 = false;
|
|
146
152
|
try {
|
|
147
|
-
|
|
153
|
+
(_a = win.document) == null ? void 0 : _a.addEventListener(
|
|
148
154
|
"e",
|
|
149
155
|
null,
|
|
150
156
|
Object.defineProperty({}, "passive", {
|
|
@@ -210,9 +216,9 @@ var isComplexType = (o) => {
|
|
|
210
216
|
};
|
|
211
217
|
|
|
212
218
|
// src/utils/query-nonce-meta-tag-content.ts
|
|
213
|
-
function queryNonceMetaTagContent(
|
|
219
|
+
function queryNonceMetaTagContent(doc) {
|
|
214
220
|
var _a, _b, _c;
|
|
215
|
-
return (_c = (_b = (_a =
|
|
221
|
+
return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
// src/utils/result.ts
|
|
@@ -264,12 +270,11 @@ var unwrapErr = (result) => {
|
|
|
264
270
|
}
|
|
265
271
|
};
|
|
266
272
|
var updateFallbackSlotVisibility = (elm) => {
|
|
267
|
-
const childNodes = elm
|
|
273
|
+
const childNodes = internalCall(elm, "childNodes");
|
|
268
274
|
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
|
|
269
275
|
getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
|
|
270
|
-
var _a;
|
|
271
276
|
if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
|
|
272
|
-
if ((
|
|
277
|
+
if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
|
|
273
278
|
slotNode.hidden = true;
|
|
274
279
|
} else {
|
|
275
280
|
slotNode.hidden = false;
|
|
@@ -277,19 +282,31 @@ var updateFallbackSlotVisibility = (elm) => {
|
|
|
277
282
|
}
|
|
278
283
|
});
|
|
279
284
|
}
|
|
280
|
-
|
|
281
|
-
|
|
285
|
+
let i2 = 0;
|
|
286
|
+
for (i2 = 0; i2 < childNodes.length; i2++) {
|
|
287
|
+
const childNode = childNodes[i2];
|
|
288
|
+
if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
|
|
282
289
|
updateFallbackSlotVisibility(childNode);
|
|
283
290
|
}
|
|
284
291
|
}
|
|
285
292
|
};
|
|
293
|
+
var getSlottedChildNodes = (childNodes) => {
|
|
294
|
+
const result = [];
|
|
295
|
+
for (let i2 = 0; i2 < childNodes.length; i2++) {
|
|
296
|
+
const slottedNode = childNodes[i2]["s-nr"] || void 0;
|
|
297
|
+
if (slottedNode && slottedNode.isConnected) {
|
|
298
|
+
result.push(slottedNode);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return result;
|
|
302
|
+
};
|
|
286
303
|
function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
287
304
|
let i2 = 0;
|
|
288
305
|
let slottedNodes = [];
|
|
289
306
|
let childNode;
|
|
290
307
|
for (; i2 < childNodes.length; i2++) {
|
|
291
308
|
childNode = childNodes[i2];
|
|
292
|
-
if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode
|
|
309
|
+
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
|
|
293
310
|
slottedNodes.push(childNode);
|
|
294
311
|
if (typeof slotName !== "undefined") return slottedNodes;
|
|
295
312
|
}
|
|
@@ -297,11 +314,12 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
297
314
|
}
|
|
298
315
|
return slottedNodes;
|
|
299
316
|
}
|
|
300
|
-
var
|
|
317
|
+
var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
|
|
301
318
|
const childNodes = [];
|
|
302
|
-
if (includeSlot &&
|
|
303
|
-
|
|
304
|
-
|
|
319
|
+
if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
|
|
320
|
+
let node = slot;
|
|
321
|
+
while (node = node.nextSibling) {
|
|
322
|
+
if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
|
|
305
323
|
}
|
|
306
324
|
return childNodes;
|
|
307
325
|
};
|
|
@@ -320,6 +338,44 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
|
|
320
338
|
}
|
|
321
339
|
return slotName === "";
|
|
322
340
|
};
|
|
341
|
+
var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
|
|
342
|
+
function patchSlotNode(node) {
|
|
343
|
+
if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
|
|
344
|
+
const assignedFactory = (elementsOnly) => (function(opts) {
|
|
345
|
+
const toReturn = [];
|
|
346
|
+
const slotName = this["s-sn"];
|
|
347
|
+
if (opts == null ? void 0 : opts.flatten) {
|
|
348
|
+
console.error(`
|
|
349
|
+
Flattening is not supported for Stencil non-shadow slots.
|
|
350
|
+
You can use \`.childNodes\` to nested slot fallback content.
|
|
351
|
+
If you have a particular use case, please open an issue on the Stencil repo.
|
|
352
|
+
`);
|
|
353
|
+
}
|
|
354
|
+
const parent = this["s-cr"].parentElement;
|
|
355
|
+
const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
|
|
356
|
+
slottedNodes.forEach((n) => {
|
|
357
|
+
if (slotName === getSlotName(n)) {
|
|
358
|
+
toReturn.push(n);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
if (elementsOnly) {
|
|
362
|
+
return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
|
|
363
|
+
}
|
|
364
|
+
return toReturn;
|
|
365
|
+
}).bind(node);
|
|
366
|
+
node.assignedElements = assignedFactory(true);
|
|
367
|
+
node.assignedNodes = assignedFactory(false);
|
|
368
|
+
}
|
|
369
|
+
function internalCall(node, method) {
|
|
370
|
+
if ("__" + method in node) {
|
|
371
|
+
const toReturn = node["__" + method];
|
|
372
|
+
if (typeof toReturn !== "function") return toReturn;
|
|
373
|
+
return toReturn.bind(node);
|
|
374
|
+
} else {
|
|
375
|
+
if (typeof node[method] !== "function") return node[method];
|
|
376
|
+
return node[method].bind(node);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
323
379
|
var createTime = (fnName, tagName = "") => {
|
|
324
380
|
{
|
|
325
381
|
return () => {
|
|
@@ -500,7 +556,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
500
556
|
var _a;
|
|
501
557
|
const scopeId2 = getScopeId(cmpMeta);
|
|
502
558
|
const style = styles.get(scopeId2);
|
|
503
|
-
|
|
559
|
+
if (!win.document) {
|
|
560
|
+
return scopeId2;
|
|
561
|
+
}
|
|
562
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
|
|
504
563
|
if (style) {
|
|
505
564
|
if (typeof style === "string") {
|
|
506
565
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -511,9 +570,9 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
511
570
|
}
|
|
512
571
|
if (!appliedStyles.has(scopeId2)) {
|
|
513
572
|
{
|
|
514
|
-
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) ||
|
|
573
|
+
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
|
|
515
574
|
styleElm.innerHTML = style;
|
|
516
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(
|
|
575
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
517
576
|
if (nonce != null) {
|
|
518
577
|
styleElm.setAttribute("nonce", nonce);
|
|
519
578
|
}
|
|
@@ -575,104 +634,105 @@ var attachStyles = (hostRef) => {
|
|
|
575
634
|
};
|
|
576
635
|
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
|
577
636
|
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
578
|
-
if (oldValue
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
} else {
|
|
596
|
-
elm.style[prop] = "";
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
for (const prop in newValue) {
|
|
602
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
637
|
+
if (oldValue === newValue) {
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
641
|
+
let ln = memberName.toLowerCase();
|
|
642
|
+
if (memberName === "class") {
|
|
643
|
+
const classList = elm.classList;
|
|
644
|
+
const oldClasses = parseClassList(oldValue);
|
|
645
|
+
let newClasses = parseClassList(newValue);
|
|
646
|
+
{
|
|
647
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
648
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
649
|
+
}
|
|
650
|
+
} else if (memberName === "style") {
|
|
651
|
+
{
|
|
652
|
+
for (const prop in oldValue) {
|
|
653
|
+
if (!newValue || newValue[prop] == null) {
|
|
603
654
|
if (prop.includes("-")) {
|
|
604
|
-
elm.style.
|
|
655
|
+
elm.style.removeProperty(prop);
|
|
605
656
|
} else {
|
|
606
|
-
elm.style[prop] =
|
|
657
|
+
elm.style[prop] = "";
|
|
607
658
|
}
|
|
608
659
|
}
|
|
609
660
|
}
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
} else if (isMemberInElement(win, ln)) {
|
|
618
|
-
memberName = ln.slice(2);
|
|
619
|
-
} else {
|
|
620
|
-
memberName = ln[2] + memberName.slice(3);
|
|
621
|
-
}
|
|
622
|
-
if (oldValue || newValue) {
|
|
623
|
-
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
624
|
-
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
625
|
-
if (oldValue) {
|
|
626
|
-
plt.rel(elm, memberName, oldValue, capture);
|
|
627
|
-
}
|
|
628
|
-
if (newValue) {
|
|
629
|
-
plt.ael(elm, memberName, newValue, capture);
|
|
661
|
+
}
|
|
662
|
+
for (const prop in newValue) {
|
|
663
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
664
|
+
if (prop.includes("-")) {
|
|
665
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
666
|
+
} else {
|
|
667
|
+
elm.style[prop] = newValue[prop];
|
|
630
668
|
}
|
|
631
669
|
}
|
|
670
|
+
}
|
|
671
|
+
} else if (memberName === "key") ; else if (memberName === "ref") {
|
|
672
|
+
if (newValue) {
|
|
673
|
+
newValue(elm);
|
|
674
|
+
}
|
|
675
|
+
} else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
|
|
676
|
+
if (memberName[2] === "-") {
|
|
677
|
+
memberName = memberName.slice(3);
|
|
678
|
+
} else if (isMemberInElement(win, ln)) {
|
|
679
|
+
memberName = ln.slice(2);
|
|
632
680
|
} else {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
681
|
+
memberName = ln[2] + memberName.slice(3);
|
|
682
|
+
}
|
|
683
|
+
if (oldValue || newValue) {
|
|
684
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
685
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
686
|
+
if (oldValue) {
|
|
687
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
688
|
+
}
|
|
689
|
+
if (newValue) {
|
|
690
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
} else {
|
|
694
|
+
const isComplex = isComplexType(newValue);
|
|
695
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
696
|
+
try {
|
|
697
|
+
if (!elm.tagName.includes("-")) {
|
|
698
|
+
const n = newValue == null ? "" : newValue;
|
|
699
|
+
if (memberName === "list") {
|
|
700
|
+
isProp = false;
|
|
701
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
|
702
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
703
|
+
elm[memberName] = n;
|
|
704
|
+
} else {
|
|
705
|
+
elm.setAttribute(memberName, n);
|
|
646
706
|
}
|
|
647
|
-
} else if (elm[memberName] !== newValue) {
|
|
648
|
-
elm[memberName] = newValue;
|
|
649
707
|
}
|
|
650
|
-
}
|
|
708
|
+
} else if (elm[memberName] !== newValue) {
|
|
709
|
+
elm[memberName] = newValue;
|
|
651
710
|
}
|
|
711
|
+
} catch (e) {
|
|
652
712
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
713
|
+
}
|
|
714
|
+
let xlink = false;
|
|
715
|
+
{
|
|
716
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
|
|
717
|
+
memberName = ln;
|
|
718
|
+
xlink = true;
|
|
659
719
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
664
|
-
} else {
|
|
665
|
-
elm.removeAttribute(memberName);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
669
|
-
newValue = newValue === true ? "" : newValue;
|
|
720
|
+
}
|
|
721
|
+
if (newValue == null || newValue === false) {
|
|
722
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
670
723
|
if (xlink) {
|
|
671
|
-
elm.
|
|
724
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
672
725
|
} else {
|
|
673
|
-
elm.
|
|
726
|
+
elm.removeAttribute(memberName);
|
|
674
727
|
}
|
|
675
728
|
}
|
|
729
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
730
|
+
newValue = newValue === true ? "" : newValue;
|
|
731
|
+
if (xlink) {
|
|
732
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
733
|
+
} else {
|
|
734
|
+
elm.setAttribute(memberName, newValue);
|
|
735
|
+
}
|
|
676
736
|
}
|
|
677
737
|
}
|
|
678
738
|
};
|
|
@@ -758,11 +818,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
758
818
|
}
|
|
759
819
|
}
|
|
760
820
|
if (newVNode2.$text$ !== null) {
|
|
761
|
-
elm = newVNode2.$elm$ =
|
|
821
|
+
elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
|
|
762
822
|
} else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
763
|
-
elm = newVNode2.$elm$ =
|
|
823
|
+
elm = newVNode2.$elm$ = win.document.createTextNode("");
|
|
824
|
+
{
|
|
825
|
+
updateElement(null, newVNode2, isSvgMode);
|
|
826
|
+
}
|
|
764
827
|
} else {
|
|
765
|
-
|
|
828
|
+
if (!win.document) {
|
|
829
|
+
throw new Error(
|
|
830
|
+
"You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
elm = newVNode2.$elm$ = win.document.createElement(
|
|
766
834
|
!useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
767
835
|
);
|
|
768
836
|
{
|
|
@@ -787,6 +855,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
787
855
|
elm["s-cr"] = contentRef;
|
|
788
856
|
elm["s-sn"] = newVNode2.$name$ || "";
|
|
789
857
|
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
|
858
|
+
patchSlotNode(elm);
|
|
790
859
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
791
860
|
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
792
861
|
{
|
|
@@ -976,14 +1045,11 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
976
1045
|
const elm = newVNode2.$elm$ = oldVNode.$elm$;
|
|
977
1046
|
const oldChildren = oldVNode.$children$;
|
|
978
1047
|
const newChildren = newVNode2.$children$;
|
|
979
|
-
const tag = newVNode2.$tag$;
|
|
980
1048
|
const text = newVNode2.$text$;
|
|
981
1049
|
let defaultHolder;
|
|
982
1050
|
if (text === null) {
|
|
983
1051
|
{
|
|
984
|
-
|
|
985
|
-
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
986
|
-
}
|
|
1052
|
+
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
987
1053
|
}
|
|
988
1054
|
if (oldChildren !== null && newChildren !== null) {
|
|
989
1055
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
@@ -1122,8 +1188,8 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
1122
1188
|
markSlotContentForRelocation(rootVnode.$elm$);
|
|
1123
1189
|
for (const relocateData of relocateNodes) {
|
|
1124
1190
|
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1125
|
-
if (!nodeToRelocate["s-ol"]) {
|
|
1126
|
-
const orgLocationNode =
|
|
1191
|
+
if (!nodeToRelocate["s-ol"] && win.document) {
|
|
1192
|
+
const orgLocationNode = win.document.createTextNode("");
|
|
1127
1193
|
orgLocationNode["s-nr"] = nodeToRelocate;
|
|
1128
1194
|
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
|
1129
1195
|
}
|
|
@@ -1164,7 +1230,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
1164
1230
|
}
|
|
1165
1231
|
}
|
|
1166
1232
|
}
|
|
1167
|
-
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](
|
|
1233
|
+
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
|
|
1168
1234
|
} else {
|
|
1169
1235
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1170
1236
|
if (isInitialLoad) {
|
|
@@ -1227,10 +1293,11 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1227
1293
|
hostRef.$queuedListeners$ = void 0;
|
|
1228
1294
|
}
|
|
1229
1295
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1296
|
+
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
1297
|
+
} else {
|
|
1298
|
+
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
1233
1299
|
}
|
|
1300
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
1234
1301
|
endSchedule();
|
|
1235
1302
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1236
1303
|
};
|
|
@@ -1296,14 +1363,13 @@ var postUpdateComponent = (hostRef) => {
|
|
|
1296
1363
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
1297
1364
|
const instance = hostRef.$lazyInstance$ ;
|
|
1298
1365
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1366
|
+
safeCall(instance, "componentDidRender", void 0, elm);
|
|
1299
1367
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1300
1368
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1301
1369
|
{
|
|
1302
1370
|
addHydratedFlag(elm);
|
|
1303
1371
|
}
|
|
1304
|
-
|
|
1305
|
-
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
1306
|
-
}
|
|
1372
|
+
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
1307
1373
|
endPostUpdate();
|
|
1308
1374
|
{
|
|
1309
1375
|
hostRef.$onReadyResolve$(elm);
|
|
@@ -1312,9 +1378,7 @@ var postUpdateComponent = (hostRef) => {
|
|
|
1312
1378
|
}
|
|
1313
1379
|
}
|
|
1314
1380
|
} else {
|
|
1315
|
-
|
|
1316
|
-
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
1317
|
-
}
|
|
1381
|
+
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
1318
1382
|
endPostUpdate();
|
|
1319
1383
|
}
|
|
1320
1384
|
{
|
|
@@ -1355,7 +1419,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1355
1419
|
const hostRef = getHostRef(ref);
|
|
1356
1420
|
if (!hostRef) {
|
|
1357
1421
|
throw new Error(
|
|
1358
|
-
`Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/
|
|
1422
|
+
`Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
|
|
1359
1423
|
);
|
|
1360
1424
|
}
|
|
1361
1425
|
const elm = hostRef.$hostElement$ ;
|
|
@@ -1381,6 +1445,11 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1381
1445
|
}
|
|
1382
1446
|
}
|
|
1383
1447
|
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1448
|
+
if (instance.componentShouldUpdate) {
|
|
1449
|
+
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1384
1453
|
scheduleUpdate(hostRef, false);
|
|
1385
1454
|
}
|
|
1386
1455
|
}
|
|
@@ -1582,6 +1651,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1582
1651
|
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1583
1652
|
}
|
|
1584
1653
|
endNewInstance();
|
|
1654
|
+
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
1585
1655
|
} else {
|
|
1586
1656
|
Cstr = elm.constructor;
|
|
1587
1657
|
const cmpTag = elm.localName;
|
|
@@ -1609,6 +1679,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1609
1679
|
}
|
|
1610
1680
|
};
|
|
1611
1681
|
var fireConnectedCallback = (instance, elm) => {
|
|
1682
|
+
{
|
|
1683
|
+
safeCall(instance, "connectedCallback", void 0, elm);
|
|
1684
|
+
}
|
|
1612
1685
|
};
|
|
1613
1686
|
|
|
1614
1687
|
// src/runtime/connected-callback.ts
|
|
@@ -1648,21 +1721,29 @@ var connectedCallback = (elm) => {
|
|
|
1648
1721
|
}
|
|
1649
1722
|
} else {
|
|
1650
1723
|
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
1651
|
-
if (hostRef == null ? void 0 : hostRef.$lazyInstance$)
|
|
1652
|
-
hostRef.$
|
|
1724
|
+
if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
1725
|
+
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
1726
|
+
} else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
|
|
1727
|
+
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
|
|
1653
1728
|
}
|
|
1654
1729
|
}
|
|
1655
1730
|
endConnected();
|
|
1656
1731
|
}
|
|
1657
1732
|
};
|
|
1658
1733
|
var setContentReference = (elm) => {
|
|
1659
|
-
|
|
1734
|
+
if (!win.document) {
|
|
1735
|
+
return;
|
|
1736
|
+
}
|
|
1737
|
+
const contentRefElm = elm["s-cr"] = win.document.createComment(
|
|
1660
1738
|
""
|
|
1661
1739
|
);
|
|
1662
1740
|
contentRefElm["s-cn"] = true;
|
|
1663
1741
|
insertBefore(elm, contentRefElm, elm.firstChild);
|
|
1664
1742
|
};
|
|
1665
1743
|
var disconnectInstance = (instance, elm) => {
|
|
1744
|
+
{
|
|
1745
|
+
safeCall(instance, "disconnectedCallback", void 0, elm || instance);
|
|
1746
|
+
}
|
|
1666
1747
|
};
|
|
1667
1748
|
var disconnectedCallback = async (elm) => {
|
|
1668
1749
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
@@ -1673,8 +1754,10 @@ var disconnectedCallback = async (elm) => {
|
|
|
1673
1754
|
hostRef.$rmListeners$ = void 0;
|
|
1674
1755
|
}
|
|
1675
1756
|
}
|
|
1676
|
-
if (hostRef == null ? void 0 : hostRef.$lazyInstance$)
|
|
1677
|
-
hostRef.$
|
|
1757
|
+
if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
1758
|
+
disconnectInstance(hostRef.$lazyInstance$, elm);
|
|
1759
|
+
} else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
|
|
1760
|
+
hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
|
|
1678
1761
|
}
|
|
1679
1762
|
}
|
|
1680
1763
|
if (rootAppliedStyles.has(elm)) {
|
|
@@ -1688,18 +1771,22 @@ var disconnectedCallback = async (elm) => {
|
|
|
1688
1771
|
// src/runtime/bootstrap-lazy.ts
|
|
1689
1772
|
var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1690
1773
|
var _a;
|
|
1774
|
+
if (!win.document) {
|
|
1775
|
+
console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1691
1778
|
const endBootstrap = createTime();
|
|
1692
1779
|
const cmpTags = [];
|
|
1693
1780
|
const exclude = options.exclude || [];
|
|
1694
1781
|
const customElements2 = win.customElements;
|
|
1695
|
-
const head =
|
|
1782
|
+
const head = win.document.head;
|
|
1696
1783
|
const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
|
|
1697
|
-
const dataStyles = /* @__PURE__ */
|
|
1784
|
+
const dataStyles = /* @__PURE__ */ win.document.createElement("style");
|
|
1698
1785
|
const deferredConnectedCallbacks = [];
|
|
1699
1786
|
let appLoadFallback;
|
|
1700
1787
|
let isBootstrapping = true;
|
|
1701
1788
|
Object.assign(plt, options);
|
|
1702
|
-
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./",
|
|
1789
|
+
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
|
|
1703
1790
|
let hasSlotRelocation = false;
|
|
1704
1791
|
lazyBundles.map((lazyBundle) => {
|
|
1705
1792
|
lazyBundle[1].map((compactMeta) => {
|
|
@@ -1802,7 +1889,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1802
1889
|
}
|
|
1803
1890
|
if (dataStyles.innerHTML.length) {
|
|
1804
1891
|
dataStyles.setAttribute("data-styles", "");
|
|
1805
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(
|
|
1892
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
1806
1893
|
if (nonce != null) {
|
|
1807
1894
|
dataStyles.setAttribute("nonce", nonce);
|
|
1808
1895
|
}
|
|
@@ -1823,7 +1910,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1823
1910
|
// src/runtime/fragment.ts
|
|
1824
1911
|
var Fragment = (_, children) => children;
|
|
1825
1912
|
var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1826
|
-
if (listeners) {
|
|
1913
|
+
if (listeners && win.document) {
|
|
1827
1914
|
listeners.map(([flags, name, method]) => {
|
|
1828
1915
|
const target = elm;
|
|
1829
1916
|
const handler = hostListenerProxy(hostRef, method);
|