@ai-matrx/records-ui 0.116.0 → 0.116.2

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 (51) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/dist/SaveToTable-3VDK4U5M.js +20 -0
  3. package/dist/chunk-32TUVT57.js +246 -0
  4. package/dist/chunk-32TUVT57.js.map +1 -0
  5. package/dist/chunk-B5S5F5NH.js +445 -0
  6. package/dist/chunk-B5S5F5NH.js.map +1 -0
  7. package/dist/chunk-IUUZVQZD.js +95 -0
  8. package/dist/chunk-IUUZVQZD.js.map +1 -0
  9. package/dist/{chunk-6NSGVKYL.js → chunk-NJYJEAQC.js} +1 -91
  10. package/dist/chunk-NJYJEAQC.js.map +1 -0
  11. package/dist/{chunk-4ZYGWYQP.js → chunk-QRZ4RW2T.js} +56 -31
  12. package/dist/chunk-QRZ4RW2T.js.map +1 -0
  13. package/dist/chunk-SPPATZSR.js +288 -0
  14. package/dist/chunk-SPPATZSR.js.map +1 -0
  15. package/dist/{chunk-7IZJT3DV.js → chunk-TCRNJVGZ.js} +93 -512
  16. package/dist/chunk-TCRNJVGZ.js.map +1 -0
  17. package/dist/{chunk-W5SOKJ5P.js → chunk-TNIC2SGW.js} +5 -3
  18. package/dist/{chunk-W5SOKJ5P.js.map → chunk-TNIC2SGW.js.map} +1 -1
  19. package/dist/{chunk-3OKHOGSO.js → chunk-VCAOXQ5K.js} +2 -283
  20. package/dist/chunk-VCAOXQ5K.js.map +1 -0
  21. package/dist/first-page.cjs.map +1 -1
  22. package/dist/first-page.js.map +1 -1
  23. package/dist/helpers.cjs +812 -8
  24. package/dist/helpers.cjs.map +1 -1
  25. package/dist/helpers.d.cts +441 -3
  26. package/dist/helpers.d.ts +441 -3
  27. package/dist/helpers.js +754 -10
  28. package/dist/helpers.js.map +1 -1
  29. package/dist/index.cjs +1634 -1581
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +156 -168
  32. package/dist/index.d.ts +156 -168
  33. package/dist/index.js +4286 -4477
  34. package/dist/index.js.map +1 -1
  35. package/dist/object-actions.js +3 -2
  36. package/dist/pickers.cjs +52 -13
  37. package/dist/pickers.cjs.map +1 -1
  38. package/dist/pickers.js +6 -3
  39. package/dist/skeleton.cjs +262 -0
  40. package/dist/skeleton.cjs.map +1 -0
  41. package/dist/skeleton.d.cts +50 -0
  42. package/dist/skeleton.d.ts +50 -0
  43. package/dist/skeleton.js +26 -0
  44. package/dist/skeleton.js.map +1 -0
  45. package/package.json +18 -7
  46. package/dist/SaveToTable-AG7ZY4IG.js +0 -18
  47. package/dist/chunk-3OKHOGSO.js.map +0 -1
  48. package/dist/chunk-4ZYGWYQP.js.map +0 -1
  49. package/dist/chunk-6NSGVKYL.js.map +0 -1
  50. package/dist/chunk-7IZJT3DV.js.map +0 -1
  51. /package/dist/{SaveToTable-AG7ZY4IG.js.map → SaveToTable-3VDK4U5M.js.map} +0 -0
