@mlightcad/ui-components 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,8 +6,80 @@ This is one common UI component library based on Element Plus.
6
6
 
7
7
  The following components are included in this package.
8
8
 
9
+ - Tool Palette: one dockable, resizable, and floating window, which is quite similar to AutoCAD Tool Palette.
9
10
  - Toolbar: one toolbar which can be easily customized by one array of button data.
10
11
 
12
+ ### Tool Palette
13
+
14
+ AutoCAD uses [tool palettes](https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-167A8594-92CB-4FCC-B72C-0F546383E97C) to organize blocks, hatches, and custom tools in a tabbed window. Tool Palette component is quite similar to one in AutoCAD. It supports the following features.
15
+
16
+ - Dockable: dock to the left or right side of the window
17
+ - Folderable: roll open or closed as your need
18
+ - Auto-hide: roll open and closed as the cursor moves across it. When this option is cleared, the full tool palette stays open continuously.
19
+
20
+ <img src="./doc/palette.jpg" alt="Tool Palette Example">
21
+
22
+ You can customize tool palette by the following properties.
23
+
24
+ ```javascript
25
+ /**
26
+ * Properties of MlToolPalette component
27
+ */
28
+ interface Props {
29
+ /**
30
+ * The title of tool palette dialog
31
+ */
32
+ title?: string
33
+ /**
34
+ * The minimum distance from the left side of the tool palette to the left side of the window
35
+ */
36
+ leftOffset?: number
37
+ /**
38
+ * The minimum distance from the right side of the tool palette to the right side of the window
39
+ */
40
+ rightOffset?: number
41
+ /**
42
+ * The minimum distance from the top side of the tool palette to the top side of the window
43
+ */
44
+ topOffset?: number
45
+ /**
46
+ * The minimum distance from the bottom side of the tool palette to the bottom side of the window
47
+ */
48
+ bottomOffset?: number
49
+ }
50
+ ```
51
+
52
+ Four `offsetXXX` properties are used to set the minimum distance from the side of the tool palette to the side of the window. It is quite useful if you want the tool palette is shown within area. For example, one web page has one title bar at the top of window, one status bar at the bottom of window, and one canvas area between the title bar and the status bar. The height of the title bar is 60px and the height of the status bar is 20px. Then you can set `topOffset` to 60 and `bottomOffset` to 20 to let the tool palette are shown and moved within canvas area only.
53
+
54
+ It is quite easy to use it.
55
+
56
+ ```javascript
57
+ <script lang="ts" setup>
58
+ import { MlToolPalette } from '@mlightcad/ui-components'
59
+ const toolPaletteVisible = ref<boolean>(false)
60
+ </script>
61
+
62
+ <template>
63
+ <ml-tool-palette
64
+ class="tool-palette"
65
+ v-model="toolPaletteVisible"
66
+ title="Tool Palette Test"
67
+ :top-offset="60"
68
+ :bottom-offset="20"
69
+ >
70
+ <span>Tool Palette Test</span>
71
+ </ml-tool-palette>
72
+ </template>
73
+
74
+ <style scoped>
75
+ .tool-palette {
76
+ position: fixed;
77
+ top: 55px;
78
+ width: 400px;
79
+ }
80
+ </style>
81
+ ```
82
+
11
83
  ### Toolbar
12
84
 
13
85
  Toolbar component has the followiing features.