@markdy/core 1.0.17 → 1.0.19
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/README.md +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,7 +68,8 @@ try {
|
|
|
68
68
|
| `ParseError` | class | Error with `.line` number for diagnostics |
|
|
69
69
|
| `DiagramAST` | type | Parsed scene: meta, nodes, edges, groups, patterns, beats |
|
|
70
70
|
| `RenderPlan` | type | Positioned nodes, routed edges, group zones, sequence messages, timed cues, beat ranges |
|
|
71
|
-
| `SceneMeta` | type | Scene configuration
|
|
71
|
+
| `SceneMeta` | type | Scene configuration; `meta.player` is authoritative, with deprecated flat mirrors retained for compatibility |
|
|
72
|
+
| `PlayerConfig` / `resolvePlayer` | type / function | Grouped playback, controls, interaction, and chrome configuration with host resolution |
|
|
72
73
|
| `NodeDecl` | type | Node declaration (kind, id, label, style) |
|
|
73
74
|
| `EdgeDecl` | type | Edge declaration (kind, from, to, label) |
|
|
74
75
|
| `BeatDecl` | type | Named beat with cues |
|
package/dist/index.d.ts
CHANGED
|
@@ -409,7 +409,7 @@ declare const PLAYER_FLAT_KEYS: string[];
|
|
|
409
409
|
* key is unknown or the value does not fit the setting type.
|
|
410
410
|
*/
|
|
411
411
|
declare function applyPlayerSetting(config: PlayerConfig, scope: PlayerScope, key: string, rawValue: string): string | undefined;
|
|
412
|
-
/** Host
|
|
412
|
+
/** Host behavior overrides. `false` gates a feature off; `true` supplies legacy defaults when script values are absent. */
|
|
413
413
|
type PlayerOverrides = {
|
|
414
414
|
autoplay?: boolean;
|
|
415
415
|
loop?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -611,25 +611,26 @@ function unquote(raw) {
|
|
|
611
611
|
}
|
|
612
612
|
function resolvePlayer(config = {}, overrides = {}) {
|
|
613
613
|
const playback = config.playback ?? {};
|
|
614
|
+
const configuredControls = config.controls ?? {};
|
|
614
615
|
const interaction = config.interaction ?? {};
|
|
615
616
|
const chrome = config.chrome ?? {};
|
|
616
|
-
const
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
theme:
|
|
617
|
+
const controlsAllowed = overrides.controls !== false;
|
|
618
|
+
const hostControlDefault = overrides.controls === true;
|
|
619
|
+
const resolveControl = (value, fallback = hostControlDefault) => controlsAllowed && (value ?? fallback);
|
|
620
|
+
const requestedControls = {
|
|
621
|
+
play: resolveControl(configuredControls.play),
|
|
622
|
+
restart: resolveControl(configuredControls.restart),
|
|
623
|
+
prevBeat: resolveControl(configuredControls.prevBeat, false),
|
|
624
|
+
nextBeat: resolveControl(configuredControls.nextBeat, false),
|
|
625
|
+
seek: resolveControl(configuredControls.seek),
|
|
626
|
+
speed: resolveControl(configuredControls.speed),
|
|
627
|
+
fit: resolveControl(configuredControls.fit),
|
|
628
|
+
resetView: resolveControl(configuredControls.resetView),
|
|
629
|
+
fullscreen: resolveControl(configuredControls.fullscreen),
|
|
630
|
+
svg: resolveControl(configuredControls.svg),
|
|
631
|
+
share: resolveControl(configuredControls.share),
|
|
632
|
+
code: resolveControl(configuredControls.code, false),
|
|
633
|
+
theme: resolveControl(configuredControls.theme, false)
|
|
633
634
|
};
|
|
634
635
|
const interactionOn = overrides.interactiveViewport !== false && (overrides.interactiveViewport === true || config.interaction !== void 0 || overrides.controls === true);
|
|
635
636
|
const gestures = {
|
|
@@ -638,8 +639,16 @@ function resolvePlayer(config = {}, overrides = {}) {
|
|
|
638
639
|
doubleClickToReset: interactionOn && (interaction.doubleClickToReset ?? true)
|
|
639
640
|
};
|
|
640
641
|
const interactionEnabled = gestures.zoom || gestures.pan || gestures.doubleClickToReset;
|
|
641
|
-
const
|
|
642
|
-
const
|
|
642
|
+
const configuredSpeeds = configuredControls.speeds?.length ? configuredControls.speeds : [0.25, 1];
|
|
643
|
+
const speeds = configuredSpeeds.filter(
|
|
644
|
+
(rate2, index) => Number.isFinite(rate2) && rate2 > 0 && configuredSpeeds.indexOf(rate2) === index
|
|
645
|
+
);
|
|
646
|
+
const controls = {
|
|
647
|
+
...requestedControls,
|
|
648
|
+
speed: requestedControls.speed && speeds.length > 1,
|
|
649
|
+
resetView: requestedControls.resetView && interactionEnabled
|
|
650
|
+
};
|
|
651
|
+
const controlsEnabled = Object.values(controls).some(Boolean);
|
|
643
652
|
const rate = overrides.playbackRate ?? playback.rate ?? 1;
|
|
644
653
|
return {
|
|
645
654
|
playback: {
|
|
@@ -649,9 +658,8 @@ function resolvePlayer(config = {}, overrides = {}) {
|
|
|
649
658
|
},
|
|
650
659
|
controls: {
|
|
651
660
|
...controls,
|
|
652
|
-
resetView,
|
|
653
661
|
enabled: controlsEnabled,
|
|
654
|
-
speeds
|
|
662
|
+
speeds
|
|
655
663
|
},
|
|
656
664
|
interaction: {
|
|
657
665
|
...gestures,
|
package/package.json
CHANGED