@cardenelabs/cdl 0.17.1 → 0.18.1
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 +49 -1
- package/dist/index.cjs +54 -4
- 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 +53 -5
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +51 -4
- 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 +51 -4
- package/dist/react.js.map +1 -1
- package/dist/{render-Dc5Pdf7e.d.cts → render-Czv0tUon.d.cts} +25 -1
- package/dist/{render-Dc5Pdf7e.d.ts → render-Czv0tUon.d.ts} +25 -1
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/layout.ts +2 -0
- package/src/render/edges.tsx +18 -2
- package/src/render/stage.tsx +63 -5
- package/src/types.ts +27 -0
package/dist/react.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export { p as CdlDiagramView, l as CdlDiagramViewProps } from './render-
|
|
2
|
+
export { p as CdlDiagramView, l as CdlDiagramViewProps } from './render-Czv0tUon.cjs';
|
package/dist/react.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export { p as CdlDiagramView, l as CdlDiagramViewProps } from './render-
|
|
2
|
+
export { p as CdlDiagramView, l as CdlDiagramViewProps } from './render-Czv0tUon.js';
|
package/dist/react.js
CHANGED
|
@@ -4035,6 +4035,8 @@ function layout(diag) {
|
|
|
4035
4035
|
states: diag.states,
|
|
4036
4036
|
phases: diag.phases,
|
|
4037
4037
|
...diag.derived ? { derived: diag.derived } : {},
|
|
4038
|
+
// 矢印をいつ出すか (#582)。 描き手が読む欄なので、そのまま持ち越す
|
|
4039
|
+
...diag.edgeReveal ? { edgeReveal: diag.edgeReveal } : {},
|
|
4038
4040
|
bboxes,
|
|
4039
4041
|
collisions,
|
|
4040
4042
|
nearCollisions,
|
|
@@ -4192,6 +4194,7 @@ var EDGE_HEADS = [
|
|
|
4192
4194
|
];
|
|
4193
4195
|
var EDGE_HEAD_FILL_DEFAULT = "solid";
|
|
4194
4196
|
var EDGE_HEAD_FILLS = ["solid", "hollow"];
|
|
4197
|
+
var EDGE_REVEAL_DEFAULT = "phase";
|
|
4195
4198
|
|
|
4196
4199
|
// src/formula/evaluator.ts
|
|
4197
4200
|
function evaluate(ast, ctxOrResolver) {
|
|
@@ -5571,6 +5574,7 @@ function labelTextOpacity(line) {
|
|
|
5571
5574
|
function CdlEdgeView({
|
|
5572
5575
|
edge,
|
|
5573
5576
|
active,
|
|
5577
|
+
drawing,
|
|
5574
5578
|
progress,
|
|
5575
5579
|
stateValues
|
|
5576
5580
|
}) {
|
|
@@ -5595,6 +5599,7 @@ function CdlEdgeView({
|
|
|
5595
5599
|
"data-cdl-from": edge.from,
|
|
5596
5600
|
"data-cdl-to": edge.to,
|
|
5597
5601
|
"data-cdl-active": active ? "true" : "false",
|
|
5602
|
+
"data-cdl-drawing": drawing ? "true" : "false",
|
|
5598
5603
|
"data-cdl-path-d": edge.d,
|
|
5599
5604
|
"data-cdl-label-x": edge.labelX,
|
|
5600
5605
|
"data-cdl-label-y": edge.labelY,
|
|
@@ -5626,6 +5631,7 @@ function CdlEdgeView({
|
|
|
5626
5631
|
{
|
|
5627
5632
|
edge,
|
|
5628
5633
|
active,
|
|
5634
|
+
drawing,
|
|
5629
5635
|
progress,
|
|
5630
5636
|
color,
|
|
5631
5637
|
marker,
|
|
@@ -5653,6 +5659,7 @@ function CdlEdgeView({
|
|
|
5653
5659
|
function SolidEdgePath({
|
|
5654
5660
|
edge,
|
|
5655
5661
|
active,
|
|
5662
|
+
drawing,
|
|
5656
5663
|
progress,
|
|
5657
5664
|
color,
|
|
5658
5665
|
marker,
|
|
@@ -5660,7 +5667,7 @@ function SolidEdgePath({
|
|
|
5660
5667
|
dashed,
|
|
5661
5668
|
stateValues
|
|
5662
5669
|
}) {
|
|
5663
|
-
const visibleD =
|
|
5670
|
+
const visibleD = drawing ? pathSubpath(edge.d, progress) : edge.d;
|
|
5664
5671
|
const defaultWidth = active ? 5 : 2.5;
|
|
5665
5672
|
const boundWidth = edge.widthBind && stateValues ? resolveNumericAttr(edge.widthBind, stateValues, defaultWidth) : defaultWidth;
|
|
5666
5673
|
const boundStroke = edge.strokeBind && stateValues ? interpolate(edge.strokeBind, stateValues) : color;
|
|
@@ -14195,6 +14202,36 @@ function CdlStage({
|
|
|
14195
14202
|
svgRef
|
|
14196
14203
|
}) {
|
|
14197
14204
|
const activeSet = new Set(currentPhase?.activate ?? []);
|
|
14205
|
+
const \u77E2\u5370\u306E\u51FA\u756A = useMemo(() => {
|
|
14206
|
+
const \u521D\u51FA = /* @__PURE__ */ new Map();
|
|
14207
|
+
laid.phases.forEach((p, i) => {
|
|
14208
|
+
for (const id of p.activate ?? []) if (!\u521D\u51FA.has(id)) \u521D\u51FA.set(id, i);
|
|
14209
|
+
});
|
|
14210
|
+
const \u4ECA = currentPhase === void 0 ? -1 : laid.phases.findIndex((p) => p.id === currentPhase.id);
|
|
14211
|
+
const \u96A0\u3059 = (laid.edgeReveal ?? EDGE_REVEAL_DEFAULT) !== "all";
|
|
14212
|
+
return {
|
|
14213
|
+
\u51FA\u308B\u304B: (edgeId) => {
|
|
14214
|
+
if (!\u96A0\u3059) return true;
|
|
14215
|
+
const first = \u521D\u51FA.get(edgeId);
|
|
14216
|
+
if (first === void 0) return true;
|
|
14217
|
+
return \u4ECA < 0 || \u4ECA >= first;
|
|
14218
|
+
},
|
|
14219
|
+
/*
|
|
14220
|
+
* この段で初めて出るか (#584)。
|
|
14221
|
+
*
|
|
14222
|
+
* 起点から伸ばすのはこの段だけ。 光っているかで引くと、段をまたいで光り続ける図で
|
|
14223
|
+
* 既に見えている線が毎段引き直される (実測 = 表の図で 3 本とも段が変わるたびに伸び直した)。
|
|
14224
|
+
*
|
|
14225
|
+
* **隠さない図でも初出は数える**。 `all` は「最初から見せる」 だけの指定で、
|
|
14226
|
+
* 伸びる動きまで毎段繰り返してよいという意味ではない。
|
|
14227
|
+
*/
|
|
14228
|
+
\u4F38\u3070\u3059\u304B: (edgeId) => {
|
|
14229
|
+
const first = \u521D\u51FA.get(edgeId);
|
|
14230
|
+
if (first === void 0) return false;
|
|
14231
|
+
return \u4ECA === first;
|
|
14232
|
+
}
|
|
14233
|
+
};
|
|
14234
|
+
}, [laid.phases, currentPhase, laid.edgeReveal]);
|
|
14198
14235
|
const drawSet = new Set(currentPhase?.draw ?? []);
|
|
14199
14236
|
const \u63CF\u304F\u9032\u307F = \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, currentPhase?.drawRatio);
|
|
14200
14237
|
const { lifelineStarts, uniformFooterTop } = useMemo(() => {
|
|
@@ -14354,7 +14391,17 @@ function CdlStage({
|
|
|
14354
14391
|
},
|
|
14355
14392
|
lane.id
|
|
14356
14393
|
)),
|
|
14357
|
-
laid.edges.map((edge) => /* @__PURE__ */ jsx(
|
|
14394
|
+
laid.edges.filter((edge) => \u77E2\u5370\u306E\u51FA\u756A.\u51FA\u308B\u304B(edge.id)).map((edge) => /* @__PURE__ */ jsx(
|
|
14395
|
+
CdlEdgeView,
|
|
14396
|
+
{
|
|
14397
|
+
edge,
|
|
14398
|
+
active: activeSet.has(edge.id),
|
|
14399
|
+
drawing: \u77E2\u5370\u306E\u51FA\u756A.\u4F38\u3070\u3059\u304B(edge.id),
|
|
14400
|
+
progress,
|
|
14401
|
+
stateValues
|
|
14402
|
+
},
|
|
14403
|
+
edge.id
|
|
14404
|
+
)),
|
|
14358
14405
|
laid.nodes.map((node) => {
|
|
14359
14406
|
const \u63CF\u304F = drawSet.has(node.id);
|
|
14360
14407
|
const view = /* @__PURE__ */ jsx(
|
|
@@ -14370,8 +14417,8 @@ function CdlStage({
|
|
|
14370
14417
|
);
|
|
14371
14418
|
return /* @__PURE__ */ jsx("g", { children: view }, node.id);
|
|
14372
14419
|
}),
|
|
14373
|
-
laid.edges.filter((edge) => Boolean(edge.dThrough)).map((edge) => /* @__PURE__ */ jsx(CdlEdgeGlowView, { edge, active: activeSet.has(edge.id) }, `glow-${edge.id}`)),
|
|
14374
|
-
laid.edges.map((edge) => /* @__PURE__ */ jsx(
|
|
14420
|
+
laid.edges.filter((edge) => Boolean(edge.dThrough) && \u77E2\u5370\u306E\u51FA\u756A.\u51FA\u308B\u304B(edge.id)).map((edge) => /* @__PURE__ */ jsx(CdlEdgeGlowView, { edge, active: activeSet.has(edge.id) }, `glow-${edge.id}`)),
|
|
14421
|
+
laid.edges.filter((edge) => \u77E2\u5370\u306E\u51FA\u756A.\u51FA\u308B\u304B(edge.id)).map((edge) => /* @__PURE__ */ jsx(
|
|
14375
14422
|
CdlEdgeLabelView,
|
|
14376
14423
|
{
|
|
14377
14424
|
edge,
|