@voicenter-team/voicenter-ui-plus 3.4.2 → 3.4.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 (82) hide show
  1. package/README.md +502 -502
  2. package/library/assets/assets/sass/main.css +1 -1
  3. package/library/assets/components/VcFileUploader/VcFileUploaderArea.css +1 -0
  4. package/library/assets/components/VcFileUploader/{VcFileUploader.css → VcFileUploaderSimple.css} +1 -1
  5. package/library/assets/components/VcJsonSchema/Components/JsonSchemaEditor.css +1 -1
  6. package/library/assets/components/VcLoading/Loaders/Circles.css +1 -1
  7. package/library/assets/components/VcLoading/Loaders/DotSpinner.css +1 -1
  8. package/library/assets/components/VcLoading/Loaders/LdsSpinner.css +1 -1
  9. package/library/assets/components/VcLoading/Loaders/LoadIcon.css +1 -1
  10. package/library/assets/components/VcLoading/Loaders/Stretch.css +1 -1
  11. package/library/assets/components/VcLoading/VcLoading.css +1 -1
  12. package/library/assets/components/VcMdEditor/ParameterNode.css +1 -1
  13. package/library/assets/components/VcSkeletonLoader/Loaders/Card.css +1 -1
  14. package/library/assets/components/VcSkeletonLoader/Loaders/Circle.css +1 -1
  15. package/library/assets/components/VcSkeletonLoader/Loaders/Row.css +1 -1
  16. package/library/assets/components/VcSkeletonLoader/Loaders/Square.css +1 -1
  17. package/library/assets/components/VcSkeletonLoader/Loaders/Text.css +1 -1
  18. package/library/components/VcFileUploader/VcFileUploader.vue.mjs +87 -5
  19. package/library/components/VcFileUploader/VcFileUploader.vue2.mjs +1 -381
  20. package/library/components/VcFileUploader/VcFileUploaderArea.vue.mjs +338 -0
  21. package/library/components/VcFileUploader/VcFileUploaderArea.vue3.mjs +5 -0
  22. package/library/components/VcFileUploader/VcFileUploaderSimple.vue.mjs +7 -0
  23. package/library/components/VcFileUploader/VcFileUploaderSimple.vue2.mjs +200 -0
  24. package/library/components/VcFileUploader/VcSimpleUploaderAction.vue.mjs +62 -0
  25. package/library/components/VcFileUploader/VcSimpleUploaderAction.vue2.mjs +4 -0
  26. package/library/components/VcFileUploader/VcSimpleUploaderFileList.vue.mjs +75 -0
  27. package/library/components/VcFileUploader/VcSimpleUploaderFileList.vue2.mjs +4 -0
  28. package/library/components/VcJsonSchema/Components/JsonSchemaEditor.vue.mjs +1 -1
  29. package/library/components/VcLoading/Loaders/Circles.vue.mjs +1 -1
  30. package/library/components/VcLoading/Loaders/DotSpinner.vue.mjs +1 -1
  31. package/library/components/VcLoading/Loaders/DotSpinner.vue2.mjs +2 -2
  32. package/library/components/VcLoading/Loaders/LdsSpinner.vue.mjs +1 -1
  33. package/library/components/VcLoading/Loaders/LoadIcon.vue.mjs +1 -1
  34. package/library/components/VcLoading/Loaders/Stretch.vue.mjs +1 -1
  35. package/library/components/VcLoading/Loaders/Stretch.vue2.mjs +1 -1
  36. package/library/components/VcLoading/VcLoading.vue.mjs +1 -1
  37. package/library/components/VcMdEditor/ParameterNode.vue.mjs +1 -1
  38. package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNav.vue.mjs +33 -25
  39. package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue.mjs +31 -0
  40. package/library/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue2.mjs +4 -0
  41. package/library/components/VcSkeletonLoader/Loaders/Card.vue.mjs +1 -1
  42. package/library/components/VcSkeletonLoader/Loaders/Circle.vue.mjs +1 -1
  43. package/library/components/VcSkeletonLoader/Loaders/Row.vue.mjs +1 -1
  44. package/library/components/VcSkeletonLoader/Loaders/Square.vue.mjs +1 -1
  45. package/library/components/VcSkeletonLoader/Loaders/Text.vue.mjs +1 -1
  46. package/library/composables/input/useFileUploader.mjs +163 -0
  47. package/library/composables/option/useOptionMethods.mjs +14 -0
  48. package/library/index.mjs +151 -146
  49. package/library/index.mjs.br +0 -0
  50. package/library/index.mjs.gz +0 -0
  51. package/library/localization/index.mjs.gz +0 -0
  52. package/library/localization/locales/en.json.mjs +2 -0
  53. package/library/plugin-components.gen.mjs +157 -152
  54. package/library/plugin.mjs +149 -144
  55. package/library/plugin.mjs.br +0 -0
  56. package/library/plugin.mjs.gz +0 -0
  57. package/library/style.css +17 -15
  58. package/library/style.css.br +0 -0
  59. package/library/style.css.gz +0 -0
  60. package/library/theme/index.mjs.gz +0 -0
  61. package/library/types/components/VcFileUploader/VcFileUploader.vue.d.ts +29 -139
  62. package/library/types/components/VcFileUploader/VcFileUploaderArea.vue.d.ts +122 -0
  63. package/library/types/components/VcFileUploader/VcFileUploaderSimple.vue.d.ts +127 -0
  64. package/library/types/components/VcFileUploader/VcSimpleUploaderAction.vue.d.ts +38 -0
  65. package/library/types/components/VcFileUploader/VcSimpleUploaderFileList.vue.d.ts +41 -0
  66. package/library/types/components/VcRadioTabs/UiComponents/VcRadioTabsNavHint.vue.d.ts +36 -0
  67. package/library/types/components/exports.d.ts +5 -1
  68. package/library/types/components.gen.d.ts +2 -0
  69. package/library/types/composables/input/useFileUploader.d.ts +82 -0
  70. package/library/types/composables/option/useOptionMethods.d.ts +9 -8
  71. package/library/types/localization/locales/en.json.d.ts +164 -162
  72. package/library/types/theme/themes.json.d.ts +227 -227
  73. package/library/types/types/OptionAndConfig.types.d.ts +4 -0
  74. package/library/utils/jsonSchema/index.mjs.gz +0 -0
  75. package/package.json +185 -185
  76. package/src/theme/index.ts +101 -101
  77. package/src/theme/tailwindScheme.js +37 -37
  78. package/src/theme/theme.types.ts +31 -31
  79. package/src/theme/themeMerge.ts +40 -40
  80. package/src/theme/themes.json +227 -227
  81. package/tailwind.config.d.ts +5 -5
  82. package/tailwind.config.js +192 -192
