@histoire/plugin-kit 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/README.md +182 -2
- package/dist/builtins.d.ts +13 -0
- package/dist/builtins.d.ts.map +1 -0
- package/dist/builtins.js +7 -0
- package/dist/define.d.ts +19 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +43 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +14 -0
- package/dist/frame.d.ts +6 -0
- package/dist/frame.d.ts.map +1 -0
- package/dist/frame.js +3 -0
- package/dist/host/actions.d.ts +37 -0
- package/dist/host/actions.d.ts.map +1 -0
- package/dist/host/actions.js +47 -0
- package/dist/host/create-host.d.ts +9 -0
- package/dist/host/create-host.d.ts.map +1 -0
- package/dist/host/create-host.js +194 -0
- package/dist/host/diagnostics.d.ts +14 -0
- package/dist/host/diagnostics.d.ts.map +1 -0
- package/dist/host/diagnostics.js +26 -0
- package/dist/host/frames.d.ts +43 -0
- package/dist/host/frames.d.ts.map +1 -0
- package/dist/host/frames.js +63 -0
- package/dist/host/generation.d.ts +24 -0
- package/dist/host/generation.d.ts.map +1 -0
- package/dist/host/generation.js +38 -0
- package/dist/host/install.d.ts +43 -0
- package/dist/host/install.d.ts.map +1 -0
- package/dist/host/install.js +168 -0
- package/dist/host/manifest.d.ts +23 -0
- package/dist/host/manifest.d.ts.map +1 -0
- package/dist/host/manifest.js +37 -0
- package/dist/host/mount.d.ts +15 -0
- package/dist/host/mount.d.ts.map +1 -0
- package/dist/host/mount.js +57 -0
- package/dist/host/ordering.d.ts +20 -0
- package/dist/host/ordering.d.ts.map +1 -0
- package/dist/host/ordering.js +12 -0
- package/dist/host/plugin-api.d.ts +33 -0
- package/dist/host/plugin-api.d.ts.map +1 -0
- package/dist/host/plugin-api.js +113 -0
- package/dist/host/preferences.d.ts +57 -0
- package/dist/host/preferences.d.ts.map +1 -0
- package/dist/host/preferences.js +137 -0
- package/dist/host/registry.d.ts +43 -0
- package/dist/host/registry.d.ts.map +1 -0
- package/dist/host/registry.js +123 -0
- package/dist/host/resources.d.ts +20 -0
- package/dist/host/resources.d.ts.map +1 -0
- package/dist/host/resources.js +45 -0
- package/dist/ids.d.ts +32 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +51 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/react/index.d.ts +19 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +25 -0
- package/dist/render/keys.d.ts +7 -0
- package/dist/render/keys.d.ts.map +1 -0
- package/dist/render/keys.js +15 -0
- package/dist/render/mount-manager.d.ts +36 -0
- package/dist/render/mount-manager.d.ts.map +1 -0
- package/dist/render/mount-manager.js +128 -0
- package/dist/render/view-binding.d.ts +19 -0
- package/dist/render/view-binding.d.ts.map +1 -0
- package/dist/render/view-binding.js +7 -0
- package/dist/render/workbench-components.d.ts +39 -0
- package/dist/render/workbench-components.d.ts.map +1 -0
- package/dist/render/workbench-components.js +76 -0
- package/dist/session/context.d.ts +66 -0
- package/dist/session/context.d.ts.map +1 -0
- package/dist/session/context.js +173 -0
- package/dist/session/frames.d.ts +46 -0
- package/dist/session/frames.d.ts.map +1 -0
- package/dist/session/frames.js +68 -0
- package/dist/shortcuts.d.ts +94 -0
- package/dist/shortcuts.d.ts.map +1 -0
- package/dist/shortcuts.js +159 -0
- package/dist/styles.d.ts +3 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +25 -0
- package/dist/svelte4/index.d.ts +27 -0
- package/dist/svelte4/index.d.ts.map +1 -0
- package/dist/svelte4/index.js +16 -0
- package/dist/svelte5/index.d.ts +21 -0
- package/dist/svelte5/index.d.ts.map +1 -0
- package/dist/svelte5/index.js +40 -0
- package/dist/types/actions.d.ts +12 -0
- package/dist/types/actions.d.ts.map +1 -0
- package/dist/types/actions.js +1 -0
- package/dist/types/base.d.ts +12 -0
- package/dist/types/base.d.ts.map +1 -0
- package/dist/types/base.js +1 -0
- package/dist/types/canvas.d.ts +150 -0
- package/dist/types/canvas.d.ts.map +1 -0
- package/dist/types/canvas.js +1 -0
- package/dist/types/channel.d.ts +28 -0
- package/dist/types/channel.d.ts.map +1 -0
- package/dist/types/channel.js +1 -0
- package/dist/types/commands.d.ts +35 -0
- package/dist/types/commands.d.ts.map +1 -0
- package/dist/types/commands.js +1 -0
- package/dist/types/common.d.ts +7 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +1 -0
- package/dist/types/context.d.ts +72 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/context.js +1 -0
- package/dist/types/contribution.d.ts +56 -0
- package/dist/types/contribution.d.ts.map +1 -0
- package/dist/types/contribution.js +1 -0
- package/dist/types/frame.d.ts +41 -0
- package/dist/types/frame.d.ts.map +1 -0
- package/dist/types/frame.js +1 -0
- package/dist/types/host.d.ts +123 -0
- package/dist/types/host.d.ts.map +1 -0
- package/dist/types/host.js +1 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/inspector.d.ts +38 -0
- package/dist/types/inspector.d.ts.map +1 -0
- package/dist/types/inspector.js +1 -0
- package/dist/types/menus.d.ts +71 -0
- package/dist/types/menus.d.ts.map +1 -0
- package/dist/types/menus.js +1 -0
- package/dist/types/plugin.d.ts +133 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +1 -0
- package/dist/types/preferences.d.ts +31 -0
- package/dist/types/preferences.d.ts.map +1 -0
- package/dist/types/preferences.js +1 -0
- package/dist/types/services.d.ts +175 -0
- package/dist/types/services.d.ts.map +1 -0
- package/dist/types/services.js +1 -0
- package/dist/types/shell.d.ts +47 -0
- package/dist/types/shell.d.ts.map +1 -0
- package/dist/types/shell.js +1 -0
- package/dist/types/toolbar.d.ts +59 -0
- package/dist/types/toolbar.d.ts.map +1 -0
- package/dist/types/toolbar.js +1 -0
- package/dist/types/view.d.ts +82 -0
- package/dist/types/view.d.ts.map +1 -0
- package/dist/types/view.js +1 -0
- package/dist/vue/components.d.ts +122 -0
- package/dist/vue/components.d.ts.map +1 -0
- package/dist/vue/components.js +112 -0
- package/dist/vue/index.d.ts +21 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue/index.js +47 -0
- package/dist/vue/mount.d.ts +9 -0
- package/dist/vue/mount.d.ts.map +1 -0
- package/dist/vue/mount.js +32 -0
- package/dist/vue/panel-action.d.ts +60 -0
- package/dist/vue/panel-action.d.ts.map +1 -0
- package/dist/vue/panel-action.js +28 -0
- package/package.json +92 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/svelte5/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAI3D,gDAAgD;AAChD,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,gCAAgC;IAChC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;IACnB,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CACxB;AAED,uDAAuD;AACvD,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpE;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CA6B/E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { mount, unmount } from 'svelte';
|
|
2
|
+
import { createSubscriber } from 'svelte/reactivity';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a Svelte 5 component as a DOM `mount` view (Svelte 5.7+).
|
|
5
|
+
*
|
|
6
|
+
* Props are a plain object whose `context` getter reads a `createSubscriber` signal, so
|
|
7
|
+
* template effects reading `context` re-run when the host pushes a snapshot, without
|
|
8
|
+
* remounting and without compiling runes into this package.
|
|
9
|
+
* @param component Component rendered with the surface context.
|
|
10
|
+
*/
|
|
11
|
+
export function svelte5View(component) {
|
|
12
|
+
return {
|
|
13
|
+
mount(container, context, host) {
|
|
14
|
+
let current = context;
|
|
15
|
+
let notify;
|
|
16
|
+
// Start runs when the first effect reads `context`; its update re-runs every reader.
|
|
17
|
+
const track = createSubscriber((update) => {
|
|
18
|
+
notify = update;
|
|
19
|
+
return () => {
|
|
20
|
+
notify = undefined;
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
const props = {
|
|
24
|
+
get context() {
|
|
25
|
+
track();
|
|
26
|
+
return current;
|
|
27
|
+
},
|
|
28
|
+
host,
|
|
29
|
+
};
|
|
30
|
+
const instance = mount(component, { target: container, props });
|
|
31
|
+
return {
|
|
32
|
+
update(next) {
|
|
33
|
+
current = next;
|
|
34
|
+
notify?.();
|
|
35
|
+
},
|
|
36
|
+
dispose: () => unmount(instance),
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Awaitable } from './common.js';
|
|
2
|
+
/** Per-invocation options passed to an action. */
|
|
3
|
+
export interface ActionRunOptions {
|
|
4
|
+
/** Aborted when the captured target scope changes (selection or source); late results are discarded. */
|
|
5
|
+
signal: AbortSignal;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Plugin action. The host captures the target scope when invocation starts,
|
|
9
|
+
* so `context` keeps describing the invoked target even if selection moves.
|
|
10
|
+
*/
|
|
11
|
+
export type ActionRun<C> = (context: C, options: ActionRunOptions) => Awaitable<void>;
|
|
12
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/types/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,kDAAkD;AAClD,MAAM,WAAW,gBAAgB;IAC/B,wGAAwG;IACxG,MAAM,EAAE,WAAW,CAAA;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,KAAK,SAAS,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Fields shared by every contribution, parameterized by the surface context. */
|
|
2
|
+
export interface ContributionBase<C> {
|
|
3
|
+
/** Local id, unique within the plugin; the host qualifies it as `${pluginId}:${id}`. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Sort key among plugin entries of the same placement; lower first. */
|
|
6
|
+
order?: number;
|
|
7
|
+
/** Re-evaluated on context changes; hidden while it returns `false`. */
|
|
8
|
+
available?: (context: C) => boolean;
|
|
9
|
+
/** Omitted from static builds. */
|
|
10
|
+
devOnly?: boolean;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/types/base.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,wFAAwF;IACxF,EAAE,EAAE,MAAM,CAAA;IACV,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wEAAwE;IACxE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAA;IACnC,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { HistoireRect } from '@histoire/protocol';
|
|
2
|
+
import type { ContributionBase } from './base.js';
|
|
3
|
+
import type { WorkbenchIcon } from './common.js';
|
|
4
|
+
import type { CanvasScopedContext, FrameHeaderContext, FrameRef, FrameScopedContext } from './context.js';
|
|
5
|
+
import type { CanvasPoint, CanvasService } from './services.js';
|
|
6
|
+
import type { ToolbarGroup } from './toolbar.js';
|
|
7
|
+
import type { ContributionView } from './view.js';
|
|
8
|
+
/**
|
|
9
|
+
* Overlay layer across the viewport (`viewport`: origin at the viewport's top-left corner, one
|
|
10
|
+
* unit per CSS pixel) or following pan and zoom (`canvas`: origin and units of canvas space,
|
|
11
|
+
* transformed by `translate(pan) scale(zoom)`).
|
|
12
|
+
*/
|
|
13
|
+
export type CanvasOverlayInput = ContributionBase<CanvasScopedContext> & {
|
|
14
|
+
/** Coordinate space of the layer. */
|
|
15
|
+
space: 'viewport' | 'canvas';
|
|
16
|
+
/** Receive pointer events; passive overlays never intercept story pointer events. */
|
|
17
|
+
interactive?: boolean;
|
|
18
|
+
} & ContributionView<CanvasScopedContext>;
|
|
19
|
+
/**
|
|
20
|
+
* Overlay instantiated once per rendered frame (two frames of one variant get two instances),
|
|
21
|
+
* sized and positioned over that frame's rendered document box in viewport pixels.
|
|
22
|
+
*/
|
|
23
|
+
export type CanvasFrameOverlayInput = ContributionBase<FrameScopedContext> & {
|
|
24
|
+
/** Receive pointer events; passive overlays never intercept story pointer events. */
|
|
25
|
+
interactive?: boolean;
|
|
26
|
+
} & ContributionView<FrameScopedContext>;
|
|
27
|
+
/** Color of a frame header badge: `danger` and `warning` for problems, `accent` for highlights. */
|
|
28
|
+
export type CanvasFrameBadgeTone = 'neutral' | 'accent' | 'warning' | 'danger';
|
|
29
|
+
/** Frame header badge with a tone and an accessible description. */
|
|
30
|
+
export interface CanvasFrameBadgeValue {
|
|
31
|
+
/** Short visible text, usually a count. */
|
|
32
|
+
text: string | number;
|
|
33
|
+
/** Badge color; `neutral` by default. */
|
|
34
|
+
tone?: CanvasFrameBadgeTone;
|
|
35
|
+
/** Full description for tooltips and assistive technology (e.g. `3 accessibility violations`). */
|
|
36
|
+
label?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Badge shown in the header of every laid-out canvas frame, next to the variant title. The
|
|
40
|
+
* callback is re-read on context, registry and `api.invalidate()` changes; returning `null`,
|
|
41
|
+
* `undefined` or `''` hides the badge for that frame.
|
|
42
|
+
*/
|
|
43
|
+
export type CanvasFrameBadgeInput = ContributionBase<FrameHeaderContext> & {
|
|
44
|
+
/** Badge of one frame. */
|
|
45
|
+
badge: (context: FrameHeaderContext) => string | number | CanvasFrameBadgeValue | null | undefined;
|
|
46
|
+
};
|
|
47
|
+
/** Pointer event delivered to an active canvas tool. */
|
|
48
|
+
export interface CanvasToolPointerEvent {
|
|
49
|
+
/** Original DOM event. */
|
|
50
|
+
readonly event: PointerEvent;
|
|
51
|
+
/** Pointer position in viewport-local coordinates. */
|
|
52
|
+
readonly viewport: CanvasPoint;
|
|
53
|
+
/** Pointer position in canvas space. */
|
|
54
|
+
readonly canvas: CanvasPoint;
|
|
55
|
+
/** Frame under the pointer, if any. */
|
|
56
|
+
readonly frame: FrameRef | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Pointer handler of a canvas tool; runs only after built-in pan declines the gesture.
|
|
60
|
+
* A throwing handler is recorded as a diagnostic and the canvas falls back to Select.
|
|
61
|
+
*/
|
|
62
|
+
export type CanvasToolPointerHandler = (event: CanvasToolPointerEvent, context: CanvasScopedContext) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Tool added to the canvas tool switch. While active it receives pointer input over the whole
|
|
65
|
+
* canvas (frames included); Space and middle-button panning stay with the canvas.
|
|
66
|
+
*/
|
|
67
|
+
export type CanvasToolInput = ContributionBase<CanvasScopedContext> & {
|
|
68
|
+
/** Visible label. */
|
|
69
|
+
label: string;
|
|
70
|
+
/** Tool icon. */
|
|
71
|
+
icon: WorkbenchIcon;
|
|
72
|
+
/** CSS cursor while the tool is active. */
|
|
73
|
+
cursor?: string;
|
|
74
|
+
/** Keys activating the tool, registered in the workbench shortcut registry (`canvas` scope). */
|
|
75
|
+
shortcut?: readonly string[];
|
|
76
|
+
/** Primary-button gesture start; the pointer is captured until up or cancel. */
|
|
77
|
+
onPointerDown?: CanvasToolPointerHandler;
|
|
78
|
+
/** Pointer movement over the canvas, during a gesture or hovering; suspended while panning. */
|
|
79
|
+
onPointerMove?: CanvasToolPointerHandler;
|
|
80
|
+
/** Gesture end. */
|
|
81
|
+
onPointerUp?: CanvasToolPointerHandler;
|
|
82
|
+
/** Gesture cancelled (Escape, pan takeover, tool switch or removal). */
|
|
83
|
+
onCancel?: (context: CanvasScopedContext) => void;
|
|
84
|
+
/** Tool was switched away, removed, or its viewport disposed; retire any remaining work. */
|
|
85
|
+
onDeactivate?: (context: CanvasScopedContext) => void;
|
|
86
|
+
};
|
|
87
|
+
/** Canvas service of one mounted custom view: the viewport service plus layout invalidation. */
|
|
88
|
+
export interface CanvasViewService extends CanvasService {
|
|
89
|
+
/**
|
|
90
|
+
* Tell the canvas this view's `layout` changed. The canvas re-reads it once after the current
|
|
91
|
+
* update (calls coalesce) and applies the view's zoom policy: Fit frames the new boxes, a
|
|
92
|
+
* fixed zoom keeps the camera. No-op once the view is switched away.
|
|
93
|
+
*/
|
|
94
|
+
requestLayout: () => void;
|
|
95
|
+
}
|
|
96
|
+
/** Context of one mounted custom view. */
|
|
97
|
+
export interface CanvasViewContext extends CanvasScopedContext {
|
|
98
|
+
/** Canvas service of the view, with `requestLayout`. */
|
|
99
|
+
readonly canvas: CanvasViewService;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Arrangement added beside Grid, List and Matrix. The view covers the canvas body in viewport
|
|
103
|
+
* pixels and places content with `context.canvas` transforms; frames it leases through that
|
|
104
|
+
* context may use the whole viewport budget and are released when the view is switched away.
|
|
105
|
+
*
|
|
106
|
+
* Pointer input: like a story frame, view content receives primary presses with the Select tool
|
|
107
|
+
* (the canvas neither pans nor takes focus); the Pan tool, held Space and the middle button pan
|
|
108
|
+
* the canvas and never reach the content. A press whose target element itself carries the
|
|
109
|
+
* `data-histoire-canvas-pan` attribute (not its descendants) behaves like a press on empty
|
|
110
|
+
* canvas; mark full-size backgrounds with it.
|
|
111
|
+
*/
|
|
112
|
+
export type CanvasViewInput = ContributionBase<CanvasScopedContext> & {
|
|
113
|
+
/** Visible label. */
|
|
114
|
+
label: string;
|
|
115
|
+
/** Arrangement icon. */
|
|
116
|
+
icon: WorkbenchIcon;
|
|
117
|
+
/**
|
|
118
|
+
* Content boxes in canvas space at a candidate zoom, used by Fit (pass-through zoom lets
|
|
119
|
+
* fixed-pixel chrome scale inversely). Read when the canvas measures: on switch, resize, frame
|
|
120
|
+
* registry changes and `context.canvas.requestLayout()`. Views without a layout opt out of
|
|
121
|
+
* fitting; Fit keeps the camera.
|
|
122
|
+
*/
|
|
123
|
+
layout?: (zoom: number) => ReadonlyArray<HistoireRect>;
|
|
124
|
+
/**
|
|
125
|
+
* Toolbar groups shown while the view is active; omitted shows every group. The arrangement
|
|
126
|
+
* switch (`arrange`) and the inspector toggle (`inspector`) always show.
|
|
127
|
+
*/
|
|
128
|
+
toolbar?: ReadonlyArray<ToolbarGroup>;
|
|
129
|
+
} & ContributionView<CanvasViewContext>;
|
|
130
|
+
/** Registered canvas overlay. */
|
|
131
|
+
export type CanvasOverlayContribution = CanvasOverlayInput & {
|
|
132
|
+
kind: 'canvas.overlay';
|
|
133
|
+
};
|
|
134
|
+
/** Registered per-frame overlay. */
|
|
135
|
+
export type CanvasFrameOverlayContribution = CanvasFrameOverlayInput & {
|
|
136
|
+
kind: 'canvas.frame-overlay';
|
|
137
|
+
};
|
|
138
|
+
/** Registered frame header badge. */
|
|
139
|
+
export type CanvasFrameBadgeContribution = CanvasFrameBadgeInput & {
|
|
140
|
+
kind: 'canvas.frame-badge';
|
|
141
|
+
};
|
|
142
|
+
/** Registered canvas tool. */
|
|
143
|
+
export type CanvasToolContribution = CanvasToolInput & {
|
|
144
|
+
kind: 'canvas.tool';
|
|
145
|
+
};
|
|
146
|
+
/** Registered canvas view. */
|
|
147
|
+
export type CanvasViewContribution = CanvasViewInput & {
|
|
148
|
+
kind: 'canvas.view';
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=canvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/types/canvas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACzG,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,GAAG;IACvE,qCAAqC;IACrC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAA;IAC5B,qFAAqF;IACrF,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,CAAA;AAEzC;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,GAAG;IAC3E,qFAAqF;IACrF,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,GAAG,gBA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4BAA4B,GAAG,qBAAqB,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAA;AAEjG,8BAA8B;AAC9B,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAA;AAE9E,8BAA8B;AAC9B,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HistoireJsonValue, HistoireTarget } from '@histoire/protocol';
|
|
2
|
+
import type { Disposer } from './common.js';
|
|
3
|
+
/** Message received on a plugin channel, attributed to its sender. */
|
|
4
|
+
export interface PluginChannelMessage {
|
|
5
|
+
/** Plugin owning the channel. */
|
|
6
|
+
pluginId: string;
|
|
7
|
+
/** Frame actor that sent or receives the message. */
|
|
8
|
+
actorId: string;
|
|
9
|
+
/** Variant rendered by the actor. */
|
|
10
|
+
target: HistoireTarget;
|
|
11
|
+
/** Message type chosen by the plugin. */
|
|
12
|
+
type: string;
|
|
13
|
+
/** JSON payload. */
|
|
14
|
+
data: HistoireJsonValue;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Per-plugin channel bound to exactly one frame actor.
|
|
18
|
+
* Size and rate limits follow host channels; excess messages are dropped and counted.
|
|
19
|
+
*/
|
|
20
|
+
export interface PluginChannel {
|
|
21
|
+
/** Sends one message; resolves when handed to the transport. */
|
|
22
|
+
post: (type: string, data: HistoireJsonValue) => Promise<void>;
|
|
23
|
+
/** Observes messages of one type. */
|
|
24
|
+
on: (type: string, listener: (data: HistoireJsonValue, message: PluginChannelMessage) => void) => Disposer;
|
|
25
|
+
/** Messages dropped by limits since the channel opened. */
|
|
26
|
+
getDroppedCount: () => number;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/types/channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACnC,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAA;IACf,qCAAqC;IACrC,MAAM,EAAE,cAAc,CAAA;IACtB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,oBAAoB;IACpB,IAAI,EAAE,iBAAiB,CAAA;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9D,qCAAqC;IACrC,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,oBAAoB,KAAK,IAAI,KAAK,QAAQ,CAAA;IAC1G,2DAA2D;IAC3D,eAAe,EAAE,MAAM,MAAM,CAAA;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ActionRun } from './actions.js';
|
|
2
|
+
import type { ContributionBase } from './base.js';
|
|
3
|
+
import type { WorkbenchIcon } from './common.js';
|
|
4
|
+
import type { WorkbenchContext } from './context.js';
|
|
5
|
+
/** Keyboard focus scope; mirrors the workbench shortcut registry scopes. */
|
|
6
|
+
export type ShortcutScope = 'global' | 'canvas' | 'frame' | 'comment';
|
|
7
|
+
/** Entry in command search. */
|
|
8
|
+
export type CommandInput = ContributionBase<WorkbenchContext> & {
|
|
9
|
+
/** Visible command name. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Command icon. */
|
|
12
|
+
icon: WorkbenchIcon;
|
|
13
|
+
/** Extra text matched by search. */
|
|
14
|
+
searchText?: string;
|
|
15
|
+
/** Action run when the command is chosen. */
|
|
16
|
+
run: ActionRun<WorkbenchContext>;
|
|
17
|
+
};
|
|
18
|
+
/** Keyboard binding for a command, registered in the existing shortcut registry. */
|
|
19
|
+
export type ShortcutInput = ContributionBase<WorkbenchContext> & {
|
|
20
|
+
/** Qualified command id (`acme:run`). */
|
|
21
|
+
command: string;
|
|
22
|
+
/** Alternative key combinations; `mod` maps to command/control. */
|
|
23
|
+
keys: readonly string[];
|
|
24
|
+
/** Focus scope in which the shortcut runs. */
|
|
25
|
+
scope: ShortcutScope;
|
|
26
|
+
};
|
|
27
|
+
/** Registered command. */
|
|
28
|
+
export type CommandContribution = CommandInput & {
|
|
29
|
+
kind: 'command';
|
|
30
|
+
};
|
|
31
|
+
/** Registered shortcut. */
|
|
32
|
+
export type ShortcutContribution = ShortcutInput & {
|
|
33
|
+
kind: 'shortcut';
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/types/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEpD,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;AAErE,+BAA+B;AAC/B,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,GAAG;IAC9D,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,oBAAoB;IACpB,IAAI,EAAE,aAAa,CAAA;IACnB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6CAA6C;IAC7C,GAAG,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAA;CACjC,CAAA;AAED,oFAAoF;AACpF,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,GAAG;IAC/D,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,mEAAmE;IACnE,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,8CAA8C;IAC9C,KAAK,EAAE,aAAa,CAAA;CACrB,CAAA;AAED,0BAA0B;AAC1B,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAEpE,2BAA2B;AAC3B,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Value or promise of value; plugin hooks may complete synchronously or asynchronously. */
|
|
2
|
+
export type Awaitable<T> = T | PromiseLike<T>;
|
|
3
|
+
/** Releases one registration or resource; calling it more than once has no further effect. */
|
|
4
|
+
export type Disposer = () => void;
|
|
5
|
+
/** Offline Carbon glyph name, as listed in Histoire's bundled icon set. */
|
|
6
|
+
export type WorkbenchIcon = string;
|
|
7
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AAE7C,8FAA8F;AAC9F,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAA;AAEjC,2EAA2E;AAC3E,MAAM,MAAM,aAAa,GAAG,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { HistoireReadonly, HistoireSnapshot, HistoireTarget } from '@histoire/protocol';
|
|
2
|
+
import type { Disposer } from './common.js';
|
|
3
|
+
import type { CanvasService, CatalogService, DevEventService, NavigationService, TestsService } from './services.js';
|
|
4
|
+
/**
|
|
5
|
+
* Optional services a host may provide. A missing capability means the matching
|
|
6
|
+
* context property is absent; accessing it never throws.
|
|
7
|
+
*/
|
|
8
|
+
export type WorkbenchCapability = 'catalog' | 'navigation' | 'devEvents' | 'canvas' | 'frames' | 'preferences' | 'tests';
|
|
9
|
+
/** Where the workbench reads stories from. */
|
|
10
|
+
export interface WorkbenchSource {
|
|
11
|
+
/** Live dev server, static book, or remote embedded source. */
|
|
12
|
+
readonly mode: 'dev' | 'static' | 'remote';
|
|
13
|
+
}
|
|
14
|
+
/** Current selection of the owning workbench. */
|
|
15
|
+
export interface WorkbenchSelection {
|
|
16
|
+
/** Selected story/variant, or `null` when nothing is selected. */
|
|
17
|
+
readonly target: HistoireTarget | null;
|
|
18
|
+
}
|
|
19
|
+
/** Root-scoped context; surfaces receive narrower scopes extending it. */
|
|
20
|
+
export interface WorkbenchContext {
|
|
21
|
+
/** Services the host provides in this workbench. */
|
|
22
|
+
readonly capabilities: ReadonlySet<WorkbenchCapability>;
|
|
23
|
+
/** Story source description. */
|
|
24
|
+
readonly source: WorkbenchSource;
|
|
25
|
+
/** SDK-backed readonly catalog. */
|
|
26
|
+
readonly catalog: CatalogService;
|
|
27
|
+
/** Current selection snapshot. */
|
|
28
|
+
readonly selection: WorkbenchSelection;
|
|
29
|
+
/** Tabs, panes, settings, canvas views and story navigation. */
|
|
30
|
+
readonly navigation: NavigationService;
|
|
31
|
+
/** Present only with a compatible dev transport. */
|
|
32
|
+
readonly devEvents?: DevEventService;
|
|
33
|
+
/** Present only where the host runs project tests (dev server). */
|
|
34
|
+
readonly tests?: TestsService;
|
|
35
|
+
/** Notified after any context value changes; read fresh values from the context. */
|
|
36
|
+
subscribe: (listener: () => void) => Disposer;
|
|
37
|
+
}
|
|
38
|
+
/** Identity of one rendered story frame; two frames of one variant have distinct keys. */
|
|
39
|
+
export interface FrameRef {
|
|
40
|
+
/** Unique frame key within the owning workbench. */
|
|
41
|
+
readonly key: string;
|
|
42
|
+
/** Variant rendered by the frame. */
|
|
43
|
+
readonly target: HistoireTarget;
|
|
44
|
+
}
|
|
45
|
+
/** Readonly runtime state and settings of exactly one frame. */
|
|
46
|
+
export interface FrameRuntimeView {
|
|
47
|
+
/** Latest coherent snapshot of the frame's session. */
|
|
48
|
+
getSnapshot: () => HistoireReadonly<HistoireSnapshot>;
|
|
49
|
+
/** Observes future snapshots of this frame only. */
|
|
50
|
+
subscribe: (listener: (snapshot: HistoireReadonly<HistoireSnapshot>) => void) => Disposer;
|
|
51
|
+
}
|
|
52
|
+
/** Context bound to one frame (inspector, frame menu, frame overlays). */
|
|
53
|
+
export interface FrameScopedContext extends WorkbenchContext {
|
|
54
|
+
/** Frame this scope is bound to; stays fixed for the scope lifetime. */
|
|
55
|
+
readonly frame: FrameRef;
|
|
56
|
+
/** Readonly runtime state/settings of exactly this frame. */
|
|
57
|
+
readonly runtime: FrameRuntimeView;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Context of one laid-out canvas frame, whether or not its document is live (frame header
|
|
61
|
+
* badges). It has no runtime: frames outside the live budget still show their header.
|
|
62
|
+
*/
|
|
63
|
+
export interface FrameHeaderContext extends WorkbenchContext {
|
|
64
|
+
/** Frame whose header is rendered. */
|
|
65
|
+
readonly frame: FrameRef;
|
|
66
|
+
}
|
|
67
|
+
/** Context bound to one canvas viewport (overlays, tools, custom views). */
|
|
68
|
+
export interface CanvasScopedContext extends WorkbenchContext {
|
|
69
|
+
/** Geometry, coordinate transforms and frame leases of this canvas. */
|
|
70
|
+
readonly canvas: CanvasService;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAC5F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEpH;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,OAAO,CAAA;AAEX,8CAA8C;AAC9C,MAAM,WAAW,eAAe;IAC9B,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;CAC3C;AAED,iDAAiD;AACjD,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAA;CACvC;AAED,0EAA0E;AAC1E,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAA;IACvD,gCAAgC;IAChC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;IAChC,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,kCAAkC;IAClC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAA;IACtC,gEAAgE;IAChE,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAA;IACtC,oDAAoD;IACpD,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAA;IACpC,mEAAmE;IACnE,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAA;IAC7B,oFAAoF;IACpF,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,QAAQ,CAAA;CAC9C;AAED,0FAA0F;AAC1F,MAAM,WAAW,QAAQ;IACvB,oDAAoD;IACpD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;CAChC;AAED,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,WAAW,EAAE,MAAM,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;IACrD,oDAAoD;IACpD,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,IAAI,KAAK,QAAQ,CAAA;CAC1F;AAED,0EAA0E;AAC1E,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;IACxB,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;CACzB;AAED,4EAA4E;AAC5E,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { CanvasFrameBadgeContribution, CanvasFrameOverlayContribution, CanvasOverlayContribution, CanvasToolContribution, CanvasViewContribution } from './canvas.js';
|
|
2
|
+
import type { CommandContribution, ShortcutContribution } from './commands.js';
|
|
3
|
+
import type { InspectorSectionContribution, InspectorTabContribution } from './inspector.js';
|
|
4
|
+
import type { ContextMenuItemContribution, FrameMenuItemContribution } from './menus.js';
|
|
5
|
+
import type { HomeSectionContribution, SettingsSectionContribution, ShellPaneContribution } from './shell.js';
|
|
6
|
+
import type { ToolbarItemContribution } from './toolbar.js';
|
|
7
|
+
/** Contribution shape for each kind; the single source of contribution kinds. */
|
|
8
|
+
export interface ContributionKindMap {
|
|
9
|
+
/** Inspector tab. */
|
|
10
|
+
'inspector.tab': InspectorTabContribution;
|
|
11
|
+
/** Section around an inspector tab body. */
|
|
12
|
+
'inspector.section': InspectorSectionContribution;
|
|
13
|
+
/** Canvas toolbar item. */
|
|
14
|
+
'toolbar.item': ToolbarItemContribution;
|
|
15
|
+
/** Command search entry. */
|
|
16
|
+
'command': CommandContribution;
|
|
17
|
+
/** Command keyboard binding. */
|
|
18
|
+
'shortcut': ShortcutContribution;
|
|
19
|
+
/** Frame context menu entry. */
|
|
20
|
+
'frame-menu.item': FrameMenuItemContribution;
|
|
21
|
+
/** Workbench context menu entry. */
|
|
22
|
+
'context-menu.item': ContextMenuItemContribution;
|
|
23
|
+
/** Viewport or canvas overlay. */
|
|
24
|
+
'canvas.overlay': CanvasOverlayContribution;
|
|
25
|
+
/** Per-frame overlay. */
|
|
26
|
+
'canvas.frame-overlay': CanvasFrameOverlayContribution;
|
|
27
|
+
/** Frame header badge. */
|
|
28
|
+
'canvas.frame-badge': CanvasFrameBadgeContribution;
|
|
29
|
+
/** Canvas tool. */
|
|
30
|
+
'canvas.tool': CanvasToolContribution;
|
|
31
|
+
/** Canvas arrangement. */
|
|
32
|
+
'canvas.view': CanvasViewContribution;
|
|
33
|
+
/** Rail pane. */
|
|
34
|
+
'shell.pane': ShellPaneContribution;
|
|
35
|
+
/** Settings section. */
|
|
36
|
+
'settings.section': SettingsSectionContribution;
|
|
37
|
+
/** Home section. */
|
|
38
|
+
'home.section': HomeSectionContribution;
|
|
39
|
+
}
|
|
40
|
+
/** Every contribution kind. */
|
|
41
|
+
export type ContributionKind = keyof ContributionKindMap;
|
|
42
|
+
/** Contribution of one kind. */
|
|
43
|
+
export type ContributionOfKind<K extends ContributionKind> = ContributionKindMap[K];
|
|
44
|
+
/** Any contribution accepted by `api.contribute`. */
|
|
45
|
+
export type WorkbenchContribution = ContributionKindMap[ContributionKind];
|
|
46
|
+
/**
|
|
47
|
+
* Contribution as exposed by the host registry: `id` is qualified (`acme:panel`,
|
|
48
|
+
* or `builtin:` for built-ins) and ownership is explicit.
|
|
49
|
+
*/
|
|
50
|
+
export type QualifiedContribution<K extends ContributionKind = ContributionKind> = ContributionOfKind<K> & {
|
|
51
|
+
/** Owning plugin id, or `builtin`. */
|
|
52
|
+
readonly pluginId: string;
|
|
53
|
+
/** Id as written by the plugin, before qualification. */
|
|
54
|
+
readonly localId: string;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../src/types/contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,8BAA8B,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAC1K,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,KAAK,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAC5F,OAAO,KAAK,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAC7G,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAE3D,iFAAiF;AACjF,MAAM,WAAW,mBAAmB;IAClC,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AAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { HistoireJsonValue, HistoireTarget } from '@histoire/protocol';
|
|
2
|
+
import type { PluginChannel } from './channel.js';
|
|
3
|
+
import type { Awaitable, Disposer } from './common.js';
|
|
4
|
+
/** Readonly view of the rendered variant's state inside the frame. */
|
|
5
|
+
export interface ReadonlyFrameState {
|
|
6
|
+
/** Current variant state. */
|
|
7
|
+
readonly value: Readonly<Record<string, unknown>>;
|
|
8
|
+
/** Notified after state changes. */
|
|
9
|
+
subscribe: (listener: () => void) => Disposer;
|
|
10
|
+
}
|
|
11
|
+
/** Context passed to a frame plugin for one rendered actor. */
|
|
12
|
+
export interface FramePluginContext {
|
|
13
|
+
/** Unique id of this rendered mount. */
|
|
14
|
+
readonly actorId: string;
|
|
15
|
+
/** Id of the frame document hosting the actor. */
|
|
16
|
+
readonly documentId: string;
|
|
17
|
+
/** Rendered variant. */
|
|
18
|
+
readonly target: HistoireTarget;
|
|
19
|
+
/** Rendered variant root element. */
|
|
20
|
+
readonly element: HTMLElement;
|
|
21
|
+
/** Aborted when the actor is torn down (selection, HMR, page hide). */
|
|
22
|
+
readonly signal: AbortSignal;
|
|
23
|
+
/** Variant state. */
|
|
24
|
+
readonly state: ReadonlyFrameState;
|
|
25
|
+
/** Browser-visible options from the plugin descriptor. */
|
|
26
|
+
readonly options: HistoireJsonValue | undefined;
|
|
27
|
+
/** Channel to the workbench side of this plugin, bound to this actor. */
|
|
28
|
+
readonly channel: PluginChannel;
|
|
29
|
+
/** Registers teardown run when the actor detaches. */
|
|
30
|
+
onCleanup: (callback: () => void) => void;
|
|
31
|
+
}
|
|
32
|
+
/** Shape accepted by `defineFramePlugin`. */
|
|
33
|
+
export interface FramePluginDefinition {
|
|
34
|
+
/** Plugin id; must match the descriptor id. */
|
|
35
|
+
readonly id: string;
|
|
36
|
+
/** Extension contract version; only `1` exists. */
|
|
37
|
+
readonly apiVersion: 1;
|
|
38
|
+
/** Called once per rendered actor after variant readiness; the returned disposer runs on detach. */
|
|
39
|
+
readonly attach: (frame: FramePluginContext) => Awaitable<void | Disposer>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/types/frame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtD,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IACjC,6BAA6B;IAC7B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACjD,oCAAoC;IACpC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,QAAQ,CAAA;CAC9C;AAED,+DAA+D;AAC/D,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,kDAAkD;IAClD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,wBAAwB;IACxB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;IAC/B,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,qBAAqB;IACrB,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAA;IAClC,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,CAAA;IAC/C,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;IAC/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