@formspec/core 0.1.0-alpha.2 → 0.1.0-alpha.23

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 (58) hide show
  1. package/README.md +85 -0
  2. package/dist/__tests__/constraint-definitions.test.d.ts +2 -0
  3. package/dist/__tests__/constraint-definitions.test.d.ts.map +1 -0
  4. package/dist/__tests__/guards.test.d.ts +2 -0
  5. package/dist/__tests__/guards.test.d.ts.map +1 -0
  6. package/dist/core-alpha.d.ts +1441 -0
  7. package/dist/core-beta.d.ts +1441 -0
  8. package/dist/core-internal.d.ts +1441 -0
  9. package/dist/core.d.ts +917 -0
  10. package/dist/extensions/index.d.ts +283 -0
  11. package/dist/extensions/index.d.ts.map +1 -0
  12. package/dist/guards.d.ts +73 -0
  13. package/dist/guards.d.ts.map +1 -0
  14. package/dist/index.cjs +130 -0
  15. package/dist/index.cjs.map +1 -0
  16. package/dist/index.d.ts +6 -2
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +85 -12
  19. package/dist/index.js.map +1 -1
  20. package/dist/internals.cjs +165 -0
  21. package/dist/internals.cjs.map +1 -0
  22. package/dist/internals.d.ts +13 -0
  23. package/dist/internals.d.ts.map +1 -0
  24. package/dist/internals.js +115 -0
  25. package/dist/internals.js.map +1 -0
  26. package/dist/types/constraint-definitions.d.ts +64 -0
  27. package/dist/types/constraint-definitions.d.ts.map +1 -0
  28. package/dist/types/data-source.d.ts +8 -0
  29. package/dist/types/data-source.d.ts.map +1 -1
  30. package/dist/types/elements.d.ts +40 -0
  31. package/dist/types/elements.d.ts.map +1 -1
  32. package/dist/types/field-state.d.ts +4 -0
  33. package/dist/types/field-state.d.ts.map +1 -1
  34. package/dist/types/form-state.d.ts +2 -0
  35. package/dist/types/form-state.d.ts.map +1 -1
  36. package/dist/types/index.d.ts +4 -0
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/ir.d.ts +578 -0
  39. package/dist/types/ir.d.ts.map +1 -0
  40. package/dist/types/predicate.d.ts +4 -0
  41. package/dist/types/predicate.d.ts.map +1 -1
  42. package/dist/types/validity.d.ts +2 -0
  43. package/dist/types/validity.d.ts.map +1 -1
  44. package/package.json +25 -8
  45. package/dist/types/data-source.js +0 -2
  46. package/dist/types/data-source.js.map +0 -1
  47. package/dist/types/elements.js +0 -8
  48. package/dist/types/elements.js.map +0 -1
  49. package/dist/types/field-state.js +0 -17
  50. package/dist/types/field-state.js.map +0 -1
  51. package/dist/types/form-state.js +0 -2
  52. package/dist/types/form-state.js.map +0 -1
  53. package/dist/types/index.js +0 -3
  54. package/dist/types/index.js.map +0 -1
  55. package/dist/types/predicate.js +0 -7
  56. package/dist/types/predicate.js.map +0 -1
  57. package/dist/types/validity.js +0 -2
  58. package/dist/types/validity.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # @formspec/core
2
+
3
+ Shared types, canonical IR nodes, and extension registration APIs for FormSpec.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @formspec/core
9
+ ```
10
+
11
+ Most app code should prefer `formspec` unless you are building tooling, extensions, or lower-level integrations.
12
+
13
+ ## Main Responsibilities
14
+
15
+ - Form element and state types
16
+ - Canonical IR types used by the build pipeline
17
+ - Constraint-definition metadata
18
+ - Extension registration helpers for custom types, constraints, and annotations
19
+ - Shared type guards
20
+
21
+ ## Example
22
+
23
+ ```ts
24
+ import type { FormElement, FormIR } from "@formspec/core";
25
+ import { defineConstraint, defineCustomType, defineExtension } from "@formspec/core";
26
+
27
+ function isFieldElement(element: FormElement): boolean {
28
+ return element._type === "field";
29
+ }
30
+
31
+ const decimalType = defineCustomType({
32
+ typeName: "Decimal",
33
+ tsTypeNames: ["Decimal"],
34
+ toJsonSchema: (_payload, vendorPrefix) => ({
35
+ type: "string",
36
+ [`${vendorPrefix}-decimal`]: true,
37
+ }),
38
+ });
39
+
40
+ const extension = defineExtension({
41
+ extensionId: "x-example/decimal",
42
+ types: [decimalType],
43
+ constraints: [],
44
+ annotations: [],
45
+ });
46
+ ```
47
+
48
+ ## Key Exports
49
+
50
+ ### Form Types
51
+
52
+ - `FormSpec`
53
+ - `FormElement`
54
+ - `AnyField`
55
+ - `Group`
56
+ - `Conditional`
57
+ - `FieldState`
58
+ - `FormState`
59
+
60
+ ### IR Types
61
+
62
+ - `FormIR`
63
+ - `FieldNode`
64
+ - `LayoutNode`
65
+ - `TypeNode`
66
+ - `ConstraintNode`
67
+ - `AnnotationNode`
68
+ - `Provenance`
69
+
70
+ ### Extension API
71
+
72
+ - `defineExtension`
73
+ - `defineConstraint`
74
+ - `defineConstraintTag`
75
+ - `defineAnnotation`
76
+ - `defineCustomType`
77
+
78
+ ### Utilities
79
+
80
+ - `normalizeConstraintTagName`
81
+ - field and layout type guards
82
+
83
+ ## License
84
+
85
+ UNLICENSED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=constraint-definitions.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constraint-definitions.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/constraint-definitions.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=guards.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/guards.test.ts"],"names":[],"mappings":""}