@founderhq/journeys 0.3.65 → 0.3.67
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.cjs +627 -336
- package/dist/index.d.cts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +627 -336
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -753,7 +753,8 @@ function JourneyProvider({
|
|
|
753
753
|
const currentStep = config.steps[currentStepIndex];
|
|
754
754
|
const routing = currentStep.routing;
|
|
755
755
|
if (routing) {
|
|
756
|
-
|
|
756
|
+
const conditions = Array.isArray(routing.conditions) ? routing.conditions : [];
|
|
757
|
+
for (const rule of conditions) {
|
|
757
758
|
if (evaluateRoutingRule(rule, currentAnswers)) {
|
|
758
759
|
const idx = config.steps.findIndex((s) => s.id === rule.goTo);
|
|
759
760
|
if (idx >= 0) return idx;
|
|
@@ -1197,19 +1198,225 @@ var renderTemplate = (template, variables, fallback) => {
|
|
|
1197
1198
|
};
|
|
1198
1199
|
|
|
1199
1200
|
// src/blocks/resolve-template.ts
|
|
1200
|
-
|
|
1201
|
+
var VALID_IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
1202
|
+
var IDENTIFIER_TOKEN_RE = /[A-Za-z_$][A-Za-z0-9_$]*/g;
|
|
1203
|
+
var RESERVED_IDENTIFIERS = /* @__PURE__ */ new Set([
|
|
1204
|
+
"arguments",
|
|
1205
|
+
"await",
|
|
1206
|
+
"break",
|
|
1207
|
+
"case",
|
|
1208
|
+
"catch",
|
|
1209
|
+
"class",
|
|
1210
|
+
"const",
|
|
1211
|
+
"continue",
|
|
1212
|
+
"debugger",
|
|
1213
|
+
"default",
|
|
1214
|
+
"delete",
|
|
1215
|
+
"do",
|
|
1216
|
+
"else",
|
|
1217
|
+
"enum",
|
|
1218
|
+
"eval",
|
|
1219
|
+
"export",
|
|
1220
|
+
"extends",
|
|
1221
|
+
"false",
|
|
1222
|
+
"finally",
|
|
1223
|
+
"for",
|
|
1224
|
+
"function",
|
|
1225
|
+
"if",
|
|
1226
|
+
"implements",
|
|
1227
|
+
"import",
|
|
1228
|
+
"in",
|
|
1229
|
+
"instanceof",
|
|
1230
|
+
"interface",
|
|
1231
|
+
"let",
|
|
1232
|
+
"new",
|
|
1233
|
+
"null",
|
|
1234
|
+
"package",
|
|
1235
|
+
"private",
|
|
1236
|
+
"protected",
|
|
1237
|
+
"public",
|
|
1238
|
+
"return",
|
|
1239
|
+
"static",
|
|
1240
|
+
"super",
|
|
1241
|
+
"switch",
|
|
1242
|
+
"this",
|
|
1243
|
+
"throw",
|
|
1244
|
+
"true",
|
|
1245
|
+
"try",
|
|
1246
|
+
"typeof",
|
|
1247
|
+
"undefined",
|
|
1248
|
+
"var",
|
|
1249
|
+
"void",
|
|
1250
|
+
"while",
|
|
1251
|
+
"with",
|
|
1252
|
+
"yield"
|
|
1253
|
+
]);
|
|
1254
|
+
var GLOBAL_IDENTIFIERS = /* @__PURE__ */ new Set([
|
|
1255
|
+
"Array",
|
|
1256
|
+
"BigInt",
|
|
1257
|
+
"Boolean",
|
|
1258
|
+
"Date",
|
|
1259
|
+
"Error",
|
|
1260
|
+
"Infinity",
|
|
1261
|
+
"Intl",
|
|
1262
|
+
"JSON",
|
|
1263
|
+
"Map",
|
|
1264
|
+
"Math",
|
|
1265
|
+
"NaN",
|
|
1266
|
+
"Number",
|
|
1267
|
+
"Object",
|
|
1268
|
+
"Promise",
|
|
1269
|
+
"RegExp",
|
|
1270
|
+
"Set",
|
|
1271
|
+
"String",
|
|
1272
|
+
"Symbol",
|
|
1273
|
+
"URL",
|
|
1274
|
+
"URLSearchParams",
|
|
1275
|
+
"WeakMap",
|
|
1276
|
+
"WeakSet",
|
|
1277
|
+
"console",
|
|
1278
|
+
"decodeURI",
|
|
1279
|
+
"decodeURIComponent",
|
|
1280
|
+
"encodeURI",
|
|
1281
|
+
"encodeURIComponent",
|
|
1282
|
+
"globalThis",
|
|
1283
|
+
"isFinite",
|
|
1284
|
+
"isNaN",
|
|
1285
|
+
"parseFloat",
|
|
1286
|
+
"parseInt"
|
|
1287
|
+
]);
|
|
1288
|
+
function previousNonWhitespace(value, index) {
|
|
1289
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
1290
|
+
if (!/\s/.test(value[i])) return value[i];
|
|
1291
|
+
}
|
|
1292
|
+
return void 0;
|
|
1293
|
+
}
|
|
1294
|
+
function stripLiteralsAndComments(expression) {
|
|
1295
|
+
let stripped = "";
|
|
1296
|
+
let i = 0;
|
|
1297
|
+
while (i < expression.length) {
|
|
1298
|
+
const char = expression[i];
|
|
1299
|
+
const next = expression[i + 1];
|
|
1300
|
+
if (char === "/" && next === "/") {
|
|
1301
|
+
stripped += " ";
|
|
1302
|
+
i += 2;
|
|
1303
|
+
while (i < expression.length && expression[i] !== "\n") {
|
|
1304
|
+
stripped += " ";
|
|
1305
|
+
i++;
|
|
1306
|
+
}
|
|
1307
|
+
continue;
|
|
1308
|
+
}
|
|
1309
|
+
if (char === "/" && next === "*") {
|
|
1310
|
+
stripped += " ";
|
|
1311
|
+
i += 2;
|
|
1312
|
+
while (i < expression.length) {
|
|
1313
|
+
const end = expression[i] === "*" && expression[i + 1] === "/";
|
|
1314
|
+
stripped += " ";
|
|
1315
|
+
i++;
|
|
1316
|
+
if (end) {
|
|
1317
|
+
stripped += " ";
|
|
1318
|
+
i++;
|
|
1319
|
+
break;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
continue;
|
|
1323
|
+
}
|
|
1324
|
+
if (char === "'" || char === '"' || char === "`") {
|
|
1325
|
+
const quote = char;
|
|
1326
|
+
stripped += " ";
|
|
1327
|
+
i++;
|
|
1328
|
+
while (i < expression.length) {
|
|
1329
|
+
const current = expression[i];
|
|
1330
|
+
stripped += " ";
|
|
1331
|
+
i++;
|
|
1332
|
+
if (current === "\\") {
|
|
1333
|
+
if (i < expression.length) {
|
|
1334
|
+
stripped += " ";
|
|
1335
|
+
i++;
|
|
1336
|
+
}
|
|
1337
|
+
continue;
|
|
1338
|
+
}
|
|
1339
|
+
if (current === quote) break;
|
|
1340
|
+
}
|
|
1341
|
+
continue;
|
|
1342
|
+
}
|
|
1343
|
+
stripped += char;
|
|
1344
|
+
i++;
|
|
1345
|
+
}
|
|
1346
|
+
return stripped;
|
|
1347
|
+
}
|
|
1348
|
+
function extractTemplateExpressions(template) {
|
|
1349
|
+
const expressions = [];
|
|
1350
|
+
let i = 0;
|
|
1351
|
+
while (i < template.length) {
|
|
1352
|
+
if (template[i] !== "$" || template[i + 1] !== "{") {
|
|
1353
|
+
i++;
|
|
1354
|
+
continue;
|
|
1355
|
+
}
|
|
1356
|
+
let depth = 1;
|
|
1357
|
+
let quote = null;
|
|
1358
|
+
let escaped = false;
|
|
1359
|
+
const start = i + 2;
|
|
1360
|
+
i = start;
|
|
1361
|
+
while (i < template.length) {
|
|
1362
|
+
const char = template[i];
|
|
1363
|
+
if (quote) {
|
|
1364
|
+
if (escaped) {
|
|
1365
|
+
escaped = false;
|
|
1366
|
+
} else if (char === "\\") {
|
|
1367
|
+
escaped = true;
|
|
1368
|
+
} else if (char === quote) {
|
|
1369
|
+
quote = null;
|
|
1370
|
+
}
|
|
1371
|
+
i++;
|
|
1372
|
+
continue;
|
|
1373
|
+
}
|
|
1374
|
+
if (char === "'" || char === '"' || char === "`") {
|
|
1375
|
+
quote = char;
|
|
1376
|
+
i++;
|
|
1377
|
+
continue;
|
|
1378
|
+
}
|
|
1379
|
+
if (char === "{") {
|
|
1380
|
+
depth++;
|
|
1381
|
+
} else if (char === "}") {
|
|
1382
|
+
depth--;
|
|
1383
|
+
if (depth === 0) {
|
|
1384
|
+
expressions.push(template.slice(start, i));
|
|
1385
|
+
i++;
|
|
1386
|
+
break;
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
i++;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
return expressions;
|
|
1393
|
+
}
|
|
1394
|
+
function collectTemplateVariables(expressions, answers) {
|
|
1201
1395
|
var _a;
|
|
1202
1396
|
const vars = {};
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1397
|
+
for (const expression of expressions) {
|
|
1398
|
+
const stripped = stripLiteralsAndComments(expression);
|
|
1399
|
+
IDENTIFIER_TOKEN_RE.lastIndex = 0;
|
|
1400
|
+
let match;
|
|
1401
|
+
while ((match = IDENTIFIER_TOKEN_RE.exec(stripped)) !== null) {
|
|
1402
|
+
const key = match[0];
|
|
1403
|
+
const isPropertyAccess = previousNonWhitespace(stripped, match.index) === ".";
|
|
1404
|
+
if (isPropertyAccess || !VALID_IDENTIFIER_RE.test(key) || RESERVED_IDENTIFIERS.has(key) || GLOBAL_IDENTIFIERS.has(key) && !(key in answers)) {
|
|
1405
|
+
continue;
|
|
1406
|
+
}
|
|
1407
|
+
vars[key] = (_a = answers[key]) != null ? _a : void 0;
|
|
1408
|
+
}
|
|
1208
1409
|
}
|
|
1209
|
-
|
|
1410
|
+
return vars;
|
|
1411
|
+
}
|
|
1412
|
+
function resolveTemplate(template, answers) {
|
|
1413
|
+
if (!template.includes("${")) return template;
|
|
1414
|
+
const expressions = extractTemplateExpressions(template);
|
|
1415
|
+
if (expressions.length === 0) return template;
|
|
1416
|
+
const vars = collectTemplateVariables(expressions, answers);
|
|
1210
1417
|
return renderTemplate(template, vars, "");
|
|
1211
1418
|
}
|
|
1212
|
-
var WHOLE_REF_RE = /^\$\{(
|
|
1419
|
+
var WHOLE_REF_RE = /^\$\{([A-Za-z_$][A-Za-z0-9_$]*)\}$/;
|
|
1213
1420
|
function resolveStringField(value, answers) {
|
|
1214
1421
|
const wholeRef = value.match(WHOLE_REF_RE);
|
|
1215
1422
|
if (wholeRef) {
|
|
@@ -3716,16 +3923,17 @@ function ChecklistItemRow({
|
|
|
3716
3923
|
animate: animate2,
|
|
3717
3924
|
entranceDelay
|
|
3718
3925
|
}) {
|
|
3926
|
+
var _a, _b;
|
|
3719
3927
|
const hasLoadSequence = item.loadDelay != null && !item.checked;
|
|
3720
3928
|
const uid = sanitizeSvgId(React.useId());
|
|
3721
3929
|
const gradientId = `checklist-grad-${uid}-${index}`;
|
|
3722
3930
|
const initialPhase = item.checked ? "checked" : "unchecked";
|
|
3723
3931
|
const [phase, setPhase] = React.useState(initialPhase);
|
|
3724
3932
|
React.useEffect(() => {
|
|
3725
|
-
var
|
|
3933
|
+
var _a2;
|
|
3726
3934
|
if (!hasLoadSequence) return;
|
|
3727
3935
|
const loadDelay = item.loadDelay * 1e3;
|
|
3728
|
-
const loadDuration = ((
|
|
3936
|
+
const loadDuration = ((_a2 = item.loadDuration) != null ? _a2 : 4) * 1e3;
|
|
3729
3937
|
const loadTimer = setTimeout(() => setPhase("loading"), loadDelay);
|
|
3730
3938
|
const checkTimer = setTimeout(
|
|
3731
3939
|
() => setPhase("checked"),
|
|
@@ -3739,6 +3947,8 @@ function ChecklistItemRow({
|
|
|
3739
3947
|
const CustomIcon = item.icon ? lucideIcons7[item.icon] : void 0;
|
|
3740
3948
|
const IconComp = CustomIcon && ("render" in CustomIcon || typeof CustomIcon === "function") ? CustomIcon : icons.Check;
|
|
3741
3949
|
const hasCustomIcon = IconComp !== icons.Check;
|
|
3950
|
+
const textContent = (_b = (_a = item.segments) != null ? _a : item.text) != null ? _b : "";
|
|
3951
|
+
const textStyle = item.textColor || item.lineHeight != null ? { color: item.textColor, lineHeight: item.lineHeight } : void 0;
|
|
3742
3952
|
const iconProps = item.iconGradient ? { stroke: `url(#${gradientId})` } : item.iconColor ? { color: item.iconColor } : {};
|
|
3743
3953
|
const content = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3744
3954
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3801,13 +4011,14 @@ function ChecklistItemRow({
|
|
|
3801
4011
|
}
|
|
3802
4012
|
),
|
|
3803
4013
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3804
|
-
|
|
4014
|
+
RichText,
|
|
3805
4015
|
{
|
|
4016
|
+
content: textContent,
|
|
3806
4017
|
className: cn(
|
|
3807
4018
|
"text-sm transition-colors duration-300",
|
|
3808
4019
|
phase === "checked" ? "text-foreground" : "text-muted-foreground"
|
|
3809
4020
|
),
|
|
3810
|
-
|
|
4021
|
+
style: textStyle
|
|
3811
4022
|
}
|
|
3812
4023
|
)
|
|
3813
4024
|
] });
|
|
@@ -4153,6 +4364,9 @@ function CircularProgressBlock({
|
|
|
4153
4364
|
);
|
|
4154
4365
|
}
|
|
4155
4366
|
var lucideIcons8 = icons__namespace;
|
|
4367
|
+
var DEFAULT_CHART_HEIGHT = 280;
|
|
4368
|
+
var DEFAULT_Y_AXIS_LABEL_GUTTER = 64;
|
|
4369
|
+
var Y_AXIS_LABEL_GAP = 8;
|
|
4156
4370
|
function toSvg(points, w, h, pad) {
|
|
4157
4371
|
const drawW = w - pad.left - pad.right;
|
|
4158
4372
|
const drawH = h - pad.top - pad.bottom;
|
|
@@ -4218,10 +4432,36 @@ function xValToPercent(xVal, svgW, pad) {
|
|
|
4218
4432
|
const drawW = svgW - pad.left - pad.right;
|
|
4219
4433
|
return (pad.left + xVal / 100 * drawW) / svgW * 100;
|
|
4220
4434
|
}
|
|
4435
|
+
function toCssLength(value, fallback) {
|
|
4436
|
+
if (value === void 0) return fallback;
|
|
4437
|
+
if (typeof value === "number") {
|
|
4438
|
+
return Number.isFinite(value) && value > 0 ? `${value}px` : fallback;
|
|
4439
|
+
}
|
|
4440
|
+
const trimmed = value.trim();
|
|
4441
|
+
if (!trimmed) return fallback;
|
|
4442
|
+
return /^-?\d+(\.\d+)?$/.test(trimmed) ? `${trimmed}px` : trimmed;
|
|
4443
|
+
}
|
|
4444
|
+
function toViewBoxHeight(value) {
|
|
4445
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
4446
|
+
return value;
|
|
4447
|
+
}
|
|
4448
|
+
if (typeof value === "string") {
|
|
4449
|
+
const match = value.trim().match(/^(\d+(?:\.\d+)?)(?:px)?$/i);
|
|
4450
|
+
if (match) {
|
|
4451
|
+
const parsed = Number(match[1]);
|
|
4452
|
+
if (Number.isFinite(parsed) && parsed > 0) return parsed;
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
return DEFAULT_CHART_HEIGHT;
|
|
4456
|
+
}
|
|
4457
|
+
function toPositiveNumber(value, fallback) {
|
|
4458
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
|
|
4459
|
+
}
|
|
4221
4460
|
function LineChartBlock({
|
|
4222
4461
|
lines = [],
|
|
4223
4462
|
width = "100%",
|
|
4224
4463
|
height = 280,
|
|
4464
|
+
yLabelGutter,
|
|
4225
4465
|
yLabels,
|
|
4226
4466
|
xLabels,
|
|
4227
4467
|
animationDuration = 1.5,
|
|
@@ -4236,12 +4476,19 @@ function LineChartBlock({
|
|
|
4236
4476
|
const [animate2, setAnimate] = React.useState(false);
|
|
4237
4477
|
const pathRefs = React.useRef([]);
|
|
4238
4478
|
const dotRefs = React.useRef([]);
|
|
4239
|
-
const svgH = height;
|
|
4479
|
+
const svgH = toViewBoxHeight(height);
|
|
4480
|
+
const chartWidth = toCssLength(width, "100%");
|
|
4481
|
+
const chartHeight = toCssLength(height, `${DEFAULT_CHART_HEIGHT}px`);
|
|
4240
4482
|
const hasEndLabels = lines.some((l) => l.endLabel || l.endIcon);
|
|
4241
4483
|
const hasEndDots = lines.some((l) => l.endDot);
|
|
4242
4484
|
const hasYLabels = !!((yLabels == null ? void 0 : yLabels.top) || (yLabels == null ? void 0 : yLabels.bottom));
|
|
4243
4485
|
const padRight = hasEndDots ? 80 : hasEndLabels ? 60 : 16;
|
|
4244
|
-
const pad = {
|
|
4486
|
+
const pad = {
|
|
4487
|
+
top: 16,
|
|
4488
|
+
right: padRight,
|
|
4489
|
+
bottom: 16,
|
|
4490
|
+
left: hasYLabels ? toPositiveNumber(yLabelGutter, DEFAULT_Y_AXIS_LABEL_GUTTER) : 16
|
|
4491
|
+
};
|
|
4245
4492
|
React.useEffect(() => {
|
|
4246
4493
|
const timer = setTimeout(() => setAnimate(true), startDelay * 1e3);
|
|
4247
4494
|
return () => clearTimeout(timer);
|
|
@@ -4256,6 +4503,7 @@ function LineChartBlock({
|
|
|
4256
4503
|
});
|
|
4257
4504
|
const durationMs = animationDuration * 1e3;
|
|
4258
4505
|
const hasDots = lines.some((l) => l.endDot);
|
|
4506
|
+
const yAxisLabelWidth = `max(0px, calc(${pad.left / svgW * 100}% - ${Y_AXIS_LABEL_GAP}px))`;
|
|
4259
4507
|
React.useEffect(() => {
|
|
4260
4508
|
if (!animate2 || !hasDots) return;
|
|
4261
4509
|
const startTime = performance.now();
|
|
@@ -4281,299 +4529,329 @@ function LineChartBlock({
|
|
|
4281
4529
|
return () => cancelAnimationFrame(rafId);
|
|
4282
4530
|
}, [animate2, hasDots, durationMs, svgW, svgH]);
|
|
4283
4531
|
const toPctY = (px) => `${px / svgH * 100}%`;
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
"
|
|
4307
|
-
{
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4532
|
+
const yAxisLabelStyle = (top) => ({
|
|
4533
|
+
top,
|
|
4534
|
+
left: 0,
|
|
4535
|
+
width: yAxisLabelWidth,
|
|
4536
|
+
maxWidth: yAxisLabelWidth,
|
|
4537
|
+
transform: "translateY(-50%)",
|
|
4538
|
+
color: labelColor,
|
|
4539
|
+
textAlign: "right",
|
|
4540
|
+
whiteSpace: "pre-line",
|
|
4541
|
+
overflowWrap: "anywhere",
|
|
4542
|
+
lineHeight: 1.1,
|
|
4543
|
+
pointerEvents: "none"
|
|
4544
|
+
});
|
|
4545
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4546
|
+
"div",
|
|
4547
|
+
{
|
|
4548
|
+
className: cn("w-full overflow-visible", className),
|
|
4549
|
+
style: { width: chartWidth },
|
|
4550
|
+
children: [
|
|
4551
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4552
|
+
"div",
|
|
4553
|
+
{
|
|
4554
|
+
className: "relative overflow-visible",
|
|
4555
|
+
style: { height: chartHeight },
|
|
4556
|
+
children: [
|
|
4557
|
+
(yLabels == null ? void 0 : yLabels.top) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4558
|
+
"span",
|
|
4559
|
+
{
|
|
4560
|
+
className: "absolute text-xs font-medium",
|
|
4561
|
+
style: yAxisLabelStyle(
|
|
4562
|
+
toPctY(
|
|
4563
|
+
yLabels.topAt != null ? yValToPixel(yLabels.topAt, svgH, pad) : pad.top
|
|
4564
|
+
)
|
|
4565
|
+
),
|
|
4566
|
+
children: yLabels.top
|
|
4567
|
+
}
|
|
4568
|
+
),
|
|
4569
|
+
(yLabels == null ? void 0 : yLabels.bottom) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4570
|
+
"span",
|
|
4571
|
+
{
|
|
4572
|
+
className: "absolute text-xs font-medium",
|
|
4573
|
+
style: yAxisLabelStyle(
|
|
4574
|
+
toPctY(
|
|
4575
|
+
yLabels.bottomAt != null ? yValToPixel(yLabels.bottomAt, svgH, pad) : svgH - pad.bottom
|
|
4576
|
+
)
|
|
4577
|
+
),
|
|
4578
|
+
children: yLabels.bottom
|
|
4579
|
+
}
|
|
4580
|
+
),
|
|
4581
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4582
|
+
"svg",
|
|
4583
|
+
{
|
|
4584
|
+
viewBox: `0 0 ${svgW} ${svgH}`,
|
|
4585
|
+
preserveAspectRatio: "none",
|
|
4586
|
+
className: "w-full h-full",
|
|
4587
|
+
style: { overflow: "visible" },
|
|
4588
|
+
children: [
|
|
4589
|
+
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
4590
|
+
linesData.map(
|
|
4591
|
+
(line, i) => {
|
|
4592
|
+
var _a2;
|
|
4593
|
+
return line.fill ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4594
|
+
"linearGradient",
|
|
4595
|
+
{
|
|
4596
|
+
id: `lc-fill-${uid}-${i}`,
|
|
4597
|
+
x1: "0",
|
|
4598
|
+
y1: "0",
|
|
4599
|
+
x2: "0",
|
|
4600
|
+
y2: "1",
|
|
4601
|
+
children: [
|
|
4602
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4603
|
+
"stop",
|
|
4604
|
+
{
|
|
4605
|
+
offset: "0%",
|
|
4606
|
+
stopColor: line.fill.from,
|
|
4607
|
+
stopOpacity: (_a2 = line.fill.opacity) != null ? _a2 : 0.4
|
|
4608
|
+
}
|
|
4609
|
+
),
|
|
4610
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4611
|
+
"stop",
|
|
4612
|
+
{
|
|
4613
|
+
offset: "100%",
|
|
4614
|
+
stopColor: line.fill.to,
|
|
4615
|
+
stopOpacity: 0
|
|
4616
|
+
}
|
|
4617
|
+
)
|
|
4618
|
+
]
|
|
4619
|
+
},
|
|
4620
|
+
`fill-${i}`
|
|
4621
|
+
) : null;
|
|
4622
|
+
}
|
|
4623
|
+
),
|
|
4624
|
+
linesData.map(
|
|
4625
|
+
(line, i) => line.fill ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4626
|
+
"linearGradient",
|
|
4627
|
+
{
|
|
4628
|
+
id: `lc-mask-grad-${uid}-${i}`,
|
|
4629
|
+
x1: "0",
|
|
4630
|
+
y1: "0",
|
|
4631
|
+
x2: "0",
|
|
4632
|
+
y2: "1",
|
|
4633
|
+
children: [
|
|
4634
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "white" }),
|
|
4635
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "70%", stopColor: "white" }),
|
|
4636
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "black" })
|
|
4637
|
+
]
|
|
4638
|
+
},
|
|
4639
|
+
`mask-${i}`
|
|
4640
|
+
) : null
|
|
4641
|
+
),
|
|
4642
|
+
linesData.map(
|
|
4643
|
+
(line, i) => line.fill ? /* @__PURE__ */ jsxRuntime.jsx("mask", { id: `lc-mask-${uid}-${i}`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4644
|
+
"rect",
|
|
4645
|
+
{
|
|
4646
|
+
x: "0",
|
|
4647
|
+
y: animate2 ? "0" : `-${svgH}`,
|
|
4648
|
+
width: svgW,
|
|
4649
|
+
height: svgH,
|
|
4650
|
+
fill: `url(#lc-mask-grad-${uid}-${i})`,
|
|
4651
|
+
style: {
|
|
4652
|
+
transition: `y ${durationMs}ms cubic-bezier(0.25, 0.4, 0.25, 1)`
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
) }, `mask-el-${i}`) : null
|
|
4656
|
+
)
|
|
4657
|
+
] }),
|
|
4658
|
+
showGrid && [25, 50, 75].map((pct) => {
|
|
4659
|
+
const y = pad.top + (100 - pct) / 100 * (svgH - pad.top - pad.bottom);
|
|
4660
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4661
|
+
"line",
|
|
4662
|
+
{
|
|
4663
|
+
x1: pad.left,
|
|
4664
|
+
y1: y,
|
|
4665
|
+
x2: svgW - pad.right,
|
|
4666
|
+
y2: y,
|
|
4667
|
+
stroke: axisColor,
|
|
4668
|
+
strokeWidth: 0.5,
|
|
4669
|
+
strokeDasharray: "4 4"
|
|
4670
|
+
},
|
|
4671
|
+
pct
|
|
4672
|
+
);
|
|
4673
|
+
}),
|
|
4674
|
+
linesData.map(
|
|
4675
|
+
(line, i) => line.fillDPath ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4676
|
+
"path",
|
|
4677
|
+
{
|
|
4678
|
+
d: line.fillDPath,
|
|
4679
|
+
fill: `url(#lc-fill-${uid}-${i})`,
|
|
4680
|
+
mask: `url(#lc-mask-${uid}-${i})`
|
|
4681
|
+
},
|
|
4682
|
+
`area-${i}`
|
|
4683
|
+
) : null
|
|
4684
|
+
),
|
|
4685
|
+
linesData.map((line, i) => {
|
|
4330
4686
|
var _a2;
|
|
4331
|
-
return
|
|
4332
|
-
"
|
|
4687
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4688
|
+
"path",
|
|
4333
4689
|
{
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
stopOpacity: 0
|
|
4354
|
-
}
|
|
4355
|
-
)
|
|
4356
|
-
]
|
|
4690
|
+
ref: (el) => {
|
|
4691
|
+
pathRefs.current[i] = el;
|
|
4692
|
+
},
|
|
4693
|
+
d: line.lineDPath,
|
|
4694
|
+
fill: "none",
|
|
4695
|
+
stroke: line.color,
|
|
4696
|
+
strokeWidth: (_a2 = line.strokeWidth) != null ? _a2 : 3,
|
|
4697
|
+
strokeLinecap: "round",
|
|
4698
|
+
strokeLinejoin: "round",
|
|
4699
|
+
pathLength: 1,
|
|
4700
|
+
style: line.dashed ? {
|
|
4701
|
+
strokeDasharray: "8 6",
|
|
4702
|
+
opacity: animate2 ? 1 : 0,
|
|
4703
|
+
transition: `opacity ${durationMs}ms ease`
|
|
4704
|
+
} : {
|
|
4705
|
+
strokeDasharray: 1,
|
|
4706
|
+
strokeDashoffset: animate2 ? 0 : 1,
|
|
4707
|
+
transition: `stroke-dashoffset ${durationMs}ms cubic-bezier(0.25, 0.4, 0.25, 1)`
|
|
4708
|
+
}
|
|
4357
4709
|
},
|
|
4358
|
-
`
|
|
4359
|
-
)
|
|
4360
|
-
}
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
(line, i) => line.fill ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4364
|
-
"linearGradient",
|
|
4710
|
+
`line-${i}`
|
|
4711
|
+
);
|
|
4712
|
+
}),
|
|
4713
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4714
|
+
"line",
|
|
4365
4715
|
{
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
},
|
|
4377
|
-
`mask-${i}`
|
|
4378
|
-
) : null
|
|
4379
|
-
),
|
|
4380
|
-
linesData.map(
|
|
4381
|
-
(line, i) => line.fill ? /* @__PURE__ */ jsxRuntime.jsx("mask", { id: `lc-mask-${uid}-${i}`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4382
|
-
"rect",
|
|
4716
|
+
x1: pad.left,
|
|
4717
|
+
y1: pad.top,
|
|
4718
|
+
x2: pad.left,
|
|
4719
|
+
y2: svgH - pad.bottom,
|
|
4720
|
+
stroke: axisColor,
|
|
4721
|
+
strokeWidth: 2
|
|
4722
|
+
}
|
|
4723
|
+
),
|
|
4724
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4725
|
+
"line",
|
|
4383
4726
|
{
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
transition: `y ${durationMs}ms cubic-bezier(0.25, 0.4, 0.25, 1)`
|
|
4391
|
-
}
|
|
4727
|
+
x1: pad.left,
|
|
4728
|
+
y1: svgH - pad.bottom,
|
|
4729
|
+
x2: svgW - pad.right,
|
|
4730
|
+
y2: svgH - pad.bottom,
|
|
4731
|
+
stroke: axisColor,
|
|
4732
|
+
strokeWidth: 2
|
|
4392
4733
|
}
|
|
4393
|
-
)
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4734
|
+
)
|
|
4735
|
+
]
|
|
4736
|
+
}
|
|
4737
|
+
),
|
|
4738
|
+
linesData.map((line, i) => {
|
|
4739
|
+
var _a2, _b2, _c, _d, _e;
|
|
4740
|
+
if (!line.endDot) return null;
|
|
4741
|
+
const dotSize = (_a2 = line.endDot.size) != null ? _a2 : 28;
|
|
4742
|
+
const iconSize = dotSize * 0.55;
|
|
4743
|
+
const imageScale = typeof line.endDot.imageScale === "number" && Number.isFinite(line.endDot.imageScale) ? Math.min(Math.max(line.endDot.imageScale, 0), 1) : 0.72;
|
|
4744
|
+
const imageSize = dotSize * imageScale;
|
|
4745
|
+
const LucideIcon = line.endDot.lucideIcon ? lucideIcons8[line.endDot.lucideIcon] : null;
|
|
4746
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4747
|
+
"div",
|
|
4748
|
+
{
|
|
4749
|
+
ref: (el) => {
|
|
4750
|
+
dotRefs.current[i] = el;
|
|
4408
4751
|
},
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4752
|
+
className: "absolute flex items-center justify-center rounded-full shadow-lg",
|
|
4753
|
+
style: {
|
|
4754
|
+
width: dotSize,
|
|
4755
|
+
height: dotSize,
|
|
4756
|
+
background: line.endDot.gradient ? `linear-gradient(${(_b2 = line.endDot.gradient.angle) != null ? _b2 : 180}deg, ${line.endDot.gradient.from}, ${line.endDot.gradient.to})` : (_c = line.endDot.color) != null ? _c : line.color,
|
|
4757
|
+
transform: "translate(-50%, -50%)",
|
|
4758
|
+
opacity: 0,
|
|
4759
|
+
left: 0,
|
|
4760
|
+
top: 0,
|
|
4761
|
+
zIndex: 10
|
|
4419
4762
|
},
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
d: line.lineDPath,
|
|
4432
|
-
fill: "none",
|
|
4433
|
-
stroke: line.color,
|
|
4434
|
-
strokeWidth: (_a2 = line.strokeWidth) != null ? _a2 : 3,
|
|
4435
|
-
strokeLinecap: "round",
|
|
4436
|
-
strokeLinejoin: "round",
|
|
4437
|
-
pathLength: 1,
|
|
4438
|
-
style: line.dashed ? {
|
|
4439
|
-
strokeDasharray: "8 6",
|
|
4440
|
-
opacity: animate2 ? 1 : 0,
|
|
4441
|
-
transition: `opacity ${durationMs}ms ease`
|
|
4442
|
-
} : {
|
|
4443
|
-
strokeDasharray: 1,
|
|
4444
|
-
strokeDashoffset: animate2 ? 0 : 1,
|
|
4445
|
-
transition: `stroke-dashoffset ${durationMs}ms cubic-bezier(0.25, 0.4, 0.25, 1)`
|
|
4763
|
+
children: line.endDot.imageSrc ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4764
|
+
"img",
|
|
4765
|
+
{
|
|
4766
|
+
src: line.endDot.imageSrc,
|
|
4767
|
+
alt: (_d = line.endDot.imageAlt) != null ? _d : "",
|
|
4768
|
+
draggable: false,
|
|
4769
|
+
className: "rounded-full object-contain",
|
|
4770
|
+
style: {
|
|
4771
|
+
width: imageSize,
|
|
4772
|
+
height: imageSize
|
|
4773
|
+
}
|
|
4446
4774
|
}
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
)
|
|
4462
|
-
|
|
4463
|
-
|
|
4775
|
+
) : LucideIcon ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4776
|
+
LucideIcon,
|
|
4777
|
+
{
|
|
4778
|
+
size: iconSize,
|
|
4779
|
+
color: (_e = line.endDot.lucideIconColor) != null ? _e : "#fff",
|
|
4780
|
+
strokeWidth: 2.5
|
|
4781
|
+
}
|
|
4782
|
+
) : line.endDot.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: iconSize, lineHeight: 1 }, children: line.endDot.icon }) : null
|
|
4783
|
+
},
|
|
4784
|
+
`dot-${i}`
|
|
4785
|
+
);
|
|
4786
|
+
}),
|
|
4787
|
+
linesData.map((line, i) => {
|
|
4788
|
+
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
4789
|
+
if (!line.endIcon && !line.endLabel) return null;
|
|
4790
|
+
const cx = line.lastPt[0];
|
|
4791
|
+
const cy = line.lastPt[1];
|
|
4792
|
+
const labelLines = (_b2 = (_a2 = line.endLabel) == null ? void 0 : _a2.split("\n")) != null ? _b2 : [];
|
|
4793
|
+
const hasDot = !!line.endDot;
|
|
4794
|
+
const offX = (_d = (_c = line.endLabelOffset) == null ? void 0 : _c.x) != null ? _d : 0;
|
|
4795
|
+
const offY = (_f = (_e = line.endLabelOffset) == null ? void 0 : _e.y) != null ? _f : 0;
|
|
4796
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4797
|
+
"div",
|
|
4464
4798
|
{
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4799
|
+
className: "absolute flex flex-col items-center",
|
|
4800
|
+
style: __spreadProps(__spreadValues({}, hasDot ? {
|
|
4801
|
+
left: `calc(${cx / svgW * 100}% + ${offX}px)`,
|
|
4802
|
+
transform: "translateX(-50%)"
|
|
4803
|
+
} : { right: 0 }), {
|
|
4804
|
+
top: toPctY(cy + offY),
|
|
4805
|
+
opacity: animate2 ? 1 : 0,
|
|
4806
|
+
transition: `opacity 400ms ease ${durationMs * 0.8}ms`,
|
|
4807
|
+
textAlign: "center",
|
|
4808
|
+
whiteSpace: "nowrap"
|
|
4809
|
+
}),
|
|
4810
|
+
children: [
|
|
4811
|
+
line.endIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-lg", children: line.endIcon }),
|
|
4812
|
+
labelLines.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4813
|
+
"span",
|
|
4814
|
+
{
|
|
4815
|
+
className: "text-xs font-semibold leading-tight",
|
|
4816
|
+
style: { color: (_g = line.endLabelColor) != null ? _g : labelColor },
|
|
4817
|
+
children: labelLines.map((ln, j) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block", children: ln }, j))
|
|
4818
|
+
}
|
|
4819
|
+
)
|
|
4820
|
+
]
|
|
4821
|
+
},
|
|
4822
|
+
`end-${i}`
|
|
4823
|
+
);
|
|
4824
|
+
})
|
|
4825
|
+
]
|
|
4826
|
+
}
|
|
4827
|
+
),
|
|
4828
|
+
xLabels && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative text-xs font-medium mt-1", style: { color: labelColor, height: 20 }, children: [
|
|
4829
|
+
xLabels.left && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4830
|
+
"span",
|
|
4831
|
+
{
|
|
4832
|
+
className: "absolute",
|
|
4833
|
+
style: {
|
|
4834
|
+
left: `${xValToPercent((_a = xLabels.leftAt) != null ? _a : 0, svgW, pad)}%`,
|
|
4835
|
+
transform: "translateX(-50%)"
|
|
4836
|
+
},
|
|
4837
|
+
children: xLabels.left
|
|
4474
4838
|
}
|
|
4475
4839
|
),
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
"div",
|
|
4484
|
-
{
|
|
4485
|
-
ref: (el) => {
|
|
4486
|
-
dotRefs.current[i] = el;
|
|
4487
|
-
},
|
|
4488
|
-
className: "absolute flex items-center justify-center rounded-full shadow-lg",
|
|
4489
|
-
style: {
|
|
4490
|
-
width: dotSize,
|
|
4491
|
-
height: dotSize,
|
|
4492
|
-
background: line.endDot.gradient ? `linear-gradient(${(_b2 = line.endDot.gradient.angle) != null ? _b2 : 180}deg, ${line.endDot.gradient.from}, ${line.endDot.gradient.to})` : (_c = line.endDot.color) != null ? _c : line.color,
|
|
4493
|
-
transform: "translate(-50%, -50%)",
|
|
4494
|
-
opacity: 0,
|
|
4495
|
-
left: 0,
|
|
4496
|
-
top: 0,
|
|
4497
|
-
zIndex: 10
|
|
4498
|
-
},
|
|
4499
|
-
children: LucideIcon ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4500
|
-
LucideIcon,
|
|
4501
|
-
{
|
|
4502
|
-
size: iconSize,
|
|
4503
|
-
color: (_d = line.endDot.lucideIconColor) != null ? _d : "#fff",
|
|
4504
|
-
strokeWidth: 2.5
|
|
4505
|
-
}
|
|
4506
|
-
) : line.endDot.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: iconSize, lineHeight: 1 }, children: line.endDot.icon }) : null
|
|
4507
|
-
},
|
|
4508
|
-
`dot-${i}`
|
|
4509
|
-
);
|
|
4510
|
-
}),
|
|
4511
|
-
linesData.map((line, i) => {
|
|
4512
|
-
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
4513
|
-
if (!line.endIcon && !line.endLabel) return null;
|
|
4514
|
-
const cx = line.lastPt[0];
|
|
4515
|
-
const cy = line.lastPt[1];
|
|
4516
|
-
const labelLines = (_b2 = (_a2 = line.endLabel) == null ? void 0 : _a2.split("\n")) != null ? _b2 : [];
|
|
4517
|
-
const hasDot = !!line.endDot;
|
|
4518
|
-
const offX = (_d = (_c = line.endLabelOffset) == null ? void 0 : _c.x) != null ? _d : 0;
|
|
4519
|
-
const offY = (_f = (_e = line.endLabelOffset) == null ? void 0 : _e.y) != null ? _f : 0;
|
|
4520
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4521
|
-
"div",
|
|
4522
|
-
{
|
|
4523
|
-
className: "absolute flex flex-col items-center",
|
|
4524
|
-
style: __spreadProps(__spreadValues({}, hasDot ? {
|
|
4525
|
-
left: `calc(${cx / svgW * 100}% + ${offX}px)`,
|
|
4526
|
-
transform: "translateX(-50%)"
|
|
4527
|
-
} : { right: 0 }), {
|
|
4528
|
-
top: toPctY(cy + offY),
|
|
4529
|
-
opacity: animate2 ? 1 : 0,
|
|
4530
|
-
transition: `opacity 400ms ease ${durationMs * 0.8}ms`,
|
|
4531
|
-
textAlign: "center",
|
|
4532
|
-
whiteSpace: "nowrap"
|
|
4533
|
-
}),
|
|
4534
|
-
children: [
|
|
4535
|
-
line.endIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-lg", children: line.endIcon }),
|
|
4536
|
-
labelLines.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4537
|
-
"span",
|
|
4538
|
-
{
|
|
4539
|
-
className: "text-xs font-semibold leading-tight",
|
|
4540
|
-
style: { color: (_g = line.endLabelColor) != null ? _g : labelColor },
|
|
4541
|
-
children: labelLines.map((ln, j) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block", children: ln }, j))
|
|
4542
|
-
}
|
|
4543
|
-
)
|
|
4544
|
-
]
|
|
4840
|
+
xLabels.right && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4841
|
+
"span",
|
|
4842
|
+
{
|
|
4843
|
+
className: "absolute",
|
|
4844
|
+
style: {
|
|
4845
|
+
left: `${xValToPercent((_b = xLabels.rightAt) != null ? _b : 100, svgW, pad)}%`,
|
|
4846
|
+
transform: "translateX(-50%)"
|
|
4545
4847
|
},
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
]
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
xLabels.left && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4554
|
-
"span",
|
|
4555
|
-
{
|
|
4556
|
-
className: "absolute",
|
|
4557
|
-
style: {
|
|
4558
|
-
left: `${xValToPercent((_a = xLabels.leftAt) != null ? _a : 0, svgW, pad)}%`,
|
|
4559
|
-
transform: "translateX(-50%)"
|
|
4560
|
-
},
|
|
4561
|
-
children: xLabels.left
|
|
4562
|
-
}
|
|
4563
|
-
),
|
|
4564
|
-
xLabels.right && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4565
|
-
"span",
|
|
4566
|
-
{
|
|
4567
|
-
className: "absolute",
|
|
4568
|
-
style: {
|
|
4569
|
-
left: `${xValToPercent((_b = xLabels.rightAt) != null ? _b : 100, svgW, pad)}%`,
|
|
4570
|
-
transform: "translateX(-50%)"
|
|
4571
|
-
},
|
|
4572
|
-
children: xLabels.right
|
|
4573
|
-
}
|
|
4574
|
-
)
|
|
4575
|
-
] })
|
|
4576
|
-
] });
|
|
4848
|
+
children: xLabels.right
|
|
4849
|
+
}
|
|
4850
|
+
)
|
|
4851
|
+
] })
|
|
4852
|
+
]
|
|
4853
|
+
}
|
|
4854
|
+
);
|
|
4577
4855
|
}
|
|
4578
4856
|
function getInitials2(name) {
|
|
4579
4857
|
return name.split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
|
|
@@ -5560,6 +5838,7 @@ function TimelineBlock({
|
|
|
5560
5838
|
} : {};
|
|
5561
5839
|
const renderNodeIcon = iconPlacement === "node" && item.icon;
|
|
5562
5840
|
const renderContentIcon = iconPlacement === "content" && item.icon;
|
|
5841
|
+
const renderTitleIcon = iconPlacement === "before-title" && item.icon;
|
|
5563
5842
|
const showLabel = labelPlacement === "above" && item.label;
|
|
5564
5843
|
const showOutgoing = !isLast || !!(endLine == null ? void 0 : endLine.show);
|
|
5565
5844
|
const outgoingColor = isLast ? resolveColor((_a2 = endLine == null ? void 0 : endLine.color) != null ? _a2 : lineColor, blockLineValue) : resolveColor((_b = item.lineColor) != null ? _b : lineColor, blockLineValue);
|
|
@@ -5575,6 +5854,45 @@ function TimelineBlock({
|
|
|
5575
5854
|
const defaultItemSpacing = Math.max(16, nodeSize * 0.4);
|
|
5576
5855
|
const bottomPad = isLast ? (endLine == null ? void 0 : endLine.show) ? EDGE_LINE_HEIGHT : 0 : itemSpacing != null ? itemSpacing : defaultItemSpacing;
|
|
5577
5856
|
const nodeTopMargin = iconPlacement === "node" ? 0 : 4;
|
|
5857
|
+
const contentBody = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5858
|
+
renderContentIcon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-1.5", children: renderIcon3(item.icon) }),
|
|
5859
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5860
|
+
"div",
|
|
5861
|
+
{
|
|
5862
|
+
style: iconPlacement === "node" ? {
|
|
5863
|
+
minHeight: nodeSize,
|
|
5864
|
+
display: "flex",
|
|
5865
|
+
flexDirection: "column",
|
|
5866
|
+
justifyContent: "center"
|
|
5867
|
+
} : void 0,
|
|
5868
|
+
children: [
|
|
5869
|
+
showLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground/70 uppercase tracking-wider", children: item.label }),
|
|
5870
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5871
|
+
"h4",
|
|
5872
|
+
{
|
|
5873
|
+
className: cn(
|
|
5874
|
+
"font-semibold text-foreground",
|
|
5875
|
+
iconPlacement === "node" ? "text-xl leading-tight" : "text-sm",
|
|
5876
|
+
renderTitleIcon ? "flex items-center gap-2" : null
|
|
5877
|
+
),
|
|
5878
|
+
children: renderTitleIcon ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5879
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex shrink-0", children: renderIcon3(item.icon) }),
|
|
5880
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0", children: item.title })
|
|
5881
|
+
] }) : item.title
|
|
5882
|
+
}
|
|
5883
|
+
)
|
|
5884
|
+
]
|
|
5885
|
+
}
|
|
5886
|
+
),
|
|
5887
|
+
item.description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5888
|
+
"p",
|
|
5889
|
+
{
|
|
5890
|
+
className: "text-sm text-muted-foreground",
|
|
5891
|
+
style: { marginTop: resolvedTitleDescGap },
|
|
5892
|
+
children: item.description
|
|
5893
|
+
}
|
|
5894
|
+
)
|
|
5895
|
+
] });
|
|
5578
5896
|
return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper, __spreadProps(__spreadValues({ className: "relative flex" }, animProps), { children: [
|
|
5579
5897
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5580
5898
|
"div",
|
|
@@ -5638,46 +5956,19 @@ function TimelineBlock({
|
|
|
5638
5956
|
]
|
|
5639
5957
|
}
|
|
5640
5958
|
),
|
|
5641
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5959
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5642
5960
|
"div",
|
|
5643
5961
|
{
|
|
5644
5962
|
className: "flex-1 min-w-0",
|
|
5645
5963
|
style: { paddingBottom: bottomPad, paddingTop: isFirst && showIncoming ? EDGE_LINE_HEIGHT : 0, paddingLeft: contentGap },
|
|
5646
|
-
children:
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
"
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
flexDirection: "column",
|
|
5655
|
-
justifyContent: "center"
|
|
5656
|
-
} : void 0,
|
|
5657
|
-
children: [
|
|
5658
|
-
showLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium text-muted-foreground/70 uppercase tracking-wider", children: item.label }),
|
|
5659
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5660
|
-
"h4",
|
|
5661
|
-
{
|
|
5662
|
-
className: cn(
|
|
5663
|
-
"font-semibold text-foreground",
|
|
5664
|
-
iconPlacement === "node" ? "text-xl leading-tight" : "text-sm"
|
|
5665
|
-
),
|
|
5666
|
-
children: item.title
|
|
5667
|
-
}
|
|
5668
|
-
)
|
|
5669
|
-
]
|
|
5670
|
-
}
|
|
5671
|
-
),
|
|
5672
|
-
item.description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5673
|
-
"p",
|
|
5674
|
-
{
|
|
5675
|
-
className: "text-sm text-muted-foreground",
|
|
5676
|
-
style: { marginTop: resolvedTitleDescGap },
|
|
5677
|
-
children: item.description
|
|
5678
|
-
}
|
|
5679
|
-
)
|
|
5680
|
-
]
|
|
5964
|
+
children: item.contentCard ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5965
|
+
"div",
|
|
5966
|
+
{
|
|
5967
|
+
className: "rounded-lg border border-border/60 bg-card/80 p-3 shadow-sm",
|
|
5968
|
+
"data-timeline-content-card": "true",
|
|
5969
|
+
children: contentBody
|
|
5970
|
+
}
|
|
5971
|
+
) : contentBody
|
|
5681
5972
|
}
|
|
5682
5973
|
)
|
|
5683
5974
|
] }), i);
|
|
@@ -7654,13 +7945,13 @@ function MotionAnimatedBlock({
|
|
|
7654
7945
|
const exitMotion = exitPreset && exitPreset !== "none" ? EXIT_PRESETS[exitPreset] : void 0;
|
|
7655
7946
|
const rawExitDuration = (_b = exitAnim == null ? void 0 : exitAnim.duration) != null ? _b : DEFAULT_EXIT_DURATION_S;
|
|
7656
7947
|
const rawExitDelay = (_c = exitAnim == null ? void 0 : exitAnim.delay) != null ? _c : 0;
|
|
7657
|
-
const exitDuration = rawExitDuration
|
|
7658
|
-
const exitDelay = rawExitDelay
|
|
7948
|
+
const exitDuration = rawExitDuration;
|
|
7949
|
+
const exitDelay = rawExitDelay;
|
|
7659
7950
|
const motionConfig = preset !== "none" ? PRESETS[preset] : null;
|
|
7660
7951
|
const rawDuration = (_d = anim == null ? void 0 : anim.duration) != null ? _d : DEFAULT_DURATION_S;
|
|
7661
7952
|
const rawDelay = (_e = anim == null ? void 0 : anim.delay) != null ? _e : visibleIndex * DEFAULT_STAGGER_S;
|
|
7662
|
-
const duration = rawDuration
|
|
7663
|
-
const delay = rawDelay
|
|
7953
|
+
const duration = rawDuration;
|
|
7954
|
+
const delay = rawDelay;
|
|
7664
7955
|
const delayMs = delay * 1e3;
|
|
7665
7956
|
const [delayedIn, setDelayedIn] = React.useState(delayMs === 0);
|
|
7666
7957
|
React.useEffect(() => {
|
|
@@ -7669,7 +7960,7 @@ function MotionAnimatedBlock({
|
|
|
7669
7960
|
return () => clearTimeout(id);
|
|
7670
7961
|
}, [delayMs]);
|
|
7671
7962
|
const rawAutoHide = exitAnim == null ? void 0 : exitAnim.autoHideAfter;
|
|
7672
|
-
const autoHideS = rawAutoHide != null && rawAutoHide > 0 ? rawAutoHide
|
|
7963
|
+
const autoHideS = rawAutoHide != null && rawAutoHide > 0 ? rawAutoHide : null;
|
|
7673
7964
|
const [autoHidden, setAutoHidden] = React.useState(false);
|
|
7674
7965
|
React.useEffect(() => {
|
|
7675
7966
|
if (autoHideS == null) return;
|