@atscript/vue-form 0.1.58

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 (190) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/dist/as-action-71f9E_bL.cjs +208 -0
  4. package/dist/as-action-DU17rykn.mjs +203 -0
  5. package/dist/as-action.cjs +2 -0
  6. package/dist/as-action.d.cts +2 -0
  7. package/dist/as-action.d.mts +2 -0
  8. package/dist/as-action.mjs +2 -0
  9. package/dist/as-action.vue-BdbAOZCL.d.cts +13 -0
  10. package/dist/as-action.vue-CmY3eil1.d.mts +13 -0
  11. package/dist/as-adornment-shell-9UmdNIPR.cjs +97 -0
  12. package/dist/as-adornment-shell-knFiB7Ct.mjs +92 -0
  13. package/dist/as-array-Bn27x9cq.cjs +466 -0
  14. package/dist/as-array-DwarTaKP.mjs +455 -0
  15. package/dist/as-array-clear-btn-DAGervXL.cjs +48 -0
  16. package/dist/as-array-clear-btn-DIhzCKC9.mjs +43 -0
  17. package/dist/as-array.cjs +11 -0
  18. package/dist/as-array.d.cts +2 -0
  19. package/dist/as-array.d.mts +2 -0
  20. package/dist/as-array.mjs +11 -0
  21. package/dist/as-array.vue-C5r_ycIa.d.mts +9 -0
  22. package/dist/as-array.vue-CeBZRVm7.d.cts +9 -0
  23. package/dist/as-checkbox-B_9mwla6.mjs +285 -0
  24. package/dist/as-checkbox-DXGTVHPE.cjs +296 -0
  25. package/dist/as-checkbox.cjs +6 -0
  26. package/dist/as-checkbox.d.cts +2 -0
  27. package/dist/as-checkbox.d.mts +2 -0
  28. package/dist/as-checkbox.mjs +6 -0
  29. package/dist/as-checkbox.vue-BL53Xjmi.d.mts +9 -0
  30. package/dist/as-checkbox.vue-Da1KVG5J.d.cts +9 -0
  31. package/dist/as-collapsible-CqxeJut7.cjs +148 -0
  32. package/dist/as-collapsible-DtNCofNT.mjs +143 -0
  33. package/dist/as-date-C7tFQDkh.mjs +253 -0
  34. package/dist/as-date-k3MW3dmA.cjs +258 -0
  35. package/dist/as-date.cjs +8 -0
  36. package/dist/as-date.d.cts +2 -0
  37. package/dist/as-date.d.mts +2 -0
  38. package/dist/as-date.mjs +8 -0
  39. package/dist/as-date.vue-C5JaS3Sd.d.mts +9 -0
  40. package/dist/as-date.vue-e2ewS_V4.d.cts +9 -0
  41. package/dist/as-datetime-C030mzI5.cjs +258 -0
  42. package/dist/as-datetime-elcOoDT5.mjs +253 -0
  43. package/dist/as-datetime.cjs +8 -0
  44. package/dist/as-datetime.d.cts +2 -0
  45. package/dist/as-datetime.d.mts +2 -0
  46. package/dist/as-datetime.mjs +8 -0
  47. package/dist/as-datetime.vue-ClsSnJSV.d.mts +9 -0
  48. package/dist/as-datetime.vue-vfHFsby6.d.cts +9 -0
  49. package/dist/as-decimal-BJIGgPXU.cjs +711 -0
  50. package/dist/as-decimal-DtXjFPhe.mjs +694 -0
  51. package/dist/as-decimal.cjs +7 -0
  52. package/dist/as-decimal.d.cts +2 -0
  53. package/dist/as-decimal.d.mts +2 -0
  54. package/dist/as-decimal.mjs +7 -0
  55. package/dist/as-decimal.vue-B1pEKdjM.d.cts +25 -0
  56. package/dist/as-decimal.vue-CSCtYRRa.d.mts +25 -0
  57. package/dist/as-field-CXVjrEPQ.mjs +481 -0
  58. package/dist/as-field-shell-B2iTn-iM.cjs +346 -0
  59. package/dist/as-field-shell-Pdy3sAvr.mjs +341 -0
  60. package/dist/as-field-shell.cjs +5 -0
  61. package/dist/as-field-shell.d.cts +2 -0
  62. package/dist/as-field-shell.d.mts +2 -0
  63. package/dist/as-field-shell.mjs +5 -0
  64. package/dist/as-field-shell.vue-Ddnp8KxY.d.mts +37 -0
  65. package/dist/as-field-shell.vue-Dmt05vGD.d.cts +37 -0
  66. package/dist/as-field-wLYoaZnT.cjs +498 -0
  67. package/dist/as-field.cjs +4 -0
  68. package/dist/as-field.d.cts +25 -0
  69. package/dist/as-field.d.mts +26 -0
  70. package/dist/as-field.mjs +4 -0
  71. package/dist/as-form-CWwgyvfw.mjs +425 -0
  72. package/dist/as-form-DAIkyt7H.cjs +448 -0
  73. package/dist/as-form.cjs +7 -0
  74. package/dist/as-form.d.cts +2 -0
  75. package/dist/as-form.d.mts +2 -0
  76. package/dist/as-form.mjs +7 -0
  77. package/dist/as-form.vue-B4Bn0pbC.d.cts +158 -0
  78. package/dist/as-form.vue-DRrb_yoj.d.mts +158 -0
  79. package/dist/as-input-CpbV2k3s.cjs +231 -0
  80. package/dist/as-input-DIa8BzLv.mjs +226 -0
  81. package/dist/as-input-control-BzELjheN.mjs +266 -0
  82. package/dist/as-input-control-C5-DelZT.cjs +271 -0
  83. package/dist/as-input.cjs +8 -0
  84. package/dist/as-input.d.cts +2 -0
  85. package/dist/as-input.d.mts +2 -0
  86. package/dist/as-input.mjs +8 -0
  87. package/dist/as-input.vue-11ldp9uT.d.cts +17 -0
  88. package/dist/as-input.vue-fUhcvfv2.d.mts +17 -0
  89. package/dist/as-iterator-BYMNe6UJ.cjs +61 -0
  90. package/dist/as-iterator-CT5y1jyn.mjs +56 -0
  91. package/dist/as-iterator.cjs +5 -0
  92. package/dist/as-iterator.d.cts +14 -0
  93. package/dist/as-iterator.d.mts +15 -0
  94. package/dist/as-iterator.mjs +5 -0
  95. package/dist/as-number-BA55JIq1.cjs +387 -0
  96. package/dist/as-number-JPEwPK8Q.mjs +376 -0
  97. package/dist/as-number.cjs +8 -0
  98. package/dist/as-number.d.cts +2 -0
  99. package/dist/as-number.d.mts +2 -0
  100. package/dist/as-number.mjs +8 -0
  101. package/dist/as-number.vue-Bk-W7Vwv.d.mts +26 -0
  102. package/dist/as-number.vue-C2Aih98s.d.cts +26 -0
  103. package/dist/as-object-CT6lNEqt.mjs +300 -0
  104. package/dist/as-object-qUL7l8V1.cjs +305 -0
  105. package/dist/as-object.cjs +11 -0
  106. package/dist/as-object.d.cts +2 -0
  107. package/dist/as-object.d.mts +2 -0
  108. package/dist/as-object.mjs +11 -0
  109. package/dist/as-object.vue-CKwMyM_F.d.cts +13 -0
  110. package/dist/as-object.vue-Cg52b61-.d.mts +13 -0
  111. package/dist/as-paragraph-BGO-j4US.cjs +203 -0
  112. package/dist/as-paragraph-jIG_dg7_.mjs +198 -0
  113. package/dist/as-paragraph.cjs +2 -0
  114. package/dist/as-paragraph.d.cts +2 -0
  115. package/dist/as-paragraph.d.mts +2 -0
  116. package/dist/as-paragraph.mjs +2 -0
  117. package/dist/as-paragraph.vue-BDt0pBG-.d.cts +9 -0
  118. package/dist/as-paragraph.vue-C3FgTEt5.d.mts +9 -0
  119. package/dist/as-radio-B1N-gmoI.mjs +242 -0
  120. package/dist/as-radio-U3OK7bTg.cjs +247 -0
  121. package/dist/as-radio.cjs +6 -0
  122. package/dist/as-radio.d.cts +2 -0
  123. package/dist/as-radio.d.mts +2 -0
  124. package/dist/as-radio.mjs +6 -0
  125. package/dist/as-radio.vue-D_fweoN1.d.mts +9 -0
  126. package/dist/as-radio.vue-ZC4kLBnT.d.cts +9 -0
  127. package/dist/as-ref-CIifSSCQ.mjs +337 -0
  128. package/dist/as-ref-SImaIrwK.cjs +342 -0
  129. package/dist/as-ref.cjs +7 -0
  130. package/dist/as-ref.d.cts +2 -0
  131. package/dist/as-ref.d.mts +2 -0
  132. package/dist/as-ref.mjs +7 -0
  133. package/dist/as-ref.vue-BNeQeQpO.d.cts +9 -0
  134. package/dist/as-ref.vue-Cr5jeNDn.d.mts +9 -0
  135. package/dist/as-select-BB3uxACS.cjs +246 -0
  136. package/dist/as-select-UBGCVhku.mjs +241 -0
  137. package/dist/as-select.cjs +6 -0
  138. package/dist/as-select.d.cts +2 -0
  139. package/dist/as-select.d.mts +2 -0
  140. package/dist/as-select.mjs +6 -0
  141. package/dist/as-select.vue-Dd7huPq2.d.cts +9 -0
  142. package/dist/as-select.vue-RYpbZbKt.d.mts +9 -0
  143. package/dist/as-time-C24rvslH.cjs +258 -0
  144. package/dist/as-time-CQsxUs8P.mjs +253 -0
  145. package/dist/as-time.cjs +8 -0
  146. package/dist/as-time.d.cts +2 -0
  147. package/dist/as-time.d.mts +2 -0
  148. package/dist/as-time.mjs +8 -0
  149. package/dist/as-time.vue-huLx2B4l.d.mts +9 -0
  150. package/dist/as-time.vue-nMEHLXke.d.cts +9 -0
  151. package/dist/as-tuple-BU--cuuI.cjs +351 -0
  152. package/dist/as-tuple-DkI9swlW.mjs +340 -0
  153. package/dist/as-tuple.cjs +11 -0
  154. package/dist/as-tuple.d.cts +2 -0
  155. package/dist/as-tuple.d.mts +2 -0
  156. package/dist/as-tuple.mjs +11 -0
  157. package/dist/as-tuple.vue-CQhzOJsn.d.mts +9 -0
  158. package/dist/as-tuple.vue-DyskCkf-.d.cts +9 -0
  159. package/dist/as-union-BGvdxr3G.mjs +351 -0
  160. package/dist/as-union-C0btoJn3.cjs +368 -0
  161. package/dist/as-union.cjs +6 -0
  162. package/dist/as-union.d.cts +2 -0
  163. package/dist/as-union.d.mts +2 -0
  164. package/dist/as-union.mjs +6 -0
  165. package/dist/as-union.vue-BjlDPZn0.d.mts +9 -0
  166. package/dist/as-union.vue-CqjU3O10.d.cts +9 -0
  167. package/dist/as-variant-picker-BVs0AvjK.mjs +96 -0
  168. package/dist/as-variant-picker-DObQZHmm.cjs +107 -0
  169. package/dist/index.cjs +173 -0
  170. package/dist/index.d.cts +966 -0
  171. package/dist/index.d.mts +966 -0
  172. package/dist/index.mjs +105 -0
  173. package/dist/types-C4HRSxgV.d.cts +233 -0
  174. package/dist/types-Czm-Gtud.d.mts +233 -0
  175. package/dist/use-as-date-B7CtcRQd.cjs +329 -0
  176. package/dist/use-as-date-C39i9mzE.mjs +318 -0
  177. package/dist/use-as-dropdown-BMnEm6jF.mjs +82 -0
  178. package/dist/use-as-dropdown-C-Qy7Vt0.cjs +105 -0
  179. package/dist/use-as-locale-BrFdAgnU.mjs +23 -0
  180. package/dist/use-as-locale-C4z5stwD.cjs +34 -0
  181. package/dist/use-as-nested-sections-store-jdMRxjBE.cjs +80 -0
  182. package/dist/use-as-nested-sections-store-lhi0z5z1.mjs +63 -0
  183. package/dist/use-as-optional-add-flow-CuXEir_i.mjs +43 -0
  184. package/dist/use-as-optional-add-flow-STOaQWo9.cjs +48 -0
  185. package/dist/use-as-value-help-CBykDEjZ.mjs +89 -0
  186. package/dist/use-as-value-help-uANI3zWa.cjs +100 -0
  187. package/dist/use-form-context-Dwr8Ai1v.cjs +207 -0
  188. package/dist/use-form-context-bAj7UoSe.mjs +106 -0
  189. package/package.json +180 -0
  190. package/styles.d.ts +2 -0
