@maggioli-design-system/mds-table-row 4.4.2 → 4.5.0

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 (101) hide show
  1. package/dist/cjs/{index-74074cfd.js → index-7b6fb148.js} +22 -14
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mds-table-row.cjs.entry.js +2 -2
  4. package/dist/cjs/mds-table-row.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +2 -2
  6. package/dist/collection/common/file.js +48 -0
  7. package/dist/collection/common/icon.js +15 -0
  8. package/dist/collection/common/unit.js +15 -3
  9. package/dist/collection/common/yugop/core.js +16 -0
  10. package/dist/collection/common/yugop/index.js +3 -0
  11. package/dist/collection/common/yugop/random-text.js +59 -0
  12. package/dist/collection/common/yugop/utils/math.js +11 -0
  13. package/dist/collection/common/yugop/utils/noop.js +1 -0
  14. package/dist/collection/common/yugop/utils/prng.js +21 -0
  15. package/dist/collection/common/yugop/utils/string.js +2 -0
  16. package/dist/collection/components/mds-table-row/mds-table-row.css +142 -2
  17. package/dist/collection/dictionary/file-extensions.js +64 -0
  18. package/dist/collection/dictionary/icon.js +6 -1
  19. package/dist/collection/dictionary/text.js +6 -0
  20. package/dist/collection/dictionary/variant.js +18 -1
  21. package/dist/collection/fixtures/filenames.js +57 -0
  22. package/dist/collection/type/file-types.js +1 -0
  23. package/dist/collection/type/text.js +1 -0
  24. package/dist/collection/type/variant-file-format.js +111 -0
  25. package/dist/components/mds-table-row.js +1 -1
  26. package/dist/documentation.d.ts +1 -21
  27. package/dist/documentation.json +3 -3
  28. package/dist/esm/{index-152f5146.js → index-9f40909f.js} +22 -14
  29. package/dist/esm/loader.js +2 -2
  30. package/dist/esm/mds-table-row.entry.js +2 -2
  31. package/dist/esm/mds-table-row.js +3 -3
  32. package/dist/esm-es5/index-9f40909f.js +1 -0
  33. package/dist/esm-es5/loader.js +1 -1
  34. package/dist/esm-es5/mds-table-row.entry.js +1 -1
  35. package/dist/esm-es5/mds-table-row.js +1 -1
  36. package/dist/mds-table-row/mds-table-row.esm.js +1 -1
  37. package/dist/mds-table-row/mds-table-row.js +1 -1
  38. package/dist/mds-table-row/p-24e0f761.system.js +2 -0
  39. package/dist/mds-table-row/p-4e5a0559.js +2 -0
  40. package/dist/mds-table-row/{p-1bbb8bb6.system.js → p-65fbbba9.system.js} +1 -1
  41. package/dist/mds-table-row/p-ab9fb13e.entry.js +1 -0
  42. package/dist/mds-table-row/p-f8b0aa6b.system.entry.js +1 -0
  43. package/dist/stats.json +77 -35
  44. package/dist/types/common/file.d.ts +12 -0
  45. package/dist/types/common/icon.d.ts +5 -0
  46. package/dist/types/common/unit.d.ts +2 -1
  47. package/dist/types/common/yugop/core.d.ts +10 -0
  48. package/dist/types/common/yugop/index.d.ts +1 -0
  49. package/dist/types/common/yugop/random-text.d.ts +31 -0
  50. package/dist/types/common/yugop/utils/math.d.ts +3 -0
  51. package/dist/types/common/yugop/utils/noop.d.ts +1 -0
  52. package/dist/types/common/yugop/utils/prng.d.ts +8 -0
  53. package/dist/types/common/yugop/utils/string.d.ts +1 -0
  54. package/dist/types/dictionary/file-extensions.d.ts +11 -0
  55. package/dist/types/dictionary/icon.d.ts +2 -1
  56. package/dist/types/dictionary/text.d.ts +2 -0
  57. package/dist/types/dictionary/variant.d.ts +2 -1
  58. package/dist/types/fixtures/filenames.d.ts +2 -0
  59. package/dist/types/type/file-types.d.ts +1 -0
  60. package/dist/types/type/text.d.ts +1 -0
  61. package/dist/types/type/variant-file-format.d.ts +11 -0
  62. package/dist/types/type/variant.d.ts +1 -0
  63. package/documentation.json +47 -12
  64. package/package.json +4 -4
  65. package/src/common/file.ts +63 -0
  66. package/src/common/icon.ts +25 -0
  67. package/src/common/unit.ts +21 -2
  68. package/src/common/yugop/core.ts +47 -0
  69. package/src/common/yugop/index.ts +4 -0
  70. package/src/common/yugop/random-text.ts +95 -0
  71. package/src/common/yugop/utils/math.ts +21 -0
  72. package/src/common/yugop/utils/noop.ts +1 -0
  73. package/src/common/yugop/utils/prng.ts +35 -0
  74. package/src/common/yugop/utils/string.ts +4 -0
  75. package/src/dictionary/file-extensions.ts +81 -0
  76. package/src/dictionary/icon.ts +6 -0
  77. package/src/dictionary/text.ts +9 -0
  78. package/src/dictionary/variant.ts +19 -0
  79. package/src/fixtures/filenames.ts +60 -0
  80. package/src/fixtures/icons.json +10 -0
  81. package/src/fixtures/iconsauce.json +3 -0
  82. package/src/type/file-types.ts +55 -0
  83. package/src/type/text.ts +4 -0
  84. package/src/type/variant-file-format.ts +128 -0
  85. package/src/type/variant.ts +17 -0
  86. package/www/build/mds-table-row.esm.js +1 -1
  87. package/www/build/mds-table-row.js +1 -1
  88. package/www/build/p-24e0f761.system.js +2 -0
  89. package/www/build/p-4e5a0559.js +2 -0
  90. package/www/build/{p-1bbb8bb6.system.js → p-65fbbba9.system.js} +1 -1
  91. package/www/build/p-ab9fb13e.entry.js +1 -0
  92. package/www/build/p-f8b0aa6b.system.entry.js +1 -0
  93. package/dist/esm-es5/index-152f5146.js +0 -1
  94. package/dist/mds-table-row/p-0461a91a.system.entry.js +0 -1
  95. package/dist/mds-table-row/p-6d1e82c7.system.js +0 -2
  96. package/dist/mds-table-row/p-8b036a2e.entry.js +0 -1
  97. package/dist/mds-table-row/p-ccb2cba7.js +0 -2
  98. package/www/build/p-0461a91a.system.entry.js +0 -1
  99. package/www/build/p-6d1e82c7.system.js +0 -2
  100. package/www/build/p-8b036a2e.entry.js +0 -1
  101. package/www/build/p-ccb2cba7.js +0 -2
