@entifix/next-shell 0.20.2 → 0.21.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 (39) hide show
  1. package/README.md +16 -1
  2. package/dist/lib/crud/index.d.ts +1 -0
  3. package/dist/lib/crud/index.d.ts.map +1 -1
  4. package/dist/lib/crud/index.js +1 -0
  5. package/dist/lib/crud/index.js.map +1 -1
  6. package/dist/lib/crud/make-entity-crud.d.ts.map +1 -1
  7. package/dist/lib/crud/make-entity-crud.js +128 -58
  8. package/dist/lib/crud/make-entity-crud.js.map +1 -1
  9. package/dist/lib/crud/make-entity-crud.types.d.ts +68 -1
  10. package/dist/lib/crud/make-entity-crud.types.d.ts.map +1 -1
  11. package/dist/lib/crud/make-entity-crud.types.js.map +1 -1
  12. package/dist/lib/crud/reference-labels.d.ts +27 -0
  13. package/dist/lib/crud/reference-labels.d.ts.map +1 -0
  14. package/dist/lib/crud/reference-labels.js +159 -0
  15. package/dist/lib/crud/reference-labels.js.map +1 -0
  16. package/dist/lib/crud/regions.d.ts +25 -0
  17. package/dist/lib/crud/regions.d.ts.map +1 -0
  18. package/dist/lib/crud/regions.js +82 -0
  19. package/dist/lib/crud/regions.js.map +1 -0
  20. package/dist/lib/crud/related-columns.d.ts +29 -0
  21. package/dist/lib/crud/related-columns.d.ts.map +1 -0
  22. package/dist/lib/crud/related-columns.js +141 -0
  23. package/dist/lib/crud/related-columns.js.map +1 -0
  24. package/dist/lib/i18n/catalog/en.d.ts.map +1 -1
  25. package/dist/lib/i18n/catalog/en.js +6 -0
  26. package/dist/lib/i18n/catalog/en.js.map +1 -1
  27. package/dist/lib/i18n/catalog/es.d.ts +8 -0
  28. package/dist/lib/i18n/catalog/es.d.ts.map +1 -1
  29. package/dist/lib/i18n/catalog/es.js +7 -1
  30. package/dist/lib/i18n/catalog/es.js.map +1 -1
  31. package/dist/lib/i18n/catalog/index.d.ts +12 -0
  32. package/dist/lib/i18n/catalog/index.d.ts.map +1 -1
  33. package/dist/lib/workspace/drafts-state.d.ts +1 -1
  34. package/dist/lib/workspace/tabs-state.d.ts +1 -1
  35. package/package.json +11 -11
  36. package/dist/lib/crud/use-link-labels.d.ts +0 -32
  37. package/dist/lib/crud/use-link-labels.d.ts.map +0 -1
  38. package/dist/lib/crud/use-link-labels.js +0 -76
  39. package/dist/lib/crud/use-link-labels.js.map +0 -1
