@useupup/vue 3.3.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/LICENSE +21 -0
- package/README.md +67 -0
- package/dist/AudioUploader-6ZMGQ3GT.cjs +376 -0
- package/dist/AudioUploader-6ZMGQ3GT.cjs.map +1 -0
- package/dist/AudioUploader-IEWPI3TS.js +376 -0
- package/dist/AudioUploader-IEWPI3TS.js.map +1 -0
- package/dist/BoxUploader-S6CGJLO7.cjs +214 -0
- package/dist/BoxUploader-S6CGJLO7.cjs.map +1 -0
- package/dist/BoxUploader-TIDCYWMC.js +214 -0
- package/dist/BoxUploader-TIDCYWMC.js.map +1 -0
- package/dist/CameraUploader-575RARRY.js +258 -0
- package/dist/CameraUploader-575RARRY.js.map +1 -0
- package/dist/CameraUploader-LBIVBECB.cjs +258 -0
- package/dist/CameraUploader-LBIVBECB.cjs.map +1 -0
- package/dist/DropboxUploader-HTGDBDTB.cjs +216 -0
- package/dist/DropboxUploader-HTGDBDTB.cjs.map +1 -0
- package/dist/DropboxUploader-M2LY2Q32.js +216 -0
- package/dist/DropboxUploader-M2LY2Q32.js.map +1 -0
- package/dist/GoogleDriveUploader-R3WJYLW7.cjs +220 -0
- package/dist/GoogleDriveUploader-R3WJYLW7.cjs.map +1 -0
- package/dist/GoogleDriveUploader-SAY4C2QY.js +220 -0
- package/dist/GoogleDriveUploader-SAY4C2QY.js.map +1 -0
- package/dist/OneDriveUploader-EDB3RJA4.js +219 -0
- package/dist/OneDriveUploader-EDB3RJA4.js.map +1 -0
- package/dist/OneDriveUploader-WYALTOCQ.cjs +219 -0
- package/dist/OneDriveUploader-WYALTOCQ.cjs.map +1 -0
- package/dist/ScreenCaptureUploader-F65CM6OA.js +334 -0
- package/dist/ScreenCaptureUploader-F65CM6OA.js.map +1 -0
- package/dist/ScreenCaptureUploader-TZ74W7WQ.cjs +334 -0
- package/dist/ScreenCaptureUploader-TZ74W7WQ.cjs.map +1 -0
- package/dist/UrlUploader-PXEGUBQ4.js +143 -0
- package/dist/UrlUploader-PXEGUBQ4.js.map +1 -0
- package/dist/UrlUploader-TLYGV433.cjs +143 -0
- package/dist/UrlUploader-TLYGV433.cjs.map +1 -0
- package/dist/assets/logos.d.ts +5 -0
- package/dist/assets/logos.d.ts.map +1 -0
- package/dist/chunk-D32QOALR.cjs +1083 -0
- package/dist/chunk-D32QOALR.cjs.map +1 -0
- package/dist/chunk-GG4ABGXB.cjs +62 -0
- package/dist/chunk-GG4ABGXB.cjs.map +1 -0
- package/dist/chunk-GVB7IFRP.cjs +0 -0
- package/dist/chunk-GVB7IFRP.cjs.map +1 -0
- package/dist/chunk-IXLKUMV2.cjs +55 -0
- package/dist/chunk-IXLKUMV2.cjs.map +1 -0
- package/dist/chunk-M6AHIQ3M.js +62 -0
- package/dist/chunk-M6AHIQ3M.js.map +1 -0
- package/dist/chunk-PPPFIWFQ.js +1083 -0
- package/dist/chunk-PPPFIWFQ.js.map +1 -0
- package/dist/chunk-RZ7RTSRZ.js +55 -0
- package/dist/chunk-RZ7RTSRZ.js.map +1 -0
- package/dist/chunk-X6FZTCNT.js +0 -0
- package/dist/chunk-X6FZTCNT.js.map +1 -0
- package/dist/components/AudioUploader.vue.d.ts +3 -0
- package/dist/components/AudioUploader.vue.d.ts.map +1 -0
- package/dist/components/AudioWaveform.vue.d.ts +16 -0
- package/dist/components/AudioWaveform.vue.d.ts.map +1 -0
- package/dist/components/BoxUploader.vue.d.ts +3 -0
- package/dist/components/BoxUploader.vue.d.ts.map +1 -0
- package/dist/components/CameraUploader.vue.d.ts +3 -0
- package/dist/components/CameraUploader.vue.d.ts.map +1 -0
- package/dist/components/ClientBoxUploader.vue.d.ts +3 -0
- package/dist/components/ClientBoxUploader.vue.d.ts.map +1 -0
- package/dist/components/ClientDropboxUploader.vue.d.ts +3 -0
- package/dist/components/ClientDropboxUploader.vue.d.ts.map +1 -0
- package/dist/components/ClientGoogleDriveUploader.vue.d.ts +3 -0
- package/dist/components/ClientGoogleDriveUploader.vue.d.ts.map +1 -0
- package/dist/components/ClientOneDriveUploader.vue.d.ts +3 -0
- package/dist/components/ClientOneDriveUploader.vue.d.ts.map +1 -0
- package/dist/components/DefaultLoaderIcon.vue.d.ts +3 -0
- package/dist/components/DefaultLoaderIcon.vue.d.ts.map +1 -0
- package/dist/components/DropboxUploader.vue.d.ts +3 -0
- package/dist/components/DropboxUploader.vue.d.ts.map +1 -0
- package/dist/components/FileHero.vue.d.ts +13 -0
- package/dist/components/FileHero.vue.d.ts.map +1 -0
- package/dist/components/FileIcon.vue.d.ts +9 -0
- package/dist/components/FileIcon.vue.d.ts.map +1 -0
- package/dist/components/FileItem.vue.d.ts +14 -0
- package/dist/components/FileItem.vue.d.ts.map +1 -0
- package/dist/components/FileList.vue.d.ts +3 -0
- package/dist/components/FileList.vue.d.ts.map +1 -0
- package/dist/components/FilePreview.vue.d.ts +22 -0
- package/dist/components/FilePreview.vue.d.ts.map +1 -0
- package/dist/components/FilePreviewPortal.vue.d.ts +15 -0
- package/dist/components/FilePreviewPortal.vue.d.ts.map +1 -0
- package/dist/components/FilePreviewThumbnail.vue.d.ts +19 -0
- package/dist/components/FilePreviewThumbnail.vue.d.ts.map +1 -0
- package/dist/components/FileRow.vue.d.ts +17 -0
- package/dist/components/FileRow.vue.d.ts.map +1 -0
- package/dist/components/GoogleDriveUploader.vue.d.ts +3 -0
- package/dist/components/GoogleDriveUploader.vue.d.ts.map +1 -0
- package/dist/components/Icon.d.ts +36 -0
- package/dist/components/Icon.d.ts.map +1 -0
- package/dist/components/Icons.d.ts +10 -0
- package/dist/components/Icons.d.ts.map +1 -0
- package/dist/components/ImageEditorStub.vue.d.ts +3 -0
- package/dist/components/ImageEditorStub.vue.d.ts.map +1 -0
- package/dist/components/OneDriveUploader.vue.d.ts +3 -0
- package/dist/components/OneDriveUploader.vue.d.ts.map +1 -0
- package/dist/components/ScreenCaptureUploader.vue.d.ts +3 -0
- package/dist/components/ScreenCaptureUploader.vue.d.ts.map +1 -0
- package/dist/components/ServerModeDriveUploader.vue.d.ts +9 -0
- package/dist/components/ServerModeDriveUploader.vue.d.ts.map +1 -0
- package/dist/components/SourceSelector.vue.d.ts +3 -0
- package/dist/components/SourceSelector.vue.d.ts.map +1 -0
- package/dist/components/SourceView.vue.d.ts +3 -0
- package/dist/components/SourceView.vue.d.ts.map +1 -0
- package/dist/components/UploaderPanel.vue.d.ts +3 -0
- package/dist/components/UploaderPanel.vue.d.ts.map +1 -0
- package/dist/components/UrlUploader.vue.d.ts +3 -0
- package/dist/components/UrlUploader.vue.d.ts.map +1 -0
- package/dist/components/shared/DriveAuthFallback.vue.d.ts +12 -0
- package/dist/components/shared/DriveAuthFallback.vue.d.ts.map +1 -0
- package/dist/components/shared/DriveBrowser.vue.d.ts +28 -0
- package/dist/components/shared/DriveBrowser.vue.d.ts.map +1 -0
- package/dist/components/shared/DriveBrowserHeader.vue.d.ts +13 -0
- package/dist/components/shared/DriveBrowserHeader.vue.d.ts.map +1 -0
- package/dist/components/shared/DriveBrowserIcon.vue.d.ts +7 -0
- package/dist/components/shared/DriveBrowserIcon.vue.d.ts.map +1 -0
- package/dist/components/shared/DriveBrowserItem.vue.d.ts +9 -0
- package/dist/components/shared/DriveBrowserItem.vue.d.ts.map +1 -0
- package/dist/components/shared/FileSuccessCheck.vue.d.ts +20 -0
- package/dist/components/shared/FileSuccessCheck.vue.d.ts.map +1 -0
- package/dist/components/shared/ProgressBar.vue.d.ts +11 -0
- package/dist/components/shared/ProgressBar.vue.d.ts.map +1 -0
- package/dist/components/shared/SourceViewContainer.vue.d.ts +18 -0
- package/dist/components/shared/SourceViewContainer.vue.d.ts.map +1 -0
- package/dist/components/shared/UploaderHeader.vue.d.ts +15 -0
- package/dist/components/shared/UploaderHeader.vue.d.ts.map +1 -0
- package/dist/composables/use-tiles-per-row.d.ts +10 -0
- package/dist/composables/use-tiles-per-row.d.ts.map +1 -0
- package/dist/composables/useBox.d.ts +28 -0
- package/dist/composables/useBox.d.ts.map +1 -0
- package/dist/composables/useCameraUploader.d.ts +25 -0
- package/dist/composables/useCameraUploader.d.ts.map +1 -0
- package/dist/composables/useDropbox.d.ts +28 -0
- package/dist/composables/useDropbox.d.ts.map +1 -0
- package/dist/composables/useFetchFileByUrl.d.ts +8 -0
- package/dist/composables/useFetchFileByUrl.d.ts.map +1 -0
- package/dist/composables/useGoogleDrive.d.ts +28 -0
- package/dist/composables/useGoogleDrive.d.ts.map +1 -0
- package/dist/composables/useOneDrive.d.ts +29 -0
- package/dist/composables/useOneDrive.d.ts.map +1 -0
- package/dist/composables/useSSEProcessing.d.ts +19 -0
- package/dist/composables/useSSEProcessing.d.ts.map +1 -0
- package/dist/composables/useServerModeDrive.d.ts +17 -0
- package/dist/composables/useServerModeDrive.d.ts.map +1 -0
- package/dist/composables/useSourceSelector.d.ts +13 -0
- package/dist/composables/useSourceSelector.d.ts.map +1 -0
- package/dist/composables/useUploaderController.d.ts +4 -0
- package/dist/composables/useUploaderController.d.ts.map +1 -0
- package/dist/composables/useUploaderPanel.d.ts +13 -0
- package/dist/composables/useUploaderPanel.d.ts.map +1 -0
- package/dist/context/source-view-header-extra.d.ts +4 -0
- package/dist/context/source-view-header-extra.d.ts.map +1 -0
- package/dist/context/uploader-context.d.ts +95 -0
- package/dist/context/uploader-context.d.ts.map +1 -0
- package/dist/index.cjs +4405 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4405 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/constants.d.ts +11 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/view-mode.d.ts +24 -0
- package/dist/lib/view-mode.d.ts.map +1 -0
- package/dist/shared/types.d.ts +15 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/styles.d.ts +4 -0
- package/dist/tailwind-prefixed.css +2508 -0
- package/dist/upup-uploader.vue.d.ts +18 -0
- package/dist/upup-uploader.vue.d.ts.map +1 -0
- package/dist/use-upup-upload.d.ts +38 -0
- package/dist/use-upup-upload.d.ts.map +1 -0
- package/package.json +100 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkD32QOALRcjs = require('./chunk-D32QOALR.cjs');
|
|
6
|
+
require('./chunk-IXLKUMV2.cjs');
|
|
7
|
+
require('./chunk-GG4ABGXB.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkGVB7IFRPcjs = require('./chunk-GVB7IFRP.cjs');
|
|
14
|
+
|
|
15
|
+
// src/components/OneDriveUploader.vue
|
|
16
|
+
var _vue = require('vue');
|
|
17
|
+
|
|
18
|
+
// src/components/ClientOneDriveUploader.vue
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
// src/composables/useOneDrive.ts
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var _core = require('@useupup/core');
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
var _internal = require('@useupup/core/internal');
|
|
34
|
+
function useOneDrive() {
|
|
35
|
+
const { core } = _chunkGVB7IFRPcjs.useUploaderRuntime.call(void 0, );
|
|
36
|
+
const { setActiveSource } = _chunkGVB7IFRPcjs.useUploaderSource.call(void 0, );
|
|
37
|
+
const { setFiles } = _chunkGVB7IFRPcjs.useUploaderFiles.call(void 0, );
|
|
38
|
+
if (!core) {
|
|
39
|
+
throw new Error("useOneDrive must be used inside <UpupUploader />");
|
|
40
|
+
}
|
|
41
|
+
const controller = new (0, _internal.DriveBrowserController)(core, _core.ONE_DRIVE_DESCRIPTOR, {
|
|
42
|
+
onFilesSelected: (files) => {
|
|
43
|
+
setFiles(files);
|
|
44
|
+
},
|
|
45
|
+
onClose: () => {
|
|
46
|
+
setActiveSource(void 0);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const state = _vue.shallowRef.call(void 0, controller.getSnapshot());
|
|
50
|
+
let unsub = null;
|
|
51
|
+
_vue.onMounted.call(void 0, () => {
|
|
52
|
+
unsub = controller.subscribe(() => {
|
|
53
|
+
state.value = controller.getSnapshot();
|
|
54
|
+
});
|
|
55
|
+
controller.init();
|
|
56
|
+
});
|
|
57
|
+
_vue.onUnmounted.call(void 0, () => {
|
|
58
|
+
controller.destroy();
|
|
59
|
+
unsub == null ? void 0 : unsub();
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
user: _vue.computed.call(void 0, () => state.value.user),
|
|
63
|
+
oneDriveFiles: _vue.computed.call(void 0, () => state.value.folder),
|
|
64
|
+
signOut: () => {
|
|
65
|
+
controller.signOut();
|
|
66
|
+
},
|
|
67
|
+
signIn: () => {
|
|
68
|
+
controller.signIn();
|
|
69
|
+
},
|
|
70
|
+
authenticate: () => {
|
|
71
|
+
controller.signIn();
|
|
72
|
+
},
|
|
73
|
+
token: _vue.computed.call(void 0,
|
|
74
|
+
() => state.value.isAuthenticated ? "active" : void 0
|
|
75
|
+
),
|
|
76
|
+
isAuthenticated: _vue.computed.call(void 0, () => state.value.isAuthenticated),
|
|
77
|
+
isLoading: _vue.computed.call(void 0, () => state.value.isLoading),
|
|
78
|
+
path: _vue.computed.call(void 0, () => state.value.path),
|
|
79
|
+
setPath: (newPath) => {
|
|
80
|
+
controller.setPath(newPath);
|
|
81
|
+
},
|
|
82
|
+
handleClick: (file) => {
|
|
83
|
+
controller.handleClick(file);
|
|
84
|
+
},
|
|
85
|
+
selectedFiles: _vue.computed.call(void 0, () => state.value.selectedFiles),
|
|
86
|
+
showLoader: _vue.computed.call(void 0, () => state.value.showLoader),
|
|
87
|
+
handleSubmit: () => controller.handleSubmit(),
|
|
88
|
+
handleCancelDownload: () => {
|
|
89
|
+
controller.handleCancelDownload();
|
|
90
|
+
},
|
|
91
|
+
onSelectCurrentFolder: () => controller.onSelectCurrentFolder(),
|
|
92
|
+
isClickLoading: _vue.computed.call(void 0, () => state.value.isClickLoading),
|
|
93
|
+
error: _vue.computed.call(void 0, () => state.value.error),
|
|
94
|
+
hasMore: _vue.computed.call(void 0, () => state.value.hasMore),
|
|
95
|
+
isLoadingMore: _vue.computed.call(void 0, () => state.value.isLoadingMore),
|
|
96
|
+
loadMore: () => controller.loadMore()
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/components/ClientOneDriveUploader.vue
|
|
101
|
+
|
|
102
|
+
var _sfc_main = /* @__PURE__ */ _vue.defineComponent.call(void 0, {
|
|
103
|
+
__name: "ClientOneDriveUploader",
|
|
104
|
+
setup(__props, { expose: __expose }) {
|
|
105
|
+
__expose();
|
|
106
|
+
const { user, oneDriveFiles: driveFiles, signOut, token, isAuthenticated, authenticate, isLoading, path, setPath, isClickLoading, handleClick, selectedFiles, showLoader, handleSubmit, handleCancelDownload, onSelectCurrentFolder, error, hasMore, isLoadingMore, loadMore } = useOneDrive();
|
|
107
|
+
async function handleSignOut() {
|
|
108
|
+
signOut();
|
|
109
|
+
}
|
|
110
|
+
const __returned__ = {
|
|
111
|
+
user,
|
|
112
|
+
driveFiles,
|
|
113
|
+
signOut,
|
|
114
|
+
token,
|
|
115
|
+
isAuthenticated,
|
|
116
|
+
authenticate,
|
|
117
|
+
isLoading,
|
|
118
|
+
path,
|
|
119
|
+
setPath,
|
|
120
|
+
isClickLoading,
|
|
121
|
+
handleClick,
|
|
122
|
+
selectedFiles,
|
|
123
|
+
showLoader,
|
|
124
|
+
handleSubmit,
|
|
125
|
+
handleCancelDownload,
|
|
126
|
+
onSelectCurrentFolder,
|
|
127
|
+
error,
|
|
128
|
+
hasMore,
|
|
129
|
+
isLoadingMore,
|
|
130
|
+
loadMore,
|
|
131
|
+
handleSignOut,
|
|
132
|
+
DriveAuthFallback: _chunkD32QOALRcjs.DriveAuthFallback_default,
|
|
133
|
+
DriveBrowser: _chunkD32QOALRcjs.DriveBrowser_default
|
|
134
|
+
};
|
|
135
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
136
|
+
enumerable: false,
|
|
137
|
+
value: true
|
|
138
|
+
});
|
|
139
|
+
return __returned__;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
143
|
+
return !$setup.isAuthenticated && !$setup.token && !$setup.isLoading ? (_vue.openBlock.call(void 0, ), _vue.createBlock.call(void 0, $setup["DriveAuthFallback"], {
|
|
144
|
+
key: 0,
|
|
145
|
+
"provider-name": "OneDrive",
|
|
146
|
+
"on-retry": $setup.authenticate,
|
|
147
|
+
"data-upup-slot": "one-drive-uploader"
|
|
148
|
+
}, null, 8, ["on-retry"])) : (_vue.openBlock.call(void 0, ), _vue.createBlock.call(void 0, $setup["DriveBrowser"], {
|
|
149
|
+
key: 1,
|
|
150
|
+
"drive-files": $setup.driveFiles,
|
|
151
|
+
user: $setup.user,
|
|
152
|
+
"handle-sign-out": $setup.handleSignOut,
|
|
153
|
+
"data-upup-slot": "one-drive-uploader",
|
|
154
|
+
path: $setup.path,
|
|
155
|
+
"set-path": $setup.setPath,
|
|
156
|
+
"is-click-loading": $setup.isClickLoading,
|
|
157
|
+
"handle-click": $setup.handleClick,
|
|
158
|
+
"selected-files": $setup.selectedFiles,
|
|
159
|
+
"show-loader": $setup.showLoader,
|
|
160
|
+
"handle-submit": $setup.handleSubmit,
|
|
161
|
+
"handle-cancel-download": $setup.handleCancelDownload,
|
|
162
|
+
"on-select-current-folder": $setup.onSelectCurrentFolder,
|
|
163
|
+
error: $setup.error,
|
|
164
|
+
"has-more": $setup.hasMore,
|
|
165
|
+
"is-loading-more": $setup.isLoadingMore,
|
|
166
|
+
"load-more": $setup.loadMore
|
|
167
|
+
}, null, 8, [
|
|
168
|
+
"drive-files",
|
|
169
|
+
"user",
|
|
170
|
+
"path",
|
|
171
|
+
"set-path",
|
|
172
|
+
"is-click-loading",
|
|
173
|
+
"handle-click",
|
|
174
|
+
"selected-files",
|
|
175
|
+
"show-loader",
|
|
176
|
+
"handle-submit",
|
|
177
|
+
"handle-cancel-download",
|
|
178
|
+
"on-select-current-folder",
|
|
179
|
+
"error",
|
|
180
|
+
"has-more",
|
|
181
|
+
"is-loading-more",
|
|
182
|
+
"load-more"
|
|
183
|
+
]));
|
|
184
|
+
}
|
|
185
|
+
var ClientOneDriveUploader_default = /* @__PURE__ */ _chunkGVB7IFRPcjs.export_helper_default.call(void 0, _sfc_main, [["render", _sfc_render], ["__file", "C:\\Users\\amind\\OneDrive\\Desktop\\Projects\\INTERNAL\\upup\\packages\\vue\\src\\components\\ClientOneDriveUploader.vue"]]);
|
|
186
|
+
|
|
187
|
+
// src/components/OneDriveUploader.vue
|
|
188
|
+
|
|
189
|
+
var _sfc_main2 = /* @__PURE__ */ _vue.defineComponent.call(void 0, {
|
|
190
|
+
__name: "OneDriveUploader",
|
|
191
|
+
setup(__props, { expose: __expose }) {
|
|
192
|
+
__expose();
|
|
193
|
+
const { mode } = _chunkGVB7IFRPcjs.useUploaderRuntime.call(void 0, );
|
|
194
|
+
const { setActiveSource } = _chunkGVB7IFRPcjs.useUploaderSource.call(void 0, );
|
|
195
|
+
const __returned__ = {
|
|
196
|
+
mode,
|
|
197
|
+
setActiveSource,
|
|
198
|
+
ClientOneDriveUploader: ClientOneDriveUploader_default,
|
|
199
|
+
ServerModeDriveUploader: _chunkD32QOALRcjs.ServerModeDriveUploader_default
|
|
200
|
+
};
|
|
201
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
202
|
+
enumerable: false,
|
|
203
|
+
value: true
|
|
204
|
+
});
|
|
205
|
+
return __returned__;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
function _sfc_render2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
209
|
+
return $setup.mode === "server" ? (_vue.openBlock.call(void 0, ), _vue.createBlock.call(void 0, $setup["ServerModeDriveUploader"], {
|
|
210
|
+
key: 0,
|
|
211
|
+
provider: "one-drive",
|
|
212
|
+
"on-back": () => $setup.setActiveSource(void 0)
|
|
213
|
+
}, null, 8, ["on-back"])) : (_vue.openBlock.call(void 0, ), _vue.createBlock.call(void 0, $setup["ClientOneDriveUploader"], { key: 1 }));
|
|
214
|
+
}
|
|
215
|
+
var OneDriveUploader_default = /* @__PURE__ */ _chunkGVB7IFRPcjs.export_helper_default.call(void 0, _sfc_main2, [["render", _sfc_render2], ["__file", "C:\\Users\\amind\\OneDrive\\Desktop\\Projects\\INTERNAL\\upup\\packages\\vue\\src\\components\\OneDriveUploader.vue"]]);
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
exports.default = OneDriveUploader_default;
|
|
219
|
+
//# sourceMappingURL=OneDriveUploader-WYALTOCQ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["c:\\Users\\amind\\OneDrive\\Desktop\\Projects\\INTERNAL\\upup\\packages\\vue\\dist\\OneDriveUploader-WYALTOCQ.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;AACA,0BAA0D;AAC1D;AACA;AACA;AACA;AACA;AACA;AACE;AACA;AACA;AACA;AACF;AACA;AACE;AACF,qCAAsB;AACtB;AACE;AACF,kDAA+B;AAC/B,SAAS,WAAW,CAAC,EAAE;AACvB,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,kDAAkB,CAAE;AACvC,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,iDAAiB,CAAE;AACjD,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,gDAAgB,CAAE;AACzC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE;AACb,IAAI,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC;AACvE,EAAE;AACF,EAAE,M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ceViewContainer_default
|
|
3
|
+
} from "./chunk-M6AHIQ3M.js";
|
|
4
|
+
import {
|
|
5
|
+
export_helper_default,
|
|
6
|
+
useUploaderFiles,
|
|
7
|
+
useUploaderSource,
|
|
8
|
+
useUploaderTheme
|
|
9
|
+
} from "./chunk-X6FZTCNT.js";
|
|
10
|
+
|
|
11
|
+
// src/components/ScreenCaptureUploader.vue
|
|
12
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
13
|
+
import { onUnmounted, ref } from "vue";
|
|
14
|
+
import { cn } from "@useupup/core/internal";
|
|
15
|
+
import { createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, createElementBlock as _createElementBlock, createTextVNode as _createTextVNode, Fragment as _Fragment, createVNode as _createVNode } from "vue";
|
|
16
|
+
var _sfc_main = /* @__PURE__ */ _defineComponent({
|
|
17
|
+
__name: "ScreenCaptureUploader",
|
|
18
|
+
setup(__props, { expose: __expose }) {
|
|
19
|
+
__expose();
|
|
20
|
+
const { setFiles } = useUploaderFiles();
|
|
21
|
+
const { setActiveSource } = useUploaderSource();
|
|
22
|
+
const { isDark: dark } = useUploaderTheme();
|
|
23
|
+
const state = ref("idle");
|
|
24
|
+
const duration = ref(0);
|
|
25
|
+
const videoUrl = ref(null);
|
|
26
|
+
const error = ref(null);
|
|
27
|
+
const mediaRecorder = ref(null);
|
|
28
|
+
const chunks = [];
|
|
29
|
+
const timerRef = ref(null);
|
|
30
|
+
const streamRef = ref(null);
|
|
31
|
+
const videoRef = ref(null);
|
|
32
|
+
let previewRef = null;
|
|
33
|
+
onUnmounted(() => {
|
|
34
|
+
var _a;
|
|
35
|
+
if (timerRef.value) clearInterval(timerRef.value);
|
|
36
|
+
if (videoUrl.value) URL.revokeObjectURL(videoUrl.value);
|
|
37
|
+
(_a = streamRef.value) == null ? void 0 : _a.getTracks().forEach((t) => t.stop());
|
|
38
|
+
});
|
|
39
|
+
function bindPreview(el) {
|
|
40
|
+
var _a;
|
|
41
|
+
const video = el instanceof HTMLVideoElement ? el : null;
|
|
42
|
+
previewRef = video;
|
|
43
|
+
if (video && streamRef.value && video.srcObject !== streamRef.value) {
|
|
44
|
+
video.srcObject = streamRef.value;
|
|
45
|
+
void ((_a = video.play()) == null ? void 0 : _a.catch(() => {
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function startRecording() {
|
|
50
|
+
try {
|
|
51
|
+
const stream = await navigator.mediaDevices.getDisplayMedia({
|
|
52
|
+
video: true,
|
|
53
|
+
audio: true
|
|
54
|
+
});
|
|
55
|
+
streamRef.value = stream;
|
|
56
|
+
chunks.length = 0;
|
|
57
|
+
const [videoTrack] = stream.getVideoTracks();
|
|
58
|
+
if (videoTrack) {
|
|
59
|
+
videoTrack.onended = () => {
|
|
60
|
+
if (mediaRecorder.value && mediaRecorder.value.state !== "inactive") {
|
|
61
|
+
mediaRecorder.value.stop();
|
|
62
|
+
}
|
|
63
|
+
if (timerRef.value) clearInterval(timerRef.value);
|
|
64
|
+
state.value = "recorded";
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const recorder = new MediaRecorder(stream);
|
|
68
|
+
mediaRecorder.value = recorder;
|
|
69
|
+
recorder.ondataavailable = (e) => {
|
|
70
|
+
if (e.data.size > 0) chunks.push(e.data);
|
|
71
|
+
};
|
|
72
|
+
recorder.onstop = () => {
|
|
73
|
+
const blob = new Blob(chunks, { type: recorder.mimeType || "video/webm" });
|
|
74
|
+
videoUrl.value = URL.createObjectURL(blob);
|
|
75
|
+
stream.getTracks().forEach((t) => t.stop());
|
|
76
|
+
if (previewRef) previewRef.srcObject = null;
|
|
77
|
+
};
|
|
78
|
+
recorder.start();
|
|
79
|
+
state.value = "recording";
|
|
80
|
+
duration.value = 0;
|
|
81
|
+
timerRef.value = setInterval(() => {
|
|
82
|
+
duration.value++;
|
|
83
|
+
}, 1e3);
|
|
84
|
+
} catch {
|
|
85
|
+
error.value = "Screen sharing was cancelled or denied. Please try again.";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function stopRecording() {
|
|
89
|
+
var _a;
|
|
90
|
+
(_a = mediaRecorder.value) == null ? void 0 : _a.stop();
|
|
91
|
+
if (timerRef.value) clearInterval(timerRef.value);
|
|
92
|
+
state.value = "recorded";
|
|
93
|
+
}
|
|
94
|
+
function discardRecording() {
|
|
95
|
+
if (videoUrl.value) URL.revokeObjectURL(videoUrl.value);
|
|
96
|
+
videoUrl.value = null;
|
|
97
|
+
duration.value = 0;
|
|
98
|
+
state.value = "idle";
|
|
99
|
+
}
|
|
100
|
+
function addRecording() {
|
|
101
|
+
if (!videoUrl.value) return;
|
|
102
|
+
fetch(videoUrl.value).then((r) => r.blob()).then((blob) => {
|
|
103
|
+
const file = new File([blob], `screen-recording-${Date.now()}.webm`, { type: blob.type });
|
|
104
|
+
setFiles([file]);
|
|
105
|
+
setActiveSource(void 0);
|
|
106
|
+
}).catch(() => {
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function retryRecording() {
|
|
110
|
+
error.value = null;
|
|
111
|
+
startRecording();
|
|
112
|
+
}
|
|
113
|
+
function formatTime(s) {
|
|
114
|
+
const m = Math.floor(s / 60);
|
|
115
|
+
const sec = s % 60;
|
|
116
|
+
return `${m}:${sec.toString().padStart(2, "0")}`;
|
|
117
|
+
}
|
|
118
|
+
const __returned__ = {
|
|
119
|
+
setFiles,
|
|
120
|
+
setActiveSource,
|
|
121
|
+
dark,
|
|
122
|
+
state,
|
|
123
|
+
duration,
|
|
124
|
+
videoUrl,
|
|
125
|
+
error,
|
|
126
|
+
mediaRecorder,
|
|
127
|
+
chunks,
|
|
128
|
+
timerRef,
|
|
129
|
+
streamRef,
|
|
130
|
+
videoRef,
|
|
131
|
+
get previewRef() {
|
|
132
|
+
return previewRef;
|
|
133
|
+
},
|
|
134
|
+
set previewRef(v) {
|
|
135
|
+
previewRef = v;
|
|
136
|
+
},
|
|
137
|
+
bindPreview,
|
|
138
|
+
startRecording,
|
|
139
|
+
stopRecording,
|
|
140
|
+
discardRecording,
|
|
141
|
+
addRecording,
|
|
142
|
+
retryRecording,
|
|
143
|
+
formatTime,
|
|
144
|
+
get cn() {
|
|
145
|
+
return cn;
|
|
146
|
+
},
|
|
147
|
+
SourceViewContainer: SourceViewContainer_default
|
|
148
|
+
};
|
|
149
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
150
|
+
enumerable: false,
|
|
151
|
+
value: true
|
|
152
|
+
});
|
|
153
|
+
return __returned__;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
var _hoisted_1 = { class: "upup-flex upup-flex-col upup-items-center upup-gap-3 upup-p-6 upup-text-center" };
|
|
157
|
+
var _hoisted_2 = { class: "upup-flex upup-h-full upup-w-full upup-flex-col upup-items-center upup-justify-center upup-gap-4 upup-p-4" };
|
|
158
|
+
var _hoisted_3 = {
|
|
159
|
+
key: 0,
|
|
160
|
+
class: "upup-flex upup-flex-col upup-items-center upup-gap-4"
|
|
161
|
+
};
|
|
162
|
+
var _hoisted_4 = { class: "upup-flex upup-h-20 upup-w-20 upup-items-center upup-justify-center upup-rounded-full upup-bg-[#0ea5e9]/20" };
|
|
163
|
+
var _hoisted_5 = ["stroke"];
|
|
164
|
+
var _hoisted_6 = { class: "upup-relative upup-flex upup-min-h-0 upup-w-full upup-max-w-md upup-flex-1" };
|
|
165
|
+
var _hoisted_7 = {
|
|
166
|
+
"data-upup-slot": "screen-rec-chip",
|
|
167
|
+
class: "upup-absolute upup-left-2.5 upup-top-2.5 upup-flex upup-items-center upup-gap-1.5 upup-rounded-md upup-bg-[#04080f]/60 upup-px-2 upup-py-1 upup-font-mono upup-text-[11px] upup-tabular-nums upup-text-[#fecdd3]"
|
|
168
|
+
};
|
|
169
|
+
var _hoisted_8 = ["src"];
|
|
170
|
+
var _hoisted_9 = { class: "upup-flex upup-gap-3" };
|
|
171
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
172
|
+
return _openBlock(), _createElementBlock(
|
|
173
|
+
_Fragment,
|
|
174
|
+
null,
|
|
175
|
+
[_createCommentVNode(" Error state "), $setup.error ? (_openBlock(), _createBlock($setup["SourceViewContainer"], {
|
|
176
|
+
key: 0,
|
|
177
|
+
"data-upup-slot": "screen-capture-uploader"
|
|
178
|
+
}, {
|
|
179
|
+
default: _withCtx(() => [_createElementVNode("div", _hoisted_1, [_createElementVNode(
|
|
180
|
+
"p",
|
|
181
|
+
{ class: _normalizeClass($setup.cn("upup-text-sm upup-text-red-500", { "upup-text-red-400": $setup.dark })) },
|
|
182
|
+
_toDisplayString($setup.error),
|
|
183
|
+
3
|
|
184
|
+
/* TEXT, CLASS */
|
|
185
|
+
), _createElementVNode(
|
|
186
|
+
"button",
|
|
187
|
+
{
|
|
188
|
+
type: "button",
|
|
189
|
+
class: _normalizeClass($setup.cn("upup-rounded-lg upup-bg-[#0ea5e9] upup-px-4 upup-py-2 upup-text-sm upup-font-medium upup-text-white", { "upup-bg-[#38bdf8] dark:upup-bg-[#38bdf8]": $setup.dark })),
|
|
190
|
+
onClick: $setup.retryRecording
|
|
191
|
+
},
|
|
192
|
+
" Try Again ",
|
|
193
|
+
2
|
|
194
|
+
/* CLASS */
|
|
195
|
+
)])]),
|
|
196
|
+
_: 1
|
|
197
|
+
})) : (_openBlock(), _createElementBlock(
|
|
198
|
+
_Fragment,
|
|
199
|
+
{ key: 1 },
|
|
200
|
+
[_createCommentVNode(" Normal state "), _createVNode($setup["SourceViewContainer"], { "data-upup-slot": "screen-capture-uploader" }, {
|
|
201
|
+
default: _withCtx(() => [_createElementVNode("div", _hoisted_2, [
|
|
202
|
+
_createCommentVNode(" Idle "),
|
|
203
|
+
$setup.state === "idle" ? (_openBlock(), _createElementBlock("div", _hoisted_3, [_createElementVNode("div", _hoisted_4, [(_openBlock(), _createElementBlock("svg", {
|
|
204
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
205
|
+
width: "32",
|
|
206
|
+
height: "32",
|
|
207
|
+
viewBox: "0 0 24 24",
|
|
208
|
+
fill: "none",
|
|
209
|
+
stroke: $setup.dark ? "#38bdf8" : "#0284c7",
|
|
210
|
+
"stroke-width": "2",
|
|
211
|
+
"stroke-linecap": "round",
|
|
212
|
+
"stroke-linejoin": "round"
|
|
213
|
+
}, [..._cache[0] || (_cache[0] = [
|
|
214
|
+
_createElementVNode(
|
|
215
|
+
"rect",
|
|
216
|
+
{
|
|
217
|
+
width: "20",
|
|
218
|
+
height: "15",
|
|
219
|
+
x: "2",
|
|
220
|
+
y: "3",
|
|
221
|
+
rx: "2"
|
|
222
|
+
},
|
|
223
|
+
null,
|
|
224
|
+
-1
|
|
225
|
+
/* CACHED */
|
|
226
|
+
),
|
|
227
|
+
_createElementVNode(
|
|
228
|
+
"polyline",
|
|
229
|
+
{ points: "8 21 16 21" },
|
|
230
|
+
null,
|
|
231
|
+
-1
|
|
232
|
+
/* CACHED */
|
|
233
|
+
),
|
|
234
|
+
_createElementVNode(
|
|
235
|
+
"line",
|
|
236
|
+
{
|
|
237
|
+
x1: "12",
|
|
238
|
+
x2: "12",
|
|
239
|
+
y1: "18",
|
|
240
|
+
y2: "21"
|
|
241
|
+
},
|
|
242
|
+
null,
|
|
243
|
+
-1
|
|
244
|
+
/* CACHED */
|
|
245
|
+
)
|
|
246
|
+
])], 8, _hoisted_5))]), _createElementVNode(
|
|
247
|
+
"button",
|
|
248
|
+
{
|
|
249
|
+
type: "button",
|
|
250
|
+
class: _normalizeClass($setup.cn("upup-rounded-lg upup-bg-[#0ea5e9] upup-px-6 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-[#0284c7]", { "upup-bg-[#38bdf8] hover:upup-bg-[#0ea5e9] dark:upup-bg-[#38bdf8]": $setup.dark })),
|
|
251
|
+
onClick: $setup.startRecording
|
|
252
|
+
},
|
|
253
|
+
" Share Screen ",
|
|
254
|
+
2
|
|
255
|
+
/* CLASS */
|
|
256
|
+
)])) : _createCommentVNode("v-if", true),
|
|
257
|
+
_createCommentVNode(" Recording "),
|
|
258
|
+
$setup.state === "recording" ? (_openBlock(), _createElementBlock(
|
|
259
|
+
_Fragment,
|
|
260
|
+
{ key: 1 },
|
|
261
|
+
[_createElementVNode("div", _hoisted_6, [
|
|
262
|
+
_createElementVNode(
|
|
263
|
+
"video",
|
|
264
|
+
{
|
|
265
|
+
ref: $setup.bindPreview,
|
|
266
|
+
muted: "",
|
|
267
|
+
class: "upup-min-h-0 upup-w-full upup-flex-1 upup-rounded-lg upup-object-contain"
|
|
268
|
+
},
|
|
269
|
+
null,
|
|
270
|
+
512
|
|
271
|
+
/* NEED_PATCH */
|
|
272
|
+
),
|
|
273
|
+
_createCommentVNode(" REC chip (states-tour-3 state E): red dot + label + timer.\r\n The dot's pulse is fx-gated \u2014 under motion-off the dot\r\n stays static so the recording status remains visible. "),
|
|
274
|
+
_createElementVNode("div", _hoisted_7, [_cache[1] || (_cache[1] = _createElementVNode(
|
|
275
|
+
"span",
|
|
276
|
+
{ class: "upup-animate-fx-rec-pulse upup-h-2 upup-w-2 upup-rounded-full upup-bg-red-500" },
|
|
277
|
+
null,
|
|
278
|
+
-1
|
|
279
|
+
/* CACHED */
|
|
280
|
+
)), _createTextVNode(
|
|
281
|
+
" REC " + _toDisplayString($setup.formatTime($setup.duration)),
|
|
282
|
+
1
|
|
283
|
+
/* TEXT */
|
|
284
|
+
)])
|
|
285
|
+
]), _createElementVNode("button", {
|
|
286
|
+
type: "button",
|
|
287
|
+
class: "upup-fx-press upup-rounded-lg upup-bg-red-500 upup-px-6 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-red-600",
|
|
288
|
+
onClick: $setup.stopRecording
|
|
289
|
+
}, " Stop Recording ")],
|
|
290
|
+
64
|
|
291
|
+
/* STABLE_FRAGMENT */
|
|
292
|
+
)) : _createCommentVNode("v-if", true),
|
|
293
|
+
_createCommentVNode(" Recorded "),
|
|
294
|
+
$setup.state === "recorded" && $setup.videoUrl ? (_openBlock(), _createElementBlock(
|
|
295
|
+
_Fragment,
|
|
296
|
+
{ key: 2 },
|
|
297
|
+
[_createElementVNode("video", {
|
|
298
|
+
ref: "videoRef",
|
|
299
|
+
controls: "",
|
|
300
|
+
src: $setup.videoUrl,
|
|
301
|
+
class: "upup-w-full upup-max-w-md upup-min-h-0 upup-flex-1 upup-rounded-lg upup-object-contain"
|
|
302
|
+
}, null, 8, _hoisted_8), _createElementVNode("div", _hoisted_9, [_createElementVNode("button", {
|
|
303
|
+
type: "button",
|
|
304
|
+
class: "upup-rounded-lg upup-bg-gray-500 upup-px-4 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-gray-600",
|
|
305
|
+
onClick: $setup.discardRecording
|
|
306
|
+
}, " Discard "), _createElementVNode(
|
|
307
|
+
"button",
|
|
308
|
+
{
|
|
309
|
+
type: "button",
|
|
310
|
+
class: _normalizeClass($setup.cn("upup-rounded-lg upup-bg-[#0ea5e9] upup-px-4 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-[#0284c7]", { "upup-bg-[#38bdf8] hover:upup-bg-[#0ea5e9] dark:upup-bg-[#38bdf8]": $setup.dark })),
|
|
311
|
+
onClick: $setup.addRecording
|
|
312
|
+
},
|
|
313
|
+
" Add Recording ",
|
|
314
|
+
2
|
|
315
|
+
/* CLASS */
|
|
316
|
+
)])],
|
|
317
|
+
64
|
|
318
|
+
/* STABLE_FRAGMENT */
|
|
319
|
+
)) : _createCommentVNode("v-if", true)
|
|
320
|
+
])]),
|
|
321
|
+
_: 1
|
|
322
|
+
})],
|
|
323
|
+
2112
|
|
324
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
325
|
+
))],
|
|
326
|
+
2112
|
|
327
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
var ScreenCaptureUploader_default = /* @__PURE__ */ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "C:\\Users\\amind\\OneDrive\\Desktop\\Projects\\INTERNAL\\upup\\packages\\vue\\src\\components\\ScreenCaptureUploader.vue"]]);
|
|
331
|
+
export {
|
|
332
|
+
ScreenCaptureUploader_default as default
|
|
333
|
+
};
|
|
334
|
+
//# sourceMappingURL=ScreenCaptureUploader-F65CM6OA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ScreenCaptureUploader.vue","../src/components/ScreenCaptureUploader.vue"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport { onUnmounted, ref, type ComponentPublicInstance } from 'vue'\r\nimport {\r\n useUploaderFiles,\r\n useUploaderSource,\r\n useUploaderTheme,\r\n} from '../context/uploader-context'\r\nimport { cn } from '@useupup/core/internal'\r\nimport SourceViewContainer from './shared/SourceViewContainer.vue'\r\n\r\ntype RecordingState = 'idle' | 'recording' | 'recorded'\r\n\r\nconst { setFiles } = useUploaderFiles()\r\nconst { setActiveSource } = useUploaderSource()\r\nconst { isDark: dark } = useUploaderTheme()\r\n\r\nconst state = ref<RecordingState>('idle')\r\nconst duration = ref(0)\r\nconst videoUrl = ref<string | null>(null)\r\nconst error = ref<string | null>(null)\r\n\r\nconst mediaRecorder = ref<MediaRecorder | null>(null)\r\nconst chunks: Blob[] = []\r\nconst timerRef = ref<ReturnType<typeof setInterval> | null>(null)\r\nconst streamRef = ref<MediaStream | null>(null)\r\nconst videoRef = ref<HTMLVideoElement | null>(null)\r\nlet previewRef: HTMLVideoElement | null = null\r\n\r\nonUnmounted(() => {\r\n if (timerRef.value) clearInterval(timerRef.value)\r\n if (videoUrl.value) URL.revokeObjectURL(videoUrl.value)\r\n streamRef.value?.getTracks().forEach(t => t.stop())\r\n})\r\n\r\nfunction bindPreview(el: Element | ComponentPublicInstance | null) {\r\n const video = el instanceof HTMLVideoElement ? el : null\r\n previewRef = video\r\n // Vue invokes a function ref on every component update, and the recording\r\n // timer re-renders this view once per second. Guard so we bind srcObject +\r\n // play() once per mount, not every tick — re-assigning srcObject restarts\r\n // the media element's load algorithm and visibly flickers the preview.\r\n if (video && streamRef.value && video.srcObject !== streamRef.value) {\r\n video.srcObject = streamRef.value\r\n void video.play()?.catch(() => {})\r\n }\r\n}\r\n\r\nasync function startRecording() {\r\n try {\r\n const stream = await navigator.mediaDevices.getDisplayMedia({\r\n video: true,\r\n audio: true,\r\n })\r\n streamRef.value = stream\r\n chunks.length = 0\r\n\r\n const [videoTrack] = stream.getVideoTracks()\r\n if (videoTrack) {\r\n videoTrack.onended = () => {\r\n if (mediaRecorder.value && mediaRecorder.value.state !== 'inactive') {\r\n mediaRecorder.value.stop()\r\n }\r\n if (timerRef.value) clearInterval(timerRef.value)\r\n state.value = 'recorded'\r\n }\r\n }\r\n\r\n const recorder = new MediaRecorder(stream)\r\n mediaRecorder.value = recorder\r\n\r\n recorder.ondataavailable = (e) => {\r\n if (e.data.size > 0) chunks.push(e.data)\r\n }\r\n\r\n recorder.onstop = () => {\r\n const blob = new Blob(chunks, { type: recorder.mimeType || 'video/webm' })\r\n videoUrl.value = URL.createObjectURL(blob)\r\n stream.getTracks().forEach(t => t.stop())\r\n if (previewRef) previewRef.srcObject = null\r\n }\r\n\r\n recorder.start()\r\n state.value = 'recording'\r\n duration.value = 0\r\n timerRef.value = setInterval(() => { duration.value++ }, 1000)\r\n } catch {\r\n error.value = 'Screen sharing was cancelled or denied. Please try again.'\r\n }\r\n}\r\n\r\nfunction stopRecording() {\r\n mediaRecorder.value?.stop()\r\n if (timerRef.value) clearInterval(timerRef.value)\r\n state.value = 'recorded'\r\n}\r\n\r\nfunction discardRecording() {\r\n if (videoUrl.value) URL.revokeObjectURL(videoUrl.value)\r\n videoUrl.value = null\r\n duration.value = 0\r\n state.value = 'idle'\r\n}\r\n\r\nfunction addRecording() {\r\n if (!videoUrl.value) return\r\n fetch(videoUrl.value)\r\n .then(r => r.blob())\r\n .then(blob => {\r\n const file = new File([blob], `screen-recording-${Date.now()}.webm`, { type: blob.type })\r\n setFiles([file])\r\n setActiveSource(undefined)\r\n })\r\n .catch(() => {\r\n // upup-catch: replaying an in-memory object URL cannot fail in practice; ignore\r\n })\r\n}\r\n\r\nfunction retryRecording() {\r\n error.value = null\r\n startRecording()\r\n}\r\n\r\nfunction formatTime(s: number) {\r\n const m = Math.floor(s / 60)\r\n const sec = s % 60\r\n return `${m}:${sec.toString().padStart(2, '0')}`\r\n}\r\n</script>\r\n\r\n<template>\r\n <!-- Error state -->\r\n <SourceViewContainer v-if=\"error\" data-upup-slot=\"screen-capture-uploader\">\r\n <div class=\"upup-flex upup-flex-col upup-items-center upup-gap-3 upup-p-6 upup-text-center\">\r\n <p\r\n :class=\"cn('upup-text-sm upup-text-red-500', {\r\n 'upup-text-red-400': dark,\r\n })\"\r\n >\r\n {{ error }}\r\n </p>\r\n <button\r\n type=\"button\"\r\n :class=\"cn(\r\n 'upup-rounded-lg upup-bg-[#0ea5e9] upup-px-4 upup-py-2 upup-text-sm upup-font-medium upup-text-white',\r\n {\r\n 'upup-bg-[#38bdf8] dark:upup-bg-[#38bdf8]': dark,\r\n },\r\n )\"\r\n @click=\"retryRecording\"\r\n >\r\n Try Again\r\n </button>\r\n </div>\r\n </SourceViewContainer>\r\n\r\n <!-- Normal state -->\r\n <SourceViewContainer v-else data-upup-slot=\"screen-capture-uploader\">\r\n <div class=\"upup-flex upup-h-full upup-w-full upup-flex-col upup-items-center upup-justify-center upup-gap-4 upup-p-4\">\r\n <!-- Idle -->\r\n <div v-if=\"state === 'idle'\" class=\"upup-flex upup-flex-col upup-items-center upup-gap-4\">\r\n <div class=\"upup-flex upup-h-20 upup-w-20 upup-items-center upup-justify-center upup-rounded-full upup-bg-[#0ea5e9]/20\">\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"32\"\r\n height=\"32\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n :stroke=\"dark ? '#38bdf8' : '#0284c7'\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n >\r\n <rect width=\"20\" height=\"15\" x=\"2\" y=\"3\" rx=\"2\" />\r\n <polyline points=\"8 21 16 21\" />\r\n <line x1=\"12\" x2=\"12\" y1=\"18\" y2=\"21\" />\r\n </svg>\r\n </div>\r\n <button\r\n type=\"button\"\r\n :class=\"cn(\r\n 'upup-rounded-lg upup-bg-[#0ea5e9] upup-px-6 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-[#0284c7]',\r\n {\r\n 'upup-bg-[#38bdf8] hover:upup-bg-[#0ea5e9] dark:upup-bg-[#38bdf8]': dark,\r\n },\r\n )\"\r\n @click=\"startRecording\"\r\n >\r\n Share Screen\r\n </button>\r\n </div>\r\n\r\n <!-- Recording -->\r\n <template v-if=\"state === 'recording'\">\r\n <div class=\"upup-relative upup-flex upup-min-h-0 upup-w-full upup-max-w-md upup-flex-1\">\r\n <video\r\n :ref=\"bindPreview\"\r\n muted\r\n class=\"upup-min-h-0 upup-w-full upup-flex-1 upup-rounded-lg upup-object-contain\"\r\n />\r\n <!-- REC chip (states-tour-3 state E): red dot + label + timer.\r\n The dot's pulse is fx-gated — under motion-off the dot\r\n stays static so the recording status remains visible. -->\r\n <div\r\n data-upup-slot=\"screen-rec-chip\"\r\n class=\"upup-absolute upup-left-2.5 upup-top-2.5 upup-flex upup-items-center upup-gap-1.5 upup-rounded-md upup-bg-[#04080f]/60 upup-px-2 upup-py-1 upup-font-mono upup-text-[11px] upup-tabular-nums upup-text-[#fecdd3]\"\r\n >\r\n <span class=\"upup-animate-fx-rec-pulse upup-h-2 upup-w-2 upup-rounded-full upup-bg-red-500\" />\r\n REC {{ formatTime(duration) }}\r\n </div>\r\n </div>\r\n <button\r\n type=\"button\"\r\n class=\"upup-fx-press upup-rounded-lg upup-bg-red-500 upup-px-6 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-red-600\"\r\n @click=\"stopRecording\"\r\n >\r\n Stop Recording\r\n </button>\r\n </template>\r\n\r\n <!-- Recorded -->\r\n <template v-if=\"state === 'recorded' && videoUrl\">\r\n <video\r\n ref=\"videoRef\"\r\n controls\r\n :src=\"videoUrl\"\r\n class=\"upup-w-full upup-max-w-md upup-min-h-0 upup-flex-1 upup-rounded-lg upup-object-contain\"\r\n />\r\n <div class=\"upup-flex upup-gap-3\">\r\n <button\r\n type=\"button\"\r\n class=\"upup-rounded-lg upup-bg-gray-500 upup-px-4 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-gray-600\"\r\n @click=\"discardRecording\"\r\n >\r\n Discard\r\n </button>\r\n <button\r\n type=\"button\"\r\n :class=\"cn(\r\n 'upup-rounded-lg upup-bg-[#0ea5e9] upup-px-4 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-[#0284c7]',\r\n {\r\n 'upup-bg-[#38bdf8] hover:upup-bg-[#0ea5e9] dark:upup-bg-[#38bdf8]': dark,\r\n },\r\n )\"\r\n @click=\"addRecording\"\r\n >\r\n Add Recording\r\n </button>\r\n </div>\r\n </template>\r\n </div>\r\n </SourceViewContainer>\r\n</template>\r\n","<script setup lang=\"ts\">\r\nimport { onUnmounted, ref, type ComponentPublicInstance } from 'vue'\r\nimport {\r\n useUploaderFiles,\r\n useUploaderSource,\r\n useUploaderTheme,\r\n} from '../context/uploader-context'\r\nimport { cn } from '@useupup/core/internal'\r\nimport SourceViewContainer from './shared/SourceViewContainer.vue'\r\n\r\ntype RecordingState = 'idle' | 'recording' | 'recorded'\r\n\r\nconst { setFiles } = useUploaderFiles()\r\nconst { setActiveSource } = useUploaderSource()\r\nconst { isDark: dark } = useUploaderTheme()\r\n\r\nconst state = ref<RecordingState>('idle')\r\nconst duration = ref(0)\r\nconst videoUrl = ref<string | null>(null)\r\nconst error = ref<string | null>(null)\r\n\r\nconst mediaRecorder = ref<MediaRecorder | null>(null)\r\nconst chunks: Blob[] = []\r\nconst timerRef = ref<ReturnType<typeof setInterval> | null>(null)\r\nconst streamRef = ref<MediaStream | null>(null)\r\nconst videoRef = ref<HTMLVideoElement | null>(null)\r\nlet previewRef: HTMLVideoElement | null = null\r\n\r\nonUnmounted(() => {\r\n if (timerRef.value) clearInterval(timerRef.value)\r\n if (videoUrl.value) URL.revokeObjectURL(videoUrl.value)\r\n streamRef.value?.getTracks().forEach(t => t.stop())\r\n})\r\n\r\nfunction bindPreview(el: Element | ComponentPublicInstance | null) {\r\n const video = el instanceof HTMLVideoElement ? el : null\r\n previewRef = video\r\n // Vue invokes a function ref on every component update, and the recording\r\n // timer re-renders this view once per second. Guard so we bind srcObject +\r\n // play() once per mount, not every tick — re-assigning srcObject restarts\r\n // the media element's load algorithm and visibly flickers the preview.\r\n if (video && streamRef.value && video.srcObject !== streamRef.value) {\r\n video.srcObject = streamRef.value\r\n void video.play()?.catch(() => {})\r\n }\r\n}\r\n\r\nasync function startRecording() {\r\n try {\r\n const stream = await navigator.mediaDevices.getDisplayMedia({\r\n video: true,\r\n audio: true,\r\n })\r\n streamRef.value = stream\r\n chunks.length = 0\r\n\r\n const [videoTrack] = stream.getVideoTracks()\r\n if (videoTrack) {\r\n videoTrack.onended = () => {\r\n if (mediaRecorder.value && mediaRecorder.value.state !== 'inactive') {\r\n mediaRecorder.value.stop()\r\n }\r\n if (timerRef.value) clearInterval(timerRef.value)\r\n state.value = 'recorded'\r\n }\r\n }\r\n\r\n const recorder = new MediaRecorder(stream)\r\n mediaRecorder.value = recorder\r\n\r\n recorder.ondataavailable = (e) => {\r\n if (e.data.size > 0) chunks.push(e.data)\r\n }\r\n\r\n recorder.onstop = () => {\r\n const blob = new Blob(chunks, { type: recorder.mimeType || 'video/webm' })\r\n videoUrl.value = URL.createObjectURL(blob)\r\n stream.getTracks().forEach(t => t.stop())\r\n if (previewRef) previewRef.srcObject = null\r\n }\r\n\r\n recorder.start()\r\n state.value = 'recording'\r\n duration.value = 0\r\n timerRef.value = setInterval(() => { duration.value++ }, 1000)\r\n } catch {\r\n error.value = 'Screen sharing was cancelled or denied. Please try again.'\r\n }\r\n}\r\n\r\nfunction stopRecording() {\r\n mediaRecorder.value?.stop()\r\n if (timerRef.value) clearInterval(timerRef.value)\r\n state.value = 'recorded'\r\n}\r\n\r\nfunction discardRecording() {\r\n if (videoUrl.value) URL.revokeObjectURL(videoUrl.value)\r\n videoUrl.value = null\r\n duration.value = 0\r\n state.value = 'idle'\r\n}\r\n\r\nfunction addRecording() {\r\n if (!videoUrl.value) return\r\n fetch(videoUrl.value)\r\n .then(r => r.blob())\r\n .then(blob => {\r\n const file = new File([blob], `screen-recording-${Date.now()}.webm`, { type: blob.type })\r\n setFiles([file])\r\n setActiveSource(undefined)\r\n })\r\n .catch(() => {\r\n // upup-catch: replaying an in-memory object URL cannot fail in practice; ignore\r\n })\r\n}\r\n\r\nfunction retryRecording() {\r\n error.value = null\r\n startRecording()\r\n}\r\n\r\nfunction formatTime(s: number) {\r\n const m = Math.floor(s / 60)\r\n const sec = s % 60\r\n return `${m}:${sec.toString().padStart(2, '0')}`\r\n}\r\n</script>\r\n\r\n<template>\r\n <!-- Error state -->\r\n <SourceViewContainer v-if=\"error\" data-upup-slot=\"screen-capture-uploader\">\r\n <div class=\"upup-flex upup-flex-col upup-items-center upup-gap-3 upup-p-6 upup-text-center\">\r\n <p\r\n :class=\"cn('upup-text-sm upup-text-red-500', {\r\n 'upup-text-red-400': dark,\r\n })\"\r\n >\r\n {{ error }}\r\n </p>\r\n <button\r\n type=\"button\"\r\n :class=\"cn(\r\n 'upup-rounded-lg upup-bg-[#0ea5e9] upup-px-4 upup-py-2 upup-text-sm upup-font-medium upup-text-white',\r\n {\r\n 'upup-bg-[#38bdf8] dark:upup-bg-[#38bdf8]': dark,\r\n },\r\n )\"\r\n @click=\"retryRecording\"\r\n >\r\n Try Again\r\n </button>\r\n </div>\r\n </SourceViewContainer>\r\n\r\n <!-- Normal state -->\r\n <SourceViewContainer v-else data-upup-slot=\"screen-capture-uploader\">\r\n <div class=\"upup-flex upup-h-full upup-w-full upup-flex-col upup-items-center upup-justify-center upup-gap-4 upup-p-4\">\r\n <!-- Idle -->\r\n <div v-if=\"state === 'idle'\" class=\"upup-flex upup-flex-col upup-items-center upup-gap-4\">\r\n <div class=\"upup-flex upup-h-20 upup-w-20 upup-items-center upup-justify-center upup-rounded-full upup-bg-[#0ea5e9]/20\">\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"32\"\r\n height=\"32\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n :stroke=\"dark ? '#38bdf8' : '#0284c7'\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n >\r\n <rect width=\"20\" height=\"15\" x=\"2\" y=\"3\" rx=\"2\" />\r\n <polyline points=\"8 21 16 21\" />\r\n <line x1=\"12\" x2=\"12\" y1=\"18\" y2=\"21\" />\r\n </svg>\r\n </div>\r\n <button\r\n type=\"button\"\r\n :class=\"cn(\r\n 'upup-rounded-lg upup-bg-[#0ea5e9] upup-px-6 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-[#0284c7]',\r\n {\r\n 'upup-bg-[#38bdf8] hover:upup-bg-[#0ea5e9] dark:upup-bg-[#38bdf8]': dark,\r\n },\r\n )\"\r\n @click=\"startRecording\"\r\n >\r\n Share Screen\r\n </button>\r\n </div>\r\n\r\n <!-- Recording -->\r\n <template v-if=\"state === 'recording'\">\r\n <div class=\"upup-relative upup-flex upup-min-h-0 upup-w-full upup-max-w-md upup-flex-1\">\r\n <video\r\n :ref=\"bindPreview\"\r\n muted\r\n class=\"upup-min-h-0 upup-w-full upup-flex-1 upup-rounded-lg upup-object-contain\"\r\n />\r\n <!-- REC chip (states-tour-3 state E): red dot + label + timer.\r\n The dot's pulse is fx-gated — under motion-off the dot\r\n stays static so the recording status remains visible. -->\r\n <div\r\n data-upup-slot=\"screen-rec-chip\"\r\n class=\"upup-absolute upup-left-2.5 upup-top-2.5 upup-flex upup-items-center upup-gap-1.5 upup-rounded-md upup-bg-[#04080f]/60 upup-px-2 upup-py-1 upup-font-mono upup-text-[11px] upup-tabular-nums upup-text-[#fecdd3]\"\r\n >\r\n <span class=\"upup-animate-fx-rec-pulse upup-h-2 upup-w-2 upup-rounded-full upup-bg-red-500\" />\r\n REC {{ formatTime(duration) }}\r\n </div>\r\n </div>\r\n <button\r\n type=\"button\"\r\n class=\"upup-fx-press upup-rounded-lg upup-bg-red-500 upup-px-6 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-red-600\"\r\n @click=\"stopRecording\"\r\n >\r\n Stop Recording\r\n </button>\r\n </template>\r\n\r\n <!-- Recorded -->\r\n <template v-if=\"state === 'recorded' && videoUrl\">\r\n <video\r\n ref=\"videoRef\"\r\n controls\r\n :src=\"videoUrl\"\r\n class=\"upup-w-full upup-max-w-md upup-min-h-0 upup-flex-1 upup-rounded-lg upup-object-contain\"\r\n />\r\n <div class=\"upup-flex upup-gap-3\">\r\n <button\r\n type=\"button\"\r\n class=\"upup-rounded-lg upup-bg-gray-500 upup-px-4 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-gray-600\"\r\n @click=\"discardRecording\"\r\n >\r\n Discard\r\n </button>\r\n <button\r\n type=\"button\"\r\n :class=\"cn(\r\n 'upup-rounded-lg upup-bg-[#0ea5e9] upup-px-4 upup-py-2.5 upup-text-sm upup-font-medium upup-text-white upup-transition-colors hover:upup-bg-[#0284c7]',\r\n {\r\n 'upup-bg-[#38bdf8] hover:upup-bg-[#0ea5e9] dark:upup-bg-[#38bdf8]': dark,\r\n },\r\n )\"\r\n @click=\"addRecording\"\r\n >\r\n Add Recording\r\n </button>\r\n </div>\r\n </template>\r\n </div>\r\n </SourceViewContainer>\r\n</template>\r\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