@ggui-ai/ui-gen 0.17.0 → 0.18.0
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/adapters/generation-dispatch.js +252 -108
- package/dist/adapters/generation-dispatch.js.map +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/advanced/index.js +261 -113
- package/dist/advanced/index.js.map +1 -1
- package/dist/boilerplate.js +27 -3
- package/dist/boilerplate.js.map +1 -1
- package/dist/check/index.js +70 -0
- package/dist/check/index.js.map +1 -1
- package/dist/evaluation/axis-checks/index.js +50 -0
- package/dist/evaluation/axis-checks/index.js.map +1 -1
- package/dist/evaluation/axis-checks/registry.js +50 -0
- package/dist/evaluation/axis-checks/registry.js.map +1 -1
- package/dist/evaluation/index.js +50 -0
- package/dist/evaluation/index.js.map +1 -1
- package/dist/harness/index.js +27 -3
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/prompts.js +4 -0
- package/dist/harness/prompts.js.map +1 -1
- package/dist/harness/runtime.js +27 -3
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness/types-public.js +27 -3
- package/dist/harness/types-public.js.map +1 -1
- package/dist/index.js +261 -113
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/boilerplate/free-design-prompt.ts +2 -0
- package/src/boilerplate/generate.ts +8 -1
- package/src/boilerplate/hard-sections.ts +31 -2
- package/src/boilerplate/system-prompt.ts +2 -0
- package/src/boilerplate/templates/layouts/fullscreen-desktop.tsx.tmpl +5 -3
- package/src/boilerplate/templates/layouts/fullscreen-mobile.tsx.tmpl +3 -3
- package/src/boilerplate/templates/layouts/fullscreen-universal.tsx.tmpl +5 -3
- package/src/check/run-tier0.ts +152 -0
- package/src/contract-context.ts +13 -0
- package/src/evaluation/axis-checks/checks/universal.ts +64 -0
|
@@ -1312,7 +1312,8 @@ type ${typeName} = ${tsType};`
|
|
|
1312
1312
|
);
|
|
1313
1313
|
const callSig = tsType === "void" ? "() => void \u2014 fire and forget" : `(data: ${tsType}) => void`;
|
|
1314
1314
|
const toolHint = tool ? ` \u2192 nextStep: ${tool}` : "";
|
|
1315
|
-
|
|
1315
|
+
const onceHint = " \u2014 if this is meant ONCE, disable its control after it fires";
|
|
1316
|
+
actionHookCalls.push(` const ${key} = useAction<${typeName}>('${key}'); // ${callSig}${toolHint}${onceHint}`);
|
|
1316
1317
|
}
|
|
1317
1318
|
const streamChannels = contract?.streamSpec ?? {};
|
|
1318
1319
|
const streamChannelEntries = Object.entries(streamChannels);
|
|
@@ -1647,12 +1648,33 @@ Rules:
|
|
|
1647
1648
|
3. Default values come from the current request \u2014 so the component renders correctly standalone.
|
|
1648
1649
|
4. Copy comes from the props. NEVER invent display text the contract does not carry \u2014 no eyebrow / kicker / overline (a \`<Text caps>\` label), no helper line, no status text, no tagline. A caps label exists only when a prop supplies its text (\`<Text caps>{props.section}</Text>\`); a heading's fallback is the request's own words, never a slogan of your own. Text the agent cannot change is chatter on every render.
|
|
1649
1650
|
5. Props interface must be typed and exported.`;
|
|
1650
|
-
var
|
|
1651
|
+
var TERMINAL_ACTIONS = `## Actions the user means once
|
|
1652
|
+
|
|
1653
|
+
A second press is a mistake only when it would make a SECOND THING HAPPEN IN THE WORLD \u2014 a second booking, a second charge, a second order, a second application sent. If pressing again would only write the SAME STATE AGAIN \u2014 saving, updating, renaming, setting a preference, toggling \u2014 nothing is duplicated and the control stays armed.
|
|
1654
|
+
|
|
1655
|
+
Guard a control only where you have evidence, not a feeling about the verb: the request itself names a one-time commitment \u2014 "submit the application", "place the order", "confirm the booking".
|
|
1656
|
+
|
|
1657
|
+
**When in doubt, leave it armed.** A control the user cannot press a second time has lost them something that worked \u2014 save, edit, save again is ordinary. A control left armed is only what every interface does by default.
|
|
1658
|
+
|
|
1659
|
+
When you do guard one:
|
|
1660
|
+
- Hold a small piece of state for it and set it in the handler: \`const [submitted, setSubmitted] = useState(false)\`.
|
|
1661
|
+
- \`disabled={submitted}\` on the control that fires it, and say so in the label or beside it ("Submitted", "Request sent") \u2014 a control that is disabled without explanation reads as broken.
|
|
1662
|
+
- A card re-rendered with new props starts fresh; the state above lives with the component, not with the request.
|
|
1663
|
+
|
|
1664
|
+
Nothing in the wire DECLARES one-shot-ness yet, which is why the test is what a second press would DO \u2014 not how final the word sounds.`;
|
|
1665
|
+
var FRAME_SIZING = `## Sizing \u2014 the frame owns the height and the width
|
|
1651
1666
|
|
|
1652
1667
|
The host sizes the iframe; the component never sizes itself to the viewport. NEVER write \`100vh\` / \`100dvh\` / \`100svh\` (or an \`h-screen\` / \`min-h-screen\` class) as a height on any element:
|
|
1653
1668
|
- An inline card takes its natural height. A content-sized frame is measured FROM the content, so a \`100vh\` root can never shrink and grows the frame on every re-measure.
|
|
1654
1669
|
- Under fullscreen the frame already stretches your root to its full height. Centre inside it with flex (\`display: flex; flex-direction: column; justify-content: center\`), never with a viewport height.
|
|
1655
|
-
- To fill a parent that has a height use \`height: 100%\` or \`flex: 1\`; a viewport unit is only ever a \`max-height\` cap on a scroll region
|
|
1670
|
+
- To fill a parent that has a height use \`height: 100%\` or \`flex: 1\`; a viewport unit is only ever a \`max-height\` cap on a scroll region.
|
|
1671
|
+
|
|
1672
|
+
The width works the same way, and the mistake is the mirror image: **your outermost element FILLS the frame; a width cap belongs INSIDE it, on the column that holds text.**
|
|
1673
|
+
|
|
1674
|
+
- Never put \`maxWidth\` (or a \`max-w-*\` class) on the element you return at the top. On a wide canvas that turns your card into a narrow strip with the frame's ground on either side of it, and on a narrow one it does nothing \u2014 the same composition reading differently at two sizes.
|
|
1675
|
+
- DO cap the reading measure inside: a column of prose is easiest to read at 60\u201370 characters, so wrap the TEXT in a \`<Container maxWidth="sm">\` (or your own \`max-width\`) and leave the root filling. A hero band, a toolbar, a table or an image then still uses the whole width, which is what makes a wide card look composed rather than padded.
|
|
1676
|
+
- Centre that inner column with the container's own centring, not by shrinking the root.
|
|
1677
|
+
- **They are two different elements.** Even when the whole card is one column of text, the root still fills and the column sits INSIDE it \u2014 \`<Box padding="lg"><Container maxWidth="sm">\u2026</Container></Box>\`, never a root that is itself the container. A centred card is centring inside a filled frame, not a shrunken frame.`;
|
|
1656
1678
|
var COMPONENT_STRUCTURE = `## Component Structure
|
|
1657
1679
|
|
|
1658
1680
|
Keep JSX nesting depth to 3\u20135 levels. When deeper, extract repeated/complex sections into helper components \u2014 named functions defined above the main Component in the same file. Helpers take data + callbacks via props; they don't own state.
|
|
@@ -1864,6 +1886,7 @@ ${axisSection}
|
|
|
1864
1886
|
CONTRACT_SURFACE,
|
|
1865
1887
|
DEFENSIVE_CODING,
|
|
1866
1888
|
GESTURE_ROUTING,
|
|
1889
|
+
TERMINAL_ACTIONS,
|
|
1867
1890
|
FREE_GESTURE_SURFACE,
|
|
1868
1891
|
ANTI_PATTERNS,
|
|
1869
1892
|
CROSS_REFERENCE_RULES,
|
|
@@ -2262,6 +2285,7 @@ ${axisSection}
|
|
|
2262
2285
|
CONTRACT_SURFACE,
|
|
2263
2286
|
DEFENSIVE_CODING,
|
|
2264
2287
|
GESTURE_ROUTING,
|
|
2288
|
+
TERMINAL_ACTIONS,
|
|
2265
2289
|
INTERACTIVE_TRAITS,
|
|
2266
2290
|
ANTI_PATTERNS,
|
|
2267
2291
|
CROSS_REFERENCE_RULES,
|