@histoire/vue 0.0.0-stage → 1.0.0-beta.2
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 +21 -0
- package/dist/components/controls/GenericControls.d.ts +30 -0
- package/dist/components/controls/GenericControls.d.ts.map +1 -0
- package/dist/components/controls/GenericControls.js +34 -0
- package/dist/components/controls/HistoireControls.d.ts +30 -0
- package/dist/components/controls/HistoireControls.d.ts.map +1 -0
- package/dist/components/controls/HistoireControls.js +176 -0
- package/dist/components/controls/PresetMenu.d.ts +63 -0
- package/dist/components/controls/PresetMenu.d.ts.map +1 -0
- package/dist/components/controls/PresetMenu.js +180 -0
- package/dist/components/controls/PropControl.d.ts +40 -0
- package/dist/components/controls/PropControl.d.ts.map +1 -0
- package/dist/components/controls/PropControl.js +66 -0
- package/dist/components/controls/StateControl.d.ts +15 -0
- package/dist/components/controls/StateControl.d.ts.map +1 -0
- package/dist/components/controls/StateControl.js +30 -0
- package/dist/components/controls/StatePresets.d.ts +37 -0
- package/dist/components/controls/StatePresets.d.ts.map +1 -0
- package/dist/components/controls/StatePresets.js +105 -0
- package/dist/components/controls/edit.d.ts +10 -0
- package/dist/components/controls/edit.d.ts.map +1 -0
- package/dist/components/controls/edit.js +82 -0
- package/dist/components/controls/editor.d.ts +9 -0
- package/dist/components/controls/editor.d.ts.map +1 -0
- package/dist/components/controls/editor.js +28 -0
- package/dist/components/docs/HistoireDocs.d.ts +44 -0
- package/dist/components/docs/HistoireDocs.d.ts.map +1 -0
- package/dist/components/docs/HistoireDocs.js +124 -0
- package/dist/components/docs/anchors.d.ts +3 -0
- package/dist/components/docs/anchors.d.ts.map +1 -0
- package/dist/components/docs/anchors.js +26 -0
- package/dist/components/docs/content.d.ts +11 -0
- package/dist/components/docs/content.d.ts.map +1 -0
- package/dist/components/docs/content.js +7 -0
- package/dist/components/docs/links.d.ts +20 -0
- package/dist/components/docs/links.d.ts.map +1 -0
- package/dist/components/docs/links.js +85 -0
- package/dist/components/docs/sanitize.d.ts +3 -0
- package/dist/components/docs/sanitize.d.ts.map +1 -0
- package/dist/components/docs/sanitize.js +16 -0
- package/dist/components/embed/EmbedPanels.d.ts +21 -0
- package/dist/components/embed/EmbedPanels.d.ts.map +1 -0
- package/dist/components/embed/EmbedPanels.js +49 -0
- package/dist/components/embed/HistoireEmbed.d.ts +36 -0
- package/dist/components/embed/HistoireEmbed.d.ts.map +1 -0
- package/dist/components/embed/HistoireEmbed.js +81 -0
- package/dist/components/embed/geometry.d.ts +5 -0
- package/dist/components/embed/geometry.d.ts.map +1 -0
- package/dist/components/embed/geometry.js +38 -0
- package/dist/components/events/HistoireEvents.d.ts +30 -0
- package/dist/components/events/HistoireEvents.d.ts.map +1 -0
- package/dist/components/events/HistoireEvents.js +88 -0
- package/dist/components/explorer/ExplorerNavigation.d.ts +20 -0
- package/dist/components/explorer/ExplorerNavigation.d.ts.map +1 -0
- package/dist/components/explorer/ExplorerNavigation.js +15 -0
- package/dist/components/explorer/ExplorerPanels.d.ts +42 -0
- package/dist/components/explorer/ExplorerPanels.d.ts.map +1 -0
- package/dist/components/explorer/ExplorerPanels.js +87 -0
- package/dist/components/explorer/ExplorerPreview.d.ts +29 -0
- package/dist/components/explorer/ExplorerPreview.d.ts.map +1 -0
- package/dist/components/explorer/ExplorerPreview.js +93 -0
- package/dist/components/explorer/HistoireExplorer.d.ts +47 -0
- package/dist/components/explorer/HistoireExplorer.d.ts.map +1 -0
- package/dist/components/explorer/HistoireExplorer.js +41 -0
- package/dist/components/explorer/panel-tabs.d.ts +48 -0
- package/dist/components/explorer/panel-tabs.d.ts.map +1 -0
- package/dist/components/explorer/panel-tabs.js +58 -0
- package/dist/components/extensions/HistoireExtensionOutlet.d.ts +47 -0
- package/dist/components/extensions/HistoireExtensionOutlet.d.ts.map +1 -0
- package/dist/components/extensions/HistoireExtensionOutlet.js +35 -0
- package/dist/components/extensions/HistoireExtensionView.d.ts +59 -0
- package/dist/components/extensions/HistoireExtensionView.d.ts.map +1 -0
- package/dist/components/extensions/HistoireExtensionView.js +58 -0
- package/dist/components/extensions/panel-action.d.ts +38 -0
- package/dist/components/extensions/panel-action.d.ts.map +1 -0
- package/dist/components/extensions/panel-action.js +19 -0
- package/dist/components/extensions/state-renderer.d.ts +17 -0
- package/dist/components/extensions/state-renderer.d.ts.map +1 -0
- package/dist/components/extensions/state-renderer.js +72 -0
- package/dist/components/extensions/view-lifecycle.d.ts +47 -0
- package/dist/components/extensions/view-lifecycle.d.ts.map +1 -0
- package/dist/components/extensions/view-lifecycle.js +108 -0
- package/dist/components/extensions/workbench-components.d.ts +9 -0
- package/dist/components/extensions/workbench-components.d.ts.map +1 -0
- package/dist/components/extensions/workbench-components.js +82 -0
- package/dist/components/preview/HistoirePreview.d.ts +11 -0
- package/dist/components/preview/HistoirePreview.d.ts.map +1 -0
- package/dist/components/preview/HistoirePreview.js +3 -0
- package/dist/components/preview/surface.d.ts +13 -0
- package/dist/components/preview/surface.d.ts.map +1 -0
- package/dist/components/preview/surface.js +129 -0
- package/dist/components/search/HistoireSearch.d.ts +9 -0
- package/dist/components/search/HistoireSearch.d.ts.map +1 -0
- package/dist/components/search/HistoireSearch.js +66 -0
- package/dist/components/source/HistoireSource.d.ts +58 -0
- package/dist/components/source/HistoireSource.d.ts.map +1 -0
- package/dist/components/source/HistoireSource.js +85 -0
- package/dist/components/source/content.d.ts +11 -0
- package/dist/components/source/content.d.ts.map +1 -0
- package/dist/components/source/content.js +7 -0
- package/dist/components/source/highlight.d.ts +3 -0
- package/dist/components/source/highlight.d.ts.map +1 -0
- package/dist/components/source/highlight.js +15 -0
- package/dist/components/source/render.d.ts +6 -0
- package/dist/components/source/render.d.ts.map +1 -0
- package/dist/components/source/render.js +11 -0
- package/dist/components/tests/HistoireTests.d.ts +66 -0
- package/dist/components/tests/HistoireTests.d.ts.map +1 -0
- package/dist/components/tests/HistoireTests.js +109 -0
- package/dist/components/tests/TestsRunActions.d.ts +54 -0
- package/dist/components/tests/TestsRunActions.d.ts.map +1 -0
- package/dist/components/tests/TestsRunActions.js +138 -0
- package/dist/components/tests/render.d.ts +33 -0
- package/dist/components/tests/render.d.ts.map +1 -0
- package/dist/components/tests/render.js +103 -0
- package/dist/components/toolbar/HistoireToolbar.d.ts +7 -0
- package/dist/components/toolbar/HistoireToolbar.d.ts.map +1 -0
- package/dist/components/toolbar/HistoireToolbar.js +66 -0
- package/dist/components/toolbar/ToolbarExtensions.d.ts +27 -0
- package/dist/components/toolbar/ToolbarExtensions.d.ts.map +1 -0
- package/dist/components/toolbar/ToolbarExtensions.js +79 -0
- package/dist/components/toolbar/groups.d.ts +19 -0
- package/dist/components/toolbar/groups.d.ts.map +1 -0
- package/dist/components/toolbar/groups.js +18 -0
- package/dist/components/tree/HistoireStoryTree.d.ts +40 -0
- package/dist/components/tree/HistoireStoryTree.d.ts.map +1 -0
- package/dist/components/tree/HistoireStoryTree.js +57 -0
- package/dist/composables/session.d.ts +4 -0
- package/dist/composables/session.d.ts.map +1 -0
- package/dist/composables/session.js +5 -0
- package/dist/composables/snapshot.d.ts +5 -0
- package/dist/composables/snapshot.d.ts.map +1 -0
- package/dist/composables/snapshot.js +9 -0
- package/dist/content/controller.d.ts +20 -0
- package/dist/content/controller.d.ts.map +1 -0
- package/dist/content/controller.js +54 -0
- package/dist/content.css +22 -0
- package/dist/controls.css +26 -0
- package/dist/embed.css +15 -0
- package/dist/explorer.css +67 -0
- package/dist/extensions.css +20 -0
- package/dist/foundation/VirtualList.d.ts +114 -0
- package/dist/foundation/VirtualList.d.ts.map +1 -0
- package/dist/foundation/VirtualList.js +126 -0
- package/dist/foundation/floating.d.ts +9 -0
- package/dist/foundation/floating.d.ts.map +1 -0
- package/dist/foundation/floating.js +90 -0
- package/dist/foundation/parts.d.ts +13 -0
- package/dist/foundation/parts.d.ts.map +1 -0
- package/dist/foundation/parts.js +13 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/internal.d.ts +31 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +26 -0
- package/dist/navigation.css +51 -0
- package/dist/overlays/OverlayHost.d.ts +21 -0
- package/dist/overlays/OverlayHost.d.ts.map +1 -0
- package/dist/overlays/OverlayHost.js +118 -0
- package/dist/overlays/geometry.d.ts +4 -0
- package/dist/overlays/geometry.d.ts.map +1 -0
- package/dist/overlays/geometry.js +7 -0
- package/dist/overlays/menu-bounds.d.ts +10 -0
- package/dist/overlays/menu-bounds.d.ts.map +1 -0
- package/dist/overlays/menu-bounds.js +52 -0
- package/dist/provider/HistoireProvider.d.ts +43 -0
- package/dist/provider/HistoireProvider.d.ts.map +1 -0
- package/dist/provider/HistoireProvider.js +183 -0
- package/dist/provider/context.d.ts +37 -0
- package/dist/provider/context.d.ts.map +1 -0
- package/dist/provider/context.js +16 -0
- package/dist/provider/extensions.d.ts +61 -0
- package/dist/provider/extensions.d.ts.map +1 -0
- package/dist/provider/extensions.js +139 -0
- package/dist/provider/panels.d.ts +33 -0
- package/dist/provider/panels.d.ts.map +1 -0
- package/dist/provider/panels.js +53 -0
- package/dist/provider/plugin-shortcuts.d.ts +22 -0
- package/dist/provider/plugin-shortcuts.d.ts.map +1 -0
- package/dist/provider/plugin-shortcuts.js +73 -0
- package/dist/provider/shortcuts.d.ts +16 -0
- package/dist/provider/shortcuts.d.ts.map +1 -0
- package/dist/provider/shortcuts.js +62 -0
- package/dist/provider/theme.d.ts +4 -0
- package/dist/provider/theme.d.ts.map +1 -0
- package/dist/provider/theme.js +25 -0
- package/dist/search/navigation.d.ts +27 -0
- package/dist/search/navigation.d.ts.map +1 -0
- package/dist/search/navigation.js +61 -0
- package/dist/style.css +88 -0
- package/dist/tests/collector.d.ts +16 -0
- package/dist/tests/collector.d.ts.map +1 -0
- package/dist/tests/collector.js +51 -0
- package/dist/tests/controller.d.ts +28 -0
- package/dist/tests/controller.d.ts.map +1 -0
- package/dist/tests/controller.js +79 -0
- package/dist/tests/model.d.ts +20 -0
- package/dist/tests/model.d.ts.map +1 -0
- package/dist/tests/model.js +18 -0
- package/dist/tests.css +59 -0
- package/dist/virtual-list.css +6 -0
- package/package.json +58 -3
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { HistoireControls } from './components/controls/HistoireControls.js';
|
|
2
|
+
export { HistoireDocs } from './components/docs/HistoireDocs.js';
|
|
3
|
+
export { HistoireEmbed } from './components/embed/HistoireEmbed.js';
|
|
4
|
+
export { HistoireEvents } from './components/events/HistoireEvents.js';
|
|
5
|
+
export { HistoireExplorer } from './components/explorer/HistoireExplorer.js';
|
|
6
|
+
export { HistoireExtensionOutlet } from './components/extensions/HistoireExtensionOutlet.js';
|
|
7
|
+
export { HistoirePreview } from './components/preview/HistoirePreview.js';
|
|
8
|
+
export { HistoireSearch } from './components/search/HistoireSearch.js';
|
|
9
|
+
export { HistoireSource } from './components/source/HistoireSource.js';
|
|
10
|
+
export { HistoireTests } from './components/tests/HistoireTests.js';
|
|
11
|
+
export { HistoireToolbar } from './components/toolbar/HistoireToolbar.js';
|
|
12
|
+
export { HistoireStoryTree } from './components/tree/HistoireStoryTree.js';
|
|
13
|
+
export { useHistoireSession } from './composables/session.js';
|
|
14
|
+
export { useHistoireSnapshot } from './composables/snapshot.js';
|
|
15
|
+
export type { HistoirePartClasses } from './foundation/parts.js';
|
|
16
|
+
export { HistoireProvider } from './provider/HistoireProvider.js';
|
|
17
|
+
export type { HistoireSession } from '@histoire/sdk';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAA;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { HistoireControls } from './components/controls/HistoireControls.js';
|
|
2
|
+
export { HistoireDocs } from './components/docs/HistoireDocs.js';
|
|
3
|
+
export { HistoireEmbed } from './components/embed/HistoireEmbed.js';
|
|
4
|
+
export { HistoireEvents } from './components/events/HistoireEvents.js';
|
|
5
|
+
export { HistoireExplorer } from './components/explorer/HistoireExplorer.js';
|
|
6
|
+
export { HistoireExtensionOutlet } from './components/extensions/HistoireExtensionOutlet.js';
|
|
7
|
+
export { HistoirePreview } from './components/preview/HistoirePreview.js';
|
|
8
|
+
export { HistoireSearch } from './components/search/HistoireSearch.js';
|
|
9
|
+
export { HistoireSource } from './components/source/HistoireSource.js';
|
|
10
|
+
export { HistoireTests } from './components/tests/HistoireTests.js';
|
|
11
|
+
export { HistoireToolbar } from './components/toolbar/HistoireToolbar.js';
|
|
12
|
+
export { HistoireStoryTree } from './components/tree/HistoireStoryTree.js';
|
|
13
|
+
export { useHistoireSession } from './composables/session.js';
|
|
14
|
+
export { useHistoireSnapshot } from './composables/snapshot.js';
|
|
15
|
+
export { HistoireProvider } from './provider/HistoireProvider.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export { GenericControls } from './components/controls/GenericControls.js';
|
|
2
|
+
export { StatePresets } from './components/controls/StatePresets.js';
|
|
3
|
+
export { HistoireDocs } from './components/docs/HistoireDocs.js';
|
|
4
|
+
export { sanitizeDocsHtml } from './components/docs/sanitize.js';
|
|
5
|
+
export { HistoireEvents } from './components/events/HistoireEvents.js';
|
|
6
|
+
export { ExplorerNavigation } from './components/explorer/ExplorerNavigation.js';
|
|
7
|
+
export { ExplorerPanels } from './components/explorer/ExplorerPanels.js';
|
|
8
|
+
export { ExplorerPreview } from './components/explorer/ExplorerPreview.js';
|
|
9
|
+
export { HistoireExplorer } from './components/explorer/HistoireExplorer.js';
|
|
10
|
+
export { HistoireExtensionView } from './components/extensions/HistoireExtensionView.js';
|
|
11
|
+
export { useExtensionView } from './components/extensions/view-lifecycle.js';
|
|
12
|
+
export type { ExtensionViewOptions, ExtensionViewState } from './components/extensions/view-lifecycle.js';
|
|
13
|
+
export { HistoireSearch } from './components/search/HistoireSearch.js';
|
|
14
|
+
export { HistoireSource } from './components/source/HistoireSource.js';
|
|
15
|
+
export { HistoireTests } from './components/tests/HistoireTests.js';
|
|
16
|
+
export { HistoireToolbar } from './components/toolbar/HistoireToolbar.js';
|
|
17
|
+
export { HistoireStoryTree } from './components/tree/HistoireStoryTree.js';
|
|
18
|
+
export { HistoireDropdown, HistoireTooltip } from './foundation/floating.js';
|
|
19
|
+
export { mergePartClass } from './foundation/parts.js';
|
|
20
|
+
export { HistoireVirtualList } from './foundation/VirtualList.js';
|
|
21
|
+
export type { HistoireVirtualItem, HistoireVirtualListHandle, HistoireVirtualSlot } from './foundation/VirtualList.js';
|
|
22
|
+
export { useHistoireContext, useHistoireResource } from './provider/context.js';
|
|
23
|
+
export type { HistoireContainerSize, HistoireVueContext } from './provider/context.js';
|
|
24
|
+
export { provideHistoireExtensions } from './provider/extensions.js';
|
|
25
|
+
export type { HistoireProviderExtensions } from './provider/extensions.js';
|
|
26
|
+
export { focusHistoireSearch, HISTOIRE_SEARCH_FOCUS, HISTOIRE_SHOW_UI, HISTOIRE_TOGGLE_UI, requestHistoireUiShow, requestHistoireUiToggle } from './provider/shortcuts.js';
|
|
27
|
+
export { createHistoireSearchNavigation, provideHistoireSearchNavigation } from './search/navigation.js';
|
|
28
|
+
export { createHistoireTestsCollector, type HistoireTestsCollectorOptions } from './tests/collector.js';
|
|
29
|
+
export { createHistoireTestsModel, provideHistoireTestsModel, useProvidedHistoireTestsModel } from './tests/model.js';
|
|
30
|
+
export type { HistoireTestsModel } from './tests/model.js';
|
|
31
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAA;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAA;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAA;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAC5E,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,YAAY,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEtH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC/E,YAAY,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AACpE,YAAY,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAC1K,OAAO,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAA;AACxG,OAAO,EAAE,4BAA4B,EAAE,KAAK,6BAA6B,EAAE,MAAM,sBAAsB,CAAA;AACvG,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AACrH,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { GenericControls } from './components/controls/GenericControls.js';
|
|
2
|
+
export { StatePresets } from './components/controls/StatePresets.js';
|
|
3
|
+
export { HistoireDocs } from './components/docs/HistoireDocs.js';
|
|
4
|
+
export { sanitizeDocsHtml } from './components/docs/sanitize.js';
|
|
5
|
+
export { HistoireEvents } from './components/events/HistoireEvents.js';
|
|
6
|
+
export { ExplorerNavigation } from './components/explorer/ExplorerNavigation.js';
|
|
7
|
+
export { ExplorerPanels } from './components/explorer/ExplorerPanels.js';
|
|
8
|
+
export { ExplorerPreview } from './components/explorer/ExplorerPreview.js';
|
|
9
|
+
export { HistoireExplorer } from './components/explorer/HistoireExplorer.js';
|
|
10
|
+
export { HistoireExtensionView } from './components/extensions/HistoireExtensionView.js';
|
|
11
|
+
export { useExtensionView } from './components/extensions/view-lifecycle.js';
|
|
12
|
+
export { HistoireSearch } from './components/search/HistoireSearch.js';
|
|
13
|
+
export { HistoireSource } from './components/source/HistoireSource.js';
|
|
14
|
+
export { HistoireTests } from './components/tests/HistoireTests.js';
|
|
15
|
+
export { HistoireToolbar } from './components/toolbar/HistoireToolbar.js';
|
|
16
|
+
export { HistoireStoryTree } from './components/tree/HistoireStoryTree.js';
|
|
17
|
+
export { HistoireDropdown, HistoireTooltip } from './foundation/floating.js';
|
|
18
|
+
export { mergePartClass } from './foundation/parts.js';
|
|
19
|
+
export { HistoireVirtualList } from './foundation/VirtualList.js';
|
|
20
|
+
// First-party panel foundation. External loaders/extensions are unsupported.
|
|
21
|
+
export { useHistoireContext, useHistoireResource } from './provider/context.js';
|
|
22
|
+
export { provideHistoireExtensions } from './provider/extensions.js';
|
|
23
|
+
export { focusHistoireSearch, HISTOIRE_SEARCH_FOCUS, HISTOIRE_SHOW_UI, HISTOIRE_TOGGLE_UI, requestHistoireUiShow, requestHistoireUiToggle } from './provider/shortcuts.js';
|
|
24
|
+
export { createHistoireSearchNavigation, provideHistoireSearchNavigation } from './search/navigation.js';
|
|
25
|
+
export { createHistoireTestsCollector } from './tests/collector.js';
|
|
26
|
+
export { createHistoireTestsModel, provideHistoireTestsModel, useProvidedHistoireTestsModel } from './tests/model.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
:where(.histoire-provider) :is(.histoire-tree, .histoire-search, .histoire-events) {
|
|
2
|
+
min-width: 0;
|
|
3
|
+
min-height: 0;
|
|
4
|
+
overflow: auto;
|
|
5
|
+
flex: 1;
|
|
6
|
+
padding: 8px;
|
|
7
|
+
}
|
|
8
|
+
:where(.histoire-provider) :is(.histoire-tree, .histoire-search) :where(ul) {
|
|
9
|
+
list-style: none;
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0 0 0 12px;
|
|
12
|
+
}
|
|
13
|
+
:where(.histoire-provider) :is(.histoire-tree, .histoire-search) > :where(ul) { padding: 0; }
|
|
14
|
+
:where(.histoire-provider) :is(.histoire-tree, .histoire-search) :where(button) {
|
|
15
|
+
display: block;
|
|
16
|
+
width: 100%;
|
|
17
|
+
text-align: start;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
padding: 6px 8px;
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
:where(.histoire-provider) :where(.histoire-tree, .histoire-search) :where(button):is(:hover, [aria-current="true"]) {
|
|
25
|
+
background: var(--histoire-panel);
|
|
26
|
+
color: var(--histoire-accent);
|
|
27
|
+
}
|
|
28
|
+
:where(.histoire-provider) .histoire-tree :where(summary) { padding: 6px 8px; cursor: pointer; }
|
|
29
|
+
:where(.histoire-provider) .histoire-tree .histoire-story-variant-count { float: inline-end; opacity: .6; }
|
|
30
|
+
:where(.histoire-provider) .histoire-search :where(small) { display: block; color: var(--histoire-muted); }
|
|
31
|
+
:where(.histoire-provider) .histoire-search .histoire-text { width: 100%; margin-bottom: 6px; }
|
|
32
|
+
:where(.histoire-provider) .histoire-toolbar {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
gap: 6px;
|
|
36
|
+
align-items: center;
|
|
37
|
+
padding: 8px;
|
|
38
|
+
border-bottom: 1px solid var(--histoire-border);
|
|
39
|
+
}
|
|
40
|
+
:where(.histoire-provider) .histoire-toolbar :where(label) { display: flex; align-items: center; gap: 4px; }
|
|
41
|
+
:where(.histoire-provider) .histoire-toolbar .histoire-text { width: 72px; }
|
|
42
|
+
|
|
43
|
+
:where(.histoire-provider) :is(.histoire-toolbar, .histoire-events) :where(button) { }
|
|
44
|
+
:where(.histoire-provider) :is(.histoire-tree, .histoire-search, .histoire-toolbar, .histoire-events) :where(button):disabled { }
|
|
45
|
+
:where(.histoire-provider) .histoire-events :where(ol) { margin: 8px 0; padding: 0; }
|
|
46
|
+
:where(.histoire-provider) .histoire-events :where(time) { font-size: 12px; color: var(--histoire-muted); }
|
|
47
|
+
:where(.histoire-provider) .histoire-events :where(pre) { margin: 4px 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
48
|
+
:where(.histoire-provider) :is(.histoire-tree, .histoire-search) :where([role="alert"]) { color: #dc2626; }
|
|
49
|
+
|
|
50
|
+
:where(.histoire-provider) .histoire-events { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
|
|
51
|
+
:where(.histoire-provider) .histoire-events > .histoire-virtual-list { flex: 1; min-height: 0; }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HistoireControlsOverlayMessage, HistoireControlsOverlayResult } from '@histoire/protocol';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
/** Scoped finite presentation; values/callbacks remain inside controls sandbox. */
|
|
4
|
+
export declare const HistoireControlsOverlayHost: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
request: {
|
|
6
|
+
type: PropType<HistoireControlsOverlayMessage>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
result: (_id: string, _result: HistoireControlsOverlayResult) => true;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
14
|
+
request: {
|
|
15
|
+
type: PropType<HistoireControlsOverlayMessage>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
}>> & Readonly<{
|
|
19
|
+
onResult?: ((_id: string, _result: HistoireControlsOverlayResult) => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
21
|
+
//# sourceMappingURL=OverlayHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayHost.d.ts","sourceRoot":"","sources":["../../src/overlays/OverlayHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AACvG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAOnC,mFAAmF;AACnF,eAAO,MAAM,2BAA2B;;cAEF,QAAQ,CAAC,8BAA8B,CAAC;;;;;;kBACrD,MAAM,WAAW,6BAA6B;;;;;;;;iFAqGrE,CAAA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { focusControlsSelectedOption, HstButton, moveControlsOptionFocus, reconcileControlsOptionFocus } from '@histoire/controls/vue';
|
|
2
|
+
import { defineComponent, h, nextTick, ref, Teleport, watch } from 'vue';
|
|
3
|
+
import { HistoireDropdown, HistoireTooltip } from '../foundation/floating.js';
|
|
4
|
+
import { useHistoireContext, useHistoireResource } from '../provider/context.js';
|
|
5
|
+
import { providerOverlayRect } from './geometry.js';
|
|
6
|
+
import { observeControlsMenuBounds } from './menu-bounds.js';
|
|
7
|
+
/** Scoped finite presentation; values/callbacks remain inside controls sandbox. */
|
|
8
|
+
export const HistoireControlsOverlayHost = defineComponent({
|
|
9
|
+
name: 'HistoireControlsOverlayHost',
|
|
10
|
+
props: { request: { type: Object, required: true } },
|
|
11
|
+
emits: { result: (_id, _result) => true },
|
|
12
|
+
setup(props, { emit }) {
|
|
13
|
+
const context = useHistoireContext();
|
|
14
|
+
const list = ref(null);
|
|
15
|
+
const popper = ref(null);
|
|
16
|
+
const maximumHeight = ref();
|
|
17
|
+
let bounds;
|
|
18
|
+
let active = true;
|
|
19
|
+
/** Echo opaque overlay identity; late hide can never resolve replacement menu. */
|
|
20
|
+
function result(value) {
|
|
21
|
+
if (active) {
|
|
22
|
+
emit('result', props.request.id, value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Preserve current keyboard focus when a resized scrollport gets a new cap. */
|
|
26
|
+
function setMaximumHeight(value) {
|
|
27
|
+
maximumHeight.value = value;
|
|
28
|
+
const owner = list.value;
|
|
29
|
+
void nextTick().then(() => {
|
|
30
|
+
if (!active || !owner || list.value !== owner)
|
|
31
|
+
return;
|
|
32
|
+
const focused = owner.ownerDocument.activeElement;
|
|
33
|
+
// Never restore selectedId here: End/Arrow navigation may focus another
|
|
34
|
+
// opaque choice. Reveal only the current option in this exact menu.
|
|
35
|
+
if (focused?.getAttribute('role') === 'option' && owner.contains(focused)) {
|
|
36
|
+
focused.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
37
|
+
}
|
|
38
|
+
}).catch((error) => {
|
|
39
|
+
if (active && list.value === owner)
|
|
40
|
+
context.reportError(error);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Focus only after actual popper shown; owner identity checked again by controller. */
|
|
44
|
+
async function focusSelected() {
|
|
45
|
+
await nextTick();
|
|
46
|
+
const options = props.request.overlay;
|
|
47
|
+
if (!active || options?.kind !== 'select') {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
bounds?.close();
|
|
51
|
+
bounds = list.value ? observeControlsMenuBounds(list.value, setMaximumHeight) : undefined;
|
|
52
|
+
await nextTick();
|
|
53
|
+
if (!active)
|
|
54
|
+
return;
|
|
55
|
+
focusControlsSelectedOption(list.value);
|
|
56
|
+
}
|
|
57
|
+
/** Tab closes before finite cross-frame traversal; Escape returns source anchor. */
|
|
58
|
+
function keydown(event) {
|
|
59
|
+
if (event.key === 'Tab' || event.key === 'Escape') {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
event.stopPropagation();
|
|
62
|
+
result({ restoreFocus: true, ...(event.key === 'Tab' ? { focusDirection: event.shiftKey ? 'previous' : 'next' } : {}) });
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
moveControlsOptionFocus(list.value, event);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Reordering retains current option focus; removed/disabled choices recover.
|
|
69
|
+
watch(() => props.request.overlay, (overlay) => {
|
|
70
|
+
if (!active || overlay?.kind !== 'select')
|
|
71
|
+
return;
|
|
72
|
+
if (!overlay.items.length)
|
|
73
|
+
result({ restoreFocus: true });
|
|
74
|
+
else
|
|
75
|
+
reconcileControlsOptionFocus(list.value);
|
|
76
|
+
}, { deep: true, flush: 'post' });
|
|
77
|
+
watch(() => props.request.anchor, async () => {
|
|
78
|
+
await nextTick();
|
|
79
|
+
popper.value?.onResize?.();
|
|
80
|
+
bounds?.update();
|
|
81
|
+
});
|
|
82
|
+
useHistoireResource(() => {
|
|
83
|
+
active = false;
|
|
84
|
+
bounds?.close();
|
|
85
|
+
});
|
|
86
|
+
return () => {
|
|
87
|
+
const overlay = props.request.overlay;
|
|
88
|
+
if (!overlay || !context.root.value || !context.overlay.value) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
const rect = providerOverlayRect(context.root.value, props.request.anchor);
|
|
92
|
+
const options = overlay.kind === 'select' ? overlay : undefined;
|
|
93
|
+
const tooltip = overlay.kind === 'tooltip' ? overlay : undefined;
|
|
94
|
+
return h(Teleport, { to: context.overlay.value }, h(options ? HistoireDropdown : HistoireTooltip, {
|
|
95
|
+
ref: popper,
|
|
96
|
+
key: props.request.id,
|
|
97
|
+
shown: true,
|
|
98
|
+
triggers: [],
|
|
99
|
+
autoHide: !!options,
|
|
100
|
+
autoSize: !!options,
|
|
101
|
+
autoBoundaryMaxSize: true,
|
|
102
|
+
placement: tooltip?.placement ?? 'bottom',
|
|
103
|
+
distance: tooltip?.distance ?? 8,
|
|
104
|
+
noAutoFocus: true,
|
|
105
|
+
eagerMount: true,
|
|
106
|
+
class: 'histoire-controls-anchor',
|
|
107
|
+
style: { left: `${rect.x}px`, top: `${rect.y}px`, width: `${rect.width}px`, height: `${rect.height}px` },
|
|
108
|
+
onApplyShow: focusSelected,
|
|
109
|
+
onHide: () => result({ restoreFocus: false }),
|
|
110
|
+
}, {
|
|
111
|
+
default: () => h('span', { 'aria-hidden': true }),
|
|
112
|
+
popper: () => options
|
|
113
|
+
? h('div', { 'ref': list, 'role': 'listbox', 'aria-label': options.label ?? 'Options', 'class': 'histoire-controls-options', 'data-histoire-control-appearance': context.root.value?.dataset.histoireAppearance, 'style': maximumHeight.value === undefined ? undefined : { '--histoire-control-menu-boundary': `${maximumHeight.value}px` }, 'onKeydown': keydown }, options.items.map(item => h(HstButton, { 'key': item.id, 'type': 'button', 'role': 'option', 'color': 'flat', 'disabled': item.disabled, 'aria-selected': item.id === options.selectedId, 'onClick': () => !item.disabled && result({ itemId: item.id, restoreFocus: true }) }, { default: () => item.label })))
|
|
114
|
+
: h('span', { role: 'tooltip', class: 'histoire-controls-tooltip' }, tooltip?.content),
|
|
115
|
+
}));
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HistoireControlsRect } from '@histoire/protocol';
|
|
2
|
+
/** Convert viewport anchor into provider padding box, including transformed hosts. */
|
|
3
|
+
export declare function providerOverlayRect(root: HTMLElement, anchor: HistoireControlsRect): HistoireControlsRect;
|
|
4
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/overlays/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAE9D,sFAAsF;AACtF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,GAAG,oBAAoB,CAKzG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Convert viewport anchor into provider padding box, including transformed hosts. */
|
|
2
|
+
export function providerOverlayRect(root, anchor) {
|
|
3
|
+
const rect = root.getBoundingClientRect();
|
|
4
|
+
const scaleX = root.offsetWidth ? rect.width / root.offsetWidth : 1;
|
|
5
|
+
const scaleY = root.offsetHeight ? rect.height / root.offsetHeight : 1;
|
|
6
|
+
return { x: (anchor.x - rect.x) / scaleX - root.clientLeft, y: (anchor.y - rect.y) / scaleY - root.clientTop, width: anchor.width / scaleX, height: anchor.height / scaleY };
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Menu measurement owned by one displayed popper and closed with that overlay. */
|
|
2
|
+
export interface ControlsMenuBounds {
|
|
3
|
+
/** Refresh after anchor geometry changes or vendor positioning completes. */
|
|
4
|
+
update: () => void;
|
|
5
|
+
/** Disconnect observers; late callbacks become inert. */
|
|
6
|
+
close: () => void;
|
|
7
|
+
}
|
|
8
|
+
/** Fit complete choices inside FloatingVue's content box, including fractional borders. */
|
|
9
|
+
export declare function observeControlsMenuBounds(list: HTMLElement, height: (value: number | undefined) => void): ControlsMenuBounds;
|
|
10
|
+
//# sourceMappingURL=menu-bounds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-bounds.d.ts","sourceRoot":"","sources":["../../src/overlays/menu-bounds.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,yDAAyD;IACzD,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED,2FAA2F;AAC3F,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,GAAG,kBAAkB,CA+C5H"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Fit complete choices inside FloatingVue's content box, including fractional borders. */
|
|
2
|
+
export function observeControlsMenuBounds(list, height) {
|
|
3
|
+
const inner = list.closest('.v-popper__inner');
|
|
4
|
+
const view = list.ownerDocument.defaultView;
|
|
5
|
+
let active = true;
|
|
6
|
+
let delivered = false;
|
|
7
|
+
let previous;
|
|
8
|
+
/** Use the vendor's boundary constraint, never its height resulting from our own cap. */
|
|
9
|
+
function update() {
|
|
10
|
+
if (!active || !inner || !view)
|
|
11
|
+
return;
|
|
12
|
+
const style = view.getComputedStyle(inner);
|
|
13
|
+
const maximum = Number.parseFloat(style.maxHeight);
|
|
14
|
+
// FloatingVue temporarily clears maxHeight while asynchronously computing
|
|
15
|
+
// its next position. Retain the last bounded scrollport during that gap:
|
|
16
|
+
// expanding it would reset scrollTop and conceal the focused choice.
|
|
17
|
+
if (!Number.isFinite(maximum) && previous !== undefined)
|
|
18
|
+
return;
|
|
19
|
+
const borders = (Number.parseFloat(style.borderTopWidth) || 0) + (Number.parseFloat(style.borderBottomWidth) || 0);
|
|
20
|
+
// Floor prevents a partially clipped last row under transformed hosts. Reading
|
|
21
|
+
// clientHeight here would feed the imposed cap back into itself on each resize.
|
|
22
|
+
const value = Number.isFinite(maximum) ? Math.max(0, Math.floor(maximum - borders)) : undefined;
|
|
23
|
+
if (!delivered || value !== previous) {
|
|
24
|
+
delivered = true;
|
|
25
|
+
previous = value;
|
|
26
|
+
height(value);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const resize = inner && view?.ResizeObserver ? new view.ResizeObserver(update) : undefined;
|
|
30
|
+
const mutation = inner && view?.MutationObserver ? new view.MutationObserver(update) : undefined;
|
|
31
|
+
if (inner) {
|
|
32
|
+
resize?.observe(inner);
|
|
33
|
+
// Increasing a boundary can leave the current menu unchanged, so observe the
|
|
34
|
+
// vendor's inline constraint as well as the resulting content dimensions.
|
|
35
|
+
mutation?.observe(inner, { attributes: true, attributeFilter: ['style'] });
|
|
36
|
+
}
|
|
37
|
+
update();
|
|
38
|
+
return {
|
|
39
|
+
update,
|
|
40
|
+
close() {
|
|
41
|
+
if (!active)
|
|
42
|
+
return;
|
|
43
|
+
active = false;
|
|
44
|
+
try {
|
|
45
|
+
resize?.disconnect();
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
mutation?.disconnect();
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ExtensionHost } from '@histoire/plugin-kit';
|
|
2
|
+
import type { HistoireSession } from '@histoire/sdk';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
4
|
+
/** Explicit session provider with local theme, overlay, measurement and resource ownership. */
|
|
5
|
+
export declare const HistoireProvider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
6
|
+
/** Caller connects/disposes this controller. */
|
|
7
|
+
session: {
|
|
8
|
+
type: PropType<HistoireSession>;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Caller-owned extension host whose contributions native parts render. Never disposed by the
|
|
13
|
+
* provider, kept across session replacement; nested providers without it reuse the nearest one.
|
|
14
|
+
*/
|
|
15
|
+
extensions: {
|
|
16
|
+
type: PropType<ExtensionHost>;
|
|
17
|
+
default: undefined;
|
|
18
|
+
};
|
|
19
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
22
|
+
/** Async child mount/cleanup failures; never dropped as unhandled rejections. */
|
|
23
|
+
error: (_error: unknown) => true;
|
|
24
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
25
|
+
/** Caller connects/disposes this controller. */
|
|
26
|
+
session: {
|
|
27
|
+
type: PropType<HistoireSession>;
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Caller-owned extension host whose contributions native parts render. Never disposed by the
|
|
32
|
+
* provider, kept across session replacement; nested providers without it reuse the nearest one.
|
|
33
|
+
*/
|
|
34
|
+
extensions: {
|
|
35
|
+
type: PropType<ExtensionHost>;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
}>> & Readonly<{
|
|
39
|
+
onError?: ((_error: unknown) => any) | undefined;
|
|
40
|
+
}>, {
|
|
41
|
+
extensions: ExtensionHost;
|
|
42
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
43
|
+
//# sourceMappingURL=HistoireProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoireProvider.d.ts","sourceRoot":"","sources":["../../src/provider/HistoireProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAWnC,+FAA+F;AAC/F,eAAO,MAAM,gBAAgB;IAIzB,gDAAgD;;cACrB,QAAQ,CAAC,eAAe,CAAC;;;IACpD;;;OAGG;;QACW,IAAI,EAAY,QAAQ,CAAC,aAAa,CAAC;QAAE,OAAO;;;;;IAG9D,iFAAiF;oBACjE,OAAO;;IAVvB,gDAAgD;;;;;IAEhD;;;OAGG;;;;;;;;;4EA+JL,CAAA"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { provideHistoireControls } from '@histoire/controls/vue';
|
|
2
|
+
import { getHistoireSessionDescriptor } from '@histoire/sdk/internal';
|
|
3
|
+
import { computed, defineComponent, h, inject, markRaw, onBeforeUnmount, onMounted, provide, readonly, shallowRef, toRaw, watch } from 'vue';
|
|
4
|
+
import { provideNativeWorkbenchComponents } from '../components/extensions/workbench-components.js';
|
|
5
|
+
import { histoireContextKey } from './context.js';
|
|
6
|
+
import { createProviderExtensions, histoireExtensionsKey, provideHistoireExtensions } from './extensions.js';
|
|
7
|
+
import { createHistoirePanelNavigation } from './panels.js';
|
|
8
|
+
import { bindPluginShortcuts } from './plugin-shortcuts.js';
|
|
9
|
+
import { getHistoireThemeVariables } from './theme.js';
|
|
10
|
+
/** Explicit session provider with local theme, overlay, measurement and resource ownership. */
|
|
11
|
+
export const HistoireProvider = defineComponent({
|
|
12
|
+
name: 'HistoireProvider',
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: {
|
|
15
|
+
/** Caller connects/disposes this controller. */
|
|
16
|
+
session: { type: Object, required: true },
|
|
17
|
+
/**
|
|
18
|
+
* Caller-owned extension host whose contributions native parts render. Never disposed by the
|
|
19
|
+
* provider, kept across session replacement; nested providers without it reuse the nearest one.
|
|
20
|
+
*/
|
|
21
|
+
extensions: { type: Object, default: undefined },
|
|
22
|
+
},
|
|
23
|
+
emits: {
|
|
24
|
+
/** Async child mount/cleanup failures; never dropped as unhandled rejections. */
|
|
25
|
+
error: (_error) => true,
|
|
26
|
+
},
|
|
27
|
+
setup(props, { attrs, slots, emit }) {
|
|
28
|
+
const root = shallowRef(null);
|
|
29
|
+
const overlay = shallowRef(null);
|
|
30
|
+
const size = shallowRef({ width: 0, height: 0 });
|
|
31
|
+
const snapshot = shallowRef(props.session.getSnapshot());
|
|
32
|
+
const panels = createHistoirePanelNavigation(() => toRaw(props.session).getSnapshot());
|
|
33
|
+
const generation = shallowRef(0);
|
|
34
|
+
// Hosts are plain objects with private state; Vue must never proxy them.
|
|
35
|
+
const ownHost = () => props.extensions ? markRaw(toRaw(props.extensions)) : undefined;
|
|
36
|
+
const plugins = createProviderExtensions({ own: ownHost, inherited: inject(histoireExtensionsKey, undefined), session: () => toRaw(props.session), panels });
|
|
37
|
+
provideHistoireExtensions(() => plugins.state.host);
|
|
38
|
+
// State and pane components for plugin views; an enclosing workbench's own ones win.
|
|
39
|
+
provideNativeWorkbenchComponents();
|
|
40
|
+
const systemDark = shallowRef(false);
|
|
41
|
+
const dark = computed(() => snapshot.value.settings.colorScheme === 'dark' || (snapshot.value.settings.colorScheme === 'auto' && systemDark.value));
|
|
42
|
+
const paletteRevision = computed(() => snapshot.value.status === 'ready' && snapshot.value.source ? JSON.stringify([snapshot.value.source.epoch, snapshot.value.source.revision]) : '');
|
|
43
|
+
const theme = computed(() => {
|
|
44
|
+
// Detached descriptor is read only on coherent source revision/session change,
|
|
45
|
+
// avoiding catalog copies on every state edit or event publication.
|
|
46
|
+
return getHistoireThemeVariables(paletteRevision.value ? getHistoireSessionDescriptor(toRaw(props.session)).config : undefined, dark.value);
|
|
47
|
+
});
|
|
48
|
+
const resources = new Set();
|
|
49
|
+
/** One subscription publishes both canonical snapshot and local navigation retirement. */
|
|
50
|
+
function synchronize(value) {
|
|
51
|
+
panels.synchronize(value);
|
|
52
|
+
plugins.synchronize(value);
|
|
53
|
+
snapshot.value = value;
|
|
54
|
+
}
|
|
55
|
+
let stop = props.session.subscribe(synchronize);
|
|
56
|
+
let removed = false;
|
|
57
|
+
let stopMedia;
|
|
58
|
+
let stopShortcuts;
|
|
59
|
+
/** Observe teardown failures and report child errors through live provider boundary. */
|
|
60
|
+
function reportError(error) {
|
|
61
|
+
emit('error', error);
|
|
62
|
+
}
|
|
63
|
+
/** Capture one teardown immediately, release once even if both scopes unmount. */
|
|
64
|
+
function own(cleanup) {
|
|
65
|
+
let active = true;
|
|
66
|
+
const dispose = () => {
|
|
67
|
+
if (!active)
|
|
68
|
+
return;
|
|
69
|
+
active = false;
|
|
70
|
+
resources.delete(dispose);
|
|
71
|
+
try {
|
|
72
|
+
Promise.resolve(cleanup()).catch(reportError);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
reportError(error);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
if (removed)
|
|
79
|
+
dispose();
|
|
80
|
+
else
|
|
81
|
+
resources.add(dispose);
|
|
82
|
+
return dispose;
|
|
83
|
+
}
|
|
84
|
+
// Descendants remount when the explicit caller changes sessions. Their
|
|
85
|
+
// composables therefore retain direct session access without prop drilling.
|
|
86
|
+
const context = {
|
|
87
|
+
get session() {
|
|
88
|
+
// Host refs/props may proxy session. Internal ownership belongs to the
|
|
89
|
+
// caller's exact controller object, never Vue's reactive wrapper.
|
|
90
|
+
return toRaw(props.session);
|
|
91
|
+
},
|
|
92
|
+
root,
|
|
93
|
+
overlay,
|
|
94
|
+
size: readonly(size),
|
|
95
|
+
panels,
|
|
96
|
+
own,
|
|
97
|
+
reportError,
|
|
98
|
+
extensions: plugins.state,
|
|
99
|
+
};
|
|
100
|
+
provide(histoireContextKey, context);
|
|
101
|
+
provideHistoireControls({ overlay, dark });
|
|
102
|
+
watch(() => props.session, (session) => {
|
|
103
|
+
for (const dispose of Array.from(resources))
|
|
104
|
+
dispose();
|
|
105
|
+
stop();
|
|
106
|
+
panels.clear();
|
|
107
|
+
plugins.replace();
|
|
108
|
+
snapshot.value = session.getSnapshot();
|
|
109
|
+
stop = session.subscribe(synchronize);
|
|
110
|
+
generation.value++;
|
|
111
|
+
}, { flush: 'sync' });
|
|
112
|
+
/** Keep one size observer bound to the current provider root. */
|
|
113
|
+
const stopRootSize = watch(root, (element, _previous, onCleanup) => {
|
|
114
|
+
if (!element) {
|
|
115
|
+
size.value = { width: 0, height: 0 };
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const observedRoot = element;
|
|
119
|
+
let active = true;
|
|
120
|
+
/** Reject queued callbacks after replacement, including A/B/A root reuse. */
|
|
121
|
+
function publish(width, height) {
|
|
122
|
+
if (!active || removed || root.value !== observedRoot)
|
|
123
|
+
return;
|
|
124
|
+
size.value = { width, height };
|
|
125
|
+
}
|
|
126
|
+
// Initial measurement runs after DOM update, outside descendant render.
|
|
127
|
+
const bounds = observedRoot.getBoundingClientRect();
|
|
128
|
+
publish(bounds.width, bounds.height);
|
|
129
|
+
const Observer = observedRoot.ownerDocument.defaultView?.ResizeObserver;
|
|
130
|
+
if (!Observer) {
|
|
131
|
+
onCleanup(() => active = false);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const observer = new Observer((entries) => {
|
|
135
|
+
if (!active || removed || root.value !== observedRoot)
|
|
136
|
+
return;
|
|
137
|
+
const content = entries.find(entry => entry.target === observedRoot)?.contentRect;
|
|
138
|
+
if (content)
|
|
139
|
+
publish(content.width, content.height);
|
|
140
|
+
});
|
|
141
|
+
onCleanup(() => {
|
|
142
|
+
active = false;
|
|
143
|
+
observer.disconnect();
|
|
144
|
+
});
|
|
145
|
+
observer.observe(observedRoot);
|
|
146
|
+
}, { flush: 'post', immediate: true });
|
|
147
|
+
onMounted(() => {
|
|
148
|
+
if (!root.value)
|
|
149
|
+
return;
|
|
150
|
+
// Not a session resource: session replacement keeps the provider root and its keys.
|
|
151
|
+
stopShortcuts = bindPluginShortcuts(root.value, plugins.state, reportError);
|
|
152
|
+
const media = root.value.ownerDocument.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');
|
|
153
|
+
if (media) {
|
|
154
|
+
systemDark.value = media.matches;
|
|
155
|
+
const change = (event) => systemDark.value = event.matches;
|
|
156
|
+
media.addEventListener('change', change);
|
|
157
|
+
stopMedia = () => media.removeEventListener('change', change);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
onBeforeUnmount(() => {
|
|
161
|
+
removed = true;
|
|
162
|
+
stopRootSize();
|
|
163
|
+
stopMedia?.();
|
|
164
|
+
stopShortcuts?.();
|
|
165
|
+
stop();
|
|
166
|
+
for (const dispose of Array.from(resources))
|
|
167
|
+
dispose();
|
|
168
|
+
panels.close();
|
|
169
|
+
plugins.close();
|
|
170
|
+
});
|
|
171
|
+
return () => h('div', {
|
|
172
|
+
...attrs,
|
|
173
|
+
'ref': root,
|
|
174
|
+
'class': ['histoire-provider', { 'htw-dark': dark.value }, attrs.class],
|
|
175
|
+
'data-histoire-appearance': dark.value ? 'dark' : 'light',
|
|
176
|
+
'dir': snapshot.value.settings.textDirection,
|
|
177
|
+
'style': [theme.value, attrs.style],
|
|
178
|
+
}, [
|
|
179
|
+
h('div', { class: 'histoire-provider-content', key: generation.value }, slots.default?.()),
|
|
180
|
+
h('div', { 'ref': overlay, 'class': 'histoire-provider-overlays', 'data-histoire-overlay': '' }),
|
|
181
|
+
]);
|
|
182
|
+
},
|
|
183
|
+
});
|