@formicoidea/labre-core 0.41.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/LICENSE +384 -0
  2. package/dist/_pkgs/affine-block-bookmark/bookmark-block.js +2 -2
  3. package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +7 -1
  4. package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +2 -1
  5. package/dist/_pkgs/affine-block-embed/embed-github-block/embed-github-block.js +2 -1
  6. package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.d.ts +2 -0
  7. package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +5 -0
  8. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +1 -0
  9. package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +30 -8
  10. package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.d.ts +8 -0
  11. package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.js +19 -0
  12. package/dist/_pkgs/affine-block-embed/embed-loom-block/embed-loom-block.js +2 -1
  13. package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +2 -1
  14. package/dist/_pkgs/affine-block-frame/frame-manager.js +1 -1
  15. package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
  16. package/dist/_pkgs/affine-block-frame/frame-toolbar.js +6 -1
  17. package/dist/_pkgs/affine-block-list/list-keymap.js +7 -0
  18. package/dist/_pkgs/affine-block-note/note-keymap.js +7 -1
  19. package/dist/_pkgs/affine-block-paragraph/paragraph-keymap.js +7 -1
  20. package/dist/_pkgs/affine-block-root/commands/pivot-commands.js +1 -8
  21. package/dist/_pkgs/affine-block-root/commands/tag-commands.js +1 -8
  22. package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.d.ts +9 -0
  23. package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +51 -0
  24. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +22 -0
  25. package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +46 -0
  26. package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.d.ts +21 -0
  27. package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.js +24 -0
  28. package/dist/_pkgs/affine-block-root/edgeless/utils/query.js +8 -0
  29. package/dist/_pkgs/affine-block-root/keyboard/keymap.js +1 -16
  30. package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +21 -3
  31. package/dist/_pkgs/affine-block-surface/element-model/index.js +14 -2
  32. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +23 -0
  33. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +89 -0
  34. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +7 -0
  35. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +5 -0
  36. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +41 -0
  37. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +70 -0
  38. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +49 -0
  39. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +257 -0
  40. package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.d.ts +16 -0
  41. package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.js +24 -0
  42. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +24 -0
  43. package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +66 -0
  44. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +4 -0
  45. package/dist/_pkgs/affine-block-surface/extensions/index.js +4 -0
  46. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +66 -4
  47. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +241 -11
  48. package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +18 -0
  49. package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.d.ts +81 -0
  50. package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.js +81 -0
  51. package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +136 -0
  52. package/dist/_pkgs/affine-block-surface/extensions/legend.js +439 -0
  53. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +17 -3
  54. package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +35 -13
  55. package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +61 -1
  56. package/dist/_pkgs/affine-block-surface/extensions/reading.js +85 -39
  57. package/dist/_pkgs/affine-block-surface/extensions/record-action.d.ts +66 -0
  58. package/dist/_pkgs/affine-block-surface/extensions/record-action.js +145 -0
  59. package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +253 -28
  60. package/dist/_pkgs/affine-block-surface/extensions/validation.js +489 -41
  61. package/dist/_pkgs/affine-block-surface/framework-background/background-view.d.ts +115 -0
  62. package/dist/_pkgs/affine-block-surface/framework-background/background-view.js +185 -0
  63. package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +1 -0
  64. package/dist/_pkgs/affine-block-surface/framework-background/index.js +1 -0
  65. package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +16 -1
  66. package/dist/_pkgs/affine-block-surface/framework-background/labels.js +31 -21
  67. package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +29 -5
  68. package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +6 -4
  69. package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +56 -8
  70. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +12 -0
  71. package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +15 -0
  72. package/dist/_pkgs/affine-block-surface/view.js +8 -1
  73. package/dist/_pkgs/affine-block-surface-ref/configs/slash-menu.js +1 -1
  74. package/dist/_pkgs/affine-components/color-picker/button.d.ts +56 -1
  75. package/dist/_pkgs/affine-components/color-picker/button.js +168 -23
  76. package/dist/_pkgs/affine-components/color-picker/framework-palette.d.ts +106 -0
  77. package/dist/_pkgs/affine-components/color-picker/framework-palette.js +177 -0
  78. package/dist/_pkgs/affine-components/color-picker/index.d.ts +2 -0
  79. package/dist/_pkgs/affine-components/color-picker/index.js +2 -0
  80. package/dist/_pkgs/affine-components/color-picker/palette-carousel.d.ts +85 -0
  81. package/dist/_pkgs/affine-components/color-picker/palette-carousel.js +440 -0
  82. package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.d.ts +31 -1
  83. package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +189 -63
  84. package/dist/_pkgs/affine-components/resource/resource.js +29 -16
  85. package/dist/_pkgs/affine-components/translations.d.ts +8 -0
  86. package/dist/_pkgs/affine-components/translations.js +17 -0
  87. package/dist/_pkgs/affine-foundation/view.js +2 -1
  88. package/dist/_pkgs/affine-gfx-brush/element-renderer.js +2 -2
  89. package/dist/_pkgs/affine-gfx-brush/toolbar/configs/brush.js +6 -1
  90. package/dist/_pkgs/affine-gfx-brush/toolbar/configs/highlighter.js +6 -1
  91. package/dist/_pkgs/affine-gfx-connector/connector-manager.d.ts +9 -1
  92. package/dist/_pkgs/affine-gfx-connector/connector-manager.js +61 -0
  93. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.d.ts +7 -1
  94. package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +87 -17
  95. package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +78 -17
  96. package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.d.ts +24 -2
  97. package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +31 -8
  98. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.d.ts +124 -3
  99. package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +216 -54
  100. package/dist/_pkgs/affine-gfx-connector/text/text.d.ts +13 -4
  101. package/dist/_pkgs/affine-gfx-connector/text/text.js +13 -44
  102. package/dist/_pkgs/affine-gfx-connector/toolbar/config.d.ts +56 -0
  103. package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +72 -4
  104. package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.d.ts +8 -0
  105. package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.js +118 -0
  106. package/dist/_pkgs/affine-gfx-connector/view/view.d.ts +37 -1
  107. package/dist/_pkgs/affine-gfx-connector/view/view.js +97 -8
  108. package/dist/_pkgs/affine-gfx-group/command/group-api.js +1 -1
  109. package/dist/_pkgs/affine-gfx-group/store.js +0 -2
  110. package/dist/_pkgs/affine-gfx-group/translations.d.ts +9 -10
  111. package/dist/_pkgs/affine-gfx-group/translations.js +9 -13
  112. package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +1 -1
  113. package/dist/_pkgs/affine-gfx-mindmap/toolbar/basket-elements.js +1 -1
  114. package/dist/_pkgs/affine-gfx-mindmap/toolbar/utils/import-mindmap.js +2 -2
  115. package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +1 -1
  116. package/dist/_pkgs/affine-gfx-mindmap/translations.js +1 -1
  117. package/dist/_pkgs/affine-gfx-shape/element-renderer/highlighter.js +2 -2
  118. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.d.ts +6 -0
  119. package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +30 -1
  120. package/dist/_pkgs/affine-gfx-shape/polygon-tool.d.ts +20 -1
  121. package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +9 -1
  122. package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +6 -1
  123. package/dist/_pkgs/affine-gfx-shape/toolbar/palette-color-action.js +11 -1
  124. package/dist/_pkgs/affine-gfx-template/builtin/other.js +1 -1
  125. package/dist/_pkgs/affine-gfx-template/snapshot-from-action.js +32 -119
  126. package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +1 -1
  127. package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.d.ts +13 -1
  128. package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.js +19 -4
  129. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.d.ts +41 -0
  130. package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +57 -2
  131. package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +8 -1
  132. package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +12 -2
  133. package/dist/_pkgs/affine-gfx-text/translations.d.ts +1 -0
  134. package/dist/_pkgs/affine-gfx-text/translations.js +2 -1
  135. package/dist/_pkgs/affine-inline-preset/markdown.js +5 -1
  136. package/dist/_pkgs/affine-model/consts/connector.d.ts +28 -2
  137. package/dist/_pkgs/affine-model/consts/connector.js +26 -0
  138. package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -1
  139. package/dist/_pkgs/affine-model/elements/brush/brush.js +1 -1
  140. package/dist/_pkgs/affine-model/elements/c4/board.js +1 -1
  141. package/dist/_pkgs/affine-model/elements/c4/boundary.js +1 -1
  142. package/dist/_pkgs/affine-model/elements/connector/connector.d.ts +135 -0
  143. package/dist/_pkgs/affine-model/elements/connector/connector.js +246 -5
  144. package/dist/_pkgs/affine-model/elements/connector/end-label.d.ts +83 -0
  145. package/dist/_pkgs/affine-model/elements/connector/end-label.js +119 -0
  146. package/dist/_pkgs/affine-model/elements/connector/index.d.ts +1 -0
  147. package/dist/_pkgs/affine-model/elements/connector/index.js +1 -0
  148. package/dist/_pkgs/affine-model/elements/context-map/context-map.js +1 -1
  149. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +28 -0
  150. package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +129 -2
  151. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.d.ts +8 -0
  152. package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +45 -2
  153. package/dist/_pkgs/affine-model/elements/edgy/board.js +1 -1
  154. package/dist/_pkgs/affine-model/elements/edgy/facets.js +1 -1
  155. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +6 -0
  156. package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +36 -2
  157. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +18 -7
  158. package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +23 -8
  159. package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +16 -0
  160. package/dist/_pkgs/affine-model/elements/framework-background/background.js +18 -0
  161. package/dist/_pkgs/affine-model/elements/highlighter/highlighter.js +1 -1
  162. package/dist/_pkgs/affine-model/elements/index.d.ts +8 -0
  163. package/dist/_pkgs/affine-model/elements/index.js +1 -0
  164. package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -1
  165. package/dist/_pkgs/affine-model/elements/text/text.js +1 -1
  166. package/dist/_pkgs/affine-model/elements/uml/band.d.ts +39 -0
  167. package/dist/_pkgs/affine-model/elements/uml/band.js +31 -0
  168. package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +158 -0
  169. package/dist/_pkgs/affine-model/elements/uml/diagram.js +229 -0
  170. package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +161 -0
  171. package/dist/_pkgs/affine-model/elements/uml/fragment.js +205 -0
  172. package/dist/_pkgs/affine-model/elements/uml/index.d.ts +8 -0
  173. package/dist/_pkgs/affine-model/elements/uml/index.js +8 -0
  174. package/dist/_pkgs/affine-model/elements/uml/lifeline.d.ts +77 -0
  175. package/dist/_pkgs/affine-model/elements/uml/lifeline.js +89 -0
  176. package/dist/_pkgs/affine-model/elements/uml/node.d.ts +142 -0
  177. package/dist/_pkgs/affine-model/elements/uml/node.js +190 -0
  178. package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +106 -0
  179. package/dist/_pkgs/affine-model/elements/uml/partition.js +172 -0
  180. package/dist/_pkgs/affine-model/elements/uml/region.d.ts +75 -0
  181. package/dist/_pkgs/affine-model/elements/uml/region.js +150 -0
  182. package/dist/_pkgs/affine-model/elements/uml/subject.d.ts +37 -0
  183. package/dist/_pkgs/affine-model/elements/uml/subject.js +108 -0
  184. package/dist/_pkgs/affine-model/elements/wardley/wardley.js +1 -1
  185. package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.d.ts +1 -0
  186. package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +7 -0
  187. package/dist/_pkgs/affine-shared/services/font-loader/config.js +43 -0
  188. package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +1 -9
  189. package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.d.ts +53 -0
  190. package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.js +95 -0
  191. package/dist/_pkgs/affine-shared/services/telemetry-service/index.d.ts +1 -0
  192. package/dist/_pkgs/affine-shared/services/telemetry-service/index.js +1 -0
  193. package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +26 -1
  194. package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
  195. package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.d.ts +34 -0
  196. package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.js +63 -0
  197. package/dist/_pkgs/affine-shared/services/toolbar-service/index.d.ts +1 -0
  198. package/dist/_pkgs/affine-shared/services/toolbar-service/index.js +1 -0
  199. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +77 -7
  200. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +97 -7
  201. package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
  202. package/dist/_pkgs/affine-shared/styles/index.js +1 -0
  203. package/dist/_pkgs/affine-shared/styles/motion.d.ts +14 -0
  204. package/dist/_pkgs/affine-shared/styles/motion.js +38 -0
  205. package/dist/_pkgs/affine-shared/utils/event.d.ts +10 -0
  206. package/dist/_pkgs/affine-shared/utils/event.js +20 -0
  207. package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +16 -0
  208. package/dist/_pkgs/affine-shared/utils/file/filesys.js +25 -0
  209. package/dist/_pkgs/affine-shared/utils/index.d.ts +1 -0
  210. package/dist/_pkgs/affine-shared/utils/index.js +1 -0
  211. package/dist/_pkgs/affine-shared/utils/link-preview-refresh.d.ts +12 -0
  212. package/dist/_pkgs/affine-shared/utils/link-preview-refresh.js +13 -0
  213. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +12 -4
  214. package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +27 -4
  215. package/dist/_pkgs/affine-widget-edgeless-toolbar/create-popper.js +13 -0
  216. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +2 -0
  217. package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +2 -0
  218. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +80 -0
  219. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +270 -81
  220. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.d.ts +15 -0
  221. package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.js +15 -0
  222. package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-weight-and-style-panel.js +8 -1
  223. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.d.ts +42 -0
  224. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.js +100 -0
  225. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.d.ts +100 -0
  226. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.js +274 -0
  227. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.d.ts +3 -0
  228. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.js +3 -0
  229. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.d.ts +25 -0
  230. package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.js +67 -0
  231. package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +5 -0
  232. package/dist/_pkgs/global/gfx/xywh.js +7 -0
  233. package/dist/_pkgs/std/extension/command-registry.d.ts +158 -1
  234. package/dist/_pkgs/std/extension/command-registry.js +22 -0
  235. package/dist/_pkgs/std/gfx/index.d.ts +1 -1
  236. package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.d.ts +12 -0
  237. package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +20 -1
  238. package/dist/_pkgs/std/gfx/interactivity/manager.d.ts +10 -0
  239. package/dist/_pkgs/std/gfx/interactivity/manager.js +12 -0
  240. package/dist/_pkgs/std/gfx/model/surface/element-model.js +12 -7
  241. package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +56 -0
  242. package/dist/_pkgs/std/gfx/model/surface/surface-model.js +84 -3
  243. package/dist/_pkgs/std/gfx/view/view.d.ts +11 -2
  244. package/dist/_pkgs/std/gfx/view/view.js +16 -2
  245. package/dist/commands.d.ts +6 -0
  246. package/dist/commands.js +8 -1
  247. package/dist/frameworks.d.ts +9 -0
  248. package/dist/frameworks.js +19 -0
  249. package/dist/translations.js +16 -0
  250. package/package.json +9 -4
  251. package/dist/_pkgs/affine-gfx-group/group-watcher.d.ts +0 -1
  252. package/dist/_pkgs/affine-gfx-group/group-watcher.js +0 -20
