wenay-react2 1.0.37 → 1.0.39

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 (34) hide show
  1. package/README.md +2 -0
  2. package/lib/common/src/components/Input.d.ts +25 -6
  3. package/lib/common/src/components/Input.js +27 -8
  4. package/lib/common/src/components/Modal/ModalContextProvider.js +1 -1
  5. package/lib/common/src/components/Settings/SettingsDialog.d.ts +12 -2
  6. package/lib/common/src/components/Settings/SettingsDialog.js +412 -16
  7. package/lib/common/src/components/Toolbar/Toolbar.d.ts +21 -2
  8. package/lib/common/src/components/Toolbar/Toolbar.js +84 -14
  9. package/lib/common/src/grid/columnState/CardList.js +5 -2
  10. package/lib/common/src/grid/columnState/ColumnDots.d.ts +1 -1
  11. package/lib/common/src/grid/columnState/ColumnDots.js +9 -19
  12. package/lib/common/src/grid/columnState/ColumnsMenu.js +10 -18
  13. package/lib/common/src/grid/columnState/columnState.d.ts +4 -0
  14. package/lib/common/src/grid/columnState/columnState.js +39 -14
  15. package/lib/common/src/hooks/useReplay.d.ts +54 -0
  16. package/lib/common/src/hooks/useReplay.js +222 -0
  17. package/lib/common/src/logs/logStyles.d.ts +13 -0
  18. package/lib/common/src/logs/logStyles.js +18 -0
  19. package/lib/common/src/logs/logs.js +5 -7
  20. package/lib/common/src/logs/logsContext.js +22 -26
  21. package/lib/common/src/menu/menu.d.ts +2 -1
  22. package/lib/common/src/menu/menu.js +28 -21
  23. package/lib/common/src/menu/menuMouse.d.ts +17 -0
  24. package/lib/common/src/menu/menuMouse.js +70 -3
  25. package/lib/common/src/styles/tokens.d.ts +92 -1
  26. package/lib/common/src/styles/tokens.js +92 -1
  27. package/lib/common/src/utils/index.d.ts +1 -0
  28. package/lib/common/src/utils/index.js +1 -0
  29. package/lib/common/src/utils/searchHistory.d.ts +14 -0
  30. package/lib/common/src/utils/searchHistory.js +59 -0
  31. package/lib/style/menuRight.css +2 -2
  32. package/lib/style/style.css +634 -53
  33. package/lib/style/tokens.css +90 -4
  34. package/package.json +2 -2
