@constela/server 14.0.2 → 14.0.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.
- package/dist/index.js +15 -4
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/renderer.ts
|
|
2
|
-
import { isCookieInitialExpr } from "@constela/core";
|
|
2
|
+
import { isCookieInitialExpr, callChartHelper } from "@constela/core";
|
|
3
3
|
|
|
4
4
|
// src/markdown.ts
|
|
5
5
|
import { marked } from "marked";
|
|
@@ -505,7 +505,8 @@ function evaluate(expr, ctx) {
|
|
|
505
505
|
case "call": {
|
|
506
506
|
const callExpr = expr;
|
|
507
507
|
if (callExpr.target === null) {
|
|
508
|
-
|
|
508
|
+
const args2 = callExpr.args?.map((arg) => evaluate(arg, ctx)) ?? [];
|
|
509
|
+
return callChartHelper(callExpr.method, args2);
|
|
509
510
|
}
|
|
510
511
|
const target = evaluate(callExpr.target, ctx);
|
|
511
512
|
if (target == null) return void 0;
|
|
@@ -802,7 +803,12 @@ async function renderPortal(node, ctx) {
|
|
|
802
803
|
async function renderLocalState(node, ctx) {
|
|
803
804
|
const localStateValues = {};
|
|
804
805
|
for (const [name, field] of Object.entries(node.state)) {
|
|
805
|
-
|
|
806
|
+
const initial = field.initial;
|
|
807
|
+
if (initial && typeof initial === "object" && "expr" in initial) {
|
|
808
|
+
localStateValues[name] = evaluate(initial, ctx);
|
|
809
|
+
} else {
|
|
810
|
+
localStateValues[name] = initial;
|
|
811
|
+
}
|
|
806
812
|
}
|
|
807
813
|
const childCtx = {
|
|
808
814
|
...ctx,
|
|
@@ -1620,7 +1626,12 @@ async function renderPortalToStream(node, ctx) {
|
|
|
1620
1626
|
async function renderLocalStateToStream(node, ctx) {
|
|
1621
1627
|
const localStateValues = {};
|
|
1622
1628
|
for (const [name, field] of Object.entries(node.state)) {
|
|
1623
|
-
|
|
1629
|
+
const initial = field.initial;
|
|
1630
|
+
if (initial && typeof initial === "object" && "expr" in initial) {
|
|
1631
|
+
localStateValues[name] = evaluate2(initial, ctx);
|
|
1632
|
+
} else {
|
|
1633
|
+
localStateValues[name] = initial;
|
|
1634
|
+
}
|
|
1624
1635
|
}
|
|
1625
1636
|
const childCtx = {
|
|
1626
1637
|
...ctx,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/server",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.4",
|
|
4
4
|
"description": "Server-side rendering for Constela UI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@constela/compiler": "^0.15.
|
|
19
|
-
"@constela/core": "^0.18.
|
|
18
|
+
"@constela/compiler": "^0.15.9",
|
|
19
|
+
"@constela/core": "^0.18.3"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"isomorphic-dompurify": "^2.35.0",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"tsup": "^8.0.0",
|
|
30
30
|
"typescript": "^5.3.0",
|
|
31
31
|
"vitest": "^2.0.0",
|
|
32
|
-
"@constela/compiler": "0.15.
|
|
33
|
-
"@constela/core": "0.18.
|
|
32
|
+
"@constela/compiler": "0.15.9",
|
|
33
|
+
"@constela/core": "0.18.3"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=20.0.0"
|