@xenolithengine/graph-wc 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 +53 -0
- package/dist/attrs.d.ts +8 -0
- package/dist/attrs.d.ts.map +1 -0
- package/dist/attrs.js +31 -0
- package/dist/attrs.js.map +1 -0
- package/dist/element.d.ts +21 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +59 -0
- package/dist/element.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -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,53 @@
|
|
|
1
|
+
# @xenolithengine/graph-wc
|
|
2
|
+
|
|
3
|
+
[](https://github.com/XenolithEngine/xenolith-graph#status)
|
|
4
|
+
[](https://github.com/XenolithEngine/xenolith-graph/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
`<xenolith-graph>` Web Component — the universal adapter. Works in Angular, Vue, Svelte, Solid, Lit, Astro, and vanilla.
|
|
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-wc pixi.js
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Peer dependency: `pixi.js@^8.6.0`. WebGL/client-only.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { register } from '@xenolithengine/graph-wc'
|
|
24
|
+
register() // default tag <xenolith-graph>
|
|
25
|
+
// register('my-graph') // or with a custom tag
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<xenolith-graph style="width:100%;height:100vh" minimap></xenolith-graph>
|
|
30
|
+
|
|
31
|
+
<script type="module">
|
|
32
|
+
import { register } from '@xenolithengine/graph-wc'
|
|
33
|
+
register()
|
|
34
|
+
|
|
35
|
+
const el = document.querySelector('xenolith-graph')
|
|
36
|
+
el.addEventListener('node:click', (e) => console.log(e.detail.nodeId))
|
|
37
|
+
</script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Registration is **explicit** (the import is side-effect-free); call `register()` once at startup.
|
|
41
|
+
|
|
42
|
+
## What's exported
|
|
43
|
+
|
|
44
|
+
- `register(tag?)` — define the custom element (idempotent; default tag `xenolith-graph`)
|
|
45
|
+
- `XenolithGraphElement` — the `HTMLElement` class (if you want to register it yourself)
|
|
46
|
+
- `readAttributes`, `FORWARDED_EVENTS` — used internally; exported for advanced hosts
|
|
47
|
+
|
|
48
|
+
## Docs
|
|
49
|
+
|
|
50
|
+
- [API reference](https://xenolithengine.github.io/xenolith-graph/guides/api/) — every method exposed by `XenolithEditor`
|
|
51
|
+
- [GitHub](https://github.com/XenolithEngine/xenolith-graph)
|
|
52
|
+
|
|
53
|
+
MIT © XenolithEngine
|
package/dist/attrs.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { XenolithProps } from '@xenolithengine/graph-adapter-core';
|
|
2
|
+
/** Parse the declarative (string) attributes of <xenolith-graph> into props. Complex props
|
|
3
|
+
* (theme object, graph data) arrive via JS properties, not attributes. */
|
|
4
|
+
export declare function readAttributes(el: HTMLElement): Partial<XenolithProps>;
|
|
5
|
+
/** Every public editor event is re-dispatched off the element as a same-named CustomEvent whose
|
|
6
|
+
* `detail` is the event payload. */
|
|
7
|
+
export declare const FORWARDED_EVENTS: readonly ["node:added", "node:removed", "node:moved", "node:click", "edge:connected", "edge:disconnected", "selection:changed", "viewport:changed", "widget:changed", "widget:action", "graph:loaded", "history:changed", "dive:changed"];
|
|
8
|
+
//# sourceMappingURL=attrs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attrs.d.ts","sourceRoot":"","sources":["../src/attrs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAQvE;2EAC2E;AAC3E,wBAAgB,cAAc,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAStE;AAED;qCACqC;AACrC,eAAO,MAAM,gBAAgB,2OAMnB,CAAA"}
|
package/dist/attrs.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** A boolean HTML attribute is true when present unless its value is the string "false". */
|
|
2
|
+
function boolAttr(el, name) {
|
|
3
|
+
if (!el.hasAttribute(name))
|
|
4
|
+
return undefined;
|
|
5
|
+
return el.getAttribute(name) !== 'false';
|
|
6
|
+
}
|
|
7
|
+
/** Parse the declarative (string) attributes of <xenolith-graph> into props. Complex props
|
|
8
|
+
* (theme object, graph data) arrive via JS properties, not attributes. */
|
|
9
|
+
export function readAttributes(el) {
|
|
10
|
+
const props = {};
|
|
11
|
+
const minimap = boolAttr(el, 'minimap');
|
|
12
|
+
if (minimap !== undefined)
|
|
13
|
+
props.minimap = minimap;
|
|
14
|
+
const fit = boolAttr(el, 'fit-on-load');
|
|
15
|
+
if (fit !== undefined)
|
|
16
|
+
props.fitOnLoad = fit;
|
|
17
|
+
const grid = boolAttr(el, 'disable-grid');
|
|
18
|
+
if (grid !== undefined)
|
|
19
|
+
props.disableGrid = grid;
|
|
20
|
+
return props;
|
|
21
|
+
}
|
|
22
|
+
/** Every public editor event is re-dispatched off the element as a same-named CustomEvent whose
|
|
23
|
+
* `detail` is the event payload. */
|
|
24
|
+
export const FORWARDED_EVENTS = [
|
|
25
|
+
'node:added', 'node:removed', 'node:moved', 'node:click',
|
|
26
|
+
'edge:connected', 'edge:disconnected',
|
|
27
|
+
'selection:changed', 'viewport:changed',
|
|
28
|
+
'widget:changed', 'widget:action',
|
|
29
|
+
'graph:loaded', 'history:changed', 'dive:changed',
|
|
30
|
+
];
|
|
31
|
+
//# sourceMappingURL=attrs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attrs.js","sourceRoot":"","sources":["../src/attrs.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,SAAS,QAAQ,CAAC,EAAe,EAAE,IAAY;IAC7C,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAA;IAC5C,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,OAAO,CAAA;AAC1C,CAAC;AAED;2EAC2E;AAC3E,MAAM,UAAU,cAAc,CAAC,EAAe;IAC5C,MAAM,KAAK,GAA2B,EAAE,CAAA;IACxC,MAAM,OAAO,GAAG,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,IAAI,OAAO,KAAK,SAAS;QAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAA;IAClD,MAAM,GAAG,GAAG,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;IACvC,IAAI,GAAG,KAAK,SAAS;QAAE,KAAK,CAAC,SAAS,GAAG,GAAG,CAAA;IAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC,CAAA;IACzC,IAAI,IAAI,KAAK,SAAS;QAAE,KAAK,CAAC,WAAW,GAAG,IAAI,CAAA;IAChD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;qCACqC;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY;IACxD,gBAAgB,EAAE,mBAAmB;IACrC,mBAAmB,EAAE,kBAAkB;IACvC,gBAAgB,EAAE,eAAe;IACjC,cAAc,EAAE,iBAAiB,EAAE,cAAc;CACzC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type XenolithProps } from '@xenolithengine/graph-adapter-core';
|
|
2
|
+
import type { XenolithEditor } from '@xenolithengine/graph-editor';
|
|
3
|
+
/** `<xenolith-graph>` — the universal adapter. Declarative attributes (`minimap`, `fit-on-load`,
|
|
4
|
+
* `disable-grid`) and JS properties (`theme`, `graph`) feed the editor; every public editor event
|
|
5
|
+
* is re-emitted off the element as a same-named CustomEvent. Works in any framework that speaks
|
|
6
|
+
* DOM (Angular, Vue, Svelte, Solid, Lit, Astro, vanilla). */
|
|
7
|
+
export declare class XenolithGraphElement extends HTMLElement {
|
|
8
|
+
#private;
|
|
9
|
+
static get observedAttributes(): string[];
|
|
10
|
+
set theme(v: XenolithProps['theme']);
|
|
11
|
+
get theme(): XenolithProps['theme'];
|
|
12
|
+
set graph(v: unknown);
|
|
13
|
+
get graph(): unknown;
|
|
14
|
+
set zoomBounds(v: XenolithProps['zoomBounds']);
|
|
15
|
+
/** The live editor instance, or null before mount / after teardown. */
|
|
16
|
+
get editor(): XenolithEditor | null;
|
|
17
|
+
connectedCallback(): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
attributeChangedCallback(): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAChH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAGlE;;;8DAG8D;AAC9D,qBAAa,oBAAqB,SAAQ,WAAW;;IACnD,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAAsD;IAO/F,IAAI,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,EAA+B;IAClE,IAAI,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC,CAA6B;IAChE,IAAI,KAAK,CAAC,CAAC,EAAE,OAAO,EAA+B;IACnD,IAAI,KAAK,IAAI,OAAO,CAA6B;IACjD,IAAI,UAAU,CAAC,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,EAAoC;IAEjF,uEAAuE;IACvE,IAAI,MAAM,IAAI,cAAc,GAAG,IAAI,CAAyC;IAE5E,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAO5B,wBAAwB,IAAI,IAAI;CA4BjC"}
|
package/dist/element.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createEditorBinding } from '@xenolithengine/graph-adapter-core';
|
|
2
|
+
import { readAttributes, FORWARDED_EVENTS } from './attrs.js';
|
|
3
|
+
/** `<xenolith-graph>` — the universal adapter. Declarative attributes (`minimap`, `fit-on-load`,
|
|
4
|
+
* `disable-grid`) and JS properties (`theme`, `graph`) feed the editor; every public editor event
|
|
5
|
+
* is re-emitted off the element as a same-named CustomEvent. Works in any framework that speaks
|
|
6
|
+
* DOM (Angular, Vue, Svelte, Solid, Lit, Astro, vanilla). */
|
|
7
|
+
export class XenolithGraphElement extends HTMLElement {
|
|
8
|
+
static get observedAttributes() { return ['minimap', 'fit-on-load', 'disable-grid']; }
|
|
9
|
+
#binding = null;
|
|
10
|
+
#props = {};
|
|
11
|
+
#offs = [];
|
|
12
|
+
#mounting = false;
|
|
13
|
+
set theme(v) { this.#patch({ theme: v }); }
|
|
14
|
+
get theme() { return this.#props.theme; }
|
|
15
|
+
set graph(v) { this.#patch({ graph: v }); }
|
|
16
|
+
get graph() { return this.#props.graph; }
|
|
17
|
+
set zoomBounds(v) { this.#patch({ zoomBounds: v }); }
|
|
18
|
+
/** The live editor instance, or null before mount / after teardown. */
|
|
19
|
+
get editor() { return this.#binding?.editor ?? null; }
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
this.#props = { ...readAttributes(this), ...this.#props };
|
|
22
|
+
void this.#mount();
|
|
23
|
+
}
|
|
24
|
+
disconnectedCallback() {
|
|
25
|
+
for (const off of this.#offs)
|
|
26
|
+
off();
|
|
27
|
+
this.#offs = [];
|
|
28
|
+
this.#binding?.destroy();
|
|
29
|
+
this.#binding = null;
|
|
30
|
+
}
|
|
31
|
+
attributeChangedCallback() {
|
|
32
|
+
this.#patch(readAttributes(this));
|
|
33
|
+
}
|
|
34
|
+
async #mount() {
|
|
35
|
+
if (this.#mounting || this.#binding)
|
|
36
|
+
return;
|
|
37
|
+
this.#mounting = true;
|
|
38
|
+
let binding;
|
|
39
|
+
try {
|
|
40
|
+
binding = await createEditorBinding(this, this.#props);
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
this.#mounting = false;
|
|
44
|
+
}
|
|
45
|
+
if (!this.isConnected) {
|
|
46
|
+
binding.destroy();
|
|
47
|
+
return;
|
|
48
|
+
} // detached while awaiting init
|
|
49
|
+
this.#binding = binding;
|
|
50
|
+
for (const name of FORWARDED_EVENTS) {
|
|
51
|
+
this.#offs.push(binding.on(name, (detail) => this.dispatchEvent(new CustomEvent(name, { detail, bubbles: false }))));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
#patch(partial) {
|
|
55
|
+
this.#props = { ...this.#props, ...partial };
|
|
56
|
+
this.#binding?.setProps(this.#props);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { XenolithGraphElement } from './element.js';
|
|
2
|
+
export { readAttributes, FORWARDED_EVENTS } from './attrs.js';
|
|
3
|
+
/** Register the custom element (default tag `xenolith-graph`). Idempotent — safe to call multiple
|
|
4
|
+
* times and across modules.
|
|
5
|
+
*
|
|
6
|
+
* Call this EXPLICITLY after import:
|
|
7
|
+
*
|
|
8
|
+
* import { register } from '@xenolithengine/graph-wc'
|
|
9
|
+
* register() // default tag <xenolith-graph>
|
|
10
|
+
* register('my-graph') // custom tag
|
|
11
|
+
*
|
|
12
|
+
* Pre-v0.7 BETA: `import '@xenolithengine/graph-wc'` auto-registered. That was a side-effect import which
|
|
13
|
+
* (a) makes the package non-tree-shakeable, (b) collides on tag-name conflicts before the host
|
|
14
|
+
* has a chance to choose. Now explicit. Migration: add a one-liner `register()` after import. */
|
|
15
|
+
export declare function register(tag?: string): void;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7D;;;;;;;;;;;kGAWkG;AAClG,wBAAgB,QAAQ,CAAC,GAAG,SAAmB,GAAG,IAAI,CAGrD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { XenolithGraphElement } from './element.js';
|
|
2
|
+
export { XenolithGraphElement } from './element.js';
|
|
3
|
+
export { readAttributes, FORWARDED_EVENTS } from './attrs.js';
|
|
4
|
+
/** Register the custom element (default tag `xenolith-graph`). Idempotent — safe to call multiple
|
|
5
|
+
* times and across modules.
|
|
6
|
+
*
|
|
7
|
+
* Call this EXPLICITLY after import:
|
|
8
|
+
*
|
|
9
|
+
* import { register } from '@xenolithengine/graph-wc'
|
|
10
|
+
* register() // default tag <xenolith-graph>
|
|
11
|
+
* register('my-graph') // custom tag
|
|
12
|
+
*
|
|
13
|
+
* Pre-v0.7 BETA: `import '@xenolithengine/graph-wc'` auto-registered. That was a side-effect import which
|
|
14
|
+
* (a) makes the package non-tree-shakeable, (b) collides on tag-name conflicts before the host
|
|
15
|
+
* has a chance to choose. Now explicit. Migration: add a one-liner `register()` after import. */
|
|
16
|
+
export function register(tag = 'xenolith-graph') {
|
|
17
|
+
if (typeof customElements === 'undefined')
|
|
18
|
+
return;
|
|
19
|
+
if (!customElements.get(tag))
|
|
20
|
+
customElements.define(tag, XenolithGraphElement);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7D;;;;;;;;;;;kGAWkG;AAClG,MAAM,UAAU,QAAQ,CAAC,GAAG,GAAG,gBAAgB;IAC7C,IAAI,OAAO,cAAc,KAAK,WAAW;QAAE,OAAM;IACjD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAA;AAChF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xenolithengine/graph-wc",
|
|
3
|
+
"version": "0.7.0-beta.0",
|
|
4
|
+
"description": "<xenolith-graph> Web Component — the universal adapter. Works in Angular, Vue, Svelte, Solid, Lit, Astro, and vanilla.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"./dist/register.js"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@xenolithengine/graph-adapter-core": "0.7.0-beta.0",
|
|
25
|
+
"@xenolithengine/graph-editor": "0.7.0-beta.0"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"pixi.js": "^8.6.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"jsdom": "^25.0.0",
|
|
32
|
+
"pixi.js": "^8.6.0",
|
|
33
|
+
"typescript": "^5.7.0",
|
|
34
|
+
"vitest": "^3.0.0"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"web-components",
|
|
38
|
+
"custom-elements",
|
|
39
|
+
"node-editor",
|
|
40
|
+
"node-graph"
|
|
41
|
+
],
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/XenolithEngine/xenolith-graph.git",
|
|
48
|
+
"directory": "packages/wc"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://xenolithengine.github.io/xenolith-graph/",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/XenolithEngine/xenolith-graph/issues"
|
|
53
|
+
},
|
|
54
|
+
"author": "XenolithEngine",
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsc -b",
|
|
57
|
+
"dev": "tsc -b --watch",
|
|
58
|
+
"test": "vitest run --passWithNoTests",
|
|
59
|
+
"lint": "eslint src",
|
|
60
|
+
"typecheck": "tsc --noEmit"
|
|
61
|
+
}
|
|
62
|
+
}
|