dash-button-web 0.0.2 → 0.0.4

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 +35 -4
  2. package/dist/cjs/dash-button.cjs.entry.js.map +1 -1
  3. package/dist/cjs/{index-8282b36b.js → index-d91975cd.js} +37 -2
  4. package/dist/cjs/index-d91975cd.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 +51 -0
  8. package/dist/collection/components/my-component/dash-button.js +69 -2
  9. package/dist/collection/components/my-component/dash-button.js.map +1 -1
  10. package/dist/components/dash-button.js +36 -3
  11. package/dist/components/dash-button.js.map +1 -1
  12. package/dist/esm/dash-button.entry.js +35 -4
  13. package/dist/esm/dash-button.entry.js.map +1 -1
  14. package/dist/esm/{index-2b6c17bc.js → index-1c7e21da.js} +37 -2
  15. package/dist/esm/index-1c7e21da.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 +3 -0
  19. package/dist/types/components.d.ts +4 -0
  20. package/dist/web-compnont/p-aa686508.js +3 -0
  21. package/dist/web-compnont/p-aa686508.js.map +1 -0
  22. package/dist/web-compnont/{p-4356bec1.entry.js → p-ccad140c.entry.js} +3 -3
  23. package/dist/web-compnont/p-ccad140c.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
@@ -1093,7 +1124,11 @@ const postUpdateComponent = (hostRef) => {
1093
1124
  const tagName = hostRef.$cmpMeta$.$tagName$;
1094
1125
  const elm = hostRef.$hostElement$;
1095
1126
  const endPostUpdate = createTime('postUpdate', tagName);
1127
+ const instance = hostRef.$lazyInstance$ ;
1096
1128
  const ancestorComponent = hostRef.$ancestorComponent$;
1129
+ {
1130
+ safeCall(instance, 'componentDidRender');
1131
+ }
1097
1132
  if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1098
1133
  hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1099
1134
  {
@@ -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-d91975cd.js.map