@markdy/core 1.3.0 → 1.3.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.
Files changed (2) hide show
  1. package/dist/index.js +37 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1917,17 +1917,43 @@ function scheduleBeats(ast, edges) {
1917
1917
  let edgeCounter = edges.length;
1918
1918
  const edgeIds = edges.map((e) => e.id);
1919
1919
  const groupMap = Object.fromEntries(Object.entries(ast.groups).map(([k, g]) => [k, g.members]));
1920
- const hasIntro = ast.beats.some((b) => b.cues.some((c) => c.kind === "show"));
1921
- if (!hasIntro && Object.keys(ast.nodes).length > 0) {
1922
- cues.push({
1923
- start: 0,
1924
- duration: DEFAULTS.show,
1925
- kind: "show",
1926
- targets: Object.keys(ast.nodes),
1927
- params: { stagger: DEFAULTS.stagger },
1928
- beat: "__intro"
1929
- });
1930
- t += DEFAULTS.show + DEFAULTS.cueGap;
1920
+ const hasShowCue = ast.beats.some(
1921
+ (b) => b.cues.some((c) => c.kind === "show" || c.kind === "parallel" && c.cues.some((pc) => pc.kind === "show"))
1922
+ );
1923
+ const flowNodeIds = /* @__PURE__ */ new Set();
1924
+ for (const b of ast.beats) {
1925
+ for (const c of b.cues) {
1926
+ if (c.kind === "flow") {
1927
+ for (const seg of c.segments) {
1928
+ flowNodeIds.add(seg.from);
1929
+ flowNodeIds.add(seg.to);
1930
+ }
1931
+ } else if (c.kind === "parallel") {
1932
+ for (const pc of c.cues) {
1933
+ if (pc.kind === "flow") {
1934
+ for (const seg of pc.segments) {
1935
+ flowNodeIds.add(seg.from);
1936
+ flowNodeIds.add(seg.to);
1937
+ }
1938
+ }
1939
+ }
1940
+ }
1941
+ }
1942
+ }
1943
+ const isSequence = ast.meta.type === "sequence";
1944
+ if (!hasShowCue && Object.keys(ast.nodes).length > 0) {
1945
+ const nodesToReveal = !isSequence && flowNodeIds.size > 0 ? Object.keys(ast.nodes).filter((id) => !flowNodeIds.has(id)) : Object.keys(ast.nodes);
1946
+ if (nodesToReveal.length > 0) {
1947
+ cues.push({
1948
+ start: 0,
1949
+ duration: DEFAULTS.show,
1950
+ kind: "show",
1951
+ targets: nodesToReveal,
1952
+ params: { stagger: DEFAULTS.stagger },
1953
+ beat: "__intro"
1954
+ });
1955
+ t += DEFAULTS.show + DEFAULTS.cueGap;
1956
+ }
1931
1957
  }
1932
1958
  for (const beat of ast.beats) {
1933
1959
  const beatStart = t;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/core",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Diagram-native MarkdyScript parser and compiler (auto-layout, edge routing, cue scheduling) — zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "type": "module",