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.
Files changed (217) hide show
  1. package/README.md +118 -0
  2. package/docs/demo.html +426 -0
  3. package/docs/dist/min.js +164 -0
  4. package/docs/dist/v1/min.js +124 -0
  5. package/docs/dist/v17/min.js +355 -0
  6. package/docs/dist/v18/min.js +160 -0
  7. package/docs/dist/v19/min.js +164 -0
  8. package/docs/dist/v2/min.js +129 -0
  9. package/docs/dist/v3/min.js +201 -0
  10. package/docs/index.html +248 -0
  11. package/docs/pages/architecture.html +115 -0
  12. package/docs/pages/how-it-works.html +125 -0
  13. package/docs/pages/what-not.html +100 -0
  14. package/docs/pages/what.html +105 -0
  15. package/docs/pages/why.html +88 -0
  16. package/docs/samples/form.html +265 -0
  17. package/docs/samples/index.html +112 -0
  18. package/docs/samples/table.html +306 -0
  19. package/index.js +2 -0
  20. package/package.json +50 -0
  21. package/samples/dataList/index.html +31 -0
  22. package/samples/dataList/index.js +62 -0
  23. package/samples/dataList/input/data.json +5043 -0
  24. package/samples/dataList/input/structure.json +38 -0
  25. package/samples/dataList copy/index.html +30 -0
  26. package/samples/dataList copy/index.js +61 -0
  27. package/samples/dataList copy/input/data.json +35307 -0
  28. package/samples/dataList copy/input/structure.json +18 -0
  29. package/samples/form/index.html +29 -0
  30. package/samples/form/index.js +64 -0
  31. package/samples/form/input/data.json +9 -0
  32. package/samples/form/input/structure.json +192 -0
  33. package/samples/form-/data.json +42 -0
  34. package/samples/form-/structure.json +110 -0
  35. package/samples/select/index.html +31 -0
  36. package/samples/select/index.js +61 -0
  37. package/samples/select/input/data.json +35287 -0
  38. package/samples/select/input/select.json +18 -0
  39. package/samples/select/input/structure.json +47 -0
  40. package/samples/table/index.html +29 -0
  41. package/samples/table/index.js +61 -0
  42. package/samples/table/input/data.json +35287 -0
  43. package/samples/table/input/structure copy.json +47 -0
  44. package/samples/table/input/structure.json +86 -0
  45. package/samples/table/input/table.json +135 -0
  46. package/samples/table-/data.json +68 -0
  47. package/samples/table-/structure.json +235 -0
  48. package/src/index.js +2 -0
  49. package/src/v10/index.js +96 -0
  50. package/src/v10/instructionEngine/compile/compileTree.js +191 -0
  51. package/src/v10/instructionEngine/compileTree.js +1 -0
  52. package/src/v10/instructionEngine/expandIteration.js +1 -0
  53. package/src/v10/instructionEngine/index.js +29 -0
  54. package/src/v10/instructionEngine/interpolate.js +2 -0
  55. package/src/v10/instructionEngine/iteration/expandIteration.js +95 -0
  56. package/src/v10/instructionEngine/operation/operation.js +237 -0
  57. package/src/v10/instructionEngine/other/other.js +150 -0
  58. package/src/v10/instructionEngine/pipeline/pipeline.js +47 -0
  59. package/src/v10/instructionEngine/replace/replace.js +173 -0
  60. package/src/v10/instructionEngine/resolve/resolvePath.js +18 -0
  61. package/src/v10/instructionEngine/resolve/resolveTokenValue.js +22 -0
  62. package/src/v10/instructionEngine/resolvePath.js +1 -0
  63. package/src/v10/instructionEngine/resolveTokenValue.js +1 -0
  64. package/src/v10/instructionEngine/story/storyInjector.js +50 -0
  65. package/src/v10/instructionEngine/storyInjector.js +1 -0
  66. package/src/v10/instructionEngine/value/interpolate.js +38 -0
  67. package/src/v11/index.js +116 -0
  68. package/src/v11/iterate.js +270 -0
  69. package/src/v11/replace.js +169 -0
  70. package/src/v11/resolvePath.js +29 -0
  71. package/src/v12/index.js +122 -0
  72. package/src/v12/iterate/bindFormValues.js +74 -0
  73. package/src/v12/iterate/expandIteration.js +181 -0
  74. package/src/v12/iterate/index.js +10 -0
  75. package/src/v12/iterate/iterate.js +56 -0
  76. package/src/v12/iterate/iterateNode.js +86 -0
  77. package/src/v12/iterate/resolveCollection.js +37 -0
  78. package/src/v12/iterate.js +270 -0
  79. package/src/v12/replace.js +169 -0
  80. package/src/v12/resolvePath.js +29 -0
  81. package/src/v13/index.js +110 -0
  82. package/src/v13/iterate/bindFormValues.js +74 -0
  83. package/src/v13/iterate/expandIteration.js +188 -0
  84. package/src/v13/iterate/index.js +9 -0
  85. package/src/v13/iterate/iterate.js +32 -0
  86. package/src/v13/iterate/iterateNode.js +86 -0
  87. package/src/v13/iterate/resolveCollection.js +37 -0
  88. package/src/v13/iterate/walk.js +90 -0
  89. package/src/v13/iterate.js +270 -0
  90. package/src/v13/replace.js +169 -0
  91. package/src/v13/resolvePath.js +29 -0
  92. package/src/v14/index.js +112 -0
  93. package/src/v14/iterate/bindFormValues.js +74 -0
  94. package/src/v14/iterate/expandIteration.js +188 -0
  95. package/src/v14/iterate/index.js +9 -0
  96. package/src/v14/iterate/iterate.js +32 -0
  97. package/src/v14/iterate/resolveCollection.js +37 -0
  98. package/src/v14/iterate/walk/walk copy 2.js +114 -0
  99. package/src/v14/iterate/walk/walk copy.js +90 -0
  100. package/src/v14/iterate/walk/walk.js +98 -0
  101. package/src/v14/iterate.js +270 -0
  102. package/src/v14/replace/index.js +16 -0
  103. package/src/v14/replace/walk.js +90 -0
  104. package/src/v14/replace.js +153 -0
  105. package/src/v14/resolvePath.js +29 -0
  106. package/src/v15/index.js +123 -0
  107. package/src/v15/iterate/bindFormValues.js +74 -0
  108. package/src/v15/iterate/expandIteration.js +188 -0
  109. package/src/v15/iterate/index.js +9 -0
  110. package/src/v15/iterate/iterate.js +32 -0
  111. package/src/v15/iterate/resolveCollection.js +37 -0
  112. package/src/v15/iterate/walk/walk copy 2.js +114 -0
  113. package/src/v15/iterate/walk/walk copy.js +90 -0
  114. package/src/v15/iterate/walk/walk.js +195 -0
  115. package/src/v15/iterate.js +270 -0
  116. package/src/v15/replace/index.js +16 -0
  117. package/src/v15/replace/walk.js +90 -0
  118. package/src/v15/replace.js +155 -0
  119. package/src/v15/resolvePath.js +29 -0
  120. package/src/v16/index.js +129 -0
  121. package/src/v16/iterate/bindFormValues.js +74 -0
  122. package/src/v16/iterate/expandIteration.js +188 -0
  123. package/src/v16/iterate/index.js +9 -0
  124. package/src/v16/iterate/iterate.js +32 -0
  125. package/src/v16/iterate/resolveCollection.js +37 -0
  126. package/src/v16/iterate/walk/walk copy 2.js +114 -0
  127. package/src/v16/iterate/walk/walk copy.js +90 -0
  128. package/src/v16/iterate/walk/walk.js +196 -0
  129. package/src/v16/iterate.js +270 -0
  130. package/src/v16/replace/index.js +16 -0
  131. package/src/v16/replace/walk.js +90 -0
  132. package/src/v16/replace.js +155 -0
  133. package/src/v16/resolvePath.js +29 -0
  134. package/src/v17/index.js +119 -0
  135. package/src/v17/iterate/bindFormValues.js +74 -0
  136. package/src/v17/iterate/expandIteration.js +188 -0
  137. package/src/v17/iterate/index.js +9 -0
  138. package/src/v17/iterate/iterate.js +32 -0
  139. package/src/v17/iterate/resolveCollection.js +37 -0
  140. package/src/v17/iterate/walk/iterateDo.js +42 -0
  141. package/src/v17/iterate/walk/replaceWithData.js +60 -0
  142. package/src/v17/iterate/walk/walk.js +94 -0
  143. package/src/v17/iterate.js +270 -0
  144. package/src/v17/replace/index.js +16 -0
  145. package/src/v17/replace/walk.js +90 -0
  146. package/src/v17/replace.js +160 -0
  147. package/src/v17/resolvePath.js +29 -0
  148. package/src/v18/index.js +66 -0
  149. package/src/v18/meta.js +7 -0
  150. package/src/v18/registerGlobal.js +17 -0
  151. package/src/v18/replace.js +18 -0
  152. package/src/v18/resolvePath.js +29 -0
  153. package/src/v18/walk/iterate/v1/index.js +42 -0
  154. package/src/v18/walk/iterate/v2/index.js +32 -0
  155. package/src/v18/walk/iterate/v3/index.js +46 -0
  156. package/src/v18/walk/iterate/v4/createChildren.js +24 -0
  157. package/src/v18/walk/iterate/v4/index.js +25 -0
  158. package/src/v18/walk/replaceWithData/v1/index.js +42 -0
  159. package/src/v18/walk/replaceWithData/v1/replaceCommon.js +21 -0
  160. package/src/v18/walk/replaceWithData/v2/index.js +105 -0
  161. package/src/v18/walk/replaceWithData/v2/replaceCommon.js +21 -0
  162. package/src/v18/walk/replaceWithData/v3/index.js +15 -0
  163. package/src/v18/walk/replaceWithData/v3/replaceAttributes.js +29 -0
  164. package/src/v18/walk/replaceWithData/v3/replaceCommon.js +23 -0
  165. package/src/v18/walk/replaceWithData/v3/replaceNodeValue.js +27 -0
  166. package/src/v18/walk/walk.js +94 -0
  167. package/src/v19/index.js +55 -0
  168. package/src/v19/meta.js +7 -0
  169. package/src/v19/registerGlobal.js +17 -0
  170. package/src/v19/replace.js +18 -0
  171. package/src/v19/resolvePath.js +29 -0
  172. package/src/v19/walk/iterate/v1/index.js +42 -0
  173. package/src/v19/walk/iterate/v2/index.js +32 -0
  174. package/src/v19/walk/iterate/v3/index.js +46 -0
  175. package/src/v19/walk/iterate/v4/createChildren.js +27 -0
  176. package/src/v19/walk/iterate/v4/index.js +25 -0
  177. package/src/v19/walk/replaceWithData/v1/index.js +42 -0
  178. package/src/v19/walk/replaceWithData/v1/replaceCommon.js +21 -0
  179. package/src/v19/walk/replaceWithData/v2/index.js +105 -0
  180. package/src/v19/walk/replaceWithData/v2/replaceCommon.js +21 -0
  181. package/src/v19/walk/replaceWithData/v3/index.js +15 -0
  182. package/src/v19/walk/replaceWithData/v3/replaceAttributes.js +29 -0
  183. package/src/v19/walk/replaceWithData/v3/replaceCommon.js +23 -0
  184. package/src/v19/walk/replaceWithData/v3/replaceNodeValue.js +27 -0
  185. package/src/v19/walk/walk.js +97 -0
  186. package/src/v8/index.js +69 -0
  187. package/src/v8/instructionEngine/compile/compileTree.js +191 -0
  188. package/src/v8/instructionEngine/compileTree.js +1 -0
  189. package/src/v8/instructionEngine/expandIteration.js +1 -0
  190. package/src/v8/instructionEngine/index.js +16 -0
  191. package/src/v8/instructionEngine/interpolate.js +2 -0
  192. package/src/v8/instructionEngine/iteration/expandIteration.js +95 -0
  193. package/src/v8/instructionEngine/resolve/resolvePath.js +18 -0
  194. package/src/v8/instructionEngine/resolve/resolveTokenValue.js +22 -0
  195. package/src/v8/instructionEngine/resolvePath.js +1 -0
  196. package/src/v8/instructionEngine/resolveTokenValue.js +1 -0
  197. package/src/v8/instructionEngine/story/storyInjector.js +50 -0
  198. package/src/v8/instructionEngine/storyInjector.js +1 -0
  199. package/src/v8/instructionEngine/value/interpolate.js +38 -0
  200. package/src/v9/index.js +96 -0
  201. package/src/v9/instructionEngine/compile/compileTree.js +191 -0
  202. package/src/v9/instructionEngine/compileTree.js +1 -0
  203. package/src/v9/instructionEngine/expandIteration.js +1 -0
  204. package/src/v9/instructionEngine/index.js +29 -0
  205. package/src/v9/instructionEngine/interpolate.js +2 -0
  206. package/src/v9/instructionEngine/iteration/expandIteration.js +95 -0
  207. package/src/v9/instructionEngine/operation/operation.js +237 -0
  208. package/src/v9/instructionEngine/other/other.js +150 -0
  209. package/src/v9/instructionEngine/pipeline/pipeline.js +47 -0
  210. package/src/v9/instructionEngine/replace/replace.js +173 -0
  211. package/src/v9/instructionEngine/resolve/resolvePath.js +18 -0
  212. package/src/v9/instructionEngine/resolve/resolveTokenValue.js +22 -0
  213. package/src/v9/instructionEngine/resolvePath.js +1 -0
  214. package/src/v9/instructionEngine/resolveTokenValue.js +1 -0
  215. package/src/v9/instructionEngine/story/storyInjector.js +50 -0
  216. package/src/v9/instructionEngine/storyInjector.js +1 -0
  217. package/src/v9/instructionEngine/value/interpolate.js +38 -0
