@voicenter-team/voicenter-ui-plus 3.4.4 → 3.4.5

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 (151) hide show
  1. package/README.md +502 -502
  2. package/library/assets/assets/sass/main.css +1 -1
  3. package/library/assets/components/VcAvatar/VcAvatar.css +1 -0
  4. package/library/assets/components/VcBadgeTag/VcBadgeTag.css +1 -0
  5. package/library/assets/components/VcChatComposer/VcChatComposer.css +1 -0
  6. package/library/assets/components/VcEmojiPicker/VcEmojiPicker.css +1 -0
  7. package/library/assets/components/VcFileUploader/VcFileItem.css +1 -0
  8. package/library/assets/components/VcFileUploader/VcFileUploaderArea.css +1 -1
  9. package/library/assets/components/VcFileUploader/VcFileUploaderSimple.css +1 -1
  10. package/library/assets/components/VcJsonSchema/Components/JsonSchemaEditor.css +1 -1
  11. package/library/assets/components/VcLoading/Loaders/Circles.css +1 -1
  12. package/library/assets/components/VcLoading/Loaders/DotSpinner.css +1 -1
  13. package/library/assets/components/VcLoading/Loaders/LdsSpinner.css +1 -1
  14. package/library/assets/components/VcLoading/Loaders/LoadIcon.css +1 -1
  15. package/library/assets/components/VcLoading/Loaders/Stretch.css +1 -1
  16. package/library/assets/components/VcLoading/VcLoading.css +1 -1
  17. package/library/assets/components/VcMdEditor/ParameterNode.css +1 -1
  18. package/library/assets/components/VcMessage/VcMessage.css +1 -0
  19. package/library/assets/components/VcMessage/content/VcMessageAudioBlock.css +1 -0
  20. package/library/assets/components/VcMessage/content/VcMessageFileBlock.css +1 -0
  21. package/library/assets/components/VcMessage/content/VcMessageImageBlock.css +1 -0
  22. package/library/assets/components/VcMessage/content/VcMessageTextBlock.css +1 -0
  23. package/library/assets/components/VcMessage/reactions/VcMessageEmojiPicker.css +1 -0
  24. package/library/assets/components/VcMessage/reactions/VcMessageReactionBar.css +1 -0
  25. package/library/assets/components/VcMessagesWrapper/VcMessagesWrapper.css +1 -0
  26. package/library/assets/components/VcSkeletonLoader/Loaders/Card.css +1 -1
  27. package/library/assets/components/VcSkeletonLoader/Loaders/Circle.css +1 -1
  28. package/library/assets/components/VcSkeletonLoader/Loaders/Row.css +1 -1
  29. package/library/assets/components/VcSkeletonLoader/Loaders/Square.css +1 -1
  30. package/library/assets/components/VcSkeletonLoader/Loaders/Text.css +1 -1
  31. package/library/components/VcAvatar/VcAvatar.vue.mjs +62 -0
  32. package/library/components/VcAvatar/VcAvatar.vue3.mjs +5 -0
  33. package/library/components/VcBadgeTag/VcBadgeTag.vue.mjs +31 -0
  34. package/library/components/VcBadgeTag/VcBadgeTag.vue3.mjs +5 -0
  35. package/library/components/VcChatComposer/VcChatComposer.vue.mjs +554 -0
  36. package/library/components/VcChatComposer/VcChatComposer.vue3.mjs +5 -0
  37. package/library/components/VcChatComposer/richText.mjs +320 -0
  38. package/library/components/VcEmojiPicker/VcEmojiPicker.vue.mjs +387 -0
  39. package/library/components/VcEmojiPicker/VcEmojiPicker.vue3.mjs +5 -0
  40. package/library/components/VcEmojiPicker/emojiData.mjs +26 -0
  41. package/library/components/VcFileUploader/VcFileItem.vue.mjs +146 -0
  42. package/library/components/VcFileUploader/VcFileItem.vue3.mjs +5 -0
  43. package/library/components/VcFileUploader/VcFileUploaderArea.vue.mjs +24 -147
  44. package/library/components/VcFileUploader/VcFileUploaderSimple.vue.mjs +1 -1
  45. package/library/components/VcJsonSchema/Components/JsonSchemaEditor.vue.mjs +1 -1
  46. package/library/components/VcLoading/Loaders/Circles.vue.mjs +1 -1
  47. package/library/components/VcLoading/Loaders/DotSpinner.vue.mjs +1 -1
  48. package/library/components/VcLoading/Loaders/DotSpinner.vue2.mjs +2 -2
  49. package/library/components/VcLoading/Loaders/LdsSpinner.vue.mjs +1 -1
  50. package/library/components/VcLoading/Loaders/LoadIcon.vue.mjs +1 -1
  51. package/library/components/VcLoading/Loaders/Stretch.vue.mjs +1 -1
  52. package/library/components/VcLoading/Loaders/Stretch.vue2.mjs +1 -1
  53. package/library/components/VcLoading/VcLoading.vue.mjs +1 -1
  54. package/library/components/VcMdEditor/ParameterNode.vue.mjs +1 -1
  55. package/library/components/VcMessage/VcMessage.vue.mjs +212 -0
  56. package/library/components/VcMessage/VcMessage.vue3.mjs +5 -0
  57. package/library/components/VcMessage/content/VcMessageAudioBlock.vue.mjs +53 -0
  58. package/library/components/VcMessage/content/VcMessageAudioBlock.vue3.mjs +5 -0
  59. package/library/components/VcMessage/content/VcMessageFileBlock.vue.mjs +80 -0
  60. package/library/components/VcMessage/content/VcMessageFileBlock.vue3.mjs +5 -0
  61. package/library/components/VcMessage/content/VcMessageImageBlock.vue.mjs +57 -0
  62. package/library/components/VcMessage/content/VcMessageImageBlock.vue3.mjs +5 -0
  63. package/library/components/VcMessage/content/VcMessageTextBlock.vue.mjs +19 -0
  64. package/library/components/VcMessage/content/VcMessageTextBlock.vue3.mjs +5 -0
  65. package/library/components/VcMessage/content/messageContentComponents.mjs +17 -0
  66. package/library/components/VcMessage/reactions/VcMessageEmojiPicker.vue.mjs +167 -0
  67. package/library/components/VcMessage/reactions/VcMessageEmojiPicker.vue3.mjs +5 -0
  68. package/library/components/VcMessage/reactions/VcMessageReactionBar.vue.mjs +82 -0
  69. package/library/components/VcMessage/reactions/VcMessageReactionBar.vue3.mjs +5 -0
  70. package/library/components/VcMessage/reactions/emojis.mjs +4 -0
  71. package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue.mjs +243 -0
  72. package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue3.mjs +5 -0
  73. package/library/components/VcSkeletonLoader/Loaders/Card.vue.mjs +1 -1
  74. package/library/components/VcSkeletonLoader/Loaders/Circle.vue.mjs +1 -1
  75. package/library/components/VcSkeletonLoader/Loaders/Row.vue.mjs +1 -1
  76. package/library/components/VcSkeletonLoader/Loaders/Square.vue.mjs +1 -1
  77. package/library/components/VcSkeletonLoader/Loaders/Text.vue.mjs +1 -1
  78. package/library/components/VcSoundplayer/useSoundPlayerProvideInject.mjs +1 -1
  79. package/library/composables/useAudioRecorder.mjs +120 -0
  80. package/library/enum/fileTypes.mjs +51 -0
  81. package/library/index.mjs +237 -216
  82. package/library/index.mjs.br +0 -0
  83. package/library/index.mjs.gz +0 -0
  84. package/library/localization/index.mjs.gz +0 -0
  85. package/library/localization/locales/en.json.mjs +24 -1
  86. package/library/plugin-components.gen.mjs +171 -150
  87. package/library/plugin.mjs +235 -214
  88. package/library/plugin.mjs.br +0 -0
  89. package/library/plugin.mjs.gz +0 -0
  90. package/library/style.css +42 -16
  91. package/library/style.css.br +0 -0
  92. package/library/style.css.gz +0 -0
  93. package/library/theme/index.mjs.gz +0 -0
  94. package/library/types/components/VcAvatar/VcAvatar.vue.d.ts +47 -0
  95. package/library/types/components/VcBadgeTag/VcBadgeTag.vue.d.ts +42 -0
  96. package/library/types/components/VcChatComposer/VcChatComposer.vue.d.ts +81 -0
  97. package/library/types/components/VcChatComposer/richText.d.ts +12 -0
  98. package/library/types/components/VcCollapse/VcCollapseItem.vue.d.ts +1 -1
  99. package/library/types/components/VcEmojiPicker/VcEmojiPicker.vue.d.ts +63 -0
  100. package/library/types/components/VcEmojiPicker/emojiData.d.ts +16 -0
  101. package/library/types/components/VcExcelUploader/VcExcelFileUploadBlock.vue.d.ts +1 -1
  102. package/library/types/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.vue.d.ts +2 -2
  103. package/library/types/components/VcFileUploader/VcFileItem.vue.d.ts +85 -0
  104. package/library/types/components/VcFileUploader/VcFileUploader.vue.d.ts +3 -3
  105. package/library/types/components/VcFileUploader/VcFileUploaderArea.vue.d.ts +17 -18
  106. package/library/types/components/VcFileUploader/VcFileUploaderSimple.vue.d.ts +3 -3
  107. package/library/types/components/VcForm/VcForm.vue.d.ts +1 -1
  108. package/library/types/components/VcMessage/VcMessage.vue.d.ts +66 -0
  109. package/library/types/components/VcMessage/content/VcMessageAudioBlock.vue.d.ts +24 -0
  110. package/library/types/components/VcMessage/content/VcMessageFileBlock.vue.d.ts +24 -0
  111. package/library/types/components/VcMessage/content/VcMessageImageBlock.vue.d.ts +28 -0
  112. package/library/types/components/VcMessage/content/VcMessageTextBlock.vue.d.ts +24 -0
  113. package/library/types/components/VcMessage/content/messageContentComponents.d.ts +3 -0
  114. package/library/types/components/VcMessage/reactions/VcMessageEmojiPicker.vue.d.ts +68 -0
  115. package/library/types/components/VcMessage/reactions/VcMessageReactionBar.vue.d.ts +28 -0
  116. package/library/types/components/VcMessage/reactions/emojis.d.ts +1 -0
  117. package/library/types/components/VcMessagesWrapper/VcMessagesWrapper.vue.d.ts +71 -0
  118. package/library/types/components/VcProgress/VcProgress.vue.d.ts +1 -1
  119. package/library/types/components/VcRadioGroup/VcRadioGroup.vue.d.ts +3 -3
  120. package/library/types/components/VcSelect/VcInfiniteScrollSelect.vue.d.ts +6 -6
  121. package/library/types/components/VcSelect/VcSelect.vue.d.ts +6 -6
  122. package/library/types/components/VcSelect/VcSelectGrouped.vue.d.ts +6 -6
  123. package/library/types/components/VcSelect/VcSelectOption.vue.d.ts +3 -3
  124. package/library/types/components/VcTree/VcTree.vue.d.ts +6 -6
  125. package/library/types/components/VcTree/VcTreeSelect.vue.d.ts +3 -3
  126. package/library/types/components/VcWizard/VcSummaryStep.vue.d.ts +1 -1
  127. package/library/types/components/VcWizard/VcWizardSummary.vue.d.ts +1 -1
  128. package/library/types/components/exports.d.ts +15 -1
  129. package/library/types/components.gen.d.ts +7 -0
  130. package/library/types/composables/useAudioRecorder.d.ts +18 -0
  131. package/library/types/entity/components/Button/VcEntityDeleteIconButton.vue.d.ts +3 -3
  132. package/library/types/enum/fileTypes.d.ts +3 -0
  133. package/library/types/localization/locales/en.json.d.ts +187 -164
  134. package/library/types/theme/themes.json.d.ts +227 -227
  135. package/library/types/types/VcAvatar.types.d.ts +35 -0
  136. package/library/types/types/VcBadgeTag.types.d.ts +19 -0
  137. package/library/types/types/VcChatComposer.types.d.ts +112 -0
  138. package/library/types/types/VcEmojiPicker.types.d.ts +20 -0
  139. package/library/types/types/VcFileUploader.types.d.ts +4 -0
  140. package/library/types/types/VcMessage.types.d.ts +131 -0
  141. package/library/types/types/VcMessagesWrapper.types.d.ts +61 -0
  142. package/library/types/types/index.d.ts +6 -0
  143. package/library/utils/jsonSchema/index.mjs.gz +0 -0
  144. package/package.json +215 -185
  145. package/src/theme/index.ts +101 -101
  146. package/src/theme/tailwindScheme.js +37 -37
  147. package/src/theme/theme.types.ts +31 -31
  148. package/src/theme/themeMerge.ts +40 -40
  149. package/src/theme/themes.json +227 -227
  150. package/tailwind.config.d.ts +5 -5
  151. package/tailwind.config.js +192 -192
