@ai-matrx/records-ui 0.116.99 → 0.116.101

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.cjs CHANGED
@@ -6845,12 +6845,11 @@ function toStripAndRows(actions, rowCount = STRIP_FEATURE_ROWS) {
6845
6845
  const features = actions.map((a, index) => ({ a, index })).filter(({ a }) => a.verb === void 0).sort((x, y) => (x.a.rank ?? Infinity) - (y.a.rank ?? Infinity) || x.index - y.index).map(({ a }) => a);
6846
6846
  return { strip, rows: features.slice(0, rowCount), more: features.slice(rowCount) };
6847
6847
  }
6848
- var import_tap_target, STANDARD_VERBS, OBJECT_ACTION_GROUPS, GROUP_IDS, DEFAULT_ACTION_ORIGIN, ACTION_NOT_HERE_REASON, ACTION_CHECKING_ACCESS_REASON, ACTION_NO_ACCESS_REASON, ACTION_PLATFORM_TABLE_REASON, BUILT_ON, NOOP, TABLE_ACTION_CHORDS, TABLE_ACTION_KEYS, STRIP_FEATURE_ROWS;
6848
+ var import_tap_shortcut, STANDARD_VERBS, OBJECT_ACTION_GROUPS, GROUP_IDS, DEFAULT_ACTION_ORIGIN, ACTION_NOT_HERE_REASON, ACTION_CHECKING_ACCESS_REASON, ACTION_NO_ACCESS_REASON, ACTION_PLATFORM_TABLE_REASON, BUILT_ON, NOOP, TABLE_ACTION_CHORDS, TABLE_ACTION_KEYS, STRIP_FEATURE_ROWS;
6849
6849
  var init_objectActions = __esm({
6850
6850
  "src/objectActions.ts"() {
6851
6851
  "use strict";
6852
- "use client";
6853
- import_tap_target = require("@ai-matrx/design-system/tap-target");
6852
+ import_tap_shortcut = require("@ai-matrx/design-system/tap-shortcut");
6854
6853
  init_fieldTypes();
6855
6854
  init_rights();
6856
6855
  STANDARD_VERBS = [
@@ -6908,7 +6907,7 @@ var init_objectActions = __esm({
6908
6907
  archive: { code: "Backspace", chord: "alt+shift+backspace" }
6909
6908
  };
6910
6909
  TABLE_ACTION_KEYS = Object.fromEntries(
6911
- Object.entries(TABLE_ACTION_CHORDS).map(([id, { code, chord }]) => [id, { code, label: (0, import_tap_target.formatTapShortcut)(chord) }])
6910
+ Object.entries(TABLE_ACTION_CHORDS).map(([id, { code, chord }]) => [id, { code, label: (0, import_tap_shortcut.formatTapShortcut)(chord) }])
6912
6911
  );
6913
6912
  STRIP_FEATURE_ROWS = 4;
6914
6913
  }
@@ -10049,14 +10048,11 @@ function NumberBox({
10049
10048
  function unitOf(format) {
10050
10049
  return format.options?.unit ?? "px";
10051
10050
  }
10051
+ var SPACING_BAR_MAX_PX = 96;
10052
10052
  function MeasureMini({ px, kind: kind2 }) {
10053
10053
  if (kind2 === "spacing") {
10054
- const gap = Math.max(1, Math.min(px, 48));
10055
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { "aria-hidden": true, "data-records-measure-mini": "spacing", className: "inline-flex h-4 shrink-0 items-center", children: [
10056
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "h-4 w-2.5 rounded-sm border border-border bg-muted" }),
10057
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { width: gap } }),
10058
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "h-4 w-2.5 rounded-sm border border-border bg-muted" })
10059
- ] });
10054
+ const length = Math.max(1, Math.min(px, SPACING_BAR_MAX_PX));
10055
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": true, "data-records-measure-mini": "spacing", className: "inline-flex h-4 shrink-0 items-center", style: { width: SPACING_BAR_MAX_PX }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "data-records-measure-bar": "", className: "h-2 rounded-sm bg-primary", style: { width: length } }) });
10060
10056
  }
