@sdxc/kit 2026.11.25 → 2026.11.26
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.jsonl +12 -0
- package/package.json +2 -2
- package/registry/ui/slider.json +2 -2
package/changelog.jsonl
CHANGED
|
@@ -2233,3 +2233,15 @@
|
|
|
2233
2233
|
{"release":"2026.11.24","package":"@sdxc/seo","type":"fix","breaking":false,"title":"Write the card image's alt text for X as well","body":"Before: Seo.Meta wrote og.imageAlt only as og:image:alt, which X does not read, so a card\nshared there had no description for screen-reader users. After: the same text is also written as\ntwitter:image:alt whenever the card has an image. Consumers that already pass og.imageAlt get the\nextra tag with no change; nothing else in the output changes."}
|
|
2234
2234
|
{"release":"2026.11.25","package":"@sdxc/novel","type":"feat","breaking":false,"title":"Describe the cast and show it on a Characters screen","body":"`character()` takes a `description` message key, and a new `Characters`\nlibrary screen lists the cast beside the chosen character's portrait, name,\ndescription and every look the stage drew them in:\n\n export const CAST = cast({\n mika: character({\n name: \"cast.mika\",\n description: \"cast.mikaAbout\",\n sprites: { smile: \"/mika/smile.webp\", sad: \"/mika/sad.webp\" },\n }),\n });\n\n <NovelPlayer.Extras>\n <Gallery />\n <Characters />\n </NovelPlayer.Extras>\n\nA character shows as the `unknownName` label, and cannot be picked, until\nthey are `known` or a play introduces them. A sprite stays a locked\nplaceholder until the stage draws the character in it once, in any\nplaythrough; a layered character lists each combination of variants the\nstage drew. Its dialog is wider than the other library screens'.\n\n`NovelPlayer.Default` offers the screen in its Extras menu, and\n`NovelPlayer.Title` adds it to its default screens (Chapters, Gallery,\nCharacters, Memories). When the player offers the screen, a named speaker's\nname on the textbox is a button that opens it on them, through the new\n`showCharacter(id)` on the player context (`character` reads the id it asked\nfor).\n\n`Persistent.unlocked` gains `sprites`, the looks the stage drew, keyed\n`<character>:<sprite>` or `<character>:<layer>=<variant>,…`; stored data\nwithout it reads as none seen. `NovelLibrary` gains `characters`, and\n`NovelLabels` gains `characters` and `characterLooks`. A custom title that\npasses its own screens is unchanged; one relying on the defaults now shows a\nCharacters button."}
|
|
2235
2235
|
{"release":"2026.11.25","package":"@sdxc/workers-cache","type":"fix","breaking":false,"title":"Downgrade session-bearing requests without throwing in development","body":"Before: in development (`NODE_ENV=development`, or a request to a local host), the\n`@sdxc/workers-cache` middleware threw `UnsafeCachePolicyError` whenever a page that\ndeclared a public policy, or a targeted CDN lifetime, was requested with a session. A\ndeveloper signed in to their own app saw an error overlay over every public page.\n\nAfter: only a declared response that carries its own `Set-Cookie` throws in development.\nA request that brings a session is downgraded to `private, no-store` and logged as\n`cache.downgraded` (reason `session-with-public-policy` or\n`session-with-shared-targeted-policy`), the same way it always was in production, so the\npage renders uncached for the signed-in visitor.\n\nProduction behavior is unchanged and consumers need no action. Code that caught\n`UnsafeCachePolicyError` in development to detect a session refusal should read the\n`cache.downgraded` log field instead."}
|
|
2236
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"feat","breaking":false,"title":"Tab the settings screen and add a way back to the title","body":"The settings screen is now a wide dialog with Text, Sound and Accessibility tabs. Each row shows the setting's name, its current value (`40/s`, `1 sec`, `80%`) and its control. Under the text speed, a sample line types at the chosen speed, and Reset settings and Back buttons close the screen. `NovelPlayer.Settings` keeps its props, so no change is needed to use it.\n\nThe quick menu also gains a Title button whenever the player has a title screen (`NovelPlayer.Default` with `titleScreen`). It leaves the play and returns to the title, where Continue picks up from the latest save.\n\nRestyle the settings screen through new theme variables: `--novel-settings-panel-background`, `-panel-color`, `-panel-padding`, `-divider`, `-readout-color`, `-tab-background`, `-tab-selected-background`, `-tab-color`, `-tab-selected-color`, `-tab-border`, `-tab-radius`, `-tab-font`, `-preview-background` and `-preview-color`. Its parts carry `data-novel-settings-tab`, `data-novel-settings-panel`, `data-novel-setting`, `data-novel-setting-readout`, `data-novel-settings-preview`, `data-novel-settings-reset` and `data-novel-settings-back`:\n\n css({\n \"--novel-settings-panel-background\": \"#f3ead6\",\n \"--novel-settings-tab-border\": \"1px solid #d4b06a\",\n })\n\nNew labels translate the new words: `settingsText`, `settingsSound`, `settingsAccessibility`, `textPreview`, `textInstant`, `resetSettings`, `back` and `toTitle`. `SettingRow` is exported for a custom screen, and `RangeSetting` takes an optional `readout` and now renders a full row.\n\nA settings screen test that clicks a control must first open that control's tab, since only the open tab's rows are visible."}
|
|
2237
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"feat","breaking":false,"title":"Keep an encyclopedia of what the reader has learned","body":"A novel can now declare an encyclopedia of topics, such as places, magic or terms. Each topic holds entries the reader learns as the story goes. The new `Encyclopedia` screen gathers them in one book, along with the cast, the CGs and the music.\n\nDeclare it with `encyclopedia()`, `topic()` and `entry()`, and pass it to `createNovel`:\n\n export const LORE = encyclopedia({\n places: topic({\n name: \"lore.places\",\n entries: {\n pier: entry({\n title: \"lore.pier.title\",\n summary: \"lore.pier.summary\",\n body: \"lore.pier.body\",\n sections: [{ title: \"lore.pier.historyTitle\", body: \"lore.pier.history\" }],\n }),\n },\n }),\n });\n createNovel({ ..., encyclopedia: LORE });\n\nAn entry stays hidden until a scene runs `ctx.learn(LORE.places.entries.pier)`, unless it is declared with `known: true`. Persistent data records it in the new `unlocked.entries` list, and the novel emits `unlock` with `kind: \"entry\"`, which the player shows as a \"New entry: <title>\" toast. `check()` reports an entry the novel does not declare.\n\n`<Encyclopedia />` has pages for every learned entry (with its topic), the characters, each topic, the gallery and the music room. `pages` picks and orders them, for example `pages={[\"characters\", \"places\", \"gallery\"]}`. A topic page has a search field and opens the chosen entry beside the list: its topic, title, summary, a Contents disclosure and numbered sections.\n\nThe default menus change:\n- `NovelPlayer.Default`'s extras menu offers Memories, Encyclopedia, Endings, Chapters and Scene replay. Gallery, Characters and the Music room now live inside the encyclopedia.\n- The title screen's defaults are Chapters, Encyclopedia and Memories.\n- A speaker's name in the textbox opens the encyclopedia on that character.\n\nTo keep the old screens, pass them as children of `NovelPlayer.Extras` or `screens` on the title.\n\nNew labels: `encyclopedia`, `encyclopediaAll`, `search`, `contents`, `noEntries` and `entryUnlocked`. New theme variables: `--novel-encyclopedia-page-padding`, `--novel-encyclopedia-current-background` and `--novel-encyclopedia-current-color`. Code that builds a `Persistent` value by hand must add `entries: []` to `unlocked`."}
|
|
2238
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"fix","breaking":false,"title":"Leave the empty All entries page out of an encyclopedia without topics","body":"Before, a novel that declared no encyclopedia still opened the Encyclopedia on an All entries page that could only say \"Nothing learned yet.\" Now that page appears only when the novel declares topics, so such a novel's encyclopedia opens on Characters, then Gallery and Music room. No consumer action is needed."}
|
|
2239
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"feat","breaking":false,"title":"Grow a character's bio as the story reveals them","body":"A character can now declare a `bio` of titled sections. The characters screen, inside the encyclopedia or on its own, lists them numbered below the description. Each section stays hidden until a scene teaches it, so a character's page fills in as the story reveals who they are:\n\n harry: character({\n name: \"cast.harry\",\n description: \"about.harry\",\n bio: {\n raised: { title: \"bio.harry.raised\", body: \"bio.harry.raisedText\", known: true },\n scar: { title: \"bio.harry.scar\", body: \"bio.harry.scarText\" },\n },\n sprites: { … },\n })\n\n ctx.learn(CAST.harry, \"scar\")\n\n`learn(character, section)` works like `learn(entry)`. It records `harry:scar` in the new `unlocked.bios` list of persistent data, emits `unlock` with `kind: \"bio\"`, and shows a \"New entry: Harry\" toast the first time. A section declared `known: true` shows as soon as the reader meets the character. `check()` and the play both report a section the character does not declare. The new `bioKey(character, section)` names a section as persistent data records it.\n\nCode that builds a `Persistent` value by hand must add `bios: []` to `unlocked`. Code that switches over every `Directive` gets a new `LearnBioDirective` (`type: \"learnBio\"`), and `UnlockEvent.kind` gains `\"bio\"`."}
|
|
2240
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"fix","breaking":false,"title":"Include the Encyclopedia component in the package","body":"Before, @sdxc/novel/ui exported Encyclopedia from a module the package did not include, so importing @sdxc/novel/ui failed to resolve ./ui/encyclopedia.js and any app that bundled it failed to build. The package now ships the module, and importing @sdxc/novel/ui works again. Consumers need only upgrade."}
|
|
2241
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"fix","breaking":false,"title":"Show the settings sliders' rail and keep a chosen look's outline whole","body":"Before, the settings screen's sliders drew their rail in the UI theme's border token, which\nunder a dark system theme is a faint white that disappears on a light settings panel, so a\nslider at zero showed only its thumb. The encyclopedia's character page also clipped the\noutline around the chosen look at the edge of its scrolling column.\n\nNow each slider draws its rail in `--novel-settings-slider-track` and its filled part in\n`--novel-settings-slider-fill` (the accent color by default), and the looks list leaves room\nfor the outline. Set the two variables to match a custom settings panel:\n\n css({\n \"--novel-settings-slider-track\": \"rgb(122 96 52 / 0.25)\",\n \"--novel-settings-slider-fill\": \"#9c7630\",\n })\n\nNo other action is needed."}
|
|
2242
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"feat","breaking":false,"title":"Play hover and select sounds on the interface","body":"The player and the title screen can now play a sound as the reader reaches an option, by\npointer, keyboard or gamepad, and another as they pick one. Pass any declared sound assets:\n\n <NovelPlayer.Default\n novel={novel}\n sounds={{ hover: ASSETS.sounds.hover, select: ASSETS.sounds.select }}\n />\n\n`NovelPlayer.Title` takes the same `sounds` prop. Clicking the stage to advance stays silent,\nand a pick that opens a dialog or swaps the screen sounds once. The sounds play on a new\n`interface` mixer channel, which the settings screen lists as \"Interface\" (label\n`volumeInterface`, default volume 0.6), and `AudioMixer#playInterface(source)` plays one.\n\n`AudioChannel` and `NovelSettings[\"volume\"]` gain `interface`: code that builds a full volume\nrecord by hand adds `interface: <0..1>`. Stored settings without it take the default."}
|
|
2243
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"feat","breaking":true,"title":"Group a character's known and listed flags under lore, and polish the encyclopedia","body":"`character()` takes `known` inside a new `lore` option, beside a new `listed` flag:\n\nBefore:\n\n mika: character({ name: \"cast.mika\", known: true, sprites })\n\nAfter:\n\n mika: character({ name: \"cast.mika\", lore: { known: true }, sprites })\n\nMigrate every `known: true` on a character to `lore: { known: true }`. Encyclopedia entries and\nbio sections keep their own `known`. `lore: { listed: false }` leaves a passer-by, such as \"a\nprefect\", off the Characters page.\n\nThe encyclopedia and the library screens also change:\n\n- The Characters page lists only the characters the reader met in any play: introduced, heard\n speaking a line the reader read, or drawn on stage. `LibraryCharacter.met` follows the same\n rule, so a character declared `lore: { known: true }` who never appeared is no longer listed,\n and unmet characters no longer show as \"???\" rows.\n- On the Characters page only the list and the bio column scroll; the portrait stays in view.\n- The Gallery and the Music room (and `readLibrary`'s `images` and `music`) follow the order the\n story first shows and plays them, with unused assets last.\n- The encyclopedia leaves out its Gallery and Music room pages when the novel declares no images\n or no tracks.\n- CG tiles, a character's looks and chapter cards share one frame, locked or not, drawn from\n `--novel-library-frame`, `--novel-library-radius`, `--novel-library-locked-background` and\n `--novel-library-locked-color`.\n- Entry section headings are aligned with the text instead of centred.\n- Clicking a \"New entry\" toast opens that entry, and a bio toast that character's page. A toast\n takes `opens: { entry }` or `opens: { character }`, and the player context gains\n `showEntry(id)` and `entry`.\n- A right click on the stage hides the interface, and another brings it back.\n- The settings sliders draw their empty part as a thin line in `--novel-settings-slider-track`,\n `--novel-settings-slider-track-thickness` (default `2px`) thick.\n\n`Characters`' `labels` no longer takes `unknownName`."}
|
|
2244
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"fix","breaking":false,"title":"Keep the settings screen one size across tabs, and show its switches","body":"Before, the settings screen took each tab's height, so switching tabs resized the dialog and\nmoved the tab buttons under the pointer. Its switches also drew their track in the UI theme's\ntokens, which a dark theme turned into a faint white that vanished on a light settings panel,\nleaving only the thumb.\n\nNow every tab shares the tallest tab's size, so the tabs never move, and the switches draw their\ntrack in `--novel-settings-switch-off` and `--novel-settings-switch-on` and their thumb in\n`--novel-settings-switch-thumb`. No action is needed; set the three variables to match a custom\nsettings panel."}
|
|
2245
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"feat","breaking":false,"title":"Add a full screen button to the title screen","body":"`NovelPlayer.Title`, and so `NovelPlayer.Default`'s title screen, shows a button in its bottom\ncorner that enters and leaves full screen, where the browser allows it. It fills the screen with\nthe box the title sits in; a player with a title screen now does the same from its quick menu,\nso starting a game or going back to the title stays in full screen.\n\nRestyle the button with `--novel-title-fullscreen-inset`, `-size`, `-border`, `-radius`,\n`-background` and `-color`, or through `[data-novel-title-fullscreen]`. No action is needed."}
|
|
2246
|
+
{"release":"2026.11.26","package":"@sdxc/novel","type":"fix","breaking":false,"title":"Start the settings preview's typing once it is on the page","body":"Before, the settings screen's text preview started its typing timer while rendering, so a\nserver render of a player (a docs page that embeds one, for example) left a timer running\nthat later tried to update a component that never mounted, logging \"Cannot call\nhandle.update() before TextPreview's initial render commits\".\n\nNow the preview starts typing after it mounts in the browser, and a server render draws the\nline at rest with no timer. No action is needed."}
|
|
2247
|
+
{"release":"2026.11.26","package":"@sdxc/ui","type":"fix","breaking":false,"title":"Center the slider thumb on its rail in Chrome and Safari","body":"Before, a `Slider` whose pointer target (`--ui-target-size`, 1.5rem by default) was taller than\nits thumb drew the thumb high in Chrome and Safari: WebKit placed it at the top of the grown\nnative input, about 2px above the rail at the default sizes and more for larger targets.\n\nNow the thumb sits on the rail's centre line in every browser, at any thumb and target size. No\naction is needed."}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdxc/kit",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.26",
|
|
4
4
|
"description": "The sdxc command line: start a Remix v3 app, generate its files, copy UI components into it and upgrade it",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"remix": "3.2.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "a6d84fa08849d9318c95ac92e15cc77973a91561",
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
package/registry/ui/slider.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slider",
|
|
3
|
-
"changedIn": "2026.11.
|
|
3
|
+
"changedIn": "2026.11.26",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"Slider"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "slider.tsx",
|
|
10
|
-
"content": "/**\n * A single-value range control built on a native `<input type=\"range\">`,\n * paired with a track that draws its own background rail and a live fill\n * bar, plus an `<output>` for reporting the current value. The root shares\n * the resolved range and value with every part through component context,\n * so a track's fill bar and a thumb's native attributes always agree\n * without a consumer repeating the same numbers twice.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport {\n\tabsolute,\n\tafter,\n\tappearance,\n\tbasis,\n\tbefore,\n\tbg,\n\tborder,\n\tbs,\n\tcursor,\n\tgrow,\n\tinsBe,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\tinset,\n\tis,\n\titems,\n\tm,\n\tminBs,\n\tminIs,\n\toutlineStyle,\n\tpseudoContent,\n\traw,\n\trelative,\n\trounded,\n\tshrink,\n\ttabularNums,\n\ttranslateX,\n\ttranslateY,\n\tvstack,\n\twhen,\n\tz,\n} from \"@sdxc/u\";\nimport { mergeMix } from \"@sdxc/u/general\";\n\nimport { outputCaptionText } from \"@sdxc/ui/styles\";\nimport { rangeThumbAppearance } from \"@sdxc/ui/styles\";\nimport { mergeStyle } from \"@sdxc/ui/utils\";\nimport { resolveFillPercent } from \"@sdxc/ui/utils\";\n\n/** Default {@link Slider.Props} orientation, applied when `orientation` is omitted. */\nconst DEFAULT_ORIENTATION: Slider.Orientation = \"horizontal\";\n\n/** Default {@link Slider.Props} lower bound, applied when `min` is omitted. */\nconst DEFAULT_MIN = 0;\n\n/** Default {@link Slider.Props} upper bound, applied when `max` is omitted. */\nconst DEFAULT_MAX = 100;\n\n/** Default {@link Slider.ThumbProps} step, applied when `step` is omitted. */\nconst DEFAULT_STEP = 1;\n\n/**\n * Negative inset growing {@link Slider.Thumb}'s native input across the track's thin\n * axis to the larger of the thumb and `--ui-target-size`, clamped at zero so a track\n * already that thick keeps its own box.\n */\nconst THUMB_HIT_INSET =\n\t\"min(0px, calc((100% - max(var(--ui-slider-thumb-size, 1.25rem), var(--ui-target-size, 1.5rem))) / 2))\";\n\n/**\n * Prop types for {@link Slider} and its compound parts.\n */\nexport namespace Slider {\n\t/**\n\t * Axis the track's fill bar and thumb travel along: a full-width row, or\n\t * a full-height column.\n\t */\n\texport type Orientation = \"horizontal\" | \"vertical\";\n\n\t/**\n\t * Value {@link Slider} shares through component context so every nested\n\t * {@link Slider.Track}, {@link Slider.Thumb}, and {@link Slider.Output}\n\t * reads the same resolved range, value, orientation, and thumb id.\n\t */\n\texport interface Context {\n\t\t/** Resolved lower bound of the range, shared with {@link Slider.Thumb}. */\n\t\tmin: number;\n\t\t/** Resolved upper bound of the range, shared with {@link Slider.Thumb}. */\n\t\tmax: number;\n\t\t/** Resolved current value, used to compute {@link Slider.Track}'s fill bar and default {@link Slider.Thumb}'s own value. */\n\t\tvalue: number;\n\t\t/** Layout axis, read by {@link Slider.Thumb} to set its accessible orientation. */\n\t\torientation: Orientation;\n\t\t/**\n\t\t * Id shared by {@link Slider.Thumb} (as its own `id`) and\n\t\t * {@link Slider.Output} (as its `htmlFor`) so the two associate\n\t\t * natively without either needing an explicit id from the consumer.\n\t\t */\n\t\tthumbId: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link Slider}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Layout axis. Defaults to {@link DEFAULT_ORIENTATION}. */\n\t\torientation?: Orientation;\n\t\t/** Lower bound of the range. Defaults to {@link DEFAULT_MIN}. */\n\t\tmin?: number;\n\t\t/** Upper bound of the range. Defaults to {@link DEFAULT_MAX}. */\n\t\tmax?: number;\n\t\t/** Current value, for a slider whose value the consumer tracks itself. */\n\t\tvalue?: number;\n\t\t/** Starting value, for a slider that never tracks its own value. */\n\t\tdefaultValue?: number;\n\t}\n\n\t/**\n\t * Props accepted by {@link Slider.Track}.\n\t */\n\texport interface TrackProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<input>` attribute except `type` and `role`, fixed to\n\t * `\"range\"` and the platform's implicit `\"slider\"` role. `min`/`max`/`step`\n\t * override the range inherited from the nearest ancestor {@link Slider}.\n\t */\n\texport interface ThumbProps extends Omit<TagProps<\"input\">, \"type\" | \"role\"> {}\n\n\t/**\n\t * Props accepted by {@link Slider.Output}.\n\t */\n\texport interface OutputProps extends TagProps<\"output\"> {}\n}\n\n/**\n * Renders the root `<div>`, stacking its children and resolving range, value, orientation\n * and thumb id into context. Nested parts scope orientation rules to its `data-slot`, so an\n * ancestor carrying `data-orientation` (a toolbar, a scroll viewport) leaves its layout alone.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link Slider.Context}.\n * @returns The render function producing the root's markup.\n * @example\n * <Slider aria-label={t(\"settings.volume\")} min={0} max={100} defaultValue={40}>\n * \t<Slider.Output />\n * \t<Slider.Track>\n * \t\t<Slider.Thumb />\n * \t</Slider.Track>\n * </Slider>\n * @example\n * <Slider orientation=\"vertical\" min={0} max={10} defaultValue={6}>\n * \t<Slider.Track>\n * \t\t<Slider.Thumb aria-label={t(\"equalizer.band\", { hz: 250 })} />\n * \t</Slider.Track>\n * </Slider>\n */\nexport function Slider(handle: Handle<Slider.Props, Slider.Context>) {\n\treturn () => {\n\t\tlet { orientation, min, max, value, defaultValue, mix, ...rest } = handle.props;\n\t\tlet resolvedOrientation = orientation ?? DEFAULT_ORIENTATION;\n\t\tlet resolvedMin = min ?? DEFAULT_MIN;\n\t\tlet resolvedMax = max ?? DEFAULT_MAX;\n\t\tlet resolvedValue = value ?? defaultValue ?? resolvedMin;\n\n\t\thandle.context.set({\n\t\t\tmin: resolvedMin,\n\t\t\tmax: resolvedMax,\n\t\t\tvalue: resolvedValue,\n\t\t\torientation: resolvedOrientation,\n\t\t\tthumbId: handle.id,\n\t\t});\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"slider\"\n\t\t\t\tdata-orientation={resolvedOrientation}\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tvstack({ gap: \"0.5rem\" }),\n\t\t\t\t\t\twhen('&[data-orientation=\"horizontal\"]', [is(\"100%\"), minIs(\"10rem\")]),\n\t\t\t\t\t\twhen('&[data-orientation=\"vertical\"]', [bs(\"10rem\"), items(\"center\")]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n\n/**\n * Renders the visual track: a `position: relative` `<div>` that draws a rail\n * and fill bar as pseudo-elements sized from context's resolved value, and\n * overlays a nested {@link Slider.Thumb} so native drag spans its full length.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the track's markup.\n * @example\n * <Slider.Track>\n * \t<Slider.Thumb />\n * </Slider.Track>\n */\nSlider.Track = function SliderTrack(handle: Handle<Slider.TrackProps>) {\n\treturn () => {\n\t\tlet { mix, style, ...rest } = handle.props;\n\t\tlet context = handle.context.get(Slider);\n\t\tlet fillPercent = resolveFillPercent(context.min, context.max, context.value);\n\t\tlet resolvedStyle = mergeStyle(style, { \"--ui-slider-fill\": `${fillPercent}%` });\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tstyle={resolvedStyle}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\twhen('[data-orientation=\"horizontal\"] &', [\n\t\t\t\t\t\t\tis(\"100%\"),\n\t\t\t\t\t\t\tbs(\"var(--ui-slider-thumb-size, 1.25rem)\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-slot=\"slider\"][data-orientation=\"vertical\"] &', [\n\t\t\t\t\t\t\tis(\"var(--ui-slider-thumb-size, 1.25rem)\"),\n\t\t\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tbefore([absolute(), rounded(\"full\"), bg(\"neutral.border\"), pseudoContent('\"\"')]),\n\t\t\t\t\t\tafter([absolute(), rounded(\"full\"), bg(\"brand.solid\"), pseudoContent('\"\"')]),\n\t\t\t\t\t\twhen('[data-slot=\"slider\"][data-orientation=\"vertical\"] &', [\n\t\t\t\t\t\t\tgrow(),\n\t\t\t\t\t\t\tshrink(1),\n\t\t\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-orientation=\"horizontal\"] &::before', [\n\t\t\t\t\t\t\tbs(\"var(--ui-slider-track-thickness, 0.5rem)\"),\n\t\t\t\t\t\t\tinsIs(\"0\"),\n\t\t\t\t\t\t\tinsIe(\"0\"),\n\t\t\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\t\t\ttranslateY(\"-50%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-orientation=\"horizontal\"] &::after', [\n\t\t\t\t\t\t\tbs(\"var(--ui-slider-track-thickness, 0.5rem)\"),\n\t\t\t\t\t\t\tis(\"var(--ui-slider-fill, 0%)\"),\n\t\t\t\t\t\t\tinsIs(\"0\"),\n\t\t\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\t\t\ttranslateY(\"-50%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-slot=\"slider\"][data-orientation=\"vertical\"] &::before', [\n\t\t\t\t\t\t\tis(\"var(--ui-slider-track-thickness, 0.5rem)\"),\n\t\t\t\t\t\t\tbs(\"100%\"),\n\t\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\t\ttranslateX(\"-50%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-slot=\"slider\"][data-orientation=\"vertical\"] &::after', [\n\t\t\t\t\t\t\tis(\"var(--ui-slider-track-thickness, 0.5rem)\"),\n\t\t\t\t\t\t\tbs(\"var(--ui-slider-fill, 0%)\"),\n\t\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\t\ttranslateX(\"-50%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the interactive thumb: a native `<input type=\"range\">` reset to\n * cover {@link Slider.Track}'s full box so native drag and keyboard control\n * span its whole length, rotating with `writing-mode` when vertical.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the thumb's markup.\n * @example\n * <Slider.Thumb aria-label={t(\"settings.volume\")} />\n * @example\n * <Slider.Thumb aria-label={t(\"settings.brightness\")} disabled />\n */\nSlider.Thumb = function SliderThumb(handle: Handle<Slider.ThumbProps>) {\n\treturn () => {\n\t\tlet { id, min, max, step, value, defaultValue, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(Slider);\n\t\tlet resolvedStep = step ?? DEFAULT_STEP;\n\t\tlet resolvedValue = value ?? defaultValue ?? context.value;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\n\t\t\t\ttype=\"range\"\n\t\t\t\tid={id ?? context.thumbId}\n\t\t\t\tmin={min ?? context.min}\n\t\t\t\tmax={max ?? context.max}\n\t\t\t\tstep={resolvedStep}\n\t\t\t\tdefaultValue={resolvedValue}\n\t\t\t\taria-orientation={context.orientation === \"vertical\" ? \"vertical\" : undefined}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trangeThumbAppearance(\"--ui-slider-thumb-size\", \"--ui-slider-thumb-border-width\"),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinset(\"0\"),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The native input reaches past the track across its thin axis to a full pointer\n\t\t\t\t\t\t * target, centred so the thumb stays on the visible rail. Its block axis is that\n\t\t\t\t\t\t * thin axis in both orientations, since a vertical input runs `vertical-lr`.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tinsBs(THUMB_HIT_INSET),\n\t\t\t\t\t\tinsBe(THUMB_HIT_INSET),\n\t\t\t\t\t\tz(10),\n\t\t\t\t\t\tm(\"0\"),\n\t\t\t\t\t\tappearance(),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\twhen(\"&:disabled\", cursor(\"not-allowed\")),\n\t\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\t\twhen(\"&::-webkit-slider-runnable-track\", [appearance(), bs(\"100%\"), bg(\"transparent\")]),\n\t\t\t\t\t\twhen(\"&::-moz-range-track\", [\n\t\t\t\t\t\t\tappearance(),\n\t\t\t\t\t\t\tbs(\"100%\"),\n\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\tborder({ style: \"none\" }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'[data-slot=\"slider\"][data-orientation=\"vertical\"] &',\n\t\t\t\t\t\t\traw({ writingMode: \"vertical-lr\", direction: \"rtl\" }),\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a live readout: a native `<output>` associated by default with\n * the nearest ancestor {@link Slider}'s thumb via `htmlFor`, so assistive\n * technology knows which control it reports on. Pass the value as `children`.\n *\n * @param handle Runtime handle carrying the host `<output>`'s props.\n * @returns The render function producing the readout's markup.\n * @example\n * <Slider.Output>{new Intl.NumberFormat(locale, { style: \"percent\" }).format(0.4)}</Slider.Output>\n */\nSlider.Output = function SliderOutput(handle: Handle<Slider.OutputProps>) {\n\treturn () => {\n\t\tlet { htmlFor, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(Slider);\n\n\t\treturn (\n\t\t\t<output\n\t\t\t\t{...rest}\n\t\t\t\thtmlFor={htmlFor ?? context.thumbId}\n\t\t\t\tmix={mergeMix([outputCaptionText(), tabularNums()], mix)}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
|
|
10
|
+
"content": "/**\n * A single-value range control built on a native `<input type=\"range\">`,\n * paired with a track that draws its own background rail and a live fill\n * bar, plus an `<output>` for reporting the current value. The root shares\n * the resolved range and value with every part through component context,\n * so a track's fill bar and a thumb's native attributes always agree\n * without a consumer repeating the same numbers twice.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport {\n\tabsolute,\n\tafter,\n\tappearance,\n\tbasis,\n\tbefore,\n\tbg,\n\tborder,\n\tbs,\n\tcursor,\n\tgrow,\n\tinsBe,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\tinset,\n\tis,\n\titems,\n\tm,\n\tminBs,\n\tminIs,\n\toutlineStyle,\n\tpseudoContent,\n\traw,\n\trelative,\n\trounded,\n\tshrink,\n\ttabularNums,\n\ttranslateX,\n\ttranslateY,\n\tvstack,\n\twhen,\n\tz,\n} from \"@sdxc/u\";\nimport { mergeMix } from \"@sdxc/u/general\";\n\nimport { outputCaptionText } from \"@sdxc/ui/styles\";\nimport { rangeThumbAppearance } from \"@sdxc/ui/styles\";\nimport { mergeStyle } from \"@sdxc/ui/utils\";\nimport { resolveFillPercent } from \"@sdxc/ui/utils\";\n\n/** Default {@link Slider.Props} orientation, applied when `orientation` is omitted. */\nconst DEFAULT_ORIENTATION: Slider.Orientation = \"horizontal\";\n\n/** Default {@link Slider.Props} lower bound, applied when `min` is omitted. */\nconst DEFAULT_MIN = 0;\n\n/** Default {@link Slider.Props} upper bound, applied when `max` is omitted. */\nconst DEFAULT_MAX = 100;\n\n/** Default {@link Slider.ThumbProps} step, applied when `step` is omitted. */\nconst DEFAULT_STEP = 1;\n\n/**\n * Negative inset growing {@link Slider.Thumb}'s native input across the track's thin\n * axis to the larger of the thumb and `--ui-target-size`, clamped at zero so a track\n * already that thick keeps its own box.\n */\nconst THUMB_HIT_INSET =\n\t\"min(0px, calc((100% - max(var(--ui-slider-thumb-size, 1.25rem), var(--ui-target-size, 1.5rem))) / 2))\";\n\n/**\n * How far WebKit's thumb moves down its input to sit on the rail's centre line: WebKit draws it at\n * the start of an input that {@link THUMB_HIT_INSET} grew past the thumb, so it takes half the\n * growth as margin. Firefox centres its thumb on its own.\n */\nconst THUMB_CENTER_OFFSET =\n\t\"calc((max(var(--ui-slider-thumb-size, 1.25rem), var(--ui-target-size, 1.5rem)) - var(--ui-slider-thumb-size, 1.25rem)) / 2)\";\n\n/**\n * Prop types for {@link Slider} and its compound parts.\n */\nexport namespace Slider {\n\t/**\n\t * Axis the track's fill bar and thumb travel along: a full-width row, or\n\t * a full-height column.\n\t */\n\texport type Orientation = \"horizontal\" | \"vertical\";\n\n\t/**\n\t * Value {@link Slider} shares through component context so every nested\n\t * {@link Slider.Track}, {@link Slider.Thumb}, and {@link Slider.Output}\n\t * reads the same resolved range, value, orientation, and thumb id.\n\t */\n\texport interface Context {\n\t\t/** Resolved lower bound of the range, shared with {@link Slider.Thumb}. */\n\t\tmin: number;\n\t\t/** Resolved upper bound of the range, shared with {@link Slider.Thumb}. */\n\t\tmax: number;\n\t\t/** Resolved current value, used to compute {@link Slider.Track}'s fill bar and default {@link Slider.Thumb}'s own value. */\n\t\tvalue: number;\n\t\t/** Layout axis, read by {@link Slider.Thumb} to set its accessible orientation. */\n\t\torientation: Orientation;\n\t\t/**\n\t\t * Id shared by {@link Slider.Thumb} (as its own `id`) and\n\t\t * {@link Slider.Output} (as its `htmlFor`) so the two associate\n\t\t * natively without either needing an explicit id from the consumer.\n\t\t */\n\t\tthumbId: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link Slider}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Layout axis. Defaults to {@link DEFAULT_ORIENTATION}. */\n\t\torientation?: Orientation;\n\t\t/** Lower bound of the range. Defaults to {@link DEFAULT_MIN}. */\n\t\tmin?: number;\n\t\t/** Upper bound of the range. Defaults to {@link DEFAULT_MAX}. */\n\t\tmax?: number;\n\t\t/** Current value, for a slider whose value the consumer tracks itself. */\n\t\tvalue?: number;\n\t\t/** Starting value, for a slider that never tracks its own value. */\n\t\tdefaultValue?: number;\n\t}\n\n\t/**\n\t * Props accepted by {@link Slider.Track}.\n\t */\n\texport interface TrackProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<input>` attribute except `type` and `role`, fixed to\n\t * `\"range\"` and the platform's implicit `\"slider\"` role. `min`/`max`/`step`\n\t * override the range inherited from the nearest ancestor {@link Slider}.\n\t */\n\texport interface ThumbProps extends Omit<TagProps<\"input\">, \"type\" | \"role\"> {}\n\n\t/**\n\t * Props accepted by {@link Slider.Output}.\n\t */\n\texport interface OutputProps extends TagProps<\"output\"> {}\n}\n\n/**\n * Renders the root `<div>`, stacking its children and resolving range, value, orientation\n * and thumb id into context. Nested parts scope orientation rules to its `data-slot`, so an\n * ancestor carrying `data-orientation` (a toolbar, a scroll viewport) leaves its layout alone.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link Slider.Context}.\n * @returns The render function producing the root's markup.\n * @example\n * <Slider aria-label={t(\"settings.volume\")} min={0} max={100} defaultValue={40}>\n * \t<Slider.Output />\n * \t<Slider.Track>\n * \t\t<Slider.Thumb />\n * \t</Slider.Track>\n * </Slider>\n * @example\n * <Slider orientation=\"vertical\" min={0} max={10} defaultValue={6}>\n * \t<Slider.Track>\n * \t\t<Slider.Thumb aria-label={t(\"equalizer.band\", { hz: 250 })} />\n * \t</Slider.Track>\n * </Slider>\n */\nexport function Slider(handle: Handle<Slider.Props, Slider.Context>) {\n\treturn () => {\n\t\tlet { orientation, min, max, value, defaultValue, mix, ...rest } = handle.props;\n\t\tlet resolvedOrientation = orientation ?? DEFAULT_ORIENTATION;\n\t\tlet resolvedMin = min ?? DEFAULT_MIN;\n\t\tlet resolvedMax = max ?? DEFAULT_MAX;\n\t\tlet resolvedValue = value ?? defaultValue ?? resolvedMin;\n\n\t\thandle.context.set({\n\t\t\tmin: resolvedMin,\n\t\t\tmax: resolvedMax,\n\t\t\tvalue: resolvedValue,\n\t\t\torientation: resolvedOrientation,\n\t\t\tthumbId: handle.id,\n\t\t});\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"slider\"\n\t\t\t\tdata-orientation={resolvedOrientation}\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tvstack({ gap: \"0.5rem\" }),\n\t\t\t\t\t\twhen('&[data-orientation=\"horizontal\"]', [is(\"100%\"), minIs(\"10rem\")]),\n\t\t\t\t\t\twhen('&[data-orientation=\"vertical\"]', [bs(\"10rem\"), items(\"center\")]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n\n/**\n * Renders the visual track: a `position: relative` `<div>` that draws a rail\n * and fill bar as pseudo-elements sized from context's resolved value, and\n * overlays a nested {@link Slider.Thumb} so native drag spans its full length.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the track's markup.\n * @example\n * <Slider.Track>\n * \t<Slider.Thumb />\n * </Slider.Track>\n */\nSlider.Track = function SliderTrack(handle: Handle<Slider.TrackProps>) {\n\treturn () => {\n\t\tlet { mix, style, ...rest } = handle.props;\n\t\tlet context = handle.context.get(Slider);\n\t\tlet fillPercent = resolveFillPercent(context.min, context.max, context.value);\n\t\tlet resolvedStyle = mergeStyle(style, { \"--ui-slider-fill\": `${fillPercent}%` });\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tstyle={resolvedStyle}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\twhen('[data-orientation=\"horizontal\"] &', [\n\t\t\t\t\t\t\tis(\"100%\"),\n\t\t\t\t\t\t\tbs(\"var(--ui-slider-thumb-size, 1.25rem)\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-slot=\"slider\"][data-orientation=\"vertical\"] &', [\n\t\t\t\t\t\t\tis(\"var(--ui-slider-thumb-size, 1.25rem)\"),\n\t\t\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tbefore([absolute(), rounded(\"full\"), bg(\"neutral.border\"), pseudoContent('\"\"')]),\n\t\t\t\t\t\tafter([absolute(), rounded(\"full\"), bg(\"brand.solid\"), pseudoContent('\"\"')]),\n\t\t\t\t\t\twhen('[data-slot=\"slider\"][data-orientation=\"vertical\"] &', [\n\t\t\t\t\t\t\tgrow(),\n\t\t\t\t\t\t\tshrink(1),\n\t\t\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-orientation=\"horizontal\"] &::before', [\n\t\t\t\t\t\t\tbs(\"var(--ui-slider-track-thickness, 0.5rem)\"),\n\t\t\t\t\t\t\tinsIs(\"0\"),\n\t\t\t\t\t\t\tinsIe(\"0\"),\n\t\t\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\t\t\ttranslateY(\"-50%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-orientation=\"horizontal\"] &::after', [\n\t\t\t\t\t\t\tbs(\"var(--ui-slider-track-thickness, 0.5rem)\"),\n\t\t\t\t\t\t\tis(\"var(--ui-slider-fill, 0%)\"),\n\t\t\t\t\t\t\tinsIs(\"0\"),\n\t\t\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\t\t\ttranslateY(\"-50%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-slot=\"slider\"][data-orientation=\"vertical\"] &::before', [\n\t\t\t\t\t\t\tis(\"var(--ui-slider-track-thickness, 0.5rem)\"),\n\t\t\t\t\t\t\tbs(\"100%\"),\n\t\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\t\ttranslateX(\"-50%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-slot=\"slider\"][data-orientation=\"vertical\"] &::after', [\n\t\t\t\t\t\t\tis(\"var(--ui-slider-track-thickness, 0.5rem)\"),\n\t\t\t\t\t\t\tbs(\"var(--ui-slider-fill, 0%)\"),\n\t\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\t\ttranslateX(\"-50%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the interactive thumb: a native `<input type=\"range\">` reset to\n * cover {@link Slider.Track}'s full box so native drag and keyboard control\n * span its whole length, rotating with `writing-mode` when vertical.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the thumb's markup.\n * @example\n * <Slider.Thumb aria-label={t(\"settings.volume\")} />\n * @example\n * <Slider.Thumb aria-label={t(\"settings.brightness\")} disabled />\n */\nSlider.Thumb = function SliderThumb(handle: Handle<Slider.ThumbProps>) {\n\treturn () => {\n\t\tlet { id, min, max, step, value, defaultValue, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(Slider);\n\t\tlet resolvedStep = step ?? DEFAULT_STEP;\n\t\tlet resolvedValue = value ?? defaultValue ?? context.value;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\n\t\t\t\ttype=\"range\"\n\t\t\t\tid={id ?? context.thumbId}\n\t\t\t\tmin={min ?? context.min}\n\t\t\t\tmax={max ?? context.max}\n\t\t\t\tstep={resolvedStep}\n\t\t\t\tdefaultValue={resolvedValue}\n\t\t\t\taria-orientation={context.orientation === \"vertical\" ? \"vertical\" : undefined}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trangeThumbAppearance(\"--ui-slider-thumb-size\", \"--ui-slider-thumb-border-width\"),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinset(\"0\"),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The native input reaches past the track across its thin axis to a full pointer\n\t\t\t\t\t\t * target, centred so the thumb stays on the visible rail. Its block axis is that\n\t\t\t\t\t\t * thin axis in both orientations, since a vertical input runs `vertical-lr`.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tinsBs(THUMB_HIT_INSET),\n\t\t\t\t\t\tinsBe(THUMB_HIT_INSET),\n\t\t\t\t\t\tz(10),\n\t\t\t\t\t\tm(\"0\"),\n\t\t\t\t\t\tappearance(),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\t\twhen(\"&:disabled\", cursor(\"not-allowed\")),\n\t\t\t\t\t\toutlineStyle(\"none\"),\n\t\t\t\t\t\twhen(\"&::-webkit-slider-runnable-track\", [appearance(), bs(\"100%\"), bg(\"transparent\")]),\n\t\t\t\t\t\twhen(\"&::-webkit-slider-thumb\", raw({ marginBlockStart: THUMB_CENTER_OFFSET })),\n\t\t\t\t\t\twhen(\"&::-moz-range-track\", [\n\t\t\t\t\t\t\tappearance(),\n\t\t\t\t\t\t\tbs(\"100%\"),\n\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\tborder({ style: \"none\" }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'[data-slot=\"slider\"][data-orientation=\"vertical\"] &',\n\t\t\t\t\t\t\traw({ writingMode: \"vertical-lr\", direction: \"rtl\" }),\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a live readout: a native `<output>` associated by default with\n * the nearest ancestor {@link Slider}'s thumb via `htmlFor`, so assistive\n * technology knows which control it reports on. Pass the value as `children`.\n *\n * @param handle Runtime handle carrying the host `<output>`'s props.\n * @returns The render function producing the readout's markup.\n * @example\n * <Slider.Output>{new Intl.NumberFormat(locale, { style: \"percent\" }).format(0.4)}</Slider.Output>\n */\nSlider.Output = function SliderOutput(handle: Handle<Slider.OutputProps>) {\n\treturn () => {\n\t\tlet { htmlFor, mix, ...rest } = handle.props;\n\t\tlet context = handle.context.get(Slider);\n\n\t\treturn (\n\t\t\t<output\n\t\t\t\t{...rest}\n\t\t\t\thtmlFor={htmlFor ?? context.thumbId}\n\t\t\t\tmix={mergeMix([outputCaptionText(), tabularNums()], mix)}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
|
|
11
11
|
},
|
|
12
12
|
"test": {
|
|
13
13
|
"path": "slider.test.tsx",
|