@godxjp/ui 23.2.1 → 23.4.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.
Files changed (101) hide show
  1. package/dist/app/timezones.js +2 -1
  2. package/dist/components/charts/chart-cartesian.js +2 -4
  3. package/dist/components/charts/chart-frame.js +2 -1
  4. package/dist/components/data-display/card.d.ts +87 -1
  5. package/dist/components/data-display/card.js +88 -15
  6. package/dist/components/data-display/index.d.ts +5 -1
  7. package/dist/components/data-display/index.js +5 -0
  8. package/dist/components/data-display/thought-chain.d.ts +42 -0
  9. package/dist/components/data-display/thought-chain.js +177 -0
  10. package/dist/components/data-display/welcome.d.ts +26 -0
  11. package/dist/components/data-display/welcome.js +37 -0
  12. package/dist/components/data-entry/attachments.d.ts +19 -0
  13. package/dist/components/data-entry/attachments.js +322 -0
  14. package/dist/components/data-entry/date-picker.js +12 -14
  15. package/dist/components/data-entry/index.d.ts +2 -0
  16. package/dist/components/data-entry/index.js +2 -0
  17. package/dist/components/data-entry/number-input.js +2 -1
  18. package/dist/components/feedback/dialog.d.ts +10 -7
  19. package/dist/components/feedback/dialog.js +40 -17
  20. package/dist/components/feedback/index.d.ts +3 -3
  21. package/dist/components/feedback/index.js +2 -0
  22. package/dist/components/feedback/skeleton.d.ts +11 -2
  23. package/dist/components/feedback/skeleton.js +8 -0
  24. package/dist/components/general/actions.d.ts +59 -0
  25. package/dist/components/general/actions.js +253 -0
  26. package/dist/components/general/activity.js +1 -0
  27. package/dist/components/general/button.js +2 -1
  28. package/dist/components/general/float-button.d.ts +41 -0
  29. package/dist/components/general/float-button.js +336 -0
  30. package/dist/components/general/index.d.ts +6 -2
  31. package/dist/components/general/index.js +12 -1
  32. package/dist/components/general/typography.d.ts +79 -4
  33. package/dist/components/general/typography.js +598 -54
  34. package/dist/components/layout/draggable-panel.d.ts +18 -0
  35. package/dist/components/layout/draggable-panel.js +189 -0
  36. package/dist/components/layout/error-surface.js +3 -2
  37. package/dist/components/layout/index.d.ts +2 -0
  38. package/dist/components/layout/index.js +2 -0
  39. package/dist/components/navigation/conversations.d.ts +39 -0
  40. package/dist/components/navigation/conversations.js +371 -0
  41. package/dist/components/navigation/index.d.ts +2 -0
  42. package/dist/components/navigation/index.js +2 -0
  43. package/dist/components/ui/card.js +1 -0
  44. package/dist/components/ui/toggle.js +2 -1
  45. package/dist/i18n/messages/en.json +53 -0
  46. package/dist/i18n/messages/ja.json +53 -0
  47. package/dist/i18n/messages/vi.json +53 -0
  48. package/dist/i18n/translate.js +3 -2
  49. package/dist/lib/datetime/picker-format.js +2 -1
  50. package/dist/lib/format.js +3 -2
  51. package/dist/lib/intl-cache.d.ts +32 -0
  52. package/dist/lib/intl-cache.js +29 -0
  53. package/dist/props/components/data-display.prop.d.ts +143 -1
  54. package/dist/props/components/data-entry.prop.d.ts +87 -0
  55. package/dist/props/components/feedback.prop.d.ts +53 -1
  56. package/dist/props/components/general.prop.d.ts +440 -3
  57. package/dist/props/components/index.d.ts +2 -2
  58. package/dist/props/components/layout.prop.d.ts +63 -1
  59. package/dist/props/components/navigation.prop.d.ts +150 -0
  60. package/dist/props/registry.d.ts +431 -0
  61. package/dist/props/registry.js +551 -0
  62. package/dist/props/vocabulary/index.d.ts +1 -1
  63. package/dist/props/vocabulary/interaction.prop.d.ts +113 -0
  64. package/dist/styles/alert-layout.css +22 -0
  65. package/dist/styles/card-layout.css +34 -0
  66. package/dist/styles/core.css +1 -0
  67. package/dist/styles/data-display-layout.css +236 -0
  68. package/dist/styles/float-button-layout.css +168 -0
  69. package/dist/styles/form-layout.css +11 -1
  70. package/dist/styles/index.css +1 -0
  71. package/dist/styles/layout.css +196 -0
  72. package/dist/styles/navigation-layout.css +139 -0
  73. package/dist/styles/text-layout.css +156 -0
  74. package/dist/tokens/axes.css +5 -0
  75. package/dist/tokens/base.css +7 -0
  76. package/dist/tokens/components/actions.css +14 -0
  77. package/dist/tokens/components/attachments.css +15 -0
  78. package/dist/tokens/components/conversations.css +28 -0
  79. package/dist/tokens/components/draggable-panel.css +25 -0
  80. package/dist/tokens/components/float-button.css +39 -0
  81. package/dist/tokens/components/text.css +13 -0
  82. package/dist/tokens/components/thought-chain.css +31 -0
  83. package/dist/tokens/components/welcome.css +19 -0
  84. package/dist/tokens/foundation.css +6 -4
  85. package/docs/DESIGN-AUTHORITY.md +133 -20
  86. package/docs/FRAME-COVERAGE-REPORT.md +5 -2
  87. package/docs/data-display/card/examples/tab-list.tsx +97 -0
  88. package/docs/data-display/thought-chain.tsx +176 -0
  89. package/docs/data-display/welcome.tsx +115 -0
  90. package/docs/data-entry/attachments.tsx +160 -0
  91. package/docs/feedback/dialog.tsx +50 -0
  92. package/docs/general/actions.tsx +175 -0
  93. package/docs/general/float-button.tsx +133 -0
  94. package/docs/general/typography.tsx +63 -1
  95. package/docs/layout/draggable-panel.tsx +127 -0
  96. package/docs/navigation/conversations.tsx +176 -0
  97. package/docs/roadmap/parity-audit-layout-navigation-general.md +17 -16
  98. package/package.json +20 -4
  99. package/scripts/_agent-setup.mjs +36 -5
  100. package/scripts/guinea-pig-skill.md +14 -0
  101. package/scripts/ui-audit.mjs +69 -9
