@pihanga2/shadcn 0.2.17 → 0.2.19

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.
Files changed (84) hide show
  1. package/README.md +6 -1
  2. package/cards/button/button.types.d.ts +2 -2
  3. package/cards/checkbox/checkbox.types.d.ts +2 -2
  4. package/cards/codeMirror/codeMirror.types.d.ts +1 -1
  5. package/cards/collapsibleCard/collapsibleCard.types.d.ts +1 -1
  6. package/cards/dataTable/dataTable.types.d.ts +5 -5
  7. package/cards/dialog/dialog.types.d.ts +3 -3
  8. package/cards/drawer/drawer.types.d.ts +3 -3
  9. package/cards/dropDownMenu/drop-down.types.d.ts +1 -1
  10. package/cards/emptyCard/emptyCard.component.js +25 -0
  11. package/cards/emptyCard/emptyCard.component.js.map +1 -0
  12. package/cards/emptyCard/emptyCard.types.js +7 -0
  13. package/cards/emptyCard/emptyCard.types.js.map +1 -0
  14. package/cards/emptyCard/index.js +12 -0
  15. package/cards/emptyCard/index.js.map +1 -0
  16. package/cards/fileDrop/fileDrop.types.d.ts +2 -2
  17. package/cards/form/form.types.d.ts +2 -2
  18. package/cards/graphin/graphin.types.d.ts +9 -9
  19. package/cards/input/input.component.js +28 -23
  20. package/cards/input/input.component.js.map +1 -1
  21. package/cards/input/input.types.d.ts +10 -4
  22. package/cards/input/input.types.js.map +1 -1
  23. package/cards/jsonViewer/jsonViewer.types.d.ts +2 -2
  24. package/cards/keyboardOverlay/keyboardOverlay.component.js +1 -0
  25. package/cards/keyboardOverlay/keyboardOverlay.component.js.map +1 -1
  26. package/cards/keyboardOverlay/keyboardOverlay.types.d.ts +1 -1
  27. package/cards/list/list.types.d.ts +1 -1
  28. package/cards/menu/menu.types.d.ts +1 -1
  29. package/cards/modeToggle/mode-toggle.types.d.ts +1 -1
  30. package/cards/navbarSearch/navbarSearch.type.d.ts +3 -3
  31. package/cards/observable/index.d.ts +1 -0
  32. package/cards/observable/index.js +13 -0
  33. package/cards/observable/index.js.map +1 -0
  34. package/cards/observable/observable.component.d.ts +4 -0
  35. package/cards/observable/observable.component.js +74 -0
  36. package/cards/observable/observable.component.js.map +1 -0
  37. package/cards/observable/observable.types.d.ts +253 -0
  38. package/cards/observable/observable.types.js +21 -0
  39. package/cards/observable/observable.types.js.map +1 -0
  40. package/cards/pageWithNavbar/pageWithNavbar.type.d.ts +1 -1
  41. package/cards/pageWithNavbarMeta/pageWithNavbarMeta.types.d.ts +1 -1
  42. package/cards/pasteTarget/pasteTarget.types.d.ts +2 -2
  43. package/cards/resizableColumns/index.js +12 -0
  44. package/cards/resizableColumns/index.js.map +1 -0
  45. package/cards/resizableColumns/resizableColumns.component.js +105 -0
  46. package/cards/resizableColumns/resizableColumns.component.js.map +1 -0
  47. package/cards/resizableColumns/resizableColumns.css +1 -0
  48. package/cards/resizableColumns/resizableColumns.types.js +7 -0
  49. package/cards/resizableColumns/resizableColumns.types.js.map +1 -0
  50. package/cards/resizableGrid/index.js +12 -0
  51. package/cards/resizableGrid/index.js.map +1 -0
  52. package/cards/resizableGrid/resizableGrid.component.js +166 -0
  53. package/cards/resizableGrid/resizableGrid.component.js.map +1 -0
  54. package/cards/resizableGrid/resizableGrid.css +1 -0
  55. package/cards/resizableGrid/resizableGrid.types.js +7 -0
  56. package/cards/resizableGrid/resizableGrid.types.js.map +1 -0
  57. package/cards/scrollbarWithAnnotations/scrollbarWithAnnotations.types.d.ts +2 -2
  58. package/cards/select/select.types.d.ts +6 -6
  59. package/cards/sheetCard/sheetCard.types.d.ts +3 -3
  60. package/cards/slider/slider.types.d.ts +4 -4
  61. package/cards/stack/stack.component.js +51 -38
  62. package/cards/stack/stack.component.js.map +1 -1
  63. package/cards/stepper/stepper.types.d.ts +1 -1
  64. package/cards/switch/switch.types.d.ts +2 -2
  65. package/cards/tabs/tabs.types.d.ts +1 -1
  66. package/cards/textArea/index.d.ts +1 -0
  67. package/cards/textArea/index.js +13 -0
  68. package/cards/textArea/index.js.map +1 -0
  69. package/cards/textArea/textArea.component.d.ts +4 -0
  70. package/cards/textArea/textArea.component.js +83 -0
  71. package/cards/textArea/textArea.component.js.map +1 -0
  72. package/cards/textArea/textArea.types.d.ts +147 -0
  73. package/cards/textArea/textArea.types.js +7 -0
  74. package/cards/textArea/textArea.types.js.map +1 -0
  75. package/cards/textField/textField.types.d.ts +2 -2
  76. package/cards/toast/toast.types.d.ts +3 -3
  77. package/cards/toggleGroup/toggleGroup.types.d.ts +2 -2
  78. package/components/ui/empty.js +40 -0
  79. package/components/ui/empty.js.map +1 -0
  80. package/components/ui/input.js +11 -11
  81. package/components/ui/input.js.map +1 -1
  82. package/components/ui/textarea.js +15 -0
  83. package/components/ui/textarea.js.map +1 -0
  84. package/package.json +28 -2
@@ -5,13 +5,13 @@ export declare const NAVBAR_SEARCH_ACTION: {
5
5
  SEARCH_ITEMS: string;
6
6
  SEARCH_FOCUS: string;
7
7
  };
8
- export declare const onNavbarSearchSubmit: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
8
+ export declare const onNavbarSearchSubmit: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
9
9
  cardID: string;
10
10
  } & NavbarSearchEvent>) => void;
11
- export declare const onNavbarSearchItems: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
11
+ export declare const onNavbarSearchItems: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
12
12
  cardID: string;
13
13
  } & NavbarSearchInputEvent>) => void;
14
- export declare const onNavbarSearchFocus: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
14
+ export declare const onNavbarSearchFocus: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
15
15
  cardID: string;
16
16
  } & NavbarSearchFocusEvent>) => void;
