@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
package/dist/harness/runtime.js
CHANGED
|
@@ -759,7 +759,8 @@ type ${typeName} = ${tsType};`
|
|
|
759
759
|
);
|
|
760
760
|
const callSig = tsType === "void" ? "() => void \u2014 fire and forget" : `(data: ${tsType}) => void`;
|
|
761
761
|
const toolHint = tool ? ` \u2192 nextStep: ${tool}` : "";
|
|
762
|
-
|
|
762
|
+
const onceHint = " \u2014 if this is meant ONCE, disable its control after it fires";
|
|
763
|
+
actionHookCalls.push(` const ${key} = useAction<${typeName}>('${key}'); // ${callSig}${toolHint}${onceHint}`);
|
|
763
764
|
}
|
|
764
765
|
const streamChannels = contract?.streamSpec ?? {};
|
|
765
766
|
const streamChannelEntries = Object.entries(streamChannels);
|
|
@@ -1387,12 +1388,33 @@ Rules:
|
|
|
1387
1388
|
3. Default values come from the current request \u2014 so the component renders correctly standalone.
|
|
1388
1389
|
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.
|
|
1389
1390
|
5. Props interface must be typed and exported.`;
|
|
1390
|
-
var
|
|
1391
|
+
var TERMINAL_ACTIONS = `## Actions the user means once
|
|
1392
|
+
|
|
1393
|
+
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.
|
|
1394
|
+
|
|
1395
|
+
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".
|
|
1396
|
+
|
|
1397
|
+
**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.
|
|
1398
|
+
|
|
1399
|
+
When you do guard one:
|
|
1400
|
+
- Hold a small piece of state for it and set it in the handler: \`const [submitted, setSubmitted] = useState(false)\`.
|
|
1401
|
+
- \`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.
|
|
1402
|
+
- A card re-rendered with new props starts fresh; the state above lives with the component, not with the request.
|
|
1403
|
+
|
|
1404
|
+
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.`;
|
|
1405
|
+
var FRAME_SIZING = `## Sizing \u2014 the frame owns the height and the width
|
|
1391
1406
|
|
|
1392
1407
|
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:
|
|
1393
1408
|
- 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.
|
|
1394
1409
|
- 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.
|
|
1395
|
-
- 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
|
|
1410
|
+
- 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.
|
|
1411
|
+
|
|
1412
|
+
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.**
|
|
1413
|
+
|
|
1414
|
+
- 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.
|
|
1415
|
+
- 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.
|
|
1416
|
+
- Centre that inner column with the container's own centring, not by shrinking the root.
|
|
1417
|
+
- **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.`;
|
|
1396
1418
|
var COMPONENT_STRUCTURE = `## Component Structure
|
|
1397
1419
|
|
|
1398
1420
|
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.
|
|
@@ -1604,6 +1626,7 @@ ${axisSection}
|
|
|
1604
1626
|
CONTRACT_SURFACE,
|
|
1605
1627
|
DEFENSIVE_CODING,
|
|
1606
1628
|
GESTURE_ROUTING,
|
|
1629
|
+
TERMINAL_ACTIONS,
|
|
1607
1630
|
FREE_GESTURE_SURFACE,
|
|
1608
1631
|
ANTI_PATTERNS,
|
|
1609
1632
|
CROSS_REFERENCE_RULES,
|
|
@@ -2002,6 +2025,7 @@ ${axisSection}
|
|
|
2002
2025
|
CONTRACT_SURFACE,
|
|
2003
2026
|
DEFENSIVE_CODING,
|
|
2004
2027
|
GESTURE_ROUTING,
|
|
2028
|
+
TERMINAL_ACTIONS,
|
|
2005
2029
|
INTERACTIVE_TRAITS,
|
|
2006
2030
|
ANTI_PATTERNS,
|
|
2007
2031
|
CROSS_REFERENCE_RULES,
|