@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
@@ -0,0 +1,445 @@
1
+ /**
2
+ * The palette header a colour picker draws above its swatch grid when more than
3
+ * one palette is on offer (`docs/adr/0027`): the page's name, opening an inline
4
+ * list of every page IN PLACE of the grid, and a wheel over the panel paging
5
+ * like a carousel.
6
+ *
7
+ * A render helper and a stylesheet rather than a custom element: the two
8
+ * pickers that show it (`edgeless-color-picker-button` and
9
+ * `edgeless-shape-color-picker`) live in different shadow roots and already own
10
+ * their own `render()`, and a third element registered in `effects()` would buy
11
+ * nothing but a tag name.
12
+ *
13
+ * Everything here is driven by `click`, never by a default action.
14
+ * `editor-toolbar` cancels every `pointerdown` in its subtree — popper menus
15
+ * included — to keep the canvas selection and the focus where they are
16
+ * (`toolbar/toolbar.ts`), and a cancelled `pointerdown` suppresses the
17
+ * compatibility `mousedown` whose default action is the only thing that opens a
18
+ * native `<select>`. `click` survives that policy untouched, which is why the
19
+ * list is ours and not the platform's.
20
+ *
21
+ * The header is the PANEL'S TITLE, not a bar bolted on top of it: a compact,
22
+ * content-width trigger whose name starts on the very x the section labels
23
+ * ("Fill color", "Border color") and the swatch grid start on. Its hit area
24
+ * comes from padding cancelled by an equal negative margin, so the hover pill
25
+ * bleeds outward while the text itself stays on the panel's left grid line.
26
+ */
27
+ import { ColorScheme, resolveColor } from '../../affine-model/index.js';
28
+ import { translateKey } from '../../affine-shared/services/index.js';
29
+ import { reducedMotionStyle, springDuration, springEasing, } from '../../affine-shared/styles/index.js';
30
+ import { unsafeCSSVarV2 } from '../../affine-shared/theme/index.js';
31
+ import { ArrowDownSmallIcon, DoneIcon } from '@blocksuite/icons/lit';
32
+ import { css, html, nothing } from 'lit';
33
+ import { keyed } from 'lit/directives/keyed.js';
34
+ import { PALETTE_GROUP_CHOOSE } from '../translations.js';
35
+ /** Include in the host component's `static styles`. */
36
+ export const paletteCarouselStyles = css `
37
+ .palette-carousel {
38
+ display: flex;
39
+ align-items: center;
40
+ align-self: stretch;
41
+ padding-bottom: 4px;
42
+ }
43
+
44
+ .palette-carousel-name {
45
+ display: inline-flex;
46
+ /* Content width, not the panel's: a title, not a bar. */
47
+ flex: 0 0 auto;
48
+ align-items: center;
49
+ gap: 2px;
50
+ max-width: 100%;
51
+ min-width: 0;
52
+ /* The hover pill bleeds out by exactly what the padding pushed in, so the
53
+ * name starts on the same x as "Fill color" and as the swatch grid. */
54
+ /* 4px, not the popup's whole 8px gutter: the pill keeps a 4px gap to the popup
55
+ * edge, so its 4px radius stays concentric with the popup's 8px corner. */
56
+ margin: -2px -4px;
57
+ padding: 2px 4px;
58
+ border: none;
59
+ border-radius: 4px;
60
+ background: transparent;
61
+ /* The panel's own type, one step stronger: this names the whole panel. */
62
+ font-family: inherit;
63
+ font-size: inherit;
64
+ font-weight: 500;
65
+ line-height: 22px;
66
+ color: ${unsafeCSSVarV2('text/primary')};
67
+ cursor: pointer;
68
+ outline: none;
69
+ }
70
+
71
+ .palette-carousel-name:hover {
72
+ background: var(--affine-hover-color);
73
+ }
74
+
75
+ .palette-carousel-name:focus-visible {
76
+ outline: 1px solid var(--affine-primary-color);
77
+ outline-offset: -1px;
78
+ }
79
+
80
+ .palette-carousel-name > .label {
81
+ overflow: hidden;
82
+ white-space: nowrap;
83
+ text-overflow: ellipsis;
84
+ /* The name travels with the swatches it names — same keys, same curve. */
85
+ animation: palette-carousel-settle ${springDuration} ${springEasing};
86
+ }
87
+
88
+ .palette-carousel-name > .label[data-direction='next'] {
89
+ animation-name: palette-carousel-next;
90
+ }
91
+
92
+ .palette-carousel-name > .label[data-direction='prev'] {
93
+ animation-name: palette-carousel-prev;
94
+ }
95
+
96
+ .palette-carousel-chevron {
97
+ display: flex;
98
+ flex: 0 0 auto;
99
+ color: ${unsafeCSSVarV2('icon/primary')};
100
+ transition: transform ${springDuration} ${springEasing};
101
+ }
102
+
103
+ .palette-carousel-chevron svg {
104
+ width: 16px;
105
+ height: 16px;
106
+ }
107
+
108
+ .palette-carousel-name[aria-expanded='true'] .palette-carousel-chevron {
109
+ transform: rotate(180deg);
110
+ }
111
+
112
+ .palette-carousel-list {
113
+ display: flex;
114
+ flex-direction: column;
115
+ align-self: stretch;
116
+ box-sizing: content-box;
117
+ /* As wide as whatever it stands in for — the panel measures itself on the
118
+ * way in, see rememberPanelWidth — plus the two gutters its rows bleed
119
+ * into, so the popup never resizes under the cursor. The fallback is the
120
+ * 9-column swatch grid (9 × 20px + 8 × 4px). */
121
+ min-width: calc(var(--palette-panel-width, 212px) + 8px);
122
+ /* Full-bleed rows: the list reaches the popup's padding edge, and its rows
123
+ * put their names back on the panel's grid line with their own padding. */
124
+ margin: 0 -4px;
125
+ /* Nine pages fit without scrolling; the cap is a seatbelt for a tenth. */
126
+ max-height: 280px;
127
+ overflow-y: auto;
128
+ /* Same trap as the popup box that holds this list (issue #392, see
129
+ * toolbar/menu-button.ts): an overflow-y of its own makes the other axis
130
+ * scrollable too, and this list is one long page name — a translation, or
131
+ * a tenth page — away from overflowing it. */
132
+ overflow-x: hidden;
133
+ overscroll-behavior: contain;
134
+ animation: palette-carousel-settle ${springDuration} ${springEasing};
135
+ }
136
+
137
+ .palette-carousel-option {
138
+ display: flex;
139
+ align-items: center;
140
+ gap: 8px;
141
+ padding: 4px;
142
+ border: none;
143
+ border-radius: 4px;
144
+ background: transparent;
145
+ font-family: inherit;
146
+ font-size: inherit;
147
+ color: var(--affine-text-primary-color);
148
+ text-align: left;
149
+ white-space: nowrap;
150
+ cursor: pointer;
151
+ }
152
+
153
+ .palette-carousel-option:hover {
154
+ background: var(--affine-hover-color);
155
+ }
156
+
157
+ .palette-carousel-option:focus-visible {
158
+ outline: 1px solid var(--affine-primary-color);
159
+ outline-offset: -1px;
160
+ }
161
+
162
+ .palette-carousel-option[aria-current='true'] {
163
+ color: var(--affine-primary-color);
164
+ }
165
+
166
+ .palette-carousel-option > .label {
167
+ flex: 1 1 auto;
168
+ overflow: hidden;
169
+ text-overflow: ellipsis;
170
+ }
171
+
172
+ .palette-carousel-dots {
173
+ display: flex;
174
+ flex: 0 0 auto;
175
+ gap: 2px;
176
+ }
177
+
178
+ .palette-carousel-dot {
179
+ width: 8px;
180
+ height: 8px;
181
+ border-radius: 50%;
182
+ box-sizing: border-box;
183
+ border: 0.5px solid ${unsafeCSSVarV2('layer/insideBorder/blackBorder')};
184
+ }
185
+
186
+ .palette-carousel-tick {
187
+ display: flex;
188
+ /* Always the same slot, ticked or not, so the dots line up down the list. */
189
+ flex: 0 0 16px;
190
+ height: 16px;
191
+ color: inherit;
192
+ }
193
+
194
+ .palette-carousel-tick svg {
195
+ width: 16px;
196
+ height: 16px;
197
+ }
198
+
199
+ /* The swatches of ONE page. Re-keyed on the page index, so a page change
200
+ * builds a new box and its entry animation starts from scratch — a burst of
201
+ * wheel events never queues, it replaces. */
202
+ .palette-carousel-page {
203
+ display: flex;
204
+ flex-direction: column;
205
+ align-items: stretch;
206
+ animation: palette-carousel-settle ${springDuration} ${springEasing};
207
+ }
208
+
209
+ .palette-carousel-page[data-direction='next'] {
210
+ animation-name: palette-carousel-next;
211
+ }
212
+
213
+ .palette-carousel-page[data-direction='prev'] {
214
+ animation-name: palette-carousel-prev;
215
+ }
216
+
217
+ /* The easing overshoots (easeOutBack), so each of these travels a little
218
+ * past its resting place and springs back — the "elastic" of the recette. */
219
+ @keyframes palette-carousel-next {
220
+ from {
221
+ transform: translateX(14px);
222
+ opacity: 0;
223
+ }
224
+ to {
225
+ transform: translateX(0);
226
+ opacity: 1;
227
+ }
228
+ }
229
+
230
+ @keyframes palette-carousel-prev {
231
+ from {
232
+ transform: translateX(-14px);
233
+ opacity: 0;
234
+ }
235
+ to {
236
+ transform: translateX(0);
237
+ opacity: 1;
238
+ }
239
+ }
240
+
241
+ @keyframes palette-carousel-settle {
242
+ from {
243
+ transform: scale(0.97);
244
+ opacity: 0;
245
+ }
246
+ to {
247
+ transform: scale(1);
248
+ opacity: 1;
249
+ }
250
+ }
251
+
252
+ ${reducedMotionStyle('.palette-carousel')}
253
+ ${reducedMotionStyle('.palette-carousel-list')}
254
+ ${reducedMotionStyle('.palette-carousel-page')}
255
+ `;
256
+ /**
257
+ * One page per wheel GESTURE, not per time slice. A trackpad flick streams
258
+ * events for a second or more (the inertia tail), so a fixed throttle paged
259
+ * four or five times per flick. A gesture ends when the wheel has been quiet
260
+ * for {@link WHEEL_QUIET_MS}; within one, a further page is granted only to a
261
+ * deliberate, still-strong scroll — never to the fading tail. Module-level
262
+ * stamps are enough because only one picker is ever open.
263
+ *
264
+ * ponytail: hand-tuned thresholds; if they need per-device tuning, accumulate
265
+ * delta into page-sized steps instead.
266
+ */
267
+ const WHEEL_QUIET_MS = 160;
268
+ const WHEEL_REPEAT_MS = 650;
269
+ const WHEEL_REPEAT_MIN_DELTA = 40;
270
+ let lastWheelEventAt = 0;
271
+ let lastWheelPageAt = 0;
272
+ /** How many swatches of a page are shown beside its name, for recognition. */
273
+ const PREVIEW_DOTS = 5;
274
+ /**
275
+ * The wheel handler each host binds on its own PANEL container — the header and
276
+ * the swatch grids alike, because "the mouse has to be on the name" was the
277
+ * second half of the recette's failure.
278
+ *
279
+ * Wrap-around in both directions: the pages are a ring, not a list, and the
280
+ * base palette is always one of them. The direction is the wheel's own sign,
281
+ * never the index delta, so wrapping from the last page to the first still
282
+ * comes in from the right.
283
+ */
284
+ export function paletteCarouselWheel(options) {
285
+ const { groups, index, onPage, open } = options;
286
+ return (e) => {
287
+ if (groups.length < 2)
288
+ return;
289
+ // ctrl+wheel is the pinch-zoom gesture the edgeless board claims on
290
+ // `document` in capture (`edgeless/utils/pinch-zoom.ts`) — not ours.
291
+ if (e.ctrlKey)
292
+ return;
293
+ // While the list is open the wheel belongs to the list, which may scroll.
294
+ if (open)
295
+ return;
296
+ const delta = e.deltaY || e.deltaX;
297
+ if (!delta)
298
+ return;
299
+ // Neither the canvas nor the page moves under an open picker.
300
+ e.preventDefault();
301
+ e.stopPropagation();
302
+ const now = Date.now();
303
+ const newGesture = now - lastWheelEventAt > WHEEL_QUIET_MS;
304
+ lastWheelEventAt = now;
305
+ const sustained = now - lastWheelPageAt > WHEEL_REPEAT_MS &&
306
+ Math.abs(delta) >= WHEEL_REPEAT_MIN_DELTA;
307
+ if (!newGesture && !sustained)
308
+ return;
309
+ lastWheelPageAt = now;
310
+ const forward = delta > 0;
311
+ onPage((index + (forward ? 1 : -1) + groups.length) % groups.length, forward ? 'next' : 'prev');
312
+ };
313
+ }
314
+ /**
315
+ * The swatches of the page on screen, wrapped so that paging slides them in.
316
+ * The host passes its own grid (both of them, in the shape picker, each in its
317
+ * own wrapper — same key, same timing, so the two move together).
318
+ *
319
+ * `keyed` is the whole mechanism: the wrapper is torn down and rebuilt on a
320
+ * page change, which restarts the CSS animation and, by the same token, cancels
321
+ * the one in flight. No JS animation, nothing to queue, and the swatches stay
322
+ * clickable throughout (a CSS animation never takes the pointer).
323
+ */
324
+ export function paletteCarouselPage(options, content) {
325
+ const { groups, index, direction = 'settle' } = options;
326
+ // No carousel, no page: the grid of a picker with a single palette keeps the
327
+ // exact DOM it had before any of this existed.
328
+ if (groups.length < 2)
329
+ return content;
330
+ return keyed(index, html `<div class="palette-carousel-page" data-direction=${direction}>
331
+ ${content}
332
+ </div>`);
333
+ }
334
+ /**
335
+ * The popup must not resize under the cursor when the list takes the grid's
336
+ * place, and a list has no way to know how wide the thing it replaces was — so
337
+ * the panel is measured on the way IN and hands the number down as a custom
338
+ * property. Read from the header's own container, which is the flex column the
339
+ * grid, the section labels and the list all share.
340
+ */
341
+ function rememberPanelWidth(trigger) {
342
+ const panel = trigger.closest('[data-orientation]');
343
+ if (!panel)
344
+ return;
345
+ const { width } = panel.getBoundingClientRect();
346
+ if (width > 0)
347
+ panel.style.setProperty('--palette-panel-width', `${width}px`);
348
+ }
349
+ const dots = (group, theme) => group.palettes.slice(0, PREVIEW_DOTS).map(palette => {
350
+ const value = resolveColor(palette.value, theme);
351
+ return html `<span
352
+ class="palette-carousel-dot"
353
+ style="background:${value.startsWith('--') ? `var(${value})` : value}"
354
+ ></span>`;
355
+ });
356
+ /**
357
+ * The header row — and, when {@link CarouselOptions.open} is set, the list of
358
+ * pages the host draws INSTEAD of its swatch grid. `nothing` when there is
359
+ * nothing to page through, which is what every call site that passes no groups
360
+ * at all gets, so a picker with one palette renders exactly as it did before
361
+ * this existed.
362
+ */
363
+ export function renderPaletteCarousel(options) {
364
+ const { groups, index, onPage, onToggle, open = false, direction = 'settle', std, theme, } = options;
365
+ if (groups.length < 2)
366
+ return nothing;
367
+ const group = groups[index];
368
+ if (!group)
369
+ return nothing;
370
+ const choose = std
371
+ ? translateKey(std, ...PALETTE_GROUP_CHOOSE)
372
+ : PALETTE_GROUP_CHOOSE[1];
373
+ // Every handler below stops the click: the header lives inside an open
374
+ // popper, and `createButtonPopper` hides the menu on any document click whose
375
+ // composed path misses the TRIGGER (`button-popper.ts`).
376
+ //
377
+ // Closing the list re-states the page it was opened on, which changes no
378
+ // page at all and only clears the direction: the grid comes back where it
379
+ // left, without replaying the slide of the last page change.
380
+ const toggle = (e) => {
381
+ e.stopPropagation();
382
+ if (open)
383
+ onPage(index, 'settle');
384
+ else
385
+ rememberPanelWidth(e.currentTarget);
386
+ onToggle(!open);
387
+ };
388
+ const pick = (to) => (e) => {
389
+ e.stopPropagation();
390
+ // A row names its page, so here the index delta IS the direction.
391
+ onPage(to, to === index ? 'settle' : to > index ? 'next' : 'prev');
392
+ onToggle(false);
393
+ };
394
+ // Escape closes the LIST, not the menu: `editor-menu-button` hides the whole
395
+ // popper on an Escape that reaches it, which would be a surprising way out of
396
+ // a list the user only meant to dismiss.
397
+ const keydown = (e) => {
398
+ if (e.key !== 'Escape' || !open)
399
+ return;
400
+ e.stopPropagation();
401
+ onPage(index, 'settle');
402
+ onToggle(false);
403
+ };
404
+ return html `
405
+ <div class="palette-carousel" @keydown=${keydown}>
406
+ <button
407
+ type="button"
408
+ class="palette-carousel-name"
409
+ aria-label=${choose}
410
+ aria-expanded=${open}
411
+ @click=${toggle}
412
+ >
413
+ ${keyed(index, html `<span class="label" data-direction=${direction}
414
+ >${group.label}</span
415
+ >`)}
416
+ <span class="palette-carousel-chevron">${ArrowDownSmallIcon()}</span>
417
+ </button>
418
+ </div>
419
+ ${open
420
+ ? html `
421
+ <div class="palette-carousel-list" @keydown=${keydown}>
422
+ ${groups.map((item, i) => {
423
+ const current = i === index;
424
+ return html `
425
+ <button
426
+ type="button"
427
+ class="palette-carousel-option"
428
+ aria-current=${current ? 'true' : 'false'}
429
+ @click=${pick(i)}
430
+ >
431
+ <span class="label">${item.label}</span>
432
+ <span class="palette-carousel-dots">
433
+ ${dots(item, theme ?? ColorScheme.Light)}
434
+ </span>
435
+ <span class="palette-carousel-tick">
436
+ ${current ? DoneIcon() : nothing}
437
+ </span>
438
+ </button>
439
+ `;
440
+ })}
441
+ </div>
442
+ `
443
+ : nothing}
444
+ `;
445
+ }
@@ -109,7 +109,7 @@ export const COLOR_PICKER_STYLE = css `
109
109
  }
110
110
  .modes .mode button[active] {
111
111
  pointer-events: none;
112
- outline: 2px solid var(--affine-brand-color, #1e96eb);
112
+ outline: 2px solid var(--affine-brand-color);
113
113
  }
114
114
 
115
115
  .content {
@@ -264,7 +264,9 @@ export const menuButtonItems = {
264
264
  const data = {
265
265
  content: () => html `
