@sdxc/kit 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 +397 -22
- package/changelog.jsonl +1171 -1092
- package/config.schema.json +53 -1
- package/dist/cli.js +12 -0
- package/dist/commands/deploy.d.ts +23 -0
- package/dist/commands/deploy.js +167 -0
- package/dist/commands/destroy.d.ts +22 -0
- package/dist/commands/destroy.js +92 -0
- package/dist/commands/doctor.d.ts +26 -0
- package/dist/commands/doctor.js +65 -0
- package/dist/commands/initializers.d.ts +16 -0
- package/dist/commands/initializers.js +23 -0
- package/dist/commands/make.d.ts +78 -6
- package/dist/commands/make.js +134 -20
- package/dist/commands/middleware.d.ts +16 -0
- package/dist/commands/middleware.js +21 -0
- package/dist/commands/models.d.ts +18 -0
- package/dist/commands/models.js +29 -0
- package/dist/commands/notes.d.ts +17 -0
- package/dist/commands/notes.js +27 -0
- package/dist/commands/routes.d.ts +25 -0
- package/dist/commands/routes.js +50 -0
- package/dist/commands/run.d.ts +16 -0
- package/dist/commands/run.js +32 -11
- package/dist/commands/scaffold.d.ts +30 -0
- package/dist/commands/scaffold.js +34 -0
- package/dist/commands/schedule.d.ts +16 -0
- package/dist/commands/schedule.js +21 -0
- package/dist/commands/stats.d.ts +16 -0
- package/dist/commands/stats.js +21 -0
- package/dist/commands/ui/update.d.ts +6 -3
- package/dist/commands/ui/update.js +24 -7
- package/dist/commands/upgrade.d.ts +3 -1
- package/dist/commands/upgrade.js +88 -23
- package/dist/config.d.ts +20 -0
- package/dist/config.js +32 -1
- package/dist/contract.d.ts +101 -3
- package/dist/contract.js +371 -26
- package/dist/create/templates.js +3 -2
- package/dist/dependencies.d.ts +5 -1
- package/dist/dependencies.js +16 -1
- package/dist/deploy/plan.d.ts +49 -0
- package/dist/deploy/plan.js +68 -0
- package/dist/destroy.d.ts +40 -0
- package/dist/destroy.js +317 -0
- package/dist/doctor/check.d.ts +71 -0
- package/dist/doctor/check.js +53 -0
- package/dist/doctor/checks.d.ts +23 -0
- package/dist/doctor/checks.js +70 -0
- package/dist/doctor/define.d.ts +59 -0
- package/dist/doctor/define.js +16 -0
- package/dist/doctor/emails.d.ts +18 -0
- package/dist/doctor/emails.js +243 -0
- package/dist/doctor/env.d.ts +26 -0
- package/dist/doctor/env.js +88 -0
- package/dist/doctor/files.d.ts +14 -0
- package/dist/doctor/files.js +34 -0
- package/dist/doctor/fixture.d.ts +23 -0
- package/dist/doctor/fixture.js +46 -0
- package/dist/doctor/install.d.ts +17 -0
- package/dist/doctor/install.js +37 -0
- package/dist/doctor/installed.d.ts +11 -0
- package/dist/doctor/installed.js +79 -0
- package/dist/doctor/jsdoc.d.ts +44 -0
- package/dist/doctor/jsdoc.js +201 -0
- package/dist/doctor/layout.d.ts +23 -0
- package/dist/doctor/layout.js +83 -0
- package/dist/doctor/migrations.d.ts +16 -0
- package/dist/doctor/migrations.js +96 -0
- package/dist/doctor/models.d.ts +13 -0
- package/dist/doctor/models.js +69 -0
- package/dist/doctor/pins.d.ts +15 -0
- package/dist/doctor/pins.js +79 -0
- package/dist/doctor/project.d.ts +58 -0
- package/dist/doctor/project.js +261 -0
- package/dist/doctor/remix.d.ts +14 -0
- package/dist/doctor/remix.js +44 -0
- package/dist/doctor/routes.d.ts +11 -0
- package/dist/doctor/routes.js +49 -0
- package/dist/doctor/typegen.d.ts +13 -0
- package/dist/doctor/typegen.js +57 -0
- package/dist/doctor/ui.d.ts +14 -0
- package/dist/doctor/ui.js +51 -0
- package/dist/initializers.d.ts +25 -0
- package/dist/initializers.js +89 -0
- package/dist/lock.d.ts +2 -2
- package/dist/make/actions.d.ts +23 -0
- package/dist/make/actions.js +82 -0
- package/dist/make/declare.d.ts +31 -3
- package/dist/make/declare.js +284 -9
- package/dist/make/email.d.ts +23 -0
- package/dist/make/email.js +111 -0
- package/dist/make/from-fields.d.ts +30 -0
- package/dist/make/from-fields.js +162 -0
- package/dist/make/from-model.d.ts +39 -0
- package/dist/make/from-model.js +161 -0
- package/dist/make/generate.d.ts +25 -5
- package/dist/make/generate.js +76 -22
- package/dist/make/guard.d.ts +35 -0
- package/dist/make/guard.js +73 -0
- package/dist/make/imports.d.ts +6 -0
- package/dist/make/imports.js +19 -0
- package/dist/make/index.d.ts +49 -4
- package/dist/make/index.js +290 -29
- package/dist/make/kinds.d.ts +34 -2
- package/dist/make/kinds.js +92 -8
- package/dist/make/mount.d.ts +25 -0
- package/dist/make/mount.js +135 -0
- package/dist/make/schema-diff.d.ts +58 -0
- package/dist/make/schema-diff.js +609 -0
- package/dist/make/schema.d.ts +76 -0
- package/dist/make/schema.js +206 -0
- package/dist/make/stubs.d.ts +14 -7
- package/dist/make/stubs.js +24 -8
- package/dist/make/test.d.ts +43 -0
- package/dist/make/test.js +150 -0
- package/dist/make/trigger.d.ts +31 -0
- package/dist/make/trigger.js +163 -0
- package/dist/models.d.ts +42 -0
- package/dist/models.js +149 -0
- package/dist/notes.d.ts +28 -0
- package/dist/notes.js +66 -0
- package/dist/reference.d.ts +27 -0
- package/dist/reference.js +103 -0
- package/dist/releases.d.ts +9 -0
- package/dist/releases.js +29 -8
- package/dist/routes/chains.d.ts +34 -0
- package/dist/routes/chains.js +95 -0
- package/dist/routes/filter.d.ts +53 -0
- package/dist/routes/filter.js +147 -0
- package/dist/routes/format.d.ts +23 -0
- package/dist/routes/format.js +123 -0
- package/dist/routes/helpers.d.ts +21 -0
- package/dist/routes/helpers.js +165 -0
- package/dist/routes/index.d.ts +56 -0
- package/dist/routes/index.js +167 -0
- package/dist/routes/modules.d.ts +116 -0
- package/dist/routes/modules.js +235 -0
- package/dist/routes/parse.d.ts +161 -0
- package/dist/routes/parse.js +621 -0
- package/dist/routes/routers.d.ts +69 -0
- package/dist/routes/routers.js +327 -0
- package/dist/scaffold/fields.d.ts +129 -0
- package/dist/scaffold/fields.js +421 -0
- package/dist/scaffold/index.d.ts +39 -0
- package/dist/scaffold/index.js +622 -0
- package/dist/scaffold/render.d.ts +61 -0
- package/dist/scaffold/render.js +417 -0
- package/dist/schedule.d.ts +45 -0
- package/dist/schedule.js +124 -0
- package/dist/stats.d.ts +37 -0
- package/dist/stats.js +126 -0
- package/dist/ui/commands.d.ts +10 -3
- package/dist/ui/commands.js +85 -15
- package/dist/ui/registry.d.ts +8 -8
- package/dist/upgrade/agents.d.ts +49 -0
- package/dist/upgrade/agents.js +110 -0
- package/dist/upgrade/changelog.d.ts +2 -2
- package/dist/upgrade/project.d.ts +4 -0
- package/dist/upgrade/project.js +11 -1
- package/dist/upgrade/prompt.d.ts +11 -0
- package/dist/upgrade/prompt.js +50 -7
- package/package.json +6 -4
- package/registry/ui/alert-dialog.json +2 -2
- package/registry/ui/attachment.json +2 -2
- package/registry/ui/calendar.json +2 -2
- package/registry/ui/color-picker.json +2 -2
- package/registry/ui/command.json +2 -2
- package/registry/ui/date-picker.json +2 -2
- package/registry/ui/date-range-picker.json +2 -2
- package/registry/ui/dialog.json +2 -2
- package/registry/ui/file-trigger.json +2 -2
- package/registry/ui/heading-scope.json +2 -2
- package/registry/ui/message-scroller.json +2 -2
- package/registry/ui/number-field.json +2 -2
- package/registry/ui/range-calendar.json +2 -2
- package/registry/ui/resizable.json +2 -2
- package/registry/ui/select.json +2 -2
- package/registry/ui/shared-element.json +2 -2
- package/registry/ui/sidebar.json +3 -3
- package/registry/ui/typeset.json +3 -3
- package/stubs/command.spec.stub +15 -0
- package/stubs/controller.api.resource.stub +23 -0
- package/stubs/controller.api.spec.stub +15 -0
- package/stubs/controller.form.stub +2 -2
- package/stubs/controller.form.test.stub +2 -2
- package/stubs/controller.resource.form.stub +67 -0
- package/stubs/controller.resource.stub +28 -0
- package/stubs/controller.spec.stub +15 -0
- package/stubs/email.stub +9 -14
- package/stubs/email.test.stub +9 -9
- package/stubs/factory.stub +1 -1
- package/stubs/mcp.spec.stub +16 -0
- package/stubs/model.stub +3 -3
- package/stubs/policy.test.stub +34 -8
- package/stubs/scaffold.api.create.stub +34 -0
- package/stubs/scaffold.api.create.test.stub +37 -0
- package/stubs/scaffold.api.destroy.stub +34 -0
- package/stubs/scaffold.api.destroy.test.stub +44 -0
- package/stubs/scaffold.api.index.stub +23 -0
- package/stubs/scaffold.api.index.test.stub +31 -0
- package/stubs/scaffold.api.show.stub +27 -0
- package/stubs/scaffold.api.show.test.stub +41 -0
- package/stubs/scaffold.api.update.stub +44 -0
- package/stubs/scaffold.api.update.test.stub +46 -0
- package/stubs/scaffold.command.create.stub +22 -0
- package/stubs/scaffold.command.create.test.stub +30 -0
- package/stubs/scaffold.command.delete.stub +20 -0
- package/stubs/scaffold.command.delete.test.stub +39 -0
- package/stubs/scaffold.command.list.stub +18 -0
- package/stubs/scaffold.command.list.test.stub +31 -0
- package/stubs/scaffold.command.show.stub +19 -0
- package/stubs/scaffold.command.show.test.stub +37 -0
- package/stubs/scaffold.controller.destroy.stub +35 -0
- package/stubs/scaffold.controller.destroy.test.stub +65 -0
- package/stubs/scaffold.controller.edit.stub +97 -0
- package/stubs/scaffold.controller.edit.test.stub +91 -0
- package/stubs/scaffold.controller.index.stub +55 -0
- package/stubs/scaffold.controller.index.test.stub +32 -0
- package/stubs/scaffold.controller.new.stub +70 -0
- package/stubs/scaffold.controller.new.test.stub +81 -0
- package/stubs/scaffold.controller.show.stub +59 -0
- package/stubs/scaffold.controller.show.test.stub +43 -0
- package/stubs/scaffold.factory.stub +16 -0
- package/stubs/scaffold.form.stub +75 -0
- package/stubs/scaffold.mcp.create.stub +24 -0
- package/stubs/scaffold.mcp.create.test.stub +36 -0
- package/stubs/scaffold.mcp.delete.stub +31 -0
- package/stubs/scaffold.mcp.delete.test.stub +43 -0
- package/stubs/scaffold.mcp.get.stub +21 -0
- package/stubs/scaffold.mcp.get.test.stub +31 -0
- package/stubs/scaffold.mcp.list.stub +23 -0
- package/stubs/scaffold.mcp.list.test.stub +25 -0
- package/stubs/scaffold.mcp.update.stub +37 -0
- package/stubs/scaffold.mcp.update.test.stub +40 -0
- package/stubs/scaffold.migration.stub +3 -0
- package/stubs/scaffold.model.stub +35 -0
- package/stubs/scaffold.model.test.stub +25 -0
- package/stubs/scaffold.spec.stub +7 -0
- package/stubs/scaffold.test-database.stub +33 -0
- package/stubs/scaffold.test-mcp.stub +92 -0
- package/stubs/scaffold.validator.stub +18 -0
- package/stubs/scaffold.validator.test.stub +26 -0
- package/templates/app/AGENTS.md +167 -0
- package/templates/app/CLAUDE.md +1 -0
- package/templates/app/README.md +33 -15
- package/templates/app/app/commands/console.test.ts +26 -0
- package/templates/app/app/commands/console.ts +19 -0
- package/templates/app/app/commands/db/fresh.test.ts +57 -0
- package/templates/app/app/commands/db/fresh.ts +37 -0
- package/templates/app/app/commands/db/migrate.test.ts +17 -1
- package/templates/app/app/commands/db/migrate.ts +51 -18
- package/templates/app/app/commands/db/prepare.test.ts +39 -0
- package/templates/app/app/commands/db/prepare.ts +35 -0
- package/templates/app/app/commands/db/seed.test.ts +38 -0
- package/templates/app/app/commands/db/seed.ts +26 -0
- package/templates/app/app/commands/deploy.test.ts +34 -0
- package/templates/app/app/commands/deploy.ts +18 -0
- package/templates/app/app/commands/emails/preview.test.tsx +63 -0
- package/templates/app/app/commands/emails/preview.ts +24 -0
- package/templates/app/app/commands/index.ts +57 -2
- package/templates/app/app/commands/typegen.test.ts +20 -1
- package/templates/app/app/commands/typegen.ts +16 -2
- package/templates/app/app/emails/index.ts +10 -0
- package/templates/app/app/http/middleware/access.test.ts +43 -0
- package/templates/app/app/http/middleware/access.ts +41 -0
- package/templates/app/app/http/middleware/api.ts +12 -3
- package/templates/app/app/http/middleware/page.test.ts +4 -1
- package/templates/app/app/http/middleware/page.ts +7 -5
- package/templates/app/app/initializers/cli.ts +35 -2
- package/templates/app/app/initializers/dispatcher.ts +9 -1
- package/templates/app/app/initializers/mail-transport.test.ts +33 -0
- package/templates/app/app/initializers/mail-transport.ts +26 -0
- package/templates/app/app/initializers/mail.test.ts +17 -17
- package/templates/app/app/initializers/mail.ts +15 -7
- package/templates/app/app/initializers/router.test.ts +7 -0
- package/templates/app/app/initializers/router.tsx +13 -3
- package/templates/app/app/jobs/email.test.tsx +70 -0
- package/templates/app/app/jobs/email.ts +16 -0
- package/templates/app/app/jobs/index.ts +6 -2
- package/templates/app/app/policies/abilities.ts +13 -0
- package/templates/app/app/policies/policy.test.ts +15 -0
- package/templates/app/app/policies/policy.ts +30 -0
- package/templates/app/app/services/commands.ts +30 -0
- package/templates/app/app/services/migrations.test.ts +48 -1
- package/templates/app/app/services/migrations.ts +66 -9
- package/templates/app/app/test/cloudflare-workers.ts +2 -0
- package/templates/app/app/test/local-database.ts +67 -0
- package/templates/app/app/test/session.ts +28 -0
- package/templates/app/bootstrap/console.ts +13 -0
- package/templates/app/cloudflare.config.ts +3 -3
- package/templates/app/database/seed.ts +12 -0
- package/templates/app/package.json +3 -1
- package/templates/app/spec/config.jsonc +16 -0
- package/stubs/policy.stub +0 -16
package/registry/ui/sidebar.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sidebar",
|
|
3
|
-
"changedIn": "2026.10.
|
|
3
|
+
"changedIn": "2026.10.21",
|
|
4
4
|
"dependencies": [
|
|
5
5
|
"dialog",
|
|
6
6
|
"scroll-area",
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
],
|
|
12
12
|
"source": {
|
|
13
13
|
"path": "sidebar.tsx",
|
|
14
|
-
"content": "/**\n * An application shell's primary navigation rail, composed from a layout\n * root, a collapsible rail, a main-content inset, and a family of\n * group/menu/item parts for organizing links. Collapsing rides a single\n * checkbox's native `:checked` state, so the whole shell works with zero\n * library JavaScript.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { PanelLeftIcon } from \"@sdxc/icons\";\nimport { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { bg, border, borderEdge, colorMix, fg, outline, outlineStyle } from \"@sdxc/u/color\";\nimport {\n\tbackdropBlur,\n\tbackdropSaturate,\n\topacity,\n\trounded,\n\tshadow,\n\ttransition,\n\ttransitionBehavior,\n\ttransitionDuration,\n\ttransitionProperty,\n} from \"@sdxc/u/effects\";\nimport { cursor, pseudoContent, userSelect, willChange } from \"@sdxc/u/general\";\nimport { var as varUtility } from \"@sdxc/u/general/var\";\nimport {\n\tabsolute,\n\tcontainer,\n\tfixed,\n\tflex,\n\tflexCol,\n\tgap,\n\tgrow,\n\thidden,\n\tinlineFlex,\n\tinsBe,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\tinsLeft,\n\tinsRight,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n\tvstack,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { media, supports } from \"@sdxc/u/responsive\";\nimport {\n\tbs,\n\tis,\n\tm,\n\tmaxBs,\n\tmaxIs,\n\tmbe,\n\tmbs,\n\tminBs,\n\tminIs,\n\tmis,\n\tp,\n\tpb,\n\tpbe,\n\tpbs,\n\tpi,\n\tpis,\n\tsafeAreaPadding,\n} from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { after, data, focusVisible, hover, when } from \"@sdxc/u/state\";\nimport { scaleProperty, translateProperty, translateX } from \"@sdxc/u/transform\";\nimport {\n\tfontSize,\n\ttabularNums,\n\ttextAlign,\n\ttextDecoration,\n\ttextTransform,\n\ttracking,\n\ttruncate,\n\tweight,\n} from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { durations, easings } from \"@sdxc/ui/animations\";\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { warnIfNoAccessibleName } from \"@sdxc/ui/utils\";\n\nimport { Dialog } from \"@sdxc/ui/dialog\";\nimport { ScrollArea } from \"@sdxc/ui/scroll-area\";\nimport { Separator } from \"@sdxc/ui/separator\";\n\n/** Visual treatment {@link Sidebar} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: Sidebar.Variant = \"sidebar\";\n\n/** Collapse behavior {@link Sidebar} falls back to when `collapsible` is omitted. */\nconst DEFAULT_COLLAPSIBLE: Sidebar.Collapsible = \"offcanvas\";\n\n/**\n * Physical edge {@link Sidebar} docks against, and the edge\n * {@link Sidebar.MobileNav} slides in from, when `side` is omitted.\n */\nconst DEFAULT_SIDE: Sidebar.Side = \"left\";\n\n/** Semantic color role {@link Sidebar.Item} falls back to when `color` is omitted. */\nconst DEFAULT_ITEM_COLOR: Sidebar.Color = \"neutral\";\n\n/** Size variant {@link Sidebar.MenuButton} and {@link Sidebar.MenuLink} fall back to when `size` is omitted. */\nconst DEFAULT_MENU_BUTTON_SIZE: Sidebar.MenuButtonSize = \"md\";\n\n/** Whether {@link Sidebar.MenuAction} stays hidden until its row is hovered or focused, when `showOnHover` is omitted. */\nconst DEFAULT_SHOW_ON_HOVER = true;\n\n/** Whether {@link Sidebar.MenuSkeleton} renders a leading icon placeholder, when `showIcon` is omitted. */\nconst DEFAULT_SHOW_ICON = false;\n\n/**\n * Named container {@link Sidebar.Provider} declares on its own host, so\n * {@link Sidebar} and {@link Sidebar.Rail} can query the shell's overall\n * width for room to show a persistent rail, regardless of nesting depth.\n */\nconst PROVIDER_CONTAINER_NAME = \"ui-sidebar-provider\";\n\n/**\n * Named container {@link Sidebar.Inset} declares on its own host, so content\n * rendered inside it — a Card, a Table, anything sized by its surroundings —\n * responds to the inset's own available width as the rail expands or collapses.\n */\nconst INSET_CONTAINER_NAME = \"ui-sidebar-inset\";\n\n/**\n * Container query matching a shell wide enough to host the persistent rail\n * alongside its inset; below this width, {@link Sidebar}'s `\"icon\"` and\n * `\"offcanvas\"` collapse modes step aside for {@link Sidebar.MobileNav}.\n */\nconst WIDE_SHELL_QUERY = `@container ${PROVIDER_CONTAINER_NAME} (min-width: 48rem)`;\n\n/**\n * Selector matching {@link Sidebar.Trigger}'s own checkbox input once it\n * carries the platform's native `:checked` state — the single source of\n * truth every collapse-driven rule in {@link Sidebar.Provider} reads from.\n */\nconst TOGGLE_CHECKED_SELECTOR = '[data-slot=\"toggle\"]:checked';\n\n/**\n * Resolves the `aria-current` value an anchor-based nav part renders with:\n * an explicit `aria-current` always wins, and a `current`/`active`\n * shorthand of `true` falls back to `\"page\"` when nothing else was given.\n */\nfunction resolveAriaCurrent(\n\tcurrent: boolean | undefined,\n\tariaCurrent: TagProps<\"a\">[\"aria-current\"],\n): TagProps<\"a\">[\"aria-current\"] {\n\treturn ariaCurrent ?? (current ? \"page\" : undefined);\n}\n\n/**\n * Prop types for {@link Sidebar} and its compound parts.\n */\nexport namespace Sidebar {\n\t/**\n\t * Visual treatment the rail renders with: `\"sidebar\"` sits flush against\n\t * its edge, `\"floating\"` insets itself with a margin, a rounded, shadowed\n\t * panel, and a blurred backdrop; `\"inset\"` renders the same panel without blur.\n\t */\n\texport type Variant = \"sidebar\" | \"floating\" | \"inset\";\n\n\t/**\n\t * How the rail collapses: `\"none\"` always renders at full width, `\"icon\"`\n\t * narrows to an icon-only rail, and `\"offcanvas\"` narrows to nothing. Every\n\t * mode but `\"none\"` yields to {@link Sidebar.MobileNav} on narrow shells.\n\t */\n\texport type Collapsible = \"none\" | \"offcanvas\" | \"icon\";\n\n\t/**\n\t * Physical edge of the shell the rail docks against and, for\n\t * {@link Sidebar.MobileNav}, slides in from. `\"left\"` and `\"right\"` name\n\t * that edge regardless of `dir`, staying pinned to one physical side.\n\t */\n\texport type Side = \"left\" | \"right\";\n\n\t/**\n\t * Semantic color role {@link Sidebar.Item} renders its current-page\n\t * treatment in, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Size variant controlling {@link Sidebar.MenuButton}'s and\n\t * {@link Sidebar.MenuLink}'s padding, font size, and icon size.\n\t */\n\texport type MenuButtonSize = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough. Establishes\n\t * the shell's row layout — {@link Sidebar} beside {@link Sidebar.Inset} —\n\t * plus the {@link PROVIDER_CONTAINER_NAME} container and `:checked` collapse rules.\n\t */\n\texport interface ProviderProps extends TagProps<\"div\"> {\n\t\t/** {@link Sidebar} and {@link Sidebar.Inset}, in either order. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<aside>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface Props extends TagProps<\"aside\"> {\n\t\t/** Visual treatment. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Collapse behavior. Defaults to {@link DEFAULT_COLLAPSIBLE}. */\n\t\tcollapsible?: Collapsible;\n\t\t/** Physical docking edge. Defaults to {@link DEFAULT_SIDE}. */\n\t\tside?: Side;\n\t}\n\n\t/**\n\t * Every prop {@link Dialog.Props} accepts, plus `side`. `id` stays the id\n\t * a trigger elsewhere on the page opens this drawer with — see\n\t * {@link Dialog.Props} for the full Invoker Commands contract.\n\t */\n\texport interface MobileNavProps extends Dialog.Props {\n\t\t/** Physical edge to dock against and slide in from. Defaults to {@link DEFAULT_SIDE}. */\n\t\tside?: Side;\n\t}\n\n\t/**\n\t * Every native `<header>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface HeaderProps extends TagProps<\"header\"> {}\n\n\t/**\n\t * Every prop {@link ScrollArea.ViewportProps} accepts, unchanged.\n\t */\n\texport interface ContentProps extends ScrollArea.ViewportProps {}\n\n\t/**\n\t * Every native `<footer>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface FooterProps extends TagProps<\"footer\"> {}\n\n\t/**\n\t * Every native `<nav>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface NavProps extends TagProps<\"nav\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.Item}, built as an intersection because\n\t * the underlying anchor prop type is a union keyed on `href` — the\n\t * accessible-anchor contract restricts `role` once `href` is present.\n\t */\n\texport type ItemProps = TagProps<\"a\"> & {\n\t\t/** Destination the item navigates to. */\n\t\thref: string;\n\t\t/** Semantic color role applied once the item is current. Defaults to {@link DEFAULT_ITEM_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tcurrent?: boolean;\n\t};\n\n\t/**\n\t * Every native `<section>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupProps extends TagProps<\"section\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupLabelProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<button>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupActionProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupContentProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<ul>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuProps extends TagProps<\"ul\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, plus the `mix` passthrough. Its own\n\t * `:hover`/`:focus-within` state reveals a nested {@link Sidebar.MenuAction}\n\t * that would otherwise stay hidden.\n\t */\n\texport interface MenuItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuButton}.\n\t */\n\texport interface MenuButtonProps extends TagProps<\"button\"> {\n\t\t/** Size variant. Defaults to {@link DEFAULT_MENU_BUTTON_SIZE}. */\n\t\tsize?: MenuButtonSize;\n\t\t/** Marks the row as the current selection, independent of navigation. */\n\t\tactive?: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuLink}. Built as an intersection for\n\t * the same reason as {@link Sidebar.ItemProps}.\n\t */\n\texport type MenuLinkProps = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/** Size variant. Defaults to {@link DEFAULT_MENU_BUTTON_SIZE}. */\n\t\tsize?: MenuButtonSize;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tactive?: boolean;\n\t};\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuAction}.\n\t */\n\texport interface MenuActionProps extends TagProps<\"button\"> {\n\t\t/**\n\t\t * Whether the control stays invisible until its ancestor\n\t\t * {@link Sidebar.MenuItem} is hovered or focused. Defaults to\n\t\t * {@link DEFAULT_SHOW_ON_HOVER}; set `false` to keep it always visible.\n\t\t */\n\t\tshowOnHover?: boolean;\n\t}\n\n\t/**\n\t * Every native `<span>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuBadgeProps extends TagProps<\"span\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSkeleton}.\n\t */\n\texport interface MenuSkeletonProps extends TagProps<\"div\"> {\n\t\t/** Whether to render a leading icon-shaped placeholder. Defaults to {@link DEFAULT_SHOW_ICON}. */\n\t\tshowIcon?: boolean;\n\t}\n\n\t/**\n\t * Every native `<ul>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuSubProps extends TagProps<\"ul\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuSubItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSubButton}.\n\t */\n\texport interface MenuSubButtonProps extends TagProps<\"button\"> {\n\t\t/** Marks the row as the current selection, independent of navigation. */\n\t\tactive?: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSubLink}. Built as an intersection\n\t * for the same reason as {@link Sidebar.ItemProps}.\n\t */\n\texport type MenuSubLinkProps = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tactive?: boolean;\n\t};\n\n\t/**\n\t * Props accepted by {@link Sidebar.Rail}: every native `<label>` attribute\n\t * except `htmlFor`, narrowed to required since it names the id of\n\t * {@link Sidebar.Trigger}'s own checkbox, the control this rail mirrors.\n\t */\n\texport interface RailProps extends Omit<TagProps<\"label\">, \"htmlFor\"> {\n\t\t/** Id of the {@link Sidebar.Trigger} checkbox this rail toggles. */\n\t\thtmlFor: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.Trigger}: every native `<input>`\n\t * attribute except `type` and `role`, fixed by the platform's checkbox\n\t * semantics, so `id`, `checked`, `defaultChecked`, and `disabled` all work.\n\t */\n\texport interface TriggerProps extends Omit<TagProps<\"input\">, \"type\" | \"role\"> {\n\t\t/**\n\t\t * Accessible label for the icon-only control — required, since the\n\t\t * control carries no visible text for assistive technology to read.\n\t\t */\n\t\t\"aria-label\": string;\n\t}\n\n\t/**\n\t * Every prop {@link ScrollArea.ViewportProps} accepts, unchanged.\n\t */\n\texport interface InsetProps extends ScrollArea.ViewportProps {}\n\n\t/**\n\t * Every prop {@link Separator.Props} accepts, unchanged.\n\t */\n\texport interface SeparatorProps extends Separator.Props {}\n}\n\n/**\n * Renders the rail itself: a native `<aside>` sized and styled through its\n * `data-variant`, `data-collapsible`, and `data-side` attributes, with\n * every collapse rule keyed off {@link Sidebar.Provider}'s `:has()` state.\n *\n * @param handle Runtime handle carrying the host `<aside>`'s props.\n * @returns The render function producing the rail's markup.\n * @example\n * <Sidebar.Provider>\n * \t<Sidebar variant=\"floating\" collapsible=\"icon\" side=\"right\">\n * \t\t<Sidebar.Header>{logo}</Sidebar.Header>\n * \t\t<Sidebar.Content>{nav}</Sidebar.Content>\n * \t</Sidebar>\n * \t<Sidebar.Inset>{children}</Sidebar.Inset>\n * </Sidebar.Provider>\n */\nexport function Sidebar(handle: Handle<Sidebar.Props>) {\n\treturn () => {\n\t\tlet { variant, collapsible, side, mix, ...rest } = handle.props;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet resolvedCollapsible = collapsible ?? DEFAULT_COLLAPSIBLE;\n\t\tlet resolvedSide = side ?? DEFAULT_SIDE;\n\n\t\treturn (\n\t\t\t<aside\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"sidebar\"\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\tdata-collapsible={resolvedCollapsible}\n\t\t\t\tdata-side={resolvedSide}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tis(varUtility(\"sidebar-width\", \"16rem\")),\n\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\tdata(\"side\", \"left\", [\n\t\t\t\t\t\tborderEdge(\"right\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\tsafeAreaPadding(\"left\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"side\", \"right\", [\n\t\t\t\t\t\tborderEdge(\"left\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\tsafeAreaPadding(\"right\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"floating\", [\n\t\t\t\t\t\tm(\"0.5rem\"),\n\t\t\t\t\t\tshadow(\"lg\"),\n\t\t\t\t\t\tsupports(\n\t\t\t\t\t\t\t\"(backdrop-filter: blur(0))\",\n\t\t\t\t\t\t\tmedia(\"(prefers-reduced-transparency: no-preference)\", [\n\t\t\t\t\t\t\t\tborder(\n\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tbg(\n\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-bg-tint)\", weight: 95 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tbackdropBlur(\"md\"),\n\t\t\t\t\t\t\t\tbackdropSaturate(1.4),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"inset\", shadow(\"base\")),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t`@container ${PROVIDER_CONTAINER_NAME} (max-width: 47.9375rem)`,\n\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"], &[data-collapsible=\"offcanvas\"]', hidden()),\n\t\t\t\t\t),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\ttransition(\"inline-size, transform\", {\n\t\t\t\t\t\tduration: durations.normal,\n\t\t\t\t\t\teasing: easings.standard,\n\t\t\t\t\t}),\n\t\t\t\t\tdata(\"variant\", \"floating\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\tdata(\"variant\", \"inset\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\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 shell's layout root: a flex row placing {@link Sidebar} beside\n * {@link Sidebar.Inset}, hosting every collapse rule keyed purely off\n * {@link Sidebar.Trigger}'s checkbox reaching `:checked` in this subtree.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the shell's markup.\n * @example\n * <Sidebar.Provider>\n * \t<Sidebar collapsible=\"icon\">\n * \t\t<Sidebar.Header>\n * \t\t\t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * \t\t</Sidebar.Header>\n * \t\t<Sidebar.Content>\n * \t\t\t<Sidebar.Menu>\n * \t\t\t\t<Sidebar.MenuItem>\n * \t\t\t\t\t<Sidebar.MenuLink href=\"/dashboard\" active>\n * \t\t\t\t\t\t<HomeIcon aria-hidden />\n * \t\t\t\t\t\t<span data-sidebar-collapsed-hide>{t(\"nav.dashboard\")}</span>\n * \t\t\t\t\t</Sidebar.MenuLink>\n * \t\t\t\t</Sidebar.MenuItem>\n * \t\t\t</Sidebar.Menu>\n * \t\t</Sidebar.Content>\n * \t\t<Sidebar.Rail htmlFor=\"app-sidebar-toggle\" />\n * \t</Sidebar>\n * \t<Sidebar.Inset>{children}</Sidebar.Inset>\n * </Sidebar.Provider>\n */\nSidebar.Provider = function SidebarProvider(handle: Handle<Sidebar.ProviderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"provider\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"stretch\"),\n\t\t\t\t\tminBs(\"100dvh\"),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\twhen(`&:has(${TOGGLE_CHECKED_SELECTOR})`, [\n\t\t\t\t\t\twhen('[data-slot=\"sidebar\"][data-collapsible=\"icon\"]', [\n\t\t\t\t\t\t\tis(varUtility(\"sidebar-width-icon\", \"3rem\")),\n\t\t\t\t\t\t\twhen(\"[data-sidebar-collapsed-hide]\", visuallyHidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"group-label\"]', visuallyHidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-badge\"]', hidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-sub\"]', hidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-button\"], [data-slot=\"menu-link\"]', [\n\t\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\t\tpi(\"0\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-slot=\"sidebar\"][data-collapsible=\"offcanvas\"][data-side=\"left\"]', [\n\t\t\t\t\t\t\ttranslateX(\"-100%\"),\n\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('[data-slot=\"sidebar\"][data-collapsible=\"offcanvas\"][data-side=\"right\"]', [\n\t\t\t\t\t\t\ttranslateX(\"100%\"),\n\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]),\n\t\t\t\t\tcontainer(PROVIDER_CONTAINER_NAME),\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 docked, edge-to-edge mobile substitute for {@link Sidebar}:\n * {@link Sidebar}'s nav content re-composed inside {@link Dialog}, docked\n * to `side` and opened via Invoker Commands, not a viewport check. A press\n * outside it closes it, which is the dismissal a touch device has.\n *\n * @param handle Runtime handle carrying the host `<dialog>`'s props, plus `side`.\n * @returns The render function producing the drawer's markup.\n * @example\n * <button commandfor=\"mobile-nav\" command=\"show-modal\" aria-label={t(\"nav.openMenu\")}>\n * \t<MenuIcon aria-hidden />\n * </button>\n * <Sidebar.MobileNav id=\"mobile-nav\" aria-label={t(\"nav.mainNavigation\")}>\n * \t<Sidebar.Header>{logo}</Sidebar.Header>\n * \t<Sidebar.Content>{nav}</Sidebar.Content>\n * </Sidebar.MobileNav>\n */\nSidebar.MobileNav = function SidebarMobileNav(handle: Handle<Sidebar.MobileNavProps>) {\n\treturn () => {\n\t\tlet { side, mix, ...rest } = handle.props;\n\t\tlet resolvedSide = side ?? DEFAULT_SIDE;\n\n\t\treturn (\n\t\t\t<Dialog\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"mobile-nav\"\n\t\t\t\tdata-side={resolvedSide}\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * A press outside closes the drawer, the way a drawer is dismissed on a phone: a modal\n\t\t\t\t\t * dialog otherwise closes only on Escape, which a touch device lacks. A consumer\n\t\t\t\t\t * holding the drawer open passes its own `closedby`.\n\t\t\t\t\t */\n\t\t\t\t\tattrs({ closedby: \"any\" }),\n\t\t\t\t\tfixed(),\n\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tm(\"0\"),\n\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\tp(\"0\"),\n\t\t\t\t\tmaxBs(\"none\"),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tis(varUtility(\"sidebar-width-mobile\", \"18rem\")),\n\t\t\t\t\tmaxIs(\"90vw\"),\n\t\t\t\t\t/** Gated on `[open]` so the UA's own `dialog:not([open])` hiding still applies. */\n\t\t\t\t\twhen(\"&[open]\", flex()),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t\tdata(\"side\", \"left\", [insLeft(\"0\"), safeAreaPadding(\"left\"), translateX(\"-100%\")]),\n\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"0\")),\n\t\t\t\t\tdata(\"side\", \"right\", [insRight(\"0\"), safeAreaPadding(\"right\"), translateX(\"100%\")]),\n\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"0\")),\n\t\t\t\t\twhen(\"@starting-style\", [\n\t\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"-100%\")),\n\t\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"100%\")),\n\t\t\t\t\t]),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\tpbs(\"env(safe-area-inset-top, 0px)\"),\n\t\t\t\t\tpbe(\"env(safe-area-inset-bottom, 0px)\"),\n\t\t\t\t\ttransition(\"transform, display, overlay\", {\n\t\t\t\t\t\tduration: durations.slow,\n\t\t\t\t\t\teasing: easings.decelerate,\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 rail's header slot: a `<header>` laying out its children in\n * a centered row, block-sized to a fixed height with a divider border\n * below it and safe-area padding on its block-start edge.\n *\n * @param handle Runtime handle carrying the host `<header>`'s props.\n * @returns The render function producing the header slot's markup.\n * @example\n * <Sidebar.Header>\n * \t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * </Sidebar.Header>\n */\nSidebar.Header = function SidebarHeader(handle: Handle<Sidebar.HeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"header\"\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * The slot paints the rail's background, so content scrolling behind a row held\n\t\t\t\t\t * against the viewport stays hidden; inheriting it matches whichever surface hosts\n\t\t\t\t\t * the row, the docked rail or the drawer.\n\t\t\t\t\t */\n\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tbs(\"4rem\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tborderEdge(\"block-end\", {\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\t\tpi(\"1rem\"),\n\t\t\t\t\tpbs(\"calc(0.5rem + env(safe-area-inset-top, 0px))\"),\n\t\t\t\t\tpbe(\"0.5rem\"),\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 rail's own scrollable nav region: {@link ScrollArea.Viewport}\n * laid out as a padded, gap-separated column that scrolls independently of\n * {@link Sidebar.Header} and {@link Sidebar.Footer} once it overflows.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the content region's markup.\n * @example\n * <Sidebar.Content>\n * \t<Sidebar.Group>\n * \t\t<Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n * \t\t<Sidebar.Menu>...</Sidebar.Menu>\n * \t</Sidebar.Group>\n * </Sidebar.Content>\n */\nSidebar.Content = function SidebarContent(handle: Handle<Sidebar.ContentProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ScrollArea.Viewport\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\tgap(\"1rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"1rem\"),\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 rail's footer slot: a `<footer>` laying out its children in\n * a centered row with a divider border above it and safe-area padding on\n * its block-end edge.\n *\n * @param handle Runtime handle carrying the host `<footer>`'s props.\n * @returns The render function producing the footer slot's markup.\n * @example\n * <Sidebar.Footer>\n * \t<Sidebar.MenuButton>{t(\"nav.account\")}</Sidebar.MenuButton>\n * </Sidebar.Footer>\n */\nSidebar.Footer = function SidebarFooter(handle: Handle<Sidebar.FooterProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<footer\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"footer\"\n\t\t\t\tmix={[\n\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tshrink(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tborderEdge(\"block-start\", {\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpbs(\"1rem\"),\n\t\t\t\t\tpbe(\"calc(1rem + env(safe-area-inset-bottom, 0px))\"),\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 flat navigation list: a `<nav>` stacking its {@link Sidebar.Item}\n * children in a column with a small gap, suited to a rail with a simple,\n * ungrouped set of links.\n *\n * @param handle Runtime handle carrying the host `<nav>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Sidebar.Nav aria-label={t(\"nav.mainNavigation\")}>\n * \t<Sidebar.Item href=\"/dashboard\" current>{t(\"nav.dashboard\")}</Sidebar.Item>\n * \t<Sidebar.Item href=\"/settings\">{t(\"nav.settings\")}</Sidebar.Item>\n * </Sidebar.Nav>\n */\nSidebar.Nav = function SidebarNav(handle: Handle<Sidebar.NavProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <nav {...rest} data-slot=\"nav\" mix={[vstack({ gap: \"0.25rem\" }), mix]} />;\n\t};\n};\n\n/**\n * Renders a single row inside {@link Sidebar.Nav}: a native `<a>` colored\n * through `data-color`, tinted once `aria-current` is set, matching\n * {@link Sidebar.MenuLink}; its focus ring always reads in that same color.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.Item href=\"/dashboard\" current>\n * \t<HomeIcon aria-hidden />\n * \t{t(\"nav.dashboard\")}\n * </Sidebar.Item>\n * @example\n * <Sidebar.Item href=\"/billing/cancel\" color=\"danger\" aria-current={pathname === \"/billing/cancel\" ? \"page\" : undefined}>\n * \t<XCircleIcon aria-hidden />\n * \t{t(\"nav.cancelPlan\")}\n * </Sidebar.Item>\n */\nSidebar.Item = function SidebarItem(handle: Handle<Sidebar.ItemProps>) {\n\treturn () => {\n\t\tlet { color, current, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_ITEM_COLOR;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(current, ariaCurrent);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t]),\n\t\t\t\t\tflex(),\n\t\t\t\t\tminBs(\"2.25rem\"),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\tweight(500),\n\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", [is(\"1rem\"), bs(\"1rem\"), shrink()]),\n\t\t\t\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\tgap(\"0.75rem\"),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:hover\", [bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.muted\")),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.emphasis\")),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"brand\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"brand.tint\"),\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"brand\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"success\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"success.tint\"),\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"success\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"warning.tint\"),\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"warning\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"danger\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"danger.tint\"),\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"danger\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\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 related cluster of {@link Sidebar.Menu} items: a `<section>`\n * stacking its children in a column, gaining a divider border and extra\n * space above itself whenever it follows another {@link Sidebar.Group}.\n *\n * @param handle Runtime handle carrying the host `<section>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <Sidebar.Group>\n * \t<Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n * \t<Sidebar.GroupContent>\n * \t\t<Sidebar.Menu>...</Sidebar.Menu>\n * \t</Sidebar.GroupContent>\n * </Sidebar.Group>\n */\nSidebar.Group = function SidebarGroup(handle: Handle<Sidebar.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<section\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\twhen(\"& + &\", [\n\t\t\t\t\t\tmbs(\"0.5rem\"),\n\t\t\t\t\t\tborderEdge(\"block-start\", {\n\t\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 60 },\n\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t]),\n\t\t\t\t\tgap(\"0.25rem\"),\n\t\t\t\t\twhen(\"& + &\", pbs(\"1rem\")),\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 {@link Sidebar.Group}'s label: a small, muted, uppercase heading\n * row, visually clipped once the ancestor {@link Sidebar} collapses to\n * icon-only, while staying announced to assistive technology.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the label's markup.\n * @example\n * <Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n */\nSidebar.GroupLabel = function SidebarGroupLabel(handle: Handle<Sidebar.GroupLabelProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-label\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"between\"),\n\t\t\t\t\tmbe(\"0.25rem\"),\n\t\t\t\t\tweight(600),\n\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\ttextTransform(\"uppercase\"),\n\t\t\t\t\ttracking(\"wider\"),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"0.375rem\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\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 small icon-only action button anchored to {@link Sidebar.GroupLabel}'s\n * trailing edge, its pointer target grown to `--ui-target-size`. In dev mode, an\n * action with no plain text and no `aria-label`/`aria-labelledby` logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the action's markup.\n * @example\n * <Sidebar.GroupLabel>\n * \t{t(\"nav.workspace\")}\n * \t<Sidebar.GroupAction aria-label={t(\"nav.addWorkspace\")}>\n * \t\t<PlusIcon aria-hidden />\n * \t</Sidebar.GroupAction>\n * </Sidebar.GroupLabel>\n */\nSidebar.GroupAction = function SidebarGroupAction(handle: Handle<Sidebar.GroupActionProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Sidebar.GroupAction: an icon-only action needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-action\"\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"1.25rem\"),\n\t\t\t\t\tbs(\"1.25rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Sidebar.Group}'s body slot: a `<div>` stacking its children\n * — typically a {@link Sidebar.Menu} — in a column with a small gap.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the body slot's markup.\n * @example\n * <Sidebar.GroupContent>\n * \t<Sidebar.Menu>...</Sidebar.Menu>\n * </Sidebar.GroupContent>\n */\nSidebar.GroupContent = function SidebarGroupContent(handle: Handle<Sidebar.GroupContentProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} data-slot=\"group-content\" mix={[vstack({ gap: \"0.125rem\" }), mix]} />;\n\t};\n};\n\n/**\n * Renders a list of nav rows: a native `<ul>` stacking {@link Sidebar.MenuItem}\n * children in a column with a small gap.\n *\n * @param handle Runtime handle carrying the host `<ul>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Sidebar.Menu>\n * \t<Sidebar.MenuItem>\n * \t\t<Sidebar.MenuLink href=\"/dashboard\">{t(\"nav.dashboard\")}</Sidebar.MenuLink>\n * \t</Sidebar.MenuItem>\n * </Sidebar.Menu>\n */\nSidebar.Menu = function SidebarMenu(handle: Handle<Sidebar.MenuProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ul\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu\"\n\t\t\t\tmix={[is(\"full\"), minIs(\"0\"), vstack({ gap: \"0.125rem\" }), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single row inside {@link Sidebar.Menu}: a relatively positioned\n * `<li>` whose own `:hover`/`:focus-within` state reveals a nested\n * {@link Sidebar.MenuAction} that stays invisible at rest.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuItem>\n * \t<Sidebar.MenuLink href=\"/inbox\">{t(\"nav.inbox\")}</Sidebar.MenuLink>\n * \t<Sidebar.MenuAction aria-label={t(\"nav.inboxSettings\")}>\n * \t\t<SettingsIcon aria-hidden />\n * \t</Sidebar.MenuAction>\n * </Sidebar.MenuItem>\n */\nSidebar.MenuItem = function SidebarMenuItem(handle: Handle<Sidebar.MenuItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-item\"\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tflex(),\n\t\t\t\t\t/**\n\t\t\t\t\t * A plain row centres what it holds and a row carrying a sub-menu stacks, putting the\n\t\t\t\t\t * nested list under it at full width. The selectors never match at once, so the layout\n\t\t\t\t\t * holds whichever order the cascade puts the pair in.\n\t\t\t\t\t */\n\t\t\t\t\twhen('&:not(:has([data-slot=\"menu-sub\"]))', items(\"center\")),\n\t\t\t\t\twhen('&:has([data-slot=\"menu-sub\"])', [flexCol(), items(\"stretch\")]),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t\"&:hover [data-slot='menu-action'], &:focus-within [data-slot='menu-action']\",\n\t\t\t\t\t\topacity(100),\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 native `<button>` row for an in-page action inside\n * {@link Sidebar.Menu}, sized through `data-size` and marked current via\n * `active`; its leading icon is muted, and a trailing label truncates.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuButton onClick={openCommandPalette}>\n * \t<SearchIcon aria-hidden />\n * \t<span data-sidebar-collapsed-hide>{t(\"nav.search\")}</span>\n * </Sidebar.MenuButton>\n */\nSidebar.MenuButton = function SidebarMenuButton(handle: Handle<Sidebar.MenuButtonProps>) {\n\treturn () => {\n\t\tlet { size, active, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_MENU_BUTTON_SIZE;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-button\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuRowMixins(),\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 native `<a>` row for navigation inside {@link Sidebar.Menu},\n * visually identical to {@link Sidebar.MenuButton}. `active` sets\n * `aria-current=\"page\"` when unset, with styling reading that attribute directly.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuLink href=\"/dashboard\" active>\n * \t<HomeIcon aria-hidden />\n * \t<span data-sidebar-collapsed-hide>{t(\"nav.dashboard\")}</span>\n * </Sidebar.MenuLink>\n */\nSidebar.MenuLink = function SidebarMenuLink(handle: Handle<Sidebar.MenuLinkProps>) {\n\treturn () => {\n\t\tlet { size, active, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_MENU_BUTTON_SIZE;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(active, ariaCurrent);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"menu-link\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Shared `@sdxc/u` mixins for {@link Sidebar.MenuButton} and\n * {@link Sidebar.MenuLink}, factored out since the two differ only in host\n * element and how their current/active state is expressed.\n */\nfunction menuRowMixins() {\n\treturn [\n\t\tflex(),\n\t\tis(\"full\"),\n\t\tminIs(\"0\"),\n\t\titems(\"center\"),\n\t\toverflow(\"hidden\"),\n\t\ttextAlign(\"start\"),\n\t\tweight(500),\n\t\ttextDecoration(\"none\"),\n\t\tfontSize(\"sm\"),\n\t\toutlineStyle(\"none\"),\n\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\tis(\"1rem\"),\n\t\t\tbs(\"1rem\"),\n\t\t\tshrink(),\n\t\t]),\n\t\twhen(\"& > span\", truncate()),\n\t\tdata(\"size\", \"sm\", [\n\t\t\tminBs(\"1.75rem\"),\n\t\t\tpb(\"0.375rem\"),\n\t\t\tfontSize(\"xs\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\t\tis(\"0.875rem\"),\n\t\t\t\tbs(\"0.875rem\"),\n\t\t\t]),\n\t\t]),\n\t\tdata(\"size\", \"md\", minBs(\"2.25rem\")),\n\t\tdata(\"size\", \"lg\", [\n\t\t\tminBs(\"2.75rem\"),\n\t\t\tpb(\"0.625rem\"),\n\t\t\tfontSize(\"base\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\t\tis(\"1.25rem\"),\n\t\t\t\tbs(\"1.25rem\"),\n\t\t\t]),\n\t\t]),\n\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\tgap(\"0.75rem\"),\n\t\trounded(\"lg\"),\n\t\tpi(\"0.5rem\"),\n\t\tpb(\"0.5rem\"),\n\t\tfg(\"neutral\"),\n\t\ttransition(\n\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t),\n\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", fg(\"neutral.muted\")),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', [\n\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\tfg(\"neutral.emphasis\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", fg(\"neutral.emphasis\")),\n\t\t]),\n\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t];\n}\n\n/**\n * Renders a small icon-only action anchored to {@link Sidebar.MenuItem}'s trailing\n * edge, revealed by `showOnHover`, with its pointer target grown to `--ui-target-size`.\n * In dev mode, an action with no accessible name logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the action's markup.\n * @example\n * <Sidebar.MenuAction aria-label={t(\"nav.inboxSettings\")}>\n * \t<SettingsIcon aria-hidden />\n * </Sidebar.MenuAction>\n * @example\n * <Sidebar.MenuAction showOnHover={false} aria-label={t(\"nav.starred\")}>\n * \t<StarIcon aria-hidden />\n * </Sidebar.MenuAction>\n */\nSidebar.MenuAction = function SidebarMenuAction(handle: Handle<Sidebar.MenuActionProps>) {\n\treturn () => {\n\t\tlet { showOnHover, children, mix, ...rest } = handle.props;\n\t\tlet resolvedShowOnHover = showOnHover ?? DEFAULT_SHOW_ON_HOVER;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Sidebar.MenuAction: an icon-only action needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-action\"\n\t\t\t\tdata-show-on-hover={resolvedShowOnHover ? undefined : \"false\"}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinsIe(\"0.375rem\"),\n\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\ttranslateProperty(\"0 -50%\"),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"1.5rem\"),\n\t\t\t\t\tbs(\"1.5rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\topacity(0),\n\t\t\t\t\tfocusVisible(opacity(100)),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\tdata(\"show-on-hover\", \"false\", opacity(100)),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-pressed\"), fg(\"neutral\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders a small count or status pill pinned to the trailing edge of a\n * {@link Sidebar.MenuButton} or {@link Sidebar.MenuLink} row, hidden once\n * the ancestor {@link Sidebar} collapses to its icon-only rail.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the pill's markup.\n * @example\n * <Sidebar.MenuLink href=\"/inbox\">\n * \t{t(\"nav.inbox\")}\n * \t<Sidebar.MenuBadge>24</Sidebar.MenuBadge>\n * </Sidebar.MenuLink>\n */\nSidebar.MenuBadge = function SidebarMenuBadge(handle: Handle<Sidebar.MenuBadgeProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-badge\"\n\t\t\t\tmix={[\n\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\tweight(600),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(\"0.375rem\"),\n\t\t\t\t\tpb(\"0.125rem\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral\"),\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 static loading placeholder shaped like {@link Sidebar.MenuButton}:\n * an optional icon-shaped {@link Skeleton} block followed by a text-shaped\n * one; compose `pulse()` or `shimmer()` through `mix` for a loading cue.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the placeholder's markup.\n * @example\n * <Sidebar.MenuSkeleton showIcon />\n * @example\n * <Sidebar.MenuSkeleton style={{ inlineSize: \"70%\" }} />\n */\nSidebar.MenuSkeleton = function SidebarMenuSkeleton(handle: Handle<Sidebar.MenuSkeletonProps>) {\n\treturn () => {\n\t\tlet { showIcon, mix, ...rest } = handle.props;\n\t\tlet resolvedShowIcon = showIcon ?? DEFAULT_SHOW_ICON;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-skeleton\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tbs(\"2.25rem\"),\n\t\t\t\t\tgap(\"0.75rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{resolvedShowIcon && (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tdata-slot=\"menu-skeleton-icon\"\n\t\t\t\t\t\tmix={[is(\"1rem\"), bs(\"1rem\"), shrink(), rounded(\"sm\"), bg(\"neutral.border\")]}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<span\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tdata-slot=\"menu-skeleton-text\"\n\t\t\t\t\tmix={[bs(\"1rem\"), grow(), is(\"60%\"), rounded(\"md\"), bg(\"neutral.border\")]}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders a nested list of sub-rows beneath a {@link Sidebar.MenuItem}: a\n * `<ul>` indented from and bordered against the rail's inline-start edge,\n * hidden once the ancestor {@link Sidebar} collapses to its icon-only rail.\n *\n * @param handle Runtime handle carrying the host `<ul>`'s props.\n * @returns The render function producing the nested list's markup.\n * @example\n * <Sidebar.MenuSub>\n * \t<Sidebar.MenuSubItem>\n * \t\t<Sidebar.MenuSubLink href=\"/settings/profile\">{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n * \t</Sidebar.MenuSubItem>\n * </Sidebar.MenuSub>\n */\nSidebar.MenuSub = function SidebarMenuSub(handle: Handle<Sidebar.MenuSubProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ul\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-sub\"\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tmis(\"1rem\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tborderEdge(\"inline-start\", { width: 1, style: \"solid\" }),\n\t\t\t\t\tpis(\"0.625rem\"),\n\t\t\t\t\tgap(\"0.125rem\"),\n\t\t\t\t\tborder(\"neutral\"),\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 single row inside {@link Sidebar.MenuSub}: a plain `<li>`.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubItem>\n * \t<Sidebar.MenuSubLink href=\"/settings/profile\">{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n * </Sidebar.MenuSubItem>\n */\nSidebar.MenuSubItem = function SidebarMenuSubItem(handle: Handle<Sidebar.MenuSubItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <li {...rest} data-slot=\"menu-sub-item\" mix={[flex(), items(\"center\"), mix]} />;\n\t};\n};\n\n/**\n * Renders a native `<button>` row for an in-page action inside\n * {@link Sidebar.MenuSub}, smaller and more muted than\n * {@link Sidebar.MenuButton}, marked current through `active`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubButton onClick={runQuickAction}>{t(\"nav.markAllRead\")}</Sidebar.MenuSubButton>\n */\nSidebar.MenuSubButton = function SidebarMenuSubButton(handle: Handle<Sidebar.MenuSubButtonProps>) {\n\treturn () => {\n\t\tlet { active, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-sub-button\"\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuSubRowMixins(),\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 native `<a>` row for navigation inside {@link Sidebar.MenuSub},\n * visually identical to {@link Sidebar.MenuSubButton}. `active` sets\n * `aria-current=\"page\"` when `aria-current` is otherwise unset.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubLink href=\"/settings/profile\" active>{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n */\nSidebar.MenuSubLink = function SidebarMenuSubLink(handle: Handle<Sidebar.MenuSubLinkProps>) {\n\treturn () => {\n\t\tlet { active, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(active, ariaCurrent);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"menu-sub-link\"\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuSubRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Shared `@sdxc/u` mixins for {@link Sidebar.MenuSubButton} and\n * {@link Sidebar.MenuSubLink}.\n */\nfunction menuSubRowMixins() {\n\treturn [\n\t\tflex(),\n\t\tminBs(\"2rem\"),\n\t\tis(\"full\"),\n\t\titems(\"center\"),\n\t\ttextAlign(\"start\"),\n\t\ttextDecoration(\"none\"),\n\t\tfontSize(\"sm\"),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', weight(500)),\n\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\tgap(\"0.5rem\"),\n\t\trounded(\"lg\"),\n\t\tpi(\"0.625rem\"),\n\t\tpb(\"0.375rem\"),\n\t\tfg(\"neutral.muted\"),\n\t\ttransition(\n\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t),\n\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', [\n\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\tfg(\"neutral.emphasis\"),\n\t\t]),\n\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t];\n}\n\n/**\n * Renders a thin drag-styled affordance along {@link Sidebar}'s own edge,\n * toggling {@link Sidebar.Trigger}'s checkbox through a native `<label>`\n * association; marked `aria-hidden` since that checkbox is the accessible control.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the rail's markup.\n * @example\n * <Sidebar>\n * \t<Sidebar.Header>...</Sidebar.Header>\n * \t<Sidebar.Rail htmlFor=\"app-sidebar-toggle\" />\n * </Sidebar>\n */\nSidebar.Rail = function SidebarRail(handle: Handle<Sidebar.RailProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"rail\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ \"aria-hidden\": \"true\" }),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tis(\"1rem\"),\n\t\t\t\t\tz(20),\n\t\t\t\t\thidden(),\n\t\t\t\t\tcursor(\"col-resize\"),\n\t\t\t\t\twhen('[data-side=\"left\"] &', insRight(\"-1rem\")),\n\t\t\t\t\twhen('[data-side=\"right\"] &', insLeft(\"-1rem\")),\n\t\t\t\t\tafter([\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tis(\"2px\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\ttranslateProperty(\"-50% 0\"),\n\t\t\t\t\t\tpseudoContent('\"\"'),\n\t\t\t\t\t\ttransitionProperty(\"background-color\"),\n\t\t\t\t\t\ttransitionDuration(\"150ms\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(WIDE_SHELL_QUERY, [flex(), items(\"center\"), justify(\"center\")]),\n\t\t\t\t\thover(after(bg(\"neutral.border\"))),\n\t\t\t\t\twhen(\"&:active\", after(bg(\"brand.ring\"))),\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 collapse toggle: a native, keyboard-reachable `<input type=\"checkbox\">`\n * in a button-styled `<label>` whose pointer target grows to `--ui-target-size`; its\n * `:checked` state drives every collapse rule in {@link Sidebar.Provider}.\n *\n * @param handle Runtime handle carrying the host checkbox's props.\n * @returns The render function producing the toggle's markup.\n * @example\n * <Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * @example\n * <Sidebar.Trigger id=\"app-sidebar-toggle\" defaultChecked aria-label={t(\"nav.toggleSidebar\")} />\n */\nSidebar.Trigger = function SidebarTrigger(handle: Handle<Sidebar.TriggerProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:has(input:focus-visible)\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"2rem\"),\n\t\t\t\t\tbs(\"2rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\twhen(\"& > svg\", [is(\"1rem\"), bs(\"1rem\")]),\n\t\t\t\t\twhen(\"&:has(input:disabled)\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<PanelLeftIcon />\n\t\t\t\t<input type=\"checkbox\" {...rest} data-slot=\"toggle\" mix={[visuallyHidden(), mix]} />\n\t\t\t</label>\n\t\t);\n\t};\n};\n\n/**\n * Renders the shell's main content region: {@link ScrollArea.Viewport}\n * laid out as a growing flex column that resizes as {@link Sidebar}\n * collapses or expands, declaring {@link INSET_CONTAINER_NAME} for nested sizing.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the inset's markup.\n * @example\n * <Sidebar.Inset>\n * \t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * \t<main>{children}</main>\n * </Sidebar.Inset>\n */\nSidebar.Inset = function SidebarInset(handle: Handle<Sidebar.InsetProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ScrollArea.Viewport\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"inset\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tminIs(\"0\"),\n\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\tcontainer(INSET_CONTAINER_NAME),\n\t\t\t\t\tbg(\"neutral.tint\"),\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 hairline divider between two stretches of rail content:\n * identical to {@link Separator}, with the small block-axis and inline-axis\n * margins {@link Sidebar}'s own content regions expect around one.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the divider's markup.\n * @example\n * <Sidebar.Group>...</Sidebar.Group>\n * <Sidebar.Separator />\n * <Sidebar.Group>...</Sidebar.Group>\n */\nSidebar.Separator = function SidebarSeparator(handle: Handle<Sidebar.SeparatorProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <Separator {...rest} data-slot=\"separator\" mix={[m(\"0.5rem\"), mix]} />;\n\t};\n};\n"
|
|
14
|
+
"content": "/**\n * An application shell's primary navigation rail, composed from a layout\n * root, a collapsible rail, a main-content inset, and a family of\n * group/menu/item parts for organizing links. Collapsing rides a single\n * checkbox's native `:checked` state, so the whole shell works with zero\n * library JavaScript.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { PanelLeftIcon } from \"@sdxc/icons\";\nimport { visuallyHidden } from \"@sdxc/u/a11y\";\nimport { bg, border, borderEdge, colorMix, fg, outline, outlineStyle } from \"@sdxc/u/color\";\nimport {\n\tbackdropBlur,\n\tbackdropSaturate,\n\topacity,\n\trounded,\n\tshadow,\n\ttransition,\n\ttransitionBehavior,\n\ttransitionDuration,\n\ttransitionProperty,\n} from \"@sdxc/u/effects\";\nimport { cursor, pseudoContent, userSelect, willChange } from \"@sdxc/u/general\";\nimport { var as varUtility } from \"@sdxc/u/general/var\";\nimport {\n\tabsolute,\n\tcontainer,\n\tfixed,\n\tflex,\n\tflexCol,\n\tgap,\n\tgrow,\n\thidden,\n\tinlineFlex,\n\tinsBe,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\tinsLeft,\n\tinsRight,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n\tvstack,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { media, supports } from \"@sdxc/u/responsive\";\nimport {\n\tbs,\n\tis,\n\tm,\n\tmaxBs,\n\tmaxIs,\n\tmbe,\n\tmbs,\n\tminBs,\n\tminIs,\n\tmis,\n\tp,\n\tpb,\n\tpbe,\n\tpbs,\n\tpi,\n\tpis,\n\tsafeAreaPadding,\n} from \"@sdxc/u/size\";\nimport { z } from \"@sdxc/u/stacking\";\nimport { after, data, focusVisible, hover, when } from \"@sdxc/u/state\";\nimport { scaleProperty, translateProperty, translateX } from \"@sdxc/u/transform\";\nimport {\n\tfontSize,\n\ttabularNums,\n\ttextAlign,\n\ttextDecoration,\n\ttextTransform,\n\ttracking,\n\ttruncate,\n\tweight,\n} from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { durations, easings } from \"@sdxc/ui/animations\";\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { warnIfNoAccessibleName } from \"@sdxc/ui/utils\";\n\nimport { Dialog } from \"@sdxc/ui/dialog\";\nimport { ScrollArea } from \"@sdxc/ui/scroll-area\";\nimport { Separator } from \"@sdxc/ui/separator\";\n\n/** Visual treatment {@link Sidebar} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: Sidebar.Variant = \"sidebar\";\n\n/** Collapse behavior {@link Sidebar} falls back to when `collapsible` is omitted. */\nconst DEFAULT_COLLAPSIBLE: Sidebar.Collapsible = \"offcanvas\";\n\n/**\n * Physical edge {@link Sidebar} docks against, and the edge\n * {@link Sidebar.MobileNav} slides in from, when `side` is omitted.\n */\nconst DEFAULT_SIDE: Sidebar.Side = \"left\";\n\n/** Semantic color role {@link Sidebar.Item} falls back to when `color` is omitted. */\nconst DEFAULT_ITEM_COLOR: Sidebar.Color = \"neutral\";\n\n/** Size variant {@link Sidebar.MenuButton} and {@link Sidebar.MenuLink} fall back to when `size` is omitted. */\nconst DEFAULT_MENU_BUTTON_SIZE: Sidebar.MenuButtonSize = \"md\";\n\n/** Whether {@link Sidebar.MenuAction} stays hidden until its row is hovered or focused, when `showOnHover` is omitted. */\nconst DEFAULT_SHOW_ON_HOVER = true;\n\n/** Whether {@link Sidebar.MenuSkeleton} renders a leading icon placeholder, when `showIcon` is omitted. */\nconst DEFAULT_SHOW_ICON = false;\n\n/**\n * Named container {@link Sidebar.Provider} declares on its own host, so\n * {@link Sidebar} and {@link Sidebar.Rail} can query the shell's overall\n * width for room to show a persistent rail, regardless of nesting depth.\n */\nconst PROVIDER_CONTAINER_NAME = \"ui-sidebar-provider\";\n\n/**\n * Named container {@link Sidebar.Inset} declares on its own host, so content\n * rendered inside it — a Card, a Table, anything sized by its surroundings —\n * responds to the inset's own available width as the rail expands or collapses.\n */\nconst INSET_CONTAINER_NAME = \"ui-sidebar-inset\";\n\n/**\n * Container query matching a shell wide enough to host the persistent rail\n * alongside its inset; below this width, {@link Sidebar}'s `\"icon\"` and\n * `\"offcanvas\"` collapse modes step aside for {@link Sidebar.MobileNav}.\n */\nconst WIDE_SHELL_QUERY = `@container ${PROVIDER_CONTAINER_NAME} (min-width: 48rem)`;\n\n/**\n * Selector matching {@link Sidebar.Trigger}'s own checkbox input once it\n * carries the platform's native `:checked` state — the single source of\n * truth every collapse-driven rule in {@link Sidebar} reads from.\n */\nconst TOGGLE_CHECKED_SELECTOR = '[data-slot=\"toggle\"]:checked';\n\n/**\n * Resolves the `aria-current` value an anchor-based nav part renders with:\n * an explicit `aria-current` always wins, and a `current`/`active`\n * shorthand of `true` falls back to `\"page\"` when nothing else was given.\n */\nfunction resolveAriaCurrent(\n\tcurrent: boolean | undefined,\n\tariaCurrent: TagProps<\"a\">[\"aria-current\"],\n): TagProps<\"a\">[\"aria-current\"] {\n\treturn ariaCurrent ?? (current ? \"page\" : undefined);\n}\n\n/**\n * Prop types for {@link Sidebar} and its compound parts.\n */\nexport namespace Sidebar {\n\t/**\n\t * Visual treatment the rail renders with: `\"sidebar\"` sits flush against\n\t * its edge, `\"floating\"` insets itself with a margin, a rounded, shadowed\n\t * panel, and a blurred backdrop; `\"inset\"` renders the same panel without blur.\n\t */\n\texport type Variant = \"sidebar\" | \"floating\" | \"inset\";\n\n\t/**\n\t * How the rail collapses: `\"none\"` always renders at full width, `\"icon\"`\n\t * narrows to an icon-only rail, and `\"offcanvas\"` narrows to nothing. Every\n\t * mode but `\"none\"` yields to {@link Sidebar.MobileNav} on narrow shells.\n\t */\n\texport type Collapsible = \"none\" | \"offcanvas\" | \"icon\";\n\n\t/**\n\t * Physical edge of the shell the rail docks against and, for\n\t * {@link Sidebar.MobileNav}, slides in from. `\"left\"` and `\"right\"` name\n\t * that edge regardless of `dir`, staying pinned to one physical side.\n\t */\n\texport type Side = \"left\" | \"right\";\n\n\t/**\n\t * Semantic color role {@link Sidebar.Item} renders its current-page\n\t * treatment in, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Size variant controlling {@link Sidebar.MenuButton}'s and\n\t * {@link Sidebar.MenuLink}'s padding, font size, and icon size.\n\t */\n\texport type MenuButtonSize = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough. Establishes\n\t * the shell's row layout — {@link Sidebar} beside {@link Sidebar.Inset} —\n\t * plus the {@link PROVIDER_CONTAINER_NAME} container the collapse rules query.\n\t */\n\texport interface ProviderProps extends TagProps<\"div\"> {\n\t\t/** {@link Sidebar} and {@link Sidebar.Inset}, in either order. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every native `<aside>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface Props extends TagProps<\"aside\"> {\n\t\t/** Visual treatment. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Collapse behavior. Defaults to {@link DEFAULT_COLLAPSIBLE}. */\n\t\tcollapsible?: Collapsible;\n\t\t/** Physical docking edge. Defaults to {@link DEFAULT_SIDE}. */\n\t\tside?: Side;\n\t}\n\n\t/**\n\t * Every prop {@link Dialog.Props} accepts, plus `side`. `id` stays the id\n\t * a trigger elsewhere on the page opens this drawer with — see\n\t * {@link Dialog.Props} for the full Invoker Commands contract.\n\t */\n\texport interface MobileNavProps extends Dialog.Props {\n\t\t/** Physical edge to dock against and slide in from. Defaults to {@link DEFAULT_SIDE}. */\n\t\tside?: Side;\n\t}\n\n\t/**\n\t * Every native `<header>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface HeaderProps extends TagProps<\"header\"> {}\n\n\t/**\n\t * Every prop {@link ScrollArea.ViewportProps} accepts, unchanged.\n\t */\n\texport interface ContentProps extends ScrollArea.ViewportProps {}\n\n\t/**\n\t * Every native `<footer>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface FooterProps extends TagProps<\"footer\"> {}\n\n\t/**\n\t * Every native `<nav>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface NavProps extends TagProps<\"nav\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.Item}, built as an intersection because\n\t * the underlying anchor prop type is a union keyed on `href` — the\n\t * accessible-anchor contract restricts `role` once `href` is present.\n\t */\n\texport type ItemProps = TagProps<\"a\"> & {\n\t\t/** Destination the item navigates to. */\n\t\thref: string;\n\t\t/** Semantic color role applied once the item is current. Defaults to {@link DEFAULT_ITEM_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tcurrent?: boolean;\n\t};\n\n\t/**\n\t * Every native `<section>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupProps extends TagProps<\"section\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupLabelProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<button>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupActionProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface GroupContentProps extends TagProps<\"div\"> {}\n\n\t/**\n\t * Every native `<ul>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuProps extends TagProps<\"ul\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, plus the `mix` passthrough. Its own\n\t * `:hover`/`:focus-within` state reveals a nested {@link Sidebar.MenuAction}\n\t * that would otherwise stay hidden.\n\t */\n\texport interface MenuItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuButton}.\n\t */\n\texport interface MenuButtonProps extends TagProps<\"button\"> {\n\t\t/** Size variant. Defaults to {@link DEFAULT_MENU_BUTTON_SIZE}. */\n\t\tsize?: MenuButtonSize;\n\t\t/** Marks the row as the current selection, independent of navigation. */\n\t\tactive?: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuLink}. Built as an intersection for\n\t * the same reason as {@link Sidebar.ItemProps}.\n\t */\n\texport type MenuLinkProps = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/** Size variant. Defaults to {@link DEFAULT_MENU_BUTTON_SIZE}. */\n\t\tsize?: MenuButtonSize;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tactive?: boolean;\n\t};\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuAction}.\n\t */\n\texport interface MenuActionProps extends TagProps<\"button\"> {\n\t\t/**\n\t\t * Whether the control stays invisible until its ancestor\n\t\t * {@link Sidebar.MenuItem} is hovered or focused. Defaults to\n\t\t * {@link DEFAULT_SHOW_ON_HOVER}; set `false` to keep it always visible.\n\t\t */\n\t\tshowOnHover?: boolean;\n\t}\n\n\t/**\n\t * Every native `<span>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuBadgeProps extends TagProps<\"span\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSkeleton}.\n\t */\n\texport interface MenuSkeletonProps extends TagProps<\"div\"> {\n\t\t/** Whether to render a leading icon-shaped placeholder. Defaults to {@link DEFAULT_SHOW_ICON}. */\n\t\tshowIcon?: boolean;\n\t}\n\n\t/**\n\t * Every native `<ul>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuSubProps extends TagProps<\"ul\"> {}\n\n\t/**\n\t * Every native `<li>` attribute, plus the `mix` passthrough.\n\t */\n\texport interface MenuSubItemProps extends TagProps<\"li\"> {}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSubButton}.\n\t */\n\texport interface MenuSubButtonProps extends TagProps<\"button\"> {\n\t\t/** Marks the row as the current selection, independent of navigation. */\n\t\tactive?: boolean;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.MenuSubLink}. Built as an intersection\n\t * for the same reason as {@link Sidebar.ItemProps}.\n\t */\n\texport type MenuSubLinkProps = TagProps<\"a\"> & {\n\t\t/** Destination the link navigates to. */\n\t\thref: string;\n\t\t/** Shorthand setting `aria-current=\"page\"` when true and `aria-current` is otherwise unset. */\n\t\tactive?: boolean;\n\t};\n\n\t/**\n\t * Props accepted by {@link Sidebar.Rail}: every native `<label>` attribute\n\t * except `htmlFor`, narrowed to required since it names the id of\n\t * {@link Sidebar.Trigger}'s own checkbox, the control this rail mirrors.\n\t */\n\texport interface RailProps extends Omit<TagProps<\"label\">, \"htmlFor\"> {\n\t\t/** Id of the {@link Sidebar.Trigger} checkbox this rail toggles. */\n\t\thtmlFor: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link Sidebar.Trigger}: every native `<input>`\n\t * attribute except `type` and `role`, fixed by the platform's checkbox\n\t * semantics, so `id`, `checked`, `defaultChecked`, and `disabled` all work.\n\t */\n\texport interface TriggerProps extends Omit<TagProps<\"input\">, \"type\" | \"role\"> {\n\t\t/**\n\t\t * Accessible label for the icon-only control — required, since the\n\t\t * control carries no visible text for assistive technology to read.\n\t\t */\n\t\t\"aria-label\": string;\n\t}\n\n\t/**\n\t * Every prop {@link ScrollArea.ViewportProps} accepts, unchanged.\n\t */\n\texport interface InsetProps extends ScrollArea.ViewportProps {}\n\n\t/**\n\t * Every prop {@link Separator.Props} accepts, unchanged.\n\t */\n\texport interface SeparatorProps extends Separator.Props {}\n}\n\n/**\n * Renders the rail itself: a native `<aside>` styled through its `data-*`\n * attributes, with collapse rules keyed off {@link Sidebar.Provider}'s `:has()`\n * state and declared after its base size, so both directions animate.\n *\n * @param handle Runtime handle carrying the host `<aside>`'s props.\n * @returns The render function producing the rail's markup.\n * @example\n * <Sidebar.Provider>\n * \t<Sidebar variant=\"floating\" collapsible=\"icon\" side=\"right\">\n * \t\t<Sidebar.Header>{logo}</Sidebar.Header>\n * \t\t<Sidebar.Content>{nav}</Sidebar.Content>\n * \t</Sidebar>\n * \t<Sidebar.Inset>{children}</Sidebar.Inset>\n * </Sidebar.Provider>\n */\nexport function Sidebar(handle: Handle<Sidebar.Props>) {\n\treturn () => {\n\t\tlet { variant, collapsible, side, mix, ...rest } = handle.props;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet resolvedCollapsible = collapsible ?? DEFAULT_COLLAPSIBLE;\n\t\tlet resolvedSide = side ?? DEFAULT_SIDE;\n\n\t\treturn (\n\t\t\t<aside\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"sidebar\"\n\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\tdata-collapsible={resolvedCollapsible}\n\t\t\t\tdata-side={resolvedSide}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tis(varUtility(\"sidebar-width\", \"16rem\")),\n\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\tdata(\"side\", \"left\", [\n\t\t\t\t\t\tborderEdge(\"right\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\tsafeAreaPadding(\"left\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"side\", \"right\", [\n\t\t\t\t\t\tborderEdge(\"left\", { width: 1, style: \"solid\", color: \"neutral\" }),\n\t\t\t\t\t\tsafeAreaPadding(\"right\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"floating\", [\n\t\t\t\t\t\tm(\"0.5rem\"),\n\t\t\t\t\t\tshadow(\"lg\"),\n\t\t\t\t\t\tsupports(\n\t\t\t\t\t\t\t\"(backdrop-filter: blur(0))\",\n\t\t\t\t\t\t\tmedia(\"(prefers-reduced-transparency: no-preference)\", [\n\t\t\t\t\t\t\t\tborder(\n\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tbg(\n\t\t\t\t\t\t\t\t\tcolorMix(\n\t\t\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-bg-tint)\", weight: 95 },\n\t\t\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tbackdropBlur(\"md\"),\n\t\t\t\t\t\t\t\tbackdropSaturate(1.4),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"variant\", \"inset\", shadow(\"base\")),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t`@container ${PROVIDER_CONTAINER_NAME} (max-width: 47.9375rem)`,\n\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"], &[data-collapsible=\"offcanvas\"]', hidden()),\n\t\t\t\t\t),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\ttransition(\"inline-size, transform\", {\n\t\t\t\t\t\tduration: durations.normal,\n\t\t\t\t\t\teasing: easings.standard,\n\t\t\t\t\t}),\n\t\t\t\t\tdata(\"variant\", \"floating\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\tdata(\"variant\", \"inset\", [rounded(\"xl\"), border({ color: \"neutral\", width: 1 })]),\n\t\t\t\t\twhen(`[data-slot=\"provider\"]:has(${TOGGLE_CHECKED_SELECTOR}) &`, [\n\t\t\t\t\t\twhen('&[data-collapsible=\"icon\"]', [\n\t\t\t\t\t\t\tis(varUtility(\"sidebar-width-icon\", \"3rem\")),\n\t\t\t\t\t\t\twhen(\"[data-sidebar-collapsed-hide]\", visuallyHidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"group-label\"]', visuallyHidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-badge\"]', hidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-sub\"]', hidden()),\n\t\t\t\t\t\t\twhen('[data-slot=\"menu-button\"], [data-slot=\"menu-link\"]', [\n\t\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\t\tpi(\"0\"),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-collapsible=\"offcanvas\"][data-side=\"left\"]', [\n\t\t\t\t\t\t\ttranslateX(\"-100%\"),\n\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-collapsible=\"offcanvas\"][data-side=\"right\"]', [\n\t\t\t\t\t\t\ttranslateX(\"100%\"),\n\t\t\t\t\t\t\tis(\"0\"),\n\t\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\t\tborder({ width: \"0\", noStyleDefault: true }),\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 shell's layout root: a flex row placing {@link Sidebar} beside\n * {@link Sidebar.Inset}, whose subtree {@link Sidebar} watches for\n * {@link Sidebar.Trigger}'s checkbox reaching `:checked`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the shell's markup.\n * @example\n * <Sidebar.Provider>\n * \t<Sidebar collapsible=\"icon\">\n * \t\t<Sidebar.Header>\n * \t\t\t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * \t\t</Sidebar.Header>\n * \t\t<Sidebar.Content>\n * \t\t\t<Sidebar.Menu>\n * \t\t\t\t<Sidebar.MenuItem>\n * \t\t\t\t\t<Sidebar.MenuLink href=\"/dashboard\" active>\n * \t\t\t\t\t\t<HomeIcon aria-hidden />\n * \t\t\t\t\t\t<span data-sidebar-collapsed-hide>{t(\"nav.dashboard\")}</span>\n * \t\t\t\t\t</Sidebar.MenuLink>\n * \t\t\t\t</Sidebar.MenuItem>\n * \t\t\t</Sidebar.Menu>\n * \t\t</Sidebar.Content>\n * \t\t<Sidebar.Rail htmlFor=\"app-sidebar-toggle\" />\n * \t</Sidebar>\n * \t<Sidebar.Inset>{children}</Sidebar.Inset>\n * </Sidebar.Provider>\n */\nSidebar.Provider = function SidebarProvider(handle: Handle<Sidebar.ProviderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"provider\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"stretch\"),\n\t\t\t\t\tminBs(\"100dvh\"),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tcontainer(PROVIDER_CONTAINER_NAME),\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 docked, edge-to-edge mobile substitute for {@link Sidebar}:\n * {@link Sidebar}'s nav content re-composed inside {@link Dialog}, docked\n * to `side` and opened via Invoker Commands, not a viewport check. A press\n * outside it closes it, which is the dismissal a touch device has.\n *\n * @param handle Runtime handle carrying the host `<dialog>`'s props, plus `side`.\n * @returns The render function producing the drawer's markup.\n * @example\n * <button commandfor=\"mobile-nav\" command=\"show-modal\" aria-label={t(\"nav.openMenu\")}>\n * \t<MenuIcon aria-hidden />\n * </button>\n * <Sidebar.MobileNav id=\"mobile-nav\" aria-label={t(\"nav.mainNavigation\")}>\n * \t<Sidebar.Header>{logo}</Sidebar.Header>\n * \t<Sidebar.Content>{nav}</Sidebar.Content>\n * </Sidebar.MobileNav>\n */\nSidebar.MobileNav = function SidebarMobileNav(handle: Handle<Sidebar.MobileNavProps>) {\n\treturn () => {\n\t\tlet { side, mix, ...rest } = handle.props;\n\t\tlet resolvedSide = side ?? DEFAULT_SIDE;\n\n\t\treturn (\n\t\t\t<Dialog\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"mobile-nav\"\n\t\t\t\tdata-side={resolvedSide}\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * A press outside closes the drawer, the way a drawer is dismissed on a phone: a modal\n\t\t\t\t\t * dialog otherwise closes only on Escape, which a touch device lacks. A consumer\n\t\t\t\t\t * holding the drawer open passes its own `closedby`.\n\t\t\t\t\t */\n\t\t\t\t\tattrs({ closedby: \"any\" }),\n\t\t\t\t\tfixed(),\n\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tm(\"0\"),\n\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\tp(\"0\"),\n\t\t\t\t\tmaxBs(\"none\"),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tis(varUtility(\"sidebar-width-mobile\", \"18rem\")),\n\t\t\t\t\tmaxIs(\"90vw\"),\n\t\t\t\t\t/** Gated on `[open]` so the UA's own `dialog:not([open])` hiding still applies. */\n\t\t\t\t\twhen(\"&[open]\", flex()),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\twillChange(\"transform\"),\n\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t\tdata(\"side\", \"left\", [insLeft(\"0\"), safeAreaPadding(\"left\"), translateX(\"-100%\")]),\n\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"0\")),\n\t\t\t\t\tdata(\"side\", \"right\", [insRight(\"0\"), safeAreaPadding(\"right\"), translateX(\"100%\")]),\n\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"0\")),\n\t\t\t\t\twhen(\"@starting-style\", [\n\t\t\t\t\t\twhen('&[data-side=\"left\"][open]', translateX(\"-100%\")),\n\t\t\t\t\t\twhen('&[data-side=\"right\"][open]', translateX(\"100%\")),\n\t\t\t\t\t]),\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionProperty(\"none\")),\n\t\t\t\t\tpbs(\"env(safe-area-inset-top, 0px)\"),\n\t\t\t\t\tpbe(\"env(safe-area-inset-bottom, 0px)\"),\n\t\t\t\t\ttransition(\"transform, display, overlay\", {\n\t\t\t\t\t\tduration: durations.slow,\n\t\t\t\t\t\teasing: easings.decelerate,\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 rail's header slot: a `<header>` laying out its children in\n * a centered row, block-sized to a fixed height with a divider border\n * below it and safe-area padding on its block-start edge.\n *\n * @param handle Runtime handle carrying the host `<header>`'s props.\n * @returns The render function producing the header slot's markup.\n * @example\n * <Sidebar.Header>\n * \t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * </Sidebar.Header>\n */\nSidebar.Header = function SidebarHeader(handle: Handle<Sidebar.HeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<header\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"header\"\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * The slot paints the rail's background, so content scrolling behind a row held\n\t\t\t\t\t * against the viewport stays hidden; inheriting it matches whichever surface hosts\n\t\t\t\t\t * the row, the docked rail or the drawer.\n\t\t\t\t\t */\n\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tbs(\"4rem\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tborderEdge(\"block-end\", {\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\t\tpi(\"1rem\"),\n\t\t\t\t\tpbs(\"calc(0.5rem + env(safe-area-inset-top, 0px))\"),\n\t\t\t\t\tpbe(\"0.5rem\"),\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 rail's own scrollable nav region: {@link ScrollArea.Viewport}\n * laid out as a padded, gap-separated column that scrolls independently of\n * {@link Sidebar.Header} and {@link Sidebar.Footer} once it overflows.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the content region's markup.\n * @example\n * <Sidebar.Content>\n * \t<Sidebar.Group>\n * \t\t<Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n * \t\t<Sidebar.Menu>...</Sidebar.Menu>\n * \t</Sidebar.Group>\n * </Sidebar.Content>\n */\nSidebar.Content = function SidebarContent(handle: Handle<Sidebar.ContentProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ScrollArea.Viewport\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\tgap(\"1rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"1rem\"),\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 rail's footer slot: a `<footer>` laying out its children in\n * a centered row with a divider border above it and safe-area padding on\n * its block-end edge.\n *\n * @param handle Runtime handle carrying the host `<footer>`'s props.\n * @returns The render function producing the footer slot's markup.\n * @example\n * <Sidebar.Footer>\n * \t<Sidebar.MenuButton>{t(\"nav.account\")}</Sidebar.MenuButton>\n * </Sidebar.Footer>\n */\nSidebar.Footer = function SidebarFooter(handle: Handle<Sidebar.FooterProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<footer\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"footer\"\n\t\t\t\tmix={[\n\t\t\t\t\tbg(\"inherit\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tshrink(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tborderEdge(\"block-start\", {\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 80 },\n\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpbs(\"1rem\"),\n\t\t\t\t\tpbe(\"calc(1rem + env(safe-area-inset-bottom, 0px))\"),\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 flat navigation list: a `<nav>` stacking its {@link Sidebar.Item}\n * children in a column with a small gap, suited to a rail with a simple,\n * ungrouped set of links.\n *\n * @param handle Runtime handle carrying the host `<nav>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Sidebar.Nav aria-label={t(\"nav.mainNavigation\")}>\n * \t<Sidebar.Item href=\"/dashboard\" current>{t(\"nav.dashboard\")}</Sidebar.Item>\n * \t<Sidebar.Item href=\"/settings\">{t(\"nav.settings\")}</Sidebar.Item>\n * </Sidebar.Nav>\n */\nSidebar.Nav = function SidebarNav(handle: Handle<Sidebar.NavProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <nav {...rest} data-slot=\"nav\" mix={[vstack({ gap: \"0.25rem\" }), mix]} />;\n\t};\n};\n\n/**\n * Renders a single row inside {@link Sidebar.Nav}: a native `<a>` colored\n * through `data-color`, tinted once `aria-current` is set, matching\n * {@link Sidebar.MenuLink}; its focus ring always reads in that same color.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.Item href=\"/dashboard\" current>\n * \t<HomeIcon aria-hidden />\n * \t{t(\"nav.dashboard\")}\n * </Sidebar.Item>\n * @example\n * <Sidebar.Item href=\"/billing/cancel\" color=\"danger\" aria-current={pathname === \"/billing/cancel\" ? \"page\" : undefined}>\n * \t<XCircleIcon aria-hidden />\n * \t{t(\"nav.cancelPlan\")}\n * </Sidebar.Item>\n */\nSidebar.Item = function SidebarItem(handle: Handle<Sidebar.ItemProps>) {\n\treturn () => {\n\t\tlet { color, current, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_ITEM_COLOR;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(current, ariaCurrent);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t]),\n\t\t\t\t\tflex(),\n\t\t\t\t\tminBs(\"2.25rem\"),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tfontSize(\"sm\"),\n\t\t\t\t\tweight(500),\n\t\t\t\t\ttextDecoration(\"none\"),\n\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", [is(\"1rem\"), bs(\"1rem\"), shrink()]),\n\t\t\t\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\tgap(\"0.75rem\"),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:hover\", [bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.muted\")),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"neutral.emphasis\")),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"brand\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"brand.tint\"),\n\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"brand\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"success\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"success.tint\"),\n\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"success\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"warning.tint\"),\n\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"warning\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\tdata(\n\t\t\t\t\t\t\"color\",\n\t\t\t\t\t\t\"danger\",\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', [\n\t\t\t\t\t\t\tbg(\"danger.tint\"),\n\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\twhen(\"& > svg, & > [data-slot='icon']\", fg(\"danger\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\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 related cluster of {@link Sidebar.Menu} items: a `<section>`\n * stacking its children in a column, gaining a divider border and extra\n * space above itself whenever it follows another {@link Sidebar.Group}.\n *\n * @param handle Runtime handle carrying the host `<section>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <Sidebar.Group>\n * \t<Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n * \t<Sidebar.GroupContent>\n * \t\t<Sidebar.Menu>...</Sidebar.Menu>\n * \t</Sidebar.GroupContent>\n * </Sidebar.Group>\n */\nSidebar.Group = function SidebarGroup(handle: Handle<Sidebar.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<section\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\twhen(\"& + &\", [\n\t\t\t\t\t\tmbs(\"0.5rem\"),\n\t\t\t\t\t\tborderEdge(\"block-start\", {\n\t\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\t\tstyle: \"solid\",\n\t\t\t\t\t\t\tcolor: colorMix(\n\t\t\t\t\t\t\t\t\"oklab\",\n\t\t\t\t\t\t\t\t{ color: \"var(--ui-neutral-border)\", weight: 60 },\n\t\t\t\t\t\t\t\t\"transparent\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}),\n\t\t\t\t\t]),\n\t\t\t\t\tgap(\"0.25rem\"),\n\t\t\t\t\twhen(\"& + &\", pbs(\"1rem\")),\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 {@link Sidebar.Group}'s label: a small, muted, uppercase heading\n * row, visually clipped once the ancestor {@link Sidebar} collapses to\n * icon-only, while staying announced to assistive technology.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the label's markup.\n * @example\n * <Sidebar.GroupLabel>{t(\"nav.workspace\")}</Sidebar.GroupLabel>\n */\nSidebar.GroupLabel = function SidebarGroupLabel(handle: Handle<Sidebar.GroupLabelProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-label\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"between\"),\n\t\t\t\t\tmbe(\"0.25rem\"),\n\t\t\t\t\tweight(600),\n\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\ttextTransform(\"uppercase\"),\n\t\t\t\t\ttracking(\"wider\"),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\tpb(\"0.375rem\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\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 small icon-only action button anchored to {@link Sidebar.GroupLabel}'s\n * trailing edge, its pointer target grown to `--ui-target-size`. In dev mode, an\n * action with no plain text and no `aria-label`/`aria-labelledby` logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the action's markup.\n * @example\n * <Sidebar.GroupLabel>\n * \t{t(\"nav.workspace\")}\n * \t<Sidebar.GroupAction aria-label={t(\"nav.addWorkspace\")}>\n * \t\t<PlusIcon aria-hidden />\n * \t</Sidebar.GroupAction>\n * </Sidebar.GroupLabel>\n */\nSidebar.GroupAction = function SidebarGroupAction(handle: Handle<Sidebar.GroupActionProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Sidebar.GroupAction: an icon-only action needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-action\"\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"1.25rem\"),\n\t\t\t\t\tbs(\"1.25rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Sidebar.Group}'s body slot: a `<div>` stacking its children\n * — typically a {@link Sidebar.Menu} — in a column with a small gap.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the body slot's markup.\n * @example\n * <Sidebar.GroupContent>\n * \t<Sidebar.Menu>...</Sidebar.Menu>\n * </Sidebar.GroupContent>\n */\nSidebar.GroupContent = function SidebarGroupContent(handle: Handle<Sidebar.GroupContentProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} data-slot=\"group-content\" mix={[vstack({ gap: \"0.125rem\" }), mix]} />;\n\t};\n};\n\n/**\n * Renders a list of nav rows: a native `<ul>` stacking {@link Sidebar.MenuItem}\n * children in a column with a small gap.\n *\n * @param handle Runtime handle carrying the host `<ul>`'s props.\n * @returns The render function producing the list's markup.\n * @example\n * <Sidebar.Menu>\n * \t<Sidebar.MenuItem>\n * \t\t<Sidebar.MenuLink href=\"/dashboard\">{t(\"nav.dashboard\")}</Sidebar.MenuLink>\n * \t</Sidebar.MenuItem>\n * </Sidebar.Menu>\n */\nSidebar.Menu = function SidebarMenu(handle: Handle<Sidebar.MenuProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ul\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu\"\n\t\t\t\tmix={[is(\"full\"), minIs(\"0\"), vstack({ gap: \"0.125rem\" }), mix]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a single row inside {@link Sidebar.Menu}: a relatively positioned\n * `<li>` whose own `:hover`/`:focus-within` state reveals a nested\n * {@link Sidebar.MenuAction} that stays invisible at rest.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuItem>\n * \t<Sidebar.MenuLink href=\"/inbox\">{t(\"nav.inbox\")}</Sidebar.MenuLink>\n * \t<Sidebar.MenuAction aria-label={t(\"nav.inboxSettings\")}>\n * \t\t<SettingsIcon aria-hidden />\n * \t</Sidebar.MenuAction>\n * </Sidebar.MenuItem>\n */\nSidebar.MenuItem = function SidebarMenuItem(handle: Handle<Sidebar.MenuItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<li\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-item\"\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tflex(),\n\t\t\t\t\t/**\n\t\t\t\t\t * A plain row centres what it holds and a row carrying a sub-menu stacks, putting the\n\t\t\t\t\t * nested list under it at full width. The selectors never match at once, so the layout\n\t\t\t\t\t * holds whichever order the cascade puts the pair in.\n\t\t\t\t\t */\n\t\t\t\t\twhen('&:not(:has([data-slot=\"menu-sub\"]))', items(\"center\")),\n\t\t\t\t\twhen('&:has([data-slot=\"menu-sub\"])', [flexCol(), items(\"stretch\")]),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t\"&:hover [data-slot='menu-action'], &:focus-within [data-slot='menu-action']\",\n\t\t\t\t\t\topacity(100),\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 native `<button>` row for an in-page action inside\n * {@link Sidebar.Menu}, sized through `data-size` and marked current via\n * `active`; its leading icon is muted, and a trailing label truncates.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuButton onClick={openCommandPalette}>\n * \t<SearchIcon aria-hidden />\n * \t<span data-sidebar-collapsed-hide>{t(\"nav.search\")}</span>\n * </Sidebar.MenuButton>\n */\nSidebar.MenuButton = function SidebarMenuButton(handle: Handle<Sidebar.MenuButtonProps>) {\n\treturn () => {\n\t\tlet { size, active, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_MENU_BUTTON_SIZE;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-button\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuRowMixins(),\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 native `<a>` row for navigation inside {@link Sidebar.Menu},\n * visually identical to {@link Sidebar.MenuButton}. `active` sets\n * `aria-current=\"page\"` when unset, with styling reading that attribute directly.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuLink href=\"/dashboard\" active>\n * \t<HomeIcon aria-hidden />\n * \t<span data-sidebar-collapsed-hide>{t(\"nav.dashboard\")}</span>\n * </Sidebar.MenuLink>\n */\nSidebar.MenuLink = function SidebarMenuLink(handle: Handle<Sidebar.MenuLinkProps>) {\n\treturn () => {\n\t\tlet { size, active, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_MENU_BUTTON_SIZE;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(active, ariaCurrent);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"menu-link\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Shared `@sdxc/u` mixins for {@link Sidebar.MenuButton} and\n * {@link Sidebar.MenuLink}, factored out since the two differ only in host\n * element and how their current/active state is expressed.\n */\nfunction menuRowMixins() {\n\treturn [\n\t\tflex(),\n\t\tis(\"full\"),\n\t\tminIs(\"0\"),\n\t\titems(\"center\"),\n\t\toverflow(\"hidden\"),\n\t\ttextAlign(\"start\"),\n\t\tweight(500),\n\t\ttextDecoration(\"none\"),\n\t\tfontSize(\"sm\"),\n\t\toutlineStyle(\"none\"),\n\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\tis(\"1rem\"),\n\t\t\tbs(\"1rem\"),\n\t\t\tshrink(),\n\t\t]),\n\t\twhen(\"& > span\", truncate()),\n\t\tdata(\"size\", \"sm\", [\n\t\t\tminBs(\"1.75rem\"),\n\t\t\tpb(\"0.375rem\"),\n\t\t\tfontSize(\"xs\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\t\tis(\"0.875rem\"),\n\t\t\t\tbs(\"0.875rem\"),\n\t\t\t]),\n\t\t]),\n\t\tdata(\"size\", \"md\", minBs(\"2.25rem\")),\n\t\tdata(\"size\", \"lg\", [\n\t\t\tminBs(\"2.75rem\"),\n\t\t\tpb(\"0.625rem\"),\n\t\t\tfontSize(\"base\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", [\n\t\t\t\tis(\"1.25rem\"),\n\t\t\t\tbs(\"1.25rem\"),\n\t\t\t]),\n\t\t]),\n\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\tgap(\"0.75rem\"),\n\t\trounded(\"lg\"),\n\t\tpi(\"0.5rem\"),\n\t\tpb(\"0.5rem\"),\n\t\tfg(\"neutral\"),\n\t\ttransition(\n\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t),\n\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", fg(\"neutral.muted\")),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', [\n\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\tfg(\"neutral.emphasis\"),\n\t\t\twhen(\"& > svg:first-child, & > [data-slot='icon']:first-child\", fg(\"neutral.emphasis\")),\n\t\t]),\n\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t];\n}\n\n/**\n * Renders a small icon-only action anchored to {@link Sidebar.MenuItem}'s trailing\n * edge, revealed by `showOnHover`, with its pointer target grown to `--ui-target-size`.\n * In dev mode, an action with no accessible name logs a `console.warn`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the action's markup.\n * @example\n * <Sidebar.MenuAction aria-label={t(\"nav.inboxSettings\")}>\n * \t<SettingsIcon aria-hidden />\n * </Sidebar.MenuAction>\n * @example\n * <Sidebar.MenuAction showOnHover={false} aria-label={t(\"nav.starred\")}>\n * \t<StarIcon aria-hidden />\n * </Sidebar.MenuAction>\n */\nSidebar.MenuAction = function SidebarMenuAction(handle: Handle<Sidebar.MenuActionProps>) {\n\treturn () => {\n\t\tlet { showOnHover, children, mix, ...rest } = handle.props;\n\t\tlet resolvedShowOnHover = showOnHover ?? DEFAULT_SHOW_ON_HOVER;\n\n\t\twarnIfNoAccessibleName(\n\t\t\thandle.props,\n\t\t\tchildren,\n\t\t\t\"Sidebar.MenuAction: an icon-only action needs an `aria-label` describing what it does — assistive technology has no accessible text to announce otherwise.\",\n\t\t);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-action\"\n\t\t\t\tdata-show-on-hover={resolvedShowOnHover ? undefined : \"false\"}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinsIe(\"0.375rem\"),\n\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\ttranslateProperty(\"0 -50%\"),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"1.5rem\"),\n\t\t\t\t\tbs(\"1.5rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\topacity(0),\n\t\t\t\t\tfocusVisible(opacity(100)),\n\t\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\tdata(\"show-on-hover\", \"false\", opacity(100)),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-pressed\"), fg(\"neutral\")]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders a small count or status pill pinned to the trailing edge of a\n * {@link Sidebar.MenuButton} or {@link Sidebar.MenuLink} row, hidden once\n * the ancestor {@link Sidebar} collapses to its icon-only rail.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the pill's markup.\n * @example\n * <Sidebar.MenuLink href=\"/inbox\">\n * \t{t(\"nav.inbox\")}\n * \t<Sidebar.MenuBadge>24</Sidebar.MenuBadge>\n * </Sidebar.MenuLink>\n */\nSidebar.MenuBadge = function SidebarMenuBadge(handle: Handle<Sidebar.MenuBadgeProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-badge\"\n\t\t\t\tmix={[\n\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tfontSize(\"xs\"),\n\t\t\t\t\tweight(600),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tpi(\"0.375rem\"),\n\t\t\t\t\tpb(\"0.125rem\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral\"),\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 static loading placeholder shaped like {@link Sidebar.MenuButton}:\n * an optional icon-shaped {@link Skeleton} block followed by a text-shaped\n * one; compose `pulse()` or `shimmer()` through `mix` for a loading cue.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the placeholder's markup.\n * @example\n * <Sidebar.MenuSkeleton showIcon />\n * @example\n * <Sidebar.MenuSkeleton style={{ inlineSize: \"70%\" }} />\n */\nSidebar.MenuSkeleton = function SidebarMenuSkeleton(handle: Handle<Sidebar.MenuSkeletonProps>) {\n\treturn () => {\n\t\tlet { showIcon, mix, ...rest } = handle.props;\n\t\tlet resolvedShowIcon = showIcon ?? DEFAULT_SHOW_ICON;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-skeleton\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tbs(\"2.25rem\"),\n\t\t\t\t\tgap(\"0.75rem\"),\n\t\t\t\t\tpi(\"0.5rem\"),\n\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{resolvedShowIcon && (\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tdata-slot=\"menu-skeleton-icon\"\n\t\t\t\t\t\tmix={[is(\"1rem\"), bs(\"1rem\"), shrink(), rounded(\"sm\"), bg(\"neutral.border\")]}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<span\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tdata-slot=\"menu-skeleton-text\"\n\t\t\t\t\tmix={[bs(\"1rem\"), grow(), is(\"60%\"), rounded(\"md\"), bg(\"neutral.border\")]}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders a nested list of sub-rows beneath a {@link Sidebar.MenuItem}: a\n * `<ul>` indented from and bordered against the rail's inline-start edge,\n * hidden once the ancestor {@link Sidebar} collapses to its icon-only rail.\n *\n * @param handle Runtime handle carrying the host `<ul>`'s props.\n * @returns The render function producing the nested list's markup.\n * @example\n * <Sidebar.MenuSub>\n * \t<Sidebar.MenuSubItem>\n * \t\t<Sidebar.MenuSubLink href=\"/settings/profile\">{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n * \t</Sidebar.MenuSubItem>\n * </Sidebar.MenuSub>\n */\nSidebar.MenuSub = function SidebarMenuSub(handle: Handle<Sidebar.MenuSubProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ul\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-sub\"\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tmis(\"1rem\"),\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tborderEdge(\"inline-start\", { width: 1, style: \"solid\" }),\n\t\t\t\t\tpis(\"0.625rem\"),\n\t\t\t\t\tgap(\"0.125rem\"),\n\t\t\t\t\tborder(\"neutral\"),\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 single row inside {@link Sidebar.MenuSub}: a plain `<li>`.\n *\n * @param handle Runtime handle carrying the host `<li>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubItem>\n * \t<Sidebar.MenuSubLink href=\"/settings/profile\">{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n * </Sidebar.MenuSubItem>\n */\nSidebar.MenuSubItem = function SidebarMenuSubItem(handle: Handle<Sidebar.MenuSubItemProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <li {...rest} data-slot=\"menu-sub-item\" mix={[flex(), items(\"center\"), mix]} />;\n\t};\n};\n\n/**\n * Renders a native `<button>` row for an in-page action inside\n * {@link Sidebar.MenuSub}, smaller and more muted than\n * {@link Sidebar.MenuButton}, marked current through `active`.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubButton onClick={runQuickAction}>{t(\"nav.markAllRead\")}</Sidebar.MenuSubButton>\n */\nSidebar.MenuSubButton = function SidebarMenuSubButton(handle: Handle<Sidebar.MenuSubButtonProps>) {\n\treturn () => {\n\t\tlet { active, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"menu-sub-button\"\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuSubRowMixins(),\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 native `<a>` row for navigation inside {@link Sidebar.MenuSub},\n * visually identical to {@link Sidebar.MenuSubButton}. `active` sets\n * `aria-current=\"page\"` when `aria-current` is otherwise unset.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Sidebar.MenuSubLink href=\"/settings/profile\" active>{t(\"nav.profile\")}</Sidebar.MenuSubLink>\n */\nSidebar.MenuSubLink = function SidebarMenuSubLink(handle: Handle<Sidebar.MenuSubLinkProps>) {\n\treturn () => {\n\t\tlet { active, \"aria-current\": ariaCurrent, mix, ...rest } = handle.props;\n\t\tlet resolvedAriaCurrent = resolveAriaCurrent(active, ariaCurrent);\n\n\t\treturn (\n\t\t\t<a\n\t\t\t\t{...rest}\n\t\t\t\taria-current={resolvedAriaCurrent}\n\t\t\t\tdata-slot=\"menu-sub-link\"\n\t\t\t\tdata-active={active || undefined}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t...menuSubRowMixins(),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Shared `@sdxc/u` mixins for {@link Sidebar.MenuSubButton} and\n * {@link Sidebar.MenuSubLink}.\n */\nfunction menuSubRowMixins() {\n\treturn [\n\t\tflex(),\n\t\tminBs(\"2rem\"),\n\t\tis(\"full\"),\n\t\titems(\"center\"),\n\t\ttextAlign(\"start\"),\n\t\ttextDecoration(\"none\"),\n\t\tfontSize(\"sm\"),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', weight(500)),\n\t\twhen(\"&:active\", scaleProperty(0.98)),\n\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), opacity(50)]),\n\t\tgap(\"0.5rem\"),\n\t\trounded(\"lg\"),\n\t\tpi(\"0.625rem\"),\n\t\tpb(\"0.375rem\"),\n\t\tfg(\"neutral.muted\"),\n\t\ttransition(\n\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t),\n\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\twhen('&[data-active], &[aria-current]:not([aria-current=\"false\"])', [\n\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\tfg(\"neutral.emphasis\"),\n\t\t]),\n\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t];\n}\n\n/**\n * Renders a thin drag-styled affordance along {@link Sidebar}'s own edge,\n * toggling {@link Sidebar.Trigger}'s checkbox through a native `<label>`\n * association; marked `aria-hidden` since that checkbox is the accessible control.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the rail's markup.\n * @example\n * <Sidebar>\n * \t<Sidebar.Header>...</Sidebar.Header>\n * \t<Sidebar.Rail htmlFor=\"app-sidebar-toggle\" />\n * </Sidebar>\n */\nSidebar.Rail = function SidebarRail(handle: Handle<Sidebar.RailProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"rail\"\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ \"aria-hidden\": \"true\" }),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tis(\"1rem\"),\n\t\t\t\t\tz(20),\n\t\t\t\t\thidden(),\n\t\t\t\t\tcursor(\"col-resize\"),\n\t\t\t\t\twhen('[data-side=\"left\"] &', insRight(\"-1rem\")),\n\t\t\t\t\twhen('[data-side=\"right\"] &', insLeft(\"-1rem\")),\n\t\t\t\t\tafter([\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tis(\"2px\"),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tinsIs(\"50%\"),\n\t\t\t\t\t\ttranslateProperty(\"-50% 0\"),\n\t\t\t\t\t\tpseudoContent('\"\"'),\n\t\t\t\t\t\ttransitionProperty(\"background-color\"),\n\t\t\t\t\t\ttransitionDuration(\"150ms\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(WIDE_SHELL_QUERY, [flex(), items(\"center\"), justify(\"center\")]),\n\t\t\t\t\thover(after(bg(\"neutral.border\"))),\n\t\t\t\t\twhen(\"&:active\", after(bg(\"brand.ring\"))),\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 collapse toggle: a native, keyboard-reachable `<input type=\"checkbox\">`\n * in a button-styled `<label>` whose pointer target grows to `--ui-target-size`; its\n * `:checked` state drives every collapse rule in {@link Sidebar.Provider}.\n *\n * @param handle Runtime handle carrying the host checkbox's props.\n * @returns The render function producing the toggle's markup.\n * @example\n * <Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * @example\n * <Sidebar.Trigger id=\"app-sidebar-toggle\" defaultChecked aria-label={t(\"nav.toggleSidebar\")} />\n */\nSidebar.Trigger = function SidebarTrigger(handle: Handle<Sidebar.TriggerProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\tdata-slot=\"trigger\"\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:has(input:focus-visible)\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\tis(\"2rem\"),\n\t\t\t\t\tbs(\"2rem\"),\n\t\t\t\t\thitArea(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\tcursor(\"pointer\"),\n\t\t\t\t\twhen(\"& > svg\", [is(\"1rem\"), bs(\"1rem\")]),\n\t\t\t\t\twhen(\"&:has(input:disabled)\", [cursor(\"not-allowed\"), opacity(50)]),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\thover([bg(\"neutral.bg-tint-hover\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t<PanelLeftIcon />\n\t\t\t\t<input type=\"checkbox\" {...rest} data-slot=\"toggle\" mix={[visuallyHidden(), mix]} />\n\t\t\t</label>\n\t\t);\n\t};\n};\n\n/**\n * Renders the shell's main content region: {@link ScrollArea.Viewport}\n * laid out as a growing flex column that resizes as {@link Sidebar}\n * collapses or expands, declaring {@link INSET_CONTAINER_NAME} for nested sizing.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the inset's markup.\n * @example\n * <Sidebar.Inset>\n * \t<Sidebar.Trigger id=\"app-sidebar-toggle\" aria-label={t(\"nav.toggleSidebar\")} />\n * \t<main>{children}</main>\n * </Sidebar.Inset>\n */\nSidebar.Inset = function SidebarInset(handle: Handle<Sidebar.InsetProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<ScrollArea.Viewport\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"inset\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\tflexCol(),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tminIs(\"0\"),\n\t\t\t\t\tminBs(\"0\"),\n\t\t\t\t\tbs(\"auto\"),\n\t\t\t\t\tcontainer(INSET_CONTAINER_NAME),\n\t\t\t\t\tbg(\"neutral.tint\"),\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 hairline divider between two stretches of rail content:\n * identical to {@link Separator}, with the small block-axis and inline-axis\n * margins {@link Sidebar}'s own content regions expect around one.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the divider's markup.\n * @example\n * <Sidebar.Group>...</Sidebar.Group>\n * <Sidebar.Separator />\n * <Sidebar.Group>...</Sidebar.Group>\n */\nSidebar.Separator = function SidebarSeparator(handle: Handle<Sidebar.SeparatorProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <Separator {...rest} data-slot=\"separator\" mix={[m(\"0.5rem\"), mix]} />;\n\t};\n};\n"
|
|
15
15
|
},
|
|
16
16
|
"test": {
|
|
17
17
|
"path": "sidebar.test.tsx",
|
|
18
|
-
"content": "/**\n * Tests for {@link \"./sidebar\"}, covering the rail slots a consumer holds\n * against the viewport: a header or footer that lets the rail's background\n * show through paints the scrolling nav behind it in plain sight, so each\n * slot's own paint is asserted over `renderToString`'s output, as is the drawer\n * staying hidden while closed.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Sidebar } from \"@sdxc/ui/sidebar\";\n\ndescribe(\"Sidebar.Header\", () => {\n\ttest(\"paints the surface it sits on rather than letting it show through\", async () => {\n\t\tlet html = await renderToString(<Sidebar.Header>sdxc</Sidebar.Header>);\n\n\t\texpect(String(html)).toMatch(/background-color:\\s*inherit/);\n\t});\n});\n\ndescribe(\"Sidebar.Footer\", () => {\n\ttest(\"paints the surface it sits on rather than letting it show through\", async () => {\n\t\tlet html = await renderToString(<Sidebar.Footer>account</Sidebar.Footer>);\n\n\t\texpect(String(html)).toMatch(/background-color:\\s*inherit/);\n\t});\n});\n\ndescribe(\"Sidebar.MobileNav\", () => {\n\ttest(\"lays the drawer out only while it is open, so a closed one stays hidden\", async () => {\n\t\tlet html = String(\n\t\t\tawait renderToString(\n\t\t\t\t<Sidebar.MobileNav id=\"mobile-nav\" aria-label=\"Main\">\n\t\t\t\t\tnav\n\t\t\t\t</Sidebar.MobileNav>,\n\t\t\t),\n\t\t);\n\t\tlet css = [...html.matchAll(/<style[^>]*>([\\s\\S]*?)<\\/style>/g)]\n\t\t\t.map((match) => match[1])\n\t\t\t.join(\"\\n\");\n\n\t\tlet displays = css.match(/display:\\s*flex/g) ?? [];\n\t\tlet gated = css.match(/&\\[open\\]\\s*\\{\\s*display:\\s*flex/g) ?? [];\n\n\t\texpect(displays.length).toBeGreaterThan(0);\n\t\texpect(gated.length).toBe(displays.length);\n\t});\n});\n\ndescribe(\"small sidebar controls\", () => {\n\ttest.each([\n\t\t[\"Sidebar.GroupAction\", <Sidebar.GroupAction aria-label=\"Add\">+</Sidebar.GroupAction>],\n\t\t[\"Sidebar.MenuAction\", <Sidebar.MenuAction aria-label=\"Settings\">…</Sidebar.MenuAction>],\n\t\t[\"Sidebar.Trigger\", <Sidebar.Trigger id=\"toggle\" aria-label=\"Toggle sidebar\" />],\n\t])(\"%s grows its pointer target to the minimum target size\", async (_, node) => {\n\t\tlet html = String(await renderToString(node));\n\n\t\texpect(html).toContain(\"--ui-target-size\");\n\t\texpect(html).toMatch(/position:\\s*relative|position:\\s*absolute/);\n\t});\n});\n"
|
|
18
|
+
"content": "/**\n * Tests for {@link \"./sidebar\"}, covering the rail slots a consumer holds\n * against the viewport: a header or footer that lets the rail's background\n * show through paints the scrolling nav behind it in plain sight, so each\n * slot's own paint is asserted over `renderToString`'s output, as is the drawer\n * staying hidden while closed.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Sidebar } from \"@sdxc/ui/sidebar\";\n\ndescribe(\"Sidebar.Header\", () => {\n\ttest(\"paints the surface it sits on rather than letting it show through\", async () => {\n\t\tlet html = await renderToString(<Sidebar.Header>sdxc</Sidebar.Header>);\n\n\t\texpect(String(html)).toMatch(/background-color:\\s*inherit/);\n\t});\n});\n\ndescribe(\"Sidebar.Footer\", () => {\n\ttest(\"paints the surface it sits on rather than letting it show through\", async () => {\n\t\tlet html = await renderToString(<Sidebar.Footer>account</Sidebar.Footer>);\n\n\t\texpect(String(html)).toMatch(/background-color:\\s*inherit/);\n\t});\n});\n\ndescribe(\"Sidebar\", () => {\n\ttest(\"declares its collapsed size after its open size, so collapsing wins and animates\", async () => {\n\t\tlet html = String(\n\t\t\tawait renderToString(\n\t\t\t\t<Sidebar.Provider>\n\t\t\t\t\t<Sidebar collapsible=\"offcanvas\">nav</Sidebar>\n\t\t\t\t\t<Sidebar.Inset>page</Sidebar.Inset>\n\t\t\t\t</Sidebar.Provider>,\n\t\t\t),\n\t\t);\n\n\t\tlet open = html.indexOf(\"inline-size: var(--sidebar-width, 16rem)\");\n\t\tlet collapsed = html.search(\n\t\t\t/data-collapsible=\"offcanvas\"\\]\\[data-side=\"left\"\\][^{]*\\{[^}]*inline-size: 0/,\n\t\t);\n\n\t\texpect(open).toBeGreaterThan(-1);\n\t\texpect(collapsed).toBeGreaterThan(open);\n\t});\n});\n\ndescribe(\"Sidebar.MobileNav\", () => {\n\ttest(\"lays the drawer out only while it is open, so a closed one stays hidden\", async () => {\n\t\tlet html = String(\n\t\t\tawait renderToString(\n\t\t\t\t<Sidebar.MobileNav id=\"mobile-nav\" aria-label=\"Main\">\n\t\t\t\t\tnav\n\t\t\t\t</Sidebar.MobileNav>,\n\t\t\t),\n\t\t);\n\t\tlet css = [...html.matchAll(/<style[^>]*>([\\s\\S]*?)<\\/style>/g)]\n\t\t\t.map((match) => match[1])\n\t\t\t.join(\"\\n\");\n\n\t\tlet displays = css.match(/display:\\s*flex/g) ?? [];\n\t\tlet gated = css.match(/&\\[open\\]\\s*\\{\\s*display:\\s*flex/g) ?? [];\n\n\t\texpect(displays.length).toBeGreaterThan(0);\n\t\texpect(gated.length).toBe(displays.length);\n\t});\n});\n\ndescribe(\"small sidebar controls\", () => {\n\ttest.each([\n\t\t[\"Sidebar.GroupAction\", <Sidebar.GroupAction aria-label=\"Add\">+</Sidebar.GroupAction>],\n\t\t[\"Sidebar.MenuAction\", <Sidebar.MenuAction aria-label=\"Settings\">…</Sidebar.MenuAction>],\n\t\t[\"Sidebar.Trigger\", <Sidebar.Trigger id=\"toggle\" aria-label=\"Toggle sidebar\" />],\n\t])(\"%s grows its pointer target to the minimum target size\", async (_, node) => {\n\t\tlet html = String(await renderToString(node));\n\n\t\texpect(html).toContain(\"--ui-target-size\");\n\t\texpect(html).toMatch(/position:\\s*relative|position:\\s*absolute/);\n\t});\n});\n"
|
|
19
19
|
}
|
|
20
20
|
}
|
package/registry/ui/typeset.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typeset",
|
|
3
|
-
"changedIn": "2026.10.
|
|
3
|
+
"changedIn": "2026.10.21",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"Typeset"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "typeset.tsx",
|
|
10
|
-
"content": "/**\n * A typography layer wrapping already-rendered markdown or HTML content and\n * supplying every size, weight, spacing, and color decision through three\n * custom properties: `--ui-typeset-size`, `--ui-typeset-leading`, and\n * `--ui-typeset-flow`. `data-preset` swaps all three for a different rhythm\n * context; `data-not-typeset` opts a subtree out of the whole layer.\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 { keyframes } from \"@sdxc/u/animation\";\nimport { bg, border, borderEdge, fg, outline } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { raw } from \"@sdxc/u/general\";\nimport { block, container } from \"@sdxc/u/layout\";\nimport { overflow, overflowBlock, overflowInline } from \"@sdxc/u/overflow\";\nimport { at } from \"@sdxc/u/responsive\";\nimport { is, maxIs, pb, pi, pis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport {\n\tbalance,\n\tleading,\n\tpretty,\n\ttabularNums,\n\ttextAlign,\n\ttextDecoration,\n\ttracking,\n\tweight,\n} from \"@sdxc/u/typography\";\nimport { css } from \"remix/component\";\n\nimport { easings } from \"@sdxc/ui/animations\";\n\n/**\n * Named container {@link Typeset} declares on its own host, so its wide-table\n * handling can grant roomier cell and code-block padding once there's enough\n * space, instead of reading the viewport.\n */\nconst CONTAINER_NAME = \"ui-typeset\";\n\n/** Rhythm context {@link Typeset} falls back to when `preset` is omitted. */\nconst DEFAULT_PRESET: Typeset.Preset = \"docs\";\n\n/** CSS length each edge of a wide table's own fade tapers over. */\nconst TABLE_FADE_SIZE = \"2.5rem\";\n\n/**\n * Custom property carrying the gradient direction a wide table's edge fade\n * paints along, mirrored under `:dir(rtl)` so the same mask string works in\n * both writing directions without a second, mirrored gradient.\n */\nconst TABLE_FADE_DIRECTION_PROPERTY = \"--ui-typeset-table-fade-direction\";\n\n/**\n * `@keyframes` name backing a wide table's scroll-linked edge fade; the\n * `keyframes()` call using it must stay a top-level mixin rather than nested\n * under the table selector, since the serializer only recognizes stops there.\n */\nconst TABLE_FADE_KEYFRAMES_NAME = \"ui-typeset-table-fade\";\n\n/** Proportion of a wide table's own scroll range its edge fade ramps across. */\nconst TABLE_FADE_RAMP_PERCENT = 10;\n\n/** The style shape {@link css} accepts, reused so a keyframes block can be built ahead of the call. */\ntype Styles = Parameters<typeof css>[0];\n\n/**\n * Builds the four-stop mask-image gradient a wide table's edge fade paints:\n * a leading stop, two middle stops marking where the faded band meets the\n * fully opaque middle, and a trailing stop; only the middle stops move.\n */\nfunction tableFadeMask(startStop: string, endStop: string): string {\n\treturn `linear-gradient(to var(${TABLE_FADE_DIRECTION_PROPERTY}, right), transparent 0%, black ${startStop}, black ${endStop}, transparent 100%)`;\n}\n\nconst TABLE_FADE_SETTLED_STOP = `calc(100% - ${TABLE_FADE_SIZE})`;\nconst TABLE_FADE_SETTLED_MASK = tableFadeMask(TABLE_FADE_SIZE, TABLE_FADE_SETTLED_STOP);\n\n/**\n * Stops the wide-table edge fade animates through: fully faded on the leading\n * edge at rest, settled on both edges across the long middle of the scroll\n * range, and fully faded on the trailing edge at the end.\n */\nconst TABLE_FADE_KEYFRAMES: Record<string, Styles> = {\n\t\"0%\": { maskImage: tableFadeMask(\"0%\", TABLE_FADE_SETTLED_STOP) },\n\t[`${TABLE_FADE_RAMP_PERCENT}%, ${100 - TABLE_FADE_RAMP_PERCENT}%`]: {\n\t\tmaskImage: TABLE_FADE_SETTLED_MASK,\n\t},\n\t\"100%\": { maskImage: tableFadeMask(TABLE_FADE_SIZE, \"100%\") },\n};\n\n/**\n * Prop types for {@link Typeset}.\n */\nexport namespace Typeset {\n\t/**\n\t * Rhythm context: `\"docs\"` is the spacious default, `\"chat\"` tightens the\n\t * scale for a conversational bubble's denser turn-taking, and `\"reading\"`\n\t * opens both further for a long-form article.\n\t */\n\texport type Preset = \"docs\" | \"chat\" | \"reading\";\n\n\t/**\n\t * Every native `<div>` attribute plus `mix`. `preset` defaults to\n\t * {@link DEFAULT_PRESET}; setting a `--ui-typeset-*` property directly\n\t * overrides it, and `data-not-typeset` opts a subtree out entirely.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Rhythm context. Defaults to {@link DEFAULT_PRESET}. */\n\t\tpreset?: Preset;\n\t}\n}\n\n/**\n * Renders a `<div>` that sizes and colors already-rendered markdown or HTML\n * content through `--ui-typeset-size`, `--ui-typeset-leading`, and\n * `--ui-typeset-flow`, computing heading sizes via `calc()` off one shared value.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the typeset layer's markup.\n * @example\n * <Typeset preset=\"reading\">{renderedArticleHtml}</Typeset>\n * @example\n * <Typeset preset=\"chat\">\n * \t<p>{t(\"assistant.reply\")}</p>\n * </Typeset>\n * @example\n * <Typeset>\n * \t<p>{t(\"docs.intro\")}</p>\n * \t<div data-not-typeset>\n * \t\t<EmbeddedWidget />\n * \t</div>\n * </Typeset>\n */\nexport function Typeset(handle: Handle<Typeset.Props>) {\n\treturn () => {\n\t\tlet { preset, mix, ...rest } = handle.props;\n\t\tlet resolvedPreset = preset ?? DEFAULT_PRESET;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-preset={resolvedPreset}\n\t\t\t\tdata-slot=\"typeset\"\n\t\t\t\tmix={[\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\tkeyframes(TABLE_FADE_KEYFRAMES_NAME, TABLE_FADE_KEYFRAMES),\n\t\t\t\t\traw({\n\t\t\t\t\t\tfontSize: \"var(--ui-typeset-size, 1rem)\",\n\t\t\t\t\t\tlineHeight: \"var(--ui-typeset-leading, 1.75)\",\n\n\t\t\t\t\t\t'&[data-preset=\"docs\"]': {\n\t\t\t\t\t\t\t\"--ui-typeset-size\": \"1rem\",\n\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.75\",\n\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"1.25em\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'&[data-preset=\"chat\"]': {\n\t\t\t\t\t\t\t\"--ui-typeset-size\": \"0.9375rem\",\n\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.5\",\n\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"0.75em\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'&[data-preset=\"reading\"]': {\n\t\t\t\t\t\t\t\"--ui-typeset-size\": \"1.125rem\",\n\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.8\",\n\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"1.5em\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& > * + *\": {\n\t\t\t\t\t\t\tmarginBlockStart: \"var(--ui-typeset-flow, 1.25em)\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(blockquote, li) > * + *\": {\n\t\t\t\t\t\t\tmarginBlockStart: \"var(--ui-typeset-flow, 1.25em)\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(h1)\": {\n\t\t\t\t\t\t\tfontSize: \"calc(var(--ui-typeset-size, 1rem) * 2)\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(h2)\": {\n\t\t\t\t\t\t\tfontSize: \"calc(var(--ui-typeset-size, 1rem) * 1.5)\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(h3)\": {\n\t\t\t\t\t\t\tfontSize: \"calc(var(--ui-typeset-size, 1rem) * 1.25)\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(h4)\": {\n\t\t\t\t\t\t\tfontSize: \"calc(var(--ui-typeset-size, 1rem) * 1.125)\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(h5)\": {\n\t\t\t\t\t\t\tfontSize: \"var(--ui-typeset-size, 1rem)\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(h6)\": {\n\t\t\t\t\t\t\tfontSize: \"calc(var(--ui-typeset-size, 1rem) * 0.875)\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(ul)\": {\n\t\t\t\t\t\t\tlistStyleType: \"disc\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(ol)\": {\n\t\t\t\t\t\t\tlistStyleType: \"decimal\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(ul, ol) :where(ul)\": {\n\t\t\t\t\t\t\tlistStyleType: \"circle\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(blockquote)\": {\n\t\t\t\t\t\t\tfontStyle: \"italic\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(a)\": {\n\t\t\t\t\t\t\ttextUnderlineOffset: \"0.15em\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(a):hover\": {\n\t\t\t\t\t\t\ttextDecorationThickness: \"2px\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(em, i)\": {\n\t\t\t\t\t\t\tfontStyle: \"italic\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(code)\": {\n\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(pre)\": {\n\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(pre code)\": {\n\t\t\t\t\t\t\tpadding: \"0\",\n\t\t\t\t\t\t\tfontSize: \"1em\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(table)\": {\n\t\t\t\t\t\t\tborderCollapse: \"collapse\",\n\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t\tscrollbarWidth: \"thin\",\n\t\t\t\t\t\t\tscrollbarGutter: \"stable\",\n\n\t\t\t\t\t\t\t[TABLE_FADE_DIRECTION_PROPERTY]: \"right\",\n\t\t\t\t\t\t\tmaskImage: \"none\",\n\t\t\t\t\t\t\t\"-webkit-mask-image\": \"none\",\n\n\t\t\t\t\t\t\t\"&:dir(rtl)\": {\n\t\t\t\t\t\t\t\t[TABLE_FADE_DIRECTION_PROPERTY]: \"left\",\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\"&::-webkit-scrollbar\": {\n\t\t\t\t\t\t\t\twidth: \"0.75rem\",\n\t\t\t\t\t\t\t\theight: \"0.75rem\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"&::-webkit-scrollbar-track\": {\n\t\t\t\t\t\t\t\tbackgroundColor: \"transparent\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"&::-webkit-scrollbar-thumb\": {\n\t\t\t\t\t\t\t\tborderRadius: \"var(--ui-radius-full, 9999px)\",\n\t\t\t\t\t\t\t\tbackgroundColor: \"var(--ui-neutral-border)\",\n\t\t\t\t\t\t\t\tborderWidth: \"3px\",\n\t\t\t\t\t\t\t\tborderStyle: \"solid\",\n\t\t\t\t\t\t\t\tborderColor: \"transparent\",\n\t\t\t\t\t\t\t\tbackgroundClip: \"content-box\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"&::-webkit-scrollbar-thumb:hover\": {\n\t\t\t\t\t\t\t\tbackgroundColor: \"var(--ui-neutral-border-strong)\",\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\"@supports (animation-timeline: scroll())\": {\n\t\t\t\t\t\t\t\tanimationName: TABLE_FADE_KEYFRAMES_NAME,\n\t\t\t\t\t\t\t\tanimationDuration: \"auto\",\n\t\t\t\t\t\t\t\tanimationTimingFunction: easings.linear,\n\t\t\t\t\t\t\t\tanimationFillMode: \"both\",\n\t\t\t\t\t\t\t\tanimationTimeline: \"scroll(self inline)\",\n\t\t\t\t\t\t\t\t\"@media (prefers-reduced-motion: reduce)\": {\n\t\t\t\t\t\t\t\t\tanimationName: \"none\",\n\t\t\t\t\t\t\t\t\tmaskImage: TABLE_FADE_SETTLED_MASK,\n\t\t\t\t\t\t\t\t\t\"-webkit-mask-image\": TABLE_FADE_SETTLED_MASK,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where([data-not-typeset], [data-not-typeset] *)\": {\n\t\t\t\t\t\t\tall: \"revert-layer\",\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\n\t\t\t\t\tat(\n\t\t\t\t\t\t\"30rem\",\n\t\t\t\t\t\tCONTAINER_NAME,\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\"& :where(th, td)\": {\n\t\t\t\t\t\t\t\tpaddingInline: \"1em\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"& :where(pre)\": {\n\t\t\t\t\t\t\t\tpaddingInline: \"1.25em\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\n\t\t\t\t\twhen(\"& :where(pre)\", leading(1.6)),\n\n\t\t\t\t\twhen(\"& :where(h1, h2, h3, h4, h5, h6)\", [\n\t\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\t\tleading(1.25),\n\t\t\t\t\t\ttracking(\"tight\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tbalance(),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"& :where(h6)\", fg(\"neutral\")),\n\n\t\t\t\t\twhen(\"& :where(p, li, blockquote, dd)\", pretty()),\n\n\t\t\t\t\twhen(\"& :where(ul, ol)\", pis(\"1.5em\")),\n\t\t\t\t\twhen(\"& :where(li)::marker\", fg(\"neutral.muted\")),\n\n\t\t\t\t\twhen(\"& :where(blockquote)\", [\n\t\t\t\t\t\tpis(\"1em\"),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\tborderEdge(\"inline-start\", { color: \"neutral\", width: \"0.25em\" }),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"& :where(hr)\", borderEdge(\"block-start\", { color: \"neutral\", width: \"1px\" })),\n\n\t\t\t\t\twhen(\"& :where(a)\", [fg(\"brand\"), textDecoration(\"underline\")]),\n\t\t\t\t\twhen(\"& :where(a):focus-visible\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\trounded(\"xs\"),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"& :where(strong, b)\", [weight(\"semibold\"), fg(\"neutral.emphasis\")]),\n\n\t\t\t\t\twhen(\"& :where(code)\", [\n\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tpi(\"0.3em\"),\n\t\t\t\t\t\tpb(\"0.15em\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"& :where(pre)\", [\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tborder({ color: \"neutral.border\", width: 1 }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tpi(\"1em\"),\n\t\t\t\t\t\tpb(\"0.875em\"),\n\t\t\t\t\t\toverflowInline(\"auto\"),\n\t\t\t\t\t\toverflowBlock(\"hidden\"),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\toverscrollBehaviorInline: \"contain\",\n\t\t\t\t\t\t\toverscrollBehaviorX: \"contain\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t]),\n\t\t\t\t\t/**\n\t\t\t\t\t * A fenced block's `code` is an inline box, so the chip padding above would\n\t\t\t\t\t * apply at the start of the box alone and indent the block's first line\n\t\t\t\t\t * past every line under it. The block's own padding is the `pre`'s.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& :where(pre code)\", [\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tfg(\"inherit\"),\n\t\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\t\tpi(0),\n\t\t\t\t\t\tpb(0),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"& :where(table)\", [\n\t\t\t\t\t\tblock(),\n\t\t\t\t\t\tis(\"max(100%, max-content)\"),\n\t\t\t\t\t\tmaxIs(\"full\"),\n\t\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"& :where(th, td):not([align])\", textAlign(\"start\")),\n\t\t\t\t\twhen(\"& :where(th)\", [weight(\"semibold\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen(\"& :where(th, td)\", [\n\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\tpi(\"0.75em\"),\n\t\t\t\t\t\tpb(\"0.5em\"),\n\t\t\t\t\t\tborderEdge(\"block-end\", { color: \"neutral\", width: \"1px\" }),\n\t\t\t\t\t]),\n\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
|
|
10
|
+
"content": "/**\n * A typography layer wrapping already-rendered markdown or HTML content and\n * supplying every size, weight, spacing, and color decision through three\n * custom properties: `--ui-typeset-size`, `--ui-typeset-leading`, and\n * `--ui-typeset-flow`. `data-preset` swaps all three for a different rhythm\n * context; `data-not-typeset` opts a subtree out of the whole layer.\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 { keyframes } from \"@sdxc/u/animation\";\nimport { bg, border, borderEdge, fg, outline } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { raw } from \"@sdxc/u/general\";\nimport { block, container } from \"@sdxc/u/layout\";\nimport { overflow, overflowBlock, overflowInline } from \"@sdxc/u/overflow\";\nimport { at } from \"@sdxc/u/responsive\";\nimport { is, maxIs, pb, pi, pis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport {\n\tbalance,\n\tleading,\n\tpretty,\n\ttabularNums,\n\ttextAlign,\n\ttextDecoration,\n\ttracking,\n\tweight,\n} from \"@sdxc/u/typography\";\nimport { css } from \"remix/component\";\n\nimport { easings } from \"@sdxc/ui/animations\";\n\n/**\n * Named container {@link Typeset} declares on its own host, so its wide-table\n * handling can grant roomier cell and code-block padding once there's enough\n * space, instead of reading the viewport.\n */\nconst CONTAINER_NAME = \"ui-typeset\";\n\n/** Rhythm context {@link Typeset} falls back to when `preset` is omitted. */\nconst DEFAULT_PRESET: Typeset.Preset = \"docs\";\n\n/**\n * Body size each preset writes to `--ui-typeset-size`. On a 16px root, `docs`\n * is 18px and `reading` is 20px, so long-form copy is large enough to read;\n * `chat` is 15px for a turn taken in a denser column.\n */\nconst PRESET_BODY_SIZE: Record<Typeset.Preset, string> = {\n\tdocs: \"1.125rem\",\n\tchat: \"0.9375rem\",\n\treading: \"1.25rem\",\n};\n\n/**\n * Size body copy and headings compute from. Clearing `--ui-typeset-size`\n * still leaves the docs body, which is the preset a host uses by default.\n */\nconst TYPESET_SIZE = `var(--ui-typeset-size, ${PRESET_BODY_SIZE.docs})`;\n\n/** CSS length each edge of a wide table's own fade tapers over. */\nconst TABLE_FADE_SIZE = \"2.5rem\";\n\n/**\n * Custom property carrying the gradient direction a wide table's edge fade\n * paints along, mirrored under `:dir(rtl)` so the same mask string works in\n * both writing directions without a second, mirrored gradient.\n */\nconst TABLE_FADE_DIRECTION_PROPERTY = \"--ui-typeset-table-fade-direction\";\n\n/**\n * `@keyframes` name backing a wide table's scroll-linked edge fade; the\n * `keyframes()` call using it must stay a top-level mixin rather than nested\n * under the table selector, since the serializer only recognizes stops there.\n */\nconst TABLE_FADE_KEYFRAMES_NAME = \"ui-typeset-table-fade\";\n\n/** Proportion of a wide table's own scroll range its edge fade ramps across. */\nconst TABLE_FADE_RAMP_PERCENT = 10;\n\n/** The style shape {@link css} accepts, reused so a keyframes block can be built ahead of the call. */\ntype Styles = Parameters<typeof css>[0];\n\n/**\n * Builds the four-stop mask-image gradient a wide table's edge fade paints:\n * a leading stop, two middle stops marking where the faded band meets the\n * fully opaque middle, and a trailing stop; only the middle stops move.\n */\nfunction tableFadeMask(startStop: string, endStop: string): string {\n\treturn `linear-gradient(to var(${TABLE_FADE_DIRECTION_PROPERTY}, right), transparent 0%, black ${startStop}, black ${endStop}, transparent 100%)`;\n}\n\nconst TABLE_FADE_SETTLED_STOP = `calc(100% - ${TABLE_FADE_SIZE})`;\nconst TABLE_FADE_SETTLED_MASK = tableFadeMask(TABLE_FADE_SIZE, TABLE_FADE_SETTLED_STOP);\n\n/**\n * Stops the wide-table edge fade animates through: fully faded on the leading\n * edge at rest, settled on both edges across the long middle of the scroll\n * range, and fully faded on the trailing edge at the end.\n */\nconst TABLE_FADE_KEYFRAMES: Record<string, Styles> = {\n\t\"0%\": { maskImage: tableFadeMask(\"0%\", TABLE_FADE_SETTLED_STOP) },\n\t[`${TABLE_FADE_RAMP_PERCENT}%, ${100 - TABLE_FADE_RAMP_PERCENT}%`]: {\n\t\tmaskImage: TABLE_FADE_SETTLED_MASK,\n\t},\n\t\"100%\": { maskImage: tableFadeMask(TABLE_FADE_SIZE, \"100%\") },\n};\n\n/**\n * Prop types for {@link Typeset}.\n */\nexport namespace Typeset {\n\t/**\n\t * Rhythm context. `\"docs\"` sets the body at 18px, the size for a page meant\n\t * to be read. `\"reading\"` sets it at 20px for a long-form article. `\"chat\"`\n\t * sets it at 15px for a turn in a denser column.\n\t */\n\texport type Preset = \"docs\" | \"chat\" | \"reading\";\n\n\t/**\n\t * Every native `<div>` attribute plus `mix`. `preset` defaults to\n\t * {@link DEFAULT_PRESET}; setting a `--ui-typeset-*` property directly\n\t * overrides it, and `data-not-typeset` opts a subtree out entirely.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** Rhythm context. Defaults to {@link DEFAULT_PRESET}. */\n\t\tpreset?: Preset;\n\t}\n}\n\n/**\n * Renders a `<div>` that sizes and colors already-rendered markdown or HTML\n * content through `--ui-typeset-size`, `--ui-typeset-leading`, and\n * `--ui-typeset-flow`, computing heading sizes via `calc()` off one shared value.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the typeset layer's markup.\n * @example\n * <Typeset preset=\"reading\">{renderedArticleHtml}</Typeset>\n * @example\n * <Typeset preset=\"chat\">\n * \t<p>{t(\"assistant.reply\")}</p>\n * </Typeset>\n * @example\n * <Typeset>\n * \t<p>{t(\"docs.intro\")}</p>\n * \t<div data-not-typeset>\n * \t\t<EmbeddedWidget />\n * \t</div>\n * </Typeset>\n */\nexport function Typeset(handle: Handle<Typeset.Props>) {\n\treturn () => {\n\t\tlet { preset, mix, ...rest } = handle.props;\n\t\tlet resolvedPreset = preset ?? DEFAULT_PRESET;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-preset={resolvedPreset}\n\t\t\t\tdata-slot=\"typeset\"\n\t\t\t\tmix={[\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\tkeyframes(TABLE_FADE_KEYFRAMES_NAME, TABLE_FADE_KEYFRAMES),\n\t\t\t\t\traw({\n\t\t\t\t\t\tfontSize: TYPESET_SIZE,\n\t\t\t\t\t\tlineHeight: \"var(--ui-typeset-leading, 1.75)\",\n\n\t\t\t\t\t\t'&[data-preset=\"docs\"]': {\n\t\t\t\t\t\t\t\"--ui-typeset-size\": PRESET_BODY_SIZE.docs,\n\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.75\",\n\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"1.25em\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'&[data-preset=\"chat\"]': {\n\t\t\t\t\t\t\t\"--ui-typeset-size\": PRESET_BODY_SIZE.chat,\n\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.5\",\n\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"0.75em\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'&[data-preset=\"reading\"]': {\n\t\t\t\t\t\t\t\"--ui-typeset-size\": PRESET_BODY_SIZE.reading,\n\t\t\t\t\t\t\t\"--ui-typeset-leading\": \"1.8\",\n\t\t\t\t\t\t\t\"--ui-typeset-flow\": \"1.5em\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& > * + *\": {\n\t\t\t\t\t\t\tmarginBlockStart: \"var(--ui-typeset-flow, 1.25em)\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(blockquote, li) > * + *\": {\n\t\t\t\t\t\t\tmarginBlockStart: \"var(--ui-typeset-flow, 1.25em)\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(h1)\": {\n\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 2)`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(h2)\": {\n\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 1.5)`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(h3)\": {\n\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 1.25)`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(h4)\": {\n\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 1.125)`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(h5)\": {\n\t\t\t\t\t\t\tfontSize: TYPESET_SIZE,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(h6)\": {\n\t\t\t\t\t\t\tfontSize: `calc(${TYPESET_SIZE} * 0.875)`,\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(ul)\": {\n\t\t\t\t\t\t\tlistStyleType: \"disc\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(ol)\": {\n\t\t\t\t\t\t\tlistStyleType: \"decimal\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(ul, ol) :where(ul)\": {\n\t\t\t\t\t\t\tlistStyleType: \"circle\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(blockquote)\": {\n\t\t\t\t\t\t\tfontStyle: \"italic\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(a)\": {\n\t\t\t\t\t\t\ttextUnderlineOffset: \"0.15em\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(a):hover\": {\n\t\t\t\t\t\t\ttextDecorationThickness: \"2px\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(em, i)\": {\n\t\t\t\t\t\t\tfontStyle: \"italic\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(code)\": {\n\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(pre)\": {\n\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where(pre code)\": {\n\t\t\t\t\t\t\tpadding: \"0\",\n\t\t\t\t\t\t\tfontSize: \"1em\",\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"& :where(table)\": {\n\t\t\t\t\t\t\tborderCollapse: \"collapse\",\n\t\t\t\t\t\t\tfontSize: \"0.875em\",\n\t\t\t\t\t\t\tscrollbarWidth: \"thin\",\n\t\t\t\t\t\t\tscrollbarGutter: \"stable\",\n\n\t\t\t\t\t\t\t[TABLE_FADE_DIRECTION_PROPERTY]: \"right\",\n\t\t\t\t\t\t\tmaskImage: \"none\",\n\t\t\t\t\t\t\t\"-webkit-mask-image\": \"none\",\n\n\t\t\t\t\t\t\t\"&:dir(rtl)\": {\n\t\t\t\t\t\t\t\t[TABLE_FADE_DIRECTION_PROPERTY]: \"left\",\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\"&::-webkit-scrollbar\": {\n\t\t\t\t\t\t\t\twidth: \"0.75rem\",\n\t\t\t\t\t\t\t\theight: \"0.75rem\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"&::-webkit-scrollbar-track\": {\n\t\t\t\t\t\t\t\tbackgroundColor: \"transparent\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"&::-webkit-scrollbar-thumb\": {\n\t\t\t\t\t\t\t\tborderRadius: \"var(--ui-radius-full, 9999px)\",\n\t\t\t\t\t\t\t\tbackgroundColor: \"var(--ui-neutral-border)\",\n\t\t\t\t\t\t\t\tborderWidth: \"3px\",\n\t\t\t\t\t\t\t\tborderStyle: \"solid\",\n\t\t\t\t\t\t\t\tborderColor: \"transparent\",\n\t\t\t\t\t\t\t\tbackgroundClip: \"content-box\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"&::-webkit-scrollbar-thumb:hover\": {\n\t\t\t\t\t\t\t\tbackgroundColor: \"var(--ui-neutral-border-strong)\",\n\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\"@supports (animation-timeline: scroll())\": {\n\t\t\t\t\t\t\t\tanimationName: TABLE_FADE_KEYFRAMES_NAME,\n\t\t\t\t\t\t\t\tanimationDuration: \"auto\",\n\t\t\t\t\t\t\t\tanimationTimingFunction: easings.linear,\n\t\t\t\t\t\t\t\tanimationFillMode: \"both\",\n\t\t\t\t\t\t\t\tanimationTimeline: \"scroll(self inline)\",\n\t\t\t\t\t\t\t\t\"@media (prefers-reduced-motion: reduce)\": {\n\t\t\t\t\t\t\t\t\tanimationName: \"none\",\n\t\t\t\t\t\t\t\t\tmaskImage: TABLE_FADE_SETTLED_MASK,\n\t\t\t\t\t\t\t\t\t\"-webkit-mask-image\": TABLE_FADE_SETTLED_MASK,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"& :where([data-not-typeset], [data-not-typeset] *)\": {\n\t\t\t\t\t\t\tall: \"revert-layer\",\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\n\t\t\t\t\tat(\n\t\t\t\t\t\t\"30rem\",\n\t\t\t\t\t\tCONTAINER_NAME,\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\"& :where(th, td)\": {\n\t\t\t\t\t\t\t\tpaddingInline: \"1em\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"& :where(pre)\": {\n\t\t\t\t\t\t\t\tpaddingInline: \"1.25em\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\n\t\t\t\t\twhen(\"& :where(pre)\", leading(1.6)),\n\n\t\t\t\t\twhen(\"& :where(h1, h2, h3, h4, h5, h6)\", [\n\t\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\t\tleading(1.25),\n\t\t\t\t\t\ttracking(\"tight\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tbalance(),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"& :where(h6)\", fg(\"neutral\")),\n\n\t\t\t\t\twhen(\"& :where(p, li, blockquote, dd)\", pretty()),\n\n\t\t\t\t\twhen(\"& :where(ul, ol)\", pis(\"1.5em\")),\n\t\t\t\t\twhen(\"& :where(li)::marker\", fg(\"neutral.muted\")),\n\n\t\t\t\t\twhen(\"& :where(blockquote)\", [\n\t\t\t\t\t\tpis(\"1em\"),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\tborderEdge(\"inline-start\", { color: \"neutral\", width: \"0.25em\" }),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"& :where(hr)\", borderEdge(\"block-start\", { color: \"neutral\", width: \"1px\" })),\n\n\t\t\t\t\twhen(\"& :where(a)\", [fg(\"brand\"), textDecoration(\"underline\")]),\n\t\t\t\t\twhen(\"& :where(a):focus-visible\", [\n\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\trounded(\"xs\"),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"& :where(strong, b)\", [weight(\"semibold\"), fg(\"neutral.emphasis\")]),\n\n\t\t\t\t\twhen(\"& :where(code)\", [\n\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tpi(\"0.3em\"),\n\t\t\t\t\t\tpb(\"0.15em\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"& :where(pre)\", [\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tborder({ color: \"neutral.border\", width: 1 }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tpi(\"1em\"),\n\t\t\t\t\t\tpb(\"0.875em\"),\n\t\t\t\t\t\toverflowInline(\"auto\"),\n\t\t\t\t\t\toverflowBlock(\"hidden\"),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\toverscrollBehaviorInline: \"contain\",\n\t\t\t\t\t\t\toverscrollBehaviorX: \"contain\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t]),\n\t\t\t\t\t/**\n\t\t\t\t\t * A fenced block's `code` is an inline box, so the chip padding above would\n\t\t\t\t\t * apply at the start of the box alone and indent the block's first line\n\t\t\t\t\t * past every line under it. The block's own padding is the `pre`'s.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"& :where(pre code)\", [\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tfg(\"inherit\"),\n\t\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\t\tpi(0),\n\t\t\t\t\t\tpb(0),\n\t\t\t\t\t]),\n\n\t\t\t\t\twhen(\"& :where(table)\", [\n\t\t\t\t\t\tblock(),\n\t\t\t\t\t\tis(\"max(100%, max-content)\"),\n\t\t\t\t\t\tmaxIs(\"full\"),\n\t\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen(\"& :where(th, td):not([align])\", textAlign(\"start\")),\n\t\t\t\t\twhen(\"& :where(th)\", [weight(\"semibold\"), fg(\"neutral.emphasis\")]),\n\t\t\t\t\twhen(\"& :where(th, td)\", [\n\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\tpi(\"0.75em\"),\n\t\t\t\t\t\tpb(\"0.5em\"),\n\t\t\t\t\t\tborderEdge(\"block-end\", { color: \"neutral\", width: \"1px\" }),\n\t\t\t\t\t]),\n\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
|
|
11
11
|
},
|
|
12
12
|
"test": {
|
|
13
13
|
"path": "typeset.test.tsx",
|
|
14
|
-
"content": "/**\n * Regression tests for the wide-table edge fade's `@keyframes` rule. Its stops\n * are percentages, and `remix/component`'s serializer only reads keyframe stops as\n * stop selectors while the `@keyframes` rule sits outside any selector block —\n * nested inside the table's own selector, every stop serialized as a dropped\n * `0%: [object Object]` declaration and the animation did nothing.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Typeset } from \"@sdxc/ui/typeset\";\n\n/** The stylesheet {@link Typeset} emits, with every `<style>` tag joined. */\nasync function typesetCss(): Promise<string> {\n\tlet html = await renderToString(<Typeset />);\n\treturn [...html.matchAll(/<style[^>]*>([\\s\\S]*?)<\\/style>/g)].map((match) => match[1]).join(\"\\n\");\n}\n\ndescribe(Typeset.name, () => {\n\ttest(\"emits the table fade keyframes as real stop blocks\", async () => {\n\t\tlet css = await typesetCss();\n\n\t\texpect(css).toContain(\"@keyframes ui-typeset-table-fade\");\n\t\texpect(css).toMatch(/\\b0%\\s*\\{/);\n\t\texpect(css).toMatch(/\\b100%\\s*\\{/);\n\t\texpect(css).toMatch(/\\b10%,\\s*90%\\s*\\{/);\n\t\t/** The stops are only worth emitting if they actually carry the mask. */\n\t\texpect(css).toContain(\"mask-image\");\n\t});\n\n\ttest(\"never serializes a nested style block as a declaration value\", async () => {\n\t\texpect(await typesetCss()).not.toContain(\"[object Object]\");\n\t});\n\n\ttest(\"drives the animation it defines\", async () => {\n\t\tlet css = await typesetCss();\n\n\t\texpect(css).toContain(\"animation-name: ui-typeset-table-fade\");\n\t\texpect(css).toContain(\"animation-timeline: scroll(self inline)\");\n\t});\n\n\ttest(\"lets a vertical wheel over a code block chain to the page\", async () => {\n\t\tlet css = await typesetCss();\n\n\t\texpect(css).toContain(\"overflow-inline: auto\");\n\t\texpect(css).toContain(\"overflow-block: hidden\");\n\t\texpect(css).toContain(\"overscroll-behavior-inline: contain\");\n\t\texpect(css).toContain(\"overscroll-behavior-x: contain\");\n\t\texpect(css).not.toMatch(/overscroll-behavior:\\s*contain/);\n\t});\n});\n"
|
|
14
|
+
"content": "/**\n * Regression tests for the wide-table edge fade's `@keyframes` rule. Its stops\n * are percentages, and `remix/component`'s serializer only reads keyframe stops as\n * stop selectors while the `@keyframes` rule sits outside any selector block —\n * nested inside the table's own selector, every stop serialized as a dropped\n * `0%: [object Object]` declaration and the animation did nothing.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Typeset } from \"@sdxc/ui/typeset\";\n\n/** The stylesheet {@link Typeset} emits, with every `<style>` tag joined. */\nasync function typesetCss(): Promise<string> {\n\tlet html = await renderToString(<Typeset />);\n\treturn [...html.matchAll(/<style[^>]*>([\\s\\S]*?)<\\/style>/g)].map((match) => match[1]).join(\"\\n\");\n}\n\ndescribe(Typeset.name, () => {\n\ttest(\"emits the table fade keyframes as real stop blocks\", async () => {\n\t\tlet css = await typesetCss();\n\n\t\texpect(css).toContain(\"@keyframes ui-typeset-table-fade\");\n\t\texpect(css).toMatch(/\\b0%\\s*\\{/);\n\t\texpect(css).toMatch(/\\b100%\\s*\\{/);\n\t\texpect(css).toMatch(/\\b10%,\\s*90%\\s*\\{/);\n\t\t/** The stops are only worth emitting if they actually carry the mask. */\n\t\texpect(css).toContain(\"mask-image\");\n\t});\n\n\ttest(\"never serializes a nested style block as a declaration value\", async () => {\n\t\texpect(await typesetCss()).not.toContain(\"[object Object]\");\n\t});\n\n\ttest(\"drives the animation it defines\", async () => {\n\t\tlet css = await typesetCss();\n\n\t\texpect(css).toContain(\"animation-name: ui-typeset-table-fade\");\n\t\texpect(css).toContain(\"animation-timeline: scroll(self inline)\");\n\t});\n\n\ttest(\"sets long-form body copy at 18px for docs and 20px for reading\", async () => {\n\t\tlet css = await typesetCss();\n\n\t\texpect(css).toContain(\"--ui-typeset-size: 1.125rem\");\n\t\texpect(css).toContain(\"--ui-typeset-size: 1.25rem\");\n\t\texpect(css).toContain(\"--ui-typeset-size: 0.9375rem\");\n\t\texpect(css).not.toContain(\"--ui-typeset-size: 1rem\");\n\t\texpect(css).toContain(\"font-size: var(--ui-typeset-size, 1.125rem)\");\n\t\texpect(css).toContain(\"font-size: calc(var(--ui-typeset-size, 1.125rem) * 2)\");\n\t});\n\n\ttest(\"lets a vertical wheel over a code block chain to the page\", async () => {\n\t\tlet css = await typesetCss();\n\n\t\texpect(css).toContain(\"overflow-inline: auto\");\n\t\texpect(css).toContain(\"overflow-block: hidden\");\n\t\texpect(css).toContain(\"overscroll-behavior-inline: contain\");\n\t\texpect(css).toContain(\"overscroll-behavior-x: contain\");\n\t\texpect(css).not.toMatch(/overscroll-behavior:\\s*contain/);\n\t});\n});\n"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# The `{{command}}` command, run through the app's command line as a black box.
|
|
2
|
+
#
|
|
3
|
+
# @see https://sdxc.dev/docs/operations-and-testing/testing
|
|
4
|
+
# @see https://sdxc.dev/docs/operations-and-testing/your-apps-command-line
|
|
5
|
+
|
|
6
|
+
use cli
|
|
7
|
+
|
|
8
|
+
test "{{command}} runs" {
|
|
9
|
+
when {
|
|
10
|
+
let result = cli.run "bun" "run" "cli" {{args}} in "."
|
|
11
|
+
}
|
|
12
|
+
then {
|
|
13
|
+
expect result.exit_code 0
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The {{title}} endpoint, for a caller `{{ability}}` admits: describe what a client sends, what
|
|
3
|
+
* it gets back and which errors it should expect.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://sdxc.dev/docs/http-apis/json-apis}
|
|
6
|
+
* @see {@link https://sdxc.dev/docs/identity-and-security/authorization}{{header}}
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { createAction } from "remix/router";
|
|
10
|
+
|
|
11
|
+
import api from "~/app/http/middleware/api";
|
|
12
|
+
import abilities from "~/app/policies/abilities";
|
|
13
|
+
import routes from "{{routes}}";
|
|
14
|
+
|
|
15
|
+
export default createAction(routes.{{path}}, {
|
|
16
|
+
middleware: api,
|
|
17
|
+
/** Answers {{title}} as JSON once `ctx.access` admits `{{ability}}`. */
|
|
18
|
+
async handler(ctx) {
|
|
19
|
+
{{access}}
|
|
20
|
+
// TODO: answer the request
|
|
21
|
+
return Response.json({});
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# The {{title}} endpoint, called over HTTP the way a client calls it.
|
|
2
|
+
#
|
|
3
|
+
# @see https://sdxc.dev/docs/operations-and-testing/testing
|
|
4
|
+
# @see https://sdxc.dev/docs/http-apis/json-apis
|
|
5
|
+
|
|
6
|
+
use http
|
|
7
|
+
|
|
8
|
+
test "{{title}} answers" {
|
|
9
|
+
when {
|
|
10
|
+
let result = http.get "{{url}}" on "web"
|
|
11
|
+
}
|
|
12
|
+
then {
|
|
13
|
+
expect result.status 200
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -32,7 +32,7 @@ export default createController(routes.{{path}}, {
|
|
|
32
32
|
return ctx.render(
|
|
33
33
|
<DocumentLayout assets={ctx.assets} intl={ctx.intl} url={ctx.url} title="{{title}}">
|
|
34
34
|
<h1>{{title}}</h1>
|
|
35
|
-
<form method="post" action={routes.{{path}}.action.href()}>
|
|
35
|
+
<form method="post" action={routes.{{path}}.action.href({{params}})}>
|
|
36
36
|
<HoneypotFields {...fields} />
|
|
37
37
|
{/* TODO: replace the message field with the fields this form submits */}
|
|
38
38
|
<label>
|
|
@@ -55,7 +55,7 @@ export default createController(routes.{{path}}, {
|
|
|
55
55
|
// TODO: save the submission, then redirect where the visitor should land
|
|
56
56
|
return new Response(null, {
|
|
57
57
|
status: 303,
|
|
58
|
-
headers: { location: routes.{{path}}.index.href() },
|
|
58
|
+
headers: { location: routes.{{path}}.index.href({{params}}) },
|
|
59
59
|
});
|
|
60
60
|
},
|
|
61
61
|
},
|
|
@@ -16,7 +16,7 @@ import routes from "{{routes}}";
|
|
|
16
16
|
/** Posts `form` to the form's action. */
|
|
17
17
|
function submit(form: Record<string, string>) {
|
|
18
18
|
return createWebRouter().fetch(
|
|
19
|
-
new Request(new URL(routes.{{path}}.action.href(), "https://example.com"), {
|
|
19
|
+
new Request(new URL(routes.{{path}}.action.href({{sampleParams}}), "https://example.com"), {
|
|
20
20
|
method: "POST",
|
|
21
21
|
body: new URLSearchParams(form),
|
|
22
22
|
}),
|
|
@@ -26,7 +26,7 @@ function submit(form: Record<string, string>) {
|
|
|
26
26
|
describe("{{name}}", () => {
|
|
27
27
|
test("renders the form with its honeypot fields and CAPTCHA widget", async () => {
|
|
28
28
|
let response = await createWebRouter().fetch(
|
|
29
|
-
new URL(routes.{{path}}.index.href(), "https://example.com"),
|
|
29
|
+
new URL(routes.{{path}}.index.href({{sampleParams}}), "https://example.com"),
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
expect(response.status).toBe(200);
|