@constela/runtime 2.0.7 → 2.0.8
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 +2 -33
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -974,7 +974,6 @@ var GLOBAL_FUNCTIONS = {
|
|
|
974
974
|
getRadarAxes: (labels, cx, cy, radius) => getRadarAxes(labels, cx, cy, radius),
|
|
975
975
|
// Chart helpers - Utilities
|
|
976
976
|
getChartBounds: (data, valueKey) => getChartBounds(data, valueKey),
|
|
977
|
-
getLinePoints: (data, valueKey, width, height, padding) => getLinePoints(data, valueKey, width, height, padding),
|
|
978
977
|
generateTicks: (min, max, count) => generateTicks(min, max, count),
|
|
979
978
|
// Chart helpers - Data aggregation
|
|
980
979
|
binData: (data, valueKey, binCount) => binData(data, valueKey, binCount),
|
|
@@ -1592,26 +1591,6 @@ function getChartBounds(data, valueKey) {
|
|
|
1592
1591
|
max: Math.max(...values)
|
|
1593
1592
|
};
|
|
1594
1593
|
}
|
|
1595
|
-
function getLinePoints(data, valueKey, width, height, padding) {
|
|
1596
|
-
if (!Array.isArray(data) || data.length === 0) return void 0;
|
|
1597
|
-
if (typeof valueKey !== "string") return void 0;
|
|
1598
|
-
if (typeof width !== "number" || typeof height !== "number") return void 0;
|
|
1599
|
-
if (width <= 0 || height <= 0) return void 0;
|
|
1600
|
-
const pad = typeof padding === "number" ? padding : 40;
|
|
1601
|
-
if (typeof padding !== "undefined" && typeof padding !== "number") return void 0;
|
|
1602
|
-
const bounds = getChartBounds(data, valueKey);
|
|
1603
|
-
if (!bounds) return void 0;
|
|
1604
|
-
const { min, max } = bounds;
|
|
1605
|
-
const chartWidth = width - pad * 2;
|
|
1606
|
-
const chartHeight = height - pad * 2;
|
|
1607
|
-
return data.map((item, idx) => {
|
|
1608
|
-
const value = item[valueKey];
|
|
1609
|
-
if (typeof value !== "number") return { x: 0, y: 0 };
|
|
1610
|
-
const x2 = data.length === 1 ? pad : pad + idx / (data.length - 1) * chartWidth;
|
|
1611
|
-
const y2 = min === max ? pad + chartHeight / 2 : pad + chartHeight - scaleValue(value, min, max, 0, chartHeight);
|
|
1612
|
-
return { x: x2, y: y2 };
|
|
1613
|
-
});
|
|
1614
|
-
}
|
|
1615
1594
|
function generateTicks(min, max, count) {
|
|
1616
1595
|
if (typeof min !== "number" || typeof max !== "number" || typeof count !== "number") {
|
|
1617
1596
|
return [];
|
|
@@ -15568,17 +15547,13 @@ function renderPortal(node, ctx) {
|
|
|
15568
15547
|
}
|
|
15569
15548
|
function createLocalStateStore(stateDefs, ctx) {
|
|
15570
15549
|
const signals = {};
|
|
15571
|
-
const evaluatedValues = {};
|
|
15572
15550
|
for (const [name, def] of Object.entries(stateDefs)) {
|
|
15573
15551
|
const initial = def.initial;
|
|
15574
15552
|
let initialValue;
|
|
15575
15553
|
if (initial && typeof initial === "object" && "expr" in initial) {
|
|
15576
15554
|
const evalCtx = {
|
|
15577
15555
|
state: ctx.state,
|
|
15578
|
-
locals:
|
|
15579
|
-
...ctx.locals,
|
|
15580
|
-
...evaluatedValues
|
|
15581
|
-
}
|
|
15556
|
+
locals: ctx.locals
|
|
15582
15557
|
};
|
|
15583
15558
|
if (ctx.route) evalCtx.route = ctx.route;
|
|
15584
15559
|
if (ctx.imports) evalCtx.imports = ctx.imports;
|
|
@@ -15587,7 +15562,6 @@ function createLocalStateStore(stateDefs, ctx) {
|
|
|
15587
15562
|
initialValue = initial;
|
|
15588
15563
|
}
|
|
15589
15564
|
signals[name] = createSignal(initialValue);
|
|
15590
|
-
evaluatedValues[name] = initialValue;
|
|
15591
15565
|
}
|
|
15592
15566
|
return {
|
|
15593
15567
|
get(name) {
|
|
@@ -15918,17 +15892,13 @@ function createReactiveLocals2(baseLocals, itemSignal, indexSignal, itemName, in
|
|
|
15918
15892
|
}
|
|
15919
15893
|
function createLocalStateStore2(stateDefs, ctx) {
|
|
15920
15894
|
const signals = {};
|
|
15921
|
-
const evaluatedValues = {};
|
|
15922
15895
|
for (const [name, def] of Object.entries(stateDefs)) {
|
|
15923
15896
|
const initial = def.initial;
|
|
15924
15897
|
let initialValue;
|
|
15925
15898
|
if (initial && typeof initial === "object" && "expr" in initial) {
|
|
15926
15899
|
const evalCtx = {
|
|
15927
15900
|
state: ctx.state,
|
|
15928
|
-
locals:
|
|
15929
|
-
...ctx.locals,
|
|
15930
|
-
...evaluatedValues
|
|
15931
|
-
}
|
|
15901
|
+
locals: ctx.locals
|
|
15932
15902
|
};
|
|
15933
15903
|
if (ctx.route) evalCtx.route = ctx.route;
|
|
15934
15904
|
if (ctx.imports) evalCtx.imports = ctx.imports;
|
|
@@ -15937,7 +15907,6 @@ function createLocalStateStore2(stateDefs, ctx) {
|
|
|
15937
15907
|
initialValue = initial;
|
|
15938
15908
|
}
|
|
15939
15909
|
signals[name] = createSignal(initialValue);
|
|
15940
|
-
evaluatedValues[name] = initialValue;
|
|
15941
15910
|
}
|
|
15942
15911
|
return {
|
|
15943
15912
|
get(name) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constela/runtime",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
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.15.
|
|
22
|
-
"@constela/core": "0.18.
|
|
21
|
+
"@constela/compiler": "0.15.11",
|
|
22
|
+
"@constela/core": "0.18.5"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/dompurify": "^3.2.0",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"tsup": "^8.0.0",
|
|
30
30
|
"typescript": "^5.3.0",
|
|
31
31
|
"vitest": "^2.0.0",
|
|
32
|
-
"@constela/server": "14.0.
|
|
32
|
+
"@constela/server": "14.0.6"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@constela/ai": "3.0.
|
|
35
|
+
"@constela/ai": "3.0.5"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@constela/ai": {
|