17
17
  export type NavbarSearchProps = {
@@ -0,0 +1 @@
1
+ export * from './observable.types';
@@ -0,0 +1,13 @@
1
+ import { ObservableComponent as e } from "./observable.component.js";
2
+ import { OBSERVABLE_ACTION as t, OBSERVABLE_CARD as n, Observable as r, onObservableBlur as i, onObservableClicked as a, onObservableContextMenu as o, onObservableDoubleClicked as s, onObservableFocus as c, onObservableKeyDown as l, onObservableKeyUp as u, onObservableMouseDown as d, onObservableMouseEnter as f, onObservableMouseLeave as p, onObservableMouseMove as m, onObservableMouseUp as h, onObservableWheel as g } from "./observable.types.js";
3
+ import { actionTypesToEvents as _, registerCardComponent as v } from "@pihanga2/core";
4
+ //#region src/cards/observable/index.ts
5
+ v({
6
+ name: n,
7
+ component: e,
8
+ events: _(t)
9
+ });
10
+ //#endregion
11
+ export { t as OBSERVABLE_ACTION, n as OBSERVABLE_CARD, r as Observable, i as onObservableBlur, a as onObservableClicked, o as onObservableContextMenu, s as onObservableDoubleClicked, c as onObservableFocus, l as onObservableKeyDown, u as onObservableKeyUp, d as onObservableMouseDown, f as onObservableMouseEnter, p as onObservableMouseLeave, m as onObservableMouseMove, h as onObservableMouseUp, g as onObservableWheel };
12
+
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/observable/index.ts"],"sourcesContent":["import {actionTypesToEvents, registerCardComponent} from \"@pihanga2/core\";\n\nimport {ObservableComponent} from \"./observable.component\";\nimport {OBSERVABLE_ACTION, OBSERVABLE_CARD} from \"./observable.types\";\n\nexport * from \"./observable.types\";\n\nregisterCardComponent({\n name: OBSERVABLE_CARD,\n component: ObservableComponent,\n events: actionTypesToEvents(OBSERVABLE_ACTION),\n});\n"],"mappings":";;;;AAOA,EAAsB;CACpB,MAAM;CACN,WAAW;CACX,QAAQ,EAAoB,CAAiB;AAC/C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { PiCardProps } from '@pihanga2/core';
2
+ import { ObservableEvents, ObservableProps } from './observable.types';
3
+ import * as React from "react";
4
+ export declare const ObservableComponent: (props: PiCardProps<ObservableProps, ObservableEvents>) => React.ReactNode;
@@ -0,0 +1,74 @@
1
+ import * as e from "react";
2
+ import { Card as t } from "@pihanga2/core";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/cards/observable/observable.component.tsx
5
+ function r(e, t) {
6
+ return {
7
+ absoluteX: e.pageX,
8
+ absoluteY: e.pageY,
9
+ relativeX: e.pageX - (t.left + window.scrollX),
10
+ relativeY: e.pageY - (t.top + window.scrollY)
11
+ };
12
+ }
13
+ var i = (i) => {
14
+ let { id: a, content: o, enable: s = {}, className: c, style: l, data: u, cardName: d, onClicked: f, onDoubleClicked: p, onMouseDown: m, onMouseUp: h, onMouseEnter: g, onMouseMove: _, onMouseLeave: v, onContextMenu: y, onWheel: b, onKeyDown: x, onKeyUp: S, onFocus: C, onBlur: w } = i, T = e.useRef(null);
15
+ function E(e) {
16
+ let t = T.current?.getBoundingClientRect() ?? {
17
+ left: 0,
18
+ top: 0
19
+ };
20
+ return {
21
+ id: a,
22
+ button: e.button,
23
+ buttons: e.buttons,
24
+ altKey: e.altKey,
25
+ ctrlKey: e.ctrlKey,
26
+ metaKey: e.metaKey,
27
+ shiftKey: e.shiftKey,
28
+ ...r(e, t)
29
+ };
30
+ }
31
+ function D(e) {
32
+ let t = T.current?.getBoundingClientRect() ?? {
33
+ left: 0,
34
+ top: 0
35
+ };
36
+ return {
37
+ id: a,
38
+ deltaX: e.deltaX,
39
+ deltaY: e.deltaY,
40
+ deltaZ: e.deltaZ,
41
+ ...r(e, t)
42
+ };
43
+ }
44
+ function O(e) {
45
+ return {
46
+ id: a,
47
+ key: e.key,
48
+ code: e.code,
49
+ repeat: e.repeat,
50
+ altKey: e.altKey,
51
+ ctrlKey: e.ctrlKey,
52
+ metaKey: e.metaKey,
53
+ shiftKey: e.shiftKey
54
+ };
55
+ }
56
+ let k = u ? Object.fromEntries(Object.entries(u).map(([e, t]) => [`data-${e}`, t])) : {}, A = {};
57
+ return s.clicked && (A.onClick = (e) => f(E(e))), s.doubleClicked && (A.onDoubleClick = (e) => p(E(e))), s.mouseDown && (A.onMouseDown = (e) => m(E(e))), s.mouseUp && (A.onMouseUp = (e) => h(E(e))), s.mouseEnter && (A.onMouseEnter = (e) => g(E(e))), s.mouseMove && (A.onMouseMove = (e) => _(E(e))), s.mouseLeave && (A.onMouseLeave = (e) => v(E(e))), s.contextMenu && (A.onContextMenu = (e) => y(E(e))), s.wheel && (A.onWheel = (e) => b(D(e))), s.keyDown && (A.onKeyDown = (e) => x(O(e))), s.keyUp && (A.onKeyUp = (e) => S(O(e))), s.focus && (A.onFocus = () => C({ id: a })), s.blur && (A.onBlur = () => w({ id: a })), /* @__PURE__ */ n("div", {
58
+ ref: T,
59
+ className: c,
60
+ style: l,
61
+ "data-pihanga": d,
62
+ tabIndex: s.keyDown || s.keyUp || s.focus || s.blur ? 0 : void 0,
63
+ ...k,
64
+ ...A,
65
+ children: o && /* @__PURE__ */ n(t, {
66
+ cardName: o,
67
+ parentCard: d
68
+ })
69
+ });
70
+ };
71
+ //#endregion
72
+ export { i as ObservableComponent };
73
+
74
+ //# sourceMappingURL=observable.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observable.component.js","names":[],"sources":["../../../src/cards/observable/observable.component.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport type {\n ObservableEnabledEvents,\n ObservableEvents,\n ObservableKeyEvent,\n ObservableMouseEvent,\n ObservableProps,\n ObservableWheelEvent,\n} from \"./observable.types\";\n\nfunction pointerPosition(\n e: {pageX: number; pageY: number},\n rect: DOMRect,\n): {\n absoluteX: number;\n absoluteY: number;\n relativeX: number;\n relativeY: number;\n} {\n return {\n absoluteX: e.pageX,\n absoluteY: e.pageY,\n relativeX: e.pageX - (rect.left + window.scrollX),\n relativeY: e.pageY - (rect.top + window.scrollY),\n };\n}\n\nexport const ObservableComponent = (\n props: PiCardProps<ObservableProps, ObservableEvents>,\n): React.ReactNode => {\n const {\n id,\n content,\n enable = {} as ObservableEnabledEvents,\n className,\n style,\n data,\n cardName,\n onClicked,\n onDoubleClicked,\n onMouseDown,\n onMouseUp,\n onMouseEnter,\n onMouseMove,\n onMouseLeave,\n onContextMenu,\n onWheel,\n onKeyDown,\n onKeyUp,\n onFocus,\n onBlur,\n } = props;\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n\n function mouseEvent(\n e: React.MouseEvent<HTMLDivElement>,\n ): ObservableMouseEvent {\n const rect =\n rootRef.current?.getBoundingClientRect() ??\n ({\n left: 0,\n top: 0,\n } as DOMRect);\n return {\n id,\n button: e.button,\n buttons: e.buttons,\n altKey: e.altKey,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n shiftKey: e.shiftKey,\n ...pointerPosition(e, rect),\n };\n }\n\n function wheelEvent(\n e: React.WheelEvent<HTMLDivElement>,\n ): ObservableWheelEvent {\n const rect =\n rootRef.current?.getBoundingClientRect() ??\n ({\n left: 0,\n top: 0,\n } as DOMRect);\n return {\n id,\n deltaX: e.deltaX,\n deltaY: e.deltaY,\n deltaZ: e.deltaZ,\n ...pointerPosition(e, rect),\n };\n }\n\n function keyEvent(\n e: React.KeyboardEvent<HTMLDivElement>,\n ): ObservableKeyEvent {\n return {\n id,\n key: e.key,\n code: e.code,\n repeat: e.repeat,\n altKey: e.altKey,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n shiftKey: e.shiftKey,\n };\n }\n\n const dataAttrs = data\n ? Object.fromEntries(Object.entries(data).map(([k, v]) => [`data-${k}`, v]))\n : {};\n\n // Only wire up handlers for events that are explicitly enabled.\n const handlers: Record<string, unknown> = {};\n\n if (enable.clicked) {\n handlers.onClick = (e: React.MouseEvent<HTMLDivElement>) =>\n onClicked(mouseEvent(e));\n }\n if (enable.doubleClicked) {\n handlers.onDoubleClick = (e: React.MouseEvent<HTMLDivElement>) =>\n onDoubleClicked(mouseEvent(e));\n }\n if (enable.mouseDown) {\n handlers.onMouseDown = (e: React.MouseEvent<HTMLDivElement>) =>\n onMouseDown(mouseEvent(e));\n }\n if (enable.mouseUp) {\n handlers.onMouseUp = (e: React.MouseEvent<HTMLDivElement>) =>\n onMouseUp(mouseEvent(e));\n }\n if (enable.mouseEnter) {\n handlers.onMouseEnter = (e: React.MouseEvent<HTMLDivElement>) =>\n onMouseEnter(mouseEvent(e));\n }\n if (enable.mouseMove) {\n handlers.onMouseMove = (e: React.MouseEvent<HTMLDivElement>) =>\n onMouseMove(mouseEvent(e));\n }\n if (enable.mouseLeave) {\n handlers.onMouseLeave = (e: React.MouseEvent<HTMLDivElement>) =>\n onMouseLeave(mouseEvent(e));\n }\n if (enable.contextMenu) {\n handlers.onContextMenu = (e: React.MouseEvent<HTMLDivElement>) =>\n onContextMenu(mouseEvent(e));\n }\n if (enable.wheel) {\n handlers.onWheel = (e: React.WheelEvent<HTMLDivElement>) =>\n onWheel(wheelEvent(e));\n }\n if (enable.keyDown) {\n handlers.onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) =>\n onKeyDown(keyEvent(e));\n }\n if (enable.keyUp) {\n handlers.onKeyUp = (e: React.KeyboardEvent<HTMLDivElement>) =>\n onKeyUp(keyEvent(e));\n }\n if (enable.focus) {\n handlers.onFocus = () => onFocus({id});\n }\n if (enable.blur) {\n handlers.onBlur = () => onBlur({id});\n }\n\n // Keyboard events require the element to be focusable.\n const needsTabIndex = Boolean(\n enable.keyDown || enable.keyUp || enable.focus || enable.blur,\n );\n\n return (\n <div\n ref={rootRef}\n className={className}\n style={style as React.CSSProperties}\n data-pihanga={cardName}\n tabIndex={needsTabIndex ? 0 : undefined}\n {...dataAttrs}\n {...handlers}\n >\n {content && <Card cardName={content} parentCard={cardName} />}\n </div>\n );\n};\n"],"mappings":";;;;AAYA,SAAS,EACP,GACA,GAMA;CACA,OAAO;EACL,WAAW,EAAE;EACb,WAAW,EAAE;EACb,WAAW,EAAE,SAAS,EAAK,OAAO,OAAO;EACzC,WAAW,EAAE,SAAS,EAAK,MAAM,OAAO;CAC1C;AACF;AAEA,IAAa,KACX,MACoB;CACpB,IAAM,EACJ,OACA,YACA,YAAS,CAAC,GACV,cACA,UACA,SACA,aACA,cACA,oBACA,gBACA,cACA,iBACA,gBACA,iBACA,kBACA,YACA,cACA,YACA,YACA,cACE,GAEE,IAAU,EAAM,OAAuB,IAAI;CAEjD,SAAS,EACP,GACsB;EACtB,IAAM,IACJ,EAAQ,SAAS,sBAAsB,KACtC;GACC,MAAM;GACN,KAAK;EACP;EACF,OAAO;GACL;GACA,QAAQ,EAAE;GACV,SAAS,EAAE;GACX,QAAQ,EAAE;GACV,SAAS,EAAE;GACX,SAAS,EAAE;GACX,UAAU,EAAE;GACZ,GAAG,EAAgB,GAAG,CAAI;EAC5B;CACF;CAEA,SAAS,EACP,GACsB;EACtB,IAAM,IACJ,EAAQ,SAAS,sBAAsB,KACtC;GACC,MAAM;GACN,KAAK;EACP;EACF,OAAO;GACL;GACA,QAAQ,EAAE;GACV,QAAQ,EAAE;GACV,QAAQ,EAAE;GACV,GAAG,EAAgB,GAAG,CAAI;EAC5B;CACF;CAEA,SAAS,EACP,GACoB;EACpB,OAAO;GACL;GACA,KAAK,EAAE;GACP,MAAM,EAAE;GACR,QAAQ,EAAE;GACV,QAAQ,EAAE;GACV,SAAS,EAAE;GACX,SAAS,EAAE;GACX,UAAU,EAAE;EACd;CACF;CAEA,IAAM,IAAY,IACd,OAAO,YAAY,OAAO,QAAQ,CAAI,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,IACzE,CAAC,GAGC,IAAoC,CAAC;CA0D3C,OAxDI,EAAO,YACT,EAAS,WAAW,MAClB,EAAU,EAAW,CAAC,CAAC,IAEvB,EAAO,kBACT,EAAS,iBAAiB,MACxB,EAAgB,EAAW,CAAC,CAAC,IAE7B,EAAO,cACT,EAAS,eAAe,MACtB,EAAY,EAAW,CAAC,CAAC,IAEzB,EAAO,YACT,EAAS,aAAa,MACpB,EAAU,EAAW,CAAC,CAAC,IAEvB,EAAO,eACT,EAAS,gBAAgB,MACvB,EAAa,EAAW,CAAC,CAAC,IAE1B,EAAO,cACT,EAAS,eAAe,MACtB,EAAY,EAAW,CAAC,CAAC,IAEzB,EAAO,eACT,EAAS,gBAAgB,MACvB,EAAa,EAAW,CAAC,CAAC,IAE1B,EAAO,gBACT,EAAS,iBAAiB,MACxB,EAAc,EAAW,CAAC,CAAC,IAE3B,EAAO,UACT,EAAS,WAAW,MAClB,EAAQ,EAAW,CAAC,CAAC,IAErB,EAAO,YACT,EAAS,aAAa,MACpB,EAAU,EAAS,CAAC,CAAC,IAErB,EAAO,UACT,EAAS,WAAW,MAClB,EAAQ,EAAS,CAAC,CAAC,IAEnB,EAAO,UACT,EAAS,gBAAgB,EAAQ,EAAC,MAAE,CAAC,IAEnC,EAAO,SACT,EAAS,eAAe,EAAO,EAAC,MAAE,CAAC,IASnC,kBAAC,OAAD;EACE,KAAK;EACM;EACJ;EACP,gBAAc;EACd,UATF,EAAO,WAAW,EAAO,SAAS,EAAO,SAAS,EAAO,OAS7B,IAAI,KAAA;EAC9B,GAAI;EACJ,GAAI;YAEH,KAAW,kBAAC,GAAD;GAAM,UAAU;GAAS,YAAY;EAAW,CAAA;CACzD,CAAA;AAET"}
@@ -0,0 +1,253 @@
1
+ import { PiCardRef } from '@pihanga2/core';
2
+ export declare const OBSERVABLE_CARD = "shad/observable";
3
+ export declare const Observable: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<ObservableProps<object>, S, ObservableEvents>) => import('@pihanga2/core').PiCardDef;
4
+ export declare const OBSERVABLE_ACTION: {
5
+ CLICKED: string;
6
+ BLUR: string;
7
+ FOCUS: string;
8
+ WHEEL: string;
9
+ DOUBLE_CLICKED: string;
10
+ MOUSE_DOWN: string;
11
+ MOUSE_UP: string;
12
+ MOUSE_ENTER: string;
13
+ MOUSE_MOVE: string;
14
+ MOUSE_LEAVE: string;
15
+ CONTEXT_MENU: string;
16
+ KEY_DOWN: string;
17
+ KEY_UP: string;
18
+ };
19
+ export declare const onObservableClicked: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
20
+ cardID: string;
21
+ } & ObservablePointerPosition & {
22
+ id?: string;
23
+ /** Mouse button that triggered the event (`MouseEvent.button`). */
24
+ button?: number;
25
+ /** Bitmask of currently-pressed buttons (`MouseEvent.buttons`). */
26
+ buttons?: number;
27
+ altKey: boolean;
28
+ ctrlKey: boolean;
29
+ metaKey: boolean;
30
+ shiftKey: boolean;
31
+ }>) => void;
32
+ export declare const onObservableDoubleClicked: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
33
+ cardID: string;
34
+ } & ObservablePointerPosition & {
35
+ id?: string;
36
+ /** Mouse button that triggered the event (`MouseEvent.button`). */
37
+ button?: number;
38
+ /** Bitmask of currently-pressed buttons (`MouseEvent.buttons`). */
39
+ buttons?: number;
40
+ altKey: boolean;
41
+ ctrlKey: boolean;
42
+ metaKey: boolean;
43
+ shiftKey: boolean;
44
+ }>) => void;
45
+ export declare const onObservableMouseDown: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
46
+ cardID: string;
47
+ } & ObservablePointerPosition & {
48
+ id?: string;
49
+ /** Mouse button that triggered the event (`MouseEvent.button`). */
50
+ button?: number;
51
+ /** Bitmask of currently-pressed buttons (`MouseEvent.buttons`). */
52
+ buttons?: number;
53
+ altKey: boolean;
54
+ ctrlKey: boolean;
55
+ metaKey: boolean;
56
+ shiftKey: boolean;
57
+ }>) => void;
58
+ export declare const onObservableMouseUp: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
59
+ cardID: string;
60
+ } & ObservablePointerPosition & {
61
+ id?: string;
62
+ /** Mouse button that triggered the event (`MouseEvent.button`). */
63
+ button?: number;
64
+ /** Bitmask of currently-pressed buttons (`MouseEvent.buttons`). */
65
+ buttons?: number;
66
+ altKey: boolean;
67
+ ctrlKey: boolean;
68
+ metaKey: boolean;
69
+ shiftKey: boolean;
70
+ }>) => void;
71
+ export declare const onObservableMouseEnter: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
72
+ cardID: string;
73
+ } & ObservablePointerPosition & {
74
+ id?: string;
75
+ /** Mouse button that triggered the event (`MouseEvent.button`). */
76
+ button?: number;
77
+ /** Bitmask of currently-pressed buttons (`MouseEvent.buttons`). */
78
+ buttons?: number;
79
+ altKey: boolean;
80
+ ctrlKey: boolean;
81
+ metaKey: boolean;
82
+ shiftKey: boolean;
83
+ }>) => void;
84
+ export declare const onObservableMouseMove: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
85
+ cardID: string;
86
+ } & ObservablePointerPosition & {
87
+ id?: string;
88
+ /** Mouse button that triggered the event (`MouseEvent.button`). */
89
+ button?: number;
90
+ /** Bitmask of currently-pressed buttons (`MouseEvent.buttons`). */
91
+ buttons?: number;
92
+ altKey: boolean;
93
+ ctrlKey: boolean;
94
+ metaKey: boolean;
95
+ shiftKey: boolean;
96
+ }>) => void;
97
+ export declare const onObservableMouseLeave: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
98
+ cardID: string;
99
+ } & ObservablePointerPosition & {
100
+ id?: string;
101
+ /** Mouse button that triggered the event (`MouseEvent.button`). */
102
+ button?: number;
103
+ /** Bitmask of currently-pressed buttons (`MouseEvent.buttons`). */
104
+ buttons?: number;
105
+ altKey: boolean;
106
+ ctrlKey: boolean;
107
+ metaKey: boolean;
108
+ shiftKey: boolean;
109
+ }>) => void;
110
+ export declare const onObservableContextMenu: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
111
+ cardID: string;
112
+ } & ObservablePointerPosition & {
113
+ id?: string;
114
+ /** Mouse button that triggered the event (`MouseEvent.button`). */
115
+ button?: number;
116
+ /** Bitmask of currently-pressed buttons (`MouseEvent.buttons`). */
117
+ buttons?: number;
118
+ altKey: boolean;
119
+ ctrlKey: boolean;
120
+ metaKey: boolean;
121
+ shiftKey: boolean;
122
+ }>) => void;
123
+ export declare const onObservableWheel: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
124
+ cardID: string;
125
+ } & ObservablePointerPosition & {
126
+ id?: string;
127
+ deltaX: number;
128
+ deltaY: number;
129
+ deltaZ: number;
130
+ }>) => void;
131
+ export declare const onObservableKeyDown: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
132
+ cardID: string;
133
+ } & ObservableKeyEvent>) => void;
134
+ export declare const onObservableKeyUp: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
135
+ cardID: string;
136
+ } & ObservableKeyEvent>) => void;
137
+ export declare const onObservableFocus: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
138
+ cardID: string;
139
+ } & ObservableFocusEvent>) => void;
140
+ export declare const onObservableBlur: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
141
+ cardID: string;
142
+ } & ObservableFocusEvent>) => void;
143
+ /**
144
+ * Flags to selectively enable interaction events on the `Observable` card.
145
+ *
146
+ * An event is only wired up (listened for on the DOM) **and** reported (its
147
+ * `onXxx` callback fired) when its corresponding flag is `true`. Disabled
148
+ * events incur zero overhead — no listener is even attached.
149
+ */
150
+ export type ObservableEnabledEvents = {
151
+ /** Single click. */
152
+ clicked?: boolean;
153
+ /** Double click. */
154
+ doubleClicked?: boolean;
155
+ /** Mouse button pressed down. */
156
+ mouseDown?: boolean;
157
+ /** Mouse button released. */
158
+ mouseUp?: boolean;
159
+ /** Pointer entered the bounding box. */
160
+ mouseEnter?: boolean;
161
+ /** Pointer moved while inside the bounding box. */
162
+ mouseMove?: boolean;
163
+ /** Pointer left the bounding box. */
164
+ mouseLeave?: boolean;
165
+ /** Right-click / context-menu request. */
166
+ contextMenu?: boolean;
167
+ /** Mouse wheel / trackpad scroll. */
168
+ wheel?: boolean;
169
+ /** Key pressed down (requires the root to be focused). */
170
+ keyDown?: boolean;
171
+ /** Key released (requires the root to be focused). */
172
+ keyUp?: boolean;
173
+ /** Root element gained focus. */
174
+ focus?: boolean;
175
+ /** Root element lost focus. */
176
+ blur?: boolean;
177
+ };
178
+ export type ObservableProps<S = object> = {
179
+ /** Optional caller-defined id, echoed back in every emitted event. */
180
+ id?: string;
181
+ /** Single child card rendered inside the transparent wrapper `<div>`. */
182
+ content?: PiCardRef;
183
+ /**
184
+ * Selectively enable which interaction events are captured and reported.
185
+ * Any event not set to `true` here is neither listened for nor emitted.
186
+ */
187
+ enable?: ObservableEnabledEvents;
188
+ /** Additional Tailwind / CSS utility classes for the wrapper `<div>`. */
189
+ className?: string;
190
+ /** Inline style object for the wrapper `<div>`. */
191
+ style?: S;
192
+ /** Arbitrary data attributes rendered as `data-{key}={value}` on the root element */
193
+ data?: Record<string, string>;
194
+ };
195
+ /**
196
+ * Pointer position reported by every mouse/wheel event.
197
+ *
198
+ * - `absoluteX` / `absoluteY` — relative to the top-left of the **page**
199
+ * (i.e. `event.pageX` / `event.pageY`; includes scroll offset).
200
+ * - `relativeX` / `relativeY` — relative to the top-left of the
201
+ * `Observable` card's own bounding box.
202
+ */
203
+ export type ObservablePointerPosition = {
204
+ absoluteX: number;
205
+ absoluteY: number;
206
+ relativeX: number;
207
+ relativeY: number;
208
+ };
209
+ export type ObservableMouseEvent = ObservablePointerPosition & {
210
+ id?: string;
211
+ /** Mouse button that triggered the event (`MouseEvent.button`). */
212
+ button?: number;
213
+ /** Bitmask of currently-pressed buttons (`MouseEvent.buttons`). */
214
+ buttons?: number;
215
+ altKey: boolean;
216
+ ctrlKey: boolean;
217
+ metaKey: boolean;
218
+ shiftKey: boolean;
219
+ };
220
+ export type ObservableWheelEvent = ObservablePointerPosition & {
221
+ id?: string;
222
+ deltaX: number;
223
+ deltaY: number;
224
+ deltaZ: number;
225
+ };
226
+ export type ObservableKeyEvent = {
227
+ id?: string;
228
+ key: string;
229
+ code: string;
230
+ repeat: boolean;
231
+ altKey: boolean;
232
+ ctrlKey: boolean;
233
+ metaKey: boolean;
234
+ shiftKey: boolean;
235
+ };
236
+ export type ObservableFocusEvent = {
237
+ id?: string;
238
+ };
239
+ export type ObservableEvents = {
240
+ onClicked: ObservableMouseEvent;
241
+ onDoubleClicked: ObservableMouseEvent;
242
+ onMouseDown: ObservableMouseEvent;
243
+ onMouseUp: ObservableMouseEvent;
244
+ onMouseEnter: ObservableMouseEvent;
245
+ onMouseMove: ObservableMouseEvent;
246
+ onMouseLeave: ObservableMouseEvent;
247
+ onContextMenu: ObservableMouseEvent;
248
+ onWheel: ObservableWheelEvent;
249
+ onKeyDown: ObservableKeyEvent;
250
+ onKeyUp: ObservableKeyEvent;
251
+ onFocus: ObservableFocusEvent;
252
+ onBlur: ObservableFocusEvent;
253
+ };
@@ -0,0 +1,21 @@
1
+ import { createCardDeclaration as e, createOnAction as t, registerActions as n } from "@pihanga2/core";
2
+ //#region src/cards/observable/observable.types.ts
3
+ var r = "shad/observable", i = e(r), a = n(r, [
4
+ "clicked",
5
+ "double_clicked",
6
+ "mouse_down",
7
+ "mouse_up",
8
+ "mouse_enter",
9
+ "mouse_move",
10
+ "mouse_leave",
11
+ "context_menu",
12
+ "wheel",
13
+ "key_down",
14
+ "key_up",
15
+ "focus",
16
+ "blur"
17
+ ]), o = t(a.CLICKED), s = t(a.DOUBLE_CLICKED), c = t(a.MOUSE_DOWN), l = t(a.MOUSE_UP), u = t(a.MOUSE_ENTER), d = t(a.MOUSE_MOVE), f = t(a.MOUSE_LEAVE), p = t(a.CONTEXT_MENU), m = t(a.WHEEL), h = t(a.KEY_DOWN), g = t(a.KEY_UP), _ = t(a.FOCUS), v = t(a.BLUR);
18
+ //#endregion
19
+ export { a as OBSERVABLE_ACTION, r as OBSERVABLE_CARD, i as Observable, v as onObservableBlur, o as onObservableClicked, p as onObservableContextMenu, s as onObservableDoubleClicked, _ as onObservableFocus, h as onObservableKeyDown, g as onObservableKeyUp, c as onObservableMouseDown, u as onObservableMouseEnter, f as onObservableMouseLeave, d as onObservableMouseMove, l as onObservableMouseUp, m as onObservableWheel };
20
+
21
+ //# sourceMappingURL=observable.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observable.types.js","names":[],"sources":["../../../src/cards/observable/observable.types.ts"],"sourcesContent":["import {\n type PiCardRef,\n createCardDeclaration,\n createOnAction,\n registerActions,\n} from \"@pihanga2/core\";\n\nexport const OBSERVABLE_CARD = \"shad/observable\";\n\nexport const Observable = createCardDeclaration<\n ObservableProps,\n ObservableEvents\n>(OBSERVABLE_CARD);\n\n// ---------------------------------------------------------------------------\n// Actions\n// ---------------------------------------------------------------------------\n\nexport const OBSERVABLE_ACTION = registerActions(OBSERVABLE_CARD, [\n \"clicked\",\n \"double_clicked\",\n \"mouse_down\",\n \"mouse_up\",\n \"mouse_enter\",\n \"mouse_move\",\n \"mouse_leave\",\n \"context_menu\",\n \"wheel\",\n \"key_down\",\n \"key_up\",\n \"focus\",\n \"blur\",\n]);\n\nexport const onObservableClicked = createOnAction<ObservableMouseEvent>(\n OBSERVABLE_ACTION.CLICKED,\n);\nexport const onObservableDoubleClicked = createOnAction<ObservableMouseEvent>(\n OBSERVABLE_ACTION.DOUBLE_CLICKED,\n);\nexport const onObservableMouseDown = createOnAction<ObservableMouseEvent>(\n OBSERVABLE_ACTION.MOUSE_DOWN,\n);\nexport const onObservableMouseUp = createOnAction<ObservableMouseEvent>(\n OBSERVABLE_ACTION.MOUSE_UP,\n);\nexport const onObservableMouseEnter = createOnAction<ObservableMouseEvent>(\n OBSERVABLE_ACTION.MOUSE_ENTER,\n);\nexport const onObservableMouseMove = createOnAction<ObservableMouseEvent>(\n OBSERVABLE_ACTION.MOUSE_MOVE,\n);\nexport const onObservableMouseLeave = createOnAction<ObservableMouseEvent>(\n OBSERVABLE_ACTION.MOUSE_LEAVE,\n);\nexport const onObservableContextMenu = createOnAction<ObservableMouseEvent>(\n OBSERVABLE_ACTION.CONTEXT_MENU,\n);\nexport const onObservableWheel = createOnAction<ObservableWheelEvent>(\n OBSERVABLE_ACTION.WHEEL,\n);\nexport const onObservableKeyDown = createOnAction<ObservableKeyEvent>(\n OBSERVABLE_ACTION.KEY_DOWN,\n);\nexport const onObservableKeyUp = createOnAction<ObservableKeyEvent>(\n OBSERVABLE_ACTION.KEY_UP,\n);\nexport const onObservableFocus = createOnAction<ObservableFocusEvent>(\n OBSERVABLE_ACTION.FOCUS,\n);\nexport const onObservableBlur = createOnAction<ObservableFocusEvent>(\n OBSERVABLE_ACTION.BLUR,\n);\n\n// ---------------------------------------------------------------------------\n// Props\n// ---------------------------------------------------------------------------\n\n/**\n * Flags to selectively enable interaction events on the `Observable` card.\n *\n * An event is only wired up (listened for on the DOM) **and** reported (its\n * `onXxx` callback fired) when its corresponding flag is `true`. Disabled\n * events incur zero overhead — no listener is even attached.\n */\nexport type ObservableEnabledEvents = {\n /** Single click. */\n clicked?: boolean;\n /** Double click. */\n doubleClicked?: boolean;\n /** Mouse button pressed down. */\n mouseDown?: boolean;\n /** Mouse button released. */\n mouseUp?: boolean;\n /** Pointer entered the bounding box. */\n mouseEnter?: boolean;\n /** Pointer moved while inside the bounding box. */\n mouseMove?: boolean;\n /** Pointer left the bounding box. */\n mouseLeave?: boolean;\n /** Right-click / context-menu request. */\n contextMenu?: boolean;\n /** Mouse wheel / trackpad scroll. */\n wheel?: boolean;\n /** Key pressed down (requires the root to be focused). */\n keyDown?: boolean;\n /** Key released (requires the root to be focused). */\n keyUp?: boolean;\n /** Root element gained focus. */\n focus?: boolean;\n /** Root element lost focus. */\n blur?: boolean;\n};\n\nexport type ObservableProps<S = object> = {\n /** Optional caller-defined id, echoed back in every emitted event. */\n id?: string;\n\n /** Single child card rendered inside the transparent wrapper `<div>`. */\n content?: PiCardRef;\n\n /**\n * Selectively enable which interaction events are captured and reported.\n * Any event not set to `true` here is neither listened for nor emitted.\n */\n enable?: ObservableEnabledEvents;\n\n /** Additional Tailwind / CSS utility classes for the wrapper `<div>`. */\n className?: string;\n /** Inline style object for the wrapper `<div>`. */\n style?: S;\n\n /** Arbitrary data attributes rendered as `data-{key}={value}` on the root element */\n data?: Record<string, string>;\n};\n\n// ---------------------------------------------------------------------------\n// Event payloads\n// ---------------------------------------------------------------------------\n\n/**\n * Pointer position reported by every mouse/wheel event.\n *\n * - `absoluteX` / `absoluteY` — relative to the top-left of the **page**\n * (i.e. `event.pageX` / `event.pageY`; includes scroll offset).\n * - `relativeX` / `relativeY` — relative to the top-left of the\n * `Observable` card's own bounding box.\n */\nexport type ObservablePointerPosition = {\n absoluteX: number;\n absoluteY: number;\n relativeX: number;\n relativeY: number;\n};\n\nexport type ObservableMouseEvent = ObservablePointerPosition & {\n id?: string;\n /** Mouse button that triggered the event (`MouseEvent.button`). */\n button?: number;\n /** Bitmask of currently-pressed buttons (`MouseEvent.buttons`). */\n buttons?: number;\n altKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n shiftKey: boolean;\n};\n\nexport type ObservableWheelEvent = ObservablePointerPosition & {\n id?: string;\n deltaX: number;\n deltaY: number;\n deltaZ: number;\n};\n\nexport type ObservableKeyEvent = {\n id?: string;\n key: string;\n code: string;\n repeat: boolean;\n altKey: boolean;\n ctrlKey: boolean;\n metaKey: boolean;\n shiftKey: boolean;\n};\n\nexport type ObservableFocusEvent = {\n id?: string;\n};\n\nexport type ObservableEvents = {\n onClicked: ObservableMouseEvent;\n onDoubleClicked: ObservableMouseEvent;\n onMouseDown: ObservableMouseEvent;\n onMouseUp: ObservableMouseEvent;\n onMouseEnter: ObservableMouseEvent;\n onMouseMove: ObservableMouseEvent;\n onMouseLeave: ObservableMouseEvent;\n onContextMenu: ObservableMouseEvent;\n onWheel: ObservableWheelEvent;\n onKeyDown: ObservableKeyEvent;\n onKeyUp: ObservableKeyEvent;\n onFocus: ObservableFocusEvent;\n onBlur: ObservableFocusEvent;\n};\n"],"mappings":";;AAOA,IAAa,IAAkB,mBAElB,IAAa,EAGxB,CAAe,GAMJ,IAAoB,EAAgB,GAAiB;CAChE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,GAEY,IAAsB,EACjC,EAAkB,OACpB,GACa,IAA4B,EACvC,EAAkB,cACpB,GACa,IAAwB,EACnC,EAAkB,UACpB,GACa,IAAsB,EACjC,EAAkB,QACpB,GACa,IAAyB,EACpC,EAAkB,WACpB,GACa,IAAwB,EACnC,EAAkB,UACpB,GACa,IAAyB,EACpC,EAAkB,WACpB,GACa,IAA0B,EACrC,EAAkB,YACpB,GACa,IAAoB,EAC/B,EAAkB,KACpB,GACa,IAAsB,EACjC,EAAkB,QACpB,GACa,IAAoB,EAC/B,EAAkB,MACpB,GACa,IAAoB,EAC/B,EAAkB,KACpB,GACa,IAAmB,EAC9B,EAAkB,IACpB"}
@@ -5,7 +5,7 @@ export declare const PageWithNavbar: <S extends import('@pihanga2/core').ReduxSt
5
5
  export declare const PAGE_WITH_NAVBAR_ACTION: {
6
6
  NAVIGATE_TO: string;
7
7
  };
