@vite-hub/ui 0.3.1 → 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/README.md +107 -81
- package/dist/announce-Cy_Tn9wW.js +32 -0
- package/dist/{code-view-D0bqhogi.js → code-view-DsU-xzic.js} +4 -4
- package/dist/comment-attachments-C4yNbcx5.js +20 -0
- package/dist/{comment-composer-jYv2ULNP.js → comment-composer-D7ZytyER.js} +257 -10
- package/dist/{comment-composer-Cc8Jvu6u.d.ts → comment-composer-DvKMTrAi.d.ts} +1 -1
- package/dist/{comment-layer-ClH4MLj4.d.ts → comment-layer-GTsLdABl.d.ts} +17 -6
- package/dist/{comment-list-B8hphLfS.d.ts → comment-list-BI96empx.d.ts} +2 -2
- package/dist/comment-marks.css +18 -22
- package/dist/{comment-panel-fcKSKwLC.d.ts → comment-panel-CsKWTms_.d.ts} +15 -4
- package/dist/{comment-row-Bbm9WwuF.js → comment-row-JmTC0uXr.js} +2 -2
- package/dist/comment-selection-bar-CyVBNYl9.d.ts +42 -0
- package/dist/comment-send-7bg4NEEM.js +277 -0
- package/dist/comment-send-C45dHC22.d.ts +25 -0
- package/dist/comment-send.css +267 -0
- package/dist/comment-thread-B_Sc2QX6.js +797 -0
- package/dist/{comment-thread-CoTLrdal.d.ts → comment-thread-C6U-bsK_.d.ts} +23 -6
- package/dist/{comments-CkWc2Khc.js → comments-B88zg9gC.js} +66 -10
- package/dist/{comments-Bx2WRsYy.d.ts → comments-D8hulVPy.d.ts} +34 -6
- package/dist/{comments-context-C2lOZyQ5.js → comments-context-DhbIdYQ1.js} +2 -1
- package/dist/{config-Dk67emQt.js → config-B1u7zqMB.js} +8 -1
- package/dist/{config-DgxBW013.d.ts → config-pHazYdq6.d.ts} +11 -0
- package/dist/drop-field-3CDRFFRm.js +163 -0
- package/dist/{editor-C_wt4RRV.js → editor-BHYGLgty.js} +42 -3
- package/dist/effects-Ql6VzCRa.js +2971 -0
- package/dist/format-orwcdZL_.js +39 -0
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +1 -1
- package/dist/hold-to-delete-DjWzRDyY.d.ts +51 -0
- package/dist/hold-to-delete-ROLQRZg_.js +434 -0
- package/dist/icon-c5Jb_Tl7.d.ts +31 -0
- package/dist/{image-preview-C9tdkmEj.js → image-preview-BigoAvb3.js} +2 -2
- package/dist/{index-BD1e8vx5.d.ts → index-YUvL2nV8.d.ts} +10 -6
- package/dist/index.d.ts +18 -12
- package/dist/index.js +47 -45
- package/dist/install-D5f6msEU.js +17 -0
- package/dist/list-RCbNZ14q.js +271 -0
- package/dist/{markdown-editor-CMbNZOdN.js → markdown-editor-Dfl2DgPS.js} +1 -1
- package/dist/{markdown-editor-DqdZfIEn.d.ts → markdown-editor-wQF0yD5o.d.ts} +1 -1
- package/dist/markdown-editor.d.ts +1 -1
- package/dist/markdown-editor.js +1 -1
- package/dist/motion/core.d.ts +4 -0
- package/dist/motion/core.js +11 -0
- package/dist/motion-core-lHRF8PZz.d.ts +456 -0
- package/dist/motion.d.ts +16 -0
- package/dist/motion.js +13 -0
- package/dist/{nuxt-ui-DSQFzq3s.js → nuxt-ui-CgvMzO5v.js} +20 -14
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +20 -5
- package/dist/opt-out-b6bnUjIT.js +208 -0
- package/dist/parts/components/agent-session.js +1 -1
- package/dist/parts/components/attachment.js +1 -1
- package/dist/parts/components/avatar-stack.js +3 -2
- package/dist/parts/components/chat-session.d.ts +1 -1
- package/dist/parts/components/chat.js +2 -2
- package/dist/parts/components/code-block.js +1 -1
- package/dist/parts/components/code-view.js +1 -1
- package/dist/parts/components/comment-composer.d.ts +1 -1
- package/dist/parts/components/comment-composer.js +1 -1
- package/dist/parts/components/comment-layer.d.ts +1 -1
- package/dist/parts/components/comment-layer.js +54 -23
- package/dist/parts/components/comment-list.d.ts +1 -1
- package/dist/parts/components/comment-list.js +13 -7
- package/dist/parts/components/comment-panel.d.ts +1 -1
- package/dist/parts/components/comment-panel.js +46 -20
- package/dist/parts/components/comment-pin.js +1 -1
- package/dist/parts/components/comment-selection-bar.d.ts +2 -0
- package/dist/parts/components/comment-selection-bar.js +117 -0
- package/dist/parts/components/comment-send.d.ts +2 -0
- package/dist/parts/components/comment-send.js +2 -0
- package/dist/parts/components/comment-thread.d.ts +2 -2
- package/dist/parts/components/comment-thread.js +2 -570
- package/dist/parts/components/comments.d.ts +8 -6
- package/dist/parts/components/comments.js +6 -4
- package/dist/parts/components/copy-button.d.ts +12 -2
- package/dist/parts/components/copy-button.js +226 -1
- package/dist/parts/components/drop-field.d.ts +69 -0
- package/dist/parts/components/drop-field.js +77 -0
- package/dist/parts/components/filter-search.js +1 -1
- package/dist/parts/components/hold-to-delete.d.ts +82 -0
- package/dist/parts/components/hold-to-delete.js +76 -0
- package/dist/parts/components/markdown-editor.d.ts +1 -1
- package/dist/parts/components/markdown-editor.js +1 -1
- package/dist/parts/components/markdown-renderer.js +1 -1
- package/dist/parts/components/markdown.js +1 -1
- package/dist/parts/components/message-parts.js +13 -5
- package/dist/parts/components/motion-list.d.ts +42 -0
- package/dist/parts/components/motion-list.js +42 -0
- package/dist/parts/components/motion.d.ts +124 -0
- package/dist/parts/components/motion.js +172 -0
- package/dist/parts/components/progress.d.ts +41 -0
- package/dist/parts/components/progress.js +54 -0
- package/dist/parts/components/prompt-input.d.ts +3 -3
- package/dist/parts/components/prompt-input.js +3 -3
- package/dist/parts/components/relative-time.js +1 -1
- package/dist/parts/components/sync-status.js +2 -1
- package/dist/parts/components/tool-list.d.ts +1 -1
- package/dist/parts/components/trace-run.d.ts +1 -1
- package/dist/parts/components/trace-run.js +2 -2
- package/dist/parts/headless/comments.d.ts +2 -2
- package/dist/parts/headless/comments.js +1 -1
- package/dist/parts/playground/share.d.ts +36 -2
- package/dist/parts/workspace/browser-support-notice.js +12 -4
- package/dist/parts/workspace/codemirror.d.ts +9 -0
- package/dist/parts/workspace/codemirror.js +37 -4
- package/dist/parts/workspace/connect-panel.js +1 -1
- package/dist/parts/workspace/file-icons.d.ts +16 -0
- package/dist/parts/workspace/file-icons.js +82 -0
- package/dist/parts/workspace/icons.d.ts +1 -0
- package/dist/parts/workspace/icons.js +1 -0
- package/dist/parts/workspace/runners/render.d.ts +26 -0
- package/dist/parts/workspace/runners/render.js +124 -0
- package/dist/parts/workspace/runners/web-container.d.ts +29 -0
- package/dist/parts/workspace/runners/web-container.js +186 -0
- package/dist/parts/workspace/workspace-bar.d.ts +51 -0
- package/dist/parts/workspace/workspace-bar.js +51 -0
- package/dist/parts/workspace/workspace-boot-status.js +1 -1
- package/dist/parts/workspace/workspace-editor-head.d.ts +47 -0
- package/dist/parts/workspace/workspace-editor-head.js +66 -0
- package/dist/parts/workspace/workspace-editor.d.ts +17 -0
- package/dist/parts/workspace/workspace-editor.js +29 -3
- package/dist/parts/workspace/workspace-examples.d.ts +74 -0
- package/dist/parts/workspace/workspace-examples.js +72 -0
- package/dist/parts/workspace/workspace-file-link.d.ts +35 -0
- package/dist/parts/workspace/workspace-file-link.js +39 -0
- package/dist/parts/workspace/workspace-file-tree.d.ts +8 -8
- package/dist/parts/workspace/workspace-file-tree.js +26 -19
- package/dist/parts/workspace/workspace-guide.d.ts +52 -0
- package/dist/parts/workspace/workspace-guide.js +91 -0
- package/dist/parts/workspace/workspace-issues.d.ts +46 -0
- package/dist/parts/workspace/workspace-issues.js +49 -0
- package/dist/parts/workspace/workspace-preview.js +1 -1
- package/dist/parts/workspace/workspace-shell.d.ts +2 -88
- package/dist/parts/workspace/workspace-shell.js +131 -78
- package/dist/parts/workspace/workspace-sidebar.d.ts +75 -0
- package/dist/parts/workspace/workspace-sidebar.js +132 -0
- package/dist/parts/workspace/workspace-start.d.ts +47 -0
- package/dist/parts/workspace/workspace-start.js +60 -0
- package/dist/parts/workspace/workspace-status.d.ts +69 -0
- package/dist/parts/workspace/workspace-status.js +74 -0
- package/dist/parts/workspace/workspace-steps.d.ts +2 -0
- package/dist/parts/workspace/workspace-steps.js +128 -0
- package/dist/parts/workspace/workspace-task.d.ts +20 -0
- package/dist/parts/workspace/workspace-task.js +20 -0
- package/dist/parts/workspace/workspace.d.ts +251 -0
- package/dist/parts/workspace/workspace.js +665 -0
- package/dist/{pierre-code-view-xgBL6DO7.js → pierre-code-view-NE35tkmR.js} +37 -17
- package/dist/playground.d.ts +1 -1
- package/dist/progress-C7afI5vq.js +266 -0
- package/dist/registry-D3-ysX7l.js +78 -0
- package/dist/{relative-time-BVmjOsYG.js → relative-time-DgSS3zKN.js} +1 -1
- package/dist/ring-B7Qxu7zd.js +175 -0
- package/dist/runtime/nuxt-plugin.js +2 -2
- package/dist/styles.css +657 -526
- package/dist/text-BCJflBJf.js +826 -0
- package/dist/theme.d.ts +43 -0
- package/dist/theme.js +22 -7
- package/dist/travel-C87xd5Wh.js +182 -0
- package/dist/tween-CO24nMpf.js +62 -0
- package/dist/{types-Dyr6CfBW.d.ts → types-BX64qHlV.d.ts} +1 -1
- package/dist/visual-copy-CrVc3z4n.js +15 -0
- package/dist/workspace-shell-BJGnoF3p.d.ts +112 -0
- package/dist/workspace-steps-Bgph2rpr.d.ts +72 -0
- package/dist/workspace.d.ts +17 -4
- package/dist/workspace.js +16 -3
- package/package.json +22 -11
- package/dist/copy-button-CRN3kmSD.js +0 -253
- package/dist/format-Du58PlsG.js +0 -18
- package/dist/icon-swap.css +0 -69
- package/dist/parts/playground/highlight.d.ts +0 -5
- package/dist/parts/playground/highlight.js +0 -23
- package/dist/parts/playground/playground-render.d.ts +0 -126
- package/dist/parts/playground/playground-render.js +0 -356
- package/dist/parts/workspace/playground-container.d.ts +0 -192
- package/dist/parts/workspace/playground-container.js +0 -603
- package/dist/share-DM4eNy4q.d.ts +0 -37
package/dist/workspace.js
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import { t as formatDuration } from "./format-
|
|
1
|
+
import { t as formatDuration } from "./format-orwcdZL_.js";
|
|
2
2
|
import { BrowserSupportNotice, detectUnsupportedBrowser } from "./parts/workspace/browser-support-notice.js";
|
|
3
3
|
import { ConnectPanel, ConnectProviderRow, connectProviderLabel } from "./parts/workspace/connect-panel.js";
|
|
4
4
|
import { useConnectStore } from "./parts/workspace/connect-store.js";
|
|
5
|
+
import { WorkspaceBar } from "./parts/workspace/workspace-bar.js";
|
|
5
6
|
import { WorkspaceBootStatus, bootChecklist } from "./parts/workspace/workspace-boot-status.js";
|
|
7
|
+
import { WorkspaceEditorHead } from "./parts/workspace/workspace-editor-head.js";
|
|
6
8
|
import { WorkspaceEditor } from "./parts/workspace/workspace-editor.js";
|
|
9
|
+
import { WorkspaceExamples, groupExamples } from "./parts/workspace/workspace-examples.js";
|
|
10
|
+
import { WorkspaceFileLink, provideWorkspaceFileOpener } from "./parts/workspace/workspace-file-link.js";
|
|
7
11
|
import { WorkspaceFileTree } from "./parts/workspace/workspace-file-tree.js";
|
|
12
|
+
import { WorkspaceSteps } from "./parts/workspace/workspace-steps.js";
|
|
13
|
+
import { WorkspaceGuide } from "./parts/workspace/workspace-guide.js";
|
|
14
|
+
import { WorkspaceIssues } from "./parts/workspace/workspace-issues.js";
|
|
8
15
|
import { WorkspacePreview, workspacePreviewScript } from "./parts/workspace/workspace-preview.js";
|
|
9
16
|
import { WorkspaceShell } from "./parts/workspace/workspace-shell.js";
|
|
17
|
+
import { WorkspaceSidebar } from "./parts/workspace/workspace-sidebar.js";
|
|
18
|
+
import { WorkspaceStart } from "./parts/workspace/workspace-start.js";
|
|
19
|
+
import { WorkspaceStatus, workspaceLanguage } from "./parts/workspace/workspace-status.js";
|
|
20
|
+
import { WorkspaceTask } from "./parts/workspace/workspace-task.js";
|
|
10
21
|
import { WorkspaceTerminal } from "./parts/workspace/workspace-terminal.js";
|
|
11
|
-
import {
|
|
12
|
-
|
|
22
|
+
import { Workspace, useWorkspace, useWorkspaceDevice } from "./parts/workspace/workspace.js";
|
|
23
|
+
import { render } from "./parts/workspace/runners/render.js";
|
|
24
|
+
import { webContainer } from "./parts/workspace/runners/web-container.js";
|
|
25
|
+
export { BrowserSupportNotice, ConnectPanel, ConnectProviderRow, Workspace, WorkspaceBar, WorkspaceBootStatus, WorkspaceEditor, WorkspaceEditorHead, WorkspaceExamples, WorkspaceFileLink, WorkspaceFileTree, WorkspaceGuide, WorkspaceIssues, WorkspacePreview, WorkspaceShell, WorkspaceSidebar, WorkspaceStart, WorkspaceStatus, WorkspaceSteps, WorkspaceTask, WorkspaceTerminal, bootChecklist, connectProviderLabel, detectUnsupportedBrowser, formatDuration as formatElapsed, groupExamples, provideWorkspaceFileOpener, render, useConnectStore, useWorkspace, useWorkspaceDevice, webContainer, workspaceLanguage, workspacePreviewScript };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "AI interface primitives for Vue and Nuxt.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"type": "module",
|
|
29
29
|
"sideEffects": [
|
|
30
30
|
"./dist/comment-marks.css",
|
|
31
|
-
"./dist/icon-swap.css",
|
|
32
31
|
"./dist/styles.css",
|
|
33
32
|
"./dist/theme.css"
|
|
34
33
|
],
|
|
@@ -49,6 +48,16 @@
|
|
|
49
48
|
"import": "./dist/markdown-editor.js",
|
|
50
49
|
"default": "./dist/markdown-editor.js"
|
|
51
50
|
},
|
|
51
|
+
"./motion": {
|
|
52
|
+
"types": "./dist/motion.d.ts",
|
|
53
|
+
"import": "./dist/motion.js",
|
|
54
|
+
"default": "./dist/motion.js"
|
|
55
|
+
},
|
|
56
|
+
"./motion/core": {
|
|
57
|
+
"types": "./dist/motion/core.d.ts",
|
|
58
|
+
"import": "./dist/motion/core.js",
|
|
59
|
+
"default": "./dist/motion/core.js"
|
|
60
|
+
},
|
|
52
61
|
"./nuxt": {
|
|
53
62
|
"types": "./dist/nuxt.d.ts",
|
|
54
63
|
"import": "./dist/nuxt.js",
|
|
@@ -76,19 +85,18 @@
|
|
|
76
85
|
},
|
|
77
86
|
"./package.json": "./package.json",
|
|
78
87
|
"./comment-marks.css": "./dist/comment-marks.css",
|
|
79
|
-
"./icon-swap.css": "./dist/icon-swap.css",
|
|
80
88
|
"./styles.css": "./dist/styles.css",
|
|
81
89
|
"./theme.css": "./dist/theme.css"
|
|
82
90
|
},
|
|
83
91
|
"dependencies": {
|
|
84
92
|
"reka-ui": "^2.11.0",
|
|
85
93
|
"@comark/vue": "0.9.0",
|
|
86
|
-
"comark-chat": "0.
|
|
94
|
+
"comark-chat": "0.12.1",
|
|
87
95
|
"@nuxt/kit": "4.6.2",
|
|
88
96
|
"@shikijs/langs": "4.5.0",
|
|
89
97
|
"@shikijs/themes": "4.5.0",
|
|
90
98
|
"@types/node": "^24.19.1",
|
|
91
|
-
"@vite-hub/comments": "0.
|
|
99
|
+
"@vite-hub/comments": "0.5.0",
|
|
92
100
|
"@ui-sdk/core": "0.1.0-beta.5",
|
|
93
101
|
"@ui-sdk/vue": "0.1.0-beta.5",
|
|
94
102
|
"nostics": "1.4.0",
|
|
@@ -108,7 +116,7 @@
|
|
|
108
116
|
"@codemirror/state": "6.7.6",
|
|
109
117
|
"@codemirror/view": "6.43.15",
|
|
110
118
|
"@lezer/highlight": "1.2.5",
|
|
111
|
-
"@vite-hub/web-container": "0.
|
|
119
|
+
"@vite-hub/web-container": "0.5.0",
|
|
112
120
|
"@xterm/addon-fit": "0.11.0",
|
|
113
121
|
"@xterm/xterm": "6.0.0"
|
|
114
122
|
},
|
|
@@ -127,7 +135,7 @@
|
|
|
127
135
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
128
136
|
"@vite-hub/icons": "0.1.0",
|
|
129
137
|
"@vite-hub/internal": "0.0.1",
|
|
130
|
-
"@vite-hub/runtime": "0.
|
|
138
|
+
"@vite-hub/runtime": "0.5.0",
|
|
131
139
|
"@vue/server-renderer": "3.5.44",
|
|
132
140
|
"@vue/test-utils": "2.5.1",
|
|
133
141
|
"ai": "7.0.130",
|
|
@@ -143,7 +151,7 @@
|
|
|
143
151
|
"vue": "3.5.44",
|
|
144
152
|
"@types/markdown-it": "^14.2.0",
|
|
145
153
|
"comark-ui": "^0.12.0",
|
|
146
|
-
"@vite-hub/content": "0.
|
|
154
|
+
"@vite-hub/content": "0.5.0",
|
|
147
155
|
"playwright-core": "^1.63.0",
|
|
148
156
|
"@tiptap/core": "^3.31.4",
|
|
149
157
|
"@tiptap/extension-drag-handle": "3.23.6",
|
|
@@ -154,7 +162,7 @@
|
|
|
154
162
|
"@tiptap/pm": "^3.31.4",
|
|
155
163
|
"@tiptap/starter-kit": "^3.31.4",
|
|
156
164
|
"@tiptap/vue-3": "3.31.4",
|
|
157
|
-
"@vite-hub/blob": "0.
|
|
165
|
+
"@vite-hub/blob": "0.5.0"
|
|
158
166
|
},
|
|
159
167
|
"peerDependencies": {
|
|
160
168
|
"@floating-ui/dom": "^1.0.0",
|
|
@@ -215,7 +223,7 @@
|
|
|
215
223
|
}
|
|
216
224
|
},
|
|
217
225
|
"engines": {
|
|
218
|
-
"node": ">=
|
|
226
|
+
"node": ">=24.15.0"
|
|
219
227
|
},
|
|
220
228
|
"scripts": {
|
|
221
229
|
"bench:headless": "node scripts/headless-weight.ts",
|
|
@@ -228,7 +236,10 @@
|
|
|
228
236
|
"test:kit-parts": "node --test test/browser/kit-parts.browser.mjs",
|
|
229
237
|
"test:parity": "node --test test/browser/parity.browser.mjs",
|
|
230
238
|
"test:anchored": "node --test test/browser/anchored.browser.mjs",
|
|
239
|
+
"test:comment-send": "node --test test/browser/comment-send.browser.mjs",
|
|
231
240
|
"test:ui-sdk": "node --test test/browser/ui-sdk.browser.mjs",
|
|
232
|
-
"test:editor": "node --test test/browser/editor.browser.mjs"
|
|
241
|
+
"test:editor": "node --test test/browser/editor.browser.mjs",
|
|
242
|
+
"test:workspace-parts": "node --test test/browser/workspace-parts.browser.mjs test/browser/workspace-start.browser.mjs",
|
|
243
|
+
"test:motion": "node --test --test-concurrency=1 test/browser/motion*.browser.mjs"
|
|
233
244
|
}
|
|
234
245
|
}
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import { r as useUIComponent } from "./nuxt-ui-DSQFzq3s.js";
|
|
2
|
-
import { a as useViteHubUIIcons } from "./config-Dk67emQt.js";
|
|
3
|
-
import { t as uiErrorDiagnostics } from "./error-diagnostics-SXtnk6bz.js";
|
|
4
|
-
import { defineComponent, getCurrentInstance, getCurrentScope, h, onMounted, onScopeDispose, readonly, ref, toValue, watch } from "vue";
|
|
5
|
-
//#region src/internal/announce.ts
|
|
6
|
-
const regionSlot = "live-announcer";
|
|
7
|
-
const hidden = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0";
|
|
8
|
-
function regionFor(element) {
|
|
9
|
-
const container = element.closest("[role=dialog], [role=alertdialog]") ?? element.ownerDocument.body;
|
|
10
|
-
for (const child of container.children) if (child instanceof HTMLElement && child.dataset.slot === regionSlot) return child;
|
|
11
|
-
const region = element.ownerDocument.createElement("div");
|
|
12
|
-
region.dataset.slot = regionSlot;
|
|
13
|
-
region.setAttribute("aria-live", "polite");
|
|
14
|
-
region.setAttribute("aria-atomic", "true");
|
|
15
|
-
region.style.cssText = hidden;
|
|
16
|
-
container.append(region);
|
|
17
|
-
return region;
|
|
18
|
-
}
|
|
19
|
-
/** Adds the live region that `announce()` will use for `element`, so that the first message is read. */
|
|
20
|
-
function prepareAnnouncer(element) {
|
|
21
|
-
if (element) regionFor(element);
|
|
22
|
-
}
|
|
23
|
-
const clearTimers = /* @__PURE__ */ new WeakMap();
|
|
24
|
-
/** Reads `message` to screen readers without moving focus, and clears it after `duration` ms. */
|
|
25
|
-
function announce(element, message, duration = 2e3) {
|
|
26
|
-
if (!element) return;
|
|
27
|
-
const region = regionFor(element);
|
|
28
|
-
clearTimeout(clearTimers.get(region));
|
|
29
|
-
region.textContent = "";
|
|
30
|
-
requestAnimationFrame(() => {
|
|
31
|
-
region.textContent = message;
|
|
32
|
-
});
|
|
33
|
-
clearTimers.set(region, setTimeout(() => region.textContent = "", duration));
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region src/components/copy-button.ts
|
|
37
|
-
async function writeClipboard(value) {
|
|
38
|
-
const text = typeof value === "function" ? value() : value;
|
|
39
|
-
try {
|
|
40
|
-
await writeClipboardApi(text);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
if (!copyWithCommand(await text)) throw error;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async function writeClipboardApi(text) {
|
|
46
|
-
const clipboard = globalThis.navigator?.clipboard;
|
|
47
|
-
if (typeof clipboard?.writeText !== "function") throw uiErrorDiagnostics.UI_CLIPBOARD_UNAVAILABLE();
|
|
48
|
-
if (typeof text === "string") return clipboard.writeText(text);
|
|
49
|
-
if (typeof ClipboardItem === "function" && typeof clipboard.write === "function") return clipboard.write([new ClipboardItem({ "text/plain": text.then((resolved) => new Blob([resolved], { type: "text/plain" })) })]);
|
|
50
|
-
return clipboard.writeText(await text);
|
|
51
|
-
}
|
|
52
|
-
/** Copies through a hidden text area and `document.execCommand("copy")`. Returns `false` when the browser refuses. */
|
|
53
|
-
function copyWithCommand(text) {
|
|
54
|
-
const doc = globalThis.document;
|
|
55
|
-
if (typeof doc?.execCommand !== "function" || !doc.body) return false;
|
|
56
|
-
const focused = doc.activeElement;
|
|
57
|
-
const area = doc.createElement("textarea");
|
|
58
|
-
area.value = text;
|
|
59
|
-
area.readOnly = true;
|
|
60
|
-
area.style.position = "fixed";
|
|
61
|
-
area.style.opacity = "0";
|
|
62
|
-
doc.body.append(area);
|
|
63
|
-
area.focus({ preventScroll: true });
|
|
64
|
-
area.select();
|
|
65
|
-
try {
|
|
66
|
-
return doc.execCommand("copy");
|
|
67
|
-
} catch {
|
|
68
|
-
return false;
|
|
69
|
-
} finally {
|
|
70
|
-
area.remove();
|
|
71
|
-
if (focused instanceof HTMLElement) focused.focus({ preventScroll: true });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* The clipboard logic of `CopyButton`, for a control that copies as one part of a larger action, such as the item
|
|
76
|
-
* "Copy link" in a menu. The caller shows the result, for example with a toast.
|
|
77
|
-
*/
|
|
78
|
-
function useCopy(options = {}) {
|
|
79
|
-
const copied = ref(false);
|
|
80
|
-
const failed = ref(false);
|
|
81
|
-
let timer;
|
|
82
|
-
if (getCurrentScope()) onScopeDispose(() => clearTimeout(timer));
|
|
83
|
-
async function copy(value) {
|
|
84
|
-
clearTimeout(timer);
|
|
85
|
-
copied.value = false;
|
|
86
|
-
failed.value = false;
|
|
87
|
-
try {
|
|
88
|
-
await writeClipboard(value);
|
|
89
|
-
copied.value = true;
|
|
90
|
-
} catch {
|
|
91
|
-
failed.value = true;
|
|
92
|
-
}
|
|
93
|
-
timer = setTimeout(() => {
|
|
94
|
-
copied.value = false;
|
|
95
|
-
failed.value = false;
|
|
96
|
-
}, toValue(options.duration) ?? 2e3);
|
|
97
|
-
return copied.value;
|
|
98
|
-
}
|
|
99
|
-
return {
|
|
100
|
-
copy,
|
|
101
|
-
copied: readonly(copied),
|
|
102
|
-
failed: readonly(failed)
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* A button that copies text. It shows `icon`, or the theme's `copy` icon, and swaps to the theme's `copyCheck` icon for
|
|
107
|
-
* `duration` ms after a copy. Both icons stay in the button and cross-fade with the rules of `icon-swap.css`. It
|
|
108
|
-
* announces "Copied", or "Copy failed" when the browser refuses. Without a label it is an icon-only button named "Copy".
|
|
109
|
-
*/
|
|
110
|
-
const CopyButton = defineComponent({
|
|
111
|
-
name: "CopyButton",
|
|
112
|
-
inheritAttrs: false,
|
|
113
|
-
props: {
|
|
114
|
-
value: {
|
|
115
|
-
required: true,
|
|
116
|
-
type: [String, Function]
|
|
117
|
-
},
|
|
118
|
-
label: {
|
|
119
|
-
default: void 0,
|
|
120
|
-
type: String
|
|
121
|
-
},
|
|
122
|
-
/** The icon before a copy, such as `i-lucide-link` for a link. Defaults to the theme's `copy` icon. */
|
|
123
|
-
icon: {
|
|
124
|
-
default: void 0,
|
|
125
|
-
type: String
|
|
126
|
-
},
|
|
127
|
-
ariaLabel: {
|
|
128
|
-
default: void 0,
|
|
129
|
-
type: String
|
|
130
|
-
},
|
|
131
|
-
size: {
|
|
132
|
-
default: void 0,
|
|
133
|
-
type: String
|
|
134
|
-
},
|
|
135
|
-
variant: {
|
|
136
|
-
default: "ghost",
|
|
137
|
-
type: String
|
|
138
|
-
},
|
|
139
|
-
/** How long, in ms, the check shows after a copy. */
|
|
140
|
-
duration: {
|
|
141
|
-
default: 2e3,
|
|
142
|
-
type: Number
|
|
143
|
-
},
|
|
144
|
-
/** Call a function `value` when the pointer enters the button or it gets focus, so the click copies text that is already loaded. */
|
|
145
|
-
preload: {
|
|
146
|
-
default: false,
|
|
147
|
-
type: Boolean
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
emits: {
|
|
151
|
-
copy: () => true,
|
|
152
|
-
error: () => true
|
|
153
|
-
},
|
|
154
|
-
setup(props, { attrs, emit, slots }) {
|
|
155
|
-
const UButton = useUIComponent("UButton");
|
|
156
|
-
const UIcon = useUIComponent("UIcon");
|
|
157
|
-
const icons = useViteHubUIIcons();
|
|
158
|
-
const { copy, copied } = useCopy({ duration: () => props.duration });
|
|
159
|
-
const instance = getCurrentInstance();
|
|
160
|
-
const element = () => {
|
|
161
|
-
const el = instance?.proxy?.$el;
|
|
162
|
-
return el instanceof Element ? el : void 0;
|
|
163
|
-
};
|
|
164
|
-
onMounted(() => prepareAnnouncer(element()));
|
|
165
|
-
let preloaded;
|
|
166
|
-
watch(() => props.value, () => preloaded = void 0);
|
|
167
|
-
function preload() {
|
|
168
|
-
if (!props.preload || preloaded || typeof props.value !== "function") return;
|
|
169
|
-
const entry = { text: callValue(props.value) };
|
|
170
|
-
preloaded = entry;
|
|
171
|
-
if (typeof entry.text === "string") return;
|
|
172
|
-
entry.text.then((text) => {
|
|
173
|
-
if (preloaded === entry) entry.text = text;
|
|
174
|
-
}, () => {
|
|
175
|
-
if (preloaded === entry) preloaded = void 0;
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
const loading = ref(false);
|
|
179
|
-
async function onClick(event) {
|
|
180
|
-
const target = event.currentTarget instanceof Element ? event.currentTarget : element();
|
|
181
|
-
let value = props.value;
|
|
182
|
-
if (typeof value === "function") {
|
|
183
|
-
const text = preloaded?.text ?? callValue(value);
|
|
184
|
-
preloaded = void 0;
|
|
185
|
-
value = typeof text === "string" ? text : () => text;
|
|
186
|
-
loading.value = typeof text !== "string";
|
|
187
|
-
}
|
|
188
|
-
const ok = await copy(value);
|
|
189
|
-
loading.value = false;
|
|
190
|
-
announce(target, ok ? "Copied" : "Copy failed");
|
|
191
|
-
if (ok) emit("copy");
|
|
192
|
-
else emit("error");
|
|
193
|
-
}
|
|
194
|
-
const leading = ({ ui }) => {
|
|
195
|
-
const iconClass = ui?.leadingIcon?.({ class: leadingIconClass(attrs.ui) });
|
|
196
|
-
return [h("span", {
|
|
197
|
-
"aria-hidden": "true",
|
|
198
|
-
"data-slot": "copy-button-icon"
|
|
199
|
-
}, [h("span", { "data-icon": "copy" }, [h(UIcon, {
|
|
200
|
-
class: iconClass,
|
|
201
|
-
name: props.icon ?? icons.value.copy
|
|
202
|
-
})]), h("span", { "data-icon": "check" }, [h(UIcon, {
|
|
203
|
-
class: iconClass,
|
|
204
|
-
name: icons.value.copyCheck
|
|
205
|
-
})])])];
|
|
206
|
-
};
|
|
207
|
-
return () => h(UButton, {
|
|
208
|
-
...attrs,
|
|
209
|
-
"aria-label": props.ariaLabel ?? (props.label || slots.default ? void 0 : "Copy"),
|
|
210
|
-
"data-copied": copied.value ? "" : void 0,
|
|
211
|
-
"data-slot": attrs["data-slot"] ?? "copy-button",
|
|
212
|
-
icon: copied.value ? icons.value.copyCheck : props.icon ?? icons.value.copy,
|
|
213
|
-
label: props.label,
|
|
214
|
-
loading: loading.value,
|
|
215
|
-
size: props.size,
|
|
216
|
-
variant: props.variant,
|
|
217
|
-
onClick: (event) => {
|
|
218
|
-
callListener(attrs.onClick, event);
|
|
219
|
-
return onClick(event);
|
|
220
|
-
},
|
|
221
|
-
onFocus: (event) => {
|
|
222
|
-
callListener(attrs.onFocus, event);
|
|
223
|
-
if (event.currentTarget instanceof Element) prepareAnnouncer(event.currentTarget);
|
|
224
|
-
preload();
|
|
225
|
-
},
|
|
226
|
-
onPointerenter: (event) => {
|
|
227
|
-
callListener(attrs.onPointerenter, event);
|
|
228
|
-
preload();
|
|
229
|
-
}
|
|
230
|
-
}, {
|
|
231
|
-
...loading.value ? {} : { leading },
|
|
232
|
-
...slots.default ? { default: slots.default } : {}
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
/** Calls a function `value`. A function that throws gives a rejected promise, so the copy reports the failure. */
|
|
237
|
-
function callValue(value) {
|
|
238
|
-
try {
|
|
239
|
-
return value();
|
|
240
|
-
} catch (error) {
|
|
241
|
-
return Promise.reject(error);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
function leadingIconClass(ui) {
|
|
245
|
-
return typeof ui === "object" && ui !== null && "leadingIcon" in ui ? ui.leadingIcon : void 0;
|
|
246
|
-
}
|
|
247
|
-
function callListener(listener, event) {
|
|
248
|
-
if (Array.isArray(listener)) {
|
|
249
|
-
for (const handler of listener) if (typeof handler === "function") handler(event);
|
|
250
|
-
} else if (typeof listener === "function") listener(event);
|
|
251
|
-
}
|
|
252
|
-
//#endregion
|
|
253
|
-
export { useCopy as n, CopyButton as t };
|
package/dist/format-Du58PlsG.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region src/internal/format.ts
|
|
2
|
-
/** "320 ms", "1.2 s", "30 s", or "1 min 35 s". Seconds round down, so a running counter never shows "60 s". */
|
|
3
|
-
function formatDuration(ms) {
|
|
4
|
-
if (ms < 1e3) return `${Math.round(ms)} ms`;
|
|
5
|
-
const seconds = ms / 1e3;
|
|
6
|
-
if (seconds < 10) return `${seconds.toFixed(1)} s`;
|
|
7
|
-
if (seconds < 60) return `${Math.floor(seconds)} s`;
|
|
8
|
-
return `${Math.floor(seconds / 60)} min ${Math.floor(seconds % 60)} s`;
|
|
9
|
-
}
|
|
10
|
-
/** Two letters for an avatar without an image: `Ana Lopez` and `ana.lopez@vitehub.dev` are `AL`, `Ana` is `AN`. */
|
|
11
|
-
function initials(name) {
|
|
12
|
-
const words = name.replace(/@.*/, "").trim().split(/[\s._-]+/).filter(Boolean);
|
|
13
|
-
const first = words[0] ?? "";
|
|
14
|
-
const second = words.length > 1 ? words.at(-1) ?? "" : first.slice(1);
|
|
15
|
-
return (first.slice(0, 1) + second.slice(0, 1)).toUpperCase() || "?";
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { initials as n, formatDuration as t };
|
package/dist/icon-swap.css
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The icon swap of CopyButton: the copy icon and the check cross-fade when the button copies, and again when it returns.
|
|
3
|
-
* This is plain CSS with no framework, so a page without Vue, such as Drop's document frame, draws the same swap. Load
|
|
4
|
-
* it in the page or in a shadow root. `styles.css` imports it into its components layer.
|
|
5
|
-
*
|
|
6
|
-
* The markup:
|
|
7
|
-
*
|
|
8
|
-
* <button data-slot="copy-button" data-copied>
|
|
9
|
-
* <span data-slot="copy-button-icon" aria-hidden="true">
|
|
10
|
-
* <span data-icon="copy"><svg>…</svg></span>
|
|
11
|
-
* <span data-icon="check"><svg>…</svg></span>
|
|
12
|
-
* </span>
|
|
13
|
-
* Copy
|
|
14
|
-
* </button>
|
|
15
|
-
*
|
|
16
|
-
* - `copy-button-icon` holds both icons in one grid cell, so the button keeps its size and both icons stay in the DOM.
|
|
17
|
-
* - `data-icon="copy"` wraps the icon before a copy, and `data-icon="check"` the icon after it. The swap sets the opacity,
|
|
18
|
-
* scale, and filter of the wrappers, so a class on an icon inside, such as a utility opacity, stays as it is.
|
|
19
|
-
* - `data-copied` on the button, or on any element around the icons, shows the check. Remove it to show the copy icon.
|
|
20
|
-
*
|
|
21
|
-
* The entering icon goes from opacity 0, scale 0.3, and a 3px blur to its rest in 300ms. The leaving icon goes back in
|
|
22
|
-
* 200ms. They are transitions, so a swap that starts before the last one ends reverses from where it is, and nothing
|
|
23
|
-
* animates when the page loads. Under reduced motion the icons swap with no animation.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
[data-slot="copy-button-icon"] {
|
|
27
|
-
display: grid;
|
|
28
|
-
place-items: center;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
[data-slot="copy-button-icon"] > * {
|
|
32
|
-
display: flex;
|
|
33
|
-
grid-area: 1 / 1;
|
|
34
|
-
transition-property: opacity, scale, filter;
|
|
35
|
-
transition-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/* The hidden icon of each state. An icon takes the duration of the state that it goes to, so the leaving one is faster. */
|
|
39
|
-
[data-slot="copy-button-icon"] > [data-icon="check"],
|
|
40
|
-
[data-copied] [data-slot="copy-button-icon"] > [data-icon="copy"] {
|
|
41
|
-
filter: blur(3px);
|
|
42
|
-
opacity: 0;
|
|
43
|
-
scale: 0.3;
|
|
44
|
-
transition-duration: 200ms;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/* The shown icon of each state. */
|
|
48
|
-
[data-slot="copy-button-icon"] > [data-icon="copy"],
|
|
49
|
-
[data-copied] [data-slot="copy-button-icon"] > [data-icon="check"] {
|
|
50
|
-
filter: none;
|
|
51
|
-
opacity: 1;
|
|
52
|
-
scale: 1;
|
|
53
|
-
transition-duration: 300ms;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* A check that appears with its button, such as after the loading icon of a text that had to load, also fades in. */
|
|
57
|
-
@starting-style {
|
|
58
|
-
[data-copied] [data-slot="copy-button-icon"] > [data-icon="check"] {
|
|
59
|
-
filter: blur(3px);
|
|
60
|
-
opacity: 0;
|
|
61
|
-
scale: 0.3;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@media (prefers-reduced-motion: reduce) {
|
|
66
|
-
[data-slot="copy-button-icon"] > * {
|
|
67
|
-
transition: none;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { LanguageInput } from "shiki/core";
|
|
2
|
-
//#region src/playground/highlight.d.ts
|
|
3
|
-
/** Returns a function that colors code as HTML, or gives `undefined` for a language that did not load. */
|
|
4
|
-
export declare function createHighlight(languages: LanguageInput[]): Promise<(code: string, language: string) => string | undefined>;
|
|
5
|
-
//#endregion
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createHighlighterCore } from "shiki/core";
|
|
2
|
-
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
|
|
3
|
-
import dark from "shiki/themes/github-dark-default.mjs";
|
|
4
|
-
import light from "shiki/themes/github-light-high-contrast.mjs";
|
|
5
|
-
//#region src/playground/highlight.ts
|
|
6
|
-
/** Returns a function that colors code as HTML, or gives `undefined` for a language that did not load. */
|
|
7
|
-
async function createHighlight(languages) {
|
|
8
|
-
const highlighter = await createHighlighterCore({
|
|
9
|
-
engine: createJavaScriptRegexEngine({ forgiving: true }),
|
|
10
|
-
langs: languages,
|
|
11
|
-
themes: [light, dark]
|
|
12
|
-
});
|
|
13
|
-
const loaded = new Set(highlighter.getLoadedLanguages());
|
|
14
|
-
return (code, language) => loaded.has(language) ? highlighter.codeToHtml(code, {
|
|
15
|
-
lang: language,
|
|
16
|
-
themes: {
|
|
17
|
-
dark: "github-dark-default",
|
|
18
|
-
light: "github-light-high-contrast"
|
|
19
|
-
}
|
|
20
|
-
}) : void 0;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { createHighlight };
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { r as PlaygroundTemplate, t as PlaygroundFiles } from "../../share-DM4eNy4q.js";
|
|
2
|
-
import { PropType, VNode } from "vue";
|
|
3
|
-
import { LanguageInput } from "shiki/core";
|
|
4
|
-
//#region src/playground/playground-render.d.ts
|
|
5
|
-
/** An example that the playground can start from. Its `id` goes into share links. */
|
|
6
|
-
export interface PlaygroundPreset extends PlaygroundTemplate {
|
|
7
|
-
label: string;
|
|
8
|
-
/** Presets with the same group show under one heading. */
|
|
9
|
-
group?: string;
|
|
10
|
-
}
|
|
11
|
-
/** An editor tab. It edits one file. */
|
|
12
|
-
export interface PlaygroundPane {
|
|
13
|
-
file: string;
|
|
14
|
-
label: string;
|
|
15
|
-
/** The Shiki language that colors the file, such as `"json"`. */
|
|
16
|
-
language?: string;
|
|
17
|
-
/** Shows the slot with this name in place of the text editor, as in Nuxt UI's `UTabs`. */
|
|
18
|
-
slot?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface PlaygroundIssue {
|
|
21
|
-
message: string;
|
|
22
|
-
line?: number;
|
|
23
|
-
}
|
|
24
|
-
export interface PlaygroundResult {
|
|
25
|
-
html: string;
|
|
26
|
-
issues?: PlaygroundIssue[];
|
|
27
|
-
}
|
|
28
|
-
/** The props of the slot of a pane that sets `slot`, such as a theme form that writes `theme.json`. */
|
|
29
|
-
export interface PlaygroundPaneSlotProps {
|
|
30
|
-
pane: PlaygroundPane;
|
|
31
|
-
/** The contents of the pane's file, or `""`. */
|
|
32
|
-
value: string;
|
|
33
|
-
files: PlaygroundFiles;
|
|
34
|
-
/** Writes a file. The preview and the link follow 200 ms later. */
|
|
35
|
-
setFile: (path: string, contents: string) => void;
|
|
36
|
-
}
|
|
37
|
-
/** The payload of `load` and `preset-change`: the open preset's id, or none for a link without one, and the open files. */
|
|
38
|
-
export interface PlaygroundOpenEvent {
|
|
39
|
-
preset: string | undefined;
|
|
40
|
-
files: PlaygroundFiles;
|
|
41
|
-
}
|
|
42
|
-
/** Renders the files to the HTML of the preview, in the browser. */
|
|
43
|
-
export type PlaygroundRenderer = (files: PlaygroundFiles) => Promise<PlaygroundResult>;
|
|
44
|
-
declare function plainPreviewDocument(html: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* A playground that renders files in the page: editors on one side and the preview on the other. The state is a set
|
|
47
|
-
* of files, kept in the URL hash as a share link of `@vite-hub/ui/playground`.
|
|
48
|
-
*/
|
|
49
|
-
export declare const PlaygroundRender: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
50
|
-
/** The examples. A share link names one of them as its template. */
|
|
51
|
-
presets: {
|
|
52
|
-
required: true;
|
|
53
|
-
type: PropType<PlaygroundPreset[]>;
|
|
54
|
-
};
|
|
55
|
-
/** The id of the preset that opens when the URL has no link. Defaults to the first preset. */
|
|
56
|
-
preset: {
|
|
57
|
-
default: undefined;
|
|
58
|
-
type: StringConstructor;
|
|
59
|
-
};
|
|
60
|
-
/** The editor tabs, one file each. */
|
|
61
|
-
panes: {
|
|
62
|
-
required: true;
|
|
63
|
-
type: PropType<PlaygroundPane[]>;
|
|
64
|
-
};
|
|
65
|
-
/** Renders the files to HTML. The playground calls it 200 ms after the last edit and drops a result that is out of date. */
|
|
66
|
-
render: {
|
|
67
|
-
required: true;
|
|
68
|
-
type: PropType<PlaygroundRenderer>;
|
|
69
|
-
};
|
|
70
|
-
/** Shiki languages that color the panes. They load after the first render. Without them, the panes are plain text. */
|
|
71
|
-
languages: {
|
|
72
|
-
default: undefined;
|
|
73
|
-
type: PropType<LanguageInput[]>;
|
|
74
|
-
};
|
|
75
|
-
/** Wraps the rendered HTML in the document of the preview, with its stylesheets and theme. Defaults to a plain page. */
|
|
76
|
-
previewDocument: {
|
|
77
|
-
default: typeof plainPreviewDocument;
|
|
78
|
-
type: PropType<(html: string, files: PlaygroundFiles) => string>;
|
|
79
|
-
};
|
|
80
|
-
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
81
|
-
[key: string]: any;
|
|
82
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
83
|
-
/** The files opened from the URL hash, or from the opening preset when the URL has no link. */
|
|
84
|
-
load: (_event: PlaygroundOpenEvent) => true;
|
|
85
|
-
/** Another preset opened: the reader picked it, or a link names it. */
|
|
86
|
-
"preset-change": (_event: PlaygroundOpenEvent) => true;
|
|
87
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
88
|
-
/** The examples. A share link names one of them as its template. */
|
|
89
|
-
presets: {
|
|
90
|
-
required: true;
|
|
91
|
-
type: PropType<PlaygroundPreset[]>;
|
|
92
|
-
};
|
|
93
|
-
/** The id of the preset that opens when the URL has no link. Defaults to the first preset. */
|
|
94
|
-
preset: {
|
|
95
|
-
default: undefined;
|
|
96
|
-
type: StringConstructor;
|
|
97
|
-
};
|
|
98
|
-
/** The editor tabs, one file each. */
|
|
99
|
-
panes: {
|
|
100
|
-
required: true;
|
|
101
|
-
type: PropType<PlaygroundPane[]>;
|
|
102
|
-
};
|
|
103
|
-
/** Renders the files to HTML. The playground calls it 200 ms after the last edit and drops a result that is out of date. */
|
|
104
|
-
render: {
|
|
105
|
-
required: true;
|
|
106
|
-
type: PropType<PlaygroundRenderer>;
|
|
107
|
-
};
|
|
108
|
-
/** Shiki languages that color the panes. They load after the first render. Without them, the panes are plain text. */
|
|
109
|
-
languages: {
|
|
110
|
-
default: undefined;
|
|
111
|
-
type: PropType<LanguageInput[]>;
|
|
112
|
-
};
|
|
113
|
-
/** Wraps the rendered HTML in the document of the preview, with its stylesheets and theme. Defaults to a plain page. */
|
|
114
|
-
previewDocument: {
|
|
115
|
-
default: typeof plainPreviewDocument;
|
|
116
|
-
type: PropType<(html: string, files: PlaygroundFiles) => string>;
|
|
117
|
-
};
|
|
118
|
-
}>> & Readonly<{
|
|
119
|
-
onLoad?: ((_event: PlaygroundOpenEvent) => any) | undefined;
|
|
120
|
-
"onPreset-change"?: ((_event: PlaygroundOpenEvent) => any) | undefined;
|
|
121
|
-
}>, {
|
|
122
|
-
preset: string;
|
|
123
|
-
languages: LanguageInput[];
|
|
124
|
-
previewDocument: (html: string, files: PlaygroundFiles) => string;
|
|
125
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
126
|
-
//#endregion
|