@vokril/ui-solid 0.24.0 → 0.26.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 +17 -0
- package/README.md +16 -6
- package/dist/CommandPalette-Bf8flX2t.cjs +2 -0
- package/dist/{CommandPalette-CBA_Shqx.js → CommandPalette-CoIdCmZ0.js} +1287 -1278
- 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/{server/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/overlay/Drawer.d.cts +8 -0
- package/dist/overlay/Drawer.d.ts +8 -0
- package/dist/overlay/index.cjs +1 -1
- package/dist/overlay/index.js +1 -1
- package/dist/server/{CommandPalette-DE59Rq-n.js → CommandPalette-COVjWlx9.js} +772 -764
- package/dist/server/CommandPalette-C_9Z8gVc.cjs +1 -0
- package/dist/server/appThemeDerivation-Be_oKljl.cjs +1 -0
- package/dist/{appThemeDerivation-B7-DjMIM.js → server/appThemeDerivation-CKoSe4KP.js} +334 -252
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +468 -464
- package/dist/server/overlay/index.cjs +1 -1
- package/dist/server/overlay/index.js +1 -1
- package/dist/server/tokens/index.cjs +1 -1
- package/dist/server/tokens/index.js +33 -29
- package/dist/solid/overlay/Drawer.jsx +18 -7
- package/dist/solid/overlay/Drawer.module.css.js +1 -0
- 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 +288 -9
- package/dist/theme.css +287 -8
- 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 +287 -8
- package/dist/ui.css +1 -1
- package/package.json +3 -2
- package/dist/CommandPalette-CBFIo0FX.cjs +0 -2
- package/dist/appThemeDerivation-NS3Vws8q.cjs +0 -1
- package/dist/server/CommandPalette-CRT5VEoR.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("../CommandPalette-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../CommandPalette-C_9Z8gVc.cjs"),i=require("../Modal-CtJFoR96.cjs"),u=require("../OverlayScrollArea-D4e9D9Nd.cjs"),r=require("../GuidedTour-BoPGRyX5.cjs"),o=require("../createDialogShellFocus-BiBAZOCI.cjs"),a=require("../dialogFocusRestore-CL-ExfAA.cjs"),t=require("../Popover-BsxIKBbl.cjs"),n=require("../overlayStack-eD8AmuwY.cjs"),c=require("../useFloatingDropdown-D5UayoN6.cjs"),O=require("../ownerWindow-BCmJFMbR.cjs"),l=require("../prefersReducedMotion-BQp-Q4UR.cjs"),s=require("../DesktopContextMenuContext-DMGNVjaR.cjs");exports.CommandPalette=e.CommandPalette;exports.ConfirmDialog=e.ConfirmDialog;exports.ConsequenceLine=e.ConsequenceLine;exports.ContextMenu=e.ContextMenu;exports.DesktopContextMenu=e.DesktopContextMenu;exports.Drawer=e.Drawer;exports.DropdownMenu=e.DropdownMenu;exports.FloatingWindow=e.FloatingWindow;exports.InputDialog=e.InputDialog;exports.MenuDisclosure=e.MenuDisclosure;exports.MenuEmpty=e.MenuEmpty;exports.MenuItem=e.MenuItem;exports.MenuList=e.MenuList;exports.MenuSearch=e.MenuSearch;exports.MenuSection=e.MenuSection;exports.MenuSeparator=e.MenuSeparator;exports.NameStep=e.NameStep;exports.OptionList=e.OptionList;exports.PopoverPanel=e.PopoverPanel;exports.SUBMENU_ANCHOR_OVERLAP=e.SUBMENU_ANCHOR_OVERLAP;exports.SUBMENU_ESTIMATED_ROW_HEIGHT=e.SUBMENU_ESTIMATED_ROW_HEIGHT;exports.SUBMENU_ESTIMATED_WIDTH=e.SUBMENU_ESTIMATED_WIDTH;exports.SUBMENU_MIN_ESTIMATED_HEIGHT=e.SUBMENU_MIN_ESTIMATED_HEIGHT;exports.SUBMENU_VIEWPORT_MARGIN=e.SUBMENU_VIEWPORT_MARGIN;exports.SaveDiscardDialog=e.SaveDiscardDialog;exports.SelectedOptions=e.SelectedOptions;exports.StatementPreview=e.StatementPreview;exports.StepFooter=e.StepFooter;exports.Tooltip=e.Tooltip;exports.TooltipHost=e.TooltipHost;exports.closeContextMenu=e.closeContextMenu;exports.computeSubmenuPlacement=e.computeSubmenuPlacement;exports.confirmationLevelOf=e.confirmationLevelOf;exports.createDangerousActionDialog=e.createDangerousActionDialog;exports.createDesktopContextMenuApi=e.createDesktopContextMenuApi;exports.createDialogFocusScope=e.createDialogFocusScope;exports.createOverlayCloseGuard=e.createOverlayCloseGuard;exports.describeConsequence=e.describeConsequence;exports.estimateSubmenuHeight=e.estimateSubmenuHeight;exports.firstFocusableMenuIndex=e.firstFocusableMenuIndex;exports.isDesktopMenuNavigationKey=e.isDesktopMenuNavigationKey;exports.isIrreversible=e.isIrreversible;exports.lastFocusableMenuIndex=e.lastFocusableMenuIndex;exports.menuSurfaceClasses=e.menuSurfaceClasses;exports.nextFocusableMenuIndex=e.nextFocusableMenuIndex;exports.openContextMenu=e.openContextMenu;exports.panelClasses=e.panelClasses;exports.resolveDangerousActionDialogKeyIntent=e.resolveDangerousActionDialogKeyIntent;exports.resolveMenuFocusForKey=e.resolveMenuFocusForKey;exports.tooltip=e.tooltip;exports.ActionPlaceRow=i.ActionPlaceRow;exports.Modal=i.Modal;exports.modalTitlebarHeight=i.modalTitlebarHeight;exports.OverlayScrollArea=u.OverlayScrollArea;exports.Disclosure=r.Disclosure;exports.GuidedTour=r.GuidedTour;exports.Panel=r.Panel;exports.PanelSeparator=r.PanelSeparator;exports.positionTourCard=r.positionTourCard;exports.COLD_DELAY_MS=o.COLD_DELAY_MS;exports.COOLDOWN_MS=o.COOLDOWN_MS;exports.DEFAULT_MARGIN=o.DEFAULT_MARGIN;exports.DEFAULT_OFFSET=o.DEFAULT_OFFSET;exports.HoverTooltip=o.HoverTooltip;exports.TOOLTIP_CURSOR_OFFSET_X=o.TOOLTIP_CURSOR_OFFSET_X;exports.TOOLTIP_CURSOR_OFFSET_Y=o.TOOLTIP_CURSOR_OFFSET_Y;exports.TOOLTIP_MAX_FOOTPRINT_X=o.TOOLTIP_MAX_FOOTPRINT_X;exports.TOOLTIP_VIEWPORT_MARGIN=o.TOOLTIP_VIEWPORT_MARGIN;exports.WARM_DELAY_MS=o.WARM_DELAY_MS;exports.collectFocusableElements=o.collectFocusableElements;exports.computeAnchoredTooltipPosition=o.computeAnchoredTooltipPosition;exports.computeTooltipPointerPosition=o.computeTooltipPointerPosition;exports.createDialogShellFocus=o.createDialogShellFocus;exports.createTooltipCoordinator=o.createTooltipCoordinator;exports.resolveDialogShellKeyIntent=o.resolveDialogShellKeyIntent;exports.resolveModalFocusTrapTarget=o.resolveModalFocusTrapTarget;exports.tooltipCoordinator=o.tooltipCoordinator;exports.trapTabFocusWithin=o.trapTabFocusWithin;exports.OverlayPortal=a.OverlayPortal;exports.restoreFocusTo=a.restoreFocusTo;exports.shouldRestoreFocusOnDialogClose=a.shouldRestoreFocusOnDialogClose;exports.AnchorAlignment=t.AnchorAlignment;exports.AnchorAxisAlignment=t.AnchorAxisAlignment;exports.AnchorPosition=t.AnchorPosition;exports.LISTBOX_OPTION_SELECTOR=t.LISTBOX_OPTION_SELECTOR;exports.MENU_ITEM_SELECTOR=t.MENU_ITEM_SELECTOR;exports.OVERLAY_DEFAULT_GAP=t.OVERLAY_DEFAULT_GAP;exports.OVERLAY_DEFAULT_MARGIN=t.OVERLAY_DEFAULT_MARGIN;exports.POPOVER_DEFAULT_GAP=t.POPOVER_DEFAULT_GAP;exports.POPOVER_VIEWPORT_MARGIN=t.POPOVER_VIEWPORT_MARGIN;exports.Popover=t.Popover;exports.calcFixedWidthDropdownLeft=t.calcFixedWidthDropdownLeft;exports.computeAnchoredPosition=t.computeAnchoredPosition;exports.computeDropdownPosition=t.computeDropdownPosition;exports.computePopoverPosition=t.computePopoverPosition;exports.isPopoverNavigationKey=t.isPopoverNavigationKey;exports.layout2d=t.layout2d;exports.requestOwnerAnimationFrame=t.requestOwnerAnimationFrame;exports.resolvePopoverFocusForKey=t.resolvePopoverFocusForKey;exports.resolvePopoverSide=t.resolvePopoverSide;exports.getOverlayDiagnostics=n.getOverlayDiagnostics;exports.hasOpenLayerIn=n.hasOpenLayerIn;exports.isAnyOverlayOpen=n.isAnyOverlayOpen;exports.isModalOccluded=n.isModalOccluded;exports.isOverlayOverlapping=n.isOverlayOverlapping;exports.notifyOverlayChanged=n.notifyOverlayChanged;exports.notifyOverlayMotionEnd=n.notifyOverlayMotionEnd;exports.notifyOverlayMotionStart=n.notifyOverlayMotionStart;exports.onOverlayMotion=n.onOverlayMotion;exports.overlayDepth=n.overlayDepth;exports.readOverlayMutationRevision=n.readOverlayMutationRevision;exports.registerOverlayClose=n.registerOverlayClose;exports.registerOverlayCondition=n.registerOverlayCondition;exports.registerOverlayOpen=n.registerOverlayOpen;exports.useOverlayRegistration=n.useOverlayRegistration;exports.useFloatingDropdown=c.useFloatingDropdown;exports.ownerWindow=O.ownerWindow;exports.modalBackgroundExemption=l.modalBackgroundExemption;exports.neutralizeBackground=l.neutralizeBackground;exports.DesktopContextMenuContext=s.DesktopContextMenuContext;exports.useDesktopContextMenu=s.useDesktopContextMenu;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as o, a as s, b as t, c as r, D as n, d as i, e as l, F as u, I as p, M as O, f as c, g as M, h as T, i as m, j as d, k as D, N as E, O as _, P as A, S as P, l as v, m as S, n as g, o as I, p as F, q as y, r as C, s as x, T as R, t as L, u as f, v as h, w as N, x as U, y as b, z as G, A as W, B as w, E as H, G as k, H as B, J as V, K, L as X, Q as Y, R as j, U as q, V as z, W as J, X as Q } from "../CommandPalette-
|
|
1
|
+
import { C as o, a as s, b as t, c as r, D as n, d as i, e as l, F as u, I as p, M as O, f as c, g as M, h as T, i as m, j as d, k as D, N as E, O as _, P as A, S as P, l as v, m as S, n as g, o as I, p as F, q as y, r as C, s as x, T as R, t as L, u as f, v as h, w as N, x as U, y as b, z as G, A as W, B as w, E as H, G as k, H as B, J as V, K, L as X, Q as Y, R as j, U as q, V as z, W as J, X as Q } from "../CommandPalette-COVjWlx9.js";
|
|
2
2
|
import { A as $, M as ee, m as ae } from "../Modal-j54-C2Md.js";
|
|
3
3
|
import { O as se } from "../OverlayScrollArea-221dfKyz.js";
|
|
4
4
|
import { D as re, G as ne, P as ie, a as le, p as ue } from "../GuidedTour-CIlHyRcR.js";
|
|
@@ -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
|
};
|
|
@@ -15,9 +15,17 @@ import { isKey } from '../_internal/base/keys';
|
|
|
15
15
|
export function Drawer(props) {
|
|
16
16
|
let drawerElement = null;
|
|
17
17
|
const overlayGuard = createOverlayCloseGuard();
|
|
18
|
-
const
|
|
18
|
+
const contained = () => props.container !== undefined;
|
|
19
|
+
const openedIn = createMemo((previous) => props.open
|
|
20
|
+
? (previous ??
|
|
21
|
+
(props.container?.isConnected
|
|
22
|
+
? props.container.ownerDocument
|
|
23
|
+
: getActiveWindow().document))
|
|
24
|
+
: null, null);
|
|
19
25
|
const layer = useOverlayRegistration(() => props.open, 'drawer', {
|
|
20
|
-
type
|
|
26
|
+
get type() {
|
|
27
|
+
return contained() ? 'popover' : 'modal';
|
|
28
|
+
},
|
|
21
29
|
element: () => (drawerElement?.isConnected ? drawerElement : null),
|
|
22
30
|
document: () => openedIn() ?? undefined,
|
|
23
31
|
});
|
|
@@ -27,7 +35,10 @@ export function Drawer(props) {
|
|
|
27
35
|
});
|
|
28
36
|
const captureAndFocus = (el) => {
|
|
29
37
|
drawerElement = el;
|
|
30
|
-
|
|
38
|
+
if (contained())
|
|
39
|
+
focusScope.captureReturnFocus();
|
|
40
|
+
else
|
|
41
|
+
focusScope.captureDialog(el);
|
|
31
42
|
requestOwnerAnimationFrame(el, () => {
|
|
32
43
|
if (!el.isConnected)
|
|
33
44
|
return;
|
|
@@ -82,9 +93,9 @@ export function Drawer(props) {
|
|
|
82
93
|
onCleanup(() => win.removeEventListener('keydown', onKey, true));
|
|
83
94
|
});
|
|
84
95
|
return (<Show when={openedIn()}>
|
|
85
|
-
{(doc) => (<Portal mount={doc().body}>
|
|
86
|
-
<div class={styles.backdrop} onMouseDown={handleOverlayMouseDown} onClick={handleOverlayClick} aria-hidden="true"/>
|
|
87
|
-
<
|
|
96
|
+
{(doc) => (<Portal mount={props.container ?? doc().body}>
|
|
97
|
+
<div class={`${styles.backdrop} ${contained() ? (styles.contained ?? '') : ''}`} onMouseDown={handleOverlayMouseDown} onClick={handleOverlayClick} aria-hidden="true"/>
|
|
98
|
+
<div ref={captureAndFocus} class={`${styles.drawer} ${placementClass()} ${sizeClass()} ${contained() ? (styles.contained ?? '') : ''} ${props.class ?? ''}`} role="dialog" aria-modal={contained() ? undefined : 'true'} aria-label={props.ariaLabel ?? props.title ?? t('Drawer')} tabIndex={-1} onKeyDown={handleKeyDown}>
|
|
88
99
|
<header class={styles.header}>
|
|
89
100
|
<Show when={props.title} fallback={<div />}>
|
|
90
101
|
<h3 class={styles.title}>{props.title}</h3>
|
|
@@ -103,7 +114,7 @@ export function Drawer(props) {
|
|
|
103
114
|
<Show when={props.footer}>
|
|
104
115
|
<footer class={styles.footer}>{props.footer}</footer>
|
|
105
116
|
</Show>
|
|
106
|
-
</
|
|
117
|
+
</div>
|
|
107
118
|
</Portal>)}
|
|
108
119
|
</Show>);
|
|
109
120
|
}
|
|
@@ -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,
|