@@ -0,0 +1,141 @@
1
+ 'use client';
2
+ import { _ as _extends } from "@swc/helpers/_/_extends";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { EntityLoadRequestTag, loadUCFactory } from '@entifix/business';
5
+ import { coerceFiltering, describeEntityColumns, extractMetaEntity, parseRsql, serializeRsql } from '@entifix/core';
6
+ import { CellValue, EntityColumn, useEntityNoun, useT, useTranslateKey } from '@entifix/react-controls';
7
+ import { entityQueryScope } from '@entifix/react-integration';
8
+ import { useQueries } from '@tanstack/react-query';
9
+ import { Context, Effect } from 'effect';
10
+ /**
11
+ * How many matches one related read asks for. A page names far fewer for a
12
+ * `via` column; a `match` column whose records hold more than this per page
13
+ * reads as the count of those it got.
14
+ */ export const RELATED_PAGE_SIZE = 200;
15
+ /**
16
+ * Checks every related column against both entities' metadata, so a mistake
17
+ * throws when the screen is generated rather than answering `400` per page.
18
+ */ export function planRelated(entityConstructor, descriptors, related) {
19
+ return related.map((column)=>{
20
+ var _descriptors_find, _target_find;
21
+ const name = `${entityConstructor.name}'s related column "${column.key}"`;
22
+ if (column.via === undefined === (column.match === undefined)) {
23
+ throw new Error(`${name} needs exactly one of via and match.`);
24
+ }
25
+ if (column.via !== undefined && ((_descriptors_find = descriptors.find((entry)=>entry.name === column.via)) == null ? void 0 : _descriptors_find.references) === undefined) {
26
+ throw new Error(`${name} reads via "${column.via}", which is not a reference member of ${entityConstructor.name}.`);
27
+ }
28
+ const target = describeEntityColumns(column.target);
29
+ if (column.match !== undefined && ((_target_find = target.find((entry)=>entry.name === column.match)) == null ? void 0 : _target_find.filterable) !== true) {
30
+ throw new Error(`${name} matches on "${column.match}", which must be a filterable member of ${column.target.name}.`);
31
+ }
32
+ const descriptor = target.find((entry)=>entry.name === column.member);
33
+ if (descriptor === undefined) {
34
+ throw new Error(`${name} shows "${column.member}", which is not a member of ${column.target.name}.`);
35
+ }
36
+ // Through the target's own allowlist, as a service would coerce it.
37
+ const rsql = column.filtering === undefined ? '' : serializeRsql([
38
+ column.filtering
39
+ ]);
40
+ if (rsql !== '') coerceFiltering(column.target, parseRsql(rsql));
41
+ return _extends({}, column, {
42
+ descriptor,
43
+ entityKey: String(extractMetaEntity(column.target).key)
44
+ });
45
+ });
46
+ }
47
+ const valueOf = (record, member)=>record[member];
48
+ const present = (value)=>value !== undefined && value !== null && value !== '';
49
+ /**
50
+ * One column per related plan, its values read for the page's items in one
51
+ * request per column — keyed under the target's own query scope, so a write
52
+ * to the target refreshes it.
53
+ */ export function useRelatedColumns(plans, items, repositoryOf) {
54
+ const translateKey = useTranslateKey();
55
+ const t = useT('shell');
56
+ const noun = useEntityNoun();
57
+ const keysOf = (plan)=>[
58
+ ...new Set(items.map((item)=>{
59
+ var _plan_via;
60
+ return valueOf(item, (_plan_via = plan.via) != null ? _plan_via : 'id');
61
+ }).filter(present).map(String))
62
+ ].sort();
63
+ const results = useQueries({
64
+ queries: plans.map((plan)=>{
65
+ const keys = keysOf(plan);
66
+ const property = plan.via === undefined ? plan.match : 'id';
67
+ const filtering = {
68
+ operator: 'and',
69
+ values: [
70
+ {
71
+ property: property,
72
+ operator: 'in',
73
+ values: keys
74
+ },
75
+ ...plan.filtering === undefined ? [] : [
76
+ plan.filtering
77
+ ]
78
+ ]
79
+ };
80
+ const request = {
81
+ filtering: [
82
+ filtering
83
+ ],
84
+ page: 1,
85
+ pageSize: RELATED_PAGE_SIZE
86
+ };
87
+ return {
88
+ queryKey: [
89
+ ...entityQueryScope(plan.target),
90
+ 'related',
91
+ plan.key,
92
+ keys
93
+ ],
94
+ enabled: keys.length > 0,
95
+ queryFn: ()=>Effect.runPromise(Effect.provide(loadUCFactory(), repositoryOf(plan).pipe(Context.add(EntityLoadRequestTag, request)))).then((page)=>page.items)
96
+ };
97
+ })
98
+ });
99
+ return plans.map((plan, index)=>{
100
+ var _ref;
101
+ var _results_index;
102
+ const matches = (_ref = (_results_index = results[index]) == null ? void 0 : _results_index.data) != null ? _ref : [];
103
+ const matchesOf = (item)=>{
104
+ var _plan_via;
105
+ const key = valueOf(item, (_plan_via = plan.via) != null ? _plan_via : 'id');
106
+ if (!present(key)) return [];
107
+ return matches.filter((match)=>plan.via === undefined ? String(valueOf(match, plan.match)) === String(key) : String(match.id) === String(key));
108
+ };
109
+ const plural = noun(extractMetaEntity(plan.target), 'plural');
110
+ return /*#__PURE__*/ _jsx(EntityColumn, _extends({
111
+ field: plan.key,
112
+ label: translateKey(plan.labelKey),
113
+ type: plan.descriptor.type
114
+ }, plan.descriptor.minWidth === undefined ? {} : {
115
+ minWidth: plan.descriptor.minWidth
116
+ }, {
117
+ render: (item)=>{
118
+ const found = matchesOf(item);
119
+ const [only] = found;
120
+ if (only === undefined || found.length > 1) {
121
+ return found.length > 1 ? /*#__PURE__*/ _jsx("span", {
122
+ children: t('related.count', {
123
+ count: found.length,
124
+ noun: plural
125
+ })
126
+ }) : /*#__PURE__*/ _jsx("span", {
127
+ className: "text-content-muted",
128
+ children: "—"
129
+ });
130
+ }
131
+ return plan.render === undefined ? /*#__PURE__*/ _jsx(CellValue, {
132
+ value: valueOf(only, plan.member),
133
+ descriptor: plan.descriptor,
134
+ record: only
135
+ }) : plan.render(only);
136
+ }
137
+ }), plan.key);
138
+ });
139
+ }
140
+
141
+ //# sourceMappingURL=related-columns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/crud/related-columns.tsx"],"sourcesContent":["'use client';\n\nimport {\n EntityLoadRequestTag,\n type EntityRepositoryTag,\n loadUCFactory,\n} from '@entifix/business';\nimport {\n coerceFiltering,\n describeEntityColumns,\n type Entity,\n type EntityConstructor,\n type EntityFieldDescriptor,\n type EntityLoadRequest,\n extractMetaEntity,\n type FilterGroup,\n parseRsql,\n serializeRsql,\n} from '@entifix/core';\nimport {\n CellValue,\n EntityColumn,\n useEntityNoun,\n useT,\n useTranslateKey,\n} from '@entifix/react-controls';\nimport { entityQueryScope } from '@entifix/react-integration';\nimport { useQueries } from '@tanstack/react-query';\nimport { Context, Effect } from 'effect';\nimport type { ReactElement } from 'react';\n\nimport type { EntityCrudRelated } from './make-entity-crud.types.js';\n\n/**\n * How many matches one related read asks for. A page names far fewer for a\n * `via` column; a `match` column whose records hold more than this per page\n * reads as the count of those it got.\n */\nexport const RELATED_PAGE_SIZE = 200;\n\n/** A related column, checked when the screen is generated. */\nexport interface RelatedPlan<TAdapters> extends EntityCrudRelated<TAdapters> {\n /** The target member's descriptor: what a match's value reads as. */\n readonly descriptor: EntityFieldDescriptor;\n readonly entityKey: string;\n}\n\n/**\n * Checks every related column against both entities' metadata, so a mistake\n * throws when the screen is generated rather than answering `400` per page.\n */\nexport function planRelated<TAdapters>(\n entityConstructor: EntityConstructor<Entity>,\n descriptors: readonly EntityFieldDescriptor[],\n related: readonly EntityCrudRelated<TAdapters>[],\n): RelatedPlan<TAdapters>[] {\n return related.map(column => {\n const name = `${entityConstructor.name}'s related column \"${column.key}\"`;\n if ((column.via === undefined) === (column.match === undefined)) {\n throw new Error(`${name} needs exactly one of via and match.`);\n }\n if (\n column.via !== undefined &&\n descriptors.find(entry => entry.name === column.via)?.references ===\n undefined\n ) {\n throw new Error(\n `${name} reads via \"${column.via}\", which is not a reference member of ${entityConstructor.name}.`,\n );\n }\n const target = describeEntityColumns(column.target);\n if (\n column.match !== undefined &&\n target.find(entry => entry.name === column.match)?.filterable !== true\n ) {\n throw new Error(\n `${name} matches on \"${column.match}\", which must be a filterable member of ${column.target.name}.`,\n );\n }\n const descriptor = target.find(entry => entry.name === column.member);\n if (descriptor === undefined) {\n throw new Error(\n `${name} shows \"${column.member}\", which is not a member of ${column.target.name}.`,\n );\n }\n // Through the target's own allowlist, as a service would coerce it.\n const rsql =\n column.filtering === undefined ? '' : serializeRsql([column.filtering]);\n if (rsql !== '') coerceFiltering(column.target, parseRsql(rsql));\n return {\n ...column,\n descriptor,\n entityKey: String(extractMetaEntity(column.target).key),\n };\n });\n}\n\nconst valueOf = (record: Entity, member: string): unknown =>\n (record as unknown as Record<string, unknown>)[member];\n\nconst present = (value: unknown): value is string | number =>\n value !== undefined && value !== null && value !== '';\n\n/**\n * One column per related plan, its values read for the page's items in one\n * request per column — keyed under the target's own query scope, so a write\n * to the target refreshes it.\n */\nexport function useRelatedColumns<TAdapters, TEntity extends Entity>(\n plans: readonly RelatedPlan<TAdapters>[],\n items: readonly TEntity[],\n repositoryOf: (\n plan: RelatedPlan<TAdapters>,\n ) => Context.Context<EntityRepositoryTag>,\n): ReactElement[] {\n const translateKey = useTranslateKey();\n const t = useT('shell');\n const noun = useEntityNoun();\n\n const keysOf = (plan: RelatedPlan<TAdapters>) =>\n [\n ...new Set(\n items\n .map(item => valueOf(item, plan.via ?? 'id'))\n .filter(present)\n .map(String),\n ),\n ].sort();\n\n const results = useQueries({\n queries: plans.map(plan => {\n const keys = keysOf(plan);\n const property = plan.via === undefined ? (plan.match as string) : 'id';\n const filtering: FilterGroup<Entity> = {\n operator: 'and',\n values: [\n {\n property: property as never,\n operator: 'in',\n values: keys as never,\n },\n ...(plan.filtering === undefined\n ? []\n : [plan.filtering as FilterGroup<Entity>]),\n ],\n };\n const request: EntityLoadRequest = {\n filtering: [filtering],\n page: 1,\n pageSize: RELATED_PAGE_SIZE,\n };\n return {\n queryKey: [...entityQueryScope(plan.target), 'related', plan.key, keys],\n enabled: keys.length > 0,\n queryFn: () =>\n Effect.runPromise(\n Effect.provide(\n loadUCFactory<Entity>(),\n repositoryOf(plan).pipe(\n Context.add(EntityLoadRequestTag, request),\n ),\n ),\n ).then(page => page.items),\n };\n }),\n });\n\n return plans.map((plan, index) => {\n const matches = results[index]?.data ?? [];\n const matchesOf = (item: TEntity) => {\n const key = valueOf(item, plan.via ?? 'id');\n if (!present(key)) return [];\n return matches.filter(match =>\n plan.via === undefined\n ? String(valueOf(match, plan.match as string)) === String(key)\n : String(match.id) === String(key),\n );\n };\n const plural = noun(extractMetaEntity(plan.target), 'plural');\n return (\n <EntityColumn<TEntity>\n key={plan.key}\n field={plan.key}\n label={translateKey(plan.labelKey)}\n type={plan.descriptor.type}\n {...(plan.descriptor.minWidth === undefined\n ? {}\n : { minWidth: plan.descriptor.minWidth })}\n render={item => {\n const found = matchesOf(item);\n const [only] = found;\n if (only === undefined || found.length > 1) {\n return found.length > 1 ? (\n <span>\n {t('related.count', { count: found.length, noun: plural })}\n </span>\n ) : (\n <span className=\"text-content-muted\">—</span>\n );\n }\n return plan.render === undefined ? (\n <CellValue\n value={valueOf(only, plan.member)}\n descriptor={plan.descriptor}\n record={only as unknown as Record<string, unknown>}\n />\n ) : (\n plan.render(only)\n );\n }}\n />\n );\n });\n}\n"],"names":["EntityLoadRequestTag","loadUCFactory","coerceFiltering","describeEntityColumns","extractMetaEntity","parseRsql","serializeRsql","CellValue","EntityColumn","useEntityNoun","useT","useTranslateKey","entityQueryScope","useQueries","Context","Effect","RELATED_PAGE_SIZE","planRelated","entityConstructor","descriptors","related","map","column","target","name","key","via","undefined","match","Error","find","entry","references","filterable","descriptor","member","rsql","filtering","entityKey","String","valueOf","record","present","value","useRelatedColumns","plans","items","repositoryOf","translateKey","t","noun","keysOf","plan","Set","item","filter","sort","results","queries","keys","property","operator","values","request","page","pageSize","queryKey","enabled","length","queryFn","runPromise","provide","pipe","add","then","index","matches","data","matchesOf","id","plural","field","label","labelKey","type","minWidth","render","found","only","span","count","className"],"mappings":"AAAA;;;AAEA,SACEA,oBAAoB,EAEpBC,aAAa,QACR,oBAAoB;AAC3B,SACEC,eAAe,EACfC,qBAAqB,EAKrBC,iBAAiB,EAEjBC,SAAS,EACTC,aAAa,QACR,gBAAgB;AACvB,SACEC,SAAS,EACTC,YAAY,EACZ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lB,UAAU,CAACmD,QAAQ,KAAK1D,YAC9B,CAAC,IACD;YAAE0D,UAAUjC,KAAKlB,UAAU,CAACmD,QAAQ;QAAC;YACzCC,QAAQhC,CAAAA;gBACN,MAAMiC,QAAQT,UAAUxB;gBACxB,MAAM,CAACkC,KAAK,GAAGD;gBACf,IAAIC,SAAS7D,aAAa4D,MAAMnB,MAAM,GAAG,GAAG;oBAC1C,OAAOmB,MAAMnB,MAAM,GAAG,kBACpB,KAACqB;kCACExC,EAAE,iBAAiB;4BAAEyC,OAAOH,MAAMnB,MAAM;4BAAElB,MAAM8B;wBAAO;uCAG1D,KAACS;wBAAKE,WAAU;kCAAqB;;gBAEzC;gBACA,OAAOvC,KAAKkC,MAAM,KAAK3D,0BACrB,KAACpB;oBACCoC,OAAOH,QAAQgD,MAAMpC,KAAKjB,MAAM;oBAChCD,YAAYkB,KAAKlB,UAAU;oBAC3BO,QAAQ+C;qBAGVpC,KAAKkC,MAAM,CAACE;YAEhB;YA5BKpC,KAAK3B,GAAG;IA+BnB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/lib/i18n/catalog/en.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG,cAAc,SAAS,EAAE,KAAK,CAAC;AAE9C,eAAO,MAAM,KAAK,EAAE,OAqFnB,CAAC"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/lib/i18n/catalog/en.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG,cAAc,SAAS,EAAE,KAAK,CAAC;AAE9C,eAAO,MAAM,KAAK,EAAE,OA6FnB,CAAC"}
@@ -49,6 +49,12 @@ export const shell = {
49
49
  expandGroup: 'Expand {{group}}',
50
50
  collapseGroup: 'Collapse {{group}}'
51
51
  },