10061
10057
  if (kind2 === "border") {
10062
10058
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": true, "data-records-measure-mini": "border", className: "inline-block h-5 w-5 shrink-0 rounded-sm bg-card", style: { boxShadow: `inset 0 0 0 ${Math.max(0.5, Math.min(px, 6))}px hsl(var(--foreground))` } });
@@ -18310,7 +18306,7 @@ function AlsoPointsAt({ own: own3, value, onChange }) {
18310
18306
  const toggle = (id, on) => onChange(on ? [...value.filter((v) => v !== id), id] : value.filter((v) => v !== id));
18311
18307
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex flex-col gap-1", "data-records-link-also-points-at": "", children: [
18312
18308
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_design_system51.Label, { className: "text-xs", children: "Also points at" }),
18313
- tables.loading && entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-xs text-muted-foreground", children: "Reading tables\u2026" }) : entries.length === 0 && unseen.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-xs text-muted-foreground", children: "No other tables yet." }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex max-h-40 flex-col gap-1 overflow-y-auto", children: [
18309
+ tables.loading && entries.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "h-40 text-xs text-muted-foreground", "data-records-also-box": "", children: "Reading tables\u2026" }) : entries.length === 0 && unseen.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "h-40 text-xs text-muted-foreground", "data-records-also-box": "", children: "No other tables yet." }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex h-40 flex-col gap-1 overflow-y-auto", "data-records-also-box": "", children: [
18314
18310
  entries.map((e) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", children: [
18315
18311
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
18316
18312
  import_design_system51.Checkbox,
@@ -25517,7 +25513,7 @@ var import_react198 = require("@ai-matrx/records/react");
25517
25513
  var import_records51 = require("@ai-matrx/records");
25518
25514
  var import_records52 = require("@ai-matrx/records");
25519
25515
  var import_data_table14 = require("@ai-matrx/design-system/data-table");
25520
- var import_core20 = require("@ai-matrx/records/core");
25516
+ var import_core21 = require("@ai-matrx/records/core");
25521
25517
 
25522
25518
  // src/tableDecorations.ts
25523
25519
  var import_react117 = require("react");
@@ -25689,7 +25685,7 @@ function useTableCanBeCleaned(tableId) {
25689
25685
 
25690
25686
  // src/gridControls.tsx
25691
25687
  var import_clipboard3 = require("@ai-matrx/kit/clipboard");
25692
- var import_core16 = require("@ai-matrx/records/core");
25688
+ var import_core17 = require("@ai-matrx/records/core");
25693
25689
  var import_react158 = require("react");
25694
25690
  var import_react159 = require("@ai-matrx/records/react");
25695
25691
  var import_design_system86 = require("@ai-matrx/design-system");
@@ -25710,6 +25706,7 @@ var import_react122 = require("@ai-matrx/records/react");
25710
25706
  var import_records42 = require("@ai-matrx/records");
25711
25707
  var import_design_system68 = require("@ai-matrx/design-system");
25712
25708
  var import_format8 = require("@ai-matrx/kit/format");
25709
+ var import_core15 = require("@ai-matrx/records/core");
25713
25710
  init_Refusal();
25714
25711
  init_refusals();
25715
25712
  init_host();
@@ -25795,7 +25792,8 @@ function fillEstimateWords(args) {
25795
25792
  const total = costInPoints(args.estimate.costCents, args.rate);
25796
25793
  if (total !== null) return `about ${total}${args.estimate.extraReads ? " or more" : ""}`;
25797
25794
  }
25798
- return "no estimate";
25795
+ const why = args.estimate ? args.estimate.says?.trim() : "";
25796
+ return why ? `no estimate: ${why}` : "no estimate";
25799
25797
  }
25800
25798
  var FILL_OFF_REASON = "Switch it on to fill";
25801
25799
  var NO_ENRICH_REASON = "Having an agent fill this column is not switched on here yet, so this panel does not offer it rather than offering something that cannot happen. Everything else on this panel works. It is on our list, not yours.";
@@ -25900,17 +25898,29 @@ function useEnrichCells(tableId, recordIds) {
25900
25898
  return { cells, refresh, error };
25901
25899
  }
25902
25900
  var NEVER2 = "Fill it in once and leave it alone";
25903
- var FILL_TRY_MAX = 10;
25904
- var FILL_ROWS_MAX = 50;
25905
- var FILL_N_DEFAULT = "3";
25906
- function dueRowsEstimate(row) {
25901
+ function useFillLimits(client) {
25902
+ const [limits, setLimits] = (0, import_react121.useState)(null);
25903
+ (0, import_react121.useEffect)(() => {
25904
+ let live = true;
25905
+ if (!client?.recordsLimits) {
25906
+ setLimits({ ...import_core15.RECORDS_LIMITS_DEFAULTS });
25907
+ return;
25908
+ }
25909
+ void client.recordsLimits().then((got) => live && setLimits(got), () => live && setLimits({ ...import_core15.RECORDS_LIMITS_DEFAULTS }));
25910
+ return () => {
25911
+ live = false;
25912
+ };
25913
+ }, [client]);
25914
+ return limits;
25915
+ }
25916
+ function dueRowsEstimate(row, rowsMax = import_core15.RECORDS_LIMITS_DEFAULTS.aiFillRowsMax) {
25907
25917
  const empty = Math.max(0, Number(row.rows_total) - Number(row.rows_filled));
25908
- return Math.max(1, Math.min(FILL_ROWS_MAX, empty));
25918
+ return Math.max(1, Math.min(rowsMax, empty));
25909
25919
  }
25910
- function fillCountFrom(text) {
25920
+ function fillCountFrom(text, rowsMax = import_core15.RECORDS_LIMITS_DEFAULTS.aiFillRowsMax) {
25911
25921
  if (!/^\d+$/.test(text.trim())) return null;
25912
25922
  const n = Number(text);
25913
- return n >= 1 && n <= FILL_ROWS_MAX ? n : null;
25923
+ return n >= 1 && n <= rowsMax ? n : null;
25914
25924
  }
25915
25925
  function EnrichPanel({ tableId, fieldId, className }) {
25916
25926
  const client = (0, import_react122.useRecordsClient)();
@@ -25919,6 +25929,10 @@ function EnrichPanel({ tableId, fieldId, className }) {
25919
25929
  const table = (0, import_react122.useTable)(tableId);
25920
25930
  const fields = (0, import_react122.useFields)(tableId);
25921
25931
  const rights = useTableRights(table.data);
25932
+ const limits = useFillLimits(client);
25933
+ const tryMax = limits?.aiFillTryMax ?? 0;
25934
+ const rowsMax = limits?.aiFillRowsMax ?? 0;
25935
+ const startN = String(limits?.aiFillDefaultRows ?? "");
25922
25936
  const [rows, setRows] = (0, import_react121.useState)(null);
25923
25937
  const [error, setError] = (0, import_react121.useState)(null);
25924
25938
  const [busy, setBusy] = (0, import_react121.useState)(null);
@@ -25989,7 +26003,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
25989
26003
  tableId,
25990
26004
  fieldId: row.field_id,
25991
26005
  fieldKey: row.field_key,
25992
- rows: count ?? (previewOnly ? 5 : 50),
26006
+ rows: count ?? (previewOnly ? 5 : rowsMax),
25993
26007
  previewOnly
25994
26008
  });
25995
26009
  setBusy(null);
@@ -26000,11 +26014,11 @@ function EnrichPanel({ tableId, fieldId, className }) {
26000
26014
  }
26001
26015
  if (!previewOnly) await load();
26002
26016
  },
26003
- [host, load, tableId]
26017
+ [host, load, tableId, rowsMax]
26004
26018
  );
26005
26019
  const startFill = (0, import_react121.useCallback)(
26006
26020
  (row, count) => {
26007
- if (count > FILL_TRY_MAX) {
26021
+ if (count > tryMax) {
26008
26022
  setConfirming({ fieldId: row.field_id, count });
26009
26023
  if (row.cost_per_row_cents === null && previewCost[row.field_id] === void 0 && host.estimateFill) {
26010
26024
  const key = `${row.field_id}:${count}`;
@@ -26016,7 +26030,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
26016
26030
  setConfirming(null);
26017
26031
  void runIt(row, false, count);
26018
26032
  },
26019
- [runIt, previewCost, host, tableId]
26033
+ [runIt, previewCost, host, tableId, tryMax]
26020
26034
  );
26021
26035
  if (error) return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(RefusalNotice, { error, className });
26022
26036
  if (rows === null) return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_design_system68.Skeleton, { className: (0, import_design_system68.cn)("h-40 w-full", className) });
@@ -26257,7 +26271,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
26257
26271
  children: "Show me five rows it would do"
26258
26272
  }
26259
26273
  ),
26260
- host.enrich ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
26274
+ host.enrich && limits === null ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_design_system68.Skeleton, { className: "h-8 w-64", "data-enrich-limits-reading": "" }) : host.enrich ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
26261
26275
  /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
