@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
@@ -40,13 +40,13 @@ import { SignalWatcher, WithDisposable } from '../../global/lit/index.js';
40
40
  import { stdContext } from '../../std/index.js';
41
41
  import { consume } from '@lit/context';
42
42
  import { batch, signal } from '@preact/signals-core';
43
- import { css, html, LitElement } from 'lit';
44
- import { property, query } from 'lit/decorators.js';
43
+ import { css, html, LitElement, nothing } from 'lit';
44
+ import { property, query, state } from 'lit/decorators.js';
45
45
  import { choose } from 'lit-html/directives/choose.js';
46
46
  import { repeat } from 'lit-html/directives/repeat.js';
47
47
  import { styleMap } from 'lit-html/directives/style-map.js';
48
48
  import { when } from 'lit-html/directives/when.js';
49
- import { calcCustomButtonStyle, keepColor, packColorsWith, preprocessColor, rgbaToHex8, } from '../color-picker/index.js';
49
+ import { calcCustomButtonStyle, keepColor, packColorsWith, paletteCarouselPage, paletteCarouselStyles, paletteCarouselWheel, preprocessColor, renderPaletteCarousel, rgbaToHex8, } from '../color-picker/index.js';
50
50
  import { BORDER_COLOR_LABEL, COLOR_LABEL, FILL_COLOR_LABEL, } from '../translations.js';