package/package.json CHANGED
@@ -1,185 +1,185 @@
1
- {
2
- "name": "@voicenter-team/voicenter-ui-plus",
3
- "version": "3.4.2",
4
- "scripts": {
5
- "dev": "vite",
6
- "build": "vite build",
7
- "analyze": "cross-env ANALYZE=true vite build",
8
- "build:documentation": "npm run build && cross-env TARGET=doc vite build",
9
- "ts-check": "vue-tsc --noEmit -p tsconfig.prod.json",
10
- "ts-check-all": "vue-tsc --noEmit",
11
- "generate-icon-list": "node ./script/generate/generateIconList.js",
12
- "generate:entries": "node ./script/generate-entries.mjs",
13
- "verify:entries": "node ./script/verify-entries.mjs",
14
- "preview": "vite preview",
15
- "test": "vitest",
16
- "test:ui": "vitest --ui",
17
- "test:coverage": "vitest run --coverage",
18
- "test:coverage:watch": "vitest --coverage",
19
- "test:coverage:ui": "vitest --coverage --ui",
20
- "upload-icons": "node ./script/icons-publish/index.js",
21
- "scan-for-remote": "npm run build && node ./script/scan-for-remote-sources.js",
22
- "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts --fix --ignore-path .gitignore",
23
- "mcp:install": "cd mcp-server && npm install",
24
- "mcp:generate": "cd mcp-server && npm run generate:all",
25
- "mcp:dev": "cd mcp-server && npm run dev",
26
- "mcp:build": "cd mcp-server && npm run build",
27
- "mcp:start": "cd mcp-server && npm start",
28
- "release": "npm ci && npm run build && npm publish",
29
- "prepare": "husky"
30
- },
31
- "lint-staged": {
32
- "*.{vue,js,jsx,cjs,mjs,ts}": "eslint --fix"
33
- },
34
- "main": "./library/index.mjs",
35
- "module": "./library/index.mjs",
36
- "types": "./library/types/index.d.ts",
37
- "sideEffects": [
38
- "**/*.css",
39
- "./library/plugin.mjs"
40
- ],
41
- "typesVersions": {
42
- "*": {
43
- "plugin": [
44
- "./library/types/plugin.d.ts"
45
- ],
46
- "services": [
47
- "./library/types/services/index.d.ts"
48
- ],
49
- "theme": [
50
- "./library/types/theme/index.d.ts"
51
- ],
52
- "font": [
53
- "./library/types/font/index.d.ts"
54
- ]
55
- }
56
- },
57
- "exports": {
58
- ".": {
59
- "types": "./library/types/index.d.ts",
60
- "import": "./library/index.mjs",
61
- "default": "./library/index.mjs"
62
- },
63
- "./plugin": {
64
- "types": "./library/types/plugin.d.ts",
65
- "import": "./library/plugin.mjs",
66
- "default": "./library/plugin.mjs"
67
- },
68
- "./services": {
69
- "types": "./library/types/services/index.d.ts",
70
- "import": "./library/services/index.mjs",
71
- "default": "./library/services/index.mjs"
72
- },
73
- "./theme": {
74
- "types": "./library/types/theme/index.d.ts",
75
- "import": "./library/theme/index.mjs",
76
- "default": "./library/theme/index.mjs"
77
- },
78
- "./font": {
79
- "types": "./library/types/font/index.d.ts",
80
- "import": "./library/font/index.mjs",
81
- "default": "./library/font/index.mjs"
82
- },
83
- "./style.css": "./library/style.css",
84
- "./base.css": "./library/assets/assets/sass/main.css",
85
- "./src/theme/*": "./src/theme/*",
86
- "./src/theme/tailwindScheme": "./src/theme/tailwindScheme.js",
87
- "./src/theme/themes.json": "./src/theme/themes.json",
88
- "./tailwind.config": "./tailwind.config.js",
89
- "./library/types/*": "./library/types/*.d.ts"
90
- },
91
- "files": [
92
- "library",
93
- "src/theme",
94
- "tailwind.config.js",
95
- "tailwind.config.d.ts"
96
- ],
97
- "engines": {
98
- "node": ">= 20"
99
- },
100
- "peerDependencies": {
101
- "@codemirror/lang-html": "^6.0.0",
102
- "@codemirror/lang-json": "^6.0.1",
103
- "@codemirror/lang-markdown": "^6.0.0",
104
- "@lucide/vue": "^1.16.0",
105
- "@milkdown/crepe": "^7.15.5",
106
- "@milkdown/kit": "^7.15.5",
107
- "@milkdown/utils": "^7.15.5",
108
- "@milkdown/vue": "^7.15.5",
109
- "@prosemirror-adapter/vue": "^0.4.1",
110
- "@vueuse/core": ">=10.7.2",
111
- "codemirror": "^6.0.1",
112
- "dayjs": "^1.11.19",
113
- "element-plus": "^2.11.3",
114
- "highlight.js": "^11.6.0",
115
- "libphonenumber-js": "^1.10.13",
116
- "lodash-es": "^4.17.21",
117
- "maska": "^3.2.0",
118
- "pdfjs-dist": "^2.16.105",
119
- "vue": "^3.5.13",
120
- "vue-advanced-cropper": "^2.8.3",
121
- "vue-codemirror6": "^1.3.12",
122
- "wavesurfer.js": "^7.7.15",
123
- "xlsx": "^0.18.5"
124
- },
125
- "devDependencies": {
126
- "@codemirror/lang-json": "^6.0.1",
127
- "@fullhuman/postcss-purgecss": "^7.0.2",
128
- "@highlightjs/vue-plugin": "^2.1.0",
129
- "@lucide/vue": "^1.16.0",
130
- "@milkdown/crepe": "7.15.5",
131
- "@milkdown/kit": "7.15.5",
132
- "@milkdown/utils": "7.15.5",
133
- "@milkdown/vue": "7.15.5",
134
- "@prosemirror-adapter/vue": "^0.4.1",
135
- "@types/json-schema": "^7.0.15",
136
- "@types/lodash-es": "^4.17.12",
137
- "@types/node": "^18.7.6",
138
- "@types/wavesurfer.js": "^6.0.3",
139
- "@types/webfontloader": "^1.6.38",
140
- "@vitejs/plugin-vue": "5.2.4",
141
- "@vitest/coverage-v8": "3.2.7",
142
- "@vitest/ui": "3.2.7",
143
- "@voicenter-team/aws-uploader": "^1.0.10",
144
- "@voicenter-team/eslint-config-vue": "^1.0.21",
145
- "@vue/server-renderer": "^3.5.13",
146
- "@vue/test-utils": "^2.4.6",
147
- "@vueuse/core": "10.7.2",
148
- "autoprefixer": "10.4.17",
149
- "axios": "^1.6.0",
150
- "chalk": "4.1.2",
151
- "codemirror": "^6.0.1",
152
- "cross-env": "^7.0.3",
153
- "dotenv": "^16.4.7",
154
- "eslint": "^8.57.1",
155
- "eslint-plugin-standard": "^5.0.0",
156
- "eslint-plugin-vue": "9.21.1",
157
- "highlight.js": "^11.6.0",
158
- "husky": "^9.1.7",
159
- "jsdom": "^26.1.0",
160
- "lint-staged": "^17.3.0",
161
- "pdfjs-dist": "2.16.105",
162
- "postcss": "8.5.24",
163
- "readline-sync": "^1.4.10",
164
- "sass": "1.93.3",
165
- "tailwindcss": "^3.1.8",
166
- "terser": "^5.44.0",
167
- "typescript": "5.3.3",
168
- "unplugin-element-plus": "^0.4.1",
169
- "vite": "^5.4.6",
170
- "vite-bundle-analyzer": "^0.15.2",
171
- "vite-plugin-compression": "^0.5.1",
172
- "vite-plugin-dts": "3.7.2",
173
- "vite-plugin-inspect": "0.8.9",
174
- "vite-plugin-lib-inject-css": "^2.2.2",
175
- "vite-plugin-static-copy": "0.17.1",
176
- "vitest": "^3.2.4",
177
- "vue-advanced-cropper": "^2.8.3",
178
- "vue-codemirror6": "^1.3.12",
179
- "vue-component-type-helpers": "^1.8.27",
180
- "vue-router": "4.2.5",
181
- "vue-tsc": "1.8.27",
182
- "wavesurfer.js": "^7.7.15",
183
- "xlsx": "0.18.5"
184
- }
185
- }
1
+ {
2
+ "name": "@voicenter-team/voicenter-ui-plus",
3
+ "version": "3.4.4",
4
+ "scripts": {
5
+ "dev": "vite",
6
+ "build": "vite build",
7
+ "analyze": "cross-env ANALYZE=true vite build",
8
+ "build:documentation": "npm run build && cross-env TARGET=doc vite build",
9
+ "ts-check": "vue-tsc --noEmit -p tsconfig.prod.json",
10
+ "ts-check-all": "vue-tsc --noEmit",
11
+ "generate-icon-list": "node ./script/generate/generateIconList.js",
12
+ "generate:entries": "node ./script/generate-entries.mjs",
13
+ "verify:entries": "node ./script/verify-entries.mjs",
14
+ "preview": "vite preview",
15
+ "test": "vitest",
16
+ "test:ui": "vitest --ui",
17
+ "test:coverage": "vitest run --coverage",
18
+ "test:coverage:watch": "vitest --coverage",
19
+ "test:coverage:ui": "vitest --coverage --ui",
20
+ "upload-icons": "node ./script/icons-publish/index.js",
21
+ "scan-for-remote": "npm run build && node ./script/scan-for-remote-sources.js",
22
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts --fix --ignore-path .gitignore",
23
+ "mcp:install": "cd mcp-server && npm install",
24
+ "mcp:generate": "cd mcp-server && npm run generate:all",
25
+ "mcp:dev": "cd mcp-server && npm run dev",
26
+ "mcp:build": "cd mcp-server && npm run build",
27
+ "mcp:start": "cd mcp-server && npm start",
28
+ "release": "npm ci && npm run build && npm publish",
29
+ "prepare": "husky"
30
+ },
31
+ "lint-staged": {
32
+ "*.{vue,js,jsx,cjs,mjs,ts}": "eslint --fix"
33
+ },
34
+ "main": "./library/index.mjs",
35
+ "module": "./library/index.mjs",
36
+ "types": "./library/types/index.d.ts",
37
+ "sideEffects": [
38
+ "**/*.css",
39
+ "./library/plugin.mjs"
40
+ ],
41
+ "typesVersions": {
42
+ "*": {
43
+ "plugin": [
44
+ "./library/types/plugin.d.ts"
45
+ ],
46
+ "services": [
47
+ "./library/types/services/index.d.ts"
48
+ ],
49
+ "theme": [
50
+ "./library/types/theme/index.d.ts"
51
+ ],
52
+ "font": [
53
+ "./library/types/font/index.d.ts"
54
+ ]
55
+ }
56
+ },
57
+ "exports": {
58
+ ".": {
59
+ "types": "./library/types/index.d.ts",
60
+ "import": "./library/index.mjs",
61
+ "default": "./library/index.mjs"
62
+ },
63
+ "./plugin": {
64
+ "types": "./library/types/plugin.d.ts",
65
+ "import": "./library/plugin.mjs",
66
+ "default": "./library/plugin.mjs"
67
+ },
68
+ "./services": {
69
+ "types": "./library/types/services/index.d.ts",
70
+ "import": "./library/services/index.mjs",
71
+ "default": "./library/services/index.mjs"
72
+ },
73
+ "./theme": {
74
+ "types": "./library/types/theme/index.d.ts",
75
+ "import": "./library/theme/index.mjs",
76
+ "default": "./library/theme/index.mjs"
77
+ },
78
+ "./font": {
79
+ "types": "./library/types/font/index.d.ts",
80
+ "import": "./library/font/index.mjs",
81
+ "default": "./library/font/index.mjs"
82
+ },
83
+ "./style.css": "./library/style.css",
84
+ "./base.css": "./library/assets/assets/sass/main.css",
85
+ "./src/theme/*": "./src/theme/*",
86
+ "./src/theme/tailwindScheme": "./src/theme/tailwindScheme.js",
87
+ "./src/theme/themes.json": "./src/theme/themes.json",
88
+ "./tailwind.config": "./tailwind.config.js",
89
+ "./library/types/*": "./library/types/*.d.ts"
90
+ },
91
+ "files": [
92
+ "library",
93
+ "src/theme",
94
+ "tailwind.config.js",
95
+ "tailwind.config.d.ts"
96
+ ],
97
+ "engines": {
98
+ "node": ">= 20"
99
+ },
100
+ "peerDependencies": {
101
+ "@codemirror/lang-html": "^6.0.0",
102
+ "@codemirror/lang-json": "^6.0.1",
103
+ "@codemirror/lang-markdown": "^6.0.0",
104
+ "@lucide/vue": "^1.16.0",
105
+ "@milkdown/crepe": "^7.15.5",
106
+ "@milkdown/kit": "^7.15.5",
107
+ "@milkdown/utils": "^7.15.5",
108
+ "@milkdown/vue": "^7.15.5",
109
+ "@prosemirror-adapter/vue": "^0.4.1",
110
+ "@vueuse/core": ">=10.7.2",
111
+ "codemirror": "^6.0.1",
112
+ "dayjs": "^1.11.19",
113
+ "element-plus": "^2.11.3",
114
+ "highlight.js": "^11.6.0",
115
+ "libphonenumber-js": "^1.10.13",
116
+ "lodash-es": "^4.17.21",
117
+ "maska": "^3.2.0",
118
+ "pdfjs-dist": "^2.16.105",
119
+ "vue": "^3.5.13",
120
+ "vue-advanced-cropper": "^2.8.3",
121
+ "vue-codemirror6": "^1.3.12",
122
+ "wavesurfer.js": "^7.7.15",
123
+ "xlsx": "^0.18.5"
124
+ },
125
+ "devDependencies": {
126
+ "@codemirror/lang-json": "^6.0.1",
127
+ "@fullhuman/postcss-purgecss": "^7.0.2",
128
+ "@highlightjs/vue-plugin": "^2.1.0",
129
+ "@lucide/vue": "^1.16.0",
130
+ "@milkdown/crepe": "7.15.5",
131
+ "@milkdown/kit": "7.15.5",
132
+ "@milkdown/utils": "7.15.5",
133
+ "@milkdown/vue": "7.15.5",
134
+ "@prosemirror-adapter/vue": "^0.4.1",
135
+ "@types/json-schema": "^7.0.15",
136
+ "@types/lodash-es": "^4.17.12",
137
+ "@types/node": "^18.7.6",
138
+ "@types/wavesurfer.js": "^6.0.3",
139
+ "@types/webfontloader": "^1.6.38",
140
+ "@vitejs/plugin-vue": "5.2.4",
141
+ "@vitest/coverage-v8": "3.2.7",
142
+ "@vitest/ui": "3.2.7",
143
+ "@voicenter-team/aws-uploader": "^1.0.10",
144
+ "@voicenter-team/eslint-config-vue": "^1.0.21",
145
+ "@vue/server-renderer": "^3.5.13",
146
+ "@vue/test-utils": "^2.4.6",
147
+ "@vueuse/core": "10.7.2",
148
+ "autoprefixer": "10.4.17",
149
+ "axios": "^1.6.0",
150
+ "chalk": "4.1.2",
151
+ "codemirror": "^6.0.1",
152
+ "cross-env": "^7.0.3",
153
+ "dotenv": "^16.4.7",
154
+ "eslint": "^8.57.1",
155
+ "eslint-plugin-standard": "^5.0.0",
156
+ "eslint-plugin-vue": "9.21.1",
157
+ "highlight.js": "^11.6.0",
158
+ "husky": "^9.1.7",
159
+ "jsdom": "^26.1.0",
160
+ "lint-staged": "^17.3.0",
161
+ "pdfjs-dist": "2.16.105",
162
+ "postcss": "8.5.24",
163
+ "readline-sync": "^1.4.10",
164
+ "sass": "1.93.3",
165
+ "tailwindcss": "^3.1.8",
166
+ "terser": "^5.44.0",
167
+ "typescript": "5.3.3",
168
+ "unplugin-element-plus": "^0.4.1",
169
+ "vite": "^5.4.6",
170
+ "vite-bundle-analyzer": "^0.15.2",
171
+ "vite-plugin-compression": "^0.5.1",
172
+ "vite-plugin-dts": "3.7.2",
173
+ "vite-plugin-inspect": "0.8.9",
174
+ "vite-plugin-lib-inject-css": "^2.2.2",
175
+ "vite-plugin-static-copy": "0.17.1",
176
+ "vitest": "^3.2.4",
177
+ "vue-advanced-cropper": "^2.8.3",
178
+ "vue-codemirror6": "^1.3.12",
179
+ "vue-component-type-helpers": "^1.8.27",
180
+ "vue-router": "4.2.5",
181
+ "vue-tsc": "1.8.27",
182
+ "wavesurfer.js": "^7.7.15",
183
+ "xlsx": "0.18.5"
184
+ }
185
+ }
@@ -1,101 +1,101 @@
1
- import { themesType, themeType, UIThemeConfig } from './theme.types' // Must be relative as doing publish
2
- import __themes from './themes.json' // Must be relative as doing publish
3
- import { overrideElementTheme as _overrideElementTheme, globalVariables } from './themeMerge'
4
-
5
- const _default: themeType = __themes.redGreen
6
-
7
- const themes: themesType = __themes
8
-
9
- // Re-exported for back-compat with consumers that imported it directly.
10
- // The implementation lives in `themeMerge.ts` so the build-time codegen
11
- // can reuse it without dragging in browser-globals from the rest of this
12
- // module.
13
- export const overrideElementTheme = _overrideElementTheme
14
-
15
- export function appendGlobalCssVariables (cssData: { [key: string]: string }, appendTo: HTMLElement) {
16
- Object.entries(cssData).forEach(([ variableName, variableValue ]) => {
17
- appendTo.style.setProperty(`--${variableName}`, variableValue)
18
- })
19
- }
20
-
21
- export async function getThemeConfigData (themeConfig?: UIThemeConfig) {
22
- let currentTheme = _default
23
-
24
- if (themeConfig) {
25
-
26
- if (themeConfig.type === 'local') {
27
- if (themes[themeConfig.themeName]) {
28
- currentTheme = themes[themeConfig.themeName]
29
- } else {
30
- console.warn(`[VoicenterUI-plus] No such theme: ${themeConfig.themeName}`)
31
- }
32
- }
33
-
34
- if (themeConfig.type === 'remote') {
35
- let body = JSON.stringify(
36
- {
37
- SectionList: [
38
- themeConfig.brandingSectionName
39
- ],
40
- Domain: window.location.hostname
41
- }
42
- )
43
-
44
- if (themeConfig.payloadData) {
45
- body = JSON.stringify(themeConfig.payloadData)
46
- }
47
-
48
- const apiStyling = await fetch(themeConfig.apiUrl, {
49
- method: 'POST',
50
- cache: 'no-cache',
51
- headers: {
52
- 'Content-Type': 'application/json'
53
- },
54
- referrerPolicy: 'no-referrer',
55
- body
56
- })
57
- .then(res => res.json())
58
- .then(res => res.Data)
59
- .then(res => {
60
- return Object.fromEntries(Object.entries(res).map(([ key, value ]) => {
61
- return [
62
- key.replace(`${themeConfig.brandingSectionName}.`, ''),
63
- String(value)
64
- ]
65
- }))
66
- })
67
- .catch(e => console.error(e))
68
-
69
- if (apiStyling) {
70
- currentTheme = apiStyling
71
- }
72
- }
73
-
74
- if (themeConfig.type === 'customJson') {
75
- currentTheme = themeConfig.config ?? {}
76
- }
77
- }
78
-
79
- return currentTheme
80
- }
81
-
82
- export default async function (themeConfig?: UIThemeConfig, appendTo: HTMLElement = document.documentElement) {
83
-
84
- if (themeConfig?.type === 'none') {
85
- return themeConfig?.onSetupCallback ? themeConfig?.onSetupCallback({}) : {}
86
- }
87
-
88
- const currentTheme = await getThemeConfigData(themeConfig)
89
-
90
- appendGlobalCssVariables(
91
- {
92
- ...overrideElementTheme(currentTheme),
93
- ...globalVariables
94
- },
95
- appendTo
96
- )
97
-
98
- if (themeConfig?.onSetupCallback) {
99
- themeConfig.onSetupCallback(currentTheme)
100
- }
101
- }
1
+ import { themesType, themeType, UIThemeConfig } from './theme.types' // Must be relative as doing publish
2
+ import __themes from './themes.json' // Must be relative as doing publish
3
+ import { overrideElementTheme as _overrideElementTheme, globalVariables } from './themeMerge'
4
+
5
+ const _default: themeType = __themes.redGreen
6
+
7
+ const themes: themesType = __themes
8
+
9
+ // Re-exported for back-compat with consumers that imported it directly.
10
+ // The implementation lives in `themeMerge.ts` so the build-time codegen
11
+ // can reuse it without dragging in browser-globals from the rest of this
12
+ // module.
13
+ export const overrideElementTheme = _overrideElementTheme
14
+
15
+ export function appendGlobalCssVariables (cssData: { [key: string]: string }, appendTo: HTMLElement) {
16
+ Object.entries(cssData).forEach(([ variableName, variableValue ]) => {
17
+ appendTo.style.setProperty(`--${variableName}`, variableValue)
18
+ })
19
+ }
20
+
21
+ export async function getThemeConfigData (themeConfig?: UIThemeConfig) {
22
+ let currentTheme = _default
23
+
24
+ if (themeConfig) {
25
+
26
+ if (themeConfig.type === 'local') {
27
+ if (themes[themeConfig.themeName]) {
28
+ currentTheme = themes[themeConfig.themeName]
29
+ } else {
30
+ console.warn(`[VoicenterUI-plus] No such theme: ${themeConfig.themeName}`)
31
+ }
32
+ }
33
+
34
+ if (themeConfig.type === 'remote') {
35
+ let body = JSON.stringify(
36
+ {
37
+ SectionList: [
38
+ themeConfig.brandingSectionName
39
+ ],
40
+ Domain: window.location.hostname
41
+ }
42
+ )
43
+
44
+ if (themeConfig.payloadData) {
45
+ body = JSON.stringify(themeConfig.payloadData)
46
+ }
47
+
48
+ const apiStyling = await fetch(themeConfig.apiUrl, {
49
+ method: 'POST',
50
+ cache: 'no-cache',
51
+ headers: {
52
+ 'Content-Type': 'application/json'
53
+ },
54
+ referrerPolicy: 'no-referrer',
55
+ body
56
+ })
57
+ .then(res => res.json())
58
+ .then(res => res.Data)
59
+ .then(res => {
60
+ return Object.fromEntries(Object.entries(res).map(([ key, value ]) => {
61
+ return [
62
+ key.replace(`${themeConfig.brandingSectionName}.`, ''),
63
+ String(value)
64
+ ]
65
+ }))
66
+ })
67
+ .catch(e => console.error(e))
68
+
69
+ if (apiStyling) {
70
+ currentTheme = apiStyling
71
+ }
72
+ }
73
+
74
+ if (themeConfig.type === 'customJson') {
75
+ currentTheme = themeConfig.config ?? {}
76
+ }
77
+ }
78
+
79
+ return currentTheme
80
+ }
81
+
82
+ export default async function (themeConfig?: UIThemeConfig, appendTo: HTMLElement = document.documentElement) {
83
+
84
+ if (themeConfig?.type === 'none') {
85
+ return themeConfig?.onSetupCallback ? themeConfig?.onSetupCallback({}) : {}
86
+ }
87
+
88
+ const currentTheme = await getThemeConfigData(themeConfig)
89
+
90
+ appendGlobalCssVariables(
91
+ {
92
+ ...overrideElementTheme(currentTheme),
93
+ ...globalVariables
94
+ },
95
+ appendTo
96
+ )
97
+
98
+ if (themeConfig?.onSetupCallback) {
99
+ themeConfig.onSetupCallback(currentTheme)
100
+ }
101
+ }
@@ -1,37 +1,37 @@
1
- const _themes = require('./themes.json')
2
- const schemeColors = {}
3
- const _default = _themes.blue
4
-
5
- const additionalColors = [
6
- 'primary-actions',
7
- 'primary-alternative-actions',
8
- 'secondary-actions',
9
- 'destructive-actions',
10
- 'error-actions',
11
- 'success-actions',
12
- 'warning-actions',
13
- 'active-elements',
14
- 'inactive-elements'
15
- ]
16
- const postfixes = [
17
- '--focus',
18
- '--pressed',
19
- '-bg--focus',
20
- '-bg--pressed'
21
- ]
22
-
23
- Object.keys(_default).forEach(variableName => {
24
- schemeColors[variableName] = `var(--${variableName})`
25
- })
26
-
27
- additionalColors.forEach(colorName => {
28
- if (!colorName.endsWith('elements')) {
29
- schemeColors[colorName] = `var(--${colorName})`
30
- }
31
- postfixes.forEach(ends => {
32
- const _key = colorName + ends
33
- schemeColors[_key] = `var(--${_key})`
34
- })
35
- })
36
-
37
- module.exports = schemeColors
1
+ const _themes = require('./themes.json')
2
+ const schemeColors = {}
3
+ const _default = _themes.blue
4
+
5
+ const additionalColors = [
6
+ 'primary-actions',
7
+ 'primary-alternative-actions',
8
+ 'secondary-actions',
9
+ 'destructive-actions',
10
+ 'error-actions',
11
+ 'success-actions',
12
+ 'warning-actions',
13
+ 'active-elements',
14
+ 'inactive-elements'
15
+ ]
16
+ const postfixes = [
17
+ '--focus',
18
+ '--pressed',
19
+ '-bg--focus',
20
+ '-bg--pressed'
21
+ ]
22
+
23
+ Object.keys(_default).forEach(variableName => {
24
+ schemeColors[variableName] = `var(--${variableName})`
25
+ })
26
+
27
+ additionalColors.forEach(colorName => {
28
+ if (!colorName.endsWith('elements')) {
29
+ schemeColors[colorName] = `var(--${colorName})`
30
+ }
31
+ postfixes.forEach(ends => {
32
+ const _key = colorName + ends
33
+ schemeColors[_key] = `var(--${_key})`
34
+ })
35
+ })
36
+
37
+ module.exports = schemeColors