26262
26276
  import_design_system68.Button,
26263
26277
  {
@@ -26286,10 +26300,10 @@ function EnrichPanel({ tableId, fieldId, className }) {
26286
26300
  type: "number",
26287
26301
  inputMode: "numeric",
26288
26302
  min: 1,
26289
- max: FILL_ROWS_MAX,
26303
+ max: rowsMax,
26290
26304
  className: "h-8 w-16",
26291
26305
  "aria-label": "How many rows to fill",
26292
- value: fillN[row.field_id] ?? FILL_N_DEFAULT,
26306
+ value: fillN[row.field_id] ?? startN,
26293
26307
  onChange: (e) => setFillN((prev) => ({ ...prev, [row.field_id]: e.target.value }))
26294
26308
  }
26295
26309
  ),
@@ -26298,15 +26312,15 @@ function EnrichPanel({ tableId, fieldId, className }) {
26298
26312
  {
26299
26313
  size: "sm",
26300
26314
  variant: "outline",
26301
- disabled: busy === row.field_id || !row.enabled || fillCountFrom(fillN[row.field_id] ?? FILL_N_DEFAULT) === null,
26315
+ disabled: busy === row.field_id || !row.enabled || fillCountFrom(fillN[row.field_id] ?? startN, rowsMax) === null,
26302
26316
  title: row.enabled ? void 0 : FILL_OFF_REASON,
26303
26317
  "data-enrich-fill-rows": "",
26304
26318
  onClick: () => {
26305
- const n = fillCountFrom(fillN[row.field_id] ?? FILL_N_DEFAULT);
26319
+ const n = fillCountFrom(fillN[row.field_id] ?? startN, rowsMax);
26306
26320
  if (n !== null) startFill(row, n);
26307
26321
  },
26308
26322
  children: (() => {
26309
- const n = fillCountFrom(fillN[row.field_id] ?? FILL_N_DEFAULT);
26323
+ const n = fillCountFrom(fillN[row.field_id] ?? startN, rowsMax);
26310
26324
  return n === null ? "Fill rows" : `Fill ${n} ${n === 1 ? "row" : "rows"}`;
26311
26325
  })()
26312
26326
  }
@@ -26319,7 +26333,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
26319
26333
  disabled: busy === row.field_id || !row.enabled,
26320
26334
  title: row.enabled ? void 0 : FILL_OFF_REASON,
26321
26335
  "data-enrich-fill-due": "",
26322
- onClick: () => startFill(row, dueRowsEstimate(row)),
26336
+ onClick: () => startFill(row, dueRowsEstimate(row, rowsMax)),
26323
26337
  children: "Fill in what is due"
26324
26338
  }
