@descope/web-components-ui 1.0.62 → 1.0.64

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/dist/cjs/index.cjs.js +95 -21
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +673 -697
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/447.js +1 -1
  6. package/dist/umd/666.js +37 -0
  7. package/dist/umd/725.js +1 -37
  8. package/dist/umd/descope-button-index-js.js +1 -1
  9. package/dist/umd/descope-checkbox-index-js.js +1 -1
  10. package/dist/umd/descope-container-index-js.js +1 -1
  11. package/dist/umd/descope-date-picker-index-js.js +1 -1
  12. package/dist/umd/descope-divider-index-js.js +1 -1
  13. package/dist/umd/descope-email-field-index-js.js +1 -1
  14. package/dist/umd/descope-link-index-js.js +1 -1
  15. package/dist/umd/descope-loader-linear-index-js.js +1 -1
  16. package/dist/umd/descope-loader-radial-index-js.js +1 -1
  17. package/dist/umd/descope-logo-index-js.js +1 -1
  18. package/dist/umd/descope-number-field-index-js.js +1 -1
  19. package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
  20. package/dist/umd/descope-passcode-index-js.js +1 -1
  21. package/dist/umd/descope-password-field-index-js.js +1 -1
  22. package/dist/umd/descope-switch-toggle-index-js.js +1 -1
  23. package/dist/umd/descope-text-area-index-js.js +1 -1
  24. package/dist/umd/descope-text-field-index-js.js +1 -1
  25. package/dist/umd/descope-text-index-js.js +1 -1
  26. package/dist/umd/index.js +1 -1
  27. package/package.json +1 -1
  28. package/src/baseClasses/BaseInputClass.js +1 -1
  29. package/src/components/descope-button/Button.js +14 -10
  30. package/src/components/descope-checkbox/Checkbox.js +8 -5
  31. package/src/components/descope-container/Container.js +12 -7
  32. package/src/components/descope-date-picker/index.js +3 -3
  33. package/src/components/descope-divider/Divider.js +35 -30
  34. package/src/components/descope-email-field/EmailField.js +3 -3
  35. package/src/components/descope-link/Link.js +19 -27
  36. package/src/components/descope-loader-linear/LoaderLinear.js +12 -7
  37. package/src/components/descope-loader-radial/LoaderRadial.js +5 -5
  38. package/src/components/descope-logo/Logo.js +4 -4
  39. package/src/components/descope-number-field/NumberField.js +3 -3
  40. package/src/components/descope-passcode/Passcode.js +55 -71
  41. package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +1 -1
  42. package/src/components/descope-password-field/PasswordField.js +3 -3
  43. package/src/components/descope-switch-toggle/SwitchToggle.js +8 -5
  44. package/src/components/descope-text/Text.js +18 -9
  45. package/src/components/descope-text-area/TextArea.js +7 -6
  46. package/src/components/descope-text-field/TextField.js +3 -3
  47. package/src/components/descope-text-field/textFieldMappings.js +3 -5
  48. package/src/constants.js +1 -0
  49. package/src/dev/index.js +2 -2
  50. package/src/{componentsHelpers/createProxy/helpers.js → helpers/componentHelpers.js} +13 -5
  51. package/src/{helpers.js → helpers/index.js} +5 -2
  52. package/src/helpers/themeHelpers/componentsThemeManager.js +40 -0
  53. package/src/{themeHelpers → helpers/themeHelpers}/index.js +56 -21
  54. package/src/index.cjs.js +1 -1
  55. package/src/index.js +5 -5
  56. package/src/index.umd.js +4 -0
  57. package/src/{componentsHelpers/createProxy/index.js → mixins/createProxy.js} +4 -4
  58. package/src/{componentsHelpers → mixins}/createStyleMixin/helpers.js +14 -15
  59. package/src/mixins/createStyleMixin/index.js +109 -0
  60. package/src/{componentsHelpers → mixins}/index.js +2 -6
  61. package/src/theme/components/button.js +2 -2
  62. package/src/theme/components/checkbox.js +2 -1
  63. package/src/theme/components/container.js +2 -2
  64. package/src/theme/components/divider.js +17 -9
  65. package/src/theme/components/link.js +1 -1
  66. package/src/theme/components/loader/loaderLinear.js +1 -1
  67. package/src/theme/components/loader/loaderRadial.js +1 -1
  68. package/src/theme/components/text.js +1 -1
  69. package/src/theme/components/textArea.js +2 -1
  70. package/src/theme/components/textField.js +1 -1
  71. package/src/theme/globals.js +3 -3
  72. package/dist/umd/442.js +0 -1
  73. package/dist/umd/942.js +0 -1
  74. package/dist/umd/descope-combo-index-js.js +0 -1
  75. package/src/components/descope-combo/index.js +0 -27
  76. package/src/componentsHelpers/compose.js +0 -3
  77. package/src/componentsHelpers/createStyleMixin/index.js +0 -114
  78. package/src/componentsHelpers/enforceNestingElementsStylesMixin.js +0 -103
  79. /package/dist/umd/{725.js.LICENSE.txt → 666.js.LICENSE.txt} +0 -0
  80. /package/src/{themeHelpers/processColors.js → helpers/themeHelpers/colorsHelpers.js} +0 -0
  81. /package/src/{componentsHelpers → mixins}/componentNameValidationMixin.js +0 -0
  82. /package/src/{componentsHelpers → mixins}/draggableMixin.js +0 -0
  83. /package/src/{componentsHelpers → mixins}/hoverableMixin.js +0 -0
  84. /package/src/{componentsHelpers → mixins}/inputMixin.js +0 -0
  85. /package/src/{componentsHelpers → mixins}/proxyInputMixin.js +0 -0
