@cardenelabs/cdl 0.36.0 → 0.38.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/CHANGELOG.md +47 -1
- package/README.md +32 -9
- package/dist/index.cjs +40 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +40 -16
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +40 -16
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +40 -16
- package/dist/react.js.map +1 -1
- package/dist/{render-R7v2bfyz.d.cts → render-BYdmSviQ.d.cts} +19 -8
- package/dist/{render-R7v2bfyz.d.ts → render-BYdmSviQ.d.ts} +19 -8
- package/package.json +1 -1
- package/src/anim/core/timeline.ts +28 -10
- package/src/anim/core/types.ts +12 -0
- package/src/kinds/chart-slope.tsx +52 -8
- package/src/render/stage.tsx +17 -3
- package/src/render.tsx +8 -1
- package/src/types.ts +19 -8
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as Computed, k as CdlDerivedValue, l as CdlScrollTrigger, L as LaidDiagram, m as CdlDiagramViewProps, n as LaidEdge, o as LaidNode, p as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-
|
|
2
|
-
export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as ChartPieForm, w as ChartSlopeForm, x as EDGE_HEADS, y as EDGE_HEAD_DEFAULT, z as EDGE_HEAD_FILLS, A as EDGE_HEAD_FILL_DEFAULT, D as EDGE_REVEALS, F as EDGE_REVEAL_DEFAULT, G as EDGE_STYLES, H as EdgeReveal, I as InteractiveHandlerMap, K as InteractiveSignalsAccessor, M as LaidLane, O as NODE_KINDS, P as ScrollProgressHandle, U as TONES, V as computeEventBindingKey, W as computeFormulaKey, X as computeInputSignalKey, Y as computeScrollTriggerKey, Z as computed, _ as createInteractiveSignalsAccessor, $ as createScrollProgressHandle, a0 as createScrollProgressSignals, a1 as hasInteractivePrimitives, a2 as sequenceBoardMetrics, a3 as sequenceStepId, a4 as signal } from './render-
|
|
1
|
+
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as Computed, k as CdlDerivedValue, l as CdlScrollTrigger, L as LaidDiagram, m as CdlDiagramViewProps, n as LaidEdge, o as LaidNode, p as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-BYdmSviQ.cjs';
|
|
2
|
+
export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as ChartPieForm, w as ChartSlopeForm, x as EDGE_HEADS, y as EDGE_HEAD_DEFAULT, z as EDGE_HEAD_FILLS, A as EDGE_HEAD_FILL_DEFAULT, D as EDGE_REVEALS, F as EDGE_REVEAL_DEFAULT, G as EDGE_STYLES, H as EdgeReveal, I as InteractiveHandlerMap, K as InteractiveSignalsAccessor, M as LaidLane, O as NODE_KINDS, P as ScrollProgressHandle, U as TONES, V as computeEventBindingKey, W as computeFormulaKey, X as computeInputSignalKey, Y as computeScrollTriggerKey, Z as computed, _ as createInteractiveSignalsAccessor, $ as createScrollProgressHandle, a0 as createScrollProgressSignals, a1 as hasInteractivePrimitives, a2 as sequenceBoardMetrics, a3 as sequenceStepId, a4 as signal } from './render-BYdmSviQ.cjs';
|
|
3
3
|
import { JSX } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function effect(fn: () => void | (() => void)): () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as Computed, k as CdlDerivedValue, l as CdlScrollTrigger, L as LaidDiagram, m as CdlDiagramViewProps, n as LaidEdge, o as LaidNode, p as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-
|
|
2
|
-
export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as ChartPieForm, w as ChartSlopeForm, x as EDGE_HEADS, y as EDGE_HEAD_DEFAULT, z as EDGE_HEAD_FILLS, A as EDGE_HEAD_FILL_DEFAULT, D as EDGE_REVEALS, F as EDGE_REVEAL_DEFAULT, G as EDGE_STYLES, H as EdgeReveal, I as InteractiveHandlerMap, K as InteractiveSignalsAccessor, M as LaidLane, O as NODE_KINDS, P as ScrollProgressHandle, U as TONES, V as computeEventBindingKey, W as computeFormulaKey, X as computeInputSignalKey, Y as computeScrollTriggerKey, Z as computed, _ as createInteractiveSignalsAccessor, $ as createScrollProgressHandle, a0 as createScrollProgressSignals, a1 as hasInteractivePrimitives, a2 as sequenceBoardMetrics, a3 as sequenceStepId, a4 as signal } from './render-
|
|
1
|
+
import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as EdgeRole, f as EdgeHead, g as EdgeHeadFill, h as CdlState, i as CdlEventTarget, j as Computed, k as CdlDerivedValue, l as CdlScrollTrigger, L as LaidDiagram, m as CdlDiagramViewProps, n as LaidEdge, o as LaidNode, p as CdlEdge, B as BBox, R as RowMark, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-BYdmSviQ.js';
|
|
2
|
+
export { q as CdlDiagramView, r as CdlEventBinding, s as CdlEventKind, t as CdlFormula, u as CdlPhase, v as ChartPieForm, w as ChartSlopeForm, x as EDGE_HEADS, y as EDGE_HEAD_DEFAULT, z as EDGE_HEAD_FILLS, A as EDGE_HEAD_FILL_DEFAULT, D as EDGE_REVEALS, F as EDGE_REVEAL_DEFAULT, G as EDGE_STYLES, H as EdgeReveal, I as InteractiveHandlerMap, K as InteractiveSignalsAccessor, M as LaidLane, O as NODE_KINDS, P as ScrollProgressHandle, U as TONES, V as computeEventBindingKey, W as computeFormulaKey, X as computeInputSignalKey, Y as computeScrollTriggerKey, Z as computed, _ as createInteractiveSignalsAccessor, $ as createScrollProgressHandle, a0 as createScrollProgressSignals, a1 as hasInteractivePrimitives, a2 as sequenceBoardMetrics, a3 as sequenceStepId, a4 as signal } from './render-BYdmSviQ.js';
|
|
3
3
|
import { JSX } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function effect(fn: () => void | (() => void)): () => void;
|
package/dist/index.js
CHANGED
|
@@ -14156,6 +14156,8 @@ var Timeline = class {
|
|
|
14156
14156
|
rafHandle = null;
|
|
14157
14157
|
phaseIndex = 0;
|
|
14158
14158
|
phaseProgress = 0;
|
|
14159
|
+
/** 曲線を通す前の進み (cdl#711)。 経過時間そのものの割合で、 描く動きが読む */
|
|
14160
|
+
phaseLinearProgress = 0;
|
|
14159
14161
|
phaseStartedAt = 0;
|
|
14160
14162
|
status = "idle";
|
|
14161
14163
|
/**
|
|
@@ -14184,12 +14186,12 @@ var Timeline = class {
|
|
|
14184
14186
|
const initial = options.initialPhaseIndex;
|
|
14185
14187
|
if (initial != null && initial > 0 && initial < phases.length) {
|
|
14186
14188
|
this.phaseIndex = initial;
|
|
14187
|
-
this.
|
|
14189
|
+
this.setProgress(1);
|
|
14188
14190
|
this.status = initial === phases.length - 1 ? "settled" : "paused";
|
|
14189
14191
|
}
|
|
14190
14192
|
this.initialState = {
|
|
14191
14193
|
phaseIndex: this.phaseIndex,
|
|
14192
|
-
|
|
14194
|
+
phaseLinearProgress: this.phaseLinearProgress,
|
|
14193
14195
|
status: this.status
|
|
14194
14196
|
};
|
|
14195
14197
|
}
|
|
@@ -14211,13 +14213,14 @@ var Timeline = class {
|
|
|
14211
14213
|
}
|
|
14212
14214
|
snapshot() {
|
|
14213
14215
|
const cached = this.cachedSnapshot;
|
|
14214
|
-
if (cached && cached.status === this.status && cached.phaseIndex === this.phaseIndex && cached.phaseProgress === this.phaseProgress && cached.totalPhases === this.phases.length) {
|
|
14216
|
+
if (cached && cached.status === this.status && cached.phaseIndex === this.phaseIndex && cached.phaseProgress === this.phaseProgress && cached.phaseLinearProgress === this.phaseLinearProgress && cached.totalPhases === this.phases.length) {
|
|
14215
14217
|
return cached;
|
|
14216
14218
|
}
|
|
14217
14219
|
const next = {
|
|
14218
14220
|
status: this.status,
|
|
14219
14221
|
phaseIndex: this.phaseIndex,
|
|
14220
14222
|
phaseProgress: this.phaseProgress,
|
|
14223
|
+
phaseLinearProgress: this.phaseLinearProgress,
|
|
14221
14224
|
totalPhases: this.phases.length
|
|
14222
14225
|
};
|
|
14223
14226
|
this.cachedSnapshot = next;
|
|
@@ -14240,7 +14243,7 @@ var Timeline = class {
|
|
|
14240
14243
|
const clamped = Math.max(0, Math.min(this.phases.length - 1, index));
|
|
14241
14244
|
this.cancelRaf();
|
|
14242
14245
|
this.phaseIndex = clamped;
|
|
14243
|
-
this.
|
|
14246
|
+
this.setProgress(1);
|
|
14244
14247
|
this.status = clamped === this.phases.length - 1 ? "settled" : "paused";
|
|
14245
14248
|
this.emit();
|
|
14246
14249
|
}
|
|
@@ -14280,14 +14283,14 @@ var Timeline = class {
|
|
|
14280
14283
|
if (this.phaseIndex <= 0) return;
|
|
14281
14284
|
this.cancelRaf();
|
|
14282
14285
|
this.phaseIndex -= 1;
|
|
14283
|
-
this.
|
|
14286
|
+
this.setProgress(1);
|
|
14284
14287
|
this.status = "paused";
|
|
14285
14288
|
this.emit();
|
|
14286
14289
|
}
|
|
14287
14290
|
reset() {
|
|
14288
14291
|
this.cancelRaf();
|
|
14289
14292
|
this.phaseIndex = 0;
|
|
14290
|
-
this.
|
|
14293
|
+
this.setProgress(0);
|
|
14291
14294
|
this.status = "idle";
|
|
14292
14295
|
this.emit();
|
|
14293
14296
|
}
|
|
@@ -14308,7 +14311,7 @@ var Timeline = class {
|
|
|
14308
14311
|
this.subscribers.clear();
|
|
14309
14312
|
this.status = this.initialState.status;
|
|
14310
14313
|
this.phaseIndex = this.initialState.phaseIndex;
|
|
14311
|
-
this.
|
|
14314
|
+
this.setProgress(this.initialState.phaseLinearProgress);
|
|
14312
14315
|
}
|
|
14313
14316
|
// ─── internals ───────────────────────────────────────────────
|
|
14314
14317
|
advancePhase() {
|
|
@@ -14344,20 +14347,20 @@ var Timeline = class {
|
|
|
14344
14347
|
}, ms);
|
|
14345
14348
|
}
|
|
14346
14349
|
beginPhaseTransition() {
|
|
14347
|
-
this.
|
|
14350
|
+
this.setProgress(0);
|
|
14348
14351
|
this.phaseStartedAt = performance.now();
|
|
14349
14352
|
this.cancelRaf();
|
|
14350
14353
|
const step = (now) => {
|
|
14351
14354
|
const duration = this.autoAdvanceMsOverride ?? this.getPhase().durationMs ?? 600;
|
|
14352
14355
|
const elapsed = now - this.phaseStartedAt;
|
|
14353
14356
|
const linearT = clamp01(elapsed / duration);
|
|
14354
|
-
this.
|
|
14357
|
+
this.setProgress(linearT);
|
|
14355
14358
|
this.emit();
|
|
14356
14359
|
if (linearT < 1) {
|
|
14357
14360
|
this.rafHandle = requestAnimationFrame(step);
|
|
14358
14361
|
return;
|
|
14359
14362
|
}
|
|
14360
|
-
this.
|
|
14363
|
+
this.setProgress(1);
|
|
14361
14364
|
this.emit();
|
|
14362
14365
|
if (this.status === "playing") {
|
|
14363
14366
|
if (this.phaseIndex < this.phases.length - 1) {
|
|
@@ -14372,6 +14375,19 @@ var Timeline = class {
|
|
|
14372
14375
|
};
|
|
14373
14376
|
this.rafHandle = requestAnimationFrame(step);
|
|
14374
14377
|
}
|
|
14378
|
+
/**
|
|
14379
|
+
* 段の進みを 2 つ同時に置く (cdl#711)。
|
|
14380
|
+
*
|
|
14381
|
+
* **代入する場所を 1 つに閉じる**。 曲げた進みと曲げる前の進みを別々に書くと、
|
|
14382
|
+
* どちらかを更新し忘れた経路が「前の段の値のまま」 で残る。
|
|
14383
|
+
*
|
|
14384
|
+
* 両端 (0 と 1) は曲線を通さず、 そのまま置く。 曲線は差し替えられる欄なので、
|
|
14385
|
+
* `easing(1)` が 1 を返す保証がない。 段の始まりと終わりの値は曲線に委ねない。
|
|
14386
|
+
*/
|
|
14387
|
+
setProgress(linear2) {
|
|
14388
|
+
this.phaseLinearProgress = linear2;
|
|
14389
|
+
this.phaseProgress = linear2 <= 0 ? 0 : linear2 >= 1 ? 1 : this.easing(linear2);
|
|
14390
|
+
}
|
|
14375
14391
|
cancelRaf() {
|
|
14376
14392
|
if (this.rafHandle != null) {
|
|
14377
14393
|
cancelAnimationFrame(this.rafHandle);
|
|
@@ -25525,7 +25541,12 @@ function ChartSlopeNode({
|
|
|
25525
25541
|
const \u4E0A\u7AEF = PAD + (\u524D\u3042\u308A ? \u6642\u70B9\u306E\u7D1A + 12 : 0) + 6;
|
|
25526
25542
|
const \u4E0B\u7AEF = Math.max(\u4E0A\u7AEF + 10, node.h - PAD - 6);
|
|
25527
25543
|
const y\u3092\u53D6\u308B = (v) => \u5C3A\u306E\u5E45 > 0 ? \u4E0B\u7AEF - (v - \u6700\u5C0F) / \u5C3A\u306E\u5E45 * (\u4E0B\u7AEF - \u4E0A\u7AEF) : (\u4E0A\u7AEF + \u4E0B\u7AEF) / 2;
|
|
25528
|
-
const \
|
|
25544
|
+
const \u66F8\u3044\u305F\u5F62 = node.chartSlopeForm;
|
|
25545
|
+
const \u5F62 = \u524D\u3042\u308A && (\u66F8\u3044\u305F\u5F62 === "delta" || \u66F8\u3044\u305F\u5F62 === "rank") ? \u66F8\u3044\u305F\u5F62 : "values";
|
|
25546
|
+
const \u9806\u4F4D\u3092\u53D6\u308B = (v, \u5168\u90E8) => \u5168\u90E8.filter((x) => x > v).length + 1;
|
|
25547
|
+
const \u524D\u306E\u9806\u4F4D = \u7CFB\u5217\u305F\u3061.map((s) => \u9806\u4F4D\u3092\u53D6\u308B(s.\u524D, \u7CFB\u5217\u305F\u3061.map((x) => x.\u524D)));
|
|
25548
|
+
const \u4ECA\u306E\u9806\u4F4D = \u7CFB\u5217\u305F\u3061.map((s) => \u9806\u4F4D\u3092\u53D6\u308B(s.\u4ECA, \u7CFB\u5217\u305F\u3061.map((x) => x.\u4ECA)));
|
|
25549
|
+
const \u6BB5\u306Ey\u3092\u53D6\u308B = (\u9806\u4F4D) => \u7CFB\u5217\u305F\u3061.length > 1 ? \u4E0A\u7AEF + (\u9806\u4F4D - 1) / (\u7CFB\u5217\u305F\u3061.length - 1) * (\u4E0B\u7AEF - \u4E0A\u7AEF) : (\u4E0A\u7AEF + \u4E0B\u7AEF) / 2;
|
|
25529
25550
|
const \u5897\u6E1B\u8868\u8A18 = (\u524D, \u4ECA) => {
|
|
25530
25551
|
const \u5DEE = \u4ECA - \u524D;
|
|
25531
25552
|
return \u5DEE > 0 ? `+${\u5B9F\u5024\u8868\u8A18(\u5DEE)}` : \u5B9F\u5024\u8868\u8A18(\u5DEE);
|
|
@@ -25608,8 +25629,8 @@ function ChartSlopeNode({
|
|
|
25608
25629
|
)
|
|
25609
25630
|
] }),
|
|
25610
25631
|
\u7CFB\u5217\u305F\u3061.map((s, i) => {
|
|
25611
|
-
const \u5DE6y = y\u3092\u53D6\u308B(s.\u524D);
|
|
25612
|
-
const \u53F3y = y\u3092\u53D6\u308B(s.\u4ECA);
|
|
25632
|
+
const \u5DE6y = \u5F62 === "rank" ? \u6BB5\u306Ey\u3092\u53D6\u308B(\u524D\u306E\u9806\u4F4D[i]) : y\u3092\u53D6\u308B(s.\u524D);
|
|
25633
|
+
const \u53F3y = \u5F62 === "rank" ? \u6BB5\u306Ey\u3092\u53D6\u308B(\u4ECA\u306E\u9806\u4F4D[i]) : y\u3092\u53D6\u308B(s.\u4ECA);
|
|
25613
25634
|
const \u672A\u89E3\u6C7A = s.\u672A\u89E3\u6C7A ? "true" : void 0;
|
|
25614
25635
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
25615
25636
|
\u524D\u3042\u308A && /* @__PURE__ */ jsx(
|
|
@@ -30640,6 +30661,7 @@ function CdlStage({
|
|
|
30640
30661
|
laid,
|
|
30641
30662
|
currentPhase,
|
|
30642
30663
|
progress,
|
|
30664
|
+
drawProgress,
|
|
30643
30665
|
stateValues,
|
|
30644
30666
|
debug,
|
|
30645
30667
|
compact = false,
|
|
@@ -30697,7 +30719,8 @@ function CdlStage({
|
|
|
30697
30719
|
}
|
|
30698
30720
|
return scales;
|
|
30699
30721
|
}, [laid]);
|
|
30700
|
-
const \u63CF\u304F\u9032\u307F =
|
|
30722
|
+
const \u63CF\u304F\u7D20\u306E\u9032\u307F = drawProgress ?? progress;
|
|
30723
|
+
const \u63CF\u304F\u9032\u307F = \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(\u63CF\u304F\u7D20\u306E\u9032\u307F, currentPhase?.drawRatio);
|
|
30701
30724
|
const { lifelineStarts, uniformFooterTop } = useMemo(() => {
|
|
30702
30725
|
const starts = lifelineStartYs(laid.nodes);
|
|
30703
30726
|
return {
|
|
@@ -30876,7 +30899,7 @@ function CdlStage({
|
|
|
30876
30899
|
edge,
|
|
30877
30900
|
active: activeSet.has(edge.id),
|
|
30878
30901
|
drawing: \u77E2\u5370\u306E\u51FA\u756A.\u4F38\u3070\u3059\u304B(edge.id),
|
|
30879
|
-
progress,
|
|
30902
|
+
progress: \u77E2\u5370\u306E\u51FA\u756A.\u4F38\u3070\u3059\u304B(edge.id) ? \u63CF\u304F\u9032\u307F : progress,
|
|
30880
30903
|
stateValues
|
|
30881
30904
|
},
|
|
30882
30905
|
edge.id
|
|
@@ -31107,6 +31130,7 @@ function CdlDiagramView({ diagram: diagram2, laid: laidProp, hideHeader = false,
|
|
|
31107
31130
|
const phaseIdx = focusPhaseId ? laid.phases.findIndex((p) => p.id === focusPhaseId) : state.phaseIndex;
|
|
31108
31131
|
const currentPhase = laid.phases[Math.max(0, phaseIdx)] ?? laid.phases[0];
|
|
31109
31132
|
const progress = reduced ? 1 : state.phaseProgress;
|
|
31133
|
+
const drawProgress = reduced ? 1 : state.phaseLinearProgress;
|
|
31110
31134
|
const baseStateValues = computeStateValues(laid, phaseIdx, progress);
|
|
31111
31135
|
const isInteractive = hasInteractivePrimitives(diagram2);
|
|
31112
31136
|
const interactive = useInteractiveIntegration(
|
|
@@ -31148,7 +31172,7 @@ function CdlDiagramView({ diagram: diagram2, laid: laidProp, hideHeader = false,
|
|
|
31148
31172
|
}
|
|
31149
31173
|
),
|
|
31150
31174
|
isInteractive && interactive.panel,
|
|
31151
|
-
/* @__PURE__ */ jsx(CdlStage, { laid, currentPhase, progress, stateValues, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
|
|
31175
|
+
/* @__PURE__ */ jsx(CdlStage, { laid, currentPhase, progress, drawProgress, stateValues, debug, compact: hideHeader, svgRef: isInteractive ? interactive.svgRef : void 0 }),
|
|
31152
31176
|
hideHeader && !hideMiniPhaseIndicator && currentPhase && laid.phases.length > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-t border-[var(--cdl-divider,#d4d4d8)]/40 bg-[var(--cdl-stage-bg,#f1f5f9)]/50 px-3 py-2 text-xs", children: [
|
|
31153
31177
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
31154
31178
|
laid.phases.map((p, i) => /* @__PURE__ */ jsx(
|