You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/module-configuration.md
+52-6Lines changed: 52 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,22 +4,68 @@ JSON configuration objects for Wegue modules.
4
4
5
5
## General
6
6
7
-
The `modules` object contains sub-objects, whereas the key is the identifier for the module and the value is the dedicated module configuration. For example:
7
+
The `modules` object contains sub-objects, where the key is the identifier for the module instance and the value is the dedicated module configuration. For example:
8
8
9
9
```json
10
-
"wgu-layerlist": {
11
-
"target": "menu",
12
-
"win": "floating",
13
-
"draggable": false
14
-
}
10
+
"wgu-layerlist": {
11
+
"target": "menu",
12
+
"win": "floating",
13
+
"draggable": false
14
+
}
15
15
```
16
16
17
+
### Module identifier and module type
18
+
In general, the identifier specifies the type of module to be added.
19
+
In the example above, Wegue will look for a Vue component matching the module type `wgu-layerlist` and automatically append the `-win` suffix when resolving the component name. Internally, this results in the component `wgu-layerlist-win`, which must be registered in the application, for example:
This approach allows simple module definitions where the identifier directly maps to a single module instance.
29
+
30
+
### Multiple instances of the same module type
31
+
To allow multiple instances of the same module type, the module identifier can be chosen arbitrarily. In this case, the actual module type must be specified explicitly using the `moduleType` property.
32
+
Example:
33
+
```json
34
+
"wgu-layerlist1": {
35
+
"moduleType": "wgu-layerlist",
36
+
"target": "menu",
37
+
"win": "floating",
38
+
"draggable": false
39
+
},
40
+
"wgu-layerlist2": {
41
+
"moduleType": "wgu-layerlist",
42
+
"target": "menu",
43
+
"win": "floating",
44
+
"draggable": false
45
+
}
46
+
```
47
+
In this configuration:
48
+
*`wgu-layerlist1` and `wgu-layerlist2` are instance identifiers.
49
+
* Both instances reference the same module type via `"moduleType": "wgu-layerlist"`
50
+
* Wegue will create two independent instances of the `wgu-layerlist` module.
51
+
* Each instance has its own configuration, state, and window (if applicable)
52
+
If `moduleType` is omitted, Wegue assumes that the module identifier itself represents the module type.
53
+
54
+
55
+
#### Note / Limitation:
56
+
While Wegue supports configuring multiple instances of the same module type, stock Wegue components are not guaranteed to be designed for multi-instantiation. Some built-in modules may rely on shared state, global identifiers, or singleton assumptions and may behave incorrectly or unpredictably when instantiated multiple times.
57
+
58
+
Multi-instantiation is therefore primarily intended for custom modules or stock modules that are explicitly designed and validated for this usage. When using multiple instances of a stock module, this behavior should be considered experimental unless otherwise documented.
59
+
60
+
### Common module properties
61
+
17
62
The following properties can be applied to all module types:
18
63
19
64
| Property | Meaning | Example |
20
65
|--------------------|:---------:|---------|
21
66
|**target**| Where should the button to enable/disable the module be rendered. Valid options are `menu` or `toolbar`|`"target": "menu"`|
22
67
|**win**| Value to mark if the module has a window as sub component and where to show the module UI elements. Valid options are `floating` and `sidebar`. If the value is omitted, then the module is not associated with a window. |`"win": "floating"`|
68
+
| moduleType | Optional module type. Required only if different from the module identifier (e.g. for multi-instantiation). | `"moduleType": "wgu-layerlist"`
23
69
| icon | Provide a customized icon for the module. |`"icon": "md:info"`|
24
70
| minimizable | Indicates whether the module window can be minimized. Only applies if a module window is present as indicated by the `win` parameter. |`"minimizable": true`|
25
71
| closable | Indicates whether the module window can be closed by a "X" icon in the window's header bar. Only applies if a module window is present as indicated by the `win` parameter. |`"closable": false`|
0 commit comments