open-chat-studio-widget 0.4.6 → 0.4.8
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/app-globals-V2Kpy_OQ.js +8 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
- package/dist/cjs/{index-c9203be6.js → index-AhSI5tER.js} +329 -238
- package/dist/cjs/index-AhSI5tER.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +4 -5
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/open-chat-studio-widget.cjs.entry.js +3941 -3904
- package/dist/cjs/open-chat-studio-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/open-chat-studio-widget.cjs.js +8 -7
- package/dist/cjs/open-chat-studio-widget.cjs.js.map +1 -1
- package/dist/cjs/open-chat-studio-widget.entry.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ocs-chat/ocs-chat.css +36 -661
- package/dist/collection/components/ocs-chat/ocs-chat.js +41 -20
- package/dist/collection/components/ocs-chat/ocs-chat.js.map +1 -1
- package/dist/components/index.js +2 -1
- package/dist/components/open-chat-studio-widget.js +3939 -3900
- package/dist/components/open-chat-studio-widget.js.map +1 -1
- package/dist/esm/app-globals-DQuL1Twl.js +6 -0
- package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
- package/dist/esm/{index-0349ca51.js → index-DkJ7OJTS.js} +327 -216
- package/dist/esm/index-DkJ7OJTS.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +5 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/open-chat-studio-widget.entry.js +3942 -3903
- package/dist/esm/open-chat-studio-widget.entry.js.map +1 -1
- package/dist/esm/open-chat-studio-widget.js +7 -5
- package/dist/esm/open-chat-studio-widget.js.map +1 -1
- package/dist/open-chat-studio-widget/index.esm.js.map +1 -1
- package/dist/open-chat-studio-widget/loader.esm.js.map +1 -0
- package/dist/open-chat-studio-widget/open-chat-studio-widget.entry.esm.js.map +1 -0
- package/dist/open-chat-studio-widget/open-chat-studio-widget.esm.js +1 -1
- package/dist/open-chat-studio-widget/open-chat-studio-widget.esm.js.map +1 -1
- package/dist/open-chat-studio-widget/p-DQuL1Twl.js +2 -0
- package/dist/open-chat-studio-widget/p-DQuL1Twl.js.map +1 -0
- package/dist/open-chat-studio-widget/p-DkJ7OJTS.js +3 -0
- package/dist/open-chat-studio-widget/p-DkJ7OJTS.js.map +1 -0
- package/dist/open-chat-studio-widget/p-bde68fbd.entry.js +4 -0
- package/dist/open-chat-studio-widget/p-bde68fbd.entry.js.map +1 -0
- package/dist/types/components/ocs-chat/ocs-chat.d.ts +5 -0
- package/dist/types/components.d.ts +20 -0
- package/dist/types/stencil-public-runtime.d.ts +35 -6
- package/package.json +2 -2
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/index-c9203be6.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js +0 -5
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/index-0349ca51.js.map +0 -1
- package/dist/open-chat-studio-widget/p-16df1b20.entry.js +0 -4
- package/dist/open-chat-studio-widget/p-16df1b20.entry.js.map +0 -1
- package/dist/open-chat-studio-widget/p-3dc66a9a.js +0 -3
- package/dist/open-chat-studio-widget/p-3dc66a9a.js.map +0 -1
- package/dist/open-chat-studio-widget/p-e1255160.js +0 -2
- package/dist/open-chat-studio-widget/p-e1255160.js.map +0 -1
- package/loader/package.json +0 -11
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const NAMESPACE = 'open-chat-studio-widget';
|
|
2
|
-
const BUILD = /* open-chat-studio-widget */ {
|
|
2
|
+
const BUILD = /* open-chat-studio-widget */ { hydratedSelectorName: "hydrated", lazyLoad: true, updatable: true};
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
|
-
Stencil Client Platform v4.
|
|
5
|
+
Stencil Client Platform v4.36.3 | MIT Licensed | https://stenciljs.com
|
|
6
6
|
*/
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __export = (target, all) => {
|
|
@@ -15,10 +15,15 @@ var SVG_NS = "http://www.w3.org/2000/svg";
|
|
|
15
15
|
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
16
16
|
|
|
17
17
|
// src/client/client-host-ref.ts
|
|
18
|
-
var
|
|
19
|
-
|
|
18
|
+
var getHostRef = (ref) => {
|
|
19
|
+
if (ref.__stencil__getHostRef) {
|
|
20
|
+
return ref.__stencil__getHostRef();
|
|
21
|
+
}
|
|
22
|
+
return void 0;
|
|
23
|
+
};
|
|
20
24
|
var registerInstance = (lazyInstance, hostRef) => {
|
|
21
|
-
|
|
25
|
+
lazyInstance.__stencil__getHostRef = () => hostRef;
|
|
26
|
+
hostRef.$lazyInstance$ = lazyInstance;
|
|
22
27
|
};
|
|
23
28
|
var registerHost = (hostElement, cmpMeta) => {
|
|
24
29
|
const hostRef = {
|
|
@@ -32,7 +37,8 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
32
37
|
hostElement["s-p"] = [];
|
|
33
38
|
hostElement["s-rc"] = [];
|
|
34
39
|
}
|
|
35
|
-
const ref =
|
|
40
|
+
const ref = hostRef;
|
|
41
|
+
hostElement.__stencil__getHostRef = () => ref;
|
|
36
42
|
return ref;
|
|
37
43
|
};
|
|
38
44
|
var isMemberInElement = (elm, memberName) => memberName in elm;
|
|
@@ -72,11 +78,9 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
72
78
|
|
|
73
79
|
// src/client/client-style.ts
|
|
74
80
|
var styles = /* @__PURE__ */ new Map();
|
|
75
|
-
var HYDRATED_STYLE_ID = "sty-id";
|
|
76
81
|
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
77
82
|
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
78
83
|
var win = typeof window !== "undefined" ? window : {};
|
|
79
|
-
var doc = win.document || { head: {} };
|
|
80
84
|
var plt = {
|
|
81
85
|
$flags$: 0,
|
|
82
86
|
$resourcesUrl$: "",
|
|
@@ -95,6 +99,7 @@ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
|
|
|
95
99
|
}
|
|
96
100
|
return false;
|
|
97
101
|
})() ;
|
|
102
|
+
var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
|
|
98
103
|
var queuePending = false;
|
|
99
104
|
var queueDomReads = [];
|
|
100
105
|
var queueDomWrites = [];
|
|
@@ -136,11 +141,16 @@ var isComplexType = (o) => {
|
|
|
136
141
|
};
|
|
137
142
|
|
|
138
143
|
// src/utils/query-nonce-meta-tag-content.ts
|
|
139
|
-
function queryNonceMetaTagContent(
|
|
144
|
+
function queryNonceMetaTagContent(doc) {
|
|
140
145
|
var _a, _b, _c;
|
|
141
|
-
return (_c = (_b = (_a =
|
|
146
|
+
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;
|
|
142
147
|
}
|
|
143
148
|
|
|
149
|
+
// src/utils/regular-expression.ts
|
|
150
|
+
var escapeRegExpSpecialCharacters = (text) => {
|
|
151
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
152
|
+
};
|
|
153
|
+
|
|
144
154
|
// src/utils/result.ts
|
|
145
155
|
var result_exports = {};
|
|
146
156
|
__export(result_exports, {
|
|
@@ -189,6 +199,26 @@ var unwrapErr = (result) => {
|
|
|
189
199
|
throw result.value;
|
|
190
200
|
}
|
|
191
201
|
};
|
|
202
|
+
|
|
203
|
+
// src/utils/style.ts
|
|
204
|
+
function createStyleSheetIfNeededAndSupported(styles2) {
|
|
205
|
+
return void 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/utils/shadow-root.ts
|
|
209
|
+
var globalStyleSheet;
|
|
210
|
+
function createShadowRoot(cmpMeta) {
|
|
211
|
+
var _a;
|
|
212
|
+
const shadowRoot = this.attachShadow({ mode: "open" });
|
|
213
|
+
if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
|
|
214
|
+
if (globalStyleSheet) {
|
|
215
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
216
|
+
shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
|
|
217
|
+
} else {
|
|
218
|
+
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
192
222
|
var createTime = (fnName, tagName = "") => {
|
|
193
223
|
{
|
|
194
224
|
return () => {
|
|
@@ -203,6 +233,110 @@ var uniqueTime = (key, measureText) => {
|
|
|
203
233
|
};
|
|
204
234
|
}
|
|
205
235
|
};
|
|
236
|
+
var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
|
|
237
|
+
var registerStyle = (scopeId2, cssText, allowCS) => {
|
|
238
|
+
let style = styles.get(scopeId2);
|
|
239
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
240
|
+
style = style || new CSSStyleSheet();
|
|
241
|
+
if (typeof style === "string") {
|
|
242
|
+
style = cssText;
|
|
243
|
+
} else {
|
|
244
|
+
style.replaceSync(cssText);
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
style = cssText;
|
|
248
|
+
}
|
|
249
|
+
styles.set(scopeId2, style);
|
|
250
|
+
};
|
|
251
|
+
var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
252
|
+
var _a;
|
|
253
|
+
const scopeId2 = getScopeId(cmpMeta);
|
|
254
|
+
const style = styles.get(scopeId2);
|
|
255
|
+
if (!win.document) {
|
|
256
|
+
return scopeId2;
|
|
257
|
+
}
|
|
258
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
|
|
259
|
+
if (style) {
|
|
260
|
+
if (typeof style === "string") {
|
|
261
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
262
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
263
|
+
let styleElm;
|
|
264
|
+
if (!appliedStyles) {
|
|
265
|
+
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
266
|
+
}
|
|
267
|
+
if (!appliedStyles.has(scopeId2)) {
|
|
268
|
+
{
|
|
269
|
+
styleElm = win.document.createElement("style");
|
|
270
|
+
styleElm.innerHTML = style;
|
|
271
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
272
|
+
if (nonce != null) {
|
|
273
|
+
styleElm.setAttribute("nonce", nonce);
|
|
274
|
+
}
|
|
275
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
276
|
+
if (styleContainerNode.nodeName === "HEAD") {
|
|
277
|
+
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
278
|
+
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
279
|
+
styleContainerNode.insertBefore(
|
|
280
|
+
styleElm,
|
|
281
|
+
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
|
282
|
+
);
|
|
283
|
+
} else if ("host" in styleContainerNode) {
|
|
284
|
+
if (supportsConstructableStylesheets) {
|
|
285
|
+
const stylesheet = new CSSStyleSheet();
|
|
286
|
+
stylesheet.replaceSync(style);
|
|
287
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
288
|
+
styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
|
|
289
|
+
} else {
|
|
290
|
+
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
291
|
+
}
|
|
292
|
+
} else {
|
|
293
|
+
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
294
|
+
if (existingStyleContainer) {
|
|
295
|
+
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
296
|
+
} else {
|
|
297
|
+
styleContainerNode.prepend(styleElm);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
styleContainerNode.append(styleElm);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
305
|
+
styleContainerNode.insertBefore(styleElm, null);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
309
|
+
styleElm.innerHTML += SLOT_FB_CSS;
|
|
310
|
+
}
|
|
311
|
+
if (appliedStyles) {
|
|
312
|
+
appliedStyles.add(scopeId2);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
} else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
316
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
317
|
+
styleContainerNode.adoptedStyleSheets.push(style);
|
|
318
|
+
} else {
|
|
319
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return scopeId2;
|
|
324
|
+
};
|
|
325
|
+
var attachStyles = (hostRef) => {
|
|
326
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
327
|
+
const elm = hostRef.$hostElement$;
|
|
328
|
+
const flags = cmpMeta.$flags$;
|
|
329
|
+
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
330
|
+
const scopeId2 = addStyle(
|
|
331
|
+
elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
|
332
|
+
cmpMeta);
|
|
333
|
+
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
334
|
+
elm["s-sc"] = scopeId2;
|
|
335
|
+
elm.classList.add(scopeId2 + "-h");
|
|
336
|
+
}
|
|
337
|
+
endAttachStyles();
|
|
338
|
+
};
|
|
339
|
+
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
|
206
340
|
var h = (nodeName, vnodeData, ...children) => {
|
|
207
341
|
let child = null;
|
|
208
342
|
let key = null;
|
|
@@ -304,13 +438,33 @@ var convertToPrivate = (node) => {
|
|
|
304
438
|
vnode.$name$ = node.vname;
|
|
305
439
|
return vnode;
|
|
306
440
|
};
|
|
307
|
-
var
|
|
441
|
+
var createSupportsRuleRe = (selector) => {
|
|
442
|
+
const safeSelector2 = escapeRegExpSpecialCharacters(selector);
|
|
443
|
+
return new RegExp(
|
|
444
|
+
// First capture group: match any context before the selector that's not inside @supports selector()
|
|
445
|
+
// Using negative lookahead to avoid matching inside @supports selector(...) condition
|
|
446
|
+
`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
|
|
447
|
+
"g"
|
|
448
|
+
);
|
|
449
|
+
};
|
|
450
|
+
createSupportsRuleRe("::slotted");
|
|
451
|
+
createSupportsRuleRe(":host");
|
|
452
|
+
createSupportsRuleRe(":host-context");
|
|
453
|
+
var parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
454
|
+
if (typeof propValue === "string" && (propType & 16 /* Unknown */ || propType & 8 /* Any */) && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
|
|
455
|
+
try {
|
|
456
|
+
return JSON.parse(propValue);
|
|
457
|
+
} catch (e) {
|
|
458
|
+
}
|
|
459
|
+
}
|
|
308
460
|
if (propValue != null && !isComplexType(propValue)) {
|
|
309
461
|
if (propType & 4 /* Boolean */) {
|
|
310
|
-
|
|
462
|
+
{
|
|
463
|
+
return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
464
|
+
}
|
|
311
465
|
}
|
|
312
466
|
if (propType & 2 /* Number */) {
|
|
313
|
-
return parseFloat(propValue);
|
|
467
|
+
return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
|
|
314
468
|
}
|
|
315
469
|
if (propType & 1 /* String */) {
|
|
316
470
|
return String(propValue);
|
|
@@ -319,193 +473,104 @@ var parsePropertyValue = (propValue, propType) => {
|
|
|
319
473
|
}
|
|
320
474
|
return propValue;
|
|
321
475
|
};
|
|
322
|
-
var getElement = (ref) =>
|
|
476
|
+
var getElement = (ref) => {
|
|
477
|
+
var _a;
|
|
478
|
+
return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
|
|
479
|
+
};
|
|
323
480
|
var emitEvent = (elm, name, opts) => {
|
|
324
481
|
const ev = plt.ce(name, opts);
|
|
325
482
|
elm.dispatchEvent(ev);
|
|
326
483
|
return ev;
|
|
327
484
|
};
|
|
328
|
-
var
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
if (supportsConstructableStylesheets && allowCS) {
|
|
332
|
-
style = style || new CSSStyleSheet();
|
|
333
|
-
if (typeof style === "string") {
|
|
334
|
-
style = cssText;
|
|
335
|
-
} else {
|
|
336
|
-
style.replaceSync(cssText);
|
|
337
|
-
}
|
|
338
|
-
} else {
|
|
339
|
-
style = cssText;
|
|
485
|
+
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
486
|
+
if (oldValue === newValue) {
|
|
487
|
+
return;
|
|
340
488
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
351
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
352
|
-
let styleElm;
|
|
353
|
-
if (!appliedStyles) {
|
|
354
|
-
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
355
|
-
}
|
|
356
|
-
if (!appliedStyles.has(scopeId2)) {
|
|
357
|
-
{
|
|
358
|
-
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
|
|
359
|
-
styleElm.innerHTML = style;
|
|
360
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
|
|
361
|
-
if (nonce != null) {
|
|
362
|
-
styleElm.setAttribute("nonce", nonce);
|
|
363
|
-
}
|
|
364
|
-
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
365
|
-
if (styleContainerNode.nodeName === "HEAD") {
|
|
366
|
-
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
367
|
-
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
368
|
-
styleContainerNode.insertBefore(
|
|
369
|
-
styleElm,
|
|
370
|
-
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
|
371
|
-
);
|
|
372
|
-
} else if ("host" in styleContainerNode) {
|
|
373
|
-
if (supportsConstructableStylesheets) {
|
|
374
|
-
const stylesheet = new CSSStyleSheet();
|
|
375
|
-
stylesheet.replaceSync(style);
|
|
376
|
-
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
377
|
-
} else {
|
|
378
|
-
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
379
|
-
if (existingStyleContainer) {
|
|
380
|
-
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
381
|
-
} else {
|
|
382
|
-
styleContainerNode.prepend(styleElm);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
} else {
|
|
386
|
-
styleContainerNode.append(styleElm);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
390
|
-
styleContainerNode.insertBefore(styleElm, null);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
394
|
-
styleElm.innerHTML += SLOT_FB_CSS;
|
|
395
|
-
}
|
|
396
|
-
if (appliedStyles) {
|
|
397
|
-
appliedStyles.add(scopeId2);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
} else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
401
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
489
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
490
|
+
let ln = memberName.toLowerCase();
|
|
491
|
+
if (memberName === "class") {
|
|
492
|
+
const classList = elm.classList;
|
|
493
|
+
const oldClasses = parseClassList(oldValue);
|
|
494
|
+
let newClasses = parseClassList(newValue);
|
|
495
|
+
{
|
|
496
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
497
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
402
498
|
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
408
|
-
const elm = hostRef.$hostElement$;
|
|
409
|
-
const flags = cmpMeta.$flags$;
|
|
410
|
-
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
411
|
-
const scopeId2 = addStyle(
|
|
412
|
-
elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
|
413
|
-
cmpMeta);
|
|
414
|
-
if ((flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */ || flags & 128 /* shadowNeedsScopedCss */)) {
|
|
415
|
-
elm["s-sc"] = scopeId2;
|
|
416
|
-
elm.classList.add(scopeId2 + "-h");
|
|
417
|
-
}
|
|
418
|
-
endAttachStyles();
|
|
419
|
-
};
|
|
420
|
-
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
|
421
|
-
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
422
|
-
if (oldValue !== newValue) {
|
|
423
|
-
let isProp = isMemberInElement(elm, memberName);
|
|
424
|
-
let ln = memberName.toLowerCase();
|
|
425
|
-
if (memberName === "class") {
|
|
426
|
-
const classList = elm.classList;
|
|
427
|
-
const oldClasses = parseClassList(oldValue);
|
|
428
|
-
let newClasses = parseClassList(newValue);
|
|
429
|
-
{
|
|
430
|
-
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
431
|
-
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
432
|
-
}
|
|
433
|
-
} else if (memberName === "style") {
|
|
434
|
-
{
|
|
435
|
-
for (const prop in oldValue) {
|
|
436
|
-
if (!newValue || newValue[prop] == null) {
|
|
437
|
-
if (prop.includes("-")) {
|
|
438
|
-
elm.style.removeProperty(prop);
|
|
439
|
-
} else {
|
|
440
|
-
elm.style[prop] = "";
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
for (const prop in newValue) {
|
|
446
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
499
|
+
} else if (memberName === "style") {
|
|
500
|
+
{
|
|
501
|
+
for (const prop in oldValue) {
|
|
502
|
+
if (!newValue || newValue[prop] == null) {
|
|
447
503
|
if (prop.includes("-")) {
|
|
448
|
-
elm.style.
|
|
504
|
+
elm.style.removeProperty(prop);
|
|
449
505
|
} else {
|
|
450
|
-
elm.style[prop] =
|
|
506
|
+
elm.style[prop] = "";
|
|
451
507
|
}
|
|
452
508
|
}
|
|
453
509
|
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
} else if (isMemberInElement(win, ln)) {
|
|
462
|
-
memberName = ln.slice(2);
|
|
463
|
-
} else {
|
|
464
|
-
memberName = ln[2] + memberName.slice(3);
|
|
465
|
-
}
|
|
466
|
-
if (oldValue || newValue) {
|
|
467
|
-
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
468
|
-
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
469
|
-
if (oldValue) {
|
|
470
|
-
plt.rel(elm, memberName, oldValue, capture);
|
|
471
|
-
}
|
|
472
|
-
if (newValue) {
|
|
473
|
-
plt.ael(elm, memberName, newValue, capture);
|
|
510
|
+
}
|
|
511
|
+
for (const prop in newValue) {
|
|
512
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
513
|
+
if (prop.includes("-")) {
|
|
514
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
515
|
+
} else {
|
|
516
|
+
elm.style[prop] = newValue[prop];
|
|
474
517
|
}
|
|
475
518
|
}
|
|
519
|
+
}
|
|
520
|
+
} else if (memberName === "key") ; else if (memberName === "ref") {
|
|
521
|
+
if (newValue) {
|
|
522
|
+
newValue(elm);
|
|
523
|
+
}
|
|
524
|
+
} else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
|
|
525
|
+
if (memberName[2] === "-") {
|
|
526
|
+
memberName = memberName.slice(3);
|
|
527
|
+
} else if (isMemberInElement(win, ln)) {
|
|
528
|
+
memberName = ln.slice(2);
|
|
476
529
|
} else {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
530
|
+
memberName = ln[2] + memberName.slice(3);
|
|
531
|
+
}
|
|
532
|
+
if (oldValue || newValue) {
|
|
533
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
534
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
535
|
+
if (oldValue) {
|
|
536
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
537
|
+
}
|
|
538
|
+
if (newValue) {
|
|
539
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
} else {
|
|
543
|
+
const isComplex = isComplexType(newValue);
|
|
544
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
545
|
+
try {
|
|
546
|
+
if (!elm.tagName.includes("-")) {
|
|
547
|
+
const n = newValue == null ? "" : newValue;
|
|
548
|
+
if (memberName === "list") {
|
|
549
|
+
isProp = false;
|
|
550
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
|
551
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
552
|
+
elm[memberName] = n;
|
|
553
|
+
} else {
|
|
554
|
+
elm.setAttribute(memberName, n);
|
|
490
555
|
}
|
|
491
|
-
} else if (elm[memberName] !== newValue) {
|
|
492
|
-
elm[memberName] = newValue;
|
|
493
556
|
}
|
|
494
|
-
}
|
|
557
|
+
} else if (elm[memberName] !== newValue) {
|
|
558
|
+
elm[memberName] = newValue;
|
|
495
559
|
}
|
|
560
|
+
} catch (e) {
|
|
496
561
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
elm.removeAttribute(memberName);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
504
|
-
newValue = newValue === true ? "" : newValue;
|
|
562
|
+
}
|
|
563
|
+
if (newValue == null || newValue === false) {
|
|
564
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
505
565
|
{
|
|
506
|
-
elm.
|
|
566
|
+
elm.removeAttribute(memberName);
|
|
507
567
|
}
|
|
508
568
|
}
|
|
569
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
570
|
+
newValue = newValue === true ? "" : newValue;
|
|
571
|
+
{
|
|
572
|
+
elm.setAttribute(memberName, newValue);
|
|
573
|
+
}
|
|
509
574
|
}
|
|
510
575
|
}
|
|
511
576
|
};
|
|
@@ -560,7 +625,6 @@ function sortedAttrNames(attrNames) {
|
|
|
560
625
|
);
|
|
561
626
|
}
|
|
562
627
|
var hostTagName;
|
|
563
|
-
var useNativeShadowDom = false;
|
|
564
628
|
var isSvgMode = false;
|
|
565
629
|
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
566
630
|
const newVNode2 = newParentVNode.$children$[childIndex];
|
|
@@ -568,14 +632,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
568
632
|
let elm;
|
|
569
633
|
let childNode;
|
|
570
634
|
if (newVNode2.$text$ !== null) {
|
|
571
|
-
elm = newVNode2.$elm$ =
|
|
635
|
+
elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
|
|
572
636
|
} else {
|
|
573
637
|
if (!isSvgMode) {
|
|
574
638
|
isSvgMode = newVNode2.$tag$ === "svg";
|
|
575
639
|
}
|
|
576
|
-
|
|
640
|
+
if (!win.document) {
|
|
641
|
+
throw new Error(
|
|
642
|
+
"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."
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
elm = newVNode2.$elm$ = win.document.createElementNS(
|
|
577
646
|
isSvgMode ? SVG_NS : HTML_NS,
|
|
578
|
-
|
|
647
|
+
newVNode2.$tag$
|
|
579
648
|
) ;
|
|
580
649
|
if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
581
650
|
isSvgMode = false;
|
|
@@ -737,9 +806,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
737
806
|
isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
|
|
738
807
|
}
|
|
739
808
|
{
|
|
740
|
-
|
|
741
|
-
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
742
|
-
}
|
|
809
|
+
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
743
810
|
}
|
|
744
811
|
if (oldChildren !== null && newChildren !== null) {
|
|
745
812
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
@@ -753,7 +820,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
753
820
|
!isInitialRender && BUILD.updatable && oldChildren !== null
|
|
754
821
|
) {
|
|
755
822
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
756
|
-
}
|
|
823
|
+
} else ;
|
|
757
824
|
if (isSvgMode && tag === "svg") {
|
|
758
825
|
isSvgMode = false;
|
|
759
826
|
}
|
|
@@ -774,9 +841,9 @@ var insertBefore = (parent, newNode, reference) => {
|
|
|
774
841
|
};
|
|
775
842
|
var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
776
843
|
const hostElm = hostRef.$hostElement$;
|
|
777
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
778
844
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
779
|
-
const
|
|
845
|
+
const isHostElement = isHost(renderFnResults);
|
|
846
|
+
const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
|
|
780
847
|
hostTagName = hostElm.tagName;
|
|
781
848
|
if (isInitialLoad && rootVnode.$attrs$) {
|
|
782
849
|
for (const key of Object.keys(rootVnode.$attrs$)) {
|
|
@@ -789,7 +856,6 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
789
856
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
790
857
|
hostRef.$vnode$ = rootVnode;
|
|
791
858
|
rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
|
|
792
|
-
useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
|
|
793
859
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
794
860
|
};
|
|
795
861
|
|
|
@@ -816,6 +882,12 @@ var scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
816
882
|
}
|
|
817
883
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
818
884
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
885
|
+
if (isInitialLoad) {
|
|
886
|
+
queueMicrotask(() => {
|
|
887
|
+
dispatch();
|
|
888
|
+
});
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
819
891
|
return writeTask(dispatch) ;
|
|
820
892
|
};
|
|
821
893
|
var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
@@ -829,10 +901,11 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
829
901
|
}
|
|
830
902
|
let maybePromise;
|
|
831
903
|
if (isInitialLoad) {
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
904
|
+
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
905
|
+
} else {
|
|
906
|
+
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
835
907
|
}
|
|
908
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
836
909
|
endSchedule();
|
|
837
910
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
838
911
|
};
|
|
@@ -875,7 +948,7 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
|
875
948
|
try {
|
|
876
949
|
instance = instance.render() ;
|
|
877
950
|
{
|
|
878
|
-
hostRef.$flags$ &=
|
|
951
|
+
hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
|
|
879
952
|
}
|
|
880
953
|
{
|
|
881
954
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
@@ -898,14 +971,13 @@ var postUpdateComponent = (hostRef) => {
|
|
|
898
971
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
899
972
|
const instance = hostRef.$lazyInstance$ ;
|
|
900
973
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
974
|
+
safeCall(instance, "componentDidRender", void 0, elm);
|
|
901
975
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
902
976
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
903
977
|
{
|
|
904
978
|
addHydratedFlag(elm);
|
|
905
979
|
}
|
|
906
|
-
|
|
907
|
-
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
908
|
-
}
|
|
980
|
+
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
909
981
|
endPostUpdate();
|
|
910
982
|
{
|
|
911
983
|
hostRef.$onReadyResolve$(elm);
|
|
@@ -914,6 +986,7 @@ var postUpdateComponent = (hostRef) => {
|
|
|
914
986
|
}
|
|
915
987
|
}
|
|
916
988
|
} else {
|
|
989
|
+
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
917
990
|
endPostUpdate();
|
|
918
991
|
}
|
|
919
992
|
{
|
|
@@ -924,7 +997,7 @@ var postUpdateComponent = (hostRef) => {
|
|
|
924
997
|
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
925
998
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
926
999
|
}
|
|
927
|
-
hostRef.$flags$ &=
|
|
1000
|
+
hostRef.$flags$ &= -517;
|
|
928
1001
|
}
|
|
929
1002
|
};
|
|
930
1003
|
var appDidLoad = (who) => {
|
|
@@ -949,16 +1022,21 @@ var addHydratedFlag = (elm) => {
|
|
|
949
1022
|
var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
950
1023
|
var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
951
1024
|
const hostRef = getHostRef(ref);
|
|
1025
|
+
if (!hostRef) {
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
952
1028
|
if (!hostRef) {
|
|
953
1029
|
throw new Error(
|
|
954
|
-
`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/
|
|
1030
|
+
`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).`
|
|
955
1031
|
);
|
|
956
1032
|
}
|
|
957
1033
|
const elm = hostRef.$hostElement$ ;
|
|
958
1034
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
959
1035
|
const flags = hostRef.$flags$;
|
|
960
1036
|
const instance = hostRef.$lazyInstance$ ;
|
|
961
|
-
newVal = parsePropertyValue(
|
|
1037
|
+
newVal = parsePropertyValue(
|
|
1038
|
+
newVal,
|
|
1039
|
+
cmpMeta.$members$[propName][0]);
|
|
962
1040
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
963
1041
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
964
1042
|
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
@@ -977,6 +1055,11 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
977
1055
|
}
|
|
978
1056
|
}
|
|
979
1057
|
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1058
|
+
if (instance.componentShouldUpdate) {
|
|
1059
|
+
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
980
1063
|
scheduleUpdate(hostRef, false);
|
|
981
1064
|
}
|
|
982
1065
|
}
|
|
@@ -1017,6 +1100,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1017
1100
|
Object.defineProperty(prototype, memberName, {
|
|
1018
1101
|
set(newValue) {
|
|
1019
1102
|
const ref = getHostRef(this);
|
|
1103
|
+
if (!ref) {
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1020
1106
|
if (origSetter) {
|
|
1021
1107
|
const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
1022
1108
|
if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
|
|
@@ -1024,7 +1110,11 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1024
1110
|
} else if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
1025
1111
|
ref.$instanceValues$.set(memberName, currentValue);
|
|
1026
1112
|
}
|
|
1027
|
-
origSetter.apply(this, [
|
|
1113
|
+
origSetter.apply(this, [
|
|
1114
|
+
parsePropertyValue(
|
|
1115
|
+
newValue,
|
|
1116
|
+
memberFlags)
|
|
1117
|
+
]);
|
|
1028
1118
|
newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
1029
1119
|
setValue(this, memberName, newValue, cmpMeta);
|
|
1030
1120
|
return;
|
|
@@ -1046,7 +1136,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1046
1136
|
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
1047
1137
|
ref.$instanceValues$.set(memberName, currentValue);
|
|
1048
1138
|
}
|
|
1049
|
-
ref.$lazyInstance$[memberName] = parsePropertyValue(
|
|
1139
|
+
ref.$lazyInstance$[memberName] = parsePropertyValue(
|
|
1140
|
+
newValue,
|
|
1141
|
+
memberFlags);
|
|
1050
1142
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
1051
1143
|
};
|
|
1052
1144
|
if (ref.$lazyInstance$) {
|
|
@@ -1074,7 +1166,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1074
1166
|
} else if (propName == null) {
|
|
1075
1167
|
const hostRef = getHostRef(this);
|
|
1076
1168
|
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
1077
|
-
if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
|
|
1169
|
+
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
|
|
1078
1170
|
const instance = hostRef.$lazyInstance$ ;
|
|
1079
1171
|
const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
|
|
1080
1172
|
entry == null ? void 0 : entry.forEach((callbackName) => {
|
|
@@ -1095,7 +1187,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1095
1187
|
Cstr.observedAttributes = Array.from(
|
|
1096
1188
|
/* @__PURE__ */ new Set([
|
|
1097
1189
|
...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
|
|
1098
|
-
...members.filter(([_, m]) => m[0] &
|
|
1190
|
+
...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
|
|
1099
1191
|
const attrName = m[1] || propName;
|
|
1100
1192
|
attrNameToPropName.set(attrName, propName);
|
|
1101
1193
|
return attrName;
|
|
@@ -1142,12 +1234,13 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1142
1234
|
consoleError(e, elm);
|
|
1143
1235
|
}
|
|
1144
1236
|
{
|
|
1145
|
-
hostRef.$flags$ &=
|
|
1237
|
+
hostRef.$flags$ &= -9 /* isConstructingInstance */;
|
|
1146
1238
|
}
|
|
1147
1239
|
{
|
|
1148
1240
|
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1149
1241
|
}
|
|
1150
1242
|
endNewInstance();
|
|
1243
|
+
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
1151
1244
|
} else {
|
|
1152
1245
|
Cstr = elm.constructor;
|
|
1153
1246
|
const cmpTag = elm.localName;
|
|
@@ -1175,12 +1268,18 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1175
1268
|
}
|
|
1176
1269
|
};
|
|
1177
1270
|
var fireConnectedCallback = (instance, elm) => {
|
|
1271
|
+
{
|
|
1272
|
+
safeCall(instance, "connectedCallback", void 0, elm);
|
|
1273
|
+
}
|
|
1178
1274
|
};
|
|
1179
1275
|
|
|
1180
1276
|
// src/runtime/connected-callback.ts
|
|
1181
1277
|
var connectedCallback = (elm) => {
|
|
1182
1278
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1183
1279
|
const hostRef = getHostRef(elm);
|
|
1280
|
+
if (!hostRef) {
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1184
1283
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1185
1284
|
const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
|
|
1186
1285
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
@@ -1207,8 +1306,10 @@ var connectedCallback = (elm) => {
|
|
|
1207
1306
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
1208
1307
|
}
|
|
1209
1308
|
} else {
|
|
1210
|
-
if (hostRef == null ? void 0 : hostRef.$lazyInstance$)
|
|
1211
|
-
hostRef.$
|
|
1309
|
+
if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
1310
|
+
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
1311
|
+
} else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
|
|
1312
|
+
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
|
|
1212
1313
|
}
|
|
1213
1314
|
}
|
|
1214
1315
|
endConnected();
|
|
@@ -1239,18 +1340,22 @@ var disconnectedCallback = async (elm) => {
|
|
|
1239
1340
|
// src/runtime/bootstrap-lazy.ts
|
|
1240
1341
|
var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1241
1342
|
var _a;
|
|
1343
|
+
if (!win.document) {
|
|
1344
|
+
console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1242
1347
|
const endBootstrap = createTime();
|
|
1243
1348
|
const cmpTags = [];
|
|
1244
1349
|
const exclude = options.exclude || [];
|
|
1245
1350
|
const customElements2 = win.customElements;
|
|
1246
|
-
const head =
|
|
1351
|
+
const head = win.document.head;
|
|
1247
1352
|
const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
|
|
1248
|
-
const dataStyles = /* @__PURE__ */
|
|
1353
|
+
const dataStyles = /* @__PURE__ */ win.document.createElement("style");
|
|
1249
1354
|
const deferredConnectedCallbacks = [];
|
|
1250
1355
|
let appLoadFallback;
|
|
1251
1356
|
let isBootstrapping = true;
|
|
1252
1357
|
Object.assign(plt, options);
|
|
1253
|
-
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./",
|
|
1358
|
+
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
|
|
1254
1359
|
let hasSlotRelocation = false;
|
|
1255
1360
|
lazyBundles.map((lazyBundle) => {
|
|
1256
1361
|
lazyBundle[1].map((compactMeta) => {
|
|
@@ -1281,9 +1386,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1281
1386
|
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1282
1387
|
{
|
|
1283
1388
|
if (!self.shadowRoot) {
|
|
1284
|
-
|
|
1285
|
-
self.attachShadow({ mode: "open" });
|
|
1286
|
-
}
|
|
1389
|
+
createShadowRoot.call(self, cmpMeta);
|
|
1287
1390
|
} else {
|
|
1288
1391
|
if (self.shadowRoot.mode !== "open") {
|
|
1289
1392
|
throw new Error(
|
|
@@ -1295,7 +1398,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1295
1398
|
}
|
|
1296
1399
|
}
|
|
1297
1400
|
connectedCallback() {
|
|
1298
|
-
getHostRef(this);
|
|
1401
|
+
const hostRef = getHostRef(this);
|
|
1402
|
+
if (!hostRef) {
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1299
1405
|
if (!this.hasRegisteredEventListeners) {
|
|
1300
1406
|
this.hasRegisteredEventListeners = true;
|
|
1301
1407
|
}
|
|
@@ -1314,6 +1420,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1314
1420
|
plt.raf(() => {
|
|
1315
1421
|
var _a3;
|
|
1316
1422
|
const hostRef = getHostRef(this);
|
|
1423
|
+
if (!hostRef) {
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1317
1426
|
const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
|
|
1318
1427
|
if (i2 > -1) {
|
|
1319
1428
|
deferredConnectedCallbacks.splice(i2, 1);
|
|
@@ -1324,7 +1433,8 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1324
1433
|
});
|
|
1325
1434
|
}
|
|
1326
1435
|
componentOnReady() {
|
|
1327
|
-
|
|
1436
|
+
var _a3;
|
|
1437
|
+
return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
|
|
1328
1438
|
}
|
|
1329
1439
|
};
|
|
1330
1440
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
@@ -1346,7 +1456,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1346
1456
|
}
|
|
1347
1457
|
if (dataStyles.innerHTML.length) {
|
|
1348
1458
|
dataStyles.setAttribute("data-styles", "");
|
|
1349
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(
|
|
1459
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
1350
1460
|
if (nonce != null) {
|
|
1351
1461
|
dataStyles.setAttribute("nonce", nonce);
|
|
1352
1462
|
}
|
|
@@ -1368,5 +1478,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1368
1478
|
var setNonce = (nonce) => plt.$nonce$ = nonce;
|
|
1369
1479
|
|
|
1370
1480
|
export { Host as H, bootstrapLazy as b, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
1481
|
+
//# sourceMappingURL=index-DkJ7OJTS.js.map
|
|
1371
1482
|
|
|
1372
|
-
//# sourceMappingURL=index-
|
|
1483
|
+
//# sourceMappingURL=index-DkJ7OJTS.js.map
|