51
51
  let EdgelessShapeColorPicker = (() => {
52
52
  let _classSuper = WithDisposable(SignalWatcher(LitElement));
@@ -59,6 +59,21 @@ let EdgelessShapeColorPicker = (() => {
59
59
  let _palettes_decorators;
60
60
  let _palettes_initializers = [];
61
61
  let _palettes_extraInitializers = [];
62
+ let _paletteGroups_decorators;
63
+ let _paletteGroups_initializers = [];
64
+ let _paletteGroups_extraInitializers = [];
65
+ let _activeGroupKey_decorators;
66
+ let _activeGroupKey_initializers = [];
67
+ let _activeGroupKey_extraInitializers = [];
68
+ let _pickedGroupIndex_decorators;
69
+ let _pickedGroupIndex_initializers = [];
70
+ let _pickedGroupIndex_extraInitializers = [];
71
+ let _paletteListOpen_decorators;
72
+ let _paletteListOpen_initializers = [];
73
+ let _paletteListOpen_extraInitializers = [];
74
+ let _pageDirection_decorators;
75
+ let _pageDirection_initializers = [];
76
+ let _pageDirection_extraInitializers = [];
62
77
  let _menuButton_decorators;
63
78
  let _menuButton_initializers = [];
64
79
  let _menuButton_extraInitializers = [];
@@ -68,10 +83,20 @@ let EdgelessShapeColorPicker = (() => {
68
83
  _std_decorators = [consume({ context: stdContext })];
69
84
  _payload_decorators = [property({ attribute: false })];
70
85
  _palettes_decorators = [property({ attribute: false })];
86
+ _paletteGroups_decorators = [property({ attribute: false })];
87
+ _activeGroupKey_decorators = [property({ attribute: false })];
88
+ _pickedGroupIndex_decorators = [state()];
89
+ _paletteListOpen_decorators = [state()];
90
+ _pageDirection_decorators = [state()];
71
91
  _menuButton_decorators = [query('editor-menu-button')];
72
92
  __esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers);
73
93
  __esDecorate(this, null, _payload_decorators, { kind: "accessor", name: "payload", static: false, private: false, access: { has: obj => "payload" in obj, get: obj => obj.payload, set: (obj, value) => { obj.payload = value; } }, metadata: _metadata }, _payload_initializers, _payload_extraInitializers);
74
94
  __esDecorate(this, null, _palettes_decorators, { kind: "accessor", name: "palettes", static: false, private: false, access: { has: obj => "palettes" in obj, get: obj => obj.palettes, set: (obj, value) => { obj.palettes = value; } }, metadata: _metadata }, _palettes_initializers, _palettes_extraInitializers);
95
+ __esDecorate(this, null, _paletteGroups_decorators, { kind: "accessor", name: "paletteGroups", static: false, private: false, access: { has: obj => "paletteGroups" in obj, get: obj => obj.paletteGroups, set: (obj, value) => { obj.paletteGroups = value; } }, metadata: _metadata }, _paletteGroups_initializers, _paletteGroups_extraInitializers);
96
+ __esDecorate(this, null, _activeGroupKey_decorators, { kind: "accessor", name: "activeGroupKey", static: false, private: false, access: { has: obj => "activeGroupKey" in obj, get: obj => obj.activeGroupKey, set: (obj, value) => { obj.activeGroupKey = value; } }, metadata: _metadata }, _activeGroupKey_initializers, _activeGroupKey_extraInitializers);
97
+ __esDecorate(this, null, _pickedGroupIndex_decorators, { kind: "accessor", name: "pickedGroupIndex", static: false, private: false, access: { has: obj => "pickedGroupIndex" in obj, get: obj => obj.pickedGroupIndex, set: (obj, value) => { obj.pickedGroupIndex = value; } }, metadata: _metadata }, _pickedGroupIndex_initializers, _pickedGroupIndex_extraInitializers);
98
+ __esDecorate(this, null, _paletteListOpen_decorators, { kind: "accessor", name: "paletteListOpen", static: false, private: false, access: { has: obj => "paletteListOpen" in obj, get: obj => obj.paletteListOpen, set: (obj, value) => { obj.paletteListOpen = value; } }, metadata: _metadata }, _paletteListOpen_initializers, _paletteListOpen_extraInitializers);
99
+ __esDecorate(this, null, _pageDirection_decorators, { kind: "accessor", name: "pageDirection", static: false, private: false, access: { has: obj => "pageDirection" in obj, get: obj => obj.pageDirection, set: (obj, value) => { obj.pageDirection = value; } }, metadata: _metadata }, _pageDirection_initializers, _pageDirection_extraInitializers);
75
100
  __esDecorate(this, null, _menuButton_decorators, { kind: "accessor", name: "menuButton", static: false, private: false, access: { has: obj => "menuButton" in obj, get: obj => obj.menuButton, set: (obj, value) => { obj.menuButton = value; } }, metadata: _metadata }, _menuButton_initializers, _menuButton_extraInitializers);
76
101
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
77
102
  }
@@ -95,6 +120,8 @@ let EdgelessShapeColorPicker = (() => {
95
120
  color: ${unsafeCSSVarV2('text/secondary')};
96
121
  font-weight: 400;
97
122
  }
123
+
124
+ ${paletteCarouselStyles}
98
125
  `; }
99
126
  #pickFillColor;
100
127
  #pickStrokeColor;
@@ -103,8 +130,41 @@ let EdgelessShapeColorPicker = (() => {
103
130
  #calcCustomButtonStyle(color, isCustomColor) {
104
131
  return calcCustomButtonStyle(color, isCustomColor, this);
105
132
  }
133
+ /**
134
+ * The page of {@link paletteGroups} on screen — see the twin getter on
135
+ * `edgeless-color-picker-button` for why a click wins over the prop.
136
+ */
137
+ get groupIndex() {
138
+ if (this.pickedGroupIndex !== undefined)
139
+ return this.pickedGroupIndex;
140
+ const asked = this.paletteGroups.findIndex(group => group.key === this.activeGroupKey);
141
+ return asked < 0 ? 0 : asked;
142
+ }
143
+ /** The page on screen, or the caller's own list when there is no carousel. */
144
+ get activePalettes() {
145
+ if (this.paletteGroups.length < 2)
146
+ return this.palettes;
147
+ return this.paletteGroups[this.groupIndex]?.palettes ?? this.palettes;
148
+ }
149
+ /**
150
+ * A new selection re-opens on ITS framework — see the twin on
151
+ * `edgeless-color-picker-button`.
152
+ */
153
+ willUpdate(changed) {
154
+ if (changed.has('activeGroupKey')) {
155
+ this.pickedGroupIndex = undefined;
156
+ this.paletteListOpen = false;
157
+ this.pageDirection = 'settle';
158
+ }
159
+ }
160
+ /** Page, and remember which way it went — see the twin. */
161
+ #page;
162
+ /** Measured against the UNION of the pages, for the reason the twin states. */
106
163
  #calcCustomButtonState(color, theme) {
107
- return !this.palettes
164
+ const offered = this.paletteGroups.length > 1
165
+ ? this.paletteGroups.flatMap(group => group.palettes)
166
+ : this.palettes;
167
+ return !offered
108
168
  .map(({ value }) => resolveColor(value, theme))
109
169
  .includes(color);
110
170
  }
@@ -126,13 +186,15 @@ let EdgelessShapeColorPicker = (() => {
126
186
  firstUpdated() {
127
187
  this.disposables.addFromEvent(this.menuButton, 'toggle', (e) => {
128
188
  const opened = e.detail;
189
+ // A re-opened picker shows its swatches, never the list it was left on.
190
+ this.paletteListOpen = false;
129
191
  if (!opened && this.tabType$.peek() === 'custom') {
130
192
  this.tabType$.value = 'normal';
131
193
  }
132
194
  });
133
195
  }
134
196
  render() {
135
- const { tabType$: { value: tabType }, colorType$: { value: colorType }, palettes, fillColorWithoutAlpha, payload: { fillColor, strokeColor, strokeWidth, strokeStyle, originalFillColor, originalStrokeColor, theme, enableCustomColor, }, } = this;
197
+ const { tabType$: { value: tabType }, colorType$: { value: colorType }, activePalettes, fillColorWithoutAlpha, payload: { fillColor, strokeColor, strokeWidth, strokeStyle, originalFillColor, originalStrokeColor, theme, enableCustomColor, }, } = this;
136
198
  return html `
137
199
  <editor-menu-button
138
200
  .contentPadding="${tabType === 'normal' ? '8px' : '0px'}"
@@ -152,69 +214,96 @@ let EdgelessShapeColorPicker = (() => {
152
214
  </editor-icon-button>
153
215
  `}
154
216
  >
155
- <div class="pickers" data-orientation="vertical">
217
+ <div
218
+ class="pickers"
219
+ data-orientation="vertical"
220
+ @wheel=${paletteCarouselWheel({
221
+ groups: this.paletteGroups,
222
+ index: this.groupIndex,
223
+ onPage: this.#page,
224
+ open: this.paletteListOpen,
225
+ })}
226
+ >
156
227
  ${choose(tabType, [
157
228
  [
158
229
  'normal',
159
230
  () => {
160
231
  return html `
161
- ${repeat([
162
- {
163
- label: this.std
164
- ? translateKey(this.std, ...FILL_COLOR_LABEL)
165
- : FILL_COLOR_LABEL[1],
166
- type: 'fillColor',
167
- value: fillColor,
168
- hollowCircle: false,
169
- onPick: this.#pickFillColor,
170
- },
171
- {
172
- label: this.std
173
- ? translateKey(this.std, ...BORDER_COLOR_LABEL)
174
- : BORDER_COLOR_LABEL[1],
175
- type: 'strokeColor',
176
- value: strokeColor,
177
- hollowCircle: true,
178
- onPick: this.#pickStrokeColor,
179
- },
180
- ], item => item.type, ({ label, type, value, onPick, hollowCircle }) => html `
181
- <div class="picker-label">${label}</div>
182
- <edgeless-color-panel
183
- aria-label="${label}"
184
- role="listbox"
185
- .hasTransparent=${false}
186
- .hollowCircle=${hollowCircle}
187
- .value=${value}
188
- .theme=${theme}
189
- .palettes=${palettes}
190
- .std=${this.std}
191
- @select=${onPick}
192
- >
193
- ${when(enableCustomColor, () => {
194
- const isCustomColor = this.#calcCustomButtonState(value, theme);
195
- const styleInfo = this.#calcCustomButtonStyle(value, isCustomColor);
196
- return html `
197
- <edgeless-color-custom-button
198
- slot="custom"
199
- style=${styleMap(styleInfo)}
200
- ?active=${isCustomColor}
201
- @click=${() => this.#switchToCustomWith(type)}
202
- ></edgeless-color-custom-button>
203
- `;
232
+ ${renderPaletteCarousel({
233
+ groups: this.paletteGroups,
234
+ index: this.groupIndex,
235
+ onPage: this.#page,
236
+ onToggle: open => (this.paletteListOpen = open),
237
+ open: this.paletteListOpen,
238
+ direction: this.pageDirection,
239
+ std: this.std,
240
+ theme,
204
241
  })}
205
- </edgeless-color-panel>
206
- `)}
207
- <div class="picker-label">
208
- ${this.std
209
- ? translateKey(this.std, ...BOARD_BORDER_STYLE_LABEL)
210
- : BOARD_BORDER_STYLE_LABEL[1]}
211
- </div>
212
- <edgeless-line-styles-panel
213
- class="picker"
214
- .lineSize=${strokeWidth}
215
- .lineStyle=${strokeStyle}
216
- @select=${this.#pickStrokeStyle}
217
- ></edgeless-line-styles-panel>
242
+ ${this.paletteListOpen
243
+ ? nothing
244
+ : html `${repeat([
245
+ {
246
+ label: this.std
247
+ ? translateKey(this.std, ...FILL_COLOR_LABEL)
248
+ : FILL_COLOR_LABEL[1],
249
+ type: 'fillColor',
250
+ value: fillColor,
251
+ hollowCircle: false,
252
+ onPick: this.#pickFillColor,
253
+ },
254
+ {
255
+ label: this.std
256
+ ? translateKey(this.std, ...BORDER_COLOR_LABEL)
257
+ : BORDER_COLOR_LABEL[1],
258
+ type: 'strokeColor',
259
+ value: strokeColor,
260
+ hollowCircle: true,
261
+ onPick: this.#pickStrokeColor,
262
+ },
263
+ ], item => item.type, ({ label, type, value, onPick, hollowCircle, }) => html `
264
+ <div class="picker-label">${label}</div>
265
+ ${paletteCarouselPage({
266
+ groups: this.paletteGroups,
267
+ index: this.groupIndex,
268
+ direction: this.pageDirection,
269
+ }, html `
270
+ <edgeless-color-panel
271
+ aria-label="${label}"
272
+ role="listbox"
273
+ .hasTransparent=${false}
274
+ .hollowCircle=${hollowCircle}
275
+ .value=${value}
276
+ .theme=${theme}
277
+ .palettes=${activePalettes}
278
+ .std=${this.std}
279
+ @select=${onPick}
280
+ >
281
+ ${when(enableCustomColor, () => {
282
+ const isCustomColor = this.#calcCustomButtonState(value, theme);
283
+ const styleInfo = this.#calcCustomButtonStyle(value, isCustomColor);
284
+ return html `
285
+ <edgeless-color-custom-button
286
+ slot="custom"
287
+ style=${styleMap(styleInfo)}
288
+ ?active=${isCustomColor}
289
+ @click=${() => this.#switchToCustomWith(type)}
290
+ ></edgeless-color-custom-button>
291
+ `;
292
+ })}
293
+ </edgeless-color-panel>
294
+ `)}
295
+ `)}
296
+ <div class="picker-label">
297
+ ${this.std
298
+ ? translateKey(this.std, ...BOARD_BORDER_STYLE_LABEL)
299
+ : BOARD_BORDER_STYLE_LABEL[1]}
300
+ </div>
301
+ <edgeless-line-styles-panel
302
+ class="picker"
303
+ .lineSize=${strokeWidth}
304
+ .lineStyle=${strokeStyle}
305
+ @select=${this.#pickStrokeStyle}
306
+ ></edgeless-line-styles-panel>`}
218
307
  `;
219
308
  },
220
309
  ],
@@ -245,6 +334,33 @@ let EdgelessShapeColorPicker = (() => {
245
334
  #palettes_accessor_storage;
246
335
  get palettes() { return this.#palettes_accessor_storage; }
247
336
  set palettes(value) { this.#palettes_accessor_storage = value; }
337
+ #paletteGroups_accessor_storage;
338
+ /**
339
+ * The carousel's pages, base palette first (`docs/adr/0027`). Empty falls
340
+ * back to {@link palettes} and draws no header — the panel as it was.
341
+ */
342
+ get paletteGroups() { return this.#paletteGroups_accessor_storage; }
343
+ set paletteGroups(value) { this.#paletteGroups_accessor_storage = value; }
344
+ #activeGroupKey_accessor_storage;
345
+ /** The page to open on: the framework of the selected element, usually. */
346
+ get activeGroupKey() { return this.#activeGroupKey_accessor_storage; }
347
+ set activeGroupKey(value) { this.#activeGroupKey_accessor_storage = value; }
348
+ #pickedGroupIndex_accessor_storage;
349
+ /** Component state only, never persisted: which page the user paged TO. */
350
+ get pickedGroupIndex() { return this.#pickedGroupIndex_accessor_storage; }
351
+ set pickedGroupIndex(value) { this.#pickedGroupIndex_accessor_storage = value; }
352
+ #paletteListOpen_accessor_storage;
353
+ /**
354
+ * View state too: whether the header's list of pages is showing IN PLACE of
355
+ * the two grids and the line styles — see the twin on
356
+ * `edgeless-color-picker-button`.
357
+ */
358
+ get paletteListOpen() { return this.#paletteListOpen_accessor_storage; }
359
+ set paletteListOpen(value) { this.#paletteListOpen_accessor_storage = value; }
360
+ #pageDirection_accessor_storage;
361
+ /** Which way the page arrived — see the twin. Both grids take it together. */
362
+ get pageDirection() { return this.#pageDirection_accessor_storage; }
363
+ set pageDirection(value) { this.#pageDirection_accessor_storage = value; }
248
364
  #menuButton_accessor_storage;
249
365
  get menuButton() { return this.#menuButton_accessor_storage; }
250
366
  set menuButton(value) { this.#menuButton_accessor_storage = value; }
@@ -297,9 +413,19 @@ let EdgelessShapeColorPicker = (() => {
297
413
  cancelable: true,
298
414
  }));
299
415
  };
416
+ /** Page, and remember which way it went — see the twin. */
417
+ this.#page = (index, direction) => {
418
+ this.pickedGroupIndex = index;
419
+ this.pageDirection = direction;
420
+ };
300
421
  this.#payload_accessor_storage = __runInitializers(this, _payload_initializers, void 0);
301
422
  this.#palettes_accessor_storage = (__runInitializers(this, _payload_extraInitializers), __runInitializers(this, _palettes_initializers, DefaultTheme.Palettes));
302
- this.#menuButton_accessor_storage = (__runInitializers(this, _palettes_extraInitializers), __runInitializers(this, _menuButton_initializers, void 0));
423
+ this.#paletteGroups_accessor_storage = (__runInitializers(this, _palettes_extraInitializers), __runInitializers(this, _paletteGroups_initializers, []));
424
+ this.#activeGroupKey_accessor_storage = (__runInitializers(this, _paletteGroups_extraInitializers), __runInitializers(this, _activeGroupKey_initializers, undefined));
425
+ this.#pickedGroupIndex_accessor_storage = (__runInitializers(this, _activeGroupKey_extraInitializers), __runInitializers(this, _pickedGroupIndex_initializers, undefined));
426
+ this.#paletteListOpen_accessor_storage = (__runInitializers(this, _pickedGroupIndex_extraInitializers), __runInitializers(this, _paletteListOpen_initializers, false));
427
+ this.#pageDirection_accessor_storage = (__runInitializers(this, _paletteListOpen_extraInitializers), __runInitializers(this, _pageDirection_initializers, 'settle'));
428
+ this.#menuButton_accessor_storage = (__runInitializers(this, _pageDirection_extraInitializers), __runInitializers(this, _menuButton_initializers, void 0));
303
429
  __runInitializers(this, _menuButton_extraInitializers);
304
430
  }
305
431
  };
@@ -9,11 +9,11 @@ export const AIStarIcon = html `<svg
9
9
  <g clip-path="url(#clip0_7444_26654)">
10
10
  <path
11
11
  d="M9.40033 4.57585C9.36627 4.27519 9.11207 4.04792 8.80948 4.04761C8.50689 4.0473 8.25223 4.27405 8.21756 4.57465C7.99211 6.52928 7.40771 7.90373 6.46492 8.84651C5.52213 9.7893 4.14769 10.3737 2.19305 10.5991C1.89246 10.6338 1.66571 10.8885 1.66602 11.1911C1.66633 11.4937 1.8936 11.7479 2.19426 11.7819C4.11659 11.9997 5.52025 12.5838 6.48542 13.5315C7.44696 14.4757 8.04356 15.8498 8.21597 17.7908C8.24327 18.0981 8.50096 18.3337 8.80954 18.3333C9.11813 18.333 9.37528 18.0969 9.40189 17.7894C9.56714 15.8804 10.1632 14.4774 11.1295 13.5111C12.0958 12.5448 13.4988 11.9487 15.4078 11.7835C15.7153 11.7569 15.9514 11.4997 15.9517 11.1911C15.9521 10.8825 15.7165 10.6249 15.4092 10.5976C13.4683 10.4252 12.0941 9.82855 11.15 8.86701C10.2022 7.90184 9.61807 6.49818 9.40033 4.57585Z"
12
- fill="#1E96EB"
12
+ fill="var(--affine-primary-color)"
13
13
  />
14
14
  <path
15
15
  d="M15.7849 1.87208C15.7717 1.75516 15.6728 1.66678 15.5551 1.66666C15.4375 1.66654 15.3384 1.75472 15.3249 1.87162C15.2373 2.63175 15.01 3.16626 14.6434 3.5329C14.2767 3.89954 13.7422 4.1268 12.9821 4.21448C12.8652 4.22796 12.777 4.327 12.7771 4.44467C12.7772 4.56234 12.8656 4.6612 12.9826 4.67445C13.7301 4.75912 14.276 4.9863 14.6513 5.35485C15.0253 5.72203 15.2573 6.25642 15.3243 7.01121C15.335 7.13075 15.4352 7.22235 15.5552 7.22221C15.6752 7.22208 15.7752 7.13025 15.7855 7.01069C15.8498 6.26831 16.0816 5.72268 16.4574 5.3469C16.8332 4.97111 17.3788 4.73932 18.1212 4.67505C18.2407 4.6647 18.3325 4.5647 18.3327 4.44469C18.3328 4.32469 18.2412 4.22448 18.1217 4.21386C17.3669 4.14681 16.8325 3.9148 16.4653 3.54087C16.0968 3.16552 15.8696 2.61966 15.7849 1.87208Z"
16
- fill="#1E96EB"
16
+ fill="var(--affine-primary-color)"
17
17
  />
18
18
  </g>
19
19
  <defs>
@@ -46,7 +46,7 @@ export const AIStopIcon = html `<svg
46
46
  fill-rule="evenodd"
47
47
  clip-rule="evenodd"
48
48
  d="M17.0827 10C17.0827 13.912 13.9114 17.0834 9.99935 17.0834C6.08733 17.0834 2.91602 13.912 2.91602 10C2.91602 6.088 6.08733 2.91669 9.99935 2.91669C13.9114 2.91669 17.0827 6.088 17.0827 10ZM18.3327 10C18.3327 14.6024 14.6017 18.3334 9.99935 18.3334C5.39698 18.3334 1.66602 14.6024 1.66602 10C1.66602 5.39765 5.39698 1.66669 9.99935 1.66669C14.6017 1.66669 18.3327 5.39765 18.3327 10ZM8.33268 6.66669C7.41221 6.66669 6.66602 7.41288 6.66602 8.33335V11.6667C6.66602 12.5872 7.41221 13.3334 8.33268 13.3334H11.666C12.5865 13.3334 13.3327 12.5872 13.3327 11.6667V8.33335C13.3327 7.41288 12.5865 6.66669 11.666 6.66669H8.33268Z"
49
- fill="#1E96EB"
49
+ fill="var(--affine-primary-color)"
50
50
  />
51
51
  </g>
52
52
  <defs>
@@ -1,3 +1,9 @@
1
+ /**
2
+ * The chrome accent, reached through its token rather than written as a hex:
3
+ * the six-dot burst is chrome, so it has to follow the host's theme (DESIGN.md,
4
+ * The Borrowed Blue Rule).
5
+ */
6
+ const ACCENT = 'var(--affine-primary-color)';
1
7
  export const playCheckAnimation = async (refElement, { left = 0, size = 20 } = {}) => {
2
8
  const sparkingEl = document.createElement('div');
3
9
  sparkingEl.classList.add('affine-check-animation');
@@ -14,7 +20,7 @@ export const playCheckAnimation = async (refElement, { left = 0, size = 20 } = {
14
20
  refElement.append(sparkingEl);
15
21
  await sparkingEl.animate([
16
22
  {
17
- boxShadow: '0 -18px 0 -8px #1e96eb, 16px -8px 0 -8px #1e96eb, 16px 8px 0 -8px #1e96eb, 0 18px 0 -8px #1e96eb, -16px 8px 0 -8px #1e96eb, -16px -8px 0 -8px #1e96eb',
23
+ boxShadow: `0 -18px 0 -8px ${ACCENT}, 16px -8px 0 -8px ${ACCENT}, 16px 8px 0 -8px ${ACCENT}, 0 18px 0 -8px ${ACCENT}, -16px 8px 0 -8px ${ACCENT}, -16px -8px 0 -8px ${ACCENT}`,
18
24
  },
19
25
  ], { duration: 240, easing: 'ease', fill: 'forwards' }).finished;
20
26
  await sparkingEl.animate([
@@ -1,5 +1,5 @@
1
1
  import { translateKey } from '../../affine-shared/services/index.js';
2
- import { computed, effect, signal, } from '@preact/signals-core';
2
+ import { computed, effect, signal, untracked, } from '@preact/signals-core';
3
3
  import { RESOURCE_NOT_FOUND_WORDINGS, RESOURCE_RETRIEVE_FAILED_WORDINGS, } from '../translations.js';
4
4
  export class ResourceController {
5
5
  constructor(blobId$, kind = 'File',
@@ -71,30 +71,43 @@ export class ResourceController {
71
71
  return result;
72
72
  }
73
73
  updateState(state) {
74
- this.state$.value = { ...this.state$.value, ...state };
74
+ // `peek()`, never `.value`: merging must not subscribe whatever effect
75
+ // happens to be running to `state$`, otherwise the write below re-runs
76
+ // that effect, which writes again — see `subscribe()` and issue #319.
77
+ this.state$.value = { ...this.state$.peek(), ...state };
75
78
  }
76
79
  // The explicit return type keeps declaration emit off signals-core's
77
80
  // `DisposeFn`, whose `[Symbol.dispose]` member tsc cannot serialize.
78
81
  subscribe() {
79
82
  return effect(() => {
83
+ // Only the blob id is tracked: a new id re-runs the effect, nothing else
84
+ // does. The subscription body stays `untracked` because a host whose
85
+ // `blobState$` replays on subscribe (a `BehaviorSubject`) writes `state$`
86
+ // synchronously from inside this very effect; tracked, that write would
87
+ // re-run the effect, re-subscribe, replay, write again — until
88
+ // signals-core gives up with `Cycle detected` (issue #319).
80
89
  const blobId = this.blobId$.value;
81
90
  if (!blobId)
82
91
  return;
83
- const blobState$ = this.engine?.blobState$(blobId);
84
- if (!blobState$)
85
- return;
86
- const subscription = blobState$.subscribe(state => {
87
- let { uploading, downloading, errorMessage } = state;
88
- if (state.overSize) {
89
- uploading = false;
90
- downloading = false;
91
- }
92
- else if ((uploading || downloading) && errorMessage) {
93
- errorMessage = null;
94
- }
95
- this.updateState({ ...state, uploading, downloading, errorMessage });
92
+ return untracked(() => {
93
+ const blobState$ = this.engine?.blobState$(blobId);
94
+ if (!blobState$)
95
+ return;
96
+ const subscription = blobState$.subscribe(state => {
97
+ let { uploading, downloading, errorMessage } = state;
98
+ if (state.overSize) {
99
+ uploading = false;
100
+ downloading = false;
101
+ }
102
+ else if ((uploading || downloading) && errorMessage) {
103
+ errorMessage = null;
104
+ }
105
+ // A later emission can land while some unrelated effect is being
106
+ // evaluated; it must not become a dependency of that effect either.
107
+ untracked(() => this.updateState({ ...state, uploading, downloading, errorMessage }));
108
+ });
109
+ return () => subscription.unsubscribe();
96
110
  });
97
- return () => subscription.unsubscribe();
98
111
  });
99
112
  }
100
113
  async blob() {
@@ -218,9 +218,14 @@ let SizeDropdownMenu = (() => {
218
218
  const { sizes, format, type, icon, resolvedLabel: label, size$: { value: size }, } = this;
219
219
  const isCheckType = type === 'check';
220
220
  const placeholder = format?.(Math.trunc(size)) ?? Math.trunc(size);
221
+ // `class` is STATIC. It used to be `${label.toLowerCase()}-menu`, which
222
+ // made a CSS class depend on the host's language the day `label` joined
223
+ // the translation seam (#390) — `échelle-menu` in French. Nothing in the
224
+ // repo selects it (checked across the styles and both test suites): it is
225
+ // the stable identifier it was always meant to be.
221
226
  return html `
222
227
  <editor-menu-button
223
- class="${`${label.toLowerCase()}-menu`}"
228
+ class="size-menu"
224
229
  .contentPadding="${'8px'}"
225
230
  .button=${html `
226
231
  <editor-icon-button
@@ -1,7 +1,7 @@
1
1
  export { EditorChevronDown } from './chevron-down.js';
2
2
  export { ToolbarMoreMenuConfigExtension } from './config.js';
3
3
  export { EditorIconButton } from './icon-button.js';
4
- export { EditorMenuAction, EditorMenuButton, EditorMenuContent, } from './menu-button.js';
4
+ export { EDITOR_MENU_TOGGLE, EditorMenuAction, EditorMenuButton, EditorMenuContent, } from './menu-button.js';
5
5
  export { MenuContext } from './menu-context.js';
6
6
  export { type PickerMenu, type PickerMenuItem, renderCurrentPickerItemWith, renderPickerMenu, renderPickerMenuItems, } from './picker-menu.js';
7
7
  export { EditorToolbarSeparator } from './separator.js';
@@ -6,7 +6,7 @@ import { Tooltip } from './tooltip.js';
6
6
  export { EditorChevronDown } from './chevron-down.js';
7
7
  export { ToolbarMoreMenuConfigExtension } from './config.js';
8
8
  export { EditorIconButton } from './icon-button.js';
9
- export { EditorMenuAction, EditorMenuButton, EditorMenuContent, } from './menu-button.js';
9
+ export { EDITOR_MENU_TOGGLE, EditorMenuAction, EditorMenuButton, EditorMenuContent, } from './menu-button.js';
10
10
  export { MenuContext } from './menu-context.js';
11
11
  export { renderCurrentPickerItemWith, renderPickerMenu, renderPickerMenuItems, } from './picker-menu.js';
12
12
  export { EditorToolbarSeparator } from './separator.js';
@@ -1,5 +1,12 @@
1
1
  import { type ButtonPopperOptions } from '../../affine-shared/utils/index.js';
2
2
  import { LitElement, type PropertyValues, type TemplateResult } from 'lit';
3
+ /**
4
+ * A panel in a toolbar opened or closed, announced across shadow boundaries.
5
+ *
6
+ * `detail` is whether it is now open, and the deepest element of
7
+ * `composedPath()` is the button it belongs to.
8
+ */
9
+ export declare const EDITOR_MENU_TOGGLE = "editor-menu-toggle";
3
10
  declare const EditorMenuButton_base: typeof LitElement & import("../../global/utils/types.js").Constructor<import("../../global/lit/with-disposable.js").DisposableClass>;
4
11
  export declare class EditorMenuButton extends EditorMenuButton_base {
5
12
  static styles: import("lit").CSSResult;
@@ -37,6 +37,13 @@ import { createButtonPopper, } from '../../affine-shared/utils/index.js';
37
37
  import { WithDisposable } from '../../global/lit/index.js';
38
38
  import { css, html, LitElement, } from 'lit';
39
39
  import { property, query } from 'lit/decorators.js';
40
+ /**
41
+ * A panel in a toolbar opened or closed, announced across shadow boundaries.
42
+ *
43
+ * `detail` is whether it is now open, and the deepest element of
44
+ * `composedPath()` is the button it belongs to.
45
+ */
46
+ export const EDITOR_MENU_TOGGLE = 'editor-menu-toggle';
40
47
  let EditorMenuButton = (() => {
41
48
  let _classSuper = WithDisposable(LitElement);
42
49
  let __content_decorators;
@@ -97,6 +104,20 @@ let EditorMenuButton = (() => {
97
104
  else {
98
105
  delete this.dataset.open;
99
106
  }
107
+ // Said again, out loud, for whoever is holding this button — the row
108
+ // it sits on has to know, and `data-open` alone cannot tell it: a
109
+ // picker keeps its menu button inside its OWN shadow root, where no
110
+ // `querySelector` and no `MutationObserver` of the row's reaches. This
111
+ // one bubbles AND is composed, so it crosses every boundary between
112
+ // here and the row. See `EditorToolbar`, which stops clipping while a
113
+ // panel is open. The `toggle` event above is deliberately left as it
114
+ // is: it does not bubble, and things listen for it by that name.
115
+ this.dispatchEvent(new CustomEvent(EDITOR_MENU_TOGGLE, {
116
+ detail: opened,
117
+ bubbles: true,
118
+ cancelable: false,
119
+ composed: true,
120
+ }));
100
121
  },
101
122
  mainAxis: 0,
102
123
  offsetHeight: 6 * 4,
@@ -184,6 +205,15 @@ export class EditorMenuContent extends LitElement {
184
205
  .content-wrapper {
185
206
  overscroll-behavior: contain;
186
207
  overflow-y: auto;
208
+ /* Spelled out because CSS Overflow computes a visible axis to auto as
209
+ * soon as the other one is not visible: the overflow-y above would
210
+ * silently make this popup scrollable SIDEWAYS too. Anything animated by
211
+ * a positive translateX inside it — the palette carousel's incoming page,
212
+ * see color-picker/palette-carousel.ts — then grows the scrollable
213
+ * region for the length of the animation and flashes a horizontal
214
+ * scrollbar (issue #392). Not clip: combined with overflow-y: auto the
215
+ * spec falls it back to hidden anyway. */
216
+ overflow-x: hidden;
187
217
  padding: var(--content-padding, 0 6px);
188
218
  }
189
219
 
@@ -38,6 +38,21 @@ export type PickerMenu<T> = {
38
38
  label: string;
39
39
  icon?: TemplateResult;
40
40
  tooltip?: string;
41
+ /**
42
+ * The accessible name of the MENU shell (`aria-label` on
43
+ * `editor-menu-button`), which the caller supplies whole (#390).
44
+ *
45
+ * It used to be sewn together here as `` `${label.toLowerCase()}-menu` ``.
46
+ * That was a stable identifier while {@link label} was an English literal;
47
+ * once the caller started handing over a TRANSLATED label it became half a
48
+ * sentence in each language ("changer le type de forme-menu"). A menu's
49
+ * accessible name is its own wording, never a composition — the precedent
50
+ * is `ROOT_ALIGNMENT_MENU_ARIA` in `blocks/root`.
51
+ *
52
+ * Left out, the name is composed from {@link label} as before, so a caller
53
+ * that still passes an English literal is unaffected.
54
+ */
55
+ menuAria?: string;
41
56
  items: PickerMenuItem<T>[];
42
57
  currentValue: T;
43
58
  onPick: (value: T) => void;
@@ -51,5 +66,5 @@ export type PickerMenu<T> = {
51
66
  };
52
67
  /** The field of the item that currently matches — its icon, usually. */
53
68
  export declare function renderCurrentPickerItemWith<T, F extends keyof PickerMenuItem<T>>(items: PickerMenuItem<T>[], currentValue: T, field: F): PickerMenuItem<T>[F] | undefined;
54
- export declare function renderPickerMenu<T>({ label, tooltip, icon, items, currentValue, onPick, testId, }: PickerMenu<T>): TemplateResult<1>;
69
+ export declare function renderPickerMenu<T>({ label, tooltip, menuAria, icon, items, currentValue, onPick, testId, }: PickerMenu<T>): TemplateResult<1>;
55
70
  export declare function renderPickerMenuItems<T>(items: PickerMenuItem<T>[], currentValue: T, onPick: (value: T) => void, testId?: string): unknown;
@@ -6,11 +6,11 @@ import { EditorChevronDown } from './chevron-down.js';
6
6
  export function renderCurrentPickerItemWith(items, currentValue, field) {
7
7
  return items.find(({ value }) => value === currentValue)?.[field];
8
8
  }
9
- export function renderPickerMenu({ label, tooltip, icon, items, currentValue, onPick, testId, }) {
9
+ export function renderPickerMenu({ label, tooltip, menuAria, icon, items, currentValue, onPick, testId, }) {
10
10
  return html `
11
11
  <editor-menu-button
12
12
  data-testid=${ifDefined(testId)}
13
- aria-label="${`${label.toLowerCase()}-menu`}"
13
+ aria-label="${menuAria ?? `${label.toLowerCase()}-menu`}"
14
14
  .button=${html `
15
15
  <editor-icon-button
16
16
  data-testid=${ifDefined(testId ? `${testId}-button` : undefined)}
@@ -1,6 +1,7 @@
1
1
  import { LitElement } from 'lit';
2
2
  declare const EditorToolbar_base: typeof LitElement & import("../../global/utils/types.js").Constructor<import("../../global/lit/with-disposable.js").DisposableClass>;
3
3
  export declare class EditorToolbar extends EditorToolbar_base {
4
+ #private;
4
5
  static styles: import("lit").CSSResult;
5
6
  connectedCallback(): void;
6
7
  render(): import("lit-html").TemplateResult<1>;