266
266
  ${config.checked.value
267
- ? CheckBoxCheckSolidIcon({ style: `color:#1E96EB` })
267
+ ? CheckBoxCheckSolidIcon({
268
+ style: `color:var(--affine-primary-color)`,
269
+ })
268
270
  : CheckBoxUnIcon()}
269
271
  <div class="affine-menu-action-text">
270
272
  ${config.label?.() ?? config.name}
@@ -1,6 +1,7 @@
1
1
  import { type Color, type ColorScheme, type LineWidth, type Palette, type ShapeProps, type StrokeStyle } from '../../affine-model/index.js';
2
2
  import type { BlockStdScope } from '../../std/index.js';
3
- import { LitElement } from 'lit';
3
+ import { LitElement, type PropertyValues } from 'lit';
4
+ import { type PaletteCarouselDirection, type PaletteGroup } from '../color-picker/index.js';
4
5
  import type { EditorMenuButton } from '../toolbar/index.js';
5
6
  type TabType = 'normal' | 'custom';
6
7
  type ColorType = Extract<keyof ShapeProps, 'fillColor' | 'strokeColor'>;
@@ -11,6 +12,18 @@ export declare class EdgelessShapeColorPicker extends EdgelessShapeColorPicker_b
11
12
  static styles: import("lit").CSSResult;
