@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.
- package/LICENSE +21 -0
- package/dist/components/controls/GenericControls.d.ts +30 -0
- package/dist/components/controls/GenericControls.d.ts.map +1 -0
- package/dist/components/controls/GenericControls.js +34 -0
- package/dist/components/controls/HistoireControls.d.ts +30 -0
- package/dist/components/controls/HistoireControls.d.ts.map +1 -0
- package/dist/components/controls/HistoireControls.js +176 -0
- package/dist/components/controls/PresetMenu.d.ts +63 -0
- package/dist/components/controls/PresetMenu.d.ts.map +1 -0
- package/dist/components/controls/PresetMenu.js +180 -0
- package/dist/components/controls/PropControl.d.ts +40 -0
- package/dist/components/controls/PropControl.d.ts.map +1 -0
- package/dist/components/controls/PropControl.js +66 -0
- package/dist/components/controls/StateControl.d.ts +15 -0
- package/dist/components/controls/StateControl.d.ts.map +1 -0
- package/dist/components/controls/StateControl.js +30 -0
- package/dist/components/controls/StatePresets.d.ts +37 -0
- package/dist/components/controls/StatePresets.d.ts.map +1 -0
- package/dist/components/controls/StatePresets.js +105 -0
- package/dist/components/controls/edit.d.ts +10 -0
- package/dist/components/controls/edit.d.ts.map +1 -0
- package/dist/components/controls/edit.js +82 -0
- package/dist/components/controls/editor.d.ts +9 -0
- package/dist/components/controls/editor.d.ts.map +1 -0
- package/dist/components/controls/editor.js +28 -0
- package/dist/components/docs/HistoireDocs.d.ts +44 -0
- package/dist/components/docs/HistoireDocs.d.ts.map +1 -0
- package/dist/components/docs/HistoireDocs.js +124 -0
- package/dist/components/docs/anchors.d.ts +3 -0
- package/dist/components/docs/anchors.d.ts.map +1 -0
- package/dist/components/docs/anchors.js +26 -0
- package/dist/components/docs/content.d.ts +11 -0
- package/dist/components/docs/content.d.ts.map +1 -0
- package/dist/components/docs/content.js +7 -0
- package/dist/components/docs/links.d.ts +20 -0
- package/dist/components/docs/links.d.ts.map +1 -0
- package/dist/components/docs/links.js +85 -0
- package/dist/components/docs/sanitize.d.ts +3 -0
- package/dist/components/docs/sanitize.d.ts.map +1 -0
- package/dist/components/docs/sanitize.js +16 -0
- package/dist/components/embed/EmbedPanels.d.ts +21 -0
- package/dist/components/embed/EmbedPanels.d.ts.map +1 -0
- package/dist/components/embed/EmbedPanels.js +49 -0
- package/dist/components/embed/HistoireEmbed.d.ts +47 -0
- package/dist/components/embed/HistoireEmbed.d.ts.map +1 -0
- package/dist/components/embed/HistoireEmbed.js +83 -0
- package/dist/components/embed/geometry.d.ts +5 -0
- package/dist/components/embed/geometry.d.ts.map +1 -0
- package/dist/components/embed/geometry.js +38 -0
- package/dist/components/events/HistoireEvents.d.ts +30 -0
- package/dist/components/events/HistoireEvents.d.ts.map +1 -0
- package/dist/components/events/HistoireEvents.js +88 -0
- package/dist/components/explorer/ExplorerNavigation.d.ts +20 -0
- package/dist/components/explorer/ExplorerNavigation.d.ts.map +1 -0
- package/dist/components/explorer/ExplorerNavigation.js +15 -0
- package/dist/components/explorer/ExplorerPanels.d.ts +42 -0
- package/dist/components/explorer/ExplorerPanels.d.ts.map +1 -0
- package/dist/components/explorer/ExplorerPanels.js +87 -0
- package/dist/components/explorer/ExplorerPreview.d.ts +29 -0
- package/dist/components/explorer/ExplorerPreview.d.ts.map +1 -0
- package/dist/components/explorer/ExplorerPreview.js +93 -0
- package/dist/components/explorer/HistoireExplorer.d.ts +47 -0
- package/dist/components/explorer/HistoireExplorer.d.ts.map +1 -0
- package/dist/components/explorer/HistoireExplorer.js +41 -0
- package/dist/components/explorer/panel-tabs.d.ts +48 -0
- package/dist/components/explorer/panel-tabs.d.ts.map +1 -0
- package/dist/components/explorer/panel-tabs.js +58 -0
- package/dist/components/extensions/HistoireExtensionOutlet.d.ts +47 -0
- package/dist/components/extensions/HistoireExtensionOutlet.d.ts.map +1 -0
- package/dist/components/extensions/HistoireExtensionOutlet.js +35 -0
- package/dist/components/extensions/HistoireExtensionView.d.ts +59 -0
- package/dist/components/extensions/HistoireExtensionView.d.ts.map +1 -0
- package/dist/components/extensions/HistoireExtensionView.js +58 -0
- package/dist/components/extensions/panel-action.d.ts +38 -0
- package/dist/components/extensions/panel-action.d.ts.map +1 -0
- package/dist/components/extensions/panel-action.js +19 -0
- package/dist/components/extensions/state-renderer.d.ts +17 -0
- package/dist/components/extensions/state-renderer.d.ts.map +1 -0
- package/dist/components/extensions/state-renderer.js +72 -0
- package/dist/components/extensions/view-lifecycle.d.ts +47 -0
- package/dist/components/extensions/view-lifecycle.d.ts.map +1 -0
- package/dist/components/extensions/view-lifecycle.js +108 -0
- package/dist/components/extensions/workbench-components.d.ts +9 -0
- package/dist/components/extensions/workbench-components.d.ts.map +1 -0
- package/dist/components/extensions/workbench-components.js +82 -0
- package/dist/components/preview/HistoirePreview.d.ts +23 -0
- package/dist/components/preview/HistoirePreview.d.ts.map +1 -0
- package/dist/components/preview/HistoirePreview.js +3 -0
- package/dist/components/preview/surface.d.ts +27 -0
- package/dist/components/preview/surface.d.ts.map +1 -0
- package/dist/components/preview/surface.js +133 -0
- package/dist/components/search/HistoireSearch.d.ts +9 -0
- package/dist/components/search/HistoireSearch.d.ts.map +1 -0
- package/dist/components/search/HistoireSearch.js +66 -0
- package/dist/components/source/HistoireSource.d.ts +58 -0
- package/dist/components/source/HistoireSource.d.ts.map +1 -0
- package/dist/components/source/HistoireSource.js +85 -0
- package/dist/components/source/content.d.ts +11 -0
- package/dist/components/source/content.d.ts.map +1 -0
- package/dist/components/source/content.js +7 -0
- package/dist/components/source/highlight.d.ts +3 -0
- package/dist/components/source/highlight.d.ts.map +1 -0
- package/dist/components/source/highlight.js +15 -0
- package/dist/components/source/render.d.ts +6 -0
- package/dist/components/source/render.d.ts.map +1 -0
- package/dist/components/source/render.js +11 -0
- package/dist/components/tests/HistoireTests.d.ts +66 -0
- package/dist/components/tests/HistoireTests.d.ts.map +1 -0
- package/dist/components/tests/HistoireTests.js +109 -0
- package/dist/components/tests/TestsRunActions.d.ts +54 -0
- package/dist/components/tests/TestsRunActions.d.ts.map +1 -0
- package/dist/components/tests/TestsRunActions.js +138 -0
- package/dist/components/tests/render.d.ts +33 -0
- package/dist/components/tests/render.d.ts.map +1 -0
- package/dist/components/tests/render.js +103 -0
- package/dist/components/toolbar/HistoireToolbar.d.ts +7 -0
- package/dist/components/toolbar/HistoireToolbar.d.ts.map +1 -0
- package/dist/components/toolbar/HistoireToolbar.js +66 -0
- package/dist/components/toolbar/ToolbarExtensions.d.ts +27 -0
- package/dist/components/toolbar/ToolbarExtensions.d.ts.map +1 -0
- package/dist/components/toolbar/ToolbarExtensions.js +79 -0
- package/dist/components/toolbar/groups.d.ts +19 -0
- package/dist/components/toolbar/groups.d.ts.map +1 -0
- package/dist/components/toolbar/groups.js +18 -0
- package/dist/components/tree/HistoireStoryTree.d.ts +40 -0
- package/dist/components/tree/HistoireStoryTree.d.ts.map +1 -0
- package/dist/components/tree/HistoireStoryTree.js +57 -0
- package/dist/composables/session.d.ts +4 -0
- package/dist/composables/session.d.ts.map +1 -0
- package/dist/composables/session.js +5 -0
- package/dist/composables/snapshot.d.ts +5 -0
- package/dist/composables/snapshot.d.ts.map +1 -0
- package/dist/composables/snapshot.js +9 -0
- package/dist/content/controller.d.ts +20 -0
- package/dist/content/controller.d.ts.map +1 -0
- package/dist/content/controller.js +54 -0
- package/dist/content.css +22 -0
- package/dist/controls.css +26 -0
- package/dist/embed.css +15 -0
- package/dist/explorer.css +67 -0
- package/dist/extensions.css +20 -0
- package/dist/foundation/VirtualList.d.ts +114 -0
- package/dist/foundation/VirtualList.d.ts.map +1 -0
- package/dist/foundation/VirtualList.js +126 -0
- package/dist/foundation/floating.d.ts +9 -0
- package/dist/foundation/floating.d.ts.map +1 -0
- package/dist/foundation/floating.js +90 -0
- package/dist/foundation/parts.d.ts +13 -0
- package/dist/foundation/parts.d.ts.map +1 -0
- package/dist/foundation/parts.js +13 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/internal.d.ts +31 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +26 -0
- package/dist/navigation.css +51 -0
- package/dist/overlays/OverlayHost.d.ts +21 -0
- package/dist/overlays/OverlayHost.d.ts.map +1 -0
- package/dist/overlays/OverlayHost.js +118 -0
- package/dist/overlays/geometry.d.ts +4 -0
- package/dist/overlays/geometry.d.ts.map +1 -0
- package/dist/overlays/geometry.js +7 -0
- package/dist/overlays/menu-bounds.d.ts +10 -0
- package/dist/overlays/menu-bounds.d.ts.map +1 -0
- package/dist/overlays/menu-bounds.js +52 -0
- package/dist/provider/HistoireProvider.d.ts +43 -0
- package/dist/provider/HistoireProvider.d.ts.map +1 -0
- package/dist/provider/HistoireProvider.js +183 -0
- package/dist/provider/context.d.ts +37 -0
- package/dist/provider/context.d.ts.map +1 -0
- package/dist/provider/context.js +16 -0
- package/dist/provider/extensions.d.ts +61 -0
- package/dist/provider/extensions.d.ts.map +1 -0
- package/dist/provider/extensions.js +139 -0
- package/dist/provider/panels.d.ts +33 -0
- package/dist/provider/panels.d.ts.map +1 -0
- package/dist/provider/panels.js +53 -0
- package/dist/provider/plugin-shortcuts.d.ts +22 -0
- package/dist/provider/plugin-shortcuts.d.ts.map +1 -0
- package/dist/provider/plugin-shortcuts.js +73 -0
- package/dist/provider/shortcuts.d.ts +16 -0
- package/dist/provider/shortcuts.d.ts.map +1 -0
- package/dist/provider/shortcuts.js +62 -0
- package/dist/provider/theme.d.ts +4 -0
- package/dist/provider/theme.d.ts.map +1 -0
- package/dist/provider/theme.js +25 -0
- package/dist/search/navigation.d.ts +27 -0
- package/dist/search/navigation.d.ts.map +1 -0
- package/dist/search/navigation.js +61 -0
- package/dist/style.css +88 -0
- package/dist/tests/collector.d.ts +16 -0
- package/dist/tests/collector.d.ts.map +1 -0
- package/dist/tests/collector.js +51 -0
- package/dist/tests/controller.d.ts +28 -0
- package/dist/tests/controller.d.ts.map +1 -0
- package/dist/tests/controller.js +79 -0
- package/dist/tests/model.d.ts +20 -0
- package/dist/tests/model.d.ts.map +1 -0
- package/dist/tests/model.js +18 -0
- package/dist/tests.css +59 -0
- package/dist/virtual-list.css +6 -0
- package/package.json +58 -3
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Guillaume Chau
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Render generic state and auto props from readonly runtime projection only. */
|
|
2
|
+
export declare const GenericControls: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
/** Host utilities for documented component parts; package markers remain intact. */
|
|
4
|
+
classes: {
|
|
5
|
+
type: import("vue").PropType<Partial<Record<"fieldset" | "legend", string>>>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
/** Include generic state fields when no custom controls were provided. */
|
|
9
|
+
showState: {
|
|
10
|
+
type: BooleanConstructor;
|
|
11
|
+
default: boolean;
|
|
12
|
+
};
|
|
13
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
/** Host utilities for documented component parts; package markers remain intact. */
|
|
17
|
+
classes: {
|
|
18
|
+
type: import("vue").PropType<Partial<Record<"fieldset" | "legend", string>>>;
|
|
19
|
+
default: undefined;
|
|
20
|
+
};
|
|
21
|
+
/** Include generic state fields when no custom controls were provided. */
|
|
22
|
+
showState: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
26
|
+
}>> & Readonly<{}>, {
|
|
27
|
+
classes: Partial<Record<"fieldset" | "legend", string>>;
|
|
28
|
+
showState: boolean;
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
30
|
+
//# sourceMappingURL=GenericControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericControls.d.ts","sourceRoot":"","sources":["../../../src/components/controls/GenericControls.ts"],"names":[],"mappings":"AAOA,iFAAiF;AACjF,eAAO,MAAM,eAAe;IAGxB,oFAAoF;;;;;IAEpF,0EAA0E;;QAC7D,IAAI;QAAW,OAAO;;;;;IAHnC,oFAAoF;;;;;IAEpF,0EAA0E;;;;;;;;4EAoB5E,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getControlStateKeys } from '@histoire/controls/vue';
|
|
2
|
+
import { defineComponent, h } from 'vue';
|
|
3
|
+
import { useHistoireSnapshot } from '../../composables/snapshot.js';
|
|
4
|
+
import { partClassesProp } from '../../foundation/parts.js';
|
|
5
|
+
import { PropControl } from './PropControl.js';
|
|
6
|
+
import { StateControl } from './StateControl.js';
|
|
7
|
+
/** Render generic state and auto props from readonly runtime projection only. */
|
|
8
|
+
export const GenericControls = defineComponent({
|
|
9
|
+
name: 'HistoireGenericControls',
|
|
10
|
+
props: {
|
|
11
|
+
/** Host utilities for documented component parts; package markers remain intact. */
|
|
12
|
+
classes: partClassesProp(),
|
|
13
|
+
/** Include generic state fields when no custom controls were provided. */
|
|
14
|
+
showState: { type: Boolean, default: true },
|
|
15
|
+
},
|
|
16
|
+
setup(props) {
|
|
17
|
+
const snapshot = useHistoireSnapshot();
|
|
18
|
+
return () => {
|
|
19
|
+
const state = snapshot.value.state?.value;
|
|
20
|
+
if (!state)
|
|
21
|
+
return null;
|
|
22
|
+
const definitions = Array.isArray(state._hPropDefs) ? state._hPropDefs : [];
|
|
23
|
+
return h('div', { class: 'histoire-generic-controls' }, [
|
|
24
|
+
...(props.showState ? getControlStateKeys(state).map(field => h(StateControl, { key: field, field })) : []),
|
|
25
|
+
...definitions.map(component => component && typeof component === 'object' && typeof component.index === 'number' && Array.isArray(component.props)
|
|
26
|
+
? h('fieldset', { key: component.index, class: props.classes?.fieldset }, [
|
|
27
|
+
h('legend', { class: props.classes?.legend }, String(component.name ?? 'Component')),
|
|
28
|
+
...component.props.filter((prop) => prop && typeof prop.name === 'string').map((definition) => h(PropControl, { key: definition.name, index: component.index, definition })),
|
|
29
|
+
])
|
|
30
|
+
: null),
|
|
31
|
+
]);
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Native generic editors and explicit source-owned custom-controls replica. */
|
|
2
|
+
export declare const HistoireControls: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
/** Host utilities for documented component parts; package markers remain intact. */
|
|
4
|
+
classes: {
|
|
5
|
+
type: import("vue").PropType<Partial<Record<"fieldset" | "legend" | "presetTrigger" | "presets" | "reset" | "root" | "state", string>>>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
/** First-party compact inspector keeps preset management behind disclosure. */
|
|
9
|
+
compactPresets: {
|
|
10
|
+
type: BooleanConstructor;
|
|
11
|
+
default: boolean;
|
|
12
|
+
};
|
|
13
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
/** Host utilities for documented component parts; package markers remain intact. */
|
|
17
|
+
classes: {
|
|
18
|
+
type: import("vue").PropType<Partial<Record<"fieldset" | "legend" | "presetTrigger" | "presets" | "reset" | "root" | "state", string>>>;
|
|
19
|
+
default: undefined;
|
|
20
|
+
};
|
|
21
|
+
/** First-party compact inspector keeps preset management behind disclosure. */
|
|
22
|
+
compactPresets: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
26
|
+
}>> & Readonly<{}>, {
|
|
27
|
+
classes: Partial<Record<"fieldset" | "legend" | "presetTrigger" | "presets" | "reset" | "root" | "state", string>>;
|
|
28
|
+
compactPresets: boolean;
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
30
|
+
//# sourceMappingURL=HistoireControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoireControls.d.ts","sourceRoot":"","sources":["../../../src/components/controls/HistoireControls.ts"],"names":[],"mappings":"AAYA,gFAAgF;AAChF,eAAO,MAAM,gBAAgB;IAGzB,oFAAoF;;;;;IAEpF,+EAA+E;;QAC7D,IAAI;QAAW,OAAO;;;;;IAHxC,oFAAoF;;;;;IAEpF,+EAA+E;;;;;;;;4EA8JjF,CAAA"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { BuiltinIcon, HstButton, LoadingDelayBoundary, restoreControlsFocus, useLoadingDelay } from '@histoire/controls/vue';
|
|
2
|
+
import { configureHistoireMountControls, postHistoireMountEvent, subscribeHistoireMountEvents } from '@histoire/sdk/internal';
|
|
3
|
+
import { defineComponent, h, onMounted, shallowRef, watch } from 'vue';
|
|
4
|
+
import { useHistoireSnapshot } from '../../composables/snapshot.js';
|
|
5
|
+
import { mergePartClass, partClassesProp, renderPartState } from '../../foundation/parts.js';
|
|
6
|
+
import { HistoireControlsOverlayHost } from '../../overlays/OverlayHost.js';
|
|
7
|
+
import { useHistoireContext, useHistoireResource } from '../../provider/context.js';
|
|
8
|
+
import { GenericControls } from './GenericControls.js';
|
|
9
|
+
import { StatePresets } from './StatePresets.js';
|
|
10
|
+
/** Native generic editors and explicit source-owned custom-controls replica. */
|
|
11
|
+
export const HistoireControls = defineComponent({
|
|
12
|
+
name: 'HistoireControls',
|
|
13
|
+
props: {
|
|
14
|
+
/** Host utilities for documented component parts; package markers remain intact. */
|
|
15
|
+
classes: partClassesProp(),
|
|
16
|
+
/** First-party compact inspector keeps preset management behind disclosure. */
|
|
17
|
+
compactPresets: { type: Boolean, default: false },
|
|
18
|
+
},
|
|
19
|
+
setup(props, { slots }) {
|
|
20
|
+
const context = useHistoireContext();
|
|
21
|
+
const snapshot = useHistoireSnapshot();
|
|
22
|
+
const container = shallowRef(null);
|
|
23
|
+
const overlay = shallowRef(null);
|
|
24
|
+
const presets = shallowRef(null);
|
|
25
|
+
const hasControls = shallowRef();
|
|
26
|
+
const failure = shallowRef(null);
|
|
27
|
+
let mount;
|
|
28
|
+
let off = () => {
|
|
29
|
+
};
|
|
30
|
+
let client = false;
|
|
31
|
+
let removed = false;
|
|
32
|
+
let closing = Promise.resolve();
|
|
33
|
+
/** Teardown invalidates UI immediately; stale focus/height cannot reach replacement. */
|
|
34
|
+
function unmount() {
|
|
35
|
+
const current = mount;
|
|
36
|
+
mount = undefined;
|
|
37
|
+
overlay.value = null;
|
|
38
|
+
hasControls.value = undefined;
|
|
39
|
+
failure.value = null;
|
|
40
|
+
off();
|
|
41
|
+
off = () => {
|
|
42
|
+
};
|
|
43
|
+
if (current) {
|
|
44
|
+
closing = current.unmount().catch(context.reportError);
|
|
45
|
+
}
|
|
46
|
+
return closing;
|
|
47
|
+
}
|
|
48
|
+
/** Only active menu may resolve local opaque choice. */
|
|
49
|
+
function result(id, value) {
|
|
50
|
+
if (!mount || overlay.value?.id !== id) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
overlay.value = null;
|
|
54
|
+
postHistoireMountEvent(mount, 'overlay.result', { id, ...value });
|
|
55
|
+
}
|
|
56
|
+
/** SDK internal seam already validates port/source/canonical document ownership. */
|
|
57
|
+
function receive(event) {
|
|
58
|
+
const value = event.payload;
|
|
59
|
+
if (event.event === 'overlay.close') {
|
|
60
|
+
if (overlay.value?.id === value.id) {
|
|
61
|
+
overlay.value = null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (event.event === 'overlay.open' || event.event === 'overlay.update') {
|
|
65
|
+
if (event.event === 'overlay.update' && overlay.value?.id !== value.id)
|
|
66
|
+
return;
|
|
67
|
+
overlay.value = { ...value, type: '__histoire:controls-overlay', storyId: event.target.storyId, variantId: event.target.variantId };
|
|
68
|
+
}
|
|
69
|
+
else if (event.event === 'controls.height') {
|
|
70
|
+
if (typeof value.hasControls === 'boolean') {
|
|
71
|
+
hasControls.value = value.hasControls;
|
|
72
|
+
}
|
|
73
|
+
const iframe = container.value?.querySelector('iframe');
|
|
74
|
+
if (iframe) {
|
|
75
|
+
iframe.style.height = `${hasControls.value ? value.height : 0}px`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else if (event.event === 'focus.changed' && value.direction) {
|
|
79
|
+
restoreControlsFocus(container.value?.querySelector('iframe') ?? null, { restoreFocus: true, focusDirection: value.direction });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Primary loss is unavailable, never an invitation to create hidden runtime. */
|
|
83
|
+
async function reconcile() {
|
|
84
|
+
const current = snapshot.value;
|
|
85
|
+
if (current.runtime.status !== 'ready' || !current.selection?.variantId) {
|
|
86
|
+
await unmount();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!client || removed || mount || !container.value) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
await closing;
|
|
93
|
+
if (removed || snapshot.value.runtime.runtimeId !== current.runtime.runtimeId || mount) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
mount = context.session.mount(container.value, { surface: 'controls' });
|
|
98
|
+
configureHistoireMountControls(mount, true);
|
|
99
|
+
off = subscribeHistoireMountEvents(mount, receive);
|
|
100
|
+
const owned = mount;
|
|
101
|
+
// Readiness belongs to this child mount and captured primary document.
|
|
102
|
+
// Navigation/unmount observes rejection without reporting stale failure.
|
|
103
|
+
void owned.ready.catch(async (error) => {
|
|
104
|
+
if (removed || mount !== owned || snapshot.value.runtime.runtimeId !== current.runtime.runtimeId) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
context.reportError(error);
|
|
108
|
+
await unmount();
|
|
109
|
+
if (!removed && snapshot.value.runtime.runtimeId === current.runtime.runtimeId) {
|
|
110
|
+
hasControls.value = false;
|
|
111
|
+
failure.value = error;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
if (removed || snapshot.value.runtime.runtimeId !== current.runtime.runtimeId)
|
|
117
|
+
return;
|
|
118
|
+
context.reportError(error);
|
|
119
|
+
// Configuration/subscription may fail after a child was acquired.
|
|
120
|
+
// Join its teardown before Retry can acquire another replica.
|
|
121
|
+
await unmount();
|
|
122
|
+
if (!removed && snapshot.value.runtime.runtimeId === current.runtime.runtimeId) {
|
|
123
|
+
hasControls.value = false;
|
|
124
|
+
failure.value = error;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
watch([() => snapshot.value.runtime.runtimeId, () => snapshot.value.runtime.status, () => snapshot.value.selection?.storyId, () => snapshot.value.selection?.variantId], () => {
|
|
129
|
+
overlay.value = null;
|
|
130
|
+
failure.value = null;
|
|
131
|
+
void reconcile();
|
|
132
|
+
}, { flush: 'sync' });
|
|
133
|
+
onMounted(() => {
|
|
134
|
+
client = true;
|
|
135
|
+
void reconcile();
|
|
136
|
+
});
|
|
137
|
+
useHistoireResource(() => {
|
|
138
|
+
removed = true;
|
|
139
|
+
return unmount();
|
|
140
|
+
});
|
|
141
|
+
const loadingVisible = useLoadingDelay(() => snapshot.value.runtime.status === 'ready' && !!snapshot.value.selection?.variantId && hasControls.value === undefined && !failure.value, () => snapshot.value.runtime.runtimeId);
|
|
142
|
+
return () => h('section', { 'class': mergePartClass('histoire-controls', props.classes?.root), 'aria-label': 'Controls', 'aria-busy': snapshot.value.runtime.status === 'ready' && hasControls.value === undefined }, [
|
|
143
|
+
snapshot.value.runtime.status !== 'ready' || !snapshot.value.selection?.variantId
|
|
144
|
+
? renderPartState(slots.unavailable?.() ?? h('div', { role: 'status' }, 'Variant unavailable'), props.classes?.state)
|
|
145
|
+
: h('div', { class: 'histoire-controls-presets' }, [
|
|
146
|
+
h(StatePresets, { ref: presets, compact: props.compactPresets, classes: { root: props.classes?.presets, trigger: props.classes?.presetTrigger } }),
|
|
147
|
+
h(HstButton, { 'color': 'flat', 'type': 'button', 'class': mergePartClass('histoire-controls-reset', props.classes?.reset), 'iconOnly': true, 'aria-label': 'Reset state', 'title': 'Reset state', 'disabled': !presets.value || presets.value.busy(), 'onClick': () => {
|
|
148
|
+
void presets.value?.reset();
|
|
149
|
+
} }, { default: () => h(BuiltinIcon, { 'icon': 'carbon:reset', 'width': 16, 'height': 16, 'aria-hidden': 'true' }) }),
|
|
150
|
+
]),
|
|
151
|
+
// Keep custom controls before detected props in Story Inspector and Explorer.
|
|
152
|
+
// Unknown availability keeps this frame visible long enough for runtime readiness.
|
|
153
|
+
h('div', { 'ref': container, 'class': 'histoire-custom-controls', 'data-test-id': 'story-controls-sandbox', 'style': hasControls.value === undefined
|
|
154
|
+
? { position: 'fixed', left: '0', top: '0', opacity: 0, pointerEvents: 'none', width: `${context.root.value ? context.size.value.width : 420}px`, height: '32px', zIndex: -2147483647 }
|
|
155
|
+
: { visibility: hasControls.value ? 'visible' : 'hidden', height: hasControls.value ? 'auto' : '1px' } }),
|
|
156
|
+
failure.value
|
|
157
|
+
? h('div', { class: 'histoire-controls-failure' }, [
|
|
158
|
+
h('p', { role: 'alert' }, `Custom controls unavailable: ${failure.value?.message ?? String(failure.value)}`),
|
|
159
|
+
h(HstButton, { color: 'flat', type: 'button', onClick: () => {
|
|
160
|
+
failure.value = null;
|
|
161
|
+
hasControls.value = undefined;
|
|
162
|
+
void reconcile();
|
|
163
|
+
} }, { default: () => 'Retry controls' }),
|
|
164
|
+
])
|
|
165
|
+
: null,
|
|
166
|
+
// Unknown availability cannot decide between detected state and authored
|
|
167
|
+
// controls. Wait for this document's controls.height publication.
|
|
168
|
+
snapshot.value.runtime.status === 'ready' && snapshot.value.selection?.variantId
|
|
169
|
+
? hasControls.value === undefined
|
|
170
|
+
? loadingVisible.value ? h(LoadingDelayBoundary, null, () => renderPartState(slots.loading?.() ?? h('div', { role: 'status' }, 'Loading controls'), props.classes?.state)) : null
|
|
171
|
+
: h(GenericControls, { showState: hasControls.value === false, classes: props.classes })
|
|
172
|
+
: null,
|
|
173
|
+
overlay.value ? h(HistoireControlsOverlayHost, { key: overlay.value.id, request: overlay.value, onResult: result }) : null,
|
|
174
|
+
]);
|
|
175
|
+
},
|
|
176
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { HistoirePresetAction } from '@histoire/sdk/internal';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
/** Preset editing stays inside the provider-owned dropdown, beside its select. */
|
|
4
|
+
export declare const PresetMenu: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
/** Host utilities for documented component parts; package markers remain intact. */
|
|
6
|
+
classes: {
|
|
7
|
+
type: PropType<Partial<Record<"trigger", string>>>;
|
|
8
|
+
default: undefined;
|
|
9
|
+
};
|
|
10
|
+
/** Opaque runtime ID; initial state intentionally has no saved preset actions. */
|
|
11
|
+
selectedId: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
15
|
+
/** Current saved label, used only to seed a rename draft. */
|
|
16
|
+
selectedLabel: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
/** Runtime operation in flight disables opening another management action. */
|
|
21
|
+
disabled: {
|
|
22
|
+
type: BooleanConstructor;
|
|
23
|
+
default: boolean;
|
|
24
|
+
};
|
|
25
|
+
/** Parent retains document ownership and reports runtime errors. */
|
|
26
|
+
action: {
|
|
27
|
+
type: PropType<(input: HistoirePresetAction) => Promise<boolean>>;
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
|
+
/** Host utilities for documented component parts; package markers remain intact. */
|
|
34
|
+
classes: {
|
|
35
|
+
type: PropType<Partial<Record<"trigger", string>>>;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
/** Opaque runtime ID; initial state intentionally has no saved preset actions. */
|
|
39
|
+
selectedId: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
required: true;
|
|
42
|
+
};
|
|
43
|
+
/** Current saved label, used only to seed a rename draft. */
|
|
44
|
+
selectedLabel: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
/** Runtime operation in flight disables opening another management action. */
|
|
49
|
+
disabled: {
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
default: boolean;
|
|
52
|
+
};
|
|
53
|
+
/** Parent retains document ownership and reports runtime errors. */
|
|
54
|
+
action: {
|
|
55
|
+
type: PropType<(input: HistoirePresetAction) => Promise<boolean>>;
|
|
56
|
+
required: true;
|
|
57
|
+
};
|
|
58
|
+
}>> & Readonly<{}>, {
|
|
59
|
+
classes: Partial<Record<"trigger", string>>;
|
|
60
|
+
selectedLabel: string;
|
|
61
|
+
disabled: boolean;
|
|
62
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
63
|
+
//# sourceMappingURL=PresetMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresetMenu.d.ts","sourceRoot":"","sources":["../../../src/components/controls/PresetMenu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAOnC,kFAAkF;AAClF,eAAO,MAAM,UAAU;IAGnB,oFAAoF;;;;;IAEpF,kFAAkF;;;;;IAElF,6DAA6D;;QAC5C,IAAI;QAAU,OAAO;;IACtC,8EAA8E;;QAClE,IAAI;QAAW,OAAO;;IAClC,oEAAoE;;cACxC,QAAQ,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;;;;;;IATvF,oFAAoF;;;;;IAEpF,kFAAkF;;;;;IAElF,6DAA6D;;;;;IAE7D,8EAA8E;;;;;IAE9E,oEAAoE;;;;;;;;;4EAqJtE,CAAA"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { getControlElement, HstButton, HstText, restoreControlsFocus } from '@histoire/controls/vue';
|
|
2
|
+
import { defineComponent, h, nextTick, shallowRef } from 'vue';
|
|
3
|
+
import { HistoireDropdown } from '../../foundation/floating.js';
|
|
4
|
+
import { mergePartClass, partClassesProp } from '../../foundation/parts.js';
|
|
5
|
+
import { useHistoireResource } from '../../provider/context.js';
|
|
6
|
+
/** Preset editing stays inside the provider-owned dropdown, beside its select. */
|
|
7
|
+
export const PresetMenu = defineComponent({
|
|
8
|
+
name: 'HistoirePresetMenu',
|
|
9
|
+
props: {
|
|
10
|
+
/** Host utilities for documented component parts; package markers remain intact. */
|
|
11
|
+
classes: partClassesProp(),
|
|
12
|
+
/** Opaque runtime ID; initial state intentionally has no saved preset actions. */
|
|
13
|
+
selectedId: { type: String, required: true },
|
|
14
|
+
/** Current saved label, used only to seed a rename draft. */
|
|
15
|
+
selectedLabel: { type: String, default: '' },
|
|
16
|
+
/** Runtime operation in flight disables opening another management action. */
|
|
17
|
+
disabled: { type: Boolean, default: false },
|
|
18
|
+
/** Parent retains document ownership and reports runtime errors. */
|
|
19
|
+
action: { type: Function, required: true },
|
|
20
|
+
},
|
|
21
|
+
setup(props) {
|
|
22
|
+
const trigger = shallowRef(null);
|
|
23
|
+
const content = shallowRef(null);
|
|
24
|
+
const shown = shallowRef(false);
|
|
25
|
+
const mode = shallowRef('actions');
|
|
26
|
+
const label = shallowRef('');
|
|
27
|
+
const busy = shallowRef(false);
|
|
28
|
+
let active = true;
|
|
29
|
+
let focusVersion = 0;
|
|
30
|
+
let openLast = false;
|
|
31
|
+
let visible = false;
|
|
32
|
+
/** Guard delayed focus against closed or retired dropdown content. */
|
|
33
|
+
async function focusContent() {
|
|
34
|
+
const version = ++focusVersion;
|
|
35
|
+
await nextTick();
|
|
36
|
+
if (!active || !shown.value || focusVersion !== version)
|
|
37
|
+
return;
|
|
38
|
+
const input = content.value?.querySelector('input');
|
|
39
|
+
const actions = content.value?.querySelectorAll('[role="menuitem"]:not(:disabled)');
|
|
40
|
+
const target = input ?? actions?.[openLast ? actions.length - 1 : 0];
|
|
41
|
+
target?.focus();
|
|
42
|
+
input?.select();
|
|
43
|
+
openLast = false;
|
|
44
|
+
}
|
|
45
|
+
/** Only an explicit dismissal restores this dropdown's trigger focus. */
|
|
46
|
+
function close(restore = false) {
|
|
47
|
+
const wasShown = shown.value;
|
|
48
|
+
shown.value = false;
|
|
49
|
+
focusVersion++;
|
|
50
|
+
if (restore && wasShown && trigger.value?.isConnected)
|
|
51
|
+
trigger.value.focus();
|
|
52
|
+
}
|
|
53
|
+
/** A new opening starts at actions, never a stale name draft. */
|
|
54
|
+
function open(last = false) {
|
|
55
|
+
if (props.disabled)
|
|
56
|
+
return;
|
|
57
|
+
mode.value = 'actions';
|
|
58
|
+
label.value = '';
|
|
59
|
+
openLast = last;
|
|
60
|
+
shown.value = true;
|
|
61
|
+
// Reopening during the vendor's hide delay reuses an already visible
|
|
62
|
+
// popper, so no second apply-show event will restore menu focus.
|
|
63
|
+
if (visible)
|
|
64
|
+
void focusContent();
|
|
65
|
+
}
|
|
66
|
+
/** Reveal a name field only for actions that need one. */
|
|
67
|
+
function edit(next) {
|
|
68
|
+
mode.value = next;
|
|
69
|
+
label.value = next === 'rename' ? props.selectedLabel : '';
|
|
70
|
+
void focusContent();
|
|
71
|
+
}
|
|
72
|
+
/** Acknowledge before closing; retired requests cannot publish UI or focus. */
|
|
73
|
+
async function run(input) {
|
|
74
|
+
if (busy.value)
|
|
75
|
+
return;
|
|
76
|
+
busy.value = true;
|
|
77
|
+
try {
|
|
78
|
+
if (await props.action(input) && active)
|
|
79
|
+
close(true);
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
if (active)
|
|
83
|
+
busy.value = false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** Enter commits a non-empty name without submitting any caller-owned form. */
|
|
87
|
+
function submit() {
|
|
88
|
+
const value = label.value.trim();
|
|
89
|
+
if (!value || busy.value)
|
|
90
|
+
return;
|
|
91
|
+
if (mode.value === 'save')
|
|
92
|
+
void run({ action: 'save', label: value });
|
|
93
|
+
else if (mode.value === 'rename' && props.selectedId)
|
|
94
|
+
void run({ action: 'rename', id: props.selectedId, label: value });
|
|
95
|
+
}
|
|
96
|
+
/** Menu navigation skips unavailable preset actions; Tab resumes beside trigger. */
|
|
97
|
+
function keydown(event) {
|
|
98
|
+
if (event.key === 'Tab' && mode.value === 'actions') {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
event.stopPropagation();
|
|
101
|
+
close();
|
|
102
|
+
restoreControlsFocus(trigger.value, { restoreFocus: true, focusDirection: event.shiftKey ? 'previous' : 'next' });
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (mode.value !== 'actions') {
|
|
106
|
+
if (event.key === 'Enter' && event.target === content.value?.querySelector('input')) {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
event.stopPropagation();
|
|
109
|
+
submit();
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const actions = Array.from(content.value?.querySelectorAll('[role="menuitem"]:not(:disabled)') ?? []);
|
|
114
|
+
const index = actions.indexOf(content.value?.ownerDocument.activeElement);
|
|
115
|
+
const next = event.key === 'ArrowDown'
|
|
116
|
+
? (index + 1) % actions.length
|
|
117
|
+
: event.key === 'ArrowUp'
|
|
118
|
+
? (index - 1 + actions.length) % actions.length
|
|
119
|
+
: event.key === 'Home' ? 0 : event.key === 'End' ? actions.length - 1 : undefined;
|
|
120
|
+
if (next === undefined || !actions.length)
|
|
121
|
+
return;
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
event.stopPropagation();
|
|
124
|
+
actions[next]?.focus();
|
|
125
|
+
}
|
|
126
|
+
/** Dismiss when keyboard traversal leaves this menu or its name form. */
|
|
127
|
+
async function focusout() {
|
|
128
|
+
const owner = content.value;
|
|
129
|
+
await nextTick();
|
|
130
|
+
if (!active || !shown.value || owner !== content.value)
|
|
131
|
+
return;
|
|
132
|
+
const focused = owner?.ownerDocument.activeElement;
|
|
133
|
+
if (focused && !owner?.contains(focused) && focused !== trigger.value)
|
|
134
|
+
close();
|
|
135
|
+
}
|
|
136
|
+
useHistoireResource(() => {
|
|
137
|
+
active = false;
|
|
138
|
+
focusVersion++;
|
|
139
|
+
});
|
|
140
|
+
return () => h(HistoireDropdown, {
|
|
141
|
+
class: 'histoire-preset-dropdown',
|
|
142
|
+
placement: 'bottom-end',
|
|
143
|
+
distance: 6,
|
|
144
|
+
triggers: [],
|
|
145
|
+
shown: shown.value,
|
|
146
|
+
noAutoFocus: true,
|
|
147
|
+
autoBoundaryMaxSize: true,
|
|
148
|
+
onApplyShow: () => {
|
|
149
|
+
visible = true;
|
|
150
|
+
void focusContent();
|
|
151
|
+
},
|
|
152
|
+
onApplyHide: () => { visible = false; },
|
|
153
|
+
onHide: () => close(),
|
|
154
|
+
}, {
|
|
155
|
+
default: () => h(HstButton, { 'color': 'flat', 'ref': (value) => { trigger.value = getControlElement(value); }, 'type': 'button', 'class': mergePartClass('histoire-preset-trigger', props.classes?.trigger), 'iconOnly': true, 'aria-label': 'Manage presets', 'aria-haspopup': 'menu', 'aria-expanded': shown.value, 'disabled': props.disabled, 'onClick': () => shown.value ? close(true) : open(), 'onKeydown': (event) => {
|
|
156
|
+
if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')
|
|
157
|
+
return;
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
event.stopPropagation();
|
|
160
|
+
open(event.key === 'ArrowUp');
|
|
161
|
+
} }, { default: () => h('svg', { 'viewBox': '0 0 16 16', 'width': 16, 'height': 16, 'fill': 'currentColor', 'aria-hidden': true }, [4, 8, 12].map(cy => h('circle', { cx: 8, cy, r: 1.25 }))) }),
|
|
162
|
+
popper: () => mode.value === 'actions'
|
|
163
|
+
? h('div', { 'ref': content, 'class': 'histoire-preset-menu histoire-control-popover', 'role': 'menu', 'aria-label': 'Preset actions', 'onKeydown': keydown, 'onFocusout': focusout }, [
|
|
164
|
+
h(HstButton, { color: 'flat', type: 'button', role: 'menuitem', tabindex: -1, disabled: busy.value, onClick: () => edit('save') }, { default: () => 'Save preset' }),
|
|
165
|
+
h(HstButton, { color: 'flat', type: 'button', role: 'menuitem', tabindex: -1, disabled: busy.value || !props.selectedId, onClick: () => edit('rename') }, { default: () => 'Rename preset' }),
|
|
166
|
+
h(HstButton, { color: 'flat', type: 'button', role: 'menuitem', tabindex: -1, disabled: busy.value || !props.selectedId, onClick: () => { void run({ action: 'delete', id: props.selectedId }); } }, { default: () => 'Delete preset' }),
|
|
167
|
+
])
|
|
168
|
+
: h('div', { 'ref': content, 'class': 'histoire-preset-form histoire-control-popover', 'role': 'form', 'aria-label': mode.value === 'save' ? 'Save preset' : 'Rename preset', 'aria-busy': busy.value, 'onKeydown': keydown, 'onFocusout': focusout }, [
|
|
169
|
+
h(HstText, { 'layout': 'inline', 'aria-label': 'Preset name', 'placeholder': 'Preset name', 'maxlength': 120, 'modelValue': label.value, 'disabled': busy.value, 'onUpdate:modelValue': (value) => { label.value = value; } }),
|
|
170
|
+
h('div', { class: 'histoire-preset-form-actions' }, [
|
|
171
|
+
h(HstButton, { color: 'flat', type: 'button', disabled: busy.value, onClick: () => {
|
|
172
|
+
mode.value = 'actions';
|
|
173
|
+
void focusContent();
|
|
174
|
+
} }, { default: () => 'Cancel' }),
|
|
175
|
+
h(HstButton, { color: 'flat', type: 'button', disabled: busy.value || !label.value.trim(), onClick: submit }, { default: () => mode.value === 'save' ? 'Save' : 'Rename' }),
|
|
176
|
+
]),
|
|
177
|
+
]),
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HistoireMatrixValue } from '@histoire/protocol';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
/** Runtime-derived prop metadata contains no component constructors or host execution. */
|
|
4
|
+
export interface HistoireControlProp {
|
|
5
|
+
/** Name in owning component's automatic override state. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Collected runtime prop type labels. */
|
|
8
|
+
types?: string[];
|
|
9
|
+
/** Cleaned runtime default used as editor hint. */
|
|
10
|
+
default?: string;
|
|
11
|
+
/** Runtime-collected source prop value, used until an explicit override exists. */
|
|
12
|
+
value?: unknown;
|
|
13
|
+
/** Complete finite choices advertised by source runtime metadata. */
|
|
14
|
+
values?: readonly HistoireMatrixValue[];
|
|
15
|
+
/** Framework enum alias retained until normalized to values. */
|
|
16
|
+
enum?: readonly HistoireMatrixValue[];
|
|
17
|
+
}
|
|
18
|
+
/** Automatic props use same editor mapping and retain runtime-owned definitions. */
|
|
19
|
+
export declare const PropControl: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
20
|
+
index: {
|
|
21
|
+
type: NumberConstructor;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
definition: {
|
|
25
|
+
type: PropType<HistoireControlProp>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
|
+
index: {
|
|
32
|
+
type: NumberConstructor;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
definition: {
|
|
36
|
+
type: PropType<HistoireControlProp>;
|
|
37
|
+
required: true;
|
|
38
|
+
};
|
|
39
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
|
+
//# sourceMappingURL=PropControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropControl.d.ts","sourceRoot":"","sources":["../../../src/components/controls/PropControl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AASnC,0FAA0F;AAC1F,MAAM,WAAW,mBAAmB;IAClC,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAA;IACZ,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mFAAmF;IACnF,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qEAAqE;IACrE,MAAM,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAA;IACvC,gEAAgE;IAChE,IAAI,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAA;CACtC;AAED,oFAAoF;AACpF,eAAO,MAAM,WAAW;;;;;;cAE0D,QAAQ,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;iGAqD7G,CAAA"}
|