@jxsuite/studio 0.23.2 → 0.24.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 +2230 -714
- package/dist/studio.js.map +121 -104
- package/package.json +8 -7
- package/src/browse/{browse-modal.js → browse-modal.ts} +9 -10
- package/src/browse/{browse.js → browse.ts} +109 -84
- package/src/canvas/{canvas-diff.js → canvas-diff.ts} +42 -35
- package/src/canvas/{canvas-helpers.js → canvas-helpers.ts} +25 -19
- package/src/canvas/{canvas-live-render.js → canvas-live-render.ts} +53 -63
- package/src/canvas/{canvas-render.js → canvas-render.ts} +110 -121
- package/src/canvas/{canvas-utils.js → canvas-utils.ts} +48 -44
- package/src/canvas/{nested-site-style.js → nested-site-style.ts} +3 -3
- package/src/editor/{component-inline-edit.js → component-inline-edit.ts} +45 -33
- package/src/editor/{content-inline-edit.js → content-inline-edit.ts} +27 -45
- package/src/editor/{context-menu.js → context-menu.ts} +38 -36
- package/src/editor/{convert-targets.js → convert-targets.ts} +15 -12
- package/src/editor/{convert-to-component.js → convert-to-component.ts} +25 -26
- package/src/editor/{convert-to-repeater.js → convert-to-repeater.ts} +60 -40
- package/src/editor/{inline-edit.js → inline-edit.ts} +91 -55
- package/src/editor/{inline-format.js → inline-format.ts} +46 -51
- package/src/editor/{insertion-helper.js → insertion-helper.ts} +47 -63
- package/src/editor/{shortcuts.js → shortcuts.ts} +45 -31
- package/src/editor/{slash-menu.js → slash-menu.ts} +34 -35
- package/src/files/{components.js → components.ts} +12 -15
- package/src/files/{file-ops.js → file-ops.ts} +36 -29
- package/src/files/{files.js → files.ts} +102 -84
- package/src/github/{github-auth.js → github-auth.ts} +3 -3
- package/src/github/{github-publish.js → github-publish.ts} +20 -18
- package/src/markdown/{md-allowlist.js → md-allowlist.ts} +5 -2
- package/src/markdown/{md-convert.js → md-convert.ts} +146 -169
- package/src/new-project/{new-project-modal.js → new-project-modal.ts} +16 -18
- package/src/panels/{activity-bar.js → activity-bar.ts} +26 -34
- package/src/panels/{ai-panel.js → ai-panel.ts} +30 -30
- package/src/panels/{block-action-bar.js → block-action-bar.ts} +64 -73
- package/src/panels/{canvas-dnd.js → canvas-dnd.ts} +44 -49
- package/src/panels/{data-explorer.js → data-explorer.ts} +21 -15
- package/src/panels/dnd.ts +417 -0
- package/src/panels/{editors.js → editors.ts} +43 -50
- package/src/panels/{elements-panel.js → elements-panel.ts} +30 -27
- package/src/panels/{events-panel.js → events-panel.ts} +33 -25
- package/src/panels/{git-panel.js → git-panel.ts} +97 -83
- package/src/panels/{head-panel.js → head-panel.ts} +117 -139
- package/src/panels/{imports-panel.js → imports-panel.ts} +69 -89
- package/src/panels/{layers-panel.js → layers-panel.ts} +61 -57
- package/src/panels/{left-panel.js → left-panel.ts} +56 -63
- package/src/panels/{overlays.js → overlays.ts} +28 -36
- package/src/panels/{panel-events.js → panel-events.ts} +53 -51
- package/src/panels/{preview-render.js → preview-render.ts} +20 -15
- package/src/panels/{properties-panel.js → properties-panel.ts} +212 -246
- package/src/panels/{pseudo-preview.js → pseudo-preview.ts} +9 -8
- package/src/panels/{quick-search.js → quick-search.ts} +16 -17
- package/src/panels/{right-panel.js → right-panel.ts} +41 -59
- package/src/panels/{shared.js → shared.ts} +7 -5
- package/src/panels/{signals-panel.js → signals-panel.ts} +322 -362
- package/src/panels/{statusbar.js → statusbar.ts} +14 -14
- package/src/panels/{style-inputs.js → style-inputs.ts} +66 -48
- package/src/panels/{style-panel.js → style-panel.ts} +235 -290
- package/src/panels/{style-utils.js → style-utils.ts} +32 -31
- package/src/panels/{stylebook-layers-panel.js → stylebook-layers-panel.ts} +22 -14
- package/src/panels/{stylebook-panel.js → stylebook-panel.ts} +127 -140
- package/src/panels/{tab-strip.js → tab-strip.ts} +12 -14
- package/src/panels/{toolbar.js → toolbar.ts} +68 -70
- package/src/panels/{welcome-screen.js → welcome-screen.ts} +14 -16
- package/src/{platform.js → platform.ts} +5 -3
- package/src/platforms/{devserver.js → devserver.ts} +53 -44
- package/src/{recent-projects.js → recent-projects.ts} +17 -12
- package/src/{resize-edges.js → resize-edges.ts} +18 -13
- package/src/services/{cem-export.js → cem-export.ts} +14 -7
- package/src/services/{code-services.js → code-services.ts} +29 -20
- package/src/services/{monaco-setup.js → monaco-setup.ts} +2 -3
- package/src/settings/{content-types-editor.js → content-types-editor.ts} +88 -67
- package/src/settings/{css-vars-editor.js → css-vars-editor.ts} +78 -51
- package/src/settings/{defs-editor.js → defs-editor.ts} +70 -56
- package/src/settings/{general-settings.js → general-settings.ts} +29 -28
- package/src/settings/{head-editor.js → head-editor.ts} +37 -35
- package/src/settings/{schema-field-ui.js → schema-field-ui.ts} +86 -76
- package/src/settings/{settings-modal.js → settings-modal.ts} +14 -16
- package/src/{site-context.js → site-context.ts} +35 -32
- package/src/{state.js → state.ts} +95 -78
- package/src/{store.js → store.ts} +60 -63
- package/src/{studio.js → studio.ts} +117 -119
- package/src/tabs/tab.ts +196 -0
- package/src/tabs/{transact.js → transact.ts} +107 -60
- package/src/types.ts +185 -0
- package/src/ui/{button-group.js → button-group.ts} +21 -21
- package/src/ui/{color-selector.js → color-selector.ts} +44 -37
- package/src/ui/{expression-editor.js → expression-editor.ts} +65 -40
- package/src/ui/{field-row.js → field-row.ts} +19 -2
- package/src/ui/{icons.js → icons.ts} +2 -2
- package/src/ui/{layers.js → layers.ts} +33 -24
- package/src/ui/{media-picker.js → media-picker.ts} +13 -9
- package/src/ui/{panel-resize.js → panel-resize.ts} +9 -4
- package/src/ui/{spectrum.js → spectrum.ts} +4 -4
- package/src/ui/{unit-selector.js → unit-selector.ts} +16 -19
- package/src/ui/{value-selector.js → value-selector.ts} +28 -28
- package/src/ui/{widgets.js → widgets.ts} +62 -15
- package/src/utils/{canvas-media.js → canvas-media.ts} +29 -14
- package/src/utils/{edit-display.js → edit-display.ts} +23 -20
- package/src/utils/{google-fonts.js → google-fonts.ts} +14 -13
- package/src/utils/{inherited-style.js → inherited-style.ts} +15 -10
- package/src/utils/{studio-utils.js → studio-utils.ts} +35 -23
- package/src/{view.js → view.ts} +53 -55
- package/src/workspace/{workspace.js → workspace.ts} +44 -33
- package/src/panels/dnd.js +0 -426
- package/src/tabs/tab.js +0 -192
- /package/src/{reactivity.js → reactivity.ts} +0 -0
package/src/tabs/tab.js
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { reactive, effectScope } from "../reactivity.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {{
|
|
5
|
-
* rightTab: string;
|
|
6
|
-
* canvasMode: string;
|
|
7
|
-
* zoom: number;
|
|
8
|
-
* activeMedia: string | null;
|
|
9
|
-
* activeSelector: string | null;
|
|
10
|
-
* editingFunction: FunctionEditDef | null;
|
|
11
|
-
* featureToggles: Record<string, boolean>;
|
|
12
|
-
* styleSections: Record<string, boolean>;
|
|
13
|
-
* inspectorSections: Record<string, boolean>;
|
|
14
|
-
* styleShorthands: Record<string, boolean>;
|
|
15
|
-
* styleFilter: string;
|
|
16
|
-
* styleFilterActive: boolean;
|
|
17
|
-
* stylebookSelection: string | null;
|
|
18
|
-
* stylebookTab: string;
|
|
19
|
-
* stylebookFilter: string;
|
|
20
|
-
* stylebookCustomizedOnly: boolean;
|
|
21
|
-
* settingsTab: string;
|
|
22
|
-
* gitStatus: GitStatusResult | null;
|
|
23
|
-
* gitBranches: GitBranchesResult | null;
|
|
24
|
-
* gitCommitMessage: string;
|
|
25
|
-
* gitLoading: boolean;
|
|
26
|
-
* gitError: string | null;
|
|
27
|
-
* gitDiffState: GitDiffState | null;
|
|
28
|
-
* pendingInlineEdit: InlineEditDef | null;
|
|
29
|
-
* }} TabUi
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @typedef {{
|
|
34
|
-
* document: Record<string, unknown>;
|
|
35
|
-
* selection: (string | number)[] | null;
|
|
36
|
-
* }} HistorySnapshot
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @typedef {{
|
|
41
|
-
* id: string;
|
|
42
|
-
* documentPath: string | null;
|
|
43
|
-
* fileHandle: FileSystemFileHandle | null;
|
|
44
|
-
* capabilities: { modes: string[] };
|
|
45
|
-
* scope: { stop(): void; run<T>(fn: () => T): T | undefined; [k: string]: unknown };
|
|
46
|
-
* doc: {
|
|
47
|
-
* document: JxMutableNode;
|
|
48
|
-
* content: { frontmatter: Record<string, unknown> };
|
|
49
|
-
* mode: string;
|
|
50
|
-
* sourceFormat: string | null;
|
|
51
|
-
* handlersSource: string | null;
|
|
52
|
-
* dirty: boolean;
|
|
53
|
-
* };
|
|
54
|
-
* session: {
|
|
55
|
-
* selection: (string | number)[] | null;
|
|
56
|
-
* hover: (string | number)[] | null;
|
|
57
|
-
* clipboard: JxMutableNode | null;
|
|
58
|
-
* documentStack: DocumentStackEntry[];
|
|
59
|
-
* ui: TabUi;
|
|
60
|
-
* canvas: {
|
|
61
|
-
* status: string;
|
|
62
|
-
* scope: { stop(): void; [k: string]: unknown } | null;
|
|
63
|
-
* error: string | null;
|
|
64
|
-
* pendingInlineEdit: InlineEditDef | null;
|
|
65
|
-
* };
|
|
66
|
-
* };
|
|
67
|
-
* history: {
|
|
68
|
-
* snapshots: HistorySnapshot[];
|
|
69
|
-
* index: number;
|
|
70
|
-
* };
|
|
71
|
-
* }} Tab
|
|
72
|
-
*/
|
|
73
|
-
|
|
74
|
-
/** @returns {TabUi} */
|
|
75
|
-
function createDefaultUi() {
|
|
76
|
-
return {
|
|
77
|
-
rightTab: "properties",
|
|
78
|
-
canvasMode: "edit",
|
|
79
|
-
zoom: 1,
|
|
80
|
-
activeMedia: null,
|
|
81
|
-
activeSelector: null,
|
|
82
|
-
editingFunction: null,
|
|
83
|
-
featureToggles: {},
|
|
84
|
-
styleSections: {},
|
|
85
|
-
inspectorSections: {},
|
|
86
|
-
styleShorthands: {},
|
|
87
|
-
styleFilter: "",
|
|
88
|
-
styleFilterActive: false,
|
|
89
|
-
stylebookSelection: null,
|
|
90
|
-
stylebookTab: "elements",
|
|
91
|
-
stylebookFilter: "",
|
|
92
|
-
stylebookCustomizedOnly: false,
|
|
93
|
-
settingsTab: "stylebook",
|
|
94
|
-
gitStatus: null,
|
|
95
|
-
gitBranches: null,
|
|
96
|
-
gitCommitMessage: "",
|
|
97
|
-
gitLoading: false,
|
|
98
|
-
gitError: null,
|
|
99
|
-
gitDiffState: null,
|
|
100
|
-
pendingInlineEdit: null,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const ALL_MODES = ["edit", "design", "preview", "source", "stylebook"];
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Create a new tab with reactive doc/session/history trees, owned by an effectScope.
|
|
108
|
-
*
|
|
109
|
-
* @param {{
|
|
110
|
-
* id: string;
|
|
111
|
-
* documentPath?: string | null;
|
|
112
|
-
* fileHandle?: FileSystemFileHandle | null;
|
|
113
|
-
* document: Record<string, unknown>;
|
|
114
|
-
* frontmatter?: Record<string, unknown>;
|
|
115
|
-
* sourceFormat?: string | null;
|
|
116
|
-
* capabilities?: { modes?: string[] };
|
|
117
|
-
* }} opts
|
|
118
|
-
* @returns {Tab}
|
|
119
|
-
*/
|
|
120
|
-
export function createTab({
|
|
121
|
-
id,
|
|
122
|
-
documentPath = null,
|
|
123
|
-
fileHandle = null,
|
|
124
|
-
document,
|
|
125
|
-
frontmatter,
|
|
126
|
-
sourceFormat = null,
|
|
127
|
-
capabilities,
|
|
128
|
-
}) {
|
|
129
|
-
const scope = effectScope();
|
|
130
|
-
|
|
131
|
-
const resolvedModes = capabilities?.modes ?? inferModes(documentPath, sourceFormat);
|
|
132
|
-
|
|
133
|
-
const tab = /** @type {Tab} */ (
|
|
134
|
-
/** @type {unknown} */ (
|
|
135
|
-
scope.run(() => ({
|
|
136
|
-
id,
|
|
137
|
-
documentPath,
|
|
138
|
-
fileHandle,
|
|
139
|
-
capabilities: { modes: resolvedModes },
|
|
140
|
-
scope,
|
|
141
|
-
doc: reactive({
|
|
142
|
-
document,
|
|
143
|
-
sourceFormat,
|
|
144
|
-
content: { frontmatter: frontmatter || {} },
|
|
145
|
-
mode:
|
|
146
|
-
sourceFormat === "md"
|
|
147
|
-
? "content"
|
|
148
|
-
: documentPath?.endsWith(".md")
|
|
149
|
-
? "content"
|
|
150
|
-
: "component",
|
|
151
|
-
handlersSource: null,
|
|
152
|
-
dirty: false,
|
|
153
|
-
}),
|
|
154
|
-
session: reactive({
|
|
155
|
-
selection: null,
|
|
156
|
-
hover: null,
|
|
157
|
-
clipboard: null,
|
|
158
|
-
documentStack: [],
|
|
159
|
-
ui: createDefaultUi(),
|
|
160
|
-
canvas: { status: "idle", scope: null, error: null, pendingInlineEdit: null },
|
|
161
|
-
}),
|
|
162
|
-
history: reactive({
|
|
163
|
-
snapshots: [{ document: structuredClone(document), selection: null }],
|
|
164
|
-
index: 0,
|
|
165
|
-
}),
|
|
166
|
-
}))
|
|
167
|
-
)
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
return tab;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* @param {string | null | undefined} documentPath
|
|
175
|
-
* @param {string | null} sourceFormat
|
|
176
|
-
* @returns {string[]}
|
|
177
|
-
*/
|
|
178
|
-
function inferModes(documentPath, sourceFormat) {
|
|
179
|
-
if (documentPath === "project.json") return ["stylebook", "source"];
|
|
180
|
-
if (sourceFormat === "md" || documentPath?.endsWith(".md"))
|
|
181
|
-
return ["edit", "design", "preview", "source"];
|
|
182
|
-
return ALL_MODES;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Dispose a tab — stops its effectScope, killing all effects created within it.
|
|
187
|
-
*
|
|
188
|
-
* @param {Tab} tab
|
|
189
|
-
*/
|
|
190
|
-
export function disposeTab(tab) {
|
|
191
|
-
tab.scope.stop();
|
|
192
|
-
}
|
|
File without changes
|