@wildo-ai/saas-frontend-lib 1.1.12 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/data-display/DisplayValueDispatcher.d.ts.map +1 -1
- package/dist/esm/components/data-display/DisplayValueDispatcher.js +17 -1
- package/dist/esm/components/data-display/DisplayValueDispatcher.js.map +1 -1
- package/dist/esm/components/data-display/approval-seal.d.ts +97 -0
- package/dist/esm/components/data-display/approval-seal.d.ts.map +1 -0
- package/dist/esm/components/data-display/approval-seal.js +208 -0
- package/dist/esm/components/data-display/approval-seal.js.map +1 -0
- package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.d.ts.map +1 -1
- package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.js +5 -2
- package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.js.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-file.d.ts.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-file.js +16 -2
- package/dist/esm/components/data-display/formatters/display-field-file.js.map +1 -1
- package/dist/esm/components/flows-actors/approval.d.ts.map +1 -1
- package/dist/esm/components/flows-actors/approval.js +48 -18
- package/dist/esm/components/flows-actors/approval.js.map +1 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.d.ts.map +1 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.js +20 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.js.map +1 -1
- package/dist/esm/components/form/chromes/FormFieldChrome.js +1 -1
- package/dist/esm/components/form/chromes/FormFieldChrome.js.map +1 -1
- package/dist/esm/components/form/chromes/field-control-aria.d.ts +8 -1
- package/dist/esm/components/form/chromes/field-control-aria.d.ts.map +1 -1
- package/dist/esm/components/form/chromes/field-control-aria.js +19 -2
- package/dist/esm/components/form/chromes/field-control-aria.js.map +1 -1
- package/dist/esm/components/form/validation-errors/validate-field-url.frontend.d.ts +5 -0
- package/dist/esm/components/form/validation-errors/validate-field-url.frontend.d.ts.map +1 -1
- package/dist/esm/components/form/validation-errors/validate-field-url.frontend.js +6 -2
- package/dist/esm/components/form/validation-errors/validate-field-url.frontend.js.map +1 -1
- package/dist/esm/components/resources/ResourceCollectionBody_Table.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceCollectionBody_Table.js +8 -1
- package/dist/esm/components/resources/ResourceCollectionBody_Table.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_DangerZone.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_DangerZone.js +2 -2
- package/dist/esm/components/resources/ResourceLayout_DangerZone.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.js +2 -2
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.js.map +1 -1
- package/dist/esm/components/resources/ResourceListItemRenderer.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceListItemRenderer.js +6 -1
- package/dist/esm/components/resources/ResourceListItemRenderer.js.map +1 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.d.ts.map +1 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js +5 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js.map +1 -1
- package/dist/esm/components/resources/skeleton/DisplayLayout.js +2 -2
- package/dist/esm/components/resources/skeleton/DisplayLayout.js.map +1 -1
- package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.d.ts.map +1 -1
- package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.js +71 -16
- package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.js.map +1 -1
- package/dist/esm/components/sections/surface.d.ts +12 -0
- package/dist/esm/components/sections/surface.d.ts.map +1 -1
- package/dist/esm/components/sections/surface.js +14 -0
- package/dist/esm/components/sections/surface.js.map +1 -1
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.d.ts +27 -24
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.d.ts.map +1 -1
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.js +27 -33
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.js.map +1 -1
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.d.ts +37 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.d.ts.map +1 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.js +100 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.js.map +1 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.d.ts +3 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.d.ts.map +1 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.js +34 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.js.map +1 -0
- package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.d.ts +47 -0
- package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.d.ts.map +1 -0
- package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.js +94 -0
- package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.js.map +1 -0
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.d.ts +39 -0
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.d.ts.map +1 -0
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.js +155 -0
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.js.map +1 -0
- package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.d.ts.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.js +3 -2
- package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.js.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.d.ts +15 -0
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.d.ts.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.js +29 -0
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.js.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/use-shell-motion.d.ts.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/use-shell-motion.js +2 -2
- package/dist/esm/core/app-shell/shell-motion/use-shell-motion.js.map +1 -1
- package/dist/esm/core/branding/useBrandPresentation.d.ts.map +1 -1
- package/dist/esm/core/branding/useBrandPresentation.js +17 -6
- package/dist/esm/core/branding/useBrandPresentation.js.map +1 -1
- package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.d.ts.map +1 -1
- package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.js +2 -0
- package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.js.map +1 -1
- package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.d.ts.map +1 -1
- package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.js +11 -1
- package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.js.map +1 -1
- package/dist/esm/core/i18n/I18nContext.d.ts.map +1 -1
- package/dist/esm/core/i18n/I18nContext.js +8 -2
- package/dist/esm/core/i18n/I18nContext.js.map +1 -1
- package/dist/esm/core/i18n/component-label-resolution.utils.d.ts.map +1 -1
- package/dist/esm/core/i18n/component-label-resolution.utils.js +6 -1
- package/dist/esm/core/i18n/component-label-resolution.utils.js.map +1 -1
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.d.ts +0 -15
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.d.ts.map +1 -1
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.js +71 -6
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.js.map +1 -1
- package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.d.ts.map +1 -1
- package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.js +12 -3
- package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.js.map +1 -1
- package/dist/esm/core/navigation/NavigationContext.d.ts.map +1 -1
- package/dist/esm/core/navigation/NavigationContext.js +60 -17
- package/dist/esm/core/navigation/NavigationContext.js.map +1 -1
- package/dist/esm/core/navigation/launcher-resolution.d.ts +29 -0
- package/dist/esm/core/navigation/launcher-resolution.d.ts.map +1 -1
- package/dist/esm/core/navigation/launcher-resolution.js +31 -0
- package/dist/esm/core/navigation/launcher-resolution.js.map +1 -1
- package/dist/esm/core/navigation/navigation-controller-internals.d.ts +48 -0
- package/dist/esm/core/navigation/navigation-controller-internals.d.ts.map +1 -1
- package/dist/esm/core/navigation/navigation-controller-internals.js +56 -3
- package/dist/esm/core/navigation/navigation-controller-internals.js.map +1 -1
- package/dist/esm/core/navigation/useNavigationRouterSync.d.ts.map +1 -1
- package/dist/esm/core/navigation/useNavigationRouterSync.js +30 -2
- package/dist/esm/core/navigation/useNavigationRouterSync.js.map +1 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts +34 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts.map +1 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js +41 -0
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js.map +1 -1
- package/dist/esm/core/resources/route-parent-relocation.frontend.utils.d.ts +44 -0
- package/dist/esm/core/resources/route-parent-relocation.frontend.utils.d.ts.map +1 -0
- package/dist/esm/core/resources/route-parent-relocation.frontend.utils.js +63 -0
- package/dist/esm/core/resources/route-parent-relocation.frontend.utils.js.map +1 -0
- package/dist/esm/core/resources/useOperationDirectExecution.d.ts.map +1 -1
- package/dist/esm/core/resources/useOperationDirectExecution.js +45 -6
- package/dist/esm/core/resources/useOperationDirectExecution.js.map +1 -1
- package/dist/esm/core/runtime/AppRouter.d.ts.map +1 -1
- package/dist/esm/core/runtime/AppRouter.js +18 -1
- package/dist/esm/core/runtime/AppRouter.js.map +1 -1
- package/dist/esm/core/security/UserOrgsContext.d.ts.map +1 -1
- package/dist/esm/core/security/UserOrgsContext.js +61 -8
- package/dist/esm/core/security/UserOrgsContext.js.map +1 -1
- package/dist/esm/core/ui/inner-control-activation.utils.d.ts +16 -0
- package/dist/esm/core/ui/inner-control-activation.utils.d.ts.map +1 -0
- package/dist/esm/core/ui/inner-control-activation.utils.js +44 -0
- package/dist/esm/core/ui/inner-control-activation.utils.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The current organization's stored layout of one chart dashboard, and the doors to change it (#2299).
|
|
3
|
+
*
|
|
4
|
+
* Read through the `organizationDashboardLayouts` LIST, filtered by the dashboard's `layoutRef` (every member may read
|
|
5
|
+
* it); written through its CREATE / UPDATE, and reset through its DELETE (the organization's administrators). The backend
|
|
6
|
+
* decides every request and audits every write; this hook only asks the registry's own roles before OFFERING a write
|
|
7
|
+
* (`canEdit`), so a member is never shown an editor whose save would be refused.
|
|
8
|
+
*
|
|
9
|
+
* Settling, and what each outcome means for the dashboard:
|
|
10
|
+
* - no `layoutRef`, no organization, no LIST this frontend registers, or a viewer the LIST would refuse: SETTLED with no
|
|
11
|
+
* layout, so the dashboard shows its declared tiles at once;
|
|
12
|
+
* - a read in flight: LOADING. The dashboard waits rather than drawing the declared order and then jumping;
|
|
13
|
+
* - a read that failed: SETTLED with no layout, logged. Presentation falls back to what the application declared, never
|
|
14
|
+
* to an error;
|
|
15
|
+
* - after a save or a reset in this tab, every dashboard showing the same layout in the same organization reads it again.
|
|
16
|
+
*/
|
|
17
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
18
|
+
import { CoreResourceOperation, CoreResourceType, ResourceOperationVariantType, ResourcesConfig_OperationPathUtils, } from '@wildo-ai/saas-models';
|
|
19
|
+
import { useResourceRegistry } from '../../../core/resources/useResourceRegistry.js';
|
|
20
|
+
import { useAppScopeSafe } from '../../../core/scope/useAppScope.js';
|
|
21
|
+
import { viewerMayPerformOperation } from '../../../core/navigation/launcher-resolution.js';
|
|
22
|
+
import { LoggerFrontendService } from '../../../core/monitoring/logger.frontend.service.js';
|
|
23
|
+
const logger = LoggerFrontendService.getLogger();
|
|
24
|
+
const LAYOUTS = CoreResourceType.ORGANIZATION_DASHBOARD_LAYOUTS;
|
|
25
|
+
/** Where the read of a dashboard's layout stands. */
|
|
26
|
+
export var ChartDashboardLayoutReadState;
|
|
27
|
+
(function (ChartDashboardLayoutReadState) {
|
|
28
|
+
/** The layout is being read; the dashboard waits. */
|
|
29
|
+
ChartDashboardLayoutReadState["LOADING"] = "loading";
|
|
30
|
+
/** Read, or nothing to read: `stored` is the organization's layout, or undefined for the declared one. */
|
|
31
|
+
ChartDashboardLayoutReadState["SETTLED"] = "settled";
|
|
32
|
+
})(ChartDashboardLayoutReadState || (ChartDashboardLayoutReadState = {}));
|
|
33
|
+
/** Every mounted reader of one (organization, layout), told to read again after a write in this tab. */
|
|
34
|
+
const layoutReaders = new Map();
|
|
35
|
+
function notifyLayoutReaders(key) {
|
|
36
|
+
layoutReaders.get(key)?.forEach((reread) => reread());
|
|
37
|
+
}
|
|
38
|
+
function findDefaultApiOperation(operations, verb) {
|
|
39
|
+
return operations?.find((operation) => operation.operationIdentifier === verb
|
|
40
|
+
&& operation.isOperationDefault === true
|
|
41
|
+
&& operation.isBulkOperation !== true
|
|
42
|
+
&& operation.variantType === ResourceOperationVariantType.API_CALL);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A refused write is followed by a re-read, so the next attempt targets what the store now holds: another administrator
|
|
46
|
+
* may have created the row (this tab's CREATE then answers 409) or reset it (UPDATE answers 404) since it was read.
|
|
47
|
+
*/
|
|
48
|
+
function rereadAndRethrow(key) {
|
|
49
|
+
return (error) => {
|
|
50
|
+
notifyLayoutReaders(key);
|
|
51
|
+
throw error;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** The rows of one LIST answer, from either the paginated or the bare-array shape. */
|
|
55
|
+
function listRows(result) {
|
|
56
|
+
if (Array.isArray(result))
|
|
57
|
+
return result;
|
|
58
|
+
const data = result?.data;
|
|
59
|
+
return Array.isArray(data) ? data : [];
|
|
60
|
+
}
|
|
61
|
+
/** One write's answer, whether bare or wrapped in `{ data }`. */
|
|
62
|
+
function writtenRow(result) {
|
|
63
|
+
if (!result || typeof result !== 'object' || Array.isArray(result))
|
|
64
|
+
return undefined;
|
|
65
|
+
const wrapped = result.data;
|
|
66
|
+
const row = (wrapped && typeof wrapped === 'object' && !Array.isArray(wrapped) ? wrapped : result);
|
|
67
|
+
return typeof row._id === 'string' && Array.isArray(row.tiles) ? row : undefined;
|
|
68
|
+
}
|
|
69
|
+
/** See the module comment. `viewer` is the viewer's effective roles, as the dashboard's gate reads them. */
|
|
70
|
+
export function useChartDashboardLayout(layoutRef, viewer) {
|
|
71
|
+
const { registry, doOperation } = useResourceRegistry();
|
|
72
|
+
const organizationId = useAppScopeSafe()?.currentOrganizationId ?? null;
|
|
73
|
+
const configuration = registry.resourceConfigurations[LAYOUTS];
|
|
74
|
+
const operations = configuration?.operations;
|
|
75
|
+
const organizationFieldIdentifier = registry.resourceConfigurations[CoreResourceType.ORGANIZATIONS]?.resourceFieldIdentifier ?? 'organizationId';
|
|
76
|
+
const layoutFieldIdentifier = configuration?.resourceFieldIdentifier;
|
|
77
|
+
const doors = useMemo(() => ({
|
|
78
|
+
list: findDefaultApiOperation(operations, CoreResourceOperation.LIST),
|
|
79
|
+
create: findDefaultApiOperation(operations, CoreResourceOperation.CREATE),
|
|
80
|
+
update: findDefaultApiOperation(operations, CoreResourceOperation.UPDATE),
|
|
81
|
+
remove: findDefaultApiOperation(operations, CoreResourceOperation.DELETE),
|
|
82
|
+
}), [operations]);
|
|
83
|
+
const may = (operation) => !!operation && viewerMayPerformOperation({ ...operation, resourceType: LAYOUTS }, viewer);
|
|
84
|
+
const mayRead = !!layoutRef && organizationId !== null && may(doors.list);
|
|
85
|
+
const canEdit = mayRead && may(doors.create) && may(doors.update) && may(doors.remove);
|
|
86
|
+
const key = mayRead ? `${organizationId}|${layoutRef}` : null;
|
|
87
|
+
const [answer, setAnswer] = useState(null);
|
|
88
|
+
const [revision, setRevision] = useState(0);
|
|
89
|
+
// The scoped `doOperation` changes identity with every scope change; the read uses the latest through a ref so a
|
|
90
|
+
// settling scope does not cancel and resend it.
|
|
91
|
+
const doOperationRef = useRef(doOperation);
|
|
92
|
+
doOperationRef.current = doOperation;
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!key)
|
|
95
|
+
return undefined;
|
|
96
|
+
const reread = () => setRevision((current) => current + 1);
|
|
97
|
+
const readers = layoutReaders.get(key) ?? new Set();
|
|
98
|
+
readers.add(reread);
|
|
99
|
+
layoutReaders.set(key, readers);
|
|
100
|
+
return () => {
|
|
101
|
+
readers.delete(reread);
|
|
102
|
+
if (readers.size === 0)
|
|
103
|
+
layoutReaders.delete(key);
|
|
104
|
+
};
|
|
105
|
+
}, [key]);
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (!key || !doors.list || organizationId === null || !layoutRef)
|
|
108
|
+
return undefined;
|
|
109
|
+
let cancelled = false;
|
|
110
|
+
const settle = (stored) => {
|
|
111
|
+
if (!cancelled)
|
|
112
|
+
setAnswer({ key, stored });
|
|
113
|
+
};
|
|
114
|
+
doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.list), { contextualParameters: { [organizationFieldIdentifier]: organizationId }, queryParameters: { dashboardRef: layoutRef, page: 1, limit: 1 } }, { silent: true })
|
|
115
|
+
// The filter is the backend's; the row is checked again here, so a LIST that ignored it never applies another
|
|
116
|
+
// dashboard's layout.
|
|
117
|
+
.then((result) => settle(listRows(result).find((row) => row.dashboardRef === layoutRef)))
|
|
118
|
+
.catch((error) => {
|
|
119
|
+
logger.warn('Could not read the organization\'s dashboard layout; showing the declared one', { layoutRef, organizationId, error });
|
|
120
|
+
settle(undefined);
|
|
121
|
+
});
|
|
122
|
+
return () => { cancelled = true; };
|
|
123
|
+
}, [key, doors.list, organizationId, layoutRef, organizationFieldIdentifier, revision]);
|
|
124
|
+
const stored = key && answer?.key === key ? answer.stored : undefined;
|
|
125
|
+
const readState = !key || answer?.key === key ? ChartDashboardLayoutReadState.SETTLED : ChartDashboardLayoutReadState.LOADING;
|
|
126
|
+
const save = useCallback(async (tiles) => {
|
|
127
|
+
if (!key || organizationId === null || !layoutRef || !doors.create || !doors.update || !layoutFieldIdentifier)
|
|
128
|
+
return;
|
|
129
|
+
const contextualParameters = { [organizationFieldIdentifier]: organizationId };
|
|
130
|
+
const result = await (stored
|
|
131
|
+
? doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.update), {
|
|
132
|
+
contextualParameters: { ...contextualParameters, [layoutFieldIdentifier]: stored._id },
|
|
133
|
+
requestData: { tiles },
|
|
134
|
+
})
|
|
135
|
+
: doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.create), {
|
|
136
|
+
contextualParameters,
|
|
137
|
+
requestData: { dashboardRef: layoutRef, tiles },
|
|
138
|
+
})).catch(rereadAndRethrow(key));
|
|
139
|
+
const row = writtenRow(result);
|
|
140
|
+
if (row)
|
|
141
|
+
setAnswer({ key, stored: row });
|
|
142
|
+
notifyLayoutReaders(key);
|
|
143
|
+
}, [key, organizationId, layoutRef, doors.create, doors.update, layoutFieldIdentifier, organizationFieldIdentifier, stored]);
|
|
144
|
+
const reset = useCallback(async () => {
|
|
145
|
+
if (!key || organizationId === null || !doors.remove || !layoutFieldIdentifier || !stored)
|
|
146
|
+
return;
|
|
147
|
+
await doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.remove), {
|
|
148
|
+
contextualParameters: { [organizationFieldIdentifier]: organizationId, [layoutFieldIdentifier]: stored._id },
|
|
149
|
+
}).catch(rereadAndRethrow(key));
|
|
150
|
+
setAnswer({ key, stored: undefined });
|
|
151
|
+
notifyLayoutReaders(key);
|
|
152
|
+
}, [key, organizationId, doors.remove, layoutFieldIdentifier, organizationFieldIdentifier, stored]);
|
|
153
|
+
return { readState, stored, canEdit, save, reset };
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=useChartDashboardLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChartDashboardLayout.js","sourceRoot":"","sources":["../../../../../src/components/views/chart-dashboard/useChartDashboardLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,4BAA4B,EAC5B,kCAAkC,GAGnC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAE7F,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAA+B,MAAM,yDAAyD,CAAC;AACjI,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AAEpG,MAAM,MAAM,GAA0B,qBAAqB,CAAC,SAAS,EAAE,CAAC;AACxE,MAAM,OAAO,GAAG,gBAAgB,CAAC,8BAA8B,CAAC;AAEhE,qDAAqD;AACrD,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,qDAAqD;IACrD,oDAAmB,CAAA;IACnB,0GAA0G;IAC1G,oDAAmB,CAAA;AACrB,CAAC,EALW,6BAA6B,KAA7B,6BAA6B,QAKxC;AAcD,wGAAwG;AACxG,MAAM,aAAa,GAAG,IAAI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":["/**\n * The current organization's stored layout of one chart dashboard, and the doors to change it (#2299).\n *\n * Read through the `organizationDashboardLayouts` LIST, filtered by the dashboard's `layoutRef` (every member may read\n * it); written through its CREATE / UPDATE, and reset through its DELETE (the organization's administrators). The backend\n * decides every request and audits every write; this hook only asks the registry's own roles before OFFERING a write\n * (`canEdit`), so a member is never shown an editor whose save would be refused.\n *\n * Settling, and what each outcome means for the dashboard:\n * - no `layoutRef`, no organization, no LIST this frontend registers, or a viewer the LIST would refuse: SETTLED with no\n * layout, so the dashboard shows its declared tiles at once;\n * - a read in flight: LOADING. The dashboard waits rather than drawing the declared order and then jumping;\n * - a read that failed: SETTLED with no layout, logged. Presentation falls back to what the application declared, never\n * to an error;\n * - after a save or a reset in this tab, every dashboard showing the same layout in the same organization reads it again.\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ResourceOperationVariantType,\n ResourcesConfig_OperationPathUtils,\n type OrganizationDashboardLayout,\n type OrganizationDashboardLayoutTile,\n} from '@wildo-ai/saas-models';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport type { FrontendResourceConfiguration_Operation } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { viewerMayPerformOperation, type LauncherEffectiveRoles } from '~wildo-frontend-lib/core/navigation/launcher-resolution';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\n\nconst logger: LoggerFrontendService = LoggerFrontendService.getLogger();\nconst LAYOUTS = CoreResourceType.ORGANIZATION_DASHBOARD_LAYOUTS;\n\n/** Where the read of a dashboard's layout stands. */\nexport enum ChartDashboardLayoutReadState {\n /** The layout is being read; the dashboard waits. */\n LOADING = 'loading',\n /** Read, or nothing to read: `stored` is the organization's layout, or undefined for the declared one. */\n SETTLED = 'settled',\n}\n\nexport interface ChartDashboardLayoutHandle {\n readState: ChartDashboardLayoutReadState;\n /** The organization's stored layout of this dashboard; undefined when it keeps the declared one. */\n stored: OrganizationDashboardLayout | undefined;\n /** Whether the viewer may arrange this dashboard for the organization (create, update and reset). */\n canEdit: boolean;\n /** Store `tiles` as the organization's layout of this dashboard: CREATE the first time, UPDATE after. */\n save: (tiles: OrganizationDashboardLayoutTile[]) => Promise<void>;\n /** Delete the organization's layout, so the dashboard goes back to what the application declares. */\n reset: () => Promise<void>;\n}\n\n/** Every mounted reader of one (organization, layout), told to read again after a write in this tab. */\nconst layoutReaders = new Map<string, Set<() => void>>();\n\nfunction notifyLayoutReaders(key: string): void {\n layoutReaders.get(key)?.forEach((reread) => reread());\n}\n\nfunction findDefaultApiOperation(operations: readonly FrontendResourceConfiguration_Operation[] | undefined, verb: CoreResourceOperation): FrontendResourceConfiguration_Operation | undefined {\n return operations?.find((operation) => operation.operationIdentifier === verb\n && operation.isOperationDefault === true\n && operation.isBulkOperation !== true\n && operation.variantType === ResourceOperationVariantType.API_CALL);\n}\n\n/**\n * A refused write is followed by a re-read, so the next attempt targets what the store now holds: another administrator\n * may have created the row (this tab's CREATE then answers 409) or reset it (UPDATE answers 404) since it was read.\n */\nfunction rereadAndRethrow(key: string): (error: unknown) => never {\n return (error: unknown) => {\n notifyLayoutReaders(key);\n throw error;\n };\n}\n\n/** The rows of one LIST answer, from either the paginated or the bare-array shape. */\nfunction listRows(result: unknown): OrganizationDashboardLayout[] {\n if (Array.isArray(result)) return result as OrganizationDashboardLayout[];\n const data = (result as { data?: unknown } | null | undefined)?.data;\n return Array.isArray(data) ? data as OrganizationDashboardLayout[] : [];\n}\n\n/** One write's answer, whether bare or wrapped in `{ data }`. */\nfunction writtenRow(result: unknown): OrganizationDashboardLayout | undefined {\n if (!result || typeof result !== 'object' || Array.isArray(result)) return undefined;\n const wrapped = (result as { data?: unknown }).data;\n const row = (wrapped && typeof wrapped === 'object' && !Array.isArray(wrapped) ? wrapped : result) as Partial<OrganizationDashboardLayout>;\n return typeof row._id === 'string' && Array.isArray(row.tiles) ? row as OrganizationDashboardLayout : undefined;\n}\n\n/** See the module comment. `viewer` is the viewer's effective roles, as the dashboard's gate reads them. */\nexport function useChartDashboardLayout(layoutRef: string | undefined, viewer: LauncherEffectiveRoles): ChartDashboardLayoutHandle {\n const { registry, doOperation } = useResourceRegistry();\n const organizationId = useAppScopeSafe()?.currentOrganizationId ?? null;\n const configuration = registry.resourceConfigurations[LAYOUTS];\n const operations = configuration?.operations as readonly FrontendResourceConfiguration_Operation[] | undefined;\n const organizationFieldIdentifier = registry.resourceConfigurations[CoreResourceType.ORGANIZATIONS]?.resourceFieldIdentifier ?? 'organizationId';\n const layoutFieldIdentifier = configuration?.resourceFieldIdentifier;\n\n const doors = useMemo(() => ({\n list: findDefaultApiOperation(operations, CoreResourceOperation.LIST),\n create: findDefaultApiOperation(operations, CoreResourceOperation.CREATE),\n update: findDefaultApiOperation(operations, CoreResourceOperation.UPDATE),\n remove: findDefaultApiOperation(operations, CoreResourceOperation.DELETE),\n }), [operations]);\n const may = (operation: FrontendResourceConfiguration_Operation | undefined): boolean =>\n !!operation && viewerMayPerformOperation({ ...operation, resourceType: LAYOUTS }, viewer);\n const mayRead = !!layoutRef && organizationId !== null && may(doors.list);\n const canEdit = mayRead && may(doors.create) && may(doors.update) && may(doors.remove);\n\n const key = mayRead ? `${organizationId}|${layoutRef}` : null;\n const [answer, setAnswer] = useState<{ key: string; stored: OrganizationDashboardLayout | undefined } | null>(null);\n const [revision, setRevision] = useState(0);\n // The scoped `doOperation` changes identity with every scope change; the read uses the latest through a ref so a\n // settling scope does not cancel and resend it.\n const doOperationRef = useRef(doOperation);\n doOperationRef.current = doOperation;\n\n useEffect(() => {\n if (!key) return undefined;\n const reread = (): void => setRevision((current) => current + 1);\n const readers = layoutReaders.get(key) ?? new Set<() => void>();\n readers.add(reread);\n layoutReaders.set(key, readers);\n return () => {\n readers.delete(reread);\n if (readers.size === 0) layoutReaders.delete(key);\n };\n }, [key]);\n\n useEffect(() => {\n if (!key || !doors.list || organizationId === null || !layoutRef) return undefined;\n let cancelled = false;\n const settle = (stored: OrganizationDashboardLayout | undefined): void => {\n if (!cancelled) setAnswer({ key, stored });\n };\n doOperationRef.current(\n ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.list),\n { contextualParameters: { [organizationFieldIdentifier]: organizationId }, queryParameters: { dashboardRef: layoutRef, page: 1, limit: 1 } },\n { silent: true },\n )\n // The filter is the backend's; the row is checked again here, so a LIST that ignored it never applies another\n // dashboard's layout.\n .then((result) => settle(listRows(result).find((row) => row.dashboardRef === layoutRef)))\n .catch((error: unknown) => {\n logger.warn('Could not read the organization\\'s dashboard layout; showing the declared one', { layoutRef, organizationId, error });\n settle(undefined);\n });\n return () => { cancelled = true; };\n }, [key, doors.list, organizationId, layoutRef, organizationFieldIdentifier, revision]);\n\n const stored = key && answer?.key === key ? answer.stored : undefined;\n const readState = !key || answer?.key === key ? ChartDashboardLayoutReadState.SETTLED : ChartDashboardLayoutReadState.LOADING;\n\n const save = useCallback(async (tiles: OrganizationDashboardLayoutTile[]): Promise<void> => {\n if (!key || organizationId === null || !layoutRef || !doors.create || !doors.update || !layoutFieldIdentifier) return;\n const contextualParameters = { [organizationFieldIdentifier]: organizationId };\n const result = await (stored\n ? doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.update), {\n contextualParameters: { ...contextualParameters, [layoutFieldIdentifier]: stored._id },\n requestData: { tiles },\n })\n : doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.create), {\n contextualParameters,\n requestData: { dashboardRef: layoutRef, tiles },\n })).catch(rereadAndRethrow(key));\n const row = writtenRow(result);\n if (row) setAnswer({ key, stored: row });\n notifyLayoutReaders(key);\n }, [key, organizationId, layoutRef, doors.create, doors.update, layoutFieldIdentifier, organizationFieldIdentifier, stored]);\n\n const reset = useCallback(async (): Promise<void> => {\n if (!key || organizationId === null || !doors.remove || !layoutFieldIdentifier || !stored) return;\n await doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.remove), {\n contextualParameters: { [organizationFieldIdentifier]: organizationId, [layoutFieldIdentifier]: stored._id },\n }).catch(rereadAndRethrow(key));\n setAnswer({ key, stored: undefined });\n notifyLayoutReaders(key);\n }, [key, organizationId, doors.remove, layoutFieldIdentifier, organizationFieldIdentifier, stored]);\n\n return { readState, stored, canEdit, save, reset };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-motion-origins.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/shell-motion-origins.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,
|
|
1
|
+
{"version":3,"file":"shell-motion-origins.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/shell-motion-origins.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,EAQL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAEnC;;;;;GAKG;AAEH,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAcD;;;GAGG;AACH,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAIjD,qHAAqH;AACrH,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AA6CD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAQ/D;AAUD,6GAA6G;A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AqBnI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef } from 'react';
|
|
2
|
-
import { SHELL_MODAL_POPUP_SLOTS, SHELL_PANE_SELECTOR, SHELL_PROXY_ATTRIBUTE, SHELL_PROXY_FLIGHT_SHARE, ShellDialogArrival, ShellPopupSlot, } from './shell-motion-vocabulary.js';
|
|
2
|
+
import { SHELL_MODAL_POPUP_SLOTS, SHELL_PANE_SELECTOR, SHELL_PICTURE_STRIPPED_ATTRIBUTES, SHELL_PROXY_ATTRIBUTE, SHELL_PROXY_FLIGHT_SHARE, ShellDialogArrival, ShellPopupSlot, } from './shell-motion-vocabulary.js';
|
|
3
3
|
/** A row is at least this high (a single line of text in a padded row) … */
|
|
4
4
|
const ROW_MIN_HEIGHT_PX = 24;
|
|
5
5
|
/** … at most this high (a two-line card row with meta) … */
|
|
@@ -24,7 +24,8 @@ function pictureOf(element) {
|
|
|
24
24
|
copy.setAttribute('aria-hidden', 'true');
|
|
25
25
|
copy.setAttribute('inert', '');
|
|
26
26
|
for (const node of [copy, ...copy.querySelectorAll('*')]) {
|
|
27
|
-
|
|
27
|
+
// The shared markers, and the row's own state hooks: the picture is a flat image of a row that is about to change.
|
|
28
|
+
for (const attribute of [...SHELL_PICTURE_STRIPPED_ATTRIBUTES, 'data-slot', 'data-state'])
|
|
28
29
|
node.removeAttribute(attribute);
|
|
29
30
|
}
|
|
30
31
|
for (const media of copy.querySelectorAll('iframe, video, audio'))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-motion-origins.js","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/shell-motion-origins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AAEnE,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,GAGf,MAAM,2BAA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C;YACjG,CAAC;QACH,CAAC,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC7C,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC/G,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import { useEffect, useMemo, useRef, type RefObject } from 'react';\n\nimport {\n SHELL_MODAL_POPUP_SLOTS,\n SHELL_PANE_SELECTOR,\n SHELL_PROXY_ATTRIBUTE,\n SHELL_PROXY_FLIGHT_SHARE,\n ShellDialogArrival,\n ShellPopupSlot,\n type ShellMotionAxis,\n type ShellStageRect,\n} from './shell-motion-vocabulary';\n\n/**\n * The motion building blocks that start from WHERE something was pressed (#2055): a pane or a dialog growing out of the\n * row or button that opened it, an emphasized pane growing to its new width, and a pane's rows cascading in. Like the\n * rest of the motion core they write nothing on an engine element but WAAPI animations, which leave nothing behind, and\n * proxies of their own.\n */\n\n/** A box in viewport coordinates. */\nexport interface ShellViewportBox {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\n/** A row is at least this high (a single line of text in a padded row) … */\nconst ROW_MIN_HEIGHT_PX = 24;\n/** … at most this high (a two-line card row with meta) … */\nconst ROW_MAX_HEIGHT_PX = 220;\n/** … and at least this share of its pane's width. */\nconst ROW_MIN_WIDTH_SHARE = 0.5;\n/** How many rows a cascade animates at most: the rest are below the fold or too many to stagger meaningfully. */\nconst CASCADE_MAX_ROWS = 24;\n/** The stagger between two cascading rows. */\nconst CASCADE_STAGGER_MS = 28;\n/** How long a cascade keeps watching for rows that arrive after the place changed (data still loading). */\nconst CASCADE_WATCH_MS = 1500;\n/**\n * How recent a press must be to be what opened a pane or a dialog. Short on purpose: a modal that opens later than\n * this was not opened by that press (a timer, a websocket push), and must not fly from it.\n */\nexport const SHELL_PRESS_ORIGIN_MAX_AGE_MS = 800;\n\nconst toBox = (rect: DOMRect | ShellViewportBox): ShellViewportBox => ({ left: rect.left, top: rect.top, width: rect.width, height: rect.height });\n\n/** A pressed box, with — for a row — a still picture of it taken at the press, which a proxy carries as it grows. */\nexport interface ShellPressedBox extends ShellViewportBox {\n picture?: HTMLElement;\n /**\n * The pressed row itself, live — for a view-transition arrival, which names the row BEFORE the commit so the browser\n * captures it. It may have moved or unmounted since the press; the box above is where it was.\n */\n element?: HTMLElement;\n}\n\n/** An inert, unaddressable copy of an element: no ids, no focus, hidden from assistive technology, no engine markers. */\nfunction pictureOf(element: HTMLElement): HTMLElement {\n const copy = element.cloneNode(true) as HTMLElement;\n copy.setAttribute('aria-hidden', 'true');\n copy.setAttribute('inert', '');\n for (const node of [copy, ...copy.querySelectorAll<HTMLElement>('*')]) {\n for (const attribute of ['id', 'data-content-area', 'data-panel-id', 'data-component-area', 'data-slot', 'data-state']) node.removeAttribute(attribute);\n }\n for (const media of copy.querySelectorAll('iframe, video, audio')) media.remove();\n return copy;\n}\n\n/** Whether an element has the shape of a row inside a pane `paneWidth` wide. */\nfunction isRowShaped(element: Element, paneWidth: number): element is HTMLElement {\n if (!(element instanceof HTMLElement)) return false;\n const height = element.offsetHeight;\n return height >= ROW_MIN_HEIGHT_PX && height <= ROW_MAX_HEIGHT_PX && element.offsetWidth >= paneWidth * ROW_MIN_WIDTH_SHARE;\n}\n\n/**\n * Whether two elements are ALIKE — the same tag, and mostly the same classes (half their class tokens shared or more).\n * Rows rendered by one component share their classes, whatever state class one of them adds (`active`, `selected`); a\n * header, a toolbar and a filter bar are rendered by different components and do not.\n */\nfunction isAlike(a: Element, b: Element): boolean {\n if (a.tagName !== b.tagName) return false;\n const tokensA = new Set(a.classList);\n const tokensB = new Set(b.classList);\n if (tokensA.size === 0 && tokensB.size === 0) return true;\n const shared = [...tokensA].filter((token) => tokensB.has(token)).length;\n return shared / Math.max(tokensA.size, tokensB.size) >= 0.5;\n}\n\n/**\n * Whether a row-shaped element is one of a REPEATED group — at least one alike, row-shaped sibling: a list, even of two\n * items, and never a strip that is alone of its kind.\n */\nfunction isInRepeatedGroup(element: HTMLElement, paneWidth: number): boolean {\n const siblings = element.parentElement ? [...element.parentElement.children] : [];\n return siblings.some((sibling) => sibling !== element && isRowShaped(sibling, paneWidth) && isAlike(sibling, element));\n}\n\n/**\n * The row an element belongs to, recognised by SHAPE: the nearest ancestor inside the pane that is row-high, wide, and\n * one of a repeated group of such siblings. The engine renders no row marker, and its lists are tables, card lists or an\n * application's own rows, so a marker could never cover them all while a shape does. The repeated-group rule keeps a\n * full-width toolbar or header, which is alone of its kind, from passing for a row. `null` outside a pane, or when\n * nothing on the way qualifies (a multi-column card grid, whose cards are narrower than half the pane).\n */\nexport function shellRowBox(target: Element): HTMLElement | null {\n const pane = target.closest(SHELL_PANE_SELECTOR);\n if (!pane) return null;\n const paneWidth = pane.clientWidth;\n for (let element: Element | null = target; element && element !== pane; element = element.parentElement) {\n if (isRowShaped(element, paneWidth) && isInRepeatedGroup(element, paneWidth)) return element;\n }\n return null;\n}\n\nconst CONTROL_SELECTOR = 'button, a, [role=\"button\"], [role=\"menuitem\"], [role=\"option\"]';\n\ninterface ShellPress {\n row: ShellPressedBox | null;\n control: ShellViewportBox;\n at: number;\n}\n\n/** The last press, as boxes to grow from. Each `take…` CONSUMES it, so one press opens at most one thing. */\nexport interface ShellPressOrigin {\n /** The row pressed within `maxAgeMs`, if any, with its picture. */\n takeRow(maxAgeMs: number): ShellPressedBox | null;\n /** The row pressed within `maxAgeMs`, WITHOUT consuming the press — to decide before taking it. */\n peekRow(maxAgeMs: number): ShellPressedBox | null;\n /** The control (button, link, menu item) pressed within `maxAgeMs`, if any. */\n takeControl(maxAgeMs: number): ShellViewportBox | null;\n}\n\n/**\n * Remembers the last press — a pointer press, or Enter / Space on a focused element — as the box of the row and of the\n * control it happened in, measured AT the press, before anything re-renders (the row may move or unmount the moment what\n * it opens mounts). ANY other key press forgets it: whatever opens next was opened by that key (a shortcut such as the\n * command palette's), not by the earlier press, and must not grow out of it.\n *\n * Installs nothing while `enabled` is false — a layout whose axis never grows from a press pays no listener and no layout\n * read on every press.\n */\nexport function useShellPressOrigin(enabled: boolean): ShellPressOrigin {\n const last = useRef<ShellPress | null>(null);\n useEffect(() => {\n last.current = null;\n if (!enabled) return undefined;\n const record = (target: Element | null): void => {\n if (!target) return;\n const row = shellRowBox(target);\n const control = target.closest(CONTROL_SELECTOR) ?? target;\n last.current = {\n row: row ? { ...toBox(row.getBoundingClientRect()), picture: pictureOf(row), element: row } : null,\n control: toBox(control.getBoundingClientRect()),\n at: performance.now(),\n };\n };\n const onPointer = (event: PointerEvent): void => record(event.target instanceof Element ? event.target : null);\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === 'Enter' || event.key === ' ') record(document.activeElement);\n else last.current = null;\n };\n document.addEventListener('pointerdown', onPointer, true);\n document.addEventListener('keydown', onKey, true);\n return () => {\n document.removeEventListener('pointerdown', onPointer, true);\n document.removeEventListener('keydown', onKey, true);\n };\n }, [enabled]);\n return useMemo<ShellPressOrigin>(() => {\n const take = <T extends ShellViewportBox>(pick: (press: ShellPress) => T | null, maxAgeMs: number): T | null => {\n const press = last.current;\n if (!press || performance.now() - press.at > maxAgeMs) return null;\n last.current = null;\n return pick(press);\n };\n const peek = (maxAgeMs: number): ShellPressedBox | null => {\n const press = last.current;\n return press && performance.now() - press.at <= maxAgeMs ? press.row : null;\n };\n return { takeRow: (maxAgeMs) => take((press) => press.row, maxAgeMs), peekRow: peek, takeControl: (maxAgeMs) => take((press) => press.control, maxAgeMs) };\n }, []);\n}\n\n/**\n * Flies a proxy box from one viewport box to another inside the stage, for `SHELL_PROXY_FLIGHT_SHARE` of the axis's\n * motion, then removes it. A pressed row's picture (`from.picture`) rides in it, fading as it grows. The proxy is the core's own element (`data-shell-proxy`, aria-hidden, no pointer events),\n * painted inline from the theme's tokens so it reads as the surface it becomes.\n *\n * `arriving` — the pane or dialog the proxy stands for — is revealed on the SAME clock: hidden for the flight, then faded\n * in over the rest of the motion, by a script animation that sits above whatever the layout's stylesheet plays on it.\n * Two clocks (a stylesheet hold started at mount, a flight started later) drift apart; one cannot.\n */\nexport function flyShellProxy(stage: HTMLElement, from: ShellPressedBox, to: ShellViewportBox, axis: ShellMotionAxis, arriving?: Element): Promise<void> {\n const duration = Math.round(axis.durationMs * SHELL_PROXY_FLIGHT_SHARE);\n if (duration === 0 || typeof HTMLElement.prototype.animate !== 'function') return Promise.resolve();\n const origin = stage.getBoundingClientRect();\n const frame = (box: ShellViewportBox, radius: number): Keyframe => ({\n left: `${box.left - origin.left}px`,\n top: `${box.top - origin.top}px`,\n width: `${box.width}px`,\n height: `${box.height}px`,\n borderRadius: `${radius}px`,\n });\n const proxy = document.createElement('div');\n proxy.setAttribute(SHELL_PROXY_ATTRIBUTE, '');\n proxy.setAttribute('aria-hidden', 'true');\n Object.assign(proxy.style, {\n position: 'absolute',\n zIndex: '400',\n pointerEvents: 'none',\n boxSizing: 'border-box',\n background: 'var(--card, var(--background))',\n border: '1px solid var(--primary, currentColor)',\n boxShadow: '0 18px 40px -18px rgb(0 0 0 / 0.35)',\n });\n Object.assign(proxy.style, frame(from, 10), { overflow: 'hidden' });\n // The pressed row rides in the proxy, fading as the box grows: the row visibly BECOMES the record.\n if (from.picture) {\n Object.assign(from.picture.style, { position: 'absolute', left: '0', top: '0', width: `${from.width}px`, height: `${from.height}px`, margin: '0', pointerEvents: 'none' });\n proxy.appendChild(from.picture);\n from.picture.animate([{ opacity: 1 }, { opacity: 0 }], { duration: Math.round(duration * 0.8), easing: 'ease-in', fill: 'forwards' });\n }\n stage.appendChild(proxy);\n if (arriving instanceof HTMLElement && typeof arriving.animate === 'function') {\n arriving.animate([{ opacity: 0 }, { opacity: 0, offset: SHELL_PROXY_FLIGHT_SHARE }, { opacity: 1 }], { duration: axis.durationMs, easing: 'linear' });\n }\n const animation = proxy.animate([frame(from, 10), frame(to, 14)], { duration, easing: axis.easing, fill: 'forwards' });\n return animation.finished.catch(() => undefined).then(() => proxy.remove());\n}\n\n/**\n * An emphasized pane grows from the box it had (`before`, in stage coordinates) to the box it now fills: it is\n * REVEALED through a clip that starts on the old box, so its content is never scaled or distorted on the way.\n */\nexport function growShellPane(pane: HTMLElement, before: ShellStageRect, stage: HTMLElement, axis: ShellMotionAxis): void {\n if (axis.durationMs === 0 || typeof pane.animate !== 'function') return;\n const origin = stage.getBoundingClientRect();\n const after = pane.getBoundingClientRect();\n const top = Math.max(0, origin.top + before.top - after.top);\n const left = Math.max(0, origin.left + before.left - after.left);\n const right = Math.max(0, after.right - (origin.left + before.left + before.width));\n const bottom = Math.max(0, after.bottom - (origin.top + before.top + before.height));\n pane.animate([{ clipPath: `inset(${top}px ${right}px ${bottom}px ${left}px round 12px)` }, { clipPath: 'inset(0px 0px 0px 0px round 0px)' }], {\n duration: axis.durationMs,\n easing: axis.easing,\n });\n}\n\n/** A pane given back its place slides home from where it stood while it had the width. */\nexport function slideShellPaneHome(pane: HTMLElement, before: ShellStageRect, stage: HTMLElement, axis: ShellMotionAxis): void {\n if (axis.durationMs === 0 || typeof pane.animate !== 'function') return;\n const origin = stage.getBoundingClientRect();\n const dx = origin.left + before.left - pane.getBoundingClientRect().left;\n if (Math.abs(dx) < 2) return;\n pane.animate([{ transform: `translateX(${dx}px)` }, { transform: 'none' }], { duration: axis.durationMs, easing: axis.easing });\n}\n\n/**\n * The rows of a pane: the largest group of ALIKE, row-shaped siblings in it (at least two — a list of two items is a\n * list — and most of their parent's children, so neither a toolbar of wide buttons nor a pane's own header strips pass\n * for a list).\n */\nexport function shellPaneRows(pane: HTMLElement): HTMLElement[] {\n const width = pane.clientWidth;\n let best: HTMLElement[] = [];\n for (const parent of [pane, ...pane.querySelectorAll<HTMLElement>('*')]) {\n if (parent.children.length < 2 || parent.children.length <= best.length) continue;\n const shaped = [...parent.children].filter((child): child is HTMLElement => isRowShaped(child, width));\n // The rows are the largest ALIKE subset of the row-shaped children (a list's header row is not one of them). Each\n // child joins the first group whose first member it is alike to: linear in the children, not quadratic.\n const groups: HTMLElement[][] = [];\n for (const child of shaped) {\n const group = groups.find((candidate) => isAlike(candidate[0]!, child));\n if (group) group.push(child);\n else groups.push([child]);\n }\n const rows = groups.reduce<HTMLElement[]>((largest, group) => (group.length > largest.length ? group : largest), []);\n if (rows.length >= 2 && rows.length > best.length && rows.length >= parent.children.length * 0.6) best = rows;\n }\n return best;\n}\n\n/**\n * Cascades a pane's rows in, one after another. Rows present now cascade at once. For `CASCADE_WATCH_MS` afterwards\n * the pane is re-scanned after mutations — at most once per frame, in an animation-frame callback, which runs before\n * that frame is painted — and rows not yet animated join the cascade. So rows that arrive with the data (after a loading\n * skeleton, in a different container) cascade too, and a row never shows and then vanishes to start its entrance.\n * Watching the WHOLE pane, not the first list found, is deliberate: the first list is often the skeleton.\n */\nexport function cascadeShellRows(pane: HTMLElement, axis: ShellMotionAxis): () => void {\n if (axis.durationMs === 0 || typeof pane.animate !== 'function') return () => undefined;\n const animated = new WeakSet<Element>();\n let staggerIndex = 0;\n const run = (): void => {\n scan = 0;\n for (const row of shellPaneRows(pane).slice(0, CASCADE_MAX_ROWS)) {\n if (animated.has(row)) continue;\n animated.add(row);\n row.animate([{ opacity: 0, transform: 'translateY(12px) scale(0.98)' }, { opacity: 1, transform: 'none' }], {\n duration: Math.round(axis.durationMs * 0.8),\n easing: axis.easing,\n delay: Math.min(staggerIndex, CASCADE_MAX_ROWS) * CASCADE_STAGGER_MS,\n fill: 'backwards',\n });\n staggerIndex += 1;\n }\n };\n let scan = 0;\n run();\n // A new batch staggers from its own first row, not after the rows already shown.\n const watch = new MutationObserver(() => {\n if (scan) return;\n staggerIndex = 0;\n scan = requestAnimationFrame(run);\n });\n watch.observe(pane, { childList: true, subtree: true });\n const stop = setTimeout(() => { cancelAnimationFrame(scan); watch.disconnect(); }, CASCADE_WATCH_MS);\n return () => {\n clearTimeout(stop);\n cancelAnimationFrame(scan);\n watch.disconnect();\n };\n}\n\n/**\n * A modal popup grows out of the control that opened it, for an axis whose `dialogArrival` says so: when a modal content\n * slot appears open in the stage's overlay layer, a proxy flies from the pressed control to the dialog's box, and the\n * dialog is revealed on the flight's clock. Only the overlay layer is watched. A drawer is left alone: its library\n * positions it with transforms of its own.\n */\nexport function useShellDialogArrival(rootRef: RefObject<HTMLElement | null>, axis: ShellMotionAxis, origin: ShellPressOrigin): void {\n useEffect(() => {\n const layer = rootRef.current?.querySelector('[data-shell-overlay-layer]');\n const stage = rootRef.current;\n if (!stage || !layer || axis.dialogArrival !== ShellDialogArrival.FROM_PRESSED_ELEMENT || axis.durationMs === 0) return undefined;\n const seen = new WeakSet<Element>();\n const openModal = SHELL_MODAL_POPUP_SLOTS.filter((slot) => slot !== ShellPopupSlot.DRAWER)\n .map((slot) => `[data-slot=\"${slot}\"][data-state=\"open\"]`)\n .join(', ');\n const check = (): void => {\n for (const dialog of layer.querySelectorAll(openModal)) {\n if (seen.has(dialog)) continue;\n seen.add(dialog);\n const from = origin.takeControl(SHELL_PRESS_ORIGIN_MAX_AGE_MS);\n if (from) void flyShellProxy(stage, from, toBox(dialog.getBoundingClientRect()), axis, dialog);\n }\n };\n const observer = new MutationObserver(check);\n observer.observe(layer, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-state'] });\n return () => observer.disconnect();\n }, [rootRef, axis, origin]);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shell-motion-origins.js","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/shell-motion-origins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AAEnE,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,iCAAiC,EACjC,qBAAqB,EACrB,wBAAwB,EAC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,EAAE,MAAM,CAAC,CAAC;YACjG,CAAC;QACH,CAAC,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC7C,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAC/G,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import { useEffect, useMemo, useRef, type RefObject } from 'react';\n\nimport {\n SHELL_MODAL_POPUP_SLOTS,\n SHELL_PANE_SELECTOR,\n SHELL_PICTURE_STRIPPED_ATTRIBUTES,\n SHELL_PROXY_ATTRIBUTE,\n SHELL_PROXY_FLIGHT_SHARE,\n ShellDialogArrival,\n ShellPopupSlot,\n type ShellMotionAxis,\n type ShellStageRect,\n} from './shell-motion-vocabulary';\n\n/**\n * The motion building blocks that start from WHERE something was pressed (#2055): a pane or a dialog growing out of the\n * row or button that opened it, an emphasized pane growing to its new width, and a pane's rows cascading in. Like the\n * rest of the motion core they write nothing on an engine element but WAAPI animations, which leave nothing behind, and\n * proxies of their own.\n */\n\n/** A box in viewport coordinates. */\nexport interface ShellViewportBox {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\n/** A row is at least this high (a single line of text in a padded row) … */\nconst ROW_MIN_HEIGHT_PX = 24;\n/** … at most this high (a two-line card row with meta) … */\nconst ROW_MAX_HEIGHT_PX = 220;\n/** … and at least this share of its pane's width. */\nconst ROW_MIN_WIDTH_SHARE = 0.5;\n/** How many rows a cascade animates at most: the rest are below the fold or too many to stagger meaningfully. */\nconst CASCADE_MAX_ROWS = 24;\n/** The stagger between two cascading rows. */\nconst CASCADE_STAGGER_MS = 28;\n/** How long a cascade keeps watching for rows that arrive after the place changed (data still loading). */\nconst CASCADE_WATCH_MS = 1500;\n/**\n * How recent a press must be to be what opened a pane or a dialog. Short on purpose: a modal that opens later than\n * this was not opened by that press (a timer, a websocket push), and must not fly from it.\n */\nexport const SHELL_PRESS_ORIGIN_MAX_AGE_MS = 800;\n\nconst toBox = (rect: DOMRect | ShellViewportBox): ShellViewportBox => ({ left: rect.left, top: rect.top, width: rect.width, height: rect.height });\n\n/** A pressed box, with — for a row — a still picture of it taken at the press, which a proxy carries as it grows. */\nexport interface ShellPressedBox extends ShellViewportBox {\n picture?: HTMLElement;\n /**\n * The pressed row itself, live — for a view-transition arrival, which names the row BEFORE the commit so the browser\n * captures it. It may have moved or unmounted since the press; the box above is where it was.\n */\n element?: HTMLElement;\n}\n\n/** An inert, unaddressable copy of an element: no ids, no focus, hidden from assistive technology, no engine markers. */\nfunction pictureOf(element: HTMLElement): HTMLElement {\n const copy = element.cloneNode(true) as HTMLElement;\n copy.setAttribute('aria-hidden', 'true');\n copy.setAttribute('inert', '');\n for (const node of [copy, ...copy.querySelectorAll<HTMLElement>('*')]) {\n // The shared markers, and the row's own state hooks: the picture is a flat image of a row that is about to change.\n for (const attribute of [...SHELL_PICTURE_STRIPPED_ATTRIBUTES, 'data-slot', 'data-state']) node.removeAttribute(attribute);\n }\n for (const media of copy.querySelectorAll('iframe, video, audio')) media.remove();\n return copy;\n}\n\n/** Whether an element has the shape of a row inside a pane `paneWidth` wide. */\nfunction isRowShaped(element: Element, paneWidth: number): element is HTMLElement {\n if (!(element instanceof HTMLElement)) return false;\n const height = element.offsetHeight;\n return height >= ROW_MIN_HEIGHT_PX && height <= ROW_MAX_HEIGHT_PX && element.offsetWidth >= paneWidth * ROW_MIN_WIDTH_SHARE;\n}\n\n/**\n * Whether two elements are ALIKE — the same tag, and mostly the same classes (half their class tokens shared or more).\n * Rows rendered by one component share their classes, whatever state class one of them adds (`active`, `selected`); a\n * header, a toolbar and a filter bar are rendered by different components and do not.\n */\nfunction isAlike(a: Element, b: Element): boolean {\n if (a.tagName !== b.tagName) return false;\n const tokensA = new Set(a.classList);\n const tokensB = new Set(b.classList);\n if (tokensA.size === 0 && tokensB.size === 0) return true;\n const shared = [...tokensA].filter((token) => tokensB.has(token)).length;\n return shared / Math.max(tokensA.size, tokensB.size) >= 0.5;\n}\n\n/**\n * Whether a row-shaped element is one of a REPEATED group — at least one alike, row-shaped sibling: a list, even of two\n * items, and never a strip that is alone of its kind.\n */\nfunction isInRepeatedGroup(element: HTMLElement, paneWidth: number): boolean {\n const siblings = element.parentElement ? [...element.parentElement.children] : [];\n return siblings.some((sibling) => sibling !== element && isRowShaped(sibling, paneWidth) && isAlike(sibling, element));\n}\n\n/**\n * The row an element belongs to, recognised by SHAPE: the nearest ancestor inside the pane that is row-high, wide, and\n * one of a repeated group of such siblings. The engine renders no row marker, and its lists are tables, card lists or an\n * application's own rows, so a marker could never cover them all while a shape does. The repeated-group rule keeps a\n * full-width toolbar or header, which is alone of its kind, from passing for a row. `null` outside a pane, or when\n * nothing on the way qualifies (a multi-column card grid, whose cards are narrower than half the pane).\n */\nexport function shellRowBox(target: Element): HTMLElement | null {\n const pane = target.closest(SHELL_PANE_SELECTOR);\n if (!pane) return null;\n const paneWidth = pane.clientWidth;\n for (let element: Element | null = target; element && element !== pane; element = element.parentElement) {\n if (isRowShaped(element, paneWidth) && isInRepeatedGroup(element, paneWidth)) return element;\n }\n return null;\n}\n\nconst CONTROL_SELECTOR = 'button, a, [role=\"button\"], [role=\"menuitem\"], [role=\"option\"]';\n\ninterface ShellPress {\n row: ShellPressedBox | null;\n control: ShellViewportBox;\n at: number;\n}\n\n/** The last press, as boxes to grow from. Each `take…` CONSUMES it, so one press opens at most one thing. */\nexport interface ShellPressOrigin {\n /** The row pressed within `maxAgeMs`, if any, with its picture. */\n takeRow(maxAgeMs: number): ShellPressedBox | null;\n /** The row pressed within `maxAgeMs`, WITHOUT consuming the press — to decide before taking it. */\n peekRow(maxAgeMs: number): ShellPressedBox | null;\n /** The control (button, link, menu item) pressed within `maxAgeMs`, if any. */\n takeControl(maxAgeMs: number): ShellViewportBox | null;\n}\n\n/**\n * Remembers the last press — a pointer press, or Enter / Space on a focused element — as the box of the row and of the\n * control it happened in, measured AT the press, before anything re-renders (the row may move or unmount the moment what\n * it opens mounts). ANY other key press forgets it: whatever opens next was opened by that key (a shortcut such as the\n * command palette's), not by the earlier press, and must not grow out of it.\n *\n * Installs nothing while `enabled` is false — a layout whose axis never grows from a press pays no listener and no layout\n * read on every press.\n */\nexport function useShellPressOrigin(enabled: boolean): ShellPressOrigin {\n const last = useRef<ShellPress | null>(null);\n useEffect(() => {\n last.current = null;\n if (!enabled) return undefined;\n const record = (target: Element | null): void => {\n if (!target) return;\n const row = shellRowBox(target);\n const control = target.closest(CONTROL_SELECTOR) ?? target;\n last.current = {\n row: row ? { ...toBox(row.getBoundingClientRect()), picture: pictureOf(row), element: row } : null,\n control: toBox(control.getBoundingClientRect()),\n at: performance.now(),\n };\n };\n const onPointer = (event: PointerEvent): void => record(event.target instanceof Element ? event.target : null);\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === 'Enter' || event.key === ' ') record(document.activeElement);\n else last.current = null;\n };\n document.addEventListener('pointerdown', onPointer, true);\n document.addEventListener('keydown', onKey, true);\n return () => {\n document.removeEventListener('pointerdown', onPointer, true);\n document.removeEventListener('keydown', onKey, true);\n };\n }, [enabled]);\n return useMemo<ShellPressOrigin>(() => {\n const take = <T extends ShellViewportBox>(pick: (press: ShellPress) => T | null, maxAgeMs: number): T | null => {\n const press = last.current;\n if (!press || performance.now() - press.at > maxAgeMs) return null;\n last.current = null;\n return pick(press);\n };\n const peek = (maxAgeMs: number): ShellPressedBox | null => {\n const press = last.current;\n return press && performance.now() - press.at <= maxAgeMs ? press.row : null;\n };\n return { takeRow: (maxAgeMs) => take((press) => press.row, maxAgeMs), peekRow: peek, takeControl: (maxAgeMs) => take((press) => press.control, maxAgeMs) };\n }, []);\n}\n\n/**\n * Flies a proxy box from one viewport box to another inside the stage, for `SHELL_PROXY_FLIGHT_SHARE` of the axis's\n * motion, then removes it. A pressed row's picture (`from.picture`) rides in it, fading as it grows. The proxy is the core's own element (`data-shell-proxy`, aria-hidden, no pointer events),\n * painted inline from the theme's tokens so it reads as the surface it becomes.\n *\n * `arriving` — the pane or dialog the proxy stands for — is revealed on the SAME clock: hidden for the flight, then faded\n * in over the rest of the motion, by a script animation that sits above whatever the layout's stylesheet plays on it.\n * Two clocks (a stylesheet hold started at mount, a flight started later) drift apart; one cannot.\n */\nexport function flyShellProxy(stage: HTMLElement, from: ShellPressedBox, to: ShellViewportBox, axis: ShellMotionAxis, arriving?: Element): Promise<void> {\n const duration = Math.round(axis.durationMs * SHELL_PROXY_FLIGHT_SHARE);\n if (duration === 0 || typeof HTMLElement.prototype.animate !== 'function') return Promise.resolve();\n const origin = stage.getBoundingClientRect();\n const frame = (box: ShellViewportBox, radius: number): Keyframe => ({\n left: `${box.left - origin.left}px`,\n top: `${box.top - origin.top}px`,\n width: `${box.width}px`,\n height: `${box.height}px`,\n borderRadius: `${radius}px`,\n });\n const proxy = document.createElement('div');\n proxy.setAttribute(SHELL_PROXY_ATTRIBUTE, '');\n proxy.setAttribute('aria-hidden', 'true');\n Object.assign(proxy.style, {\n position: 'absolute',\n zIndex: '400',\n pointerEvents: 'none',\n boxSizing: 'border-box',\n background: 'var(--card, var(--background))',\n border: '1px solid var(--primary, currentColor)',\n boxShadow: '0 18px 40px -18px rgb(0 0 0 / 0.35)',\n });\n Object.assign(proxy.style, frame(from, 10), { overflow: 'hidden' });\n // The pressed row rides in the proxy, fading as the box grows: the row visibly BECOMES the record.\n if (from.picture) {\n Object.assign(from.picture.style, { position: 'absolute', left: '0', top: '0', width: `${from.width}px`, height: `${from.height}px`, margin: '0', pointerEvents: 'none' });\n proxy.appendChild(from.picture);\n from.picture.animate([{ opacity: 1 }, { opacity: 0 }], { duration: Math.round(duration * 0.8), easing: 'ease-in', fill: 'forwards' });\n }\n stage.appendChild(proxy);\n if (arriving instanceof HTMLElement && typeof arriving.animate === 'function') {\n arriving.animate([{ opacity: 0 }, { opacity: 0, offset: SHELL_PROXY_FLIGHT_SHARE }, { opacity: 1 }], { duration: axis.durationMs, easing: 'linear' });\n }\n const animation = proxy.animate([frame(from, 10), frame(to, 14)], { duration, easing: axis.easing, fill: 'forwards' });\n return animation.finished.catch(() => undefined).then(() => proxy.remove());\n}\n\n/**\n * An emphasized pane grows from the box it had (`before`, in stage coordinates) to the box it now fills: it is\n * REVEALED through a clip that starts on the old box, so its content is never scaled or distorted on the way.\n */\nexport function growShellPane(pane: HTMLElement, before: ShellStageRect, stage: HTMLElement, axis: ShellMotionAxis): void {\n if (axis.durationMs === 0 || typeof pane.animate !== 'function') return;\n const origin = stage.getBoundingClientRect();\n const after = pane.getBoundingClientRect();\n const top = Math.max(0, origin.top + before.top - after.top);\n const left = Math.max(0, origin.left + before.left - after.left);\n const right = Math.max(0, after.right - (origin.left + before.left + before.width));\n const bottom = Math.max(0, after.bottom - (origin.top + before.top + before.height));\n pane.animate([{ clipPath: `inset(${top}px ${right}px ${bottom}px ${left}px round 12px)` }, { clipPath: 'inset(0px 0px 0px 0px round 0px)' }], {\n duration: axis.durationMs,\n easing: axis.easing,\n });\n}\n\n/** A pane given back its place slides home from where it stood while it had the width. */\nexport function slideShellPaneHome(pane: HTMLElement, before: ShellStageRect, stage: HTMLElement, axis: ShellMotionAxis): void {\n if (axis.durationMs === 0 || typeof pane.animate !== 'function') return;\n const origin = stage.getBoundingClientRect();\n const dx = origin.left + before.left - pane.getBoundingClientRect().left;\n if (Math.abs(dx) < 2) return;\n pane.animate([{ transform: `translateX(${dx}px)` }, { transform: 'none' }], { duration: axis.durationMs, easing: axis.easing });\n}\n\n/**\n * The rows of a pane: the largest group of ALIKE, row-shaped siblings in it (at least two — a list of two items is a\n * list — and most of their parent's children, so neither a toolbar of wide buttons nor a pane's own header strips pass\n * for a list).\n */\nexport function shellPaneRows(pane: HTMLElement): HTMLElement[] {\n const width = pane.clientWidth;\n let best: HTMLElement[] = [];\n for (const parent of [pane, ...pane.querySelectorAll<HTMLElement>('*')]) {\n if (parent.children.length < 2 || parent.children.length <= best.length) continue;\n const shaped = [...parent.children].filter((child): child is HTMLElement => isRowShaped(child, width));\n // The rows are the largest ALIKE subset of the row-shaped children (a list's header row is not one of them). Each\n // child joins the first group whose first member it is alike to: linear in the children, not quadratic.\n const groups: HTMLElement[][] = [];\n for (const child of shaped) {\n const group = groups.find((candidate) => isAlike(candidate[0]!, child));\n if (group) group.push(child);\n else groups.push([child]);\n }\n const rows = groups.reduce<HTMLElement[]>((largest, group) => (group.length > largest.length ? group : largest), []);\n if (rows.length >= 2 && rows.length > best.length && rows.length >= parent.children.length * 0.6) best = rows;\n }\n return best;\n}\n\n/**\n * Cascades a pane's rows in, one after another. Rows present now cascade at once. For `CASCADE_WATCH_MS` afterwards\n * the pane is re-scanned after mutations — at most once per frame, in an animation-frame callback, which runs before\n * that frame is painted — and rows not yet animated join the cascade. So rows that arrive with the data (after a loading\n * skeleton, in a different container) cascade too, and a row never shows and then vanishes to start its entrance.\n * Watching the WHOLE pane, not the first list found, is deliberate: the first list is often the skeleton.\n */\nexport function cascadeShellRows(pane: HTMLElement, axis: ShellMotionAxis): () => void {\n if (axis.durationMs === 0 || typeof pane.animate !== 'function') return () => undefined;\n const animated = new WeakSet<Element>();\n let staggerIndex = 0;\n const run = (): void => {\n scan = 0;\n for (const row of shellPaneRows(pane).slice(0, CASCADE_MAX_ROWS)) {\n if (animated.has(row)) continue;\n animated.add(row);\n row.animate([{ opacity: 0, transform: 'translateY(12px) scale(0.98)' }, { opacity: 1, transform: 'none' }], {\n duration: Math.round(axis.durationMs * 0.8),\n easing: axis.easing,\n delay: Math.min(staggerIndex, CASCADE_MAX_ROWS) * CASCADE_STAGGER_MS,\n fill: 'backwards',\n });\n staggerIndex += 1;\n }\n };\n let scan = 0;\n run();\n // A new batch staggers from its own first row, not after the rows already shown.\n const watch = new MutationObserver(() => {\n if (scan) return;\n staggerIndex = 0;\n scan = requestAnimationFrame(run);\n });\n watch.observe(pane, { childList: true, subtree: true });\n const stop = setTimeout(() => { cancelAnimationFrame(scan); watch.disconnect(); }, CASCADE_WATCH_MS);\n return () => {\n clearTimeout(stop);\n cancelAnimationFrame(scan);\n watch.disconnect();\n };\n}\n\n/**\n * A modal popup grows out of the control that opened it, for an axis whose `dialogArrival` says so: when a modal content\n * slot appears open in the stage's overlay layer, a proxy flies from the pressed control to the dialog's box, and the\n * dialog is revealed on the flight's clock. Only the overlay layer is watched. A drawer is left alone: its library\n * positions it with transforms of its own.\n */\nexport function useShellDialogArrival(rootRef: RefObject<HTMLElement | null>, axis: ShellMotionAxis, origin: ShellPressOrigin): void {\n useEffect(() => {\n const layer = rootRef.current?.querySelector('[data-shell-overlay-layer]');\n const stage = rootRef.current;\n if (!stage || !layer || axis.dialogArrival !== ShellDialogArrival.FROM_PRESSED_ELEMENT || axis.durationMs === 0) return undefined;\n const seen = new WeakSet<Element>();\n const openModal = SHELL_MODAL_POPUP_SLOTS.filter((slot) => slot !== ShellPopupSlot.DRAWER)\n .map((slot) => `[data-slot=\"${slot}\"][data-state=\"open\"]`)\n .join(', ');\n const check = (): void => {\n for (const dialog of layer.querySelectorAll(openModal)) {\n if (seen.has(dialog)) continue;\n seen.add(dialog);\n const from = origin.takeControl(SHELL_PRESS_ORIGIN_MAX_AGE_MS);\n if (from) void flyShellProxy(stage, from, toBox(dialog.getBoundingClientRect()), axis, dialog);\n }\n };\n const observer = new MutationObserver(check);\n observer.observe(layer, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-state'] });\n return () => observer.disconnect();\n }, [rootRef, axis, origin]);\n}\n"]}
|
|
@@ -139,6 +139,21 @@ export declare const SHELL_OBJECT_ATTRIBUTE = "data-shell-object";
|
|
|
139
139
|
export declare const SHELL_GHOST_LAYER_ATTRIBUTE = "data-shell-ghost-layer";
|
|
140
140
|
/** The attribute every ghost carries, with its kind (`ShellGhostKind`). */
|
|
141
141
|
export declare const SHELL_GHOST_ATTRIBUTE = "data-shell-ghost";
|
|
142
|
+
/**
|
|
143
|
+
* The markers a still picture of an engine element must NOT carry: everything a query for the real element, or for a
|
|
144
|
+
* control inside it, finds it by. A picture (a discarded pane leaving, an image behind an expanded pane, a pressed row
|
|
145
|
+
* flying into its pane) is inert and takes no pointer, but it is still in the document while it fades, and a picture
|
|
146
|
+
* that kept these was found by those queries as though it were the thing it shows.
|
|
147
|
+
*
|
|
148
|
+
* Measured 2026-11-14 on Wonder Todos (morph layout): a closed todo pane's picture kept `data-navigation-back` for the
|
|
149
|
+
* ~650ms it took to leave, so a lookup of the pane's back control found the picture's (#3764 had to wait it out in
|
|
150
|
+
* `browser-nav-zones`). It never took a click (inert, `pointer-events: none`: the point under it hit the list), but
|
|
151
|
+
* the zone's own back control is identified by that attribute, and a picture must not answer to it.
|
|
152
|
+
*
|
|
153
|
+
* Styling hooks (`data-slot`, `data-state`) are NOT here: a picture keeps the look of what it shows. A caller that
|
|
154
|
+
* needs a narrower picture strips more on its own.
|
|
155
|
+
*/
|
|
156
|
+
export declare const SHELL_PICTURE_STRIPPED_ATTRIBUTES: readonly string[];
|
|
142
157
|
/** The two kinds of ghost. */
|
|
143
158
|
export declare enum ShellGhostKind {
|
|
144
159
|
/** A dismissed side pane, flying away. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-motion-vocabulary.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/shell-motion-vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGlE,sJAAsJ;AACtJ;;;;;;;;;GASG;AAEH,+DAA+D;AAC/D,oBAAY,gBAAgB;IAC1B,kEAAkE;IAClE,QAAQ,aAAa;IACrB,yEAAyE;IACzE,OAAO,YAAY;CACpB;AAED,mFAAmF;AACnF,oBAAY,cAAc;IACxB,wGAAwG;IACxG,IAAI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B;IAC7C,OAAO,oBAAoB;IAC3B,UAAU,uBAAuB;IACjC,OAAO,oBAAoB;IAC3B,MAAM,mBAAmB;IACzB,OAAO,oBAAoB;IAC3B,WAAW,wBAAwB;IACnC,MAAM,mBAAmB;IACzB,YAAY,yBAAyB;IACrC,KAAK,kBAAkB;IACvB,MAAM,mBAAmB;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAW1F,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,yBAAyB,EAAE,SAAS,cAAc,EAAyD,CAAC;AAEzH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,cAAc,EAAsG,CAAC;AAEpK,0HAA0H;AAC1H,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAA6C,CAAC;AAEnG;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AACD,2EAA2E"}
|
|
1
|
+
{"version":3,"file":"shell-motion-vocabulary.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/shell-motion-vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGlE,sJAAsJ;AACtJ;;;;;;;;;GASG;AAEH,+DAA+D;AAC/D,oBAAY,gBAAgB;IAC1B,kEAAkE;IAClE,QAAQ,aAAa;IACrB,yEAAyE;IACzE,OAAO,YAAY;CACpB;AAED,mFAAmF;AACnF,oBAAY,cAAc;IACxB,wGAAwG;IACxG,IAAI,SAAS;IACb,6FAA6F;IAC7F,MAAM,WAAW;IACjB,yDAAyD;IACzD,SAAS,cAAc;CACxB;AAED,8DAA8D;AAC9D,oBAAY,cAAc;IACxB,6EAA6E;IAC7E,SAAS,cAAc;IACvB,+FAA+F;IAC/F,aAAa,kBAAkB;CAChC;AAED,6CAA6C;AAC7C,oBAAY,gB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,MAAM,mBAAmB;IACzB,YAAY,yBAAyB;IACrC,KAAK,kBAAkB;IACvB,MAAM,mBAAmB;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAW1F,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,yBAAyB,EAAE,SAAS,cAAc,EAAyD,CAAC;AAEzH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,cAAc,EAAsG,CAAC;AAEpK,0HAA0H;AAC1H,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAA6C,CAAC;AAEnG;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AACD,2EAA2E"}
|
|
@@ -88,6 +88,35 @@ export const SHELL_OBJECT_ATTRIBUTE = 'data-shell-object';
|
|
|
88
88
|
export const SHELL_GHOST_LAYER_ATTRIBUTE = 'data-shell-ghost-layer';
|
|
89
89
|
/** The attribute every ghost carries, with its kind (`ShellGhostKind`). */
|
|
90
90
|
export const SHELL_GHOST_ATTRIBUTE = 'data-shell-ghost';
|
|
91
|
+
/**
|
|
92
|
+
* The markers a still picture of an engine element must NOT carry: everything a query for the real element, or for a
|
|
93
|
+
* control inside it, finds it by. A picture (a discarded pane leaving, an image behind an expanded pane, a pressed row
|
|
94
|
+
* flying into its pane) is inert and takes no pointer, but it is still in the document while it fades, and a picture
|
|
95
|
+
* that kept these was found by those queries as though it were the thing it shows.
|
|
96
|
+
*
|
|
97
|
+
* Measured 2026-11-14 on Wonder Todos (morph layout): a closed todo pane's picture kept `data-navigation-back` for the
|
|
98
|
+
* ~650ms it took to leave, so a lookup of the pane's back control found the picture's (#3764 had to wait it out in
|
|
99
|
+
* `browser-nav-zones`). It never took a click (inert, `pointer-events: none`: the point under it hit the list), but
|
|
100
|
+
* the zone's own back control is identified by that attribute, and a picture must not answer to it.
|
|
101
|
+
*
|
|
102
|
+
* Styling hooks (`data-slot`, `data-state`) are NOT here: a picture keeps the look of what it shows. A caller that
|
|
103
|
+
* needs a narrower picture strips more on its own.
|
|
104
|
+
*/
|
|
105
|
+
export const SHELL_PICTURE_STRIPPED_ATTRIBUTES = [
|
|
106
|
+
'id',
|
|
107
|
+
// The engine's pane and region markers.
|
|
108
|
+
'data-content-area',
|
|
109
|
+
'data-panel-id',
|
|
110
|
+
'data-zone-hidden',
|
|
111
|
+
'data-zone-emphasized',
|
|
112
|
+
'data-component-area',
|
|
113
|
+
SHELL_OBJECT_ATTRIBUTE,
|
|
114
|
+
// The engine's control hooks: a zone's back control, an operation's trigger, a navigation item, a rail entry.
|
|
115
|
+
'data-navigation-back',
|
|
116
|
+
'data-operation-id',
|
|
117
|
+
'data-nav-item-id',
|
|
118
|
+
'data-ref',
|
|
119
|
+
];
|
|
91
120
|
/** The two kinds of ghost. */
|
|
92
121
|
export var ShellGhostKind;
|
|
93
122
|
(function (ShellGhostKind) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-motion-vocabulary.js","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/shell-motion-vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,sJAAsJ;AACtJ;;;;;;;;;GASG;AAEH,+DAA+D;AAC/D,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,kEAAkE;IAClE,yCAAqB,CAAA;IACrB,yEAAyE;IACzE,uCAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAED,mFAAmF;AACnF,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,wGAAwG;IACxG,+BAAa,CAAA;IACb,6FAA6F;IAC7F,mCAAiB,CAAA;IACjB,yDAAyD;IACzD,y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AAc,CAAC,MAAM,EAAE,cAAc,CAAC,YAAY,EAAE,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;AAEpK,0HAA0H;AAC1H,MAAM,CAAC,MAAM,uBAAuB,GAAsB,CAAC,MAAM,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;AAEnG;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,uCAAuC,uBAAuB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC;AACjJ,CAAC;AACD,2EAA2E","sourcesContent":["import { ShellRegion } from '@wildo-ai/presets-components-models';\nimport { NavigationZoneName } from '@wildo-ai/saas-models';\n\n/** @wildo_source:part:start saas.frontend.app-shell.shell-motion-contract facet:layer:frontend facet:family:app-shell facet:audience:app-developer */\n/**\n * The motion building blocks a layout composes (#2052). They are the MECHANICS every animated layout needs — which\n * pane is in front, which zone just opened or changed place, the picture a dismissed or hidden pane leaves behind, the\n * dip a pane or a column makes while it changes — and none of them knows which way things move. That is the axis's\n * (`ShellMotionAxis`): a depth axis moves along z (the focal-plane 3D layout), a flat axis slides, scales and fades.\n *\n * Nothing here writes on a region the engine renders. Ghosts are pictures in the layout's own layers, dips play\n * through the Web Animations API (nothing is left on the element when they finish), and objects are the layout's own\n * wrappers plus the navigation panes found by the engine's markers.\n */\n\n/** How a navigation zone's place moved between two renders. */\nexport enum ShellPlaceChange {\n /** The zone held nothing and now holds a place: a pane opened. */\n APPEARED = 'appeared',\n /** The zone showed one place and now shows another, in the same pane. */\n CHANGED = 'changed',\n}\n\n/** Where a ghost — the picture of a pane that was dismissed or hidden — stands. */\nexport enum ShellGhostPose {\n /** Where the pane stood: a ghost starts here, and a picture left behind returns here before it goes. */\n REST = 'rest',\n /** Stepped back behind an expanded pane, dimmed: the picture of a pane the expansion hid. */\n BEHIND = 'behind',\n /** Gone: where a dismissed pane flies to as it fades. */\n DISCARDED = 'discarded',\n}\n\n/** What a dip — a brief move away and back — acknowledges. */\nexport enum ShellMotionDip {\n /** A pane's content changed in place (the same zone shows another place). */\n PANE_SWAP = 'pane-swap',\n /** A side column (the sidebar or a utility panel) changed width, and the panes re-arranged. */\n COLUMN_RESIZE = 'column-resize',\n}\n\n/** How a side pane arrives when it opens. */\nexport enum ShellPaneArrival {\n /** The layout's stylesheet animates the pane as it mounts (a keyframe on the pane). */\n STYLESHEET = 'stylesheet',\n /**\n * The pane GROWS OUT OF the element that was pressed to open it: a proxy box flies from the pressed row to the\n * pane's box, and the core reveals the pane on the flight's own clock (hidden for `SHELL_PROXY_FLIGHT_SHARE` of the\n * motion, then faded in). A layout's stylesheet MAY also hold the arriving pane for that share — only as the fallback\n * when there is nothing to fly from (a pane opened by URL), where the pane then simply appears when the hold ends.\n * An axis may ask the browser to carry it out instead, as a view transition (`paneArrivalByViewTransition`).\n */\n FROM_PRESSED_ELEMENT = 'from-pressed-element',\n}\n\n/** How a pane changes size when it is emphasized (takes the width) or given back its place. */\nexport enum ShellPaneResize {\n /** At once, as the engine lays it out. */\n INSTANT = 'instant',\n /** The emphasized pane grows from the box it had to the width it takes; given back its place, it slides home. */\n GROW = 'grow',\n}\n\n/** How a modal popup (a dialog, a sheet) arrives. */\nexport enum ShellDialogArrival {\n /** The layout's stylesheet animates it (a keyframe on its content slot). */\n STYLESHEET = 'stylesheet',\n /**\n * It GROWS OUT OF its trigger: a proxy flies from the pressed control to the dialog's box, and the core reveals the\n * dialog on the flight's own clock. A stylesheet hold is optional, the fallback when no control was pressed.\n */\n FROM_PRESSED_ELEMENT = 'from-pressed-element',\n}\n\n/**\n * The share of the motion a proxy flies before the element it stands for appears (the rest of the motion reveals\n * it). The core reveals the arriving element on the SAME clock as the flight (a script animation that sits above any\n * stylesheet animation), so the two can never drift apart; a layout's stylesheet may also hold the element for this\n * share, as the fallback when there is nothing to fly from (a pane opened by URL).\n */\nexport const SHELL_PROXY_FLIGHT_SHARE = 0.55;\n\n/** The attribute on a proxy the core flies. A layout may restyle it (the core paints it from theme tokens inline). */\nexport const SHELL_PROXY_ATTRIBUTE = 'data-shell-proxy';\n\n/** An element's laid-out box in the stage (untransformed), as last measured. */\nexport interface ShellStageRect {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\n/**\n * Which way a layout moves things. The building blocks decide WHEN something moves and WHAT; the axis decides only\n * the pose it moves to. A layout builds one from its settings and memoizes it: the hooks re-arm when it changes.\n */\nexport interface ShellMotionAxis {\n /** How long every motion lasts, in milliseconds. `0` turns the motion building blocks off (reduced motion). */\n durationMs: number;\n /** The timing function of the dips (a CSS easing). */\n easing: string;\n /**\n * Whether a pane an expansion hides leaves a still picture of itself behind the expanded pane. Only an axis whose\n * panes are SEEN THROUGH should say yes (the focal plane's glass windows). Where panes paint nothing of their own\n * — a 2D shell under a CONTINUOUS theme — the picture shows through the expanded pane and its text overlaps the\n * expanded pane's text (measured on the glide layout, 2026-09-30).\n */\n drawsHiddenPanePicture: boolean;\n /** How a side pane arrives (`ShellPaneArrival`). */\n paneArrival: ShellPaneArrival;\n /**\n * With `FROM_PRESSED_ELEMENT`: carry the arrival out as a browser VIEW TRANSITION where the browser has one\n * (`document.startViewTransition`) — the navigation's commit runs inside it, and the browser morphs the pressed row\n * into the pane from pictures of the screen before and after. Where it has none, or nothing was pressed, the proxy\n * flies as usual, so the arrival never depends on it. Absent means no. Evaluated on #2055.\n */\n paneArrivalByViewTransition?: boolean;\n /** How an emphasized pane changes size (`ShellPaneResize`). */\n paneResize: ShellPaneResize;\n /** How a modal popup arrives (`ShellDialogArrival`). */\n dialogArrival: ShellDialogArrival;\n /**\n * Whether the rows of a pane cascade in when the pane opens or shows another place. Rows are recognised by shape\n * (the largest group of wide, row-high siblings in the pane), so it holds for tables, card lists and custom rows.\n */\n cascadesRows: boolean;\n /**\n * The style properties a ghost takes at a pose — standard or custom properties, kebab-case (`transform`,\n * `--fp-z`). Opacity is not the axis's: a ghost always fades as it goes and appears as it steps back. The layout's\n * stylesheet transitions these properties on `[data-shell-ghost]`.\n */\n ghostPose(pose: ShellGhostPose, placement: { rect: ShellStageRect; stage: HTMLElement }): Readonly<Record<string, string>>;\n /**\n * The peak keyframe of a dip. The first and last keyframes are implicit: the element leaves and returns to its rest.\n * `stage` is the layout's stage, for a dip that travels sideways and must mirror right to left.\n */\n dipPeak(dip: ShellMotionDip, placement: { stage: HTMLElement }): Keyframe;\n}\n\n/**\n * The attribute a layout container puts on each wrapper it draws a region in. Wrappers are the layout's own\n * elements, so they may be moved; the region inside keeps the engine's markup untouched.\n */\nexport const SHELL_OBJECT_ATTRIBUTE = 'data-shell-object';\n/** The attribute of the layout's two ghost layers: `back` (under the regions) and `front` (above them). */\nexport const SHELL_GHOST_LAYER_ATTRIBUTE = 'data-shell-ghost-layer';\n/** The attribute every ghost carries, with its kind (`ShellGhostKind`). */\nexport const SHELL_GHOST_ATTRIBUTE = 'data-shell-ghost';\n\n/** The two kinds of ghost. */\nexport enum ShellGhostKind {\n /** A dismissed side pane, flying away. */\n DISCARDED = 'discarded',\n /** A still image of a pane an expansion hid. */\n BEHIND = 'behind',\n}\n\n/** The two ghost layers. */\nexport enum ShellGhostLayer {\n BACK = 'back',\n FRONT = 'front',\n}\n\n/**\n * The selector of one shell region, by the marker its preset writes (`data-component-area`, from `ShellRegion`). The\n * one place a layout spells it, so a region is always found by the enum and never by a literal.\n */\nexport function shellRegionSelector(region: ShellRegion): string {\n return `[data-component-area=\"${region}\"]`;\n}\n\nconst CONTENT = shellRegionSelector(ShellRegion.CONTENT);\n\n/**\n * The navigation panes inside the content region, by the engine's own markers: the zone itself in the static and\n * single-zone branches (`[data-content-area]`), the panel in the resizable branch (`[data-panel-id^=\"nav-\"]`) — never\n * the zone INSIDE a panel, which would be moved twice and clipped by the panel's `overflow: hidden`.\n */\nexport const SHELL_PANE_SELECTOR = `${CONTENT} [data-content-area]:not([data-panel-id] *), ${CONTENT} [data-panel-id^=\"nav-\"]`;\n\n/** The pane of one zone, in either branch (a plain selector list: `:not()` nested in `:is()` is beyond some engines). */\nexport function shellPaneSelectorForZone(zone: string): string {\n return `${CONTENT} [data-content-area=\"${zone}\"]:not([data-panel-id] *), ${CONTENT} [data-panel-id=\"nav-${zone}\"]`;\n}\n\n/** The zone a pane element shows, read from the engine's markers; `undefined` for anything else. */\nexport function shellPaneZone(element: Element): string | undefined {\n if (!(element instanceof HTMLElement)) return undefined;\n return element.dataset.contentArea ?? element.dataset.panelId?.replace(/^nav-/, '');\n}\n\nconst SIDE_ZONES: ReadonlySet<string> = new Set([NavigationZoneName.SECONDARY, NavigationZoneName.COMPANION]);\n\n/** Whether a pane shows a SIDE zone — the only kind a person dismisses (the primary pane leaves only on a remount). */\nexport function isShellSidePane(element: Element): boolean {\n const zone = shellPaneZone(element);\n return zone !== undefined && SIDE_ZONES.has(zone);\n}\n\n/** Whether a zone is a SIDE zone (secondary, companion): the panes that open beside the list. */\nexport function isShellSideZone(zone: string): boolean {\n return SIDE_ZONES.has(zone);\n}\n\n/**\n * The portalled popups a layout may move, by the `data-slot` their content element carries (the presets write these\n * values; Radix writes `data-state` on the same element). A closed list: a layout keys its popup motion on it, never\n * on a role or a class.\n */\nexport enum ShellPopupSlot {\n DROPDOWN_MENU = 'dropdown-menu-content',\n DROPDOWN_MENU_SUB = 'dropdown-menu-sub-content',\n CONTEXT_MENU = 'context-menu-content',\n CONTEXT_MENU_SUB = 'context-menu-sub-content',\n POPOVER = 'popover-content',\n HOVER_CARD = 'hover-card-content',\n TOOLTIP = 'tooltip-content',\n SELECT = 'select-content',\n MENUBAR = 'menubar-content',\n MENUBAR_SUB = 'menubar-sub-content',\n DIALOG = 'dialog-content',\n ALERT_DIALOG = 'alert-dialog-content',\n SHEET = 'sheet-content',\n DRAWER = 'drawer-content',\n}\n\n/**\n * The popups anchored to a trigger, each with the CSS variable Radix publishes as its trigger-relative origin: the\n * point a layout lifts or scales such a popup from.\n */\nexport const SHELL_ANCHORED_POPUP_ORIGINS: Readonly<Partial<Record<ShellPopupSlot, string>>> = {\n [ShellPopupSlot.DROPDOWN_MENU]: '--radix-dropdown-menu-content-transform-origin',\n [ShellPopupSlot.DROPDOWN_MENU_SUB]: '--radix-dropdown-menu-content-transform-origin',\n [ShellPopupSlot.CONTEXT_MENU]: '--radix-context-menu-content-transform-origin',\n [ShellPopupSlot.CONTEXT_MENU_SUB]: '--radix-context-menu-content-transform-origin',\n [ShellPopupSlot.POPOVER]: '--radix-popover-content-transform-origin',\n [ShellPopupSlot.HOVER_CARD]: '--radix-hover-card-content-transform-origin',\n [ShellPopupSlot.TOOLTIP]: '--radix-tooltip-content-transform-origin',\n [ShellPopupSlot.SELECT]: '--radix-select-content-transform-origin',\n [ShellPopupSlot.MENUBAR]: '--radix-menubar-content-transform-origin',\n [ShellPopupSlot.MENUBAR_SUB]: '--radix-menubar-content-transform-origin',\n};\n\n/** The centred dialogs: no trigger origin, they open over the whole shell. */\nexport const SHELL_CENTRED_POPUP_SLOTS: readonly ShellPopupSlot[] = [ShellPopupSlot.DIALOG, ShellPopupSlot.ALERT_DIALOG];\n\n/**\n * The MODAL popups: while one is open the rest of the shell is not what the person works in. Keyed on the content\n * slot, deliberately never on `role=\"dialog\"` — a Radix popover carries that role too (date pickers, record pickers,\n * the notification centre), and treating it as modal steps back the form being edited — nor on\n * `body[data-scroll-locked]`, which dropdown and context menus also set.\n */\nexport const SHELL_MODAL_POPUP_SLOTS: readonly ShellPopupSlot[] = [ShellPopupSlot.DIALOG, ShellPopupSlot.ALERT_DIALOG, ShellPopupSlot.SHEET, ShellPopupSlot.DRAWER];\n\n/** The `data-state` values of an OPEN popup. A tooltip is never `open`: Radix writes `delayed-open` or `instant-open`. */\nexport const SHELL_POPUP_OPEN_STATES: readonly string[] = ['open', 'delayed-open', 'instant-open'];\n\n/**\n * A `:has()` clause that matches a layout root while a modal popup is open in its overlay layer\n * (`AppShellOverlayPortalLayer`, `[data-shell-overlay-layer]`). Append it to the root selector:\n * `[data-my-layout]${shellModalOpenClause()} [data-shell-object] { … }`.\n */\nexport function shellModalOpenClause(): string {\n return `:has([data-shell-overlay-layer] :is(${SHELL_MODAL_POPUP_SLOTS.map((slot) => `[data-slot=\"${slot}\"]`).join(', ')})[data-state=\"open\"])`;\n}\n/** @wildo_source:part:end saas.frontend.app-shell.shell-motion-contract */\n"]}
|
|
1
|
+
{"version":3,"file":"shell-motion-vocabulary.js","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/shell-motion-vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,sJAAsJ;AACtJ;;;;;;;;;GASG;AAEH,+DAA+D;AAC/D,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,kEAAkE;IAClE,yCAAqB,CAAA;IACrB,yEAAyE;IACzE,uCAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAED,mFAAmF;AACnF,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,wGAAwG;IACxG,+BAAa,CAAA;IACb,6FAA6F;IAC7F,mCAAiB,CAAA;IACjB,yDAAyD;IACzD,yCAAuB,CAAA;AACzB,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB;AAED,8DAA8D;AAC9D,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,6EAA6E;IAC7E,yCAAuB,CAAA;IACvB,+FAA+F;IAC/F,iDAA+B,CAAA;AACjC,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAED,6CAA6C;AAC7C,MAAM,CAAN,IAAY,gBAWX;AAXD,WAAY,gBAAgB;IAC1B,uFAAuF;IACvF,6CAAyB,CAAA;IACzB;;;;;;OAMG;IACH,iEAA6C,CAAA;AAC/C,CAAC,EAXW,gBAAgB,KAAhB,gBAAgB,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AAC,MAAM,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;AAEnG;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,uCAAuC,uBAAuB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC;AACjJ,CAAC;AACD,2EAA2E","sourcesContent":["import { ShellRegion } from '@wildo-ai/presets-components-models';\nimport { NavigationZoneName } from '@wildo-ai/saas-models';\n\n/** @wildo_source:part:start saas.frontend.app-shell.shell-motion-contract facet:layer:frontend facet:family:app-shell facet:audience:app-developer */\n/**\n * The motion building blocks a layout composes (#2052). They are the MECHANICS every animated layout needs — which\n * pane is in front, which zone just opened or changed place, the picture a dismissed or hidden pane leaves behind, the\n * dip a pane or a column makes while it changes — and none of them knows which way things move. That is the axis's\n * (`ShellMotionAxis`): a depth axis moves along z (the focal-plane 3D layout), a flat axis slides, scales and fades.\n *\n * Nothing here writes on a region the engine renders. Ghosts are pictures in the layout's own layers, dips play\n * through the Web Animations API (nothing is left on the element when they finish), and objects are the layout's own\n * wrappers plus the navigation panes found by the engine's markers.\n */\n\n/** How a navigation zone's place moved between two renders. */\nexport enum ShellPlaceChange {\n /** The zone held nothing and now holds a place: a pane opened. */\n APPEARED = 'appeared',\n /** The zone showed one place and now shows another, in the same pane. */\n CHANGED = 'changed',\n}\n\n/** Where a ghost — the picture of a pane that was dismissed or hidden — stands. */\nexport enum ShellGhostPose {\n /** Where the pane stood: a ghost starts here, and a picture left behind returns here before it goes. */\n REST = 'rest',\n /** Stepped back behind an expanded pane, dimmed: the picture of a pane the expansion hid. */\n BEHIND = 'behind',\n /** Gone: where a dismissed pane flies to as it fades. */\n DISCARDED = 'discarded',\n}\n\n/** What a dip — a brief move away and back — acknowledges. */\nexport enum ShellMotionDip {\n /** A pane's content changed in place (the same zone shows another place). */\n PANE_SWAP = 'pane-swap',\n /** A side column (the sidebar or a utility panel) changed width, and the panes re-arranged. */\n COLUMN_RESIZE = 'column-resize',\n}\n\n/** How a side pane arrives when it opens. */\nexport enum ShellPaneArrival {\n /** The layout's stylesheet animates the pane as it mounts (a keyframe on the pane). */\n STYLESHEET = 'stylesheet',\n /**\n * The pane GROWS OUT OF the element that was pressed to open it: a proxy box flies from the pressed row to the\n * pane's box, and the core reveals the pane on the flight's own clock (hidden for `SHELL_PROXY_FLIGHT_SHARE` of the\n * motion, then faded in). A layout's stylesheet MAY also hold the arriving pane for that share — only as the fallback\n * when there is nothing to fly from (a pane opened by URL), where the pane then simply appears when the hold ends.\n * An axis may ask the browser to carry it out instead, as a view transition (`paneArrivalByViewTransition`).\n */\n FROM_PRESSED_ELEMENT = 'from-pressed-element',\n}\n\n/** How a pane changes size when it is emphasized (takes the width) or given back its place. */\nexport enum ShellPaneResize {\n /** At once, as the engine lays it out. */\n INSTANT = 'instant',\n /** The emphasized pane grows from the box it had to the width it takes; given back its place, it slides home. */\n GROW = 'grow',\n}\n\n/** How a modal popup (a dialog, a sheet) arrives. */\nexport enum ShellDialogArrival {\n /** The layout's stylesheet animates it (a keyframe on its content slot). */\n STYLESHEET = 'stylesheet',\n /**\n * It GROWS OUT OF its trigger: a proxy flies from the pressed control to the dialog's box, and the core reveals the\n * dialog on the flight's own clock. A stylesheet hold is optional, the fallback when no control was pressed.\n */\n FROM_PRESSED_ELEMENT = 'from-pressed-element',\n}\n\n/**\n * The share of the motion a proxy flies before the element it stands for appears (the rest of the motion reveals\n * it). The core reveals the arriving element on the SAME clock as the flight (a script animation that sits above any\n * stylesheet animation), so the two can never drift apart; a layout's stylesheet may also hold the element for this\n * share, as the fallback when there is nothing to fly from (a pane opened by URL).\n */\nexport const SHELL_PROXY_FLIGHT_SHARE = 0.55;\n\n/** The attribute on a proxy the core flies. A layout may restyle it (the core paints it from theme tokens inline). */\nexport const SHELL_PROXY_ATTRIBUTE = 'data-shell-proxy';\n\n/** An element's laid-out box in the stage (untransformed), as last measured. */\nexport interface ShellStageRect {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\n/**\n * Which way a layout moves things. The building blocks decide WHEN something moves and WHAT; the axis decides only\n * the pose it moves to. A layout builds one from its settings and memoizes it: the hooks re-arm when it changes.\n */\nexport interface ShellMotionAxis {\n /** How long every motion lasts, in milliseconds. `0` turns the motion building blocks off (reduced motion). */\n durationMs: number;\n /** The timing function of the dips (a CSS easing). */\n easing: string;\n /**\n * Whether a pane an expansion hides leaves a still picture of itself behind the expanded pane. Only an axis whose\n * panes are SEEN THROUGH should say yes (the focal plane's glass windows). Where panes paint nothing of their own\n * — a 2D shell under a CONTINUOUS theme — the picture shows through the expanded pane and its text overlaps the\n * expanded pane's text (measured on the glide layout, 2026-09-30).\n */\n drawsHiddenPanePicture: boolean;\n /** How a side pane arrives (`ShellPaneArrival`). */\n paneArrival: ShellPaneArrival;\n /**\n * With `FROM_PRESSED_ELEMENT`: carry the arrival out as a browser VIEW TRANSITION where the browser has one\n * (`document.startViewTransition`) — the navigation's commit runs inside it, and the browser morphs the pressed row\n * into the pane from pictures of the screen before and after. Where it has none, or nothing was pressed, the proxy\n * flies as usual, so the arrival never depends on it. Absent means no. Evaluated on #2055.\n */\n paneArrivalByViewTransition?: boolean;\n /** How an emphasized pane changes size (`ShellPaneResize`). */\n paneResize: ShellPaneResize;\n /** How a modal popup arrives (`ShellDialogArrival`). */\n dialogArrival: ShellDialogArrival;\n /**\n * Whether the rows of a pane cascade in when the pane opens or shows another place. Rows are recognised by shape\n * (the largest group of wide, row-high siblings in the pane), so it holds for tables, card lists and custom rows.\n */\n cascadesRows: boolean;\n /**\n * The style properties a ghost takes at a pose — standard or custom properties, kebab-case (`transform`,\n * `--fp-z`). Opacity is not the axis's: a ghost always fades as it goes and appears as it steps back. The layout's\n * stylesheet transitions these properties on `[data-shell-ghost]`.\n */\n ghostPose(pose: ShellGhostPose, placement: { rect: ShellStageRect; stage: HTMLElement }): Readonly<Record<string, string>>;\n /**\n * The peak keyframe of a dip. The first and last keyframes are implicit: the element leaves and returns to its rest.\n * `stage` is the layout's stage, for a dip that travels sideways and must mirror right to left.\n */\n dipPeak(dip: ShellMotionDip, placement: { stage: HTMLElement }): Keyframe;\n}\n\n/**\n * The attribute a layout container puts on each wrapper it draws a region in. Wrappers are the layout's own\n * elements, so they may be moved; the region inside keeps the engine's markup untouched.\n */\nexport const SHELL_OBJECT_ATTRIBUTE = 'data-shell-object';\n/** The attribute of the layout's two ghost layers: `back` (under the regions) and `front` (above them). */\nexport const SHELL_GHOST_LAYER_ATTRIBUTE = 'data-shell-ghost-layer';\n/** The attribute every ghost carries, with its kind (`ShellGhostKind`). */\nexport const SHELL_GHOST_ATTRIBUTE = 'data-shell-ghost';\n\n/**\n * The markers a still picture of an engine element must NOT carry: everything a query for the real element, or for a\n * control inside it, finds it by. A picture (a discarded pane leaving, an image behind an expanded pane, a pressed row\n * flying into its pane) is inert and takes no pointer, but it is still in the document while it fades, and a picture\n * that kept these was found by those queries as though it were the thing it shows.\n *\n * Measured 2026-11-14 on Wonder Todos (morph layout): a closed todo pane's picture kept `data-navigation-back` for the\n * ~650ms it took to leave, so a lookup of the pane's back control found the picture's (#3764 had to wait it out in\n * `browser-nav-zones`). It never took a click (inert, `pointer-events: none`: the point under it hit the list), but\n * the zone's own back control is identified by that attribute, and a picture must not answer to it.\n *\n * Styling hooks (`data-slot`, `data-state`) are NOT here: a picture keeps the look of what it shows. A caller that\n * needs a narrower picture strips more on its own.\n */\nexport const SHELL_PICTURE_STRIPPED_ATTRIBUTES: readonly string[] = [\n 'id',\n // The engine's pane and region markers.\n 'data-content-area',\n 'data-panel-id',\n 'data-zone-hidden',\n 'data-zone-emphasized',\n 'data-component-area',\n SHELL_OBJECT_ATTRIBUTE,\n // The engine's control hooks: a zone's back control, an operation's trigger, a navigation item, a rail entry.\n 'data-navigation-back',\n 'data-operation-id',\n 'data-nav-item-id',\n 'data-ref',\n];\n\n/** The two kinds of ghost. */\nexport enum ShellGhostKind {\n /** A dismissed side pane, flying away. */\n DISCARDED = 'discarded',\n /** A still image of a pane an expansion hid. */\n BEHIND = 'behind',\n}\n\n/** The two ghost layers. */\nexport enum ShellGhostLayer {\n BACK = 'back',\n FRONT = 'front',\n}\n\n/**\n * The selector of one shell region, by the marker its preset writes (`data-component-area`, from `ShellRegion`). The\n * one place a layout spells it, so a region is always found by the enum and never by a literal.\n */\nexport function shellRegionSelector(region: ShellRegion): string {\n return `[data-component-area=\"${region}\"]`;\n}\n\nconst CONTENT = shellRegionSelector(ShellRegion.CONTENT);\n\n/**\n * The navigation panes inside the content region, by the engine's own markers: the zone itself in the static and\n * single-zone branches (`[data-content-area]`), the panel in the resizable branch (`[data-panel-id^=\"nav-\"]`) — never\n * the zone INSIDE a panel, which would be moved twice and clipped by the panel's `overflow: hidden`.\n */\nexport const SHELL_PANE_SELECTOR = `${CONTENT} [data-content-area]:not([data-panel-id] *), ${CONTENT} [data-panel-id^=\"nav-\"]`;\n\n/** The pane of one zone, in either branch (a plain selector list: `:not()` nested in `:is()` is beyond some engines). */\nexport function shellPaneSelectorForZone(zone: string): string {\n return `${CONTENT} [data-content-area=\"${zone}\"]:not([data-panel-id] *), ${CONTENT} [data-panel-id=\"nav-${zone}\"]`;\n}\n\n/** The zone a pane element shows, read from the engine's markers; `undefined` for anything else. */\nexport function shellPaneZone(element: Element): string | undefined {\n if (!(element instanceof HTMLElement)) return undefined;\n return element.dataset.contentArea ?? element.dataset.panelId?.replace(/^nav-/, '');\n}\n\nconst SIDE_ZONES: ReadonlySet<string> = new Set([NavigationZoneName.SECONDARY, NavigationZoneName.COMPANION]);\n\n/** Whether a pane shows a SIDE zone — the only kind a person dismisses (the primary pane leaves only on a remount). */\nexport function isShellSidePane(element: Element): boolean {\n const zone = shellPaneZone(element);\n return zone !== undefined && SIDE_ZONES.has(zone);\n}\n\n/** Whether a zone is a SIDE zone (secondary, companion): the panes that open beside the list. */\nexport function isShellSideZone(zone: string): boolean {\n return SIDE_ZONES.has(zone);\n}\n\n/**\n * The portalled popups a layout may move, by the `data-slot` their content element carries (the presets write these\n * values; Radix writes `data-state` on the same element). A closed list: a layout keys its popup motion on it, never\n * on a role or a class.\n */\nexport enum ShellPopupSlot {\n DROPDOWN_MENU = 'dropdown-menu-content',\n DROPDOWN_MENU_SUB = 'dropdown-menu-sub-content',\n CONTEXT_MENU = 'context-menu-content',\n CONTEXT_MENU_SUB = 'context-menu-sub-content',\n POPOVER = 'popover-content',\n HOVER_CARD = 'hover-card-content',\n TOOLTIP = 'tooltip-content',\n SELECT = 'select-content',\n MENUBAR = 'menubar-content',\n MENUBAR_SUB = 'menubar-sub-content',\n DIALOG = 'dialog-content',\n ALERT_DIALOG = 'alert-dialog-content',\n SHEET = 'sheet-content',\n DRAWER = 'drawer-content',\n}\n\n/**\n * The popups anchored to a trigger, each with the CSS variable Radix publishes as its trigger-relative origin: the\n * point a layout lifts or scales such a popup from.\n */\nexport const SHELL_ANCHORED_POPUP_ORIGINS: Readonly<Partial<Record<ShellPopupSlot, string>>> = {\n [ShellPopupSlot.DROPDOWN_MENU]: '--radix-dropdown-menu-content-transform-origin',\n [ShellPopupSlot.DROPDOWN_MENU_SUB]: '--radix-dropdown-menu-content-transform-origin',\n [ShellPopupSlot.CONTEXT_MENU]: '--radix-context-menu-content-transform-origin',\n [ShellPopupSlot.CONTEXT_MENU_SUB]: '--radix-context-menu-content-transform-origin',\n [ShellPopupSlot.POPOVER]: '--radix-popover-content-transform-origin',\n [ShellPopupSlot.HOVER_CARD]: '--radix-hover-card-content-transform-origin',\n [ShellPopupSlot.TOOLTIP]: '--radix-tooltip-content-transform-origin',\n [ShellPopupSlot.SELECT]: '--radix-select-content-transform-origin',\n [ShellPopupSlot.MENUBAR]: '--radix-menubar-content-transform-origin',\n [ShellPopupSlot.MENUBAR_SUB]: '--radix-menubar-content-transform-origin',\n};\n\n/** The centred dialogs: no trigger origin, they open over the whole shell. */\nexport const SHELL_CENTRED_POPUP_SLOTS: readonly ShellPopupSlot[] = [ShellPopupSlot.DIALOG, ShellPopupSlot.ALERT_DIALOG];\n\n/**\n * The MODAL popups: while one is open the rest of the shell is not what the person works in. Keyed on the content\n * slot, deliberately never on `role=\"dialog\"` — a Radix popover carries that role too (date pickers, record pickers,\n * the notification centre), and treating it as modal steps back the form being edited — nor on\n * `body[data-scroll-locked]`, which dropdown and context menus also set.\n */\nexport const SHELL_MODAL_POPUP_SLOTS: readonly ShellPopupSlot[] = [ShellPopupSlot.DIALOG, ShellPopupSlot.ALERT_DIALOG, ShellPopupSlot.SHEET, ShellPopupSlot.DRAWER];\n\n/** The `data-state` values of an OPEN popup. A tooltip is never `open`: Radix writes `delayed-open` or `instant-open`. */\nexport const SHELL_POPUP_OPEN_STATES: readonly string[] = ['open', 'delayed-open', 'instant-open'];\n\n/**\n * A `:has()` clause that matches a layout root while a modal popup is open in its overlay layer\n * (`AppShellOverlayPortalLayer`, `[data-shell-overlay-layer]`). Append it to the root selector:\n * `[data-my-layout]${shellModalOpenClause()} [data-shell-object] { … }`.\n */\nexport function shellModalOpenClause(): string {\n return `:has([data-shell-overlay-layer] :is(${SHELL_MODAL_POPUP_SLOTS.map((slot) => `[data-slot=\"${slot}\"]`).join(', ')})[data-state=\"open\"])`;\n}\n/** @wildo_source:part:end saas.frontend.app-shell.shell-motion-contract */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-shell-motion.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/use-shell-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"use-shell-motion.d.ts","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/use-shell-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMrF,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;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,eAAe,GAAG;IAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CA4HjI;AAKD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,eAAe,GAAG,IAAI,CAyBxG;AAED,iJAAiJ;AACjJ,wEAAwE;AACxE,MAAM,WAAW,kBAAkB;IACjC,uGAAuG;IACvG,IAAI,EAAE,eAAe,CAAC;IACtB,0FAA0F;IAC1F,UAAU,EAAE,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC;IAC9E,qHAAqH;IACrH,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9G;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAuCxJ;AACD,sEAAsE"}
|
|
@@ -2,7 +2,7 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import { ShellRegion } from '@wildo-ai/presets-components-models';
|
|
3
3
|
import { NAVIGATION_STRUCTURAL_ZONES } from '../../navigation/navigation.schemas.js';
|
|
4
4
|
import { installNavigationCommitWrapper } from '../../navigation/navigation-commit.js';
|
|
5
|
-
import { isShellSidePane, SHELL_GHOST_ATTRIBUTE, SHELL_GHOST_LAYER_ATTRIBUTE, SHELL_OBJECT_ATTRIBUTE, SHELL_PANE_SELECTOR, shellPaneSelectorForZone, shellPaneZone, shellRegionSelector, ShellGhostKind, ShellGhostLayer, ShellGhostPose, ShellDialogArrival, ShellMotionDip, ShellPaneArrival, ShellPaneResize, ShellPlaceChange, } from './shell-motion-vocabulary.js';
|
|
5
|
+
import { isShellSidePane, SHELL_GHOST_ATTRIBUTE, SHELL_GHOST_LAYER_ATTRIBUTE, SHELL_OBJECT_ATTRIBUTE, SHELL_PICTURE_STRIPPED_ATTRIBUTES, SHELL_PANE_SELECTOR, shellPaneSelectorForZone, shellPaneZone, shellRegionSelector, ShellGhostKind, ShellGhostLayer, ShellGhostPose, ShellDialogArrival, ShellMotionDip, ShellPaneArrival, ShellPaneResize, ShellPlaceChange, } from './shell-motion-vocabulary.js';
|
|
6
6
|
import { installShellLayoutStylesheet } from './shell-layout-stylesheet.js';
|
|
7
7
|
import { createShellViewTransitionCommit, SHELL_VIEW_TRANSITION_CSS, shellViewTransitionsAvailable } from './shell-view-transition.js';
|
|
8
8
|
import { cascadeShellRows, flyShellProxy, growShellPane, SHELL_PRESS_ORIGIN_MAX_AGE_MS, slideShellPaneHome, useShellDialogArrival, useShellPressOrigin } from './shell-motion-origins.js';
|
|
@@ -156,7 +156,7 @@ export function makeShellPicture(element) {
|
|
|
156
156
|
element.setAttribute('aria-hidden', 'true');
|
|
157
157
|
element.setAttribute('inert', '');
|
|
158
158
|
for (const node of [element, ...element.querySelectorAll('*')]) {
|
|
159
|
-
for (const attribute of
|
|
159
|
+
for (const attribute of SHELL_PICTURE_STRIPPED_ATTRIBUTES)
|
|
160
160
|
node.removeAttribute(attribute);
|
|
161
161
|
}
|
|
162
162
|
for (const media of element.querySelectorAll('iframe, video, audio'))
|