@@ -0,0 +1,95 @@
1
+ "use client";
2
+
3
+ // src/rights.ts
4
+ import { atLeast } from "@ai-matrx/records/field-kinds";
5
+ var LEVEL_WORD = {
6
+ viewer: "Viewer",
7
+ commenter: "Commenter",
8
+ edit_content: "Content editor",
9
+ editor: "Editor",
10
+ admin: "Admin"
11
+ };
12
+ var NEEDS = {
13
+ read: "viewer",
14
+ // custom.io_comment_write
15
+ comment: "commenter",
16
+ // custom.record_update / custom.record_write — `edit_content` changes rows and page content;
17
+ // columns, views and settings (structure) stay with admin below, and sharing with admin.
18
+ write: "edit_content",
19
+ // custom.view_designate / view_declare / migrate_merge / record_restore — all ask `editor`: more than
20
+ // changing content (`edit_content`), less than changing columns (`admin`).
21
+ organise: "editor",
22
+ // custom.record_delete
23
+ remove: "editor",
24
+ // custom.share_grant — ONE-LADDER (2026-10-10): Edit may pass View / Comment / Edit on inside the
25
+ // organization (iam.may_grant_as, knobs access.sharing/*). Which levels, and to whom, is the share
26
+ // dialog's own question (iam.my_grantable_levels); the Share button only has to open for Edit.
27
+ share: "editor",
28
+ // custom.field_declare / field_update / field_retire / table settings
29
+ structure: "admin"
30
+ };
31
+ function levelNeededFor(what) {
32
+ return NEEDS[what];
33
+ }
34
+ var NOT_YET = "Still asking the store what you may do here. Nothing is offered until it has answered.";
35
+ var NOTHING_AT_ALL = "You have not been given this. Ask somebody who administers it to share it with you.";
36
+ function sentenceFor(what, level) {
37
+ if (level === null) return NOTHING_AT_ALL;
38
+ const need = LEVEL_WORD[NEEDS[what]];
39
+ const have = LEVEL_WORD[level];
40
+ const doing = {
41
+ read: "open this",
42
+ comment: "leave a comment",
43
+ write: "change anything here",
44
+ organise: "organise this",
45
+ remove: "delete this",
46
+ share: "pass this on to somebody else",
47
+ structure: "change the columns of this table"
48
+ };
49
+ return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
50
+ }
51
+ function whatYouMayDo(level, known = true) {
52
+ const may = (what) => known && atLeast(level, NEEDS[what]);
53
+ return {
54
+ level: known ? level : null,
55
+ known,
56
+ read: may("read"),
57
+ comment: may("comment"),
58
+ write: may("write"),
59
+ organise: may("organise"),
60
+ remove: may("remove"),
61
+ share: may("share"),
62
+ structure: may("structure"),
63
+ why: (what) => known ? sentenceFor(what, level) : NOT_YET
64
+ };
65
+ }
66
+ var NOT_ANSWERED_YET = whatYouMayDo(null, false);
67
+ var KERNEL_REASON = "This is one of the tables the platform ships, so its columns are not changed from a screen. Make your own table to change columns.";
68
+ function whatYouMayDoWithTable(table, level, known) {
69
+ const base = whatYouMayDo(level, known);
70
+ if (!table?.is_kernel) return table && tableIsLocked(table) ? lockedStructure(base) : base;
71
+ return {
72
+ ...base,
73
+ structure: false,
74
+ why: (what) => what === "structure" ? KERNEL_REASON : base.why(what)
75
+ };
76
+ }
77
+ function tableIsLocked(table) {
78
+ return table?.metadata?.["locked"] === true;
79
+ }
80
+ var DATABASE_LOCKED_REASON = "This database is locked, so its columns and settings are read-only. Unlock it to change them.";
81
+ function lockedStructure(base) {
82
+ return { ...base, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base.why(what) };
83
+ }
84
+
85
+ export {
86
+ LEVEL_WORD,
87
+ levelNeededFor,
88
+ whatYouMayDo,
89
+ NOT_ANSWERED_YET,
90
+ KERNEL_REASON,
91
+ whatYouMayDoWithTable,
92
+ tableIsLocked,
93
+ DATABASE_LOCKED_REASON
94
+ };
95
+ //# sourceMappingURL=chunk-IUUZVQZD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/rights.ts"],"sourcesContent":["// src/rights.ts — @ai-matrx/records-ui\n//\n// THE ONE PLACE A LEVEL BECOMES A SCREEN.\n//\n// WHAT A PERSON HIT (independent verdict, sixth pass, 19-20 September). A\n// colleague who had been shared a table at viewer opened it, double-clicked a\n// cell, got a live editor, typed a value and pressed Enter — and only THEN was\n// told she may not write. \"The permission is right; the screen told her she\n// could.\" Measured against Airtable, Notion and Linear the verdict called it\n// out by name: \"None of these three products lets you start an action it\n// already knows it will reject.\"\n//\n// WHY THE SCREEN COULD NOT KNOW. The rights question was a PORT with two honest\n// answers and no third: `NO_RIGHTS` (every administering control absent, which\n// is useless for a host whose authority IS the store's) and\n// `storeDecidesRights` — `{admin: true, comment: true, write: true}` for every\n// non-kernel table, for everybody. That second one is the defect, written down:\n// it is the screen ASSUMING the answer and letting the door say no afterwards.\n//\n// WHAT REPLACES IT. The store already answers this, and the client now carries\n// it: `custom.read_records` returns the reader's level on the TABLE on every\n// row (so `Table.your_level` costs nothing), and `custom.my_levels` — the door\n// this lane added — answers the caller's level on any subject they name, one\n// call for a whole page. This file is the only place in the package that turns\n// one of those four words into what a screen may DRAW.\n//\n// THE LADDER IS THE STORE'S, NOT OURS: viewer < commenter < editor < admin, and\n// which rung each door requires is read from the doors themselves —\n// `custom.record_update` asserts `editor` on the record, `custom.field_declare`\n// asserts `admin` on the TABLE (\"the SHAPE of this table, which is an admin's\n// right and not an editor's\"), `custom.io_comment_write` admits a commenter.\n// Nothing here invents a rule; it mirrors the four assertions those doors make\n// and is wrong the moment they change, which is what the suite is for.\n//\n// ABSENT OR HONEST, NEVER DEAD. Every `false` here carries the sentence that\n// says why and what to do about it, so a control can be left out AND explained.\n// A screen that hid a control with nothing to say is the silent half of the\n// same defect.\n\nimport { atLeast, type PermissionLevel } from \"@ai-matrx/records/field-kinds\";\nimport type { Table } from \"@ai-matrx/records\";\n\n/** The six things a person does to a record or a table, as the screens offer them. */\nexport type Capability = \"read\" | \"comment\" | \"write\" | \"organise\" | \"remove\" | \"share\" | \"structure\";\n\nexport interface WhatYouMayDo {\n /** The word the store answered, or null when it answered nothing. */\n level: PermissionLevel | null;\n /**\n * Whether the store has ANSWERED yet. `false` is a third state and not a\n * refusal: a screen that drew \"you may not\" while the answer was in flight\n * would blink every control off on every reload, which is its own lie.\n */\n known: boolean;\n read: boolean;\n comment: boolean;\n write: boolean;\n /** Duplicate, merge, restore, make a layout the default: the doors that ask `editor`, above content. */\n organise: boolean;\n remove: boolean;\n share: boolean;\n structure: boolean;\n /** Why this person may not do that, in one sentence naming the way in. */\n why: (what: Capability) => string;\n}\n\n/** What each rung of the ladder is called where a person reads it. */\nexport const LEVEL_WORD: Record<PermissionLevel, string> = {\n viewer: \"Viewer\",\n commenter: \"Commenter\",\n edit_content: \"Content editor\",\n editor: \"Editor\",\n admin: \"Admin\",\n};\n\n/**\n * WHICH RUNG EACH DOOR ASKS FOR. Read off the doors themselves, in one place,\n * so a screen never re-decides it and the suite has one thing to check.\n */\nconst NEEDS: Record<Capability, PermissionLevel> = {\n read: \"viewer\",\n // custom.io_comment_write\n comment: \"commenter\",\n // custom.record_update / custom.record_write — `edit_content` changes rows and page content;\n // columns, views and settings (structure) stay with admin below, and sharing with admin.\n write: \"edit_content\",\n // custom.view_designate / view_declare / migrate_merge / record_restore — all ask `editor`: more than\n // changing content (`edit_content`), less than changing columns (`admin`).\n organise: \"editor\",\n // custom.record_delete\n remove: \"editor\",\n // custom.share_grant — ONE-LADDER (2026-10-10): Edit may pass View / Comment / Edit on inside the\n // organization (iam.may_grant_as, knobs access.sharing/*). Which levels, and to whom, is the share\n // dialog's own question (iam.my_grantable_levels); the Share button only has to open for Edit.\n share: \"editor\",\n // custom.field_declare / field_update / field_retire / table settings\n structure: \"admin\",\n};\n\n/** The rung a capability asks for — so a short \"Needs Admin access\" never re-decides the ladder. */\nexport function levelNeededFor(what: Capability): PermissionLevel {\n return NEEDS[what];\n}\n\nconst NOT_YET =\n \"Still asking the store what you may do here. Nothing is offered until it has answered.\";\n\nconst NOTHING_AT_ALL =\n \"You have not been given this. Ask somebody who administers it to share it with you.\";\n\n/** The sentence for one refusal: what the level is, what it would have to be. */\nfunction sentenceFor(what: Capability, level: PermissionLevel | null): string {\n if (level === null) return NOTHING_AT_ALL;\n const need = LEVEL_WORD[NEEDS[what]];\n const have = LEVEL_WORD[level];\n const doing: Record<Capability, string> = {\n read: \"open this\",\n comment: \"leave a comment\",\n write: \"change anything here\",\n organise: \"organise this\",\n remove: \"delete this\",\n share: \"pass this on to somebody else\",\n structure: \"change the columns of this table\",\n };\n return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;\n}\n\n/**\n * WHAT ONE LEVEL LETS A PERSON DO. `level` null and `known` true means the\n * store said \"nothing\" — a real answer. `known` false means it has not said.\n */\nexport function whatYouMayDo(level: PermissionLevel | null, known = true): WhatYouMayDo {\n const may = (what: Capability) => known && atLeast(level, NEEDS[what]);\n return {\n level: known ? level : null,\n known,\n read: may(\"read\"),\n comment: may(\"comment\"),\n write: may(\"write\"),\n organise: may(\"organise\"),\n remove: may(\"remove\"),\n share: may(\"share\"),\n structure: may(\"structure\"),\n why: (what) => (known ? sentenceFor(what, level) : NOT_YET),\n };\n}\n\n/** Nothing offered, because nothing is known yet. */\nexport const NOT_ANSWERED_YET: WhatYouMayDo = whatYouMayDo(null, false);\n\n/**\n * REC-27. The nine Tables the platform ships are not administered from a\n * person's screen whatever level they hold on them — so the structure controls\n * are absent for a kernel Table and say why, and everything else follows the\n * level as usual.\n */\nexport const KERNEL_REASON =\n \"This is one of the tables the platform ships, so its columns are not changed from a screen. \" +\n \"Make your own table to change columns.\";\n\nexport function whatYouMayDoWithTable(\n table: Table | null | undefined,\n level: PermissionLevel | null,\n known: boolean,\n): WhatYouMayDo {\n const base = whatYouMayDo(level, known);\n // A LOCKED DATABASE (lane NOTION-SMALL-2): the columns and the table's settings stay as they are until\n // somebody unlocks it. An editing convenience, never a permission — the lock changes what is OFFERED, the\n // store's ladder is untouched and anyone who may edit the table may unlock it.\n if (!table?.is_kernel) return table && tableIsLocked(table) ? lockedStructure(base) : base;\n return {\n ...base,\n structure: false,\n why: (what) => (what === \"structure\" ? KERNEL_REASON : base.why(what)),\n };\n}\n\n/** Is this table locked against column and settings changes? Kept on the table's own metadata. */\nexport function tableIsLocked(table: Pick<Table, \"metadata\"> | null | undefined): boolean {\n return table?.metadata?.[\"locked\"] === true;\n}\n\nexport const DATABASE_LOCKED_REASON = \"This database is locked, so its columns and settings are read-only. Unlock it to change them.\";\n\nfunction lockedStructure(base: WhatYouMayDo): WhatYouMayDo {\n return { ...base, structure: false, why: (what) => (what === \"structure\" ? DATABASE_LOCKED_REASON : base.why(what)) };\n}\n"],"mappings":";;;AAuCA,SAAS,eAAqC;AA4BvC,IAAM,aAA8C;AAAA,EACzD,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,OAAO;AACT;AAMA,IAAM,QAA6C;AAAA,EACjD,MAAM;AAAA;AAAA,EAEN,SAAS;AAAA;AAAA;AAAA,EAGT,OAAO;AAAA;AAAA;AAAA,EAGP,UAAU;AAAA;AAAA,EAEV,QAAQ;AAAA;AAAA;AAAA;AAAA,EAIR,OAAO;AAAA;AAAA,EAEP,WAAW;AACb;AAGO,SAAS,eAAe,MAAmC;AAChE,SAAO,MAAM,IAAI;AACnB;AAEA,IAAM,UACJ;AAEF,IAAM,iBACJ;AAGF,SAAS,Y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AAS,gBAAgB,MAAkC;AACzD,SAAO,EAAE,GAAG,MAAM,WAAW,OAAO,KAAK,CAAC,SAAU,SAAS,cAAc,yBAAyB,KAAK,IAAI,IAAI,EAAG;AACtH;","names":[]}
@@ -1,87 +1,5 @@
1
1
  "use client";
