@sincpro/web-framework 1.1.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +188 -87
  2. package/dist/core/cache.d.ts +1 -2
  3. package/dist/core/cache.js +8 -5
  4. package/dist/core/explain.d.ts +15 -0
  5. package/dist/core/{transport.js → explain.js} +4 -26
  6. package/dist/core/form.d.ts +1 -1
  7. package/dist/core/form.js +1 -0
  8. package/dist/core/index.d.ts +9 -15
  9. package/dist/core/index.js +8 -14
  10. package/dist/core/list.d.ts +5 -4
  11. package/dist/core/list.js +1 -0
  12. package/dist/core/lookup.d.ts +1 -1
  13. package/dist/core/lookup.js +1 -0
  14. package/dist/core/present.d.ts +1 -0
  15. package/dist/core/present.js +54 -6
  16. package/dist/core/relation.d.ts +1 -1
  17. package/dist/core/relation.js +1 -1
  18. package/dist/core/summary.d.ts +1 -6
  19. package/dist/core/trail.d.ts +1 -1
  20. package/dist/core/trail.js +1 -0
  21. package/dist/errors/index.d.ts +48 -0
  22. package/dist/errors/index.js +56 -0
  23. package/dist/react/context.d.ts +6 -4
  24. package/dist/react/context.js +11 -3
  25. package/dist/react/index.d.ts +2 -0
  26. package/dist/react/index.js +2 -0
  27. package/dist/react/scope.d.ts +1 -1
  28. package/dist/react/scope.js +1 -1
  29. package/dist/react/useCommand.d.ts +1 -1
  30. package/dist/react/useCommand.js +1 -2
  31. package/dist/react/useContextValues.d.ts +15 -0
  32. package/dist/react/useContextValues.js +19 -0
  33. package/dist/react/useGroups.js +2 -2
  34. package/dist/react/useHistory.d.ts +1 -1
  35. package/dist/react/useHistory.js +3 -2
  36. package/dist/react/useListing.d.ts +4 -4
  37. package/dist/react/useListing.js +16 -7
  38. package/dist/react/useLookup.d.ts +1 -1
  39. package/dist/react/useLookup.js +3 -2
  40. package/dist/react/useNameOf.d.ts +1 -1
  41. package/dist/react/useNameOf.js +3 -3
  42. package/dist/react/usePivot.js +2 -2
  43. package/dist/react/useRecord.d.ts +1 -2
  44. package/dist/react/useRecord.js +18 -6
  45. package/dist/react/useRelated.d.ts +1 -1
  46. package/dist/react/useRelated.js +1 -0
  47. package/dist/react/useService.d.ts +38 -0
  48. package/dist/react/useService.js +66 -0
  49. package/dist/react/useSummary.d.ts +1 -1
  50. package/dist/react/useSummary.js +1 -0
  51. package/dist/telemetry/index.d.ts +45 -0
  52. package/dist/telemetry/index.js +55 -0
  53. package/dist/web/Refused.js +1 -1
  54. package/dist/web/index.d.ts +1 -1
  55. package/dist/web/index.js +1 -1
  56. package/dist/web/list/EntityList.d.ts +1 -1
  57. package/dist/web/list/EntityList.js +3 -3
  58. package/dist/web/list/EntitySearchBar.d.ts +2 -1
  59. package/dist/web/list/EntitySearchBar.js +17 -11
  60. package/dist/web/list/presentation.d.ts +1 -1
  61. package/dist/web/list/presentation.js +1 -0
  62. package/dist/web/list/rowCommands.d.ts +1 -1
  63. package/dist/web/list/rowCommands.js +1 -2
  64. package/dist/web/record/CommandButton.d.ts +1 -1
  65. package/dist/web/record/CommandButton.js +1 -0
  66. package/dist/web/record/EntityPicker.d.ts +8 -5
  67. package/dist/web/record/EntityPicker.js +6 -5
  68. package/dist/web/record/EntityTags.d.ts +1 -1
  69. package/dist/web/record/EntityTags.js +1 -0
  70. package/dist/web/record/RelatedList.d.ts +1 -1
  71. package/dist/web/record/RelatedList.js +1 -0
  72. package/dist/web/record/control.d.ts +4 -2
  73. package/dist/web/record/control.js +8 -5
  74. package/dist/web/record/edit.js +21 -1
  75. package/dist/web/record/lines.js +13 -2
  76. package/dist/web/record/opening.d.ts +1 -1
  77. package/dist/web/record/opening.js +1 -0
  78. package/dist/web/record/record.d.ts +12 -2
  79. package/dist/web/record/record.js +10 -2
  80. package/dist/web/workspace/SincproApp.d.ts +9 -20
  81. package/dist/web/workspace/SincproApp.js +17 -4
  82. package/dist/web/workspace/composer.d.ts +1 -2
  83. package/dist/web/workspace/composer.js +2 -2
  84. package/dist/web/workspace/open.d.ts +1 -1
  85. package/dist/web/workspace/open.js +1 -0
  86. package/dist/web/workspace/record.d.ts +60 -13
  87. package/dist/web/workspace/record.js +89 -28
  88. package/dist/web/workspace/workspace.d.ts +1 -1
  89. package/dist/web/workspace/workspace.js +1 -0
  90. package/package.json +45 -15
  91. package/dist/codegen/cli.d.ts +0 -2
  92. package/dist/codegen/cli.js +0 -82
  93. package/dist/codegen/client.d.ts +0 -14
  94. package/dist/codegen/client.js +0 -178
  95. package/dist/codegen/domain.d.ts +0 -14
  96. package/dist/codegen/domain.js +0 -195
  97. package/dist/codegen/entities.d.ts +0 -14
  98. package/dist/codegen/entities.js +0 -158
  99. package/dist/codegen/index.d.ts +0 -11
  100. package/dist/codegen/index.js +0 -9
  101. package/dist/codegen/metamodel.d.ts +0 -89
  102. package/dist/codegen/metamodel.js +0 -1
  103. package/dist/codegen/names.d.ts +0 -40
  104. package/dist/codegen/names.js +0 -114
  105. package/dist/codegen/rest.d.ts +0 -31
  106. package/dist/codegen/rest.js +0 -27
  107. package/dist/core/contract.d.ts +0 -34
  108. package/dist/core/contract.js +0 -41
  109. package/dist/core/discovery.d.ts +0 -47
  110. package/dist/core/discovery.js +0 -68
  111. package/dist/core/entity.d.ts +0 -227
  112. package/dist/core/entity.js +0 -187
  113. package/dist/core/ids.d.ts +0 -17
  114. package/dist/core/ids.js +0 -52
  115. package/dist/core/memory.d.ts +0 -46
  116. package/dist/core/memory.js +0 -108
  117. package/dist/core/meta.d.ts +0 -121
  118. package/dist/core/meta.js +0 -130
  119. package/dist/core/metas.d.ts +0 -17
  120. package/dist/core/metas.js +0 -7
  121. package/dist/core/rest.d.ts +0 -49
  122. package/dist/core/rest.js +0 -143
  123. package/dist/core/retry.d.ts +0 -24
  124. package/dist/core/retry.js +0 -25
  125. package/dist/core/schema.d.ts +0 -39
  126. package/dist/core/schema.js +0 -128
  127. package/dist/core/transport.d.ts +0 -90
  128. package/dist/core/zone.d.ts +0 -27
  129. package/dist/core/zone.js +0 -75
