@entifix/next-shell 0.19.0 → 0.20.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.
- package/README.md +7 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/back-office/account-menu.d.ts +10 -1
- package/dist/lib/back-office/account-menu.d.ts.map +1 -1
- package/dist/lib/back-office/account-menu.js +27 -3
- package/dist/lib/back-office/account-menu.js.map +1 -1
- package/dist/lib/back-office/back-office-shell.d.ts +0 -19
- package/dist/lib/back-office/back-office-shell.d.ts.map +1 -1
- package/dist/lib/back-office/back-office-shell.js +75 -59
- package/dist/lib/back-office/back-office-shell.js.map +1 -1
- package/dist/lib/back-office/breadcrumb-labels.d.ts +20 -0
- package/dist/lib/back-office/breadcrumb-labels.d.ts.map +1 -0
- package/dist/lib/back-office/breadcrumb-labels.js +52 -0
- package/dist/lib/back-office/breadcrumb-labels.js.map +1 -0
- package/dist/lib/back-office/breadcrumbs.d.ts.map +1 -1
- package/dist/lib/back-office/breadcrumbs.js +6 -1
- package/dist/lib/back-office/breadcrumbs.js.map +1 -1
- package/dist/lib/back-office/index.d.ts +1 -0
- package/dist/lib/back-office/index.d.ts.map +1 -1
- package/dist/lib/back-office/index.js +1 -0
- package/dist/lib/back-office/index.js.map +1 -1
- package/dist/lib/back-office/sidebar-nav.d.ts.map +1 -1
- package/dist/lib/back-office/sidebar-nav.js +31 -36
- package/dist/lib/back-office/sidebar-nav.js.map +1 -1
- package/dist/lib/command-palette/command-palette-host.d.ts.map +1 -1
- package/dist/lib/command-palette/command-palette-host.js +2 -9
- package/dist/lib/command-palette/command-palette-host.js.map +1 -1
- package/dist/lib/command-palette/use-use-cases-source.d.ts.map +1 -1
- package/dist/lib/command-palette/use-use-cases-source.js +3 -1
- package/dist/lib/command-palette/use-use-cases-source.js.map +1 -1
- package/dist/lib/confirm-action/confirm-action-state.d.ts +33 -0
- package/dist/lib/confirm-action/confirm-action-state.d.ts.map +1 -0
- package/dist/lib/confirm-action/confirm-action-state.js +33 -0
- package/dist/lib/confirm-action/confirm-action-state.js.map +1 -0
- package/dist/lib/confirm-action/confirm-action.d.ts +28 -0
- package/dist/lib/confirm-action/confirm-action.d.ts.map +1 -0
- package/dist/lib/confirm-action/confirm-action.js +129 -0
- package/dist/lib/confirm-action/confirm-action.js.map +1 -0
- package/dist/lib/confirm-action/index.d.ts +3 -0
- package/dist/lib/confirm-action/index.d.ts.map +1 -0
- package/dist/lib/confirm-action/index.js +3 -0
- package/dist/lib/confirm-action/index.js.map +1 -0
- package/dist/lib/crud/entity-crud-form.d.ts +5 -1
- package/dist/lib/crud/entity-crud-form.d.ts.map +1 -1
- package/dist/lib/crud/entity-crud-form.js +5 -10
- package/dist/lib/crud/entity-crud-form.js.map +1 -1
- package/dist/lib/crud/make-entity-crud.d.ts.map +1 -1
- package/dist/lib/crud/make-entity-crud.js +120 -20
- package/dist/lib/crud/make-entity-crud.js.map +1 -1
- package/dist/lib/crud/make-entity-crud.types.d.ts +18 -1
- package/dist/lib/crud/make-entity-crud.types.d.ts.map +1 -1
- package/dist/lib/crud/make-entity-crud.types.js.map +1 -1
- package/dist/lib/crud/use-link-labels.d.ts +32 -0
- package/dist/lib/crud/use-link-labels.d.ts.map +1 -0
- package/dist/lib/crud/use-link-labels.js +76 -0
- package/dist/lib/crud/use-link-labels.js.map +1 -0
- package/dist/lib/i18n/catalog/en.d.ts.map +1 -1
- package/dist/lib/i18n/catalog/en.js +4 -4
- package/dist/lib/i18n/catalog/en.js.map +1 -1
- package/dist/lib/i18n/catalog/es.d.ts +4 -2
- package/dist/lib/i18n/catalog/es.d.ts.map +1 -1
- package/dist/lib/i18n/catalog/es.js +4 -4
- package/dist/lib/i18n/catalog/es.js.map +1 -1
- package/dist/lib/i18n/catalog/index.d.ts +4 -4
- package/dist/lib/theme/theme-cookies.d.ts +27 -0
- package/dist/lib/theme/theme-cookies.d.ts.map +1 -0
- package/dist/lib/theme/theme-cookies.js +18 -0
- package/dist/lib/theme/theme-cookies.js.map +1 -0
- package/dist/lib/workspace/pending-flows.d.ts.map +1 -1
- package/dist/lib/workspace/pending-flows.js +15 -6
- package/dist/lib/workspace/pending-flows.js.map +1 -1
- package/dist/lib/workspace/workspace-shell.d.ts.map +1 -1
- package/dist/lib/workspace/workspace-shell.js +11 -2
- package/dist/lib/workspace/workspace-shell.js.map +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +5 -0
- package/dist/server.js.map +1 -1
- package/package.json +9 -9
- package/dist/lib/crud/validation-messages.d.ts +0 -13
- package/dist/lib/crud/validation-messages.d.ts.map +0 -1
- package/dist/lib/crud/validation-messages.js +0 -36
- package/dist/lib/crud/validation-messages.js.map +0 -1
|
@@ -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
|
|
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"}
|
|
@@ -9,9 +9,8 @@ export declare const shellCatalogs: {
|
|
|
9
9
|
nav: {
|
|
10
10
|
primary: string;
|
|
11
11
|
openInWorkspace: string;
|
|
12
|
-
openInWorkspaceShort: string;
|
|
13
12
|
openInNewTab: string;
|
|
14
|
-
|
|
13
|
+
itemActions: string;
|
|
15
14
|
screenType: {
|
|
16
15
|
master: string;
|
|
17
16
|
operation: string;
|
|
@@ -44,6 +43,7 @@ export declare const shellCatalogs: {
|
|
|
44
43
|
openInWorkspaceHint: string;
|
|
45
44
|
};
|
|
46
45
|
sidebar: {
|
|
46
|
+
skipToContent: string;
|
|
47
47
|
expand: string;
|
|
48
48
|
collapse: string;
|
|
49
49
|
openMenu: string;
|
|
@@ -85,9 +85,8 @@ export declare const shellCatalogs: {
|
|
|
85
85
|
nav: {
|
|
86
86
|
primary: string;
|
|
87
87
|
openInWorkspace: string;
|
|
88
|
-
openInWorkspaceShort: string;
|
|
89
88
|
openInNewTab: string;
|
|
90
|
-
|
|
89
|
+
itemActions: string;
|
|
91
90
|
screenType: {
|
|
92
91
|
master: string;
|
|
93
92
|
operation: string;
|
|
@@ -120,6 +119,7 @@ export declare const shellCatalogs: {
|
|
|
120
119
|
openInWorkspaceHint: string;
|
|
121
120
|
};
|
|
122
121
|
sidebar: {
|
|
122
|
+
skipToContent: string;
|
|
123
123
|
expand: string;
|
|
124
124
|
collapse: string;
|
|
125
125
|
openMenu: string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** A request's cookies, as `cookies()` from `next/headers` answers them. */
|
|
2
|
+
export interface CookieReader {
|
|
3
|
+
get(name: string): {
|
|
4
|
+
readonly value: string;
|
|
5
|
+
} | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface ThemeCookieOptions {
|
|
8
|
+
/** The theme ids the app registers; an unknown stored one is ignored. */
|
|
9
|
+
readonly themes: readonly string[];
|
|
10
|
+
/** The theme when nothing valid is stored; the first one otherwise. */
|
|
11
|
+
readonly defaultTheme?: string;
|
|
12
|
+
/** The density when nothing valid is stored. */
|
|
13
|
+
readonly defaultDensity?: 'comfortable' | 'compact';
|
|
14
|
+
/** The cookie `ThemeProvider` keeps the choice in. */
|
|
15
|
+
readonly storageKey?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The theme and density a reader chose, read from the request's cookies, so a
|
|
19
|
+
* root layout renders `data-theme` and `data-density` with the page — no paint
|
|
20
|
+
* in the wrong palette, and nothing that changes after it loads. Hand the same
|
|
21
|
+
* values to `ThemeProvider` as `initialTheme` and `initialDensity`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readThemeCookies(cookies: CookieReader, { themes, defaultTheme, defaultDensity, storageKey, }: ThemeCookieOptions): {
|
|
24
|
+
theme: string;
|
|
25
|
+
density: 'comfortable' | 'compact' | undefined;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=theme-cookies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-cookies.d.ts","sourceRoot":"","sources":["../../../src/lib/theme/theme-cookies.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CAC3D;AAED,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,uEAAuE;IACvE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,gDAAgD;IAChD,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACpD,sDAAsD;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,EACE,MAAM,EACN,YAAY,EACZ,cAAc,EACd,UAAyB,GAC1B,EAAE,kBAAkB,GACpB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,CAAA;CAAE,CAanE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { densityCookie, THEME_COOKIE } from '@entifix/react-controls';
|
|
2
|
+
/**
|
|
3
|
+
* The theme and density a reader chose, read from the request's cookies, so a
|
|
4
|
+
* root layout renders `data-theme` and `data-density` with the page — no paint
|
|
5
|
+
* in the wrong palette, and nothing that changes after it loads. Hand the same
|
|
6
|
+
* values to `ThemeProvider` as `initialTheme` and `initialDensity`.
|
|
7
|
+
*/ export function readThemeCookies(cookies, { themes, defaultTheme, defaultDensity, storageKey = THEME_COOKIE }) {
|
|
8
|
+
var _ref;
|
|
9
|
+
var _cookies_get, _cookies_get1;
|
|
10
|
+
const stored = (_cookies_get = cookies.get(storageKey)) == null ? void 0 : _cookies_get.value;
|
|
11
|
+
const density = (_cookies_get1 = cookies.get(densityCookie(storageKey))) == null ? void 0 : _cookies_get1.value;
|
|
12
|
+
return {
|
|
13
|
+
theme: stored !== undefined && themes.includes(stored) ? stored : (_ref = defaultTheme != null ? defaultTheme : themes[0]) != null ? _ref : '',
|
|
14
|
+
density: density === 'comfortable' || density === 'compact' ? density : defaultDensity
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=theme-cookies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/theme/theme-cookies.ts"],"sourcesContent":["import { densityCookie, THEME_COOKIE } from '@entifix/react-controls';\n\n/** A request's cookies, as `cookies()` from `next/headers` answers them. */\nexport interface CookieReader {\n get(name: string): { readonly value: string } | undefined;\n}\n\nexport interface ThemeCookieOptions {\n /** The theme ids the app registers; an unknown stored one is ignored. */\n readonly themes: readonly string[];\n /** The theme when nothing valid is stored; the first one otherwise. */\n readonly defaultTheme?: string;\n /** The density when nothing valid is stored. */\n readonly defaultDensity?: 'comfortable' | 'compact';\n /** The cookie `ThemeProvider` keeps the choice in. */\n readonly storageKey?: string;\n}\n\n/**\n * The theme and density a reader chose, read from the request's cookies, so a\n * root layout renders `data-theme` and `data-density` with the page — no paint\n * in the wrong palette, and nothing that changes after it loads. Hand the same\n * values to `ThemeProvider` as `initialTheme` and `initialDensity`.\n */\nexport function readThemeCookies(\n cookies: CookieReader,\n {\n themes,\n defaultTheme,\n defaultDensity,\n storageKey = THEME_COOKIE,\n }: ThemeCookieOptions,\n): { theme: string; density: 'comfortable' | 'compact' | undefined } {\n const stored = cookies.get(storageKey)?.value;\n const density = cookies.get(densityCookie(storageKey))?.value;\n return {\n theme:\n stored !== undefined && themes.includes(stored)\n ? stored\n : (defaultTheme ?? themes[0] ?? ''),\n density:\n density === 'comfortable' || density === 'compact'\n ? density\n : defaultDensity,\n };\n}\n"],"names":["densityCookie","THEME_COOKIE","readThemeCookies","cookies","themes","defaultTheme","defaultDensity","storageKey","stored","get","value","density","theme","undefined","includes"],"mappings":"AAAA,SAASA,aAAa,EAAEC,YAAY,QAAQ,0BAA0B;AAkBtE;;;;;CAKC,GACD,OAAO,SAASC,iBACdC,OAAqB,EACrB,EACEC,MAAM,EACNC,YAAY,EACZC,cAAc,EACdC,aAAaN,YAAY,EACN;QAQZI;QANMF,cACCA;IADhB,MAAMK,UAASL,eAAAA,QAAQM,GAAG,CAACF,gCAAZJ,aAAyBO,KAAK;IAC7C,MAAMC,WAAUR,gBAAAA,QAAQM,GAAG,CAACT,cAAcO,iCAA1BJ,cAAwCO,KAAK;IAC7D,OAAO;QACLE,OACEJ,WAAWK,aAAaT,OAAOU,QAAQ,CAACN,UACpCA,UACCH,OAAAA,uBAAAA,eAAgBD,MAAM,CAAC,EAAE,YAAzBC,OAA6B;QACpCM,SACEA,YAAY,iBAAiBA,YAAY,YACrCA,UACAL;IACR;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pending-flows.d.ts","sourceRoot":"","sources":["../../../src/lib/workspace/pending-flows.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,kBAAkB,EAEvB,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"pending-flows.d.ts","sourceRoot":"","sources":["../../../src/lib/workspace/pending-flows.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,kBAAkB,EAEvB,KAAK,WAAW,EAGjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAKhD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,QAAiB,CAAC;AAQtD,MAAM,WAAW,yBAAyB;IACxC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,OAAO,EACP,UAAU,EACV,QAAkC,EAClC,OAA4B,EAC5B,QAAQ,GACT,EAAE,yBAAyB,+BAwC3B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
import { useToasts } from '@entifix/react-controls';
|
|
5
|
-
import { makePendingFlowStore, PendingFlowStoreProvider, usePendingFlowSettlement } from '@entifix/react-integration';
|
|
4
|
+
import { LiveUpdatesProvider, useToasts } from '@entifix/react-controls';
|
|
5
|
+
import { makePendingFlowStore, PendingFlowStoreProvider, usePendingFlowSettlement, usePushConnection } from '@entifix/react-integration';
|
|
6
6
|
import { useMemo } from 'react';
|
|
7
7
|
import { makeIndexedDbStateStorage } from './idb-state-storage.js';
|
|
8
8
|
import { ANONYMOUS_WORKSPACE_SCOPE } from './workspace-scope.js';
|
|
@@ -29,6 +29,9 @@ const pendingFlowStorage = makeIndexedDbStateStorage('entifix-pending-flows', 'f
|
|
|
29
29
|
* only the workspace: a create is `/<basePath>/new` on the route host.
|
|
30
30
|
*/ export function PendingFlowsProvider({ scope, channel, readStatus, maxAgeMs = PENDING_FLOW_MAX_AGE_MS, storage = pendingFlowStorage, children }) {
|
|
31
31
|
const toasts = useToasts();
|
|
32
|
+
// The stream a pending write waits on, published to the controls: the top
|
|
33
|
+
// bar says when live updates are paused, a pending write that it is waiting.
|
|
34
|
+
const live = usePushConnection(channel);
|
|
32
35
|
// A store per principal: a sign-in under another scope must never read the
|
|
33
36
|
// previous one's pending writes.
|
|
34
37
|
const store = useMemo(()=>makePendingFlowStore({
|
|
@@ -47,13 +50,19 @@ const pendingFlowStorage = makeIndexedDbStateStorage('entifix-pending-flows', 'f
|
|
|
47
50
|
readStatus
|
|
48
51
|
}, {
|
|
49
52
|
onFailure: (failure)=>{
|
|
50
|
-
toasts == null ? void 0 : toasts.
|
|
53
|
+
toasts == null ? void 0 : toasts.show({
|
|
54
|
+
tone: 'failure',
|
|
55
|
+
failure
|
|
56
|
+
});
|
|
51
57
|
}
|
|
52
58
|
}));
|
|
53
59
|
if (toasts === undefined) throw new Error('PendingFlowsProvider must sit inside a ToastProvider: a failed flow has nowhere else to be shown');
|
|
54
|
-
return /*#__PURE__*/ _jsx(
|
|
55
|
-
|
|
56
|
-
children:
|
|
60
|
+
return /*#__PURE__*/ _jsx(LiveUpdatesProvider, {
|
|
61
|
+
value: live,
|
|
62
|
+
children: /*#__PURE__*/ _jsx(PendingFlowStoreProvider, {
|
|
63
|
+
store: store,
|
|
64
|
+
children: children
|
|
65
|
+
})
|
|
57
66
|
});
|
|
58
67
|
}
|
|
59
68
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/workspace/pending-flows.tsx"],"sourcesContent":["'use client';\n\nimport { useToasts } from '@entifix/react-controls';\nimport {\n type FlowStatusRead,\n makePendingFlowStore,\n type PendingFlowStorage,\n PendingFlowStoreProvider,\n type PushChannel,\n usePendingFlowSettlement,\n} from '@entifix/react-integration';\nimport { type ReactNode, useMemo } from 'react';\n\nimport { makeIndexedDbStateStorage } from './idb-state-storage.js';\nimport { ANONYMOUS_WORKSPACE_SCOPE } from './workspace-scope.js';\n\n/**\n * How long a pending flow nobody can account for is kept before it is\n * dropped: no push arrived, and its status read answers nothing. Long enough\n * for a flow that waits on a person, short enough that a lost one does not\n * hold a form open across a working day.\n */\nexport const PENDING_FLOW_MAX_AGE_MS = 30 * 60 * 1000;\n\n// Module scope: a storage per render would reopen the database each time.\nconst pendingFlowStorage = makeIndexedDbStateStorage(\n 'entifix-pending-flows',\n 'flows',\n);\n\nexport interface PendingFlowsProviderProps {\n /**\n * Whose pending flows these are — `workspaceScopeKey({ userId,\n * organizationId })`, or `ANONYMOUS_WORKSPACE_SCOPE` for nobody in\n * particular, which keeps flow ids and their age only.\n *\n * Required because IndexedDB belongs to the browser profile, not to\n * whoever signed in.\n */\n readonly scope: string;\n /** The tab's push channel, where each pending flow's outcome arrives. */\n readonly channel: PushChannel;\n /**\n * Reads a flow's status link when its push may have been missed —\n * `buildFlowStatusReader()` over REST. Omitted, a flow settles by push\n * alone, and one whose push was missed is dropped at the age bound.\n */\n readonly readStatus?: FlowStatusRead;\n readonly maxAgeMs?: number;\n /** Defaults to IndexedDB, so a pending write survives a reload. */\n readonly storage?: PendingFlowStorage;\n readonly children: ReactNode;\n}\n\n/**\n * Waits on every write this browser handed to a flow, and tells the operator\n * once when one fails\n * ([ADR 0022](../../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)).\n *\n * It holds the pending-flow store the generated CRUD records into, persisted\n * per principal, and settles each flow from its push or from a status read\n * after a reconnect. A failed flow is shown through the host's\n * `ToastRegion`, translated, exactly once — however many tabs or\n * redeliveries report it.\n *\n * ⚠️ **Mount it inside a `ToastProvider`, and above the plain routes**, not\n * only the workspace: a create is `/<basePath>/new` on the route host.\n */\nexport function PendingFlowsProvider({\n scope,\n channel,\n readStatus,\n maxAgeMs = PENDING_FLOW_MAX_AGE_MS,\n storage = pendingFlowStorage,\n children,\n}: PendingFlowsProviderProps) {\n const toasts = useToasts();\n\n // A store per principal: a sign-in under another scope must never read the\n // previous one's pending writes.\n const store = useMemo(\n () =>\n makePendingFlowStore({\n storage,\n key: `pending-flows:${scope}`,\n anonymous: scope === ANONYMOUS_WORKSPACE_SCOPE,\n }),\n [scope, storage],\n );\n\n usePendingFlowSettlement({\n channel,\n store,\n maxAgeMs,\n ...(readStatus === undefined ? {} : { readStatus }),\n onFailure: failure => {\n toasts?.
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/workspace/pending-flows.tsx"],"sourcesContent":["'use client';\n\nimport { LiveUpdatesProvider, useToasts } from '@entifix/react-controls';\nimport {\n type FlowStatusRead,\n makePendingFlowStore,\n type PendingFlowStorage,\n PendingFlowStoreProvider,\n type PushChannel,\n usePendingFlowSettlement,\n usePushConnection,\n} from '@entifix/react-integration';\nimport { type ReactNode, useMemo } from 'react';\n\nimport { makeIndexedDbStateStorage } from './idb-state-storage.js';\nimport { ANONYMOUS_WORKSPACE_SCOPE } from './workspace-scope.js';\n\n/**\n * How long a pending flow nobody can account for is kept before it is\n * dropped: no push arrived, and its status read answers nothing. Long enough\n * for a flow that waits on a person, short enough that a lost one does not\n * hold a form open across a working day.\n */\nexport const PENDING_FLOW_MAX_AGE_MS = 30 * 60 * 1000;\n\n// Module scope: a storage per render would reopen the database each time.\nconst pendingFlowStorage = makeIndexedDbStateStorage(\n 'entifix-pending-flows',\n 'flows',\n);\n\nexport interface PendingFlowsProviderProps {\n /**\n * Whose pending flows these are — `workspaceScopeKey({ userId,\n * organizationId })`, or `ANONYMOUS_WORKSPACE_SCOPE` for nobody in\n * particular, which keeps flow ids and their age only.\n *\n * Required because IndexedDB belongs to the browser profile, not to\n * whoever signed in.\n */\n readonly scope: string;\n /** The tab's push channel, where each pending flow's outcome arrives. */\n readonly channel: PushChannel;\n /**\n * Reads a flow's status link when its push may have been missed —\n * `buildFlowStatusReader()` over REST. Omitted, a flow settles by push\n * alone, and one whose push was missed is dropped at the age bound.\n */\n readonly readStatus?: FlowStatusRead;\n readonly maxAgeMs?: number;\n /** Defaults to IndexedDB, so a pending write survives a reload. */\n readonly storage?: PendingFlowStorage;\n readonly children: ReactNode;\n}\n\n/**\n * Waits on every write this browser handed to a flow, and tells the operator\n * once when one fails\n * ([ADR 0022](../../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)).\n *\n * It holds the pending-flow store the generated CRUD records into, persisted\n * per principal, and settles each flow from its push or from a status read\n * after a reconnect. A failed flow is shown through the host's\n * `ToastRegion`, translated, exactly once — however many tabs or\n * redeliveries report it.\n *\n * ⚠️ **Mount it inside a `ToastProvider`, and above the plain routes**, not\n * only the workspace: a create is `/<basePath>/new` on the route host.\n */\nexport function PendingFlowsProvider({\n scope,\n channel,\n readStatus,\n maxAgeMs = PENDING_FLOW_MAX_AGE_MS,\n storage = pendingFlowStorage,\n children,\n}: PendingFlowsProviderProps) {\n const toasts = useToasts();\n // The stream a pending write waits on, published to the controls: the top\n // bar says when live updates are paused, a pending write that it is waiting.\n const live = usePushConnection(channel);\n\n // A store per principal: a sign-in under another scope must never read the\n // previous one's pending writes.\n const store = useMemo(\n () =>\n makePendingFlowStore({\n storage,\n key: `pending-flows:${scope}`,\n anonymous: scope === ANONYMOUS_WORKSPACE_SCOPE,\n }),\n [scope, storage],\n );\n\n usePendingFlowSettlement({\n channel,\n store,\n maxAgeMs,\n ...(readStatus === undefined ? {} : { readStatus }),\n onFailure: failure => {\n toasts?.show({ tone: 'failure', failure });\n },\n });\n\n if (toasts === undefined)\n throw new Error(\n 'PendingFlowsProvider must sit inside a ToastProvider: a failed flow has nowhere else to be shown',\n );\n\n return (\n <LiveUpdatesProvider value={live}>\n <PendingFlowStoreProvider store={store}>\n {children}\n </PendingFlowStoreProvider>\n </LiveUpdatesProvider>\n );\n}\n"],"names":["LiveUpdatesProvider","useToasts","makePendingFlowStore","PendingFlowStoreProvider","usePendingFlowSettlement","usePushConnection","useMemo","makeIndexedDbStateStorage","ANONYMOUS_WORKSPACE_SCOPE","PENDING_FLOW_MAX_AGE_MS","pendingFlowStorage","PendingFlowsProvider","scope","channel","readStatus","maxAgeMs","storage","children","toasts","live","store","key","anonymous","undefined","onFailure","failure","show","tone","Error","value"],"mappings":"AAAA;;;AAEA,SAASA,mBAAmB,EAAEC,SAAS,QAAQ,0BAA0B;AACzE,SAEEC,oBAAoB,EAEpBC,wBAAwB,EAExBC,wBAAwB,EACxBC,iBAAiB,QACZ,6BAA6B;AACpC,SAAyBC,OAAO,QAAQ,QAAQ;AAEhD,SAASC,yBAAyB,QAAQ,yBAAyB;AACnE,SAASC,yBAAyB,QAAQ,uBAAuB;AAEjE;;;;;CAKC,GACD,OAAO,MAAMC,0BAA0B,KAAK,KAAK,KAAK;AAEtD,0EAA0E;AAC1E,MAAMC,qBAAqBH,0BACzB,yBACA;AA2BF;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASI,qBAAqB,EACnCC,KAAK,EACLC,OAAO,EACPC,UAAU,EACVC,WAAWN,uBAAuB,EAClCO,UAAUN,kBAAkB,EAC5BO,QAAQ,EACkB;IAC1B,MAAMC,SAASjB;IACf,0EAA0E;IAC1E,6EAA6E;IAC7E,MAAMkB,OAAOd,kBAAkBQ;IAE/B,2EAA2E;IAC3E,iCAAiC;IACjC,MAAMO,QAAQd,QACZ,IACEJ,qBAAqB;YACnBc;YACAK,KAAK,CAAC,cAAc,EAAET,OAAO;YAC7BU,WAAWV,UAAUJ;QACvB,IACF;QAACI;QAAOI;KAAQ;IAGlBZ,yBAAyB;QACvBS;QACAO;QACAL;OACID,eAAeS,YAAY,CAAC,IAAI;QAAET;IAAW;QACjDU,WAAWC,CAAAA;YACTP,0BAAAA,OAAQQ,IAAI,CAAC;gBAAEC,MAAM;gBAAWF;YAAQ;QAC1C;;IAGF,IAAIP,WAAWK,WACb,MAAM,IAAIK,MACR;IAGJ,qBACE,KAAC5B;QAAoB6B,OAAOV;kBAC1B,cAAA,KAAChB;YAAyBiB,OAAOA;sBAC9BH;;;AAIT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-shell.d.ts","sourceRoot":"","sources":["../../../src/lib/workspace/workspace-shell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace-shell.d.ts","sourceRoot":"","sources":["../../../src/lib/workspace/workspace-shell.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,SAAS,EAA8B,MAAM,OAAO,CAAC;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;OAQG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,QAAQ,EAAE,WAAW,CAAC;IACtB,yEAAyE;IACzE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,gCAAgC;IAChC,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,GACX,EAAE,mBAAmB,+BAsNrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ConfirmDialog, Tab, TabPanel, TabStrip, TopBar, useT, useTranslateKey } from '@entifix/react-controls';
|
|
3
|
+
import { ConfirmDialog, HotkeyScopeProvider, Tab, TabPanel, TabStrip, TopBar, useLiveUpdates, useT, useTranslateKey } from '@entifix/react-controls';
|
|
4
4
|
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
|
5
5
|
import { useEffect, useId, useState } from 'react';
|
|
6
6
|
import { useDraftsState } from './drafts-state.js';
|
|
@@ -15,6 +15,7 @@ import { useTabsState } from './tabs-state.js';
|
|
|
15
15
|
* instead of crashing.
|
|
16
16
|
*/ export function WorkspaceShell({ scope, registry, actions, fallback, emptyState }) {
|
|
17
17
|
const t = useT('shell');
|
|
18
|
+
const live = useLiveUpdates();
|
|
18
19
|
// Tab captions are catalog keys carried in a registry, not authored copy.
|
|
19
20
|
const translate = useTranslateKey();
|
|
20
21
|
const searchParams = useSearchParams();
|
|
@@ -159,6 +160,8 @@ import { useTabsState } from './tabs-state.js';
|
|
|
159
160
|
className: "min-w-0 flex flex-1 flex-col",
|
|
160
161
|
children: [
|
|
161
162
|
/*#__PURE__*/ _jsx(TopBar, {
|
|
163
|
+
connection: live.connection,
|
|
164
|
+
onReconnect: live.reconnect,
|
|
162
165
|
children: /*#__PURE__*/ _jsxs(TopBar.Actions, {
|
|
163
166
|
children: [
|
|
164
167
|
activeParam && /*#__PURE__*/ _jsx("button", {
|
|
@@ -195,7 +198,13 @@ import { useTabsState } from './tabs-state.js';
|
|
|
195
198
|
id: panelId,
|
|
196
199
|
labelledBy: !deadLink && activeIndex >= 0 ? tabId(activeIndex) : undefined,
|
|
197
200
|
className: "min-w-0 flex-1 p-m",
|
|
198
|
-
children:
|
|
201
|
+
children: /*#__PURE__*/ _jsx(HotkeyScopeProvider, {
|
|
202
|
+
value: {
|
|
203
|
+
id: `tab:${activeParam != null ? activeParam : ''}`,
|
|
204
|
+
active: true
|
|
205
|
+
},
|
|
206
|
+
children: body
|
|
207
|
+
})
|
|
199
208
|
}),
|
|
200
209
|
pendingClose && /*#__PURE__*/ _jsx(ConfirmDialog, {
|
|
201
210
|
open: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/workspace/workspace-shell.tsx"],"sourcesContent":["'use client';\n\nimport {\n ConfirmDialog,\n Tab,\n TabPanel,\n TabStrip,\n TopBar,\n useT,\n useTranslateKey,\n} from '@entifix/react-controls';\nimport { usePathname, useRouter, useSearchParams } from 'next/navigation';\nimport { type ReactNode, useEffect, useId, useState } from 'react';\n\nimport { useDraftsState } from './drafts-state.js';\nimport type { TabRegistry } from './tab-kind.js';\nimport { useTabsState } from './tabs-state.js';\n\nexport interface WorkspaceShellProps {\n /**\n * Who this workspace belongs to — `workspaceScopeKey({ userId,\n * organizationId })`, resolved on the server from the session.\n *\n * Required, deliberately: IndexedDB is a property of the browser profile, so a\n * host that forgets to pass one hands the next account to sign in on that\n * machine the previous account's open tabs and half-finished edits. A default\n * would make that the quiet outcome of doing nothing.\n */\n scope: string;\n /** Resolves `?tab=` values to renderable tabs. */\n registry: TabRegistry;\n /** Right-aligned actions above the tab strip (search, the user menu). */\n actions?: ReactNode;\n /** Body when `?tab=` names something the registry cannot resolve. */\n fallback?: ReactNode;\n /** Body when no tab is open. */\n emptyState?: ReactNode;\n}\n\n/**\n * The tab workspace: a strip of persisted tabs over the active tab's body — no\n * sidebar or brand of its own. It is mounted inside a host shell (the\n * back-office layout, say) that already supplies those, so nesting two\n * sidebars never happens. The open set lives in {@link useTabsState}\n * (IndexedDB); the URL's `?tab=` projects only the active tab, so a deep link\n * opens or focuses exactly that tab and an unknown kind shows the fallback\n * instead of crashing.\n */\nexport function WorkspaceShell({\n scope,\n registry,\n actions,\n fallback,\n emptyState,\n}: WorkspaceShellProps) {\n const t = useT('shell');\n // Tab captions are catalog keys carried in a registry, not authored copy.\n const translate = useTranslateKey();\n const searchParams = useSearchParams();\n const router = useRouter();\n const pathname = usePathname();\n const urlTab = searchParams.get('tab');\n\n const tabs = useTabsState(state => state.tabs);\n const activeParam = useTabsState(state => state.activeParam);\n const open = useTabsState(state => state.open);\n const close = useTabsState(state => state.close);\n const activate = useTabsState(state => state.activate);\n\n const drafts = useDraftsState(state => state.drafts);\n const clearDraft = useDraftsState(state => state.clearDraft);\n\n // Load the persisted tab set and drafts once, on the client (hydration is\n // skipped at creation so SSR never touches IndexedDB).\n //\n // Both URL effects below wait on this flag, because the read is async and\n // lands *after* the first commit: opening the deep-linked tab before it\n // resolves means the restored snapshot's `activeParam` overwrites the tab the\n // URL asked for, and the write-back then projects that wrong tab into the\n // address bar. The URL is the more specific instruction, so it is applied\n // once the store has finished restoring rather than before.\n const [hydrated, setHydrated] = useState(false);\n useEffect(() => {\n // The scope is applied *before* the read, not after: the storage key is what\n // decides whose tabs and drafts come back, so setting it late would restore\n // the unscoped set first and only then start writing to the right key. Both\n // stores are module singletons with `skipHydration`, and this is the only\n // place that rehydrates them, so re-pointing them here is enough — no store\n // factory or provider is needed to keep two accounts apart.\n useTabsState.persist.setOptions({ name: `tabs:${scope}` });\n useDraftsState.persist.setOptions({ name: `drafts:${scope}` });\n void Promise.all([\n useTabsState.persist.rehydrate(),\n useDraftsState.persist.rehydrate(),\n ]).finally(() => setHydrated(true));\n }, [scope]);\n\n // The `?tab=` value the registry cannot resolve, if any — derived, so it is\n // known on the very first render rather than an effect later. An\n // unresolvable address used to be dropped on the floor: no tab, no error,\n // and the write-back below then replaced it with the previously active tab,\n // so even the URL stopped saying what was asked for. Here it answers with\n // the fallback and the bad address stays in the bar, where it can be read.\n //\n // `dismissed` is the escape: a deliberate tab interaction is a newer\n // instruction than the address that failed, and it holds the *value* rather\n // than a flag so the next dead link is dead again.\n const [dismissed, setDismissed] = useState<string | null>(null);\n const deadLink =\n urlTab && urlTab !== dismissed && !registry.resolve(urlTab, translate)\n ? urlTab\n : null;\n\n // A tab is dirty while its address has an unsaved draft; closing one confirms.\n //\n // The confirmation is a rendered dialog, so the decision spans two commits\n // rather than one blocking call: `handleClose` either closes outright or\n // parks the address, and the dialog's own buttons finish it. `window.confirm`\n // could not be styled, blocked the thread while it was up, and in Playwright\n // had to be driven by a global `page.on('dialog')` handler registered before\n // the click — which is why the workspace had no end-to-end test at all.\n const [pendingClose, setPendingClose] = useState<string | null>(null);\n\n const commitClose = (param: string) => {\n // Unconditional: `clearDraft` returns the state unchanged when the address\n // holds no draft, so the clean path costs a no-op rather than a branch.\n clearDraft(param);\n setDismissed(urlTab);\n close(param);\n };\n\n const handleClose = (param: string) => {\n if (param in drafts) {\n setPendingClose(param);\n return;\n }\n commitClose(param);\n };\n\n const handleActivate = (param: string) => {\n setDismissed(urlTab);\n activate(param);\n };\n\n // Deep link → open/focus the addressed tab (a dead one shows the fallback).\n useEffect(() => {\n if (!hydrated || !urlTab) return;\n const resolved = registry.resolve(urlTab, translate);\n if (resolved) {\n open({ param: resolved.param, title: resolved.title });\n }\n }, [hydrated, urlTab, registry, open, translate]);\n\n // Project the active tab back to the URL so it stays shareable.\n //\n // The active tab is read from the *committed* store rather than from this\n // render's snapshot. Following a link to a second tab changes the URL one\n // commit before the store catches up, so the snapshot still names the\n // previously active tab — writing that back would undo the navigation, the\n // effect above would re-open the URL's tab, and the two would trade the\n // address bar back and forth forever (a visible flicker between, say, brands\n // and categories). The effect above runs first in the same commit, so by the\n // time this one reads the store the URL's tab is already active.\n // That ordering is also what makes the `hydrated` gate work: when the flag\n // flips, the effect above has already re-applied the URL's tab over the\n // restored snapshot, so there is nothing here to write back.\n //\n // A dead deep link suspends it: overwriting the address the visitor typed\n // with an unrelated tab is what made the failure invisible in the first place.\n useEffect(() => {\n if (!hydrated || deadLink) return;\n const active = useTabsState.getState().activeParam;\n if (active && active !== urlTab) {\n router.replace(`${pathname}?tab=${encodeURIComponent(active)}`);\n }\n }, [hydrated, deadLink, activeParam, urlTab, pathname, router]);\n\n const copyDeepLink = (param: string) => {\n void navigator.clipboard.writeText(\n `${window.location.origin}${pathname}?tab=${encodeURIComponent(param)}`,\n );\n };\n\n // Tab and panel ids: DOM ids, so derived from the tab's position under one\n // per-shell prefix rather than from its param, which holds `:` and `#`.\n const idBase = useId();\n const panelId = `${idBase}-panel`;\n const tabId = (index: number) => `${idBase}-tab-${index}`;\n const activeIndex = tabs.findIndex(tab => tab.param === activeParam);\n\n const activeResolved = activeParam\n ? registry.resolve(activeParam, translate)\n : null;\n const body = deadLink\n ? fallback\n : activeResolved\n ? activeResolved.render()\n : emptyState;\n\n return (\n <div className=\"min-w-0 flex flex-1 flex-col\">\n <TopBar>\n <TopBar.Actions>\n {activeParam && (\n <button\n type=\"button\"\n onClick={() => copyDeepLink(activeParam)}\n className=\"rounded-md px-2xs py-3xs text-step-sm text-content-muted focus-ring transition hover:bg-surface hover:text-content\"\n >\n {t('workspace.copyLink')}\n </button>\n )}\n {actions}\n </TopBar.Actions>\n </TopBar>\n\n <TabStrip>\n {tabs.map((tab, index) => (\n <Tab\n key={tab.param}\n id={tabId(index)}\n controls={panelId}\n // Re-derived from the registry rather than read back from the\n // store: the persisted title is whatever locale it was opened\n // in, so a locale switch would leave stale captions behind.\n label={registry.resolve(tab.param, translate)?.title ?? tab.title}\n // Nothing is selected while the fallback is up: a highlighted\n // tab beside a body that is not its own reads as a render bug.\n active={!deadLink && tab.param === activeParam}\n state={tab.param in drafts ? 'dirty' : 'idle'}\n onSelect={() => handleActivate(tab.param)}\n onClose={() => handleClose(tab.param)}\n />\n ))}\n </TabStrip>\n\n <TabPanel\n id={panelId}\n labelledBy={\n !deadLink && activeIndex >= 0 ? tabId(activeIndex) : undefined\n }\n className=\"min-w-0 flex-1 p-m\"\n >\n {body}\n </TabPanel>\n\n {pendingClose && (\n <ConfirmDialog\n open\n tone=\"destructive\"\n title={t('workspace.discardTitle')}\n message={t('workspace.discard')}\n confirmLabel={t('workspace.discardConfirm')}\n onCancel={() => setPendingClose(null)}\n onConfirm={() => {\n commitClose(pendingClose);\n setPendingClose(null);\n }}\n />\n )}\n </div>\n );\n}\n"],"names":["ConfirmDialog","Tab","TabPanel","TabStrip","TopBar","useT","useTranslateKey","usePathname","useRouter","useSearchParams","useEffect","useId","useState","useDraftsState","useTabsState","WorkspaceShell","scope","registry","actions","fallback","emptyState","t","translate","searchParams","router","pathname","urlTab","get","tabs","state","activeParam","open","close","activate","drafts","clearDraft","hydrated","setHydrated","persist","setOptions","name","Promise","all","rehydrate","finally","dismissed","setDismissed","deadLink","resolve","pendingClose","setPendingClose","commitClose","param","handleClose","handleActivate","resolved","title","active","getState","replace","encodeURIComponent","copyDeepLink","navigator","clipboard","writeText","window","location","origin","idBase","panelId","tabId","index","activeIndex","findIndex","tab","activeResolved","body","render","div","className","Actions","button","type","onClick","map","id","controls","label","onSelect","onClose","labelledBy","undefined","tone","message","confirmLabel","onCancel","onConfirm"],"mappings":"AAAA;;AAEA,SACEA,aAAa,EACbC,GAAG,EACHC,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACNC,IAAI,EACJC,eAAe,QACV,0BAA0B;AACjC,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,QAAQ,kBAAkB;AAC1E,SAAyBC,SAAS,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,QAAQ;AAEnE,SAASC,cAAc,QAAQ,oBAAoB;AAEnD,SAASC,YAAY,QAAQ,kBAAkB;AAuB/C;;;;;;;;CAQC,GACD,OAAO,SAASC,eAAe,EAC7BC,KAAK,EACLC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACU;IACpB,MAAMC,IAAIhB,KAAK;IACf,0EAA0E;IAC1E,MAAMiB,YAAYhB;IAClB,MAAMiB,eAAed;IACrB,MAAMe,SAAShB;IACf,MAAMiB,WAAWlB;IACjB,MAAMmB,SAASH,aAAaI,GAAG,CAAC;IAEhC,M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,eAAeoB,IAAItB,KAAK;wBACxCqC,SAAS,IAAMpC,YAAYqB,IAAItB,KAAK;uBAZ/BsB,IAAItB,KAAK;;;0BAiBpB,KAAClD;gBACCmF,IAAIhB;gBACJqB,YACE,CAAC3C,YAAYyB,eAAe,IAAIF,MAAME,eAAemB;gBAEvDZ,WAAU;0BAETH;;YAGF3B,8BACC,KAACjD;gBACC+B,IAAI;gBACJ6D,MAAK;gBACLpC,OAAOnC,EAAE;gBACTwE,SAASxE,EAAE;gBACXyE,cAAczE,EAAE;gBAChB0E,UAAU,IAAM7C,gBAAgB;gBAChC8C,WAAW;oBACT7C,YAAYF;oBACZC,gBAAgB;gBAClB;;;;AAKV"}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/workspace/workspace-shell.tsx"],"sourcesContent":["'use client';\n\nimport {\n ConfirmDialog,\n HotkeyScopeProvider,\n Tab,\n TabPanel,\n TabStrip,\n TopBar,\n useLiveUpdates,\n useT,\n useTranslateKey,\n} from '@entifix/react-controls';\nimport { usePathname, useRouter, useSearchParams } from 'next/navigation';\nimport { type ReactNode, useEffect, useId, useState } from 'react';\n\nimport { useDraftsState } from './drafts-state.js';\nimport type { TabRegistry } from './tab-kind.js';\nimport { useTabsState } from './tabs-state.js';\n\nexport interface WorkspaceShellProps {\n /**\n * Who this workspace belongs to — `workspaceScopeKey({ userId,\n * organizationId })`, resolved on the server from the session.\n *\n * Required, deliberately: IndexedDB is a property of the browser profile, so a\n * host that forgets to pass one hands the next account to sign in on that\n * machine the previous account's open tabs and half-finished edits. A default\n * would make that the quiet outcome of doing nothing.\n */\n scope: string;\n /** Resolves `?tab=` values to renderable tabs. */\n registry: TabRegistry;\n /** Right-aligned actions above the tab strip (search, the user menu). */\n actions?: ReactNode;\n /** Body when `?tab=` names something the registry cannot resolve. */\n fallback?: ReactNode;\n /** Body when no tab is open. */\n emptyState?: ReactNode;\n}\n\n/**\n * The tab workspace: a strip of persisted tabs over the active tab's body — no\n * sidebar or brand of its own. It is mounted inside a host shell (the\n * back-office layout, say) that already supplies those, so nesting two\n * sidebars never happens. The open set lives in {@link useTabsState}\n * (IndexedDB); the URL's `?tab=` projects only the active tab, so a deep link\n * opens or focuses exactly that tab and an unknown kind shows the fallback\n * instead of crashing.\n */\nexport function WorkspaceShell({\n scope,\n registry,\n actions,\n fallback,\n emptyState,\n}: WorkspaceShellProps) {\n const t = useT('shell');\n const live = useLiveUpdates();\n // Tab captions are catalog keys carried in a registry, not authored copy.\n const translate = useTranslateKey();\n const searchParams = useSearchParams();\n const router = useRouter();\n const pathname = usePathname();\n const urlTab = searchParams.get('tab');\n\n const tabs = useTabsState(state => state.tabs);\n const activeParam = useTabsState(state => state.activeParam);\n const open = useTabsState(state => state.open);\n const close = useTabsState(state => state.close);\n const activate = useTabsState(state => state.activate);\n\n const drafts = useDraftsState(state => state.drafts);\n const clearDraft = useDraftsState(state => state.clearDraft);\n\n // Load the persisted tab set and drafts once, on the client (hydration is\n // skipped at creation so SSR never touches IndexedDB).\n //\n // Both URL effects below wait on this flag, because the read is async and\n // lands *after* the first commit: opening the deep-linked tab before it\n // resolves means the restored snapshot's `activeParam` overwrites the tab the\n // URL asked for, and the write-back then projects that wrong tab into the\n // address bar. The URL is the more specific instruction, so it is applied\n // once the store has finished restoring rather than before.\n const [hydrated, setHydrated] = useState(false);\n useEffect(() => {\n // The scope is applied *before* the read, not after: the storage key is what\n // decides whose tabs and drafts come back, so setting it late would restore\n // the unscoped set first and only then start writing to the right key. Both\n // stores are module singletons with `skipHydration`, and this is the only\n // place that rehydrates them, so re-pointing them here is enough — no store\n // factory or provider is needed to keep two accounts apart.\n useTabsState.persist.setOptions({ name: `tabs:${scope}` });\n useDraftsState.persist.setOptions({ name: `drafts:${scope}` });\n void Promise.all([\n useTabsState.persist.rehydrate(),\n useDraftsState.persist.rehydrate(),\n ]).finally(() => setHydrated(true));\n }, [scope]);\n\n // The `?tab=` value the registry cannot resolve, if any — derived, so it is\n // known on the very first render rather than an effect later. An\n // unresolvable address used to be dropped on the floor: no tab, no error,\n // and the write-back below then replaced it with the previously active tab,\n // so even the URL stopped saying what was asked for. Here it answers with\n // the fallback and the bad address stays in the bar, where it can be read.\n //\n // `dismissed` is the escape: a deliberate tab interaction is a newer\n // instruction than the address that failed, and it holds the *value* rather\n // than a flag so the next dead link is dead again.\n const [dismissed, setDismissed] = useState<string | null>(null);\n const deadLink =\n urlTab && urlTab !== dismissed && !registry.resolve(urlTab, translate)\n ? urlTab\n : null;\n\n // A tab is dirty while its address has an unsaved draft; closing one confirms.\n //\n // The confirmation is a rendered dialog, so the decision spans two commits\n // rather than one blocking call: `handleClose` either closes outright or\n // parks the address, and the dialog's own buttons finish it. `window.confirm`\n // could not be styled, blocked the thread while it was up, and in Playwright\n // had to be driven by a global `page.on('dialog')` handler registered before\n // the click — which is why the workspace had no end-to-end test at all.\n const [pendingClose, setPendingClose] = useState<string | null>(null);\n\n const commitClose = (param: string) => {\n // Unconditional: `clearDraft` returns the state unchanged when the address\n // holds no draft, so the clean path costs a no-op rather than a branch.\n clearDraft(param);\n setDismissed(urlTab);\n close(param);\n };\n\n const handleClose = (param: string) => {\n if (param in drafts) {\n setPendingClose(param);\n return;\n }\n commitClose(param);\n };\n\n const handleActivate = (param: string) => {\n setDismissed(urlTab);\n activate(param);\n };\n\n // Deep link → open/focus the addressed tab (a dead one shows the fallback).\n useEffect(() => {\n if (!hydrated || !urlTab) return;\n const resolved = registry.resolve(urlTab, translate);\n if (resolved) {\n open({ param: resolved.param, title: resolved.title });\n }\n }, [hydrated, urlTab, registry, open, translate]);\n\n // Project the active tab back to the URL so it stays shareable.\n //\n // The active tab is read from the *committed* store rather than from this\n // render's snapshot. Following a link to a second tab changes the URL one\n // commit before the store catches up, so the snapshot still names the\n // previously active tab — writing that back would undo the navigation, the\n // effect above would re-open the URL's tab, and the two would trade the\n // address bar back and forth forever (a visible flicker between, say, brands\n // and categories). The effect above runs first in the same commit, so by the\n // time this one reads the store the URL's tab is already active.\n // That ordering is also what makes the `hydrated` gate work: when the flag\n // flips, the effect above has already re-applied the URL's tab over the\n // restored snapshot, so there is nothing here to write back.\n //\n // A dead deep link suspends it: overwriting the address the visitor typed\n // with an unrelated tab is what made the failure invisible in the first place.\n useEffect(() => {\n if (!hydrated || deadLink) return;\n const active = useTabsState.getState().activeParam;\n if (active && active !== urlTab) {\n router.replace(`${pathname}?tab=${encodeURIComponent(active)}`);\n }\n }, [hydrated, deadLink, activeParam, urlTab, pathname, router]);\n\n const copyDeepLink = (param: string) => {\n void navigator.clipboard.writeText(\n `${window.location.origin}${pathname}?tab=${encodeURIComponent(param)}`,\n );\n };\n\n // Tab and panel ids: DOM ids, so derived from the tab's position under one\n // per-shell prefix rather than from its param, which holds `:` and `#`.\n const idBase = useId();\n const panelId = `${idBase}-panel`;\n const tabId = (index: number) => `${idBase}-tab-${index}`;\n const activeIndex = tabs.findIndex(tab => tab.param === activeParam);\n\n const activeResolved = activeParam\n ? registry.resolve(activeParam, translate)\n : null;\n const body = deadLink\n ? fallback\n : activeResolved\n ? activeResolved.render()\n : emptyState;\n\n return (\n <div className=\"min-w-0 flex flex-1 flex-col\">\n <TopBar connection={live.connection} onReconnect={live.reconnect}>\n <TopBar.Actions>\n {activeParam && (\n <button\n type=\"button\"\n onClick={() => copyDeepLink(activeParam)}\n className=\"rounded-md px-2xs py-3xs text-step-sm text-content-muted focus-ring transition hover:bg-surface hover:text-content\"\n >\n {t('workspace.copyLink')}\n </button>\n )}\n {actions}\n </TopBar.Actions>\n </TopBar>\n\n <TabStrip>\n {tabs.map((tab, index) => (\n <Tab\n key={tab.param}\n id={tabId(index)}\n controls={panelId}\n // Re-derived from the registry rather than read back from the\n // store: the persisted title is whatever locale it was opened\n // in, so a locale switch would leave stale captions behind.\n label={registry.resolve(tab.param, translate)?.title ?? tab.title}\n // Nothing is selected while the fallback is up: a highlighted\n // tab beside a body that is not its own reads as a render bug.\n active={!deadLink && tab.param === activeParam}\n state={tab.param in drafts ? 'dirty' : 'idle'}\n onSelect={() => handleActivate(tab.param)}\n onClose={() => handleClose(tab.param)}\n />\n ))}\n </TabStrip>\n\n <TabPanel\n id={panelId}\n labelledBy={\n !deadLink && activeIndex >= 0 ? tabId(activeIndex) : undefined\n }\n className=\"min-w-0 flex-1 p-m\"\n >\n {/* The tab's shortcuts are its own: bound while it is the tab shown. */}\n <HotkeyScopeProvider\n value={{ id: `tab:${activeParam ?? ''}`, active: true }}\n >\n {body}\n </HotkeyScopeProvider>\n </TabPanel>\n\n {pendingClose && (\n <ConfirmDialog\n open\n tone=\"destructive\"\n title={t('workspace.discardTitle')}\n message={t('workspace.discard')}\n confirmLabel={t('workspace.discardConfirm')}\n onCancel={() => setPendingClose(null)}\n onConfirm={() => {\n commitClose(pendingClose);\n setPendingClose(null);\n }}\n />\n )}\n </div>\n );\n}\n"],"names":["ConfirmDialog","HotkeyScopeProvider","Tab","TabPanel","TabStrip","TopBar","useLiveUpdates","useT","useTranslateKey","usePathname","useRouter","useSearchParams","useEffect","useId","useState","useDraftsState","useTabsState","WorkspaceShell","scope","registry","actions","fallback","emptyState","t","live","translate","searchParams","router","pathname","urlTab","get","tabs","state","activeParam","open","close","activate","drafts","clearDraft","hydrated","setHydrated","persist","setOptions","name","Promise","all","rehydrate","finally","dismissed","setDismissed","deadLink","resolve","pendingClose","setPendingClose","commitClose","param","handleClose","handleActivate","resolved","title","active","getState","replace","encodeURIComponent","copyDeepLink","navigator","clipboard","writeText","window","location","origin","idBase","panelId","tabId","index","activeIndex","findIndex","tab","activeResolved","body","render","div","className","connection","onReconnect","reconnect","Actions","button","type","onClick","map","id","controls","label","onSelect","onClose","labelledBy","undefined","value","tone","message","confirmLabel","onCancel","onConfirm"],"mappings":"AAAA;;AAEA,SACEA,aAAa,EACbC,mBAAmB,EACnBC,GAAG,EACHC,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACNC,cAAc,EACdC,IAAI,EACJC,eAAe,QACV,0BAA0B;AACjC,SAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,QA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C,MAAK;4BACLC,SAAS,IAAMzB,aAAa/B;4BAC5BiD,WAAU;sCAET3D,EAAE;;wBAGNH;;;;0BAIL,KAAChB;0BACE2B,KAAK2D,GAAG,CAAC,CAACb,KAAKH;;wBAQLvD;yCAPT,KAACjB;wBAECyF,IAAIlB,MAAMC;wBACVkB,UAAUpB;wBACV,8DAA8D;wBAC9D,8DAA8D;wBAC9D,4DAA4D;wBAC5DqB,KAAK,WAAE1E,oBAAAA,SAASgC,OAAO,CAAC0B,IAAItB,KAAK,EAAE9B,+BAA5BN,kBAAwCwC,KAAK,mBAAIkB,IAAIlB,KAAK;wBACjE,8DAA8D;wBAC9D,+DAA+D;wBAC/DC,QAAQ,CAACV,YAAY2B,IAAItB,KAAK,KAAKtB;wBACnCD,OAAO6C,IAAItB,KAAK,IAAIlB,SAAS,UAAU;wBACvCyD,UAAU,IAAMrC,eAAeoB,IAAItB,KAAK;wBACxCwC,SAAS,IAAMvC,YAAYqB,IAAItB,KAAK;uBAZ/BsB,IAAItB,KAAK;;;0BAiBpB,KAACpD;gBACCwF,IAAInB;gBACJwB,YACE,CAAC9C,YAAYyB,eAAe,IAAIF,MAAME,eAAesB;gBAEvDf,WAAU;0BAGV,cAAA,KAACjF;oBACCiG,OAAO;wBAAEP,IAAI,CAAC,IAAI,EAAE1D,sBAAAA,cAAe,IAAI;wBAAE2B,QAAQ;oBAAK;8BAErDmB;;;YAIJ3B,8BACC,KAACpD;gBACCkC,IAAI;gBACJiE,MAAK;gBACLxC,OAAOpC,EAAE;gBACT6E,SAAS7E,EAAE;gBACX8E,cAAc9E,EAAE;gBAChB+E,UAAU,IAAMjD,gBAAgB;gBAChCkD,WAAW;oBACTjD,YAAYF;oBACZC,gBAAgB;gBAClB;;;;AAKV"}
|
package/dist/server.d.ts
CHANGED
|
@@ -11,4 +11,6 @@ export * from './lib/search/record-search-source.js';
|
|
|
11
11
|
export * from './lib/session/bearer.js';
|
|
12
12
|
export * from './lib/session/account-links.js';
|
|
13
13
|
export * from './lib/session/device.js';
|
|
14
|
+
export * from './lib/confirm-action/confirm-action-state.js';
|
|
15
|
+
export * from './lib/theme/theme-cookies.js';
|
|
14
16
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAWA,cAAc,+BAA+B,CAAC;AAG9C,cAAc,8BAA8B,CAAC;AAM7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AAGjD,cAAc,qCAAqC,CAAC;AAGpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAK/C,cAAc,oBAAoB,CAAC;AAInC,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AAKrD,cAAc,yBAAyB,CAAC;AAIxC,cAAc,gCAAgC,CAAC;AAG/C,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAWA,cAAc,+BAA+B,CAAC;AAG9C,cAAc,8BAA8B,CAAC;AAM7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AAGjD,cAAc,qCAAqC,CAAC;AAGpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAK/C,cAAc,oBAAoB,CAAC;AAInC,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AAKrD,cAAc,yBAAyB,CAAC;AAIxC,cAAc,gCAAgC,CAAC;AAG/C,cAAc,yBAAyB,CAAC;AAIxC,cAAc,8CAA8C,CAAC;AAG7D,cAAc,8BAA8B,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -38,5 +38,10 @@ export * from './lib/session/bearer.js';
|
|
|
38
38
|
export * from './lib/session/account-links.js';
|
|
39
39
|
// Device identity — read from the request, written onto the response.
|
|
40
40
|
export * from './lib/session/device.js';
|
|
41
|
+
// The guard a Server Action behind `ConfirmAction` runs: it acts only on a post
|
|
42
|
+
// that went through the confirmation.
|
|
43
|
+
export * from './lib/confirm-action/confirm-action-state.js';
|
|
44
|
+
// The reader's theme and density, read where the page is rendered.
|
|
45
|
+
export * from './lib/theme/theme-cookies.js';
|
|
41
46
|
|
|
42
47
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["// Server-only surface, published as `@entifix/next-shell/server`.\n//\n// It stays a separate entry so route handlers and cookie helpers are never\n// reached through the client surface: stamped as client modules they would\n// become client references and their `next/server` imports would fail. The\n// library compiles per-file, so each module keeps its own `\"use client\"` (or\n// keeps none, as here) instead of inheriting a bundle-wide banner.\n\n// React server components\n\n// Probe route handlers (liveness/readiness) shared by every Next app.\nexport * from './lib/health/health-routes.js';\n\n// The `GET /api/config` handler + the same-origin domain rewrite it applies.\nexport * from './lib/config/config-route.js';\n\n// The shared fleet token, and the header config-service reads it from. Exported\n// because a server component that reads config-service directly — rather than\n// through its own app's `/api/config` route — has to carry it itself. It never\n// reaches the browser: this is the server entry.\nexport * from './lib/config/configuration-source.js';\nexport * from './lib/config/problem-response.js';\n\n// The same-origin proxy each host mounts per backend it talks to.\nexport * from './lib/config/service-proxy-route.js';\n\n// Session cookies + the shared refresh route handler\nexport * from './lib/session/cookies.js';\nexport * from './lib/session/refresh-route.js';\n\n// The `[slug]` value that means \"create\". A pure constant, exported from both\n// entries because both need it: the generated pages read it in the browser, and\n// a shell's palette commands compose the create route with it on the server.\nexport * from './lib/crud/slug.js';\n\n// The cross-domain record search: the aggregating route, and the declarations a\n// host fans out over.\nexport * from './lib/search/record-search-route.js';\nexport * from './lib/search/record-search-source.js';\n\n// The access cookie, read once and forwarded as a bearer. Three server surfaces\n// carry it the same way — the per-backend proxy, the auth shell's hand-written\n// handlers, and the record search fan-out — and none of them grants anything.\nexport * from './lib/session/bearer.js';\n\n// Account-link builders. Pure functions, but server layouts call them directly,\n// and anything exported from the client entry becomes a client function.\nexport * from './lib/session/account-links.js';\n\n// Device identity — read from the request, written onto the response.\nexport * from './lib/session/device.js';\n"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,6EAA6E;AAC7E,mEAAmE;AAEnE,0BAA0B;AAE1B,sEAAsE;AACtE,cAAc,gCAAgC;AAE9C,6EAA6E;AAC7E,cAAc,+BAA+B;AAE7C,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,iDAAiD;AACjD,cAAc,uCAAuC;AACrD,cAAc,mCAAmC;AAEjD,kEAAkE;AAClE,cAAc,sCAAsC;AAEpD,qDAAqD;AACrD,cAAc,2BAA2B;AACzC,cAAc,iCAAiC;AAE/C,8EAA8E;AAC9E,gFAAgF;AAChF,6EAA6E;AAC7E,cAAc,qBAAqB;AAEnC,gFAAgF;AAChF,sBAAsB;AACtB,cAAc,sCAAsC;AACpD,cAAc,uCAAuC;AAErD,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,cAAc,0BAA0B;AAExC,gFAAgF;AAChF,yEAAyE;AACzE,cAAc,iCAAiC;AAE/C,sEAAsE;AACtE,cAAc,0BAA0B"}
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["// Server-only surface, published as `@entifix/next-shell/server`.\n//\n// It stays a separate entry so route handlers and cookie helpers are never\n// reached through the client surface: stamped as client modules they would\n// become client references and their `next/server` imports would fail. The\n// library compiles per-file, so each module keeps its own `\"use client\"` (or\n// keeps none, as here) instead of inheriting a bundle-wide banner.\n\n// React server components\n\n// Probe route handlers (liveness/readiness) shared by every Next app.\nexport * from './lib/health/health-routes.js';\n\n// The `GET /api/config` handler + the same-origin domain rewrite it applies.\nexport * from './lib/config/config-route.js';\n\n// The shared fleet token, and the header config-service reads it from. Exported\n// because a server component that reads config-service directly — rather than\n// through its own app's `/api/config` route — has to carry it itself. It never\n// reaches the browser: this is the server entry.\nexport * from './lib/config/configuration-source.js';\nexport * from './lib/config/problem-response.js';\n\n// The same-origin proxy each host mounts per backend it talks to.\nexport * from './lib/config/service-proxy-route.js';\n\n// Session cookies + the shared refresh route handler\nexport * from './lib/session/cookies.js';\nexport * from './lib/session/refresh-route.js';\n\n// The `[slug]` value that means \"create\". A pure constant, exported from both\n// entries because both need it: the generated pages read it in the browser, and\n// a shell's palette commands compose the create route with it on the server.\nexport * from './lib/crud/slug.js';\n\n// The cross-domain record search: the aggregating route, and the declarations a\n// host fans out over.\nexport * from './lib/search/record-search-route.js';\nexport * from './lib/search/record-search-source.js';\n\n// The access cookie, read once and forwarded as a bearer. Three server surfaces\n// carry it the same way — the per-backend proxy, the auth shell's hand-written\n// handlers, and the record search fan-out — and none of them grants anything.\nexport * from './lib/session/bearer.js';\n\n// Account-link builders. Pure functions, but server layouts call them directly,\n// and anything exported from the client entry becomes a client function.\nexport * from './lib/session/account-links.js';\n\n// Device identity — read from the request, written onto the response.\nexport * from './lib/session/device.js';\n\n// The guard a Server Action behind `ConfirmAction` runs: it acts only on a post\n// that went through the confirmation.\nexport * from './lib/confirm-action/confirm-action-state.js';\n\n// The reader's theme and density, read where the page is rendered.\nexport * from './lib/theme/theme-cookies.js';\n"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,6EAA6E;AAC7E,mEAAmE;AAEnE,0BAA0B;AAE1B,sEAAsE;AACtE,cAAc,gCAAgC;AAE9C,6EAA6E;AAC7E,cAAc,+BAA+B;AAE7C,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,iDAAiD;AACjD,cAAc,uCAAuC;AACrD,cAAc,mCAAmC;AAEjD,kEAAkE;AAClE,cAAc,sCAAsC;AAEpD,qDAAqD;AACrD,cAAc,2BAA2B;AACzC,cAAc,iCAAiC;AAE/C,8EAA8E;AAC9E,gFAAgF;AAChF,6EAA6E;AAC7E,cAAc,qBAAqB;AAEnC,gFAAgF;AAChF,sBAAsB;AACtB,cAAc,sCAAsC;AACpD,cAAc,uCAAuC;AAErD,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,cAAc,0BAA0B;AAExC,gFAAgF;AAChF,yEAAyE;AACzE,cAAc,iCAAiC;AAE/C,sEAAsE;AACtE,cAAc,0BAA0B;AAExC,gFAAgF;AAChF,sCAAsC;AACtC,cAAc,+CAA+C;AAE7D,mEAAmE;AACnE,cAAc,+BAA+B"}
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"version": "0.
|
|
24
|
+
"version": "0.20.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": {
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"react": "19.3.1",
|
|
58
58
|
"react-dom": "19.3.1",
|
|
59
59
|
"zustand": "^5.0.16",
|
|
60
|
-
"@entifix/testing-unit": "0.
|
|
60
|
+
"@entifix/testing-unit": "0.20.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"idb": "^8.0.4",
|
|
64
|
-
"@entifix/authz": "0.
|
|
65
|
-
"@entifix/business": "0.
|
|
66
|
-
"@entifix/core": "0.
|
|
67
|
-
"@entifix/i18n": "0.
|
|
68
|
-
"@entifix/react-controls": "0.
|
|
69
|
-
"@entifix/react-integration": "0.
|
|
70
|
-
"@entifix/transactions": "0.
|
|
64
|
+
"@entifix/authz": "0.20.0",
|
|
65
|
+
"@entifix/business": "0.20.0",
|
|
66
|
+
"@entifix/core": "0.20.0",
|
|
67
|
+
"@entifix/i18n": "0.20.0",
|
|
68
|
+
"@entifix/react-controls": "0.20.0",
|
|
69
|
+
"@entifix/react-integration": "0.20.0",
|
|
70
|
+
"@entifix/transactions": "0.20.0"
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
73
73
|
"dist",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { EntityDraftMessages } from '@entifix/react-integration';
|
|
2
|
-
/** A translate function bound to the `controls` namespace. */
|
|
3
|
-
export type ControlsTranslate = (key: string, params?: Record<string, unknown>) => string;
|
|
4
|
-
/**
|
|
5
|
-
* The form's validation sentences, in the `controls` catalog's words.
|
|
6
|
-
*
|
|
7
|
-
* The integration package owns the validation *rules* and this shell owns the
|
|
8
|
-
* sentences, because a sideways import between the two T3 packages is an edge
|
|
9
|
-
* the tier register does not declare. `count` doubles as i18next's plural
|
|
10
|
-
* selector, so `minItems` reads "1 item" and "2 items".
|
|
11
|
-
*/
|
|
12
|
-
export declare function validationMessagesFor(ct: ControlsTranslate): EntityDraftMessages;
|
|
13
|
-
//# sourceMappingURL=validation-messages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation-messages.d.ts","sourceRoot":"","sources":["../../../src/lib/crud/validation-messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,MAAM,CAAC;AAEZ;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,iBAAiB,GACpB,mBAAmB,CAerB"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The form's validation sentences, in the `controls` catalog's words.
|
|
3
|
-
*
|
|
4
|
-
* The integration package owns the validation *rules* and this shell owns the
|
|
5
|
-
* sentences, because a sideways import between the two T3 packages is an edge
|
|
6
|
-
* the tier register does not declare. `count` doubles as i18next's plural
|
|
7
|
-
* selector, so `minItems` reads "1 item" and "2 items".
|
|
8
|
-
*/ export function validationMessagesFor(ct) {
|
|
9
|
-
const say = (failure)=>(field)=>ct(`validation.${failure}`, {
|
|
10
|
-
field
|
|
11
|
-
});
|
|
12
|
-
return {
|
|
13
|
-
required: say('required'),
|
|
14
|
-
number: say('number'),
|
|
15
|
-
date: say('date'),
|
|
16
|
-
option: say('option'),
|
|
17
|
-
minItems: (field, count)=>ct('validation.minItems', {
|
|
18
|
-
field,
|
|
19
|
-
count
|
|
20
|
-
}),
|
|
21
|
-
maxItems: (field, count)=>ct('validation.maxItems', {
|
|
22
|
-
field,
|
|
23
|
-
count
|
|
24
|
-
}),
|
|
25
|
-
notBefore: (field, other)=>ct('validation.notBefore', {
|
|
26
|
-
field,
|
|
27
|
-
other
|
|
28
|
-
}),
|
|
29
|
-
locale: (field, locale)=>ct('validation.locale', {
|
|
30
|
-
field,
|
|
31
|
-
locale: locale.toUpperCase()
|
|
32
|
-
})
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
//# sourceMappingURL=validation-messages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/crud/validation-messages.ts"],"sourcesContent":["import type { EntityDraftMessages } from '@entifix/react-integration';\n\n/** A translate function bound to the `controls` namespace. */\nexport type ControlsTranslate = (\n key: string,\n params?: Record<string, unknown>,\n) => string;\n\n/**\n * The form's validation sentences, in the `controls` catalog's words.\n *\n * The integration package owns the validation *rules* and this shell owns the\n * sentences, because a sideways import between the two T3 packages is an edge\n * the tier register does not declare. `count` doubles as i18next's plural\n * selector, so `minItems` reads \"1 item\" and \"2 items\".\n */\nexport function validationMessagesFor(\n ct: ControlsTranslate,\n): EntityDraftMessages {\n const say =\n (failure: 'required' | 'number' | 'date' | 'option') => (field: string) =>\n ct(`validation.${failure}`, { field });\n return {\n required: say('required'),\n number: say('number'),\n date: say('date'),\n option: say('option'),\n minItems: (field, count) => ct('validation.minItems', { field, count }),\n maxItems: (field, count) => ct('validation.maxItems', { field, count }),\n notBefore: (field, other) => ct('validation.notBefore', { field, other }),\n locale: (field, locale) =>\n ct('validation.locale', { field, locale: locale.toUpperCase() }),\n };\n}\n"],"names":["validationMessagesFor","ct","say","failure","field","required","number","date","option","minItems","count","maxItems","notBefore","other","locale","toUpperCase"],"mappings":"AAQA;;;;;;;CAOC,GACD,OAAO,SAASA,sBACdC,EAAqB;IAErB,MAAMC,MACJ,CAACC,UAAuD,CAACC,QACvDH,GAAG,CAAC,WAAW,EAAEE,SAAS,EAAE;gBAAEC;YAAM;IACxC,OAAO;QACLC,UAAUH,IAAI;QACdI,QAAQJ,IAAI;QACZK,MAAML,IAAI;QACVM,QAAQN,IAAI;QACZO,UAAU,CAACL,OAAOM,QAAUT,GAAG,uBAAuB;gBAAEG;gBAAOM;YAAM;QACrEC,UAAU,CAACP,OAAOM,QAAUT,GAAG,uBAAuB;gBAAEG;gBAAOM;YAAM;QACrEE,WAAW,CAACR,OAAOS,QAAUZ,GAAG,wBAAwB;gBAAEG;gBAAOS;YAAM;QACvEC,QAAQ,CAACV,OAAOU,SACdb,GAAG,qBAAqB;gBAAEG;gBAAOU,QAAQA,OAAOC,WAAW;YAAG;IAClE;AACF"}
|