@adea-ai/ui 0.156.0 → 0.158.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 +3 -3
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +305 -172
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts +6 -0
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +2 -2
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-types.d.ts +26 -0
- package/dist/components/composites/appearance-editor/appearance-types.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-types.js +10 -0
- package/dist/components/composites/appearance-editor/appearance-types.js.map +1 -0
- package/dist/components/composites/appearance-editor/font-settings-group.d.ts +13 -1
- package/dist/components/composites/appearance-editor/font-settings-group.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +51 -15
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/index.d.ts +2 -1
- package/dist/components/composites/appearance-editor/index.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/index.js +3 -2
- package/dist/components/theme/theme-document.d.ts +1 -1
- package/dist/components/theme/theme-document.js.map +1 -1
- package/dist/components/theme/theme-provider-value.d.ts +1 -1
- package/dist/components/theme/theme-provider-value.js.map +1 -1
- package/dist/components/ui/button/button.d.ts.map +1 -1
- package/dist/components/ui/button/button.js +3 -3
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +4 -18
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/lib/appearance-font-settings.d.ts +18 -4
- package/dist/lib/appearance-font-settings.d.ts.map +1 -1
- package/dist/lib/appearance-font-settings.js +24 -6
- package/dist/lib/appearance-font-settings.js.map +1 -1
- package/dist/lib/fast-icon.d.ts +2 -1
- package/dist/lib/fast-icon.d.ts.map +1 -1
- package/dist/lib/fast-icon.js +4 -3
- package/dist/lib/fast-icon.js.map +1 -1
- package/dist/lib/font-catalog.d.ts +5 -0
- package/dist/lib/font-catalog.d.ts.map +1 -1
- package/dist/lib/font-catalog.js +10 -5
- package/dist/lib/font-catalog.js.map +1 -1
- package/dist/lib/font-zoom.d.ts +1 -1
- package/dist/lib/font-zoom.d.ts.map +1 -1
- package/dist/lib/font-zoom.js +5 -1
- package/dist/lib/font-zoom.js.map +1 -1
- package/dist/lib/theme-defaults.generated.d.ts.map +1 -1
- package/dist/lib/theme-defaults.generated.js +88 -60
- package/dist/lib/theme-defaults.generated.js.map +1 -1
- package/dist/lib/theme-projection.d.ts +2 -0
- package/dist/lib/theme-projection.d.ts.map +1 -1
- package/dist/lib/theme-projection.js +2 -2
- package/dist/lib/theme-projection.js.map +1 -1
- package/dist/lib/theme-types.d.ts +7 -0
- package/dist/lib/theme-types.d.ts.map +1 -1
- package/dist/lib/theme-types.js +7 -0
- package/dist/lib/theme-types.js.map +1 -1
- package/dist/lib/tokens.d.ts.map +1 -1
- package/dist/lib/tokens.js +17 -2
- package/dist/lib/tokens.js.map +1 -1
- package/dist/r/appearance-editor.json +2 -1
- package/dist/r/lib.json +1 -1
- package/dist/r/registry.json +4 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +202 -110
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +11 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +27 -0
- package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +50 -10
- package/dist/r/src/components/composites/appearance-editor/index.ts +3 -0
- package/dist/r/src/components/theme/theme-document.ts +1 -1
- package/dist/r/src/components/theme/theme-provider-value.ts +1 -1
- package/dist/r/src/components/ui/button/button.tsx +12 -3
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +9 -18
- package/dist/r/src/lib/appearance-font-settings.ts +43 -7
- package/dist/r/src/lib/fast-icon.ts +11 -4
- package/dist/r/src/lib/font-catalog.ts +5 -0
- package/dist/r/src/lib/font-zoom.ts +3 -0
- package/dist/r/src/lib/theme-defaults.generated.ts +88 -60
- package/dist/r/src/lib/theme-projection.ts +2 -0
- package/dist/r/src/lib/theme-types.ts +7 -0
- package/dist/r/src/lib/tokens.ts +17 -2
- package/dist/r/src/styles/appearance-font-settings.css +2 -0
- package/dist/r/src/styles/theme-variants.css +608 -370
- package/dist/r/src/styles/theme.css +4 -4
- package/dist/r/theming.json +1 -1
- package/package.json +2 -2
- package/registry.json +4 -3
- package/src/components/composites/appearance-editor/appearance-editor.tsx +202 -110
- package/src/components/composites/appearance-editor/appearance-rows.tsx +11 -1
- package/src/components/composites/appearance-editor/appearance-types.ts +27 -0
- package/src/components/composites/appearance-editor/font-settings-group.tsx +50 -10
- package/src/components/composites/appearance-editor/index.ts +3 -0
- package/src/components/theme/theme-document.ts +1 -1
- package/src/components/theme/theme-provider-value.ts +1 -1
- package/src/components/ui/button/button.tsx +12 -3
- package/src/components/ui/tooltip/tooltip.tsx +9 -18
- package/src/lib/appearance-font-settings.ts +43 -7
- package/src/lib/fast-icon.ts +11 -4
- package/src/lib/font-catalog.ts +5 -0
- package/src/lib/font-zoom.ts +3 -0
- package/src/lib/theme-defaults.generated.ts +88 -60
- package/src/lib/theme-projection.ts +2 -0
- package/src/lib/theme-types.ts +7 -0
- package/src/lib/tokens.ts +17 -2
- package/src/styles/appearance-font-settings.css +2 -0
- package/src/styles/theme-variants.css +608 -370
- package/src/styles/theme.css +4 -4
- package/src/styles/themes/aardvark-blue.css +7 -0
- package/src/styles/themes/aardvark-ink.css +7 -0
- package/src/styles/themes/adea-dark-colorblind.css +22 -15
- package/src/styles/themes/adea-dark-high-contrast.css +22 -15
- package/src/styles/themes/adea-dark.css +22 -15
- package/src/styles/themes/adea-light-colorblind.css +21 -14
- package/src/styles/themes/adea-light-high-contrast.css +21 -14
- package/src/styles/themes/adea-light.css +22 -15
- package/src/styles/themes/ayu-light.css +20 -13
- package/src/styles/themes/ayu-mirage.css +21 -14
- package/src/styles/themes/ayu.css +22 -15
- package/src/styles/themes/catppuccin-frappe.css +16 -9
- package/src/styles/themes/catppuccin-latte.css +15 -8
- package/src/styles/themes/catppuccin-macchiato.css +16 -9
- package/src/styles/themes/catppuccin-mocha.css +16 -9
- package/src/styles/themes/dracula.css +16 -9
- package/src/styles/themes/everforest-dark.css +19 -12
- package/src/styles/themes/everforest-light.css +21 -14
- package/src/styles/themes/gruvbox-dark.css +21 -14
- package/src/styles/themes/gruvbox-light.css +20 -13
- package/src/styles/themes/kanagawa.css +18 -11
- package/src/styles/themes/monokai.css +19 -12
- package/src/styles/themes/nord-light.css +7 -0
- package/src/styles/themes/nord.css +19 -12
- package/src/styles/themes/one-dark.css +16 -9
- package/src/styles/themes/rosepine-dawn.css +19 -12
- package/src/styles/themes/rosepine-moon.css +20 -13
- package/src/styles/themes/rosepine.css +20 -13
- package/src/styles/themes/solarized-dark.css +19 -12
- package/src/styles/themes/solarized-light.css +19 -12
- package/src/styles/themes/tokyonight-day.css +7 -0
- package/src/styles/themes/tokyonight-night.css +18 -11
- package/src/styles/themes/tokyonight-storm.css +18 -11
- package/src/styles/themes/vesper.css +22 -15
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
ChevronDown as LucideChevronDown,
|
|
4
4
|
Code2 as LucideCode2,
|
|
5
5
|
PanelsTopLeft as LucidePanelsTopLeft,
|
|
6
|
+
SquareTerminal as LucideSquareTerminal,
|
|
6
7
|
} from 'lucide-solid'
|
|
7
|
-
import { For, createMemo, createSignal, createUniqueId } from 'solid-js'
|
|
8
|
+
import { For, Show, createMemo, createSignal, createUniqueId } from 'solid-js'
|
|
8
9
|
import { DEFAULT_FONT_ID, fontOptions } from '#lib/font-catalog'
|
|
9
10
|
import { Button } from '../../ui/button'
|
|
10
11
|
import {
|
|
@@ -22,6 +23,7 @@ import {
|
|
|
22
23
|
APPEARANCE_EDITOR_FONT_SIZE_MIN,
|
|
23
24
|
normalizeAppearanceEditorFontSettings,
|
|
24
25
|
normalizeAppearanceEditorFontSize,
|
|
26
|
+
resolveAppearanceEditorFontSettings,
|
|
25
27
|
type AppearanceEditorFontAxis,
|
|
26
28
|
type AppearanceEditorFontFamilyId,
|
|
27
29
|
type AppearanceEditorFontSettings,
|
|
@@ -33,14 +35,29 @@ const BookOpen = fastIcon(LucideBookOpen)
|
|
|
33
35
|
const ChevronDown = fastIcon(LucideChevronDown)
|
|
34
36
|
const Code2 = fastIcon(LucideCode2)
|
|
35
37
|
const PanelsTopLeft = fastIcon(LucidePanelsTopLeft)
|
|
38
|
+
const SquareTerminal = fastIcon(LucideSquareTerminal)
|
|
36
39
|
|
|
37
40
|
export type AppearanceFontSettingsGroupProps = {
|
|
38
41
|
settings: AppearanceEditorFontSettings
|
|
39
42
|
menuPortalMount?: HTMLElement
|
|
40
43
|
onChange: (settings: AppearanceEditorFontSettings) => void
|
|
41
44
|
disabled?: boolean
|
|
45
|
+
/**
|
|
46
|
+
* The axes to draw, in the catalogue's order. The default is UI, Content and
|
|
47
|
+
* Code: with no terminal row the terminal keeps following Code. A host that
|
|
48
|
+
* lists `terminal` lets it be set apart; until it is, the row shows Code's value.
|
|
49
|
+
*/
|
|
50
|
+
axes?: readonly AppearanceEditorFontAxis[]
|
|
51
|
+
/**
|
|
52
|
+
* The rows sit under a tab that already names their subject: each is titled
|
|
53
|
+
* "Font" and carries no description. Controls keep the axis in their
|
|
54
|
+
* accessible names.
|
|
55
|
+
*/
|
|
56
|
+
sectioned?: boolean
|
|
42
57
|
}
|
|
43
58
|
|
|
59
|
+
const DEFAULT_FONT_ROW_AXES: readonly AppearanceEditorFontAxis[] = ['ui', 'content', 'code']
|
|
60
|
+
|
|
44
61
|
const FONT_ROWS = [
|
|
45
62
|
{
|
|
46
63
|
axis: 'ui',
|
|
@@ -57,9 +74,15 @@ const FONT_ROWS = [
|
|
|
57
74
|
{
|
|
58
75
|
axis: 'code',
|
|
59
76
|
label: 'Code',
|
|
60
|
-
description: 'Code,
|
|
77
|
+
description: 'Code, diffs, and file paths.',
|
|
61
78
|
icon: Code2,
|
|
62
79
|
},
|
|
80
|
+
{
|
|
81
|
+
axis: 'terminal',
|
|
82
|
+
label: 'Terminal',
|
|
83
|
+
description: 'Terminals and agent CLIs.',
|
|
84
|
+
icon: SquareTerminal,
|
|
85
|
+
},
|
|
63
86
|
] as const satisfies readonly {
|
|
64
87
|
axis: AppearanceEditorFontAxis
|
|
65
88
|
label: string
|
|
@@ -71,6 +94,7 @@ const catalogFontOptions = fontOptions.filter((option) => option.id !== DEFAULT_
|
|
|
71
94
|
|
|
72
95
|
function FontFamilyMenu(props: {
|
|
73
96
|
label: string
|
|
97
|
+
axis: AppearanceEditorFontAxis
|
|
74
98
|
family: AppearanceEditorFontFamilyId
|
|
75
99
|
menuPortalMount?: HTMLElement
|
|
76
100
|
disabled?: boolean
|
|
@@ -85,6 +109,12 @@ function FontFamilyMenu(props: {
|
|
|
85
109
|
fontOptions.find((option) => option.id === DEFAULT_FONT_ID)?.label ??
|
|
86
110
|
'System'
|
|
87
111
|
|
|
112
|
+
const selectedFamilyVariable = () =>
|
|
113
|
+
(
|
|
114
|
+
fontOptions.find((option) => option.id === props.family) ??
|
|
115
|
+
fontOptions.find((option) => option.id === DEFAULT_FONT_ID)
|
|
116
|
+
)?.familyVariables[props.axis] ?? '--font-family-system'
|
|
117
|
+
|
|
88
118
|
return (
|
|
89
119
|
<DropdownMenu
|
|
90
120
|
modal={false}
|
|
@@ -103,7 +133,11 @@ function FontFamilyMenu(props: {
|
|
|
103
133
|
disabled={props.disabled}
|
|
104
134
|
class="w-32 max-w-full justify-between"
|
|
105
135
|
>
|
|
106
|
-
|
|
136
|
+
{/* The choice is drawn in its own face: a preview, and the face is fetched as soon as
|
|
137
|
+
it is picked even when nothing else on screen uses this axis yet. */}
|
|
138
|
+
<span class="truncate" style={{ 'font-family': `var(${selectedFamilyVariable()})` }}>
|
|
139
|
+
{selectedLabel()}
|
|
140
|
+
</span>
|
|
107
141
|
<ChevronDown aria-hidden="true" class="ms-2 size-4 shrink-0 text-muted-foreground" />
|
|
108
142
|
</DropdownMenuTrigger>
|
|
109
143
|
<DropdownMenuContent
|
|
@@ -198,6 +232,9 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
|
|
|
198
232
|
>({})
|
|
199
233
|
const sizeHintPrefix = createUniqueId()
|
|
200
234
|
const settings = createMemo(() => normalizeAppearanceEditorFontSettings(props.settings).settings)
|
|
235
|
+
const resolved = createMemo(() => resolveAppearanceEditorFontSettings(settings()))
|
|
236
|
+
const axes = () => props.axes ?? DEFAULT_FONT_ROW_AXES
|
|
237
|
+
const rows = createMemo(() => FONT_ROWS.filter((row) => axes().includes(row.axis)))
|
|
201
238
|
|
|
202
239
|
const updateAxis = (
|
|
203
240
|
axis: AppearanceEditorFontAxis,
|
|
@@ -207,7 +244,7 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
|
|
|
207
244
|
props.onChange({
|
|
208
245
|
...current,
|
|
209
246
|
[axis]: {
|
|
210
|
-
...
|
|
247
|
+
...resolved()[axis],
|
|
211
248
|
...patch,
|
|
212
249
|
},
|
|
213
250
|
})
|
|
@@ -216,21 +253,21 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
|
|
|
216
253
|
const commitSize = (axis: AppearanceEditorFontAxis) => {
|
|
217
254
|
const input = sizeDrafts()[axis]
|
|
218
255
|
if (input === undefined) return
|
|
219
|
-
const size = normalizeAppearanceEditorFontSize(input,
|
|
256
|
+
const size = normalizeAppearanceEditorFontSize(input, resolved()[axis].size)
|
|
220
257
|
setSizeDrafts((current) => {
|
|
221
258
|
const next = { ...current }
|
|
222
259
|
delete next[axis]
|
|
223
260
|
return next
|
|
224
261
|
})
|
|
225
|
-
if (size !==
|
|
262
|
+
if (size !== resolved()[axis].size) updateAxis(axis, { size })
|
|
226
263
|
}
|
|
227
264
|
|
|
228
265
|
return (
|
|
229
266
|
<div class="global-appearance-font-settings">
|
|
230
|
-
<For each={
|
|
267
|
+
<For each={rows()}>
|
|
231
268
|
{(row) => {
|
|
232
269
|
const Icon = row.icon
|
|
233
|
-
const value = () =>
|
|
270
|
+
const value = () => resolved()[row.axis]
|
|
234
271
|
const inputValue = () => sizeDrafts()[row.axis] ?? String(value().size)
|
|
235
272
|
const sizeHintId = `${sizeHintPrefix}-${row.axis}-font-size-help`
|
|
236
273
|
const sizeIsInvalid = () => {
|
|
@@ -257,12 +294,15 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
|
|
|
257
294
|
and the title/subtitle stay aligned. The compact widths keep
|
|
258
295
|
that true at the appearance sheet's own width. */}
|
|
259
296
|
<div class="min-w-0 flex-1">
|
|
260
|
-
<h3 class="text-sm font-medium">{row.label}</h3>
|
|
261
|
-
<
|
|
297
|
+
<h3 class="text-sm font-medium">{props.sectioned ? 'Font' : row.label}</h3>
|
|
298
|
+
<Show when={!props.sectioned}>
|
|
299
|
+
<div class="mt-0.5 truncate text-xs text-muted-foreground">{row.description}</div>
|
|
300
|
+
</Show>
|
|
262
301
|
</div>
|
|
263
302
|
<div class="flex shrink-0 items-center gap-2">
|
|
264
303
|
<FontFamilyMenu
|
|
265
304
|
label={row.label}
|
|
305
|
+
axis={row.axis}
|
|
266
306
|
family={value().family}
|
|
267
307
|
menuPortalMount={props.menuPortalMount}
|
|
268
308
|
disabled={props.disabled}
|
|
@@ -14,12 +14,15 @@ export {
|
|
|
14
14
|
fontSettingsBootstrapScript,
|
|
15
15
|
normalizeAppearanceEditorFontSettings,
|
|
16
16
|
normalizeAppearanceEditorFontSize,
|
|
17
|
+
resolveAppearanceEditorFontSettings,
|
|
17
18
|
type AppearanceEditorFontAxis,
|
|
18
19
|
type AppearanceEditorFontFamilyId,
|
|
19
20
|
type AppearanceEditorFontSetting,
|
|
20
21
|
type AppearanceEditorFontSettings,
|
|
21
22
|
type NormalizedAppearanceEditorFontSettings,
|
|
23
|
+
type ResolvedAppearanceEditorFontSettings,
|
|
22
24
|
} from '#lib/appearance-font-settings'
|
|
25
|
+
export { APPEARANCE_EDITOR_TABS, type AppearanceEditorTab } from './appearance-types'
|
|
23
26
|
export type {
|
|
24
27
|
AppearanceDraft,
|
|
25
28
|
AppearanceEditorProps,
|
|
@@ -78,7 +78,7 @@ export type ThemeDocumentOptions = {
|
|
|
78
78
|
*
|
|
79
79
|
* With `palette: 'stylesheet'`, `floor` is the one palette write a catalogue
|
|
80
80
|
* variant still gets: the stylesheet is generated for the default projection, so
|
|
81
|
-
* the
|
|
81
|
+
* the `--editor-*` properties are written inline over it. The rest of the
|
|
82
82
|
* palette stays in the stylesheet.
|
|
83
83
|
*/
|
|
84
84
|
editorRoles?: EditorRolesMode
|
|
@@ -147,7 +147,7 @@ export type ThemeProviderProps = {
|
|
|
147
147
|
/**
|
|
148
148
|
* The projection behind the `--editor-*` ramp. `syntax` (the default) is the
|
|
149
149
|
* catalogue's quiet syntax roles, a comment among them deliberately below
|
|
150
|
-
* body-text contrast. `floor` holds
|
|
150
|
+
* body-text contrast. `floor` holds every role to 4.5:1 on the canvas, as
|
|
151
151
|
* hex, for a host that renders code as content (a diff, a file view) rather than
|
|
152
152
|
* as decoration.
|
|
153
153
|
*
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type ComponentProps,
|
|
4
|
+
mergeProps,
|
|
5
|
+
sharedConfig,
|
|
6
|
+
Show,
|
|
7
|
+
splitProps,
|
|
8
|
+
type ValidComponent,
|
|
9
|
+
} from 'solid-js'
|
|
3
10
|
import { isServer, spread } from 'solid-js/web'
|
|
4
11
|
import { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'
|
|
5
12
|
import { cn } from '#lib/utils'
|
|
@@ -115,7 +122,9 @@ export function Button<T extends ValidComponent = 'button'>(props: ButtonProps<T
|
|
|
115
122
|
// createElement and spread, which is what the compiled JSX would do, so the
|
|
116
123
|
// module holds no template: `buttonVariants` stays importable in plain Node
|
|
117
124
|
// (a server renderer reads the class contract from this entry). A server
|
|
118
|
-
// render has no document, so it takes the Polymorphic path.
|
|
125
|
+
// render has no document, so it takes the Polymorphic path. So does a button
|
|
126
|
+
// the client hydrates: a fresh element would not adopt the server's node, and
|
|
127
|
+
// its children would look for server nodes that were never claimed.
|
|
119
128
|
const native = () => {
|
|
120
129
|
const element = document.createElement('button')
|
|
121
130
|
spread(
|
|
@@ -132,7 +141,7 @@ export function Button<T extends ValidComponent = 'button'>(props: ButtonProps<T
|
|
|
132
141
|
}
|
|
133
142
|
return (
|
|
134
143
|
<Show
|
|
135
|
-
when={!isServer && (local.as === undefined || local.as === 'button')}
|
|
144
|
+
when={!isServer && !sharedConfig.context && (local.as === undefined || local.as === 'button')}
|
|
136
145
|
fallback={
|
|
137
146
|
<Polymorphic
|
|
138
147
|
as={local.as ?? 'button'}
|
|
@@ -47,13 +47,6 @@ const tooltipDefaults: TooltipTiming = {
|
|
|
47
47
|
|
|
48
48
|
const TooltipTimingContext = createContext<TooltipTiming>(tooltipDefaults)
|
|
49
49
|
|
|
50
|
-
/**
|
|
51
|
-
* How long after a pointer leaves a keyboard-focused trigger its close request
|
|
52
|
-
* still counts as the pointer's: Kobalte reports that close one `closeDelay`
|
|
53
|
-
* later, plus a frame of slack for the timer to fire.
|
|
54
|
-
*/
|
|
55
|
-
const POINTER_CLOSE_INTENT_SLACK_MS = 50
|
|
56
|
-
|
|
57
50
|
/**
|
|
58
51
|
* The layer a tooltip sits in, when that layer closes on Escape.
|
|
59
52
|
*
|
|
@@ -200,19 +193,18 @@ export function Tooltip(props: TooltipRootProps) {
|
|
|
200
193
|
let closeIntent = false
|
|
201
194
|
let ignoreDuplicateClose = false
|
|
202
195
|
let onOpenChange: (next: boolean, source?: 'handoff') => void
|
|
203
|
-
|
|
204
|
-
|
|
196
|
+
// Whether the next close Kobalte reports belongs to the pointer having left a
|
|
197
|
+
// trigger that still holds keyboard focus. It is state, not a deadline: Kobalte
|
|
198
|
+
// reports that close one `closeDelay` later on a timer, and a busy event loop
|
|
199
|
+
// can deliver it arbitrarily late, so the request stays the pointer's until it
|
|
200
|
+
// is answered or something explicit (open, blur, click, Escape, scroll, a
|
|
201
|
+
// handoff) takes over.
|
|
202
|
+
let pointerClosePending = false
|
|
205
203
|
const clearPointerCloseIntent = () => {
|
|
206
|
-
|
|
207
|
-
if (pointerCloseIntentTimeout) clearTimeout(pointerCloseIntentTimeout)
|
|
208
|
-
pointerCloseIntentTimeout = undefined
|
|
204
|
+
pointerClosePending = false
|
|
209
205
|
}
|
|
210
206
|
const markPointerCloseIntent = () => {
|
|
211
|
-
if (
|
|
212
|
-
clearPointerCloseIntent()
|
|
213
|
-
const intentWindow = (props.closeDelay ?? timing.closeDelay) + POINTER_CLOSE_INTENT_SLACK_MS
|
|
214
|
-
pointerCloseIntentUntil = Date.now() + intentWindow
|
|
215
|
-
pointerCloseIntentTimeout = setTimeout(clearPointerCloseIntent, intentWindow)
|
|
207
|
+
if (isOpen()) pointerClosePending = true
|
|
216
208
|
}
|
|
217
209
|
const markCloseIntent = () => {
|
|
218
210
|
closeIntent = true
|
|
@@ -277,7 +269,6 @@ export function Tooltip(props: TooltipRootProps) {
|
|
|
277
269
|
const focusedTrigger = interaction.isTriggerFocused()
|
|
278
270
|
const anotherTooltipOpening =
|
|
279
271
|
pendingTooltipOpenId !== undefined && pendingTooltipOpenId !== id
|
|
280
|
-
const pointerClosePending = Date.now() <= pointerCloseIntentUntil
|
|
281
272
|
if (
|
|
282
273
|
source !== 'handoff' &&
|
|
283
274
|
focusedTrigger &&
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DEFAULT_FONT_ID, fontOptions, type FontOption } from '#lib/font-catalog'
|
|
2
2
|
import { safeScriptStringLiteral } from '#lib/safe-script'
|
|
3
3
|
|
|
4
|
-
export const APPEARANCE_EDITOR_FONT_AXES = ['ui', 'content', 'code'] as const
|
|
4
|
+
export const APPEARANCE_EDITOR_FONT_AXES = ['ui', 'content', 'code', 'terminal'] as const
|
|
5
5
|
|
|
6
6
|
export type AppearanceEditorFontAxis = (typeof APPEARANCE_EDITOR_FONT_AXES)[number]
|
|
7
7
|
export type AppearanceEditorFontFamilyId = FontOption['id']
|
|
@@ -13,8 +13,21 @@ export type AppearanceEditorFontSetting = Readonly<{
|
|
|
13
13
|
size: number
|
|
14
14
|
}>
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* The host-owned choices edited by the shared appearance composition.
|
|
18
|
+
*
|
|
19
|
+
* `terminal` is optional in what a host stores: a record written before the
|
|
20
|
+
* terminal had its own axis, or by a host that never offers one, follows the
|
|
21
|
+
* Code axis. Normalization keeps it absent, so such a record is stored as it was.
|
|
22
|
+
*/
|
|
17
23
|
export type AppearanceEditorFontSettings = Readonly<
|
|
24
|
+
Record<Exclude<AppearanceEditorFontAxis, 'terminal'>, AppearanceEditorFontSetting> & {
|
|
25
|
+
terminal?: AppearanceEditorFontSetting
|
|
26
|
+
}
|
|
27
|
+
>
|
|
28
|
+
|
|
29
|
+
/** Font settings with every axis resolved (`resolveAppearanceEditorFontSettings`). */
|
|
30
|
+
export type ResolvedAppearanceEditorFontSettings = Readonly<
|
|
18
31
|
Record<AppearanceEditorFontAxis, AppearanceEditorFontSetting>
|
|
19
32
|
>
|
|
20
33
|
|
|
@@ -28,6 +41,15 @@ export const DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS: AppearanceEditorFontSettin
|
|
|
28
41
|
code: Object.freeze({ family: DEFAULT_FONT_ID, size: 12 }),
|
|
29
42
|
})
|
|
30
43
|
|
|
44
|
+
/** Every axis with a value: the terminal follows Code until it is given its own. */
|
|
45
|
+
export function resolveAppearanceEditorFontSettings(
|
|
46
|
+
settings: AppearanceEditorFontSettings
|
|
47
|
+
): ResolvedAppearanceEditorFontSettings {
|
|
48
|
+
return settings.terminal
|
|
49
|
+
? (settings as ResolvedAppearanceEditorFontSettings)
|
|
50
|
+
: { ...settings, terminal: settings.code }
|
|
51
|
+
}
|
|
52
|
+
|
|
31
53
|
export type NormalizedAppearanceEditorFontSettings = Readonly<{
|
|
32
54
|
settings: AppearanceEditorFontSettings
|
|
33
55
|
/** Axes whose persisted family or size was unavailable or outside its limits. */
|
|
@@ -71,6 +93,13 @@ const fontAxisProjection = Object.freeze({
|
|
|
71
93
|
scaleProperty: '--font-code-scale',
|
|
72
94
|
defaultSize: DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS.code.size,
|
|
73
95
|
}),
|
|
96
|
+
terminal: Object.freeze({
|
|
97
|
+
familyAttribute: 'data-terminal-font',
|
|
98
|
+
familyProperty: '--font-terminal',
|
|
99
|
+
sizeProperty: '--font-terminal-size',
|
|
100
|
+
scaleProperty: '--font-terminal-scale',
|
|
101
|
+
defaultSize: DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS.code.size,
|
|
102
|
+
}),
|
|
74
103
|
})
|
|
75
104
|
|
|
76
105
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
@@ -108,6 +137,8 @@ export function normalizeAppearanceEditorFontSize(value: unknown, fallback: numb
|
|
|
108
137
|
/**
|
|
109
138
|
* Recover persisted font choices against the shared font catalogue.
|
|
110
139
|
*
|
|
140
|
+
* A record with no `terminal` axis is returned without one: it follows Code.
|
|
141
|
+
*
|
|
111
142
|
* `legacyUiFamily` lets a host migrate its previous single font field into the
|
|
112
143
|
* UI axis. Content and code remain on the new System defaults during that
|
|
113
144
|
* migration. Missing settings are ordinary defaults; an unknown saved id or an
|
|
@@ -120,13 +151,18 @@ export function normalizeAppearanceEditorFontSettings(
|
|
|
120
151
|
const source = isRecord(value) ? value : undefined
|
|
121
152
|
const malformedRoot = value !== undefined && value !== null && source === undefined
|
|
122
153
|
const recovered = new Set<AppearanceEditorFontAxis>()
|
|
123
|
-
const settings = {} as
|
|
154
|
+
const settings = {} as {
|
|
155
|
+
-readonly [Axis in keyof AppearanceEditorFontSettings]: AppearanceEditorFontSettings[Axis]
|
|
156
|
+
}
|
|
124
157
|
|
|
125
158
|
for (const axis of APPEARANCE_EDITOR_FONT_AXES) {
|
|
126
159
|
const axisPresent = source ? hasOwn(source, axis) : false
|
|
127
160
|
const axisValue = source?.[axis]
|
|
128
161
|
const axisSource = isRecord(axisValue) ? axisValue : undefined
|
|
129
|
-
|
|
162
|
+
// The terminal used the Code axis before it had its own. A record without a
|
|
163
|
+
// terminal entry stays without one and keeps following Code.
|
|
164
|
+
if (axis === 'terminal' && !axisPresent) continue
|
|
165
|
+
const fallback = DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS[axis === 'terminal' ? 'code' : axis]
|
|
130
166
|
|
|
131
167
|
if (malformedRoot || (axisPresent && axisSource === undefined)) recovered.add(axis)
|
|
132
168
|
|
|
@@ -170,7 +206,7 @@ export function normalizeAppearanceEditorFontSettings(
|
|
|
170
206
|
*
|
|
171
207
|
* This is shared by `ThemeProvider` and hosts that own their own appearance
|
|
172
208
|
* persistence, so UI/content/code use the same catalogue ids, theme tokens,
|
|
173
|
-
* sizes, and projected CSS variables. The marker activates the optional role
|
|
209
|
+
* sizes, and projected CSS variables (terminal included). The marker activates the optional role
|
|
174
210
|
* stylesheet and survives CSS import reordering.
|
|
175
211
|
*/
|
|
176
212
|
export function applyAppearanceFontSettings(
|
|
@@ -178,7 +214,7 @@ export function applyAppearanceFontSettings(
|
|
|
178
214
|
value: unknown
|
|
179
215
|
): NormalizedAppearanceEditorFontSettings {
|
|
180
216
|
const normalized = normalizeAppearanceEditorFontSettings(value)
|
|
181
|
-
const
|
|
217
|
+
const settings = resolveAppearanceEditorFontSettings(normalized.settings)
|
|
182
218
|
|
|
183
219
|
// Only changed values are written: this runs on every theme pass, and an
|
|
184
220
|
// unchanged attribute or property rewritten still dirties the document's style.
|
|
@@ -233,5 +269,5 @@ export function fontSettingsBootstrapScript(storageKey: string, persistedVersion
|
|
|
233
269
|
? ''
|
|
234
270
|
: `&&parsed.version===Number(${safeScriptStringLiteral(String(persistedVersion))})`
|
|
235
271
|
|
|
236
|
-
return `(function(){var r=document.documentElement;var axes=JSON.parse(${safeScriptStringLiteral(axisConfig)});var projection=JSON.parse(${safeScriptStringLiteral(fontProjection)});var ids=${fontIds};var has=function(v,k){return Object.prototype.hasOwnProperty.call(v,k)};var record=function(v){return typeof v==='object'&&v!==null&&!Array.isArray(v)};var p={};try{var raw=localStorage.getItem(${safeScriptStringLiteral(storageKey)});var parsed=raw?JSON.parse(raw):{};if(record(parsed)${persistedVersionGuard})p=parsed;}catch(e){}var saved=record(p.fonts)?p.fonts:{};var valid=function(v,d){return ids.indexOf(v)!==-1?v:d};var size=function(v,d){var n=typeof v==='number'?v:typeof v==='string'&&v.trim()!==''?Number(v):NaN;return Number.isFinite(n)?Math.min(${APPEARANCE_EDITOR_FONT_SIZE_MAX},Math.max(${APPEARANCE_EDITOR_FONT_SIZE_MIN},Math.round(n))):d};r.setAttribute('data-font-settings','');for(var axis in axes){if(!has(axes,axis))continue;var spec=axes[axis];var candidate=saved[axis];var value=record(candidate)?candidate:{};var legacyUi=axis==='ui'&&!has(value,'family');var family=legacyUi?valid(p.font,'system'):valid(value.family,'system');var font=projection[family];if(family==='system')r.removeAttribute(spec.familyAttribute);else r.setAttribute(spec.familyAttribute,family);r.style.setProperty(spec.familyProperty,'var('+font.familyVariables[axis]+')');var px=size(value.size,spec.defaultSize);r.style.setProperty(spec.sizeProperty,px+'px');r.style.setProperty(spec.scaleProperty,String(px/spec.defaultSize));if(axis==='ui'){r.style.setProperty('--ui-tracking',font.uiTracking);r.style.setProperty('--ui-word-spacing',font.uiWordSpacing);}}r.removeAttribute('data-font');})();`
|
|
272
|
+
return `(function(){var r=document.documentElement;var axes=JSON.parse(${safeScriptStringLiteral(axisConfig)});var projection=JSON.parse(${safeScriptStringLiteral(fontProjection)});var ids=${fontIds};var has=function(v,k){return Object.prototype.hasOwnProperty.call(v,k)};var record=function(v){return typeof v==='object'&&v!==null&&!Array.isArray(v)};var p={};try{var raw=localStorage.getItem(${safeScriptStringLiteral(storageKey)});var parsed=raw?JSON.parse(raw):{};if(record(parsed)${persistedVersionGuard})p=parsed;}catch(e){}var saved=record(p.fonts)?p.fonts:{};var valid=function(v,d){return ids.indexOf(v)!==-1?v:d};var size=function(v,d){var n=typeof v==='number'?v:typeof v==='string'&&v.trim()!==''?Number(v):NaN;return Number.isFinite(n)?Math.min(${APPEARANCE_EDITOR_FONT_SIZE_MAX},Math.max(${APPEARANCE_EDITOR_FONT_SIZE_MIN},Math.round(n))):d};r.setAttribute('data-font-settings','');for(var axis in axes){if(!has(axes,axis))continue;var spec=axes[axis];var candidate=axis==='terminal'&&!has(saved,'terminal')?saved.code:saved[axis];var value=record(candidate)?candidate:{};var legacyUi=axis==='ui'&&!has(value,'family');var family=legacyUi?valid(p.font,'system'):valid(value.family,'system');var font=projection[family];if(family==='system')r.removeAttribute(spec.familyAttribute);else r.setAttribute(spec.familyAttribute,family);r.style.setProperty(spec.familyProperty,'var('+font.familyVariables[axis]+')');var px=size(value.size,spec.defaultSize);r.style.setProperty(spec.sizeProperty,px+'px');r.style.setProperty(spec.scaleProperty,String(px/spec.defaultSize));if(axis==='ui'){r.style.setProperty('--ui-tracking',font.uiTracking);r.style.setProperty('--ui-word-spacing',font.uiWordSpacing);}}r.removeAttribute('data-font');})();`
|
|
237
273
|
}
|
package/src/lib/fast-icon.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JSX } from 'solid-js'
|
|
2
|
-
import { createRoot, mergeProps, splitProps } from 'solid-js'
|
|
2
|
+
import { createRoot, mergeProps, sharedConfig, splitProps } from 'solid-js'
|
|
3
3
|
import { isServer, spread } from 'solid-js/web'
|
|
4
4
|
|
|
5
5
|
type IconComponent = (props: JSX.SvgSVGAttributes<SVGSVGElement>) => JSX.Element
|
|
@@ -31,13 +31,20 @@ const A11Y = /^(aria-|role$|title$)/
|
|
|
31
31
|
* drew, so the markup (attributes, class names, path keys) stays exactly
|
|
32
32
|
* lucide's. Props that change the drawing (`size`, `color`, `strokeWidth`,
|
|
33
33
|
* `absoluteStrokeWidth`) or a `LucideProvider` are not supported: those callers
|
|
34
|
-
* keep the lucide component. On the server
|
|
34
|
+
* keep the lucide component. On the server, and while the client hydrates, the
|
|
35
|
+
* lucide component renders as is.
|
|
35
36
|
*/
|
|
36
37
|
export function fastIcon<T extends (props: never) => JSX.Element>(LucideIcon: T): T {
|
|
37
38
|
const Icon = LucideIcon as unknown as IconComponent
|
|
38
39
|
const Fast = (props: JSX.SvgSVGAttributes<SVGSVGElement>) => {
|
|
39
|
-
// Children (a <title>), drawing props
|
|
40
|
-
|
|
40
|
+
// Children (a <title>), drawing props, the server and hydration keep lucide's
|
|
41
|
+
// component: a hydrating icon must claim the server's nodes, not build its own.
|
|
42
|
+
if (
|
|
43
|
+
isServer ||
|
|
44
|
+
sharedConfig.context ||
|
|
45
|
+
props.children !== undefined ||
|
|
46
|
+
DRAWING.some((key) => key in props)
|
|
47
|
+
)
|
|
41
48
|
return Icon(props)
|
|
42
49
|
const template = capture(Icon)
|
|
43
50
|
const [local, rest] = splitProps(props, ['class'])
|
package/src/lib/font-catalog.ts
CHANGED
|
@@ -18,6 +18,7 @@ const FONT_OPTIONS = [
|
|
|
18
18
|
ui: '--font-family-space-grotesk',
|
|
19
19
|
content: '--font-family-space-grotesk',
|
|
20
20
|
code: '--font-family-space-grotesk',
|
|
21
|
+
terminal: '--font-family-space-grotesk',
|
|
21
22
|
},
|
|
22
23
|
uiTracking: 'normal',
|
|
23
24
|
uiWordSpacing: 'normal',
|
|
@@ -30,6 +31,7 @@ const FONT_OPTIONS = [
|
|
|
30
31
|
ui: '--font-family-system',
|
|
31
32
|
content: '--font-family-system',
|
|
32
33
|
code: '--font-family-system-mono',
|
|
34
|
+
terminal: '--font-family-system-mono',
|
|
33
35
|
},
|
|
34
36
|
uiTracking: 'normal',
|
|
35
37
|
uiWordSpacing: 'normal',
|
|
@@ -42,6 +44,7 @@ const FONT_OPTIONS = [
|
|
|
42
44
|
ui: '--font-family-geist',
|
|
43
45
|
content: '--font-family-geist',
|
|
44
46
|
code: '--font-family-geist',
|
|
47
|
+
terminal: '--font-family-geist',
|
|
45
48
|
},
|
|
46
49
|
uiTracking: 'normal',
|
|
47
50
|
uiWordSpacing: 'normal',
|
|
@@ -54,6 +57,7 @@ const FONT_OPTIONS = [
|
|
|
54
57
|
ui: '--font-family-geist-mono',
|
|
55
58
|
content: '--font-family-geist-mono',
|
|
56
59
|
code: '--font-family-geist-mono',
|
|
60
|
+
terminal: '--font-family-geist-mono',
|
|
57
61
|
},
|
|
58
62
|
uiTracking: '-0.03em',
|
|
59
63
|
uiWordSpacing: '-1.5px',
|
|
@@ -66,6 +70,7 @@ const FONT_OPTIONS = [
|
|
|
66
70
|
ui: '--font-family-jetbrains-mono',
|
|
67
71
|
content: '--font-family-jetbrains-mono',
|
|
68
72
|
code: '--font-family-jetbrains-mono',
|
|
73
|
+
terminal: '--font-family-jetbrains-mono',
|
|
69
74
|
},
|
|
70
75
|
uiTracking: '-0.04em',
|
|
71
76
|
uiWordSpacing: '-2.5px',
|
package/src/lib/font-zoom.ts
CHANGED
|
@@ -62,6 +62,9 @@ export function stepAppearanceFontSizes(
|
|
|
62
62
|
ui: { ...current.ui, size: step(current.ui.size) },
|
|
63
63
|
content: { ...current.content, size: step(current.content.size) },
|
|
64
64
|
code: { ...current.code, size: step(current.code.size) },
|
|
65
|
+
...(current.terminal
|
|
66
|
+
? { terminal: { ...current.terminal, size: step(current.terminal.size) } }
|
|
67
|
+
: {}),
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
|