@ai-matrx/records-ui 0.85.7 → 0.85.9

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/index.js CHANGED
@@ -2212,9 +2212,9 @@ var DUE_STATE_LABEL = {
2212
2212
  };
2213
2213
  var WORK_INBOX_KINDS = exhaustiveValuesOf()(["assignment", "approval", "proposal"]);
2214
2214
  var WORK_INBOX_KIND_LABEL = {
2215
- assignment: "Yours",
2216
- approval: "Approve",
2217
- proposal: "Agent"
2215
+ assignment: "Assigned",
2216
+ approval: "Approval",
2217
+ proposal: "Agent proposal"
2218
2218
  };
2219
2219
  var WORK_INBOX_KIND_GROUP_LABEL = {
2220
2220
  approval: "Approvals",
@@ -19099,14 +19099,20 @@ var COMPARE_LABEL = {
19099
19099
  function compareKey(block, fields) {
19100
19100
  return block.bucket?.key ?? block.compare?.key ?? offerableFields(onePerKey(fields), "date")[0]?.key ?? null;
19101
19101
  }
19102
- function canonical(value) {
19103
- if (value === void 0 || value === null) return "null";
19104
- if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
19105
- if (typeof value === "object") {
19106
- const entries = Object.entries(value).filter(([, v]) => v !== void 0 && v !== null).sort(([a], [b]) => a.localeCompare(b));
19107
- return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`).join(",")}}`;
19102
+ function holds(sent, stored) {
19103
+ const absent = (v) => v === void 0 || v === null;
19104
+ if (absent(sent)) return absent(stored);
19105
+ if (absent(stored)) return false;
19106
+ if (Array.isArray(sent)) {
19107
+ return Array.isArray(stored) && stored.length === sent.length && sent.every((v, i) => holds(v, stored[i]));
19108
19108
  }
19109
- return JSON.stringify(value);
19109
+ if (typeof sent === "object") {
19110
+ if (typeof stored !== "object" || Array.isArray(stored)) return false;
19111
+ return Object.entries(sent).every(
19112
+ ([k, v]) => absent(v) || holds(v, stored[k])
19113
+ );
19114
+ }
19115
+ return Object.is(sent, stored);
19110
19116
  }
19111
19117
  var KEPT_SETTINGS = [
19112
19118
  ["kind", "its shape"],
@@ -19123,7 +19129,7 @@ function whatTheStoreDidNotKeep(sent, stored) {
19123
19129
  lost.push(`\u201C${block.title}\u201D`);
19124
19130
  return;
19125
19131
  }
19126
- const what = KEPT_SETTINGS.filter(([key]) => canonical(block[key]) !== canonical(kept[key])).map(([, words]) => words);
19132
+ const what = KEPT_SETTINGS.filter(([key]) => !holds(block[key], kept[key])).map(([, words]) => words);
19127
19133
  if (what.length) lost.push(`${what.join(" and ")} for \u201C${block.title}\u201D`);
19128
19134
  });
19129
19135
  if (lost.length === 0) return null;
@@ -21137,12 +21143,15 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
21137
21143
  expected_version: home.table.version
21138
21144
  });
21139
21145
  setMoving(false);
21140
- setChoosing(null);
21141
21146
  if (!moved.ok) {
21142
- setSaid({ tone: "refused", text: `Nothing moved. ${moved.error.message}` });
21143
- setAttempt((n) => n + 1);
21147
+ const hint = moved.error.hint?.trim();
21148
+ setSaid({
21149
+ tone: "refused",
21150
+ text: `Nothing moved. ${moved.error.message}${hint && !moved.error.message.includes(hint) ? ` ${hint}` : ""}`
21151
+ });
21144
21152
  return;
21145
21153
  }
21154
+ setChoosing(null);
21146
21155
  setSaid({ tone: "done", text: `${moved.data.tableName} now lives in ${moved.data.to.name}.` });
21147
21156
  setAttempt((n) => n + 1);
21148
21157
  onMoved?.(moved.data.to);
@@ -21178,65 +21187,90 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
21178
21187
  ]
21179
21188
  }
21180
21189
  ) }),
