@tearleads/windowing 0.2.29 → 0.2.31

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.
@@ -46,8 +46,8 @@ id; `useOptionalTheme` returns `null` outside a provider.
46
46
 
47
47
  Mount one provider above everything themed. It stamps the attributes before
48
48
  the browser paints and removes them on unmount; under a dark scheme,
49
- `tokens.css` sets `color-scheme: dark`. Tearleads sets its themes per host
50
- profile in `packages/app/src/host/AppHostConfig.ts`.
49
+ [`tokens.css`][tokens] sets `color-scheme: dark`. Tearleads sets its themes per
50
+ host profile in [`packages/app/src/host/AppHostConfig.ts`][host-profile].
51
51
 
52
52
  ## Wallpapers and Display Properties
53
53
 
@@ -118,14 +118,15 @@ chrome's look without rendering a window.
118
118
 
119
119
  The stylesheets read design tokens (colors, spacing, radii, shadows, and the
120
120
  `--window-bar-*` and `--tearleads-window-titlebar-*` chrome tokens). The package
121
- entry imports `tokens.css`, which defines every one of them under
121
+ entry imports [`tokens.css`][tokens], which defines every one of them under
122
122
  `:where(:root)`, so a page that defines none still renders a complete light
123
123
  window. That rule has zero specificity: any `:root` rule, theme, or scoped block
124
124
  the host writes overrides it. Tearleads overrides them with its own themes in
125
- `packages/ui/src/styles.css` and `packages/app/src/shell/layout/AppChrome.css`.
125
+ [`packages/ui/src/styles.css`][ui-styles] and
126
+ [`packages/app/src/shell/layout/AppChrome.css`][app-chrome].
126
127
  The routed shell also reads the screen's safe areas (`--safe-area-*`) and, under
127
128
  `:root[data-navigation-mode="routed"]`, a 44px `--control-height` and 24px
128
- `--control-icon-size`, which `tokens.css` defines the same way.
129
+ `--control-icon-size`, which [`tokens.css`][tokens] defines the same way.
129
130
 
130
131
  Several defaults derive from `--color-dark`, the foreground: the window edge
131
132
  (`--border-strong-color`), the hover and selection chip (`--emphasis-surface`
@@ -134,8 +135,8 @@ and `--emphasis-text`), and `--color-hairline`. A dark theme that sets only the
134
135
  Tearleads' dark theme does.
135
136
 
136
137
  The window, menus, and routed shell draw thin scrollbars in `--scrollbar-thumb`
137
- over `--scrollbar-track`. `tokens.css` leaves both unset, so the thumb falls
138
- back to `--color-dark` at 32%, mixed on each surface so it follows the theme
138
+ over `--scrollbar-track`. [`tokens.css`][tokens] leaves both unset, so the thumb
139
+ falls back to `--color-dark` at 32%, mixed on each surface so it follows the theme
139
140
  there, including a scoped one, and the track to transparent. They use the
140
141
  standard `scrollbar-width` and
141
142
  `scrollbar-color` properties, which Firefox, Chromium 121, and Safari 26.2
@@ -145,8 +146,8 @@ scrolls the same way: `scrollbar-color` inherits from the surface, and
145
146
  specificity, so any host rule wins.
146
147
 
147
148
  The window paints its background, behind its body and sidebar, with
148
- `--window-background`. `tokens.css` leaves it unset, so it falls back to
149
- `--color-light` wherever that is set, including a scoped theme. Content sets
149
+ `--window-background`. [`tokens.css`][tokens] leaves it unset, so it falls back
150
+ to `--color-light` wherever that is set, including a scoped theme. Content sets
150
151
  its own window's background with `useWindowBackground`, while it is mounted;
151
152
  `undefined` keeps the default. A document viewer can use it to set its page
152
153
  apart from the window around it:
@@ -165,3 +166,8 @@ Windows and menus lay out `border-box`, the box model their sizes assume. Since
165
166
  `box-sizing` does not inherit, a zero-specificity rule sets it on the window or
166
167
  menu and everything inside, including window content; any host rule overrides
167
168
  it.
169
+
170
+ [tokens]: https://github.com/a2f0/tearleads/blob/main/packages/windowing/src/tokens.css
171
+ [host-profile]: https://github.com/a2f0/tearleads/blob/main/packages/app/src/host/AppHostConfig.ts
172
+ [ui-styles]: https://github.com/a2f0/tearleads/blob/main/packages/ui/src/styles.css
173
+ [app-chrome]: https://github.com/a2f0/tearleads/blob/main/packages/app/src/shell/layout/AppChrome.css
package/docs/launcher.md CHANGED
@@ -27,11 +27,12 @@ receives where the menu opened, for placing a new window near it:
27
27
  The button is named "Menu" unless `label` says otherwise, and announces its
28
28
  menu with `aria-haspopup` and `aria-expanded`. By default it is a square,
29
29
  borderless control the height of the bar's controls, lit while hovered,
30
- focused, or open (`StartMenu.css`). A `className` replaces that styling, so a
30
+ focused, or open ([`StartMenu.css`][start-menu-styles]). A `className` replaces
31
+ that styling, so a
31
32
  host's own button styles apply alone. A menu that needs more than a list passes
32
33
  `renderMenu`, which renders the open menu itself and receives its `position`
33
34
  and a `close` callback. Tearleads' footer does this in
34
- `packages/app/src/shell/pane/footer/PaneFooter.tsx`.
35
+ [`packages/app/src/shell/pane/footer/PaneFooter.tsx`][pane-footer].
35
36
 
36
37
  ## Launching mini-apps
37
38
 
@@ -124,7 +125,9 @@ writes one JSON string, so the host chooses where it lives:
124
125
  `createOpfsDesktopStateStorage` keeps a file in the origin private file system,
125
126
  `createMemoryDesktopStateStorage` keeps it in memory (the default), and a host
126
127
  can wrap its own store, as Tearleads wraps each identity's encrypted blob store
127
- in `packages/app/src/shell/pane/shell/usePaneDesktopStateStorage.ts`. Keep the
128
+ in
129
+ [`packages/app/src/shell/pane/shell/usePaneDesktopStateStorage.ts`][desktop-storage].
130
+ Keep the
128
131
  adapter stable: a new adapter reloads the layout from what it holds. Moves made
129
132
  before the load finishes win and are saved with the stored layout; when the
130
133
  read fails, moves stay in memory and nothing is written.
@@ -160,4 +163,9 @@ offers, such as to those the session may see, and
160
163
  Overlays that should fill the content pane rather than the screen portal into
161
164
  `useRoutedPaneOverlayHost().host`. The shell sizes to the box its host gives
162
165
  `.routed-pane`, as a grid item or a block with a height. Tearleads dresses it in
