@swisspost/design-system-components 1.3.4 → 1.3.6
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-126f28cf.js → index-f95ab17b.js} +62 -20
- package/dist/cjs/index-f95ab17b.js.map +1 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/{package-3838cb5b.js → package-79d607b8.js} +2 -2
- package/dist/cjs/{package-3838cb5b.js.map → package-79d607b8.js.map} +1 -1
- package/dist/cjs/post-collapsible.cjs.entry.js +3 -3
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +3 -3
- package/dist/cjs/post-components.cjs.js.map +1 -1
- package/dist/cjs/post-icon.cjs.entry.js +17 -84
- package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/post-collapsible/post-collapsible.css +1187 -48
- package/dist/collection/components/post-icon/post-icon.css +11 -3
- package/dist/collection/components/post-icon/post-icon.js +14 -82
- package/dist/collection/components/post-icon/post-icon.js.map +1 -1
- package/dist/collection/utils/property-checkers/tests/check-non-empty.spec.js +36 -0
- package/dist/collection/utils/property-checkers/tests/check-non-empty.spec.js.map +1 -0
- package/dist/collection/utils/property-checkers/tests/check-one-of.spec.js +13 -0
- package/dist/collection/utils/property-checkers/tests/check-one-of.spec.js.map +1 -0
- package/dist/collection/utils/property-checkers/tests/check-type.spec.js +103 -0
- package/dist/collection/utils/property-checkers/tests/check-type.spec.js.map +1 -0
- package/dist/collection/utils/property-checkers/tests/empty-or.spec.js +23 -0
- package/dist/collection/utils/property-checkers/tests/empty-or.spec.js.map +1 -0
- package/dist/collection/utils/tests/should-reduce-motion.spec.js +16 -0
- package/dist/collection/utils/tests/should-reduce-motion.spec.js.map +1 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-collapsible.js +2 -2
- package/dist/components/post-collapsible.js.map +1 -1
- package/dist/components/post-icon.js +16 -84
- package/dist/components/post-icon.js.map +1 -1
- package/dist/docs.json +3 -3
- package/dist/esm/{index-286143e7.js → index-0cfe0348.js} +62 -20
- package/dist/esm/index-0cfe0348.js.map +1 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/{package-fb4a74d0.js → package-ba1192d8.js} +2 -2
- package/dist/esm/{package-fb4a74d0.js.map → package-ba1192d8.js.map} +1 -1
- package/dist/esm/post-collapsible.entry.js +3 -3
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +4 -4
- package/dist/esm/post-components.js.map +1 -1
- package/dist/esm/post-icon.entry.js +17 -84
- package/dist/esm/post-icon.entry.js.map +1 -1
- package/dist/post-components/p-2f408d84.entry.js +2 -0
- package/dist/post-components/{p-7dd960f1.entry.js.map → p-2f408d84.entry.js.map} +1 -1
- package/dist/post-components/p-75734ad5.entry.js +2 -0
- package/dist/post-components/p-75734ad5.entry.js.map +1 -0
- package/dist/post-components/p-8f4d1bc9.js +3 -0
- package/dist/post-components/p-8f4d1bc9.js.map +1 -0
- package/dist/post-components/{p-87bf3416.js → p-a6796794.js} +2 -2
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/dist/types/components/post-icon/post-icon.d.ts +0 -8
- package/dist/types/stencil-public-runtime.d.ts +1 -0
- package/loader/index.d.ts +1 -1
- package/package.json +13 -14
- package/dist/cjs/index-126f28cf.js.map +0 -1
- package/dist/esm/index-286143e7.js.map +0 -1
- package/dist/post-components/p-0c286590.js +0 -3
- package/dist/post-components/p-0c286590.js.map +0 -1
- package/dist/post-components/p-6e225c16.entry.js +0 -2
- package/dist/post-components/p-6e225c16.entry.js.map +0 -1
- package/dist/post-components/p-7dd960f1.entry.js +0 -2
- /package/dist/post-components/{p-87bf3416.js.map → p-a6796794.js.map} +0 -0
|
@@ -613,15 +613,16 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
613
613
|
* @param vnodes a list of virtual DOM nodes to remove
|
|
614
614
|
* @param startIdx the index at which to start removing nodes (inclusive)
|
|
615
615
|
* @param endIdx the index at which to stop removing nodes (inclusive)
|
|
616
|
-
* @param vnode a VNode
|
|
617
|
-
* @param elm an element
|
|
618
616
|
*/
|
|
619
|
-
const removeVnodes = (vnodes, startIdx, endIdx
|
|
620
|
-
for (
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
elm
|
|
617
|
+
const removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
618
|
+
for (let index = startIdx; index <= endIdx; ++index) {
|
|
619
|
+
const vnode = vnodes[index];
|
|
620
|
+
if (vnode) {
|
|
621
|
+
const elm = vnode.$elm$;
|
|
622
|
+
if (elm) {
|
|
623
|
+
// remove the vnode's element from the dom
|
|
624
|
+
elm.remove();
|
|
625
|
+
}
|
|
625
626
|
}
|
|
626
627
|
}
|
|
627
628
|
};
|
|
@@ -916,23 +917,67 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
916
917
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
917
918
|
return writeTask(dispatch) ;
|
|
918
919
|
};
|
|
920
|
+
/**
|
|
921
|
+
* Dispatch initial-render and update lifecycle hooks, enqueuing calls to
|
|
922
|
+
* component lifecycle methods like `componentWillLoad` as well as
|
|
923
|
+
* {@link updateComponent}, which will kick off the virtual DOM re-render.
|
|
924
|
+
*
|
|
925
|
+
* @param hostRef a reference to a host DOM node
|
|
926
|
+
* @param isInitialLoad whether we're on the initial load or not
|
|
927
|
+
* @returns an empty Promise which is used to enqueue a series of operations for
|
|
928
|
+
* the component
|
|
929
|
+
*/
|
|
919
930
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
920
931
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
921
932
|
const instance = hostRef.$lazyInstance$ ;
|
|
922
|
-
|
|
933
|
+
// We're going to use this variable together with `enqueue` to implement a
|
|
934
|
+
// little promise-based queue. We start out with it `undefined`. When we add
|
|
935
|
+
// the first function to the queue we'll set this variable to be that
|
|
936
|
+
// function's return value. When we attempt to add subsequent values to the
|
|
937
|
+
// queue we'll check that value and, if it was a `Promise`, we'll then chain
|
|
938
|
+
// the new function off of that `Promise` using `.then()`. This will give our
|
|
939
|
+
// queue two nice properties:
|
|
940
|
+
//
|
|
941
|
+
// 1. If all functions added to the queue are synchronous they'll be called
|
|
942
|
+
// synchronously right away.
|
|
943
|
+
// 2. If all functions added to the queue are asynchronous they'll all be
|
|
944
|
+
// called in order after `dispatchHooks` exits.
|
|
945
|
+
let maybePromise;
|
|
923
946
|
if (isInitialLoad) {
|
|
924
947
|
{
|
|
925
|
-
|
|
948
|
+
// If `componentWillLoad` returns a `Promise` then we want to wait on
|
|
949
|
+
// whatever's going on in that `Promise` before we launch into
|
|
950
|
+
// rendering the component, doing other lifecycle stuff, etc. So
|
|
951
|
+
// in that case we assign the returned promise to the variable we
|
|
952
|
+
// declared above to hold a possible 'queueing' Promise
|
|
953
|
+
maybePromise = safeCall(instance, 'componentWillLoad');
|
|
926
954
|
}
|
|
927
955
|
}
|
|
928
956
|
{
|
|
929
|
-
|
|
957
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, 'componentWillRender'));
|
|
930
958
|
}
|
|
931
959
|
endSchedule();
|
|
932
|
-
return
|
|
960
|
+
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
933
961
|
};
|
|
962
|
+
/**
|
|
963
|
+
* This function uses a Promise to implement a simple first-in, first-out queue
|
|
964
|
+
* of functions to be called.
|
|
965
|
+
*
|
|
966
|
+
* The queue is ordered on the basis of the first argument. If it's
|
|
967
|
+
* `undefined`, then nothing is on the queue yet, so the provided function can
|
|
968
|
+
* be called synchronously (although note that this function may return a
|
|
969
|
+
* `Promise`). The idea is that then the return value of that enqueueing
|
|
970
|
+
* operation is kept around, so that if it was a `Promise` then subsequent
|
|
971
|
+
* functions can be enqueued by calling this function again with that `Promise`
|
|
972
|
+
* as the first argument.
|
|
973
|
+
*
|
|
974
|
+
* @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
|
|
975
|
+
* @param fn a function to enqueue
|
|
976
|
+
* @returns either a `Promise` or the return value of the provided function
|
|
977
|
+
*/
|
|
978
|
+
const enqueue = (maybePromise, fn) => maybePromise instanceof Promise ? maybePromise.then(fn) : fn();
|
|
934
979
|
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
935
|
-
|
|
980
|
+
var _a;
|
|
936
981
|
const elm = hostRef.$hostElement$;
|
|
937
982
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
938
983
|
const rc = elm['s-rc'];
|
|
@@ -954,7 +999,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
954
999
|
endRender();
|
|
955
1000
|
endUpdate();
|
|
956
1001
|
{
|
|
957
|
-
const childrenPromises = elm['s-p'];
|
|
1002
|
+
const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
|
|
958
1003
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
959
1004
|
if (childrenPromises.length === 0) {
|
|
960
1005
|
postUpdate();
|
|
@@ -1055,9 +1100,6 @@ const safeCall = (instance, method, arg) => {
|
|
|
1055
1100
|
}
|
|
1056
1101
|
return undefined;
|
|
1057
1102
|
};
|
|
1058
|
-
const then = (promise, thenFn) => {
|
|
1059
|
-
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1060
|
-
};
|
|
1061
1103
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1062
1104
|
;
|
|
1063
1105
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
@@ -1218,9 +1260,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1218
1260
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1219
1261
|
// initializeComponent
|
|
1220
1262
|
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1263
|
+
// Let the runtime know that the component has been initialized
|
|
1264
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1221
1265
|
{
|
|
1222
|
-
// we haven't initialized this element yet
|
|
1223
|
-
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1224
1266
|
// lazy loaded components
|
|
1225
1267
|
// request the component's implementation to be
|
|
1226
1268
|
// wired up with the host element
|
|
@@ -1561,4 +1603,4 @@ exports.promiseResolve = promiseResolve;
|
|
|
1561
1603
|
exports.registerInstance = registerInstance;
|
|
1562
1604
|
exports.setNonce = setNonce;
|
|
1563
1605
|
|
|
1564
|
-
//# sourceMappingURL=index-
|
|
1606
|
+
//# sourceMappingURL=index-f95ab17b.js.map
|