@constela/runtime 0.16.1 → 0.16.3
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/index.js +16 -10
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -13604,7 +13604,9 @@ function createEventCallback(handler, ctx) {
|
|
|
13604
13604
|
payload = evaluatePayload(handler.payload, {
|
|
13605
13605
|
state: ctx.state,
|
|
13606
13606
|
locals: { ...ctx.locals, ...eventLocals },
|
|
13607
|
-
...ctx.
|
|
13607
|
+
...ctx.refs && { refs: ctx.refs },
|
|
13608
|
+
...ctx.imports && { imports: ctx.imports },
|
|
13609
|
+
...ctx.route && { route: ctx.route }
|
|
13608
13610
|
});
|
|
13609
13611
|
}
|
|
13610
13612
|
const actionCtx = {
|
|
@@ -13651,7 +13653,9 @@ function setupIntersectionObserver(el, handler, ctx) {
|
|
|
13651
13653
|
payload = evaluatePayload(handler.payload, {
|
|
13652
13654
|
state: ctx.state,
|
|
13653
13655
|
locals: { ...ctx.locals, ...intersectLocals },
|
|
13654
|
-
...ctx.
|
|
13656
|
+
...ctx.refs && { refs: ctx.refs },
|
|
13657
|
+
...ctx.imports && { imports: ctx.imports },
|
|
13658
|
+
...ctx.route && { route: ctx.route }
|
|
13655
13659
|
});
|
|
13656
13660
|
}
|
|
13657
13661
|
const actionCtx = {
|
|
@@ -13719,7 +13723,7 @@ function renderElement(node, ctx) {
|
|
|
13719
13723
|
}
|
|
13720
13724
|
} else {
|
|
13721
13725
|
const cleanup = createEffect(() => {
|
|
13722
|
-
const value = evaluate(propValue, { state: ctx.state, locals: ctx.locals, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } });
|
|
13726
|
+
const value = evaluate(propValue, { state: ctx.state, locals: ctx.locals, ...ctx.refs && { refs: ctx.refs }, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } });
|
|
13723
13727
|
applyProp(el, propName, value, useSvgNamespace);
|
|
13724
13728
|
});
|
|
13725
13729
|
ctx.cleanups?.push(cleanup);
|
|
@@ -13774,7 +13778,7 @@ function applyProp(el, propName, value, isSvg = false) {
|
|
|
13774
13778
|
function renderText(node, ctx) {
|
|
13775
13779
|
const textNode = document.createTextNode("");
|
|
13776
13780
|
const cleanup = createEffect(() => {
|
|
13777
|
-
const value = evaluate(node.value, { state: ctx.state, locals: ctx.locals, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } });
|
|
13781
|
+
const value = evaluate(node.value, { state: ctx.state, locals: ctx.locals, ...ctx.refs && { refs: ctx.refs }, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } });
|
|
13778
13782
|
textNode.textContent = formatValue(value);
|
|
13779
13783
|
});
|
|
13780
13784
|
ctx.cleanups?.push(cleanup);
|
|
@@ -13795,7 +13799,7 @@ function renderIf(node, ctx) {
|
|
|
13795
13799
|
let currentBranch = "none";
|
|
13796
13800
|
let branchCleanups = [];
|
|
13797
13801
|
const effectCleanup = createEffect(() => {
|
|
13798
|
-
const condition = evaluate(node.condition, { state: ctx.state, locals: ctx.locals, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } });
|
|
13802
|
+
const condition = evaluate(node.condition, { state: ctx.state, locals: ctx.locals, ...ctx.refs && { refs: ctx.refs }, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } });
|
|
13799
13803
|
const shouldShowThen = Boolean(condition);
|
|
13800
13804
|
const newBranch = shouldShowThen ? "then" : node.else ? "else" : "none";
|
|
13801
13805
|
if (newBranch !== currentBranch) {
|
|
@@ -13873,7 +13877,7 @@ function renderEach(node, ctx) {
|
|
|
13873
13877
|
let currentNodes = [];
|
|
13874
13878
|
let itemCleanups = [];
|
|
13875
13879
|
const effectCleanup = createEffect(() => {
|
|
13876
|
-
const items = evaluate(node.items, { state: ctx.state, locals: ctx.locals, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } });
|
|
13880
|
+
const items = evaluate(node.items, { state: ctx.state, locals: ctx.locals, ...ctx.refs && { refs: ctx.refs }, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } });
|
|
13877
13881
|
if (!hasKey || !node.key) {
|
|
13878
13882
|
for (const cleanup of itemCleanups) {
|
|
13879
13883
|
cleanup();
|
|
@@ -13930,7 +13934,9 @@ function renderEach(node, ctx) {
|
|
|
13930
13934
|
const keyValue = evaluate(node.key, {
|
|
13931
13935
|
state: ctx.state,
|
|
13932
13936
|
locals: tempLocals,
|
|
13933
|
-
...ctx.
|
|
13937
|
+
...ctx.refs && { refs: ctx.refs },
|
|
13938
|
+
...ctx.imports && { imports: ctx.imports },
|
|
13939
|
+
...ctx.route && { route: ctx.route }
|
|
13934
13940
|
});
|
|
13935
13941
|
if (seenKeys.has(keyValue)) {
|
|
13936
13942
|
if (typeof process !== "undefined" && process.env?.["NODE_ENV"] !== "production") {
|
|
@@ -14022,7 +14028,7 @@ function renderMarkdown(node, ctx) {
|
|
|
14022
14028
|
const container = document.createElement("div");
|
|
14023
14029
|
container.className = "constela-markdown";
|
|
14024
14030
|
const cleanup = createEffect(() => {
|
|
14025
|
-
const content = evaluate(node.content, { state: ctx.state, locals: ctx.locals, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } });
|
|
14031
|
+
const content = evaluate(node.content, { state: ctx.state, locals: ctx.locals, ...ctx.refs && { refs: ctx.refs }, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } });
|
|
14026
14032
|
const html6 = parseMarkdown(String(content ?? ""));
|
|
14027
14033
|
container.innerHTML = html6;
|
|
14028
14034
|
});
|
|
@@ -14037,8 +14043,8 @@ function renderCode(node, ctx) {
|
|
|
14037
14043
|
container.appendChild(pre);
|
|
14038
14044
|
pre.appendChild(codeEl);
|
|
14039
14045
|
const cleanup = createEffect(() => {
|
|
14040
|
-
const language = String(evaluate(node.language, { state: ctx.state, locals: ctx.locals, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } }) ?? "plaintext");
|
|
14041
|
-
const content = String(evaluate(node.content, { state: ctx.state, locals: ctx.locals, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } }) ?? "");
|
|
14046
|
+
const language = String(evaluate(node.language, { state: ctx.state, locals: ctx.locals, ...ctx.refs && { refs: ctx.refs }, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } }) ?? "plaintext");
|
|
14047
|
+
const content = String(evaluate(node.content, { state: ctx.state, locals: ctx.locals, ...ctx.refs && { refs: ctx.refs }, ...ctx.imports && { imports: ctx.imports }, ...ctx.route && { route: ctx.route } }) ?? "");
|
|
14042
14048
|
codeEl.className = `language-${language || "plaintext"}`;
|
|
14043
14049
|
codeEl.dataset["language"] = language || "plaintext";
|
|
14044
14050
|
container.dataset["language"] = language || "plaintext";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/runtime",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.3",
|
|
4
4
|
"description": "Runtime DOM renderer for Constela UI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"dompurify": "^3.3.1",
|
|
19
19
|
"marked": "^17.0.1",
|
|
20
20
|
"shiki": "^3.20.0",
|
|
21
|
-
"@constela/compiler": "0.11.
|
|
22
|
-
"@constela/core": "0.12.
|
|
21
|
+
"@constela/compiler": "0.11.3",
|
|
22
|
+
"@constela/core": "0.12.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/dompurify": "^3.2.0",
|