52
+ /** A list column whose value lives in another entity, when more than one record matches. */ /** The section nav above a record's related regions. */ regions: {
53
+ nav: 'Record sections'
54
+ },
55
+ related: {
56
+ count: '{{count}} {{noun}}'
57
+ },
52
58
  session: {
53
59
  expiringSoon: 'Your session is about to expire. Save your work and sign in again to continue.'
54
60
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/i18n/catalog/en.ts"],"sourcesContent":["type EsShell = typeof import('./es.js').shell;\n\nexport const shell: EsShell = {\n nav: {\n primary: 'Primary',\n openInWorkspace: 'Open in workspace',\n openInNewTab: 'Open in a new tab',\n /** The one menu beside each destination: open it elsewhere. */\n itemActions: 'Options for {{label}}',\n /**\n * The screen taxonomy. Translated like every other string rather\n * than kept in Spanish: what that decision fixed was which *Spanish* word\n * ships to the default locale, not that the term is untranslatable.\n */\n screenType: {\n master: 'Definitions',\n operation: 'Operations',\n wizard: 'Wizards',\n report: 'Reports',\n },\n },\n commandPalette: {\n open: 'Search or run',\n title: 'Search or run',\n placeholder: 'Search a record, a screen or a command…',\n newPlaceholder: 'What would you like to create?',\n newLabel: 'New…',\n newTitle: 'New',\n back: 'Back',\n empty: 'No results',\n loading: 'Searching…',\n more_one: '{{count}} more',\n more_other: '{{count}} more',\n typeMore: 'Type at least {{count}} characters to search records.',\n groups: {\n actions: 'Actions',\n commands: 'Commands',\n navigation: 'Navigation',\n tabs: 'Open tabs',\n records: 'Records',\n },\n unavailableScope: 'Not available here: {{reason}}',\n unavailableReach: 'We could not reach this source: {{reason}}',\n openInWorkspaceHint: 'Tab',\n },\n sidebar: {\n /** The page's first stop: past the navigation, to the content. */\n skipToContent: 'Skip to content',\n expand: 'Expand sidebar',\n collapse: 'Collapse sidebar',\n openMenu: 'Open the menu',\n closeMenu: 'Close the menu',\n menu: 'Navigation menu',\n expandGroup: 'Expand {{group}}',\n collapseGroup: 'Collapse {{group}}',\n },\n session: {\n expiringSoon:\n 'Your session is about to expire. Save your work and sign in again to continue.',\n },\n breadcrumbs: {\n home: 'Home',\n // The `/new` segment, which every domain's create route shares. It was\n // an auth-specific string until one host started serving two domains,\n // at which point a catalog page's breadcrumb read \"New user\".\n new: 'New',\n },\n account: {\n profile: 'Profile',\n security: 'Security',\n sessions: 'Sessions',\n signOut: 'Sign out',\n },\n workspace: {\n copyLink: 'Copy link',\n empty: 'No open tabs. Pick a catalog from the sidebar to start.',\n unsupported: \"This tab can't be opened here.\",\n discardTitle: 'Discard changes',\n discard: 'This tab has unsaved changes. Closing it will lose them.',\n discardConfirm: 'Discard',\n // See the Spanish catalog for why a failure's reason is not a key here.\n pendingLabel: 'Save status',\n savePending_one: 'Saving 1 record…',\n savePending_other: 'Saving {{count}} records…',\n saveFailed: 'The record could not be saved.',\n saveFailedDismiss: 'Dismiss',\n },\n};\n"],"names":["shell","nav","primary","openInWorkspace","openInNewTab","itemActions","screenType","master","operation","wizard","report","commandPalette","open","title","placeholder","newPlaceholder","newLabel","newTitle","back","empty","loading","more_one","more_other","typeMore","groups","actions","commands","navigation","tabs","records","unavailableScope","unavailableReach","openInWorkspaceHint","sidebar","skipToContent","expand","collapse","openMenu","closeMenu","menu","expandGroup","collapseGroup","session","expiringSoon","breadcrumbs","home","new","account","profile","security","sessions","signOut","workspace","copyLink","unsupported","discardTitle","discard","discardConfirm","pendingLabel","savePending_one","savePending_other","saveFailed","saveFailedDismiss"],"mappings":"AAEA,OAAO,MAAMA,QAAiB;IAC5BC,KAAK;QACHC,SAAS;QACTC,iBAAiB;QACjBC,cAAc;QACd,6DAA6D,GAC7DC,aAAa;QACb;;;;KAIC,GACDC,YAAY;YACVC,QAAQ;YACRC,WAAW;YACXC,QAAQ;YACRC,QAAQ;QACV;IACF;IACAC,gBAAgB;QACdC,MAAM;QACNC,OAAO;QACPC,aAAa;QACbC,gBAAgB;QAChBC,UAAU;QACVC,UAAU;QACVC,MAAM;QACNC,OAAO;QACPC,SAAS;QACTC,UAAU;QACVC,YAAY;QACZC,UAAU;QACVC,QAAQ;YACNC,SAAS;YACTC,UAAU;YACVC,YAAY;YACZC,MAAM;YACNC,SAAS;QACX;QACAC,kBAAkB;QAClBC,kBAAkB;QAClBC,qBAAqB;IACvB;IACAC,SAAS;QACP,gEAAgE,GAChEC,eAAe;QACfC,QAAQ;QACRC,UAAU;QACVC,UAAU;QACVC,WAAW;QACXC,MAAM;QACNC,aAAa;QACbC,eAAe;IACjB;IACAC,SAAS;QACPC,cACE;IACJ;IACAC,aAAa;QACXC,MAAM;QACN,uEAAuE;QACvE,sEAAsE;QACtE,8DAA8D;QAC9DC,KAAK;IACP;IACAC,SAAS;QACPC,SAAS;QACTC,UAAU;QACVC,UAAU;QACVC,SAAS;IACX;IACAC,WAAW;QACTC,UAAU;QACVlC,OAAO;QACPmC,aAAa;QACbC,cAAc;QACdC,SAAS;QACTC,gBAAgB;QAChB,wEAAwE;QACxEC,cAAc;QACdC,iBAAiB;QACjBC,mBAAmB;QACnBC,YAAY;QACZC,mBAAmB;IACrB;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../src/lib/i18n/catalog/en.ts"],"sourcesContent":["type EsShell = typeof import('./es.js').shell;\n\nexport const shell: EsShell = {\n nav: {\n primary: 'Primary',\n openInWorkspace: 'Open in workspace',\n openInNewTab: 'Open in a new tab',\n /** The one menu beside each destination: open it elsewhere. */\n itemActions: 'Options for {{label}}',\n /**\n * The screen taxonomy. Translated like every other string rather\n * than kept in Spanish: what that decision fixed was which *Spanish* word\n * ships to the default locale, not that the term is untranslatable.\n */\n screenType: {\n master: 'Definitions',\n operation: 'Operations',\n wizard: 'Wizards',\n report: 'Reports',\n },\n },\n commandPalette: {\n open: 'Search or run',\n title: 'Search or run',\n placeholder: 'Search a record, a screen or a command…',\n newPlaceholder: 'What would you like to create?',\n newLabel: 'New…',\n newTitle: 'New',\n back: 'Back',\n empty: 'No results',\n loading: 'Searching…',\n more_one: '{{count}} more',\n more_other: '{{count}} more',\n typeMore: 'Type at least {{count}} characters to search records.',\n groups: {\n actions: 'Actions',\n commands: 'Commands',\n navigation: 'Navigation',\n tabs: 'Open tabs',\n records: 'Records',\n },\n unavailableScope: 'Not available here: {{reason}}',\n unavailableReach: 'We could not reach this source: {{reason}}',\n openInWorkspaceHint: 'Tab',\n },\n sidebar: {\n /** The page's first stop: past the navigation, to the content. */\n skipToContent: 'Skip to content',\n expand: 'Expand sidebar',\n collapse: 'Collapse sidebar',\n openMenu: 'Open the menu',\n closeMenu: 'Close the menu',\n menu: 'Navigation menu',\n expandGroup: 'Expand {{group}}',\n collapseGroup: 'Collapse {{group}}',\n },\n /** A list column whose value lives in another entity, when more than one record matches. */\n /** The section nav above a record's related regions. */\n regions: {\n nav: 'Record sections',\n },\n related: {\n count: '{{count}} {{noun}}',\n },\n session: {\n expiringSoon:\n 'Your session is about to expire. Save your work and sign in again to continue.',\n },\n breadcrumbs: {\n home: 'Home',\n // The `/new` segment, which every domain's create route shares. It was\n // an auth-specific string until one host started serving two domains,\n // at which point a catalog page's breadcrumb read \"New user\".\n new: 'New',\n },\n account: {\n profile: 'Profile',\n security: 'Security',\n sessions: 'Sessions',\n signOut: 'Sign out',\n },\n workspace: {\n copyLink: 'Copy link',\n empty: 'No open tabs. Pick a catalog from the sidebar to start.',\n unsupported: \"This tab can't be opened here.\",\n discardTitle: 'Discard changes',\n discard: 'This tab has unsaved changes. Closing it will lose them.',\n discardConfirm: 'Discard',\n // See the Spanish catalog for why a failure's reason is not a key here.\n pendingLabel: 'Save status',\n savePending_one: 'Saving 1 record…',\n savePending_other: 'Saving {{count}} records…',\n saveFailed: 'The record could not be saved.',\n saveFailedDismiss: 'Dismiss',\n },\n};\n"],"names":["shell","nav","primary","openInWorkspace","openInNewTab","itemActions","screenType","master","operation","wizard","report","commandPalette","open","title","placeholder","newPlaceholder","newLabel","newTitle","back","empty","loading","more_one","more_other","typeMore","groups","actions","commands","navigation","tabs","records","unavailableScope","unavailableReach","openInWorkspaceHint","sidebar","skipToContent","expand","collapse","openMenu","closeMenu","menu","expandGroup","collapseGroup","regions","related","count","session","expiringSoon","breadcrumbs","home","new","account","profile","security","sessions","signOut","workspace","copyLink","unsupported","discardTitle","discard","discardConfirm","pendingLabel","savePending_one","savePending_other","saveFailed","saveFailedDismiss"],"mappings":"AAEA,OAAO,MAAMA,QAAiB;IAC5BC,KAAK;QACHC,SAAS;QACTC,iBAAiB;QACjBC,cAAc;QACd,6DAA6D,GAC7DC,aAAa;QACb;;;;KAIC,GACDC,YAAY;YACVC,QAAQ;YACRC,WAAW;YACXC,QAAQ;YACRC,QAAQ;QACV;IACF;IACAC,gBAAgB;QACdC,MAAM;QACNC,OAAO;QACPC,aAAa;QACbC,gBAAgB;QAChBC,UAAU;QACVC,UAAU;QACVC,MAAM;QACNC,OAAO;QACPC,SAAS;QACTC,UAAU;QACVC,YAAY;QACZC,UAAU;QACVC,QAAQ;YACNC,SAAS;YACTC,UAAU;YACVC,YAAY;YACZC,MAAM;YACNC,SAAS;QACX;QACAC,kBAAkB;QAClBC,kBAAkB;QAClBC,qBAAqB;IACvB;IACAC,SAAS;QACP,gEAAgE,GAChEC,eAAe;QACfC,QAAQ;QACRC,UAAU;QACVC,UAAU;QACVC,WAAW;QACXC,MAAM;QACNC,aAAa;QACbC,eAAe;IACjB;IACA,0FAA0F,GAC1F,sDAAsD,GACtDC,SAAS;QACPzC,KAAK;IACP;IACA0C,SAAS;QACPC,OAAO;IACT;IACAC,SAAS;QACPC,cACE;IACJ;IACAC,aAAa;QACXC,MAAM;QACN,uEAAuE;QACvE,sEAAsE;QACtE,8DAA8D;QAC9DC,KAAK;IACP;IACAC,SAAS;QACPC,SAAS;QACTC,UAAU;QACVC,UAAU;QACVC,SAAS;IACX;IACAC,WAAW;QACTC,UAAU;QACVrC,OAAO;QACPsC,aAAa;QACbC,cAAc;QACdC,SAAS;QACTC,gBAAgB;QAChB,wEAAwE;QACxEC,cAAc;QACdC,iBAAiB;QACjBC,mBAAmB;QACnBC,YAAY;QACZC,mBAAmB;IACrB;AACF,EAAE"}
@@ -76,6 +76,14 @@ export declare const shell: {
76
76
  * thing: nothing here counts down, since a number that moves invites a person
77
77
  * to watch it rather than to save their work.
78
78
  */
79
+ /** A list column whose value lives in another entity, when more than one record matches. */
80
+ /** The section nav above a record's related regions. */
81
+ regions: {
82
+ nav: string;
83
+ };
84
+ related: {
85
+ count: string;
86
+ };
79
87
  session: {
80
88
  expiringSoon: string;
81
89
  };
@@ -1 +1 @@
1
- {"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../../src/lib/i18n/catalog/es.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,eAAO,MAAM,KAAK;;;;;QAKd,+DAA+D;;QAE/D;;;;;;WAMG;;;;;;;;IAQL;;;;OAIG;;QAED,4EAA4E;;QAE5E,qDAAqD;;;;;QAKrD,4EAA4E;;;;;;;QAO5E,2EAA2E;;;;;;;;;QAS3E;;;;WAIG;;;QAGH,uEAAuE;;;;QAIvE,kEAAkE;;;;;;;;;;IAapE;;;;;OAKG;;;;;;;;IAYH;;;;OAIG;;;;;;;;;;;;;;;;;;;;CAkCJ,CAAC"}
1
+ {"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../../src/lib/i18n/catalog/es.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,eAAO,MAAM,KAAK;;;;;QAKd,+DAA+D;;QAE/D;;;;;;WAMG;;;;;;;;IAQL;;;;OAIG;;QAED,4EAA4E;;QAE5E,qDAAqD;;;;;QAKrD,4EAA4E;;;;;;;QAO5E,2EAA2E;;;;;;;;;QAS3E;;;;WAIG;;;QAGH,uEAAuE;;;;QAIvE,kEAAkE;;;;;;;;;;IAapE;;;;;OAKG;IACH,4FAA4F;IAC5F,wDAAwD;;;;;;;;;;;;;;IAkBxD;;;;OAIG;;;;;;;;;;;;;;;;;;;;CAkCJ,CAAC"}
@@ -67,7 +67,13 @@
67
67
  * window before the absolute ceiling. One key, because the strip says one
68
68
  * thing: nothing here counts down, since a number that moves invites a person
69
69
  * to watch it rather than to save their work.
70
- */ session: {
70
+ */ /** A list column whose value lives in another entity, when more than one record matches. */ /** The section nav above a record's related regions. */ regions: {
71
+ nav: 'Secciones del registro'
72
+ },
73
+ related: {
74
+ count: '{{count}} {{noun}}'
75
+ },
76
+ session: {
71
77
  expiringSoon: 'Tu sesión está por expirar. Guarda tu trabajo e inicia sesión de nuevo para continuar.'
72
78
  },
73
79
  breadcrumbs: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/i18n/catalog/es.ts"],"sourcesContent":["/** Copy owned by the Next shells — back-office chrome and the tab workspace. */\nexport const shell = {\n nav: {\n primary: 'Principal',\n openInWorkspace: 'Abrir en el espacio de trabajo',\n openInNewTab: 'Abrir en una pestaña nueva',\n /** The one menu beside each destination: open it elsewhere. */\n itemActions: 'Opciones de {{label}}',\n /**\n * The screen taxonomy — the sidebar's top tier, above the\n * domain. `Definiciones` rather than `Maestros` because the ERP term needs\n * the ERP background to parse, and rather than `Catálogos` or `Referencias`\n * because both already mean something else here: the product catalog, and a\n * product's code in `storefront.category.sortByCode`.\n */\n screenType: {\n master: 'Definiciones',\n operation: 'Operaciones',\n wizard: 'Asistentes',\n report: 'Consultas',\n },\n },\n /**\n * La paleta de comandos. Vive en `shell:` y no en `controls:`\n * porque el control es agnóstico —recibe copia ya resuelta— y quien la\n * arma es el back office.\n */\n commandPalette: {\n /** El disparador visible, que existe justo porque un atajo puede fallar. */\n open: 'Buscar o ejecutar',\n /** El nombre accesible del diálogo y de su campo. */\n title: 'Buscar o ejecutar',\n placeholder: 'Busca un registro, una pantalla o un comando…',\n newPlaceholder: '¿Qué quieres crear?',\n newLabel: 'Nuevo…',\n /** El nombre de la página apilada, y también el del control para volver. */\n newTitle: 'Nuevo',\n back: 'Volver',\n empty: 'Sin resultados',\n loading: 'Buscando…',\n more_one: '{{count}} más',\n more_other: '{{count}} más',\n /** Escribe al menos dos caracteres — el suelo que impone `/api/search`. */\n typeMore: 'Escribe al menos {{count}} caracteres para buscar registros.',\n groups: {\n actions: 'Acciones',\n commands: 'Comandos',\n navigation: 'Navegación',\n tabs: 'Pestañas abiertas',\n records: 'Registros',\n },\n /**\n * Dos redacciones para dos cosas distintas: «no es tuyo» es el estado\n * **normal** de un operador sin organización, y pintarlo como avería en\n * cada tecleo enseña a ignorar el aviso que sí importa.\n */\n unavailableScope: 'No disponible aquí: {{reason}}',\n unavailableReach: 'No pudimos consultar este origen: {{reason}}',\n /** Sufijo del comando que abre un destino como pestaña del espacio. */\n openInWorkspaceHint: 'Pestaña',\n },\n sidebar: {\n /** The page's first stop: past the navigation, to the content. */\n skipToContent: 'Saltar al contenido',\n expand: 'Expandir barra lateral',\n collapse: 'Contraer barra lateral',\n openMenu: 'Abrir el menú',\n closeMenu: 'Cerrar el menú',\n // The drawer is a dialog, so it needs a name of its own — the landmark\n // inside it is the nav, and a dialog with no accessible name is announced\n // as just \"dialog\".\n menu: 'Menú de navegación',\n expandGroup: 'Desplegar {{group}}',\n collapseGroup: 'Plegar {{group}}',\n },\n /**\n * The session strip, rendered by `SessionKeepalive` only inside the final\n * window before the absolute ceiling. One key, because the strip says one\n * thing: nothing here counts down, since a number that moves invites a person\n * to watch it rather than to save their work.\n */\n session: {\n expiringSoon:\n 'Tu sesión está por expirar. Guarda tu trabajo e inicia sesión de nuevo para continuar.',\n },\n breadcrumbs: {\n home: 'Inicio',\n // The `/new` segment, which every domain's create route shares. It was\n // an auth-specific string until one host started serving two domains,\n // at which point a catalog page's breadcrumb read \"New user\".\n new: 'Nuevo',\n },\n /**\n * The account surface. The auth shell owns the screens, but `ACCOUNT_DESTINATIONS`\n * — the one list every app builds its menu from — lives in the shell, so the\n * shell owns their names too and resolves them itself.\n */\n account: {\n profile: 'Perfil',\n security: 'Seguridad',\n sessions: 'Sesiones',\n signOut: 'Cerrar sesión',\n },\n workspace: {\n copyLink: 'Copiar enlace',\n empty:\n 'No hay pestañas abiertas. Elige un catálogo en la barra lateral para empezar.',\n unsupported: 'Esta pestaña no se puede abrir aquí.',\n // The confirmation that guards closing a dirty tab. The title carries the\n // question, so the message states the consequence rather than repeating it\n // — it was phrased as a question while `window.confirm` rendered it, which\n // had nowhere to put a title.\n discardTitle: 'Descartar cambios',\n discard:\n 'Esta pestaña tiene cambios sin guardar. Si la cierras, se perderán.',\n discardConfirm: 'Descartar',\n // What became of a write the server has not finished. `count` is the\n // number in flight; a failure names no reason here, because the only one a\n // transaction carries is a server exception string in whatever language it\n // was written in — that is rendered beside this, unlocalized and marked so.\n pendingLabel: 'Estado de los guardados',\n savePending_one: 'Guardando 1 registro…',\n savePending_other: 'Guardando {{count}} registros…',\n saveFailed: 'No se pudo guardar el registro.',\n saveFailedDismiss: 'Descartar',\n },\n /**\n * The storefront. Its pages live in `shells-next-marketplace`, so its copy\n * lives here and not in an app catalog — `app:` is reserved for `apps/`.\n */\n};\n"],"names":["shell","nav","primary","openInWorkspace","openInNewTab","itemActions","screenType","master","operation","wizard","report","commandPalette","open","title","placeholder","newPlaceholder","newLabel","newTitle","back","empty","loading","more_one","more_other","typeMore","groups","actions","commands","navigation","tabs","records","unavailableScope","unavailableReach","openInWorkspaceHint","sidebar","skipToContent","expand","collapse","openMenu","closeMenu","menu","expandGroup","collapseGroup","session","expiringSoon","breadcrumbs","home","new","account","profile","security","sessions","signOut","workspace","copyLink","unsupported","discardTitle","discard","discardConfirm","pendingLabel","savePending_one","savePending_other","saveFailed","saveFailedDismiss"],"mappings":"AAAA,8EAA8E,GAC9E,OAAO,MAAMA,QAAQ;IACnBC,KAAK;QACHC,SAAS;QACTC,iBAAiB;QACjBC,cAAc;QACd,6DAA6D,GAC7DC,aAAa;QACb;;;;;;KAMC,GACDC,YAAY;YACVC,QAAQ;YACRC,WAAW;YACXC,QAAQ;YACRC,QAAQ;QACV;IACF;IACA;;;;GAIC,GACDC,gBAAgB;QACd,0EAA0E,GAC1EC,MAAM;QACN,mDAAmD,GACnDC,OAAO;QACPC,aAAa;QACbC,gBAAgB;QAChBC,UAAU;QACV,0EAA0E,GAC1EC,UAAU;QACVC,MAAM;QACNC,OAAO;QACPC,SAAS;QACTC,UAAU;QACVC,YAAY;QACZ,yEAAyE,GACzEC,UAAU;QACVC,QAAQ;YACNC,SAAS;YACTC,UAAU;YACVC,YAAY;YACZC,MAAM;YACNC,SAAS;QACX;QACA;;;;KAIC,GACDC,kBAAkB;QAClBC,kBAAkB;QAClB,qEAAqE,GACrEC,qBAAqB;IACvB;IACAC,SAAS;QACP,gEAAgE,GAChEC,eAAe;QACfC,QAAQ;QACRC,UAAU;QACVC,UAAU;QACVC,WAAW;QACX,uEAAuE;QACvE,0EAA0E;QAC1E,oBAAoB;QACpBC,MAAM;QACNC,aAAa;QACbC,eAAe;IACjB;IACA;;;;;GAKC,GACDC,SAAS;QACPC,cACE;IACJ;IACAC,aAAa;QACXC,MAAM;QACN,uEAAuE;QACvE,sEAAsE;QACtE,8DAA8D;QAC9DC,KAAK;IACP;IACA;;;;GAIC,GACDC,SAAS;QACPC,SAAS;QACTC,UAAU;QACVC,UAAU;QACVC,SAAS;IACX;IACAC,WAAW;QACTC,UAAU;QACVlC,OACE;QACFmC,aAAa;QACb,0EAA0E;QAC1E,2EAA2E;QAC3E,2EAA2E;QAC3E,8BAA8B;QAC9BC,cAAc;QACdC,SACE;QACFC,gBAAgB;QAChB,qEAAqE;QACrE,2EAA2E;QAC3E,2EAA2E;QAC3E,4EAA4E;QAC5EC,cAAc;QACdC,iBAAiB;QACjBC,mBAAmB;QACnBC,YAAY;QACZC,mBAAmB;IACrB;AAKF,EAAE"}
1
+ {"version":3,"sources":["../../../../src/lib/i18n/catalog/es.ts"],"sourcesContent":["/** Copy owned by the Next shells — back-office chrome and the tab workspace. */\nexport const shell = {\n nav: {\n primary: 'Principal',\n openInWorkspace: 'Abrir en el espacio de trabajo',\n openInNewTab: 'Abrir en una pestaña nueva',\n /** The one menu beside each destination: open it elsewhere. */\n itemActions: 'Opciones de {{label}}',\n /**\n * The screen taxonomy — the sidebar's top tier, above the\n * domain. `Definiciones` rather than `Maestros` because the ERP term needs\n * the ERP background to parse, and rather than `Catálogos` or `Referencias`\n * because both already mean something else here: the product catalog, and a\n * product's code in `storefront.category.sortByCode`.\n */\n screenType: {\n master: 'Definiciones',\n operation: 'Operaciones',\n wizard: 'Asistentes',\n report: 'Consultas',\n },\n },\n /**\n * La paleta de comandos. Vive en `shell:` y no en `controls:`\n * porque el control es agnóstico —recibe copia ya resuelta— y quien la\n * arma es el back office.\n */\n commandPalette: {\n /** El disparador visible, que existe justo porque un atajo puede fallar. */\n open: 'Buscar o ejecutar',\n /** El nombre accesible del diálogo y de su campo. */\n title: 'Buscar o ejecutar',\n placeholder: 'Busca un registro, una pantalla o un comando…',\n newPlaceholder: '¿Qué quieres crear?',\n newLabel: 'Nuevo…',\n /** El nombre de la página apilada, y también el del control para volver. */\n newTitle: 'Nuevo',\n back: 'Volver',\n empty: 'Sin resultados',\n loading: 'Buscando…',\n more_one: '{{count}} más',\n more_other: '{{count}} más',\n /** Escribe al menos dos caracteres — el suelo que impone `/api/search`. */\n typeMore: 'Escribe al menos {{count}} caracteres para buscar registros.',\n groups: {\n actions: 'Acciones',\n commands: 'Comandos',\n navigation: 'Navegación',\n tabs: 'Pestañas abiertas',\n records: 'Registros',\n },\n /**\n * Dos redacciones para dos cosas distintas: «no es tuyo» es el estado\n * **normal** de un operador sin organización, y pintarlo como avería en\n * cada tecleo enseña a ignorar el aviso que sí importa.\n */\n unavailableScope: 'No disponible aquí: {{reason}}',\n unavailableReach: 'No pudimos consultar este origen: {{reason}}',\n /** Sufijo del comando que abre un destino como pestaña del espacio. */\n openInWorkspaceHint: 'Pestaña',\n },\n sidebar: {\n /** The page's first stop: past the navigation, to the content. */\n skipToContent: 'Saltar al contenido',\n expand: 'Expandir barra lateral',\n collapse: 'Contraer barra lateral',\n openMenu: 'Abrir el menú',\n closeMenu: 'Cerrar el menú',\n // The drawer is a dialog, so it needs a name of its own — the landmark\n // inside it is the nav, and a dialog with no accessible name is announced\n // as just \"dialog\".\n menu: 'Menú de navegación',\n expandGroup: 'Desplegar {{group}}',\n collapseGroup: 'Plegar {{group}}',\n },\n /**\n * The session strip, rendered by `SessionKeepalive` only inside the final\n * window before the absolute ceiling. One key, because the strip says one\n * thing: nothing here counts down, since a number that moves invites a person\n * to watch it rather than to save their work.\n */\n /** A list column whose value lives in another entity, when more than one record matches. */\n /** The section nav above a record's related regions. */\n regions: {\n nav: 'Secciones del registro',\n },\n related: {\n count: '{{count}} {{noun}}',\n },\n session: {\n expiringSoon:\n 'Tu sesión está por expirar. Guarda tu trabajo e inicia sesión de nuevo para continuar.',\n },\n breadcrumbs: {\n home: 'Inicio',\n // The `/new` segment, which every domain's create route shares. It was\n // an auth-specific string until one host started serving two domains,\n // at which point a catalog page's breadcrumb read \"New user\".\n new: 'Nuevo',\n },\n /**\n * The account surface. The auth shell owns the screens, but `ACCOUNT_DESTINATIONS`\n * — the one list every app builds its menu from — lives in the shell, so the\n * shell owns their names too and resolves them itself.\n */\n account: {\n profile: 'Perfil',\n security: 'Seguridad',\n sessions: 'Sesiones',\n signOut: 'Cerrar sesión',\n },\n workspace: {\n copyLink: 'Copiar enlace',\n empty:\n 'No hay pestañas abiertas. Elige un catálogo en la barra lateral para empezar.',\n unsupported: 'Esta pestaña no se puede abrir aquí.',\n // The confirmation that guards closing a dirty tab. The title carries the\n // question, so the message states the consequence rather than repeating it\n // — it was phrased as a question while `window.confirm` rendered it, which\n // had nowhere to put a title.\n discardTitle: 'Descartar cambios',\n discard:\n 'Esta pestaña tiene cambios sin guardar. Si la cierras, se perderán.',\n discardConfirm: 'Descartar',\n // What became of a write the server has not finished. `count` is the\n // number in flight; a failure names no reason here, because the only one a\n // transaction carries is a server exception string in whatever language it\n // was written in — that is rendered beside this, unlocalized and marked so.\n pendingLabel: 'Estado de los guardados',\n savePending_one: 'Guardando 1 registro…',\n savePending_other: 'Guardando {{count}} registros…',\n saveFailed: 'No se pudo guardar el registro.',\n saveFailedDismiss: 'Descartar',\n },\n /**\n * The storefront. Its pages live in `shells-next-marketplace`, so its copy\n * lives here and not in an app catalog — `app:` is reserved for `apps/`.\n */\n};\n"],"names":["shell","nav","primary","openInWorkspace","openInNewTab","itemActions","screenType","master","operation","wizard","report","commandPalette","open","title","placeholder","newPlaceholder","newLabel","newTitle","back","empty","loading","more_one","more_other","typeMore","groups","actions","commands","navigation","tabs","records","unavailableScope","unavailableReach","openInWorkspaceHint","sidebar","skipToContent","expand","collapse","openMenu","closeMenu","menu","expandGroup","collapseGroup","regions","related","count","session","expiringSoon","breadcrumbs","home","new","account","profile","security","sessions","signOut","workspace","copyLink","unsupported","discardTitle","discard","discardConfirm","pendingLabel","savePending_one","savePending_other","saveFailed","saveFailedDismiss"],"mappings":"AAAA,8EAA8E,GAC9E,OAAO,MAAMA,QAAQ;IACnBC,KAAK;QACHC,SAAS;QACTC,iBAAiB;QACjBC,cAAc;QACd,6DAA6D,GAC7DC,aAAa;QACb;;;;;;KAMC,GACDC,YAAY;YACVC,QAAQ;YACRC,WAAW;YACXC,QAAQ;YACRC,QAAQ;QACV;IACF;IACA;;;;GAIC,GACDC,gBAAgB;QACd,0EAA0E,GAC1EC,MAAM;QACN,mDAAmD,GACnDC,OAAO;QACPC,aAAa;QACbC,gBAAgB;QAChBC,UAAU;QACV,0EAA0E,GAC1EC,UAAU;QACVC,MAAM;QACNC,OAAO;QACPC,SAAS;QACTC,UAAU;QACVC,YAAY;QACZ,yEAAyE,GACzEC,UAAU;QACVC,QAAQ;YACNC,SAAS;YACTC,UAAU;YACVC,YAAY;YACZC,MAAM;YACNC,SAAS;QACX;QACA;;;;KAIC,GACDC,kBAAkB;QAClBC,kBAAkB;QAClB,qEAAqE,GACrEC,qBAAqB;IACvB;IACAC,SAAS;QACP,gEAAgE,GAChEC,eAAe;QACfC,QAAQ;QACRC,UAAU;QACVC,UAAU;QACVC,WAAW;QACX,uEAAuE;QACvE,0EAA0E;QAC1E,oBAAoB;QACpBC,MAAM;QACNC,aAAa;QACbC,eAAe;IACjB;IACA;;;;;GAKC,GACD,0FAA0F,GAC1F,sDAAsD,GACtDC,SAAS;QACPzC,KAAK;IACP;IACA0C,SAAS;QACPC,OAAO;IACT;IACAC,SAAS;QACPC,cACE;IACJ;IACAC,aAAa;QACXC,MAAM;QACN,uEAAuE;QACvE,sEAAsE;QACtE,8DAA8D;QAC9DC,KAAK;IACP;IACA;;;;GAIC,GACDC,SAAS;QACPC,SAAS;QACTC,UAAU;QACVC,UAAU;QACVC,SAAS;IACX;IACAC,WAAW;QACTC,UAAU;QACVrC,OACE;QACFsC,aAAa;QACb,0EAA0E;QAC1E,2EAA2E;QAC3E,2EAA2E;QAC3E,8BAA8B;QAC9BC,cAAc;QACdC,SACE;QACFC,gBAAgB;QAChB,qEAAqE;QACrE,2EAA2E;QAC3E,2EAA2E;QAC3E,4EAA4E;QAC5EC,cAAc;QACdC,iBAAiB;QACjBC,mBAAmB;QACnBC,YAAY;QACZC,mBAAmB;IACrB;AAKF,EAAE"}
@@ -52,6 +52,12 @@ export declare const shellCatalogs: {
52
52
  expandGroup: string;
53
53
  collapseGroup: string;
54
54
  };
55
+ regions: {
56
+ nav: string;
57
+ };
58
+ related: {
59
+ count: string;
60
+ };
55
61
  session: {
56
62
  expiringSoon: string;
57
63
  };
@@ -128,6 +134,12 @@ export declare const shellCatalogs: {
128
134
  expandGroup: string;
129
135
  collapseGroup: string;
130
136
  };
137
+ regions: {
138
+ nav: string;
139
+ };
140
+ related: {
141
+ count: string;
142
+ };
131
143
  session: {
132
144
  expiringSoon: string;
133
145
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/i18n/catalog/index.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGhB,CAAC;AAEX,qEAAqE;AACrE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC;AAE1D,eAAO,MAAM,gBAAgB,oBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/i18n/catalog/index.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGhB,CAAC;AAEX,qEAAqE;AACrE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC;AAE1D,eAAO,MAAM,gBAAgB,oBAAqB,CAAC"}
@@ -58,7 +58,7 @@ export declare const useDraftsState: import("zustand").UseBoundStore<Omit<import
58
58
  persist: {
59
59
  setOptions: (options: Partial<import("zustand/middleware").PersistOptions<DraftsState, unknown, unknown>>) => void;
60
60
  clearStorage: () => void;
61
- rehydrate: () => Promise<void> | void;
61
+ rehydrate: () => Promise<void>;
62
62
  hasHydrated: () => boolean;
63
63
  onHydrate: (fn: (state: DraftsState) => void) => () => void;
64
64
  onFinishHydration: (fn: (state: DraftsState) => void) => () => void;
@@ -36,7 +36,7 @@ export declare const useTabsState: import("zustand").UseBoundStore<Omit<import("
36
36
  persist: {
37
37
  setOptions: (options: Partial<import("zustand/middleware").PersistOptions<TabsState, unknown, unknown>>) => void;
38
38
  clearStorage: () => void;
39
- rehydrate: () => Promise<void> | void;
39
+ rehydrate: () => Promise<void>;
40
40
  hasHydrated: () => boolean;
41
41
  onHydrate: (fn: (state: TabsState) => void) => () => void;
42
42
  onFinishHydration: (fn: (state: TabsState) => void) => () => void;
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  }
22
22
  }
23
23
  },
24
- "version": "0.20.2",
24
+ "version": "0.21.0",
25
25
  "description": "Next.js application shell: back-office chrome, workspace tabs, CRUD screens derived from entity metadata, and session and proxy routes.",
26
26
  "license": "MIT",
27
27
  "repository": {
@@ -50,24 +50,24 @@
50
50
  }
51
51
  },
52
52
  "devDependencies": {
53
- "@tanstack/react-query": "^5.105.1",
53
+ "@tanstack/react-query": "^5.107.1",
54
54
  "effect": "4.0.7",
55
55
  "i18next": "26.6.0",
56
56
  "next": "16.4.3",
57
57
  "react": "19.3.1",
58
58
  "react-dom": "19.3.1",
59
- "zustand": "^5.0.16",
60
- "@entifix/testing-unit": "0.20.2"
59
+ "zustand": "^5.1.0",
60
+ "@entifix/testing-unit": "0.21.0"
61
61
  },
62
62
  "dependencies": {
63
63
  "idb": "^8.0.4",
64
- "@entifix/authz": "0.20.2",
65
- "@entifix/business": "0.20.2",
66
- "@entifix/core": "0.20.2",
67
- "@entifix/react-controls": "0.20.2",
68
- "@entifix/i18n": "0.20.2",
69
- "@entifix/react-integration": "0.20.2",
70
- "@entifix/transactions": "0.20.2"
64
+ "@entifix/authz": "0.21.0",
65
+ "@entifix/business": "0.21.0",
66
+ "@entifix/core": "0.21.0",
67
+ "@entifix/i18n": "0.21.0",
68
+ "@entifix/react-controls": "0.21.0",
69
+ "@entifix/react-integration": "0.21.0",
70
+ "@entifix/transactions": "0.21.0"
71
71
  },
72
72
  "files": [
73
73
  "dist",
@@ -1,32 +0,0 @@
1
- import { type EntityRepositoryTag } from '@entifix/business';
2
- import { type Entity, type EntityConstructor, type Locale } from '@entifix/core';
3
- import { Context } from 'effect';
4
- /** One member a list shows as the record it names, and where to read it. */
5
- export interface LinkLabelPlan {
6
- readonly field: string;
7
- readonly entityConstructor: EntityConstructor<Entity>;
8
- readonly labelProperty: string;
9
- readonly ctx: Context.Context<EntityRepositoryTag>;
10
- }
11
- /** What a list cell knows about the record an id names. */
12
- export type LinkLabel = {
13
- readonly state: 'resolving';
14
- } | {
15
- readonly state: 'named';
16
- readonly label: string;
17
- } | {
18
- readonly state: 'unnamed';
19
- };
20
- /** A target's label member as a reader sees it: localized, or as text. */
21
- export declare const targetLabel: (raw: unknown, locale: Locale) => string | undefined;
22
- /**
23
- * The records a page of rows refers to by id, read once per distinct id and
24
- * cached under the target's own scope, so a list column can name each one
25
- * rather than print its key (#200).
26
- */
27
- export declare function useLinkLabels(plans: readonly LinkLabelPlan[], items: readonly Entity[]): (field: string, item: Entity) => LinkLabel | undefined;
28
- /** A list cell for an id: the record's name, a skeleton while it is read. */
29
- export declare function LinkLabelCell({ label }: {
30
- label: LinkLabel | undefined;
31
- }): import("react").JSX.Element;
32
- //# sourceMappingURL=use-link-labels.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-link-labels.d.ts","sourceRoot":"","sources":["../../../src/lib/crud/use-link-labels.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,MAAM,EACX,KAAK,iBAAiB,EAEtB,KAAK,MAAM,EAEZ,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,OAAO,EAAU,MAAM,QAAQ,CAAC;AAEzC,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACtD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACpD;AAED,2DAA2D;AAC3D,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAOlC,0EAA0E;AAC1E,eAAO,MAAM,WAAW,GACtB,KAAK,OAAO,EACZ,QAAQ,MAAM,KACb,MAAM,GAAG,SAKO,CAAC;AAEpB;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,CAiDxD;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,+BAKxE"}
@@ -1,76 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { EntityIdTag, getUCFactory } from '@entifix/business';
4
- import { isLocalizedText, localize } from '@entifix/core';
5
- import { Skeleton, useLocale } from '@entifix/react-controls';
6
- import { entityQueryScope } from '@entifix/react-integration';
7
- import { useQueries } from '@tanstack/react-query';
8
- import { Context, Effect } from 'effect';
9
- const idOf = (item, field)=>{
10
- const raw = item[field];
11
- return raw == null || raw === '' ? undefined : String(raw);
12
- };
13
- /** A target's label member as a reader sees it: localized, or as text. */ export const targetLabel = (raw, locale)=>isLocalizedText(raw) ? localize(raw, locale) : raw == null || raw === '' ? undefined : String(raw);
14
- /**
15
- * The records a page of rows refers to by id, read once per distinct id and
16
- * cached under the target's own scope, so a list column can name each one
17
- * rather than print its key (#200).
18
- */ export function useLinkLabels(plans, items) {
19
- const locale = useLocale();
20
- const requests = plans.flatMap((plan)=>[
21
- ...new Set(items.map((item)=>idOf(item, plan.field)).filter((id)=>id !== undefined))
22
- ].map((id)=>({
23
- plan,
24
- id
25
- })));
26
- const results = useQueries({
27
- queries: requests.map(({ plan, id })=>({
28
- queryKey: [
29
- ...entityQueryScope(plan.entityConstructor),
30
- 'label',
31
- id
32
- ],
33
- queryFn: ()=>Effect.runPromise(Effect.provide(getUCFactory(), plan.ctx.pipe(Context.add(EntityIdTag, id))))
34
- }))
35
- });
36
- const byKey = new Map(requests.map(({ plan, id }, index)=>[
37
- `${plan.field}\u0000${id}`,
38
- {
39
- plan,
40
- result: results[index]
41
- }
42
- ]));
43
- return (field, item)=>{
44
- var _result_data;
45
- const id = idOf(item, field);
46
- if (id === undefined) return undefined;
47
- // Every id on the page was asked for above, so the entry is there.
48
- const { plan, result } = byKey.get(`${field}\u0000${id}`);
49
- if (result.isPending) return {
50
- state: 'resolving'
51
- };
52
- const raw = (_result_data = result.data) == null ? void 0 : _result_data[plan.labelProperty];
53
- const label = targetLabel(raw, locale);
54
- return label === undefined ? {
55
- state: 'unnamed'
56
- } : {
57
- state: 'named',
58
- label
59
- };
60
- };
61
- }
62
- /** A list cell for an id: the record's name, a skeleton while it is read. */ export function LinkLabelCell({ label }) {
63
- if ((label == null ? void 0 : label.state) === 'resolving') return /*#__PURE__*/ _jsx(Skeleton, {
64
- shape: "line",
65
- className: "w-16"
66
- });
67
- if ((label == null ? void 0 : label.state) === 'named') return /*#__PURE__*/ _jsx("span", {
68
- children: label.label
69
- });
70
- return /*#__PURE__*/ _jsx("span", {
71
- className: "text-content-muted",
72
- children: "—"
73
- });
74
- }
75
-
76
- //# sourceMappingURL=use-link-labels.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/crud/use-link-labels.tsx"],"sourcesContent":["'use client';\n\nimport {\n EntityIdTag,\n type EntityRepositoryTag,\n getUCFactory,\n} from '@entifix/business';\nimport {\n type Entity,\n type EntityConstructor,\n isLocalizedText,\n type Locale,\n localize,\n} from '@entifix/core';\nimport { Skeleton, useLocale } from '@entifix/react-controls';\nimport { entityQueryScope } from '@entifix/react-integration';\nimport { useQueries } from '@tanstack/react-query';\nimport { Context, Effect } from 'effect';\n\n/** One member a list shows as the record it names, and where to read it. */\nexport interface LinkLabelPlan {\n readonly field: string;\n readonly entityConstructor: EntityConstructor<Entity>;\n readonly labelProperty: string;\n readonly ctx: Context.Context<EntityRepositoryTag>;\n}\n\n/** What a list cell knows about the record an id names. */\nexport type LinkLabel =\n | { readonly state: 'resolving' }\n | { readonly state: 'named'; readonly label: string }\n | { readonly state: 'unnamed' };\n\nconst idOf = (item: Entity, field: string): string | undefined => {\n const raw = (item as unknown as Record<string, unknown>)[field];\n return raw == null || raw === '' ? undefined : String(raw);\n};\n\n/** A target's label member as a reader sees it: localized, or as text. */\nexport const targetLabel = (\n raw: unknown,\n locale: Locale,\n): string | undefined =>\n isLocalizedText(raw)\n ? localize(raw, locale)\n : raw == null || raw === ''\n ? undefined\n : String(raw);\n\n/**\n * The records a page of rows refers to by id, read once per distinct id and\n * cached under the target's own scope, so a list column can name each one\n * rather than print its key (#200).\n */\nexport function useLinkLabels(\n plans: readonly LinkLabelPlan[],\n items: readonly Entity[],\n): (field: string, item: Entity) => LinkLabel | undefined {\n const locale = useLocale();\n const requests = plans.flatMap(plan =>\n [\n ...new Set(\n items\n .map(item => idOf(item, plan.field))\n .filter((id): id is string => id !== undefined),\n ),\n ].map(id => ({ plan, id })),\n );\n\n const results = useQueries({\n queries: requests.map(({ plan, id }) => ({\n queryKey: [...entityQueryScope(plan.entityConstructor), 'label', id],\n queryFn: () =>\n Effect.runPromise(\n Effect.provide(\n getUCFactory<Entity>(),\n plan.ctx.pipe(Context.add(EntityIdTag, id)),\n ),\n ),\n })),\n });\n\n const byKey = new Map(\n requests.map(({ plan, id }, index) => [\n `${plan.field}\\u0000${id}`,\n { plan, result: results[index] },\n ]),\n );\n\n return (field, item) => {\n const id = idOf(item, field);\n if (id === undefined) return undefined;\n // Every id on the page was asked for above, so the entry is there.\n const { plan, result } = byKey.get(`${field}\\u0000${id}`) as {\n plan: LinkLabelPlan;\n result: (typeof results)[number];\n };\n if (result.isPending) return { state: 'resolving' };\n const raw = (result.data as Record<string, unknown> | undefined)?.[\n plan.labelProperty\n ];\n const label = targetLabel(raw, locale);\n return label === undefined\n ? { state: 'unnamed' }\n : { state: 'named', label };\n };\n}\n\n/** A list cell for an id: the record's name, a skeleton while it is read. */\nexport function LinkLabelCell({ label }: { label: LinkLabel | undefined }) {\n if (label?.state === 'resolving')\n return <Skeleton shape=\"line\" className=\"w-16\" />;\n if (label?.state === 'named') return <span>{label.label}</span>;\n return <span className=\"text-content-muted\">—</span>;\n}\n"],"names":["EntityIdTag","getUCFactory","isLocalizedText","localize","Skeleton","useLocale","entityQueryScope","useQueries","Context","Effect","idOf","item","field","raw","undefined","String","targetLabel","locale","useLinkLabels","plans","items","requests","flatMap","plan","Set","map","filter","id","results","queries","queryKey","entityConstructor","queryFn","runPromise","provide","ctx","pipe","add","byKey","Map","index","result","get","isPending","state","data","labelProperty","label","LinkLabelCell","shape","className","span"],"mappings":"AAAA;;AAEA,SACEA,WAAW,EAEXC,YAAY,QACP,oBAAoB;AAC3B,SAGEC,eAAe,EAEfC,QAAQ,QACH,gBAAgB;AACvB,SAASC,QAAQ,EAAEC,SAAS,QAAQ,0BAA0B;AAC9D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,OAAO,EAAEC,MAAM,QAAQ,SAAS;AAgBzC,MAAMC,OAAO,CAACC,MAAcC;IAC1B,MAAMC,MAAM,AAACF,IAA2C,CAACC,MAAM;IAC/D,OAAOC,OAAO,QAAQA,QAAQ,KAAKC,YAAYC,OAAOF;AACxD;AAEA,wEAAwE,GACxE,OAAO,MAAMG,cAAc,CACzBH,KACAI,SAEAf,gBAAgBW,OACZV,SAASU,KAAKI,UACdJ,OAAO,QAAQA,QAAQ,KACrBC,YACAC,OAAOF,KAAK;AAEpB;;;;CAIC,GACD,OAAO,SAASK,cACdC,KAA+B,EAC/BC,KAAwB;IAExB,MAAMH,SAASZ;IACf,MAAMgB,WAAWF,MAAMG,OAAO,CAACC,CAAAA,OAC7B;eACK,IAAIC,IACLJ,MACGK,GAAG,CAACd,CAAAA,OAAQD,KAAKC,MAAMY,KAAKX,KAAK,GACjCc,MAAM,CAAC,CAACC,KA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