@cbnventures/docusaurus-preset-nova 0.29.0 → 0.30.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cbnventures/docusaurus-preset-nova",
3
- "version": "0.29.0",
3
+ "version": "0.30.1",
4
4
  "description": "Scripts, templates, and project configuration for the common JavaScript and TypeScript developer",
5
5
  "keywords": [
6
6
  "eslint",
@@ -71,10 +71,10 @@
71
71
  "private": false,
72
72
  "scripts": {
73
73
  "dev": "node ../../scripts/nova-run-scripts.mjs --parallel --node-env development 'dev:*'",
74
- "dev:watch-plugin": "tsc --project tsconfig.plugin.json --watch",
74
+ "dev:watch-plugin": "node ../../scripts/nova-transpile.mjs --project tsconfig.plugin.json --watch",
75
75
  "dev:watch-styles": "node ../../scripts/copy-styles.mjs --watch",
76
- "dev:watch-theme": "tsc --project tsconfig.theme.json --watch",
77
- "dev:watch-cli": "tsc --project tsconfig.cli.json --watch",
76
+ "dev:watch-theme": "node ../../scripts/nova-transpile.mjs --project tsconfig.theme.json --watch",
77
+ "dev:watch-cli": "node ../../scripts/nova-transpile.mjs --project tsconfig.cli.json --watch",
78
78
  "dev:fix-shiki-import": "node ../../scripts/fix-shiki-import.mjs --watch",
79
79
  "check": "node ../../scripts/nova-run-scripts.mjs --sequential 'check:*'",
80
80
  "check:lint": "eslint ./ --max-warnings=0",
@@ -85,10 +85,10 @@
85
85
  "check:types-config": "node ../../scripts/nova-type-check.mjs --project tsconfig.config.json",
86
86
  "check:test": "vitest run",
87
87
  "build": "node ../../scripts/nova-run-scripts.mjs --sequential --node-env production 'build:*'",
88
- "build:transpile-theme": "tsc --project tsconfig.theme.json --outDir ./build --skipLibCheck",
89
- "build:transpile-plugin": "tsc --project tsconfig.plugin.json --outDir ./build --skipLibCheck",
90
- "build:transpile-worker": "tsc --project tsconfig.worker.json --outDir ./build --skipLibCheck",
91
- "build:transpile-cli": "tsc --project tsconfig.cli.json --outDir ./build --skipLibCheck",
88
+ "build:transpile-theme": "node ../../scripts/nova-transpile.mjs --project tsconfig.theme.json",
89
+ "build:transpile-plugin": "node ../../scripts/nova-transpile.mjs --project tsconfig.plugin.json",
90
+ "build:transpile-worker": "node ../../scripts/nova-transpile.mjs --project tsconfig.worker.json",
91
+ "build:transpile-cli": "node ../../scripts/nova-transpile.mjs --project tsconfig.cli.json",
92
92
  "build:copy-types": "shx rm -rf \"./build/src/types\" && shx cp -r \"./src/types\" \"./build/src/types\"",
93
93
  "build:fix-shiki-import": "node ../../scripts/fix-shiki-import.mjs",
94
94
  "build:copy-styles": "node ../../scripts/copy-styles.mjs",
@@ -100,7 +100,7 @@
100
100
  "node": "^22 || ^24"
101
101
  },
102
102
  "dependencies": {
103
- "@cbnventures/nova": "0.29.0",
103
+ "@cbnventures/nova": "0.30.1",
104
104
  "@codesandbox/sandpack-react": "2.20.0",
105
105
  "@docusaurus/plugin-content-blog": "3.10.2",
106
106
  "@docusaurus/plugin-content-docs": "3.10.2",
@@ -0,0 +1,8 @@
1
+ import type { Lib_MermaidViewport_ClampScale_Returns, Lib_MermaidViewport_ClampScale_Value, Lib_MermaidViewport_MaxScale, Lib_MermaidViewport_MinScale, Lib_MermaidViewport_PanStep, Lib_MermaidViewport_ResolvePan_Current, Lib_MermaidViewport_ResolvePan_Returns, Lib_MermaidViewport_ResolvePan_Start, Lib_MermaidViewport_ResolvePan_StartPosition, Lib_MermaidViewport_ScaleStep } from '../types/lib/mermaid-viewport.d.ts';
2
+ export declare const MERMAID_MIN_SCALE: Lib_MermaidViewport_MinScale;
3
+ export declare const MERMAID_MAX_SCALE: Lib_MermaidViewport_MaxScale;
4
+ export declare const MERMAID_SCALE_STEP: Lib_MermaidViewport_ScaleStep;
5
+ export declare const MERMAID_PAN_STEP: Lib_MermaidViewport_PanStep;
6
+ export declare function clampScale(value: Lib_MermaidViewport_ClampScale_Value): Lib_MermaidViewport_ClampScale_Returns;
7
+ export declare function resolvePan(startPosition: Lib_MermaidViewport_ResolvePan_StartPosition, start: Lib_MermaidViewport_ResolvePan_Start, current: Lib_MermaidViewport_ResolvePan_Current): Lib_MermaidViewport_ResolvePan_Returns;
8
+ //# sourceMappingURL=mermaid-viewport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mermaid-viewport.d.ts","sourceRoot":"","sources":["../../../src/lib/mermaid-viewport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sCAAsC,EACtC,oCAAoC,EACpC,4BAA4B,EAC5B,4BAA4B,EAC5B,2BAA2B,EAC3B,sCAAsC,EACtC,sCAAsC,EACtC,oCAAoC,EACpC,4CAA4C,EAC5C,6BAA6B,EAC9B,MAAM,oCAAoC,CAAC;AAU5C,eAAO,MAAM,iBAAiB,EAAE,4BAAkC,CAAC;AAUnE,eAAO,MAAM,iBAAiB,EAAE,4BAAgC,CAAC;AAUjE,eAAO,MAAM,kBAAkB,EAAE,6BAAoC,CAAC;AAUtE,eAAO,MAAM,gBAAgB,EAAE,2BAAgC,CAAC;AAchE,wBAAgB,UAAU,CAAC,KAAK,EAAE,oCAAoC,GAAG,sCAAsC,CAE9G;AAgBD,wBAAgB,UAAU,CAAC,aAAa,EAAE,4CAA4C,EAAE,KAAK,EAAE,oCAAoC,EAAE,OAAO,EAAE,sCAAsC,GAAG,sCAAsC,CAK5N"}
@@ -0,0 +1,14 @@
1
+ export const MERMAID_MIN_SCALE = 0.5;
2
+ export const MERMAID_MAX_SCALE = 3;
3
+ export const MERMAID_SCALE_STEP = 0.25;
4
+ export const MERMAID_PAN_STEP = 32;
5
+ export function clampScale(value) {
6
+ return Math.min(MERMAID_MAX_SCALE, Math.max(MERMAID_MIN_SCALE, value));
7
+ }
8
+ export function resolvePan(startPosition, start, current) {
9
+ return {
10
+ x: startPosition['x'] + current['x'] - start['x'],
11
+ y: startPosition['y'] + current['y'] - start['y'],
12
+ };
13
+ }
14
+ //# sourceMappingURL=mermaid-viewport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mermaid-viewport.js","sourceRoot":"","sources":["../../../src/lib/mermaid-viewport.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,MAAM,iBAAiB,GAAiC,GAAG,CAAC;AAUnE,MAAM,CAAC,MAAM,iBAAiB,GAAiC,CAAC,CAAC;AAUjE,MAAM,CAAC,MAAM,kBAAkB,GAAkC,IAAI,CAAC;AAUtE,MAAM,CAAC,MAAM,gBAAgB,GAAgC,EAAE,CAAC;AAchE,MAAM,UAAU,UAAU,CAAC,KAA2C;IACpE,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC;AACzE,CAAC;AAgBD,MAAM,UAAU,UAAU,CAAC,aAA2D,EAAE,KAA2C,EAAE,OAA+C;IAClL,OAAO;QACL,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;QACjD,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;KAClD,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"base-set.d.ts","sourceRoot":"","sources":["../../../../src/plugins/icons/base-set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAWjG,eAAO,MAAM,WAAW,EAAE,iCA+CzB,CAAC"}
1
+ {"version":3,"file":"base-set.d.ts","sourceRoot":"","sources":["../../../../src/plugins/icons/base-set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAWjG,eAAO,MAAM,WAAW,EAAE,iCAiDzB,CAAC"}
@@ -29,6 +29,8 @@ export const iconBaseSet = [
29
29
  'lucide:sun',
30
30
  'lucide:triangle-alert',
31
31
  'lucide:x',
32
+ 'lucide:zoom-in',
33
+ 'lucide:zoom-out',
32
34
  'ri:apple-fill',
33
35
  'ri:bluesky-fill',
34
36
  'ri:facebook-fill',
@@ -1 +1 @@
1
- {"version":3,"file":"base-set.js","sourceRoot":"","sources":["../../../../src/plugins/icons/base-set.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,iBAAiB;IACjB,cAAc;IACd,qBAAqB;IACrB,sBAAsB;IACtB,aAAa;IACb,sBAAsB;IACtB,kBAAkB;IAClB,eAAe;IACf,cAAc;IACd,cAAc;IACd,aAAa;IACb,kBAAkB;IAClB,aAAa;IACb,aAAa;IACb,kBAAkB;IAClB,eAAe;IACf,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,kBAAkB;IAClB,sBAAsB;IACtB,eAAe;IACf,YAAY;IACZ,iBAAiB;IACjB,YAAY;IACZ,uBAAuB;IACvB,UAAU;IACV,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,cAAc;IACd,kBAAkB;IAClB,gBAAgB;IAChB,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,mBAAmB;IACnB,iBAAiB;CAClB,CAAC"}
1
+ {"version":3,"file":"base-set.js","sourceRoot":"","sources":["../../../../src/plugins/icons/base-set.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,iBAAiB;IACjB,cAAc;IACd,qBAAqB;IACrB,sBAAsB;IACtB,aAAa;IACb,sBAAsB;IACtB,kBAAkB;IAClB,eAAe;IACf,cAAc;IACd,cAAc;IACd,aAAa;IACb,kBAAkB;IAClB,aAAa;IACb,aAAa;IACb,kBAAkB;IAClB,eAAe;IACf,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,kBAAkB;IAClB,sBAAsB;IACtB,eAAe;IACf,YAAY;IACZ,iBAAiB;IACjB,YAAY;IACZ,uBAAuB;IACvB,UAAU;IACV,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,cAAc;IACd,kBAAkB;IAClB,gBAAgB;IAChB,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,mBAAmB;IACnB,iBAAiB;CAClB,CAAC"}
@@ -1,9 +1,84 @@
1
1
  .nova-mermaid-container {
2
- overflow-x: auto;
3
2
  margin-block: 1.5rem;
4
3
  }
5
4
 
6
- .nova-mermaid-container > svg {
5
+ .nova-mermaid-controls {
6
+ display: flex;
7
+ justify-content: flex-end;
8
+ gap: 0.25rem;
9
+ margin-block-end: 0.5rem;
10
+ }
11
+
12
+ .nova-mermaid-control {
13
+ display: inline-flex;
14
+ justify-content: center;
15
+ align-items: center;
16
+ min-width: 2rem;
17
+ height: 2rem;
18
+ padding: 0 0.5rem;
19
+ color: var(--nova-color-text);
20
+ background: var(--nova-color-surface-raised);
21
+ border: 1px solid var(--nova-color-border);
22
+ border-radius: var(--ifm-button-border-radius);
23
+ font: inherit;
24
+ font-size: 0.75rem;
25
+ line-height: 1;
26
+ cursor: pointer;
27
+ }
28
+
29
+ .nova-mermaid-control:hover:not(:disabled) {
30
+ color: var(--nova-color-primary-600);
31
+ border-color: var(--nova-color-primary-500);
32
+ }
33
+
34
+ [data-theme="dark"] .nova-mermaid-control:hover:not(:disabled) {
35
+ color: var(--nova-color-primary-400);
36
+ }
37
+
38
+ .nova-mermaid-control:focus-visible,
39
+ .nova-mermaid-viewport:focus-visible {
40
+ outline: 2px solid var(--nova-color-primary-500);
41
+ outline-offset: 2px;
42
+ }
43
+
44
+ .nova-mermaid-control:disabled {
45
+ opacity: 0.45;
46
+ cursor: not-allowed;
47
+ }
48
+
49
+ .nova-mermaid-scale {
50
+ min-width: 3.75rem;
51
+ font-variant-numeric: tabular-nums;
52
+ }
53
+
54
+ .nova-mermaid-viewport {
55
+ overflow: hidden;
56
+ padding: 0.25rem;
57
+ border-radius: var(--ifm-global-radius);
58
+ touch-action: pan-y;
59
+ }
60
+
61
+ .nova-mermaid-viewport--interactive {
62
+ cursor: grab;
63
+ touch-action: none;
64
+ }
65
+
66
+ .nova-mermaid-viewport--dragging {
67
+ cursor: grabbing;
68
+ user-select: none;
69
+ }
70
+
71
+ .nova-mermaid-stage {
72
+ transform-origin: center;
73
+ transition: transform 160ms ease;
74
+ will-change: transform;
75
+ }
76
+
77
+ .nova-mermaid-viewport--dragging .nova-mermaid-stage {
78
+ transition: none;
79
+ }
80
+
81
+ .nova-mermaid-stage > svg {
7
82
  display: block;
8
83
  margin-inline: auto;
9
84
  max-width: 100%;
@@ -26,6 +101,12 @@
26
101
  direction: ltr;
27
102
  }
28
103
 
104
+ @media (prefers-reduced-motion: reduce) {
105
+ .nova-mermaid-stage {
106
+ transition: none;
107
+ }
108
+ }
109
+
29
110
  /*
30
111
  * Mermaid bakes themeVariables.lineColor into the SVG marker (arrowhead)
31
112
  * paths and only the edgePath line is overridden by per-preset themeCSS.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mermaid-viewport.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mermaid-viewport.test.d.ts","sourceRoot":"","sources":["../../../../src/tests/lib/mermaid-viewport.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import { deepStrictEqual, strictEqual } from 'node:assert/strict';
2
+ import { describe, it } from 'vitest';
3
+ import { clampScale, MERMAID_MAX_SCALE, MERMAID_MIN_SCALE, resolvePan, } from '../../lib/mermaid-viewport.js';
4
+ describe('clampScale', () => {
5
+ it('clamps requests to the supported zoom range', () => {
6
+ const belowMinimum = clampScale(0);
7
+ const withinRange = clampScale(1.75);
8
+ const aboveMaximum = clampScale(5);
9
+ strictEqual(belowMinimum, MERMAID_MIN_SCALE);
10
+ strictEqual(withinRange, 1.75);
11
+ strictEqual(aboveMaximum, MERMAID_MAX_SCALE);
12
+ return;
13
+ });
14
+ return;
15
+ });
16
+ describe('resolvePan', () => {
17
+ it('resolves pointer travel from the drag origin', () => {
18
+ const startPosition = {
19
+ x: 25,
20
+ y: -10,
21
+ };
22
+ const start = {
23
+ x: 100,
24
+ y: 80,
25
+ };
26
+ const current = {
27
+ x: 145,
28
+ y: 50,
29
+ };
30
+ const result = resolvePan(startPosition, start, current);
31
+ deepStrictEqual(result, {
32
+ x: 70,
33
+ y: -40,
34
+ });
35
+ return;
36
+ });
37
+ return;
38
+ });
39
+ //# sourceMappingURL=mermaid-viewport.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mermaid-viewport.test.js","sourceRoot":"","sources":["../../../../src/tests/lib/mermaid-viewport.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,GACX,MAAM,+BAA+B,CAAC;AAiBvC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,YAAY,GAA4F,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5H,MAAM,WAAW,GAA2F,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7H,MAAM,YAAY,GAA4F,UAAU,CAAC,CAAC,CAAC,CAAC;QAE5H,WAAW,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;QAC7C,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC/B,WAAW,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;QAE7C,OAAO;IACT,CAAC,CAAC,CAAC;IAEH,OAAO;AACT,CAAC,CAAC,CAAC;AAOH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,aAAa,GAA8F;YAC/G,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,CAAC,EAAE;SACP,CAAC;QACF,MAAM,KAAK,GAAsF;YAC/F,CAAC,EAAE,GAAG;YACN,CAAC,EAAE,EAAE;SACN,CAAC;QACF,MAAM,OAAO,GAAwF;YACnG,CAAC,EAAE,GAAG;YACN,CAAC,EAAE,EAAE;SACN,CAAC;QACF,MAAM,MAAM,GAAuF,UAAU,CAAC,aAAa,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAE7I,eAAe,CAAC,MAAM,EAAE;YACtB,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,CAAC,EAAE;SACP,CAAC,CAAC;QAEH,OAAO;IACT,CAAC,CAAC,CAAC;IAEH,OAAO;AACT,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/Mermaid/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,iCAAiC,EACjC,mCAAmC,EAMpC,MAAM,sCAAsC,CAAC;AAsD9C,iBAAS,OAAO,CAAC,KAAK,EAAE,iCAAiC,GAAG,mCAAmC,CAoB9F;AAED,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/Mermaid/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAEV,iCAAiC,EACjC,mCAAmC,EAuCpC,MAAM,sCAAsC,CAAC;AAyW9C,iBAAS,OAAO,CAAC,KAAK,EAAE,iCAAiC,GAAG,mCAAmC,CAoB9F;AAED,eAAe,OAAO,CAAC"}
@@ -1,12 +1,28 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import ErrorBoundary from '@docusaurus/ErrorBoundary';
3
+ import { translate } from '@docusaurus/Translate';
4
+ import { Icon } from '@iconify/react/offline';
3
5
  import ErrorPageContent from '@theme/ErrorPageContent';
4
- import { useEffect, useRef } from 'react';
6
+ import { useEffect, useRef, useState, } from 'react';
7
+ import { clampScale, MERMAID_MAX_SCALE, MERMAID_MIN_SCALE, MERMAID_PAN_STEP, MERMAID_SCALE_STEP, resolvePan, } from '../../lib/mermaid-viewport.js';
5
8
  import { MERMAID_CONTAINER_CLASS_NAME, useMermaidRenderResult, } from '../../lib/mermaid.js';
6
9
  import { useColorModeObserver } from '../../lib/use-color-mode-observer.js';
7
10
  function MermaidContent(props) {
8
11
  const renderResult = useMermaidRenderResult({ text: props['value'] });
9
12
  const containerRef = useRef(null);
13
+ const scaleState = useState(1);
14
+ const scale = scaleState[0];
15
+ const setScale = scaleState[1];
16
+ const positionState = useState({
17
+ x: 0,
18
+ y: 0,
19
+ });
20
+ const position = positionState[0];
21
+ const setPosition = positionState[1];
22
+ const isDraggingState = useState(false);
23
+ const isDragging = isDraggingState[0];
24
+ const setIsDragging = isDraggingState[1];
25
+ const dragRef = useRef(null);
10
26
  useEffect(() => {
11
27
  if (renderResult !== null
12
28
  && containerRef.current !== null
@@ -19,7 +35,152 @@ function MermaidContent(props) {
19
35
  return null;
20
36
  }
21
37
  const className = (props['className'] !== undefined) ? `${MERMAID_CONTAINER_CLASS_NAME} ${props['className']}` : MERMAID_CONTAINER_CLASS_NAME;
22
- return (_jsx("div", { ref: containerRef, className: className, style: props['style'], dangerouslySetInnerHTML: { __html: renderResult['svg'] } }));
38
+ const canZoomIn = scale < MERMAID_MAX_SCALE;
39
+ const canZoomOut = scale > MERMAID_MIN_SCALE;
40
+ const isInteractive = scale > 1;
41
+ const scaleLabel = `${Math.round(scale * 100)}%`;
42
+ const zoomInLabel = translate({
43
+ id: 'theme.mermaid.zoomIn',
44
+ message: 'Zoom in diagram',
45
+ description: 'Accessible label for the Mermaid diagram zoom-in button',
46
+ });
47
+ const zoomOutLabel = translate({
48
+ id: 'theme.mermaid.zoomOut',
49
+ message: 'Zoom out diagram',
50
+ description: 'Accessible label for the Mermaid diagram zoom-out button',
51
+ });
52
+ const resetLabel = translate({
53
+ id: 'theme.mermaid.resetView',
54
+ message: 'Reset diagram view',
55
+ description: 'Accessible label for the Mermaid diagram reset button',
56
+ });
57
+ const viewportLabel = translate({
58
+ id: 'theme.mermaid.viewport',
59
+ message: 'Interactive diagram. Zoom in, then drag or use the arrow keys to pan.',
60
+ description: 'Accessible instructions for the interactive Mermaid diagram viewport',
61
+ });
62
+ const stageStyle = {
63
+ transform: `translate(${position['x']}px, ${position['y']}px) scale(${scale})`,
64
+ };
65
+ const viewportClassName = [
66
+ 'nova-mermaid-viewport',
67
+ (isInteractive === true) ? 'nova-mermaid-viewport--interactive' : '',
68
+ (isDragging === true) ? 'nova-mermaid-viewport--dragging' : '',
69
+ ].filter((value) => value !== '').join(' ');
70
+ function zoomIn() {
71
+ const nextScale = clampScale(scale + MERMAID_SCALE_STEP);
72
+ setScale(nextScale);
73
+ return undefined;
74
+ }
75
+ function zoomOut() {
76
+ const nextScale = clampScale(scale - MERMAID_SCALE_STEP);
77
+ setScale(nextScale);
78
+ if (nextScale <= 1) {
79
+ setPosition({
80
+ x: 0,
81
+ y: 0,
82
+ });
83
+ }
84
+ return undefined;
85
+ }
86
+ function handlePointerDown(event) {
87
+ if (event['button'] !== 0 || isInteractive === false) {
88
+ return undefined;
89
+ }
90
+ if (event['target'] instanceof Element && event['target'].closest('a') !== null) {
91
+ return undefined;
92
+ }
93
+ dragRef.current = {
94
+ pointerId: event['pointerId'],
95
+ start: {
96
+ x: event['clientX'],
97
+ y: event['clientY'],
98
+ },
99
+ startPosition: position,
100
+ };
101
+ event['currentTarget'].setPointerCapture(event['pointerId']);
102
+ setIsDragging(true);
103
+ return undefined;
104
+ }
105
+ function handlePointerMove(event) {
106
+ if (dragRef.current === null || dragRef.current['pointerId'] !== event['pointerId']) {
107
+ return undefined;
108
+ }
109
+ setPosition(resolvePan(dragRef.current['startPosition'], dragRef.current['start'], {
110
+ x: event['clientX'],
111
+ y: event['clientY'],
112
+ }));
113
+ return undefined;
114
+ }
115
+ function handlePointerEnd(event) {
116
+ if (dragRef.current === null || dragRef.current['pointerId'] !== event['pointerId']) {
117
+ return undefined;
118
+ }
119
+ if (event['currentTarget'].hasPointerCapture(event['pointerId']) === true) {
120
+ event['currentTarget'].releasePointerCapture(event['pointerId']);
121
+ }
122
+ dragRef.current = null;
123
+ setIsDragging(false);
124
+ return undefined;
125
+ }
126
+ function handleKeyDown(event) {
127
+ if (isInteractive === false) {
128
+ return undefined;
129
+ }
130
+ let nextPosition = undefined;
131
+ switch (event['key']) {
132
+ case 'ArrowDown': {
133
+ nextPosition = {
134
+ x: position['x'],
135
+ y: position['y'] - MERMAID_PAN_STEP,
136
+ };
137
+ break;
138
+ }
139
+ case 'ArrowLeft': {
140
+ nextPosition = {
141
+ x: position['x'] + MERMAID_PAN_STEP,
142
+ y: position['y'],
143
+ };
144
+ break;
145
+ }
146
+ case 'ArrowRight': {
147
+ nextPosition = {
148
+ x: position['x'] - MERMAID_PAN_STEP,
149
+ y: position['y'],
150
+ };
151
+ break;
152
+ }
153
+ case 'ArrowUp': {
154
+ nextPosition = {
155
+ x: position['x'],
156
+ y: position['y'] + MERMAID_PAN_STEP,
157
+ };
158
+ break;
159
+ }
160
+ default: {
161
+ break;
162
+ }
163
+ }
164
+ if (nextPosition !== undefined) {
165
+ event.preventDefault();
166
+ setPosition(nextPosition);
167
+ }
168
+ return undefined;
169
+ }
170
+ return (_jsxs("div", { ref: containerRef, className: className, style: props['style'], children: [_jsxs("div", { className: "nova-mermaid-controls", role: "toolbar", "aria-label": translate({
171
+ id: 'theme.mermaid.controls',
172
+ message: 'Diagram controls',
173
+ description: 'Accessible label for the Mermaid diagram control toolbar',
174
+ }), children: [_jsx("button", { className: "nova-mermaid-control", type: "button", disabled: canZoomOut === false, onClick: zoomOut, "aria-label": zoomOutLabel, title: zoomOutLabel, children: _jsx(Icon, { icon: "lucide:zoom-out", width: "16", height: "16", "aria-hidden": "true" }) }), _jsx("button", { className: "nova-mermaid-control nova-mermaid-scale", type: "button", disabled: (scale === 1
175
+ && position['x'] === 0
176
+ && position['y'] === 0), onClick: () => {
177
+ setScale(1);
178
+ setPosition({
179
+ x: 0,
180
+ y: 0,
181
+ });
182
+ return undefined;
183
+ }, "aria-label": `${resetLabel}: ${scaleLabel}`, title: resetLabel, children: scaleLabel }), _jsx("button", { className: "nova-mermaid-control", type: "button", disabled: canZoomIn === false, onClick: zoomIn, "aria-label": zoomInLabel, title: zoomInLabel, children: _jsx(Icon, { icon: "lucide:zoom-in", width: "16", height: "16", "aria-hidden": "true" }) })] }), _jsx("div", { className: viewportClassName, role: "application", tabIndex: 0, "aria-label": viewportLabel, onKeyDown: handleKeyDown, onPointerCancel: handlePointerEnd, onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerUp: handlePointerEnd, children: _jsx("div", { className: "nova-mermaid-stage", style: stageStyle, dangerouslySetInnerHTML: { __html: renderResult['svg'] } }) })] }));
23
184
  }
24
185
  function Mermaid(props) {
25
186
  const colorMode = useColorModeObserver();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/theme/Mermaid/index.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAuB5E,SAAS,cAAc,CAAC,KAA+C;IACrE,MAAM,YAAY,GAA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,IAEb,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EACrB,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC,EAC7B,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAHhB,SAAS,CAId,GACY,CACjB,CAAC;AACJ,CAAC;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { Shared_MermaidViewportPosition } from '../shared.d.ts';
2
+
3
+ /**
4
+ * Lib - Mermaid Viewport - Minimum Scale.
5
+ *
6
+ * @since 0.30.0
7
+ */
8
+ export type Lib_MermaidViewport_MinScale = number;
9
+
10
+ /**
11
+ * Lib - Mermaid Viewport - Maximum Scale.
12
+ *
13
+ * @since 0.30.0
14
+ */
15
+ export type Lib_MermaidViewport_MaxScale = number;
16
+
17
+ /**
18
+ * Lib - Mermaid Viewport - Scale Step.
19
+ *
20
+ * @since 0.30.0
21
+ */
22
+ export type Lib_MermaidViewport_ScaleStep = number;
23
+
24
+ /**
25
+ * Lib - Mermaid Viewport - Pan Step.
26
+ *
27
+ * @since 0.30.0
28
+ */
29
+ export type Lib_MermaidViewport_PanStep = number;
30
+
31
+ /**
32
+ * Lib - Mermaid Viewport - Clamp Scale.
33
+ *
34
+ * @since 0.30.0
35
+ */
36
+ export type Lib_MermaidViewport_ClampScale_Value = number;
37
+
38
+ export type Lib_MermaidViewport_ClampScale_Returns = number;
39
+
40
+ /**
41
+ * Lib - Mermaid Viewport - Resolve Pan.
42
+ *
43
+ * @since 0.30.0
44
+ */
45
+ export type Lib_MermaidViewport_ResolvePan_StartPosition = Shared_MermaidViewportPosition;
46
+
47
+ export type Lib_MermaidViewport_ResolvePan_Start = Shared_MermaidViewportPosition;
48
+
49
+ export type Lib_MermaidViewport_ResolvePan_Current = Shared_MermaidViewportPosition;
50
+
51
+ export type Lib_MermaidViewport_ResolvePan_Returns = Shared_MermaidViewportPosition;
@@ -108,6 +108,20 @@ export type Shared_MermaidConfig = {
108
108
  [key: string]: unknown;
109
109
  };
110
110
 
111
+ /**
112
+ * Shared - Mermaid Viewport Position.
113
+ *
114
+ * @since 0.30.0
115
+ */
116
+ export type Shared_MermaidViewportPosition_X = number;
117
+
118
+ export type Shared_MermaidViewportPosition_Y = number;
119
+
120
+ export type Shared_MermaidViewportPosition = {
121
+ x: Shared_MermaidViewportPosition_X;
122
+ y: Shared_MermaidViewportPosition_Y;
123
+ };
124
+
111
125
  /**
112
126
  * Shared - Progress Bar Config.
113
127
  *
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Tests - Lib - Mermaid Viewport - Clamp Scale - Clamps Requests To The Supported Zoom Range.
3
+ *
4
+ * @since 0.30.0
5
+ */
6
+ export type Tests_Lib_MermaidViewport_ClampScale_ClampsRequestsToTheSupportedZoomRange_BelowMinimum = number;
7
+
8
+ export type Tests_Lib_MermaidViewport_ClampScale_ClampsRequestsToTheSupportedZoomRange_WithinRange = number;
9
+
10
+ export type Tests_Lib_MermaidViewport_ClampScale_ClampsRequestsToTheSupportedZoomRange_AboveMaximum = number;
11
+
12
+ /**
13
+ * Tests - Lib - Mermaid Viewport - Resolve Pan - Resolves Pointer Travel From The Drag Origin.
14
+ *
15
+ * @since 0.30.0
16
+ */
17
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_StartPosition_X = number;
18
+
19
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_StartPosition_Y = number;
20
+
21
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_StartPosition = {
22
+ x: Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_StartPosition_X;
23
+ y: Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_StartPosition_Y;
24
+ };
25
+
26
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Start_X = number;
27
+
28
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Start_Y = number;
29
+
30
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Start = {
31
+ x: Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Start_X;
32
+ y: Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Start_Y;
33
+ };
34
+
35
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Current_X = number;
36
+
37
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Current_Y = number;
38
+
39
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Current = {
40
+ x: Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Current_X;
41
+ y: Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Current_Y;
42
+ };
43
+
44
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Result_X = number;
45
+
46
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Result_Y = number;
47
+
48
+ export type Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Result = {
49
+ x: Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Result_X;
50
+ y: Tests_Lib_MermaidViewport_ResolvePan_ResolvesPointerTravelFromTheDragOrigin_Result_Y;
51
+ };
@@ -115,7 +115,7 @@ export type Theme_DocSidebarItem_Category_Index_DocSidebarItemCategory_ContainsA
115
115
 
116
116
  export type Theme_DocSidebarItem_Category_Index_DocSidebarItemCategory_ContainsActivePath_ActivePath = string;
117
117
 
118
- export type Theme_DocSidebarItem_Category_Index_DocSidebarItemCategory_ContainsActivePath_Result = boolean;
118
+ export type Theme_DocSidebarItem_Category_Index_DocSidebarItemCategory_ContainsActivePath_Returns = boolean;
119
119
 
120
120
  export type Theme_DocSidebarItem_Category_Index_DocSidebarItemCategory_ContainsActivePath_Item = Record<string, unknown>;
121
121
 
@@ -1,6 +1,16 @@
1
- import type { CSSProperties } from 'react';
1
+ import type {
2
+ CSSProperties,
3
+ Dispatch,
4
+ KeyboardEvent,
5
+ PointerEvent,
6
+ RefObject,
7
+ SetStateAction,
8
+ } from 'react';
2
9
 
3
- import type { Shared_MermaidRenderOutput } from '../../shared.d.ts';
10
+ import type {
11
+ Shared_MermaidRenderOutput,
12
+ Shared_MermaidViewportPosition,
13
+ } from '../../shared.d.ts';
4
14
 
5
15
  /**
6
16
  * Theme - Mermaid.
@@ -46,6 +56,114 @@ export type Theme_Mermaid_Index_MermaidContent_Returns = React.JSX.Element | nul
46
56
 
47
57
  export type Theme_Mermaid_Index_MermaidContent_RenderResult = Shared_MermaidRenderOutput | null;
48
58
 
49
- export type Theme_Mermaid_Index_MermaidContent_ContainerRef = React.RefObject<HTMLDivElement | null>;
59
+ export type Theme_Mermaid_Index_MermaidContent_ContainerRef = RefObject<HTMLDivElement | null>;
60
+
61
+ export type Theme_Mermaid_Index_MermaidContent_Scale = number;
62
+
63
+ export type Theme_Mermaid_Index_MermaidContent_ScaleState = [Theme_Mermaid_Index_MermaidContent_Scale, Dispatch<SetStateAction<Theme_Mermaid_Index_MermaidContent_Scale>>];
64
+
65
+ export type Theme_Mermaid_Index_MermaidContent_SetScale = Dispatch<SetStateAction<Theme_Mermaid_Index_MermaidContent_Scale>>;
66
+
67
+ export type Theme_Mermaid_Index_MermaidContent_Position = Shared_MermaidViewportPosition;
68
+
69
+ export type Theme_Mermaid_Index_MermaidContent_PositionState = [Theme_Mermaid_Index_MermaidContent_Position, Dispatch<SetStateAction<Theme_Mermaid_Index_MermaidContent_Position>>];
70
+
71
+ export type Theme_Mermaid_Index_MermaidContent_SetPosition = Dispatch<SetStateAction<Theme_Mermaid_Index_MermaidContent_Position>>;
72
+
73
+ export type Theme_Mermaid_Index_MermaidContent_IsDragging = boolean;
74
+
75
+ export type Theme_Mermaid_Index_MermaidContent_IsDraggingState = [Theme_Mermaid_Index_MermaidContent_IsDragging, Dispatch<SetStateAction<Theme_Mermaid_Index_MermaidContent_IsDragging>>];
76
+
77
+ export type Theme_Mermaid_Index_MermaidContent_SetIsDragging = Dispatch<SetStateAction<Theme_Mermaid_Index_MermaidContent_IsDragging>>;
78
+
79
+ export type Theme_Mermaid_Index_MermaidContent_Drag_PointerId = number;
80
+
81
+ export type Theme_Mermaid_Index_MermaidContent_Drag_Start = Shared_MermaidViewportPosition;
82
+
83
+ export type Theme_Mermaid_Index_MermaidContent_Drag_StartPosition = Shared_MermaidViewportPosition;
84
+
85
+ export type Theme_Mermaid_Index_MermaidContent_Drag = {
86
+ pointerId: Theme_Mermaid_Index_MermaidContent_Drag_PointerId;
87
+ start: Theme_Mermaid_Index_MermaidContent_Drag_Start;
88
+ startPosition: Theme_Mermaid_Index_MermaidContent_Drag_StartPosition;
89
+ };
90
+
91
+ export type Theme_Mermaid_Index_MermaidContent_DragRef = RefObject<Theme_Mermaid_Index_MermaidContent_Drag | null>;
50
92
 
51
93
  export type Theme_Mermaid_Index_MermaidContent_ClassName = string;
94
+
95
+ export type Theme_Mermaid_Index_MermaidContent_CanZoomIn = boolean;
96
+
97
+ export type Theme_Mermaid_Index_MermaidContent_CanZoomOut = boolean;
98
+
99
+ export type Theme_Mermaid_Index_MermaidContent_IsInteractive = boolean;
100
+
101
+ export type Theme_Mermaid_Index_MermaidContent_ScaleLabel = string;
102
+
103
+ export type Theme_Mermaid_Index_MermaidContent_ZoomInLabel = string;
104
+
105
+ export type Theme_Mermaid_Index_MermaidContent_ZoomOutLabel = string;
106
+
107
+ export type Theme_Mermaid_Index_MermaidContent_ResetLabel = string;
108
+
109
+ export type Theme_Mermaid_Index_MermaidContent_ViewportLabel = string;
110
+
111
+ export type Theme_Mermaid_Index_MermaidContent_StageStyle = CSSProperties;
112
+
113
+ export type Theme_Mermaid_Index_MermaidContent_ViewportClassName = string;
114
+
115
+ /**
116
+ * Theme - Mermaid - Mermaid Content - Handle Key Down.
117
+ *
118
+ * @since 0.30.0
119
+ */
120
+ export type Theme_Mermaid_Index_MermaidContent_HandleKeyDown_Event = KeyboardEvent<HTMLDivElement>;
121
+
122
+ export type Theme_Mermaid_Index_MermaidContent_HandleKeyDown_Returns = undefined;
123
+
124
+ export type Theme_Mermaid_Index_MermaidContent_HandleKeyDown_NextPosition = Shared_MermaidViewportPosition | undefined;
125
+
126
+ /**
127
+ * Theme - Mermaid - Mermaid Content - Handle Pointer Down.
128
+ *
129
+ * @since 0.30.0
130
+ */
131
+ export type Theme_Mermaid_Index_MermaidContent_HandlePointerDown_Event = PointerEvent<HTMLDivElement>;
132
+
133
+ export type Theme_Mermaid_Index_MermaidContent_HandlePointerDown_Returns = undefined;
134
+
135
+ /**
136
+ * Theme - Mermaid - Mermaid Content - Handle Pointer End.
137
+ *
138
+ * @since 0.30.0
139
+ */
140
+ export type Theme_Mermaid_Index_MermaidContent_HandlePointerEnd_Event = PointerEvent<HTMLDivElement>;
141
+
142
+ export type Theme_Mermaid_Index_MermaidContent_HandlePointerEnd_Returns = undefined;
143
+
144
+ /**
145
+ * Theme - Mermaid - Mermaid Content - Handle Pointer Move.
146
+ *
147
+ * @since 0.30.0
148
+ */
149
+ export type Theme_Mermaid_Index_MermaidContent_HandlePointerMove_Event = PointerEvent<HTMLDivElement>;
150
+
151
+ export type Theme_Mermaid_Index_MermaidContent_HandlePointerMove_Returns = undefined;
152
+
153
+ /**
154
+ * Theme - Mermaid - Mermaid Content - Zoom In.
155
+ *
156
+ * @since 0.30.0
157
+ */
158
+ export type Theme_Mermaid_Index_MermaidContent_ZoomIn_Returns = undefined;
159
+
160
+ export type Theme_Mermaid_Index_MermaidContent_ZoomIn_NextScale = number;
161
+
162
+ /**
163
+ * Theme - Mermaid - Mermaid Content - Zoom Out.
164
+ *
165
+ * @since 0.30.0
166
+ */
167
+ export type Theme_Mermaid_Index_MermaidContent_ZoomOut_Returns = undefined;
168
+
169
+ export type Theme_Mermaid_Index_MermaidContent_ZoomOut_NextScale = number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cbnventures/docusaurus-preset-nova",
3
- "version": "0.29.0",
3
+ "version": "0.30.1",
4
4
  "description": "Scripts, templates, and project configuration for the common JavaScript and TypeScript developer",
5
5
  "keywords": [
6
6
  "eslint",
@@ -71,10 +71,10 @@
71
71
  "private": false,
72
72
  "scripts": {
73
73
  "dev": "node ../../scripts/nova-run-scripts.mjs --parallel --node-env development 'dev:*'",
74
- "dev:watch-plugin": "tsc --project tsconfig.plugin.json --watch",
74
+ "dev:watch-plugin": "node ../../scripts/nova-transpile.mjs --project tsconfig.plugin.json --watch",
75
75
  "dev:watch-styles": "node ../../scripts/copy-styles.mjs --watch",
76
- "dev:watch-theme": "tsc --project tsconfig.theme.json --watch",
77
- "dev:watch-cli": "tsc --project tsconfig.cli.json --watch",
76
+ "dev:watch-theme": "node ../../scripts/nova-transpile.mjs --project tsconfig.theme.json --watch",
77
+ "dev:watch-cli": "node ../../scripts/nova-transpile.mjs --project tsconfig.cli.json --watch",
78
78
  "dev:fix-shiki-import": "node ../../scripts/fix-shiki-import.mjs --watch",
79
79
  "check": "node ../../scripts/nova-run-scripts.mjs --sequential 'check:*'",
80
80
  "check:lint": "eslint ./ --max-warnings=0",
@@ -85,10 +85,10 @@
85
85
  "check:types-config": "node ../../scripts/nova-type-check.mjs --project tsconfig.config.json",
86
86
  "check:test": "vitest run",
87
87
  "build": "node ../../scripts/nova-run-scripts.mjs --sequential --node-env production 'build:*'",
88
- "build:transpile-theme": "tsc --project tsconfig.theme.json --outDir ./build --skipLibCheck",
89
- "build:transpile-plugin": "tsc --project tsconfig.plugin.json --outDir ./build --skipLibCheck",
90
- "build:transpile-worker": "tsc --project tsconfig.worker.json --outDir ./build --skipLibCheck",
91
- "build:transpile-cli": "tsc --project tsconfig.cli.json --outDir ./build --skipLibCheck",
88
+ "build:transpile-theme": "node ../../scripts/nova-transpile.mjs --project tsconfig.theme.json",
89
+ "build:transpile-plugin": "node ../../scripts/nova-transpile.mjs --project tsconfig.plugin.json",
90
+ "build:transpile-worker": "node ../../scripts/nova-transpile.mjs --project tsconfig.worker.json",
91
+ "build:transpile-cli": "node ../../scripts/nova-transpile.mjs --project tsconfig.cli.json",
92
92
  "build:copy-types": "shx rm -rf \"./build/src/types\" && shx cp -r \"./src/types\" \"./build/src/types\"",
93
93
  "build:fix-shiki-import": "node ../../scripts/fix-shiki-import.mjs",
94
94
  "build:copy-styles": "node ../../scripts/copy-styles.mjs",
@@ -100,7 +100,7 @@
100
100
  "node": "^22 || ^24"
101
101
  },
102
102
  "dependencies": {
103
- "@cbnventures/nova": "0.29.0",
103
+ "@cbnventures/nova": "0.30.1",
104
104
  "@codesandbox/sandpack-react": "2.20.0",
105
105
  "@docusaurus/plugin-content-blog": "3.10.2",
106
106
  "@docusaurus/plugin-content-docs": "3.10.2",