@spacecorexdev/core 0.0.5 → 0.2.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.
Files changed (414) hide show
  1. package/dist/api/index.js +1 -0
  2. package/dist/contract.js +1 -0
  3. package/dist/hooks/index.js +1 -0
  4. package/dist/index.js +7 -0
  5. package/{src → dist}/styles/ant-table.css +5 -26
  6. package/{src → dist}/styles/index.css +8 -8
  7. package/dist/types/index.js +1 -0
  8. package/dist/ui/index.js +1 -0
  9. package/dist/utils/index.js +7 -0
  10. package/package.json +67 -70
  11. package/types/api/project.d.ts +10 -1
  12. package/types/index.d.ts +4 -4
  13. package/types/types/index.d.ts +1 -3
  14. package/types/types/project/base.d.ts +6 -1
  15. package/types/types/project/index.d.ts +1 -0
  16. package/types/types/project/member.d.ts +1 -1
  17. package/types/types/{projectRole.d.ts → project/projectRole.d.ts} +2 -2
  18. package/types/ui/ResizableTable/index.d.ts +7 -0
  19. package/types/ui/RoleSelector/index.d.ts +7 -1
  20. package/types/ui/UIFileUpload.d.ts +2 -2
  21. package/types/ui/index.d.ts +1 -10
  22. package/types/ui/upload/index.d.ts +6 -0
  23. package/types/utils/CacheIndexedDB.d.ts +9 -0
  24. package/types/utils/index.d.ts +2 -2
  25. package/types/utils/mailto.d.ts +12 -0
  26. package/public/cmaps/78-EUC-H.bcmap +0 -0
  27. package/public/cmaps/78-EUC-V.bcmap +0 -0
  28. package/public/cmaps/78-H.bcmap +0 -0
  29. package/public/cmaps/78-RKSJ-H.bcmap +0 -0
  30. package/public/cmaps/78-RKSJ-V.bcmap +0 -0
  31. package/public/cmaps/78-V.bcmap +0 -0
  32. package/public/cmaps/78ms-RKSJ-H.bcmap +0 -0
  33. package/public/cmaps/78ms-RKSJ-V.bcmap +0 -0
  34. package/public/cmaps/83pv-RKSJ-H.bcmap +0 -0
  35. package/public/cmaps/90ms-RKSJ-H.bcmap +0 -0
  36. package/public/cmaps/90ms-RKSJ-V.bcmap +0 -0
  37. package/public/cmaps/90msp-RKSJ-H.bcmap +0 -0
  38. package/public/cmaps/90msp-RKSJ-V.bcmap +0 -0
  39. package/public/cmaps/90pv-RKSJ-H.bcmap +0 -0
  40. package/public/cmaps/90pv-RKSJ-V.bcmap +0 -0
  41. package/public/cmaps/Add-H.bcmap +0 -0
  42. package/public/cmaps/Add-RKSJ-H.bcmap +0 -0
  43. package/public/cmaps/Add-RKSJ-V.bcmap +0 -0
  44. package/public/cmaps/Add-V.bcmap +0 -0
  45. package/public/cmaps/Adobe-CNS1-0.bcmap +0 -0
  46. package/public/cmaps/Adobe-CNS1-1.bcmap +0 -0
  47. package/public/cmaps/Adobe-CNS1-2.bcmap +0 -0
  48. package/public/cmaps/Adobe-CNS1-3.bcmap +0 -0
  49. package/public/cmaps/Adobe-CNS1-4.bcmap +0 -0
  50. package/public/cmaps/Adobe-CNS1-5.bcmap +0 -0
  51. package/public/cmaps/Adobe-CNS1-6.bcmap +0 -0
  52. package/public/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  53. package/public/cmaps/Adobe-GB1-0.bcmap +0 -0
  54. package/public/cmaps/Adobe-GB1-1.bcmap +0 -0
  55. package/public/cmaps/Adobe-GB1-2.bcmap +0 -0
  56. package/public/cmaps/Adobe-GB1-3.bcmap +0 -0
  57. package/public/cmaps/Adobe-GB1-4.bcmap +0 -0
  58. package/public/cmaps/Adobe-GB1-5.bcmap +0 -0
  59. package/public/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  60. package/public/cmaps/Adobe-Japan1-0.bcmap +0 -0
  61. package/public/cmaps/Adobe-Japan1-1.bcmap +0 -0
  62. package/public/cmaps/Adobe-Japan1-2.bcmap +0 -0
  63. package/public/cmaps/Adobe-Japan1-3.bcmap +0 -0
  64. package/public/cmaps/Adobe-Japan1-4.bcmap +0 -0
  65. package/public/cmaps/Adobe-Japan1-5.bcmap +0 -0
  66. package/public/cmaps/Adobe-Japan1-6.bcmap +0 -0
  67. package/public/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  68. package/public/cmaps/Adobe-Korea1-0.bcmap +0 -0
  69. package/public/cmaps/Adobe-Korea1-1.bcmap +0 -0
  70. package/public/cmaps/Adobe-Korea1-2.bcmap +0 -0
  71. package/public/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  72. package/public/cmaps/B5-H.bcmap +0 -0
  73. package/public/cmaps/B5-V.bcmap +0 -0
  74. package/public/cmaps/B5pc-H.bcmap +0 -0
  75. package/public/cmaps/B5pc-V.bcmap +0 -0
  76. package/public/cmaps/CNS-EUC-H.bcmap +0 -0
  77. package/public/cmaps/CNS-EUC-V.bcmap +0 -0
  78. package/public/cmaps/CNS1-H.bcmap +0 -0
  79. package/public/cmaps/CNS1-V.bcmap +0 -0
  80. package/public/cmaps/CNS2-H.bcmap +0 -0
  81. package/public/cmaps/CNS2-V.bcmap +0 -3
  82. package/public/cmaps/ETHK-B5-H.bcmap +0 -0
  83. package/public/cmaps/ETHK-B5-V.bcmap +0 -0
  84. package/public/cmaps/ETen-B5-H.bcmap +0 -0
  85. package/public/cmaps/ETen-B5-V.bcmap +0 -0
  86. package/public/cmaps/ETenms-B5-H.bcmap +0 -3
  87. package/public/cmaps/ETenms-B5-V.bcmap +0 -0
  88. package/public/cmaps/EUC-H.bcmap +0 -0
  89. package/public/cmaps/EUC-V.bcmap +0 -0
  90. package/public/cmaps/Ext-H.bcmap +0 -0
  91. package/public/cmaps/Ext-RKSJ-H.bcmap +0 -0
  92. package/public/cmaps/Ext-RKSJ-V.bcmap +0 -0
  93. package/public/cmaps/Ext-V.bcmap +0 -0
  94. package/public/cmaps/GB-EUC-H.bcmap +0 -0
  95. package/public/cmaps/GB-EUC-V.bcmap +0 -0
  96. package/public/cmaps/GB-H.bcmap +0 -4
  97. package/public/cmaps/GB-V.bcmap +0 -0
  98. package/public/cmaps/GBK-EUC-H.bcmap +0 -0
  99. package/public/cmaps/GBK-EUC-V.bcmap +0 -0
  100. package/public/cmaps/GBK2K-H.bcmap +0 -0
  101. package/public/cmaps/GBK2K-V.bcmap +0 -0
  102. package/public/cmaps/GBKp-EUC-H.bcmap +0 -0
  103. package/public/cmaps/GBKp-EUC-V.bcmap +0 -0
  104. package/public/cmaps/GBT-EUC-H.bcmap +0 -0
  105. package/public/cmaps/GBT-EUC-V.bcmap +0 -0
  106. package/public/cmaps/GBT-H.bcmap +0 -0
  107. package/public/cmaps/GBT-V.bcmap +0 -0
  108. package/public/cmaps/GBTpc-EUC-H.bcmap +0 -0
  109. package/public/cmaps/GBTpc-EUC-V.bcmap +0 -0
  110. package/public/cmaps/GBpc-EUC-H.bcmap +0 -0
  111. package/public/cmaps/GBpc-EUC-V.bcmap +0 -0
  112. package/public/cmaps/H.bcmap +0 -0
  113. package/public/cmaps/HKdla-B5-H.bcmap +0 -0
  114. package/public/cmaps/HKdla-B5-V.bcmap +0 -0
  115. package/public/cmaps/HKdlb-B5-H.bcmap +0 -0
  116. package/public/cmaps/HKdlb-B5-V.bcmap +0 -0
  117. package/public/cmaps/HKgccs-B5-H.bcmap +0 -0
  118. package/public/cmaps/HKgccs-B5-V.bcmap +0 -0
  119. package/public/cmaps/HKm314-B5-H.bcmap +0 -0
  120. package/public/cmaps/HKm314-B5-V.bcmap +0 -0
  121. package/public/cmaps/HKm471-B5-H.bcmap +0 -0
  122. package/public/cmaps/HKm471-B5-V.bcmap +0 -0
  123. package/public/cmaps/HKscs-B5-H.bcmap +0 -0
  124. package/public/cmaps/HKscs-B5-V.bcmap +0 -0
  125. package/public/cmaps/Hankaku.bcmap +0 -0
  126. package/public/cmaps/Hiragana.bcmap +0 -0
  127. package/public/cmaps/KSC-EUC-H.bcmap +0 -0
  128. package/public/cmaps/KSC-EUC-V.bcmap +0 -0
  129. package/public/cmaps/KSC-H.bcmap +0 -0
  130. package/public/cmaps/KSC-Johab-H.bcmap +0 -0
  131. package/public/cmaps/KSC-Johab-V.bcmap +0 -0
  132. package/public/cmaps/KSC-V.bcmap +0 -0
  133. package/public/cmaps/KSCms-UHC-H.bcmap +0 -0
  134. package/public/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  135. package/public/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  136. package/public/cmaps/KSCms-UHC-V.bcmap +0 -0
  137. package/public/cmaps/KSCpc-EUC-H.bcmap +0 -0
  138. package/public/cmaps/KSCpc-EUC-V.bcmap +0 -0
  139. package/public/cmaps/Katakana.bcmap +0 -0
  140. package/public/cmaps/LICENSE +0 -36
  141. package/public/cmaps/NWP-H.bcmap +0 -0
  142. package/public/cmaps/NWP-V.bcmap +0 -0
  143. package/public/cmaps/RKSJ-H.bcmap +0 -0
  144. package/public/cmaps/RKSJ-V.bcmap +0 -0
  145. package/public/cmaps/Roman.bcmap +0 -0
  146. package/public/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  147. package/public/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  148. package/public/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  149. package/public/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  150. package/public/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  151. package/public/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  152. package/public/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  153. package/public/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  154. package/public/cmaps/UniGB-UCS2-H.bcmap +0 -0
  155. package/public/cmaps/UniGB-UCS2-V.bcmap +0 -0
  156. package/public/cmaps/UniGB-UTF16-H.bcmap +0 -0
  157. package/public/cmaps/UniGB-UTF16-V.bcmap +0 -0
  158. package/public/cmaps/UniGB-UTF32-H.bcmap +0 -0
  159. package/public/cmaps/UniGB-UTF32-V.bcmap +0 -0
  160. package/public/cmaps/UniGB-UTF8-H.bcmap +0 -0
  161. package/public/cmaps/UniGB-UTF8-V.bcmap +0 -0
  162. package/public/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  163. package/public/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  164. package/public/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  165. package/public/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  166. package/public/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  167. package/public/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  168. package/public/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  169. package/public/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  170. package/public/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  171. package/public/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  172. package/public/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  173. package/public/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  174. package/public/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  175. package/public/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  176. package/public/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  177. package/public/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  178. package/public/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  179. package/public/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  180. package/public/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  181. package/public/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  182. package/public/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  183. package/public/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  184. package/public/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  185. package/public/cmaps/UniKS-UCS2-H.bcmap +0 -0
  186. package/public/cmaps/UniKS-UCS2-V.bcmap +0 -0
  187. package/public/cmaps/UniKS-UTF16-H.bcmap +0 -0
  188. package/public/cmaps/UniKS-UTF16-V.bcmap +0 -0
  189. package/public/cmaps/UniKS-UTF32-H.bcmap +0 -0
  190. package/public/cmaps/UniKS-UTF32-V.bcmap +0 -0
  191. package/public/cmaps/UniKS-UTF8-H.bcmap +0 -0
  192. package/public/cmaps/UniKS-UTF8-V.bcmap +0 -0
  193. package/public/cmaps/V.bcmap +0 -0
  194. package/public/cmaps/WP-Symbol.bcmap +0 -0
  195. package/public/polyfills/polyfills.js +0 -802
  196. package/public/vendor/docx/docx.worker.js +0 -5
  197. package/public/vendor/docx/jszip.min.js +0 -13
  198. package/public/vendor/libarchive/libarchive.wasm +0 -0
  199. package/public/vendor/libarchive/worker-bundle.js +0 -6
  200. package/public/vendor/pptx/pptx.worker.js +0 -26
  201. package/public/wasm/cad/0.8.2/dwfv-render.wasm +0 -0
  202. package/public/wasm/cad/0.8.2/dwg-worker.js +0 -24
  203. package/public/wasm/cad/0.8.2/dwg-worker.js.map +0 -1
  204. package/public/wasm/cad/0.8.2/libredwg-web.js +0 -2
  205. package/public/wasm/cad/0.8.2/libredwg-web.wasm +0 -0
  206. package/public/wasm/cad/dwfv-render.wasm +0 -0
  207. package/public/wasm/cad/dwg-worker.js +0 -24
  208. package/public/wasm/cad/dwg-worker.js.map +0 -1
  209. package/public/wasm/cad/libredwg-web.js +0 -2
  210. package/public/wasm/cad/libredwg-web.wasm +0 -0
  211. package/public/wasm/data/sql-wasm.wasm +0 -0
  212. package/public/wasm/hdiff.wasm +0 -0
  213. package/public/wasm/model/LICENSE.occt-import-js.txt +0 -504
  214. package/public/wasm/model/LICENSE.occt.txt +0 -502
  215. package/public/wasm/model/occt-import-js.js +0 -19
  216. package/public/wasm/model/occt-import-js.wasm +0 -0
  217. package/public/wasm/model/occt-worker.js +0 -83
  218. package/public/wasm/typst/fonts/DejaVuSansMono-Bold.ttf +0 -0
  219. package/public/wasm/typst/fonts/DejaVuSansMono-BoldOblique.ttf +0 -0
  220. package/public/wasm/typst/fonts/DejaVuSansMono-Oblique.ttf +0 -0
  221. package/public/wasm/typst/fonts/DejaVuSansMono.ttf +0 -0
  222. package/public/wasm/typst/fonts/LibertinusSerif-Bold.otf +0 -0
  223. package/public/wasm/typst/fonts/LibertinusSerif-BoldItalic.otf +0 -0
  224. package/public/wasm/typst/fonts/LibertinusSerif-Italic.otf +0 -0
  225. package/public/wasm/typst/fonts/LibertinusSerif-Regular.otf +0 -0
  226. package/public/wasm/typst/fonts/LibertinusSerif-Semibold.otf +0 -0
  227. package/public/wasm/typst/fonts/LibertinusSerif-SemiboldItalic.otf +0 -0
  228. package/public/wasm/typst/fonts/NewCM10-Bold.otf +0 -0
  229. package/public/wasm/typst/fonts/NewCM10-BoldItalic.otf +0 -0
  230. package/public/wasm/typst/fonts/NewCM10-Italic.otf +0 -0
  231. package/public/wasm/typst/fonts/NewCM10-Regular.otf +0 -0
  232. package/public/wasm/typst/fonts/NewCMMath-Bold.otf +0 -0
  233. package/public/wasm/typst/fonts/NewCMMath-Book.otf +0 -0
  234. package/public/wasm/typst/fonts/NewCMMath-Regular.otf +0 -0
  235. package/public/wasm/typst/fonts/README.md +0 -7
  236. package/public/wasm/typst/typst_ts_renderer_bg.wasm +0 -0
  237. package/public/wasm/typst/typst_ts_web_compiler_bg.wasm +0 -0
  238. package/scripts/patch-docx-grid.cjs +0 -412
  239. package/src/api/_base.ts +0 -243
  240. package/src/api/index.ts +0 -17
  241. package/src/api/project.ts +0 -1345
  242. package/src/api/user.ts +0 -1174
  243. package/src/contract.ts +0 -50
  244. package/src/hooks/index.ts +0 -2
  245. package/src/hooks/useLongPress.ts +0 -137
  246. package/src/hooks/useOnlineStatus.ts +0 -22
  247. package/src/index.ts +0 -14
  248. package/src/types/id.ts +0 -2
  249. package/src/types/index.ts +0 -5
  250. package/src/types/project/base.ts +0 -63
  251. package/src/types/project/contract.ts +0 -79
  252. package/src/types/project/contractStatus.tsx +0 -15
  253. package/src/types/project/index.ts +0 -5
  254. package/src/types/project/member.ts +0 -46
  255. package/src/types/project/progress.ts +0 -43
  256. package/src/types/projectRole.ts +0 -17
  257. package/src/types/theme.ts +0 -1
  258. package/src/types/user/index.ts +0 -1
  259. package/src/types/user/role.ts +0 -7
  260. package/src/ui/CommentTimeline/index.tsx +0 -330
  261. package/src/ui/FileManager/FileContextMenu.tsx +0 -628
  262. package/src/ui/FileManager/FileGridView.tsx +0 -529
  263. package/src/ui/FileManager/FileTableView.tsx +0 -405
  264. package/src/ui/FileManager/FileToolbar.tsx +0 -119
  265. package/src/ui/FileManager/FileVersionHistoryModal.tsx +0 -175
  266. package/src/ui/FileManager/MoveCopyToProjectModal.tsx +0 -119
  267. package/src/ui/FileManager/ShareToWechatModal.tsx +0 -419
  268. package/src/ui/FileManager/hooks/useFileManagerActions.ts +0 -2532
  269. package/src/ui/FileManager/hooks/useFileManagerState.ts +0 -419
  270. package/src/ui/FileManager/index.tsx +0 -580
  271. package/src/ui/FileManager/projectFileManagerApi.ts +0 -57
  272. package/src/ui/FileManager/types.ts +0 -184
  273. package/src/ui/FileManager/utils/fileDeltaWorker.ts +0 -193
  274. package/src/ui/FileManager/utils/fileTree.ts +0 -178
  275. package/src/ui/FileManager/utils/fileUpload.ts +0 -714
  276. package/src/ui/FileManager/utils/fileUtils.ts +0 -65
  277. package/src/ui/InvoiceRecordsList/index.tsx +0 -813
  278. package/src/ui/MyFileSelectorModal.tsx +0 -261
  279. package/src/ui/ProjectSelector/index.tsx +0 -472
  280. package/src/ui/ProjectSelector/projectCache.ts +0 -40
  281. package/src/ui/RoleSelector/index.tsx +0 -473
  282. package/src/ui/RoleSelector/roleCache.ts +0 -40
  283. package/src/ui/UIAlert.tsx +0 -399
  284. package/src/ui/UIAlertExample.tsx +0 -129
  285. package/src/ui/UIConfirm.tsx +0 -335
  286. package/src/ui/UIConfirmExample.tsx +0 -165
  287. package/src/ui/UIDatePicker.tsx +0 -146
  288. package/src/ui/UIDateRangePicker.tsx +0 -38
  289. package/src/ui/UIFilePreview/ExcelEditor/index.tsx +0 -617
  290. package/src/ui/UIFilePreview/ExcelEditor/types.ts +0 -24
  291. package/src/ui/UIFilePreview/ExportDropdown.css +0 -85
  292. package/src/ui/UIFilePreview/ExportDropdown.tsx +0 -109
  293. package/src/ui/UIFilePreview/IndexedDBUtils.ts +0 -564
  294. package/src/ui/UIFilePreview/MarkdownEditor/exportMarkdownPdf.ts +0 -576
  295. package/src/ui/UIFilePreview/MarkdownEditor/index.tsx +0 -677
  296. package/src/ui/UIFilePreview/MarkdownEditor/markdownEditor.css +0 -1005
  297. package/src/ui/UIFilePreview/MarkdownEditor/types.ts +0 -15
  298. package/src/ui/UIFilePreview/PPTXEditor/index.tsx +0 -602
  299. package/src/ui/UIFilePreview/RichDocEditor/exportRDocMarkdown.ts +0 -77
  300. package/src/ui/UIFilePreview/RichDocEditor/exportRDocPdf.ts +0 -374
  301. package/src/ui/UIFilePreview/RichDocEditor/index.tsx +0 -730
  302. package/src/ui/UIFilePreview/RichDocEditor/richdoc-editor.css +0 -59
  303. package/src/ui/UIFilePreview/UIFilePreview.tsx +0 -611
  304. package/src/ui/UIFilePreview/WordEditor/index.tsx +0 -3933
  305. package/src/ui/UIFilePreview/WordEditor/style.ts +0 -1213
  306. package/src/ui/UIFilePreview/WordEditor/word-editor.css +0 -999
  307. package/src/ui/UIFilePreview/filePreview.css +0 -193
  308. package/src/ui/UIFilePreview/filetypes/archive.tsx +0 -66
  309. package/src/ui/UIFilePreview/filetypes/cad.tsx +0 -287
  310. package/src/ui/UIFilePreview/filetypes/excel.tsx +0 -355
  311. package/src/ui/UIFilePreview/filetypes/image.tsx +0 -20
  312. package/src/ui/UIFilePreview/filetypes/imageLoader.ts +0 -63
  313. package/src/ui/UIFilePreview/filetypes/pdf.tsx +0 -156
  314. package/src/ui/UIFilePreview/filetypes/ppt.tsx +0 -535
  315. package/src/ui/UIFilePreview/filetypes/pptExportPdf.ts +0 -523
  316. package/src/ui/UIFilePreview/filetypes/video.tsx +0 -482
  317. package/src/ui/UIFilePreview/filetypes/word.tsx +0 -245
  318. package/src/ui/UIFilePreview/filetypes/wordExportMarkdown.ts +0 -86
  319. package/src/ui/UIFilePreview/filetypes/wordExportPdf.tsx +0 -427
  320. package/src/ui/UIFilePreview/index.ts +0 -35
  321. package/src/ui/UIFilePreview/pdfPagination.ts +0 -143
  322. package/src/ui/UIFilePreview/previewUtils.tsx +0 -531
  323. package/src/ui/UIFileUpload.tsx +0 -382
  324. package/src/ui/UIImageUpload.tsx +0 -195
  325. package/src/ui/UILoading.tsx +0 -255
  326. package/src/ui/UILoadingExample.tsx +0 -139
  327. package/src/ui/UISelect.tsx +0 -105
  328. package/src/ui/UIToast.tsx +0 -381
  329. package/src/ui/UIToastExample.tsx +0 -69
  330. package/src/ui/UIToastSingle.tsx +0 -279
  331. package/src/ui/UIViewToggle.tsx +0 -64
  332. package/src/ui/UserSelector/index.tsx +0 -583
  333. package/src/ui/index.ts +0 -84
  334. package/src/ui/upload/image.ts +0 -135
  335. package/src/ui/upload/index.ts +0 -73
  336. package/src/ui/upload/submitFile.ts +0 -106
  337. package/src/ui/upload/submitForm.ts +0 -124
  338. package/src/ui/upload/upload.err.ts +0 -15
  339. package/src/ui/upload/upload.ts +0 -250
  340. package/src/utils/CacheDepartmentInfo.ts +0 -372
  341. package/src/utils/CacheFileContent.ts +0 -315
  342. package/src/utils/CachePermissionInfo.ts +0 -235
  343. package/src/utils/CacheRoleInfo.ts +0 -303
  344. package/src/utils/CacheUserInfo.ts +0 -818
  345. package/src/utils/CacheViewToggleInfo.ts +0 -182
  346. package/src/utils/MessageContentUtils.ts +0 -268
  347. package/src/utils/clipboard.ts +0 -70
  348. package/src/utils/companyEmail.ts +0 -19
  349. package/src/utils/forbidDebugger.ts +0 -59
  350. package/src/utils/formatters.ts +0 -94
  351. package/src/utils/htmlUtils.tsx +0 -59
  352. package/src/utils/index.ts +0 -18
  353. package/src/utils/keyboard.ts +0 -114
  354. package/src/utils/mammothApi.ts +0 -16
  355. package/src/utils/polyfills.ts +0 -928
  356. package/src/utils/regex.ts +0 -14
  357. package/src/utils/storage.ts +0 -95
  358. package/src/utils/workerBootstrap.ts +0 -87
  359. package/types/hooks.d.ts +0 -5
  360. package/types/types/user/index.d.ts +0 -1
  361. package/types/types/user/role.d.ts +0 -7
  362. package/types/ui/FileManager/FileContextMenu.d.ts +0 -50
  363. package/types/ui/FileManager/FileGridView.d.ts +0 -51
  364. package/types/ui/FileManager/FileTableView.d.ts +0 -49
  365. package/types/ui/FileManager/FileToolbar.d.ts +0 -16
  366. package/types/ui/FileManager/FileVersionHistoryModal.d.ts +0 -9
  367. package/types/ui/FileManager/MoveCopyToProjectModal.d.ts +0 -17
  368. package/types/ui/FileManager/ShareToWechatModal.d.ts +0 -10
  369. package/types/ui/FileManager/hooks/useFileManagerActions.d.ts +0 -143
  370. package/types/ui/FileManager/hooks/useFileManagerState.d.ts +0 -146
  371. package/types/ui/FileManager/index.d.ts +0 -16
  372. package/types/ui/FileManager/projectFileManagerApi.d.ts +0 -6
  373. package/types/ui/FileManager/types.d.ts +0 -178
  374. package/types/ui/FileManager/utils/fileDeltaWorker.d.ts +0 -14
  375. package/types/ui/FileManager/utils/fileTree.d.ts +0 -7
  376. package/types/ui/FileManager/utils/fileUpload.d.ts +0 -60
  377. package/types/ui/FileManager/utils/fileUtils.d.ts +0 -26
  378. package/types/ui/InvoiceRecordsList/index.d.ts +0 -43
  379. package/types/ui/MyFileSelectorModal.d.ts +0 -16
  380. package/types/ui/UIFilePreview/ExcelEditor/index.d.ts +0 -20
  381. package/types/ui/UIFilePreview/ExcelEditor/types.d.ts +0 -29
  382. package/types/ui/UIFilePreview/ExportDropdown.d.ts +0 -26
  383. package/types/ui/UIFilePreview/IndexedDBUtils.d.ts +0 -109
  384. package/types/ui/UIFilePreview/MarkdownEditor/exportMarkdownPdf.d.ts +0 -27
  385. package/types/ui/UIFilePreview/MarkdownEditor/index.d.ts +0 -34
  386. package/types/ui/UIFilePreview/MarkdownEditor/types.d.ts +0 -14
  387. package/types/ui/UIFilePreview/PPTXEditor/index.d.ts +0 -19
  388. package/types/ui/UIFilePreview/RichDocEditor/exportRDocMarkdown.d.ts +0 -23
  389. package/types/ui/UIFilePreview/RichDocEditor/exportRDocPdf.d.ts +0 -22
  390. package/types/ui/UIFilePreview/RichDocEditor/index.d.ts +0 -39
  391. package/types/ui/UIFilePreview/UIFilePreview.d.ts +0 -34
  392. package/types/ui/UIFilePreview/WordEditor/index.d.ts +0 -20
  393. package/types/ui/UIFilePreview/WordEditor/style.d.ts +0 -81
  394. package/types/ui/UIFilePreview/filetypes/archive.d.ts +0 -6
  395. package/types/ui/UIFilePreview/filetypes/cad.d.ts +0 -5
  396. package/types/ui/UIFilePreview/filetypes/excel.d.ts +0 -6
  397. package/types/ui/UIFilePreview/filetypes/image.d.ts +0 -6
  398. package/types/ui/UIFilePreview/filetypes/imageLoader.d.ts +0 -7
  399. package/types/ui/UIFilePreview/filetypes/pdf.d.ts +0 -7
  400. package/types/ui/UIFilePreview/filetypes/ppt.d.ts +0 -5
  401. package/types/ui/UIFilePreview/filetypes/pptExportPdf.d.ts +0 -28
  402. package/types/ui/UIFilePreview/filetypes/video.d.ts +0 -6
  403. package/types/ui/UIFilePreview/filetypes/word.d.ts +0 -5
  404. package/types/ui/UIFilePreview/filetypes/wordExportMarkdown.d.ts +0 -19
  405. package/types/ui/UIFilePreview/filetypes/wordExportPdf.d.ts +0 -32
  406. package/types/ui/UIFilePreview/index.d.ts +0 -46
  407. package/types/ui/UIFilePreview/pdfPagination.d.ts +0 -25
  408. package/types/ui/UIFilePreview/previewUtils.d.ts +0 -62
  409. package/types/ui.d.ts +0 -5
  410. package/types/utils/CacheFileContent.d.ts +0 -31
  411. package/types/utils/mammothApi.d.ts +0 -14
  412. package/types/utils.d.ts +0 -5
  413. /package/{src → dist}/styles/ant-modal.css +0 -0
  414. /package/{src → dist}/styles/ant-spin.css +0 -0
