vitepress-plugin-filelist 0.6.1 → 0.6.2

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 CHANGED
@@ -134,7 +134,7 @@ interface FileListSource {
134
134
 
135
135
  - Chrome / Edge(含较新的 Android Chrome):点“下载 ZIP”先弹出系统“另存为”窗口,之后边下载边写入,内存占用很小,不受大小限制
136
136
  - Firefox、Safari、iPhone:浏览器只能先把文件放进内存再打包。按已选总大小判断:超过 `zipWarnSize` 先确认,超过 `zipMaxSize` 不打包并建议分批
137
- - 打包期间操作条显示进度(大小与文件数),可随时取消;勾选暂时锁定。任一文件失败会整体取消并提示文件名
137
+ - 打包期间操作条显示进度(大小与文件数),可随时取消;勾选暂时锁定。任一文件失败会整体取消,并弹窗说明是哪个文件、什么原因
138
138
  - 同时取 4 个文件(顺序不变),减少每个文件的网络等待;进度每 100 ms 更新一次
139
139
  - ZIP 只存储不压缩(网盘文件多为已压缩格式),支持超过 4 GB(Zip64)
140
140
 
@@ -92,6 +92,9 @@ interface FileListLabels {
92
92
  unlockFolder: string;
93
93
  /** @deprecated Network failures now append `corsHint`. */
94
94
  networkHint: string;
95
+ /** Title of the dialog when a batch ZIP fails (the reason is the text). */
96
+ batchFailedTitle: string;
97
+ batchFailedHint: string;
95
98
  /** Single file handed to the browser's download manager. `{name}` */
96
99
  downloadStarted: string;
97
100
  /** Batch progress detail. `{done}` `{total}` sizes, `{files}` `{count}` file counts */
@@ -899,6 +899,8 @@ const fileListLocales = {
899
899
  forgetPassword: "忘记",
900
900
  unlockFolder: "输入 {name} 的密码",
901
901
  networkHint: "可能被跨域拦截:请检查 OpenList 的 cors.allow_origins,或 OpenList-Worker 的 ALLOW_URLS。",
902
+ batchFailedTitle: "打包失败",
903
+ batchFailedHint: "可以减少勾选的文件后重试。",
902
904
  downloadStarted: "已交给浏览器下载:{name}",
903
905
  batchProgress: "{done} / {total} · {files} / {count} 个文件",
904
906
  batchDone: "已打包 {name}({count} 个文件,{size})",
@@ -977,6 +979,8 @@ const fileListLocales = {
977
979
  forgetPassword: "Forget",
978
980
  unlockFolder: "Enter the password for {name}",
979
981
  networkHint: "Possibly blocked by CORS: check cors.allow_origins in OpenList, or ALLOW_URLS in OpenList-Worker.",
982
+ batchFailedTitle: "Could not create the ZIP",
983
+ batchFailedHint: "Try again with fewer files selected.",
980
984
  downloadStarted: "Downloading {name} in your browser",
981
985
  batchProgress: "{done} / {total} · {files} / {count} files",
982
986
  batchDone: "Saved {name} ({count} files, {size})",
@@ -2298,9 +2302,28 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2298
2302
  max: bytes(props.zipMaxSize, touch ? 1024 : 2048)
2299
2303
  };
2300
2304
  }
2305
+ /** A ZIP question or notice: over the warning size, over the limit, or failed. */
2301
2306
  const zipNotice = ref(null);
2302
2307
  /** Only desktop browsers get “use Chrome or Edge”; on iPhone every browser is Safari. */
2303
2308
  const zipTip = computed(() => typeof window !== "undefined" && !window.matchMedia?.("(pointer: coarse)").matches ? t("zipStreamTip") : "");
2309
+ const zipDialog = computed(() => {
2310
+ const notice = zipNotice.value;
2311
+ if (!notice) return null;
2312
+ if (notice.kind === "failed") return {
2313
+ title: t("batchFailedTitle"),
2314
+ text: notice.message,
2315
+ tip: t("batchFailedHint"),
2316
+ cancel: t("gotIt")
2317
+ };
2318
+ const warn = notice.kind === "warn";
2319
+ return {
2320
+ title: t(warn ? "zipWarnTitle" : "zipBlockTitle", { size: formatSize(notice.size) }),
2321
+ text: t(warn ? "zipWarnText" : "zipBlockText", { limit: formatSize(notice.limit) }),
2322
+ tip: zipTip.value,
2323
+ confirm: warn ? t("zipContinue") : void 0,
2324
+ cancel: warn ? t("cancel") : t("gotIt")
2325
+ };
2326
+ });
2304
2327
  function zipName() {
2305
2328
  return zipFileName(props.title || t("defaultZip"));
2306
2329
  }
@@ -2369,7 +2392,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2369
2392
  }));