@@ -421,6 +421,9 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
421
421
  }
422
422
  }
423
423
  }
424
+ // This needs to always happen so we can hide nodes that are projected
425
+ // to another component but don't end up in a slot
426
+ elm['s-hn'] = hostTagName;
424
427
  return elm;
425
428
  };
426
429
  /**
@@ -544,8 +547,9 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
544
547
  * @param oldCh the old children of the parent node
545
548
  * @param newVNode the new VNode which will replace the parent
546
549
  * @param newCh the new children of the parent node
550
+ * @param isInitialRender whether or not this is the first render of the vdom
547
551
  */
548
- const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
552
+ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
549
553
  let oldStartIdx = 0;
550
554
  let newStartIdx = 0;
551
555
  let oldEndIdx = oldCh.length - 1;
@@ -569,25 +573,25 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
569
573
  else if (newEndVnode == null) {
570
574
  newEndVnode = newCh[--newEndIdx];
571
575
  }
572
- else if (isSameVnode(oldStartVnode, newStartVnode)) {
576
+ else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
573
577
  // if the start nodes are the same then we should patch the new VNode
574
578
  // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
575
579
  // indices to reflect that. We don't need to move any DOM Nodes around
576
580
  // since things are matched up in order.
577
- patch(oldStartVnode, newStartVnode);
581
+ patch(oldStartVnode, newStartVnode, isInitialRender);
578
582
  oldStartVnode = oldCh[++oldStartIdx];
579
583
  newStartVnode = newCh[++newStartIdx];
580
584
  }
581
- else if (isSameVnode(oldEndVnode, newEndVnode)) {
585
+ else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
582
586
  // likewise, if the end nodes are the same we patch new onto old and
583
587
  // decrement our end indices, and also likewise in this case we don't
584
588
  // need to move any DOM Nodes.
585
- patch(oldEndVnode, newEndVnode);
589
+ patch(oldEndVnode, newEndVnode, isInitialRender);
586
590
  oldEndVnode = oldCh[--oldEndIdx];
587
591
  newEndVnode = newCh[--newEndIdx];
588
592
  }
589
- else if (isSameVnode(oldStartVnode, newEndVnode)) {
590
- patch(oldStartVnode, newEndVnode);
593
+ else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
594
+ patch(oldStartVnode, newEndVnode, isInitialRender);
591
595
  // We need to move the element for `oldStartVnode` into a position which
592
596
  // will be appropriate for `newEndVnode`. For this we can use
593
597
  // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
@@ -609,8 +613,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
609
613
  oldStartVnode = oldCh[++oldStartIdx];
610
614
  newEndVnode = newCh[--newEndIdx];
611
615
  }
