@jxsuite/studio 0.28.2 → 0.28.4

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.
Files changed (104) hide show
  1. package/dist/studio.js +86144 -83971
  2. package/dist/studio.js.map +229 -219
  3. package/package.json +5 -5
  4. package/src/browse/browse-modal.ts +9 -3
  5. package/src/browse/browse.ts +139 -82
  6. package/src/canvas/canvas-diff.ts +35 -18
  7. package/src/canvas/canvas-helpers.ts +55 -21
  8. package/src/canvas/canvas-live-render.ts +140 -89
  9. package/src/canvas/canvas-render.ts +127 -82
  10. package/src/canvas/canvas-utils.ts +68 -42
  11. package/src/canvas/nested-site-style.ts +15 -7
  12. package/src/editor/component-inline-edit.ts +90 -51
  13. package/src/editor/content-inline-edit.ts +75 -72
  14. package/src/editor/context-menu.ts +125 -71
  15. package/src/editor/convert-targets.ts +17 -13
  16. package/src/editor/convert-to-component.ts +51 -28
  17. package/src/editor/convert-to-repeater.ts +44 -19
  18. package/src/editor/inline-edit.ts +107 -52
  19. package/src/editor/inline-format.ts +128 -60
  20. package/src/editor/insertion-helper.ts +26 -14
  21. package/src/editor/shortcuts.ts +89 -43
  22. package/src/editor/slash-menu.ts +41 -26
  23. package/src/files/components.ts +9 -7
  24. package/src/files/file-ops.ts +53 -33
  25. package/src/files/files.ts +246 -143
  26. package/src/format/constraints.ts +25 -15
  27. package/src/format/format-host.ts +33 -10
  28. package/src/github/github-auth.ts +24 -14
  29. package/src/github/github-publish.ts +20 -14
  30. package/src/new-project/new-project-modal.ts +27 -18
  31. package/src/panels/activity-bar.ts +27 -26
  32. package/src/panels/ai-panel.ts +100 -44
  33. package/src/panels/block-action-bar.ts +84 -52
  34. package/src/panels/canvas-dnd.ts +47 -28
  35. package/src/panels/data-explorer.ts +24 -11
  36. package/src/panels/dnd.ts +148 -100
  37. package/src/panels/editors.ts +54 -37
  38. package/src/panels/elements-panel.ts +23 -13
  39. package/src/panels/events-panel.ts +48 -38
  40. package/src/panels/git-panel.ts +95 -60
  41. package/src/panels/head-panel.ts +138 -84
  42. package/src/panels/imports-panel.ts +66 -29
  43. package/src/panels/layers-panel.ts +80 -36
  44. package/src/panels/left-panel.ts +86 -53
  45. package/src/panels/overlays.ts +36 -19
  46. package/src/panels/panel-events.ts +48 -27
  47. package/src/panels/panel-scheduler.ts +41 -23
  48. package/src/panels/preview-render.ts +26 -26
  49. package/src/panels/properties-panel.ts +155 -118
  50. package/src/panels/pseudo-preview.ts +31 -15
  51. package/src/panels/quick-search.ts +28 -13
  52. package/src/panels/right-panel.ts +35 -24
  53. package/src/panels/shared.ts +46 -29
  54. package/src/panels/signals-panel.ts +303 -186
  55. package/src/panels/statusbar.ts +27 -12
  56. package/src/panels/style-inputs.ts +30 -24
  57. package/src/panels/style-panel.ts +130 -90
  58. package/src/panels/style-utils.ts +63 -23
  59. package/src/panels/stylebook-layers-panel.ts +27 -30
  60. package/src/panels/stylebook-panel.ts +140 -72
  61. package/src/panels/tab-strip.ts +21 -10
  62. package/src/panels/toolbar.ts +52 -40
  63. package/src/panels/welcome-screen.ts +1 -1
  64. package/src/platform.ts +2 -1
  65. package/src/platforms/devserver.ts +221 -105
  66. package/src/recent-projects.ts +15 -7
  67. package/src/resize-edges.ts +7 -5
  68. package/src/services/cem-export.ts +73 -57
  69. package/src/services/code-services.ts +52 -25
  70. package/src/services/monaco-setup.ts +5 -5
  71. package/src/settings/content-types-editor.ts +133 -62
  72. package/src/settings/css-vars-editor.ts +31 -14
  73. package/src/settings/defs-editor.ts +125 -63
  74. package/src/settings/general-settings.ts +11 -6
  75. package/src/settings/head-editor.ts +30 -15
  76. package/src/settings/schema-field-ui.ts +75 -35
  77. package/src/settings/settings-modal.ts +35 -17
  78. package/src/site-context.ts +80 -47
  79. package/src/state.ts +98 -65
  80. package/src/store.ts +42 -23
  81. package/src/studio.ts +165 -144
  82. package/src/tabs/tab.ts +51 -45
  83. package/src/tabs/transact.ts +230 -109
  84. package/src/types.ts +60 -51
  85. package/src/ui/button-group.ts +3 -2
  86. package/src/ui/color-selector.ts +33 -15
  87. package/src/ui/expression-editor.ts +139 -86
  88. package/src/ui/field-input.ts +35 -18
  89. package/src/ui/field-row.ts +1 -1
  90. package/src/ui/icons.ts +5 -6
  91. package/src/ui/layers.ts +33 -26
  92. package/src/ui/media-picker.ts +13 -7
  93. package/src/ui/panel-resize.ts +39 -20
  94. package/src/ui/spectrum.ts +4 -2
  95. package/src/ui/unit-selector.ts +20 -11
  96. package/src/ui/value-selector.ts +13 -7
  97. package/src/ui/widgets.ts +34 -18
  98. package/src/utils/canvas-media.ts +66 -33
  99. package/src/utils/edit-display.ts +43 -44
  100. package/src/utils/google-fonts.ts +10 -6
  101. package/src/utils/inherited-style.ts +22 -8
  102. package/src/utils/studio-utils.ts +88 -45
  103. package/src/view.ts +9 -5
  104. package/src/workspace/workspace.ts +49 -29