@@ -32,6 +32,17 @@ export function createContextMenu(data) {
32
32
  const map = new Map();
33
33
  const state = { open: false, items: [], point: { x: 0, y: 0 }, seq: 0 };
34
34
  const listeners = new Set();
35
+ const statsListeners = new Set();
36
+ const statsState = {
37
+ openAt: 0,
38
+ openAtPoint: 0,
39
+ legacyLayer: 0,
40
+ close: 0,
41
+ replace: 0,
42
+ empty: 0,
43
+ sources: {},
44
+ layers: {},
45
+ };
35
46
  const layers = new Set();
36
47
  let layerSeq = 0;
37
48
  function emit() {
@@ -43,6 +54,50 @@ export function createContextMenu(data) {
43
54
  listeners.add(cb);
44
55
  return () => { listeners.delete(cb); };
45
56
  }
57
+ function statsSnapshot() {
58
+ return {
59
+ openAt: statsState.openAt,
60
+ openAtPoint: statsState.openAtPoint,
61
+ legacyLayer: statsState.legacyLayer,
62
+ close: statsState.close,
63
+ replace: statsState.replace,
64
+ empty: statsState.empty,
65
+ sources: { ...statsState.sources },
66
+ layers: { ...statsState.layers },
67
+ };
68
+ }
69
+ function emitStats() {
70
+ const snapshot = statsSnapshot();
71
+ for (const cb of [...statsListeners])
72
+ cb(snapshot);
73
+ }
74
+ function bumpStat(key) {
75
+ statsState[key] += 1;
76
+ emitStats();
77
+ }
78
+ function bumpMapStat(map, key) {
79
+ if (!key)
80
+ return;
81
+ map[key] = (map[key] ?? 0) + 1;
82
+ }
83
+ const stats = {
84
+ getSnapshot: statsSnapshot,
85
+ reset() {
86
+ statsState.openAt = 0;
87
+ statsState.openAtPoint = 0;
88
+ statsState.legacyLayer = 0;
89
+ statsState.close = 0;
90
+ statsState.replace = 0;
91
+ statsState.empty = 0;
92
+ statsState.sources = {};
93
+ statsState.layers = {};
94
+ emitStats();
95
+ },
96
+ onChange(cb) {
97
+ statsListeners.add(cb);
98
+ return () => { statsListeners.delete(cb); };
99
+ },
100
+ };
46
101
  function legacyItems() {
47
102
  if (map.has("only"))
48
103
  return normalizeItems(map.get("only"));
@@ -56,28 +111,39 @@ export function createContextMenu(data) {
56
111
  function close() {
57
112
  if (!state.open && state.items.length == 0)
58
113
  return;
114
+ bumpStat("close");
59
115
  state.open = false;
60
116
  state.items = [];
61
117
  state.layerId = undefined;
62
118
  emit();
63
119
  }
64
- function openAt(anchor, items, opts = {}) {
120
+ function openMenu(anchor, items, opts = {}, kind) {
65
121
  preventNative(anchor);
66
122
  const nextItems = normalizeItems(items);
67
123
  if (nextItems.length == 0) {
124
+ bumpStat("empty");
68
125
  close();
69
126
  return false;
70
127
  }
128
+ if (state.open)
129
+ bumpStat("replace");
130
+ bumpStat(kind);
71
131
  state.open = true;
72
132
  state.items = nextItems;
73
133
  state.point = anchorPoint(anchor);
74
134
  state.source = opts.source;
75
135
  state.layerId = opts.layerId ?? anchorLayerId(anchor) ?? [...layers][0];
136
+ bumpMapStat(statsState.sources, state.source);
137
+ bumpMapStat(statsState.layers, state.layerId);
138
+ emitStats();
76
139
  emit();
77
140
  return true;
78
141
  }
142
+ function openAt(anchor, items, opts = {}) {
143
+ return openMenu(anchor, items, opts, "openAt");
144
+ }
79
145
  function openAtPoint(point, items, opts = {}) {
80
- return openAt(point, items, opts);
146
+ return openMenu(point, items, opts, "openAtPoint");
81
147
  }
82
148
  function getState() {
83
149
  return {
@@ -123,7 +189,7 @@ export function createContextMenu(data) {
123
189
  return other ? normalizeItems(other()) : legacyItems();
124
190
  }
125
191
  function openQueued(anchor) {
126
- const opened = openAt(anchor, queuedItems(), { source: "layer", layerId });
192
+ const opened = openMenu(anchor, queuedItems(), { source: "layer", layerId }, "legacyLayer");
127
193
  if (opened) {
128
194
  map.clear();
129
195
  onConsume?.();
@@ -194,6 +260,7 @@ export function createContextMenu(data) {
194
260
  openAt,
195
261
  openAtPoint,
196
262
  close,
263
+ stats,
197
264
  Layer,
198
265
  MenuView: Menu,
199
266
  };
@@ -17,6 +17,7 @@ export declare const tokens: {
17
17
  readonly itemColor: "#fff";
18
18
  readonly itemHoverColor: "#101010";
19
19
  readonly itemHoverBgColor: "#fff";
20
+ readonly outlineColor: "#007bff";
20
21
  readonly shadow: "0 0 20px 14px rgba(34, 60, 80, 0.2)";
21
22
  };
22
23
  /** FloatingWindow window chrome (--wnd-*). Defaults = legacy look; apps re-skin via :root[data-theme].
@@ -55,7 +56,7 @@ export declare const tokens: {
55
56
  readonly shadow: "0 12px 40px rgba(0, 0, 0, 0.5)";
56
57
  /** var(--color-bg-light) in CSS */
57
58
  readonly navBg: "#17202e";
58
- readonly navWidth: "168px";
59
+ readonly navWidth: "220px";
59
60
  };
60
61
  /** Toolbar (createToolbar) chrome (--tb-*). Dark defaults; apps re-skin via :root[data-theme]. */
61
62
  readonly tb: {
@@ -74,6 +75,96 @@ export declare const tokens: {
74
75
  readonly popRadius: "8px";
75
76
  readonly popShadow: "0 8px 28px rgba(0, 0, 0, 0.5)";
76
77
  };
78
+ /** Column-state compact menu (ColumnsMenu/MenuStrip) chrome (--cols-menu-*). */
79
+ readonly colsMenu: {
80
+ readonly gap: "6px";
81
+ readonly btnGap: "4px";
82
+ readonly btnPadding: "3px 9px";
83
+ readonly btnRadius: "6px";
84
+ readonly btnFontSize: "12px";
85
+ readonly btnLineHeight: "16px";
86
+ readonly onBorder: "1px solid #24292f";
87
+ readonly onBg: "#24292f";
88
+ readonly onColor: "#fff";
89
+ readonly offBorder: "1px solid #d0d7de";
90
+ readonly offBg: "#fff";
91
+ readonly offColor: "#8c959f";
92
+ readonly disabledBorder: "1px dashed #d0d7de";
93
+ readonly disabledBg: "#f6f8fa";
94
+ readonly disabledColor: "#c4ccd4";
95
+ readonly fixedShadow: "0 0 0 2px #eaeef2";
96
+ readonly dragShadow: "0 3px 10px rgba(0, 0, 0, 0.35)";
97
+ readonly divider: "#d0d7de";
98
+ readonly abbrFontSize: "10px";
99
+ readonly abbrFontWeight: 700;
100
+ readonly abbrLetterSpacing: "0.5px";
101
+ readonly marksFontSize: "9px";
102
+ readonly marksOpacity: 0.9;
103
+ };
104
+ /** ColumnDots chrome (--cols-dots-*). Defaults preserve restored card-29 look. */
105
+ readonly colsDots: {
106
+ readonly text: "#24292f";
107
+ readonly headGap: "10px";
108
+ readonly headMarginBottom: "6px";
109
+ readonly headFontSize: "12px";
110
+ readonly metaColor: "#57606a";
111
+ readonly sortBorder: "1px solid #6e7781";
112
+ readonly sortRadius: "6px";
113
+ readonly sortPadding: "2px 8px";
114
+ readonly sortFontSize: "12px";
115
+ readonly sortBg: "#fff";
116
+ readonly trackHeight: "56px";
117
+ readonly trackMargin: "0 14px";
118
+ readonly rail: "#d0d7de";
119
+ readonly markWidth: "44px";
120
+ readonly markHeight: "56px";
121
+ readonly markMarginLeft: "-22px";
122
+ readonly sortMarkColor: "#0969da";
123
+ readonly sortMarkFontSize: "11px";
124
+ readonly pin: "#afb8c1";
125
+ readonly labelColor: "#8c959f";
126
+ readonly labelActiveColor: "#24292f";
127
+ readonly labelFontSize: "10px";
128
+ readonly dotSize: "18px";
129
+ readonly dotRadius: "9px";
130
+ readonly dotBg: "#24292f";
131
+ readonly dotShadow: "0 3px 10px rgba(0, 0, 0, 0.35)";
132
+ readonly selectedBg: "#0969da";
133
+ readonly selectedBorder: "#b6d4fe";
134
+ readonly fixedBorder: "#afb8c1";
135
+ };
136
+ /** CardList chrome (--cols-card-*). Defaults preserve restored card-29 look. */
137
+ readonly colsCard: {
138
+ readonly gap: "8px";
139
+ readonly border: "1px solid #d0d7de";
140
+ readonly radius: "8px";
141
+ readonly padding: "8px 10px";
142
+ readonly bg: "#fff";
143
+ readonly headerGap: "8px";
144
+ readonly headerMarginBottom: "6px";
145
+ readonly titleFontSize: "14px";
146
+ readonly accentFontSize: "11px";
147
+ readonly accentPadding: "1px 8px";
148
+ readonly accentRadius: "10px";
149
+ readonly accentBg: "#ddf4ff";
150
+ readonly accentColor: "#0969da";
151
+ readonly fieldGap: "10px";
152
+ readonly fieldFontSize: "12px";
153
+ readonly fieldLineHeight: 1.7;
154
+ readonly labelColor: "#57606a";
155
+ readonly labelMinWidth: "72px";
156
+ };
157
+ readonly logs: {
158
+ readonly notificationText: "#fff";
159
+ readonly notificationAccent: "#5D9FFA";
160
+ readonly toggleBg: "rgb(58, 58, 58)";
161
+ readonly toggleOffBg: "rgb(144, 60, 60)";
162
+ readonly divider: "rgba(255, 255, 255, 1)";
163
+ readonly tabNavBg: "#333";
164
+ readonly tabBg: "#444";
165
+ readonly tabActiveBg: "#666";
166
+ readonly tabText: "#fff";
167
+ };
77
168
  readonly font: {
78
169
  readonly family: "Roboto";
79
170
  readonly sizeBase: "12px";
@@ -19,6 +19,7 @@ export const tokens = {
19
19
  itemColor: '#fff',
20
20
  itemHoverColor: '#101010',
21
21
  itemHoverBgColor: '#fff',
22
+ outlineColor: '#007bff',
22
23
  shadow: '0 0 20px 14px rgba(34, 60, 80, 0.2)',
23
24
  },
24
25
  /** FloatingWindow window chrome (--wnd-*). Defaults = legacy look; apps re-skin via :root[data-theme].
@@ -57,7 +58,7 @@ export const tokens = {
57
58
  shadow: '0 12px 40px rgba(0, 0, 0, 0.5)',
58
59
  /** var(--color-bg-light) in CSS */
59
60
  navBg: '#17202e',
60
- navWidth: '168px',
61
+ navWidth: '220px',
61
62
  },
62
63
  /** Toolbar (createToolbar) chrome (--tb-*). Dark defaults; apps re-skin via :root[data-theme]. */
63
64
  tb: {
@@ -76,6 +77,96 @@ export const tokens = {
76
77
  popRadius: '8px',
77
78
  popShadow: '0 8px 28px rgba(0, 0, 0, 0.5)',
78
79
  },
80
+ /** Column-state compact menu (ColumnsMenu/MenuStrip) chrome (--cols-menu-*). */
81
+ colsMenu: {
82
+ gap: '6px',
83
+ btnGap: '4px',
84
+ btnPadding: '3px 9px',
85
+ btnRadius: '6px',
86
+ btnFontSize: '12px',
87
+ btnLineHeight: '16px',
88
+ onBorder: '1px solid #24292f',
89
+ onBg: '#24292f',
90
+ onColor: '#fff',
91
+ offBorder: '1px solid #d0d7de',
92
+ offBg: '#fff',
93
+ offColor: '#8c959f',
94
+ disabledBorder: '1px dashed #d0d7de',
95
+ disabledBg: '#f6f8fa',
96
+ disabledColor: '#c4ccd4',
97
+ fixedShadow: '0 0 0 2px #eaeef2',
98
+ dragShadow: '0 3px 10px rgba(0, 0, 0, 0.35)',
99
+ divider: '#d0d7de',
100
+ abbrFontSize: '10px',
101
+ abbrFontWeight: 700,
102
+ abbrLetterSpacing: '0.5px',
103
+ marksFontSize: '9px',
104
+ marksOpacity: 0.9,
105
+ },
106
+ /** ColumnDots chrome (--cols-dots-*). Defaults preserve restored card-29 look. */
107
+ colsDots: {
108
+ text: '#24292f',
109
+ headGap: '10px',
110
+ headMarginBottom: '6px',
111
+ headFontSize: '12px',
112
+ metaColor: '#57606a',
113
+ sortBorder: '1px solid #6e7781',
114
+ sortRadius: '6px',
115
+ sortPadding: '2px 8px',
116
+ sortFontSize: '12px',
117
+ sortBg: '#fff',
118
+ trackHeight: '56px',
119
+ trackMargin: '0 14px',
120
+ rail: '#d0d7de',
121
+ markWidth: '44px',
122
+ markHeight: '56px',
123
+ markMarginLeft: '-22px',
124
+ sortMarkColor: '#0969da',
125
+ sortMarkFontSize: '11px',
126
+ pin: '#afb8c1',
127
+ labelColor: '#8c959f',
128
+ labelActiveColor: '#24292f',
129
+ labelFontSize: '10px',
130
+ dotSize: '18px',
131
+ dotRadius: '9px',
132
+ dotBg: '#24292f',
133
+ dotShadow: '0 3px 10px rgba(0, 0, 0, 0.35)',
134
+ selectedBg: '#0969da',
135
+ selectedBorder: '#b6d4fe',
136
+ fixedBorder: '#afb8c1',
137
+ },
138
+ /** CardList chrome (--cols-card-*). Defaults preserve restored card-29 look. */
139
+ colsCard: {
140
+ gap: '8px',
141
+ border: '1px solid #d0d7de',
142
+ radius: '8px',
143
+ padding: '8px 10px',
144
+ bg: '#fff',
145
+ headerGap: '8px',
146
+ headerMarginBottom: '6px',
147
+ titleFontSize: '14px',
148
+ accentFontSize: '11px',
149
+ accentPadding: '1px 8px',
150
+ accentRadius: '10px',
151
+ accentBg: '#ddf4ff',
152
+ accentColor: '#0969da',
153
+ fieldGap: '10px',
154
+ fieldFontSize: '12px',
155
+ fieldLineHeight: 1.7,
156
+ labelColor: '#57606a',
157
+ labelMinWidth: '72px',
158
+ }, /** Logs chrome (--logs-*). Defaults preserve the old logger look; apps re-skin via CSS vars. */
159
+ logs: {
160
+ notificationText: '#fff',
161
+ notificationAccent: '#5D9FFA',
162
+ toggleBg: 'rgb(58, 58, 58)',
163
+ toggleOffBg: 'rgb(144, 60, 60)',
164
+ divider: 'rgba(255, 255, 255, 1)',
165
+ tabNavBg: '#333',
166
+ tabBg: '#444',
167
+ tabActiveBg: '#666',
168
+ tabText: '#fff',
169
+ },
79
170
  font: {
80
171
  family: 'Roboto',
81
172
  sizeBase: '12px',
@@ -6,3 +6,4 @@ export * from './inputAutoStep';
6
6
  export * from './memoryStore';
7
7
  export * from './observableMap';
8
8
  export * from './pageVisibilityContext';
9
+ export * from './searchHistory';
@@ -6,3 +6,4 @@ export * from './inputAutoStep';
6
6
  export * from './memoryStore';
7
7
  export * from './observableMap';
8
8
  export * from './pageVisibilityContext';
9
+ export * from './searchHistory';
@@ -0,0 +1,14 @@
1
+ export type SearchHistoryState = {
2
+ items: string[];
3
+ };
4
+ export type SearchHistoryApi = ReturnType<typeof createSearchHistory>;
5
+ export declare function createSearchHistory(opts: {
6
+ key: string;
7
+ max?: number;
8
+ }): {
9
+ readonly items: string[];
10
+ use(): string[];
11
+ add(value: string): void;
12
+ remove(value: string): void;
13
+ clear(): void;
14
+ };
@@ -0,0 +1,59 @@
1
+ import { renderBy, updateBy } from "../../updateBy";
2
+ import { memoryGetOrCreate, memoryMarkDirty } from "./memoryStore";
3
+ function normalizeSearchHistoryItem(value) {
4
+ return value.replace(/\s+/g, " ").trim();
5
+ }
6
+ export function createSearchHistory(opts) {
7
+ const max = Math.max(1, opts.max ?? 8);
8
+ const st = memoryGetOrCreate(opts.key, { items: [] });
9
+ function normalize() {
10
+ const seen = new Set();
11
+ st.items = st.items
12
+ .map(normalizeSearchHistoryItem)
13
+ .filter(Boolean)
14
+ .filter(item => {
15
+ const k = item.toLocaleLowerCase();
16
+ if (seen.has(k))
17
+ return false;
18
+ seen.add(k);
19
+ return true;
20
+ })
21
+ .slice(0, max);
22
+ return st.items;
23
+ }
24
+ function emit() {
25
+ normalize();
26
+ renderBy(st);
27
+ memoryMarkDirty(opts.key);
28
+ }
29
+ return {
30
+ get items() {
31
+ return normalize().slice();
32
+ },
33
+ use() {
34
+ updateBy(st);
35
+ return normalize().slice();
36
+ },
37
+ add(value) {
38
+ const item = normalizeSearchHistoryItem(value);
39
+ if (!item)
40
+ return;
41
+ st.items = [item, ...st.items.filter(e => e.toLocaleLowerCase() != item.toLocaleLowerCase())];
42
+ emit();
43
+ },
44
+ remove(value) {
45
+ const item = normalizeSearchHistoryItem(value);
46
+ const next = st.items.filter(e => e.toLocaleLowerCase() != item.toLocaleLowerCase());
47
+ if (next.length == st.items.length)
48
+ return;
49
+ st.items = next;
50
+ emit();
51
+ },
52
+ clear() {
53
+ if (st.items.length == 0)
54
+ return;
55
+ st.items = [];
56
+ emit();
57
+ },
58
+ };
59
+ }
@@ -96,7 +96,7 @@
96
96
 
97
97
  /* If the animation completed, the outline remains */
98
98
  .draggable-div.outline-complete::after {
99
- border-color: #007bff;
99
+ border-color: var(--menu-outline-color);
100
100
  /* Ensure the pseudo-element shows the full outline */
101
101
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
102
102
  }
@@ -108,7 +108,7 @@
108
108
  clip-path: polygon(0 0, 0 0, 0 0, 0 0);
109
109
  }
110
110
  25% {
111
- border-color: #007bff;
111
+ border-color: var(--menu-outline-color);
112
112
  /* Draw the top line */
113
113
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
114
114
  }