@@ -1,5 +1,5 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord, Criteria } from "@sincpro/criteria";
2
- import type { Entity } from "../../core/entity.js";
3
3
  import { type ListDefinition } from "../../core/list.js";
4
4
  import { type OpenTarget } from "@sincpro/web-ui";
5
5
  /**
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { isList } from "../../core/list.js";
4
5
  import { useFramework } from "../../react/context.js";
5
6
  import { excluding, useLookup } from "../../react/useLookup.js";
@@ -1,5 +1,5 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord } from "@sincpro/criteria";
2
- import type { Entity } from "../../core/entity.js";
3
3
  import type { RecordReading } from "../../react/useRecord.js";
4
4
  import { type EntityListProps } from "../list/EntityList.js";
5
5
  /**
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { frameworkCopy } from "../../core/copy.js";
4
5
  import { defaultFields } from "../../core/present.js";
5
6
  import { useRelated } from "../../react/useRelated.js";
@@ -1,5 +1,5 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord } from "@sincpro/criteria";
2
- import type { Entity } from "../../core/entity.js";
3
3
  import type { ReactNode } from "react";
4
4
  /** What a control of a field receives: its value, how to change it, and its state now. */
5
5
  export type FieldControl = {
@@ -32,12 +32,14 @@ export declare function controlFor(control: FieldControl, type: string, exact: b
32
32
  * workspace's chooser (`RecordLinesEditor`), so «Buscar más…» is the picker's own there;
33
33
  * `ownChooser` asks for it anywhere else.
34
34
  */
35
- export declare function RelationPicker({ target, value, onChange, label, ownChooser, standalone, }: {
35
+ export declare function RelationPicker({ target, value, onChange, label, ownChooser, standalone, onClear, }: {
36
36
  target: Entity;
37
37
  value: string;
38
38
  onChange: (id: string, chosen?: AnyRecord) => void;
39
39
  label: string;
40
40
  ownChooser?: boolean;
41
+ /** The choice can be removed — a field that is not required. */
42
+ onClear?: () => void;
41
43
  /** No `Field` names it (a cell): it carries `label` itself — as `FieldControl.standalone`. */
42
44
  standalone?: boolean;
43
45
  }): import("react").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { instantOf, timeZoneNow, wallTimeOf } from "../../core/zone.js";
3
+ import { dayOf, instantOf, timeZoneNow, wallTimeOf, } from "@sincpro/client-framework";
4
4
  import { EntityPicker } from "./EntityPicker.js";
5
5
  import { Checkbox, DatePicker, DateTimePicker, NumberInput, Select, TagsField, TextInput, } from "@sincpro/web-ui";
6
6
  /**
@@ -28,8 +28,11 @@ export function controlFor(control, type, exact, choices) {
28
28
  const zone = timeZoneNow();
29
29
  return (_jsx(DateTimePicker, { value: typeof value === "string" && value !== "" ? wallTimeOf(value, zone) : null, onChange: (wall) => set(wall === null ? null : instantOf(wall, zone)), ...named }));
30
30
  }
31
- case "date":
32
- return (_jsx(DatePicker, { value: typeof value === "string" && value !== "" ? value : null, onChange: set, ...named }));
31
+ case "date": {
32
+ // «Today» is the business's day, on the installed zone — never the browser's.
33
+ const today = dayOf(new Date().toISOString(), timeZoneNow());
34
+ return (_jsx(DatePicker, { ...(today === null ? {} : { today }), value: typeof value === "string" && value !== "" ? value : null, onChange: set, ...named }));
35
+ }
33
36
  case "text[]": {
34
37
  // A list of words is chips: each word is its own key, and typing a new one adds it.
35
38
  const words = Array.isArray(value) ? value.map(String) : [];
@@ -48,10 +51,10 @@ export function controlFor(control, type, exact, choices) {
48
51
  * workspace's chooser (`RecordLinesEditor`), so «Buscar más…» is the picker's own there;
49
52
  * `ownChooser` asks for it anywhere else.
50
53
  */
51
- export function RelationPicker({ target, value, onChange, label, ownChooser = false, standalone = false, }) {
54
+ export function RelationPicker({ target, value, onChange, label, ownChooser = false, standalone = false, onClear, }) {
52
55
  // Opening the chosen record and «Buscar más…» are the workspace's when there is one: the
53
56
  // picker reads it (`RecordOpening`); a line keeps its own chooser.
54
57
  return (_jsx(EntityPicker, { entity: target, value: value, onChange: onChange,
55
58
  // «Buscar más…» is an option of the picker already: no second button beside it.
56
- browse: false, ownChooser: ownChooser, ...(standalone ? { "aria-label": label } : {}) }));
59
+ browse: false, ownChooser: ownChooser, ...(onClear === undefined ? {} : { onClear }), ...(standalone ? { "aria-label": label } : {}) }));
57
60
  }
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { choicesOf } from "@sincpro/criteria";
4
5
  import { frameworkCopy } from "../../core/copy.js";
5
6
  import { errorAt } from "../../core/edit.js";
@@ -62,6 +63,17 @@ export function RecordField({ record, name, as, bare = false, lines: look, list:
62
63
  // A one2many of no declared entity (the lines of an invoice): edited inside the record as a
63
64
  // whole list (`RecordLinesEditor`) — or, when the record brought only a page, that page read
64
65
  // only with its real total.
66
+ // A list of values inside the record (`field.embedded(definition, { many: true })`: a
67
+ // project's channels, an inventory's components) — no model of its own, no id — is edited the
68
+ // same way as lines: a whole list, local keys, through the record's own save.
69
+ const own = meta?.fields[name];
70
+ if (as === undefined && own?.type === "embedded" && own.many === true && own.definition) {
71
+ // A page of them stays read only, as a one2many's: written back whole it would drop what
72
+ // it did not bring.
73
+ const whole = editableLines(edit.values[name]);
74
+ const lines = whole === null ? (_jsx(RecordLines, { record: record.record ?? {}, meta: meta, name: name, locale: locale })) : (_jsx(RecordLinesEditor, { record: record, name: name, lines: whole, ...(look === undefined ? {} : { look }) }));
75
+ return bare ? lines : _jsx(FormSection, { title: view.label, children: lines });
76
+ }
65
77
  if (as === undefined && relation?.field.type === "one2many" && target === undefined) {
66
78
  // Editable when the record holds ALL its lines; a page of them stays read only.
67
79
  const whole = editableLines(edit.values[name]);
@@ -118,7 +130,15 @@ export function RecordField({ record, name, as, bare = false, lines: look, list:
118
130
  return _jsx(KeyValue, { target: target, id: id, ...opens });
119
131
  return (_jsx(RelationValue, { name: textOf(meta, relation.relation, edit.values[relation.relation], locale) ?? id, ...opens }));
120
132
  }
121
- return (_jsx(RelationPicker, { target: target, value: id, onChange: (next) => edit.set(relation.key, next), label: view.label }));
133
+ return (_jsx(RelationPicker, { target: target, value: id, onChange: (next) => edit.set(relation.key, next), label: view.label, ...(state.required || edit.state(relation.key).required
134
+ ? {}
135
+ : {
136
+ onClear: () => {
137
+ edit.set(relation.key, null);
138
+ if (relation.held)
139
+ edit.set(relation.relation, null);
140
+ },
141
+ }) }));
122
142
  }
123
143
  if (view.type === "boolean" && as === undefined)
124
144
  return (_jsx(Checkbox, { checked: value === true, onChange: control.set, label: view.label, disabled: state.readonly }));
@@ -48,7 +48,14 @@ function LineValue({ definition, field, line, set, label, invalid, locale, inCel
48
48
  // would put the record IN the key.
49
49
  write(relation.held
50
50
  ? { [relation.key]: id, [relation.relation]: chosen ?? null }
51
- : { [relation.key]: id }) }));
51
+ : { [relation.key]: id }), ...(definition?.fields[relation.key]?.required === true ||
52
+ definition?.fields[relation.key]?.required_when !== undefined
53
+ ? {}
54
+ : {
55
+ onClear: () => write(relation.held
56
+ ? { [relation.key]: null, [relation.relation]: null }
57
+ : { [relation.key]: null }),
58
+ }) }));
52
59
  }