@@ -13,10 +13,50 @@ const kebabCase = (str) =>
13
13
 
14
14
  const kebabCaseJoin = (...args) => kebabCase(args.join('-'));
15
15
 
16
+ const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name);
17
+
16
18
  const getCssVarName = (...args) =>
17
- `--${kebabCaseJoin(...args.filter((arg) => !!arg))}`;
19
+ `--${kebabCaseJoin(...args.filter((arg) => !!arg))}`;
18
20
 
19
- const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name);
21
+ class ComponentsThemeManager {
22
+ static mountOnPropName = 'DescopeThemeManager';
23
+
24
+ #themes = {};
25
+
26
+ #currentThemeName = 'light';
27
+
28
+ #callbacks = new Set();
29
+
30
+ #notify() {
31
+ this.#callbacks.forEach(cb => cb?.());
32
+ };
33
+
34
+ get currentThemeName() {
35
+ return this.#currentThemeName;
36
+ }
37
+
38
+ set currentThemeName(themeName) {
39
+ this.#currentThemeName = themeName;
40
+ this.#notify();
41
+ }
42
+
43
+ get currentTheme() {
44
+ return this.#themes[this.currentThemeName];
45
+ }
46
+
47
+ onCurrentThemeChange(cb) {
48
+ this.#callbacks.add(cb);
49
+
50
+ return () => { this.#callbacks.delete(cb); };
51
+ };
52
+
53
+ set themes(themes) {
54
+ this.#themes = themes;
55
+ this.#notify();
56
+ }
57
+ }
58
+
59
+ const componentsThemeManager = new ComponentsThemeManager();
20
60
 
21
61
  const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
22
62
 
@@ -46,9 +86,9 @@ const getThemeRefs = (theme, prefix) =>
46
86
  const globalsThemeToStyle = (theme, themeName = '') => `
47
87
  *[data-theme="${themeName}"] {
48
88
  ${Object.entries(themeToCSSVarsObj(theme)).reduce(
49
- (acc, entry) => (acc += `${entry.join(':')};\n`),
50
- ''
51
- )}
89
+ (acc, entry) => (acc += `${entry.join(':')};\n`),
90
+ ''
91
+ )}
52
92
  }
53
93
  `;
54
94
 
