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
@@ -64,6 +64,11 @@ const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
64
64
  * Don't add values to these!!
65
65
  */
66
66
  const EMPTY_OBJ = {};
67
+ /**
68
+ * Namespaces
69
+ */
70
+ const SVG_NS = 'http://www.w3.org/2000/svg';
71
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
67
72
  const isDef = (v) => v != null;
68
73
  /**
69
74
  * Check whether a value is a 'complex type', defined here as an object or a
@@ -497,8 +502,15 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
497
502
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
498
503
  }
499
504
  else {
505
+ if (!isSvgMode) {
506
+ isSvgMode = newVNode.$tag$ === 'svg';
507
+ }
500
508
  // create element
501
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
509
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
510
+ );
511
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
512
+ isSvgMode = false;
513
+ }
502
514
  // add css classes, attrs, props, listeners, etc.
503
515
  {
504
516
  updateElement(null, newVNode, isSvgMode);
@@ -519,6 +531,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
519
531
  }
520
532
  }
521
533
  }
534
+ {
535
+ if (newVNode.$tag$ === 'svg') {
536
+ // Only reset the SVG context when we're exiting <svg> element
537
+ isSvgMode = false;
538
+ }
539
+ else if (elm.tagName === 'foreignObject') {
540
+ // Reenter SVG context when we're exiting <foreignObject> element
541
+ isSvgMode = true;
542
+ }
543
+ }
522
544
  }
523
545
  // This needs to always happen so we can hide nodes that are projected
524
546
  // to another component but don't end up in a slot
@@ -836,8 +858,14 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
836
858
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
837
859
  const oldChildren = oldVNode.$children$;
838
860
  const newChildren = newVNode.$children$;
861
+ const tag = newVNode.$tag$;
839
862
  const text = newVNode.$text$;
840
863
  if (text === null) {
864
+ {
865
+ // test if we're rendering an svg element, or still rendering nodes inside of one
866
+ // only add this to the when the compiler sees we're using an svg somewhere
867
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
868
+ }
841
869
  {
842
870
  {
843
871
  // either this is the first render of an element OR it's an update
@@ -864,6 +892,9 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
864
892
  // no new child vnodes, but there are old child vnodes to remove
865
893
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
866
894
  }
895
+ if (isSvgMode && tag === 'svg') {
896
+ isSvgMode = false;
897
+ }
867
898
  }
868
899
  else if (oldVNode.$text$ !== text) {
869
900
  // update the text content for the text only vnode
@@ -971,6 +1002,16 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
971
1002
  // 2. If all functions added to the queue are asynchronous they'll all be
972
1003
  // called in order after `dispatchHooks` exits.
973
1004
  let maybePromise;
1005
+ if (isInitialLoad) {
1006
+ {
1007
+ // If `componentWillLoad` returns a `Promise` then we want to wait on
1008
+ // whatever's going on in that `Promise` before we launch into
1009
+ // rendering the component, doing other lifecycle stuff, etc. So
1010
+ // in that case we assign the returned promise to the variable we
1011
+ // declared above to hold a possible 'queueing' Promise
1012
+ maybePromise = safeCall(instance, 'componentWillLoad');
1013
+ }
1014
+ }
974
1015
  endSchedule();
975
1016
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
976
1017
  };
@@ -1366,7 +1407,6 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1366
1407
  hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1367
1408
  }
1368
1409
  endNewInstance();
1369
- fireConnectedCallback(hostRef.$lazyInstance$);
1370
1410
  }
1371
1411
  if (Cstr.style) {
1372
1412
  // this component has styles but we haven't registered them yet
@@ -1396,9 +1436,6 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1396
1436
  }
1397
1437
  };
1398
1438
  const fireConnectedCallback = (instance) => {
1399
- {
1400
- safeCall(instance, 'connectedCallback');
1401
- }
1402
1439
  };
1403
1440
  const connectedCallback = (elm) => {
1404
1441
  if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
@@ -1440,11 +1477,9 @@ const connectedCallback = (elm) => {
1440
1477
  }
1441
1478
  else {
1442
1479
  // fire off connectedCallback() on component instance
1443
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
1444
- fireConnectedCallback(hostRef.$lazyInstance$);
1445
- }
1480
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1446
1481
  else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1447
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
1482
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1448
1483
  }
1449
1484
  }
1450
1485
  endConnected();
@@ -1730,4 +1765,4 @@ exports.promiseResolve = promiseResolve;
1730
1765
  exports.registerInstance = registerInstance;
1731
1766
  exports.setNonce = setNonce;
1732
1767
 
1733
- //# sourceMappingURL=index-8282b36b.js.map
1768
+ //# sourceMappingURL=index-991e75df.js.map