rafters 0.0.82 → 0.0.84

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.
@@ -55,6 +55,92 @@ declare const RegistryItemIntelligenceSchema: z.ZodObject<{
55
55
  }, z.core.$strip>>;
56
56
  }, z.core.$strip>;
57
57
  type RegistryItemIntelligence = z.infer<typeof RegistryItemIntelligenceSchema>;
58
+ /**
59
+ * The framework targets a component can be built for. One target == one source
60
+ * extension (`.tsx` -> react, `.astro` -> astro, `.vue` -> vue, `.svelte` ->
61
+ * svelte, `.element.ts` -> wc). See COMPONENT_EXTENSIONS in the registry
62
+ * generator (apps/registry/src/lib/registry/componentService.ts).
63
+ */
64
+ declare const ComponentTargetSchema: z.ZodEnum<{
65
+ react: "react";
66
+ astro: "astro";
67
+ vue: "vue";
68
+ svelte: "svelte";
69
+ wc: "wc";
70
+ }>;
71
+ type ComponentTarget = z.infer<typeof ComponentTargetSchema>;
72
+ /**
73
+ * One prop's machine-actionable shape. Kept byte-compatible with #2072's
74
+ * `PropNode` (packages/cli/src/mcp/graph.ts) so `describe(<id>.props.<name>)`
75
+ * resolves generator output directly.
76
+ *
77
+ * NOTE: the enum arm's `values` is intentionally NOT `.min(1)`. A verbatim
78
+ * literal union always yields >=1 member, but a REQUIRED structural prop with
79
+ * no literal domain (e.g. astro's `id: string`) is emitted as an empty-values
80
+ * enum carrying only `required: true` -- honest ("no known value domain"),
81
+ * never a fabricated `['string']`. This is the one deliberate divergence from
82
+ * the issue's literal `.min(1)` schema; graph.ts's PropNode has no min either,
83
+ * so byte-compatibility holds.
84
+ */
85
+ declare const PropFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
86
+ type: z.ZodLiteral<"enum">;
87
+ values: z.ZodArray<z.ZodString>;
88
+ default: z.ZodOptional<z.ZodString>;
89
+ required: z.ZodOptional<z.ZodBoolean>;
90
+ constraint: z.ZodOptional<z.ZodObject<{
91
+ when: z.ZodObject<{
92
+ prop: z.ZodString;
93
+ matches: z.ZodString;
94
+ }, z.core.$strip>;
95
+ requires: z.ZodObject<{
96
+ prop: z.ZodString;
97
+ }, z.core.$strip>;
98
+ }, z.core.$strip>>;
99
+ }, z.core.$strip>, z.ZodObject<{
100
+ type: z.ZodLiteral<"grammar">;
101
+ grammar: z.ZodArray<z.ZodString>;
102
+ vocab: z.ZodString;
103
+ onInvalid: z.ZodLiteral<"silent-noop">;
104
+ default: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ type: z.ZodLiteral<"deprecated">;
107
+ deprecatedFor: z.ZodString;
108
+ }, z.core.$strip>], "type">;
109
+ type PropField = z.infer<typeof PropFieldSchema>;
110
+ /**
111
+ * One target's extracted prop surface: verbatim literal-union props, the
112
+ * slots/events it exposes, and a target-correct usage snippet.
113
+ */
114
+ declare const FacetSchema: z.ZodObject<{
115
+ props: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
116
+ type: z.ZodLiteral<"enum">;
117
+ values: z.ZodArray<z.ZodString>;
118
+ default: z.ZodOptional<z.ZodString>;
119
+ required: z.ZodOptional<z.ZodBoolean>;
120
+ constraint: z.ZodOptional<z.ZodObject<{
121
+ when: z.ZodObject<{
122
+ prop: z.ZodString;
123
+ matches: z.ZodString;
124
+ }, z.core.$strip>;
125
+ requires: z.ZodObject<{
126
+ prop: z.ZodString;
127
+ }, z.core.$strip>;
128
+ }, z.core.$strip>>;
129
+ }, z.core.$strip>, z.ZodObject<{
130
+ type: z.ZodLiteral<"grammar">;
131
+ grammar: z.ZodArray<z.ZodString>;
132
+ vocab: z.ZodString;
133
+ onInvalid: z.ZodLiteral<"silent-noop">;
134
+ default: z.ZodOptional<z.ZodString>;
135
+ }, z.core.$strip>, z.ZodObject<{
136
+ type: z.ZodLiteral<"deprecated">;
137
+ deprecatedFor: z.ZodString;
138
+ }, z.core.$strip>], "type">>;
139
+ slots: z.ZodOptional<z.ZodArray<z.ZodString>>;
140
+ events: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
+ snippet: z.ZodString;
142
+ }, z.core.$strip>;
143
+ type Facet = z.infer<typeof FacetSchema>;
58
144
  /**
59
145
  * A component or primitive in the registry
60
146
  */