12
13
  tabType$: import("@preact/signals-core").Signal<TabType>;
13
14
  colorType$: import("@preact/signals-core").Signal<ColorType>;
15
+ /**
16
+ * The page of {@link paletteGroups} on screen — see the twin getter on
17
+ * `edgeless-color-picker-button` for why a click wins over the prop.
18
+ */
19
+ get groupIndex(): number;
20
+ /** The page on screen, or the caller's own list when there is no carousel. */
21
+ get activePalettes(): readonly Palette[];
22
+ /**
23
+ * A new selection re-opens on ITS framework — see the twin on
24
+ * `edgeless-color-picker-button`.
25
+ */
26
+ willUpdate(changed: PropertyValues): void;
14
27
  get fillColorWithoutAlpha(): string;
15
28
  firstUpdated(): void;
16
29
  render(): import("lit-html").TemplateResult<1>;
@@ -25,6 +38,23 @@ export declare class EdgelessShapeColorPicker extends EdgelessShapeColorPicker_b
25
38
  enableCustomColor: boolean;
26
39
  };
27
40
  accessor palettes: Palette[];
41
+ /**
42
+ * The carousel's pages, base palette first (`docs/adr/0027`). Empty falls
43
+ * back to {@link palettes} and draws no header — the panel as it was.
44
+ */
45
+ accessor paletteGroups: readonly PaletteGroup[];
46
+ /** The page to open on: the framework of the selected element, usually. */
47
+ accessor activeGroupKey: string | undefined;
48
+ /** Component state only, never persisted: which page the user paged TO. */
49
+ accessor pickedGroupIndex: number | undefined;
50
+ /**
51
+ * View state too: whether the header's list of pages is showing IN PLACE of
52
+ * the two grids and the line styles — see the twin on
53
+ * `edgeless-color-picker-button`.
54
+ */
55
+ accessor paletteListOpen: boolean;
56
+ /** Which way the page arrived — see the twin. Both grids take it together. */
57
+ accessor pageDirection: PaletteCarouselDirection;
28
58
  accessor menuButton: EditorMenuButton;
29
59
  }
30
60
  export {};