@ultralabs/glass 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +318 -0
- package/DESIGN.md +682 -0
- package/LICENSE +21 -0
- package/README.md +690 -2
- package/dist/esm/index.js +20872 -0
- package/dist/types/src/charts/ULCartesianChart.d.ts +177 -0
- package/dist/types/src/charts/ULDonutChart.d.ts +65 -0
- package/dist/types/src/charts/ULFunnelChart.d.ts +64 -0
- package/dist/types/src/charts/ULHeatmapChart.d.ts +40 -0
- package/dist/types/src/charts/ULRadarChart.d.ts +19 -0
- package/dist/types/src/charts/ULRadialChart.d.ts +48 -0
- package/dist/types/src/charts/ULScatterChart.d.ts +49 -0
- package/dist/types/src/charts/core.d.ts +287 -0
- package/dist/types/src/charts/decimate.d.ts +8 -0
- package/dist/types/src/charts/nav.d.ts +368 -0
- package/dist/types/src/charts/quadtree.d.ts +9 -0
- package/dist/types/src/charts/scales.d.ts +59 -0
- package/dist/types/src/charts/timeseries.d.ts +56 -0
- package/dist/types/src/components/ULAnchoredSurface/ULAnchoredSurface.d.ts +72 -0
- package/dist/types/src/components/ULBatch2/carousel.d.ts +31 -0
- package/dist/types/src/components/ULBatch2/hovercard.d.ts +40 -0
- package/dist/types/src/components/ULBatch2/layout.d.ts +16 -0
- package/dist/types/src/components/ULBatch2/menubar.d.ts +29 -0
- package/dist/types/src/components/ULBatch2/navmenu.d.ts +51 -0
- package/dist/types/src/components/ULBatch2/resizable.d.ts +48 -0
- package/dist/types/src/components/ULBatch2/typography.d.ts +55 -0
- package/dist/types/src/components/ULButton/ULButton.d.ts +87 -0
- package/dist/types/src/components/ULContainers/ULCard.d.ts +54 -0
- package/dist/types/src/components/ULContainers/ULDialog.d.ts +57 -0
- package/dist/types/src/components/ULContainers/ULLayout.d.ts +81 -0
- package/dist/types/src/components/ULContainers/ULMenu.d.ts +99 -0
- package/dist/types/src/components/ULContainers/ULOverlays.d.ts +113 -0
- package/dist/types/src/components/ULContainers/contextTarget.d.ts +91 -0
- package/dist/types/src/components/ULData/ULData.d.ts +225 -0
- package/dist/types/src/components/ULData/ULKpi.d.ts +159 -0
- package/dist/types/src/components/ULField/ULField.d.ts +93 -0
- package/dist/types/src/components/ULForms/fieldContext.d.ts +39 -0
- package/dist/types/src/components/ULForms/forms.d.ts +143 -0
- package/dist/types/src/components/ULIsland/ULIsland.d.ts +39 -0
- package/dist/types/src/components/ULIsland/headerConfig.d.ts +43 -0
- package/dist/types/src/components/ULIsland/navIndicator.d.ts +26 -0
- package/dist/types/src/components/ULListbox/ULListbox.d.ts +75 -0
- package/dist/types/src/components/ULPickers/ULPickers.d.ts +141 -0
- package/dist/types/src/components/ULSegmented/ULSegmented.d.ts +50 -0
- package/dist/types/src/components/ULSelection/ULSelection.d.ts +71 -0
- package/dist/types/src/components/ULSlider/ULSlider.d.ts +43 -0
- package/dist/types/src/components/ULSpinner/ULSpinner.d.ts +8 -0
- package/dist/types/src/components/ULStructure/kbd.d.ts +22 -0
- package/dist/types/src/components/ULStructure/structure.d.ts +154 -0
- package/dist/types/src/components/ULTabs/ULTabs.d.ts +28 -0
- package/dist/types/src/components/ULTooltip/anchoredTooltip.d.ts +22 -0
- package/dist/types/src/components/actions/actions.d.ts +175 -0
- package/dist/types/src/components/actions/core.d.ts +346 -0
- package/dist/types/src/components/dashboard/blocks.d.ts +583 -0
- package/dist/types/src/components/dashboard/blocks2.d.ts +297 -0
- package/dist/types/src/components/dashboard/columnsDrag.d.ts +27 -0
- package/dist/types/src/components/shared/ULCheckMark.d.ts +9 -0
- package/dist/types/src/components/shared/dev.d.ts +13 -0
- package/dist/types/src/components/shared/icons.d.ts +23 -0
- package/dist/types/src/glass/ULGlass.d.ts +78 -0
- package/dist/types/src/glass/ULGlassGroup.d.ts +16 -0
- package/dist/types/src/glass/accent.d.ts +31 -0
- package/dist/types/src/glass/contrast.d.ts +78 -0
- package/dist/types/src/glass/engine.d.ts +177 -0
- package/dist/types/src/glass/glassDebug.d.ts +27 -0
- package/dist/types/src/glass/material.d.ts +49 -0
- package/dist/types/src/glass/radius.d.ts +2 -0
- package/dist/types/src/hooks/useAnchoredMorph.d.ts +20 -0
- package/dist/types/src/hooks/usePointerLight.d.ts +6 -0
- package/dist/types/src/hooks/useReducedMotion.d.ts +3 -0
- package/dist/types/src/index.d.ts +150 -0
- package/dist/types/src/island/sectionAccent.d.ts +18 -0
- package/dist/types/src/live/ULLiveStatus.d.ts +18 -0
- package/dist/types/src/live/liveQueue.d.ts +13 -0
- package/dist/types/src/live/liveSource.d.ts +149 -0
- package/dist/types/src/live/liveStore.d.ts +72 -0
- package/dist/types/src/motion/anchoredMorph.d.ts +163 -0
- package/dist/types/src/motion/goo.d.ts +3 -0
- package/dist/types/src/motion/lensBubble.d.ts +143 -0
- package/dist/types/src/motion/lensSelect.d.ts +31 -0
- package/dist/types/src/motion/overlayStack.d.ts +13 -0
- package/dist/types/src/motion/placement.d.ts +18 -0
- package/dist/types/src/motion/spring.d.ts +20 -0
- package/dist/types/src/motion/topLayer.d.ts +13 -0
- package/dist/types/src/motion/viewSwap.d.ts +33 -0
- package/dist/types/src/motion/virtualAnchor.d.ts +28 -0
- package/dist/ul-glass.css +10508 -0
- package/dist/ul-glass.js +20915 -0
- package/dist/ul-glass.min.js +14 -0
- package/dist/ul-glass.min.js.map +7 -0
- package/icons/arrow-up-down.svg +5 -0
- package/icons/bell.svg +3 -0
- package/icons/bold.svg +2 -0
- package/icons/calendar.svg +5 -0
- package/icons/check.svg +2 -0
- package/icons/chevron-down.svg +2 -0
- package/icons/chevron-left.svg +2 -0
- package/icons/chevron-right.svg +2 -0
- package/icons/chevrons-right.svg +3 -0
- package/icons/circle-check.svg +3 -0
- package/icons/circle-x.svg +4 -0
- package/icons/circle.svg +2 -0
- package/icons/copy.svg +3 -0
- package/icons/ellipsis.svg +4 -0
- package/icons/eye.svg +3 -0
- package/icons/filter.svg +2 -0
- package/icons/flags/LICENSE.md +2 -0
- package/icons/flags/cs.svg +1 -0
- package/icons/flags/de.svg +1 -0
- package/icons/flags/en.svg +1 -0
- package/icons/flags/sk.svg +1 -0
- package/icons/folder-kanban.svg +5 -0
- package/icons/icons.json +1 -0
- package/icons/inbox.svg +3 -0
- package/icons/info.svg +4 -0
- package/icons/layout-dashboard.svg +5 -0
- package/icons/layout-grid.svg +5 -0
- package/icons/loader-circle.svg +2 -0
- package/icons/lock.svg +3 -0
- package/icons/mail.svg +3 -0
- package/icons/menu.svg +4 -0
- package/icons/minus.svg +2 -0
- package/icons/panel-left-close.svg +4 -0
- package/icons/plus.svg +3 -0
- package/icons/refresh-cw.svg +5 -0
- package/icons/search.svg +3 -0
- package/icons/shield-check.svg +3 -0
- package/icons/shopping-bag.svg +4 -0
- package/icons/sparkles.svg +6 -0
- package/icons/trash-2.svg +6 -0
- package/icons/triangle-alert.svg +4 -0
- package/icons/upload.svg +4 -0
- package/icons/users.svg +5 -0
- package/icons/x.svg +3 -0
- package/package.json +62 -4
- package/tokens/tokens.css +799 -0
- package/tokens/tokens.json +1017 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard blocks, Part 11: inline edit, notification centre, activity feed, code block, JSON viewer.
|
|
3
|
+
* Composition only: ULSaveButton / async action core, ULSelect, ULDatePicker, ULPopover + ULMenu (anchored morph),
|
|
4
|
+
* context menus (withContextMenu), ULRollingNumber, ULTimeAgo, ULTabs (shared lens), ULCopyButton, the live-table queue
|
|
5
|
+
* rule (useLiveQueue). No new overlay or animation code beyond the bell ring (WAAPI, tokens, off in reduced motion).
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { type MenuItem } from '../ULContainers/ULMenu.js';
|
|
9
|
+
import { type ContextMenuProps } from '../ULContainers/contextTarget.js';
|
|
10
|
+
import './blocks2.css';
|
|
11
|
+
declare const T: {
|
|
12
|
+
en: {
|
|
13
|
+
close: string;
|
|
14
|
+
edit: string;
|
|
15
|
+
save: string;
|
|
16
|
+
cancel: string;
|
|
17
|
+
number: string;
|
|
18
|
+
required: string;
|
|
19
|
+
notifications: string;
|
|
20
|
+
unread: string;
|
|
21
|
+
unreadOne: string;
|
|
22
|
+
markRead: string;
|
|
23
|
+
markUnread: string;
|
|
24
|
+
markAll: string;
|
|
25
|
+
caughtUp: string;
|
|
26
|
+
caughtUpD: string;
|
|
27
|
+
failed: string;
|
|
28
|
+
newN: string;
|
|
29
|
+
newNotifs: string;
|
|
30
|
+
actions: string;
|
|
31
|
+
activity: string;
|
|
32
|
+
all: string;
|
|
33
|
+
details: string;
|
|
34
|
+
newEvents: string;
|
|
35
|
+
noEvents: string;
|
|
36
|
+
older: string;
|
|
37
|
+
wrap: string;
|
|
38
|
+
copyCode: string;
|
|
39
|
+
copyValue: string;
|
|
40
|
+
copyPath: string;
|
|
41
|
+
search: string;
|
|
42
|
+
matches: string;
|
|
43
|
+
noMatches: string;
|
|
44
|
+
more: string;
|
|
45
|
+
full: string;
|
|
46
|
+
less: string;
|
|
47
|
+
items: string;
|
|
48
|
+
keys: string;
|
|
49
|
+
filter: string;
|
|
50
|
+
};
|
|
51
|
+
sk: {
|
|
52
|
+
close: string;
|
|
53
|
+
edit: string;
|
|
54
|
+
save: string;
|
|
55
|
+
cancel: string;
|
|
56
|
+
number: string;
|
|
57
|
+
required: string;
|
|
58
|
+
notifications: string;
|
|
59
|
+
unread: string;
|
|
60
|
+
unreadOne: string;
|
|
61
|
+
markRead: string;
|
|
62
|
+
markUnread: string;
|
|
63
|
+
markAll: string;
|
|
64
|
+
caughtUp: string;
|
|
65
|
+
caughtUpD: string;
|
|
66
|
+
failed: string;
|
|
67
|
+
newN: string;
|
|
68
|
+
newNotifs: string;
|
|
69
|
+
actions: string;
|
|
70
|
+
activity: string;
|
|
71
|
+
all: string;
|
|
72
|
+
details: string;
|
|
73
|
+
newEvents: string;
|
|
74
|
+
noEvents: string;
|
|
75
|
+
older: string;
|
|
76
|
+
wrap: string;
|
|
77
|
+
copyCode: string;
|
|
78
|
+
copyValue: string;
|
|
79
|
+
copyPath: string;
|
|
80
|
+
search: string;
|
|
81
|
+
matches: string;
|
|
82
|
+
noMatches: string;
|
|
83
|
+
more: string;
|
|
84
|
+
full: string;
|
|
85
|
+
less: string;
|
|
86
|
+
items: string;
|
|
87
|
+
keys: string;
|
|
88
|
+
filter: string;
|
|
89
|
+
};
|
|
90
|
+
de: {
|
|
91
|
+
close: string;
|
|
92
|
+
edit: string;
|
|
93
|
+
save: string;
|
|
94
|
+
cancel: string;
|
|
95
|
+
number: string;
|
|
96
|
+
required: string;
|
|
97
|
+
notifications: string;
|
|
98
|
+
unread: string;
|
|
99
|
+
unreadOne: string;
|
|
100
|
+
markRead: string;
|
|
101
|
+
markUnread: string;
|
|
102
|
+
markAll: string;
|
|
103
|
+
caughtUp: string;
|
|
104
|
+
caughtUpD: string;
|
|
105
|
+
failed: string;
|
|
106
|
+
newN: string;
|
|
107
|
+
newNotifs: string;
|
|
108
|
+
actions: string;
|
|
109
|
+
activity: string;
|
|
110
|
+
all: string;
|
|
111
|
+
details: string;
|
|
112
|
+
newEvents: string;
|
|
113
|
+
noEvents: string;
|
|
114
|
+
older: string;
|
|
115
|
+
wrap: string;
|
|
116
|
+
copyCode: string;
|
|
117
|
+
copyValue: string;
|
|
118
|
+
copyPath: string;
|
|
119
|
+
search: string;
|
|
120
|
+
matches: string;
|
|
121
|
+
noMatches: string;
|
|
122
|
+
more: string;
|
|
123
|
+
full: string;
|
|
124
|
+
less: string;
|
|
125
|
+
items: string;
|
|
126
|
+
keys: string;
|
|
127
|
+
filter: string;
|
|
128
|
+
};
|
|
129
|
+
cs: {
|
|
130
|
+
close: string;
|
|
131
|
+
edit: string;
|
|
132
|
+
save: string;
|
|
133
|
+
cancel: string;
|
|
134
|
+
number: string;
|
|
135
|
+
required: string;
|
|
136
|
+
notifications: string;
|
|
137
|
+
unread: string;
|
|
138
|
+
unreadOne: string;
|
|
139
|
+
markRead: string;
|
|
140
|
+
markUnread: string;
|
|
141
|
+
markAll: string;
|
|
142
|
+
caughtUp: string;
|
|
143
|
+
caughtUpD: string;
|
|
144
|
+
failed: string;
|
|
145
|
+
newN: string;
|
|
146
|
+
newNotifs: string;
|
|
147
|
+
actions: string;
|
|
148
|
+
activity: string;
|
|
149
|
+
all: string;
|
|
150
|
+
details: string;
|
|
151
|
+
newEvents: string;
|
|
152
|
+
noEvents: string;
|
|
153
|
+
older: string;
|
|
154
|
+
wrap: string;
|
|
155
|
+
copyCode: string;
|
|
156
|
+
copyValue: string;
|
|
157
|
+
copyPath: string;
|
|
158
|
+
search: string;
|
|
159
|
+
matches: string;
|
|
160
|
+
noMatches: string;
|
|
161
|
+
more: string;
|
|
162
|
+
full: string;
|
|
163
|
+
less: string;
|
|
164
|
+
items: string;
|
|
165
|
+
keys: string;
|
|
166
|
+
filter: string;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
type Key = keyof typeof T.en;
|
|
170
|
+
export declare const block2Text: (k: Key, locale?: string, vars?: Record<string, string | number>) => string;
|
|
171
|
+
export interface ULInlineEditProps<V = unknown> extends ContextMenuProps<{
|
|
172
|
+
value: V;
|
|
173
|
+
}> {
|
|
174
|
+
value: V;
|
|
175
|
+
/** Persist. A throw / rejection rolls the optimistic value back and leaves the editor open on Retry. */
|
|
176
|
+
onCommit: (v: V) => Promise<unknown> | unknown;
|
|
177
|
+
/** Optimistic update (called with the new value before onCommit, and with the old one on rollback). */
|
|
178
|
+
onValueChange?: (v: V) => void;
|
|
179
|
+
type?: 'text' | 'number' | 'select' | 'date';
|
|
180
|
+
label: string;
|
|
181
|
+
options?: {
|
|
182
|
+
value: string;
|
|
183
|
+
label: string;
|
|
184
|
+
}[];
|
|
185
|
+
format?: (v: V) => React.ReactNode;
|
|
186
|
+
validate?: (v: V) => string | null | undefined;
|
|
187
|
+
placeholder?: string;
|
|
188
|
+
locale?: string;
|
|
189
|
+
disabled?: boolean;
|
|
190
|
+
className?: string;
|
|
191
|
+
}
|
|
192
|
+
export declare function ULInlineEdit<V = unknown>(props: ULInlineEditProps<V>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
193
|
+
export interface NotificationItem {
|
|
194
|
+
id: string;
|
|
195
|
+
title: React.ReactNode;
|
|
196
|
+
body?: React.ReactNode;
|
|
197
|
+
time: Date | number | string;
|
|
198
|
+
read?: boolean;
|
|
199
|
+
tone?: 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
|
|
200
|
+
textValue?: string;
|
|
201
|
+
}
|
|
202
|
+
export interface ULNotificationCenterProps extends ContextMenuProps<NotificationItem> {
|
|
203
|
+
items: NotificationItem[];
|
|
204
|
+
onReadChange?: (id: string, read: boolean) => void;
|
|
205
|
+
onMarkAllRead?: () => void;
|
|
206
|
+
/** Per-item actions: the row's actions button AND right-click (one source). */
|
|
207
|
+
itemMenu?: (it: NotificationItem) => MenuItem[];
|
|
208
|
+
loading?: boolean;
|
|
209
|
+
error?: React.ReactNode;
|
|
210
|
+
onRetry?: () => unknown;
|
|
211
|
+
open?: boolean;
|
|
212
|
+
onOpenChange?: (open: boolean) => void;
|
|
213
|
+
label?: string;
|
|
214
|
+
locale?: string;
|
|
215
|
+
/** Bell ring on new unread items (rate limited; never in reduced motion). Default true. */
|
|
216
|
+
ring?: boolean;
|
|
217
|
+
/** Default 'covered': the popover covers the bell from the first frame (top layer); 'above' opts back to a popover below the bell. */
|
|
218
|
+
anchorVisibility?: 'above' | 'covered';
|
|
219
|
+
}
|
|
220
|
+
export declare function ULNotificationCenter(props: ULNotificationCenterProps): React.JSX.Element;
|
|
221
|
+
export interface ActivityEvent {
|
|
222
|
+
id: string;
|
|
223
|
+
actor: {
|
|
224
|
+
name: string;
|
|
225
|
+
src?: string;
|
|
226
|
+
};
|
|
227
|
+
action: React.ReactNode;
|
|
228
|
+
target?: {
|
|
229
|
+
label: string;
|
|
230
|
+
href?: string;
|
|
231
|
+
};
|
|
232
|
+
time: Date | number | string;
|
|
233
|
+
details?: React.ReactNode;
|
|
234
|
+
kind?: string;
|
|
235
|
+
}
|
|
236
|
+
export interface ULActivityFeedProps extends ContextMenuProps<ActivityEvent> {
|
|
237
|
+
events: ActivityEvent[];
|
|
238
|
+
/** Filter chips (by event kind). Multi-select; none = all. */
|
|
239
|
+
filters?: {
|
|
240
|
+
value: string;
|
|
241
|
+
label: string;
|
|
242
|
+
}[];
|
|
243
|
+
filter?: string[];
|
|
244
|
+
defaultFilter?: string[];
|
|
245
|
+
onFilterChange?: (f: string[]) => void;
|
|
246
|
+
onTargetClick?: (e: ActivityEvent) => void;
|
|
247
|
+
/** Rows rendered before "Show older" (the flat row model is virtualisation-ready). Default 50. */
|
|
248
|
+
pageSize?: number;
|
|
249
|
+
label?: string;
|
|
250
|
+
locale?: string;
|
|
251
|
+
}
|
|
252
|
+
export declare function ULActivityFeed(props: ULActivityFeedProps): React.JSX.Element;
|
|
253
|
+
type Tok = [string, string | null];
|
|
254
|
+
/** Tiny tokenizer (comments, strings, numbers, keywords, literals, flags). Unknown language = plain text.
|
|
255
|
+
* `state` carries an open block comment across lines (ts / js: a line inside or ending a /* … *\/ block is a comment); bash `#` is a
|
|
256
|
+
* comment only at the line start or after whitespace (not inside URLs). */
|
|
257
|
+
export declare function tokenizeLine(line: string, language?: string, state?: {
|
|
258
|
+
block?: boolean;
|
|
259
|
+
}): Tok[];
|
|
260
|
+
export interface CodeSample {
|
|
261
|
+
value: string;
|
|
262
|
+
label: string;
|
|
263
|
+
language?: string;
|
|
264
|
+
code: string;
|
|
265
|
+
}
|
|
266
|
+
export interface ULCodeBlockProps {
|
|
267
|
+
code?: string;
|
|
268
|
+
language?: string;
|
|
269
|
+
samples?: CodeSample[];
|
|
270
|
+
value?: string;
|
|
271
|
+
defaultValue?: string;
|
|
272
|
+
onValueChange?: (v: string) => void;
|
|
273
|
+
lineNumbers?: boolean;
|
|
274
|
+
highlight?: number[];
|
|
275
|
+
wrap?: boolean;
|
|
276
|
+
defaultWrap?: boolean;
|
|
277
|
+
onWrapChange?: (w: boolean) => void;
|
|
278
|
+
label?: string;
|
|
279
|
+
maxHeight?: number | string;
|
|
280
|
+
locale?: string;
|
|
281
|
+
className?: string;
|
|
282
|
+
}
|
|
283
|
+
export declare function ULCodeBlock({ code, language, samples, value, defaultValue, onValueChange, lineNumbers, highlight, wrap: wCtl, defaultWrap, onWrapChange, label, maxHeight, locale, className }: ULCodeBlockProps): React.JSX.Element;
|
|
284
|
+
export interface ULJsonViewerProps {
|
|
285
|
+
data: unknown;
|
|
286
|
+
label?: string;
|
|
287
|
+
rootName?: string;
|
|
288
|
+
defaultExpandDepth?: number;
|
|
289
|
+
maxString?: number;
|
|
290
|
+
pageSize?: number;
|
|
291
|
+
maxHeight?: number | string;
|
|
292
|
+
onSelect?: (path: string, value: unknown) => void;
|
|
293
|
+
locale?: string;
|
|
294
|
+
className?: string;
|
|
295
|
+
}
|
|
296
|
+
export declare function ULJsonViewer({ data, label, rootName, defaultExpandDepth, maxString, pageSize, maxHeight, onSelect, locale, className }: ULJsonViewerProps): React.JSX.Element;
|
|
297
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ColumnsDragOptions {
|
|
2
|
+
keys: string[];
|
|
3
|
+
onCommit: (order: string[]) => void;
|
|
4
|
+
moved: (key: string, pos: number, total: number) => string;
|
|
5
|
+
cancelled: string;
|
|
6
|
+
}
|
|
7
|
+
/** Test hook: pointermoves seen, frames written, commits. */
|
|
8
|
+
export declare const columnsDragStats: {
|
|
9
|
+
moves: number;
|
|
10
|
+
frames: number;
|
|
11
|
+
commits: number;
|
|
12
|
+
writes: number;
|
|
13
|
+
};
|
|
14
|
+
/** Move one key from index a to index b. */
|
|
15
|
+
export declare function reorderKeys(keys: string[], a: number, b: number): string[];
|
|
16
|
+
/** Target index for the dragged row (index `from`) whose centre is at y, given the rows' resting centres. */
|
|
17
|
+
export declare function dragSlot(mids: number[], from: number, y: number): number;
|
|
18
|
+
export declare function isColumnsDragging(): boolean;
|
|
19
|
+
export declare function startColumnsDrag(e: {
|
|
20
|
+
currentTarget: EventTarget;
|
|
21
|
+
clientY: number;
|
|
22
|
+
pointerId: number;
|
|
23
|
+
pointerType: string;
|
|
24
|
+
button: number;
|
|
25
|
+
preventDefault(): void;
|
|
26
|
+
stopPropagation(): void;
|
|
27
|
+
}, o: ColumnsDragOptions): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './ULCheckMark.css';
|
|
3
|
+
export interface ULCheckMarkProps {
|
|
4
|
+
checked: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Imperative enter / exit on a .ul-check element (exported for owners that toggle outside React). */
|
|
8
|
+
export declare function animateCheck(el: HTMLElement, on: boolean): void;
|
|
9
|
+
export declare function ULCheckMark({ checked, className }: ULCheckMarkProps): React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** Dev-only checks. Production builds (dist/ul-glass.min.js) set window.__UL_PROD__ = true and every warning is skipped. */
|
|
3
|
+
export declare const isDev: () => boolean;
|
|
4
|
+
/** console.warn once per element and key. */
|
|
5
|
+
export declare function warnOnce(el: Element, key: string, msg: string): void;
|
|
6
|
+
export type Surface = 'glass' | 'solid' | 'busy';
|
|
7
|
+
/**
|
|
8
|
+
* What the element sits on: the nearest ancestor that paints something. Glass (.ul-glass), an explicit
|
|
9
|
+
* data-ul-surface="solid|busy", an opaque background color (solid) or a background image / gradient (busy).
|
|
10
|
+
*/
|
|
11
|
+
export declare function surfaceBehind(el: Element): Surface;
|
|
12
|
+
/** Measures the surface once after mount. Returns true when the element sits directly on a busy backdrop. */
|
|
13
|
+
export declare function useBareOnBusy(ref: React.RefObject<HTMLElement | null>, warn?: string): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './icon.css';
|
|
3
|
+
import './hit.css';
|
|
4
|
+
/** Line icons used inside components (same 24 grid, round caps as icons/*.svg). */
|
|
5
|
+
declare const P: Record<string, string>;
|
|
6
|
+
export type IconSize = 'xs' | 'sm' | 'md' | 'lg' | number | string;
|
|
7
|
+
export interface ULIconProps extends Omit<React.SVGProps<SVGSVGElement>, 'name'> {
|
|
8
|
+
/** Built-in line icon. Or pass path (24 grid) / children for a custom glyph. */
|
|
9
|
+
name?: keyof typeof P | string;
|
|
10
|
+
path?: string;
|
|
11
|
+
/** Token size xs|sm|md|lg (em-based, default md) or an explicit px number / CSS length. A sizing wrapper (.ul-btn-icon etc.) makes it fill the box. */
|
|
12
|
+
size?: IconSize;
|
|
13
|
+
/** Filled glyph (fill currentColor, no stroke). */
|
|
14
|
+
filled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** The one icon primitive: explicit width/height, flex: none, display: block. Never an unsized svg. */
|
|
17
|
+
export declare function ULIcon({ name, path, size, filled, className, style, children, viewBox, ...rest }: ULIconProps): React.JSX.Element;
|
|
18
|
+
/** @deprecated alias, same component. */
|
|
19
|
+
export declare const Icon: typeof ULIcon;
|
|
20
|
+
/** Stable DOM id from React.useId (colons are not valid in CSS selectors). */
|
|
21
|
+
export declare function useDomId(prefix: string, given?: string): string;
|
|
22
|
+
export declare const cx: (...c: (string | false | null | undefined)[]) => string;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type GlassTier, type LensMode, type GlassQuality, type GlassPriority } from './engine.js';
|
|
3
|
+
import { type Accent, type AccentStrength, type Backdrop } from './accent.js';
|
|
4
|
+
import { type Material, type MaterialCategory } from './material.js';
|
|
5
|
+
import './ULGlass.css';
|
|
6
|
+
export type GlassVariant = 'clear' | 'chrome';
|
|
7
|
+
/** Element attributes forwarded to the `as` element through the rest props (button / link / form-control hosts). */
|
|
8
|
+
export type ULGlassElementAttrs = Pick<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'disabled' | 'name' | 'form'> & Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target' | 'rel' | 'download' | 'hrefLang'>;
|
|
9
|
+
export interface ULGlassProps extends React.HTMLAttributes<HTMLElement>, ULGlassElementAttrs {
|
|
10
|
+
/** Element to render. Default 'div'. */
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
/** Material thickness: sm controls, md cards, lg menus/sidebars, xl sheets. */
|
|
13
|
+
tier?: GlassTier;
|
|
14
|
+
variant?: GlassVariant;
|
|
15
|
+
/** Lens profile: standard | polar | prominent. */
|
|
16
|
+
mode?: LensMode;
|
|
17
|
+
/** Overrides the tier radius. Use concentric() for nested surfaces. */
|
|
18
|
+
radius?: number | string;
|
|
19
|
+
padding?: number | string;
|
|
20
|
+
/** Multiplier on the displacement scale. 0 = no lens. */
|
|
21
|
+
refraction?: number;
|
|
22
|
+
/** Absolute overrides of tier tokens (tuning / special cases). */
|
|
23
|
+
blur?: number | string;
|
|
24
|
+
bezel?: number | string;
|
|
25
|
+
scale?: number;
|
|
26
|
+
aberration?: number;
|
|
27
|
+
magnify?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Elastic surface (hover pull, press/drag stretch). Default false. Use for
|
|
30
|
+
* controls only — buttons, icon buttons, chips, switch/slider thumbs,
|
|
31
|
+
* segmented lens, FAB. Cards, panels, sheets, sidebars, toolbars, tables,
|
|
32
|
+
* inputs and popovers stay rigid (light + rim only).
|
|
33
|
+
*/
|
|
34
|
+
interactive?: boolean;
|
|
35
|
+
/** Overrides the size-tier factor (--ul-elasticity-sm/md/lg/xl); still × --ul-elasticity. */
|
|
36
|
+
elasticity?: number;
|
|
37
|
+
/** @internal showcase comparison only */
|
|
38
|
+
legacyElastic?: boolean;
|
|
39
|
+
/** Press feedback: scale down + flare at the pointer. */
|
|
40
|
+
pressable?: boolean;
|
|
41
|
+
/** Pressed scale with `pressable` (engine option). Default .965 (engine default). */
|
|
42
|
+
pressScale?: number;
|
|
43
|
+
/** Pointer light, rim rotation and elasticity. */
|
|
44
|
+
light?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* full: SVG refraction + aberration + rim + light. lite: blur + saturate, rim, tint, light on hover.
|
|
47
|
+
* flat: no backdrop-filter. auto (default): the governor grants full within the refraction budget.
|
|
48
|
+
*/
|
|
49
|
+
quality?: GlassQuality;
|
|
50
|
+
/** Governor priority. overlay > focused/hovered > island > closest to viewport center. Default: overlay for role=dialog / anchored surfaces. */
|
|
51
|
+
priority?: GlassPriority;
|
|
52
|
+
/** Toggling this materializes / dematerializes the surface. */
|
|
53
|
+
visible?: boolean;
|
|
54
|
+
/** Paint the displacement map (debug). */
|
|
55
|
+
debug?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Accent preset (ice | violet | emerald | amber | rose) or any CSS color.
|
|
58
|
+
* Omit to inherit the nearest ancestor's accent. Tints the tint, rim, glow
|
|
59
|
+
* and pointer light only; refraction stays neutral; text stays neutral.
|
|
60
|
+
*/
|
|
61
|
+
accent?: Accent;
|
|
62
|
+
/** subtle | tinted (default once an accent is set) | vivid, or k 0..1. Omit to inherit. */
|
|
63
|
+
accentStrength?: AccentStrength;
|
|
64
|
+
/** What sits behind this surface; selects the contrast scrim. Omit to inherit (default dark). */
|
|
65
|
+
backdrop?: Backdrop;
|
|
66
|
+
/**
|
|
67
|
+
* "glass" | "flat". Flat = the reduced-transparency fallback (no backdrop-filter, refraction, gloss rim, pointer light);
|
|
68
|
+
* outside the refraction budget. Omit to resolve: nearest ULProvider scope > category default > global default.
|
|
69
|
+
* @default undefined (resolved; "glass" for every category except inputs)
|
|
70
|
+
*/
|
|
71
|
+
material?: Material;
|
|
72
|
+
/**
|
|
73
|
+
* Category used to resolve `material` when it is omitted: inputs | controls | surfaces | overlays | chrome.
|
|
74
|
+
* @default "surfaces"
|
|
75
|
+
*/
|
|
76
|
+
materialCategory?: MaterialCategory;
|
|
77
|
+
}
|
|
78
|
+
export declare const ULGlass: React.ForwardRefExoticComponent<ULGlassProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './ULGlassGroup.css';
|
|
3
|
+
export interface GlassGroupContextValue {
|
|
4
|
+
spacing?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const GlassGroupContext: React.Context<GlassGroupContextValue | null>;
|
|
7
|
+
export interface ULGlassGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/** Gap between members in px; also the merge distance for the stage-3 goo/morph system. */
|
|
9
|
+
spacing?: number;
|
|
10
|
+
direction?: 'row' | 'column';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Groups sibling glass so they share one sampling region. Members must not overlap
|
|
14
|
+
* (glass never samples glass). Merge/split morphing is added in stage 3.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ULGlassGroup({ spacing, direction, className, style, children, ...rest }: ULGlassGroupProps): React.JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const ACCENT_PRESETS: readonly ["ice", "violet", "emerald", "amber", "rose"];
|
|
3
|
+
export type AccentPreset = (typeof ACCENT_PRESETS)[number];
|
|
4
|
+
/** A preset name or any CSS color. */
|
|
5
|
+
export type Accent = AccentPreset | (string & {});
|
|
6
|
+
export type Backdrop = 'dark' | 'mid' | 'light';
|
|
7
|
+
export declare const ACCENT_STRENGTHS: readonly ["subtle", "tinted", "vivid"];
|
|
8
|
+
/** subtle (ambient) · tinted (default for accented glass) · vivid (hero), or a raw k in 0..1. */
|
|
9
|
+
export type AccentStrength = (typeof ACCENT_STRENGTHS)[number] | number;
|
|
10
|
+
export declare const isAccentPreset: (v: unknown) => v is AccentPreset;
|
|
11
|
+
type Attrs = {
|
|
12
|
+
'data-ul-accent'?: string;
|
|
13
|
+
'data-ul-accent-strength'?: string;
|
|
14
|
+
style?: Record<string, string>;
|
|
15
|
+
};
|
|
16
|
+
/** Attributes/style that set an accent and/or strength on an element. */
|
|
17
|
+
export declare function accentAttrs(accent?: Accent | null, strength?: AccentStrength | null): Attrs;
|
|
18
|
+
/** Imperative version (observers, island). null removes the value so the element inherits again. */
|
|
19
|
+
export declare function setAccent(el: HTMLElement, accent?: Accent | null, strength?: AccentStrength | null): void;
|
|
20
|
+
export interface ULAccentScopeProps extends React.HTMLAttributes<HTMLElement> {
|
|
21
|
+
accent?: Accent | null;
|
|
22
|
+
strength?: AccentStrength | null;
|
|
23
|
+
/** What sits behind glass inside this scope; selects the contrast scrim. */
|
|
24
|
+
backdrop?: Backdrop;
|
|
25
|
+
/** Render as a layout-less wrapper (display: contents). Default true. */
|
|
26
|
+
contents?: boolean;
|
|
27
|
+
as?: React.ElementType;
|
|
28
|
+
}
|
|
29
|
+
/** Sets an accent / strength / backdrop once for everything inside. Changes animate. */
|
|
30
|
+
export declare function ULAccentScope({ accent, strength, backdrop, contents, as: Tag, style, children, ...rest }: ULAccentScopeProps): React.JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contrast guard model. Browsers can't read backdrop pixels, so the guard is
|
|
3
|
+
* declarative: a surface states its backdrop class (dark / mid / light) and
|
|
4
|
+
* receives a deep-accent backing sized for it. This module reproduces the
|
|
5
|
+
* material's layer stack (same order and math as ULGlass.css + the engine's
|
|
6
|
+
* backdrop colorize) to verify, and re-derive, the scrim tokens for every
|
|
7
|
+
* theme, accent and strength. Compositing is modelled in gamma sRGB, like
|
|
8
|
+
* the browser; color-mix(in oklab) is modelled in oklab.
|
|
9
|
+
*/
|
|
10
|
+
import { type Backdrop } from './accent.js';
|
|
11
|
+
type RGB = [number, number, number];
|
|
12
|
+
/** Resolve any CSS color string (hex, rgb(), names) to sRGB 0..1. */
|
|
13
|
+
export declare function toRGB(color: string): RGB;
|
|
14
|
+
export declare const luminance: (c: RGB) => number;
|
|
15
|
+
export declare function contrastRatio(a: RGB | string, b: RGB | string): number;
|
|
16
|
+
type Range = {
|
|
17
|
+
subtle: number;
|
|
18
|
+
vivid: number;
|
|
19
|
+
};
|
|
20
|
+
export interface GlassContrastTokens {
|
|
21
|
+
text: RGB;
|
|
22
|
+
text2: RGB;
|
|
23
|
+
tint: number;
|
|
24
|
+
light: number;
|
|
25
|
+
brightness: number;
|
|
26
|
+
deep: number;
|
|
27
|
+
k: Record<'subtle' | 'tinted' | 'vivid', number>;
|
|
28
|
+
mixTint: Range;
|
|
29
|
+
shade: Range;
|
|
30
|
+
body: Range;
|
|
31
|
+
wash: Range;
|
|
32
|
+
lightMix: Range;
|
|
33
|
+
backdrop: Range;
|
|
34
|
+
scrim: Record<Backdrop, Record<'subtle' | 'tinted' | 'vivid', number>>;
|
|
35
|
+
maxLum: Record<Backdrop, number>;
|
|
36
|
+
target: number;
|
|
37
|
+
}
|
|
38
|
+
/** Read the guard inputs from computed tokens on `el` (theme-aware). */
|
|
39
|
+
export declare function readContrastTokens(el?: Element): GlassContrastTokens;
|
|
40
|
+
/** x: 0 at subtle, 1 at vivid (same as --ul-ax). */
|
|
41
|
+
export declare const strengthX: (t: GlassContrastTokens, k: number) => number;
|
|
42
|
+
/** Scrim the CSS applies for a backdrop class at strength x (piecewise subtle → tinted → vivid). */
|
|
43
|
+
export declare function scrimAt(t: GlassContrastTokens, backdrop: Backdrop, x: number): number;
|
|
44
|
+
/** Worst-case surface for a backdrop class: brightest allowed backdrop, colorized, body at its top stop, deep backing, wash, optional full pointer light. */
|
|
45
|
+
export declare function worstSurface(t: GlassContrastTokens, accent: RGB, backdrop: Backdrop, x: number, scrim?: number, withLight?: boolean): RGB;
|
|
46
|
+
export interface ContrastRow {
|
|
47
|
+
accent: string;
|
|
48
|
+
strength: string;
|
|
49
|
+
backdrop: Backdrop;
|
|
50
|
+
scrim: number;
|
|
51
|
+
text2: number;
|
|
52
|
+
textLit: number;
|
|
53
|
+
pass: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Pass = secondary text ≥ target at rest AND primary text ≥ target under full pointer light.
|
|
57
|
+
* Covers every accent × strength × backdrop class. `accents` maps a label to a CSS color (defaults to presets).
|
|
58
|
+
*/
|
|
59
|
+
export declare function accentContrastReport(el?: Element, accents?: Record<string, string>): ContrastRow[];
|
|
60
|
+
/** OKLCH of a CSS color: [L, C, h°]. */
|
|
61
|
+
export declare function toOklch(color: string | RGB): [number, number, number];
|
|
62
|
+
export declare const fromOklch: (L: number, C: number, h: number) => string;
|
|
63
|
+
export interface AccentGuard {
|
|
64
|
+
chosen: string;
|
|
65
|
+
effective: string;
|
|
66
|
+
adjusted: boolean;
|
|
67
|
+
worst: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Contrast guard for CUSTOM accents (presets are covered by the scrim tokens). Runs the same worst-case model as
|
|
71
|
+
* accentContrastReport for this one colour; if any row fails it clamps the colour into the safe OKLCH range
|
|
72
|
+
* (--ul-accent-custom-l-min / -l-max / -c-max), then, if still needed, walks chroma down and lightness toward the
|
|
73
|
+
* middle of that range until every row passes. `effective` is what should be applied.
|
|
74
|
+
*/
|
|
75
|
+
export declare function guardAccent(color: string, el?: Element): AccentGuard;
|
|
76
|
+
/** Smallest scrim (step .01) that passes for every accent on a backdrop class at strength x. */
|
|
77
|
+
export declare function minScrim(t: GlassContrastTokens, accents: RGB[], backdrop: Backdrop, x: number): number;
|
|
78
|
+
export {};
|