@@ -88,6 +174,42 @@ declare const RegistryItemSchema: z.ZodObject<{
88
174
  nevers: z.ZodDefault<z.ZodArray<z.ZodString>>;
89
175
  }, z.core.$strip>>;
90
176
  }, z.core.$strip>>;
177
+ facets: z.ZodDefault<z.ZodRecord<z.ZodEnum<{
178
+ react: "react";
179
+ astro: "astro";
180
+ vue: "vue";
181
+ svelte: "svelte";
182
+ wc: "wc";
183
+ }> & z.core.$partial, z.ZodObject<{
184
+ props: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
185
+ type: z.ZodLiteral<"enum">;
186
+ values: z.ZodArray<z.ZodString>;
187
+ default: z.ZodOptional<z.ZodString>;
188
+ required: z.ZodOptional<z.ZodBoolean>;
189
+ constraint: z.ZodOptional<z.ZodObject<{
190
+ when: z.ZodObject<{
191
+ prop: z.ZodString;
192
+ matches: z.ZodString;
193
+ }, z.core.$strip>;
194
+ requires: z.ZodObject<{
195
+ prop: z.ZodString;
196
+ }, z.core.$strip>;
197
+ }, z.core.$strip>>;
198
+ }, z.core.$strip>, z.ZodObject<{
199
+ type: z.ZodLiteral<"grammar">;
200
+ grammar: z.ZodArray<z.ZodString>;
201
+ vocab: z.ZodString;
202
+ onInvalid: z.ZodLiteral<"silent-noop">;
203
+ default: z.ZodOptional<z.ZodString>;
204
+ }, z.core.$strip>, z.ZodObject<{
205
+ type: z.ZodLiteral<"deprecated">;
206
+ deprecatedFor: z.ZodString;
207
+ }, z.core.$strip>], "type">>;
208
+ slots: z.ZodOptional<z.ZodArray<z.ZodString>>;
209
+ events: z.ZodOptional<z.ZodArray<z.ZodString>>;
210
+ snippet: z.ZodString;
211
+ }, z.core.$strip>>>;
212
+ parent: z.ZodOptional<z.ZodString>;
91
213
  }, z.core.$strip>;
92
214
  type RegistryItem = z.infer<typeof RegistryItemSchema>;
