@formicoidea/labre-core 0.49.0 → 0.51.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 (241) hide show
  1. package/dist/_pkgs/affine-block-attachment/asset-picker.d.ts +24 -0
  2. package/dist/_pkgs/affine-block-attachment/asset-picker.js +87 -0
  3. package/dist/_pkgs/affine-block-attachment/configs/slash-menu.js +3 -20
  4. package/dist/_pkgs/affine-block-attachment/index.d.ts +1 -0
  5. package/dist/_pkgs/affine-block-attachment/index.js +1 -0
  6. package/dist/_pkgs/affine-block-attachment/utils.d.ts +9 -1
  7. package/dist/_pkgs/affine-block-attachment/utils.js +9 -0
  8. package/dist/_pkgs/affine-block-bookmark/adapters/markdown/markdown.js +14 -1
  9. package/dist/_pkgs/affine-block-bookmark/adapters/notion-html.js +5 -1
  10. package/dist/_pkgs/affine-block-database/adapters/markdown.js +5 -3
  11. package/dist/_pkgs/affine-block-embed/common/adapters/html.js +5 -3
  12. package/dist/_pkgs/affine-block-embed/common/adapters/markdown.js +11 -0
  13. package/dist/_pkgs/affine-block-frame/frame-template.d.ts +58 -0
  14. package/dist/_pkgs/affine-block-frame/frame-template.js +207 -0
  15. package/dist/_pkgs/affine-block-frame/frame-toolbar.js +19 -3
  16. package/dist/_pkgs/affine-block-frame/index.d.ts +1 -0
  17. package/dist/_pkgs/affine-block-frame/index.js +1 -0
  18. package/dist/_pkgs/affine-block-frame/translations.d.ts +7 -0
  19. package/dist/_pkgs/affine-block-frame/translations.js +16 -1
  20. package/dist/_pkgs/affine-block-frame/view.js +6 -0
  21. package/dist/_pkgs/affine-block-image/asset-picker.d.ts +63 -0
  22. package/dist/_pkgs/affine-block-image/asset-picker.js +183 -0
  23. package/dist/_pkgs/affine-block-image/commands/insert-images.d.ts +5 -0
  24. package/dist/_pkgs/affine-block-image/commands/insert-images.js +8 -8
  25. package/dist/_pkgs/affine-block-image/components/page-image-block.d.ts +11 -0
  26. package/dist/_pkgs/affine-block-image/components/page-image-block.js +81 -12
  27. package/dist/_pkgs/affine-block-image/configs/replace-action.d.ts +9 -0
  28. package/dist/_pkgs/affine-block-image/configs/replace-action.js +27 -0
  29. package/dist/_pkgs/affine-block-image/configs/toolbar.js +6 -0
  30. package/dist/_pkgs/affine-block-image/crop/crop-controller.d.ts +46 -0
  31. package/dist/_pkgs/affine-block-image/crop/crop-controller.js +104 -0
  32. package/dist/_pkgs/affine-block-image/crop/crop-math.d.ts +70 -0
  33. package/dist/_pkgs/affine-block-image/crop/crop-math.js +141 -0
  34. package/dist/_pkgs/affine-block-image/crop/crop-overlay.d.ts +57 -0
  35. package/dist/_pkgs/affine-block-image/crop/crop-overlay.js +343 -0
  36. package/dist/_pkgs/affine-block-image/crop/crop-toolbar.d.ts +12 -0
  37. package/dist/_pkgs/affine-block-image/crop/crop-toolbar.js +78 -0
  38. package/dist/_pkgs/affine-block-image/crop/write-crop.d.ts +16 -0
  39. package/dist/_pkgs/affine-block-image/crop/write-crop.js +57 -0
  40. package/dist/_pkgs/affine-block-image/edgeless-clipboard-config.js +4 -1
  41. package/dist/_pkgs/affine-block-image/effects.js +2 -0
  42. package/dist/_pkgs/affine-block-image/image-block.d.ts +2 -0
  43. package/dist/_pkgs/affine-block-image/image-block.js +2 -0
  44. package/dist/_pkgs/affine-block-image/image-edgeless-block.d.ts +2 -0
  45. package/dist/_pkgs/affine-block-image/image-edgeless-block.js +36 -8
  46. package/dist/_pkgs/affine-block-image/image-resize-manager.js +15 -0
  47. package/dist/_pkgs/affine-block-image/index.d.ts +1 -0
  48. package/dist/_pkgs/affine-block-image/index.js +1 -0
  49. package/dist/_pkgs/affine-block-image/translations.d.ts +15 -0
  50. package/dist/_pkgs/affine-block-image/translations.js +43 -0
  51. package/dist/_pkgs/affine-block-image/utils.d.ts +13 -0
  52. package/dist/_pkgs/affine-block-image/utils.js +10 -1
  53. package/dist/_pkgs/affine-block-root/clipboard/page-clipboard.js +5 -0
  54. package/dist/_pkgs/affine-block-root/commands/page-export-commands.d.ts +2 -0
  55. package/dist/_pkgs/affine-block-root/commands/page-export-commands.js +71 -0
  56. package/dist/_pkgs/affine-block-root/index.d.ts +1 -0
  57. package/dist/_pkgs/affine-block-root/index.js +1 -0
  58. package/dist/_pkgs/affine-block-root/view.js +8 -0
  59. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.d.ts +30 -0
  60. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.js +44 -0
  61. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.d.ts +26 -0
  62. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.js +82 -0
  63. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.d.ts +18 -0
  64. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.js +91 -0
  65. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.d.ts +3 -0
  66. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.js +3 -0
  67. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.d.ts +50 -0
  68. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.js +732 -0
  69. package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.d.ts +12 -0
  70. package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.js +15 -0
  71. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +7 -1
  72. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +7 -1
  73. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +60 -1
  74. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +2 -2
  75. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +2 -2
  76. package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.d.ts +6 -0
  77. package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.js +8 -0
  78. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +28 -1
  79. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +66 -6
  80. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +2 -7
  81. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +2 -6
  82. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +2 -0
  83. package/dist/_pkgs/affine-block-surface/extensions/index.js +2 -0
  84. package/dist/_pkgs/affine-block-surface/extensions/interchange-export.d.ts +84 -0
  85. package/dist/_pkgs/affine-block-surface/extensions/interchange-export.js +150 -0
  86. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +24 -2
  87. package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +23 -2
  88. package/dist/_pkgs/affine-block-surface/extensions/interchange.js +4 -1
  89. package/dist/_pkgs/affine-block-surface/extensions/legend-role.d.ts +18 -0
  90. package/dist/_pkgs/affine-block-surface/extensions/legend-role.js +20 -0
  91. package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +2 -19
  92. package/dist/_pkgs/affine-block-surface/extensions/legend.js +2 -18
  93. package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.d.ts +67 -0
  94. package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.js +235 -0
  95. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +1 -0
  96. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +9 -0
  97. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +17 -13
  98. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +52 -80
  99. package/dist/_pkgs/affine-block-surface/extensions/xml-element.d.ts +98 -0
  100. package/dist/_pkgs/affine-block-surface/extensions/xml-element.js +261 -0
  101. package/dist/_pkgs/affine-block-surface/extensions/xml-reader.d.ts +238 -0
  102. package/dist/_pkgs/affine-block-surface/extensions/xml-reader.js +570 -0
  103. package/dist/_pkgs/affine-block-surface/framework-background/def.js +1 -1
  104. package/dist/_pkgs/affine-block-surface/interchange-headless.d.ts +29 -0
  105. package/dist/_pkgs/affine-block-surface/interchange-headless.js +32 -0
  106. package/dist/_pkgs/affine-block-surface/view.js +22 -2
  107. package/dist/_pkgs/affine-block-table/adapters/utils.js +24 -1
  108. package/dist/_pkgs/affine-components/color-picker/color-panel.d.ts +11 -0
  109. package/dist/_pkgs/affine-components/color-picker/color-panel.js +87 -12
  110. package/dist/_pkgs/affine-components/color-picker/framework-palette.d.ts +8 -0
  111. package/dist/_pkgs/affine-components/color-picker/framework-palette.js +11 -3
  112. package/dist/_pkgs/affine-components/color-picker/icons.d.ts +9 -0
  113. package/dist/_pkgs/affine-components/color-picker/icons.js +12 -0
  114. package/dist/_pkgs/affine-gfx-note/toolbar/note-menu.js +5 -8
  115. package/dist/_pkgs/affine-gfx-template/contribute.d.ts +14 -4
  116. package/dist/_pkgs/affine-gfx-template/contribute.js +47 -6
  117. package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.d.ts +7 -2
  118. package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.js +14 -40
  119. package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.d.ts +1 -1
  120. package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.js +1 -1
  121. package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.d.ts +4 -4
  122. package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +9 -9
  123. package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +2 -4
  124. package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
  125. package/dist/_pkgs/affine-gfx-template/translations.js +9 -0
  126. package/dist/_pkgs/affine-inline-footnote/adapters/markdown/inline-delta.js +6 -0
  127. package/dist/_pkgs/affine-inline-footnote/adapters/markdown/markdown-inline.js +7 -0
  128. package/dist/_pkgs/affine-inline-link/adapters/html/html-inline.js +4 -1
  129. package/dist/_pkgs/affine-inline-link/adapters/html/inline-delta.js +3 -1
  130. package/dist/_pkgs/affine-inline-link/adapters/markdown/inline-delta.js +4 -1
  131. package/dist/_pkgs/affine-inline-link/adapters/notion-html/html-inline.js +2 -1
  132. package/dist/_pkgs/affine-inline-link/link-node/affine-link.d.ts +7 -0
  133. package/dist/_pkgs/affine-inline-link/link-node/affine-link.js +37 -0
  134. package/dist/_pkgs/affine-inline-link/link-node/index.d.ts +1 -0
  135. package/dist/_pkgs/affine-inline-link/link-node/index.js +1 -0
  136. package/dist/_pkgs/affine-inline-link/link-node/propose-views.d.ts +22 -0
  137. package/dist/_pkgs/affine-inline-link/link-node/propose-views.js +59 -0
  138. package/dist/_pkgs/affine-model/blocks/database/types.d.ts +28 -0
  139. package/dist/_pkgs/affine-model/blocks/image/image-crop.d.ts +48 -0
  140. package/dist/_pkgs/affine-model/blocks/image/image-crop.js +78 -0
  141. package/dist/_pkgs/affine-model/blocks/image/image-model.d.ts +6 -0
  142. package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
  143. package/dist/_pkgs/affine-model/blocks/image/index.d.ts +1 -0
  144. package/dist/_pkgs/affine-model/blocks/image/index.js +1 -0
  145. package/dist/_pkgs/affine-model/consts/shape.d.ts +2 -0
  146. package/dist/_pkgs/affine-model/consts/shape.js +5 -0
  147. package/dist/_pkgs/affine-model/elements/bpmn/consts.d.ts +31 -0
  148. package/dist/_pkgs/affine-model/elements/bpmn/consts.js +31 -0
  149. package/dist/_pkgs/affine-model/elements/bpmn/index.d.ts +1 -0
  150. package/dist/_pkgs/affine-model/elements/bpmn/index.js +1 -0
  151. package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +0 -25
  152. package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -25
  153. package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +0 -2
  154. package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -2
  155. package/dist/_pkgs/affine-model/elements/uml/consts.d.ts +133 -0
  156. package/dist/_pkgs/affine-model/elements/uml/consts.js +107 -0
  157. package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +1 -79
  158. package/dist/_pkgs/affine-model/elements/uml/diagram.js +1 -53
  159. package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +0 -15
  160. package/dist/_pkgs/affine-model/elements/uml/fragment.js +1 -15
  161. package/dist/_pkgs/affine-model/elements/uml/index.d.ts +1 -0
  162. package/dist/_pkgs/affine-model/elements/uml/index.js +1 -0
  163. package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +0 -20
  164. package/dist/_pkgs/affine-model/elements/uml/partition.js +1 -20
  165. package/dist/_pkgs/affine-model/elements/uml/region.d.ts +0 -11
  166. package/dist/_pkgs/affine-model/elements/uml/region.js +1 -11
  167. package/dist/_pkgs/affine-model/headless.d.ts +19 -0
  168. package/dist/_pkgs/affine-model/headless.js +19 -0
  169. package/dist/_pkgs/affine-shared/headless.d.ts +10 -0
  170. package/dist/_pkgs/affine-shared/headless.js +10 -0
  171. package/dist/_pkgs/affine-shared/services/asset-picker-service.d.ts +63 -0
  172. package/dist/_pkgs/affine-shared/services/asset-picker-service.js +20 -0
  173. package/dist/_pkgs/affine-shared/services/data-source-picker-service.d.ts +6 -3
  174. package/dist/_pkgs/affine-shared/services/frame-template-service.d.ts +83 -0
  175. package/dist/_pkgs/affine-shared/services/frame-template-service.js +17 -0
  176. package/dist/_pkgs/affine-shared/services/index.d.ts +2 -0
  177. package/dist/_pkgs/affine-shared/services/index.js +2 -0
  178. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +6 -0
  179. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +10 -0
  180. package/dist/_pkgs/affine-widget-drag-handle/watchers/drag-event-watcher.js +8 -3
  181. package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +4 -16
  182. package/dist/_pkgs/affine-widget-linked-doc/transformers/html.d.ts +7 -0
  183. package/dist/_pkgs/affine-widget-linked-doc/transformers/html.js +25 -24
  184. package/dist/_pkgs/affine-widget-linked-doc/transformers/index.d.ts +1 -1
  185. package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.d.ts +7 -0
  186. package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.js +26 -25
  187. package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.d.ts +23 -0
  188. package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.js +14 -0
  189. package/dist/_pkgs/data-view/core/common/properties.d.ts +29 -0
  190. package/dist/_pkgs/data-view/core/common/properties.js +110 -8
  191. package/dist/_pkgs/data-view/core/common/property-menu.d.ts +44 -1
  192. package/dist/_pkgs/data-view/core/common/property-menu.js +100 -3
  193. package/dist/_pkgs/data-view/core/component/tags/color-carousel.d.ts +41 -0
  194. package/dist/_pkgs/data-view/core/component/tags/color-carousel.js +199 -0
  195. package/dist/_pkgs/data-view/core/component/tags/color-menu.d.ts +49 -0
  196. package/dist/_pkgs/data-view/core/component/tags/color-menu.js +123 -0
  197. package/dist/_pkgs/data-view/core/component/tags/index.d.ts +3 -0
  198. package/dist/_pkgs/data-view/core/component/tags/index.js +3 -0
  199. package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +8 -1
  200. package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +21 -20
  201. package/dist/_pkgs/data-view/core/component/tags/softened-colors.d.ts +42 -0
  202. package/dist/_pkgs/data-view/core/component/tags/softened-colors.js +79 -0
  203. package/dist/_pkgs/data-view/core/data-view.d.ts +8 -1
  204. package/dist/_pkgs/data-view/core/data-view.js +18 -2
  205. package/dist/_pkgs/data-view/core/effect.js +2 -1
  206. package/dist/_pkgs/data-view/core/filter/eval.d.ts +6 -1
  207. package/dist/_pkgs/data-view/core/filter/eval.js +7 -2
  208. package/dist/_pkgs/data-view/core/group-by/renderer/select-group.d.ts +3 -0
  209. package/dist/_pkgs/data-view/core/group-by/renderer/select-group.js +119 -71
  210. package/dist/_pkgs/data-view/core/view/color-rules.d.ts +85 -0
  211. package/dist/_pkgs/data-view/core/view/color-rules.js +165 -0
  212. package/dist/_pkgs/data-view/core/view/index.d.ts +1 -0
  213. package/dist/_pkgs/data-view/core/view/index.js +1 -0
  214. package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +1 -0
  215. package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +1 -0
  216. package/dist/_pkgs/data-view/translations.d.ts +34 -0
  217. package/dist/_pkgs/data-view/translations.js +80 -0
  218. package/dist/_pkgs/data-view/view-presets/gallery/gallery-view.js +7 -1
  219. package/dist/_pkgs/data-view/view-presets/kanban/mobile/card.js +6 -1
  220. package/dist/_pkgs/data-view/view-presets/kanban/pc/card.js +6 -1
  221. package/dist/_pkgs/data-view/view-presets/list/list-view.js +4 -0
  222. package/dist/_pkgs/data-view/view-presets/table/mobile/row.js +3 -0
  223. package/dist/_pkgs/data-view/view-presets/table/pc/header/database-header-column.d.ts +3 -1
  224. package/dist/_pkgs/data-view/view-presets/table/pc/header/database-header-column.js +149 -175
  225. package/dist/_pkgs/data-view/view-presets/table/pc/row/row.js +6 -0
  226. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/color-rules-menu.d.ts +12 -0
  227. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/color-rules-menu.js +206 -0
  228. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +16 -2
  229. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.d.ts +4 -2
  230. package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-settings.js +11 -2
  231. package/dist/commands.js +5 -2
  232. package/dist/host-panels.d.ts +21 -1
  233. package/dist/host-panels.js +50 -10
  234. package/dist/interchange.d.ts +1 -0
  235. package/dist/interchange.js +1 -0
  236. package/dist/model/headless.d.ts +1 -0
  237. package/dist/model/headless.js +1 -0
  238. package/dist/shared/headless.d.ts +1 -0
  239. package/dist/shared/headless.js +1 -0
  240. package/dist/translations.js +8 -1
  241. package/package.json +13 -1
