gesso-framework 0.6.4 → 0.6.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # gesso-framework
2
2
 
3
+ ## 0.6.6
4
+
5
+ ### Patch Changes
6
+
7
+ - gesso-core@0.6.6
8
+
9
+ ## 0.6.5
10
+
11
+ ### Patch Changes
12
+
13
+ - e93e0ee: A `Link` can now name an in-app destination with `to`, and a Cmd-click opens it somewhere new, the way a browser treats an anchor. `to` takes one of the application's own urls (`/epic/BUD-12?story=BUD-13`) or a `RouteTarget` from `to(route, params)`. A plain click, Enter or Space runs `onPress` and then navigates the router in place. A click with Command or Control held (either one, on any platform), a middle click, or Cmd-Enter / Ctrl-Enter runs `onPress` and then asks the shell to open the app at that url somewhere new, leaving the current screen where it is. An `href` link is unchanged: it opens through `openUrl` however it is clicked. When a link has both, `to` wins. `Breadcrumb` items take the same `to`.
14
+
15
+ The request is the new `ShellService.openRoute(url)`, and what "somewhere new" means is the shell's decision. `createApp` and `GessoApp` take an `onOpenRoute(url)` for a host with its own idea of a new tab, such as an app inside Jira opening one through Forge's `router.open`. Without one, a browser shell opens a tab at the app's own address for that url: the path on the same origin in `path` mode, the same page with the fragment set in `hash` mode. In `memory` mode there is no address, so the link is followed in place. A handed-in `ShellHistory` can answer the new optional `href(url)` to give the address itself; without it, such a link is also followed in place.
16
+
17
+ In `gesso-electrobun`, the view bridge has `openRoute(url)` to pass as `onOpenRoute`, and `createDesktopApp` answers it by opening a new window of the application at that route: `openWindow({ route })`, and an `onOpenRoute(url, window)` option to do something else. A window learns its route from the page it loads: `open` reads `window.route`, `withWindowRoute` puts it in the view url's fragment, and `windowRoute()` reads it back as the window's starting url. An `open` that ignores it keeps working. The Electrobun template does all three.
18
+
19
+ - gesso-core@0.6.5
20
+
3
21
  ## 0.6.4
4
22
 
5
23
  ### Patch Changes