@@ -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": "LedgerParentName"
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": "${LedgerParentName}"
40
+ }
41
+ ]
42
+ }
43
+ },
44
+ "children": []
45
+ }
46
+ ]
47
+ }
@@ -0,0 +1,86 @@
1
+ {
2
+ "tagName": "div",
3
+ "attributes": {
4
+ "class": "card shadow-sm"
5
+ },
6
+ "children": [
7
+ {
8
+ "tagName": "div",
9
+ "attributes": {
10
+ "class": "card-header"
11
+ },
12
+ "children": [
13
+ {
14
+ "tagName": "input",
15
+ "attributes": {
16
+ "type": "search",
17
+ "class": "form-control",
18
+ "placeholder": "Search...",
19
+ "id": "table-search"
20
+ }
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "tagName": "div",
26
+ "attributes": {
27
+ "class": "table-responsive"
28
+ },
29
+ "children": [
30
+ {
31
+ "tagName": "table",
32
+ "attributes": {
33
+ "class": "table table-hover table-striped mb-0"
34
+ },
35
+ "children": [
36
+ {
37
+ "tagName": "thead",
38
+ "attributes": {
39
+ "class": "table-dark"
40
+ },
41
+ "children": [
42
+ {
43
+ "tagName": "tr",
44
+ "children": [
45
+ {
46
+ "tagName": "th",
47
+ "textContent": "Name"
48
+ },
49
+ {
50
+ "tagName": "th",
51
+ "textContent": "LedgerParentName"
52
+ }
53
+ ]
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "tagName": "tbody",
59
+ "attributes": {
60
+ "id": "table-body"
61
+ },
62
+ "jsonToSpec": {
63
+ "operation": "iterate",
64
+ "source": "data",
65
+ "template": {
66
+ "tagName": "tr",
67
+ "children": [
68
+ {
69
+ "tagName": "td",
70
+ "textContent": "${LedgerName}"
71
+ },
72
+ {
73
+ "tagName": "td",
74
+ "textContent": "${LedgerParentName}"
75
+ }
76
+ ]
77
+ }
78
+ },
79
+ "children": []
80
+ }
81
+ ]
82
+ }
83
+ ]
84
+ }
85
+ ]
86
+ }
@@ -0,0 +1,135 @@
1
+ {
2
+ "simple": {
3
+ "tagName": "table",
4
+ "attributes": {
5
+ "class": "table"
6
+ },
7
+ "children": [
8
+ {
9
+ "tagName": "thead",
10
+ "children": [
11
+ {
12
+ "tagName": "tr",
13
+ "children": [
14
+ {
15
+ "tagName": "th",
16
+ "textContent": "Name"
17
+ },
18
+ {
19
+ "tagName": "th",
20
+ "textContent": "LedgerParentName"
21
+ }
22
+ ]
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "tagName": "tbody",
28
+ "jsonToSpec": {
29
+ "operation": "iterate",
30
+ "source": "data",
31
+ "template": {
32
+ "tagName": "tr",
33
+ "children": [
34
+ {
35
+ "tagName": "td",
36
+ "textContent": "${LedgerName}"
37
+ },
38
+ {
39
+ "tagName": "td",
40
+ "textContent": "${LedgerParentName}"
41
+ }
42
+ ]
43
+ }
44
+ },
45
+ "children": []
46
+ }
47
+ ]
48
+ },
49
+ "withSearch": {
50
+ "tagName": "div",
51
+ "attributes": {
52
+ "class": "card shadow-sm"
53
+ },
54
+ "children": [
55
+ {
56
+ "tagName": "div",
57
+ "attributes": {
58
+ "class": "card-header"
59
+ },
60
+ "children": [
61
+ {
62
+ "tagName": "input",
63
+ "attributes": {
64
+ "type": "search",
65
+ "class": "form-control",
66
+ "placeholder": "Search...",
67
+ "id": "table-search"
68
+ }
69
+ }
70
+ ]
71
+ },
72
+ {
73
+ "tagName": "div",
74
+ "attributes": {
75
+ "class": "table-responsive"
76
+ },
77
+ "children": [
78
+ {
79
+ "tagName": "table",
80
+ "attributes": {
81
+ "class": "table table-hover table-striped mb-0"
82
+ },
83
+ "children": [
84
+ {
85
+ "tagName": "thead",
86
+ "attributes": {
87
+ "class": "table-dark"
88
+ },
89
+ "children": [
90
+ {
91
+ "tagName": "tr",
92
+ "children": [
93
+ {
94
+ "tagName": "th",
95
+ "textContent": "Name"
96
+ },
97
+ {
98
+ "tagName": "th",
99
+ "textContent": "LedgerParentName"
100
+ }
101
+ ]
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ "tagName": "tbody",
107
+ "attributes": {
108
+ "id": "table-body"
109
+ },
110
+ "jsonToSpec": {
111
+ "operation": "iterate",
112
+ "source": "data",
113
+ "template": {
114
+ "tagName": "tr",
115
+ "children": [
116
+ {
117
+ "tagName": "td",
118
+ "textContent": "${LedgerName}"
119
+ },
120
+ {
121
+ "tagName": "td",
122
+ "textContent": "${LedgerParentName}"
123
+ }
124
+ ]
125
+ }
126
+ },
127
+ "children": []
128
+ }
129
+ ]
130
+ }
131
+ ]
132
+ }
133
+ ]
134
+ }
135
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "columns": [
3
+ {
4
+ "columnName": "Category",
5
+ "title": "Category",
6
+ "field": "Category",
7
+ "isVisible": true
8
+ },
9
+ {
10
+ "columnName": "ItemName",
11
+ "title": "Item Name",
12
+ "field": "ItemName",
13
+ "isVisible": true
14
+ },
15
+ {
16
+ "columnName": "Service",
17
+ "title": "Service",
18
+ "field": "Service",
19
+ "isVisible": true
20
+ },
21
+ {
22
+ "columnName": "Rate",
23
+ "title": "Rate (₹)",
24
+ "field": "Rate",
25
+ "isVisible": true
26
+ },
27
+ {
28
+ "columnName": "pk",
29
+ "title": "pk",
30
+ "field": "pk",
31
+ "isVisible": false
32
+ }
33
+ ],
34
+ "rows": [
35
+ {
36
+ "pk": "item-001",
37
+ "Category": "Beverages",
38
+ "ItemName": "Green Tea",
39
+ "Service": "Packaging",
40
+ "Rate": 150
41
+ },
42
+ {
43
+ "pk": "item-002",
44
+ "Category": "Beverages",
45
+ "ItemName": "Espresso Coffee",
46
+ "Service": "Grinding",
47
+ "Rate": 220
48
+ },
49
+ {
50
+ "pk": "item-003",
51
+ "Category": "Bakery",
52
+ "ItemName": "Almond Cookies",
53
+ "Service": "Baking",
54
+ "Rate": 95
55
+ },
56
+ {
57
+ "pk": "item-004",
58
+ "Category": "Beverages",
59
+ "ItemName": "Orange Juice",
60
+ "Service": "Bottling",
61
+ "Rate": 120
62
+ }
63
+ ],
64
+ "summary": {
65
+ "totalItems": 4,
66
+ "avgRate": 146.25
67
+ }
68
+ }
@@ -0,0 +1,235 @@
1
+ {
2
+ "tagName": "div",
3
+ "attributes": {
4
+ "class": "card shadow-sm border border-slate-200 rounded-xl overflow-hidden max-w-4xl mx-auto"
5
+ },
6
+ "children": [
7
+ {
8
+ "tagName": "div",
9
+ "attributes": {
10
+ "class": "card-header bg-slate-100 px-6 py-4 border-b border-slate-200 d-flex justify-content-between align-items-center"
11
+ },
12
+ "children": [
13
+ {
14
+ "tagName": "div",
15
+ "children": [
16
+ {
17
+ "tagName": "h2",
18
+ "textContent": "Item Master Table",
19
+ "attributes": {
20
+ "class": "h5 mb-0 fw-bold text-slate-800"
21
+ }
22
+ },
23
+ {
24
+ "tagName": "p",
25
+ "textContent": "Rendered via 2-file compiler: thead & tbody iteration over data.columns & data.rows",
26
+ "attributes": {
27
+ "class": "small text-muted mb-0"
28
+ }
29
+ }
30
+ ]
31
+ },
32
+ {
33
+ "tagName": "span",
34
+ "textContent": "${summary.totalItems} Items",
35
+ "attributes": {
36
+ "class": "badge bg-indigo-600 text-white font-mono px-3 py-1.5"
37
+ }
38
+ }
39
+ ]
40
+ },
41
+ {
42
+ "tagName": "div",
43
+ "attributes": {
44
+ "class": "table-responsive"
45
+ },
46
+ "children": [
47
+ {
48
+ "tagName": "table",
49
+ "attributes": {
50
+ "class": "table table-hover table-striped align-middle mb-0"
51
+ },
52
+ "children": [
53
+ {
54
+ "tagName": "thead",
55
+ "attributes": {
56
+ "class": "table-light"
57
+ },
58
+ "children": [
59
+ {
60
+ "tagName": "tr",
61
+ "children": [
62
+ {
63
+ "tagName": "th",
64
+ "textContent": "#",
65
+ "attributes": {
66
+ "class": "text-center py-3",
67
+ "style": "width: 50px;"
68
+ }
69
+ },
70
+ {
71
+ "operation": "iterate",
72
+ "source": "columns",
73
+ "filter": {
74
+ "isVisible": true
75
+ },
76
+ "template": {
77
+ "tagName": "th",
78
+ "textContent": "${title}",
79
+ "attributes": {
80
+ "class": "text-start py-3"
81
+ }
82
+ }
83
+ },
84
+ {
85
+ "tagName": "th",
86
+ "textContent": "Status",
87
+ "attributes": {
88
+ "class": "text-center py-3",
89
+ "style": "width: 100px;"
90
+ }
91
+ },
92
+ {
93
+ "tagName": "th",
94
+ "textContent": "Action",
95
+ "attributes": {
96
+ "class": "text-end py-3 px-4",
97
+ "style": "width: 100px;"
98
+ }
99
+ }
100
+ ]
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ "tagName": "tbody",
106
+ "children": [
107
+ {
108
+ "operation": "iterate",
109
+ "source": "rows",
110
+ "template": {
111
+ "tagName": "tr",
112
+ "children": [
113
+ {
114
+ "tagName": "td",
115
+ "textContent": "${$number}",
116
+ "attributes": {
117
+ "class": "text-center font-mono small text-muted py-2.5"
118
+ }
119
+ },
120
+ {
121
+ "operation": "iterate",
122
+ "source": "columns",
123
+ "filter": {
124
+ "isVisible": true
125
+ },
126
+ "template": {
127
+ "tagName": "td",
128
+ "textContent": "${value}",
129
+ "attributes": {
130
+ "class": "text-start py-2.5"
131
+ }
132
+ }
133
+ },
134
+ {
135
+ "tagName": "td",
136
+ "attributes": {
137
+ "class": "text-center py-2.5"
138
+ },
139
+ "children": [
140
+ {
141
+ "tagName": "span",
142
+ "textContent": "Active",
143
+ "attributes": {
144
+ "class": "badge bg-success-subtle text-success border border-success-subtle font-mono text-xs"
145
+ }
146
+ }
147
+ ]
148
+ },
149
+ {
150
+ "tagName": "td",
151
+ "attributes": {
152
+ "class": "text-end py-2.5 px-4"
153
+ },
154
+ "children": [
155
+ {
156
+ "tagName": "button",
157
+ "textContent": "View",
158
+ "attributes": {
159
+ "type": "button",
160
+ "class": "btn btn-outline-primary btn-sm py-0 px-2 text-xs"
161
+ }
162
+ }
163
+ ]
164
+ }
165
+ ]
166
+ }
167
+ }
168
+ ]
169
+ },
170
+ {
171
+ "tagName": "tfoot",
172
+ "attributes": {
173
+ "class": "table-light border-top"
174
+ },
175
+ "children": [
176
+ {
177
+ "tagName": "tr",
178
+ "children": [
179
+ {
180
+ "tagName": "td",
181
+ "textContent": "Summary: Total Items: ${summary.totalItems} | Average Rate: ₹${summary.avgRate}",
182
+ "attributes": {
183
+ "colspan": "7",
184
+ "class": "small text-muted py-2.5 px-4 fw-semibold"
185
+ }
186
+ }
187
+ ]
188
+ }
189
+ ]
190
+ }
191
+ ]
192
+ }
193
+ ]
194
+ },
195
+ {
196
+ "tagName": "div",
197
+ "attributes": {
198
+ "class": "card-footer bg-slate-50 px-6 py-3 border-t border-slate-200 d-flex justify-content-between align-items-center"
199
+ },
200
+ "children": [
201
+ {
202
+ "tagName": "span",
203
+ "textContent": "Showing 4 of 4 records",
204
+ "attributes": {
205
+ "class": "text-xs text-muted font-mono"
206
+ }
207
+ },
208
+ {
209
+ "tagName": "div",
210
+ "attributes": {
211
+ "class": "d-flex gap-2"
212
+ },
213
+ "children": [
214
+ {
215
+ "tagName": "button",
216
+ "textContent": "Export CSV",
217
+ "attributes": {
218
+ "type": "button",
219
+ "class": "btn btn-outline-secondary btn-sm text-xs"
220
+ }
221
+ },
222
+ {
223
+ "tagName": "button",
224
+ "textContent": "Add New Row",
225
+ "attributes": {
226
+ "type": "button",
227
+ "class": "btn btn-primary btn-sm text-xs"
228
+ }
229
+ }
230
+ ]
231
+ }
232
+ ]
233
+ }
234
+ ]
235
+ }
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from "./v18/index.js";
2
+ export * from "./v18/index.js";
@@ -0,0 +1,96 @@
1
+ /**
2
+ * json-to-spec v9
3
+ *
4
+ * Modular 3-Stage Specification Compiler:
5
+ * 1. operation: detects and expands iterations and structural directives
6
+ * 2. replace: resolves dynamic token interpolation in strings, text, attributes & properties
7
+ * 3. other: applies form control value bindings, story injection, and cleans up metadata
8
+ *
9
+ * All three applications can be invoked independently, chained in custom pipelines,
10
+ * or executed via compile().
11
+ */
12
+
13
+ import operation from "./instructionEngine/operation/operation.js";
14
+ import replace from "./instructionEngine/replace/replace.js";
15
+ import other from "./instructionEngine/other/other.js";
16
+ import { pipeline, pipe, defaultPipeline } from "./instructionEngine/pipeline/pipeline.js";
17
+
18
+ export const meta = {
19
+ version: "10.0.0",
20
+ name: "json-to-spec/v10",
21
+ description: "Pure JSON Specification Compiler with decoupled operation, replace, and other pipeline stages"
22
+ };
23
+
24
+ /**
25
+ * Compiles a JSON UI structure tree containing `jsonToSpec` operations with a data payload.
26
+ *
27
+ * Outside API:
28
+ * - compile(structureJson, dataJson)
29
+ * - compile({ inStructure, inData, inSteps })
30
+ * - compile({ structure, data, steps })
31
+ *
32
+ * @param {Object|Array} inStructureOrOptions - The UI structure JSON tree or options object
33
+ * @param {Object} [inData] - Data payload containing collections and values
34
+ * @returns {Object|Array} - Compiled 100% pure JSON specification ready for json-to-dom
35
+ */
36
+ export const compile = (inStructureOrOptions, inData = {}) => {
37
+ let localStructure = inStructureOrOptions;
38
+ let localData = inData || {};
39
+ let localSteps = defaultPipeline;
40
+
41
+ if (inStructureOrOptions && typeof inStructureOrOptions === "object" && !Array.isArray(inStructureOrOptions)) {
42
+ if ("inStructure" in inStructureOrOptions || "inTree" in inStructureOrOptions || "inNode" in inStructureOrOptions) {
43
+ localStructure = inStructureOrOptions.inStructure || inStructureOrOptions.inTree || inStructureOrOptions.inNode;
44
+ localData = inStructureOrOptions.inData || localData;
45
+ localSteps = inStructureOrOptions.inSteps || localSteps;
46
+ } else if ("structure" in inStructureOrOptions) {
47
+ localStructure = inStructureOrOptions.structure;
48
+ localData = inStructureOrOptions.data || localData;
49
+ localSteps = inStructureOrOptions.steps || localSteps;
50
+ } else if ("context" in inStructureOrOptions) {
51
+ localStructure = inStructureOrOptions.context;
52
+ localData = inStructureOrOptions.data || localData;
53
+ localSteps = inStructureOrOptions.steps || localSteps;
54
+ }
55
+ }
56
+
57
+ return pipeline({
58
+ inStructure: localStructure,
59
+ inData: localData,
60
+ inSteps: localSteps
61
+ });
62
+ };
63
+
64
+ export const jsonToSpec = {
65
+ operation,
66
+ replace,
67
+ other,
68
+ pipeline,
69
+ pipe,
70
+ compile
71
+ };
72
+
73
+ export {
74
+ operation,
75
+ replace,
76
+ other,
77
+ pipeline,
78
+ pipe,
79
+ defaultPipeline
80
+ };
81
+
82
+ if (typeof globalThis !== "undefined") {
83
+ globalThis.ks ??= {};
84
+ globalThis.ks["json-to-spec"] = {
85
+ meta,
86
+ compile,
87
+ pipeline,
88
+ pipe,
89
+ operation,
90
+ replace,
91
+ other,
92
+ jsonToSpec
93
+ };
94
+ }
95
+
96
+ export default compile;