163
- `packages/app/src/shell/layout/routed/AppRoutedPane.tsx`.
166
+ [`packages/app/src/shell/layout/routed/AppRoutedPane.tsx`][app-routed-pane].
167
+
168
+ [start-menu-styles]: https://github.com/a2f0/tearleads/blob/main/packages/windowing/src/menu/StartMenu.css
169
+ [pane-footer]: https://github.com/a2f0/tearleads/blob/main/packages/app/src/shell/pane/footer/PaneFooter.tsx
170
+ [desktop-storage]: https://github.com/a2f0/tearleads/blob/main/packages/app/src/shell/pane/shell/usePaneDesktopStateStorage.ts
171
+ [app-routed-pane]: https://github.com/a2f0/tearleads/blob/main/packages/app/src/shell/layout/routed/AppRoutedPane.tsx
@@ -15,25 +15,28 @@ bun run --cwd packages/windowing package:smoke # pack, install, render, typeche
15
15
  The built package is ES modules with declarations and source maps, plus every
16
16
  stylesheet. React and react-dom are peer dependencies from 19.2, the first
17
17
  release with `useEffectEvent`; Phosphor icons is its one dependency. The
18
- stylesheets and the entry module (which imports `tokens.css`) are declared side
19
- effects, so bundlers that trust `sideEffects` keep the token defaults.
20
- `src/publishedPackage.test.ts` checks the built manifest and that no module
21
- reaches outside the package, so a new workspace import fails the package's tests
22
- rather than the publish. The declarations drop the stylesheet imports tsc keeps
18
+ stylesheets and the entry module (which imports [`tokens.css`][tokens]) are
19
+ declared side effects, so bundlers that trust `sideEffects` keep the token
20
+ defaults. [`src/publishedPackage.test.ts`][package-tests] checks the built
21
+ manifest, documentation links, and that no module reaches outside the package,
22
+ so a new workspace import fails the package's tests rather than the publish.
23
+ The declarations drop the stylesheet imports tsc keeps
23
24
  in them, which a consumer's typecheck could not resolve. The smoke script
24
25
  installs the lowest React the peer range admits, typechecks against the
25
26
  declarations with TypeScript's defaults, and bundles a named import with webpack.
26
27
 
27
- Merging to `main` publishes. When `packages/windowing` changes there,
28
- `.github/workflows/windowing-publish.yml` publishes the version in
29
- `package.json` if it is a stable `x.y.z` newer than npm's `latest`; a merge that
28
+ Merging to `main` publishes. When [`packages/windowing`][windowing-source] changes
29
+ there, [`.github/workflows/windowing-publish.yml`][windowing-publish] publishes
30
+ the version in [`package.json`][workspace-manifest] if it is a stable `x.y.z`
31
+ newer than npm's `latest`; a merge that
30
32
  leaves the version alone, a re-run, or a run that finishes after a newer release
31
33
  succeeds without publishing, as decided by `agent-tool release plan`.
32
34
  The workflow authenticates with
