@smwb/ui-solid 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,14 +11,16 @@ and `@smwb/ui-styles` source.
11
11
 
12
12
  | Package | What it is |
13
13
  | --- | --- |
14
- | **`@smwb/ui-solid`** | This package — SolidJS components. |
15
- | `@smwb/ui-react` | React version, same design system. |
16
- | `@smwb/ui-styles` | Framework-agnostic LESS source + design tokens. |
17
- | `@smwb/ui-css` | Prebuilt aggregate stylesheet (`import "@smwb/ui-css"`). |
18
- | `@smwb/ui-mcp-solid` | MCP server exposing this catalog to AI tools. |
14
+ | [**`@smwb/ui-solid`**](https://www.npmjs.com/package/@smwb/ui-solid) | This package — SolidJS components. |
15
+ | [`@smwb/ui-react`](https://www.npmjs.com/package/@smwb/ui-react) | React version, same design system. |
16
+ | [`@smwb/ui-styles`](https://www.npmjs.com/package/@smwb/ui-styles) | Framework-agnostic LESS source + design tokens. |
17
+ | [`@smwb/ui-css`](https://www.npmjs.com/package/@smwb/ui-css) | Prebuilt aggregate stylesheet (`import "@smwb/ui-css"`). |
18
+ | [`@smwb/ui-mcp-solid`](https://www.npmjs.com/package/@smwb/ui-mcp-solid) | MCP server exposing this catalog to AI tools. |
19
19
 
20
20
  ## Component catalog
21
21
 
22
+ - **Storybook (production):** https://summerweb.ru/ui-solid/
23
+ - **Storybook (dev):** https://summerweb.ru/ui-dev-solid/
22
24
  - **Local Storybook:** `npm run storybook` → http://localhost:6006
23
25
 
24
26
  ## Installation
@@ -1,66 +1,57 @@
1
- import { isServer as X, use as Y, insert as L, setAttribute as c, effect as F, className as v, style as $, template as N, delegateEvents as O } from "solid-js/web";
1
+ import { isServer as F, use as H, insert as $, setAttribute as v, effect as N, className as m, style as L, template as O, delegateEvents as U } from "solid-js/web";
2
2
  import '../../../assets/styles/less/components/screenDivider/screenDivider.entry.css';/* empty css */
3
- import { mergeProps as T, splitProps as U, createSignal as x, createEffect as f, children as j, onCleanup as q } from "solid-js";
4
- import m from "clsx";
5
- import { throttle as B } from "../../../utils/throttle.js";
6
- import { mergeRefs as G } from "../../../primitives/mergeRefs.js";
7
- var J = /* @__PURE__ */ N("<div data-testid=screen-divider><div></div><span class=smwb-screen-divider__resizer role=separator aria-valuemin=0 aria-valuemax=100 tabindex=0></span><div>");
8
- const C = (a, d) => d * (a / 100), _ = (a, d) => !a && d ? 100 - d : a || 50;
9
- function te(a) {
10
- const d = T({
3
+ import { mergeProps as X, splitProps as Y, createSignal as x, createEffect as f, children as j, onCleanup as q } from "solid-js";
4
+ import u from "clsx";
5
+ import { throttle as G } from "../../../utils/throttle.js";
6
+ import { mergeRefs as J } from "../../../primitives/mergeRefs.js";
7
+ var Q = /* @__PURE__ */ O("<div data-testid=screen-divider><div></div><span class=smwb-screen-divider__resizer role=separator aria-valuemin=0 aria-valuemax=100 tabindex=0></span><div>");
8
+ const C = (d, l) => !d && l ? 100 - l : d || 50;
9
+ function te(d) {
10
+ const l = X({
11
11
  orientation: "horizontal",
12
12
  keyboardStep: 5,
13
13
  resizerAriaLabel: "Resize panels"
14
- }, a), [e] = U(d, ["class", "orientation", "sizeFirst", "sizeSecond", "children", "onSizeChange", "keyboardStep", "resizerAriaLabel", "ref"]);
15
- let u;
16
- const [l, s] = x(_(e.sizeFirst, e.sizeSecond)), [h, b] = x(!1);
14
+ }, d), [e] = Y(l, ["class", "orientation", "sizeFirst", "sizeSecond", "children", "onSizeChange", "keyboardStep", "resizerAriaLabel", "ref"]);
15
+ let h;
16
+ const [a, s] = x(C(e.sizeFirst, e.sizeSecond)), [g, p] = x(!1);
17
17
  f(() => {
18
- s(_(e.sizeFirst, e.sizeSecond));
18
+ s(C(e.sizeFirst, e.sizeSecond));
19
19
  }), f(() => {
20
- e.onSizeChange?.(l());
20
+ e.onSizeChange?.(a());
21
21
  });
22
- const M = j(() => e.children), p = () => M.toArray(), y = B((t) => {
23
- if (!h()) return;
24
- const n = u;
25
- if (n)
26
- if (e.orientation === "vertical") {
27
- let r = t.clientY - n.offsetTop;
28
- r < 0 && (r = 0);
29
- const o = r / n.clientHeight * 100;
30
- C(o, n.clientWidth) > 5 && o < 101 && s(o - 7);
31
- } else {
32
- let r = t.clientX - n.offsetLeft;
33
- r < 0 && (r = 0);
34
- const o = r / n.clientWidth * 100;
35
- C(o, n.clientWidth) > 5 && o < 101 && s(o);
36
- }
37
- }, 1e3 / 60), R = () => {
38
- b(!0);
39
- }, g = () => {
40
- b(!1);
22
+ const _ = j(() => e.children), b = () => _.toArray(), y = G((t) => {
23
+ if (!g()) return;
24
+ const n = h;
25
+ if (!n) return;
26
+ const i = n.getBoundingClientRect(), o = e.orientation === "vertical" ? i.height : i.width, c = e.orientation === "vertical" ? t.clientY - i.top : t.clientX - i.left, r = Math.max(5, Math.min(o - 5, c));
27
+ s(r / o * 100);
28
+ }, 1e3 / 60), M = () => {
29
+ p(!0);
30
+ }, w = () => {
31
+ p(!1);
41
32
  };
42
33
  f(() => {
43
- X || (h() ? (document.body.addEventListener("pointerup", g), document.body.addEventListener("pointermove", y), document.body.style.cursor = e.orientation === "horizontal" ? "e-resize" : "n-resize") : document.body.style.cursor = "default", q(() => {
44
- document.body.removeEventListener("pointerup", g), document.body.removeEventListener("pointermove", y);
34
+ F || (g() ? (document.body.addEventListener("pointerup", w), document.body.addEventListener("pointermove", y), document.body.style.cursor = e.orientation === "horizontal" ? "e-resize" : "n-resize") : document.body.style.cursor = "default", q(() => {
35
+ document.body.removeEventListener("pointerup", w), document.body.removeEventListener("pointermove", y);
45
36
  }));
46
37
  });
47
- const K = (t) => {
48
- const n = e.orientation === "vertical" ? "ArrowUp" : "ArrowLeft", r = e.orientation === "vertical" ? "ArrowDown" : "ArrowRight";
49
- t.key === n ? (t.preventDefault(), s((o) => Math.max(0, o - e.keyboardStep))) : t.key === r ? (t.preventDefault(), s((o) => Math.min(100, o + e.keyboardStep))) : t.key === "Home" ? (t.preventDefault(), s(0)) : t.key === "End" && (t.preventDefault(), s(100));
50
- }, P = () => e.orientation === "vertical" ? {
51
- height: `${l()}%`
38
+ const R = (t) => {
39
+ const n = e.orientation === "vertical" ? "ArrowUp" : "ArrowLeft", i = e.orientation === "vertical" ? "ArrowDown" : "ArrowRight";
40
+ t.key === n ? (t.preventDefault(), s((o) => Math.max(0, o - e.keyboardStep))) : t.key === i ? (t.preventDefault(), s((o) => Math.min(100, o + e.keyboardStep))) : t.key === "Home" ? (t.preventDefault(), s(0)) : t.key === "End" && (t.preventDefault(), s(100));
41
+ }, K = () => e.orientation === "vertical" ? {
42
+ height: `${a()}%`
52
43
  } : {
53
- width: `${l()}%`
54
- }, W = () => e.orientation === "vertical" ? {
55
- height: `${100 - l()}%`
44
+ width: `${a()}%`
45
+ }, I = () => e.orientation === "vertical" ? {
46
+ height: `${100 - a()}%`
56
47
  } : {
57
- width: `${100 - l()}%`
48
+ width: `${100 - a()}%`
58
49
  };
59
50
  return (() => {
60
- var t = J(), n = t.firstChild, r = n.nextSibling, o = r.nextSibling, w = G(e.ref, (i) => u = i);
61
- return typeof w == "function" && Y(w, t), L(n, () => p()[0] ?? ""), r.$$keydown = K, r.$$pointerdown = R, c(r, "draggable", !1), L(o, () => p()[1] ?? ""), F((i) => {
62
- var z = m("smwb-screen-divider__wrapper", `smwb-${e.orientation}`, e.class), S = m("smwb-screen-divider__first", `smwb-${e.orientation}`), H = P(), D = e.orientation === "vertical" ? "horizontal" : "vertical", k = Math.round(l()), A = e.resizerAriaLabel, E = m("smwb-screen-divider__second", `smwb-${e.orientation}`), I = W();
63
- return z !== i.e && v(t, i.e = z), S !== i.t && v(n, i.t = S), i.a = $(n, H, i.a), D !== i.o && c(r, "aria-orientation", i.o = D), k !== i.i && c(r, "aria-valuenow", i.i = k), A !== i.n && c(r, "aria-label", i.n = A), E !== i.s && v(o, i.s = E), i.h = $(o, I, i.h), i;
51
+ var t = Q(), n = t.firstChild, i = n.nextSibling, o = i.nextSibling, c = J(e.ref, (r) => h = r);
52
+ return typeof c == "function" && H(c, t), $(n, () => b()[0] ?? ""), i.$$keydown = R, i.$$pointerdown = M, v(i, "draggable", !1), $(o, () => b()[1] ?? ""), N((r) => {
53
+ var z = u("smwb-screen-divider__wrapper", `smwb-${e.orientation}`, e.class), S = u("smwb-screen-divider__first", `smwb-${e.orientation}`), P = K(), D = e.orientation === "vertical" ? "horizontal" : "vertical", k = Math.round(a()), A = e.resizerAriaLabel, E = u("smwb-screen-divider__second", `smwb-${e.orientation}`), B = I();
54
+ return z !== r.e && m(t, r.e = z), S !== r.t && m(n, r.t = S), r.a = L(n, P, r.a), D !== r.o && v(i, "aria-orientation", r.o = D), k !== r.i && v(i, "aria-valuenow", r.i = k), A !== r.n && v(i, "aria-label", r.n = A), E !== r.s && m(o, r.s = E), r.h = L(o, B, r.h), r;
64
55
  }, {
65
56
  e: void 0,
66
57
  t: void 0,
@@ -73,7 +64,7 @@ function te(a) {
73
64
  }), t;
74
65
  })();
75
66
  }
76
- O(["pointerdown", "keydown"]);
67
+ U(["pointerdown", "keydown"]);
77
68
  export {
78
69
  te as ScreenDivider
79
70
  };
@@ -1 +1 @@
1
- {"version":3,"file":"screenDivider.js","sources":["../../../../src/components/layout/screenDivider/screenDivider.tsx"],"sourcesContent":["import {\n type JSX,\n type ParentProps,\n children as resolveChildren,\n createEffect,\n createSignal,\n mergeProps,\n onCleanup,\n splitProps,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport cn from \"clsx\";\nimport { throttle } from \"../../../utils/throttle\";\nimport { mergeRefs, type Ref } from \"../../../primitives/mergeRefs\";\n\nexport interface ScreenDividerProps {\n sizeFirst?: number;\n sizeSecond?: number;\n class?: string;\n orientation?: \"horizontal\" | \"vertical\";\n /** Called with the first pane size (percent) whenever it changes. */\n onSizeChange?: (sizeFirst: number) => void;\n /** Step (in percent) applied on arrow-key resize. */\n keyboardStep?: number;\n /** Accessible label for the resizer handle. */\n resizerAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst toPixels = (percent: number, parentSize: number): number => parentSize * (percent / 100);\n\nconst getInitialDivider = (sizeFirst?: number | null, sizeSecond?: number | null): number => {\n if (!sizeFirst && sizeSecond) {\n return 100 - sizeSecond;\n }\n if (sizeFirst) {\n return sizeFirst;\n }\n return 50;\n};\n\nexport function ScreenDivider(props: ParentProps<ScreenDividerProps>): JSX.Element {\n const merged = mergeProps(\n { orientation: \"horizontal\" as const, keyboardStep: 5, resizerAriaLabel: \"Resize panels\" },\n props\n );\n const [local] = splitProps(merged, [\n \"class\",\n \"orientation\",\n \"sizeFirst\",\n \"sizeSecond\",\n \"children\",\n \"onSizeChange\",\n \"keyboardStep\",\n \"resizerAriaLabel\",\n \"ref\",\n ]);\n\n let wrapperEl: HTMLDivElement | undefined;\n const [divider, setDivider] = createSignal(getInitialDivider(local.sizeFirst, local.sizeSecond));\n const [isDragging, setIsDragging] = createSignal(false);\n\n // Sync with controlled size props.\n createEffect(() => {\n setDivider(getInitialDivider(local.sizeFirst, local.sizeSecond));\n });\n\n // Report size changes.\n createEffect(() => {\n local.onSizeChange?.(divider());\n });\n\n const resolved = resolveChildren(() => local.children);\n const child = (): unknown[] => resolved.toArray();\n\n const dragOver = throttle((event: PointerEvent) => {\n if (!isDragging()) return;\n const wrapper = wrapperEl;\n if (!wrapper) return;\n if (local.orientation === \"vertical\") {\n let relativeMouseY = event.clientY - wrapper.offsetTop;\n if (relativeMouseY < 0) relativeMouseY = 0;\n const newDivider = (relativeMouseY / wrapper.clientHeight) * 100;\n if (toPixels(newDivider, wrapper.clientWidth) > 5 && newDivider < 101) {\n setDivider(newDivider - 7);\n }\n } else {\n let relativeMouseX = event.clientX - wrapper.offsetLeft;\n if (relativeMouseX < 0) relativeMouseX = 0;\n const newDivider = (relativeMouseX / wrapper.clientWidth) * 100;\n if (toPixels(newDivider, wrapper.clientWidth) > 5 && newDivider < 101) {\n setDivider(newDivider);\n }\n }\n }, 1000 / 60);\n\n const handleDragStart = (): void => {\n setIsDragging(true);\n };\n const handleDragEnd = (): void => {\n setIsDragging(false);\n };\n\n createEffect(() => {\n if (isServer) return;\n if (isDragging()) {\n document.body.addEventListener(\"pointerup\", handleDragEnd);\n document.body.addEventListener(\"pointermove\", dragOver);\n document.body.style.cursor = local.orientation === \"horizontal\" ? \"e-resize\" : \"n-resize\";\n } else {\n document.body.style.cursor = \"default\";\n }\n onCleanup(() => {\n document.body.removeEventListener(\"pointerup\", handleDragEnd);\n document.body.removeEventListener(\"pointermove\", dragOver);\n });\n });\n\n const onResizerKeyDown: JSX.EventHandler<HTMLSpanElement, KeyboardEvent> = (event) => {\n const decreaseKey = local.orientation === \"vertical\" ? \"ArrowUp\" : \"ArrowLeft\";\n const increaseKey = local.orientation === \"vertical\" ? \"ArrowDown\" : \"ArrowRight\";\n if (event.key === decreaseKey) {\n event.preventDefault();\n setDivider((prev) => Math.max(0, prev - local.keyboardStep));\n } else if (event.key === increaseKey) {\n event.preventDefault();\n setDivider((prev) => Math.min(100, prev + local.keyboardStep));\n } else if (event.key === \"Home\") {\n event.preventDefault();\n setDivider(0);\n } else if (event.key === \"End\") {\n event.preventDefault();\n setDivider(100);\n }\n };\n\n const firstChildStyle = (): JSX.CSSProperties =>\n local.orientation === \"vertical\" ? { height: `${divider()}%` } : { width: `${divider()}%` };\n const secondChildStyle = (): JSX.CSSProperties =>\n local.orientation === \"vertical\" ? { height: `${100 - divider()}%` } : { width: `${100 - divider()}%` };\n\n return (\n <div\n class={cn(\"smwb-screen-divider__wrapper\", `smwb-${local.orientation}`, local.class)}\n ref={mergeRefs(local.ref, (el) => (wrapperEl = el))}\n data-testid=\"screen-divider\"\n >\n <div class={cn(\"smwb-screen-divider__first\", `smwb-${local.orientation}`)} style={firstChildStyle()}>\n {(child()[0] ?? \"\") as JSX.Element}\n </div>\n <span\n class=\"smwb-screen-divider__resizer\"\n onPointerDown={handleDragStart}\n draggable={false}\n role=\"separator\"\n aria-orientation={local.orientation === \"vertical\" ? \"horizontal\" : \"vertical\"}\n aria-valuenow={Math.round(divider())}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={local.resizerAriaLabel}\n tabindex={0}\n onKeyDown={onResizerKeyDown}\n />\n <div class={cn(\"smwb-screen-divider__second\", `smwb-${local.orientation}`)} style={secondChildStyle()}>\n {(child()[1] ?? \"\") as JSX.Element}\n </div>\n </div>\n );\n}\n\nexport default ScreenDivider;\n"],"names":["toPixels","percent","parentSize","getInitialDivider","sizeFirst","sizeSecond","ScreenDivider","props","merged","mergeProps","orientation","keyboardStep","resizerAriaLabel","local","splitProps","wrapperEl","divider","setDivider","createSignal","isDragging","setIsDragging","createEffect","onSizeChange","resolved","resolveChildren","children","child","toArray","dragOver","throttle","event","wrapper","relativeMouseY","clientY","offsetTop","newDivider","clientHeight","clientWidth","relativeMouseX","clientX","offsetLeft","handleDragStart","handleDragEnd","isServer","document","body","addEventListener","style","cursor","onCleanup","removeEventListener","onResizerKeyDown","decreaseKey","increaseKey","key","preventDefault","prev","Math","max","min","firstChildStyle","height","width","secondChildStyle","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_ref$","mergeRefs","ref","el","_$use","_$insert","$$keydown","$$pointerdown","_$setAttribute","_$effect","_p$","_v$","cn","class","_v$2","_v$3","_v$4","_v$5","round","_v$6","_v$7","_v$8","e","_$className","t","a","_$style","o","i","n","s","h","undefined","_$delegateEvents"],"mappings":";;;;;;;AA8BA,MAAMA,IAAWA,CAACC,GAAiBC,MAA+BA,KAAcD,IAAU,MAEpFE,IAAoBA,CAACC,GAA2BC,MAChD,CAACD,KAAaC,IACT,MAAMA,IAEXD,KAGG;AAGF,SAASE,GAAcC,GAAqD;AACjF,QAAMC,IAASC,EACb;AAAA,IAAEC,aAAa;AAAA,IAAuBC,cAAc;AAAA,IAAGC,kBAAkB;AAAA,EAAA,GACzEL,CACF,GACM,CAACM,CAAK,IAAIC,EAAWN,GAAQ,CACjC,SACA,eACA,aACA,cACA,YACA,gBACA,gBACA,oBACA,KAAK,CACN;AA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IAAAL,EAAA3B,GAAAsB,GAAAX,EAAAqB,CAAA,GAAArB;AAAAA,IAAA,GAAA;AAAA,MAAAY,GAAAU;AAAAA,MAAAR,GAAAQ;AAAAA,MAAAP,GAAAO;AAAAA,MAAAL,GAAAK;AAAAA,MAAAJ,GAAAI;AAAAA,MAAAH,GAAAG;AAAAA,MAAAF,GAAAE;AAAAA,MAAAD,GAAAC;AAAAA,IAAAA,CAAA,GAAAvC;AAAAA,EAAA,GAAA;AAK3G;AAE6BwC,EAAA,CAAA,eAAA,SAAA,CAAA;"}
1
+ {"version":3,"file":"screenDivider.js","sources":["../../../../src/components/layout/screenDivider/screenDivider.tsx"],"sourcesContent":["import {\n type JSX,\n type ParentProps,\n children as resolveChildren,\n createEffect,\n createSignal,\n mergeProps,\n onCleanup,\n splitProps,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport cn from \"clsx\";\nimport { throttle } from \"../../../utils/throttle\";\nimport { mergeRefs, type Ref } from \"../../../primitives/mergeRefs\";\n\nexport interface ScreenDividerProps {\n sizeFirst?: number;\n sizeSecond?: number;\n class?: string;\n orientation?: \"horizontal\" | \"vertical\";\n /** Called with the first pane size (percent) whenever it changes. */\n onSizeChange?: (sizeFirst: number) => void;\n /** Step (in percent) applied on arrow-key resize. */\n keyboardStep?: number;\n /** Accessible label for the resizer handle. */\n resizerAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst getInitialDivider = (sizeFirst?: number | null, sizeSecond?: number | null): number => {\n if (!sizeFirst && sizeSecond) {\n return 100 - sizeSecond;\n }\n if (sizeFirst) {\n return sizeFirst;\n }\n return 50;\n};\n\nexport function ScreenDivider(props: ParentProps<ScreenDividerProps>): JSX.Element {\n const merged = mergeProps(\n { orientation: \"horizontal\" as const, keyboardStep: 5, resizerAriaLabel: \"Resize panels\" },\n props\n );\n const [local] = splitProps(merged, [\n \"class\",\n \"orientation\",\n \"sizeFirst\",\n \"sizeSecond\",\n \"children\",\n \"onSizeChange\",\n \"keyboardStep\",\n \"resizerAriaLabel\",\n \"ref\",\n ]);\n\n let wrapperEl: HTMLDivElement | undefined;\n const [divider, setDivider] = createSignal(getInitialDivider(local.sizeFirst, local.sizeSecond));\n const [isDragging, setIsDragging] = createSignal(false);\n\n // Sync with controlled size props.\n createEffect(() => {\n setDivider(getInitialDivider(local.sizeFirst, local.sizeSecond));\n });\n\n // Report size changes.\n createEffect(() => {\n local.onSizeChange?.(divider());\n });\n\n const resolved = resolveChildren(() => local.children);\n const child = (): unknown[] => resolved.toArray();\n\n const dragOver = throttle((event: PointerEvent) => {\n if (!isDragging()) return;\n const wrapper = wrapperEl;\n if (!wrapper) return;\n // Viewport-relative rect — using offsetLeft/offsetTop here is wrong\n // because they are relative to the nearest positioned ancestor, not\n // the viewport that clientX/clientY live in (this is what made the\n // divider drift away from the cursor when the wrapper was nested).\n const rect = wrapper.getBoundingClientRect();\n const total = local.orientation === \"vertical\" ? rect.height : rect.width;\n const cursor = local.orientation === \"vertical\" ? event.clientY - rect.top : event.clientX - rect.left;\n // 5px margin on each side so neither pane fully collapses.\n const clamped = Math.max(5, Math.min(total - 5, cursor));\n setDivider((clamped / total) * 100);\n }, 1000 / 60);\n\n const handleDragStart = (): void => {\n setIsDragging(true);\n };\n const handleDragEnd = (): void => {\n setIsDragging(false);\n };\n\n createEffect(() => {\n if (isServer) return;\n if (isDragging()) {\n document.body.addEventListener(\"pointerup\", handleDragEnd);\n document.body.addEventListener(\"pointermove\", dragOver);\n document.body.style.cursor = local.orientation === \"horizontal\" ? \"e-resize\" : \"n-resize\";\n } else {\n document.body.style.cursor = \"default\";\n }\n onCleanup(() => {\n document.body.removeEventListener(\"pointerup\", handleDragEnd);\n document.body.removeEventListener(\"pointermove\", dragOver);\n });\n });\n\n const onResizerKeyDown: JSX.EventHandler<HTMLSpanElement, KeyboardEvent> = (event) => {\n const decreaseKey = local.orientation === \"vertical\" ? \"ArrowUp\" : \"ArrowLeft\";\n const increaseKey = local.orientation === \"vertical\" ? \"ArrowDown\" : \"ArrowRight\";\n if (event.key === decreaseKey) {\n event.preventDefault();\n setDivider((prev) => Math.max(0, prev - local.keyboardStep));\n } else if (event.key === increaseKey) {\n event.preventDefault();\n setDivider((prev) => Math.min(100, prev + local.keyboardStep));\n } else if (event.key === \"Home\") {\n event.preventDefault();\n setDivider(0);\n } else if (event.key === \"End\") {\n event.preventDefault();\n setDivider(100);\n }\n };\n\n const firstChildStyle = (): JSX.CSSProperties =>\n local.orientation === \"vertical\" ? { height: `${divider()}%` } : { width: `${divider()}%` };\n const secondChildStyle = (): JSX.CSSProperties =>\n local.orientation === \"vertical\" ? { height: `${100 - divider()}%` } : { width: `${100 - divider()}%` };\n\n return (\n <div\n class={cn(\"smwb-screen-divider__wrapper\", `smwb-${local.orientation}`, local.class)}\n ref={mergeRefs(local.ref, (el) => (wrapperEl = el))}\n data-testid=\"screen-divider\"\n >\n <div class={cn(\"smwb-screen-divider__first\", `smwb-${local.orientation}`)} style={firstChildStyle()}>\n {(child()[0] ?? \"\") as JSX.Element}\n </div>\n <span\n class=\"smwb-screen-divider__resizer\"\n onPointerDown={handleDragStart}\n draggable={false}\n role=\"separator\"\n aria-orientation={local.orientation === \"vertical\" ? \"horizontal\" : \"vertical\"}\n aria-valuenow={Math.round(divider())}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={local.resizerAriaLabel}\n tabindex={0}\n onKeyDown={onResizerKeyDown}\n />\n <div class={cn(\"smwb-screen-divider__second\", `smwb-${local.orientation}`)} style={secondChildStyle()}>\n {(child()[1] ?? \"\") as JSX.Element}\n </div>\n </div>\n );\n}\n\nexport default ScreenDivider;\n"],"names":["getInitialDivider","sizeFirst","sizeSecond","ScreenDivider","props","merged","mergeProps","orientation","keyboardStep","resizerAriaLabel","local","splitProps","wrapperEl","divider","setDivider","createSignal","isDragging","setIsDragging","createEffect","onSizeChange","resolved","resolveChildren","children","child","toArray","dragOver","throttle","event","wrapper","rect","getBoundingClientRect","total","height","width","cursor","clientY","top","clientX","left","clamped","Math","max","min","handleDragStart","handleDragEnd","isServer","document","body","addEventListener","style","onCleanup","removeEventListener","onResizerKeyDown","decreaseKey","increaseKey","key","preventDefault","prev","firstChildStyle","secondChildStyle","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_ref$","mergeRefs","ref","el","_$use","_$insert","$$keydown","$$pointerdown","_$setAttribute","_$effect","_p$","_v$","cn","class","_v$2","_v$3","_v$4","_v$5","round","_v$6","_v$7","_v$8","e","_$className","t","a","_$style","o","i","n","s","h","undefined","_$delegateEvents"],"mappings":";;;;;;;AA8BA,MAAMA,IAAoBA,CAACC,GAA2BC,MAChD,CAACD,KAAaC,IACT,MAAMA,IAEXD,KAGG;AAGF,SAASE,GAAcC,GAAqD;AACjF,QAAMC,IAASC,EACb;AAAA,IAAEC,aAAa;AAAA,IAAuBC,cAAc;AAAA,IAAGC,kBAAkB;AAAA,EAAA,GACzEL,CACF,GACM,CAACM,CAAK,IAAIC,EAAWN,GAAQ,CACjC,SACA,eACA,aACA,cACA,YACA,gBACA,gBACA,oBACA,KAAK,CACN;AAED,MAAIO;AACJ,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAaf,EAAkBU,EAAMT,WAAWS,EAAMR,UAAU,CAAC,GACzF,CAACc,GAAYC,CAAa,IAAIF,EAAa,EAAK;AAGtDG,EAAAA,EAAa,MAAM;AACjBJ,IAAAA,EAAWd,EAAkBU,EAAMT,WAAWS,EAAMR,UAAU,CAAC;AAAA,EACjE,CAAC,GAGDgB,EAAa,MAAM;AACjBR,IAAAA,EAAMS,eAAeN,GAAS;AAAA,EAChC,CAAC;AAED,QAAMO,IAAWC,EAAgB,MAAMX,EAAMY,QAAQ,GAC/CC,IAAQA,MAAiBH,EAASI,QAAAA,GAElCC,IAAWC,EAAS,CAACC,MAAwB;AACjD,QAAI,CAACX,IAAc;AACnB,UAAMY,IAAUhB;AAChB,QAAI,CAACgB,EAAS;AAKd,UAAMC,IAAOD,EAAQE,sBAAAA,G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,EAAAA;AAAkBmB,aAAAA,MAAAD,EAAAY,KAAAC,EAAA9B,GAAAiB,EAAAY,IAAAX,CAAA,GAAAG,MAAAJ,EAAAc,KAAAD,EAAA5B,GAAAe,EAAAc,IAAAV,CAAA,GAAAJ,EAAAe,IAAAC,EAAA/B,GAAAoB,GAAAL,EAAAe,CAAA,GAAAT,MAAAN,EAAAiB,KAAAnB,EAAAX,GAAA,oBAAAa,EAAAiB,IAAAX,CAAA,GAAAC,MAAAP,EAAAkB,KAAApB,EAAAX,GAAA,iBAAAa,EAAAkB,IAAAX,CAAA,GAAAE,MAAAT,EAAAmB,KAAArB,EAAAX,GAAA,cAAAa,EAAAmB,IAAAV,CAAA,GAAAC,MAAAV,EAAAoB,KAAAP,EAAAxB,GAAAW,EAAAoB,IAAAV,CAAA,GAAAV,EAAAqB,IAAAL,EAAA3B,GAAAsB,GAAAX,EAAAqB,CAAA,GAAArB;AAAAA,IAAA,GAAA;AAAA,MAAAY,GAAAU;AAAAA,MAAAR,GAAAQ;AAAAA,MAAAP,GAAAO;AAAAA,MAAAL,GAAAK;AAAAA,MAAAJ,GAAAI;AAAAA,MAAAH,GAAAG;AAAAA,MAAAF,GAAAE;AAAAA,MAAAD,GAAAC;AAAAA,IAAAA,CAAA,GAAAvC;AAAAA,EAAA,GAAA;AAK3G;AAE6BwC,EAAA,CAAA,eAAA,SAAA,CAAA;"}
@@ -1,65 +1,56 @@
1
- import { isServer as X, use as Y, insert as L, setAttribute as c, effect as F, className as v, style as $, template as N, delegateEvents as O } from "solid-js/web";
2
- import { mergeProps as T, splitProps as U, createSignal as x, createEffect as f, children as j, onCleanup as q } from "solid-js";
3
- import m from "clsx";
4
- import { throttle as B } from "../../../utils/throttle.js";
5
- import { mergeRefs as G } from "../../../primitives/mergeRefs.js";
6
- var J = /* @__PURE__ */ N("<div data-testid=screen-divider><div></div><span class=smwb-screen-divider__resizer role=separator aria-valuemin=0 aria-valuemax=100 tabindex=0></span><div>");
7
- const C = (a, d) => d * (a / 100), _ = (a, d) => !a && d ? 100 - d : a || 50;
8
- function re(a) {
9
- const d = T({
1
+ import { isServer as F, use as H, insert as $, setAttribute as v, effect as N, className as m, style as L, template as O, delegateEvents as U } from "solid-js/web";
2
+ import { mergeProps as X, splitProps as Y, createSignal as x, createEffect as f, children as j, onCleanup as q } from "solid-js";
3
+ import u from "clsx";
4
+ import { throttle as G } from "../../../utils/throttle.js";
5
+ import { mergeRefs as J } from "../../../primitives/mergeRefs.js";
6
+ var Q = /* @__PURE__ */ O("<div data-testid=screen-divider><div></div><span class=smwb-screen-divider__resizer role=separator aria-valuemin=0 aria-valuemax=100 tabindex=0></span><div>");
7
+ const C = (d, l) => !d && l ? 100 - l : d || 50;
8
+ function re(d) {
9
+ const l = X({
10
10
  orientation: "horizontal",
11
11
  keyboardStep: 5,
12
12
  resizerAriaLabel: "Resize panels"
13
- }, a), [e] = U(d, ["class", "orientation", "sizeFirst", "sizeSecond", "children", "onSizeChange", "keyboardStep", "resizerAriaLabel", "ref"]);
14
- let u;
15
- const [l, s] = x(_(e.sizeFirst, e.sizeSecond)), [h, b] = x(!1);
13
+ }, d), [e] = Y(l, ["class", "orientation", "sizeFirst", "sizeSecond", "children", "onSizeChange", "keyboardStep", "resizerAriaLabel", "ref"]);
14
+ let h;
15
+ const [a, s] = x(C(e.sizeFirst, e.sizeSecond)), [g, b] = x(!1);
16
16
  f(() => {
17
- s(_(e.sizeFirst, e.sizeSecond));
17
+ s(C(e.sizeFirst, e.sizeSecond));
18
18
  }), f(() => {
19
- e.onSizeChange?.(l());
19
+ e.onSizeChange?.(a());
20
20
  });
21
- const M = j(() => e.children), y = () => M.toArray(), g = B((t) => {
22
- if (!h()) return;
23
- const o = u;
24
- if (o)
25
- if (e.orientation === "vertical") {
26
- let r = t.clientY - o.offsetTop;
27
- r < 0 && (r = 0);
28
- const n = r / o.clientHeight * 100;
29
- C(n, o.clientWidth) > 5 && n < 101 && s(n - 7);
30
- } else {
31
- let r = t.clientX - o.offsetLeft;
32
- r < 0 && (r = 0);
33
- const n = r / o.clientWidth * 100;
34
- C(n, o.clientWidth) > 5 && n < 101 && s(n);
35
- }
36
- }, 1e3 / 60), R = () => {
21
+ const _ = j(() => e.children), p = () => _.toArray(), y = G((t) => {
22
+ if (!g()) return;
23
+ const o = h;
24
+ if (!o) return;
25
+ const i = o.getBoundingClientRect(), n = e.orientation === "vertical" ? i.height : i.width, c = e.orientation === "vertical" ? t.clientY - i.top : t.clientX - i.left, r = Math.max(5, Math.min(n - 5, c));
26
+ s(r / n * 100);
27
+ }, 1e3 / 60), M = () => {
37
28
  b(!0);
38
- }, p = () => {
29
+ }, w = () => {
39
30
  b(!1);
40
31
  };
41
32
  f(() => {
42
- X || (h() ? (document.body.addEventListener("pointerup", p), document.body.addEventListener("pointermove", g), document.body.style.cursor = e.orientation === "horizontal" ? "e-resize" : "n-resize") : document.body.style.cursor = "default", q(() => {
43
- document.body.removeEventListener("pointerup", p), document.body.removeEventListener("pointermove", g);
33
+ F || (g() ? (document.body.addEventListener("pointerup", w), document.body.addEventListener("pointermove", y), document.body.style.cursor = e.orientation === "horizontal" ? "e-resize" : "n-resize") : document.body.style.cursor = "default", q(() => {
34
+ document.body.removeEventListener("pointerup", w), document.body.removeEventListener("pointermove", y);
44
35
  }));
45
36
  });
46
- const K = (t) => {
47
- const o = e.orientation === "vertical" ? "ArrowUp" : "ArrowLeft", r = e.orientation === "vertical" ? "ArrowDown" : "ArrowRight";
48
- t.key === o ? (t.preventDefault(), s((n) => Math.max(0, n - e.keyboardStep))) : t.key === r ? (t.preventDefault(), s((n) => Math.min(100, n + e.keyboardStep))) : t.key === "Home" ? (t.preventDefault(), s(0)) : t.key === "End" && (t.preventDefault(), s(100));
49
- }, P = () => e.orientation === "vertical" ? {
50
- height: `${l()}%`
37
+ const R = (t) => {
38
+ const o = e.orientation === "vertical" ? "ArrowUp" : "ArrowLeft", i = e.orientation === "vertical" ? "ArrowDown" : "ArrowRight";
39
+ t.key === o ? (t.preventDefault(), s((n) => Math.max(0, n - e.keyboardStep))) : t.key === i ? (t.preventDefault(), s((n) => Math.min(100, n + e.keyboardStep))) : t.key === "Home" ? (t.preventDefault(), s(0)) : t.key === "End" && (t.preventDefault(), s(100));
40
+ }, K = () => e.orientation === "vertical" ? {
41
+ height: `${a()}%`
51
42
  } : {
52
- width: `${l()}%`
53
- }, W = () => e.orientation === "vertical" ? {
54
- height: `${100 - l()}%`
43
+ width: `${a()}%`
44
+ }, I = () => e.orientation === "vertical" ? {
45
+ height: `${100 - a()}%`
55
46
  } : {
56
- width: `${100 - l()}%`
47
+ width: `${100 - a()}%`
57
48
  };
58
49
  return (() => {
59
- var t = J(), o = t.firstChild, r = o.nextSibling, n = r.nextSibling, w = G(e.ref, (i) => u = i);
60
- return typeof w == "function" && Y(w, t), L(o, () => y()[0] ?? ""), r.$$keydown = K, r.$$pointerdown = R, c(r, "draggable", !1), L(n, () => y()[1] ?? ""), F((i) => {
61
- var z = m("smwb-screen-divider__wrapper", `smwb-${e.orientation}`, e.class), S = m("smwb-screen-divider__first", `smwb-${e.orientation}`), H = P(), D = e.orientation === "vertical" ? "horizontal" : "vertical", k = Math.round(l()), A = e.resizerAriaLabel, E = m("smwb-screen-divider__second", `smwb-${e.orientation}`), I = W();
62
- return z !== i.e && v(t, i.e = z), S !== i.t && v(o, i.t = S), i.a = $(o, H, i.a), D !== i.o && c(r, "aria-orientation", i.o = D), k !== i.i && c(r, "aria-valuenow", i.i = k), A !== i.n && c(r, "aria-label", i.n = A), E !== i.s && v(n, i.s = E), i.h = $(n, I, i.h), i;
50
+ var t = Q(), o = t.firstChild, i = o.nextSibling, n = i.nextSibling, c = J(e.ref, (r) => h = r);
51
+ return typeof c == "function" && H(c, t), $(o, () => p()[0] ?? ""), i.$$keydown = R, i.$$pointerdown = M, v(i, "draggable", !1), $(n, () => p()[1] ?? ""), N((r) => {
52
+ var z = u("smwb-screen-divider__wrapper", `smwb-${e.orientation}`, e.class), S = u("smwb-screen-divider__first", `smwb-${e.orientation}`), P = K(), D = e.orientation === "vertical" ? "horizontal" : "vertical", k = Math.round(a()), A = e.resizerAriaLabel, E = u("smwb-screen-divider__second", `smwb-${e.orientation}`), B = I();
53
+ return z !== r.e && m(t, r.e = z), S !== r.t && m(o, r.t = S), r.a = L(o, P, r.a), D !== r.o && v(i, "aria-orientation", r.o = D), k !== r.i && v(i, "aria-valuenow", r.i = k), A !== r.n && v(i, "aria-label", r.n = A), E !== r.s && m(n, r.s = E), r.h = L(n, B, r.h), r;
63
54
  }, {
64
55
  e: void 0,
65
56
  t: void 0,
@@ -72,7 +63,7 @@ function re(a) {
72
63
  }), t;
73
64
  })();
74
65
  }
75
- O(["pointerdown", "keydown"]);
66
+ U(["pointerdown", "keydown"]);
76
67
  export {
77
68
  re as ScreenDivider
78
69
  };
@@ -1 +1 @@
1
- {"version":3,"file":"screenDivider.js","sources":["../../../../../src/components/layout/screenDivider/screenDivider.tsx"],"sourcesContent":["import {\n type JSX,\n type ParentProps,\n children as resolveChildren,\n createEffect,\n createSignal,\n mergeProps,\n onCleanup,\n splitProps,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport cn from \"clsx\";\nimport { throttle } from \"../../../utils/throttle\";\nimport { mergeRefs, type Ref } from \"../../../primitives/mergeRefs\";\n\nexport interface ScreenDividerProps {\n sizeFirst?: number;\n sizeSecond?: number;\n class?: string;\n orientation?: \"horizontal\" | \"vertical\";\n /** Called with the first pane size (percent) whenever it changes. */\n onSizeChange?: (sizeFirst: number) => void;\n /** Step (in percent) applied on arrow-key resize. */\n keyboardStep?: number;\n /** Accessible label for the resizer handle. */\n resizerAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst toPixels = (percent: number, parentSize: number): number => parentSize * (percent / 100);\n\nconst getInitialDivider = (sizeFirst?: number | null, sizeSecond?: number | null): number => {\n if (!sizeFirst && sizeSecond) {\n return 100 - sizeSecond;\n }\n if (sizeFirst) {\n return sizeFirst;\n }\n return 50;\n};\n\nexport function ScreenDivider(props: ParentProps<ScreenDividerProps>): JSX.Element {\n const merged = mergeProps(\n { orientation: \"horizontal\" as const, keyboardStep: 5, resizerAriaLabel: \"Resize panels\" },\n props\n );\n const [local] = splitProps(merged, [\n \"class\",\n \"orientation\",\n \"sizeFirst\",\n \"sizeSecond\",\n \"children\",\n \"onSizeChange\",\n \"keyboardStep\",\n \"resizerAriaLabel\",\n \"ref\",\n ]);\n\n let wrapperEl: HTMLDivElement | undefined;\n const [divider, setDivider] = createSignal(getInitialDivider(local.sizeFirst, local.sizeSecond));\n const [isDragging, setIsDragging] = createSignal(false);\n\n // Sync with controlled size props.\n createEffect(() => {\n setDivider(getInitialDivider(local.sizeFirst, local.sizeSecond));\n });\n\n // Report size changes.\n createEffect(() => {\n local.onSizeChange?.(divider());\n });\n\n const resolved = resolveChildren(() => local.children);\n const child = (): unknown[] => resolved.toArray();\n\n const dragOver = throttle((event: PointerEvent) => {\n if (!isDragging()) return;\n const wrapper = wrapperEl;\n if (!wrapper) return;\n if (local.orientation === \"vertical\") {\n let relativeMouseY = event.clientY - wrapper.offsetTop;\n if (relativeMouseY < 0) relativeMouseY = 0;\n const newDivider = (relativeMouseY / wrapper.clientHeight) * 100;\n if (toPixels(newDivider, wrapper.clientWidth) > 5 && newDivider < 101) {\n setDivider(newDivider - 7);\n }\n } else {\n let relativeMouseX = event.clientX - wrapper.offsetLeft;\n if (relativeMouseX < 0) relativeMouseX = 0;\n const newDivider = (relativeMouseX / wrapper.clientWidth) * 100;\n if (toPixels(newDivider, wrapper.clientWidth) > 5 && newDivider < 101) {\n setDivider(newDivider);\n }\n }\n }, 1000 / 60);\n\n const handleDragStart = (): void => {\n setIsDragging(true);\n };\n const handleDragEnd = (): void => {\n setIsDragging(false);\n };\n\n createEffect(() => {\n if (isServer) return;\n if (isDragging()) {\n document.body.addEventListener(\"pointerup\", handleDragEnd);\n document.body.addEventListener(\"pointermove\", dragOver);\n document.body.style.cursor = local.orientation === \"horizontal\" ? \"e-resize\" : \"n-resize\";\n } else {\n document.body.style.cursor = \"default\";\n }\n onCleanup(() => {\n document.body.removeEventListener(\"pointerup\", handleDragEnd);\n document.body.removeEventListener(\"pointermove\", dragOver);\n });\n });\n\n const onResizerKeyDown: JSX.EventHandler<HTMLSpanElement, KeyboardEvent> = (event) => {\n const decreaseKey = local.orientation === \"vertical\" ? \"ArrowUp\" : \"ArrowLeft\";\n const increaseKey = local.orientation === \"vertical\" ? \"ArrowDown\" : \"ArrowRight\";\n if (event.key === decreaseKey) {\n event.preventDefault();\n setDivider((prev) => Math.max(0, prev - local.keyboardStep));\n } else if (event.key === increaseKey) {\n event.preventDefault();\n setDivider((prev) => Math.min(100, prev + local.keyboardStep));\n } else if (event.key === \"Home\") {\n event.preventDefault();\n setDivider(0);\n } else if (event.key === \"End\") {\n event.preventDefault();\n setDivider(100);\n }\n };\n\n const firstChildStyle = (): JSX.CSSProperties =>\n local.orientation === \"vertical\" ? { height: `${divider()}%` } : { width: `${divider()}%` };\n const secondChildStyle = (): JSX.CSSProperties =>\n local.orientation === \"vertical\" ? { height: `${100 - divider()}%` } : { width: `${100 - divider()}%` };\n\n return (\n <div\n class={cn(\"smwb-screen-divider__wrapper\", `smwb-${local.orientation}`, local.class)}\n ref={mergeRefs(local.ref, (el) => (wrapperEl = el))}\n data-testid=\"screen-divider\"\n >\n <div class={cn(\"smwb-screen-divider__first\", `smwb-${local.orientation}`)} style={firstChildStyle()}>\n {(child()[0] ?? \"\") as JSX.Element}\n </div>\n <span\n class=\"smwb-screen-divider__resizer\"\n onPointerDown={handleDragStart}\n draggable={false}\n role=\"separator\"\n aria-orientation={local.orientation === \"vertical\" ? \"horizontal\" : \"vertical\"}\n aria-valuenow={Math.round(divider())}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={local.resizerAriaLabel}\n tabindex={0}\n onKeyDown={onResizerKeyDown}\n />\n <div class={cn(\"smwb-screen-divider__second\", `smwb-${local.orientation}`)} style={secondChildStyle()}>\n {(child()[1] ?? \"\") as JSX.Element}\n </div>\n </div>\n );\n}\n\nexport default ScreenDivider;\n"],"names":["toPixels","percent","parentSize","getInitialDivider","sizeFirst","sizeSecond","ScreenDivider","props","merged","mergeProps","orientation","keyboardStep","resizerAriaLabel","local","splitProps","wrapperEl","divider","setDivider","createSignal","isDragging","setIsDragging","createEffect","onSizeChange","resolved","resolveChildren","children","child","toArray","dragOver","throttle","event","wrapper","relativeMouseY","clientY","offsetTop","newDivider","clientHeight","clientWidth","relativeMouseX","clientX","offsetLeft","handleDragStart","handleDragEnd","isServer","document","body","addEventListener","style","cursor","onCleanup","removeEventListener","onResizerKeyDown","decreaseKey","increaseKey","key","preventDefault","prev","Math","max","min","firstChildStyle","height","width","secondChildStyle","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_ref$","mergeRefs","ref","el","_$use","_$insert","$$keydown","$$pointerdown","_$setAttribute","_$effect","_p$","_v$","cn","class","_v$2","_v$3","_v$4","_v$5","round","_v$6","_v$7","_v$8","e","_$className","t","a","_$style","o","i","n","s","h","undefined","_$delegateEvents"],"mappings":";;;;;;AA6BA,MAAMA,IAAWA,CAACC,GAAiBC,MAA+BA,KAAcD,IAAU,MAEpFE,IAAoBA,CAACC,GAA2BC,MAChD,CAACD,KAAaC,IACT,MAAMA,IAEXD,KAGG;AAGF,SAASE,GAAcC,GAAqD;AACjF,QAAMC,IAASC,EACb;AAAA,IAAEC,aAAa;AAAA,IAAuBC,cAAc;AAAA,IAAGC,kBAAkB;AAAA,EAAA,GACzEL,CACF,GACM,CAACM,CAAK,IAAIC,EAAWN,GAAQ,CACjC,SACA,eACA,aACA,cACA,YACA,gBACA,gBACA,oBACA,KAAK,CACN;AAED,MAAIO;AACJ,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAaf,EAAkBU,EAAMT,WAAWS,EAAMR,UAAU,CAAC,GACzF,CAACc,GAAYC,CAAa,IAAIF,EAAa,EAAK;AAGtDG,EAAAA,EAAa,MAAM;AACjBJ,IAAAA,EAAWd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AAAH,GAAAG;AAAAA,MAAAF,GAAAE;AAAAA,MAAAD,GAAAC;AAAAA,IAAAA,CAAA,GAAAvC;AAAAA,EAAA,GAAA;AAK3G;AAE6BwC,EAAA,CAAA,eAAA,SAAA,CAAA;"}
1
+ {"version":3,"file":"screenDivider.js","sources":["../../../../../src/components/layout/screenDivider/screenDivider.tsx"],"sourcesContent":["import {\n type JSX,\n type ParentProps,\n children as resolveChildren,\n createEffect,\n createSignal,\n mergeProps,\n onCleanup,\n splitProps,\n} from \"solid-js\";\nimport { isServer } from \"solid-js/web\";\nimport cn from \"clsx\";\nimport { throttle } from \"../../../utils/throttle\";\nimport { mergeRefs, type Ref } from \"../../../primitives/mergeRefs\";\n\nexport interface ScreenDividerProps {\n sizeFirst?: number;\n sizeSecond?: number;\n class?: string;\n orientation?: \"horizontal\" | \"vertical\";\n /** Called with the first pane size (percent) whenever it changes. */\n onSizeChange?: (sizeFirst: number) => void;\n /** Step (in percent) applied on arrow-key resize. */\n keyboardStep?: number;\n /** Accessible label for the resizer handle. */\n resizerAriaLabel?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst getInitialDivider = (sizeFirst?: number | null, sizeSecond?: number | null): number => {\n if (!sizeFirst && sizeSecond) {\n return 100 - sizeSecond;\n }\n if (sizeFirst) {\n return sizeFirst;\n }\n return 50;\n};\n\nexport function ScreenDivider(props: ParentProps<ScreenDividerProps>): JSX.Element {\n const merged = mergeProps(\n { orientation: \"horizontal\" as const, keyboardStep: 5, resizerAriaLabel: \"Resize panels\" },\n props\n );\n const [local] = splitProps(merged, [\n \"class\",\n \"orientation\",\n \"sizeFirst\",\n \"sizeSecond\",\n \"children\",\n \"onSizeChange\",\n \"keyboardStep\",\n \"resizerAriaLabel\",\n \"ref\",\n ]);\n\n let wrapperEl: HTMLDivElement | undefined;\n const [divider, setDivider] = createSignal(getInitialDivider(local.sizeFirst, local.sizeSecond));\n const [isDragging, setIsDragging] = createSignal(false);\n\n // Sync with controlled size props.\n createEffect(() => {\n setDivider(getInitialDivider(local.sizeFirst, local.sizeSecond));\n });\n\n // Report size changes.\n createEffect(() => {\n local.onSizeChange?.(divider());\n });\n\n const resolved = resolveChildren(() => local.children);\n const child = (): unknown[] => resolved.toArray();\n\n const dragOver = throttle((event: PointerEvent) => {\n if (!isDragging()) return;\n const wrapper = wrapperEl;\n if (!wrapper) return;\n // Viewport-relative rect — using offsetLeft/offsetTop here is wrong\n // because they are relative to the nearest positioned ancestor, not\n // the viewport that clientX/clientY live in (this is what made the\n // divider drift away from the cursor when the wrapper was nested).\n const rect = wrapper.getBoundingClientRect();\n const total = local.orientation === \"vertical\" ? rect.height : rect.width;\n const cursor = local.orientation === \"vertical\" ? event.clientY - rect.top : event.clientX - rect.left;\n // 5px margin on each side so neither pane fully collapses.\n const clamped = Math.max(5, Math.min(total - 5, cursor));\n setDivider((clamped / total) * 100);\n }, 1000 / 60);\n\n const handleDragStart = (): void => {\n setIsDragging(true);\n };\n const handleDragEnd = (): void => {\n setIsDragging(false);\n };\n\n createEffect(() => {\n if (isServer) return;\n if (isDragging()) {\n document.body.addEventListener(\"pointerup\", handleDragEnd);\n document.body.addEventListener(\"pointermove\", dragOver);\n document.body.style.cursor = local.orientation === \"horizontal\" ? \"e-resize\" : \"n-resize\";\n } else {\n document.body.style.cursor = \"default\";\n }\n onCleanup(() => {\n document.body.removeEventListener(\"pointerup\", handleDragEnd);\n document.body.removeEventListener(\"pointermove\", dragOver);\n });\n });\n\n const onResizerKeyDown: JSX.EventHandler<HTMLSpanElement, KeyboardEvent> = (event) => {\n const decreaseKey = local.orientation === \"vertical\" ? \"ArrowUp\" : \"ArrowLeft\";\n const increaseKey = local.orientation === \"vertical\" ? \"ArrowDown\" : \"ArrowRight\";\n if (event.key === decreaseKey) {\n event.preventDefault();\n setDivider((prev) => Math.max(0, prev - local.keyboardStep));\n } else if (event.key === increaseKey) {\n event.preventDefault();\n setDivider((prev) => Math.min(100, prev + local.keyboardStep));\n } else if (event.key === \"Home\") {\n event.preventDefault();\n setDivider(0);\n } else if (event.key === \"End\") {\n event.preventDefault();\n setDivider(100);\n }\n };\n\n const firstChildStyle = (): JSX.CSSProperties =>\n local.orientation === \"vertical\" ? { height: `${divider()}%` } : { width: `${divider()}%` };\n const secondChildStyle = (): JSX.CSSProperties =>\n local.orientation === \"vertical\" ? { height: `${100 - divider()}%` } : { width: `${100 - divider()}%` };\n\n return (\n <div\n class={cn(\"smwb-screen-divider__wrapper\", `smwb-${local.orientation}`, local.class)}\n ref={mergeRefs(local.ref, (el) => (wrapperEl = el))}\n data-testid=\"screen-divider\"\n >\n <div class={cn(\"smwb-screen-divider__first\", `smwb-${local.orientation}`)} style={firstChildStyle()}>\n {(child()[0] ?? \"\") as JSX.Element}\n </div>\n <span\n class=\"smwb-screen-divider__resizer\"\n onPointerDown={handleDragStart}\n draggable={false}\n role=\"separator\"\n aria-orientation={local.orientation === \"vertical\" ? \"horizontal\" : \"vertical\"}\n aria-valuenow={Math.round(divider())}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={local.resizerAriaLabel}\n tabindex={0}\n onKeyDown={onResizerKeyDown}\n />\n <div class={cn(\"smwb-screen-divider__second\", `smwb-${local.orientation}`)} style={secondChildStyle()}>\n {(child()[1] ?? \"\") as JSX.Element}\n </div>\n </div>\n );\n}\n\nexport default ScreenDivider;\n"],"names":["getInitialDivider","sizeFirst","sizeSecond","ScreenDivider","props","merged","mergeProps","orientation","keyboardStep","resizerAriaLabel","local","splitProps","wrapperEl","divider","setDivider","createSignal","isDragging","setIsDragging","createEffect","onSizeChange","resolved","resolveChildren","children","child","toArray","dragOver","throttle","event","wrapper","rect","getBoundingClientRect","total","height","width","cursor","clientY","top","clientX","left","clamped","Math","max","min","handleDragStart","handleDragEnd","isServer","document","body","addEventListener","style","onCleanup","removeEventListener","onResizerKeyDown","decreaseKey","increaseKey","key","preventDefault","prev","firstChildStyle","secondChildStyle","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_ref$","mergeRefs","ref","el","_$use","_$insert","$$keydown","$$pointerdown","_$setAttribute","_$effect","_p$","_v$","cn","class","_v$2","_v$3","_v$4","_v$5","round","_v$6","_v$7","_v$8","e","_$className","t","a","_$style","o","i","n","s","h","undefined","_$delegateEvents"],"mappings":";;;;;;AA6BA,MAAMA,IAAoBA,CAACC,GAA2BC,MAChD,CAACD,KAAaC,IACT,MAAMA,IAEXD,KAGG;AAGF,SAASE,GAAcC,GAAqD;AACjF,QAAMC,IAASC,EACb;AAAA,IAAEC,aAAa;AAAA,IAAuBC,cAAc;AAAA,IAAGC,kBAAkB;AAAA,EAAA,GACzEL,CACF,GACM,CAACM,CAAK,IAAIC,EAAWN,GAAQ,CACjC,SACA,eACA,aACA,cACA,YACA,gBACA,gBACA,oBACA,KAAK,CACN;AAED,MAAIO;AACJ,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAaf,EAAkBU,EAAMT,WAAWS,EAAMR,UAAU,CAAC,GACzF,CAACc,GAAYC,CAAa,IAAIF,EAAa,EAAK;AAGtDG,EAAAA,EAAa,MAAM;AACjBJ,IAAAA,EAAWd,EAAkBU,EAAMT,WAAWS,EAAMR,UAAU,CAAC;AAAA,EACjE,CAAC,GAGDgB,EAAa,MAAM;AACjBR,IAAAA,EAAMS,eAAeN,GAAS;AAAA,EAChC,CAAC;AAED,QAAMO,IAAWC,EAAgB,MAAMX,EAAMY,QAAQ,GAC/CC,IAAQA,MAAiBH,EAASI,QAAAA,GAElCC,IAAWC,EAAS,CAACC,MAAwB;AACjD,QAAI,CAACX,IAAc;AACnB,UAAMY,IAAUhB;AAChB,QAAI,CAACgB,EAAS;AAKd,UAAMC,IAAOD,EAAQE,sBAAAA,GACfC,IAAQrB,EAAMH,gBAAgB,aAAasB,EAAKG,SAASH,EAAKI,OAC9DC,IAASxB,EAAMH,gBAAgB,aAAaoB,EAAMQ,UAAUN,EAAKO,MAAMT,EAAMU,UAAUR,EAAKS,MAE5FC,IAAUC,KAAKC,IAAI,GAAGD,KAAKE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GAAAL,EAAAe,CAAA,GAAAT,MAAAN,EAAAiB,KAAAnB,EAAAX,GAAA,oBAAAa,EAAAiB,IAAAX,CAAA,GAAAC,MAAAP,EAAAkB,KAAApB,EAAAX,GAAA,iBAAAa,EAAAkB,IAAAX,CAAA,GAAAE,MAAAT,EAAAmB,KAAArB,EAAAX,GAAA,cAAAa,EAAAmB,IAAAV,CAAA,GAAAC,MAAAV,EAAAoB,KAAAP,EAAAxB,GAAAW,EAAAoB,IAAAV,CAAA,GAAAV,EAAAqB,IAAAL,EAAA3B,GAAAsB,GAAAX,EAAAqB,CAAA,GAAArB;AAAAA,IAAA,GAAA;AAAA,MAAAY,GAAAU;AAAAA,MAAAR,GAAAQ;AAAAA,MAAAP,GAAAO;AAAAA,MAAAL,GAAAK;AAAAA,MAAAJ,GAAAI;AAAAA,MAAAH,GAAAG;AAAAA,MAAAF,GAAAE;AAAAA,MAAAD,GAAAC;AAAAA,IAAAA,CAAA,GAAAvC;AAAAA,EAAA,GAAA;AAK3G;AAE6BwC,EAAA,CAAA,eAAA,SAAA,CAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smwb/ui-solid",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "SolidJS port of summer-ui: strict, tree-shakeable Material-style component library sharing the @smwb/ui-styles design system.",
5
5
  "license": "MIT",
6
6
  "type": "module",