@fusion.dev/helix-sandbox 0.0.0-dev
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 +112 -0
- package/api.json +1 -0
- package/custom-elements.json +1182 -0
- package/dist/code-block/code-block-highlight.d.ts +16 -0
- package/dist/code-block/code-block-highlight.d.ts.map +1 -0
- package/dist/code-block/code-block-highlight.js +10 -0
- package/dist/code-block/code-block-highlight.js.map +1 -0
- package/dist/code-block/index.d.ts +2 -0
- package/dist/code-block/index.d.ts.map +1 -0
- package/dist/code-block/index.js +5 -0
- package/dist/code-block/index.js.map +1 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +2 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/root/editor-root.css.d.ts +2 -0
- package/dist/editor/root/editor-root.css.d.ts.map +1 -0
- package/dist/editor/root/editor-root.css.js +3 -0
- package/dist/editor/root/editor-root.css.js.map +1 -0
- package/dist/editor/root/editor-root.d.ts +146 -0
- package/dist/editor/root/editor-root.d.ts.map +1 -0
- package/dist/editor/root/editor-root.js +199 -0
- package/dist/editor/root/editor-root.js.map +1 -0
- package/dist/highlight/highlight.d.ts +25 -0
- package/dist/highlight/highlight.d.ts.map +1 -0
- package/dist/highlight/highlight.js +97 -0
- package/dist/highlight/highlight.js.map +1 -0
- package/dist/highlight/index.d.ts +4 -0
- package/dist/highlight/index.d.ts.map +1 -0
- package/dist/highlight/index.js +4 -0
- package/dist/highlight/index.js.map +1 -0
- package/dist/highlight/language.d.ts +26 -0
- package/dist/highlight/language.d.ts.map +1 -0
- package/dist/highlight/language.js +21 -0
- package/dist/highlight/language.js.map +1 -0
- package/dist/highlight/shell.d.ts +10 -0
- package/dist/highlight/shell.d.ts.map +1 -0
- package/dist/highlight/shell.js +31 -0
- package/dist/highlight/shell.js.map +1 -0
- package/dist/highlight/stream.d.ts +10 -0
- package/dist/highlight/stream.d.ts.map +1 -0
- package/dist/highlight/stream.js +178 -0
- package/dist/highlight/stream.js.map +1 -0
- package/dist/highlight/syntax.d.ts +10 -0
- package/dist/highlight/syntax.d.ts.map +1 -0
- package/dist/highlight/syntax.js +100 -0
- package/dist/highlight/syntax.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/sandbox/editor/sandbox-editor.css.d.ts +2 -0
- package/dist/sandbox/editor/sandbox-editor.css.d.ts.map +1 -0
- package/dist/sandbox/editor/sandbox-editor.css.js +3 -0
- package/dist/sandbox/editor/sandbox-editor.css.js.map +1 -0
- package/dist/sandbox/editor/sandbox-editor.d.ts +147 -0
- package/dist/sandbox/editor/sandbox-editor.d.ts.map +1 -0
- package/dist/sandbox/editor/sandbox-editor.js +199 -0
- package/dist/sandbox/editor/sandbox-editor.js.map +1 -0
- package/examples.json +1 -0
- package/lint.json +1 -0
- package/package.json +116 -0
- package/types/jsx.d.ts +638 -0
- package/types/svelte.d.ts +36 -0
- package/types/vue.d.ts +134 -0
- package/types/words.d.ts +22 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';
|
|
8
|
+
import { css } from '@codemirror/lang-css';
|
|
9
|
+
import { html as htmlLanguage } from '@codemirror/lang-html';
|
|
10
|
+
import { javascript } from '@codemirror/lang-javascript';
|
|
11
|
+
import { indentUnit, StreamLanguage, syntaxHighlighting } from '@codemirror/language';
|
|
12
|
+
import { Annotation, Compartment, EditorState } from '@codemirror/state';
|
|
13
|
+
import { EditorView, keymap, lineNumbers } from '@codemirror/view';
|
|
14
|
+
import { customElement, HelixBeforeEditEvent, HelixCaretEvent, HelixEditEvent, HelixElement, reportRuntime, words, } from '@fusion.dev/helix-core';
|
|
15
|
+
import { html, unsafeCSS } from 'lit';
|
|
16
|
+
import { property } from 'lit/decorators.js';
|
|
17
|
+
import { languageOf } from '../../highlight/language.js';
|
|
18
|
+
import { shellMode, shellTokens } from '../../highlight/shell.js';
|
|
19
|
+
import { syntaxHighlighter, syntaxRules } from '../../highlight/syntax.js';
|
|
20
|
+
import { styles } from './sandbox-editor.css.js';
|
|
21
|
+
const shellLanguage = StreamLanguage.define({ ...shellMode, tokenTable: shellTokens });
|
|
22
|
+
const LANGUAGES = {
|
|
23
|
+
css: () => css(),
|
|
24
|
+
html: () => htmlLanguage(),
|
|
25
|
+
js: () => javascript(),
|
|
26
|
+
sh: () => shellLanguage,
|
|
27
|
+
ts: () => javascript({ typescript: true }),
|
|
28
|
+
tsx: () => javascript({ jsx: true, typescript: true }),
|
|
29
|
+
};
|
|
30
|
+
const given = Annotation.define();
|
|
31
|
+
let HelixSandboxEditor = class HelixSandboxEditor extends HelixElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.fieldLabel = 'Example source';
|
|
35
|
+
this.language = 'html';
|
|
36
|
+
this.name = 'html';
|
|
37
|
+
this.readOnly = false;
|
|
38
|
+
this.value = '';
|
|
39
|
+
this.readOnly$ = new Compartment();
|
|
40
|
+
this.language$ = new Compartment();
|
|
41
|
+
this.name$ = new Compartment();
|
|
42
|
+
this.baseline = '';
|
|
43
|
+
}
|
|
44
|
+
static { this.words = 'helix-sandbox-editor'; }
|
|
45
|
+
get modified() {
|
|
46
|
+
return this.value === this.edited && this.value !== this.baseline;
|
|
47
|
+
}
|
|
48
|
+
reset() {
|
|
49
|
+
const view = this.view;
|
|
50
|
+
if (view && this.modified) {
|
|
51
|
+
view.dispatch({ changes: { from: 0, insert: this.baseline, to: view.state.doc.length } });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
grammar() {
|
|
55
|
+
const read = languageOf(typeof this.language === 'string' ? this.language : '');
|
|
56
|
+
if (read !== undefined) {
|
|
57
|
+
return LANGUAGES[read]();
|
|
58
|
+
}
|
|
59
|
+
if (this.unread !== this.language) {
|
|
60
|
+
this.unread = this.language;
|
|
61
|
+
reportRuntime({
|
|
62
|
+
kind: 'unknown-language',
|
|
63
|
+
message: `<${this.localName} language="${this.language}"> names no language the editor reads, ` +
|
|
64
|
+
'so its source is drawn plain. Use css, html, js, jsx, mjs, sh, ts or tsx.',
|
|
65
|
+
tag: this.localName,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
get caret() {
|
|
71
|
+
const state = this.view?.state;
|
|
72
|
+
if (!state) {
|
|
73
|
+
return { column: 1, line: 1 };
|
|
74
|
+
}
|
|
75
|
+
const head = state.selection.main.head;
|
|
76
|
+
const line = state.doc.lineAt(head);
|
|
77
|
+
return { column: head - line.from + 1, line: line.number };
|
|
78
|
+
}
|
|
79
|
+
get mount() {
|
|
80
|
+
return this.renderRoot.querySelector('[part="editor"]');
|
|
81
|
+
}
|
|
82
|
+
create() {
|
|
83
|
+
const parent = this.mount;
|
|
84
|
+
if (!parent || this.view) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.view = new EditorView({
|
|
88
|
+
parent,
|
|
89
|
+
root: this.shadowRoot ?? document,
|
|
90
|
+
state: EditorState.create({
|
|
91
|
+
doc: this.value,
|
|
92
|
+
extensions: [
|
|
93
|
+
lineNumbers(),
|
|
94
|
+
history(),
|
|
95
|
+
indentUnit.of(' '),
|
|
96
|
+
EditorState.tabSize.of(2),
|
|
97
|
+
keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab]),
|
|
98
|
+
syntaxHighlighting(syntaxHighlighter, { fallback: true }),
|
|
99
|
+
this.language$.of(this.grammar()),
|
|
100
|
+
this.readOnly$.of(EditorState.readOnly.of(this.readOnly)),
|
|
101
|
+
EditorView.lineWrapping,
|
|
102
|
+
EditorState.transactionFilter.of((transaction) => {
|
|
103
|
+
if (!transaction.docChanged || transaction.annotation(given)) {
|
|
104
|
+
return transaction;
|
|
105
|
+
}
|
|
106
|
+
const next = transaction.newDoc.toString();
|
|
107
|
+
const request = new HelixBeforeEditEvent({ value: next });
|
|
108
|
+
return this.dispatchEvent(request) ? transaction : [];
|
|
109
|
+
}),
|
|
110
|
+
EditorView.updateListener.of((update) => {
|
|
111
|
+
const edit = update.docChanged &&
|
|
112
|
+
!update.transactions.some((transaction) => transaction.annotation(given));
|
|
113
|
+
if (edit) {
|
|
114
|
+
const next = update.state.doc.toString();
|
|
115
|
+
this.edited = next;
|
|
116
|
+
this.value = next;
|
|
117
|
+
this.dispatchEvent(new HelixEditEvent({ value: next }));
|
|
118
|
+
}
|
|
119
|
+
if (update.selectionSet || update.docChanged || update.focusChanged) {
|
|
120
|
+
this.dispatchEvent(new HelixCaretEvent(this.caret));
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
123
|
+
this.name$.of(EditorView.contentAttributes.of({ 'aria-label': this.fieldLabel })),
|
|
124
|
+
],
|
|
125
|
+
}),
|
|
126
|
+
});
|
|
127
|
+
this.dispatchEvent(new HelixCaretEvent(this.caret));
|
|
128
|
+
}
|
|
129
|
+
focus() {
|
|
130
|
+
this.view?.focus();
|
|
131
|
+
}
|
|
132
|
+
disconnectedCallback() {
|
|
133
|
+
super.disconnectedCallback();
|
|
134
|
+
this.view?.destroy();
|
|
135
|
+
this.view = undefined;
|
|
136
|
+
}
|
|
137
|
+
willUpdate(changed) {
|
|
138
|
+
super.willUpdate(changed);
|
|
139
|
+
if (this.value !== this.edited) {
|
|
140
|
+
this.baseline = this.value;
|
|
141
|
+
this.edited = undefined;
|
|
142
|
+
}
|
|
143
|
+
this.toggleState('modified', this.modified);
|
|
144
|
+
}
|
|
145
|
+
updated(changed) {
|
|
146
|
+
super.updated(changed);
|
|
147
|
+
this.create();
|
|
148
|
+
const view = this.view;
|
|
149
|
+
if (!view) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (changed.has('language')) {
|
|
153
|
+
view.dispatch({ effects: this.language$.reconfigure(this.grammar()) });
|
|
154
|
+
}
|
|
155
|
+
if (changed.has('fieldLabel')) {
|
|
156
|
+
view.dispatch({
|
|
157
|
+
effects: this.name$.reconfigure(EditorView.contentAttributes.of({ 'aria-label': this.fieldLabel })),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (changed.has('readOnly')) {
|
|
161
|
+
view.dispatch({
|
|
162
|
+
effects: this.readOnly$.reconfigure(EditorState.readOnly.of(this.readOnly)),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (changed.has('value') && this.value !== view.state.doc.toString()) {
|
|
166
|
+
const head = view.state.selection.main.head;
|
|
167
|
+
view.dispatch({
|
|
168
|
+
annotations: given.of(true),
|
|
169
|
+
changes: { from: 0, insert: this.value, to: view.state.doc.length },
|
|
170
|
+
selection: { anchor: Math.min(head, this.value.length) },
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
render() {
|
|
175
|
+
return html `<div part="editor"></div>`;
|
|
176
|
+
}
|
|
177
|
+
static { this.styles = [styles, unsafeCSS(syntaxRules)]; }
|
|
178
|
+
};
|
|
179
|
+
__decorate([
|
|
180
|
+
words,
|
|
181
|
+
property({ attribute: 'field-label' })
|
|
182
|
+
], HelixSandboxEditor.prototype, "fieldLabel", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
property()
|
|
185
|
+
], HelixSandboxEditor.prototype, "language", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
property()
|
|
188
|
+
], HelixSandboxEditor.prototype, "name", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
property({ attribute: 'readonly', reflect: true, type: Boolean })
|
|
191
|
+
], HelixSandboxEditor.prototype, "readOnly", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
property()
|
|
194
|
+
], HelixSandboxEditor.prototype, "value", void 0);
|
|
195
|
+
HelixSandboxEditor = __decorate([
|
|
196
|
+
customElement('helix-sandbox-editor')
|
|
197
|
+
], HelixSandboxEditor);
|
|
198
|
+
export { HelixSandboxEditor };
|
|
199
|
+
//# sourceMappingURL=sandbox-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-editor.js","sourceRoot":"","sources":["../../../src/sandbox/editor/sandbox-editor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC1C,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACrF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAA;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,EAEL,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,aAAa,EACb,KAAK,GACN,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA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AC,CAAA;QACJ,CAAC;IACH,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA,2BAA2B,CAAA;IACxC,CAAC;aAEe,WAAM,GAAmB,CAAC,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,AAAnD,CAAmD;CAC1E,CAAA;AAzQC;IAFC,KAAK;IACL,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;sDACV;AAO7B;IADC,QAAQ,EAAE;oDACsB;AAMjC;IADC,QAAQ,EAAE;gDACE;AAUb;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAClD;AAMhB;IADC,QAAQ,EAAE;iDACD;AAzCC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAqR9B"}
|
package/examples.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"environment":{"browser":"chromium 153.0.8010.12","fonts":"90 fonts, d93ed8347ae01f6c","os":"ubuntu 24.04","platform":"linux"},"examples":{"sandbox":[]},"package":"@fusion.dev/helix-sandbox"}
|
package/lint.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"package":"@fusion.dev/helix-sandbox","tags":{"helix-sandbox-editor":{"attributes":{"field-label":null,"language":["css","html","javascript","js","jsx","mjs","sh","ts","tsx"],"name":null,"readonly":null,"value":null},"booleans":["readonly"],"family":"sandbox","hooks":[],"parts":["editor"],"reflected":["readonly"],"slots":[],"written":["readOnly$","read-only$","language$","name$","modified","caret","mount","internals","whenSettled","when-settled","hydrating","serverRendered","server-rendered","childrenKnown","children-known","knownChildren","known-children","assignsByName","assigns-by-name","stopInner","stop-inner"]}},"version":"0.206.0"}
|
package/package.json
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fusion.dev/helix-sandbox",
|
|
3
|
+
"description": "A CodeMirror source pane for the Helix sandbox, and a code highlighter for Code Block.",
|
|
4
|
+
"version": "0.0.0-dev",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"directory": "helix/sandbox",
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/project-fusion/fusion.git"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./api.json": "./api.json",
|
|
21
|
+
"./code-block": {
|
|
22
|
+
"types": "./dist/code-block/index.d.ts",
|
|
23
|
+
"default": "./dist/code-block/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./custom-elements.json": "./custom-elements.json",
|
|
26
|
+
"./editor": {
|
|
27
|
+
"types": "./dist/editor/index.d.ts",
|
|
28
|
+
"default": "./dist/editor/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./examples.json": "./examples.json",
|
|
31
|
+
"./highlight": {
|
|
32
|
+
"types": "./dist/highlight/index.d.ts",
|
|
33
|
+
"default": "./dist/highlight/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./jsx": "./types/jsx.d.ts",
|
|
36
|
+
"./lint.json": "./lint.json",
|
|
37
|
+
"./package.json": "./package.json",
|
|
38
|
+
"./svelte": "./types/svelte.d.ts",
|
|
39
|
+
"./vue": "./types/vue.d.ts",
|
|
40
|
+
"./words": "./types/words.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"api.json",
|
|
44
|
+
"custom-elements.json",
|
|
45
|
+
"dist",
|
|
46
|
+
"examples.json",
|
|
47
|
+
"lint.json",
|
|
48
|
+
"types"
|
|
49
|
+
],
|
|
50
|
+
"customElements": "custom-elements.json",
|
|
51
|
+
"sideEffects": [
|
|
52
|
+
"./dist/code-block/index.js",
|
|
53
|
+
"./dist/editor/index.js",
|
|
54
|
+
"./dist/sandbox/editor/sandbox-editor.js"
|
|
55
|
+
],
|
|
56
|
+
"scripts": {
|
|
57
|
+
"analyze": "bun --bun helix-cem",
|
|
58
|
+
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig.types.json",
|
|
59
|
+
"styles": "build-styles .",
|
|
60
|
+
"test": "bun run test:dom && bun run test:ssr",
|
|
61
|
+
"test:dom": "bun test dom.spec",
|
|
62
|
+
"test:ssr": "bun test ssr.spec",
|
|
63
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
64
|
+
},
|
|
65
|
+
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@codemirror/commands": "^6.10.4",
|
|
68
|
+
"@codemirror/lang-css": "^6.3.1",
|
|
69
|
+
"@codemirror/lang-html": "^6.4.12",
|
|
70
|
+
"@codemirror/lang-javascript": "^6.2.5",
|
|
71
|
+
"@codemirror/language": "^6.12.4",
|
|
72
|
+
"@codemirror/legacy-modes": "^6.5.4",
|
|
73
|
+
"@codemirror/state": "^6.7.1",
|
|
74
|
+
"@codemirror/view": "^6.43.8",
|
|
75
|
+
"@fusion.dev/helix-core": "0.206.0",
|
|
76
|
+
"@fusion.dev/helix-headless": "0.206.0",
|
|
77
|
+
"@fusion.dev/helix-styles": "0.206.0",
|
|
78
|
+
"@lezer/css": "^1.3.6",
|
|
79
|
+
"@lezer/highlight": "^1.2.5",
|
|
80
|
+
"@lezer/html": "^1.3.13",
|
|
81
|
+
"@lezer/javascript": "^1.5.4"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@fusion.dev/helix": "0.206.0",
|
|
85
|
+
"@fusion.dev/helix-cem": "0.206.0",
|
|
86
|
+
"@fusion.dev/helix-testing": "0.206.0",
|
|
87
|
+
"@fusion.dev/scripts": "0.0.0-dev",
|
|
88
|
+
"@happy-dom/global-registrator": "^20.14.5",
|
|
89
|
+
"@lit-labs/ssr": "^4.1.0",
|
|
90
|
+
"@types/bun": "^1.4.2",
|
|
91
|
+
"lit": "^3.2.1"
|
|
92
|
+
},
|
|
93
|
+
"homepage": "https://fusion.dev",
|
|
94
|
+
"keywords": [
|
|
95
|
+
"codemirror",
|
|
96
|
+
"design-system",
|
|
97
|
+
"editor",
|
|
98
|
+
"lezer",
|
|
99
|
+
"lit",
|
|
100
|
+
"sandbox",
|
|
101
|
+
"syntax-highlighting",
|
|
102
|
+
"web-components"
|
|
103
|
+
],
|
|
104
|
+
"peerDependencies": {
|
|
105
|
+
"@fusion.dev/helix": "0.206.0",
|
|
106
|
+
"lit": "^3.2.1"
|
|
107
|
+
},
|
|
108
|
+
"peerDependenciesMeta": {
|
|
109
|
+
"@fusion.dev/helix": {
|
|
110
|
+
"optional": true
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"publishConfig": {
|
|
114
|
+
"access": "restricted"
|
|
115
|
+
}
|
|
116
|
+
}
|