@ai-matrx/records-ui 0.116.122 → 0.116.124

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 (53) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{SaveToTable-VNAYIDXB.js → SaveToTable-BEKANHD3.js} +4 -3
  3. package/dist/{chunk-KJAVVXRW.js → chunk-5RU7BPCU.js} +8 -230
  4. package/dist/chunk-5RU7BPCU.js.map +1 -0
  5. package/dist/chunk-6DK2DKTD.js +235 -0
  6. package/dist/chunk-6DK2DKTD.js.map +1 -0
  7. package/dist/{chunk-6RFL5KYR.js → chunk-B7A3B6F4.js} +2 -2
  8. package/dist/{chunk-U2B3TLDZ.js → chunk-EB6IVWGJ.js} +193 -77
  9. package/dist/chunk-EB6IVWGJ.js.map +1 -0
  10. package/dist/data-source.d.cts +1 -1
  11. package/dist/data-source.d.ts +1 -1
  12. package/dist/decision-gate.d.cts +4 -4
  13. package/dist/decision-gate.d.ts +4 -4
  14. package/dist/entity-doors.d.cts +24 -28
  15. package/dist/entity-doors.d.ts +24 -28
  16. package/dist/entity-ref.d.cts +48 -52
  17. package/dist/entity-ref.d.ts +48 -52
  18. package/dist/first-page.d.cts +4 -4
  19. package/dist/first-page.d.ts +4 -4
  20. package/dist/helpers.cjs.map +1 -1
  21. package/dist/helpers.d.cts +104 -106
  22. package/dist/helpers.d.ts +104 -106
  23. package/dist/helpers.js.map +1 -1
  24. package/dist/html-frame.d.cts +2 -2
  25. package/dist/html-frame.d.ts +2 -2
  26. package/dist/index.cjs +531 -282
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +488 -480
  29. package/dist/index.d.ts +488 -480
  30. package/dist/index.js +351 -214
  31. package/dist/index.js.map +1 -1
  32. package/dist/list-dimensions.cjs +203 -7
  33. package/dist/list-dimensions.cjs.map +1 -1
  34. package/dist/list-dimensions.d.cts +8 -8
  35. package/dist/list-dimensions.d.ts +8 -8
  36. package/dist/list-dimensions.js +10 -7
  37. package/dist/list-dimensions.js.map +1 -1
  38. package/dist/objectActions-DeP_tTmc.d.cts +12 -12
  39. package/dist/objectActions-DeP_tTmc.d.ts +12 -12
  40. package/dist/pickers.cjs +179 -55
  41. package/dist/pickers.cjs.map +1 -1
  42. package/dist/pickers.d.cts +13 -13
  43. package/dist/pickers.d.ts +13 -13
  44. package/dist/pickers.js +3 -2
  45. package/dist/skeleton.d.cts +11 -11
  46. package/dist/skeleton.d.ts +11 -11
  47. package/dist/table-shape.d.cts +7 -7
  48. package/dist/table-shape.d.ts +7 -7
  49. package/package.json +2 -2
  50. package/dist/chunk-KJAVVXRW.js.map +0 -1
  51. package/dist/chunk-U2B3TLDZ.js.map +0 -1
  52. /package/dist/{SaveToTable-VNAYIDXB.js.map → SaveToTable-BEKANHD3.js.map} +0 -0
  53. /package/dist/{chunk-6RFL5KYR.js.map → chunk-B7A3B6F4.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.116.124
4
+
5
+ - The formula box names the row its answer comes from ("On Paddle: 4"), never "First row": the sampled row is the store's first, not the top row of the grid a person is looking at, so "First row: 4" over a grid whose top row works out to 10 read as a wrong answer. Consumer action: none.
6
+ - History rows never cut their words off: in the narrow panel a formula's history squeezed the cause ("Record edited", "Formula changed") to one letter, and a column's history cut the change itself to an ellipsis. Both now draw two lines per row: the answer (or before -> after) and its formula version first, then why, who and when, with the ways back. Guard: `a-history-row-never-cuts-off-its-words`. Consumer action: none.
7
+
8
+ ## 0.116.123
9
+
10
+ - `list-dimensions`: every read failure shows the door's people sentence through `refusalSentence`, never `error.message` raw (the refusal census found five raw renders). Tests follow two deliberate changes: the hydration test's browser runs the server's streamed Suspense reveal (the lazy data table), and on a phone the grid's search, select-all and New record follow design-system's sheet toolbar (search in Tools, primary + select-all on the row); the ungrouped Grouping button reads "Group by". Consumer action: none.
11
+
3
12
  ## 0.116.122
4
13
 
5
14
  - Test only: the skeleton height test waits for the data table's lazy entry to settle before counting placeholder rows (it counted the lazy stand-in, which has no placeholder-row marker, and read 0). Consumer action: none.
@@ -3,9 +3,10 @@ import {
3
3
  SAVE_TO_TABLE_TYPES,
4
4
  SaveToTable,
5
5
  shapesOfSource
6
- } from "./chunk-6RFL5KYR.js";
6
+ } from "./chunk-B7A3B6F4.js";
7
7
  import "./chunk-MTA5CGMH.js";