@@ -1664,6 +1664,9 @@ type ShellRequest = {
1664
1664
  } | {
1665
1665
  type: 'openUrl';
1666
1666
  url: string;
1667
+ } | {
1668
+ type: 'openRoute';
1669
+ url: string;
1667
1670
  } | {
1668
1671
  type: 'redirect';
1669
1672
  url: string;
@@ -1949,6 +1952,30 @@ declare class ShellService {
1949
1952
  settleClipboard(id: number, copied: boolean): void;
1950
1953
  /** Opens a URL in the user's browser, in a new tab or window. */
1951
1954
  openUrl(url: string): void;
1955
+ /**
1956
+ * Opens this application at one of its own urls, somewhere new: what
1957
+ * a Cmd-click or a Ctrl-click on an in-app link asks for.
1958
+ *
1959
+ * Not `openUrl`, because the two urls are different kinds of thing.
1960
+ * `openUrl` takes an address that already means something to the
1961
+ * browser. This takes the router's url, `/epic/BUD-12?story=BUD-13`,
1962
+ * which means something only to this application, and only the
1963
+ * shell knows what address shows the application at it: a path on
1964
+ * the page's origin, a fragment on the page's own address, a tab in
1965
+ * the product the app is embedded in, or a new native window. The
1966
+ * render thread cannot know which, so it names the route and the
1967
+ * shell decides.
1968
+ *
1969
+ * What each shell does, in order: the host's `onOpenRoute` if it gave
1970
+ * one; otherwise a new tab at the address the history gives for the
1971
+ * url (`ShellHistory.href`); otherwise, where there is no address,
1972
+ * which is `memory` mode, the shell follows the url in place, exactly
1973
+ * as `RouterService.navigate` would, rather than doing nothing.
1974
+ *
1975
+ * The current screen does not navigate. Nothing comes back, as with
1976
+ * `openUrl`. With no shell installed the request is dropped.
1977
+ */
1978
+ openRoute(url: string): void;
1952
1979
  /**
1953
1980
  * Replaces the page with `url`, leaving the application.
1954
1981
  *
@@ -4895,6 +4922,16 @@ type RuntimeToShellMessage = {
4895
4922
  type: 'openUrl';
4896
4923
  url: string;
4897
4924
  } |
4925
+ /**
4926
+ * Open the app at one of its own urls somewhere new
4927
+ * (ShellService.openRoute). `url` is the router's, not an address:
4928
+ * the shell turns it into one, through its `onOpenRoute` or its
4929
+ * history, or follows it in place when it has neither.
4930
+ */
4931
+ {
4932
+ type: 'openRoute';
4933
+ url: string;
4934
+ } |
4898
4935
  /**
4899
4936
  * Replace the page with a url, leaving the app (ShellService.redirect).
4900
4937
  * `url` is as the component gave it, relative or not; the shell
@@ -5355,6 +5392,21 @@ interface ShellHistory {
5355
5392
  */
5356
5393
  onChange(listener: (url: string) => void): void;
5357
5394
  dispose(): void;
5395
+ /**
5396
+ * The address a new tab would open to show the app at `url`, or null
5397
+ * when this history has none to give.
5398
+ *
5399
+ * Asked when a link is followed somewhere new (`ShellService.openRoute`,
5400
+ * a Cmd-click or a Ctrl-click). The browser modes answer with the
5401
+ * document address that holds `url`, which is what `push` would have
5402
+ * written; `memory` answers null, because a url kept in memory names
5403
+ * no page anything else could load. Optional, because a history an
5404
+ * embedder wrote may have no such answer either, and leaving it out
5405
+ * says exactly that: the shell then follows the link in place. A
5406
+ * host that can open its own kind of tab (Jira's, through Forge's
5407
+ * `router.open`) says so with the shell's `onOpenRoute` instead.
5408
+ */
5409
+ href?(url: string): string | null;
5358
5410
  }
5359
5411
  /**
5360
5412
  * Just the parts of a window this module uses.
@@ -5474,6 +5526,25 @@ interface WorkerAppOptions {
5474
5526
  * reach. `gesso-electrobun`'s bridge is what goes here.
5475
5527
  */
5476
5528
  onOpenUrl?: (url: string) => void;
5529
+ /**
5530
+ * Opens the app at one of its own urls somewhere new
5531
+ * (`ShellService.openRoute`, a Cmd-click or a Ctrl-click on an in-app
5532
+ * `Link`), in place of a new browser tab.
5533
+ *
5534
+ * `url` is the router's, `/epic/BUD-12?story=BUD-13`, not an address.
5535
+ * Without this the shell opens a new tab at the address its history
5536
+ * gives for it (`ShellHistory.href`): the origin and the path in
5537
+ * `path` mode, the page with that fragment in `hash` mode. With no
5538
+ * address to give, in `memory` mode or with a history that has no
5539
+ * `href`, it follows the url in place.
5540
+ *
5541
+ * A host whose idea of a new tab is not the browser's goes here: an
5542
+ * app embedded in another product opens one of that product's tabs
5543
+ * (an Atlassian Forge app, Forge's `router.open`), and a desktop
5544
+ * window asks for another window (`gesso-electrobun`'s bridge,
5545
+ * `openRoute`).
5546
+ */
5547
+ onOpenRoute?: (url: string) => void;
5477
5548
  /**
5478
5549
  * Replaces the page with a url the application asked for
5479
5550
  * (`ShellService.redirect`), in place of `window.location.assign`.
@@ -6194,6 +6265,12 @@ interface GessoAppOptions {
6194
6265
  * because it belongs to whoever passed it.
6195
6266
  */
6196
6267
  history?: ShellHistoryOptions | ShellHistory;
6268
+ /**
6269
+ * Opens the app at one of its own urls somewhere new
6270
+ * (`ShellService.openRoute`), in place of a new browser tab. The
6271
+ * same option, and the same fallbacks, as `WorkerAppOptions.onOpenRoute`.
6272
+ */
6273
+ onOpenRoute?: (url: string) => void;
6197
6274
  canvas?: CanvasHost;
6198
6275
  /** The rendering backend; see RendererChoice. Defaults to `auto`. */
6199
6276
  renderer?: RendererChoice;
@@ -6263,6 +6340,7 @@ declare class GessoApp {
6263
6340
  private readonly accessibilityEnabled;
6264
6341
  private readonly adapter;
6265
6342
  private readonly historyOptions;
6343
+ private readonly onOpenRoute;
6266
6344
  private running;
6267
6345
  private resizeObserver;
6268
6346
  private proxy;
@@ -8361,4 +8439,4 @@ declare class RenderWorkerApp {
8361
8439
  }
8362
8440
  //#endregion
8363
8441
  export { StorageAdapter as $, UiOwnerReport as $n, Resource as $r, FontFaceDeclaration as $t, Presence as A, AudioState as An, Channel as Ar, ActionCause as At, PersistedOptions as B, ShellFileType as Bn, bind as Br, UiTreeSnapshot as Bt, FocusService as C, formatUrl as Cn, pickKeys as Cr, AppLogicEndpoint as Ct, FindService as D, AudioRequest as Dn, findUnplainPath as Dr, ShellHistoryMode as Dt, TextService as E, AudioMetadata as En, createChannelRegistry as Er, ShellHistory as Et, AudioSinkOptions as F, UiDuration as Fn, ControlledOptions as Fr, DevtoolsEvent as Ft, IndexedDbStorage as G, ShellStorageResult as Gn, EachKey as Gr, FrameMetrics as Gt, persisted as H, ShellRequest as Hn, ShowProps as Hr, RuntimeErrorSource as Ht, AudioSinkOutput as I, UiEasingChoice as In, ControlledValue as Ir, DevtoolsRequest as It, OpfsFileHandle as J, observeColorScheme as Jn, debounced as Jr, GessoRuntimeOptions as Jt, IndexedDbStorageOptions as K, ColorScheme as Kn, EachProps as Kr, FramePhaseTimings as Kt, MediaSessionLike as L, ShellFile as Ln, controlled as Lr, FrameEntry as Lt, RouterOutlet as M, AnimateOptions as Mn, Inject as Mr, ChannelErrorEntry as Mt, AudioElementLike as N, AnimationService as Nn, Input as Nr, CommandEntry as Nt, observeMediaQuery as O, AudioSample as On, requirePlainData as Or, ShellHistoryOptions as Ot, AudioSink as P, SpringOptions as Pn, Output as Pr, ConsoleEntry as Pt, MemoryStorage as Q, UiNodeReport as Qn, mutate as Qr, UiFramePhase as Qt, audioClock as R, ShellFileRequest as Rn, ThemeTokenCell as Rr, PatchEntry as Rt, writeClipboard as S, buildPath as Sn, pick as Sr, createApp as St, EditingService as T, AudioAction as Tn, ChannelRegistryHandle as Tr, WorkerAppOptions as Tt, ShellStorage as U, ShellService as Un, show as Ur, RuntimeToShellMessage as Ut, PersistedState as V, ShellRecentFile as Vn, Show as Vr, treeText as Vt, ShellStorageOptions as W, ShellStorageOp as Wn, Each as Wr, ShellToRuntimeMessage as Wt, OpfsStorageOptions as X, NodePathTarget as Xn, MutateOptions as Xr, RuntimeInput as Xt, OpfsStorage as Y, BoundStream as Yn, throttled as Yr, RendererChoice as Yt, OpfsWritable as Z, UiEnvironmentReport as Zn, Mutation as Zr, UI_FRAME_PHASES as Zt, EditingMirrorTarget as _, derive as _i, RouteOptions as _n, createComponent as _r, GessoAppOptions as _t, UiRole as a, select as ai, MediaOptions as an, formatAge as ar, storageReadValue as at, EditingProxy as b, to as bn, isComponentElement as br, WebMcpChoice as bt, UiSemanticsPatch as c, FanOut as ci, RouteMatch as cn, formatStream as cr, UndoableOptions as ct, markNow as d, ComputedCell as di, RouterService as dn, ComponentHost as dr, UndoStackOptions as dt, ResourceOptions as ei, FontFaceLike as en, UiPropOrigin as er, StorageOutcome as et, measureSpan as f, ComputedOptions as fi, RouteState as fn, OverlayLayer as fr, UndoTransaction as ft, renderRoot as g, Equality as gi, RouteGuard as gn, OverlayService as gr, GessoApp as gt, RenderWorkerApp as h, DeriveOptions as hi, RouteDefinition as hn, OverlayRect as hr, shellStorageDenied as ht, UI_SEMANTIC_STATES as i, SelectOptions as ii, FontService as in, describeStream as ir, storageReadFailure as it, PresenceProps as j, AudioStatus as jn, Define as jr, ActionEntry as jt, observeReducedMotion as k, AudioService as kn, ChannelRegistry as kr, createShellHistory as kt, UiSemanticsRecord$1 as l, FanOutOptions as li, RouterHistorySink as ln, printPropValue as lr, undoable as lt, setPerformanceMarks$1 as m, computed as mi, RouteContext as mn, OverlayPlacement as mr, performShellStorage as mt, MARK_PREFIX as n, ResourceStatus as ni, FontFamilyStatus as nn, UiSemanticsReport as nr, classifyStorageError as nt, UiSemanticState as o, FanCell as oi, MediaService as on, formatNodePath as or, UndoShortcutOptions as ot, performanceMarksEnabled as p, ReadSource as pi, OutletProps as pn, OverlayEntry as pr, ShellLocalStore as pt, OpfsDirectory as q, ColorSchemePreference as qn, each as qr, GessoRuntime as qt, UI_ROLES as r, resource as ri, FontHost as rn, UiStreamReport as rr, storageErrorMessage as rt, UiSemanticsMap$1 as s, FanKey as si, RouteAnswer as sn, formatNodeReport as sr, registerUndoShortcuts as st, EditingState$1 as t, ResourceState as ti, FontFamilyDeclaration as tn, UiPropReport as tr, StorageRead as tt, markInstant as u, fanOut as ui, RouterRoutes as un, ComponentHostResolver as ur, UndoStack as ut, SemanticsMirror as v, ServiceRegistry as vi, RouteTarget as vn, ComponentElement as vr, createSyncApp as vt, ScrollService as w, parseUrl as wn, ChannelRegistration as wr, WorkerApp as wt, EditingProxySink as x, RouteParams as xn, structurallyEqual as xr, CreateAppOptions as xt, SemanticsMirrorSink as y, route as yn, FrameworkChild as yr, GessoAppBuilder as yt, FrameService as z, ShellFileResult as zn, themeTokenCell as zr, UiTreeNode as zt };
8364
- //# sourceMappingURL=index-BvaYnj-Q.d.ts.map
8442
+ //# sourceMappingURL=index-B8PU7Cf0.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _ as channel, a as isChannelHostMessage, c as applyPatch, d as ChannelSpec, f as ChannelToken, g as ViewOf, h as CommandsOf, i as isChannelClientMessage, l as applyPatches, m as CommandMap, n as ChannelHostMessage, o as Patch, p as Command, r as ChannelPort, s as PatchPath, t as ChannelClientMessage, u as diffProjection, v as defineChannel, y as viewKeys } from "./ChannelProtocol-ByNoHujM.js";
2
2
  import { A as portHandle, C as MessageEndpoint, D as isHubMessage, E as WorkerHandle, F as JsonSchema, I as channelSchema, L as describeChannel, M as workerHandle, N as ChannelSchema, O as isPortErrorMessage, P as CommandSchema, S as APPLICATION_WORKER, T as PortHost, _ as serve, b as ProvidedChannel, g as ServedChannel, j as servePorts, k as isPortHandshake, v as serveChannels, w as PortHandshake, x as provide, y as ChannelSource } from "./ui-U39HjNFA.js";
3
3
  import { C as internalState, S as InternalState, _ as ReadableCell, a as ComponentType, b as isOutputTarget, c as isClassComponent, d as bounds, f as EmitArgs, g as OutputTarget, h as OutputCell, i as ComponentProps, l as ChannelReplica, m as InputCell, o as FunctionComponent, p as EmitValue, r as ComponentContext, s as Inputs, t as ClassComponent, u as BoundsCell, v as input, w as Component, x as output, y as into } from "./FunctionComponent-fYMdePtH.js";
4
- import { $ as StorageAdapter, $n as UiOwnerReport, $r as Resource, $t as FontFaceDeclaration, A as Presence, An as AudioState, Ar as Channel, At as ActionCause, B as PersistedOptions, Bn as ShellFileType, Br as bind, Bt as UiTreeSnapshot, C as FocusService, Cn as formatUrl, Cr as pickKeys, Ct as AppLogicEndpoint, D as FindService, Dn as AudioRequest, Dr as findUnplainPath, Dt as ShellHistoryMode, E as TextService, En as AudioMetadata, Er as createChannelRegistry, Et as ShellHistory, F as AudioSinkOptions, Fn as UiDuration, Fr as ControlledOptions, Ft as DevtoolsEvent, G as IndexedDbStorage, Gn as ShellStorageResult, Gr as EachKey, Gt as FrameMetrics, H as persisted, Hn as ShellRequest, Hr as ShowProps, Ht as RuntimeErrorSource, I as AudioSinkOutput, In as UiEasingChoice, Ir as ControlledValue, It as DevtoolsRequest, J as OpfsFileHandle, Jn as observeColorScheme, Jr as debounced, Jt as GessoRuntimeOptions, K as IndexedDbStorageOptions, Kn as ColorScheme, Kr as EachProps, Kt as FramePhaseTimings, L as MediaSessionLike, Ln as ShellFile, Lr as controlled, Lt as FrameEntry, M as RouterOutlet, Mn as AnimateOptions, Mr as Inject, Mt as ChannelErrorEntry, N as AudioElementLike, Nn as AnimationService, Nr as Input, Nt as CommandEntry, O as observeMediaQuery, On as AudioSample, Or as requirePlainData, Ot as ShellHistoryOptions, P as AudioSink, Pn as SpringOptions, Pr as Output, Pt as ConsoleEntry, Q as MemoryStorage, Qn as UiNodeReport, Qr as mutate, Qt as UiFramePhase, R as audioClock, Rn as ShellFileRequest, Rr as ThemeTokenCell, Rt as PatchEntry, S as writeClipboard, Sn as buildPath, Sr as pick, St as createApp, T as EditingService, Tn as AudioAction, Tr as ChannelRegistryHandle, Tt as WorkerAppOptions, U as ShellStorage, Un as ShellService, Ur as show, Ut as RuntimeToShellMessage, V as PersistedState, Vn as ShellRecentFile, Vr as Show, Vt as treeText, W as ShellStorageOptions, Wn as ShellStorageOp, Wr as Each, Wt as ShellToRuntimeMessage, X as OpfsStorageOptions, Xn as NodePathTarget, Xr as MutateOptions, Xt as RuntimeInput, Y as OpfsStorage, Yn as BoundStream, Yr as throttled, Yt as RendererChoice, Z as OpfsWritable, Zn as UiEnvironmentReport, Zr as Mutation, Zt as UI_FRAME_PHASES, _ as EditingMirrorTarget, _i as derive, _n as RouteOptions, _r as createComponent, _t as GessoAppOptions, a as UiRole, ai as select, an as MediaOptions, ar as formatAge, at as storageReadValue, b as EditingProxy, bn as to, br as isComponentElement, bt as WebMcpChoice, c as UiSemanticsPatch, ci as FanOut, cn as RouteMatch, cr as formatStream, ct as UndoableOptions, d as markNow, di as ComputedCell, dn as RouterService, dr as ComponentHost, dt as UndoStackOptions, ei as ResourceOptions, en as FontFaceLike, er as UiPropOrigin, et as StorageOutcome, f as measureSpan, fi as ComputedOptions, fn as RouteState, fr as OverlayLayer, ft as UndoTransaction, g as renderRoot, gi as Equality, gn as RouteGuard, gr as OverlayService, gt as GessoApp, h as RenderWorkerApp, hi as DeriveOptions, hn as RouteDefinition, hr as OverlayRect, ht as shellStorageDenied, i as UI_SEMANTIC_STATES, ii as SelectOptions, in as FontService, ir as describeStream, it as storageReadFailure, j as PresenceProps, jn as AudioStatus, jr as Define, jt as ActionEntry, k as observeReducedMotion, kn as AudioService, kr as ChannelRegistry, kt as createShellHistory, l as UiSemanticsRecord, li as FanOutOptions, ln as RouterHistorySink, lr as printPropValue, lt as undoable, m as setPerformanceMarks, mi as computed, mn as RouteContext, mr as OverlayPlacement, mt as performShellStorage, n as MARK_PREFIX, ni as ResourceStatus, nn as FontFamilyStatus, nr as UiSemanticsReport, nt as classifyStorageError, o as UiSemanticState, oi as FanCell, on as MediaService, or as formatNodePath, ot as UndoShortcutOptions, p as performanceMarksEnabled, pi as ReadSource, pn as OutletProps, pr as OverlayEntry, pt as ShellLocalStore, q as OpfsDirectory, qn as ColorSchemePreference, qr as each, qt as GessoRuntime, r as UI_ROLES, ri as resource, rn as FontHost, rr as UiStreamReport, rt as storageErrorMessage, s as UiSemanticsMap, si as FanKey, sn as RouteAnswer, sr as formatNodeReport, st as registerUndoShortcuts, t as EditingState, ti as ResourceState, tn as FontFamilyDeclaration, tr as UiPropReport, tt as StorageRead, u as markInstant, ui as fanOut, un as RouterRoutes, ur as ComponentHostResolver, ut as UndoStack, v as SemanticsMirror, vi as ServiceRegistry, vn as RouteTarget, vr as ComponentElement, vt as createSyncApp, w as ScrollService, wn as parseUrl, wr as ChannelRegistration, wt as WorkerApp, x as EditingProxySink, xn as RouteParams, xr as structurallyEqual, xt as CreateAppOptions, y as SemanticsMirrorSink, yn as route, yr as FrameworkChild, yt as GessoAppBuilder, z as FrameService, zn as ShellFileResult, zr as themeTokenCell, zt as UiTreeNode } from "./index-BvaYnj-Q.js";
4
+ import { $ as StorageAdapter, $n as UiOwnerReport, $r as Resource, $t as FontFaceDeclaration, A as Presence, An as AudioState, Ar as Channel, At as ActionCause, B as PersistedOptions, Bn as ShellFileType, Br as bind, Bt as UiTreeSnapshot, C as FocusService, Cn as formatUrl, Cr as pickKeys, Ct as AppLogicEndpoint, D as FindService, Dn as AudioRequest, Dr as findUnplainPath, Dt as ShellHistoryMode, E as TextService, En as AudioMetadata, Er as createChannelRegistry, Et as ShellHistory, F as AudioSinkOptions, Fn as UiDuration, Fr as ControlledOptions, Ft as DevtoolsEvent, G as IndexedDbStorage, Gn as ShellStorageResult, Gr as EachKey, Gt as FrameMetrics, H as persisted, Hn as ShellRequest, Hr as ShowProps, Ht as RuntimeErrorSource, I as AudioSinkOutput, In as UiEasingChoice, Ir as ControlledValue, It as DevtoolsRequest, J as OpfsFileHandle, Jn as observeColorScheme, Jr as debounced, Jt as GessoRuntimeOptions, K as IndexedDbStorageOptions, Kn as ColorScheme, Kr as EachProps, Kt as FramePhaseTimings, L as MediaSessionLike, Ln as ShellFile, Lr as controlled, Lt as FrameEntry, M as RouterOutlet, Mn as AnimateOptions, Mr as Inject, Mt as ChannelErrorEntry, N as AudioElementLike, Nn as AnimationService, Nr as Input, Nt as CommandEntry, O as observeMediaQuery, On as AudioSample, Or as requirePlainData, Ot as ShellHistoryOptions, P as AudioSink, Pn as SpringOptions, Pr as Output, Pt as ConsoleEntry, Q as MemoryStorage, Qn as UiNodeReport, Qr as mutate, Qt as UiFramePhase, R as audioClock, Rn as ShellFileRequest, Rr as ThemeTokenCell, Rt as PatchEntry, S as writeClipboard, Sn as buildPath, Sr as pick, St as createApp, T as EditingService, Tn as AudioAction, Tr as ChannelRegistryHandle, Tt as WorkerAppOptions, U as ShellStorage, Un as ShellService, Ur as show, Ut as RuntimeToShellMessage, V as PersistedState, Vn as ShellRecentFile, Vr as Show, Vt as treeText, W as ShellStorageOptions, Wn as ShellStorageOp, Wr as Each, Wt as ShellToRuntimeMessage, X as OpfsStorageOptions, Xn as NodePathTarget, Xr as MutateOptions, Xt as RuntimeInput, Y as OpfsStorage, Yn as BoundStream, Yr as throttled, Yt as RendererChoice, Z as OpfsWritable, Zn as UiEnvironmentReport, Zr as Mutation, Zt as UI_FRAME_PHASES, _ as EditingMirrorTarget, _i as derive, _n as RouteOptions, _r as createComponent, _t as GessoAppOptions, a as UiRole, ai as select, an as MediaOptions, ar as formatAge, at as storageReadValue, b as EditingProxy, bn as to, br as isComponentElement, bt as WebMcpChoice, c as UiSemanticsPatch, ci as FanOut, cn as RouteMatch, cr as formatStream, ct as UndoableOptions, d as markNow, di as ComputedCell, dn as RouterService, dr as ComponentHost, dt as UndoStackOptions, ei as ResourceOptions, en as FontFaceLike, er as UiPropOrigin, et as StorageOutcome, f as measureSpan, fi as ComputedOptions, fn as RouteState, fr as OverlayLayer, ft as UndoTransaction, g as renderRoot, gi as Equality, gn as RouteGuard, gr as OverlayService, gt as GessoApp, h as RenderWorkerApp, hi as DeriveOptions, hn as RouteDefinition, hr as OverlayRect, ht as shellStorageDenied, i as UI_SEMANTIC_STATES, ii as SelectOptions, in as FontService, ir as describeStream, it as storageReadFailure, j as PresenceProps, jn as AudioStatus, jr as Define, jt as ActionEntry, k as observeReducedMotion, kn as AudioService, kr as ChannelRegistry, kt as createShellHistory, l as UiSemanticsRecord, li as FanOutOptions, ln as RouterHistorySink, lr as printPropValue, lt as undoable, m as setPerformanceMarks, mi as computed, mn as RouteContext, mr as OverlayPlacement, mt as performShellStorage, n as MARK_PREFIX, ni as ResourceStatus, nn as FontFamilyStatus, nr as UiSemanticsReport, nt as classifyStorageError, o as UiSemanticState, oi as FanCell, on as MediaService, or as formatNodePath, ot as UndoShortcutOptions, p as performanceMarksEnabled, pi as ReadSource, pn as OutletProps, pr as OverlayEntry, pt as ShellLocalStore, q as OpfsDirectory, qn as ColorSchemePreference, qr as each, qt as GessoRuntime, r as UI_ROLES, ri as resource, rn as FontHost, rr as UiStreamReport, rt as storageErrorMessage, s as UiSemanticsMap, si as FanKey, sn as RouteAnswer, sr as formatNodeReport, st as registerUndoShortcuts, t as EditingState, ti as ResourceState, tn as FontFamilyDeclaration, tr as UiPropReport, tt as StorageRead, u as markInstant, ui as fanOut, un as RouterRoutes, ur as ComponentHostResolver, ut as UndoStack, v as SemanticsMirror, vi as ServiceRegistry, vn as RouteTarget, vr as ComponentElement, vt as createSyncApp, w as ScrollService, wn as parseUrl, wr as ChannelRegistration, wt as WorkerApp, x as EditingProxySink, xn as RouteParams, xr as structurallyEqual, xt as CreateAppOptions, y as SemanticsMirrorSink, yn as route, yr as FrameworkChild, yt as GessoAppBuilder, z as FrameService, zn as ShellFileResult, zr as themeTokenCell, zt as UiTreeNode } from "./index-B8PU7Cf0.js";
5
5
  export { APPLICATION_WORKER, type ActionCause, type ActionEntry, type AnimateOptions, AnimationService, type AppLogicEndpoint, type AudioAction, type AudioElementLike, type AudioMetadata, type AudioRequest, type AudioSample, AudioService, AudioSink, type AudioSinkOptions, type AudioSinkOutput, type AudioState, type AudioStatus, type BoundStream, BoundsCell, Channel, type ChannelClientMessage, type ChannelErrorEntry, type ChannelHostMessage, type ChannelPort, type ChannelRegistration, ChannelRegistry, type ChannelRegistryHandle, ChannelReplica, type ChannelSchema, type ChannelSource, type ChannelSpec, type ChannelToken, type ClassComponent, type ColorScheme, type ColorSchemePreference, type Command, type CommandEntry, type CommandMap, type CommandSchema, type CommandsOf, Component, type ComponentContext, type ComponentElement, ComponentHost, ComponentHostResolver, type ComponentProps, type ComponentType, ComputedCell, type ComputedOptions, type ConsoleEntry, type ControlledOptions, type ControlledValue, type CreateAppOptions, Define, type DeriveOptions, type DevtoolsEvent, type DevtoolsRequest, Each, type EachKey, type EachProps, type EditingMirrorTarget, EditingProxy, type EditingProxySink, EditingService, type EditingState, type EmitArgs, type EmitValue, type Equality, FanCell, type FanKey, FanOut, type FanOutOptions, FindService, FocusService, type FontFaceDeclaration, type FontFaceLike, type FontFamilyDeclaration, type FontFamilyStatus, type FontHost, FontService, type FrameEntry, type FrameMetrics, type FramePhaseTimings, FrameService, type FrameworkChild, type FunctionComponent, GessoApp, GessoAppBuilder, type GessoAppOptions, GessoRuntime, type GessoRuntimeOptions, IndexedDbStorage, type IndexedDbStorageOptions, Inject, Input, InputCell, type Inputs, InternalState, type JsonSchema, MARK_PREFIX, type MediaOptions, MediaService, type MediaSessionLike, MemoryStorage, type MessageEndpoint, type MutateOptions, type Mutation, type NodePathTarget, type OpfsDirectory, type OpfsFileHandle, OpfsStorage, type OpfsStorageOptions, type OpfsWritable, type OutletProps, Output, type OutputCell, type OutputTarget, type OverlayEntry, OverlayLayer, type OverlayPlacement, type OverlayRect, OverlayService, type Patch, type PatchEntry, type PatchPath, type PersistedOptions, PersistedState, type PortHandshake, type PortHost, Presence, type PresenceProps, ProvidedChannel, type ReadSource, type ReadableCell, RenderWorkerApp, type RendererChoice, Resource, type ResourceOptions, type ResourceState, type ResourceStatus, type RouteAnswer, type RouteContext, type RouteDefinition, type RouteGuard, type RouteMatch, type RouteOptions, type RouteParams, RouteState, type RouteTarget, type RouterHistorySink, RouterOutlet, type RouterRoutes, RouterService, type RuntimeErrorSource, type RuntimeInput, type RuntimeToShellMessage, ScrollService, type SelectOptions, SemanticsMirror, type SemanticsMirrorSink, type ServedChannel, ServiceRegistry, type ShellFile, type ShellFileRequest, type ShellFileResult, type ShellFileType, type ShellHistory, type ShellHistoryMode, type ShellHistoryOptions, type ShellLocalStore, type ShellRecentFile, type ShellRequest, ShellService, ShellStorage, type ShellStorageOp, type ShellStorageOptions, type ShellStorageResult, type ShellToRuntimeMessage, Show, type ShowProps, type SpringOptions, type StorageAdapter, type StorageOutcome, type StorageRead, TextService, ThemeTokenCell, UI_FRAME_PHASES, UI_ROLES, UI_SEMANTIC_STATES, type UiDuration, type UiEasingChoice, type UiEnvironmentReport, type UiFramePhase, type UiNodeReport, type UiOwnerReport, type UiPropOrigin, type UiPropReport, type UiRole, type UiSemanticState, type UiSemanticsMap, type UiSemanticsPatch, type UiSemanticsRecord, type UiSemanticsReport, type UiStreamReport, type UiTreeNode, type UiTreeSnapshot, type UndoShortcutOptions, UndoStack, type UndoStackOptions, type UndoTransaction, type UndoableOptions, type ViewOf, type WebMcpChoice, WorkerApp, type WorkerAppOptions, type WorkerHandle, applyPatch, applyPatches, audioClock, bind, bounds, buildPath, channel, channelSchema, classifyStorageError, computed, controlled, createApp, createChannelRegistry, createComponent, createShellHistory, createSyncApp, debounced, defineChannel, derive, describeChannel, describeStream, diffProjection, each, fanOut, findUnplainPath, formatAge, formatNodePath, formatNodeReport, formatStream, formatUrl, input, internalState, into, isChannelClientMessage, isChannelHostMessage, isClassComponent, isComponentElement, isHubMessage, isOutputTarget, isPortErrorMessage, isPortHandshake, markInstant, markNow, measureSpan, mutate, observeColorScheme, observeMediaQuery, observeReducedMotion, output, parseUrl, performShellStorage, performanceMarksEnabled, persisted, pick, pickKeys, portHandle, printPropValue, provide, registerUndoShortcuts, renderRoot, requirePlainData, resource, route, select, serve, serveChannels, servePorts, setPerformanceMarks, shellStorageDenied, show, storageErrorMessage, storageReadFailure, storageReadValue, structurallyEqual, themeTokenCell, throttled, to, treeText, undoable, viewKeys, workerHandle, writeClipboard };
package/dist/index.js CHANGED
@@ -1949,6 +1949,35 @@ var ShellService = class {
1949
1949
  });
1950
1950
  }
