@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.
Files changed (204) hide show
  1. package/LICENSE +21 -0
  2. package/dist/components/controls/GenericControls.d.ts +30 -0
  3. package/dist/components/controls/GenericControls.d.ts.map +1 -0
  4. package/dist/components/controls/GenericControls.js +34 -0
  5. package/dist/components/controls/HistoireControls.d.ts +30 -0
  6. package/dist/components/controls/HistoireControls.d.ts.map +1 -0
  7. package/dist/components/controls/HistoireControls.js +176 -0
  8. package/dist/components/controls/PresetMenu.d.ts +63 -0
  9. package/dist/components/controls/PresetMenu.d.ts.map +1 -0
  10. package/dist/components/controls/PresetMenu.js +180 -0
  11. package/dist/components/controls/PropControl.d.ts +40 -0
  12. package/dist/components/controls/PropControl.d.ts.map +1 -0
  13. package/dist/components/controls/PropControl.js +66 -0
  14. package/dist/components/controls/StateControl.d.ts +15 -0
  15. package/dist/components/controls/StateControl.d.ts.map +1 -0
  16. package/dist/components/controls/StateControl.js +30 -0
  17. package/dist/components/controls/StatePresets.d.ts +37 -0
  18. package/dist/components/controls/StatePresets.d.ts.map +1 -0
  19. package/dist/components/controls/StatePresets.js +105 -0
  20. package/dist/components/controls/edit.d.ts +10 -0
  21. package/dist/components/controls/edit.d.ts.map +1 -0
  22. package/dist/components/controls/edit.js +82 -0
  23. package/dist/components/controls/editor.d.ts +9 -0
  24. package/dist/components/controls/editor.d.ts.map +1 -0
  25. package/dist/components/controls/editor.js +28 -0
  26. package/dist/components/docs/HistoireDocs.d.ts +44 -0
  27. package/dist/components/docs/HistoireDocs.d.ts.map +1 -0
  28. package/dist/components/docs/HistoireDocs.js +124 -0
  29. package/dist/components/docs/anchors.d.ts +3 -0
  30. package/dist/components/docs/anchors.d.ts.map +1 -0
  31. package/dist/components/docs/anchors.js +26 -0
  32. package/dist/components/docs/content.d.ts +11 -0
  33. package/dist/components/docs/content.d.ts.map +1 -0
  34. package/dist/components/docs/content.js +7 -0
  35. package/dist/components/docs/links.d.ts +20 -0
  36. package/dist/components/docs/links.d.ts.map +1 -0
  37. package/dist/components/docs/links.js +85 -0
  38. package/dist/components/docs/sanitize.d.ts +3 -0
  39. package/dist/components/docs/sanitize.d.ts.map +1 -0
  40. package/dist/components/docs/sanitize.js +16 -0
  41. package/dist/components/embed/EmbedPanels.d.ts +21 -0
  42. package/dist/components/embed/EmbedPanels.d.ts.map +1 -0
  43. package/dist/components/embed/EmbedPanels.js +49 -0
  44. package/dist/components/embed/HistoireEmbed.d.ts +36 -0
  45. package/dist/components/embed/HistoireEmbed.d.ts.map +1 -0
  46. package/dist/components/embed/HistoireEmbed.js +81 -0
  47. package/dist/components/embed/geometry.d.ts +5 -0
  48. package/dist/components/embed/geometry.d.ts.map +1 -0
  49. package/dist/components/embed/geometry.js +38 -0
  50. package/dist/components/events/HistoireEvents.d.ts +30 -0
  51. package/dist/components/events/HistoireEvents.d.ts.map +1 -0
  52. package/dist/components/events/HistoireEvents.js +88 -0
  53. package/dist/components/explorer/ExplorerNavigation.d.ts +20 -0
  54. package/dist/components/explorer/ExplorerNavigation.d.ts.map +1 -0
  55. package/dist/components/explorer/ExplorerNavigation.js +15 -0
  56. package/dist/components/explorer/ExplorerPanels.d.ts +42 -0
  57. package/dist/components/explorer/ExplorerPanels.d.ts.map +1 -0
  58. package/dist/components/explorer/ExplorerPanels.js +87 -0
  59. package/dist/components/explorer/ExplorerPreview.d.ts +29 -0
  60. package/dist/components/explorer/ExplorerPreview.d.ts.map +1 -0
  61. package/dist/components/explorer/ExplorerPreview.js +93 -0
  62. package/dist/components/explorer/HistoireExplorer.d.ts +47 -0
  63. package/dist/components/explorer/HistoireExplorer.d.ts.map +1 -0
  64. package/dist/components/explorer/HistoireExplorer.js +41 -0
  65. package/dist/components/explorer/panel-tabs.d.ts +48 -0
  66. package/dist/components/explorer/panel-tabs.d.ts.map +1 -0
  67. package/dist/components/explorer/panel-tabs.js +58 -0
  68. package/dist/components/extensions/HistoireExtensionOutlet.d.ts +47 -0
  69. package/dist/components/extensions/HistoireExtensionOutlet.d.ts.map +1 -0
  70. package/dist/components/extensions/HistoireExtensionOutlet.js +35 -0
  71. package/dist/components/extensions/HistoireExtensionView.d.ts +59 -0
  72. package/dist/components/extensions/HistoireExtensionView.d.ts.map +1 -0
  73. package/dist/components/extensions/HistoireExtensionView.js +58 -0
  74. package/dist/components/extensions/panel-action.d.ts +38 -0
  75. package/dist/components/extensions/panel-action.d.ts.map +1 -0
  76. package/dist/components/extensions/panel-action.js +19 -0
  77. package/dist/components/extensions/state-renderer.d.ts +17 -0
  78. package/dist/components/extensions/state-renderer.d.ts.map +1 -0
  79. package/dist/components/extensions/state-renderer.js +72 -0
  80. package/dist/components/extensions/view-lifecycle.d.ts +47 -0
  81. package/dist/components/extensions/view-lifecycle.d.ts.map +1 -0
  82. package/dist/components/extensions/view-lifecycle.js +108 -0
  83. package/dist/components/extensions/workbench-components.d.ts +9 -0
  84. package/dist/components/extensions/workbench-components.d.ts.map +1 -0
  85. package/dist/components/extensions/workbench-components.js +82 -0
  86. package/dist/components/preview/HistoirePreview.d.ts +11 -0
  87. package/dist/components/preview/HistoirePreview.d.ts.map +1 -0
  88. package/dist/components/preview/HistoirePreview.js +3 -0
  89. package/dist/components/preview/surface.d.ts +13 -0
  90. package/dist/components/preview/surface.d.ts.map +1 -0
  91. package/dist/components/preview/surface.js +129 -0
  92. package/dist/components/search/HistoireSearch.d.ts +9 -0
  93. package/dist/components/search/HistoireSearch.d.ts.map +1 -0
  94. package/dist/components/search/HistoireSearch.js +66 -0
  95. package/dist/components/source/HistoireSource.d.ts +58 -0
  96. package/dist/components/source/HistoireSource.d.ts.map +1 -0
  97. package/dist/components/source/HistoireSource.js +85 -0
  98. package/dist/components/source/content.d.ts +11 -0
  99. package/dist/components/source/content.d.ts.map +1 -0
  100. package/dist/components/source/content.js +7 -0
  101. package/dist/components/source/highlight.d.ts +3 -0
  102. package/dist/components/source/highlight.d.ts.map +1 -0
  103. package/dist/components/source/highlight.js +15 -0
  104. package/dist/components/source/render.d.ts +6 -0
  105. package/dist/components/source/render.d.ts.map +1 -0
  106. package/dist/components/source/render.js +11 -0
  107. package/dist/components/tests/HistoireTests.d.ts +66 -0
  108. package/dist/components/tests/HistoireTests.d.ts.map +1 -0
  109. package/dist/components/tests/HistoireTests.js +109 -0
  110. package/dist/components/tests/TestsRunActions.d.ts +54 -0
  111. package/dist/components/tests/TestsRunActions.d.ts.map +1 -0
  112. package/dist/components/tests/TestsRunActions.js +138 -0
  113. package/dist/components/tests/render.d.ts +33 -0
  114. package/dist/components/tests/render.d.ts.map +1 -0
  115. package/dist/components/tests/render.js +103 -0
  116. package/dist/components/toolbar/HistoireToolbar.d.ts +7 -0
  117. package/dist/components/toolbar/HistoireToolbar.d.ts.map +1 -0
  118. package/dist/components/toolbar/HistoireToolbar.js +66 -0
  119. package/dist/components/toolbar/ToolbarExtensions.d.ts +27 -0
  120. package/dist/components/toolbar/ToolbarExtensions.d.ts.map +1 -0
  121. package/dist/components/toolbar/ToolbarExtensions.js +79 -0
  122. package/dist/components/toolbar/groups.d.ts +19 -0
  123. package/dist/components/toolbar/groups.d.ts.map +1 -0
  124. package/dist/components/toolbar/groups.js +18 -0
  125. package/dist/components/tree/HistoireStoryTree.d.ts +40 -0
  126. package/dist/components/tree/HistoireStoryTree.d.ts.map +1 -0
  127. package/dist/components/tree/HistoireStoryTree.js +57 -0
  128. package/dist/composables/session.d.ts +4 -0
  129. package/dist/composables/session.d.ts.map +1 -0
  130. package/dist/composables/session.js +5 -0
  131. package/dist/composables/snapshot.d.ts +5 -0
  132. package/dist/composables/snapshot.d.ts.map +1 -0
  133. package/dist/composables/snapshot.js +9 -0
  134. package/dist/content/controller.d.ts +20 -0
  135. package/dist/content/controller.d.ts.map +1 -0
  136. package/dist/content/controller.js +54 -0
  137. package/dist/content.css +22 -0
  138. package/dist/controls.css +26 -0
  139. package/dist/embed.css +15 -0
  140. package/dist/explorer.css +67 -0
  141. package/dist/extensions.css +20 -0
  142. package/dist/foundation/VirtualList.d.ts +114 -0
  143. package/dist/foundation/VirtualList.d.ts.map +1 -0
  144. package/dist/foundation/VirtualList.js +126 -0
  145. package/dist/foundation/floating.d.ts +9 -0
  146. package/dist/foundation/floating.d.ts.map +1 -0
  147. package/dist/foundation/floating.js +90 -0
  148. package/dist/foundation/parts.d.ts +13 -0
  149. package/dist/foundation/parts.d.ts.map +1 -0
  150. package/dist/foundation/parts.js +13 -0
  151. package/dist/index.d.ts +18 -0
  152. package/dist/index.d.ts.map +1 -0
  153. package/dist/index.js +15 -0
  154. package/dist/internal.d.ts +31 -0
  155. package/dist/internal.d.ts.map +1 -0
  156. package/dist/internal.js +26 -0
  157. package/dist/navigation.css +51 -0
  158. package/dist/overlays/OverlayHost.d.ts +21 -0
  159. package/dist/overlays/OverlayHost.d.ts.map +1 -0
  160. package/dist/overlays/OverlayHost.js +118 -0
  161. package/dist/overlays/geometry.d.ts +4 -0
  162. package/dist/overlays/geometry.d.ts.map +1 -0
  163. package/dist/overlays/geometry.js +7 -0
  164. package/dist/overlays/menu-bounds.d.ts +10 -0
  165. package/dist/overlays/menu-bounds.d.ts.map +1 -0
  166. package/dist/overlays/menu-bounds.js +52 -0
  167. package/dist/provider/HistoireProvider.d.ts +43 -0
  168. package/dist/provider/HistoireProvider.d.ts.map +1 -0
  169. package/dist/provider/HistoireProvider.js +183 -0
  170. package/dist/provider/context.d.ts +37 -0
  171. package/dist/provider/context.d.ts.map +1 -0
  172. package/dist/provider/context.js +16 -0
  173. package/dist/provider/extensions.d.ts +61 -0
  174. package/dist/provider/extensions.d.ts.map +1 -0
  175. package/dist/provider/extensions.js +139 -0
  176. package/dist/provider/panels.d.ts +33 -0
  177. package/dist/provider/panels.d.ts.map +1 -0
  178. package/dist/provider/panels.js +53 -0
  179. package/dist/provider/plugin-shortcuts.d.ts +22 -0
  180. package/dist/provider/plugin-shortcuts.d.ts.map +1 -0
  181. package/dist/provider/plugin-shortcuts.js +73 -0
  182. package/dist/provider/shortcuts.d.ts +16 -0
  183. package/dist/provider/shortcuts.d.ts.map +1 -0
  184. package/dist/provider/shortcuts.js +62 -0
  185. package/dist/provider/theme.d.ts +4 -0
  186. package/dist/provider/theme.d.ts.map +1 -0
  187. package/dist/provider/theme.js +25 -0
  188. package/dist/search/navigation.d.ts +27 -0
  189. package/dist/search/navigation.d.ts.map +1 -0
  190. package/dist/search/navigation.js +61 -0
  191. package/dist/style.css +88 -0
  192. package/dist/tests/collector.d.ts +16 -0
  193. package/dist/tests/collector.d.ts.map +1 -0
  194. package/dist/tests/collector.js +51 -0
  195. package/dist/tests/controller.d.ts +28 -0
  196. package/dist/tests/controller.d.ts.map +1 -0
  197. package/dist/tests/controller.js +79 -0
  198. package/dist/tests/model.d.ts +20 -0
  199. package/dist/tests/model.d.ts.map +1 -0
  200. package/dist/tests/model.js +18 -0
  201. package/dist/tests.css +59 -0
  202. package/dist/virtual-list.css +6 -0
  203. package/package.json +58 -3
  204. package/README.md +0 -3
