@sdxc/ui 2026.10.20 → 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 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`, `chat`, `reading`).
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.
@@ -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 and `:checked` collapse rules.
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>` sized and styled through its
246
- * `data-variant`, `data-collapsible`, and `data-side` attributes, with
247
- * every collapse rule keyed off {@link Sidebar.Provider}'s `:has()` state.
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.Provider} reads from.
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>` sized and styled through its
74
- * `data-variant`, `data-collapsible`, and `data-side` attributes, with
75
- * every collapse rule keyed off {@link Sidebar.Provider}'s `:has()` state.
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}, hosting every collapse rule keyed purely off
138
- * {@link Sidebar.Trigger}'s checkbox reaching `:checked` in this subtree.
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: `"docs"` is the spacious default, `"chat"` tightens the
18
- * scale for a conversational bubble's denser turn-taking, and `"reading"`
19
- * opens both further for a long-form article.
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: "var(--ui-typeset-size, 1rem)",
105
+ fontSize: TYPESET_SIZE,
91
106
  lineHeight: "var(--ui-typeset-leading, 1.75)",
92
107
  '&[data-preset="docs"]': {
93
- "--ui-typeset-size": "1rem",
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": "0.9375rem",
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": "1.125rem",
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: "calc(var(--ui-typeset-size, 1rem) * 2)",
129
+ fontSize: `calc(${TYPESET_SIZE} * 2)`,
115
130
  },
116
131
  "& :where(h2)": {
117
- fontSize: "calc(var(--ui-typeset-size, 1rem) * 1.5)",
132
+ fontSize: `calc(${TYPESET_SIZE} * 1.5)`,
118
133
  },
119
134
  "& :where(h3)": {
120
- fontSize: "calc(var(--ui-typeset-size, 1rem) * 1.25)",
135
+ fontSize: `calc(${TYPESET_SIZE} * 1.25)`,
121
136
  },
122
137
  "& :where(h4)": {
123
- fontSize: "calc(var(--ui-typeset-size, 1rem) * 1.125)",
138
+ fontSize: `calc(${TYPESET_SIZE} * 1.125)`,
124
139
  },
125
140
  "& :where(h5)": {
126
- fontSize: "var(--ui-typeset-size, 1rem)",
141
+ fontSize: TYPESET_SIZE,
127
142
  },
128
143
  "& :where(h6)": {
129
- fontSize: "calc(var(--ui-typeset-size, 1rem) * 0.875)",
144
+ fontSize: `calc(${TYPESET_SIZE} * 0.875)`,
130
145
  },
131
146
  "& :where(ul)": {
132
147
  listStyleType: "disc",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdxc/ui",
3
- "version": "2026.10.20",
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",
@@ -25,7 +25,7 @@
25
25
  "peerDependencies": {
26
26
  "remix": "3.0.0"
27
27
  },
28
- "gitHead": "bd4473246f405c43055d2fc5e08c62ba35197258",
28
+ "gitHead": "b64617ec8a697696a1fe6fb0f704fb9017b6a7a0",
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },