@wildo-ai/saas-frontend-lib 1.1.13 → 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/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/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/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/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/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/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/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
|
@@ -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;;;;;;;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;IACpE,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,yCAAyC;IAClE,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,0CAA0C;IACpE,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,0CAA0C;CACzE,CAAC;AAEF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,yBAAyB,GAA8B,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;AAEzH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA8B,CAAC,cAAc,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;A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CAAC;AAEF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,yBAAyB,GAA8B,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;AAEzH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA8B,CAAC,cAAc,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/**\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,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAiBL,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAQnC;;;;GAIG;AACH,eAAO,MAAM,eAAe,kCAAyC,CAAC;AAEtE,iHAAiH;AACjH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAYnG;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACtC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,GACnG,IAAI,CAoCN;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAoBrJ;AAED,8DAA8D;AA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AkB,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'))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-shell-motion.js","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/use-shell-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AAEpF,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACpI,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAEvL,sFAAsF;AACtF,MAAM,oBAAoB,GAAG,IAAI,sBAAsB,MAAM,mBAAmB,EAAE,CAAC;AAEnF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAA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AC,oBAAoB,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7H,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;YAC3D,IAAI,IAAI;gBAAE,KAAK,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACrF,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YAC/B,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AACnC,CAAC;AACD,sEAAsE","sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from 'react';\n\nimport { ShellRegion } from '@wildo-ai/presets-components-models';\n\nimport { NAVIGATION_STRUCTURAL_ZONES } from '../../navigation/navigation.schemas';\nimport { installNavigationCommitWrapper } from '../../navigation/navigation-commit';\nimport type { NavigationContextType } from '../../navigation/NavigationContext';\nimport {\n isShellSidePane,\n SHELL_GHOST_ATTRIBUTE,\n SHELL_GHOST_LAYER_ATTRIBUTE,\n SHELL_OBJECT_ATTRIBUTE,\n SHELL_PANE_SELECTOR,\n shellPaneSelectorForZone,\n shellPaneZone,\n shellRegionSelector,\n ShellGhostKind,\n ShellGhostLayer,\n ShellGhostPose,\n ShellDialogArrival,\n ShellMotionDip,\n ShellPaneArrival,\n ShellPaneResize,\n ShellPlaceChange,\n type ShellMotionAxis,\n type ShellStageRect,\n} from './shell-motion-vocabulary';\nimport { installShellLayoutStylesheet } from './shell-layout-stylesheet';\nimport { createShellViewTransitionCommit, SHELL_VIEW_TRANSITION_CSS, shellViewTransitionsAvailable } from './shell-view-transition';\nimport { cascadeShellRows, flyShellProxy, growShellPane, SHELL_PRESS_ORIGIN_MAX_AGE_MS, slideShellPaneHome, useShellDialogArrival, useShellPressOrigin } from './shell-motion-origins';\n\n/** Every object a layout moves: its own region wrappers, and the navigation panes. */\nconst SHELL_MOTION_OBJECTS = `[${SHELL_OBJECT_ATTRIBUTE}], ${SHELL_PANE_SELECTOR}`;\n\n/**\n * The last laid-out box of every object, kept so a pane that has just been REMOVED or HIDDEN can still be drawn where\n * it was (its ghost leaves from there). A zero-size reading never replaces a real one: a hidden pane measures as\n * nothing, and its last visible box is the one that matters.\n */\nexport const shellStageRects = new WeakMap<Element, ShellStageRect>();\n\n/** An element's layout offset inside `root`, walking the offset-parent chain (transforms are not part of it). */\nexport function offsetWithin(element: HTMLElement, root: HTMLElement): { left: number; top: number } {\n let left = 0;\n let top = 0;\n let node: HTMLElement | null = element;\n while (node && node !== root) {\n left += node.offsetLeft;\n top += node.offsetTop;\n const parent = node.offsetParent as HTMLElement | null;\n if (!parent || (!root.contains(parent) && parent !== root)) break;\n node = parent;\n }\n return { left, top };\n}\n\n/**\n * Measures every object in the stage — the layout's region wrappers and the navigation panes — whenever anything can\n * have moved one: the stage or any object resizing (a sidebar collapsing MOVES the content column without resizing the\n * stage), the DOM changing, the window resizing. Each box lands in {@link shellStageRects}, and `onObject` lets a\n * layout derive something per object from it (the focal plane writes each object's vanishing-point origin).\n *\n * Offsets come from `offsetLeft`/`offsetTop`, which ignore transforms, so an object that is moved right now still\n * reports where it is laid out.\n */\nexport function useShellStageMeasurement(\n rootRef: RefObject<HTMLElement | null>,\n onObject?: (element: HTMLElement, offset: { left: number; top: number }, stage: HTMLElement) => void,\n): void {\n const onObjectRef = useRef(onObject);\n onObjectRef.current = onObject;\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root) return undefined;\n let frame = 0;\n // Absent in some environments (a test DOM): the window resize and the mutations below still re-measure.\n const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => schedule());\n const observed = new Set<HTMLElement>();\n const measure = (): void => {\n frame = 0;\n const objects = new Set(root.querySelectorAll<HTMLElement>(SHELL_MOTION_OBJECTS));\n for (const element of objects) if (!observed.has(element)) { resize?.observe(element); observed.add(element); }\n for (const element of observed) if (!objects.has(element)) { resize?.unobserve(element); observed.delete(element); }\n for (const element of objects) {\n const offset = offsetWithin(element, root);\n onObjectRef.current?.(element, offset, root);\n if (element.offsetWidth > 0 && element.offsetHeight > 0) shellStageRects.set(element, { ...offset, width: element.offsetWidth, height: element.offsetHeight });\n }\n };\n const schedule = (): void => {\n if (!frame) frame = requestAnimationFrame(measure);\n };\n measure();\n resize?.observe(root);\n const mutations = new MutationObserver(schedule);\n mutations.observe(root, { childList: true, subtree: true });\n window.addEventListener('resize', schedule);\n return () => {\n cancelAnimationFrame(frame);\n resize?.disconnect();\n mutations.disconnect();\n window.removeEventListener('resize', schedule);\n };\n }, [rootRef]);\n}\n\n/**\n * Which pane is in front: the one last pressed in or focused, or the one that last opened or changed place\n * (`bringForward`). Kept by the layout rather than read from the navigation state's `focusedZone` alone, because that\n * follows only interaction: opening a record beside a list leaves the LIST focused, and a layout brings the new pane\n * forward. The engine's focus state is never written.\n */\nexport function useShellFrontPane(rootRef: RefObject<HTMLElement | null>, focusedZone: string): { zone: string; bringForward: (zone: string) => void } {\n const [zone, setZone] = useState<string>(focusedZone);\n useEffect(() => setZone(focusedZone), [focusedZone]);\n useEffect(() => {\n const root = rootRef.current;\n if (!root) return undefined;\n const fromEvent = (event: Event): void => {\n const target = event.target instanceof Element ? event.target : null;\n const pane = target?.closest(`${shellRegionSelector(ShellRegion.CONTENT)} :is([data-content-area], [data-panel-id^=\"nav-\"])`);\n const name = pane ? shellPaneZone(pane) : undefined;\n if (name) setZone(name);\n };\n root.addEventListener('pointerdown', fromEvent, true);\n root.addEventListener('focusin', fromEvent, true);\n return () => {\n root.removeEventListener('pointerdown', fromEvent, true);\n root.removeEventListener('focusin', fromEvent, true);\n };\n }, [rootRef]);\n return { zone, bringForward: setZone };\n}\n\n/** The part of the navigation state place detection reads. */\nexport type ShellPlaceNavigation = Pick<NavigationContextType, 'state' | 'getTopEntry'>;\n\nconst STRUCTURAL_ZONES: ReadonlySet<string> = new Set(NAVIGATION_STRUCTURAL_ZONES);\n\n/**\n * Reports each structural zone that APPEARS (it held nothing and now holds a place) or CHANGES place (it now shows\n * another URL path). A place is the top entry's URL path — not its id, which is minted again on every push, and not\n * its query string, which carries view state on the same content (a section tab, a list mode). The overlay zone is a\n * dialog, not a pane, and is never reported. Nothing is reported on the first render.\n */\nexport function useShellPlaceChanges(navigation: ShellPlaceNavigation, onPlace: (zone: string, how: ShellPlaceChange) => void): void {\n const zones = Object.keys(navigation.state.zones).filter((zone) => STRUCTURAL_ZONES.has(zone));\n const places = zones.map((zone) => {\n const top = navigation.getTopEntry(zone as Parameters<ShellPlaceNavigation['getTopEntry']>[0]);\n return top ? (top.urlPath?.split(/[?#]/)[0] ?? top.id) : '';\n });\n const signature = zones.map((zone, index) => `${zone}:${places[index]}`).join('|');\n const previous = useRef<Map<string, string> | null>(null);\n const onPlaceRef = useRef(onPlace);\n onPlaceRef.current = onPlace;\n useEffect(() => {\n const current = new Map(zones.map((zone, index) => [zone, places[index] ?? '']));\n const before = previous.current;\n previous.current = current;\n if (!before) return;\n for (const [zone, place] of current) {\n const was = before.get(zone) ?? '';\n if (place === '' || was === place) continue;\n onPlaceRef.current(zone, was === '' ? ShellPlaceChange.APPEARED : ShellPlaceChange.CHANGED);\n }\n // `signature` is the whole dependency: the zones and places are derived from the same render.\n }, [signature]);\n}\n\n/**\n * Makes an element a picture: no ids, no focus, invisible to assistive technology, and none of the markers a query for\n * the REAL pane would find (a document-level lookup of a pane must never return its image). Embedded frames and media\n * are dropped rather than loaded a second time.\n */\nexport function makeShellPicture(element: HTMLElement): void {\n element.setAttribute('aria-hidden', 'true');\n element.setAttribute('inert', '');\n for (const node of [element, ...element.querySelectorAll<HTMLElement>('*')]) {\n for (const attribute of ['id', 'data-content-area', 'data-panel-id', 'data-zone-hidden', 'data-zone-emphasized', 'data-component-area', SHELL_OBJECT_ATTRIBUTE]) node.removeAttribute(attribute);\n }\n for (const media of element.querySelectorAll('iframe, video, audio')) media.remove();\n}\n\nfunction applyStyles(element: HTMLElement, styles: Readonly<Record<string, string>>): void {\n for (const [property, value] of Object.entries(styles)) element.style.setProperty(property, value);\n}\n\n/** Two frames: the first lets the ghost render at its start pose, the second changes it, so the transition plays. */\nfunction afterPaint(run: () => void): void {\n requestAnimationFrame(() => requestAnimationFrame(run));\n}\n\n/**\n * What a stylesheet cannot do alone, because the engine unmounts or hides a pane at once:\n *\n * - **Discard.** A side pane dismissed by its close control is removed from the DOM immediately. The removed node,\n * no longer React's, is re-parented into the FRONT ghost layer at the box it last had, and goes to the axis's\n * `DISCARDED` pose as it fades.\n * - **Expand.** An emphasized pane takes the width and the engine HIDES the others (`data-zone-hidden`). When the axis\n * draws one (`drawsHiddenPanePicture`), a still, inert image of each hidden pane is left in the BACK ghost layer at\n * the axis's `BEHIND` pose. It is a picture, never a\n * control: returning to side by side is the pane's own restore control. The image returns to `REST` and fades when\n * the emphasis ends.\n * - **Swap.** `dip(zone)` plays the axis's `PANE_SWAP` dip on a pane whose content changed in place.\n *\n * Needs {@link useShellStageMeasurement} running on the same stage (the boxes ghosts leave from), and the two ghost\n * layers (`[data-shell-ghost-layer=\"back\"]` and `\"front\"`) inside it. An axis with `durationMs: 0` plays nothing: no\n * discard ghost and no dip. The picture behind an expanded pane is still drawn — a still picture is not motion — at\n * its pose at once, and removed at once.\n */\nexport function useShellPaneMotion(rootRef: RefObject<HTMLElement | null>, axis: ShellMotionAxis): { dip: (zone: string) => void } {\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root) return undefined;\n const back = root.querySelector<HTMLElement>(`[${SHELL_GHOST_LAYER_ATTRIBUTE}=\"${ShellGhostLayer.BACK}\"]`);\n const front = root.querySelector<HTMLElement>(`[${SHELL_GHOST_LAYER_ATTRIBUTE}=\"${ShellGhostLayer.FRONT}\"]`);\n if (!back || !front) return undefined;\n const behind = new Map<Element, HTMLElement>();\n const duration = axis.durationMs;\n\n const createGhost = (kind: ShellGhostKind, rect: ShellStageRect): HTMLElement => {\n const ghost = document.createElement('div');\n ghost.setAttribute(SHELL_GHOST_ATTRIBUTE, kind);\n ghost.setAttribute('aria-hidden', 'true');\n Object.assign(ghost.style, { position: 'absolute', left: `${rect.left}px`, top: `${rect.top}px`, width: `${rect.width}px`, height: `${rect.height}px` });\n applyStyles(ghost, axis.ghostPose(ShellGhostPose.REST, { rect, stage: root }));\n return ghost;\n };\n\n const discard = (node: HTMLElement): void => {\n const rect = shellStageRects.get(node);\n // Moved rather than removed (taken out and put back in one batch): it is still on screen, not discarded.\n if (!rect || duration === 0 || node.isConnected) return;\n const ghost = createGhost(ShellGhostKind.DISCARDED, rect);\n makeShellPicture(node);\n ghost.appendChild(node);\n front.appendChild(ghost);\n afterPaint(() => {\n applyStyles(ghost, axis.ghostPose(ShellGhostPose.DISCARDED, { rect, stage: root }));\n ghost.style.opacity = '0';\n });\n setTimeout(() => ghost.remove(), duration + 60);\n };\n\n const syncBehind = (): void => {\n const emphasized = root.querySelector('[data-zone-emphasized]');\n // Only for an axis that draws one (`drawsHiddenPanePicture`). Drawn under reduced motion too: a still picture is\n // not motion. Only its travel and fade are skipped.\n const hidden = emphasized && axis.drawsHiddenPanePicture\n ? [...root.querySelectorAll<HTMLElement>(SHELL_PANE_SELECTOR)].filter((pane) => pane.hasAttribute('data-zone-hidden'))\n : [];\n for (const [pane, ghost] of behind) {\n if (hidden.includes(pane as HTMLElement)) continue;\n behind.delete(pane);\n if (duration === 0) { ghost.remove(); continue; }\n const rect = shellStageRects.get(pane);\n if (rect) applyStyles(ghost, axis.ghostPose(ShellGhostPose.REST, { rect, stage: root }));\n ghost.style.opacity = '0';\n setTimeout(() => ghost.remove(), duration);\n }\n for (const pane of hidden) {\n if (behind.has(pane)) continue;\n const rect = shellStageRects.get(pane);\n if (!rect) continue;\n const ghost = createGhost(ShellGhostKind.BEHIND, rect);\n const copy = pane.cloneNode(true) as HTMLElement;\n makeShellPicture(copy);\n copy.classList.remove('hidden');\n copy.style.width = '100%';\n copy.style.height = '100%';\n ghost.appendChild(copy);\n behind.set(pane, ghost);\n if (duration === 0) {\n // Still: placed straight at its pose, with no transition to play.\n applyStyles(ghost, axis.ghostPose(ShellGhostPose.BEHIND, { rect, stage: root }));\n back.appendChild(ghost);\n continue;\n }\n ghost.style.opacity = '0';\n back.appendChild(ghost);\n afterPaint(() => {\n applyStyles(ghost, axis.ghostPose(ShellGhostPose.BEHIND, { rect, stage: root }));\n ghost.style.opacity = '1';\n });\n }\n };\n\n /** The pane object an emphasis marker belongs to: the zone itself, or the resizable panel holding it. */\n const paneOf = (element: Element): HTMLElement | null =>\n (element.matches(SHELL_PANE_SELECTOR) ? element : element.closest('[data-panel-id^=\"nav-\"]')) as HTMLElement | null;\n\n const observer = new MutationObserver((records) => {\n for (const record of records) {\n // An emphasis given or taken: the pane grows to its new width, or slides home (`ShellPaneResize.GROW`). The\n // stage's last measurement still holds the box it had: measurement waits for the next frame.\n if (record.type === 'attributes' && record.attributeName === 'data-zone-emphasized' && axis.paneResize === ShellPaneResize.GROW) {\n const pane = record.target instanceof Element ? paneOf(record.target) : null;\n const before = pane ? shellStageRects.get(pane) : undefined;\n if (pane && before) {\n if ((record.target as Element).hasAttribute('data-zone-emphasized')) growShellPane(pane, before, root, axis);\n else slideShellPaneHome(pane, before, root, axis);\n }\n continue;\n }\n if (record.type !== 'childList') continue;\n for (const node of record.removedNodes) {\n // A detached node matches no selector that names its ancestors, so a pane is recognised by the box the\n // stage last measured for it: only objects have one. Only a SIDE pane is ever dismissed — the primary pane\n // leaves only when the content remounts (a breakpoint flip), which is not a discard.\n if (node instanceof HTMLElement && shellStageRects.has(node) && isShellSidePane(node)) discard(node);\n }\n }\n syncBehind();\n });\n const content = root.querySelector(shellRegionSelector(ShellRegion.CONTENT)) ?? root;\n observer.observe(content, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-zone-hidden', 'data-zone-emphasized'] });\n syncBehind();\n return () => {\n observer.disconnect();\n for (const ghost of behind.values()) ghost.remove();\n };\n }, [rootRef, axis]);\n\n const dipRef = useRef<(zone: string) => void>(() => undefined);\n useEffect(() => {\n dipRef.current = (zone: string): void => {\n const root = rootRef.current;\n if (!root || axis.durationMs === 0) return;\n const pane = root.querySelector<HTMLElement>(shellPaneSelectorForZone(zone));\n if (!pane || typeof pane.animate !== 'function') return;\n pane.animate([axis.dipPeak(ShellMotionDip.PANE_SWAP, { stage: root })], { duration: axis.durationMs, easing: axis.easing });\n };\n }, [rootRef, axis]);\n return { dip: (zone) => dipRef.current(zone) };\n}\n\n/** A column's width must change by more than this to count as a fold, not a drag tremor. */\nconst COLUMN_RESIZE_THRESHOLD_PX = 24;\n\n/**\n * A side column (the sidebar folding to its rail or unfolding, a utility panel) plays the axis's `COLUMN_RESIZE` dip\n * while the panes re-arrange. The width animates over many frames, so the dip plays once per settled change larger\n * than a few pixels, and at most once per motion. It runs on the layout's OWN wrapper (`[data-shell-object]`).\n */\nexport function useShellColumnMotion(rootRef: RefObject<HTMLElement | null>, axis: ShellMotionAxis): void {\n useEffect(() => {\n const root = rootRef.current;\n if (!root || axis.durationMs === 0 || typeof ResizeObserver === 'undefined') return undefined;\n const columns = [...root.querySelectorAll<HTMLElement>(`[${SHELL_OBJECT_ATTRIBUTE}]`)].filter((wrapper) =>\n wrapper.querySelector(`:scope > ${shellRegionSelector(ShellRegion.SIDEBAR)}, :scope > ${shellRegionSelector(ShellRegion.UTILITY_PANEL)}`));\n const settled = new Map<HTMLElement, number>();\n const lastDip = new Map<HTMLElement, number>();\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const wrapper = entry.target as HTMLElement;\n const width = wrapper.offsetWidth;\n const previous = settled.get(wrapper);\n if (previous === undefined || width === 0) { settled.set(wrapper, width); continue; }\n if (Math.abs(width - previous) <= COLUMN_RESIZE_THRESHOLD_PX) continue;\n settled.set(wrapper, width);\n const now = performance.now();\n if (now - (lastDip.get(wrapper) ?? 0) < axis.durationMs) continue;\n lastDip.set(wrapper, now);\n wrapper.animate([axis.dipPeak(ShellMotionDip.COLUMN_RESIZE, { stage: root })], { duration: axis.durationMs, easing: axis.easing });\n }\n });\n for (const column of columns) observer.observe(column);\n return () => observer.disconnect();\n }, [rootRef, axis]);\n}\n\n/** @wildo_source:part:start saas.frontend.app-shell.use-shell-motion facet:layer:frontend facet:family:app-shell facet:audience:app-developer */\n/** What an animated layout's stage passes to {@link useShellMotion}. */\nexport interface ShellMotionOptions {\n /** Which way things move, and for how long. Memoize it: the building blocks re-arm when it changes. */\n axis: ShellMotionAxis;\n /** The navigation state (`useNavigationState()`): its focused zone, its zones' places. */\n navigation: ShellPlaceNavigation & Pick<NavigationContextType, 'focusedZone'>;\n /** Called per object on every measurement, with its offset in the stage (a depth layout derives its origin here). */\n onObjectMeasured?: (element: HTMLElement, offset: { left: number; top: number }, stage: HTMLElement) => void;\n}\n\n/**\n * Every motion building block an animated layout composes, on one stage: the measurement, the front pane, place\n * changes (a pane that opens or changes place comes forward, and a change in place dips), the discard and behind\n * ghosts, the column dip — and, as the axis chooses, a side pane or a dialog growing out of what was pressed, an\n * emphasized pane growing to its width, and rows cascading in (a side pane's arrival as a browser view transition when\n * the axis asks, `paneArrivalByViewTransition`). Returns the zone in front, which the layout exposes (as an attribute) for its stylesheet\n * to recede the others.\n *\n * The stage (`rootRef`) must contain the layout's region wrappers marked `data-shell-object`, the content outlet, and\n * the two ghost layers (`data-shell-ghost-layer=\"back\"` under the regions, `\"front\"` above them).\n */\nexport function useShellMotion(rootRef: RefObject<HTMLElement | null>, { axis, navigation, onObjectMeasured }: ShellMotionOptions): { frontZone: string } {\n useShellStageMeasurement(rootRef, onObjectMeasured);\n const { dip } = useShellPaneMotion(rootRef, axis);\n const front = useShellFrontPane(rootRef, navigation.focusedZone);\n useShellColumnMotion(rootRef, axis);\n const origin = useShellPressOrigin(axis.paneArrival === ShellPaneArrival.FROM_PRESSED_ELEMENT || axis.dialogArrival === ShellDialogArrival.FROM_PRESSED_ELEMENT);\n useShellDialogArrival(rootRef, axis, origin);\n // A side pane's arrival carried out as a browser view transition, where the axis asks and the browser can: the\n // navigation's commit runs inside it. It consumes the press, so the proxy below finds nothing to fly from.\n useEffect(() => {\n if (axis.paneArrival !== ShellPaneArrival.FROM_PRESSED_ELEMENT || !axis.paneArrivalByViewTransition || axis.durationMs === 0) return undefined;\n if (!shellViewTransitionsAvailable()) return undefined;\n const releaseStylesheet = installShellLayoutStylesheet('shell-view-transition', SHELL_VIEW_TRANSITION_CSS);\n const uninstall = installNavigationCommitWrapper(createShellViewTransitionCommit({ stage: () => rootRef.current, origin, axis }));\n return () => {\n uninstall();\n releaseStylesheet();\n };\n }, [rootRef, origin, axis]);\n // One cascade per zone: two panes changing place together must not cancel each other's.\n const cascades = useRef(new Map<string, () => void>());\n useEffect(() => () => { for (const stop of cascades.current.values()) stop(); cascades.current.clear(); }, []);\n useShellPlaceChanges(navigation, (zone, how) => {\n if (how === ShellPlaceChange.CHANGED) dip(zone);\n front.bringForward(zone);\n const root = rootRef.current;\n const pane = root?.querySelector<HTMLElement>(shellPaneSelectorForZone(zone));\n if (!root || !pane || axis.durationMs === 0) return;\n // A side pane that opened grows out of the row pressed to open it (`ShellPaneArrival.FROM_PRESSED_ELEMENT`).\n if (how === ShellPlaceChange.APPEARED && axis.paneArrival === ShellPaneArrival.FROM_PRESSED_ELEMENT && isShellSidePane(pane)) {\n const from = origin.takeRow(SHELL_PRESS_ORIGIN_MAX_AGE_MS);\n if (from) void flyShellProxy(root, from, pane.getBoundingClientRect(), axis, pane);\n }\n if (axis.cascadesRows) {\n cascades.current.get(zone)?.();\n cascades.current.set(zone, cascadeShellRows(pane, axis));\n }\n });\n return { frontZone: front.zone };\n}\n/** @wildo_source:part:end saas.frontend.app-shell.use-shell-motion */\n"]}
|
|
1
|
+
{"version":3,"file":"use-shell-motion.js","sourceRoot":"","sources":["../../../../../src/core/app-shell/shell-motion/use-shell-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AAEpF,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,iCAAiC,EACjC,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GAGjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACpI,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAEvL,sFAAsF;AACtF,MAAM,oBAAoB,GAAG,IAAI,sBAAsB,MAAM,mBAAmB,EAAE,CAAC;AAEnF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,OAAO,EAA2B,CAAC;AAEtE,iHAAiH;AACjH,MAAM,UAAU,YAAY,CAAC,OAAoB,EAAE,IAAiB;IAClE,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,IAAI,GAAuB,OAAO,CAAC;IACvC,OAAO,IAAI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Q,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YAC/B,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AACnC,CAAC;AACD,sEAAsE","sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from 'react';\n\nimport { ShellRegion } from '@wildo-ai/presets-components-models';\n\nimport { NAVIGATION_STRUCTURAL_ZONES } from '../../navigation/navigation.schemas';\nimport { installNavigationCommitWrapper } from '../../navigation/navigation-commit';\nimport type { NavigationContextType } from '../../navigation/NavigationContext';\nimport {\n isShellSidePane,\n SHELL_GHOST_ATTRIBUTE,\n SHELL_GHOST_LAYER_ATTRIBUTE,\n SHELL_OBJECT_ATTRIBUTE,\n SHELL_PICTURE_STRIPPED_ATTRIBUTES,\n SHELL_PANE_SELECTOR,\n shellPaneSelectorForZone,\n shellPaneZone,\n shellRegionSelector,\n ShellGhostKind,\n ShellGhostLayer,\n ShellGhostPose,\n ShellDialogArrival,\n ShellMotionDip,\n ShellPaneArrival,\n ShellPaneResize,\n ShellPlaceChange,\n type ShellMotionAxis,\n type ShellStageRect,\n} from './shell-motion-vocabulary';\nimport { installShellLayoutStylesheet } from './shell-layout-stylesheet';\nimport { createShellViewTransitionCommit, SHELL_VIEW_TRANSITION_CSS, shellViewTransitionsAvailable } from './shell-view-transition';\nimport { cascadeShellRows, flyShellProxy, growShellPane, SHELL_PRESS_ORIGIN_MAX_AGE_MS, slideShellPaneHome, useShellDialogArrival, useShellPressOrigin } from './shell-motion-origins';\n\n/** Every object a layout moves: its own region wrappers, and the navigation panes. */\nconst SHELL_MOTION_OBJECTS = `[${SHELL_OBJECT_ATTRIBUTE}], ${SHELL_PANE_SELECTOR}`;\n\n/**\n * The last laid-out box of every object, kept so a pane that has just been REMOVED or HIDDEN can still be drawn where\n * it was (its ghost leaves from there). A zero-size reading never replaces a real one: a hidden pane measures as\n * nothing, and its last visible box is the one that matters.\n */\nexport const shellStageRects = new WeakMap<Element, ShellStageRect>();\n\n/** An element's layout offset inside `root`, walking the offset-parent chain (transforms are not part of it). */\nexport function offsetWithin(element: HTMLElement, root: HTMLElement): { left: number; top: number } {\n let left = 0;\n let top = 0;\n let node: HTMLElement | null = element;\n while (node && node !== root) {\n left += node.offsetLeft;\n top += node.offsetTop;\n const parent = node.offsetParent as HTMLElement | null;\n if (!parent || (!root.contains(parent) && parent !== root)) break;\n node = parent;\n }\n return { left, top };\n}\n\n/**\n * Measures every object in the stage — the layout's region wrappers and the navigation panes — whenever anything can\n * have moved one: the stage or any object resizing (a sidebar collapsing MOVES the content column without resizing the\n * stage), the DOM changing, the window resizing. Each box lands in {@link shellStageRects}, and `onObject` lets a\n * layout derive something per object from it (the focal plane writes each object's vanishing-point origin).\n *\n * Offsets come from `offsetLeft`/`offsetTop`, which ignore transforms, so an object that is moved right now still\n * reports where it is laid out.\n */\nexport function useShellStageMeasurement(\n rootRef: RefObject<HTMLElement | null>,\n onObject?: (element: HTMLElement, offset: { left: number; top: number }, stage: HTMLElement) => void,\n): void {\n const onObjectRef = useRef(onObject);\n onObjectRef.current = onObject;\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root) return undefined;\n let frame = 0;\n // Absent in some environments (a test DOM): the window resize and the mutations below still re-measure.\n const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => schedule());\n const observed = new Set<HTMLElement>();\n const measure = (): void => {\n frame = 0;\n const objects = new Set(root.querySelectorAll<HTMLElement>(SHELL_MOTION_OBJECTS));\n for (const element of objects) if (!observed.has(element)) { resize?.observe(element); observed.add(element); }\n for (const element of observed) if (!objects.has(element)) { resize?.unobserve(element); observed.delete(element); }\n for (const element of objects) {\n const offset = offsetWithin(element, root);\n onObjectRef.current?.(element, offset, root);\n if (element.offsetWidth > 0 && element.offsetHeight > 0) shellStageRects.set(element, { ...offset, width: element.offsetWidth, height: element.offsetHeight });\n }\n };\n const schedule = (): void => {\n if (!frame) frame = requestAnimationFrame(measure);\n };\n measure();\n resize?.observe(root);\n const mutations = new MutationObserver(schedule);\n mutations.observe(root, { childList: true, subtree: true });\n window.addEventListener('resize', schedule);\n return () => {\n cancelAnimationFrame(frame);\n resize?.disconnect();\n mutations.disconnect();\n window.removeEventListener('resize', schedule);\n };\n }, [rootRef]);\n}\n\n/**\n * Which pane is in front: the one last pressed in or focused, or the one that last opened or changed place\n * (`bringForward`). Kept by the layout rather than read from the navigation state's `focusedZone` alone, because that\n * follows only interaction: opening a record beside a list leaves the LIST focused, and a layout brings the new pane\n * forward. The engine's focus state is never written.\n */\nexport function useShellFrontPane(rootRef: RefObject<HTMLElement | null>, focusedZone: string): { zone: string; bringForward: (zone: string) => void } {\n const [zone, setZone] = useState<string>(focusedZone);\n useEffect(() => setZone(focusedZone), [focusedZone]);\n useEffect(() => {\n const root = rootRef.current;\n if (!root) return undefined;\n const fromEvent = (event: Event): void => {\n const target = event.target instanceof Element ? event.target : null;\n const pane = target?.closest(`${shellRegionSelector(ShellRegion.CONTENT)} :is([data-content-area], [data-panel-id^=\"nav-\"])`);\n const name = pane ? shellPaneZone(pane) : undefined;\n if (name) setZone(name);\n };\n root.addEventListener('pointerdown', fromEvent, true);\n root.addEventListener('focusin', fromEvent, true);\n return () => {\n root.removeEventListener('pointerdown', fromEvent, true);\n root.removeEventListener('focusin', fromEvent, true);\n };\n }, [rootRef]);\n return { zone, bringForward: setZone };\n}\n\n/** The part of the navigation state place detection reads. */\nexport type ShellPlaceNavigation = Pick<NavigationContextType, 'state' | 'getTopEntry'>;\n\nconst STRUCTURAL_ZONES: ReadonlySet<string> = new Set(NAVIGATION_STRUCTURAL_ZONES);\n\n/**\n * Reports each structural zone that APPEARS (it held nothing and now holds a place) or CHANGES place (it now shows\n * another URL path). A place is the top entry's URL path — not its id, which is minted again on every push, and not\n * its query string, which carries view state on the same content (a section tab, a list mode). The overlay zone is a\n * dialog, not a pane, and is never reported. Nothing is reported on the first render.\n */\nexport function useShellPlaceChanges(navigation: ShellPlaceNavigation, onPlace: (zone: string, how: ShellPlaceChange) => void): void {\n const zones = Object.keys(navigation.state.zones).filter((zone) => STRUCTURAL_ZONES.has(zone));\n const places = zones.map((zone) => {\n const top = navigation.getTopEntry(zone as Parameters<ShellPlaceNavigation['getTopEntry']>[0]);\n return top ? (top.urlPath?.split(/[?#]/)[0] ?? top.id) : '';\n });\n const signature = zones.map((zone, index) => `${zone}:${places[index]}`).join('|');\n const previous = useRef<Map<string, string> | null>(null);\n const onPlaceRef = useRef(onPlace);\n onPlaceRef.current = onPlace;\n useEffect(() => {\n const current = new Map(zones.map((zone, index) => [zone, places[index] ?? '']));\n const before = previous.current;\n previous.current = current;\n if (!before) return;\n for (const [zone, place] of current) {\n const was = before.get(zone) ?? '';\n if (place === '' || was === place) continue;\n onPlaceRef.current(zone, was === '' ? ShellPlaceChange.APPEARED : ShellPlaceChange.CHANGED);\n }\n // `signature` is the whole dependency: the zones and places are derived from the same render.\n }, [signature]);\n}\n\n/**\n * Makes an element a picture: no ids, no focus, invisible to assistive technology, and none of the markers a query for\n * the REAL pane would find (a document-level lookup of a pane must never return its image). Embedded frames and media\n * are dropped rather than loaded a second time.\n */\nexport function makeShellPicture(element: HTMLElement): void {\n element.setAttribute('aria-hidden', 'true');\n element.setAttribute('inert', '');\n for (const node of [element, ...element.querySelectorAll<HTMLElement>('*')]) {\n for (const attribute of SHELL_PICTURE_STRIPPED_ATTRIBUTES) node.removeAttribute(attribute);\n }\n for (const media of element.querySelectorAll('iframe, video, audio')) media.remove();\n}\n\nfunction applyStyles(element: HTMLElement, styles: Readonly<Record<string, string>>): void {\n for (const [property, value] of Object.entries(styles)) element.style.setProperty(property, value);\n}\n\n/** Two frames: the first lets the ghost render at its start pose, the second changes it, so the transition plays. */\nfunction afterPaint(run: () => void): void {\n requestAnimationFrame(() => requestAnimationFrame(run));\n}\n\n/**\n * What a stylesheet cannot do alone, because the engine unmounts or hides a pane at once:\n *\n * - **Discard.** A side pane dismissed by its close control is removed from the DOM immediately. The removed node,\n * no longer React's, is re-parented into the FRONT ghost layer at the box it last had, and goes to the axis's\n * `DISCARDED` pose as it fades.\n * - **Expand.** An emphasized pane takes the width and the engine HIDES the others (`data-zone-hidden`). When the axis\n * draws one (`drawsHiddenPanePicture`), a still, inert image of each hidden pane is left in the BACK ghost layer at\n * the axis's `BEHIND` pose. It is a picture, never a\n * control: returning to side by side is the pane's own restore control. The image returns to `REST` and fades when\n * the emphasis ends.\n * - **Swap.** `dip(zone)` plays the axis's `PANE_SWAP` dip on a pane whose content changed in place.\n *\n * Needs {@link useShellStageMeasurement} running on the same stage (the boxes ghosts leave from), and the two ghost\n * layers (`[data-shell-ghost-layer=\"back\"]` and `\"front\"`) inside it. An axis with `durationMs: 0` plays nothing: no\n * discard ghost and no dip. The picture behind an expanded pane is still drawn — a still picture is not motion — at\n * its pose at once, and removed at once.\n */\nexport function useShellPaneMotion(rootRef: RefObject<HTMLElement | null>, axis: ShellMotionAxis): { dip: (zone: string) => void } {\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root) return undefined;\n const back = root.querySelector<HTMLElement>(`[${SHELL_GHOST_LAYER_ATTRIBUTE}=\"${ShellGhostLayer.BACK}\"]`);\n const front = root.querySelector<HTMLElement>(`[${SHELL_GHOST_LAYER_ATTRIBUTE}=\"${ShellGhostLayer.FRONT}\"]`);\n if (!back || !front) return undefined;\n const behind = new Map<Element, HTMLElement>();\n const duration = axis.durationMs;\n\n const createGhost = (kind: ShellGhostKind, rect: ShellStageRect): HTMLElement => {\n const ghost = document.createElement('div');\n ghost.setAttribute(SHELL_GHOST_ATTRIBUTE, kind);\n ghost.setAttribute('aria-hidden', 'true');\n Object.assign(ghost.style, { position: 'absolute', left: `${rect.left}px`, top: `${rect.top}px`, width: `${rect.width}px`, height: `${rect.height}px` });\n applyStyles(ghost, axis.ghostPose(ShellGhostPose.REST, { rect, stage: root }));\n return ghost;\n };\n\n const discard = (node: HTMLElement): void => {\n const rect = shellStageRects.get(node);\n // Moved rather than removed (taken out and put back in one batch): it is still on screen, not discarded.\n if (!rect || duration === 0 || node.isConnected) return;\n const ghost = createGhost(ShellGhostKind.DISCARDED, rect);\n makeShellPicture(node);\n ghost.appendChild(node);\n front.appendChild(ghost);\n afterPaint(() => {\n applyStyles(ghost, axis.ghostPose(ShellGhostPose.DISCARDED, { rect, stage: root }));\n ghost.style.opacity = '0';\n });\n setTimeout(() => ghost.remove(), duration + 60);\n };\n\n const syncBehind = (): void => {\n const emphasized = root.querySelector('[data-zone-emphasized]');\n // Only for an axis that draws one (`drawsHiddenPanePicture`). Drawn under reduced motion too: a still picture is\n // not motion. Only its travel and fade are skipped.\n const hidden = emphasized && axis.drawsHiddenPanePicture\n ? [...root.querySelectorAll<HTMLElement>(SHELL_PANE_SELECTOR)].filter((pane) => pane.hasAttribute('data-zone-hidden'))\n : [];\n for (const [pane, ghost] of behind) {\n if (hidden.includes(pane as HTMLElement)) continue;\n behind.delete(pane);\n if (duration === 0) { ghost.remove(); continue; }\n const rect = shellStageRects.get(pane);\n if (rect) applyStyles(ghost, axis.ghostPose(ShellGhostPose.REST, { rect, stage: root }));\n ghost.style.opacity = '0';\n setTimeout(() => ghost.remove(), duration);\n }\n for (const pane of hidden) {\n if (behind.has(pane)) continue;\n const rect = shellStageRects.get(pane);\n if (!rect) continue;\n const ghost = createGhost(ShellGhostKind.BEHIND, rect);\n const copy = pane.cloneNode(true) as HTMLElement;\n makeShellPicture(copy);\n copy.classList.remove('hidden');\n copy.style.width = '100%';\n copy.style.height = '100%';\n ghost.appendChild(copy);\n behind.set(pane, ghost);\n if (duration === 0) {\n // Still: placed straight at its pose, with no transition to play.\n applyStyles(ghost, axis.ghostPose(ShellGhostPose.BEHIND, { rect, stage: root }));\n back.appendChild(ghost);\n continue;\n }\n ghost.style.opacity = '0';\n back.appendChild(ghost);\n afterPaint(() => {\n applyStyles(ghost, axis.ghostPose(ShellGhostPose.BEHIND, { rect, stage: root }));\n ghost.style.opacity = '1';\n });\n }\n };\n\n /** The pane object an emphasis marker belongs to: the zone itself, or the resizable panel holding it. */\n const paneOf = (element: Element): HTMLElement | null =>\n (element.matches(SHELL_PANE_SELECTOR) ? element : element.closest('[data-panel-id^=\"nav-\"]')) as HTMLElement | null;\n\n const observer = new MutationObserver((records) => {\n for (const record of records) {\n // An emphasis given or taken: the pane grows to its new width, or slides home (`ShellPaneResize.GROW`). The\n // stage's last measurement still holds the box it had: measurement waits for the next frame.\n if (record.type === 'attributes' && record.attributeName === 'data-zone-emphasized' && axis.paneResize === ShellPaneResize.GROW) {\n const pane = record.target instanceof Element ? paneOf(record.target) : null;\n const before = pane ? shellStageRects.get(pane) : undefined;\n if (pane && before) {\n if ((record.target as Element).hasAttribute('data-zone-emphasized')) growShellPane(pane, before, root, axis);\n else slideShellPaneHome(pane, before, root, axis);\n }\n continue;\n }\n if (record.type !== 'childList') continue;\n for (const node of record.removedNodes) {\n // A detached node matches no selector that names its ancestors, so a pane is recognised by the box the\n // stage last measured for it: only objects have one. Only a SIDE pane is ever dismissed — the primary pane\n // leaves only when the content remounts (a breakpoint flip), which is not a discard.\n if (node instanceof HTMLElement && shellStageRects.has(node) && isShellSidePane(node)) discard(node);\n }\n }\n syncBehind();\n });\n const content = root.querySelector(shellRegionSelector(ShellRegion.CONTENT)) ?? root;\n observer.observe(content, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-zone-hidden', 'data-zone-emphasized'] });\n syncBehind();\n return () => {\n observer.disconnect();\n for (const ghost of behind.values()) ghost.remove();\n };\n }, [rootRef, axis]);\n\n const dipRef = useRef<(zone: string) => void>(() => undefined);\n useEffect(() => {\n dipRef.current = (zone: string): void => {\n const root = rootRef.current;\n if (!root || axis.durationMs === 0) return;\n const pane = root.querySelector<HTMLElement>(shellPaneSelectorForZone(zone));\n if (!pane || typeof pane.animate !== 'function') return;\n pane.animate([axis.dipPeak(ShellMotionDip.PANE_SWAP, { stage: root })], { duration: axis.durationMs, easing: axis.easing });\n };\n }, [rootRef, axis]);\n return { dip: (zone) => dipRef.current(zone) };\n}\n\n/** A column's width must change by more than this to count as a fold, not a drag tremor. */\nconst COLUMN_RESIZE_THRESHOLD_PX = 24;\n\n/**\n * A side column (the sidebar folding to its rail or unfolding, a utility panel) plays the axis's `COLUMN_RESIZE` dip\n * while the panes re-arrange. The width animates over many frames, so the dip plays once per settled change larger\n * than a few pixels, and at most once per motion. It runs on the layout's OWN wrapper (`[data-shell-object]`).\n */\nexport function useShellColumnMotion(rootRef: RefObject<HTMLElement | null>, axis: ShellMotionAxis): void {\n useEffect(() => {\n const root = rootRef.current;\n if (!root || axis.durationMs === 0 || typeof ResizeObserver === 'undefined') return undefined;\n const columns = [...root.querySelectorAll<HTMLElement>(`[${SHELL_OBJECT_ATTRIBUTE}]`)].filter((wrapper) =>\n wrapper.querySelector(`:scope > ${shellRegionSelector(ShellRegion.SIDEBAR)}, :scope > ${shellRegionSelector(ShellRegion.UTILITY_PANEL)}`));\n const settled = new Map<HTMLElement, number>();\n const lastDip = new Map<HTMLElement, number>();\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const wrapper = entry.target as HTMLElement;\n const width = wrapper.offsetWidth;\n const previous = settled.get(wrapper);\n if (previous === undefined || width === 0) { settled.set(wrapper, width); continue; }\n if (Math.abs(width - previous) <= COLUMN_RESIZE_THRESHOLD_PX) continue;\n settled.set(wrapper, width);\n const now = performance.now();\n if (now - (lastDip.get(wrapper) ?? 0) < axis.durationMs) continue;\n lastDip.set(wrapper, now);\n wrapper.animate([axis.dipPeak(ShellMotionDip.COLUMN_RESIZE, { stage: root })], { duration: axis.durationMs, easing: axis.easing });\n }\n });\n for (const column of columns) observer.observe(column);\n return () => observer.disconnect();\n }, [rootRef, axis]);\n}\n\n/** @wildo_source:part:start saas.frontend.app-shell.use-shell-motion facet:layer:frontend facet:family:app-shell facet:audience:app-developer */\n/** What an animated layout's stage passes to {@link useShellMotion}. */\nexport interface ShellMotionOptions {\n /** Which way things move, and for how long. Memoize it: the building blocks re-arm when it changes. */\n axis: ShellMotionAxis;\n /** The navigation state (`useNavigationState()`): its focused zone, its zones' places. */\n navigation: ShellPlaceNavigation & Pick<NavigationContextType, 'focusedZone'>;\n /** Called per object on every measurement, with its offset in the stage (a depth layout derives its origin here). */\n onObjectMeasured?: (element: HTMLElement, offset: { left: number; top: number }, stage: HTMLElement) => void;\n}\n\n/**\n * Every motion building block an animated layout composes, on one stage: the measurement, the front pane, place\n * changes (a pane that opens or changes place comes forward, and a change in place dips), the discard and behind\n * ghosts, the column dip — and, as the axis chooses, a side pane or a dialog growing out of what was pressed, an\n * emphasized pane growing to its width, and rows cascading in (a side pane's arrival as a browser view transition when\n * the axis asks, `paneArrivalByViewTransition`). Returns the zone in front, which the layout exposes (as an attribute) for its stylesheet\n * to recede the others.\n *\n * The stage (`rootRef`) must contain the layout's region wrappers marked `data-shell-object`, the content outlet, and\n * the two ghost layers (`data-shell-ghost-layer=\"back\"` under the regions, `\"front\"` above them).\n */\nexport function useShellMotion(rootRef: RefObject<HTMLElement | null>, { axis, navigation, onObjectMeasured }: ShellMotionOptions): { frontZone: string } {\n useShellStageMeasurement(rootRef, onObjectMeasured);\n const { dip } = useShellPaneMotion(rootRef, axis);\n const front = useShellFrontPane(rootRef, navigation.focusedZone);\n useShellColumnMotion(rootRef, axis);\n const origin = useShellPressOrigin(axis.paneArrival === ShellPaneArrival.FROM_PRESSED_ELEMENT || axis.dialogArrival === ShellDialogArrival.FROM_PRESSED_ELEMENT);\n useShellDialogArrival(rootRef, axis, origin);\n // A side pane's arrival carried out as a browser view transition, where the axis asks and the browser can: the\n // navigation's commit runs inside it. It consumes the press, so the proxy below finds nothing to fly from.\n useEffect(() => {\n if (axis.paneArrival !== ShellPaneArrival.FROM_PRESSED_ELEMENT || !axis.paneArrivalByViewTransition || axis.durationMs === 0) return undefined;\n if (!shellViewTransitionsAvailable()) return undefined;\n const releaseStylesheet = installShellLayoutStylesheet('shell-view-transition', SHELL_VIEW_TRANSITION_CSS);\n const uninstall = installNavigationCommitWrapper(createShellViewTransitionCommit({ stage: () => rootRef.current, origin, axis }));\n return () => {\n uninstall();\n releaseStylesheet();\n };\n }, [rootRef, origin, axis]);\n // One cascade per zone: two panes changing place together must not cancel each other's.\n const cascades = useRef(new Map<string, () => void>());\n useEffect(() => () => { for (const stop of cascades.current.values()) stop(); cascades.current.clear(); }, []);\n useShellPlaceChanges(navigation, (zone, how) => {\n if (how === ShellPlaceChange.CHANGED) dip(zone);\n front.bringForward(zone);\n const root = rootRef.current;\n const pane = root?.querySelector<HTMLElement>(shellPaneSelectorForZone(zone));\n if (!root || !pane || axis.durationMs === 0) return;\n // A side pane that opened grows out of the row pressed to open it (`ShellPaneArrival.FROM_PRESSED_ELEMENT`).\n if (how === ShellPlaceChange.APPEARED && axis.paneArrival === ShellPaneArrival.FROM_PRESSED_ELEMENT && isShellSidePane(pane)) {\n const from = origin.takeRow(SHELL_PRESS_ORIGIN_MAX_AGE_MS);\n if (from) void flyShellProxy(root, from, pane.getBoundingClientRect(), axis, pane);\n }\n if (axis.cascadesRows) {\n cascades.current.get(zone)?.();\n cascades.current.set(zone, cascadeShellRows(pane, axis));\n }\n });\n return { frontZone: front.zone };\n}\n/** @wildo_source:part:end saas.frontend.app-shell.use-shell-motion */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBrandPresentation.d.ts","sourceRoot":"","sources":["../../../../src/core/branding/useBrandPresentation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,8FAA8F;IAC9F,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB,+FAA+F;IAC/F,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"useBrandPresentation.d.ts","sourceRoot":"","sources":["../../../../src/core/branding/useBrandPresentation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,8FAA8F;IAC9F,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB,+FAA+F;IAC/F,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,GAAG,iBAAiB,CAoC3F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback,
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
2
|
import { BrandAssetComposition } from '@wildo-ai/saas-models';
|
|
3
3
|
/**
|
|
4
4
|
* Turns a resolved {@link BrandIdentity} into the presentation decisions a surface needs.
|
|
@@ -19,12 +19,23 @@ export function useBrandPresentation(identity) {
|
|
|
19
19
|
const logoUrl = identity?.logoUrl;
|
|
20
20
|
const name = identity?.name ?? '';
|
|
21
21
|
/*
|
|
22
|
-
*
|
|
23
|
-
* and a latch left set from the previous
|
|
22
|
+
* The failure latch records WHICH URL failed, and is cleared during render the moment the URL
|
|
23
|
+
* changes. A light/dark switch resolves a DIFFERENT asset, and a latch left set from the previous
|
|
24
|
+
* one would suppress a mark that loads perfectly.
|
|
25
|
+
*
|
|
26
|
+
* It used to be a boolean reset by `useEffect(..., [logoUrl])`. That reset ran AFTER the commit
|
|
27
|
+
* that drew the new `<img>`, so an `error` event arriving between the commit and the passive
|
|
28
|
+
* effect was overwritten by the late reset and the broken image stayed (#3784: reproduced on a
|
|
29
|
+
* loaded CPU, about 1 render in 200, which is how a QA runner met it). Keying the latch on the URL
|
|
30
|
+
* removes that window: an error is about the URL its `<img>` was rendered with, an error from a
|
|
31
|
+
* superseded `<img>` names a URL that no longer matches, and the reset happens in the same render
|
|
32
|
+
* that changes the URL rather than one effect later.
|
|
24
33
|
*/
|
|
25
|
-
const [
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
const [failedUrl, setFailedUrl] = useState(undefined);
|
|
35
|
+
if (failedUrl !== undefined && failedUrl !== logoUrl)
|
|
36
|
+
setFailedUrl(undefined);
|
|
37
|
+
const markFailed = failedUrl !== undefined && failedUrl === logoUrl;
|
|
38
|
+
const onMarkError = useCallback(() => setFailedUrl(logoUrl), [logoUrl]);
|
|
28
39
|
const hasMark = Boolean(logoUrl) && !markFailed;
|
|
29
40
|
const markCarriesName = hasMark && identity?.logoComposition !== undefined && identity.logoComposition !== BrandAssetComposition.SYMBOL;
|
|
30
41
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBrandPresentation.js","sourceRoot":"","sources":["../../../../src/core/branding/useBrandPresentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"useBrandPresentation.js","sourceRoot":"","sources":["../../../../src/core/branding/useBrandPresentation.ts"],"names":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-models';\n\nimport type { BrandIdentity } from './useBrandIdentity';\n\n/**\n * A brand identity, reduced to the decisions every surface that RENDERS one must take.\n *\n * {@link BrandIdentity} answers \"what did the brand resolve to\". This answers \"what may I therefore\n * draw\", which is a different question with four traps in it — and each trap is a visible defect\n * rather than a crash, so nothing fails loudly when a surface gets one wrong.\n */\nexport interface BrandPresentation {\n /** The application (or shell) name. May be empty only if the identity itself carries none. */\n name: string;\n /** The mark's URL — present only when {@link hasMark} is true. */\n logoUrl?: string;\n /**\n * A mark resolved AND has not failed to load. Distinct from `logoUrl !== undefined`: a URL that\n * 404s is a resolved mark that must not be drawn.\n */\n hasMark: boolean;\n /**\n * The resolved mark CONTAINS the name — a `WORDMARK` or `LOCKUP`, which the resolver's last\n * fallback rung can return for an application that generated no `SYMBOL`.\n *\n * Surfaces must not print the name beside such a mark: it would appear twice. They must also give\n * it intrinsic width rather than a square slot, or it letterboxes.\n */\n markCarriesName: boolean;\n /**\n * Draw the mark LIGHT: it is the single-colour mark on a dark UI (`BrandIdentity.markIsSingleColourOnDarkUi`). A\n * surface renders it as a light silhouette (e.g. `brightness-0 invert`) rather than as the dark asset it is.\n */\n drawMarkLight: boolean;\n /** Nothing identifiable at all — no usable mark and no name. Render no identity affordance. */\n isEmpty: boolean;\n /**\n * Wire to the `<img>`'s `onError`. A brand asset URL comes from configuration and can point at a\n * file that is not there; without this the surface renders a browser broken-image glyph where the\n * product identity should be.\n */\n onMarkError: () => void;\n}\n\n/**\n * Turns a resolved {@link BrandIdentity} into the presentation decisions a surface needs.\n *\n * ## Why this is shared rather than re-derived\n *\n * The sidebar's `BRAND_HEADER` worked these out first, and every one of them is a rule about the\n * DATA rather than about a sidebar: a wordmark contains the name; a failed load must degrade to the\n * no-mark presentation instead of a broken image; the failure latch must reset when the URL changes\n * or a light/dark switch leaves the surface permanently markless; an identity with neither mark nor\n * name must render nothing rather than an empty click target.\n *\n * A second surface presenting a brand needs the same four answers, so they live here once. What is\n * NOT here is anything about layout — a rail collapses, a login page does not — because that is the\n * part that genuinely differs per surface.\n */\nexport function useBrandPresentation(identity: BrandIdentity | undefined): BrandPresentation {\n const logoUrl = identity?.logoUrl;\n const name = identity?.name ?? '';\n\n /*\n * The failure latch records WHICH URL failed, and is cleared during render the moment the URL\n * changes. A light/dark switch resolves a DIFFERENT asset, and a latch left set from the previous\n * one would suppress a mark that loads perfectly.\n *\n * It used to be a boolean reset by `useEffect(..., [logoUrl])`. That reset ran AFTER the commit\n * that drew the new `<img>`, so an `error` event arriving between the commit and the passive\n * effect was overwritten by the late reset and the broken image stayed (#3784: reproduced on a\n * loaded CPU, about 1 render in 200, which is how a QA runner met it). Keying the latch on the URL\n * removes that window: an error is about the URL its `<img>` was rendered with, an error from a\n * superseded `<img>` names a URL that no longer matches, and the reset happens in the same render\n * that changes the URL rather than one effect later.\n */\n const [failedUrl, setFailedUrl] = useState<string | undefined>(undefined);\n if (failedUrl !== undefined && failedUrl !== logoUrl) setFailedUrl(undefined);\n const markFailed = failedUrl !== undefined && failedUrl === logoUrl;\n\n const onMarkError = useCallback(() => setFailedUrl(logoUrl), [logoUrl]);\n\n const hasMark = Boolean(logoUrl) && !markFailed;\n const markCarriesName =\n hasMark && identity?.logoComposition !== undefined && identity.logoComposition !== BrandAssetComposition.SYMBOL;\n\n return {\n name,\n logoUrl: hasMark ? logoUrl : undefined,\n hasMark,\n markCarriesName,\n drawMarkLight: hasMark && identity?.markIsSingleColourOnDarkUi === true,\n isEmpty: !hasMark && name.length === 0,\n onMarkError,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExecutionResourceOperationContextBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/execution/useExecutionResourceOperationContextBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,qBAAqB,EACrB,4BAA4B,EAC5B,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAsB/B,OAAO,KAAK,EAGV,gCAAgC,EAEjC,MAAM,+DAA+D,CAAC;AAIvE,KAAK,wCAAwC,GACzC;IACE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,4BAA4B,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GACD;IACE,aAAa,EAAE,qBAAqB,CAAC;IACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEN,MAAM,MAAM,gCAAgC,GAAG,wCAAwC,GAAG;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,0BAA0B,CAAC,EAAE,gCAAgC,CAAC,4BAA4B,CAAC,CAAC;IAC5F,0BAA0B,CAAC,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC1D,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,WAAW,6CAA6C;IAC5D,6BAA6B,EAAE,CAC7B,MAAM,EAAE,gCAAgC,KACrC,gCAAgC,CAAC;CACvC;
|
|
1
|
+
{"version":3,"file":"useExecutionResourceOperationContextBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/execution/useExecutionResourceOperationContextBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,qBAAqB,EACrB,4BAA4B,EAC5B,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAsB/B,OAAO,KAAK,EAGV,gCAAgC,EAEjC,MAAM,+DAA+D,CAAC;AAIvE,KAAK,wCAAwC,GACzC;IACE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,4BAA4B,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GACD;IACE,aAAa,EAAE,qBAAqB,CAAC;IACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEN,MAAM,MAAM,gCAAgC,GAAG,wCAAwC,GAAG;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,0BAA0B,CAAC,EAAE,gCAAgC,CAAC,4BAA4B,CAAC,CAAC;IAC5F,0BAA0B,CAAC,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC1D,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,WAAW,6CAA6C;IAC5D,6BAA6B,EAAE,CAC7B,MAAM,EAAE,gCAAgC,KACrC,gCAAgC,CAAC;CACvC;AA0ND,wBAAgB,2CAA2C,IAAI,6CAA6C,CA8H3G"}
|
|
@@ -102,7 +102,17 @@ function resolveOperationForTarget(resourceConfig, resourceType, target, registr
|
|
|
102
102
|
registry,
|
|
103
103
|
hasResourceId: frontendResourceUtils.getResourceId(contextResourceIdentifiers[resourceType]) !== '',
|
|
104
104
|
allowBulk: target.allowBulk,
|
|
105
|
-
|
|
105
|
+
/*
|
|
106
|
+
* The RUNTIME addressability check (does the current context carry the ids the operation's route needs?) is what a
|
|
107
|
+
* READ/UPDATE/DELETE must pass to be called at all. Whether the operation also has a routable PAGE is a different
|
|
108
|
+
* question, asked only when the target says so through `requireAddressable`: an execution action EXECUTES or EMBEDS
|
|
109
|
+
* the operation as often as it navigates to it, and an operation surfaced `EMBEDDED` (a dialog, an inline action) is
|
|
110
|
+
* fully callable. Requiring a page here refused every such operation, so the to-do list flow view's inspector, whose
|
|
111
|
+
* DELETE on to-dos, tasks and lists is `EMBEDDED`, offered no Delete at all (#3859). The explicit-operation branch
|
|
112
|
+
* above never asked for a page either. A page-routable variant is still preferred among several candidates
|
|
113
|
+
* (`pickPreferredOperationForCoreSemantic`).
|
|
114
|
+
*/
|
|
115
|
+
requireFrontendAddressable: target.requireAddressable === true,
|
|
106
116
|
contextResourceIdentifiers,
|
|
107
117
|
contextualParameters,
|
|
108
118
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExecutionResourceOperationContextBuilder.js","sourceRoot":"","sources":["../../../../src/core/execution/useExecutionResourceOperationContextBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,GAGtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,4CAA4C,EAC5C,qCAAqC,GACtC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,4DAA4D,CAAC;AACpE,OAAO,EACL,qCAAqC,EACrC,0CAA0C,GAC3C,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EACL,+CAA+C,EAC/C,mDAAmD,GACpD,MAAM,2EAA2E,CAAC;AAOnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,2EAA2E,CAAC;AA+BlH,SAAS,2CAA2C,CAClD,OAAe,EACf,OAAiC;IAEjC,OAAO,qBAAqB,CAAC,uBAAuB,CAClD,2BAA2B,CAAC,aAAa,EACzC;QACE,OAAO;QACP,SAAS,EAAE,6CAA6C;QACxD,GAAG,OAAO;KACX,CACF,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAC7B,MAAgD;IAEhD,OAA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,kBAAkB,EAAE,YAAY;gBAChC,QAAQ,EAAE,kBAAkB;gBAC5B,QAAQ;aACT,CAAC,CAAC,WAAW,CAAC;YACf,0BAA0B,GAAG,EAAE,GAAG,wBAAwB,EAAE,GAAG,CAAC,MAAM,CAAC,0BAA0B,IAAI,EAAE,CAAC,EAAE,CAAC;QAC7G,CAAC;QACD,IAAI,kBAAkB,EAAE,CAAC;YACvB,0BAA0B,CAAC,YAAY,CAAC,GAAG,2BAA2B,CAAC;gBACrE,YAAY,EAAE,0BAA0B,CAAC,YAAY,CAAC;gBACtD,UAAU,EAAE,kBAAkB;aAC/B,CAAC,CAAC;QACL,CAAC;QAED,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,yBAAyB,CAC1E,0BAA0B,EAC1B,QAAQ,CACT,CAAC;QACF,MAAM,SAAS,GAAG,yBAAyB,CACzC,cAAc,EACd,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,0BAA0B,EAC1B,oBAAoB,CACrB,CAAC;QAEF,MAAM,2BAA2B,GAAG,qBAAqB,CAAC,gCAAgC,CACxF,YAA4B,EAC5B,0BAA0B,EAC1B,QAAQ,EACR,MAAM,CAAC,0BAA0B,CAClC,CAAC;QAEF,OAAO,qBAAqB,CAAC,mDAAmD,CAAC;YAC/E,YAAY,EAAE,YAA4B;YAC1C,SAAS;YACT,0BAA0B;YAC1B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;YAC3C,2BAA2B;SAC5B,CAAC,CAAC;IACL,CAAC,EAAE;QACD,gBAAgB,CAAC,0BAA0B;QAC3C,gBAAgB,CAAC,cAAc;QAC/B,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO;QACL,6BAA6B;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useContext } from 'react';\n\nimport {\n ErrorCustomMessageReference,\n CoreResourceOperation,\n ResourceOperationVariantType,\n type ResourceType,\n} from '@wildo-ai/saas-models';\n\nimport {\n buildExecutionParticipationContextIdentifier,\n getExecutionParticipationResourceType,\n} from './execution-participation.utils';\nimport {\n assertExecutionRuntimeContext,\n ExecutionRuntimeContext,\n} from './ExecutionRuntimeContext';\nimport {\n frontendResourceUtils,\n FrontendResourceUtils,\n} from '~wildo-frontend-lib/core/resources/frontend-resource.utils';\nimport {\n pickPreferredOperationForCoreSemantic,\n resolveEffectiveCoreOperationFromOperation,\n} from '~wildo-frontend-lib/core/resources/operation-semantics.frontend.utils';\nimport {\n isFrontendOperationAddressableForCurrentContext,\n pickPreferredOperationForCoreSemanticAddressability,\n} from '~wildo-frontend-lib/core/resources/resource-addressability.frontend.utils';\nimport type {\n AnyFrontendResourceConfiguration,\n FrontendResourceConfiguration_Operation,\n FrontendResourceOperationContext,\n FrontendResourcesRegistry,\n} from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { scopeReferencedRecord } from '~wildo-frontend-lib/core/resources/referenced-record-scope.frontend.utils';\n\ntype ExecutionResourceOperationTargetSelector =\n | {\n operationIdentifier: string;\n variantType?: ResourceOperationVariantType;\n variantKey?: string;\n isOperationDefault?: boolean;\n isBulkOperation?: boolean;\n }\n | {\n operationLike: CoreResourceOperation;\n requireAddressable?: boolean;\n allowBulk?: boolean;\n };\n\nexport type ExecutionResourceOperationTarget = ExecutionResourceOperationTargetSelector & {\n resourceType?: string;\n resourceId?: string;\n participationRef?: string;\n contextResourceIdentifiers?: FrontendResourceOperationContext['contextResourceIdentifiers'];\n relationshipFieldOverrides?: Record<ResourceType, string>;\n additionalContext?: Record<string, unknown>;\n};\n\nexport interface ExecutionResourceOperationContextBuilderValue {\n buildResourceOperationContext: (\n target: ExecutionResourceOperationTarget,\n ) => FrontendResourceOperationContext;\n}\n\nfunction buildExecutionResourceOperationBuilderError(\n message: string,\n context?: Record<string, unknown>,\n): Error {\n return FrontendResourceUtils.buildConfigurationError(\n ErrorCustomMessageReference.CONFIGURATION,\n {\n message,\n component: 'useExecutionResourceOperationContextBuilder',\n ...context,\n },\n );\n}\n\nfunction hasOperationIdentifier(\n target: ExecutionResourceOperationTargetSelector,\n): target is Extract<ExecutionResourceOperationTargetSelector, { operationIdentifier: string }> {\n return 'operationIdentifier' in target;\n}\n\nfunction resolveExplicitOperationForTarget(\n resourceConfig: AnyFrontendResourceConfiguration,\n resourceType: string,\n target: Extract<ExecutionResourceOperationTargetSelector, { operationIdentifier: string }>,\n): FrontendResourceConfiguration_Operation {\n const matchingOperations = (resourceConfig.operations ?? []).filter((candidate) => {\n if (String(candidate.operationIdentifier) !== target.operationIdentifier) {\n return false;\n }\n if (target.variantType !== undefined && candidate.variantType !== target.variantType) {\n return false;\n }\n if (target.variantKey !== undefined && candidate.variantKey !== target.variantKey) {\n return false;\n }\n if (target.isOperationDefault !== undefined && candidate.isOperationDefault !== target.isOperationDefault) {\n return false;\n }\n if (target.isBulkOperation !== undefined && candidate.isBulkOperation !== target.isBulkOperation) {\n return false;\n }\n return true;\n });\n\n if (matchingOperations.length === 1) {\n return matchingOperations[0]!;\n }\n\n const defaultNonBulkOperations = matchingOperations.filter(\n (candidate) => candidate.isOperationDefault === true && candidate.isBulkOperation !== true,\n );\n if (\n target.variantKey === undefined\n && target.variantType === undefined\n && target.isOperationDefault === undefined\n && target.isBulkOperation === undefined\n && defaultNonBulkOperations.length === 1\n ) {\n return defaultNonBulkOperations[0]!;\n }\n\n throw buildExecutionResourceOperationBuilderError(\n matchingOperations.length === 0\n ? `Execution resource-operation builder cannot resolve operation \"${target.operationIdentifier}\" on resource \"${resourceType}\".`\n : `Execution resource-operation builder found ambiguous operation \"${target.operationIdentifier}\" on resource \"${resourceType}\".`,\n {\n resourceType,\n operationIdentifier: target.operationIdentifier,\n variantType: target.variantType,\n variantKey: target.variantKey,\n isOperationDefault: target.isOperationDefault,\n isBulkOperation: target.isBulkOperation,\n candidates: matchingOperations.map((candidate) => ({\n variantType: candidate.variantType,\n variantKey: candidate.variantKey,\n isOperationDefault: candidate.isOperationDefault,\n isBulkOperation: candidate.isBulkOperation,\n })),\n },\n );\n}\n\nfunction resolveOperationForTarget(\n resourceConfig: AnyFrontendResourceConfiguration | undefined,\n resourceType: string,\n target: ExecutionResourceOperationTargetSelector,\n registry: FrontendResourcesRegistry,\n contextResourceIdentifiers: FrontendResourceOperationContext['contextResourceIdentifiers'],\n contextualParameters: Record<string, string | number>,\n): FrontendResourceConfiguration_Operation {\n if (!resourceConfig) {\n throw buildExecutionResourceOperationBuilderError(\n `Execution resource-operation builder cannot resolve resource \"${resourceType}\" from the registry.`,\n { resourceType },\n );\n }\n\n if (hasOperationIdentifier(target)) {\n const operation = resolveExplicitOperationForTarget(resourceConfig, resourceType, target);\n\n const effectiveCoreOperation = resolveEffectiveCoreOperationFromOperation(operation);\n const requiresRuntimeAddressability = effectiveCoreOperation === CoreResourceOperation.READ\n || effectiveCoreOperation === CoreResourceOperation.UPDATE\n || effectiveCoreOperation === CoreResourceOperation.DELETE;\n if (\n requiresRuntimeAddressability\n && operation.isBulkOperation !== true\n && !isFrontendOperationAddressableForCurrentContext({\n resourceConfig,\n operation,\n registry,\n hasResourceId: frontendResourceUtils.getResourceId(contextResourceIdentifiers[resourceType]) !== '',\n contextResourceIdentifiers,\n contextualParameters,\n })\n ) {\n throw buildExecutionResourceOperationBuilderError(\n `Execution resource-operation builder resolved operation \"${target.operationIdentifier}\" on resource \"${resourceType}\", but the current context cannot address it.`,\n {\n resourceType,\n operationIdentifier: target.operationIdentifier,\n },\n );\n }\n\n return operation;\n }\n\n const requiresRuntimeAddressability = target.operationLike === CoreResourceOperation.READ\n || target.operationLike === CoreResourceOperation.UPDATE\n || target.operationLike === CoreResourceOperation.DELETE;\n const semanticOperation = target.requireAddressable || requiresRuntimeAddressability\n ? pickPreferredOperationForCoreSemanticAddressability({\n resourceConfig,\n operations: resourceConfig.operations ?? [],\n coreOperation: target.operationLike,\n registry,\n hasResourceId: frontendResourceUtils.getResourceId(contextResourceIdentifiers[resourceType]) !== '',\n allowBulk: target.allowBulk,\n requireFrontendAddressable: true,\n contextResourceIdentifiers,\n contextualParameters,\n })\n : pickPreferredOperationForCoreSemantic(\n resourceConfig.operations ?? [],\n target.operationLike,\n {\n requireAddressable: target.requireAddressable,\n allowBulk: target.allowBulk,\n },\n );\n\n if (!semanticOperation) {\n throw buildExecutionResourceOperationBuilderError(\n `Execution resource-operation builder cannot resolve a preferred ${String(target.operationLike)}-like operation on resource \"${resourceType}\".`,\n {\n resourceType,\n operationLike: target.operationLike,\n requireAddressable: target.requireAddressable,\n allowBulk: target.allowBulk,\n },\n );\n }\n\n return semanticOperation;\n}\n\nfunction overrideResourceContextSlot(params: {\n currentValue: FrontendResourceOperationContext['contextResourceIdentifiers'][string] | undefined;\n resourceId: string;\n}): FrontendResourceOperationContext['contextResourceIdentifiers'][string] {\n const fieldIdentifier = params.currentValue\n ? frontendResourceUtils.getFieldIdentifier(params.currentValue)\n : undefined;\n\n if (fieldIdentifier) {\n return {\n fieldIdentifier,\n resourceId: params.resourceId,\n };\n }\n\n return params.resourceId;\n}\n\nfunction getAdditionalContextCurrentObject(\n additionalContext?: Record<string, unknown>,\n): Record<string, unknown> | undefined {\n const currentObject = additionalContext?.currentObject ?? additionalContext?.resource;\n return currentObject && typeof currentObject === 'object' && !Array.isArray(currentObject)\n ? currentObject as Record<string, unknown>\n : undefined;\n}\n\nfunction resolveAdditionalContextResourceId(params: {\n additionalContext?: Record<string, unknown>;\n resourceConfig: AnyFrontendResourceConfiguration | undefined;\n}): string | undefined {\n const currentObject = getAdditionalContextCurrentObject(params.additionalContext);\n const candidate = currentObject?._id\n ?? (params.resourceConfig?.resourceFieldIdentifier\n ? currentObject?.[params.resourceConfig.resourceFieldIdentifier]\n : undefined);\n return typeof candidate === 'string' && candidate.length > 0 ? candidate : undefined;\n}\n\nexport function useExecutionResourceOperationContextBuilder(): ExecutionResourceOperationContextBuilderValue {\n const { registry } = useResourceRegistry();\n const executionRuntime = assertExecutionRuntimeContext(useContext(ExecutionRuntimeContext));\n\n const buildResourceOperationContext = useCallback<ExecutionResourceOperationContextBuilderValue['buildResourceOperationContext']>((target) => {\n const participation = target.participationRef\n ? executionRuntime.participations[target.participationRef]\n : undefined;\n\n if (target.participationRef && !participation) {\n throw buildExecutionResourceOperationBuilderError(\n `Execution resource-operation builder cannot resolve participation \"${target.participationRef}\".`,\n {\n participationRef: target.participationRef,\n },\n );\n }\n\n const resourceType = target.resourceType ?? (\n participation\n ? getExecutionParticipationResourceType(participation)\n : undefined\n );\n\n if (!resourceType) {\n throw buildExecutionResourceOperationBuilderError(\n 'Execution resource-operation builder requires either `resourceType` or `participationRef`.',\n {\n target,\n },\n );\n }\n\n let contextResourceIdentifiers: FrontendResourceOperationContext['contextResourceIdentifiers'] = {\n ...(executionRuntime.contextResourceIdentifiers ?? {}),\n ...(target.contextResourceIdentifiers ?? {}),\n };\n\n if (participation) {\n const participationContextIdentifier = buildExecutionParticipationContextIdentifier({\n participation,\n registry,\n });\n if (!participationContextIdentifier && !target.resourceId) {\n throw buildExecutionResourceOperationBuilderError(\n `Execution resource-operation builder cannot derive a concrete resource identifier from participation \"${target.participationRef}\".`,\n {\n participationRef: target.participationRef,\n resourceType,\n },\n );\n }\n if (participationContextIdentifier) {\n contextResourceIdentifiers[resourceType] = participationContextIdentifier;\n }\n }\n\n const resourceConfig = registry.resourceConfigurations[resourceType];\n const additionalContextResourceId = resolveAdditionalContextResourceId({\n additionalContext: target.additionalContext,\n resourceConfig,\n });\n const resolvedResourceId = target.resourceId ?? additionalContextResourceId;\n if (resolvedResourceId && !participation) {\n /*\n * A record opened by an id the target names itself is reached in ITS scope, not the execution's (#2746, the\n * #2741 rule the composite and embed builders apply). The runtime context is the execution view's, and the view\n * merges the viewer's working scope into it (a list selected in a quick-switcher): carried over, that list became\n * a parent of this record's chain and the record was read under it, and refused when it belongs to another. The\n * runtime's own record keeps the whole context; identifiers the target passes itself are its own statement. A\n * PARTICIPATION is left as it was: its id is bound from that same runtime context, which is what identifies it.\n */\n const runtimeIdentifiers = executionRuntime.contextResourceIdentifiers ?? {};\n const scopedRuntimeIdentifiers = scopeReferencedRecord({\n hostIdentifiers: runtimeIdentifiers,\n hostContextualParameters: {},\n hostRecord: { resourceType, id: frontendResourceUtils.getResourceId(runtimeIdentifiers[resourceType]) },\n targetResourceType: resourceType,\n targetId: resolvedResourceId,\n registry,\n }).identifiers;\n contextResourceIdentifiers = { ...scopedRuntimeIdentifiers, ...(target.contextResourceIdentifiers ?? {}) };\n }\n if (resolvedResourceId) {\n contextResourceIdentifiers[resourceType] = overrideResourceContextSlot({\n currentValue: contextResourceIdentifiers[resourceType],\n resourceId: resolvedResourceId,\n });\n }\n\n const contextualParameters = FrontendResourceUtils.buildContextualParameters(\n contextResourceIdentifiers,\n registry,\n );\n const operation = resolveOperationForTarget(\n resourceConfig,\n resourceType,\n target,\n registry,\n contextResourceIdentifiers,\n contextualParameters,\n );\n\n const parentResourcesRequirements = frontendResourceUtils.buildParentResourcesRequirements(\n resourceType as ResourceType,\n contextResourceIdentifiers,\n registry,\n target.relationshipFieldOverrides,\n );\n\n return frontendResourceUtils.createFrontendResourceOperationContextFromOperation({\n resourceType: resourceType as ResourceType,\n operation,\n contextResourceIdentifiers,\n additionalContext: target.additionalContext,\n parentResourcesRequirements,\n });\n }, [\n executionRuntime.contextResourceIdentifiers,\n executionRuntime.participations,\n registry,\n ]);\n\n return {\n buildResourceOperationContext,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useExecutionResourceOperationContextBuilder.js","sourceRoot":"","sources":["../../../../src/core/execution/useExecutionResourceOperationContextBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,GAGtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,4CAA4C,EAC5C,qCAAqC,GACtC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,GACxB,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QAEF,MAAM,2BAA2B,GAAG,qBAAqB,CAAC,gCAAgC,CACxF,YAA4B,EAC5B,0BAA0B,EAC1B,QAAQ,EACR,MAAM,CAAC,0BAA0B,CAClC,CAAC;QAEF,OAAO,qBAAqB,CAAC,mDAAmD,CAAC;YAC/E,YAAY,EAAE,YAA4B;YAC1C,SAAS;YACT,0BAA0B;YAC1B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;YAC3C,2BAA2B;SAC5B,CAAC,CAAC;IACL,CAAC,EAAE;QACD,gBAAgB,CAAC,0BAA0B;QAC3C,gBAAgB,CAAC,cAAc;QAC/B,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO;QACL,6BAA6B;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useContext } from 'react';\n\nimport {\n ErrorCustomMessageReference,\n CoreResourceOperation,\n ResourceOperationVariantType,\n type ResourceType,\n} from '@wildo-ai/saas-models';\n\nimport {\n buildExecutionParticipationContextIdentifier,\n getExecutionParticipationResourceType,\n} from './execution-participation.utils';\nimport {\n assertExecutionRuntimeContext,\n ExecutionRuntimeContext,\n} from './ExecutionRuntimeContext';\nimport {\n frontendResourceUtils,\n FrontendResourceUtils,\n} from '~wildo-frontend-lib/core/resources/frontend-resource.utils';\nimport {\n pickPreferredOperationForCoreSemantic,\n resolveEffectiveCoreOperationFromOperation,\n} from '~wildo-frontend-lib/core/resources/operation-semantics.frontend.utils';\nimport {\n isFrontendOperationAddressableForCurrentContext,\n pickPreferredOperationForCoreSemanticAddressability,\n} from '~wildo-frontend-lib/core/resources/resource-addressability.frontend.utils';\nimport type {\n AnyFrontendResourceConfiguration,\n FrontendResourceConfiguration_Operation,\n FrontendResourceOperationContext,\n FrontendResourcesRegistry,\n} from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { scopeReferencedRecord } from '~wildo-frontend-lib/core/resources/referenced-record-scope.frontend.utils';\n\ntype ExecutionResourceOperationTargetSelector =\n | {\n operationIdentifier: string;\n variantType?: ResourceOperationVariantType;\n variantKey?: string;\n isOperationDefault?: boolean;\n isBulkOperation?: boolean;\n }\n | {\n operationLike: CoreResourceOperation;\n requireAddressable?: boolean;\n allowBulk?: boolean;\n };\n\nexport type ExecutionResourceOperationTarget = ExecutionResourceOperationTargetSelector & {\n resourceType?: string;\n resourceId?: string;\n participationRef?: string;\n contextResourceIdentifiers?: FrontendResourceOperationContext['contextResourceIdentifiers'];\n relationshipFieldOverrides?: Record<ResourceType, string>;\n additionalContext?: Record<string, unknown>;\n};\n\nexport interface ExecutionResourceOperationContextBuilderValue {\n buildResourceOperationContext: (\n target: ExecutionResourceOperationTarget,\n ) => FrontendResourceOperationContext;\n}\n\nfunction buildExecutionResourceOperationBuilderError(\n message: string,\n context?: Record<string, unknown>,\n): Error {\n return FrontendResourceUtils.buildConfigurationError(\n ErrorCustomMessageReference.CONFIGURATION,\n {\n message,\n component: 'useExecutionResourceOperationContextBuilder',\n ...context,\n },\n );\n}\n\nfunction hasOperationIdentifier(\n target: ExecutionResourceOperationTargetSelector,\n): target is Extract<ExecutionResourceOperationTargetSelector, { operationIdentifier: string }> {\n return 'operationIdentifier' in target;\n}\n\nfunction resolveExplicitOperationForTarget(\n resourceConfig: AnyFrontendResourceConfiguration,\n resourceType: string,\n target: Extract<ExecutionResourceOperationTargetSelector, { operationIdentifier: string }>,\n): FrontendResourceConfiguration_Operation {\n const matchingOperations = (resourceConfig.operations ?? []).filter((candidate) => {\n if (String(candidate.operationIdentifier) !== target.operationIdentifier) {\n return false;\n }\n if (target.variantType !== undefined && candidate.variantType !== target.variantType) {\n return false;\n }\n if (target.variantKey !== undefined && candidate.variantKey !== target.variantKey) {\n return false;\n }\n if (target.isOperationDefault !== undefined && candidate.isOperationDefault !== target.isOperationDefault) {\n return false;\n }\n if (target.isBulkOperation !== undefined && candidate.isBulkOperation !== target.isBulkOperation) {\n return false;\n }\n return true;\n });\n\n if (matchingOperations.length === 1) {\n return matchingOperations[0]!;\n }\n\n const defaultNonBulkOperations = matchingOperations.filter(\n (candidate) => candidate.isOperationDefault === true && candidate.isBulkOperation !== true,\n );\n if (\n target.variantKey === undefined\n && target.variantType === undefined\n && target.isOperationDefault === undefined\n && target.isBulkOperation === undefined\n && defaultNonBulkOperations.length === 1\n ) {\n return defaultNonBulkOperations[0]!;\n }\n\n throw buildExecutionResourceOperationBuilderError(\n matchingOperations.length === 0\n ? `Execution resource-operation builder cannot resolve operation \"${target.operationIdentifier}\" on resource \"${resourceType}\".`\n : `Execution resource-operation builder found ambiguous operation \"${target.operationIdentifier}\" on resource \"${resourceType}\".`,\n {\n resourceType,\n operationIdentifier: target.operationIdentifier,\n variantType: target.variantType,\n variantKey: target.variantKey,\n isOperationDefault: target.isOperationDefault,\n isBulkOperation: target.isBulkOperation,\n candidates: matchingOperations.map((candidate) => ({\n variantType: candidate.variantType,\n variantKey: candidate.variantKey,\n isOperationDefault: candidate.isOperationDefault,\n isBulkOperation: candidate.isBulkOperation,\n })),\n },\n );\n}\n\nfunction resolveOperationForTarget(\n resourceConfig: AnyFrontendResourceConfiguration | undefined,\n resourceType: string,\n target: ExecutionResourceOperationTargetSelector,\n registry: FrontendResourcesRegistry,\n contextResourceIdentifiers: FrontendResourceOperationContext['contextResourceIdentifiers'],\n contextualParameters: Record<string, string | number>,\n): FrontendResourceConfiguration_Operation {\n if (!resourceConfig) {\n throw buildExecutionResourceOperationBuilderError(\n `Execution resource-operation builder cannot resolve resource \"${resourceType}\" from the registry.`,\n { resourceType },\n );\n }\n\n if (hasOperationIdentifier(target)) {\n const operation = resolveExplicitOperationForTarget(resourceConfig, resourceType, target);\n\n const effectiveCoreOperation = resolveEffectiveCoreOperationFromOperation(operation);\n const requiresRuntimeAddressability = effectiveCoreOperation === CoreResourceOperation.READ\n || effectiveCoreOperation === CoreResourceOperation.UPDATE\n || effectiveCoreOperation === CoreResourceOperation.DELETE;\n if (\n requiresRuntimeAddressability\n && operation.isBulkOperation !== true\n && !isFrontendOperationAddressableForCurrentContext({\n resourceConfig,\n operation,\n registry,\n hasResourceId: frontendResourceUtils.getResourceId(contextResourceIdentifiers[resourceType]) !== '',\n contextResourceIdentifiers,\n contextualParameters,\n })\n ) {\n throw buildExecutionResourceOperationBuilderError(\n `Execution resource-operation builder resolved operation \"${target.operationIdentifier}\" on resource \"${resourceType}\", but the current context cannot address it.`,\n {\n resourceType,\n operationIdentifier: target.operationIdentifier,\n },\n );\n }\n\n return operation;\n }\n\n const requiresRuntimeAddressability = target.operationLike === CoreResourceOperation.READ\n || target.operationLike === CoreResourceOperation.UPDATE\n || target.operationLike === CoreResourceOperation.DELETE;\n const semanticOperation = target.requireAddressable || requiresRuntimeAddressability\n ? pickPreferredOperationForCoreSemanticAddressability({\n resourceConfig,\n operations: resourceConfig.operations ?? [],\n coreOperation: target.operationLike,\n registry,\n hasResourceId: frontendResourceUtils.getResourceId(contextResourceIdentifiers[resourceType]) !== '',\n allowBulk: target.allowBulk,\n /*\n * The RUNTIME addressability check (does the current context carry the ids the operation's route needs?) is what a\n * READ/UPDATE/DELETE must pass to be called at all. Whether the operation also has a routable PAGE is a different\n * question, asked only when the target says so through `requireAddressable`: an execution action EXECUTES or EMBEDS\n * the operation as often as it navigates to it, and an operation surfaced `EMBEDDED` (a dialog, an inline action) is\n * fully callable. Requiring a page here refused every such operation, so the to-do list flow view's inspector, whose\n * DELETE on to-dos, tasks and lists is `EMBEDDED`, offered no Delete at all (#3859). The explicit-operation branch\n * above never asked for a page either. A page-routable variant is still preferred among several candidates\n * (`pickPreferredOperationForCoreSemantic`).\n */\n requireFrontendAddressable: target.requireAddressable === true,\n contextResourceIdentifiers,\n contextualParameters,\n })\n : pickPreferredOperationForCoreSemantic(\n resourceConfig.operations ?? [],\n target.operationLike,\n {\n requireAddressable: target.requireAddressable,\n allowBulk: target.allowBulk,\n },\n );\n\n if (!semanticOperation) {\n throw buildExecutionResourceOperationBuilderError(\n `Execution resource-operation builder cannot resolve a preferred ${String(target.operationLike)}-like operation on resource \"${resourceType}\".`,\n {\n resourceType,\n operationLike: target.operationLike,\n requireAddressable: target.requireAddressable,\n allowBulk: target.allowBulk,\n },\n );\n }\n\n return semanticOperation;\n}\n\nfunction overrideResourceContextSlot(params: {\n currentValue: FrontendResourceOperationContext['contextResourceIdentifiers'][string] | undefined;\n resourceId: string;\n}): FrontendResourceOperationContext['contextResourceIdentifiers'][string] {\n const fieldIdentifier = params.currentValue\n ? frontendResourceUtils.getFieldIdentifier(params.currentValue)\n : undefined;\n\n if (fieldIdentifier) {\n return {\n fieldIdentifier,\n resourceId: params.resourceId,\n };\n }\n\n return params.resourceId;\n}\n\nfunction getAdditionalContextCurrentObject(\n additionalContext?: Record<string, unknown>,\n): Record<string, unknown> | undefined {\n const currentObject = additionalContext?.currentObject ?? additionalContext?.resource;\n return currentObject && typeof currentObject === 'object' && !Array.isArray(currentObject)\n ? currentObject as Record<string, unknown>\n : undefined;\n}\n\nfunction resolveAdditionalContextResourceId(params: {\n additionalContext?: Record<string, unknown>;\n resourceConfig: AnyFrontendResourceConfiguration | undefined;\n}): string | undefined {\n const currentObject = getAdditionalContextCurrentObject(params.additionalContext);\n const candidate = currentObject?._id\n ?? (params.resourceConfig?.resourceFieldIdentifier\n ? currentObject?.[params.resourceConfig.resourceFieldIdentifier]\n : undefined);\n return typeof candidate === 'string' && candidate.length > 0 ? candidate : undefined;\n}\n\nexport function useExecutionResourceOperationContextBuilder(): ExecutionResourceOperationContextBuilderValue {\n const { registry } = useResourceRegistry();\n const executionRuntime = assertExecutionRuntimeContext(useContext(ExecutionRuntimeContext));\n\n const buildResourceOperationContext = useCallback<ExecutionResourceOperationContextBuilderValue['buildResourceOperationContext']>((target) => {\n const participation = target.participationRef\n ? executionRuntime.participations[target.participationRef]\n : undefined;\n\n if (target.participationRef && !participation) {\n throw buildExecutionResourceOperationBuilderError(\n `Execution resource-operation builder cannot resolve participation \"${target.participationRef}\".`,\n {\n participationRef: target.participationRef,\n },\n );\n }\n\n const resourceType = target.resourceType ?? (\n participation\n ? getExecutionParticipationResourceType(participation)\n : undefined\n );\n\n if (!resourceType) {\n throw buildExecutionResourceOperationBuilderError(\n 'Execution resource-operation builder requires either `resourceType` or `participationRef`.',\n {\n target,\n },\n );\n }\n\n let contextResourceIdentifiers: FrontendResourceOperationContext['contextResourceIdentifiers'] = {\n ...(executionRuntime.contextResourceIdentifiers ?? {}),\n ...(target.contextResourceIdentifiers ?? {}),\n };\n\n if (participation) {\n const participationContextIdentifier = buildExecutionParticipationContextIdentifier({\n participation,\n registry,\n });\n if (!participationContextIdentifier && !target.resourceId) {\n throw buildExecutionResourceOperationBuilderError(\n `Execution resource-operation builder cannot derive a concrete resource identifier from participation \"${target.participationRef}\".`,\n {\n participationRef: target.participationRef,\n resourceType,\n },\n );\n }\n if (participationContextIdentifier) {\n contextResourceIdentifiers[resourceType] = participationContextIdentifier;\n }\n }\n\n const resourceConfig = registry.resourceConfigurations[resourceType];\n const additionalContextResourceId = resolveAdditionalContextResourceId({\n additionalContext: target.additionalContext,\n resourceConfig,\n });\n const resolvedResourceId = target.resourceId ?? additionalContextResourceId;\n if (resolvedResourceId && !participation) {\n /*\n * A record opened by an id the target names itself is reached in ITS scope, not the execution's (#2746, the\n * #2741 rule the composite and embed builders apply). The runtime context is the execution view's, and the view\n * merges the viewer's working scope into it (a list selected in a quick-switcher): carried over, that list became\n * a parent of this record's chain and the record was read under it, and refused when it belongs to another. The\n * runtime's own record keeps the whole context; identifiers the target passes itself are its own statement. A\n * PARTICIPATION is left as it was: its id is bound from that same runtime context, which is what identifies it.\n */\n const runtimeIdentifiers = executionRuntime.contextResourceIdentifiers ?? {};\n const scopedRuntimeIdentifiers = scopeReferencedRecord({\n hostIdentifiers: runtimeIdentifiers,\n hostContextualParameters: {},\n hostRecord: { resourceType, id: frontendResourceUtils.getResourceId(runtimeIdentifiers[resourceType]) },\n targetResourceType: resourceType,\n targetId: resolvedResourceId,\n registry,\n }).identifiers;\n contextResourceIdentifiers = { ...scopedRuntimeIdentifiers, ...(target.contextResourceIdentifiers ?? {}) };\n }\n if (resolvedResourceId) {\n contextResourceIdentifiers[resourceType] = overrideResourceContextSlot({\n currentValue: contextResourceIdentifiers[resourceType],\n resourceId: resolvedResourceId,\n });\n }\n\n const contextualParameters = FrontendResourceUtils.buildContextualParameters(\n contextResourceIdentifiers,\n registry,\n );\n const operation = resolveOperationForTarget(\n resourceConfig,\n resourceType,\n target,\n registry,\n contextResourceIdentifiers,\n contextualParameters,\n );\n\n const parentResourcesRequirements = frontendResourceUtils.buildParentResourcesRequirements(\n resourceType as ResourceType,\n contextResourceIdentifiers,\n registry,\n target.relationshipFieldOverrides,\n );\n\n return frontendResourceUtils.createFrontendResourceOperationContextFromOperation({\n resourceType: resourceType as ResourceType,\n operation,\n contextResourceIdentifiers,\n additionalContext: target.additionalContext,\n parentResourcesRequirements,\n });\n }, [\n executionRuntime.contextResourceIdentifiers,\n executionRuntime.participations,\n registry,\n ]);\n\n return {\n buildResourceOperationContext,\n };\n}\n"]}
|