@@ -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
@@ -1,31 +1,31 @@
1
- export type themeType = {
2
- [key: string]: string
3
- }
4
- export type themesType = {
5
- [key: string]: themeType
6
- }
7
- export type UIThemeBaseConfig = {
8
- type: string
9
- onSetupCallback?: (loadedTheme: themeType) => void
10
- }
11
- export type UIThemeLocalConfig = UIThemeBaseConfig & {
12
- type: 'local'
13
- themeName: string
14
- }
15
- export type UIThemeRemoteConfig = UIThemeBaseConfig & {
16
- type: 'remote'
17
- brandingSectionName?: string
18
- payloadData?: Record<string, unknown>
19
- apiUrl: string
20
- }
21
-
22
- export type UIThemeCustomObjectJsonConfig = UIThemeBaseConfig & {
23
- type: 'customJson',
24
- config: themeType
25
- }
26
-
27
- export type UiThemeNoneConfig = UIThemeBaseConfig & {
28
- type: 'none'
29
- }
30
-
31
- export declare type UIThemeConfig = UIThemeLocalConfig | UIThemeRemoteConfig | UIThemeCustomObjectJsonConfig | UiThemeNoneConfig
1
+ export type themeType = {
2
+ [key: string]: string
3
+ }
4
+ export type themesType = {
5
+ [key: string]: themeType
6
+ }
7
+ export type UIThemeBaseConfig = {
8
+ type: string
9
+ onSetupCallback?: (loadedTheme: themeType) => void
10
+ }
11
+ export type UIThemeLocalConfig = UIThemeBaseConfig & {
12
+ type: 'local'
13
+ themeName: string
14
+ }
15
+ export type UIThemeRemoteConfig = UIThemeBaseConfig & {
16
+ type: 'remote'
17
+ brandingSectionName?: string
18
+ payloadData?: Record<string, unknown>
19
+ apiUrl: string
20
+ }
21
+
22
+ export type UIThemeCustomObjectJsonConfig = UIThemeBaseConfig & {
23
+ type: 'customJson',
24
+ config: themeType
25
+ }
26
+
27
+ export type UiThemeNoneConfig = UIThemeBaseConfig & {
28
+ type: 'none'
29
+ }
30
+
31
+ export declare type UIThemeConfig = UIThemeLocalConfig | UIThemeRemoteConfig | UIThemeCustomObjectJsonConfig | UiThemeNoneConfig
@@ -1,40 +1,40 @@
1
- // Pure helpers shared by the runtime theme installer (theme/index.ts) and
2
- // the build-time codegen (vite.config.ts). Single source of truth for the
3
- // element-plus override map and the global variable constants — neither
4
- // place hardcodes variable names.
5
-
6
- export const globalVariables: Record<string, string> = {
7
- 'input-font-size': '0.875rem',
8
- 'input-font-weight': '500',
9
- 'select-option-height': '2rem',
10
- 'base-border-radius': '0.25rem'
11
- }
12
-
13
- export function overrideElementTheme (theme: Record<string, string>): Record<string, string> {
14
- return {
15
- ...theme,
16
- 'el-color-primary': theme['el-color-primary'] ?? theme.primary,
17
- 'el-color-success': theme['el-color-success'] ?? theme.success,
18
- 'el-color-warning': theme['el-color-warning'] ?? theme.warning,
19
- 'el-color-danger': theme['el-color-danger'] ?? theme.error,
20
- 'el-color-error': theme['el-color-error'] ?? theme.error,
21
- 'el-color-info': theme['el-color-info'] ?? theme['secondary'],
22
- 'el-fill-color': theme['el-fill-color'] ?? theme['field-bg'],
23
- 'el-text-color-primary': theme['el-text-color-primary'] ?? theme['default-text'],
24
- 'el-text-color-regular': theme['el-text-color-regular'] ?? theme['default-text'],
25
- 'el-text-color-placeholder': theme['el-text-color-placeholder'] ?? theme.placeholders,
26
- 'el-disabled-text-color': theme['el-disabled-text-color'] ?? theme['inactive-text'],
27
- 'el-text-color-disabled': theme['el-text-color-disabled'] ?? theme['inactive-text'],
28
- transparent: 'transparent',
29
- white: '#FFFFFF',
30
- black: '#000000',
31
- current: 'currentColor'
32
- }
33
- }
34
-
35
- export function mergeThemeWithDefaults (theme: Record<string, string>): Record<string, string> {
36
- return {
37
- ...overrideElementTheme(theme),
38
- ...globalVariables
39
- }
40
- }
1
+ // Pure helpers shared by the runtime theme installer (theme/index.ts) and
2
+ // the build-time codegen (vite.config.ts). Single source of truth for the
3
+ // element-plus override map and the global variable constants — neither
4
+ // place hardcodes variable names.
5
+
6
+ export const globalVariables: Record<string, string> = {
7
+ 'input-font-size': '0.875rem',
8
+ 'input-font-weight': '500',
9
+ 'select-option-height': '2rem',
10
+ 'base-border-radius': '0.25rem'
11
+ }
12
+
13
+ export function overrideElementTheme (theme: Record<string, string>): Record<string, string> {
14
+ return {
15
+ ...theme,
16
+ 'el-color-primary': theme['el-color-primary'] ?? theme.primary,
17
+ 'el-color-success': theme['el-color-success'] ?? theme.success,
18
+ 'el-color-warning': theme['el-color-warning'] ?? theme.warning,
19
+ 'el-color-danger': theme['el-color-danger'] ?? theme.error,
20
+ 'el-color-error': theme['el-color-error'] ?? theme.error,
21
+ 'el-color-info': theme['el-color-info'] ?? theme['secondary'],
22
+ 'el-fill-color': theme['el-fill-color'] ?? theme['field-bg'],
23
+ 'el-text-color-primary': theme['el-text-color-primary'] ?? theme['default-text'],
24
+ 'el-text-color-regular': theme['el-text-color-regular'] ?? theme['default-text'],
25
+ 'el-text-color-placeholder': theme['el-text-color-placeholder'] ?? theme.placeholders,
26
+ 'el-disabled-text-color': theme['el-disabled-text-color'] ?? theme['inactive-text'],
27
+ 'el-text-color-disabled': theme['el-text-color-disabled'] ?? theme['inactive-text'],
28
+ transparent: 'transparent',
29
+ white: '#FFFFFF',
30
+ black: '#000000',
31
+ current: 'currentColor'
32
+ }
33
+ }
34
+
35
+ export function mergeThemeWithDefaults (theme: Record<string, string>): Record<string, string> {
36
+ return {
37
+ ...overrideElementTheme(theme),
38
+ ...globalVariables
39
+ }
40
+ }