@runopencode/rx-stencil 0.4.3 → 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/dist/cjs/{index-CbERigo8.js → index-DWhjpI-K.js} +396 -41
- package/dist/{esm/set-property-CpZKE-Xu.js → cjs/index-Dssn3hdS.js} +2 -61
- package/dist/cjs/index.cjs.js +280 -244
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mutation-observable-qY7nC854.js +152 -0
- package/dist/cjs/properties-observable-DXbVBslA.js +23 -0
- package/dist/cjs/property-observable-CPp5WEjC.js +86 -0
- package/dist/cjs/rx-async.cjs.entry.js +21 -14
- package/dist/cjs/rx-stencil.cjs.js +3 -3
- package/dist/cjs/schedule-render-DG4hFv5E.js +53 -0
- package/dist/cjs/set-property-C3KARzdl.js +33 -0
- package/dist/cjs/stencil-uD4ZIy1h.js +75 -0
- package/dist/cjs/test-properties-observable.cjs.entry.js +27 -0
- package/dist/cjs/test-property-observable.cjs.entry.js +31 -0
- package/dist/cjs/test-schedule-render.cjs.entry.js +28 -0
- package/dist/cjs/test-view-child-observable-shadow-dom.cjs.entry.js +40 -0
- package/dist/cjs/until-disconnected-BTCr-3q2.js +27 -0
- package/dist/collection/collection-manifest.json +9 -2
- package/dist/collection/components/async/async.js +42 -10
- package/dist/collection/components/index.js +1 -0
- package/dist/collection/rx/decorator/content-child.js +34 -0
- package/dist/collection/rx/decorator/content-children.js +34 -0
- package/dist/collection/rx/decorator/index.js +6 -2
- package/dist/collection/rx/decorator/query-selector-all.js +6 -38
- package/dist/collection/rx/decorator/query-selector.js +6 -51
- package/dist/collection/rx/decorator/view-child.js +34 -0
- package/dist/collection/rx/decorator/view-children.js +34 -0
- package/dist/collection/rx/index.js +1 -0
- package/dist/collection/rx/observable/connected-observable.js +27 -0
- package/dist/collection/rx/observable/content-child-observable.js +24 -0
- package/dist/collection/rx/observable/content-children-observable.js +15 -0
- package/dist/collection/rx/observable/from-event.js +26 -0
- package/dist/collection/rx/observable/index.js +9 -4
- package/dist/collection/rx/observable/mutation-observable.js +6 -0
- package/dist/collection/rx/observable/properties-observable.js +5 -0
- package/dist/collection/rx/observable/property-observable.js +72 -17
- package/dist/collection/rx/observable/render-observable.js +18 -9
- package/dist/collection/rx/observable/view-child-observable.js +30 -0
- package/dist/collection/rx/observable/view-children-observable.js +21 -0
- package/dist/collection/rx/operator/index.js +4 -3
- package/dist/collection/rx/operator/to-property.js +7 -7
- package/dist/collection/rx/operator/until-disconnected.js +12 -94
- package/dist/collection/rx/operator/while-connected.js +39 -0
- package/dist/collection/rx/subscriber/index.js +1 -1
- package/dist/collection/rx/subscriber/set-property.js +13 -0
- package/dist/collection/rx/types.js +1 -0
- package/dist/collection/tests/rx/observable/from-event/test-from-event.component.js +30 -0
- package/dist/collection/tests/rx/observable/properties-observable/test-properties-observable.component.js +85 -0
- package/dist/collection/tests/rx/observable/property-observable/test-property-observable.component.js +47 -0
- package/dist/collection/tests/rx/observable/render-observable.unit.js +38 -0
- package/dist/collection/tests/rx/observable/view-child-observable/test-view-child-observable-shadow-dom.component.js +96 -0
- package/dist/collection/tests/rx/operator/schedule-render/test-schedule-render.component.js +42 -0
- package/dist/collection/tests/rx/operator/to-property.unit.js +28 -0
- package/dist/collection/tests/rx/operator/until-disconnected.unit.js +25 -0
- package/dist/collection/tests/rx/operator/while-connected/test-while-connected.component.js +32 -0
- package/dist/collection/tests/rx/subscriber/set-property.unit.js +53 -0
- package/dist/collection/utils/decorator.js +33 -0
- package/dist/collection/utils/index.js +1 -1
- package/dist/collection/utils/rxjs.js +67 -0
- package/dist/collection/utils/stencil.js +66 -0
- package/dist/collection/utils/values-registry.js +40 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -0
- package/dist/components/mutation-observable.js +1 -0
- package/dist/components/properties-observable.js +1 -0
- package/dist/components/property-observable.js +1 -0
- package/dist/components/rx-async.js +1 -1
- package/dist/components/schedule-render.js +1 -0
- package/dist/components/set-property.js +1 -1
- package/dist/components/stencil.js +1 -0
- package/dist/components/test-properties-observable.d.ts +11 -0
- package/dist/components/test-properties-observable.js +1 -0
- package/dist/components/test-property-observable.d.ts +11 -0
- package/dist/components/test-property-observable.js +1 -0
- package/dist/components/test-schedule-render.d.ts +11 -0
- package/dist/components/test-schedule-render.js +1 -0
- package/dist/components/test-view-child-observable-shadow-dom.d.ts +11 -0
- package/dist/components/test-view-child-observable-shadow-dom.js +1 -0
- package/dist/components/until-disconnected.js +1 -0
- package/dist/esm/{index-BIBww8qU.js → index-BCGlW-2C.js} +396 -42
- package/dist/{cjs/set-property-BZHuI0P5.js → esm/index-Bn8mRT4P.js} +1 -67
- package/dist/esm/index.js +266 -240
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mutation-observable-xA7xgk29.js +145 -0
- package/dist/esm/properties-observable-Bzq-rZ4c.js +21 -0
- package/dist/esm/property-observable-BKyQe0OR.js +84 -0
- package/dist/esm/rx-async.entry.js +18 -11
- package/dist/esm/rx-stencil.js +4 -4
- package/dist/esm/schedule-render-BGCI5FMG.js +50 -0
- package/dist/esm/set-property-CgrvJ28c.js +31 -0
- package/dist/esm/stencil-BQCAKjCT.js +68 -0
- package/dist/esm/test-properties-observable.entry.js +25 -0
- package/dist/esm/test-property-observable.entry.js +29 -0
- package/dist/esm/test-schedule-render.entry.js +26 -0
- package/dist/esm/test-view-child-observable-shadow-dom.entry.js +38 -0
- package/dist/esm/until-disconnected-D2pF81SM.js +25 -0
- package/dist/rx-stencil/index.esm.js +1 -1
- package/dist/rx-stencil/p-7c570c65.entry.js +1 -0
- package/dist/rx-stencil/p-BCGlW-2C.js +3 -0
- package/dist/rx-stencil/p-BLLg2g3n.js +1 -0
- package/dist/rx-stencil/p-BQCAKjCT.js +1 -0
- package/dist/rx-stencil/p-Bn8mRT4P.js +1 -0
- package/dist/rx-stencil/p-D1zETqVV.js +1 -0
- package/dist/rx-stencil/p-DHIVm3-O.js +1 -0
- package/dist/rx-stencil/p-J0xLdrjW.js +1 -0
- package/dist/rx-stencil/p-Sf5sf4Pq.js +1 -0
- package/dist/rx-stencil/p-a4c71f45.entry.js +1 -0
- package/dist/rx-stencil/p-b2c6ba01.entry.js +1 -0
- package/dist/rx-stencil/p-dc654207.entry.js +1 -0
- package/dist/rx-stencil/p-e661490a.entry.js +1 -0
- package/dist/rx-stencil/p-wVeMJABH.js +1 -0
- package/dist/rx-stencil/rx-stencil.esm.js +1 -1
- package/dist/types/components/async/async.d.ts +9 -2
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components.d.ts +92 -2
- package/dist/types/rx/decorator/content-child.d.ts +3 -0
- package/dist/types/rx/decorator/content-children.d.ts +3 -0
- package/dist/types/rx/decorator/index.d.ts +6 -2
- package/dist/types/rx/decorator/query-selector-all.d.ts +7 -21
- package/dist/types/rx/decorator/query-selector.d.ts +7 -29
- package/dist/types/rx/decorator/view-child.d.ts +27 -0
- package/dist/types/rx/decorator/view-children.d.ts +11 -0
- package/dist/types/rx/index.d.ts +1 -0
- package/dist/types/rx/observable/connected-observable.d.ts +9 -0
- package/dist/types/rx/observable/content-child-observable.d.ts +5 -0
- package/dist/types/rx/observable/content-children-observable.d.ts +5 -0
- package/dist/types/rx/observable/from-event.d.ts +26 -0
- package/dist/types/rx/observable/index.d.ts +9 -4
- package/dist/types/rx/observable/mutation-observable.d.ts +6 -0
- package/dist/types/rx/observable/properties-observable.d.ts +5 -0
- package/dist/types/rx/observable/property-observable.d.ts +1 -1
- package/dist/types/rx/observable/render-observable.d.ts +6 -1
- package/dist/types/rx/observable/view-child-observable.d.ts +17 -0
- package/dist/types/rx/observable/view-children-observable.d.ts +5 -0
- package/dist/types/rx/operator/index.d.ts +4 -3
- package/dist/types/rx/operator/to-property.d.ts +1 -3
- package/dist/types/rx/operator/while-connected.d.ts +22 -0
- package/dist/types/rx/subscriber/index.d.ts +1 -1
- package/dist/types/rx/subscriber/set-property.d.ts +13 -0
- package/dist/types/rx/types.d.ts +12 -0
- package/dist/types/stencil-public-runtime.d.ts +74 -55
- package/dist/types/tests/rx/observable/properties-observable/test-properties-observable.component.d.ts +9 -0
- package/dist/types/tests/rx/observable/property-observable/test-property-observable.component.d.ts +8 -0
- package/dist/types/tests/rx/observable/render-observable.unit.d.ts +1 -0
- package/dist/types/tests/rx/observable/view-child-observable/test-view-child-observable-shadow-dom.component.d.ts +12 -0
- package/dist/types/tests/rx/operator/schedule-render/test-schedule-render.component.d.ts +7 -0
- package/dist/types/tests/rx/operator/to-property.unit.d.ts +1 -0
- package/dist/types/tests/rx/operator/until-disconnected.unit.d.ts +1 -0
- package/dist/types/tests/rx/subscriber/set-property.unit.d.ts +1 -0
- package/dist/types/utils/decorator.d.ts +11 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/rxjs.d.ts +31 -0
- package/dist/types/utils/stencil.d.ts +54 -0
- package/dist/types/utils/values-registry.d.ts +10 -0
- package/loader/index.d.ts +1 -1
- package/package.json +19 -10
- package/dist/collection/utils/get-property-descriptor.js +0 -17
- package/dist/rx-stencil/p-77100dee.entry.js +0 -1
- package/dist/rx-stencil/p-BIBww8qU.js +0 -2
- package/dist/rx-stencil/p-IbpJ_cRo.js +0 -1
- package/dist/types/utils/get-property-descriptor.d.ts +0 -7
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
const NAMESPACE = 'rx-stencil';
|
|
2
|
-
const BUILD = /* rx-stencil */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated",
|
|
2
|
+
const BUILD = /* rx-stencil */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: false, state: true, updatable: true};
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
|
-
Stencil Client Platform v4.
|
|
5
|
+
Stencil Client Platform v4.45.0 | MIT Licensed | https://stenciljs.com
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
// src/utils/get-prop-descriptor.ts
|
|
10
|
+
function getPropertyDescriptor(obj, memberName, getOnly) {
|
|
11
|
+
const stopAt = typeof HTMLElement !== "undefined" ? HTMLElement.prototype : null;
|
|
12
|
+
while (obj && obj !== stopAt) {
|
|
13
|
+
const desc = Object.getOwnPropertyDescriptor(obj, memberName);
|
|
14
|
+
if (desc && (!getOnly || desc.get)) return desc;
|
|
15
|
+
obj = Object.getPrototypeOf(obj);
|
|
16
|
+
}
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// src/utils/es2022-rewire-class-members.ts
|
|
8
21
|
var reWireGetterSetter = (instance, hostRef) => {
|
|
9
22
|
var _a;
|
|
10
23
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -12,7 +25,7 @@ var reWireGetterSetter = (instance, hostRef) => {
|
|
|
12
25
|
members.map(([memberName, [memberFlags]]) => {
|
|
13
26
|
if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
|
|
14
27
|
const ogValue = instance[memberName];
|
|
15
|
-
const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
|
|
28
|
+
const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName, true) || Object.getOwnPropertyDescriptor(instance, memberName);
|
|
16
29
|
if (ogDescriptor) {
|
|
17
30
|
Object.defineProperty(instance, memberName, {
|
|
18
31
|
get() {
|
|
@@ -25,18 +38,14 @@ var reWireGetterSetter = (instance, hostRef) => {
|
|
|
25
38
|
enumerable: true
|
|
26
39
|
});
|
|
27
40
|
}
|
|
28
|
-
|
|
41
|
+
if (hostRef.$instanceValues$.has(memberName)) {
|
|
42
|
+
instance[memberName] = hostRef.$instanceValues$.get(memberName);
|
|
43
|
+
} else if (ogValue !== void 0) {
|
|
44
|
+
instance[memberName] = ogValue;
|
|
45
|
+
}
|
|
29
46
|
}
|
|
30
47
|
});
|
|
31
48
|
};
|
|
32
|
-
function getPropertyDescriptor(obj, memberName) {
|
|
33
|
-
while (obj) {
|
|
34
|
-
const desc = Object.getOwnPropertyDescriptor(obj, memberName);
|
|
35
|
-
if (desc == null ? void 0 : desc.get) return desc;
|
|
36
|
-
obj = Object.getPrototypeOf(obj);
|
|
37
|
-
}
|
|
38
|
-
return void 0;
|
|
39
|
-
}
|
|
40
49
|
|
|
41
50
|
// src/client/client-host-ref.ts
|
|
42
51
|
var getHostRef = (ref) => {
|
|
@@ -49,7 +58,7 @@ var registerInstance = (lazyInstance, hostRef) => {
|
|
|
49
58
|
if (!hostRef) return;
|
|
50
59
|
lazyInstance.__stencil__getHostRef = () => hostRef;
|
|
51
60
|
hostRef.$lazyInstance$ = lazyInstance;
|
|
52
|
-
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.
|
|
61
|
+
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
|
|
53
62
|
reWireGetterSetter(lazyInstance, hostRef);
|
|
54
63
|
}
|
|
55
64
|
};
|
|
@@ -61,6 +70,9 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
61
70
|
$instanceValues$: /* @__PURE__ */ new Map(),
|
|
62
71
|
$serializerValues$: /* @__PURE__ */ new Map()
|
|
63
72
|
};
|
|
73
|
+
{
|
|
74
|
+
hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
|
|
75
|
+
}
|
|
64
76
|
{
|
|
65
77
|
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
66
78
|
hostElement["s-p"] = [];
|
|
@@ -73,11 +85,14 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
73
85
|
hostElement.__stencil__getHostRef = () => ref;
|
|
74
86
|
return ref;
|
|
75
87
|
};
|
|
88
|
+
var isMemberInElement = (elm, memberName) => memberName in elm;
|
|
76
89
|
var consoleError = (e, el) => (0, console.error)(e, el);
|
|
77
90
|
|
|
78
91
|
// src/client/client-load-module.ts
|
|
79
92
|
var cmpModules = /* @__PURE__ */ new Map();
|
|
93
|
+
var failedLoadAttempts = /* @__PURE__ */ new Map();
|
|
80
94
|
var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
95
|
+
var _a;
|
|
81
96
|
const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
|
|
82
97
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
83
98
|
if (!bundleId) {
|
|
@@ -87,21 +102,28 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
87
102
|
if (module) {
|
|
88
103
|
return module[exportName];
|
|
89
104
|
}
|
|
105
|
+
const retryCount = (_a = failedLoadAttempts.get(bundleId)) != null ? _a : 0;
|
|
106
|
+
const cacheBustParams = [
|
|
107
|
+
retryCount > 0 ? `s-retry=${retryCount}` : "",
|
|
108
|
+
""
|
|
109
|
+
].filter(Boolean).join("&");
|
|
90
110
|
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
91
111
|
return import(
|
|
92
112
|
/* @vite-ignore */
|
|
93
113
|
/* webpackInclude: /\.entry\.js$/ */
|
|
94
114
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
95
115
|
/* webpackMode: "lazy" */
|
|
96
|
-
`./${bundleId}.entry.js${""}`
|
|
116
|
+
`./${bundleId}.entry.js${cacheBustParams ? "?" + cacheBustParams : ""}`
|
|
97
117
|
).then(
|
|
98
118
|
(importedModule) => {
|
|
99
119
|
{
|
|
120
|
+
failedLoadAttempts.delete(bundleId);
|
|
100
121
|
cmpModules.set(bundleId, importedModule);
|
|
101
122
|
}
|
|
102
123
|
return importedModule[exportName];
|
|
103
124
|
},
|
|
104
125
|
(e) => {
|
|
126
|
+
failedLoadAttempts.set(bundleId, retryCount + 1);
|
|
105
127
|
consoleError(e, hostRef.$hostElement$);
|
|
106
128
|
}
|
|
107
129
|
);
|
|
@@ -111,6 +133,8 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
111
133
|
var styles = /* @__PURE__ */ new Map();
|
|
112
134
|
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
113
135
|
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
136
|
+
var MAX_LAZY_LOAD_RETRIES = 3;
|
|
137
|
+
var LAZY_LOAD_RETRY_INTERVAL_MS = 1e3;
|
|
114
138
|
var win = typeof window !== "undefined" ? window : {};
|
|
115
139
|
var plt = {
|
|
116
140
|
$flags$: 0,
|
|
@@ -137,6 +161,10 @@ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @_
|
|
|
137
161
|
var queuePending = false;
|
|
138
162
|
var queueDomReads = [];
|
|
139
163
|
var queueDomWrites = [];
|
|
164
|
+
var scheduleFlush = () => {
|
|
165
|
+
var _a;
|
|
166
|
+
return ((_a = win.document) == null ? void 0 : _a.hidden) ? nextTick(flush) : plt.raf(flush);
|
|
167
|
+
};
|
|
140
168
|
var queueTask = (queue, write) => (cb) => {
|
|
141
169
|
queue.push(cb);
|
|
142
170
|
if (!queuePending) {
|
|
@@ -144,7 +172,7 @@ var queueTask = (queue, write) => (cb) => {
|
|
|
144
172
|
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
145
173
|
nextTick(flush);
|
|
146
174
|
} else {
|
|
147
|
-
|
|
175
|
+
scheduleFlush();
|
|
148
176
|
}
|
|
149
177
|
}
|
|
150
178
|
};
|
|
@@ -163,12 +191,33 @@ var flush = () => {
|
|
|
163
191
|
{
|
|
164
192
|
consume(queueDomWrites);
|
|
165
193
|
if (queuePending = queueDomReads.length > 0) {
|
|
166
|
-
|
|
194
|
+
scheduleFlush();
|
|
167
195
|
}
|
|
168
196
|
}
|
|
169
197
|
};
|
|
170
198
|
var nextTick = (cb) => promiseResolve().then(cb);
|
|
171
199
|
var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
|
|
200
|
+
|
|
201
|
+
// src/utils/style.ts
|
|
202
|
+
function createStyleSheetIfNeededAndSupported(styles2) {
|
|
203
|
+
return void 0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// src/utils/shadow-root.ts
|
|
207
|
+
var globalStyleSheet;
|
|
208
|
+
function createShadowRoot(cmpMeta) {
|
|
209
|
+
var _a;
|
|
210
|
+
const opts = { mode: "open" };
|
|
211
|
+
const shadowRoot = this.attachShadow(opts);
|
|
212
|
+
if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
|
|
213
|
+
if (globalStyleSheet) {
|
|
214
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
215
|
+
shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
|
|
216
|
+
} else {
|
|
217
|
+
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
172
221
|
var createTime = (fnName, tagName = "") => {
|
|
173
222
|
{
|
|
174
223
|
return () => {
|
|
@@ -299,10 +348,15 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
299
348
|
var attachStyles = (hostRef) => {
|
|
300
349
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
301
350
|
const elm = hostRef.$hostElement$;
|
|
351
|
+
const flags = cmpMeta.$flags$;
|
|
302
352
|
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
303
|
-
addStyle(
|
|
304
|
-
elm.getRootNode(),
|
|
353
|
+
const scopeId2 = addStyle(
|
|
354
|
+
elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
|
305
355
|
cmpMeta);
|
|
356
|
+
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
357
|
+
elm["s-sc"] = scopeId2;
|
|
358
|
+
elm.classList.add(scopeId2 + "-h");
|
|
359
|
+
}
|
|
306
360
|
endAttachStyles();
|
|
307
361
|
};
|
|
308
362
|
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
|
@@ -329,6 +383,11 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
|
329
383
|
} else if (child != null && typeof child !== "boolean") {
|
|
330
384
|
if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
|
|
331
385
|
child = String(child);
|
|
386
|
+
} else if (typeof nodeName !== "function" && child.$flags$ === void 0) {
|
|
387
|
+
{
|
|
388
|
+
consoleError("Invalid vNode child");
|
|
389
|
+
}
|
|
390
|
+
continue;
|
|
332
391
|
}
|
|
333
392
|
if (simple && lastSimple) {
|
|
334
393
|
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
|
@@ -344,6 +403,12 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
|
344
403
|
if (vnodeData.key) {
|
|
345
404
|
key = vnodeData.key;
|
|
346
405
|
}
|
|
406
|
+
{
|
|
407
|
+
const classData = vnodeData.className || vnodeData.class;
|
|
408
|
+
if (classData) {
|
|
409
|
+
vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
|
|
410
|
+
}
|
|
411
|
+
}
|
|
347
412
|
}
|
|
348
413
|
const vnode = newVNode(nodeName, null);
|
|
349
414
|
vnode.$attrs$ = vnodeData;
|
|
@@ -375,9 +440,37 @@ var newVNode = (tag, text) => {
|
|
|
375
440
|
var Host = {};
|
|
376
441
|
var isHost = (node) => node && node.$tag$ === Host;
|
|
377
442
|
|
|
443
|
+
// src/runtime/normalize-watchers.ts
|
|
444
|
+
var normalizeWatchers = (raw) => {
|
|
445
|
+
if (!raw) return void 0;
|
|
446
|
+
const keys = Object.keys(raw);
|
|
447
|
+
if (keys.length === 0) return void 0;
|
|
448
|
+
let hasLegacy = false;
|
|
449
|
+
for (const propName of keys) {
|
|
450
|
+
if (hasLegacy) break;
|
|
451
|
+
for (const h2 of raw[propName]) {
|
|
452
|
+
if (typeof h2 === "string") {
|
|
453
|
+
hasLegacy = true;
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (!hasLegacy) return raw;
|
|
459
|
+
const out = {};
|
|
460
|
+
for (const propName of keys) {
|
|
461
|
+
out[propName] = raw[propName].map(
|
|
462
|
+
(h2) => typeof h2 === "string" ? { [h2]: 0 } : h2
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
return out;
|
|
466
|
+
};
|
|
467
|
+
|
|
378
468
|
// src/runtime/parse-property-value.ts
|
|
379
469
|
var parsePropertyValue = (propValue, propType, isFormAssociated) => {
|
|
380
470
|
if (propValue != null && !isComplexType(propValue)) {
|
|
471
|
+
if (propType & 1 /* String */) {
|
|
472
|
+
return String(propValue);
|
|
473
|
+
}
|
|
381
474
|
return propValue;
|
|
382
475
|
}
|
|
383
476
|
return propValue;
|
|
@@ -395,7 +488,92 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
395
488
|
if (oldValue === newValue) {
|
|
396
489
|
return;
|
|
397
490
|
}
|
|
491
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
398
492
|
memberName.toLowerCase();
|
|
493
|
+
if (memberName === "class") {
|
|
494
|
+
const classList = elm.classList;
|
|
495
|
+
const oldClasses = parseClassList(oldValue);
|
|
496
|
+
let newClasses = parseClassList(newValue);
|
|
497
|
+
{
|
|
498
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
499
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
500
|
+
}
|
|
501
|
+
} else if (memberName === "key") ; else if (memberName[0] === "a" && memberName.startsWith("attr:")) {
|
|
502
|
+
const propName = memberName.slice(5);
|
|
503
|
+
let attrName;
|
|
504
|
+
{
|
|
505
|
+
const hostRef = getHostRef(elm);
|
|
506
|
+
if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
|
|
507
|
+
const memberMeta = hostRef.$cmpMeta$.$members$[propName];
|
|
508
|
+
if (memberMeta && memberMeta[1]) {
|
|
509
|
+
attrName = memberMeta[1];
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (!attrName) {
|
|
514
|
+
attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
515
|
+
}
|
|
516
|
+
if (newValue == null || newValue === false) {
|
|
517
|
+
if (newValue !== false || elm.getAttribute(attrName) === "") {
|
|
518
|
+
elm.removeAttribute(attrName);
|
|
519
|
+
}
|
|
520
|
+
} else {
|
|
521
|
+
elm.setAttribute(attrName, newValue === true ? "" : newValue);
|
|
522
|
+
}
|
|
523
|
+
return;
|
|
524
|
+
} else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
|
|
525
|
+
const propName = memberName.slice(5);
|
|
526
|
+
try {
|
|
527
|
+
elm[propName] = newValue;
|
|
528
|
+
} catch (e) {
|
|
529
|
+
}
|
|
530
|
+
return;
|
|
531
|
+
} else {
|
|
532
|
+
const isComplex = isComplexType(newValue);
|
|
533
|
+
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
534
|
+
try {
|
|
535
|
+
if (!elm.tagName.includes("-")) {
|
|
536
|
+
const n = newValue == null ? "" : newValue;
|
|
537
|
+
if (memberName === "list") {
|
|
538
|
+
isProp = false;
|
|
539
|
+
} else if (oldValue == null || elm[memberName] !== n) {
|
|
540
|
+
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
541
|
+
elm[memberName] = n;
|
|
542
|
+
} else {
|
|
543
|
+
elm.setAttribute(memberName, n);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
} else if (elm[memberName] !== newValue) {
|
|
547
|
+
elm[memberName] = newValue;
|
|
548
|
+
}
|
|
549
|
+
} catch (e) {
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if (newValue == null || newValue === false) {
|
|
553
|
+
if (newValue !== false || elm.getAttribute(memberName) === "" || flags & 4 /* isHost */ && !isEnumeratedAttribute(memberName)) {
|
|
554
|
+
{
|
|
555
|
+
elm.removeAttribute(memberName);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
559
|
+
newValue = newValue === true ? "" : newValue;
|
|
560
|
+
{
|
|
561
|
+
elm.setAttribute(memberName, newValue);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
var ENUMERATED_ATTRIBUTES = /* @__PURE__ */ new Set(["draggable", "contenteditable", "spellcheck"]);
|
|
567
|
+
var isEnumeratedAttribute = (attrName) => ENUMERATED_ATTRIBUTES.has(attrName) || attrName.startsWith("aria-");
|
|
568
|
+
var parseClassListRegex = /\s/;
|
|
569
|
+
var parseClassList = (value) => {
|
|
570
|
+
if (typeof value === "object" && value && "baseVal" in value) {
|
|
571
|
+
value = value.baseVal;
|
|
572
|
+
}
|
|
573
|
+
if (!value || typeof value !== "string") {
|
|
574
|
+
return [];
|
|
575
|
+
}
|
|
576
|
+
return value.split(parseClassListRegex);
|
|
399
577
|
};
|
|
400
578
|
|
|
401
579
|
// src/runtime/vdom/update-element.ts
|
|
@@ -410,7 +588,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
|
|
|
410
588
|
elm,
|
|
411
589
|
memberName,
|
|
412
590
|
oldVnodeAttrs[memberName],
|
|
413
|
-
void 0
|
|
591
|
+
void 0,
|
|
592
|
+
isSvgMode2,
|
|
593
|
+
newVnode.$flags$);
|
|
414
594
|
}
|
|
415
595
|
}
|
|
416
596
|
}
|
|
@@ -419,7 +599,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
|
|
|
419
599
|
elm,
|
|
420
600
|
memberName,
|
|
421
601
|
oldVnodeAttrs[memberName],
|
|
422
|
-
newVnodeAttrs[memberName]
|
|
602
|
+
newVnodeAttrs[memberName],
|
|
603
|
+
isSvgMode2,
|
|
604
|
+
newVnode.$flags$);
|
|
423
605
|
}
|
|
424
606
|
};
|
|
425
607
|
function sortedAttrNames(attrNames) {
|
|
@@ -432,6 +614,8 @@ function sortedAttrNames(attrNames) {
|
|
|
432
614
|
);
|
|
433
615
|
}
|
|
434
616
|
var hostTagName;
|
|
617
|
+
var useNativeShadowDom = false;
|
|
618
|
+
var isSvgMode = false;
|
|
435
619
|
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
436
620
|
const newVNode2 = newParentVNode.$children$[childIndex];
|
|
437
621
|
let i2 = 0;
|
|
@@ -447,7 +631,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
447
631
|
newVNode2.$tag$
|
|
448
632
|
);
|
|
449
633
|
{
|
|
450
|
-
updateElement(null, newVNode2);
|
|
634
|
+
updateElement(null, newVNode2, isSvgMode);
|
|
451
635
|
}
|
|
452
636
|
if (newVNode2.$children$) {
|
|
453
637
|
const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
|
|
@@ -462,9 +646,31 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
462
646
|
elm["s-hn"] = hostTagName;
|
|
463
647
|
return elm;
|
|
464
648
|
};
|
|
649
|
+
var relocateToHostRoot = (parentElm) => {
|
|
650
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
651
|
+
const host = parentElm.closest(hostTagName.toLowerCase());
|
|
652
|
+
if (host != null) {
|
|
653
|
+
const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
|
|
654
|
+
(ref) => ref["s-cr"]
|
|
655
|
+
);
|
|
656
|
+
const childNodeArray = Array.from(
|
|
657
|
+
parentElm.__childNodes || parentElm.childNodes
|
|
658
|
+
);
|
|
659
|
+
for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
|
|
660
|
+
if (childNode["s-sh"] != null) {
|
|
661
|
+
insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
|
|
662
|
+
childNode["s-sh"] = void 0;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
plt.$flags$ &= -2 /* isTmpDisconnected */;
|
|
667
|
+
};
|
|
465
668
|
var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
466
669
|
let containerElm = parentElm;
|
|
467
670
|
let childNode;
|
|
671
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
672
|
+
containerElm = containerElm.shadowRoot;
|
|
673
|
+
}
|
|
468
674
|
if (parentVNode.$tag$ === "template") {
|
|
469
675
|
containerElm = containerElm.content;
|
|
470
676
|
}
|
|
@@ -543,7 +749,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
543
749
|
if (idxInOld >= 0) {
|
|
544
750
|
elmToMove = oldCh[idxInOld];
|
|
545
751
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
546
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode2,
|
|
752
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
|
|
547
753
|
} else {
|
|
548
754
|
patch(elmToMove, newStartVnode, isInitialRender);
|
|
549
755
|
oldCh[idxInOld] = void 0;
|
|
@@ -590,10 +796,17 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
590
796
|
const elm = newVNode2.$elm$ = oldVNode.$elm$;
|
|
591
797
|
const oldChildren = oldVNode.$children$;
|
|
592
798
|
const newChildren = newVNode2.$children$;
|
|
799
|
+
const tag = newVNode2.$tag$;
|
|
593
800
|
const text = newVNode2.$text$;
|
|
594
801
|
if (text == null) {
|
|
595
802
|
{
|
|
596
|
-
|
|
803
|
+
if (tag === "slot" && !useNativeShadowDom) {
|
|
804
|
+
if (oldVNode.$name$ !== newVNode2.$name$) {
|
|
805
|
+
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
806
|
+
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
597
810
|
}
|
|
598
811
|
if (oldChildren !== null && newChildren !== null) {
|
|
599
812
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
@@ -613,14 +826,13 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
613
826
|
}
|
|
614
827
|
};
|
|
615
828
|
var insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
616
|
-
|
|
617
|
-
return parent.__insertBefore(newNode, reference);
|
|
618
|
-
} else {
|
|
829
|
+
{
|
|
619
830
|
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
620
831
|
}
|
|
621
832
|
};
|
|
622
833
|
var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
623
834
|
const hostElm = hostRef.$hostElement$;
|
|
835
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
624
836
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
625
837
|
const isHostElement = isHost(renderFnResults);
|
|
626
838
|
const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
|
|
@@ -635,7 +847,8 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
635
847
|
rootVnode.$tag$ = null;
|
|
636
848
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
637
849
|
hostRef.$vnode$ = rootVnode;
|
|
638
|
-
rootVnode.$elm$ = oldVNode.$elm$ = hostElm;
|
|
850
|
+
rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
|
|
851
|
+
useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
|
|
639
852
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
640
853
|
};
|
|
641
854
|
|
|
@@ -774,6 +987,9 @@ var postUpdateComponent = (hostRef) => {
|
|
|
774
987
|
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
775
988
|
endPostUpdate();
|
|
776
989
|
}
|
|
990
|
+
{
|
|
991
|
+
hostRef.$onInstanceResolve$(elm);
|
|
992
|
+
}
|
|
777
993
|
{
|
|
778
994
|
if (hostRef.$onRenderResolve$) {
|
|
779
995
|
hostRef.$onRenderResolve$();
|
|
@@ -826,15 +1042,38 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
826
1042
|
`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).`
|
|
827
1043
|
);
|
|
828
1044
|
}
|
|
1045
|
+
const elm = hostRef.$hostElement$ ;
|
|
829
1046
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
830
1047
|
const flags = hostRef.$flags$;
|
|
831
1048
|
const instance = hostRef.$lazyInstance$ ;
|
|
832
1049
|
newVal = parsePropertyValue(
|
|
833
|
-
newVal
|
|
1050
|
+
newVal,
|
|
1051
|
+
cmpMeta.$members$[propName][0]);
|
|
834
1052
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
835
1053
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
836
1054
|
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
837
1055
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1056
|
+
if (BUILD.propChangeCallback && cmpMeta.$watchers$) {
|
|
1057
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1058
|
+
if (watchMethods) {
|
|
1059
|
+
watchMethods.map((watcher) => {
|
|
1060
|
+
try {
|
|
1061
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
1062
|
+
if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
|
|
1063
|
+
if (!instance) {
|
|
1064
|
+
hostRef.$fetchedCbList$.push(() => {
|
|
1065
|
+
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
1066
|
+
});
|
|
1067
|
+
} else {
|
|
1068
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
} catch (e) {
|
|
1072
|
+
consoleError(e, elm);
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
838
1077
|
if (flags & 2 /* hasRendered */) {
|
|
839
1078
|
if (instance.componentShouldUpdate) {
|
|
840
1079
|
const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
|
|
@@ -848,16 +1087,25 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
848
1087
|
}
|
|
849
1088
|
}
|
|
850
1089
|
};
|
|
851
|
-
|
|
852
|
-
// src/runtime/proxy-component.ts
|
|
853
1090
|
var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
854
|
-
var _a;
|
|
1091
|
+
var _a, _b;
|
|
855
1092
|
const prototype = Cstr.prototype;
|
|
856
1093
|
if (cmpMeta.$members$ || BUILD.propChangeCallback) {
|
|
1094
|
+
if (BUILD.propChangeCallback) {
|
|
1095
|
+
if (Cstr.watchers && !cmpMeta.$watchers$) {
|
|
1096
|
+
cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
|
|
1097
|
+
}
|
|
1098
|
+
if (Cstr.deserializers && !cmpMeta.$deserializers$) {
|
|
1099
|
+
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
1100
|
+
}
|
|
1101
|
+
if (Cstr.serializers && !cmpMeta.$serializers$) {
|
|
1102
|
+
cmpMeta.$serializers$ = Cstr.serializers;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
857
1105
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
|
858
1106
|
members.map(([memberName, [memberFlags]]) => {
|
|
859
1107
|
if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
|
|
860
|
-
const { get: origGetter, set: origSetter } =
|
|
1108
|
+
const { get: origGetter, set: origSetter } = getPropertyDescriptor(prototype, memberName) || {};
|
|
861
1109
|
if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
|
|
862
1110
|
if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
|
|
863
1111
|
if (flags & 1 /* isElementConstructor */ || !origGetter) {
|
|
@@ -890,7 +1138,8 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
890
1138
|
}
|
|
891
1139
|
origSetter.apply(this, [
|
|
892
1140
|
parsePropertyValue(
|
|
893
|
-
newValue
|
|
1141
|
+
newValue,
|
|
1142
|
+
memberFlags)
|
|
894
1143
|
]);
|
|
895
1144
|
newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
896
1145
|
setValue(this, memberName, newValue, cmpMeta);
|
|
@@ -908,37 +1157,108 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
908
1157
|
}
|
|
909
1158
|
return;
|
|
910
1159
|
}
|
|
911
|
-
const
|
|
1160
|
+
const parsedValue = parsePropertyValue(
|
|
1161
|
+
newValue,
|
|
1162
|
+
memberFlags);
|
|
1163
|
+
const setterSetVal = (val) => {
|
|
912
1164
|
const currentValue = ref.$lazyInstance$[memberName];
|
|
913
1165
|
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
914
1166
|
ref.$instanceValues$.set(memberName, currentValue);
|
|
915
1167
|
}
|
|
916
|
-
ref.$lazyInstance$[memberName] =
|
|
917
|
-
newValue);
|
|
1168
|
+
ref.$lazyInstance$[memberName] = val;
|
|
918
1169
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
919
1170
|
};
|
|
920
1171
|
if (ref.$lazyInstance$) {
|
|
921
|
-
setterSetVal();
|
|
1172
|
+
setterSetVal(parsedValue);
|
|
922
1173
|
} else {
|
|
1174
|
+
ref.$instanceValues$.set(memberName, parsedValue);
|
|
923
1175
|
ref.$fetchedCbList$.push(() => {
|
|
924
|
-
|
|
1176
|
+
const pendingValue = ref.$instanceValues$.get(memberName);
|
|
1177
|
+
if (ref.$lazyInstance$[memberName] !== pendingValue) {
|
|
1178
|
+
setterSetVal(pendingValue);
|
|
1179
|
+
}
|
|
925
1180
|
});
|
|
926
1181
|
}
|
|
927
1182
|
}
|
|
928
1183
|
}
|
|
929
1184
|
});
|
|
1185
|
+
} else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
|
|
1186
|
+
Object.defineProperty(prototype, memberName, {
|
|
1187
|
+
value(...args) {
|
|
1188
|
+
var _a2;
|
|
1189
|
+
const ref = getHostRef(this);
|
|
1190
|
+
return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
|
|
1191
|
+
var _a3;
|
|
1192
|
+
return (_a3 = ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
930
1196
|
}
|
|
931
1197
|
});
|
|
1198
|
+
if ((flags & 1 /* isElementConstructor */)) {
|
|
1199
|
+
const attrNameToPropName = /* @__PURE__ */ new Map();
|
|
1200
|
+
prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
|
|
1201
|
+
plt.jmp(() => {
|
|
1202
|
+
var _a2;
|
|
1203
|
+
const propName = attrNameToPropName.get(attrName);
|
|
1204
|
+
const hostRef = getHostRef(this);
|
|
1205
|
+
if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
|
|
1206
|
+
newValue = this[propName];
|
|
1207
|
+
delete this[propName];
|
|
1208
|
+
}
|
|
1209
|
+
if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
|
|
1210
|
+
this[propName] == newValue) {
|
|
1211
|
+
return;
|
|
1212
|
+
} else if (propName == null) {
|
|
1213
|
+
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
1214
|
+
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
|
|
1215
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1216
|
+
const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
|
|
1217
|
+
entry == null ? void 0 : entry.forEach((watcher) => {
|
|
1218
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
1219
|
+
if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
|
|
1220
|
+
instance[watchMethodName].call(instance, newValue, oldValue, attrName);
|
|
1221
|
+
}
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
const propFlags = members.find(([m]) => m === propName);
|
|
1227
|
+
const propMemberFlags = propFlags ? propFlags[1][0] : 0;
|
|
1228
|
+
const isBooleanTarget = propMemberFlags & 4 /* Boolean */;
|
|
1229
|
+
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
1230
|
+
if (isBooleanTarget) {
|
|
1231
|
+
newValue = newValue === null || newValue === "false" ? false : true;
|
|
1232
|
+
}
|
|
1233
|
+
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
1234
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
|
|
1235
|
+
this[propName] = newValue;
|
|
1236
|
+
}
|
|
1237
|
+
});
|
|
1238
|
+
};
|
|
1239
|
+
Cstr.observedAttributes = Array.from(
|
|
1240
|
+
/* @__PURE__ */ new Set([
|
|
1241
|
+
...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
|
|
1242
|
+
...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
|
|
1243
|
+
const attrName = m[1] || propName;
|
|
1244
|
+
attrNameToPropName.set(attrName, propName);
|
|
1245
|
+
return attrName;
|
|
1246
|
+
})
|
|
1247
|
+
])
|
|
1248
|
+
);
|
|
1249
|
+
}
|
|
932
1250
|
}
|
|
933
1251
|
return Cstr;
|
|
934
1252
|
};
|
|
935
1253
|
|
|
936
1254
|
// src/runtime/initialize-component.ts
|
|
937
1255
|
var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
1256
|
+
var _a;
|
|
938
1257
|
let Cstr;
|
|
939
1258
|
try {
|
|
940
1259
|
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
941
1260
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1261
|
+
hostRef.$flags$ &= -1025 /* hasFailedLoad */;
|
|
942
1262
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
943
1263
|
if (bundleId) {
|
|
944
1264
|
const CstrImport = loadModule(cmpMeta, hostRef);
|
|
@@ -950,9 +1270,19 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
950
1270
|
Cstr = CstrImport;
|
|
951
1271
|
}
|
|
952
1272
|
if (!Cstr) {
|
|
1273
|
+
hostRef.$flags$ &= -33 /* hasInitializedComponent */;
|
|
1274
|
+
hostRef.$loadRetryCount$ = ((_a = hostRef.$loadRetryCount$) != null ? _a : 0) + 1;
|
|
1275
|
+
if (hostRef.$loadRetryCount$ < MAX_LAZY_LOAD_RETRIES) {
|
|
1276
|
+
hostRef.$flags$ |= 1024 /* hasFailedLoad */;
|
|
1277
|
+
}
|
|
953
1278
|
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
954
1279
|
}
|
|
955
1280
|
if (!Cstr.isProxied) {
|
|
1281
|
+
if (BUILD.propChangeCallback) {
|
|
1282
|
+
cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
|
|
1283
|
+
cmpMeta.$serializers$ = Cstr.serializers;
|
|
1284
|
+
cmpMeta.$deserializers$ = Cstr.deserializers;
|
|
1285
|
+
}
|
|
956
1286
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
957
1287
|
Cstr.isProxied = true;
|
|
958
1288
|
}
|
|
@@ -968,6 +1298,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
968
1298
|
{
|
|
969
1299
|
hostRef.$flags$ &= -9 /* isConstructingInstance */;
|
|
970
1300
|
}
|
|
1301
|
+
if (BUILD.propChangeCallback) {
|
|
1302
|
+
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1303
|
+
}
|
|
971
1304
|
endNewInstance();
|
|
972
1305
|
{
|
|
973
1306
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
@@ -1003,7 +1336,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1003
1336
|
hostRef.$onRenderResolve$();
|
|
1004
1337
|
hostRef.$onRenderResolve$ = void 0;
|
|
1005
1338
|
}
|
|
1006
|
-
if (hostRef.$onReadyResolve$) {
|
|
1339
|
+
if (hostRef.$onReadyResolve$ && !(hostRef.$flags$ & 1024 /* hasFailedLoad */)) {
|
|
1007
1340
|
hostRef.$onReadyResolve$(elm);
|
|
1008
1341
|
}
|
|
1009
1342
|
}
|
|
@@ -1036,7 +1369,7 @@ var connectedCallback = (elm) => {
|
|
|
1036
1369
|
}
|
|
1037
1370
|
if (cmpMeta.$members$) {
|
|
1038
1371
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1039
|
-
if (memberFlags & 31 /* Prop */ &&
|
|
1372
|
+
if (memberFlags & 31 /* Prop */ && Object.prototype.hasOwnProperty.call(elm, memberName)) {
|
|
1040
1373
|
const value = elm[memberName];
|
|
1041
1374
|
delete elm[memberName];
|
|
1042
1375
|
elm[memberName] = value;
|
|
@@ -1049,6 +1382,8 @@ var connectedCallback = (elm) => {
|
|
|
1049
1382
|
} else {
|
|
1050
1383
|
if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
1051
1384
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
1385
|
+
} else if (hostRef.$flags$ & 1024 /* hasFailedLoad */) {
|
|
1386
|
+
setTimeout(() => initializeComponent(elm, hostRef, cmpMeta), LAZY_LOAD_RETRY_INTERVAL_MS);
|
|
1052
1387
|
} else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
|
|
1053
1388
|
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
|
|
1054
1389
|
}
|
|
@@ -1099,6 +1434,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1099
1434
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
|
|
1100
1435
|
lazyBundles.map((lazyBundle) => {
|
|
1101
1436
|
lazyBundle[1].map((compactMeta) => {
|
|
1437
|
+
var _a2, _b;
|
|
1102
1438
|
const cmpMeta = {
|
|
1103
1439
|
$flags$: compactMeta[0],
|
|
1104
1440
|
$tagName$: compactMeta[1],
|
|
@@ -1108,6 +1444,11 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1108
1444
|
{
|
|
1109
1445
|
cmpMeta.$members$ = compactMeta[2];
|
|
1110
1446
|
}
|
|
1447
|
+
if (BUILD.propChangeCallback) {
|
|
1448
|
+
cmpMeta.$watchers$ = normalizeWatchers(compactMeta[4]);
|
|
1449
|
+
cmpMeta.$serializers$ = (_a2 = compactMeta[5]) != null ? _a2 : {};
|
|
1450
|
+
cmpMeta.$deserializers$ = (_b = compactMeta[6]) != null ? _b : {};
|
|
1451
|
+
}
|
|
1111
1452
|
const tagName = transformTag(cmpMeta.$tagName$);
|
|
1112
1453
|
const HostElement = class extends HTMLElement {
|
|
1113
1454
|
["s-p"];
|
|
@@ -1118,6 +1459,19 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1118
1459
|
super(self);
|
|
1119
1460
|
self = this;
|
|
1120
1461
|
registerHost(self, cmpMeta);
|
|
1462
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1463
|
+
{
|
|
1464
|
+
if (!self.shadowRoot) {
|
|
1465
|
+
createShadowRoot.call(self, cmpMeta);
|
|
1466
|
+
} else {
|
|
1467
|
+
if (self.shadowRoot.mode !== "open") {
|
|
1468
|
+
throw new Error(
|
|
1469
|
+
`Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
|
|
1470
|
+
);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1121
1475
|
}
|
|
1122
1476
|
connectedCallback() {
|
|
1123
1477
|
const hostRef = getHostRef(this);
|
|
@@ -1139,7 +1493,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1139
1493
|
}
|
|
1140
1494
|
disconnectedCallback() {
|
|
1141
1495
|
plt.jmp(() => disconnectedCallback(this));
|
|
1142
|
-
|
|
1496
|
+
nextTick(() => {
|
|
1143
1497
|
var _a3;
|
|
1144
1498
|
const hostRef = getHostRef(this);
|
|
1145
1499
|
if (!hostRef) {
|
|
@@ -1199,4 +1553,4 @@ function transformTag(tag) {
|
|
|
1199
1553
|
return tag;
|
|
1200
1554
|
}
|
|
1201
1555
|
|
|
1202
|
-
export { Host as H, bootstrapLazy as b, forceUpdate as f, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
1556
|
+
export { BUILD as B, Host as H, bootstrapLazy as b, forceUpdate as f, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|