@pine-ds/icons 3.1.0 → 3.3.0-rc.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 (76) hide show
  1. package/components/pds-icon.d.ts +2 -2
  2. package/components/pds-icon.js +175 -171
  3. package/components/pds-icon.js.map +1 -1
  4. package/components/utils.js +65 -45
  5. package/components/utils.js.map +1 -1
  6. package/dist/cheatsheet.html +7 -5
  7. package/dist/cjs/{index-b35d5b0f.js → index-17212f65.js} +81 -21
  8. package/dist/cjs/index-17212f65.js.map +1 -0
  9. package/dist/cjs/index.cjs.js +2 -2
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/pds-icon.cjs.entry.js +152 -150
  12. package/dist/cjs/pds-icon.cjs.entry.js.map +1 -1
  13. package/dist/cjs/pds-icons.cjs.js +3 -3
  14. package/dist/cjs/pds-icons.cjs.js.map +1 -1
  15. package/dist/cjs/utils-8c57ce6a.js +101 -0
  16. package/dist/cjs/utils-8c57ce6a.js.map +1 -0
  17. package/dist/collection/collection-manifest.json +1 -1
  18. package/dist/collection/components/pds-icon/pds-icon.js +189 -168
  19. package/dist/collection/components/pds-icon/pds-icon.js.map +1 -1
  20. package/dist/collection/components/pds-icon/request.js +21 -21
  21. package/dist/collection/components/pds-icon/request.js.map +1 -1
  22. package/dist/collection/components/pds-icon/svg/premium.svg +1 -0
  23. package/dist/collection/components/pds-icon/svg/theme-store.svg +1 -1
  24. package/dist/collection/components/pds-icon/test/pds-icon.e2e.js +6 -6
  25. package/dist/collection/components/pds-icon/test/pds-icon.e2e.js.map +1 -1
  26. package/dist/collection/components/pds-icon/test/pds-icon.spec.js +69 -31
  27. package/dist/collection/components/pds-icon/test/pds-icon.spec.js.map +1 -1
  28. package/dist/collection/components/pds-icon/utils.js +61 -51
  29. package/dist/collection/components/pds-icon/utils.js.map +1 -1
  30. package/dist/collection/components/pds-icon/validate.js +35 -35
  31. package/dist/collection/components/pds-icon/validate.js.map +1 -1
  32. package/dist/docs.json +23 -2
  33. package/dist/esm/{index-8effeb27.js → index-d1a605fc.js} +81 -21
  34. package/dist/esm/index-d1a605fc.js.map +1 -0
  35. package/dist/esm/index.js +2 -2
  36. package/dist/esm/loader.js +3 -3
  37. package/dist/esm/pds-icon.entry.js +152 -150
  38. package/dist/esm/pds-icon.entry.js.map +1 -1
  39. package/dist/esm/pds-icons.js +4 -4
  40. package/dist/esm/pds-icons.js.map +1 -1
  41. package/dist/esm/utils-15462a67.js +95 -0
  42. package/dist/esm/utils-15462a67.js.map +1 -0
  43. package/dist/pds-icons/index.esm.js +1 -1
  44. package/dist/pds-icons/p-19d7058a.js +3 -0
  45. package/dist/pds-icons/p-19d7058a.js.map +1 -0
  46. package/dist/pds-icons/p-229b8f4e.entry.js +2 -0
  47. package/dist/pds-icons/p-229b8f4e.entry.js.map +1 -0
  48. package/dist/pds-icons/p-f0b1dbd6.js +2 -0
  49. package/dist/pds-icons/p-f0b1dbd6.js.map +1 -0
  50. package/dist/pds-icons/pds-icons.esm.js +1 -1
  51. package/dist/pds-icons/pds-icons.esm.js.map +1 -1
  52. package/dist/pds-icons.json +8 -1
  53. package/dist/pds-icons.symbols.svg +3 -2
  54. package/dist/svg/premium.svg +1 -0
  55. package/dist/svg/theme-store.svg +1 -1
  56. package/dist/types/components/pds-icon/pds-icon.d.ts +41 -35
  57. package/dist/types/components/pds-icon/utils.d.ts +4 -4
  58. package/dist/types/components.d.ts +8 -0
  59. package/dist/types/stencil-public-runtime.d.ts +29 -0
  60. package/icons/index.d.ts +2 -1
  61. package/icons/index.js +3 -2
  62. package/icons/index.mjs +3 -2
  63. package/icons/package.json +1 -1
  64. package/package.json +6 -6
  65. package/dist/cjs/index-b35d5b0f.js.map +0 -1
  66. package/dist/cjs/utils-395a38b7.js +0 -81
  67. package/dist/cjs/utils-395a38b7.js.map +0 -1
  68. package/dist/esm/index-8effeb27.js.map +0 -1
  69. package/dist/esm/utils-a0ad61d0.js +0 -75
  70. package/dist/esm/utils-a0ad61d0.js.map +0 -1
  71. package/dist/pds-icons/p-91678731.entry.js +0 -2
  72. package/dist/pds-icons/p-91678731.entry.js.map +0 -1
  73. package/dist/pds-icons/p-a3383818.js +0 -3
  74. package/dist/pds-icons/p-a3383818.js.map +0 -1
  75. package/dist/pds-icons/p-dc5765cb.js +0 -2
  76. package/dist/pds-icons/p-dc5765cb.js.map +0 -1