2370
2393
  selected.value = /* @__PURE__ */ new Set();
2371
2394
  } catch (error) {
2372
- showToast(controller.signal.aborted ? t("batchCanceled") : t("batchFailed", { message: errorText(error) }));
2395
+ if (controller.signal.aborted) showToast(t("batchCanceled"));
2396
+ else zipNotice.value = {
2397
+ kind: "failed",
2398
+ message: errorText(error)
2399
+ };
2373
2400
  } finally {
2374
2401
  zipAbort = null;
2375
2402
  batchBusy.value = false;
@@ -2817,12 +2844,12 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2817
2844
  createElementVNode("div", _hoisted_73, [createElementVNode("span", null, toDisplayString(t("loaded", { count: allFiles.value.length })) + " · " + toDisplayString(t("totalSize", { size: unref(formatSize)(unref(totalSize)(allFiles.value)) })), 1)]),
2818
2845
  toast.value ? (openBlock(), createElementBlock("div", _hoisted_74, toDisplayString(toast.value), 1)) : createCommentVNode("v-if", true),
2819
2846
  createVNode(_sfc_main$3, {
2820
- open: !!zipNotice.value,
2821
- title: zipNotice.value ? t(zipNotice.value.kind === "warn" ? "zipWarnTitle" : "zipBlockTitle", { size: unref(formatSize)(zipNotice.value.size) }) : "",
2822
- text: zipNotice.value ? t(zipNotice.value.kind === "warn" ? "zipWarnText" : "zipBlockText", { limit: unref(formatSize)(zipNotice.value.limit) }) : "",
2823
- tip: zipTip.value,
2824
- "confirm-label": zipNotice.value?.kind === "warn" ? t("zipContinue") : void 0,
2825
- "cancel-label": zipNotice.value?.kind === "warn" ? t("cancel") : t("gotIt"),
2847
+ open: !!zipDialog.value,
2848
+ title: zipDialog.value?.title ?? "",
2849
+ text: zipDialog.value?.text ?? "",
2850
+ tip: zipDialog.value?.tip,
2851
+ "confirm-label": zipDialog.value?.confirm,
2852
+ "cancel-label": zipDialog.value?.cancel ?? "",
2826
2853
  onConfirm: confirmZip,
2827
2854
  onClose: _cache[4] || (_cache[4] = ($event) => zipNotice.value = null)
2828
2855
  }, null, 8, [
@@ -92,6 +92,9 @@ interface FileListLabels {
92
92
  unlockFolder: string;
93
93
  /** @deprecated Network failures now append `corsHint`. */
94
94
  networkHint: string;
95
+ /** Title of the dialog when a batch ZIP fails (the reason is the text). */
96
+ batchFailedTitle: string;
97
+ batchFailedHint: string;
95
98
  /** Single file handed to the browser's download manager. `{name}` */
96
99
  downloadStarted: string;
97
100
  /** Batch progress detail. `{done}` `{total}` sizes, `{files}` `{count}` file counts */
@@ -852,6 +852,8 @@ const fileListLocales = {
852
852
  forgetPassword: "忘记",
853
853
  unlockFolder: "输入 {name} 的密码",
854
854
  networkHint: "可能被跨域拦截:请检查 OpenList 的 cors.allow_origins,或 OpenList-Worker 的 ALLOW_URLS。",
855
+ batchFailedTitle: "打包失败",
856
+ batchFailedHint: "可以减少勾选的文件后重试。",
855
857
  downloadStarted: "已交给浏览器下载:{name}",
856
858
  batchProgress: "{done} / {total} · {files} / {count} 个文件",
857
859
  batchDone: "已打包 {name}({count} 个文件,{size})",
@@ -930,6 +932,8 @@ const fileListLocales = {
930
932
  forgetPassword: "Forget",
931
933
  unlockFolder: "Enter the password for {name}",
932
934
  networkHint: "Possibly blocked by CORS: check cors.allow_origins in OpenList, or ALLOW_URLS in OpenList-Worker.",
935
+ batchFailedTitle: "Could not create the ZIP",
936
+ batchFailedHint: "Try again with fewer files selected.",
933
937
  downloadStarted: "Downloading {name} in your browser",
934
938
  batchProgress: "{done} / {total} · {files} / {count} files",
935
939
  batchDone: "Saved {name} ({count} files, {size})",
@@ -1750,9 +1754,28 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
1750
1754
  showToast(t("downloadFailed", { message: errorText(error) }));
1751
1755
  }
1752
1756
  }
1757
+ /** A ZIP question or notice: over the warning size, over the limit, or failed. */
1753
1758
  const zipNotice = ref(null);
1754
1759
  /** Only desktop browsers get “use Chrome or Edge”; on iPhone every browser is Safari. */
1755
1760
  const zipTip = computed(() => typeof window !== "undefined" && !window.matchMedia?.("(pointer: coarse)").matches ? t("zipStreamTip") : "");
1761
+ const zipDialog = computed(() => {
1762
+ const notice = zipNotice.value;
1763
+ if (!notice) return null;
1764
+ if (notice.kind === "failed") return {
1765
+ title: t("batchFailedTitle"),
1766
+ text: notice.message,
1767
+ tip: t("batchFailedHint"),
1768
+ cancel: t("gotIt")
1769
+ };
1770
+ const warn = notice.kind === "warn";
1771
+ return {
1772
+ title: t(warn ? "zipWarnTitle" : "zipBlockTitle", { size: formatSize(notice.size) }),
1773
+ text: t(warn ? "zipWarnText" : "zipBlockText", { limit: formatSize(notice.limit) }),
1774
+ tip: zipTip.value,
1775
+ confirm: warn ? t("zipContinue") : void 0,
1776
+ cancel: warn ? t("cancel") : t("gotIt")
1777
+ };
1778
+ });
1756
1779
  function zipName() {
1757
1780
  return zipFileName(props.title || t("defaultZip"));
1758
1781
  }
@@ -1783,7 +1806,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
1783
1806
  }));
1784
1807
  selected.value = /* @__PURE__ */ new Set();
1785
1808
  } catch (error) {
1786
- showToast(controller.signal.aborted ? t("batchCanceled") : t("batchFailed", { message: errorText(error) }));
1809
+ if (controller.signal.aborted) showToast(t("batchCanceled"));
1810
+ else zipNotice.value = {
1811
+ kind: "failed",
1812
+ message: errorText(error)
1813
+ };
1787
1814
  } finally {
1788
1815
  zipAbort = null;
1789
1816
  batchBusy.value = false;
@@ -2080,12 +2107,12 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2080
2107
  if (toast.value) _push(`<div class="fl-toast" role="status">${ssrInterpolate(toast.value)}</div>`);
2081
2108
  else _push(`<!---->`);
2082
2109
  _push(ssrRenderComponent(_sfc_main$3, {
2083
- open: !!zipNotice.value,
2084
- title: zipNotice.value ? t(zipNotice.value.kind === "warn" ? "zipWarnTitle" : "zipBlockTitle", { size: unref(formatSize)(zipNotice.value.size) }) : "",
2085
- text: zipNotice.value ? t(zipNotice.value.kind === "warn" ? "zipWarnText" : "zipBlockText", { limit: unref(formatSize)(zipNotice.value.limit) }) : "",
2086
- tip: zipTip.value,
2087
- "confirm-label": zipNotice.value?.kind === "warn" ? t("zipContinue") : void 0,
2088
- "cancel-label": zipNotice.value?.kind === "warn" ? t("cancel") : t("gotIt"),
2110
+ open: !!zipDialog.value,
2111
+ title: zipDialog.value?.title ?? "",
2112
+ text: zipDialog.value?.text ?? "",
2113
+ tip: zipDialog.value?.tip,
2114
+ "confirm-label": zipDialog.value?.confirm,
2115
+ "cancel-label": zipDialog.value?.cancel ?? "",
2089
2116
  onConfirm: confirmZip,
2090
2117
  onClose: ($event) => zipNotice.value = null
2091
2118
  }, null, _parent));
@@ -787,11 +787,13 @@
787
787
  }
788
788
 
789
789
  .fl-toast {
790
- position: absolute;
791
- bottom: 14px;
790
+ /* the viewport, not the card: a long list would push the card's bottom off screen */
791
+ position: fixed;
792
+ bottom: calc(24px + env(safe-area-inset-bottom));
792
793
  left: 50%;
793
- z-index: 5;
794
- max-width: 92%;
794
+ z-index: 100;
795
+ box-sizing: border-box;
796
+ max-width: min(560px, calc(100vw - 32px));
795
797
  padding: 7px 14px;
796
798
  overflow: hidden;
797
799
  font-size: 13px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitepress-plugin-filelist",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "packageManager": "pnpm@11.25.0",
5
5
  "type": "module",
6
6
  "description": "OpenList file browser for VitePress: tree view, batch ZIP download, i18n, password and token support.",