@@ -1,802 +0,0 @@
1
- /* =========================================================
2
- * Safari / 旧 WebView 运行时能力兜底
3
- * 目标执行上下文:主窗口(window) / Web Worker(self) / Service Worker(self)
4
- * 用法:
5
- * 1) 主窗口 <script src="/polyfills/polyfills.js"></script>(放在最前)
6
- * 2) Worker: self.importScripts('/polyfills/polyfills.js');(放在业务脚本最前)
7
- * 不引入第三方库,完全手工最小实现;只在缺失时赋值,避免与 React dispatcher 冲突。
8
- * ========================================================= */
9
- (function installPolyfills(global) {
10
- if (!global) return;
11
-
12
- /* -------------------------------------------------------
13
- * 辅助:仅在缺失时挂载
14
- * ----------------------------------------------------- */
15
- function setIfMissing(target, key, value) {
16
- try {
17
- if (typeof target[key] === 'undefined') {
18
- // 优先 defineProperty:可写/可配置但不参与枚举,与原生一致
19
- Object.defineProperty(target, key, {
20
- configurable: true,
21
- enumerable: false,
22
- writable: true,
23
- value: value,
24
- });
25
- // 部分老 Safari 对内置构造器/全局 defineProperty 不抛错但不生效(静默失败),
26
- // 因此赋值后立即比对,必要时退化为直接赋值兜底。
27
- if (target[key] !== value) {
28
- try { target[key] = value; } catch (_e2) { /* skip */ }
29
- }
30
- return;
31
- }
32
- } catch (_err) {
33
- // 严格冻结对象:尝试直接赋值兜底;再失败则静默忽略
34
- try { target[key] = value; return; } catch (_e) { /* skip */ }
35
- }
36
- // 最后一道:再次验证 defineProperty 未报错但实际未写入的场景
37
- try {
38
- if (typeof target[key] === 'undefined' && target[key] !== value) target[key] = value;
39
- } catch (_e) { /* skip */ }
40
- }
41
-
42
- /* =======================================================
43
- * 1) Promise.allSettled
44
- * ===================================================== */
45
- (function polyfillPromiseAllSettled() {
46
- var PromiseCtor = global.Promise;
47
- if (!PromiseCtor) return;
48
- if (typeof PromiseCtor.allSettled === 'function') return;
49
-
50
- var allSettledImpl = function allSettled(values) {
51
- var items = Array.isArray(values) ? values : (values && typeof values[Symbol.iterator] === 'function' ? Array.from(values) : []);
52
- if (items.length === 0) return PromiseCtor.resolve([]);
53
- return new PromiseCtor(function (resolve) {
54
- var total = items.length;
55
- var remaining = total;
56
- var results = new Array(total);
57
- function settleOne(index, status, payload) {
58
- if (status === 'fulfilled') {
59
- results[index] = { status: 'fulfilled', value: payload };
60
- } else {
61
- results[index] = { status: 'rejected', reason: payload };
62
- }
63
- remaining -= 1;
64
- if (remaining === 0) resolve(results);
65
- }
66
- for (var i = 0; i < total; i++) {
67
- (function (idx) {
68
- try {
69
- var item = items[idx];
70
- PromiseCtor.resolve(item).then(
71
- function (v) { settleOne(idx, 'fulfilled', v); },
72
- function (r) { settleOne(idx, 'rejected', r); }
73
- );
74
- } catch (err) {
75
- settleOne(idx, 'rejected', err);
76
- }
77
- })(i);
78
- }
79
- });
80
- };
81
-
82
- setIfMissing(PromiseCtor, 'allSettled', allSettledImpl);
83
- })();
84
-
85
- /* =======================================================
86
- * 2) QueuingStrategy
87
- * ===================================================== */
88
- var ByteLengthQS = (function () {
89
- function ByteLengthQueuingStrategy(opts) {
90
- this.highWaterMark = opts && opts.highWaterMark != null ? opts.highWaterMark : 0;
91
- }
92
- ByteLengthQueuingStrategy.prototype.size = function (chunk) {
93
- return chunk && typeof chunk.byteLength === 'number' ? chunk.byteLength : 0;
94
- };
95
- return ByteLengthQueuingStrategy;
96
- })();
97
-
98
- var CountQS = (function () {
99
- function CountQueuingStrategy(opts) {
100
- this.highWaterMark = opts && opts.highWaterMark != null ? opts.highWaterMark : 0;
101
- }
102
- CountQueuingStrategy.prototype.size = function () { return 1; };
103
- return CountQueuingStrategy;
104
- })();
105
-
106
- setIfMissing(global, 'ByteLengthQueuingStrategy', ByteLengthQS);
107
- setIfMissing(global, 'CountQueuingStrategy', CountQS);
108
-
109
- /* =======================================================
110
- * 3) ReadableStream (+ Default/BYOB Reader + Default/BYOB Controller)
111
- * ===================================================== */
112
- var PolyfillReadable = (function () {
113
-
114
- function installOnReadableStreamInstance(stream) {
115
- stream._chunks = [];
116
- stream._waiting = null;
117
- stream._byobWaiting = null;
118
- stream._reader = null;
119
- stream._byobReader = null;
120
- stream._state = { closed: false, errored: false, error: undefined };
121
- stream._pulling = false;
122
- stream._pullScheduled = false;
123
- }
124
-
125
- function toUint8(chunk) {
126
- if (chunk instanceof Uint8Array) return chunk;
127
- if (chunk && typeof chunk === 'object' && typeof chunk.buffer === 'object' && typeof chunk.byteOffset === 'number' && typeof chunk.byteLength === 'number') {
128
- return new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
129
- }
130
- if (chunk instanceof ArrayBuffer) return new Uint8Array(chunk);
131
- if (typeof chunk === 'string') {
132
- var enc = new TextEncoder();
133
- return enc.encode(chunk);
134
- }
135
- if (Array.isArray(chunk)) return new Uint8Array(chunk);
136
- return new Uint8Array(0);
137
- }
138
-
139
- function DefaultController(stream) { this._s = stream; }
140
- DefaultController.prototype.enqueue = function (chunk) { this._s._push(chunk); };
141
- DefaultController.prototype.close = function () { this._s._close(); };
142
- DefaultController.prototype.error = function (e) { this._s._error(e != null ? e : new Error('ReadableStream errored')); };
143
- Object.defineProperty(DefaultController.prototype, 'desiredSize', {
144
- configurable: true, get: function () { return this._s._chunks ? 1 : 0; }
145
- });
146
- Object.defineProperty(DefaultController.prototype, 'byobRequest', {
147
- configurable: true, get: function () { return null; }
148
- });
149
-
150
- function ByteController(stream) { this._s = stream; }
151
- ByteController.prototype.enqueue = function (chunk) {
152
- var u8 = toUint8(chunk);
153
- this._s._push(u8);
154
- };
155
- ByteController.prototype.close = function () { this._s._close(); };
156
- ByteController.prototype.error = function (e) { this._s._error(e != null ? e : new Error('ReadableByteStream errored')); };
157
- Object.defineProperty(ByteController.prototype, 'desiredSize', {
158
- configurable: true, get: function () { return this._s._chunks ? 1 : 0; }
159
- });
160
- Object.defineProperty(ByteController.prototype, 'byobRequest', {
161
- configurable: true, get: function () { return null; }
162
- });
163
-
164
- function DefaultReader(stream) {
165
- var self = this;
166
- this._s = stream;
167
- stream._reader = this;
168
- this.closed = new Promise(function (res) { self._res = res; });
169
- }
170
- DefaultReader.prototype.read = function () { return this._s._read(); };
171
- DefaultReader.prototype.releaseLock = function () {
172
- if (this._s._reader === this) this._s._reader = null;
173
- };
174
- DefaultReader.prototype.cancel = function (reason) { return this._s.cancel(reason); };
175
-
176
- function BYOBReader(stream) {
177
- var self = this;
178
- this._s = stream;
179
- stream._byobReader = this;
180
- this.closed = new Promise(function (res) { self._res = res; });
181
- }
182
- BYOBReader.prototype.read = function (view) { return this._s._readInto(view); };
183
- BYOBReader.prototype.releaseLock = function () {
184
- if (this._s._byobReader === this) this._s._byobReader = null;
185
- };
186
- BYOBReader.prototype.cancel = function (reason) { return this._s.cancel(reason); };
187
-
188
- function ReadableStream(underlyingSource, _strategy) {
189
- var self = this;
190
- installOnReadableStreamInstance(self);
191
- self.locked = false;
192
- var src = underlyingSource || null;
193
- self._source = src;
194
- self._cancelCallback = src && typeof src.cancel === 'function' ? src.cancel : null;
195
- if (src && src.type === 'bytes') {
196
- self._type = 'bytes';
197
- self._autoAllocateChunkSize = src.autoAllocateChunkSize;
198
- self._controller = new ByteController(self);
199
- } else {
200
- self._type = undefined;
201
- self._controller = new DefaultController(self);
202
- }
203
- var start = src && typeof src.start === 'function' ? src.start : null;
204
- if (start) {
205
- Promise.resolve(start.call(src, self._controller))['catch'](function (e) { self._error(e); });
206
- }
207
- }
208
-
209
- ReadableStream.prototype.getReader = function (opts) {
210
- if (opts && opts.mode === 'byob') {
211
- if (this._byobReader) throw new TypeError('ReadableStream is locked');
212
- return new BYOBReader(this);
213
- }
214
- if (this._reader) throw new TypeError('ReadableStream is locked');
215
- return new DefaultReader(this);
216
- };
217
-
218
- ReadableStream.prototype._schedulePullIfNeeded = function () {
219
- var self = this;
220
- if (self._pullScheduled) return;
221
- var src = self._source;
222
- var pull = src && typeof src.pull === 'function' ? src.pull : null;
223
- if (!pull) return;
224
- if (self._state.closed || self._state.errored) return;
225
- if (self._chunks.length > 0 || self._waiting || self._byobWaiting) return;
226
- self._pullScheduled = true;
227
- var fn = (typeof queueMicrotask === 'function') ? queueMicrotask : function (cb) { Promise.resolve().then(cb); };
228
- fn(function () {
229
- self._pullScheduled = false;
230
- if (self._pulling) return;
231
- if (self._state.closed || self._state.errored) return;
232
- self._pulling = true;
233
- Promise.resolve(pull.call(self._source, self._controller))
234
- ['catch'](function (e) { self._error(e); })
235
- .then(function () { self._pulling = false; }, function () { self._pulling = false; });
236
- });
237
- };
238
-
239
- ReadableStream.prototype._push = function (chunk) {
240
- if (this._state.closed || this._state.errored) return;
241
- if (this._waiting) {
242
- var resolve = this._waiting; this._waiting = null;
243
- resolve({ done: false, value: chunk });
244
- this._schedulePullIfNeeded();
245
- return;
246
- }
247
- if (this._byobWaiting) {
248
- var resolveByob = this._byobWaiting; this._byobWaiting = null;
249
- var src = toUint8(chunk);
250
- var out = new Uint8Array(src.length); out.set(src);
251
- resolveByob({ done: false, value: out });
252
- this._schedulePullIfNeeded();
253
- return;
254
- }
255
- this._chunks.push({ type: 'chunk', value: chunk });
256
- this._schedulePullIfNeeded();
257
- };
258
-
259
- ReadableStream.prototype._close = function () {
260
- if (this._state.closed || this._state.errored) return;
261
- this._state.closed = true;
262
- this._chunks.push({ type: 'close' });
263
- if (this._waiting) {
264
- var resolve = this._waiting; this._waiting = null;
265
- resolve({ done: true, value: undefined });
266
- }
267
- this._finalize();
268
- };
269
-
270
- ReadableStream.prototype._error = function (error) {
271
- if (this._state.closed || this._state.errored) return;
272
- this._state.errored = true;
273
- this._state.error = error;
274
- this._chunks.push({ type: 'error', error: error });
275
- if (this._waiting) {
276
- var resolve = this._waiting; this._waiting = null;
277
- resolve(Promise.reject(error));
278
- }
279
- this._finalize();
280
- };
281
-
282
- ReadableStream.prototype._finalize = function () {
283
- if (this._reader && this._reader._res) this._reader._res(undefined);
284
- if (this._byobReader && this._byobReader._res) this._byobReader._res(undefined);
285
- };
286
-
287
- ReadableStream.prototype._read = function () {
288
- var self = this;
289
- if (self._state.errored) return Promise.reject(self._state.error);
290
- if (self._state.closed) return Promise.resolve({ done: true, value: undefined });
291
- while (self._chunks.length) {
292
- var item = self._chunks.shift();
293
- if (item.type === 'chunk') {
294
- self._schedulePullIfNeeded();
295
- return Promise.resolve({ done: false, value: item.value });
296
- }
297
- if (item.type === 'close') return Promise.resolve({ done: true, value: undefined });
298
- if (item.type === 'error') return Promise.reject(item.error);
299
- }
300
- return new Promise(function (resolve, reject) {
301
- self._waiting = function (valOrPromise) {
302
- if (valOrPromise && typeof valOrPromise.then === 'function') {
303
- valOrPromise.then(function (v) { return resolve(v); }, function (e) { return reject(e); });
304
- return;
305
- }
306
- if (self._state.errored) reject(self._state.error);
307
- else resolve(valOrPromise);
308
- };
309
- self._schedulePullIfNeeded();
310
- });
311
- };
312
-
313
- ReadableStream.prototype._readInto = function (view) {
314
- var self = this;
315
- if (self._state.errored) return Promise.reject(self._state.error);
316
- if (self._state.closed) return Promise.resolve({ done: true, value: view });
317
- var written = 0;
318
- var target = new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
319
- while (self._chunks.length && written < target.byteLength) {
320
- var item = self._chunks[0];
321
- if (item.type === 'chunk') {
322
- var src = toUint8(item.value);
323
- var toCopy = Math.min(src.length, target.byteLength - written);
324
- target.set(src.subarray(0, toCopy), written);
325
- written += toCopy;
326
- if (toCopy < src.length) item.value = src.subarray(toCopy);
327
- else self._chunks.shift();
328
- } else if (item.type === 'close') {
329
- self._chunks.shift();
330
- var out = written === 0 ? view : new DataView(view.buffer, view.byteOffset, written);
331
- return Promise.resolve({ done: true, value: written ? out : view });
332
- } else if (item.type === 'error') {
333
- self._chunks.shift();
334
- return Promise.reject(item.error);
335
- }
336
- }
337
- if (written > 0) {
338
- var newView = new DataView(view.buffer, view.byteOffset, written);
339
- self._schedulePullIfNeeded();
340
- return Promise.resolve({ done: false, value: newView });
341
- }
342
- return new Promise(function (resolve, reject) {
343
- self._byobWaiting = function (res) {
344
- if (self._state.errored) reject(self._state.error);
345
- else resolve(res);
346
- };
347
- self._schedulePullIfNeeded();
348
- });
349
- };
350
-
351
- ReadableStream.prototype.cancel = function (reason) {
352
- var self = this;
353
- if (self._state.closed || self._state.errored) return Promise.resolve();
354
- self._state.closed = true;
355
- var done = function () { self._finalize(); };
356
- if (self._cancelCallback) {
357
- try {
358
- var r = self._cancelCallback(reason);
359
- if (r && typeof r.then === 'function') {
360
- return Promise.resolve(r).then(function () { done(); return undefined; }, function () { done(); return undefined; });
361
- }
362
- } catch (e) { /* continue to finalize */ }
363
- }
364
- done();
365
- return Promise.resolve();
366
- };
367
-
368
- ReadableStream.prototype.tee = function () {
369
- var left = branch(this);
370
- var right = branch(this);
371
- return [left, right];
372
- };
373
-
374
- function branch(src) {
375
- var rs = new ReadableStream({
376
- start: function (controller) {
377
- var reader = src.getReader();
378
- function pump() {
379
- return reader.read().then(function (res) {
380
- if (res.done) return controller.close();
381
- controller.enqueue(res.value);
382
- return pump();
383
- })['catch'](function (e) {
384
- controller.error(e);
385
- }).then(function () {
386
- try { reader.releaseLock(); } catch (_e) { /* skip */ }
387
- }, function () {
388
- try { reader.releaseLock(); } catch (_e) { /* skip */ }
389
- });
390
- }
391
- return pump();
392
- }
393
- });
394
- return rs;
395
- }
396
-
397
- ReadableStream.prototype.pipeTo = function (dest, options) {
398
- var preventClose = !!(options && options.preventClose);
399
- var preventAbort = !!(options && options.preventAbort);
400
- var preventCancel = !!(options && options.preventCancel);
401
- var writer = dest && typeof dest.getWriter === 'function' ? dest.getWriter() : null;
402
- var self = this;
403
- return new Promise(function (resolve, reject) {
404
- var reader = self.getReader();
405
- function releaseAll() {
406
- try { reader.releaseLock(); } catch (_e) { /* skip */ }
407
- if (writer && typeof writer.releaseLock === 'function') {
408
- try { writer.releaseLock(); } catch (_e) { /* skip */ }
409
- }
410
- }
411
- function closeDest() {
412
- if (preventClose) return resolve();
413
- if (writer && typeof writer.close === 'function') {
414
- Promise.resolve(writer.close()).then(function () { resolve(); }, function (e) { reject(e); });
415
- } else if (dest && typeof dest.close === 'function') {
416
- try { dest.close(); } catch (_e) { /* skip */ }
417
- resolve();
418
- } else {
419
- resolve();
420
- }
421
- }
422
- function abortDest(err) {
423
- if (preventAbort) return;
424
- try {
425
- if (writer && typeof writer.abort === 'function') {
426
- var pr = writer.abort(err);
427
- if (pr && typeof pr.then === 'function') pr.then(null, function () { /* already aborting */ });
428
- } else if (dest && typeof dest.abort === 'function') {
429
- dest.abort(err);
430
- }
431
- } catch (_e) { /* skip */ }
432
- }
433
- function cancelSelf(err) {
434
- if (preventCancel) return;
435
- try {
436
- var pr = self.cancel(err);
437
- if (pr && typeof pr.then === 'function') pr.then(null, function () { /* already canceling */ });
438
- } catch (_e) { /* skip */ }
439
- }
440
- function pump() {
441
- return reader.read().then(function (res) {
442
- if (res.done) {
443
- closeDest();
444
- return undefined;
445
- }
446
- var writePromise;
447
- if (writer) {
448
- if (writer.ready && typeof writer.ready.then === 'function') {
449
- writePromise = writer.ready.then(function () { return writer.write(res.value); });
450
- } else {
451
- writePromise = writer.write(res.value);
452
- }
453
- } else if (dest && typeof dest.write === 'function') {
454
- writePromise = Promise.resolve(dest.write(res.value));
455
- } else {
456
- writePromise = Promise.resolve();
457
- }
458
- return Promise.resolve(writePromise).then(pump, function (writeErr) {
459
- abortDest(writeErr); cancelSelf(writeErr);
460
- throw writeErr;
461
- });
462
- })['catch'](function (err) {
463
- releaseAll();
464
- abortDest(err); cancelSelf(err);
465
- reject(err);
466
- });
467
- }
468
- Promise.resolve()
469
- .then(pump)
470
- .then(function () { releaseAll(); }, function () { releaseAll(); });
471
- });
472
- };
473
-
474
- ReadableStream.prototype.pipeThrough = function (transform, options) {
475
- this.pipeTo(transform.writable, options);
476
- return transform.readable;
477
- };
478
-
479
- return {
480
- ReadableStream: ReadableStream,
481
- DefaultController: DefaultController,
482
- ByteController: ByteController,
483
- DefaultReader: DefaultReader,
484
- BYOBReader: BYOBReader,
485
- };
486
- })();
487
-
488
- setIfMissing(global, 'ReadableStream', PolyfillReadable.ReadableStream);
489
- setIfMissing(global, 'ReadableByteStreamController', PolyfillReadable.ByteController);
490
- setIfMissing(global, 'ReadableStreamDefaultController', PolyfillReadable.DefaultController);
491
- setIfMissing(global, 'ReadableStreamDefaultReader', PolyfillReadable.DefaultReader);
492
- setIfMissing(global, 'ReadableStreamBYOBReader', PolyfillReadable.BYOBReader);
493
-
494
- /* =======================================================
495
- * 4) WritableStream + DefaultWriter
496
- * ===================================================== */
497
- var PolyfillWritable = (function () {
498
- function DefaultWriter(stream) {
499
- var self = this;
500
- this._stream = stream;
501
- stream._writer = this;
502
- this.closed = new Promise(function (res) { self._resClosed = res; });
503
- this.ready = Promise.resolve(undefined);
504
- this.desiredSize = 1;
505
- }
506
- DefaultWriter.prototype.abort = function (reason) { return this._stream.abort(reason); };
507
- DefaultWriter.prototype.close = function () { return this._stream.close(); };
508
- DefaultWriter.prototype.releaseLock = function () {
509
- if (this._stream._writer === this) this._stream._writer = null;
510
- };
511
- DefaultWriter.prototype.write = function (chunk) { return this._stream.write(chunk); };
512
-
513
- function makeController(store) {
514
- return {
515
- get signal() { return store.signal; },
516
- error: function (e) { store.onError(e != null ? e : new Error('WritableStream errored')); }
517
- };
518
- }
519
-
520
- function WritableStream(sink, _strategy) {
521
- var self = this;
522
- self._writer = null;
523
- self.locked = false;
524
- self._state = { closed: false, errored: false, error: undefined };
525
- self._sink = sink || {};
526
- self._signal = { aborted: false, reason: undefined };
527
- var ctrlStore = {
528
- signal: self._signal,
529
- onError: function (err) { self._error(err); }
530
- };
531
- self._controller = makeController(ctrlStore);
532
- var start = self._sink && typeof self._sink.start === 'function' ? self._sink.start : null;
533
- if (start) {
534
- Promise.resolve(start.call(self._sink, self._controller))['catch'](function (e) { self._error(e); });
535
- }
536
- }
537
-
538
- WritableStream.prototype.getWriter = function () {
539
- if (this._writer) throw new TypeError('WritableStream is locked');
540
- return new DefaultWriter(this);
541
- };
542
-
543
- WritableStream.prototype.write = function (chunk) {
544
- if (this._state.errored) return Promise.reject(this._state.error);
545
- if (this._state.closed) return Promise.reject(new TypeError('WritableStream is closed'));
546
- var fn = this._sink && typeof this._sink.write === 'function' ? this._sink.write : null;
547
- if (!fn) return Promise.resolve();
548
- try {
549
- var r = fn.call(this._sink, chunk, this._controller);
550
- return Promise.resolve(r);
551
- } catch (e) { return Promise.reject(e); }
552
- };
553
-
554
- WritableStream.prototype.close = function () {
555
- var self = this;
556
- if (self._state.closed || self._state.errored) return Promise.resolve();
557
- self._state.closed = true;
558
- var fn = self._sink && typeof self._sink.close === 'function' ? self._sink.close : null;
559
- var after = function () { self._finalize(); };
560
- if (!fn) { after(); return Promise.resolve(); }
561
- try {
562
- var r = fn.call(self._sink);
563
- return Promise.resolve(r).then(function () { after(); }, function (e) { after(); return Promise.reject(e); });
564
- } catch (e) { after(); return Promise.reject(e); }
565
- };
566
-
567
- WritableStream.prototype.abort = function (reason) {
568
- var self = this;
569
- if (self._state.closed || self._state.errored) return Promise.resolve();
570
- self._signal.aborted = true;
571
- self._signal.reason = reason;
572
- self._state.errored = true;
573
- self._state.error = reason;
574
- var fn = self._sink && typeof self._sink.abort === 'function' ? self._sink.abort : null;
575
- var after = function () { self._finalize(); };
576
- if (!fn) { after(); return Promise.resolve(); }
577
- try {
578
- var r = fn.call(self._sink, reason);
579
- return Promise.resolve(r).then(function () { after(); }, function (e) { after(); return Promise.reject(e); });
580
- } catch (e) { after(); return Promise.reject(e); }
581
- };
582
-
583
- WritableStream.prototype._error = function (err) {
584
- if (this._state.closed || this._state.errored) return;
585
- this._state.errored = true;
586
- this._state.error = err;
587
- this._finalize();
588
- };
589
-
590
- WritableStream.prototype._finalize = function () {
591
- if (this._writer && this._writer._resClosed) this._writer._resClosed(undefined);
592
- };
593
-
594
- return { WritableStream: WritableStream, DefaultWriter: DefaultWriter };
595
- })();
596
-
597
- setIfMissing(global, 'WritableStream', PolyfillWritable.WritableStream);
598
- setIfMissing(global, 'WritableStreamDefaultWriter', PolyfillWritable.DefaultWriter);
599
-
600
- /* =======================================================
601
- * 5) TransformStream
602
- * ===================================================== */
603
- var PolyfillTransform = (function () {
604
- function TransformStream(transformer, _writableStrategy, _readableStrategy) {
605
- var readableController;
606
- var readable = new global.ReadableStream({
607
- start: function (controller) {
608
- readableController = controller;
609
- var startFn = transformer && typeof transformer.start === 'function' ? transformer.start : null;
610
- if (startFn) {
611
- Promise.resolve(startFn.call(transformer, readableController))['catch'](function (e) {
612
- try { readableController.error(e); } catch (_e) { /* skip */ }
613
- });
614
- }
615
- }
616
- });
617
- var writable = new global.WritableStream({
618
- write: function (chunk, controller) {
619
- var fn = transformer && typeof transformer.transform === 'function' ? transformer.transform : null;
620
- if (fn) {
621
- return Promise.resolve(fn.call(transformer, chunk, readableController));
622
- }
623
- readableController.enqueue(chunk);
624
- return Promise.resolve();
625
- },
626
- close: function () {
627
- var flush = transformer && typeof transformer.flush === 'function' ? transformer.flush : null;
628
- var p = flush ? Promise.resolve(flush.call(transformer, readableController)) : Promise.resolve();
629
- return p.then(function () { try { readableController.close(); } catch (_e) { /* skip */ } });
630
- },
631
- abort: function (reason) {
632
- try { readableController.error(reason); } catch (_e) { /* skip */ }
633
- var abortFn = transformer && typeof transformer.abort === 'function' ? transformer.abort : null;
634
- return abortFn ? Promise.resolve(abortFn.call(transformer, reason)) : Promise.resolve();
635
- }
636
- });
637
- this.readable = readable;
638
- this.writable = writable;
639
- }
640
- return TransformStream;
641
- })();
642
-
643
- setIfMissing(global, 'TransformStream', PolyfillTransform);
644
-
645
- /* =======================================================
646
- * 6) TextDecoderStream / TextEncoderStream
647
- * ===================================================== */
648
- if (typeof global.TextDecoderStream === 'undefined' && typeof global.TextDecoder === 'function') {
649
- var TextDecoderStream = (function () {
650
- function PolyfillTDS(label, options) {
651
- var decoder = new global.TextDecoder(label, options);
652
- this.encoding = decoder.encoding;
653
- this.fatal = decoder.fatal;
654
- this.ignoreBOM = decoder.ignoreBOM;
655
- var ts = new PolyfillTransform({
656
- transform: function (chunk, controller) {
657
- controller.enqueue(decoder.decode(chunk, { stream: true }));
658
- },
659
- flush: function (controller) {
660
- var tail = decoder.decode();
661
- if (tail) controller.enqueue(tail);
662
- }
663
- });
664
- this.readable = ts.readable;
665
- this.writable = ts.writable;
666
- }
667
- return PolyfillTDS;
668
- })();
669
- global.TextDecoderStream = TextDecoderStream;
670
- }
671
-
672
- if (typeof global.TextEncoderStream === 'undefined' && typeof global.TextEncoder === 'function') {
673
- var TextEncoderStream = (function () {
674
- function PolyfillTES() {
675
- var encoder = new global.TextEncoder();
676
- this.encoding = 'utf-8';
677
- var ts = new PolyfillTransform({
678
- transform: function (chunk, controller) { controller.enqueue(encoder.encode(chunk)); }
679
- });
680
- this.readable = ts.readable;
681
- this.writable = ts.writable;
682
- }
683
- return PolyfillTES;
684
- })();
685
- global.TextEncoderStream = TextEncoderStream;
686
- }
687
-
688
- // Safari 半残实现的第二道防线(所有 Polyfill* 都已声明后再执行):
689
- // 老版本 Safari 中,ReadableStream 已作为函数存在,但 BYOB 控制器缺失,
690
- // 或 new ReadableStream({type:'bytes'}) 会抛 "ReadableByteStreamController is not implemented"
691
- // (React 18 renderToReadableStream → createInternalReadableStreamFromUnderlyingSource 路径)。
692
- // 命中任一迹象就强制整体替换,保证 React SSR 路径拿到一致实现。
693
- (function detectBrokenStreamsAndOverride() {
694
- try {
695
- var RS = global.ReadableStream;
696
- var RBC = global.ReadableByteStreamController;
697
- var WS = global.WritableStream;
698
- var TS = global.TransformStream;
699
- if (typeof RS !== 'function') return; // 下一节 setIfMissing 或上方安装已覆盖
700
-
701
- var broken = false;
702
- if (typeof RBC !== 'function') broken = true;
703
-
704
- if (!broken) {
705
- try {
706
- var src = {
707
- type: 'bytes',
708
- start: function (c) { try { c.close(); } catch (_) {} },
709
- };
710
- var tmp = new RS(src);
711
- try {
712
- var byob = tmp.getReader({ mode: 'byob' });
713
- if (!byob) broken = true;
714
- else try { byob.releaseLock(); } catch (_) {}
715
- } catch (bErr) {
716
- var bMsg = String(bErr && bErr.message || '');
717
- if (/not implemented|ReadableByteStreamController|byob|not supported|invalid mode/i.test(bMsg)) broken = true;
718
- }
719
- try { tmp.cancel && tmp.cancel(); } catch (_) {}
720
- } catch (e) {
721
- var msg = String(e && e.message || '');
722
- if (/ReadableByteStreamController is not implemented|is not implemented|not supported|type bytes|invalid type/i.test(msg)) broken = true;
723
- }
724
- }
725
-
726
- if (!broken) {
727
- var proto = RS.prototype;
728
- if (!proto || typeof proto.pipeTo !== 'function' || typeof proto.pipeThrough !== 'function' || typeof proto.tee !== 'function') {
729
- if (typeof WS !== 'function') broken = true;
730
- }
731
- }
732
- if (!broken && typeof TS !== 'undefined' && typeof TS !== 'function') broken = true;
733
-
734
- if (!broken) return;
735
-
736
- var PolyRS = PolyfillReadable && PolyfillReadable.ReadableStream;
737
- var PolyWS = PolyfillWritable && PolyfillWritable.WritableStream;
738
- var PolyTS = PolyfillTransform;
739
-
740
- function forceSet(key, value) {
741
- try {
742
- Object.defineProperty(global, key, {
743
- configurable: true, writable: true, enumerable: false, value: value,
744
- });
745
- } catch (_) {
746
- try { global[key] = value; } catch (__) {}
747
- }
748
- try { if (global[key] !== value) global[key] = value; } catch (_) {}
749
- }
750
-
751
- if (PolyRS) forceSet('ReadableStream', PolyRS);
752
- if (PolyfillReadable) {
753
- forceSet('ReadableByteStreamController', PolyfillReadable.ByteController);
754
- forceSet('ReadableStreamDefaultController', PolyfillReadable.DefaultController);
755
- forceSet('ReadableStreamDefaultReader', PolyfillReadable.DefaultReader);
756
- forceSet('ReadableStreamBYOBReader', PolyfillReadable.BYOBReader);
757
- }
758
- if (PolyWS) {
759
- forceSet('WritableStream', PolyWS);
760
- forceSet('WritableStreamDefaultWriter', PolyfillWritable.DefaultWriter);
761
- }
762
- if (PolyTS) forceSet('TransformStream', PolyTS);
763
- } catch (_e) { /* skip */ }
764
- })();
765
-
766
- /* =======================================================
767
- * 7) 针对部分原生 ReadableStream 但缺少 pipeTo 的老版本 Safari 原型补齐
768
- * ===================================================== */
769
- (function patchNativeReadableStreamPrototype() {
770
- var RS = global.ReadableStream;
771
- if (!RS || typeof RS !== 'function') return;
772
- try {
773
- var proto = RS.prototype;
774
- if (!proto) return;
775
- var PolyRS = PolyfillReadable.ReadableStream.prototype;
776
- if (typeof proto.pipeTo !== 'function') {
777
- Object.defineProperty(proto, 'pipeTo', {
778
- configurable: true, writable: true, value: PolyRS.pipeTo,
779
- });
780
- }
781
- if (typeof proto.pipeThrough !== 'function') {
782
- Object.defineProperty(proto, 'pipeThrough', {
783
- configurable: true, writable: true, value: PolyRS.pipeThrough,
784
- });
785
- }
786
- if (typeof proto.tee !== 'function') {
787
- Object.defineProperty(proto, 'tee', {
788
- configurable: true, writable: true, value: PolyRS.tee,
789
- });
790
- }
791
- } catch (_err) { /* skip */ }
792
- })();
793
-
794
- /* =======================================================
795
- * 8) queueMicrotask (少数老 WebView 缺失)
796
- * ===================================================== */
797
- if (typeof global.queueMicrotask !== 'function') {
798
- global.queueMicrotask = function (cb) {
799
- Promise.resolve().then(function () { try { cb(); } catch (e) { throw e; } });
800
- };
801
- }
802
- })(typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof globalThis !== 'undefined' ? globalThis : this);