@vokril/ui-solid 0.25.0 → 0.27.0
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/CHANGELOG.md +20 -0
- package/README.md +17 -6
- package/dist/_internal/platform/settings/settingsTypes.d.cts +7 -0
- package/dist/_internal/platform/settings/settingsTypes.d.ts +7 -0
- package/dist/appThemeDerivation-Be_oKljl.cjs +1 -0
- package/dist/{appThemeDerivation-B7-DjMIM.js → appThemeDerivation-CKoSe4KP.js} +334 -252
- package/dist/fonts/manrope.css +10 -0
- package/dist/fonts.css +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +476 -472
- package/dist/server/appThemeDerivation-Be_oKljl.cjs +1 -0
- package/dist/server/{appThemeDerivation-B7-DjMIM.js → appThemeDerivation-CKoSe4KP.js} +334 -252
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +468 -464
- package/dist/server/tokens/index.cjs +1 -1
- package/dist/server/tokens/index.js +33 -29
- package/dist/solid/tokens/index.js +1 -1
- package/dist/solid/tokens/palette/palettes.js +62 -4
- package/dist/solid/tokens/palette/themeRegistry.js +30 -7
- package/dist/solid/tokens/theme.jsx +12 -5
- package/dist/style.css +583 -11
- package/dist/theme.css +582 -10
- package/dist/tokens/index.cjs +1 -1
- package/dist/tokens/index.d.cts +2 -2
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/index.js +33 -29
- package/dist/tokens/palette/palettes.d.cts +13 -13
- package/dist/tokens/palette/palettes.d.ts +13 -13
- package/dist/tokens/palette/themeRegistry.d.cts +27 -6
- package/dist/tokens/palette/themeRegistry.d.ts +27 -6
- package/dist/tokens/theme.d.cts +11 -8
- package/dist/tokens/theme.d.ts +11 -8
- package/dist/tokens/tokens.css +582 -10
- package/dist/ui.css +1 -1
- package/package.json +3 -2
- package/dist/appThemeDerivation-NS3Vws8q.cjs +0 -1
- package/dist/server/appThemeDerivation-NS3Vws8q.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../appThemeDerivation-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../appThemeDerivation-Be_oKljl.cjs");exports.DEFAULT_THEME_ID=e.DEFAULT_THEME_ID;exports.DESIGN_THEMES=e.DESIGN_THEMES;exports.INK_ROLE_KEYS=e.INK_ROLE_KEYS;exports.LEGACY_THEME_IDS=e.LEGACY_THEME_IDS;exports.MAX_TEXT_TINT_ALPHA=e.MAX_TEXT_TINT_ALPHA;exports.OKABE_ITO_DIFF=e.OKABE_ITO_DIFF;exports.TEXT_ROLE_KEYS=e.TEXT_ROLE_KEYS;exports.ThemeProvider=e.ThemeProvider;exports.UNIQUE_ACCENT=e.UNIQUE_ACCENT;exports.WELD_BG=e.WELD_BG;exports.WELD_SURFACE=e.WELD_SURFACE;exports.accessibleFillSurface=e.accessibleFillSurface;exports.accessibleInputBorder=e.accessibleInputBorder;exports.accessibleOnFillInk=e.accessibleOnFillInk;exports.accessibleTextColor=e.accessibleTextColor;exports.applyAppTheme=e.applyAppTheme;exports.derivePaletteProperties=e.derivePaletteProperties;exports.generateMonacoThemeFromPalette=e.generateMonacoThemeFromPalette;exports.generateTerminalPaletteFromPalette=e.generateTerminalPaletteFromPalette;exports.getDefaultThemeId=e.getDefaultThemeId;exports.getThemeById=e.getThemeById;exports.getThemeDesign=e.getThemeDesign;exports.getThemeOptions=e.getThemeOptions;exports.getThemes=e.getThemes;exports.isColorVisionSafeActive=e.isColorVisionSafeActive;exports.isKnownThemeId=e.isKnownThemeId;exports.readActiveAppPalette=e.readActiveAppPalette;exports.readActiveAppThemeId=e.readActiveAppThemeId;exports.readActiveAppThemeType=e.readActiveAppThemeType;exports.registerThemeSource=e.registerThemeSource;exports.resolveThemeOption=e.resolveThemeOption;exports.setThemeDesign=e.setThemeDesign;exports.textGroundsFor=e.textGroundsFor;exports.themeOptions=e.themeOptions;exports.toColorVisionSafePalette=e.toColorVisionSafePalette;exports.useTheme=e.useTheme;
|
|
@@ -1,35 +1,39 @@
|
|
|
1
|
-
import { D as
|
|
1
|
+
import { D as a, a as t, I as T, L as r, M as i, O as o, T as l, b as m, U as E, W as n, c as p, d as h, e as A, f as _, g as c, h as I, i as d, j as g, k as D, l as S, m as F, n as O, o as P, p as v, q as L, r as u, s as C, t as f, u as M, v as b, w as B, x as K, y as N, z as U, A as x, B as y } from "../appThemeDerivation-CKoSe4KP.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
t as
|
|
3
|
+
a as DEFAULT_THEME_ID,
|
|
4
|
+
t as DESIGN_THEMES,
|
|
5
|
+
T as INK_ROLE_KEYS,
|
|
5
6
|
r as LEGACY_THEME_IDS,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
i as MAX_TEXT_TINT_ALPHA,
|
|
8
|
+
o as OKABE_ITO_DIFF,
|
|
9
|
+
l as TEXT_ROLE_KEYS,
|
|
10
|
+
m as ThemeProvider,
|
|
11
|
+
E as UNIQUE_ACCENT,
|
|
12
|
+
n as WELD_BG,
|
|
13
|
+
p as WELD_SURFACE,
|
|
14
|
+
h as accessibleFillSurface,
|
|
15
|
+
A as accessibleInputBorder,
|
|
16
|
+
_ as accessibleOnFillInk,
|
|
17
|
+
c as accessibleTextColor,
|
|
18
|
+
I as applyAppTheme,
|
|
19
|
+
d as derivePaletteProperties,
|
|
20
|
+
g as generateMonacoThemeFromPalette,
|
|
21
|
+
D as generateTerminalPaletteFromPalette,
|
|
22
|
+
S as getDefaultThemeId,
|
|
23
|
+
F as getThemeById,
|
|
24
|
+
O as getThemeDesign,
|
|
22
25
|
P as getThemeOptions,
|
|
23
26
|
v as getThemes,
|
|
24
27
|
L as isColorVisionSafeActive,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
u as isKnownThemeId,
|
|
29
|
+
C as readActiveAppPalette,
|
|
30
|
+
f as readActiveAppThemeId,
|
|
31
|
+
M as readActiveAppThemeType,
|
|
32
|
+
b as registerThemeSource,
|
|
33
|
+
B as resolveThemeOption,
|
|
34
|
+
K as setThemeDesign,
|
|
35
|
+
N as textGroundsFor,
|
|
36
|
+
U as themeOptions,
|
|
37
|
+
x as toColorVisionSafePalette,
|
|
38
|
+
y as useTheme
|
|
35
39
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './theme';
|
|
2
2
|
export { themeOptions } from './palette/palettes';
|
|
3
|
-
export { DEFAULT_THEME_ID, LEGACY_THEME_IDS, getThemeById, getThemeOptions, isKnownThemeId, registerThemeSource, } from './palette/themeRegistry';
|
|
3
|
+
export { DEFAULT_THEME_ID, DESIGN_THEMES, LEGACY_THEME_IDS, getDefaultThemeId, getThemeById, getThemeDesign, getThemeOptions, isKnownThemeId, registerThemeSource, setThemeDesign, } from './palette/themeRegistry';
|
|
4
4
|
export { derivePaletteProperties } from './palette/paletteProperties';
|
|
5
5
|
export { toColorVisionSafePalette, isColorVisionSafeActive, OKABE_ITO_DIFF, } from './palette/colorVisionPalette';
|
|
6
6
|
export * from './palette/accessiblePalette';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export const themeOptions = [
|
|
2
2
|
{
|
|
3
|
-
id: '
|
|
4
|
-
label: '
|
|
3
|
+
id: 'viper-dark',
|
|
4
|
+
label: 'Viper Dark',
|
|
5
5
|
type: 'dark',
|
|
6
|
+
design: 'viper',
|
|
6
7
|
palette: {
|
|
7
8
|
surface: '#212329',
|
|
8
9
|
surfaceAlt: '#181A1F',
|
|
@@ -27,9 +28,10 @@ export const themeOptions = [
|
|
|
27
28
|
},
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
|
-
id: 'light',
|
|
31
|
-
label: '
|
|
31
|
+
id: 'viper-light',
|
|
32
|
+
label: 'Viper Light',
|
|
32
33
|
type: 'light',
|
|
34
|
+
design: 'viper',
|
|
33
35
|
palette: {
|
|
34
36
|
surface: '#FFFFFF',
|
|
35
37
|
surfaceAlt: '#F3F4F8',
|
|
@@ -53,6 +55,62 @@ export const themeOptions = [
|
|
|
53
55
|
syntaxComment: '#696D79',
|
|
54
56
|
},
|
|
55
57
|
},
|
|
58
|
+
{
|
|
59
|
+
id: 'vokril-dark',
|
|
60
|
+
label: 'Vokril Dark',
|
|
61
|
+
type: 'dark',
|
|
62
|
+
design: 'vokril',
|
|
63
|
+
palette: {
|
|
64
|
+
surface: '#121018',
|
|
65
|
+
surfaceAlt: '#1C1925',
|
|
66
|
+
surfaceElevated: '#121018',
|
|
67
|
+
brand: '#8C75F2',
|
|
68
|
+
brandHover: '#A593F6',
|
|
69
|
+
content: '#F0EDF7',
|
|
70
|
+
contentSecondary: '#A8A1B8',
|
|
71
|
+
border: '#2C2838',
|
|
72
|
+
input: '#1C1925',
|
|
73
|
+
inputBorder: '#2C2838',
|
|
74
|
+
success: '#4FB772',
|
|
75
|
+
error: '#FF8A80',
|
|
76
|
+
warning: '#F0A945',
|
|
77
|
+
info: '#55A8DB',
|
|
78
|
+
syntaxKeyword: '#BC97E8',
|
|
79
|
+
syntaxString: '#92C487',
|
|
80
|
+
syntaxFunction: '#F0C77C',
|
|
81
|
+
syntaxNumber: '#6FBCE3',
|
|
82
|
+
syntaxType: '#76CDC5',
|
|
83
|
+
syntaxComment: '#8F939F',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'vokril-light',
|
|
88
|
+
label: 'Vokril Light',
|
|
89
|
+
type: 'light',
|
|
90
|
+
design: 'vokril',
|
|
91
|
+
palette: {
|
|
92
|
+
surface: '#FFFFFF',
|
|
93
|
+
surfaceAlt: '#F3F1F7',
|
|
94
|
+
surfaceElevated: '#FFFFFF',
|
|
95
|
+
brand: '#593BD8',
|
|
96
|
+
brandHover: '#4227B4',
|
|
97
|
+
content: '#24212D',
|
|
98
|
+
contentSecondary: '#5E596B',
|
|
99
|
+
border: '#DEDBE5',
|
|
100
|
+
input: '#FFFFFF',
|
|
101
|
+
inputBorder: '#DEDBE5',
|
|
102
|
+
success: '#048A45',
|
|
103
|
+
error: '#B42318',
|
|
104
|
+
warning: '#C27400',
|
|
105
|
+
info: '#007AB0',
|
|
106
|
+
syntaxKeyword: '#7D3AB7',
|
|
107
|
+
syntaxString: '#357426',
|
|
108
|
+
syntaxFunction: '#895709',
|
|
109
|
+
syntaxNumber: '#006A9D',
|
|
110
|
+
syntaxType: '#007973',
|
|
111
|
+
syntaxComment: '#696D79',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
56
114
|
{
|
|
57
115
|
id: 'high-contrast-dark',
|
|
58
116
|
label: 'High Contrast Dark',
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import { themeOptions } from './palettes';
|
|
2
|
-
export const
|
|
3
|
-
|
|
2
|
+
export const DESIGN_THEMES = {
|
|
3
|
+
viper: { dark: 'viper-dark', light: 'viper-light' },
|
|
4
|
+
vokril: { dark: 'vokril-dark', light: 'vokril-light' },
|
|
5
|
+
};
|
|
6
|
+
export const DEFAULT_THEME_ID = 'viper-dark';
|
|
7
|
+
export const LEGACY_THEME_IDS = {
|
|
8
|
+
darcula: 'viper-dark',
|
|
9
|
+
light: 'viper-light',
|
|
10
|
+
};
|
|
4
11
|
const canonicalId = (themeId) => LEGACY_THEME_IDS[themeId] ?? themeId;
|
|
12
|
+
let activeDesign = 'viper';
|
|
13
|
+
export function setThemeDesign(design) {
|
|
14
|
+
if (!Object.prototype.hasOwnProperty.call(DESIGN_THEMES, design)) {
|
|
15
|
+
throw new Error(`Unknown theme design: ${String(design)}`);
|
|
16
|
+
}
|
|
17
|
+
activeDesign = design;
|
|
18
|
+
}
|
|
19
|
+
export function getThemeDesign() {
|
|
20
|
+
return activeDesign;
|
|
21
|
+
}
|
|
22
|
+
export function getDefaultThemeId(type = 'dark') {
|
|
23
|
+
return DESIGN_THEMES[activeDesign][type];
|
|
24
|
+
}
|
|
5
25
|
const sources = [];
|
|
6
26
|
export function registerThemeSource(source) {
|
|
7
27
|
sources.push(source);
|
|
@@ -21,16 +41,19 @@ function contributedById(themeId) {
|
|
|
21
41
|
}
|
|
22
42
|
return null;
|
|
23
43
|
}
|
|
44
|
+
const inActiveDesign = (theme) => theme.design === undefined || theme.design === activeDesign;
|
|
45
|
+
const builtInById = (themeId) => themeOptions.find((t) => t.id === themeId);
|
|
24
46
|
export function getThemeById(rawId) {
|
|
25
47
|
const themeId = canonicalId(rawId);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
48
|
+
const builtIn = builtInById(themeId);
|
|
49
|
+
if (builtIn && !inActiveDesign(builtIn))
|
|
50
|
+
return builtInById(getDefaultThemeId(builtIn.type));
|
|
51
|
+
return builtIn ?? contributedById(themeId) ?? builtInById(getDefaultThemeId());
|
|
29
52
|
}
|
|
30
53
|
export function getThemeOptions() {
|
|
31
|
-
return [...themeOptions, ...sources.flatMap((source) => source.options())];
|
|
54
|
+
return [...themeOptions.filter(inActiveDesign), ...sources.flatMap((source) => source.options())];
|
|
32
55
|
}
|
|
33
56
|
export function isKnownThemeId(rawId) {
|
|
34
57
|
const themeId = canonicalId(rawId);
|
|
35
|
-
return
|
|
58
|
+
return builtInById(themeId) !== undefined || contributedById(themeId) !== null;
|
|
36
59
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { createContext, createEffect, createMemo, createSignal, onCleanup, useContext, } from 'solid-js';
|
|
2
2
|
import { isDev } from 'solid-js/web';
|
|
3
|
-
import {
|
|
3
|
+
import { getDefaultThemeId, getThemeById, getThemeOptions } from './palette/themeRegistry';
|
|
4
4
|
import { derivePaletteProperties } from './palette/paletteProperties';
|
|
5
5
|
import { toColorVisionSafePalette } from './palette/colorVisionPalette';
|
|
6
6
|
const COLORBLIND_SAFE_ATTR = 'data-colorblind-safe';
|
|
7
|
+
const DESIGN_ATTR = 'data-design';
|
|
7
8
|
export function resolveThemeOption(theme, prefersLight = false) {
|
|
8
9
|
if (theme === 'system')
|
|
9
|
-
return getThemeById(prefersLight ? 'light' :
|
|
10
|
+
return getThemeById(getDefaultThemeId(prefersLight ? 'light' : 'dark'));
|
|
10
11
|
if (theme === 'dark')
|
|
11
|
-
return getThemeById(
|
|
12
|
+
return getThemeById(getDefaultThemeId('dark'));
|
|
13
|
+
if (theme === 'light')
|
|
14
|
+
return getThemeById(getDefaultThemeId('light'));
|
|
12
15
|
return getThemeById(theme);
|
|
13
16
|
}
|
|
14
17
|
export function applyAppTheme(theme, options = {}) {
|
|
@@ -32,6 +35,10 @@ export function applyAppTheme(theme, options = {}) {
|
|
|
32
35
|
root.classList.add(option.type);
|
|
33
36
|
root.style.colorScheme = option.type;
|
|
34
37
|
root.setAttribute('data-app-theme', option.id);
|
|
38
|
+
if (option.design)
|
|
39
|
+
root.setAttribute(DESIGN_ATTR, option.design);
|
|
40
|
+
else
|
|
41
|
+
root.removeAttribute(DESIGN_ATTR);
|
|
35
42
|
return option;
|
|
36
43
|
}
|
|
37
44
|
export function getThemes() {
|
|
@@ -107,12 +114,12 @@ export function useTheme() {
|
|
|
107
114
|
if (!context) {
|
|
108
115
|
if (isDev && !warnedOutsideProvider) {
|
|
109
116
|
warnedOutsideProvider = true;
|
|
110
|
-
console.warn(
|
|
117
|
+
console.warn("@vokril/ui-solid: useTheme() was called outside <ThemeProvider>; it reports the design's dark theme and ignores setTheme.");
|
|
111
118
|
}
|
|
112
119
|
return {
|
|
113
120
|
theme: () => 'dark',
|
|
114
121
|
resolvedTheme: () => 'dark',
|
|
115
|
-
themeId: () =>
|
|
122
|
+
themeId: () => getDefaultThemeId(),
|
|
116
123
|
setTheme: () => { },
|
|
117
124
|
toggleTheme: () => { },
|
|
118
125
|
colorVisionSafe: () => false,
|