mlform 0.1.2 → 0.1.4

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 (299) hide show
  1. package/README.md +241 -88
  2. package/dist/design-system-CrrSGfFB.js +1352 -0
  3. package/dist/engine-nnhWPT2L.js +5301 -0
  4. package/dist/kit-Dt_1Fxlc.js +76 -0
  5. package/dist/mlform/design-system.mjs +2 -0
  6. package/dist/mlform/engine.mjs +3 -0
  7. package/dist/mlform/kit.mjs +3 -0
  8. package/dist/mlform/primitives.mjs +2 -0
  9. package/dist/mlform/questionnaire.mjs +640 -0
  10. package/dist/mlform/transport.mjs +2 -0
  11. package/dist/mlform.mjs +4 -709
  12. package/dist/primitives-Pi-ztAr6.js +5063 -0
  13. package/dist/transport-A1RsnZhD.js +2143 -0
  14. package/dist/types/src/design-system/constants.d.ts +34 -0
  15. package/dist/types/src/design-system/contract/component-keys.d.ts +2 -0
  16. package/dist/types/src/design-system/contract/component-tokens.d.ts +5 -0
  17. package/dist/types/src/design-system/contract/global-tokens.d.ts +7 -0
  18. package/dist/types/src/design-system/contract/index.d.ts +4 -0
  19. package/dist/types/src/design-system/contract/token-keys.d.ts +12 -0
  20. package/dist/types/src/design-system/index.d.ts +8 -0
  21. package/dist/types/src/design-system/recipes/contrast.d.ts +2 -0
  22. package/dist/types/src/design-system/recipes/default.d.ts +2 -0
  23. package/dist/types/src/design-system/recipes/index.d.ts +4 -0
  24. package/dist/types/src/design-system/recipes/minimal.d.ts +2 -0
  25. package/dist/types/src/design-system/recipes/soft.d.ts +2 -0
  26. package/dist/types/src/design-system/registry/builtins.d.ts +5 -0
  27. package/dist/types/src/design-system/registry/create-registry.d.ts +2 -0
  28. package/dist/types/src/design-system/registry/deep-freeze.d.ts +5 -0
  29. package/dist/types/src/design-system/registry/define-recipe.d.ts +2 -0
  30. package/dist/types/src/design-system/registry/define-theme.d.ts +2 -0
  31. package/dist/types/src/design-system/registry/define-token-maps.d.ts +6 -0
  32. package/dist/types/src/design-system/registry/index.d.ts +5 -0
  33. package/dist/types/src/design-system/resolve/diagnostics.d.ts +9 -0
  34. package/dist/types/src/design-system/resolve/index.d.ts +5 -0
  35. package/dist/types/src/design-system/resolve/merge-config.d.ts +2 -0
  36. package/dist/types/src/design-system/resolve/migrate-tokens.d.ts +44 -0
  37. package/dist/types/src/design-system/resolve/resolve-mode.d.ts +6 -0
  38. package/dist/types/src/design-system/resolve/resolve-recipe.d.ts +2 -0
  39. package/dist/types/src/design-system/resolve/resolve-theme.d.ts +2 -0
  40. package/dist/types/src/design-system/resolve/resolve-tokens.d.ts +2 -0
  41. package/dist/types/src/design-system/runtime/apply-tokens.d.ts +4 -0
  42. package/dist/types/src/design-system/runtime/attach-design-system.d.ts +11 -0
  43. package/dist/types/src/design-system/runtime/create-stylesheet.d.ts +11 -0
  44. package/dist/types/src/design-system/runtime/declarations.d.ts +5 -0
  45. package/dist/types/src/design-system/runtime/design-system-controller.d.ts +9 -0
  46. package/dist/types/src/design-system/runtime/host-state.d.ts +3 -0
  47. package/dist/types/src/design-system/runtime/hydrate-design-system.d.ts +25 -0
  48. package/dist/types/src/design-system/runtime/index.d.ts +8 -0
  49. package/dist/types/src/design-system/themes/cobalt.d.ts +2 -0
  50. package/dist/types/src/design-system/themes/graphite.d.ts +2 -0
  51. package/dist/types/src/design-system/themes/index.d.ts +5 -0
  52. package/dist/types/src/design-system/themes/neutral.d.ts +2 -0
  53. package/dist/types/src/design-system/themes/sage.d.ts +2 -0
  54. package/dist/types/src/design-system/themes/sunset.d.ts +2 -0
  55. package/dist/types/src/design-system/tokens/base.d.ts +5 -0
  56. package/dist/types/src/design-system/tokens/contrast.d.ts +8 -0
  57. package/dist/types/src/design-system/tokens/density.d.ts +9 -0
  58. package/dist/types/src/design-system/tokens/forced-colors.d.ts +12 -0
  59. package/dist/types/src/design-system/tokens/index.d.ts +5 -0
  60. package/dist/types/src/design-system/tokens/motion.d.ts +2 -0
  61. package/dist/types/src/design-system/types.d.ts +225 -0
  62. package/dist/types/src/engine/builtins/fields/boolean.d.ts +8 -0
  63. package/dist/types/src/engine/builtins/fields/category.d.ts +11 -0
  64. package/dist/types/src/engine/builtins/fields/date.d.ts +9 -0
  65. package/dist/types/src/engine/builtins/fields/long-text.d.ts +10 -0
  66. package/dist/types/src/engine/builtins/fields/multi-choice.d.ts +12 -0
  67. package/dist/types/src/engine/builtins/fields/number.d.ts +11 -0
  68. package/dist/types/src/engine/builtins/fields/rating.d.ts +9 -0
  69. package/dist/types/src/engine/builtins/fields/series.d.ts +20 -0
  70. package/dist/types/src/engine/builtins/fields/single-choice.d.ts +12 -0
  71. package/dist/types/src/engine/builtins/fields/text.d.ts +10 -0
  72. package/dist/types/src/engine/builtins/index.d.ts +97 -0
  73. package/dist/types/src/engine/builtins/reports/classifier.d.ts +8 -0
  74. package/dist/types/src/engine/builtins/reports/regressor.d.ts +8 -0
  75. package/dist/types/src/engine/builtins/shared.d.ts +49 -0
  76. package/dist/types/src/engine/comparison.d.ts +2 -0
  77. package/dist/types/src/engine/constants.d.ts +51 -0
  78. package/dist/types/src/engine/declarative/explanation.d.ts +2 -0
  79. package/dist/types/src/engine/declarative/field.d.ts +2 -0
  80. package/dist/types/src/engine/declarative/presentation.d.ts +61 -0
  81. package/dist/types/src/engine/declarative/report.d.ts +2 -0
  82. package/dist/types/src/engine/equality.d.ts +4 -0
  83. package/dist/types/src/engine/errors.d.ts +28 -0
  84. package/dist/types/src/engine/explanations/controller.d.ts +13 -0
  85. package/dist/types/src/engine/explanations/index.d.ts +1 -0
  86. package/dist/types/src/engine/fields/controller.d.ts +30 -0
  87. package/dist/types/src/engine/fields/index.d.ts +1 -0
  88. package/dist/types/src/engine/form.d.ts +2 -0
  89. package/dist/types/src/engine/index.d.ts +11 -0
  90. package/dist/types/src/engine/paths.d.ts +2 -0
  91. package/dist/types/src/engine/registry/index.d.ts +26 -0
  92. package/dist/types/src/engine/reports/controller.d.ts +19 -0
  93. package/dist/types/src/engine/reports/index.d.ts +1 -0
  94. package/dist/types/src/engine/schema/index.d.ts +7 -0
  95. package/dist/types/src/engine/state/engine.d.ts +60 -0
  96. package/dist/types/src/engine/state/index.d.ts +3 -0
  97. package/dist/types/src/engine/state/snapshots.d.ts +5 -0
  98. package/dist/types/src/engine/state/store.d.ts +13 -0
  99. package/dist/types/src/engine/submission/abort.d.ts +15 -0
  100. package/dist/types/src/engine/submission/explanations.d.ts +2 -0
  101. package/dist/types/src/engine/submission/index.d.ts +5 -0
  102. package/dist/types/src/engine/submission/lifecycle.d.ts +16 -0
  103. package/dist/types/src/engine/submission/pipeline.d.ts +2 -0
  104. package/dist/types/src/engine/submission/reports.d.ts +12 -0
  105. package/dist/types/src/engine/submission/request.d.ts +23 -0
  106. package/dist/types/src/engine/submission/result.d.ts +4 -0
  107. package/dist/types/src/engine/submission/submitter.d.ts +40 -0
  108. package/dist/types/src/engine/types/explanation.d.ts +109 -0
  109. package/dist/types/src/engine/types/field.d.ts +172 -0
  110. package/dist/types/src/engine/types/form.d.ts +120 -0
  111. package/dist/types/src/engine/types/index.d.ts +9 -0
  112. package/dist/types/src/engine/types/pipeline.d.ts +31 -0
  113. package/dist/types/src/engine/types/registry.d.ts +17 -0
  114. package/dist/types/src/engine/types/report.d.ts +87 -0
  115. package/dist/types/src/engine/types/transport.d.ts +41 -0
  116. package/dist/types/src/engine/utils.d.ts +9 -0
  117. package/dist/types/src/engine/validation/conditions.d.ts +11 -0
  118. package/dist/types/src/engine/validation/field.d.ts +29 -0
  119. package/dist/types/src/engine/validation/form.d.ts +35 -0
  120. package/dist/types/src/engine/validation/index.d.ts +3 -0
  121. package/dist/types/src/engine/values.d.ts +2 -0
  122. package/dist/types/src/index.d.ts +7 -0
  123. package/dist/types/src/kit/constants.d.ts +4 -0
  124. package/dist/types/src/kit/defaults.d.ts +11 -0
  125. package/dist/types/src/kit/index.d.ts +4 -0
  126. package/dist/types/src/kit/mount-form.d.ts +3 -0
  127. package/dist/types/src/kit/types.d.ts +52 -0
  128. package/dist/types/src/primitives/base-async-report-element.d.ts +19 -0
  129. package/dist/types/src/primitives/base-explanation-element.d.ts +21 -0
  130. package/dist/types/src/primitives/base-field-element.d.ts +21 -0
  131. package/dist/types/src/primitives/base-report-element.d.ts +15 -0
  132. package/dist/types/src/primitives/components/declarative-explanation.d.ts +5 -0
  133. package/dist/types/src/primitives/components/declarative-field.d.ts +6 -0
  134. package/dist/types/src/primitives/components/declarative-report.d.ts +5 -0
  135. package/dist/types/src/primitives/components/explanation-panel.d.ts +22 -0
  136. package/dist/types/src/primitives/components/field-frame.d.ts +21 -0
  137. package/dist/types/src/primitives/components/form-errors.d.ts +19 -0
  138. package/dist/types/src/primitives/components/form-root.d.ts +29 -0
  139. package/dist/types/src/primitives/components/presentation.d.ts +4 -0
  140. package/dist/types/src/primitives/components/report-frame.d.ts +22 -0
  141. package/dist/types/src/primitives/components/submit-button.d.ts +21 -0
  142. package/dist/types/src/primitives/components/unsupported-component.d.ts +14 -0
  143. package/dist/types/src/primitives/constants.d.ts +94 -0
  144. package/dist/types/src/primitives/controller-binding.d.ts +32 -0
  145. package/dist/types/src/primitives/fields/boolean-field.d.ts +6 -0
  146. package/dist/types/src/primitives/fields/category-field.d.ts +6 -0
  147. package/dist/types/src/primitives/fields/date-field.d.ts +6 -0
  148. package/dist/types/src/primitives/fields/long-text-field.d.ts +6 -0
  149. package/dist/types/src/primitives/fields/multi-choice-field.d.ts +6 -0
  150. package/dist/types/src/primitives/fields/number-field.d.ts +8 -0
  151. package/dist/types/src/primitives/fields/rating-field.d.ts +6 -0
  152. package/dist/types/src/primitives/fields/series-field.d.ts +8 -0
  153. package/dist/types/src/primitives/fields/single-choice-field.d.ts +6 -0
  154. package/dist/types/src/primitives/fields/text-field.d.ts +6 -0
  155. package/dist/types/src/primitives/index.d.ts +8 -0
  156. package/dist/types/src/primitives/mount-form.d.ts +4 -0
  157. package/dist/types/src/primitives/register.d.ts +0 -0
  158. package/dist/types/src/primitives/registry.d.ts +3 -0
  159. package/dist/types/src/primitives/reports/classifier-report.d.ts +5 -0
  160. package/dist/types/src/primitives/reports/regressor-report.d.ts +5 -0
  161. package/dist/types/src/primitives/types.d.ts +128 -0
  162. package/dist/types/src/primitives/utils.d.ts +3 -0
  163. package/dist/types/src/questionnaire/constants.d.ts +31 -0
  164. package/dist/types/src/questionnaire/defaults.d.ts +8 -0
  165. package/dist/types/src/questionnaire/engine/controller.d.ts +12 -0
  166. package/dist/types/src/questionnaire/engine/schema.d.ts +9 -0
  167. package/dist/types/src/questionnaire/errors.d.ts +3 -0
  168. package/dist/types/src/questionnaire/index.d.ts +6 -0
  169. package/dist/types/src/questionnaire/mount.d.ts +3 -0
  170. package/dist/types/src/questionnaire/primitives/components/questionnaire-root.d.ts +23 -0
  171. package/dist/types/src/questionnaire/primitives/components/step-indicator.d.ts +14 -0
  172. package/dist/types/src/questionnaire/primitives/register.d.ts +0 -0
  173. package/dist/types/src/questionnaire/types.d.ts +69 -0
  174. package/dist/types/src/shared/errors.d.ts +3 -0
  175. package/dist/types/src/shared/index.d.ts +1 -0
  176. package/dist/types/src/transport/capabilities.d.ts +7 -0
  177. package/dist/types/src/transport/clone.d.ts +6 -0
  178. package/dist/types/src/transport/composition/fallback.d.ts +2 -0
  179. package/dist/types/src/transport/composition/fanout.d.ts +3 -0
  180. package/dist/types/src/transport/composition/hedged.d.ts +2 -0
  181. package/dist/types/src/transport/composition/index.d.ts +7 -0
  182. package/dist/types/src/transport/composition/load-balancing.d.ts +2 -0
  183. package/dist/types/src/transport/composition/pipeline.d.ts +2 -0
  184. package/dist/types/src/transport/composition/racing.d.ts +2 -0
  185. package/dist/types/src/transport/composition/routing.d.ts +3 -0
  186. package/dist/types/src/transport/constants.d.ts +34 -0
  187. package/dist/types/src/transport/errors.d.ts +36 -0
  188. package/dist/types/src/transport/index.d.ts +9 -0
  189. package/dist/types/src/transport/internal.d.ts +110 -0
  190. package/dist/types/src/transport/middleware/auth.d.ts +2 -0
  191. package/dist/types/src/transport/middleware/cache.d.ts +2 -0
  192. package/dist/types/src/transport/middleware/circuit-breaker.d.ts +2 -0
  193. package/dist/types/src/transport/middleware/dedup.d.ts +2 -0
  194. package/dist/types/src/transport/middleware/index.d.ts +12 -0
  195. package/dist/types/src/transport/middleware/logging.d.ts +2 -0
  196. package/dist/types/src/transport/middleware/metrics.d.ts +2 -0
  197. package/dist/types/src/transport/middleware/pipe.d.ts +2 -0
  198. package/dist/types/src/transport/middleware/rate-limit.d.ts +2 -0
  199. package/dist/types/src/transport/middleware/retry.d.ts +2 -0
  200. package/dist/types/src/transport/middleware/timeout.d.ts +2 -0
  201. package/dist/types/src/transport/middleware/tracing.d.ts +2 -0
  202. package/dist/types/src/transport/middleware/transform.d.ts +3 -0
  203. package/dist/types/src/transport/policy-context.d.ts +3 -0
  204. package/dist/types/src/transport/protocols/graphql.d.ts +2 -0
  205. package/dist/types/src/transport/protocols/grpc.d.ts +5 -0
  206. package/dist/types/src/transport/protocols/index.d.ts +5 -0
  207. package/dist/types/src/transport/protocols/json.d.ts +2 -0
  208. package/dist/types/src/transport/protocols/sse.d.ts +2 -0
  209. package/dist/types/src/transport/protocols/websocket.d.ts +2 -0
  210. package/dist/types/src/transport/runtime.d.ts +4 -0
  211. package/dist/types/src/transport/state/cache-store.d.ts +2 -0
  212. package/dist/types/src/transport/state/circuit-breaker.d.ts +2 -0
  213. package/dist/types/src/transport/state/health.d.ts +2 -0
  214. package/dist/types/src/transport/state/index.d.ts +5 -0
  215. package/dist/types/src/transport/state/rate-limiter.d.ts +2 -0
  216. package/dist/types/src/transport/state/session.d.ts +2 -0
  217. package/dist/types/src/transport/types/capabilities.d.ts +35 -0
  218. package/dist/types/src/transport/types/core.d.ts +57 -0
  219. package/dist/types/src/transport/types/events.d.ts +50 -0
  220. package/dist/types/src/transport/types/index.d.ts +7 -0
  221. package/dist/types/src/transport/types/middleware.d.ts +3 -0
  222. package/dist/types/src/transport/types/options.d.ts +258 -0
  223. package/dist/types/src/transport/types/session.d.ts +48 -0
  224. package/dist/types/src/transport/types/state.d.ts +46 -0
  225. package/package.json +93 -37
  226. package/dist/FieldStrategy-pPekBtH-.js +0 -2318
  227. package/dist/ModelTypes-B9_veCKB.js +0 -5
  228. package/dist/ReportStrategy-DY3GC_mJ.js +0 -23
  229. package/dist/boolean-field-Cd3uhIPj.js +0 -104
  230. package/dist/category-field-D_Ms1x9u.js +0 -73
  231. package/dist/classifier-prediction-C5QzorTo.js +0 -193
  232. package/dist/custom-element-ttkHUa8w.js +0 -13
  233. package/dist/date-field-Cg_ja679.js +0 -162
  234. package/dist/error-card-BwjPChwf.js +0 -195
  235. package/dist/field-wrapper-DqIQl76d.js +0 -177
  236. package/dist/ml-layout-Dx63KKf7.js +0 -332
  237. package/dist/mlform/extensions.mjs +0 -38
  238. package/dist/mlform/strategies.mjs +0 -292
  239. package/dist/number-field-CC2DrVEb.js +0 -165
  240. package/dist/property-jKFNMQpR.js +0 -561
  241. package/dist/range-field-Cr7LEtsJ.js +0 -98
  242. package/dist/regressor-prediction-C18dHlfK.js +0 -236
  243. package/dist/src/core/app/DescriptorItem.d.ts +0 -6
  244. package/dist/src/core/app/DescriptorRegistry.d.ts +0 -13
  245. package/dist/src/core/app/DescriptorService.d.ts +0 -22
  246. package/dist/src/core/app/DescriptorStrategy.d.ts +0 -11
  247. package/dist/src/core/app/index.d.ts +0 -4
  248. package/dist/src/core/domain/index.d.ts +0 -24
  249. package/dist/src/core/index.d.ts +0 -3
  250. package/dist/src/core/ui/error-card.d.ts +0 -38
  251. package/dist/src/core/ui/field-wrapper.d.ts +0 -23
  252. package/dist/src/core/ui/index.d.ts +0 -3
  253. package/dist/src/core/ui/ml-layout.d.ts +0 -23
  254. package/dist/src/extensions/app/FieldStrategy.d.ts +0 -10
  255. package/dist/src/extensions/app/ReportStrategy.d.ts +0 -9
  256. package/dist/src/extensions/app/index.d.ts +0 -2
  257. package/dist/src/extensions/domain/BaseField.d.ts +0 -7
  258. package/dist/src/extensions/domain/BaseModel.d.ts +0 -6
  259. package/dist/src/extensions/domain/index.d.ts +0 -2
  260. package/dist/src/extensions/index.d.ts +0 -3
  261. package/dist/src/extensions/ui/field-element.d.ts +0 -9
  262. package/dist/src/extensions/ui/index.d.ts +0 -1
  263. package/dist/src/index.d.ts +0 -1
  264. package/dist/src/mlform/index.d.ts +0 -1
  265. package/dist/src/mlform/mlform.d.ts +0 -27
  266. package/dist/src/mlform/mlform.types.d.ts +0 -11
  267. package/dist/src/strategies/app/BooleanStrategy.d.ts +0 -12
  268. package/dist/src/strategies/app/CategoryStrategy.d.ts +0 -13
  269. package/dist/src/strategies/app/ClassifierStrategy.d.ts +0 -15
  270. package/dist/src/strategies/app/DateStrategy.d.ts +0 -15
  271. package/dist/src/strategies/app/NumberStrategy.d.ts +0 -29
  272. package/dist/src/strategies/app/RegressorStrategy.d.ts +0 -15
  273. package/dist/src/strategies/app/TextStrategy.d.ts +0 -16
  274. package/dist/src/strategies/app/index.d.ts +0 -7
  275. package/dist/src/strategies/domain/BooleanField.d.ts +0 -10
  276. package/dist/src/strategies/domain/CategoryField.d.ts +0 -11
  277. package/dist/src/strategies/domain/ClassifierModel.d.ts +0 -11
  278. package/dist/src/strategies/domain/DateField.d.ts +0 -13
  279. package/dist/src/strategies/domain/FieldTypes.d.ts +0 -7
  280. package/dist/src/strategies/domain/ModelTypes.d.ts +0 -4
  281. package/dist/src/strategies/domain/NumberField.d.ts +0 -15
  282. package/dist/src/strategies/domain/RegressorModel.d.ts +0 -11
  283. package/dist/src/strategies/domain/TextField.d.ts +0 -14
  284. package/dist/src/strategies/domain/index.d.ts +0 -9
  285. package/dist/src/strategies/index.d.ts +0 -1
  286. package/dist/src/strategies/ui/boolean-field.d.ts +0 -13
  287. package/dist/src/strategies/ui/category-field.d.ts +0 -14
  288. package/dist/src/strategies/ui/classifier-prediction.d.ts +0 -39
  289. package/dist/src/strategies/ui/date-field.d.ts +0 -18
  290. package/dist/src/strategies/ui/index.d.ts +0 -8
  291. package/dist/src/strategies/ui/number-field.d.ts +0 -19
  292. package/dist/src/strategies/ui/range-field.d.ts +0 -17
  293. package/dist/src/strategies/ui/regressor-prediction.d.ts +0 -29
  294. package/dist/src/strategies/ui/text-field.d.ts +0 -17
  295. package/dist/state-CLlTRyl1.js +0 -12
  296. package/dist/test/_fixtures/DummyField.d.ts +0 -9
  297. package/dist/test/setup.d.ts +0 -1
  298. package/dist/test/unit/DummyField.test.d.ts +0 -1
  299. package/dist/text-field-DwP-Fa1w.js +0 -114
