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 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
- [![LIVE DOCS](https://img.shields.io/badge/LIVE-DOCUMENTATION-blue?style=for-the-badge)](https://keshavsoft.github.io/declarative-spec/)
7
- [![NPM](https://img.shields.io/badge/NPM-PACKAGE-CB3837?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/declarative-spec)
8
- [![GITHUB](https://img.shields.io/badge/GITHUB-REPOSITORY-181717?style=for-the-badge&logo=github)](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
+ [![LIVE DOCS](https://img.shields.io/badge/LIVE-DOCUMENTATION-blue?style=for-the-badge)](https://keshavsoft.github.io/declarative-spec/)
7
+ [![NPM](https://img.shields.io/badge/NPM-PACKAGE-CB3837?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/declarative-spec)
8
+ [![GITHUB](https://img.shields.io/badge/GITHUB-REPOSITORY-181717?style=for-the-badge&logo=github)](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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "declarative-spec",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "description": "High-level declarative UI component blueprints, option configurations, and assembly contracts for JSON-to-DOM compilers.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { default } from "./v7/index.js";
1
+ export { default } from "./v8/index.js";
2
2
 
3
- export * from "./v7/index.js";
3
+ export * from "./v8/index.js";
@@ -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.
@@ -0,0 +1,8 @@
1
+ import spec from "./spec.json" with { type: "json" };
2
+ import meta from "./meta.js";
3
+ import registerGlobal from "./register.js";
4
+
5
+ export { spec, meta };
6
+ export default spec;
7
+
8
+ registerGlobal(spec);
package/src/v8/meta.js ADDED
@@ -0,0 +1,6 @@
1
+ export const meta = {
2
+ name: "declarative-spec",
3
+ version: "1.8.1"
4
+ };
5
+
6
+ export default meta;
@@ -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;