@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
@@ -61,10 +61,12 @@ export function indexOverBackgrounds(siblings, box) {
61
61
  * is still below every artefact already drawn there. Otherwise nothing.
62
62
  * 2. `element` IS a background. If another background it overlaps sits above
63
63
  * it, the same raise applies — superposed boards stack in the order they
64
- * were placed, each still under its own artefacts. Otherwise, if it covers
65
- * an artefact it overlaps, it is acting as a lid: lower it to just above
66
- * the floor it lies on, or to the back of the surface when it lies on bare
67
- * canvas. Otherwise nothing.
64
+ * were placed, each still under its own artefacts — unless it ENCLOSES that
65
+ * background, in which case it is the sheet the other is drawn on and stays
66
+ * under it ({@link encloses}). Otherwise, if it covers an artefact it
67
+ * overlaps, it is acting as a lid: lower it to just above the floor it lies
68
+ * on, or to the back of the surface when it lies on bare canvas. Otherwise
69
+ * nothing.
68
70
  *
69
71
  * `siblings` are the OTHER top-level elements of the surface — canvas elements
70
72
  * and blocks alike, since the surface paints both by index — with `element`
@@ -89,18 +91,64 @@ export function indexOverBackgrounds(siblings, box) {
89
91
  export function stackingIndexFor(element, siblings) {
90
92
  const box = Bound.deserialize(element.xywh);
91
93
  const overlapping = siblings.filter(sibling => Bound.deserialize(sibling.xywh).isOverlapWithBound(box));
92
- const buried = overlapping.some(sibling => sibling.isBackground && sibling.index > element.index);
94
+ // The stack {@link indexOverBackgrounds} is allowed to land ON, which is the
95
+ // same carve-out as `buried`'s applied to the DESTINATION rather than to the
96
+ // question. The recette of 2026-09-15 needed both halves: a frame buried under
97
+ // a PEER board is raised, and the depth it was raised to was read off the
98
+ // unfiltered list — whose topmost overlapping background is the frame's OWN
99
+ // inner subject. So the sheet cleared the peer and landed just above the thing
100
+ // drawn on it, which is the very state `encloses` exists to prevent.
101
+ //
102
+ // DEMOTED, not removed: what it encloses is not a floor it may stand on, but
103
+ // it is still something the minted key has to stay UNDER. Dropping those
104
+ // entries would take the upper bound away with them and `generateKeyBetween`
105
+ // would append past its own content instead of slotting in below it.
106
+ const floors = siblings.map(sibling => encloses(element, box, sibling)
107
+ ? { ...sibling, isBackground: false }
108
+ : sibling);
109
+ const buried = overlapping.some(sibling => sibling.isBackground &&
110
+ sibling.index > element.index &&
111
+ !encloses(element, box, sibling));
93
112
  const lidding = element.isBackground &&
94
113
  overlapping.some(sibling => !sibling.isBackground && sibling.index < element.index);
95
114
  const next = buried
96
- ? indexOverBackgrounds(siblings, box)
115
+ ? indexOverBackgrounds(floors, box)
97
116
  : lidding
98
117
  ? // Down to the floor it lies on, or to the back of the surface when
99
- // there is none — the depth `createWardleyArea` mints by hand.
100
- (indexOverBackgrounds(siblings, box) ?? backOf(siblings))
118
+ // there is none — the depth `createWardleyArea` mints by hand. The back
119
+ // is measured against EVERY sibling: "under everything" means under the
120
+ // content too, enclosed or not.
121
+ (indexOverBackgrounds(floors, box) ?? backOf(siblings))
101
122
  : null;
102
123
  return next === element.index ? null : next;
103
124
  }
125
+ /**
126
+ * Whether `element` is the SHEET `sibling` is drawn on — a background that
127
+ * strictly encloses another background.
128
+ *
129
+ * The carve-out the "superposed boards" clause needs, and the recette of
130
+ * 2026-09-15 is what named it: a UML diagram frame holds inner backgrounds of
131
+ * its own — a use case subject (§18.1.4), an activity partition (§15.6.4), a
132
+ * composite state (§14.2.4), a combined fragment (§17.6.4) — and a C4 board
133
+ * holds boundaries. Every one of them is drawn INSIDE the sheet and therefore
134
+ * above it, which made the sheet permanently "buried" under its own content:
135
+ * moving or resizing it raised it just above the topmost background it
136
+ * overlapped, and when that background was the topmost element of the stack the
137
+ * opaque sheet went to the very front and hid everything drawn on it.
138
+ *
139
+ * Two superposed PEER boards are a different gesture and keep the old answer.
140
+ * The discriminator is containment and not mere overlap: a sheet is bigger than
141
+ * what is drawn on it, so `element` is its floor only when it wholly encloses
142
+ * it AND covers more ground than it. Equal boxes — two boards dropped on the
143
+ * same spot — enclose each other, which is no statement at all, so they are
144
+ * peers and the raise still applies.
145
+ */
146
+ function encloses(element, box, sibling) {
147
+ if (!element.isBackground)
148
+ return false;
149
+ const inner = Bound.deserialize(sibling.xywh);
150
+ return box.contains(inner) && inner.w * inner.h < box.w * box.h;
151
+ }
104
152
  /** A key below every sibling: the back of the surface. */
105
153
  function backOf(siblings) {
106
154
  const lowest = siblings.reduce((min, sibling) => min === null || sibling.index < min ? sibling.index : min, null);
@@ -4,6 +4,7 @@ import type { BlockStdScope } from '../../std/index.js';
4
4
  import type { GfxLocalElementModel, GridManager, LayerManager, SurfaceBlockModel, Viewport } from '../../std/gfx/index.js';
5
5
  import { Subject } from 'rxjs';
6
6
  import type { SurfaceElementModel } from '../element-model/base.js';
7
+ import { RoughCanvas } from '../utils/rough/canvas.js';
7
8
  import type { Overlay } from './overlay.js';
8
9
  type EnvProvider = {
9
10
  generateColorProperty: (color: Color, fallback?: Color) => string;
@@ -131,6 +132,17 @@ export declare class CanvasRenderer {
131
132
  dispose(): void;
132
133
  generateColorProperty(color: Color, fallback?: Color): string;
133
134
  getCanvasByBound(bound?: IBound, surfaceElements?: SurfaceElementModel[], canvas?: HTMLCanvasElement, clearBeforeDrawing?: boolean, withZoom?: boolean): HTMLCanvasElement;
135
+ /**
136
+ * Paint `bound` into any 2D context at 1:1 — no device pixel ratio, no zoom.
137
+ * The SVG export's door: it hands the same element renderers an SVG-emitting
138
+ * context instead of a canvas one.
139
+ *
140
+ * `surfaceElements` is painted in the order given, so a caller that wants the
141
+ * canvas' z-order passes what `GfxController.getElementsByBound` returned
142
+ * (already sorted by `layer.compare`). Omitting it falls back to the grid
143
+ * search, which is NOT layer-ordered.
144
+ */
145
+ renderBoundTo(ctx: CanvasRenderingContext2D, rc: RoughCanvas, bound: IBound, surfaceElements?: SurfaceElementModel[]): void;
134
146
  getColorScheme(): ColorScheme;
135
147
  getColorValue(color: Color, fallback?: Color, real?: boolean): string;
136
148
  getPropertyValue(property: string): string;
@@ -527,6 +527,21 @@ export class CanvasRenderer {
527
527
  this._renderByBound(ctx, matrix, rc, bound, surfaceElements);
528
528
  return canvas;
529
529
  }
530
+ /**
531
+ * Paint `bound` into any 2D context at 1:1 — no device pixel ratio, no zoom.
532
+ * The SVG export's door: it hands the same element renderers an SVG-emitting
533
+ * context instead of a canvas one.
534
+ *
535
+ * `surfaceElements` is painted in the order given, so a caller that wants the
536
+ * canvas' z-order passes what `GfxController.getElementsByBound` returned
537
+ * (already sorted by `layer.compare`). Omitting it falls back to the grid
538
+ * search, which is NOT layer-ordered.
539
+ */
540
+ renderBoundTo(ctx, rc, bound, surfaceElements) {
541
+ const matrix = new DOMMatrix();
542
+ ctx.setTransform(matrix);
543
+ this._renderByBound(ctx, matrix, rc, bound, surfaceElements);
544
+ }
530
545
  getColorScheme() {
531
546
  return this.provider.getColorScheme?.() ?? ColorScheme.Light;
532
547
  }
@@ -1,4 +1,4 @@
1
- import { ThemeProvider } from '../../affine-shared/services/index.js';
1
+ import { getChromeAccentColor } from '../../affine-shared/services/index.js';
2
2
  import { DisposableGroup } from '../../global/disposable/index.js';
3
3
  import { effect } from '@preact/signals-core';
4
4
  import { Overlay } from './overlay.js';
@@ -8,8 +8,6 @@ const HIGHLIGHT_STROKE_WIDTH = 2;
8
8
  const HIGHLIGHT_GAP = 4;
9
9
  /** Ring corner radius, in screen pixels. */
10
10
  const HIGHLIGHT_RADIUS = 4;
11
- /** Used when no theme is provided, matches the legacy frame highlight. */
12
- const FALLBACK_HIGHLIGHT_COLOR = '#1E96EB';
13
11
  /**
14
12
  * Draws the transient emphasis ring around the elements held by
15
13
  * `gfx.highlight` (`ElementHighlightManager`).
@@ -20,10 +18,7 @@ const FALLBACK_HIGHLIGHT_COLOR = '#1E96EB';
20
18
  export class ElementHighlightOverlay extends Overlay {
21
19
  static { this.overlayName = 'element-highlight'; }
22
20
  get _strokeColor() {
23
- return (this.gfx.std
24
- .getOptional(ThemeProvider)
25
- ?.getCssVariableColor('--affine-primary-color') ??
26
- FALLBACK_HIGHLIGHT_COLOR);
21
+ return getChromeAccentColor(this.gfx.std);
27
22
  }
28
23
  constructor(gfx) {
29
24
  super(gfx);
@@ -2,7 +2,7 @@ import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
2
2
  import { BlockViewExtension, CommandExtension, FlavourExtension, } from '../std/index.js';
3
3
  import { literal } from 'lit/static-html.js';
4
4
  import { effects } from './effects.js';
5
- import { auditCommands, EdgelessCRUDExtension, EdgelessLegacySlotExtension, EditPropsMiddlewareBuilder, mapQualityCommands, mapQualityWidget, ReadingManager, readingProposalWidget, readingToolbarExtension, SpotlightManager, ValidationManager, validationExceptionToolbarExtension, ValidationOverlay, violationDetailWidget, } from './extensions/index.js';
5
+ import { auditCommands, EdgelessCRUDExtension, EdgelessLegacySlotExtension, EditPropsMiddlewareBuilder, exportSvgCommands, exportSvgToolbarExtension, mapQualityCommands, mapQualityWidget, ReadingManager, readingProposalWidget, readingToolbarExtension, SpotlightManager, ValidationManager, validationExceptionToolbarExtension, ValidationOverlay, violationDetailWidget, } from './extensions/index.js';
6
6
  import { ExportManagerExtension } from './extensions/export-manager/export-manager.js';
7
7
  import { BackgroundStackingExtension } from './framework-background/stacking.js';
8
8
  import { ElementHighlightOverlay } from './renderer/element-highlight-overlay.js';
@@ -65,6 +65,13 @@ export class SurfaceViewExtension extends ViewExtensionProvider {
65
65
  // extension does.
66
66
  context.register(mapQualityWidget);
67
67
  context.register(CommandExtension(mapQualityCommands));
68
+ // "Export SVG" in the "⋮" of every framework board, and the one command
69
+ // behind it. Generic like the two above and registered on the same terms:
70
+ // a board is a `FrameworkBackgroundElementModel`, whatever framework drew
71
+ // it, so the picture it takes away needs no framework at all
72
+ // (`docs/adr/0025`). Nothing is offered until a board is selected.
73
+ context.register(CommandExtension(exportSvgCommands));
74
+ context.register(exportSvgToolbarExtension);
68
75
  }
69
76
  else {
70
77
  context.register(BlockViewExtension('affine:surface', literal `affine-surface-void`));
@@ -83,7 +83,7 @@ const surfaceRefSlashMenuConfig = {
83
83
  const rootX = x;
84
84
  const rootY = centerVertical - rootH / 2;
85
85
  // Translated HERE and once: the captions are document content the
86
- // moment they land (ADR 0016), so the host's catalogue is asked at
86
+ // moment they land (ADR 0023), so the host's catalogue is asked at
87
87
  // placement and never again.
88
88
  const root = {
89
89
  children: [],
@@ -6,8 +6,8 @@ export const EdgelessTooltip = html `<svg width="170" height="106" viewBox="0 0
6
6
  <rect width="170" height="106" rx="2" fill="white"/>
7
7
  </mask>
8
8
  <g mask="url(#mask0_16460_1252)">
9
- <rect x="100.5" y="42.6565" width="141" height="51" stroke="#1E96EB" stroke-width="3" stroke-dasharray="5 5"/>
10
- <circle cx="101.5" cy="43.5" r="6" fill="white" stroke="#1E96EB" stroke-width="3"/>
9
+ <rect x="100.5" y="42.6565" width="141" height="51" stroke="var(--affine-primary-color)" stroke-width="3" stroke-dasharray="5 5"/>
10
+ <circle cx="101.5" cy="43.5" r="6" fill="white" stroke="var(--affine-primary-color)" stroke-width="3"/>
11
11
  <rect x="105" y="8" width="59" height="26" rx="10" fill="black" fill-opacity="0.1"/>
12
12
  <text fill="#121212" xml:space="preserve" style="white-space: pre" font-family="Inter" font-size="12" letter-spacing="0em"><tspan x="117" y="25.3636">Group</tspan></text>
13
13
  <mask id="mask1_16460_1252" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="98" height="106">
@@ -1,20 +1,50 @@
1
1
  import type { Color, ColorScheme, Palette } 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
4
  import type { EditorMenuButton } from '../toolbar/menu-button.js';
5
+ import type { PaletteGroup } from './framework-palette.js';
6
+ import { type PaletteCarouselDirection } from './palette-carousel.js';
5
7
  import type { PickColorEvent } from './types.js';
6
8
  type Type = 'normal' | 'custom';
7
9
  declare const EdgelessColorPickerButton_base: typeof LitElement & import("../../global/utils/types.js").Constructor<import("../../global/lit/with-disposable.js").DisposableClass>;
8
10
  export declare class EdgelessColorPickerButton extends EdgelessColorPickerButton_base {
9
11
  #private;
12
+ static styles: import("lit").CSSResult;
10
13
  switchToCustomTab: (e: MouseEvent) => void;
11
14
  get colorWithoutAlpha(): string;
12
15
  get customButtonStyle(): {
13
16
  '--b': string;
14
17
  '--c': string;
15
18
  };
19
+ /**
20
+ * The page of {@link paletteGroups} currently on screen — the one the caller
21
+ * asked for until the user pages away from it, and never reset by a re-render
22
+ * (a toolbar rebuilds `paletteGroups` on every update, so reading the prop
23
+ * back would undo the click that moved the carousel).
24
+ */
25
+ get groupIndex(): number;
26
+ /**
27
+ * The swatches on screen: the carousel's current page — unless there is no
28
+ * carousel. A single page means no framework offered hues, and then the
29
+ * caller's own {@link palettes} wins: that is how a Wardley node keeps its
30
+ * notation swatches when the Wardley flag is off, its node toolbar being
31
+ * always-on while its palette is not (`docs/adr/0009`).
32
+ */
33
+ get activePalettes(): readonly Palette[];
34
+ /**
35
+ * "Custom" is measured against the UNION of the pages, not the one on screen:
36
+ * a Wardley blue is one of the offered swatches whichever page is showing,
37
+ * and paging to `Default` must not make the element look custom-coloured.
38
+ */
16
39
  get isCustomColor(): boolean;
17
40
  get tabContentPadding(): string;
41
+ /**
42
+ * A NEW selection re-opens on ITS framework: the page the user paged to
43
+ * belongs to the element they were recolouring, not to the next one. Only a
44
+ * change of {@link activeGroupKey} clears it, so paging survives the
45
+ * re-render the click itself provokes.
46
+ */
47
+ willUpdate(changed: PropertyValues): void;
18
48
  firstUpdated(): void;
19
49
  render(): import("lit-html").TemplateResult<1>;
20
50
  accessor originalColor: Color;
@@ -25,6 +55,31 @@ export declare class EdgelessColorPickerButton extends EdgelessColorPickerButton
25
55
  accessor label: string;
26
56
  accessor menuButton: EditorMenuButton;
27
57
  accessor palettes: Palette[];
58
+ /**
59
+ * The carousel's pages, base palette first (`docs/adr/0027`). Empty — every
60
+ * call site that has not opted in — falls back to {@link palettes} and draws
61
+ * no header, which is exactly the panel this component rendered before.
62
+ */
63
+ accessor paletteGroups: readonly PaletteGroup[];
64
+ /** The page to open on: the framework of the selected element, usually. */
65
+ accessor activeGroupKey: string | undefined;
66
+ /**
67
+ * Component state only, never persisted: which page the user paged TO.
68
+ * `undefined` means "still on the one the caller asked for".
69
+ */
70
+ accessor pickedGroupIndex: number | undefined;
71
+ /**
72
+ * View state, like {@link pickedGroupIndex}: whether the header's list of
73
+ * pages is showing IN PLACE of the swatch grid. Reset when the picker
74
+ * re-opens and when the selection changes, so it never greets a new element.
75
+ */
76
+ accessor paletteListOpen: boolean;
77
+ /**
78
+ * View state again: which way the page on screen arrived, so the swatches
79
+ * and the name slide in from the right side of the panel. Never persisted,
80
+ * and cleared with the rest when the selection changes.
81
+ */
82
+ accessor pageDirection: PaletteCarouselDirection;
28
83
  accessor pick: (event: PickColorEvent) => void;
29
84
  /**
30
85
  * Optional, forwarded to the nested `edgeless-color-panel` — see
@@ -40,6 +40,7 @@ import { choose } from 'lit/directives/choose.js';
40
40
  import { ifDefined } from 'lit/directives/if-defined.js';
41
41
  import { styleMap } from 'lit/directives/style-map.js';
42
42
  import { when } from 'lit-html/directives/when.js';
43
+ import { paletteCarouselPage, paletteCarouselStyles, paletteCarouselWheel, renderPaletteCarousel, } from './palette-carousel.js';
43
44
  import { calcCustomButtonStyle, keepColor, packColorsWith, preprocessColor, rgbaToHex8, } from './utils.js';
44
45
  let EdgelessColorPickerButton = (() => {
45
46
  let _classSuper = WithDisposable(LitElement);
@@ -67,6 +68,21 @@ let EdgelessColorPickerButton = (() => {
67
68
  let _palettes_decorators;
68
69
  let _palettes_initializers = [];
69
70
  let _palettes_extraInitializers = [];
71
+ let _paletteGroups_decorators;
72
+ let _paletteGroups_initializers = [];
73
+ let _paletteGroups_extraInitializers = [];
74
+ let _activeGroupKey_decorators;
75
+ let _activeGroupKey_initializers = [];
76
+ let _activeGroupKey_extraInitializers = [];
77
+ let _pickedGroupIndex_decorators;
78
+ let _pickedGroupIndex_initializers = [];
79
+ let _pickedGroupIndex_extraInitializers = [];
80
+ let _paletteListOpen_decorators;
81
+ let _paletteListOpen_initializers = [];
82
+ let _paletteListOpen_extraInitializers = [];
83
+ let _pageDirection_decorators;
84
+ let _pageDirection_initializers = [];
85
+ let _pageDirection_extraInitializers = [];
70
86
  let _pick_decorators;
71
87
  let _pick_initializers = [];
72
88
  let _pick_extraInitializers = [];
@@ -96,6 +112,11 @@ let EdgelessColorPickerButton = (() => {
96
112
  _label_decorators = [property()];
97
113
  _menuButton_decorators = [query('editor-menu-button')];
98
114
  _palettes_decorators = [property({ attribute: false })];
115
+ _paletteGroups_decorators = [property({ attribute: false })];
116
+ _activeGroupKey_decorators = [property({ attribute: false })];
117
+ _pickedGroupIndex_decorators = [state()];
118
+ _paletteListOpen_decorators = [state()];
119
+ _pageDirection_decorators = [state()];
99
120
  _pick_decorators = [property({ attribute: false })];
100
121
  _std_decorators = [property({ attribute: false })];
101
122
  _tabType_decorators = [state()];
@@ -110,6 +131,11 @@ let EdgelessColorPickerButton = (() => {
110
131
  __esDecorate(this, null, _label_decorators, { kind: "accessor", name: "label", static: false, private: false, access: { has: obj => "label" in obj, get: obj => obj.label, set: (obj, value) => { obj.label = value; } }, metadata: _metadata }, _label_initializers, _label_extraInitializers);
111
132
  __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);
112
133
  __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);
134
+ __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);
135
+ __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);
136
+ __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);
137
+ __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);
138
+ __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);
113
139
  __esDecorate(this, null, _pick_decorators, { kind: "accessor", name: "pick", static: false, private: false, access: { has: obj => "pick" in obj, get: obj => obj.pick, set: (obj, value) => { obj.pick = value; } }, metadata: _metadata }, _pick_initializers, _pick_extraInitializers);
114
140
  __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);
115
141
  __esDecorate(this, null, _tabType_decorators, { kind: "accessor", name: "tabType", static: false, private: false, access: { has: obj => "tabType" in obj, get: obj => obj.tabType, set: (obj, value) => { obj.tabType = value; } }, metadata: _metadata }, _tabType_initializers, _tabType_extraInitializers);
@@ -118,6 +144,7 @@ let EdgelessColorPickerButton = (() => {
118
144
  __esDecorate(this, null, _enableCustomColor_decorators, { kind: "accessor", name: "enableCustomColor", static: false, private: false, access: { has: obj => "enableCustomColor" in obj, get: obj => obj.enableCustomColor, set: (obj, value) => { obj.enableCustomColor = value; } }, metadata: _metadata }, _enableCustomColor_initializers, _enableCustomColor_extraInitializers);
119
145
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
120
146
  }
147
+ static { this.styles = paletteCarouselStyles; }
121
148
  #select;
122
149
  get colorWithoutAlpha() {
123
150
  return keepColor(this.color.startsWith('--')
@@ -130,8 +157,40 @@ let EdgelessColorPickerButton = (() => {
130
157
  get customButtonStyle() {
131
158
  return calcCustomButtonStyle(this.color, this.isCustomColor, this);
132
159
  }
160
+ /**
161
+ * The page of {@link paletteGroups} currently on screen — the one the caller
162
+ * asked for until the user pages away from it, and never reset by a re-render
163
+ * (a toolbar rebuilds `paletteGroups` on every update, so reading the prop
164
+ * back would undo the click that moved the carousel).
165
+ */
166
+ get groupIndex() {
167
+ if (this.pickedGroupIndex !== undefined)
168
+ return this.pickedGroupIndex;
169
+ const asked = this.paletteGroups.findIndex(group => group.key === this.activeGroupKey);
170
+ return asked < 0 ? 0 : asked;
171
+ }
172
+ /**
173
+ * The swatches on screen: the carousel's current page — unless there is no
174
+ * carousel. A single page means no framework offered hues, and then the
175
+ * caller's own {@link palettes} wins: that is how a Wardley node keeps its
176
+ * notation swatches when the Wardley flag is off, its node toolbar being
177
+ * always-on while its palette is not (`docs/adr/0009`).
178
+ */
179
+ get activePalettes() {
180
+ if (this.paletteGroups.length < 2)
181
+ return this.palettes;
182
+ return this.paletteGroups[this.groupIndex]?.palettes ?? this.palettes;
183
+ }
184
+ /**
185
+ * "Custom" is measured against the UNION of the pages, not the one on screen:
186
+ * a Wardley blue is one of the offered swatches whichever page is showing,
187
+ * and paging to `Default` must not make the element look custom-coloured.
188
+ */
133
189
  get isCustomColor() {
134
- return !this.palettes
190
+ const offered = this.paletteGroups.length > 1
191
+ ? this.paletteGroups.flatMap(group => group.palettes)
192
+ : this.palettes;
193
+ return !offered
135
194
  .map(({ value }) => resolveColor(value, this.theme))
136
195
  .includes(this.color);
137
196
  }
@@ -143,9 +202,26 @@ let EdgelessColorPickerButton = (() => {
143
202
  this.pick?.({ type: 'pick', detail });
144
203
  this.pick?.({ type: 'end' });
145
204
  }
205
+ /**
206
+ * A NEW selection re-opens on ITS framework: the page the user paged to
207
+ * belongs to the element they were recolouring, not to the next one. Only a
208
+ * change of {@link activeGroupKey} clears it, so paging survives the
209
+ * re-render the click itself provokes.
210
+ */
211
+ willUpdate(changed) {
212
+ if (changed.has('activeGroupKey')) {
213
+ this.pickedGroupIndex = undefined;
214
+ this.paletteListOpen = false;
215
+ this.pageDirection = 'settle';
216
+ }
217
+ }
218
+ /** Page, and remember which way it went, for the entry animation. */
219
+ #page;
146
220
  firstUpdated() {
147
221
  this.disposables.addFromEvent(this.menuButton, 'toggle', (e) => {
148
222
  const opened = e.detail;
223
+ // A re-opened picker shows its swatches, never the list it was left on.
224
+ this.paletteListOpen = false;
149
225
  if (!opened && this.tabType !== 'normal') {
150
226
  this.tabType = 'normal';
151
227
  }
@@ -177,29 +253,53 @@ let EdgelessColorPickerButton = (() => {
177
253
  [
178
254
  'normal',
179
255
  () => html `
180
- <div data-orientation="vertical">
256
+ <div
257
+ data-orientation="vertical"
258
+ @wheel=${paletteCarouselWheel({
259
+ groups: this.paletteGroups,
260
+ index: this.groupIndex,
261
+ onPage: this.#page,
262
+ open: this.paletteListOpen,
263
+ })}
264
+ >
181
265
  <slot name="other"></slot>
182
266
  <slot name="separator"></slot>
183
- <edgeless-color-panel
184
- role="listbox"
185
- class=${ifDefined(this.colorPanelClass)}
186
- .value=${this.color}
187
- .theme=${this.theme}
188
- .palettes=${this.palettes}
189
- .hollowCircle=${this.hollowCircle}
190
- .hasTransparent=${false}
191
- .std=${this.std}
192
- @select=${this.#select}
193
- >
194
- ${when(this.enableCustomColor, () => html `
195
- <edgeless-color-custom-button
196
- slot="custom"
197
- style=${styleMap(this.customButtonStyle)}
198
- ?active=${this.isCustomColor}
199
- @click=${this.switchToCustomTab}
200
- ></edgeless-color-custom-button>
201
- `)}
202
- </edgeless-color-panel>
267
+ ${renderPaletteCarousel({
268
+ groups: this.paletteGroups,
269
+ index: this.groupIndex,
270
+ onPage: this.#page,
271
+ onToggle: open => (this.paletteListOpen = open),
272
+ open: this.paletteListOpen,
273
+ direction: this.pageDirection,
274
+ std: this.std,
275
+ theme: this.theme,
276
+ })}
277
+ ${when(!this.paletteListOpen, () => paletteCarouselPage({
278
+ groups: this.paletteGroups,
279
+ index: this.groupIndex,
280
+ direction: this.pageDirection,
281
+ }, html `
282
+ <edgeless-color-panel
283
+ role="listbox"
284
+ class=${ifDefined(this.colorPanelClass)}
285
+ .value=${this.color}
286
+ .theme=${this.theme}
287
+ .palettes=${this.activePalettes}
288
+ .hollowCircle=${this.hollowCircle}
289
+ .hasTransparent=${false}
290
+ .std=${this.std}
291
+ @select=${this.#select}
292
+ >
293
+ ${when(this.enableCustomColor, () => html `
294
+ <edgeless-color-custom-button
295
+ slot="custom"
296
+ style=${styleMap(this.customButtonStyle)}
297
+ ?active=${this.isCustomColor}
298
+ @click=${this.switchToCustomTab}
299
+ ></edgeless-color-custom-button>
300
+ `)}
301
+ </edgeless-color-panel>
302
+ `))}
203
303
  </div>
204
304
  `,
205
305
  ],
@@ -246,6 +346,41 @@ let EdgelessColorPickerButton = (() => {
246
346
  #palettes_accessor_storage;
247
347
  get palettes() { return this.#palettes_accessor_storage; }
248
348
  set palettes(value) { this.#palettes_accessor_storage = value; }
349
+ #paletteGroups_accessor_storage;
350
+ /**
351
+ * The carousel's pages, base palette first (`docs/adr/0027`). Empty — every
352
+ * call site that has not opted in — falls back to {@link palettes} and draws
353
+ * no header, which is exactly the panel this component rendered before.
354
+ */
355
+ get paletteGroups() { return this.#paletteGroups_accessor_storage; }
356
+ set paletteGroups(value) { this.#paletteGroups_accessor_storage = value; }
357
+ #activeGroupKey_accessor_storage;
358
+ /** The page to open on: the framework of the selected element, usually. */
359
+ get activeGroupKey() { return this.#activeGroupKey_accessor_storage; }
360
+ set activeGroupKey(value) { this.#activeGroupKey_accessor_storage = value; }
361
+ #pickedGroupIndex_accessor_storage;
362
+ /**
363
+ * Component state only, never persisted: which page the user paged TO.
364
+ * `undefined` means "still on the one the caller asked for".
365
+ */
366
+ get pickedGroupIndex() { return this.#pickedGroupIndex_accessor_storage; }
367
+ set pickedGroupIndex(value) { this.#pickedGroupIndex_accessor_storage = value; }
368
+ #paletteListOpen_accessor_storage;
369
+ /**
370
+ * View state, like {@link pickedGroupIndex}: whether the header's list of
371
+ * pages is showing IN PLACE of the swatch grid. Reset when the picker
372
+ * re-opens and when the selection changes, so it never greets a new element.
373
+ */
374
+ get paletteListOpen() { return this.#paletteListOpen_accessor_storage; }
375
+ set paletteListOpen(value) { this.#paletteListOpen_accessor_storage = value; }
376
+ #pageDirection_accessor_storage;
377
+ /**
378
+ * View state again: which way the page on screen arrived, so the swatches
379
+ * and the name slide in from the right side of the panel. Never persisted,
380
+ * and cleared with the rest when the selection changes.
381
+ */
382
+ get pageDirection() { return this.#pageDirection_accessor_storage; }
383
+ set pageDirection(value) { this.#pageDirection_accessor_storage = value; }
249
384
  #pick_accessor_storage;
250
385
  get pick() { return this.#pick_accessor_storage; }
251
386
  set pick(value) { this.#pick_accessor_storage = value; }
@@ -280,6 +415,11 @@ let EdgelessColorPickerButton = (() => {
280
415
  // refresh menu's position
281
416
  this.menuButton.show(true);
282
417
  };
418
+ /** Page, and remember which way it went, for the entry animation. */
419
+ this.#page = (index, direction) => {
420
+ this.pickedGroupIndex = index;
421
+ this.pageDirection = direction;
422
+ };
283
423
  this.#originalColor_accessor_storage = __runInitializers(this, _originalColor_initializers, void 0);
284
424
  this.#color_accessor_storage = (__runInitializers(this, _originalColor_extraInitializers), __runInitializers(this, _color_initializers, void 0));
285
425
  this.#colorPanelClass_accessor_storage = (__runInitializers(this, _color_extraInitializers), __runInitializers(this, _colorPanelClass_initializers, undefined));
@@ -288,7 +428,12 @@ let EdgelessColorPickerButton = (() => {
288
428
  this.#label_accessor_storage = (__runInitializers(this, _isText_extraInitializers), __runInitializers(this, _label_initializers, void 0));
289
429
  this.#menuButton_accessor_storage = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _menuButton_initializers, void 0));
290
430
  this.#palettes_accessor_storage = (__runInitializers(this, _menuButton_extraInitializers), __runInitializers(this, _palettes_initializers, DefaultTheme.Palettes));
291
- this.#pick_accessor_storage = (__runInitializers(this, _palettes_extraInitializers), __runInitializers(this, _pick_initializers, void 0));
431
+ this.#paletteGroups_accessor_storage = (__runInitializers(this, _palettes_extraInitializers), __runInitializers(this, _paletteGroups_initializers, []));
432
+ this.#activeGroupKey_accessor_storage = (__runInitializers(this, _paletteGroups_extraInitializers), __runInitializers(this, _activeGroupKey_initializers, undefined));
433
+ this.#pickedGroupIndex_accessor_storage = (__runInitializers(this, _activeGroupKey_extraInitializers), __runInitializers(this, _pickedGroupIndex_initializers, undefined));
434
+ this.#paletteListOpen_accessor_storage = (__runInitializers(this, _pickedGroupIndex_extraInitializers), __runInitializers(this, _paletteListOpen_initializers, false));
435
+ this.#pageDirection_accessor_storage = (__runInitializers(this, _paletteListOpen_extraInitializers), __runInitializers(this, _pageDirection_initializers, 'settle'));
436
+ this.#pick_accessor_storage = (__runInitializers(this, _pageDirection_extraInitializers), __runInitializers(this, _pick_initializers, void 0));
292
437
  this.#std_accessor_storage = (__runInitializers(this, _pick_extraInitializers), __runInitializers(this, _std_initializers, undefined));
293
438
  this.#tabType_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _tabType_initializers, 'normal'));
294
439
  this.#theme_accessor_storage = (__runInitializers(this, _tabType_extraInitializers), __runInitializers(this, _theme_initializers, void 0));