@formicoidea/labre-core 0.41.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) 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-edgeless-text/edgeless-toolbar/config.js +7 -1
  4. package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +2 -1
  5. package/dist/_pkgs/affine-block-embed/embed-github-block/embed-github-block.js +2 -1
  6. package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.d.ts +2 -0
  7. package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +5 -0
  8. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +1 -0
  9. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +30 -8
  10. package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.d.ts +8 -0
  11. package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.js +19 -0
  12. package/dist/_pkgs/affine-block-embed/embed-loom-block/embed-loom-block.js +2 -1
  13. package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +2 -1
  14. package/dist/_pkgs/affine-block-frame/frame-manager.js +1 -1
  15. package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
  16. package/dist/_pkgs/affine-block-frame/frame-toolbar.js +6 -1
  17. package/dist/_pkgs/affine-block-list/list-keymap.js +7 -0
  18. package/dist/_pkgs/affine-block-note/note-keymap.js +7 -1
  19. package/dist/_pkgs/affine-block-paragraph/paragraph-keymap.js +7 -1
  20. package/dist/_pkgs/affine-block-root/commands/pivot-commands.js +1 -8
  21. package/dist/_pkgs/affine-block-root/commands/tag-commands.js +1 -8
  22. package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.d.ts +9 -0
  23. package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +51 -0
  24. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +22 -0
  25. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +46 -0
  26. package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.d.ts +21 -0
  27. package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.js +24 -0
  28. package/dist/_pkgs/affine-block-root/edgeless/utils/query.js +8 -0
  29. package/dist/_pkgs/affine-block-root/keyboard/keymap.js +1 -16
  30. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +21 -3
  31. package/dist/_pkgs/affine-block-surface/element-model/index.js +14 -2
  32. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +23 -0
  33. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +89 -0
  34. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +7 -0
  35. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +5 -0
  36. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +41 -0
  37. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +70 -0
  38. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +49 -0
  39. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +257 -0
  40. package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.d.ts +16 -0
  41. package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.js +24 -0
  42. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +24 -0
  43. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +66 -0
  44. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +4 -0
  45. package/dist/_pkgs/affine-block-surface/extensions/index.js +4 -0
  46. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +66 -4
  47. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +241 -11
  48. package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +18 -0
  49. package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.d.ts +81 -0
  50. package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.js +81 -0
  51. package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +136 -0
  52. package/dist/_pkgs/affine-block-surface/extensions/legend.js +439 -0
  53. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +17 -3
  54. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +35 -13
  55. package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +61 -1
  56. package/dist/_pkgs/affine-block-surface/extensions/reading.js +85 -39
  57. package/dist/_pkgs/affine-block-surface/extensions/record-action.d.ts +66 -0
  58. package/dist/_pkgs/affine-block-surface/extensions/record-action.js +145 -0
  59. package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +253 -28
  60. package/dist/_pkgs/affine-block-surface/extensions/validation.js +489 -41
  61. package/dist/_pkgs/affine-block-surface/framework-background/background-view.d.ts +115 -0
  62. package/dist/_pkgs/affine-block-surface/framework-background/background-view.js +185 -0
  63. package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +1 -0
  64. package/dist/_pkgs/affine-block-surface/framework-background/index.js +1 -0
  65. package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +16 -1
  66. package/dist/_pkgs/affine-block-surface/framework-background/labels.js +31 -21
  67. package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +29 -5
  68. package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +6 -4
  69. package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +56 -8
  70. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +12 -0
  71. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +15 -0
  72. package/dist/_pkgs/affine-block-surface/view.js +8 -1
  73. package/dist/_pkgs/affine-block-surface-ref/configs/slash-menu.js +1 -1
  74. package/dist/_pkgs/affine-components/color-picker/button.d.ts +56 -1
  75. package/dist/_pkgs/affine-components/color-picker/button.js +168 -23
  76. package/dist/_pkgs/affine-components/color-picker/framework-palette.d.ts +106 -0
  77. package/dist/_pkgs/affine-components/color-picker/framework-palette.js +177 -0
  78. package/dist/_pkgs/affine-components/color-picker/index.d.ts +2 -0
  79. package/dist/_pkgs/affine-components/color-picker/index.js +2 -0
  80. package/dist/_pkgs/affine-components/color-picker/palette-carousel.d.ts +85 -0
  81. package/dist/_pkgs/affine-components/color-picker/palette-carousel.js +440 -0
  82. package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.d.ts +31 -1
  83. package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +189 -63
  84. package/dist/_pkgs/affine-components/resource/resource.js +29 -16
  85. package/dist/_pkgs/affine-components/translations.d.ts +8 -0
  86. package/dist/_pkgs/affine-components/translations.js +17 -0
  87. package/dist/_pkgs/affine-foundation/view.js +2 -1
  88. package/dist/_pkgs/affine-gfx-brush/element-renderer.js +2 -2
  89. package/dist/_pkgs/affine-gfx-brush/toolbar/configs/brush.js +6 -1
  90. package/dist/_pkgs/affine-gfx-brush/toolbar/configs/highlighter.js +6 -1
  91. package/dist/_pkgs/affine-gfx-connector/connector-manager.d.ts +9 -1
  92. package/dist/_pkgs/affine-gfx-connector/connector-manager.js +61 -0
  93. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.d.ts +7 -1
  94. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +87 -17
  95. package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +78 -17
  96. package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.d.ts +24 -2
  97. package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +31 -8
  98. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.d.ts +124 -3
  99. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +216 -54
  100. package/dist/_pkgs/affine-gfx-connector/text/text.d.ts +13 -4
  101. package/dist/_pkgs/affine-gfx-connector/text/text.js +13 -44
  102. package/dist/_pkgs/affine-gfx-connector/toolbar/config.d.ts +56 -0
  103. package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +72 -4
  104. package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.d.ts +8 -0
  105. package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.js +118 -0
  106. package/dist/_pkgs/affine-gfx-connector/view/view.d.ts +37 -1
  107. package/dist/_pkgs/affine-gfx-connector/view/view.js +97 -8
  108. package/dist/_pkgs/affine-gfx-group/command/group-api.js +1 -1
  109. package/dist/_pkgs/affine-gfx-group/store.js +0 -2
  110. package/dist/_pkgs/affine-gfx-group/translations.d.ts +9 -10
  111. package/dist/_pkgs/affine-gfx-group/translations.js +9 -13
  112. package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +1 -1
  113. package/dist/_pkgs/affine-gfx-mindmap/toolbar/basket-elements.js +1 -1
  114. package/dist/_pkgs/affine-gfx-mindmap/toolbar/utils/import-mindmap.js +2 -2
  115. package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +1 -1
  116. package/dist/_pkgs/affine-gfx-mindmap/translations.js +1 -1
  117. package/dist/_pkgs/affine-gfx-shape/element-renderer/highlighter.js +2 -2
  118. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.d.ts +6 -0
  119. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +30 -1
  120. package/dist/_pkgs/affine-gfx-shape/polygon-tool.d.ts +20 -1
  121. package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +9 -1
  122. package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +6 -1
  123. package/dist/_pkgs/affine-gfx-shape/toolbar/palette-color-action.js +11 -1
  124. package/dist/_pkgs/affine-gfx-template/builtin/other.js +1 -1
  125. package/dist/_pkgs/affine-gfx-template/snapshot-from-action.js +32 -119
  126. package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +1 -1
  127. package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.d.ts +13 -1
  128. package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.js +19 -4
  129. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.d.ts +41 -0
  130. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +57 -2
  131. package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +8 -1
  132. package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +12 -2
  133. package/dist/_pkgs/affine-gfx-text/translations.d.ts +1 -0
  134. package/dist/_pkgs/affine-gfx-text/translations.js +2 -1
  135. package/dist/_pkgs/affine-inline-preset/markdown.js +5 -1
  136. package/dist/_pkgs/affine-model/consts/connector.d.ts +28 -2
  137. package/dist/_pkgs/affine-model/consts/connector.js +26 -0
  138. package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -1
  139. package/dist/_pkgs/affine-model/elements/brush/brush.js +1 -1
  140. package/dist/_pkgs/affine-model/elements/c4/board.js +1 -1
  141. package/dist/_pkgs/affine-model/elements/c4/boundary.js +1 -1
  142. package/dist/_pkgs/affine-model/elements/connector/connector.d.ts +135 -0
  143. package/dist/_pkgs/affine-model/elements/connector/connector.js +246 -5
  144. package/dist/_pkgs/affine-model/elements/connector/end-label.d.ts +83 -0
  145. package/dist/_pkgs/affine-model/elements/connector/end-label.js +119 -0
  146. package/dist/_pkgs/affine-model/elements/connector/index.d.ts +1 -0
  147. package/dist/_pkgs/affine-model/elements/connector/index.js +1 -0
  148. package/dist/_pkgs/affine-model/elements/context-map/context-map.js +1 -1
  149. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +28 -0
  150. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +129 -2
  151. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.d.ts +8 -0
  152. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +45 -2
  153. package/dist/_pkgs/affine-model/elements/edgy/board.js +1 -1
  154. package/dist/_pkgs/affine-model/elements/edgy/facets.js +1 -1
  155. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +6 -0
  156. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +36 -2
  157. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +18 -7
  158. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +23 -8
  159. package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +16 -0
  160. package/dist/_pkgs/affine-model/elements/framework-background/background.js +18 -0
  161. package/dist/_pkgs/affine-model/elements/highlighter/highlighter.js +1 -1
  162. package/dist/_pkgs/affine-model/elements/index.d.ts +8 -0
  163. package/dist/_pkgs/affine-model/elements/index.js +1 -0
  164. package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -1
  165. package/dist/_pkgs/affine-model/elements/text/text.js +1 -1
  166. package/dist/_pkgs/affine-model/elements/uml/band.d.ts +39 -0
  167. package/dist/_pkgs/affine-model/elements/uml/band.js +31 -0
  168. package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +158 -0
  169. package/dist/_pkgs/affine-model/elements/uml/diagram.js +229 -0
  170. package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +161 -0
  171. package/dist/_pkgs/affine-model/elements/uml/fragment.js +205 -0
  172. package/dist/_pkgs/affine-model/elements/uml/index.d.ts +8 -0
  173. package/dist/_pkgs/affine-model/elements/uml/index.js +8 -0
  174. package/dist/_pkgs/affine-model/elements/uml/lifeline.d.ts +77 -0
  175. package/dist/_pkgs/affine-model/elements/uml/lifeline.js +89 -0
  176. package/dist/_pkgs/affine-model/elements/uml/node.d.ts +142 -0
  177. package/dist/_pkgs/affine-model/elements/uml/node.js +190 -0
  178. package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +106 -0
  179. package/dist/_pkgs/affine-model/elements/uml/partition.js +172 -0
  180. package/dist/_pkgs/affine-model/elements/uml/region.d.ts +75 -0
  181. package/dist/_pkgs/affine-model/elements/uml/region.js +150 -0
  182. package/dist/_pkgs/affine-model/elements/uml/subject.d.ts +37 -0
  183. package/dist/_pkgs/affine-model/elements/uml/subject.js +108 -0
  184. package/dist/_pkgs/affine-model/elements/wardley/wardley.js +1 -1
  185. package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.d.ts +1 -0
  186. package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +7 -0
  187. package/dist/_pkgs/affine-shared/services/font-loader/config.js +43 -0
  188. package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +1 -9
  189. package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.d.ts +53 -0
  190. package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.js +95 -0
  191. package/dist/_pkgs/affine-shared/services/telemetry-service/index.d.ts +1 -0
  192. package/dist/_pkgs/affine-shared/services/telemetry-service/index.js +1 -0
  193. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +26 -1
  194. package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
  195. package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.d.ts +34 -0
  196. package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.js +63 -0
  197. package/dist/_pkgs/affine-shared/services/toolbar-service/index.d.ts +1 -0
  198. package/dist/_pkgs/affine-shared/services/toolbar-service/index.js +1 -0
  199. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +77 -7
  200. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +97 -7
  201. package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
  202. package/dist/_pkgs/affine-shared/styles/index.js +1 -0
  203. package/dist/_pkgs/affine-shared/styles/motion.d.ts +14 -0
  204. package/dist/_pkgs/affine-shared/styles/motion.js +38 -0
  205. package/dist/_pkgs/affine-shared/utils/event.d.ts +10 -0
  206. package/dist/_pkgs/affine-shared/utils/event.js +20 -0
  207. package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +16 -0
  208. package/dist/_pkgs/affine-shared/utils/file/filesys.js +25 -0
  209. package/dist/_pkgs/affine-shared/utils/index.d.ts +1 -0
  210. package/dist/_pkgs/affine-shared/utils/index.js +1 -0
  211. package/dist/_pkgs/affine-shared/utils/link-preview-refresh.d.ts +12 -0
  212. package/dist/_pkgs/affine-shared/utils/link-preview-refresh.js +13 -0
  213. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +12 -4
  214. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +27 -4
  215. package/dist/_pkgs/affine-widget-edgeless-toolbar/create-popper.js +13 -0
  216. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +2 -0
  217. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +2 -0
  218. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +80 -0
  219. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +270 -81
  220. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.d.ts +15 -0
  221. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.js +15 -0
  222. package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-weight-and-style-panel.js +8 -1
  223. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.d.ts +42 -0
  224. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.js +100 -0
  225. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.d.ts +100 -0
  226. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.js +274 -0
  227. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.d.ts +3 -0
  228. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.js +3 -0
  229. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.d.ts +25 -0
  230. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.js +67 -0
  231. package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +5 -0
  232. package/dist/_pkgs/global/gfx/xywh.js +7 -0
  233. package/dist/_pkgs/std/extension/command-registry.d.ts +158 -1
  234. package/dist/_pkgs/std/extension/command-registry.js +22 -0
  235. package/dist/_pkgs/std/gfx/index.d.ts +1 -1
  236. package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.d.ts +12 -0
  237. package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +20 -1
  238. package/dist/_pkgs/std/gfx/interactivity/manager.d.ts +10 -0
  239. package/dist/_pkgs/std/gfx/interactivity/manager.js +12 -0
  240. package/dist/_pkgs/std/gfx/model/surface/element-model.js +12 -7
  241. package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +56 -0
  242. package/dist/_pkgs/std/gfx/model/surface/surface-model.js +84 -3
  243. package/dist/_pkgs/std/gfx/view/view.d.ts +11 -2
  244. package/dist/_pkgs/std/gfx/view/view.js +16 -2
  245. package/dist/commands.d.ts +6 -0
  246. package/dist/commands.js +8 -1
  247. package/dist/frameworks.d.ts +9 -0
  248. package/dist/frameworks.js +19 -0
  249. package/dist/translations.js +16 -0
  250. package/package.json +9 -4
  251. package/dist/_pkgs/affine-gfx-group/group-watcher.d.ts +0 -1
  252. package/dist/_pkgs/affine-gfx-group/group-watcher.js +0 -20
