@histoire/vue 0.0.0-stage → 1.0.0-beta.3

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 +47 -0
  45. package/dist/components/embed/HistoireEmbed.d.ts.map +1 -0
  46. package/dist/components/embed/HistoireEmbed.js +83 -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 +23 -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 +27 -0
  90. package/dist/components/preview/surface.d.ts.map +1 -0
  91. package/dist/components/preview/surface.js +133 -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,66 @@
1
+ import { BuiltinIcon, createPropOverridePatch, HstButton, HstButtonGroup } from '@histoire/controls/vue';
2
+ import { getHistoireFiniteMatrixValues } from '@histoire/protocol';
3
+ import { defineComponent, h } from 'vue';
4
+ import { useHistoireSnapshot } from '../../composables/snapshot.js';
5
+ import { useHistoireContext } from '../../provider/context.js';
6
+ import { useHistoireControlEdit } from './edit.js';
7
+ import { renderHistoireControl } from './editor.js';
8
+ /** Automatic props use same editor mapping and retain runtime-owned definitions. */
9
+ export const PropControl = defineComponent({
10
+ name: 'HistoirePropControl',
11
+ props: { index: { type: Number, required: true }, definition: { type: Object, required: true } },
12
+ setup(props) {
13
+ const context = useHistoireContext();
14
+ const snapshot = useHistoireSnapshot();
15
+ const edit = useHistoireControlEdit(snapshot, () => {
16
+ const state = snapshot.value.state?.value;
17
+ const overrides = state?._hPropState?.[props.index];
18
+ return overrides && Object.hasOwn(overrides, props.definition.name) ? overrides[props.definition.name] : props.definition.value;
19
+ });
20
+ /** Deleting one override restores runtime default without rewriting definitions. */
21
+ function patch(value, remove = false) {
22
+ const { index, definition } = props;
23
+ edit.set(remove ? definition.value : value, async () => {
24
+ const state = context.session.getSnapshot().state?.value;
25
+ if (state)
26
+ await context.session.state.patch(createPropOverridePatch(state, index, definition.name, value, remove));
27
+ }, remove);
28
+ }
29
+ return () => {
30
+ const state = snapshot.value.state?.value;
31
+ const overrides = state?._hPropState?.[props.index];
32
+ const present = !!overrides && Object.hasOwn(overrides, props.definition.name);
33
+ const control = {
34
+ 'class': 'histoire-prop-control',
35
+ 'title': `${props.definition.name}${present ? ' *' : ''}`,
36
+ 'aria-label': props.definition.name,
37
+ 'data-histoire-control-type': props.definition.types?.join(' | ') || 'unknown',
38
+ 'modelValue': edit.value.value,
39
+ 'placeholder': present ? undefined : props.definition.default,
40
+ 'onUpdate:modelValue': patch,
41
+ };
42
+ const slots = {
43
+ 'label-actions': () => h(HstButton, { 'color': 'flat', 'type': 'button', 'class': 'histoire-prop-control-reset', 'iconOnly': true, 'disabled': !present, 'aria-label': `Remove ${props.definition.name} override`, 'onClick': () => patch(undefined, true) }, {
44
+ default: () => h(BuiltinIcon, { icon: 'carbon:reset', width: 16, height: 16, class: 'histoire-prop-control-reset-icon' }),
45
+ }),
46
+ };
47
+ const values = getHistoireFiniteMatrixValues(props.definition.values ?? props.definition.enum);
48
+ if (values?.length) {
49
+ const selected = values.findIndex(value => value === edit.value.value);
50
+ // String option tokens retain exact typed scalars in runtime-owned patches.
51
+ return h(HstButtonGroup, {
52
+ ...control,
53
+ 'class': 'histoire-prop-control histoire-prop-control-finite',
54
+ 'modelValue': selected < 0 ? undefined : String(selected),
55
+ 'options': values.map((value, index) => ({ value: String(index), label: typeof value === 'string' && values.some(other => typeof other !== 'string' && String(other) === value) ? JSON.stringify(value) : String(value) })),
56
+ 'onUpdate:modelValue': (token) => {
57
+ const index = values.findIndex((_value, index) => String(index) === token);
58
+ if (index !== -1)
59
+ patch(values[index]);
60
+ },
61
+ }, slots);
62
+ }
63
+ return renderHistoireControl(props.definition.types?.[0], control, slots);
64
+ };
65
+ },
66
+ });
@@ -0,0 +1,15 @@
1
+ /** Native editor changes cleaned mirror through canonical session patch. */
2
+ export declare const StateControl: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ field: {
4
+ type: StringConstructor;
5
+ required: true;
6
+ };
7
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
8
+ [key: string]: any;
9
+ }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
10
+ field: {
11
+ type: StringConstructor;
12
+ required: true;
13
+ };
14
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
15
+ //# sourceMappingURL=StateControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StateControl.d.ts","sourceRoot":"","sources":["../../../src/components/controls/StateControl.ts"],"names":[],"mappings":"AAMA,4EAA4E;AAC5E,eAAO,MAAM,YAAY;;;;;;;;;;;;iGAsBvB,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { defineComponent } from 'vue';
2
+ import { useHistoireSnapshot } from '../../composables/snapshot.js';
3
+ import { useHistoireContext } from '../../provider/context.js';
4
+ import { useHistoireControlEdit } from './edit.js';
5
+ import { renderHistoireControl } from './editor.js';
6
+ /** Native editor changes cleaned mirror through canonical session patch. */
7
+ export const StateControl = defineComponent({
8
+ name: 'HistoireStateControl',
9
+ props: { field: { type: String, required: true } },
10
+ setup(props) {
11
+ const context = useHistoireContext();
12
+ const snapshot = useHistoireSnapshot();
13
+ const edit = useHistoireControlEdit(snapshot, () => snapshot.value.state?.value?.[props.field]);
14
+ return () => {
15
+ const state = snapshot.value.state?.value;
16
+ if (!state || !Object.hasOwn(state, props.field))
17
+ return null;
18
+ return renderHistoireControl(typeof state[props.field], {
19
+ 'class': 'histoire-state-control',
20
+ 'title': props.field,
21
+ 'data-histoire-control-type': typeof state[props.field],
22
+ 'modelValue': edit.value.value,
23
+ 'onUpdate:modelValue': (value) => {
24
+ const field = props.field;
25
+ edit.set(value, () => context.session.state.patch({ [field]: value }));
26
+ },
27
+ });
28
+ };
29
+ },
30
+ });
@@ -0,0 +1,37 @@
1
+ /** Preset-owner action exposed to adjacent controls without duplicating selection state. */
2
+ export interface HistoireStatePresetsHandle {
3
+ /** Whether a list or preset command currently owns the state controls. */
4
+ busy: () => boolean;
5
+ /** Reset runtime state and synchronize the selected preset when still current. */
6
+ reset: () => Promise<boolean>;
7
+ }
8
+ /** Memory-only runtime-owned presets; host receives opaque IDs and labels only. */
9
+ export declare const StatePresets: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
10
+ /** Host utilities for documented component parts; package markers remain intact. */
11
+ classes: {
12
+ type: import("vue").PropType<Partial<Record<"root" | "trigger", string>>>;
13
+ default: undefined;
14
+ };
15
+ /** First-party inspector prefixes select choices with their preset context. */
16
+ compact: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
21
+ [key: string]: any;
22
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ /** Host utilities for documented component parts; package markers remain intact. */
24
+ classes: {
25
+ type: import("vue").PropType<Partial<Record<"root" | "trigger", string>>>;
26
+ default: undefined;
27
+ };
28
+ /** First-party inspector prefixes select choices with their preset context. */
29
+ compact: {
30
+ type: BooleanConstructor;
31
+ default: boolean;
32
+ };
33
+ }>> & Readonly<{}>, {
34
+ classes: Partial<Record<"root" | "trigger", string>>;
35
+ compact: boolean;
36
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
37
+ //# sourceMappingURL=StatePresets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatePresets.d.ts","sourceRoot":"","sources":["../../../src/components/controls/StatePresets.ts"],"names":[],"mappings":"AASA,4FAA4F;AAC5F,MAAM,WAAW,0BAA0B;IACzC,0EAA0E;IAC1E,IAAI,EAAE,MAAM,OAAO,CAAA;IACnB,kFAAkF;IAClF,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9B;AAED,mFAAmF;AACnF,eAAO,MAAM,YAAY;IAGrB,oFAAoF;;;;;IAEpF,+EAA+E;;QACpE,IAAI;QAAW,OAAO;;;;;IAHjC,oFAAoF;;;;;IAEpF,+EAA+E;;;;;;;;4EAyFjF,CAAA"}
@@ -0,0 +1,105 @@
1
+ import { HstSelect } from '@histoire/controls/vue';
2
+ import { requestHistoireStatePreset } from '@histoire/sdk/internal';
3
+ import { defineComponent, h, shallowRef, watch } from 'vue';
4
+ import { useHistoireSnapshot } from '../../composables/snapshot.js';
5
+ import { mergePartClass, partClassesProp } from '../../foundation/parts.js';
6
+ import { useHistoireContext, useHistoireResource } from '../../provider/context.js';
7
+ import { PresetMenu } from './PresetMenu.js';
8
+ /** Memory-only runtime-owned presets; host receives opaque IDs and labels only. */
9
+ export const StatePresets = defineComponent({
10
+ name: 'HistoireStatePresets',
11
+ props: {
12
+ /** Host utilities for documented component parts; package markers remain intact. */
13
+ classes: partClassesProp(),
14
+ /** First-party inspector prefixes select choices with their preset context. */
15
+ compact: { type: Boolean, default: false },
16
+ },
17
+ setup(props, { expose }) {
18
+ const context = useHistoireContext();
19
+ const snapshot = useHistoireSnapshot();
20
+ const items = shallowRef([]);
21
+ const selected = shallowRef('');
22
+ const pending = shallowRef(false);
23
+ let generation = 0;
24
+ let operationGeneration = 0;
25
+ let documentIdentity = '';
26
+ let active = true;
27
+ /** Source publication retires commands while surviving document presets remain valid. */
28
+ function owner() {
29
+ const value = snapshot.value;
30
+ return JSON.stringify([value.status, value.stale, value.source, value.selection, value.runtime.mountId, value.runtime.runtimeId, value.runtime.status]);
31
+ }
32
+ /** Captured source and document own operation, error and selection publication. */
33
+ async function action(input) {
34
+ if (pending.value)
35
+ return false;
36
+ const token = operationGeneration;
37
+ pending.value = true;
38
+ try {
39
+ let result;
40
+ if (input.action === 'reset') {
41
+ await context.session.state.reset();
42
+ result = { items: items.value };
43
+ }
44
+ else {
45
+ result = await requestHistoireStatePreset(context.session, input);
46
+ }
47
+ if (!active || operationGeneration !== token) {
48
+ return false;
49
+ }
50
+ items.value = result.items;
51
+ if (result.selectedId) {
52
+ selected.value = result.selectedId;
53
+ }
54
+ else if (input.action === 'apply') {
55
+ selected.value = input.id;
56
+ }
57
+ if (input.action === 'delete' || input.action === 'reset') {
58
+ selected.value = '';
59
+ }
60
+ return true;
61
+ }
62
+ catch (error) {
63
+ if (active && operationGeneration === token) {
64
+ context.reportError(error);
65
+ }
66
+ return false;
67
+ }
68
+ finally {
69
+ if (active && operationGeneration === token)
70
+ pending.value = false;
71
+ }
72
+ }
73
+ watch(owner, () => {
74
+ operationGeneration++;
75
+ pending.value = false;
76
+ const value = snapshot.value;
77
+ const identity = JSON.stringify([value.source?.sourceId, value.source?.epoch, value.runtime.runtimeId, value.runtime.status, value.selection]);
78
+ if (identity !== documentIdentity) {
79
+ documentIdentity = identity;
80
+ generation++;
81
+ items.value = [];
82
+ selected.value = '';
83
+ }
84
+ // An unrelated story HMR can retire a pending list request. Refresh the
85
+ // surviving runtime's list without clearing its existing choices/draft.
86
+ if (value.status === 'ready' && !value.stale && value.runtime.status === 'ready') {
87
+ void action({ action: 'list' });
88
+ }
89
+ }, { immediate: true, flush: 'sync' });
90
+ useHistoireResource(() => {
91
+ active = false;
92
+ generation++;
93
+ operationGeneration++;
94
+ });
95
+ // External Reset state must pass through this owner so preset selection
96
+ // cannot survive a successful runtime reset as stale menu state.
97
+ expose({ busy: () => pending.value, reset: () => action({ action: 'reset' }) });
98
+ return () => h('div', { class: [mergePartClass('histoire-state-presets', props.classes?.root), props.compact ? 'histoire-state-presets-compact' : ''] }, [
99
+ h(HstSelect, { 'layout': 'inline', 'aria-label': 'State preset', 'modelValue': selected.value, 'disabled': pending.value, 'options': [{ value: '', label: props.compact ? 'Preset: Initial state' : 'Initial state' }, ...items.value.map(item => ({ value: item.id, label: props.compact ? `Preset: ${item.label}` : item.label }))], 'onUpdate:modelValue': (id) => {
100
+ void action(id ? { action: 'apply', id } : { action: 'reset' });
101
+ } }),
102
+ h(PresetMenu, { key: generation, selectedId: selected.value, selectedLabel: items.value.find(item => item.id === selected.value)?.label, disabled: pending.value, action, classes: { trigger: props.classes?.trigger } }),
103
+ ]);
104
+ },
105
+ });
@@ -0,0 +1,10 @@
1
+ import type { HistoireSession } from '@histoire/sdk';
2
+ import type { ShallowRef } from 'vue';
3
+ /** Each editor retains newest local intent while source acknowledgments publish earlier values. */
4
+ export declare function useHistoireControlEdit(snapshot: Readonly<ShallowRef<ReturnType<HistoireSession['getSnapshot']>>>, read: () => unknown): {
5
+ /** Runtime projection resumes only after latest local edit is acknowledged. */
6
+ value: import("vue").ComputedRef<unknown>;
7
+ /** Coalesce intermediate keystrokes without losing final user intent. */
8
+ set(value: unknown, write: () => Promise<unknown>, force?: boolean): void;
9
+ };
10
+ //# sourceMappingURL=edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../src/components/controls/edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAiBrC,mGAAmG;AACnG,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO;IAgDlI,+EAA+E;IAC/E,KAAK;IACL,yEAAyE;IACzE,GAAG,QAAQ,OAAO,SAAS,MAAM,OAAO,CAAC,OAAO,CAAC,oBAAkB,IAAI;EAO1E"}
@@ -0,0 +1,82 @@
1
+ import { computed, shallowRef, watch } from 'vue';
2
+ import { useHistoireContext, useHistoireResource } from '../../provider/context.js';
3
+ /** Native editors share ordered patches so sibling automatic props retain each other's edits. */
4
+ const queues = new WeakMap();
5
+ /** JSON editor initialization and incoming projections are not fresh user mutations. */
6
+ function sameValue(value, current) {
7
+ if (Object.is(value, current))
8
+ return true;
9
+ if (!value || !current || typeof value !== 'object' || typeof current !== 'object')
10
+ return false;
11
+ try {
12
+ return JSON.stringify(value) === JSON.stringify(current);
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ }
18
+ /** Each editor retains newest local intent while source acknowledgments publish earlier values. */
19
+ export function useHistoireControlEdit(snapshot, read) {
20
+ const context = useHistoireContext();
21
+ const draft = shallowRef(null);
22
+ let active = true;
23
+ let pending = false;
24
+ let queued = null;
25
+ /** Target and source changes revoke queued edits even if field name is reused. */
26
+ function owner() {
27
+ const value = snapshot.value;
28
+ return JSON.stringify([value.source, value.selection, value.runtime.runtimeId]);
29
+ }
30
+ /** Join sibling edits, recomputing patches from latest accepted mirror at admission. */
31
+ async function flush() {
32
+ if (pending)
33
+ return;
34
+ pending = true;
35
+ try {
36
+ while (queued) {
37
+ if (!active)
38
+ break;
39
+ const edit = queued;
40
+ queued = null;
41
+ const operation = (queues.get(context.session) ?? Promise.resolve()).catch(() => { }).then(() => {
42
+ if (active && edit.owner === owner())
43
+ return edit.write();
44
+ });
45
+ queues.set(context.session, operation);
46
+ try {
47
+ await operation;
48
+ }
49
+ catch (error) {
50
+ if (active && edit.owner === owner())
51
+ context.reportError(error);
52
+ }
53
+ if (active && edit.owner === owner() && !queued)
54
+ draft.value = null;
55
+ }
56
+ }
57
+ finally {
58
+ pending = false;
59
+ }
60
+ }
61
+ watch(owner, () => {
62
+ queued = null;
63
+ draft.value = null;
64
+ }, { flush: 'sync' });
65
+ useHistoireResource(() => {
66
+ active = false;
67
+ queued = null;
68
+ draft.value = null;
69
+ });
70
+ return {
71
+ /** Runtime projection resumes only after latest local edit is acknowledged. */
72
+ value: computed(() => draft.value ? draft.value.value : read()),
73
+ /** Coalesce intermediate keystrokes without losing final user intent. */
74
+ set(value, write, force = false) {
75
+ if (!active || (!force && sameValue(value, draft.value ? draft.value.value : read())))
76
+ return;
77
+ draft.value = { value };
78
+ queued = { owner: owner(), write };
79
+ void flush();
80
+ },
81
+ };
82
+ }
@@ -0,0 +1,9 @@
1
+ import type { VNode } from 'vue';
2
+ /**
3
+ * JSON editors cannot round-trip every cloneable state graph. Never rewrite
4
+ * unsupported values into strings or omit fields to make them editable.
5
+ */
6
+ export declare function renderHistoireControl(type: string | undefined, props: Record<string, unknown>, slots?: {
7
+ 'label-actions'?: () => VNode;
8
+ }): VNode;
9
+ //# sourceMappingURL=editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../src/components/controls/editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAKhC;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,MAAM,KAAK,CAAA;CAAE,GAAG,KAAK,CAuBhJ"}
@@ -0,0 +1,28 @@
1
+ import { getControlComponent, HstJson } from '@histoire/controls/vue';
2
+ import { HISTOIRE_WIRE_LIMITS, measureWireValue } from '@histoire/protocol';
3
+ import { h, toRaw } from 'vue';
4
+ /**
5
+ * JSON editors cannot round-trip every cloneable state graph. Never rewrite
6
+ * unsupported values into strings or omit fields to make them editable.
7
+ */
8
+ export function renderHistoireControl(type, props, slots) {
9
+ const component = getControlComponent(type);
10
+ if (component === HstJson && props.modelValue !== undefined) {
11
+ try {
12
+ measureWireValue(toRaw(props.modelValue), { mode: 'json', maxBytes: HISTOIRE_WIRE_LIMITS.state });
13
+ }
14
+ catch {
15
+ const hasLabelActions = !!slots?.['label-actions'];
16
+ const label = [h('span', { class: 'histoire-control-title' }, String(props.title ?? ''))];
17
+ if (hasLabelActions) {
18
+ label.push(h('span', { class: 'histoire-control-label-actions' }, slots?.['label-actions']?.()), h('span', { class: 'histoire-control-type' }, String(props['data-histoire-control-type'] ?? 'unknown')));
19
+ }
20
+ return h('div', { 'role': 'group', 'class': hasLabelActions ? [props.class, 'histoire-prop-control-unavailable'] : undefined, 'aria-label': props['aria-label'] ?? props.title }, [
21
+ h('span', { class: 'histoire-control-label' }, label),
22
+ h('output', 'JSON editing unavailable'),
23
+ ]);
24
+ }
25
+ }
26
+ // Source-derived values are presentation; editing remains an explicit runtime patch.
27
+ return h(component, props, slots);
28
+ }
@@ -0,0 +1,44 @@
1
+ import type { PropType } from 'vue';
2
+ /** Independent data-only documentation; no host story import or host router dependency. */
3
+ export declare const HistoireDocs: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ /** Host utilities for documented component parts; package markers remain intact. */
5
+ classes: {
6
+ type: PropType<Partial<Record<"root", string>>>;
7
+ default: undefined;
8
+ };
9
+ anchor: {
10
+ type: StringConstructor;
11
+ default: string;
12
+ };
13
+ /** Embedded docs open book links without changing the scoped session. */
14
+ storyLinkBehavior: {
15
+ type: PropType<'select' | 'open'>;
16
+ default: string;
17
+ };
18
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
19
+ [key: string]: any;
20
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("anchor" | "content" | "error")[], "anchor" | "content" | "error", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
21
+ /** Host utilities for documented component parts; package markers remain intact. */
22
+ classes: {
23
+ type: PropType<Partial<Record<"root", string>>>;
24
+ default: undefined;
25
+ };
26
+ anchor: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ /** Embedded docs open book links without changing the scoped session. */
31
+ storyLinkBehavior: {
32
+ type: PropType<'select' | 'open'>;
33
+ default: string;
34
+ };
35
+ }>> & Readonly<{
36
+ onAnchor?: ((...args: any[]) => any) | undefined;
37
+ onContent?: ((...args: any[]) => any) | undefined;
38
+ onError?: ((...args: any[]) => any) | undefined;
39
+ }>, {
40
+ classes: Partial<Record<"root", string>>;
41
+ anchor: string;
42
+ storyLinkBehavior: "open" | "select";
43
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
44
+ //# sourceMappingURL=HistoireDocs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HistoireDocs.d.ts","sourceRoot":"","sources":["../../../src/components/docs/HistoireDocs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAanC,2FAA2F;AAC3F,eAAO,MAAM,YAAY;IAGrB,oFAAoF;;;;;;QAE1E,IAAI;QAAU,OAAO;;IAC/B,yEAAyE;;QACpD,IAAI,EAAY,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAAC;QAAE,OAAO;;;;;IAJzE,oFAAoF;;;;;;;;;IAGpF,yEAAyE;;;;;;;;;;;;;4EAgG3E,CAAA"}
@@ -0,0 +1,124 @@
1
+ import { HistoireSdkError, isStoryRouteHash } from '@histoire/protocol';
2
+ import { getAcceptedHistoireSessionDescriptor, getHistoireDocsPolicy, selectHistoireStoryLink } from '@histoire/sdk/internal';
3
+ import { defineComponent, h, nextTick, onMounted, shallowRef, watch } from 'vue';
4
+ import { createHistoireContentController } from '../../content/controller.js';
5
+ import { mergePartClass, partClassesProp } from '../../foundation/parts.js';
6
+ import { useHistoireContext, useHistoireResource } from '../../provider/context.js';
7
+ import { scrollDocsAnchor } from './anchors.js';
8
+ import { prepareHistoireDocs } from './content.js';
9
+ import { getDocsStoryHref, resolveDocsStoryLink } from './links.js';
10
+ /** Independent data-only documentation; no host story import or host router dependency. */
11
+ export const HistoireDocs = defineComponent({
12
+ name: 'HistoireDocs',
13
+ props: {
14
+ /** Host utilities for documented component parts; package markers remain intact. */
15
+ classes: partClassesProp(),
16
+ anchor: { type: String, default: '' },
17
+ /** Embedded docs open book links without changing the scoped session. */
18
+ storyLinkBehavior: { type: String, default: 'select' },
19
+ },
20
+ emits: ['content', 'error', 'anchor'],
21
+ setup(props, { emit, expose }) {
22
+ const context = useHistoireContext();
23
+ const { session } = context;
24
+ const root = shallowRef(null);
25
+ const state = shallowRef({ status: 'idle', value: null, error: null });
26
+ let pendingAnchor;
27
+ let navigation = 0;
28
+ let active = true;
29
+ /** A deferred link/anchor never gains authority over replacement selection or source. */
30
+ function anchorIsCurrent() {
31
+ const value = session.getSnapshot();
32
+ return active && pendingAnchor && value.status === 'ready' && !value.stale && value.selection?.storyId === pendingAnchor.storyId && value.selection.variantId === pendingAnchor.variantId && value.source?.sourceId === pendingAnchor.sourceId && value.source.epoch === pendingAnchor.epoch && value.source.revision === pendingAnchor.revision;
33
+ }
34
+ useHistoireResource(session.subscribe(() => {
35
+ if (pendingAnchor && !anchorIsCurrent())
36
+ pendingAnchor = undefined;
37
+ }));
38
+ const controller = createHistoireContentController(session, () => {
39
+ const value = session.getSnapshot();
40
+ return [value.status, value.stale, value.source?.epoch, value.source?.revision, value.selection?.storyId];
41
+ }, async () => {
42
+ const snapshot = session.getSnapshot();
43
+ if (!snapshot.selection || !root.value || !snapshot.source)
44
+ return null;
45
+ const document = root.value.ownerDocument;
46
+ return prepareHistoireDocs(await session.docs.get(snapshot.selection.storyId), snapshot.source.url, document, getHistoireDocsPolicy(session));
47
+ }, (value) => {
48
+ state.value = value;
49
+ if (value.status === 'ready')
50
+ emit('content', value.value.content);
51
+ if (value.status === 'error')
52
+ emit('error', value.error);
53
+ });
54
+ useHistoireResource(() => {
55
+ active = false;
56
+ navigation++;
57
+ controller.close();
58
+ });
59
+ expose({ refresh: controller.refresh });
60
+ onMounted(() => void controller.start());
61
+ watch(() => [state.value.value, props.anchor, context.panels.docs.value?.anchor], async () => {
62
+ await nextTick();
63
+ if (root.value && state.value.status === 'ready') {
64
+ scrollDocsAnchor(root.value, anchorIsCurrent() ? pendingAnchor.hash : props.anchor || context.panels.docs.value?.anchor || '');
65
+ pendingAnchor = undefined;
66
+ }
67
+ });
68
+ /** Known story links route through same controller; local anchors never touch host URL. */
69
+ function click(event) {
70
+ if (!active || event.button || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey)
71
+ return;
72
+ const link = event.target?.closest('a');
73
+ if (!link || !root.value?.contains(link))
74
+ return;
75
+ const href = link.getAttribute('href');
76
+ if (!href)
77
+ return;
78
+ if (href.startsWith('#') && !isStoryRouteHash(href)) {
79
+ event.preventDefault();
80
+ if (scrollDocsAnchor(root.value, href))
81
+ emit('anchor', href);
82
+ return;
83
+ }
84
+ const snapshot = session.getSnapshot();
85
+ const target = snapshot.source && resolveDocsStoryLink(href, snapshot.source.url, snapshot.catalog.stories, link.getAttribute('data-histoire-story-path'));
86
+ if (!target && !link.hasAttribute('data-route'))
87
+ return;
88
+ event.preventDefault();
89
+ if (!target) {
90
+ emit('error', new HistoireSdkError('STORY_NOT_FOUND', 'Documentation story link unavailable'));
91
+ return;
92
+ }
93
+ if (props.storyLinkBehavior === 'open') {
94
+ const mode = getAcceptedHistoireSessionDescriptor(session).config?.routerMode;
95
+ root.value.ownerDocument.defaultView?.open(getDocsStoryHref(target, snapshot.source.url, mode), '_blank', 'noopener,noreferrer');
96
+ return;
97
+ }
98
+ const current = ++navigation;
99
+ void selectHistoireStoryLink(session, target).then(async () => {
100
+ const selected = session.getSnapshot();
101
+ if (!active || current !== navigation || selected.status !== 'ready' || selected.stale || selected.selection?.storyId !== target.selection.storyId || (target.selection.variantId !== undefined && selected.selection.variantId !== target.selection.variantId) || selected.source?.sourceId !== snapshot.source?.sourceId || selected.source?.epoch !== snapshot.source?.epoch || selected.source?.revision !== snapshot.source?.revision)
102
+ return;
103
+ const anchor = { hash: target.anchor ?? '', storyId: selected.selection.storyId, variantId: selected.selection.variantId, sourceId: selected.source.sourceId, epoch: selected.source.epoch, revision: selected.source.revision };
104
+ pendingAnchor = anchor;
105
+ await nextTick();
106
+ if (active && pendingAnchor === anchor && anchorIsCurrent() && root.value && state.value.status === 'ready' && state.value.value?.content.storyId === anchor.storyId) {
107
+ scrollDocsAnchor(root.value, anchor.hash);
108
+ pendingAnchor = undefined;
109
+ }
110
+ }).catch((error) => {
111
+ const selected = session.getSnapshot();
112
+ if (active && current === navigation && selected.source?.sourceId === snapshot.source?.sourceId && selected.source?.epoch === snapshot.source?.epoch && selected.source?.revision === snapshot.source?.revision)
113
+ emit('error', error);
114
+ });
115
+ }
116
+ return () => {
117
+ const value = state.value.value;
118
+ return h('section', { 'ref': root, 'class': mergePartClass('histoire-docs', props.classes?.root), 'aria-label': 'Histoire documentation', 'aria-busy': state.value.status === 'loading', 'onClick': click }, [
119
+ state.value.error ? h('p', { role: 'alert' }, state.value.error.message ?? String(state.value.error)) : null,
120
+ value ? (value.html === null ? h('pre', value.content.body) : h('div', { innerHTML: value.html })) : null,
121
+ ]);
122
+ };
123
+ },
124
+ });
@@ -0,0 +1,3 @@
1
+ /** Find exact ID within panel only; avoid selector injection and host document anchors. */
2
+ export declare function scrollDocsAnchor(root: Element, hash: string): boolean;
3
+ //# sourceMappingURL=anchors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchors.d.ts","sourceRoot":"","sources":["../../../src/components/docs/anchors.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAmBrE"}
@@ -0,0 +1,26 @@
1
+ /** Find exact ID within panel only; avoid selector injection and host document anchors. */
2
+ export function scrollDocsAnchor(root, hash) {
3
+ let id;
4
+ try {
5
+ id = decodeURIComponent(hash.replace(/^#/, ''));
6
+ }
7
+ catch {
8
+ return false;
9
+ }
10
+ if (!id)
11
+ return false;
12
+ const target = Array.from(root.querySelectorAll('[id]')).find(element => element.id === id);
13
+ if (!target)
14
+ return false;
15
+ // scrollIntoView would also scroll host ancestors. Move this panel alone.
16
+ // Standalone docs page can own the scroll area surrounding renderer. Native
17
+ // docs panels keep their own scroll owner unless host marks one explicitly.
18
+ const panel = (root.closest('[data-histoire-docs-scroll]') ?? root);
19
+ const bounds = panel.getBoundingClientRect();
20
+ const scale = panel.offsetHeight > 0 && Number.isFinite(bounds.height) && bounds.height > 0 ? bounds.height / panel.offsetHeight : 1;
21
+ const delta = (target.getBoundingClientRect().top - bounds.top) / scale - panel.clientTop;
22
+ if (!Number.isFinite(delta))
23
+ return false;
24
+ panel.scrollTop += delta;
25
+ return true;
26
+ }
@@ -0,0 +1,11 @@
1
+ import type { HistoireDocsContent } from '@histoire/protocol';
2
+ /** Prepared remote HTML accompanies original data, never replaces portable DTO contract. */
3
+ export interface HistoirePreparedDocs {
4
+ /** Captured source body/provenance. */
5
+ content: HistoireDocsContent;
6
+ /** Final sanitized HTML, or null for safely rendered plain text. */
7
+ html: string | null;
8
+ }
9
+ /** Native remote policy always sanitizes; legacy trusted-local renderer remains standalone adapter. */
10
+ export declare function prepareHistoireDocs(content: HistoireDocsContent, base: string, document: Document, policy?: 'remote' | 'trusted-local'): Promise<HistoirePreparedDocs>;
11
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/components/docs/content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAI7D,4FAA4F;AAC5F,MAAM,WAAW,oBAAoB;IACnC,uCAAuC;IACvC,OAAO,EAAE,mBAAmB,CAAA;IAC5B,oEAAoE;IACpE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB;AAED,uGAAuG;AACvG,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAE,QAAQ,GAAG,eAA0B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAGtL"}
@@ -0,0 +1,7 @@
1
+ import { normalizeDocsLinks } from './links.js';
2
+ import { sanitizeDocsHtml } from './sanitize.js';
3
+ /** Native remote policy always sanitizes; legacy trusted-local renderer remains standalone adapter. */
4
+ export async function prepareHistoireDocs(content, base, document, policy = 'remote') {
5
+ const html = content.format === 'text' ? null : normalizeDocsLinks(content.body, base, document);
6
+ return { content, html: html === null || policy === 'trusted-local' ? html : await sanitizeDocsHtml(html, document) };
7
+ }