@voicenter-team/voicenter-ui-plus 4.0.0-beta.2 → 4.0.0-beta.3
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/MIGRATION_v3.md +196 -0
- package/README.md +7 -6
- package/library/assets/assets/sass/main.css +1 -1
- package/library/assets/components/VcSoundplayer/VcSoundPlayerCompact.css +1 -0
- package/library/assets/components/VcSoundplayer/VcSoundVolume.css +1 -1
- package/library/components/VcSoundplayer/VcPlayerPlayStopButton.vue.mjs +2 -1
- package/library/components/VcSoundplayer/VcSoundPlayer.vue.mjs +2 -8
- package/library/components/VcSoundplayer/VcSoundPlayerCompact.vue.mjs +197 -0
- package/library/components/VcSoundplayer/VcSoundPlayerCompact.vue3.mjs +5 -0
- package/library/components/VcSoundplayer/VcSoundPlayerWrapper.vue.mjs +2 -1
- package/library/components/VcSoundplayer/player.options.mjs +8 -0
- package/library/index.mjs +59 -56
- package/library/index.mjs.br +0 -0
- package/library/index.mjs.gz +0 -0
- package/library/plugin-components.gen.mjs +91 -88
- package/library/plugin.mjs +59 -56
- package/library/plugin.mjs.br +0 -0
- package/library/plugin.mjs.gz +0 -0
- package/library/style.css +4 -2
- package/library/style.css.br +0 -0
- package/library/style.css.gz +0 -0
- package/library/types/components/VcSoundplayer/VcPlayerPlayStopButton.vue.d.ts +11 -0
- package/library/types/components/VcSoundplayer/VcSoundPlayerCompact.vue.d.ts +75 -0
- package/library/types/components/VcSoundplayer/VcSoundPlayerWrapper.vue.d.ts +2 -0
- package/library/types/components/VcSoundplayer/player.options.d.ts +2 -0
- package/library/types/components/exports.d.ts +3 -1
- package/library/types/components.gen.d.ts +1 -0
- package/package.json +2 -1
- package/src/theme/index.ts +101 -101
- package/src/theme/theme.types.ts +31 -31
- package/tailwind.config.d.ts +5 -5
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
|
+
}
|
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/tailwind.config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Config } from 'tailwindcss'
|
|
2
|
-
|
|
3
|
-
declare const config: Config
|
|
4
|
-
|
|
5
|
-
export default config
|
|
1
|
+
import { Config } from 'tailwindcss'
|
|
2
|
+
|
|
3
|
+
declare const config: Config
|
|
4
|
+
|
|
5
|
+
export default config
|