@aperture-browser/session-react 0.0.0-nightly.94.647ec69595a0 → 0.0.0-nightly.95.3b4883f6d9c2

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/index.d.ts CHANGED
@@ -20,6 +20,19 @@ interface ApertureSessionFeatures extends SessionFeatures {
20
20
  type ResolvedSessionFeatures = Required<SessionFeatures>;
21
21
  declare function resolveSessionFeatures(features?: SessionFeatures): ResolvedSessionFeatures;
22
22
  //#endregion
23
+ //#region src/ui-root.d.ts
24
+ type ApertureTheme = "light" | "dark" | "system";
25
+ interface ApertureUIRootProps {
26
+ readonly theme?: ApertureTheme;
27
+ readonly className?: string;
28
+ readonly children?: ReactNode;
29
+ }
30
+ declare function ApertureUIRoot({
31
+ theme,
32
+ className,
33
+ children
34
+ }: ApertureUIRootProps): import("react").JSX.Element;
35
+ //#endregion
23
36
  //#region src/aperture-session.d.ts
24
37
  interface SessionProps {
25
38
  readonly access: SessionAccess$1 | null;
@@ -28,7 +41,7 @@ interface SessionProps {
28
41
  }
29
42
  interface ApertureSessionProps extends SessionProps {
30
43
  readonly features?: ApertureSessionFeatures;
31
- readonly theme?: "light" | "dark" | "system";
44
+ readonly theme?: ApertureTheme;
32
45
  readonly className?: string;
33
46
  }
34
47
  declare function ApertureSession({
@@ -93,5 +106,5 @@ declare function BrowserViewport({
93
106
  //#region src/notices.d.ts
94
107
  declare function showNotice(notice: SessionNotice): void;
95
108
  //#endregion
96
- export { ApertureProvider, ApertureProviderProps, ApertureRuntime, ApertureRuntimeOptions, ApertureSession, ApertureSessionFeatures, ApertureSessionProps, BrowserCommands, BrowserControlPane, BrowserMediaPath, BrowserMediaPhase, BrowserViewport, BrowserViewportProps, ClipboardError, CollaborationControl, type CollaborationCursor, type CollaborationError, type CollaborationLeaseMode, type CollaborationPaintEvent, type CollaborationPaintPoint, type CollaborationParticipant, type CollaborationPhase, type CollaborationRole, LiveSessionControl, LiveSessionError, LiveSessionMediaSelection, LiveSessionMediaSize, LiveSessionViewportOwnership, ResolvedSessionFeatures, RuntimeProvider, RuntimeProviderMissingError, Session, type SessionAccess, SessionFeatures, SessionNotice, SessionProps, SessionStatus, SessionViewport, SessionViewportOverlay, SessionViewportPlaceholder, SessionViewportProps, SessionViewportStatus, UseBrowserControlResult, UseSessionOptions, UseSessionResult, collaborationPaintLifetimeMs, copyText, copyTextWithToast, devToolsUrl, makeApertureRuntime, resolveSessionFeatures, shareSessionAccess, showNotice, useBaseUrl, useBrowserControl, useEffectCallback, useFork, useLiveSession, useRunApi, useRuntime, useSession };
109
+ export { ApertureProvider, ApertureProviderProps, ApertureRuntime, ApertureRuntimeOptions, ApertureSession, ApertureSessionFeatures, ApertureSessionProps, ApertureTheme, ApertureUIRoot, ApertureUIRootProps, BrowserCommands, BrowserControlPane, BrowserMediaPath, BrowserMediaPhase, BrowserViewport, BrowserViewportProps, ClipboardError, CollaborationControl, type CollaborationCursor, type CollaborationError, type CollaborationLeaseMode, type CollaborationPaintEvent, type CollaborationPaintPoint, type CollaborationParticipant, type CollaborationPhase, type CollaborationRole, LiveSessionControl, LiveSessionError, LiveSessionMediaSelection, LiveSessionMediaSize, LiveSessionViewportOwnership, ResolvedSessionFeatures, RuntimeProvider, RuntimeProviderMissingError, Session, type SessionAccess, SessionFeatures, SessionNotice, SessionProps, SessionStatus, SessionViewport, SessionViewportOverlay, SessionViewportPlaceholder, SessionViewportProps, SessionViewportStatus, UseBrowserControlResult, UseSessionOptions, UseSessionResult, collaborationPaintLifetimeMs, copyText, copyTextWithToast, devToolsUrl, makeApertureRuntime, resolveSessionFeatures, shareSessionAccess, showNotice, useBaseUrl, useBrowserControl, useEffectCallback, useFork, useLiveSession, useRunApi, useRuntime, useSession };
97
110
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -10,13 +10,13 @@ import { clsx } from "clsx";
10
10
  import { twMerge } from "tailwind-merge";
11
11
  import { useTheme } from "next-themes";
12
12
  import { Toaster, toast } from "sonner";
13
- import { Tooltip } from "@base-ui/react/tooltip";
14
13
  import * as ResizablePrimitive from "react-resizable-panels";
15
14
  import { usePanelRef } from "react-resizable-panels";
16
15
  import * as Schedule from "effect/Schedule";
17
16
  import { Button } from "@base-ui/react/button";
18
17
  import { ContextMenu } from "@base-ui/react/context-menu";
19
18
  import { Input } from "@base-ui/react/input";
19
+ import { Tooltip } from "@base-ui/react/tooltip";
20
20
  import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
21
21
  import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
22
22
  import { PreviewCard } from "@base-ui/react/preview-card";
@@ -104,57 +104,6 @@ const Toaster$1 = ({ ...props }) => {
104
104
  });
105
105
  };
106
106
  //#endregion
107
- //#region ../ui/src/portal.tsx
108
- const PortalContainerContext = createContext(void 0);
109
- function PortalContainerProvider({ container, children }) {
110
- return /* @__PURE__ */ jsx(PortalContainerContext.Provider, {
111
- value: container,
112
- children
113
- });
114
- }
115
- function usePortalContainer() {
116
- return useContext(PortalContainerContext);
117
- }
118
- //#endregion
119
- //#region ../ui/src/components/tooltip.tsx
120
- function TooltipProvider({ delay = 0, ...props }) {
121
- return /* @__PURE__ */ jsx(Tooltip.Provider, {
122
- "data-slot": "tooltip-provider",
123
- delay,
124
- ...props
125
- });
126
- }
127
- function Tooltip$1({ ...props }) {
128
- return /* @__PURE__ */ jsx(Tooltip.Root, {
129
- "data-slot": "tooltip",
130
- ...props
131
- });
132
- }
133
- function TooltipTrigger({ ...props }) {
134
- return /* @__PURE__ */ jsx(Tooltip.Trigger, {
135
- "data-slot": "tooltip-trigger",
136
- ...props
137
- });
138
- }
139
- function TooltipContent({ className, side = "top", sideOffset = 4, align = "center", alignOffset = 0, children, ...props }) {
140
- return /* @__PURE__ */ jsx(Tooltip.Portal, {
141
- container: usePortalContainer(),
142
- children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
143
- align,
144
- alignOffset,
145
- side,
146
- sideOffset,
147
- className: "isolate z-50",
148
- children: /* @__PURE__ */ jsxs(Tooltip.Popup, {
149
- "data-slot": "tooltip-content",
150
- className: cn("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
151
- ...props,
152
- children: [children, /* @__PURE__ */ jsx(Tooltip.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" })]
153
- })
154
- })
155
- });
156
- }
157
- //#endregion
158
107
  //#region src/features.ts
159
108
  function resolveSessionFeatures(features) {
160
109
  return {
@@ -209,6 +158,18 @@ function Button$1({ className, variant = "default", size = "default", ...props }
209
158
  });
210
159
  }
211
160
  //#endregion
161
+ //#region ../ui/src/portal.tsx
162
+ const PortalContainerContext = createContext(void 0);
163
+ function PortalContainerProvider({ container, children }) {
164
+ return /* @__PURE__ */ jsx(PortalContainerContext.Provider, {
165
+ value: container,
166
+ children
167
+ });
168
+ }
169
+ function usePortalContainer() {
170
+ return useContext(PortalContainerContext);
171
+ }
172
+ //#endregion
212
173
  //#region ../ui/src/components/context-menu.tsx
213
174
  function ContextMenu$1({ ...props }) {
214
175
  return /* @__PURE__ */ jsx(ContextMenu.Root, {
@@ -334,6 +295,45 @@ function InputGroupInput({ className, ...props }) {
334
295
  });
335
296
  }
336
297
  //#endregion
298
+ //#region ../ui/src/components/tooltip.tsx
299
+ function TooltipProvider({ delay = 0, ...props }) {
300
+ return /* @__PURE__ */ jsx(Tooltip.Provider, {
301
+ "data-slot": "tooltip-provider",
302
+ delay,
303
+ ...props
304
+ });
305
+ }
306
+ function Tooltip$1({ ...props }) {
307
+ return /* @__PURE__ */ jsx(Tooltip.Root, {
308
+ "data-slot": "tooltip",
309
+ ...props
310
+ });
311
+ }
312
+ function TooltipTrigger({ ...props }) {
313
+ return /* @__PURE__ */ jsx(Tooltip.Trigger, {
314
+ "data-slot": "tooltip-trigger",
315
+ ...props
316
+ });
317
+ }
318
+ function TooltipContent({ className, side = "top", sideOffset = 4, align = "center", alignOffset = 0, children, ...props }) {
319
+ return /* @__PURE__ */ jsx(Tooltip.Portal, {
320
+ container: usePortalContainer(),
321
+ children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
322
+ align,
323
+ alignOffset,
324
+ side,
325
+ sideOffset,
326
+ className: "isolate z-50",
327
+ children: /* @__PURE__ */ jsxs(Tooltip.Popup, {
328
+ "data-slot": "tooltip-content",
329
+ className: cn("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
330
+ ...props,
331
+ children: [children, /* @__PURE__ */ jsx(Tooltip.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" })]
332
+ })
333
+ })
334
+ });
335
+ }
336
+ //#endregion
337
337
  //#region ../ui/src/components/hover-card.tsx
338
338
  function HoverCard(props) {
339
339
  return /* @__PURE__ */ jsx(PreviewCard.Root, {
@@ -2200,6 +2200,14 @@ function BrowserControlPane({ control, leading, features: featureOverrides, coll
2200
2200
  window.localStorage.setItem(LOCAL_CURSOR_STORAGE_KEY, String(enabled));
2201
2201
  } catch {}
2202
2202
  }
2203
+ const viewport = /* @__PURE__ */ jsx(BrowserViewport, {
2204
+ control,
2205
+ viewport: control.viewport,
2206
+ localCursorEnabled,
2207
+ paintingEnabled: features.drawing && paintingEnabled,
2208
+ onPaintingEnabledChange: setPaintingEnabled,
2209
+ statusBadge: features.statusBadge
2210
+ });
2203
2211
  return /* @__PURE__ */ jsxs("div", {
2204
2212
  className: "flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden",
2205
2213
  children: [/* @__PURE__ */ jsx(BrowserToolbar, {
@@ -2219,7 +2227,7 @@ function BrowserControlPane({ control, leading, features: featureOverrides, coll
2219
2227
  onDevToolsOpenChange: handleDevToolsOpenChange,
2220
2228
  onDevToolsDockChange: setDevToolsDock,
2221
2229
  onSessionDetails
2222
- }), /* @__PURE__ */ jsxs(ResizablePanelGroup, {
2230
+ }), features.devTools ? /* @__PURE__ */ jsxs(ResizablePanelGroup, {
2223
2231
  orientation: devToolsDock === "bottom" ? "vertical" : "horizontal",
2224
2232
  className: "min-h-0 min-w-0 flex-1 has-[[data-separator=active]]:[&_iframe]:pointer-events-none",
2225
2233
  children: [
@@ -2227,14 +2235,7 @@ function BrowserControlPane({ control, leading, features: featureOverrides, coll
2227
2235
  className: "flex min-h-0 min-w-0",
2228
2236
  defaultSize: "60%",
2229
2237
  minSize: "20%",
2230
- children: /* @__PURE__ */ jsx(BrowserViewport, {
2231
- control,
2232
- viewport: control.viewport,
2233
- localCursorEnabled,
2234
- paintingEnabled: features.drawing && paintingEnabled,
2235
- onPaintingEnabledChange: setPaintingEnabled,
2236
- statusBadge: features.statusBadge
2237
- })
2238
+ children: viewport
2238
2239
  }),
2239
2240
  /* @__PURE__ */ jsx(ResizableHandle, {
2240
2241
  withHandle: true,
@@ -2247,7 +2248,7 @@ function BrowserControlPane({ control, leading, features: featureOverrides, coll
2247
2248
  collapsible: true,
2248
2249
  defaultSize: "40%",
2249
2250
  minSize: "20%",
2250
- children: Array.from(features.devTools ? devToolsTargetIds : [], (targetId) => /* @__PURE__ */ jsx("div", {
2251
+ children: Array.from(devToolsTargetIds, (targetId) => /* @__PURE__ */ jsx("div", {
2251
2252
  className: "h-full min-h-0 w-full min-w-0",
2252
2253
  hidden: targetId !== activeTargetId,
2253
2254
  children: /* @__PURE__ */ jsx(BrowserDevToolsPane, {
@@ -2257,28 +2258,19 @@ function BrowserControlPane({ control, leading, features: featureOverrides, coll
2257
2258
  }, targetId))
2258
2259
  })
2259
2260
  ]
2260
- })]
2261
+ }) : viewport]
2261
2262
  });
2262
2263
  }
2263
2264
  //#endregion
2264
- //#region src/aperture-session.tsx
2265
- function ApertureSession({ theme = "system", className, ...props }) {
2265
+ //#region src/ui-root.tsx
2266
+ function ApertureUIRoot({ theme = "system", className, children }) {
2266
2267
  const [root, setRoot] = useState(null);
2267
- const dark = useDarkTheme(theme);
2268
2268
  return /* @__PURE__ */ jsx("div", {
2269
2269
  ref: setRoot,
2270
- className: cn("aperture-root relative h-full w-full", dark && "dark", className),
2271
- children: root ? /* @__PURE__ */ jsx(ApertureProvider, {
2272
- baseUrl: props.access?.baseUrl,
2273
- children: /* @__PURE__ */ jsx(PortalContainerProvider, {
2274
- container: root,
2275
- children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [/* @__PURE__ */ jsx(Session, { ...props }), props.features?.toaster !== false ? /* @__PURE__ */ jsx(Toaster$1, {
2276
- theme: dark ? "dark" : "light",
2277
- richColors: true,
2278
- closeButton: true,
2279
- position: "bottom-center"
2280
- }) : null] })
2281
- })
2270
+ className: cn("aperture-root relative h-full w-full", useDarkTheme(theme) && "dark", className),
2271
+ children: root ? /* @__PURE__ */ jsx(PortalContainerProvider, {
2272
+ container: root,
2273
+ children: /* @__PURE__ */ jsx(TooltipProvider, { children })
2282
2274
  }) : null
2283
2275
  });
2284
2276
  }
@@ -2294,6 +2286,23 @@ function useDarkTheme(theme) {
2294
2286
  }, [theme]);
2295
2287
  return theme === "dark" || theme === "system" && systemDark;
2296
2288
  }
2289
+ //#endregion
2290
+ //#region src/aperture-session.tsx
2291
+ function ApertureSession({ theme = "system", className, ...props }) {
2292
+ return /* @__PURE__ */ jsx(ApertureUIRoot, {
2293
+ theme,
2294
+ className,
2295
+ children: /* @__PURE__ */ jsxs(ApertureProvider, {
2296
+ baseUrl: props.access?.baseUrl,
2297
+ children: [/* @__PURE__ */ jsx(Session, { ...props }), props.features?.toaster !== false ? /* @__PURE__ */ jsx(Toaster$1, {
2298
+ theme,
2299
+ richColors: true,
2300
+ closeButton: true,
2301
+ position: "bottom-center"
2302
+ }) : null]
2303
+ })
2304
+ });
2305
+ }
2297
2306
  function Session({ access, features, leading }) {
2298
2307
  const { status, control } = useSession({
2299
2308
  access,
@@ -2360,6 +2369,6 @@ function SessionState({ icon, title, description }) {
2360
2369
  });
2361
2370
  }
2362
2371
  //#endregion
2363
- export { ApertureProvider, ApertureSession, BrowserControlPane, BrowserViewport, ClipboardError, LiveSessionError, RuntimeProvider, RuntimeProviderMissingError, Session, SessionViewport, collaborationPaintLifetimeMs, copyText, copyTextWithToast, devToolsUrl, makeApertureRuntime, resolveSessionFeatures, shareSessionAccess, showNotice, useBaseUrl, useBrowserControl, useEffectCallback, useFork, useLiveSession, useRunApi, useRuntime, useSession };
2372
+ export { ApertureProvider, ApertureSession, ApertureUIRoot, BrowserControlPane, BrowserViewport, ClipboardError, LiveSessionError, RuntimeProvider, RuntimeProviderMissingError, Session, SessionViewport, collaborationPaintLifetimeMs, copyText, copyTextWithToast, devToolsUrl, makeApertureRuntime, resolveSessionFeatures, shareSessionAccess, showNotice, useBaseUrl, useBrowserControl, useEffectCallback, useFork, useLiveSession, useRunApi, useRuntime, useSession };
2364
2373
 
2365
2374
  //# sourceMappingURL=index.js.map