@@ -891,16 +891,47 @@ function staleOwnedRules() {
891
891
  const target = join(CWD, ".ai", "rules", "godxjp-ui.md");
892
892
  if (!existsSync(target)) return null;
893
893
 
894
- const stamped = /<!-- godxjp-ui:version ([^\s]+) -->/.exec(readFileSync(target, "utf8"))?.[1];
894
+ // FOUR states, not two. `!stamped || !installed || stamped === installed` collapsed three very
895
+ // different situations into one silence, and only ONE of them is genuinely fine:
896
+ //
897
+ // no rule file, consumer never opted into the agent kit -> silent, and it MUST stay silent.
898
+ // Turning this into a finding would make a UI audit into a tool that nags every consumer to
899
+ // install an agent kit they did not ask for. (Handled by the existsSync above.)
900
+ // rule file present but carrying NO stamp -> compatibility UNKNOWN, say so.
901
+ // installed version unreadable -> compatibility UNKNOWN, say so.
902
+ // stamp != installed -> stale, the original finding.
903
+ const contents = readFileSync(target, "utf8");
904
+ const stamped = /<!-- godxjp-ui:version ([^\s]+) -->/.exec(contents)?.[1];
905
+
895
906
  let installed;
896
907
  try {
897
908
  installed = JSON.parse(
898
909
  readFileSync(join(CWD, "node_modules", "@godxjp", "ui", "package.json"), "utf8"),
899
910
  ).version;
900
911
  } catch {
901
- return null;
912
+ installed = undefined;
902
913
  }
903
- if (!stamped || !installed || stamped === installed) return null;
914
+
915
+ if (!stamped || !installed) {
916
+ // A file the package OWNS, whose provenance cannot be established. That is not the same as
917
+ // "up to date", and reporting it as such is the whole class of bug this function exists for.
918
+ return {
919
+ file: ".ai/rules/godxjp-ui.md",
920
+ line: 1,
921
+ rule: "owned-rules-unknown",
922
+ severity: "warn",
923
+ message:
924
+ `This file is written by @godxjp/ui, but its version cannot be established ` +
925
+ `(${!stamped ? "the file carries no `<!-- godxjp-ui:version … -->` stamp" : "the installed package version could not be read"}). ` +
926
+ `An agent may be reading guidance from a different major. Refresh it with ` +
927
+ `\`npx @godxjp/ui init-agent\`, or delete the file if this project does not use the agent kit.`,
928
+ replacement: null,
929
+ standard: null,
930
+ snippet: (stamped ?? "(no stamp)") + " vs " + (installed ?? "(package version unreadable)"),
931
+ };
932
+ }
933
+
934
+ if (stamped === installed) return null;
904
935
 
905
936
  return {
906
937
  file: ".ai/rules/godxjp-ui.md",
@@ -1112,11 +1143,37 @@ const warnings = findings.filter((f) => f.severity === "warn");
1112
1143
  // "✓ No UI-standardization violations found." and exited 0 having read nothing at all.
1113
1144
  // …except under `--changed`, where "this branch touched no .tsx" is a clean run, not a
1114
1145
  // misconfigured path. Failing there would make the gate unusable on every backend-only commit.
1115
- if (filesScanned === 0 && CHANGED) {
1116
- if (!quiet && !asJson) console.log("✓ ui-audit --changed: no .tsx/.jsx changed on this branch.");
1146
+ // "This branch touched no UI file" is a clean run — but ONLY if there is nothing else to say.
1147
+ //
1148
+ // `staleOwnedRules()` runs before the scan loop and pushes its finding into `findings`, and this
1149
+ // branch used to exit 0 regardless: a consumer whose package-owned rules were four majors out of
1150
+ // date got "✓ no .tsx/.jsx changed" and a clean exit on any commit that happened not to touch a
1151
+ // component. Under `--format json` it was worse — the exit came BEFORE anything was written, so
1152
+ // stdout was EMPTY and a CI step reading it could not tell that from a pass.
1153
+ //
1154
+ // Reproduced: rules stamped 19.6.0 against an installed 23.3.0, one README.md changed →
1155
+ // `✓ no .tsx/.jsx changed`, exit 0, empty JSON, while `ui-audit src --format json` on the same
1156
+ // tree at the same moment reported `owned-rules-stale`.
1157
+ //
1158
+ // Same defect as the `.jsx` one this file just fixed, one screen further down: a gate declaring
1159
+ // itself clean while holding a finding.
1160
+ /** `--changed` legitimately opened no file. NOT the same thing as a misconfigured scan path. */
1161
+ const changedNoFiles = CHANGED && filesScanned === 0;
1162
+
1163
+ if (changedNoFiles && findings.length === 0) {
1164
+ if (asJson) {
1165
+ // ALWAYS emit a valid document on the JSON path. This branch used to exit before writing
1166
+ // anything, so a CI step parsing stdout got an empty string and a zero exit.
1167
+ process.stdout.write(
1168
+ JSON.stringify({ summary: { errors: 0, warnings: 0 }, findings: [] }, null, 2) + "\n",
1169
+ );
1170
+ } else if (!quiet) {
1171
+ console.log("✓ ui-audit --changed: no .tsx/.jsx changed on this branch.");
1172
+ }
1117
1173
  process.exit(0);
1118
1174
  }
1119
- if (filesScanned === 0) {
1175
+
1176
+ if (filesScanned === 0 && !CHANGED) {
1120
1177
  const message =
1121
1178
  `ui-audit scanned 0 files — none of [${SCAN_DIRS.join(", ")}] exists (or all were filtered). ` +
1122
1179
  `Pass the directories to scan, e.g. \`node scripts/ui-audit.mjs src docs\`. ` +
@@ -1131,7 +1188,7 @@ if (filesScanned === 0) {
1131
1188
  process.exitCode = 2;
1132
1189
  }
1133
1190
 
1134
- if (filesScanned === 0) {
1191
+ if (filesScanned === 0 && !changedNoFiles) {
1135
1192
  // already reported above
1136
1193
  } else if (asJson) {
1137
1194
  process.stdout.write(
@@ -1161,7 +1218,10 @@ if (filesScanned === 0) {
1161
1218
  console.log(` ${C.dim}${f.snippet}${C.reset}`);
1162
1219
  }
1163
1220
  console.log(
1164
- `\ngodxjp-ui audit: ${C.red}${errors.length} error(s)${C.reset}, ${C.yellow}${warnings.length} warning(s)${C.reset} across ${scannedFiles.join(", ")}.`,
1221
+ `\ngodxjp-ui audit: ${C.red}${errors.length} error(s)${C.reset}, ${C.yellow}${warnings.length} warning(s)${C.reset}` +
1222
+ (scannedFiles.length > 0
1223
+ ? ` across ${scannedFiles.join(", ")}.`
1224
+ : " — no UI file changed on this branch, but the findings above are not about a file."),
1165
1225
  );
1166
1226
  if (errors.length === 0 && warnings.length === 0) {
1167
1227
  console.log("✓ No UI-standardization violations found.");
@@ -1169,4 +1229,4 @@ if (filesScanned === 0) {
1169
1229
  }
1170
1230
 
1171
1231
  // See the note above --rules: exitCode, so a large JSON report drains fully.
1172
- if (filesScanned > 0) process.exitCode = errors.length > 0 ? 1 : 0;
1232
+ if (filesScanned > 0 || changedNoFiles) process.exitCode = errors.length > 0 ? 1 : 0;