dash-button-web 0.0.2 → 0.0.5

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 (31) hide show
  1. package/dist/cjs/dash-button.cjs.entry.js +101 -6
  2. package/dist/cjs/dash-button.cjs.entry.js.map +1 -1
  3. package/dist/cjs/{index-8282b36b.js → index-991e75df.js} +45 -10
  4. package/dist/cjs/index-991e75df.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/web-compnont.cjs.js +2 -2
  7. package/dist/collection/components/my-component/dash-button.css +61 -0
  8. package/dist/collection/components/my-component/dash-button.js +173 -5
  9. package/dist/collection/components/my-component/dash-button.js.map +1 -1
  10. package/dist/components/dash-button.js +106 -6
  11. package/dist/components/dash-button.js.map +1 -1
  12. package/dist/esm/dash-button.entry.js +101 -6
  13. package/dist/esm/dash-button.entry.js.map +1 -1
  14. package/dist/esm/{index-2b6c17bc.js → index-8310c457.js} +45 -10
  15. package/dist/esm/index-8310c457.js.map +1 -0
  16. package/dist/esm/loader.js +3 -3
  17. package/dist/esm/web-compnont.js +3 -3
  18. package/dist/types/components/my-component/dash-button.d.ts +8 -1
  19. package/dist/types/components.d.ts +8 -0
  20. package/dist/web-compnont/p-4bd42d49.js +3 -0
  21. package/dist/web-compnont/p-4bd42d49.js.map +1 -0
  22. package/dist/web-compnont/{p-4356bec1.entry.js → p-89ceb862.entry.js} +3 -3
  23. package/dist/web-compnont/p-89ceb862.entry.js.map +1 -0
  24. package/dist/web-compnont/web-compnont.esm.js +1 -1
  25. package/dist/web-compnont/web-compnont.esm.js.map +1 -1
  26. package/package.json +1 -1
  27. package/dist/cjs/index-8282b36b.js.map +0 -1
  28. package/dist/esm/index-2b6c17bc.js.map +0 -1
  29. package/dist/web-compnont/p-35259f64.js +0 -3
  30. package/dist/web-compnont/p-35259f64.js.map +0 -1
  31. package/dist/web-compnont/p-4356bec1.entry.js.map +0 -1
@@ -42,6 +42,11 @@ const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
42
42
  * Don't add values to these!!
43
43
  */
44
44
  const EMPTY_OBJ = {};
45
+ /**
46
+ * Namespaces
47
+ */
48
+ const SVG_NS = 'http://www.w3.org/2000/svg';
49
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
45
50
  const isDef = (v) => v != null;
46
51
  /**
47
52
  * Check whether a value is a 'complex type', defined here as an object or a
@@ -475,8 +480,15 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
475
480
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
476
481
  }
477
482
  else {
483
+ if (!isSvgMode) {
484
+ isSvgMode = newVNode.$tag$ === 'svg';
485
+ }
478
486
  // create element
479
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
487
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
488
+ );
489
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
490
+ isSvgMode = false;
491
+ }
480
492
  // add css classes, attrs, props, listeners, etc.
481
493
  {
482
494
  updateElement(null, newVNode, isSvgMode);
@@ -497,6 +509,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
497
509
  }
498
510
  }
499
511
  }
512
+ {
513
+ if (newVNode.$tag$ === 'svg') {
514
+ // Only reset the SVG context when we're exiting <svg> element
515
+ isSvgMode = false;
516
+ }
517
+ else if (elm.tagName === 'foreignObject') {
518
+ // Reenter SVG context when we're exiting <foreignObject> element
519
+ isSvgMode = true;
520
+ }
521
+ }
500
522
  }
501
523
  // This needs to always happen so we can hide nodes that are projected
502
524
  // to another component but don't end up in a slot
@@ -814,8 +836,14 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
814
836
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
815
837
  const oldChildren = oldVNode.$children$;
816
838
  const newChildren = newVNode.$children$;
839
+ const tag = newVNode.$tag$;
817
840
  const text = newVNode.$text$;
818
841
  if (text === null) {
842
+ {
843
+ // test if we're rendering an svg element, or still rendering nodes inside of one
844
+ // only add this to the when the compiler sees we're using an svg somewhere
845
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
846
+ }
819
847
  {
820
848
  {
821
849
  // either this is the first render of an element OR it's an update
@@ -842,6 +870,9 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
842
870
  // no new child vnodes, but there are old child vnodes to remove
843
871
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
844
872
  }
873
+ if (isSvgMode && tag === 'svg') {
874
+ isSvgMode = false;
875
+ }
845
876
  }
846
877
  else if (oldVNode.$text$ !== text) {
847
878
  // update the text content for the text only vnode
@@ -949,6 +980,16 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
949
980
  // 2. If all functions added to the queue are asynchronous they'll all be
950
981
  // called in order after `dispatchHooks` exits.
951
982
  let maybePromise;
983
+ if (isInitialLoad) {
984
+ {
985
+ // If `componentWillLoad` returns a `Promise` then we want to wait on
986
+ // whatever's going on in that `Promise` before we launch into
987
+ // rendering the component, doing other lifecycle stuff, etc. So
988
+ // in that case we assign the returned promise to the variable we
989
+ // declared above to hold a possible 'queueing' Promise
990
+ maybePromise = safeCall(instance, 'componentWillLoad');
991
+ }
992
+ }
952
993
  endSchedule();
953
994
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
954
995
  };
@@ -1344,7 +1385,6 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1344
1385
  hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1345
1386
  }
1346
1387
  endNewInstance();
1347
- fireConnectedCallback(hostRef.$lazyInstance$);
1348
1388
  }
1349
1389
  if (Cstr.style) {
1350
1390
  // this component has styles but we haven't registered them yet
@@ -1374,9 +1414,6 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1374
1414
  }
1375
1415
  };
1376
1416
  const fireConnectedCallback = (instance) => {
1377
- {
1378
- safeCall(instance, 'connectedCallback');
1379
- }
1380
1417
  };
1381
1418
  const connectedCallback = (elm) => {
1382
1419
  if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
@@ -1418,11 +1455,9 @@ const connectedCallback = (elm) => {
1418
1455
  }
1419
1456
  else {
1420
1457
  // fire off connectedCallback() on component instance
1421
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
1422
- fireConnectedCallback(hostRef.$lazyInstance$);
1423
- }
1458
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1424
1459
  else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1425
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
1460
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1426
1461
  }
1427
1462
  }
1428
1463
  endConnected();
@@ -1703,4 +1738,4 @@ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1703
1738
 
1704
1739
  export { bootstrapLazy as b, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1705
1740
 
1706
- //# sourceMappingURL=index-2b6c17bc.js.map
1741
+ //# sourceMappingURL=index-8310c457.js.map