33
35
  [npm trusted publishing](https://docs.npmjs.com/trusted-publishers): npm accepts
34
36
  the job's GitHub OIDC token instead of an npm token, and attaches provenance to
35
37
  each version. On npmjs.com the package's trusted publisher names the `a2f0`
36
- owner, the `tearleads` repository, the `windowing-publish.yml` workflow, and
38
+ owner, the `tearleads` repository, the
39
+ [`windowing-publish.yml`][windowing-publish] workflow, and
37
40
  the `npm` environment, which the repository restricts to `main`. Renaming the
38
41
  workflow or the environment breaks publishing until that setting matches.
39
42
 
@@ -48,8 +51,9 @@ bun run publish:npm windowing
48
51
 
49
52
  Windowing has no workspace dependencies, and its React peers and Phosphor
50
53
  dependency already exist on npm, so it publishes on its own.
51
- `scripts/release/publishNpmPackage.sh` publishes each npm package by its
52
- directory name; `bun run --cwd packages/windowing publish:npm` runs it for
54
+ [`scripts/release/publishNpmPackage.sh`][publish-npm-package] publishes each npm
55
+ package by its directory name; `bun run --cwd packages/windowing publish:npm`
56
+ runs it for
53
57
  windowing, and the workflow runs it too.
54
58
 
55
59
  The command rebuilds into a fresh temporary directory, publishes its generated
@@ -68,7 +72,15 @@ Run `package:smoke` separately before a release to verify the packed package in
68
72
  an external consumer. It needs the network to install the consumer dependencies.
69
73
 
70
74
  `ship-pr` bumps changed workspace packages before review and merge; the generated
71
- manifest copies `version` from `package.json`. For a release outside that flow,
72
- bump the version yourself before publishing. The manifest names this repository,
75
+ manifest copies `version` from [`package.json`][workspace-manifest]. For a release
76
+ outside that flow, bump the version yourself before publishing. The manifest
77
+ names this repository,
73
78
  which npm requires of a version with provenance, and declares
74
79
  `"license": "UNLICENSED"`.
80
+
81
+ [tokens]: https://github.com/a2f0/tearleads/blob/main/packages/windowing/src/tokens.css
82
+ [package-tests]: https://github.com/a2f0/tearleads/blob/main/packages/windowing/src/publishedPackage.test.ts
83
+ [windowing-source]: https://github.com/a2f0/tearleads/tree/main/packages/windowing
84
+ [windowing-publish]: https://github.com/a2f0/tearleads/blob/main/.github/workflows/windowing-publish.yml
85
+ [workspace-manifest]: https://github.com/a2f0/tearleads/blob/main/packages/windowing/package.json
86
+ [publish-npm-package]: https://github.com/a2f0/tearleads/blob/main/scripts/release/publishNpmPackage.sh
package/docs/windows.md CHANGED
@@ -71,6 +71,8 @@ useWindowTitleBarAction(
71
71
 
72
72
  Memoized `buttonProps` forwards `ref`, `aria-expanded`, and `onMouseDown` to
73
73
  popup triggers. Both toolbars place Refresh last; it also remains in View.
74
+ While a `useWindowRefreshMenuItem` registration reports `refreshing`, Refresh is
75
+ disabled, announced as `aria-busy`, and shows a turning ring instead of its icon.
74
76
 
75
77
  Windows with an `appId` reserve the toolbar and offer route-history Back.
76
78
  With `historyBack={false}`, the row appears when actions register, then stays.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tearleads/windowing",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
4
4
  "description": "App-agnostic window management for React: window state, window chrome, and the menu and sidebar primitives it renders with.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -2,6 +2,7 @@ import { type PropsWithChildren } from "react";
2
2
  import { type WindowBackAction, type WindowBackActionInput, type WindowTitleBarActionInput } from "./WindowChromeActions.js";
3
3
  import type { WindowMenuItem } from "./WindowMenuBar.js";
4
4
  import type { WindowTitleBarAction } from "./WindowTitleBar.js";
5
+ import { type WindowRefreshMenuItem } from "./windowMenuRegistrations.js";
5
6
  interface WindowRefreshMenuItemInput {
6
7
  disabled?: boolean;
7
8
  label?: string;
@@ -19,7 +20,7 @@ interface WindowFileMenuItemInput {
19
20
  export declare function WindowMenuProvider({ children }: PropsWithChildren): import("react").JSX.Element;
20
21
  export declare function useWindowFileMenuItems(): WindowMenuItem[];
21
22
  export declare function useWindowViewMenuItems(): WindowMenuItem[];
22
- export declare function useWindowRefreshMenuItemValue(): WindowMenuItem | null;
23
+ export declare function useWindowRefreshMenuItemValue(): WindowRefreshMenuItem | null;
23
24
  export declare function useWindowTitleBarActions(): WindowTitleBarAction[];
24
25
  export declare function useWindowBackActionValue(): WindowBackAction | null;
25
26
  export declare function useWindowToolbarReserved(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"WindowMenuContext.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/window/WindowMenuContext.tsx"],"names":[],"mappings":";AAAA,O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AAI,IAAI;QAC/B,oBAAoB,EAAE,+BAA+B;QACrD,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,uBAAuB;QACrC,cAAc,EAAE,yBAAyB;KAC1C,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n createContext,\n type PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { useWindowItemRegistration } from \"./useWindowItemRegistration\";\nimport {\n sameWindowItem,\n selectHighestPriorityItem,\n useWindowItemRegistry,\n} from \"./useWindowItemRegistry\";\nimport { useWindowToolbarReservationRegistry } from \"./useWindowToolbarReservationRegistry\";\nimport {\n createBackAction,\n createRegisteredBackAction,\n createRegisteredTitleBarAction,\n createTitleBarActions,\n type RegisteredWindowBackAction,\n type RegisteredWindowTitleBarAction,\n type WindowBackAction,\n type WindowBackActionInput,\n type WindowTitleBarActionInput,\n} from \"./WindowChromeActions\";\nimport type { WindowMenuItem } from \"./WindowMenuBar\";\nimport type { WindowTitleBarAction } from \"./WindowTitleBar\";\nimport {\n createMenuItems,\n createRefreshMenuItem,\n REFRESH_LABEL,\n type RegisteredWindowMenuItem,\n type RegisteredWindowRefreshMenuItem,\n} from \"./windowMenuRegistrations\";\n\ninterface WindowRefreshMenuItemInput {\n disabled?: boolean;\n label?: string;\n onRefresh: () => unknown;\n priority?: number;\n refreshing?: boolean;\n}\n\ninterface WindowFileMenuItemInput {\n disabled?: boolean;\n id: string;\n label: string;\n onClick: () => unknown;\n priority?: number;\n}\n\nfunction createRegisteredMenuItem(\n item: WindowFileMenuItemInput,\n onClick: () => unknown,\n): RegisteredWindowMenuItem {\n return {\n disabled: item.disabled ?? false,\n id: item.id,\n label: item.label,\n onClick,\n priority: item.priority ?? 0,\n };\n}\n\nfunction createRegisteredRefreshMenuItem(\n item: WindowRefreshMenuItemInput,\n onRefresh: () => unknown,\n): RegisteredWindowRefreshMenuItem {\n return {\n disabled: item.disabled ?? false,\n label: item.label ?? REFRESH_LABEL,\n onRefresh,\n priority: item.priority ?? 0,\n refreshing: item.refreshing ?? false,\n };\n}\n\ninterface WindowMenuContextValue {\n fileMenuItems: WindowMenuItem[];\n viewMenuItems: WindowMenuItem[];\n /**\n * The winning refresh registration, also folded into `viewMenuItems` for the\n * windowed menu bar. Exposed on its own for the Refresh button shared by the\n * windowed toolbar and routed app bar.\n */\n refreshMenuItem: WindowMenuItem | null;\n titleBarActions: WindowTitleBarAction[];\n backAction: WindowBackAction | null;\n toolbarReserved: boolean;\n toolbarReservationReleased: boolean;\n registerFileMenuItem: (id: object, item: RegisteredWindowMenuItem) => void;\n unregisterFileMenuItem: (id: object) => void;\n registerViewMenuItem: (id: object, item: RegisteredWindowMenuItem) => void;\n unregisterViewMenuItem: (id: object) => void;\n registerTitleBarAction: (\n id: object,\n item: RegisteredWindowTitleBarAction,\n ) => void;\n unregisterTitleBarAction: (id: object) => void;\n registerBackAction: (id: object, item: RegisteredWindowBackAction) => void;\n unregisterBackAction: (id: object) => void;\n registerRefreshMenuItem: (\n id: object,\n item: RegisteredWindowRefreshMenuItem,\n ) => void;\n unregisterRefreshMenuItem: (id: object) => void;\n registerToolbarReservation: (id: object, reserved: boolean) => void;\n unregisterToolbarReservation: (id: object) => void;\n}\n\nconst WindowMenuContext = createContext<WindowMenuContextValue>({\n fileMenuItems: [],\n viewMenuItems: [],\n refreshMenuItem: null,\n titleBarActions: [],\n backAction: null,\n toolbarReserved: false,\n toolbarReservationReleased: false,\n registerFileMenuItem: () => {},\n unregisterFileMenuItem: () => {},\n registerViewMenuItem: () => {},\n unregisterViewMenuItem: () => {},\n registerTitleBarAction: () => {},\n unregisterTitleBarAction: () => {},\n registerBackAction: () => {},\n unregisterBackAction: () => {},\n registerRefreshMenuItem: () => {},\n unregisterRefreshMenuItem: () => {},\n registerToolbarReservation: () => {},\n unregisterToolbarReservation: () => {},\n});\n\nfunction useWindowMenuContextValue(): WindowMenuContextValue {\n const fileMenu =\n useWindowItemRegistry<RegisteredWindowMenuItem>(sameWindowItem);\n const viewMenu =\n useWindowItemRegistry<RegisteredWindowMenuItem>(sameWindowItem);\n const titleBar =\n useWindowItemRegistry<RegisteredWindowTitleBarAction>(sameWindowItem);\n const back =\n useWindowItemRegistry<RegisteredWindowBackAction>(sameWindowItem);\n const refresh =\n useWindowItemRegistry<RegisteredWindowRefreshMenuItem>(sameWindowItem);\n const toolbarReservation = useWindowToolbarReservationRegistry();\n\n const fileMenuItemList = useMemo(\n () => createMenuItems(fileMenu.items),\n [fileMenu.items],\n );\n const refreshMenuItem = useMemo(\n () => createRefreshMenuItem(selectHighestPriorityItem(refresh.items)),\n [refresh.items],\n );\n const viewMenuItemList = useMemo(\n () => [\n ...createMenuItems(viewMenu.items),\n ...(refreshMenuItem ? [refreshMenuItem] : []),\n ],\n [refreshMenuItem, viewMenu.items],\n );\n const titleBarActionList = useMemo(\n () => createTitleBarActions(titleBar.items),\n [titleBar.items],\n );\n const backAction = useMemo(\n () => createBackAction(selectHighestPriorityItem(back.items)),\n [back.items],\n );\n\n const value = useMemo(\n () => ({\n fileMenuItems: fileMenuItemList,\n viewMenuItems: viewMenuItemList,\n refreshMenuItem,\n titleBarActions: titleBarActionList,\n backAction,\n toolbarReserved: toolbarReservation.reserved,\n toolbarReservationReleased: toolbarReservation.released,\n registerFileMenuItem: fileMenu.registerItem,\n unregisterFileMenuItem: fileMenu.unregisterItem,\n registerViewMenuItem: viewMenu.registerItem,\n unregisterViewMenuItem: viewMenu.unregisterItem,\n registerTitleBarAction: titleBar.registerItem,\n unregisterTitleBarAction: titleBar.unregisterItem,\n registerBackAction: back.registerItem,\n unregisterBackAction: back.unregisterItem,\n registerRefreshMenuItem: refresh.registerItem,\n unregisterRefreshMenuItem: refresh.unregisterItem,\n registerToolbarReservation: toolbarReservation.register,\n unregisterToolbarReservation: toolbarReservation.unregister,\n }),\n [\n fileMenuItemList,\n viewMenuItemList,\n refreshMenuItem,\n titleBarActionList,\n backAction,\n toolbarReservation,\n fileMenu.registerItem,\n fileMenu.unregisterItem,\n viewMenu.registerItem,\n viewMenu.unregisterItem,\n titleBar.registerItem,\n titleBar.unregisterItem,\n back.registerItem,\n back.unregisterItem,\n refresh.registerItem,\n refresh.unregisterItem,\n ],\n );\n\n return value;\n}\n\nexport function WindowMenuProvider({ children }: PropsWithChildren) {\n const value = useWindowMenuContextValue();\n\n return (\n <WindowMenuContext.Provider value={value}>\n {children}\n </WindowMenuContext.Provider>\n );\n}\n\nexport function useWindowFileMenuItems(): WindowMenuItem[] {\n return useContext(WindowMenuContext).fileMenuItems;\n}\n\nexport function useWindowViewMenuItems(): WindowMenuItem[] {\n return useContext(WindowMenuContext).viewMenuItems;\n}\n\nexport function useWindowRefreshMenuItemValue(): WindowMenuItem | null {\n return useContext(WindowMenuContext).refreshMenuItem;\n}\n\nexport function useWindowTitleBarActions(): WindowTitleBarAction[] {\n return useContext(WindowMenuContext).titleBarActions;\n}\n\nexport function useWindowBackActionValue(): WindowBackAction | null {\n return useContext(WindowMenuContext).backAction;\n}\n\nexport function useWindowToolbarReserved(): boolean {\n return useContext(WindowMenuContext).toolbarReserved;\n}\n\nexport function useWindowToolbarReservationReleased(): boolean {\n return useContext(WindowMenuContext).toolbarReservationReleased;\n}\n\nfunction useRegisteredWindowMenuItem(\n item: WindowFileMenuItemInput | null,\n registerMenuItem: (id: object, item: RegisteredWindowMenuItem) => void,\n unregisterMenuItem: (id: object) => void,\n): void {\n useWindowItemRegistration({\n action: item?.onClick ?? null,\n createRegisteredItem: createRegisteredMenuItem,\n input: item,\n registerItem: registerMenuItem,\n unregisterItem: unregisterMenuItem,\n });\n}\n\nexport function useWindowFileMenuItem(\n item: WindowFileMenuItemInput | null,\n): void {\n const { registerFileMenuItem, unregisterFileMenuItem } =\n useContext(WindowMenuContext);\n useRegisteredWindowMenuItem(\n item,\n registerFileMenuItem,\n unregisterFileMenuItem,\n );\n}\n\nexport function useWindowViewMenuItem(\n item: WindowFileMenuItemInput | null,\n): void {\n const { registerViewMenuItem, unregisterViewMenuItem } =\n useContext(WindowMenuContext);\n useRegisteredWindowMenuItem(\n item,\n registerViewMenuItem,\n unregisterViewMenuItem,\n );\n}\n\n/**\n * Registers an action in the current window's toolbar.\n *\n * Keep `icon` and `buttonProps` reference-stable (for example with `useMemo`)\n * so context updates do not continuously re-register the action.\n */\nexport function useWindowTitleBarAction(\n item: WindowTitleBarActionInput | null,\n): void {\n const { registerTitleBarAction, unregisterTitleBarAction } =\n useContext(WindowMenuContext);\n useWindowItemRegistration({\n action: item?.onClick ?? null,\n createRegisteredItem: createRegisteredTitleBarAction,\n input: item,\n registerItem: registerTitleBarAction,\n unregisterItem: unregisterTitleBarAction,\n });\n}\n\nexport function useWindowBackAction(item: WindowBackActionInput | null): void {\n const { registerBackAction, unregisterBackAction } =\n useContext(WindowMenuContext);\n useWindowItemRegistration({\n action: item?.onClick ?? null,\n createRegisteredItem: createRegisteredBackAction,\n input: item,\n registerItem: registerBackAction,\n unregisterItem: unregisterBackAction,\n });\n}\n\n/**\n * Keeps this window's toolbar row reserved (rendered) while the caller is\n * mounted, even when it registers no title-bar or back actions. A mini-app that\n * wants explorer-style chrome on every route — a blank bar on the routes that\n * have no actions rather than a collapsing/reappearing row — calls this once.\n * Pass `reserve = false` to release the reservation without unmounting.\n */\nexport function useWindowToolbarReservation(reserve = true): void {\n const { registerToolbarReservation, unregisterToolbarReservation } =\n useContext(WindowMenuContext);\n const idRef = useRef<object>({});\n const hasEverReservedRef = useRef(false);\n\n useEffect(() => {\n const id = idRef.current;\n\n if (reserve) {\n hasEverReservedRef.current = true;\n registerToolbarReservation(id, true);\n return () => unregisterToolbarReservation(id);\n }\n\n if (!hasEverReservedRef.current) {\n return;\n }\n\n // A caller that previously reserved the row is now explicitly releasing it.\n // This lets WindowToolBar clear its latched blank row while callers that\n // never opted into reservations keep the older latch-once behavior.\n registerToolbarReservation(id, false);\n return () => unregisterToolbarReservation(id);\n }, [reserve, registerToolbarReservation, unregisterToolbarReservation]);\n}\n\nexport function useWindowRefreshMenuItem(\n item: WindowRefreshMenuItemInput | null,\n): void {\n const { registerRefreshMenuItem, unregisterRefreshMenuItem } =\n useContext(WindowMenuContext);\n useWindowItemRegistration({\n action: item?.onRefresh ?? null,\n createRegisteredItem: createRegisteredRefreshMenuItem,\n input: item,\n registerItem: registerRefreshMenuItem,\n unregisterItem: unregisterRefreshMenuItem,\n });\n}\n"]}
1
+ {"version":3,"file":"WindowMenuContext.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/window/WindowMenuContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAEb,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,GACP,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAC5F,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,GAMtB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,aAAa,GAId,MAAM,2BAA2B,CAAC;AAkBnC,SAAS,wBAAwB,CAC/B,IAA6B,EAC7B,OAAsB;IAEtB,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,KAAK;QAChC,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO;QACP,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,CAAC;KAC7B,CAAC;AACJ,CAAC;AAED,SAAS,+BAA+B,CACtC,IAAgC,EAChC,SAAwB;IAExB,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,KAAK;QAChC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,aAAa;QAClC,SAAS;QACT,QAAQ,EAAE,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tC,OAAO,GAAG,EAAE,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC,EAAE,CAAC,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,IAAuC;IAEvC,MAAM,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,GAC1D,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAChC,yBAAyB,CAAC;QACxB,MAAM,EAAE,IAAI,EAAE,SAAS,IAAI,IAAI;QAC/B,oBAAoB,EAAE,+BAA+B;QACrD,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,uBAAuB;QACrC,cAAc,EAAE,yBAAyB;KAC1C,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n createContext,\n type PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { useWindowItemRegistration } from \"./useWindowItemRegistration\";\nimport {\n sameWindowItem,\n selectHighestPriorityItem,\n useWindowItemRegistry,\n} from \"./useWindowItemRegistry\";\nimport { useWindowToolbarReservationRegistry } from \"./useWindowToolbarReservationRegistry\";\nimport {\n createBackAction,\n createRegisteredBackAction,\n createRegisteredTitleBarAction,\n createTitleBarActions,\n type RegisteredWindowBackAction,\n type RegisteredWindowTitleBarAction,\n type WindowBackAction,\n type WindowBackActionInput,\n type WindowTitleBarActionInput,\n} from \"./WindowChromeActions\";\nimport type { WindowMenuItem } from \"./WindowMenuBar\";\nimport type { WindowTitleBarAction } from \"./WindowTitleBar\";\nimport {\n createMenuItems,\n createRefreshMenuItem,\n REFRESH_LABEL,\n type RegisteredWindowMenuItem,\n type RegisteredWindowRefreshMenuItem,\n type WindowRefreshMenuItem,\n} from \"./windowMenuRegistrations\";\n\ninterface WindowRefreshMenuItemInput {\n disabled?: boolean;\n label?: string;\n onRefresh: () => unknown;\n priority?: number;\n refreshing?: boolean;\n}\n\ninterface WindowFileMenuItemInput {\n disabled?: boolean;\n id: string;\n label: string;\n onClick: () => unknown;\n priority?: number;\n}\n\nfunction createRegisteredMenuItem(\n item: WindowFileMenuItemInput,\n onClick: () => unknown,\n): RegisteredWindowMenuItem {\n return {\n disabled: item.disabled ?? false,\n id: item.id,\n label: item.label,\n onClick,\n priority: item.priority ?? 0,\n };\n}\n\nfunction createRegisteredRefreshMenuItem(\n item: WindowRefreshMenuItemInput,\n onRefresh: () => unknown,\n): RegisteredWindowRefreshMenuItem {\n return {\n disabled: item.disabled ?? false,\n label: item.label ?? REFRESH_LABEL,\n onRefresh,\n priority: item.priority ?? 0,\n refreshing: item.refreshing ?? false,\n };\n}\n\ninterface WindowMenuContextValue {\n fileMenuItems: WindowMenuItem[];\n viewMenuItems: WindowMenuItem[];\n /**\n * The winning refresh registration, also folded into `viewMenuItems` for the\n * windowed menu bar. Exposed on its own for the Refresh button shared by the\n * windowed toolbar and routed app bar.\n */\n refreshMenuItem: WindowRefreshMenuItem | null;\n titleBarActions: WindowTitleBarAction[];\n backAction: WindowBackAction | null;\n toolbarReserved: boolean;\n toolbarReservationReleased: boolean;\n registerFileMenuItem: (id: object, item: RegisteredWindowMenuItem) => void;\n unregisterFileMenuItem: (id: object) => void;\n registerViewMenuItem: (id: object, item: RegisteredWindowMenuItem) => void;\n unregisterViewMenuItem: (id: object) => void;\n registerTitleBarAction: (\n id: object,\n item: RegisteredWindowTitleBarAction,\n ) => void;\n unregisterTitleBarAction: (id: object) => void;\n registerBackAction: (id: object, item: RegisteredWindowBackAction) => void;\n unregisterBackAction: (id: object) => void;\n registerRefreshMenuItem: (\n id: object,\n item: RegisteredWindowRefreshMenuItem,\n ) => void;\n unregisterRefreshMenuItem: (id: object) => void;\n registerToolbarReservation: (id: object, reserved: boolean) => void;\n unregisterToolbarReservation: (id: object) => void;\n}\n\nconst WindowMenuContext = createContext<WindowMenuContextValue>({\n fileMenuItems: [],\n viewMenuItems: [],\n refreshMenuItem: null,\n titleBarActions: [],\n backAction: null,\n toolbarReserved: false,\n toolbarReservationReleased: false,\n registerFileMenuItem: () => {},\n unregisterFileMenuItem: () => {},\n registerViewMenuItem: () => {},\n unregisterViewMenuItem: () => {},\n registerTitleBarAction: () => {},\n unregisterTitleBarAction: () => {},\n registerBackAction: () => {},\n unregisterBackAction: () => {},\n registerRefreshMenuItem: () => {},\n unregisterRefreshMenuItem: () => {},\n registerToolbarReservation: () => {},\n unregisterToolbarReservation: () => {},\n});\n\nfunction useWindowMenuContextValue(): WindowMenuContextValue {\n const fileMenu =\n useWindowItemRegistry<RegisteredWindowMenuItem>(sameWindowItem);\n const viewMenu =\n useWindowItemRegistry<RegisteredWindowMenuItem>(sameWindowItem);\n const titleBar =\n useWindowItemRegistry<RegisteredWindowTitleBarAction>(sameWindowItem);\n const back =\n useWindowItemRegistry<RegisteredWindowBackAction>(sameWindowItem);\n const refresh =\n useWindowItemRegistry<RegisteredWindowRefreshMenuItem>(sameWindowItem);\n const toolbarReservation = useWindowToolbarReservationRegistry();\n\n const fileMenuItemList = useMemo(\n () => createMenuItems(fileMenu.items),\n [fileMenu.items],\n );\n const refreshMenuItem = useMemo(\n () => createRefreshMenuItem(selectHighestPriorityItem(refresh.items)),\n [refresh.items],\n );\n const viewMenuItemList = useMemo(\n () => [\n ...createMenuItems(viewMenu.items),\n ...(refreshMenuItem ? [refreshMenuItem] : []),\n ],\n [refreshMenuItem, viewMenu.items],\n );\n const titleBarActionList = useMemo(\n () => createTitleBarActions(titleBar.items),\n [titleBar.items],\n );\n const backAction = useMemo(\n () => createBackAction(selectHighestPriorityItem(back.items)),\n [back.items],\n );\n\n const value = useMemo(\n () => ({\n fileMenuItems: fileMenuItemList,\n viewMenuItems: viewMenuItemList,\n refreshMenuItem,\n titleBarActions: titleBarActionList,\n backAction,\n toolbarReserved: toolbarReservation.reserved,\n toolbarReservationReleased: toolbarReservation.released,\n registerFileMenuItem: fileMenu.registerItem,\n unregisterFileMenuItem: fileMenu.unregisterItem,\n registerViewMenuItem: viewMenu.registerItem,\n unregisterViewMenuItem: viewMenu.unregisterItem,\n registerTitleBarAction: titleBar.registerItem,\n unregisterTitleBarAction: titleBar.unregisterItem,\n registerBackAction: back.registerItem,\n unregisterBackAction: back.unregisterItem,\n registerRefreshMenuItem: refresh.registerItem,\n unregisterRefreshMenuItem: refresh.unregisterItem,\n registerToolbarReservation: toolbarReservation.register,\n unregisterToolbarReservation: toolbarReservation.unregister,\n }),\n [\n fileMenuItemList,\n viewMenuItemList,\n refreshMenuItem,\n titleBarActionList,\n backAction,\n toolbarReservation,\n fileMenu.registerItem,\n fileMenu.unregisterItem,\n viewMenu.registerItem,\n viewMenu.unregisterItem,\n titleBar.registerItem,\n titleBar.unregisterItem,\n back.registerItem,\n back.unregisterItem,\n refresh.registerItem,\n refresh.unregisterItem,\n ],\n );\n\n return value;\n}\n\nexport function WindowMenuProvider({ children }: PropsWithChildren) {\n const value = useWindowMenuContextValue();\n\n return (\n <WindowMenuContext.Provider value={value}>\n {children}\n </WindowMenuContext.Provider>\n );\n}\n\nexport function useWindowFileMenuItems(): WindowMenuItem[] {\n return useContext(WindowMenuContext).fileMenuItems;\n}\n\nexport function useWindowViewMenuItems(): WindowMenuItem[] {\n return useContext(WindowMenuContext).viewMenuItems;\n}\n\nexport function useWindowRefreshMenuItemValue(): WindowRefreshMenuItem | null {\n return useContext(WindowMenuContext).refreshMenuItem;\n}\n\nexport function useWindowTitleBarActions(): WindowTitleBarAction[] {\n return useContext(WindowMenuContext).titleBarActions;\n}\n\nexport function useWindowBackActionValue(): WindowBackAction | null {\n return useContext(WindowMenuContext).backAction;\n}\n\nexport function useWindowToolbarReserved(): boolean {\n return useContext(WindowMenuContext).toolbarReserved;\n}\n\nexport function useWindowToolbarReservationReleased(): boolean {\n return useContext(WindowMenuContext).toolbarReservationReleased;\n}\n\nfunction useRegisteredWindowMenuItem(\n item: WindowFileMenuItemInput | null,\n registerMenuItem: (id: object, item: RegisteredWindowMenuItem) => void,\n unregisterMenuItem: (id: object) => void,\n): void {\n useWindowItemRegistration({\n action: item?.onClick ?? null,\n createRegisteredItem: createRegisteredMenuItem,\n input: item,\n registerItem: registerMenuItem,\n unregisterItem: unregisterMenuItem,\n });\n}\n\nexport function useWindowFileMenuItem(\n item: WindowFileMenuItemInput | null,\n): void {\n const { registerFileMenuItem, unregisterFileMenuItem } =\n useContext(WindowMenuContext);\n useRegisteredWindowMenuItem(\n item,\n registerFileMenuItem,\n unregisterFileMenuItem,\n );\n}\n\nexport function useWindowViewMenuItem(\n item: WindowFileMenuItemInput | null,\n): void {\n const { registerViewMenuItem, unregisterViewMenuItem } =\n useContext(WindowMenuContext);\n useRegisteredWindowMenuItem(\n item,\n registerViewMenuItem,\n unregisterViewMenuItem,\n );\n}\n\n/**\n * Registers an action in the current window's toolbar.\n *\n * Keep `icon` and `buttonProps` reference-stable (for example with `useMemo`)\n * so context updates do not continuously re-register the action.\n */\nexport function useWindowTitleBarAction(\n item: WindowTitleBarActionInput | null,\n): void {\n const { registerTitleBarAction, unregisterTitleBarAction } =\n useContext(WindowMenuContext);\n useWindowItemRegistration({\n action: item?.onClick ?? null,\n createRegisteredItem: createRegisteredTitleBarAction,\n input: item,\n registerItem: registerTitleBarAction,\n unregisterItem: unregisterTitleBarAction,\n });\n}\n\nexport function useWindowBackAction(item: WindowBackActionInput | null): void {\n const { registerBackAction, unregisterBackAction } =\n useContext(WindowMenuContext);\n useWindowItemRegistration({\n action: item?.onClick ?? null,\n createRegisteredItem: createRegisteredBackAction,\n input: item,\n registerItem: registerBackAction,\n unregisterItem: unregisterBackAction,\n });\n}\n\n/**\n * Keeps this window's toolbar row reserved (rendered) while the caller is\n * mounted, even when it registers no title-bar or back actions. A mini-app that\n * wants explorer-style chrome on every route — a blank bar on the routes that\n * have no actions rather than a collapsing/reappearing row — calls this once.\n * Pass `reserve = false` to release the reservation without unmounting.\n */\nexport function useWindowToolbarReservation(reserve = true): void {\n const { registerToolbarReservation, unregisterToolbarReservation } =\n useContext(WindowMenuContext);\n const idRef = useRef<object>({});\n const hasEverReservedRef = useRef(false);\n\n useEffect(() => {\n const id = idRef.current;\n\n if (reserve) {\n hasEverReservedRef.current = true;\n registerToolbarReservation(id, true);\n return () => unregisterToolbarReservation(id);\n }\n\n if (!hasEverReservedRef.current) {\n return;\n }\n\n // A caller that previously reserved the row is now explicitly releasing it.\n // This lets WindowToolBar clear its latched blank row while callers that\n // never opted into reservations keep the older latch-once behavior.\n registerToolbarReservation(id, false);\n return () => unregisterToolbarReservation(id);\n }, [reserve, registerToolbarReservation, unregisterToolbarReservation]);\n}\n\nexport function useWindowRefreshMenuItem(\n item: WindowRefreshMenuItemInput | null,\n): void {\n const { registerRefreshMenuItem, unregisterRefreshMenuItem } =\n useContext(WindowMenuContext);\n useWindowItemRegistration({\n action: item?.onRefresh ?? null,\n createRegisteredItem: createRegisteredRefreshMenuItem,\n input: item,\n registerItem: registerRefreshMenuItem,\n unregisterItem: unregisterRefreshMenuItem,\n });\n}\n"]}
@@ -0,0 +1,17 @@
1
+ /* Turns like the app's other loading rings: one full turn every 0.8s. */
2
+ .window-refresh-spinner {
3
+ animation: window-refresh-spin 0.8s linear infinite;
4
+ }
5
+
6
+ @keyframes window-refresh-spin {
7
+ to {
8
+ transform: rotate(360deg);
9
+ }
10
+ }
11
+
12
+ /* Slow the turn rather than stop it: a frozen ring reads as a hang. */
13
+ @media (prefers-reduced-motion: reduce) {
14
+ .window-refresh-spinner {
15
+ animation-duration: 2.4s;
16
+ }
17
+ }
@@ -1,6 +1,10 @@
1
- import type { WindowMenuItem } from "./WindowMenuBar.js";
2
- /** The registered refresh action shared by floating and routed toolbars. */
1
+ import type { WindowRefreshMenuItem } from "./windowMenuRegistrations.js";
2
+ /**
3
+ * The registered refresh action shared by floating and routed toolbars. While
4
+ * the refresh runs, a turning ring replaces the icon so a long refresh reads
5
+ * as work in progress rather than as a disabled button.
6
+ */
3
7
  export declare function WindowRefreshButton({ className, item, }: {
4
8
  className: string;
5
- item: WindowMenuItem;
9
+ item: WindowRefreshMenuItem;
6
10
  }): import("react").JSX.Element;
@@ -1,7 +1,17 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ArrowsClockwiseIcon } from "@phosphor-icons/react/dist/csr/ArrowsClockwise";
3
- /** The registered refresh action shared by floating and routed toolbars. */
3
+ import "./WindowRefreshButton.css";
4
+ /**
5
+ * The registered refresh action shared by floating and routed toolbars. While
6
+ * the refresh runs, a turning ring replaces the icon so a long refresh reads
7
+ * as work in progress rather than as a disabled button.
8
+ */
4
9
  export function WindowRefreshButton({ className, item, }) {
5
- return (_jsx("button", { "aria-label": item.label, className: className, disabled: item.disabled, title: item.label, type: "button", onClick: item.onClick, children: _jsx(ArrowsClockwiseIcon, { "aria-hidden": true, size: 18 }) }));
10
+ return (_jsx("button", { "aria-busy": item.refreshing, "aria-label": item.label, className: className, disabled: item.disabled, title: item.label, type: "button", onClick: item.onClick, children: item.refreshing ? (_jsx(RefreshSpinner, {})) : (_jsx(ArrowsClockwiseIcon, { "aria-hidden": true, size: 18 })) }));
11
+ }
12
+ // An open ring on the icon set's 256-unit grid and 16-unit stroke, so each
13
+ // toolbar's icon sizing applies to it exactly as to the icon it replaces.
14
+ function RefreshSpinner() {
15
+ return (_jsx("svg", { "aria-hidden": true, className: "window-refresh-spinner", height: 18, viewBox: "0 0 256 256", width: 18, children: _jsx("circle", { cx: 128, cy: 128, fill: "none", pathLength: 4, r: 96, stroke: "currentColor", strokeDasharray: "3 1", strokeLinecap: "round", strokeWidth: 16 }) }));
6
16
  }
