@rytass/wms-map-react-components 0.1.10 → 0.2.0

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 (97) hide show
  1. package/components/breadcrumb/breadcrumb-edit-modal.cjs +92 -0
  2. package/components/breadcrumb/breadcrumb-edit-modal.d.cts +9 -0
  3. package/components/breadcrumb/breadcrumb-edit-modal.module.scss.cjs +5 -0
  4. package/components/breadcrumb/breadcrumb.cjs +171 -0
  5. package/components/breadcrumb/breadcrumb.d.cts +11 -0
  6. package/components/breadcrumb/breadcrumb.d.ts +1 -1
  7. package/components/breadcrumb/breadcrumb.module.scss.cjs +5 -0
  8. package/components/canvas/react-flow-canvas.cjs +321 -0
  9. package/components/canvas/react-flow-canvas.d.cts +38 -0
  10. package/components/canvas/react-flow-canvas.d.ts +1 -1
  11. package/components/canvas/react-flow-canvas.module.scss.cjs +5 -0
  12. package/components/modal/wms-map-content.cjs +808 -0
  13. package/components/modal/wms-map-content.d.cts +4 -0
  14. package/components/modal/wms-map-content.d.ts +1 -1
  15. package/components/modal/wms-map-modal-container.cjs +130 -0
  16. package/components/modal/wms-map-modal-container.d.cts +5 -0
  17. package/components/modal/wms-map-modal-container.d.ts +1 -1
  18. package/components/modal/wms-map-modal-container.module.scss.cjs +5 -0
  19. package/components/nodes/base-node.d.cts +12 -0
  20. package/components/nodes/base-node.d.ts +1 -1
  21. package/components/nodes/image-node.cjs +236 -0
  22. package/components/nodes/image-node.d.cts +17 -0
  23. package/components/nodes/image-node.d.ts +1 -1
  24. package/components/nodes/image-node.module.scss.cjs +5 -0
  25. package/components/nodes/path-node.cjs +553 -0
  26. package/components/nodes/path-node.d.cts +19 -0
  27. package/components/nodes/path-node.d.ts +1 -1
  28. package/components/nodes/path-node.module.scss.cjs +5 -0
  29. package/components/nodes/rectangle-node.cjs +239 -0
  30. package/components/nodes/rectangle-node.d.cts +11 -0
  31. package/components/nodes/rectangle-node.d.ts +1 -1
  32. package/components/nodes/rectangle-node.module.scss.cjs +5 -0
  33. package/components/ui/context-menu.cjs +171 -0
  34. package/components/ui/context-menu.d.cts +25 -0
  35. package/components/ui/context-menu.module.scss.cjs +5 -0
  36. package/components/ui/toolbar.cjs +286 -0
  37. package/components/ui/toolbar.d.cts +23 -0
  38. package/components/ui/toolbar.d.ts +1 -1
  39. package/components/ui/toolbar.module.scss.cjs +5 -0
  40. package/components/ui/view-mode-toolbar.cjs +44 -0
  41. package/components/ui/view-mode-toolbar.d.cts +9 -0
  42. package/components/ui/view-mode-toolbar.d.ts +1 -1
  43. package/components/ui/view-mode-toolbar.module.scss.cjs +5 -0
  44. package/constants/index.cjs +54 -0
  45. package/constants/index.d.cts +45 -0
  46. package/constants/index.d.ts +2 -2
  47. package/constants/text-mappings.cjs +46 -0
  48. package/constants/text-mappings.d.cts +181 -0
  49. package/hooks/use-context-menu.cjs +231 -0
  50. package/hooks/use-context-menu.d.cts +37 -0
  51. package/hooks/use-context-menu.d.ts +1 -1
  52. package/hooks/use-direct-state-history.cjs +217 -0
  53. package/hooks/use-direct-state-history.d.cts +58 -0
  54. package/hooks/use-direct-state-history.d.ts +2 -2
  55. package/hooks/use-pen-drawing.cjs +366 -0
  56. package/hooks/use-pen-drawing.d.cts +30 -0
  57. package/hooks/use-pen-drawing.d.ts +1 -1
  58. package/hooks/use-rectangle-drawing.cjs +139 -0
  59. package/hooks/use-rectangle-drawing.d.cts +19 -0
  60. package/hooks/use-rectangle-drawing.d.ts +1 -1
  61. package/hooks/use-text-editing.cjs +156 -0
  62. package/hooks/use-text-editing.d.cts +19 -0
  63. package/icons/index.cjs +233 -0
  64. package/icons/index.d.cts +16 -0
  65. package/index.cjs +26 -0
  66. package/index.d.cts +5 -0
  67. package/index.d.ts +5 -5
  68. package/package.json +68 -3
  69. package/types/callback.types.d.cts +7 -0
  70. package/types/callback.types.d.ts +1 -1
  71. package/types/canvas.types.d.cts +35 -0
  72. package/types/canvas.types.d.ts +1 -1
  73. package/types/component-props.types.d.cts +45 -0
  74. package/types/component-props.types.d.ts +2 -2
  75. package/types/history.types.d.cts +24 -0
  76. package/types/history.types.d.ts +2 -2
  77. package/types/index.d.cts +5 -0
  78. package/types/index.d.ts +5 -5
  79. package/types/react-flow.types.d.cts +30 -0
  80. package/typings.cjs +44 -0
  81. package/typings.d.cts +136 -0
  82. package/utils/api-data-transform.cjs +221 -0
  83. package/utils/api-data-transform.d.cts +33 -0
  84. package/utils/api-data-transform.d.ts +1 -1
  85. package/utils/color-utils.cjs +58 -0
  86. package/utils/color-utils.d.cts +17 -0
  87. package/utils/debug-logger.cjs +45 -0
  88. package/utils/debug-logger.d.cts +33 -0
  89. package/utils/map-data-transform.cjs +360 -0
  90. package/utils/map-data-transform.d.cts +18 -0
  91. package/utils/map-data-transform.d.ts +1 -1
  92. package/utils/node-operations.cjs +88 -0
  93. package/utils/node-operations.d.cts +26 -0
  94. package/utils/node-utils.cjs +40 -0
  95. package/utils/node-utils.d.cts +10 -0
  96. package/index.cjs.css +0 -1
  97. package/index.cjs.js +0 -5128
