@sdxc/ui 2026.10.17 → 2026.10.21
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/dist/components/alert-dialog.js +1 -1
- package/dist/components/attachment.js +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/color-picker.js +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/file-trigger.js +1 -1
- package/dist/components/heading-scope.js +1 -1
- package/dist/components/message-scroller.js +1 -1
- package/dist/components/number-field.js +2 -2
- package/dist/components/range-calendar.js +1 -1
- package/dist/components/resizable.js +1 -1
- package/dist/components/select.js +2 -2
- package/dist/components/shared-element.js +1 -1
- package/dist/components/sidebar.d.ts +4 -4
- package/dist/components/sidebar.js +31 -31
- package/dist/components/typeset.d.ts +3 -3
- package/dist/components/typeset.js +25 -10
- package/dist/mixins/attachment-trigger.js +2 -2
- package/dist/mixins/color-preview.js +1 -1
- package/dist/mixins/context-menu.js +1 -1
- package/dist/mixins/copy-to-clipboard.js +1 -1
- package/dist/mixins/hotkey.js +2 -2
- package/dist/mixins/persist.js +1 -1
- package/dist/mixins/validate.js +1 -1
- package/dist/utils/warn-if-no-accessible-name.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -229,7 +229,7 @@ Every export carries JSDoc, so the editor shows each full signature.
|
|
|
229
229
|
- `YouTubeEmbed` — a lazy-loaded 16:9 YouTube player (`videoId`, `start?`, `title`) served from
|
|
230
230
|
`www.youtube-nocookie.com`, which the page's `frame-src` has to allow.
|
|
231
231
|
- `Text`, `Header`, `Keyboard`, `Typeset` — muted copy, a section label, a `<kbd>`, and typography
|
|
232
|
-
for rendered markup (`docs
|
|
232
|
+
for rendered markup. `Typeset` sets the body at 18px (`docs`), 20px (`reading`) or 15px (`chat`).
|
|
233
233
|
- `ShortcutList` — a `<dl>` pairing actions with key caps.
|
|
234
234
|
- `Highlight` — `{ text, match }` segments rendered with each match in a `<mark>`.
|
|
235
235
|
- `HeadingScope`, `Heading` — a heading-depth scope, and the `<h1>`–`<h6>` that reads it.
|
|
@@ -142,7 +142,7 @@ AlertDialog.Action = function AlertDialogAction(handle) {
|
|
|
142
142
|
let resolvedType = type ?? DEFAULT_TYPE;
|
|
143
143
|
let isInvoker = resolvedType === "button";
|
|
144
144
|
let resolvedColor = color ?? DEFAULT_ACTION_COLOR;
|
|
145
|
-
if (import.meta.env
|
|
145
|
+
if (import.meta.env?.DEV && isInvoker && !commandfor) {
|
|
146
146
|
console.warn('AlertDialog.Action: needs "commandfor" naming the panel it dismisses, or type="submit" to submit its enclosing form instead — as rendered, pressing it does nothing.');
|
|
147
147
|
}
|
|
148
148
|
return (_jsx(Button, { ...rest, type: resolvedType, color: resolvedColor, commandfor: isInvoker ? commandfor : undefined, command: isInvoker ? (command ?? DEFAULT_COMMAND) : undefined, "data-slot": "action" }));
|
|
@@ -274,7 +274,7 @@ Attachment.Trigger = function AttachmentTrigger(handle) {
|
|
|
274
274
|
let isConfigured = href !== undefined || commandfor !== undefined;
|
|
275
275
|
let resolvedRole = role ?? (href !== undefined ? "link" : isConfigured ? "button" : undefined);
|
|
276
276
|
let resolvedTabIndex = tabIndex ?? (isConfigured ? 0 : undefined);
|
|
277
|
-
if (import.meta.env
|
|
277
|
+
if (import.meta.env?.DEV && !isConfigured) {
|
|
278
278
|
console.warn('Attachment.Trigger: rendered with neither "href" nor "commandfor" — nothing will happen once `attachmentTrigger()` handles an activation.');
|
|
279
279
|
}
|
|
280
280
|
return (_jsx("div", { ...rest, role: resolvedRole, tabIndex: resolvedTabIndex, "data-slot": "trigger", mix: [
|
|
@@ -67,7 +67,7 @@ export function Calendar(handle) {
|
|
|
67
67
|
return () => {
|
|
68
68
|
let { color, name, value, defaultValue, min, max, step, required, disabled, readOnly, autoComplete, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, mix, ...rest } = handle.props;
|
|
69
69
|
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
70
|
-
if (import.meta.env
|
|
70
|
+
if (import.meta.env?.DEV && !children && !ariaLabel && !ariaLabelledBy) {
|
|
71
71
|
console.warn('Calendar: falling back to a plain "input type=date" needs an "aria-label" or "aria-labelledby" describing what it collects for assistive technology.');
|
|
72
72
|
}
|
|
73
73
|
return (_jsx("div", { ...rest, "data-slot": "calendar", mix: [inlineBlock(), rounded("lg"), p(3), bg("neutral.tint"), mix], children: children ?? (_jsx(Input, { type: "date", color: resolvedColor, name: name, value: value, defaultValue: defaultValue, min: min, max: max, step: step, required: required, disabled: disabled, readOnly: readOnly, autoComplete: autoComplete, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy })) }));
|
|
@@ -64,7 +64,7 @@ const DEFAULT_DIALOG_PLACEMENT = "bottom-start";
|
|
|
64
64
|
export function ColorPicker(handle) {
|
|
65
65
|
return () => {
|
|
66
66
|
let { color, label, description, errorMessage, format, name, value, defaultValue, placeholder, required, disabled, readOnly, autoComplete, parts, children, mix, ...rest } = handle.props;
|
|
67
|
-
if (import.meta.env
|
|
67
|
+
if (import.meta.env?.DEV && !children && !label) {
|
|
68
68
|
console.warn('ColorPicker: falling back to ColorField\'s plain color-notation field needs a "label" describing what it collects for assistive technology.');
|
|
69
69
|
}
|
|
70
70
|
if (!children) {
|
|
@@ -122,7 +122,7 @@ Command.List = function CommandList(handle) {
|
|
|
122
122
|
Command.Item = function CommandItem(handle) {
|
|
123
123
|
return () => {
|
|
124
124
|
let { value, children, mix, ...rest } = handle.props;
|
|
125
|
-
if (import.meta.env
|
|
125
|
+
if (import.meta.env?.DEV && !value) {
|
|
126
126
|
console.warn('Command.Item: needs a "value" — a filter behavior matches typed text against this instead of parsing rendered children.');
|
|
127
127
|
}
|
|
128
128
|
return (_jsx("div", { ...rest, "data-slot": "item", "data-value": value, mix: [
|
|
@@ -28,7 +28,7 @@ import { DateField } from "./date-field.js";
|
|
|
28
28
|
export function DatePicker(handle) {
|
|
29
29
|
return () => {
|
|
30
30
|
let { color, label, description, errorMessage, name, value, defaultValue, min, max, step, required, disabled, readOnly, autoComplete, parts, children, mix, ...rest } = handle.props;
|
|
31
|
-
if (import.meta.env
|
|
31
|
+
if (import.meta.env?.DEV && !children && !label) {
|
|
32
32
|
console.warn('DatePicker: falling back to DateField\'s plain "input type=date" needs a "label" describing what it collects for assistive technology.');
|
|
33
33
|
}
|
|
34
34
|
if (!children) {
|
|
@@ -32,7 +32,7 @@ import { DatePicker } from "./date-picker.js";
|
|
|
32
32
|
export function DateRangePicker(handle) {
|
|
33
33
|
return () => {
|
|
34
34
|
let { color, startLabel, endLabel, startDescription, endDescription, startErrorMessage, endErrorMessage, startName, endName, startValue, endValue, startDefaultValue, endDefaultValue, min, max, step, required, disabled, readOnly, autoComplete, parts, children, mix, ...rest } = handle.props;
|
|
35
|
-
if (import.meta.env
|
|
35
|
+
if (import.meta.env?.DEV && !children) {
|
|
36
36
|
if (!startLabel) {
|
|
37
37
|
console.warn('DateRangePicker: falling back to paired "input type=date" fields needs a "startLabel" describing the range\'s start for assistive technology.');
|
|
38
38
|
}
|
|
@@ -59,7 +59,7 @@ const DEFAULT_CLOSE_COMMAND = "close";
|
|
|
59
59
|
export function Dialog(handle) {
|
|
60
60
|
return () => {
|
|
61
61
|
let { id, children, mix, ...rest } = handle.props;
|
|
62
|
-
if (import.meta.env
|
|
62
|
+
if (import.meta.env?.DEV && !id) {
|
|
63
63
|
console.warn('Dialog rendered without an "id" — "commandfor" on a trigger or close control has nothing to target.');
|
|
64
64
|
}
|
|
65
65
|
return (_jsx("dialog", { ...rest, id: id, "data-slot": "dialog", mix: [
|
|
@@ -40,7 +40,7 @@ export function FileTrigger(handle) {
|
|
|
40
40
|
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
41
41
|
let resolvedVariant = variant ?? DEFAULT_VARIANT;
|
|
42
42
|
let resolvedSize = size ?? DEFAULT_SIZE;
|
|
43
|
-
if (import.meta.env
|
|
43
|
+
if (import.meta.env?.DEV &&
|
|
44
44
|
!handle.props["aria-label"] &&
|
|
45
45
|
!handle.props["aria-labelledby"] &&
|
|
46
46
|
!hasAccessibleText(children)) {
|
|
@@ -48,7 +48,7 @@ export function readAmbientLevel(handle) {
|
|
|
48
48
|
export function resolveHeadingLevel(handle, explicitLevel) {
|
|
49
49
|
let resolved = explicitLevel ?? readAmbientLevel(handle) ?? DEFAULT_LEVEL;
|
|
50
50
|
if (resolved > MAX_LEVEL) {
|
|
51
|
-
if (import.meta.env
|
|
51
|
+
if (import.meta.env?.DEV) {
|
|
52
52
|
console.warn(`Heading nesting resolved to level ${resolved}, past the native "h1"–"h6" range. Flatten the nesting, or start a new top-level HeadingScope instead of nesting further.`);
|
|
53
53
|
}
|
|
54
54
|
return MAX_LEVEL;
|
|
@@ -141,7 +141,7 @@ MessageScroller.Content = function MessageScrollerContent(handle) {
|
|
|
141
141
|
MessageScroller.Item = function MessageScrollerItem(handle) {
|
|
142
142
|
return () => {
|
|
143
143
|
let { messageId, scrollAnchor, children, mix, ...rest } = handle.props;
|
|
144
|
-
if (import.meta.env
|
|
144
|
+
if (import.meta.env?.DEV && !messageId) {
|
|
145
145
|
console.warn('MessageScroller.Item: needs a "messageId" — a scroll-follow behavior matches rows against this instead of parsing rendered children.');
|
|
146
146
|
}
|
|
147
147
|
return (_jsx("div", { ...rest, "data-slot": "item", "data-message-id": messageId, "data-scroll-anchor": scrollAnchor || undefined, mix: [
|
|
@@ -167,7 +167,7 @@ NumberField.Input = function NumberFieldInput(handle) {
|
|
|
167
167
|
NumberField.DecrementButton = function NumberFieldDecrementButton(handle) {
|
|
168
168
|
return () => {
|
|
169
169
|
let { type, mix, ...rest } = handle.props;
|
|
170
|
-
if (import.meta.env
|
|
170
|
+
if (import.meta.env?.DEV && !handle.props["aria-label"] && !handle.props["aria-labelledby"]) {
|
|
171
171
|
console.warn("NumberField.DecrementButton: needs an `aria-label` describing what it does — its content is a decorative glyph with no accessible name of its own.");
|
|
172
172
|
}
|
|
173
173
|
return (_jsx("button", { type: type ?? DEFAULT_BUTTON_TYPE, ...rest, "data-slot": "decrement", mix: [stepperButtonMix("end"), mix], children: _jsx(MinusIcon, {}) }));
|
|
@@ -188,7 +188,7 @@ NumberField.DecrementButton = function NumberFieldDecrementButton(handle) {
|
|
|
188
188
|
NumberField.IncrementButton = function NumberFieldIncrementButton(handle) {
|
|
189
189
|
return () => {
|
|
190
190
|
let { type, mix, ...rest } = handle.props;
|
|
191
|
-
if (import.meta.env
|
|
191
|
+
if (import.meta.env?.DEV && !handle.props["aria-label"] && !handle.props["aria-labelledby"]) {
|
|
192
192
|
console.warn("NumberField.IncrementButton: needs an `aria-label` describing what it does — its content is a decorative glyph with no accessible name of its own.");
|
|
193
193
|
}
|
|
194
194
|
return (_jsx("button", { type: type ?? DEFAULT_BUTTON_TYPE, ...rest, "data-slot": "increment", mix: [stepperButtonMix("start"), mix], children: _jsx(PlusIcon, {}) }));
|
|
@@ -55,7 +55,7 @@ export function RangeCalendar(handle) {
|
|
|
55
55
|
return () => {
|
|
56
56
|
let { color, startName, endName, startValue, endValue, startDefaultValue, endDefaultValue, min, max, step, required, disabled, readOnly, autoComplete, startLabel, endLabel, parts, children, mix, ...rest } = handle.props;
|
|
57
57
|
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
58
|
-
if (import.meta.env
|
|
58
|
+
if (import.meta.env?.DEV && !children) {
|
|
59
59
|
if (!startLabel) {
|
|
60
60
|
console.warn('RangeCalendar: falling back to a plain "input type=date" pair needs a "startLabel" describing the range\'s start for assistive technology.');
|
|
61
61
|
}
|
|
@@ -118,7 +118,7 @@ Resizable.Handle = function ResizableHandle(handle) {
|
|
|
118
118
|
return () => {
|
|
119
119
|
let { mix, ...rest } = handle.props;
|
|
120
120
|
let context = handle.context.get(Resizable);
|
|
121
|
-
if (import.meta.env
|
|
121
|
+
if (import.meta.env?.DEV && !rest["aria-label"] && !rest["aria-labelledby"]) {
|
|
122
122
|
console.warn("Resizable.Handle: a resize handle with no `aria-label` or `aria-labelledby` needs one describing what it resizes — assistive technology has no accessible name to announce otherwise.");
|
|
123
123
|
}
|
|
124
124
|
return (_jsx("div", { "data-orientation": context.orientation, "aria-orientation": context.orientation, ...rest, mix: [
|
|
@@ -53,7 +53,7 @@ export function Select(handle) {
|
|
|
53
53
|
return () => {
|
|
54
54
|
let { color, multiple, size, mix, ...rest } = handle.props;
|
|
55
55
|
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
56
|
-
if (import.meta.env
|
|
56
|
+
if (import.meta.env?.DEV && (multiple || (typeof size === "number" && size > 1))) {
|
|
57
57
|
console.warn("Select: `appearance: base-select` styling has no effect on a `multiple` select or one with a `size` greater than 1 — the browser keeps its plain list-box rendering there instead of the customized trigger, value, and option styling.");
|
|
58
58
|
}
|
|
59
59
|
let fieldMix = [
|
|
@@ -263,7 +263,7 @@ Select.Option = function SelectOption(handle) {
|
|
|
263
263
|
Select.Group = function SelectGroup(handle) {
|
|
264
264
|
return () => {
|
|
265
265
|
let { mix, ...rest } = handle.props;
|
|
266
|
-
if (import.meta.env
|
|
266
|
+
if (import.meta.env?.DEV && !rest.label) {
|
|
267
267
|
console.warn("Select.Group: an `optgroup` with no `label` renders with no visible heading for its options — pass a `label` describing the group.");
|
|
268
268
|
}
|
|
269
269
|
return (_jsx("optgroup", { ...rest, mix: [
|
|
@@ -39,7 +39,7 @@ const CROSS_DOCUMENT_TRANSITION_STYLESHEET = `
|
|
|
39
39
|
export function SharedElement(handle) {
|
|
40
40
|
return () => {
|
|
41
41
|
let { id, mix, style, ...rest } = handle.props;
|
|
42
|
-
if (import.meta.env
|
|
42
|
+
if (import.meta.env?.DEV && !id) {
|
|
43
43
|
console.warn('SharedElement rendered without an "id" — the browser has nothing to match it against on the other side of a cross-document view transition.');
|
|
44
44
|
}
|
|
45
45
|
let resolvedStyle = mergeStyle(style, { "view-transition-name": id });
|
|
@@ -47,7 +47,7 @@ export declare namespace Sidebar {
|
|
|
47
47
|
/**
|
|
48
48
|
* Every native `<div>` attribute, plus the `mix` passthrough. Establishes
|
|
49
49
|
* the shell's row layout — {@link Sidebar} beside {@link Sidebar.Inset} —
|
|
50
|
-
* plus the {@link PROVIDER_CONTAINER_NAME} container
|
|
50
|
+
* plus the {@link PROVIDER_CONTAINER_NAME} container the collapse rules query.
|
|
51
51
|
*/
|
|
52
52
|
interface ProviderProps extends TagProps<"div"> {
|
|
53
53
|
/** {@link Sidebar} and {@link Sidebar.Inset}, in either order. */
|
|
@@ -242,9 +242,9 @@ export declare namespace Sidebar {
|
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
/**
|
|
245
|
-
* Renders the rail itself: a native `<aside>`
|
|
246
|
-
*
|
|
247
|
-
*
|
|
245
|
+
* Renders the rail itself: a native `<aside>` styled through its `data-*`
|
|
246
|
+
* attributes, with collapse rules keyed off {@link Sidebar.Provider}'s `:has()`
|
|
247
|
+
* state and declared after its base size, so both directions animate.
|
|
248
248
|
*
|
|
249
249
|
* @param handle Runtime handle carrying the host `<aside>`'s props.
|
|
250
250
|
* @returns The render function producing the rail's markup.
|
|
@@ -58,7 +58,7 @@ const WIDE_SHELL_QUERY = `@container ${PROVIDER_CONTAINER_NAME} (min-width: 48re
|
|
|
58
58
|
/**
|
|
59
59
|
* Selector matching {@link Sidebar.Trigger}'s own checkbox input once it
|
|
60
60
|
* carries the platform's native `:checked` state — the single source of
|
|
61
|
-
* truth every collapse-driven rule in {@link Sidebar
|
|
61
|
+
* truth every collapse-driven rule in {@link Sidebar} reads from.
|
|
62
62
|
*/
|
|
63
63
|
const TOGGLE_CHECKED_SELECTOR = '[data-slot="toggle"]:checked';
|
|
64
64
|
/**
|
|
@@ -70,9 +70,9 @@ function resolveAriaCurrent(current, ariaCurrent) {
|
|
|
70
70
|
return ariaCurrent ?? (current ? "page" : undefined);
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* Renders the rail itself: a native `<aside>`
|
|
74
|
-
*
|
|
75
|
-
*
|
|
73
|
+
* Renders the rail itself: a native `<aside>` styled through its `data-*`
|
|
74
|
+
* attributes, with collapse rules keyed off {@link Sidebar.Provider}'s `:has()`
|
|
75
|
+
* state and declared after its base size, so both directions animate.
|
|
76
76
|
*
|
|
77
77
|
* @param handle Runtime handle carrying the host `<aside>`'s props.
|
|
78
78
|
* @returns The render function producing the rail's markup.
|
|
@@ -128,14 +128,39 @@ export function Sidebar(handle) {
|
|
|
128
128
|
}),
|
|
129
129
|
data("variant", "floating", [rounded("xl"), border({ color: "neutral", width: 1 })]),
|
|
130
130
|
data("variant", "inset", [rounded("xl"), border({ color: "neutral", width: 1 })]),
|
|
131
|
+
when(`[data-slot="provider"]:has(${TOGGLE_CHECKED_SELECTOR}) &`, [
|
|
132
|
+
when('&[data-collapsible="icon"]', [
|
|
133
|
+
is(varUtility("sidebar-width-icon", "3rem")),
|
|
134
|
+
when("[data-sidebar-collapsed-hide]", visuallyHidden()),
|
|
135
|
+
when('[data-slot="group-label"]', visuallyHidden()),
|
|
136
|
+
when('[data-slot="menu-badge"]', hidden()),
|
|
137
|
+
when('[data-slot="menu-sub"]', hidden()),
|
|
138
|
+
when('[data-slot="menu-button"], [data-slot="menu-link"]', [
|
|
139
|
+
justify("center"),
|
|
140
|
+
pi("0"),
|
|
141
|
+
]),
|
|
142
|
+
]),
|
|
143
|
+
when('&[data-collapsible="offcanvas"][data-side="left"]', [
|
|
144
|
+
translateX("-100%"),
|
|
145
|
+
is("0"),
|
|
146
|
+
overflow("hidden"),
|
|
147
|
+
border({ width: "0", noStyleDefault: true }),
|
|
148
|
+
]),
|
|
149
|
+
when('&[data-collapsible="offcanvas"][data-side="right"]', [
|
|
150
|
+
translateX("100%"),
|
|
151
|
+
is("0"),
|
|
152
|
+
overflow("hidden"),
|
|
153
|
+
border({ width: "0", noStyleDefault: true }),
|
|
154
|
+
]),
|
|
155
|
+
]),
|
|
131
156
|
mix,
|
|
132
157
|
] }));
|
|
133
158
|
};
|
|
134
159
|
}
|
|
135
160
|
/**
|
|
136
161
|
* Renders the shell's layout root: a flex row placing {@link Sidebar} beside
|
|
137
|
-
* {@link Sidebar.Inset},
|
|
138
|
-
* {@link Sidebar.Trigger}'s checkbox reaching `:checked
|
|
162
|
+
* {@link Sidebar.Inset}, whose subtree {@link Sidebar} watches for
|
|
163
|
+
* {@link Sidebar.Trigger}'s checkbox reaching `:checked`.
|
|
139
164
|
*
|
|
140
165
|
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
141
166
|
* @returns The render function producing the shell's markup.
|
|
@@ -168,31 +193,6 @@ Sidebar.Provider = function SidebarProvider(handle) {
|
|
|
168
193
|
items("stretch"),
|
|
169
194
|
minBs("100dvh"),
|
|
170
195
|
is("full"),
|
|
171
|
-
when(`&:has(${TOGGLE_CHECKED_SELECTOR})`, [
|
|
172
|
-
when('[data-slot="sidebar"][data-collapsible="icon"]', [
|
|
173
|
-
is(varUtility("sidebar-width-icon", "3rem")),
|
|
174
|
-
when("[data-sidebar-collapsed-hide]", visuallyHidden()),
|
|
175
|
-
when('[data-slot="group-label"]', visuallyHidden()),
|
|
176
|
-
when('[data-slot="menu-badge"]', hidden()),
|
|
177
|
-
when('[data-slot="menu-sub"]', hidden()),
|
|
178
|
-
when('[data-slot="menu-button"], [data-slot="menu-link"]', [
|
|
179
|
-
justify("center"),
|
|
180
|
-
pi("0"),
|
|
181
|
-
]),
|
|
182
|
-
]),
|
|
183
|
-
when('[data-slot="sidebar"][data-collapsible="offcanvas"][data-side="left"]', [
|
|
184
|
-
translateX("-100%"),
|
|
185
|
-
is("0"),
|
|
186
|
-
overflow("hidden"),
|
|
187
|
-
border({ width: "0", noStyleDefault: true }),
|
|
188
|
-
]),
|
|
189
|
-
when('[data-slot="sidebar"][data-collapsible="offcanvas"][data-side="right"]', [
|
|
190
|
-
translateX("100%"),
|
|
191
|
-
is("0"),
|
|
192
|
-
overflow("hidden"),
|
|
193
|
-
border({ width: "0", noStyleDefault: true }),
|
|
194
|
-
]),
|
|
195
|
-
]),
|
|
196
196
|
container(PROVIDER_CONTAINER_NAME),
|
|
197
197
|
mix,
|
|
198
198
|
] }));
|
|
@@ -14,9 +14,9 @@ import type { Handle, Props as TagProps } from "remix/component";
|
|
|
14
14
|
*/
|
|
15
15
|
export declare namespace Typeset {
|
|
16
16
|
/**
|
|
17
|
-
* Rhythm context
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* Rhythm context. `"docs"` sets the body at 18px, the size for a page meant
|
|
18
|
+
* to be read. `"reading"` sets it at 20px for a long-form article. `"chat"`
|
|
19
|
+
* sets it at 15px for a turn in a denser column.
|
|
20
20
|
*/
|
|
21
21
|
type Preset = "docs" | "chat" | "reading";
|
|
22
22
|
/**
|
|
@@ -19,6 +19,21 @@ import { easings } from "../animations/tokens.js";
|
|
|
19
19
|
const CONTAINER_NAME = "ui-typeset";
|
|
20
20
|
/** Rhythm context {@link Typeset} falls back to when `preset` is omitted. */
|
|
21
21
|
const DEFAULT_PRESET = "docs";
|
|
22
|
+
/**
|
|
23
|
+
* Body size each preset writes to `--ui-typeset-size`. On a 16px root, `docs`
|
|
24
|
+
* is 18px and `reading` is 20px, so long-form copy is large enough to read;
|
|
25
|
+
* `chat` is 15px for a turn taken in a denser column.
|
|
26
|
+
*/
|
|
27
|
+
const PRESET_BODY_SIZE = {
|
|
28
|
+
docs: "1.125rem",
|
|
29
|
+
chat: "0.9375rem",
|
|
30
|
+
reading: "1.25rem",
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Size body copy and headings compute from. Clearing `--ui-typeset-size`
|
|
34
|
+
* still leaves the docs body, which is the preset a host uses by default.
|
|
35
|
+
*/
|
|
36
|
+
const TYPESET_SIZE = `var(--ui-typeset-size, ${PRESET_BODY_SIZE.docs})`;
|
|
22
37
|
/** CSS length each edge of a wide table's own fade tapers over. */
|
|
23
38
|
const TABLE_FADE_SIZE = "2.5rem";
|
|
24
39
|
/**
|
|
@@ -87,20 +102,20 @@ export function Typeset(handle) {
|
|
|
87
102
|
container(CONTAINER_NAME),
|
|
88
103
|
keyframes(TABLE_FADE_KEYFRAMES_NAME, TABLE_FADE_KEYFRAMES),
|
|
89
104
|
raw({
|
|
90
|
-
fontSize:
|
|
105
|
+
fontSize: TYPESET_SIZE,
|
|
91
106
|
lineHeight: "var(--ui-typeset-leading, 1.75)",
|
|
92
107
|
'&[data-preset="docs"]': {
|
|
93
|
-
"--ui-typeset-size":
|
|
108
|
+
"--ui-typeset-size": PRESET_BODY_SIZE.docs,
|
|
94
109
|
"--ui-typeset-leading": "1.75",
|
|
95
110
|
"--ui-typeset-flow": "1.25em",
|
|
96
111
|
},
|
|
97
112
|
'&[data-preset="chat"]': {
|
|
98
|
-
"--ui-typeset-size":
|
|
113
|
+
"--ui-typeset-size": PRESET_BODY_SIZE.chat,
|
|
99
114
|
"--ui-typeset-leading": "1.5",
|
|
100
115
|
"--ui-typeset-flow": "0.75em",
|
|
101
116
|
},
|
|
102
117
|
'&[data-preset="reading"]': {
|
|
103
|
-
"--ui-typeset-size":
|
|
118
|
+
"--ui-typeset-size": PRESET_BODY_SIZE.reading,
|
|
104
119
|
"--ui-typeset-leading": "1.8",
|
|
105
120
|
"--ui-typeset-flow": "1.5em",
|
|
106
121
|
},
|
|
@@ -111,22 +126,22 @@ export function Typeset(handle) {
|
|
|
111
126
|
marginBlockStart: "var(--ui-typeset-flow, 1.25em)",
|
|
112
127
|
},
|
|
113
128
|
"& :where(h1)": {
|
|
114
|
-
fontSize:
|
|
129
|
+
fontSize: `calc(${TYPESET_SIZE} * 2)`,
|
|
115
130
|
},
|
|
116
131
|
"& :where(h2)": {
|
|
117
|
-
fontSize:
|
|
132
|
+
fontSize: `calc(${TYPESET_SIZE} * 1.5)`,
|
|
118
133
|
},
|
|
119
134
|
"& :where(h3)": {
|
|
120
|
-
fontSize:
|
|
135
|
+
fontSize: `calc(${TYPESET_SIZE} * 1.25)`,
|
|
121
136
|
},
|
|
122
137
|
"& :where(h4)": {
|
|
123
|
-
fontSize:
|
|
138
|
+
fontSize: `calc(${TYPESET_SIZE} * 1.125)`,
|
|
124
139
|
},
|
|
125
140
|
"& :where(h5)": {
|
|
126
|
-
fontSize:
|
|
141
|
+
fontSize: TYPESET_SIZE,
|
|
127
142
|
},
|
|
128
143
|
"& :where(h6)": {
|
|
129
|
-
fontSize:
|
|
144
|
+
fontSize: `calc(${TYPESET_SIZE} * 0.875)`,
|
|
130
145
|
},
|
|
131
146
|
"& :where(ul)": {
|
|
132
147
|
listStyleType: "disc",
|
|
@@ -56,14 +56,14 @@ function resolveAction(host) {
|
|
|
56
56
|
return undefined;
|
|
57
57
|
let command = host.getAttribute("command") ?? DEFAULT_DIALOG_COMMAND;
|
|
58
58
|
if (command !== DEFAULT_DIALOG_COMMAND) {
|
|
59
|
-
if (import.meta.env
|
|
59
|
+
if (import.meta.env?.DEV) {
|
|
60
60
|
console.warn(`attachmentTrigger(): unsupported command "${command}" — only "${DEFAULT_DIALOG_COMMAND}" opens a dialog from a card activation.`);
|
|
61
61
|
}
|
|
62
62
|
return undefined;
|
|
63
63
|
}
|
|
64
64
|
let dialog = document.getElementById(commandForId);
|
|
65
65
|
if (!(dialog instanceof HTMLDialogElement)) {
|
|
66
|
-
if (import.meta.env
|
|
66
|
+
if (import.meta.env?.DEV) {
|
|
67
67
|
console.warn(`attachmentTrigger(): commandfor="${commandForId}" doesn't reference a <dialog> element.`);
|
|
68
68
|
}
|
|
69
69
|
return undefined;
|
|
@@ -64,7 +64,7 @@ export const colorPreview = createMixin((handle) => {
|
|
|
64
64
|
let host = event.currentTarget;
|
|
65
65
|
let swatch = findSwatch(host);
|
|
66
66
|
if (swatch === null) {
|
|
67
|
-
if (import.meta.env
|
|
67
|
+
if (import.meta.env?.DEV && !hasWarnedMissingSwatch) {
|
|
68
68
|
hasWarnedMissingSwatch = true;
|
|
69
69
|
console.warn(`colorPreview(): no element matching ${SWATCH_SELECTOR} found beneath the ColorField host to update.`);
|
|
70
70
|
}
|
|
@@ -39,7 +39,7 @@ export const contextMenu = createMixin((handle) => {
|
|
|
39
39
|
function openSurfaceAt(id, point, options) {
|
|
40
40
|
let surface = document.getElementById(id);
|
|
41
41
|
if (!surface) {
|
|
42
|
-
if (import.meta.env
|
|
42
|
+
if (import.meta.env?.DEV) {
|
|
43
43
|
console.warn(`contextMenu(): no element with id "${id}" found to open.`);
|
|
44
44
|
}
|
|
45
45
|
return;
|
|
@@ -98,7 +98,7 @@ export const copyToClipboard = createMixin((handle) => {
|
|
|
98
98
|
return;
|
|
99
99
|
let target = resolveCopyTarget(button);
|
|
100
100
|
if (!target) {
|
|
101
|
-
if (import.meta.env
|
|
101
|
+
if (import.meta.env?.DEV) {
|
|
102
102
|
console.warn('copyToClipboard(): button has no "commandfor" target to copy text from.');
|
|
103
103
|
}
|
|
104
104
|
return;
|
package/dist/mixins/hotkey.js
CHANGED
|
@@ -39,7 +39,7 @@ function setOpen(host, open) {
|
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
if (!host.hasAttribute("popover")) {
|
|
42
|
-
if (import.meta.env
|
|
42
|
+
if (import.meta.env?.DEV) {
|
|
43
43
|
console.warn(`hotkey(): host is neither a <dialog> nor a [popover] element, so it cannot be ${open ? "shown" : "hidden"}.`);
|
|
44
44
|
}
|
|
45
45
|
return;
|
|
@@ -86,7 +86,7 @@ export const hotkey = createMixin((handle) => {
|
|
|
86
86
|
});
|
|
87
87
|
return (combo) => {
|
|
88
88
|
parsed = parseKeyCombo(combo);
|
|
89
|
-
if (parsed.key === "" && import.meta.env
|
|
89
|
+
if (parsed.key === "" && import.meta.env?.DEV) {
|
|
90
90
|
console.warn(`hotkey(): "${combo}" has no trigger key and will never match.`);
|
|
91
91
|
}
|
|
92
92
|
};
|
package/dist/mixins/persist.js
CHANGED
|
@@ -57,7 +57,7 @@ export const persist = createMixin((handle) => {
|
|
|
57
57
|
let host = event.currentTarget;
|
|
58
58
|
let checkbox = findToggleCheckbox(host);
|
|
59
59
|
if (checkbox === null) {
|
|
60
|
-
if (import.meta.env
|
|
60
|
+
if (import.meta.env?.DEV) {
|
|
61
61
|
console.warn(`persist(): no element with ${SIDEBAR_TOGGLE_ATTRIBUTE} found beneath the Sidebar root to toggle.`);
|
|
62
62
|
}
|
|
63
63
|
return;
|
package/dist/mixins/validate.js
CHANGED
|
@@ -85,7 +85,7 @@ function mirrorValidity(field, message) {
|
|
|
85
85
|
field.setAttribute("aria-invalid", message === "" ? "false" : "true");
|
|
86
86
|
let slot = findFieldErrorSlot(field);
|
|
87
87
|
if (slot === null) {
|
|
88
|
-
if (import.meta.env
|
|
88
|
+
if (import.meta.env?.DEV && message !== "") {
|
|
89
89
|
console.warn("validate(): no FieldError slot found through this field's aria-describedby; " +
|
|
90
90
|
`add ${FIELD_ERROR_ATTRIBUTE} to the element the field describes its error with.`);
|
|
91
91
|
}
|
|
@@ -28,7 +28,7 @@ import { hasAccessibleText } from "./has-accessible-text.js";
|
|
|
28
28
|
* );
|
|
29
29
|
*/
|
|
30
30
|
export function warnIfNoAccessibleName(props, children, message) {
|
|
31
|
-
if (import.meta.env
|
|
31
|
+
if (import.meta.env?.DEV &&
|
|
32
32
|
!props["aria-label"] &&
|
|
33
33
|
!props["aria-labelledby"] &&
|
|
34
34
|
!hasAccessibleText(children)) {
|
|
@@ -49,7 +49,7 @@ export function warnIfNoAccessibleName(props, children, message) {
|
|
|
49
49
|
* );
|
|
50
50
|
*/
|
|
51
51
|
export function warnIfNoAccessibleLabel(props, message) {
|
|
52
|
-
if (import.meta.env
|
|
52
|
+
if (import.meta.env?.DEV && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
53
53
|
console.warn(message);
|
|
54
54
|
}
|
|
55
55
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdxc/ui",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.21",
|
|
4
4
|
"description": "Styled, accessible remix/component components rendered as server HTML",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@remix-run/ui": "0.12.1",
|
|
21
|
-
"@sdxc/icons": "2026.10.
|
|
22
|
-
"@sdxc/u": "2026.10.
|
|
21
|
+
"@sdxc/icons": "2026.10.20",
|
|
22
|
+
"@sdxc/u": "2026.10.20",
|
|
23
23
|
"@sdxc/uuid": "2026.10.13"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"remix": "3.0.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "b64617ec8a697696a1fe6fb0f704fb9017b6a7a0",
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|