@adea-ai/ui 0.160.0 → 0.160.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"settings-layout.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/settings/settings-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAIvD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAExF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,cAAc,CAAC,OAAO,IAAI,CAAC,EAC3B,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,CACnE,GAAG;IACF,gFAAgF;IAChF,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAA;IAC1C,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAA;IACpB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,uEAAuE;IACvE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,+FAA+F;IAC/F,cAAc,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,KAAK,IAAI,CAAC,CAAA;IAC7E;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,wBAAwB,CAAA;IAC3C,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAWhE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAqDxD"}
1
+ {"version":3,"file":"settings-layout.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/settings/settings-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAIvD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAExF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,cAAc,CAAC,OAAO,IAAI,CAAC,EAC3B,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,CACnE,GAAG;IACF,gFAAgF;IAChF,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAA;IAC1C,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAA;IACpB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,uEAAuE;IACvE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,+FAA+F;IAC/F,cAAc,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,KAAK,IAAI,CAAC,CAAA;IAC7E;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,wBAAwB,CAAA;IAC3C,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAWhE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAsExD"}
@@ -2,8 +2,8 @@ import { MD_BREAKPOINT } from "../../../lib/breakpoints.js";
2
2
  import { cn } from "../../../lib/utils.js";
3
3
  import { Tabs } from "../../ui/tabs/tabs.js";
4
4
  import { SettingsNavigation } from "./settings-navigation.js";
5
- import { createComponent, insert, mergeProps, template } from "@solidjs/web";
6
- import { createSignal, omit, onSettled } from "solid-js";
5
+ import { createComponent, insert, mergeProps, ref, template } from "@solidjs/web";
6
+ import { createEffect, createSignal, omit, onSettled, untrack } from "solid-js";
7
7
  // src/components/composites/settings/settings-layout.tsx
8
8
  var _tmpl$ = /* @__PURE__ */ template(`<div data-slot=settings-layout-panels class="min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]">`);
9
9
  /** Below the `md` breakpoint the rail becomes a strip. */
@@ -43,6 +43,13 @@ function SettingsLayout(props) {
43
43
  if (requested !== "auto") return requested;
44
44
  return wide() ? "rail" : "strip";
45
45
  };
