@swisspost/design-system-components 1.3.10 → 1.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/check-non-empty-35b4d0b5.js +14 -0
- package/dist/cjs/check-non-empty-35b4d0b5.js.map +1 -0
- package/dist/cjs/check-one-of-4c2e8b2e.js +10 -0
- package/dist/cjs/check-one-of-4c2e8b2e.js.map +1 -0
- package/dist/cjs/{package-f6bb523d.js → check-type-508a21a5.js} +1 -10
- package/dist/cjs/check-type-508a21a5.js.map +1 -0
- package/dist/cjs/fade-8c6d4fa7.js +12 -0
- package/dist/cjs/fade-8c6d4fa7.js.map +1 -0
- package/dist/cjs/{index-272283b3.js → index-12cc37c9.js} +121 -5
- package/dist/{post-components/p-0096c140.js.map → cjs/index-12cc37c9.js.map} +1 -1
- package/dist/cjs/index-f8f6f146.js +28 -0
- package/dist/cjs/index-f8f6f146.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/package-67091813.js +7 -0
- package/dist/cjs/package-67091813.js.map +1 -0
- package/dist/cjs/post-alert.cjs.entry.js +106 -0
- package/dist/cjs/post-alert.cjs.entry.js.map +1 -0
- package/dist/cjs/post-collapsible.cjs.entry.js +6 -4
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-icon.cjs.entry.js +14 -29
- package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tab-header.cjs.entry.js +35 -0
- package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -0
- package/dist/cjs/post-tab-panel.cjs.entry.js +29 -0
- package/dist/cjs/post-tab-panel.cjs.entry.js.map +1 -0
- package/dist/cjs/post-tabs.cjs.entry.js +136 -0
- package/dist/cjs/post-tabs.cjs.entry.js.map +1 -0
- package/dist/cjs/post-tooltip.cjs.entry.js +5097 -0
- package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -0
- package/dist/collection/animations/fade.js +6 -0
- package/dist/collection/animations/fade.js.map +1 -0
- package/dist/collection/animations/index.js +2 -0
- package/dist/collection/animations/index.js.map +1 -0
- package/dist/collection/collection-manifest.json +6 -1
- package/dist/collection/components/post-alert/alert-types.js +2 -0
- package/dist/collection/components/post-alert/alert-types.js.map +1 -0
- package/dist/collection/components/post-alert/post-alert.css +563 -0
- package/dist/collection/components/post-alert/post-alert.js +256 -0
- package/dist/collection/components/post-alert/post-alert.js.map +1 -0
- package/dist/collection/components/post-collapsible/post-collapsible.css +7 -0
- package/dist/collection/components/post-tab-header/post-tab-header.css +337 -0
- package/dist/collection/components/post-tab-header/post-tab-header.js +68 -0
- package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.css +3 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +55 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.js.map +1 -0
- package/dist/collection/components/post-tabs/post-tabs.css +148 -0
- package/dist/collection/components/post-tabs/post-tabs.js +208 -0
- package/dist/collection/components/post-tabs/post-tabs.js.map +1 -0
- package/dist/collection/components/post-tooltip/post-tooltip.css +194 -0
- package/dist/collection/components/post-tooltip/post-tooltip.js +338 -0
- package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -0
- package/dist/collection/components/post-tooltip/types.js +2 -0
- package/dist/collection/components/post-tooltip/types.js.map +1 -0
- package/dist/collection/utils/property-checkers/check-one-of.js.map +1 -1
- package/dist/collection/utils/property-checkers/check-pattern.js +5 -0
- package/dist/collection/utils/property-checkers/check-pattern.js.map +1 -0
- package/dist/collection/utils/property-checkers/index.js +3 -0
- package/dist/collection/utils/property-checkers/index.js.map +1 -1
- package/dist/components/check-non-empty.js +11 -0
- package/dist/components/check-non-empty.js.map +1 -0
- package/dist/components/check-one-of.js +8 -0
- package/dist/components/check-one-of.js.map +1 -0
- package/dist/{esm/package-bcf00737.js → components/check-type.js} +2 -9
- package/dist/components/check-type.js.map +1 -0
- package/dist/components/fade.js +9 -0
- package/dist/components/fade.js.map +1 -0
- package/dist/components/package.js +2 -20
- package/dist/components/package.js.map +1 -1
- package/dist/components/post-alert.d.ts +11 -0
- package/dist/components/post-alert.js +136 -0
- package/dist/components/post-alert.js.map +1 -0
- package/dist/components/post-collapsible.js +3 -1
- package/dist/components/post-collapsible.js.map +1 -1
- package/dist/components/post-icon.js +1 -141
- package/dist/components/post-icon.js.map +1 -1
- package/dist/components/post-icon2.js +146 -0
- package/dist/components/post-icon2.js.map +1 -0
- package/dist/components/post-tab-header.d.ts +11 -0
- package/dist/components/post-tab-header.js +52 -0
- package/dist/components/post-tab-header.js.map +1 -0
- package/dist/components/post-tab-panel.d.ts +11 -0
- package/dist/components/post-tab-panel.js +46 -0
- package/dist/components/post-tab-panel.js.map +1 -0
- package/dist/components/post-tabs.d.ts +11 -0
- package/dist/components/post-tabs.js +153 -0
- package/dist/components/post-tabs.js.map +1 -0
- package/dist/components/post-tooltip.d.ts +11 -0
- package/dist/components/post-tooltip.js +5118 -0
- package/dist/components/post-tooltip.js.map +1 -0
- package/dist/docs.json +441 -1
- package/dist/esm/check-non-empty-554bdf88.js +11 -0
- package/dist/esm/check-non-empty-554bdf88.js.map +1 -0
- package/dist/esm/check-one-of-ded5e15e.js +8 -0
- package/dist/esm/check-one-of-ded5e15e.js.map +1 -0
- package/dist/esm/check-type-18ebb4e7.js +16 -0
- package/dist/esm/check-type-18ebb4e7.js.map +1 -0
- package/dist/esm/fade-671f1489.js +9 -0
- package/dist/esm/fade-671f1489.js.map +1 -0
- package/dist/esm/{index-60a84798.js → index-5611074b.js} +121 -6
- package/dist/esm/index-5611074b.js.map +1 -0
- package/dist/esm/index-7f723686.js +24 -0
- package/dist/esm/index-7f723686.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-f5cb3167.js +5 -0
- package/dist/esm/package-f5cb3167.js.map +1 -0
- package/dist/esm/post-alert.entry.js +102 -0
- package/dist/esm/post-alert.entry.js.map +1 -0
- package/dist/esm/post-collapsible.entry.js +4 -2
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-icon.entry.js +6 -21
- package/dist/esm/post-icon.entry.js.map +1 -1
- package/dist/esm/post-tab-header.entry.js +31 -0
- package/dist/esm/post-tab-header.entry.js.map +1 -0
- package/dist/esm/post-tab-panel.entry.js +25 -0
- package/dist/esm/post-tab-panel.entry.js.map +1 -0
- package/dist/esm/post-tabs.entry.js +132 -0
- package/dist/esm/post-tabs.entry.js.map +1 -0
- package/dist/esm/post-tooltip.entry.js +5093 -0
- package/dist/esm/post-tooltip.entry.js.map +1 -0
- package/dist/post-components/p-12046db8.entry.js +2 -0
- package/dist/post-components/{p-99ccf0cf.entry.js.map → p-12046db8.entry.js.map} +1 -1
- package/dist/post-components/p-15fc087f.js +2 -0
- package/dist/post-components/p-15fc087f.js.map +1 -0
- package/dist/post-components/p-24b07f64.js +2 -0
- package/dist/post-components/p-24b07f64.js.map +1 -0
- package/dist/post-components/p-29535fea.entry.js +2 -0
- package/dist/post-components/p-29535fea.entry.js.map +1 -0
- package/dist/post-components/p-296af738.entry.js +2 -0
- package/dist/post-components/p-296af738.entry.js.map +1 -0
- package/dist/post-components/p-2b6ab354.entry.js +9 -0
- package/dist/post-components/p-2b6ab354.entry.js.map +1 -0
- package/dist/post-components/p-75a7b352.js +2 -0
- package/dist/post-components/p-75a7b352.js.map +1 -0
- package/dist/post-components/p-a14ec7bb.entry.js +2 -0
- package/dist/post-components/p-a14ec7bb.entry.js.map +1 -0
- package/dist/post-components/p-bcc705f1.js +2 -0
- package/dist/post-components/p-bcc705f1.js.map +1 -0
- package/dist/post-components/p-c7497ecb.entry.js +2 -0
- package/dist/post-components/p-c7497ecb.entry.js.map +1 -0
- package/dist/post-components/p-c8efe0ae.js +2 -0
- package/dist/post-components/p-c8efe0ae.js.map +1 -0
- package/dist/post-components/p-cc6e4eb8.entry.js +2 -0
- package/dist/post-components/p-cc6e4eb8.entry.js.map +1 -0
- package/dist/post-components/p-d94db268.js +3 -0
- package/dist/post-components/p-d94db268.js.map +1 -0
- package/dist/post-components/p-e5306504.js +2 -0
- package/dist/post-components/p-e5306504.js.map +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/dist/types/animations/fade.d.ts +2 -0
- package/dist/types/animations/index.d.ts +1 -0
- package/dist/types/components/post-alert/alert-types.d.ts +2 -0
- package/dist/types/components/post-alert/post-alert.d.ts +49 -0
- package/dist/types/components/post-tab-header/post-tab-header.d.ts +11 -0
- package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +10 -0
- package/dist/types/components/post-tabs/post-tabs.d.ts +34 -0
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +66 -0
- package/dist/types/components/post-tooltip/types.d.ts +2 -0
- package/dist/types/components.d.ts +190 -0
- package/dist/types/utils/property-checkers/check-one-of.d.ts +1 -1
- package/dist/types/utils/property-checkers/check-pattern.d.ts +1 -0
- package/dist/types/utils/property-checkers/index.d.ts +3 -1
- package/package.json +13 -9
- package/dist/cjs/index-272283b3.js.map +0 -1
- package/dist/cjs/package-f6bb523d.js.map +0 -1
- package/dist/esm/index-60a84798.js.map +0 -1
- package/dist/esm/package-bcf00737.js.map +0 -1
- package/dist/post-components/p-0096c140.js +0 -3
- package/dist/post-components/p-4a3ff4c0.js +0 -2
- package/dist/post-components/p-4a3ff4c0.js.map +0 -1
- package/dist/post-components/p-99ccf0cf.entry.js +0 -2
- package/dist/post-components/p-cafa0281.entry.js +0 -2
- package/dist/post-components/p-cafa0281.entry.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const EMPTY_VALUES = [undefined, null, ''];
|
|
4
|
+
|
|
5
|
+
function checkNonEmpty(value, error) {
|
|
6
|
+
if (EMPTY_VALUES.some(v => v === value)) {
|
|
7
|
+
throw new Error(error);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.EMPTY_VALUES = EMPTY_VALUES;
|
|
12
|
+
exports.checkNonEmpty = checkNonEmpty;
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=check-non-empty-35b4d0b5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"check-non-empty-35b4d0b5.js","mappings":";;MAAa,YAAY,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE;;SCEhC,aAAa,CAAC,KAAc,EAAE,KAAa;EACzD,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,EAAE;IACvC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GACxB;AACH;;;;;","names":[],"sources":["./src/utils/property-checkers/constants.ts","./src/utils/property-checkers/check-non-empty.ts"],"sourcesContent":["export const EMPTY_VALUES = [undefined, null, ''];\n","import { EMPTY_VALUES } from './constants';\n\nexport function checkNonEmpty(value: unknown, error: string) {\n if (EMPTY_VALUES.some(v => v === value)) {\n throw new Error(error);\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"check-one-of-4c2e8b2e.js","mappings":";;SAAgB,UAAU,CAAI,KAAQ,EAAE,cAA4B,EAAE,KAAa;EACjF,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9D;;;;","names":[],"sources":["./src/utils/property-checkers/check-one-of.ts"],"sourcesContent":["export function checkOneOf<T>(value: T, possibleValues: readonly T[], error: string) {\n if (!possibleValues.includes(value)) throw new Error(error);\n}\n"],"version":3}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function checkOneOf(value, possibleValues, error) {
|
|
4
|
-
if (!possibleValues.includes(value))
|
|
5
|
-
throw new Error(error);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
3
|
function checkType(value, type, error) {
|
|
9
4
|
const typeIsArray = type === 'array';
|
|
10
5
|
const valueIsArray = Array.isArray(value);
|
|
@@ -18,10 +13,6 @@ function checkType(value, type, error) {
|
|
|
18
13
|
}
|
|
19
14
|
}
|
|
20
15
|
|
|
21
|
-
const version = "1.3.10";
|
|
22
|
-
|
|
23
|
-
exports.checkOneOf = checkOneOf;
|
|
24
16
|
exports.checkType = checkType;
|
|
25
|
-
exports.version = version;
|
|
26
17
|
|
|
27
|
-
//# sourceMappingURL=
|
|
18
|
+
//# sourceMappingURL=check-type-508a21a5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"check-type-508a21a5.js","mappings":";;SAQgB,SAAS,CAAC,KAAc,EAAE,IAAkB,EAAE,KAAa;EACzE,MAAM,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC;EACrC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;EAE1C,IAAI,WAAW,IAAI,YAAY,EAAE;IAC/B,IAAI,YAAY,KAAK,WAAW;MAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GAC1D;OAAM;IACL,IAAI,OAAO,KAAK,KAAK,IAAI;MAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GACnD;AACH;;;;","names":[],"sources":["./src/utils/property-checkers/check-type.ts"],"sourcesContent":["export type PropertyType =\n | 'boolean'\n | 'number'\n | 'string'\n | 'array'\n | 'object'\n | 'function';\n\nexport function checkType(value: unknown, type: PropertyType, error: string) {\n const typeIsArray = type === 'array';\n const valueIsArray = Array.isArray(value);\n\n if (typeIsArray || valueIsArray) {\n if (valueIsArray !== typeIsArray) throw new Error(error);\n } else {\n if (typeof value !== type) throw new Error(error);\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fadeDuration = 200;
|
|
4
|
+
const fadedOutKeyFrame = { opacity: '0' };
|
|
5
|
+
const fadedInKeyFrame = { opacity: '1' };
|
|
6
|
+
const fadeIn = (el) => el.animate([fadedOutKeyFrame, fadedInKeyFrame], { duration: fadeDuration });
|
|
7
|
+
const fadeOut = (el) => el.animate([fadedInKeyFrame, fadedOutKeyFrame], { duration: fadeDuration });
|
|
8
|
+
|
|
9
|
+
exports.fadeIn = fadeIn;
|
|
10
|
+
exports.fadeOut = fadeOut;
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=fade-8c6d4fa7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"fade-8c6d4fa7.js","mappings":";;AAAA,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,gBAAgB,GAAG,EAAC,OAAO,EAAE,GAAG,EAAC,CAAC;AACxC,MAAM,eAAe,GAAG,EAAC,OAAO,EAAE,GAAG,EAAC,CAAC;MAE1B,MAAM,GAAG,CAAC,EAAW,KAAgB,EAAE,CAAC,OAAO,CAC1D,CAAE,gBAAgB,EAAE,eAAe,CAAE,EACrC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAC1B;MAEW,OAAO,GAAG,CAAC,EAAW,KAAgB,EAAE,CAAC,OAAO,CAC3D,CAAE,eAAe,EAAE,gBAAgB,CAAE,EACrC,EAAE,QAAQ,EAAE,YAAY,EAAE;;;;;","names":[],"sources":["./src/animations/fade.ts"],"sourcesContent":["const fadeDuration = 200;\nconst fadedOutKeyFrame = {opacity: '0'};\nconst fadedInKeyFrame = {opacity: '1'};\n\nexport const fadeIn = (el: Element): Animation => el.animate(\n [ fadedOutKeyFrame, fadedInKeyFrame ],\n { duration: fadeDuration }\n);\n\nexport const fadeOut = (el: Element): Animation => el.animate(\n [ fadedInKeyFrame, fadedOutKeyFrame ],\n { duration: fadeDuration }\n);\n"],"version":3}
|
|
@@ -99,6 +99,7 @@ function queryNonceMetaTagContent(doc) {
|
|
|
99
99
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
100
100
|
const h = (nodeName, vnodeData, ...children) => {
|
|
101
101
|
let child = null;
|
|
102
|
+
let key = null;
|
|
102
103
|
let simple = false;
|
|
103
104
|
let lastSimple = false;
|
|
104
105
|
const vNodeChildren = [];
|
|
@@ -126,6 +127,10 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
126
127
|
};
|
|
127
128
|
walk(children);
|
|
128
129
|
if (vnodeData) {
|
|
130
|
+
// normalize class / classname attributes
|
|
131
|
+
if (vnodeData.key) {
|
|
132
|
+
key = vnodeData.key;
|
|
133
|
+
}
|
|
129
134
|
{
|
|
130
135
|
const classData = vnodeData.className || vnodeData.class;
|
|
131
136
|
if (classData) {
|
|
@@ -147,6 +152,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
147
152
|
if (vNodeChildren.length > 0) {
|
|
148
153
|
vnode.$children$ = vNodeChildren;
|
|
149
154
|
}
|
|
155
|
+
{
|
|
156
|
+
vnode.$key$ = key;
|
|
157
|
+
}
|
|
150
158
|
return vnode;
|
|
151
159
|
};
|
|
152
160
|
/**
|
|
@@ -168,6 +176,9 @@ const newVNode = (tag, text) => {
|
|
|
168
176
|
{
|
|
169
177
|
vnode.$attrs$ = null;
|
|
170
178
|
}
|
|
179
|
+
{
|
|
180
|
+
vnode.$key$ = null;
|
|
181
|
+
}
|
|
171
182
|
return vnode;
|
|
172
183
|
};
|
|
173
184
|
const Host = {};
|
|
@@ -279,6 +290,19 @@ const parsePropertyValue = (propValue, propType) => {
|
|
|
279
290
|
return propValue;
|
|
280
291
|
};
|
|
281
292
|
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
293
|
+
const createEvent = (ref, name, flags) => {
|
|
294
|
+
const elm = getElement(ref);
|
|
295
|
+
return {
|
|
296
|
+
emit: (detail) => {
|
|
297
|
+
return emitEvent(elm, name, {
|
|
298
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
299
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
300
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
301
|
+
detail,
|
|
302
|
+
});
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
};
|
|
282
306
|
/**
|
|
283
307
|
* Helper function to create & dispatch a custom Event on a provided target
|
|
284
308
|
* @param elm the target of the Event
|
|
@@ -413,6 +437,14 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
413
437
|
}
|
|
414
438
|
}
|
|
415
439
|
}
|
|
440
|
+
else if (memberName === 'key')
|
|
441
|
+
;
|
|
442
|
+
else if (memberName === 'ref') {
|
|
443
|
+
// minifier will clean this up
|
|
444
|
+
if (newValue) {
|
|
445
|
+
newValue(elm);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
416
448
|
else if ((!isProp ) &&
|
|
417
449
|
memberName[0] === 'o' &&
|
|
418
450
|
memberName[1] === 'n') {
|
|
@@ -529,7 +561,11 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
529
561
|
let i = 0;
|
|
530
562
|
let elm;
|
|
531
563
|
let childNode;
|
|
532
|
-
{
|
|
564
|
+
if (newVNode.$text$ !== null) {
|
|
565
|
+
// create text node
|
|
566
|
+
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
533
569
|
if (!isSvgMode) {
|
|
534
570
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
535
571
|
}
|
|
@@ -619,6 +655,7 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
|
619
655
|
const vnode = vnodes[index];
|
|
620
656
|
if (vnode) {
|
|
621
657
|
const elm = vnode.$elm$;
|
|
658
|
+
nullifyVNodeRefs(vnode);
|
|
622
659
|
if (elm) {
|
|
623
660
|
// remove the vnode's element from the dom
|
|
624
661
|
elm.remove();
|
|
@@ -697,6 +734,8 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
|
697
734
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
698
735
|
let oldStartIdx = 0;
|
|
699
736
|
let newStartIdx = 0;
|
|
737
|
+
let idxInOld = 0;
|
|
738
|
+
let i = 0;
|
|
700
739
|
let oldEndIdx = oldCh.length - 1;
|
|
701
740
|
let oldStartVnode = oldCh[0];
|
|
702
741
|
let oldEndVnode = oldCh[oldEndIdx];
|
|
@@ -704,6 +743,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
704
743
|
let newStartVnode = newCh[0];
|
|
705
744
|
let newEndVnode = newCh[newEndIdx];
|
|
706
745
|
let node;
|
|
746
|
+
let elmToMove;
|
|
707
747
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
708
748
|
if (oldStartVnode == null) {
|
|
709
749
|
// VNode might have been moved left
|
|
@@ -770,7 +810,41 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
770
810
|
newStartVnode = newCh[++newStartIdx];
|
|
771
811
|
}
|
|
772
812
|
else {
|
|
813
|
+
// Here we do some checks to match up old and new nodes based on the
|
|
814
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
|
815
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
|
816
|
+
// component.
|
|
817
|
+
//
|
|
818
|
+
// First we check to see if there are any nodes in the array of old
|
|
819
|
+
// children which have the same key as the first node in the new
|
|
820
|
+
// children.
|
|
821
|
+
idxInOld = -1;
|
|
773
822
|
{
|
|
823
|
+
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
824
|
+
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
|
825
|
+
idxInOld = i;
|
|
826
|
+
break;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
if (idxInOld >= 0) {
|
|
831
|
+
// We found a node in the old children which matches up with the first
|
|
832
|
+
// node in the new children! So let's deal with that
|
|
833
|
+
elmToMove = oldCh[idxInOld];
|
|
834
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
835
|
+
// the tag doesn't match so we'll need a new DOM element
|
|
836
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
837
|
+
}
|
|
838
|
+
else {
|
|
839
|
+
patch(elmToMove, newStartVnode);
|
|
840
|
+
// invalidate the matching old node so that we won't try to update it
|
|
841
|
+
// again later on
|
|
842
|
+
oldCh[idxInOld] = undefined;
|
|
843
|
+
node = elmToMove.$elm$;
|
|
844
|
+
}
|
|
845
|
+
newStartVnode = newCh[++newStartIdx];
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
774
848
|
// We either didn't find an element in the old children that matches
|
|
775
849
|
// the key of the first new child OR the build is not using `key`
|
|
776
850
|
// attributes at all. In either case we need to create a new element
|
|
@@ -819,7 +893,10 @@ const isSameVnode = (leftVNode, rightVNode) => {
|
|
|
819
893
|
// compare if two vnode to see if they're "technically" the same
|
|
820
894
|
// need to have the same element tag, and same key to be the same
|
|
821
895
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
822
|
-
|
|
896
|
+
// this will be set if components in the build have `key` attrs set on them
|
|
897
|
+
{
|
|
898
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
899
|
+
}
|
|
823
900
|
}
|
|
824
901
|
return false;
|
|
825
902
|
};
|
|
@@ -836,7 +913,8 @@ const patch = (oldVNode, newVNode) => {
|
|
|
836
913
|
const oldChildren = oldVNode.$children$;
|
|
837
914
|
const newChildren = newVNode.$children$;
|
|
838
915
|
const tag = newVNode.$tag$;
|
|
839
|
-
|
|
916
|
+
const text = newVNode.$text$;
|
|
917
|
+
if (text === null) {
|
|
840
918
|
{
|
|
841
919
|
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
842
920
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
@@ -858,6 +936,11 @@ const patch = (oldVNode, newVNode) => {
|
|
|
858
936
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
859
937
|
}
|
|
860
938
|
else if (newChildren !== null) {
|
|
939
|
+
// no old child vnodes, but there are new child vnodes to add
|
|
940
|
+
if (oldVNode.$text$ !== null) {
|
|
941
|
+
// the old vnode was text, so be sure to clear it out
|
|
942
|
+
elm.textContent = '';
|
|
943
|
+
}
|
|
861
944
|
// add the new vnode children
|
|
862
945
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
863
946
|
}
|
|
@@ -869,6 +952,24 @@ const patch = (oldVNode, newVNode) => {
|
|
|
869
952
|
isSvgMode = false;
|
|
870
953
|
}
|
|
871
954
|
}
|
|
955
|
+
else if (oldVNode.$text$ !== text) {
|
|
956
|
+
// update the text content for the text only vnode
|
|
957
|
+
// and also only if the text is different than before
|
|
958
|
+
elm.data = text;
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
/**
|
|
962
|
+
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
|
|
963
|
+
* calling them with `null`. This signals that the DOM element corresponding to
|
|
964
|
+
* the VDom node has been removed from the DOM.
|
|
965
|
+
*
|
|
966
|
+
* @param vNode a virtual DOM node
|
|
967
|
+
*/
|
|
968
|
+
const nullifyVNodeRefs = (vNode) => {
|
|
969
|
+
{
|
|
970
|
+
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
971
|
+
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
|
972
|
+
}
|
|
872
973
|
};
|
|
873
974
|
/**
|
|
874
975
|
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
@@ -1319,6 +1420,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1319
1420
|
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1320
1421
|
}
|
|
1321
1422
|
endNewInstance();
|
|
1423
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
1322
1424
|
}
|
|
1323
1425
|
if (Cstr.style) {
|
|
1324
1426
|
// this component has styles but we haven't registered them yet
|
|
@@ -1347,6 +1449,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1347
1449
|
schedule();
|
|
1348
1450
|
}
|
|
1349
1451
|
};
|
|
1452
|
+
const fireConnectedCallback = (instance) => {
|
|
1453
|
+
{
|
|
1454
|
+
safeCall(instance, 'connectedCallback');
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1350
1457
|
const connectedCallback = (elm) => {
|
|
1351
1458
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1352
1459
|
const hostRef = getHostRef(elm);
|
|
@@ -1385,12 +1492,20 @@ const connectedCallback = (elm) => {
|
|
|
1385
1492
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
1386
1493
|
}
|
|
1387
1494
|
}
|
|
1495
|
+
else {
|
|
1496
|
+
// fire off connectedCallback() on component instance
|
|
1497
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
1498
|
+
}
|
|
1388
1499
|
endConnected();
|
|
1389
1500
|
}
|
|
1390
1501
|
};
|
|
1391
1502
|
const disconnectedCallback = (elm) => {
|
|
1392
1503
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1393
|
-
getHostRef(elm);
|
|
1504
|
+
const hostRef = getHostRef(elm);
|
|
1505
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1506
|
+
{
|
|
1507
|
+
safeCall(instance, 'disconnectedCallback');
|
|
1508
|
+
}
|
|
1394
1509
|
}
|
|
1395
1510
|
};
|
|
1396
1511
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
@@ -1609,10 +1724,11 @@ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
|
1609
1724
|
|
|
1610
1725
|
exports.Host = Host;
|
|
1611
1726
|
exports.bootstrapLazy = bootstrapLazy;
|
|
1727
|
+
exports.createEvent = createEvent;
|
|
1612
1728
|
exports.getElement = getElement;
|
|
1613
1729
|
exports.h = h;
|
|
1614
1730
|
exports.promiseResolve = promiseResolve;
|
|
1615
1731
|
exports.registerInstance = registerInstance;
|
|
1616
1732
|
exports.setNonce = setNonce;
|
|
1617
1733
|
|
|
1618
|
-
//# sourceMappingURL=index-
|
|
1734
|
+
//# sourceMappingURL=index-12cc37c9.js.map
|