@@ -0,0 +1,440 @@
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
+ overscroll-behavior: contain;
129
+ animation: palette-carousel-settle ${springDuration} ${springEasing};
130
+ }
131
+
132
+ .palette-carousel-option {
133
+ display: flex;
134
+ align-items: center;
135
+ gap: 8px;
136
+ padding: 4px;
137
+ border: none;
138
+ border-radius: 4px;
139
+ background: transparent;
140
+ font-family: inherit;
141
+ font-size: inherit;
142
+ color: var(--affine-text-primary-color);
143
+ text-align: left;
144
+ white-space: nowrap;
145
+ cursor: pointer;
146
+ }
147
+
148
+ .palette-carousel-option:hover {
149
+ background: var(--affine-hover-color);
150
+ }
151
+
152
+ .palette-carousel-option:focus-visible {
153
+ outline: 1px solid var(--affine-primary-color);
154
+ outline-offset: -1px;
155
+ }
156
+
157
+ .palette-carousel-option[aria-current='true'] {
158
+ color: var(--affine-primary-color);
159
+ }
160
+
161
+ .palette-carousel-option > .label {
162
+ flex: 1 1 auto;
163
+ overflow: hidden;
164
+ text-overflow: ellipsis;
165
+ }
166
+
167
+ .palette-carousel-dots {
168
+ display: flex;
169
+ flex: 0 0 auto;
170
+ gap: 2px;
171
+ }
172
+
173
+ .palette-carousel-dot {
174
+ width: 8px;
175
+ height: 8px;
176
+ border-radius: 50%;
177
+ box-sizing: border-box;
178
+ border: 0.5px solid ${unsafeCSSVarV2('layer/insideBorder/blackBorder')};
179
+ }
180
+
181
+ .palette-carousel-tick {
182
+ display: flex;
183
+ /* Always the same slot, ticked or not, so the dots line up down the list. */
184
+ flex: 0 0 16px;
185
+ height: 16px;
186
+ color: inherit;
187
+ }
188
+
189
+ .palette-carousel-tick svg {
190
+ width: 16px;
191
+ height: 16px;
192
+ }
193
+
194
+ /* The swatches of ONE page. Re-keyed on the page index, so a page change
195
+ * builds a new box and its entry animation starts from scratch — a burst of
196
+ * wheel events never queues, it replaces. */
197
+ .palette-carousel-page {
198
+ display: flex;
199
+ flex-direction: column;
200
+ align-items: stretch;
201
+ animation: palette-carousel-settle ${springDuration} ${springEasing};
202
+ }
203
+
204
+ .palette-carousel-page[data-direction='next'] {
205
+ animation-name: palette-carousel-next;
206
+ }
207
+
208
+ .palette-carousel-page[data-direction='prev'] {
209
+ animation-name: palette-carousel-prev;
210
+ }
211
+
212
+ /* The easing overshoots (easeOutBack), so each of these travels a little
213
+ * past its resting place and springs back — the "elastic" of the recette. */
214
+ @keyframes palette-carousel-next {
215
+ from {
216
+ transform: translateX(14px);
217
+ opacity: 0;
218
+ }
219
+ to {
220
+ transform: translateX(0);
221
+ opacity: 1;
222
+ }
223
+ }
224
+
225
+ @keyframes palette-carousel-prev {
226
+ from {
227
+ transform: translateX(-14px);
228
+ opacity: 0;
229
+ }
230
+ to {
231
+ transform: translateX(0);
232
+ opacity: 1;
233
+ }
234
+ }
235
+
236
+ @keyframes palette-carousel-settle {
237
+ from {
238
+ transform: scale(0.97);
239
+ opacity: 0;
240
+ }
241
+ to {
242
+ transform: scale(1);
243
+ opacity: 1;
244
+ }
245
+ }
246
+
247
+ ${reducedMotionStyle('.palette-carousel')}
248
+ ${reducedMotionStyle('.palette-carousel-list')}
249
+ ${reducedMotionStyle('.palette-carousel-page')}
250
+ `;
251
+ /**
252
+ * One page per wheel GESTURE, not per time slice. A trackpad flick streams
253
+ * events for a second or more (the inertia tail), so a fixed throttle paged
254
+ * four or five times per flick. A gesture ends when the wheel has been quiet
255
+ * for {@link WHEEL_QUIET_MS}; within one, a further page is granted only to a
256
+ * deliberate, still-strong scroll — never to the fading tail. Module-level
257
+ * stamps are enough because only one picker is ever open.
258
+ *
259
+ * ponytail: hand-tuned thresholds; if they need per-device tuning, accumulate
260
+ * delta into page-sized steps instead.
261
+ */
262
+ const WHEEL_QUIET_MS = 160;
263
+ const WHEEL_REPEAT_MS = 650;
264
+ const WHEEL_REPEAT_MIN_DELTA = 40;
265
+ let lastWheelEventAt = 0;
266
+ let lastWheelPageAt = 0;
267
+ /** How many swatches of a page are shown beside its name, for recognition. */
268
+ const PREVIEW_DOTS = 5;
269
+ /**
270
+ * The wheel handler each host binds on its own PANEL container — the header and
271
+ * the swatch grids alike, because "the mouse has to be on the name" was the
272
+ * second half of the recette's failure.
273
+ *
274
+ * Wrap-around in both directions: the pages are a ring, not a list, and the
275
+ * base palette is always one of them. The direction is the wheel's own sign,
276
+ * never the index delta, so wrapping from the last page to the first still
277
+ * comes in from the right.
278
+ */
279
+ export function paletteCarouselWheel(options) {
280
+ const { groups, index, onPage, open } = options;
281
+ return (e) => {
282
+ if (groups.length < 2)
283
+ return;
284
+ // ctrl+wheel is the pinch-zoom gesture the edgeless board claims on
285
+ // `document` in capture (`edgeless/utils/pinch-zoom.ts`) — not ours.
286
+ if (e.ctrlKey)
287
+ return;
288
+ // While the list is open the wheel belongs to the list, which may scroll.
289
+ if (open)
290
+ return;
291
+ const delta = e.deltaY || e.deltaX;
292
+ if (!delta)
293
+ return;
294
+ // Neither the canvas nor the page moves under an open picker.
295
+ e.preventDefault();
296
+ e.stopPropagation();
297
+ const now = Date.now();
298
+ const newGesture = now - lastWheelEventAt > WHEEL_QUIET_MS;
299
+ lastWheelEventAt = now;
300
+ const sustained = now - lastWheelPageAt > WHEEL_REPEAT_MS &&
301
+ Math.abs(delta) >= WHEEL_REPEAT_MIN_DELTA;
302
+ if (!newGesture && !sustained)
303
+ return;
304
+ lastWheelPageAt = now;
305
+ const forward = delta > 0;
306
+ onPage((index + (forward ? 1 : -1) + groups.length) % groups.length, forward ? 'next' : 'prev');
307
+ };
308
+ }
309
+ /**
310
+ * The swatches of the page on screen, wrapped so that paging slides them in.
311
+ * The host passes its own grid (both of them, in the shape picker, each in its
312
+ * own wrapper — same key, same timing, so the two move together).
313
+ *
314
+ * `keyed` is the whole mechanism: the wrapper is torn down and rebuilt on a
315
+ * page change, which restarts the CSS animation and, by the same token, cancels
316
+ * the one in flight. No JS animation, nothing to queue, and the swatches stay
317
+ * clickable throughout (a CSS animation never takes the pointer).
318
+ */
319
+ export function paletteCarouselPage(options, content) {
320
+ const { groups, index, direction = 'settle' } = options;
321
+ // No carousel, no page: the grid of a picker with a single palette keeps the
322
+ // exact DOM it had before any of this existed.
323
+ if (groups.length < 2)
324
+ return content;
325
+ return keyed(index, html `<div class="palette-carousel-page" data-direction=${direction}>
326
+ ${content}
327
+ </div>`);
328
+ }
329
+ /**
330
+ * The popup must not resize under the cursor when the list takes the grid's
331
+ * place, and a list has no way to know how wide the thing it replaces was — so
332
+ * the panel is measured on the way IN and hands the number down as a custom
333
+ * property. Read from the header's own container, which is the flex column the
334
+ * grid, the section labels and the list all share.
335
+ */
336
+ function rememberPanelWidth(trigger) {
337
+ const panel = trigger.closest('[data-orientation]');
338
+ if (!panel)
339
+ return;
340
+ const { width } = panel.getBoundingClientRect();
341
+ if (width > 0)
342
+ panel.style.setProperty('--palette-panel-width', `${width}px`);
343
+ }
344
+ const dots = (group, theme) => group.palettes.slice(0, PREVIEW_DOTS).map(palette => {
345
+ const value = resolveColor(palette.value, theme);
346
+ return html `<span
347
+ class="palette-carousel-dot"
348
+ style="background:${value.startsWith('--') ? `var(${value})` : value}"
349
+ ></span>`;
350
+ });
351
+ /**
352
+ * The header row — and, when {@link CarouselOptions.open} is set, the list of
353
+ * pages the host draws INSTEAD of its swatch grid. `nothing` when there is
354
+ * nothing to page through, which is what every call site that passes no groups
355
+ * at all gets, so a picker with one palette renders exactly as it did before
356
+ * this existed.
357
+ */
358
+ export function renderPaletteCarousel(options) {
359
+ const { groups, index, onPage, onToggle, open = false, direction = 'settle', std, theme, } = options;
360
+ if (groups.length < 2)
361
+ return nothing;
362
+ const group = groups[index];
363
+ if (!group)
364
+ return nothing;
365
+ const choose = std
366
+ ? translateKey(std, ...PALETTE_GROUP_CHOOSE)
367
+ : PALETTE_GROUP_CHOOSE[1];
368
+ // Every handler below stops the click: the header lives inside an open
369
+ // popper, and `createButtonPopper` hides the menu on any document click whose
370
+ // composed path misses the TRIGGER (`button-popper.ts`).
371
+ //
372
+ // Closing the list re-states the page it was opened on, which changes no
373
+ // page at all and only clears the direction: the grid comes back where it
374
+ // left, without replaying the slide of the last page change.
375
+ const toggle = (e) => {
376
+ e.stopPropagation();
377
+ if (open)
378
+ onPage(index, 'settle');
379
+ else
380
+ rememberPanelWidth(e.currentTarget);
381
+ onToggle(!open);
382
+ };
383
+ const pick = (to) => (e) => {
384
+ e.stopPropagation();
385
+ // A row names its page, so here the index delta IS the direction.
386
+ onPage(to, to === index ? 'settle' : to > index ? 'next' : 'prev');
387
+ onToggle(false);
388
+ };
389
+ // Escape closes the LIST, not the menu: `editor-menu-button` hides the whole
390
+ // popper on an Escape that reaches it, which would be a surprising way out of
391
+ // a list the user only meant to dismiss.
392
+ const keydown = (e) => {
393
+ if (e.key !== 'Escape' || !open)
394
+ return;
395
+ e.stopPropagation();
396
+ onPage(index, 'settle');
397
+ onToggle(false);
398
+ };
399
+ return html `
400
+ <div class="palette-carousel" @keydown=${keydown}>
401
+ <button
402
+ type="button"
403
+ class="palette-carousel-name"
404
+ aria-label=${choose}
405
+ aria-expanded=${open}
406
+ @click=${toggle}
407
+ >
408
+ ${keyed(index, html `<span class="label" data-direction=${direction}
409
+ >${group.label}</span
410
+ >`)}
411
+ <span class="palette-carousel-chevron">${ArrowDownSmallIcon()}</span>
412
+ </button>
413
+ </div>
414
+ ${open
415
+ ? html `
416
+ <div class="palette-carousel-list" @keydown=${keydown}>
417
+ ${groups.map((item, i) => {
418
+ const current = i === index;
419
+ return html `
420
+ <button
421
+ type="button"
422
+ class="palette-carousel-option"
423
+ aria-current=${current ? 'true' : 'false'}
424
+ @click=${pick(i)}
425
+ >
426
+ <span class="label">${item.label}</span>
427
+ <span class="palette-carousel-dots">
428
+ ${dots(item, theme ?? ColorScheme.Light)}
429
+ </span>
430
+ <span class="palette-carousel-tick">
431
+ ${current ? DoneIcon() : nothing}
432
+ </span>
433
+ </button>
434
+ `;
435
+ })}
436
+ </div>
437
+ `
438
+ : nothing}
439
+ `;
440
+ }
@@ -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 {};