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,30 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function _interopNamespace(e) {
|
|
4
|
-
if (e && e.__esModule) return e;
|
|
5
|
-
var n = Object.create(null);
|
|
6
|
-
if (e) {
|
|
7
|
-
Object.keys(e).forEach(function (k) {
|
|
8
|
-
if (k !== 'default') {
|
|
9
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
10
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return e[k];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
n['default'] = e;
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
3
|
const NAMESPACE = 'open-chat-studio-widget';
|
|
24
|
-
const BUILD = /* open-chat-studio-widget */ {
|
|
4
|
+
const BUILD = /* open-chat-studio-widget */ { hydratedSelectorName: "hydrated", lazyLoad: true, updatable: true};
|
|
5
|
+
const Env = /* open-chat-studio-widget */ {"version":"0.5.0"};
|
|
25
6
|
|
|
26
7
|
/*
|
|
27
|
-
Stencil Client Platform v4.
|
|
8
|
+
Stencil Client Platform v4.36.3 | MIT Licensed | https://stenciljs.com
|
|
28
9
|
*/
|
|
29
10
|
var __defProp = Object.defineProperty;
|
|
30
11
|
var __export = (target, all) => {
|
|
@@ -37,10 +18,15 @@ var SVG_NS = "http://www.w3.org/2000/svg";
|
|
|
37
18
|
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
38
19
|
|
|
39
20
|
// src/client/client-host-ref.ts
|
|
40
|
-
var
|
|
41
|
-
|
|
21
|
+
var getHostRef = (ref) => {
|
|
22
|
+
if (ref.__stencil__getHostRef) {
|
|
23
|
+
return ref.__stencil__getHostRef();
|
|
24
|
+
}
|
|
25
|
+
return void 0;
|
|
26
|
+
};
|
|
42
27
|
var registerInstance = (lazyInstance, hostRef) => {
|
|
43
|
-
|
|
28
|
+
lazyInstance.__stencil__getHostRef = () => hostRef;
|
|
29
|
+
hostRef.$lazyInstance$ = lazyInstance;
|
|
44
30
|
};
|
|
45
31
|
var registerHost = (hostElement, cmpMeta) => {
|
|
46
32
|
const hostRef = {
|
|
@@ -54,7 +40,8 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
54
40
|
hostElement["s-p"] = [];
|
|
55
41
|
hostElement["s-rc"] = [];
|
|
56
42
|
}
|
|
57
|
-
const ref =
|
|
43
|
+
const ref = hostRef;
|
|
44
|
+
hostElement.__stencil__getHostRef = () => ref;
|
|
58
45
|
return ref;
|
|
59
46
|
};
|
|
60
47
|
var isMemberInElement = (elm, memberName) => memberName in elm;
|
|
@@ -73,13 +60,13 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
73
60
|
return module[exportName];
|
|
74
61
|
}
|
|
75
62
|
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
76
|
-
return
|
|
63
|
+
return import(
|
|
77
64
|
/* @vite-ignore */
|
|
78
65
|
/* webpackInclude: /\.entry\.js$/ */
|
|
79
66
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
80
67
|
/* webpackMode: "lazy" */
|
|
81
68
|
`./${bundleId}.entry.js${""}`
|
|
82
|
-
)
|
|
69
|
+
).then(
|
|
83
70
|
(importedModule) => {
|
|
84
71
|
{
|
|
85
72
|
cmpModules.set(bundleId, importedModule);
|
|
@@ -94,11 +81,9 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
94
81
|
|
|
95
82
|
// src/client/client-style.ts
|
|
96
83
|
var styles = /* @__PURE__ */ new Map();
|
|
97
|
-
var HYDRATED_STYLE_ID = "sty-id";
|
|
98
84
|
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
99
85
|
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
100
86
|
var win = typeof window !== "undefined" ? window : {};
|
|
101
|
-
var doc = win.document || { head: {} };
|
|
102
87
|
var plt = {
|
|
103
88
|
$flags$: 0,
|
|
104
89
|
$resourcesUrl$: "",
|
|
@@ -117,6 +102,7 @@ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
|
|
|
117
102
|
}
|
|
118
103
|
return false;
|
|
119
104
|
})() ;
|
|
105
|
+
var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
|
|
120
106
|
var queuePending = false;
|
|
121
107
|
var queueDomReads = [];
|
|
122
108
|
var queueDomWrites = [];
|
|
@@ -158,11 +144,16 @@ var isComplexType = (o) => {
|
|
|
158
144
|
};
|
|
159
145
|
|
|
160
146
|
// src/utils/query-nonce-meta-tag-content.ts
|
|
161
|
-
function queryNonceMetaTagContent(
|
|
147
|
+
function queryNonceMetaTagContent(doc) {
|
|
162
148
|
var _a, _b, _c;
|
|
163
|
-
return (_c = (_b = (_a =
|
|
149
|
+
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;
|
|
164
150
|
}
|
|
165
151
|
|
|
152
|
+
// src/utils/regular-expression.ts
|
|
153
|
+
var escapeRegExpSpecialCharacters = (text) => {
|
|
154
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
155
|
+
};
|
|
156
|
+
|
|
166
157
|
// src/utils/result.ts
|
|
167
158
|
var result_exports = {};
|
|
168
159
|
__export(result_exports, {
|
|
@@ -211,6 +202,26 @@ var unwrapErr = (result) => {
|
|
|
211
202
|
throw result.value;
|
|
212
203
|
}
|
|
213
204
|
};
|
|
205
|
+
|
|
206
|
+
// src/utils/style.ts
|
|
207
|
+
function createStyleSheetIfNeededAndSupported(styles2) {
|
|
208
|
+
return void 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/utils/shadow-root.ts
|
|
212
|
+
var globalStyleSheet;
|
|
213
|
+
function createShadowRoot(cmpMeta) {
|
|
214
|
+
var _a;
|
|
215
|
+
const shadowRoot = this.attachShadow({ mode: "open" });
|
|
216
|
+
if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
|
|
217
|
+
if (globalStyleSheet) {
|
|
218
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
219
|
+
shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
|
|
220
|
+
} else {
|
|
221
|
+
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
214
225
|
var createTime = (fnName, tagName = "") => {
|
|
215
226
|
{
|
|
216
227
|
return () => {
|
|
@@ -225,6 +236,110 @@ var uniqueTime = (key, measureText) => {
|
|
|
225
236
|
};
|
|
226
237
|
}
|
|
227
238
|
};
|
|
239
|
+
var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
|
|
240
|
+
var registerStyle = (scopeId2, cssText, allowCS) => {
|
|
241
|
+
let style = styles.get(scopeId2);
|
|
242
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
243
|
+
style = style || new CSSStyleSheet();
|
|
244
|
+
if (typeof style === "string") {
|
|
245
|
+
style = cssText;
|
|
246
|
+
} else {
|
|
247
|
+
style.replaceSync(cssText);
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
style = cssText;
|
|
251
|
+
}
|
|
252
|
+
styles.set(scopeId2, style);
|
|
253
|
+
};
|
|
254
|
+
var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
255
|
+
var _a;
|
|
256
|
+
const scopeId2 = getScopeId(cmpMeta);
|
|
257
|
+
const style = styles.get(scopeId2);
|
|
258
|
+
if (!win.document) {
|
|
259
|
+
return scopeId2;
|
|
260
|
+
}
|
|
261
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
|
|
262
|
+
if (style) {
|
|
263
|
+
if (typeof style === "string") {
|
|
264
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
265
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
266
|
+
let styleElm;
|
|
267
|
+
if (!appliedStyles) {
|
|
268
|
+
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
269
|
+
}
|
|
270
|
+
if (!appliedStyles.has(scopeId2)) {
|
|
271
|
+
{
|
|
272
|
+
styleElm = win.document.createElement("style");
|
|
273
|
+
styleElm.innerHTML = style;
|
|
274
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
275
|
+
if (nonce != null) {
|
|
276
|
+
styleElm.setAttribute("nonce", nonce);
|
|
277
|
+
}
|
|
278
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
279
|
+
if (styleContainerNode.nodeName === "HEAD") {
|
|
280
|
+
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
281
|
+
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
282
|
+
styleContainerNode.insertBefore(
|
|
283
|
+
styleElm,
|
|
284
|
+
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
|
285
|
+
);
|
|
286
|
+
} else if ("host" in styleContainerNode) {
|
|
287
|
+
if (supportsConstructableStylesheets) {
|
|
288
|
+
const stylesheet = new CSSStyleSheet();
|
|
289
|
+
stylesheet.replaceSync(style);
|
|
290
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
291
|
+
styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
|
|
292
|
+
} else {
|
|
293
|
+
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
294
|
+
}
|
|
295
|
+
} else {
|
|
296
|
+
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
297
|
+
if (existingStyleContainer) {
|
|
298
|
+
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
299
|
+
} else {
|
|
300
|
+
styleContainerNode.prepend(styleElm);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
} else {
|
|
304
|
+
styleContainerNode.append(styleElm);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
308
|
+
styleContainerNode.insertBefore(styleElm, null);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
312
|
+
styleElm.innerHTML += SLOT_FB_CSS;
|
|
313
|
+
}
|
|
314
|
+
if (appliedStyles) {
|
|
315
|
+
appliedStyles.add(scopeId2);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
} else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
319
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
320
|
+
styleContainerNode.adoptedStyleSheets.push(style);
|
|
321
|
+
} else {
|
|
322
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return scopeId2;
|
|
327
|
+
};
|
|
328
|
+
var attachStyles = (hostRef) => {
|
|
329
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
330
|
+
const elm = hostRef.$hostElement$;
|
|
331
|
+
const flags = cmpMeta.$flags$;
|
|
332
|
+
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
333
|
+
const scopeId2 = addStyle(
|
|
334
|
+
elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
|
335
|
+
cmpMeta);
|
|
336
|
+
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
337
|
+
elm["s-sc"] = scopeId2;
|
|
338
|
+
elm.classList.add(scopeId2 + "-h");
|
|
339
|
+
}
|
|
340
|
+
endAttachStyles();
|
|
341
|
+
};
|
|
342
|
+
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
|
228
343
|
var h = (nodeName, vnodeData, ...children) => {
|
|
229
344
|
let child = null;
|
|
230
345
|
let key = null;
|
|
@@ -326,13 +441,33 @@ var convertToPrivate = (node) => {
|
|
|
326
441
|
vnode.$name$ = node.vname;
|
|
327
442
|
return vnode;
|
|
328
443
|
};
|
|
329
|
-
var
|
|
444
|
+
var createSupportsRuleRe = (selector) => {
|
|
445
|
+
const safeSelector2 = escapeRegExpSpecialCharacters(selector);
|
|
446
|
+
return new RegExp(
|
|
447
|
+
// First capture group: match any context before the selector that's not inside @supports selector()
|
|
448
|
+
// Using negative lookahead to avoid matching inside @supports selector(...) condition
|
|
449
|
+
`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
|
|
450
|
+
"g"
|
|
451
|
+
);
|
|
452
|
+
};
|
|
453
|
+
createSupportsRuleRe("::slotted");
|
|
454
|
+
createSupportsRuleRe(":host");
|
|
455
|
+
createSupportsRuleRe(":host-context");
|
|
456
|
+
var parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
457
|
+
if (typeof propValue === "string" && (propType & 16 /* Unknown */ || propType & 8 /* Any */) && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
|
|
458
|
+
try {
|
|
459
|
+
return JSON.parse(propValue);
|
|
460
|
+
} catch (e) {
|
|
461
|
+
}
|
|
462
|
+
}
|
|
330
463
|
if (propValue != null && !isComplexType(propValue)) {
|
|
331
464
|
if (propType & 4 /* Boolean */) {
|
|
332
|
-
|
|
465
|
+
{
|
|
466
|
+
return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
467
|
+
}
|
|
333
468
|
}
|
|
334
469
|
if (propType & 2 /* Number */) {
|
|
335
|
-
return parseFloat(propValue);
|
|
470
|
+
return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
|
|
336
471
|
}
|
|
337
472
|
if (propType & 1 /* String */) {
|
|
338
473
|
return String(propValue);
|
|
@@ -341,193 +476,104 @@ var parsePropertyValue = (propValue, propType) => {
|
|
|
341
476
|
}
|
|
342
477
|
return propValue;
|
|
343
478
|
};
|
|
344
|
-
var getElement = (ref) =>
|
|
479
|
+
var getElement = (ref) => {
|
|
480
|
+
var _a;
|
|
481
|
+
return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
|
|
482
|
+
};
|
|
345
483
|
var emitEvent = (elm, name, opts) => {
|
|
346
484
|
const ev = plt.ce(name, opts);
|
|
347
485
|
elm.dispatchEvent(ev);
|
|
348
486
|
return ev;
|
|
349
487
|
};
|
|
350
|
-
var
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
if (supportsConstructableStylesheets && allowCS) {
|
|
354
|
-
style = style || new CSSStyleSheet();
|
|
355
|
-
if (typeof style === "string") {
|
|
356
|
-
style = cssText;
|
|
357
|
-
} else {
|
|
358
|
-
style.replaceSync(cssText);
|
|
359
|
-
}
|
|
360
|
-
} else {
|
|
361
|
-
style = cssText;
|
|
488
|
+
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
489
|
+
if (oldValue === newValue) {
|
|
490
|
+
return;
|
|
362
491
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
373
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
374
|
-
let styleElm;
|
|
375
|
-
if (!appliedStyles) {
|
|
376
|
-
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
377
|
-
}
|
|
378
|
-
if (!appliedStyles.has(scopeId2)) {
|
|
379
|
-
{
|
|
380
|
-
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
|
|
381
|
-
styleElm.innerHTML = style;
|
|
382
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
|
|
383
|
-
if (nonce != null) {
|
|
384
|
-
styleElm.setAttribute("nonce", nonce);
|
|
385
|
-
}
|
|
386
|
-
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
387
|
-
if (styleContainerNode.nodeName === "HEAD") {
|
|
388
|
-
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
389
|
-
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
390
|
-
styleContainerNode.insertBefore(
|
|
391
|
-
styleElm,
|
|
392
|
-
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
|
393
|
-
);
|
|
394
|
-
} else if ("host" in styleContainerNode) {
|
|
395
|
-
if (supportsConstructableStylesheets) {
|
|
396
|
-
const stylesheet = new CSSStyleSheet();
|
|
397
|
-
stylesheet.replaceSync(style);
|
|
398
|
-
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
399
|
-
} else {
|
|
400
|
-
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
401
|
-
if (existingStyleContainer) {
|
|
402
|
-
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
403
|
-
} else {
|
|
404
|
-
styleContainerNode.prepend(styleElm);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
} else {
|
|
408
|
-
styleContainerNode.append(styleElm);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
412
|
-
styleContainerNode.insertBefore(styleElm, null);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
416
|
-
styleElm.innerHTML += SLOT_FB_CSS;
|
|
417
|
-
}
|
|
418
|
-
if (appliedStyles) {
|
|
419
|
-
appliedStyles.add(scopeId2);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
} else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
423
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
492
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
493
|
+
let ln = memberName.toLowerCase();
|
|
494
|
+
if (memberName === "class") {
|
|
495
|
+
const classList = elm.classList;
|
|
496
|
+
const oldClasses = parseClassList(oldValue);
|
|
497
|
+
let newClasses = parseClassList(newValue);
|
|
498
|
+
{
|
|
499
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
500
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
424
501
|
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
430
|
-
const elm = hostRef.$hostElement$;
|
|
431
|
-
const flags = cmpMeta.$flags$;
|
|
432
|
-
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
433
|
-
const scopeId2 = addStyle(
|
|
434
|
-
elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
|
435
|
-
cmpMeta);
|
|
436
|
-
if ((flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */ || flags & 128 /* shadowNeedsScopedCss */)) {
|
|
437
|
-
elm["s-sc"] = scopeId2;
|
|
438
|
-
elm.classList.add(scopeId2 + "-h");
|
|
439
|
-
}
|
|
440
|
-
endAttachStyles();
|
|
441
|
-
};
|
|
442
|
-
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
|
443
|
-
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
444
|
-
if (oldValue !== newValue) {
|
|
445
|
-
let isProp = isMemberInElement(elm, memberName);
|
|
446
|
-
let ln = memberName.toLowerCase();
|
|
447
|
-
if (memberName === "class") {
|
|
448
|
-
const classList = elm.classList;
|
|
449
|
-
const oldClasses = parseClassList(oldValue);
|
|
450
|
-
let newClasses = parseClassList(newValue);
|
|
451
|
-
{
|
|
452
|
-
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
453
|
-
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
454
|
-
}
|
|
455
|
-
} else if (memberName === "style") {
|
|
456
|
-
{
|
|
457
|
-
for (const prop in oldValue) {
|
|
458
|
-
if (!newValue || newValue[prop] == null) {
|
|
459
|
-
if (prop.includes("-")) {
|
|
460
|
-
elm.style.removeProperty(prop);
|
|
461
|
-
} else {
|
|
462
|
-
elm.style[prop] = "";
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
for (const prop in newValue) {
|
|
468
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
502
|
+
} else if (memberName === "style") {
|
|
503
|
+
{
|
|
504
|
+
for (const prop in oldValue) {
|
|
505
|
+
if (!newValue || newValue[prop] == null) {
|
|
469
506
|
if (prop.includes("-")) {
|
|
470
|
-
elm.style.
|
|
507
|
+
elm.style.removeProperty(prop);
|
|
471
508
|
} else {
|
|
472
|
-
elm.style[prop] =
|
|
509
|
+
elm.style[prop] = "";
|
|
473
510
|
}
|
|
474
511
|
}
|
|
475
512
|
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
} else if (isMemberInElement(win, ln)) {
|
|
484
|
-
memberName = ln.slice(2);
|
|
485
|
-
} else {
|
|
486
|
-
memberName = ln[2] + memberName.slice(3);
|
|
487
|
-
}
|
|
488
|
-
if (oldValue || newValue) {
|
|
489
|
-
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
490
|
-
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
491
|
-
if (oldValue) {
|
|
492
|
-
plt.rel(elm, memberName, oldValue, capture);
|
|
493
|
-
}
|
|
494
|
-
if (newValue) {
|
|
495
|
-
plt.ael(elm, memberName, newValue, capture);
|
|
513
|
+
}
|
|
514
|
+
for (const prop in newValue) {
|
|
515
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
516
|
+
if (prop.includes("-")) {
|
|
517
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
518
|
+
} else {
|
|
519
|
+
elm.style[prop] = newValue[prop];
|
|
496
520
|
}
|
|
497
521
|
}
|
|
522
|
+
}
|
|
523
|
+
} else if (memberName === "key") ; else if (memberName === "ref") {
|
|
524
|
+
if (newValue) {
|
|
525
|
+
newValue(elm);
|
|
526
|
+
}
|
|
527
|
+
} else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
|
|
528
|
+
if (memberName[2] === "-") {
|
|
529
|
+
memberName = memberName.slice(3);
|
|
530
|
+
} else if (isMemberInElement(win, ln)) {
|
|
531
|
+
memberName = ln.slice(2);
|
|
498
532
|
} else {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
533
|
+
memberName = ln[2] + memberName.slice(3);
|
|
534
|
+
}
|
|
535
|
+
if (oldValue || newValue) {
|
|
536
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
|
537
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
|
|
538
|
+
if (oldValue) {
|
|
539
|
+
plt.rel(elm, memberName, oldValue, capture);
|
|
540
|
+
}
|
|
541
|
+
if (newValue) {
|
|
542
|
+
plt.ael(elm, memberName, newValue, capture);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
} else {
|
|
546
|
+
const isComplex = isComplexType(newValue);
|
|
547
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
548
|
+
try {
|
|
549
|
+
if (!elm.tagName.includes("-")) {
|
|
550
|
+
const n = newValue == null ? "" : newValue;
|
|
551
|
+
if (memberName === "list") {
|
|
552
|
+
isProp = false;
|
|
553
|
+
} else if (oldValue == null || elm[memberName] != n) {
|
|
554
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
555
|
+
elm[memberName] = n;
|
|
556
|
+
} else {
|
|
557
|
+
elm.setAttribute(memberName, n);
|
|
512
558
|
}
|
|
513
|
-
} else if (elm[memberName] !== newValue) {
|
|
514
|
-
elm[memberName] = newValue;
|
|
515
559
|
}
|
|
516
|
-
}
|
|
560
|
+
} else if (elm[memberName] !== newValue) {
|
|
561
|
+
elm[memberName] = newValue;
|
|
517
562
|
}
|
|
563
|
+
} catch (e) {
|
|
518
564
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
elm.removeAttribute(memberName);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
526
|
-
newValue = newValue === true ? "" : newValue;
|
|
565
|
+
}
|
|
566
|
+
if (newValue == null || newValue === false) {
|
|
567
|
+
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
527
568
|
{
|
|
528
|
-
elm.
|
|
569
|
+
elm.removeAttribute(memberName);
|
|
529
570
|
}
|
|
530
571
|
}
|
|
572
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
573
|
+
newValue = newValue === true ? "" : newValue;
|
|
574
|
+
{
|
|
575
|
+
elm.setAttribute(memberName, newValue);
|
|
576
|
+
}
|
|
531
577
|
}
|
|
532
578
|
}
|
|
533
579
|
};
|
|
@@ -582,7 +628,6 @@ function sortedAttrNames(attrNames) {
|
|
|
582
628
|
);
|
|
583
629
|
}
|
|
584
630
|
var hostTagName;
|
|
585
|
-
var useNativeShadowDom = false;
|
|
586
631
|
var isSvgMode = false;
|
|
587
632
|
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
588
633
|
const newVNode2 = newParentVNode.$children$[childIndex];
|
|
@@ -590,14 +635,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
590
635
|
let elm;
|
|
591
636
|
let childNode;
|
|
592
637
|
if (newVNode2.$text$ !== null) {
|
|
593
|
-
elm = newVNode2.$elm$ =
|
|
638
|
+
elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
|
|
594
639
|
} else {
|
|
595
640
|
if (!isSvgMode) {
|
|
596
641
|
isSvgMode = newVNode2.$tag$ === "svg";
|
|
597
642
|
}
|
|
598
|
-
|
|
643
|
+
if (!win.document) {
|
|
644
|
+
throw new Error(
|
|
645
|
+
"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."
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
elm = newVNode2.$elm$ = win.document.createElementNS(
|
|
599
649
|
isSvgMode ? SVG_NS : HTML_NS,
|
|
600
|
-
|
|
650
|
+
newVNode2.$tag$
|
|
601
651
|
) ;
|
|
602
652
|
if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
603
653
|
isSvgMode = false;
|
|
@@ -759,9 +809,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
759
809
|
isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
|
|
760
810
|
}
|
|
761
811
|
{
|
|
762
|
-
|
|
763
|
-
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
764
|
-
}
|
|
812
|
+
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
765
813
|
}
|
|
766
814
|
if (oldChildren !== null && newChildren !== null) {
|
|
767
815
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
@@ -775,7 +823,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
775
823
|
!isInitialRender && BUILD.updatable && oldChildren !== null
|
|
776
824
|
) {
|
|
777
825
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
778
|
-
}
|
|
826
|
+
} else ;
|
|
779
827
|
if (isSvgMode && tag === "svg") {
|
|
780
828
|
isSvgMode = false;
|
|
781
829
|
}
|
|
@@ -796,9 +844,9 @@ var insertBefore = (parent, newNode, reference) => {
|
|
|
796
844
|
};
|
|
797
845
|
var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
798
846
|
const hostElm = hostRef.$hostElement$;
|
|
799
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
800
847
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
801
|
-
const
|
|
848
|
+
const isHostElement = isHost(renderFnResults);
|
|
849
|
+
const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
|
|
802
850
|
hostTagName = hostElm.tagName;
|
|
803
851
|
if (isInitialLoad && rootVnode.$attrs$) {
|
|
804
852
|
for (const key of Object.keys(rootVnode.$attrs$)) {
|
|
@@ -811,7 +859,6 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
811
859
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
812
860
|
hostRef.$vnode$ = rootVnode;
|
|
813
861
|
rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
|
|
814
|
-
useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
|
|
815
862
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
816
863
|
};
|
|
817
864
|
|
|
@@ -838,6 +885,12 @@ var scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
838
885
|
}
|
|
839
886
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
840
887
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
888
|
+
if (isInitialLoad) {
|
|
889
|
+
queueMicrotask(() => {
|
|
890
|
+
dispatch();
|
|
891
|
+
});
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
841
894
|
return writeTask(dispatch) ;
|
|
842
895
|
};
|
|
843
896
|
var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
@@ -851,10 +904,11 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
851
904
|
}
|
|
852
905
|
let maybePromise;
|
|
853
906
|
if (isInitialLoad) {
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
907
|
+
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
908
|
+
} else {
|
|
909
|
+
maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
|
|
857
910
|
}
|
|
911
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
|
|
858
912
|
endSchedule();
|
|
859
913
|
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
860
914
|
};
|
|
@@ -897,7 +951,7 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
|
897
951
|
try {
|
|
898
952
|
instance = instance.render() ;
|
|
899
953
|
{
|
|
900
|
-
hostRef.$flags$ &=
|
|
954
|
+
hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
|
|
901
955
|
}
|
|
902
956
|
{
|
|
903
957
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
@@ -920,14 +974,13 @@ var postUpdateComponent = (hostRef) => {
|
|
|
920
974
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
921
975
|
const instance = hostRef.$lazyInstance$ ;
|
|
922
976
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
977
|
+
safeCall(instance, "componentDidRender", void 0, elm);
|
|
923
978
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
924
979
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
925
980
|
{
|
|
926
981
|
addHydratedFlag(elm);
|
|
927
982
|
}
|
|
928
|
-
|
|
929
|
-
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
930
|
-
}
|
|
983
|
+
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
931
984
|
endPostUpdate();
|
|
932
985
|
{
|
|
933
986
|
hostRef.$onReadyResolve$(elm);
|
|
@@ -936,6 +989,7 @@ var postUpdateComponent = (hostRef) => {
|
|
|
936
989
|
}
|
|
937
990
|
}
|
|
938
991
|
} else {
|
|
992
|
+
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
939
993
|
endPostUpdate();
|
|
940
994
|
}
|
|
941
995
|
{
|
|
@@ -946,7 +1000,7 @@ var postUpdateComponent = (hostRef) => {
|
|
|
946
1000
|
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
947
1001
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
948
1002
|
}
|
|
949
|
-
hostRef.$flags$ &=
|
|
1003
|
+
hostRef.$flags$ &= -517;
|
|
950
1004
|
}
|
|
951
1005
|
};
|
|
952
1006
|
var appDidLoad = (who) => {
|
|
@@ -971,16 +1025,21 @@ var addHydratedFlag = (elm) => {
|
|
|
971
1025
|
var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
972
1026
|
var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
973
1027
|
const hostRef = getHostRef(ref);
|
|
1028
|
+
if (!hostRef) {
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
974
1031
|
if (!hostRef) {
|
|
975
1032
|
throw new Error(
|
|
976
|
-
`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/
|
|
1033
|
+
`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).`
|
|
977
1034
|
);
|
|
978
1035
|
}
|
|
979
1036
|
const elm = hostRef.$hostElement$ ;
|
|
980
1037
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
981
1038
|
const flags = hostRef.$flags$;
|
|
982
1039
|
const instance = hostRef.$lazyInstance$ ;
|
|
983
|
-
newVal = parsePropertyValue(
|
|
1040
|
+
newVal = parsePropertyValue(
|
|
1041
|
+
newVal,
|
|
1042
|
+
cmpMeta.$members$[propName][0]);
|
|
984
1043
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
985
1044
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
986
1045
|
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
@@ -999,6 +1058,11 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
999
1058
|
}
|
|
1000
1059
|
}
|
|
1001
1060
|
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1061
|
+
if (instance.componentShouldUpdate) {
|
|
1062
|
+
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1002
1066
|
scheduleUpdate(hostRef, false);
|
|
1003
1067
|
}
|
|
1004
1068
|
}
|
|
@@ -1039,6 +1103,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1039
1103
|
Object.defineProperty(prototype, memberName, {
|
|
1040
1104
|
set(newValue) {
|
|
1041
1105
|
const ref = getHostRef(this);
|
|
1106
|
+
if (!ref) {
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1042
1109
|
if (origSetter) {
|
|
1043
1110
|
const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
1044
1111
|
if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
|
|
@@ -1046,7 +1113,11 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1046
1113
|
} else if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
1047
1114
|
ref.$instanceValues$.set(memberName, currentValue);
|
|
1048
1115
|
}
|
|
1049
|
-
origSetter.apply(this, [
|
|
1116
|
+
origSetter.apply(this, [
|
|
1117
|
+
parsePropertyValue(
|
|
1118
|
+
newValue,
|
|
1119
|
+
memberFlags)
|
|
1120
|
+
]);
|
|
1050
1121
|
newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
1051
1122
|
setValue(this, memberName, newValue, cmpMeta);
|
|
1052
1123
|
return;
|
|
@@ -1068,7 +1139,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1068
1139
|
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
1069
1140
|
ref.$instanceValues$.set(memberName, currentValue);
|
|
1070
1141
|
}
|
|
1071
|
-
ref.$lazyInstance$[memberName] = parsePropertyValue(
|
|
1142
|
+
ref.$lazyInstance$[memberName] = parsePropertyValue(
|
|
1143
|
+
newValue,
|
|
1144
|
+
memberFlags);
|
|
1072
1145
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
1073
1146
|
};
|
|
1074
1147
|
if (ref.$lazyInstance$) {
|
|
@@ -1096,7 +1169,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1096
1169
|
} else if (propName == null) {
|
|
1097
1170
|
const hostRef = getHostRef(this);
|
|
1098
1171
|
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
1099
|
-
if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
|
|
1172
|
+
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
|
|
1100
1173
|
const instance = hostRef.$lazyInstance$ ;
|
|
1101
1174
|
const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
|
|
1102
1175
|
entry == null ? void 0 : entry.forEach((callbackName) => {
|
|
@@ -1117,7 +1190,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1117
1190
|
Cstr.observedAttributes = Array.from(
|
|
1118
1191
|
/* @__PURE__ */ new Set([
|
|
1119
1192
|
...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
|
|
1120
|
-
...members.filter(([_, m]) => m[0] &
|
|
1193
|
+
...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
|
|
1121
1194
|
const attrName = m[1] || propName;
|
|
1122
1195
|
attrNameToPropName.set(attrName, propName);
|
|
1123
1196
|
return attrName;
|
|
@@ -1164,12 +1237,13 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1164
1237
|
consoleError(e, elm);
|
|
1165
1238
|
}
|
|
1166
1239
|
{
|
|
1167
|
-
hostRef.$flags$ &=
|
|
1240
|
+
hostRef.$flags$ &= -9 /* isConstructingInstance */;
|
|
1168
1241
|
}
|
|
1169
1242
|
{
|
|
1170
1243
|
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1171
1244
|
}
|
|
1172
1245
|
endNewInstance();
|
|
1246
|
+
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
1173
1247
|
} else {
|
|
1174
1248
|
Cstr = elm.constructor;
|
|
1175
1249
|
const cmpTag = elm.localName;
|
|
@@ -1197,12 +1271,18 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1197
1271
|
}
|
|
1198
1272
|
};
|
|
1199
1273
|
var fireConnectedCallback = (instance, elm) => {
|
|
1274
|
+
{
|
|
1275
|
+
safeCall(instance, "connectedCallback", void 0, elm);
|
|
1276
|
+
}
|
|
1200
1277
|
};
|
|
1201
1278
|
|
|
1202
1279
|
// src/runtime/connected-callback.ts
|
|
1203
1280
|
var connectedCallback = (elm) => {
|
|
1204
1281
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1205
1282
|
const hostRef = getHostRef(elm);
|
|
1283
|
+
if (!hostRef) {
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1206
1286
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1207
1287
|
const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
|
|
1208
1288
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
@@ -1229,8 +1309,10 @@ var connectedCallback = (elm) => {
|
|
|
1229
1309
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
1230
1310
|
}
|
|
1231
1311
|
} else {
|
|
1232
|
-
if (hostRef == null ? void 0 : hostRef.$lazyInstance$)
|
|
1233
|
-
hostRef.$
|
|
1312
|
+
if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
1313
|
+
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
1314
|
+
} else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
|
|
1315
|
+
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
|
|
1234
1316
|
}
|
|
1235
1317
|
}
|
|
1236
1318
|
endConnected();
|
|
@@ -1261,18 +1343,22 @@ var disconnectedCallback = async (elm) => {
|
|
|
1261
1343
|
// src/runtime/bootstrap-lazy.ts
|
|
1262
1344
|
var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1263
1345
|
var _a;
|
|
1346
|
+
if (!win.document) {
|
|
1347
|
+
console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
|
|
1348
|
+
return;
|
|
1349
|
+
}
|
|
1264
1350
|
const endBootstrap = createTime();
|
|
1265
1351
|
const cmpTags = [];
|
|
1266
1352
|
const exclude = options.exclude || [];
|
|
1267
1353
|
const customElements2 = win.customElements;
|
|
1268
|
-
const head =
|
|
1354
|
+
const head = win.document.head;
|
|
1269
1355
|
const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
|
|
1270
|
-
const dataStyles = /* @__PURE__ */
|
|
1356
|
+
const dataStyles = /* @__PURE__ */ win.document.createElement("style");
|
|
1271
1357
|
const deferredConnectedCallbacks = [];
|
|
1272
1358
|
let appLoadFallback;
|
|
1273
1359
|
let isBootstrapping = true;
|
|
1274
1360
|
Object.assign(plt, options);
|
|
1275
|
-
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./",
|
|
1361
|
+
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
|
|
1276
1362
|
let hasSlotRelocation = false;
|
|
1277
1363
|
lazyBundles.map((lazyBundle) => {
|
|
1278
1364
|
lazyBundle[1].map((compactMeta) => {
|
|
@@ -1303,9 +1389,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1303
1389
|
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1304
1390
|
{
|
|
1305
1391
|
if (!self.shadowRoot) {
|
|
1306
|
-
|
|
1307
|
-
self.attachShadow({ mode: "open" });
|
|
1308
|
-
}
|
|
1392
|
+
createShadowRoot.call(self, cmpMeta);
|
|
1309
1393
|
} else {
|
|
1310
1394
|
if (self.shadowRoot.mode !== "open") {
|
|
1311
1395
|
throw new Error(
|
|
@@ -1317,7 +1401,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1317
1401
|
}
|
|
1318
1402
|
}
|
|
1319
1403
|
connectedCallback() {
|
|
1320
|
-
getHostRef(this);
|
|
1404
|
+
const hostRef = getHostRef(this);
|
|
1405
|
+
if (!hostRef) {
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1321
1408
|
if (!this.hasRegisteredEventListeners) {
|
|
1322
1409
|
this.hasRegisteredEventListeners = true;
|
|
1323
1410
|
}
|
|
@@ -1336,6 +1423,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1336
1423
|
plt.raf(() => {
|
|
1337
1424
|
var _a3;
|
|
1338
1425
|
const hostRef = getHostRef(this);
|
|
1426
|
+
if (!hostRef) {
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1339
1429
|
const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
|
|
1340
1430
|
if (i2 > -1) {
|
|
1341
1431
|
deferredConnectedCallbacks.splice(i2, 1);
|
|
@@ -1346,7 +1436,8 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1346
1436
|
});
|
|
1347
1437
|
}
|
|
1348
1438
|
componentOnReady() {
|
|
1349
|
-
|
|
1439
|
+
var _a3;
|
|
1440
|
+
return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
|
|
1350
1441
|
}
|
|
1351
1442
|
};
|
|
1352
1443
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
@@ -1368,7 +1459,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1368
1459
|
}
|
|
1369
1460
|
if (dataStyles.innerHTML.length) {
|
|
1370
1461
|
dataStyles.setAttribute("data-styles", "");
|
|
1371
|
-
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(
|
|
1462
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
1372
1463
|
if (nonce != null) {
|
|
1373
1464
|
dataStyles.setAttribute("nonce", nonce);
|
|
1374
1465
|
}
|
|
@@ -1389,6 +1480,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1389
1480
|
// src/runtime/nonce.ts
|
|
1390
1481
|
var setNonce = (nonce) => plt.$nonce$ = nonce;
|
|
1391
1482
|
|
|
1483
|
+
exports.Env = Env;
|
|
1392
1484
|
exports.Host = Host;
|
|
1393
1485
|
exports.bootstrapLazy = bootstrapLazy;
|
|
1394
1486
|
exports.getElement = getElement;
|
|
@@ -1396,5 +1488,6 @@ exports.h = h;
|
|
|
1396
1488
|
exports.promiseResolve = promiseResolve;
|
|
1397
1489
|
exports.registerInstance = registerInstance;
|
|
1398
1490
|
exports.setNonce = setNonce;
|
|
1491
|
+
//# sourceMappingURL=index-CC3Krx2K.js.map
|
|
1399
1492
|
|
|
1400
|
-
//# sourceMappingURL=index-
|
|
1493
|
+
//# sourceMappingURL=index-CC3Krx2K.js.map
|