1951
1951
  /**
1952
+ * Opens this application at one of its own urls, somewhere new: what
1953
+ * a Cmd-click or a Ctrl-click on an in-app link asks for.
1954
+ *
1955
+ * Not `openUrl`, because the two urls are different kinds of thing.
1956
+ * `openUrl` takes an address that already means something to the
1957
+ * browser. This takes the router's url, `/epic/BUD-12?story=BUD-13`,
1958
+ * which means something only to this application, and only the
1959
+ * shell knows what address shows the application at it: a path on
1960
+ * the page's origin, a fragment on the page's own address, a tab in
1961
+ * the product the app is embedded in, or a new native window. The
1962
+ * render thread cannot know which, so it names the route and the
1963
+ * shell decides.
1964
+ *
1965
+ * What each shell does, in order: the host's `onOpenRoute` if it gave
1966
+ * one; otherwise a new tab at the address the history gives for the
1967
+ * url (`ShellHistory.href`); otherwise, where there is no address,
1968
+ * which is `memory` mode, the shell follows the url in place, exactly
1969
+ * as `RouterService.navigate` would, rather than doing nothing.
1970
+ *
1971
+ * The current screen does not navigate. Nothing comes back, as with
1972
+ * `openUrl`. With no shell installed the request is dropped.
1973
+ */
1974
+ openRoute(url) {
1975
+ this.handler?.({
1976
+ type: "openRoute",
1977
+ url
1978
+ });
1979
+ }
1980
+ /**
1952
1981
  * Replaces the page with `url`, leaving the application.
1953
1982
  *
1954
1983
  * Not the router's `navigate`, which moves between screens *inside*
@@ -3794,6 +3823,35 @@ function isShellHistory(value) {
3794
3823
  return value !== void 0 && typeof value.push === "function" && typeof value.onChange === "function";
3795
3824
  }
3796
3825
  /**
3826
+ * Opens the app at `url` somewhere new, as the shell's answer to
3827
+ * `ShellService.openRoute`.
3828
+ *
3829
+ * In this order, and the order is the decision. A host's own handler
3830
+ * wins, because an app embedded in another product or in a desktop
3831
+ * window knows what a new tab means there and a browser default would
3832
+ * be wrong in both. Without one, the history is asked for the address
3833
+ * that holds `url`, and that address is opened. Without an address,
3834
+ * which is `memory` mode and any handed-in history with no `href`, the
3835
+ * link is followed in place: a Cmd-click that did nothing at all would
3836
+ * read as a broken link, and arriving at the destination in the window
3837
+ * already open is what a browser does with a modifier it cannot honour.
3838
+ *
3839
+ * Shared by `WorkerApp` and `GessoApp`, which differ only in how a url
3840
+ * reaches the router, so it is passed in.
3841
+ */
3842
+ function openRouteWith(handler, url, history, open, followInPlace) {
3843
+ if (handler !== void 0) {
3844
+ handler(url);
3845
+ return;
3846
+ }
3847
+ const address = history?.href?.(url) ?? null;
3848
+ if (address !== null) {
3849
+ open(address);
3850
+ return;
3851
+ }
3852
+ followInPlace(url);
3853
+ }
3854
+ /**
3797
3855
  * Stops an app hearing about a history it is done with.
3798
3856
  *
3799
3857
  * A history the app made is disposed, which drops its listeners and
@@ -3836,6 +3894,10 @@ var MemoryHistory = class {
3836
3894
  dispose() {
3837
3895
  this.listener = null;
3838
3896
  }
3897
+ /** No address: a url kept here names no page another tab could load. */
3898
+ href() {
3899
+ return null;
3900
+ }
3839
3901
  step(delta) {
3840
3902
  const next = this.index + delta;
3841
3903
  if (next < 0 || next >= this.entries.length) return;
@@ -3903,6 +3965,17 @@ var BrowserHistory = class {
3903
3965
  this.host.removeEventListener("popstate", this.onPopState);
3904
3966
  this.host.removeEventListener("hashchange", this.onHashChange);
3905
3967
  }
3968
+ /**
3969
+ * The address `push` would write for `url`, for a new tab to open.
3970
+ *
3971
+ * Relative, as `pushState` takes it, and resolved against the page by
3972
+ * whatever opens it: `/epic/2` in `path` mode, and the page's own
3973
+ * path and query with the fragment set in `hash` mode, so the new tab
3974
+ * loads the same document and starts on the same screen.
3975
+ */
3976
+ href(url) {
3977
+ return this.toHref(url);
3978
+ }
3906
3979
  report() {
3907
3980
  const url = this.url;
3908
3981
  if (url === this.written) return;
@@ -4596,6 +4669,16 @@ var WorkerApp = class {
4596
4669
  openUrlWith(this.options.onOpenUrl, message.url);
4597
4670
  return;
4598
4671
  }
4672
+ if (message.type === "openRoute") {
4673
+ openRouteWith(this.options.onOpenRoute, message.url, this.history, (address) => window.open(address, "_blank", "noopener"), (url) => {
4674
+ this.history?.push(url);
4675
+ this.post({
4676
+ type: "url",
4677
+ url
4678
+ });
4679
+ });
4680
+ return;
4681
+ }
4599
4682
  if (message.type === "redirect") {
4600
4683
  redirectWith(this.options.onRedirect, message.url, window.location);
4601
4684
  return;
@@ -9750,6 +9833,7 @@ var GessoApp = class {
9750
9833
  accessibilityEnabled;
9751
9834
  adapter;
9752
9835
  historyOptions;
9836
+ onOpenRoute;
9753
9837
  running = false;
9754
9838
  resizeObserver = null;
9755
9839
  proxy = null;
@@ -9779,6 +9863,7 @@ var GessoApp = class {
9779
9863
  this.inputEnabled = options.input ?? true;
9780
9864
  this.accessibilityEnabled = options.accessibility ?? true;
9781
9865
  this.historyOptions = options.history;
9866
+ this.onOpenRoute = options.onOpenRoute;
9782
9867
  this.colorSchemePreference = options.colorScheme ?? "auto";
9783
9868
  this.runtime = new GessoRuntime({
9784
9869
  root: options.root,
@@ -10094,6 +10179,14 @@ var GessoApp = class {
10094
10179
  else history.forward();
10095
10180
  return;
10096
10181
  }
10182
+ if (request.type === "openRoute") {
10183
+ const view = isCanvasElement(this.canvas) ? this.canvas.ownerDocument.defaultView : null;
10184
+ openRouteWith(this.onOpenRoute, request.url, view === null ? null : history, (address) => view?.open(address, "_blank", "noopener"), (url) => {
10185
+ history.push(url);
10186
+ this.runtime.setUrl(url);
10187
+ });
10188
+ return;
10189
+ }
10097
10190
  if (!isCanvasElement(this.canvas)) {
10098
10191
  if (request.type === "popup") this.runtime.settlePopup(request.id, false);
10099
10192
  else if (request.type === "storage") this.runtime.settleStorage(request.id, shellStorageDenied());
@@ -11449,6 +11542,10 @@ var RenderWorkerApp = class {
11449
11542
  type: "openUrl",
11450
11543
  url: request.url
11451
11544
  });
11545
+ else if (request.type === "openRoute") this.host.postMessage({
11546
+ type: "openRoute",
11547
+ url: request.url
11548
+ });
11452
11549
  else if (request.type === "redirect") this.host.postMessage({
11453
11550
  type: "redirect",
11454
11551
  url: request.url