json-to-spec 19.1.0
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 +118 -0
- package/docs/demo.html +426 -0
- package/docs/dist/min.js +164 -0
- package/docs/dist/v1/min.js +124 -0
- package/docs/dist/v17/min.js +355 -0
- package/docs/dist/v18/min.js +160 -0
- package/docs/dist/v19/min.js +164 -0
- package/docs/dist/v2/min.js +129 -0
- package/docs/dist/v3/min.js +201 -0
- package/docs/index.html +248 -0
- package/docs/pages/architecture.html +115 -0
- package/docs/pages/how-it-works.html +125 -0
- package/docs/pages/what-not.html +100 -0
- package/docs/pages/what.html +105 -0
- package/docs/pages/why.html +88 -0
- package/docs/samples/form.html +265 -0
- package/docs/samples/index.html +112 -0
- package/docs/samples/table.html +306 -0
- package/index.js +2 -0
- package/package.json +50 -0
- package/samples/dataList/index.html +31 -0
- package/samples/dataList/index.js +62 -0
- package/samples/dataList/input/data.json +5043 -0
- package/samples/dataList/input/structure.json +38 -0
- package/samples/dataList copy/index.html +30 -0
- package/samples/dataList copy/index.js +61 -0
- package/samples/dataList copy/input/data.json +35307 -0
- package/samples/dataList copy/input/structure.json +18 -0
- package/samples/form/index.html +29 -0
- package/samples/form/index.js +64 -0
- package/samples/form/input/data.json +9 -0
- package/samples/form/input/structure.json +192 -0
- package/samples/form-/data.json +42 -0
- package/samples/form-/structure.json +110 -0
- package/samples/select/index.html +31 -0
- package/samples/select/index.js +61 -0
- package/samples/select/input/data.json +35287 -0
- package/samples/select/input/select.json +18 -0
- package/samples/select/input/structure.json +47 -0
- package/samples/table/index.html +29 -0
- package/samples/table/index.js +61 -0
- package/samples/table/input/data.json +35287 -0
- package/samples/table/input/structure copy.json +47 -0
- package/samples/table/input/structure.json +86 -0
- package/samples/table/input/table.json +135 -0
- package/samples/table-/data.json +68 -0
- package/samples/table-/structure.json +235 -0
- package/src/index.js +2 -0
- package/src/v10/index.js +96 -0
- package/src/v10/instructionEngine/compile/compileTree.js +191 -0
- package/src/v10/instructionEngine/compileTree.js +1 -0
- package/src/v10/instructionEngine/expandIteration.js +1 -0
- package/src/v10/instructionEngine/index.js +29 -0
- package/src/v10/instructionEngine/interpolate.js +2 -0
- package/src/v10/instructionEngine/iteration/expandIteration.js +95 -0
- package/src/v10/instructionEngine/operation/operation.js +237 -0
- package/src/v10/instructionEngine/other/other.js +150 -0
- package/src/v10/instructionEngine/pipeline/pipeline.js +47 -0
- package/src/v10/instructionEngine/replace/replace.js +173 -0
- package/src/v10/instructionEngine/resolve/resolvePath.js +18 -0
- package/src/v10/instructionEngine/resolve/resolveTokenValue.js +22 -0
- package/src/v10/instructionEngine/resolvePath.js +1 -0
- package/src/v10/instructionEngine/resolveTokenValue.js +1 -0
- package/src/v10/instructionEngine/story/storyInjector.js +50 -0
- package/src/v10/instructionEngine/storyInjector.js +1 -0
- package/src/v10/instructionEngine/value/interpolate.js +38 -0
- package/src/v11/index.js +116 -0
- package/src/v11/iterate.js +270 -0
- package/src/v11/replace.js +169 -0
- package/src/v11/resolvePath.js +29 -0
- package/src/v12/index.js +122 -0
- package/src/v12/iterate/bindFormValues.js +74 -0
- package/src/v12/iterate/expandIteration.js +181 -0
- package/src/v12/iterate/index.js +10 -0
- package/src/v12/iterate/iterate.js +56 -0
- package/src/v12/iterate/iterateNode.js +86 -0
- package/src/v12/iterate/resolveCollection.js +37 -0
- package/src/v12/iterate.js +270 -0
- package/src/v12/replace.js +169 -0
- package/src/v12/resolvePath.js +29 -0
- package/src/v13/index.js +110 -0
- package/src/v13/iterate/bindFormValues.js +74 -0
- package/src/v13/iterate/expandIteration.js +188 -0
- package/src/v13/iterate/index.js +9 -0
- package/src/v13/iterate/iterate.js +32 -0
- package/src/v13/iterate/iterateNode.js +86 -0
- package/src/v13/iterate/resolveCollection.js +37 -0
- package/src/v13/iterate/walk.js +90 -0
- package/src/v13/iterate.js +270 -0
- package/src/v13/replace.js +169 -0
- package/src/v13/resolvePath.js +29 -0
- package/src/v14/index.js +112 -0
- package/src/v14/iterate/bindFormValues.js +74 -0
- package/src/v14/iterate/expandIteration.js +188 -0
- package/src/v14/iterate/index.js +9 -0
- package/src/v14/iterate/iterate.js +32 -0
- package/src/v14/iterate/resolveCollection.js +37 -0
- package/src/v14/iterate/walk/walk copy 2.js +114 -0
- package/src/v14/iterate/walk/walk copy.js +90 -0
- package/src/v14/iterate/walk/walk.js +98 -0
- package/src/v14/iterate.js +270 -0
- package/src/v14/replace/index.js +16 -0
- package/src/v14/replace/walk.js +90 -0
- package/src/v14/replace.js +153 -0
- package/src/v14/resolvePath.js +29 -0
- package/src/v15/index.js +123 -0
- package/src/v15/iterate/bindFormValues.js +74 -0
- package/src/v15/iterate/expandIteration.js +188 -0
- package/src/v15/iterate/index.js +9 -0
- package/src/v15/iterate/iterate.js +32 -0
- package/src/v15/iterate/resolveCollection.js +37 -0
- package/src/v15/iterate/walk/walk copy 2.js +114 -0
- package/src/v15/iterate/walk/walk copy.js +90 -0
- package/src/v15/iterate/walk/walk.js +195 -0
- package/src/v15/iterate.js +270 -0
- package/src/v15/replace/index.js +16 -0
- package/src/v15/replace/walk.js +90 -0
- package/src/v15/replace.js +155 -0
- package/src/v15/resolvePath.js +29 -0
- package/src/v16/index.js +129 -0
- package/src/v16/iterate/bindFormValues.js +74 -0
- package/src/v16/iterate/expandIteration.js +188 -0
- package/src/v16/iterate/index.js +9 -0
- package/src/v16/iterate/iterate.js +32 -0
- package/src/v16/iterate/resolveCollection.js +37 -0
- package/src/v16/iterate/walk/walk copy 2.js +114 -0
- package/src/v16/iterate/walk/walk copy.js +90 -0
- package/src/v16/iterate/walk/walk.js +196 -0
- package/src/v16/iterate.js +270 -0
- package/src/v16/replace/index.js +16 -0
- package/src/v16/replace/walk.js +90 -0
- package/src/v16/replace.js +155 -0
- package/src/v16/resolvePath.js +29 -0
- package/src/v17/index.js +119 -0
- package/src/v17/iterate/bindFormValues.js +74 -0
- package/src/v17/iterate/expandIteration.js +188 -0
- package/src/v17/iterate/index.js +9 -0
- package/src/v17/iterate/iterate.js +32 -0
- package/src/v17/iterate/resolveCollection.js +37 -0
- package/src/v17/iterate/walk/iterateDo.js +42 -0
- package/src/v17/iterate/walk/replaceWithData.js +60 -0
- package/src/v17/iterate/walk/walk.js +94 -0
- package/src/v17/iterate.js +270 -0
- package/src/v17/replace/index.js +16 -0
- package/src/v17/replace/walk.js +90 -0
- package/src/v17/replace.js +160 -0
- package/src/v17/resolvePath.js +29 -0
- package/src/v18/index.js +66 -0
- package/src/v18/meta.js +7 -0
- package/src/v18/registerGlobal.js +17 -0
- package/src/v18/replace.js +18 -0
- package/src/v18/resolvePath.js +29 -0
- package/src/v18/walk/iterate/v1/index.js +42 -0
- package/src/v18/walk/iterate/v2/index.js +32 -0
- package/src/v18/walk/iterate/v3/index.js +46 -0
- package/src/v18/walk/iterate/v4/createChildren.js +24 -0
- package/src/v18/walk/iterate/v4/index.js +25 -0
- package/src/v18/walk/replaceWithData/v1/index.js +42 -0
- package/src/v18/walk/replaceWithData/v1/replaceCommon.js +21 -0
- package/src/v18/walk/replaceWithData/v2/index.js +105 -0
- package/src/v18/walk/replaceWithData/v2/replaceCommon.js +21 -0
- package/src/v18/walk/replaceWithData/v3/index.js +15 -0
- package/src/v18/walk/replaceWithData/v3/replaceAttributes.js +29 -0
- package/src/v18/walk/replaceWithData/v3/replaceCommon.js +23 -0
- package/src/v18/walk/replaceWithData/v3/replaceNodeValue.js +27 -0
- package/src/v18/walk/walk.js +94 -0
- package/src/v19/index.js +55 -0
- package/src/v19/meta.js +7 -0
- package/src/v19/registerGlobal.js +17 -0
- package/src/v19/replace.js +18 -0
- package/src/v19/resolvePath.js +29 -0
- package/src/v19/walk/iterate/v1/index.js +42 -0
- package/src/v19/walk/iterate/v2/index.js +32 -0
- package/src/v19/walk/iterate/v3/index.js +46 -0
- package/src/v19/walk/iterate/v4/createChildren.js +27 -0
- package/src/v19/walk/iterate/v4/index.js +25 -0
- package/src/v19/walk/replaceWithData/v1/index.js +42 -0
- package/src/v19/walk/replaceWithData/v1/replaceCommon.js +21 -0
- package/src/v19/walk/replaceWithData/v2/index.js +105 -0
- package/src/v19/walk/replaceWithData/v2/replaceCommon.js +21 -0
- package/src/v19/walk/replaceWithData/v3/index.js +15 -0
- package/src/v19/walk/replaceWithData/v3/replaceAttributes.js +29 -0
- package/src/v19/walk/replaceWithData/v3/replaceCommon.js +23 -0
- package/src/v19/walk/replaceWithData/v3/replaceNodeValue.js +27 -0
- package/src/v19/walk/walk.js +97 -0
- package/src/v8/index.js +69 -0
- package/src/v8/instructionEngine/compile/compileTree.js +191 -0
- package/src/v8/instructionEngine/compileTree.js +1 -0
- package/src/v8/instructionEngine/expandIteration.js +1 -0
- package/src/v8/instructionEngine/index.js +16 -0
- package/src/v8/instructionEngine/interpolate.js +2 -0
- package/src/v8/instructionEngine/iteration/expandIteration.js +95 -0
- package/src/v8/instructionEngine/resolve/resolvePath.js +18 -0
- package/src/v8/instructionEngine/resolve/resolveTokenValue.js +22 -0
- package/src/v8/instructionEngine/resolvePath.js +1 -0
- package/src/v8/instructionEngine/resolveTokenValue.js +1 -0
- package/src/v8/instructionEngine/story/storyInjector.js +50 -0
- package/src/v8/instructionEngine/storyInjector.js +1 -0
- package/src/v8/instructionEngine/value/interpolate.js +38 -0
- package/src/v9/index.js +96 -0
- package/src/v9/instructionEngine/compile/compileTree.js +191 -0
- package/src/v9/instructionEngine/compileTree.js +1 -0
- package/src/v9/instructionEngine/expandIteration.js +1 -0
- package/src/v9/instructionEngine/index.js +29 -0
- package/src/v9/instructionEngine/interpolate.js +2 -0
- package/src/v9/instructionEngine/iteration/expandIteration.js +95 -0
- package/src/v9/instructionEngine/operation/operation.js +237 -0
- package/src/v9/instructionEngine/other/other.js +150 -0
- package/src/v9/instructionEngine/pipeline/pipeline.js +47 -0
- package/src/v9/instructionEngine/replace/replace.js +173 -0
- package/src/v9/instructionEngine/resolve/resolvePath.js +18 -0
- package/src/v9/instructionEngine/resolve/resolveTokenValue.js +22 -0
- package/src/v9/instructionEngine/resolvePath.js +1 -0
- package/src/v9/instructionEngine/resolveTokenValue.js +1 -0
- package/src/v9/instructionEngine/story/storyInjector.js +50 -0
- package/src/v9/instructionEngine/storyInjector.js +1 -0
- package/src/v9/instructionEngine/value/interpolate.js +38 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tagName": "select",
|
|
3
|
+
"attributes": {
|
|
4
|
+
"id": "uom"
|
|
5
|
+
},
|
|
6
|
+
"jsonToSpec": {
|
|
7
|
+
"operation": "iterate",
|
|
8
|
+
"source": "uom",
|
|
9
|
+
"template": {
|
|
10
|
+
"tagName": "option",
|
|
11
|
+
"attributes": {
|
|
12
|
+
"value": "${name}"
|
|
13
|
+
},
|
|
14
|
+
"textContent": "${name}"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"children": []
|
|
18
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tagName": "table",
|
|
3
|
+
"attributes": {
|
|
4
|
+
"class": "table"
|
|
5
|
+
},
|
|
6
|
+
"children": [
|
|
7
|
+
{
|
|
8
|
+
"tagName": "thead",
|
|
9
|
+
"children": [
|
|
10
|
+
{
|
|
11
|
+
"tagName": "tr",
|
|
12
|
+
"children": [
|
|
13
|
+
{
|
|
14
|
+
"tagName": "th",
|
|
15
|
+
"textContent": "Name"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"tagName": "th",
|
|
19
|
+
"textContent": "Amount"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"tagName": "tbody",
|
|
27
|
+
"jsonToSpec": {
|
|
28
|
+
"operation": "iterate",
|
|
29
|
+
"source": "data",
|
|
30
|
+
"template": {
|
|
31
|
+
"tagName": "tr",
|
|
32
|
+
"children": [
|
|
33
|
+
{
|
|
34
|
+
"tagName": "td",
|
|
35
|
+
"textContent": "${LedgerName}"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"tagName": "td",
|
|
39
|
+
"textContent": "${Amount}"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"children": []
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
+
<title>v30 - Input Only</title>
|
|
8
|
+
<script>
|
|
9
|
+
if (!location.pathname.endsWith('/') && !location.pathname.endsWith('.html')) {
|
|
10
|
+
location.replace(location.pathname + '/' + location.search + location.hash);
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"
|
|
15
|
+
integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
|
16
|
+
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<main class="container">
|
|
21
|
+
<h1 id="head1" style="margin-top:0;font-size:1.25rem">Simple Input (v30)</h1>
|
|
22
|
+
<div id="dom-render-container">
|
|
23
|
+
<div class="text-center py-5 text-muted">Loading input demo...</div>
|
|
24
|
+
</div>
|
|
25
|
+
</main>
|
|
26
|
+
<script type="module" src="./index.js"></script>
|
|
27
|
+
</body>
|
|
28
|
+
|
|
29
|
+
</html>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { default as compile } from "../../src/index.js";
|
|
2
|
+
// import * as domEngine from "./json-to-dom.v27.min.js";
|
|
3
|
+
|
|
4
|
+
import { specToDom } from "https://keshavsoft.github.io/json-to-dom/dist/v31/min.js";
|
|
5
|
+
|
|
6
|
+
const folder = "input";
|
|
7
|
+
let actionBinding = null;
|
|
8
|
+
let state = { structure: null, data: null, compiled: null };
|
|
9
|
+
|
|
10
|
+
const loadInput = async () => {
|
|
11
|
+
const [structure, data] = await Promise.all([
|
|
12
|
+
fetch(`./${folder}/structure.json`).then((r) => r.json()),
|
|
13
|
+
fetch(`./${folder}/data.json`).then((r) => r.json())
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
structure,
|
|
18
|
+
data
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const render = (structure, data) => {
|
|
23
|
+
const t0 = performance.now();
|
|
24
|
+
|
|
25
|
+
console.log("lllllllllll : ", state);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const specAsJsonToDom = compile(structure, data);
|
|
29
|
+
const compileTime = (performance.now() - t0).toFixed(2);
|
|
30
|
+
const compileBadge = document.getElementById("compile-time-badge");
|
|
31
|
+
if (compileBadge) compileBadge.textContent = `Compiled in ${compileTime}ms`;
|
|
32
|
+
|
|
33
|
+
const container = document.getElementById("dom-render-container");
|
|
34
|
+
if (container) container.innerHTML = "";
|
|
35
|
+
|
|
36
|
+
// console.log("222222222 : ", specAsJsonToDom);
|
|
37
|
+
|
|
38
|
+
specToDom({ spec: specAsJsonToDom, targetHtmlId: "dom-render-container" });
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const start = async () => {
|
|
42
|
+
try {
|
|
43
|
+
const {
|
|
44
|
+
structure,
|
|
45
|
+
data
|
|
46
|
+
} = await loadInput();
|
|
47
|
+
|
|
48
|
+
render(structure, data);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
const container = document.getElementById("dom-render-container");
|
|
51
|
+
if (container) container.innerHTML = `<div style="color:#b91c1c">Error: ${err.message}</div>`;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
start();
|
|
56
|
+
|
|
57
|
+
const head1 = document.getElementById("head1");
|
|
58
|
+
const version = window?.ks?.["json-to-spec"]?.meta?.version;
|
|
59
|
+
if (version && head1) {
|
|
60
|
+
head1.innerHTML += ` - ${version}`;
|
|
61
|
+
};
|