@formicoidea/labre-core 0.41.0 → 0.43.1

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 (343) hide show
  1. package/LICENSE +384 -0
  2. package/dist/_pkgs/affine-block-bookmark/bookmark-block.js +2 -2
  3. package/dist/_pkgs/affine-block-data-view/configs/tooltips.js +1 -1
  4. package/dist/_pkgs/affine-block-database/configs/tooltips.js +1 -1
  5. package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +4 -2
  6. package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +7 -1
  7. package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.d.ts +39 -0
  8. package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.js +39 -0
  9. package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +4 -1
  10. package/dist/_pkgs/affine-block-embed/embed-github-block/embed-github-block.js +2 -1
  11. package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.d.ts +14 -1
  12. package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.js +21 -2
  13. package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +2 -0
  14. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +2 -1
  15. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +41 -11
  16. package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.d.ts +16 -0
  17. package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.js +17 -1
  18. package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.d.ts +8 -0
  19. package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.js +19 -0
  20. package/dist/_pkgs/affine-block-embed/embed-loom-block/embed-loom-block.js +4 -1
  21. package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +4 -1
  22. package/dist/_pkgs/affine-block-embed/index.d.ts +1 -0
  23. package/dist/_pkgs/affine-block-embed/index.js +1 -0
  24. package/dist/_pkgs/affine-block-embed/translations.d.ts +8 -0
  25. package/dist/_pkgs/affine-block-embed/translations.js +28 -0
  26. package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +4 -2
  27. package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +2 -2
  28. package/dist/_pkgs/affine-block-frame/frame-manager.js +6 -3
  29. package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
  30. package/dist/_pkgs/affine-block-frame/frame-toolbar.js +6 -1
  31. package/dist/_pkgs/affine-block-list/list-keymap.js +7 -0
  32. package/dist/_pkgs/affine-block-list/utils/get-list-icon.js +3 -1
  33. package/dist/_pkgs/affine-block-note/configs/tooltips.js +1 -1
  34. package/dist/_pkgs/affine-block-note/note-keymap.js +7 -1
  35. package/dist/_pkgs/affine-block-paragraph/paragraph-keymap.js +7 -1
  36. package/dist/_pkgs/affine-block-root/adapters/html.js +2 -2
  37. package/dist/_pkgs/affine-block-root/commands/copy-link-commands.d.ts +2 -0
  38. package/dist/_pkgs/affine-block-root/commands/copy-link-commands.js +155 -0
  39. package/dist/_pkgs/affine-block-root/commands/pivot-commands.js +1 -8
  40. package/dist/_pkgs/affine-block-root/commands/tag-commands.js +1 -8
  41. package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.d.ts +9 -0
  42. package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +51 -0
  43. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +22 -0
  44. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +46 -0
  45. package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.d.ts +21 -0
  46. package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.js +24 -0
  47. package/dist/_pkgs/affine-block-root/edgeless/utils/query.js +8 -0
  48. package/dist/_pkgs/affine-block-root/index.d.ts +1 -0
  49. package/dist/_pkgs/affine-block-root/index.js +1 -0
  50. package/dist/_pkgs/affine-block-root/keyboard/keymap.js +1 -16
  51. package/dist/_pkgs/affine-block-root/view.js +2 -0
  52. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +21 -3
  53. package/dist/_pkgs/affine-block-surface/element-model/index.js +14 -2
  54. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +23 -0
  55. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +89 -0
  56. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +7 -0
  57. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +5 -0
  58. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +41 -0
  59. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +70 -0
  60. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +49 -0
  61. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +257 -0
  62. package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.d.ts +16 -0
  63. package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.js +24 -0
  64. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +24 -0
  65. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +66 -0
  66. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +4 -0
  67. package/dist/_pkgs/affine-block-surface/extensions/index.js +4 -0
  68. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +66 -4
  69. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +253 -11
  70. package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +18 -0
  71. package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.d.ts +81 -0
  72. package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.js +81 -0
  73. package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +144 -0
  74. package/dist/_pkgs/affine-block-surface/extensions/legend.js +495 -0
  75. package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +4 -0
  76. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +17 -3
  77. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +35 -13
  78. package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +61 -1
  79. package/dist/_pkgs/affine-block-surface/extensions/reading.js +85 -39
  80. package/dist/_pkgs/affine-block-surface/extensions/record-action.d.ts +66 -0
  81. package/dist/_pkgs/affine-block-surface/extensions/record-action.js +145 -0
  82. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +3 -0
  83. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +23 -0
  84. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +1 -1
  85. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +12 -4
  86. package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +253 -28
  87. package/dist/_pkgs/affine-block-surface/extensions/validation.js +489 -41
  88. package/dist/_pkgs/affine-block-surface/framework-background/background-view.d.ts +115 -0
  89. package/dist/_pkgs/affine-block-surface/framework-background/background-view.js +185 -0
  90. package/dist/_pkgs/affine-block-surface/framework-background/fit.d.ts +36 -0
  91. package/dist/_pkgs/affine-block-surface/framework-background/fit.js +30 -0
  92. package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +2 -0
  93. package/dist/_pkgs/affine-block-surface/framework-background/index.js +2 -0
  94. package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +16 -1
  95. package/dist/_pkgs/affine-block-surface/framework-background/labels.js +31 -21
  96. package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +29 -5
  97. package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +6 -4
  98. package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +56 -8
  99. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +12 -0
  100. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +15 -0
  101. package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.js +2 -7
  102. package/dist/_pkgs/affine-block-surface/view.js +8 -1
  103. package/dist/_pkgs/affine-block-surface-ref/configs/slash-menu.js +1 -1
  104. package/dist/_pkgs/affine-block-surface-ref/configs/tooltips.js +2 -2
  105. package/dist/_pkgs/affine-components/color-picker/button.d.ts +56 -1
  106. package/dist/_pkgs/affine-components/color-picker/button.js +168 -23
  107. package/dist/_pkgs/affine-components/color-picker/framework-palette.d.ts +106 -0
  108. package/dist/_pkgs/affine-components/color-picker/framework-palette.js +177 -0
  109. package/dist/_pkgs/affine-components/color-picker/index.d.ts +2 -0
  110. package/dist/_pkgs/affine-components/color-picker/index.js +2 -0
  111. package/dist/_pkgs/affine-components/color-picker/palette-carousel.d.ts +85 -0
  112. package/dist/_pkgs/affine-components/color-picker/palette-carousel.js +445 -0
  113. package/dist/_pkgs/affine-components/color-picker/styles.js +1 -1
  114. package/dist/_pkgs/affine-components/context-menu/button.js +3 -1
  115. package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.d.ts +31 -1
  116. package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +189 -63
  117. package/dist/_pkgs/affine-components/icons/ai.js +3 -3
  118. package/dist/_pkgs/affine-components/icons/list.js +7 -1
  119. package/dist/_pkgs/affine-components/resource/resource.js +29 -16
  120. package/dist/_pkgs/affine-components/size-dropdown-menu/dropdown-menu.js +6 -1
  121. package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -1
  122. package/dist/_pkgs/affine-components/toolbar/index.js +1 -1
  123. package/dist/_pkgs/affine-components/toolbar/menu-button.d.ts +7 -0
  124. package/dist/_pkgs/affine-components/toolbar/menu-button.js +30 -0
  125. package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +16 -1
  126. package/dist/_pkgs/affine-components/toolbar/picker-menu.js +2 -2
  127. package/dist/_pkgs/affine-components/toolbar/toolbar.d.ts +1 -0
  128. package/dist/_pkgs/affine-components/toolbar/toolbar.js +67 -0
  129. package/dist/_pkgs/affine-components/translations.d.ts +8 -0
  130. package/dist/_pkgs/affine-components/translations.js +17 -0
  131. package/dist/_pkgs/affine-foundation/view.js +2 -1
  132. package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card-title-editor.js +1 -1
  133. package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +1 -1
  134. package/dist/_pkgs/affine-gfx-brush/element-renderer.js +2 -2
  135. package/dist/_pkgs/affine-gfx-brush/toolbar/components/eraser/icons.js +1 -1
  136. package/dist/_pkgs/affine-gfx-brush/toolbar/configs/brush.js +6 -1
  137. package/dist/_pkgs/affine-gfx-brush/toolbar/configs/highlighter.js +6 -1
  138. package/dist/_pkgs/affine-gfx-connector/connector-manager.d.ts +9 -1
  139. package/dist/_pkgs/affine-gfx-connector/connector-manager.js +61 -0
  140. package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.d.ts +11 -2
  141. package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +11 -2
  142. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.d.ts +7 -1
  143. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +87 -17
  144. package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +78 -17
  145. package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.d.ts +24 -2
  146. package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +31 -8
  147. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.d.ts +124 -3
  148. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +219 -56
  149. package/dist/_pkgs/affine-gfx-connector/text/text.d.ts +13 -4
  150. package/dist/_pkgs/affine-gfx-connector/text/text.js +13 -44
  151. package/dist/_pkgs/affine-gfx-connector/toolbar/config.d.ts +56 -0
  152. package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +94 -10
  153. package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.d.ts +8 -0
  154. package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.js +118 -0
  155. package/dist/_pkgs/affine-gfx-connector/translations.d.ts +3 -0
  156. package/dist/_pkgs/affine-gfx-connector/translations.js +23 -0
  157. package/dist/_pkgs/affine-gfx-connector/view/view.d.ts +37 -1
  158. package/dist/_pkgs/affine-gfx-connector/view/view.js +97 -8
  159. package/dist/_pkgs/affine-gfx-group/command/group-api.js +1 -1
  160. package/dist/_pkgs/affine-gfx-group/store.js +0 -2
  161. package/dist/_pkgs/affine-gfx-group/translations.d.ts +9 -10
  162. package/dist/_pkgs/affine-gfx-group/translations.js +9 -13
  163. package/dist/_pkgs/affine-gfx-mindmap/indicator-overlay/index.js +6 -2
  164. package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +1 -1
  165. package/dist/_pkgs/affine-gfx-mindmap/toolbar/basket-elements.js +1 -1
  166. package/dist/_pkgs/affine-gfx-mindmap/toolbar/config.js +4 -2
  167. package/dist/_pkgs/affine-gfx-mindmap/toolbar/utils/import-mindmap.js +2 -2
  168. package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +7 -1
  169. package/dist/_pkgs/affine-gfx-mindmap/translations.js +11 -1
  170. package/dist/_pkgs/affine-gfx-shape/element-renderer/highlighter.js +2 -2
  171. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.d.ts +6 -0
  172. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +30 -1
  173. package/dist/_pkgs/affine-gfx-shape/polygon-tool.d.ts +20 -1
  174. package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +9 -1
  175. package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +10 -3
  176. package/dist/_pkgs/affine-gfx-shape/toolbar/palette-color-action.js +11 -1
  177. package/dist/_pkgs/affine-gfx-shape/translations.d.ts +7 -0
  178. package/dist/_pkgs/affine-gfx-shape/translations.js +11 -0
  179. package/dist/_pkgs/affine-gfx-template/builtin/other.js +14 -8
  180. package/dist/_pkgs/affine-gfx-template/snapshot-from-action.js +32 -119
  181. package/dist/_pkgs/affine-gfx-template/toolbar/template-loading.js +1 -1
  182. package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +1 -1
  183. package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
  184. package/dist/_pkgs/affine-gfx-template/translations.js +38 -0
  185. package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.d.ts +13 -1
  186. package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.js +19 -4
  187. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.d.ts +41 -0
  188. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +60 -4
  189. package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +8 -1
  190. package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +14 -2
  191. package/dist/_pkgs/affine-gfx-text/translations.d.ts +9 -0
  192. package/dist/_pkgs/affine-gfx-text/translations.js +14 -1
  193. package/dist/_pkgs/affine-inline-latex/latex-node/latex-editor-menu.js +2 -1
  194. package/dist/_pkgs/affine-inline-preset/markdown.js +5 -1
  195. package/dist/_pkgs/affine-model/consts/connector.d.ts +28 -2
  196. package/dist/_pkgs/affine-model/consts/connector.js +26 -0
  197. package/dist/_pkgs/affine-model/consts/text.d.ts +15 -2
  198. package/dist/_pkgs/affine-model/consts/text.js +25 -1
  199. package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -1
  200. package/dist/_pkgs/affine-model/elements/brush/brush.js +1 -1
  201. package/dist/_pkgs/affine-model/elements/c4/board.js +1 -1
  202. package/dist/_pkgs/affine-model/elements/c4/boundary.js +1 -1
  203. package/dist/_pkgs/affine-model/elements/connector/connector.d.ts +135 -0
  204. package/dist/_pkgs/affine-model/elements/connector/connector.js +246 -5
  205. package/dist/_pkgs/affine-model/elements/connector/end-label.d.ts +83 -0
  206. package/dist/_pkgs/affine-model/elements/connector/end-label.js +119 -0
  207. package/dist/_pkgs/affine-model/elements/connector/index.d.ts +1 -0
  208. package/dist/_pkgs/affine-model/elements/connector/index.js +1 -0
  209. package/dist/_pkgs/affine-model/elements/context-map/context-map.js +1 -1
  210. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +28 -0
  211. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +129 -2
  212. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.d.ts +8 -0
  213. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +45 -2
  214. package/dist/_pkgs/affine-model/elements/edgy/board.js +1 -1
  215. package/dist/_pkgs/affine-model/elements/edgy/facets.js +1 -1
  216. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +6 -0
  217. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +36 -2
  218. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +18 -7
  219. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +23 -8
  220. package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +16 -0
  221. package/dist/_pkgs/affine-model/elements/framework-background/background.js +18 -0
  222. package/dist/_pkgs/affine-model/elements/highlighter/highlighter.js +1 -1
  223. package/dist/_pkgs/affine-model/elements/index.d.ts +8 -0
  224. package/dist/_pkgs/affine-model/elements/index.js +1 -0
  225. package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -1
  226. package/dist/_pkgs/affine-model/elements/text/text.js +1 -1
  227. package/dist/_pkgs/affine-model/elements/uml/band.d.ts +39 -0
  228. package/dist/_pkgs/affine-model/elements/uml/band.js +31 -0
  229. package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +158 -0
  230. package/dist/_pkgs/affine-model/elements/uml/diagram.js +229 -0
  231. package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +161 -0
  232. package/dist/_pkgs/affine-model/elements/uml/fragment.js +205 -0
  233. package/dist/_pkgs/affine-model/elements/uml/index.d.ts +8 -0
  234. package/dist/_pkgs/affine-model/elements/uml/index.js +8 -0
  235. package/dist/_pkgs/affine-model/elements/uml/lifeline.d.ts +77 -0
  236. package/dist/_pkgs/affine-model/elements/uml/lifeline.js +89 -0
  237. package/dist/_pkgs/affine-model/elements/uml/node.d.ts +142 -0
  238. package/dist/_pkgs/affine-model/elements/uml/node.js +190 -0
  239. package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +106 -0
  240. package/dist/_pkgs/affine-model/elements/uml/partition.js +172 -0
  241. package/dist/_pkgs/affine-model/elements/uml/region.d.ts +75 -0
  242. package/dist/_pkgs/affine-model/elements/uml/region.js +150 -0
  243. package/dist/_pkgs/affine-model/elements/uml/subject.d.ts +37 -0
  244. package/dist/_pkgs/affine-model/elements/uml/subject.js +108 -0
  245. package/dist/_pkgs/affine-model/elements/wardley/wardley.js +1 -1
  246. package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.d.ts +1 -0
  247. package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +18 -0
  248. package/dist/_pkgs/affine-shared/services/font-loader/config.js +82 -50
  249. package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +1 -9
  250. package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.d.ts +53 -0
  251. package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.js +95 -0
  252. package/dist/_pkgs/affine-shared/services/telemetry-service/index.d.ts +1 -0
  253. package/dist/_pkgs/affine-shared/services/telemetry-service/index.js +1 -0
  254. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +26 -1
  255. package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
  256. package/dist/_pkgs/affine-shared/services/theme-service.d.ts +19 -0
  257. package/dist/_pkgs/affine-shared/services/theme-service.js +24 -0
  258. package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.d.ts +34 -0
  259. package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.js +63 -0
  260. package/dist/_pkgs/affine-shared/services/toolbar-service/index.d.ts +1 -0
  261. package/dist/_pkgs/affine-shared/services/toolbar-service/index.js +1 -0
  262. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +97 -7
  263. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +178 -7
  264. package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
  265. package/dist/_pkgs/affine-shared/styles/index.js +1 -0
  266. package/dist/_pkgs/affine-shared/styles/motion.d.ts +14 -0
  267. package/dist/_pkgs/affine-shared/styles/motion.js +38 -0
  268. package/dist/_pkgs/affine-shared/utils/event.d.ts +10 -0
  269. package/dist/_pkgs/affine-shared/utils/event.js +20 -0
  270. package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +16 -0
  271. package/dist/_pkgs/affine-shared/utils/file/filesys.js +25 -0
  272. package/dist/_pkgs/affine-shared/utils/index.d.ts +1 -0
  273. package/dist/_pkgs/affine-shared/utils/index.js +1 -0
  274. package/dist/_pkgs/affine-shared/utils/link-preview-refresh.d.ts +12 -0
  275. package/dist/_pkgs/affine-shared/utils/link-preview-refresh.js +13 -0
  276. package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +2 -2
  277. package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +5 -1
  278. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +12 -4
  279. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +27 -4
  280. package/dist/_pkgs/affine-widget-edgeless-toolbar/config/types.d.ts +15 -0
  281. package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.d.ts +1 -1
  282. package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.js +7 -2
  283. package/dist/_pkgs/affine-widget-edgeless-toolbar/create-popper.js +13 -0
  284. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +2 -0
  285. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +2 -0
  286. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +80 -0
  287. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +270 -81
  288. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.d.ts +15 -0
  289. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.js +15 -0
  290. package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.d.ts +18 -0
  291. package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.js +52 -6
  292. package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-weight-and-style-panel.js +8 -1
  293. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.d.ts +42 -0
  294. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.js +100 -0
  295. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.d.ts +100 -0
  296. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.js +274 -0
  297. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.d.ts +3 -0
  298. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.js +3 -0
  299. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.d.ts +25 -0
  300. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.js +67 -0
  301. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +6 -0
  302. package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +10 -0
  303. package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +5 -0
  304. package/dist/_pkgs/affine-widget-frame-title/edgeless-frame-title-editor.js +2 -1
  305. package/dist/_pkgs/affine-widget-slash-menu/translations.d.ts +16 -0
  306. package/dist/_pkgs/affine-widget-slash-menu/translations.js +23 -1
  307. package/dist/_pkgs/affine-widget-toolbar/utils.js +57 -14
  308. package/dist/_pkgs/data-view/core/detail/field.js +2 -1
  309. package/dist/_pkgs/data-view/core/filter/literal/define.js +3 -1
  310. package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +1 -1
  311. package/dist/_pkgs/data-view/property-presets/checkbox/cell-renderer.js +8 -2
  312. package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +1 -1
  313. package/dist/_pkgs/data-view/view-presets/kanban/pc/controller/drag.js +2 -1
  314. package/dist/_pkgs/data-view/view-presets/table/pc/controller/drag.js +2 -1
  315. package/dist/_pkgs/data-view/view-presets/table/pc/controller/selection.js +1 -1
  316. package/dist/_pkgs/data-view/view-presets/table/pc/header/vertical-indicator.js +2 -1
  317. package/dist/_pkgs/data-view/view-presets/table/pc/row/row-select-checkbox.js +3 -1
  318. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/drag.js +2 -1
  319. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/selection.js +1 -1
  320. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/header/vertical-indicator.js +2 -1
  321. package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/row-header.js +3 -1
  322. package/dist/_pkgs/global/gfx/xywh.js +7 -0
  323. package/dist/_pkgs/std/extension/command-registry.d.ts +158 -1
  324. package/dist/_pkgs/std/extension/command-registry.js +22 -0
  325. package/dist/_pkgs/std/gfx/index.d.ts +1 -1
  326. package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.d.ts +12 -0
  327. package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +20 -1
  328. package/dist/_pkgs/std/gfx/interactivity/manager.d.ts +10 -0
  329. package/dist/_pkgs/std/gfx/interactivity/manager.js +12 -0
  330. package/dist/_pkgs/std/gfx/model/surface/element-model.js +12 -7
  331. package/dist/_pkgs/std/gfx/model/surface/role.d.ts +10 -5
  332. package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +56 -0
  333. package/dist/_pkgs/std/gfx/model/surface/surface-model.js +84 -3
  334. package/dist/_pkgs/std/gfx/view/view.d.ts +11 -2
  335. package/dist/_pkgs/std/gfx/view/view.js +16 -2
  336. package/dist/commands.d.ts +6 -0
  337. package/dist/commands.js +10 -2
  338. package/dist/frameworks.d.ts +9 -0
  339. package/dist/frameworks.js +19 -0
  340. package/dist/translations.js +21 -0
  341. package/package.json +13 -4
  342. package/dist/_pkgs/affine-gfx-group/group-watcher.d.ts +0 -1
  343. package/dist/_pkgs/affine-gfx-group/group-watcher.js +0 -20