@@ -34,21 +34,23 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
34
34
  };
35
35
  import { menu, popMenu, popupTargetFromElement, } from '../../../../../affine-components/context-menu/index.js';
36
36
  import { SignalWatcher, WithDisposable } from '../../../../../global/lit/index.js';
37
- import { DeleteIcon, DuplicateIcon, FilterIcon, InsertLeftIcon, InsertRightIcon, MoveLeftIcon, MoveRightIcon, SortIcon, ViewIcon, } from '@blocksuite/icons/lit';
38
- import { ShadowlessElement } from '../../../../../std/index.js';
37
+ import { FilterIcon, InsertLeftIcon, InsertRightIcon, MoveLeftIcon, MoveRightIcon, SortIcon, } from '@blocksuite/icons/lit';
38
+ import { ShadowlessElement, stdContext } from '../../../../../std/index.js';
39
+ import { consume } from '@lit/context';
39
40
  import { css } from 'lit';
40
41
  import { property } from 'lit/decorators.js';
41
42
  import { classMap } from 'lit/directives/class-map.js';
42
43
  import { createRef, ref } from 'lit/directives/ref.js';
43
44
  import { styleMap } from 'lit/directives/style-map.js';
44
45
  import { html } from 'lit/static-html.js';
45
- import { inputConfig, typeConfig, } from '../../../../core/common/property-menu.js';
46
+ import { popPropertyMenu } from '../../../../core/common/property-menu.js';
46
47
  import { filterTraitKey } from '../../../../core/filter/trait.js';