package/src/tabs/tab.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /// <reference lib="dom" />
2
- import { reactive, effectScope } from "../reactivity";
2
+ import { effectScope, reactive } from "../reactivity";
3
3
  import { formatByName, formatForPath } from "../format/format-host";
4
4
  import type {
5
- GitDiffState,
6
- InlineEditDef,
7
- FunctionEditDef,
8
5
  DocumentStackEntry,
9
- GitStatusResult,
6
+ FunctionEditDef,
10
7
  GitBranchesResult,
8
+ GitDiffState,
9
+ GitStatusResult,
10
+ InlineEditDef,
11
11
  } from "../types";
12
12
  import type { JxMutableNode } from "@jxsuite/schema/types";
13
13
 
@@ -49,8 +49,8 @@ export interface Tab {
49
49
  fileHandle: FileSystemFileHandle | null;
50
50
  capabilities: { modes: string[] };
51
51
  scope: {
52
- stop(): void;
53
- run<T>(fn: () => T): T | undefined;
52
+ stop: () => void;
53
+ run: <T>(fn: () => T) => T | undefined;
54
54
  [k: string]: unknown;
55
55
  };
56
56
  doc: {
@@ -69,7 +69,7 @@ export interface Tab {
69
69
  ui: TabUi;
70
70
  canvas: {
71
71
  status: string;
72
- scope: { stop(): void; [k: string]: unknown } | null;
72
+ scope: { stop: () => void; [k: string]: unknown } | null;
73
73
  error: string | null;
74
74
  pendingInlineEdit: InlineEditDef | null;
75
75
  };
@@ -83,30 +83,30 @@ export interface Tab {
83
83
  /** @returns {TabUi} */
84
84
  function createDefaultUi() {
85
85
  return {
86
- rightTab: "properties",
87
- canvasMode: "edit",
88
- zoom: 1,
89
86
  activeMedia: null,
90
87
  activeSelector: null,
88
+ canvasMode: "edit",
91
89
  editingFunction: null,
92
90
  featureToggles: {},
93
- styleSections: {},
91
+ gitBranches: null,
92
+ gitCommitMessage: "",
93
+ gitDiffState: null,
94
+ gitError: null,
95
+ gitLoading: false,
96
+ gitStatus: null,
94
97
  inspectorSections: {},
95
- styleShorthands: {},
98
+ pendingInlineEdit: null,
99
+ rightTab: "properties",
100
+ settingsTab: "stylebook",
96
101
  styleFilter: "",
97
102
  styleFilterActive: false,
103
+ styleSections: {},
104
+ styleShorthands: {},
105
+ stylebookCustomizedOnly: false,
106
+ stylebookFilter: "",
98
107
  stylebookSelection: null,
99
108
  stylebookTab: "elements",
100
- stylebookFilter: "",
101
- stylebookCustomizedOnly: false,
102
- settingsTab: "stylebook",
103
- gitStatus: null,
104
- gitBranches: null,
105
- gitCommitMessage: "",
106
- gitLoading: false,
107
- gitError: null,
108
- gitDiffState: null,
109
- pendingInlineEdit: null,
109
+ zoom: 1,
110
110
  };
111
111
  }
112
112
 
@@ -148,35 +148,35 @@ export function createTab({
148
148
  const resolvedModes = capabilities?.modes ?? inferModes(documentPath, sourceFormat);
149
149
 
150
150
  const tab = scope.run(() => ({
151
- id,
152
- documentPath,
153
- fileHandle,
154
151
  capabilities: { modes: resolvedModes },
155
- scope,
156
152
  doc: reactive({
157
- document,
158
- sourceFormat,
159
153
  content: { frontmatter: frontmatter || {} },
160
- mode: inferDocumentMode(documentPath, sourceFormat),
161
- handlersSource: null,
162
154
  dirty: false,
155
+ document,
156
+ handlersSource: null,
157
+ mode: inferDocumentMode(documentPath, sourceFormat),
158
+ sourceFormat,
163
159
  }),
160
+ documentPath,
161
+ fileHandle,
162
+ history: reactive({
163
+ index: 0,
164
+ snapshots: [{ document: structuredClone(document), selection: null }],
165
+ }),
166
+ id,
167
+ scope,
164
168
  session: reactive({
165
- selection: null,
166
- hover: null,
167
- clipboard: null,
168
- documentStack: [],
169
- ui: createDefaultUi(),
170
169
  canvas: {
171
- status: "idle",
172
- scope: null,
173
170
  error: null,
174
171
  pendingInlineEdit: null,
172
+ scope: null,
173
+ status: "idle",
175
174
  },
176
- }),
177
- history: reactive({
178
- snapshots: [{ document: structuredClone(document), selection: null }],
179
- index: 0,
175
+ clipboard: null,
176
+ documentStack: [],
177
+ hover: null,
178
+ selection: null,
179
+ ui: createDefaultUi(),
180
180
  }),
181
181
  })) as unknown as Tab;
182
182
 
@@ -189,9 +189,13 @@ export function createTab({
189
189
  * @returns {string[]}
190
190
  */
191
191
  function inferModes(documentPath: string | null | undefined, sourceFormat: string | null) {
192
- if (documentPath === "project.json") return ["stylebook", "source"];
192
+ if (documentPath === "project.json") {
193
+ return ["stylebook", "source"];
194
+ }
193
195
  const format = formatByName(sourceFormat) ?? formatForPath(documentPath);
194
- if (format) return format.studio?.modes ?? ["edit", "design", "preview", "source"];
196
+ if (format) {
197
+ return format.studio?.modes ?? ["edit", "design", "preview", "source"];
198
+ }
195
199
  return ALL_MODES;
196
200
  }
197
201
 
@@ -205,7 +209,9 @@ function inferModes(documentPath: string | null | undefined, sourceFormat: strin
205
209
  */
206
210
  function inferDocumentMode(documentPath: string | null | undefined, sourceFormat: string | null) {
207
211
  const format = formatByName(sourceFormat) ?? formatForPath(documentPath);
208
- if (format) return format.studio?.documentMode?.default ?? "content";
212
+ if (format) {
213
+ return format.studio?.documentMode?.default ?? "content";
214
+ }
209
215
  return "component";
210
216
  }
211
217