@keemakr/ui-sdk 1.1.0-dev-20260819052449 → 1.1.0-dev-20260819114857
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.
- package/dist/schema.d.ts +36 -0
- package/dist/schema.js +56 -14
- package/package.json +1 -1
package/dist/schema.d.ts
CHANGED
|
@@ -148,6 +148,42 @@ declare const leafNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
148
148
|
screen: z.ZodString;
|
|
149
149
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
150
150
|
}, z.core.$strip>], "kind">>;
|
|
151
|
+
expand: z.ZodOptional<z.ZodObject<{
|
|
152
|
+
children: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
153
|
+
type: z.ZodLiteral<"heading">;
|
|
154
|
+
text: z.ZodString;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"text">;
|
|
157
|
+
value: z.ZodString;
|
|
158
|
+
muted: z.ZodDefault<z.ZodBoolean>;
|
|
159
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
160
|
+
type: z.ZodLiteral<"markdown">;
|
|
161
|
+
value: z.ZodString;
|
|
162
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"stat">;
|
|
164
|
+
label: z.ZodString;
|
|
165
|
+
value: z.ZodString;
|
|
166
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
168
|
+
type: z.ZodLiteral<"button">;
|
|
169
|
+
label: z.ZodString;
|
|
170
|
+
onPress: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
171
|
+
kind: z.ZodLiteral<"action">;
|
|
172
|
+
action: z.ZodString;
|
|
173
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
174
|
+
confirm: z.ZodOptional<z.ZodString>;
|
|
175
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
176
|
+
kind: z.ZodLiteral<"navigate">;
|
|
177
|
+
screen: z.ZodString;
|
|
178
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
179
|
+
}, z.core.$strip>], "kind">;
|
|
180
|
+
variant: z.ZodDefault<z.ZodEnum<{
|
|
181
|
+
destructive: "destructive";
|
|
182
|
+
primary: "primary";
|
|
183
|
+
secondary: "secondary";
|
|
184
|
+
}>>;
|
|
185
|
+
}, z.core.$strip>], "type">>;
|
|
186
|
+
}, z.core.$strip>>;
|
|
151
187
|
}, z.core.$strip>>;
|
|
152
188
|
empty: z.ZodString;
|
|
153
189
|
}, z.core.$strip>, z.ZodObject<{
|
package/dist/schema.js
CHANGED
|
@@ -97,21 +97,44 @@ const chartSchema = z
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
|
+
const headingSchema = z.object({ type: z.literal('heading'), text: z.string().max(120) });
|
|
101
|
+
const textSchema = z.object({
|
|
102
|
+
type: z.literal('text'),
|
|
103
|
+
value: z.string().max(5000),
|
|
104
|
+
muted: z.boolean().default(false),
|
|
105
|
+
});
|
|
106
|
+
/** Rendered by core's sanitizing markdown renderer — never raw HTML. */
|
|
107
|
+
const markdownSchema = z.object({ type: z.literal('markdown'), value: z.string().max(20000) });
|
|
108
|
+
const statSchema = z.object({
|
|
109
|
+
type: z.literal('stat'),
|
|
110
|
+
label: z.string().max(80),
|
|
111
|
+
value: z.string().max(40),
|
|
112
|
+
hint: z.string().max(120).optional(),
|
|
113
|
+
});
|
|
114
|
+
/**
|
|
115
|
+
* What a table row may reveal in place. Deliberately NOT the leaf union and NOT
|
|
116
|
+
* `nodeSchema`: `table` is itself a leaf, so either reference re-opens the
|
|
117
|
+
* recursion — both were measured accepting a 200-level `table -> expand -> table`
|
|
118
|
+
* chain, escaping MAX_SECTION_DEPTH entirely, and both collapsed type inference
|
|
119
|
+
* (TS7022 on the leaf union, TS7024 on the lazy callback). Naming the five
|
|
120
|
+
* content branches explicitly keeps this non-recursive by construction, which is
|
|
121
|
+
* why the depth test asserts REJECTION rather than slowness: the validator
|
|
122
|
+
* handles 200 levels in tens of milliseconds, so nothing upstream would catch it.
|
|
123
|
+
*
|
|
124
|
+
* The general rule: any leaf that references the leaf union re-opens the recursion.
|
|
125
|
+
*/
|
|
126
|
+
const expandContentSchema = z.discriminatedUnion('type', [
|
|
127
|
+
headingSchema,
|
|
128
|
+
textSchema,
|
|
129
|
+
markdownSchema,
|
|
130
|
+
statSchema,
|
|
131
|
+
buttonSchema,
|
|
132
|
+
]);
|
|
100
133
|
const leafNodeSchema = z.discriminatedUnion('type', [
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
muted: z.boolean().default(false),
|
|
106
|
-
}),
|
|
107
|
-
/** Rendered by core's sanitizing markdown renderer — never raw HTML. */
|
|
108
|
-
z.object({ type: z.literal('markdown'), value: z.string().max(20000) }),
|
|
109
|
-
z.object({
|
|
110
|
-
type: z.literal('stat'),
|
|
111
|
-
label: z.string().max(80),
|
|
112
|
-
value: z.string().max(40),
|
|
113
|
-
hint: z.string().max(120).optional(),
|
|
114
|
-
}),
|
|
134
|
+
headingSchema,
|
|
135
|
+
textSchema,
|
|
136
|
+
markdownSchema,
|
|
137
|
+
statSchema,
|
|
115
138
|
buttonSchema,
|
|
116
139
|
z.object({
|
|
117
140
|
type: z.literal('form'),
|
|
@@ -137,6 +160,25 @@ const leafNodeSchema = z.discriminatedUnion('type', [
|
|
|
137
160
|
key: z.string().max(128),
|
|
138
161
|
cells: z.record(slug, cellSchema),
|
|
139
162
|
onPress: pressSchema.optional(),
|
|
163
|
+
/**
|
|
164
|
+
* Content the row reveals in place, no navigation hop. Content nodes
|
|
165
|
+
* only — no nested `table`, no `section`.
|
|
166
|
+
*
|
|
167
|
+
* A row declaring `expand` WITH CONTENT toggles disclosure when
|
|
168
|
+
* activated, and its `onPress` is IGNORED. The renderer already gives a
|
|
169
|
+
* pressable row `role="button"` with an Enter/Space handler, so a second
|
|
170
|
+
* focusable control inside it would be invalid ARIA with two handlers on
|
|
171
|
+
* one key. Expansion is local view state; a press means "call my
|
|
172
|
+
* runtime". They stay apart deliberately.
|
|
173
|
+
*
|
|
174
|
+
* Zero children is allowed and means NO disclosure — the row behaves
|
|
175
|
+
* exactly as if `expand` were absent, `onPress` included. A body built
|
|
176
|
+
* from data legitimately drops to nothing, and rejecting that would fail
|
|
177
|
+
* the whole screen load rather than degrade one row (the same cliff the
|
|
178
|
+
* tab strip's minimum had). The maximum stays: an oversize body has no
|
|
179
|
+
* safe degradation — truncating it would be silent data loss.
|
|
180
|
+
*/
|
|
181
|
+
expand: z.object({ children: z.array(expandContentSchema).max(20) }).optional(),
|
|
140
182
|
}))
|
|
141
183
|
.max(500),
|
|
142
184
|
/** Shown when `rows` is empty — every data-bound surface needs an empty state. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keemakr/ui-sdk",
|
|
3
|
-
"version": "1.1.0-dev-
|
|
3
|
+
"version": "1.1.0-dev-20260819114857",
|
|
4
4
|
"description": "Product screens for keemakr marketplace modules: a versioned, server-driven UI tree schema plus defineScreen() handlers. Module code never ships to the browser — keemakr-core validates the tree and renders it with platform components.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|