7
17
  //# sourceMappingURL=WindowRefreshButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WindowRefreshButton.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/window/WindowRefreshButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAGrF,4EAA4E;AAC5E,MAAM,UAAU,mBAAmB,CAAC,EAClC,SAAS,EACT,IAAI,GAIL;IACC,OAAO,CACL,+BACc,IAAI,CAAC,KAAK,EACtB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,IAAI,CAAC,OAAO,YAErB,KAAC,mBAAmB,yBAAa,IAAI,EAAE,EAAE,GAAI,GACtC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { ArrowsClockwiseIcon } from \"@phosphor-icons/react/dist/csr/ArrowsClockwise\";\nimport type { WindowMenuItem } from \"./WindowMenuBar\";\n\n/** The registered refresh action shared by floating and routed toolbars. */\nexport function WindowRefreshButton({\n className,\n item,\n}: {\n className: string;\n item: WindowMenuItem;\n}) {\n return (\n <button\n aria-label={item.label}\n className={className}\n disabled={item.disabled}\n title={item.label}\n type=\"button\"\n onClick={item.onClick}\n >\n <ArrowsClockwiseIcon aria-hidden size={18} />\n </button>\n );\n}\n"]}
1
+ {"version":3,"file":"WindowRefreshButton.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/window/WindowRefreshButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,2BAA2B,CAAC;AAGnC;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,SAAS,EACT,IAAI,GAIL;IACC,OAAO,CACL,8BACa,IAAI,CAAC,UAAU,gBACd,IAAI,CAAC,KAAK,EACtB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,IAAI,CAAC,OAAO,YAEpB,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CACjB,KAAC,cAAc,KAAG,CACnB,CAAC,CAAC,CAAC,CACF,KAAC,mBAAmB,yBAAa,IAAI,EAAE,EAAE,GAAI,CAC9C,GACM,CACV,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,0EAA0E;AAC1E,SAAS,cAAc;IACrB,OAAO,CACL,mCAEE,SAAS,EAAC,wBAAwB,EAClC,MAAM,EAAE,EAAE,EACV,OAAO,EAAC,aAAa,EACrB,KAAK,EAAE,EAAE,YAET,iBACE,EAAE,EAAE,GAAG,EACP,EAAE,EAAE,GAAG,EACP,IAAI,EAAC,MAAM,EACX,UAAU,EAAE,CAAC,EACb,CAAC,EAAE,EAAE,EACL,MAAM,EAAC,cAAc,EACrB,eAAe,EAAC,KAAK,EACrB,aAAa,EAAC,OAAO,EACrB,WAAW,EAAE,EAAE,GACf,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { ArrowsClockwiseIcon } from \"@phosphor-icons/react/dist/csr/ArrowsClockwise\";\nimport \"./WindowRefreshButton.css\";\nimport type { WindowRefreshMenuItem } from \"./windowMenuRegistrations\";\n\n/**\n * The registered refresh action shared by floating and routed toolbars. While\n * the refresh runs, a turning ring replaces the icon so a long refresh reads\n * as work in progress rather than as a disabled button.\n */\nexport function WindowRefreshButton({\n className,\n item,\n}: {\n className: string;\n item: WindowRefreshMenuItem;\n}) {\n return (\n <button\n aria-busy={item.refreshing}\n aria-label={item.label}\n className={className}\n disabled={item.disabled}\n title={item.label}\n type=\"button\"\n onClick={item.onClick}\n >\n {item.refreshing ? (\n <RefreshSpinner />\n ) : (\n <ArrowsClockwiseIcon aria-hidden size={18} />\n )}\n </button>\n );\n}\n\n// An open ring on the icon set's 256-unit grid and 16-unit stroke, so each\n// toolbar's icon sizing applies to it exactly as to the icon it replaces.\nfunction RefreshSpinner() {\n return (\n <svg\n aria-hidden\n className=\"window-refresh-spinner\"\n height={18}\n viewBox=\"0 0 256 256\"\n width={18}\n >\n <circle\n cx={128}\n cy={128}\n fill=\"none\"\n pathLength={4}\n r={96}\n stroke=\"currentColor\"\n strokeDasharray=\"3 1\"\n strokeLinecap=\"round\"\n strokeWidth={16}\n />\n </svg>\n );\n}\n"]}
@@ -14,5 +14,9 @@ export interface RegisteredWindowRefreshMenuItem {
14
14
  priority: number;
15
15
  refreshing: boolean;
16
16
  }
