@voicenter-team/voicenter-ui-plus 3.4.4 → 3.4.6
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.
- package/README.md +502 -502
- package/library/assets/assets/sass/main.css +1 -1
- package/library/assets/components/VcAvatar/VcAvatar.css +1 -0
- package/library/assets/components/VcBadgeTag/VcBadgeTag.css +1 -0
- package/library/assets/components/VcChatComposer/VcChatComposer.css +1 -0
- package/library/assets/components/VcEmojiPicker/VcEmojiPicker.css +1 -0
- package/library/assets/components/VcFileUploader/VcFileItem.css +1 -0
- package/library/assets/components/VcFileUploader/VcFileUploaderArea.css +1 -1
- package/library/assets/components/VcFileUploader/VcFileUploaderSimple.css +1 -1
- package/library/assets/components/VcJsonSchema/Components/JsonSchemaEditor.css +1 -1
- package/library/assets/components/VcLoading/Loaders/Circles.css +1 -1
- package/library/assets/components/VcLoading/Loaders/DotSpinner.css +1 -1
- package/library/assets/components/VcLoading/Loaders/LdsSpinner.css +1 -1
- package/library/assets/components/VcLoading/Loaders/LoadIcon.css +1 -1
- package/library/assets/components/VcLoading/Loaders/Stretch.css +1 -1
- package/library/assets/components/VcLoading/VcLoading.css +1 -1
- package/library/assets/components/VcMdEditor/ParameterNode.css +1 -1
- package/library/assets/components/VcMessage/VcMessage.css +1 -0
- package/library/assets/components/VcMessage/content/VcMessageAudioBlock.css +1 -0
- package/library/assets/components/VcMessage/content/VcMessageFileBlock.css +1 -0
- package/library/assets/components/VcMessage/content/VcMessageImageBlock.css +1 -0
- package/library/assets/components/VcMessage/content/VcMessageTextBlock.css +1 -0
- package/library/assets/components/VcMessage/reactions/VcMessageEmojiPicker.css +1 -0
- package/library/assets/components/VcMessage/reactions/VcMessageReactionBar.css +1 -0
- package/library/assets/components/VcMessagesWrapper/VcMessagesWrapper.css +1 -0
- package/library/assets/components/VcSkeletonLoader/Loaders/Card.css +1 -1
- package/library/assets/components/VcSkeletonLoader/Loaders/Circle.css +1 -1
- package/library/assets/components/VcSkeletonLoader/Loaders/Row.css +1 -1
- package/library/assets/components/VcSkeletonLoader/Loaders/Square.css +1 -1
- package/library/assets/components/VcSkeletonLoader/Loaders/Text.css +1 -1
- package/library/components/VcAvatar/VcAvatar.vue.mjs +62 -0
- package/library/components/VcAvatar/VcAvatar.vue3.mjs +5 -0
- package/library/components/VcBadgeTag/VcBadgeTag.vue.mjs +31 -0
- package/library/components/VcBadgeTag/VcBadgeTag.vue3.mjs +5 -0
- package/library/components/VcChatComposer/VcChatComposer.vue.mjs +554 -0
- package/library/components/VcChatComposer/VcChatComposer.vue3.mjs +5 -0
- package/library/components/VcChatComposer/richText.mjs +320 -0
- package/library/components/VcEmojiPicker/VcEmojiPicker.vue.mjs +387 -0
- package/library/components/VcEmojiPicker/VcEmojiPicker.vue3.mjs +5 -0
- package/library/components/VcEmojiPicker/emojiData.mjs +26 -0
- package/library/components/VcFileUploader/VcFileItem.vue.mjs +146 -0
- package/library/components/VcFileUploader/VcFileItem.vue3.mjs +5 -0
- package/library/components/VcFileUploader/VcFileUploaderArea.vue.mjs +24 -147
- package/library/components/VcFileUploader/VcFileUploaderSimple.vue.mjs +1 -1
- package/library/components/VcJsonSchema/Components/JsonSchemaEditor.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/Circles.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/DotSpinner.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/DotSpinner.vue2.mjs +2 -2
- package/library/components/VcLoading/Loaders/LdsSpinner.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/LoadIcon.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/Stretch.vue.mjs +1 -1
- package/library/components/VcLoading/Loaders/Stretch.vue2.mjs +1 -1
- package/library/components/VcLoading/VcLoading.vue.mjs +1 -1
- package/library/components/VcMdEditor/ParameterNode.vue.mjs +1 -1
- package/library/components/VcMessage/VcMessage.vue.mjs +212 -0
- package/library/components/VcMessage/VcMessage.vue3.mjs +5 -0
- package/library/components/VcMessage/content/VcMessageAudioBlock.vue.mjs +53 -0
- package/library/components/VcMessage/content/VcMessageAudioBlock.vue3.mjs +5 -0
- package/library/components/VcMessage/content/VcMessageFileBlock.vue.mjs +80 -0
- package/library/components/VcMessage/content/VcMessageFileBlock.vue3.mjs +5 -0
- package/library/components/VcMessage/content/VcMessageImageBlock.vue.mjs +57 -0
- package/library/components/VcMessage/content/VcMessageImageBlock.vue3.mjs +5 -0
- package/library/components/VcMessage/content/VcMessageTextBlock.vue.mjs +19 -0
- package/library/components/VcMessage/content/VcMessageTextBlock.vue3.mjs +5 -0
- package/library/components/VcMessage/content/messageContentComponents.mjs +17 -0
- package/library/components/VcMessage/reactions/VcMessageEmojiPicker.vue.mjs +167 -0
- package/library/components/VcMessage/reactions/VcMessageEmojiPicker.vue3.mjs +5 -0
- package/library/components/VcMessage/reactions/VcMessageReactionBar.vue.mjs +82 -0
- package/library/components/VcMessage/reactions/VcMessageReactionBar.vue3.mjs +5 -0
- package/library/components/VcMessage/reactions/emojis.mjs +4 -0
- package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue.mjs +243 -0
- package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue3.mjs +5 -0
- package/library/components/VcSkeletonLoader/Loaders/Card.vue.mjs +1 -1
- package/library/components/VcSkeletonLoader/Loaders/Circle.vue.mjs +1 -1
- package/library/components/VcSkeletonLoader/Loaders/Row.vue.mjs +1 -1
- package/library/components/VcSkeletonLoader/Loaders/Square.vue.mjs +1 -1
- package/library/components/VcSkeletonLoader/Loaders/Text.vue.mjs +1 -1
- package/library/components/VcSoundplayer/useSoundPlayerProvideInject.mjs +1 -1
- package/library/composables/useAudioRecorder.mjs +120 -0
- package/library/enum/fileTypes.mjs +51 -0
- package/library/index.mjs +237 -216
- package/library/index.mjs.br +0 -0
- package/library/index.mjs.gz +0 -0
- package/library/localization/index.mjs.gz +0 -0
- package/library/localization/locales/en.json.mjs +24 -1
- package/library/plugin-components.gen.mjs +171 -150
- package/library/plugin.mjs +235 -214
- package/library/plugin.mjs.br +0 -0
- package/library/plugin.mjs.gz +0 -0
- package/library/style.css +42 -16
- package/library/style.css.br +0 -0
- package/library/style.css.gz +0 -0
- package/library/theme/index.mjs.gz +0 -0
- package/library/types/components/VcAvatar/VcAvatar.vue.d.ts +47 -0
- package/library/types/components/VcBadgeTag/VcBadgeTag.vue.d.ts +42 -0
- package/library/types/components/VcChatComposer/VcChatComposer.vue.d.ts +81 -0
- package/library/types/components/VcChatComposer/richText.d.ts +12 -0
- package/library/types/components/VcCollapse/VcCollapseItem.vue.d.ts +1 -1
- package/library/types/components/VcEmojiPicker/VcEmojiPicker.vue.d.ts +63 -0
- package/library/types/components/VcEmojiPicker/emojiData.d.ts +16 -0
- package/library/types/components/VcExcelUploader/VcExcelFileUploadBlock.vue.d.ts +1 -1
- package/library/types/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.vue.d.ts +2 -2
- package/library/types/components/VcFileUploader/VcFileItem.vue.d.ts +85 -0
- package/library/types/components/VcFileUploader/VcFileUploader.vue.d.ts +3 -3
- package/library/types/components/VcFileUploader/VcFileUploaderArea.vue.d.ts +17 -18
- package/library/types/components/VcFileUploader/VcFileUploaderSimple.vue.d.ts +3 -3
- package/library/types/components/VcForm/VcForm.vue.d.ts +1 -1
- package/library/types/components/VcMessage/VcMessage.vue.d.ts +66 -0
- package/library/types/components/VcMessage/content/VcMessageAudioBlock.vue.d.ts +24 -0
- package/library/types/components/VcMessage/content/VcMessageFileBlock.vue.d.ts +24 -0
- package/library/types/components/VcMessage/content/VcMessageImageBlock.vue.d.ts +28 -0
- package/library/types/components/VcMessage/content/VcMessageTextBlock.vue.d.ts +24 -0
- package/library/types/components/VcMessage/content/messageContentComponents.d.ts +3 -0
- package/library/types/components/VcMessage/reactions/VcMessageEmojiPicker.vue.d.ts +68 -0
- package/library/types/components/VcMessage/reactions/VcMessageReactionBar.vue.d.ts +28 -0
- package/library/types/components/VcMessage/reactions/emojis.d.ts +1 -0
- package/library/types/components/VcMessagesWrapper/VcMessagesWrapper.vue.d.ts +71 -0
- package/library/types/components/VcProgress/VcProgress.vue.d.ts +1 -1
- package/library/types/components/VcRadioGroup/VcRadioGroup.vue.d.ts +3 -3
- package/library/types/components/VcSelect/VcInfiniteScrollSelect.vue.d.ts +6 -6
- package/library/types/components/VcSelect/VcSelect.vue.d.ts +6 -6
- package/library/types/components/VcSelect/VcSelectGrouped.vue.d.ts +6 -6
- package/library/types/components/VcSelect/VcSelectOption.vue.d.ts +3 -3
- package/library/types/components/VcTree/VcTree.vue.d.ts +6 -6
- package/library/types/components/VcTree/VcTreeSelect.vue.d.ts +3 -3
- package/library/types/components/VcWizard/VcSummaryStep.vue.d.ts +1 -1
- package/library/types/components/VcWizard/VcWizardSummary.vue.d.ts +1 -1
- package/library/types/components/exports.d.ts +15 -1
- package/library/types/components.gen.d.ts +7 -0
- package/library/types/composables/useAudioRecorder.d.ts +18 -0
- package/library/types/entity/components/Button/VcEntityDeleteIconButton.vue.d.ts +3 -3
- package/library/types/enum/fileTypes.d.ts +3 -0
- package/library/types/localization/locales/en.json.d.ts +187 -164
- package/library/types/theme/themes.json.d.ts +227 -227
- package/library/types/types/VcAvatar.types.d.ts +35 -0
- package/library/types/types/VcBadgeTag.types.d.ts +19 -0
- package/library/types/types/VcChatComposer.types.d.ts +112 -0
- package/library/types/types/VcEmojiPicker.types.d.ts +20 -0
- package/library/types/types/VcFileUploader.types.d.ts +4 -0
- package/library/types/types/VcMessage.types.d.ts +131 -0
- package/library/types/types/VcMessagesWrapper.types.d.ts +61 -0
- package/library/types/types/index.d.ts +6 -0
- package/library/utils/jsonSchema/index.mjs.gz +0 -0
- package/package.json +215 -185
- package/src/theme/index.ts +101 -101
- package/src/theme/tailwindScheme.js +37 -37
- package/src/theme/theme.types.ts +31 -31
- package/src/theme/themeMerge.ts +40 -40
- package/src/theme/themes.json +227 -227
- package/tailwind.config.d.ts +5 -5
- package/tailwind.config.js +192 -192
package/src/theme/index.ts
CHANGED
|
@@ -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
|
package/src/theme/theme.types.ts
CHANGED
|
@@ -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
|
package/src/theme/themeMerge.ts
CHANGED
|
@@ -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
|
+
}
|