@@ -4,7 +4,7 @@ import { EmbedIframeService, type IframeOptions } from '../../affine-shared/serv
4
4
  import { type ReadonlySignal } from '@preact/signals-core';
5
5
  import { type ClassInfo } from 'lit/directives/class-map.js';
6
6
  import type { EmbedLinkInputPopupOptions } from './components/embed-iframe-link-input-popup.js';
7
- import type { EmbedIframeStatusCardOptions } from './types.js';
7
+ import { type EmbedIframeStatusCardOptions } from './types.js';
8
8
  export type EmbedIframeStatus = 'idle' | 'loading' | 'success' | 'error';
9
9
  export declare class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIframeBlockModel> {
10
10
  selectedStyle$: ReadonlySignal<ClassInfo> | null;
@@ -21,6 +21,7 @@ export declare class EmbedIframeBlockComponent extends CaptionedBlockComponent<E
21
21
  readonly showOverlay$: ReadonlySignal<boolean>;
22
22
  readonly selectedBorderRadius$: ReadonlySignal<number>;
23
23
  protected iframeOptions: IframeOptions | undefined;
24
+ private currentConfigName;
24
25
  get embedIframeService(): EmbedIframeService;
25
26
  get linkPreviewService(): import("../../affine-shared/services/index.js").LinkPreviewProvider;
26
27
  get notificationService(): import("../../affine-shared/services/notification-service.js").NotificationService | null;
@@ -36,8 +36,7 @@ import { SurfaceBlockModel } from '../../affine-block-surface/index.js';
36
36
  import { CaptionedBlockComponent, SelectedStyle, } from '../../affine-components/caption/index.js';
37
37
  import { createLitPortal } from '../../affine-components/portal/index.js';
38
38
  import { EmbedIframeService, LinkPreviewServiceIdentifier, NotificationProvider, TOAST_NO_LINK_FOUND, translateKey, } from '../../affine-shared/services/index.js';
39
- import { matchModels } from '../../affine-shared/utils/index.js';
40
- import { BlockSuiteError, ErrorCode } from '../../global/exceptions/index.js';
39
+ import { matchModels, shouldRefreshOnPropsUpdate, } from '../../affine-shared/utils/index.js';
41
40
  import { BlockSelection } from '../../std/index.js';
42
41
  import { flip, offset, shift } from '@floating-ui/dom';
43
42
  import { computed, effect, signal, } from '@preact/signals-core';
@@ -48,8 +47,10 @@ import { ifDefined } from 'lit/directives/if-defined.js';
48
47
  import { styleMap } from 'lit/directives/style-map.js';
49
48
  import { DEFAULT_IFRAME_HEIGHT, DEFAULT_IFRAME_WIDTH, EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS, ERROR_CARD_DEFAULT_HEIGHT, IDLE_CARD_DEFAULT_HEIGHT, LINK_CREATE_POPUP_OFFSET, LOADING_CARD_DEFAULT_HEIGHT, } from './consts.js';
50
49
  import { embedIframeBlockStyles } from './style.js';
51
- import { safeGetIframeSrc } from './utils.js';
52
- import { EMBED_IFRAME_NO_LINK_MESSAGE } from '../translations.js';
50
+ import { EmbedIframeError, } from './types.js';
51
+ import { isSafeEmbedUrl, safeGetIframeSrc } from './utils.js';
52
+ import { TRUSTED_SANDBOX, UNTRUSTED_SANDBOX, } from '../common/iframe-sandbox.js';
53
+ import { EMBED_IFRAME_ERROR_INVALID_URL, EMBED_IFRAME_ERROR_NO_DATA, EMBED_IFRAME_NO_LINK_MESSAGE, } from '../translations.js';
53
54
  let EmbedIframeBlockComponent = (() => {
54
55
  let _classSuper = CaptionedBlockComponent;
55
56
  let __blockContainer_decorators;
@@ -122,7 +123,7 @@ let EmbedIframeBlockComponent = (() => {
122
123
  }
123
124
  // refresh data when original url changes
124
125
  this.disposables.add(this.model.propsUpdated.subscribe(({ key }) => {
125
- if (key === 'url') {
126
+ if (shouldRefreshOnPropsUpdate(this.store, key)) {
126
127
  this.refreshData().catch(console.error);
127
128
  }
128
129
  }));
@@ -219,9 +220,12 @@ let EmbedIframeBlockComponent = (() => {
219
220
  return EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS;
220
221
  });
221
222
  this.iframeOptions = undefined;
223
+ // the name of the provider config matched by the original url, if any
224
+ this.currentConfigName = undefined;
222
225
  this.open = () => {
223
226
  const link = this.model.props.url;
224
- if (!link) {
227
+ // a non http(s) link would run in the opener context, never open it
228
+ if (!isSafeEmbedUrl(link)) {
225
229
  this.notificationService?.notify({
226
230
  title: translateKey(this.std, ...TOAST_NO_LINK_FOUND),
227
231
  message: translateKey(this.std, ...EMBED_IFRAME_NO_LINK_MESSAGE),
@@ -230,7 +234,7 @@ let EmbedIframeBlockComponent = (() => {
230
234
  });
231
235
  return;
232
236
  }
233
- window.open(link, '_blank');
237
+ window.open(link, '_blank', 'noopener,noreferrer');
234
238
  };
235
239
  this.refreshData = async () => {
236
240
  try {
@@ -246,7 +250,10 @@ let EmbedIframeBlockComponent = (() => {
246
250
  const embedIframeService = this.embedIframeService;
247
251
  const linkPreviewService = this.linkPreviewService;
248
252
  if (!embedIframeService || !linkPreviewService) {
249
- throw new BlockSuiteError(ErrorCode.ValueNotExists, 'EmbedIframeService or LinkPreviewService not found');
253
+ // A DI wiring failure, never a user-facing fact: it declares NO
254
+ // `messageKey`, so the card shows its generic keyed sentence and this
255
+ // technical one stays where a developer reads it (#390).
256
+ throw new EmbedIframeError('EmbedIframeService or LinkPreviewService not found');
250
257
  }
251
258
  // get embed data and preview data in a promise
252
259
  const [embedData, previewData] = await Promise.all([
@@ -256,7 +263,9 @@ let EmbedIframeBlockComponent = (() => {
256
263
  // if the embed data is not found, and the iframeUrl is not set, throw an error
257
264
  const currentIframeUrl = this.model.props.iframeUrl;
258
265
  if (!embedData && !currentIframeUrl) {
259
- throw new BlockSuiteError(ErrorCode.ValueNotExists, 'Failed to get embed data');
266
+ throw new EmbedIframeError(EMBED_IFRAME_ERROR_NO_DATA[1], {
267
+ messageKey: EMBED_IFRAME_ERROR_NO_DATA[0],
268
+ });
260
269
  }
261
270
  // update model
262
271
  const iframeUrl = this._getIframeUrl(embedData) ?? currentIframeUrl;
@@ -325,6 +334,7 @@ let EmbedIframeBlockComponent = (() => {
325
334
  const config = this.embedIframeService?.getConfig(url);
326
335
  if (config) {
327
336
  this.iframeOptions = config.options;
337
+ this.currentConfigName = config.name;
328
338
  }
329
339
  };
330
340
  this._handleDoubleClick = () => {
@@ -359,11 +369,30 @@ let EmbedIframeBlockComponent = (() => {
359
369
  };
360
370
  this._renderIframe = () => {
361
371
  const { iframeUrl } = this.model.props;
362
- const { widthPercent, heightInNote, style, allow, referrerpolicy, scrolling, allowFullscreen, } = this.iframeOptions ?? {};
372
+ // the url comes from the document: refuse to give a non http(s) one to src
373
+ if (!isSafeEmbedUrl(iframeUrl)) {
374
+ return html `<embed-iframe-error-card
375
+ .error=${new EmbedIframeError(EMBED_IFRAME_ERROR_INVALID_URL[1], {
376
+ messageKey: EMBED_IFRAME_ERROR_INVALID_URL[0],
377
+ })}
378
+ .model=${this.model}
379
+ .onRetry=${this._handleRetry}
380
+ .std=${this.std}
381
+ .inSurface=${this.inSurface}
382
+ .options=${this._statusCardOptions}
383
+ ></embed-iframe-error-card>`;
384
+ }
385
+ const { widthPercent, heightInNote, style, allow, referrerpolicy, scrolling, allowFullscreen, sandbox, } = this.iframeOptions ?? {};
363
386
  const width = `${widthPercent}%`;
364
387
  // if the block is in the surface, use 100% as the height
365
388
  // otherwise, use the heightInNote
366
389
  const height = this.inSurface ? '100%' : heightInNote;
390
+ // a provider may widen its own sandbox; an arbitrary url (generic config,
391
+ // or no config at all) only ever gets the untrusted one
392
+ const sandboxValue = sandbox ??
393
+ (this.currentConfigName && this.currentConfigName !== 'generic'
394
+ ? TRUSTED_SANDBOX
395
+ : UNTRUSTED_SANDBOX);
367
396
  return html `
368
397
  <iframe
369
398
  width=${width ?? DEFAULT_IFRAME_WIDTH}
@@ -372,7 +401,8 @@ let EmbedIframeBlockComponent = (() => {
372
401
  loading="lazy"
373
402
  frameborder="0"
374
403
  credentialless
375
- src=${ifDefined(iframeUrl)}
404
+ sandbox=${sandboxValue}
405
+ src=${iframeUrl}
376
406
  allow=${ifDefined(allow)}
377
407
  referrerpolicy=${ifDefined(referrerpolicy)}
378
408
  scrolling=${ifDefined(scrolling)}
@@ -14,3 +14,19 @@ export type EmbedIframeStatusCardOptions = {
14
14
  width?: number;
15
15
  height?: number;
16
16
  };
17
+ /**
18
+ * An embed failure that names its own sentence — the `InterchangeImportError`
19
+ * pattern (`blocks/surface/src/extensions/interchange.ts`) applied to the
20
+ * iframe error card (#390).
21
+ *
22
+ * `message` stays the English developer sentence (the console, a test's
23
+ * assertion); `messageKey` is what the CARD renders. An error without a key
24
+ * renders `EMBED_IFRAME_ERROR_FALLBACK`, never its `message`: a sentence
25
+ * written for a developer has no business under a translated title.
26
+ */
27
+ export declare class EmbedIframeError extends Error {
28
+ readonly messageKey?: string;
29
+ constructor(message: string, options?: {
30
+ messageKey?: string;
31
+ });
32
+ }
@@ -1 +1,17 @@
1
- export {};
1
+ /**
2
+ * An embed failure that names its own sentence — the `InterchangeImportError`
3
+ * pattern (`blocks/surface/src/extensions/interchange.ts`) applied to the
4
+ * iframe error card (#390).
5
+ *
6
+ * `message` stays the English developer sentence (the console, a test's
7
+ * assertion); `messageKey` is what the CARD renders. An error without a key
8
+ * renders `EMBED_IFRAME_ERROR_FALLBACK`, never its `message`: a sentence
9
+ * written for a developer has no business under a translated title.
10
+ */
11
+ export class EmbedIframeError extends Error {
12
+ constructor(message, options) {
13
+ super(message);
14
+ this.name = 'EmbedIframeError';
15
+ this.messageKey = options?.messageKey;
16
+ }
17
+ }
@@ -13,6 +13,14 @@ export interface EmbedIframeUrlValidationOptions {
13
13
  * @returns Whether the url is valid
14
14
  */
15
15
  export declare function validateEmbedIframeUrl(url: string, options: EmbedIframeUrlValidationOptions): boolean;
16
+ /**
17
+ * Whether a url stored in the document may be handed to an iframe `src` or to
18
+ * `window.open`. Only http(s) passes: the url comes from a collaborative
19
+ * document, so a `javascript:` or `data:` one must never reach the browser.
20
+ * @param url URL to check
21
+ * @returns Whether the url is safe to navigate to
22
+ */
23
+ export declare function isSafeEmbedUrl(url: string | undefined): url is string;
16
24
  /**
17
25
  * Safely extracts the src URL from an iframe HTML string
18
26
  * @param htmlString The iframe HTML string to parse
@@ -17,6 +17,25 @@ export function validateEmbedIframeUrl(url, options) {
17
17
  return false;
18
18
  }
19
19
  }
20
+ /**
21
+ * Whether a url stored in the document may be handed to an iframe `src` or to
22
+ * `window.open`. Only http(s) passes: the url comes from a collaborative
23
+ * document, so a `javascript:` or `data:` one must never reach the browser.
24
+ * @param url URL to check
25
+ * @returns Whether the url is safe to navigate to
26
+ */
27
+ export function isSafeEmbedUrl(url) {
28
+ if (!url) {
29
+ return false;
30
+ }
31
+ try {
32
+ const { protocol } = new URL(url);
33
+ return protocol === 'http:' || protocol === 'https:';
34
+ }
35
+ catch {
36
+ return false;
37
+ }
38
+ }
20
39
  /**
21
40
  * Safely extracts the src URL from an iframe HTML string
22
41
  * @param htmlString The iframe HTML string to parse
@@ -35,12 +35,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { LoadingIcon, OpenIcon } from '../../affine-components/icons/index.js';
36
36
  import { ImageProxyService } from '../../affine-shared/adapters/index.js';
37
37
  import { ThemeProvider } from '../../affine-shared/services/index.js';
38
+ import { shouldRefreshOnPropsUpdate } from '../../affine-shared/utils/index.js';
38
39
  import { BlockSelection } from '../../std/index.js';
39
40
  import { html } from 'lit';
40
41
  import { property } from 'lit/decorators.js';
41
42
  import { classMap } from 'lit/directives/class-map.js';
42
43
  import { styleMap } from 'lit/directives/style-map.js';
43
44
  import { EmbedBlockComponent } from '../common/embed-block-element.js';
45
+ import { PROVIDER_PLAYER_SANDBOX } from '../common/iframe-sandbox.js';
44
46
  import { getEmbedCardIcons } from '../common/utils.js';
45
47
  import { loomUrlRegex } from './embed-loom-model.js';
46
48
  import { LoomIcon, styles } from './styles.js';
@@ -95,7 +97,7 @@ let EmbedLoomBlockComponent = (() => {
95
97
  }
96
98
  this.disposables.add(this.model.propsUpdated.subscribe(({ key }) => {
97
99
  this.requestUpdate();
98
- if (key === 'url') {
100
+ if (shouldRefreshOnPropsUpdate(this.store, key)) {
99
101
  this.refreshData();
100
102
  }
101
103
  }));
@@ -135,6 +137,7 @@ let EmbedLoomBlockComponent = (() => {
135
137
  allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
136
138
  loading="lazy"
137
139
  credentialless
140
+ sandbox=${PROVIDER_PLAYER_SANDBOX}
138
141
  ></iframe>
139
142
 
140
143
  <!-- overlay to prevent the iframe from capturing pointer events -->
@@ -35,12 +35,14 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { LoadingIcon, OpenIcon } from '../../affine-components/icons/index.js';
36
36
  import { ImageProxyService } from '../../affine-shared/adapters/index.js';
37
37
  import { ThemeProvider } from '../../affine-shared/services/index.js';
38
+ import { shouldRefreshOnPropsUpdate } from '../../affine-shared/utils/index.js';
38
39
  import { BlockSelection } from '../../std/index.js';
39
40
  import { html, nothing } from 'lit';
40
41
  import { property, state } from 'lit/decorators.js';
41
42
  import { classMap } from 'lit/directives/class-map.js';
42
43
  import { styleMap } from 'lit/directives/style-map.js';
43
44
  import { EmbedBlockComponent } from '../common/embed-block-element.js';
45
+ import { PROVIDER_PLAYER_SANDBOX } from '../common/iframe-sandbox.js';
44
46
  import { getEmbedCardIcons } from '../common/utils.js';
45
47
  import { youtubeUrlRegex } from './embed-youtube-model.js';
46
48
  import { styles, YoutubeIcon } from './styles.js';
@@ -100,7 +102,7 @@ let EmbedYoutubeBlockComponent = (() => {
100
102
  }
101
103
  this.disposables.add(this.model.propsUpdated.subscribe(({ key }) => {
102
104
  this.requestUpdate();
103
- if (key === 'url') {
105
+ if (shouldRefreshOnPropsUpdate(this.store, key)) {
104
106
  this.refreshData();
105
107
  }
106
108
  }));
@@ -152,6 +154,7 @@ let EmbedYoutubeBlockComponent = (() => {
152
154
  allowfullscreen
153
155
  loading="lazy"
154
156
  credentialless
157
+ sandbox=${PROVIDER_PLAYER_SANDBOX}
155
158
  ></iframe>
156
159
 
157
160
  <!-- overlay to prevent the iframe from capturing pointer events -->
@@ -3,6 +3,7 @@ export { createEmbedBlockMarkdownAdapterMatcher } from './common/adapters/markdo
3
3
  export { createEmbedBlockPlainTextAdapterMatcher } from './common/adapters/plain-text.js';
4
4
  export { createEmbedEdgelessBlockInteraction, EmbedBlockComponent, } from './common/embed-block-element.js';
5
5
  export * from './common/embed-note-content-styles.js';
6
+ export { PROVIDER_PLAYER_SANDBOX, TRUSTED_SANDBOX, UNTRUSTED_SANDBOX, } from './common/iframe-sandbox.js';
6
7
  export { insertEmbedCard } from './common/insert-embed-card.js';
7
8
  export * from './common/render-linked-doc.js';
8
9
  export { toEdgelessEmbedBlock } from './common/to-edgeless-embed-block.js';
@@ -3,6 +3,7 @@ export { createEmbedBlockMarkdownAdapterMatcher } from './common/adapters/markdo
3
3
  export { createEmbedBlockPlainTextAdapterMatcher } from './common/adapters/plain-text.js';
4
4
  export { createEmbedEdgelessBlockInteraction, EmbedBlockComponent, } from './common/embed-block-element.js';
5
5
  export * from './common/embed-note-content-styles.js';
6
+ export { PROVIDER_PLAYER_SANDBOX, TRUSTED_SANDBOX, UNTRUSTED_SANDBOX, } from './common/iframe-sandbox.js';
6
7
  export { insertEmbedCard } from './common/insert-embed-card.js';
7
8
  export * from './common/render-linked-doc.js';
8
9
  export { toEdgelessEmbedBlock } from './common/to-edgeless-embed-block.js';
@@ -18,6 +18,14 @@ export declare const EMBED_IFRAME_SLASH_NAME: ChromeWording;
18
18
  export declare const EMBED_IFRAME_SLASH_DESCRIPTION: ChromeWording;
19
19
  export declare const EMBED_IFRAME_ERROR_TITLE: ChromeWording;
20
20
  export declare const EMBED_IFRAME_ERROR_EDIT: ChromeWording;
21
+ export declare const EMBED_IFRAME_ERROR_NO_DATA: ChromeWording;
22
+ export declare const EMBED_IFRAME_ERROR_INVALID_URL: ChromeWording;
23
+ /**
24
+ * What the card says for any error that declares no key of its own —
25
+ * including the DI wiring failure ("EmbedIframeService or LinkPreviewService
26
+ * not found"), which is never a user-facing fact and stays in the console.
27
+ */
28
+ export declare const EMBED_IFRAME_ERROR_FALLBACK: ChromeWording;
21
29
  export declare const EMBED_IFRAME_IDLE_TEXT: ChromeWording;
22
30
  export declare const EMBED_IFRAME_INVALID_URL_TITLE: ChromeWording;
23
31
  export declare const EMBED_IFRAME_INVALID_URL_MESSAGE: ChromeWording;
@@ -39,6 +39,31 @@ export const EMBED_IFRAME_ERROR_TITLE = [
39
39
  'This link couldn’t be loaded.',
40
40
  ];
41
41
  export const EMBED_IFRAME_ERROR_EDIT = TOOLBAR_EDIT;
42
+ /* ── The error card's own sentence (#390) ─────────────────────────────────
43
+ *
44
+ * The card used to render `error.message` raw — a developer sentence thrown
45
+ * by `refreshData`, drawn under a translated title. An `EmbedIframeError`
46
+ * carries a `messageKey` instead (the `InterchangeImportError` pattern,
47
+ * `blocks/surface/src/extensions/interchange.ts`), and the card resolves the
48
+ * key or this fallback, never the raw `message`.
49
+ */
50
+ export const EMBED_IFRAME_ERROR_NO_DATA = [
51
+ 'com.labre.embed.iframe.error.no-embed-data',
52
+ 'Failed to get embed data',
53
+ ];
54
+ export const EMBED_IFRAME_ERROR_INVALID_URL = [
55
+ 'com.labre.embed.iframe.error.invalid-url',
56
+ 'Invalid iframe URL',
57
+ ];
58
+ /**
59
+ * What the card says for any error that declares no key of its own —
60
+ * including the DI wiring failure ("EmbedIframeService or LinkPreviewService
61
+ * not found"), which is never a user-facing fact and stays in the console.
62
+ */
63
+ export const EMBED_IFRAME_ERROR_FALLBACK = [
64
+ 'com.labre.embed.iframe.error.message',
65
+ 'Failed to load embedded content',
66
+ ];
42
67
  export const EMBED_IFRAME_IDLE_TEXT = [
43
68
  'com.labre.embed.iframe.idle.text',
44
69
  'Embed anything (Google Drive, Google Docs, Spotify, Miro…)',
@@ -101,6 +126,9 @@ export const EMBED_WORDINGS = [
101
126
  EMBED_IFRAME_SLASH_NAME,
102
127
  EMBED_IFRAME_SLASH_DESCRIPTION,
103
128
  EMBED_IFRAME_ERROR_TITLE,
129
+ EMBED_IFRAME_ERROR_NO_DATA,
130
+ EMBED_IFRAME_ERROR_INVALID_URL,
131
+ EMBED_IFRAME_ERROR_FALLBACK,
104
132
  EMBED_IFRAME_IDLE_TEXT,
105
133
  EMBED_IFRAME_INVALID_URL_TITLE,
106
134
  EMBED_IFRAME_INVALID_URL_MESSAGE,
@@ -38,7 +38,7 @@ import { LoadingIcon } from '../../affine-components/icons/index.js';
38
38
  import { isPeekable, Peekable } from '../../affine-components/peek/index.js';
39
39
  import { RefNodeSlotsProvider } from '../../affine-inline-reference/index.js';
40
40
  import { EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, REFERENCE_NODE, } from '../../affine-shared/consts/index.js';
41
- import { CHROME_LOADING, CitationProvider, DocDisplayMetaProvider, DocModeProvider, LINKED_DOC_DELETED, LINKED_DOC_EMPTY_PREVIEW, LINKED_DOC_FAILED, OpenDocExtensionIdentifier, ThemeProvider, TOOLBAR_RELOAD, translateKey, whenLinkedDocContentReady, } from '../../affine-shared/services/index.js';
41
+ import { CHROME_LOADING, CHROME_UNTITLED, CitationProvider, DocDisplayMetaProvider, DocModeProvider, LINKED_DOC_DELETED, LINKED_DOC_EMPTY_PREVIEW, LINKED_DOC_FAILED, OpenDocExtensionIdentifier, ThemeProvider, TOOLBAR_RELOAD, translateKey, whenLinkedDocContentReady, } from '../../affine-shared/services/index.js';
42
42
  import { cloneReferenceInfo, cloneReferenceInfoWithoutAliases, isNewTabTrigger, isNewViewTrigger, matchModels, referenceToNode, } from '../../affine-shared/utils/index.js';
43
43
  import { Bound } from '../../global/gfx/index.js';
44
44
  import { ResetIcon } from '@blocksuite/icons/lit';
@@ -118,7 +118,9 @@ let EmbedLinkedDocBlockComponent = (() => {
118
118
  }
119
119
  static { this.styles = styles; }
120
120
  get docTitle() {
121
- return this.model.props.title || this.linkedDoc?.meta?.title || 'Untitled';
121
+ return (this.model.props.title ||
122
+ this.linkedDoc?.meta?.title ||
123
+ translateKey(this.std, ...CHROME_UNTITLED));
122
124
  }
123
125
  get editorMode() {
124
126
  return this._linkedDocMode;
@@ -38,7 +38,7 @@ import { ViewExtensionManagerIdentifier } from '../../affine-ext-loader/index.js
38
38
  import { RefNodeSlotsProvider, } from '../../affine-inline-reference/index.js';
39
39
  import { NoteDisplayMode, } from '../../affine-model/index.js';
40
40
  import { REFERENCE_NODE } from '../../affine-shared/consts/index.js';
41
- import { DocDisplayMetaProvider, DocModeProvider, EditorSettingExtension, EditorSettingProvider, GeneralSettingSchema, ThemeExtensionIdentifier, ThemeProvider, translateKey, } from '../../affine-shared/services/index.js';
41
+ import { CHROME_UNTITLED, DocDisplayMetaProvider, DocModeProvider, EditorSettingExtension, EditorSettingProvider, GeneralSettingSchema, ThemeExtensionIdentifier, ThemeProvider, translateKey, } from '../../affine-shared/services/index.js';
42
42
  import { cloneReferenceInfo } from '../../affine-shared/utils/index.js';
43
43
  import { Bound, getCommonBound } from '../../global/gfx/index.js';
44
44
  import { BlockSelection, BlockStdScope, LifeCycleWatcher, } from '../../std/index.js';
@@ -405,7 +405,7 @@ let EmbedSyncedDocBlockComponent = (() => {
405
405
  };
406
406
  }
407
407
  get docTitle() {
408
- return this.syncedDoc?.meta?.title || 'Untitled';
408
+ return (this.syncedDoc?.meta?.title || translateKey(this.std, ...CHROME_UNTITLED));
409
409
  }
410
410
  get docUpdatedAt() {
411
411
  return this._docUpdatedAt;
@@ -1,6 +1,6 @@
1
1
  import { indexOverBackgrounds, Overlay, stackedElementsOf, } from '../affine-block-surface/index.js';
2
2
  import { FrameworkBackgroundElementModel } from '../affine-model/index.js';
3
- import { EditPropsStore, translateKey } from '../affine-shared/services/index.js';
3
+ import { EditPropsStore, getChromeAccentColor, translateKey, } from '../affine-shared/services/index.js';
4
4
  import { DisposableGroup } from '../global/disposable/index.js';
5
5
  import { BlockSuiteError, ErrorCode } from '../global/exceptions/index.js';
6
6
  import { Bound, deserializeXYWH, } from '../global/gfx/index.js';
@@ -65,7 +65,10 @@ export class FrameOverlay extends Overlay {
65
65
  }
66
66
  render(ctx) {
67
67
  ctx.beginPath();
68
- ctx.strokeStyle = '#1E96EB';
68
+ // The accent read from the theme, not a literal: a canvas context cannot
69
+ // take a `var(…)`, so the token is resolved here (DESIGN.md, The Borrowed
70
+ // Blue Rule).
71
+ ctx.strokeStyle = getChromeAccentColor(this.gfx.std);
69
72
  ctx.lineWidth = 2 / this.gfx.viewport.zoom;
70
73
  const radius = 2 / this.gfx.viewport.zoom;
71
74
  if (this._frame) {
@@ -146,7 +149,7 @@ export class EdgelessFrameManager extends GfxExtension {
146
149
  .get(EditPropsStore)
147
150
  .applyLastProps('affine:frame', {
148
151
  // Translated HERE and once: the title is document content the moment
149
- // it lands (ADR 0016), so the host's catalogue is asked at placement
152
+ // it lands (ADR 0023), so the host's catalogue is asked at placement
150
153
  // and never again — a renamed frame keeps its name.
151
154
  title: new Text(new Y.Text(translateKey(this.gfx.std, ...FRAME_SEED_NAME, {
152
155
  n: this.frames.length + 1,
@@ -50,7 +50,7 @@ export class FrameTool extends BaseTool {
50
50
  .get(EditPropsStore)
51
51
  .applyLastProps('affine:frame', {
52
52
  // Translated HERE and once, like `EdgelessFrameManager._addFrameBlock`:
53
- // the title is document content the moment it lands (ADR 0016).
53
+ // the title is document content the moment it lands (ADR 0023).
54
54
  title: new Text(new Y.Text(translateKey(this.std, ...FRAME_SEED_NAME, {
55
55
  n: frames.length + 1,
56
56
  }))),
@@ -1,5 +1,5 @@
1
1
  import { EdgelessCRUDIdentifier } from '../affine-block-surface/index.js';
2
- import { packColor, } from '../affine-components/color-picker/index.js';
2
+ import { frameworkPaletteGroups, packColor, } from '../affine-components/color-picker/index.js';
3
3
  import { toast } from '../affine-components/toast/index.js';
4
4
  import { DEFAULT_NOTE_HEIGHT, DefaultTheme, FrameBlockModel, FrameBlockSchema, NoteBlockModel, NoteBlockSchema, NoteDisplayMode, resolveColor, SurfaceRefBlockSchema, } from '../affine-model/index.js';
5
5
  import { NotificationProvider, TOAST_FRAME_INSERTED_INTO_PAGE, TOOLBAR_RENAME, ToolbarModuleExtension, translateKey, } from '../affine-shared/services/index.js';
@@ -135,6 +135,9 @@ const builtinSurfaceToolbarConfig = {
135
135
  break;
136
136
  }
137
137
  };
138
+ // A frame drawn over a framework board opens on that framework's hues
139
+ // (`docs/adr/0027`); the editor palette stays page one.
140
+ const carousel = frameworkPaletteGroups(ctx.std, models, DefaultTheme.Palettes);
138
141
  return html `
139
142
  <edgeless-color-picker-button
140
143
  class="background"
@@ -144,6 +147,8 @@ const builtinSurfaceToolbarConfig = {
144
147
  .theme=${theme}
145
148
  .std=${ctx.std}
146
149
  .originalColor=${firstModel.props.background}
150
+ .paletteGroups=${carousel.groups}
151
+ .activeGroupKey=${carousel.activeKey}
147
152
  .enableCustomColor=${enableCustomColor}
148
153
  >
149
154
  </edgeless-color-picker-button>
@@ -1,6 +1,7 @@
1
1
  import { textKeymap } from '../affine-inline-preset/index.js';
2
2
  import { ListBlockSchema } from '../affine-model/index.js';
3
3
  import { getSelectedModelsCommand } from '../affine-shared/commands/index.js';
4
+ import { isNativeFocusableTarget } from '../affine-shared/utils/index.js';
4
5
  import { IS_MAC } from '../global/env/index.js';
5
6
  import { KeymapExtension, TextSelection } from '../std/index.js';
6
7
  import { canDedentListCommand, dedentListCommand, } from './commands/dedent-list.js';
@@ -11,6 +12,8 @@ import { forwardDelete } from './utils/forward-delete.js';
11
12
  export const ListKeymapExtension = KeymapExtension(std => {
12
13
  return {
13
14
  Enter: ctx => {
15
+ if (isNativeFocusableTarget(ctx.get('keyboardState').raw.target))
16
+ return;
14
17
  const text = std.selection.find(TextSelection);
15
18
  if (!text)
16
19
  return false;
@@ -39,6 +42,8 @@ export const ListKeymapExtension = KeymapExtension(std => {
39
42
  return true;
40
43
  },
41
44
  Tab: ctx => {
45
+ if (isNativeFocusableTarget(ctx.get('keyboardState').raw.target))
46
+ return;
42
47
  const [_, { selectedModels }] = std.command
43
48
  .chain()
44
49
  .pipe(getSelectedModelsCommand, {
@@ -63,6 +68,8 @@ export const ListKeymapExtension = KeymapExtension(std => {
63
68
  return true;
64
69
  },
65
70
  'Shift-Tab': ctx => {
71
+ if (isNativeFocusableTarget(ctx.get('keyboardState').raw.target))
72
+ return;
66
73
  const [_, { selectedModels }] = std.command
67
74
  .chain()
68
75
  .pipe(getSelectedModelsCommand, {
@@ -42,7 +42,9 @@ export function getListIcon(model, showChildren, onClick) {
42
42
  @click=${onClick}
43
43
  >
44
44
  ${model.props.checked
45
- ? CheckBoxCheckSolidIcon({ style: 'color: #1E96EB' })
45
+ ? CheckBoxCheckSolidIcon({
46
+ style: 'color: var(--affine-primary-color)',
47
+ })
46
48
  : CheckBoxUnIcon()}
47
49
  </div>`;
48
50
  case 'toggle':
@@ -262,7 +262,7 @@ export const TodoTooltip = html `<svg width="170" height="68" viewBox="0 0 170 6
262
262
  <g mask="url(#mask0_5604_203551)">
263
263
  <path fill-rule="evenodd" clip-rule="evenodd" d="M13.6667 19C12.7462 19 12 19.7462 12 20.6667V27.3333C12 28.2538 12.7462 29 13.6667 29H20.3333C21.2538 29 22 28.2538 22 27.3333V20.6667C22 19.7462 21.2538 19 20.3333 19H13.6667ZM12.9091 20.6667C12.9091 20.2483 13.2483 19.9091 13.6667 19.9091H20.3333C20.7517 19.9091 21.0909 20.2483 21.0909 20.6667V27.3333C21.0909 27.7517 20.7517 28.0909 20.3333 28.0909H13.6667C13.2483 28.0909 12.9091 27.7517 12.9091 27.3333V20.6667Z" fill="#77757D"/>
264
264
  <rect x="28" y="20.1364" width="142" height="8" rx="4" fill="#121212" fill-opacity="0.3"/>
265
- <path fill-rule="evenodd" clip-rule="evenodd" d="M12 40.6667C12 39.7462 12.7462 39 13.6667 39H20.3333C21.2538 39 22 39.7462 22 40.6667V47.3333C22 48.2538 21.2538 49 20.3333 49H13.6667C12.7462 49 12 48.2538 12 47.3333V40.6667ZM19.7457 42.5032C19.9232 42.3257 19.9232 42.0379 19.7457 41.8604C19.5681 41.6829 19.2803 41.6829 19.1028 41.8604L16.0909 44.8723L15.2002 43.9816C15.0227 43.8041 14.7349 43.8041 14.5574 43.9816C14.3799 44.1591 14.3799 44.4469 14.5574 44.6244L15.7695 45.8366C15.947 46.0141 16.2348 46.0141 16.4123 45.8366L19.7457 42.5032Z" fill="#1E96EB"/>
265
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 40.6667C12 39.7462 12.7462 39 13.6667 39H20.3333C21.2538 39 22 39.7462 22 40.6667V47.3333C22 48.2538 21.2538 49 20.3333 49H13.6667C12.7462 49 12 48.2538 12 47.3333V40.6667ZM19.7457 42.5032C19.9232 42.3257 19.9232 42.0379 19.7457 41.8604C19.5681 41.6829 19.2803 41.6829 19.1028 41.8604L16.0909 44.8723L15.2002 43.9816C15.0227 43.8041 14.7349 43.8041 14.5574 43.9816C14.3799 44.1591 14.3799 44.4469 14.5574 44.6244L15.7695 45.8366C15.947 46.0141 16.2348 46.0141 16.4123 45.8366L19.7457 42.5032Z" fill="var(--affine-primary-color)"/>
266
266
  <rect x="28" y="40.1364" width="142" height="8" rx="4" fill="#8E8D91" fill-opacity="0.55"/>
267
267
  </g>
268
268
  </svg>
@@ -1,7 +1,7 @@
1
1
  import { CodeBlockModel, ListBlockModel, NoteBlockModel, NoteBlockSchema, ParagraphBlockModel, } from '../affine-model/index.js';
2
2
  import { textConversionConfigs } from '../affine-rich-text/index.js';
3
3
  import { focusBlockEnd, focusBlockStart, getBlockSelectionsCommand, getNextBlockCommand, getPrevBlockCommand, getTextSelectionCommand, } from '../affine-shared/commands/index.js';
4
- import { asyncGetBlockComponent, matchModels, } from '../affine-shared/utils/index.js';
4
+ import { asyncGetBlockComponent, isNativeFocusableTarget, matchModels, } from '../affine-shared/utils/index.js';
5
5
  import { BlockSelection, KeymapExtension, TextSelection, } from '../std/index.js';
6
6
  import { dedentBlocks, dedentBlocksToRoot, indentBlocks, selectBlock, selectBlocksBetween, updateBlockType, } from './commands/index.js';
7
7
  import { moveBlockConfigs } from './move-block.js';
@@ -338,6 +338,8 @@ class NoteKeymap {
338
338
  };
339
339
  this._onEnter = (ctx) => {
340
340
  const event = ctx.get('defaultState').event;
341
+ if (isNativeFocusableTarget(event.target))
342
+ return;
341
343
  const [result] = this._std.command
342
344
  .chain()
343
345
  .pipe(getBlockSelectionsCommand)
@@ -448,6 +450,8 @@ class NoteKeymap {
448
450
  ...this._bindQuickActionHotKey(),
449
451
  ...this._bindTextConversionHotKey(),
450
452
  Tab: ctx => {
453
+ if (isNativeFocusableTarget(ctx.get('keyboardState').raw.target))
454
+ return;
451
455
  const [success] = this.std.command.exec(indentBlocks);
452
456
  if (!success)
453
457
  return;
@@ -455,6 +459,8 @@ class NoteKeymap {
455
459
  return true;
456
460
  },
457
461
  'Shift-Tab': ctx => {
462
+ if (isNativeFocusableTarget(ctx.get('keyboardState').raw.target))
463
+ return;
458
464
  const [success] = this.std.command.exec(dedentBlocks);
459
465
  if (!success)
460
466
  return;
@@ -1,7 +1,7 @@
1
1
  import { textKeymap } from '../affine-inline-preset/index.js';
2
2
  import { CalloutBlockModel, ParagraphBlockModel, ParagraphBlockSchema, } from '../affine-model/index.js';
3
3
  import { focusTextModel, getInlineEditorByModel, } from '../affine-rich-text/index.js';
4
- import { calculateCollapsedSiblings, matchModels, } from '../affine-shared/utils/index.js';
4
+ import { calculateCollapsedSiblings, isNativeFocusableTarget, matchModels, } from '../affine-shared/utils/index.js';
5
5
  import { IS_MAC } from '../global/env/index.js';
6
6
  import { KeymapExtension, TextSelection } from '../std/index.js';
7
7
  import { addParagraphCommand } from './commands/add-paragraph.js';
@@ -76,6 +76,8 @@ export const ParagraphKeymapExtension = KeymapExtension(std => {
76
76
  return true;
77
77
  },
78
78
  Enter: ctx => {
79
+ if (isNativeFocusableTarget(ctx.get('keyboardState').raw.target))
80
+ return;
79
81
  const { store } = std;
80
82
  const text = std.selection.find(TextSelection);
81
83
  if (!text)
@@ -157,6 +159,8 @@ export const ParagraphKeymapExtension = KeymapExtension(std => {
157
159
  return true;
158
160
  },
159
161
  Tab: ctx => {
162
+ if (isNativeFocusableTarget(ctx.get('keyboardState').raw.target))
163
+ return;
160
164
  const [success] = std.command
161
165
  .chain()
162
166
  .pipe(canIndentParagraphCommand)
@@ -169,6 +173,8 @@ export const ParagraphKeymapExtension = KeymapExtension(std => {
169
173
  return true;
170
174
  },
171
175
  'Shift-Tab': ctx => {
176
+ if (isNativeFocusableTarget(ctx.get('keyboardState').raw.target))
177
+ return;
172
178
  const [success] = std.command
173
179
  .chain()
174
180
  .pipe(canDedentParagraphCommand)
@@ -49,7 +49,7 @@ export const rootBlockHtmlAdapterMatcher = {
49
49
  display: none;
50
50
  }
51
51
  label:before {
52
- background: rgb(30, 150, 235);
52
+ background: var(--affine-primary-color, rgb(30, 150, 235));
53
53
  border-radius: 3px;
54
54
  height: 16px;
55
55
  width: 16px;
@@ -58,7 +58,7 @@ export const rootBlockHtmlAdapterMatcher = {
58
58
  }
59
59
  input[type='checkbox'] + label:before {
60
60
  content: '';
61
- background: rgb(30, 150, 235);
61
+ background: var(--affine-primary-color, rgb(30, 150, 235));
62
62
  color: #fff;
63
63
  font-size: 16px;
64
64
  line-height: 16px;
@@ -0,0 +1,2 @@
1
+ import { type AnyCommandDescriptor } from '../../std/index.js';
2
+ export declare const copyLinkCommands: AnyCommandDescriptor[];