@gemologic/sheen 0.1.0-rc.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/LICENSE +19 -0
- package/README.md +32 -0
- package/dist/core.d.ts +52 -0
- package/dist/core.js +29 -0
- package/dist/formisch.d.ts +5 -0
- package/dist/formisch.js +22 -0
- package/dist/forms.d.ts +34 -0
- package/dist/forms.js +18 -0
- package/dist/index.d.ts +144 -0
- package/dist/index.js +75 -0
- package/dist/layout/Layout.d.ts +28 -0
- package/dist/layout/Layout.js +121 -0
- package/dist/metadata.d.ts +46 -0
- package/dist/metadata.js +47 -0
- package/dist/navigation.d.ts +30 -0
- package/dist/navigation.js +16 -0
- package/dist/overlays.d.ts +28 -0
- package/dist/overlays.js +15 -0
- package/dist/primitives/Accordion.d.ts +16 -0
- package/dist/primitives/Accordion.js +223 -0
- package/dist/primitives/ActivityTimeline.d.ts +20 -0
- package/dist/primitives/ActivityTimeline.js +104 -0
- package/dist/primitives/AlertDialog.d.ts +7 -0
- package/dist/primitives/AlertDialog.js +8 -0
- package/dist/primitives/Avatar.d.ts +22 -0
- package/dist/primitives/Avatar.js +115 -0
- package/dist/primitives/Breadcrumb.d.ts +11 -0
- package/dist/primitives/Breadcrumb.js +66 -0
- package/dist/primitives/Button.d.ts +11 -0
- package/dist/primitives/Button.js +59 -0
- package/dist/primitives/ButtonGroup.d.ts +7 -0
- package/dist/primitives/ButtonGroup.js +33 -0
- package/dist/primitives/Checkbox.d.ts +22 -0
- package/dist/primitives/Checkbox.js +93 -0
- package/dist/primitives/CheckboxGroup.d.ts +18 -0
- package/dist/primitives/CheckboxGroup.js +122 -0
- package/dist/primitives/Collapsible.d.ts +9 -0
- package/dist/primitives/Collapsible.js +72 -0
- package/dist/primitives/Combobox.d.ts +41 -0
- package/dist/primitives/Combobox.js +684 -0
- package/dist/primitives/CommandPalette.d.ts +42 -0
- package/dist/primitives/CommandPalette.js +319 -0
- package/dist/primitives/ConfirmDialog.d.ts +11 -0
- package/dist/primitives/ConfirmDialog.js +42 -0
- package/dist/primitives/ContextMenu.d.ts +16 -0
- package/dist/primitives/ContextMenu.js +132 -0
- package/dist/primitives/DescriptionList.d.ts +11 -0
- package/dist/primitives/DescriptionList.js +44 -0
- package/dist/primitives/Dialog.d.ts +21 -0
- package/dist/primitives/Dialog.js +141 -0
- package/dist/primitives/Drawer.d.ts +9 -0
- package/dist/primitives/Drawer.js +21 -0
- package/dist/primitives/DropdownMenu.d.ts +59 -0
- package/dist/primitives/DropdownMenu.js +441 -0
- package/dist/primitives/EditableTextField.d.ts +11 -0
- package/dist/primitives/EditableTextField.js +126 -0
- package/dist/primitives/EmptyState.d.ts +7 -0
- package/dist/primitives/EmptyState.js +45 -0
- package/dist/primitives/Field.d.ts +18 -0
- package/dist/primitives/Field.js +72 -0
- package/dist/primitives/FileDropzone.d.ts +40 -0
- package/dist/primitives/FileDropzone.js +261 -0
- package/dist/primitives/IconButton.d.ts +8 -0
- package/dist/primitives/IconButton.js +34 -0
- package/dist/primitives/Input.d.ts +7 -0
- package/dist/primitives/Input.js +55 -0
- package/dist/primitives/InputGroup.d.ts +7 -0
- package/dist/primitives/InputGroup.js +73 -0
- package/dist/primitives/Link.d.ts +7 -0
- package/dist/primitives/Link.js +35 -0
- package/dist/primitives/LinkTooltip.d.ts +11 -0
- package/dist/primitives/LinkTooltip.js +88 -0
- package/dist/primitives/NavList.d.ts +17 -0
- package/dist/primitives/NavList.js +143 -0
- package/dist/primitives/Notice.d.ts +8 -0
- package/dist/primitives/Notice.js +64 -0
- package/dist/primitives/NumberField.d.ts +22 -0
- package/dist/primitives/NumberField.js +177 -0
- package/dist/primitives/Pagination.d.ts +12 -0
- package/dist/primitives/Pagination.js +127 -0
- package/dist/primitives/Popover.d.ts +12 -0
- package/dist/primitives/Popover.js +103 -0
- package/dist/primitives/Progress.d.ts +17 -0
- package/dist/primitives/Progress.js +98 -0
- package/dist/primitives/RadioGroup.d.ts +19 -0
- package/dist/primitives/RadioGroup.js +173 -0
- package/dist/primitives/Resizable.d.ts +36 -0
- package/dist/primitives/Resizable.js +196 -0
- package/dist/primitives/ScrollArea.d.ts +6 -0
- package/dist/primitives/ScrollArea.js +178 -0
- package/dist/primitives/SearchInput.d.ts +12 -0
- package/dist/primitives/SearchInput.js +89 -0
- package/dist/primitives/SegmentedControl.d.ts +25 -0
- package/dist/primitives/SegmentedControl.js +188 -0
- package/dist/primitives/Select.d.ts +24 -0
- package/dist/primitives/Select.js +320 -0
- package/dist/primitives/Separator.d.ts +6 -0
- package/dist/primitives/Separator.js +31 -0
- package/dist/primitives/ShortcutPending.d.ts +6 -0
- package/dist/primitives/ShortcutPending.js +40 -0
- package/dist/primitives/ShortcutProvider.d.ts +32 -0
- package/dist/primitives/ShortcutProvider.js +172 -0
- package/dist/primitives/ShortcutScope.d.ts +6 -0
- package/dist/primitives/ShortcutScope.js +29 -0
- package/dist/primitives/ShortcutSheet.d.ts +5 -0
- package/dist/primitives/ShortcutSheet.js +87 -0
- package/dist/primitives/Skeleton.d.ts +5 -0
- package/dist/primitives/Skeleton.js +23 -0
- package/dist/primitives/Slider.d.ts +35 -0
- package/dist/primitives/Slider.js +210 -0
- package/dist/primitives/Spinner.d.ts +7 -0
- package/dist/primitives/Spinner.js +44 -0
- package/dist/primitives/Status.d.ts +15 -0
- package/dist/primitives/Status.js +78 -0
- package/dist/primitives/Stepper.d.ts +32 -0
- package/dist/primitives/Stepper.js +147 -0
- package/dist/primitives/Surface.d.ts +11 -0
- package/dist/primitives/Surface.js +58 -0
- package/dist/primitives/Switch.d.ts +4 -0
- package/dist/primitives/Switch.js +7 -0
- package/dist/primitives/Table.d.ts +23 -0
- package/dist/primitives/Table.js +101 -0
- package/dist/primitives/Tabs.d.ts +17 -0
- package/dist/primitives/Tabs.js +157 -0
- package/dist/primitives/TagInput.d.ts +33 -0
- package/dist/primitives/TagInput.js +288 -0
- package/dist/primitives/Textarea.d.ts +8 -0
- package/dist/primitives/Textarea.js +106 -0
- package/dist/primitives/Toast.d.ts +10 -0
- package/dist/primitives/Toast.js +78 -0
- package/dist/primitives/Toaster.d.ts +9 -0
- package/dist/primitives/Toaster.js +183 -0
- package/dist/primitives/Tooltip.d.ts +13 -0
- package/dist/primitives/Tooltip.js +84 -0
- package/dist/primitives/Tree.d.ts +23 -0
- package/dist/primitives/Tree.js +275 -0
- package/dist/primitives/Typography.d.ts +16 -0
- package/dist/primitives/Typography.js +82 -0
- package/dist/primitives/boolean-input-state.d.ts +14 -0
- package/dist/primitives/boolean-input-state.js +39 -0
- package/dist/primitives/button-variants.d.ts +9 -0
- package/dist/primitives/button-variants.js +7 -0
- package/dist/primitives/choice-options.d.ts +7 -0
- package/dist/primitives/choice-options.js +35 -0
- package/dist/primitives/create-confirm.d.ts +15 -0
- package/dist/primitives/create-confirm.js +49 -0
- package/dist/primitives/create-toaster.d.ts +51 -0
- package/dist/primitives/create-toaster.js +87 -0
- package/dist/primitives/link-focus.d.ts +2 -0
- package/dist/primitives/link-focus.js +38 -0
- package/dist/primitives/menu-focus.d.ts +3 -0
- package/dist/primitives/menu-focus.js +32 -0
- package/dist/primitives/tooltip-layer.d.ts +14 -0
- package/dist/primitives/tooltip-layer.js +84 -0
- package/dist/theme/ThemeProvider.d.ts +59 -0
- package/dist/theme/ThemeProvider.js +239 -0
- package/dist/theme/intl.d.ts +6 -0
- package/dist/theme/intl.js +13 -0
- package/dist/theme/keyboard-script.d.ts +2 -0
- package/dist/theme/keyboard-script.js +6 -0
- package/dist/theme/layers.d.ts +7 -0
- package/dist/theme/layers.js +23 -0
- package/dist/theme/messages.d.ts +235 -0
- package/dist/theme/messages.js +115 -0
- package/dist/theme/script.d.ts +9 -0
- package/dist/theme/script.js +49 -0
- package/dist/theme/state.d.ts +27 -0
- package/dist/theme/state.js +55 -0
- package/dist/utils/browser-status.d.ts +5 -0
- package/dist/utils/browser-status.js +22 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/utils/cn.js +7 -0
- package/dist/utils/optimistic.d.ts +6 -0
- package/dist/utils/optimistic.js +16 -0
- package/dist/utils/polymorphic.d.ts +1 -0
- package/dist/utils/shortcut-platform.d.ts +2 -0
- package/dist/utils/shortcut-platform.js +10 -0
- package/dist/utils/shortcut-registry.d.ts +61 -0
- package/dist/utils/shortcut-registry.js +186 -0
- package/package.json +100 -0
- package/src/core.ts +55 -0
- package/src/formisch.ts +28 -0
- package/src/forms.ts +34 -0
- package/src/index.ts +144 -0
- package/src/layout/Layout.tsx +43 -0
- package/src/metadata.d.ts +46 -0
- package/src/metadata.ts +66 -0
- package/src/navigation.ts +30 -0
- package/src/overlays.ts +28 -0
- package/src/primitives/Accordion.tsx +145 -0
- package/src/primitives/ActivityTimeline.tsx +72 -0
- package/src/primitives/AlertDialog.tsx +8 -0
- package/src/primitives/Avatar.tsx +85 -0
- package/src/primitives/Breadcrumb.tsx +41 -0
- package/src/primitives/Button.tsx +27 -0
- package/src/primitives/ButtonGroup.tsx +18 -0
- package/src/primitives/Checkbox.tsx +51 -0
- package/src/primitives/CheckboxGroup.tsx +73 -0
- package/src/primitives/Collapsible.tsx +43 -0
- package/src/primitives/Combobox.tsx +402 -0
- package/src/primitives/CommandPalette.tsx +234 -0
- package/src/primitives/ConfirmDialog.tsx +25 -0
- package/src/primitives/ContextMenu.tsx +100 -0
- package/src/primitives/DescriptionList.tsx +26 -0
- package/src/primitives/Dialog.tsx +81 -0
- package/src/primitives/Drawer.tsx +26 -0
- package/src/primitives/DropdownMenu.tsx +221 -0
- package/src/primitives/EditableTextField.tsx +91 -0
- package/src/primitives/EmptyState.tsx +21 -0
- package/src/primitives/Field.tsx +38 -0
- package/src/primitives/FileDropzone.tsx +189 -0
- package/src/primitives/IconButton.tsx +22 -0
- package/src/primitives/Input.tsx +17 -0
- package/src/primitives/InputGroup.tsx +23 -0
- package/src/primitives/Link.tsx +19 -0
- package/src/primitives/LinkTooltip.tsx +31 -0
- package/src/primitives/NavList.tsx +58 -0
- package/src/primitives/Notice.tsx +25 -0
- package/src/primitives/NumberField.tsx +168 -0
- package/src/primitives/Pagination.tsx +64 -0
- package/src/primitives/Popover.tsx +44 -0
- package/src/primitives/Progress.tsx +62 -0
- package/src/primitives/RadioGroup.tsx +104 -0
- package/src/primitives/Resizable.tsx +170 -0
- package/src/primitives/ScrollArea.tsx +115 -0
- package/src/primitives/SearchInput.tsx +98 -0
- package/src/primitives/SegmentedControl.tsx +140 -0
- package/src/primitives/Select.tsx +171 -0
- package/src/primitives/Separator.tsx +13 -0
- package/src/primitives/ShortcutPending.tsx +21 -0
- package/src/primitives/ShortcutProvider.tsx +179 -0
- package/src/primitives/ShortcutScope.tsx +17 -0
- package/src/primitives/ShortcutSheet.tsx +35 -0
- package/src/primitives/Skeleton.tsx +12 -0
- package/src/primitives/Slider.tsx +153 -0
- package/src/primitives/Spinner.tsx +19 -0
- package/src/primitives/Status.tsx +33 -0
- package/src/primitives/Stepper.tsx +106 -0
- package/src/primitives/Surface.tsx +21 -0
- package/src/primitives/Switch.tsx +9 -0
- package/src/primitives/Table.tsx +57 -0
- package/src/primitives/Tabs.tsx +96 -0
- package/src/primitives/TagInput.tsx +282 -0
- package/src/primitives/Textarea.tsx +77 -0
- package/src/primitives/Toast.tsx +36 -0
- package/src/primitives/Toaster.tsx +175 -0
- package/src/primitives/Tooltip.tsx +41 -0
- package/src/primitives/Tree.tsx +256 -0
- package/src/primitives/Typography.tsx +39 -0
- package/src/primitives/boolean-input-state.ts +65 -0
- package/src/primitives/button-variants.ts +20 -0
- package/src/primitives/choice-options.ts +39 -0
- package/src/primitives/create-confirm.tsx +56 -0
- package/src/primitives/create-toaster.ts +128 -0
- package/src/primitives/link-focus.ts +38 -0
- package/src/primitives/menu-focus.ts +43 -0
- package/src/primitives/tooltip-layer.tsx +53 -0
- package/src/styles.css +655 -0
- package/src/theme/ThemeProvider.tsx +215 -0
- package/src/theme/intl.ts +14 -0
- package/src/theme/keyboard-script.ts +4 -0
- package/src/theme/layers.ts +16 -0
- package/src/theme/messages.ts +157 -0
- package/src/theme/script.ts +70 -0
- package/src/theme/state.ts +48 -0
- package/src/utils/browser-status.ts +36 -0
- package/src/utils/cn.ts +5 -0
- package/src/utils/optimistic.ts +22 -0
- package/src/utils/polymorphic.ts +1 -0
- package/src/utils/shortcut-platform.ts +4 -0
- package/src/utils/shortcut-registry.ts +216 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
//#region src/utils/shortcut-registry.ts
|
|
2
|
+
var e = /* @__PURE__ */ new Map([
|
|
3
|
+
["esc", "escape"],
|
|
4
|
+
["return", "enter"],
|
|
5
|
+
["space", " "],
|
|
6
|
+
["plus", "+"]
|
|
7
|
+
]), t = (t) => e.get(t.toLowerCase()) ?? t.toLowerCase(), n = (e) => JSON.stringify([
|
|
8
|
+
e.ctrl,
|
|
9
|
+
e.meta,
|
|
10
|
+
e.alt,
|
|
11
|
+
e.shift,
|
|
12
|
+
e.key
|
|
13
|
+
]), r = (e) => (e.ctrl || e.meta) && [
|
|
14
|
+
"r",
|
|
15
|
+
"l",
|
|
16
|
+
"t",
|
|
17
|
+
"w"
|
|
18
|
+
].includes(e.key);
|
|
19
|
+
function i(e, n) {
|
|
20
|
+
let i = e.trim().toLowerCase().split("+").map((e) => e.trim()), a = i.pop();
|
|
21
|
+
if (!a || /\s/.test(a)) throw Error(`Expected one shortcut chord: ${e}`);
|
|
22
|
+
let o = /* @__PURE__ */ new Set();
|
|
23
|
+
for (let t of i) {
|
|
24
|
+
let r = t === "mod" ? n === "mac" ? "meta" : "ctrl" : t;
|
|
25
|
+
if (![
|
|
26
|
+
"ctrl",
|
|
27
|
+
"meta",
|
|
28
|
+
"alt",
|
|
29
|
+
"shift"
|
|
30
|
+
].includes(r) || o.has(r)) throw Error(`Invalid or duplicate shortcut modifier: ${e}`);
|
|
31
|
+
o.add(r);
|
|
32
|
+
}
|
|
33
|
+
let s = t(a);
|
|
34
|
+
if ([
|
|
35
|
+
"ctrl",
|
|
36
|
+
"meta",
|
|
37
|
+
"alt",
|
|
38
|
+
"shift",
|
|
39
|
+
"mod"
|
|
40
|
+
].includes(s)) throw Error(`Shortcut requires a non-modifier key: ${e}`);
|
|
41
|
+
let c = o.has("shift") && !(s.length === 1 && /[^a-z0-9 ]/.test(s)), l = {
|
|
42
|
+
key: s,
|
|
43
|
+
ctrl: o.has("ctrl"),
|
|
44
|
+
meta: o.has("meta"),
|
|
45
|
+
alt: o.has("alt"),
|
|
46
|
+
shift: c
|
|
47
|
+
};
|
|
48
|
+
if (r(l)) throw Error(`Reserved browser shortcut: ${e}`);
|
|
49
|
+
return l;
|
|
50
|
+
}
|
|
51
|
+
function a(e) {
|
|
52
|
+
let a = /* @__PURE__ */ new Map(), o = 0, s = !1, c, l, u = () => Object.freeze([...a].flatMap(([e, t]) => [...t.values()].flatMap((t) => t.map((n, r) => Object.freeze({
|
|
53
|
+
id: n.id,
|
|
54
|
+
scope: e,
|
|
55
|
+
keys: n.definition.keys,
|
|
56
|
+
displayKeys: n.displayKeys,
|
|
57
|
+
label: n.definition.label,
|
|
58
|
+
group: n.definition.group,
|
|
59
|
+
characterOnly: n.characterOnly,
|
|
60
|
+
shadowed: r < t.length - 1
|
|
61
|
+
}))))), d = () => {
|
|
62
|
+
l !== void 0 && clearTimeout(l), l = void 0, c && (c = void 0, e.onPending?.(Object.freeze([])));
|
|
63
|
+
}, f = (t) => {
|
|
64
|
+
let n = t.definition.run();
|
|
65
|
+
n && Promise.resolve(n).catch((n) => {
|
|
66
|
+
if (!s && t.active) try {
|
|
67
|
+
e.onError ? e.onError(n) : queueMicrotask(() => {
|
|
68
|
+
throw n;
|
|
69
|
+
});
|
|
70
|
+
} catch (e) {
|
|
71
|
+
queueMicrotask(() => {
|
|
72
|
+
throw e;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}, p = (t, n, r, i, a) => {
|
|
77
|
+
d(), a?.();
|
|
78
|
+
let o = t.find((e) => e.chords.length === n);
|
|
79
|
+
return o ? f(o) : (c = {
|
|
80
|
+
entries: t,
|
|
81
|
+
completed: n,
|
|
82
|
+
scopes: JSON.stringify(r),
|
|
83
|
+
expires: performance.now() + 1e3,
|
|
84
|
+
characterShortcuts: i
|
|
85
|
+
}, l = setTimeout(d, 1e3), e.onPending?.(Object.freeze(t.map((e) => Object.freeze({
|
|
86
|
+
keys: e.definition.keys,
|
|
87
|
+
displayKeys: e.displayKeys,
|
|
88
|
+
label: e.definition.label,
|
|
89
|
+
scope: e.definition.scope,
|
|
90
|
+
completed: n
|
|
91
|
+
}))))), !0;
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
cancelPending: d,
|
|
95
|
+
register(t) {
|
|
96
|
+
if (s) throw Error("Cannot register a shortcut on a disposed registry");
|
|
97
|
+
if (t.developmentOnly && !e.development) return () => {};
|
|
98
|
+
if (!t.scope.trim() || !t.label.trim() || !t.group.trim()) throw Error("Shortcuts require nonempty scope, label, and group");
|
|
99
|
+
let r = t.keys.trim().replace(/\s*\+\s*/g, "+").split(/\s+/).map((t, n) => {
|
|
100
|
+
let r = i(t, e.platform);
|
|
101
|
+
if (n > 0 && r.key === "escape" && !r.ctrl && !r.meta && !r.alt && !r.shift) throw Error("Escape is reserved for cancelling a pending sequence");
|
|
102
|
+
return r;
|
|
103
|
+
}), l = r.map(n), f = /* @__PURE__ */ new Map([
|
|
104
|
+
["escape", "Esc"],
|
|
105
|
+
[" ", "Space"],
|
|
106
|
+
["enter", "Enter"]
|
|
107
|
+
]), p = r.map((t) => [
|
|
108
|
+
t.ctrl ? "Ctrl" : "",
|
|
109
|
+
t.alt ? e.platform === "mac" ? "⌥" : "Alt" : "",
|
|
110
|
+
t.shift ? e.platform === "mac" ? "⇧" : "Shift" : "",
|
|
111
|
+
t.meta ? e.platform === "mac" ? "⌘" : "Meta" : "",
|
|
112
|
+
f.get(t.key) ?? t.key.toUpperCase()
|
|
113
|
+
].filter(Boolean).join("+")).join(" → "), m = r.every((e) => !e.ctrl && !e.meta && !e.alt && Array.from(e.key).length === 1), h = JSON.stringify(l), g = a.get(t.scope) ?? /* @__PURE__ */ new Map();
|
|
114
|
+
for (let e of g.values()) {
|
|
115
|
+
let n = e.at(-1);
|
|
116
|
+
if (n && n.chords.length !== l.length && n.chords.slice(0, Math.min(n.chords.length, l.length)).every((e, t) => e === l[t])) throw Error(`Ambiguous shortcut prefix in ${t.scope}: "${n.definition.label}" and "${t.label}"`);
|
|
117
|
+
}
|
|
118
|
+
let _ = g.get(h) ?? [], v = _.at(-1);
|
|
119
|
+
if (v) {
|
|
120
|
+
let n = `Shortcut collision in ${t.scope}: "${v.definition.label}" and "${t.label}" (${t.keys})`;
|
|
121
|
+
if (e.development) throw Error(n);
|
|
122
|
+
(e.warn ?? console.warn)(n);
|
|
123
|
+
}
|
|
124
|
+
d();
|
|
125
|
+
let y = {
|
|
126
|
+
definition: Object.freeze({ ...t }),
|
|
127
|
+
chords: l,
|
|
128
|
+
displayKeys: p,
|
|
129
|
+
characterOnly: m,
|
|
130
|
+
id: ++o,
|
|
131
|
+
active: !0
|
|
132
|
+
};
|
|
133
|
+
return _.push(y), g.set(h, _), a.set(t.scope, g), e.onChange?.(u()), () => {
|
|
134
|
+
c?.entries.includes(y) && d(), y.active = !1;
|
|
135
|
+
let n = _.indexOf(y);
|
|
136
|
+
n < 0 || (_.splice(n, 1), _.length || g.delete(h), g.size || a.delete(t.scope), e.onChange?.(u()));
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
dispatch(e, i, o) {
|
|
140
|
+
if (s || e.repeat) return !1;
|
|
141
|
+
if (e.composing) return d(), !1;
|
|
142
|
+
let l = t(e.key), u = e.characterShortcuts !== !1, f = {
|
|
143
|
+
key: l,
|
|
144
|
+
ctrl: e.ctrlKey,
|
|
145
|
+
meta: e.metaKey,
|
|
146
|
+
alt: e.altKey,
|
|
147
|
+
shift: e.shiftKey && !(l.length === 1 && /[^a-z0-9 ]/.test(l))
|
|
148
|
+
};
|
|
149
|
+
if (r(f) || e.editing && !f.ctrl && !f.meta) return d(), !1;
|
|
150
|
+
if (c && (c.characterShortcuts !== u || c.scopes !== JSON.stringify(i) || performance.now() >= c.expires) && d(), c) {
|
|
151
|
+
if (l === "escape" && !f.ctrl && !f.meta && !f.alt && !f.shift) return d(), o?.(), !0;
|
|
152
|
+
if ([
|
|
153
|
+
"control",
|
|
154
|
+
"meta",
|
|
155
|
+
"alt",
|
|
156
|
+
"shift"
|
|
157
|
+
].includes(l)) return !1;
|
|
158
|
+
let e = c, t = e.completed + 1, r = e.entries.filter((t) => t.active && t.chords[e.completed] === n(f));
|
|
159
|
+
if (r.length) return p(r, t, i, u, o);
|
|
160
|
+
d();
|
|
161
|
+
}
|
|
162
|
+
for (let e of [...i].reverse()) {
|
|
163
|
+
let t = [...a.get(e)?.values() ?? []].flatMap((e) => {
|
|
164
|
+
let t = e.at(-1);
|
|
165
|
+
return t?.chords[0] === n(f) && (u || !t.characterOnly) ? [t] : [];
|
|
166
|
+
});
|
|
167
|
+
if (t.length) return p(t, 1, i, u, o);
|
|
168
|
+
}
|
|
169
|
+
return !1;
|
|
170
|
+
},
|
|
171
|
+
snapshot: u,
|
|
172
|
+
run(e) {
|
|
173
|
+
if (s || !Number.isSafeInteger(e)) return !1;
|
|
174
|
+
for (let t of a.values()) for (let n of t.values()) {
|
|
175
|
+
let t = n.at(-1);
|
|
176
|
+
if (t?.id === e && t.active) return d(), f(t), !0;
|
|
177
|
+
}
|
|
178
|
+
return !1;
|
|
179
|
+
},
|
|
180
|
+
dispose() {
|
|
181
|
+
s || (s = !0, d(), a.clear(), e.onChange?.(u()));
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
export { a as createShortcutRegistry };
|
package/package.json
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gemologic/sheen",
|
|
3
|
+
"version": "0.1.0-rc.0",
|
|
4
|
+
"description": "Accessible, themeable SolidJS components for application interfaces.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/gemologic/sheen.git",
|
|
10
|
+
"directory": "packages/ui"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://sheen.gemologic.dev",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/gemologic/sheen/issues"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public",
|
|
18
|
+
"provenance": true
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"src",
|
|
23
|
+
"!dist/**/*.test.*",
|
|
24
|
+
"!dist/**/*.demo.*",
|
|
25
|
+
"!dist/**/*.meta.*",
|
|
26
|
+
"!src/**/*.test.*",
|
|
27
|
+
"!src/**/*.demo.*",
|
|
28
|
+
"!src/**/*.meta.*"
|
|
29
|
+
],
|
|
30
|
+
"sideEffects": [
|
|
31
|
+
"**/*.css"
|
|
32
|
+
],
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"solid": "./src/index.ts",
|
|
37
|
+
"import": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./core": {
|
|
40
|
+
"types": "./dist/core.d.ts",
|
|
41
|
+
"solid": "./src/core.ts",
|
|
42
|
+
"import": "./dist/core.js"
|
|
43
|
+
},
|
|
44
|
+
"./forms": {
|
|
45
|
+
"types": "./dist/forms.d.ts",
|
|
46
|
+
"solid": "./src/forms.ts",
|
|
47
|
+
"import": "./dist/forms.js"
|
|
48
|
+
},
|
|
49
|
+
"./overlays": {
|
|
50
|
+
"types": "./dist/overlays.d.ts",
|
|
51
|
+
"solid": "./src/overlays.ts",
|
|
52
|
+
"import": "./dist/overlays.js"
|
|
53
|
+
},
|
|
54
|
+
"./navigation": {
|
|
55
|
+
"types": "./dist/navigation.d.ts",
|
|
56
|
+
"solid": "./src/navigation.ts",
|
|
57
|
+
"import": "./dist/navigation.js"
|
|
58
|
+
},
|
|
59
|
+
"./formisch": {
|
|
60
|
+
"types": "./dist/formisch.d.ts",
|
|
61
|
+
"solid": "./src/formisch.ts",
|
|
62
|
+
"import": "./dist/formisch.js"
|
|
63
|
+
},
|
|
64
|
+
"./theme-script": {
|
|
65
|
+
"types": "./dist/theme/script.d.ts",
|
|
66
|
+
"solid": "./src/theme/script.ts",
|
|
67
|
+
"import": "./dist/theme/script.js"
|
|
68
|
+
},
|
|
69
|
+
"./metadata": {
|
|
70
|
+
"types": "./dist/metadata.d.ts",
|
|
71
|
+
"solid": "./src/metadata.ts",
|
|
72
|
+
"import": "./dist/metadata.js"
|
|
73
|
+
},
|
|
74
|
+
"./styles.css": "./src/styles.css"
|
|
75
|
+
},
|
|
76
|
+
"peerDependencies": {
|
|
77
|
+
"@formisch/solid": ">=1 <2",
|
|
78
|
+
"solid-js": "1.9.15"
|
|
79
|
+
},
|
|
80
|
+
"peerDependenciesMeta": {
|
|
81
|
+
"@formisch/solid": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"dependencies": {
|
|
86
|
+
"@corvu/resizable": "0.2.5",
|
|
87
|
+
"@gemologic/sheen-tokens": "0.1.0-rc.0",
|
|
88
|
+
"@kobalte/core": "0.13.13",
|
|
89
|
+
"clsx": "2.1.1",
|
|
90
|
+
"cmdk-solid": "1.2.0"
|
|
91
|
+
},
|
|
92
|
+
"devDependencies": {
|
|
93
|
+
"@formisch/solid": "1.0.0",
|
|
94
|
+
"solid-js": "1.9.15",
|
|
95
|
+
"valibot": "1.4.2"
|
|
96
|
+
},
|
|
97
|
+
"scripts": {
|
|
98
|
+
"build": "vite build && tsc -p tsconfig.build.json"
|
|
99
|
+
}
|
|
100
|
+
}
|
package/src/core.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export { ThemeProvider, ThemeScope, useTheme } from "./theme/ThemeProvider.tsx";
|
|
2
|
+
export type { ThemeProviderProps, ThemeScopeProps, ThemeContextValue } from "./theme/ThemeProvider.tsx";
|
|
3
|
+
export { defaultThemeState, resolveThemeState, readThemeState } from "./theme/state.ts";
|
|
4
|
+
export type { ThemeState, ThemeOverrides } from "./theme/state.ts";
|
|
5
|
+
export { createThemeScript } from "./theme/script.ts";
|
|
6
|
+
export { createKeyboardHydrationScript } from "./theme/keyboard-script.ts";
|
|
7
|
+
export { englishMessages } from "./theme/messages.ts";
|
|
8
|
+
export type { Messages } from "./theme/messages.ts";
|
|
9
|
+
export { useNumberFormatter, useDateFormatter } from "./theme/intl.ts";
|
|
10
|
+
|
|
11
|
+
export { Button } from "./primitives/Button.tsx";
|
|
12
|
+
export type { ButtonProps } from "./primitives/Button.tsx";
|
|
13
|
+
export { buttonVariants } from "./primitives/button-variants.ts";
|
|
14
|
+
export type { ButtonVariantProps } from "./primitives/button-variants.ts";
|
|
15
|
+
export { ButtonGroup } from "./primitives/ButtonGroup.tsx";
|
|
16
|
+
export type { ButtonGroupProps } from "./primitives/ButtonGroup.tsx";
|
|
17
|
+
export { IconButton } from "./primitives/IconButton.tsx";
|
|
18
|
+
export type { IconButtonProps } from "./primitives/IconButton.tsx";
|
|
19
|
+
export { Link } from "./primitives/Link.tsx";
|
|
20
|
+
export type { LinkProps } from "./primitives/Link.tsx";
|
|
21
|
+
export type { SheenPolymorphicProps } from "./utils/polymorphic.ts";
|
|
22
|
+
|
|
23
|
+
export { cn } from "./utils/cn.ts";
|
|
24
|
+
export { useOnlineStatus, useIsWindowFocused } from "./utils/browser-status.ts";
|
|
25
|
+
export { optimistic } from "./utils/optimistic.ts";
|
|
26
|
+
export type { OptimisticRevert } from "./utils/optimistic.ts";
|
|
27
|
+
|
|
28
|
+
export { Stack, Row, Row as Cluster, Grid, Container, Center, Spacer } from "./layout/Layout.tsx";
|
|
29
|
+
export type { StackProps, RowProps, GridProps, ContainerProps, CenterProps, SpacerProps, Spacing, Alignment, Justification } from "./layout/Layout.tsx";
|
|
30
|
+
export { Text, Heading, Code, Kbd } from "./primitives/Typography.tsx";
|
|
31
|
+
export type { TextProps, HeadingProps, CodeProps, KbdProps } from "./primitives/Typography.tsx";
|
|
32
|
+
export { Badge, Tag } from "./primitives/Status.tsx";
|
|
33
|
+
export type { BadgeProps, TagProps, StatusTone } from "./primitives/Status.tsx";
|
|
34
|
+
export { Surface, Card } from "./primitives/Surface.tsx";
|
|
35
|
+
export type { SurfaceProps, CardProps } from "./primitives/Surface.tsx";
|
|
36
|
+
export { Separator } from "./primitives/Separator.tsx";
|
|
37
|
+
export type { SeparatorProps } from "./primitives/Separator.tsx";
|
|
38
|
+
export { Alert, Callout } from "./primitives/Notice.tsx";
|
|
39
|
+
export type { AlertProps, CalloutProps } from "./primitives/Notice.tsx";
|
|
40
|
+
export { DescriptionList, DescriptionTerm, DescriptionDetails } from "./primitives/DescriptionList.tsx";
|
|
41
|
+
export type { DescriptionListProps, DescriptionTermProps, DescriptionDetailsProps } from "./primitives/DescriptionList.tsx";
|
|
42
|
+
export { Skeleton } from "./primitives/Skeleton.tsx";
|
|
43
|
+
export type { SkeletonProps } from "./primitives/Skeleton.tsx";
|
|
44
|
+
export { EmptyState } from "./primitives/EmptyState.tsx";
|
|
45
|
+
export type { EmptyStateProps } from "./primitives/EmptyState.tsx";
|
|
46
|
+
export { Spinner } from "./primitives/Spinner.tsx";
|
|
47
|
+
export type { SpinnerProps } from "./primitives/Spinner.tsx";
|
|
48
|
+
export { Table, TableCaption, TableHead, TableBody, TableFoot, TableRow, TableHeaderCell, TableCell } from "./primitives/Table.tsx";
|
|
49
|
+
export type { TableProps, TableCaptionProps, TableHeadProps, TableBodyProps, TableFootProps, TableRowProps, TableHeaderCellProps, TableCellProps } from "./primitives/Table.tsx";
|
|
50
|
+
export { Avatar, AvatarGroup } from "./primitives/Avatar.tsx";
|
|
51
|
+
export type { AvatarProps, AvatarGroupProps, AvatarItem, AvatarSize } from "./primitives/Avatar.tsx";
|
|
52
|
+
export { Progress, Meter } from "./primitives/Progress.tsx";
|
|
53
|
+
export type { ProgressProps, MeterProps } from "./primitives/Progress.tsx";
|
|
54
|
+
export { ActivityTimeline } from "./primitives/ActivityTimeline.tsx";
|
|
55
|
+
export type { ActivityTimelineProps, ActivityTimelineItem, WorkflowState } from "./primitives/ActivityTimeline.tsx";
|
package/src/formisch.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FieldStore, FormSchema, RequiredPath } from "@formisch/solid";
|
|
2
|
+
import type { JSX } from "solid-js";
|
|
3
|
+
import type { InputProps } from "./primitives/Input.tsx";
|
|
4
|
+
|
|
5
|
+
export type FormischInputBinding = Pick<InputProps, "name" | "value" | "error" | "autofocus" | "ref" | "onFocus" | "onInput" | "onChange" | "onBlur">;
|
|
6
|
+
|
|
7
|
+
function inputValue(value: unknown): string | number {
|
|
8
|
+
if (value === undefined || value === null) return "";
|
|
9
|
+
if (typeof value === "string" || typeof value === "number" && Number.isFinite(value)) return value;
|
|
10
|
+
throw new Error("formischInputProps supports string and finite-number fields only");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Maps a Formisch field store to the controlled attributes consumed by Sheen Input. */
|
|
14
|
+
export function formischInputProps<TSchema extends FormSchema, TFieldPath extends RequiredPath>(field: FieldStore<TSchema, TFieldPath>): FormischInputBinding {
|
|
15
|
+
const onInput: JSX.EventHandler<HTMLInputElement, InputEvent> = event => field.props.onInput(event);
|
|
16
|
+
const onChange: JSX.EventHandler<HTMLInputElement, Event> = event => field.props.onChange(event);
|
|
17
|
+
return {
|
|
18
|
+
name: field.props.name,
|
|
19
|
+
value: inputValue(field.input),
|
|
20
|
+
...(field.errors?.[0] === undefined ? {} : { error: field.errors[0] }),
|
|
21
|
+
autofocus: field.props.autofocus,
|
|
22
|
+
ref: element => field.props.ref(element),
|
|
23
|
+
onFocus: () => field.props.onFocus(),
|
|
24
|
+
onInput,
|
|
25
|
+
onChange,
|
|
26
|
+
onBlur: () => field.props.onBlur(),
|
|
27
|
+
};
|
|
28
|
+
}
|
package/src/forms.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { Field } from "./primitives/Field.tsx";
|
|
2
|
+
export type { FieldProps, FieldControlProps } from "./primitives/Field.tsx";
|
|
3
|
+
export { Input } from "./primitives/Input.tsx";
|
|
4
|
+
export type { InputProps } from "./primitives/Input.tsx";
|
|
5
|
+
export { InputGroup } from "./primitives/InputGroup.tsx";
|
|
6
|
+
export type { InputGroupProps } from "./primitives/InputGroup.tsx";
|
|
7
|
+
export { SearchInput } from "./primitives/SearchInput.tsx";
|
|
8
|
+
export type { SearchInputProps } from "./primitives/SearchInput.tsx";
|
|
9
|
+
export { Textarea } from "./primitives/Textarea.tsx";
|
|
10
|
+
export type { TextareaProps } from "./primitives/Textarea.tsx";
|
|
11
|
+
export { EditableTextField } from "./primitives/EditableTextField.tsx";
|
|
12
|
+
export type { EditableTextFieldProps } from "./primitives/EditableTextField.tsx";
|
|
13
|
+
export { Checkbox } from "./primitives/Checkbox.tsx";
|
|
14
|
+
export type { CheckboxProps } from "./primitives/Checkbox.tsx";
|
|
15
|
+
export { Switch } from "./primitives/Switch.tsx";
|
|
16
|
+
export type { SwitchProps } from "./primitives/Switch.tsx";
|
|
17
|
+
export { CheckboxGroup } from "./primitives/CheckboxGroup.tsx";
|
|
18
|
+
export type { CheckboxGroupProps, CheckboxOption } from "./primitives/CheckboxGroup.tsx";
|
|
19
|
+
export { RadioGroup } from "./primitives/RadioGroup.tsx";
|
|
20
|
+
export type { RadioGroupProps, RadioOption } from "./primitives/RadioGroup.tsx";
|
|
21
|
+
export { SegmentedControl } from "./primitives/SegmentedControl.tsx";
|
|
22
|
+
export type { SegmentedControlProps, SegmentedControlOption } from "./primitives/SegmentedControl.tsx";
|
|
23
|
+
export { TagInput } from "./primitives/TagInput.tsx";
|
|
24
|
+
export type { TagInputProps, TagInputValidationContext, TagInputValidationResult } from "./primitives/TagInput.tsx";
|
|
25
|
+
export { FileDropzone } from "./primitives/FileDropzone.tsx";
|
|
26
|
+
export type { FileDropzoneProps, FileDropzoneItem, FileDropzoneStatus, FileDropzoneRejection, FileDropzoneRejectionReason } from "./primitives/FileDropzone.tsx";
|
|
27
|
+
export { Select } from "./primitives/Select.tsx";
|
|
28
|
+
export type { SelectProps, SelectOption } from "./primitives/Select.tsx";
|
|
29
|
+
export { Combobox, MultiCombobox } from "./primitives/Combobox.tsx";
|
|
30
|
+
export type { ComboboxProps, MultiComboboxProps, ComboboxOption, ComboboxFilter } from "./primitives/Combobox.tsx";
|
|
31
|
+
export { NumberField } from "./primitives/NumberField.tsx";
|
|
32
|
+
export type { NumberFieldProps } from "./primitives/NumberField.tsx";
|
|
33
|
+
export { Slider, RangeSlider } from "./primitives/Slider.tsx";
|
|
34
|
+
export type { SliderProps, RangeSliderProps } from "./primitives/Slider.tsx";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export { ThemeProvider, ThemeScope, useTheme } from "./theme/ThemeProvider.tsx";
|
|
2
|
+
export type { ThemeProviderProps, ThemeScopeProps, ThemeContextValue } from "./theme/ThemeProvider.tsx";
|
|
3
|
+
export { defaultThemeState, resolveThemeState, readThemeState } from "./theme/state.ts";
|
|
4
|
+
export type { ThemeState, ThemeOverrides } from "./theme/state.ts";
|
|
5
|
+
export { createThemeScript } from "./theme/script.ts";
|
|
6
|
+
export { createKeyboardHydrationScript } from "./theme/keyboard-script.ts";
|
|
7
|
+
export { Button } from "./primitives/Button.tsx";
|
|
8
|
+
export type { ButtonProps } from "./primitives/Button.tsx";
|
|
9
|
+
export { buttonVariants } from "./primitives/button-variants.ts";
|
|
10
|
+
export type { ButtonVariantProps } from "./primitives/button-variants.ts";
|
|
11
|
+
export type { SheenPolymorphicProps } from "./utils/polymorphic.ts";
|
|
12
|
+
export { Input } from "./primitives/Input.tsx";
|
|
13
|
+
export type { InputProps } from "./primitives/Input.tsx";
|
|
14
|
+
export { Dialog } from "./primitives/Dialog.tsx";
|
|
15
|
+
export type { DialogProps } from "./primitives/Dialog.tsx";
|
|
16
|
+
export { Drawer, Sheet } from "./primitives/Drawer.tsx";
|
|
17
|
+
export type { DrawerProps, DrawerSide, SheetProps } from "./primitives/Drawer.tsx";
|
|
18
|
+
export { AlertDialog } from "./primitives/AlertDialog.tsx";
|
|
19
|
+
export type { AlertDialogProps } from "./primitives/AlertDialog.tsx";
|
|
20
|
+
export { ConfirmDialog } from "./primitives/ConfirmDialog.tsx";
|
|
21
|
+
export type { ConfirmDialogProps } from "./primitives/ConfirmDialog.tsx";
|
|
22
|
+
export { createConfirm } from "./primitives/create-confirm.tsx";
|
|
23
|
+
export type { ConfirmController, ConfirmOptions } from "./primitives/create-confirm.tsx";
|
|
24
|
+
export { Tooltip } from "./primitives/Tooltip.tsx";
|
|
25
|
+
export { createShortcutRegistry } from "./utils/shortcut-registry.ts";
|
|
26
|
+
export { ShortcutProvider, useShortcut, usePendingShortcut, useShortcutBindings, useShortcutCommands } from "./primitives/ShortcutProvider.tsx";
|
|
27
|
+
export { ShortcutSheet } from "./primitives/ShortcutSheet.tsx";
|
|
28
|
+
export { ShortcutPending } from "./primitives/ShortcutPending.tsx";
|
|
29
|
+
export { ShortcutScope } from "./primitives/ShortcutScope.tsx";
|
|
30
|
+
export type { ShortcutScopeProps } from "./primitives/ShortcutScope.tsx";
|
|
31
|
+
export type { ShortcutPendingProps } from "./primitives/ShortcutPending.tsx";
|
|
32
|
+
export type { ShortcutSheetProps } from "./primitives/ShortcutSheet.tsx";
|
|
33
|
+
export type { ShortcutProviderProps } from "./primitives/ShortcutProvider.tsx";
|
|
34
|
+
export type { PendingShortcut, ShortcutAction, ShortcutBinding, ShortcutDefinition, ShortcutInput, ShortcutRegistryOptions } from "./utils/shortcut-registry.ts";
|
|
35
|
+
export { LinkTooltip } from "./primitives/LinkTooltip.tsx";
|
|
36
|
+
export type { LinkTooltipProps } from "./primitives/LinkTooltip.tsx";
|
|
37
|
+
export type { TooltipProps } from "./primitives/Tooltip.tsx";
|
|
38
|
+
export { Popover } from "./primitives/Popover.tsx";
|
|
39
|
+
export type { PopoverProps } from "./primitives/Popover.tsx";
|
|
40
|
+
export { DropdownMenu } from "./primitives/DropdownMenu.tsx";
|
|
41
|
+
export type { DropdownMenuProps, DropdownMenuPlacement, MenuItem, MenuAction, MenuCheckbox, MenuRadioGroup, MenuRadioOption, MenuSubmenu, MenuSeparator } from "./primitives/DropdownMenu.tsx";
|
|
42
|
+
export { ContextMenu } from "./primitives/ContextMenu.tsx";
|
|
43
|
+
export type { ContextMenuProps } from "./primitives/ContextMenu.tsx";
|
|
44
|
+
export { CommandPalette, commandPaletteFilter } from "./primitives/CommandPalette.tsx";
|
|
45
|
+
export type { CommandPaletteProps, CommandPaletteCommand, CommandPaletteSource, CommandPaletteStaticSource, CommandPaletteRemoteSource, CommandPaletteRecents } from "./primitives/CommandPalette.tsx";
|
|
46
|
+
export { cn } from "./utils/cn.ts";
|
|
47
|
+
export { useOnlineStatus, useIsWindowFocused } from "./utils/browser-status.ts";
|
|
48
|
+
export { optimistic } from "./utils/optimistic.ts";
|
|
49
|
+
export type { OptimisticRevert } from "./utils/optimistic.ts";
|
|
50
|
+
export { createToaster } from "./primitives/create-toaster.ts";
|
|
51
|
+
export { Toast } from "./primitives/Toast.tsx";
|
|
52
|
+
export type { ToastProps } from "./primitives/Toast.tsx";
|
|
53
|
+
export { Toaster } from "./primitives/Toaster.tsx";
|
|
54
|
+
export type { ToasterProps } from "./primitives/Toaster.tsx";
|
|
55
|
+
export type { ToastId, ToastAction, ToastOptions, ToastNotification, ToastActionResult, ToastController } from "./primitives/create-toaster.ts";
|
|
56
|
+
export { englishMessages } from "./theme/messages.ts";
|
|
57
|
+
export type { Messages } from "./theme/messages.ts";
|
|
58
|
+
export { useNumberFormatter, useDateFormatter } from "./theme/intl.ts";
|
|
59
|
+
export { Stack, Row, Row as Cluster, Grid, Container, Center, Spacer } from "./layout/Layout.tsx";
|
|
60
|
+
export type { StackProps, RowProps, GridProps, ContainerProps, CenterProps, SpacerProps, Spacing, Alignment, Justification } from "./layout/Layout.tsx";
|
|
61
|
+
export { Text, Heading, Code, Kbd } from "./primitives/Typography.tsx";
|
|
62
|
+
export type { TextProps, HeadingProps, CodeProps, KbdProps } from "./primitives/Typography.tsx";
|
|
63
|
+
export { Badge, Tag } from "./primitives/Status.tsx";
|
|
64
|
+
export type { BadgeProps, TagProps, StatusTone } from "./primitives/Status.tsx";
|
|
65
|
+
export { Surface, Card } from "./primitives/Surface.tsx";
|
|
66
|
+
export type { SurfaceProps, CardProps } from "./primitives/Surface.tsx";
|
|
67
|
+
export { Separator } from "./primitives/Separator.tsx";
|
|
68
|
+
export type { SeparatorProps } from "./primitives/Separator.tsx";
|
|
69
|
+
export { Alert, Callout } from "./primitives/Notice.tsx";
|
|
70
|
+
export type { AlertProps, CalloutProps } from "./primitives/Notice.tsx";
|
|
71
|
+
export { DescriptionList, DescriptionTerm, DescriptionDetails } from "./primitives/DescriptionList.tsx";
|
|
72
|
+
export type { DescriptionListProps, DescriptionTermProps, DescriptionDetailsProps } from "./primitives/DescriptionList.tsx";
|
|
73
|
+
export { Skeleton } from "./primitives/Skeleton.tsx";
|
|
74
|
+
export type { SkeletonProps } from "./primitives/Skeleton.tsx";
|
|
75
|
+
export { EmptyState } from "./primitives/EmptyState.tsx";
|
|
76
|
+
export type { EmptyStateProps } from "./primitives/EmptyState.tsx";
|
|
77
|
+
export { Spinner } from "./primitives/Spinner.tsx";
|
|
78
|
+
export type { SpinnerProps } from "./primitives/Spinner.tsx";
|
|
79
|
+
export { Field } from "./primitives/Field.tsx";
|
|
80
|
+
export type { FieldProps, FieldControlProps } from "./primitives/Field.tsx";
|
|
81
|
+
export { InputGroup } from "./primitives/InputGroup.tsx";
|
|
82
|
+
export type { InputGroupProps } from "./primitives/InputGroup.tsx";
|
|
83
|
+
export { SearchInput } from "./primitives/SearchInput.tsx";
|
|
84
|
+
export type { SearchInputProps } from "./primitives/SearchInput.tsx";
|
|
85
|
+
export { Textarea } from "./primitives/Textarea.tsx";
|
|
86
|
+
export type { TextareaProps } from "./primitives/Textarea.tsx";
|
|
87
|
+
export { EditableTextField } from "./primitives/EditableTextField.tsx";
|
|
88
|
+
export type { EditableTextFieldProps } from "./primitives/EditableTextField.tsx";
|
|
89
|
+
export { Checkbox } from "./primitives/Checkbox.tsx";
|
|
90
|
+
export type { CheckboxProps } from "./primitives/Checkbox.tsx";
|
|
91
|
+
export { Switch } from "./primitives/Switch.tsx";
|
|
92
|
+
export type { SwitchProps } from "./primitives/Switch.tsx";
|
|
93
|
+
export { CheckboxGroup } from "./primitives/CheckboxGroup.tsx";
|
|
94
|
+
export type { CheckboxGroupProps, CheckboxOption } from "./primitives/CheckboxGroup.tsx";
|
|
95
|
+
export { RadioGroup } from "./primitives/RadioGroup.tsx";
|
|
96
|
+
export { SegmentedControl } from "./primitives/SegmentedControl.tsx";
|
|
97
|
+
export type { SegmentedControlProps, SegmentedControlOption } from "./primitives/SegmentedControl.tsx";
|
|
98
|
+
export { TagInput } from "./primitives/TagInput.tsx";
|
|
99
|
+
export type { TagInputProps, TagInputValidationContext, TagInputValidationResult } from "./primitives/TagInput.tsx";
|
|
100
|
+
export { FileDropzone } from "./primitives/FileDropzone.tsx";
|
|
101
|
+
export type { FileDropzoneProps, FileDropzoneItem, FileDropzoneStatus, FileDropzoneRejection, FileDropzoneRejectionReason } from "./primitives/FileDropzone.tsx";
|
|
102
|
+
export { ActivityTimeline } from "./primitives/ActivityTimeline.tsx";
|
|
103
|
+
export type { ActivityTimelineProps, ActivityTimelineItem, WorkflowState } from "./primitives/ActivityTimeline.tsx";
|
|
104
|
+
export { Stepper } from "./primitives/Stepper.tsx";
|
|
105
|
+
export type { StepperProps, StepperStep, StepperStatusStep, StepperLinkStep, StepperActionStep } from "./primitives/Stepper.tsx";
|
|
106
|
+
export { Select } from "./primitives/Select.tsx";
|
|
107
|
+
export type { SelectProps, SelectOption } from "./primitives/Select.tsx";
|
|
108
|
+
export { Combobox, MultiCombobox } from "./primitives/Combobox.tsx";
|
|
109
|
+
export type { ComboboxProps, MultiComboboxProps, ComboboxOption, ComboboxFilter } from "./primitives/Combobox.tsx";
|
|
110
|
+
export type { RadioGroupProps, RadioOption } from "./primitives/RadioGroup.tsx";
|
|
111
|
+
export { Table, TableCaption, TableHead, TableBody, TableFoot, TableRow, TableHeaderCell, TableCell } from "./primitives/Table.tsx";
|
|
112
|
+
export type { TableProps, TableCaptionProps, TableHeadProps, TableBodyProps, TableFootProps, TableRowProps, TableHeaderCellProps, TableCellProps } from "./primitives/Table.tsx";
|
|
113
|
+
export { Breadcrumb } from "./primitives/Breadcrumb.tsx";
|
|
114
|
+
export type { BreadcrumbProps, BreadcrumbEntry } from "./primitives/Breadcrumb.tsx";
|
|
115
|
+
export { Collapsible } from "./primitives/Collapsible.tsx";
|
|
116
|
+
export type { CollapsibleProps } from "./primitives/Collapsible.tsx";
|
|
117
|
+
export { Accordion, AccordionItem } from "./primitives/Accordion.tsx";
|
|
118
|
+
export type { AccordionProps, AccordionItemProps } from "./primitives/Accordion.tsx";
|
|
119
|
+
export { Tabs } from "./primitives/Tabs.tsx";
|
|
120
|
+
export type { TabsProps, TabOption } from "./primitives/Tabs.tsx";
|
|
121
|
+
export { NavList, NavItem } from "./primitives/NavList.tsx";
|
|
122
|
+
export type { NavListProps, NavItemProps } from "./primitives/NavList.tsx";
|
|
123
|
+
export { ScrollArea } from "./primitives/ScrollArea.tsx";
|
|
124
|
+
export type { ScrollAreaProps } from "./primitives/ScrollArea.tsx";
|
|
125
|
+
export { ButtonGroup } from "./primitives/ButtonGroup.tsx";
|
|
126
|
+
export type { ButtonGroupProps } from "./primitives/ButtonGroup.tsx";
|
|
127
|
+
export { IconButton } from "./primitives/IconButton.tsx";
|
|
128
|
+
export type { IconButtonProps } from "./primitives/IconButton.tsx";
|
|
129
|
+
export { Link } from "./primitives/Link.tsx";
|
|
130
|
+
export type { LinkProps } from "./primitives/Link.tsx";
|
|
131
|
+
export { Pagination } from "./primitives/Pagination.tsx";
|
|
132
|
+
export type { PaginationProps } from "./primitives/Pagination.tsx";
|
|
133
|
+
export { Avatar, AvatarGroup } from "./primitives/Avatar.tsx";
|
|
134
|
+
export type { AvatarProps, AvatarGroupProps, AvatarItem, AvatarSize } from "./primitives/Avatar.tsx";
|
|
135
|
+
export { Progress, Meter } from "./primitives/Progress.tsx";
|
|
136
|
+
export type { ProgressProps, MeterProps } from "./primitives/Progress.tsx";
|
|
137
|
+
export { NumberField } from "./primitives/NumberField.tsx";
|
|
138
|
+
export type { NumberFieldProps } from "./primitives/NumberField.tsx";
|
|
139
|
+
export { Slider, RangeSlider } from "./primitives/Slider.tsx";
|
|
140
|
+
export type { SliderProps, RangeSliderProps } from "./primitives/Slider.tsx";
|
|
141
|
+
export { Tree, TreeItem } from "./primitives/Tree.tsx";
|
|
142
|
+
export type { TreeProps, TreeItemProps, TreeSelectionMode } from "./primitives/Tree.tsx";
|
|
143
|
+
export { Resizable, ResizablePanel, ResizableHandle } from "./primitives/Resizable.tsx";
|
|
144
|
+
export type { ResizableProps, ResizablePanelProps, ResizableHandleProps, ResizablePersistence } from "./primitives/Resizable.tsx";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { splitProps } from "solid-js";
|
|
2
|
+
import type { JSX } from "solid-js";
|
|
3
|
+
import { cn } from "../utils/cn.ts";
|
|
4
|
+
|
|
5
|
+
export type Spacing = "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
export type Alignment = "start" | "center" | "end" | "stretch";
|
|
7
|
+
export type Justification = "start" | "center" | "end" | "between";
|
|
8
|
+
export interface StackProps extends JSX.HTMLAttributes<HTMLDivElement> { gap?: Spacing; align?: Alignment; justify?: Justification }
|
|
9
|
+
export interface RowProps extends StackProps { wrap?: boolean }
|
|
10
|
+
export interface GridProps extends JSX.HTMLAttributes<HTMLDivElement> { columns?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; gap?: Spacing; align?: Alignment }
|
|
11
|
+
export interface ContainerProps extends JSX.HTMLAttributes<HTMLDivElement> { padding?: Spacing }
|
|
12
|
+
export type CenterProps = JSX.HTMLAttributes<HTMLDivElement>;
|
|
13
|
+
export type SpacerProps = JSX.HTMLAttributes<HTMLDivElement>;
|
|
14
|
+
|
|
15
|
+
export function Stack(props: StackProps): JSX.Element {
|
|
16
|
+
const [local, others] = splitProps(props, ["class", "gap", "align", "justify"]);
|
|
17
|
+
return <div {...others} class={cn("sheen-layout sheen-stack", local.class)} data-gap={local.gap ?? "md"} data-align={local.align ?? "stretch"} data-justify={local.justify ?? "start"} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function Row(props: RowProps): JSX.Element {
|
|
21
|
+
const [local, others] = splitProps(props, ["class", "gap", "align", "justify", "wrap"]);
|
|
22
|
+
return <div {...others} class={cn("sheen-layout sheen-row", local.class)} data-gap={local.gap ?? "md"} data-align={local.align ?? "center"} data-justify={local.justify ?? "start"} data-wrap={local.wrap ?? true} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function Grid(props: GridProps): JSX.Element {
|
|
26
|
+
const [local, others] = splitProps(props, ["class", "columns", "gap", "align"]);
|
|
27
|
+
return <div {...others} class={cn("sheen-layout sheen-grid", local.class)} data-columns={local.columns ?? 1} data-gap={local.gap ?? "md"} data-align={local.align ?? "stretch"} />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function Container(props: ContainerProps): JSX.Element {
|
|
31
|
+
const [local, others] = splitProps(props, ["class", "padding"]);
|
|
32
|
+
return <div {...others} class={cn("sheen-layout sheen-container", local.class)} data-gap={local.padding ?? "md"} />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function Center(props: CenterProps): JSX.Element {
|
|
36
|
+
const [local, others] = splitProps(props, ["class"]);
|
|
37
|
+
return <div {...others} class={cn("sheen-layout sheen-center", local.class)} />;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function Spacer(props: SpacerProps): JSX.Element {
|
|
41
|
+
const [local, others] = splitProps(props, ["class"]);
|
|
42
|
+
return <div {...others} class={cn("sheen-layout sheen-spacer", local.class)} aria-hidden="true" />;
|
|
43
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Build-time documentation data. Never imported by the component runtime entry point. */
|
|
2
|
+
export interface PropMetadata {
|
|
3
|
+
readonly description: string;
|
|
4
|
+
readonly default?: string | number | boolean | null;
|
|
5
|
+
readonly control?: {
|
|
6
|
+
readonly kind: "boolean" | "text";
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: "select";
|
|
9
|
+
readonly values: readonly (string | number | boolean | null)[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export type ComposerMetadataParentRegion = "root" | "topbar" | "sidebar" | "page-header" | "toolbar" | "main-grid" | "details-panel" | "status-bar" | "overlays";
|
|
13
|
+
export interface ComposerMetadata {
|
|
14
|
+
readonly allowedParentRegions: readonly ComposerMetadataParentRegion[];
|
|
15
|
+
readonly acceptedChildRegions: readonly string[];
|
|
16
|
+
readonly editableSafeProps: readonly string[];
|
|
17
|
+
readonly fixtureFactory: string;
|
|
18
|
+
readonly codeGenerationAdapter: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ComponentMetadata {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly package: string;
|
|
23
|
+
readonly category: string;
|
|
24
|
+
readonly summary: string;
|
|
25
|
+
readonly props: Readonly<Record<string, PropMetadata>>;
|
|
26
|
+
readonly tokens: readonly string[];
|
|
27
|
+
readonly a11y: {
|
|
28
|
+
readonly role: string;
|
|
29
|
+
readonly keyboard: readonly string[];
|
|
30
|
+
};
|
|
31
|
+
readonly examples: readonly {
|
|
32
|
+
readonly title: string;
|
|
33
|
+
readonly code: string;
|
|
34
|
+
readonly imports?: string;
|
|
35
|
+
readonly setup?: string;
|
|
36
|
+
}[];
|
|
37
|
+
readonly guidance: {
|
|
38
|
+
readonly do: readonly string[];
|
|
39
|
+
readonly dont: readonly string[];
|
|
40
|
+
};
|
|
41
|
+
readonly composer?: ComposerMetadata;
|
|
42
|
+
}
|
|
43
|
+
export declare function defineMeta<Props>(metadata: Omit<ComponentMetadata, "props"> & {
|
|
44
|
+
readonly props: Partial<Record<keyof Props, PropMetadata>>;
|
|
45
|
+
}): ComponentMetadata;
|
|
46
|
+
export declare function isComponentMetadata(value: unknown): value is ComponentMetadata;
|