@xenolithengine/graph-vue 0.7.0-beta.0
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 +57 -0
- package/dist/components.d.ts +181 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +155 -0
- package/dist/components.js.map +1 -0
- package/dist/hooks.d.ts +2875 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +86 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +140 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +162 -0
- package/dist/index.js.map +1 -0
- package/dist/widget.d.ts +28 -0
- package/dist/widget.d.ts.map +1 -0
- package/dist/widget.js +50 -0
- package/dist/widget.js.map +1 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 strelok2012
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @xenolithengine/graph-vue
|
|
2
|
+
|
|
3
|
+
[](https://github.com/XenolithEngine/xenolith-graph#status)
|
|
4
|
+
[](https://github.com/XenolithEngine/xenolith-graph/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
Vue 3 adapter for XenolithGraph — `<XenolithGraph>` component + composables.
|
|
7
|
+
|
|
8
|
+
> **Beta** — public API in `STABLE-API.md` is the surface we plan to freeze, but it is **NOT frozen yet** — breaking changes can land at any point before v1.0. If you adopt now, pin an exact version.
|
|
9
|
+
|
|
10
|
+
Part of [XenolithGraph](https://github.com/XenolithEngine/xenolith-graph) — an AI-native, embeddable node-graph editor for the web with its own visual design language (Xen).
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @xenolithengine/graph-vue pixi.js
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Peer deps: `vue@^3.4.0`, `pixi.js@^8.6.0`. WebGL/client-only.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```vue
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { XenolithGraph, XenolithControls, XenolithMiniMap } from '@xenolithengine/graph-vue'
|
|
25
|
+
import savedGraph from './graph.json'
|
|
26
|
+
|
|
27
|
+
const onReady = (editor) => editor.fitView()
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<XenolithGraph
|
|
32
|
+
:graph="savedGraph"
|
|
33
|
+
:minimap="true"
|
|
34
|
+
@ready="onReady"
|
|
35
|
+
@node-click="({ nodeId }) => console.log(nodeId)"
|
|
36
|
+
>
|
|
37
|
+
<XenolithControls position="bottom-left" />
|
|
38
|
+
<XenolithMiniMap position="bottom-right" />
|
|
39
|
+
</XenolithGraph>
|
|
40
|
+
</template>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## What's exported
|
|
44
|
+
|
|
45
|
+
- `<XenolithGraph>` — Vue 3 component (props: `theme`, `graph`, `zoomBounds`, `minimap`, `disableGrid`, `snap`, `resizeToWindow`, `fitOnLoad`; emits camelCase versions of every editor event plus `ready`)
|
|
46
|
+
- In-editor panels: `<XenolithPanel>`, `<XenolithButton>`, `<XenolithControls>`, `<XenolithMiniMap>`
|
|
47
|
+
- Composables: `useEditor`, `useEditorOrNull`, `useEditorReady`, `useEditorEvent`, `useNodes`, `useEdges`, `useSelection`, `useViewport`, `useGraphJSON`, `useUndoRedo`
|
|
48
|
+
- `XenolithEditorKey` — Vue injection key (for hand-rolled `provide`/`inject`)
|
|
49
|
+
- Custom widgets: `vueWidget`, `WidgetProps`
|
|
50
|
+
|
|
51
|
+
## Docs
|
|
52
|
+
|
|
53
|
+
- [Vue guide](https://xenolithengine.github.io/xenolith-graph/guides/vue/)
|
|
54
|
+
- [API reference](https://xenolithengine.github.io/xenolith-graph/guides/api/) — every method exposed by `XenolithEditor`
|
|
55
|
+
- [GitHub](https://github.com/XenolithEngine/xenolith-graph)
|
|
56
|
+
|
|
57
|
+
MIT © XenolithEngine
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { type PropType, type VNode } from 'vue';
|
|
2
|
+
import type { ControlsOptions, MinimapPosition } from '@xenolithengine/graph-editor';
|
|
3
|
+
export type PanelPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
4
|
+
/**
|
|
5
|
+
* `<XenolithPanel position="top-right">` — Vue equivalent of React `<XenolithPanel>`.
|
|
6
|
+
* Anchors children inside the editor's overlay layer via `<Teleport>`, so panels live "in" the
|
|
7
|
+
* graph and inherit the theme's `--xeno-*` vars. `bare` drops the frosted card chrome and only
|
|
8
|
+
* positions the slot.
|
|
9
|
+
*/
|
|
10
|
+
export declare const XenolithPanel: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
11
|
+
position: {
|
|
12
|
+
type: PropType<PanelPosition>;
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
bare: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
position: {
|
|
23
|
+
type: PropType<PanelPosition>;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
bare: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
}>> & Readonly<{}>, {
|
|
31
|
+
position: PanelPosition;
|
|
32
|
+
bare: boolean;
|
|
33
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
34
|
+
/**
|
|
35
|
+
* `<XenolithButton :active="...">` — themed button using the editor's `--xeno-*` vars (gold in
|
|
36
|
+
* Xen, cyan in Liquid Glass — switches with the theme for free). Use inside `<XenolithPanel>` /
|
|
37
|
+
* `<XenolithControls>`. Forwards `disabled`, `@click`, etc.
|
|
38
|
+
*/
|
|
39
|
+
export declare const XenolithButton: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
40
|
+
active: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
disabled: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: boolean;
|
|
47
|
+
};
|
|
48
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
51
|
+
active: {
|
|
52
|
+
type: BooleanConstructor;
|
|
53
|
+
default: boolean;
|
|
54
|
+
};
|
|
55
|
+
disabled: {
|
|
56
|
+
type: BooleanConstructor;
|
|
57
|
+
default: boolean;
|
|
58
|
+
};
|
|
59
|
+
}>> & Readonly<{
|
|
60
|
+
onClick?: (...args: any[]) => any;
|
|
61
|
+
}>, {
|
|
62
|
+
active: boolean;
|
|
63
|
+
disabled: boolean;
|
|
64
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
65
|
+
/**
|
|
66
|
+
* `<XenolithControls :show-zoom="false" position="bottom-right" />` — declarative wrapper over
|
|
67
|
+
* `editor.chrome.setControls`. Renders no DOM of its own; the toolbar lives in the editor's
|
|
68
|
+
* overlayRoot and is shared across frameworks. Unmount → toolbar removed.
|
|
69
|
+
*/
|
|
70
|
+
export declare const XenolithControls: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
71
|
+
position: {
|
|
72
|
+
type: PropType<ControlsOptions["position"]>;
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
orientation: {
|
|
76
|
+
type: PropType<ControlsOptions["orientation"]>;
|
|
77
|
+
default: undefined;
|
|
78
|
+
};
|
|
79
|
+
zoomStep: {
|
|
80
|
+
type: NumberConstructor;
|
|
81
|
+
default: undefined;
|
|
82
|
+
};
|
|
83
|
+
showZoom: {
|
|
84
|
+
type: BooleanConstructor;
|
|
85
|
+
default: undefined;
|
|
86
|
+
};
|
|
87
|
+
showFit: {
|
|
88
|
+
type: BooleanConstructor;
|
|
89
|
+
default: undefined;
|
|
90
|
+
};
|
|
91
|
+
showReset: {
|
|
92
|
+
type: BooleanConstructor;
|
|
93
|
+
default: undefined;
|
|
94
|
+
};
|
|
95
|
+
showHistory: {
|
|
96
|
+
type: BooleanConstructor;
|
|
97
|
+
default: undefined;
|
|
98
|
+
};
|
|
99
|
+
showSave: {
|
|
100
|
+
type: BooleanConstructor;
|
|
101
|
+
default: undefined;
|
|
102
|
+
};
|
|
103
|
+
showLock: {
|
|
104
|
+
type: BooleanConstructor;
|
|
105
|
+
default: undefined;
|
|
106
|
+
};
|
|
107
|
+
showInsert: {
|
|
108
|
+
type: BooleanConstructor;
|
|
109
|
+
default: undefined;
|
|
110
|
+
};
|
|
111
|
+
}>, () => VNode | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
112
|
+
position: {
|
|
113
|
+
type: PropType<ControlsOptions["position"]>;
|
|
114
|
+
default: undefined;
|
|
115
|
+
};
|
|
116
|
+
orientation: {
|
|
117
|
+
type: PropType<ControlsOptions["orientation"]>;
|
|
118
|
+
default: undefined;
|
|
119
|
+
};
|
|
120
|
+
zoomStep: {
|
|
121
|
+
type: NumberConstructor;
|
|
122
|
+
default: undefined;
|
|
123
|
+
};
|
|
124
|
+
showZoom: {
|
|
125
|
+
type: BooleanConstructor;
|
|
126
|
+
default: undefined;
|
|
127
|
+
};
|
|
128
|
+
showFit: {
|
|
129
|
+
type: BooleanConstructor;
|
|
130
|
+
default: undefined;
|
|
131
|
+
};
|
|
132
|
+
showReset: {
|
|
133
|
+
type: BooleanConstructor;
|
|
134
|
+
default: undefined;
|
|
135
|
+
};
|
|
136
|
+
showHistory: {
|
|
137
|
+
type: BooleanConstructor;
|
|
138
|
+
default: undefined;
|
|
139
|
+
};
|
|
140
|
+
showSave: {
|
|
141
|
+
type: BooleanConstructor;
|
|
142
|
+
default: undefined;
|
|
143
|
+
};
|
|
144
|
+
showLock: {
|
|
145
|
+
type: BooleanConstructor;
|
|
146
|
+
default: undefined;
|
|
147
|
+
};
|
|
148
|
+
showInsert: {
|
|
149
|
+
type: BooleanConstructor;
|
|
150
|
+
default: undefined;
|
|
151
|
+
};
|
|
152
|
+
}>> & Readonly<{}>, {
|
|
153
|
+
position: import("@xenolithengine/graph-editor").ControlsPosition | undefined;
|
|
154
|
+
orientation: "horizontal" | "vertical" | undefined;
|
|
155
|
+
zoomStep: number;
|
|
156
|
+
showZoom: boolean;
|
|
157
|
+
showFit: boolean;
|
|
158
|
+
showReset: boolean;
|
|
159
|
+
showHistory: boolean;
|
|
160
|
+
showSave: boolean;
|
|
161
|
+
showLock: boolean;
|
|
162
|
+
showInsert: boolean;
|
|
163
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
164
|
+
/**
|
|
165
|
+
* `<XenolithMiniMap position="bottom-right" />` — declarative minimap toggle. Mounted → visible
|
|
166
|
+
* with the given anchor; unmounted → hidden. Renders no DOM of its own (minimap is WebGL).
|
|
167
|
+
*/
|
|
168
|
+
export declare const XenolithMiniMap: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
169
|
+
position: {
|
|
170
|
+
type: PropType<MinimapPosition>;
|
|
171
|
+
default: string;
|
|
172
|
+
};
|
|
173
|
+
}>, () => VNode | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
174
|
+
position: {
|
|
175
|
+
type: PropType<MinimapPosition>;
|
|
176
|
+
default: string;
|
|
177
|
+
};
|
|
178
|
+
}>> & Readonly<{}>, {
|
|
179
|
+
position: MinimapPosition;
|
|
180
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
181
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAAmB,KAAK,KAAK,EAC3C,MAAM,KAAK,CAAA;AACZ,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAGpF,MAAM,MAAM,aAAa,GACrB,UAAU,GAAG,YAAY,GAAG,WAAW,GACvC,aAAa,GAAG,eAAe,GAAG,cAAc,CAAA;AAWpD;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;cAGM,QAAQ,CAAC,aAAa,CAAC;;;;;;;;;;;cAAvB,QAAQ,CAAC,aAAa,CAAC;;;;;;;;;;4EAuBrD,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;4EA6BzB,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;cAGO,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;;;;cACrC,QAAQ,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAUtD,KAAK,GAAG,IAAI;;cAXE,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;;;;cACrC,QAAQ,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAkC1E,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe;;cAGI,QAAQ,CAAC,eAAe,CAAC;;;UAEnC,KAAK,GAAG,IAAI;;cAFF,QAAQ,CAAC,eAAe,CAAC;;;;;4EAavD,CAAA"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { Teleport, computed, defineComponent, h, normalizeStyle, onUnmounted, watch, } from 'vue';
|
|
2
|
+
import { useEditor, useEditorReady } from './index.js';
|
|
3
|
+
const POS = {
|
|
4
|
+
'top-left': { top: '12px', left: '12px' },
|
|
5
|
+
'top-center': { top: '12px', left: '50%', transform: 'translateX(-50%)' },
|
|
6
|
+
'top-right': { top: '12px', right: '12px' },
|
|
7
|
+
'bottom-left': { bottom: '12px', left: '12px' },
|
|
8
|
+
'bottom-center': { bottom: '12px', left: '50%', transform: 'translateX(-50%)' },
|
|
9
|
+
'bottom-right': { bottom: '12px', right: '12px' },
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* `<XenolithPanel position="top-right">` — Vue equivalent of React `<XenolithPanel>`.
|
|
13
|
+
* Anchors children inside the editor's overlay layer via `<Teleport>`, so panels live "in" the
|
|
14
|
+
* graph and inherit the theme's `--xeno-*` vars. `bare` drops the frosted card chrome and only
|
|
15
|
+
* positions the slot.
|
|
16
|
+
*/
|
|
17
|
+
export const XenolithPanel = defineComponent({
|
|
18
|
+
name: 'XenolithPanel',
|
|
19
|
+
props: {
|
|
20
|
+
position: { type: String, default: 'top-left' },
|
|
21
|
+
bare: { type: Boolean, default: false },
|
|
22
|
+
},
|
|
23
|
+
setup(props, { slots }) {
|
|
24
|
+
const editor = useEditor();
|
|
25
|
+
return () => {
|
|
26
|
+
const e = editor.value;
|
|
27
|
+
if (!e)
|
|
28
|
+
return null;
|
|
29
|
+
const chrome = props.bare ? {} : {
|
|
30
|
+
background: 'var(--xeno-panel)',
|
|
31
|
+
border: '1px solid var(--xeno-border)',
|
|
32
|
+
borderRadius: '10px',
|
|
33
|
+
padding: '10px',
|
|
34
|
+
color: 'var(--xeno-text)',
|
|
35
|
+
boxShadow: '0 6px 24px rgba(0,0,0,0.35)',
|
|
36
|
+
fontFamily: 'system-ui, sans-serif',
|
|
37
|
+
fontSize: '13px',
|
|
38
|
+
};
|
|
39
|
+
const style = { position: 'absolute', pointerEvents: 'auto', ...POS[props.position], ...chrome };
|
|
40
|
+
return h(Teleport, { to: e.chrome.overlayRoot }, h('div', { 'data-xeno-panel': '', style }, slots['default']?.()));
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* `<XenolithButton :active="...">` — themed button using the editor's `--xeno-*` vars (gold in
|
|
46
|
+
* Xen, cyan in Liquid Glass — switches with the theme for free). Use inside `<XenolithPanel>` /
|
|
47
|
+
* `<XenolithControls>`. Forwards `disabled`, `@click`, etc.
|
|
48
|
+
*/
|
|
49
|
+
export const XenolithButton = defineComponent({
|
|
50
|
+
name: 'XenolithButton',
|
|
51
|
+
props: {
|
|
52
|
+
active: { type: Boolean, default: false },
|
|
53
|
+
disabled: { type: Boolean, default: false },
|
|
54
|
+
},
|
|
55
|
+
emits: ['click'],
|
|
56
|
+
setup(props, { slots, emit, attrs }) {
|
|
57
|
+
return () => h('button', {
|
|
58
|
+
type: 'button',
|
|
59
|
+
'data-xeno-button': '',
|
|
60
|
+
disabled: props.disabled,
|
|
61
|
+
onClick: (e) => { if (!props.disabled)
|
|
62
|
+
emit('click', e); },
|
|
63
|
+
// `normalizeStyle([base, attrs.style])` merges deep — host `:style="{marginLeft:6}"`
|
|
64
|
+
// composes with the built-in look instead of clobbering it.
|
|
65
|
+
style: normalizeStyle([{
|
|
66
|
+
font: 'inherit',
|
|
67
|
+
fontSize: '13px',
|
|
68
|
+
lineHeight: '1',
|
|
69
|
+
padding: '7px 12px',
|
|
70
|
+
cursor: props.disabled ? 'default' : 'pointer',
|
|
71
|
+
opacity: props.disabled ? '0.4' : '1',
|
|
72
|
+
borderRadius: '8px',
|
|
73
|
+
border: `1px solid ${props.active ? 'var(--xeno-accent)' : 'var(--xeno-border)'}`,
|
|
74
|
+
background: props.active ? 'var(--xeno-accent)' : 'var(--xeno-elevated)',
|
|
75
|
+
color: props.active ? 'var(--xeno-canvas)' : 'var(--xeno-text)',
|
|
76
|
+
}, attrs['style']]),
|
|
77
|
+
}, slots['default']?.());
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* `<XenolithControls :show-zoom="false" position="bottom-right" />` — declarative wrapper over
|
|
82
|
+
* `editor.chrome.setControls`. Renders no DOM of its own; the toolbar lives in the editor's
|
|
83
|
+
* overlayRoot and is shared across frameworks. Unmount → toolbar removed.
|
|
84
|
+
*/
|
|
85
|
+
export const XenolithControls = defineComponent({
|
|
86
|
+
name: 'XenolithControls',
|
|
87
|
+
props: {
|
|
88
|
+
position: { type: String, default: undefined },
|
|
89
|
+
orientation: { type: String, default: undefined },
|
|
90
|
+
zoomStep: { type: Number, default: undefined },
|
|
91
|
+
showZoom: { type: Boolean, default: undefined },
|
|
92
|
+
showFit: { type: Boolean, default: undefined },
|
|
93
|
+
showReset: { type: Boolean, default: undefined },
|
|
94
|
+
showHistory: { type: Boolean, default: undefined },
|
|
95
|
+
showSave: { type: Boolean, default: undefined },
|
|
96
|
+
showLock: { type: Boolean, default: undefined },
|
|
97
|
+
showInsert: { type: Boolean, default: undefined },
|
|
98
|
+
},
|
|
99
|
+
setup(props) {
|
|
100
|
+
const editor = useEditor();
|
|
101
|
+
const opts = computed(() => {
|
|
102
|
+
const o = {};
|
|
103
|
+
if (props.position !== undefined)
|
|
104
|
+
o.position = props.position;
|
|
105
|
+
if (props.orientation !== undefined)
|
|
106
|
+
o.orientation = props.orientation;
|
|
107
|
+
if (props.zoomStep !== undefined)
|
|
108
|
+
o.zoomStep = props.zoomStep;
|
|
109
|
+
if (props.showZoom !== undefined)
|
|
110
|
+
o.showZoom = props.showZoom;
|
|
111
|
+
if (props.showFit !== undefined)
|
|
112
|
+
o.showFit = props.showFit;
|
|
113
|
+
if (props.showReset !== undefined)
|
|
114
|
+
o.showReset = props.showReset;
|
|
115
|
+
if (props.showHistory !== undefined)
|
|
116
|
+
o.showHistory = props.showHistory;
|
|
117
|
+
if (props.showSave !== undefined)
|
|
118
|
+
o.showSave = props.showSave;
|
|
119
|
+
if (props.showLock !== undefined)
|
|
120
|
+
o.showLock = props.showLock;
|
|
121
|
+
if (props.showInsert !== undefined)
|
|
122
|
+
o.showInsert = props.showInsert;
|
|
123
|
+
return o;
|
|
124
|
+
});
|
|
125
|
+
useEditorReady((e) => {
|
|
126
|
+
e.chrome.setControls(opts.value);
|
|
127
|
+
return () => e.chrome.setControls(false);
|
|
128
|
+
});
|
|
129
|
+
watch(opts, (o) => { editor.value?.chrome.setControls(o); });
|
|
130
|
+
onUnmounted(() => { editor.value?.chrome.setControls(false); });
|
|
131
|
+
return () => null;
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
/**
|
|
135
|
+
* `<XenolithMiniMap position="bottom-right" />` — declarative minimap toggle. Mounted → visible
|
|
136
|
+
* with the given anchor; unmounted → hidden. Renders no DOM of its own (minimap is WebGL).
|
|
137
|
+
*/
|
|
138
|
+
export const XenolithMiniMap = defineComponent({
|
|
139
|
+
name: 'XenolithMiniMap',
|
|
140
|
+
props: {
|
|
141
|
+
position: { type: String, default: 'bottom-right' },
|
|
142
|
+
},
|
|
143
|
+
setup(props) {
|
|
144
|
+
const editor = useEditorReady((e) => {
|
|
145
|
+
e.chrome.setMinimapVisible(true);
|
|
146
|
+
e.chrome.setMinimapPosition(props.position);
|
|
147
|
+
return () => e.chrome.setMinimapVisible(false);
|
|
148
|
+
});
|
|
149
|
+
watch(() => props.position, (pos) => {
|
|
150
|
+
editor.value?.chrome.setMinimapPosition(pos);
|
|
151
|
+
});
|
|
152
|
+
return () => null;
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,GAE3E,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAMtD,MAAM,GAAG,GAA2D;IAClE,UAAU,EAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAC9C,YAAY,EAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,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