package/LICENSE ADDED
@@ -0,0 +1,384 @@
1
+ # Mozilla Public License Version 2.0
2
+
3
+ Copyright (c) TOEVERYTHING PTE. LTD. and its affiliates.
4
+
5
+ 1. Definitions
6
+
7
+ ---
8
+
9
+ 1.1. "Contributor"
10
+ means each individual or legal entity that creates, contributes to
11
+ the creation of, or owns Covered Software.
12
+
13
+ 1.2. "Contributor Version"
14
+ means the combination of the Contributions of others (if any) used
15
+ by a Contributor and that particular Contributor's Contribution.
16
+
17
+ 1.3. "Contribution"
18
+ means Covered Software of a particular Contributor.
19
+
20
+ 1.4. "Covered Software"
21
+ means Source Code Form to which the initial Contributor has attached
22
+ the notice in Exhibit A, the Executable Form of such Source Code
23
+ Form, and Modifications of such Source Code Form, in each case
24
+ including portions thereof.
25
+
26
+ 1.5. "Incompatible With Secondary Licenses"
27
+ means
28
+
29
+ (a) that the initial Contributor has attached the notice described
30
+ in Exhibit B to the Covered Software; or
31
+
32
+ (b) that the Covered Software was made available under the terms of
33
+ version 1.1 or earlier of the License, but not also under the
34
+ terms of a Secondary License.
35
+
36
+ 1.6. "Executable Form"
37
+ means any form of the work other than Source Code Form.
38
+
39
+ 1.7. "Larger Work"
40
+ means a work that combines Covered Software with other material, in
41
+ a separate file or files, that is not Covered Software.
42
+
43
+ 1.8. "License"
44
+ means this document.
45
+
46
+ 1.9. "Licensable"
47
+ means having the right to grant, to the maximum extent possible,
48
+ whether at the time of the initial grant or subsequently, any and
49
+ all of the rights conveyed by this License.
50
+
51
+ 1.10. "Modifications"
52
+ means any of the following:
53
+
54
+ (a) any file in Source Code Form that results from an addition to,
55
+ deletion from, or modification of the contents of Covered
56
+ Software; or
57
+
58
+ (b) any new file in Source Code Form that contains any Covered
59
+ Software.
60
+
61
+ 1.11. "Patent Claims" of a Contributor
62
+ means any patent claim(s), including without limitation, method,
63
+ process, and apparatus claims, in any patent Licensable by such
64
+ Contributor that would be infringed, but for the grant of the
65
+ License, by the making, using, selling, offering for sale, having
66
+ made, import, or transfer of either its Contributions or its
67
+ Contributor Version.
68
+
69
+ 1.12. "Secondary License"
70
+ means either the GNU General Public License, Version 2.0, the GNU
71
+ Lesser General Public License, Version 2.1, the GNU Affero General
72
+ Public License, Version 3.0, or any later versions of those
73
+ licenses.
74
+
75
+ 1.13. "Source Code Form"
76
+ means the form of the work preferred for making modifications.
77
+
78
+ 1.14. "You" (or "Your")
79
+ means an individual or a legal entity exercising rights under this
80
+ License. For legal entities, "You" includes any entity that
81
+ controls, is controlled by, or is under common control with You. For
82
+ purposes of this definition, "control" means (a) the power, direct
83
+ or indirect, to cause the direction or management of such entity,
84
+ whether by contract or otherwise, or (b) ownership of more than
85
+ fifty percent (50%) of the outstanding shares or beneficial
86
+ ownership of such entity.
87
+
88
+ 2. License Grants and Conditions
89
+
90
+ ---
91
+
92
+ 2.1. Grants
93
+
94
+ Each Contributor hereby grants You a world-wide, royalty-free,
95
+ non-exclusive license:
96
+
97
+ (a) under intellectual property rights (other than patent or trademark)
98
+ Licensable by such Contributor to use, reproduce, make available,
99
+ modify, display, perform, distribute, and otherwise exploit its
100
+ Contributions, either on an unmodified basis, with Modifications, or
101
+ as part of a Larger Work; and
102
+
103
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
104
+ for sale, have made, import, and otherwise transfer either its
105
+ Contributions or its Contributor Version.
106
+
107
+ 2.2. Effective Date
108
+
109
+ The licenses granted in Section 2.1 with respect to any Contribution
110
+ become effective for each Contribution on the date the Contributor first
111
+ distributes such Contribution.
112
+
113
+ 2.3. Limitations on Grant Scope
114
+
115
+ The licenses granted in this Section 2 are the only rights granted under
116
+ this License. No additional rights or licenses will be implied from the
117
+ distribution or licensing of Covered Software under this License.
118
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
119
+ Contributor:
120
+
121
+ (a) for any code that a Contributor has removed from Covered Software;
122
+ or
123
+
124
+ (b) for infringements caused by: (i) Your and any other third party's
125
+ modifications of Covered Software, or (ii) the combination of its
126
+ Contributions with other software (except as part of its Contributor
127
+ Version); or
128
+
129
+ (c) under Patent Claims infringed by Covered Software in the absence of
130
+ its Contributions.
131
+
132
+ This License does not grant any rights in the trademarks, service marks,
133
+ or logos of any Contributor (except as may be necessary to comply with
134
+ the notice requirements in Section 3.4).
135
+
136
+ 2.4. Subsequent Licenses
137
+
138
+ No Contributor makes additional grants as a result of Your choice to
139
+ distribute the Covered Software under a subsequent version of this
140
+ License (see Section 10.2) or under the terms of a Secondary License (if
141
+ permitted under the terms of Section 3.3).
142
+
143
+ 2.5. Representation
144
+
145
+ Each Contributor represents that the Contributor believes its
146
+ Contributions are its original creation(s) or it has sufficient rights
147
+ to grant the rights to its Contributions conveyed by this License.
148
+
149
+ 2.6. Fair Use
150
+
151
+ This License is not intended to limit any rights You have under
152
+ applicable copyright doctrines of fair use, fair dealing, or other
153
+ equivalents.
154
+
155
+ 2.7. Conditions
156
+
157
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
158
+ in Section 2.1.
159
+
160
+ 3. Responsibilities
161
+
162
+ ---
163
+
164
+ 3.1. Distribution of Source Form
165
+
166
+ All distribution of Covered Software in Source Code Form, including any
167
+ Modifications that You create or to which You contribute, must be under
168
+ the terms of this License. You must inform recipients that the Source
169
+ Code Form of the Covered Software is governed by the terms of this
170
+ License, and how they can obtain a copy of this License. You may not
171
+ attempt to alter or restrict the recipients' rights in the Source Code
172
+ Form.
173
+
174
+ 3.2. Distribution of Executable Form
175
+
176
+ If You distribute Covered Software in Executable Form then:
177
+
178
+ (a) such Covered Software must also be made available in Source Code
179
+ Form, as described in Section 3.1, and You must inform recipients of
180
+ the Executable Form how they can obtain a copy of such Source Code
181
+ Form by reasonable means in a timely manner, at a charge no more
182
+ than the cost of distribution to the recipient; and
183
+
184
+ (b) You may distribute such Executable Form under the terms of this
185
+ License, or sublicense it under different terms, provided that the
186
+ license for the Executable Form does not attempt to limit or alter
187
+ the recipients' rights in the Source Code Form under this License.
188
+
189
+ 3.3. Distribution of a Larger Work
190
+
191
+ You may create and distribute a Larger Work under terms of Your choice,
192
+ provided that You also comply with the requirements of this License for
193
+ the Covered Software. If the Larger Work is a combination of Covered
194
+ Software with a work governed by one or more Secondary Licenses, and the
195
+ Covered Software is not Incompatible With Secondary Licenses, this
196
+ License permits You to additionally distribute such Covered Software
197
+ under the terms of such Secondary License(s), so that the recipient of
198
+ the Larger Work may, at their option, further distribute the Covered
199
+ Software under the terms of either this License or such Secondary
200
+ License(s).
201
+
202
+ 3.4. Notices
203
+
204
+ You may not remove or alter the substance of any license notices
205
+ (including copyright notices, patent notices, disclaimers of warranty,
206
+ or limitations of liability) contained within the Source Code Form of
207
+ the Covered Software, except that You may alter any license notices to
208
+ the extent required to remedy known factual inaccuracies.
209
+
210
+ 3.5. Application of Additional Terms
211
+
212
+ You may choose to offer, and to charge a fee for, warranty, support,
213
+ indemnity or liability obligations to one or more recipients of Covered
214
+ Software. However, You may do so only on Your own behalf, and not on
215
+ behalf of any Contributor. You must make it absolutely clear that any
216
+ such warranty, support, indemnity, or liability obligation is offered by
217
+ You alone, and You hereby agree to indemnify every Contributor for any
218
+ liability incurred by such Contributor as a result of warranty, support,
219
+ indemnity or liability terms You offer. You may include additional
220
+ disclaimers of warranty and limitations of liability specific to any
221
+ jurisdiction.
222
+
223
+ 4. Inability to Comply Due to Statute or Regulation
224
+
225
+ ---
226
+
227
+ If it is impossible for You to comply with any of the terms of this
228
+ License with respect to some or all of the Covered Software due to
229
+ statute, judicial order, or regulation then You must: (a) comply with
230
+ the terms of this License to the maximum extent possible; and (b)
231
+ describe the limitations and the code they affect. Such description must
232
+ be placed in a text file included with all distributions of the Covered
233
+ Software under this License. Except to the extent prohibited by statute
234
+ or regulation, such description must be sufficiently detailed for a
235
+ recipient of ordinary skill to be able to understand it.
236
+
237
+ 5. Termination
238
+
239
+ ---
240
+
241
+ 5.1. The rights granted under this License will terminate automatically
242
+ if You fail to comply with any of its terms. However, if You become
243
+ compliant, then the rights granted under this License from a particular
244
+ Contributor are reinstated (a) provisionally, unless and until such
245
+ Contributor explicitly and finally terminates Your grants, and (b) on an
246
+ ongoing basis, if such Contributor fails to notify You of the
247
+ non-compliance by some reasonable means prior to 60 days after You have
248
+ come back into compliance. Moreover, Your grants from a particular
249
+ Contributor are reinstated on an ongoing basis if such Contributor
250
+ notifies You of the non-compliance by some reasonable means, this is the
251
+ first time You have received notice of non-compliance with this License
252
+ from such Contributor, and You become compliant prior to 30 days after
253
+ Your receipt of the notice.
254
+
255
+ 5.2. If You initiate litigation against any entity by asserting a patent
256
+ infringement claim (excluding declaratory judgment actions,
257
+ counter-claims, and cross-claims) alleging that a Contributor Version
258
+ directly or indirectly infringes any patent, then the rights granted to
259
+ You by any and all Contributors for the Covered Software under Section
260
+ 2.1 of this License shall terminate.
261
+
262
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
263
+ end user license agreements (excluding distributors and resellers) which
264
+ have been validly granted by You or Your distributors under this License
265
+ prior to termination shall survive termination.
266
+
267
+ ---
268
+
269
+ - *
270
+ - 6. Disclaimer of Warranty \*
271
+ - ------------------------- \*
272
+ - *
273
+ - Covered Software is provided under this License on an "as is" \*
274
+ - basis, without warranty of any kind, either expressed, implied, or \*
275
+ - statutory, including, without limitation, warranties that the \*
276
+ - Covered Software is free of defects, merchantable, fit for a \*
277
+ - particular purpose or non-infringing. The entire risk as to the \*
278
+ - quality and performance of the Covered Software is with You. \*
279
+ - Should any Covered Software prove defective in any respect, You \*
280
+ - (not any Contributor) assume the cost of any necessary servicing, \*
281
+ - repair, or correction. This disclaimer of warranty constitutes an \*
282
+ - essential part of this License. No use of any Covered Software is \*
283
+ - authorized under this License except under this disclaimer. \*
284
+ - *
285
+
286
+ ---
287
+
288
+ ---
289
+
290
+ - *
291
+ - 7. Limitation of Liability \*
292
+ - -------------------------- \*
293
+ - *
294
+ - Under no circumstances and under no legal theory, whether tort \*
295
+ - (including negligence), contract, or otherwise, shall any \*
296
+ - Contributor, or anyone who distributes Covered Software as \*
297
+ - permitted above, be liable to You for any direct, indirect, \*
298
+ - special, incidental, or consequential damages of any character \*
299
+ - including, without limitation, damages for lost profits, loss of \*
300
+ - goodwill, work stoppage, computer failure or malfunction, or any \*
301
+ - and all other commercial damages or losses, even if such party \*
302
+ - shall have been informed of the possibility of such damages. This \*
303
+ - limitation of liability shall not apply to liability for death or \*
304
+ - personal injury resulting from such party's negligence to the \*
305
+ - extent applicable law prohibits such limitation. Some \*
306
+ - jurisdictions do not allow the exclusion or limitation of \*
307
+ - incidental or consequential damages, so this exclusion and \*
308
+ - limitation may not apply to You. \*
309
+ - *
310
+
311
+ ---
312
+
313
+ 8. Litigation
314
+
315
+ ---
316
+
317
+ Any litigation relating to this License may be brought only in the
318
+ courts of a jurisdiction where the defendant maintains its principal
319
+ place of business and such litigation shall be governed by laws of that
320
+ jurisdiction, without reference to its conflict-of-law provisions.
321
+ Nothing in this Section shall prevent a party's ability to bring
322
+ cross-claims or counter-claims.
323
+
324
+ 9. Miscellaneous
325
+
326
+ ---
327
+
328
+ This License represents the complete agreement concerning the subject
329
+ matter hereof. If any provision of this License is held to be
330
+ unenforceable, such provision shall be reformed only to the extent
331
+ necessary to make it enforceable. Any law or regulation which provides
332
+ that the language of a contract shall be construed against the drafter
333
+ shall not be used to construe this License against a Contributor.
334
+
335
+ 10. Versions of the License
336
+
337
+ ---
338
+
339
+ 10.1. New Versions
340
+
341
+ Mozilla Foundation is the license steward. Except as provided in Section
342
+ 10.3, no one other than the license steward has the right to modify or
343
+ publish new versions of this License. Each version will be given a
344
+ distinguishing version number.
345
+
346
+ 10.2. Effect of New Versions
347
+
348
+ You may distribute the Covered Software under the terms of the version
349
+ of the License under which You originally received the Covered Software,
350
+ or under the terms of any subsequent version published by the license
351
+ steward.
352
+
353
+ 10.3. Modified Versions
354
+
355
+ If you create software not governed by this License, and you want to
356
+ create a new license for such software, you may create and use a
357
+ modified version of this License if you rename the license and remove
358
+ any references to the name of the license steward (except to note that
359
+ such modified license differs from this License).
360
+
361
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
362
+ Licenses
363
+
364
+ If You choose to distribute Source Code Form that is Incompatible With
365
+ Secondary Licenses under the terms of this version of the License, the
366
+ notice described in Exhibit B of this License must be attached.
367
+
368
+ ## Exhibit A - Source Code Form License Notice
369
+
370
+ This Source Code Form is subject to the terms of the Mozilla Public
371
+ License, v. 2.0. If a copy of the MPL was not distributed with this
372
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
373
+
374
+ If it is not possible or desirable to put the notice in a particular
375
+ file, then You may include the notice in a location (such as a LICENSE
376
+ file in a relevant directory) where a recipient would be likely to look
377
+ for such a notice.
378
+
379
+ You may add additional accurate notices of copyright ownership.
380
+
381
+ ## Exhibit B - "Incompatible With Secondary Licenses" Notice
382
+
383
+ This Source Code Form is "Incompatible With Secondary Licenses", as
384
+ defined by the Mozilla Public License, v. 2.0.
@@ -35,7 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { CaptionedBlockComponent, SelectedStyle, } from '../affine-components/caption/index.js';
36
36
  import { ImageProxyService } from '../affine-shared/adapters/index.js';
