@markdy/core 1.4.3 → 1.4.5
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 +3 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +46 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
<a href="https://markdy.com/playground/"><img src="https://img.shields.io/badge/⚡_Live_Studio-markdy.com%2Fplayground-3b82f6?style=for-the-badge" alt="Live Studio" /></a>
|
|
5
5
|
<a href="https://markdy.com/docs/"><img src="https://img.shields.io/badge/📖_Docs-Documentation-10b981?style=for-the-badge" alt="Documentation" /></a>
|
|
6
6
|
<a href="https://marketplace.visualstudio.com/items?itemName=hoangyell.markdy-vscode"><img src="https://img.shields.io/badge/🔌_VS_Code-Extension-8b5cf6?style=for-the-badge" alt="VS Code Extension" /></a>
|
|
7
|
+
<a href="https://github.com/sponsors/HoangYell"><img src="https://img.shields.io/badge/💖_Sponsor-Support_Markdy-ea4aaa?style=for-the-badge" alt="Sponsor Markdy" /></a>
|
|
7
8
|
</p>
|
|
8
9
|
|
|
9
10
|
The zero-dependency parser, dynamic port multiplexer, and AST routing engine for [MarkdyScript](https://markdy.com/docs/) — a diagram-native DSL for animated architecture diagrams that AI agents generate reliably.
|
|
10
11
|
|
|
11
12
|
> 🚀 **Try it live**: Test MarkdyScript in the browser at **[markdy.com/playground](https://markdy.com/playground/)**
|
|
12
13
|
> 📚 **Documentation**: Complete syntax guide and examples at **[markdy.com/docs](https://markdy.com/docs/)**
|
|
13
|
-
> 🌟 **Architecture Blueprints**: 30+ canonical production diagrams at **[markdy.com/examples](https://markdy.com/examples/)**
|
|
14
|
+
> 🌟 **Architecture Blueprints**: 30+ canonical production diagrams at **[markdy.com/examples](https://markdy.com/examples/)**
|
|
15
|
+
> 💼 **Enterprise & Commercial**: Free under MIT. To support development or request custom architecture blueprints, explore **[GitHub Sponsors](https://github.com/sponsors/HoangYell)**.
|
|
14
16
|
|
|
15
17
|
## Features
|
|
16
18
|
|
package/dist/index.d.ts
CHANGED
|
@@ -87,6 +87,8 @@ type SceneMeta = {
|
|
|
87
87
|
explicitTheme?: boolean;
|
|
88
88
|
/** Whether layout direction was explicitly specified by the author in the script. */
|
|
89
89
|
explicitDirection?: boolean;
|
|
90
|
+
/** Layout mode: explicit fixed direction or adaptive auto. */
|
|
91
|
+
layoutMode?: "auto" | "explicit";
|
|
90
92
|
/** Opt-in diagram mode; defaults to architecture. */
|
|
91
93
|
type?: DiagramType;
|
|
92
94
|
/** Playback, controls, interaction, and chrome behavior. Source of truth. */
|
package/dist/index.js
CHANGED
|
@@ -521,6 +521,7 @@ var FLAT = {
|
|
|
521
521
|
next_beat: CONTROLS.next_beat,
|
|
522
522
|
keyboard: INTERACTION.keyboard,
|
|
523
523
|
shortcuts: INTERACTION.shortcuts,
|
|
524
|
+
fit: CONTROLS.fit,
|
|
524
525
|
fitView: CONTROLS.fitView,
|
|
525
526
|
fit_view: CONTROLS.fit_view,
|
|
526
527
|
fitViewButton: CONTROLS.fitViewButton,
|
|
@@ -642,6 +643,7 @@ function resolvePlayer(config = {}, overrides = {}) {
|
|
|
642
643
|
const chrome = config.chrome ?? {};
|
|
643
644
|
const controlsAllowed = overrides.controls !== false;
|
|
644
645
|
const hostControlDefault = overrides.controls === true;
|
|
646
|
+
const hasControlsConfig = config.controls !== void 0 || overrideControls !== void 0;
|
|
645
647
|
const resolveControl = (value, fallback = hostControlDefault) => controlsAllowed && (value ?? fallback);
|
|
646
648
|
const requestedControls = {
|
|
647
649
|
play: resolveControl(configuredControls.play),
|
|
@@ -659,11 +661,13 @@ function resolvePlayer(config = {}, overrides = {}) {
|
|
|
659
661
|
code: resolveControl(configuredControls.code, false),
|
|
660
662
|
theme: resolveControl(configuredControls.theme, hostControlDefault)
|
|
661
663
|
};
|
|
662
|
-
const
|
|
664
|
+
const hasExplicitInteraction = config.interaction !== void 0;
|
|
665
|
+
const fallbackGesture = overrides.interactiveViewport === true || overrides.controls === true;
|
|
666
|
+
const interactionOn = overrides.interactiveViewport === true || overrides.controls === true || overrides.interactiveViewport !== false && hasExplicitInteraction;
|
|
663
667
|
const gestures = {
|
|
664
|
-
zoom: interactionOn && (interaction.zoom ??
|
|
665
|
-
pan: interactionOn && (interaction.pan ??
|
|
666
|
-
doubleClickToReset: interactionOn && (interaction.doubleClickToReset ??
|
|
668
|
+
zoom: interactionOn && (interaction.zoom ?? fallbackGesture),
|
|
669
|
+
pan: interactionOn && (interaction.pan ?? fallbackGesture),
|
|
670
|
+
doubleClickToReset: interactionOn && (interaction.doubleClickToReset ?? fallbackGesture)
|
|
667
671
|
};
|
|
668
672
|
const interactionEnabled = gestures.zoom || gestures.pan || gestures.doubleClickToReset;
|
|
669
673
|
const configuredSpeeds = configuredControls.speeds?.length ? configuredControls.speeds : [0.25, 1];
|
|
@@ -692,7 +696,7 @@ function resolvePlayer(config = {}, overrides = {}) {
|
|
|
692
696
|
interaction: {
|
|
693
697
|
...gestures,
|
|
694
698
|
enabled: interactionEnabled,
|
|
695
|
-
clickToPlay: overrides.clickToPlay ?? (
|
|
699
|
+
clickToPlay: overrides.clickToPlay ?? (interaction.clickToPlay ?? true),
|
|
696
700
|
keyboard: interactionOn && (interaction.keyboard ?? false)
|
|
697
701
|
},
|
|
698
702
|
chrome: {
|
|
@@ -4054,11 +4058,19 @@ function parse(source, opts = {}) {
|
|
|
4054
4058
|
meta.title = title;
|
|
4055
4059
|
remainder = str.rest;
|
|
4056
4060
|
}
|
|
4057
|
-
const inlineLayout = remainder.match(/\b(?:layout|direction|rankdir)\s+(LR|RL|TB|BT)\b/i);
|
|
4061
|
+
const inlineLayout = remainder.match(/\b(?:layout|direction|rankdir)\s+(LR|RL|TB|BT|auto)\b/i);
|
|
4058
4062
|
if (inlineLayout) {
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4063
|
+
const val = inlineLayout[1].toUpperCase();
|
|
4064
|
+
if (val === "AUTO") {
|
|
4065
|
+
meta.direction = "LR";
|
|
4066
|
+
meta.explicitDirection = false;
|
|
4067
|
+
meta.layoutMode = "auto";
|
|
4068
|
+
} else {
|
|
4069
|
+
meta.direction = val;
|
|
4070
|
+
meta.explicitDirection = true;
|
|
4071
|
+
meta.layoutMode = "explicit";
|
|
4072
|
+
}
|
|
4073
|
+
remainder = remainder.replace(/\b(?:layout|direction|rankdir)\s+(LR|RL|TB|BT|auto)\b/i, " ");
|
|
4062
4074
|
}
|
|
4063
4075
|
const props = parseProps(remainder);
|
|
4064
4076
|
for (const [k, v] of Object.entries(props)) {
|
|
@@ -4080,8 +4092,16 @@ function parse(source, opts = {}) {
|
|
|
4080
4092
|
meta.theme = val;
|
|
4081
4093
|
meta.explicitTheme = val !== "auto";
|
|
4082
4094
|
} else if (k === "direction" || k === "layout" || k === "rankdir") {
|
|
4083
|
-
|
|
4084
|
-
|
|
4095
|
+
const val = String(v).toUpperCase();
|
|
4096
|
+
if (val === "AUTO") {
|
|
4097
|
+
meta.direction = "LR";
|
|
4098
|
+
meta.explicitDirection = false;
|
|
4099
|
+
meta.layoutMode = "auto";
|
|
4100
|
+
} else {
|
|
4101
|
+
meta.direction = val;
|
|
4102
|
+
meta.explicitDirection = true;
|
|
4103
|
+
meta.layoutMode = "explicit";
|
|
4104
|
+
}
|
|
4085
4105
|
} else if (PLAYER_FLAT_KEY_SET.has(k)) {
|
|
4086
4106
|
const error = applyPlayerSetting(meta.player ??= {}, "player", k, String(v));
|
|
4087
4107
|
if (error) diagnostics.push({ severity: "warning", message: error, line: lineNo });
|
|
@@ -4118,9 +4138,17 @@ function parse(source, opts = {}) {
|
|
|
4118
4138
|
i++;
|
|
4119
4139
|
continue;
|
|
4120
4140
|
}
|
|
4121
|
-
if (/^layout\s+(LR|RL|TB|BT)\b/i.test(line)) {
|
|
4122
|
-
|
|
4123
|
-
|
|
4141
|
+
if (/^layout\s+(LR|RL|TB|BT|auto)\b/i.test(line)) {
|
|
4142
|
+
const val = line.split(/\s+/)[1].toUpperCase();
|
|
4143
|
+
if (val === "AUTO") {
|
|
4144
|
+
meta.direction = "LR";
|
|
4145
|
+
meta.explicitDirection = false;
|
|
4146
|
+
meta.layoutMode = "auto";
|
|
4147
|
+
} else {
|
|
4148
|
+
meta.direction = val;
|
|
4149
|
+
meta.explicitDirection = true;
|
|
4150
|
+
meta.layoutMode = "explicit";
|
|
4151
|
+
}
|
|
4124
4152
|
i++;
|
|
4125
4153
|
continue;
|
|
4126
4154
|
}
|
|
@@ -7262,6 +7290,7 @@ function getIntelliCodeCompletions(docText, cursorLine, cursorCol) {
|
|
|
7262
7290
|
}
|
|
7263
7291
|
if (/(layout\s+|direction\s*=\s*)\w*$/i.test(ctx.linePrefix)) {
|
|
7264
7292
|
items.push(
|
|
7293
|
+
{ label: "auto", insertText: "auto", kind: "layout", detail: "Responsive Auto (LR / TB)", documentation: "Automatically adapts layout orientation between horizontal (LR) and vertical (TB) based on container width.", boost: 11 },
|
|
7265
7294
|
{ label: "LR", insertText: "LR", kind: "layout", detail: "Left-to-Right", documentation: "Horizontal left-to-right system flow layout.", boost: 10 },
|
|
7266
7295
|
{ label: "TB", insertText: "TB", kind: "layout", detail: "Top-to-Bottom", documentation: "Vertical top-to-bottom hierarchy layout.", boost: 9 },
|
|
7267
7296
|
{ label: "RL", insertText: "RL", kind: "layout", detail: "Right-to-Left", documentation: "Right-to-left reverse topology layout.", boost: 5 },
|
|
@@ -7633,7 +7662,9 @@ function formatScene(ast) {
|
|
|
7633
7662
|
if (ast.meta.fps !== 60) sceneParts.push(`fps=${ast.meta.fps}`);
|
|
7634
7663
|
if (ast.meta.duration !== void 0) sceneParts.push(`duration=${ast.meta.duration}`);
|
|
7635
7664
|
lines.push(sceneParts.join(" "));
|
|
7636
|
-
if (ast.meta.
|
|
7665
|
+
if (ast.meta.layoutMode === "auto") {
|
|
7666
|
+
lines.push("layout auto");
|
|
7667
|
+
} else if (ast.meta.direction !== "LR") {
|
|
7637
7668
|
lines.push(`layout ${ast.meta.direction}`);
|
|
7638
7669
|
}
|
|
7639
7670
|
for (const style of Object.values(ast.styles)) {
|
package/package.json
CHANGED