@@ -1,38 +0,0 @@
1
- import { F as h } from "../FieldStrategy-pPekBtH-.js";
2
- import { B as x, a as y, R as C } from "../ReportStrategy-DY3GC_mJ.js";
3
- import { i as o, a as l } from "../property-jKFNMQpR.js";
4
- import { r as d } from "../state-CLlTRyl1.js";
5
- var p = Object.defineProperty, c = (s, t, a, m) => {
6
- for (var e = void 0, r = s.length - 1, i; r >= 0; r--)
7
- (i = s[r]) && (e = i(t, a, e) || e);
8
- return e && p(t, a, e), e;
9
- };
10
- class n extends o {
11
- static baseStyles = l`
12
- * {
13
- box-sizing: border-box;
14
- }
15
- `;
16
- connectedCallback() {
17
- super.connectedCallback(), this.value = void 0, this.dispatchState("empty");
18
- }
19
- dispatchState(t, a = "") {
20
- this.dispatchEvent(
21
- new CustomEvent("field-state", {
22
- detail: { state: t, message: a, value: this.value },
23
- bubbles: !0,
24
- composed: !0
25
- })
26
- );
27
- }
28
- }
29
- c([
30
- d()
31
- ], n.prototype, "value");
32
- export {
33
- x as BaseFieldSchema,
34
- y as BaseModelSchema,
35
- n as FieldElement,
36
- h as FieldStrategy,
37
- C as ReportStrategy
38
- };
@@ -1,292 +0,0 @@
1
- import { s as i, o as a, e as o, b as E, d as r, a as u, n, i as d, f as h, t as M, F as l } from "../FieldStrategy-pPekBtH-.js";
2
- import { F as s, M as p } from "../ModelTypes-B9_veCKB.js";
3
- import { B as m, a as S, R as A } from "../ReportStrategy-DY3GC_mJ.js";
4
- const T = i({
5
- ...m.shape,
6
- type: o(s.BOOLEAN),
7
- value: a(E())
8
- }), _ = "The value must match one of the allowed options", L = (e, t) => !(t === void 0 || e.includes(t)), b = i({
9
- ...m.shape,
10
- type: o(s.CATEGORY),
11
- value: a(u()),
12
- options: r(u()).min(1)
13
- }).check((e) => {
14
- L(e.value.options, e.value.value) && e.issues.push({
15
- code: "custom",
16
- path: ["value"],
17
- message: _,
18
- input: e.value,
19
- continue: !0
20
- });
21
- }), y = i({
22
- ...S.shape,
23
- type: o(p.CLASSIFIER),
24
- mapping: a(r(u().min(1))),
25
- probabilities: a(
26
- r(r(n().min(0).max(1)).min(1)).min(1)
27
- ),
28
- details: E().default(!1)
29
- }), N = "The minimum date must be earlier than or equal to the maximum date", R = "The selected date must be later than or equal to the minimum date", O = "The selected date must be earlier than or equal to the maximum date", v = (e, t) => !(e === void 0 || t === void 0 || new Date(e) <= new Date(t)), I = i({
30
- ...m.shape,
31
- type: o(s.DATE),
32
- value: a(h()),
33
- min: a(h()),
34
- max: a(h()),
35
- step: a(d().min(1).default(1))
36
- }).check((e) => {
37
- v(e.value.min, e.value.max) && e.issues.push({
38
- code: "custom",
39
- path: ["min"],
40
- message: N,
41
- input: e.value,
42
- continue: !0
43
- }), v(e.value.value, e.value.max) && e.issues.push({
44
- code: "custom",
45
- path: ["value"],
46
- message: O,
47
- input: e.value,
48
- continue: !0
49
- }), v(e.value.min, e.value.value) && e.issues.push({
50
- code: "custom",
51
- path: ["min"],
52
- message: R,
53
- input: e.value,
54
- continue: !0
55
- });
56
- }), C = "The minimum value must be less than or equal to the maximum value", G = "The selected value must be greater than or equal to the minimum value", f = "The selected value must be less than or equal to the maximum value", c = (e, t) => !(e === void 0 || t === void 0 || e <= t), V = i({
57
- ...m.shape,
58
- type: o(s.NUMBER),
59
- min: a(n()),
60
- max: a(n()),
61
- step: a(n().positive().default(1)),
62
- placeholder: a(u()),
63
- value: a(n()),
64
- unit: a(u())
65
- }).check((e) => {
66
- c(e.value.min, e.value.max) && e.issues.push({
67
- code: "custom",
68
- path: ["min"],
69
- message: C,
70
- input: e.value,
71
- continue: !0
72
- }), c(e.value.min, e.value.value) && e.issues.push({
73
- code: "custom",
74
- path: ["min"],
75
- message: G,
76
- input: e.value,
77
- continue: !0
78
- }), c(e.value.value, e.value.max) && e.issues.push({
79
- code: "custom",
80
- path: ["value"],
81
- message: f,
82
- input: e.value,
83
- continue: !0
84
- });
85
- }), B = i({
86
- ...S.shape,
87
- type: o(p.REGRESSOR),
88
- values: a(r(n()).min(1)),
89
- unit: a(u()),
90
- interval: a(M([n(), n()]))
91
- }), D = "Invalid regex pattern", F = "Minimum length must be less than or equal to maximum length", U = "Minimum length is <<minLength>> characters", X = "Maximum length of <<maxLength>> characters exceeded.", q = (e) => {
92
- if (e === void 0) return !0;
93
- try {
94
- return new RegExp(e), !0;
95
- } catch {
96
- return !1;
97
- }
98
- }, g = (e, t) => !(e === void 0 || t === void 0 || e <= t), w = i({
99
- ...m.shape,
100
- type: o(s.TEXT),
101
- value: a(u()),
102
- placeholder: a(u()),
103
- minLength: a(d().min(0)),
104
- maxLength: a(d().min(0)),
105
- pattern: a(u())
106
- }).check((e) => {
107
- q(e.value.pattern) || e.issues.push({
108
- code: "custom",
109
- message: D,
110
- input: e.value,
111
- continue: !0
112
- }), g(e.value.minLength, e.value.maxLength) && e.issues.push({
113
- code: "custom",
114
- path: ["minLength"],
115
- message: F,
116
- input: e.value,
117
- continue: !0
118
- }), g(e.value.minLength, e.value.value?.length) && e.issues.push({
119
- code: "custom",
120
- path: ["minLength"],
121
- message: U.replace(
122
- "<<minLength>>",
123
- e.value.minLength?.toString() || "0"
124
- ),
125
- input: e.value,
126
- continue: !0
127
- }), g(e.value.value?.length, e.value.maxLength) && e.issues.push({
128
- code: "custom",
129
- path: ["value"],
130
- message: X.replace(
131
- "<<maxLength>>",
132
- e.value.maxLength?.toString() || "infinity"
133
- ),
134
- input: e.value,
135
- continue: !0
136
- });
137
- });
138
- class j extends l {
139
- constructor() {
140
- super(
141
- s.BOOLEAN,
142
- T,
143
- () => import("../boolean-field-Cd3uhIPj.js")
144
- );
145
- }
146
- buildControl(t) {
147
- return {
148
- tag: "boolean-field",
149
- props: {
150
- defaultValue: t.value !== void 0 ? String(t.value) : void 0
151
- }
152
- };
153
- }
154
- }
155
- class $ extends l {
156
- constructor() {
157
- super(
158
- s.CATEGORY,
159
- b,
160
- () => import("../category-field-D_Ms1x9u.js")
161
- );
162
- }
163
- buildControl(t) {
164
- return {
165
- tag: "category-field",
166
- props: {
167
- defaultValue: t.value ?? "",
168
- optionList: t.options
169
- }
170
- };
171
- }
172
- }
173
- class z extends A {
174
- constructor() {
175
- super(
176
- p.CLASSIFIER,
177
- y,
178
- () => import("../classifier-prediction-C5QzorTo.js")
179
- );
180
- }
181
- buildControl(t) {
182
- return {
183
- tag: "classifier-prediction",
184
- props: {
185
- title: t.title,
186
- mapping: t.mapping,
187
- probabilities: t.probabilities,
188
- details: t.details.toString()
189
- }
190
- };
191
- }
192
- }
193
- class H extends l {
194
- constructor() {
195
- super(
196
- s.DATE,
197
- I,
198
- () => import("../date-field-Cg_ja679.js")
199
- );
200
- }
201
- buildControl(t) {
202
- return {
203
- tag: "date-field",
204
- props: {
205
- min: t.min ? new Date(t.min).toISOString() : void 0,
206
- max: t.max ? new Date(t.max).toISOString() : void 0,
207
- step: t.step,
208
- defaultValue: t.value ? new Date(t.value).toISOString() : void 0
209
- }
210
- };
211
- }
212
- }
213
- class J extends l {
214
- constructor() {
215
- super(s.NUMBER, V, async () => {
216
- await Promise.resolve(), import("../range-field-Cr7LEtsJ.js"), import("../number-field-CC2DrVEb.js");
217
- });
218
- }
219
- buildControl(t) {
220
- return t.min != null && t.max != null && !t.required && t.value != null ? {
221
- tag: "range-field",
222
- props: {
223
- unit: t.unit,
224
- min: t.min,
225
- max: t.max,
226
- step: t.step,
227
- defaultValue: t.value
228
- },
229
- slot: "inputs"
230
- } : {
231
- tag: "number-field",
232
- props: {
233
- unit: t.unit,
234
- min: t.min,
235
- max: t.max,
236
- step: t.step,
237
- defaultValue: t.value,
238
- placeholder: t.placeholder
239
- }
240
- };
241
- }
242
- }
243
- class K extends A {
244
- constructor() {
245
- super(
246
- p.REGRESSOR,
247
- B,
248
- () => import("../regressor-prediction-C18dHlfK.js")
249
- );
250
- }
251
- buildControl(t) {
252
- return {
253
- tag: "regressor-prediction",
254
- props: {
255
- title: t.title,
256
- values: t.values,
257
- unit: t.unit,
258
- interval: t.interval
259
- }
260
- };
261
- }
262
- }
263
- class Q extends l {
264
- constructor() {
265
- super(
266
- s.TEXT,
267
- w,
268
- () => import("../text-field-DwP-Fa1w.js")
269
- );
270
- }
271
- buildControl(t) {
272
- return {
273
- tag: "text-field",
274
- props: {
275
- minlength: t.minLength,
276
- maxlength: t.maxLength,
277
- placeholder: t.placeholder,
278
- defaultValue: t.value,
279
- pattern: t.pattern
280
- }
281
- };
282
- }
283
- }
284
- export {
285
- j as BooleanStrategy,
286
- $ as CategoryStrategy,
287
- z as ClassifierStrategy,
288
- H as DateStrategy,
289
- J as NumberStrategy,
290
- K as RegressorStrategy,
291
- Q as TextStrategy
292
- };
@@ -1,165 +0,0 @@
1
- import { FieldElement as p } from "./mlform/extensions.mjs";
2
- import { a as m, n as u, x as c } from "./property-jKFNMQpR.js";
3
- import { t as d } from "./custom-element-ttkHUa8w.js";
4
- var h = Object.defineProperty, f = Object.getOwnPropertyDescriptor, b = (r, t, i) => t in r ? h(r, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[t] = i, l = (r, t, i, n) => {
5
- for (var e = n > 1 ? void 0 : n ? f(t, i) : t, s = r.length - 1, o; s >= 0; s--)
6
- (o = r[s]) && (e = (n ? o(t, i, e) : o(e)) || e);
7
- return n && e && h(t, i, e), e;
8
- }, v = (r, t, i) => b(r, t + "", i);
9
- let a = class extends p {
10
- unit = "";
11
- step = "1";
12
- firstUpdated() {
13
- if (this.placeholder || (this.placeholder = this.step), this.defaultValue) {
14
- this.value = Number(this.defaultValue);
15
- const r = new InputEvent("input", {
16
- bubbles: !0,
17
- composed: !0
18
- });
19
- Object.defineProperty(r, "target", {
20
- value: { value: this.defaultValue },
21
- writable: !1
22
- }), this.onInput(r);
23
- } else
24
- this.value = NaN;
25
- }
26
- render() {
27
- return c`
28
- <div class="input-wrapper">
29
- <input
30
- type="text"
31
- inputmode="decimal"
32
- autocomplete="off"
33
- @input=${this.onInput}
34
- .step=${Number(this.step)}
35
- .min=${Number(this.min)}
36
- .max=${Number(this.max)}
37
- .placeholder=${this.placeholder}
38
- .value=${Number.isNaN(this.value) ? "" : this.value}
39
- />
40
- <span class="unit">${this.unit}</span>
41
- </div>
42
- `;
43
- }
44
- onInput(r) {
45
- if (this.value = Number(r.target.value.trim()), !this.value) {
46
- this.dispatchState("empty");
47
- return;
48
- }
49
- if (!/^[0-9.,\s-]+$/.test(this.value.toString())) {
50
- this.dispatchState(
51
- "error",
52
- "Only digits, comma, dot, space, and a leading minus are allowed."
53
- );
54
- return;
55
- }
56
- const i = (this.value.toString().match(/-/g) || []).length;
57
- if (i > 1 || i === 1 && !this.value.toString().startsWith("-")) {
58
- this.dispatchState(
59
- "error",
60
- "Minus sign must appear once and only at the beginning."
61
- );
62
- return;
63
- }
64
- if (!/^-?(?:\d{1,3}(?:([,\s])\d{3}(?:\1\d{3})*)|\d+)(?:[.]\d+)?$/.test(this.value.toString())) {
65
- this.dispatchState(
66
- "error",
67
- "Invalid number format (check grouping or decimal separator)."
68
- );
69
- return;
70
- }
71
- const e = this.parseLocaleNumber(this.value.toString());
72
- if (this.min && this.max && (e < parseFloat(this.min) || e > parseFloat(this.max))) {
73
- this.dispatchState(
74
- "error",
75
- `Number must be between
76
- ${this.min} ${this.unit} and
77
- ${this.max ?? ""} ${this.unit}`
78
- );
79
- return;
80
- }
81
- if (this.min && e < parseFloat(this.min)) {
82
- this.dispatchState(
83
- "error",
84
- `Number must be greater than or equal to ${this.min} ${this.unit}`
85
- );
86
- return;
87
- }
88
- if (this.max && e > parseFloat(this.max)) {
89
- this.dispatchState(
90
- "error",
91
- `Number must be less than or equal to ${this.max} ${this.unit}`
92
- );
93
- return;
94
- }
95
- this.dispatchState(
96
- "success",
97
- `Valid Number: ${e.toLocaleString("en-US", {})} ${this.unit}`
98
- );
99
- }
100
- parseLocaleNumber(r) {
101
- let t = r.replace(/\s+/g, ""), i = "";
102
- t.startsWith("-") && (i = "-", t = t.slice(1));
103
- const n = t.lastIndexOf("."), e = Math.max(n);
104
- let s, o = "";
105
- return e !== -1 ? (s = t.slice(0, e), o = t.slice(e + 1)) : s = t, s = s.replace(/[.,]/g, ""), parseFloat(i + (o ? `${s}.${o}` : s));
106
- }
107
- };
108
- v(a, "styles", [
109
- p.baseStyles,
110
- m`
111
- .input-wrapper {
112
- position: relative;
113
- }
114
- input[type="text"] {
115
- width: 100%;
116
- padding: 0.75rem calc(var(--unit-w) + 2rem) 0.75rem 1rem;
117
- font-size: 1rem;
118
- border: 1px solid var(--ml-color-border);
119
- border-radius: var(--radius);
120
- outline: none;
121
- transition: border-color 0.2s ease;
122
- white-space: nowrap;
123
- overflow-x: auto;
124
- overflow-y: hidden;
125
- -webkit-overflow-scrolling: touch;
126
- }
127
- input[type="text"]:focus {
128
- border-color: var(--ml-color-accent);
129
- }
130
- .unit {
131
- position: absolute;
132
- right: 1rem;
133
- top: 50%;
134
- min-width: var(--unit-w);
135
- transform: translateY(-50%);
136
- font-size: 0.9rem;
137
- color: var(--ml-color-secondary);
138
- pointer-events: none;
139
- }
140
- `
141
- ]);
142
- l([
143
- u({ type: String })
144
- ], a.prototype, "unit", 2);
145
- l([
146
- u({ type: String })
147
- ], a.prototype, "step", 2);
148
- l([
149
- u({ type: String })
150
- ], a.prototype, "min", 2);
151
- l([
152
- u({ type: String })
153
- ], a.prototype, "max", 2);
154
- l([
155
- u({ type: String })
156
- ], a.prototype, "defaultValue", 2);
157
- l([
158
- u({ type: String })
159
- ], a.prototype, "placeholder", 2);
160
- a = l([
161
- d("number-field")
162
- ], a);
163
- export {
164
- a as NumberField
165
- };