2
2
 
3
- // src/rights.ts
4
- import { atLeast } from "@ai-matrx/records/field-kinds";
5
- var LEVEL_WORD = {
6
- viewer: "Viewer",
7
- commenter: "Commenter",
8
- edit_content: "Content editor",
9
- editor: "Editor",
10
- admin: "Admin"
11
- };
12
- var NEEDS = {
13
- read: "viewer",
14
- // custom.io_comment_write
15
- comment: "commenter",
16
- // custom.record_update / custom.record_write — `edit_content` changes rows and page content;
17
- // columns, views and settings (structure) stay with admin below, and sharing with admin.
18
- write: "edit_content",
19
- // custom.view_designate / view_declare / migrate_merge / record_restore — all ask `editor`: more than
20
- // changing content (`edit_content`), less than changing columns (`admin`).
21
- organise: "editor",
22
- // custom.record_delete
23
- remove: "editor",
24
- // custom.share_grant — ONE-LADDER (2026-10-10): Edit may pass View / Comment / Edit on inside the
25
- // organization (iam.may_grant_as, knobs access.sharing/*). Which levels, and to whom, is the share
26
- // dialog's own question (iam.my_grantable_levels); the Share button only has to open for Edit.
27
- share: "editor",
28
- // custom.field_declare / field_update / field_retire / table settings
29
- structure: "admin"
30
- };
31
- function levelNeededFor(what) {
32
- return NEEDS[what];
33
- }
34
- var NOT_YET = "Still asking the store what you may do here. Nothing is offered until it has answered.";
35
- var NOTHING_AT_ALL = "You have not been given this. Ask somebody who administers it to share it with you.";
36
- function sentenceFor(what, level) {
37
- if (level === null) return NOTHING_AT_ALL;
38
- const need = LEVEL_WORD[NEEDS[what]];
39
- const have = LEVEL_WORD[level];
40
- const doing = {
41
- read: "open this",
42
- comment: "leave a comment",
43
- write: "change anything here",
44
- organise: "organise this",
45
- remove: "delete this",
46
- share: "pass this on to somebody else",
47
- structure: "change the columns of this table"
48
- };
49
- return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
50
- }
51
- function whatYouMayDo(level, known = true) {
52
- const may = (what) => known && atLeast(level, NEEDS[what]);
53
- return {
54
- level: known ? level : null,
55
- known,
56
- read: may("read"),
57
- comment: may("comment"),
58
- write: may("write"),
59
- organise: may("organise"),
60
- remove: may("remove"),
61
- share: may("share"),
62
- structure: may("structure"),
63
- why: (what) => known ? sentenceFor(what, level) : NOT_YET
64
- };
65
- }
66
- var NOT_ANSWERED_YET = whatYouMayDo(null, false);
67
- var KERNEL_REASON = "This is one of the tables the platform ships, so its columns are not changed from a screen. Make your own table to change columns.";
68
- function whatYouMayDoWithTable(table, level, known) {
69
- const base = whatYouMayDo(level, known);
70
- if (!table?.is_kernel) return table && tableIsLocked(table) ? lockedStructure(base) : base;
71
- return {
72
- ...base,
73
- structure: false,
74
- why: (what) => what === "structure" ? KERNEL_REASON : base.why(what)
75
- };
76
- }
77
- function tableIsLocked(table) {
78
- return table?.metadata?.["locked"] === true;
79
- }
80
- var DATABASE_LOCKED_REASON = "This database is locked, so its columns and settings are read-only. Unlock it to change them.";
81
- function lockedStructure(base) {
82
- return { ...base, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base.why(what) };
83
- }
84
-
85
3
  // src/fieldTypes.ts