8
- import "./chunk-KJAVVXRW.js";
8
+ import "./chunk-5RU7BPCU.js";
9
+ import "./chunk-6DK2DKTD.js";
9
10
  import "./chunk-YHPVSUK6.js";
10
11
  import "./chunk-LBZZDHV6.js";
11
12
  import "./chunk-RKI2YQHW.js";
@@ -16,4 +17,4 @@ export {
16
17
  SaveToTable,
17
18
  shapesOfSource
18
19
  };
19
- //# sourceMappingURL=SaveToTable-VNAYIDXB.js.map
20
+ //# sourceMappingURL=SaveToTable-BEKANHD3.js.map
@@ -1,4 +1,11 @@
1
1
  "use client";
2
+ import {
3
+ isMachineIdentity,
4
+ peopleHint,
5
+ refusalForAPerson,
6
+ refusalLineForAPerson,
7
+ refusalSentence
8
+ } from "./chunk-6DK2DKTD.js";
2
9
  import {
3
10
  NOT_ANSWERED_YET,
4
11
  whatYouMayDo,
@@ -172,225 +179,6 @@ function cardTitleField(fields, titleKey, exclude = []) {
172
179
  return ordered.find((f) => f.type === "text" && canTitle(f, excluded)) ?? ordered.find((f) => canTitle(f, excluded));
173
180
  }
174
181
 
175
- // src/plainWords.ts
176
- var MACHINE_IDENTITY = [
177
- /\b[A-Z]{2,4}-\d{1,3}\b/,
178
- // A build lane's tag: capital words joined by hyphens, then a colon ("STORE-TAILS-3:",
179
- // "MOVE-AND-OUTSIDER:"). A person never reads which lane wrote a sentence.
180
- /\b[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+:/,
181
- /\b(?:custom|platform|iam|history|public|auth|campaign_watch)\.[a-z_]+/,
182
- /\b(?:config|data|document|spec|patch)\.[a-z_]+/,
183
- /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i,
184
- /\b[a-z][a-z0-9]*(?:_[a-z0-9]+)+\b/,
185
- // Five characters of digits and capitals, at least one a digit — so `23514`
186
- // and `PT409` match and an emphatic `NEVER` does not.
187
- /\b(?=[0-9A-Z]{5}\b)(?=[0-9A-Z]*\d)[0-9A-Z]{5}\b/
188
- ];
189
- function isMachineIdentity(text) {
190
- return MACHINE_IDENTITY.some((shape) => shape.test(text));
191
- }
192
- function machineIdentityIn(text) {
193
- const found = [];
194
- for (const shape of MACHINE_IDENTITY) {
195
- const all = new RegExp(shape.source, shape.flags.includes("g") ? shape.flags : `${shape.flags}g`);
196
- for (const hit of text.matchAll(all)) if (hit[0]) found.push(hit[0]);
197
- }
198
- return [...new Set(found)];
199
- }
200
- var TITLE = {
201
- stale_write: "Someone else wrote first",
202
- door: "You do not have access to this",
203
- door_absent: "That is not built yet",
204
- refused_by_rule: "That value was not accepted",
205
- invalid_argument: "That was not accepted",
206
- not_found: "Not there any more",
207
- missing_reference: "That points at something that is not there",
208
- already_exists: "That already exists",
209
- not_supported: "That cannot be done here",
210
- store_limit: "This has got as big as it can",
211
- // 🚨 NOT "THE SWITCH IS OFF" (lane 7 W1 fix round 1). PGRST202 / PGRST205 land here, and the
212
- // commonest cause is a door this screen asks for that the database it talks to does not serve
213
- // YET — a release in flight. Telling the person her organization has its store switched off was
214
- // false (the switch is answered by its own door, `platform.unified_data_store_on`). Honest:
215
- // nothing happened, and it is ours, and it passes.
216
- store_not_served: "This isn't available right now",
217
- unreachable: "We could not reach your data",
218
- needs_approval: "This is waiting on someone's approval",
219
- stale_read: "Your view of this is a moment behind",
220
- timed_out: "That took too long to answer",
221
- internal: "Something went wrong at our end"
222
- };
223
- var REMEDY = {
224
- stale_write: "Look at what they wrote. Keep theirs, or try again and yours goes on top.",
225
- door: "Ask somebody who administers this to share it with you at the level you need.",
226
- door_absent: "There is nothing to do here yet. It is on our list, not yours.",
227
- refused_by_rule: "Change the value so it passes, then try again.",
228
- invalid_argument: "Change what you entered, then try again.",
229
- not_found: "It may have been deleted. Go back to the list and open it again from there.",
230
- missing_reference: "Pick something that is still there.",
231
- already_exists: "Use a different name.",
232
- not_supported: "There is another way to do this \u2014 ask, and we will point you at it.",
233
- store_limit: "Split it up, or ask us to raise the ceiling for your organization.",
234
- store_not_served: "Nothing was changed. Try again in a few minutes.",
235
- // 🚨 NOTHING WAS WRITTEN AND NOTHING WAS REFUSED (lane TAILS-6). The call
236
- // never arrived, so "try again" is the honest instruction rather than a
237
- // consolation — and saying nothing changed is the half a person actually
238
- // worries about.
239
- unreachable: "Nothing was changed. Check your connection and open this again.",
240
- needs_approval: "Nothing was changed yet. The people who can approve it have been asked.",
241
- stale_read: "Open this again in a moment and it will be up to date.",
242
- // 🚨 ONE REMEDY THAT IS TRUE OF EVERY DOOR (lane CHAIR-STORE-PERF, 2026-10-03). The store cancels the
243
- // WHOLE statement at its clock, so a timed-out door wrote nothing — a create, a column add and a page
244
- // read alike. "Try a smaller page" was written for the page read and was printed to a person adding
245
- // one row to a three-row table (clone walk, 2026-10-03; the clock was a lock another lane's
246
- // rehearsal held, not the row). A door whose page can shrink says so in its own hint, which wins here.
247
- // ONE SENTENCE, NOT TWO (lane TIMEOUT-ONE-SENTENCE, 2026-10-19): the shared timed-out sentence ("That took too long.
248
- // Nothing was lost; try again.") already says what happened and what to do, so the table adds NO second remedy
249
- // ("Nothing was changed" was also wrong on a read). Empty = the notice prints no remedy line and the one-line
250
- // form is the sentence alone. A door's own hint still wins.
251
- timed_out: "",
252
- internal: "Nothing you did caused this. Try again, and tell us if it keeps happening."
253
- };
254
- var ENGINEER_TEXT = [
255
- /@ai-matrx\//,
256
- /\bSQLSTATE\b/i,
257
- /\bPostgREST\b/i,
258
- /\bIndexedDB\b/i,
259
- // `<RecordsUiProvider>` — a component, on a screen.
260
- /<\/?[A-Z][A-Za-z0-9]*\s*\/?>/,
261
- // `savedViews`, `openRecords`, `onReask` — an identifier, however it is
262
- // quoted. English does not write camelCase; code does.
263
- /\b[a-z][a-z0-9]*[A-Z][A-Za-z0-9]*\b/,
264
- // A backticked token is a thing you type into an editor, not a thing you do.
265
- /`[A-Za-z_][A-Za-z0-9_.]*`/,
266
- // "bind X on Y", "pass X", "import X" — an instruction to whoever maintains
267
- // the app, arriving on the screen of somebody who cannot act on it.
268
- /\bbind\s+[`'"A-Za-z]/i
269
- ];
270
- function isDeveloperHint(hint) {
271
- const text = hint.trim();
272
- if (text === "") return false;
273
- if (text.includes("```")) return true;
274
- if (/\n\s+at\s+\S+/.test(text)) return true;
275
- if (text.length > 600) return true;
276
- return isEngineerText(text);
277
- }
278
- function peopleHint(hint) {
279
- const said = (hint ?? "").trim();
280
- if (said === "" || isDeveloperHint(said)) return null;
281
- return plainSentence(said).kept;
282
- }
283
- function isEngineerText(text) {
284
- return ENGINEER_TEXT.some((shape) => shape.test(text));
285
- }
286
- function withoutMachineClauses(sentence) {
287
- const dropped = [];
288
- const footnotes = [];
289
- const withoutFootnotes = sentence.replace(/\s*\((?:see\s+)?[A-Z]{2,5}-[A-Z0-9-]{1,8}\)/g, (hit) => {
290
- footnotes.push(hit.trim());
291
- return "";
292
- });
293
- dropped.push(...footnotes);
294
- const clauses = withoutFootnotes.split(/(?:,\s+so\s+|\s+—\s+|\s+--\s+|\s*\|\s*)/).map((clause) => clause.trim()).filter((clause) => clause !== "");
295
- const kept2 = clauses.filter((clause) => {
296
- if (!isMachineIdentity(clause)) return true;
297
- dropped.push(clause);
298
- return false;
299
- });
300
- if (kept2.length === 0) return { kept: null, dropped };
301
- if (dropped.length === 0) return { kept: sentence.trim(), dropped };
302
- let joined = kept2.join(". ").replace(/\.\.+/g, ".").trim();
303
- if (!/[.!?]$/.test(joined)) joined = `${joined}.`;
304
- return { kept: joined, dropped };
305
- }
306
- function peopleSentence(message) {
307
- const [lead = "", ...tail] = message.split(/\s+—\s+|\s+--\s+/);
308
- const sentences = lead.trim().split(/(?<=(?<!\b(?:Dr|Mr|Mrs|Ms|St|vs|No|e\.g|i\.e|etc|[A-Z]))[.!?])\s+/);
309
- const first = sentences[0] ?? "";
310
- const rest = [...sentences.slice(1), ...tail].map((part) => part.trim()).filter((part) => part !== "");
311
- const cleaned = plainSentence(first);
312
- return { kept: cleaned.kept, dropped: [...cleaned.dropped, ...rest] };
313
- }
314
- function refusalSentence(error) {
315
- return refusalForAPerson(error).sentence;
316
- }
317
- var BUILD_LABEL = String.raw`(?:Test \d+ \([^)]{1,40}\)|[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+|[A-Z]{1,5}\d+[a-z]?)`;
318
- var LEADING_BUILD_LABEL = new RegExp(String.raw`^${BUILD_LABEL}(?:\s*\/\s*${BUILD_LABEL})*:\s+`);
319
- function withoutBuildLabel(sentence) {
320
- const hit = LEADING_BUILD_LABEL.exec(sentence);
321
- if (!hit) return { label: null, rest: sentence };
322
- const rest = sentence.slice(hit[0].length).trim();
323
- return { label: hit[0].trim(), rest: rest.charAt(0).toUpperCase() + rest.slice(1) };
324
- }
325
- function plainSentence(message) {
326
- const dropped = [];
327
- const kept2 = [];
328
- for (const raw of message.split(/(?<=[.!?])\s+/)) {
329
- const labelled = withoutBuildLabel(raw.trim());
330
- if (labelled.label) dropped.push(labelled.label);
331
- const sentence = labelled.rest;
332
- if (sentence === "") continue;
333
- const cleaned = withoutMachineClauses(sentence);
334
- dropped.push(...cleaned.dropped);
335
- if (cleaned.kept) kept2.push(cleaned.kept);
336
- }
337
- return { kept: kept2.length === 0 ? null : kept2.join(" "), dropped };
338
- }
339
- function readsAsASentence(text) {
340
- return (text ?? "").trim().split(/\s+/).filter(Boolean).length >= 2;
341
- }
342
- function exampleOf(error) {
343
- const detail = error.detail;
344
- if (!detail || typeof detail !== "object") return null;
345
- const example = detail.example;
346
- return typeof example === "string" && example.trim() !== "" ? example.trim() : null;
347
- }
348
- var TIMED_OUT_SAID = "That took too long. Nothing was lost; try again.";
349
- function refusalForAPerson(error) {
350
- const code = error.code ?? "internal";
351
- const timedOut = code === "timed_out" || error.sqlstate === "57014" || /canceling statement due to statement timeout/i.test(String(error.message ?? ""));
352
- const ours = error.ours === true;
353
- const hint = plainSentence(String(error.hint ?? ""));
354
- const message = ours ? plainSentence(String(error.message ?? "")) : peopleSentence(String(error.message ?? ""));
355
- const title = timedOut ? TITLE["timed_out"] : TITLE[code] ?? "That was refused";
356
- const hintIsForEngineers = isDeveloperHint(String(error.hint ?? ""));
357
- const example = exampleOf(error);
358
- const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers || !readsAsASentence(hint.kept) ? null : hint.kept) ?? (timedOut ? REMEDY["timed_out"] : REMEDY[code]) ?? REMEDY["internal"];
359
- const messageIsForEngineers = isEngineerText(String(error.message ?? ""));
360
- const said = timedOut ? TIMED_OUT_SAID : (messageIsForEngineers ? "" : message.kept ?? "").trim();
361
- const forEngineers = [
362
- error.sqlstate ? `SQLSTATE ${error.sqlstate}.` : null,
363
- // The client's own note about a class it did not recognize, or a call that
364
- // never reached the store. It is rendered out of sight, never as a sentence.
365
- error.diagnostic ? error.diagnostic : null,
366
- messageIsForEngineers || timedOut ? `Message: ${error.message}` : null,
367
- error.hint && (hintIsForEngineers || hint.kept !== error.hint) ? `Hint: ${error.hint}` : null,
368
- message.dropped.length > 0 || hint.dropped.length > 0 ? `Dropped from the person's view: ${[...message.dropped, ...hint.dropped].join(" | ")}` : null
369
- ].filter(Boolean).join(" ");
370
- return {
371
- title,
372
- // Nothing invented. When every clause was machine identity the title says
373
- // what happened and the remedy says what to do; a made-up diagnosis would
374
- // be worse than the identifier it replaced.
375
- sentence: said === "" ? `${title}.` : said,
376
- remedy,
377
- storeSaid: said !== "",
378
- forEngineers
379
- };
380
- }
381
- function refusalLineForAPerson(error) {
382
- const plain = refusalForAPerson(error);
383
- const sentence = plain.sentence.trim();
384
- const ended = sentence === "" || /[.!?…:]$/.test(sentence) ? sentence : `${sentence}.`;
385
- return `${ended} ${plain.remedy}`.trim();
386
- }
387
- function refusalIsMissingInput(error) {
388
- return error.sqlstate === "22023" || error.code === "invalid_argument";
389
- }
390
- function withoutInternalCodes(text) {
391
- return text.replace(/\s*\((?:[A-Z]{2,}-\d+[A-Za-z]?|T\d+)(?:\s*\/\s*(?:[A-Z]{2,}-\d+[A-Za-z]?|T\d+))*\)/g, "").replace(/\s+([.,;])/g, "$1").trim();
392
- }
393
-
394
182
  // src/Refusal.tsx
395
183
  import { archivedOrganizationId } from "@ai-matrx/records/core";
396
184
  import { Alert as Alert2, AlertDescription as AlertDescription2, AlertTitle as AlertTitle2, ErrorBox, TIMED_OUT_SENTENCE as TIMED_OUT_SENTENCE2, cn as cn2 } from "@ai-matrx/design-system";
@@ -1724,16 +1512,6 @@ export {
1724
1512
  singularNoun,
1725
1513
  pluralNoun,
1726
1514
  cardTitleField,
1727
- MACHINE_IDENTITY,
1728
- isMachineIdentity,
1729
- machineIdentityIn,
1730
- ENGINEER_TEXT,
1731
- isEngineerText,
1732
- refusalSentence,
1733
- refusalForAPerson,
1734
- refusalLineForAPerson,
1735
- refusalIsMissingInput,
1736
- withoutInternalCodes,
1737
1515
  refusalTimedOut,
1738
1516
  refusalSaid,
1739
1517
  hintIsMachineIdentity,
@@ -1800,4 +1578,4 @@ export {
1800
1578
  choiceNudgeOf,
1801
1579
  useChoiceNudge
1802
1580
  };
1803
- //# sourceMappingURL=chunk-KJAVVXRW.js.map
1581
+ //# sourceMappingURL=chunk-5RU7BPCU.js.map