612
- else if (isSameVnode(oldEndVnode, newStartVnode)) {
613
- patch(oldEndVnode, newStartVnode);
616
+ else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
617
+ patch(oldEndVnode, newStartVnode, isInitialRender);
614
618
  // We've already checked above if `oldStartVnode` and `newStartVnode` are
615
619
  // the same node, so since we're here we know that they are not. Thus we
616
620
  // can move the element for `oldEndVnode` _before_ the element for
@@ -664,9 +668,10 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
664
668
  *
665
669
  * @param leftVNode the first VNode to check
666
670
  * @param rightVNode the second VNode to check
671
+ * @param isInitialRender whether or not this is the first render of the vdom
667
672
  * @returns whether they're equal or not
668
673
  */
669
- const isSameVnode = (leftVNode, rightVNode) => {
674
+ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
670
675
  // compare if two vnode to see if they're "technically" the same
671
676
  // need to have the same element tag, and same key to be the same
672
677
  if (leftVNode.$tag$ === rightVNode.$tag$) {
@@ -681,8 +686,9 @@ const isSameVnode = (leftVNode, rightVNode) => {
681
686
  *
682
687
  * @param oldVNode an old VNode whose DOM element and children we want to update
683
688
  * @param newVNode a new VNode representing an updated version of the old one
689
+ * @param isInitialRender whether or not this is the first render of the vdom
684
690
  */
685
- const patch = (oldVNode, newVNode) => {
691
+ const patch = (oldVNode, newVNode, isInitialRender = false) => {
686
692
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
687
693
  const oldChildren = oldVNode.$children$;
688
694
  const newChildren = newVNode.$children$;
@@ -701,7 +707,7 @@ const patch = (oldVNode, newVNode) => {
701
707
  if (oldChildren !== null && newChildren !== null) {
702
708
  // looks like there's child vnodes for both the old and new vnodes
703
709
  // so we need to call `updateChildren` to reconcile them
704
- updateChildren(elm, oldChildren, newVNode, newChildren);
710
+ updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
705
711
  }
706
712
  else if (newChildren !== null) {
707
713
  // add the new vnode children
@@ -770,7 +776,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
770
776
  scopeId = hostElm['s-sc'];
771
777
  }
772
778
  // synchronous patch
773
- patch(oldVNode, rootVnode);
779
+ patch(oldVNode, rootVnode, isInitialLoad);
774
780
  };
775
781
  const attachToAncestor = (hostRef, ancestorComponent) => {
776
782
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
@@ -1420,12 +1426,14 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1420
1426
  // If we have styles, add them to the DOM
1421
1427
  if (dataStyles.innerHTML.length) {
1422
1428
  dataStyles.setAttribute('data-styles', '');
1423
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1424
1429
  // Apply CSP nonce to the style tag if it exists
1425
1430
  const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1426
1431
  if (nonce != null) {
1427
1432
  dataStyles.setAttribute('nonce', nonce);
1428
1433
  }
1434
+ // Insert the styles into the document head
1435
+ // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
1436
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1429
1437
  }
1430
1438
  // Process deferred connectedCallbacks now all components have been registered
1431
1439
  isBootstrapping = false;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-74074cfd.js');
5
+ const index = require('./index-7b6fb148.js');
6
6
 
7
7
  const defineCustomElements = (win, options) => {
8
8
  if (typeof window === 'undefined') return undefined;
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-74074cfd.js');
5
+ const index = require('./index-7b6fb148.js');
6
6
 
7
- const mdsTableRowCss = ".fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.text{font-size:1rem}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{display:table-row}:host([interactive]:hover){--mds-table-cell-background:var(--mds-table-cell-background-hover, rgb(var(--tone-neutral)))}";
7
+ const mdsTableRowCss = ".static{position:static}.fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.bg-label-amaranth-10{--tw-bg-opacity:1;background-color:rgb(var(--label-amaranth-10) / var(--tw-bg-opacity))}.bg-label-aqua-10{--tw-bg-opacity:1;background-color:rgb(var(--label-aqua-10) / var(--tw-bg-opacity))}.bg-label-blue-10{--tw-bg-opacity:1;background-color:rgb(var(--label-blue-10) / var(--tw-bg-opacity))}.bg-label-green-10{--tw-bg-opacity:1;background-color:rgb(var(--label-green-10) / var(--tw-bg-opacity))}.bg-label-lime-10{--tw-bg-opacity:1;background-color:rgb(var(--label-lime-10) / var(--tw-bg-opacity))}.bg-label-orange-10{--tw-bg-opacity:1;background-color:rgb(var(--label-orange-10) / var(--tw-bg-opacity))}.bg-label-orchid-10{--tw-bg-opacity:1;background-color:rgb(var(--label-orchid-10) / var(--tw-bg-opacity))}.bg-label-violet-10{--tw-bg-opacity:1;background-color:rgb(var(--label-violet-10) / var(--tw-bg-opacity))}.bg-label-yellow-10{--tw-bg-opacity:1;background-color:rgb(var(--label-yellow-10) / var(--tw-bg-opacity))}.bg-tone-neutral-10{--tw-bg-opacity:1;background-color:rgb(var(--tone-neutral-10) / var(--tw-bg-opacity))}.fill-label-amaranth-04{fill:rgb(var(--label-amaranth-04))}.fill-label-aqua-04{fill:rgb(var(--label-aqua-04))}.fill-label-blue-04{fill:rgb(var(--label-blue-04))}.fill-label-green-04{fill:rgb(var(--label-green-04))}.fill-label-lime-04{fill:rgb(var(--label-lime-04))}.fill-label-orange-04{fill:rgb(var(--label-orange-04))}.fill-label-orchid-04{fill:rgb(var(--label-orchid-04))}.fill-label-violet-04{fill:rgb(var(--label-violet-04))}.fill-label-yellow-04{fill:rgb(var(--label-yellow-04))}.fill-tone-neutral-04{fill:rgb(var(--tone-neutral-04))}.text-label-amaranth-04{--tw-text-opacity:1;color:rgb(var(--label-amaranth-04) / var(--tw-text-opacity))}.text-label-aqua-04{--tw-text-opacity:1;color:rgb(var(--label-aqua-04) / var(--tw-text-opacity))}.text-label-blue-04{--tw-text-opacity:1;color:rgb(var(--label-blue-04) / var(--tw-text-opacity))}.text-label-green-04{--tw-text-opacity:1;color:rgb(var(--label-green-04) / var(--tw-text-opacity))}.text-label-lime-04{--tw-text-opacity:1;color:rgb(var(--label-lime-04) / var(--tw-text-opacity))}.text-label-orange-04{--tw-text-opacity:1;color:rgb(var(--label-orange-04) / var(--tw-text-opacity))}.text-label-orchid-04{--tw-text-opacity:1;color:rgb(var(--label-orchid-04) / var(--tw-text-opacity))}.text-label-violet-04{--tw-text-opacity:1;color:rgb(var(--label-violet-04) / var(--tw-text-opacity))}.text-label-yellow-04{--tw-text-opacity:1;color:rgb(var(--label-yellow-04) / var(--tw-text-opacity))}.text-tone-neutral-04{--tw-text-opacity:1;color:rgb(var(--tone-neutral-04) / var(--tw-text-opacity))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{display:table-row}:host([interactive]:hover){--mds-table-cell-background:var(--mds-table-cell-background-hover, rgb(var(--tone-neutral)))}";
8
8
 
9
9
  const MdsTableRow = class {
10
10
  constructor(hostRef) {
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-74074cfd.js');
5
+ const index = require('./index-7b6fb148.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Browser v4.8.0 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Browser v4.10.0 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchBrowser = () => {
11
11
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mds-table-row.cjs.js', document.baseURI).href));
@@ -4,8 +4,8 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "4.8.0",
8
- "typescriptVersion": "5.2.2"
7
+ "version": "4.10.0",
8
+ "typescriptVersion": "5.3.3"
9
9
  },
10
10
  "collections": [],
11
11
  "bundles": []
@@ -0,0 +1,48 @@
1
+ import { fileExtensionsDictionary } from "../dictionary/file-extensions";
2
+ import { fileFormatsVariant } from "../type/variant-file-format";
3
+ const sanitizeFilename = (filename, error = 'Attribute "filename" is undefined.') => {
4
+ var _a;
5
+ if (filename === undefined) {
6
+ throw console.error(error);
7
+ }
8
+ if (filename.includes('/')) {
9
+ return (_a = filename.split('/').pop()) !== null && _a !== void 0 ? _a : '';
10
+ }
11
+ return filename;
12
+ };
13
+ const sanitizeSuffix = (rawFilename) => {
14
+ var _a;
15
+ const filename = sanitizeFilename(rawFilename);
16
+ if (filename.includes('.')) {
17
+ return (_a = filename.split('.').pop()) !== null && _a !== void 0 ? _a : '';
18
+ }
19
+ return filename;
20
+ };
21
+ const getName = (rawFilename) => {
22
+ var _a;
23
+ const filename = sanitizeFilename(rawFilename);
24
+ if (filename.includes('.')) {
25
+ return (_a = filename.split('.')[0]) !== null && _a !== void 0 ? _a : '';
26
+ }
27
+ return filename;
28
+ };
29
+ const getSuffix = (rawFilename, suffixOverride) => {
30
+ const suffix = sanitizeSuffix(rawFilename);
31
+ const filename = sanitizeFilename(rawFilename);
32
+ if (suffixOverride !== null && suffixOverride !== undefined) {
33
+ return suffixOverride.toLowerCase();
34
+ }
35
+ if (suffix !== filename) {
36
+ return suffix;
37
+ }
38
+ return 'default';
39
+ };
40
+ const getExtensionInfos = (rawFilename, suffixOverride) => {
41
+ var _a;
42
+ const suffix = getSuffix(rawFilename, suffixOverride).toLocaleLowerCase();
43
+ return (_a = fileExtensionsDictionary[suffix]) !== null && _a !== void 0 ? _a : fileExtensionsDictionary.default;
44
+ };
45
+ const getFormatsVariant = (rawFilename, suffixOverride) => {
46
+ return fileFormatsVariant[getExtensionInfos(rawFilename, suffixOverride).format];
47
+ };
48
+ export { getExtensionInfos, getFormatsVariant, getSuffix, getName, };
@@ -0,0 +1,15 @@
1
+ const BASE64_SVG_ICON = 'data:image/svg+xml;base64,';
2
+ const MARKUP_SVG_ICON = '<svg ';
3
+ const isIconFormatIsBase64 = (icon) => {
4
+ if (!icon) {
5
+ return false;
6
+ }
7
+ return icon.startsWith(BASE64_SVG_ICON);
8
+ };
9
+ const isIconFormatIsSVG = (icon) => {
10
+ if (!icon) {
11
+ return false;
12
+ }
13
+ return icon.startsWith(MARKUP_SVG_ICON);
14
+ };
15
+ export { isIconFormatIsBase64, isIconFormatIsSVG, BASE64_SVG_ICON, MARKUP_SVG_ICON, };
@@ -1,10 +1,22 @@
1
1
  const cssDurationToMilliseconds = (duration, defaultValue = 1000) => {
2
+ if (duration.includes('ms')) {
3
+ return Number(duration.replace('ms', ''));
4
+ }
2
5
  if (duration.includes('s')) {
3
6
  return Number(duration.replace('s', '')) * 1000;
4
7
  }
5
- if (duration.includes('ms')) {
6
- return Number(duration.replace('s', ''));
8
+ return defaultValue;
9
+ };
10
+ const cssSizeToNumber = (size, defaultValue = 0) => {
11
+ if (size.includes('px')) {
12
+ return Number(size.replace('px', ''));
13
+ }
14
+ if (size.includes('rem')) {
15
+ return Number(size.replace('rem', '')) * 16;
16
+ }
17
+ if (size.includes('em')) {
18
+ return Number(size.replace('em', '')) * 16;
7
19
  }
8
20
  return defaultValue;
9
21
  };
10
- export { cssDurationToMilliseconds, };
22
+ export { cssDurationToMilliseconds, cssSizeToNumber, };
@@ -0,0 +1,16 @@
1
+ import { generator } from "./utils/prng";
2
+ import { strToCharCodeArray } from "./utils/string";
3
+ import { randomSign, minMaxLooped } from "./utils/math";
4
+ const rand = generator();
5
+ const random = (base, offset) => () => (base + rand.range(0, offset)) * randomSign();
6
+ export const generateRandomCharCodeArray = (base, offset) => str => strToCharCodeArray(str).map(random(base, offset));
7
+ export const charCodeArrayToString = ({ str, minCharCode, maxCharCode, placeholderChar, charStep, }) => charCodes => charCodes.reduce((acc, item, index) => {
8
+ if (item !== 0) {
9
+ if (Math.abs(item) > charStep) {
10
+ return acc + placeholderChar;
11
+ }
12
+ return (acc +
13
+ String.fromCharCode(minMaxLooped(minCharCode, maxCharCode)(str.charCodeAt(index) + item)));
14
+ }
15
+ return acc + str.charAt(index);
16
+ }, '');
@@ -0,0 +1,3 @@
1
+ // taken from https://github.com/zenoplex/random-text
2
+ // @flow
3
+ export { default } from './random-text';
@@ -0,0 +1,59 @@
1
+ import { generateRandomCharCodeArray, charCodeArrayToString } from "./core";
2
+ import { noop } from "./utils/noop";
3
+ class RandomText {
4
+ constructor(options) {
5
+ this.start = () => {
6
+ const { frameOffset, charOffset, str, speed } = this;
7
+ const randoms = generateRandomCharCodeArray(frameOffset, charOffset)(str);
8
+ this.stop();
9
+ this.rafId = requestAnimationFrame(() => {
10
+ this.step(randoms, speed, speed);
11
+ });
12
+ };
13
+ Object.assign(this, Object.assign(Object.assign({}, RandomText.defaults), options));
14
+ }
15
+ stop() {
16
+ cancelAnimationFrame(this.rafId);
17
+ }
18
+ step(randoms, stepCount, speed) {
19
+ const { str, charStep, minCharCode, maxCharCode, placeholderChar, onProgress, onComplete, } = this;
20
+ const stepArray = randoms.slice(0, stepCount);
21
+ const steppedArray = stepArray.map(item => {
22
+ if (item > 0)
23
+ return item - 1;
24
+ if (item < 0)
25
+ return item + 1;
26
+ return 0;
27
+ });
28
+ const output = charCodeArrayToString({
29
+ str,
30
+ minCharCode,
31
+ maxCharCode,
32
+ placeholderChar,
33
+ charStep,
34
+ })(steppedArray);
35
+ const updatedRandoms = [...steppedArray, ...randoms.slice(stepCount)];
36
+ onProgress(output);
37
+ if (output !== str) {
38
+ this.rafId = requestAnimationFrame(() => {
39
+ this.step(updatedRandoms, stepCount + speed, speed);
40
+ });
41
+ }
42
+ else {
43
+ onComplete(output);
44
+ }
45
+ }
46
+ }
47
+ RandomText.defaults = {
48
+ str: '',
49
+ speed: 2,
50
+ placeholderChar: '_',
51
+ frameOffset: 30,
52
+ charOffset: 20,
53
+ charStep: 10,
54
+ minCharCode: 32,
55
+ maxCharCode: 122,
56
+ onProgress: noop,
57
+ onComplete: noop,
58
+ };
59
+ export default RandomText;
@@ -0,0 +1,11 @@
1
+ import { generator } from "./prng";
2
+ const rand = generator();
3
+ export const randomSign = () => (Math.round(Math.random()) - 0.5) * 2;
4
+ export const generateRandomNumbers = base => charOffset => length => [...Array(length)].map(() => (base + rand.range(0, charOffset)) * randomSign());
5
+ export const minMaxLooped = (min, max) => value => {
6
+ if (value > max)
7
+ return min + (value - max);
8
+ if (value < min)
9
+ return max + (value - min);
10
+ return value;
11
+ };
@@ -0,0 +1 @@
1
+ export const noop = () => { };
@@ -0,0 +1,21 @@
1
+ const int32 = 2147483647;
2
+ const gen = v => (v * 16807) % int32;
3
+ const randomFloat = v => gen(v) / int32;
4
+ const randomInt = v => gen(v);
5
+ export const generator = (seed = 1) => {
6
+ let value = seed < 1 ? 1 : seed;
7
+ const next = () => {
8
+ value = randomInt(value);
9
+ return value;
10
+ };
11
+ return {
12
+ random: () => next(),
13
+ randomFloat: () => randomFloat(next()),
14
+ range: (min, max) => {
15
+ const minimum = min - 0.4999;
16
+ const maximum = max + 0.4999;
17
+ return Math.round(minimum + (maximum - minimum) * randomFloat(next()));
18
+ },
19
+ rangeFloat: (min, max) => min + (max - min) * randomFloat(next()),
20
+ };
21
+ };
@@ -0,0 +1,2 @@
1
+ // export const strToCharCodeArray: string => number[] = str => str.split('').map(item => item.charCodeAt(0));
2
+ export const strToCharCodeArray = str => str.split('').map(item => item.charCodeAt(0));
@@ -1,3 +1,7 @@
1
+ .static {
2
+ position: static;
3
+ }
4
+
1
5
  .fixed {
2
6
  position: fixed;
3
7
  }
@@ -10,8 +14,144 @@
10
14
  border-width: 1px;
11
15
  }
12
16
 
13
- .text {
14
- font-size: 1rem;
17
+ .bg-label-amaranth-10 {
18
+ --tw-bg-opacity: 1;
19
+ background-color: rgb(var(--label-amaranth-10) / var(--tw-bg-opacity));
20
+ }
21
+
22
+ .bg-label-aqua-10 {
23
+ --tw-bg-opacity: 1;
24
+ background-color: rgb(var(--label-aqua-10) / var(--tw-bg-opacity));
25
+ }
26
+
27
+ .bg-label-blue-10 {
28
+ --tw-bg-opacity: 1;
29
+ background-color: rgb(var(--label-blue-10) / var(--tw-bg-opacity));
30
+ }
31
+
32
+ .bg-label-green-10 {
33
+ --tw-bg-opacity: 1;
34
+ background-color: rgb(var(--label-green-10) / var(--tw-bg-opacity));
35
+ }
36
+
37
+ .bg-label-lime-10 {
38
+ --tw-bg-opacity: 1;
39
+ background-color: rgb(var(--label-lime-10) / var(--tw-bg-opacity));
40
+ }
41
+
42
+ .bg-label-orange-10 {
43
+ --tw-bg-opacity: 1;
44
+ background-color: rgb(var(--label-orange-10) / var(--tw-bg-opacity));
45
+ }
46
+
47
+ .bg-label-orchid-10 {
48
+ --tw-bg-opacity: 1;
49
+ background-color: rgb(var(--label-orchid-10) / var(--tw-bg-opacity));
50
+ }
51
+
52
+ .bg-label-violet-10 {
53
+ --tw-bg-opacity: 1;
54
+ background-color: rgb(var(--label-violet-10) / var(--tw-bg-opacity));
55
+ }
56
+
57
+ .bg-label-yellow-10 {
58
+ --tw-bg-opacity: 1;
59
+ background-color: rgb(var(--label-yellow-10) / var(--tw-bg-opacity));
60
+ }
61
+
62
+ .bg-tone-neutral-10 {
63
+ --tw-bg-opacity: 1;
64
+ background-color: rgb(var(--tone-neutral-10) / var(--tw-bg-opacity));
65
+ }
66
+
67
+ .fill-label-amaranth-04 {
68
+ fill: rgb(var(--label-amaranth-04));
69
+ }
70
+
71
+ .fill-label-aqua-04 {
72
+ fill: rgb(var(--label-aqua-04));
73
+ }
74
+
75
+ .fill-label-blue-04 {
76
+ fill: rgb(var(--label-blue-04));
77
+ }
78
+
79
+ .fill-label-green-04 {
80
+ fill: rgb(var(--label-green-04));
81
+ }
82
+
83
+ .fill-label-lime-04 {
84
+ fill: rgb(var(--label-lime-04));
85
+ }
86
+
87
+ .fill-label-orange-04 {
88
+ fill: rgb(var(--label-orange-04));
89
+ }
90
+
91
+ .fill-label-orchid-04 {
92
+ fill: rgb(var(--label-orchid-04));
93
+ }
94
+
95
+ .fill-label-violet-04 {
96
+ fill: rgb(var(--label-violet-04));
97
+ }
98
+
99
+ .fill-label-yellow-04 {
100
+ fill: rgb(var(--label-yellow-04));
101
+ }
102
+
103
+ .fill-tone-neutral-04 {
104
+ fill: rgb(var(--tone-neutral-04));
105
+ }
106
+
107
+ .text-label-amaranth-04 {
108
+ --tw-text-opacity: 1;
109
+ color: rgb(var(--label-amaranth-04) / var(--tw-text-opacity));
110
+ }
111
+
112
+ .text-label-aqua-04 {
113
+ --tw-text-opacity: 1;
114
+ color: rgb(var(--label-aqua-04) / var(--tw-text-opacity));
115
+ }
116
+
117
+ .text-label-blue-04 {
118
+ --tw-text-opacity: 1;
119
+ color: rgb(var(--label-blue-04) / var(--tw-text-opacity));
120
+ }
121
+
122
+ .text-label-green-04 {
123
+ --tw-text-opacity: 1;
124
+ color: rgb(var(--label-green-04) / var(--tw-text-opacity));
125
+ }
126
+
127
+ .text-label-lime-04 {
128
+ --tw-text-opacity: 1;
129
+ color: rgb(var(--label-lime-04) / var(--tw-text-opacity));
130
+ }
131
+
132
+ .text-label-orange-04 {
133
+ --tw-text-opacity: 1;
134
+ color: rgb(var(--label-orange-04) / var(--tw-text-opacity));
135
+ }
136
+
137
+ .text-label-orchid-04 {
138
+ --tw-text-opacity: 1;
139
+ color: rgb(var(--label-orchid-04) / var(--tw-text-opacity));
140
+ }
141
+
142
+ .text-label-violet-04 {
143
+ --tw-text-opacity: 1;
144
+ color: rgb(var(--label-violet-04) / var(--tw-text-opacity));
145
+ }
146
+
147
+ .text-label-yellow-04 {
148
+ --tw-text-opacity: 1;
149
+ color: rgb(var(--label-yellow-04) / var(--tw-text-opacity));
150
+ }
151
+
152
+ .text-tone-neutral-04 {
153
+ --tw-text-opacity: 1;
154
+ color: rgb(var(--tone-neutral-04) / var(--tw-text-opacity));
15
155
  }
16
156
 
17
157
  .shadow {
@@ -0,0 +1,64 @@
1
+ const fileExtensionsDictionary = {
2
+ '7z': { format: 'archive', description: 'Archivio compresso' },
3
+ ace: { format: 'archive', description: 'Archivio compresso' },
4
+ ai: { format: 'vector', description: 'Vettoriale Adobe Illustrator' },
5
+ dart: { format: 'code', description: 'Dart' },
6
+ db: { format: 'data', description: 'File di database' },
7
+ default: { format: 'attachment', description: 'Formato sconosciuto' },
8
+ dmg: { format: 'executable', description: 'Apple Disk Image' },
9
+ doc: { format: 'text', description: 'Documento Microsoft Word' },
10
+ docm: { format: 'text', description: 'Documento Microsoft Word' },
11
+ docx: { format: 'text', description: 'Documento Microsoft Word Compresso' },
12
+ eml: { format: 'email', description: 'E-mail di posta elettronica' },
13
+ eps: { format: 'vector', description: 'Vettoriale Corel Draw' },
14
+ exe: { format: 'executable', description: 'File eseguibile Windows' },
15
+ flac: { format: 'audio', description: 'Audio non compresso' },
16
+ gif: { format: 'image', description: 'Immagine compressa', preview: true },
17
+ htm: { format: 'markup', description: 'Pagina web' },
18
+ heic: { format: 'image', description: 'High Efficiency Image File Format' },
19
+ html: { format: 'markup', description: 'Pagina web' },
20
+ jpe: { format: 'image', description: 'Immagine compressa', preview: true },
21
+ jpeg: { format: 'image', description: 'Immagine compressa', preview: true },
22
+ jpg: { format: 'image', description: 'Immagine compressa', preview: true },
23
+ js: { format: 'code', description: 'JavaScript' },
24
+ json: { format: 'data', description: 'JavaScript Object Notation' },
25
+ jsx: { format: 'code', description: 'JavaScript' },
26
+ m2v: { format: 'video', description: 'Filmato SD' },
27
+ mp2: { format: 'audio', description: 'Audio compresso' },
28
+ mp3: { format: 'audio', description: 'Audio compresso' },
29
+ mp4: { format: 'video', description: 'Filmato HD' },
30
+ mp4v: { format: 'video', description: 'Filmato HD' },
31
+ mpeg: { format: 'video', description: 'Filmato SD' },
32
+ mpg4: { format: 'video', description: 'Filmato SD' },
33
+ mpg: { format: 'video', description: 'Filmato SD' },
34
+ mpga: { format: 'audio', description: 'Audio compresso' },
35
+ odp: { format: 'slide', description: 'Slide di presentazione LibreOffice' },
36
+ ods: { format: 'spreadsheet', description: 'Foglio di calcolo LibreOffice' },
37
+ odt: { format: 'text', description: 'File di testo LibreOffice' },
38
+ pdf: { format: 'document', description: 'Documento Adobe' },
39
+ php: { format: 'code', description: 'Hypertext Preprocessor' },
40
+ png: { format: 'image', description: 'Immagine Portable Network Graphics', preview: true },
41
+ ppt: { format: 'slide', description: 'Slide di presentazione PowerPoint' },
42
+ rar: { format: 'archive', description: 'Archivio compresso' },
43
+ rtf: { format: 'text', description: 'Documento di testo Rich Text Format' },
44
+ sass: { format: 'code', description: 'Syntactically Awesome StyleSheets' },
45
+ shtml: { format: 'markup', description: 'Pagina web' },
46
+ svg: { format: 'vector', description: 'Scalable Vector Graphics', preview: true },
47
+ tar: { format: 'archive', description: 'Archivio non compresso' },
48
+ tiff: { format: 'image', description: 'Tag Image File Format' },
49
+ ts: { format: 'code', description: 'TypeScript' },
50
+ tsx: { format: 'code', description: 'TypeScript Extended Syntax' },
51
+ txt: { format: 'text', description: 'Documento di testo non formattato' },
52
+ wav: { format: 'audio', description: 'Audio non compresso' },
53
+ webp: { format: 'image', description: 'Immagine Web Picture', preview: true },
54
+ xar: { format: 'archive', description: 'Archivio compresso' },
55
+ xls: { format: 'spreadsheet', description: 'Foglio di calcolo Office' },
56
+ xlsx: { format: 'spreadsheet', description: 'Foglio di calcolo Office' },
57
+ zip: { format: 'archive', description: 'Archivio compresso' },
58
+ };
59
+ const genericMimeToExt = new Map([
60
+ ['image', ['.png', '.jpg', '.jpeg', '.tiff', '.webp', '.jpe', '.gif', '.heic']],
61
+ ['audio', ['.mp2', '.mp3', '.mpga', '.wav', '.flac']],
62
+ ['video', ['.mv2', '.mp4', '.mp4v', '.mpeg', '.mpg4', '.mpg']],
63
+ ]);
64
+ export { fileExtensionsDictionary, genericMimeToExt, };
@@ -2,4 +2,9 @@ import jsonIconsDictionary from "../fixtures/icons.json";
2
2
  import jsonMggIconsDictionary from "../fixtures/iconsauce.json";
3
3
  const iconsDictionary = jsonIconsDictionary;
4
4
  const mggIconsDictionary = jsonMggIconsDictionary;
5
- export { iconsDictionary, mggIconsDictionary, };
5
+ const svgIconsDictionary = [
6
+ `${location.origin}/svg/mi/baseline/email.svg`,
7
+ 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjQiPjxwYXRoIGQ9Im0yMzMtODAgNjUtMjgxTDgwLTU1MGwyODgtMjUgMTEyLTI2NSAxMTIgMjY1IDI4OCAyNS0yMTggMTg5IDY1IDI4MS0yNDctMTQ5TDIzMy04MFoiLz48L3N2Zz4=',
8
+ '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6s-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8s-3.58-8-8-8z"/></svg>',
9
+ ];
10
+ export { iconsDictionary, mggIconsDictionary, svgIconsDictionary, };
@@ -0,0 +1,6 @@
1
+ const truncateDictionary = [
2
+ 'all',
3
+ 'none',
4
+ 'word',
5
+ ];
6
+ export { truncateDictionary, };
@@ -35,6 +35,23 @@ const themeFullVariantDictionary = [
35
35
  'warning',
36
36
  'yellow',
37
37
  ];
38
+ const themeFullVariantAvatarDictionary = [
39
+ 'amaranth',
40
+ 'aqua',
41
+ 'blue',
42
+ 'error',
43
+ 'green',
44
+ 'info',
45
+ 'lime',
46
+ 'orange',
47
+ 'orchid',
48
+ 'primary',
49
+ 'sky',
50
+ 'success',
51
+ 'violet',
52
+ 'warning',
53
+ 'yellow',
54
+ ];
38
55
  const themeLabelVariantDictionary = [
39
56
  'amaranth',
40
57
  'aqua',
@@ -70,4 +87,4 @@ const toneMinimalVariantDictionary = [
70
87
  'strong',
71
88
  'weak',
72
89
  ];
73
- export { themeFullVariantDictionary, themeLabelVariantDictionary, themeLuminanceVariantDictionary, themeStatusVariantDictionary, themeVariantDictionary, toneActionVariantDictionary, toneMinimalVariantDictionary, toneSimpleVariantDictionary, toneVariantDictionary, };
90
+ export { themeFullVariantAvatarDictionary, themeFullVariantDictionary, themeLabelVariantDictionary, themeLuminanceVariantDictionary, themeStatusVariantDictionary, themeVariantDictionary, toneActionVariantDictionary, toneMinimalVariantDictionary, toneSimpleVariantDictionary, toneVariantDictionary, };