53
60
  return controlFor({
54
61
  value: line[field],
@@ -92,7 +99,11 @@ export function RecordLinesEditor({ record, name, lines, look = {}, }) {
92
99
  const { entities, metas } = useFramework();
93
100
  const opening = useRecordOpening();
94
101
  const definition = meta?.fields[name]?.definition ?? null;
95
- const identity = definition?.identity || "id";
102
+ // A value inside the record (an embedded list) has no identity of its own: every line is
103
+ // keyed locally — falling back to `id` would key it by whatever it holds under that name.
104
+ const identity = meta?.fields[name]?.type === "embedded"
105
+ ? (definition?.identity ?? "")
106
+ : definition?.identity || "id";
96
107
  const fields = lineFields(definition);
97
108
  const shown = look.columns === undefined ? fields : look.columns.filter((one) => fields.includes(one));
98
109
  const controls = look.controls ?? {};
@@ -1,5 +1,5 @@
1
+ import { type Entity, type EntityRef } from "@sincpro/client-framework";
1
2
  import { type AnyRecord, type Criteria, type Expression } from "@sincpro/criteria";
2
- import type { Entity, EntityRef } from "../../core/entity.js";
3
3
  import { type ListDefinition } from "../../core/list.js";
4
4
  import type { OpenTarget } from "@sincpro/web-ui";
5
5
  import { type ReactNode } from "react";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { merge } from "@sincpro/criteria";
4
5
  import { isList, scopeOf } from "../../core/list.js";
5
6
  import { createContext, useContext } from "react";
@@ -1,5 +1,5 @@
1
1
  import { type AnyRecord, type Meta } from "@sincpro/criteria";
2
- import { type SheetField } from "@sincpro/web-ui";
2
+ import { type RowAction, type SheetField } from "@sincpro/web-ui";
3
3
  import type { ReactNode } from "react";
4
4
  export declare function factsOf<T extends AnyRecord>(record: T, meta: Meta | null | undefined, names: readonly string[], options?: {
5
5
  locale?: string | undefined;
@@ -13,8 +13,16 @@ export declare function countOf(record: AnyRecord, name: string): number;
13
13
  * Its columns come from the relation's own definition when the server expanded it, and are
14
14
  * read off the rows otherwise. When the record brought only one page of them, it says so —
15
15
  * «se muestran 50 de 1000» — instead of drawing 50 as if they were all.
16
+ *
17
+ * `rowActions` acts on a part from its row — a group's member, a project's share — with a
18
+ * Command of the record (`useCommand(projects, "unshareProject")`): the parts have no route of
19
+ * their own, so what removes one is the record's, and the screen names it.
20
+ *
21
+ * <RecordLines record={project} meta={meta} name="shares"
22
+ * rowActions={(share) => [{ id: "unshare", label: "Quitar", icon: X, tone: "danger",
23
+ * onSelect: () => unshare.run(project.id, { tenant_id: share.tenant_id }) }]} />
16
24
  */
17
- export declare function RecordLines<T extends AnyRecord>({ record, meta, name, columns, cells, locale, onOpen, }: {
25
+ export declare function RecordLines<T extends AnyRecord>({ record, meta, name, columns, cells, locale, onOpen, rowActions, }: {
18
26
  record: AnyRecord;
19
27
  meta: Meta | null | undefined;
20
28
  name: string;
@@ -22,4 +30,6 @@ export declare function RecordLines<T extends AnyRecord>({ record, meta, name, c
22
30
  cells?: Readonly<Partial<Record<string, (row: T) => ReactNode>>>;
23
31
  locale?: string | undefined;
24
32
  onOpen?: (row: T) => void;
33
+ /** What a row's part can be acted on with — a Command of the record. */
34
+ rowActions?: (row: T) => readonly RowAction[];
25
35
  }): import("react").JSX.Element;
@@ -46,11 +46,19 @@ export function countOf(record, name) {
46
46
  * Its columns come from the relation's own definition when the server expanded it, and are
47
47
  * read off the rows otherwise. When the record brought only one page of them, it says so —
48
48
  * «se muestran 50 de 1000» — instead of drawing 50 as if they were all.
49
+ *
50
+ * `rowActions` acts on a part from its row — a group's member, a project's share — with a
51
+ * Command of the record (`useCommand(projects, "unshareProject")`): the parts have no route of
52
+ * their own, so what removes one is the record's, and the screen names it.
53
+ *
54
+ * <RecordLines record={project} meta={meta} name="shares"
55
+ * rowActions={(share) => [{ id: "unshare", label: "Quitar", icon: X, tone: "danger",
56
+ * onSelect: () => unshare.run(project.id, { tenant_id: share.tenant_id }) }]} />
49
57
  */
50
- export function RecordLines({ record, meta, name, columns, cells, locale, onOpen, }) {
58
+ export function RecordLines({ record, meta, name, columns, cells, locale, onOpen, rowActions, }) {
51
59
  const related = relatedOf(record[name]);
52
60
  const definition = meta?.fields[name]?.definition ?? describeRows(related.items);
53
61
  const identity = definition.identity || "id";
54
62
  const copy = frameworkCopy();
55
- return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(List, { embedded: true, items: related.items, keyOf: (row) => String(row[identity]), present: "table", empty: { sentence: copy.list.empty }, ...(onOpen === undefined ? {} : { onOpen }), children: _jsx(List.Table, { columns: columnsOf(definition, columns, { locale, ...(cells ? { cells } : {}) }) }) }), related.partial ? (_jsx("p", { className: "text-meta text-muted", children: copy.record.partial(related.items.length, related.count.value) })) : null] }));
63
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(List, { embedded: true, items: related.items, keyOf: (row) => String(row[identity]), present: "table", empty: { sentence: copy.list.empty }, ...(onOpen === undefined ? {} : { onOpen }), children: _jsx(List.Table, { columns: columnsOf(definition, columns, { locale, ...(cells ? { cells } : {}) }), ...(rowActions === undefined ? {} : { rowActions }) }) }), related.partial ? (_jsx("p", { className: "text-meta text-muted", children: copy.record.partial(related.items.length, related.count.value) })) : null] }));
56
64
  }
@@ -1,26 +1,9 @@
1
+ import { type Entity, type Transport } from "@sincpro/client-framework";
1
2
  import type { Meta } from "@sincpro/criteria";
2
- import { type ComposerSkin, type ResourceRef, type ViewSpec, type WorkspaceStore } from "@sincpro/web-composer";
3
+ import { type ComposerSkin, type OnViewError, type ResourceRef, type ViewSpec, type WorkspaceStore } from "@sincpro/web-composer";
3
4
  import { type CacheOptions } from "../../core/cache.js";
4
- import type { Entity } from "../../core/entity.js";
5
- import type { Transport } from "../../core/transport.js";
6
5
  import { type ReactNode } from "react";
7
- /**
8
- * The application context in one place: who answers (the transport), in which language, which
9
- * model definitions are already known, the toasts, and the workspace with its views, ⌘K and
10
- * shortcuts.
11
- *
12
- * Context: forge's `main.tsx` + `console.tsx` installed three copy tables, a toast provider, a
13
- * context of its own and a composer by hand. This is that, once. It is a convenience, not the
14
- * only door: everything it mounts is exported, and an app with its own shell mounts them itself.
15
- * What it does NOT own: the session (the app builds the transport with its headers) and what the
16
- * application bar says. The bar is the app's (`bar`), drawn above the workspace inside every
17
- * provider; a menu in it opens views through the workspace the app holds (`workspace`, from
18
- * composer's `useWorkspace()`) — a workspace owned in here could not be reached from outside.
19
- *
20
- * const workspace = useWorkspace();
21
- * <SincproApp workspace={workspace} bar={<Menu onOpen={(ref) => workspace.push(ref)} />} … />
22
- */
23
- export declare function SincproApp({ transport, views, start, language, metas, entities, empty, skin, cache, timeZone, workspace: given, bar, }: {
6
+ export declare function SincproApp({ transport, views, start, language, metas, entities, empty, skin, cache, timeZone, workspace: given, bar, onViewError, }: {
24
7
  transport: Transport;
25
8
  /** The entities as composer views — `entityView(…)` — and any other view of the app. */
26
9
  views: readonly ViewSpec[];
@@ -51,4 +34,10 @@ export declare function SincproApp({ transport, views, start, language, metas, e
51
34
  /** The application's bar, above the workspace and inside the providers: its menus may read
52
35
  * the framework (`useFramework`) and open views through `workspace`. */
53
36
  bar?: ReactNode;
37
+ /**
38
+ * Told when a view breaks while drawing. By default it reaches the process's error reporter
39
+ * (`reportError`, @sincpro/client-framework) — the one the use cases report to — as
40
+ * `view <ref>`; without a reporter configured, nothing is sent.
41
+ */
42
+ onViewError?: OnViewError;
54
43
  }): import("react").JSX.Element;
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { processContext, reportError, } from "@sincpro/client-framework";
3
4
  import { Composer, installComposerCopy, SPANISH_COMPOSER_COPY, useWorkspace, } from "@sincpro/web-composer";
4
- import { createRegistry } from "@sincpro/web-composer/domain";
5
- import { cachedTransport } from "../../core/cache.js";
5
+ import { createRegistry, formatRef } from "@sincpro/web-composer/domain";
6
+ import { cachedTransport, } from "../../core/cache.js";
6
7
  import { installFrameworkCopy, SPANISH_FRAMEWORK_COPY, } from "../../core/copy.js";
7
8
  import { FrameworkProvider } from "../../react/context.js";
8
9
  import { webUiSkin } from "./skin.js";
@@ -24,7 +25,9 @@ import { useEffect, useMemo, useState } from "react";
24
25
  * const workspace = useWorkspace();
25
26
  * <SincproApp workspace={workspace} bar={<Menu onOpen={(ref) => workspace.push(ref)} />} … />
26
27
  */
27
- export function SincproApp({ transport, views, start, language = "es", metas, entities, empty, skin = webUiSkin, cache = {}, timeZone, workspace: given, bar, }) {
28
+ /** A view that broke while drawing, told to the process's error reporter: `view <ref>`. */
29
+ const reportViewError = (error, { resource }) => reportError(error, `view ${formatRef(resource)}`);
30
+ export function SincproApp({ transport, views, start, language = "es", metas, entities, empty, skin = webUiSkin, cache = {}, timeZone, workspace: given, bar, onViewError = reportViewError, }) {
28
31
  // Installed once, before anything draws: the three tables are module state of their packages.
29
32
  useState(() => {
30
33
  if (language === "es") {
@@ -43,6 +46,16 @@ export function SincproApp({ transport, views, start, language = "es", metas, en
43
46
  // The options are read once: a cache that changes shape mid-session forgets everything.
44
47
  // eslint-disable-next-line react-hooks/exhaustive-deps
45
48
  [transport]);
49
+ // What was read in one company is not the other's: a change of context forgets every answer
50
+ // before the screens read again (`FrameworkProvider` gives them another transport).
51
+ useEffect(() => {
52
+ if (cache === false)
53
+ return;
54
+ const forgetting = cached;
55
+ return processContext.watch(() => forgetting.invalidate());
56
+ // The cache is read once, as `cached` is.
57
+ // eslint-disable-next-line react-hooks/exhaustive-deps
58
+ }, [cached]);
46
59
  const own = useWorkspace();
47
60
  const workspace = given ?? own;
48
61
  const registry = useMemo(() => createRegistry(views), [views]);
@@ -52,5 +65,5 @@ export function SincproApp({ transport, views, start, language = "es", metas, en
52
65
  // The first screen only: a re-render must not push it again.
53
66
  // eslint-disable-next-line react-hooks/exhaustive-deps
54
67
  }, [workspace]);
55
- return (_jsx(FrameworkProvider, { transport: cached, locale: language, ...(metas === undefined ? {} : { metas }), ...(entities === undefined ? {} : { entities }), ...(timeZone === undefined ? {} : { timeZone }), children: _jsx(ToastProvider, { children: _jsxs("div", { className: "flex h-dvh min-h-0 flex-col bg-ground", children: [bar, _jsx("div", { className: "flex min-h-0 flex-1 flex-col", children: _jsx(Composer, { workspace: workspace, registry: registry, skin: skin, ...(empty === undefined ? {} : { empty }) }) })] }) }) }));
68
+ return (_jsx(FrameworkProvider, { transport: cached, locale: language, ...(metas === undefined ? {} : { metas }), ...(entities === undefined ? {} : { entities }), ...(timeZone === undefined ? {} : { timeZone }), children: _jsx(ToastProvider, { children: _jsxs("div", { className: "flex h-dvh min-h-0 flex-col bg-ground", children: [bar, _jsx("div", { className: "flex min-h-0 flex-1 flex-col", children: _jsx(Composer, { workspace: workspace, registry: registry, skin: skin, onViewError: onViewError, ...(empty === undefined ? {} : { empty }) }) })] }) }) }));
56
69
  }
@@ -1,8 +1,7 @@
1
+ import { type Entity, type Transport } from "@sincpro/client-framework";
1
2
  import { type AnyRecord, type Meta } from "@sincpro/criteria";
2
3
  import type { ViewProps, ViewSpec } from "@sincpro/web-composer";
3
- import { type Entity } from "../../core/entity.js";
4
4
  import type { ListDefinition } from "../../core/list.js";
5
- import type { Transport } from "../../core/transport.js";
6
5
  import { type ComponentType } from "react";
7
6
  /**
8
7
  * An entity as the composer's view: one `ViewSpec` for its list (a reference without an id)
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { listRoute, NEW_PARAM, scopeOfRef, } from "@sincpro/client-framework";
3
4
  import { matching } from "@sincpro/criteria";
4
- import { listRoute, NEW_PARAM, scopeOfRef, } from "../../core/entity.js";
5
5
  import { lookupOf } from "../../core/lookup.js";
6
6
  import { ListScopeProvider } from "../../react/scope.js";
7
7
  import { useListing } from "../../react/useListing.js";
@@ -57,7 +57,7 @@ export function entityView(entity, options) {
57
57
  // A chooser opened by a picker offers only what the picker may choose: its cut travels in
58
58
  // the reference, and the list — the application's own too — reads under it.
59
59
  const cut = record ? undefined : scopeOfRef(props.resource);
60
- const list = cut === undefined ? (_jsx(List, { ...props })) : (_jsx(ListScopeProvider, { value: { key: entity.key, where: cut }, children: _jsx(List, { ...props }) }));
60
+ const list = cut === undefined ? (_jsx(List, { ...props })) : (_jsx(ListScopeProvider, { value: { key: entity.key, selection: cut }, children: _jsx(List, { ...props }) }));
61
61
  return _jsx(InWorkspace, { api: props.api, children: record ? _jsx(One, { ...props }) : list });
62
62
  };
63
63
  }
@@ -1,6 +1,6 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord, Meta } from "@sincpro/criteria";
2
3
  import type { ResourceRef, WorkspaceApi } from "@sincpro/web-composer";
3
- import type { Entity } from "../../core/entity.js";
4
4
  import { type OpenTarget } from "@sincpro/web-ui";
5
5
  import type { ReactNode } from "react";
6
6
  /**
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { useSummaryOf } from "../../react/useSummary.js";
4
5
  import { openOptions, targetsFor } from "../list/openIn.js";
5
6
  import { relationOf } from "../record/summary.js";
@@ -1,24 +1,71 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord } from "@sincpro/criteria";
2
3
  import { type ViewProps } from "@sincpro/web-composer";
3
- import { type Entity } from "../../core/entity.js";
4
4
  import { type RecordReading } from "../../react/useRecord.js";
5
5
  import { type ReactNode } from "react";
6
+ /** Who made a record, or changed it last, and when: `Record.Audit`'s. */
7
+ export type Stamp = {
8
+ at: string;
9
+ by?: string;
10
+ };
6
11
  /**
7
- * The record of an entity, drawn from its model — the screen `entityView` opens when the
8
- * application writes none: in the page, a modal, the preview or a panel, the same.
12
+ * What every record screen in a workspace does before drawing its own — what `EntityRecord`
13
+ * does, as values: read the record for editing, follow the workspace's breadcrumb, tell the
14
+ * workspace its name and its unsaved work, read its history, step to its neighbours in the list
15
+ * it was opened from, and say its name, state, unsaved work, refusal and authorship the way
16
+ * web-ui's `Record` takes them.
9
17
  *
10
- * Context: every Sincpro record screen was the same hundred lines: read it, tell the workspace
11
- * its name and its unsaved work, draw its name and state on top, its fields, its lines, the
12
- * conflict and the restored draft, who made it, its history. Here once, from what the model and
13
- * the entity already say (`formOf`, `summaryOf`): a new entity has a useful screen before anyone
14
- * writes it. It is a default, not a cage — `fields`/`pages` choose and order, `actions` puts the
15
- * record's commands, and any screen can drop this and keep `useRecord` + `RecordField`.
18
+ * function InvoiceScreen(props: ViewProps) {
19
+ * const screen = useRecordScreen(invoices, props);
20
+ * if (screen.reading.status !== "ready") return <Skeleton rows={6} />;
21
+ * return (
22
+ * <Record {...screen.record}>
23
+ * <Record.Rail>
24
+ * <Record.Crumbs crumbs={screen.crumbs} />
25
+ * {screen.pager ? <Record.Pager {...screen.pager} /> : null}
26
+ * </Record.Rail>
27
+ * <Record.Paper>…your own fields…</Record.Paper>
28
+ * </Record>
29
+ * );
30
+ * }
16
31
  *
17
- * entityView(invoices, { transport, name: "Facturas" }) // this screen
18
- * entityView(invoices, { …, record: (props) =>
19
- * <EntityRecord {...props} entity={invoices} fields={["customer_id", "due_date"]}
20
- * actions={(invoice) => <CommandButton entity={invoices} command="post" … />} /> })
32
+ * Context: the level between `EntityRecord` and `useRecord` — a screen of its own keeps every
33
+ * behaviour of the framework's record and writes its own tree. It answers PROPS, never
34
+ * components: web-ui finds a record's regions by type (`Record.Crumbs` a direct child of
35
+ * `Record.Rail`), and a region wrapped in one of ours is not found. Before it, forge's console
36
+ * carried these 150 lines itself (`shared/record_screen.tsx`).
21
37
  */
38
+ export declare function useRecordScreen<T extends AnyRecord>(entity: Entity<T>, { api, resource }: Pick<ViewProps, "api" | "resource">): {
39
+ reading: RecordReading<T>;
40
+ crumbs: readonly import("@sincpro/web-composer").Crumb[];
41
+ history: import("../../index.js").HistoryEntry[] | undefined;
42
+ summary: import("../../index.js").RecordSummary | undefined;
43
+ /** web-ui `Record`'s own props: where it is drawn, its name, its unsaved work, its refusal. */
44
+ record: {
45
+ error?: string | undefined;
46
+ dirty?: import("@sincpro/web-ui").DirtyState | undefined;
47
+ placement: "page" | "card";
48
+ identity: {
49
+ tag?: {
50
+ label: string;
51
+ } | undefined;
52
+ subtitle?: string | undefined;
53
+ title: string;
54
+ };
55
+ };
56
+ /** `Record.Pager`'s props, when it was opened from a list and nothing is typed. */
57
+ pager: {
58
+ index: number;
59
+ total: number;
60
+ onPrev: () => void;
61
+ onNext: () => void;
62
+ } | undefined;
63
+ /** `Record.Audit`'s props, when the record says who made it or changed it. */
64
+ audit: {
65
+ updated?: Stamp | undefined;
66
+ created?: Stamp | undefined;
67
+ } | undefined;
68
+ };
22
69
  export declare function EntityRecord<T extends AnyRecord>({ api, resource, entity, fields, pages, actions, }: ViewProps & {
23
70
  entity: Entity<T>;
24
71
  /** The fields, in this order. Without it, the model's (`formOf`). */
@@ -1,9 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { TRAIL_PARAM } from "@sincpro/client-framework";
3
4
  import { labelOf, nameOf } from "@sincpro/criteria";
4
5
  import { useCrumbs } from "@sincpro/web-composer";
5
6
  import { frameworkCopy } from "../../core/copy.js";
6
- import { TRAIL_PARAM } from "../../core/entity.js";
7
+ import { explain } from "../../core/explain.js";
7
8
  import { formOf } from "../../core/form.js";
8
9
  import { placeOf, stepIn } from "../../core/trail.js";
9
10
  import { useFramework } from "../../react/context.js";
@@ -31,13 +32,44 @@ import { useState } from "react";
31
32
  * <EntityRecord {...props} entity={invoices} fields={["customer_id", "due_date"]}
32
33
  * actions={(invoice) => <CommandButton entity={invoices} command="post" … />} /> })
33
34
  */
34
- export function EntityRecord({ api, resource, entity, fields, pages, actions, }) {
35
+ /** A save's refusal as a sentence — its heading when the server gave no detail. */
36
+ function refusalOf(failure) {
37
+ const said = explain(failure);
38
+ return said.sentence || said.heading;
39
+ }
40
+ /**
41
+ * What every record screen in a workspace does before drawing its own — what `EntityRecord`
42
+ * does, as values: read the record for editing, follow the workspace's breadcrumb, tell the
43
+ * workspace its name and its unsaved work, read its history, step to its neighbours in the list
44
+ * it was opened from, and say its name, state, unsaved work, refusal and authorship the way
45
+ * web-ui's `Record` takes them.
46
+ *
47
+ * function InvoiceScreen(props: ViewProps) {
48
+ * const screen = useRecordScreen(invoices, props);
49
+ * if (screen.reading.status !== "ready") return <Skeleton rows={6} />;
50
+ * return (
51
+ * <Record {...screen.record}>
52
+ * <Record.Rail>
53
+ * <Record.Crumbs crumbs={screen.crumbs} />
54
+ * {screen.pager ? <Record.Pager {...screen.pager} /> : null}
55
+ * </Record.Rail>
56
+ * <Record.Paper>…your own fields…</Record.Paper>
57
+ * </Record>
58
+ * );
59
+ * }
60
+ *
61
+ * Context: the level between `EntityRecord` and `useRecord` — a screen of its own keeps every
62
+ * behaviour of the framework's record and writes its own tree. It answers PROPS, never
63
+ * components: web-ui finds a record's regions by type (`Record.Crumbs` a direct child of
64
+ * `Record.Rail`), and a region wrapped in one of ours is not found. Before it, forge's console
65
+ * carried these 150 lines itself (`shared/record_screen.tsx`).
66
+ */
67
+ export function useRecordScreen(entity, { api, resource }) {
35
68
  const reading = useRecord(entity, resource);
36
69
  const crumbs = useCrumbs(api);
37
70
  useRecordInWorkspace(api, reading);
38
71
  const history = useHistory(entity, reading.isNew ? "" : reading.id, [reading.record]);
39
72
  const summarize = useSummaryOf(entity);
40
- const [page, setPage] = useState(undefined);
41
73
  const copy = frameworkCopy().record;
42
74
  // Opened from a list: where it stands in it, and its neighbours (`Trail`).
43
75
  const { trails, transport } = useFramework();
@@ -55,6 +87,58 @@ export function EntityRecord({ api, resource, entity, fields, pages, actions, })
55
87
  api.replace({ ...ref, params: { ...ref.params, [TRAIL_PARAM]: trailKey } });
56
88
  });
57
89
  };
90
+ const ready = reading.status === "ready";
91
+ const summary = ready && !reading.isNew ? summarize(reading.record, reading.meta) : undefined;
92
+ const dirty = ready ? dirtyOf(reading) : undefined;
93
+ const failure = reading.edit.failure;
94
+ // Who, only when the record says it (an author is optional: the line then says only when).
95
+ const stamp = (one) => one?.at == null ? undefined : { at: one.at, ...(one.by == null ? {} : { by: one.by }) };
96
+ const created = stamp(summary?.created);
97
+ const updated = stamp(summary?.updated);
98
+ // Moving away with something typed would lose it: «save / discard» comes first.
99
+ const place = trail === undefined || reading.isNew || reading.edit.dirty
100
+ ? null
101
+ : placeOf(trail, reading.id);
102
+ return {
103
+ reading,
104
+ crumbs,
105
+ history,
106
+ summary,
107
+ /** web-ui `Record`'s own props: where it is drawn, its name, its unsaved work, its refusal. */
108
+ record: {
109
+ // Where it is mounted decides the paper, not what the rail carries: crumbs, pager and
110
+ // actions come and go while it is on screen, and the paper flipping with them remounted
111
+ // the form under the field being typed in. A modal is already a card.
112
+ placement: api.surface === "modal" ? "card" : "page",
113
+ identity: {
114
+ // A new record is «creating»; an existing one has no name until it is read.
115
+ title: summary?.name ??
116
+ (reading.isNew ? copy.creating(nameOf(reading.meta, reading.locale) || "") : ""),
117
+ ...(summary?.type == null ? {} : { subtitle: summary.type }),
118
+ ...(summary?.state == null ? {} : { tag: { label: summary.state } }),
119
+ },
120
+ ...(dirty === undefined ? {} : { dirty }),
121
+ // The refusal in words; its heading when the server said nothing more (no detail).
122
+ ...(failure === null || failure === undefined ? {} : { error: refusalOf(failure) }),
123
+ },
124
+ /** `Record.Pager`'s props, when it was opened from a list and nothing is typed. */
125
+ pager: place === null
126
+ ? undefined
127
+ : { index: place.index, total: place.total, onPrev: go(-1), onNext: go(1) },
128
+ /** `Record.Audit`'s props, when the record says who made it or changed it. */
129
+ audit: created === undefined && updated === undefined
130
+ ? undefined
131
+ : {
132
+ ...(created === undefined ? {} : { created }),
133
+ ...(updated === undefined ? {} : { updated }),
134
+ },
135
+ };
136
+ }
137
+ export function EntityRecord({ api, resource, entity, fields, pages, actions, }) {
138
+ const screen = useRecordScreen(entity, { api, resource });
139
+ const { reading, crumbs, history, pager } = screen;
140
+ const [page, setPage] = useState(undefined);
141
+ const copy = frameworkCopy().record;
58
142
  if (reading.status === "loading")
59
143
  return _jsx(Skeleton, { rows: 6, label: copy.loading });
60
144
  if (reading.status === "failed")
@@ -64,30 +148,7 @@ export function EntityRecord({ api, resource, entity, fields, pages, actions, })
64
148
  const shown = fields ?? layout.fields;
65
149
  const ownActions = actions?.(reading) ?? null;
66
150
  const tabs = pages ?? layout.pages;
67
- const summary = reading.isNew ? undefined : summarize(reading.record, meta);
68
- const dirty = dirtyOf(reading);
69
- const created = summary?.created;
70
- const updated = summary?.updated;
71
- // Who, only when the record says it (web-ui 1.9: an author is optional, the line then says
72
- // only when). The moment goes as the framework writes every fact of the record.
73
- const stamp = (one) => one?.at == null ? undefined : { at: one.at, ...(one.by == null ? {} : { by: one.by }) };
74
- const createdStamp = stamp(created);
75
- const updatedStamp = stamp(updated);
76
- // Moving away with something typed would lose it: «save / discard» comes first.
77
- const place = trail === undefined || reading.isNew || edit.dirty ? null : placeOf(trail, reading.id);
78
- return (_jsxs(Record
79
- // Where it is mounted decides the paper, not what the rail carries: crumbs, pager and
80
- // actions come and go while it is on screen (loading, a draft), and the paper flipping
81
- // with them remounted the form under the field being typed in. A modal is already a card.
82
- , {
83
- // Where it is mounted decides the paper, not what the rail carries: crumbs, pager and
84
- // actions come and go while it is on screen (loading, a draft), and the paper flipping
85
- // with them remounted the form under the field being typed in. A modal is already a card.
86
- placement: api.surface === "modal" ? "card" : "page", identity: {
87
- title: summary?.name ?? copy.creating(nameOf(meta, locale) || ""),
88
- ...(summary?.type == null ? {} : { subtitle: summary.type }),
89
- ...(summary?.state == null ? {} : { tag: { label: summary.state } }),
90
- }, ...(dirty === undefined ? {} : { dirty }), ...(edit.failure === null ? {} : { error: String(edit.failure.message) }), children: [crumbs.length === 0 && place === null && ownActions === null ? null : (_jsxs(Record.Rail, { children: [crumbs.length === 0 ? null : _jsx(Record.Crumbs, { crumbs: crumbs }), place === null ? null : (_jsx(Record.Pager, { index: place.index, total: place.total, onPrev: go(-1), onNext: go(1) })), ownActions === null ? null : _jsx(Record.Actions, { children: ownActions })] })), _jsxs(Record.Paper, { layout: "horizontal", children: [edit.conflict || edit.restored ? (_jsxs("div", { className: "flex flex-col gap-3", children: [edit.conflict ? (_jsx(Callout, { tone: "warn", title: copy.conflict, children: _jsx(Button, { size: "sm", role: "secondary", onClick: reading.reload, children: copy.reload }) })) : null, edit.restored ? (_jsx(Callout, { tone: "info", title: copy.restored, children: null })) : null] })) : null, _jsx(FormSection, { columns: api.surface === "page" || api.surface === "modal" ? 2 : 1, children: shown.map((name) => (_jsx(RecordField, { record: reading, name: name }, name))) }), edit.advice
151
+ return (_jsxs(Record, { ...screen.record, children: [crumbs.length === 0 && pager === undefined && ownActions === null ? null : (_jsxs(Record.Rail, { children: [crumbs.length === 0 ? null : _jsx(Record.Crumbs, { crumbs: crumbs }), pager === undefined ? null : _jsx(Record.Pager, { ...pager }), ownActions === null ? null : _jsx(Record.Actions, { children: ownActions })] })), _jsxs(Record.Paper, { layout: "horizontal", children: [edit.conflict || edit.restored ? (_jsxs("div", { className: "flex flex-col gap-3", children: [edit.conflict ? (_jsx(Callout, { tone: "warn", title: copy.conflict, children: _jsx(Button, { size: "sm", role: "secondary", onClick: reading.reload, children: copy.reload }) })) : null, edit.restored ? (_jsx(Callout, { tone: "info", title: copy.restored, children: null })) : null] })) : null, _jsx(FormSection, { columns: api.surface === "page" || api.surface === "modal" ? 2 : 1, children: shown.map((name) => (_jsx(RecordField, { record: reading, name: name }, name))) }), edit.advice
91
152
  .filter((one) => (one.path?.length ?? 0) <= 1)
92
- .map((one) => (_jsx(Callout, { tone: "info", title: one.message, children: null }, one.message))), tabs.length === 0 || reading.isNew ? null : (_jsx(Record.Pages, { current: page ?? tabs[0], onChange: setPage, children: tabs.map((name) => (_jsx(Record.Page, { id: name, label: labelOf(meta, name, locale), children: _jsx(RecordField, { record: reading, name: name, bare: true }) }, name))) })), createdStamp === undefined && updatedStamp === undefined ? null : (_jsx(Record.Audit, { ...(createdStamp === undefined ? {} : { created: createdStamp }), ...(updatedStamp === undefined ? {} : { updated: updatedStamp }) }))] }), history === undefined ? null : _jsx(Record.Activity, { events: history })] }));
153
+ .map((one) => (_jsx(Callout, { tone: "info", title: one.message, children: null }, one.message))), tabs.length === 0 || reading.isNew ? null : (_jsx(Record.Pages, { current: page ?? tabs[0], onChange: setPage, children: tabs.map((name) => (_jsx(Record.Page, { id: name, label: labelOf(meta, name, locale), children: _jsx(RecordField, { record: reading, name: name, bare: true }) }, name))) })), screen.audit === undefined ? null : _jsx(Record.Audit, { ...screen.audit })] }), history === undefined ? null : _jsx(Record.Activity, { events: history })] }));
93
154
  }
@@ -1,6 +1,6 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import { type AnyRecord } from "@sincpro/criteria";
2
3
  import { type WorkspaceApi } from "@sincpro/web-composer";
3
- import type { Entity } from "../../core/entity.js";
4
4
  import type { RecordReading } from "../../react/useRecord.js";
5
5
  /**
6
6
  * A record told to the workspace it is open in: its real name and whether it holds unsaved work.