17
+ /** The winning refresh registration as the toolbars and View menu draw it. */
18
+ export interface WindowRefreshMenuItem extends WindowMenuItem {
19
+ refreshing: boolean;
20
+ }
17
21
  export declare function createMenuItems(items: ReadonlyMap<object, RegisteredWindowMenuItem>): WindowMenuItem[];
18
- export declare function createRefreshMenuItem(item: RegisteredWindowRefreshMenuItem | null): WindowMenuItem | null;
22
+ export declare function createRefreshMenuItem(item: RegisteredWindowRefreshMenuItem | null): WindowRefreshMenuItem | null;
@@ -29,6 +29,7 @@ export function createRefreshMenuItem(item) {
29
29
  onClick: () => {
30
30
  void item.onRefresh();
31
31
  },
32
+ refreshing: item.refreshing,
32
33
  };
33
34
  }
34
35
  //# sourceMappingURL=windowMenuRegistrations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"windowMenuRegistrations.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/window/windowMenuRegistrations.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AACvC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAkBzC,MAAM,UAAU,eAAe,CAC7B,KAAoD;IAEpD,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;SAC9B,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;SACrD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;KACF,CAAC,CAAC,CAAC;AACR,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,IAA4C;IAE5C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU;QAC1C,EAAE,EAAE,gBAAgB;QACpB,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK;QACtD,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { WindowMenuItem } from \"./WindowMenuBar\";\n\n/*\n * The shapes a mini-app's menu registration takes, and the pure projections\n * from a registry map to the items a menu bar (or the routed app bar) renders.\n * The React seams — the context, the provider, and the register/read hooks —\n * live in WindowMenuContext.tsx.\n */\n\nexport const REFRESH_LABEL = \"Refresh\";\nconst REFRESHING_LABEL = \"Refreshing...\";\n\nexport interface RegisteredWindowMenuItem {\n disabled: boolean;\n id: string;\n label: string;\n onClick: () => unknown;\n priority: number;\n}\n\nexport interface RegisteredWindowRefreshMenuItem {\n disabled: boolean;\n label: string;\n onRefresh: () => unknown;\n priority: number;\n refreshing: boolean;\n}\n\nexport function createMenuItems(\n items: ReadonlyMap<object, RegisteredWindowMenuItem>,\n): WindowMenuItem[] {\n return Array.from(items.values())\n .sort((left, right) => right.priority - left.priority)\n .map((item) => ({\n disabled: item.disabled,\n id: item.id,\n label: item.label,\n onClick: () => {\n void item.onClick();\n },\n }));\n}\n\nexport function createRefreshMenuItem(\n item: RegisteredWindowRefreshMenuItem | null,\n): WindowMenuItem | null {\n if (!item) {\n return null;\n }\n\n return {\n disabled: item.disabled || item.refreshing,\n id: \"window-refresh\",\n label: item.refreshing ? REFRESHING_LABEL : item.label,\n onClick: () => {\n void item.onRefresh();\n },\n };\n}\n"]}
