diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index bb39f058..82afecf6 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,8 +1,9 @@
name: Release
-# Fully automatic releases. Successful CI on a master push starts this workflow;
-# if the commits since the last published version warrant a release, it bumps
-# the version, publishes to npm and tags it. No version-bump PR, no manual step.
+# Successful CI on a master push starts this workflow automatically. An
+# owner-authorized local-QA run can also be dispatched for the exact current
+# master SHA. If the commits since the last published version warrant a release,
+# it bumps the version, publishes to npm and tags it. No version-bump PR.
#
# The version comes from conventional commits (scripts/next-version.ts):
# type! / BREAKING CHANGE -> major, feat -> minor, fix|perf|revert -> patch.
@@ -23,6 +24,12 @@ on:
workflow_run:
workflows: [CI]
types: [completed]
+ workflow_dispatch:
+ inputs:
+ master_sha:
+ description: Full current master SHA after the owner-authorized local QA gate
+ required: true
+ type: string
permissions:
contents: read
@@ -30,10 +37,20 @@ permissions:
jobs:
decide:
if: >-
- github.event.workflow_run.conclusion == 'success' &&
- github.event.workflow_run.event == 'push' &&
- github.event.workflow_run.head_branch == 'master'
+ (
+ github.event_name == 'workflow_run' &&
+ github.event.workflow_run.conclusion == 'success' &&
+ github.event.workflow_run.event == 'push' &&
+ github.event.workflow_run.head_branch == 'master'
+ ) ||
+ (
+ github.event_name == 'workflow_dispatch' &&
+ github.ref == 'refs/heads/master' &&
+ inputs.master_sha == github.sha
+ )
runs-on: ubicloud-standard-2
+ env:
+ TARGET_SHA: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || inputs.master_sha }}
outputs:
mode: ${{ steps.decide.outputs.mode }}
version: ${{ steps.decide.outputs.version }}
@@ -41,13 +58,21 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # next-version.ts reads commit history
- ref: ${{ github.event.workflow_run.head_sha }}
+ ref: ${{ env.TARGET_SHA }}
- - name: Require the tested revision to remain master
+ - name: Require the exact selected revision to remain master before running it
run: |
+ if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then
+ test "$GITHUB_REF" = "refs/heads/master"
+ test "$TARGET_SHA" = "$GITHUB_SHA"
+ fi
+ if [[ ! "$TARGET_SHA" =~ ^[0-9a-f]{40}$ ]]; then
+ echo "TARGET_SHA must be a full lowercase 40-character commit SHA" >&2
+ exit 1
+ fi
git fetch origin master
- test "$(git rev-parse HEAD)" = "${{ github.event.workflow_run.head_sha }}"
- test "$(git rev-parse origin/master)" = "${{ github.event.workflow_run.head_sha }}"
+ test "$(git rev-parse HEAD)" = "$TARGET_SHA"
+ test "$(git rev-parse origin/master)" = "$TARGET_SHA"
- uses: oven-sh/setup-bun@v1
with:
@@ -86,16 +111,18 @@ jobs:
release_sha: ${{ steps.release-sha.outputs.value }}
env:
VERSION: ${{ needs.decide.outputs.version }}
+ TARGET_SHA: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || inputs.master_sha }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- ref: ${{ github.event.workflow_run.head_sha }}
+ ref: ${{ env.TARGET_SHA }}
- - name: Require the tested revision to remain master
+ - name: Require the selected revision to remain master before release preparation
run: |
git fetch origin master
- test "$(git rev-parse HEAD)" = "$(git rev-parse origin/master)"
+ test "$(git rev-parse HEAD)" = "$TARGET_SHA"
+ test "$(git rev-parse origin/master)" = "$TARGET_SHA"
# Mirrors ci.yml — the build resolves this plugin from a sibling directory.
- name: Checkout rsbuild-plugin-ui-css-purge
diff --git a/AGENTS.md b/AGENTS.md
index ed518705..677720e4 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -17,18 +17,19 @@ natively, and Claude Code loads it through the `@AGENTS.md` import in
implementation files.** It is the frontend working agreement: SolidJS/`@pathscale/ui`
conventions, and a context-efficient workflow. Reading it first keeps
context small and avoids re-deriving patterns that already exist.
-- **Releases are automatic — never run `npm publish` by hand.** A successful CI run for
- `master` starts [`.github/workflows/release.yml`](.github/workflows/release.yml) at the
- exact revision CI tested. The workflow stops if `master` advances before release,
- derives the version from conventional commits, bumps `package.json`, publishes through
- npm Trusted Publishing (OIDC), and tags the published revision. There is no `NPM_TOKEN`
- in this repository, so a local publish cannot authenticate anyway, and a hand-written
- version bump only fights the workflow. Publishing is irreversible and a version can
- never be reused, so if a release looks wrong, read the workflow run before touching
- anything.
-- **After a merge, confirm the fix actually published.** The release is gated by CI and
- fails closed when another merge advances `master`. Confirm the npm version and tag both
- point at the expected release revision:
+- **Releases use the guarded workflow — never run `npm publish` by hand.** A successful
+ CI run for `master` starts the automatic path at the exact revision CI tested. An
+ authorized `workflow_dispatch` may use the local-QA path only with the explicitly
+ supplied full SHA that is still the exact `master` head. When a release is warranted,
+ both paths reuse the release preparation checks, publish through npm Trusted Publishing
+ (OIDC), and tag the published revision. There is no `NPM_TOKEN` in this repository, so a local publish
+ cannot authenticate anyway, and a hand-written version bump only fights the workflow.
+ Publishing is irreversible and a version can never be reused, so if a release looks
+ wrong, read the workflow run before touching anything.
+- **After a merge, confirm the fix actually published.** The automatic release is gated
+ by successful master CI; the manual path is only for an explicitly authorized local-QA
+ release at the exact current `master` SHA. Either path fails closed when `master`
+ advances. Confirm the npm version and tag both point at the expected release revision:
So check, every time:
@@ -38,8 +39,9 @@ natively, and Claude Code loads it through the `@AGENTS.md` import in
git tag --points-at HEAD # a tag here with no npm release is the hole
```
- If master is ahead of npm, inspect the CI and Release runs. Fix or re-run the failed
- workflow rather than manufacturing another version bump.
+ If master is ahead of npm, inspect the CI and Release runs. Retry the automatic path
+ when master CI succeeds; use the manual path only after authorized local QA, supplying
+ the exact current `master` SHA. Never manufacture an extra version bump.
- **One open PR per repository. Add to it.** If a PR is already open here, push your
commits onto that branch instead of opening a second one. Two open PRs against the
same library mean two releases, two version bumps, and a consumer that has to wait for
diff --git a/README.md b/README.md
index 15116c33..4a7bd42d 100644
--- a/README.md
+++ b/README.md
@@ -95,7 +95,7 @@ work against them directly.
| family | components |
|---|---|
-| **Layout** | Flex, Grid, Join, Surface, Card, GlassPanel, Separator, ScrollShadow, Skeleton, EmptyState, Footer, Header, Navbar, Toolbar, FloatingDock |
+| **Layout** | Flex, Grid, Join, Card, Separator, ScrollArea, ScrollHorizontal, Skeleton, Empty, Footer, Header, Navbar, Toolbar, Dock |
| **Typography & misc** | Text, Link, Kbd, Badge, Chip, Tag, TagGroup, Avatar, Icon, Tooltip, Breadcrumbs, Pagination, Meter, ProgressBar, ProgressCircle, Spinner |
| **Inputs** | Input, InputGroup, InputOTP, TextField, TextArea, NumberField, SearchField, PasswordField, ColorField, Checkbox, CheckboxGroup, Radio, RadioGroup, Toggle, Slider, Select, ComboBox, ListBox, SizePicker |
| **Forms** | Form, Fieldset, Label, Description, ErrorMessage, FieldError, PasswordRequirements |
@@ -175,6 +175,13 @@ import — the published size is the whole library, not what ships to your users
| **[Contributing](https://github.com/pathscale/ui/blob/master/CONTRIBUTING.md)** | local setup, component checklist, proposal template |
| **[Releasing](https://github.com/pathscale/ui/blob/master/docs/releasing.md)** | how a push to master becomes an npm version, and the gates it passes |
+## Honey password validation
+
+`@pathscale/ui/passwordRules` exports `isPrintableAsciiPassword` and
+`PASSWORD_CHARSET_MESSAGE` for inline signup and password-change validation.
+Printable ASCII (U+0020–U+007E), including spaces, is accepted without normalization.
+Do not apply this restriction to sign-in or reauthentication.
+
## License
MIT
diff --git a/docs/api-contract.md b/docs/api-contract.md
index ed5b43f9..de28649a 100644
--- a/docs/api-contract.md
+++ b/docs/api-contract.md
@@ -11,7 +11,7 @@ invisible for a day behind a doc that looked correct the whole time.
When an API change is intentional, run `bun run check:api -- --write`, read the
diff, and commit it. The diff is the review.
-187 components. An empty list means the component adds nothing beyond
+188 components. An empty list means the component adds nothing beyond
HTML attributes and `UIBaseProps`; that is an assertion, not a gap.
---
@@ -1506,6 +1506,15 @@ state?: State
value?: number
```
+### QrCode
+
+```ts
+level?: QrErrorCorrectionLevel
+size?: number | string
+title: string
+value: string
+```
+
### PWAInstallPrompt
```ts
@@ -1594,6 +1603,16 @@ variant?: ScrollAreaVariant
visibility?: ScrollAreaVisibility
```
+### ScrollHorizontal
+
+```ts
+gap?: number
+height?: number | string
+itemWidth?: number
+mobileGap?: number
+mobileItemWidth?: number
+```
+
### Select
```ts
diff --git a/docs/ui-usage.md b/docs/ui-usage.md
index e32f08c9..7a75e9e5 100644
--- a/docs/ui-usage.md
+++ b/docs/ui-usage.md
@@ -4,7 +4,7 @@
agents alike, and for every consuming application. Those apps link here rather than
keeping their own copy — one library, one set of conventions, no drift.
-SolidJS component library, HeroUI-parity API, daisyUI-style theming. 101 public
+SolidJS component library, HeroUI-parity API, daisyUI-style theming. 103 public
component families.
This file is **how to USE the library** (as a consumer, or when writing demos and
@@ -308,16 +308,67 @@ A trigger given plain text is unchanged and needs nothing.
## Component inventory (by family)
-- **Layout/primitives**: Flex, Grid, Join, Card, Separator, ScrollArea, Skeleton, Empty, Footer, Header, Navbar, Toolbar, Dock
+- **Layout/primitives**: Flex, Grid, Join, Card, Separator, ScrollArea, ScrollHorizontal, Skeleton, Empty, Footer, Header, Navbar, Toolbar, Dock
- **Typography/misc**: Text, Link, Kbd, Badge, Chip, Tag/TagGroup, Avatar, Icon, Tooltip, Breadcrumb, Pagination, Meter, Progress, RadialProgress, Spinner (alias: Loading)
- **Inputs**: Input, InputGroup, InputOTP, TextField, Textarea, NumberField, SearchField, PasswordField (+ password-requirements/rules, `passwordRules.ts`), ColorField, Checkbox(+Group), Radio(+Group), Switch, Slider, Select, ComboBox, ListBox, SizePicker, Form pieces (Label, Description, ErrorMessage, FieldError, Fieldset)
+
+For Honey signup and password changes, import `isPrintableAsciiPassword` and
+`PASSWORD_CHARSET_MESSAGE` from `@pathscale/ui/passwordRules`. The validator allows
+only U+0020 through U+007E, preserves spaces, and leaves length and confirmation to
+the form's existing rules. Show the message inline when validation fails. Never use
+this validator for sign-in or reauthentication: existing passwords remain accepted.
- **Dates**: Calendar, RangeCalendar, DatePicker, DateRangePicker (internal date engine); DateField, TimeField (separate segmented editors)
- **Color**: ColorPicker, ColorArea, ColorSlider, ColorSwatch(+Picker), ColorWheel, ComplexColorWheel, ColorWheelFlower, ThemeColorPicker
- **Overlays**: Dialog, Drawer, Popover, Dropdown, Menu, Toast, Collapsible(+Group), Accordion
- **Data**: DataGrid (assembled, `createDataGrid` model), FlexGrid (incremental reveal, `createFlexGrid` model), Table (headless compound, bring your own model), plus primitives `useStreamingBuffer`, `useStreamingSubscription`
- **Auth kit**: AuthForm, AuthCard, AuthFieldGroup, AuthSubmitButton, AuthFooterLinks, AuthPoweredBy, AuthErrorMessage, AuthSuccessMessage — Layouts composing Button/Card/fields. Their spacing, alignment and tone are recipe parameters (`gap`, `align`, `variant`), so a consumer asks for the presentation it wants rather than restating utility classes. AuthCard exposes `header`, `headings`, `title`, `description`, `branding`, `body` and `footer` as `data-slot` targets.
- **Connection settings**: ConnectionSettings (the panel) with `createConnectionSettings` (the store). See below.
-- **Visual FX**: MetalBorder (WebGL liquid-metal border; presets `chromatic|silver|gold`, `kind="pill"|"circle"`, `glow`, `strength` 0-100, `theme="dark"|"light"|"auto"`), GlowCard (mouse-tracking glow), NoiseBackground (animated gradient blobs), ImmersiveLanding (full mini-app w/ PWA widgets), VideoPreview, LiveChat, ChatBubble, LanguageSwitcher
+- **Visual FX**: MetalBorder (WebGL liquid-metal border; presets `chromatic|silver|gold`, `kind="pill"|"circle"`, `glow`, `strength` 0-100, `theme="dark"|"light"|"auto"`), GlowCard (mouse-tracking glow), NoiseBackground (animated gradient blobs), QrCode, ImmersiveLanding (full mini-app w/ PWA widgets), VideoPreview, LiveChat, ChatBubble, LanguageSwitcher
+
+## ScrollHorizontal
+
+Use `ScrollHorizontal` for a gallery whose cards move horizontally as the page
+scrolls vertically. Intro and outro sections remain regular consumer content.
+Children can be existing Layouts such as `Card`:
+
+```tsx
+import { Card, ScrollHorizontal } from "@pathscale/ui";
+
+
+
Stories
+
Introductory copy stays outside the gallery.
+
+
+
+ First story
+ Second story
+ Third story
+
+
+Outro content follows the gallery.
+```
+
+`itemWidth` and `mobileItemWidth` set card widths; `gap` and `mobileGap` set
+spacing. Defaults are 400px and 280px for widths, and 30px and 15px for gaps.
+The default `height="auto"` measures the row and creates enough vertical travel
+to reach the last card. Pass a number for a pixel height or a CSS length string
+to choose a different section height.
+
+The gallery exposes a labelled `region` with a keyboard-focusable horizontal
+viewport. Supply `aria-label` or `aria-labelledby` with a useful name. Focus
+entering an offscreen card moves the page to reveal it without changing DOM or
+focus order. Reduced motion disables sticky translation and leaves a normal
+horizontal scroller. After hydration, supported browsers use a CSS view timeline;
+other browsers use a passive scroll listener with frame-scheduled progress.
+The component also accepts `class`, `style` and `dataTheme` props. `ScrollArea`
+remains the component for an ordinary scrollable region.
Renames from old versions: Loading→Spinner, DropdownSelect→Select, RangeSlider→Slider, Callout→Alert, EmptyState→Empty, Toggle→Switch, Modal→Dialog, TextArea→Textarea, Disclosure→Collapsible, FloatingDock→Dock, ProgressBar→Progress, ProgressCircle→RadialProgress, ScrollShadow→ScrollArea, Breadcrumbs→Breadcrumb. ~40 components removed outright (Carousel, Rating, Steps, Stats, FileInput, …).
@@ -588,6 +639,48 @@ enablePopmotion((opts) => animate({ ...opts })); // ⚠️ WITHOUT this, all J
- Solid components: `{(isExiting, onExitComplete) => …` — Presence force-unmounts after 800ms if `onExitComplete` never fires. `` for height collapse.
- `resolvePreset(name, {reduceMotion})` returns the `noMotion` preset under prefers-reduced-motion. Note Dialog/Toast/Drawer animate via CSS, not this system.
+The root barrel and `@pathscale/ui/motion` subpath also export small browser
+motion helpers:
+
+```tsx
+import {
+ animateElement,
+ createInView,
+ createScrollProgress,
+ springKeyframes,
+ stagger,
+} from "@pathscale/ui/motion";
+
+const visible = createInView(() => observedElement, { once: true });
+const progress = createScrollProgress(() => section, {
+ range: "start-start/end-end",
+});
+const delay = stagger(index, 50); // milliseconds
+
+const samples = springKeyframes({ stiffness: 180, damping: 20, mass: 1 });
+const animation = animateElement(element, { opacity: samples }, {
+ duration: ((samples.length - 1) / 60) * 1000,
+});
+```
+
+`createInView` and `createScrollProgress` return Solid accessors and attach
+browser listeners only after mount. Visibility starts as `true` if the observer
+is unavailable. Scroll progress starts at zero, samples scroll updates at most
+once per animation frame, and also writes `--scroll-progress` to its target for
+CSS. Its supported range tracks the target from viewport top to its bottom at
+viewport bottom; the target's previous inline custom property is restored on
+cleanup. `supportsViewTimeline()` checks the CSS timeline and attachment range
+used by `ScrollHorizontal`.
+
+`animateElement` uses WAAPI when available, defaults to the library's base
+duration and `motionEasings.out`, and applies the final keyframe immediately when
+WAAPI is unavailable. Its options follow WAAPI timing fields in milliseconds;
+the returned `finished` promise resolves on completion or cancellation, and
+`cancel()` stops the animation. Live reduced-motion changes finish an active
+animation by default. `springKeyframes` returns normalized 60 Hz samples for a
+WAAPI property; use `(samples.length - 1) / 60 * 1000` milliseconds as the
+duration to preserve that sample rate.
+
## Streaming
```ts
@@ -639,6 +732,22 @@ token, with `@plugin "@iconify/tailwind4"` under Tailwind v4 or
than ours. Both sources inherit colour through `currentColor`, so `flavor` works
the same either way.
+## QR codes
+
+`QrCode` encodes `value` into one inline SVG. Its required `title` is both the
+SVG title and its accessible name. Encoding is synchronous, so a changed value
+updates the matrix immediately. `level` accepts `L`, `M`, `Q` or `H` and defaults
+to `M`; `size` accepts a number of CSS pixels or another CSS length.
+
+```tsx
+import { QrCode } from "@pathscale/ui";
+
+
+```
+
+For non-Solid use, `qrMatrix(value, level?)` returns the dark modules as a
+`boolean[][]`.
+
## Dates
Calendar/DatePicker/RangeCalendar/DateRangePicker use the internal engine (native `Date`, a built-in name table, no `Intl` and no date lib). Values are `Date` objects; ranges are `{start: Date, end: Date}`. Controlled via `value/defaultValue/onChange`. `DateField`/`TimeField` are separate segmented text editors, not calendar-backed.
diff --git a/layouts.library.json b/layouts.library.json
index f70bdbad..e94cbb5e 100644
--- a/layouts.library.json
+++ b/layouts.library.json
@@ -153,11 +153,13 @@
"PasswordRequirements",
"Popover",
"Progress",
+ "QrCode",
"RadialProgress",
"Radio",
"RadioGroup",
"RangeCalendar",
"ScrollArea",
+ "ScrollHorizontal",
"Select",
"Separator",
"SizePicker",
diff --git a/src/component-families.ts b/src/component-families.ts
index ab42bfa1..24c11d28 100644
--- a/src/component-families.ts
+++ b/src/component-families.ts
@@ -250,6 +250,10 @@ export const componentFamilies = [
"id": "progress",
"name": "Progress"
},
+ {
+ "id": "qr-code",
+ "name": "QrCode"
+ },
{
"id": "radio",
"name": "Radio"
@@ -258,6 +262,10 @@ export const componentFamilies = [
"id": "scroll-area",
"name": "ScrollArea"
},
+ {
+ "id": "scroll-horizontal",
+ "name": "ScrollHorizontal"
+ },
{
"id": "select",
"name": "Select"
diff --git a/src/components/qr-code/QrCode.css b/src/components/qr-code/QrCode.css
new file mode 100644
index 00000000..4c6c6a22
--- /dev/null
+++ b/src/components/qr-code/QrCode.css
@@ -0,0 +1,5 @@
+@layer components {
+ .qr-code {
+ display: block;
+ }
+}
diff --git a/src/components/qr-code/QrCode.layout.tsx b/src/components/qr-code/QrCode.layout.tsx
new file mode 100644
index 00000000..600a0577
--- /dev/null
+++ b/src/components/qr-code/QrCode.layout.tsx
@@ -0,0 +1,87 @@
+import "./QrCode.css";
+import type { JSX } from "@solidjs/web";
+import { createMemo } from "solid-js";
+import type { Layout } from "../../lib/layouts";
+import type { QrErrorCorrectionLevel } from "../../lib/qr/qrMatrix";
+import { qrMatrix } from "../../lib/qr/qrMatrix";
+import type { UIBaseProps } from "../vocabulary";
+import { componentRecipe } from "./QrCode.recipe";
+
+export type QrCodeProps = Omit<
+ JSX.SvgSVGAttributes,
+ | "aria-label"
+ | "aria-labelledby"
+ | "children"
+ | "height"
+ | "role"
+ | "title"
+ | "viewBox"
+ | "width"
+> &
+ UIBaseProps & {
+ /** The text encoded into the QR matrix. */
+ value: string;
+ /** Accessible name for the QR image. */
+ title: string;
+ /** Reed-Solomon error correction level. Defaults to M. */
+ level?: QrErrorCorrectionLevel;
+ /** Rendered square size in CSS pixels or another CSS length. */
+ size?: number | string;
+ };
+
+function matrixPath(matrix: boolean[][]): string {
+ const path: string[] = [];
+
+ for (let row = 0; row < matrix.length; row++) {
+ let column = 0;
+ while (column < matrix[row].length) {
+ if (!matrix[row][column]) {
+ column++;
+ continue;
+ }
+
+ const start = column;
+ while (column < matrix[row].length && matrix[row][column]) column++;
+ const x = start + 4;
+ const y = row + 4;
+ path.push(`M${x} ${y}h${column - start}v1h-${column - start}z`);
+ }
+ }
+
+ return path.join("");
+}
+
+const QrCodeLayout: Layout = () => {
+ const matrix = createMemo(() => qrMatrix(local.value, local.level ?? "M"));
+ const path = createMemo(() => matrixPath(matrix()));
+ const viewBox = () => {
+ const size = matrix().length + 8;
+ return `0 0 ${size} ${size}`;
+ };
+
+ return (
+
+ );
+};
+
+export default QrCodeLayout;
+export { QrCodeLayout as QrCode };
diff --git a/src/components/qr-code/QrCode.recipe.ts b/src/components/qr-code/QrCode.recipe.ts
new file mode 100644
index 00000000..24c750c6
--- /dev/null
+++ b/src/components/qr-code/QrCode.recipe.ts
@@ -0,0 +1,12 @@
+import { recipe } from "../../lib/layouts";
+
+export const componentRecipe = recipe({
+ component: "qr-code",
+ element: "svg",
+ slots: {
+ root: { base: "qr-code" },
+ modules: { base: "qr-code__modules" },
+ "qr-code": {},
+ "qr-code-modules": {},
+ },
+});
diff --git a/src/components/qr-code/index.ts b/src/components/qr-code/index.ts
new file mode 100644
index 00000000..910b2734
--- /dev/null
+++ b/src/components/qr-code/index.ts
@@ -0,0 +1,9 @@
+export {
+ type QrErrorCorrectionLevel,
+ qrMatrix,
+} from "../../lib/qr/qrMatrix";
+export {
+ default,
+ QrCode,
+ type QrCodeProps,
+} from "./QrCode.generated";
diff --git a/src/components/scroll-horizontal/ScrollHorizontal.css b/src/components/scroll-horizontal/ScrollHorizontal.css
new file mode 100644
index 00000000..8dfed34d
--- /dev/null
+++ b/src/components/scroll-horizontal/ScrollHorizontal.css
@@ -0,0 +1,100 @@
+@layer components {
+ .scroll-horizontal {
+ display: block;
+ width: 100%;
+ }
+
+ .scroll-horizontal[data-scroll-ready="true"] {
+ height: var(--scroll-horizontal-section-height, auto);
+ }
+
+ .scroll-horizontal__viewport {
+ align-items: center;
+ display: flex;
+ max-width: 100%;
+ overflow-x: auto;
+ overflow-y: hidden;
+ }
+
+ .scroll-horizontal__track {
+ align-items: stretch;
+ display: flex;
+ flex: 0 0 auto;
+ gap: var(--scroll-horizontal-mobile-gap, 15px);
+ min-width: 100%;
+ width: max-content;
+ }
+
+ .scroll-horizontal__track > * {
+ box-sizing: border-box;
+ flex: 0 0 var(--scroll-horizontal-mobile-item-width, 280px);
+ min-width: 0;
+ width: var(--scroll-horizontal-mobile-item-width, 280px);
+ }
+
+ .scroll-horizontal[data-scroll-ready="true"] .scroll-horizontal__viewport {
+ height: 100vh;
+ overflow: hidden;
+ position: sticky;
+ top: 0;
+ }
+
+ @media (min-width: 768px) {
+ .scroll-horizontal__track {
+ gap: var(--scroll-horizontal-gap, 30px);
+ }
+
+ .scroll-horizontal__track > * {
+ flex-basis: var(--scroll-horizontal-item-width, 400px);
+ width: var(--scroll-horizontal-item-width, 400px);
+ }
+ }
+
+ @supports (view-timeline-name: --scroll-horizontal) and
+ (view-timeline-axis: block) and
+ (animation-timeline: --scroll-horizontal) and
+ (animation-range: contain 0% contain 100%) {
+ .scroll-horizontal[data-scroll-ready="true"][data-scroll-native="true"] {
+ view-timeline-axis: block;
+ view-timeline-name: --scroll-horizontal;
+ }
+
+ .scroll-horizontal[data-scroll-ready="true"][data-scroll-native="true"]
+ .scroll-horizontal__track {
+ animation: scroll-horizontal-track linear both;
+ animation-timeline: --scroll-horizontal;
+ animation-range-start: contain 0%;
+ animation-range-end: contain 100%;
+ }
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ .scroll-horizontal[data-scroll-ready="true"] {
+ height: auto;
+ }
+
+ .scroll-horizontal[data-scroll-ready="true"] .scroll-horizontal__viewport {
+ height: auto;
+ min-height: 0;
+ overflow-x: auto;
+ overflow-y: hidden;
+ position: relative;
+ top: auto;
+ }
+
+ .scroll-horizontal[data-scroll-ready="true"] .scroll-horizontal__track {
+ animation: none;
+ transform: none;
+ }
+ }
+
+ @keyframes scroll-horizontal-track {
+ from {
+ transform: translateX(0);
+ }
+
+ to {
+ transform: translateX(calc(0px - var(--scroll-horizontal-travel, 0px)));
+ }
+ }
+}
diff --git a/src/components/scroll-horizontal/ScrollHorizontal.layout.tsx b/src/components/scroll-horizontal/ScrollHorizontal.layout.tsx
new file mode 100644
index 00000000..623a17d6
--- /dev/null
+++ b/src/components/scroll-horizontal/ScrollHorizontal.layout.tsx
@@ -0,0 +1,428 @@
+import "./ScrollHorizontal.css";
+import type { JSX } from "@solidjs/web";
+import {
+ type Component,
+ createMemo,
+ createSignal,
+ omit,
+ onCleanup,
+ onSettled,
+ Show,
+} from "solid-js";
+import type { Layout } from "../../lib/layouts";
+import {
+ attachScrollProgress,
+ supportsViewTimeline,
+ type ScrollProgressBinding as ScrollProgressHandle,
+} from "../../motion/scroll-progress";
+import type { UIBaseProps } from "../vocabulary";
+import { componentRecipe } from "./ScrollHorizontal.recipe";
+
+export type ScrollHorizontalProps = UIBaseProps &
+ Omit, "class" | "style" | "height"> & {
+ itemWidth?: number;
+ mobileItemWidth?: number;
+ gap?: number;
+ mobileGap?: number;
+ height?: number | string;
+ };
+
+const ScrollProgressBinding: Component<{
+ target: () => HTMLElement | undefined;
+ onProgress: (progress: number) => void;
+ onDispose: () => void;
+}> = (props) => {
+ let binding: ScrollProgressHandle | undefined;
+
+ onSettled(() => {
+ binding?.cleanup();
+ const section = props.target();
+ binding = section
+ ? attachScrollProgress(section, { onProgress: props.onProgress })
+ : undefined;
+ });
+
+ onCleanup(() => {
+ binding?.cleanup();
+ binding = undefined;
+ props.onDispose();
+ });
+
+ return null;
+};
+
+type ScrollLayoutResizeObserver = Pick;
+type ScrollLayoutResizeObserverConstructor = new (
+ callback: ResizeObserverCallback,
+) => ScrollLayoutResizeObserver;
+
+const getScrollLayoutResizeObserver =
+ (): ScrollLayoutResizeObserverConstructor | undefined => {
+ const observerConstructor = (
+ window as Window & {
+ ResizeObserver?: ScrollLayoutResizeObserverConstructor;
+ }
+ ).ResizeObserver;
+ return typeof observerConstructor === "function"
+ ? observerConstructor
+ : undefined;
+ };
+
+const ScrollHorizontal: Layout<
+ typeof componentRecipe,
+ ScrollHorizontalProps
+> = () => {
+ const others = omit(
+ local,
+ "children",
+ "class",
+ "dataTheme",
+ "style",
+ "itemWidth",
+ "mobileItemWidth",
+ "gap",
+ "mobileGap",
+ "height",
+ "ref",
+ "onFocusIn",
+ "tabIndex",
+ "aria-label",
+ "aria-labelledby",
+ "role",
+ );
+
+ let sectionRef: HTMLElement | undefined;
+ let viewportRef: HTMLElement | undefined;
+ let trackRef: HTMLDivElement | undefined;
+ let prefersReducedMotion = false;
+
+ const [travel, setTravel] = createSignal(0);
+ const [measuredHeight, setMeasuredHeight] = createSignal("auto");
+ const [ready, setReady] = createSignal(false);
+ const [nativeTimeline, setNativeTimeline] = createSignal(false);
+ let fallbackProgress = 0;
+
+ const asPixels = (value: number): string =>
+ `${Math.max(0, Number.isFinite(value) ? value : 0)}px`;
+
+ const clearFallbackTrackTransform = () => {
+ if (!trackRef) return;
+ try {
+ trackRef.style.removeProperty("transform");
+ } catch {
+ // The track may already be detached.
+ }
+ };
+
+ const writeFallbackTrackTransform = (progress?: number) => {
+ if (progress !== undefined) fallbackProgress = progress;
+ if (!trackRef) return;
+ if (prefersReducedMotion || nativeTimeline() || !ready()) {
+ clearFallbackTrackTransform();
+ return;
+ }
+
+ const distance = travel();
+ const offset =
+ Number.isFinite(distance) && Number.isFinite(fallbackProgress)
+ ? -(distance * fallbackProgress)
+ : 0;
+ try {
+ trackRef.style.transform = `translateX(${offset}px)`;
+ } catch {
+ // Inline transform is the fallback paint path; keep scroll handling.
+ }
+ };
+
+ const asLength = (value: number | string): string =>
+ typeof value === "number" ? asPixels(value) : value;
+
+ const style = createMemo(
+ () =>
+ ({
+ ...(local.style ?? {}),
+ "--scroll-horizontal-item-width": asPixels(local.itemWidth ?? 400),
+ "--scroll-horizontal-mobile-item-width": asPixels(
+ local.mobileItemWidth ?? 280,
+ ),
+ "--scroll-horizontal-gap": asPixels(local.gap ?? 30),
+ "--scroll-horizontal-mobile-gap": asPixels(local.mobileGap ?? 15),
+ "--scroll-horizontal-travel": asPixels(travel()),
+ "--scroll-horizontal-section-height":
+ local.height === undefined || local.height === "auto"
+ ? measuredHeight()
+ : asLength(local.height),
+ }) as JSX.CSSProperties,
+ );
+
+ const measure = (): boolean => {
+ if (!sectionRef || !viewportRef || !trackRef) return false;
+
+ const rowWidth = trackRef.scrollWidth;
+ const viewportWidth = viewportRef.clientWidth;
+ const viewportHeight = window.innerHeight;
+ if (
+ !Number.isFinite(rowWidth) ||
+ !Number.isFinite(viewportWidth) ||
+ !Number.isFinite(viewportHeight) ||
+ viewportWidth <= 0 ||
+ viewportHeight <= 0
+ ) {
+ return false;
+ }
+
+ const nextTravel = Math.max(0, rowWidth - viewportWidth);
+ const nextHeight =
+ local.height === undefined || local.height === "auto"
+ ? `${viewportHeight + nextTravel}px`
+ : asLength(local.height);
+
+ try {
+ sectionRef.style.setProperty(
+ "--scroll-horizontal-travel",
+ asPixels(nextTravel),
+ );
+ sectionRef.style.setProperty(
+ "--scroll-horizontal-section-height",
+ nextHeight,
+ );
+ } catch {
+ return false;
+ }
+
+ setTravel((current) => (current === nextTravel ? current : nextTravel));
+
+ if (local.height === undefined || local.height === "auto") {
+ setMeasuredHeight((current) =>
+ current === nextHeight ? current : nextHeight,
+ );
+ }
+
+ return true;
+ };
+
+ const handleFocusIn: JSX.EventHandlerUnion = (
+ event,
+ ) => {
+ if (
+ !prefersReducedMotion &&
+ ready() &&
+ sectionRef &&
+ viewportRef &&
+ trackRef &&
+ event.target instanceof globalThis.HTMLElement &&
+ trackRef.contains(event.target)
+ ) {
+ const focusTarget = event.target;
+ let item: HTMLElement = focusTarget;
+
+ while (item.parentElement && item.parentElement !== trackRef) {
+ item = item.parentElement;
+ }
+
+ if (item.parentElement === trackRef) {
+ const focusRect = focusTarget.getBoundingClientRect();
+ const viewportRect = viewportRef.getBoundingClientRect();
+ const visibleWidth = viewportRef.clientWidth;
+ const itemLeft = focusRect.left - viewportRect.left;
+ const itemRight = focusRect.right - viewportRect.left;
+
+ const clipsLeft = itemLeft < 0;
+ const clipsRight = itemRight > visibleWidth;
+
+ if (focusRect.width > 0 && (clipsLeft || clipsRight)) {
+ const sectionRect = sectionRef.getBoundingClientRect();
+ const viewportHeight = window.innerHeight;
+ const sectionRange = Math.max(0, sectionRect.height - viewportHeight);
+ const horizontalTravel = travel();
+
+ if (sectionRange > 0 && horizontalTravel > 0) {
+ const currentProgress = Math.max(
+ 0,
+ Math.min(1, -sectionRect.top / sectionRange),
+ );
+ const offsetAtStart = horizontalTravel * currentProgress;
+ const itemLeftAtStart = itemLeft + offsetAtStart;
+ const itemRightAtStart = itemRight + offsetAtStart;
+ const nextProgress = Math.max(
+ 0,
+ Math.min(
+ 1,
+ itemRight <= 0
+ ? itemRightAtStart / horizontalTravel
+ : clipsLeft
+ ? itemLeftAtStart / horizontalTravel
+ : (itemRightAtStart - visibleWidth) / horizontalTravel,
+ ),
+ );
+ const sectionTop = sectionRect.top + window.scrollY;
+
+ window.scrollTo({
+ top: sectionTop + nextProgress * sectionRange,
+ behavior: "auto",
+ });
+ }
+ }
+ }
+ }
+
+ if (typeof local.onFocusIn === "function") local.onFocusIn(event);
+ };
+
+ onSettled(() => {
+ setNativeTimeline(supportsViewTimeline());
+
+ const mediaQuery =
+ typeof window.matchMedia === "function"
+ ? window.matchMedia("(prefers-reduced-motion: reduce)")
+ : undefined;
+ const maxInitialRetries = 3;
+ let initialRetriesRemaining = maxInitialRetries;
+ let active = true;
+ let pendingFrame: number | undefined;
+ let retryPending = false;
+ let layoutObserver: ScrollLayoutResizeObserver | undefined;
+
+ const cancelScheduledMeasure = () => {
+ if (pendingFrame !== undefined) {
+ window.cancelAnimationFrame(pendingFrame);
+ pendingFrame = undefined;
+ }
+ retryPending = false;
+ };
+
+ const scheduleMeasure = (retryIfUnavailable = false) => {
+ if (!active || prefersReducedMotion) return;
+ retryPending ||= retryIfUnavailable;
+ if (pendingFrame !== undefined) return;
+
+ pendingFrame = window.requestAnimationFrame(() => {
+ pendingFrame = undefined;
+ const shouldRetry = retryPending;
+ retryPending = false;
+ if (!active || prefersReducedMotion) return;
+
+ const measured = measure();
+ setReady(measured);
+ writeFallbackTrackTransform();
+ if (measured) {
+ initialRetriesRemaining = maxInitialRetries;
+ return;
+ }
+
+ if (shouldRetry && initialRetriesRemaining > 0) {
+ initialRetriesRemaining -= 1;
+ scheduleMeasure(true);
+ }
+ });
+ };
+
+ const applyMotionPreference = () => {
+ prefersReducedMotion = mediaQuery?.matches ?? false;
+
+ if (prefersReducedMotion) {
+ cancelScheduledMeasure();
+ setReady(false);
+ clearFallbackTrackTransform();
+ return;
+ }
+
+ initialRetriesRemaining = maxInitialRetries;
+ scheduleMeasure(true);
+ };
+
+ const handleResize = () => {
+ if (prefersReducedMotion) return;
+ scheduleMeasure();
+ };
+
+ window.addEventListener("resize", handleResize, { passive: true });
+ mediaQuery?.addEventListener?.("change", applyMotionPreference);
+ if (mediaQuery && !mediaQuery.addEventListener) {
+ mediaQuery.addListener(applyMotionPreference);
+ }
+
+ const ResizeObserverConstructor = getScrollLayoutResizeObserver();
+ if (ResizeObserverConstructor && viewportRef && trackRef) {
+ try {
+ layoutObserver = new ResizeObserverConstructor(handleResize);
+ layoutObserver.observe(viewportRef);
+ layoutObserver.observe(trackRef);
+ } catch {
+ layoutObserver?.disconnect();
+ layoutObserver = undefined;
+ }
+ }
+
+ // Bounded frame retries handle late initial layout when ResizeObserver is
+ // unavailable; observer notifications cover delayed and later resizes.
+ applyMotionPreference();
+
+ return () => {
+ active = false;
+ cancelScheduledMeasure();
+ layoutObserver?.disconnect();
+ window.removeEventListener("resize", handleResize);
+ mediaQuery?.removeEventListener?.("change", applyMotionPreference);
+ if (mediaQuery && !mediaQuery.removeEventListener) {
+ mediaQuery.removeListener(applyMotionPreference);
+ }
+ };
+ });
+
+ return (
+ {
+ sectionRef = el;
+ if (typeof local.ref === "function") local.ref(el);
+ }}
+ data-theme={local.dataTheme}
+ data-scroll-ready={ready() ? "true" : undefined}
+ data-scroll-native={nativeTimeline() ? "true" : undefined}
+ style={style()}
+ onFocusIn={handleFocusIn}
+ role={typeof local.role === "string" ? local.role : "group"}
+ aria-label={undefined}
+ aria-labelledby={undefined}
+ >
+
+ sectionRef}
+ onProgress={writeFallbackTrackTransform}
+ onDispose={clearFallbackTrackTransform}
+ />
+
+ {
+ viewportRef = el;
+ }}
+ {...slot.viewport}
+ role="region"
+ aria-label={
+ typeof local["aria-label"] === "string"
+ ? local["aria-label"]
+ : "Scrollable content"
+ }
+ aria-labelledby={
+ typeof local["aria-labelledby"] === "string"
+ ? local["aria-labelledby"]
+ : undefined
+ }
+ tabindex={typeof local.tabIndex === "number" ? local.tabIndex : 0}
+ >
+