wenay-react2 1.0.35 → 1.0.36

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 (95) hide show
  1. package/README.md +12 -56
  2. package/lib/common/api.d.ts +28 -28
  3. package/lib/common/api.js +31 -31
  4. package/lib/common/src/components/Buttons/MiniButton.d.ts +1 -3
  5. package/lib/common/src/components/Buttons/MiniButton.js +1 -3
  6. package/lib/common/src/components/Dnd/{RNDFunc.d.ts → DragArea.d.ts} +1 -1
  7. package/lib/common/src/components/Dnd/{RNDFunc.js → DragArea.js} +1 -1
  8. package/lib/common/src/components/Dnd/{RNDFunc3.d.ts → FloatingWindow.d.ts} +7 -7
  9. package/lib/common/src/components/Dnd/{RNDFunc3.js → FloatingWindow.js} +10 -10
  10. package/lib/common/src/components/Dnd/OutlineDragDemo.d.ts +1 -0
  11. package/lib/common/src/components/Dnd/{DraggableOutlineDiv.js → OutlineDragDemo.js} +1 -2
  12. package/lib/common/src/components/Dnd/Resizable.js +1 -1
  13. package/lib/common/src/components/Dnd/index.d.ts +3 -3
  14. package/lib/common/src/components/Dnd/index.js +3 -3
  15. package/lib/common/src/components/Input.d.ts +5 -5
  16. package/lib/common/src/components/Input.js +10 -10
  17. package/lib/common/src/components/Menu/RightMenu.d.ts +25 -5
  18. package/lib/common/src/components/Menu/RightMenu.js +27 -19
  19. package/lib/common/src/components/Menu/RightMenuStore.d.ts +2 -2
  20. package/lib/common/src/components/Menu/RightMenuStore.js +1 -1
  21. package/lib/common/src/components/Modal/LeftModal.js +4 -4
  22. package/lib/common/src/components/Modal/Modal.d.ts +11 -17
  23. package/lib/common/src/components/Modal/Modal.js +15 -21
  24. package/lib/common/src/components/Modal/ModalContextProvider.d.ts +0 -6
  25. package/lib/common/src/components/Modal/ModalContextProvider.js +2 -9
  26. package/lib/common/src/components/Other.d.ts +2 -2
  27. package/lib/common/src/components/Other.js +5 -5
  28. package/lib/common/src/components/Parameters.d.ts +3 -3
  29. package/lib/common/src/components/Parameters.js +3 -3
  30. package/lib/common/src/components/{ParametersEngine.d.ts → ParamsEditor.d.ts} +1 -1
  31. package/lib/common/src/components/{ParametersEngine.js → ParamsEditor.js} +10 -10
  32. package/lib/common/src/components/Settings/SettingsDialog.d.ts +4 -4
  33. package/lib/common/src/components/Toolbar/Toolbar.d.ts +50 -37
  34. package/lib/common/src/components/Toolbar/Toolbar.js +60 -23
  35. package/lib/common/src/components/UiSlot/UiSlot.d.ts +3 -3
  36. package/lib/common/src/components/UiSlot/UiSlot.js +6 -6
  37. package/lib/common/src/grid/agGrid4/agGrid4.d.ts +4 -4
  38. package/lib/common/src/grid/agGrid4/agGrid4.js +6 -6
  39. package/lib/common/src/grid/agGrid4/index.d.ts +3 -3
  40. package/lib/common/src/grid/agGrid4/index.js +1 -1
  41. package/lib/common/src/grid/agGrid4/theme.d.ts +3 -3
  42. package/lib/common/src/grid/columnState/CardList.d.ts +11 -0
  43. package/lib/common/src/grid/columnState/CardList.js +28 -0
  44. package/lib/common/src/grid/columnState/ColumnDots.d.ts +9 -0
  45. package/lib/common/src/grid/columnState/ColumnDots.js +121 -0
  46. package/lib/common/src/grid/columnState/ColumnsMenu.d.ts +65 -0
  47. package/lib/common/src/grid/columnState/ColumnsMenu.js +123 -0
  48. package/lib/common/src/grid/columnState/columnState.d.ts +113 -0
  49. package/lib/common/src/grid/columnState/columnState.js +284 -0
  50. package/lib/common/src/grid/columnState/index.d.ts +4 -0
  51. package/lib/common/src/grid/columnState/index.js +4 -0
  52. package/lib/common/src/hooks/index.d.ts +1 -1
  53. package/lib/common/src/hooks/index.js +1 -1
  54. package/lib/common/src/hooks/useKeyboard.d.ts +18 -0
  55. package/lib/common/src/hooks/{useAddDownAnyKey.js → useKeyboard.js} +16 -24
  56. package/lib/common/src/hooks/useObserveStore.d.ts +12 -12
  57. package/lib/common/src/hooks/useObserveStore.js +2 -2
  58. package/lib/common/src/hooks/useOutside.d.ts +12 -19
  59. package/lib/common/src/hooks/useOutside.js +9 -16
  60. package/lib/common/src/hooks/useReorder.d.ts +4 -4
  61. package/lib/common/src/hooks/useReorderBoard.d.ts +15 -15
  62. package/lib/common/src/hooks/useReplay.d.ts +9 -9
  63. package/lib/common/src/hooks/useReplay.js +7 -7
  64. package/lib/common/src/logs/logs.d.ts +3 -3
  65. package/lib/common/src/logs/logs.js +11 -13
  66. package/lib/common/src/logs/{logs3.d.ts → logsContext.d.ts} +4 -4
  67. package/lib/common/src/logs/{logs3.js → logsContext.js} +4 -4
  68. package/lib/common/src/menu/menu.d.ts +16 -16
  69. package/lib/common/src/menu/menu.js +12 -11
  70. package/lib/common/src/menu/menuMouse.d.ts +71 -13
  71. package/lib/common/src/menu/menuMouse.js +189 -21
  72. package/lib/common/src/menu/menuR.d.ts +3 -3
  73. package/lib/common/src/menu/menuR.js +5 -5
  74. package/lib/common/src/styles/styleGrid.d.ts +1 -1
  75. package/lib/common/src/styles/tokens.d.ts +1 -1
  76. package/lib/common/src/styles/tokens.js +1 -1
  77. package/lib/common/src/utils/cache.d.ts +11 -11
  78. package/lib/common/src/utils/cache.js +0 -0
  79. package/lib/common/src/utils/gridRows.d.ts +37 -0
  80. package/lib/common/src/utils/{applyTransactionAsyncUpdate.js → gridRows.js} +6 -38
  81. package/lib/common/src/utils/index.d.ts +2 -2
  82. package/lib/common/src/utils/index.js +2 -2
  83. package/lib/common/src/utils/inputAutoStep.d.ts +2 -2
  84. package/lib/common/src/utils/inputAutoStep.js +26 -37
  85. package/lib/common/src/utils/{mapMemory.d.ts → memoryStore.d.ts} +13 -13
  86. package/lib/common/src/utils/{mapMemory.js → memoryStore.js} +32 -32
  87. package/lib/common/src/utils/observableMap.d.ts +5 -5
  88. package/lib/common/src/utils/observableMap.js +3 -3
  89. package/lib/common/updateBy.js +2 -2
  90. package/lib/style/style.css +3 -3
  91. package/lib/style/tokens.css +1 -1
  92. package/package.json +49 -49
  93. package/lib/common/src/components/Dnd/DraggableOutlineDiv.d.ts +0 -2
  94. package/lib/common/src/hooks/useAddDownAnyKey.d.ts +0 -24
  95. package/lib/common/src/utils/applyTransactionAsyncUpdate.d.ts +0 -53
