declarative-spec 1.7.1 → 1.8.1
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 +105 -105
- package/package.json +1 -1
- package/src/index.js +2 -2
- package/src/v8/README.md +13 -0
- package/src/v8/index.js +8 -0
- package/src/v8/meta.js +6 -0
- package/src/v8/register.js +11 -0
- package/src/v8/spec.json +2612 -0
package/README.md
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
# declarative-spec
|
|
2
|
-
|
|
3
|
-
> **Canonical HTML DOM tag specifications, default utility classes, attributes, and interpolation tokens for declarative JSON-to-DOM compilers.**
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
[](https://keshavsoft.github.io/declarative-spec/)
|
|
7
|
-
[](https://www.npmjs.com/package/declarative-spec)
|
|
8
|
-
[](https://github.com/keshavsoft/declarative-spec)
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
Part of the **KeshavSoft Declarative UI Architecture** (Tier 2: DOM Tag Specifications).
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 📖 The Story
|
|
16
|
-
|
|
17
|
-
In modern web development, tag structures are often tightly coupled to JavaScript frameworks (JSX, Vue templates, or string templates).
|
|
18
|
-
|
|
19
|
-
`declarative-spec` decouples raw HTML elements into **pure, serializable JSON blueprints**:
|
|
20
|
-
1. **Zero Runtime Dependency**: Defines HTML primitives (`<table>`, `<th>`, `<td>`, `<select>`, `<button>`) with serializable attributes and utility classes.
|
|
21
|
-
2. **String Interpolation Tokens**: Supports dynamic placeholder tokens (`${columnName}`) that compilers can hydrate without hardcoding DOM manipulation.
|
|
22
|
-
3. **Engine Agnostic**: Can be compiled into native DOM elements, Virtual DOM nodes, or server-side HTML strings.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## 📦 Installation
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install declarative-spec
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## 🚀 Usage
|
|
35
|
-
|
|
36
|
-
### 1. Import Spec in ES Modules
|
|
37
|
-
|
|
38
|
-
```javascript
|
|
39
|
-
import spec from "declarative-spec";
|
|
40
|
-
|
|
41
|
-
// Inspect a base tag specification
|
|
42
|
-
console.log(spec.tableSimple);
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### 2. Import Specific Version
|
|
46
|
-
|
|
47
|
-
```javascript
|
|
48
|
-
import spec from "declarative-spec/v1";
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### 3. Direct JSON Import
|
|
52
|
-
|
|
53
|
-
```javascript
|
|
54
|
-
import spec from "declarative-spec/spec.json" with { type: "json" };
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## 🏛️ Tag Spec Blueprint Example
|
|
60
|
-
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"tableSimple": {
|
|
64
|
-
"tag": "table",
|
|
65
|
-
"attributes": {
|
|
66
|
-
"class": "table table-bordered table-striped"
|
|
67
|
-
},
|
|
68
|
-
"children": []
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## 🌐 Interactive Monaco Studio & Documentation
|
|
76
|
-
|
|
77
|
-
Explore, edit, and inspect all tag blueprints live in Monaco:
|
|
78
|
-
* **Documentation & Story:** [https://keshavsoft.github.io/declarative-spec/](https://keshavsoft.github.io/declarative-spec/)
|
|
79
|
-
* **Monaco Spec Studio:** [https://keshavsoft.github.io/declarative-spec/monaco/v1/](https://keshavsoft.github.io/declarative-spec/monaco/v1/)
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## 📄 License
|
|
84
|
-
|
|
85
|
-
MIT © [KeshavSoft](https://github.com/keshavsoft)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
## V7 — Declarative Spec Sample Lab
|
|
89
|
-
|
|
90
|
-
V7 preserves the V6 catalogue and adds the class-based Bootstrap Header specification. It also introduces a dedicated sample lab: **one isolated folder for every top-level V7 specification entry**.
|
|
91
|
-
|
|
92
|
-
- [V7 documentation](docs/v7/)
|
|
93
|
-
- [V7 sample catalogue](samples/v7/)
|
|
94
|
-
- [Canonical V7 JSON](src/v7/spec.json)
|
|
95
|
-
- [Published V7 JSON](docs/json/v7/spec.json)
|
|
96
|
-
|
|
97
|
-
The lab contains 91 individual sample folders covering all 91 catalogue entries and 30 distinct HTML tag names. Each sample loads its own `example.json` over HTTP and renders the declared DOM structure. These are structural usage tests; application-specific behavior such as sorting, data population, and form submission remains with the consuming renderer/application.
|
|
98
|
-
|
|
99
|
-
Start a local static server from the repository root:
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
npx http-server .
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Then open `http://localhost:8080/samples/v7/`.
|
|
1
|
+
# declarative-spec
|
|
2
|
+
|
|
3
|
+
> **Canonical HTML DOM tag specifications, default utility classes, attributes, and interpolation tokens for declarative JSON-to-DOM compilers.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
[](https://keshavsoft.github.io/declarative-spec/)
|
|
7
|
+
[](https://www.npmjs.com/package/declarative-spec)
|
|
8
|
+
[](https://github.com/keshavsoft/declarative-spec)
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Part of the **KeshavSoft Declarative UI Architecture** (Tier 2: DOM Tag Specifications).
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 📖 The Story
|
|
16
|
+
|
|
17
|
+
In modern web development, tag structures are often tightly coupled to JavaScript frameworks (JSX, Vue templates, or string templates).
|
|
18
|
+
|
|
19
|
+
`declarative-spec` decouples raw HTML elements into **pure, serializable JSON blueprints**:
|
|
20
|
+
1. **Zero Runtime Dependency**: Defines HTML primitives (`<table>`, `<th>`, `<td>`, `<select>`, `<button>`) with serializable attributes and utility classes.
|
|
21
|
+
2. **String Interpolation Tokens**: Supports dynamic placeholder tokens (`${columnName}`) that compilers can hydrate without hardcoding DOM manipulation.
|
|
22
|
+
3. **Engine Agnostic**: Can be compiled into native DOM elements, Virtual DOM nodes, or server-side HTML strings.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 📦 Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install declarative-spec
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🚀 Usage
|
|
35
|
+
|
|
36
|
+
### 1. Import Spec in ES Modules
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import spec from "declarative-spec";
|
|
40
|
+
|
|
41
|
+
// Inspect a base tag specification
|
|
42
|
+
console.log(spec.tableSimple);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Import Specific Version
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
import spec from "declarative-spec/v1";
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 3. Direct JSON Import
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
import spec from "declarative-spec/spec.json" with { type: "json" };
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 🏛️ Tag Spec Blueprint Example
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"tableSimple": {
|
|
64
|
+
"tag": "table",
|
|
65
|
+
"attributes": {
|
|
66
|
+
"class": "table table-bordered table-striped"
|
|
67
|
+
},
|
|
68
|
+
"children": []
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 🌐 Interactive Monaco Studio & Documentation
|
|
76
|
+
|
|
77
|
+
Explore, edit, and inspect all tag blueprints live in Monaco:
|
|
78
|
+
* **Documentation & Story:** [https://keshavsoft.github.io/declarative-spec/](https://keshavsoft.github.io/declarative-spec/)
|
|
79
|
+
* **Monaco Spec Studio:** [https://keshavsoft.github.io/declarative-spec/monaco/v1/](https://keshavsoft.github.io/declarative-spec/monaco/v1/)
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 📄 License
|
|
84
|
+
|
|
85
|
+
MIT © [KeshavSoft](https://github.com/keshavsoft)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## V7 — Declarative Spec Sample Lab
|
|
89
|
+
|
|
90
|
+
V7 preserves the V6 catalogue and adds the class-based Bootstrap Header specification. It also introduces a dedicated sample lab: **one isolated folder for every top-level V7 specification entry**.
|
|
91
|
+
|
|
92
|
+
- [V7 documentation](docs/v7/)
|
|
93
|
+
- [V7 sample catalogue](samples/v7/)
|
|
94
|
+
- [Canonical V7 JSON](src/v7/spec.json)
|
|
95
|
+
- [Published V7 JSON](docs/json/v7/spec.json)
|
|
96
|
+
|
|
97
|
+
The lab contains 91 individual sample folders covering all 91 catalogue entries and 30 distinct HTML tag names. Each sample loads its own `example.json` over HTTP and renders the declared DOM structure. These are structural usage tests; application-specific behavior such as sorting, data population, and form submission remains with the consuming renderer/application.
|
|
98
|
+
|
|
99
|
+
Start a local static server from the repository root:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npx http-server .
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Then open `http://localhost:8080/samples/v7/`.
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default } from "./
|
|
1
|
+
export { default } from "./v8/index.js";
|
|
2
2
|
|
|
3
|
-
export * from "./
|
|
3
|
+
export * from "./v8/index.js";
|
package/src/v8/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Declarative Spec V7
|
|
2
|
+
|
|
3
|
+
V7 preserves all V6 specifications and adds `bootstrapHeader`.
|
|
4
|
+
|
|
5
|
+
`bootstrapHeader` models the Bootstrap navigation header from the Monaco V2 example. Inline SVG elements have been replaced with Bootstrap Icons class-based `<i>` elements:
|
|
6
|
+
|
|
7
|
+
- Brand: `bi bi-bootstrap-fill`
|
|
8
|
+
- Home: `bi bi-house`
|
|
9
|
+
- Render: `bi bi-table`
|
|
10
|
+
|
|
11
|
+
The Render anchor retains `id="renderId"` for the existing JavaScript binding contract.
|
|
12
|
+
|
|
13
|
+
See [`samples/bootstrap-header/v7`](../../samples/bootstrap-header/v7/) for a runnable sample.
|
package/src/v8/index.js
ADDED
package/src/v8/meta.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import meta from "./meta.js";
|
|
2
|
+
|
|
3
|
+
const registerGlobal = (spec) => {
|
|
4
|
+
if (typeof globalThis === "undefined") return;
|
|
5
|
+
|
|
6
|
+
globalThis.ks ??= {};
|
|
7
|
+
globalThis.ks.declarative ??= {};
|
|
8
|
+
globalThis.ks.declarative.spec = { meta, data: spec };
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default registerGlobal;
|