@vite-hub/ui 0.6.1 → 0.7.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 +105 -45
- package/dist/AttachmentTitle-BWw0ck0T.js +110 -0
- package/dist/BubbleContent-B1a4e3vE.js +45 -0
- package/dist/Chat-BZxkf3Tt.js +112 -0
- package/dist/ChatMessage-Blr5F-zi.js +94 -0
- package/dist/CodeBlockContent-BjXJm8lO.js +92 -0
- package/dist/CodeBlockTitle-DYrYpc1U.js +99 -0
- package/dist/CommentRow-ViZ7r8nr.js +86 -0
- package/dist/CopyButton-Dtg_Oc9_.js +115 -0
- package/dist/Markdown-_w7feFzl.js +70 -0
- package/dist/MarkdownCodeBlock-B4j7x0H6.js +127 -0
- package/dist/MarkdownImage-CJN3myt4.js +111 -0
- package/dist/MessageHeader-CJ9eBHSS.js +61 -0
- package/dist/MessageParts-FVyYZNsn.js +57 -0
- package/dist/MessageScrollerViewport-BaTlWLki.js +142 -0
- package/dist/MorphText-CYTndbyp.js +36 -0
- package/dist/RollNumber-Bo2tzfAp.js +49 -0
- package/dist/TraceTitle-Cp0y7RRD.js +133 -0
- package/dist/agent-session-BwZSMi4S.d.ts +312 -0
- package/dist/agent-session-DhlTKCQG.js +875 -0
- package/dist/{announce-B0DLwflT.js → announce-CJNXaYbT.js} +1 -3
- package/dist/appendItems-hQ4aBd9Q.js +4047 -0
- package/dist/attachment-BllgHx9Q.d.ts +124 -0
- package/dist/attachment-DQMJNfj0.js +35 -0
- package/dist/avatar-stack-Bj1xUkzY.d.ts +4 -0
- package/dist/avatar-stack-nQErr0qn.js +72 -0
- package/dist/bubble-D3M2_InY.js +32 -0
- package/dist/bubble-DmplVxLr.d.ts +64 -0
- package/dist/chat-DWdyMSuj.d.ts +13 -0
- package/dist/chat-message-QLHnX_ED.d.ts +11 -0
- package/dist/chat-session-BOj5L3Ey.d.ts +29 -0
- package/dist/chat-session-hjZRL6jY.js +43 -0
- package/dist/choices-input-DqgXl5a-.d.ts +97 -0
- package/dist/{vue-d2Td6uu2.js → client-BG-oCUtv-5i4sRwXP.js} +4156 -4156
- package/dist/code-block-Bp8y-XJp.d.ts +182 -0
- package/dist/code-block-CMERLfew.js +14 -0
- package/dist/code-view-26RY6dX8.js +137 -0
- package/dist/code-view-D8yYdFUc.d.ts +184 -0
- package/dist/{comment-composer-X7vJKh5b.js → comment-composer-BUt6vbnr.js} +175 -37
- package/dist/{comment-composer-DmDM3XYP.d.ts → comment-composer-CIsbz-78.d.ts} +7 -7
- package/dist/{comment-layer-KnnVfdRV.d.ts → comment-layer-BlVNORgj.d.ts} +17 -8
- package/dist/comment-layer-Ck2H24oJ.js +1206 -0
- package/dist/{comment-panel-DoLDOw3E.d.ts → comment-panel-Djx-KxVa.d.ts} +28 -21
- package/dist/comment-selection-bar-CbOEI98x.d.ts +33 -0
- package/dist/comment-selection-bar-CxPkJxVl.js +145 -0
- package/dist/comment-send.css +2 -2
- package/dist/{comment-thread-jqPx6aJ8.js → comment-thread-C_Q4UDaV.js} +74 -49
- package/dist/{comment-thread-DPV2kqA4.d.ts → comment-thread-X6gYMNay.d.ts} +11 -10
- package/dist/comments-B1itauwb.d.ts +52 -0
- package/dist/{comments-9MDSNm-9.js → comments-BaSrroRV.js} +32 -4
- package/dist/comments-BtD28xEn.js +390 -0
- package/dist/{comments-OWjNidkP.d.ts → comments-ZfV6IZs8.d.ts} +9 -2
- package/dist/components-CM5mZe0a.js +269 -0
- package/dist/{config-LRonN53j.js → config-CFwvNt4Y.js} +11 -30
- package/dist/{config-COSdO-ay.d.ts → config-JmsTI7gs.d.ts} +20 -33
- package/dist/connection-status-BVSH2ZVo.js +72 -0
- package/dist/connection-status-g62BTn44.d.ts +37 -0
- package/dist/copy-button-CRiXUFsl.d.ts +17 -0
- package/dist/device-frame-BW6IjB6P.d.ts +78 -0
- package/dist/device-frame-DDWoyB-G.js +515 -0
- package/dist/diffs-BTKaVnsb.d.ts +272 -0
- package/dist/diffs.d.ts +3 -0
- package/dist/{pierre-code-view-C49BVDrc.js → diffs.js} +147 -4223
- package/dist/drop-field-C0bXv1J-.d.ts +35 -0
- package/dist/drop-field-DKpYQ3tO.js +77 -0
- package/dist/editor-BsOTjnnN.d.ts +540 -0
- package/dist/{markdown-editor-D1irG9Xl.js → editor-DJPUs1nt.js} +833 -106
- package/dist/editor.d.ts +2 -0
- package/dist/editor.js +3 -0
- package/dist/element-BpjNQvZ0.js +6 -0
- package/dist/{file-tree-CRFIdtzw.js → file-tree-B4JKbp4r.js} +19 -18
- package/dist/{file-tree-DOtkeBaq.d.ts → file-tree-BdnKA6UA.d.ts} +33 -8
- package/dist/file-tree-DDSIafDn.d.ts +22 -0
- package/dist/file-tree-DS5shGSL.js +46 -0
- package/dist/file-tree.d.ts +2 -0
- package/dist/file-tree.js +1 -0
- package/dist/files-cuVXzWlx.js +30 -0
- package/dist/filter-search-C9e6sGij.d.ts +28 -0
- package/dist/filter-search-COZsoRiR.js +73 -0
- package/dist/formatCSSVariablePrefix-DLS1Ed1_.js +5 -0
- package/dist/headless-2IcUWHMq.d.ts +51 -0
- package/dist/headless.d.ts +7 -4
- package/dist/headless.js +5 -3
- package/dist/highlight.d.ts +2 -0
- package/dist/highlight.js +1 -0
- package/dist/{highlights-C2AbEdDI.js → highlights-8Al0-h-v.js} +3 -2
- package/dist/{hold-to-delete-BSMrpE-i.d.ts → hold-to-delete-CQc1JaG_.d.ts} +7 -0
- package/dist/{hold-to-delete-Cludb56v.js → hold-to-delete-CcQbfiQx.js} +111 -20
- package/dist/hold-to-delete-cOPqQ9FJ.js +85 -0
- package/dist/hold-to-delete-ksBE7wxc.d.ts +58 -0
- package/dist/index-9Z6Gwtnf.d.ts +77 -0
- package/dist/{index-B2cbt3py.d.ts → index-D3-uYBqH.d.ts} +1 -1
- package/dist/index.d.ts +165 -52
- package/dist/index.js +127 -671
- package/dist/markdown-BLALLOc0.d.ts +45 -0
- package/dist/{markdown-renderer-DMyYKeil.js → markdown-DDyOdYq_.js} +125 -127
- package/dist/{parts/components/markdown-renderer.d.ts → markdown-DkDxdpMU.d.ts} +10 -7
- package/dist/markdown-editor.d.ts +51 -98
- package/dist/markdown-editor.js +70 -3
- package/dist/markdown.d.ts +2 -0
- package/dist/markdown.js +1 -0
- package/dist/marker-CvcWZ3Zp.d.ts +59 -0
- package/dist/marker-DNL6QR3L.js +63 -0
- package/dist/message-BwivYIEl.js +13 -0
- package/dist/message-DEq4K5cQ.d.ts +72 -0
- package/dist/message-parts-B1BZFVKe.d.ts +3 -0
- package/dist/message-parts-CG3gNWn8.d.ts +11 -0
- package/dist/message-parts.d.ts +2 -0
- package/dist/message-parts.js +1 -0
- package/dist/message-scroller-D7AvM31v.d.ts +41 -0
- package/dist/motion/core.d.ts +4 -4
- package/dist/motion/core.js +5 -11
- package/dist/motion-BH6ShUam.d.ts +12 -0
- package/dist/{effects-C1zYpSpg.js → motion-core-BdTfxAhY.js} +1779 -55
- package/dist/{motion-core-Dh20n5Se.d.ts → motion-core-BfIefToe.d.ts} +30 -73
- package/dist/motion-dPwxx3Wk.js +76 -0
- package/dist/{install-C4LwcJda.js → motion-itHFtXwA.js} +1 -1
- package/dist/motion-list-BBbz93WT.js +49 -0
- package/dist/motion.d.ts +5 -14
- package/dist/motion.js +6 -13
- package/dist/nuxt-ui-CPdiTwwD.js +22 -0
- package/dist/nuxt.d.ts +9 -5
- package/dist/nuxt.js +28 -32
- package/dist/parts/components/agent-session.d.ts +2 -295
- package/dist/parts/components/agent-session.js +1 -659
- package/dist/parts/components/attachment.d.ts +2 -85
- package/dist/parts/components/attachment.js +3 -72
- package/dist/parts/components/avatar-stack.d.ts +3 -2
- package/dist/parts/components/avatar-stack.js +1 -60
- package/dist/parts/components/bubble.d.ts +2 -69
- package/dist/parts/components/bubble.js +3 -52
- package/dist/parts/components/chat-message.d.ts +3 -25
- package/dist/parts/components/chat-message.js +1 -50
- package/dist/parts/components/chat-session.d.ts +2 -26
- package/dist/parts/components/chat-session.js +1 -37
- package/dist/parts/components/chat.d.ts +3 -52
- package/dist/parts/components/chat.js +1 -105
- package/dist/parts/components/code-block.d.ts +2 -102
- package/dist/parts/components/code-block.js +4 -109
- package/dist/parts/components/code-view.d.ts +3 -268
- 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 +1 -634
- package/dist/parts/components/comment-panel.d.ts +2 -2
- package/dist/parts/components/comment-panel.js +22 -16
- package/dist/parts/components/comment-selection-bar.d.ts +2 -2
- package/dist/parts/components/comment-selection-bar.js +1 -116
- package/dist/parts/components/comment-thread.d.ts +1 -1
- package/dist/parts/components/comment-thread.js +1 -3
- package/dist/parts/components/comments.d.ts +8 -9
- package/dist/parts/components/comments.js +6 -9
- package/dist/parts/components/connection-status.d.ts +2 -36
- package/dist/parts/components/connection-status.js +1 -64
- package/dist/parts/components/copy-button.d.ts +3 -126
- package/dist/parts/components/copy-button.js +3 -226
- package/dist/parts/components/device-frame.d.ts +2 -128
- package/dist/parts/components/device-frame.js +1 -470
- package/dist/parts/components/drop-field.d.ts +2 -67
- package/dist/parts/components/drop-field.js +1 -76
- package/dist/parts/components/file-tree.d.ts +3 -2
- package/dist/parts/components/file-tree.js +3 -1
- package/dist/parts/components/filter-search.d.ts +2 -45
- package/dist/parts/components/filter-search.js +1 -57
- package/dist/parts/components/hold-to-delete.d.ts +2 -80
- package/dist/parts/components/hold-to-delete.js +1 -75
- package/dist/parts/components/markdown.d.ts +3 -45
- package/dist/parts/components/markdown.js +1 -46
- package/dist/parts/components/marker.d.ts +2 -32
- package/dist/parts/components/marker.js +1 -22
- package/dist/parts/components/message-parts.d.ts +3 -25
- package/dist/parts/components/message-parts.js +1 -45
- package/dist/parts/components/message.d.ts +2 -32
- package/dist/parts/components/message.js +3 -22
- package/dist/parts/components/motion-list.d.ts +2 -40
- package/dist/parts/components/motion-list.js +1 -41
- package/dist/parts/components/motion.d.ts +5 -118
- package/dist/parts/components/motion.js +4 -171
- package/dist/parts/components/patch-parsers.d.ts +1 -1
- package/dist/parts/components/progress.d.ts +2 -39
- package/dist/parts/components/progress.js +1 -53
- package/dist/parts/components/prompt-input.d.ts +2 -134
- package/dist/parts/components/prompt-input.js +1 -253
- package/dist/parts/components/relative-time.d.ts +2 -71
- package/dist/parts/components/relative-time.js +1 -1
- package/dist/parts/components/status.d.ts +2 -58
- package/dist/parts/components/status.js +1 -47
- package/dist/parts/components/sync-status.d.ts +2 -22
- package/dist/parts/components/sync-status.js +1 -48
- package/dist/parts/components/tool-list.d.ts +2 -28
- package/dist/parts/components/tool-list.js +1 -118
- package/dist/parts/components/trace-run.d.ts +2 -25
- package/dist/parts/components/trace-run.js +1 -89
- package/dist/parts/components/trace.d.ts +2 -59
- package/dist/parts/components/trace.js +1 -76
- package/dist/parts/composables/attachments.js +75 -1
- package/dist/parts/headless/choices-input.d.ts +2 -2
- package/dist/parts/headless/choices-input.js +49 -37
- package/dist/parts/headless/comments.d.ts +1 -1
- package/dist/parts/headless/comments.js +1 -1
- package/dist/parts/headless/message-scroller.d.ts +2 -2
- package/dist/parts/headless/message-scroller.js +211 -309
- package/dist/parts/headless/relative-time.d.ts +2 -0
- package/dist/parts/headless/relative-time.js +1 -0
- package/dist/parts/workspace/browser-support-notice.js +6 -5
- package/dist/parts/workspace/connect-panel.js +1 -1
- package/dist/parts/workspace/runners/web-container.js +2 -2
- package/dist/parts/workspace/workspace-bar.d.ts +1 -1
- package/dist/parts/workspace/workspace-bar.js +1 -1
- package/dist/parts/workspace/workspace-boot-status.d.ts +1 -1
- package/dist/parts/workspace/workspace-boot-status.js +1 -206
- package/dist/parts/workspace/workspace-editor-head.d.ts +1 -1
- package/dist/parts/workspace/workspace-editor-head.js +1 -1
- package/dist/parts/workspace/workspace-editor.d.ts +2 -2
- package/dist/parts/workspace/workspace-examples.js +1 -1
- package/dist/parts/workspace/workspace-file-tree.d.ts +1 -1
- package/dist/parts/workspace/workspace-file-tree.js +3 -2
- package/dist/parts/workspace/workspace-guide.js +1 -1
- package/dist/parts/workspace/workspace-preview.d.ts +1 -1
- package/dist/parts/workspace/workspace-preview.js +14 -12
- package/dist/parts/workspace/workspace-shell.d.ts +1 -1
- package/dist/parts/workspace/workspace-shell.js +11 -11
- package/dist/parts/workspace/workspace-sidebar.d.ts +2 -2
- package/dist/parts/workspace/workspace-sidebar.js +2 -2
- package/dist/parts/workspace/workspace-start.js +1 -1
- package/dist/parts/workspace/workspace-steps.js +1 -1
- package/dist/parts/workspace/workspace.d.ts +3 -3
- package/dist/parts/workspace/workspace.js +5 -5
- package/dist/press-BuEC-XvZ.d.ts +83 -0
- package/dist/progress-Ch0fA-bf.d.ts +8 -0
- package/dist/progress-D_9sG648.js +47 -0
- package/dist/prompt-input-CRXEJBAK.js +412 -0
- package/dist/prompt-input-j4OFTF5p.d.ts +116 -0
- package/dist/relative-time-BnJfjeEm.js +131 -0
- package/dist/relative-time-BuP-Gvzn.d.ts +43 -0
- package/dist/{relative-time-DJnw45tr.js → relative-time-Dz2DR4eb.js} +64 -114
- package/dist/relative-time-grHFu1kY.d.ts +11 -0
- package/dist/{ring-GaJsg32c.js → ring-DoL9jivj.js} +1 -2
- package/dist/runtime/nuxt-plugin.js +2 -5
- package/dist/{shiki-CbfEu_Az.js → shiki-CxzM_xNo.js} +3 -2
- package/dist/stand-ins-CuKM1UH1.js +339 -0
- package/dist/status-B2Yhrwv8.js +67 -0
- package/dist/status-ySiRa-8O.d.ts +38 -0
- package/dist/{stream-tokenizer-ByC3l0HQ.js → stream-tokenizer-BsjV6wxW.js} +1 -1
- package/dist/styles.css +4343 -3403
- package/dist/sync-status-BRroyOre.js +59 -0
- package/dist/sync-status-D4KdGO6y.d.ts +35 -0
- package/dist/theme.css +3 -0
- package/dist/theme.d.ts +14 -0
- package/dist/theme.js +19 -8
- package/dist/{themes-DKugPHlg.js → themes-B0_ioVT0.js} +1 -1
- package/dist/tool-list-DDaCqpR6.js +209 -0
- package/dist/tool-list-DMRPM0Yi.d.ts +50 -0
- package/dist/trace-KCBvOsw_.d.ts +113 -0
- package/dist/trace-run-Dk962P5a.d.ts +49 -0
- package/dist/trace-run-nh6FIsl6.js +202 -0
- package/dist/{opt-out-D66l60sg.js → tween-lVMRCUEv.js} +60 -1
- package/dist/types-BF_U0tgp.d.ts +74 -0
- package/dist/types-CTk3aNb5.d.ts +15 -0
- package/dist/types-D0a3i4Fw.d.ts +21 -0
- package/dist/types-DTecvcsZ.d.ts +35 -0
- package/dist/types-D_BWab7g.d.ts +75 -0
- package/dist/types-RHaQ4gj1.d.ts +27 -0
- package/dist/ui-components-CKQAPI-W.js +7 -0
- package/dist/unwrapDefault-CExq-4rm.js +5 -0
- package/dist/use-copy-DK1SSZkh.js +66 -0
- package/dist/utils-hi9-xROt.js +37 -0
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +8 -14
- package/dist/{vue-vUGpdMct.js → vue-DdYvDVOr.js} +1 -1
- package/dist/workspace-boot-status-CyGlJS06.js +216 -0
- package/dist/{workspace-shell-ChCwWPyv.d.ts → workspace-shell-B4A7CINd.d.ts} +1 -1
- package/dist/workspace.d.ts +1 -1
- package/dist/workspace.js +1 -2
- package/package.json +48 -14
- package/dist/attachments-DgwoQZKY.js +0 -88
- package/dist/avatar-stack-C0IKwj6g.d.ts +0 -57
- package/dist/choices-input-BUf-QqGj.d.ts +0 -92
- package/dist/code-view-Cg4nyTNA.js +0 -172
- package/dist/comment-attachments-DAzUbRmJ.js +0 -23
- package/dist/comment-list-ncwaCSVX.d.ts +0 -60
- package/dist/comment-person-D_IyIjXo.js +0 -39
- package/dist/comment-pin-hBJFiSYW.d.ts +0 -66
- package/dist/comment-row-DPMWI5Z0.js +0 -38
- package/dist/comment-selection-bar-CVuS-FNL.d.ts +0 -40
- package/dist/comment-send-CUkL3TbZ.js +0 -275
- package/dist/comment-send-MmxFsOQf.d.ts +0 -23
- package/dist/comment-status-nsCdrRk_.js +0 -20
- package/dist/drop-field-CNZgwFVO.js +0 -162
- package/dist/editor-Dmk3k6f6.js +0 -620
- package/dist/format-CPipR1FP.js +0 -19
- package/dist/handlers-CnbkvXjX.js +0 -181
- package/dist/icon-XZaCUZTG.d.ts +0 -29
- package/dist/image-preview-BKVUtfwQ.js +0 -104
- package/dist/index-B_PSX-5h.d.ts +0 -69
- package/dist/list-DUTAo0uC.js +0 -270
- package/dist/markdown-editor-B7gD60tp.d.ts +0 -189
- package/dist/message-scroller-BZqS63IX.d.ts +0 -173
- package/dist/nuxt-ui-7ByUrymx.js +0 -43
- package/dist/parts/components/comment-list.d.ts +0 -2
- package/dist/parts/components/comment-list.js +0 -173
- package/dist/parts/components/comment-pin.d.ts +0 -2
- package/dist/parts/components/comment-pin.js +0 -74
- package/dist/parts/components/comment-send.d.ts +0 -2
- package/dist/parts/components/comment-send.js +0 -1
- package/dist/parts/components/markdown-editor.d.ts +0 -2
- package/dist/parts/components/markdown-editor.js +0 -1
- package/dist/parts/components/markdown-renderer.js +0 -1
- package/dist/payload-text-DQNRbJY5.js +0 -31
- package/dist/progress-DL9k-ERG.js +0 -265
- package/dist/registry-DAIjCjWd.js +0 -77
- package/dist/slot-part-BWHvQ3mK.js +0 -25
- package/dist/text-gacox6bp.js +0 -822
- package/dist/travel-BliEidau.js +0 -180
- package/dist/tween-Dv3IIIQG.js +0 -61
- package/dist/types-Ceh7h7NT.d.ts +0 -31
- package/dist/visual-copy-CHHBfJ6O.js +0 -14
|
@@ -1,470 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// src/components/device-frame.ts
|
|
3
|
-
const DEVICE_FRAME_PRESETS = [
|
|
4
|
-
{
|
|
5
|
-
id: "iphone",
|
|
6
|
-
label: "iPhone",
|
|
7
|
-
kind: "phone",
|
|
8
|
-
width: 393,
|
|
9
|
-
height: 852
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
id: "ipad",
|
|
13
|
-
label: "iPad",
|
|
14
|
-
kind: "tablet",
|
|
15
|
-
width: 820,
|
|
16
|
-
height: 1180
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
id: "laptop",
|
|
20
|
-
label: "Laptop",
|
|
21
|
-
kind: "laptop",
|
|
22
|
-
width: 1280,
|
|
23
|
-
height: 800
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: "desktop",
|
|
27
|
-
label: "Desktop",
|
|
28
|
-
kind: "desktop",
|
|
29
|
-
width: 1920,
|
|
30
|
-
height: 1080
|
|
31
|
-
}
|
|
32
|
-
];
|
|
33
|
-
/** The widths Chrome's device mode marks above the page, narrowest first. */
|
|
34
|
-
const DEVICE_FRAME_BREAKPOINTS = [
|
|
35
|
-
{
|
|
36
|
-
label: "Mobile S",
|
|
37
|
-
width: 320
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: "Mobile M",
|
|
41
|
-
width: 375
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: "Mobile L",
|
|
45
|
-
width: 425
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
label: "Tablet",
|
|
49
|
-
width: 768
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
label: "Laptop",
|
|
53
|
-
width: 1024
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
label: "Laptop L",
|
|
57
|
-
width: 1440
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
label: "4K",
|
|
61
|
-
width: 2560
|
|
62
|
-
}
|
|
63
|
-
];
|
|
64
|
-
const SIZE_MIN = 240;
|
|
65
|
-
const SIZE_MAX = 3840;
|
|
66
|
-
const ZOOM_MIN = .1;
|
|
67
|
-
const ZOOM_MAX = 4;
|
|
68
|
-
const clampSize = (value) => Math.round(Math.min(SIZE_MAX, Math.max(SIZE_MIN, value)));
|
|
69
|
-
const clampZoom = (value) => Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, value));
|
|
70
|
-
const paths = {
|
|
71
|
-
phone: ["M7 2h10a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Z", "M12 18h.01"],
|
|
72
|
-
tablet: ["M6 2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Z", "M12 18h.01"],
|
|
73
|
-
laptop: ["M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16"],
|
|
74
|
-
desktop: [
|
|
75
|
-
"M4 3h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Z",
|
|
76
|
-
"M8 21h8",
|
|
77
|
-
"M12 17v4"
|
|
78
|
-
],
|
|
79
|
-
custom: [
|
|
80
|
-
"M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Z",
|
|
81
|
-
"M3 9h18",
|
|
82
|
-
"M9 21V9"
|
|
83
|
-
],
|
|
84
|
-
rotate: [
|
|
85
|
-
"M20 9V7a2 2 0 0 0-2-2h-6",
|
|
86
|
-
"m15 2-3 3 3 3",
|
|
87
|
-
"M20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2"
|
|
88
|
-
],
|
|
89
|
-
chevron: ["m6 9 6 6 6-6"],
|
|
90
|
-
close: ["M18 6 6 18", "m6 6 12 12"]
|
|
91
|
-
};
|
|
92
|
-
function icon(name, className = "vh-device-frame__icon") {
|
|
93
|
-
return h("svg", {
|
|
94
|
-
"aria-hidden": "true",
|
|
95
|
-
class: className,
|
|
96
|
-
fill: "none",
|
|
97
|
-
stroke: "currentColor",
|
|
98
|
-
"stroke-linecap": "round",
|
|
99
|
-
"stroke-linejoin": "round",
|
|
100
|
-
"stroke-width": "1.75",
|
|
101
|
-
viewBox: "0 0 24 24"
|
|
102
|
-
}, (paths[name] ?? []).map((d) => h("path", { d })));
|
|
103
|
-
}
|
|
104
|
-
function readStored(key) {
|
|
105
|
-
if (!key || typeof localStorage === "undefined") return void 0;
|
|
106
|
-
try {
|
|
107
|
-
const value = JSON.parse(localStorage.getItem(key) ?? "null");
|
|
108
|
-
if (!value || typeof value !== "object") return void 0;
|
|
109
|
-
const { on, id, width, height, zoom } = value;
|
|
110
|
-
if (typeof width !== "number" || typeof height !== "number" || typeof id !== "string") return void 0;
|
|
111
|
-
return {
|
|
112
|
-
on: on === true,
|
|
113
|
-
id,
|
|
114
|
-
width: clampSize(width),
|
|
115
|
-
height: clampSize(height),
|
|
116
|
-
zoom: typeof zoom === "number" ? clampZoom(zoom) : null
|
|
117
|
-
};
|
|
118
|
-
} catch {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/** Shows its content at a device's size: a bar with the device, the size, Rotate, breakpoints and zoom, over a stage that fits the pane. */
|
|
123
|
-
const DeviceFrame = defineComponent({
|
|
124
|
-
name: "DeviceFrame",
|
|
125
|
-
props: {
|
|
126
|
-
/** The size, for `v-model`. Without it the frame keeps its own state. */
|
|
127
|
-
modelValue: {
|
|
128
|
-
default: void 0,
|
|
129
|
-
type: Object
|
|
130
|
-
},
|
|
131
|
-
/** The first size when uncontrolled and nothing is stored. */
|
|
132
|
-
defaultValue: {
|
|
133
|
-
default: void 0,
|
|
134
|
-
type: Object
|
|
135
|
-
},
|
|
136
|
-
/** Keeps the uncontrolled size in local storage under this key. */
|
|
137
|
-
storageKey: {
|
|
138
|
-
default: void 0,
|
|
139
|
-
type: String
|
|
140
|
-
},
|
|
141
|
-
/** The devices the bar offers. Defaults to `DEVICE_FRAME_PRESETS`: iPhone, iPad, Laptop, and Desktop. */
|
|
142
|
-
presets: {
|
|
143
|
-
default: void 0,
|
|
144
|
-
type: Array
|
|
145
|
-
},
|
|
146
|
-
/** The one-click widths. Defaults to `DEVICE_FRAME_BREAKPOINTS`, Chrome's; pass `[]` to hide them. */
|
|
147
|
-
breakpoints: {
|
|
148
|
-
default: void 0,
|
|
149
|
-
type: Array
|
|
150
|
-
},
|
|
151
|
-
/** Shows the content full size without the bar, and keeps the size for later. */
|
|
152
|
-
disabled: {
|
|
153
|
-
default: false,
|
|
154
|
-
type: Boolean
|
|
155
|
-
},
|
|
156
|
-
/** Shows the bar above the page while device mode is on. Pass `false` when the page around the frame has its own device controls. */
|
|
157
|
-
toolbar: {
|
|
158
|
-
default: true,
|
|
159
|
-
type: Boolean
|
|
160
|
-
},
|
|
161
|
-
/** Space in pixels under the page, for a toolbar that floats over the bottom of the frame. */
|
|
162
|
-
insetBottom: {
|
|
163
|
-
default: 16,
|
|
164
|
-
type: Number
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
emits: { "update:modelValue": (_size) => true },
|
|
168
|
-
setup(props, { emit, slots, expose }) {
|
|
169
|
-
const presets = computed(() => props.presets ?? DEVICE_FRAME_PRESETS);
|
|
170
|
-
const breakpoints = computed(() => props.breakpoints ?? DEVICE_FRAME_BREAKPOINTS);
|
|
171
|
-
const first = presets.value[0] ?? DEVICE_FRAME_PRESETS[0];
|
|
172
|
-
const initial = (stored) => ({
|
|
173
|
-
on: false,
|
|
174
|
-
id: first.id,
|
|
175
|
-
width: first.width,
|
|
176
|
-
height: first.height,
|
|
177
|
-
zoom: null,
|
|
178
|
-
...stored ?? props.defaultValue
|
|
179
|
-
});
|
|
180
|
-
const local = ref(initial());
|
|
181
|
-
const size = computed(() => props.modelValue ?? local.value);
|
|
182
|
-
function update(next) {
|
|
183
|
-
const value = {
|
|
184
|
-
...size.value,
|
|
185
|
-
...next
|
|
186
|
-
};
|
|
187
|
-
if (props.modelValue === void 0) {
|
|
188
|
-
local.value = value;
|
|
189
|
-
if (props.storageKey && typeof localStorage !== "undefined") try {
|
|
190
|
-
localStorage.setItem(props.storageKey, JSON.stringify(value));
|
|
191
|
-
} catch {}
|
|
192
|
-
}
|
|
193
|
-
emit("update:modelValue", value);
|
|
194
|
-
}
|
|
195
|
-
const sized = computed(() => !props.disabled && size.value.on);
|
|
196
|
-
const presetOf = (id) => presets.value.find((item) => item.id === id);
|
|
197
|
-
const matching = (width, height) => presets.value.find((item) => item.width === width && item.height === height || item.width === height && item.height === width)?.id ?? "custom";
|
|
198
|
-
const preset = computed(() => presetOf(size.value.id));
|
|
199
|
-
const setSize = (width, height) => update({
|
|
200
|
-
on: true,
|
|
201
|
-
width,
|
|
202
|
-
height,
|
|
203
|
-
id: matching(width, height)
|
|
204
|
-
});
|
|
205
|
-
function pick(id) {
|
|
206
|
-
const next = presetOf(id);
|
|
207
|
-
if (!next) return;
|
|
208
|
-
const current = preset.value;
|
|
209
|
-
update(current && size.value.width === current.height && size.value.width !== current.width ? {
|
|
210
|
-
id,
|
|
211
|
-
width: next.height,
|
|
212
|
-
height: next.width
|
|
213
|
-
} : {
|
|
214
|
-
id,
|
|
215
|
-
width: next.width,
|
|
216
|
-
height: next.height
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
const rotate = () => update({
|
|
220
|
-
width: size.value.height,
|
|
221
|
-
height: size.value.width
|
|
222
|
-
});
|
|
223
|
-
const within = computed(() => breakpoints.value.filter((band) => band.width <= size.value.width).at(-1)?.width);
|
|
224
|
-
const stage = ref();
|
|
225
|
-
const room = ref({
|
|
226
|
-
width: 0,
|
|
227
|
-
height: 0
|
|
228
|
-
});
|
|
229
|
-
let observer;
|
|
230
|
-
onMounted(() => {
|
|
231
|
-
local.value = initial(readStored(props.storageKey));
|
|
232
|
-
if (!stage.value || typeof ResizeObserver === "undefined") return;
|
|
233
|
-
observer = new ResizeObserver(([entry]) => {
|
|
234
|
-
if (entry) room.value = {
|
|
235
|
-
width: entry.contentRect.width,
|
|
236
|
-
height: entry.contentRect.height
|
|
237
|
-
};
|
|
238
|
-
});
|
|
239
|
-
observer.observe(stage.value);
|
|
240
|
-
});
|
|
241
|
-
onBeforeUnmount(() => observer?.disconnect());
|
|
242
|
-
const fit = computed(() => room.value.width && room.value.height ? Math.min(1, room.value.width / size.value.width, room.value.height / size.value.height) : 1);
|
|
243
|
-
const held = ref(null);
|
|
244
|
-
const scale = computed(() => Math.max(ZOOM_MIN, held.value ?? size.value.zoom ?? fit.value));
|
|
245
|
-
let start;
|
|
246
|
-
function grab(event) {
|
|
247
|
-
if (event.currentTarget instanceof Element) event.currentTarget.setPointerCapture(event.pointerId);
|
|
248
|
-
start = {
|
|
249
|
-
x: event.clientX,
|
|
250
|
-
y: event.clientY,
|
|
251
|
-
width: size.value.width,
|
|
252
|
-
height: size.value.height
|
|
253
|
-
};
|
|
254
|
-
held.value = scale.value;
|
|
255
|
-
}
|
|
256
|
-
function drag(event, edges) {
|
|
257
|
-
if (!start) return;
|
|
258
|
-
const s = scale.value;
|
|
259
|
-
setSize(edges.x ? clampSize(start.width + 2 * (event.clientX - start.x) / s) : size.value.width, edges.y ? clampSize(start.height + (event.clientY - start.y) / s) : size.value.height);
|
|
260
|
-
}
|
|
261
|
-
function release() {
|
|
262
|
-
start = void 0;
|
|
263
|
-
held.value = null;
|
|
264
|
-
}
|
|
265
|
-
function nudge(event, edges) {
|
|
266
|
-
const step = event.shiftKey ? 50 : 10;
|
|
267
|
-
const dx = edges.x ? event.key === "ArrowRight" ? step : event.key === "ArrowLeft" ? -step : 0 : 0;
|
|
268
|
-
const dy = edges.y ? event.key === "ArrowDown" ? step : event.key === "ArrowUp" ? -step : 0 : 0;
|
|
269
|
-
if (!dx && !dy) return;
|
|
270
|
-
event.preventDefault();
|
|
271
|
-
setSize(clampSize(size.value.width + dx), clampSize(size.value.height + dy));
|
|
272
|
-
}
|
|
273
|
-
const numberValue = (event) => event.target instanceof HTMLInputElement ? event.target.valueAsNumber : NaN;
|
|
274
|
-
expose({
|
|
275
|
-
rotate,
|
|
276
|
-
fit: () => update({ zoom: null })
|
|
277
|
-
});
|
|
278
|
-
function toolbar() {
|
|
279
|
-
const current = size.value;
|
|
280
|
-
const percent = Math.round(scale.value * 100);
|
|
281
|
-
return h("div", {
|
|
282
|
-
key: "bar",
|
|
283
|
-
class: "vh-device-frame__bar",
|
|
284
|
-
role: "toolbar",
|
|
285
|
-
"aria-label": "Device"
|
|
286
|
-
}, [
|
|
287
|
-
slots["toolbar-start"]?.(),
|
|
288
|
-
h("label", {
|
|
289
|
-
class: "vh-device-frame__select",
|
|
290
|
-
"data-focus-ring": ""
|
|
291
|
-
}, [
|
|
292
|
-
icon(preset.value?.kind ?? "custom"),
|
|
293
|
-
h("span", {
|
|
294
|
-
"aria-hidden": "true",
|
|
295
|
-
class: "vh-device-frame__select-label"
|
|
296
|
-
}, preset.value?.label ?? "Custom"),
|
|
297
|
-
h("select", {
|
|
298
|
-
"aria-label": "Device",
|
|
299
|
-
value: preset.value ? current.id : "custom",
|
|
300
|
-
onChange: (event) => event.target instanceof HTMLSelectElement && pick(event.target.value)
|
|
301
|
-
}, [...presets.value.map((item) => h("option", {
|
|
302
|
-
key: item.id,
|
|
303
|
-
value: item.id
|
|
304
|
-
}, `${item.label} · ${item.width} × ${item.height}`)), preset.value ? null : h("option", {
|
|
305
|
-
value: "custom",
|
|
306
|
-
disabled: true
|
|
307
|
-
}, "Custom")]),
|
|
308
|
-
icon("chevron", "vh-device-frame__chevron")
|
|
309
|
-
]),
|
|
310
|
-
h("input", {
|
|
311
|
-
"aria-label": "Width",
|
|
312
|
-
class: "vh-device-frame__number",
|
|
313
|
-
"data-focus-frame": "",
|
|
314
|
-
inputmode: "numeric",
|
|
315
|
-
max: SIZE_MAX,
|
|
316
|
-
min: SIZE_MIN,
|
|
317
|
-
type: "number",
|
|
318
|
-
value: current.width,
|
|
319
|
-
onChange: (event) => {
|
|
320
|
-
const value = numberValue(event);
|
|
321
|
-
if (Number.isFinite(value)) setSize(clampSize(value), current.height);
|
|
322
|
-
}
|
|
323
|
-
}),
|
|
324
|
-
h("span", {
|
|
325
|
-
"aria-hidden": "true",
|
|
326
|
-
class: "vh-device-frame__times"
|
|
327
|
-
}, "×"),
|
|
328
|
-
h("input", {
|
|
329
|
-
"aria-label": "Height",
|
|
330
|
-
class: "vh-device-frame__number",
|
|
331
|
-
"data-focus-frame": "",
|
|
332
|
-
inputmode: "numeric",
|
|
333
|
-
max: SIZE_MAX,
|
|
334
|
-
min: SIZE_MIN,
|
|
335
|
-
type: "number",
|
|
336
|
-
value: current.height,
|
|
337
|
-
onChange: (event) => {
|
|
338
|
-
const value = numberValue(event);
|
|
339
|
-
if (Number.isFinite(value)) setSize(current.width, clampSize(value));
|
|
340
|
-
}
|
|
341
|
-
}),
|
|
342
|
-
h("button", {
|
|
343
|
-
class: "vh-device-frame__button",
|
|
344
|
-
type: "button",
|
|
345
|
-
onClick: rotate
|
|
346
|
-
}, [icon("rotate"), h("span", "Rotate")]),
|
|
347
|
-
breakpoints.value.length ? h("div", {
|
|
348
|
-
class: "vh-device-frame__bands",
|
|
349
|
-
role: "group",
|
|
350
|
-
"aria-label": "Breakpoints"
|
|
351
|
-
}, breakpoints.value.map((band) => h("button", {
|
|
352
|
-
key: band.width,
|
|
353
|
-
"aria-label": `${band.label}, ${band.width} pixels wide`,
|
|
354
|
-
"aria-pressed": current.width === band.width ? "true" : "false",
|
|
355
|
-
class: "vh-device-frame__band",
|
|
356
|
-
"data-within": within.value === band.width ? "" : void 0,
|
|
357
|
-
title: band.label,
|
|
358
|
-
type: "button",
|
|
359
|
-
onClick: () => setSize(band.width, current.height)
|
|
360
|
-
}, String(band.width)))) : null,
|
|
361
|
-
h("div", { class: "vh-device-frame__end" }, [
|
|
362
|
-
h("label", { class: "vh-device-frame__zoom" }, [h("input", {
|
|
363
|
-
"aria-label": "Zoom, in percent",
|
|
364
|
-
class: "vh-device-frame__number",
|
|
365
|
-
"data-focus-frame": "",
|
|
366
|
-
inputmode: "numeric",
|
|
367
|
-
max: 400,
|
|
368
|
-
min: ZOOM_MIN * 100,
|
|
369
|
-
step: 10,
|
|
370
|
-
type: "number",
|
|
371
|
-
value: percent,
|
|
372
|
-
onChange: (event) => {
|
|
373
|
-
const value = numberValue(event);
|
|
374
|
-
if (Number.isFinite(value) && value > 0) update({ zoom: clampZoom(value / 100) });
|
|
375
|
-
}
|
|
376
|
-
}), h("span", { "aria-hidden": "true" }, "%")]),
|
|
377
|
-
h("button", {
|
|
378
|
-
"aria-pressed": current.zoom === null ? "true" : "false",
|
|
379
|
-
class: "vh-device-frame__button",
|
|
380
|
-
type: "button",
|
|
381
|
-
onClick: () => update({ zoom: null })
|
|
382
|
-
}, "Fit"),
|
|
383
|
-
slots["toolbar-end"]?.(),
|
|
384
|
-
h("button", {
|
|
385
|
-
"aria-label": "Leave device mode",
|
|
386
|
-
class: "vh-device-frame__button vh-device-frame__icon-button",
|
|
387
|
-
title: "Leave device mode",
|
|
388
|
-
type: "button",
|
|
389
|
-
onClick: () => update({ on: false })
|
|
390
|
-
}, [icon("close")])
|
|
391
|
-
])
|
|
392
|
-
]);
|
|
393
|
-
}
|
|
394
|
-
const HANDLES = [
|
|
395
|
-
{
|
|
396
|
-
edge: "x",
|
|
397
|
-
edges: { x: true },
|
|
398
|
-
label: "Drag to change the width"
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
edge: "y",
|
|
402
|
-
edges: { y: true },
|
|
403
|
-
label: "Drag to change the height"
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
edge: "xy",
|
|
407
|
-
edges: {
|
|
408
|
-
x: true,
|
|
409
|
-
y: true
|
|
410
|
-
},
|
|
411
|
-
label: "Drag to resize"
|
|
412
|
-
}
|
|
413
|
-
];
|
|
414
|
-
watch(() => props.storageKey, () => {
|
|
415
|
-
if (props.modelValue === void 0) local.value = initial(readStored(props.storageKey));
|
|
416
|
-
});
|
|
417
|
-
return () => {
|
|
418
|
-
const on = sized.value;
|
|
419
|
-
const current = size.value;
|
|
420
|
-
const s = scale.value;
|
|
421
|
-
return h("div", {
|
|
422
|
-
class: "vh-device-frame",
|
|
423
|
-
"data-slot": "device-frame",
|
|
424
|
-
"data-on": on ? "" : void 0,
|
|
425
|
-
"data-dragging": held.value === null ? void 0 : ""
|
|
426
|
-
}, [on && props.toolbar ? toolbar() : null, h("div", {
|
|
427
|
-
key: "stage",
|
|
428
|
-
ref: stage,
|
|
429
|
-
class: "vh-device-frame__stage",
|
|
430
|
-
style: on ? { paddingBottom: `${props.insetBottom}px` } : void 0
|
|
431
|
-
}, [h("div", {
|
|
432
|
-
class: "vh-device-frame__footprint",
|
|
433
|
-
style: on ? {
|
|
434
|
-
width: `${current.width * s}px`,
|
|
435
|
-
height: `${current.height * s}px`
|
|
436
|
-
} : void 0
|
|
437
|
-
}, [
|
|
438
|
-
h("div", {
|
|
439
|
-
class: "vh-device-frame__page",
|
|
440
|
-
style: on ? {
|
|
441
|
-
width: `${current.width}px`,
|
|
442
|
-
height: `${current.height}px`,
|
|
443
|
-
transform: `scale(${s})`
|
|
444
|
-
} : void 0
|
|
445
|
-
}, slots.default?.()),
|
|
446
|
-
on && held.value !== null ? h("p", {
|
|
447
|
-
class: "vh-device-frame__readout",
|
|
448
|
-
"aria-live": "polite"
|
|
449
|
-
}, `${current.width} × ${current.height}`) : null,
|
|
450
|
-
...on ? HANDLES.map((handle) => h("div", {
|
|
451
|
-
key: handle.edge,
|
|
452
|
-
"aria-label": handle.label,
|
|
453
|
-
"aria-orientation": handle.edge === "y" ? "horizontal" : "vertical",
|
|
454
|
-
"aria-valuenow": handle.edge === "y" ? current.height : current.width,
|
|
455
|
-
"aria-valuemin": SIZE_MIN,
|
|
456
|
-
"aria-valuemax": SIZE_MAX,
|
|
457
|
-
class: "vh-device-frame__handle",
|
|
458
|
-
"data-edge": handle.edge,
|
|
459
|
-
role: "separator",
|
|
460
|
-
tabindex: 0,
|
|
461
|
-
onKeydown: (event) => nudge(event, handle.edges),
|
|
462
|
-
onLostpointercapture: release,
|
|
463
|
-
onPointerdown: grab,
|
|
464
|
-
onPointermove: (event) => drag(event, handle.edges)
|
|
465
|
-
}, handle.edge === "xy" ? void 0 : [h("span", { class: "vh-device-frame__grip" })])) : []
|
|
466
|
-
])])]);
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
export { DEVICE_FRAME_BREAKPOINTS, DEVICE_FRAME_PRESETS, DeviceFrame };
|
|
1
|
+
export { r as DEVICE_FRAME_BREAKPOINTS, i as DEVICE_FRAME_PRESETS, t as DeviceFrame, n as DeviceFrameToolbar } from "../../device-frame-DDWoyB-G.js";
|
|
@@ -1,67 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
/** The text of the field. `over` is true while a file is over it. */
|
|
4
|
-
default?: (props: {
|
|
5
|
-
over: boolean;
|
|
6
|
-
}) => VNodeChild;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* A place to drop files, with the drop field of `@vite-hub/ui/motion` (docs/design/motion.md, "Files are dragged in"):
|
|
10
|
-
* a grid of dots that leans toward the dragged file. It is a label around a native file input, so a click and the
|
|
11
|
-
* keyboard open the file picker as before. It emits `files` for a drop and for a pick.
|
|
12
|
-
*/
|
|
13
|
-
export declare const DropField: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
14
|
-
accept: {
|
|
15
|
-
default: undefined;
|
|
16
|
-
type: StringConstructor;
|
|
17
|
-
};
|
|
18
|
-
multiple: {
|
|
19
|
-
default: boolean;
|
|
20
|
-
type: BooleanConstructor;
|
|
21
|
-
};
|
|
22
|
-
disabled: {
|
|
23
|
-
default: boolean;
|
|
24
|
-
type: BooleanConstructor;
|
|
25
|
-
};
|
|
26
|
-
label: {
|
|
27
|
-
default: string;
|
|
28
|
-
type: StringConstructor;
|
|
29
|
-
};
|
|
30
|
-
description: {
|
|
31
|
-
default: string;
|
|
32
|
-
type: StringConstructor;
|
|
33
|
-
};
|
|
34
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
35
|
-
[key: string]: any;
|
|
36
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
37
|
-
files: (files: File[]) => boolean;
|
|
38
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
39
|
-
accept: {
|
|
40
|
-
default: undefined;
|
|
41
|
-
type: StringConstructor;
|
|
42
|
-
};
|
|
43
|
-
multiple: {
|
|
44
|
-
default: boolean;
|
|
45
|
-
type: BooleanConstructor;
|
|
46
|
-
};
|
|
47
|
-
disabled: {
|
|
48
|
-
default: boolean;
|
|
49
|
-
type: BooleanConstructor;
|
|
50
|
-
};
|
|
51
|
-
label: {
|
|
52
|
-
default: string;
|
|
53
|
-
type: StringConstructor;
|
|
54
|
-
};
|
|
55
|
-
description: {
|
|
56
|
-
default: string;
|
|
57
|
-
type: StringConstructor;
|
|
58
|
-
};
|
|
59
|
-
}>> & Readonly<{
|
|
60
|
-
onFiles?: ((files: File[]) => any) | undefined;
|
|
61
|
-
}>, {
|
|
62
|
-
label: string;
|
|
63
|
-
multiple: boolean;
|
|
64
|
-
disabled: boolean;
|
|
65
|
-
accept: string;
|
|
66
|
-
description: string;
|
|
67
|
-
}, SlotsType<DropFieldSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
1
|
+
import { i as DropFieldSlots, n as DropFieldEmits, r as DropFieldProps, t as _default } from "../../drop-field-C0bXv1J-.js";
|
|
2
|
+
export { _default as DropField, type DropFieldEmits, type DropFieldProps, type DropFieldSlots };
|
|
@@ -1,76 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineComponent, h, onBeforeUnmount, onMounted, ref } from "vue";
|
|
3
|
-
// src/components/drop-field.ts
|
|
4
|
-
/**
|
|
5
|
-
* A place to drop files, with the drop field of `@vite-hub/ui/motion` (docs/design/motion.md, "Files are dragged in"):
|
|
6
|
-
* a grid of dots that leans toward the dragged file. It is a label around a native file input, so a click and the
|
|
7
|
-
* keyboard open the file picker as before. It emits `files` for a drop and for a pick.
|
|
8
|
-
*/
|
|
9
|
-
const DropField = defineComponent({
|
|
10
|
-
name: "DropField",
|
|
11
|
-
props: {
|
|
12
|
-
accept: {
|
|
13
|
-
default: void 0,
|
|
14
|
-
type: String
|
|
15
|
-
},
|
|
16
|
-
multiple: {
|
|
17
|
-
default: false,
|
|
18
|
-
type: Boolean
|
|
19
|
-
},
|
|
20
|
-
disabled: {
|
|
21
|
-
default: false,
|
|
22
|
-
type: Boolean
|
|
23
|
-
},
|
|
24
|
-
label: {
|
|
25
|
-
default: "Drop files to upload",
|
|
26
|
-
type: String
|
|
27
|
-
},
|
|
28
|
-
description: {
|
|
29
|
-
default: "or click to browse",
|
|
30
|
-
type: String
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
emits: { files: (files) => Array.isArray(files) },
|
|
34
|
-
slots: Object,
|
|
35
|
-
setup(props, { emit, slots }) {
|
|
36
|
-
const root = ref();
|
|
37
|
-
const over = ref(false);
|
|
38
|
-
let field;
|
|
39
|
-
const watcher = typeof MutationObserver === "function" ? new MutationObserver(() => over.value = root.value?.dataset.over !== void 0) : void 0;
|
|
40
|
-
onMounted(() => {
|
|
41
|
-
if (!root.value) return;
|
|
42
|
-
field = createDropField(root.value, {
|
|
43
|
-
accepts: (event) => !props.disabled && [...event.dataTransfer?.types ?? []].includes("Files"),
|
|
44
|
-
onFiles: (files) => {
|
|
45
|
-
if (files.length) emit("files", props.multiple ? files : files.slice(0, 1));
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
watcher?.observe(root.value, { attributeFilter: ["data-over"] });
|
|
49
|
-
});
|
|
50
|
-
onBeforeUnmount(() => {
|
|
51
|
-
watcher?.disconnect();
|
|
52
|
-
field?.destroy();
|
|
53
|
-
});
|
|
54
|
-
function pick(event) {
|
|
55
|
-
const input = event.target;
|
|
56
|
-
if (!(input instanceof HTMLInputElement)) return;
|
|
57
|
-
const files = [...input.files ?? []];
|
|
58
|
-
input.value = "";
|
|
59
|
-
if (files.length) emit("files", files);
|
|
60
|
-
}
|
|
61
|
-
return () => h("label", {
|
|
62
|
-
"data-disabled": props.disabled ? "" : void 0,
|
|
63
|
-
"data-focus-ring": "",
|
|
64
|
-
"data-slot": "drop-field",
|
|
65
|
-
ref: root
|
|
66
|
-
}, [h("input", {
|
|
67
|
-
accept: props.accept,
|
|
68
|
-
"data-slot": "drop-field-input",
|
|
69
|
-
disabled: props.disabled,
|
|
70
|
-
multiple: props.multiple,
|
|
71
|
-
onChange: pick,
|
|
72
|
-
type: "file"
|
|
73
|
-
}), slots.default?.({ over: over.value }) ?? [h("span", { "data-slot": "drop-field-label" }, over.value ? "Release to upload" : props.label), props.description ? h("span", { "data-slot": "drop-field-description" }, props.description) : null]]);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
export { DropField };
|
|
1
|
+
export { t as DropField } from "../../drop-field-DKpYQ3tO.js";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as FileTreeOptions, o as useFileTree, s as useFileTreeSelection, t as FileTreeModel } from "../../file-tree-BdnKA6UA.js";
|
|
2
|
+
import { i as FileTreeProps, n as FileTreeEmits, r as FileTreeExposed, t as _default } from "../../file-tree-DDSIafDn.js";
|
|
3
|
+
export { _default as FileTree, type FileTreeEmits, type FileTreeExposed, type FileTreeModel, type FileTreeOptions, type FileTreeProps, useFileTree, useFileTreeSelection };
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { n as useFileTree, r as useFileTreeSelection } from "../../file-tree-B4JKbp4r.js";
|
|
2
|
+
import { t as FileTree_default } from "../../file-tree-DS5shGSL.js";
|
|
3
|
+
export { FileTree_default as FileTree, useFileTree, useFileTreeSelection };
|
|
@@ -1,45 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export type FilterSearchSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
|
-
export declare const FilterSearch: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
-
/** The object that `useChoices()` returns. */
|
|
6
|
-
choices: {
|
|
7
|
-
required: true;
|
|
8
|
-
type: PropType<ChoicesInputSource>;
|
|
9
|
-
};
|
|
10
|
-
/** The accessible name of the input. */
|
|
11
|
-
label: {
|
|
12
|
-
default: string;
|
|
13
|
-
type: StringConstructor;
|
|
14
|
-
};
|
|
15
|
-
placeholder: {
|
|
16
|
-
type: StringConstructor;
|
|
17
|
-
};
|
|
18
|
-
size: {
|
|
19
|
-
default: string;
|
|
20
|
-
type: PropType<FilterSearchSize>;
|
|
21
|
-
};
|
|
22
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
23
|
-
[key: string]: any;
|
|
24
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
25
|
-
/** The object that `useChoices()` returns. */
|
|
26
|
-
choices: {
|
|
27
|
-
required: true;
|
|
28
|
-
type: PropType<ChoicesInputSource>;
|
|
29
|
-
};
|
|
30
|
-
/** The accessible name of the input. */
|
|
31
|
-
label: {
|
|
32
|
-
default: string;
|
|
33
|
-
type: StringConstructor;
|
|
34
|
-
};
|
|
35
|
-
placeholder: {
|
|
36
|
-
type: StringConstructor;
|
|
37
|
-
};
|
|
38
|
-
size: {
|
|
39
|
-
default: string;
|
|
40
|
-
type: PropType<FilterSearchSize>;
|
|
41
|
-
};
|
|
42
|
-
}>> & Readonly<{}>, {
|
|
43
|
-
label: string;
|
|
44
|
-
size: FilterSearchSize;
|
|
45
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
1
|
+
import { i as FilterSearchSlots, n as FilterSearchProps, r as FilterSearchSize, t as _default } from "../../filter-search-C9e6sGij.js";
|
|
2
|
+
export { _default as FilterSearch, type FilterSearchProps, type FilterSearchSize, type FilterSearchSlots };
|