@itcenteratunihelsinki/huds-lib 0.8.55 → 0.8.57

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.
Files changed (55) hide show
  1. package/components/emotion.esm.js.map +1 -1
  2. package/components/hy-hero-carousel.js +2 -5
  3. package/components/hy-hero-carousel.js.map +1 -1
  4. package/components/hy-site-header.js +1 -1
  5. package/components/hy-site-header.js.map +1 -1
  6. package/components/index2.js.map +1 -1
  7. package/dist/cjs/color-box_91.cjs.entry.js +3 -3
  8. package/dist/cjs/color-box_91.cjs.entry.js.map +1 -1
  9. package/dist/cjs/{globalScript-d341436f.js → globalScript-42d6be40.js} +2 -2
  10. package/dist/cjs/{globalScript-d341436f.js.map → globalScript-42d6be40.js.map} +1 -1
  11. package/dist/cjs/huds-lib.cjs.js +3 -3
  12. package/dist/cjs/huds-lib.cjs.js.map +1 -1
  13. package/dist/cjs/hy-event-item.cjs.entry.js +1 -1
  14. package/dist/cjs/hy-events.cjs.entry.js +1 -1
  15. package/dist/cjs/hy-hero-carousel.cjs.entry.js +4 -7
  16. package/dist/cjs/hy-hero-carousel.cjs.entry.js.map +1 -1
  17. package/dist/cjs/{index-ca4e37f2.js → index-8fc99295.js} +35 -88
  18. package/dist/cjs/index-8fc99295.js.map +1 -0
  19. package/dist/cjs/loader.cjs.js +3 -3
  20. package/dist/cjs/loader.cjs.js.map +1 -1
  21. package/dist/collection/collection-manifest.json +1 -1
  22. package/dist/collection/components/hy-hero-carousel/hy-hero-carousel.css +7 -0
  23. package/dist/collection/components/site-header/site-header.css +7 -0
  24. package/dist/esm/color-box_91.entry.js +3 -3
  25. package/dist/esm/color-box_91.entry.js.map +1 -1
  26. package/dist/esm/{globalScript-3c6fab71.js → globalScript-784ce932.js} +2 -2
  27. package/dist/esm/{globalScript-3c6fab71.js.map → globalScript-784ce932.js.map} +1 -1
  28. package/dist/esm/huds-lib.js +4 -4
  29. package/dist/esm/huds-lib.js.map +1 -1
  30. package/dist/esm/hy-event-item.entry.js +1 -1
  31. package/dist/esm/hy-events.entry.js +1 -1
  32. package/dist/esm/hy-hero-carousel.entry.js +4 -7
  33. package/dist/esm/hy-hero-carousel.entry.js.map +1 -1
  34. package/dist/esm/{index-9920074a.js → index-f9deccc3.js} +35 -88
  35. package/dist/esm/index-f9deccc3.js.map +1 -0
  36. package/dist/esm/loader.js +4 -4
  37. package/dist/esm/loader.js.map +1 -1
  38. package/dist/huds-lib/color-box_91.entry.js +2 -2
  39. package/dist/huds-lib/color-box_91.entry.js.map +1 -1
  40. package/dist/huds-lib/{globalScript-3c6fab71.js → globalScript-784ce932.js} +2 -2
  41. package/dist/huds-lib/huds-lib.esm.js +1 -1
  42. package/dist/huds-lib/huds-lib.esm.js.map +1 -1
  43. package/dist/huds-lib/hy-event-item.entry.js +1 -1
  44. package/dist/huds-lib/hy-events.entry.js +1 -1
  45. package/dist/huds-lib/hy-hero-carousel.entry.js +1 -1
  46. package/dist/huds-lib/hy-hero-carousel.entry.js.map +1 -1
  47. package/dist/huds-lib/index-f9deccc3.js +3 -0
  48. package/dist/huds-lib/index-f9deccc3.js.map +1 -0
  49. package/dist/types/stencil-public-runtime.d.ts +0 -1
  50. package/package.json +2 -2
  51. package/dist/cjs/index-ca4e37f2.js.map +0 -1
  52. package/dist/esm/index-9920074a.js.map +0 -1
  53. package/dist/huds-lib/index-9920074a.js +0 -3
  54. package/dist/huds-lib/index-9920074a.js.map +0 -1
  55. /package/dist/huds-lib/{globalScript-3c6fab71.js.map → globalScript-784ce932.js.map} +0 -0
