@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
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
import { r as useUIComponent } from "../../nuxt-ui-CgvMzO5v.js";
|
|
2
|
+
import { t as ring } from "../../ring-B7Qxu7zd.js";
|
|
3
|
+
import { t as uiErrorDiagnostics } from "../../error-diagnostics-SXtnk6bz.js";
|
|
4
|
+
import { useCopy } from "../components/copy-button.js";
|
|
5
|
+
import { Status } from "../components/status.js";
|
|
6
|
+
import { decodePlaygroundLink, encodePlaygroundLink, playgroundLinkLimit, playgroundUrl, readPlaygroundHash } from "../playground/share.js";
|
|
7
|
+
import { downloadZip } from "../playground/zip.js";
|
|
8
|
+
import { BrowserSupportNotice } from "./browser-support-notice.js";
|
|
9
|
+
import { WorkspaceBar } from "./workspace-bar.js";
|
|
10
|
+
import { WorkspaceEditorHead } from "./workspace-editor-head.js";
|
|
11
|
+
import { WorkspaceEditor } from "./workspace-editor.js";
|
|
12
|
+
import { WorkspaceExamples } from "./workspace-examples.js";
|
|
13
|
+
import { provideWorkspaceFileOpener } from "./workspace-file-link.js";
|
|
14
|
+
import { WorkspaceFileTree } from "./workspace-file-tree.js";
|
|
15
|
+
import { WorkspaceSteps } from "./workspace-steps.js";
|
|
16
|
+
import { WorkspaceGuide } from "./workspace-guide.js";
|
|
17
|
+
import { WorkspaceShell } from "./workspace-shell.js";
|
|
18
|
+
import { WorkspaceSidebar } from "./workspace-sidebar.js";
|
|
19
|
+
import { WorkspaceStart } from "./workspace-start.js";
|
|
20
|
+
import { WorkspaceStatus } from "./workspace-status.js";
|
|
21
|
+
import { computed, defineComponent, h, inject, markRaw, nextTick, onBeforeUnmount, onMounted, provide, reactive, ref, shallowRef, watch } from "vue";
|
|
22
|
+
//#region src/workspace/workspace.ts
|
|
23
|
+
const contextKey = Symbol("Workspace");
|
|
24
|
+
/** The workspace around the calling component: its files, edits, and actions. Call it in a slot of `Workspace`. */
|
|
25
|
+
function useWorkspace() {
|
|
26
|
+
const context = inject(contextKey, void 0);
|
|
27
|
+
if (!context) throw uiErrorDiagnostics.UI_R0002({ message: "useWorkspace() must be used in a component inside Workspace." });
|
|
28
|
+
return context;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The device of the page, and whether the browser can run `runner`, known after mount. Desktops are 64rem wide or
|
|
32
|
+
* more, and tablets 48rem. Use it to place the workspace, as a page with a lesson next to it does.
|
|
33
|
+
*/
|
|
34
|
+
function useWorkspaceDevice(runner) {
|
|
35
|
+
const device = ref("pending");
|
|
36
|
+
const supported = ref();
|
|
37
|
+
let queries = [];
|
|
38
|
+
const update = () => {
|
|
39
|
+
const [desktop, tablet] = queries;
|
|
40
|
+
device.value = desktop?.matches ? "desktop" : tablet?.matches ? "tablet" : "phone";
|
|
41
|
+
};
|
|
42
|
+
onMounted(() => {
|
|
43
|
+
queries = [window.matchMedia("(min-width: 64rem)"), window.matchMedia("(min-width: 48rem)")];
|
|
44
|
+
for (const query of queries) query.addEventListener("change", update);
|
|
45
|
+
update();
|
|
46
|
+
supported.value = runner?.supported?.() ?? true;
|
|
47
|
+
});
|
|
48
|
+
onBeforeUnmount(() => {
|
|
49
|
+
for (const query of queries) query.removeEventListener("change", update);
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
device,
|
|
53
|
+
supported
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const statusTones = {
|
|
57
|
+
busy: "warning",
|
|
58
|
+
error: "error",
|
|
59
|
+
ready: "success"
|
|
60
|
+
};
|
|
61
|
+
function diff(base, files) {
|
|
62
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(base), ...Object.keys(files)])].filter((path) => base[path] !== files[path]).sort();
|
|
63
|
+
}
|
|
64
|
+
const filesOf = (example) => ({ ...example.files });
|
|
65
|
+
function firstFile(example, files) {
|
|
66
|
+
return example.open !== void 0 && files[example.open] !== void 0 ? example.open : Object.keys(files).sort()[0] ?? "";
|
|
67
|
+
}
|
|
68
|
+
const capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
69
|
+
const zipName = (prefix, example) => prefix ? `${prefix}-${example.id}` : example.id;
|
|
70
|
+
const workspaceProps = {
|
|
71
|
+
examples: {
|
|
72
|
+
required: true,
|
|
73
|
+
type: Array
|
|
74
|
+
},
|
|
75
|
+
runner: {
|
|
76
|
+
required: true,
|
|
77
|
+
type: Object
|
|
78
|
+
},
|
|
79
|
+
example: {
|
|
80
|
+
default: void 0,
|
|
81
|
+
type: String
|
|
82
|
+
},
|
|
83
|
+
selected: {
|
|
84
|
+
default: void 0,
|
|
85
|
+
type: String
|
|
86
|
+
},
|
|
87
|
+
steps: {
|
|
88
|
+
default: () => [],
|
|
89
|
+
type: Array
|
|
90
|
+
},
|
|
91
|
+
step: {
|
|
92
|
+
default: void 0,
|
|
93
|
+
type: Number
|
|
94
|
+
},
|
|
95
|
+
guide: {
|
|
96
|
+
default: void 0,
|
|
97
|
+
type: String
|
|
98
|
+
},
|
|
99
|
+
tabs: {
|
|
100
|
+
default: () => [],
|
|
101
|
+
type: Array
|
|
102
|
+
},
|
|
103
|
+
share: {
|
|
104
|
+
default: true,
|
|
105
|
+
type: Boolean
|
|
106
|
+
},
|
|
107
|
+
name: {
|
|
108
|
+
default: "",
|
|
109
|
+
type: String
|
|
110
|
+
},
|
|
111
|
+
start: {
|
|
112
|
+
default: false,
|
|
113
|
+
type: Boolean
|
|
114
|
+
},
|
|
115
|
+
label: {
|
|
116
|
+
default: "workspace",
|
|
117
|
+
type: String
|
|
118
|
+
},
|
|
119
|
+
open: {
|
|
120
|
+
default: false,
|
|
121
|
+
type: Boolean
|
|
122
|
+
},
|
|
123
|
+
reset: {
|
|
124
|
+
default: void 0,
|
|
125
|
+
type: Function
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const WorkspaceSession = defineComponent({
|
|
129
|
+
name: "WorkspaceSession",
|
|
130
|
+
props: {
|
|
131
|
+
config: {
|
|
132
|
+
required: true,
|
|
133
|
+
type: Object
|
|
134
|
+
},
|
|
135
|
+
booted: {
|
|
136
|
+
required: true,
|
|
137
|
+
type: Object
|
|
138
|
+
},
|
|
139
|
+
files: {
|
|
140
|
+
required: true,
|
|
141
|
+
type: Object
|
|
142
|
+
},
|
|
143
|
+
notice: {
|
|
144
|
+
default: void 0,
|
|
145
|
+
type: String
|
|
146
|
+
},
|
|
147
|
+
step: {
|
|
148
|
+
default: 0,
|
|
149
|
+
type: Number
|
|
150
|
+
},
|
|
151
|
+
shared: {
|
|
152
|
+
default: void 0,
|
|
153
|
+
type: Object
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
emits: {
|
|
157
|
+
"update:selected": (path) => typeof path === "string",
|
|
158
|
+
"update:step": (step) => Number.isInteger(step),
|
|
159
|
+
change: (example) => !!example,
|
|
160
|
+
remount: (example) => !!example,
|
|
161
|
+
restore: (link) => !!link
|
|
162
|
+
},
|
|
163
|
+
setup(props, { emit, slots }) {
|
|
164
|
+
const UButton = useUIComponent("UButton");
|
|
165
|
+
const UDropdownMenu = useUIComponent("UDropdownMenu");
|
|
166
|
+
const UModal = useUIComponent("UModal");
|
|
167
|
+
const config = props.config;
|
|
168
|
+
const tab = ref();
|
|
169
|
+
const showTab = (next) => {
|
|
170
|
+
tab.value = next;
|
|
171
|
+
};
|
|
172
|
+
const showFile = (path) => {
|
|
173
|
+
if (run.files.value[path] !== void 0) show(path);
|
|
174
|
+
};
|
|
175
|
+
const run = config.runner.start({
|
|
176
|
+
example: props.booted,
|
|
177
|
+
files: { ...props.files },
|
|
178
|
+
showTab,
|
|
179
|
+
show: showFile
|
|
180
|
+
});
|
|
181
|
+
const current = shallowRef(props.booted);
|
|
182
|
+
const example = computed(() => config.examples.find((item) => item.id === current.value.id) ?? current.value);
|
|
183
|
+
const edited = computed(() => diff(filesOf(example.value), run.files.value));
|
|
184
|
+
const paths = computed(() => Object.keys(run.files.value).sort());
|
|
185
|
+
const selected = ref(config.selected !== void 0 && props.files[config.selected] !== void 0 ? config.selected : firstFile(props.booted, props.files));
|
|
186
|
+
watch(() => config.selected, (path) => {
|
|
187
|
+
if (path !== void 0) selected.value = path;
|
|
188
|
+
});
|
|
189
|
+
watch(selected, (path) => emit("update:selected", path), { immediate: true });
|
|
190
|
+
const wrap = ref(false);
|
|
191
|
+
const cursor = ref({
|
|
192
|
+
column: 1,
|
|
193
|
+
line: 1
|
|
194
|
+
});
|
|
195
|
+
const sidebar = ref(false);
|
|
196
|
+
const confirm = ref();
|
|
197
|
+
function guard(title, label, action) {
|
|
198
|
+
if (edited.value.length === 0) action();
|
|
199
|
+
else confirm.value = {
|
|
200
|
+
title,
|
|
201
|
+
label,
|
|
202
|
+
action
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function confirmAction() {
|
|
206
|
+
confirm.value?.action();
|
|
207
|
+
confirm.value = void 0;
|
|
208
|
+
}
|
|
209
|
+
async function load(next, files = filesOf(next)) {
|
|
210
|
+
if (!run.keeps(next)) return emit("remount", next);
|
|
211
|
+
current.value = next;
|
|
212
|
+
selected.value = firstFile(next, files);
|
|
213
|
+
emit("change", next);
|
|
214
|
+
await run.open(next, files);
|
|
215
|
+
}
|
|
216
|
+
function pick(id) {
|
|
217
|
+
const next = config.examples.find((item) => item.id === id);
|
|
218
|
+
if (!next || next.id === example.value.id && edited.value.length === 0) return;
|
|
219
|
+
guard(`Open the ${next.label} example?`, "Replace files", () => void load(next));
|
|
220
|
+
}
|
|
221
|
+
watch(() => config.example, (id) => {
|
|
222
|
+
if (id !== void 0 && id !== example.value.id) pick(id);
|
|
223
|
+
});
|
|
224
|
+
watch(() => props.shared, (link) => {
|
|
225
|
+
if (link) guard(`Open the shared files${config.examples.length > 1 ? ` on the ${link.example.label} example` : ""}?`, "Replace files", () => emit("restore", link));
|
|
226
|
+
});
|
|
227
|
+
function reset() {
|
|
228
|
+
guard(config.examples.length > 1 ? `Discard your changes to the ${example.value.label} example?` : "Discard your changes?", "Discard changes", () => void load(example.value, config.reset?.(run.files.value, example.value)));
|
|
229
|
+
}
|
|
230
|
+
const { copy, copied } = useCopy();
|
|
231
|
+
const problem = ref();
|
|
232
|
+
async function copyLink(button) {
|
|
233
|
+
problem.value = void 0;
|
|
234
|
+
const code = await encodePlaygroundLink({
|
|
235
|
+
template: example.value.id,
|
|
236
|
+
files: run.files.value
|
|
237
|
+
}, filesOf(example.value));
|
|
238
|
+
const url = `${location.origin}${playgroundUrl(location.pathname, code)}`;
|
|
239
|
+
if (url.length > 16e3) {
|
|
240
|
+
problem.value = `This link would have ${(url.length / 1e3).toFixed(1)} KB, and a share link can have ${playgroundLinkLimit / 1e3} KB. Download the files instead.`;
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (!await copy(url)) problem.value = "The browser blocked the clipboard. Download the files instead.";
|
|
244
|
+
else if (button instanceof HTMLElement) ring(button);
|
|
245
|
+
}
|
|
246
|
+
const download = () => downloadZip(run.files.value, zipName(config.name ?? "", example.value));
|
|
247
|
+
const setFile = (path, contents) => run.setFiles({ [path]: contents });
|
|
248
|
+
const show = (path) => {
|
|
249
|
+
selected.value = path;
|
|
250
|
+
};
|
|
251
|
+
const context = {
|
|
252
|
+
edited,
|
|
253
|
+
example,
|
|
254
|
+
files: run.files,
|
|
255
|
+
guard,
|
|
256
|
+
run,
|
|
257
|
+
runner: config.runner,
|
|
258
|
+
setFile,
|
|
259
|
+
show,
|
|
260
|
+
showTab
|
|
261
|
+
};
|
|
262
|
+
provide(contextKey, context);
|
|
263
|
+
provideWorkspaceFileOpener({ show });
|
|
264
|
+
const slotProps = reactive({
|
|
265
|
+
...context,
|
|
266
|
+
run: markRaw(run),
|
|
267
|
+
runner: markRaw(config.runner)
|
|
268
|
+
});
|
|
269
|
+
const source = computed({
|
|
270
|
+
get: () => run.files.value[selected.value] ?? "",
|
|
271
|
+
set: (value) => void setFile(selected.value, value).catch(() => {})
|
|
272
|
+
});
|
|
273
|
+
const locked = computed(() => example.value.readonly?.includes(selected.value) ?? false);
|
|
274
|
+
const layout = computed(() => {
|
|
275
|
+
if (config.steps.length) return `guide-${config.guide ?? "top"}`;
|
|
276
|
+
return config.guide ? `guide-${config.guide}` : "side";
|
|
277
|
+
});
|
|
278
|
+
const tabItems = computed(() => [...run.tabs.value, ...config.tabs]);
|
|
279
|
+
function bar() {
|
|
280
|
+
const state = run.state?.value;
|
|
281
|
+
const actions = run.actions?.value ?? [];
|
|
282
|
+
const hasSidebar = !!slots.sidebar;
|
|
283
|
+
const examples = config.steps.length ? () => h(WorkspaceSteps, {
|
|
284
|
+
step: props.step,
|
|
285
|
+
steps: config.steps,
|
|
286
|
+
"onUpdate:step": (step) => emit("update:step", step)
|
|
287
|
+
}) : config.examples.length > 1 ? () => h(WorkspaceExamples, {
|
|
288
|
+
examples: config.examples,
|
|
289
|
+
modelValue: example.value.id,
|
|
290
|
+
"onUpdate:modelValue": pick
|
|
291
|
+
}) : void 0;
|
|
292
|
+
return [h(WorkspaceBar, {
|
|
293
|
+
sidebar: hasSidebar ? sidebar.value : void 0,
|
|
294
|
+
sidebarId: hasSidebar ? "vh-workspace-sidebar" : void 0,
|
|
295
|
+
"onUpdate:sidebar": (open) => {
|
|
296
|
+
sidebar.value = open;
|
|
297
|
+
}
|
|
298
|
+
}, {
|
|
299
|
+
lead: slots["bar-lead"] && (() => slots["bar-lead"]?.(slotProps) ?? []),
|
|
300
|
+
examples,
|
|
301
|
+
default: state ? () => [h("span", {
|
|
302
|
+
class: "vh-workspace-run-state",
|
|
303
|
+
role: "status"
|
|
304
|
+
}, h(Status, {
|
|
305
|
+
colored: state.tone === "error",
|
|
306
|
+
label: state.label,
|
|
307
|
+
pulse: state.tone === "busy",
|
|
308
|
+
tone: statusTones[state.tone]
|
|
309
|
+
}))] : void 0,
|
|
310
|
+
actions: () => [
|
|
311
|
+
slots["bar-actions"]?.(slotProps),
|
|
312
|
+
hasSidebar ? void 0 : h(UButton, {
|
|
313
|
+
color: "neutral",
|
|
314
|
+
disabled: edited.value.length === 0,
|
|
315
|
+
icon: "i-lucide-rotate-ccw",
|
|
316
|
+
label: "Reset",
|
|
317
|
+
variant: "ghost",
|
|
318
|
+
onClick: reset
|
|
319
|
+
}),
|
|
320
|
+
...config.share && !hasSidebar ? [h(UButton, {
|
|
321
|
+
color: "neutral",
|
|
322
|
+
icon: "i-lucide-download",
|
|
323
|
+
label: "Download",
|
|
324
|
+
variant: "ghost",
|
|
325
|
+
onClick: download
|
|
326
|
+
}), h(UButton, {
|
|
327
|
+
color: "neutral",
|
|
328
|
+
icon: copied.value ? "i-lucide-check" : "i-lucide-link",
|
|
329
|
+
label: copied.value ? "Link copied" : "Copy link",
|
|
330
|
+
variant: "outline",
|
|
331
|
+
onClick: (event) => void copyLink(event.currentTarget)
|
|
332
|
+
})] : [],
|
|
333
|
+
actions.length ? h(UDropdownMenu, {
|
|
334
|
+
content: { align: "end" },
|
|
335
|
+
items: [actions.map((item) => ({
|
|
336
|
+
disabled: item.disabled,
|
|
337
|
+
icon: item.icon,
|
|
338
|
+
label: item.label,
|
|
339
|
+
onSelect: item.onSelect
|
|
340
|
+
}))]
|
|
341
|
+
}, () => h(UButton, {
|
|
342
|
+
"aria-label": "More actions",
|
|
343
|
+
color: "neutral",
|
|
344
|
+
icon: "i-lucide-ellipsis",
|
|
345
|
+
variant: "ghost"
|
|
346
|
+
})) : void 0
|
|
347
|
+
]
|
|
348
|
+
}), hasSidebar ? h(WorkspaceSidebar, {
|
|
349
|
+
actions: config.share ? [
|
|
350
|
+
"reset",
|
|
351
|
+
"download",
|
|
352
|
+
"copy-link"
|
|
353
|
+
] : ["reset"],
|
|
354
|
+
copied: copied.value,
|
|
355
|
+
id: "vh-workspace-sidebar",
|
|
356
|
+
open: sidebar.value,
|
|
357
|
+
"onUpdate:open": (open) => {
|
|
358
|
+
sidebar.value = open;
|
|
359
|
+
},
|
|
360
|
+
onReset: reset,
|
|
361
|
+
onDownload: download,
|
|
362
|
+
"onCopy-link": () => void copyLink()
|
|
363
|
+
}, () => slots.sidebar?.(slotProps)) : void 0];
|
|
364
|
+
}
|
|
365
|
+
return () => {
|
|
366
|
+
const notice = problem.value ?? props.notice;
|
|
367
|
+
const shellSlots = {
|
|
368
|
+
bar,
|
|
369
|
+
banner: notice || slots.banner ? () => [notice ? h("div", {
|
|
370
|
+
class: "vh-workspace-notice",
|
|
371
|
+
role: "status"
|
|
372
|
+
}, notice) : void 0, ...slots.banner?.(slotProps) ?? []] : void 0,
|
|
373
|
+
files: () => [h("div", { class: "vh-ws-head" }, h("span", { class: "vh-ws-muted" }, "Files")), h(WorkspaceFileTree, {
|
|
374
|
+
edited: edited.value,
|
|
375
|
+
paths: paths.value,
|
|
376
|
+
selected: selected.value,
|
|
377
|
+
"onUpdate:selected": show
|
|
378
|
+
})],
|
|
379
|
+
"editor-head": () => h(WorkspaceEditorHead, {
|
|
380
|
+
path: selected.value,
|
|
381
|
+
readonly: locked.value,
|
|
382
|
+
wrap: wrap.value,
|
|
383
|
+
"onUpdate:wrap": (next) => {
|
|
384
|
+
wrap.value = next;
|
|
385
|
+
}
|
|
386
|
+
}),
|
|
387
|
+
editor: () => h(WorkspaceEditor, {
|
|
388
|
+
modelValue: source.value,
|
|
389
|
+
path: selected.value,
|
|
390
|
+
readonly: locked.value,
|
|
391
|
+
wrap: wrap.value,
|
|
392
|
+
onCursor: (next) => {
|
|
393
|
+
cursor.value = next;
|
|
394
|
+
},
|
|
395
|
+
"onUpdate:modelValue": (value) => {
|
|
396
|
+
source.value = value;
|
|
397
|
+
},
|
|
398
|
+
"onUpdate:wrap": (next) => {
|
|
399
|
+
wrap.value = next;
|
|
400
|
+
}
|
|
401
|
+
}),
|
|
402
|
+
status: () => h(WorkspaceStatus, {
|
|
403
|
+
cursor: cursor.value,
|
|
404
|
+
path: selected.value
|
|
405
|
+
}),
|
|
406
|
+
guide: config.steps.length ? () => h(WorkspaceGuide, {
|
|
407
|
+
step: props.step,
|
|
408
|
+
steps: config.steps,
|
|
409
|
+
"onUpdate:step": (step) => emit("update:step", step)
|
|
410
|
+
}, { default: () => slots.guide?.(slotProps) }) : slots.guide && (() => slots.guide?.(slotProps)),
|
|
411
|
+
...Object.fromEntries(run.tabs.value.map((item) => [`tab-${item.value}`, () => run.panel(item.value)])),
|
|
412
|
+
...Object.fromEntries(config.tabs.map((item) => [`tab-${item.value}`, () => slots[item.value]?.(slotProps)]))
|
|
413
|
+
};
|
|
414
|
+
return h("div", { class: "vh-workspace-session" }, [h(WorkspaceShell, {
|
|
415
|
+
label: capitalize(config.label ?? "workspace"),
|
|
416
|
+
layout: layout.value,
|
|
417
|
+
storageKey: `vitehub:workspace:${config.label}:${layout.value}`,
|
|
418
|
+
tab: tab.value,
|
|
419
|
+
tabs: tabItems.value,
|
|
420
|
+
"onUpdate:tab": showTab
|
|
421
|
+
}, shellSlots), h(UModal, {
|
|
422
|
+
description: config.share ? "Your edits to the current files are lost. Copy a link or download them first to keep them." : "Your edits to the current files are lost.",
|
|
423
|
+
open: !!confirm.value,
|
|
424
|
+
title: confirm.value?.title,
|
|
425
|
+
"onUpdate:open": (open) => {
|
|
426
|
+
if (!open) confirm.value = void 0;
|
|
427
|
+
}
|
|
428
|
+
}, { footer: () => h("div", { class: "vh-workspace-modal-actions" }, [h(UButton, {
|
|
429
|
+
color: "neutral",
|
|
430
|
+
label: "Cancel",
|
|
431
|
+
variant: "ghost",
|
|
432
|
+
onClick: () => {
|
|
433
|
+
confirm.value = void 0;
|
|
434
|
+
}
|
|
435
|
+
}), h(UButton, {
|
|
436
|
+
color: "neutral",
|
|
437
|
+
label: confirm.value?.label,
|
|
438
|
+
onClick: confirmAction
|
|
439
|
+
})]) })]);
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
/**
|
|
444
|
+
* A complete workspace: the bar, the file tree, the editor, the output, and with `steps` the guide of a lesson. The
|
|
445
|
+
* runner runs the files: `webContainer()` runs an app in the browser, and `render()` renders the files to a page. It
|
|
446
|
+
* tracks edits, asks before it discards them, copies share links, and downloads zips.
|
|
447
|
+
*/
|
|
448
|
+
const Workspace = defineComponent({
|
|
449
|
+
name: "Workspace",
|
|
450
|
+
props: workspaceProps,
|
|
451
|
+
emits: {
|
|
452
|
+
"update:example": (id) => typeof id === "string",
|
|
453
|
+
"update:selected": (path) => typeof path === "string",
|
|
454
|
+
"update:step": (step) => Number.isInteger(step),
|
|
455
|
+
"update:open": (open) => typeof open === "boolean"
|
|
456
|
+
},
|
|
457
|
+
setup(props, { emit, slots }) {
|
|
458
|
+
const UButton = useUIComponent("UButton");
|
|
459
|
+
const { device, supported } = useWorkspaceDevice(props.runner);
|
|
460
|
+
const root = ref();
|
|
461
|
+
const first = () => props.examples.find((item) => item.id === props.example) ?? props.examples[0];
|
|
462
|
+
const session = shallowRef();
|
|
463
|
+
const active = computed(() => props.examples.find((item) => item.id === session.value?.example.id) ?? session.value?.example ?? first());
|
|
464
|
+
const link = ref();
|
|
465
|
+
const starting = ref(props.start);
|
|
466
|
+
const localStep = ref(props.step ?? 0);
|
|
467
|
+
watch(() => props.step, (step) => {
|
|
468
|
+
if (step !== void 0) localStep.value = step;
|
|
469
|
+
});
|
|
470
|
+
const step = computed(() => Math.min(Math.max(0, props.steps.length - 1), Math.max(0, localStep.value)));
|
|
471
|
+
function setStep(next) {
|
|
472
|
+
localStep.value = next;
|
|
473
|
+
emit("update:step", next);
|
|
474
|
+
}
|
|
475
|
+
function boot(example, files) {
|
|
476
|
+
session.value = {
|
|
477
|
+
example,
|
|
478
|
+
files,
|
|
479
|
+
id: (session.value?.id ?? 0) + 1
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
let restoration = 0;
|
|
483
|
+
let opening = 0;
|
|
484
|
+
const shared = shallowRef();
|
|
485
|
+
async function readLink() {
|
|
486
|
+
const request = ++restoration;
|
|
487
|
+
const code = props.share ? readPlaygroundHash(location.hash) : void 0;
|
|
488
|
+
const decoded = code ? await decodePlaygroundLink(code, props.examples.map((item) => ({
|
|
489
|
+
files: filesOf(item),
|
|
490
|
+
id: item.id
|
|
491
|
+
}))) : void 0;
|
|
492
|
+
if (request !== restoration) return void 0;
|
|
493
|
+
const example = decoded?.template === void 0 ? void 0 : props.examples.find((item) => item.id === decoded.template);
|
|
494
|
+
return {
|
|
495
|
+
code,
|
|
496
|
+
link: example && decoded ? {
|
|
497
|
+
example,
|
|
498
|
+
files: decoded.files
|
|
499
|
+
} : void 0
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
function openLink(next) {
|
|
503
|
+
shared.value = void 0;
|
|
504
|
+
link.value = "restored";
|
|
505
|
+
starting.value = false;
|
|
506
|
+
boot(next.example, next.files);
|
|
507
|
+
}
|
|
508
|
+
async function restore() {
|
|
509
|
+
const read = await readLink();
|
|
510
|
+
if (!read) return;
|
|
511
|
+
if (read.link) return openLink(read.link);
|
|
512
|
+
link.value = read.code ? "invalid" : void 0;
|
|
513
|
+
boot(first());
|
|
514
|
+
}
|
|
515
|
+
async function follow() {
|
|
516
|
+
if (!readPlaygroundHash(location.hash)) return;
|
|
517
|
+
if (!session.value) return restore();
|
|
518
|
+
const before = opening;
|
|
519
|
+
const read = await readLink();
|
|
520
|
+
if (!read || before !== opening) return;
|
|
521
|
+
if (!read.link) {
|
|
522
|
+
link.value = "invalid";
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
if (shown.value && !starting.value) shared.value = { ...read.link };
|
|
526
|
+
else openLink(read.link);
|
|
527
|
+
}
|
|
528
|
+
onMounted(() => {
|
|
529
|
+
restore();
|
|
530
|
+
if (props.share) window.addEventListener("hashchange", follow);
|
|
531
|
+
});
|
|
532
|
+
onBeforeUnmount(() => window.removeEventListener("hashchange", follow));
|
|
533
|
+
function opened(example) {
|
|
534
|
+
opening++;
|
|
535
|
+
link.value = void 0;
|
|
536
|
+
emit("update:example", example.id);
|
|
537
|
+
}
|
|
538
|
+
async function startExample(id) {
|
|
539
|
+
const example = props.examples.find((item) => item.id === id);
|
|
540
|
+
if (!starting.value || !example) return;
|
|
541
|
+
starting.value = false;
|
|
542
|
+
opened(example);
|
|
543
|
+
boot(example);
|
|
544
|
+
await nextTick();
|
|
545
|
+
root.value?.querySelector(".vh-ws-topbar .vh-ws-examples-button, .vh-ws-topbar button[aria-label='More actions']")?.focus();
|
|
546
|
+
}
|
|
547
|
+
watch(() => props.example, (id) => {
|
|
548
|
+
const example = props.examples.find((item) => item.id === id);
|
|
549
|
+
if (!starting.value || !example) return;
|
|
550
|
+
starting.value = false;
|
|
551
|
+
boot(example);
|
|
552
|
+
});
|
|
553
|
+
function chooser() {
|
|
554
|
+
const text = notice();
|
|
555
|
+
return h("div", { class: "vh-workspace-session" }, [
|
|
556
|
+
h(WorkspaceBar, null, { examples: props.examples.length > 1 ? () => h(WorkspaceExamples, {
|
|
557
|
+
examples: props.examples,
|
|
558
|
+
modelValue: null,
|
|
559
|
+
"onUpdate:modelValue": startExample
|
|
560
|
+
}) : void 0 }),
|
|
561
|
+
text ? h("div", {
|
|
562
|
+
class: "vh-workspace-notice",
|
|
563
|
+
role: "status"
|
|
564
|
+
}, text) : void 0,
|
|
565
|
+
h(WorkspaceStart, {
|
|
566
|
+
examples: props.examples,
|
|
567
|
+
onPick: startExample
|
|
568
|
+
})
|
|
569
|
+
]);
|
|
570
|
+
}
|
|
571
|
+
const requested = ref(props.open);
|
|
572
|
+
watch(() => props.open, (open) => {
|
|
573
|
+
requested.value = open;
|
|
574
|
+
});
|
|
575
|
+
const shown = computed(() => {
|
|
576
|
+
if (!session.value || supported.value !== true) return false;
|
|
577
|
+
if (!props.runner.desktop) return true;
|
|
578
|
+
return device.value === "desktop" || device.value === "tablet" && requested.value;
|
|
579
|
+
});
|
|
580
|
+
watch(shown, (value) => {
|
|
581
|
+
if (value !== props.open) emit("update:open", value);
|
|
582
|
+
});
|
|
583
|
+
const { copy: copyPage, copied } = useCopy({ duration: 1500 });
|
|
584
|
+
function download() {
|
|
585
|
+
downloadZip(session.value?.files ?? filesOf(active.value), zipName(props.name, active.value));
|
|
586
|
+
}
|
|
587
|
+
const downloadButton = () => h(UButton, {
|
|
588
|
+
color: "neutral",
|
|
589
|
+
icon: "i-lucide-download",
|
|
590
|
+
label: "Download files",
|
|
591
|
+
size: "sm",
|
|
592
|
+
variant: "outline",
|
|
593
|
+
onClick: download
|
|
594
|
+
});
|
|
595
|
+
function notice() {
|
|
596
|
+
if (!link.value || !session.value) return void 0;
|
|
597
|
+
const label = session.value.example.label;
|
|
598
|
+
const many = props.examples.length > 1;
|
|
599
|
+
return link.value === "invalid" ? `This link has no files that the ${props.label} can read.${many && !starting.value ? ` It opened the ${label} example.` : ""}` : `You opened shared files${many ? ` on the ${label} example` : ""}.`;
|
|
600
|
+
}
|
|
601
|
+
function gate() {
|
|
602
|
+
if (!props.runner.desktop) return h("div", {
|
|
603
|
+
class: "vh-workspace-gate",
|
|
604
|
+
"data-state": "pending"
|
|
605
|
+
}, h("div", { class: "vh-workspace-placeholder" }, [h("div", { class: "vh-workspace-placeholder-bar" }), h("p", { class: "vh-workspace-muted" }, `Starting the ${props.label}`)]));
|
|
606
|
+
const state = device.value === "pending" ? "pending" : device.value === "phone" ? "phone" : supported.value === false ? "unsupported" : device.value === "tablet" ? "tablet" : "pending";
|
|
607
|
+
const phone = h("aside", { class: "vh-workspace-card vh-workspace-phone" }, [h("p", { class: "vh-workspace-strong" }, `The live ${props.label} runs in a desktop browser. Open this page on a desktop to edit and run the code.`), h("div", { class: "vh-workspace-actions" }, [h(UButton, {
|
|
608
|
+
color: "neutral",
|
|
609
|
+
icon: copied.value ? "i-lucide-check" : "i-lucide-link",
|
|
610
|
+
label: copied.value ? "Copied" : "Copy link",
|
|
611
|
+
size: "sm",
|
|
612
|
+
variant: "outline",
|
|
613
|
+
onClick: (event) => {
|
|
614
|
+
const button = event.currentTarget;
|
|
615
|
+
copyPage(location.href).then((ok) => ok && button instanceof HTMLElement && ring(button));
|
|
616
|
+
}
|
|
617
|
+
}), downloadButton()])]);
|
|
618
|
+
const card = state === "pending" || state === "phone" ? phone : state === "unsupported" ? h("div", { class: "vh-workspace-unsupported" }, [h(BrowserSupportNotice, {
|
|
619
|
+
description: "Download the files to run the app on your machine, or open this page in Chrome, Edge, or Firefox on a desktop to edit and run it here.",
|
|
620
|
+
supported: false
|
|
621
|
+
}), h("div", { class: "vh-workspace-actions" }, [downloadButton()])]) : h("div", { class: "vh-workspace-card" }, [h("p", { class: "vh-workspace-muted" }, "Edit and run the code in your browser. The first start downloads the dependencies of the app."), h("div", { class: "vh-workspace-actions" }, [h(UButton, {
|
|
622
|
+
color: "neutral",
|
|
623
|
+
icon: "i-lucide-play",
|
|
624
|
+
label: `Open ${props.label}`,
|
|
625
|
+
onClick: () => {
|
|
626
|
+
requested.value = true;
|
|
627
|
+
}
|
|
628
|
+
})])]);
|
|
629
|
+
return h("div", {
|
|
630
|
+
class: "vh-workspace-gate",
|
|
631
|
+
"data-state": state
|
|
632
|
+
}, [state === "pending" ? h("div", { class: "vh-workspace-placeholder" }, [h("div", { class: "vh-workspace-placeholder-bar" }), h("p", { class: "vh-workspace-muted" }, `Starting the ${props.label}`)]) : void 0, h("div", { class: "vh-workspace-gate-content" }, [
|
|
633
|
+
slots.intro?.(),
|
|
634
|
+
card,
|
|
635
|
+
slots.fallback?.()
|
|
636
|
+
])]);
|
|
637
|
+
}
|
|
638
|
+
return () => {
|
|
639
|
+
const current = session.value;
|
|
640
|
+
return h("div", {
|
|
641
|
+
class: "vh-workspace",
|
|
642
|
+
"data-runner": props.runner.desktop ? "desktop" : "any",
|
|
643
|
+
ref: root
|
|
644
|
+
}, [!shown.value || !current ? gate() : starting.value ? chooser() : h(WorkspaceSession, {
|
|
645
|
+
key: current.id,
|
|
646
|
+
booted: active.value,
|
|
647
|
+
config: props,
|
|
648
|
+
files: current.files ?? filesOf(active.value),
|
|
649
|
+
notice: notice(),
|
|
650
|
+
shared: shared.value,
|
|
651
|
+
step: step.value,
|
|
652
|
+
onChange: opened,
|
|
653
|
+
onRestore: openLink,
|
|
654
|
+
onRemount: (example) => {
|
|
655
|
+
opened(example);
|
|
656
|
+
boot(example);
|
|
657
|
+
},
|
|
658
|
+
"onUpdate:selected": (path) => emit("update:selected", path),
|
|
659
|
+
"onUpdate:step": setStep
|
|
660
|
+
}, slots)]);
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
//#endregion
|
|
665
|
+
export { Workspace, useWorkspace, useWorkspaceDevice };
|