@jxsuite/studio 0.19.0 → 0.21.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.css +98 -98
- package/dist/studio.js +13476 -12330
- package/dist/studio.js.map +152 -148
- package/dist/workers/editor.worker.js +79 -79
- package/dist/workers/json.worker.js +109 -109
- package/dist/workers/ts.worker.js +82 -82
- package/package.json +19 -7
- package/src/browse/browse-modal.js +16 -13
- package/src/browse/browse.js +44 -35
- package/src/canvas/canvas-diff.js +24 -16
- package/src/canvas/canvas-helpers.js +24 -19
- package/src/canvas/canvas-live-render.js +113 -39
- package/src/canvas/canvas-render.js +119 -73
- package/src/canvas/canvas-utils.js +51 -21
- package/src/canvas/nested-site-style.js +50 -0
- package/src/editor/component-inline-edit.js +14 -13
- package/src/editor/content-inline-edit.js +22 -10
- package/src/editor/context-menu.js +28 -14
- package/src/editor/convert-targets.js +60 -0
- package/src/editor/convert-to-component.js +20 -19
- package/src/editor/convert-to-repeater.js +226 -0
- package/src/editor/inline-edit.js +69 -28
- package/src/editor/insertion-helper.js +16 -12
- package/src/editor/shortcuts.js +14 -4
- package/src/editor/slash-menu.js +40 -19
- package/src/files/components.js +1 -1
- package/src/files/file-ops.js +37 -16
- package/src/files/files.js +322 -68
- package/src/github/github-auth.js +122 -0
- package/src/github/github-publish.js +126 -0
- package/src/markdown/md-convert.js +172 -107
- package/src/new-project/new-project-modal.js +204 -0
- package/src/panels/activity-bar.js +27 -25
- package/src/panels/ai-panel.js +406 -0
- package/src/panels/block-action-bar.js +77 -28
- package/src/panels/canvas-dnd.js +8 -2
- package/src/panels/data-explorer.js +19 -13
- package/src/panels/dnd.js +144 -92
- package/src/panels/editors.js +55 -35
- package/src/panels/elements-panel.js +33 -19
- package/src/panels/events-panel.js +15 -10
- package/src/panels/git-panel.js +475 -99
- package/src/panels/head-panel.js +121 -81
- package/src/panels/imports-panel.js +94 -65
- package/src/panels/layers-panel.js +64 -43
- package/src/panels/left-panel.js +105 -48
- package/src/panels/overlays.js +1 -0
- package/src/panels/panel-events.js +45 -30
- package/src/panels/preview-render.js +23 -18
- package/src/panels/properties-panel.js +378 -257
- package/src/panels/pseudo-preview.js +2 -2
- package/src/panels/quick-search.js +11 -9
- package/src/panels/right-panel.js +42 -16
- package/src/panels/shared.js +4 -4
- package/src/panels/signals-panel.js +415 -166
- package/src/panels/statusbar.js +10 -6
- package/src/panels/style-inputs.js +67 -35
- package/src/panels/style-panel.js +239 -134
- package/src/panels/style-utils.js +34 -16
- package/src/panels/stylebook-layers-panel.js +12 -10
- package/src/panels/stylebook-panel.js +134 -66
- package/src/panels/tab-strip.js +5 -2
- package/src/panels/toolbar.js +333 -109
- package/src/panels/welcome-screen.js +121 -0
- package/src/platform.js +2 -4
- package/src/platforms/devserver.js +113 -7
- package/src/resize-edges.js +98 -0
- package/src/services/cem-export.js +12 -7
- package/src/services/code-services.js +30 -12
- package/src/settings/content-types-editor.js +8 -8
- package/src/settings/css-vars-editor.js +30 -24
- package/src/settings/defs-editor.js +12 -7
- package/src/settings/general-settings.js +85 -3
- package/src/settings/head-editor.js +30 -24
- package/src/settings/schema-field-ui.js +58 -39
- package/src/settings/settings-modal.js +12 -9
- package/src/site-context.js +41 -31
- package/src/state.js +70 -29
- package/src/store.js +36 -35
- package/src/studio.js +120 -90
- package/src/tabs/tab.js +67 -43
- package/src/tabs/transact.js +23 -13
- package/src/ui/button-group.js +24 -24
- package/src/ui/color-selector.js +28 -23
- package/src/ui/field-row.js +3 -3
- package/src/ui/icons.js +2 -2
- package/src/ui/layers.js +31 -1
- package/src/ui/media-picker.js +7 -7
- package/src/ui/spectrum.js +5 -1
- package/src/ui/unit-selector.js +18 -16
- package/src/ui/value-selector.js +21 -15
- package/src/ui/widgets.js +22 -19
- package/src/utils/canvas-media.js +5 -4
- package/src/utils/edit-display.js +32 -26
- package/src/utils/google-fonts.js +11 -11
- package/src/utils/inherited-style.js +9 -8
- package/src/utils/studio-utils.js +18 -18
- package/src/view.js +58 -1
- package/src/workspace/workspace.js +29 -7
|
@@ -8,17 +8,23 @@ import { view } from "../view.js";
|
|
|
8
8
|
import { getEffectiveElements } from "../site-context.js";
|
|
9
9
|
import { componentRegistry } from "../files/components.js";
|
|
10
10
|
|
|
11
|
+
/** @typedef {import("../files/components.js").ComponentEntry} ComponentEntry */
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
|
-
* @param {{
|
|
14
|
+
* @param {{
|
|
15
|
+
* webdata: { elements: Record<string, { tag: string }[]> };
|
|
16
|
+
* defaultDef: (tag: string) => JxMutableNode;
|
|
17
|
+
* rerender: () => void;
|
|
18
|
+
* }} ctx
|
|
13
19
|
* @returns {import("lit-html").TemplateResult}
|
|
14
20
|
*/
|
|
15
21
|
export function renderElementsTemplate(ctx) {
|
|
16
22
|
const tab = activeTab.value;
|
|
17
23
|
|
|
18
24
|
const categories = Object.entries(ctx.webdata.elements).map(
|
|
19
|
-
(/** @type {
|
|
25
|
+
(/** @type {[string, { tag: string }[]]} */ [category, elements]) => {
|
|
20
26
|
const filtered = view.elementsFilter
|
|
21
|
-
? elements.filter((/** @type {
|
|
27
|
+
? elements.filter((/** @type {{ tag: string }} */ e) => e.tag.includes(view.elementsFilter))
|
|
22
28
|
: elements;
|
|
23
29
|
if (filtered.length === 0) return nothing;
|
|
24
30
|
|
|
@@ -26,12 +32,13 @@ export function renderElementsTemplate(ctx) {
|
|
|
26
32
|
<sp-accordion-item
|
|
27
33
|
label=${category}
|
|
28
34
|
?open=${!view.elementsCollapsed.has(category)}
|
|
29
|
-
@sp-accordion-item-toggle=${(/** @type {
|
|
30
|
-
if (e.target.open)
|
|
35
|
+
@sp-accordion-item-toggle=${(/** @type {Event} */ e) => {
|
|
36
|
+
if (/** @type {HTMLElement & { open: boolean }} */ (e.target).open)
|
|
37
|
+
view.elementsCollapsed.delete(category);
|
|
31
38
|
else view.elementsCollapsed.add(category);
|
|
32
39
|
}}
|
|
33
40
|
>
|
|
34
|
-
${filtered.map((/** @type {
|
|
41
|
+
${filtered.map((/** @type {{ tag: string }} */ { tag }) => {
|
|
35
42
|
const def = ctx.defaultDef(tag);
|
|
36
43
|
return html`
|
|
37
44
|
<div
|
|
@@ -57,13 +64,15 @@ export function renderElementsTemplate(ctx) {
|
|
|
57
64
|
},
|
|
58
65
|
);
|
|
59
66
|
|
|
60
|
-
const effectiveEls = getEffectiveElements(
|
|
67
|
+
const effectiveEls = getEffectiveElements(
|
|
68
|
+
/** @type {(string | JxElement)[] | undefined} */ (tab?.doc.document?.$elements),
|
|
69
|
+
);
|
|
61
70
|
/** @type {Set<string>} */
|
|
62
71
|
const enabledTags = new Set();
|
|
63
72
|
for (const entry of effectiveEls) {
|
|
64
73
|
if (typeof entry !== "string") continue;
|
|
65
74
|
const comp = componentRegistry.find(
|
|
66
|
-
(/** @type {
|
|
75
|
+
(/** @type {ComponentEntry} */ c) =>
|
|
67
76
|
c.source === "npm" && c.modulePath && entry === `${c.package}/${c.modulePath}`,
|
|
68
77
|
);
|
|
69
78
|
if (comp) {
|
|
@@ -77,9 +86,11 @@ export function renderElementsTemplate(ctx) {
|
|
|
77
86
|
const compsFiltered =
|
|
78
87
|
componentRegistry.length > 0
|
|
79
88
|
? componentRegistry
|
|
80
|
-
.filter((/** @type {any} */ c) => c.source !== "npm" || enabledTags.has(c.tagName))
|
|
81
89
|
.filter(
|
|
82
|
-
(/** @type {
|
|
90
|
+
(/** @type {ComponentEntry} */ c) => c.source !== "npm" || enabledTags.has(c.tagName),
|
|
91
|
+
)
|
|
92
|
+
.filter(
|
|
93
|
+
(/** @type {ComponentEntry} */ c) =>
|
|
83
94
|
!view.elementsFilter || c.tagName.toLowerCase().includes(view.elementsFilter),
|
|
84
95
|
)
|
|
85
96
|
: [];
|
|
@@ -90,14 +101,15 @@ export function renderElementsTemplate(ctx) {
|
|
|
90
101
|
<sp-accordion-item
|
|
91
102
|
label="Components"
|
|
92
103
|
?open=${!view.elementsCollapsed.has("Components")}
|
|
93
|
-
@sp-accordion-item-toggle=${(/** @type {
|
|
94
|
-
if (e.target.open)
|
|
104
|
+
@sp-accordion-item-toggle=${(/** @type {Event} */ e) => {
|
|
105
|
+
if (/** @type {HTMLElement & { open: boolean }} */ (e.target).open)
|
|
106
|
+
view.elementsCollapsed.delete("Components");
|
|
95
107
|
else view.elementsCollapsed.add("Components");
|
|
96
108
|
}}
|
|
97
109
|
>
|
|
98
110
|
<div class="components-section">
|
|
99
111
|
${compsFiltered.map(
|
|
100
|
-
(/** @type {
|
|
112
|
+
(/** @type {ComponentEntry} */ comp) => html`
|
|
101
113
|
<div
|
|
102
114
|
class="element-card"
|
|
103
115
|
data-component-tag=${comp.tagName}
|
|
@@ -112,10 +124,12 @@ export function renderElementsTemplate(ctx) {
|
|
|
112
124
|
const instanceDef = {
|
|
113
125
|
tagName: comp.tagName,
|
|
114
126
|
$props: Object.fromEntries(
|
|
115
|
-
(comp.props || []).map(
|
|
116
|
-
p
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
(comp.props || []).map(
|
|
128
|
+
(/** @type {{ name: string; default?: unknown }} */ p) => [
|
|
129
|
+
p.name,
|
|
130
|
+
p.default !== undefined ? p.default : "",
|
|
131
|
+
],
|
|
132
|
+
),
|
|
119
133
|
),
|
|
120
134
|
};
|
|
121
135
|
transactDoc(t, (tr) =>
|
|
@@ -142,8 +156,8 @@ export function renderElementsTemplate(ctx) {
|
|
|
142
156
|
size="s"
|
|
143
157
|
placeholder="Filter elements…"
|
|
144
158
|
value=${view.elementsFilter}
|
|
145
|
-
@input=${(/** @type {
|
|
146
|
-
view.elementsFilter = e.target.value.toLowerCase();
|
|
159
|
+
@input=${(/** @type {Event} */ e) => {
|
|
160
|
+
view.elementsFilter = /** @type {HTMLInputElement} */ (e.target).value.toLowerCase();
|
|
147
161
|
ctx.rerender();
|
|
148
162
|
}}
|
|
149
163
|
></sp-search>
|
|
@@ -33,7 +33,7 @@ export function eventsSidebarTemplate(helpers) {
|
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
// Declared CEM events (custom element docs)
|
|
36
|
-
/** @type {
|
|
36
|
+
/** @type {unknown} */
|
|
37
37
|
let declaredEventsT = nothing;
|
|
38
38
|
if (isCustomElementDoc()) {
|
|
39
39
|
const allEmits = [];
|
|
@@ -86,8 +86,8 @@ export function eventsSidebarTemplate(helpers) {
|
|
|
86
86
|
size="s"
|
|
87
87
|
class="event-name"
|
|
88
88
|
.value=${live(evKey)}
|
|
89
|
-
@change=${(/** @type {
|
|
90
|
-
const newKey = e.target.value;
|
|
89
|
+
@change=${(/** @type {Event} */ e) => {
|
|
90
|
+
const newKey = /** @type {HTMLInputElement} */ (e.target).value;
|
|
91
91
|
if (newKey && newKey !== evKey) {
|
|
92
92
|
transactDoc(activeTab.value, (t) => {
|
|
93
93
|
mutateUpdateProperty(t, selection, evKey, undefined);
|
|
@@ -104,8 +104,8 @@ export function eventsSidebarTemplate(helpers) {
|
|
|
104
104
|
size="s"
|
|
105
105
|
class="event-mode"
|
|
106
106
|
.value=${live(isInline ? "inline" : "ref")}
|
|
107
|
-
@change=${(/** @type {
|
|
108
|
-
if (e.target.value === "inline") {
|
|
107
|
+
@change=${(/** @type {Event} */ e) => {
|
|
108
|
+
if (/** @type {HTMLInputElement} */ (e.target).value === "inline") {
|
|
109
109
|
transactDoc(activeTab.value, (t) =>
|
|
110
110
|
mutateUpdateProperty(t, selection, evKey, {
|
|
111
111
|
$prototype: "Function",
|
|
@@ -149,11 +149,11 @@ export function eventsSidebarTemplate(helpers) {
|
|
|
149
149
|
grows
|
|
150
150
|
placeholder="// handler body"
|
|
151
151
|
.value=${live(evVal.body || "")}
|
|
152
|
-
@input=${(/** @type {
|
|
152
|
+
@input=${(/** @type {Event} */ e) => {
|
|
153
153
|
transactDoc(activeTab.value, (t) =>
|
|
154
154
|
mutateUpdateProperty(t, selection, evKey, {
|
|
155
155
|
$prototype: "Function",
|
|
156
|
-
body: e.target.value,
|
|
156
|
+
body: /** @type {HTMLInputElement} */ (e.target).value,
|
|
157
157
|
parameters: evVal.parameters || [],
|
|
158
158
|
}),
|
|
159
159
|
);
|
|
@@ -181,10 +181,15 @@ export function eventsSidebarTemplate(helpers) {
|
|
|
181
181
|
size="s"
|
|
182
182
|
class="event-handler"
|
|
183
183
|
.value=${live(evVal.$ref || "__none__")}
|
|
184
|
-
@change=${(/** @type {
|
|
185
|
-
if (
|
|
184
|
+
@change=${(/** @type {Event} */ e) => {
|
|
185
|
+
if (
|
|
186
|
+
/** @type {HTMLInputElement} */ (e.target).value &&
|
|
187
|
+
/** @type {HTMLInputElement} */ (e.target).value !== "__none__"
|
|
188
|
+
) {
|
|
186
189
|
transactDoc(activeTab.value, (t) =>
|
|
187
|
-
mutateUpdateProperty(t, selection, evKey, {
|
|
190
|
+
mutateUpdateProperty(t, selection, evKey, {
|
|
191
|
+
$ref: /** @type {HTMLInputElement} */ (e.target).value,
|
|
192
|
+
}),
|
|
188
193
|
);
|
|
189
194
|
} else {
|
|
190
195
|
transactDoc(activeTab.value, (t) =>
|