@@ -56,10 +96,20 @@ const componentsThemeToStyleObj = (componentsTheme) =>
56
96
  transformTheme(componentsTheme, [], (path, val) => {
57
97
  const [component, ...restPath] = path;
58
98
  const property = restPath.pop();
99
+ const componentName = getComponentName(component);
100
+
101
+ // we need a support for portal components theme (e.g. overlay)
102
+ // this allows us to generate those themes under different sections
103
+ // if the theme has root level attribute that starts with #
104
+ // we are generating a new theme
105
+ let themeName = 'theme';
106
+
107
+ if (restPath[0] && restPath[0].startsWith('#')) {
108
+ themeName = restPath.shift();
109
+ }
59
110
 
60
111
  // do not start with underscore -> key:value, must have 2 no underscore attrs in a row
61
112
  // starts with underscore -> attribute selector
62
-
63
113
  const attrsSelector = restPath.reduce((acc, section, idx) => {
64
114
  if (section.startsWith('_'))
65
115
  return (acc += `[${kebabCase(section.replace(/^_/, ''))}="true"]`);
@@ -79,30 +129,53 @@ const componentsThemeToStyleObj = (componentsTheme) =>
79
129
  .join('')}"]`);
80
130
  }, '');
81
131
 
82
- let selector = `${getComponentName(component)}${attrsSelector}`;
132
+ let selector = `:host${attrsSelector ? `(${attrsSelector})` : ''}`;
83
133
 
84
134
  return {
85
- [selector]: {
86
- [property]: val
135
+ [componentName]: {
136
+ [themeName]: {
137
+ [selector]: {
138
+ [property]: val
139
+ }
140
+ }
87
141
  }
88
142
  };
89
143
  });
90
144
 
