@dxos/react-ui-feed 0.11.1
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/LICENSE +105 -0
- package/dist/lib/chunk-src.mjs +2228 -0
- package/dist/lib/chunk-src.mjs.map +1 -0
- package/dist/lib/index.mjs +2 -0
- package/dist/lib/testing.mjs +1923 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/types/src/components/Block/HtmlBlock.d.ts +14 -0
- package/dist/types/src/components/Block/HtmlBlock.d.ts.map +1 -0
- package/dist/types/src/components/Block/MarkdownBlock.d.ts +24 -0
- package/dist/types/src/components/Block/MarkdownBlock.d.ts.map +1 -0
- package/dist/types/src/components/Block/block.stories.d.ts +21 -0
- package/dist/types/src/components/Block/block.stories.d.ts.map +1 -0
- package/dist/types/src/components/Block/construction.d.ts +36 -0
- package/dist/types/src/components/Block/construction.d.ts.map +1 -0
- package/dist/types/src/components/Block/extensions.d.ts +23 -0
- package/dist/types/src/components/Block/extensions.d.ts.map +1 -0
- package/dist/types/src/components/Block/highlight.d.ts +14 -0
- package/dist/types/src/components/Block/highlight.d.ts.map +1 -0
- package/dist/types/src/components/Block/index.d.ts +6 -0
- package/dist/types/src/components/Block/index.d.ts.map +1 -0
- package/dist/types/src/components/Block/selection-group.d.ts +21 -0
- package/dist/types/src/components/Block/selection-group.d.ts.map +1 -0
- package/dist/types/src/components/Block/widget-state.d.ts +33 -0
- package/dist/types/src/components/Block/widget-state.d.ts.map +1 -0
- package/dist/types/src/components/MessageList/MessageList.d.ts +129 -0
- package/dist/types/src/components/MessageList/MessageList.d.ts.map +1 -0
- package/dist/types/src/components/MessageList/MessageList.stories.d.ts +47 -0
- package/dist/types/src/components/MessageList/MessageList.stories.d.ts.map +1 -0
- package/dist/types/src/components/MessageList/index.d.ts +3 -0
- package/dist/types/src/components/MessageList/index.d.ts.map +1 -0
- package/dist/types/src/components/MessageList/position-log.d.ts +73 -0
- package/dist/types/src/components/MessageList/position-log.d.ts.map +1 -0
- package/dist/types/src/components/Minimap/Minimap.d.ts +28 -0
- package/dist/types/src/components/Minimap/Minimap.d.ts.map +1 -0
- package/dist/types/src/components/Minimap/Minimap.stories.d.ts +21 -0
- package/dist/types/src/components/Minimap/Minimap.stories.d.ts.map +1 -0
- package/dist/types/src/components/Minimap/index.d.ts +2 -0
- package/dist/types/src/components/Minimap/index.d.ts.map +1 -0
- package/dist/types/src/components/Outline/Outline.d.ts +46 -0
- package/dist/types/src/components/Outline/Outline.d.ts.map +1 -0
- package/dist/types/src/components/Outline/Outline.stories.d.ts +37 -0
- package/dist/types/src/components/Outline/Outline.stories.d.ts.map +1 -0
- package/dist/types/src/components/Outline/index.d.ts +2 -0
- package/dist/types/src/components/Outline/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +5 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/debug/Debug.d.ts +17 -0
- package/dist/types/src/debug/Debug.d.ts.map +1 -0
- package/dist/types/src/debug/Stats.d.ts +30 -0
- package/dist/types/src/debug/Stats.d.ts.map +1 -0
- package/dist/types/src/debug/debug-model.d.ts +32 -0
- package/dist/types/src/debug/debug-model.d.ts.map +1 -0
- package/dist/types/src/debug/debug-model.test.d.ts +2 -0
- package/dist/types/src/debug/debug-model.test.d.ts.map +1 -0
- package/dist/types/src/debug/frame-meter.d.ts +48 -0
- package/dist/types/src/debug/frame-meter.d.ts.map +1 -0
- package/dist/types/src/debug/frame-meter.test.d.ts +2 -0
- package/dist/types/src/debug/frame-meter.test.d.ts.map +1 -0
- package/dist/types/src/debug/index.d.ts +6 -0
- package/dist/types/src/debug/index.d.ts.map +1 -0
- package/dist/types/src/debug/use-debug.d.ts +19 -0
- package/dist/types/src/debug/use-debug.d.ts.map +1 -0
- package/dist/types/src/hooks/follow.d.ts +89 -0
- package/dist/types/src/hooks/follow.d.ts.map +1 -0
- package/dist/types/src/hooks/follow.stories.d.ts +25 -0
- package/dist/types/src/hooks/follow.stories.d.ts.map +1 -0
- package/dist/types/src/hooks/follow.test.d.ts +2 -0
- package/dist/types/src/hooks/follow.test.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +6 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useDecorations.d.ts +31 -0
- package/dist/types/src/hooks/useDecorations.d.ts.map +1 -0
- package/dist/types/src/hooks/useFeedNavigation.d.ts +44 -0
- package/dist/types/src/hooks/useFeedNavigation.d.ts.map +1 -0
- package/dist/types/src/hooks/useFollow.d.ts +46 -0
- package/dist/types/src/hooks/useFollow.d.ts.map +1 -0
- package/dist/types/src/hooks/useItemSelection.d.ts +34 -0
- package/dist/types/src/hooks/useItemSelection.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/model/feed-model.d.ts +67 -0
- package/dist/types/src/model/feed-model.d.ts.map +1 -0
- package/dist/types/src/model/feed-model.test.d.ts +2 -0
- package/dist/types/src/model/feed-model.test.d.ts.map +1 -0
- package/dist/types/src/model/feed.d.ts +66 -0
- package/dist/types/src/model/feed.d.ts.map +1 -0
- package/dist/types/src/model/feed.test.d.ts +2 -0
- package/dist/types/src/model/feed.test.d.ts.map +1 -0
- package/dist/types/src/model/index.d.ts +5 -0
- package/dist/types/src/model/index.d.ts.map +1 -0
- package/dist/types/src/model/list-model.d.ts +61 -0
- package/dist/types/src/model/list-model.d.ts.map +1 -0
- package/dist/types/src/model/list-model.test.d.ts +2 -0
- package/dist/types/src/model/list-model.test.d.ts.map +1 -0
- package/dist/types/src/model/useListModel.d.ts +22 -0
- package/dist/types/src/model/useListModel.d.ts.map +1 -0
- package/dist/types/src/stories/assistant.stories.d.ts +38 -0
- package/dist/types/src/stories/assistant.stories.d.ts.map +1 -0
- package/dist/types/src/stories/baseline.stories.d.ts +32 -0
- package/dist/types/src/stories/baseline.stories.d.ts.map +1 -0
- package/dist/types/src/stories/bridge.stories.d.ts +72 -0
- package/dist/types/src/stories/bridge.stories.d.ts.map +1 -0
- package/dist/types/src/stories/construction.stories.d.ts +17 -0
- package/dist/types/src/stories/construction.stories.d.ts.map +1 -0
- package/dist/types/src/stories/fill.stories.d.ts +51 -0
- package/dist/types/src/stories/fill.stories.d.ts.map +1 -0
- package/dist/types/src/stories/horizontal.stories.d.ts +17 -0
- package/dist/types/src/stories/horizontal.stories.d.ts.map +1 -0
- package/dist/types/src/stories/mount.stories.d.ts +19 -0
- package/dist/types/src/stories/mount.stories.d.ts.map +1 -0
- package/dist/types/src/stories/navigation.stories.d.ts +33 -0
- package/dist/types/src/stories/navigation.stories.d.ts.map +1 -0
- package/dist/types/src/stories/streaming.stories.d.ts +17 -0
- package/dist/types/src/stories/streaming.stories.d.ts.map +1 -0
- package/dist/types/src/stories/tail.stories.d.ts +47 -0
- package/dist/types/src/stories/tail.stories.d.ts.map +1 -0
- package/dist/types/src/stories/widget.stories.d.ts +16 -0
- package/dist/types/src/stories/widget.stories.d.ts.map +1 -0
- package/dist/types/src/testing/FeedStory.d.ts +30 -0
- package/dist/types/src/testing/FeedStory.d.ts.map +1 -0
- package/dist/types/src/testing/MessageWindow.d.ts +48 -0
- package/dist/types/src/testing/MessageWindow.d.ts.map +1 -0
- package/dist/types/src/testing/controls.d.ts +46 -0
- package/dist/types/src/testing/controls.d.ts.map +1 -0
- package/dist/types/src/testing/debug/FeedStats.d.ts +18 -0
- package/dist/types/src/testing/debug/FeedStats.d.ts.map +1 -0
- package/dist/types/src/testing/debug/index.d.ts +4 -0
- package/dist/types/src/testing/debug/index.d.ts.map +1 -0
- package/dist/types/src/testing/debug/sweep.d.ts +18 -0
- package/dist/types/src/testing/debug/sweep.d.ts.map +1 -0
- package/dist/types/src/testing/debug/use-feed-debug.d.ts +33 -0
- package/dist/types/src/testing/debug/use-feed-debug.d.ts.map +1 -0
- package/dist/types/src/testing/generator.d.ts +16 -0
- package/dist/types/src/testing/generator.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +10 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/scenarios.d.ts +58 -0
- package/dist/types/src/testing/scenarios.d.ts.map +1 -0
- package/dist/types/src/testing/stream.d.ts +22 -0
- package/dist/types/src/testing/stream.d.ts.map +1 -0
- package/dist/types/src/testing/turn.d.ts +21 -0
- package/dist/types/src/testing/turn.d.ts.map +1 -0
- package/dist/types/src/testing/widgets.d.ts +3 -0
- package/dist/types/src/testing/widgets.d.ts.map +1 -0
- package/dist/types/src/virtualizer/Window.d.ts +137 -0
- package/dist/types/src/virtualizer/Window.d.ts.map +1 -0
- package/dist/types/src/virtualizer/Window.stories.d.ts +112 -0
- package/dist/types/src/virtualizer/Window.stories.d.ts.map +1 -0
- package/dist/types/src/virtualizer/index.d.ts +3 -0
- package/dist/types/src/virtualizer/index.d.ts.map +1 -0
- package/dist/types/src/virtualizer/placement.d.ts +188 -0
- package/dist/types/src/virtualizer/placement.d.ts.map +1 -0
- package/dist/types/src/virtualizer/placement.test.d.ts +2 -0
- package/dist/types/src/virtualizer/placement.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +72 -0
- package/src/components/Block/HtmlBlock.tsx +26 -0
- package/src/components/Block/MarkdownBlock.tsx +157 -0
- package/src/components/Block/block.stories.tsx +140 -0
- package/src/components/Block/construction.ts +77 -0
- package/src/components/Block/extensions.ts +95 -0
- package/src/components/Block/highlight.ts +53 -0
- package/src/components/Block/index.ts +10 -0
- package/src/components/Block/selection-group.ts +53 -0
- package/src/components/Block/widget-state.tsx +75 -0
- package/src/components/MessageList/MessageList.stories.tsx +111 -0
- package/src/components/MessageList/MessageList.tsx +647 -0
- package/src/components/MessageList/index.ts +6 -0
- package/src/components/MessageList/position-log.ts +167 -0
- package/src/components/Minimap/Minimap.stories.tsx +129 -0
- package/src/components/Minimap/Minimap.tsx +84 -0
- package/src/components/Minimap/index.ts +5 -0
- package/src/components/Outline/Outline.stories.tsx +196 -0
- package/src/components/Outline/Outline.tsx +383 -0
- package/src/components/Outline/index.ts +5 -0
- package/src/components/index.ts +8 -0
- package/src/debug/Debug.tsx +90 -0
- package/src/debug/Stats.tsx +57 -0
- package/src/debug/debug-model.test.ts +36 -0
- package/src/debug/debug-model.ts +66 -0
- package/src/debug/frame-meter.test.ts +49 -0
- package/src/debug/frame-meter.ts +188 -0
- package/src/debug/index.ts +9 -0
- package/src/debug/use-debug.tsx +41 -0
- package/src/hooks/follow.stories.tsx +200 -0
- package/src/hooks/follow.test.ts +105 -0
- package/src/hooks/follow.ts +241 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useDecorations.tsx +54 -0
- package/src/hooks/useFeedNavigation.ts +90 -0
- package/src/hooks/useFollow.ts +258 -0
- package/src/hooks/useItemSelection.tsx +53 -0
- package/src/index.ts +7 -0
- package/src/model/feed-model.test.ts +84 -0
- package/src/model/feed-model.ts +214 -0
- package/src/model/feed.test.ts +65 -0
- package/src/model/feed.ts +157 -0
- package/src/model/index.ts +8 -0
- package/src/model/list-model.test.ts +71 -0
- package/src/model/list-model.ts +152 -0
- package/src/model/useListModel.ts +53 -0
- package/src/stories/assistant.stories.tsx +425 -0
- package/src/stories/baseline.stories.tsx +78 -0
- package/src/stories/bridge.stories.tsx +376 -0
- package/src/stories/construction.stories.tsx +147 -0
- package/src/stories/fill.stories.tsx +271 -0
- package/src/stories/horizontal.stories.tsx +129 -0
- package/src/stories/mount.stories.tsx +233 -0
- package/src/stories/navigation.stories.tsx +145 -0
- package/src/stories/streaming.stories.tsx +132 -0
- package/src/stories/tail.stories.tsx +149 -0
- package/src/stories/widget.stories.tsx +107 -0
- package/src/testing/FeedStory.tsx +452 -0
- package/src/testing/MessageWindow.tsx +139 -0
- package/src/testing/controls.tsx +96 -0
- package/src/testing/debug/FeedStats.tsx +182 -0
- package/src/testing/debug/index.ts +16 -0
- package/src/testing/debug/sweep.ts +85 -0
- package/src/testing/debug/use-feed-debug.ts +91 -0
- package/src/testing/generator.ts +90 -0
- package/src/testing/index.ts +13 -0
- package/src/testing/scenarios.tsx +552 -0
- package/src/testing/stream.ts +70 -0
- package/src/testing/turn.ts +91 -0
- package/src/testing/widgets.tsx +183 -0
- package/src/virtualizer/Window.stories.tsx +683 -0
- package/src/virtualizer/Window.tsx +435 -0
- package/src/virtualizer/index.ts +6 -0
- package/src/virtualizer/placement.test.ts +312 -0
- package/src/virtualizer/placement.ts +403 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import { type FrameMeter } from '../../debug';
|
|
3
|
+
export type FeedDebugOptions = {
|
|
4
|
+
/** What the pass ran under; the recorded line carries these rather than a story name. */
|
|
5
|
+
scenario?: string;
|
|
6
|
+
count: number;
|
|
7
|
+
estimateSize?: number;
|
|
8
|
+
streaming: boolean;
|
|
9
|
+
/** Whether the outlines start on. Off: they are for a question, not for every reading. */
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type FeedDebug = {
|
|
13
|
+
/** Whether the item and block outlines are drawn. */
|
|
14
|
+
debug: boolean;
|
|
15
|
+
toggleDebug: () => void;
|
|
16
|
+
/** Frame statistics and the control that records a pass. */
|
|
17
|
+
meter: FrameMeter;
|
|
18
|
+
/** Attach to the viewport: the sweep needs the element it is going to scroll. */
|
|
19
|
+
viewportRef: RefObject<HTMLDivElement | null>;
|
|
20
|
+
sweeping: boolean;
|
|
21
|
+
/** Start a measured pass, or cancel the one running. */
|
|
22
|
+
onSweep: () => void;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Everything the harness measures itself with, in one place.
|
|
26
|
+
*
|
|
27
|
+
* Kept apart from the story deliberately: instrumentation accumulates — a meter, a sweep, a toggle,
|
|
28
|
+
* a label, the refs and teardown each needs — and threaded through a component it slowly becomes
|
|
29
|
+
* the component. As an aspect the story stays about the feed, and what is being measured can be
|
|
30
|
+
* read, changed or dropped in one file.
|
|
31
|
+
*/
|
|
32
|
+
export declare const useFeedDebug: ({ scenario, count, estimateSize, streaming, enabled, }: FeedDebugOptions) => FeedDebug;
|
|
33
|
+
//# sourceMappingURL=use-feed-debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-feed-debug.d.ts","sourceRoot":"","sources":["../../../../../src/testing/debug/use-feed-debug.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,KAAK,UAAU,EAAiB,MAAM,aAAa,CAAC;AAG7D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,qDAAqD;IACrD,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,4DAA4D;IAC5D,KAAK,EAAE,UAAU,CAAC;IAClB,iFAAiF;IACjF,WAAW,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC9C,QAAQ,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,2DAMtB,gBAAgB,KAAG,SA4CrB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Message } from '@dxos/types';
|
|
2
|
+
export type MessageKind = 'markdown' | 'html' | 'code' | 'short';
|
|
3
|
+
export type GeneratorOptions = {
|
|
4
|
+
count: number;
|
|
5
|
+
/** Relative weights per kind; a mixed feed is the realistic case (email threads, AI chats). */
|
|
6
|
+
kinds?: MessageKind[];
|
|
7
|
+
seed?: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Synthetic feed for measuring the engine.
|
|
11
|
+
*
|
|
12
|
+
* Heights are deliberately uneven — a uniform-height feed would hide exactly the measurement
|
|
13
|
+
* problem the spike exists to answer.
|
|
14
|
+
*/
|
|
15
|
+
export declare const createMessages: ({ count, kinds, seed, }: GeneratorOptions) => Message.Message[];
|
|
16
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/testing/generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,+FAA+F;IAC/F,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAIF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,4BAIxB,gBAAgB,KAAG,OAAO,CAAC,OAAO,EAcpC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './FeedStory';
|
|
2
|
+
export * from './MessageWindow';
|
|
3
|
+
export * from './controls';
|
|
4
|
+
export * from './debug';
|
|
5
|
+
export * from './generator';
|
|
6
|
+
export * from './scenarios';
|
|
7
|
+
export * from './stream';
|
|
8
|
+
export * from './turn';
|
|
9
|
+
export * from './widgets';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ComponentType } from 'react';
|
|
2
|
+
import { Message } from '@dxos/types';
|
|
3
|
+
import { type XmlWidgetRegistry } from '@dxos/ui-editor';
|
|
4
|
+
import { type MessageChromeProps, type MessageRenderer } from '../';
|
|
5
|
+
/**
|
|
6
|
+
* The five places in the repo that render a thread of messages, approximated against one engine.
|
|
7
|
+
*
|
|
8
|
+
* The point is not the fixtures — it is that all five differ only in the renderer, the chrome and a
|
|
9
|
+
* couple of options, while the list, the virtualization, the selection and the search are the same
|
|
10
|
+
* code. Where a scenario needs something the engine does not have, that is the finding.
|
|
11
|
+
*/
|
|
12
|
+
export type FeedScenario =
|
|
13
|
+
/** No editor at all: fixed-height divs, so the list is measured against content that cannot move. */
|
|
14
|
+
'plain'
|
|
15
|
+
/** One editor per row, every row identical — the same document, so every height is the same. */
|
|
16
|
+
| 'uniform'
|
|
17
|
+
/** The `uniform` rows with their text as a paragraph: the same feed without a document at all. */
|
|
18
|
+
| 'uniform-text'
|
|
19
|
+
/** The `uniform` rows with an editor carrying nothing but line wrapping. */
|
|
20
|
+
| 'uniform-bare'
|
|
21
|
+
/** The `uniform` rows with wrapping and the theme, but no markdown and no decoration. */
|
|
22
|
+
| 'uniform-themed'
|
|
23
|
+
/** The `uniform` rows with the markdown language, but nothing drawn from what it parses. */
|
|
24
|
+
| 'uniform-markdown'
|
|
25
|
+
/** The `uniform` rows with markdown drawn as itself: headings, lists, links. */
|
|
26
|
+
| 'uniform-decorated'
|
|
27
|
+
/** The `uniform` rows rendered by the real item, reached through `Custom` like the probes. */
|
|
28
|
+
| 'uniform-item' | 'assistant' | 'email' | 'thread' | 'comments' | 'transcript';
|
|
29
|
+
export type ScenarioDefinition = {
|
|
30
|
+
messages: Message.Message[];
|
|
31
|
+
renderer: MessageRenderer;
|
|
32
|
+
/** Widgets for the tags the renderer emits; only the assistant turn has non-prose blocks. */
|
|
33
|
+
registry?: XmlWidgetRegistry;
|
|
34
|
+
Chrome: ComponentType<MessageChromeProps>;
|
|
35
|
+
/** Renders a `custom` item, for the scenarios that deliberately avoid an editor. */
|
|
36
|
+
Custom?: ComponentType<{
|
|
37
|
+
content: any;
|
|
38
|
+
message: Message.Message;
|
|
39
|
+
}>;
|
|
40
|
+
/** Whether the feed follows its tail: true where messages arrive, false where they are read. */
|
|
41
|
+
stickyBottom: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Height a row is assumed to have before it is measured. A function where rows differ widely: a
|
|
44
|
+
* one-line prompt and a long answer share no useful average, and a row measured for the first time
|
|
45
|
+
* re-lays everything below it — which the reader sees as flicker when scrolling up, into rows that
|
|
46
|
+
* have never been measured.
|
|
47
|
+
*/
|
|
48
|
+
estimateSize: number | ((message: Message.Message, index: number) => number);
|
|
49
|
+
/** Which messages the arrows and the navigation buttons stop on. */
|
|
50
|
+
isAnchor?: (message: Message.Message, index: number) => boolean;
|
|
51
|
+
};
|
|
52
|
+
export type ScenarioOptions = {
|
|
53
|
+
scenario: FeedScenario;
|
|
54
|
+
count: number;
|
|
55
|
+
seed?: number;
|
|
56
|
+
};
|
|
57
|
+
export declare const createScenario: ({ scenario, count, seed }: ScenarioOptions) => ScenarioDefinition;
|
|
58
|
+
//# sourceMappingURL=scenarios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenarios.d.ts","sourceRoot":"","sources":["../../../../src/testing/scenarios.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAIlD,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,OAAO,EAAE,KAAK,kBAAkB,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kBA6FjF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type TextStreamOptions = {
|
|
2
|
+
/** Delay between chunks in ms. */
|
|
3
|
+
chunkDelay?: number;
|
|
4
|
+
/** Variance in timing (0-1). */
|
|
5
|
+
variance?: number;
|
|
6
|
+
/** Words per chunk. */
|
|
7
|
+
wordsPerChunk?: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Word-by-word stream, the shape a model emits: chunks of a few words at an uneven cadence.
|
|
11
|
+
*
|
|
12
|
+
* Whitespace is preserved as its own token so a chunk boundary never fuses two words, which would
|
|
13
|
+
* corrupt the markdown the item is parsing mid-stream.
|
|
14
|
+
*/
|
|
15
|
+
export declare function textStream(text: string, options?: TextStreamOptions): AsyncGenerator<string, void>;
|
|
16
|
+
/**
|
|
17
|
+
* A plausible assistant answer: prose, a list, a code block and a closing paragraph — enough
|
|
18
|
+
* structure that the item re-parses markdown as the text arrives, rather than growing one flat
|
|
19
|
+
* paragraph.
|
|
20
|
+
*/
|
|
21
|
+
export declare const createAnswer: () => string;
|
|
22
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../src/testing/stream.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;GAKG;AACH,wBAAuB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAuB7G;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAO,MAkBlB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ContentBlock } from '@dxos/types';
|
|
2
|
+
export type TurnOptions = {
|
|
3
|
+
chunkDelay?: number;
|
|
4
|
+
wordsPerChunk?: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* One assistant turn as the blocks a model actually emits, arriving in order.
|
|
8
|
+
*
|
|
9
|
+
* The text-only stream exercises the easy half of reconciliation: a tail that only ever grows, which
|
|
10
|
+
* the item appends. A real turn is harder in three ways, and each is a separate way for an item to
|
|
11
|
+
* be rebuilt instead of extended —
|
|
12
|
+
*
|
|
13
|
+
* 1. a **status** block appears first and is removed once work begins, so the document shrinks;
|
|
14
|
+
* 2. **reasoning** streams inside an unclosed tag and is closed when it completes, which rewrites
|
|
15
|
+
* the end of the document rather than appending to it;
|
|
16
|
+
* 3. a **tool call** lands whole, then its **result** arrives as a second block after it.
|
|
17
|
+
*
|
|
18
|
+
* Yields the complete block array at each step; the caller replaces the message's blocks with it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function streamTurn({ chunkDelay, wordsPerChunk }?: TurnOptions): AsyncGenerator<ContentBlock.Any[], void>;
|
|
21
|
+
//# sourceMappingURL=turn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../../../../src/testing/turn.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAuB,UAAU,CAAC,EAAE,UAAgB,EAAE,aAAiB,EAAE,GAAE,WAAgB,GAAG,cAAc,CAC1G,YAAY,CAAC,GAAG,EAAE,EAClB,IAAI,CACL,CA2DA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widgets.d.ts","sourceRoot":"","sources":["../../../../src/testing/widgets.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAuB,KAAK,iBAAiB,EAAmB,MAAM,iBAAiB,CAAC;AAsJ/F,eAAO,MAAM,YAAY,EAAE,iBAwB1B,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React, { type ReactNode, type Ref } from 'react';
|
|
2
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
+
import { type EdgeDrift, type Extents, type Layout, Placement } from './placement';
|
|
4
|
+
/**
|
|
5
|
+
* What the window needs from a model, structurally — `ListModel`/`FeedModel` satisfy it, and the
|
|
6
|
+
* virtualizer stays importable without the model layer. The contract is SPEC F-7.1: a change says
|
|
7
|
+
* what it was (`prepended`), so the anchor is told rather than left to infer it from identities.
|
|
8
|
+
*/
|
|
9
|
+
export type WindowModel = {
|
|
10
|
+
readonly count: number;
|
|
11
|
+
getId: (index: number) => string;
|
|
12
|
+
subscribe: (listener: (change: {
|
|
13
|
+
prepended?: number;
|
|
14
|
+
appended?: number;
|
|
15
|
+
updated?: readonly string[];
|
|
16
|
+
}) => void) => () => void;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The DOM shape, and nothing else.
|
|
20
|
+
*
|
|
21
|
+
* Three elements: a **sizer** that holds no rows and exists only to give the thumb something to
|
|
22
|
+
* measure, a **window** holding the mounted rows in normal flow, and the scroller around them. The
|
|
23
|
+
* window is absolutely positioned and moved by a transform, so a correction changes one number and
|
|
24
|
+
* never touches `scrollTop` — which is what stops corrections and the reader sharing a channel (§7).
|
|
25
|
+
*
|
|
26
|
+
* Rows are unpositioned. A row that changes extent reflows the ones after it, in the browser, in the
|
|
27
|
+
* same frame; the alternative was re-placing every row below it ourselves on every frame of the
|
|
28
|
+
* change — measured at 177 re-placements for one disclosure opening (§6).
|
|
29
|
+
*
|
|
30
|
+
* Knows nothing about messages, markdown or CodeMirror. What it renders is whatever `children`
|
|
31
|
+
* returns, which is what lets `placement/*` drive it with content that cannot lie about its size.
|
|
32
|
+
*/
|
|
33
|
+
export type WindowAxis = 'block' | 'inline';
|
|
34
|
+
/**
|
|
35
|
+
* What a toolbar or a readout needs, and nothing more.
|
|
36
|
+
*
|
|
37
|
+
* Published rather than rendered: chrome belongs to the host (§2), so the window says where it is
|
|
38
|
+
* and the host decides what to draw about it.
|
|
39
|
+
*/
|
|
40
|
+
export type WindowState = {
|
|
41
|
+
/** The row at the top of the viewport — what "where am I" means to a reader. */
|
|
42
|
+
index: number;
|
|
43
|
+
visible: {
|
|
44
|
+
first: number;
|
|
45
|
+
last: number;
|
|
46
|
+
};
|
|
47
|
+
/** The mounted range, which includes the overscan the reader cannot see. */
|
|
48
|
+
mounted: {
|
|
49
|
+
first: number;
|
|
50
|
+
last: number;
|
|
51
|
+
};
|
|
52
|
+
count: number;
|
|
53
|
+
/**
|
|
54
|
+
* The same thing in pixels, which is what a map of the list has to draw.
|
|
55
|
+
*
|
|
56
|
+
* `window` is the mounted parent's span in content space — where the rows that exist actually are —
|
|
57
|
+
* and `total` is what the thumb is scaled against. A map drawn from indices instead would be a map
|
|
58
|
+
* of the model rather than of the layout, and it is the layout that goes wrong.
|
|
59
|
+
*/
|
|
60
|
+
geometry: {
|
|
61
|
+
scroll: number;
|
|
62
|
+
viewport: number;
|
|
63
|
+
total: number;
|
|
64
|
+
window: {
|
|
65
|
+
start: number;
|
|
66
|
+
extent: number;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export type WindowController = {
|
|
71
|
+
/**
|
|
72
|
+
* `behavior: 'smooth'` glides, and only over content that is mounted — a glide across rows that do
|
|
73
|
+
* not exist is a journey over a blank screen, so a far target is taken instantly (§7).
|
|
74
|
+
*/
|
|
75
|
+
scrollToIndex: (index: number, align?: 'start' | 'end', behavior?: ScrollBehavior) => void;
|
|
76
|
+
};
|
|
77
|
+
export type WindowProps = ThemedClassName<{
|
|
78
|
+
model: WindowModel;
|
|
79
|
+
extents: Extents;
|
|
80
|
+
/** Which way the list runs. The principles hold either way; only this mapping differs (§9). */
|
|
81
|
+
axis?: WindowAxis;
|
|
82
|
+
overscan?: number;
|
|
83
|
+
/** Empty extent after the last row, so it can be scrolled to the top of the viewport (§7). */
|
|
84
|
+
reserve?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Keep the last row against the end of the viewport as content arrives.
|
|
87
|
+
*
|
|
88
|
+
* Consumed by the trivial `Window` binding, which composes `useFollow`; `useWindow` itself knows
|
|
89
|
+
* nothing about following — the intent, the withdrawal and the glide are the aspect's (SPEC §Aspects).
|
|
90
|
+
*/
|
|
91
|
+
sticky?: boolean;
|
|
92
|
+
/** What an edge revealed about the estimates, if it revealed anything. */
|
|
93
|
+
onEdge?: (drift: EdgeDrift) => void;
|
|
94
|
+
/** A row whose declared extent was not the extent it rendered at. `exact` means do not correct — not do not check (§8). */
|
|
95
|
+
onMismatch?: (mismatch: {
|
|
96
|
+
index: number;
|
|
97
|
+
id: string;
|
|
98
|
+
declared: number;
|
|
99
|
+
actual: number;
|
|
100
|
+
}) => void;
|
|
101
|
+
onChange?: (state: WindowState) => void;
|
|
102
|
+
controllerRef?: Ref<WindowController>;
|
|
103
|
+
children: (index: number, id: string) => ReactNode;
|
|
104
|
+
}>;
|
|
105
|
+
/**
|
|
106
|
+
* Everything the shape needs, with no opinion about who owns the scroll element.
|
|
107
|
+
*
|
|
108
|
+
* Split out because the DOM below is only the *simplest* binding of it. A host that already has a
|
|
109
|
+
* scroll container — `MessageList` scrolls inside `ScrollArea`, which owns the overlay thumbs and
|
|
110
|
+
* the padding tokens — cannot nest a second one, and would otherwise have to reimplement the
|
|
111
|
+
* placement to keep its own chrome. It hands its element over instead.
|
|
112
|
+
*/
|
|
113
|
+
export type UseWindowOptions = Omit<WindowProps, 'classNames' | 'children'> & {
|
|
114
|
+
/** The element being scrolled, when the host owns it. `Window` passes its own. */
|
|
115
|
+
scrollerRef: React.RefObject<HTMLElement | null>;
|
|
116
|
+
};
|
|
117
|
+
export type UseWindowResult = {
|
|
118
|
+
placement: Placement;
|
|
119
|
+
layout: Layout;
|
|
120
|
+
/** Ref for the element holding the mounted rows, which is what gets measured. */
|
|
121
|
+
windowRef: React.RefObject<HTMLDivElement | null>;
|
|
122
|
+
/** Extent of the whole document along the axis, reserve included: what the thumb is scaled to. */
|
|
123
|
+
sizerExtent: number;
|
|
124
|
+
/** Absolute position of the first mounted row, which the parent is translated by. */
|
|
125
|
+
offset: number;
|
|
126
|
+
first: number;
|
|
127
|
+
last: number;
|
|
128
|
+
};
|
|
129
|
+
export declare const useWindow: ({ scrollerRef, model, extents, axis, overscan, reserve, onEdge, onMismatch, onChange, controllerRef, }: UseWindowOptions) => UseWindowResult;
|
|
130
|
+
/**
|
|
131
|
+
* The DOM shape, and nothing else.
|
|
132
|
+
*
|
|
133
|
+
* Three elements: a **sizer** that holds no rows and exists only to give the thumb something to
|
|
134
|
+
* measure, a **window** holding the mounted rows in normal flow, and the scroller around them.
|
|
135
|
+
*/
|
|
136
|
+
export declare const Window: ({ classNames, children, controllerRef, ...options }: WindowProps) => React.JSX.Element;
|
|
137
|
+
//# sourceMappingURL=Window.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Window.d.ts","sourceRoot":"","sources":["../../../../src/virtualizer/Window.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EACd,KAAK,GAAG,EAQT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAItD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,SA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;AAEF;;;;;GAKG;AACH,eAAO,MAAM,MAAM,wDAAyD,WAAW,sBAiEtF,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { type WindowAxis } from './Window';
|
|
3
|
+
/**
|
|
4
|
+
* The DOM shape, driven by content that cannot lie about its size.
|
|
5
|
+
*
|
|
6
|
+
* Between `placement.test.ts` (arithmetic, no DOM) and `baseline/*` (a real feed, real editors) sits
|
|
7
|
+
* this: plain boxes of declared extent, so anything that moves here is the shape and not the item.
|
|
8
|
+
* The layer exists because the two things fail differently and a single suite cannot say which.
|
|
9
|
+
*/
|
|
10
|
+
type StoryArgs = {
|
|
11
|
+
/** Rows the model is seeded with; the append/prepend buttons then drive the model directly. */
|
|
12
|
+
count?: number;
|
|
13
|
+
axis?: WindowAxis;
|
|
14
|
+
exact?: boolean;
|
|
15
|
+
/** Extent the row actually renders at — the story controls it, so the story knows the truth. */
|
|
16
|
+
extent?: (index: number) => number;
|
|
17
|
+
/** Outline every row and label its extent, so what is being measured is visible. */
|
|
18
|
+
debug?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Controls a story needs to drive the list, rendered in the toolbar when supplied.
|
|
21
|
+
*
|
|
22
|
+
* Buttons rather than a global the play function calls: a story is rendered more than once, so a
|
|
23
|
+
* `window.__grow` captured in an effect goes stale and the press lands on a previous mount's
|
|
24
|
+
* state — which presented as `Prepend` and `Grow` passing or failing depending on what else ran.
|
|
25
|
+
* A button is the same thing the reader has, and there is only ever one of it.
|
|
26
|
+
*/
|
|
27
|
+
/** Render the append button; 'few' appends 5 rows per press instead of 20 (the sticky story). */
|
|
28
|
+
append?: boolean | 'few';
|
|
29
|
+
/** Keep the last row against the bottom of the viewport as content arrives. */
|
|
30
|
+
sticky?: boolean;
|
|
31
|
+
prepend?: boolean;
|
|
32
|
+
grow?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Reserve a viewport's worth of space after the last row, so it can be read at the top.
|
|
35
|
+
*
|
|
36
|
+
* Computed **here**, from what the window publishes, and handed back as a number — which is the
|
|
37
|
+
* claim §7 makes: with the window placed rather than the rows, this is not a mode the list has.
|
|
38
|
+
*/
|
|
39
|
+
scrollPastEnd?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Extent the host *claims*, when that differs from what renders.
|
|
42
|
+
*
|
|
43
|
+
* Two callbacks, not one, because a story that reports the same number it renders cannot express a
|
|
44
|
+
* host being wrong — which is the only thing `Drift` is about.
|
|
45
|
+
*/
|
|
46
|
+
declared?: (index: number) => number;
|
|
47
|
+
};
|
|
48
|
+
declare const meta: Meta<StoryArgs>;
|
|
49
|
+
export default meta;
|
|
50
|
+
type Story = StoryObj<StoryArgs>;
|
|
51
|
+
/** The harness at rest, for the eye and the controls panel. No play. */
|
|
52
|
+
export declare const Default: Story;
|
|
53
|
+
/**
|
|
54
|
+
* The window is placed where the arithmetic says, and the edges agree with the model.
|
|
55
|
+
*
|
|
56
|
+
* `offset === 0` at the start and `offset + window === sizer` at the end are where estimate meets
|
|
57
|
+
* ground truth — with `exact` extents they must hold to the pixel, which is what makes this the
|
|
58
|
+
* control the other stories are read against.
|
|
59
|
+
*/
|
|
60
|
+
export declare const Static: Story;
|
|
61
|
+
/** Rows arriving at the end move nothing that is already on screen, and do not move the window. */
|
|
62
|
+
export declare const Append: Story;
|
|
63
|
+
/**
|
|
64
|
+
* The hard case: rows inserted *before* the reader.
|
|
65
|
+
*
|
|
66
|
+
* Everything at or after the anchor has to stay exactly where it is, in the frame the insert lands —
|
|
67
|
+
* which is the whole reason placement is anchor-relative rather than summed from index 0.
|
|
68
|
+
*/
|
|
69
|
+
export declare const Prepend: Story;
|
|
70
|
+
/**
|
|
71
|
+
* A row changing extent moves the rows after it and none before it — and costs us nothing.
|
|
72
|
+
*
|
|
73
|
+
* This is §6 in one assertion: the browser reflows the siblings. With rows placed by transform it
|
|
74
|
+
* was 177 re-placements written by us for one disclosure.
|
|
75
|
+
*/
|
|
76
|
+
export declare const Grow: Story;
|
|
77
|
+
/** A jump lands, and both edge invariants still hold once it has. */
|
|
78
|
+
export declare const Jump: Story;
|
|
79
|
+
/** The same shape on the other axis, where the layout constrains the extent and nothing is measured. */
|
|
80
|
+
export declare const Horizontal: Story;
|
|
81
|
+
/**
|
|
82
|
+
* A declared extent that is wrong is **reported**, not silently absorbed.
|
|
83
|
+
*
|
|
84
|
+
* `exact` is a promise the host makes, and a promise nobody checks is how a 1px separator costs a day
|
|
85
|
+
* of bisection (§8). The row renders at a size the callback did not claim; the mismatch names it.
|
|
86
|
+
*/
|
|
87
|
+
export declare const Drift: Story;
|
|
88
|
+
/**
|
|
89
|
+
* The chrome, which is outside the window and reads what it publishes.
|
|
90
|
+
*
|
|
91
|
+
* Tested because untested chrome is how a story ended up pinned to half the screen height without
|
|
92
|
+
* anything failing: the assertions were all about the rows, and nothing asked whether what surrounds
|
|
93
|
+
* them was right (§12).
|
|
94
|
+
*/
|
|
95
|
+
export declare const Chrome: Story;
|
|
96
|
+
/**
|
|
97
|
+
* With space reserved, the last row can be brought to the top of the viewport.
|
|
98
|
+
*
|
|
99
|
+
* On the old design this was a flag that special-cased the tail wherever it was consulted, and it
|
|
100
|
+
* could never be stabilised. Here the host computes a number and the list adds it to the sizer;
|
|
101
|
+
* nothing else in the engine knows it happened (§7).
|
|
102
|
+
*/
|
|
103
|
+
export declare const PastEnd: Story;
|
|
104
|
+
/**
|
|
105
|
+
* A feed pinned to its tail stays there as content arrives.
|
|
106
|
+
*
|
|
107
|
+
* The one thing the old engine spent the most machinery on — a follow, a sticky flag, a re-base and
|
|
108
|
+
* a scroll listener that had to tell the reader apart from itself. Here it is a standing intent: at
|
|
109
|
+
* the end, appending keeps you at the end; away from it, appending does not move you.
|
|
110
|
+
*/
|
|
111
|
+
export declare const Sticky: Story;
|
|
112
|
+
//# sourceMappingURL=Window.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Window.stories.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