@@ -0,0 +1,286 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var React = require('react');
6
+ var react = require('@mezzanine-ui/react');
7
+ var typings = require('../../typings.cjs');
8
+ var index$1 = require('../../constants/index.cjs');
9
+ var toolbar_module = require('./toolbar.module.scss.cjs');
10
+ var index = require('../../icons/index.cjs');
11
+
12
+ // LoadingIcon 組件
13
+ const LoadingIcon = ({ className })=>/*#__PURE__*/ jsxRuntime.jsx("div", {
14
+ className: `${toolbar_module.loadingIcon} ${className || ''}`
15
+ });
16
+ const Toolbar = ({ onUpload, onDeleteAll, onSave, editMode, drawingMode, onEditModeChange, onToggleRectangleTool, onTogglePenTool, onUndo, onRedo, canUndo = false, canRedo = false, onColorChange, selectedColor: parentSelectedColor, colorPalette, isUploading = false, maxFileSizeKB = 30720 })=>{
17
+ const [showColorMenu, setShowColorMenu] = React.useState(false);
18
+ const selectedColor = parentSelectedColor || index$1.DEFAULT_BACKGROUND_TOOL_COLOR;
19
+ // 檔案選擇處理
20
+ const handleFileChange = async (event)=>{
21
+ const files = Array.from(event.target.files || []);
22
+ // 檔案類型驗證
23
+ const validFiles = files.filter((file)=>{
24
+ if (!file.type.match(/^image\//i)) {
25
+ return false;
26
+ }
27
+ // 檔案大小驗證 (KB)
28
+ const fileSizeKB = file.size / 1024;
29
+ if (fileSizeKB > maxFileSizeKB) {
30
+ console.warn(`檔案 ${file.name} 大小 ${Math.round(fileSizeKB)}KB 超過限制 ${maxFileSizeKB}KB`);
31
+ return false;
32
+ }
33
+ return true;
34
+ });
35
+ if (validFiles.length !== files.length) {
36
+ const invalidCount = files.length - validFiles.length;
37
+ console.warn(`${invalidCount} 個檔案被跳過:格式不支援或檔案過大`);
38
+ }
39
+ if (validFiles.length > 0) {
40
+ await onUpload(validFiles);
41
+ }
42
+ // 清空 input
43
+ event.target.value = '';
44
+ };
45
+ const handleColorChange = (color)=>{
46
+ if (onColorChange) {
47
+ onColorChange(color);
48
+ }
49
+ };
50
+ const handleColorPickerClick = ()=>{
51
+ if (colorPalette && colorPalette.length > 0) {
52
+ setShowColorMenu(!showColorMenu);
53
+ }
54
+ // 如果沒有提供 colorPalette,則不執行任何操作(顏色工具將被隱藏)
55
+ };
56
+ const handleColorSelect = (color)=>{
57
+ handleColorChange(color);
58
+ setShowColorMenu(false);
59
+ };
60
+ // 點擊外部關閉顏色選單
61
+ React.useEffect(()=>{
62
+ const handleClickOutside = (event)=>{
63
+ const colorPicker = document.querySelector(`.${toolbar_module.colorPicker}`);
64
+ if (colorPicker && !colorPicker.contains(event.target)) {
65
+ setShowColorMenu(false);
66
+ }
67
+ };
68
+ if (showColorMenu) {
69
+ document.addEventListener('mousedown', handleClickOutside);
70
+ }
71
+ return ()=>{
72
+ document.removeEventListener('mousedown', handleClickOutside);
73
+ };
74
+ }, [
75
+ showColorMenu
76
+ ]);
77
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
78
+ children: [
79
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
80
+ className: toolbar_module.toolbar,
81
+ children: [
82
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
83
+ className: toolbar_module.toolbarLeft,
84
+ children: [
85
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
86
+ className: toolbar_module.toggleSwitch,
87
+ children: [
88
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
89
+ className: `${toolbar_module.toggleSlider} ${editMode === typings.EditMode.BACKGROUND ? toolbar_module.toggleSliderRight : ''}`
90
+ }),
91
+ /*#__PURE__*/ jsxRuntime.jsx("button", {
92
+ className: `${toolbar_module.toggleOption} ${editMode === typings.EditMode.LAYER ? toolbar_module.toggleOptionActive : ''}`,
93
+ onClick: ()=>onEditModeChange(typings.EditMode.LAYER),
94
+ children: "圖層"
95
+ }),
96
+ /*#__PURE__*/ jsxRuntime.jsx("button", {
97
+ className: `${toolbar_module.toggleOption} ${editMode === typings.EditMode.BACKGROUND ? toolbar_module.toggleOptionActive : ''}`,
98
+ onClick: ()=>onEditModeChange(typings.EditMode.BACKGROUND),
99
+ children: "底圖"
100
+ })
101
+ ]
102
+ }),
103
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
104
+ className: toolbar_module.separator
105
+ }),
106
+ editMode === typings.EditMode.BACKGROUND && /*#__PURE__*/ jsxRuntime.jsxs("div", {
107
+ className: toolbar_module.uploadButtonContainer,
108
+ children: [
109
+ /*#__PURE__*/ jsxRuntime.jsx(react.Button, {
110
+ variant: "base-secondary",
111
+ size: "minor",
112
+ className: `${toolbar_module.toolbarButton} ${toolbar_module.buttonWithIcon} ${toolbar_module.uploadButton} ${isUploading ? toolbar_module.uploading : ''}`,
113
+ disabled: isUploading,
114
+ children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
115
+ className: toolbar_module.buttonContent,
116
+ children: [
117
+ isUploading ? /*#__PURE__*/ jsxRuntime.jsx(LoadingIcon, {
118
+ className: toolbar_module.toolIcon
119
+ }) : /*#__PURE__*/ jsxRuntime.jsx(index.ImageIcon, {
120
+ className: toolbar_module.toolIcon
121
+ }),
122
+ isUploading ? '上傳中...' : '上傳'
123
+ ]
124
+ })
125
+ }),
126
+ /*#__PURE__*/ jsxRuntime.jsx("input", {
127
+ type: "file",
128
+ accept: "image/*",
129
+ multiple: true,
130
+ onChange: handleFileChange,
131
+ className: toolbar_module.uploadInput,
132
+ disabled: isUploading
133
+ })
134
+ ]
135
+ }),
136
+ /*#__PURE__*/ jsxRuntime.jsxs(react.Button, {
137
+ variant: "base-secondary",
138
+ size: "minor",
139
+ className: `${toolbar_module.toolbarButton} ${toolbar_module.buttonWithIcon}`,
140
+ onClick: (e)=>{
141
+ onDeleteAll();
142
+ // 強制重置按鈕狀態
143
+ const btn = e.target;
144
+ btn.blur();
145
+ setTimeout(()=>{
146
+ btn.blur();
147
+ }, 0);
148
+ },
149
+ children: [
150
+ /*#__PURE__*/ jsxRuntime.jsx(index.DeleteIcon, {
151
+ className: toolbar_module.toolIcon
152
+ }),
153
+ "刪除全部"
154
+ ]
155
+ })
156
+ ]
157
+ }),
158
+ /*#__PURE__*/ jsxRuntime.jsx(react.Button, {
159
+ variant: "base-primary",
160
+ size: "minor",
161
+ className: toolbar_module.saveButton,
162
+ onClick: (e)=>{
163
+ onSave();
164
+ // 強制重置按鈕狀態
165
+ const btn = e.target;
166
+ btn.blur();
167
+ setTimeout(()=>{
168
+ btn.blur();
169
+ }, 0);
170
+ },
171
+ children: "儲存"
172
+ })
173
+ ]
174
+ }),
175
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
176
+ className: toolbar_module.unifiedTools,
177
+ children: [
178
+ /*#__PURE__*/ jsxRuntime.jsx(react.Button, {
179
+ variant: "base-secondary",
180
+ size: "minor",
181
+ className: `${toolbar_module.toolButton} ${canUndo ? '' : toolbar_module.toolButtonDisabled}`,
182
+ onClick: onUndo,
183
+ disabled: !canUndo,
184
+ title: "上一步",
185
+ children: /*#__PURE__*/ jsxRuntime.jsx(index.UndoIcon, {
186
+ className: toolbar_module.toolIcon
187
+ })
188
+ }),
189
+ /*#__PURE__*/ jsxRuntime.jsx(react.Button, {
190
+ variant: "base-secondary",
191
+ size: "minor",
192
+ className: `${toolbar_module.toolButton} ${canRedo ? '' : toolbar_module.toolButtonDisabled}`,
193
+ onClick: onRedo,
194
+ disabled: !canRedo,
195
+ title: "下一步",
196
+ children: /*#__PURE__*/ jsxRuntime.jsx(index.RedoIcon, {
197
+ className: toolbar_module.toolIcon
198
+ })
199
+ }),
200
+ editMode === typings.EditMode.LAYER && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
201
+ children: [
202
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
203
+ className: toolbar_module.separator
204
+ }),
205
+ /*#__PURE__*/ jsxRuntime.jsx(react.Button, {
206
+ variant: drawingMode === typings.DrawingMode.NONE ? 'base-primary' : 'base-secondary',
207
+ size: "minor",
208
+ className: `${toolbar_module.toolButton} ${drawingMode === typings.DrawingMode.NONE ? toolbar_module.toolButtonActive : ''}`,
209
+ onClick: ()=>{
210
+ // 選擇選取工具時關閉繪圖模式
211
+ if (drawingMode === typings.DrawingMode.RECTANGLE) {
212
+ onToggleRectangleTool();
213
+ } else if (drawingMode === typings.DrawingMode.PEN) {
214
+ onTogglePenTool();
215
+ }
216
+ },
217
+ title: "選取工具",
218
+ children: /*#__PURE__*/ jsxRuntime.jsx(index.PointerIcon, {
219
+ className: toolbar_module.toolIcon
220
+ })
221
+ }),
222
+ /*#__PURE__*/ jsxRuntime.jsx(react.Button, {
223
+ variant: drawingMode === typings.DrawingMode.RECTANGLE ? 'base-primary' : 'base-secondary',
224
+ size: "minor",
225
+ className: `${toolbar_module.toolButton} ${drawingMode === typings.DrawingMode.RECTANGLE ? toolbar_module.toolButtonActive : ''}`,
226
+ onClick: onToggleRectangleTool,
227
+ title: "矩形工具",
228
+ children: /*#__PURE__*/ jsxRuntime.jsx(index.SquareIcon, {
229
+ className: toolbar_module.toolIcon
230
+ })
231
+ }),
232
+ /*#__PURE__*/ jsxRuntime.jsx(react.Button, {
233
+ variant: drawingMode === typings.DrawingMode.PEN ? 'base-primary' : 'base-secondary',
234
+ size: "minor",
235
+ className: `${toolbar_module.toolButton} ${drawingMode === typings.DrawingMode.PEN ? toolbar_module.toolButtonActive : ''}`,
236
+ onClick: onTogglePenTool,
237
+ title: "鋼筆工具",
238
+ children: /*#__PURE__*/ jsxRuntime.jsx(index.PenToolIcon, {
239
+ className: toolbar_module.toolIcon
240
+ })
241
+ }),
242
+ colorPalette && colorPalette.length > 0 && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
243
+ children: [
244
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
245
+ className: toolbar_module.separator
246
+ }),
247
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
248
+ className: toolbar_module.colorPicker,
249
+ children: [
250
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
251
+ className: toolbar_module.colorDisplay,
252
+ style: {
253
+ backgroundColor: selectedColor
254
+ },
255
+ onClick: handleColorPickerClick,
256
+ title: "選擇顏色"
257
+ }),
258
+ showColorMenu && /*#__PURE__*/ jsxRuntime.jsx("div", {
259
+ className: toolbar_module.colorMenu,
260
+ children: colorPalette.map((color, index$1)=>/*#__PURE__*/ jsxRuntime.jsx("div", {
261
+ className: `${toolbar_module.colorOption} ${selectedColor === color ? toolbar_module.colorOptionSelected : ''}`,
262
+ style: {
263
+ backgroundColor: color
264
+ },
265
+ onClick: ()=>handleColorSelect(color),
266
+ title: color,
267
+ children: selectedColor === color && /*#__PURE__*/ jsxRuntime.jsx(index.CheckMarkIcon, {
268
+ width: 28,
269
+ height: 28,
270
+ className: toolbar_module.checkMarkIcon
271
+ })
272
+ }, index$1))
273
+ })
274
+ ]
275
+ })
276
+ ]
277
+ })
278
+ ]
279
+ })
280
+ ]
281
+ })
282
+ ]
283
+ });
284
+ };
285
+
286
+ module.exports = Toolbar;
@@ -0,0 +1,23 @@
1
+ import { FC } from 'react';
2
+ import { DrawingMode, EditMode } from '../../typings.cjs';
3
+ interface ToolbarProps {
4
+ onUpload: (files: File[]) => Promise<void>;
5
+ onDeleteAll: () => void;
6
+ onSave: () => void;
7
+ editMode: EditMode;
8
+ drawingMode: DrawingMode;
9
+ onEditModeChange: (mode: EditMode) => void;
10
+ onToggleRectangleTool: () => void;
11
+ onTogglePenTool: () => void;
12
+ onUndo?: () => void;
13
+ onRedo?: () => void;
14
+ canUndo?: boolean;
15
+ canRedo?: boolean;
16
+ onColorChange?: (color: string) => void;
17
+ selectedColor?: string;
18
+ colorPalette?: string[];
19
+ isUploading?: boolean;
20
+ maxFileSizeKB?: number;
21
+ }
22
+ declare const Toolbar: FC<ToolbarProps>;
23
+ export default Toolbar;
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { DrawingMode, EditMode } from '../../typings';
2
+ import { DrawingMode, EditMode } from '../../typings.js';
3
3
  interface ToolbarProps {
4
4
  onUpload: (files: File[]) => Promise<void>;
5
5
  onDeleteAll: () => void;
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ var styles = {"toolbar":"toolbar-module_toolbar__96rDw","toolbarLeft":"toolbar-module_toolbarLeft__PMOYv","toggleSwitch":"toolbar-module_toggleSwitch__Gy2ML","toggleSlider":"toolbar-module_toggleSlider__7a7Nh","toggleSliderRight":"toolbar-module_toggleSliderRight__w9umy","toggleOption":"toolbar-module_toggleOption__8AIQx","toggleOptionActive":"toolbar-module_toggleOptionActive__ypvGJ","toolbarButton":"toolbar-module_toolbarButton__K8xsY","saveButton":"toolbar-module_saveButton__eiTcG","unifiedTools":"toolbar-module_unifiedTools__s27Xt","toolButton":"toolbar-module_toolButton__rQdtA","toolButtonDisabled":"toolbar-module_toolButtonDisabled__gc2mS","toolButtonActive":"toolbar-module_toolButtonActive__iCxN8","toolIcon":"toolbar-module_toolIcon__xPmHR","colorPicker":"toolbar-module_colorPicker__7PQ18","colorDisplay":"toolbar-module_colorDisplay__BEOKw","separator":"toolbar-module_separator__-IyrB","colorMenu":"toolbar-module_colorMenu__Y6gOp","colorOption":"toolbar-module_colorOption__7eLEp","colorOptionSelected":"toolbar-module_colorOptionSelected__-Zouj","checkMarkIcon":"toolbar-module_checkMarkIcon__5dAqn","buttonWithIcon":"toolbar-module_buttonWithIcon__-2ca5","uploadButtonContainer":"toolbar-module_uploadButtonContainer__vv0q8","uploadInput":"toolbar-module_uploadInput__xWb-r","uploadButton":"toolbar-module_uploadButton__SIUHi","uploading":"toolbar-module_uploading__uM5vV","loadingIcon":"toolbar-module_loadingIcon__bi-tO","buttonContent":"toolbar-module_buttonContent__nR-Kz"};
4
+
5
+ module.exports = styles;
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ require('react');
6
+ var react = require('@mezzanine-ui/react');
7
+ var typings = require('../../typings.cjs');
8
+ var viewModeToolbar_module = require('./view-mode-toolbar.module.scss.cjs');
9
+
10
+ const ViewModeToolbar = ({ viewMode, showBackground, onToggleBackground })=>{
11
+ // 只在檢視模式下顯示
12
+ if (viewMode !== typings.ViewMode.VIEW) {
13
+ return null;
14
+ }
15
+ // console.log('🔧 ViewModeToolbar 渲染:', { viewMode, showBackground });
16
+ const handleToggle = (event)=>{
17
+ const checked = event.target.checked;
18
+ console.log('🔧 Toggle 切換:', {
19
+ from: showBackground,
20
+ to: checked
21
+ });
22
+ onToggleBackground(checked);
23
+ };
24
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
25
+ className: viewModeToolbar_module.viewModeToolbar,
26
+ children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
27
+ className: viewModeToolbar_module.toolbarContent,
28
+ children: [
29
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
30
+ className: viewModeToolbar_module.label,
31
+ children: "顯示底圖"
32
+ }),
33
+ /*#__PURE__*/ jsxRuntime.jsx(react.Toggle, {
34
+ checked: showBackground,
35
+ onChange: handleToggle,
36
+ size: "main",
37
+ className: viewModeToolbar_module.switch
38
+ })
39
+ ]
40
+ })
41
+ });
42
+ };
43
+
44
+ module.exports = ViewModeToolbar;
@@ -0,0 +1,9 @@
1
+ import { FC } from 'react';
2
+ import { ViewMode } from '../../typings.cjs';
3
+ interface ViewModeToolbarProps {
4
+ viewMode: ViewMode;
5
+ showBackground: boolean;
6
+ onToggleBackground: (show: boolean) => void;
7
+ }
8
+ declare const ViewModeToolbar: FC<ViewModeToolbarProps>;
9
+ export default ViewModeToolbar;
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { ViewMode } from '../../typings';
2
+ import { ViewMode } from '../../typings.js';
3
3
  interface ViewModeToolbarProps {
4
4
  viewMode: ViewMode;
5
5
  showBackground: boolean;
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ var styles = {"viewModeToolbar":"view-mode-toolbar-module_viewModeToolbar__N0CZK","toolbarContent":"view-mode-toolbar-module_toolbarContent__aXcnS","label":"view-mode-toolbar-module_label__NyCK5","switch":"view-mode-toolbar-module_switch__RzGTA"};
4
+
5
+ module.exports = styles;
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ // 預設尺寸
4
+ const DEFAULT_IMAGE_WIDTH = 300;
5
+ const DEFAULT_IMAGE_HEIGHT = 200;
6
+ const DEFAULT_RECTANGLE_WIDTH = 150;
7
+ const DEFAULT_RECTANGLE_HEIGHT = 100;
8
+ // 顏色
9
+ const DEFAULT_RECTANGLE_COLOR = '#3b82f6';
10
+ const DEFAULT_BACKGROUND_TOOL_COLOR = '#3b82f6';
11
+ // 最小尺寸
12
+ const MIN_RECTANGLE_SIZE = 10;
13
+ const MIN_RESIZE_WIDTH = 50;
14
+ const MIN_RESIZE_HEIGHT = 30;
15
+ // 文字和標籤
16
+ const DEFAULT_RECTANGLE_LABEL = '矩形區域';
17
+ const DEFAULT_PATH_LABEL = '路徑區域';
18
+ // 透明度數值
19
+ const ACTIVE_OPACITY = 1;
20
+ const INACTIVE_OPACITY = 0.4;
21
+ const RECTANGLE_INACTIVE_OPACITY = 0.6;
22
+ // UI 配置
23
+ const UI_CONFIG = {
24
+ HISTORY_SIZE: 50,
25
+ COLOR_CHANGE_DELAY: 800,
26
+ STAGGER_DELAY: 100,
27
+ NODE_SAVE_DELAY: 50
28
+ };
29
+ // 預設倉庫 ID (應該從外部傳入)
30
+ const DEFAULT_WAREHOUSE_IDS = [
31
+ '10001',
32
+ '10001A',
33
+ '10002',
34
+ '100002B',
35
+ '100003',
36
+ '100003B'
37
+ ];
38
+
39
+ exports.ACTIVE_OPACITY = ACTIVE_OPACITY;
40
+ exports.DEFAULT_BACKGROUND_TOOL_COLOR = DEFAULT_BACKGROUND_TOOL_COLOR;
41
+ exports.DEFAULT_IMAGE_HEIGHT = DEFAULT_IMAGE_HEIGHT;
42
+ exports.DEFAULT_IMAGE_WIDTH = DEFAULT_IMAGE_WIDTH;
43
+ exports.DEFAULT_PATH_LABEL = DEFAULT_PATH_LABEL;
44
+ exports.DEFAULT_RECTANGLE_COLOR = DEFAULT_RECTANGLE_COLOR;
45
+ exports.DEFAULT_RECTANGLE_HEIGHT = DEFAULT_RECTANGLE_HEIGHT;
46
+ exports.DEFAULT_RECTANGLE_LABEL = DEFAULT_RECTANGLE_LABEL;
47
+ exports.DEFAULT_RECTANGLE_WIDTH = DEFAULT_RECTANGLE_WIDTH;
48
+ exports.DEFAULT_WAREHOUSE_IDS = DEFAULT_WAREHOUSE_IDS;
49
+ exports.INACTIVE_OPACITY = INACTIVE_OPACITY;
50
+ exports.MIN_RECTANGLE_SIZE = MIN_RECTANGLE_SIZE;
51
+ exports.MIN_RESIZE_HEIGHT = MIN_RESIZE_HEIGHT;
52
+ exports.MIN_RESIZE_WIDTH = MIN_RESIZE_WIDTH;
53
+ exports.RECTANGLE_INACTIVE_OPACITY = RECTANGLE_INACTIVE_OPACITY;
54
+ exports.UI_CONFIG = UI_CONFIG;
@@ -0,0 +1,45 @@
1
+ export declare const DEFAULT_IMAGE_WIDTH = 300;
2
+ export declare const DEFAULT_IMAGE_HEIGHT = 200;
3
+ export declare const DEFAULT_RECTANGLE_WIDTH = 150;
4
+ export declare const DEFAULT_RECTANGLE_HEIGHT = 100;
5
+ export declare const DEFAULT_RECTANGLE_COLOR = "#3b82f6";
6
+ export declare const SELECTION_BORDER_COLOR = "#3b82f6";
7
+ export declare const DEFAULT_BACKGROUND_TOOL_COLOR = "#3b82f6";
8
+ export declare const MIN_RECTANGLE_SIZE = 10;
9
+ export declare const MIN_RESIZE_WIDTH = 50;
10
+ export declare const MIN_RESIZE_HEIGHT = 30;
11
+ export declare const DEFAULT_RECTANGLE_LABEL = "\u77E9\u5F62\u5340\u57DF";
12
+ export declare const DEFAULT_PATH_LABEL = "\u8DEF\u5F91\u5340\u57DF";
13
+ export declare const ACTIVE_OPACITY = 1;
14
+ export declare const INACTIVE_OPACITY = 0.4;
15
+ export declare const RECTANGLE_INACTIVE_OPACITY = 0.6;
16
+ export declare const RESIZE_CONTROL_SIZE = 16;
17
+ export declare const IMAGE_RESIZE_CONTROL_SIZE = 20;
18
+ export declare const UI_CONFIG: {
19
+ readonly HISTORY_SIZE: 50;
20
+ readonly COLOR_CHANGE_DELAY: 800;
21
+ readonly STAGGER_DELAY: 100;
22
+ readonly NODE_SAVE_DELAY: 50;
23
+ };
24
+ export declare const CANVAS_CONFIG: {
25
+ readonly MIN_ZOOM: 0.1;
26
+ readonly MAX_ZOOM: 4;
27
+ readonly DEFAULT_VIEWPORT: {
28
+ readonly x: 0;
29
+ readonly y: 0;
30
+ readonly zoom: 1;
31
+ };
32
+ readonly BACKGROUND_COLOR: "#F5F5F5";
33
+ };
34
+ export declare const DEFAULT_WAREHOUSE_IDS: readonly ["10001", "10001A", "10002", "100002B", "100003", "100003B"];
35
+ export declare const SUPPORTED_IMAGE_TYPES: {
36
+ readonly ACCEPT: "image/png,image/jpeg,image/jpg";
37
+ readonly PATTERN: RegExp;
38
+ readonly EXTENSIONS: readonly ["png", "jpg", "jpeg"];
39
+ };
40
+ export declare const UPLOAD_CONFIG: {
41
+ readonly DEFAULT_MAX_FILE_SIZE_KB: 30720;
42
+ readonly SUPPORTED_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/webp"];
43
+ };
44
+ export { TEXT_MAPPINGS } from './text-mappings.cjs';
45
+ export type { TextMappingKey, DebugKey, OperationKey, MessageKey, TestMessageKey } from './text-mappings.cjs';
@@ -41,5 +41,5 @@ export declare const UPLOAD_CONFIG: {
41
41
  readonly DEFAULT_MAX_FILE_SIZE_KB: 30720;
42
42
  readonly SUPPORTED_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/webp"];
43
43
  };
44
- export { TEXT_MAPPINGS } from './text-mappings';
45
- export type { TextMappingKey, DebugKey, OperationKey, MessageKey, TestMessageKey } from './text-mappings';
44
+ export { TEXT_MAPPINGS } from './text-mappings.js';
45
+ export type { TextMappingKey, DebugKey, OperationKey, MessageKey, TestMessageKey } from './text-mappings.js';
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * 文字對應表
5
+ * 用於管理所有中文文字,避免 Non-ASCII 字符問題
6
+ */ const TEXT_MAPPINGS = {
7
+ // Debug 相關
8
+ DEBUG: {
9
+ DATA_LOADING: 'data-loading',
10
+ HISTORY: 'history'},
11
+ // 操作描述
12
+ OPERATIONS: {
13
+ LOAD_NEW_DATA: 'load-new-data'},
14
+ // 中文文字對應
15
+ MESSAGES: {
16
+ // 節點類型
17
+ IMAGE_NODE: '圖片節點',
18
+ RECTANGLE_NODE: '矩形節點',
19
+ PATH_NODE: '路徑節點',
20
+ // 狀態描述
21
+ SELECTABLE: '可選取',
22
+ DRAGGABLE: '可拖曳',
23
+ DELETABLE: '可刪除',
24
+ // 數據統計
25
+ NODE_COUNT: '節點數',
26
+ EDGE_COUNT: '邊數',
27
+ CURRENT_NODES: '目前節點數',
28
+ CURRENT_EDGES: '目前邊數',
29
+ NEW_DATA_NODES: '新資料節點數',
30
+ NEW_DATA_EDGES: '新資料邊數',
31
+ LOADED_NODES: '載入節點數',
32
+ LOADED_EDGES: '載入邊數',
33
+ // 操作消息
34
+ DETECT_INITIAL_NODES_CHANGE: '檢測到 initialNodes 變化,更新畫布資料:',
35
+ NODE_ID_CHANGE: '節點ID變化',
36
+ NEW_IDS: '新的',
37
+ OLD_IDS: '舊的',
38
+ DATA_LOADING_COMPLETE: '新資料載入完成:',
39
+ CURRENT_MODE: '當前模式',
40
+ NODE_TYPE_STATS: '節點類型統計',
41
+ NODE_STATE_STATS: '節點狀態統計',
42
+ HISTORY_REINITIALIZE: '歷史記錄已重新初始化:',
43
+ OPERATION: '操作',
44
+ FIRST_HISTORY_INIT: '首次初始化歷史記錄:'}};
45
+
46
+ exports.TEXT_MAPPINGS = TEXT_MAPPINGS;