cavalion-vcl 1.1.86 → 1.1.90
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/.md +8 -2
- package/CHANGELOG.md +84 -2
- package/CHATGPT.md +47 -0
- package/README.md +24 -8
- package/docs/Declarative Component Format.md +225 -0
- package/docs/Naming Conventions.md +60 -0
- package/package.json +1 -1
- package/src/Action.js +4 -3
- package/src/Component.js +136 -20
- package/src/Component.query.js +3 -3
- package/src/Control.js +98 -38
- package/src/CssRules.js +6 -32
- package/src/Dragger.js +1 -2
- package/src/Factory.js +6 -2
- package/src/entities/Query.js +73 -5
- package/src/prototypes/App.console.js +54 -7
- package/src/prototypes/App.glassy.js +265 -141
- package/src/prototypes/App.js +22 -1
- package/src/prototypes/App.openform.js +6 -3
- package/src/prototypes/App.toast.js +2 -4
- package/src/prototypes/App.v1.js +55 -13
- package/src/prototypes/App.v2.js +33 -5
- package/src/prototypes/ui/forms/util/Console.js +10 -1
- package/src/ui/Ace.js +70 -2
- package/src/ui/Console.js +3 -2
- package/src/ui/FormContainer.js +2 -2
- package/src/ui/List.js +195 -133
- package/src/ui/ListBody.js +62 -42
- package/src/ui/ListRow.js +1 -1
- package/src/ui/Node.js +21 -0
- package/src/ui/Popup.js +1 -1
- package/src/ui/Select.js +3 -3
- package/src/ui/Tree.js +20 -7
package/.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
* [CHANGELOG.md]() - [README.md]() -[SNIPPETS.md]() - [ISSUES.md]()
|
|
2
2
|
* [.js]() - [src](:/) - [package.json]()
|
|
3
3
|
|
|
4
|
+
>> [ChatGPT suggested source for this document](CHATGPT.md)
|
|
5
|
+
|
|
4
6
|
# cavalion-vcl / classes
|
|
5
7
|
|
|
6
8
|
* [Factory](src/:.js) [.parse](src/Factory:.js) - [Reader](src/:.js) - [Writer](src/:.js)
|
|
@@ -8,7 +10,7 @@
|
|
|
8
10
|
* **[Component](src/:.js)** [.query](src/Component:.js)
|
|
9
11
|
* **[Application](src/:.js)** - **[Action](src/:.js)**
|
|
10
12
|
* [data](src/:/) / [Array](src/data/:.js)
|
|
11
|
-
|
|
13
|
+
* [entities](src/:/) / [Query](src/entities/:.js) - [Instance](src/entities/:.js)
|
|
12
14
|
* **[Control](src/:.js)** < [ui](src/:/) / [Sizer](src/ui/:.js)
|
|
13
15
|
* [Element](src/ui/:.js) < [LargeIcon](src/ui/:.js) << _smdl - alert_
|
|
14
16
|
* [Input](src/ui/:.js) < [Checkbox](src/ui/:.js) - [Combobox](src/ui/:.js) - [DatePicker](src/ui/:.js)
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
* [Popup](src/ui/:.js) - [Ace](src/ui/:.js) - [Console](src/ui/:.js)
|
|
24
26
|
* ( [Form](src/ui/:.js) - [FormContainer](src/ui/:.js) ) _where does onActive/Deactive go?_
|
|
25
27
|
* [List](src/ui/:.js) | [ListColumn](src/ui/:.js) - [ListBody](src/ui/:.js) - [ListFooter](src/ui/:.js) - [ListHeader](src/ui/:.js) - [ListRow](src/ui/:.js)
|
|
26
|
-
* [Tree](src/ui/:.js) - [Node](src/ui/:.js) [.closeable](src/ui/Node:.js)
|
|
28
|
+
* [Tree](src/ui/:.js) - **[Node](src/ui/:.js)** [.closeable](src/ui/Node:.js)
|
|
27
29
|
|
|
28
30
|
# [prototypes](src/:/) `2022/04/17`
|
|
29
31
|
|
|
@@ -55,6 +57,10 @@
|
|
|
55
57
|
* [Query](src/prototypes/ui/entities/:.js) - [.scaffold](src/prototypes/ui/entities/Query:.js) - [scaffold.future](src/prototypes/ui/entities/Query:.js)
|
|
56
58
|
* [QueryFilters](src/prototypes/ui/entities/:.js)
|
|
57
59
|
|
|
60
|
+
# `2025/10/27`
|
|
61
|
+
|
|
62
|
+
[](https://chatgpt.com/codex/tasks/task_e_68ffae27cfd48326bd19cad3da60b005)
|
|
63
|
+
|
|
58
64
|
# `2024/03/24` In the wild: veldapps-gds-devtools@2.0.16
|
|
59
65
|
|
|
60
66
|
* Features dynamic content property :-p
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,86 @@
|
|
|
1
|
+
### `2025/10/27` 1.1.90 — List cell formatting & selection handling
|
|
2
|
+
|
|
3
|
+
* Adds `_formatNumbers: true` and `_renderCellTitles: true` defaults in `List` prototype.
|
|
4
|
+
* Exposes `formatDates`, `formatNumbers`, and `renderCellTitles` as public boolean properties.
|
|
5
|
+
* Adds number formatting: when `typeof value === "number"` and `formatNumbers !== false`, applies `Math.f(value)`.
|
|
6
|
+
* Breaking: numbers are now formatted by default; set `formatNumbers = false` to restore previous raw rendering.
|
|
7
|
+
* Adds optional cell titles: when `renderCellTitles === true`, sets `cell.title` to the rendered value; clears title for empty cells.
|
|
8
|
+
* Preserves date formatting via `formatDates` (still `true` by default).
|
|
9
|
+
* Refactors click selection flow: moves `setSelection(selection)` and `dispatch("click")` outside conditional branches for consistent dispatch.
|
|
10
|
+
* Maintains Ctrl/Cmd toggle and Shift range selection logic; cleans up selection state handling.
|
|
11
|
+
* Adjusts array rendering: joins primitives; for object arrays shows `"%s, ... (%d)"`.
|
|
12
|
+
* Keeps `textContent` vs `innerHTML` rendering path; updates `autoWidth` call unchanged.
|
|
13
|
+
* In `ListRow`, increases selected-row specificity to `"&.selected.selected.selected"` to ensure highlight wins.
|
|
14
|
+
|
|
15
|
+
### `2025/10/27` — onProcessPage
|
|
16
|
+
|
|
17
|
+
* Adds `onProcessPage`-property to Query....
|
|
18
|
+
|
|
19
|
+
### `2025/10/02` 1.1.89
|
|
20
|
+
|
|
21
|
+
**Component: Enhances override handling and specialization utilities**
|
|
22
|
+
|
|
23
|
+
* Improves `override` logic:
|
|
24
|
+
* Functions are now wrapped and bound via selectors as before.
|
|
25
|
+
* Non-function values fall back to direct assignment with a console warning.
|
|
26
|
+
* Adds `chain(name, link)` helper to attach a method while preserving its inherited reference.
|
|
27
|
+
* Refines event override: ensures `onSomeEvent` property-style handlers are set correctly, preparing for inherited chaining support.
|
|
28
|
+
|
|
29
|
+
**Misc UX and robustness tweaks**
|
|
30
|
+
|
|
31
|
+
* **Factory**: Only sets `Method.setInherited` when a previous value exists, avoiding undefined inheritance chains.
|
|
32
|
+
* **Console**: `open-alphaview` now uses `on(evt)`; **Alt** key opens an exploratory selection (All/Roots/Trees/Lists/etc.), otherwise focuses the active Console.
|
|
33
|
+
* **Glassy**: Disables runtime SVG “glass-distortion” injection and related `.distorted` rules (commented out).
|
|
34
|
+
* **App.openform**: Supports `App.openform.prefix` for URI prefixing in both modal and non-modal flows; forwards `sender || this`.
|
|
35
|
+
* **App.toast**: Adds `margin-bottom` animation to `.fade` for smoother collapse.
|
|
36
|
+
* **App.v1**: Removes default zoom CSS class from the main FormContainer.
|
|
37
|
+
|
|
38
|
+
### `2025/07/28`
|
|
39
|
+
|
|
40
|
+
* **Improves `getSpecializer`**
|
|
41
|
+
Split into `getSpecializer_raw` and `getSpecializer`, adding fallback logic using `Component.getFactories()` when no specializer is found.
|
|
42
|
+
|
|
43
|
+
* **Improves event binding in `Component.js`**
|
|
44
|
+
Wraps event handlers in a function (`f`) that retains the original `method` and applies `Method.setName` and `Method.setInherited` when appropriate.
|
|
45
|
+
|
|
46
|
+
* **Cleans up `CssRules.js`**
|
|
47
|
+
Removes empty JSDoc comments and adds commented-out placeholder logic for empty CSS selectors.
|
|
48
|
+
|
|
49
|
+
* **Improves `Factory.js` property method handling**
|
|
50
|
+
Calls `Method.setInherited` only when the property already has a value.
|
|
51
|
+
|
|
52
|
+
* **Improves `open-alphaview` hotkey behavior**
|
|
53
|
+
Differentiates between Alt + MetaCtrl+F3 and MetaCtrl+F3, showing an extended selection list (`All`, `Application`, `Roots`, etc.) when Alt is pressed.
|
|
54
|
+
|
|
55
|
+
* **Improves toast transition**
|
|
56
|
+
Adds `margin-bottom 250ms ease-in` to the `.fade` transition.
|
|
57
|
+
|
|
58
|
+
* **Adds `H.i` shortcut in Console utilities**
|
|
59
|
+
Enables quick opening of `devtools/Alphaview.csv` with a preselected object.
|
|
60
|
+
|
|
61
|
+
### `2025/06/25` - 1.1.88
|
|
62
|
+
|
|
63
|
+
* improves/refactores/cleans css styles
|
|
64
|
+
* updates tree node styles prevents NOde to become selected when .close is clicked
|
|
65
|
+
* sets z-index above Hover<>
|
|
66
|
+
* introduces selection-hover class selects parent upon destroy while selected
|
|
67
|
+
* generalizes sorting
|
|
68
|
+
* improves H() to accept opts
|
|
69
|
+
* reinstates (dedeprecates) Component.prototype.findOwner introduces Component.up(ctor) => findOwner
|
|
70
|
+
* tweaks default zoom settings for mac and win (125% and 109%)
|
|
71
|
+
* adds better support for Windows
|
|
72
|
+
|
|
73
|
+
### `2025/06/08` - 1.1.87
|
|
74
|
+
|
|
75
|
+
* enhances nodeNeeded to return node by name introduces qsan() as an alias to qsna() enhances click event handling
|
|
76
|
+
* adds support reloading cavalion-blocks<>-components with click-gesture
|
|
77
|
+
* finds #console more consistently and uses H()
|
|
78
|
+
* fixes sorting issue
|
|
79
|
+
* fixes an issue where getValue() was not consistent with _node.value
|
|
80
|
+
* adds specific styles for input elements in Safari updates general styles
|
|
81
|
+
* fixes the regexp-behaviour matching attribute values adds support for Action go()
|
|
82
|
+
* introduces support for setInterval (like setTimeout) adds get/set/has/clear/Interval and clearIntervals
|
|
83
|
+
|
|
1
84
|
### `2025/04/03` - 1.1.86
|
|
2
85
|
|
|
3
86
|
* 20250403 fixes bug in sorting by column (List) improves selecting console nodes with keyboard
|
|
@@ -88,7 +171,6 @@
|
|
|
88
171
|
|
|
89
172
|
* **App.v1**: Hacking CSS - makes Hovers closing X hardly visible, appears when hovered
|
|
90
173
|
|
|
91
|
-
|
|
92
174
|
### `2023/10/06` - 1.1.79
|
|
93
175
|
|
|
94
176
|
* **List**: Introduces options for behaviour of auto creating columns updates sorting updates auto-widthing updates the docs
|
|
@@ -103,7 +185,7 @@
|
|
|
103
185
|
* comments
|
|
104
186
|
* see previous comment
|
|
105
187
|
* :root => isRootComponent enchances toasting Sizer selection
|
|
106
|
-
* fixes reloadChildNodes-situation changes behavior of ui/Console, ignores
|
|
188
|
+
* fixes reloadChildNodes-situation changes behavior of ui/Console, ignores \<a>nchors, activates console on dblclick
|
|
107
189
|
* adds css styles to App.v1 simplifies code
|
|
108
190
|
* adds css styles to App.v1 simplifies code
|
|
109
191
|
* adjusts Component:setTimeout to automatically name unnamed timeout fixes Control:selectVisible which was pretty buggy - noticeably when trying to make workspace console or navigator visible fixes Node:childNodesNeeded so that callback is made correctly (fixes Cmd+F10 #resource-focus as well)
|
package/CHATGPT.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# [prototypes][3] `2022/04/17`
|
|
2
|
+
|
|
3
|
+
>
|
|
4
|
+
* [cavalion-blocks][4]
|
|
5
|
+
* [App][5] - <= _#window is instantiated here (weirdly not in .desktop)_
|
|
6
|
+
* [.console][5] << _hotkeys_ _probably deprecated_
|
|
7
|
+
* [.desktop][5] << _#client [ui/forms/Portal<>][9]_ _used at all?_
|
|
8
|
+
* [.framework7][5] - [.scaffold][5]
|
|
9
|
+
* [.v1][5] - <= _#client [ui/forms/Portal<>][9]_ _(used by cavalion-code and veldoffice-vcl-comps)_
|
|
10
|
+
* [.v2][5] - <= _Main<>_
|
|
11
|
+
* [.glassy][5] [.openform][5] [.toast][5]
|
|
12
|
+
* [make][3] / [Build][7]
|
|
13
|
+
* [ui][9]
|
|
14
|
+
* [Form][10] - [forms][9]
|
|
15
|
+
* [Home][11] [.list][11] [.tree][11]
|
|
16
|
+
* [Portal][9] - [View][9]
|
|
17
|
+
* [util][12] / [Console][13] - << _used by cavalion-code and veldoffice-MODULE-vcl_
|
|
18
|
+
* [controls][9] / [SizeHandle][15] - [Toolbar][15]
|
|
19
|
+
* [dygraphs][9] / [LineChart][17] - [Timeline][17] - _deprecated?_
|
|
20
|
+
* [entities][18]
|
|
21
|
+
* [AttributeInput][19]
|
|
22
|
+
* [.@checkbox][19] - [.@input][19] - [.@textarea][19] - [.boolean][19] - [.date][19] - [.double][19]
|
|
23
|
+
[.int][19] - [.long][19] - [.ref][19] - [.scaffold][19] - [.set][19] - [.string][19] - [.text][19] - [.timestamp][19]
|
|
24
|
+
* [Edit][20] - [.modal][20] - [.scaffold][20]
|
|
25
|
+
* [Home][18]
|
|
26
|
+
* [Instance][18]
|
|
27
|
+
* [ModelNavigator][18]
|
|
28
|
+
* [Query][21] - [.scaffold][21] - [scaffold.future][21]
|
|
29
|
+
* [QueryFilters][18]
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
|
|
33
|
+
[3]: src/prototypes/:/
|
|
34
|
+
[4]: src/prototypes/:.js
|
|
35
|
+
[5]: src/prototypes/App:.js
|
|
36
|
+
[7]: src/prototypes/make/:.js
|
|
37
|
+
[9]: src/prototypes/ui/:/
|
|
38
|
+
[10]: src/prototypes/ui/:.js
|
|
39
|
+
[11]: src/prototypes/ui/forms/:.js
|
|
40
|
+
[12]: src/prototypes/ui/forms/:/
|
|
41
|
+
[13]: src/prototypes/ui/forms/util/:.js
|
|
42
|
+
[15]: src/prototypes/ui/controls/:.js
|
|
43
|
+
[17]: src/prototypes/ui/dygraphs/:.js
|
|
44
|
+
[18]: src/prototypes/ui/entities/:.js
|
|
45
|
+
[19]: src/prototypes/ui/entities/AttributeInput:.js
|
|
46
|
+
[20]: src/prototypes/ui/entities/Edit:.js
|
|
47
|
+
[21]: src/prototypes/ui/entities/Query:.js
|
package/README.md
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
* [Declarative Component Format.md](docs/:)
|
|
2
|
+
* [Naming Conventions.md](docs/:)
|
|
3
|
+
* ...
|
|
2
4
|
|
|
3
|
-
#
|
|
5
|
+
# cavalion-vcl
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
This packages is inspired by [Visual Component Library](https://en.wikipedia.org/wiki/Visual_Component_Library) and consists of a lightweight, modular UI framework built on top of a JavaScript component model. It is designed to support the development of browser-based applications.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Component model
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## Declarative
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
* autoSize: height;
|
|
13
|
+
In cavalion-vcl UIs are defined declaratively in JavaScript by structuring trees of arrays and objects. At runtime these definitions are parsed and can be instantiated at will into live components.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
A [declarative way to define user interfaces](docs/Declarative%20Component%20Format.md) using JavaScript-class-based components, supporting dynamic behavior, event handling and layout composition.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
The framework emphasizes reusability and flexibility, allowing developers to extend or override behavior via multiple inheritance and lifecycle hooks.
|
|
21
|
+
|
|
22
|
+
It integrates well with tools like OpenLayers and AmCharts for building rich, data-driven applications.
|
|
23
|
+
|
|
24
|
+
## Specializations
|
|
25
|
+
|
|
26
|
+
For instance, consider a componentclass "veldapps/ListOf" and custom piece of might want to instantiate a list of projects by passing on the following
|
|
27
|
+
|
|
28
|
+
["veldapps/ListOf<Project>"]
|
|
29
|
+
|
|
30
|
+
## Designers
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
* `inherits` can refer to a component-class or a component(-prototype)
|
|
2
|
+
* `inherits` can refer to a "inherited"-component
|
|
3
|
+
* `#button-calculate` - specific calculation example
|
|
4
|
+
* `inherits` can be implicit ("")
|
|
5
|
+
* `inherits` can be specialized automatically by <>
|
|
6
|
+
|
|
7
|
+
### Concepts
|
|
8
|
+
|
|
9
|
+
* Factory: source, uri, root component, specializer,
|
|
10
|
+
* Component: properties, children, parent, owner, name
|
|
11
|
+
* Component.query: qs(), qsa(), ud(), udr(), ...
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Declarative Component Format
|
|
15
|
+
|
|
16
|
+
Cavalion allows defining UI trees using **JavaScript arrays** that are parsed into live components by `Factory.parse`. This format supports **shorthand syntax**, **nesting**, and **metadata injection**, and is parsed at runtime into full component objects.
|
|
17
|
+
|
|
18
|
+
### Core Syntax
|
|
19
|
+
|
|
20
|
+
The declarative syntax supports several variations, all eventually parsed into this full form:
|
|
21
|
+
|
|
22
|
+
> ```js
|
|
23
|
+
{
|
|
24
|
+
inherits: ["vcl/ui/Panel"], // or: className: "vcl/ui/Panel"
|
|
25
|
+
name: "mainPanel",
|
|
26
|
+
properties: { align: "client", css: "background: red;" },
|
|
27
|
+
children: [ /* ... nested components ... */ ]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
#### Common shorthand
|
|
32
|
+
|
|
33
|
+
> ```js
|
|
34
|
+
["vcl/ui/Panel", "mainPanel", { align: "client" }, [
|
|
35
|
+
["vcl/ui/Button", "myButton", { content: "Click me!" }]
|
|
36
|
+
]]
|
|
37
|
+
|
|
38
|
+
Is parsed into:
|
|
39
|
+
|
|
40
|
+
> ```js
|
|
41
|
+
{
|
|
42
|
+
inherits: ["vcl/ui/Panel"],
|
|
43
|
+
name: "mainPanel",
|
|
44
|
+
properties: { align: "client" },
|
|
45
|
+
children: [
|
|
46
|
+
{
|
|
47
|
+
inherits: ["vcl/ui/Button"],
|
|
48
|
+
name: "myButton",
|
|
49
|
+
properties: { content: "Click me!" },
|
|
50
|
+
children: []
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
### How parsing works
|
|
56
|
+
|
|
57
|
+
#### In `vcl/Factory.parse.js` and `blocks/Factory.parse.js`:
|
|
58
|
+
|
|
59
|
+
* Both define a recursive parser function `$()` that:
|
|
60
|
+
|
|
61
|
+
* Normalizes input like `["Class", "name", { props }, [ children ]]`
|
|
62
|
+
* Defaults missing fields (`name`, `properties`, `children`)
|
|
63
|
+
* Converts short strings like `"vcl-panel"` into full `"vcl/ui/Panel"`
|
|
64
|
+
* Converts `"vcl/ui/Panel#main"` → `className = "vcl/ui/Panel", name = "main"`
|
|
65
|
+
* Supports `"@uri"` syntax (via `PropertyValue`) for lazy-loading properties
|
|
66
|
+
|
|
67
|
+
#### Blocks factory:
|
|
68
|
+
|
|
69
|
+
* Adds additional logic for `inherits`, replacing `<>` with real prototype URIs.
|
|
70
|
+
* Also supports resolving blocks as base templates.
|
|
71
|
+
|
|
72
|
+
## Describing VCL Components with Arrays
|
|
73
|
+
|
|
74
|
+
Cavalion-VCL uses a flexible **array-based declarative syntax** to define components. These arrays are parsed by `vcl/Factory.parse` into a component tree. The parser normalizes various syntaxes into a unified structure.
|
|
75
|
+
|
|
76
|
+
### Supported Formats
|
|
77
|
+
|
|
78
|
+
#### 1. Full object structure (normalized form)
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
{
|
|
82
|
+
inherits: ["vcl/ui/Button"],
|
|
83
|
+
name: "button-save",
|
|
84
|
+
properties: { content: "Save", align: "left" },
|
|
85
|
+
children: []
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
This is the canonical form resulting from parsing.
|
|
90
|
+
|
|
91
|
+
#### 2. Shorthand array form
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
["vcl/ui/Button", "button-save", { content: "Save" }]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This gets expanded to the full object above. Fields can be omitted:
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
["vcl/ui/Panel"] // Only inherits
|
|
101
|
+
["vcl/ui/Panel", "main"] // Inherits and name
|
|
102
|
+
["vcl/ui/Panel", { align: "top" }] // Inherits and properties
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### 3. Children as fourth parameter
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
["vcl/ui/Panel", "main", { align: "client" }, [
|
|
109
|
+
["vcl/ui/Label", "label-status", { content: "Status" }]
|
|
110
|
+
]]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
This represents a nested component tree.
|
|
114
|
+
|
|
115
|
+
#### 4. Only children (used for inheritance cases)
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
[["vcl/ui/Label", "label1"], ["vcl/ui/Label", "label2"]]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
This is interpreted as children of a root panel when no explicit root is defined. The parser wraps this in a root component.
|
|
122
|
+
|
|
123
|
+
#### 5. Special string-based syntax (less common)
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
["vcl/ui/Panel#main"]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Is split into:
|
|
130
|
+
|
|
131
|
+
* `className`: `"vcl/ui/Panel"`
|
|
132
|
+
* `name`: `"main"`
|
|
133
|
+
|
|
134
|
+
Also supported:
|
|
135
|
+
|
|
136
|
+
* `"@some/uri"` → a `PropertyValue` (lazy-resolved)
|
|
137
|
+
* `"vcl-panel"` → shorthand expanded to `vcl/ui/Panel`
|
|
138
|
+
|
|
139
|
+
## The Root Component
|
|
140
|
+
|
|
141
|
+
In `Factory.parse.js`, the **root-component** is the **top-level component** of the resulting UI tree. It is the entry point that wraps or defines the rest of the hierarchy.
|
|
142
|
+
|
|
143
|
+
### Responsibilities of the root component:
|
|
144
|
+
|
|
145
|
+
* Owns the component tree (via `.children`)
|
|
146
|
+
* Defines the context for inherited prototypes or classes
|
|
147
|
+
* Provides `uri`, `inherits`, and optionally a `className`
|
|
148
|
+
|
|
149
|
+
### Automatic root wrapping
|
|
150
|
+
|
|
151
|
+
If the source is a list of children (i.e., an array of arrays), the factory will automatically wrap them in a root component of class `vcl/Component` or another default.
|
|
152
|
+
|
|
153
|
+
Example:
|
|
154
|
+
|
|
155
|
+
```js
|
|
156
|
+
// This is not a complete component
|
|
157
|
+
[
|
|
158
|
+
["vcl/ui/Button", "btn-1"],
|
|
159
|
+
["vcl/ui/Button", "btn-2"]
|
|
160
|
+
]
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
→ Is wrapped as:
|
|
164
|
+
|
|
165
|
+
```js
|
|
166
|
+
{
|
|
167
|
+
inherits: ["vcl/Component"],
|
|
168
|
+
children: [
|
|
169
|
+
{ inherits: ["vcl/ui/Button"], name: "btn-1", properties: {} },
|
|
170
|
+
{ inherits: ["vcl/ui/Button"], name: "btn-2", properties: {} }
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
This wrapper becomes the **root**.
|
|
176
|
+
|
|
177
|
+
## Summary
|
|
178
|
+
|
|
179
|
+
| Form | Description |
|
|
180
|
+
| --------------------------------- | ------------------------------- |
|
|
181
|
+
| `["Class"]` | Class only |
|
|
182
|
+
| `["Class", "name"]` | Class and name |
|
|
183
|
+
| `["Class", { props }]` | Class with properties |
|
|
184
|
+
| `["Class", "name", { props }]` | Full definition |
|
|
185
|
+
| `["Class", ..., ..., [children]]` | With nested children |
|
|
186
|
+
| `[ [child1], [child2] ]` | Implicit root wrapping |
|
|
187
|
+
| `@uri` or `#name` | Special PropertyValue reference |
|
|
188
|
+
|
|
189
|
+
The root component ensures the component tree is properly anchored, parsed, and linked to a source URI and inheritance chain.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
## Best Practices (Initial Draft)
|
|
193
|
+
|
|
194
|
+
Here are best practices based on how the parser and component model work:
|
|
195
|
+
|
|
196
|
+
### Naming
|
|
197
|
+
|
|
198
|
+
* Use **camelCase** for component `name` fields: `mainPanel`, `submitBtn`.
|
|
199
|
+
* Use **meaningful names** for `id`s and `actions` to support `qs`/`ud` querying.
|
|
200
|
+
|
|
201
|
+
### Structure
|
|
202
|
+
|
|
203
|
+
* Prefer **flat, readable hierarchies** over deeply nested ones. If logic grows complex, extract nested arrays into separate `.js` files and `require` them.
|
|
204
|
+
* Use folders to group component categories (`ui`, `actions`, `forms`, etc.)
|
|
205
|
+
|
|
206
|
+
### Styling
|
|
207
|
+
|
|
208
|
+
* Use `css: "..."` for inline styles that override existing class styles.
|
|
209
|
+
* Avoid `style: {}` unless dynamically updated in JS.
|
|
210
|
+
* For layout, standardize usage: `align: "client"`, `width: 200`, etc.
|
|
211
|
+
|
|
212
|
+
### Localization
|
|
213
|
+
|
|
214
|
+
* Wrap visible text using `locale("key")`, e.g., `{ content: locale("save_button") }`
|
|
215
|
+
* Store localized strings in a separate dictionary module (e.g., `locale/nl.js`)
|
|
216
|
+
|
|
217
|
+
### Customization
|
|
218
|
+
|
|
219
|
+
* Use `vars: {}` to inject configuration into subcomponents
|
|
220
|
+
* Use `onLoad`, `onRender`, `onDispatchChildEvent` for lifecycle hooks
|
|
221
|
+
* Define `overrides` when extending functionality with existing base components
|
|
222
|
+
|
|
223
|
+
### Reuse
|
|
224
|
+
|
|
225
|
+
* Define shared UI fragments (e.g., button toolbars, sidebars) as standalone `.js` blocks and `require()` or `["./SubComponent"]` them into parents.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
## Naming Conventions
|
|
2
|
+
|
|
3
|
+
* **Use kebab-case**: lowercase words separated by dashes.
|
|
4
|
+
* **Prefix with component type**: e.g. `button-close`, `input-username`, `tab-editor`.
|
|
5
|
+
* **Be specific and semantic**: avoid `button1`, prefer `button-generate`.
|
|
6
|
+
* **Avoid underscores and camelCase**: stick to `input-sample-id`, not `input_sampleId`.
|
|
7
|
+
* **Consistent structure**: `[type]-[purpose]-[modifier]` (modifier optional).
|
|
8
|
+
* **Names should be easily queryable**: via `qs()` or `ud()` in code.
|
|
9
|
+
|
|
10
|
+
Standardized names improve clarity, maintainability, and tooling support in Cavalion’s declarative UI framework.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### General Pattern
|
|
14
|
+
|
|
15
|
+
Component names follow the pattern:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
[type]-[specific-purpose]-[optional-modifier]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This structure provides clarity, supports query-based access via `qs()` or `ud()`, and ensures semantic meaning.
|
|
22
|
+
|
|
23
|
+
### Examples
|
|
24
|
+
|
|
25
|
+
| Type | Name | Meaning |
|
|
26
|
+
| -------- | ------------------ | ----------------------------------------- |
|
|
27
|
+
| `button` | `button-close` | A button intended to close something |
|
|
28
|
+
| `input` | `input-username` | Input field for username |
|
|
29
|
+
| `group` | `group-failure` | A logical group of related UI elements |
|
|
30
|
+
| `tab` | `tab-measurements` | A tab control labeled “Measurements” |
|
|
31
|
+
| `select` | `select-sample-1` | A dropdown for selecting the first sample |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### Guidelines
|
|
36
|
+
|
|
37
|
+
#### 1. Casing and separators
|
|
38
|
+
|
|
39
|
+
* Use **kebab-case** (lowercase with dashes)
|
|
40
|
+
* Avoid underscores (`_`) or camelCase
|
|
41
|
+
* Keep naming consistent across modules
|
|
42
|
+
|
|
43
|
+
#### 2. Type-prefixing
|
|
44
|
+
|
|
45
|
+
Prefix names with the **component type** (e.g., `button-`, `group-`, `input-`) to:
|
|
46
|
+
|
|
47
|
+
* Improve readability
|
|
48
|
+
* Support filtering and pattern matching
|
|
49
|
+
* Prevent naming collisions
|
|
50
|
+
|
|
51
|
+
#### 3. Specificity
|
|
52
|
+
|
|
53
|
+
* Use clear, purpose-based identifiers (`button-generate`, `input-stage-index`)
|
|
54
|
+
* Avoid ambiguous or generic names (`button1`, `tab1`, etc.)
|
|
55
|
+
|
|
56
|
+
#### 4. Modifiers
|
|
57
|
+
|
|
58
|
+
* Append modifiers if needed to indicate context or variation
|
|
59
|
+
* Examples: `input-weight-readonly`, `tab-config-alt`
|
|
60
|
+
|
package/package.json
CHANGED
package/src/Action.js
CHANGED
|
@@ -62,9 +62,10 @@ define(function (require) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
go: function() {
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
go: function(opts) {
|
|
66
|
+
if(this.isEnabled() && this.isVisible()) {
|
|
67
|
+
return this.execute.apply(this, arguments);
|
|
68
|
+
}
|
|
68
69
|
},
|
|
69
70
|
execute: function (evt, sender) {
|
|
70
71
|
return this.onexecute(evt, sender);
|