@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/index.js
CHANGED
|
@@ -1481,7 +1481,8 @@ type ${typeName} = ${tsType};`
|
|
|
1481
1481
|
);
|
|
1482
1482
|
const callSig = tsType === "void" ? "() => void \u2014 fire and forget" : `(data: ${tsType}) => void`;
|
|
1483
1483
|
const toolHint = tool ? ` \u2192 nextStep: ${tool}` : "";
|
|
1484
|
-
|
|
1484
|
+
const onceHint = " \u2014 if this is meant ONCE, disable its control after it fires";
|
|
1485
|
+
actionHookCalls.push(` const ${key} = useAction<${typeName}>('${key}'); // ${callSig}${toolHint}${onceHint}`);
|
|
1485
1486
|
}
|
|
1486
1487
|
const streamChannels = contract?.streamSpec ?? {};
|
|
1487
1488
|
const streamChannelEntries = Object.entries(streamChannels);
|
|
@@ -1816,12 +1817,33 @@ Rules:
|
|
|
1816
1817
|
3. Default values come from the current request \u2014 so the component renders correctly standalone.
|
|
1817
1818
|
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.
|
|
1818
1819
|
5. Props interface must be typed and exported.`;
|
|
1819
|
-
var
|
|
1820
|
+
var TERMINAL_ACTIONS = `## Actions the user means once
|
|
1821
|
+
|
|
1822
|
+
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.
|
|
1823
|
+
|
|
1824
|
+
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".
|
|
1825
|
+
|
|
1826
|
+
**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.
|
|
1827
|
+
|
|
1828
|
+
When you do guard one:
|
|
1829
|
+
- Hold a small piece of state for it and set it in the handler: \`const [submitted, setSubmitted] = useState(false)\`.
|
|
1830
|
+
- \`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.
|
|
1831
|
+
- A card re-rendered with new props starts fresh; the state above lives with the component, not with the request.
|
|
1832
|
+
|
|
1833
|
+
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.`;
|
|
1834
|
+
var FRAME_SIZING = `## Sizing \u2014 the frame owns the height and the width
|
|
1820
1835
|
|
|
1821
1836
|
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:
|
|
1822
1837
|
- 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.
|
|
1823
1838
|
- 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.
|
|
1824
|
-
- 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
|
|
1839
|
+
- 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.
|
|
1840
|
+
|
|
1841
|
+
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.**
|
|
1842
|
+
|
|
1843
|
+
- 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.
|
|
1844
|
+
- 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.
|
|
1845
|
+
- Centre that inner column with the container's own centring, not by shrinking the root.
|
|
1846
|
+
- **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.`;
|
|
1825
1847
|
var COMPONENT_STRUCTURE = `## Component Structure
|
|
1826
1848
|
|
|
1827
1849
|
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.
|
|
@@ -2033,6 +2055,7 @@ ${axisSection}
|
|
|
2033
2055
|
CONTRACT_SURFACE,
|
|
2034
2056
|
DEFENSIVE_CODING,
|
|
2035
2057
|
GESTURE_ROUTING,
|
|
2058
|
+
TERMINAL_ACTIONS,
|
|
2036
2059
|
FREE_GESTURE_SURFACE,
|
|
2037
2060
|
ANTI_PATTERNS,
|
|
2038
2061
|
CROSS_REFERENCE_RULES,
|
|
@@ -2431,6 +2454,7 @@ ${axisSection}
|
|
|
2431
2454
|
CONTRACT_SURFACE,
|
|
2432
2455
|
DEFENSIVE_CODING,
|
|
2433
2456
|
GESTURE_ROUTING,
|
|
2457
|
+
TERMINAL_ACTIONS,
|
|
2434
2458
|
INTERACTIVE_TRAITS,
|
|
2435
2459
|
ANTI_PATTERNS,
|
|
2436
2460
|
CROSS_REFERENCE_RULES,
|