46
+ let panels;
47
+ let shown = untrack(() => local.value);
48
+ createEffect(() => local.value, (value) => {
49
+ if (value === shown) return;
50
+ shown = value;
51
+ if (panels) panels.scrollTop = 0;
52
+ });
46
53
  return createComponent(Tabs, mergeProps(rest, {
47
54
  get orientation() {
48
55
  return layout() === "rail" ? "vertical" : "horizontal";
@@ -78,6 +85,11 @@ function SettingsLayout(props) {
78
85
  }
79
86
  }), (() => {
80
87
  var _el$ = _tmpl$();
88
+ ref(() => {
89
+ return (element) => {
90
+ panels = element;
91
+ };
92
+ }, _el$);
81
93
  insert(_el$, () => {
82
94
  return local.children;
83
95
  });
@@ -1 +1 @@
1
- {"version":3,"file":"settings-layout.js","names":["<Tabs\n {...rest}\n orientation={layout() === 'rail' ? 'vertical' : 'horizontal'}\n data-navigation-layout={layout()}\n value={local.value}\n class={cn('min-h-0 min-w-0 flex-1 gap-0', local.class)}\n >\n <SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />\n <div\n data-slot=\"settings-layout-panels\"\n class=\"min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]\"\n >\n {local.children}\n </div>\n </Tabs>","<SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />"],"sources":["../../../../src/components/composites/settings/settings-layout.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from '@solidjs/web'\nimport { createSignal, onSettled, omit } from 'solid-js'\nimport { MD_BREAKPOINT } from '#lib/breakpoints'\nimport { cn } from '#lib/utils'\nimport { Tabs } from '../../ui/tabs'\nimport { SettingsNavigation, type SettingsNavigationGroup } from './settings-navigation'\n\nexport type SettingsLayoutProps = Omit<\n ComponentProps<typeof Tabs>,\n 'children' | 'orientation' | 'value' | 'defaultValue' | 'onChange'\n> & {\n /** Grouped navigation entries; the host owns their values and panel content. */\n groups: readonly SettingsNavigationGroup[]\n /** Accessible name for the tab list. */\n 'aria-label': string\n /** The host-controlled selected destination. */\n value: string\n /** Updates the host-controlled selected destination. */\n onChange: (value: string) => void\n /** Called when the already-selected destination is activated again. */\n onReselect?: (value: string) => void\n /** Reveal the selected row on value changes and window resizes. Defaults to nearest scroll. */\n revealSelected?: boolean | ((trigger: HTMLButtonElement | undefined) => void)\n /**\n * How the section navigation sits beside the panels. `auto` (the default) is\n * the vertical rail from 48rem of viewport width up and a horizontal,\n * scrollable strip of tabs above the panels below it. `rail` and `strip` pin\n * one shape at every width.\n */\n navigationLayout?: SettingsNavigationLayout\n /** Panels must be rendered as `TabsContent` descendants. */\n children?: JSX.Element\n}\n\nexport type SettingsNavigationLayout = 'auto' | 'rail' | 'strip'\n\n/** Below the `md` breakpoint the rail becomes a strip. */\nconst RAIL_MEDIA_QUERY = `(min-width: ${MD_BREAKPOINT})`\n\nfunction railQuery(): MediaQueryList | undefined {\n return typeof window === 'undefined' || typeof window.matchMedia !== 'function'\n ? undefined\n : window.matchMedia(RAIL_MEDIA_QUERY)\n}\n\n/**\n * SettingsLayout.\n *\n * A controlled, vertical settings rail beside its scrollable panel viewport.\n * The host keeps ownership of selection, URL/hash state and panel content.\n *\n * Below 48rem the rail becomes a horizontal strip of tabs above the panels.\n * A 6rem rail at phone width clips every label, so this is the default rather\n * than an opt-in. It changes the tab root's orientation, not just its\n * styling: the list's `aria-orientation` and the tabs' arrow keys (Up/Down on\n * the rail, Left/Right on the strip) follow the axis the reader sees. The\n * breakpoint is the viewport's, like CatalogBrowser's and ContextualSidebar's,\n * and is read before the first render so a phone never paints the rail. A\n * server render, which has no viewport, renders the rail.\n */\nexport function SettingsLayout(props: SettingsLayoutProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'children',\n 'groups',\n 'aria-label',\n 'value',\n 'onReselect',\n 'revealSelected',\n 'navigationLayout'\n )\n\n const [wide, setWide] = createSignal(railQuery()?.matches ?? true)\n onSettled(() => {\n const query = railQuery()\n if (!query) return\n const update = () => setWide(query.matches)\n update()\n query.addEventListener('change', update)\n return () => query.removeEventListener('change', update)\n })\n const layout = (): 'rail' | 'strip' => {\n const requested = local.navigationLayout ?? 'auto'\n if (requested !== 'auto') return requested\n return wide() ? 'rail' : 'strip'\n }\n\n return (\n <Tabs\n {...rest}\n orientation={layout() === 'rail' ? 'vertical' : 'horizontal'}\n data-navigation-layout={layout()}\n value={local.value}\n class={cn('min-h-0 min-w-0 flex-1 gap-0', local.class)}\n >\n <SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />\n <div\n data-slot=\"settings-layout-panels\"\n class=\"min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]\"\n >\n {local.children}\n </div>\n </Tabs>\n )\n}\n"],"mappings":";;;;;;;;;AAqCA,IAAM,mBAAmB,e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AA,UACD;IAKK,IAAA,OAAA,OAAA;IALL,OAAA,YAIE;KAAC,OAAA,MAAM;IAAQ,CACZ;IALL,OAAA;GAKK,EAAA,CAAA,CAbN;EAcK;;AAEV"}
1
+ {"version":3,"file":"settings-layout.js","names":["<Tabs\n {...rest}\n orientation={layout() === 'rail' ? 'vertical' : 'horizontal'}\n data-navigation-layout={layout()}\n value={local.value}\n class={cn('min-h-0 min-w-0 flex-1 gap-0', local.class)}\n >\n <SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />\n <div\n ref={(element: HTMLDivElement) => {\n panels = element\n }}\n data-slot=\"settings-layout-panels\"\n class=\"min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]\"\n >\n {local.children}\n </div>\n </Tabs>","<SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />","ref={(element: HTMLDivElement) => {\n panels = element\n }}"],"sources":["../../../../src/components/composites/settings/settings-layout.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from '@solidjs/web'\nimport { createEffect, createSignal, onSettled, omit, untrack } from 'solid-js'\nimport { MD_BREAKPOINT } from '#lib/breakpoints'\nimport { cn } from '#lib/utils'\nimport { Tabs } from '../../ui/tabs'\nimport { SettingsNavigation, type SettingsNavigationGroup } from './settings-navigation'\n\nexport type SettingsLayoutProps = Omit<\n ComponentProps<typeof Tabs>,\n 'children' | 'orientation' | 'value' | 'defaultValue' | 'onChange'\n> & {\n /** Grouped navigation entries; the host owns their values and panel content. */\n groups: readonly SettingsNavigationGroup[]\n /** Accessible name for the tab list. */\n 'aria-label': string\n /** The host-controlled selected destination. */\n value: string\n /** Updates the host-controlled selected destination. */\n onChange: (value: string) => void\n /** Called when the already-selected destination is activated again. */\n onReselect?: (value: string) => void\n /** Reveal the selected row on value changes and window resizes. Defaults to nearest scroll. */\n revealSelected?: boolean | ((trigger: HTMLButtonElement | undefined) => void)\n /**\n * How the section navigation sits beside the panels. `auto` (the default) is\n * the vertical rail from 48rem of viewport width up and a horizontal,\n * scrollable strip of tabs above the panels below it. `rail` and `strip` pin\n * one shape at every width.\n */\n navigationLayout?: SettingsNavigationLayout\n /** Panels must be rendered as `TabsContent` descendants. */\n children?: JSX.Element\n}\n\nexport type SettingsNavigationLayout = 'auto' | 'rail' | 'strip'\n\n/** Below the `md` breakpoint the rail becomes a strip. */\nconst RAIL_MEDIA_QUERY = `(min-width: ${MD_BREAKPOINT})`\n\nfunction railQuery(): MediaQueryList | undefined {\n return typeof window === 'undefined' || typeof window.matchMedia !== 'function'\n ? undefined\n : window.matchMedia(RAIL_MEDIA_QUERY)\n}\n\n/**\n * SettingsLayout.\n *\n * A controlled, vertical settings rail beside its scrollable panel viewport.\n * The host keeps ownership of selection, URL/hash state and panel content.\n *\n * Below 48rem the rail becomes a horizontal strip of tabs above the panels.\n * A 6rem rail at phone width clips every label, so this is the default rather\n * than an opt-in. It changes the tab root's orientation, not just its\n * styling: the list's `aria-orientation` and the tabs' arrow keys (Up/Down on\n * the rail, Left/Right on the strip) follow the axis the reader sees. The\n * breakpoint is the viewport's, like CatalogBrowser's and ContextualSidebar's,\n * and is read before the first render so a phone never paints the rail. A\n * server render, which has no viewport, renders the rail.\n */\nexport function SettingsLayout(props: SettingsLayoutProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'children',\n 'groups',\n 'aria-label',\n 'value',\n 'onReselect',\n 'revealSelected',\n 'navigationLayout'\n )\n\n const [wide, setWide] = createSignal(railQuery()?.matches ?? true)\n onSettled(() => {\n const query = railQuery()\n if (!query) return\n const update = () => setWide(query.matches)\n update()\n query.addEventListener('change', update)\n return () => query.removeEventListener('change', update)\n })\n const layout = (): 'rail' | 'strip' => {\n const requested = local.navigationLayout ?? 'auto'\n if (requested !== 'auto') return requested\n return wide() ? 'rail' : 'strip'\n }\n\n // Another section opens at its top. The panels share one scroller, and the section that\n // leaves and the one that opens are both in it for a moment, so its offset would otherwise\n // carry over (or be moved by scroll anchoring) into the new section.\n let panels: HTMLDivElement | undefined\n let shown = untrack(() => local.value)\n createEffect(\n () => local.value,\n (value) => {\n if (value === shown) return\n shown = value\n if (panels) panels.scrollTop = 0\n }\n )\n\n return (\n <Tabs\n {...rest}\n orientation={layout() === 'rail' ? 'vertical' : 'horizontal'}\n data-navigation-layout={layout()}\n value={local.value}\n class={cn('min-h-0 min-w-0 flex-1 gap-0', local.class)}\n >\n <SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />\n <div\n ref={(element: HTMLDivElement) => {\n panels = element\n }}\n data-slot=\"settings-layout-panels\"\n class=\"min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]\"\n >\n {local.children}\n </div>\n </Tabs>\n )\n}\n"],"mappings":";;;;;;;;;AAqCA,IAAM,mBAAmB,eAAe,cAAc;AAEtD,SAAS,YAAwC;CAC/C,OAAO,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,aACjE,KAAA,IACA,OAAO,WAAW,gBAAgB;AACxC;;;;;;;;;;;;;;;;AAiBA,SAAgB,eAAe,OAA4B;CACzD,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,YACA,UACA,cACA,SACA,cACA,kBACA,kBACF;CAEA,MAAM,CAAC,MAAM,WAAW,aAAa,UAAU,CAAC,EAAE,WAAW,IAAI;CACjE,gBAAgB;EACd,MAAM,QAAQ,UAAU;EACxB,IAAI,CAAC,OAAO;EACZ,MAAM,eAAe,QAAQ,MAAM,OAAO;EAC1C,OAAO;EACP,MAAM,i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pixel-resize-handle.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,sBAAsB,GAAG;IACnC,6EAA6E;IAC7E,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IACtB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,sCA2J9D"}
1
+ {"version":3,"file":"pixel-resize-handle.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,sBAAsB,GAAG;IACnC,6EAA6E;IAC7E,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IACtB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,sCAwK9D"}
@@ -29,29 +29,34 @@ function PixelResizeHandle(props) {
29
29
  const value = () => Math.min(maximum(), Math.max(minimum(), Math.round(props.value)));
30
30
  const isRight = () => props.side === "right";
31
31
  const bounded = (next) => Math.min(maximum(), Math.max(minimum(), Math.round(next)));
32
- const commit = () => props.onCommit?.(value());
32
+ const commit = (next = value()) => props.onCommit?.(next);
33
33
  let interacting = false;
34
34
  const [drag, setDrag] = createSignal();
35
35
  let pendingMove;
36
36
  let moveFrame;
37
+ let pointerValue;
37
38
  const flushMove = () => {
38
39
  if (moveFrame !== void 0) cancelAnimationFrame(moveFrame);
39
40
  moveFrame = void 0;
40
41
  const next = pendingMove;
41
42
  pendingMove = void 0;
42
- if (next !== void 0) move(next);
43
+ if (next === void 0) return;
44
+ move(next);
45
+ return next;
43
46
  };
44
47
  const scheduleMove = (next) => {
45
48
  pendingMove = next;
49
+ pointerValue = next;
46
50
  if (moveFrame === void 0) moveFrame = requestAnimationFrame(flushMove);
47
51
  };
48
52
  const endPointer = (shouldCommit) => {
49
53
  const current = drag();
50
54
  if (!current) return;
51
- flushMove();
55
+ const committed = flushMove() ?? pointerValue ?? value();
56
+ pointerValue = void 0;
52
57
  setDrag(void 0);
53
58
  if (current.handle.hasPointerCapture(current.pointerId)) current.handle.releasePointerCapture(current.pointerId);
54
- if (shouldCommit) commit();
59
+ if (shouldCommit) commit(committed);
55
60
  };
56
61
  const endKeyboard = () => {
57
62
  const wasInteracting = interacting;
@@ -128,6 +133,7 @@ function PixelResizeHandle(props) {
128
133
  interacting = false;
129
134
  handle.focus();
130
135
  handle.setPointerCapture(event.pointerId);
136
+ pointerValue = void 0;
131
137
  setDrag({
132
138
  pointerId: event.pointerId,
133
139
  startX: event.clientX,
@@ -1 +1 @@
1
- {"version":3,"file":"pixel-resize-handle.js","names":["<GripVertical class={resizeGripIconClass} />","class={resizeGripIconClass}","width: `${maximum()}px`","aria-label={props.label ?? `Resize ${props.side} pane`}","aria-controls={props.controls}","aria-valuemin={minimum()}","aria-valuemax={maximum()}","aria-valuenow={value()}","aria-valuetext={`${value()} pixels`}","data-dragging={drag() ? '' : undefined}","left: `${isRight() ? maximum() - value() : value()}px`","class={cn(\n resizeSeparatorClass(props.grip ?? 'rung'),\n 'pointer-events-auto absolute inset-y-0 w-px cursor-pointer'\n )}","<div\n class={cn(\n 'pointer-events-none absolute inset-y-0',\n {\n 'left-0': props.side === 'left',\n 'right-0': props.side === 'right',\n },\n props.class\n )}\n style={{ width: `${maximum()}px` }}\n >\n <div\n role=\"separator\"\n tabindex={0}\n aria-orientation=\"vertical\"\n aria-label={props.label ?? `Resize ${props.side} pane`}\n aria-controls={props.controls}\n aria-valuemin={minimum()}\n aria-valuemax={maximum()}\n aria-valuenow={value()}\n aria-valuetext={`${value()} pixels`}\n data-dragging={drag() ? '' : undefined}\n style={{ left: `${isRight() ? maximum() - value() : value()}px` }}\n class={cn(\n resizeSeparatorClass(props.grip ?? 'rung'),\n 'pointer-events-auto absolute inset-y-0 w-px cursor-pointer'\n )}\n onPointerDown={(event) => {\n if (event.button !== 0 || !event.isPrimary) return\n const handle = event.currentTarget\n endPointer(false)\n interacting = false\n handle.focus()\n handle.setPointerCapture(event.pointerId)\n setDrag({\n pointerId: event.pointerId,\n startX: event.clientX,\n startValue: value(),\n handle,\n })\n }}\n onPointerMove={(event) => {\n const current = drag()\n if (!current || event.pointerId !== current.pointerId) return\n if (!current.handle.hasPointerCapture(current.pointerId)) {\n endPointer(false)\n return\n }\n const delta = (event.clientX - current.startX) * (isRight() ? -1 : 1)\n scheduleMove(bounded(current.startValue + delta))\n }}\n // A press that lands in a text selection would start a native drag of it,\n // and the browser cancels the pointer gesture for that drag.\n onDragStart={(event) => event.preventDefault()}\n onPointerUp={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(true)\n }}\n onPointerCancel={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(false)\n }}\n onLostPointerCapture={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(false)\n }}\n onBlur={() => {\n endKeyboard()\n endPointer(false)\n }}\n onKeyDown={(event) => {\n const current = drag()\n if (current && !current.handle.hasPointerCapture(current.pointerId)) endPointer(false)\n if (drag()) {\n event.preventDefault()\n return\n }\n const direction = KEY_DIRECTION[event.key]\n if (direction !== undefined) {\n event.preventDefault()\n interacting = true\n move(bounded(value() + direction * (isRight() ? -1 : 1) * (props.step ?? 16)))\n } else if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault()\n interacting = true\n move(event.key === 'Home' ? minimum() : maximum())\n }\n }}\n onKeyUp={(event) => {\n if (['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) endKeyboard()\n }}\n >\n {props.grip === 'chip' ? (\n <div class={resizeGripClass.chip}>\n <GripVertical class={resizeGripIconClass} />\n </div>\n ) : (\n <div data-slot=\"resizable-grip\" class={resizeGripClass.rung} />\n )}\n </div>\n </div>","GripVertical","LucideGripVertical","_$readShallow","_$setStyleProperty","_$setAttribute"],"sources":["../../../../src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx"],"sourcesContent":["import { GripVertical as LucideGripVertical } from '@lucide/solid'\nimport { createSignal, onCleanup } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { resizeGripClass, resizeGripIconClass, resizeSeparatorClass } from '#lib/resize-separator'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst GripVertical = fastIcon(LucideGripVertical)\n\nexport type PixelResizeHandleProps = {\n /** Which physical edge of the ruler the resizable surface is attached to. */\n side: 'left' | 'right'\n /** Current width in CSS pixels. */\n value: number\n minimum: number\n maximum: number\n step?: number\n label?: string\n controls?: string\n class?: string\n /**\n * The grip drawn on the edge: the quieter rung by default, or the bordered\n * chip for hosts that want the heavier affordance.\n */\n grip?: 'chip' | 'rung'\n onChange(value: number): void\n onCommit?(value: number): void\n}\n\n/**\n * PixelResizeHandle.\n *\n * A keyboard- and pointer-operable edge ruler for a host-owned pane. Keep the\n * pane's actual width and any persistence in its layout owner; this component\n * reports a bounded pixel value and draws the grip at the matching left or\n * right edge.\n *\n * The ruler is a single separator positioned inside a box as wide as the\n * maximum, so it needs no panel-group geometry (and none of the split-layout\n * code that comes with one): arrow keys move it by `step` along its visual\n * edge, Home and End jump to the bounds, and a pointer drag is captured on the\n * handle so cancellation and lost capture end the gesture.\n */\nexport function PixelResizeHandle(props: PixelResizeHandleProps) {\n const maximum = () => Math.max(1, props.maximum)\n const minimum = () => Math.min(maximum(), Math.max(0, props.minimum))\n const value = () => Math.min(maximum(), Math.max(minimum(), Math.round(props.value)))\n const isRight = () => props.side === 'right'\n const bounded = (next: number) => Math.min(maximum(), Math.max(minimum(), Math.round(next)))\n const commit = () => props.onCommit?.(value())\n let interacting = false\n const [drag, setDrag] = createSignal<{\n pointerId: number\n startX: number\n startValue: number\n handle: HTMLElement\n }>()\n // Pointer moves are applied once per frame: each `onChange` relays out the\n // shell, and pointer events can arrive faster than frames (WebKit does not align\n // them). Ending the gesture applies the last pending value first.\n let pendingMove: number | undefined\n let moveFrame: number | undefined\n const flushMove = () => {\n if (moveFrame !== undefined) cancelAnimationFrame(moveFrame)\n moveFrame = undefined\n const next = pendingMove\n pendingMove = undefined\n if (next !== undefined) move(next)\n }\n const scheduleMove = (next: number) => {\n pendingMove = next\n if (moveFrame === undefined) moveFrame = requestAnimationFrame(flushMove)\n }\n const endPointer = (shouldCommit: boolean) => {\n const current = drag()\n if (!current) return\n flushMove()\n setDrag(undefined)\n if (current.handle.hasPointerCapture(current.pointerId))\n current.handle.releasePointerCapture(current.pointerId)\n if (shouldCommit) commit()\n }\n const endKeyboard = () => {\n const wasInteracting = interacting\n interacting = false\n if (wasInteracting) commit()\n }\n onCleanup(() => {\n endKeyboard()\n endPointer(false)\n })\n const move = (next: number) => {\n if (next !== value()) props.onChange(next)\n }\n // Arrow keys describe physical movement of the handle: on a right-edge pane\n // moving the handle left widens the pane.\n const KEY_DIRECTION: Record<string, number> = { ArrowLeft: -1, ArrowRight: 1 }\n\n return (\n <div\n class={cn(\n 'pointer-events-none absolute inset-y-0',\n {\n 'left-0': props.side === 'left',\n 'right-0': props.side === 'right',\n },\n props.class\n )}\n style={{ width: `${maximum()}px` }}\n >\n <div\n role=\"separator\"\n tabindex={0}\n aria-orientation=\"vertical\"\n aria-label={props.label ?? `Resize ${props.side} pane`}\n aria-controls={props.controls}\n aria-valuemin={minimum()}\n aria-valuemax={maximum()}\n aria-valuenow={value()}\n aria-valuetext={`${value()} pixels`}\n data-dragging={drag() ? '' : undefined}\n style={{ left: `${isRight() ? maximum() - value() : value()}px` }}\n class={cn(\n resizeSeparatorClass(props.grip ?? 'rung'),\n 'pointer-events-auto absolute inset-y-0 w-px cursor-pointer'\n )}\n onPointerDown={(event) => {\n if (event.button !== 0 || !event.isPrimary) return\n const handle = event.currentTarget\n endPointer(false)\n interacting = false\n handle.focus()\n handle.setPointerCapture(event.pointerId)\n setDrag({\n pointerId: event.pointerId,\n startX: event.clientX,\n startValue: value(),\n handle,\n })\n }}\n onPointerMove={(event) => {\n const current = drag()\n if (!current || event.pointerId !== current.pointerId) return\n if (!current.handle.hasPointerCapture(current.pointerId)) {\n endPointer(false)\n return\n }\n const delta = (event.clientX - current.startX) * (isRight() ? -1 : 1)\n scheduleMove(bounded(current.startValue + delta))\n }}\n // A press that lands in a text selection would start a native drag of it,\n // and the browser cancels the pointer gesture for that drag.\n onDragStart={(event) => event.preventDefault()}\n onPointerUp={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(true)\n }}\n onPointerCancel={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(false)\n }}\n onLostPointerCapture={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(false)\n }}\n onBlur={() => {\n endKeyboard()\n endPointer(false)\n }}\n onKeyDown={(event) => {\n const current = drag()\n if (current && !current.handle.hasPointerCapture(current.pointerId)) endPointer(false)\n if (drag()) {\n event.preventDefault()\n return\n }\n const direction = KEY_DIRECTION[event.key]\n if (direction !== undefined) {\n event.preventDefault()\n interacting = true\n move(bounded(value() + direction * (isRight() ? -1 : 1) * (props.step ?? 16)))\n } else if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault()\n interacting = true\n move(event.key === 'Home' ? minimum() : maximum())\n }\n }}\n onKeyUp={(event) => {\n if (['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) endKeyboard()\n }}\n >\n {props.grip === 'chip' ? (\n <div class={resizeGripClass.chip}>\n <GripVertical class={resizeGripIconClass} />\n </div>\n ) : (\n <div data-slot=\"resizable-grip\" class={resizeGripClass.rung} />\n )}\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;AAOA,IAAMa,iBAAe,SAASC,YAAkB;;;;;;;;;;;;;;;AAoChD,SAAgB,kBAAkB,OAA+B;CAC/D,MAAM,gBAAgB,KAAK,IAAI,GAAG,MAAM,OAAO;CAC/C,MAAM,gBAAgB,KAAK,IAAI,QAAQ,GAAG,KAAK,IAAI,GAAG,MAAM,OAAO,CAAC;CACpE,MAAM,cAAc,KAAK,IAAI,QAAQ,GAAG,KAAK,IAAI,QAAQ,GAAG,KAAK,MAAM,MAAM,KAAK,CAAC,CAAC;CACpF,MAAM,gBAAgB,MAAM,SAAS;CACrC,MAAM,WAAW,SAAiB,KAAK,IAAI,QAAQ,GAAG,KAAK,IAAI,QAAQ,GAAG,KAAK,MAAM,IAAI,CAAC,CAAC;CAC3F,MAAM,eAAe,MAAM,WAAW,MAAM,CAAC;CAC7C,IAAI,cAAc;CAClB,MAAM,CAAC,MAAM,WAAW,aAKrB;CAIH,IAAI;CACJ,IAAI;CACJ,MAAM,kBAAkB;EACtB,IAAI,cAAc,KAAA,GAAW,qBAAqB,SAAS;EAC3D,YAAY,KAAA;EACZ,MAAM,OAAO;EACb,cAAc,KAAA;EACd,IAAI,S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A,iBAAA,CAAsB;EACtB,MAAA,KAAA,KAAAA,aAAA,OAAA,kBAAA,CAAmC;EACnC,MAAA,KAAA,KAAAA,aAAA,OAAA,iBAAA,CAAsC;EAC7B,MAAA,KAAA,KAAAD,iBAAA,OAAA,QAAA,CAAqD;EAC9D,UAAA,OAAA,GAAA,KAAA,CAGC;CAlBF,CAAA;CATL,OACEJ;AAmGJ"}
1
+ {"version":3,"file":"pixel-resize-handle.js","names":["<GripVertical class={resizeGripIconClass} />","class={resizeGripIconClass}","width: `${maximum()}px`","aria-label={props.label ?? `Resize ${props.side} pane`}","aria-controls={props.controls}","aria-valuemin={minimum()}","aria-valuemax={maximum()}","aria-valuenow={value()}","aria-valuetext={`${value()} pixels`}","data-dragging={drag() ? '' : undefined}","left: `${isRight() ? maximum() - value() : value()}px`","class={cn(\n resizeSeparatorClass(props.grip ?? 'rung'),\n 'pointer-events-auto absolute inset-y-0 w-px cursor-pointer'\n )}","<div\n class={cn(\n 'pointer-events-none absolute inset-y-0',\n {\n 'left-0': props.side === 'left',\n 'right-0': props.side === 'right',\n },\n props.class\n )}\n style={{ width: `${maximum()}px` }}\n >\n <div\n role=\"separator\"\n tabindex={0}\n aria-orientation=\"vertical\"\n aria-label={props.label ?? `Resize ${props.side} pane`}\n aria-controls={props.controls}\n aria-valuemin={minimum()}\n aria-valuemax={maximum()}\n aria-valuenow={value()}\n aria-valuetext={`${value()} pixels`}\n data-dragging={drag() ? '' : undefined}\n style={{ left: `${isRight() ? maximum() - value() : value()}px` }}\n class={cn(\n resizeSeparatorClass(props.grip ?? 'rung'),\n 'pointer-events-auto absolute inset-y-0 w-px cursor-pointer'\n )}\n onPointerDown={(event) => {\n if (event.button !== 0 || !event.isPrimary) return\n const handle = event.currentTarget\n endPointer(false)\n interacting = false\n handle.focus()\n handle.setPointerCapture(event.pointerId)\n pointerValue = undefined\n setDrag({\n pointerId: event.pointerId,\n startX: event.clientX,\n startValue: value(),\n handle,\n })\n }}\n onPointerMove={(event) => {\n const current = drag()\n if (!current || event.pointerId !== current.pointerId) return\n if (!current.handle.hasPointerCapture(current.pointerId)) {\n endPointer(false)\n return\n }\n const delta = (event.clientX - current.startX) * (isRight() ? -1 : 1)\n scheduleMove(bounded(current.startValue + delta))\n }}\n // A press that lands in a text selection would start a native drag of it,\n // and the browser cancels the pointer gesture for that drag.\n onDragStart={(event) => event.preventDefault()}\n onPointerUp={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(true)\n }}\n onPointerCancel={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(false)\n }}\n onLostPointerCapture={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(false)\n }}\n onBlur={() => {\n endKeyboard()\n endPointer(false)\n }}\n onKeyDown={(event) => {\n const current = drag()\n if (current && !current.handle.hasPointerCapture(current.pointerId)) endPointer(false)\n if (drag()) {\n event.preventDefault()\n return\n }\n const direction = KEY_DIRECTION[event.key]\n if (direction !== undefined) {\n event.preventDefault()\n interacting = true\n move(bounded(value() + direction * (isRight() ? -1 : 1) * (props.step ?? 16)))\n } else if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault()\n interacting = true\n move(event.key === 'Home' ? minimum() : maximum())\n }\n }}\n onKeyUp={(event) => {\n if (['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) endKeyboard()\n }}\n >\n {props.grip === 'chip' ? (\n <div class={resizeGripClass.chip}>\n <GripVertical class={resizeGripIconClass} />\n </div>\n ) : (\n <div data-slot=\"resizable-grip\" class={resizeGripClass.rung} />\n )}\n </div>\n </div>","GripVertical","LucideGripVertical","_$readShallow","_$setStyleProperty","_$setAttribute"],"sources":["../../../../src/components/layout/pixel-resize-handle/pixel-resize-handle.tsx"],"sourcesContent":["import { GripVertical as LucideGripVertical } from '@lucide/solid'\nimport { createSignal, onCleanup } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { resizeGripClass, resizeGripIconClass, resizeSeparatorClass } from '#lib/resize-separator'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst GripVertical = fastIcon(LucideGripVertical)\n\nexport type PixelResizeHandleProps = {\n /** Which physical edge of the ruler the resizable surface is attached to. */\n side: 'left' | 'right'\n /** Current width in CSS pixels. */\n value: number\n minimum: number\n maximum: number\n step?: number\n label?: string\n controls?: string\n class?: string\n /**\n * The grip drawn on the edge: the quieter rung by default, or the bordered\n * chip for hosts that want the heavier affordance.\n */\n grip?: 'chip' | 'rung'\n onChange(value: number): void\n onCommit?(value: number): void\n}\n\n/**\n * PixelResizeHandle.\n *\n * A keyboard- and pointer-operable edge ruler for a host-owned pane. Keep the\n * pane's actual width and any persistence in its layout owner; this component\n * reports a bounded pixel value and draws the grip at the matching left or\n * right edge.\n *\n * The ruler is a single separator positioned inside a box as wide as the\n * maximum, so it needs no panel-group geometry (and none of the split-layout\n * code that comes with one): arrow keys move it by `step` along its visual\n * edge, Home and End jump to the bounds, and a pointer drag is captured on the\n * handle so cancellation and lost capture end the gesture.\n */\nexport function PixelResizeHandle(props: PixelResizeHandleProps) {\n const maximum = () => Math.max(1, props.maximum)\n const minimum = () => Math.min(maximum(), Math.max(0, props.minimum))\n const value = () => Math.min(maximum(), Math.max(minimum(), Math.round(props.value)))\n const isRight = () => props.side === 'right'\n const bounded = (next: number) => Math.min(maximum(), Math.max(minimum(), Math.round(next)))\n const commit = (next = value()) => props.onCommit?.(next)\n let interacting = false\n const [drag, setDrag] = createSignal<{\n pointerId: number\n startX: number\n startValue: number\n handle: HTMLElement\n }>()\n // Pointer moves are applied once per frame: each `onChange` relays out the\n // shell, and pointer events can arrive faster than frames (WebKit does not align\n // them). Ending the gesture applies the last pending value first.\n let pendingMove: number | undefined\n let moveFrame: number | undefined\n // The last value the pointer asked for, whether or not its frame has run. A\n // release reads this rather than the prop, which reports the host's previous\n // width until the update renders.\n let pointerValue: number | undefined\n const flushMove = () => {\n if (moveFrame !== undefined) cancelAnimationFrame(moveFrame)\n moveFrame = undefined\n const next = pendingMove\n pendingMove = undefined\n if (next === undefined) return\n move(next)\n return next\n }\n const scheduleMove = (next: number) => {\n pendingMove = next\n pointerValue = next\n if (moveFrame === undefined) moveFrame = requestAnimationFrame(flushMove)\n }\n const endPointer = (shouldCommit: boolean) => {\n const current = drag()\n if (!current) return\n const applied = flushMove()\n // The pending move is applied to the host first, but the prop it reports\n // through is read on the next render. Commit the value just applied, not\n // the stale prop, or a fast release reports the previous width.\n const committed = applied ?? pointerValue ?? value()\n pointerValue = undefined\n setDrag(undefined)\n if (current.handle.hasPointerCapture(current.pointerId))\n current.handle.releasePointerCapture(current.pointerId)\n if (shouldCommit) commit(committed)\n }\n const endKeyboard = () => {\n const wasInteracting = interacting\n interacting = false\n if (wasInteracting) commit()\n }\n onCleanup(() => {\n endKeyboard()\n endPointer(false)\n })\n const move = (next: number) => {\n if (next !== value()) props.onChange(next)\n }\n // Arrow keys describe physical movement of the handle: on a right-edge pane\n // moving the handle left widens the pane.\n const KEY_DIRECTION: Record<string, number> = { ArrowLeft: -1, ArrowRight: 1 }\n\n return (\n <div\n class={cn(\n 'pointer-events-none absolute inset-y-0',\n {\n 'left-0': props.side === 'left',\n 'right-0': props.side === 'right',\n },\n props.class\n )}\n style={{ width: `${maximum()}px` }}\n >\n <div\n role=\"separator\"\n tabindex={0}\n aria-orientation=\"vertical\"\n aria-label={props.label ?? `Resize ${props.side} pane`}\n aria-controls={props.controls}\n aria-valuemin={minimum()}\n aria-valuemax={maximum()}\n aria-valuenow={value()}\n aria-valuetext={`${value()} pixels`}\n data-dragging={drag() ? '' : undefined}\n style={{ left: `${isRight() ? maximum() - value() : value()}px` }}\n class={cn(\n resizeSeparatorClass(props.grip ?? 'rung'),\n 'pointer-events-auto absolute inset-y-0 w-px cursor-pointer'\n )}\n onPointerDown={(event) => {\n if (event.button !== 0 || !event.isPrimary) return\n const handle = event.currentTarget\n endPointer(false)\n interacting = false\n handle.focus()\n handle.setPointerCapture(event.pointerId)\n pointerValue = undefined\n setDrag({\n pointerId: event.pointerId,\n startX: event.clientX,\n startValue: value(),\n handle,\n })\n }}\n onPointerMove={(event) => {\n const current = drag()\n if (!current || event.pointerId !== current.pointerId) return\n if (!current.handle.hasPointerCapture(current.pointerId)) {\n endPointer(false)\n return\n }\n const delta = (event.clientX - current.startX) * (isRight() ? -1 : 1)\n scheduleMove(bounded(current.startValue + delta))\n }}\n // A press that lands in a text selection would start a native drag of it,\n // and the browser cancels the pointer gesture for that drag.\n onDragStart={(event) => event.preventDefault()}\n onPointerUp={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(true)\n }}\n onPointerCancel={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(false)\n }}\n onLostPointerCapture={(event) => {\n if (event.pointerId === drag()?.pointerId) endPointer(false)\n }}\n onBlur={() => {\n endKeyboard()\n endPointer(false)\n }}\n onKeyDown={(event) => {\n const current = drag()\n if (current && !current.handle.hasPointerCapture(current.pointerId)) endPointer(false)\n if (drag()) {\n event.preventDefault()\n return\n }\n const direction = KEY_DIRECTION[event.key]\n if (direction !== undefined) {\n event.preventDefault()\n interacting = true\n move(bounded(value() + direction * (isRight() ? -1 : 1) * (props.step ?? 16)))\n } else if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault()\n interacting = true\n move(event.key === 'Home' ? minimum() : maximum())\n }\n }}\n onKeyUp={(event) => {\n if (['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) endKeyboard()\n }}\n >\n {props.grip === 'chip' ? (\n <div class={resizeGripClass.chip}>\n <GripVertical class={resizeGripIconClass} />\n </div>\n ) : (\n <div data-slot=\"resizable-grip\" class={resizeGripClass.rung} />\n )}\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;AAOA,IAAMa,iBAAe,SAASC,YAAkB;;;;;;;;;;;;;;;AAoChD,SAAgB,kBAAkB,OAA+B;CAC/D,MAAM,gBAAgB,KAAK,IAAI,GAAG,MAAM,OAAO;CAC/C,MAAM,gBAAgB,KAAK,IAAI,QAAQ,GA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;GACvBC,GAAe,MAAM;GACrBC,GAAgB,GAAG,MAAM,EAAE;GAC3BC,GAAe,KAAK,IAAI,KAAK,KAAA;GACpBC,GAAM,GAAG,QAAQ,IAAI,QAAQ,IAAI,MAAM,IAAI,MAAM,EAAE;GAC5DC,GAAAA,YAAO,GACL,qBAAqB,MAAM,QAAQ,MAAM,GACzC,4DACF,CAAC;EAlBF;CAPD,IAAA,EAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,GAAA,KAAA,QAAA;EAOC,UAAA,MAAA,GAAA,KAAA,CAAA;EACQ,MAAA,KAAA,KAAAK,iBAAA,MAAA,SAAA,CAAsB;EAM7B,MAAA,KAAA,KAAAC,aAAA,OAAA,cAAA,CAAsD;EACtD,MAAA,KAAA,KAAAA,aAAA,OAAA,iBAAA,CAA6B;EAC7B,MAAA,KAAA,KAAAA,aAAA,OAAA,iBAAA,CAAwB;EACxB,MAAA,KAAA,KAAAA,aAAA,OAAA,iBAAA,CAAwB;EACxB,MAAA,KAAA,KAAAA,aAAA,OAAA,iBAAA,CAAsB;EACtB,MAAA,KAAA,KAAAA,aAAA,OAAA,kBAAA,CAAmC;EACnC,MAAA,KAAA,KAAAA,aAAA,OAAA,iBAAA,CAAsC;EAC7B,MAAA,KAAA,KAAAD,iBAAA,OAAA,QAAA,CAAqD;EAC9D,UAAA,OAAA,GAAA,KAAA,CAGC;CAlBF,CAAA;CATL,OACEJ;AAoGJ"}
@@ -1,5 +1,5 @@
1
1
  import type { ComponentProps, JSX } from '@solidjs/web'
2
- import { createSignal, onSettled, omit } from 'solid-js'
2
+ import { createEffect, createSignal, onSettled, omit, untrack } from 'solid-js'
3
3
  import { MD_BREAKPOINT } from '../../../lib/breakpoints'
4
4
  import { cn } from '../../../lib/utils'
5
5
  import { Tabs } from '../../ui/tabs'
@@ -87,6 +87,20 @@ export function SettingsLayout(props: SettingsLayoutProps) {
87
87
  return wide() ? 'rail' : 'strip'
88
88
  }
89
89
 
90
+ // Another section opens at its top. The panels share one scroller, and the section that
91
+ // leaves and the one that opens are both in it for a moment, so its offset would otherwise
92
+ // carry over (or be moved by scroll anchoring) into the new section.
93
+ let panels: HTMLDivElement | undefined
94
+ let shown = untrack(() => local.value)
95
+ createEffect(
96
+ () => local.value,
97
+ (value) => {
98
+ if (value === shown) return
99
+ shown = value
100
+ if (panels) panels.scrollTop = 0
101
+ }
102
+ )
103
+
90
104
  return (
91
105
  <Tabs
92
106
  {...rest}
@@ -104,6 +118,9 @@ export function SettingsLayout(props: SettingsLayoutProps) {
104
118
  class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}
105
119
  />
106
120
  <div
121
+ ref={(element: HTMLDivElement) => {
122
+ panels = element
123
+ }}
107
124
  data-slot="settings-layout-panels"
108
125
  class="min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]"
109
126
  >
@@ -47,7 +47,7 @@ export function PixelResizeHandle(props: PixelResizeHandleProps) {
47
47
  const value = () => Math.min(maximum(), Math.max(minimum(), Math.round(props.value)))
48
48
  const isRight = () => props.side === 'right'
49
49
  const bounded = (next: number) => Math.min(maximum(), Math.max(minimum(), Math.round(next)))
50
- const commit = () => props.onCommit?.(value())
50
+ const commit = (next = value()) => props.onCommit?.(next)
51
51
  let interacting = false
52
52
  const [drag, setDrag] = createSignal<{
53
53
  pointerId: number
@@ -60,25 +60,37 @@ export function PixelResizeHandle(props: PixelResizeHandleProps) {
60
60
  // them). Ending the gesture applies the last pending value first.
61
61
  let pendingMove: number | undefined
62
62
  let moveFrame: number | undefined
63
+ // The last value the pointer asked for, whether or not its frame has run. A
64
+ // release reads this rather than the prop, which reports the host's previous
65
+ // width until the update renders.
66
+ let pointerValue: number | undefined
63
67
  const flushMove = () => {
64
68
  if (moveFrame !== undefined) cancelAnimationFrame(moveFrame)
65
69
  moveFrame = undefined
66
70
  const next = pendingMove
67
71
  pendingMove = undefined
68
- if (next !== undefined) move(next)
72
+ if (next === undefined) return
73
+ move(next)
74
+ return next
69
75
  }
70
76
  const scheduleMove = (next: number) => {
71
77
  pendingMove = next
78
+ pointerValue = next
72
79
  if (moveFrame === undefined) moveFrame = requestAnimationFrame(flushMove)
73
80
  }
74
81
  const endPointer = (shouldCommit: boolean) => {
75
82
  const current = drag()
76
83
  if (!current) return
77
- flushMove()
84
+ const applied = flushMove()
85
+ // The pending move is applied to the host first, but the prop it reports
86
+ // through is read on the next render. Commit the value just applied, not
87
+ // the stale prop, or a fast release reports the previous width.
88
+ const committed = applied ?? pointerValue ?? value()
89
+ pointerValue = undefined
78
90
  setDrag(undefined)
79
91
  if (current.handle.hasPointerCapture(current.pointerId))
80
92
  current.handle.releasePointerCapture(current.pointerId)
81
- if (shouldCommit) commit()
93
+ if (shouldCommit) commit(committed)
82
94
  }
83
95
  const endKeyboard = () => {
84
96
  const wasInteracting = interacting
@@ -131,6 +143,7 @@ export function PixelResizeHandle(props: PixelResizeHandleProps) {
131
143
  interacting = false
132
144
  handle.focus()
133
145
  handle.setPointerCapture(event.pointerId)
146
+ pointerValue = undefined
134
147
  setDrag({
135
148
  pointerId: event.pointerId,
136
149
  startX: event.clientX,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/ui",
3
- "version": "0.160.0",
3
+ "version": "0.160.2",
4
4
  "description": "The Adea design system: ui-sdk-backed Solid components, semantic OKLCH tokens, and the app-shell layout primitives shared by Adea and Cortana.",
5
5
  "keywords": [
6
6
  "adea",
@@ -1,5 +1,5 @@
1
1
  import type { ComponentProps, JSX } from '@solidjs/web'
2
- import { createSignal, onSettled, omit } from 'solid-js'
2
+ import { createEffect, createSignal, onSettled, omit, untrack } from 'solid-js'
3
3
  import { MD_BREAKPOINT } from '#lib/breakpoints'
4
4
  import { cn } from '#lib/utils'
5
5
  import { Tabs } from '../../ui/tabs'
@@ -87,6 +87,20 @@ export function SettingsLayout(props: SettingsLayoutProps) {
87
87
  return wide() ? 'rail' : 'strip'
88
88
  }
89
89
 
90
+ // Another section opens at its top. The panels share one scroller, and the section that
91
+ // leaves and the one that opens are both in it for a moment, so its offset would otherwise
92
+ // carry over (or be moved by scroll anchoring) into the new section.
93
+ let panels: HTMLDivElement | undefined
94
+ let shown = untrack(() => local.value)
95
+ createEffect(
96
+ () => local.value,
97
+ (value) => {
98
+ if (value === shown) return
99
+ shown = value
100
+ if (panels) panels.scrollTop = 0
101
+ }
102
+ )
103
+
90
104
  return (
91
105
  <Tabs
92
106
  {...rest}
@@ -104,6 +118,9 @@ export function SettingsLayout(props: SettingsLayoutProps) {
104
118
  class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}
105
119
  />
106
120
  <div
121
+ ref={(element: HTMLDivElement) => {
122
+ panels = element
123
+ }}
107
124
  data-slot="settings-layout-panels"
108
125
  class="min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]"
109
126
  >
@@ -47,7 +47,7 @@ export function PixelResizeHandle(props: PixelResizeHandleProps) {
47
47
  const value = () => Math.min(maximum(), Math.max(minimum(), Math.round(props.value)))
48
48
  const isRight = () => props.side === 'right'
49
49
  const bounded = (next: number) => Math.min(maximum(), Math.max(minimum(), Math.round(next)))
50
- const commit = () => props.onCommit?.(value())
50
+ const commit = (next = value()) => props.onCommit?.(next)
51
51
  let interacting = false
52
52
  const [drag, setDrag] = createSignal<{
53
53
  pointerId: number
@@ -60,25 +60,37 @@ export function PixelResizeHandle(props: PixelResizeHandleProps) {
60
60
  // them). Ending the gesture applies the last pending value first.
61
61
  let pendingMove: number | undefined
62
62
  let moveFrame: number | undefined
63
+ // The last value the pointer asked for, whether or not its frame has run. A
64
+ // release reads this rather than the prop, which reports the host's previous
65
+ // width until the update renders.
66
+ let pointerValue: number | undefined
63
67
  const flushMove = () => {
64
68
  if (moveFrame !== undefined) cancelAnimationFrame(moveFrame)
65
69
  moveFrame = undefined
66
70
  const next = pendingMove
67
71
  pendingMove = undefined
68
- if (next !== undefined) move(next)
72
+ if (next === undefined) return
73
+ move(next)
74
+ return next
69
75
  }
70
76
  const scheduleMove = (next: number) => {
71
77
  pendingMove = next
78
+ pointerValue = next
72
79
  if (moveFrame === undefined) moveFrame = requestAnimationFrame(flushMove)
73
80
  }
74
81
  const endPointer = (shouldCommit: boolean) => {
75
82
  const current = drag()
76
83
  if (!current) return
77
- flushMove()
84
+ const applied = flushMove()
85
+ // The pending move is applied to the host first, but the prop it reports
86
+ // through is read on the next render. Commit the value just applied, not
87
+ // the stale prop, or a fast release reports the previous width.
88
+ const committed = applied ?? pointerValue ?? value()
89
+ pointerValue = undefined
78
90
  setDrag(undefined)
79
91
  if (current.handle.hasPointerCapture(current.pointerId))
80
92
  current.handle.releasePointerCapture(current.pointerId)
81
- if (shouldCommit) commit()
93
+ if (shouldCommit) commit(committed)
82
94
  }
83
95
  const endKeyboard = () => {
84
96
  const wasInteracting = interacting
@@ -131,6 +143,7 @@ export function PixelResizeHandle(props: PixelResizeHandleProps) {
131
143
  interacting = false
132
144
  handle.focus()
133
145
  handle.setPointerCapture(event.pointerId)
146
+ pointerValue = undefined
134
147
  setDrag({
135
148
  pointerId: event.pointerId,
136
149
  startX: event.clientX,