91
- const componentsThemeToStyle = (componentsTheme, themeName = '') =>
92
- Object.entries(componentsThemeToStyleObj(componentsTheme)).reduce(
145
+
146
+ const createComponentsTheme = (componentsTheme) => {
147
+ const styleObj = componentsThemeToStyleObj(componentsTheme);
148
+
149
+ return Object.keys(styleObj).reduce(
150
+ (acc, componentName) => {
151
+ const componentThemes = styleObj[componentName];
152
+
153
+ return Object.assign(acc, {
154
+ [componentName]: Object.keys(componentThemes)
155
+ .reduce((acc, theme) =>
156
+ Object.assign(acc, { [theme]: componentsThemeToStyle(componentThemes[theme]) }),
157
+ {})
158
+ })
159
+ },
160
+ {}
161
+ );
162
+ };
163
+
164
+ const componentsThemeToStyle = (componentsTheme) =>
165
+ Object.entries(componentsTheme).reduce(
93
166
  (acc, [selector, vars]) =>
94
- (acc += `*[data-theme="${themeName}"] ${selector} { \n${Object.entries(
95
- vars
96
- )
97
- .map(([key, val]) => `${key}: ${val}`)
98
- .join(';\n')} \n}\n\n`),
167
+ (acc += `${selector} { \n${Object.entries(
168
+ vars
169
+ )
170
+ .map(([key, val]) => `${key}: ${val}`)
171
+ .join(';\n')} \n}\n\n`),
99
172
  ''
100
173
  );
101
174
 
102
- const themeToStyle = ({ globals, components }, themeName) => `
103
- ${globalsThemeToStyle(globals, themeName)}
104
- ${componentsThemeToStyle(components, themeName)}
105
- `;
175
+ const themeToStyle = ({ globals, components }, themeName) => ({
176
+ globals: globalsThemeToStyle(globals, themeName),
177
+ components: createComponentsTheme(components)
178
+ });
106
179
 
107
180
  const useVar = (varName) => `var(${varName})`;
108
181
 
@@ -122,7 +195,8 @@ const createHelperVars = (theme, prefix) => {
122
195
  return [res.theme, res.useVars, res.vars];
123
196
  };
124
197
 
125
- exports.componentsThemeToStyle = componentsThemeToStyle;
198
+ exports.componentsThemeManager = componentsThemeManager;
199
+ exports.createComponentsTheme = createComponentsTheme;
126
200
  exports.createHelperVars = createHelperVars;
127
201
  exports.getThemeRefs = getThemeRefs;
128
202
  exports.globalsThemeToStyle = globalsThemeToStyle;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../src/constants.js","../../src/helpers.js","../../src/componentsHelpers/index.js","../../src/themeHelpers/index.js"],"sourcesContent":["export const DESCOPE_PREFIX = 'descope';\n","export const kebabCase = (str) =>\n\tstr\n\t\t.replace(/([a-z])([A-Z])/g, '$1-$2')\n\t\t.replace(/[\\s_.]+/g, '-')\n\t\t.toLowerCase();\n\nexport const kebabCaseJoin = (...args) => kebabCase(args.join('-'));\n\nexport const getCssVarName = (...args) =>\n\t`--${kebabCaseJoin(...args.filter((arg) => !!arg))}`;\n","import { DESCOPE_PREFIX } from '../constants';\nimport { kebabCaseJoin } from '../helpers';\n\nexport const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name);\n\nexport { createStyleMixin } from './createStyleMixin';\nexport { draggableMixin } from './draggableMixin';\nexport { createProxy } from './createProxy';\nexport { proxyInputMixin } from './proxyInputMixin';\nexport { componentNameValidationMixin } from './componentNameValidationMixin';\nexport { default as compose } from './compose'","import merge from 'lodash.merge';\nimport set from 'lodash.set';\nimport { DESCOPE_PREFIX } from '../constants';\nimport { getCssVarName, kebabCase } from '../helpers';\nimport { getComponentName } from '../componentsHelpers';\n\nconst getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);\n\nconst transformTheme = (theme, path, getTransformation) => {\n\treturn Object.entries(theme).reduce((acc, [key, val]) => {\n\t\tif (val?.constructor !== Object) {\n\t\t\treturn merge(acc, getTransformation(path.concat(key), val));\n\t\t} else {\n\t\t\treturn merge(acc, transformTheme(val, [...path, key], getTransformation));\n\t\t}\n\t}, {});\n};\n\nconst stringifyArray = (strArr) =>\n\tstrArr.map((str) => (str.includes(' ') ? `\"${str}\"` : str)).join(', ');\n\nexport const themeToCSSVarsObj = (theme) =>\n\ttransformTheme(theme, [], (path, val) => ({\n\t\t[getVarName(path)]: Array.isArray(val) ? stringifyArray(val) : val\n\t}));\n\nexport const getThemeRefs = (theme, prefix) =>\n\ttransformTheme(theme, [], (path) =>\n\t\tset({}, path, `var(${getVarName(prefix ? [prefix, ...path] : path)})`)\n\t);\n\nexport const globalsThemeToStyle = (theme, themeName = '') => `\n*[data-theme=\"${themeName}\"] {\n\t${Object.entries(themeToCSSVarsObj(theme)).reduce(\n\t\t(acc, entry) => (acc += `${entry.join(':')};\\n`),\n\t\t''\n\t)}\n}\n`;\n\nconst componentsThemeToStyleObj = (componentsTheme) =>\n\ttransformTheme(componentsTheme, [], (path, val) => {\n\t\tconst [component, ...restPath] = path;\n\t\tconst property = restPath.pop();\n\n\t\t// do not start with underscore -> key:value, must have 2 no underscore attrs in a row\n\t\t// starts with underscore -> attribute selector\n\n\t\tconst attrsSelector = restPath.reduce((acc, section, idx) => {\n\t\t\tif (section.startsWith('_'))\n\t\t\t\treturn (acc += `[${kebabCase(section.replace(/^_/, ''))}=\"true\"]`);\n\n\t\t\tconst nextSection = restPath[idx + 1];\n\n\t\t\tif (typeof nextSection !== 'string' || nextSection.startsWith('_')) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'theme generator',\n\t\t\t\t\t`your theme structure is invalid, attribute \"${section}\" is followed by \"${nextSection}\" which is not allowed`\n\t\t\t\t);\n\t\t\t\treturn acc;\n\t\t\t}\n\n\t\t\treturn (acc += `[${kebabCase(section)}=\"${restPath\n\t\t\t\t.splice(idx + 1, 1)\n\t\t\t\t.join('')}\"]`);\n\t\t}, '');\n\n\t\tlet selector = `${getComponentName(component)}${attrsSelector}`;\n\n\t\treturn {\n\t\t\t[selector]: {\n\t\t\t\t[property]: val\n\t\t\t}\n\t\t};\n\t});\n\nexport const componentsThemeToStyle = (componentsTheme, themeName = '') =>\n\tObject.entries(componentsThemeToStyleObj(componentsTheme)).reduce(\n\t\t(acc, [selector, vars]) =>\n\t\t\t(acc += `*[data-theme=\"${themeName}\"] ${selector} { \\n${Object.entries(\n\t\t\t\tvars\n\t\t\t)\n\t\t\t\t.map(([key, val]) => `${key}: ${val}`)\n\t\t\t\t.join(';\\n')} \\n}\\n\\n`),\n\t\t''\n\t);\n\nexport const themeToStyle = ({ globals, components }, themeName) => `\n${globalsThemeToStyle(globals, themeName)}\n${componentsThemeToStyle(components, themeName)}\n`;\n\nconst useVar = (varName) => `var(${varName})`;\n\nexport const createHelperVars = (theme, prefix) => {\n\tconst res = transformTheme(theme, [], (path, value) => {\n\t\tconst modifiedPath = [...path];\n\t\tconst property = modifiedPath.splice(-1);\n\t\tconst varName = getCssVarName(prefix, property);\n\n\t\tconst vars = { [property]: varName };\n\t\tconst theme = set({}, [...modifiedPath, varName], value);\n\t\tconst useVars = { [property]: useVar(varName) };\n\n\t\treturn { theme, useVars, vars };\n\t});\n\n\treturn [res.theme, res.useVars, res.vars];\n};\n"],"names":[],"mappings":";;;;;AAAO,MAAM,cAAc,GAAG,SAAS;;ACAhC,MAAM,SAAS,GAAG,CAAC,GAAG;AAC7B,CAAC,GAAG;AACJ,GAAG,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;AACtC,GAAG,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;AAC3B,GAAG,WAAW,EAAE,CAAC;AACjB;AACO,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACpE;AACO,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI;AACrC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;;ACN9C,MAAM,gBAAgB,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC;;ACG7E,MAAM,UAAU,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,CAAC;AACpE;AACA,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,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;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../src/constants.js","../../src/helpers/index.js","../../src/helpers/componentHelpers.js","../../src/helpers/themeHelpers/componentsThemeManager.js","../../src/helpers/themeHelpers/index.js"],"sourcesContent":["export const DESCOPE_PREFIX = 'descope';\nexport const CSS_SELECTOR_SPECIFIER_MULTIPLY = 3","\nexport const kebabCase = (str) =>\n\tstr\n\t\t.replace(/([a-z])([A-Z])/g, '$1-$2')\n\t\t.replace(/[\\s_.]+/g, '-')\n\t\t.toLowerCase();\n\nexport const kebabCaseJoin = (...args) => kebabCase(args.join('-'));\n\nexport const compose = (...fns) =>\n\t(val) =>\n\t\tfns.reduceRight((res, fn) => fn(res), val);\n\n","import { kebabCaseJoin } from '.';\nimport { DESCOPE_PREFIX } from '../constants';\n\nconst observeAttributes = (\n\tele,\n\tcallback,\n\t{ excludeAttrs = [], includeAttrs = [] }\n) => {\n\t// sync all attrs on init\n\tcallback(\n\t\t...Array.from(ele.attributes)\n\t\t\t.filter(\n\t\t\t\t(attr) =>\n\t\t\t\t\t!excludeAttrs.includes(attr.name) &&\n\t\t\t\t\t(!includeAttrs.length || includeAttrs.includes(attr.name))\n\t\t\t)\n\t\t\t.map((attr) => attr.name)\n\t);\n\n\tconst observer = new MutationObserver((mutationsList) => {\n\t\tfor (const mutation of mutationsList) {\n\t\t\tif (\n\t\t\t\tmutation.type === 'attributes' &&\n\t\t\t\t!excludeAttrs.includes(mutation.attributeName) &&\n\t\t\t\t(!includeAttrs.length || includeAttrs.includes(mutation.attributeName))\n\t\t\t) {\n\t\t\t\tcallback([mutation.attributeName]);\n\t\t\t}\n\t\t}\n\t});\n\n\tobserver.observe(ele, { attributes: true });\n};\n\nconst createSyncAttrsCb =\n\t(srcEle, targetEle, mapAttrs = {}) =>\n\t(...attrNames) => {\n\t\tattrNames.forEach((attrName) => {\n\t\t\tconst targetAttrName = mapAttrs[attrName] || attrName;\n\t\t\tconst srcAttrVal = srcEle.getAttribute(attrName);\n\t\t\tif (srcAttrVal !== null) {\n\t\t\t\tif (targetEle.getAttribute(targetAttrName) !== srcAttrVal) {\n\t\t\t\t\ttargetEle.setAttribute(targetAttrName, srcAttrVal);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttargetEle.removeAttribute(targetAttrName);\n\t\t\t}\n\t\t});\n\t};\n\nexport const syncAttrs = (ele1, ele2, options) => {\n\tobserveAttributes(ele1, createSyncAttrsCb(ele1, ele2), options);\n\tobserveAttributes(ele2, createSyncAttrsCb(ele2, ele1), options);\n};\n\nexport const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name);\n\nexport const getCssVarName = (...args) =>\n `--${kebabCaseJoin(...args.filter((arg) => !!arg))}`;\n\nexport const forwardAttrs = (source, dest, options = {}) => {\n observeAttributes(\n source,\n createSyncAttrsCb(source, dest, options.mapAttrs),\n options\n );\n};\n\nexport const forwardProps = (src, target, props = []) => {\n\tif(!props.length) return;\n\n\tconst config = props.reduce((acc, prop) => Object.assign(acc, {[prop] : {\n\t\tget () {\n\t\t\treturn target[prop]\n\t\t},\n\t\tset (v) {\n\t\t\ttarget[prop] = v\n\t\t}\n\t}}), {})\n\n\tObject.defineProperties(src, config)\n}\n","\nclass ComponentsThemeManager {\n static mountOnPropName = 'DescopeThemeManager';\n\n #themes = {};\n\n #currentThemeName = 'light';\n\n #callbacks = new Set();\n\n #notify() {\n this.#callbacks.forEach(cb => cb?.());\n };\n\n get currentThemeName() {\n return this.#currentThemeName;\n }\n\n set currentThemeName(themeName) {\n this.#currentThemeName = themeName;\n this.#notify();\n }\n\n get currentTheme() {\n return this.#themes[this.currentThemeName];\n }\n\n onCurrentThemeChange(cb) {\n this.#callbacks.add(cb);\n\n return () => { this.#callbacks.delete(cb); };\n };\n\n set themes(themes) {\n this.#themes = themes;\n this.#notify();\n }\n}\n\nexport const componentsThemeManager = new ComponentsThemeManager()\n","import merge from 'lodash.merge';\nimport set from 'lodash.set';\nimport { DESCOPE_PREFIX } from '../../constants';\nimport { kebabCase } from '..';\nimport { getComponentName, getCssVarName } from '../componentHelpers';\n\nconst getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);\n\nconst transformTheme = (theme, path, getTransformation) => {\n\treturn Object.entries(theme).reduce((acc, [key, val]) => {\n\t\tif (val?.constructor !== Object) {\n\t\t\treturn merge(acc, getTransformation(path.concat(key), val));\n\t\t} else {\n\t\t\treturn merge(acc, transformTheme(val, [...path, key], getTransformation));\n\t\t}\n\t}, {});\n};\n\nconst stringifyArray = (strArr) =>\n\tstrArr.map((str) => (str.includes(' ') ? `\"${str}\"` : str)).join(', ');\n\nexport const themeToCSSVarsObj = (theme) =>\n\ttransformTheme(theme, [], (path, val) => ({\n\t\t[getVarName(path)]: Array.isArray(val) ? stringifyArray(val) : val\n\t}));\n\nexport const getThemeRefs = (theme, prefix) =>\n\ttransformTheme(theme, [], (path) =>\n\t\tset({}, path, `var(${getVarName(prefix ? [prefix, ...path] : path)})`)\n\t);\n\nexport const globalsThemeToStyle = (theme, themeName = '') => `\n*[data-theme=\"${themeName}\"] {\n\t${Object.entries(themeToCSSVarsObj(theme)).reduce(\n\t(acc, entry) => (acc += `${entry.join(':')};\\n`),\n\t''\n)}\n}\n`;\n\nconst componentsThemeToStyleObj = (componentsTheme) =>\n\ttransformTheme(componentsTheme, [], (path, val) => {\n\t\tconst [component, ...restPath] = path;\n\t\tconst property = restPath.pop();\n\t\tconst componentName = getComponentName(component);\n\n\t\t// we need a support for portal components theme (e.g. overlay)\n\t\t// this allows us to generate those themes under different sections\n\t\t// if the theme has root level attribute that starts with #\n\t\t// we are generating a new theme\n\t\tlet themeName = 'theme'\n\n\t\tif (restPath[0] && restPath[0].startsWith('#')) {\n\t\t\tthemeName = restPath.shift();\n\t\t}\n\n\t\t// do not start with underscore -> key:value, must have 2 no underscore attrs in a row\n\t\t// starts with underscore -> attribute selector\n\t\tconst attrsSelector = restPath.reduce((acc, section, idx) => {\n\t\t\tif (section.startsWith('_'))\n\t\t\t\treturn (acc += `[${kebabCase(section.replace(/^_/, ''))}=\"true\"]`);\n\n\t\t\tconst nextSection = restPath[idx + 1];\n\n\t\t\tif (typeof nextSection !== 'string' || nextSection.startsWith('_')) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t'theme generator',\n\t\t\t\t\t`your theme structure is invalid, attribute \"${section}\" is followed by \"${nextSection}\" which is not allowed`\n\t\t\t\t);\n\t\t\t\treturn acc;\n\t\t\t}\n\n\t\t\treturn (acc += `[${kebabCase(section)}=\"${restPath\n\t\t\t\t.splice(idx + 1, 1)\n\t\t\t\t.join('')}\"]`);\n\t\t}, '');\n\n\t\tlet selector = `:host${attrsSelector ? `(${attrsSelector})` : ''}`;\n\n\t\treturn {\n\t\t\t[componentName]: {\n\t\t\t\t[themeName]: {\n\t\t\t\t\t[selector]: {\n\t\t\t\t\t\t[property]: val\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t});\n\n\nexport const createComponentsTheme = (componentsTheme) => {\n\tconst styleObj = componentsThemeToStyleObj(componentsTheme);\n\n\treturn Object.keys(styleObj).reduce(\n\t\t(acc, componentName) => {\n\t\t\tconst componentThemes = styleObj[componentName];\n\n\t\t\treturn Object.assign(acc, {\n\t\t\t\t[componentName]: Object.keys(componentThemes)\n\t\t\t\t\t.reduce((acc, theme) =>\n\t\t\t\t\t\tObject.assign(acc, { [theme]: componentsThemeToStyle(componentThemes[theme]) }),\n\t\t\t\t\t\t{})\n\t\t\t})\n\t\t},\n\t\t{}\n\t);\n}\n\nconst componentsThemeToStyle = (componentsTheme) =>\n\tObject.entries(componentsTheme).reduce(\n\t\t(acc, [selector, vars]) =>\n\t\t(acc += `${selector} { \\n${Object.entries(\n\t\t\tvars\n\t\t)\n\t\t\t.map(([key, val]) => `${key}: ${val}`)\n\t\t\t.join(';\\n')} \\n}\\n\\n`),\n\t\t''\n\t);\n\nexport const themeToStyle = ({ globals, components }, themeName) => ({\n\tglobals: globalsThemeToStyle(globals, themeName),\n\tcomponents: createComponentsTheme(components)\n});\n\nconst useVar = (varName) => `var(${varName})`;\n\nexport const createHelperVars = (theme, prefix) => {\n\tconst res = transformTheme(theme, [], (path, value) => {\n\t\tconst modifiedPath = [...path];\n\t\tconst property = modifiedPath.splice(-1);\n\t\tconst varName = getCssVarName(prefix, property);\n\n\t\tconst vars = { [property]: varName };\n\t\tconst theme = set({}, [...modifiedPath, varName], value);\n\t\tconst useVars = { [property]: useVar(varName) };\n\n\t\treturn { theme, useVars, vars };\n\t});\n\n\treturn [res.theme, res.useVars, res.vars];\n};\n\nexport { componentsThemeManager } from './componentsThemeManager'\n"],"names":[],"mappings":";;;;;AAAO,MAAM,cAAc,GAAG,SAAS;;ACChC,MAAM,SAAS,GAAG,CAAC,GAAG;AAC7B,CAAC,GAAG;AACJ,GAAG,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;AACtC,GAAG,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;AAC3B,GAAG,WAAW,EAAE,CAAC;AACjB;AACO,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;ACgD5D,MAAM,gBAAgB,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AAC9E;AACO,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI;AACrC,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;;ACzDtD,MAAM,sBAAsB,CAAC;AAC7B,EAAE,OAAO,eAAe,GAAG,qBAAqB,CAAC;AACjD;AACA,EAAE,OAAO,GAAG,EAAE,CAAC;AACf;AACA,EAAE,iBAAiB,GAAG,OAAO,CAAC;AAC9B;AACA,EAAE,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;AACzB;AACA,EAAE,OAAO,GAAG;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