@jxsuite/studio 1.3.0 → 1.5.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/LICENSE +21 -0
- package/canvas.html +51 -0
- package/dist/iframe-entry.js +24 -10
- package/dist/iframe-entry.js.map +4 -4
- package/dist/studio.js +1418 -267
- package/dist/studio.js.map +10 -10
- package/dist/workers/ts.worker.js +4 -2
- package/fonts/OFL.txt +93 -0
- package/fonts/jetbrains-mono-400.woff2 +0 -0
- package/fonts/jetbrains-mono-500.woff2 +0 -0
- package/fonts/jetbrains-mono-700.woff2 +0 -0
- package/index.html +4631 -0
- package/package.json +14 -11
- package/src/editor/convert-to-component.ts +1 -1
- package/src/editor/convert-to-repeater.ts +1 -1
- package/src/new-project/add-repo-modal.ts +75 -14
- package/src/new-project/new-project-modal.ts +45 -18
- package/src/panels/welcome-screen.ts +15 -1
- package/src/platforms/cloud.ts +5 -3
- package/src/studio.ts +20 -3
- package/src/types.ts +8 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kevin Shenk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/canvas.html
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>Jx Canvas</title>
|
|
7
|
+
<style>
|
|
8
|
+
html,
|
|
9
|
+
body {
|
|
10
|
+
margin: 0;
|
|
11
|
+
height: 100%;
|
|
12
|
+
/* The iframe is sized to its content and NEVER scrolls internally (the parent canvas pans
|
|
13
|
+
instead, and the parent overlay can't track an internal scroll). Clip here to enforce that:
|
|
14
|
+
when the content is shorter than the fixed 800px query viewport below, the viewport's empty
|
|
15
|
+
excess would otherwise become a scrollbar exposing the white iframe background. */
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
/* Fixed-size query container. The runtime transposes the document's viewport units (vh/vw/…) to
|
|
19
|
+
container units (cqh/cqw/…) in the studio canvas (see runtime `transposeCanvasUnits`), so they
|
|
20
|
+
resolve against THIS predictable design-viewport box instead of the iframe element. That
|
|
21
|
+
decouples them from the iframe's height, so the host can size the iframe to its content height
|
|
22
|
+
(no internal scroll → the parent overlay stays glued) without a `100vh` section feeding back
|
|
23
|
+
into an ever-growing height. `#jx-canvas-root` overflows this box freely (no paint/overflow
|
|
24
|
+
containment) and is what the host measures. */
|
|
25
|
+
#jx-canvas-viewport {
|
|
26
|
+
container-type: size;
|
|
27
|
+
container-name: jx-canvas;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: var(--jx-design-viewport-height, 800px);
|
|
30
|
+
}
|
|
31
|
+
#jx-canvas-root {
|
|
32
|
+
min-height: 100%;
|
|
33
|
+
}
|
|
34
|
+
/* A page's root should fill the design viewport (short pages still look like real pages —
|
|
35
|
+
footer at the bottom, full-height heroes). A component DEFINITION is a fragment, not a page:
|
|
36
|
+
flooring it to the viewport leaves dead space below a short component. When the render stamps
|
|
37
|
+
the root as a definition (see makeStamper's `data-jx-definition-root`), drop the floor so the
|
|
38
|
+
host sizes the iframe to the component's own content. */
|
|
39
|
+
#jx-canvas-root:has(> [data-jx-definition-root]) {
|
|
40
|
+
min-height: 0;
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
43
|
+
</head>
|
|
44
|
+
<body>
|
|
45
|
+
<div id="jx-canvas-viewport"><div id="jx-canvas-root"></div></div>
|
|
46
|
+
<!-- Dev: cache-bust so each iframe mount loads the freshest canvas bundle. -->
|
|
47
|
+
<script type="module">
|
|
48
|
+
import(`./dist/iframe-entry.js?t=${Date.now()}`);
|
|
49
|
+
</script>
|
|
50
|
+
</body>
|
|
51
|
+
</html>
|
package/dist/iframe-entry.js
CHANGED
|
@@ -649,7 +649,7 @@ function track(target, type, key) {
|
|
|
649
649
|
type,
|
|
650
650
|
key
|
|
651
651
|
});
|
|
652
|
-
}
|
|
652
|
+
} else {}
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
655
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
@@ -669,7 +669,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
669
669
|
oldValue,
|
|
670
670
|
oldTarget
|
|
671
671
|
});
|
|
672
|
-
}
|
|
672
|
+
} else {}
|
|
673
673
|
}
|
|
674
674
|
};
|
|
675
675
|
startBatch();
|
|
@@ -1334,7 +1334,7 @@ class RefImpl {
|
|
|
1334
1334
|
type: "get",
|
|
1335
1335
|
key: "value"
|
|
1336
1336
|
});
|
|
1337
|
-
}
|
|
1337
|
+
} else {}
|
|
1338
1338
|
return this._value;
|
|
1339
1339
|
}
|
|
1340
1340
|
set value(newValue) {
|
|
@@ -1352,7 +1352,7 @@ class RefImpl {
|
|
|
1352
1352
|
newValue,
|
|
1353
1353
|
oldValue
|
|
1354
1354
|
});
|
|
1355
|
-
}
|
|
1355
|
+
} else {}
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
1358
1358
|
}
|
|
@@ -1954,6 +1954,12 @@ var SCHEMA_KEYWORDS = new Set([
|
|
|
1954
1954
|
function isMappedArray(value) {
|
|
1955
1955
|
return isJsonObject(value) && value.$prototype === "Array";
|
|
1956
1956
|
}
|
|
1957
|
+
function isTemplateString(value) {
|
|
1958
|
+
return typeof value === "string" && value.includes("${");
|
|
1959
|
+
}
|
|
1960
|
+
function bodyReturnsValue(body) {
|
|
1961
|
+
return /\breturn\b/.test(body);
|
|
1962
|
+
}
|
|
1957
1963
|
function isEventBinding(value) {
|
|
1958
1964
|
return isRef2(value) || isFunctionDef(value) || isExpressionDef(value);
|
|
1959
1965
|
}
|
|
@@ -2347,9 +2353,9 @@ async function resolveFunction(def2, state, key, base) {
|
|
|
2347
2353
|
let isComputed = false;
|
|
2348
2354
|
if (!hasParams) {
|
|
2349
2355
|
if (typeof def2.body === "string") {
|
|
2350
|
-
isComputed =
|
|
2356
|
+
isComputed = bodyReturnsValue(def2.body);
|
|
2351
2357
|
} else if (fn) {
|
|
2352
|
-
isComputed = fn.length <= 1 &&
|
|
2358
|
+
isComputed = fn.length <= 1 && bodyReturnsValue(fn.toString());
|
|
2353
2359
|
}
|
|
2354
2360
|
}
|
|
2355
2361
|
if (isComputed) {
|
|
@@ -2395,6 +2401,7 @@ var RESERVED_KEYS = new Set([
|
|
|
2395
2401
|
"cases",
|
|
2396
2402
|
"observedAttributes"
|
|
2397
2403
|
]);
|
|
2404
|
+
var warnedRefChildren = new Set;
|
|
2398
2405
|
function renderNode(def2, state, options) {
|
|
2399
2406
|
const path = options?._path ?? [];
|
|
2400
2407
|
if (typeof def2 === "string" || typeof def2 === "number" || typeof def2 === "boolean") {
|
|
@@ -2415,12 +2422,22 @@ function renderNode(def2, state, options) {
|
|
|
2415
2422
|
localState[key] = isRefObj(val) ? resolveRef(val.$ref, state) : val;
|
|
2416
2423
|
}
|
|
2417
2424
|
}
|
|
2425
|
+
if ("$ref" in def2 && !def2.tagName) {
|
|
2426
|
+
const refTarget = String(def2.$ref ?? "");
|
|
2427
|
+
if (!warnedRefChildren.has(refTarget)) {
|
|
2428
|
+
warnedRefChildren.add(refTarget);
|
|
2429
|
+
console.warn(`Jx: a $ref child ("${refTarget}") is not a supported component instance; register the ` + `component in $elements and use its custom-element tag instead (spec §13).`);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2418
2432
|
const tagName = def2.tagName ?? "div";
|
|
2419
2433
|
const isCustomEl = tagName.includes("-") && customElements.get(tagName);
|
|
2420
2434
|
if (def2.$props && isCustomEl) {
|
|
2421
2435
|
return renderCustomElementWithProps(def2, localState, options, path);
|
|
2422
2436
|
}
|
|
2423
2437
|
if (def2.$props) {
|
|
2438
|
+
if (tagName.includes("-")) {
|
|
2439
|
+
return renderCustomElementWithProps(def2, localState, options, path);
|
|
2440
|
+
}
|
|
2424
2441
|
const { $props: _$props, ...rest } = def2;
|
|
2425
2442
|
return renderNode(rest, mergeProps(def2, localState), options);
|
|
2426
2443
|
}
|
|
@@ -2451,9 +2468,6 @@ function renderNode(def2, state, options) {
|
|
|
2451
2468
|
}
|
|
2452
2469
|
return el;
|
|
2453
2470
|
}
|
|
2454
|
-
function isTemplateString(val) {
|
|
2455
|
-
return typeof val === "string" && val.includes("${");
|
|
2456
|
-
}
|
|
2457
2471
|
function applyProperties(el, def2, state) {
|
|
2458
2472
|
for (const [key, val] of Object.entries(def2)) {
|
|
2459
2473
|
if (RESERVED_KEYS.has(key)) {
|
|
@@ -6938,5 +6952,5 @@ export {
|
|
|
6938
6952
|
bootCanvasIframe
|
|
6939
6953
|
};
|
|
6940
6954
|
|
|
6941
|
-
//# debugId=
|
|
6955
|
+
//# debugId=81835478E00D339C64756E2164756E21
|
|
6942
6956
|
//# sourceMappingURL=iframe-entry.js.map
|