26325
26339
  )
@@ -27422,17 +27436,17 @@ function MoveUnderDialog({ tableId, record, document: document2, open, onOpenCha
27422
27436
  disabled: busy
27423
27437
  }
27424
27438
  ),
27425
- parentTableId ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
27439
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
27426
27440
  import_design_system73.Input,
27427
27441
  {
27428
27442
  value: search,
27429
27443
  onChange: (e) => setSearch(e.target.value),
27430
- placeholder: `Find in ${parentTableName}`,
27444
+ placeholder: parentTableId ? `Find in ${parentTableName}` : "Pick a table first",
27431
27445
  "aria-label": asHome ? "Find the record it also lives in" : "Find the record to move it under",
27432
- disabled: busy,
27446
+ disabled: busy || !parentTableId,
27433
27447
  "data-records-move-under-search": ""
27434
27448
  }
27435
- ) : null,
27449
+ ),
27436
27450
  /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "h-48 overflow-y-auto", "data-records-move-under-list": "", children: !parentTableId ? null : rows === null ? /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex flex-col gap-2", children: [
27437
27451
  /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_design_system73.Skeleton, { className: "h-7 w-full" }),
27438
27452
  /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_design_system73.Skeleton, { className: "h-7 w-full" }),
@@ -27585,7 +27599,7 @@ function MoveRecordDialog({ tableId, record, document: document2, open, onOpenCh
27585
27599
  // src/printLayouts.tsx
27586
27600
  var import_react143 = require("react");
27587
27601
  var import_react144 = require("@ai-matrx/records/react");
27588
- var import_core15 = require("@ai-matrx/print/core");
27602
+ var import_core16 = require("@ai-matrx/print/core");
27589
27603
  var import_design_system77 = require("@ai-matrx/design-system");
27590
27604
 
27591
27605
  // src/DocTemplate.tsx
@@ -28074,7 +28088,7 @@ function layoutPagesDocument(layoutName, pages) {
28074
28088
  return `<section class="layout-page layout-page-set" data-layout-page="">${noteHtml}${regionHtml("header", split.settings.header, logo)}<div class="layout-text">${escapeText(split.body)}</div>${regionHtml("footer", split.settings.footer)}</section>`;
28075
28089
  }).join("");
28076
28090
  const pageCss = sheet ? layoutPageCss(sheet) : "";
28077
- return (0, import_core15.buildPrintDocument)(body, layoutName, `${LAYOUT_STYLES}${pageCss}`);
28091
+ return (0, import_core16.buildPrintDocument)(body, layoutName, `${LAYOUT_STYLES}${pageCss}`);
28078
28092
  }