47
48
  import { firstFilterByRef } from '../../../../core/filter/utils.js';
48
49
  import { renderUniLit } from '../../../../core/index.js';
49
50
  import { sortTraitKey } from '../../../../core/sort/manager.js';
50
51
  import { createSortUtils } from '../../../../core/sort/utils.js';
51
52
  import { draggable, dragHandler, droppable, } from '../../../../core/utils/wc-dnd/dnd-context.js';
53
+ import { wordingOf } from '../../../../core/utils/wording.js';
52
54
  import { numberFormats } from '../../../../property-presets/number/utils/formats.js';
53
55
  import { createDefaultShowQuickSettingBar, ShowQuickSettingBarKey, } from '../../../../widget-presets/quick-setting-bar/context.js';
54
56
  import { DEFAULT_COLUMN_TITLE_HEIGHT } from '../../consts.js';
@@ -58,6 +60,9 @@ let DatabaseHeaderColumn = (() => {
58
60
  let _column_decorators;
59
61
  let _column_initializers = [];
60
62
  let _column_extraInitializers = [];
63
+ let _std_decorators;
64
+ let _std_initializers = [];
65
+ let _std_extraInitializers = [];
61
66
  let _grabStatus_decorators;
62
67
  let _grabStatus_initializers = [];
63
68
  let _grabStatus_extraInitializers = [];
@@ -68,9 +73,11 @@ let DatabaseHeaderColumn = (() => {
68
73
  static {
69
74
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
70
75
  _column_decorators = [property({ attribute: false })];
76
+ _std_decorators = [consume({ context: stdContext })];
71
77
  _grabStatus_decorators = [property({ attribute: false })];
72
78
  _tableViewLogic_decorators = [property({ attribute: false })];
73
79
  __esDecorate(this, null, _column_decorators, { kind: "accessor", name: "column", static: false, private: false, access: { has: obj => "column" in obj, get: obj => obj.column, set: (obj, value) => { obj.column = value; } }, metadata: _metadata }, _column_initializers, _column_extraInitializers);
80
+ __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);
74
81
  __esDecorate(this, null, _grabStatus_decorators, { kind: "accessor", name: "grabStatus", static: false, private: false, access: { has: obj => "grabStatus" in obj, get: obj => obj.grabStatus, set: (obj, value) => { obj.grabStatus = value; } }, metadata: _metadata }, _grabStatus_initializers, _grabStatus_extraInitializers);
75
82
  __esDecorate(this, null, _tableViewLogic_decorators, { kind: "accessor", name: "tableViewLogic", static: false, private: false, access: { has: obj => "tableViewLogic" in obj, get: obj => obj.tableViewLogic, set: (obj, value) => { obj.tableViewLogic = value; } }, metadata: _metadata }, _tableViewLogic_initializers, _tableViewLogic_extraInitializers);
76
83
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
@@ -132,179 +139,141 @@ let DatabaseHeaderColumn = (() => {
132
139
  }
133
140
  popMenu(ele) {
134
141
  const enableNumberFormatting = this.tableViewManager.featureFlags$.value.enable_number_formatting;
135
- popMenu(popupTargetFromElement(ele ?? this), {
136
- options: {
137
- items: [
138
- inputConfig(this.column),
139
- typeConfig(this.column),
140
- // Number format begin
141
- ...(enableNumberFormatting
142
- ? [
143
- menu.subMenu({
144
- name: 'Number Format',
145
- hide: () => !this.column.dataUpdate ||
146
- this.column.type$.value !== 'number',
147
- options: {
148
- items: [
149
- numberFormatConfig(this.column),
150
- ...numberFormats.map(format => {
151
- const data = this.column.data$.value;
152
- return menu.action({
153
- isSelected: data.format === format.type,
154
- prefix: html `<span
155
- style="font-size: var(--affine-font-base); scale: 1.2;"
156
- >${format.symbol}</span
157
- >`,
158
- name: format.label,
159
- select: () => {
160
- if (data.format === format.type)
161
- return;
162
- this.column.dataUpdate(() => ({
163
- format: format.type,
164
- }));
165
- },
166
- });
167
- }),
168
- ],
169
- },
170
- }),
171
- ]
172
- : []),
173
- // Number format end
174
- menu.group({
175
- items: [
176
- menu.action({
177
- name: 'Hide In View',
178
- prefix: ViewIcon(),
179
- hide: () => !this.column.hideCanSet,
180
- select: () => {
181
- this.column.hideSet(true);
182
- },
183
- }),
184
- ],
185
- }),
186
- menu.group({
187
- items: [
188
- menu.action({
189
- name: 'Filter',
190
- prefix: FilterIcon(),
191
- select: () => this._addFilter(),
192
- }),
193
- menu.action({
194
- name: 'Sort Ascending',
195
- prefix: SortIcon(),
196
- select: () => this._addSort(false),
197
- }),
198
- menu.action({
199
- name: 'Sort Descending',
200
- prefix: SortIcon(),
201
- select: () => this._addSort(true),
202
- }),
203
- ],
204
- }),
205
- menu.group({
206
- items: [
207
- menu.action({
208
- name: 'Insert Left Column',
209
- prefix: InsertLeftIcon(),
210
- select: () => {
211
- this.tableViewManager.propertyAdd({
212
- id: this.column.id,
213
- before: true,
214
- });
215
- Promise.resolve()
216
- .then(() => {
217
- const pre = this.previousElementSibling?.previousElementSibling;
218
- if (pre instanceof DatabaseHeaderColumn) {
219
- pre.editTitle();
220
- pre.scrollIntoView({
221
- inline: 'nearest',
222
- block: 'nearest',
223
- });
224
- }
225
- })
226
- .catch(console.error);
227
- },
228
- }),
229
- menu.action({
230
- name: 'Insert Right Column',
231
- prefix: InsertRightIcon(),
232
- select: () => {
233
- this.tableViewManager.propertyAdd({
234
- id: this.column.id,
235
- before: false,
236
- });
237
- Promise.resolve()
238
- .then(() => {
239
- const next = this.nextElementSibling?.nextElementSibling;
240
- if (next instanceof DatabaseHeaderColumn) {
241
- next.editTitle();
242
- next.scrollIntoView({
243
- inline: 'nearest',
244
- block: 'nearest',
245
- });
246
- }
247
- })
248
- .catch(console.error);
249
- },
250
- }),
251
- menu.action({
252
- name: 'Move Left',
253
- prefix: MoveLeftIcon(),
254
- hide: () => this.column.isFirst$.value,
255
- select: () => {
256
- const prev = this.column.prev$.value;
257
- if (!prev) {
258
- return;
142
+ popPropertyMenu(popupTargetFromElement(ele ?? this), this.column, {
143
+ wording: wordingOf(this.std),
144
+ afterType: [
145
+ ...(enableNumberFormatting
146
+ ? [
147
+ menu.subMenu({
148
+ name: 'Number Format',
149
+ hide: () => !this.column.dataUpdate ||
150
+ this.column.type$.value !== 'number',
151
+ options: {
152
+ items: [
153
+ numberFormatConfig(this.column),
154
+ ...numberFormats.map(format => {
155
+ const data = this.column.data$.value;
156
+ return menu.action({
157
+ isSelected: data.format === format.type,
158
+ prefix: html `<span
159
+ style="font-size: var(--affine-font-base); scale: 1.2;"
160
+ >${format.symbol}</span
161
+ >`,
162
+ name: format.label,
163
+ select: () => {
164
+ if (data.format === format.type)
165
+ return;
166
+ this.column.dataUpdate(() => ({
167
+ format: format.type,
168
+ }));
169
+ },
170
+ });
171
+ }),
172
+ ],
173
+ },
174
+ }),
175
+ ]
176
+ : []),
177
+ ],
178
+ beforeOperations: [
179
+ menu.group({
180
+ items: [
181
+ menu.action({
182
+ name: 'Filter',
183
+ prefix: FilterIcon(),
184
+ select: () => this._addFilter(),
185
+ }),
186
+ menu.action({
187
+ name: 'Sort Ascending',
188
+ prefix: SortIcon(),
189
+ select: () => this._addSort(false),
190
+ }),
191
+ menu.action({
192
+ name: 'Sort Descending',
193
+ prefix: SortIcon(),
194
+ select: () => this._addSort(true),
195
+ }),
196
+ ],
197
+ }),
198
+ menu.group({
199
+ items: [
200
+ menu.action({
201
+ name: 'Insert Left Column',
202
+ prefix: InsertLeftIcon(),
203
+ select: () => {
204
+ this.tableViewManager.propertyAdd({
205
+ id: this.column.id,
206
+ before: true,
207
+ });
208
+ Promise.resolve()
209
+ .then(() => {
210
+ const pre = this.previousElementSibling?.previousElementSibling;
211
+ if (pre instanceof DatabaseHeaderColumn) {
212
+ pre.editTitle();
213
+ pre.scrollIntoView({
214
+ inline: 'nearest',
215
+ block: 'nearest',
216
+ });
259
217
  }
260
- this.column.move({
261
- id: prev.id,
262
- before: true,
263
- });
264
- },
265
- }),
266
- menu.action({
267
- name: 'Move Right',
268
- prefix: MoveRightIcon(),
269
- hide: () => this.column.isLast$.value,
270
- select: () => {
271
- const next = this.column.next$.value;
272
- if (!next) {
273
- return;
218
+ })
219
+ .catch(console.error);
220
+ },
221
+ }),
222
+ menu.action({
223
+ name: 'Insert Right Column',
224
+ prefix: InsertRightIcon(),
225
+ select: () => {
226
+ this.tableViewManager.propertyAdd({
227
+ id: this.column.id,
228
+ before: false,
229
+ });
230
+ Promise.resolve()
231
+ .then(() => {
232
+ const next = this.nextElementSibling?.nextElementSibling;
233
+ if (next instanceof DatabaseHeaderColumn) {
234
+ next.editTitle();
235
+ next.scrollIntoView({
236
+ inline: 'nearest',
237
+ block: 'nearest',
238
+ });
274
239
  }
275
- this.column.move({
276
- id: next.id,
277
- before: false,
278
- });
279
- },
280
- }),
281
- ],
282
- }),
283
- menu.group({
284
- items: [
285
- menu.action({
286
- name: 'Duplicate',
287
- prefix: DuplicateIcon(),
288
- hide: () => !this.column.canDuplicate,
289
- select: () => {
290
- this.column.duplicate?.();
291
- },
292
- }),
293
- menu.action({
294
- name: 'Delete',
295
- prefix: DeleteIcon(),
296
- hide: () => !this.column.canDelete,
297
- select: () => {
298
- this.column.delete?.();
299
- },
300
- class: {
301
- 'delete-item': true,
302
- },
303
- }),
304
- ],
305
- }),
306
- ],
307
- },
240
+ })
241
+ .catch(console.error);
242
+ },
243
+ }),
244
+ menu.action({
245
+ name: 'Move Left',
246
+ prefix: MoveLeftIcon(),
247
+ hide: () => this.column.isFirst$.value,
248
+ select: () => {
249
+ const prev = this.column.prev$.value;
250
+ if (!prev) {
251
+ return;
252
+ }
253
+ this.column.move({
254
+ id: prev.id,
255
+ before: true,
256
+ });
257
+ },
258
+ }),
259
+ menu.action({
260
+ name: 'Move Right',
261
+ prefix: MoveRightIcon(),
262
+ hide: () => this.column.isLast$.value,
263
+ select: () => {
264
+ const next = this.column.next$.value;
265
+ if (!next) {
266
+ return;
267
+ }
268
+ this.column.move({
269
+ id: next.id,
270
+ before: false,
271
+ });
272
+ },
273
+ }),
274
+ ],
275
+ }),
276
+ ],
308
277
  });
309
278
  }
310
279
  widthDragStart(event) {
@@ -385,6 +354,10 @@ let DatabaseHeaderColumn = (() => {
385
354
  #column_accessor_storage;
386
355
  get column() { return this.#column_accessor_storage; }
387
356
  set column(value) { this.#column_accessor_storage = value; }
357
+ #std_accessor_storage;
358
+ /** Absent outside an editor (a unit test): the menu reads English. */
359
+ get std() { return this.#std_accessor_storage; }
360
+ set std(value) { this.#std_accessor_storage = value; }
388
361
  #grabStatus_accessor_storage;
389
362
  get grabStatus() { return this.#grabStatus_accessor_storage; }
390
363
  set grabStatus(value) { this.#grabStatus_accessor_storage = value; }
@@ -461,7 +434,8 @@ let DatabaseHeaderColumn = (() => {
461
434
  this._clickColumn();
462
435
  };
463
436
  this.#column_accessor_storage = __runInitializers(this, _column_initializers, void 0);
464
- this.#grabStatus_accessor_storage = (__runInitializers(this, _column_extraInitializers), __runInitializers(this, _grabStatus_initializers, 'grabEnd'));
437
+ this.#std_accessor_storage = (__runInitializers(this, _column_extraInitializers), __runInitializers(this, _std_initializers, void 0));
438
+ this.#grabStatus_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _grabStatus_initializers, 'grabEnd'));
465
439
  this.#tableViewLogic_accessor_storage = (__runInitializers(this, _grabStatus_extraInitializers), __runInitializers(this, _tableViewLogic_initializers, void 0));
466
440
  __runInitializers(this, _tableViewLogic_extraInitializers);
467
441
  }
@@ -45,6 +45,7 @@ import { html } from 'lit/static-html.js';
45
45
  import { TableViewRowSelection, } from '../../selection.js';
46
46
  import { cellDivider } from '../../styles.js';
47
47
  import { isNewTabClick } from '../../../../core/utils/new-tab-click.js';
48
+ import { paintRowColor, ROW_COLOR_PROPERTY, viewRowColor, } from '../../../../core/view/color-rules.js';
48
49
  import { openDetail, popRowMenu } from '../menu.js';
49
50
  let TableRowView = (() => {
50
51
  let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement));
@@ -69,6 +70,10 @@ let TableRowView = (() => {
69
70
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
70
71
  }
71
72
  static { this.styles = css `
73
+ /* A colour rule (ADR 0036) first, so the selection below still wins. */
74
+ .affine-database-block-row {
75
+ background-color: var(${unsafeCSS(ROW_COLOR_PROPERTY)}, transparent);
76
+ }
72
77
  .affine-database-block-row:has(.row-select-checkbox.selected) {
73
78
  background: var(--affine-primary-color-04);
74
79
  }
@@ -180,6 +185,7 @@ let TableRowView = (() => {
180
185
  }
181
186
  render() {
182
187
  const view = this.view;
188
+ paintRowColor(this, viewRowColor(view, this.rowId));
183
189
  return html `
184
190
  ${view.readonly$.value
185
191
  ? nothing
@@ -0,0 +1,12 @@
1
+ import { type PopupTarget } from '../../../../../affine-components/context-menu/index.js';
2
+ import type { DataViewUILogicBase } from '../../../../core/index.js';
3
+ import type { Wording } from '../../../../core/utils/wording.js';
4
+ /** The list of a view's rules, in order, and "Add a color rule". */
5
+ export declare function popColorRules(target: PopupTarget, dataViewLogic: DataViewUILogicBase, reopen: () => void, wording: Wording): void;
6
+ /**
7
+ * One rule: its conditions (the view filter's editor), its colour (the
8
+ * options' palette), its place in the order, its removal. `back` is the
9
+ * rule list. A rule a peer removed meanwhile shows an empty condition and
10
+ * writes nothing (`colorRuleUpdate` finds no rule by that id).
11
+ */
12
+ export declare function popColorRule(target: PopupTarget, dataViewLogic: DataViewUILogicBase, ruleId: string, back: () => void, wording: Wording): void;
@@ -0,0 +1,206 @@
1
+ import { menu, popMenu, popupTargetFromElement, subMenuMiddleware, } from '../../../../../affine-components/context-menu/index.js';
2
+ import { TOOLBAR_DELETE } from '../../../../../affine-shared/services/index.js';
3
+ import { ArrowDownSmallIcon, ArrowRightSmallIcon, ArrowUpSmallIcon, DeleteIcon, PlusIcon, } from '@blocksuite/icons/lit';
4
+ import { computed } from '@preact/signals-core';
5
+ import { html } from 'lit';
6
+ import { styleMap } from 'lit/directives/style-map.js';
7
+ import { selectOptionColorGrid } from '../../../../core/component/tags/color-menu.js';
8
+ import { selectOptionColors } from '../../../../core/component/tags/colors.js';
9
+ import { popCreateFilter } from '../../../../core/filter/add-filter.js';
10
+ import { emptyFilterGroup } from '../../../../core/filter/utils.js';
11
+ import { colorRuleAdd, colorRuleDelete, colorRuleMove, colorRulePaint, colorRuleUpdate, viewColorRules, } from '../../../../core/view/color-rules.js';
12
+ import { DATA_VIEW_COLOR_RULE, DATA_VIEW_COLOR_RULE_ADD_CONDITION, DATA_VIEW_COLOR_RULE_MOVE_DOWN, DATA_VIEW_COLOR_RULE_MOVE_UP, DATA_VIEW_COLOR_RULE_NO_CONDITION, DATA_VIEW_COLOR_RULES, DATA_VIEW_COLOR_RULES_ADD, } from '../../../../translations.js';
13
+ /**
14
+ * The editor of a view's conditional colours (ADR 0036, labre PRD
15
+ * REQ-DB-10): a view setting, opened from the view settings menu and from
16
+ * the full page's "This view" (`openViewSetting(…, 'color-rules')`). Made of
17
+ * what the view's filter and an option's colour already use, nothing drawn
18
+ * anew: the rule list is a menu, a rule's condition is edited by the view
19
+ * filter's own `<filter-root-view>` and `popCreateFilter`, its colour picked
20
+ * from the select options' swatch grid (`selectOptionColorGrid`).
21
+ */
22
+ function swatch(color) {
23
+ const paint = colorRulePaint(color);
24
+ return html ` <div
25
+ style=${styleMap({
26
+ backgroundColor: paint ?? 'transparent',
27
+ border: paint ? 'none' : '1px dashed var(--affine-border-color)',
28
+ boxSizing: 'border-box',
29
+ borderRadius: '50%',
30
+ width: '20px',
31
+ height: '20px',
32
+ flexShrink: '0',
33
+ })}
34
+ ></div>`;
35
+ }
36
+ /** The property names a rule reads, in the order its conditions name them. */
37
+ function ruleSummary(filter, vars, wording) {
38
+ const names = [];
39
+ const walk = (condition) => {
40
+ if (condition.type === 'group') {
41
+ condition.conditions.forEach(walk);
42
+ return;
43
+ }
44
+ const name = vars.find(v => v.id === condition.left.name)?.name;
45
+ if (name && !names.includes(name))
46
+ names.push(name);
47
+ };
48
+ filter.conditions.forEach(walk);
49
+ return names.length
50
+ ? names.join(', ')
51
+ : wording(DATA_VIEW_COLOR_RULE_NO_CONDITION);
52
+ }
53
+ function colorName(color, wording) {
54
+ const item = selectOptionColors.find(entry => entry.color === colorRulePaint(color));
55
+ if (!item)
56
+ return '';
57
+ return item.wording ? wording(item.wording) : item.name;
58
+ }
59
+ /** The list of a view's rules, in order, and "Add a color rule". */
60
+ export function popColorRules(target, dataViewLogic, reopen, wording) {
61
+ const view = dataViewLogic.view;
62
+ const rules = viewColorRules(view.manager.dataSource.viewDataGet(view.id));
63
+ const self = () => popColorRules(target, dataViewLogic, reopen, wording);
64
+ popMenu(target, {
65
+ options: {
66
+ title: { text: wording(DATA_VIEW_COLOR_RULES), onBack: reopen },
67
+ items: [
68
+ menu.group({
69
+ items: rules.map(rule => menu.action({
70
+ name: ruleSummary(rule.filter, view.vars$.value, wording),
71
+ prefix: swatch(rule.color),
72
+ postfix: html `<div style="font-size: 14px;">
73
+ ${colorName(rule.color, wording)}
74
+ </div>
75
+ ${ArrowRightSmallIcon()}`,
76
+ testId: 'dv-color-rule',
77
+ select: () => {
78
+ popColorRule(target, dataViewLogic, rule.id, self, wording);
79
+ },
80
+ })),
81
+ }),
82
+ menu.group({
83
+ items: [
84
+ menu.action({
85
+ name: wording(DATA_VIEW_COLOR_RULES_ADD),
86
+ prefix: PlusIcon(),
87
+ testId: 'dv-color-rule-add',
88
+ select: () => {
89
+ popCreateFilter(target, {
90
+ vars: view.vars$,
91
+ onBack: self,
92
+ onSelect: filter => {
93
+ const id = colorRuleAdd(view, filter);
94
+ if (id)
95
+ popColorRule(target, dataViewLogic, id, self, wording);
96
+ },
97
+ });
98
+ },
99
+ }),
100
+ ],
101
+ }),
102
+ ],
103
+ },
104
+ });
105
+ }
106
+ /**
107
+ * One rule: its conditions (the view filter's editor), its colour (the
108
+ * options' palette), its place in the order, its removal. `back` is the
109
+ * rule list. A rule a peer removed meanwhile shows an empty condition and
110
+ * writes nothing (`colorRuleUpdate` finds no rule by that id).
111
+ */
112
+ export function popColorRule(target, dataViewLogic, ruleId, back, wording) {
113
+ const view = dataViewLogic.view;
114
+ const dataSource = view.manager.dataSource;
115
+ const rule$ = computed(() => viewColorRules(dataSource.viewDataGet(view.id)).find(rule => rule.id === ruleId));
116
+ const filter$ = computed(() => rule$.value?.filter ?? emptyFilterGroup);
117
+ const setFilter = (filter) => {
118
+ colorRuleUpdate(view, ruleId, { filter });
119
+ };
120
+ const self = () => popColorRule(target, dataViewLogic, ruleId, back, wording);
121
+ const rules = viewColorRules(dataSource.viewDataGet(view.id));
122
+ const index = rules.findIndex(rule => rule.id === ruleId);
123
+ popMenu(target, {
124
+ options: {
125
+ title: { text: wording(DATA_VIEW_COLOR_RULE), onBack: back },
126
+ items: [
127
+ menu.group({
128
+ items: [
129
+ () => html `<filter-root-view
130
+ data-testid="dv-color-rule-conditions"
131
+ .onBack="${back}"
132
+ .vars="${view.vars$}"
133
+ .filterGroup="${filter$}"
134
+ .onChange="${setFilter}"
135
+ ></filter-root-view>`,
136
+ ],
137
+ }),
138
+ menu.group({
139
+ items: [
140
+ menu.action({
141
+ name: wording(DATA_VIEW_COLOR_RULE_ADD_CONDITION),
142
+ prefix: PlusIcon(),
143
+ select: ele => {
144
+ popCreateFilter(popupTargetFromElement(ele), {
145
+ vars: view.vars$,
146
+ onSelect: filter => {
147
+ const value = filter$.peek();
148
+ setFilter({
149
+ ...value,
150
+ conditions: [...value.conditions, filter],
151
+ });
152
+ },
153
+ }, { middleware: subMenuMiddleware });
154
+ return false;
155
+ },
156
+ }),
157
+ ],
158
+ }),
159
+ menu.group({
160
+ name: 'color',
161
+ items: selectOptionColorGrid({
162
+ current: colorRulePaint(rule$.peek()?.color ?? ''),
163
+ say: wording,
164
+ std: dataViewLogic.root.dataViewRenderer?.std,
165
+ select: color => {
166
+ colorRuleUpdate(view, ruleId, { color });
167
+ self();
168
+ },
169
+ }),
170
+ }),
171
+ menu.group({
172
+ items: [
173
+ menu.action({
174
+ name: wording(DATA_VIEW_COLOR_RULE_MOVE_UP),
175
+ prefix: ArrowUpSmallIcon(),
176
+ hide: () => index <= 0,
177
+ select: () => {
178
+ colorRuleMove(view, ruleId, -1);
179
+ self();
180
+ },
181
+ }),
182
+ menu.action({
183
+ name: wording(DATA_VIEW_COLOR_RULE_MOVE_DOWN),
184
+ prefix: ArrowDownSmallIcon(),
185
+ hide: () => index < 0 || index >= rules.length - 1,
186
+ select: () => {
187
+ colorRuleMove(view, ruleId, 1);
188
+ self();
189
+ },
190
+ }),
191
+ menu.action({
192
+ name: wording(TOOLBAR_DELETE),
193
+ prefix: DeleteIcon(),
194
+ class: { 'delete-item': true },
195
+ testId: 'dv-color-rule-delete',
196
+ select: () => {
197
+ colorRuleDelete(view, ruleId);
198
+ back();
199
+ },
200
+ }),
201
+ ],
202
+ }),
203
+ ],
204
+ },
205
+ });
206
+ }