@@ -1,81 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-b35d5b0f.js');
4
-
5
- let CACHED_MAP;
6
- const addIcons = (icons) => {
7
- const map = getIconMap();
8
- Object.keys(icons).forEach(name => map.set(name, icons[name]));
9
- };
10
- const getIconMap = () => {
11
- if (typeof window === 'undefined') {
12
- return new Map();
13
- }
14
- else {
15
- if (!CACHED_MAP) {
16
- const win = window; // eslint-disable-line @typescript-eslint/no-explicit-any
17
- win.PdsIcons = win.PdsIcons || {};
18
- CACHED_MAP = win.PdsIcons.map = win.PdsIcons.map || new Map();
19
- }
20
- return CACHED_MAP;
21
- }
22
- };
23
- const getName = (iconName) => {
24
- if (isStr(iconName)) {
25
- iconName = toLower(iconName);
26
- }
27
- if (!isStr(iconName) || iconName.trim() === '') {
28
- return null;
29
- }
30
- const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
31
- if (invalidChars != '') {
32
- return null;
33
- }
34
- return iconName;
35
- };
36
- const getNamedUrl = (iconName) => {
37
- const url = getIconMap().get(iconName);
38
- if (url) {
39
- return url;
40
- }
41
- return index.getAssetPath(`svg/${iconName}.svg`);
42
- };
43
- const getUrl = (icon) => {
44
- const url = getName(icon.name);
45
- if (url) {
46
- return getNamedUrl(url);
47
- }
48
- };
49
- const isStr = (val) => typeof val === 'string'; // eslint-disable-line @typescript-eslint/no-explicit-any
50
- const toLower = (val) => val.toLowerCase();
51
- /**
52
- * Elements inside of web components sometimes need to inherit global attributes
53
- * set on the host. For example, the inner input in `ion-input` should inherit
54
- * the `title` attribute that developers set directly on `ion-input`. This
55
- * helper function should be called in componentWillLoad and assigned to a variable
56
- * that is later used in the render function.
57
- *
58
- * This does not need to be reactive as changing attributes on the host element
59
- * does not trigger a re-render.
60
- */
61
- const inheritAttributes = (el, attributes = []) => {
62
- const attributeObject = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
63
- attributes.forEach(attr => {
64
- if (el.hasAttribute(attr)) {
65
- const value = el.getAttribute(attr);
66
- if (value !== null) {
67
- attributeObject[attr] = el.getAttribute(attr);
68
- }
69
- el.removeAttribute(attr);
70
- }
71
- });
72
- return attributeObject;
73
- };
74
-
75
- exports.addIcons = addIcons;
76
- exports.getName = getName;
77
- exports.getUrl = getUrl;
78
- exports.inheritAttributes = inheritAttributes;
79
- exports.isStr = isStr;
80
-
81
- //# sourceMappingURL=utils-395a38b7.js.map
@@ -1 +0,0 @@
1
- {"file":"utils-395a38b7.js","mappings":";;;;AAGA,IAAI,UAA+B,CAAC;MAEvB,QAAQ,GAAG,CAAC,KAAkC;EACzD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;EACzB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjE,EAAC;AAEM,MAAM,UAAU,GAAG;EACxB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,OAAO,IAAI,GAAG,EAAE,CAAC;GAClB;OAAO;IACN,IAAI,CAAC,UAAU,EAAE;MACf,MAAM,GAAG,GAAG,MAAa,CAAC;MAC1B,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;MAClC,UAAU,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC;KAC/D;IAED,OAAO,UAAU,CAAC;GACnB;AACH,CAAC,CAAA;MAEY,OAAO,G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C,CAAC;MACpC,IAAI,KAAK,KAAK,IAAI,EAAE;QAClB,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;OAC/C;MACD,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;KAC1B;GACF,CAAC,CAAC;EAEH,OAAO,eAAe,CAAC;AACzB;;;;;;;;","names":["getAssetPath"],"sources":["src/components/pds-icon/utils.ts"],"sourcesContent":["import { getAssetPath } from '@stencil/core';\nimport { PdsIcon } from './pds-icon';\n\nlet CACHED_MAP: Map<string, string>;\n\nexport const addIcons = (icons: { [name: string]: string; }) => {\n const map = getIconMap();\n Object.keys(icons).forEach(name => map.set(name, icons[name]));\n}\n\nexport const getIconMap = (): Map<string, string> => {\n if (typeof window === 'undefined') {\n return new Map();\n } else {\n if (!CACHED_MAP) {\n const win = window as any; // eslint-disable-line @typescript-eslint/no-explicit-any\n win.PdsIcons = win.PdsIcons || {};\n CACHED_MAP = win.PdsIcons.map = win.PdsIcons.map || new Map();\n }\n\n return CACHED_MAP;\n }\n}\n\nexport const getName = (iconName: string | undefined) => {\n if (isStr(iconName)) {\n iconName = toLower(iconName);\n }\n\n if (!isStr(iconName) || iconName.trim() === '') {\n return null;\n }\n\n const invalidChars = iconName.replace(/[a-z]|-|\\d/gi,'');\n if (invalidChars != '') { return null; }\n\n return iconName;\n}\n\nconst getNamedUrl = (iconName: string) => {\n const url = getIconMap().get(iconName);\n if (url) {\n return url;\n }\n\n return getAssetPath(`svg/${iconName}.svg`);\n};\n\nexport const getSrc = (src: string | undefined) => {\n if (isStr(src)) {\n src = src.trim();\n\n if (isSrc(src)) {\n return src;\n }\n }\n\n return null;\n}\n\nexport const getUrl = (icon: PdsIcon) => {\n const url = getName(icon.name);\n if (url) {\n return getNamedUrl(url);\n }\n};\n\n\nexport const isSrc = (str: string) => str.length > 0 && /(\\/|\\.)/.test(str);\nexport const isStr = (val: any): val is string => typeof val === 'string'; // eslint-disable-line @typescript-eslint/no-explicit-any\nexport const toLower = (val: string) => val.toLowerCase();\n\n/**\n * Elements inside of web components sometimes need to inherit global attributes\n * set on the host. For example, the inner input in `ion-input` should inherit\n * the `title` attribute that developers set directly on `ion-input`. This\n * helper function should be called in componentWillLoad and assigned to a variable\n * that is later used in the render function.\n *\n * This does not need to be reactive as changing attributes on the host element\n * does not trigger a re-render.\n */\n export const inheritAttributes = (el: HTMLElement, attributes: string[] = []) => {\n const attributeObject: { [k: string]: any } = {}; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n attributes.forEach(attr => {\n if (el.hasAttribute(attr)) {\n const value = el.getAttribute(attr);\n if (value !== null) {\n attributeObject[attr] = el.getAttribute(attr);\n }\n el.removeAttribute(attr);\n }\n });\n\n return attributeObject;\n}\n"],"version":3}