@@ -0,0 +1,5 @@
1
+ import type { HistoireSession } from '@histoire/sdk';
2
+ import type { ShallowRef } from 'vue';
3
+ /** Observe coherent SDK snapshots without deep proxying frozen DTOs or leaking listeners. */
4
+ export declare function useHistoireSnapshot(): Readonly<ShallowRef<ReturnType<HistoireSession['getSnapshot']>>>;
5
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/composables/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAIrC,6FAA6F;AAC7F,wBAAgB,mBAAmB,IAAI,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAKtG"}
@@ -0,0 +1,9 @@
1
+ import { shallowReadonly, shallowRef } from 'vue';
2
+ import { useHistoireContext, useHistoireResource } from '../provider/context.js';
3
+ /** Observe coherent SDK snapshots without deep proxying frozen DTOs or leaking listeners. */
4
+ export function useHistoireSnapshot() {
5
+ const { session } = useHistoireContext();
6
+ const snapshot = shallowRef(session.getSnapshot());
7
+ useHistoireResource(session.subscribe(value => snapshot.value = value));
8
+ return shallowReadonly(snapshot);
9
+ }
@@ -0,0 +1,20 @@
1
+ import type { HistoireSession } from '@histoire/sdk';
2
+ /** A panel keeps only current prepared content, never canonical source/session state. */
3
+ export interface HistoireContentState<T> {
4
+ /** Read/preparation lifecycle; absent selection remains idle. */
5
+ status: 'idle' | 'loading' | 'ready' | 'error';
6
+ /** Prepared current publication, cleared before every replacement read. */
7
+ value: T | null;
8
+ /** Read or preparation failure; unsafe HTML never becomes fallback value. */
9
+ error: unknown;
10
+ }
11
+ /** One read owner spans fetch, sanitization, and highlighting; abandoned work stays observed. */
12
+ export declare function createHistoireContentController<T>(session: HistoireSession, identity: () => readonly unknown[], read: () => Promise<T | null>, publish: (state: HistoireContentState<T>) => void): {
13
+ refresh: () => Promise<void>;
14
+ refreshIfChanged: () => Promise<void>;
15
+ /** Client mount opts into data reads; SSR component setup does not access DOM. */
16
+ start(): Promise<void>;
17
+ /** Provider owns observer/publication only; caller-owned session remains alive. */
18
+ close(): void;
19
+ };
20
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/content/controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,yFAAyF;AACzF,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,iEAAiE;IACjE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;IAC9C,2EAA2E;IAC3E,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IACf,6EAA6E;IAC7E,KAAK,EAAE,OAAO,CAAA;CACf;AAED,iGAAiG;AACjG,wBAAgB,+BAA+B,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,IAAI;;;IAmC7L,kFAAkF;;IAKlF,mFAAmF;;EAQtF"}
@@ -0,0 +1,54 @@
1
+ /** One read owner spans fetch, sanitization, and highlighting; abandoned work stays observed. */
2
+ export function createHistoireContentController(session, identity, read, publish) {
3
+ let active = true;
4
+ let generation = 0;
5
+ let owner = identity();
6
+ let unsubscribe;
7
+ /** Referential state identity also handles cyclic runtime mirrors without JSON serialization. */
8
+ const same = (left, right) => left.length === right.length && left.every((value, index) => value === right[index]);
9
+ /** Refresh clears old content synchronously and checks ownership after all asynchronous preparation. */
10
+ async function refresh() {
11
+ if (!active)
12
+ return;
13
+ const current = ++generation;
14
+ owner = identity();
15
+ const captured = owner;
16
+ const snapshot = session.getSnapshot();
17
+ // Disconnect/disposal is lifecycle retirement, never a new content failure.
18
+ if (snapshot.status !== 'ready' || snapshot.stale) {
19
+ publish({ status: 'idle', value: null, error: null });
20
+ return;
21
+ }
22
+ publish({ status: 'loading', value: null, error: null });
23
+ try {
24
+ const value = await read();
25
+ if (active && current === generation && same(captured, identity()))
26
+ publish({ status: value === null ? 'idle' : 'ready', value, error: null });
27
+ }
28
+ catch (error) {
29
+ if (active && current === generation && same(captured, identity()))
30
+ publish({ status: 'error', value: null, error });
31
+ }
32
+ }
33
+ /** Local appearance observers avoid a second read after SDK already published same owner. */
34
+ function refreshIfChanged() {
35
+ return same(owner, identity()) ? Promise.resolve() : refresh();
36
+ }
37
+ return {
38
+ refresh,
39
+ refreshIfChanged,
40
+ /** Client mount opts into data reads; SSR component setup does not access DOM. */
41
+ start() {
42
+ if (!unsubscribe && active)
43
+ unsubscribe = session.subscribe(() => void refreshIfChanged());
44
+ return refresh();
45
+ },
46
+ /** Provider owns observer/publication only; caller-owned session remains alive. */
47
+ close() {
48
+ active = false;
49
+ generation++;
50
+ unsubscribe?.();
51
+ unsubscribe = undefined;
52
+ },
53
+ };
54
+ }
@@ -0,0 +1,22 @@
1
+ :where(.histoire-provider) :is(.histoire-docs, .histoire-source) { min-width: 0; min-height: 0; flex: 1; overflow: auto; }
2
+ :where(.histoire-provider) .histoire-docs { padding: 16px; }
3
+ :where(.histoire-provider) .histoire-docs :is(h1, h2, h3, h4) { margin: 1.2em 0 .5em; line-height: 1.25; }
4
+ :where(.histoire-provider) .histoire-docs :where(a) { color: var(--histoire-accent); }
5
+ :where(.histoire-provider) .histoire-docs :is(img, video) { max-width: 100%; height: auto; }
6
+ :where(.histoire-provider) .histoire-docs :is(pre, code) { font-family: ui-monospace, monospace; }
7
+ :where(.histoire-provider) .histoire-docs :where(pre) { padding: 12px; overflow: auto; background: var(--histoire-panel); }
8
+ /* One shared container keeps document and story fences compact without utility CSS. */
9
+ :where(.histoire-provider) .histoire-docs .__histoire-code { position: relative; margin: 18px 0 26px; border-radius: 10px; background: var(--histoire-code, #24292e); color: #e6e7ea; }
10
+ :where(.histoire-provider) .histoire-docs .__histoire-code > :where(pre) { margin: 0; padding: 12px 16px; border-radius: inherit; background: transparent !important; }
11
+ :where(.histoire-provider) .histoire-docs .__histoire-code > :is(.__histoire-code-language, div:first-child) { position: absolute; top: 8px; right: 12px; color: rgb(255 255 255 / .4); font: 10px/1.5 var(--histoire-font-mono, ui-monospace, monospace); pointer-events: none; user-select: none; }
12
+ /* Cached and older remote docs can still include MarkdownIt's redundant outer pre. */
13
+ :where(.histoire-provider) .histoire-docs :where(pre):has(> code > .__histoire-code) { margin: 0; padding: 0; overflow: visible; white-space: normal; background: transparent; }
14
+ :where(.histoire-provider) .histoire-docs :where(pre) > :where(code):has(> .__histoire-code) { display: block; font: inherit; }
15
+ :where(.histoire-provider) .histoire-source { display: flex; flex-direction: column; }
16
+ :where(.histoire-provider) .histoire-content-actions { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--histoire-border); }
17
+ :where(.histoire-provider) .histoire-content-actions :where(button) { padding: 4px 10px; }
18
+ :where(.histoire-provider) :where(.histoire-content-actions) :where(button)[aria-pressed="true"] { color: var(--histoire-accent); border-color: currentColor; }
19
+ :where(.histoire-provider) .histoire-content-actions :where(button):disabled { }
20
+ :where(.histoire-provider) .histoire-source-content { flex: 1; min-height: 0; overflow: auto; }
21
+ :where(.histoire-provider) .histoire-source :where(pre) { margin: 0; padding: 16px; min-width: max-content; font-family: ui-monospace, monospace; }
22
+ :where(.histoire-provider) :is(.histoire-docs, .histoire-source) :where([role="alert"]) { margin: 12px; color: #dc2626; }
@@ -0,0 +1,26 @@
1
+ :where(.histoire-provider) .histoire-controls { min-width: 0; padding: 8px; }
2
+ :where(.histoire-provider) .histoire-controls :where(fieldset) { margin: 8px 0; border: 1px solid var(--histoire-border); }
3
+ :where(.histoire-provider) .histoire-generic-controls { min-width: 0; max-width: 100%; }
4
+ :where(.histoire-provider) .histoire-generic-controls :where(fieldset) { min-width: 0; min-inline-size: 0; max-width: 100%; }
5
+ /* Finite scalar labels keep full accessible text without imposing their
6
+ min-content width on every fieldset row in a narrow inspector. */
7
+ :where(.histoire-provider) .histoire-prop-control-finite { min-width: 0; max-width: 100%; }
8
+ :where(.histoire-provider) .histoire-prop-control-finite :is(span,div) { min-width: 0; max-width: 100%; }
9
+ :where(.histoire-provider) .histoire-prop-control-finite .histoire-button-group-options { flex-wrap: wrap; }
10
+ :where(.histoire-provider) .histoire-prop-control-finite .histoire-button-group-options .histoire-button { flex: 1 1 6rem; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
11
+ :where(.histoire-provider) .histoire-custom-controls { min-width: 0; }
12
+ :where(.histoire-provider) .histoire-custom-controls > :where(iframe) { display: block; width: 100%; min-height: 0; border: 0; }
13
+ :where(.histoire-provider) .histoire-controls-presets { display: flex; align-items: center; gap: 6px; min-width: 0; }
14
+ :where(.histoire-provider) .histoire-controls-presets > .histoire-state-presets { flex: 1; }
15
+ :where(.histoire-provider) .histoire-controls-reset { --histoire-icon-button-size: 32px; }
16
+ :where(.histoire-provider) .histoire-controls-anchor { position: absolute; pointer-events: none; }
17
+ :where(.histoire-provider) .histoire-controls-anchor > :where(span) { display: block; width: 100%; height: 100%; }
18
+ :where(.histoire-provider) .histoire-state-presets { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 8px 0; }
19
+ :where(.histoire-provider) .histoire-state-presets > .histoire-select { flex: 1; }
20
+ :where(.histoire-provider) .histoire-preset-dropdown { flex: none; }
21
+ :where(.histoire-provider) .histoire-preset-trigger { --histoire-icon-button-size: 32px; cursor: pointer; }
22
+ :where(.histoire-provider) :is(.histoire-preset-menu, .histoire-preset-form) { width: 200px; max-width: 100%; padding: 4px; }
23
+ :where(.histoire-provider) .histoire-preset-menu { display: flex; flex-direction: column; }
24
+ :where(.histoire-provider) .histoire-preset-menu :where(button) { width: 100%; justify-content: flex-start; text-align: left; }
25
+ :where(.histoire-provider) .histoire-preset-form { padding: 10px; }
26
+ :where(.histoire-provider) .histoire-preset-form-actions { display: flex; justify-content: flex-end; gap: 4px; margin-top: 6px; }
package/dist/embed.css ADDED
@@ -0,0 +1,15 @@
1
+ :where(.histoire-provider) .histoire-embed { display:flex; flex:1; flex-direction:column; min-width:0; min-height:0; height:100%; }
2
+ :where(.histoire-provider) .histoire-embed-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 16px; border-block-end:1px solid var(--histoire-border); }
3
+ :where(.histoire-provider) .histoire-embed-header > :where(strong) { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
4
+ :where(.histoire-provider) .histoire-embed-header > .histoire-select { max-width:65%; }
5
+ :where(.histoire-provider) .histoire-embed-workspace { display:flex; flex:1; min-width:0; min-height:0; }
6
+ :where(.histoire-provider) .histoire-embed-canvas { display:flex; flex:1; min-width:0; min-height:0; overflow:hidden; }
7
+ :where(.histoire-provider) .histoire-embed-panels { display:flex; flex:0 0 320px; flex-direction:column; min-width:0; min-height:0; border-inline-start:1px solid var(--histoire-border); background:var(--histoire-panel); }
8
+ :where(.histoire-provider) .histoire-embed-tabs { display:flex; flex-shrink:0; gap:4px; padding:8px; overflow:auto; }
9
+ :where(.histoire-provider) .histoire-embed-tabs [aria-selected="true"] { background:var(--histoire-accent-soft); }
10
+ :where(.histoire-provider) .histoire-embed-panel { flex:1; min-height:0; overflow:auto; }
11
+ @container (max-width:759px) {
12
+ :where(.histoire-provider) .histoire-embed-workspace { flex-direction:column; }
13
+ :where(.histoire-provider) .histoire-embed-panels { flex:0 1 240px; max-height:45%; border-inline-start:0; border-block-start:1px solid var(--histoire-border); }
14
+ :where(.histoire-provider) .histoire-embed-canvas { flex:1 0 120px; }
15
+ }
@@ -0,0 +1,67 @@
1
+ :where(.histoire-provider) .histoire-explorer {
2
+ display: flex;
3
+ min-width: 0;
4
+ min-height: 0;
5
+ height: 100%;
6
+ }
7
+ :where(.histoire-provider) .histoire-explorer-navigation {
8
+ flex: 0 0 240px;
9
+ min-width: 0;
10
+ overflow: auto;
11
+ border-inline-end: 1px solid var(--histoire-border);
12
+ }
13
+ :where(.histoire-provider) .histoire-explorer-main {
14
+ flex: 1;
15
+ min-width: 0;
16
+ min-height: 0;
17
+ display: flex;
18
+ flex-direction: column;
19
+ }
20
+ :where(.histoire-provider) .histoire-explorer-workspace {
21
+ display: flex;
22
+ flex: 1;
23
+ min-width: 0;
24
+ min-height: 0;
25
+ }
26
+ :where(.histoire-provider) .histoire-explorer-preview {
27
+ flex: 1;
28
+ display: flex;
29
+ flex-direction: column;
30
+ min-width: 0;
31
+ min-height: 0;
32
+ }
33
+ :where(.histoire-provider) .histoire-explorer-preview > .histoire-primary {
34
+ flex: 1;
35
+ min-height: 0;
36
+ }
37
+ :where(.histoire-provider) .histoire-explorer-layout,
38
+ :where(.histoire-provider) .histoire-explorer-tabs {
39
+ display: flex;
40
+ gap: 4px;
41
+ padding: 8px;
42
+ }
43
+ :where(.histoire-provider) .histoire-explorer-panels {
44
+ display: flex;
45
+ flex-direction: column;
46
+ flex: 0 0 320px;
47
+ min-width: 0;
48
+ min-height: 0;
49
+ overflow: auto;
50
+ border-inline-start: 1px solid var(--histoire-border);
51
+ }
52
+ :where(.histoire-provider) .histoire-explorer-panel {
53
+ flex: 1;
54
+ min-height: 180px;
55
+ overflow: auto;
56
+ }
57
+ :where(.histoire-provider) .histoire-explorer-panels > .histoire-source {
58
+ flex: 1;
59
+ min-height: 180px;
60
+ border-block-start: 1px solid var(--histoire-border);
61
+ }
62
+ @container (max-width: 760px) {
63
+ :where(.histoire-provider) .histoire-explorer { flex-direction: column; }
64
+ :where(.histoire-provider) .histoire-explorer-navigation { flex-basis: auto; max-height: 180px; }
65
+ :where(.histoire-provider) .histoire-explorer-workspace { flex-direction: column; }
66
+ :where(.histoire-provider) .histoire-explorer-panels { flex-basis: 260px; }
67
+ }
@@ -0,0 +1,20 @@
1
+ /* Native state and pane layout components handed to plugin views (components/extensions/workbench-components.ts). */
2
+ :where(.histoire-provider) .histoire-state{display:flex;flex-direction:column;align-items:center;gap:6px;margin:32px 16px;color:var(--histoire-muted);font-size:12px;text-align:center}
3
+ :where(.histoire-provider) .histoire-state-visual{display:grid;place-items:center;width:40px;height:40px;margin-bottom:6px;border-radius:50%;color:var(--histoire-accent);background:var(--histoire-accent-soft)}
4
+ :where(.histoire-provider) .histoire-state[data-state="loading"] .histoire-state-visual{background:none}
5
+ :where(.histoire-provider) .histoire-state[data-state="error"] .histoire-state-visual{color:var(--histoire-danger-text,#b91c1c);background:var(--histoire-danger-soft,rgb(220 38 38 / .08))}
6
+ :where(.histoire-provider) .histoire-state>:where(strong){color:var(--histoire-text);font-size:14px;font-weight:600}
7
+ :where(.histoire-provider) .histoire-state>:where(p){max-width:100%;margin:0;overflow-wrap:anywhere}
8
+ :where(.histoire-provider) .histoire-state-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:6px}
9
+ :where(.histoire-provider) .histoire-pane-header{display:flex;align-items:center;gap:8px;min-height:44px;padding:0 16px}
10
+ :where(.histoire-provider) .histoire-pane-header>:where(h2){flex:1;min-width:0;margin:0;overflow:hidden;color:var(--histoire-text);font-size:14px;font-weight:700;text-overflow:ellipsis;white-space:nowrap}
11
+ :where(.histoire-provider) .histoire-pane-toolbar{display:flex;gap:8px;padding:0 16px 12px}
12
+ :where(.histoire-provider) .histoire-pane-list{min-height:0;overflow:auto;padding:0 16px 16px}
13
+
14
+ /* Frame plugin content that cannot adopt the host's visual system. */
15
+ :where(.histoire-provider) .histoire-extension-degraded{box-sizing:border-box;overflow:hidden;border:1px solid var(--histoire-border);border-radius:var(--histoire-radius-control,7px)}
16
+
17
+ /* Interactive plugin content opts back in when its canvas layer is pointer-transparent.
18
+ Keep the empty mount container transparent, and let plugin descendants own their input. */
19
+ :where(.histoire-extension-view[data-histoire-interactive="true"]) > :where(:not(.histoire-extension-mount)),
20
+ :where(.histoire-extension-view[data-histoire-interactive="true"] > .histoire-extension-mount) > * { pointer-events: auto; }
@@ -0,0 +1,114 @@
1
+ import type { PropType, SlotsType, VNodeChild } from 'vue';
2
+ /** Stable row identity stays separate from recycled DOM view identity. */
3
+ export interface HistoireVirtualItem {
4
+ /** Exact caller-owned identity; never a position or concatenated target ID. */
5
+ key: string;
6
+ /** Optional recycling pool discriminator for headings and content rows. */
7
+ kind?: string;
8
+ }
9
+ /** Typed slot contract mirrors the installed scroller's public runtime slot. */
10
+ export interface HistoireVirtualSlot {
11
+ /** Exact row currently assigned to this recycled view. */
12
+ item: HistoireVirtualItem;
13
+ /** Current source-array position, independent from recycled view identity. */
14
+ index: number;
15
+ /** Inactive views render no controls or retained private row data. */
16
+ active: boolean;
17
+ }
18
+ /** List actions reveal keyboard targets before querying recycled row elements. */
19
+ export interface HistoireVirtualListHandle {
20
+ /** Read vertical offset of list's own scrolling viewport. */
21
+ getScrollTop: () => number | undefined;
22
+ /** Immediately show beginning without moving keyboard focus. */
23
+ scrollToTop: () => void;
24
+ /** Reveal exact current row; removed rows cannot acquire another row's focus. */
25
+ reveal: (key: string) => Promise<HTMLElement | undefined>;
26
+ /** Focus exact row's first native interactive control. */
27
+ focus: (key: string) => Promise<void>;
28
+ }
29
+ /** Shared SDK/app virtual scrolling surface; it never owns selection or data requests. */
30
+ export declare const HistoireVirtualList: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
31
+ /** Caller projections retain their exact keys and arbitrary row metadata. */
32
+ items: {
33
+ type: PropType<readonly HistoireVirtualItem[]>;
34
+ required: true;
35
+ };
36
+ /** Known row height uses cheap fixed-size recycling; omitted height is measured. */
37
+ itemSize: {
38
+ type: NumberConstructor;
39
+ default: undefined;
40
+ };
41
+ /** Measured lists reserve an estimated minimum height before discovery. */
42
+ minItemSize: {
43
+ type: NumberConstructor;
44
+ default: number;
45
+ };
46
+ /** Follow nearest scrolling parent for lists embedded beside other sections. */
47
+ pageMode: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
51
+ /** Preserve native list semantics where the calling surface uses them. */
52
+ listTag: {
53
+ type: StringConstructor;
54
+ default: string;
55
+ };
56
+ /** Host classes applied to the native list inside the scroller. */
57
+ listClass: {
58
+ type: StringConstructor;
59
+ default: undefined;
60
+ };
61
+ /** Native list item or generic tree presentation wrapper. */
62
+ itemTag: {
63
+ type: StringConstructor;
64
+ default: string;
65
+ };
66
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
67
+ [key: string]: any;
68
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
69
+ /** Caller projections retain their exact keys and arbitrary row metadata. */
70
+ items: {
71
+ type: PropType<readonly HistoireVirtualItem[]>;
72
+ required: true;
73
+ };
74
+ /** Known row height uses cheap fixed-size recycling; omitted height is measured. */
75
+ itemSize: {
76
+ type: NumberConstructor;
77
+ default: undefined;
78
+ };
79
+ /** Measured lists reserve an estimated minimum height before discovery. */
80
+ minItemSize: {
81
+ type: NumberConstructor;
82
+ default: number;
83
+ };
84
+ /** Follow nearest scrolling parent for lists embedded beside other sections. */
85
+ pageMode: {
86
+ type: BooleanConstructor;
87
+ default: boolean;
88
+ };
89
+ /** Preserve native list semantics where the calling surface uses them. */
90
+ listTag: {
91
+ type: StringConstructor;
92
+ default: string;
93
+ };
94
+ /** Host classes applied to the native list inside the scroller. */
95
+ listClass: {
96
+ type: StringConstructor;
97
+ default: undefined;
98
+ };
99
+ /** Native list item or generic tree presentation wrapper. */
100
+ itemTag: {
101
+ type: StringConstructor;
102
+ default: string;
103
+ };
104
+ }>> & Readonly<{}>, {
105
+ itemSize: number;
106
+ minItemSize: number;
107
+ pageMode: boolean;
108
+ listTag: string;
109
+ listClass: string;
110
+ itemTag: string;
111
+ }, SlotsType<{
112
+ default: (value: HistoireVirtualSlot) => VNodeChild;
113
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
114
+ //# sourceMappingURL=VirtualList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualList.d.ts","sourceRoot":"","sources":["../../src/foundation/VirtualList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAI1D,0EAA0E;AAC1E,MAAM,WAAW,mBAAmB;IAClC,+EAA+E;IAC/E,GAAG,EAAE,MAAM,CAAA;IACX,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,IAAI,EAAE,mBAAmB,CAAA;IACzB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAA;IACb,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAA;CAChB;AAYD,kFAAkF;AAClF,MAAM,WAAW,yBAAyB;IACxC,6DAA6D;IAC7D,YAAY,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IACtC,gEAAgE;IAChE,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,iFAAiF;IACjF,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAA;IACzD,0DAA0D;IAC1D,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACtC;AAED,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB;IAI5B,6EAA6E;;cACrD,QAAQ,CAAC,SAAS,mBAAmB,EAAE,CAAC;;;IAChE,oFAAoF;;QACxE,IAAI;QAAU,OAAO;;IACjC,2EAA2E;;QAC5D,IAAI;QAAU,OAAO;;IACpC,gFAAgF;;QACpE,IAAI;QAAW,OAAO;;IAClC,0EAA0E;;QAC/D,IAAI;QAAU,OAAO;;IAChC,mEAAmE;;QACtD,IAAI;QAAU,OAAO;;IAClC,6DAA6D;;QAClD,IAAI;QAAU,OAAO;;;;;IAbhC,6EAA6E;;;;;IAE7E,oFAAoF;;;;;IAEpF,2EAA2E;;;;;IAE3E,gFAAgF;;;;;IAEhF,0EAA0E;;;;;IAE1E,mEAAmE;;;;;IAEnE,6DAA6D;;;;;;;;;;;;;aAGzB,CAAC,KAAK,EAAE,mBAAmB,KAAK,UAAU;yEAiGhF,CAAA"}
@@ -0,0 +1,126 @@
1
+ import { defineComponent, h, nextTick, onBeforeUnmount, ref, watch } from 'vue';
2
+ import { DynamicScroller, DynamicScrollerItem, RecycleScroller } from 'vue-virtual-scroller';
3
+ /** Shared SDK/app virtual scrolling surface; it never owns selection or data requests. */
4
+ export const HistoireVirtualList = defineComponent({
5
+ name: 'HistoireVirtualList',
6
+ inheritAttrs: false,
7
+ props: {
8
+ /** Caller projections retain their exact keys and arbitrary row metadata. */
9
+ items: { type: Array, required: true },
10
+ /** Known row height uses cheap fixed-size recycling; omitted height is measured. */
11
+ itemSize: { type: Number, default: undefined },
12
+ /** Measured lists reserve an estimated minimum height before discovery. */
13
+ minItemSize: { type: Number, default: 40 },
14
+ /** Follow nearest scrolling parent for lists embedded beside other sections. */
15
+ pageMode: { type: Boolean, default: false },
16
+ /** Preserve native list semantics where the calling surface uses them. */
17
+ listTag: { type: String, default: 'div' },
18
+ /** Host classes applied to the native list inside the scroller. */
19
+ listClass: { type: String, default: undefined },
20
+ /** Native list item or generic tree presentation wrapper. */
21
+ itemTag: { type: String, default: 'div' },
22
+ },
23
+ slots: Object,
24
+ setup(props, { attrs, slots, expose }) {
25
+ const root = ref();
26
+ const scroller = ref();
27
+ let active = true;
28
+ let action = 0;
29
+ let pending;
30
+ /** Mounted-range updates and retirement release the current dynamic row waiter once. */
31
+ function wake() {
32
+ const resolve = pending;
33
+ pending = undefined;
34
+ resolve?.();
35
+ }
36
+ /** New navigation cancels any previous wait before taking ownership. */
37
+ function begin() {
38
+ wake();
39
+ return ++action;
40
+ }
41
+ onBeforeUnmount(() => {
42
+ active = false;
43
+ begin();
44
+ });
45
+ watch(() => props.items, wake, { flush: 'post' });
46
+ /** Native scroll events arrive later than Vue ticks; flush the library's public recycler. */
47
+ async function resolveRow(key, request) {
48
+ await nextTick();
49
+ if (!active || request !== action)
50
+ return;
51
+ const index = props.items.findIndex(item => item.key === key);
52
+ if (index < 0)
53
+ return;
54
+ const current = scroller.value;
55
+ current?.scrollToItem(index, { align: 'nearest' });
56
+ current?.updateVisibleItems?.(false, true);
57
+ await nextTick();
58
+ for (;;) {
59
+ if (!active || request !== action || !props.items.some(item => item.key === key))
60
+ return;
61
+ const row = Array.from(root.value?.querySelectorAll('[data-virtual-key]') ?? []).find(element => element.dataset.virtualKey === key);
62
+ if (row || props.itemSize !== undefined)
63
+ return row;
64
+ // DynamicScroller forwards the recycler's update event; never reset measured sizes.
65
+ await new Promise((resolve) => {
66
+ pending = resolve;
67
+ });
68
+ await nextTick();
69
+ }
70
+ }
71
+ /** Removed or superseded keyboard rows cannot acquire another view's focus. */
72
+ function reveal(key) {
73
+ return resolveRow(key, begin());
74
+ }
75
+ /** Recycled buttons cannot become an unintended target while moving focus. */
76
+ async function focus(key) {
77
+ const request = begin();
78
+ const row = await resolveRow(key, request);
79
+ if (active && request === action)
80
+ row?.querySelector('button:not(:disabled), [tabindex], a[href]')?.focus({ preventScroll: true });
81
+ }
82
+ /** Page-mode lists have no owned viewport; both native scrollers use their root. */
83
+ function getScrollTop() {
84
+ return props.pageMode ? undefined : root.value?.firstElementChild?.scrollTop;
85
+ }
86
+ /** Keep navigation inside library so measured and fixed lists share behavior. */
87
+ function scrollToTop() {
88
+ scroller.value?.scrollToPosition(0);
89
+ }
90
+ expose({ reveal, focus, getScrollTop, scrollToTop });
91
+ return () => {
92
+ const dynamic = props.itemSize === undefined;
93
+ return h('div', { ...attrs, ref: root, class: ['histoire-virtual-list', attrs.class, { 'histoire-virtual-list-page': props.pageMode }] }, [
94
+ h(dynamic ? DynamicScroller : RecycleScroller, {
95
+ ref: scroller,
96
+ // Pass caller array as-is (the library never mutates it): a copy would give the
97
+ // scroller a new identity on every render and trigger its items watcher (sync layout).
98
+ items: props.items,
99
+ keyField: 'key',
100
+ typeField: 'kind',
101
+ itemSize: props.itemSize,
102
+ minItemSize: props.minItemSize,
103
+ pageMode: props.pageMode,
104
+ // Flow keeps source order in DOM, including keyboard and screen-reader reading.
105
+ flowMode: true,
106
+ listTag: props.listTag,
107
+ listClass: props.listClass,
108
+ itemTag: props.itemTag,
109
+ buffer: 160,
110
+ prerender: 12,
111
+ emitUpdate: true,
112
+ onUpdate: wake,
113
+ }, {
114
+ default: (value) => {
115
+ // Retired pool slots cannot read a replacement publication by old index.
116
+ if (!value.active || props.items[value.index]?.key !== value.item.key)
117
+ return null;
118
+ // Keep configurable spacing inside the measured row so recycled positions include it.
119
+ const row = () => h('div', { 'key': value.item.key, 'data-virtual-key': value.item.key, 'style': { paddingBottom: 'var(--histoire-virtual-item-gap, 1px)' } }, [slots.default?.(value)]);
120
+ return dynamic ? h(DynamicScrollerItem, { item: value.item, active: value.active, index: value.index }, { default: row }) : row();
121
+ },
122
+ }),
123
+ ]);
124
+ };
125
+ },
126
+ });
@@ -0,0 +1,9 @@
1
+ /** Native dropdown with provider-owned teleport and no host plugin installation. */
2
+ export declare const HistoireDropdown: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
3
+ [key: string]: any;
4
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
5
+ /** Native tooltip with provider-owned teleport and no global configuration. */
6
+ export declare const HistoireTooltip: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
+ [key: string]: any;
8
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
+ //# sourceMappingURL=floating.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floating.d.ts","sourceRoot":"","sources":["../../src/foundation/floating.ts"],"names":[],"mappings":"AA4FA,oFAAoF;AACpF,eAAO,MAAM,gBAAgB;;2OAAoD,CAAA;AACjF,+EAA+E;AAC/E,eAAO,MAAM,eAAe;;2OAAkD,CAAA"}
@@ -0,0 +1,90 @@
1
+ import { Dropdown, Tooltip } from 'floating-vue';
2
+ import { defineComponent, h, mergeProps, nextTick, onMounted, shallowRef } from 'vue';
3
+ import { useHistoireContext, useHistoireResource } from '../provider/context.js';
4
+ /** Local FloatingVue component with teleport constrained to owning provider. */
5
+ function createLocalFloating(name, component) {
6
+ return defineComponent({
7
+ name,
8
+ inheritAttrs: false,
9
+ setup(_props, { attrs, slots, expose }) {
10
+ const context = useHistoireContext();
11
+ const floating = shallowRef(null);
12
+ let shown = false;
13
+ let active = true;
14
+ let visibilityVersion = 0;
15
+ let anchor;
16
+ let root = null;
17
+ expose({ onResize: () => floating.value?.onResize() });
18
+ /** Capture this trigger's keyboard origin, never a neighboring provider control. */
19
+ function onShow() {
20
+ shown = true;
21
+ visibilityVersion++;
22
+ const trigger = floating.value?.$el;
23
+ const focused = trigger?.ownerDocument.activeElement;
24
+ // Pointer activation in Firefox need not move focus. Fall back to
25
+ // this wrapper's own trigger rather than retaining another control.
26
+ anchor = focused && trigger?.contains(focused)
27
+ ? focused
28
+ : trigger?.querySelector('button, a[href], input, select, textarea, [tabindex]') ?? undefined;
29
+ }
30
+ /** Forget focus ownership once this overlay closes by click or lifecycle. */
31
+ function onHide() {
32
+ shown = false;
33
+ visibilityVersion++;
34
+ }
35
+ /** Vendor autofocus runs after animation frames even if hidden; own guarded focus instead. */
36
+ function onApplyShow() {
37
+ const optOut = attrs.noAutoFocus ?? attrs['no-auto-focus'];
38
+ if (optOut || optOut === '')
39
+ return;
40
+ const instance = floating.value;
41
+ const version = visibilityVersion;
42
+ void nextTick().then(() => {
43
+ if (!active || !shown || version !== visibilityVersion || floating.value !== instance)
44
+ return;
45
+ const trigger = instance?.$el;
46
+ const id = trigger?.getAttribute('aria-describedby') ?? trigger?.querySelector('[aria-describedby]')?.getAttribute('aria-describedby');
47
+ if (!id)
48
+ return;
49
+ // Exact scoped ID avoids host collisions and keeps default tooltip
50
+ // behavior: without autoHide its popper has no focusable tabindex.
51
+ const popper = Array.from(root?.querySelectorAll('[id]') ?? []).find(element => element.id === id);
52
+ if (popper?.isConnected)
53
+ popper.focus();
54
+ }).catch(context.reportError);
55
+ }
56
+ /** Escape never reaches another provider or unrelated host shortcuts. */
57
+ function onKeydown(event) {
58
+ if (!shown || event.key !== 'Escape')
59
+ return;
60
+ event.preventDefault();
61
+ event.stopPropagation();
62
+ floating.value?.hide({ skipDelay: true });
63
+ if (anchor?.isConnected)
64
+ anchor.focus();
65
+ }
66
+ onMounted(() => {
67
+ root = context.root.value;
68
+ root?.addEventListener('keydown', onKeydown);
69
+ });
70
+ useHistoireResource(() => {
71
+ active = false;
72
+ shown = false;
73
+ visibilityVersion++;
74
+ root?.removeEventListener('keydown', onKeydown);
75
+ });
76
+ return () => h(component, mergeProps(attrs, {
77
+ ref: floating,
78
+ container: context.overlay.value ?? false,
79
+ onShow,
80
+ onHide,
81
+ onApplyShow,
82
+ noAutoFocus: true,
83
+ }), slots);
84
+ },
85
+ });
86
+ }
87
+ /** Native dropdown with provider-owned teleport and no host plugin installation. */
88
+ export const HistoireDropdown = createLocalFloating('HistoireDropdown', Dropdown);
89
+ /** Native tooltip with provider-owned teleport and no global configuration. */
90
+ export const HistoireTooltip = createLocalFloating('HistoireTooltip', Tooltip);
@@ -0,0 +1,13 @@
1
+ import type { PropType, VNodeChild } from 'vue';
2
+ /** Optional host classes keyed by a component's documented element names. */
3
+ export type HistoirePartClasses<Part extends string> = Partial<Record<Part, string>>;
4
+ /** Typed optional prop shared by native render-function components. */
5
+ export declare function partClassesProp<Part extends string>(): {
6
+ type: PropType<HistoirePartClasses<Part>>;
7
+ default: undefined;
8
+ };
9
+ /** Keep package marker classes first and append caller utilities without dropping either. */
10
+ export declare function mergePartClass(defaultClass: string, customClass?: string): string;
11
+ /** Opt-in state layout wrapper; default slot DOM stays unchanged without host classes. */
12
+ export declare function renderPartState(content: VNodeChild, className?: string): VNodeChild;
13
+ //# sourceMappingURL=parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../../src/foundation/parts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAG/C,6EAA6E;AAC7E,MAAM,MAAM,mBAAmB,CAAC,IAAI,SAAS,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;AAEpF,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,IAAI,SAAS,MAAM;IACxC,IAAI,EAAY,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAAE,OAAO;EACtE;AAED,6FAA6F;AAC7F,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED,0FAA0F;AAC1F,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAEnF"}
@@ -0,0 +1,13 @@
1
+ import { h } from 'vue';
2
+ /** Typed optional prop shared by native render-function components. */
3
+ export function partClassesProp() {
4
+ return { type: Object, default: undefined };
5
+ }
6
+ /** Keep package marker classes first and append caller utilities without dropping either. */
7
+ export function mergePartClass(defaultClass, customClass) {
8
+ return customClass ? `${defaultClass} ${customClass}`.trim() : defaultClass;
9
+ }
10
+ /** Opt-in state layout wrapper; default slot DOM stays unchanged without host classes. */
11
+ export function renderPartState(content, className) {
12
+ return className ? h('div', { class: className }, [content]) : content;
13
+ }