8
- export declare const onPageWithNavbarNavigateTo: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
8
+ export declare const onPageWithNavbarNavigateTo: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
9
9
  cardID: string;
10
10
  } & PageWithNavbarNavigateToEvent>) => void;
11
11
  /**
@@ -7,7 +7,7 @@ export declare const PageWithNavbarMeta: <S extends import('@pihanga2/core').Red
7
7
  export declare const PAGE_WITH_NAVBAR_META_ACTION: {
8
8
  NAVIGATE_TO: string;
9
9
  };
10
- export declare const onPageWithNavbarMetaNavigateTo: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
10
+ export declare const onPageWithNavbarMetaNavigateTo: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
11
11
  cardID: string;
12
12
  } & PageWithNavbarMetaNavigateToEvent>) => void;
13
13
  export type NavLink = {
@@ -4,10 +4,10 @@ export declare const PASTE_TARGET_ACTION: {
4
4
  ERROR: string;
5
5
  PASTED_CONTENT: string;
6
6
  };
7
- export declare const onContentPasted: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
7
+ export declare const onContentPasted: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
8
8
  cardID: string;
9
9
  } & CloseEvent>) => void;
10
- export declare const onPasteError: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
10
+ export declare const onPasteError: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core/types').PiRegisterMinimal, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
11
11
  cardID: string;
12
12
  } & PasteTargetErrorEvent>) => void;
13
13
  export declare const DEF_HEIGHT = "120px";
@@ -0,0 +1,12 @@
1
+ import { ResizableColumnsComponent as e } from "./resizableColumns.component.js";
2
+ import { RESIZABLE_COLUMNS_CARD as t, ResizableColumns as n } from "./resizableColumns.types.js";
3
+ import { registerCardComponent as r } from "@pihanga2/core";
4
+ //#region src/cards/resizableColumns/index.ts
5
+ r({
6
+ name: t,
7
+ component: e
8
+ });
9
+ //#endregion
10
+ export { t as RESIZABLE_COLUMNS_CARD, n as ResizableColumns };
11
+
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/resizableColumns/index.ts"],"sourcesContent":["import {registerCardComponent} from \"@pihanga2/core\";\n\nimport {ResizableColumnsComponent} from \"./resizableColumns.component\";\nimport {RESIZABLE_COLUMNS_CARD} from \"./resizableColumns.types\";\n\nexport * from \"./resizableColumns.types\";\n\nregisterCardComponent({\n name: RESIZABLE_COLUMNS_CARD,\n component: ResizableColumnsComponent,\n});\n"],"mappings":";;;;AAOA,EAAsB;CACpB,MAAM;CACN,WAAW;AACb,CAAC"}
@@ -0,0 +1,105 @@
1
+ import './resizableColumns.css';/* empty css */
2
+ import * as e from "react";
3
+ import { Card as t } from "@pihanga2/core";
4
+ import n from "clsx";
5
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
+ //#region src/cards/resizableColumns/resizableColumns.component.tsx
7
+ var a = 10;
8
+ function o(e, t, n) {
9
+ if (!e?.length || e.length !== t) return Array(t).fill(100 / t);
10
+ let r = e.map((e) => {
11
+ let t = e.trim();
12
+ return t.endsWith("px") ? {
13
+ type: "px",
14
+ value: Math.max(0, parseFloat(t))
15
+ } : t.endsWith("%") ? {
16
+ type: "pct",
17
+ value: Math.max(0, parseFloat(t))
18
+ } : t.endsWith("fr") ? {
19
+ type: "fr",
20
+ value: Math.max(0, parseFloat(t))
21
+ } : {
22
+ type: "fr",
23
+ value: 1
24
+ };
25
+ }), i = n > 0 ? r.reduce((e, t) => e + (t.type === "px" ? t.value / n * 100 : 0), 0) : 0, a = r.reduce((e, t) => e + (t.type === "pct" ? t.value : 0), 0), o = Math.max(0, 100 - i - a), s = r.reduce((e, t) => e + (t.type === "fr" ? t.value : 0), 0), c = r.map((e) => e.type === "px" ? n > 0 ? e.value / n * 100 : 100 / t : e.type === "pct" ? e.value : s > 0 ? e.value / s * o : o / t), l = c.reduce((e, t) => e + t, 0);
26
+ return l > 0 ? c.map((e) => e / l * 100) : Array(t).fill(100 / t);
27
+ }
28
+ var s = (e, t, n) => Math.min(n, Math.max(t, e)), c = (c) => {
29
+ let { cardName: l, columnCards: u = [], columnWidths: d, minColumnPercent: f = a, className: p, dividerClassName: m } = c, h = u.length, [g, _] = e.useState(() => Array(h).fill(100 / h)), v = e.useRef(g), y = e.useRef(null), b = e.useRef(null);
30
+ e.useLayoutEffect(() => {
31
+ if (!y.current) return;
32
+ let e = y.current.getBoundingClientRect().width, t = o(d, h, e);
33
+ v.current = t, _(t);
34
+ }, [d, h]), e.useEffect(() => () => {
35
+ b.current?.();
36
+ }, []);
37
+ let x = (e, t) => ({
38
+ min: f,
39
+ max: t[e] + t[e + 1] - f
40
+ }), S = e.useCallback((e, t) => {
41
+ let n = v.current, r = n[e] + n[e + 1], { min: i, max: a } = x(e, n), o = s(t, i, a), c = [...n];
42
+ c[e] = o, c[e + 1] = r - o, v.current = c, _(c);
43
+ }, [f]), C = e.useCallback((e) => (t) => {
44
+ t.preventDefault();
45
+ let n = t.clientX, r = v.current[e], i = y.current;
46
+ if (!i) return;
47
+ let { width: a } = i.getBoundingClientRect();
48
+ if (a <= 0) return;
49
+ let o = (t) => {
50
+ S(e, r + (t.clientX - n) / a * 100);
51
+ }, s = () => {
52
+ window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", s), b.current = null;
53
+ };
54
+ b.current?.(), window.addEventListener("mousemove", o), window.addEventListener("mouseup", s), b.current = () => {
55
+ window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", s);
56
+ };
57
+ }, [S]), w = e.useCallback((e) => (t) => {
58
+ let { min: n, max: r } = x(e, v.current), i = v.current[e];
59
+ switch (t.key) {
60
+ case "ArrowLeft":
61
+ t.preventDefault(), S(e, i + (t.shiftKey ? -10 : -2));
62
+ break;
63
+ case "ArrowRight":
64
+ t.preventDefault(), S(e, i + (t.shiftKey ? 10 : 2));
65
+ break;
66
+ case "Home":
67
+ t.preventDefault(), S(e, n);
68
+ break;
69
+ case "End":
70
+ t.preventDefault(), S(e, r);
71
+ break;
72
+ }
73
+ }, [S]);
74
+ return h === 0 ? null : /* @__PURE__ */ r("div", {
75
+ ref: y,
76
+ "data-pihanga": l,
77
+ className: n("pi-resizable-columns", p),
78
+ children: u.map((a, o) => {
79
+ let s = g[o] ?? 100 / h;
80
+ return /* @__PURE__ */ i(e.Fragment, { children: [o > 0 && /* @__PURE__ */ r("div", {
81
+ className: n("pi-resizable-columns-divider", m),
82
+ onMouseDown: C(o - 1),
83
+ onKeyDown: w(o - 1),
84
+ role: "separator",
85
+ "aria-orientation": "vertical",
86
+ "aria-label": `Resize columns ${o} and ${o + 1}`,
87
+ "aria-valuemin": f,
88
+ "aria-valuemax": (g[o - 1] ?? 0) + (g[o] ?? 0) - f,
89
+ "aria-valuenow": Math.round(g[o - 1] ?? 0),
90
+ tabIndex: 0
91
+ }), /* @__PURE__ */ r("div", {
92
+ className: "pi-resizable-columns-pane",
93
+ style: { width: `${s}%` },
94
+ children: /* @__PURE__ */ r(t, {
95
+ cardName: a,
96
+ parentCard: l
97
+ })
98
+ })] }, o);
99
+ })
100
+ });
101
+ };
102
+ //#endregion
103
+ export { c as ResizableColumnsComponent };
104
+
105
+ //# sourceMappingURL=resizableColumns.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizableColumns.component.js","names":[],"sources":["../../../src/cards/resizableColumns/resizableColumns.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport clsx from \"clsx\";\n\nimport \"./resizableColumns.css\";\nimport type {ResizableColumnsProps} from \"./resizableColumns.types\";\n\nconst DEFAULT_MIN_PERCENT = 10;\n\ntype ParsedUnit = {type: \"px\" | \"pct\" | \"fr\"; value: number};\n\nfunction parseColumnWidths(\n widths: string[] | undefined,\n count: number,\n containerPx: number,\n): number[] {\n if (!widths?.length || widths.length !== count) {\n return new Array(count).fill(100 / count);\n }\n\n const parsed: ParsedUnit[] = widths.map((w) => {\n const s = w.trim();\n if (s.endsWith(\"px\"))\n return {type: \"px\", value: Math.max(0, parseFloat(s))};\n if (s.endsWith(\"%\"))\n return {type: \"pct\", value: Math.max(0, parseFloat(s))};\n if (s.endsWith(\"fr\"))\n return {type: \"fr\", value: Math.max(0, parseFloat(s))};\n return {type: \"fr\", value: 1};\n });\n\n const totalPxAsPct =\n containerPx > 0\n ? parsed.reduce(\n (s, p) => s + (p.type === \"px\" ? (p.value / containerPx) * 100 : 0),\n 0,\n )\n : 0;\n const totalExplicitPct = parsed.reduce(\n (s, p) => s + (p.type === \"pct\" ? p.value : 0),\n 0,\n );\n const remainingPct = Math.max(0, 100 - totalPxAsPct - totalExplicitPct);\n const totalFr = parsed.reduce(\n (s, p) => s + (p.type === \"fr\" ? p.value : 0),\n 0,\n );\n\n const result = parsed.map((p) => {\n if (p.type === \"px\")\n return containerPx > 0 ? (p.value / containerPx) * 100 : 100 / count;\n if (p.type === \"pct\") return p.value;\n return totalFr > 0\n ? (p.value / totalFr) * remainingPct\n : remainingPct / count;\n });\n\n const total = result.reduce((s, v) => s + v, 0);\n return total > 0\n ? result.map((v) => (v / total) * 100)\n : new Array(count).fill(100 / count);\n}\n\nconst clamp = (v: number, min: number, max: number) =>\n Math.min(max, Math.max(min, v));\n\nexport const ResizableColumnsComponent = (\n props: PiCardProps<ResizableColumnsProps>,\n): React.ReactNode => {\n const {\n cardName,\n columnCards = [],\n columnWidths,\n minColumnPercent = DEFAULT_MIN_PERCENT,\n className,\n dividerClassName,\n } = props;\n\n const count = columnCards.length;\n\n // Equal split as the initial state — useLayoutEffect overwrites before paint.\n const [panePercents, setPanePercents] = React.useState<number[]>(() =>\n new Array(count).fill(100 / count),\n );\n const panePercentsRef = React.useRef(panePercents);\n const containerRef = React.useRef<HTMLDivElement | null>(null);\n const dragCleanupRef = React.useRef<(() => void) | null>(null);\n\n // Parse columnWidths once the container is mounted so px values can be resolved.\n React.useLayoutEffect(() => {\n if (!containerRef.current) return;\n const width = containerRef.current.getBoundingClientRect().width;\n const next = parseColumnWidths(columnWidths, count, width);\n panePercentsRef.current = next;\n setPanePercents(next);\n }, [columnWidths, count]);\n\n // Cleanup any in-progress drag on unmount.\n React.useEffect(() => {\n return () => {\n dragCleanupRef.current?.();\n };\n }, []);\n\n const getDividerBounds = (dividerIndex: number, percents: number[]) => {\n const combined = percents[dividerIndex] + percents[dividerIndex + 1];\n return {min: minColumnPercent, max: combined - minColumnPercent};\n };\n\n const updatePanePair = React.useCallback(\n (dividerIndex: number, nextLeadingPercent: number) => {\n const current = panePercentsRef.current;\n const combined = current[dividerIndex] + current[dividerIndex + 1];\n const {min, max} = getDividerBounds(dividerIndex, current);\n const clamped = clamp(nextLeadingPercent, min, max);\n const next = [...current];\n next[dividerIndex] = clamped;\n next[dividerIndex + 1] = combined - clamped;\n panePercentsRef.current = next;\n setPanePercents(next);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [minColumnPercent],\n );\n\n const handleMouseDown = React.useCallback(\n (dividerIndex: number) => (event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n const startX = event.clientX;\n const startLeadingPercent = panePercentsRef.current[dividerIndex];\n const container = containerRef.current;\n if (!container) return;\n const {width} = container.getBoundingClientRect();\n if (width <= 0) return;\n\n const onMouseMove = (e: MouseEvent) => {\n const deltaPercent = ((e.clientX - startX) / width) * 100;\n updatePanePair(dividerIndex, startLeadingPercent + deltaPercent);\n };\n const onMouseUp = () => {\n window.removeEventListener(\"mousemove\", onMouseMove);\n window.removeEventListener(\"mouseup\", onMouseUp);\n dragCleanupRef.current = null;\n };\n\n dragCleanupRef.current?.();\n window.addEventListener(\"mousemove\", onMouseMove);\n window.addEventListener(\"mouseup\", onMouseUp);\n dragCleanupRef.current = () => {\n window.removeEventListener(\"mousemove\", onMouseMove);\n window.removeEventListener(\"mouseup\", onMouseUp);\n };\n },\n [updatePanePair],\n );\n\n const handleKeyDown = React.useCallback(\n (dividerIndex: number) => (event: React.KeyboardEvent<HTMLDivElement>) => {\n const {min, max} = getDividerBounds(\n dividerIndex,\n panePercentsRef.current,\n );\n const current = panePercentsRef.current[dividerIndex];\n switch (event.key) {\n case \"ArrowLeft\":\n event.preventDefault();\n updatePanePair(dividerIndex, current + (event.shiftKey ? -10 : -2));\n break;\n case \"ArrowRight\":\n event.preventDefault();\n updatePanePair(dividerIndex, current + (event.shiftKey ? 10 : 2));\n break;\n case \"Home\":\n event.preventDefault();\n updatePanePair(dividerIndex, min);\n break;\n case \"End\":\n event.preventDefault();\n updatePanePair(dividerIndex, max);\n break;\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [updatePanePair],\n );\n\n if (count === 0) return null;\n\n return (\n <div\n ref={containerRef}\n data-pihanga={cardName}\n className={clsx(\"pi-resizable-columns\", className)}\n >\n {columnCards.map((card, i) => {\n const pct = panePercents[i] ?? 100 / count;\n return (\n <React.Fragment key={i}>\n {i > 0 && (\n <div\n className={clsx(\n \"pi-resizable-columns-divider\",\n dividerClassName,\n )}\n onMouseDown={handleMouseDown(i - 1)}\n onKeyDown={handleKeyDown(i - 1)}\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={`Resize columns ${i} and ${i + 1}`}\n aria-valuemin={minColumnPercent}\n aria-valuemax={\n (panePercents[i - 1] ?? 0) +\n (panePercents[i] ?? 0) -\n minColumnPercent\n }\n aria-valuenow={Math.round(panePercents[i - 1] ?? 0)}\n tabIndex={0}\n />\n )}\n <div\n className=\"pi-resizable-columns-pane\"\n style={{width: `${pct}%`}}\n >\n <Card cardName={card} parentCard={cardName} />\n </div>\n </React.Fragment>\n );\n })}\n </div>\n );\n};\n"],"mappings":"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"}
@@ -0,0 +1 @@
1
+ .pi-resizable-columns{flex-direction:row;width:100%;min-height:100%;display:flex;overflow:hidden}.pi-resizable-columns-pane{flex-shrink:0;min-width:0;overflow:hidden}.pi-resizable-columns-divider{cursor:col-resize;flex:0 0 8px;position:relative}.pi-resizable-columns-divider:before{content:"";width:var(--rg-divider-width,1px);background-color:var(--rg-divider-color,hsl(var(--border,214 32% 91%)));transition:width .12s,background-color .12s;position:absolute;top:0;bottom:0;left:50%;transform:translate(-50%)}.pi-resizable-columns-divider:hover:before,.pi-resizable-columns-divider:focus-visible:before{width:var(--rg-divider-hover-width,4px);background-color:var(--rg-divider-hover-color,hsl(var(--muted-foreground,215 16% 47%)))}
@@ -0,0 +1,7 @@
1
+ import { createCardDeclaration as e } from "@pihanga2/core";
2
+ //#region src/cards/resizableColumns/resizableColumns.types.ts
3
+ var t = "pi/resizable-columns", n = e(t);
4
+ //#endregion
5
+ export { t as RESIZABLE_COLUMNS_CARD, n as ResizableColumns };
6
+
7
+ //# sourceMappingURL=resizableColumns.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizableColumns.types.js","names":[],"sources":["../../../src/cards/resizableColumns/resizableColumns.types.ts"],"sourcesContent":["import {createCardDeclaration, type PiCardRef} from \"@pihanga2/core\";\n\nexport const RESIZABLE_COLUMNS_CARD = \"pi/resizable-columns\";\n\nexport type ResizableColumnsProps = {\n columnCards: PiCardRef[];\n /**\n * Initial column widths. Supports CSS-like values:\n * - '200px' — fixed initial width\n * - '30%' — explicit percentage\n * - '1fr' — fraction of remaining space (after px/% columns)\n *\n * Defaults to equal split when omitted or when length doesn't match columnCards.\n * @example ['200px', '1fr', '1fr'] — fixed sidebar, two equal remaining columns\n * @example ['30%', '70%']\n * @example ['1fr', '2fr', '1fr']\n */\n columnWidths?: string[];\n /** Minimum percentage any column can shrink to during drag. Default: 10 */\n minColumnPercent?: number;\n className?: string;\n dividerClassName?: string;\n};\n\nexport const ResizableColumns = createCardDeclaration<ResizableColumnsProps>(\n RESIZABLE_COLUMNS_CARD,\n);\n"],"mappings":";;AAEA,IAAa,IAAyB,wBAsBzB,IAAmB,EAC9B,CACF"}