@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
|
@@ -399,6 +399,50 @@ function runViewportSized(input) {
|
|
|
399
399
|
)
|
|
400
400
|
];
|
|
401
401
|
}
|
|
402
|
+
var TERMINAL_WORDS = /* @__PURE__ */ new Set([
|
|
403
|
+
"submit",
|
|
404
|
+
"confirm",
|
|
405
|
+
"approve",
|
|
406
|
+
"schedule",
|
|
407
|
+
"reserve",
|
|
408
|
+
"book",
|
|
409
|
+
"pay",
|
|
410
|
+
"checkout",
|
|
411
|
+
"purchase",
|
|
412
|
+
"order"
|
|
413
|
+
]);
|
|
414
|
+
var TERMINAL_LABEL_RX = /\b(submit|confirm|approve|schedule|reserve|book|pay|checkout|purchase|place\s+order)\b/i;
|
|
415
|
+
var GUARD_RX = /\b(disabled|aria-disabled)\s*=/;
|
|
416
|
+
function nameWords(name) {
|
|
417
|
+
return name.split(/(?=[A-Z])|[_\-\s]+/).map((w) => w.toLowerCase()).filter((w) => w.length > 0);
|
|
418
|
+
}
|
|
419
|
+
function findUnguardedTerminalControls(sourceCode) {
|
|
420
|
+
if (GUARD_RX.test(sourceCode)) return [];
|
|
421
|
+
const names = /* @__PURE__ */ new Set();
|
|
422
|
+
for (const m of sourceCode.matchAll(/useAction(?:<[^>]*>)?\(\s*['"`]([^'"`]+)['"`]/g)) {
|
|
423
|
+
const name = m[1] ?? "";
|
|
424
|
+
if (nameWords(name).some((w) => TERMINAL_WORDS.has(w))) names.add(name);
|
|
425
|
+
}
|
|
426
|
+
for (const m of sourceCode.matchAll(/>([^<>{}]{1,60})<\/Button>/g)) {
|
|
427
|
+
const label = (m[1] ?? "").replace(/\s+/g, " ").trim();
|
|
428
|
+
if (label.length > 0 && TERMINAL_LABEL_RX.test(label)) names.add(label.slice(0, 40));
|
|
429
|
+
}
|
|
430
|
+
return [...names];
|
|
431
|
+
}
|
|
432
|
+
function runTerminalActionUnguarded(input) {
|
|
433
|
+
if (input.compiledCode === null) return [];
|
|
434
|
+
const found = findUnguardedTerminalControls(input.sourceCode);
|
|
435
|
+
if (found.length === 0) return [];
|
|
436
|
+
const list = found.map((t) => `"${t}"`).join(", ");
|
|
437
|
+
return [
|
|
438
|
+
mkIssue(
|
|
439
|
+
"universal.terminal_action_unguarded",
|
|
440
|
+
`${list} reads as an action the user means once, and nothing in this component disables the control after it fires \u2014 a double-click sends it twice.`,
|
|
441
|
+
'Hold the fired state (`const [submitted, setSubmitted] = useState(false)`), set it in the handler, and pass `disabled={submitted}` to that control with a word that says so ("Submitted"). If the action IS meant to repeat \u2014 sending a message, adding an item \u2014 leave it armed and ignore this.',
|
|
442
|
+
"warn"
|
|
443
|
+
)
|
|
444
|
+
];
|
|
445
|
+
}
|
|
402
446
|
var UNIVERSAL_CHECKS = [
|
|
403
447
|
{
|
|
404
448
|
id: "universal.icon_name_known",
|
|
@@ -418,6 +462,12 @@ var UNIVERSAL_CHECKS = [
|
|
|
418
462
|
values: ALL_RENDER_VALUES,
|
|
419
463
|
run: runViewportSized
|
|
420
464
|
},
|
|
465
|
+
{
|
|
466
|
+
id: "universal.terminal_action_unguarded",
|
|
467
|
+
axis: "render",
|
|
468
|
+
values: ALL_RENDER_VALUES,
|
|
469
|
+
run: runTerminalActionUnguarded
|
|
470
|
+
},
|
|
421
471
|
{
|
|
422
472
|
id: "universal.accent_text_ink",
|
|
423
473
|
axis: "render",
|