@jxsuite/studio 0.15.0 → 0.16.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/dist/studio.js +10183 -10116
- package/dist/studio.js.map +40 -40
- package/package.json +2 -2
- package/src/canvas/canvas-render.js +50 -40
- package/src/files/file-ops.js +4 -2
- package/src/files/files.js +67 -67
- package/src/panels/editors.js +10 -6
- package/src/panels/git-panel.js +17 -15
- package/src/panels/left-panel.js +4 -0
- package/src/panels/signals-panel.js +63 -40
- package/src/platforms/devserver.js +10 -0
- package/src/services/code-services.js +4 -4
- package/src/studio.js +18 -4
- package/src/tabs/transact.js +6 -2
package/src/studio.js
CHANGED
|
@@ -35,7 +35,13 @@ import {
|
|
|
35
35
|
setStatusbarRenderer,
|
|
36
36
|
mountStatusbar,
|
|
37
37
|
} from "./panels/statusbar.js";
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
openFile,
|
|
40
|
+
loadMarkdown,
|
|
41
|
+
saveFile,
|
|
42
|
+
exportFile,
|
|
43
|
+
serializeDocument,
|
|
44
|
+
} from "./files/file-ops.js";
|
|
39
45
|
import {
|
|
40
46
|
loadProject as _loadProject,
|
|
41
47
|
openProject as _openProject,
|
|
@@ -128,6 +134,7 @@ async function navigateToComponent(componentPath) {
|
|
|
128
134
|
documentPath: tab.documentPath,
|
|
129
135
|
dirty: tab.doc.dirty,
|
|
130
136
|
mode: tab.doc.mode,
|
|
137
|
+
sourceFormat: tab.doc.sourceFormat,
|
|
131
138
|
};
|
|
132
139
|
if (!tab.session.documentStack) tab.session.documentStack = [];
|
|
133
140
|
tab.session.documentStack.push(frame);
|
|
@@ -136,6 +143,7 @@ async function navigateToComponent(componentPath) {
|
|
|
136
143
|
tab.doc.document = parsed;
|
|
137
144
|
tab.doc.dirty = false;
|
|
138
145
|
tab.doc.mode = /** @type {any} */ (null);
|
|
146
|
+
tab.doc.sourceFormat = null;
|
|
139
147
|
tab.documentPath = componentPath;
|
|
140
148
|
tab.session.selection = null;
|
|
141
149
|
view.leftTab = "layers";
|
|
@@ -156,7 +164,7 @@ async function navigateBack() {
|
|
|
156
164
|
if (tab.doc.dirty && tab.documentPath) {
|
|
157
165
|
try {
|
|
158
166
|
const platform = getPlatform();
|
|
159
|
-
await platform.writeFile(tab.documentPath,
|
|
167
|
+
await platform.writeFile(tab.documentPath, serializeDocument(tab));
|
|
160
168
|
} catch (/** @type {any} */ e) {
|
|
161
169
|
const err = /** @type {any} */ (e);
|
|
162
170
|
statusMessage(`Save error: ${err.message}`);
|
|
@@ -169,6 +177,7 @@ async function navigateBack() {
|
|
|
169
177
|
tab.doc.document = frame.document;
|
|
170
178
|
tab.doc.dirty = frame.dirty;
|
|
171
179
|
tab.doc.mode = frame.mode;
|
|
180
|
+
tab.doc.sourceFormat = frame.sourceFormat;
|
|
172
181
|
tab.documentPath = frame.documentPath;
|
|
173
182
|
tab.session.selection = frame.selection;
|
|
174
183
|
view.leftTab = "layers";
|
|
@@ -300,7 +309,9 @@ initCanvasRender({
|
|
|
300
309
|
setCanvasMode,
|
|
301
310
|
openFileFromTree,
|
|
302
311
|
exportFile,
|
|
303
|
-
gitDiffState
|
|
312
|
+
get gitDiffState() {
|
|
313
|
+
return gitDiffState;
|
|
314
|
+
},
|
|
304
315
|
setGitDiffState: (/** @type {any} */ state) => {
|
|
305
316
|
gitDiffState = state;
|
|
306
317
|
},
|
|
@@ -359,6 +370,9 @@ leftPanelMod.mount({
|
|
|
359
370
|
registerElementsDnD,
|
|
360
371
|
registerComponentsDnD,
|
|
361
372
|
setupTreeKeyboard,
|
|
373
|
+
setGitDiffState: (/** @type {any} */ state) => {
|
|
374
|
+
gitDiffState = state;
|
|
375
|
+
},
|
|
362
376
|
});
|
|
363
377
|
|
|
364
378
|
// Register all renderers with the store so render()/renderOnly() work
|
|
@@ -578,7 +592,7 @@ function scheduleAutosave() {
|
|
|
578
592
|
if (t?.fileHandle && t.doc.dirty && "createWritable" in t.fileHandle) {
|
|
579
593
|
try {
|
|
580
594
|
const writable = await t.fileHandle.createWritable();
|
|
581
|
-
await writable.write(
|
|
595
|
+
await writable.write(serializeDocument(t));
|
|
582
596
|
await writable.close();
|
|
583
597
|
t.doc.dirty = false;
|
|
584
598
|
statusMessage("Auto-saved");
|
package/src/tabs/transact.js
CHANGED
|
@@ -33,7 +33,7 @@ export function transactDoc(tab, mutationFn, { skipHistory = false } = {}) {
|
|
|
33
33
|
|
|
34
34
|
if (!skipHistory) {
|
|
35
35
|
const snapshot = {
|
|
36
|
-
document:
|
|
36
|
+
document: JSON.parse(JSON.stringify(raw)),
|
|
37
37
|
selection: tab.session.selection ? [...tab.session.selection] : null,
|
|
38
38
|
};
|
|
39
39
|
const truncated = tab.history.snapshots.slice(0, tab.history.index + 1);
|
|
@@ -319,7 +319,11 @@ export function mutateRemoveDef(tab, name) {
|
|
|
319
319
|
export function mutateUpdateDef(tab, name, updates) {
|
|
320
320
|
const doc = tab.doc.document;
|
|
321
321
|
if (!doc.state) doc.state = {};
|
|
322
|
-
if (
|
|
322
|
+
if (doc.state[name] == null) {
|
|
323
|
+
doc.state[name] = {};
|
|
324
|
+
} else if (typeof doc.state[name] !== "object") {
|
|
325
|
+
doc.state[name] = { default: doc.state[name] };
|
|
326
|
+
}
|
|
323
327
|
Object.assign(doc.state[name], updates);
|
|
324
328
|
for (const k of Object.keys(doc.state[name])) {
|
|
325
329
|
if (doc.state[name][k] === undefined || doc.state[name][k] === null) {
|