@markdy/renderer-dom 1.4.18 → 1.4.20

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 +17 -4
  2. package/package.json +6 -7
package/dist/index.js CHANGED
@@ -6323,10 +6323,21 @@ function checkElementTheme(el, lightTheme = "paper", darkTheme = "nebula") {
6323
6323
  if (lower.includes("dark")) return darkTheme;
6324
6324
  if (lower.includes("light")) return lightTheme;
6325
6325
  }
6326
- const cls = el.className;
6327
- if (typeof cls === "string" && cls.length > 0) {
6328
- if (/\b(dark|dark-mode|dark-theme|theme-dark|vscode-dark)\b/i.test(cls)) return darkTheme;
6329
- if (/\b(light|light-mode|light-theme|theme-light|vscode-light)\b/i.test(cls)) return lightTheme;
6326
+ if (el.classList) {
6327
+ const darkClasses = ["dark", "dark-mode", "dark-theme", "theme-dark", "vscode-dark"];
6328
+ for (const c of darkClasses) {
6329
+ if (el.classList.contains(c)) return darkTheme;
6330
+ }
6331
+ const lightClasses = ["light", "light-mode", "light-theme", "theme-light", "vscode-light"];
6332
+ for (const c of lightClasses) {
6333
+ if (el.classList.contains(c)) return lightTheme;
6334
+ }
6335
+ } else {
6336
+ const cls = el.className;
6337
+ if (typeof cls === "string" && cls.length > 0) {
6338
+ if (/(?:^|\s)(dark|dark-mode|dark-theme|theme-dark|vscode-dark)(?:\s|$)/i.test(cls)) return darkTheme;
6339
+ if (/(?:^|\s)(light|light-mode|light-theme|theme-light|vscode-light)(?:\s|$)/i.test(cls)) return lightTheme;
6340
+ }
6330
6341
  }
6331
6342
  return null;
6332
6343
  }
@@ -7500,6 +7511,8 @@ function createDiagram(opts) {
7500
7511
  const newTheme = typeof theme === "string" ? resolveTheme2(theme) : theme;
7501
7512
  plan.theme = newTheme;
7502
7513
  applyThemeVariables(container, newTheme);
7514
+ applyThemeVariables(viewport, newTheme);
7515
+ viewport.style.background = newTheme.canvas;
7503
7516
  applyThemeToScene(scene, newTheme);
7504
7517
  if (footer) {
7505
7518
  applyThemeVariables(footer, newTheme);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/renderer-dom",
3
- "version": "1.4.18",
3
+ "version": "1.4.20",
4
4
  "description": "Browser renderer for diagram-native animated MarkdyScript architecture diagrams, built on the Web Animations API.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,19 +41,18 @@
41
41
  "url": "https://github.com/HoangYell/markdy-com/issues"
42
42
  },
43
43
  "publishConfig": {
44
- "access": "public",
45
- "registry": "https://registry.npmjs.org"
44
+ "access": "public"
46
45
  },
47
46
  "dependencies": {
48
- "html2canvas": "^1.4.1",
49
- "@markdy/core": "1.4.18"
47
+ "@markdy/core": "^1.4.20",
48
+ "html2canvas": "^1.4.1"
50
49
  },
51
50
  "devDependencies": {
51
+ "@markdy/stdlib-systems": "^1.4.20",
52
52
  "jsdom": "^29.1.1",
53
53
  "tsup": "^8.5.1",
54
54
  "typescript": "^5.9.3",
55
- "vitest": "^4.1.7",
56
- "@markdy/stdlib-systems": "1.4.18"
55
+ "vitest": "^4.1.7"
57
56
  },
58
57
  "scripts": {
59
58
  "build": "tsup",