@gemologic/sheen 0.2.1 → 0.4.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/README.md +1 -1
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/ai.d.ts +8 -0
- package/dist/ai.js +5 -0
- package/dist/core.d.ts +11 -4
- package/dist/core.js +32 -28
- package/dist/formisch.js +1 -2
- package/dist/forms.d.ts +2 -0
- package/dist/forms.js +16 -15
- package/dist/index.d.ts +27 -5
- package/dist/index.js +87 -76
- package/dist/layout/Layout.js +1 -2
- package/dist/metadata.js +1 -2
- package/dist/navigation.d.ts +2 -1
- package/dist/navigation.js +16 -16
- package/dist/overlays.d.ts +2 -0
- package/dist/overlays.js +9 -8
- package/dist/primitives/Accordion.js +9 -9
- package/dist/primitives/ActivityTimeline.js +57 -49
- package/dist/primitives/AlertDialog.js +1 -2
- package/dist/primitives/Avatar.js +16 -17
- package/dist/primitives/Board.d.ts +39 -0
- package/dist/primitives/Board.js +471 -0
- package/dist/primitives/Breadcrumb.js +1 -2
- package/dist/primitives/Button.js +38 -27
- package/dist/primitives/ButtonGroup.js +1 -2
- package/dist/primitives/Checkbox.d.ts +16 -2
- package/dist/primitives/Checkbox.js +46 -36
- package/dist/primitives/CheckboxGroup.js +11 -12
- package/dist/primitives/Collapsible.js +6 -6
- package/dist/primitives/Combobox.js +203 -201
- package/dist/primitives/CommandPalette.d.ts +4 -0
- package/dist/primitives/CommandPalette.js +138 -116
- package/dist/primitives/ConfirmDialog.js +5 -6
- package/dist/primitives/ContextMenu.js +7 -8
- package/dist/primitives/Conversation.d.ts +17 -0
- package/dist/primitives/Conversation.js +107 -0
- package/dist/primitives/DescriptionList.js +1 -2
- package/dist/primitives/Dialog.js +101 -68
- package/dist/primitives/Drawer.js +12 -13
- package/dist/primitives/DropdownMenu.js +163 -157
- package/dist/primitives/EditableTextField.js +3 -8
- package/dist/primitives/EmptyState.js +1 -2
- package/dist/primitives/Field.js +1 -2
- package/dist/primitives/FileDropzone.js +19 -18
- package/dist/primitives/Form.d.ts +23 -0
- package/dist/primitives/Form.js +76 -0
- package/dist/primitives/Glyph.d.ts +40 -0
- package/dist/primitives/Glyph.js +65 -0
- package/dist/primitives/IconButton.js +5 -6
- package/dist/primitives/Input.js +1 -2
- package/dist/primitives/InputGroup.js +8 -9
- package/dist/primitives/Link.d.ts +9 -1
- package/dist/primitives/Link.js +23 -17
- package/dist/primitives/LinkTooltip.js +6 -7
- package/dist/primitives/List.d.ts +34 -0
- package/dist/primitives/List.js +135 -0
- package/dist/primitives/Message.d.ts +13 -0
- package/dist/primitives/Message.js +75 -0
- package/dist/primitives/NavList.js +15 -16
- package/dist/primitives/Notice.d.ts +15 -1
- package/dist/primitives/Notice.js +91 -43
- package/dist/primitives/NumberField.js +81 -81
- package/dist/primitives/NumberText.d.ts +4 -0
- package/dist/primitives/NumberText.js +50 -25
- package/dist/primitives/Pagination.js +81 -60
- package/dist/primitives/Popover.d.ts +1 -0
- package/dist/primitives/Popover.js +65 -57
- package/dist/primitives/Progress.js +1 -2
- package/dist/primitives/PromptInput.d.ts +23 -0
- package/dist/primitives/PromptInput.js +135 -0
- package/dist/primitives/RadioGroup.js +12 -17
- package/dist/primitives/Resizable.js +1 -2
- package/dist/primitives/ScrollArea.js +1 -2
- package/dist/primitives/SearchInput.js +45 -38
- package/dist/primitives/SegmentedControl.d.ts +2 -0
- package/dist/primitives/SegmentedControl.js +92 -78
- package/dist/primitives/Select.js +105 -100
- package/dist/primitives/Separator.js +1 -2
- package/dist/primitives/ShortcutPending.js +11 -12
- package/dist/primitives/ShortcutProvider.d.ts +5 -0
- package/dist/primitives/ShortcutProvider.js +71 -65
- package/dist/primitives/ShortcutScope.js +8 -9
- package/dist/primitives/ShortcutSheet.js +30 -24
- package/dist/primitives/Skeleton.js +1 -2
- package/dist/primitives/Slider.js +1 -2
- package/dist/primitives/SortableList.d.ts +19 -0
- package/dist/primitives/SortableList.js +235 -0
- package/dist/primitives/Spinner.js +1 -2
- package/dist/primitives/Status.js +14 -14
- package/dist/primitives/Stepper.js +54 -52
- package/dist/primitives/StreamingText.d.ts +12 -0
- package/dist/primitives/StreamingText.js +42 -0
- package/dist/primitives/Surface.js +1 -2
- package/dist/primitives/Switch.d.ts +2 -2
- package/dist/primitives/Switch.js +1 -2
- package/dist/primitives/Table.js +1 -2
- package/dist/primitives/Tabs.js +20 -17
- package/dist/primitives/TagInput.js +6 -9
- package/dist/primitives/Textarea.js +37 -63
- package/dist/primitives/Toast.js +42 -41
- package/dist/primitives/Toaster.js +27 -28
- package/dist/primitives/Tooltip.js +32 -32
- package/dist/primitives/TooltipTrigger.d.ts +18 -0
- package/dist/primitives/TooltipTrigger.js +76 -0
- package/dist/primitives/Tree.js +1 -2
- package/dist/primitives/Typography.d.ts +6 -2
- package/dist/primitives/Typography.js +20 -12
- package/dist/primitives/boolean-input-state.js +3 -8
- package/dist/primitives/button-variants.js +2 -3
- package/dist/primitives/choice-options.js +1 -2
- package/dist/primitives/create-confirm.js +1 -2
- package/dist/primitives/create-toaster.js +1 -2
- package/dist/primitives/link-focus.js +1 -2
- package/dist/primitives/menu-focus.js +1 -2
- package/dist/primitives/sortable-core.d.ts +70 -0
- package/dist/primitives/sortable-core.js +109 -0
- package/dist/primitives/sortable-drag.d.ts +29 -0
- package/dist/primitives/sortable-drag.js +50 -0
- package/dist/primitives/tooltip-layer.js +26 -27
- package/dist/sortable.d.ts +6 -0
- package/dist/sortable.js +4 -0
- package/dist/theme/ThemeProvider.d.ts +6 -1
- package/dist/theme/ThemeProvider.js +65 -58
- package/dist/theme/intl.js +1 -2
- package/dist/theme/keyboard-script.js +1 -2
- package/dist/theme/layers.js +1 -2
- package/dist/theme/messages.d.ts +26 -0
- package/dist/theme/messages.js +9 -2
- package/dist/theme/number-format-cache.js +1 -2
- package/dist/theme/script.d.ts +1 -0
- package/dist/theme/script.js +3 -3
- package/dist/theme/state.d.ts +4 -4
- package/dist/theme/state.js +12 -13
- package/dist/utils/auto-resize.d.ts +6 -0
- package/dist/utils/auto-resize.js +31 -0
- package/dist/utils/browser-status.js +1 -2
- package/dist/utils/change-motion.d.ts +8 -0
- package/dist/utils/change-motion.js +19 -0
- package/dist/utils/cn.js +1 -2
- package/dist/utils/media-query.d.ts +10 -0
- package/dist/utils/media-query.js +16 -0
- package/dist/utils/optimistic.js +1 -2
- package/dist/utils/shortcut-platform.js +1 -2
- package/dist/utils/shortcut-registry.d.ts +5 -0
- package/dist/utils/shortcut-registry.js +61 -51
- package/dist/vite.js +3 -4
- package/package.json +23 -5
- package/src/ai.ts +8 -0
- package/src/core.ts +11 -4
- package/src/forms.ts +2 -0
- package/src/index.ts +27 -5
- package/src/navigation.ts +2 -1
- package/src/overlays.ts +2 -0
- package/src/primitives/Accordion.tsx +1 -1
- package/src/primitives/ActivityTimeline.tsx +12 -7
- package/src/primitives/Board.tsx +406 -0
- package/src/primitives/Button.tsx +15 -4
- package/src/primitives/Checkbox.tsx +14 -7
- package/src/primitives/Collapsible.tsx +1 -1
- package/src/primitives/Combobox.tsx +2 -1
- package/src/primitives/CommandPalette.tsx +13 -4
- package/src/primitives/Conversation.tsx +108 -0
- package/src/primitives/Dialog.tsx +5 -1
- package/src/primitives/DropdownMenu.tsx +12 -6
- package/src/primitives/FileDropzone.tsx +2 -2
- package/src/primitives/Form.tsx +58 -0
- package/src/primitives/Glyph.tsx +55 -0
- package/src/primitives/Link.tsx +15 -6
- package/src/primitives/List.tsx +68 -0
- package/src/primitives/Message.tsx +40 -0
- package/src/primitives/Notice.tsx +45 -12
- package/src/primitives/NumberField.tsx +3 -2
- package/src/primitives/NumberText.tsx +31 -4
- package/src/primitives/Pagination.tsx +6 -5
- package/src/primitives/Popover.tsx +7 -5
- package/src/primitives/PromptInput.tsx +116 -0
- package/src/primitives/SearchInput.tsx +4 -3
- package/src/primitives/SegmentedControl.tsx +29 -4
- package/src/primitives/Select.tsx +3 -2
- package/src/primitives/ShortcutProvider.tsx +14 -1
- package/src/primitives/ShortcutSheet.tsx +1 -1
- package/src/primitives/SortableList.tsx +208 -0
- package/src/primitives/Status.tsx +1 -1
- package/src/primitives/Stepper.tsx +7 -7
- package/src/primitives/StreamingText.tsx +32 -0
- package/src/primitives/Switch.tsx +2 -2
- package/src/primitives/Tabs.tsx +2 -1
- package/src/primitives/TagInput.tsx +1 -1
- package/src/primitives/Textarea.tsx +3 -47
- package/src/primitives/Toast.tsx +2 -1
- package/src/primitives/Tooltip.tsx +4 -2
- package/src/primitives/TooltipTrigger.tsx +60 -0
- package/src/primitives/Typography.tsx +11 -2
- package/src/primitives/button-variants.ts +1 -1
- package/src/primitives/sortable-core.ts +139 -0
- package/src/primitives/sortable-drag.ts +75 -0
- package/src/sortable.ts +6 -0
- package/src/styles/ai.css +57 -0
- package/src/styles/core.css +321 -0
- package/src/styles/forms.css +263 -0
- package/src/styles/navigation.css +137 -0
- package/src/styles/overlays.css +107 -0
- package/src/styles/sortable.css +87 -0
- package/src/styles.css +5 -658
- package/src/theme/ThemeProvider.tsx +20 -8
- package/src/theme/messages.ts +20 -1
- package/src/theme/script.ts +2 -2
- package/src/theme/state.ts +5 -5
- package/src/utils/auto-resize.ts +58 -0
- package/src/utils/change-motion.ts +28 -0
- package/src/utils/media-query.ts +26 -0
- package/src/utils/shortcut-registry.ts +19 -2
- package/src/vite.ts +3 -3
- package/vendor/integrity.json +13 -13
- package/vendor/kobalte-core/chunk/3D6FM2PJ.js +7 -1
- package/vendor/kobalte-core/chunk/G3KI2B4X.js +2 -1
- package/vendor/kobalte-core/chunk/KEL2LLJM.jsx +2 -1
- package/vendor/kobalte-core/chunk/RFN6X5VH.jsx +7 -1
- package/vendor/origins.json +4 -4
- package/vendor/solid-web/dev.cjs +21 -17
- package/vendor/solid-web/dev.js +21 -17
- package/vendor/solid-web/server.cjs +1 -1
- package/vendor/solid-web/server.js +1 -1
- package/vendor/solid-web/web.cjs +21 -17
- package/vendor/solid-web/web.js +21 -17
|
@@ -6,10 +6,10 @@ import { NumberFormatContext as s, createNumberFormatCache as c } from "./number
|
|
|
6
6
|
import { createComponent as l, effect as u, insert as d, memo as f, mergeProps as p, setAttribute as m, spread as h, template as g, use as _ } from "solid-js/web";
|
|
7
7
|
import { createContext as v, createEffect as y, createMemo as b, createSignal as x, createUniqueId as S, onCleanup as C, onMount as w, useContext as T } from "solid-js";
|
|
8
8
|
import { I18nProvider as E } from "#sheen-kobalte/i18n";
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
function
|
|
9
|
+
import { accentNames as D, bundledThemeMetadata as O, iconSetForTheme as k } from "@gemologic/sheen-tokens/catalog";
|
|
10
|
+
// src/theme/ThemeProvider.tsx
|
|
11
|
+
var A = /*#__PURE__*/ g("<div>"), j = /*#__PURE__*/ g("<section><script>");
|
|
12
|
+
function M(e) {
|
|
13
13
|
return {
|
|
14
14
|
...e,
|
|
15
15
|
portal: () => e.ready() ? e.portal() : void 0,
|
|
@@ -20,6 +20,7 @@ function j(e) {
|
|
|
20
20
|
density: () => e.state().density,
|
|
21
21
|
radius: () => e.state().radius,
|
|
22
22
|
themes: () => e.themes,
|
|
23
|
+
accents: () => e.accents,
|
|
23
24
|
setTheme: (t) => e.set({ theme: t }),
|
|
24
25
|
setMode: (t) => e.set({ mode: t }),
|
|
25
26
|
setAccent: (t) => e.set({ accent: t }),
|
|
@@ -27,24 +28,24 @@ function j(e) {
|
|
|
27
28
|
setRadius: (t) => e.set({ radius: t })
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
let e = T(
|
|
31
|
+
var N = v();
|
|
32
|
+
function P() {
|
|
33
|
+
let e = T(N);
|
|
33
34
|
if (!e) throw Error("sheen components require a ThemeProvider");
|
|
34
35
|
return e;
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function F(e, t, n) {
|
|
37
38
|
return Object.fromEntries(Object.entries({
|
|
38
39
|
...e,
|
|
39
40
|
mode: t,
|
|
40
|
-
"icon-set":
|
|
41
|
+
"icon-set": k(e.theme, n)
|
|
41
42
|
}).map(([e, t]) => [`data-sheen-${e}`, t]));
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function I(e) {
|
|
44
45
|
return (() => {
|
|
45
|
-
var t =
|
|
46
|
+
var t = A(), n = e.ref;
|
|
46
47
|
return typeof n == "function" ? _(n, t) : e.ref = t, u((n) => {
|
|
47
|
-
var r = e.kind, i = e.ready, a = e.state?.theme, o = e.state ? e.mode : void 0, s = e.state ?
|
|
48
|
+
var r = e.kind, i = e.ready, a = e.state?.theme, o = e.state ? e.mode : void 0, s = e.state ? k(e.state.theme, e.themes) : void 0, c = e.state?.accent, l = e.state?.density, u = e.state?.radius, d = e.state?.motion, f = e.state?.locale, p = e.state?.direction;
|
|
48
49
|
return r !== n.e && m(t, "data-sheen-portal", n.e = r), i !== n.t && m(t, "data-sheen-ready", n.t = i), a !== n.a && m(t, "data-sheen-theme", n.a = a), o !== n.o && m(t, "data-sheen-mode", n.o = o), s !== n.i && m(t, "data-sheen-icon-set", n.i = s), c !== n.n && m(t, "data-sheen-accent", n.n = c), l !== n.s && m(t, "data-sheen-density", n.s = l), u !== n.h && m(t, "data-sheen-radius", n.h = u), d !== n.r && m(t, "data-sheen-motion", n.r = d), f !== n.d && m(t, "data-sheen-locale", n.d = f), p !== n.l && m(t, "data-sheen-direction", n.l = p), n;
|
|
49
50
|
}, {
|
|
50
51
|
e: void 0,
|
|
@@ -61,7 +62,7 @@ function F(e) {
|
|
|
61
62
|
}), t;
|
|
62
63
|
})();
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function L() {
|
|
65
66
|
let [e, t] = x("dark");
|
|
66
67
|
return w(() => {
|
|
67
68
|
let e = matchMedia("(prefers-color-scheme: dark)"), n = () => {
|
|
@@ -70,8 +71,8 @@ function I() {
|
|
|
70
71
|
n(), e.addEventListener("change", n), C(() => e.removeEventListener("change", n));
|
|
71
72
|
}), e;
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
-
let r = c(), u = () => n.themes ??
|
|
74
|
+
function R(n) {
|
|
75
|
+
let r = c(), u = () => n.themes ?? O, d = b(() => [...D, ...(n.accents ?? []).filter((e) => !D.some((t) => t === e))]), p = {
|
|
75
76
|
...e,
|
|
76
77
|
theme: n.defaultTheme ?? e.theme,
|
|
77
78
|
mode: n.defaultMode ?? "dark",
|
|
@@ -81,39 +82,40 @@ function L(n) {
|
|
|
81
82
|
motion: n.defaultMotion ?? "full",
|
|
82
83
|
direction: n.direction ?? "ltr",
|
|
83
84
|
locale: n.locale ?? "en-US"
|
|
84
|
-
}, [
|
|
85
|
-
function
|
|
86
|
-
for (let [e, t] of Object.entries(
|
|
87
|
-
document.documentElement.setAttribute("data-sheen-preference",
|
|
85
|
+
}, [m, h] = x(n.initialState ?? p), g = b(() => m().locale), _ = b(() => m().direction), [v, S] = x(!1), [C, T] = x(), k = L(), A = b(() => m().mode === "system" ? k() : m().mode === "light" ? "light" : "dark"), j = 0;
|
|
86
|
+
function P() {
|
|
87
|
+
for (let [e, t] of Object.entries(F(m(), A(), u()))) document.documentElement.setAttribute(e, t);
|
|
88
|
+
document.documentElement.setAttribute("data-sheen-preference", m().mode), document.documentElement.dir = m().direction, document.documentElement.lang = m().locale;
|
|
88
89
|
}
|
|
89
90
|
w(() => {
|
|
90
91
|
if (n.hydration !== "cookie") {
|
|
91
|
-
let e = document.documentElement, n = Object.fromEntries(Object.keys(
|
|
92
|
-
|
|
92
|
+
let e = document.documentElement, n = Object.fromEntries(Object.keys(p).map((t) => [t, e.getAttribute(`data-sheen-${t}`)]));
|
|
93
|
+
h(t({
|
|
93
94
|
...n,
|
|
94
95
|
mode: e.getAttribute("data-sheen-preference") ?? n.mode
|
|
95
|
-
},
|
|
96
|
+
}, p, u().map((e) => e.id), d()));
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
+
S(!0), P();
|
|
98
99
|
}), y(() => {
|
|
99
|
-
|
|
100
|
+
v() && P();
|
|
100
101
|
});
|
|
101
|
-
let
|
|
102
|
-
state:
|
|
103
|
-
defaults:
|
|
104
|
-
resolvedMode:
|
|
105
|
-
ready:
|
|
106
|
-
portal:
|
|
102
|
+
let R = M({
|
|
103
|
+
state: m,
|
|
104
|
+
defaults: p,
|
|
105
|
+
resolvedMode: A,
|
|
106
|
+
ready: v,
|
|
107
|
+
portal: C,
|
|
107
108
|
tokenTarget: () => document.documentElement,
|
|
108
109
|
themes: u(),
|
|
110
|
+
accents: d(),
|
|
109
111
|
nonce: n.nonce,
|
|
110
112
|
layers: i(),
|
|
111
113
|
messages: b(() => o(a, n.messages)),
|
|
112
114
|
async set(e) {
|
|
113
115
|
let r = t({
|
|
114
|
-
...
|
|
116
|
+
...m(),
|
|
115
117
|
...e
|
|
116
|
-
},
|
|
118
|
+
}, p, R.themes().map((e) => e.id), R.accents()), i = ++j;
|
|
117
119
|
if (n.hydration === "cookie") {
|
|
118
120
|
if (!n.persist) throw Error("Cookie hydration requires an app persistence callback");
|
|
119
121
|
try {
|
|
@@ -122,38 +124,38 @@ function L(n) {
|
|
|
122
124
|
throw n.onPersistenceError?.(e), e;
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
|
-
if (i ===
|
|
127
|
+
if (i === j && (h(r), P(), n.hydration !== "cookie")) try {
|
|
126
128
|
localStorage.setItem(n.storageKey ?? "sheen", JSON.stringify(r));
|
|
127
129
|
} catch (e) {
|
|
128
130
|
n.onPersistenceError?.(e);
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
});
|
|
132
|
-
return l(
|
|
133
|
-
value:
|
|
134
|
+
return l(N.Provider, {
|
|
135
|
+
value: R,
|
|
134
136
|
get children() {
|
|
135
137
|
return l(s.Provider, {
|
|
136
138
|
value: r,
|
|
137
139
|
get children() {
|
|
138
140
|
return l(E, {
|
|
139
141
|
get locale() {
|
|
140
|
-
return
|
|
142
|
+
return g();
|
|
141
143
|
},
|
|
142
144
|
get direction() {
|
|
143
|
-
return
|
|
145
|
+
return _();
|
|
144
146
|
},
|
|
145
147
|
get children() {
|
|
146
|
-
return [f(() => n.children), l(
|
|
148
|
+
return [f(() => n.children), l(I, {
|
|
147
149
|
kind: "root",
|
|
148
150
|
get ready() {
|
|
149
|
-
return
|
|
151
|
+
return v();
|
|
150
152
|
},
|
|
151
|
-
ref:
|
|
153
|
+
ref: T,
|
|
152
154
|
get state() {
|
|
153
|
-
return f(() => !!
|
|
155
|
+
return f(() => !!v())() ? m() : void 0;
|
|
154
156
|
},
|
|
155
157
|
get mode() {
|
|
156
|
-
return
|
|
158
|
+
return A();
|
|
157
159
|
},
|
|
158
160
|
get themes() {
|
|
159
161
|
return u();
|
|
@@ -166,8 +168,8 @@ function L(n) {
|
|
|
166
168
|
}
|
|
167
169
|
});
|
|
168
170
|
}
|
|
169
|
-
function
|
|
170
|
-
let t = c(), i =
|
|
171
|
+
function z(e) {
|
|
172
|
+
let t = c(), i = P(), [a, f] = x({}), [g, _] = x(), v = b(() => n(i.state(), {
|
|
171
173
|
theme: e.theme ?? (e.theme === null ? null : i.state().theme),
|
|
172
174
|
mode: e.mode ?? (e.mode === null ? null : i.state().mode),
|
|
173
175
|
accent: e.accent ?? (e.accent === null ? null : i.state().accent),
|
|
@@ -177,26 +179,32 @@ function R(e) {
|
|
|
177
179
|
direction: e.direction ?? (e.direction === null ? null : i.state().direction),
|
|
178
180
|
locale: e.locale ?? (e.locale === null ? null : i.state().locale),
|
|
179
181
|
...a()
|
|
180
|
-
}, i.defaults)), y = b(() => v().locale), C = b(() => v().direction), w =
|
|
182
|
+
}, i.defaults)), y = b(() => v().locale), C = b(() => v().direction), w = L(), T = b(() => v().mode === "system" ? w() : v().mode === "light" ? "light" : "dark"), D = () => i.themes(), O = M({
|
|
181
183
|
...i,
|
|
182
184
|
themes: i.themes(),
|
|
185
|
+
accents: i.accents(),
|
|
183
186
|
state: v,
|
|
184
187
|
portal: g,
|
|
185
188
|
tokenTarget: () => g()?.parentElement ?? void 0,
|
|
186
189
|
resolvedMode: T,
|
|
187
190
|
messages: b(() => o(i.messages(), e.messages)),
|
|
188
191
|
async set(t) {
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
if (e.controllable) {
|
|
193
|
+
f((e) => ({
|
|
194
|
+
...e,
|
|
195
|
+
...t
|
|
196
|
+
}));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
let n = Object.keys(t).filter((e) => Object.hasOwn(A(), e));
|
|
200
|
+
if (n.length) throw Error(`ThemeScope pins ${n.join(", ")}; changing a pinned axis requires controllable=true`);
|
|
201
|
+
await i.set(t);
|
|
194
202
|
}
|
|
195
|
-
}), k = S(),
|
|
203
|
+
}), k = S(), A = () => {
|
|
196
204
|
let t = {};
|
|
197
205
|
return e.theme !== void 0 && (t.theme = e.theme), e.mode !== void 0 && (t.mode = e.mode), e.accent !== void 0 && (t.accent = e.accent), e.density !== void 0 && (t.density = e.density), e.radius !== void 0 && (t.radius = e.radius), e.motion !== void 0 && (t.motion = e.motion), e.direction !== void 0 && (t.direction = e.direction), e.locale !== void 0 && (t.locale = e.locale), t;
|
|
198
206
|
};
|
|
199
|
-
return l(
|
|
207
|
+
return l(N.Provider, {
|
|
200
208
|
value: O,
|
|
201
209
|
get children() {
|
|
202
210
|
return l(s.Provider, {
|
|
@@ -210,17 +218,17 @@ function R(e) {
|
|
|
210
218
|
return C();
|
|
211
219
|
},
|
|
212
220
|
get children() {
|
|
213
|
-
var t =
|
|
221
|
+
var t = j(), n = t.firstChild;
|
|
214
222
|
return m(t, "id", k), h(t, p({ get class() {
|
|
215
223
|
return e.class;
|
|
216
|
-
} }, () =>
|
|
224
|
+
} }, () => F(v(), T(), D()), {
|
|
217
225
|
get dir() {
|
|
218
226
|
return v().direction;
|
|
219
227
|
},
|
|
220
228
|
get lang() {
|
|
221
229
|
return v().locale;
|
|
222
230
|
}
|
|
223
|
-
}), !1, !0), d(t, () => e.children, n), d(t, l(
|
|
231
|
+
}), !1, !0), d(t, () => e.children, n), d(t, l(I, {
|
|
224
232
|
kind: "scope",
|
|
225
233
|
ref: _,
|
|
226
234
|
get state() {
|
|
@@ -233,7 +241,7 @@ function R(e) {
|
|
|
233
241
|
return D();
|
|
234
242
|
}
|
|
235
243
|
}), n), u((e) => {
|
|
236
|
-
var t = i.nonce, a = r(
|
|
244
|
+
var t = i.nonce, a = r(A(), i.defaults, D());
|
|
237
245
|
return t !== e.e && m(n, "nonce", e.e = t), a !== e.t && (n.innerHTML = e.t = a), e;
|
|
238
246
|
}, {
|
|
239
247
|
e: void 0,
|
|
@@ -246,5 +254,4 @@ function R(e) {
|
|
|
246
254
|
}
|
|
247
255
|
});
|
|
248
256
|
}
|
|
249
|
-
|
|
250
|
-
export { L as ThemeProvider, R as ThemeScope, N as useTheme };
|
|
257
|
+
export { R as ThemeProvider, z as ThemeScope, P as useTheme };
|
package/dist/theme/intl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTheme as e } from "./ThemeProvider.js";
|
|
2
2
|
import { createMemo as t } from "solid-js";
|
|
3
|
-
|
|
3
|
+
// src/theme/intl.ts
|
|
4
4
|
function n(n = {}) {
|
|
5
5
|
let r = e(), i = t(() => r.state().locale);
|
|
6
6
|
return t(() => new Intl.NumberFormat(i(), n));
|
|
@@ -9,5 +9,4 @@ function r(n = { timeZone: "UTC" }) {
|
|
|
9
9
|
let r = e(), i = t(() => r.state().locale);
|
|
10
10
|
return t(() => new Intl.DateTimeFormat(i(), n));
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { r as useDateFormatter, n as useNumberFormatter };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// src/theme/keyboard-script.ts
|
|
2
2
|
function e() {
|
|
3
3
|
return "(()=>{document.addEventListener(\"keydown\",event=>{const target=event.target;if(!(target instanceof Element)||!target.matches(\"[data-sheen-select-trigger],[data-sheen-menu-trigger]\")||event.ctrlKey||event.metaKey||event.altKey||event.isComposing)return;if(![\"ArrowDown\",\"ArrowUp\",\"ArrowLeft\",\"ArrowRight\"].includes(event.key)&&event.key.length!==1)return;if(event.key===\" \")return;const hydration=window._$HY;if(!hydration?.events||hydration.completed.has(target)||!target.hasAttribute(\"data-hk\"))return;event.preventDefault();hydration.events.push([target,event]);});})();";
|
|
4
4
|
}
|
|
5
|
-
//#endregion
|
|
6
5
|
export { e as createKeyboardHydrationScript };
|
package/dist/theme/layers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSignal as e } from "solid-js";
|
|
2
|
-
|
|
2
|
+
// src/theme/layers.ts
|
|
3
3
|
function t() {
|
|
4
4
|
let [t, n] = e([]);
|
|
5
5
|
return {
|
|
@@ -19,5 +19,4 @@ function t() {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { t as createOverlayStack };
|
package/dist/theme/messages.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const englishMessages: Readonly<{
|
|
2
2
|
close: "Close";
|
|
3
|
+
dismiss: "Dismiss";
|
|
4
|
+
announcement: "Announcement";
|
|
3
5
|
cancel: "Cancel";
|
|
4
6
|
confirm: "Confirm";
|
|
5
7
|
retry: "Retry";
|
|
@@ -98,6 +100,12 @@ export declare const englishMessages: Readonly<{
|
|
|
98
100
|
shortcutInventory: "All registered shortcuts. Availability depends on the active scope.";
|
|
99
101
|
shortcutShadowed: "Replaced by a newer binding";
|
|
100
102
|
shortcutDisabled: "Character shortcut disabled";
|
|
103
|
+
promptInput: "Message";
|
|
104
|
+
sendMessage: "Send message";
|
|
105
|
+
stopResponse: "Stop response";
|
|
106
|
+
conversation: "Conversation";
|
|
107
|
+
jumpToLatest: "Jump to latest message";
|
|
108
|
+
responseComplete: "Response complete";
|
|
101
109
|
unsavedTitle: "Discard unsaved changes?";
|
|
102
110
|
unsavedDescription: "Your unsaved changes will be lost if you leave this page.";
|
|
103
111
|
discardChanges: "Discard changes";
|
|
@@ -231,6 +239,24 @@ export interface ExtensionMessages {
|
|
|
231
239
|
readonly chartZoomOut?: string;
|
|
232
240
|
readonly chartResetZoom?: string;
|
|
233
241
|
readonly chartKeyboardInstructions?: string;
|
|
242
|
+
readonly chartGridKeyboardInstructions?: string;
|
|
243
|
+
readonly chartSeriesColumn?: string;
|
|
244
|
+
readonly chartShareColumn?: string;
|
|
245
|
+
readonly sortableInstructions?: string;
|
|
246
|
+
readonly sortableHandle?: string;
|
|
247
|
+
readonly sortableLifted?: string;
|
|
248
|
+
readonly sortableMoved?: string;
|
|
249
|
+
readonly sortableDropped?: string;
|
|
250
|
+
readonly sortableCancelled?: string;
|
|
251
|
+
readonly boardInstructions?: string;
|
|
252
|
+
readonly boardCardHandle?: string;
|
|
253
|
+
readonly boardColumnHandle?: string;
|
|
254
|
+
readonly boardLifted?: string;
|
|
255
|
+
readonly boardMoved?: string;
|
|
256
|
+
readonly boardDropped?: string;
|
|
257
|
+
readonly boardCancelled?: string;
|
|
258
|
+
readonly boardEmptyColumn?: string;
|
|
259
|
+
readonly boardCardCount?: string;
|
|
234
260
|
}
|
|
235
261
|
type CoreMessages = Readonly<Record<keyof typeof englishMessages, string>>;
|
|
236
262
|
export type Messages = CoreMessages & ExtensionMessages;
|
package/dist/theme/messages.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// src/theme/messages.ts
|
|
2
2
|
var e = Object.freeze({
|
|
3
3
|
close: "Close",
|
|
4
|
+
dismiss: "Dismiss",
|
|
5
|
+
announcement: "Announcement",
|
|
4
6
|
cancel: "Cancel",
|
|
5
7
|
confirm: "Confirm",
|
|
6
8
|
retry: "Retry",
|
|
@@ -99,6 +101,12 @@ var e = Object.freeze({
|
|
|
99
101
|
shortcutInventory: "All registered shortcuts. Availability depends on the active scope.",
|
|
100
102
|
shortcutShadowed: "Replaced by a newer binding",
|
|
101
103
|
shortcutDisabled: "Character shortcut disabled",
|
|
104
|
+
promptInput: "Message",
|
|
105
|
+
sendMessage: "Send message",
|
|
106
|
+
stopResponse: "Stop response",
|
|
107
|
+
conversation: "Conversation",
|
|
108
|
+
jumpToLatest: "Jump to latest message",
|
|
109
|
+
responseComplete: "Response complete",
|
|
102
110
|
unsavedTitle: "Discard unsaved changes?",
|
|
103
111
|
unsavedDescription: "Your unsaved changes will be lost if you leave this page.",
|
|
104
112
|
discardChanges: "Discard changes",
|
|
@@ -111,5 +119,4 @@ function t(e, t = {}) {
|
|
|
111
119
|
...t
|
|
112
120
|
});
|
|
113
121
|
}
|
|
114
|
-
//#endregion
|
|
115
122
|
export { e as englishMessages, t as resolveMessages };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext as e } from "solid-js";
|
|
2
|
-
|
|
2
|
+
// src/theme/number-format-cache.ts
|
|
3
3
|
var t = e();
|
|
4
4
|
function n(e) {
|
|
5
5
|
if (e === void 0) return "[]";
|
|
@@ -37,5 +37,4 @@ function r() {
|
|
|
37
37
|
return e.set(a, s), s;
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
//#endregion
|
|
41
40
|
export { t as NumberFormatContext, r as createNumberFormatCache };
|
package/dist/theme/script.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export declare function createThemeScript(options?: {
|
|
|
5
5
|
storageKey?: string;
|
|
6
6
|
themeIds?: readonly string[];
|
|
7
7
|
themes?: readonly ThemeMetadata[];
|
|
8
|
+
accents?: readonly string[];
|
|
8
9
|
}): string;
|
|
9
10
|
export declare function createScopeScript(overrides: ThemeOverrides, defaults: ThemeState, themes?: readonly ThemeMetadata[]): string;
|
package/dist/theme/script.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaultThemeState as e, themeChoices as t } from "./state.js";
|
|
2
2
|
import { bundledThemeMetadata as n } from "@gemologic/sheen-tokens/catalog";
|
|
3
|
-
|
|
3
|
+
// src/theme/script.ts
|
|
4
4
|
function r(e) {
|
|
5
5
|
let t = { ...e.defaults };
|
|
6
6
|
try {
|
|
@@ -24,7 +24,8 @@ function i(i = {}) {
|
|
|
24
24
|
storageKey: i.storageKey ?? "sheen",
|
|
25
25
|
choices: {
|
|
26
26
|
...t,
|
|
27
|
-
theme: o
|
|
27
|
+
theme: o,
|
|
28
|
+
accent: [...t.accent, ...(i.accents ?? []).filter((e) => !t.accent.some((t) => t === e))]
|
|
28
29
|
},
|
|
29
30
|
iconSets: Object.fromEntries(a.map((e) => [e.id, e.iconSet]))
|
|
30
31
|
}, c = JSON.stringify(s).replaceAll("<", "\\u003c").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
|
|
@@ -45,5 +46,4 @@ function o(e, t, r = n) {
|
|
|
45
46
|
let i = (e) => JSON.stringify(e).replaceAll("<", "\\u003c").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029"), o = Object.fromEntries(r.map((e) => [e.id, e.iconSet]));
|
|
46
47
|
return `(${a.toString()})(${i(e)},${i(t)},${i(o)});`;
|
|
47
48
|
}
|
|
48
|
-
//#endregion
|
|
49
49
|
export { o as createScopeScript, i as createThemeScript };
|
package/dist/theme/state.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { AccentName } from "@gemologic/sheen-tokens/catalog";
|
|
2
1
|
import type { Mode } from "@gemologic/sheen-tokens";
|
|
3
2
|
export interface ThemeState {
|
|
4
3
|
theme: string;
|
|
5
4
|
mode: Mode | "system";
|
|
6
|
-
accent
|
|
5
|
+
/** A bundled accent name or a custom accent ID registered with ThemeProvider `accents`. */
|
|
6
|
+
accent: string;
|
|
7
7
|
density: "compact" | "comfortable" | "spacious";
|
|
8
8
|
radius: "sharp" | "soft" | "round";
|
|
9
9
|
motion: "full" | "reduced";
|
|
@@ -15,11 +15,11 @@ export type ThemeOverrides = {
|
|
|
15
15
|
[K in keyof ThemeState]?: ThemeState[K] | null;
|
|
16
16
|
};
|
|
17
17
|
export declare function resolveThemeState(parent: ThemeState, overrides: ThemeOverrides, defaults: ThemeState): ThemeState;
|
|
18
|
-
export declare function readThemeState(value: unknown, fallback: ThemeState, themeIds?: readonly string[]): ThemeState;
|
|
18
|
+
export declare function readThemeState(value: unknown, fallback: ThemeState, themeIds?: readonly string[], accentIds?: readonly string[]): ThemeState;
|
|
19
19
|
export declare const themeChoices: Readonly<{
|
|
20
20
|
theme: string[];
|
|
21
21
|
mode: string[];
|
|
22
|
-
accent: readonly AccentName[];
|
|
22
|
+
accent: readonly import("@gemologic/sheen-tokens").AccentName[];
|
|
23
23
|
density: string[];
|
|
24
24
|
radius: string[];
|
|
25
25
|
motion: string[];
|
package/dist/theme/state.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { accentNames as e, bundledThemeMetadata as t
|
|
2
|
-
|
|
3
|
-
var
|
|
1
|
+
import { accentNames as e, bundledThemeMetadata as t } from "@gemologic/sheen-tokens/catalog";
|
|
2
|
+
// src/theme/state.ts
|
|
3
|
+
var n = Object.freeze({
|
|
4
4
|
theme: "obsidian",
|
|
5
5
|
mode: "dark",
|
|
6
6
|
accent: "jade",
|
|
@@ -10,7 +10,7 @@ var r = Object.freeze({
|
|
|
10
10
|
direction: "ltr",
|
|
11
11
|
locale: "en-US"
|
|
12
12
|
});
|
|
13
|
-
function
|
|
13
|
+
function r(e, t, n) {
|
|
14
14
|
return {
|
|
15
15
|
theme: t.theme === null ? n.theme : t.theme ?? e.theme,
|
|
16
16
|
mode: t.mode === null ? n.mode : t.mode ?? e.mode,
|
|
@@ -22,15 +22,15 @@ function i(e, t, n) {
|
|
|
22
22
|
locale: t.locale === null ? n.locale : t.locale ?? e.locale
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
if (typeof
|
|
27
|
-
let
|
|
28
|
-
if ("theme" in
|
|
29
|
-
Intl.getCanonicalLocales(
|
|
25
|
+
function i(n, r, i = t.map((e) => e.id), a = e) {
|
|
26
|
+
if (typeof n != "object" || !n) return { ...r };
|
|
27
|
+
let o = { ...r };
|
|
28
|
+
if ("theme" in n && typeof n.theme == "string" && i.includes(n.theme) && (o.theme = n.theme), "mode" in n && (n.mode === "dark" || n.mode === "light" || n.mode === "system") && (o.mode = n.mode), "accent" in n && typeof n.accent == "string" && a.includes(n.accent) && (o.accent = n.accent), "density" in n && (n.density === "compact" || n.density === "comfortable" || n.density === "spacious") && (o.density = n.density), "radius" in n && (n.radius === "sharp" || n.radius === "soft" || n.radius === "round") && (o.radius = n.radius), "motion" in n && (n.motion === "full" || n.motion === "reduced") && (o.motion = n.motion), "direction" in n && (n.direction === "rtl" || n.direction === "ltr") && (o.direction = n.direction), "locale" in n && typeof n.locale == "string") try {
|
|
29
|
+
Intl.getCanonicalLocales(n.locale).length && (o.locale = n.locale);
|
|
30
30
|
} catch {}
|
|
31
|
-
return
|
|
31
|
+
return o;
|
|
32
32
|
}
|
|
33
|
-
var
|
|
33
|
+
var a = Object.freeze({
|
|
34
34
|
theme: t.map((e) => e.id),
|
|
35
35
|
mode: [
|
|
36
36
|
"dark",
|
|
@@ -51,5 +51,4 @@ var o = Object.freeze({
|
|
|
51
51
|
motion: ["full", "reduced"],
|
|
52
52
|
direction: ["ltr", "rtl"]
|
|
53
53
|
});
|
|
54
|
-
|
|
55
|
-
export { r as defaultThemeState, a as readThemeState, i as resolveThemeState, o as themeChoices };
|
|
54
|
+
export { n as defaultThemeState, i as readThemeState, r as resolveThemeState, a as themeChoices };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sizes a textarea's block size to its content once per animation frame while `enabled` is true.
|
|
3
|
+
* Width changes, font loads, and form resets reschedule measurement; the returned function schedules it explicitly.
|
|
4
|
+
* Disabling restores the inline block size the element had before resizing took ownership.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createAutoResize(element: () => HTMLTextAreaElement | undefined, enabled: () => boolean): () => void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { onCleanup as e, onMount as t } from "solid-js";
|
|
2
|
+
// src/utils/auto-resize.ts
|
|
3
|
+
function n(n, r) {
|
|
4
|
+
let i = !1, a, o = !1, s = "", c = () => {
|
|
5
|
+
a = void 0;
|
|
6
|
+
let e = n();
|
|
7
|
+
e && i && (r() ? e.getClientRects().length && (o || (s = e.style.blockSize), o = !0, e.style.blockSize = "auto", e.style.blockSize = `${e.scrollHeight + e.offsetHeight - e.clientHeight}px`) : (o && (e.style.blockSize = s), o = !1));
|
|
8
|
+
}, l = () => {
|
|
9
|
+
let e = n();
|
|
10
|
+
i && e && a === void 0 && (a = e.ownerDocument.defaultView?.requestAnimationFrame(c));
|
|
11
|
+
};
|
|
12
|
+
return t(() => {
|
|
13
|
+
let t = n();
|
|
14
|
+
if (!t) return;
|
|
15
|
+
i = !0;
|
|
16
|
+
let r = -1, o = new ResizeObserver((e) => {
|
|
17
|
+
let t = e[0]?.contentRect.width;
|
|
18
|
+
t !== void 0 && t !== r && (r = t, l());
|
|
19
|
+
});
|
|
20
|
+
o.observe(t);
|
|
21
|
+
let s = t.ownerDocument.fonts;
|
|
22
|
+
s.ready.then(l), s.addEventListener("loadingdone", l);
|
|
23
|
+
let c = (e) => {
|
|
24
|
+
e.target === t.form && l();
|
|
25
|
+
};
|
|
26
|
+
t.ownerDocument.addEventListener("reset", c, !0), l(), e(() => {
|
|
27
|
+
i = !1, o.disconnect(), s.removeEventListener("loadingdone", l), t.ownerDocument.removeEventListener("reset", c, !0), a !== void 0 && t.ownerDocument.defaultView?.cancelAnimationFrame(a);
|
|
28
|
+
});
|
|
29
|
+
}), l;
|
|
30
|
+
}
|
|
31
|
+
export { n as createAutoResize };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSignal as e, onCleanup as t, onMount as n } from "solid-js";
|
|
2
|
-
|
|
2
|
+
// src/utils/browser-status.ts
|
|
3
3
|
function r() {
|
|
4
4
|
let [r, i] = e();
|
|
5
5
|
return n(() => {
|
|
@@ -18,5 +18,4 @@ function i() {
|
|
|
18
18
|
});
|
|
19
19
|
}), r;
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { i as useIsWindowFocused, r as useOnlineStatus };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ChangeDirection = "up" | "down";
|
|
2
|
+
/** Milliseconds of `--sheen-duration-slow` on the element, which reduced motion zeroes. */
|
|
3
|
+
export declare function motionDuration(element: Element): number;
|
|
4
|
+
/**
|
|
5
|
+
* Briefly tints an element with its market direction after a value change. Callers
|
|
6
|
+
* skip the initial render; reduced motion turns this into a no-op.
|
|
7
|
+
*/
|
|
8
|
+
export declare function flashChange(element: HTMLElement, direction: ChangeDirection): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/utils/change-motion.ts
|
|
2
|
+
var e = "sheen-change-flash";
|
|
3
|
+
function t(e) {
|
|
4
|
+
let t = getComputedStyle(e).getPropertyValue("--sheen-duration-slow").trim(), n = Number.parseFloat(t);
|
|
5
|
+
return !Number.isFinite(n) || n <= 0 ? 0 : t.endsWith("ms") ? n : n * 1e3;
|
|
6
|
+
}
|
|
7
|
+
function n(n, r) {
|
|
8
|
+
let i = t(n) * 4;
|
|
9
|
+
if (i === 0 || typeof n.animate != "function") return;
|
|
10
|
+
let a = getComputedStyle(n).getPropertyValue(r === "up" ? "--sheen-color-market-up" : "--sheen-color-market-down").trim();
|
|
11
|
+
if (!a) return;
|
|
12
|
+
for (let t of n.getAnimations()) t.id === e && t.cancel();
|
|
13
|
+
let o = n.animate([{ boxShadow: `inset 0 0 0 100vmax color-mix(in srgb, ${a} 22%, transparent)` }, { boxShadow: "inset 0 0 0 100vmax transparent" }], {
|
|
14
|
+
duration: i,
|
|
15
|
+
easing: "cubic-bezier(0, 0, 0, 1)"
|
|
16
|
+
});
|
|
17
|
+
o.id = e;
|
|
18
|
+
}
|
|
19
|
+
export { n as flashChange, t as motionDuration };
|
package/dist/utils/cn.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Accessor } from "solid-js";
|
|
2
|
+
import type { BreakpointName } from "@gemologic/sheen-tokens/catalog";
|
|
3
|
+
/**
|
|
4
|
+
* Tracks a media query. Server markup and the first client frame use `serverValue`, so hydration stays
|
|
5
|
+
* deterministic; the live value applies after mount. Use it for behavior (drawer versus persistent panel),
|
|
6
|
+
* never to hide content: CSS owns layout.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createMediaQuery(query: string, serverValue?: boolean): Accessor<boolean>;
|
|
9
|
+
/** `up` matches at and above the breakpoint, `down` strictly below it. */
|
|
10
|
+
export declare function useBreakpoint(name: BreakpointName, direction?: "up" | "down", serverValue?: boolean): Accessor<boolean>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createSignal as e, onCleanup as t, onMount as n } from "solid-js";
|
|
2
|
+
import { breakpointQuery as r } from "@gemologic/sheen-tokens/catalog";
|
|
3
|
+
// src/utils/media-query.ts
|
|
4
|
+
function i(r, i = !1) {
|
|
5
|
+
let [a, o] = e(i);
|
|
6
|
+
return n(() => {
|
|
7
|
+
let e = window.matchMedia(r), n = () => {
|
|
8
|
+
o(e.matches);
|
|
9
|
+
};
|
|
10
|
+
n(), e.addEventListener("change", n), t(() => e.removeEventListener("change", n));
|
|
11
|
+
}), a;
|
|
12
|
+
}
|
|
13
|
+
function a(e, t = "up", n = !1) {
|
|
14
|
+
return i(r(e, t), n);
|
|
15
|
+
}
|
|
16
|
+
export { i as createMediaQuery, a as useBreakpoint };
|
package/dist/utils/optimistic.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/shortcut-platform.ts
|
|
2
2
|
function e(e) {
|
|
3
3
|
return e.startsWith("Mac") || [
|
|
4
4
|
"iPhone",
|
|
@@ -6,5 +6,4 @@ function e(e) {
|
|
|
6
6
|
"iPod"
|
|
7
7
|
].includes(e) ? "mac" : "other";
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { e as resolveShortcutPlatform };
|