28079
28093
  function PrintWithLayoutDialog({ tableId, recordIds, names: names2, open, onOpenChange }) {
28080
28094
  const client = (0, import_react144.useRecordsClient)();
@@ -28104,7 +28118,7 @@ function PrintWithLayoutDialog({ tableId, recordIds, names: names2, open, onOpen
28104
28118
  if (!layout) return;
28105
28119
  setBusy(true);
28106
28120
  setNote(null);
28107
- const pending = (0, import_core15.openPendingPrintWindow)(layout.name);
28121
+ const pending = (0, import_core16.openPendingPrintWindow)(layout.name);
28108
28122
  const pages = [];
28109
28123
  for (const id of recordIds) {
28110
28124
  const body = await client.docRenderBody({ template_id: layout.id, record_id: id });
@@ -30014,7 +30028,7 @@ function useMergedGridControls(args) {
30014
30028
  const fieldsRef = (0, import_react158.useRef)(fields);
30015
30029
  fieldsRef.current = fields;
30016
30030
  const [choiceCounts, setChoiceCounts] = (0, import_react158.useState)({});
30017
- (0, import_react158.useEffect)(() => (0, import_core16.onRecordChanged)(() => (0, askOnce_exports.forgetAsked)(client, `value_counts:${tableId}:`)), [client, tableId]);
30031
+ (0, import_react158.useEffect)(() => (0, import_core17.onRecordChanged)(() => (0, askOnce_exports.forgetAsked)(client, `value_counts:${tableId}:`)), [client, tableId]);
30018
30032
  (0, import_react158.useEffect)(() => {
30019
30033
  if (!enabled || choiceKeys.length === 0) {
30020
30034
  setChoiceCounts({});
@@ -33738,7 +33752,7 @@ function useGroupLabel(fields, groupKey, thenKeys = []) {
33738
33752
  // src/gridUndo.tsx
33739
33753
  var import_react185 = require("react");
33740
33754
  var import_react186 = require("@ai-matrx/records/react");
33741
- var import_core17 = require("@ai-matrx/records/core");
33755
+ var import_core18 = require("@ai-matrx/records/core");
33742
33756
  var import_design_system98 = require("@ai-matrx/design-system");
33743
33757
  init_plainWords();
33744
33758
  var import_data_table13 = require("@ai-matrx/design-system/data-table");
@@ -33834,7 +33848,7 @@ function useGridUndo(args) {
33834
33848
  }
33835
33849
  forget(step2.cells.map((c) => ({ rowId: c.rowId, key: c.key })));
33836
33850
  for (const id of /* @__PURE__ */ new Set([...step2.cells.map((c) => c.rowId), ...step2.created ?? [], ...step2.archived ?? []])) {
33837
- (0, import_core17.announceRecordChanged)(id);
33851
+ (0, import_core18.announceRecordChanged)(id);
33838
33852
  }
33839
33853
  setHeld(() => {
33840
33854
  let stack = taken.stack;
@@ -34131,7 +34145,7 @@ function useRowFollowsItsMove(args) {
34131
34145
  // src/gridAssist.tsx
34132
34146
  var import_clipboard5 = require("@ai-matrx/kit/clipboard");
34133
34147
  var import_react189 = require("react");
34134
- var import_core18 = require("@ai-matrx/records/core");
34148
+ var import_core19 = require("@ai-matrx/records/core");
34135
34149
  var import_workspace = require("@ai-matrx/alchemy/react/workspace");
34136
34150
 
34137
34151
  // src/gridAgentContext.ts
@@ -34263,7 +34277,7 @@ function useGridAssist(args) {
34263
34277
  const copyRecordReference = (0, import_react189.useCallback)(
34264
34278
  (rowId) => {
34265
34279
  void (async () => {
34266
- const text = JSON.stringify({ __kind: (0, import_core18.tableKindSlug)(tableId), _record_id: rowId });
34280
+ const text = JSON.stringify({ __kind: (0, import_core19.tableKindSlug)(tableId), _record_id: rowId });
34267
34281
  if (!await (0, import_clipboard5.copyText)(text)) {
34268
34282
  say2(false, "This browser did not let the page write to the clipboard.");
34269
34283
  return;
@@ -34319,7 +34333,7 @@ function useGridAssist(args) {
34319
34333
  if (!row) return;
34320
34334
  const document2 = row.document ?? {};
34321
34335
  const value = editing.valueFor(row, fieldOf2(key));
34322
- const pointer = typeof document2[key] === "string" ? (0, import_core18.wholeValueOf)(document2, key) : null;
34336
+ const pointer = typeof document2[key] === "string" ? (0, import_core19.wholeValueOf)(document2, key) : null;
34323
34337
  setWhole({ rowId, key, rowTitle: titleOf(row), value, pointer });
34324
34338
  },
34325
34339
  [rowOf, fieldOf2, titleOf, editing]
@@ -34415,7 +34429,7 @@ function useGridAssist(args) {
34415
34429
  // src/gridBulk.tsx
34416
34430
  var import_react190 = require("react");
34417
34431
  var import_react191 = require("@ai-matrx/records/react");
34418
- var import_core19 = require("@ai-matrx/records/core");
34432
+ var import_core20 = require("@ai-matrx/records/core");
34419
34433
  init_recordVersions();
34420
34434
  var import_design_system99 = require("@ai-matrx/design-system");
34421
34435
  init_names();
@@ -34484,7 +34498,7 @@ function useGridBulk(args) {
34484
34498
  return null;
34485
34499
  }
34486
34500
  for (const result of done.data ?? []) if (result.op === "update") versions.wrote(result.id, result.version);
34487
- for (const change of changes) if ("record_id" in change && change.record_id) (0, import_core19.announceRecordChanged)(change.record_id);
34501
+ for (const change of changes) if ("record_id" in change && change.record_id) (0, import_core20.announceRecordChanged)(change.record_id);
34488
34502
  return done.data;
34489
34503
  },
34490
34504
  [client, tableId, versions, reload]
@@ -35841,7 +35855,7 @@ function GridBody({
35841
35855
  }))
35842
35856
  );
35843
35857
  editing.forget(cells);
35844
- for (const u of updates) (0, import_core20.announceRecordChanged)(u.row.recordId);
35858
+ for (const u of updates) (0, import_core21.announceRecordChanged)(u.row.recordId);
35845
35859
  const lines2 = updates.length + creates.length;
35846
35860
  undo.push({ label: `Pasted ${lines2} ${lines2 === 1 ? "row" : "rows"}`, cells, created });
35847
35861
  const expected = [
@@ -36146,7 +36160,7 @@ function GridBody({
36146
36160
  const values = presetValues ? withNewRowValues(presetValues, given) : given;
36147
36161
  setAddRefused(null);
36148
36162
  if (formHosted && fields.data) {
36149
- const wouldRefuse = (0, import_core20.predictWriteRefusals)({ fields: fields.data, document: values ?? {} });
36163
+ const wouldRefuse = (0, import_core21.predictWriteRefusals)({ fields: fields.data, document: values ?? {} });
36150
36164
  if (wouldRefuse.length > 0) {
36151
36165
  setFormAsk((held) => ({ n: (held?.n ?? 0) + 1, initial: { ...values ?? {} } }));
36152
36166
  return;
@@ -41006,7 +41020,7 @@ var import_clipboard7 = require("@ai-matrx/kit/clipboard");
41006
41020
  var import_download2 = require("@ai-matrx/kit/download");
41007
41021
  var import_react236 = require("react");
41008
41022
  var import_react237 = require("@ai-matrx/records/react");
41009
- var import_core21 = require("@ai-matrx/records/core");
41023
+ var import_core22 = require("@ai-matrx/records/core");
41010
41024
  init_host();
41011
41025
 
41012
41026
  // src/viewExport.ts
@@ -41091,7 +41105,7 @@ async function rowsForFile(args) {
41091
41105
  );
41092
41106
  const lookup = ((field2, id) => labels(field2, id) ?? learned.get(`${field2.id}:${id}`) ?? null);
41093
41107
  const read = host.readFileText;
41094
- return (0, import_core21.withWholeValues)(toRows(all, records, lookup), read ? (fileId) => read({ fileId }) : null);
41108
+ return (0, import_core22.withWholeValues)(toRows(all, records, lookup), read ? (fileId) => read({ fileId }) : null);
41095
41109
  }
41096
41110
  function ExportMenu({ tableId, rows, label, className, view }) {
41097
41111
  const client = (0, import_react237.useRecordsClient)();
@@ -46916,7 +46930,7 @@ var import_controls17 = require("@ai-matrx/design-system/controls");
46916
46930
  var import_react289 = require("react");
46917
46931
  var import_recharts = require("recharts");
46918
46932
  var import_records61 = require("@ai-matrx/records");
46919
- var import_core22 = require("@ai-matrx/records/core");
46933
+ var import_core23 = require("@ai-matrx/records/core");
46920
46934
  var import_design_system140 = require("@ai-matrx/design-system");
46921
46935
  var import_format13 = require("@ai-matrx/kit/format");
46922
46936
  init_Refusal();
@@ -47477,7 +47491,7 @@ function prettyPlain(n) {
47477
47491
  return Number.isInteger(n) ? n.toLocaleString() : n.toLocaleString(void 0, { maximumFractionDigits: 2 });
47478
47492
  }
47479
47493
  function asRefusal2(block) {
47480
- return (0, import_core22.mapPgError)(
47494
+ return (0, import_core23.mapPgError)(
47481
47495
  {
47482
47496
  message: block.refused ?? "",
47483
47497
  ...block.sqlstate ? { code: block.sqlstate } : {}
@@ -51004,7 +51018,7 @@ var import_react305 = require("react");
51004
51018
  var import_react306 = require("@ai-matrx/records/react");
51005
51019
  var import_design_system149 = require("@ai-matrx/design-system");
51006
51020
  var import_controls21 = require("@ai-matrx/design-system/controls");
51007
- var import_core23 = require("@dnd-kit/core");
51021
+ var import_core24 = require("@dnd-kit/core");
51008
51022
  var import_sortable = require("@dnd-kit/sortable");
51009
51023
  var import_utilities = require("@dnd-kit/utilities");
51010
51024
  init_Refusal();
@@ -51086,7 +51100,7 @@ function seedIsSatisfied(seed, views) {
51086
51100
  return seed.isDefault === true && views.some((v) => v.isDefault);
51087
51101
  }
51088
51102
  function SectionBox({ id, children, ...rest }) {
51089
- const { setNodeRef, isOver } = (0, import_core23.useDroppable)({ id });
51103
+ const { setNodeRef, isOver } = (0, import_core24.useDroppable)({ id });
51090
51104
  return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("div", { ref: setNodeRef, className: (0, import_design_system149.cn)("rounded-sm", isOver && "bg-accent/40"), ...rest, children });
51091
51105
  }
51092
51106
  function SortableRow({ id, disabled, children }) {
@@ -51141,7 +51155,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
51141
51155
  const [renamingSection, setRenamingSection] = (0, import_react305.useState)(null);
51142
51156
  const [dragging, setDragging] = (0, import_react305.useState)(false);
51143
51157
  const justDragged = (0, import_react305.useRef)(false);
51144
- const sensors = (0, import_core23.useSensors)((0, import_core23.useSensor)(import_core23.PointerSensor, { activationConstraint: { distance: 6 } }));
51158
+ const sensors = (0, import_core24.useSensors)((0, import_core24.useSensor)(import_core24.PointerSensor, { activationConstraint: { distance: 6 } }));
51145
51159
  async function dropped(event) {
51146
51160
  setDragging(false);
51147
51161
  justDragged.current = true;
@@ -51396,7 +51410,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
51396
51410
  ) }),
51397
51411
  /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(import_design_system149.PopoverContent, { sizing: "content", align: "start", className: "w-64 p-1", "data-view-picker-content": "", children: [
51398
51412
  /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)("div", { role: "group", "aria-label": "Saved views", className: "flex max-h-[50dvh] flex-col overflow-y-auto", children: [
51399
- /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_core23.DndContext, { sensors, collisionDetection: import_core23.closestCenter, onDragStart: () => setDragging(true), onDragCancel: () => setDragging(false), onDragEnd: (e) => void dropped(e), children: (() => {
51413
+ /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_core24.DndContext, { sensors, collisionDetection: import_core24.closestCenter, onDragStart: () => setDragging(true), onDragCancel: () => setDragging(false), onDragEnd: (e) => void dropped(e), children: (() => {
51400
51414
  const groups = (0, import_views2.groupViewsBySection)(views);
51401
51415
  return groups.some((g) => g.name === null) || !dragging ? groups : [{ name: null, views: [] }, ...groups];
51402
51416
  })().map((group) => /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(SectionBox, { id: (0, import_views2.sectionDropId)(group.name), role: "group", "aria-label": group.name ?? "Views", "data-view-section": group.name ?? "", children: [
@@ -55046,7 +55060,7 @@ var import_drafts = require("@ai-matrx/kit/drafts");
55046
55060
  var import_design_system164 = require("@ai-matrx/design-system");
55047
55061
  var import_controls25 = require("@ai-matrx/design-system/controls");
55048
55062
  var import_react331 = require("react");
55049
- var import_core24 = require("@dnd-kit/core");
55063
+ var import_core25 = require("@dnd-kit/core");
55050
55064
  var import_sortable2 = require("@dnd-kit/sortable");
55051
55065
  var import_utilities2 = require("@dnd-kit/utilities");
55052
55066
  var import_react332 = require("@ai-matrx/records/react");
@@ -56999,9 +57013,9 @@ function QuestionList({
56999
57013
  onQuestions,
57000
57014
  onQuestion
57001
57015
  }) {
57002
- const sensors = (0, import_core24.useSensors)(
57003
- (0, import_core24.useSensor)(import_core24.PointerSensor, { activationConstraint: { distance: 4 } }),
57004
- (0, import_core24.useSensor)(import_core24.KeyboardSensor, { coordinateGetter: import_sortable2.sortableKeyboardCoordinates })
57016
+ const sensors = (0, import_core25.useSensors)(
57017
+ (0, import_core25.useSensor)(import_core25.PointerSensor, { activationConstraint: { distance: 4 } }),
57018
+ (0, import_core25.useSensor)(import_core25.KeyboardSensor, { coordinateGetter: import_sortable2.sortableKeyboardCoordinates })
57005
57019
  );
57006
57020
  const askable = askableFields([...fields]);
57007
57021
  const unasked = askable.filter((f) => !draft.questions.some((q) => q.field === f.key));
@@ -57023,7 +57037,7 @@ function QuestionList({
57023
57037
  /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("span", { className: "font-medium text-foreground", children: "Questions" }),
57024
57038
  /* @__PURE__ */ (0, import_jsx_runtime189.jsx)("span", { className: "tabular-nums", children: draft.questions.length })
57025
57039
  ] }),
57026
- /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(import_core24.DndContext, { sensors, collisionDetection: import_core24.closestCenter, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(import_sortable2.SortableContext, { items: draft.questions.map((q) => q.field), strategy: import_sortable2.verticalListSortingStrategy, children: draft.questions.map((question, index) => /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
57040
+ /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(import_core25.DndContext, { sensors, collisionDetection: import_core25.closestCenter, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(import_sortable2.SortableContext, { items: draft.questions.map((q) => q.field), strategy: import_sortable2.verticalListSortingStrategy, children: draft.questions.map((question, index) => /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
57027
57041
  QuestionRow,
57028
57042
  {
57029
57043
  index,
@@ -60067,7 +60081,7 @@ init_host();
60067
60081
  // src/PageCanvas.tsx
60068
60082
  var import_react348 = require("react");
60069
60083
  var import_react349 = require("@ai-matrx/records/react");
60070
- var import_core25 = require("@ai-matrx/records/core");
60084
+ var import_core26 = require("@ai-matrx/records/core");
60071
60085
  var import_download3 = require("@ai-matrx/kit/download");
60072
60086
  var import_format17 = require("@ai-matrx/kit/format");
60073
60087
  var import_design_system174 = require("@ai-matrx/design-system");
@@ -60307,7 +60321,7 @@ function useMemberRows(block, viewerUserId, extra, mineOn, enabled) {
60307
60321
  ...q.sort.length > 0 ? { sort: q.sort } : {}
60308
60322
  });
60309
60323
  const reload = page.reload;
60310
- (0, import_react348.useEffect)(() => (0, import_core25.onRecordChanged)(() => reload()), [reload]);
60324
+ (0, import_react348.useEffect)(() => (0, import_core26.onRecordChanged)(() => reload()), [reload]);
60311
60325
  return { q, page };
60312
60326
  }
60313
60327
  function BlockBody(inner2) {
@@ -61239,7 +61253,7 @@ function onePerKey3(all) {
61239
61253
  }
61240
61254
 
61241
61255
  // src/printPage.ts
61242
- var import_core26 = require("@ai-matrx/print/core");
61256
+ var import_core27 = require("@ai-matrx/print/core");
61243
61257
  var PAGE_PRINT_STYLES = `
61244
61258
  .page-print-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
61245
61259
  .page-print-grid > * { grid-column: span 12; break-inside: avoid; }
@@ -61250,7 +61264,7 @@ function printRecordsPage(element, title) {
61250
61264
  const copy = element.cloneNode(true);
61251
61265
  copy.querySelectorAll("button, input, select, textarea, iframe, [data-records-page-settings], [data-records-page-csv]").forEach((n) => n.remove());
61252
61266
  copy.classList.add("page-print-grid");
61253
- return (0, import_core26.openPrintWindow)((0, import_core26.buildPrintDocument)(`<h1>${escapeText2(title)}</h1>${copy.innerHTML}`, title, PAGE_PRINT_STYLES), title);
61267
+ return (0, import_core27.openPrintWindow)((0, import_core27.buildPrintDocument)(`<h1>${escapeText2(title)}</h1>${copy.innerHTML}`, title, PAGE_PRINT_STYLES), title);
61254
61268
  }
61255
61269
  function escapeText2(text) {
61256
61270
  return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -63117,7 +63131,7 @@ function CalendarSubscribeDialog({
63117
63131
 
63118
63132
  // src/viewShare.ts
63119
63133
  var import_clipboard15 = require("@ai-matrx/kit/clipboard");
63120
- var import_core27 = require("@ai-matrx/print/core");
63134
+ var import_core28 = require("@ai-matrx/print/core");
63121
63135
  var import_markdown = require("@ai-matrx/print/markdown");
63122
63136
  init_objectActions();
63123
63137
  var NO_VIEW_REASON = "No saved view yet";
@@ -63242,7 +63256,7 @@ async function runTablePageAction(kind2, args) {
63242
63256
  }
63243
63257
  const page = (0, import_markdown.renderMarkdownDocument)(markdown, { title, withPrintActions: kind2 === "html-preview" });
63244
63258
  if (kind2 === "html-preview") {
63245
- (0, import_core27.openPrintWindow)(page, title);
63259
+ (0, import_core28.openPrintWindow)(page, title);
63246
63260
  if (note) args.host.notify?.success(note);
63247
63261
  } else if (kind2 === "copy-html-page") {
63248
63262
  if (await (0, import_clipboard15.copyText)(page)) args.host.notify?.success(note ?? "HTML page copied");