@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/view.ts CHANGED
@@ -7,6 +7,8 @@
7
7
  * store.js) makes renderer dependencies explicit.
8
8
  */
9
9
 
10
+ import type { editor } from "monaco-editor";
11
+
10
12
  interface ViewState {
11
13
  panzoomWrap: HTMLElement | null;
12
14
  renderGeneration: number;
@@ -16,12 +18,12 @@ interface ViewState {
16
18
  panY: number;
17
19
  prevCanvasMode: string | null;
18
20
  monacoEditor:
19
- | (import("monaco-editor").editor.IStandaloneCodeEditor & {
21
+ | (editor.IStandaloneCodeEditor & {
20
22
  _ignoreNextChange?: boolean;
21
23
  })
22
24
  | null;
23
25
  functionEditor:
24
- | (import("monaco-editor").editor.IStandaloneCodeEditor & {
26
+ | (editor.IStandaloneCodeEditor & {
25
27
  _ignoreNextChange?: boolean;
26
28
  _editingTarget?: string | null;
27
29
  })
@@ -136,8 +138,10 @@ export const view: ViewState = {
136
138
  const COLLAPSE_STORAGE_KEY = "jx-studio-panel-widths";
137
139
 
138
140
  export function applyPanelCollapse() {
139
- const app = document.getElementById("app");
140
- if (!app) return;
141
+ const app = document.querySelector("#app");
142
+ if (!app) {
143
+ return;
144
+ }
141
145
  app.classList.toggle("left-collapsed", view.leftPanelCollapsed);
142
146
  app.classList.toggle("right-collapsed", view.rightPanelCollapsed);
143
147
  try {
@@ -146,6 +150,6 @@ export function applyPanelCollapse() {
146
150
  saved.rightCollapsed = view.rightPanelCollapsed;
147
151
  localStorage.setItem(COLLAPSE_STORAGE_KEY, JSON.stringify(saved));
148
152
  } catch {
149
- // storage unavailable
153
+ // Storage unavailable
150
154
  }
151
155
  }
@@ -1,9 +1,10 @@
1
- import { reactive, computed } from "../reactivity";
1
+ import { computed, reactive } from "../reactivity";
2
2
  import { createTab, disposeTab } from "../tabs/tab";
3
3
  import type { Tab } from "../tabs/tab";
4
4
 
5
5
  import type { ComponentEntry } from "../files/components";
6
- import type { JxStyle, JxMutableNode } from "@jxsuite/schema/types";
6
+ import type { JxMutableNode, JxStyle } from "@jxsuite/schema/types";
7
+ import type { ComputedRef } from "@vue/reactivity";
7
8
 
8
9
  interface FileEntry {
9
10
  name: string;
@@ -11,40 +12,49 @@ interface FileEntry {
11
12
  type: string;
12
13
  }
13
14
 
14
- export const workspace = reactive({
15
- /** @type {string | null} */
16
- projectRoot: null as string | null,
17
- /** @type {object | null} */
18
- projectConfig: null as object | null,
19
- /** @type {ComponentEntry[]} */
20
- componentRegistry: [] as ComponentEntry[],
21
- /** @type {JxMutableNode | null} */
15
+ export interface Workspace {
16
+ projectRoot: string | null;
17
+ projectConfig: object | null;
18
+ componentRegistry: ComponentEntry[];
19
+ clipboard: JxMutableNode | null;
20
+ styleClipboard: JxStyle | null;
21
+ fileTree: {
22
+ dirs: Map<string, FileEntry[]>;
23
+ expanded: Set<string>;
24
+ selectedPath: string | null;
25
+ searchQuery: string;
26
+ };
27
+ tabs: Map<string, Tab>;
28
+ tabOrder: string[];
29
+ activeTabId: string | null;
30
+ ui: { activityBar: string };
31
+ }
32
+
33
+ // Annotated as Workspace: Vue's UnwrapNestedRefs cannot terminate on the
34
+ // Recursive document types, and reactive() does not unwrap refs we never use.
35
+ export const workspace: Workspace = reactive({
36
+ activeTabId: null as string | null,
22
37
  clipboard: null as JxMutableNode | null,
23
- /** @type {JxStyle | null} */
24
- styleClipboard: null as JxStyle | null,
38
+ componentRegistry: [] as ComponentEntry[],
25
39
  fileTree: {
26
- /** @type {Map<string, FileEntry[]>} */
27
40
  dirs: new Map<string, FileEntry[]>(),
28
- /** @type {Set<string>} */
29
41
  expanded: new Set<string>(),
30
- /** @type {string | null} */
31
- selectedPath: null as string | null,
32
42
  searchQuery: "",
43
+ selectedPath: null as string | null,
33
44
  },
34
- /** @type {Map<string, Tab>} */
35
- tabs: new Map<string, Tab>(),
36
- /** @type {string[]} */
45
+ projectConfig: null as object | null,
46
+ projectRoot: null as string | null,
47
+ styleClipboard: null as JxStyle | null,
37
48
  tabOrder: [] as string[],
38
- /** @type {string | null} */
39
- activeTabId: null as string | null,
49
+ tabs: new Map<string, Tab>(),
40
50
  ui: {
41
51
  activityBar: "files",
42
52
  },
43
- });
53
+ }) as unknown as Workspace;
44
54
 
45
55
  export const activeTab = computed(() =>
46
56
  workspace.activeTabId ? (workspace.tabs.get(workspace.activeTabId) ?? null) : null,
47
- ) as unknown as import("@vue/reactivity").ComputedRef<Tab | null>;
57
+ ) as unknown as ComputedRef<Tab | null>;
48
58
 
49
59
  /**
50
60
  * Open a new tab and make it active.
@@ -83,12 +93,14 @@ export function openTab(opts: {
83
93
  */
84
94
  export function closeTab(tabId: string) {
85
95
  const tab = workspace.tabs.get(tabId);
86
- if (!tab) return;
96
+ if (!tab) {
97
+ return;
98
+ }
87
99
  disposeTab(tab);
88
100
  workspace.tabs.delete(tabId);
89
101
  workspace.tabOrder = workspace.tabOrder.filter((id) => id !== tabId);
90
102
  if (workspace.activeTabId === tabId) {
91
- workspace.activeTabId = workspace.tabOrder[workspace.tabOrder.length - 1] || null;
103
+ workspace.activeTabId = workspace.tabOrder.at(-1) || null;
92
104
  }
93
105
  }
94
106
 
@@ -132,7 +144,9 @@ export function replaceAllTabs(newTabOpts: {
132
144
  workspace.tabOrder = [newTab.id];
133
145
 
134
146
  for (const id of oldIds) {
135
- if (id === newTab.id) continue;
147
+ if (id === newTab.id) {
148
+ continue;
149
+ }
136
150
  workspace.tabs.delete(id);
137
151
  }
138
152
  for (const tab of oldTabs) {
@@ -148,7 +162,9 @@ export function replaceAllTabs(newTabOpts: {
148
162
  * @param {string} tabId
149
163
  */
150
164
  export function activateTab(tabId: string) {
151
- if (workspace.tabs.has(tabId)) workspace.activeTabId = tabId;
165
+ if (workspace.tabs.has(tabId)) {
166
+ workspace.activeTabId = tabId;
167
+ }
152
168
  }
153
169
 
154
170
  /**
@@ -161,11 +177,15 @@ export function activateTab(tabId: string) {
161
177
  */
162
178
  export function renameTab(oldId: string, newId: string, newDocumentPath: string) {
163
179
  const tab = workspace.tabs.get(oldId);
164
- if (!tab) return;
180
+ if (!tab) {
181
+ return;
182
+ }
165
183
  tab.id = newId;
166
184
  tab.documentPath = newDocumentPath;
167
185
  workspace.tabs.delete(oldId);
168
186
  workspace.tabs.set(newId, tab);
169
187
  workspace.tabOrder = workspace.tabOrder.map((id) => (id === oldId ? newId : id));
170
- if (workspace.activeTabId === oldId) workspace.activeTabId = newId;
188
+ if (workspace.activeTabId === oldId) {
189
+ workspace.activeTabId = newId;
190
+ }
171
191
  }