@@ -2,15 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { sleepAsync } from 'wenay-common2';
4
4
  import { useDraggable } from "../../hooks/useDraggable";
5
- import { DivOutsideClick } from "../../hooks/useOutside";
6
- import { DraggableOutlineDiv } from "../Dnd/DraggableOutlineDiv";
7
- import { GetModalFuncJSX } from "../Modal/Modal";
5
+ import { OutsideClickArea } from "../../hooks/useOutside";
6
+ import { OutlineDragDemo } from "../Dnd/OutlineDragDemo";
7
+ import { createModalRenderStore } from "../Modal/Modal";
8
8
  import { mapRightMenu } from "./RightMenuStore";
9
- export function DropdownMenu({ elements, style, position: initialPosition = 'right', position2: initialPos2 = 'top', keyForSave }) {
9
+ function cx(...parts) {
10
+ return parts.filter(Boolean).join(' ');
11
+ }
12
+ function renderTrigger(trigger, state) {
13
+ return typeof trigger == 'function' ? trigger(state) : trigger;
14
+ }
15
+ export function DropdownMenu({ elements, style, styles, classNames = {}, trigger = '☰', position: initialPosition = 'right', verticalPosition: initialVerticalPosition = 'top', keyForSave }) {
10
16
  const [initialState] = useState(() => {
11
17
  const fallback = {
12
18
  position: initialPosition,
13
- position2: initialPos2,
19
+ verticalPosition: initialVerticalPosition,
14
20
  offset: { x: 0, y: 0 }
15
21
  };
16
22
  if (!keyForSave)
@@ -26,10 +32,10 @@ export function DropdownMenu({ elements, style, position: initialPosition = 'rig
26
32
  const [select, setSelect] = useState(null);
27
33
  const data = useRef({ m1: false, m2: false });
28
34
  // Get modal JSX functions
29
- const jsx = useMemo(GetModalFuncJSX, []);
35
+ const jsx = useMemo(createModalRenderStore, []);
30
36
  const jsxRender = useMemo(() => _jsx(jsx.Render, {}), [jsx]);
31
37
  const [position, setPosition] = useState(initialState.position);
32
- const [isTop, setIsTop] = useState(initialState.position2 === 'top');
38
+ const [isTop, setIsTop] = useState(initialState.verticalPosition === 'top');
33
39
  const positionLast = useRef({ ...initialState.offset });
34
40
  const containerRef = useRef(null);
35
41
  const handleDragEnd = useCallback((finalPosition) => {
@@ -70,7 +76,7 @@ export function DropdownMenu({ elements, style, position: initialPosition = 'rig
70
76
  // mapRightMenu is observable: set() itself marks the cache dirty
71
77
  mapRightMenu.set(keyForSave, {
72
78
  position: nextPosition,
73
- position2: toTop ? 'top' : 'bottom',
79
+ verticalPosition: toTop ? 'top' : 'bottom',
74
80
  offset: { ...nextOffset }
75
81
  });
76
82
  }
@@ -111,16 +117,17 @@ export function DropdownMenu({ elements, style, position: initialPosition = 'rig
111
117
  }
112
118
  }, [jsx]);
113
119
  // Render dropdown menu (dop)
114
- const dop = (isFixed || isOpen) && (_jsxs("div", { onMouseEnter: handleContentMouseEnter, onMouseLeave: handleContentMouseLeave, className: `dropdown-content2 ${!isTop ? 'dropdown-up' : ''}`, style: {
120
+ const dop = (isFixed || isOpen) && (_jsxs("div", { onMouseEnter: handleContentMouseEnter, onMouseLeave: handleContentMouseLeave, className: cx(classNames.flyout ?? 'dropdown-content2', !isTop ? (classNames.flyoutUp ?? 'dropdown-up') : undefined), style: {
115
121
  display: 'flex',
116
122
  [position]: 0,
117
123
  right: position === 'left' ? 'auto' : 0,
118
- flexDirection: position === 'left' ? 'row' : 'row-reverse'
119
- }, children: [_jsx("div", { className: "dropdown-content", onMouseEnter: handleContentMouseEnter, onMouseLeave: handleContentMouseLeave, children: elements.map((item, index) => (_jsx("div", { className: `menu-item ${select === index ? 'force-hover' : ''}`, onMouseEnter: () => handleSelect(item, index), onClick: () => handleSelect(item, index), children: item.label }, item.label))) }), _jsx("div", { onMouseEnter: handleSubmenuMouseEnter, onMouseLeave: handleSubmenuMouseLeave, children: jsx.JSX ? (
124
+ flexDirection: position === 'left' ? 'row' : 'row-reverse',
125
+ ...styles?.flyout
126
+ }, children: [_jsx("div", { className: classNames.list ?? "dropdown-content", style: styles?.list, onMouseEnter: handleContentMouseEnter, onMouseLeave: handleContentMouseLeave, children: elements.map((item, index) => (_jsx("div", { className: cx(classNames.item ?? 'menu-item', select === index ? (classNames.itemActive ?? 'force-hover') : undefined), style: styles?.item, onMouseEnter: () => handleSelect(item, index), onClick: () => handleSelect(item, index), children: item.label }, item.label))) }), _jsx("div", { onMouseEnter: handleSubmenuMouseEnter, onMouseLeave: handleSubmenuMouseLeave, children: jsx.JSX ? (
120
127
  // clamp to the viewport: with hard 40vw/70vh the submenu ran
121
128
  // off screen when the menu sat near a bottom/side edge
122
- _jsx("div", { className: "submenu", style: { width: '40vw', minHeight: '70vh',
123
- maxWidth: '90vw', maxHeight: '85vh', overflowY: 'auto' }, children: jsxRender })) : null })] }));
129
+ _jsx("div", { className: classNames.submenu ?? "submenu", style: { width: '40vw', minHeight: '70vh',
130
+ maxWidth: '90vw', maxHeight: '85vh', overflowY: 'auto', ...styles?.submenu }, children: jsxRender })) : null })] }));
124
131
  // Calculate offsets
125
132
  const computedX = position === 'left'
126
133
  ? positionLast.current.x + pos.x
@@ -132,6 +139,7 @@ export function DropdownMenu({ elements, style, position: initialPosition = 'rig
132
139
  const containerStyle = useMemo(() => {
133
140
  const computedStyle = {
134
141
  ...style,
142
+ ...styles?.container,
135
143
  display: 'flex'
136
144
  };
137
145
  // Horizontal positioning
@@ -153,10 +161,10 @@ export function DropdownMenu({ elements, style, position: initialPosition = 'rig
153
161
  computedStyle.top = 'auto';
154
162
  }
155
163
  return computedStyle;
156
- }, [style, position, isTop, computedX, computedY]);
157
- return (_jsxs(DivOutsideClick, { ref: containerRef, outsideClick: handleClickOutside, className: `menu-container ${isFixed ? 'activeM' : ''}`, style: containerStyle, onMouseEnter: () => !isFixed && setIsOpen(true), onMouseLeave: () => !isFixed && setIsOpen(false), children: [_jsx("div", { ...dragProps, className: "menu-button", onClick: handleToggle, children: "\u2630" }), dop] }));
164
+ }, [style, styles?.container, position, isTop, computedX, computedY]);
165
+ return (_jsxs(OutsideClickArea, { ref: containerRef, outsideClick: handleClickOutside, className: cx(classNames.container ?? 'menu-container', isFixed ? (classNames.activeContainer ?? 'activeM') : undefined), style: containerStyle, onMouseEnter: () => !isFixed && setIsOpen(true), onMouseLeave: () => !isFixed && setIsOpen(false), children: [_jsx("div", { ...dragProps, className: classNames.trigger ?? "menu-button", style: styles?.trigger, onClick: handleToggle, children: renderTrigger(trigger, { isOpen, isFixed }) }), dop] }));
158
166
  }
159
- export function MenuRightApi() {
167
+ export function createRightMenuController() {
160
168
  const elements = [];
161
169
  let render = null;
162
170
  return {
@@ -190,20 +198,20 @@ export function MenuRightApi() {
190
198
  }
191
199
  };
192
200
  }
193
- export function DropdownMenuTest() {
201
+ export function RightMenuDemo() {
194
202
  const testData = [
195
203
  { label: "Item 1", subMenuContent: () => _jsx(SubMenu, {}) },
196
204
  { label: "Item 2", subMenuContent: () => _jsx(SubMenu2, {}) },
197
205
  { label: "Item 3", subMenuContent: () => _jsx(SubMenu, {}) }
198
206
  ];
199
- const menu = useMemo(MenuRightApi, []);
207
+ const menu = useMemo(createRightMenuController, []);
200
208
  useEffect(() => {
201
209
  menu.set(testData);
202
210
  }, []);
203
211
  return _jsx(menu.Render, {});
204
212
  }
205
213
  const SubMenu = () => {
206
- return (_jsxs("div", { className: "maxSize", children: [_jsx(DraggableOutlineDiv, {}), _jsx("div", { className: "submenu-item", children: "Subitem 1" }), _jsx("div", { className: "submenu-item", children: "Subitem 2" }), _jsx("div", { className: "submenu-item", children: "Subitem 3" })] }));
214
+ return (_jsxs("div", { className: "maxSize", children: [_jsx(OutlineDragDemo, {}), _jsx("div", { className: "submenu-item", children: "Subitem 1" }), _jsx("div", { className: "submenu-item", children: "Subitem 2" }), _jsx("div", { className: "submenu-item", children: "Subitem 3" })] }));
207
215
  };
208
216
  const SubMenu2 = () => {
209
217
  return (_jsxs("div", { children: [_jsx("div", { className: "submenu-item", children: "Subitem 33331" }), _jsx("div", { className: "submenu-item", children: "Subitem 33332" }), _jsx("div", { className: "submenu-item", children: "Subitem 33333" })] }));
@@ -1,8 +1,8 @@
1
1
  export type MenuRightPosition = 'left' | 'right';
2
- export type MenuRightPosition2 = 'top' | 'bottom';
2
+ export type MenuRightVerticalPosition = 'top' | 'bottom';
3
3
  export type MenuRightSavedState = {
4
4
  position: MenuRightPosition;
5
- position2: MenuRightPosition2;
5
+ verticalPosition: MenuRightVerticalPosition;
6
6
  offset: {
7
7
  x: number;
8
8
  y: number;
@@ -1,3 +1,3 @@
1
1
  import { ObservableMap } from "../../utils/observableMap";
2
- // observable - Cash marks itself dirty on its mutations (drag end re-set()s the state)
2
+ // observable - memoryCache marks itself dirty on its mutations (drag end re-set()s the state)
3
3
  export const mapRightMenu = new ObservableMap();
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useEffect, useMemo, useRef, useState } from "react";
3
3
  import { colorGenerator2, sleepAsync } from "wenay-common2";
4
4
  import { renderBy, updateBy } from "../../../updateBy";
5
- import { GetModalJSX } from "./Modal";
6
- import { Drag22 } from "../Dnd/RNDFunc3";
5
+ import { createModalElementStore } from "./Modal";
6
+ import { DragBox } from "../Dnd/FloatingWindow";
7
7
  function useViewport() {
8
8
  const [width, setWidth] = useState(window.innerWidth);
9
9
  useEffect(() => {
@@ -172,7 +172,7 @@ export function LeftModal({ arr, zIndex }) {
172
172
  const sidebarComponent = useMemo(() => (_jsx(SidebarMenuComponent, { arr: arr, zIndex: zIndex, api: (apiInstance) => {
173
173
  menuApiRef.current = apiInstance;
174
174
  }, x_: currentPos.current.x, y_: currentPos.current.y })), [arr, zIndex]);
175
- const draggableWrapper = useMemo(() => (_jsx(Drag22, { onX: (xNew) => menuApiRef.current?.x(xNew), right: true, onY: (yNew) => menuApiRef.current?.y(yNew), x: 0, y: 0, onStart: () => menuApiRef.current?.start?.(), onStop: () => menuApiRef.current?.stop?.(), children: sidebarComponent })), [sidebarComponent]);
175
+ const draggableWrapper = useMemo(() => (_jsx(DragBox, { onX: (xNew) => menuApiRef.current?.x(xNew), right: true, onY: (yNew) => menuApiRef.current?.y(yNew), x: 0, y: 0, onStart: () => menuApiRef.current?.start?.(), onStop: () => menuApiRef.current?.stop?.(), children: sidebarComponent })), [sidebarComponent]);
176
176
  return _jsx("div", { className: "maxSize", children: draggableWrapper });
177
177
  }
178
178
  function LeftMenuComponent({ api, menu = [], zIndex }) {
@@ -247,7 +247,7 @@ export function getApiLeftMenu() {
247
247
  updateBy(menuStore);
248
248
  return (_jsxs("div", { className: "maxSize", style: { position: "absolute", zIndex: zIndex0 }, children: [_jsx(modal.Render, {}), _jsx(LeftMenuComponent, { zIndex: zIndex, api: () => { }, menu: getAllMenuItems() })] }));
249
249
  }
250
- const modal = GetModalJSX();
250
+ const modal = createModalElementStore();
251
251
  return {
252
252
  modal,
253
253
  renderBy() { renderBy(menuStore); },
@@ -1,26 +1,23 @@
1
1
  import React from "react";
2
2
  import type { ModalApi } from "./ModalContextProvider";
3
- type LegacyModalSetter = (jsx: React.ReactNode | null) => void;
4
- type ModalTarget = LegacyModalSetter | ModalApi;
5
- export declare function inputModal({ setModalJSX, func, name, txt }: {
3
+ type ModalSetter = (jsx: React.ReactNode | null) => void;
4
+ type ModalTarget = ModalSetter | ModalApi;
5
+ export declare function inputModal({ modal, func, name, txt }: {
6
6
  txt?: string;
7
7
  name?: string;
8
8
  /** Any modal setter: setState/useModal or ModalApi from useModal */
9
- setModalJSX: ModalTarget;
9
+ modal: ModalTarget;
10
10
  func: (txt: string) => void;
11
11
  }): void;
12
- export declare function confirmModal({ setModalJSX, func, password }: {
12
+ export declare function confirmModal({ modal, func, password }: {
13
13
  /** Any modal setter: setState/useModal or ModalApi from useModal */
14
- setModalJSX: ModalTarget;
14
+ modal: ModalTarget;
15
15
  func: () => any;
16
- /** Confirmation code word. Default "111" is kept for compatibility; pass your own. */
16
+ /** Confirmation code word. Default is "111"; pass your own for app flows. */
17
17
  password?: string;
18
18
  }): void;
19
- /**
20
- * @deprecated Imperative JSX storage based on updateBy/renderBy.
21
- * Use `ModalProvider`/`useModal` (ModalContextProvider): context plus portal.
22
- */
23
- export declare function GetModalJSX(): {
19
+ /** Low-level imperative JSX storage based on updateBy/renderBy. Prefer `ModalProvider`/`useModal` for app modals. */
20
+ export declare function createModalElementStore(): {
24
21
  set(jsx: React.JSX.Element | null): void;
25
22
  JSX: React.JSX.Element | null;
26
23
  Render(): React.JSX.Element | null;
@@ -29,11 +26,8 @@ export declare function GetModalJSX(): {
29
26
  readonly arrJSX: (import("react/jsx-runtime").JSX.Element | null)[];
30
27
  RenderArr(): (import("react/jsx-runtime").JSX.Element | null)[];
31
28
  };
32
- /**
33
- * @deprecated Imperative JSX storage based on updateBy/renderBy.
34
- * Use `ModalProvider`/`useModal` (ModalContextProvider): context plus portal.
35
- */
36
- export declare function GetModalFuncJSX(): {
29
+ /** Low-level imperative JSX storage based on updateBy/renderBy. Prefer `ModalProvider`/`useModal` for app modals. */
30
+ export declare function createModalRenderStore(): {
37
31
  set(jsx: (() => React.JSX.Element | null) | null): void;
38
32
  JSX: (() => React.JSX.Element | null) | null;
39
33
  Render(): React.JSX.Element | null;
@@ -1,28 +1,28 @@
1
1
  import { jsx as _jsx_1 } from "react/jsx-runtime";
2
2
  import { renderBy, updateBy } from "../../../updateBy";
3
- import { InputPageModal } from "../Input";
3
+ import { TextInputModal } from "../Input";
4
4
  function setModalTarget(target, jsx) {
5
5
  if (typeof target == "function")
6
6
  target(jsx);
7
7
  else
8
8
  target.replace(jsx);
9
9
  }
10
- export function inputModal({ setModalJSX, func, name, txt }) {
11
- setModalTarget(setModalJSX, _jsx_1(InputPageModal, { callback: txt => {
10
+ export function inputModal({ modal, func, name, txt }) {
11
+ setModalTarget(modal, _jsx_1(TextInputModal, { callback: txt => {
12
12
  func(txt);
13
- setModalTarget(setModalJSX, null);
14
- }, outClick: () => setModalTarget(setModalJSX, null), name: name ?? "name", txt: txt }));
13
+ setModalTarget(modal, null);
14
+ }, outClick: () => setModalTarget(modal, null), name: name ?? "name", txt: txt }));
15
15
  }
16
- export function confirmModal({ setModalJSX, func, password = "111" }) {
17
- // Do not expose custom passwords in the hint; show the legacy default as before.
16
+ export function confirmModal({ modal, func, password = "111" }) {
17
+ // Do not expose custom passwords in the hint; show only the default hint.
18
18
  const hint = password == "111" ? "password 111" : "password";
19
- setModalTarget(setModalJSX, _jsx_1(InputPageModal, { callback: txt => {
19
+ setModalTarget(modal, _jsx_1(TextInputModal, { callback: txt => {
20
20
  if (txt == password)
21
21
  func();
22
- setModalTarget(setModalJSX, null);
23
- }, outClick: () => setModalTarget(setModalJSX, null), name: hint }));
22
+ setModalTarget(modal, null);
23
+ }, outClick: () => setModalTarget(modal, null), name: hint }));
24
24
  }
25
- // Shared store for GetModalJSX/GetModalFuncJSX: identical logic, the only
25
+ // Shared store for createModalElementStore/createModalRenderStore: identical logic, the only
26
26
  // difference is how a stored value turns into an element (renderItem)
27
27
  function createJsxStore(renderItem) {
28
28
  let _jsx = null;
@@ -65,17 +65,11 @@ function createJsxStore(renderItem) {
65
65
  };
66
66
  return data;
67
67
  }
68
- /**
69
- * @deprecated Imperative JSX storage based on updateBy/renderBy.
70
- * Use `ModalProvider`/`useModal` (ModalContextProvider): context plus portal.
71
- */
72
- export function GetModalJSX() {
68
+ /** Low-level imperative JSX storage based on updateBy/renderBy. Prefer `ModalProvider`/`useModal` for app modals. */
69
+ export function createModalElementStore() {
73
70
  return createJsxStore(jsx => jsx);
74
71
  }
75
- /**
76
- * @deprecated Imperative JSX storage based on updateBy/renderBy.
77
- * Use `ModalProvider`/`useModal` (ModalContextProvider): context plus portal.
78
- */
79
- export function GetModalFuncJSX() {
72
+ /** Low-level imperative JSX storage based on updateBy/renderBy. Prefer `ModalProvider`/`useModal` for app modals. */
73
+ export function createModalRenderStore() {
80
74
  return createJsxStore(f => f());
81
75
  }
@@ -9,14 +9,8 @@ export type ModalApi = {
9
9
  export type ModalController = ((jsx: ReactNode | null) => void) & ModalApi;
10
10
  export type ModalProviderProps = {
11
11
  children: ReactNode;
12
- /** Close on click outside the modal. Defaults to true for legacy behavior. */
13
12
  closeOnOutsideClick?: boolean;
14
- /** Close on Escape. Defaults to true. */
15
13
  closeOnEscape?: boolean;
16
14
  };
17
15
  export declare const ModalProvider: ({ children, closeOnOutsideClick, closeOnEscape }: ModalProviderProps) => import("react/jsx-runtime").JSX.Element;
18
16
  export declare const useModal: () => ModalController;
19
- /** @deprecated Use `useModal()`; it is callable and also has show/open/close/set methods. */
20
- export declare const useModalOld: () => ModalController;
21
- /** @deprecated Use `useModal()` directly. */
22
- export declare function useModalApi(): ModalApi;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createContext, useContext, useEffect, useMemo, useState } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
- import { DivOutsideClick } from "../../hooks/useOutside";
4
+ import { OutsideClickArea } from "../../hooks/useOutside";
5
5
  import { tokens } from "../../styles/tokens";
6
6
  const noopModal = Object.assign(() => { }, { show() { }, open() { }, close() { }, replace() { }, set() { } });
7
7
  const ModalContext = createContext(noopModal);
@@ -30,14 +30,7 @@ export const ModalProvider = ({ children, closeOnOutsideClick = true, closeOnEsc
30
30
  position: 'fixed', inset: 0, zIndex: tokens.zIndex.modal,
31
31
  display: 'flex', alignItems: 'center', justifyContent: 'center',
32
32
  backgroundColor: 'rgba(0,0,0,0.5)'
33
- }, children: _jsx(DivOutsideClick, { outsideClick: () => { if (closeOnOutsideClick)
33
+ }, children: _jsx(OutsideClickArea, { outsideClick: () => { if (closeOnOutsideClick)
34
34
  setModal(null); }, status: true, children: modal }) }), document.body)] }));
35
35
  };
36
- // Callable for legacy code, controller-style for new code.
37
36
  export const useModal = () => useContext(ModalContext);
38
- /** @deprecated Use `useModal()`; it is callable and also has show/open/close/set methods. */
39
- export const useModalOld = () => useContext(ModalContext);
40
- /** @deprecated Use `useModal()` directly. */
41
- export function useModalApi() {
42
- return useContext(ModalContext);
43
- }
@@ -1,9 +1,9 @@
1
1
  import { Params } from "wenay-common2";
2
- export declare function EditParams2<TParams extends Params.IParamsExpandableReadonly = Params.IParamsExpandableReadonly>({ onSave, params: paramsDef }: {
2
+ export declare function ParamsEdit<TParams extends Params.IParamsExpandableReadonly = Params.IParamsExpandableReadonly>({ onSave, params: paramsDef }: {
3
3
  params: () => Promise<TParams>;
4
4
  onSave?: (params: TParams) => any;
5
5
  }): import("react/jsx-runtime").JSX.Element;
6
- export declare function EditParams3<TParams extends Params.IParamsExpandableReadonly = Params.IParamsExpandableReadonly>({ onSave, params: paramsDef }: {
6
+ export declare function ParamsArrayEdit<TParams extends Params.IParamsExpandableReadonly = Params.IParamsExpandableReadonly>({ onSave, params: paramsDef }: {
7
7
  params: () => Promise<TParams[]>;
8
8
  onSave?: (params: TParams[]) => any;
9
9
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "react";
3
- import { ParametersReact } from "./ParametersEngine";
4
- export function EditParams2({ onSave, params: paramsDef }) {
3
+ import { ParamsEditor } from "./ParamsEditor";
4
+ export function ParamsEdit({ onSave, params: paramsDef }) {
5
5
  useEffect(() => {
6
6
  paramsDef().then(e => {
7
7
  setParamsD(e);
@@ -9,20 +9,20 @@ export function EditParams2({ onSave, params: paramsDef }) {
9
9
  }, []);
10
10
  const [paramsD, setParamsD] = useState(null);
11
11
  const params = useRef(null);
12
- return _jsxs("div", { className: "maxSize", children: [paramsD && _jsx(ParametersReact, { params: paramsD, onChange: e => params.current = e }), onSave && _jsx("div", { className: "msTradeActive msTradeAlt", onClick: async () => {
12
+ return _jsxs("div", { className: "maxSize", children: [paramsD && _jsx(ParamsEditor, { params: paramsD, onChange: e => params.current = e }), onSave && _jsx("div", { className: "msTradeActive msTradeAlt", onClick: async () => {
13
13
  const t = params.current || paramsD;
14
14
  if (t)
15
15
  onSave(t);
16
16
  }, children: "save" })] });
17
17
  }
18
- export function EditParams3({ onSave, params: paramsDef }) {
18
+ export function ParamsArrayEdit({ onSave, params: paramsDef }) {
19
19
  useEffect(() => {
20
20
  paramsDef().then(e => {
21
21
  setParams(e);
22
22
  });
23
23
  }, []);
24
24
  const [params, setParams] = useState(null);
25
- return _jsxs("div", { className: "maxSize", children: [params && params.map((z, i) => _jsx(ParametersReact, { params: z, onChange: e => {
25
+ return _jsxs("div", { className: "maxSize", children: [params && params.map((z, i) => _jsx(ParamsEditor, { params: z, onChange: e => {
26
26
  params[i] = e;
27
27
  setParams(params);
28
28
  } }, i)), onSave && _jsx("div", { className: "msTradeActive msTradeAlt", onClick: async () => {
@@ -1,7 +1,7 @@
1
1
  import React, { ReactElement } from "react";
2
- export declare function FButton(name: string | ReactElement): import("react/jsx-runtime").JSX.Element;
3
- export declare function FNameButton(type: boolean, name: string | ReactElement): import("react/jsx-runtime").JSX.Element;
4
- export declare function CParameter(props: {
2
+ export declare function ParamLabelContent(name: string | ReactElement): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ParamToggleLabel(type: boolean, name: string | ReactElement): import("react/jsx-runtime").JSX.Element;
4
+ export declare function ParamRow(props: {
5
5
  name: ReactElement | string;
6
6
  children?: React.ReactNode | readonly React.ReactNode[];
7
7
  style?: React.CSSProperties | undefined;
@@ -1,12 +1,12 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from "react";
3
3
  // Button view
4
- export function FButton(name) {
4
+ export function ParamLabelContent(name) {
5
5
  return _jsxs("div", { className: "", style: { width: "100%" }, children: [" ", name] });
6
6
  }
7
7
  // Arrow for the button
8
- export function FNameButton(type, name) { return FButton(_jsx("p", { className: "toPTextIndicator", children: (type ? "▼ " : "▶ ") + name })); }
9
- export function CParameter(props) {
8
+ export function ParamToggleLabel(type, name) { return ParamLabelContent(_jsx("p", { className: "toPTextIndicator", children: (type ? "▼ " : "▶ ") + name })); }
9
+ export function ParamRow(props) {
10
10
  const [hovered, setHovered] = React.useState(false); // Tracks mouse hover state
11
11
  return (_jsxs("div", { className: "toLine LeftMenuParameters toIndicatorMenuButton", style: { position: "relative" }, children: [_jsx("div", { className: "toLine", style: { width: "auto", ...props.style }, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: props.name }), _jsx("div", { className: "toLine toRight", style: props.enabled === false ? { opacity: 0.5 } : {}, children: props.children }), hovered && props.commentary && props.commentary.length > 0 && (_jsx("div", { className: "commentary", style: {
12
12
  marginTop: "5px",
@@ -1,5 +1,5 @@
1
1
  import { Params } from "wenay-common2";
2
- export declare function ParametersReact<TParams extends Params.IParamsExpandableReadonly = Params.IParamsExpandableReadonly>(data: {
2
+ export declare function ParamsEditor<TParams extends Params.IParamsExpandableReadonly = Params.IParamsExpandableReadonly>(data: {
3
3
  params: TParams;
4
4
  expandStatus?: boolean;
5
5
  expandStatusLvl?: number;
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useEffect, useMemo, useRef, useState } from "react";
3
3
  import { deepCloneMutable, isDate, TF, timeLocalToStr_yyyymmdd, timeLocalToStr_yyyymmdd_hhmm, timeLocalToStr_yyyymmdd_hhmmss, timeLocalToStr_yyyymmdd_hhmmss_ms } from "wenay-common2";
4
4
  import { setResizeableElement, removeResizeableElement } from "./MyResizeObserver";
5
- import { CParameter, FNameButton } from "./Parameters";
6
- import { SetAutoStepForElement } from "../utils";
5
+ import { ParamRow, ParamToggleLabel } from "./Parameters";
6
+ import { setAutoStepForElement } from "../utils";
7
7
  function timeToStr(time, step) {
8
8
  function getTimeStep(time) {
9
9
  return [TF.D1.msec, TF.M1.msec, TF.S1.msec, 1].find(period => time % period == 0);
@@ -137,7 +137,7 @@ function InputNumber(set, value, range) {
137
137
  if (ref) {
138
138
  _ref = ref;
139
139
  ref.step = step + "";
140
- SetAutoStepForElement(ref, { minStep: range.step });
140
+ setAutoStepForElement(ref, { minStep: range.step });
141
141
  }
142
142
  } })] });
143
143
  }
@@ -163,17 +163,17 @@ function InputListArray(set, values, range, rangeLabels) {
163
163
  return _jsx("option", { value: String(a), label: rangeLabels?.at(i) ?? String(a), children: a }, String(a));
164
164
  }) });
165
165
  }
166
- export function ParametersReact(data) {
166
+ export function ParamsEditor(data) {
167
167
  // callbacks live in a ref: useMemo below intentionally freezes the element until
168
168
  // params identity changes, and would otherwise freeze a stale onChange/onExpand with it
169
169
  const callbacks = useRef({ onChange: data.onChange, onExpand: data.onExpand });
170
170
  callbacks.current = { onChange: data.onChange, onExpand: data.onExpand };
171
171
  const result = useMemo(() => {
172
- return _jsx(ParametersBaseReact, { params: data.params, onChange: (p) => callbacks.current.onChange(p), onExpand: (p) => callbacks.current.onExpand?.(p), expandStatus: data.expandStatus, expandStatusLvl: data.expandStatusLvl });
172
+ return _jsx(ParamsEditorBase, { params: data.params, onChange: (p) => callbacks.current.onChange(p), onExpand: (p) => callbacks.current.onExpand?.(p), expandStatus: data.expandStatus, expandStatusLvl: data.expandStatusLvl });
173
173
  }, [data.params]);
174
174
  return result;
175
175
  }
176
- function ParametersBaseReact(data) {
176
+ function ParamsEditorBase(data) {
177
177
  const [_, setUpdate] = useState(0);
178
178
  function Refresh() { setUpdate(e => ++e); }
179
179
  const styleColorDisable = "rgb(146,146,146)";
@@ -232,7 +232,7 @@ function ParametersBaseReact(data) {
232
232
  obj[key] = data; // this branch only renders boolean/string params
233
233
  onSetValue(data);
234
234
  };
235
- return _jsx(CParameter, { name: key, enabled: parentEnabled, children: Param(set, param) }, key + "#" + typeof (param));
235
+ return _jsx(ParamRow, { name: key, enabled: parentEnabled, children: Param(set, param) }, key + "#" + typeof (param));
236
236
  }
237
237
  if (typeof (param) == "function") {
238
238
  return null;
@@ -241,7 +241,7 @@ function ParametersBaseReact(data) {
241
241
  if (param.hidden)
242
242
  return null;
243
243
  const { value, range, name = key, enabled } = param;
244
- const nameButton = (type) => FNameButton(type, name);
244
+ const nameButton = (type) => ParamToggleLabel(type, name);
245
245
  const nameT = _jsx("p", { className: "toPTextIndicator", children: name });
246
246
  const set = (a) => {
247
247
  const aa = param.value instanceof Date ? new Date(a) : a;
@@ -256,7 +256,7 @@ function ParametersBaseReact(data) {
256
256
  const simpleParameter = (element) => {
257
257
  if (!element)
258
258
  return null;
259
- return _jsxs(CParameter, { name: nameT, enabled: parentEnabled && enabled != false, commentary: param.commentary, children: [element, enabled != null ?
259
+ return _jsxs(ParamRow, { name: nameT, enabled: parentEnabled && enabled != false, commentary: param.commentary, children: [element, enabled != null ?
260
260
  CheckBox((flag) => {
261
261
  param.enabled = flag;
262
262
  onSetValue(flag);
@@ -320,7 +320,7 @@ function ParametersBaseReact(data) {
320
320
  array.splice(index, 1, data);
321
321
  set(array);
322
322
  }
323
- const paramL = (hover) => _jsxs(CParameter, { name: _jsxs(_Fragment, { children: [hover && !param.constLength && onHoverElement, nameElement] }), commentary: param.commentary, children: [Param(onSet, itemVal, type, range, param.labels), param.elementsEnabled != null ?
323
+ const paramL = (hover) => _jsxs(ParamRow, { name: _jsxs(_Fragment, { children: [hover && !param.constLength && onHoverElement, nameElement] }), commentary: param.commentary, children: [Param(onSet, itemVal, type, range, param.labels), param.elementsEnabled != null ?
324
324
  CheckBox((flag) => {
325
325
  if (!Array.isArray(param.elementsEnabled))
326
326
  param.elementsEnabled = new Array(array.length).fill(param.elementsEnabled == true);
@@ -1,20 +1,20 @@
1
1
  import React from "react";
2
- export type tSettingsSection = {
2
+ export type SettingsSection = {
3
3
  key: string;
4
4
  name: string;
5
5
  render: () => React.ReactNode;
6
6
  };
7
7
  /** Register an external section. Re-register with the same key replaces the previous one.
8
8
  * The returned function removes exactly this registration (a no-op if it was replaced). */
9
- export declare function registerSettingsSection(s: tSettingsSection): () => void;
9
+ export declare function registerSettingsSection(s: SettingsSection): () => void;
10
10
  /** Current external sections (static props sections are not included). */
11
- export declare function getSettingsSections(): readonly tSettingsSection[];
11
+ export declare function getSettingsSections(): readonly SettingsSection[];
12
12
  /** Centered settings dialog: sections column on the left, active section content on the right.
13
13
  * Sections = props.sections (first) + everything from registerSettingsSection.
14
14
  * Look is themed via --dlg-* CSS variables (dark defaults), same contract as --wnd-*. */
15
15
  export declare function SettingsDialog(props: {
16
16
  trigger: React.ReactNode;
17
- sections?: tSettingsSection[];
17
+ sections?: SettingsSection[];
18
18
  defaultSection?: string;
19
19
  /** Section buttons: apps pass their own .chip / .chipActive; defaults are minimal library styles */
20
20
  sectionClassName?: string;