86
4
  import { DECLARABLE_FIELD_KINDS, NEWER_FIELD_KINDS, PARITY_FIELD_TYPES } from "@ai-matrx/records/field-kinds";
87
5
  var LOOK_KINDS = {
@@ -176,14 +94,6 @@ var ADD_FIELD_SAVE_LABEL = "Create column";
176
94
  var EDIT_FIELD_SAVE_LABEL = "Save column";
177
95
 
178
96
  export {
179
- LEVEL_WORD,
180
- levelNeededFor,
181
- whatYouMayDo,
182
- NOT_ANSWERED_YET,
183
- KERNEL_REASON,
184
- whatYouMayDoWithTable,
185
- tableIsLocked,
186
- DATABASE_LOCKED_REASON,
187
97
  LOOK_KINDS,
188
98
  declaredAsLook,
189
99
  storePublishesKind,
@@ -201,4 +111,4 @@ export {
201
111
  ADD_FIELD_SAVE_LABEL,
202
112
  EDIT_FIELD_SAVE_LABEL
203
113
  };
204
- //# sourceMappingURL=chunk-6NSGVKYL.js.map
114
+ //# sourceMappingURL=chunk-NJYJEAQC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/fieldTypes.ts"],"sourcesContent":["// src/fieldTypes.ts — @ai-matrx/records-ui\n//\n// EVERY KIND OF COLUMN THE STORE TAKES, IN THE WORDS A PERSON USES.\n//\n// The store publishes fourteen parity types and, for each, a sentence about what\n// it is MADE OF — \"REC-31: a File record reached through a relation, target the\n// kernel `File` Table\", \"FLD-9: a declared computation, on read or on write,\n// evaluated by custom.rule_eval\", \"config.via names the relation field,\n// config.pick the Value on the far side\". Those sentences are true and they are\n// for us. The 19 September verdict found them printed at the person choosing a\n// column type, alongside contract row ids, and called it what it is: machine\n// identity where a person is looking.\n//\n// So this file holds the OTHER sentence — what the type is FOR — and the field\n// panel shows that one. The store's own `made_of` stays where it belongs, in\n// `PARITY_MADE_OF`, for an engineer reading the package.\n//\n// The LIST itself is still the store's: `PARITY_FIELD_TYPES` is generated from\n// `custom.parity_field_types()`, and `assertEveryParityTypeIsExplained` (run by\n// the suite) fails the moment the store ships a fourteenth and nobody wrote a\n// sentence for it. A type with no explanation would otherwise appear with a\n// blank line under it, which is the silent version of the same defect. It caught the\n// fourteenth — `checkbox`, 2026-09-21 — exactly as it was written to.\n\nimport { DECLARABLE_FIELD_KINDS, NEWER_FIELD_KINDS, PARITY_FIELD_TYPES, type DeclarableFieldKind, type NewerFieldKind, type ParityFieldType } from \"@ai-matrx/records/field-kinds\";\n\n/** The three behaviours that carry no parity type of their own. */\nexport type PlainFieldType = \"text\" | \"long_text\" | \"number\";\n\n/**\n * THE ONE A PERSON COMING FROM AIRTABLE REACHES FOR FIRST, AND IT WAS NOT HERE.\n *\n * The list above offered `member` (a Person) and `attachment` (a File) — the two\n * relations whose target is a Table the PLATFORM keeps — and nothing at all for\n * \"this job belongs to that customer\". The store has taken it since 2026-09-20\n * (`custom.field_declare` with `type: \"relation\"` and a `relation_target`), the\n * Field type has named it since the same day, and `editorKindFor` has answered\n * `\"relation\"` for one since long before that. Only the menu did not offer it,\n * so the guide's section 3 told a person to pick a kind that did not exist.\n *\n * It is NOT a parity type of its own. `custom.parity_field_types()` ships\n * fourteen (the fourteenth is `checkbox`) and a relation is a BEHAVIOUR — the same behaviour `member` and\n * `attachment` are made of — so it sits beside the three plain ones as its own\n * word, and `parityTypesWithNoExplanation()` is unaffected by it in both\n * directions: it does not appear there, and it cannot hide a real gap there.\n */\nexport type RelationFieldType = \"relation\";\n\n/**\n * What a person picks in the panel — AND IT IS THE STORE'S OWN LIST, not a union\n * assembled here.\n *\n * 🚨 THE CLASS FIX (FIX-10B-F6, VERIFIER-10). This used to read\n * `ParityFieldType | PlainFieldType | RelationFieldType` — the parity floor plus two words\n * this file knew about — and that union was the whole defect. `custom.doc_sign` accepts\n * exactly one field, a text column whose format is `signature`, and it is granted to\n * `authenticated`; the Documents screen told a person in so many words to go and declare\n * one; and no list any screen could read named it, so the control did not exist and the\n * e-sign half of Documents was unreachable from the product. A kind the store takes and no\n * screen offers is invisible, and nothing failed — which is the only reason it survived.\n *\n * `custom.field_kinds()` is now the ONE registry and `DECLARABLE_FIELD_KINDS` is generated\n * from it, so the next kind the store learns arrives here as a TYPE ERROR in\n * `FIELD_TYPE_CHOICES`'s coverage and as a red `kindsWithNoChoice()` below — never as a\n * silence.\n */\nexport type PickableFieldType = DeclarableFieldKind | SystemFieldKind | \"entity_reference\" | NewerFieldKind | LookFieldKind;\n\n/**\n * A KIND THAT IS A PLAIN COLUMN WEARING A LOOK (grids review 3, lane H item 5). The store keeps a\n * column's \"Shows as\" on the Field (`display_format`, `custom.display_format_ids()` has `rating` and\n * `time`), so a Rating is a whole number shown as stars and a Time is a time of day kept as its\n * 24-hour text — declared through the ordinary door (`{ plain, display_format }`) the same way the\n * \"Shows as\" picker makes one. Offered whenever the store does not yet publish the kind as its own\n * word (`custom.field_kinds()`): a Rating the store publishes goes as `{ type: \"rating\", max }`.\n */\nexport type LookFieldKind = \"time\";\n\nexport interface LookKind {\n plain: \"number\" | \"text\";\n look: (args: { ratingMax: number }) => { id: string; options?: Record<string, unknown> };\n}\n\nexport const LOOK_KINDS: Partial<Record<PickableFieldType, LookKind>> = {\n rating: { plain: \"number\", look: ({ ratingMax }) => ({ id: \"rating\", options: { ratingMax } }) },\n time: { plain: \"text\", look: () => ({ id: \"time\" }) },\n};\n\n/** Is this kind declared as a plain column wearing a look (because the store does not publish it)? */\nexport function declaredAsLook(kind: string): boolean {\n return kind in LOOK_KINDS && !storePublishesKind(kind);\n}\n\n/**\n * LANE 10 P4: THE NINE NEWER KINDS (rating, duration, created by, last changed by, status, address,\n * barcode, formatted text, count). Each is listed in `FIELD_TYPE_CATALOGUE` below, so every reader\n * (Settings, the column panel, every layout) names a column of one by its own word; the MENU offers\n * one only once `custom.field_kinds()` publishes it (after the chair's apply and\n * `pnpm records:generate`), so a person is never offered a kind the live store would refuse.\n */\nexport function storePublishesKind(kind: string): boolean {\n return DECLARABLE_FIELD_KINDS.some((row) => (row.kind as string) === kind);\n}\n\n/**\n * LANE SC-R: a column that points at a PLATFORM thing (a note, a web site, an agent). Its menu entry\n * is drawn only once `custom.field_kinds()` publishes `entity_reference` (after the chair's apply\n * and `pnpm records:generate`), so the menu never offers a kind the live store would refuse.\n */\nexport const STORE_PUBLISHES_ENTITY_REFERENCE = DECLARABLE_FIELD_KINDS.some(\n (row) => (row.kind as string) === \"entity_reference\",\n);\n\n/**\n * THE STORE'S OWN STAMPS AS COLUMNS (GRID-PRIMITIVES G5; TABLE-PARITY H2 H3, lane\n * DEFAULT-GRID-PARITY). `custom.field_declare` takes these three WORDS and makes each a formula\n * Field whose expression is the system node (`fx.autonumber`, `fx.created_time`,\n * `fx.modified_time`, `config.system` naming which), so nobody types into them and every reader\n * that serves a worked-out value serves them. `custom.field_kinds()` does not publish them,\n * because each is a formula, not a behaviour of its own. So they are named here, sent as their\n * word through the `{ type }` arm, and a new autonumber column numbers the records already in\n * the table through `custom.autonumber_backfill`.\n */\nexport type SystemFieldKind = \"autonumber\" | \"created_time\" | \"modified_time\";\n\nexport const SYSTEM_FIELD_KINDS: readonly SystemFieldKind[] = [\"autonumber\", \"created_time\", \"modified_time\"];\n\nexport function isSystemFieldKind(id: string): id is SystemFieldKind {\n return (SYSTEM_FIELD_KINDS as readonly string[]).includes(id);\n}\n\nexport interface FieldTypeChoice {\n id: PickableFieldType;\n /** The word on the menu. */\n label: string;\n /** One line, under the word, saying what it is FOR. Never what it is made of. */\n explanation: string;\n /** The heading it sits under, so seventeen choices read as four short lists. */\n group: \"Words\" | \"Numbers and dates\" | \"Choices and people\" | \"Worked out\";\n}\n\n/**\n * EVERY KIND THIS PACKAGE CAN NAME AND DRAW, in menu order. The menu (`FIELD_TYPE_CHOICES`) is this\n * list less the kinds the live store does not take yet; every reader names a column from this one.\n */\nexport const FIELD_TYPE_CATALOGUE: FieldTypeChoice[] = [\n { id: \"text\", group: \"Words\", label: \"Text\", explanation: \"A short line of writing — a name, a reference, a title.\" },\n { id: \"long_text\", group: \"Words\", label: \"Long text\", explanation: \"Several lines — a description, notes, an address.\" },\n { id: \"rich_text\", group: \"Words\", label: \"Formatted text\", explanation: \"Notes with bold, lists and links.\" },\n { id: \"email\", group: \"Words\", label: \"Email address\", explanation: \"An email address, checked as you type and ready to write to.\" },\n { id: \"phone\", group: \"Words\", label: \"Phone number\", explanation: \"A phone number, checked as you type.\" },\n { id: \"url\", group: \"Words\", label: \"Link\", explanation: \"A web address that opens in a new tab when you click it.\" },\n { id: \"address\", group: \"Words\", label: \"Address\", explanation: \"A street address in parts, opened in maps.\" },\n { id: \"barcode\", group: \"Words\", label: \"Barcode\", explanation: \"A code a scanner reads, like a wristband or a box.\" },\n { id: \"button\", group: \"Words\", label: \"Button\", explanation: \"A button on each record that opens a link or runs an action.\" },\n\n { id: \"number\", group: \"Numbers and dates\", label: \"Number\", explanation: \"A plain number you can total up and sort by.\" },\n { id: \"currency\", group: \"Numbers and dates\", label: \"Money\", explanation: \"An amount of money, shown with its currency wherever it appears.\" },\n { id: \"percent\", group: \"Numbers and dates\", label: \"Percentage\", explanation: \"A number out of a hundred, kept between 0 and 100.\" },\n { id: \"rating\", group: \"Numbers and dates\", label: \"Rating\", explanation: \"A score in stars, set with one click.\" },\n { id: \"duration\", group: \"Numbers and dates\", label: \"Duration\", explanation: \"A length of time, typed as 45 min or 1:30.\" },\n { id: \"time\", group: \"Numbers and dates\", label: \"Time\", explanation: \"A time of day with no date — a shift start, opening hours.\" },\n { id: \"datetime\", group: \"Numbers and dates\", label: \"Date\", explanation: \"A day, or a day and a time. Dates are what the calendar view reads.\" },\n\n { id: \"select\", group: \"Choices and people\", label: \"Choice\", explanation: \"One answer from a list you write here. Choices are what the board view groups by.\" },\n { id: \"multi_select\", group: \"Choices and people\", label: \"Several choices\", explanation: \"Any number of answers from a list you write here.\" },\n { id: \"status\", group: \"Choices and people\", label: \"Status\", explanation: \"Choices grouped into To do, In progress and Done.\" },\n { id: \"checkbox\", group: \"Choices and people\", label: \"Yes / no\", explanation: \"A box you tick. Left alone it stays unanswered, which is not the same as a no.\" },\n { id: \"member\", group: \"Choices and people\", label: \"Person\", explanation: \"Somebody in this organization, picked from the people who are in it.\" },\n { id: \"attachment\", group: \"Choices and people\", label: \"File\", explanation: \"A file or a picture kept with the record.\" },\n { id: \"signature\", group: \"Choices and people\", label: \"Signature\", explanation: \"Somebody's sign-off on a document made from this record. Nobody types in it — it fills in when they sign.\" },\n { id: \"relation\", group: \"Choices and people\", label: \"Points at another record\", explanation: \"A link to records in another of your tables — the customer a job is for, the lines on an invoice.\" },\n {\n id: \"entity_reference\",\n group: \"Choices and people\",\n label: \"Points at something else on the platform\",\n explanation: \"A note, a web site, an agent, a workbook — anything you keep here that is not one of your tables.\",\n },\n\n { id: \"lookup\", group: \"Worked out\", label: \"Borrowed value\", explanation: \"A value read from a record this one points at, kept in step with it.\" },\n { id: \"rollup\", group: \"Worked out\", label: \"Total of linked records\", explanation: \"A count or a total worked out from the records this one points at.\" },\n { id: \"count\", group: \"Worked out\", label: \"Count of linked records\", explanation: \"How many records this one points at.\" },\n { id: \"formula\", group: \"Worked out\", label: \"Worked out from other columns\", explanation: \"A value this record works out for itself from its own other columns.\" },\n { id: \"autonumber\", group: \"Worked out\", label: \"Record number\", explanation: \"A number the table gives each record, one after another, never reused. Records already here are numbered in the order they were made.\" },\n { id: \"created_time\", group: \"Worked out\", label: \"Created time\", explanation: \"When each record was made. Nobody types it.\" },\n { id: \"modified_time\", group: \"Worked out\", label: \"Last changed time\", explanation: \"When each record last changed. Nobody types it.\" },\n { id: \"created_by\", group: \"Worked out\", label: \"Created by\", explanation: \"Who made each record. Nobody types it.\" },\n { id: \"modified_by\", group: \"Worked out\", label: \"Last changed by\", explanation: \"Who last changed each record. Nobody types it.\" },\n];\n\n/** The kinds the menu offers only once the live store publishes them. */\nconst GATED_KINDS = new Set<string>([\"entity_reference\", ...NEWER_FIELD_KINDS]);\n\nexport const FIELD_TYPE_CHOICES: FieldTypeChoice[] = FIELD_TYPE_CATALOGUE.filter(\n (c) => !GATED_KINDS.has(c.id) || storePublishesKind(c.id) || c.id in LOOK_KINDS,\n);\n\nexport const FIELD_TYPE_GROUPS: FieldTypeChoice[\"group\"][] = [\n \"Words\",\n \"Numbers and dates\",\n \"Choices and people\",\n \"Worked out\",\n];\n\nconst BY_ID = new Map<string, FieldTypeChoice>(FIELD_TYPE_CATALOGUE.map((c) => [c.id, c]));\n\nexport function fieldTypeChoice(id: string): FieldTypeChoice | undefined {\n return BY_ID.get(id);\n}\n\n/** The three that are a plain behaviour rather than one of the fourteen. */\nexport function isPlainFieldType(id: string): id is PlainFieldType {\n return id === \"text\" || id === \"long_text\" || id === \"number\";\n}\n\n/**\n * The one that is a relation a person aims themselves. It is neither plain nor\n * one of the thirteen, so every caller that branched on `isPlainFieldType`\n * alone has to answer this question too — which is why it is a named function\n * and not an inline string comparison at four call sites.\n */\nexport function isRelationFieldType(id: string): id is RelationFieldType {\n return id === \"relation\";\n}\n\n/**\n * One of FLD-11's fourteen, which is what `parity_type` on a declaration means.\n *\n * Read from the store's own generated floor, never from a list here — because a kind that\n * is NOT one of the fourteen (plain text, a person-aimed relation, a signature) has to be\n * declared by its WORD (`type`) and a panel that sent `parity_type` for it would be refused\n * \"There is no field type called …\". That is the shape of the F6 defect: the panel's `save`\n * had exactly two branches, relation and plain, and everything else fell into `parity_type`.\n */\nexport function isParityFieldType(id: string): id is ParityFieldType {\n return PARITY_FIELD_TYPES.some((row) => row.parity_type === id);\n}\n\n/**\n * THE GUARD THIS FILE NEEDS, because the list it explains is generated.\n *\n * Returns the parity types the store ships that nothing here explains. The\n * suite asserts it is empty; a fourteenth type would otherwise reach the menu\n * with a blank line under it and nobody would notice until a person did.\n *\n * `relation` is deliberately NOT one of the thirteen and therefore never\n * appears in this answer: `PARITY_FIELD_TYPES` is the store's own generated\n * list and a behaviour that carries no parity type is not in it.\n */\nexport function parityTypesWithNoExplanation(): string[] {\n return PARITY_FIELD_TYPES.map((row) => row.parity_type).filter((type) => !BY_ID.has(type));\n}\n\n/**\n * 🚨 THE GUARD THAT CLOSES THE CLASS (FIX-10B-F6).\n *\n * `parityTypesWithNoExplanation()` above watches the parity FLOOR, and the floor was never\n * the whole list: the store also declares plain text, long text, number, a person-aimed\n * relation and a signature, and for months nothing anywhere compared the panel's menu with\n * THAT. So `signature` — the one field `custom.doc_sign` accepts, on a door granted to\n * every signed-in person, named to the person by the Documents screen itself — was absent\n * from the menu and every check stayed green.\n *\n * This returns the kinds `custom.field_kinds()` publishes that this panel does not offer.\n * The suite asserts it is empty, so a kind the store learns tomorrow either reaches the\n * person or turns a test red the same day. It is the class, not the instance: it would have\n * caught `signature`, and it will catch the twentieth kind nobody has thought of yet.\n */\nexport function kindsWithNoChoice(): string[] {\n return DECLARABLE_FIELD_KINDS.map((row) => row.kind).filter((kind) => !BY_ID.has(kind));\n}\n\n// ───────────────────────────────────────────────────────────────────────────\n// THE WORDS ON THE TWO BUTTONS, IN ONE PLACE — because they used to be the SAME\n// WORDS in two places, and that cost somebody their column.\n//\n// 🚨 THE DEFECT (TAILS-5, 2026-09-21, measured while driving the panel headless\n// on Rincon Plumbing's Summerland branch). The Jobs toolbar's control that OPENS\n// the field panel read exactly \"Add field\", and the panel's own SAVE button read\n// exactly \"Add field\" too — `FieldEditor` says \"Save field\" only when EDITING an\n// existing column, so on the create path the two were character-identical. The\n// toolbar control is a TOGGLE: pressing it while the panel is open closes the\n// panel and throws away everything typed into it. So a person who typed a column\n// name, chose a type, picked the target table and its display columns, then\n// looked up at the words they were told to press, could lose all of it — with no\n// sentence, no request sent, and nothing to say it had happened. A walk written\n// by an agent lost the column twice that way and spent a round diagnosing the\n// store before reading the two labels side by side.\n//\n// WHY THEY LIVE HERE AND NOT IN `@ai-matrx/design-system`. The words are RECORDS\n// vocabulary — \"field\", \"column\" — and the design system knows nothing about\n// either; a labels module there would be a domain word in a generic package, and\n// the next person adding a button would not find it. This file is already the\n// one place that owns what a person READS about a column (`FIELD_TYPE_CHOICES`\n// is right above), and both surfaces that draw these buttons are in this\n// package. One module, one import each, and `fieldTypes.test.ts` asserts the two\n// can never be the same string again.\n//\n// THE RULE: the control that OPENS a panel and the control that COMMITS it never\n// read the same words. The opener is an invitation; the committer says what it\n// will make.\n\n/** The toolbar control that OPENS the add-a-column panel. An invitation. */\nexport const ADD_FIELD_OPEN_LABEL = \"Add column\";\n\n/** The panel's own primary, on the CREATE path. It says what pressing it makes. */\nexport const ADD_FIELD_SAVE_LABEL = \"Create column\";\n\n/** The panel's own primary when an existing column is being changed. */\nexport const EDIT_FIELD_SAVE_LABEL = \"Save column\";\n"],"mappings":";;;AAwBA,SAAS,wBAAwB,mBAAmB,0BAA+F;AA2D5I,IAAM,aAA2D;AAAA,EACtE,QAAQ,EAAE,OAAO,UAAU,MAAM,CAAC,EAAE,UAAU,OAAO,EAAE,IAAI,UAAU,SAAS,EAAE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MAAM,IAAI,IAAI,CAAC;AAC3F;AAiBO,SAAS,oBAA8B;AAC5C,SAAO,uBAAuB,IAAI,CAAC,QAAQ,IAAI,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC;AACxF;AAiCO,IAAM,uBAAuB;AAG7B,IAAM,uBAAuB;AAG7B,IAAM,wBAAwB;","names":[]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  toDropdownEntries
4
- } from "./chunk-W5SOKJ5P.js";
4
+ } from "./chunk-TNIC2SGW.js";
5
5
  import {
6
6
  BOOKING_PAGE_STATE_LABEL,
7
7
  FilePicker,
@@ -9,14 +9,9 @@ import {
9
9
  RefusalLine,
10
10
  RefusalNotice,
11
11
  addFields,
12
- calendarDayOf,
13
12
  declareTable,
14
- editorKindFor,
15
13
  fieldName,
16
- fieldTypeLabel,
17
- hasTimePart,
18
14
  hintForAPerson,
19
- isDateField,
20
15
  realPlural,
21
16
  recordName,
22
17
  recordVersions_exports,
@@ -29,7 +24,7 @@ import {
29
24
  useChoiceNudge,
30
25
  useRecordsUi,
31
26
  useTableRights
32
- } from "./chunk-3OKHOGSO.js";
27
+ } from "./chunk-VCAOXQ5K.js";
33
28
  import {
34
29
  guessColumn,
35
30
  readTableShapes,
@@ -37,9 +32,16 @@ import {
37
32
  shapeOfValue,
38
33
  uniqueLabels
39
34
  } from "./chunk-TIZHA6VK.js";
35
+ import {
36
+ calendarDayOf,
37
+ editorKindFor,
38
+ fieldTypeLabel,
39
+ hasTimePart,
40
+ isDateField
41
+ } from "./chunk-SPPATZSR.js";
40
42
  import {
41
43
  fieldTypeChoice
42
- } from "./chunk-6NSGVKYL.js";
44
+ } from "./chunk-NJYJEAQC.js";
43
45
  import {
44
46
  __reExport
45
47
  } from "./chunk-HKYEHBQT.js";
@@ -94,6 +96,16 @@ async function findUnfinishedTable(client, wantedName, wantedKeys, wantedRows, n
94
96
  }
95
97
  return null;
96
98
  }