93
215
  /**
@@ -104,4 +226,4 @@ declare const RegistryIndexSchema: z.ZodObject<{
104
226
  }, z.core.$strip>;
105
227
  type RegistryIndex = z.infer<typeof RegistryIndexSchema>;
106
228
 
107
- export { type RegistryFile, RegistryFileSchema, type RegistryIndex, RegistryIndexSchema, type RegistryItem, type RegistryItemIntelligence, RegistryItemIntelligenceSchema, RegistryItemSchema, type RegistryItemType, RegistryItemTypeSchema };
229
+ export { type ComponentTarget, ComponentTargetSchema, type Facet, FacetSchema, type PropField, PropFieldSchema, type RegistryFile, RegistryFileSchema, type RegistryIndex, RegistryIndexSchema, type RegistryItem, type RegistryItemIntelligence, RegistryItemIntelligenceSchema, RegistryItemSchema, type RegistryItemType, RegistryItemTypeSchema };
@@ -20,6 +20,41 @@ var RegistryItemIntelligenceSchema = z.object({
20
20
  nevers: z.array(z.string()).default([])
21
21
  }).optional()
22
22
  });
23
+ var ComponentTargetSchema = z.enum(["react", "astro", "vue", "svelte", "wc"]);
24
+ var PropFieldSchema = z.discriminatedUnion("type", [
25
+ z.object({
26
+ type: z.literal("enum"),
27
+ values: z.array(z.string()),
28
+ // verbatim literal union members -- never "string"
29
+ default: z.string().optional(),
30
+ required: z.boolean().optional(),
31
+ constraint: z.object({
32
+ when: z.object({ prop: z.string(), matches: z.string() }),
33
+ requires: z.object({ prop: z.string() })
34
+ }).optional()
35
+ }),
36
+ z.object({
37
+ // Matches #2072's PropNode 'grammar' arm exactly, so graph.ts's
38
+ // describe(<id>.props.<name>.vocab) drill has real shape data.
39
+ type: z.literal("grammar"),
40
+ grammar: z.array(z.string()).min(1),
41
+ // grammar shape tokens, e.g. ['word', 'word/alpha']
42
+ vocab: z.string(),
43
+ // drillable addr, e.g. 'container.props.fill.vocab' -- never inlined
44
+ onInvalid: z.literal("silent-noop"),
45
+ default: z.string().optional()
46
+ }),
47
+ z.object({
48
+ type: z.literal("deprecated"),
49
+ deprecatedFor: z.string()
50
+ })
51
+ ]);
52
+ var FacetSchema = z.object({
53
+ props: z.record(z.string(), PropFieldSchema),
54
+ slots: z.array(z.string()).optional(),
55
+ events: z.array(z.string()).optional(),
56
+ snippet: z.string()
57
+ });
23
58
  var RegistryItemSchema = z.object({
24
59
  name: z.string(),
25
60
  type: RegistryItemTypeSchema,
@@ -28,7 +63,12 @@ var RegistryItemSchema = z.object({
28
63
  files: z.array(RegistryFileSchema),
29
64
  rules: z.array(z.string()).default([]),
30
65
  composites: z.array(z.string()).default([]),
31
- intelligence: RegistryItemIntelligenceSchema.optional()
66
+ intelligence: RegistryItemIntelligenceSchema.optional(),
67
+ // Per-target facets. zod v4's `z.record(enum, ...)` demands EVERY enum key be
68
+ // present; a component built for only some targets must parse, so this is a
69
+ // partial record (only the built targets appear).
70
+ facets: z.partialRecord(ComponentTargetSchema, FacetSchema).default({}),
71
+ parent: z.string().optional()
32
72
  });
33
73
  var RegistryIndexSchema = z.object({
34
74
  name: z.string(),
@@ -40,6 +80,9 @@ var RegistryIndexSchema = z.object({
40
80
  substrate: z.array(z.string()).default([])
41
81
  });
42
82
  export {
83
+ ComponentTargetSchema,
84
+ FacetSchema,
85
+ PropFieldSchema,
43
86
  RegistryFileSchema,
44
87
  RegistryIndexSchema,
45
88
  RegistryItemIntelligenceSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rafters",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
4
4
  "description": "Design Intelligence CLI. Scaffold tokens, import existing shadcn/Tailwind v4 sources, add components, and serve an MCP server so AI agents read decisions instead of guessing.",
5
5
  "homepage": "https://rafters.studio",
6
6
  "license": "MIT",