@forsion/unit 2.13.1 → 2.13.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.
Files changed (187) hide show
  1. package/main.mjs +21 -3
  2. package/package.json +1 -1
  3. package/release.json +5 -5
  4. package/web/assets/{ArtificialView-XwHMLUFb.js → ArtificialView-DS97zlMg.js} +1 -1
  5. package/web/assets/{AutomationBuilder-hqs0QhMt.js → AutomationBuilder-BsJc8wuC.js} +1 -1
  6. package/web/assets/CalendarConfigView-BN8mraSo.js +1 -0
  7. package/web/assets/CalendarView-D55PA1vn.js +1 -0
  8. package/web/assets/{CapabilityMenu-SwVlZ06x.js → CapabilityMenu-BVrokPpT.js} +1 -1
  9. package/web/assets/{CheckboxInput-BC-5a_C9.js → CheckboxInput-BuJ3HPm_.js} +1 -1
  10. package/web/assets/{Chrome-HdfyYV3i.js → Chrome-amTcZNE4.js} +1 -1
  11. package/web/assets/{CodeView-CFL6yQ-6.js → CodeView-DRVh13k9.js} +3 -3
  12. package/web/assets/DashboardGridView-D9s9pez_.css +1 -0
  13. package/web/assets/DashboardGridView-DlFyYfUh.js +17 -0
  14. package/web/assets/{EventCard-B_ndpqH_.js → EventCard-DUrn2krw.js} +1 -1
  15. package/web/assets/ExcalidrawCanvas-TpbzBF-J.js +1 -0
  16. package/web/assets/{FloatingToc-Ce9GamvH.js → FloatingToc-B1d4-5EL.js} +1 -1
  17. package/web/assets/HomepageView-DnQ_5Obe.css +1 -0
  18. package/web/assets/HomepageView-nzKfbHM-.js +1 -0
  19. package/web/assets/ImageStudioPanels-B2PTq6Yb.js +3 -0
  20. package/web/assets/{ImageStudioView-UPv52acl.js → ImageStudioView-Cawr6pGW.js} +1 -1
  21. package/web/assets/InlineFiles-DKPH5JHz.js +1 -0
  22. package/web/assets/MarkdownBlock-BHpDy2qQ.js +58 -0
  23. package/web/assets/ModelPill-ChzAM3z1.js +2 -0
  24. package/web/assets/MuseLibraryView-DLuQ_jyV.js +2 -0
  25. package/web/assets/{MuseView-CC2A7MBs.js → MuseView-CDDwV6SR.js} +2 -2
  26. package/web/assets/{PageHistoryPanel-KhKT1DLy.js → PageHistoryPanel-BbdXpjJM.js} +2 -2
  27. package/web/assets/{PdfAnnotator-DUyrgY-t.js → PdfAnnotator-CW0wPWRB.js} +1 -1
  28. package/web/assets/PenRow-BY-MZLDQ.js +1 -0
  29. package/web/assets/{ProductView-CgsIYZqD.js → ProductView-0ieVL3rY.js} +1 -1
  30. package/web/assets/{RightPanel-BHDgqTFs.js → RightPanel-BRexwQ3W.js} +3 -3
  31. package/web/assets/RunLocationPicker-BrDfOu8-.css +1 -0
  32. package/web/assets/RunLocationPicker-CadYiE7C.js +43 -0
  33. package/web/assets/{SketchCard-BGYz-bXP.js → SketchCard-BcXCdBAs.js} +212 -8
  34. package/web/assets/{StudioGuestSurface-lt6znmkl.js → StudioGuestSurface-ZJFKnNYF.js} +1 -1
  35. package/web/assets/TodoListView-DuRdVFgB.js +1 -0
  36. package/web/assets/{Tooltip-ZxrDqN4p.js → Tooltip-DtDUL18W.js} +1 -1
  37. package/web/assets/UnifiedPage-D7JTfABH.js +68 -0
  38. package/web/assets/{amadeus-manual.en-DzRWr4BL.js → amadeus-manual.en-B8J-svqq.js} +1 -1
  39. package/web/assets/{amadeus-manual.zh-DW32DkL7.js → amadeus-manual.zh-CkCOFnrg.js} +1 -1
  40. package/web/assets/appStore-ClD7vq5L.css +1 -0
  41. package/web/assets/appStore-affnJoin.js +3292 -0
  42. package/web/assets/{arrow-up-right-DrCXuWS7.js → arrow-up-right-R4P9Mmxz.js} +1 -1
  43. package/web/assets/{astryxBridge-D-m4_kYt.js → astryxBridge-CT2wZJXs.js} +3 -3
  44. package/web/assets/{automationListSource-C8BNy6RY.js → automationListSource-JVBMsMbC.js} +1 -1
  45. package/web/assets/boardSurface-Ce0_vf9f.js +1 -0
  46. package/web/assets/{book-open-OLNm7OaB.js → book-open-CcXCToyx.js} +1 -1
  47. package/web/assets/{calendarNavStore-Cylfvv3s.js → calendarNavStore-tQJRVpum.js} +1 -1
  48. package/web/assets/{canvasPrefs-8taQ42Cz.js → canvasPrefs-CSuX9aLF.js} +1 -1
  49. package/web/assets/{chatBoxSurface-CIlzs45H.js → chatBoxSurface-IG6Vu4Dz.js} +1 -1
  50. package/web/assets/{circle-question-mark-XbAFplz1.js → circle-question-mark-O8AhUz35.js} +1 -1
  51. package/web/assets/{circle-x-fcReAZaE.js → circle-x-AV2ZWulM.js} +1 -1
  52. package/web/assets/{client-0MPbodA6.js → client-BqhpYbYL.js} +1 -1
  53. package/web/assets/{code-xml-Cuna8Kh4.js → code-xml-DdR58F83.js} +1 -1
  54. package/web/assets/{codeStudioStore-BBU62GTy.js → codeStudioStore-Dq5i8nbE.js} +1 -1
  55. package/web/assets/codingNavigation-CxdCK78-.js +53 -0
  56. package/web/assets/codingNavigation-_tOR0ell.css +1 -0
  57. package/web/assets/{create-BGtEfCcg.js → create-BgJN5qsj.js} +2 -2
  58. package/web/assets/dashboardSurface-BY-AFB-r.js +1 -0
  59. package/web/assets/{deskCapture-BiUCmqfc.js → deskCapture-BD2qD6NI.js} +1 -1
  60. package/web/assets/{diff2html-BNp2FTbk.js → diff2html-OoRdHZ_O.js} +1 -1
  61. package/web/assets/{docx-preview-CFznGVOU.js → docx-preview-B43XC8Cn.js} +1 -1
  62. package/web/assets/{emoji-6zl4yfOS.js → emoji-BPdA62d7.js} +1 -1
  63. package/web/assets/{floatingTocSurface-DreXPCa6.js → floatingTocSurface-BM2SYE_u.js} +1 -1
  64. package/web/assets/{foldActions-05QcQziQ.js → foldActions-BcyvNVBs.js} +1 -1
  65. package/web/assets/{folder-BpsfOHD4.js → folder-CCZqnwRc.js} +1 -1
  66. package/web/assets/{folder-plus-BeQHr4AZ.js → folder-plus-BJKT1Pqg.js} +1 -1
  67. package/web/assets/{gestures-DQBCcK4y.js → gestures-BwPbZDkU.js} +1 -1
  68. package/web/assets/{hand-Bko7ms15.js → hand-DRu7IJdU.js} +1 -1
  69. package/web/assets/{hard-drive-BpuI5ebj.js → hard-drive-CXNJUCXw.js} +1 -1
  70. package/web/assets/i18n-BMo19xaR.css +1 -0
  71. package/web/assets/i18n.generated-DvY59Zq3.js +15 -0
  72. package/web/assets/{imageStudio-BLVNKmEG.js → imageStudio-Axwmd4GW.js} +2 -2
  73. package/web/assets/imageStudio-DZ0qGU2s.css +1 -0
  74. package/web/assets/{index-C4L6vjd_.js → index-B1rE_NwA.js} +1 -1
  75. package/web/assets/{index-OD1gSX3h.js → index-BFTY79aq.js} +1 -1
  76. package/web/assets/{index-D6AycQIz.js → index-BGEkZBs2.js} +1 -1
  77. package/web/assets/{index-Cff42k7q.js → index-BO2XJc36.js} +1 -1
  78. package/web/assets/index-BYUntVIZ.js +297 -0
  79. package/web/assets/{index-C1doZp5H.js → index-C65u4fXd.js} +1 -1
  80. package/web/assets/{index-D7gVhvNY.js → index-C_Ohi-I3.js} +1 -1
  81. package/web/assets/{index-rggq2czF.js → index-CkMhazev.js} +1 -1
  82. package/web/assets/{index-D9UZQy42.js → index-CobUnTcv.js} +1 -1
  83. package/web/assets/{index-BgnNNv3e.js → index-D102FOuM.js} +1 -1
  84. package/web/assets/{index-DuBQ0j2g.js → index-D3CYvMpl.js} +1 -1
  85. package/web/assets/{index-BHm6K743.js → index-D78izbLA.js} +1 -1
  86. package/web/assets/{index-CwcOeZdT.js → index-DDMXVG0h.js} +1 -1
  87. package/web/assets/{index-Ck_O3Jdd.js → index-DY0M_dpd.js} +1 -1
  88. package/web/assets/{index-CLHoq1w-.js → index-DcbZwhpE.js} +1 -1
  89. package/web/assets/{index-CJeUgjPU.js → index-Dlkq7gkE.js} +1 -1
  90. package/web/assets/{index-o8cj0pRH.js → index-HqmJW2np.js} +1 -1
  91. package/web/assets/{index-sCXThwqZ.js → index-LxlyPm0_.js} +1 -1
  92. package/web/assets/{index-CD3yIkOA.js → index-Uq4J2aoW.js} +1 -1
  93. package/web/assets/{index-rHjhbwvm.js → index-WbVt2P8R.js} +1 -1
  94. package/web/assets/{index-CUZI62qU.js → index-XyjIhkPw.js} +1 -1
  95. package/web/assets/index-Y2kzYlZq.js +1 -0
  96. package/web/assets/{index-C0Gy2NQ6.js → index-mB0EQkyZ.js} +1 -1
  97. package/web/assets/{index-Uo5tswys.js → index-pJh7JN7_.js} +1 -1
  98. package/web/assets/{index-BF10xp_K.js → index-taRxNsbp.js} +1 -1
  99. package/web/assets/{invitePage-b0HGvMj6.js → invitePage-BW0BH8Ac.js} +1 -1
  100. package/web/assets/{ipc-CxAyeo8q.js → ipc-D7yENkjV.js} +1 -1
  101. package/web/assets/{jszip.min-B94KpE21.js → jszip.min-UE5d5vPJ.js} +1 -1
  102. package/web/assets/{layout-grid-BBVuEdWG.js → layout-grid-Hs3eDA07.js} +1 -1
  103. package/web/assets/linkFollow-Msu1XH9v.js +8 -0
  104. package/web/assets/{list-tree-4-0QDbLu.js → list-tree-DmuRb-p9.js} +1 -1
  105. package/web/assets/{listFold-DLuxXiIj.js → listFold-CKxjyY5_.js} +1 -1
  106. package/web/assets/{lock-CnbZm4vo.js → lock-kffGfeHt.js} +1 -1
  107. package/web/assets/{log-out-BEynWaHa.js → log-out-B5gEP0tF.js} +1 -1
  108. package/web/assets/main-DIyFlyfK.js +20 -0
  109. package/web/assets/markdownEditorSurface-Cx2rqFAY.js +3 -0
  110. package/web/assets/{message-square-plus-CpiKDvle.js → message-square-plus-DxBPIhPS.js} +1 -1
  111. package/web/assets/{messages-_jta1lSI.js → messages-4w1Khzm1.js} +1 -1
  112. package/web/assets/minus-CfoZ4oxr.js +1 -0
  113. package/web/assets/mobileEntry-B8JwR53-.js +13 -0
  114. package/web/assets/{nativeDownload-BYT082bY.js → nativeDownload-Udrv_tmU.js} +1 -1
  115. package/web/assets/{pageChrome-D3Niv1JM.js → pageChrome-D-9npbUE.js} +1 -1
  116. package/web/assets/pageChrome-eO9pb2fH.css +1 -0
  117. package/web/assets/{pageTree-CgfvpzIj.js → pageTree-CIXFRCLk.js} +4 -4
  118. package/web/assets/{pen-tool-BXEFnU2i.js → pen-tool-D_Y9We9x.js} +1 -1
  119. package/web/assets/{pencil-cqvCkekG.js → pencil-DGiTRzW1.js} +1 -1
  120. package/web/assets/phoneList-BQfCJwKF.css +1 -0
  121. package/web/assets/phoneList-DHUia6HT.js +9 -0
  122. package/web/assets/pluginChat-BXuJiMYi.js +2 -0
  123. package/web/assets/{redo-2-BO7wCDwy.js → redo-2-QgiKEg9T.js} +1 -1
  124. package/web/assets/{rotate-ccw-BvipPIjC.js → rotate-ccw-BLoH5er1.js} +1 -1
  125. package/web/assets/{sharePage-XbN50US7.js → sharePage-DYYN5usb.js} +2 -2
  126. package/web/assets/{shareViewer-BaYogetW.js → shareViewer-BzuSyJv_.js} +2 -2
  127. package/web/assets/{star-BQWMXnn7.js → star-BmywYD3u.js} +1 -1
  128. package/web/assets/tableSurface-21LDYY_G.js +1 -0
  129. package/web/assets/{terminal-l9k6RDrH.js → terminal-BlmA_Z1C.js} +1 -1
  130. package/web/assets/{terminalView-Cpnt5_0P.js → terminalView-SAxITnRW.js} +1 -1
  131. package/web/assets/{theme-C6D3tMGV.css → theme-Dgqst5S9.css} +1 -1
  132. package/web/assets/{type-CFoaj2eD.js → type-DmIL6FB-.js} +1 -1
  133. package/web/assets/{undo-2-DusxpdLa.js → undo-2-yMeXc8Wi.js} +1 -1
  134. package/web/assets/{unitAccount-DwutFPPw.js → unitAccount-BPYRAa3m.js} +1 -1
  135. package/web/assets/unitBridge-BNVzai6X.js +1 -0
  136. package/web/assets/{unitCloudTransport-vA7cLDts.js → unitCloudTransport-iFweA1xk.js} +1 -1
  137. package/web/assets/{unitOwnerAccess-LBlJ1YfA.js → unitOwnerAccess-Bggl7bDP.js} +1 -1
  138. package/web/assets/{unitShim-B_M9IrbC.js → unitShim-BP2nBO_k.js} +3 -3
  139. package/web/assets/{upload-ZrOj6tXA.js → upload-D20PZHXc.js} +1 -1
  140. package/web/assets/userSpaces-CrLrKklx.js +1 -0
  141. package/web/assets/viewportLock-DO1lzA2N.css +1 -0
  142. package/web/assets/viewportLock-tlT6H_Hc.js +629 -0
  143. package/web/assets/{workflow-DPoG4QE2.js → workflow-Bd6xBHiT.js} +1 -1
  144. package/web/assets/{zoom-in-lbTgzdQP.js → zoom-in-_TgFOpyv.js} +1 -1
  145. package/web/index.html +24 -27
  146. package/web/assets/CalendarConfigView-DKib8Oed.js +0 -1
  147. package/web/assets/CalendarView-DJ5iOzvu.js +0 -1
  148. package/web/assets/DashboardGridView-B9DCWYVb.js +0 -17
  149. package/web/assets/DashboardGridView-Ck3LKkOb.css +0 -1
  150. package/web/assets/ExcalidrawCanvas-BQ4KKLJP.js +0 -1
  151. package/web/assets/HomepageView-BNabJQfP.css +0 -1
  152. package/web/assets/HomepageView-RCOfcVbE.js +0 -1
  153. package/web/assets/ImageStudioPanels-lkS_y2uM.js +0 -3
  154. package/web/assets/InlineFiles-CQbQumkf.js +0 -1
  155. package/web/assets/MarkdownBlock-CkqiwPXa.js +0 -58
  156. package/web/assets/ModelPill-CY-rU1RU.js +0 -2
  157. package/web/assets/MuseLibraryView-CtTHlVnT.js +0 -2
  158. package/web/assets/RunLocationPicker-BE5mxnab.css +0 -1
  159. package/web/assets/RunLocationPicker-DBnXYV5B.js +0 -38
  160. package/web/assets/SidebarRow-BAJxbMcx.js +0 -9
  161. package/web/assets/SidebarRow-CsWEqPKX.css +0 -1
  162. package/web/assets/TodoListView-DPKhee6i.js +0 -1
  163. package/web/assets/UnifiedPage-BX6ZQL0h.js +0 -68
  164. package/web/assets/appStore-DWP8UET9.js +0 -3166
  165. package/web/assets/appStore-wtOILggO.css +0 -1
  166. package/web/assets/codingNavigation-CZB4v1ZW.css +0 -1
  167. package/web/assets/codingNavigation-DDlPpPk5.js +0 -47
  168. package/web/assets/dashboardSurface-BYM3C7WG.js +0 -1
  169. package/web/assets/i18n-ecQQxiMQ.css +0 -1
  170. package/web/assets/i18n.generated-BuLjnmY8.js +0 -15
  171. package/web/assets/imageStudio--KF9gwHA.css +0 -1
  172. package/web/assets/index-BM2o7PeV.js +0 -298
  173. package/web/assets/index-CuiYK18N.js +0 -1
  174. package/web/assets/linkFollow-B7ivDZMM.js +0 -8
  175. package/web/assets/main-sIq2N9Z5.js +0 -20
  176. package/web/assets/markdownEditorSurface-ZSJ3RHAv.js +0 -3
  177. package/web/assets/mdMarkStore-DQHDjG7s.js +0 -2
  178. package/web/assets/mdMarks-DbIcRa0O.js +0 -1
  179. package/web/assets/minus-C9ndHJ9O.js +0 -1
  180. package/web/assets/mobileEntry-CPmU_c4m.js +0 -13
  181. package/web/assets/pageChrome-CovzZPdb.css +0 -1
  182. package/web/assets/pluginChat-BbBukMuN.js +0 -2
  183. package/web/assets/tableSurface-BXqqidd1.js +0 -1
  184. package/web/assets/unitBridge-CcgQpkqV.js +0 -1
  185. package/web/assets/userSpaces-uJOnsedR.js +0 -1
  186. package/web/assets/viewportLock-D3SNkwS2.js +0 -631
  187. package/web/assets/viewportLock-IP1zaVkz.css +0 -1