1
+ {"version":3,"file":"windowMenuRegistrations.js","sourceRoot":"","sources":["../../../home/runner/work/tearleads/tearleads/packages/windowing/src/window/windowMenuRegistrations.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AACvC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAuBzC,MAAM,UAAU,eAAe,CAC7B,KAAoD;IAEpD,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;SAC9B,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;SACrD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;KACF,CAAC,CAAC,CAAC;AACR,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,IAA4C;IAE5C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU;QAC1C,EAAE,EAAE,gBAAgB;QACpB,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK;QACtD,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;QACxB,CAAC;QACD,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC;AACJ,CAAC","sourcesContent":["import type { WindowMenuItem } from \"./WindowMenuBar\";\n\n/*\n * The shapes a mini-app's menu registration takes, and the pure projections\n * from a registry map to the items a menu bar (or the routed app bar) renders.\n * The React seams — the context, the provider, and the register/read hooks —\n * live in WindowMenuContext.tsx.\n */\n\nexport const REFRESH_LABEL = \"Refresh\";\nconst REFRESHING_LABEL = \"Refreshing...\";\n\nexport interface RegisteredWindowMenuItem {\n disabled: boolean;\n id: string;\n label: string;\n onClick: () => unknown;\n priority: number;\n}\n\nexport interface RegisteredWindowRefreshMenuItem {\n disabled: boolean;\n label: string;\n onRefresh: () => unknown;\n priority: number;\n refreshing: boolean;\n}\n\n/** The winning refresh registration as the toolbars and View menu draw it. */\nexport interface WindowRefreshMenuItem extends WindowMenuItem {\n refreshing: boolean;\n}\n\nexport function createMenuItems(\n items: ReadonlyMap<object, RegisteredWindowMenuItem>,\n): WindowMenuItem[] {\n return Array.from(items.values())\n .sort((left, right) => right.priority - left.priority)\n .map((item) => ({\n disabled: item.disabled,\n id: item.id,\n label: item.label,\n onClick: () => {\n void item.onClick();\n },\n }));\n}\n\nexport function createRefreshMenuItem(\n item: RegisteredWindowRefreshMenuItem | null,\n): WindowRefreshMenuItem | null {\n if (!item) {\n return null;\n }\n\n return {\n disabled: item.disabled || item.refreshing,\n id: \"window-refresh\",\n label: item.refreshing ? REFRESHING_LABEL : item.label,\n onClick: () => {\n void item.onRefresh();\n },\n refreshing: item.refreshing,\n };\n}\n"]}