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