@markdy/core 1.4.4 → 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/dist/index.d.ts +2 -0
- package/dist/index.js +37 -10
- package/package.json +1 -1
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
|
@@ -4058,11 +4058,19 @@ function parse(source, opts = {}) {
|
|
|
4058
4058
|
meta.title = title;
|
|
4059
4059
|
remainder = str.rest;
|
|
4060
4060
|
}
|
|
4061
|
-
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);
|
|
4062
4062
|
if (inlineLayout) {
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
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, " ");
|
|
4066
4074
|
}
|
|
4067
4075
|
const props = parseProps(remainder);
|
|
4068
4076
|
for (const [k, v] of Object.entries(props)) {
|
|
@@ -4084,8 +4092,16 @@ function parse(source, opts = {}) {
|
|
|
4084
4092
|
meta.theme = val;
|
|
4085
4093
|
meta.explicitTheme = val !== "auto";
|
|
4086
4094
|
} else if (k === "direction" || k === "layout" || k === "rankdir") {
|
|
4087
|
-
|
|
4088
|
-
|
|
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
|
+
}
|
|
4089
4105
|
} else if (PLAYER_FLAT_KEY_SET.has(k)) {
|
|
4090
4106
|
const error = applyPlayerSetting(meta.player ??= {}, "player", k, String(v));
|
|
4091
4107
|
if (error) diagnostics.push({ severity: "warning", message: error, line: lineNo });
|
|
@@ -4122,9 +4138,17 @@ function parse(source, opts = {}) {
|
|
|
4122
4138
|
i++;
|
|
4123
4139
|
continue;
|
|
4124
4140
|
}
|
|
4125
|
-
if (/^layout\s+(LR|RL|TB|BT)\b/i.test(line)) {
|
|
4126
|
-
|
|
4127
|
-
|
|
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
|
+
}
|
|
4128
4152
|
i++;
|
|
4129
4153
|
continue;
|
|
4130
4154
|
}
|
|
@@ -7266,6 +7290,7 @@ function getIntelliCodeCompletions(docText, cursorLine, cursorCol) {
|
|
|
7266
7290
|
}
|
|
7267
7291
|
if (/(layout\s+|direction\s*=\s*)\w*$/i.test(ctx.linePrefix)) {
|
|
7268
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 },
|
|
7269
7294
|
{ label: "LR", insertText: "LR", kind: "layout", detail: "Left-to-Right", documentation: "Horizontal left-to-right system flow layout.", boost: 10 },
|
|
7270
7295
|
{ label: "TB", insertText: "TB", kind: "layout", detail: "Top-to-Bottom", documentation: "Vertical top-to-bottom hierarchy layout.", boost: 9 },
|
|
7271
7296
|
{ label: "RL", insertText: "RL", kind: "layout", detail: "Right-to-Left", documentation: "Right-to-left reverse topology layout.", boost: 5 },
|
|
@@ -7637,7 +7662,9 @@ function formatScene(ast) {
|
|
|
7637
7662
|
if (ast.meta.fps !== 60) sceneParts.push(`fps=${ast.meta.fps}`);
|
|
7638
7663
|
if (ast.meta.duration !== void 0) sceneParts.push(`duration=${ast.meta.duration}`);
|
|
7639
7664
|
lines.push(sceneParts.join(" "));
|
|
7640
|
-
if (ast.meta.
|
|
7665
|
+
if (ast.meta.layoutMode === "auto") {
|
|
7666
|
+
lines.push("layout auto");
|
|
7667
|
+
} else if (ast.meta.direction !== "LR") {
|
|
7641
7668
|
lines.push(`layout ${ast.meta.direction}`);
|
|
7642
7669
|
}
|
|
7643
7670
|
for (const style of Object.values(ast.styles)) {
|
package/package.json
CHANGED