moi-computer 0.10.1-next.6 → 0.11.0

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.
@@ -14,6 +14,17 @@ function rejectAfter(ms: number): Promise<never> {
14
14
  })
15
15
  }
16
16
 
17
+ // Scrollbars are meaningless in a static capture, and a cloned scroll
18
+ // container can reserve a classic scrollbar gutter the live page (overlay
19
+ // scrollbars) doesn't have — shifting centered content by the gutter width.
20
+ // Hidden clips exactly like auto/scroll minus the gutter.
21
+ function hideCloneScrollbars(node: Node): void {
22
+ if (!(node instanceof HTMLElement)) return
23
+ const { overflowX, overflowY } = node.style
24
+ if (overflowY === 'auto' || overflowY === 'scroll') node.style.overflowY = 'hidden'
25
+ if (overflowX === 'auto' || overflowX === 'scroll') node.style.overflowX = 'hidden'
26
+ }
27
+
17
28
  // Capture one visible DOM region into a canvas. This is deliberately unaware
18
29
  // of workspaces, chat, and drawing so other flows can reuse it later.
19
30
  export async function captureElement(element: HTMLElement): Promise<HTMLCanvasElement> {
@@ -32,7 +43,8 @@ export async function captureElement(element: HTMLElement): Promise<HTMLCanvasEl
32
43
  backgroundColor: getComputedStyle(element).backgroundColor,
33
44
  timeout: ASSET_TIMEOUT_MS,
34
45
  features: { restoreScrollPosition: true },
35
- style: { overflow: 'hidden' }
46
+ style: { overflow: 'hidden' },
47
+ onCloneEachNode: hideCloneScrollbars
36
48
  })
37
49
  try {
38
50
  return await domToCanvas(context)
@@ -63,7 +63,7 @@ export function WidgetGridLayout({
63
63
  )
64
64
 
65
65
  return (
66
- <div ref={containerRef} className="mx-auto w-full max-w-[var(--column-w)]">
66
+ <div ref={containerRef} className="w-full">
67
67
  {mounted && (
68
68
  <GridLayout
69
69
  width={width}
@@ -39,7 +39,7 @@ type NoWidgetsCreatedProps = {
39
39
 
40
40
  function NoWidgetsCreated({ onCreateWidget }: NoWidgetsCreatedProps) {
41
41
  return (
42
- <div className="relative min-h-0 flex-1 pt-7">
42
+ <div className="relative min-h-0 w-full max-w-(--column-w) flex-1 pt-7">
43
43
  <div aria-hidden="true">
44
44
  <WidgetGridLayout items={EMPTY_WIDGET_ITEMS} renderItem={renderEmptyWidget} />
45
45
  </div>
@@ -71,7 +71,7 @@ type WidgetActionsProps = {
71
71
 
72
72
  function WidgetActions({ editing, onCreateWidget, onEditingChange }: WidgetActionsProps) {
73
73
  return (
74
- <div className="mx-auto mb-4 flex w-full max-w-(--column-w) shrink-0 items-center justify-end gap-2">
74
+ <div className="mb-4 flex w-full max-w-(--column-w) shrink-0 items-center justify-end gap-2">
75
75
  {editing && (
76
76
  <Button
77
77
  type="button"
@@ -198,7 +198,10 @@ export function Widgets({ onCreateWidget, editing, onEditingChange, widgets }: W
198
198
  <LayoutGroup>
199
199
  <div
200
200
  className={cn(
201
- 'relative flex h-full flex-col p-4',
201
+ // items-center + capped children instead of mx-auto: Chrome can
202
+ // report stale 0px for auto margins after layout animations, which
203
+ // clones them flush-left in annotation captures (capture-element.ts).
204
+ 'relative flex h-full flex-col items-center p-4',
202
205
  hasWidgets ? 'overflow-y-auto' : 'overflow-hidden'
203
206
  )}
204
207
  >
@@ -211,7 +214,7 @@ export function Widgets({ onCreateWidget, editing, onEditingChange, widgets }: W
211
214
  />
212
215
  {visibleItems.length === 0 ? (
213
216
  <motion.div
214
- className="mx-auto flex min-h-0 w-full max-w-[var(--column-w)] flex-1 flex-col"
217
+ className="flex min-h-0 w-full max-w-(--column-w) flex-1 flex-col"
215
218
  animate={{ paddingBottom: panelOpen ? panelHeight : 0 }}
216
219
  transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
217
220
  >
@@ -221,6 +224,7 @@ export function Widgets({ onCreateWidget, editing, onEditingChange, widgets }: W
221
224
  // The open panel's height is reserved below the grid so every card
222
225
  // can scroll clear of the panel.
223
226
  <motion.div
227
+ className="w-full max-w-(--column-w)"
224
228
  animate={{ marginBottom: panelOpen ? panelHeight : 0 }}
225
229
  transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
226
230
  >
@@ -1 +1 @@
1
- import{_c as r}from"/chunk-v7wr1df4.js";if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);async function o(a){let[{mount:t}]=await Promise.all([import("/chunk-vwzshv0d.js"),import("/chunk-kmbxhgwv.js").then((e)=>e.loadAppConfig())]);t(a)}globalThis.__init=o;
1
+ import{_c as r}from"/chunk-v7wr1df4.js";if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);async function o(a){let[{mount:t}]=await Promise.all([import("/chunk-p1yqa71k.js"),import("/chunk-kmbxhgwv.js").then((e)=>e.loadAppConfig())]);t(a)}globalThis.__init=o;