@jxsuite/studio 0.6.2 → 0.8.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.
@@ -331,5 +331,118 @@ export function createDevServerPlatform() {
331
331
  const { schema } = await res.json();
332
332
  return schema;
333
333
  },
334
+
335
+ // ─── Git operations ──────────────────────────────────────────────────
336
+
337
+ async gitStatus() {
338
+ const res = await fetch("/__studio/git/status");
339
+ if (!res.ok) throw new Error(await res.text());
340
+ return await res.json();
341
+ },
342
+
343
+ async gitBranches() {
344
+ const res = await fetch("/__studio/git/branches");
345
+ if (!res.ok) throw new Error(await res.text());
346
+ return await res.json();
347
+ },
348
+
349
+ /** @param {number} [limit] */
350
+ async gitLog(limit) {
351
+ const q = limit ? `?limit=${limit}` : "";
352
+ const res = await fetch(`/__studio/git/log${q}`);
353
+ if (!res.ok) throw new Error(await res.text());
354
+ return await res.json();
355
+ },
356
+
357
+ /** @param {string[]} files */
358
+ async gitStage(files) {
359
+ const res = await fetch("/__studio/git/stage", {
360
+ method: "POST",
361
+ headers: { "Content-Type": "application/json" },
362
+ body: JSON.stringify({ files }),
363
+ });
364
+ if (!res.ok) throw new Error((await res.json()).error);
365
+ return await res.json();
366
+ },
367
+
368
+ /** @param {string[]} files */
369
+ async gitUnstage(files) {
370
+ const res = await fetch("/__studio/git/unstage", {
371
+ method: "POST",
372
+ headers: { "Content-Type": "application/json" },
373
+ body: JSON.stringify({ files }),
374
+ });
375
+ if (!res.ok) throw new Error((await res.json()).error);
376
+ return await res.json();
377
+ },
378
+
379
+ /** @param {string} message */
380
+ async gitCommit(message) {
381
+ const res = await fetch("/__studio/git/commit", {
382
+ method: "POST",
383
+ headers: { "Content-Type": "application/json" },
384
+ body: JSON.stringify({ message }),
385
+ });
386
+ if (!res.ok) throw new Error((await res.json()).error);
387
+ return await res.json();
388
+ },
389
+
390
+ async gitPush() {
391
+ const res = await fetch("/__studio/git/push", { method: "POST" });
392
+ if (!res.ok) throw new Error((await res.json()).error);
393
+ return await res.json();
394
+ },
395
+
396
+ async gitPull() {
397
+ const res = await fetch("/__studio/git/pull", { method: "POST" });
398
+ if (!res.ok) throw new Error((await res.json()).error);
399
+ return await res.json();
400
+ },
401
+
402
+ async gitFetch() {
403
+ const res = await fetch("/__studio/git/fetch", { method: "POST" });
404
+ if (!res.ok) throw new Error((await res.json()).error);
405
+ return await res.json();
406
+ },
407
+
408
+ /** @param {string} branch */
409
+ async gitCheckout(branch) {
410
+ const res = await fetch("/__studio/git/checkout", {
411
+ method: "POST",
412
+ headers: { "Content-Type": "application/json" },
413
+ body: JSON.stringify({ branch }),
414
+ });
415
+ if (!res.ok) throw new Error((await res.json()).error);
416
+ return await res.json();
417
+ },
418
+
419
+ /** @param {string} name */
420
+ async gitCreateBranch(name) {
421
+ const res = await fetch("/__studio/git/create-branch", {
422
+ method: "POST",
423
+ headers: { "Content-Type": "application/json" },
424
+ body: JSON.stringify({ name }),
425
+ });
426
+ if (!res.ok) throw new Error((await res.json()).error);
427
+ return await res.json();
428
+ },
429
+
430
+ /** @param {string} path */
431
+ async gitDiff(path) {
432
+ const res = await fetch(`/__studio/git/diff?path=${encodeURIComponent(path)}`);
433
+ if (!res.ok) throw new Error(await res.text());
434
+ return await res.json();
435
+ },
436
+
437
+ /** @param {string[]} files */
438
+ async gitDiscard(files) {
439
+ const res = await fetch("/__studio/git/discard", {
440
+ method: "POST",
441
+ headers: { "Content-Type": "application/json" },
442
+ body: JSON.stringify({ files }),
443
+ });
444
+ if (!res.ok) throw new Error((await res.json()).error);
445
+ return await res.json();
446
+ },
334
447
  };
335
448
  }
package/src/state.js CHANGED
@@ -221,12 +221,19 @@ export function createState(doc) {
221
221
  styleSections: {}, // { layout: true, ... } — section open/closed state
222
222
  inspectorSections: {}, // { identity: true, ... } — properties panel section open/closed state
223
223
  styleShorthands: {}, // { padding: true, ... } — shorthand expand/collapse state
224
+ styleFilter: "", // free-text filter for CSS property names
225
+ styleFilterActive: false, // true = show only props with values set
224
226
  editingFunction: null, // null | { type: 'def', defName } | { type: 'event', path, eventKey }
225
227
  stylebookSelection: null, // tag name string, e.g. "h1"
226
228
  stylebookTab: "elements", // "elements" | "variables"
227
229
  stylebookFilter: "", // search filter text
228
230
  stylebookCustomizedOnly: false, // show only customized elements
229
231
  settingsTab: "stylebook", // "stylebook" | "definitions" | "collections"
232
+ gitStatus: null, // { branch, ahead, behind, files: [] }
233
+ gitBranches: null, // { current, branches: [] }
234
+ gitCommitMessage: "", // commit message input
235
+ gitLoading: false, // loading indicator during async ops
236
+ gitError: null, // error message string
230
237
  },
231
238
  };
232
239
  }