37
37
  import { BlockCommentManager, CitationProvider, DocModeProvider, LinkPreviewServiceIdentifier, } from '../affine-shared/services/index.js';
38
- import { normalizeUrl } from '../affine-shared/utils/index.js';
38
+ import { normalizeUrl, shouldRefreshOnPropsUpdate, } from '../affine-shared/utils/index.js';
39
39
  import { BlockSelection } from '../std/index.js';
40
40
  import { computed, signal } from '@preact/signals-core';
41
41
  import { html } from 'lit';
@@ -241,7 +241,7 @@ let BookmarkBlockComponent = (() => {
241
241
  this.refreshData();
242
242
  }
243
243
  this.disposables.add(this.model.propsUpdated.subscribe(({ key }) => {
244
- if (key === 'url') {
244
+ if (shouldRefreshOnPropsUpdate(this.store, key)) {
245
245
  this.refreshData();
246
246
  }
247
247
  }));
@@ -19,7 +19,13 @@ const FONT_SIZE_LIST = [
19
19
  export const edgelessTextToolbarConfig = {
20
20
  // No need to adjust element bounds, which updates itself using ResizeObserver
21
21
  actions: [
22
- ...createTextActions(EdgelessTextBlockModel, 'edgeless-text'),
22
+ ...createTextActions(EdgelessTextBlockModel, 'edgeless-text', undefined,
23
+ // Surface *element* models carry their style props on the instance, which
24
+ // is what the shared actions read by default. This is a *block* model:
25
+ // they live under `props`, so without this projection every dropdown
26
+ // would read `undefined` and keep showing the fallbacks (Regular /
27
+ // Normal / Inter / Left) whatever the text actually is.
28
+ model => model.props),
23
29
  {
24
30
  // The shared `d.font-size` action is disabled for edgeless text (the
25
31
  // model has no `fontSize` prop); this one drives `scale` instead, the
@@ -1,4 +1,5 @@
1
1
  import { OpenIcon } from '../../affine-components/icons/index.js';
2
+ import { shouldRefreshOnPropsUpdate } from '../../affine-shared/utils/index.js';
2
3
  import { BlockSelection } from '../../std/index.js';
3
4
  import { html, nothing } from 'lit';
4
5
  import { classMap } from 'lit/directives/class-map.js';
@@ -44,7 +45,7 @@ export class EmbedFigmaBlockComponent extends EmbedBlockComponent {
44
45
  });
45
46
  }
46
47
  this.disposables.add(this.model.propsUpdated.subscribe(({ key }) => {
47
- if (key === 'url') {
48
+ if (shouldRefreshOnPropsUpdate(this.store, key)) {
48
49
  this.refreshData();
49
50
  }
50
51
  }));
@@ -35,6 +35,7 @@ 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, isGfxBlockComponent } from '../../std/index.js';
39
40
  import { html, nothing } from 'lit';
40
41
  import { property } from 'lit/decorators.js';
@@ -107,7 +108,7 @@ let EmbedGithubBlockComponent = (() => {
107
108
  }
108
109
  });
109
110
  this.disposables.add(this.model.propsUpdated.subscribe(({ key }) => {
110
- if (key === 'url') {
111
+ if (shouldRefreshOnPropsUpdate(this.store, key)) {
111
112
  this.refreshData();
112
113
  }
113
114
  }));
@@ -4,6 +4,8 @@ export declare const EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS = 8;
4
4
  export declare const DEFAULT_IFRAME_HEIGHT = 152;
5
5
  export declare const DEFAULT_IFRAME_WIDTH = "100%";
6
6
  export declare const LINK_CREATE_POPUP_OFFSET = 4;
7
+ export declare const TRUSTED_SANDBOX = "allow-same-origin allow-scripts allow-forms allow-presentation";
8
+ export declare const UNTRUSTED_SANDBOX = "allow-scripts";
7
9
  export declare const IDLE_CARD_DEFAULT_HEIGHT = 48;
8
10
  export declare const LOADING_CARD_DEFAULT_HEIGHT = 114;
9
11
  export declare const ERROR_CARD_DEFAULT_HEIGHT = 114;
@@ -4,6 +4,11 @@ export const EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS = 8;
4
4
  export const DEFAULT_IFRAME_HEIGHT = 152;
5
5
  export const DEFAULT_IFRAME_WIDTH = '100%';
6
6
  export const LINK_CREATE_POPUP_OFFSET = 4;
7
+ // Sandbox granted to an embed served by a known provider (spotify, miro, …).
8
+ export const TRUSTED_SANDBOX = 'allow-same-origin allow-scripts allow-forms allow-presentation';
9
+ // Sandbox granted to an arbitrary url: the generic provider, or no provider at
10
+ // all. Without `allow-same-origin` the frame runs on an opaque origin.
11
+ export const UNTRUSTED_SANDBOX = 'allow-scripts';
7
12
  export const IDLE_CARD_DEFAULT_HEIGHT = 48;
8
13
  export const LOADING_CARD_DEFAULT_HEIGHT = 114;
9
14
  export const ERROR_CARD_DEFAULT_HEIGHT = 114;
@@ -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,7 +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';
39
+ import { matchModels, shouldRefreshOnPropsUpdate, } from '../../affine-shared/utils/index.js';
40
40
  import { BlockSuiteError, ErrorCode } from '../../global/exceptions/index.js';
41
41
  import { BlockSelection } from '../../std/index.js';
42
42
  import { flip, offset, shift } from '@floating-ui/dom';
@@ -46,9 +46,9 @@ import { query } from 'lit/decorators.js';
46
46
  import { classMap } from 'lit/directives/class-map.js';
47
47
  import { ifDefined } from 'lit/directives/if-defined.js';
48
48
  import { styleMap } from 'lit/directives/style-map.js';
49
- 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';
49
+ 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, TRUSTED_SANDBOX, UNTRUSTED_SANDBOX, } from './consts.js';
50
50
  import { embedIframeBlockStyles } from './style.js';
51
- import { safeGetIframeSrc } from './utils.js';
51
+ import { isSafeEmbedUrl, safeGetIframeSrc } from './utils.js';
52
52
  import { EMBED_IFRAME_NO_LINK_MESSAGE } from '../translations.js';
53
53
  let EmbedIframeBlockComponent = (() => {
54
54
  let _classSuper = CaptionedBlockComponent;
@@ -122,7 +122,7 @@ let EmbedIframeBlockComponent = (() => {
122
122
  }
123
123
  // refresh data when original url changes
124
124
  this.disposables.add(this.model.propsUpdated.subscribe(({ key }) => {
125
- if (key === 'url') {
125
+ if (shouldRefreshOnPropsUpdate(this.store, key)) {
126
126
  this.refreshData().catch(console.error);
127
127
  }
128
128
  }));
@@ -219,9 +219,12 @@ let EmbedIframeBlockComponent = (() => {
219
219
  return EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS;
220
220
  });
221
221
  this.iframeOptions = undefined;
222
+ // the name of the provider config matched by the original url, if any
223
+ this.currentConfigName = undefined;
222
224
  this.open = () => {
223
225
  const link = this.model.props.url;
224
- if (!link) {
226
+ // a non http(s) link would run in the opener context, never open it
227
+ if (!isSafeEmbedUrl(link)) {
225
228
  this.notificationService?.notify({
226
229
  title: translateKey(this.std, ...TOAST_NO_LINK_FOUND),
227
230
  message: translateKey(this.std, ...EMBED_IFRAME_NO_LINK_MESSAGE),
@@ -230,7 +233,7 @@ let EmbedIframeBlockComponent = (() => {
230
233
  });
231
234
  return;
232
235
  }
233
- window.open(link, '_blank');
236
+ window.open(link, '_blank', 'noopener,noreferrer');
234
237
  };
235
238
  this.refreshData = async () => {
236
239
  try {
@@ -325,6 +328,7 @@ let EmbedIframeBlockComponent = (() => {
325
328
  const config = this.embedIframeService?.getConfig(url);
326
329
  if (config) {
327
330
  this.iframeOptions = config.options;
331
+ this.currentConfigName = config.name;
328
332
  }
329
333
  };
330
334
  this._handleDoubleClick = () => {
@@ -359,11 +363,28 @@ let EmbedIframeBlockComponent = (() => {
359
363
  };
360
364
  this._renderIframe = () => {
361
365
  const { iframeUrl } = this.model.props;
362
- const { widthPercent, heightInNote, style, allow, referrerpolicy, scrolling, allowFullscreen, } = this.iframeOptions ?? {};
366
+ // the url comes from the document: refuse to give a non http(s) one to src
367
+ if (!isSafeEmbedUrl(iframeUrl)) {
368
+ return html `<embed-iframe-error-card
369
+ .error=${new Error('Invalid iframe URL')}
370
+ .model=${this.model}
371
+ .onRetry=${this._handleRetry}
372
+ .std=${this.std}
373
+ .inSurface=${this.inSurface}
374
+ .options=${this._statusCardOptions}
375
+ ></embed-iframe-error-card>`;
376
+ }
377
+ const { widthPercent, heightInNote, style, allow, referrerpolicy, scrolling, allowFullscreen, sandbox, } = this.iframeOptions ?? {};
363
378
  const width = `${widthPercent}%`;
364
379
  // if the block is in the surface, use 100% as the height
365
380
  // otherwise, use the heightInNote
366
381
  const height = this.inSurface ? '100%' : heightInNote;
382
+ // a provider may widen its own sandbox; an arbitrary url (generic config,
383
+ // or no config at all) only ever gets the untrusted one
384
+ const sandboxValue = sandbox ??
385
+ (this.currentConfigName && this.currentConfigName !== 'generic'
386
+ ? TRUSTED_SANDBOX
387
+ : UNTRUSTED_SANDBOX);
367
388
  return html `
368
389
  <iframe
369
390
  width=${width ?? DEFAULT_IFRAME_WIDTH}
@@ -372,7 +393,8 @@ let EmbedIframeBlockComponent = (() => {
372
393
  loading="lazy"
373
394
  frameborder="0"
374
395
  credentialless
375
- src=${ifDefined(iframeUrl)}
396
+ sandbox=${sandboxValue}
397
+ src=${iframeUrl}
376
398
  allow=${ifDefined(allow)}
377
399
  referrerpolicy=${ifDefined(referrerpolicy)}
378
400
  scrolling=${ifDefined(scrolling)}
@@ -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,6 +35,7 @@ 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';
@@ -95,7 +96,7 @@ let EmbedLoomBlockComponent = (() => {
95
96
  }
96
97
  this.disposables.add(this.model.propsUpdated.subscribe(({ key }) => {
97
98
  this.requestUpdate();
98
- if (key === 'url') {
99
+ if (shouldRefreshOnPropsUpdate(this.store, key)) {
99
100
  this.refreshData();
100
101
  }
101
102
  }));
@@ -35,6 +35,7 @@ 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';
@@ -100,7 +101,7 @@ let EmbedYoutubeBlockComponent = (() => {
100
101
  }
101
102
  this.disposables.add(this.model.propsUpdated.subscribe(({ key }) => {
102
103
  this.requestUpdate();
103
- if (key === 'url') {
104
+ if (shouldRefreshOnPropsUpdate(this.store, key)) {
104
105
  this.refreshData();
105
106
  }
106
107
  }));