@@ -1,6 +1,6 @@
1
- import{F as N}from"./appStore-DWP8UET9.js";import{j as o,u as z,d as i}from"./index-BM2o7PeV.js";const O=[["path",{d:"M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-1",key:"1q9hii"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],ct=N("file-input",O);const F=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],dt=N("scroll-text",F),D="forsion-sketch";function ft(t){const e=Math.max(0,...(t.match(/`+/g)??[]).map(a=>a.length)),n="`".repeat(Math.max(3,e+1));return`${n}${D}
1
+ import{G}from"./appStore-affnJoin.js";import{j as l,u as J,d as a}from"./index-BYUntVIZ.js";const rt=[["path",{d:"M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-1",key:"1q9hii"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],Pt=G("file-input",rt);const it=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],Kt=G("scroll-text",it),ot="forsion-sketch";function Vt(t){const e=Math.max(0,...(t.match(/`+/g)??[]).map(s=>s.length)),n="`".repeat(Math.max(3,e+1));return`${n}${ot}
2
2
  ${t.replace(/\s+$/,"")}
3
- ${n}`}const K=`/* The sketch document is isolated. All colors inherit Forsion's current theme. */
3
+ ${n}`}const ct=`/* The sketch document is isolated. All colors inherit Forsion's current theme. */
4
4
  html, body { margin: 0; padding: 0; }
5
5
  *, *::before, *::after { box-sizing: border-box; }
6
6
  body {
@@ -109,6 +109,24 @@ fs-chart + fs-flow, fs-flow + fs-chart, fs-chart + fs-chart { margin-top: 28px;
109
109
  .fs-flow-steps--vertical .fs-flow-content { margin-top: 3px; }
110
110
  .fs-flow-steps--vertical .fs-flow-step:not(:last-child)::after { left: 15px; top: 39px; width: 1px; height: calc(100% - 23px); }
111
111
  .fs-flow-steps--vertical .fs-flow-step:not(:last-child)::before { top: calc(100% + 11px); left: 12px; transform: rotate(135deg); }
112
+ /* 直播补丁(10-09):新来的部件淡入;文字原地续写不动画。 */
113
+ [data-fs-new] { animation: fs-in .28s ease-out both; }
114
+ @keyframes fs-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
115
+ /* 统一拼装部件(10-09,对标 Intelligent UI 的固定组件库):网格 / 选项 / 按钮行 / 提示块 / 对比 / 追问选择 / 勾选清单。 */
116
+ .fs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(128px, 100%), 1fr)); gap: 12px; margin: 4px 0 12px; } /* 128:1200 宽的窗口里聊天栏卡内只有 ≈430px,要并排得下三个选项 */
117
+ .fs-option { display: grid; align-content: start; gap: 6px; min-width: 0; padding: 12px 14px; border-radius: var(--fs-radius); background: var(--fs-surface); }
118
+ .fs-option > h4 { margin: 0; font-size: 14px; }
119
+ .fs-points { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; }
120
+ .fs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
121
+ .fs-callout { padding: 10px 14px; border-left: 2px solid var(--fs-accent); background: var(--fs-surface); border-radius: 0 var(--fs-radius) var(--fs-radius) 0; font-size: 13px; }
122
+ fs-compare, fs-choice, fs-checklist { display: block; min-width: 0; }
123
+ fs-compare + fs-choice, fs-choice + fs-compare, fs-checklist + fs-choice, fs-chart + fs-compare, fs-compare + fs-chart, fs-flow + fs-checklist, fs-checklist + fs-flow { margin-top: 24px; }
124
+ .fs-choice-question { margin: 0 0 10px; font-size: 14px; font-weight: 500; }
125
+ .fs-choice-options { display: flex; flex-wrap: wrap; gap: 8px; }
126
+ .fs-checklist-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
127
+ .fs-checklist-items .fs-check { align-items: start; }
128
+ .fs-checklist-items .fs-check input { margin-top: 4px; }
129
+ .fs-checklist-items .fs-check input:checked + span { color: var(--fs-muted); text-decoration: line-through; }
112
130
  ::selection { background: var(--fs-accent-soft); }
113
131
  @media(max-width:480px) {
114
132
  body { padding: 14px 12px; }
@@ -122,9 +140,18 @@ fs-chart + fs-flow, fs-flow + fs-chart, fs-chart + fs-chart { margin-top: 28px;
122
140
  @media(prefers-reduced-motion:reduce) {
123
141
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
124
142
  }
125
- `,V=`/* Runs only inside the opaque-origin sandbox. No host capabilities or network. */
143
+ `,lt=`/* Runs only inside the opaque-origin sandbox. No host capabilities or network. */
126
144
  (() => {
127
145
  let state = __SKETCH_INITIAL_STATE__
146
+ // 授权令牌(Codex 10-09 二轮 P1):宿主只认带这个 nonce 的 ask / copy。它只活在这个闭包里 —— 运行时跑完就把自己的 script 节点删掉
147
+ // (模型脚本读 outerHTML 也拿不到),模型 HTML 绕过运行时直接 postMessage 就没有它。真正的手势判定因此可以放在卡内:
148
+ // navigator.userActivation 是每个 window 各自的,父文档里敲键不会传进子帧,子帧里的真点击才会让它为真。getter 在模型脚本
149
+ // 跑之前就抓好,模型脚本改不了。
150
+ const NONCE = '__SKETCH_NONCE__'
151
+ const uaGet = typeof Navigator !== 'undefined' ? Object.getOwnPropertyDescriptor(Navigator.prototype, 'userActivation')?.get : undefined
152
+ const activeGet = typeof UserActivation !== 'undefined' ? Object.getOwnPropertyDescriptor(UserActivation.prototype, 'isActive')?.get : undefined
153
+ const gestureActive = () => { try { const ua = uaGet && uaGet.call(navigator); return !!(ua && activeGet && activeGet.call(ua)) } catch { return false } }
154
+ const send = (msg) => parent.postMessage({ ...msg, nonce: NONCE }, '*')
128
155
  window.forsionSketch = Object.freeze({
129
156
  get state() { return state },
130
157
  setState(value) {
@@ -133,7 +160,23 @@ fs-chart + fs-flow, fs-flow + fs-chart, fs-chart + fs-chart { margin-top: 28px;
133
160
  state = JSON.parse(json)
134
161
  parent.postMessage({ type: 'sketch-state', state }, '*')
135
162
  },
163
+ // 卡内按钮回头改答案:把这句话当用户的下一条消息发出去(宿主侧再核 nonce + 焦点、限频、限长,只在对话里接)。
164
+ // 手势检查在这里是**真闸**(见上):模型写的卡不能一加载 / 定时就替用户发话。
165
+ ask(text) {
166
+ if (!gestureActive()) throw new Error('forsionSketch.ask() must be called from a user gesture')
167
+ const t = String(text ?? '').trim().slice(0, 400)
168
+ if (!t) throw new Error('forsionSketch.ask() needs a non-empty text')
169
+ send({ type: 'sketch-ask', text: t })
170
+ },
171
+ // 复制到剪贴板(沙箱帧自己没有剪贴板权限,由宿主代写;同样要用户手势)。
172
+ copy(text) {
173
+ if (!gestureActive()) throw new Error('forsionSketch.copy() must be called from a user gesture')
174
+ const t = String(text ?? '')
175
+ if (!t) return
176
+ send({ type: 'sketch-copy', text: t.slice(0, 20000) })
177
+ },
136
178
  })
179
+ document.currentScript?.remove()
137
180
 
138
181
  // An href must never turn a sandbox frame into an external navigation surface.
139
182
  document.addEventListener('click', (event) => {
@@ -141,10 +184,68 @@ fs-chart + fs-flow, fs-flow + fs-chart, fs-chart + fs-chart { margin-top: 28px;
141
184
  }, true)
142
185
  document.addEventListener('submit', (event) => event.preventDefault(), true)
143
186
 
187
+ // 直播补丁(10-09,对标 ChatGPT Intelligent UI 的流式组件):宿主把最新 html 发进来,这里**原地**打补丁 —— 不换 srcdoc、不重载。
188
+ // 同位置同标签的元素保留(只同步属性、递归子节点),文字节点原地续写,新节点标 data-fs-new 淡入;自定义元素(fs-*)内容一变整个换掉
189
+ // (它们从 JSON 子节点取数据,只在接入时解析)。终稿(sketch-final)再把惰性的 script 节点换成会执行的,并补发 DOMContentLoaded / load,
190
+ // 让「等 DOM 就绪再初始化」的两种写法都能跑。
191
+ function syncAttrs(live, next) {
192
+ for (const a of [...live.attributes]) if (a.name !== 'data-fs-new' && !next.hasAttribute(a.name)) live.removeAttribute(a.name)
193
+ for (const a of [...next.attributes]) if (live.getAttribute(a.name) !== a.value) live.setAttribute(a.name, a.value)
194
+ }
195
+ const markNew = (n) => {
196
+ if (n.nodeType !== 1) return
197
+ n.setAttribute('data-fs-new', '')
198
+ n.addEventListener('animationend', () => n.removeAttribute('data-fs-new'), { once: true })
199
+ }
200
+ function morph(live, next) {
201
+ if (live.nodeType === 1 && next.nodeType === 1) syncAttrs(live, next)
202
+ const a = [...live.childNodes], b = [...next.childNodes]
203
+ for (let i = 0; i < Math.max(a.length, b.length); i++) {
204
+ const x = a[i], y = b[i]
205
+ if (!y) { x.remove(); continue }
206
+ if (!x) { const n = document.importNode(y, true); markNew(n); live.appendChild(n); continue }
207
+ if (x.nodeType === 3 && y.nodeType === 3) { if (x.nodeValue !== y.nodeValue) x.nodeValue = y.nodeValue; continue }
208
+ const sameTag = x.nodeType === 1 && y.nodeType === 1 && x.tagName === y.tagName
209
+ // 自定义元素渲染后 innerHTML 已是画好的 DOM,比的是它接入时记下的原始源码(_fsSrc),不然每一拍都会被换掉重画。
210
+ if (sameTag && x.tagName.includes('-')) {
211
+ if ((x._fsSrc ?? x.innerHTML) !== y.innerHTML) { const n = document.importNode(y, true); markNew(n); x.replaceWith(n) }
212
+ else syncAttrs(x, y)
213
+ continue
214
+ }
215
+ if (sameTag) { morph(x, y); continue }
216
+ const n = document.importNode(y, true); markNew(n); x.replaceWith(n)
217
+ }
218
+ }
219
+ // 会执行的 script type(HTML 标准的 JavaScript MIME 类型表 + module);其余(application/json、importmap …)是数据,原样留着
220
+ const JS_TYPES = /^(?:module|(?:text|application)\\/(?:x-)?(?:ecma|java)script|text\\/(?:javascript1\\.[0-5]|jscript|livescript))$/
221
+ function applyHtml(html, final) {
222
+ const t = document.createElement('template')
223
+ t.innerHTML = html
224
+ morph(document.body, t.content)
225
+ if (final) {
226
+ const pending = [] // module 脚本是异步执行的,等它们跑完再发就绪事件(Codex 10-09 P2)
227
+ for (const s of [...document.body.querySelectorAll('script')]) {
228
+ const type = (s.getAttribute('type') || '').trim().toLowerCase()
229
+ if (type && !JS_TYPES.test(type)) continue
230
+ const n = document.createElement('script')
231
+ for (const attr of [...s.attributes]) n.setAttribute(attr.name, attr.value)
232
+ n.textContent = s.textContent
233
+ if (type === 'module') pending.push(new Promise((r) => { n.addEventListener('load', r, { once: true }); n.addEventListener('error', r, { once: true }) }))
234
+ s.replaceWith(n)
235
+ }
236
+ const ready = () => { document.dispatchEvent(new Event('DOMContentLoaded')); window.dispatchEvent(new Event('load')); measure() }
237
+ if (pending.length) Promise.all(pending).then(ready)
238
+ else ready()
239
+ }
240
+ measure()
241
+ }
242
+
144
243
  window.addEventListener('message', (event) => {
145
244
  if (event.source !== parent) return
146
245
  const data = event.data
147
- if (!data || data.type !== 'sketch-theme' || !data.vars) return
246
+ if (!data) return
247
+ if (data.type === 'sketch-draft' || data.type === 'sketch-final') { applyHtml(String(data.html ?? ''), data.type === 'sketch-final'); return }
248
+ if (data.type !== 'sketch-theme' || !data.vars) return
148
249
  for (const [key, value] of Object.entries(data.vars)) {
149
250
  if (key.startsWith('--fs-')) document.documentElement.style.setProperty(key, String(value))
150
251
  else if (key === 'color-scheme') document.documentElement.style.colorScheme = String(value)
@@ -189,14 +290,16 @@ fs-chart + fs-flow, fs-flow + fs-chart, fs-chart + fs-chart { margin-top: 28px;
189
290
  })
190
291
 
191
292
  function ready() {
293
+ window.__fsLoadedAt = Date.now() // 台架用:整张卡只加载一次(草稿 → 终稿不重载)
192
294
  if (window.ResizeObserver) new ResizeObserver(measure).observe(document.body)
193
295
  measure()
194
296
  }
195
- if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', ready)
297
+ // once:终稿(sketch-final)会补发一次合成的 DOMContentLoaded 给模型脚本,运行时自己的就绪只跑一次
298
+ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', ready, { once: true })
196
299
  else ready()
197
300
  window.addEventListener('load', measure)
198
301
  })()
199
- `,J=`/* Small, offline figure primitives. Text and data are never interpreted as HTML. */
302
+ `,dt=`/* Small, offline figure primitives. Text and data are never interpreted as HTML. */
200
303
  (() => {
201
304
  const svgNS = 'http://www.w3.org/2000/svg'
202
305
  const number = (value) => new Intl.NumberFormat(undefined, {
@@ -225,11 +328,13 @@ fs-chart + fs-flow, fs-flow + fs-chart, fs-chart + fs-chart { margin-top: 28px;
225
328
  queueMicrotask(() => {
226
329
  if (!this.isConnected) return
227
330
  if (!this.figureData) {
331
+ this._fsSrc = this.innerHTML // 直播补丁(sketchRuntime morph)拿它和新来的源码比,渲染后 innerHTML 就不是源码了
228
332
  try { this.figureData = JSON.parse(this.querySelector('script[type="application/json"]')?.textContent || '{}') }
229
333
  catch { this.figureData = {} }
230
334
  }
231
335
  this.render()
232
336
  this.observer?.disconnect()
337
+ if (!window.ResizeObserver) return
233
338
  this.observer = new ResizeObserver(() => {
234
339
  const width = Math.round(this.clientWidth)
235
340
  if (width && width !== this.lastWidth) { this.lastWidth = width; this.render() }
@@ -426,12 +531,111 @@ fs-chart + fs-flow, fs-flow + fs-chart, fs-chart + fs-chart { margin-top: 28px;
426
531
  }
427
532
  }
428
533
 
534
+ // 10-09(对标 ChatGPT Intelligent UI「只能拼固定组件库」):统一的拼装部件,模型只给 JSON,外观由宿主定。
535
+ const askOf = (text) => { try { window.forsionSketch.ask(String(text)) } catch (e) { console.warn(e) } }
536
+ const button = (label, onClick) => { const b = node('button', 'fs-button', label); b.type = 'button'; b.addEventListener('click', onClick); return b }
537
+
538
+ /** <fs-compare>:并排选项 {title?, caption?, options:[{label, summary?, points?:string[], ask?:{label?, text}}]}(2–6 项)。 */
539
+ class Compare extends Figure {
540
+ render() {
541
+ const d = this.figureData
542
+ const ok = d && Array.isArray(d.options) && d.options.length >= 2 && d.options.length <= 6 &&
543
+ d.options.every((o) => o && typeof o.label === 'string' &&
544
+ (o.points === undefined || (Array.isArray(o.points) && o.points.length <= 8 && o.points.every((p) => typeof p === 'string'))) &&
545
+ (o.ask === undefined || (o.ask && typeof o.ask.text === 'string')))
546
+ if (!ok) { this.error(); return }
547
+ this.replaceChildren()
548
+ const root = node('div', 'fs-compare')
549
+ heading(root, d)
550
+ const grid = node('div', 'fs-grid')
551
+ for (const o of d.options) {
552
+ const card = node('section', 'fs-option')
553
+ card.append(node('h4', '', o.label))
554
+ if (typeof o.summary === 'string' && o.summary) card.append(node('p', 'fs-muted', o.summary))
555
+ if (Array.isArray(o.points) && o.points.length) { const ul = node('ul', 'fs-points'); for (const p of o.points) ul.append(node('li', '', p)); card.append(ul) }
556
+ if (o.ask) { const act = node('div', 'fs-actions'); act.append(button(o.ask.label || o.label, () => askOf(o.ask.text))); card.append(act) }
557
+ grid.append(card)
558
+ }
559
+ root.append(grid); caption(root, d); this.append(root)
560
+ }
561
+ }
562
+
563
+ /** <fs-choice>:追问选择题 {question, options:[{label, ask?}], multiple?, ask?("{choices}" 占位), submitLabel?, caption?}。
564
+ * 单选点了就把 ask(缺省 label)当用户消息发出;多选勾完按提交,把 ask 模板里的 {choices} 换成所选。 */
565
+ class Choice extends Figure {
566
+ render() {
567
+ const d = this.figureData
568
+ const ok = d && typeof d.question === 'string' && Array.isArray(d.options) && d.options.length >= 2 && d.options.length <= 8 &&
569
+ d.options.every((o) => o && typeof o.label === 'string' && (o.ask === undefined || typeof o.ask === 'string'))
570
+ if (!ok) { this.error(); return }
571
+ this.picked ||= new Set() // 宽度变化重绘时保住已勾的
572
+ for (const i of [...this.picked]) if (i >= d.options.length) this.picked.delete(i) // setData 换了更短的选项表:越界的勾作废(Codex 10-09)
573
+ this.replaceChildren()
574
+ const root = node('div', 'fs-choice')
575
+ root.setAttribute('role', 'group')
576
+ root.append(node('p', 'fs-choice-question', d.question))
577
+ const opts = node('div', 'fs-choice-options')
578
+ if (d.multiple) {
579
+ for (const [i, o] of d.options.entries()) {
580
+ const l = node('label', 'fs-check'); const c = node('input'); c.type = 'checkbox'; c.checked = this.picked.has(i)
581
+ c.addEventListener('change', () => { if (c.checked) this.picked.add(i); else this.picked.delete(i) })
582
+ l.append(c, node('span', '', o.label)); opts.append(l)
583
+ }
584
+ const act = node('div', 'fs-actions')
585
+ act.append(button(d.submitLabel || 'OK', () => {
586
+ const chosen = [...this.picked].sort((x, y) => x - y).map((i) => d.options[i]?.label).filter(Boolean)
587
+ if (chosen.length) askOf(String(d.ask || '{choices}').replace('{choices}', chosen.join(', ')))
588
+ }))
589
+ root.append(opts, act)
590
+ } else {
591
+ for (const o of d.options) opts.append(button(o.label, () => askOf(typeof o.ask === 'string' ? o.ask : o.label)))
592
+ root.append(opts)
593
+ }
594
+ caption(root, d); this.append(root)
595
+ }
596
+ }
597
+
598
+ /** <fs-checklist>:勾选清单 {title?, caption?, items:[{label, detail?}]}(1–40 项);勾选状态经 forsionSketch.setState 存在本机
599
+ * (键 checklists[<元素 id 或 'checklist'>]),重开这张卡还在。 */
600
+ class Checklist extends Figure {
601
+ render() {
602
+ const d = this.figureData
603
+ const ok = d && Array.isArray(d.items) && d.items.length >= 1 && d.items.length <= 40 &&
604
+ d.items.every((it) => it && typeof it.label === 'string' && (it.detail === undefined || typeof it.detail === 'string'))
605
+ if (!ok) { this.error(); return }
606
+ const key = this.id || 'checklist'
607
+ const st = window.forsionSketch?.state
608
+ const saved = st && typeof st === 'object' && st.checklists ? st.checklists[key] : undefined
609
+ const done = new Set(Array.isArray(saved) ? saved.filter((i) => Number.isInteger(i)) : [])
610
+ this.replaceChildren()
611
+ const root = node('div', 'fs-checklist')
612
+ heading(root, d)
613
+ const ul = node('ul', 'fs-checklist-items')
614
+ for (const [i, it] of d.items.entries()) {
615
+ const li = node('li'); const l = node('label', 'fs-check'); const c = node('input'); c.type = 'checkbox'; c.checked = done.has(i)
616
+ c.addEventListener('change', () => {
617
+ if (c.checked) done.add(i); else done.delete(i)
618
+ const cur = window.forsionSketch.state
619
+ const base = cur && typeof cur === 'object' && !Array.isArray(cur) ? cur : {}
620
+ try { window.forsionSketch.setState({ ...base, checklists: { ...(base.checklists || {}), [key]: [...done].sort((x, y) => x - y) } }) } catch (e) { console.warn(e) }
621
+ })
622
+ const text = node('span', '', it.label)
623
+ if (it.detail) text.append(node('small', 'fs-muted', ' ' + it.detail))
624
+ l.append(c, text); li.append(l); ul.append(li)
625
+ }
626
+ root.append(ul); caption(root, d); this.append(root)
627
+ }
628
+ }
629
+
429
630
  function register() {
430
631
  if (!customElements.get('fs-chart')) customElements.define('fs-chart', Chart)
431
632
  if (!customElements.get('fs-flow')) customElements.define('fs-flow', Flow)
633
+ if (!customElements.get('fs-compare')) customElements.define('fs-compare', Compare)
634
+ if (!customElements.get('fs-choice')) customElements.define('fs-choice', Choice)
635
+ if (!customElements.get('fs-checklist')) customElements.define('fs-checklist', Checklist)
432
636
  }
433
637
  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', register)
434
638
  else register()
435
639
  })()
436
- `,C=16384,L="forsion_sketch_state_v1",x=48;function v(t){try{const e=JSON.stringify(t);return e&&new TextEncoder().encode(e).length<=C?e:void 0}catch{return}}function P(t,e,n){let a=2166136261;for(let s=0;s<n.length;s++)a=Math.imul(a^n.charCodeAt(s),16777619);return JSON.stringify([t,e,n.length,a>>>0])}function T(t){const e=t.getItem(L);if(!e||e.length>C*(x+4))return[];let n;try{n=JSON.parse(e)}catch{return[]}return Array.isArray(n)?n.filter(a=>!!a&&typeof a.key=="string"&&a.key.length<2048&&v(a.state)!==void 0).slice(-x):[]}function W(t){try{return T(localStorage).find(e=>e.key===t)?.state??null}catch{return null}}function q(t,e){const n=v(e);if(!(!n||t.length>=2048))try{const a=T(localStorage).filter(s=>s.key!==t);a.push({key:t,state:JSON.parse(n)}),localStorage.setItem(L,JSON.stringify(a.slice(-x)))}catch{}}const B="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:; font-src data:",X="allow-scripts",U=40,G=2400,Y=220,Q={"--fs-bg":"transparent"},Z=[["--fs-surface","--overlay-subtle"],["--fs-text","--text"],["--fs-muted","--text-muted"],["--fs-faint","--text-faint"],["--fs-border","--border"],["--fs-rule","--overlay-medium"],["--fs-accent","--accent-ink"],["--fs-accent-soft","--accent-light"],["--fs-green","--green"],["--fs-danger","--danger"],["--fs-radius","--radius-sm"],["--fs-font","--font-ui"],["--fs-mono","--font-mono"]];function _(t){return String(t).replace(/[<>]/g,"").trim()}function E(t){const e=getComputedStyle(t),n={...Q};for(const[a,s]of Z){const c=_(e.getPropertyValue(s));c&&(n[a]=c)}return n["color-scheme"]=document.documentElement.getAttribute("data-mode")==="dark"?"dark":"light",n}const b=new Set;let p=null;function tt(t){return b.add(t),!p&&typeof MutationObserver<"u"&&(p=new MutationObserver(()=>{for(const e of b)e()}),p.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-skin","data-bg","data-mode","data-flat","data-glass","class"]})),()=>{b.delete(t),!b.size&&p&&(p.disconnect(),p=null)}}const et=":root{--fs-s1:var(--fs-accent);--fs-s2:color-mix(in srgb,var(--fs-text) 62%,transparent);--fs-s3:color-mix(in srgb,var(--fs-text) 42%,transparent);--fs-s4:color-mix(in srgb,var(--fs-text) 26%,transparent);--fs-s5:color-mix(in srgb,var(--fs-text) 14%,transparent)}";function nt(t){const e=Object.entries(t).map(([n,a])=>`${n.replace(/[^a-z-]/gi,"")}:${_(a)}`).join(";");return e?`:root{${e}}`:""}function at(t,e={},n=null){const a=(v(n)??"null").replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),s=V.replace("__SKETCH_INITIAL_STATE__",()=>a);return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${B}"><meta name="viewport" content="width=device-width, initial-scale=1"><style>${nt(e)}${et}${K}</style><script>${s};
437
- ${J}<\/script></head><body>${t}</body></html>`}function st(){try{const t=window.Capacitor;return!!(t&&typeof t.isNativePlatform=="function"&&t.isNativePlatform())}catch{return!1}}const rt=({item:t,actions:e,stateScope:n})=>{const{t:a}=z(),s=i.useMemo(()=>n?P(n,t.callId,t.html):null,[n,t.callId,t.html]),c=i.useMemo(()=>s?W(s):null,[s]),u=i.useRef(null),w=i.useRef(null),m=i.useRef(null),[y,$]=i.useState(Y),[h,j]=i.useState(!1),[k,H]=i.useState(!1),[g,I]=i.useState(null);i.useLayoutEffect(()=>{u.current&&I(E(u.current))},[]),i.useEffect(()=>tt(()=>{const r=u.current,l=m.current?.contentWindow;r&&l&&l.postMessage({type:"sketch-theme",vars:E(r)},"*")}),[]),i.useEffect(()=>{let r,l;const d=()=>{s&&r!==void 0&&q(s,JSON.parse(r)),r=void 0,l=void 0},S=M=>{if(!m.current||M.source!==m.current.contentWindow)return;const f=M.data;if(f?.type==="sketch-state"&&s){const A=v(f.state);A!==void 0&&(r=A,l||(l=setTimeout(d,200)))}f&&f.type==="sketch-height"&&Number.isFinite(Number(f.height))&&$(Math.min(G,Math.max(U,Math.ceil(Number(f.height)))))};return window.addEventListener("message",S),window.addEventListener("pagehide",d),()=>{window.removeEventListener("message",S),window.removeEventListener("pagehide",d),clearTimeout(l),d()}},[s]),i.useEffect(()=>{const r=w.current;if(!r||h)return;const l=()=>H(r.scrollHeight>r.clientHeight+1);l();const d=new ResizeObserver(l);return d.observe(r),()=>d.disconnect()},[y,h]);const R=i.useMemo(()=>g?at(t.html,g,c):"",[t.html,g,c]);return o.jsxs("div",{className:"sketch-card",ref:u,"data-sketch-call-id":t.callId,children:[(t.title||e)&&o.jsxs("div",{className:"sketch-card-head",children:[t.title&&o.jsx("div",{className:"sketch-card-title",children:t.title}),e?.(t)]}),o.jsx("div",{ref:w,className:`sketch-clip${h?" open":""}${k&&!h?" faded":""}`,children:g&&o.jsx("iframe",{ref:m,className:"sketch-frame",sandbox:X,srcDoc:R,style:{height:y},title:t.title||"sketch"})}),k&&o.jsx("button",{type:"button",className:"sketch-card-toggle",onClick:()=>j(r=>!r),children:a(h?"sketch.collapse":"sketch.expand")})]})},it=({item:t})=>{const{t:e}=z();return o.jsxs("div",{className:"sketch-card","data-sketch-call-id":t.callId,children:[t.title&&o.jsx("div",{className:"sketch-card-title",children:t.title}),o.jsx("div",{className:"sketch-card-note",children:e("sketch.mobileUnavailable")})]})},pt=({items:t,actions:e,stateScope:n})=>{const a=st(),s=a?it:rt;return o.jsx(o.Fragment,{children:t.map(c=>o.jsx(s,{item:c,actions:a?void 0:e,stateScope:n},`${n||""}:${c.callId}`))})};export{ct as F,dt as S,pt as a,D as b,ft as s};
640
+ `,U=16384,q="forsion_sketch_state_v1",M=48;function S(t){try{const e=JSON.stringify(t);return e&&new TextEncoder().encode(e).length<=U?e:void 0}catch{return}}function ft(t,e,n){let s=2166136261;for(let i=0;i<n.length;i++)s=Math.imul(s^n.charCodeAt(i),16777619);return JSON.stringify([t,e,n.length,s>>>0])}function W(t){const e=t.getItem(q);if(!e||e.length>U*(M+4))return[];let n;try{n=JSON.parse(e)}catch{return[]}return Array.isArray(n)?n.filter(s=>!!s&&typeof s.key=="string"&&s.key.length<2048&&S(s.state)!==void 0).slice(-M):[]}function pt(t){try{return W(localStorage).find(e=>e.key===t)?.state??null}catch{return null}}function ut(t,e){const n=S(e);if(!(!n||t.length>=2048))try{const s=W(localStorage).filter(i=>i.key!==t);s.push({key:t,state:JSON.parse(n)}),localStorage.setItem(q,JSON.stringify(s.slice(-M)))}catch{}}const ht="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:; font-src data:",mt="allow-scripts",P=40,gt=2400,bt=220,vt={"--fs-bg":"transparent"},xt=[["--fs-surface","--overlay-subtle"],["--fs-text","--text"],["--fs-muted","--text-muted"],["--fs-faint","--text-faint"],["--fs-border","--border"],["--fs-rule","--overlay-medium"],["--fs-accent","--accent-ink"],["--fs-accent-soft","--accent-light"],["--fs-green","--green"],["--fs-danger","--danger"],["--fs-radius","--radius-sm"],["--fs-font","--font-ui"],["--fs-mono","--font-mono"]];function B(t){return String(t).replace(/[<>]/g,"").trim()}function K(t){const e=getComputedStyle(t),n={...vt};for(const[s,i]of xt){const c=B(e.getPropertyValue(i));c&&(n[s]=c)}return n["color-scheme"]=document.documentElement.getAttribute("data-mode")==="dark"?"dark":"light",n}const w=new Set;let g=null;function yt(t){return w.add(t),!g&&typeof MutationObserver<"u"&&(g=new MutationObserver(()=>{for(const e of w)e()}),g.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-skin","data-bg","data-mode","data-flat","data-glass","class"]})),()=>{w.delete(t),!w.size&&g&&(g.disconnect(),g=null)}}const kt=":root{--fs-s1:var(--fs-accent);--fs-s2:color-mix(in srgb,var(--fs-text) 62%,transparent);--fs-s3:color-mix(in srgb,var(--fs-text) 42%,transparent);--fs-s4:color-mix(in srgb,var(--fs-text) 26%,transparent);--fs-s5:color-mix(in srgb,var(--fs-text) 14%,transparent)}";function wt(t){const e=Object.entries(t).map(([n,s])=>`${n.replace(/[^a-z-]/gi,"")}:${B(s)}`).join(";");return e?`:root{${e}}`:""}function St(t,e={},n=null,s=""){const i=(S(n)??"null").replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),c=lt.replace("__SKETCH_INITIAL_STATE__",()=>i).replace("__SKETCH_NONCE__",()=>s.replace(/[^A-Za-z0-9-]/g,""));return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${ht}"><meta name="viewport" content="width=device-width, initial-scale=1"><style>${wt(e)}${kt}${ct}</style><script>${c};
641
+ ${dt}<\/script></head><body>${t}</body></html>`}const X=`(?![^>]*\\stype\\s*=\\s*["']?application/json\\b)`,At=new RegExp(`<script\\b${X}[^>]*>[\\s\\S]*?<\/script\\s*>`,"gi"),Et=new RegExp(`<script\\b${X}[^>]*>[\\s\\S]*$`,"i"),Mt=/<script\b[^>]*$/i,Tt=/<[a-zA-Z][^>]*(?:>|$)/g,Nt=/\son[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,Ct=/<(fs-[a-z]+)\b(?![\s\S]*<\/\1\s*>)[\s\S]*$/i;function V(t){return t.replace(At,"").replace(Et,"").replace(Mt,"").replace(Ct,"").replace(Tt,e=>e.replace(Nt,""))}const _t=400,Lt=1500,Rt=2e4,zt=150;function Ot(){try{const t=window.Capacitor;return!!(t&&typeof t.isNativePlatform=="function"&&t.isNativePlatform())}catch{return!1}}function Ht(t){return!t||document.activeElement!==t?!1:navigator.userActivation?.isActive===!0}const It=()=>crypto.randomUUID?crypto.randomUUID():Array.from(crypto.getRandomValues(new Uint8Array(16)),t=>t.toString(16).padStart(2,"0")).join(""),$t=({item:t,actions:e,stateScope:n,onAsk:s})=>{const{t:i}=J(),c=a.useMemo(()=>n&&!t.draft?ft(n,t.callId,t.html):null,[n,t.callId,t.html,t.draft]),u=a.useRef(s);u.current=s;const x=a.useRef(!!t.draft);x.current=!!t.draft;const T=a.useRef(0),Y=a.useRef(t.draft?V(t.html):t.html),Z=a.useRef(c?pt(c):null),N=a.useRef(It()),y=a.useRef(null),C=a.useRef(null),h=a.useRef(null),[_,Q]=a.useState(t.draft?P:bt),[b,tt]=a.useState(!1),[L,et]=a.useState(!1),[k,nt]=a.useState(null);a.useLayoutEffect(()=>{y.current&&nt(K(y.current))},[]),a.useEffect(()=>yt(()=>{const r=y.current,d=h.current?.contentWindow;r&&d&&d.postMessage({type:"sketch-theme",vars:K(r)},"*")}),[]);const A=a.useRef(!1),E=a.useRef(!1),v=a.useRef(null),m=a.useRef(void 0),R=r=>{h.current?.contentWindow?.postMessage(r,"*")},z=()=>{if(m.current=void 0,!A.current)return;const r=v.current;v.current=null,r!==null&&x.current&&!E.current&&R({type:"sketch-draft",html:r})},O=()=>{!A.current||E.current||(E.current=!0,clearTimeout(m.current),m.current=void 0,v.current=null,R({type:"sketch-final",html:t.html}))},H=a.useRef(!!t.draft);a.useEffect(()=>{t.draft?(v.current=V(t.html),m.current||(m.current=setTimeout(z,zt))):H.current&&O()},[t.html,t.draft]),a.useEffect(()=>()=>clearTimeout(m.current),[]);const at=()=>{A.current=!0,!x.current&&H.current?O():v.current!==null&&z()};a.useEffect(()=>{let r,d;const p=()=>{c&&r!==void 0&&ut(c,JSON.parse(r)),r=void 0,d=void 0},$=j=>{if(!h.current||j.source!==h.current.contentWindow)return;const o=j.data;if(o?.type==="sketch-state"&&c){const f=S(o.state);f!==void 0&&(r=f,d||(d=setTimeout(p,200)))}o&&o.type==="sketch-height"&&Number.isFinite(Number(o.height))&&Q(Math.min(gt,Math.max(P,Math.ceil(Number(o.height)))));const D=o&&o.nonce===N.current&&!x.current&&Ht(h.current);if(D&&o.type==="sketch-ask"&&typeof o.text=="string"&&u.current){const f=Date.now(),F=o.text.trim().slice(0,_t);F&&f-T.current>=Lt&&(T.current=f,u.current(F))}if(D&&o.type==="sketch-copy"&&typeof o.text=="string"){const f=o.text.slice(0,Rt);f&&navigator.clipboard?.writeText(f).catch(()=>{})}};return window.addEventListener("message",$),window.addEventListener("pagehide",p),()=>{window.removeEventListener("message",$),window.removeEventListener("pagehide",p),clearTimeout(d),p()}},[c]),a.useEffect(()=>{const r=C.current;if(!r||b)return;const d=()=>et(r.scrollHeight>r.clientHeight+1);d();const p=new ResizeObserver(d);return p.observe(r),()=>p.disconnect()},[_,b]);const st=a.useMemo(()=>k?St(Y.current,k,Z.current,N.current):"",[k]),I=t.draft?void 0:e;return l.jsxs("div",{className:"sketch-card",ref:y,"data-sketch-call-id":t.callId,"data-sketch-draft":t.draft?"":void 0,children:[(t.title||I)&&l.jsxs("div",{className:"sketch-card-head",children:[t.title&&l.jsx("div",{className:"sketch-card-title",children:t.title}),I?.(t)]}),l.jsx("div",{ref:C,className:`sketch-clip${b?" open":""}${L&&!b?" faded":""}`,children:k&&l.jsx("iframe",{ref:h,className:"sketch-frame",sandbox:mt,srcDoc:st,style:{height:_},title:t.title||"sketch",onLoad:at})}),L&&l.jsx("button",{type:"button",className:"sketch-card-toggle",onClick:()=>tt(r=>!r),children:i(b?"sketch.collapse":"sketch.expand")})]})},jt=({item:t})=>{const{t:e}=J();return l.jsxs("div",{className:"sketch-card","data-sketch-call-id":t.callId,children:[t.title&&l.jsx("div",{className:"sketch-card-title",children:t.title}),l.jsx("div",{className:"sketch-card-note",children:e("sketch.mobileUnavailable")})]})},Gt=({items:t,actions:e,stateScope:n,onAsk:s})=>{const i=Ot(),c=i?jt:$t;return l.jsx(l.Fragment,{children:t.map(u=>l.jsx(c,{item:u,actions:i?void 0:e,stateScope:n,onAsk:i?void 0:s},`${n||""}:${u.callId}`))})};export{Pt as F,Kt as S,Gt as a,ot as b,Vt as s};
@@ -1 +1 @@
1
- import{d as v}from"./index-BM2o7PeV.js";import{ed as J,bp as ne,ag as re}from"./appStore-DWP8UET9.js";const K=/^(auto|scroll|hidden|clip)$/,M=(l,p=1)=>Number.isFinite(l)&&l>0?l:p,m=l=>`${Math.round(l*1e3)/1e3}px`;function ae({anchorRef:l,enabled:p=!0,onActivate:Y,children:Q}){const[t]=v.useState(()=>{const d=document.createElement("div");return d.className="csu-guest-surface",d.setAttribute("aria-hidden","true"),d.inert=!0,Object.assign(d.style,{position:"absolute",display:"flex",flexDirection:"column",minWidth:"0",minHeight:"0",overflow:"hidden",boxSizing:"border-box",visibility:"hidden",pointerEvents:"none",zIndex:"1"}),d}),E=v.useRef(p);E.current=p;const q=v.useRef(Y);q.current=Y;const $=v.useRef(0),I=v.useRef(null);return v.useLayoutEffect(()=>{$.current++;let d=!1,b=0,r=t.parentElement,x=null,N=!1,R=!1;const n=t.ownerDocument,a=n.defaultView,o=(i,e)=>{t.style[i]!==e&&(t.style[i]=e)},f=()=>{o("visibility","hidden"),o("pointerEvents","none"),t.inert||(t.inert=!0),t.getAttribute("aria-hidden")!=="true"&&t.setAttribute("aria-hidden","true")},D=()=>{const i=t.style.visibility==="visible"&&E.current&&!N&&!n.documentElement.hasAttribute("data-dv-dragging");o("pointerEvents",i?"auto":"none"),t.inert===i&&(t.inert=!i);const e=i?"false":"true";t.getAttribute("aria-hidden")!==e&&t.setAttribute("aria-hidden",e)},y=()=>{d||!E.current||n.hidden||t.inert||t.style.visibility!=="visible"||!l.current?.isConnected||l.current.closest('[hidden], [inert], [aria-hidden="true"]')||n.documentElement.hasAttribute("data-dv-dragging")||(R=t.contains(n.activeElement),q.current?.())},G=()=>{t.contains(n.activeElement)||(R=!1)},ee=()=>{const i=l.current;if(!i?.isConnected||(r||(r=i.closest(".shell-work")??i.closest(".shell-host")??n.body,(r===n.body||a.getComputedStyle(r).position==="static")&&o("position","fixed"),r.appendChild(t),A?.observe(r)),x!==i&&(x&&A?.unobserve(x),A?.observe(i),x=i),!E.current||n.hidden||!r.isConnected))return f(),!1;const e=i.getBoundingClientRect();if(e.width<=0||e.height<=0)return f(),!1;let g=Math.max(0,e.left),C=Math.max(0,e.top),z=Math.min(a.innerWidth,e.right),O=Math.min(a.innerHeight,e.bottom),W=1,k="";N=!1;for(let s=i;s;s=s.parentElement){const u=a.getComputedStyle(s);if(s.hidden||u.display==="none"||u.visibility==="hidden"||u.visibility==="collapse")return f(),!1;(s.inert||s.getAttribute("aria-hidden")==="true")&&(N=!0),s!==r&&!s.contains(r)&&(W*=Number.parseFloat(u.opacity||"1"));const V=/\b(paint|strict|content)\b/.test(u.contain),B=V||K.test(u.overflowX||u.overflow),X=V||K.test(u.overflowY||u.overflow);if(!B&&!X)continue;const h=s.getBoundingClientRect(),Z=M(h.width/s.offsetWidth),_=M(h.height/s.offsetHeight),j=h.left+s.clientLeft*Z,U=h.top+s.clientTop*_,te=j+s.clientWidth*Z,ie=U+s.clientHeight*_;B&&(g=Math.max(g,j),z=Math.min(z,te)),X&&(C=Math.max(C,U),O=Math.min(O,ie)),!k&&B&&X&&Math.abs(h.left-e.left)<1&&Math.abs(h.top-e.top)<1&&Math.abs(h.right-e.right)<1&&Math.abs(h.bottom-e.bottom)<1&&(k=u.borderRadius)}if(z<=g||O<=C)return f(),!1;if(W<=0)return f(),!0;const S=r.getBoundingClientRect(),F=M(re(t)),H=t.style.position==="absolute",L=H?M(S.width/r.offsetWidth,F):F,w=H?M(S.height/r.offsetHeight,F):F;return o("left",m(H?(e.left-S.left)/L-r.clientLeft+r.scrollLeft:e.left/L)),o("top",m(H?(e.top-S.top)/w-r.clientTop+r.scrollTop:e.top/w)),o("width",m(e.width/L)),o("height",m(e.height/w)),o("clipPath",`inset(${m((C-e.top)/w)} ${m((e.right-z)/L)} ${m((e.bottom-O)/w)} ${m((g-e.left)/L)})`),o("borderRadius",k),o("opacity",String(W)),o("visibility","visible"),D(),!0},T=()=>{if(b=0,d)return;const i=ee(),e=t.contains(n.activeElement),g=e&&!R;R=e,g&&y(),i&&(b=a.requestAnimationFrame(T))},c=()=>{!d&&!b&&(b=a.requestAnimationFrame(T))},A=typeof ResizeObserver>"u"?null:new ResizeObserver(c),P=new MutationObserver(i=>{i.some(e=>e.target===n.documentElement&&e.attributeName==="data-dv-dragging")&&D(),i.some(e=>!t.contains(e.target))&&c()});return P.observe(n.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class","hidden","inert","aria-hidden","data-dv-dragging"]}),a.addEventListener("resize",c),n.addEventListener("scroll",c,!0),n.addEventListener("visibilitychange",c),a.addEventListener(J,c),t.addEventListener("focus",y,!0),t.addEventListener("pointerdown",y,!0),n.addEventListener("focus",G,!0),I.current=()=>{E.current||f(),c()},T(),()=>{d=!0,b&&a.cancelAnimationFrame(b),A?.disconnect(),P.disconnect(),a.removeEventListener("resize",c),n.removeEventListener("scroll",c,!0),n.removeEventListener("visibilitychange",c),a.removeEventListener(J,c),t.removeEventListener("focus",y,!0),t.removeEventListener("pointerdown",y,!0),n.removeEventListener("focus",G,!0),I.current=null,f();const i=++$.current;queueMicrotask(()=>{$.current===i&&t.remove()})}},[l,t]),v.useLayoutEffect(()=>{I.current?.()},[p]),ne.createPortal(Q,t)}export{ae as S};
1
+ import{d as v}from"./index-BYUntVIZ.js";import{ej as J,bq as ne,ah as re}from"./appStore-affnJoin.js";const K=/^(auto|scroll|hidden|clip)$/,M=(l,p=1)=>Number.isFinite(l)&&l>0?l:p,m=l=>`${Math.round(l*1e3)/1e3}px`;function ae({anchorRef:l,enabled:p=!0,onActivate:X,children:Q}){const[t]=v.useState(()=>{const d=document.createElement("div");return d.className="csu-guest-surface",d.setAttribute("aria-hidden","true"),d.inert=!0,Object.assign(d.style,{position:"absolute",display:"flex",flexDirection:"column",minWidth:"0",minHeight:"0",overflow:"hidden",boxSizing:"border-box",visibility:"hidden",pointerEvents:"none",zIndex:"1"}),d}),E=v.useRef(p);E.current=p;const Y=v.useRef(X);Y.current=X;const $=v.useRef(0),I=v.useRef(null);return v.useLayoutEffect(()=>{$.current++;let d=!1,b=0,r=t.parentElement,x=null,N=!1,R=!1;const n=t.ownerDocument,a=n.defaultView,o=(i,e)=>{t.style[i]!==e&&(t.style[i]=e)},f=()=>{o("visibility","hidden"),o("pointerEvents","none"),t.inert||(t.inert=!0),t.getAttribute("aria-hidden")!=="true"&&t.setAttribute("aria-hidden","true")},D=()=>{const i=t.style.visibility==="visible"&&E.current&&!N&&!n.documentElement.hasAttribute("data-dv-dragging");o("pointerEvents",i?"auto":"none"),t.inert===i&&(t.inert=!i);const e=i?"false":"true";t.getAttribute("aria-hidden")!==e&&t.setAttribute("aria-hidden",e)},y=()=>{d||!E.current||n.hidden||t.inert||t.style.visibility!=="visible"||!l.current?.isConnected||l.current.closest('[hidden], [inert], [aria-hidden="true"]')||n.documentElement.hasAttribute("data-dv-dragging")||(R=t.contains(n.activeElement),Y.current?.())},j=()=>{t.contains(n.activeElement)||(R=!1)},ee=()=>{const i=l.current;if(!i?.isConnected||(r||(r=i.closest(".shell-work")??i.closest(".shell-host")??n.body,(r===n.body||a.getComputedStyle(r).position==="static")&&o("position","fixed"),r.appendChild(t),A?.observe(r)),x!==i&&(x&&A?.unobserve(x),A?.observe(i),x=i),!E.current||n.hidden||!r.isConnected))return f(),!1;const e=i.getBoundingClientRect();if(e.width<=0||e.height<=0)return f(),!1;let g=Math.max(0,e.left),C=Math.max(0,e.top),z=Math.min(a.innerWidth,e.right),O=Math.min(a.innerHeight,e.bottom),W=1,k="";N=!1;for(let s=i;s;s=s.parentElement){const u=a.getComputedStyle(s);if(s.hidden||u.display==="none"||u.visibility==="hidden"||u.visibility==="collapse")return f(),!1;(s.inert||s.getAttribute("aria-hidden")==="true")&&(N=!0),s!==r&&!s.contains(r)&&(W*=Number.parseFloat(u.opacity||"1"));const P=/\b(paint|strict|content)\b/.test(u.contain),q=P||K.test(u.overflowX||u.overflow),B=P||K.test(u.overflowY||u.overflow);if(!q&&!B)continue;const h=s.getBoundingClientRect(),V=M(h.width/s.offsetWidth),Z=M(h.height/s.offsetHeight),_=h.left+s.clientLeft*V,U=h.top+s.clientTop*Z,te=_+s.clientWidth*V,ie=U+s.clientHeight*Z;q&&(g=Math.max(g,_),z=Math.min(z,te)),B&&(C=Math.max(C,U),O=Math.min(O,ie)),!k&&q&&B&&Math.abs(h.left-e.left)<1&&Math.abs(h.top-e.top)<1&&Math.abs(h.right-e.right)<1&&Math.abs(h.bottom-e.bottom)<1&&(k=u.borderRadius)}if(z<=g||O<=C)return f(),!1;if(W<=0)return f(),!0;const S=r.getBoundingClientRect(),F=M(re(t)),H=t.style.position==="absolute",L=H?M(S.width/r.offsetWidth,F):F,w=H?M(S.height/r.offsetHeight,F):F;return o("left",m(H?(e.left-S.left)/L-r.clientLeft+r.scrollLeft:e.left/L)),o("top",m(H?(e.top-S.top)/w-r.clientTop+r.scrollTop:e.top/w)),o("width",m(e.width/L)),o("height",m(e.height/w)),o("clipPath",`inset(${m((C-e.top)/w)} ${m((e.right-z)/L)} ${m((e.bottom-O)/w)} ${m((g-e.left)/L)})`),o("borderRadius",k),o("opacity",String(W)),o("visibility","visible"),D(),!0},T=()=>{if(b=0,d)return;const i=ee(),e=t.contains(n.activeElement),g=e&&!R;R=e,g&&y(),i&&(b=a.requestAnimationFrame(T))},c=()=>{!d&&!b&&(b=a.requestAnimationFrame(T))},A=typeof ResizeObserver>"u"?null:new ResizeObserver(c),G=new MutationObserver(i=>{i.some(e=>e.target===n.documentElement&&e.attributeName==="data-dv-dragging")&&D(),i.some(e=>!t.contains(e.target))&&c()});return G.observe(n.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class","hidden","inert","aria-hidden","data-dv-dragging"]}),a.addEventListener("resize",c),n.addEventListener("scroll",c,!0),n.addEventListener("visibilitychange",c),a.addEventListener(J,c),t.addEventListener("focus",y,!0),t.addEventListener("pointerdown",y,!0),n.addEventListener("focus",j,!0),I.current=()=>{E.current||f(),c()},T(),()=>{d=!0,b&&a.cancelAnimationFrame(b),A?.disconnect(),G.disconnect(),a.removeEventListener("resize",c),n.removeEventListener("scroll",c,!0),n.removeEventListener("visibilitychange",c),a.removeEventListener(J,c),t.removeEventListener("focus",y,!0),t.removeEventListener("pointerdown",y,!0),n.removeEventListener("focus",j,!0),I.current=null,f();const i=++$.current;queueMicrotask(()=>{$.current===i&&t.remove()})}},[l,t]),v.useLayoutEffect(()=>{I.current?.()},[p]),ne.createPortal(Q,t)}export{ae as S};
@@ -0,0 +1 @@
1
+ import{u as B,d as c,j as o,r as O}from"./index-BYUntVIZ.js";import{A as P}from"./astryxBridge-CT2wZJXs.js";import{jj as R,jR as U,jS as _,ju as F,jT as K,jU as z,dm as V,jV as Y,jW as W,ar as J,c6 as Q,jX as X,jQ as Z,jY as q,aE as G,jJ as ee,jD as te,jZ as oe,ah as se}from"./appStore-affnJoin.js";import{E as ne}from"./EventCard-DUrn2krw.js";import"./client-BqhpYbYL.js";import{C as E}from"./CheckboxInput-BuJ3HPm_.js";import"./nativeDownload-Udrv_tmU.js";import"./ipc-D7yENkjV.js";import"./Tooltip-DtDUL18W.js";O({"todolist.title":{zh:"待办",en:"To-dos"},"todolist.untitled":{zh:"未命名",en:"Untitled"},"todolist.done":{zh:"已完成",en:"Completed"},"todolist.openInNote":{zh:"在笔记中打开",en:"Open in note"},"todolist.clickToEdit":{zh:"点击编辑",en:"Click to edit"},"todolist.addPlaceholder":{zh:"新建待办",en:"New to-do"},"todolist.allDone":{zh:"全部完成了。",en:"All done."},"todolist.emptyTitle":{zh:"还没有待办。",en:"No to-dos yet."},"todolist.emptyHintA":{zh:"在笔记里写 ",en:"Write "},"todolist.emptyExample":{zh:"- [ ] 事项 @2026-09-01",en:"- [ ] Task @2026-09-01"},"todolist.emptyHintB":{zh:"(打 ",en:" in a note (type "},"todolist.emptyHintC":{zh:" 有候选),或在下面直接加一条。",en:" for suggestions), or add one below."},"todolist.emptyHintCNoAdd":{zh:" 有候选)。",en:" for suggestions)."}});const M="done";function ae(h){const l=i=>typeof i=="string"?i:typeof i=="number"?String(i):"",a=l(h?.src);return{db:l(h?.db)||void 0,src:a==="db"||a==="md"?a:"all"}}function xe({params:h}={}){const l=ae(h),{t:a}=B(),i=R(),C=U(),[T,I]=c.useState(new Set([..._,M])),[m,N]=c.useState(null),[k,j]=c.useState(""),x=c.useMemo(()=>F(new Date),[]),u=c.useMemo(()=>i.filter(e=>e.checkboxCol&&(!l.db||e.db.path===l.db)),[i,l.db]),r=c.useMemo(()=>{const e=[];if(l.src!=="md")for(const t of u){const s=t.checkboxCol;for(const n of t.db.rows){const d=typeof n.cells[t.dateCol]=="string"?n.cells[t.dateCol]:"";e.push({key:`db:${t.db.path}:${n.rowId}`,name:n.name||a("todolist.untitled"),checked:n.cells[s]===!0,raw:d,source:t.db.name,db:t,rowId:n.rowId})}}if(l.src!=="db"&&!l.db)for(const t of C.filter(s=>s.isTask))e.push({key:`md:${t.path}:${t.line}`,name:t.text,checked:t.checked,raw:t.due,source:t.heading?`${t.title} › ${t.heading}`:t.title,note:{path:t.path,heading:t.heading},mark:t});return e},[u,C,l.src,l.db,a]),f=c.useMemo(()=>r.filter(e=>e.checked),[r]),D=c.useMemo(()=>{const e=new Map;for(const t of r){if(t.checked)continue;const s=K(t.raw,x),n=e.get(s);n?n.push(t):e.set(s,[t])}for(const t of e.values())t.sort((s,n)=>{const d=z(s.raw),v=z(n.raw);return(d===v?0:d<v?-1:1)||s.source.localeCompare(n.source,"zh")||s.name.localeCompare(n.name,"zh")});return e},[r,x]),b=r.length-f.length,A=e=>I(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s}),w=c.useMemo(()=>{if(!m)return null;const e=u.find(n=>n.db.path===m.dbPath),t=e?.db.rows.find(n=>n.rowId===m.rowId);if(!e||!t)return null;const s=typeof t.cells[e.dateCol]=="string"?t.cells[e.dateCol]:"";return{db:e.db,row:t,colId:e.dateCol,title:t.name,raw:s}},[m,u]),p=c.useMemo(()=>u.find(e=>!e.db.readonly&&!e.db.isNoteView),[u]),H=()=>{const e=k.trim();!e||!p||(ee(p.db,p.dateCol,te(x,!0),e),j(""))},S=(e,t)=>{if(e.note){oe(e.note.path,e.note.heading);return}if(!e.db||!e.rowId)return;const s=t.currentTarget.getBoundingClientRect();N({dbPath:e.db.db.path,rowId:e.rowId,at:{left:s.left,top:s.top,right:s.right,bottom:s.bottom,zoom:se(t.currentTarget)||1}})},$=!!V?.patchMark,g=e=>{const t=X(e.raw,x);return o.jsxs("li",{className:"amx-todo-item",children:[e.db&&e.rowId?o.jsx(E,{label:e.name,isLabelHidden:!0,size:"sm",value:e.checked,onChange:s=>Z(e.db.db,e.rowId,e.db.checkboxCol,s?!0:void 0)}):e.mark&&$?o.jsx(E,{label:e.name,isLabelHidden:!0,size:"sm",value:e.checked,onChange:s=>q(e.mark,{checked:s})}):o.jsx("span",{className:`amx-todo-box${e.checked?" on":""}`,"aria-hidden":"true"}),o.jsxs("button",{className:"amx-todo-main",title:e.note?a("todolist.openInNote"):a("todolist.clickToEdit"),onClick:s=>S(e,s),children:[o.jsx("span",{className:`amx-todo-name${e.checked?" done":""}`,children:e.name}),e.raw?o.jsx("span",{className:`amx-todo-due ${t.tone}`,children:t.label}):null,e.note?o.jsx(G,{className:"amx-todo-jump",size:12}):null]})]},e.key)},L=(e,t)=>{if(e!=="undated")return o.jsx("ul",{className:"amx-todo-list",children:t.map(g)});const s=[];for(const n of t){const d=s[s.length-1];d&&d.source===n.source?d.items.push(n):s.push({source:n.source,items:[n]})}return o.jsx(o.Fragment,{children:s.map(n=>o.jsxs("div",{children:[o.jsxs("div",{className:"amx-todo-src",children:[n.source,o.jsx("span",{className:"amx-todo-srcn",children:n.items.length})]}),o.jsx("ul",{className:"amx-todo-list",children:n.items.map(g)})]},n.source))})},y=(e,t,s,n)=>{const d=!T.has(e);return o.jsxs("section",{className:"amx-todo-group",children:[o.jsxs("button",{className:`amx-todo-ghead${d?" is-open":""}`,onClick:()=>A(e),"aria-expanded":d,children:[o.jsx(Q,{className:"amx-todo-caret",size:12}),o.jsx("span",{className:"amx-todo-gname",children:t}),o.jsx("span",{className:"amx-todo-gcount",children:s.length})]}),o.jsx("div",{className:`amx-todo-reveal${d?" is-open":""}`,children:o.jsx("div",{className:"amx-todo-reveal-in",children:n})})]},e)};return o.jsx(P,{children:o.jsxs("div",{className:"amx-todo",children:[o.jsxs("div",{className:"amx-todo-bar",children:[o.jsx("span",{className:"amx-todo-title",children:a("todolist.title")}),b>0&&o.jsx("span",{className:"amx-todo-total",children:b})]}),r.length===0&&o.jsxs("div",{className:"amx-todo-empty",children:[a("todolist.emptyTitle"),!h?.miniSurface&&o.jsxs(o.Fragment,{children:[o.jsx("br",{}),a("todolist.emptyHintA"),o.jsx("code",{children:a("todolist.emptyExample")}),a("todolist.emptyHintB"),o.jsx("code",{children:"@"}),a(p?"todolist.emptyHintC":"todolist.emptyHintCNoAdd")]})]}),r.length>0&&b===0&&o.jsx("div",{className:"amx-todo-empty",children:a("todolist.allDone")}),Y.map(e=>{const t=D.get(e);return t&&t.length?y(e,W[e],t,L(e,t)):null}),f.length>0&&y(M,a("todolist.done"),f,o.jsx("ul",{className:"amx-todo-list",children:f.map(g)})),p&&o.jsxs("div",{className:"amx-todo-add",children:[o.jsx(J,{className:"amx-todo-addicon",size:13}),o.jsx("input",{className:"amx-todo-addinput",placeholder:a("todolist.addPlaceholder"),value:k,onChange:e=>j(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key==="Enter"&&(e.preventDefault(),H()),e.key==="Escape"&&j(""))}})]}),w&&m&&o.jsx(ne,{ev:w,at:m.at,onClose:()=>N(null)})]})})}export{xe as TodoListView,ae as readTodoParams};
@@ -1 +1 @@
1
- import{d as l,j as o}from"./index-BM2o7PeV.js";import{u as E,c as f}from"./astryxBridge-D-m4_kYt.js";import"./appStore-DWP8UET9.js";import"./nativeDownload-BYT082bY.js";import"./ipc-CxAyeo8q.js";import"./client-0MPbodA6.js";function N(r){return typeof r=="string"||typeof r=="number"}function p(...r){const i=r.filter(Boolean);return i.length>0?i.join(" "):void 0}function F({children:r,anchorRef:i,content:n,placement:y="above",alignment:m="center",delay:x=200,hideDelay:j=0,focusTrigger:g="auto",isEnabled:A=!0,onOpenChange:d,hasHoverIndication:b="auto",isOpen:B,isDefaultOpen:T}){const c=l.useRef(null),u=r!=null?N(r):!1,v=b===!0||b==="auto"&&u,w=l.useCallback(()=>{d?.(!0)},[d]),k=l.useCallback(()=>{d?.(!1)},[d]),e=E({placement:y,alignment:m,delay:x,hideDelay:j,focusTrigger:g,isEnabled:A,isOpen:B,isDefaultOpen:T,onShow:w,onHide:k});return f(()=>{if(!i)return;const s=i.current;if(!s)return;e.ref(s);const t=s.getAttribute("aria-describedby");return s.setAttribute("aria-describedby",p(t,e.describedBy)??""),()=>{e.ref(null),t?s.setAttribute("aria-describedby",t):s.removeAttribute("aria-describedby")}},[i,e.ref,e.describedBy]),f(()=>{if(i||u)return;const s=c.current;if(!s)return;const t=s.firstElementChild;if(!t)return;e.ref(t);const a=t.getAttribute("aria-describedby");return t.setAttribute("aria-describedby",p(a,e.describedBy)??""),()=>{e.ref(null),a?t.setAttribute("aria-describedby",a):t.removeAttribute("aria-describedby")}},[i,u,e.ref,e.describedBy]),i&&r==null?o.jsx(o.Fragment,{children:e.renderTooltip(n)}):u?o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:e.ref,tabIndex:0,"aria-describedby":e.describedBy,...{0:{className:"xt0psk2"},1:{className:"xt0psk2 xujl8zx xev0dqp xycaml9 xrys4gj"}}[!!v<<0],children:r}),e.renderTooltip(n)]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:c,className:"xjp7ctv",children:r}),e.renderTooltip(n)]})}F.displayName="Tooltip";export{F as Tooltip};
1
+ import{d as l,j as o}from"./index-BYUntVIZ.js";import{u as E,c as f}from"./astryxBridge-CT2wZJXs.js";import"./appStore-affnJoin.js";import"./nativeDownload-Udrv_tmU.js";import"./ipc-D7yENkjV.js";import"./client-BqhpYbYL.js";function N(r){return typeof r=="string"||typeof r=="number"}function p(...r){const i=r.filter(Boolean);return i.length>0?i.join(" "):void 0}function F({children:r,anchorRef:i,content:n,placement:y="above",alignment:m="center",delay:x=200,hideDelay:j=0,focusTrigger:g="auto",isEnabled:A=!0,onOpenChange:d,hasHoverIndication:b="auto",isOpen:B,isDefaultOpen:T}){const c=l.useRef(null),u=r!=null?N(r):!1,v=b===!0||b==="auto"&&u,w=l.useCallback(()=>{d?.(!0)},[d]),k=l.useCallback(()=>{d?.(!1)},[d]),e=E({placement:y,alignment:m,delay:x,hideDelay:j,focusTrigger:g,isEnabled:A,isOpen:B,isDefaultOpen:T,onShow:w,onHide:k});return f(()=>{if(!i)return;const s=i.current;if(!s)return;e.ref(s);const t=s.getAttribute("aria-describedby");return s.setAttribute("aria-describedby",p(t,e.describedBy)??""),()=>{e.ref(null),t?s.setAttribute("aria-describedby",t):s.removeAttribute("aria-describedby")}},[i,e.ref,e.describedBy]),f(()=>{if(i||u)return;const s=c.current;if(!s)return;const t=s.firstElementChild;if(!t)return;e.ref(t);const a=t.getAttribute("aria-describedby");return t.setAttribute("aria-describedby",p(a,e.describedBy)??""),()=>{e.ref(null),a?t.setAttribute("aria-describedby",a):t.removeAttribute("aria-describedby")}},[i,u,e.ref,e.describedBy]),i&&r==null?o.jsx(o.Fragment,{children:e.renderTooltip(n)}):u?o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:e.ref,tabIndex:0,"aria-describedby":e.describedBy,...{0:{className:"xt0psk2"},1:{className:"xt0psk2 xujl8zx xev0dqp xycaml9 xrys4gj"}}[!!v<<0],children:r}),e.renderTooltip(n)]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:c,className:"xjp7ctv",children:r}),e.renderTooltip(n)]})}F.displayName="Tooltip";export{F as Tooltip};