21181
- /* @__PURE__ */ jsx73(PopoverContent3, { align: "start", className: "w-80 p-3 text-xs", onClick: (e) => e.stopPropagation(), children: answer === null ? /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: "Asking the record store where this table lives\u2026" }) : answer.state === "not-given" ? /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: "This table has not been shared with you, so where it lives is not yours to see." }) : answer.state === "door-absent" || answer.state === "unavailable" ? /* @__PURE__ */ jsxs67("div", { className: "space-y-2", children: [
21182
- knownOrganizationName ? /* @__PURE__ */ jsxs67("p", { children: [
21183
- "Lives in ",
21184
- /* @__PURE__ */ jsx73("span", { className: "font-medium text-foreground", children: knownOrganizationName }),
21185
- "."
21186
- ] }) : null,
21187
- /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: answer.state === "door-absent" ? "Moving it to another organization is not available on this database yet." : `The record store could not be asked where this lives, so nothing here is an answer about your access. ${answer.why}` }),
21188
- answer.state === "unavailable" ? /* @__PURE__ */ jsx73(Button60, { size: "sm", variant: "outline", className: "h-7 text-xs", onClick: () => setAttempt((n) => n + 1), children: "Ask again" }) : null
21189
- ] }) : /* @__PURE__ */ jsxs67("div", { className: "space-y-2", "data-where-it-lives-panel": answer.home.table.id, children: [
21190
- /* @__PURE__ */ jsxs67("p", { children: [
21191
- /* @__PURE__ */ jsxs67("span", { className: "text-muted-foreground", children: [
21192
- answer.home.table.name,
21193
- " lives in "
21194
- ] }),
21195
- /* @__PURE__ */ jsx73("span", { className: "font-medium text-foreground", children: answer.home.organization.name }),
21196
- "."
21197
- ] }),
21198
- said ? /* @__PURE__ */ jsx73("p", { "data-where-it-lives-said": said.tone, className: said.tone === "refused" ? "text-destructive" : "text-foreground", children: said.text }) : null,
21199
- choosing ? (
21200
- // THE CONSEQUENCE, SAID BEFORE THE MOVE, in the same panel — no second dialog.
21201
- /* @__PURE__ */ jsxs67("div", { className: "space-y-2", "data-where-it-lives-confirm": choosing.id, children: [
21202
- /* @__PURE__ */ jsxs67("p", { className: "font-medium text-foreground", children: [
21203
- "Move ",
21204
- answer.home.table.name,
21205
- " to ",
21206
- choosing.name,
21207
- "?"
21190
+ /* @__PURE__ */ jsx73(
21191
+ PopoverContent3,
21192
+ {
21193
+ align: "start",
21194
+ className: "w-80 p-3 text-xs",
21195
+ onClick: (e) => e.stopPropagation(),
21196
+ onFocusOutside: (e) => e.preventDefault(),
21197
+ children: answer === null ? /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: "Asking the record store where this table lives\u2026" }) : answer.state === "not-given" ? /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: "This table has not been shared with you, so where it lives is not yours to see." }) : answer.state === "door-absent" || answer.state === "unavailable" ? /* @__PURE__ */ jsxs67("div", { className: "space-y-2", children: [
21198
+ knownOrganizationName ? /* @__PURE__ */ jsxs67("p", { children: [
21199
+ "Lives in ",
21200
+ /* @__PURE__ */ jsx73("span", { className: "font-medium text-foreground", children: knownOrganizationName }),
21201
+ "."
21202
+ ] }) : null,
21203
+ /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: answer.state === "door-absent" ? "Moving it to another organization is not available on this database yet." : `The record store could not be asked where this lives, so nothing here is an answer about your access. ${answer.why}` }),
21204
+ answer.state === "unavailable" ? /* @__PURE__ */ jsx73(Button60, { size: "sm", variant: "outline", className: "h-7 text-xs", onClick: () => setAttempt((n) => n + 1), children: "Ask again" }) : null
21205
+ ] }) : /* @__PURE__ */ jsxs67("div", { className: "space-y-2", "data-where-it-lives-panel": answer.home.table.id, children: [
21206
+ /* @__PURE__ */ jsxs67("p", { children: [
21207
+ /* @__PURE__ */ jsxs67("span", { className: "text-muted-foreground", children: [
21208
+ answer.home.table.name,
21209
+ " lives in "
21210
+ ] }),
21211
+ /* @__PURE__ */ jsx73("span", { className: "font-medium text-foreground", children: answer.home.organization.name }),
21212
+ "."
21208
21213
  ] }),
21209
- /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: moveConsequence(answer.home, choosing) }),
21210
- /* @__PURE__ */ jsxs67("div", { className: "flex gap-2", children: [
21211
- /* @__PURE__ */ jsx73(Button60, { size: "sm", className: "h-7 text-xs", disabled: moving, onClick: () => void move(choosing), children: moving ? `Moving to ${choosing.name}\u2026` : "Move it" }),
21212
- /* @__PURE__ */ jsx73(Button60, { size: "sm", variant: "ghost", className: "h-7 text-xs", disabled: moving, onClick: () => setChoosing(null), children: "Cancel" })
21214
+ said && !(said.tone === "refused" && choosing) ? /* @__PURE__ */ jsx73("p", { "data-where-it-lives-said": said.tone, className: said.tone === "refused" ? "text-destructive" : "text-foreground", children: said.text }) : null,
21215
+ choosing ? (
21216
+ // THE CONSEQUENCE, SAID BEFORE THE MOVE, in the same panel — no second dialog.
21217
+ /* @__PURE__ */ jsxs67("div", { className: "space-y-2", "data-where-it-lives-confirm": choosing.id, children: [
21218
+ /* @__PURE__ */ jsxs67("p", { className: "font-medium text-foreground", children: [
21219
+ "Move ",
21220
+ answer.home.table.name,
21221
+ " to ",
21222
+ choosing.name,
21223
+ "?"
21224
+ ] }),
21225
+ /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: moveConsequence(answer.home, choosing) }),
21226
+ said?.tone === "refused" ? /* @__PURE__ */ jsx73("p", { "data-where-it-lives-said": "refused", role: "alert", className: "text-destructive", children: said.text }) : null,
21227
+ /* @__PURE__ */ jsxs67("div", { className: "flex gap-2", children: [
21228
+ /* @__PURE__ */ jsx73(Button60, { size: "sm", className: "h-7 text-xs", disabled: moving, onClick: () => void move(choosing), children: moving ? `Moving to ${choosing.name}\u2026` : said?.tone === "refused" ? "Try again" : "Move it" }),
21229
+ /* @__PURE__ */ jsx73(
21230
+ Button60,
21231
+ {
21232
+ size: "sm",
21233
+ variant: "ghost",
21234
+ className: "h-7 text-xs",
21235
+ disabled: moving,
21236
+ onClick: () => {
21237
+ const wasRefused = said?.tone === "refused";
21238
+ setChoosing(null);
21239
+ setSaid(null);
21240
+ if (wasRefused) setAttempt((n) => n + 1);
21241
+ },
21242
+ children: "Cancel"
21243
+ }
21244
+ )
21245
+ ] })
21246
+ ] })
21247
+ ) : !answer.home.mayMove ? /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: answer.home.whyNot }) : answer.home.heldBy.length > 0 ? /* @__PURE__ */ jsxs67("div", { className: "space-y-1", children: [
21248
+ /* @__PURE__ */ jsx73("p", { className: "font-medium text-foreground", children: "It cannot move yet:" }),
21249
+ /* @__PURE__ */ jsx73("ul", { className: "list-disc space-y-1 pl-4 text-muted-foreground", children: answer.home.heldBy.map((line) => /* @__PURE__ */ jsx73("li", { children: line }, line)) })
21250
+ ] }) : answer.home.destinations.length === 0 ? /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: "You are not a member of any other organization, so there is nowhere else to move it." }) : /* @__PURE__ */ jsxs67("div", { className: "space-y-1", children: [
21251
+ /* @__PURE__ */ jsx73("p", { className: "font-medium text-foreground", children: "Move it to" }),
21252
+ /* @__PURE__ */ jsx73("ul", { className: "max-h-64 space-y-1 overflow-y-auto pr-1", children: answer.home.destinations.map((to) => /* @__PURE__ */ jsx73("li", { children: to.ok ? /* @__PURE__ */ jsx73(
21253
+ Button60,
21254
+ {
21255
+ size: "sm",
21256
+ variant: "outline",
21257
+ className: "h-7 w-full justify-start text-xs",
21258
+ "data-where-it-lives-move": to.id,
21259
+ onClick: () => {
21260
+ setSaid(null);
21261
+ setChoosing(to);
21262
+ },
21263
+ children: to.name
21264
+ }
21265
+ ) : /* @__PURE__ */ jsxs67("p", { className: "text-muted-foreground", children: [
21266
+ /* @__PURE__ */ jsx73("span", { className: "text-foreground", children: to.name }),
21267
+ " \u2014 ",
21268
+ to.why
21269
+ ] }) }, to.id)) })
21213
21270
  ] })
21214
21271
  ] })
21215
- ) : !answer.home.mayMove ? /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: answer.home.whyNot }) : answer.home.heldBy.length > 0 ? /* @__PURE__ */ jsxs67("div", { className: "space-y-1", children: [
21216
- /* @__PURE__ */ jsx73("p", { className: "font-medium text-foreground", children: "It cannot move yet:" }),
21217
- /* @__PURE__ */ jsx73("ul", { className: "list-disc space-y-1 pl-4 text-muted-foreground", children: answer.home.heldBy.map((line) => /* @__PURE__ */ jsx73("li", { children: line }, line)) })
21218
- ] }) : answer.home.destinations.length === 0 ? /* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: "You are not a member of any other organization, so there is nowhere else to move it." }) : /* @__PURE__ */ jsxs67("div", { className: "space-y-1", children: [
21219
- /* @__PURE__ */ jsx73("p", { className: "font-medium text-foreground", children: "Move it to" }),
21220
- /* @__PURE__ */ jsx73("ul", { className: "max-h-64 space-y-1 overflow-y-auto pr-1", children: answer.home.destinations.map((to) => /* @__PURE__ */ jsx73("li", { children: to.ok ? /* @__PURE__ */ jsx73(
21221
- Button60,
21222
- {
21223
- size: "sm",
21224
- variant: "outline",
21225
- className: "h-7 w-full justify-start text-xs",
21226
- "data-where-it-lives-move": to.id,
21227
- onClick: () => {
21228
- setSaid(null);
21229
- setChoosing(to);
21230
- },
21231
- children: to.name
21232
- }
21233
- ) : /* @__PURE__ */ jsxs67("p", { className: "text-muted-foreground", children: [
21234
- /* @__PURE__ */ jsx73("span", { className: "text-foreground", children: to.name }),
21235
- " \u2014 ",
21236
- to.why
21237
- ] }) }, to.id)) })
21238
- ] })
21239
- ] }) })
21272
+ }
21273
+ )
21240
21274
  ]
21241
21275
  }
21242
21276
  );