@multiplatform.one/components 9.0.1 → 9.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Chip/index.cjs +4 -3
- package/dist/cjs/Chip/index.native.js +4 -3
- package/dist/cjs/Chip/index.native.js.map +1 -1
- package/dist/cjs/DropdownMenu/index.cjs +44 -25
- package/dist/cjs/DropdownMenu/index.native.js +42 -21
- package/dist/cjs/DropdownMenu/index.native.js.map +1 -1
- package/dist/cjs/SheetModal/index.cjs +4 -3
- package/dist/cjs/appShell/AppShell.cjs +17 -12
- package/dist/cjs/appShell/AppShell.native.js +17 -12
- package/dist/cjs/appShell/AppShell.native.js.map +1 -1
- package/dist/cjs/code/PayloadView/index.cjs +4 -1
- package/dist/cjs/code/PayloadView/index.native.js +4 -1
- package/dist/cjs/code/PayloadView/index.native.js.map +1 -1
- package/dist/cjs/images/RemoteArt/index.native.js +3 -1
- package/dist/cjs/images/RemoteArt/index.native.js.map +1 -1
- package/dist/cjs/images/RemoteArt/svgMarkup.cjs +36 -28
- package/dist/cjs/images/RemoteArt/svgMarkup.native.js +66 -58
- package/dist/cjs/images/RemoteArt/svgMarkup.native.js.map +1 -1
- package/dist/cjs/layouts/AsyncBoundary.cjs +9 -8
- package/dist/cjs/layouts/AsyncBoundary.native.js +9 -8
- package/dist/cjs/layouts/AsyncBoundary.native.js.map +1 -1
- package/dist/cjs/views/Dashboard.cjs +44 -30
- package/dist/cjs/views/Dashboard.native.js +46 -28
- package/dist/cjs/views/Dashboard.native.js.map +1 -1
- package/dist/cjs/views/FilePreview.cjs +91 -48
- package/dist/cjs/views/FilePreview.native.js +98 -54
- package/dist/cjs/views/FilePreview.native.js.map +1 -1
- package/dist/cjs/views/ListGroup.cjs +68 -53
- package/dist/cjs/views/ListGroup.native.js +78 -61
- package/dist/cjs/views/ListGroup.native.js.map +1 -1
- package/dist/cjs/views/ListRow.cjs +2 -1
- package/dist/cjs/views/ListRow.native.js +2 -1
- package/dist/cjs/views/ListRow.native.js.map +1 -1
- package/dist/esm/Chip/index.mjs +4 -3
- package/dist/esm/Chip/index.mjs.map +1 -1
- package/dist/esm/Chip/index.native.js +4 -3
- package/dist/esm/Chip/index.native.js.map +1 -1
- package/dist/esm/DropdownMenu/index.mjs +44 -25
- package/dist/esm/DropdownMenu/index.mjs.map +1 -1
- package/dist/esm/DropdownMenu/index.native.js +42 -21
- package/dist/esm/DropdownMenu/index.native.js.map +1 -1
- package/dist/esm/SheetModal/index.mjs +4 -3
- package/dist/esm/SheetModal/index.mjs.map +1 -1
- package/dist/esm/appShell/AppShell.mjs +17 -12
- package/dist/esm/appShell/AppShell.mjs.map +1 -1
- package/dist/esm/appShell/AppShell.native.js +17 -12
- package/dist/esm/appShell/AppShell.native.js.map +1 -1
- package/dist/esm/code/PayloadView/index.mjs +4 -1
- package/dist/esm/code/PayloadView/index.mjs.map +1 -1
- package/dist/esm/code/PayloadView/index.native.js +4 -1
- package/dist/esm/code/PayloadView/index.native.js.map +1 -1
- package/dist/esm/images/RemoteArt/index.native.js +3 -1
- package/dist/esm/images/RemoteArt/index.native.js.map +1 -1
- package/dist/esm/images/RemoteArt/svgMarkup.mjs +36 -28
- package/dist/esm/images/RemoteArt/svgMarkup.mjs.map +1 -1
- package/dist/esm/images/RemoteArt/svgMarkup.native.js +66 -58
- package/dist/esm/images/RemoteArt/svgMarkup.native.js.map +1 -1
- package/dist/esm/layouts/AsyncBoundary.mjs +9 -8
- package/dist/esm/layouts/AsyncBoundary.mjs.map +1 -1
- package/dist/esm/layouts/AsyncBoundary.native.js +9 -8
- package/dist/esm/layouts/AsyncBoundary.native.js.map +1 -1
- package/dist/esm/views/Dashboard.mjs +44 -30
- package/dist/esm/views/Dashboard.mjs.map +1 -1
- package/dist/esm/views/Dashboard.native.js +46 -28
- package/dist/esm/views/Dashboard.native.js.map +1 -1
- package/dist/esm/views/FilePreview.mjs +91 -48
- package/dist/esm/views/FilePreview.mjs.map +1 -1
- package/dist/esm/views/FilePreview.native.js +98 -54
- package/dist/esm/views/FilePreview.native.js.map +1 -1
- package/dist/esm/views/ListGroup.mjs +69 -54
- package/dist/esm/views/ListGroup.mjs.map +1 -1
- package/dist/esm/views/ListGroup.native.js +79 -62
- package/dist/esm/views/ListGroup.native.js.map +1 -1
- package/dist/esm/views/ListRow.mjs +2 -1
- package/dist/esm/views/ListRow.mjs.map +1 -1
- package/dist/esm/views/ListRow.native.js +2 -1
- package/dist/esm/views/ListRow.native.js.map +1 -1
- package/dist/jsx/Chip/index.mjs +4 -3
- package/dist/jsx/Chip/index.mjs.map +1 -1
- package/dist/jsx/Chip/index.native.js +4 -3
- package/dist/jsx/Chip/index.native.js.map +1 -1
- package/dist/jsx/DropdownMenu/index.mjs +44 -25
- package/dist/jsx/DropdownMenu/index.mjs.map +1 -1
- package/dist/jsx/DropdownMenu/index.native.js +42 -21
- package/dist/jsx/DropdownMenu/index.native.js.map +1 -1
- package/dist/jsx/SheetModal/index.mjs +4 -3
- package/dist/jsx/SheetModal/index.mjs.map +1 -1
- package/dist/jsx/appShell/AppShell.mjs +17 -12
- package/dist/jsx/appShell/AppShell.mjs.map +1 -1
- package/dist/jsx/appShell/AppShell.native.js +17 -12
- package/dist/jsx/appShell/AppShell.native.js.map +1 -1
- package/dist/jsx/code/PayloadView/index.mjs +4 -1
- package/dist/jsx/code/PayloadView/index.mjs.map +1 -1
- package/dist/jsx/code/PayloadView/index.native.js +4 -1
- package/dist/jsx/code/PayloadView/index.native.js.map +1 -1
- package/dist/jsx/images/RemoteArt/index.native.js +3 -1
- package/dist/jsx/images/RemoteArt/index.native.js.map +1 -1
- package/dist/jsx/images/RemoteArt/svgMarkup.mjs +36 -28
- package/dist/jsx/images/RemoteArt/svgMarkup.mjs.map +1 -1
- package/dist/jsx/images/RemoteArt/svgMarkup.native.js +66 -58
- package/dist/jsx/images/RemoteArt/svgMarkup.native.js.map +1 -1
- package/dist/jsx/layouts/AsyncBoundary.mjs +9 -8
- package/dist/jsx/layouts/AsyncBoundary.mjs.map +1 -1
- package/dist/jsx/layouts/AsyncBoundary.native.js +9 -8
- package/dist/jsx/layouts/AsyncBoundary.native.js.map +1 -1
- package/dist/jsx/views/Dashboard.mjs +44 -30
- package/dist/jsx/views/Dashboard.mjs.map +1 -1
- package/dist/jsx/views/Dashboard.native.js +46 -28
- package/dist/jsx/views/Dashboard.native.js.map +1 -1
- package/dist/jsx/views/FilePreview.mjs +91 -48
- package/dist/jsx/views/FilePreview.mjs.map +1 -1
- package/dist/jsx/views/FilePreview.native.js +98 -54
- package/dist/jsx/views/FilePreview.native.js.map +1 -1
- package/dist/jsx/views/ListGroup.mjs +69 -54
- package/dist/jsx/views/ListGroup.mjs.map +1 -1
- package/dist/jsx/views/ListGroup.native.js +78 -61
- package/dist/jsx/views/ListGroup.native.js.map +1 -1
- package/dist/jsx/views/ListRow.mjs +2 -1
- package/dist/jsx/views/ListRow.mjs.map +1 -1
- package/dist/jsx/views/ListRow.native.js +2 -1
- package/dist/jsx/views/ListRow.native.js.map +1 -1
- package/package.json +7 -7
- package/src/Chip/index.tsx +2 -1
- package/src/DropdownMenu/index.tsx +39 -26
- package/src/SheetModal/index.tsx +2 -1
- package/src/SwipeDismissRow/SwipeDismissRow.stories.tsx +2 -1
- package/src/appShell/AppShell.stories.tsx +8 -11
- package/src/appShell/AppShell.tsx +8 -6
- package/src/code/PayloadView/index.tsx +4 -2
- package/src/images/RemoteArt/index.native.tsx +1 -1
- package/src/images/RemoteArt/svgMarkup.ts +56 -41
- package/src/layouts/AsyncBoundary.tsx +9 -5
- package/src/views/Dashboard.tsx +48 -40
- package/src/views/FilePreview.tsx +84 -46
- package/src/views/ListGroup.stories.tsx +1 -1
- package/src/views/ListGroup.tsx +99 -55
- package/src/views/ListRow.tsx +2 -1
- package/types/Chip/index.d.ts.map +1 -1
- package/types/DropdownMenu/index.d.ts.map +1 -1
- package/types/SheetModal/index.d.ts.map +1 -1
- package/types/appShell/AppShell.d.ts.map +1 -1
- package/types/layouts/AsyncBoundary.d.ts.map +1 -1
- package/types/views/Dashboard.d.ts.map +1 -1
- package/types/views/FilePreview.d.ts.map +1 -1
- package/types/views/ListGroup.d.ts.map +1 -1
- package/types/views/ListRow.d.ts.map +1 -1
|
@@ -121,6 +121,67 @@ function FileGlyph({
|
|
|
121
121
|
if (!isTextFile(file)) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.FileIcon, {});
|
|
122
122
|
return isProse(file) ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.FileTextIcon, {}) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.FileCodeIcon, {});
|
|
123
123
|
}
|
|
124
|
+
function useRowViewer(file, onOpen) {
|
|
125
|
+
const host = useFileViewerHost();
|
|
126
|
+
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
127
|
+
const show = () => {
|
|
128
|
+
if (onOpen) onOpen(file);else if (host) host.open(file);else setOpen(true);
|
|
129
|
+
};
|
|
130
|
+
const hostSelected = host?.file != null && fileKey(host.file) === fileKey(file);
|
|
131
|
+
return {
|
|
132
|
+
open,
|
|
133
|
+
setOpen,
|
|
134
|
+
show,
|
|
135
|
+
hostSelected,
|
|
136
|
+
owned: onOpen == null && host == null
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function FilePreviewWell({
|
|
140
|
+
file,
|
|
141
|
+
preview,
|
|
142
|
+
iconSize
|
|
143
|
+
}) {
|
|
144
|
+
const {
|
|
145
|
+
knobProps
|
|
146
|
+
} = (0, import_theme.useResolvedKnobs)();
|
|
147
|
+
const caption = knobProps.textRole.caption;
|
|
148
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_tamagui.XStack, {
|
|
149
|
+
...knobProps.gap,
|
|
150
|
+
paddingBottom: "$1",
|
|
151
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
|
|
152
|
+
flexShrink: 0,
|
|
153
|
+
width: file.thumbnail ? "$true" : iconSize
|
|
154
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
155
|
+
"aria-hidden": true,
|
|
156
|
+
flex: 1,
|
|
157
|
+
minWidth: 0,
|
|
158
|
+
backgroundColor: "$backgroundPress",
|
|
159
|
+
borderRadius: knobProps.borderRadius.borderRadius,
|
|
160
|
+
borderWidth: 0,
|
|
161
|
+
paddingHorizontal: "$3",
|
|
162
|
+
paddingVertical: "$2",
|
|
163
|
+
overflow: "hidden",
|
|
164
|
+
...{
|
|
165
|
+
"data-file-preview": "",
|
|
166
|
+
"data-code-well": ""
|
|
167
|
+
},
|
|
168
|
+
children: preview.map((line, index) => /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.Text, {
|
|
169
|
+
fontFamily: "$mono",
|
|
170
|
+
letterSpacing: 0,
|
|
171
|
+
fontSize: caption.fontSize,
|
|
172
|
+
lineHeight: caption.lineHeight,
|
|
173
|
+
color: caption.color,
|
|
174
|
+
numberOfLines: 1,
|
|
175
|
+
whiteSpace: "pre",
|
|
176
|
+
userSelect: "none",
|
|
177
|
+
...{
|
|
178
|
+
"data-preview-line": ""
|
|
179
|
+
},
|
|
180
|
+
children: line || " "
|
|
181
|
+
}, index))
|
|
182
|
+
})]
|
|
183
|
+
});
|
|
184
|
+
}
|
|
124
185
|
function FilePreviewRow({
|
|
125
186
|
file,
|
|
126
187
|
onOpen,
|
|
@@ -132,18 +193,28 @@ function FilePreviewRow({
|
|
|
132
193
|
const {
|
|
133
194
|
knobProps
|
|
134
195
|
} = (0, import_theme.useResolvedKnobs)();
|
|
135
|
-
const
|
|
136
|
-
|
|
196
|
+
const {
|
|
197
|
+
open,
|
|
198
|
+
setOpen,
|
|
199
|
+
show,
|
|
200
|
+
hostSelected,
|
|
201
|
+
owned
|
|
202
|
+
} = useRowViewer(file, onOpen);
|
|
137
203
|
const preview = filePreviewLines(file, lines);
|
|
138
204
|
const viewable = isViewableFile(file);
|
|
139
|
-
const owned = onOpen == null && host == null;
|
|
140
205
|
const iconSize = (0, import_ListRow.listLeadingIconSize)(knobProps.sizeToken);
|
|
141
|
-
const caption = knobProps.textRole.caption;
|
|
142
206
|
let press;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
207
|
+
let action = "none";
|
|
208
|
+
let TrailingIcon = null;
|
|
209
|
+
if (viewable) {
|
|
210
|
+
press = show;
|
|
211
|
+
action = "view";
|
|
212
|
+
TrailingIcon = import_react.CaretRightIcon;
|
|
213
|
+
} else if (onDownload) {
|
|
214
|
+
press = () => onDownload(file);
|
|
215
|
+
action = "download";
|
|
216
|
+
TrailingIcon = import_react.DownloadSimpleIcon;
|
|
217
|
+
}
|
|
147
218
|
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
148
219
|
children: [/* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_ListGroup.ListGroupItem, {
|
|
149
220
|
onPress: press,
|
|
@@ -151,7 +222,7 @@ function FilePreviewRow({
|
|
|
151
222
|
"aria-label": file.meta ? `${file.name}, ${file.meta}` : file.name,
|
|
152
223
|
...{
|
|
153
224
|
"data-file-row": preview.length ? "preview" : "plain",
|
|
154
|
-
"data-file-action":
|
|
225
|
+
"data-file-action": action
|
|
155
226
|
},
|
|
156
227
|
children: [Array.from({
|
|
157
228
|
length: indent
|
|
@@ -174,41 +245,10 @@ function FilePreviewRow({
|
|
|
174
245
|
title: file.name,
|
|
175
246
|
subtitle: file.meta
|
|
176
247
|
})
|
|
177
|
-
}), preview.length ? /* @__PURE__ */(0, import_jsx_runtime.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
flexShrink: 0,
|
|
182
|
-
width: file.thumbnail ? "$true" : iconSize
|
|
183
|
-
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
184
|
-
"aria-hidden": true,
|
|
185
|
-
flex: 1,
|
|
186
|
-
minWidth: 0,
|
|
187
|
-
backgroundColor: "$backgroundPress",
|
|
188
|
-
borderRadius: knobProps.borderRadius.borderRadius,
|
|
189
|
-
borderWidth: 0,
|
|
190
|
-
paddingHorizontal: "$3",
|
|
191
|
-
paddingVertical: "$2",
|
|
192
|
-
overflow: "hidden",
|
|
193
|
-
...{
|
|
194
|
-
"data-file-preview": "",
|
|
195
|
-
"data-code-well": ""
|
|
196
|
-
},
|
|
197
|
-
children: preview.map((line, index) => /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.Text, {
|
|
198
|
-
fontFamily: "$mono",
|
|
199
|
-
letterSpacing: 0,
|
|
200
|
-
fontSize: caption.fontSize,
|
|
201
|
-
lineHeight: caption.lineHeight,
|
|
202
|
-
color: caption.color,
|
|
203
|
-
numberOfLines: 1,
|
|
204
|
-
whiteSpace: "pre",
|
|
205
|
-
userSelect: "none",
|
|
206
|
-
...{
|
|
207
|
-
"data-preview-line": ""
|
|
208
|
-
},
|
|
209
|
-
children: line || " "
|
|
210
|
-
}, index))
|
|
211
|
-
})]
|
|
248
|
+
}), preview.length ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(FilePreviewWell, {
|
|
249
|
+
file,
|
|
250
|
+
preview,
|
|
251
|
+
iconSize
|
|
212
252
|
}) : null]
|
|
213
253
|
}), TrailingIcon ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ListRow.ListRowMeta, {
|
|
214
254
|
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(TrailingIcon, {
|
|
@@ -269,10 +309,10 @@ function shareFile(file, text) {
|
|
|
269
309
|
URL.revokeObjectURL(href);
|
|
270
310
|
return;
|
|
271
311
|
}
|
|
272
|
-
|
|
312
|
+
import_react_native.Share.share({
|
|
273
313
|
title: file.name,
|
|
274
314
|
message: text
|
|
275
|
-
}).catch(() =>
|
|
315
|
+
}).catch(() => void 0);
|
|
276
316
|
}
|
|
277
317
|
function withBreaks(content) {
|
|
278
318
|
if (!import_tamagui.isWeb || !/[/:,=&?]/.test(content)) return content;
|
|
@@ -357,6 +397,7 @@ function useFileViewerParts(file, open, onClose) {
|
|
|
357
397
|
} = (0, import_theme.useResolvedKnobs)();
|
|
358
398
|
const {
|
|
359
399
|
region,
|
|
400
|
+
report,
|
|
360
401
|
copy
|
|
361
402
|
} = (0, import_copy.useCopyFeedback)();
|
|
362
403
|
const {
|
|
@@ -370,14 +411,16 @@ function useFileViewerParts(file, open, onClose) {
|
|
|
370
411
|
key: "copy",
|
|
371
412
|
icon: import_react.CopyIcon,
|
|
372
413
|
label: t("Copy"),
|
|
373
|
-
onPress: () =>
|
|
414
|
+
onPress: () => {
|
|
415
|
+
copy(text).catch(() => report(false));
|
|
416
|
+
}
|
|
374
417
|
}, {
|
|
375
418
|
key: "share",
|
|
376
419
|
icon: import_react.ShareNetworkIcon,
|
|
377
420
|
label: t("Share"),
|
|
378
421
|
onPress: () => shareFile(file, text)
|
|
379
422
|
}];
|
|
380
|
-
}, [copy, file, t, text]);
|
|
423
|
+
}, [copy, file, report, t, text]);
|
|
381
424
|
if (!file) return null;
|
|
382
425
|
const title = /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_tamagui.YStack, {
|
|
383
426
|
flex: 1,
|
|
@@ -129,6 +129,70 @@ function FileGlyph(param) {
|
|
|
129
129
|
if (!isTextFile(file)) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.FileIcon, {});
|
|
130
130
|
return isProse(file) ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.FileTextIcon, {}) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.FileCodeIcon, {});
|
|
131
131
|
}
|
|
132
|
+
function useRowViewer(file, onOpen) {
|
|
133
|
+
var host = useFileViewerHost();
|
|
134
|
+
var [open, setOpen] = (0, import_react2.useState)(false);
|
|
135
|
+
var show = function show2() {
|
|
136
|
+
if (onOpen) onOpen(file);else if (host) host.open(file);else setOpen(true);
|
|
137
|
+
};
|
|
138
|
+
var hostSelected = (host === null || host === void 0 ? void 0 : host.file) != null && fileKey(host.file) === fileKey(file);
|
|
139
|
+
return {
|
|
140
|
+
open,
|
|
141
|
+
setOpen,
|
|
142
|
+
show,
|
|
143
|
+
hostSelected,
|
|
144
|
+
owned: onOpen == null && host == null
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function FilePreviewWell(param) {
|
|
148
|
+
var {
|
|
149
|
+
file,
|
|
150
|
+
preview,
|
|
151
|
+
iconSize
|
|
152
|
+
} = param;
|
|
153
|
+
var {
|
|
154
|
+
knobProps
|
|
155
|
+
} = (0, import_theme.useResolvedKnobs)();
|
|
156
|
+
var caption = knobProps.textRole.caption;
|
|
157
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_tamagui.XStack, {
|
|
158
|
+
...knobProps.gap,
|
|
159
|
+
paddingBottom: "$1",
|
|
160
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.View, {
|
|
161
|
+
flexShrink: 0,
|
|
162
|
+
width: file.thumbnail ? "$true" : iconSize
|
|
163
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
164
|
+
"aria-hidden": true,
|
|
165
|
+
flex: 1,
|
|
166
|
+
minWidth: 0,
|
|
167
|
+
backgroundColor: "$backgroundPress",
|
|
168
|
+
borderRadius: knobProps.borderRadius.borderRadius,
|
|
169
|
+
borderWidth: 0,
|
|
170
|
+
paddingHorizontal: "$3",
|
|
171
|
+
paddingVertical: "$2",
|
|
172
|
+
overflow: "hidden",
|
|
173
|
+
...{
|
|
174
|
+
"data-file-preview": "",
|
|
175
|
+
"data-code-well": ""
|
|
176
|
+
},
|
|
177
|
+
children: preview.map(function (line, index) {
|
|
178
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.Text, {
|
|
179
|
+
fontFamily: "$mono",
|
|
180
|
+
letterSpacing: 0,
|
|
181
|
+
fontSize: caption.fontSize,
|
|
182
|
+
lineHeight: caption.lineHeight,
|
|
183
|
+
color: caption.color,
|
|
184
|
+
numberOfLines: 1,
|
|
185
|
+
whiteSpace: "pre",
|
|
186
|
+
userSelect: "none",
|
|
187
|
+
...{
|
|
188
|
+
"data-preview-line": ""
|
|
189
|
+
},
|
|
190
|
+
children: line || " "
|
|
191
|
+
}, index);
|
|
192
|
+
})
|
|
193
|
+
})]
|
|
194
|
+
});
|
|
195
|
+
}
|
|
132
196
|
function FilePreviewRow(param) {
|
|
133
197
|
var {
|
|
134
198
|
file,
|
|
@@ -141,22 +205,30 @@ function FilePreviewRow(param) {
|
|
|
141
205
|
var {
|
|
142
206
|
knobProps
|
|
143
207
|
} = (0, import_theme.useResolvedKnobs)();
|
|
144
|
-
var
|
|
145
|
-
|
|
208
|
+
var {
|
|
209
|
+
open,
|
|
210
|
+
setOpen,
|
|
211
|
+
show,
|
|
212
|
+
hostSelected,
|
|
213
|
+
owned
|
|
214
|
+
} = useRowViewer(file, onOpen);
|
|
146
215
|
var preview = filePreviewLines(file, lines);
|
|
147
216
|
var viewable = isViewableFile(file);
|
|
148
|
-
var owned = onOpen == null && host == null;
|
|
149
217
|
var iconSize = (0, import_ListRow.listLeadingIconSize)(knobProps.sizeToken);
|
|
150
|
-
var caption = knobProps.textRole.caption;
|
|
151
218
|
var press;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
219
|
+
var action = "none";
|
|
220
|
+
var TrailingIcon = null;
|
|
221
|
+
if (viewable) {
|
|
222
|
+
press = show;
|
|
223
|
+
action = "view";
|
|
224
|
+
TrailingIcon = import_react.CaretRightIcon;
|
|
225
|
+
} else if (onDownload) {
|
|
226
|
+
press = function press2() {
|
|
227
|
+
return onDownload(file);
|
|
228
|
+
};
|
|
229
|
+
action = "download";
|
|
230
|
+
TrailingIcon = import_react.DownloadSimpleIcon;
|
|
231
|
+
}
|
|
160
232
|
return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
161
233
|
children: [/* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_ListGroup.ListGroupItem, {
|
|
162
234
|
onPress: press,
|
|
@@ -164,7 +236,7 @@ function FilePreviewRow(param) {
|
|
|
164
236
|
"aria-label": file.meta ? `${file.name}, ${file.meta}` : file.name,
|
|
165
237
|
...{
|
|
166
238
|
"data-file-row": preview.length ? "preview" : "plain",
|
|
167
|
-
"data-file-action":
|
|
239
|
+
"data-file-action": action
|
|
168
240
|
},
|
|
169
241
|
children: [Array.from({
|
|
170
242
|
length: indent
|
|
@@ -189,43 +261,10 @@ function FilePreviewRow(param) {
|
|
|
189
261
|
title: file.name,
|
|
190
262
|
subtitle: file.meta
|
|
191
263
|
})
|
|
192
|
-
}), preview.length ? /* @__PURE__ */(0, import_jsx_runtime.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
flexShrink: 0,
|
|
197
|
-
width: file.thumbnail ? "$true" : iconSize
|
|
198
|
-
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
199
|
-
"aria-hidden": true,
|
|
200
|
-
flex: 1,
|
|
201
|
-
minWidth: 0,
|
|
202
|
-
backgroundColor: "$backgroundPress",
|
|
203
|
-
borderRadius: knobProps.borderRadius.borderRadius,
|
|
204
|
-
borderWidth: 0,
|
|
205
|
-
paddingHorizontal: "$3",
|
|
206
|
-
paddingVertical: "$2",
|
|
207
|
-
overflow: "hidden",
|
|
208
|
-
...{
|
|
209
|
-
"data-file-preview": "",
|
|
210
|
-
"data-code-well": ""
|
|
211
|
-
},
|
|
212
|
-
children: preview.map(function (line, index) {
|
|
213
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_tamagui.Text, {
|
|
214
|
-
fontFamily: "$mono",
|
|
215
|
-
letterSpacing: 0,
|
|
216
|
-
fontSize: caption.fontSize,
|
|
217
|
-
lineHeight: caption.lineHeight,
|
|
218
|
-
color: caption.color,
|
|
219
|
-
numberOfLines: 1,
|
|
220
|
-
whiteSpace: "pre",
|
|
221
|
-
userSelect: "none",
|
|
222
|
-
...{
|
|
223
|
-
"data-preview-line": ""
|
|
224
|
-
},
|
|
225
|
-
children: line || " "
|
|
226
|
-
}, index);
|
|
227
|
-
})
|
|
228
|
-
})]
|
|
264
|
+
}), preview.length ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(FilePreviewWell, {
|
|
265
|
+
file,
|
|
266
|
+
preview,
|
|
267
|
+
iconSize
|
|
229
268
|
}) : null]
|
|
230
269
|
}), TrailingIcon ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ListRow.ListRowMeta, {
|
|
231
270
|
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(TrailingIcon, {
|
|
@@ -290,10 +329,12 @@ function shareFile(file, text) {
|
|
|
290
329
|
URL.revokeObjectURL(href);
|
|
291
330
|
return;
|
|
292
331
|
}
|
|
293
|
-
|
|
332
|
+
import_react_native.Share.share({
|
|
294
333
|
title: file.name,
|
|
295
334
|
message: text
|
|
296
|
-
}).catch(function () {
|
|
335
|
+
}).catch(function () {
|
|
336
|
+
return void 0;
|
|
337
|
+
});
|
|
297
338
|
}
|
|
298
339
|
function withBreaks(content) {
|
|
299
340
|
var _pieces_;
|
|
@@ -391,6 +432,7 @@ function useFileViewerParts(file, open, onClose) {
|
|
|
391
432
|
} = (0, import_theme.useResolvedKnobs)();
|
|
392
433
|
var {
|
|
393
434
|
region,
|
|
435
|
+
report,
|
|
394
436
|
copy
|
|
395
437
|
} = (0, import_copy.useCopyFeedback)();
|
|
396
438
|
var {
|
|
@@ -405,7 +447,9 @@ function useFileViewerParts(file, open, onClose) {
|
|
|
405
447
|
icon: import_react.CopyIcon,
|
|
406
448
|
label: t("Copy"),
|
|
407
449
|
onPress: function onPress() {
|
|
408
|
-
|
|
450
|
+
copy(text).catch(function () {
|
|
451
|
+
return report(false);
|
|
452
|
+
});
|
|
409
453
|
}
|
|
410
454
|
}, {
|
|
411
455
|
key: "share",
|
|
@@ -415,7 +459,7 @@ function useFileViewerParts(file, open, onClose) {
|
|
|
415
459
|
return shareFile(file, text);
|
|
416
460
|
}
|
|
417
461
|
}];
|
|
418
|
-
}, [copy, file, t, text]);
|
|
462
|
+
}, [copy, file, report, t, text]);
|
|
419
463
|
if (!file) return null;
|
|
420
464
|
var title = /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_tamagui.YStack, {
|
|
421
465
|
flex: 1,
|