@nowline/preview-shell 0.4.2 → 0.5.0
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/markup.d.ts +34 -6
- package/dist/markup.d.ts.map +1 -1
- package/dist/markup.js +73 -41
- package/dist/markup.js.map +1 -1
- package/dist/mount.d.ts +59 -15
- package/dist/mount.d.ts.map +1 -1
- package/dist/mount.js +598 -101
- package/dist/mount.js.map +1 -1
- package/dist/styles.d.ts +9 -8
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +286 -57
- package/dist/styles.js.map +1 -1
- package/package.json +2 -2
- package/src/markup.ts +110 -47
- package/src/mount.ts +740 -106
- package/src/styles.ts +286 -57
package/dist/markup.d.ts
CHANGED
|
@@ -4,17 +4,45 @@ export interface ViewportElements {
|
|
|
4
4
|
canvas: HTMLElement;
|
|
5
5
|
empty: HTMLElement;
|
|
6
6
|
chrome: HTMLElement;
|
|
7
|
+
/** Drag grip at the leading edge of the toolbar — initiates chrome repositioning. */
|
|
8
|
+
toolbarHandle: HTMLElement;
|
|
9
|
+
/** » restore button — shown only when the toolbar is collapsed. */
|
|
10
|
+
restoreBtn: HTMLButtonElement;
|
|
7
11
|
zoomReset: HTMLButtonElement;
|
|
8
12
|
zoomIn: HTMLButtonElement;
|
|
9
13
|
zoomOut: HTMLButtonElement;
|
|
14
|
+
/** Fit-width button (↔) — triggers fitWidth. Sits left of fitPage. */
|
|
10
15
|
fitWidth: HTMLButtonElement;
|
|
16
|
+
/** Fit-page button (⤢) — triggers fitPage. */
|
|
11
17
|
fitPage: HTMLButtonElement;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
/** ▾ more toggle — opens the more-menu panel. */
|
|
19
|
+
moreToggle: HTMLButtonElement;
|
|
20
|
+
/** More-menu panel containing format, copy, export, theme, now, links rows. */
|
|
21
|
+
moreMenu: HTMLElement;
|
|
22
|
+
/** Format sub-dropdown toggle (SVG ▾ / PNG ▾). */
|
|
23
|
+
formatToggle: HTMLButtonElement;
|
|
24
|
+
/** Format sub-dropdown list. */
|
|
25
|
+
formatMenu: HTMLUListElement;
|
|
26
|
+
/** Copy action button — uses the selected format. */
|
|
27
|
+
copyAction: HTMLButtonElement;
|
|
28
|
+
/** Export / download action button — uses the selected format. */
|
|
29
|
+
exportAction: HTMLButtonElement;
|
|
30
|
+
/** Theme sub-dropdown toggle. */
|
|
31
|
+
themeToggle: HTMLButtonElement;
|
|
32
|
+
/** Theme sub-dropdown list; items built programmatically from availableThemes. */
|
|
33
|
+
themeMenu: HTMLUListElement;
|
|
34
|
+
/** Now sub-dropdown toggle. */
|
|
35
|
+
nowToggle: HTMLButtonElement;
|
|
36
|
+
/** Label span inside nowToggle — shows Today / formatted date / None. */
|
|
37
|
+
nowLabel: HTMLElement;
|
|
38
|
+
/** Calendar picker panel — populated by mount.ts on open. */
|
|
39
|
+
nowPicker: HTMLElement;
|
|
40
|
+
/** Show-links sub-dropdown toggle. */
|
|
41
|
+
linksToggle: HTMLButtonElement;
|
|
42
|
+
/** Show-links sub-dropdown list. */
|
|
43
|
+
linksMenu: HTMLUListElement;
|
|
44
|
+
/** « collapse button — shrinks the toolbar to a translucent puck. */
|
|
45
|
+
collapseBtn: HTMLButtonElement;
|
|
18
46
|
minimap: HTMLElement;
|
|
19
47
|
minimapCanvas: HTMLElement;
|
|
20
48
|
minimapRect: HTMLElement;
|
package/dist/markup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markup.d.ts","sourceRoot":"","sources":["../src/markup.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,WAAW,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,i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AAW,CAAC;IACtB,6DAA6D;IAC7D,SAAS,EAAE,WAAW,CAAC;IACvB,sCAAsC;IACtC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,oCAAoC;IACpC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,qEAAqE;IACrE,WAAW,EAAE,iBAAiB,CAAC;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,aAAa,EAAE,WAAW,CAAC;IAC3B,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,EAAE,iBAAiB,CAAC;IAChC,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,WAAW,CAAC;IACvB,YAAY,EAAE,iBAAiB,CAAC;CACnC;AA6FD,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,gBAAgB,CAwCnE"}
|
package/dist/markup.js
CHANGED
|
@@ -2,52 +2,74 @@
|
|
|
2
2
|
// inside the supplied root element. All element refs are namespaced by
|
|
3
3
|
// CSS class (rather than `id="..."`) so two preview shells can mount in
|
|
4
4
|
// the same document without clashing.
|
|
5
|
+
// Inline SVG glyphs for the copy / download actions — crisp at any
|
|
6
|
+
// zoom and tinted by `currentColor`. Embedded via innerHTML (no script),
|
|
7
|
+
// so they are unaffected by the webview's nonce-only script/style CSP.
|
|
8
|
+
const COPY_ICON = '<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="5.5" y="5.5" width="8" height="8" rx="1.5"></rect><path d="M10.5 5.5V4A1.5 1.5 0 0 0 9 2.5H4A1.5 1.5 0 0 0 2.5 4v5A1.5 1.5 0 0 0 4 10.5h1.5"></path></svg>';
|
|
9
|
+
const DOWNLOAD_ICON = '<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M8 2.5v7.5"></path><path d="M4.75 7 8 10.25 11.25 7"></path><path d="M3 13.25h10"></path></svg>';
|
|
5
10
|
const TEMPLATE = `
|
|
6
11
|
<div class="viewport"><div class="canvas"></div></div>
|
|
7
|
-
<div class="empty">Rendering preview
|
|
12
|
+
<div class="empty">Rendering preview\u2026</div>
|
|
8
13
|
<div class="chrome">
|
|
9
|
-
<div class="toolbar
|
|
10
|
-
<
|
|
14
|
+
<div class="toolbar">
|
|
15
|
+
<span class="toolbar-handle" aria-hidden="true" title="Drag to reposition toolbar">\u2838</span>
|
|
16
|
+
<button class="btn glyph restore-btn" title="Expand toolbar" aria-label="Expand toolbar">\u00bb</button>
|
|
17
|
+
<button class="btn zoom-out" title="Zoom out" aria-label="Zoom out">\u2212</button>
|
|
11
18
|
<button class="btn zoom-label zoom-reset" title="Reset to 100%">100%</button>
|
|
12
|
-
<button class="btn zoom-in" title="Zoom in">+</button>
|
|
19
|
+
<button class="btn zoom-in" title="Zoom in" aria-label="Zoom in">+</button>
|
|
13
20
|
<span class="sep"></span>
|
|
14
|
-
<button class="btn glyph fit-width" title="Fit width (3)" aria-label="Fit width"
|
|
15
|
-
<button class="btn glyph fit-page" title="Fit page (1)" aria-label="Fit page"
|
|
21
|
+
<button class="btn glyph fit-width" title="Fit width (3)" aria-label="Fit width">\u2194</button>
|
|
22
|
+
<button class="btn glyph fit-page" title="Fit page (1)" aria-label="Fit page">\u2922</button>
|
|
16
23
|
<span class="sep"></span>
|
|
17
24
|
<div class="dropdown">
|
|
18
|
-
<button class="btn
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
<button class="btn more-toggle" title="More options">\u25be more</button>
|
|
26
|
+
<div class="more-menu" hidden>
|
|
27
|
+
<div class="more-row">
|
|
28
|
+
<span class="more-label">Format:</span>
|
|
29
|
+
<div class="dropdown">
|
|
30
|
+
<button class="btn more-sub-toggle format-toggle">SVG \u25be</button>
|
|
31
|
+
<ul class="more-sub-menu format-menu" hidden>
|
|
32
|
+
<li><button class="btn format-opt" data-value="svg"><code class="code-chip">svg</code></button></li>
|
|
33
|
+
<li><button class="btn format-opt" data-value="png"><code class="code-chip">png</code></button></li>
|
|
34
|
+
</ul>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="more-row action-row">
|
|
38
|
+
<button class="btn copy-action" title="Copy to clipboard"><span>Copy</span><span class="action-ico" aria-hidden="true">${COPY_ICON}</span></button>
|
|
39
|
+
<button class="btn export-action" title="Export file"><span>Export</span><span class="action-ico" aria-hidden="true">${DOWNLOAD_ICON}</span></button>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="more-divider"></div>
|
|
42
|
+
<div class="more-row theme-control-row">
|
|
43
|
+
<span class="more-label">Theme:</span>
|
|
44
|
+
<div class="dropdown">
|
|
45
|
+
<button class="btn more-sub-toggle theme-toggle">Auto \u25be</button>
|
|
46
|
+
<ul class="more-sub-menu theme-menu" hidden></ul>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="more-row">
|
|
50
|
+
<span class="more-label">Now:</span>
|
|
51
|
+
<div class="dropdown">
|
|
52
|
+
<button class="btn more-sub-toggle now-toggle"><span class="now-label">Today</span> \u25be</button>
|
|
53
|
+
<div class="now-picker" hidden></div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="more-row">
|
|
57
|
+
<span class="more-label">Show links:</span>
|
|
58
|
+
<div class="dropdown">
|
|
59
|
+
<button class="btn more-sub-toggle links-toggle">Yes \u25be</button>
|
|
60
|
+
<ul class="more-sub-menu links-menu" hidden>
|
|
61
|
+
<li><button class="btn links-opt" data-value="true">Yes</button></li>
|
|
62
|
+
<li><button class="btn links-opt" data-value="false">No</button></li>
|
|
63
|
+
</ul>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
46
67
|
</div>
|
|
68
|
+
<button class="btn glyph collapse-btn" title="Collapse toolbar" aria-label="Collapse toolbar">\u00ab</button>
|
|
47
69
|
</div>
|
|
48
70
|
</div>
|
|
49
71
|
<div class="minimap hidden">
|
|
50
|
-
<button class="btn minimap-close" title="Hide minimap"
|
|
72
|
+
<button class="btn minimap-close" title="Hide minimap">\u00d7</button>
|
|
51
73
|
<div class="minimap-canvas"></div>
|
|
52
74
|
<div class="minimap-rect"></div>
|
|
53
75
|
</div>
|
|
@@ -75,17 +97,27 @@ export function buildViewport(rootEl) {
|
|
|
75
97
|
canvas: q(rootEl, '.canvas'),
|
|
76
98
|
empty: q(rootEl, '.empty'),
|
|
77
99
|
chrome: q(rootEl, '.chrome'),
|
|
100
|
+
toolbarHandle: q(rootEl, '.toolbar-handle'),
|
|
101
|
+
restoreBtn: q(rootEl, '.restore-btn'),
|
|
78
102
|
zoomReset: q(rootEl, '.zoom-reset'),
|
|
79
103
|
zoomIn: q(rootEl, '.zoom-in'),
|
|
80
104
|
zoomOut: q(rootEl, '.zoom-out'),
|
|
81
105
|
fitWidth: q(rootEl, '.fit-width'),
|
|
82
106
|
fitPage: q(rootEl, '.fit-page'),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
107
|
+
moreToggle: q(rootEl, '.more-toggle'),
|
|
108
|
+
moreMenu: q(rootEl, '.more-menu'),
|
|
109
|
+
formatToggle: q(rootEl, '.format-toggle'),
|
|
110
|
+
formatMenu: q(rootEl, '.format-menu'),
|
|
111
|
+
copyAction: q(rootEl, '.copy-action'),
|
|
112
|
+
exportAction: q(rootEl, '.export-action'),
|
|
113
|
+
themeToggle: q(rootEl, '.theme-toggle'),
|
|
114
|
+
themeMenu: q(rootEl, '.theme-menu'),
|
|
115
|
+
nowToggle: q(rootEl, '.now-toggle'),
|
|
116
|
+
nowLabel: q(rootEl, '.now-label'),
|
|
117
|
+
nowPicker: q(rootEl, '.now-picker'),
|
|
118
|
+
linksToggle: q(rootEl, '.links-toggle'),
|
|
119
|
+
linksMenu: q(rootEl, '.links-menu'),
|
|
120
|
+
collapseBtn: q(rootEl, '.collapse-btn'),
|
|
89
121
|
minimap: q(rootEl, '.minimap'),
|
|
90
122
|
minimapCanvas: q(rootEl, '.minimap-canvas'),
|
|
91
123
|
minimapRect: q(rootEl, '.minimap-rect'),
|
package/dist/markup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markup.js","sourceRoot":"","sources":["../src/markup.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,uEAAuE;AACvE,wEAAwE;AACxE,sCAAsC;
|
|
1
|
+
{"version":3,"file":"markup.js","sourceRoot":"","sources":["../src/markup.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,uEAAuE;AACvE,wEAAwE;AACxE,sCAAsC;AAyDtC,mEAAmE;AACnE,yEAAyE;AACzE,uEAAuE;AACvE,MAAM,SAAS,GACX,yTAAyT,CAAC;AAC9T,MAAM,aAAa,GACf,8PAA8P,CAAC;AAEnQ,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;6IA4B4H,SAAS;2IACX,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CvJ,CAAC;AAEF,SAAS,CAAC,CAAoB,IAAiB,EAAE,QAAgB;IAC7D,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,CAAC,EAAE,EAAE,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,oCAAoC,QAAQ,yBAAyB,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,E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,CAAmB,MAAM,EAAE,aAAa,CAAC;QACrD,SAAS,EAAE,CAAC,CAAoB,MAAM,EAAE,aAAa,CAAC;QACtD,QAAQ,EAAE,CAAC,CAAc,MAAM,EAAE,YAAY,CAAC;QAC9C,SAAS,EAAE,CAAC,CAAc,MAAM,EAAE,aAAa,CAAC;QAChD,WAAW,EAAE,CAAC,CAAoB,MAAM,EAAE,eAAe,CAAC;QAC1D,SAAS,EAAE,CAAC,CAAmB,MAAM,EAAE,aAAa,CAAC;QACrD,WAAW,EAAE,CAAC,CAAoB,MAAM,EAAE,eAAe,CAAC;QAC1D,OAAO,EAAE,CAAC,CAAc,MAAM,EAAE,UAAU,CAAC;QAC3C,aAAa,EAAE,CAAC,CAAc,MAAM,EAAE,iBAAiB,CAAC;QACxD,WAAW,EAAE,CAAC,CAAc,MAAM,EAAE,eAAe,CAAC;QACpD,YAAY,EAAE,CAAC,CAAoB,MAAM,EAAE,gBAAgB,CAAC;QAC5D,WAAW,EAAE,CAAC,CAAc,MAAM,EAAE,cAAc,CAAC;QACnD,WAAW,EAAE,CAAC,CAAc,MAAM,EAAE,eAAe,CAAC;QACpD,SAAS,EAAE,CAAC,CAAc,MAAM,EAAE,mBAAmB,CAAC;QACtD,YAAY,EAAE,CAAC,CAAoB,MAAM,EAAE,gBAAgB,CAAC;KAC/D,CAAC;AACN,CAAC"}
|
package/dist/mount.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { DiagnosticRow } from '@nowline/browser';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Diagram render theme. `'auto'` resolves to the current Mode's
|
|
4
|
+
* light/dark. `'grayscale'` is a fully available theme (`'greyscale'`
|
|
5
|
+
* is accepted as an alias).
|
|
6
|
+
*/
|
|
7
|
+
export type ThemeOverride = 'auto' | 'light' | 'dark' | 'grayscale' | 'greyscale';
|
|
8
|
+
/**
|
|
9
|
+
* Now-line override. `'today'` and `'hide'` are the named sentinels;
|
|
10
|
+
* any `'YYYY-MM-DD'` date string is also valid.
|
|
11
|
+
*/
|
|
12
|
+
export type NowOverride = 'today' | 'hide' | (string & {});
|
|
4
13
|
export type InitialFit = 'fitPage' | 'fitWidth' | 'actual';
|
|
5
14
|
/**
|
|
6
15
|
* Locator info posted when the user clicks a diagnostic row. `file`
|
|
@@ -21,9 +30,9 @@ export interface ExportRequest {
|
|
|
21
30
|
body: string | Uint8Array;
|
|
22
31
|
}
|
|
23
32
|
/**
|
|
24
|
-
* View-options overrides emitted when the user
|
|
25
|
-
*
|
|
26
|
-
* with their
|
|
33
|
+
* View-options overrides emitted when the user changes Theme, Now, or
|
|
34
|
+
* Show-links in the more-menu. Only explicitly chosen fields are
|
|
35
|
+
* present; consumers merge with their option-resolution chain.
|
|
27
36
|
*/
|
|
28
37
|
export interface ViewOptionsOverrides {
|
|
29
38
|
theme?: ThemeOverride;
|
|
@@ -32,12 +41,12 @@ export interface ViewOptionsOverrides {
|
|
|
32
41
|
}
|
|
33
42
|
/**
|
|
34
43
|
* Baseline view state pushed by the consumer (e.g. when settings
|
|
35
|
-
* change). The shell uses these to pre-fill
|
|
36
|
-
*
|
|
44
|
+
* change). The shell uses these to pre-fill menu checkmarks without
|
|
45
|
+
* claiming the option as user-overridden.
|
|
37
46
|
*/
|
|
38
47
|
export interface ViewBaseline {
|
|
39
48
|
theme?: ThemeOverride;
|
|
40
|
-
/**
|
|
49
|
+
/** `'today'` | `'hide'` | `'YYYY-MM-DD'` | legacy `'auto'` / `'none'` values are accepted. */
|
|
41
50
|
now?: NowOverride | 'auto' | 'none' | string;
|
|
42
51
|
showLinks?: boolean;
|
|
43
52
|
}
|
|
@@ -49,15 +58,36 @@ export interface MountPreviewOptions {
|
|
|
49
58
|
* with `handle.setViewBaseline(...)`.
|
|
50
59
|
*/
|
|
51
60
|
viewBaseline?: ViewBaseline;
|
|
61
|
+
/**
|
|
62
|
+
* Color scheme for the chrome (toolbar, menus, minimap).
|
|
63
|
+
* `'system'` (default) auto-detects: VS Code webview via `<body>`
|
|
64
|
+
* class; browser via `prefers-color-scheme`. Never affects the
|
|
65
|
+
* diagram theme.
|
|
66
|
+
*/
|
|
67
|
+
mode?: 'light' | 'dark' | 'system';
|
|
68
|
+
/**
|
|
69
|
+
* Whether to show the Theme row in the more-menu.
|
|
70
|
+
* Defaults to `'show'`.
|
|
71
|
+
*/
|
|
72
|
+
themeControl?: 'show' | 'hide';
|
|
73
|
+
/**
|
|
74
|
+
* Diagram themes available in the Theme dropdown. **Auto** is
|
|
75
|
+
* always prepended. Defaults to `['light', 'dark', 'grayscale']`.
|
|
76
|
+
*/
|
|
77
|
+
availableThemes?: string[];
|
|
78
|
+
/**
|
|
79
|
+
* Locale used for date formatting in the Now picker.
|
|
80
|
+
* Defaults to `navigator.language`.
|
|
81
|
+
*/
|
|
82
|
+
locale?: string;
|
|
52
83
|
onGoto?: (loc: DiagnosticGoto) => void;
|
|
53
84
|
onOpenProblems?: () => void;
|
|
54
85
|
onSave?: (req: ExportRequest) => void;
|
|
55
86
|
onCopy?: (req: ExportRequest) => void;
|
|
56
87
|
/**
|
|
57
|
-
* Fired when the
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* + notify) and pop a message describing what happened.
|
|
88
|
+
* Fired when the browser's `navigator.clipboard.write` is
|
|
89
|
+
* unavailable during a copy-PNG action. Consumers pass the bytes
|
|
90
|
+
* to a host-side fallback.
|
|
61
91
|
*/
|
|
62
92
|
onCopyPngFallback?: (body: Uint8Array) => void;
|
|
63
93
|
onViewOptions?: (overrides: ViewOptionsOverrides) => void;
|
|
@@ -70,12 +100,26 @@ export interface PreviewHandle {
|
|
|
70
100
|
setDiagnostics(rows: DiagnosticRow[]): void;
|
|
71
101
|
/** Show a one-row diagnostics overlay with the supplied message. */
|
|
72
102
|
setFatal(message: string): void;
|
|
73
|
-
/** Re-skin
|
|
103
|
+
/** Re-skin view-menu baselines without claiming user overrides. */
|
|
74
104
|
setViewBaseline(baseline: ViewBaseline, resetOverrides?: boolean): void;
|
|
75
|
-
/** Update the
|
|
105
|
+
/** Update the default fit used by the next first-render. */
|
|
76
106
|
setDefaultFit(fit: InitialFit): void;
|
|
77
|
-
/** Toggle
|
|
107
|
+
/** Toggle minimap behaviour from the host. */
|
|
78
108
|
setShowMinimap(show: boolean): void;
|
|
109
|
+
/**
|
|
110
|
+
* Switch the chrome color scheme. `'system'` re-detects from the
|
|
111
|
+
* host environment; `'light'`/`'dark'` pin explicitly.
|
|
112
|
+
*/
|
|
113
|
+
setMode(mode: 'light' | 'dark' | 'system'): void;
|
|
114
|
+
/**
|
|
115
|
+
* Replace the list of selectable diagram themes. **Auto** is
|
|
116
|
+
* always prepended. Rebuilds the Theme dropdown immediately.
|
|
117
|
+
*/
|
|
118
|
+
setAvailableThemes(themes: string[]): void;
|
|
119
|
+
/**
|
|
120
|
+
* Update the locale used for date formatting in the Now picker.
|
|
121
|
+
*/
|
|
122
|
+
setLocale(locale: string): void;
|
|
79
123
|
fitPage(): void;
|
|
80
124
|
fitWidth(): void;
|
|
81
125
|
actualSize(): void;
|
package/dist/mount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,CAAC;AAElF;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAA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