@@ -0,0 +1,207 @@
1
+ let vue = require("vue");
2
+ let _atscript_ui = require("@atscript/ui");
3
+ //#region src/composables/internal-keys.ts
4
+ /**
5
+ * Typed Vue provide/inject keys used across the form tree.
6
+ *
7
+ * Keys with generic value types (form data, form context) are intentionally
8
+ * widened to `unknown` here — call sites cast to their concrete generic.
9
+ * This is the standard Vue tradeoff for `InjectionKey<T>`: a key has one
10
+ * concrete type, so the generic flexibility lives at the consumer.
11
+ */
12
+ const FORM_STATE_KEY = Symbol("atui.form-state");
13
+ const FORM_DATA_KEY = Symbol("atui.form-data");
14
+ const FORM_CONTEXT_KEY = Symbol("atui.form-context");
15
+ const ROOT_DATA_KEY = Symbol("atui.root-data");
16
+ const PATH_PREFIX_KEY = Symbol("atui.path-prefix");
17
+ const LEVEL_KEY = Symbol("atui.level");
18
+ const HIDE_ROOT_TITLE_KEY = Symbol("atui.hide-root-title");
19
+ const TYPES_KEY = Symbol("atui.types");
20
+ const COMPONENTS_KEY = Symbol("atui.components");
21
+ const ERRORS_KEY = Symbol("atui.errors");
22
+ const ACTION_HANDLER_KEY = Symbol("atui.action-handler");
23
+ const CHANGE_HANDLER_KEY = Symbol("atui.change-handler");
24
+ const DISMISS_EXTERNAL_AT_KEY = Symbol("atui.dismiss-external-at");
25
+ const UNION_CONTEXT_KEY = Symbol("atui.union-context");
26
+ //#endregion
27
+ //#region src/composables/use-form-context.ts
28
+ const EMPTY_PREFIX = (0, vue.computed)(() => "");
29
+ /**
30
+ * Unified injection composable for as-* components. Consolidates form
31
+ * state, root data, and path prefix into a single call with shared
32
+ * helpers.
33
+ */
34
+ function useFormContext(componentName) {
35
+ const _formState = (0, vue.inject)(FORM_STATE_KEY);
36
+ if (!_formState) throw new Error(`${componentName} must be used inside an AsForm component`);
37
+ const formState = _formState;
38
+ const rootData = (0, vue.inject)(ROOT_DATA_KEY);
39
+ if (!rootData) throw new Error(`${componentName} must be used inside an AsForm component (missing root data)`);
40
+ const rootFormData = () => rootData.value;
41
+ const pathPrefix = (0, vue.inject)(PATH_PREFIX_KEY, EMPTY_PREFIX);
42
+ const _formContext = (0, vue.inject)(FORM_CONTEXT_KEY);
43
+ const formContext = (0, vue.computed)(() => _formContext?.value ?? {});
44
+ function joinPath(segment) {
45
+ return (0, vue.computed)(() => {
46
+ const s = typeof segment === "function" ? segment() : segment;
47
+ if (!s) return pathPrefix.value;
48
+ return pathPrefix.value ? `${pathPrefix.value}.${s}` : s;
49
+ });
50
+ }
51
+ function buildPath(segment) {
52
+ if (!segment) return pathPrefix.value;
53
+ return pathPrefix.value ? `${pathPrefix.value}.${segment}` : segment;
54
+ }
55
+ function getByPath(path) {
56
+ return (0, _atscript_ui.getByPath)(rootFormData(), path);
57
+ }
58
+ function setByPath(path, value) {
59
+ (0, _atscript_ui.setByPath)(rootFormData(), path, value);
60
+ }
61
+ function buildScope(v, entry) {
62
+ return {
63
+ v,
64
+ data: rootFormData().value,
65
+ context: formContext.value,
66
+ entry
67
+ };
68
+ }
69
+ return {
70
+ formState,
71
+ rootFormData,
72
+ pathPrefix,
73
+ formContext,
74
+ joinPath,
75
+ buildPath,
76
+ getByPath,
77
+ setByPath,
78
+ buildScope
79
+ };
80
+ }
81
+ /**
82
+ * Consume and clear the union context injection.
83
+ *
84
+ * Structured components (object, tuple, array, field-shell) call this to
85
+ * read the union context provided by `AsUnion` and immediately clear it
86
+ * so nested children don't inherit it.
87
+ */
88
+ function useAsUnionVariant() {
89
+ const unionCtx = (0, vue.inject)(UNION_CONTEXT_KEY, void 0);
90
+ (0, vue.provide)(UNION_CONTEXT_KEY, void 0);
91
+ return unionCtx;
92
+ }
93
+ function capitalize(s) {
94
+ return s.length === 0 ? s : s[0].toUpperCase() + s.slice(1);
95
+ }
96
+ /** Split a label into base + optional `#N` suffix for two-part rendering. */
97
+ function formatIndexedLabelParts(label, arrayIndex) {
98
+ const base = label ? capitalize(label) : "";
99
+ if (arrayIndex === void 0) return base ? { base } : void 0;
100
+ return {
101
+ base,
102
+ suffix: `#${arrayIndex + 1}`
103
+ };
104
+ }
105
+ //#endregion
106
+ Object.defineProperty(exports, "ACTION_HANDLER_KEY", {
107
+ enumerable: true,
108
+ get: function() {
109
+ return ACTION_HANDLER_KEY;
110
+ }
111
+ });
112
+ Object.defineProperty(exports, "CHANGE_HANDLER_KEY", {
113
+ enumerable: true,
114
+ get: function() {
115
+ return CHANGE_HANDLER_KEY;
116
+ }
117
+ });
118
+ Object.defineProperty(exports, "COMPONENTS_KEY", {
119
+ enumerable: true,
120
+ get: function() {
121
+ return COMPONENTS_KEY;
122
+ }
123
+ });
124
+ Object.defineProperty(exports, "DISMISS_EXTERNAL_AT_KEY", {
125
+ enumerable: true,
126
+ get: function() {
127
+ return DISMISS_EXTERNAL_AT_KEY;
128
+ }
129
+ });
130
+ Object.defineProperty(exports, "ERRORS_KEY", {
131
+ enumerable: true,
132
+ get: function() {
133
+ return ERRORS_KEY;
134
+ }
135
+ });
136
+ Object.defineProperty(exports, "FORM_CONTEXT_KEY", {
137
+ enumerable: true,
138
+ get: function() {
139
+ return FORM_CONTEXT_KEY;
140
+ }
141
+ });
142
+ Object.defineProperty(exports, "FORM_DATA_KEY", {
143
+ enumerable: true,
144
+ get: function() {
145
+ return FORM_DATA_KEY;
146
+ }
147
+ });
148
+ Object.defineProperty(exports, "FORM_STATE_KEY", {
149
+ enumerable: true,
150
+ get: function() {
151
+ return FORM_STATE_KEY;
152
+ }
153
+ });
154
+ Object.defineProperty(exports, "HIDE_ROOT_TITLE_KEY", {
155
+ enumerable: true,
156
+ get: function() {
157
+ return HIDE_ROOT_TITLE_KEY;
158
+ }
159
+ });
160
+ Object.defineProperty(exports, "LEVEL_KEY", {
161
+ enumerable: true,
162
+ get: function() {
163
+ return LEVEL_KEY;
164
+ }
165
+ });
166
+ Object.defineProperty(exports, "PATH_PREFIX_KEY", {
167
+ enumerable: true,
168
+ get: function() {
169
+ return PATH_PREFIX_KEY;
170
+ }
171
+ });
172
+ Object.defineProperty(exports, "ROOT_DATA_KEY", {
173
+ enumerable: true,
174
+ get: function() {
175
+ return ROOT_DATA_KEY;
176
+ }
177
+ });
178
+ Object.defineProperty(exports, "TYPES_KEY", {
179
+ enumerable: true,
180
+ get: function() {
181
+ return TYPES_KEY;
182
+ }
183
+ });
184
+ Object.defineProperty(exports, "UNION_CONTEXT_KEY", {
185
+ enumerable: true,
186
+ get: function() {
187
+ return UNION_CONTEXT_KEY;
188
+ }
189
+ });
190
+ Object.defineProperty(exports, "formatIndexedLabelParts", {
191
+ enumerable: true,
192
+ get: function() {
193
+ return formatIndexedLabelParts;
194
+ }
195
+ });
196
+ Object.defineProperty(exports, "useAsUnionVariant", {
197
+ enumerable: true,
198
+ get: function() {
199
+ return useAsUnionVariant;
200
+ }
201
+ });
202
+ Object.defineProperty(exports, "useFormContext", {
203
+ enumerable: true,
204
+ get: function() {
205
+ return useFormContext;
206
+ }
207
+ });
@@ -0,0 +1,106 @@
1
+ import { computed, inject, provide } from "vue";
2
+ import { getByPath, setByPath } from "@atscript/ui";
3
+ //#region src/composables/internal-keys.ts
4
+ /**
5
+ * Typed Vue provide/inject keys used across the form tree.
6
+ *
7
+ * Keys with generic value types (form data, form context) are intentionally
8
+ * widened to `unknown` here — call sites cast to their concrete generic.
9
+ * This is the standard Vue tradeoff for `InjectionKey<T>`: a key has one
10
+ * concrete type, so the generic flexibility lives at the consumer.
11
+ */
12
+ const FORM_STATE_KEY = Symbol("atui.form-state");
13
+ const FORM_DATA_KEY = Symbol("atui.form-data");
14
+ const FORM_CONTEXT_KEY = Symbol("atui.form-context");
15
+ const ROOT_DATA_KEY = Symbol("atui.root-data");
16
+ const PATH_PREFIX_KEY = Symbol("atui.path-prefix");
17
+ const LEVEL_KEY = Symbol("atui.level");
18
+ const HIDE_ROOT_TITLE_KEY = Symbol("atui.hide-root-title");
19
+ const TYPES_KEY = Symbol("atui.types");
20
+ const COMPONENTS_KEY = Symbol("atui.components");
21
+ const ERRORS_KEY = Symbol("atui.errors");
22
+ const ACTION_HANDLER_KEY = Symbol("atui.action-handler");
23
+ const CHANGE_HANDLER_KEY = Symbol("atui.change-handler");
24
+ const DISMISS_EXTERNAL_AT_KEY = Symbol("atui.dismiss-external-at");
25
+ const UNION_CONTEXT_KEY = Symbol("atui.union-context");
26
+ //#endregion
27
+ //#region src/composables/use-form-context.ts
28
+ const EMPTY_PREFIX = computed(() => "");
29
+ /**
30
+ * Unified injection composable for as-* components. Consolidates form
31
+ * state, root data, and path prefix into a single call with shared
32
+ * helpers.
33
+ */
34
+ function useFormContext(componentName) {
35
+ const _formState = inject(FORM_STATE_KEY);
36
+ if (!_formState) throw new Error(`${componentName} must be used inside an AsForm component`);
37
+ const formState = _formState;
38
+ const rootData = inject(ROOT_DATA_KEY);
39
+ if (!rootData) throw new Error(`${componentName} must be used inside an AsForm component (missing root data)`);
40
+ const rootFormData = () => rootData.value;
41
+ const pathPrefix = inject(PATH_PREFIX_KEY, EMPTY_PREFIX);
42
+ const _formContext = inject(FORM_CONTEXT_KEY);
43
+ const formContext = computed(() => _formContext?.value ?? {});
44
+ function joinPath(segment) {
45
+ return computed(() => {
46
+ const s = typeof segment === "function" ? segment() : segment;
47
+ if (!s) return pathPrefix.value;
48
+ return pathPrefix.value ? `${pathPrefix.value}.${s}` : s;
49
+ });
50
+ }
51
+ function buildPath(segment) {
52
+ if (!segment) return pathPrefix.value;
53
+ return pathPrefix.value ? `${pathPrefix.value}.${segment}` : segment;
54
+ }
55
+ function getByPath$1(path) {
56
+ return getByPath(rootFormData(), path);
57
+ }
58
+ function setByPath$1(path, value) {
59
+ setByPath(rootFormData(), path, value);
60
+ }
61
+ function buildScope(v, entry) {
62
+ return {
63
+ v,
64
+ data: rootFormData().value,
65
+ context: formContext.value,
66
+ entry
67
+ };
68
+ }
69
+ return {
70
+ formState,
71
+ rootFormData,
72
+ pathPrefix,
73
+ formContext,
74
+ joinPath,
75
+ buildPath,
76
+ getByPath: getByPath$1,
77
+ setByPath: setByPath$1,
78
+ buildScope
79
+ };
80
+ }
81
+ /**
82
+ * Consume and clear the union context injection.
83
+ *
84
+ * Structured components (object, tuple, array, field-shell) call this to
85
+ * read the union context provided by `AsUnion` and immediately clear it
86
+ * so nested children don't inherit it.
87
+ */
88
+ function useAsUnionVariant() {
89
+ const unionCtx = inject(UNION_CONTEXT_KEY, void 0);
90
+ provide(UNION_CONTEXT_KEY, void 0);
91
+ return unionCtx;
92
+ }
93
+ function capitalize(s) {
94
+ return s.length === 0 ? s : s[0].toUpperCase() + s.slice(1);
95
+ }
96
+ /** Split a label into base + optional `#N` suffix for two-part rendering. */
97
+ function formatIndexedLabelParts(label, arrayIndex) {
98
+ const base = label ? capitalize(label) : "";
99
+ if (arrayIndex === void 0) return base ? { base } : void 0;
100
+ return {
101
+ base,
102
+ suffix: `#${arrayIndex + 1}`
103
+ };
104
+ }
105
+ //#endregion
106
+ export { UNION_CONTEXT_KEY as _, CHANGE_HANDLER_KEY as a, ERRORS_KEY as c, FORM_STATE_KEY as d, HIDE_ROOT_TITLE_KEY as f, TYPES_KEY as g, ROOT_DATA_KEY as h, ACTION_HANDLER_KEY as i, FORM_CONTEXT_KEY as l, PATH_PREFIX_KEY as m, useAsUnionVariant as n, COMPONENTS_KEY as o, LEVEL_KEY as p, useFormContext as r, DISMISS_EXTERNAL_AT_KEY as s, formatIndexedLabelParts as t, FORM_DATA_KEY as u };
package/package.json ADDED
@@ -0,0 +1,180 @@
1
+ {
2
+ "name": "@atscript/vue-form",
3
+ "version": "0.1.58",
4
+ "description": "Type-driven form rendering for Atscript with Vue 3",
5
+ "keywords": [
6
+ "atscript",
7
+ "components",
8
+ "form",
9
+ "form-builder",
10
+ "metadata",
11
+ "type-driven",
12
+ "typescript",
13
+ "vue",
14
+ "vue3"
15
+ ],
16
+ "homepage": "https://github.com/moostjs/atscript-ui/tree/main/packages/vue-form#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/moostjs/atscript-ui/issues"
19
+ },
20
+ "license": "MIT",
21
+ "author": "Artem Maltsev <artem@maltsev.nl>",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/moostjs/atscript-ui.git",
25
+ "directory": "packages/vue-form"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "styles.d.ts"
30
+ ],
31
+ "type": "module",
32
+ "main": "dist/index.mjs",
33
+ "types": "dist/index.d.mts",
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.mts",
37
+ "import": "./dist/index.mjs",
38
+ "require": "./dist/index.cjs"
39
+ },
40
+ "./as-action": {
41
+ "types": "./dist/as-action.d.mts",
42
+ "import": "./dist/as-action.mjs",
43
+ "require": "./dist/as-action.cjs"
44
+ },
45
+ "./as-array": {
46
+ "types": "./dist/as-array.d.mts",
47
+ "import": "./dist/as-array.mjs",
48
+ "require": "./dist/as-array.cjs"
49
+ },
50
+ "./as-checkbox": {
51
+ "types": "./dist/as-checkbox.d.mts",
52
+ "import": "./dist/as-checkbox.mjs",
53
+ "require": "./dist/as-checkbox.cjs"
54
+ },
55
+ "./as-date": {
56
+ "types": "./dist/as-date.d.mts",
57
+ "import": "./dist/as-date.mjs",
58
+ "require": "./dist/as-date.cjs"
59
+ },
60
+ "./as-datetime": {
61
+ "types": "./dist/as-datetime.d.mts",
62
+ "import": "./dist/as-datetime.mjs",
63
+ "require": "./dist/as-datetime.cjs"
64
+ },
65
+ "./as-decimal": {
66
+ "types": "./dist/as-decimal.d.mts",
67
+ "import": "./dist/as-decimal.mjs",
68
+ "require": "./dist/as-decimal.cjs"
69
+ },
70
+ "./as-field": {
71
+ "types": "./dist/as-field.d.mts",
72
+ "import": "./dist/as-field.mjs",
73
+ "require": "./dist/as-field.cjs"
74
+ },
75
+ "./as-field-shell": {
76
+ "types": "./dist/as-field-shell.d.mts",
77
+ "import": "./dist/as-field-shell.mjs",
78
+ "require": "./dist/as-field-shell.cjs"
79
+ },
80
+ "./as-form": {
81
+ "types": "./dist/as-form.d.mts",
82
+ "import": "./dist/as-form.mjs",
83
+ "require": "./dist/as-form.cjs"
84
+ },
85
+ "./as-input": {
86
+ "types": "./dist/as-input.d.mts",
87
+ "import": "./dist/as-input.mjs",
88
+ "require": "./dist/as-input.cjs"
89
+ },
90
+ "./as-iterator": {
91
+ "types": "./dist/as-iterator.d.mts",
92
+ "import": "./dist/as-iterator.mjs",
93
+ "require": "./dist/as-iterator.cjs"
94
+ },
95
+ "./as-number": {
96
+ "types": "./dist/as-number.d.mts",
97
+ "import": "./dist/as-number.mjs",
98
+ "require": "./dist/as-number.cjs"
99
+ },
100
+ "./as-object": {
101
+ "types": "./dist/as-object.d.mts",
102
+ "import": "./dist/as-object.mjs",
103
+ "require": "./dist/as-object.cjs"
104
+ },
105
+ "./as-paragraph": {
106
+ "types": "./dist/as-paragraph.d.mts",
107
+ "import": "./dist/as-paragraph.mjs",
108
+ "require": "./dist/as-paragraph.cjs"
109
+ },
110
+ "./as-radio": {
111
+ "types": "./dist/as-radio.d.mts",
112
+ "import": "./dist/as-radio.mjs",
113
+ "require": "./dist/as-radio.cjs"
114
+ },
115
+ "./as-ref": {
116
+ "types": "./dist/as-ref.d.mts",
117
+ "import": "./dist/as-ref.mjs",
118
+ "require": "./dist/as-ref.cjs"
119
+ },
120
+ "./as-select": {
121
+ "types": "./dist/as-select.d.mts",
122
+ "import": "./dist/as-select.mjs",
123
+ "require": "./dist/as-select.cjs"
124
+ },
125
+ "./as-time": {
126
+ "types": "./dist/as-time.d.mts",
127
+ "import": "./dist/as-time.mjs",
128
+ "require": "./dist/as-time.cjs"
129
+ },
130
+ "./as-tuple": {
131
+ "types": "./dist/as-tuple.d.mts",
132
+ "import": "./dist/as-tuple.mjs",
133
+ "require": "./dist/as-tuple.cjs"
134
+ },
135
+ "./as-union": {
136
+ "types": "./dist/as-union.d.mts",
137
+ "import": "./dist/as-union.mjs",
138
+ "require": "./dist/as-union.cjs"
139
+ },
140
+ "./styles": {
141
+ "types": "./styles.d.ts",
142
+ "default": "./dist/style.css"
143
+ },
144
+ "./package.json": "./package.json"
145
+ },
146
+ "publishConfig": {
147
+ "access": "public"
148
+ },
149
+ "dependencies": {
150
+ "@atscript/ui": "^0.1.58"
151
+ },
152
+ "devDependencies": {
153
+ "@atscript/core": "^0.1.54",
154
+ "@atscript/db-client": "^0.1.75",
155
+ "@atscript/typescript": "^0.1.54",
156
+ "@tsdown/css": "^0.21.4",
157
+ "@vitejs/plugin-vue": "^6",
158
+ "@vue/test-utils": "^2",
159
+ "happy-dom": "^18",
160
+ "reka-ui": "^2.9.2",
161
+ "unplugin-atscript": "^0.1.54",
162
+ "vitest": "npm:@voidzero-dev/vite-plus-test@latest",
163
+ "vue": "^3",
164
+ "vue-tsc": "^3.2.6",
165
+ "vunor": "^0.2",
166
+ "@atscript/ui-fns": "^0.1.58"
167
+ },
168
+ "peerDependencies": {
169
+ "@atscript/db-client": "^0.1.75",
170
+ "reka-ui": "^2.9.2",
171
+ "vue": "^3",
172
+ "@atscript/ui-fns": "^0.1.58"
173
+ },
174
+ "scripts": {
175
+ "build": "node ../../scripts/gen-exports.mjs && vp pack",
176
+ "dev": "vp pack --watch",
177
+ "test": "vp test",
178
+ "check": "vp check"
179
+ }
180
+ }
package/styles.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const styles: string;
2
+ export default styles;