@ponchia/ui 0.4.1 → 0.6.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 +552 -8
- package/MIGRATIONS.json +106 -0
- package/README.md +34 -8
- package/annotations/index.d.ts +402 -0
- package/annotations/index.d.ts.map +1 -0
- package/annotations/index.js +792 -0
- package/behaviors/carousel.js +198 -0
- package/behaviors/combobox.js +226 -0
- package/behaviors/command.js +190 -0
- package/behaviors/connectors.js +95 -0
- package/behaviors/crosshair.js +57 -0
- package/behaviors/dialog.js +74 -0
- package/behaviors/disclosure.js +26 -0
- package/behaviors/dismissible.js +25 -0
- package/behaviors/forms.js +186 -0
- package/behaviors/glyph.js +108 -0
- package/behaviors/index.d.ts +79 -0
- package/behaviors/index.js +18 -1409
- package/behaviors/internal.js +97 -0
- package/behaviors/legend.js +67 -0
- package/behaviors/menu.js +47 -0
- package/behaviors/popover.js +179 -0
- package/behaviors/spotlight.js +52 -0
- package/behaviors/table.js +136 -0
- package/behaviors/tabs.js +103 -0
- package/behaviors/theme.js +84 -0
- package/behaviors/toast.js +164 -0
- package/classes/classes.json +1857 -0
- package/classes/index.d.ts +306 -13
- package/classes/index.js +339 -12
- package/classes/vscode.css-custom-data.json +12 -0
- package/connectors/index.d.ts +191 -0
- package/connectors/index.d.ts.map +1 -0
- package/connectors/index.js +275 -0
- package/css/analytical.css +21 -0
- package/css/annotations.css +292 -0
- package/css/app.css +43 -13
- package/css/base.css +15 -10
- package/css/command.css +97 -0
- package/css/connectors.css +110 -0
- package/css/content.css +7 -1
- package/css/crosshair.css +100 -0
- package/css/dataviz.css +5 -1
- package/css/disclosure.css +38 -6
- package/css/dots.css +57 -0
- package/css/feedback.css +111 -2
- package/css/fonts.css +11 -7
- package/css/forms.css +42 -1
- package/css/generated.css +117 -0
- package/css/legend.css +272 -0
- package/css/marks.css +174 -0
- package/css/motion.css +24 -44
- package/css/navigation.css +7 -0
- package/css/overlay.css +31 -1
- package/css/primitives.css +109 -5
- package/css/report.css +39 -81
- package/css/selection.css +46 -0
- package/css/site.css +16 -2
- package/css/sources.css +221 -0
- package/css/spotlight.css +104 -0
- package/css/state.css +121 -0
- package/css/tokens.css +60 -37
- package/css/workbench.css +83 -0
- package/dist/bronto.css +1 -1
- package/dist/css/analytical.css +1 -0
- package/dist/css/annotations.css +1 -0
- package/dist/css/app.css +1 -1
- package/dist/css/base.css +1 -1
- package/dist/css/command.css +1 -0
- package/dist/css/connectors.css +1 -0
- package/dist/css/content.css +1 -1
- package/dist/css/crosshair.css +1 -0
- package/dist/css/disclosure.css +1 -1
- package/dist/css/dots.css +1 -1
- package/dist/css/feedback.css +1 -1
- package/dist/css/fonts.css +1 -1
- package/dist/css/forms.css +1 -1
- package/dist/css/generated.css +1 -0
- package/dist/css/legend.css +1 -0
- package/dist/css/marks.css +1 -0
- package/dist/css/motion.css +1 -1
- package/dist/css/navigation.css +1 -1
- package/dist/css/overlay.css +1 -1
- package/dist/css/primitives.css +1 -1
- package/dist/css/report.css +1 -1
- package/dist/css/selection.css +1 -0
- package/dist/css/site.css +1 -1
- package/dist/css/sources.css +1 -0
- package/dist/css/spotlight.css +1 -0
- package/dist/css/state.css +1 -0
- package/dist/css/tokens.css +1 -1
- package/dist/css/workbench.css +1 -0
- package/docs/adr/0003-theme-model.md +7 -4
- package/docs/annotations.md +425 -0
- package/docs/architecture.md +246 -0
- package/docs/command.md +95 -0
- package/docs/connectors.md +91 -0
- package/docs/contrast.md +116 -92
- package/docs/crosshair.md +63 -0
- package/docs/d2.md +195 -0
- package/docs/generated.md +91 -0
- package/docs/legends.md +184 -0
- package/docs/marks.md +93 -0
- package/docs/mermaid.md +152 -0
- package/docs/reference.md +385 -23
- package/docs/reporting.md +436 -63
- package/docs/selection.md +40 -0
- package/docs/sources.md +137 -0
- package/docs/spotlight.md +78 -0
- package/docs/stability.md +24 -2
- package/docs/state.md +85 -0
- package/docs/usage.md +123 -4
- package/docs/vega.md +225 -0
- package/docs/workbench.md +78 -0
- package/fonts/doto-400.woff2 +0 -0
- package/fonts/doto-500.woff2 +0 -0
- package/fonts/doto-600.woff2 +0 -0
- package/fonts/doto-700.woff2 +0 -0
- package/fonts/doto-800.woff2 +0 -0
- package/fonts/doto-900.woff2 +0 -0
- package/glyphs/glyphs.js +6 -4
- package/llms.txt +362 -14
- package/package.json +115 -12
- package/qwik/index.d.ts +42 -54
- package/qwik/index.d.ts.map +1 -0
- package/qwik/index.js +75 -3
- package/react/index.d.ts +39 -56
- package/react/index.d.ts.map +1 -0
- package/react/index.js +67 -3
- package/solid/index.d.ts +64 -56
- package/solid/index.d.ts.map +1 -0
- package/solid/index.js +70 -3
- package/tokens/d2.d.ts +38 -0
- package/tokens/d2.js +71 -0
- package/tokens/d2.json +43 -0
- package/tokens/index.d.ts +5 -5
- package/tokens/index.js +23 -5
- package/tokens/index.json +9 -0
- package/tokens/mermaid.d.ts +23 -0
- package/tokens/mermaid.js +181 -0
- package/tokens/mermaid.json +163 -0
- package/tokens/resolved.json +45 -1
- package/tokens/skins.js +3 -2
- package/tokens/tokens.dtcg.json +26 -0
- package/tokens/vega.d.ts +34 -0
- package/tokens/vega.js +155 -0
- package/tokens/vega.json +179 -0
- package/fonts/doto-400.ttf +0 -0
- package/fonts/doto-500.ttf +0 -0
- package/fonts/doto-600.ttf +0 -0
- package/fonts/doto-700.ttf +0 -0
- package/fonts/doto-800.ttf +0 -0
- package/fonts/doto-900.ttf +0 -0
package/react/index.js
CHANGED
|
@@ -16,6 +16,34 @@
|
|
|
16
16
|
* const toast = useToast();
|
|
17
17
|
* return <button onClick={() => toast('Saved', { tone: 'success' })}>Save</button>;
|
|
18
18
|
* }
|
|
19
|
+
*
|
|
20
|
+
* The public types below are JSDoc `@typedef`s; the shipped `index.d.ts` is
|
|
21
|
+
* generated from them (and these signatures) by `tsc --emitDeclarationOnly`.
|
|
22
|
+
*
|
|
23
|
+
* @typedef {import('../behaviors/index.js').Cleanup} Cleanup
|
|
24
|
+
* @typedef {import('../behaviors/index.js').DelegateOpts} DelegateOpts
|
|
25
|
+
* @typedef {import('../behaviors/index.js').ThemeStorageOpts} ThemeStorageOpts
|
|
26
|
+
* @typedef {import('../behaviors/index.js').ToastOpts} ToastOpts
|
|
27
|
+
*
|
|
28
|
+
* @typedef {Document
|
|
29
|
+
* | Element
|
|
30
|
+
* | { current: Document | Element | null | undefined }
|
|
31
|
+
* | (() => Document | Element | null | undefined)
|
|
32
|
+
* | null
|
|
33
|
+
* | undefined} BrontoBindingRoot
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @template {DelegateOpts} [T=DelegateOpts]
|
|
38
|
+
* @typedef {Omit<T, 'root'> & { root?: BrontoBindingRoot }} BrontoBindingOpts
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @template {DelegateOpts} [T=DelegateOpts]
|
|
43
|
+
* @typedef {BrontoBindingOpts<T>
|
|
44
|
+
* | (() => BrontoBindingOpts<T> | null | undefined)
|
|
45
|
+
* | null
|
|
46
|
+
* | undefined} BrontoBindingOptsResolver
|
|
19
47
|
*/
|
|
20
48
|
import { useEffect } from 'react';
|
|
21
49
|
import {
|
|
@@ -32,6 +60,11 @@ import {
|
|
|
32
60
|
initDialog,
|
|
33
61
|
initCarousel,
|
|
34
62
|
initDotGlyph,
|
|
63
|
+
initLegend,
|
|
64
|
+
initConnectors,
|
|
65
|
+
initSpotlight,
|
|
66
|
+
initCrosshair,
|
|
67
|
+
initCommand,
|
|
35
68
|
toast,
|
|
36
69
|
} from '../behaviors/index.js';
|
|
37
70
|
|
|
@@ -48,31 +81,62 @@ function resolveRoot(root) {
|
|
|
48
81
|
function resolveOpts(opts) {
|
|
49
82
|
const value = resolveMaybe(opts);
|
|
50
83
|
if (!value || typeof value !== 'object') return undefined;
|
|
84
|
+
// No `root` key → no scope requested; leave root out so the behavior
|
|
85
|
+
// delegates from `document`. A `root` key that resolves falsy means a scope
|
|
86
|
+
// WAS requested but the ref is not ready: emit `root: null` so the behavior
|
|
87
|
+
// no-ops instead of hijacking the whole document.
|
|
88
|
+
if (!('root' in value)) return { ...value };
|
|
51
89
|
const root = resolveRoot(value.root);
|
|
52
|
-
return
|
|
90
|
+
return { ...value, root: root || null };
|
|
53
91
|
}
|
|
54
92
|
|
|
55
93
|
/** Run a delegated behavior for the component's lifetime (init on mount, its
|
|
56
94
|
* returned cleanup on unmount). The behavior is run once; `opts` resolves
|
|
57
|
-
* on mount so refs are usable for scoped roots.
|
|
95
|
+
* on mount so refs are usable for scoped roots.
|
|
96
|
+
* @param {(opts?: DelegateOpts) => Cleanup | void} init
|
|
97
|
+
* @param {BrontoBindingOptsResolver} [opts]
|
|
98
|
+
* @returns {void} */
|
|
58
99
|
export function useBrontoBehavior(init, opts) {
|
|
59
100
|
useEffect(() => init(resolveOpts(opts)), []); // eslint-disable-line react-hooks/exhaustive-deps -- delegated once on mount
|
|
60
101
|
}
|
|
61
102
|
|
|
103
|
+
/** @param {BrontoBindingOptsResolver<ThemeStorageOpts & DelegateOpts>} [opts] @returns {void} */
|
|
62
104
|
export const useThemeToggle = (opts) => useBrontoBehavior(initThemeToggle, opts);
|
|
105
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
63
106
|
export const useDismissible = (opts) => useBrontoBehavior(dismissible, opts);
|
|
107
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
64
108
|
export const useDisclosure = (opts) => useBrontoBehavior(initDisclosure, opts);
|
|
109
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
65
110
|
export const useMenu = (opts) => useBrontoBehavior(initMenu, opts);
|
|
111
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
66
112
|
export const useFormValidation = (opts) => useBrontoBehavior(initFormValidation, opts);
|
|
113
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
67
114
|
export const useCombobox = (opts) => useBrontoBehavior(initCombobox, opts);
|
|
115
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
68
116
|
export const usePopover = (opts) => useBrontoBehavior(initPopover, opts);
|
|
117
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
69
118
|
export const useTableSort = (opts) => useBrontoBehavior(initTableSort, opts);
|
|
119
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
70
120
|
export const useTabs = (opts) => useBrontoBehavior(initTabs, opts);
|
|
121
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
71
122
|
export const useDialog = (opts) => useBrontoBehavior(initDialog, opts);
|
|
123
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
72
124
|
export const useCarousel = (opts) => useBrontoBehavior(initCarousel, opts);
|
|
125
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
73
126
|
export const useDotGlyph = (opts) => useBrontoBehavior(initDotGlyph, opts);
|
|
127
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
128
|
+
export const useLegend = (opts) => useBrontoBehavior(initLegend, opts);
|
|
129
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
130
|
+
export const useConnectors = (opts) => useBrontoBehavior(initConnectors, opts);
|
|
131
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
132
|
+
export const useSpotlight = (opts) => useBrontoBehavior(initSpotlight, opts);
|
|
133
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
134
|
+
export const useCrosshair = (opts) => useBrontoBehavior(initCrosshair, opts);
|
|
135
|
+
/** @param {BrontoBindingOptsResolver} [opts] @returns {void} */
|
|
136
|
+
export const useCommand = (opts) => useBrontoBehavior(initCommand, opts);
|
|
74
137
|
|
|
75
|
-
/** The `toast()` imperative (no lifecycle of its own).
|
|
138
|
+
/** The `toast()` imperative (no lifecycle of its own).
|
|
139
|
+
* @returns {(message: string, opts?: ToastOpts) => Cleanup} */
|
|
76
140
|
export const useToast = () => toast;
|
|
77
141
|
|
|
78
142
|
// No-flash theme application has to run before paint; do it in an inline head
|
package/solid/index.d.ts
CHANGED
|
@@ -1,57 +1,65 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
/** Run a delegated behavior for the component's lifetime (init on mount, its
|
|
2
|
+
* returned cleanup on dispose). Options resolve on mount, after refs exist.
|
|
3
|
+
* @param {(opts?: DelegateOpts) => Cleanup | void} init
|
|
4
|
+
* @param {BrontoBindingOptsResolver} [opts]
|
|
5
|
+
* @returns {void}
|
|
6
|
+
*/
|
|
7
|
+
export function useBrontoBehavior(init: (opts?: DelegateOpts) => Cleanup | void, opts?: BrontoBindingOptsResolver): void;
|
|
8
|
+
/** @type {(opts?: BrontoBindingOptsResolver<ThemeStorageOpts & DelegateOpts>) => void} */
|
|
9
|
+
export const useThemeToggle: (opts?: BrontoBindingOptsResolver<ThemeStorageOpts & DelegateOpts>) => void;
|
|
10
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
11
|
+
export const useDismissible: (opts?: BrontoBindingOptsResolver) => void;
|
|
12
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
13
|
+
export const useDisclosure: (opts?: BrontoBindingOptsResolver) => void;
|
|
14
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
15
|
+
export const useMenu: (opts?: BrontoBindingOptsResolver) => void;
|
|
16
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
17
|
+
export const useFormValidation: (opts?: BrontoBindingOptsResolver) => void;
|
|
18
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
19
|
+
export const useCombobox: (opts?: BrontoBindingOptsResolver) => void;
|
|
20
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
21
|
+
export const usePopover: (opts?: BrontoBindingOptsResolver) => void;
|
|
22
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
23
|
+
export const useTableSort: (opts?: BrontoBindingOptsResolver) => void;
|
|
24
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
25
|
+
export const useTabs: (opts?: BrontoBindingOptsResolver) => void;
|
|
26
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
27
|
+
export const useDialog: (opts?: BrontoBindingOptsResolver) => void;
|
|
28
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
29
|
+
export const useCarousel: (opts?: BrontoBindingOptsResolver) => void;
|
|
30
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
31
|
+
export const useDotGlyph: (opts?: BrontoBindingOptsResolver) => void;
|
|
32
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
33
|
+
export const useLegend: (opts?: BrontoBindingOptsResolver) => void;
|
|
34
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
35
|
+
export const useConnectors: (opts?: BrontoBindingOptsResolver) => void;
|
|
36
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
37
|
+
export const useSpotlight: (opts?: BrontoBindingOptsResolver) => void;
|
|
38
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
39
|
+
export const useCrosshair: (opts?: BrontoBindingOptsResolver) => void;
|
|
40
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
41
|
+
export const useCommand: (opts?: BrontoBindingOptsResolver) => void;
|
|
42
|
+
/** The `toast()` imperative (no lifecycle of its own).
|
|
43
|
+
* @type {() => (message: string, opts?: ToastOpts) => Cleanup} */
|
|
44
|
+
export const useToast: () => (message: string, opts?: ToastOpts) => Cleanup;
|
|
45
|
+
export { applyStoredTheme };
|
|
46
|
+
export type Cleanup = import("../behaviors/index.js").Cleanup;
|
|
47
|
+
export type DelegateOpts = import("../behaviors/index.js").DelegateOpts;
|
|
48
|
+
export type ThemeStorageOpts = import("../behaviors/index.js").ThemeStorageOpts;
|
|
49
|
+
export type ToastOpts = import("../behaviors/index.js").ToastOpts;
|
|
50
|
+
export type BrontoBindingRoot = Document | Element | {
|
|
51
|
+
current: Document | Element | null | undefined;
|
|
52
|
+
} | (() => Document | Element | null | undefined) | null | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Behavior options with the `root` widened to accept Solid refs/resolvers.
|
|
55
|
+
*/
|
|
56
|
+
export type BrontoBindingOpts<T extends DelegateOpts = import("../behaviors/index.js").DelegateOpts> = Omit<T, "root"> & {
|
|
57
|
+
root?: BrontoBindingRoot;
|
|
22
58
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/** Run any delegated behavior for the component's lifetime (init on mount,
|
|
31
|
-
* its returned cleanup on dispose). The behavior is run once. Options resolve
|
|
32
|
-
* on mount, so scoped roots may be refs or resolver callbacks. */
|
|
33
|
-
export declare function useBrontoBehavior(
|
|
34
|
-
init: (opts?: DelegateOpts) => Cleanup | void,
|
|
35
|
-
opts?: BrontoBindingOptsResolver,
|
|
36
|
-
): void;
|
|
37
|
-
|
|
38
|
-
export declare function useThemeToggle(
|
|
39
|
-
opts?: BrontoBindingOptsResolver<ThemeStorageOpts & DelegateOpts>,
|
|
40
|
-
): void;
|
|
41
|
-
export declare function useDismissible(opts?: BrontoBindingOptsResolver): void;
|
|
42
|
-
export declare function useDisclosure(opts?: BrontoBindingOptsResolver): void;
|
|
43
|
-
export declare function useMenu(opts?: BrontoBindingOptsResolver): void;
|
|
44
|
-
export declare function useFormValidation(opts?: BrontoBindingOptsResolver): void;
|
|
45
|
-
export declare function useCombobox(opts?: BrontoBindingOptsResolver): void;
|
|
46
|
-
export declare function usePopover(opts?: BrontoBindingOptsResolver): void;
|
|
47
|
-
export declare function useTableSort(opts?: BrontoBindingOptsResolver): void;
|
|
48
|
-
export declare function useTabs(opts?: BrontoBindingOptsResolver): void;
|
|
49
|
-
export declare function useDialog(opts?: BrontoBindingOptsResolver): void;
|
|
50
|
-
export declare function useCarousel(opts?: BrontoBindingOptsResolver): void;
|
|
51
|
-
export declare function useDotGlyph(opts?: BrontoBindingOptsResolver): void;
|
|
52
|
-
|
|
53
|
-
/** The `toast()` imperative (no lifecycle of its own). */
|
|
54
|
-
export declare function useToast(): (message: string, opts?: ToastOpts) => Cleanup;
|
|
55
|
-
|
|
56
|
-
export { applyStoredTheme } from '../behaviors/index.js';
|
|
57
|
-
export { cls, ui, cx } from '../classes/index.js';
|
|
59
|
+
/**
|
|
60
|
+
* `BrontoBindingOpts<T>`, or a callback that returns it on mount (after refs).
|
|
61
|
+
*/
|
|
62
|
+
export type BrontoBindingOptsResolver<T extends DelegateOpts = import("../behaviors/index.js").DelegateOpts> = BrontoBindingOpts<T> | (() => BrontoBindingOpts<T> | null | undefined) | null | undefined;
|
|
63
|
+
import { applyStoredTheme } from '../behaviors/index.js';
|
|
64
|
+
export { cls, ui, cx } from "../classes/index.js";
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA8FA;;;;;GAKG;AACH,wCAJW,CAAC,IAAI,CAAC,EAAE,YAAY,KAAK,OAAO,GAAG,IAAI,SACvC,yBAAyB,GACvB,IAAI,CAOhB;AAED,0FAA0F;AAC1F,6BADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,GAAG,YAAY,CAAC,KAAK,IAAI,CACL;AACjF,yDAAyD;AACzD,6BADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACwB;AAC7E,yDAAyD;AACzD,4BADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CAC0B;AAC/E,yDAAyD;AACzD,sBADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACc;AACnE,yDAAyD;AACzD,gCADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACkC;AACvF,yDAAyD;AACzD,0BADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACsB;AAC3E,yDAAyD;AACzD,yBADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACoB;AACzE,yDAAyD;AACzD,2BADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACwB;AAC7E,yDAAyD;AACzD,sBADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACc;AACnE,yDAAyD;AACzD,wBADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACkB;AACvE,yDAAyD;AACzD,0BADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACsB;AAC3E,yDAAyD;AACzD,0BADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACsB;AAC3E,yDAAyD;AACzD,wBADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACkB;AACvE,yDAAyD;AACzD,4BADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CAC0B;AAC/E,yDAAyD;AACzD,2BADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACwB;AAC7E,yDAAyD;AACzD,2BADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACwB;AAC7E,yDAAyD;AACzD,yBADW,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CACoB;AAEzE;kEACkE;AAClE,uBADU,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,OAAO,CAC1B;;sBA1HvB,OAAO,uBAAuB,EAAE,OAAO;2BACvC,OAAO,uBAAuB,EAAE,YAAY;+BAC5C,OAAO,uBAAuB,EAAE,gBAAgB;wBAChD,OAAO,uBAAuB,EAAE,SAAS;gCAEzC,QAAQ,GACd,OAAO,GACP;IAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,GAClD,CAAC,MAAM,QAAQ,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,GAC7C,IAAI,GACJ,SAAS;;;;8BAKa,CAAC,SAAhB,YAAa,mDACd,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,iBAAiB,CAAA;CAAE;;;;sCAK9B,CAAC,SAAhB,YAAa,mDACd,iBAAiB,CAAC,CAAC,CAAC,GAC1B,CAAC,MAAM,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,GAC/C,IAAI,GACJ,SAAS;iCAuBT,uBAAuB"}
|
package/solid/index.js
CHANGED
|
@@ -16,6 +16,36 @@
|
|
|
16
16
|
* const toast = useToast();
|
|
17
17
|
* return <button onClick={() => toast('Saved', { tone: 'success' })}>Save</button>;
|
|
18
18
|
* }
|
|
19
|
+
*
|
|
20
|
+
* The public types below are JSDoc `@typedef`s; the shipped `index.d.ts` is
|
|
21
|
+
* generated from them (and these signatures) by `tsc --emitDeclarationOnly`.
|
|
22
|
+
*
|
|
23
|
+
* @typedef {import('../behaviors/index.js').Cleanup} Cleanup
|
|
24
|
+
* @typedef {import('../behaviors/index.js').DelegateOpts} DelegateOpts
|
|
25
|
+
* @typedef {import('../behaviors/index.js').ThemeStorageOpts} ThemeStorageOpts
|
|
26
|
+
* @typedef {import('../behaviors/index.js').ToastOpts} ToastOpts
|
|
27
|
+
*
|
|
28
|
+
* @typedef {Document
|
|
29
|
+
* | Element
|
|
30
|
+
* | { current: Document | Element | null | undefined }
|
|
31
|
+
* | (() => Document | Element | null | undefined)
|
|
32
|
+
* | null
|
|
33
|
+
* | undefined} BrontoBindingRoot
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Behavior options with the `root` widened to accept Solid refs/resolvers.
|
|
38
|
+
* @template {DelegateOpts} [T=DelegateOpts]
|
|
39
|
+
* @typedef {Omit<T, 'root'> & { root?: BrontoBindingRoot }} BrontoBindingOpts
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* `BrontoBindingOpts<T>`, or a callback that returns it on mount (after refs).
|
|
44
|
+
* @template {DelegateOpts} [T=DelegateOpts]
|
|
45
|
+
* @typedef {BrontoBindingOpts<T>
|
|
46
|
+
* | (() => BrontoBindingOpts<T> | null | undefined)
|
|
47
|
+
* | null
|
|
48
|
+
* | undefined} BrontoBindingOptsResolver
|
|
19
49
|
*/
|
|
20
50
|
import { onMount, onCleanup } from 'solid-js';
|
|
21
51
|
import {
|
|
@@ -32,6 +62,11 @@ import {
|
|
|
32
62
|
initDialog,
|
|
33
63
|
initCarousel,
|
|
34
64
|
initDotGlyph,
|
|
65
|
+
initLegend,
|
|
66
|
+
initConnectors,
|
|
67
|
+
initSpotlight,
|
|
68
|
+
initCrosshair,
|
|
69
|
+
initCommand,
|
|
35
70
|
toast,
|
|
36
71
|
} from '../behaviors/index.js';
|
|
37
72
|
|
|
@@ -48,12 +83,21 @@ function resolveRoot(root) {
|
|
|
48
83
|
function resolveOpts(opts) {
|
|
49
84
|
const value = resolveMaybe(opts);
|
|
50
85
|
if (!value || typeof value !== 'object') return undefined;
|
|
86
|
+
// No `root` key → no scope requested; leave root out so the behavior
|
|
87
|
+
// delegates from `document`. A `root` key that resolves falsy means a scope
|
|
88
|
+
// WAS requested but the ref is not ready: emit `root: null` so the behavior
|
|
89
|
+
// no-ops instead of hijacking the whole document.
|
|
90
|
+
if (!('root' in value)) return { ...value };
|
|
51
91
|
const root = resolveRoot(value.root);
|
|
52
|
-
return
|
|
92
|
+
return { ...value, root: root || null };
|
|
53
93
|
}
|
|
54
94
|
|
|
55
95
|
/** Run a delegated behavior for the component's lifetime (init on mount, its
|
|
56
|
-
* returned cleanup on dispose). Options resolve on mount, after refs exist.
|
|
96
|
+
* returned cleanup on dispose). Options resolve on mount, after refs exist.
|
|
97
|
+
* @param {(opts?: DelegateOpts) => Cleanup | void} init
|
|
98
|
+
* @param {BrontoBindingOptsResolver} [opts]
|
|
99
|
+
* @returns {void}
|
|
100
|
+
*/
|
|
57
101
|
export function useBrontoBehavior(init, opts) {
|
|
58
102
|
onMount(() => {
|
|
59
103
|
const cleanup = init(resolveOpts(opts));
|
|
@@ -61,20 +105,43 @@ export function useBrontoBehavior(init, opts) {
|
|
|
61
105
|
});
|
|
62
106
|
}
|
|
63
107
|
|
|
108
|
+
/** @type {(opts?: BrontoBindingOptsResolver<ThemeStorageOpts & DelegateOpts>) => void} */
|
|
64
109
|
export const useThemeToggle = (opts) => useBrontoBehavior(initThemeToggle, opts);
|
|
110
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
65
111
|
export const useDismissible = (opts) => useBrontoBehavior(dismissible, opts);
|
|
112
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
66
113
|
export const useDisclosure = (opts) => useBrontoBehavior(initDisclosure, opts);
|
|
114
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
67
115
|
export const useMenu = (opts) => useBrontoBehavior(initMenu, opts);
|
|
116
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
68
117
|
export const useFormValidation = (opts) => useBrontoBehavior(initFormValidation, opts);
|
|
118
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
69
119
|
export const useCombobox = (opts) => useBrontoBehavior(initCombobox, opts);
|
|
120
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
70
121
|
export const usePopover = (opts) => useBrontoBehavior(initPopover, opts);
|
|
122
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
71
123
|
export const useTableSort = (opts) => useBrontoBehavior(initTableSort, opts);
|
|
124
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
72
125
|
export const useTabs = (opts) => useBrontoBehavior(initTabs, opts);
|
|
126
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
73
127
|
export const useDialog = (opts) => useBrontoBehavior(initDialog, opts);
|
|
128
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
74
129
|
export const useCarousel = (opts) => useBrontoBehavior(initCarousel, opts);
|
|
130
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
75
131
|
export const useDotGlyph = (opts) => useBrontoBehavior(initDotGlyph, opts);
|
|
132
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
133
|
+
export const useLegend = (opts) => useBrontoBehavior(initLegend, opts);
|
|
134
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
135
|
+
export const useConnectors = (opts) => useBrontoBehavior(initConnectors, opts);
|
|
136
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
137
|
+
export const useSpotlight = (opts) => useBrontoBehavior(initSpotlight, opts);
|
|
138
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
139
|
+
export const useCrosshair = (opts) => useBrontoBehavior(initCrosshair, opts);
|
|
140
|
+
/** @type {(opts?: BrontoBindingOptsResolver) => void} */
|
|
141
|
+
export const useCommand = (opts) => useBrontoBehavior(initCommand, opts);
|
|
76
142
|
|
|
77
|
-
/** The `toast()` imperative (no lifecycle of its own).
|
|
143
|
+
/** The `toast()` imperative (no lifecycle of its own).
|
|
144
|
+
* @type {() => (message: string, opts?: ToastOpts) => Cleanup} */
|
|
78
145
|
export const useToast = () => toast;
|
|
79
146
|
|
|
80
147
|
// No-flash theme application must run before paint — do it in an inline head
|
package/tokens/d2.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** @ponchia/ui — GENERATED from the token source by scripts/gen-d2.mjs.
|
|
2
|
+
* Do not edit by hand; run `npm run d2:build`. Drift-checked in CI. */
|
|
3
|
+
|
|
4
|
+
/** Resolved D2 theme colour slots (hex). See docs/d2.md for what each paints. */
|
|
5
|
+
export interface D2ThemeOverrides {
|
|
6
|
+
N1: string;
|
|
7
|
+
N2: string;
|
|
8
|
+
N3: string;
|
|
9
|
+
N4: string;
|
|
10
|
+
N5: string;
|
|
11
|
+
N6: string;
|
|
12
|
+
N7: string;
|
|
13
|
+
B1: string;
|
|
14
|
+
B2: string;
|
|
15
|
+
B3: string;
|
|
16
|
+
B4: string;
|
|
17
|
+
B5: string;
|
|
18
|
+
B6: string;
|
|
19
|
+
AA2: string;
|
|
20
|
+
AA4: string;
|
|
21
|
+
AA5: string;
|
|
22
|
+
AB4: string;
|
|
23
|
+
AB5: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Resolved D2 theme overrides for each bronto theme. */
|
|
27
|
+
export declare const d2: { light: D2ThemeOverrides; dark: D2ThemeOverrides };
|
|
28
|
+
|
|
29
|
+
/** A D2 source snippet (`vars: { d2-config: { theme-overrides, dark-theme-overrides } }`)
|
|
30
|
+
* to prepend to a diagram. */
|
|
31
|
+
export declare function brontoD2Vars(): string;
|
|
32
|
+
|
|
33
|
+
/** The slot → hex map for a theme (default `light`), for the render API's
|
|
34
|
+
* themeOverrides / darkThemeOverrides. */
|
|
35
|
+
export declare function brontoD2Overrides(theme?: 'light' | 'dark'): D2ThemeOverrides;
|
|
36
|
+
|
|
37
|
+
declare const _default: typeof brontoD2Vars;
|
|
38
|
+
export default _default;
|
package/tokens/d2.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** @ponchia/ui — GENERATED from the token source by scripts/gen-d2.mjs.
|
|
2
|
+
* Do not edit by hand; run `npm run d2:build`. Drift-checked in CI.
|
|
3
|
+
*
|
|
4
|
+
* On-brand D2 (d2lang.com) theme overrides, resolved to static hex per
|
|
5
|
+
* theme. D2 compiles to a frozen SVG and cannot read `var(--x)`. Apply via
|
|
6
|
+
* the D2 source vars block (brontoD2Vars) or the Go/WASM render API
|
|
7
|
+
* (brontoD2Overrides). See docs/d2.md. */
|
|
8
|
+
|
|
9
|
+
/** Resolved D2 theme colour slots for each bronto theme. */
|
|
10
|
+
export const d2 = {
|
|
11
|
+
light: {
|
|
12
|
+
N1: '#0a0a0a',
|
|
13
|
+
N2: '#353533',
|
|
14
|
+
N3: '#686863',
|
|
15
|
+
N4: '#a8a8a2',
|
|
16
|
+
N5: '#d8d8d4',
|
|
17
|
+
N6: '#ececea',
|
|
18
|
+
N7: '#f4f4f2',
|
|
19
|
+
B1: '#a8a8a2',
|
|
20
|
+
B2: '#d8d8d4',
|
|
21
|
+
B3: '#d8d8d4',
|
|
22
|
+
B4: '#ececea',
|
|
23
|
+
B5: '#fbfbfa',
|
|
24
|
+
B6: '#ffffff',
|
|
25
|
+
AA2: '#a8a8a2',
|
|
26
|
+
AA4: '#ffffff',
|
|
27
|
+
AA5: '#ececea',
|
|
28
|
+
AB4: '#ffffff',
|
|
29
|
+
AB5: '#ececea',
|
|
30
|
+
},
|
|
31
|
+
dark: {
|
|
32
|
+
N1: '#e6e6e6',
|
|
33
|
+
N2: '#c8c8c8',
|
|
34
|
+
N3: '#a0a0a0',
|
|
35
|
+
N4: '#555555',
|
|
36
|
+
N5: '#383838',
|
|
37
|
+
N6: '#242424',
|
|
38
|
+
N7: '#121212',
|
|
39
|
+
B1: '#555555',
|
|
40
|
+
B2: '#383838',
|
|
41
|
+
B3: '#383838',
|
|
42
|
+
B4: '#242424',
|
|
43
|
+
B5: '#181818',
|
|
44
|
+
B6: '#1c1c1c',
|
|
45
|
+
AA2: '#555555',
|
|
46
|
+
AA4: '#1c1c1c',
|
|
47
|
+
AA5: '#242424',
|
|
48
|
+
AB4: '#1c1c1c',
|
|
49
|
+
AB5: '#242424',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
function block(map) {
|
|
54
|
+
return Object.entries(map)
|
|
55
|
+
.map(([slot, hex]) => ` ${slot}: "${hex}"`)
|
|
56
|
+
.join('\n');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** A D2 source snippet to prepend to a diagram — sets the bronto palette for
|
|
60
|
+
* both light and dark via `vars.d2-config`. */
|
|
61
|
+
export function brontoD2Vars() {
|
|
62
|
+
return `vars: {\n d2-config: {\n theme-overrides: {\n${block(d2.light)}\n }\n dark-theme-overrides: {\n${block(d2.dark)}\n }\n }\n}\n`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The slot → hex map for a theme (default `light`), for the Go/WASM render
|
|
66
|
+
* API's themeOverrides / darkThemeOverrides. */
|
|
67
|
+
export function brontoD2Overrides(theme = 'light') {
|
|
68
|
+
return d2[theme === 'dark' ? 'dark' : 'light'];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default brontoD2Vars;
|
package/tokens/d2.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "@ponchia/ui D2 theme colour slots resolved to static hex per theme. Drop into a D2 diagram's `vars: { d2-config: { theme-overrides, dark-theme-overrides } }` (see brontoD2Vars in @ponchia/ui/d2), or pass to the Go/WASM render API. Monochrome base ramp + one rationed accent. Generated from the token source — do not edit by hand; run `npm run d2:build`. Drift-checked in CI.",
|
|
3
|
+
"light": {
|
|
4
|
+
"N1": "#0a0a0a",
|
|
5
|
+
"N2": "#353533",
|
|
6
|
+
"N3": "#686863",
|
|
7
|
+
"N4": "#a8a8a2",
|
|
8
|
+
"N5": "#d8d8d4",
|
|
9
|
+
"N6": "#ececea",
|
|
10
|
+
"N7": "#f4f4f2",
|
|
11
|
+
"B1": "#a8a8a2",
|
|
12
|
+
"B2": "#d8d8d4",
|
|
13
|
+
"B3": "#d8d8d4",
|
|
14
|
+
"B4": "#ececea",
|
|
15
|
+
"B5": "#fbfbfa",
|
|
16
|
+
"B6": "#ffffff",
|
|
17
|
+
"AA2": "#a8a8a2",
|
|
18
|
+
"AA4": "#ffffff",
|
|
19
|
+
"AA5": "#ececea",
|
|
20
|
+
"AB4": "#ffffff",
|
|
21
|
+
"AB5": "#ececea"
|
|
22
|
+
},
|
|
23
|
+
"dark": {
|
|
24
|
+
"N1": "#e6e6e6",
|
|
25
|
+
"N2": "#c8c8c8",
|
|
26
|
+
"N3": "#a0a0a0",
|
|
27
|
+
"N4": "#555555",
|
|
28
|
+
"N5": "#383838",
|
|
29
|
+
"N6": "#242424",
|
|
30
|
+
"N7": "#121212",
|
|
31
|
+
"B1": "#555555",
|
|
32
|
+
"B2": "#383838",
|
|
33
|
+
"B3": "#383838",
|
|
34
|
+
"B4": "#242424",
|
|
35
|
+
"B5": "#181818",
|
|
36
|
+
"B6": "#1c1c1c",
|
|
37
|
+
"AA2": "#555555",
|
|
38
|
+
"AA4": "#1c1c1c",
|
|
39
|
+
"AA5": "#242424",
|
|
40
|
+
"AB4": "#1c1c1c",
|
|
41
|
+
"AB5": "#242424"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/tokens/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
export type ThemeName = 'light' | 'dark';
|
|
5
5
|
|
|
6
|
-
export type GlobalTokenName = '--radius-xl' | '--radius-lg' | '--radius-md' | '--radius-sm' | '--radius-pill' | '--space-2xs' | '--space-xs' | '--space-sm' | '--space-md' | '--space-lg' | '--space-xl' | '--space-2xl' | '--mono' | '--sans' | '--dot-font' | '--display' | '--text-2xs' | '--text-xs' | '--text-sm' | '--text-base' | '--text-lg' | '--text-xl' | '--tracking-wide' | '--tracking-wider' | '--ease-standard' | '--ease-spring' | '--ease-out' | '--duration-fast' | '--duration-base' | '--duration-slow' | '--dot-size' | '--dot-gap' | '--z-base' | '--z-raised' | '--z-sticky' | '--z-overlay' | '--z-popover' | '--z-toast' | '--accent-1' | '--accent-2' | '--accent-3' | '--accent-4' | '--accent-5' | '--accent-6' | '--surface-1' | '--surface-2' | '--surface-3' | '--surface-4' | '--surface-5' | '--surface-6' | '--bronto-color-bg' | '--bronto-color-surface' | '--bronto-color-surface-raised' | '--bronto-color-border' | '--bronto-color-border-strong' | '--bronto-color-text' | '--bronto-color-text-muted' | '--bronto-color-action' | '--bronto-color-on-action' | '--bronto-color-focus' | '--bronto-color-success' | '--bronto-color-warning' | '--bronto-color-danger' | '--bronto-color-info' | '--surface' | '--surface-raised' | '--surface-muted' | '--border' | '--border-strong';
|
|
7
|
-
export type LightTokenName = '--bg' | '--bg-elevated' | '--bg-accent' | '--panel' | '--panel-strong' | '--panel-soft' | '--line' | '--line-strong' | '--text' | '--text-soft' | '--text-dim' | '--accent' | '--accent-ramp-end' | '--accent-strong' | '--accent-text' | '--accent-soft' | '--success' | '--success-soft' | '--warning' | '--warning-soft' | '--danger' | '--danger-soft' | '--info' | '--info-soft' | '--code-bg' | '--button-text' | '--field-dot' | '--field-dot-hot' | '--field-dot-accent' | '--focus-ring' | '--shadow' | '--shadow-raised';
|
|
8
|
-
export type DarkTokenName = '--bg' | '--bg-elevated' | '--bg-accent' | '--panel' | '--panel-strong' | '--panel-soft' | '--line' | '--line-strong' | '--text' | '--text-soft' | '--text-dim' | '--accent' | '--accent-ramp-end' | '--accent-strong' | '--accent-text' | '--accent-soft' | '--success' | '--success-soft' | '--warning' | '--warning-soft' | '--danger' | '--danger-soft' | '--info' | '--info-soft' | '--code-bg' | '--button-text' | '--field-dot' | '--field-dot-hot' | '--field-dot-accent' | '--focus-ring' | '--shadow' | '--shadow-raised';
|
|
6
|
+
export type GlobalTokenName = '--radius-xl' | '--radius-lg' | '--radius-md' | '--radius-sm' | '--radius-pill' | '--space-2xs' | '--space-xs' | '--space-sm' | '--space-md' | '--space-lg' | '--space-xl' | '--space-2xl' | '--mono' | '--sans' | '--dot-font' | '--display' | '--display-weight' | '--display-weight-strong' | '--text-2xs' | '--text-xs' | '--text-sm' | '--text-base' | '--text-lg' | '--text-xl' | '--tracking-wide' | '--tracking-wider' | '--ease-standard' | '--ease-spring' | '--ease-out' | '--duration-fast' | '--duration-base' | '--duration-slow' | '--dot-size' | '--dot-gap' | '--z-base' | '--z-raised' | '--z-sticky' | '--z-overlay' | '--z-popover' | '--z-toast' | '--accent-1' | '--accent-2' | '--accent-3' | '--accent-4' | '--accent-5' | '--accent-6' | '--surface-1' | '--surface-2' | '--surface-3' | '--surface-4' | '--surface-5' | '--surface-6' | '--bronto-color-bg' | '--bronto-color-surface' | '--bronto-color-surface-raised' | '--bronto-color-border' | '--bronto-color-border-strong' | '--bronto-color-text' | '--bronto-color-text-muted' | '--bronto-color-action' | '--bronto-color-on-action' | '--bronto-color-focus' | '--bronto-color-success' | '--bronto-color-warning' | '--bronto-color-danger' | '--bronto-color-info' | '--surface' | '--surface-raised' | '--surface-muted' | '--border' | '--border-strong';
|
|
7
|
+
export type LightTokenName = '--bg' | '--bg-elevated' | '--bg-accent' | '--panel' | '--panel-strong' | '--panel-soft' | '--line' | '--line-strong' | '--text' | '--text-soft' | '--text-dim' | '--accent' | '--accent-ramp-end' | '--accent-strong' | '--accent-text' | '--on-accent' | '--accent-soft' | '--success' | '--success-soft' | '--warning' | '--warning-soft' | '--danger' | '--danger-soft' | '--info' | '--info-soft' | '--code-bg' | '--button-text' | '--field-dot' | '--field-dot-hot' | '--field-dot-accent' | '--focus-ring' | '--shadow' | '--shadow-raised';
|
|
8
|
+
export type DarkTokenName = '--bg' | '--bg-elevated' | '--bg-accent' | '--panel' | '--panel-strong' | '--panel-soft' | '--line' | '--line-strong' | '--text' | '--text-soft' | '--text-dim' | '--accent' | '--accent-ramp-end' | '--accent-strong' | '--accent-text' | '--on-accent' | '--accent-soft' | '--success' | '--success-soft' | '--warning' | '--warning-soft' | '--danger' | '--danger-soft' | '--info' | '--info-soft' | '--code-bg' | '--button-text' | '--field-dot' | '--field-dot-hot' | '--field-dot-accent' | '--focus-ring' | '--shadow' | '--shadow-raised';
|
|
9
9
|
|
|
10
10
|
/** Exact mirror of the :root blocks in css/tokens.css (literal keys). */
|
|
11
11
|
export declare const cssVars: {
|
|
@@ -14,8 +14,8 @@ export declare const cssVars: {
|
|
|
14
14
|
dark: Record<DarkTokenName, string>;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export type ScaleKey = 'radius-xl' | 'radius-lg' | 'radius-md' | 'radius-sm' | 'radius-pill' | 'space-2xs' | 'space-xs' | 'space-sm' | 'space-md' | 'space-lg' | 'space-xl' | 'space-2xl' | 'mono' | 'sans' | 'dot-font' | 'display' | 'text-2xs' | 'text-xs' | 'text-sm' | 'text-base' | 'text-lg' | 'text-xl' | 'tracking-wide' | 'tracking-wider' | 'ease-standard' | 'ease-spring' | 'ease-out' | 'duration-fast' | 'duration-base' | 'duration-slow' | 'dot-size' | 'dot-gap' | 'z-base' | 'z-raised' | 'z-sticky' | 'z-overlay' | 'z-popover' | 'z-toast' | 'accent-1' | 'accent-2' | 'accent-3' | 'accent-4' | 'accent-5' | 'accent-6' | 'surface-1' | 'surface-2' | 'surface-3' | 'surface-4' | 'surface-5' | 'surface-6' | 'bronto-color-bg' | 'bronto-color-surface' | 'bronto-color-surface-raised' | 'bronto-color-border' | 'bronto-color-border-strong' | 'bronto-color-text' | 'bronto-color-text-muted' | 'bronto-color-action' | 'bronto-color-on-action' | 'bronto-color-focus' | 'bronto-color-success' | 'bronto-color-warning' | 'bronto-color-danger' | 'bronto-color-info' | 'surface' | 'surface-raised' | 'surface-muted' | 'border' | 'border-strong';
|
|
18
|
-
export type ColorKey = 'bg' | 'bg-elevated' | 'bg-accent' | 'panel' | 'panel-strong' | 'panel-soft' | 'line' | 'line-strong' | 'text' | 'text-soft' | 'text-dim' | 'accent' | 'accent-ramp-end' | 'accent-strong' | 'accent-text' | 'accent-soft' | 'success' | 'success-soft' | 'warning' | 'warning-soft' | 'danger' | 'danger-soft' | 'info' | 'info-soft' | 'code-bg' | 'button-text' | 'field-dot' | 'field-dot-hot' | 'field-dot-accent' | 'focus-ring' | 'shadow' | 'shadow-raised';
|
|
17
|
+
export type ScaleKey = 'radius-xl' | 'radius-lg' | 'radius-md' | 'radius-sm' | 'radius-pill' | 'space-2xs' | 'space-xs' | 'space-sm' | 'space-md' | 'space-lg' | 'space-xl' | 'space-2xl' | 'mono' | 'sans' | 'dot-font' | 'display' | 'display-weight' | 'display-weight-strong' | 'text-2xs' | 'text-xs' | 'text-sm' | 'text-base' | 'text-lg' | 'text-xl' | 'tracking-wide' | 'tracking-wider' | 'ease-standard' | 'ease-spring' | 'ease-out' | 'duration-fast' | 'duration-base' | 'duration-slow' | 'dot-size' | 'dot-gap' | 'z-base' | 'z-raised' | 'z-sticky' | 'z-overlay' | 'z-popover' | 'z-toast' | 'accent-1' | 'accent-2' | 'accent-3' | 'accent-4' | 'accent-5' | 'accent-6' | 'surface-1' | 'surface-2' | 'surface-3' | 'surface-4' | 'surface-5' | 'surface-6' | 'bronto-color-bg' | 'bronto-color-surface' | 'bronto-color-surface-raised' | 'bronto-color-border' | 'bronto-color-border-strong' | 'bronto-color-text' | 'bronto-color-text-muted' | 'bronto-color-action' | 'bronto-color-on-action' | 'bronto-color-focus' | 'bronto-color-success' | 'bronto-color-warning' | 'bronto-color-danger' | 'bronto-color-info' | 'surface' | 'surface-raised' | 'surface-muted' | 'border' | 'border-strong';
|
|
18
|
+
export type ColorKey = 'bg' | 'bg-elevated' | 'bg-accent' | 'panel' | 'panel-strong' | 'panel-soft' | 'line' | 'line-strong' | 'text' | 'text-soft' | 'text-dim' | 'accent' | 'accent-ramp-end' | 'accent-strong' | 'accent-text' | 'on-accent' | 'accent-soft' | 'success' | 'success-soft' | 'warning' | 'warning-soft' | 'danger' | 'danger-soft' | 'info' | 'info-soft' | 'code-bg' | 'button-text' | 'field-dot' | 'field-dot-hot' | 'field-dot-accent' | 'focus-ring' | 'shadow' | 'shadow-raised';
|
|
19
19
|
|
|
20
20
|
/** Ergonomic view derived from {@link cssVars} (`--` prefix stripped). */
|
|
21
21
|
export declare const tokens: {
|
package/tokens/index.js
CHANGED
|
@@ -4,16 +4,20 @@
|
|
|
4
4
|
* For consumers that need token values in JS rather than CSS: charting,
|
|
5
5
|
* canvas, inline styles, theme-aware logic, Style Dictionary / Figma sync.
|
|
6
6
|
*
|
|
7
|
-
* `cssVars` is the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* `cssVars` is the SINGLE SOURCE of truth for token values — keyed by the
|
|
8
|
+
* real custom-property name, values are the verbatim CSS strings. The four
|
|
9
|
+
* :root palette blocks of css/tokens.css are GENERATED from it
|
|
10
|
+
* (scripts/gen-tokens-css.mjs), so the dark palette is authored once here
|
|
11
|
+
* rather than in three places (the two CSS dark blocks + a JS mirror).
|
|
12
|
+
* Drift-checked by `npm run check:fresh` (scripts/check-fresh.mjs).
|
|
11
13
|
*
|
|
12
14
|
* `tokens` is an ergonomic view derived programmatically from `cssVars`
|
|
13
15
|
* (no second hand-maintained copy, so nothing to keep in sync).
|
|
14
16
|
*/
|
|
15
17
|
|
|
16
|
-
/**
|
|
18
|
+
/** Single source for token values; the css/tokens.css palette blocks are
|
|
19
|
+
* generated from this (scripts/gen-tokens-css.mjs). Edit values here, then run
|
|
20
|
+
* `npm run tokens:css:build`. Do not reshape — the generators consume it literally. */
|
|
17
21
|
export const cssVars = {
|
|
18
22
|
// Global :root — scales, shared with both themes.
|
|
19
23
|
global: {
|
|
@@ -34,6 +38,8 @@ export const cssVars = {
|
|
|
34
38
|
"'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
|
|
35
39
|
'--dot-font': "'Doto', var(--mono)",
|
|
36
40
|
'--display': 'var(--dot-font)',
|
|
41
|
+
'--display-weight': '700',
|
|
42
|
+
'--display-weight-strong': '800',
|
|
37
43
|
'--text-2xs': '0.68rem',
|
|
38
44
|
'--text-xs': '0.76rem',
|
|
39
45
|
'--text-sm': '0.86rem',
|
|
@@ -105,6 +111,12 @@ export const cssVars = {
|
|
|
105
111
|
'--accent-ramp-end': '#ffffff',
|
|
106
112
|
'--accent-strong': 'color-mix(in srgb, var(--accent) 83%, #000)',
|
|
107
113
|
'--accent-text': 'var(--accent-strong)',
|
|
114
|
+
// Read-only export: the resolved on-accent ink for FOREIGN renderers
|
|
115
|
+
// (D2/Mermaid/Vega labels on an accent fill — see tokens/*.json). In-DOM
|
|
116
|
+
// components paint their own on-accent ink from `--button-text`; overriding
|
|
117
|
+
// `--on-accent` in CSS does NOT change a button/chip. To re-ink in-DOM
|
|
118
|
+
// accent fills, set `--button-text`. (tokens review C7.)
|
|
119
|
+
'--on-accent': 'var(--button-text)',
|
|
108
120
|
'--accent-soft': 'color-mix(in srgb, var(--accent) 10%, transparent)',
|
|
109
121
|
'--success': '#2f7d4f',
|
|
110
122
|
'--success-soft': 'rgb(47, 125, 79, 0.12)',
|
|
@@ -140,6 +152,12 @@ export const cssVars = {
|
|
|
140
152
|
'--accent-ramp-end': '#000000',
|
|
141
153
|
'--accent-strong': 'color-mix(in srgb, var(--accent) 84%, #fff)',
|
|
142
154
|
'--accent-text': 'var(--accent-strong)',
|
|
155
|
+
// Read-only export: the resolved on-accent ink for FOREIGN renderers
|
|
156
|
+
// (D2/Mermaid/Vega labels on an accent fill — see tokens/*.json). In-DOM
|
|
157
|
+
// components paint their own on-accent ink from `--button-text`; overriding
|
|
158
|
+
// `--on-accent` in CSS does NOT change a button/chip. To re-ink in-DOM
|
|
159
|
+
// accent fills, set `--button-text`. (tokens review C7.)
|
|
160
|
+
'--on-accent': 'var(--button-text)',
|
|
143
161
|
'--accent-soft': 'color-mix(in srgb, var(--accent) 14%, transparent)',
|
|
144
162
|
'--success': '#4ec27e',
|
|
145
163
|
'--success-soft': 'rgb(78, 194, 126, 0.14)',
|