@@ -754,31 +754,30 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
754
754
  * @param vnodes a list of virtual DOM nodes to remove
755
755
  * @param startIdx the index at which to start removing nodes (inclusive)
756
756
  * @param endIdx the index at which to stop removing nodes (inclusive)
757
+ * @param vnode a VNode
758
+ * @param elm an element
757
759
  */
758
- const removeVnodes = (vnodes, startIdx, endIdx) => {
759
- for (let index = startIdx; index <= endIdx; ++index) {
760
- const vnode = vnodes[index];
761
- if (vnode) {
762
- const elm = vnode.$elm$;
763
- nullifyVNodeRefs(vnode);
764
- if (elm) {
765
- {
766
- // we're removing this element
767
- // so it's possible we need to show slot fallback content now
768
- checkSlotFallbackVisibility = true;
769
- if (elm['s-ol']) {
770
- // remove the original location comment
771
- elm['s-ol'].remove();
772
- }
773
- else {
774
- // it's possible that child nodes of the node
775
- // that's being removed are slot nodes
776
- putBackInOriginalLocation(elm, true);
777
- }
760
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
761
+ for (; startIdx <= endIdx; ++startIdx) {
762
+ if ((vnode = vnodes[startIdx])) {
763
+ elm = vnode.$elm$;
764
+ callNodeRefs(vnode);
765
+ {
766
+ // we're removing this element
767
+ // so it's possible we need to show slot fallback content now
768
+ checkSlotFallbackVisibility = true;
769
+ if (elm['s-ol']) {
770
+ // remove the original location comment
771
+ elm['s-ol'].remove();
772
+ }
773
+ else {
774
+ // it's possible that child nodes of the node
775
+ // that's being removed are slot nodes
776
+ putBackInOriginalLocation(elm, true);
778
777
  }
779
- // remove the vnode's element from the dom
780
- elm.remove();
781
778
  }
779
+ // remove the vnode's element from the dom
780
+ elm.remove();
782
781
  }
783
782
  }
784
783
  };
@@ -1259,17 +1258,10 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1259
1258
  }
1260
1259
  return slotNameAttr === '';
1261
1260
  };
1262
- /**
1263
- * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
1264
- * calling them with `null`. This signals that the DOM element corresponding to
1265
- * the VDom node has been removed from the DOM.
1266
- *
1267
- * @param vNode a virtual DOM node
1268
- */
1269
- const nullifyVNodeRefs = (vNode) => {
1261
+ const callNodeRefs = (vNode) => {
1270
1262
  {
1271
1263
  vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1272
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1264
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
1273
1265
  }
1274
1266
  };
1275
1267
  /**
@@ -1406,32 +1398,10 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
1406
1398
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1407
1399
  return writeTask(dispatch) ;
1408
1400
  };
1409
- /**
1410
- * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
1411
- * component lifecycle methods like `componentWillLoad` as well as
1412
- * {@link updateComponent}, which will kick off the virtual DOM re-render.
1413
- *
1414
- * @param hostRef a reference to a host DOM node
1415
- * @param isInitialLoad whether we're on the initial load or not
1416
- * @returns an empty Promise which is used to enqueue a series of operations for
1417
- * the component
1418
- */
1419
1401
  const dispatchHooks = (hostRef, isInitialLoad) => {
1420
1402
  const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1421
1403
  const instance = hostRef.$lazyInstance$ ;
1422
- // We're going to use this variable together with `enqueue` to implement a
1423
- // little promise-based queue. We start out with it `undefined`. When we add
1424
- // the first function to the queue we'll set this variable to be that
1425
- // function's return value. When we attempt to add subsequent values to the
1426
- // queue we'll check that value and, if it was a `Promise`, we'll then chain
1427
- // the new function off of that `Promise` using `.then()`. This will give our
1428
- // queue two nice properties:
1429
- //
1430
- // 1. If all functions added to the queue are synchronous they'll be called
1431
- // synchronously right away.
1432
- // 2. If all functions added to the queue are asynchronous they'll all be
1433
- // called in order after `dispatchHooks` exits.
1434
- let maybePromise;
1404
+ let promise;
1435
1405
  if (isInitialLoad) {
1436
1406
  {
1437
1407
  hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
@@ -1441,48 +1411,22 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
1441
1411
  }
1442
1412
  }
1443
1413
  {
1444
- // If `componentWillLoad` returns a `Promise` then we want to wait on
1445
- // whatever's going on in that `Promise` before we launch into
1446
- // rendering the component, doing other lifecycle stuff, etc. So
1447
- // in that case we assign the returned promise to the variable we
1448
- // declared above to hold a possible 'queueing' Promise
1449
- maybePromise = safeCall(instance, 'componentWillLoad');
1414
+ promise = safeCall(instance, 'componentWillLoad');
1450
1415
  }
1451
1416
  }
1452
1417
  else {
1453
1418
  {
1454
- // Like `componentWillLoad` above, we allow Stencil component
1455
- // authors to return a `Promise` from this lifecycle callback, and
1456
- // we specify that our runtime will wait for that `Promise` to
1457
- // resolve before the component re-renders. So if the method
1458
- // returns a `Promise` we need to keep it around!
1459
- maybePromise = safeCall(instance, 'componentWillUpdate');
1419
+ promise = safeCall(instance, 'componentWillUpdate');
1460
1420
  }
1461
1421
  }
1462
1422
  {
1463
- maybePromise = enqueue(maybePromise, () => safeCall(instance, 'componentWillRender'));
1423
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1464
1424
  }
1465
1425
  endSchedule();
1466
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1426
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1467
1427
  };
1468
- /**
1469
- * This function uses a Promise to implement a simple first-in, first-out queue
1470
- * of functions to be called.
1471
- *
1472
- * The queue is ordered on the basis of the first argument. If it's
1473
- * `undefined`, then nothing is on the queue yet, so the provided function can
1474
- * be called synchronously (although note that this function may return a
1475
- * `Promise`). The idea is that then the return value of that enqueueing
1476
- * operation is kept around, so that if it was a `Promise` then subsequent
1477
- * functions can be enqueued by calling this function again with that `Promise`
1478
- * as the first argument.
1479
- *
1480
- * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
1481
- * @param fn a function to enqueue
1482
- * @returns either a `Promise` or the return value of the provided function
1483
- */
1484
- const enqueue = (maybePromise, fn) => maybePromise instanceof Promise ? maybePromise.then(fn) : fn();
1485
1428
  const updateComponent = async (hostRef, instance, isInitialLoad) => {
1429
+ // updateComponent
1486
1430
  const elm = hostRef.$hostElement$;
1487
1431
  const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1488
1432
  const rc = elm['s-rc'];
@@ -1608,6 +1552,9 @@ const safeCall = (instance, method, arg) => {
1608
1552
  }
1609
1553
  return undefined;
1610
1554
  };
1555
+ const then = (promise, thenFn) => {
1556
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1557
+ };
1611
1558
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1612
1559
  ;
1613
1560
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
@@ -1761,9 +1708,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1761
1708
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1762
1709
  // initializeComponent
1763
1710
  if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1764
- // Let the runtime know that the component has been initialized
1765
- hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1766
1711
  {
1712
+ // we haven't initialized this element yet
1713
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1767
1714
  // lazy loaded components
1768
1715
  // request the component's implementation to be
1769
1716
  // wired up with the host element
@@ -2227,4 +2174,4 @@ exports.registerInstance = registerInstance;
2227
2174
  exports.setMode = setMode;
2228
2175
  exports.setNonce = setNonce;
2229
2176
 
2230
- //# sourceMappingURL=index-ca4e37f2.js.map
2177
+ //# sourceMappingURL=index-8fc99295.js.map