99
+ function choiceWordsOwed(existing, wanted) {
100
+ const idOf = new Map(existing.map((f) => [f.key, f.id]));
101
+ const owed = [];
102
+ for (const f of wanted) {
103
+ const fieldId = idOf.get(f.key);
104
+ const words = [...new Set((f.options ?? []).map((w) => w.trim()).filter(Boolean))];
105
+ if (f.type === "select" && fieldId && words.length > 0) owed.push({ fieldId, words });
106
+ }
107
+ return owed;
108
+ }
97
109
 
98
110
  // src/ImportWizard.tsx
99
111
  import { useCallback, useEffect, useMemo, useState } from "react";
@@ -4080,6 +4092,28 @@ function SharedNameAddress({
4080
4092
  return address ? /* @__PURE__ */ jsx10("span", { className: "ml-1.5 font-normal text-muted-foreground", "data-where-it-lives-address": "", children: address }) : null;
4081
4093
  }
4082
4094
 
4095
+ // src/tableLanes.ts
4096
+ var PLATFORM_TABLE_PREFIX = "records_ui_";
4097
+ function platformOwned(table) {
4098
+ const t = table;
4099
+ return t.platform_owned === true || t.kept_by_the_app === true;
4100
+ }
4101
+ function laneFor(table) {
4102
+ if (table.is_kernel) return "system";
4103
+ if ((table.slug ?? "").startsWith(PLATFORM_TABLE_PREFIX) || platformOwned(table)) return "app";
4104
+ if (publishedToWeb(table)) return "community";
4105
+ if (shownToOnlyMe(table)) return "mine";
4106
+ return "organization";
4107
+ }
4108
+ function publishedToWeb(table) {
4109
+ if (typeof table.published_to_web === "boolean") return table.published_to_web;
4110
+ return table.visibility === "public" || table.visibility === "link";
4111
+ }
4112
+ function shownToOnlyMe(table) {
4113
+ if (table.shown_to !== void 0) return table.shown_to === "only_me";
4114
+ return table.visibility === "personal";
4115
+ }
4116
+
4083
4117
  // src/TablesHome.tsx
4084
4118
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
4085
4119
  var TABLE_LANES = ["mine", "organization", "system", "community", "app"];
@@ -4090,7 +4124,6 @@ var LANE_TITLE = {
4090
4124
  community: "Published to the web",
4091
4125
  app: "Platform tables"
4092
4126
  };
4093
- var PLATFORM_TABLE_PREFIX = "records_ui_";
4094
4127
  var LANE_EMPTY = {
4095
4128
  // 🚨 BOTH SENTENCES USED TO DESCRIBE A PRODUCT THAT DOES NOT EXIST
4096
4129
  // (VERIFIER-15 M2, VERIFIER-16 M6). "New table makes one that only you can
@@ -4105,30 +4138,11 @@ var LANE_EMPTY = {
4105
4138
  community: "Nothing published to the web.",
4106
4139
  app: "No platform tables yet."
4107
4140
  };
4108
- function platformOwned(table) {
4109
- const t = table;
4110
- return t.platform_owned === true || t.kept_by_the_app === true;
4111
- }
4112
4141
  function keeperSays(table) {
4113
4142
  const said = table.keeper_says;
4114
4143
  return typeof said === "string" && said.trim() ? said : null;
4115
4144
  }
4116
4145
  var SECTIONS_UNKNOWN = "Who can see each table, and which you made, could not be read from the store, so every table is listed under Everyone and Only me is empty. That is not their real sharing.";
4117
- function laneFor(table) {
4118
- if (table.is_kernel) return "system";
4119
- if ((table.slug ?? "").startsWith(PLATFORM_TABLE_PREFIX) || platformOwned(table)) return "app";
4120
- if (publishedToWeb(table)) return "community";
4121
- if (shownToOnlyMe(table)) return "mine";
4122
- return "organization";
4123
- }
4124
- function publishedToWeb(table) {
4125
- if (typeof table.published_to_web === "boolean") return table.published_to_web;
4126
- return table.visibility === "public" || table.visibility === "link";
4127
- }
4128
- function shownToOnlyMe(table) {
4129
- if (table.shown_to !== void 0) return table.shown_to === "only_me";
4130
- return table.visibility === "personal";
4131
- }
4132
4146
  var VISIBILITY_LANES = ["mine", "organization", "community", "world"];
4133
4147
  var VISIBILITY_LANE_TITLE = {
4134
4148
  mine: "Only me",
@@ -4461,6 +4475,17 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
4461
4475
  setPhase("ready");
4462
4476
  return;
4463
4477
  }
4478
+ const present = await client.fields({ table_id: newId });
4479
+ if (present.ok) {
4480
+ for (const owed of choiceWordsOwed(present.data, fields)) {
4481
+ const topped = await client.fieldUpdate({ field_id: owed.fieldId, patch: { options_add: owed.words } });
4482
+ if (!topped.ok) {
4483
+ setProblem(topped.error);
4484
+ setPhase("ready");
4485
+ return;
4486
+ }
4487
+ }
4488
+ }
4464
4489
  } else {
4465
4490
  tableName2 = freeName(name ?? proposedName, (tables.data ?? []).map((t) => t.name));
4466
4491
  const born = await declareTable(client, { name: tableName2, fields });
@@ -4822,12 +4847,12 @@ export {
4822
4847
  BookingSlots,
4823
4848
  nextInWords,
4824
4849
  WhereItLives,
4850
+ platformOwned,
4851
+ laneFor,
4825
4852
  TABLE_LANES,
4826
4853
  LANE_TITLE,
4827
4854
  LANE_EMPTY,
4828
- platformOwned,
4829
4855
  SECTIONS_UNKNOWN,
4830
- laneFor,
4831
4856
  VISIBILITY_LANES,
4832
4857
  VISIBILITY_LANE_TITLE,
4833
4858
  visibilityLaneFor,
@@ -4836,4 +4861,4 @@ export {
4836
4861
  shapesOfSource,
4837
4862
  SaveToTable
4838
4863
  };
4839
- //# sourceMappingURL=chunk-4ZYGWYQP.js.map
4864
+ //# sourceMappingURL=chunk-QRZ4RW2T.js.map