@blokkli/editor 2.0.0-alpha.23 → 2.0.0-alpha.25

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 (259) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +252 -92
  3. package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue.d.ts +38 -0
  4. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +1 -1
  5. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +15 -0
  6. package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +6 -0
  7. package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +28 -3
  8. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +6 -4
  9. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +11 -3
  10. package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +138 -3
  11. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +5 -1
  12. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +116 -0
  13. package/dist/runtime/blokkliPlugins/TourItem/index.vue +22 -13
  14. package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +22 -0
  15. package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +98 -0
  16. package/dist/runtime/blokkliPlugins/index.d.ts +1 -3
  17. package/dist/runtime/blokkliPlugins/index.js +0 -4
  18. package/dist/runtime/components/Blocks/NotImplemented/index.vue +24 -0
  19. package/dist/runtime/components/Blocks/NotImplemented/index.vue.d.ts +6 -0
  20. package/dist/runtime/components/BlokkliEditable.vue.d.ts +11 -0
  21. package/dist/runtime/components/BlokkliItem.vue +16 -3
  22. package/dist/runtime/components/BlokkliItem.vue.d.ts +2 -0
  23. package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -1
  24. package/dist/runtime/components/Edit/Actions/ItemDropdown.vue +1 -1
  25. package/dist/runtime/components/Edit/Actions/index.vue +78 -73
  26. package/dist/runtime/components/Edit/AddListItem/index.vue +9 -35
  27. package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +6 -15
  28. package/dist/runtime/components/Edit/AppMenu/MenuButton.vue +39 -0
  29. package/dist/runtime/{blokkliPlugins/MenuButton/index.vue.d.ts → components/Edit/AppMenu/MenuButton.vue.d.ts} +0 -4
  30. package/dist/runtime/components/Edit/AppMenu/index.vue +62 -40
  31. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +6 -0
  32. package/dist/runtime/components/Edit/BlockProxy/index.vue +2 -2
  33. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +3 -0
  34. package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +4 -1
  35. package/dist/runtime/components/Edit/Dialog/index.vue +33 -47
  36. package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +2 -0
  37. package/dist/runtime/components/Edit/DraggableList.vue +12 -9
  38. package/dist/runtime/components/Edit/EditIndicator.vue +11 -4
  39. package/dist/runtime/components/Edit/EditProvider.vue +75 -55
  40. package/dist/runtime/components/Edit/EditProvider.vue.d.ts +1 -1
  41. package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +53 -0
  42. package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue.d.ts +7 -0
  43. package/dist/runtime/components/Edit/Features/AddList/Actions/index.vue +41 -0
  44. package/dist/runtime/components/Edit/Features/AddList/Actions/index.vue.d.ts +5 -0
  45. package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue +13 -50
  46. package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue.d.ts +5 -0
  47. package/dist/runtime/components/Edit/Features/AddList/index.vue +76 -119
  48. package/dist/runtime/components/Edit/Features/Analyze/Icon.vue +85 -0
  49. package/dist/runtime/components/Edit/Features/Analyze/Icon.vue.d.ts +5 -0
  50. package/dist/runtime/components/Edit/Features/Analyze/Main.vue +288 -59
  51. package/dist/runtime/components/Edit/Features/Analyze/Main.vue.d.ts +8 -1
  52. package/dist/runtime/components/Edit/Features/Analyze/Renderer/fragment.glsl +25 -13
  53. package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue +114 -52
  54. package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue.d.ts +16 -2
  55. package/dist/runtime/components/Edit/Features/Analyze/Renderer/vertex.glsl +31 -11
  56. package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue +2 -0
  57. package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue.d.ts +8 -1
  58. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue +4 -4
  59. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue.d.ts +20 -2
  60. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue +11 -18
  61. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue.d.ts +10 -3
  62. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +46 -40
  63. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue.d.ts +10 -4
  64. package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue +8 -4
  65. package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.js +1 -0
  66. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.d.ts +4 -3
  67. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.js +2 -1
  68. package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.js +61 -20
  69. package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.d.ts +15 -1
  70. package/dist/runtime/components/Edit/Features/Analyze/index.vue +23 -2
  71. package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +22 -8
  72. package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +42 -21
  73. package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +10 -4
  74. package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +2 -28
  75. package/dist/runtime/components/Edit/Features/Assistant/index.vue +18 -14
  76. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +11 -1
  77. package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +2 -2
  78. package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +1 -1
  79. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +52 -18
  80. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +0 -2
  81. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue.d.ts +6 -4
  82. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +77 -27
  83. package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +7 -4
  84. package/dist/runtime/components/Edit/Features/Comments/index.vue +2 -2
  85. package/dist/runtime/components/Edit/Features/Debug/Main.vue.d.ts +1 -1
  86. package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +2 -2
  87. package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue.d.ts +1 -1
  88. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue +113 -0
  89. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue.d.ts +25 -0
  90. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +8 -97
  91. package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/fragment.glsl +2 -5
  92. package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/index.vue +38 -5
  93. package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/vertex.glsl +10 -1
  94. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +1 -2
  95. package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +8 -2
  96. package/dist/runtime/components/Edit/Features/EditForm/index.vue +3 -9
  97. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +1 -1
  98. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +4 -3
  99. package/dist/runtime/components/Edit/Features/EditableField/index.vue +2 -2
  100. package/dist/runtime/components/Edit/Features/EditableMask/index.vue +1 -1
  101. package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +7 -2
  102. package/dist/runtime/components/Edit/Features/Exit/index.vue +12 -9
  103. package/dist/runtime/components/Edit/Features/Fragments/index.vue +27 -31
  104. package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +1 -0
  105. package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +25 -24
  106. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +4 -4
  107. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +9 -2
  108. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +13 -3
  109. package/dist/runtime/components/Edit/Features/Library/index.vue +26 -24
  110. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +3 -2
  111. package/dist/runtime/components/Edit/Features/MultiSelect/Renderer/index.vue +1 -3
  112. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +1 -1
  113. package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +3 -1
  114. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +10 -0
  115. package/dist/runtime/components/Edit/Features/Publish/index.vue +17 -15
  116. package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +3 -2
  117. package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +3 -2
  118. package/dist/runtime/components/Edit/Features/Revert/index.vue +24 -18
  119. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +8 -2
  120. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +12 -2
  121. package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +11 -3
  122. package/dist/runtime/components/Edit/Features/Search/index.vue +1 -1
  123. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +128 -31
  124. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +6 -6
  125. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +3 -6
  126. package/dist/runtime/components/Edit/Features/Selection/Renderer/index.vue +1 -1
  127. package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +1 -0
  128. package/dist/runtime/components/Edit/Features/Settings/index.vue +26 -18
  129. package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +3 -3
  130. package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +2 -2
  131. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +3 -3
  132. package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +2 -2
  133. package/dist/runtime/components/Edit/Features/Tour/index.vue +12 -10
  134. package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +7 -1
  135. package/dist/runtime/components/Edit/Features/Transform/index.vue +1 -1
  136. package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -17
  137. package/dist/runtime/components/Edit/Form/Textarea/index.vue +1 -1
  138. package/dist/runtime/components/Edit/FormOverlay/index.vue +13 -4
  139. package/dist/runtime/components/Edit/Indicators/index.vue +1 -1
  140. package/dist/runtime/components/Edit/InfoBox/index.vue +3 -2
  141. package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +6 -1
  142. package/dist/runtime/components/Edit/ItemIconBox/index.vue +41 -0
  143. package/dist/runtime/components/Edit/{AddListItemIcon → ItemIconBox}/index.vue.d.ts +5 -5
  144. package/dist/runtime/components/Edit/Konami/Game/index.vue +0 -1
  145. package/dist/runtime/components/Edit/Konami/index.vue +3 -5
  146. package/dist/runtime/components/Edit/Messages/Item/index.vue +11 -2
  147. package/dist/runtime/components/Edit/Messages/index.vue +6 -1
  148. package/dist/runtime/components/Edit/Overlay/index.vue +70 -0
  149. package/dist/runtime/components/Edit/Overlay/index.vue.d.ts +2 -0
  150. package/dist/runtime/components/Edit/PreviewProvider.vue +3 -3
  151. package/dist/runtime/components/Edit/ScaleToFit/index.vue +4 -4
  152. package/dist/runtime/components/Edit/SystemRequirements/index.vue +36 -36
  153. package/dist/runtime/components/Edit/Toolbar/index.vue +47 -48
  154. package/dist/runtime/components/Edit/index.d.ts +2 -2
  155. package/dist/runtime/components/Edit/index.js +2 -2
  156. package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
  157. package/dist/runtime/composables/useBlokkli.d.ts +6 -1
  158. package/dist/runtime/composables/useBlokkli.js +4 -1
  159. package/dist/runtime/css/output.css +1 -1
  160. package/dist/runtime/helpers/composables/defineAddAction.d.ts +2 -0
  161. package/dist/runtime/helpers/composables/defineAddAction.js +10 -0
  162. package/dist/runtime/helpers/composables/defineElementStyle.d.ts +2 -0
  163. package/dist/runtime/helpers/composables/defineElementStyle.js +33 -0
  164. package/dist/runtime/helpers/composables/defineItemDropdownAction.d.ts +1 -1
  165. package/dist/runtime/helpers/composables/defineItemDropdownAction.js +2 -2
  166. package/dist/runtime/helpers/composables/defineMenuButton.d.ts +2 -0
  167. package/dist/runtime/helpers/composables/defineMenuButton.js +10 -0
  168. package/dist/runtime/helpers/composables/defineRenderer.d.ts +1 -1
  169. package/dist/runtime/helpers/composables/onBroadcastEvent.d.ts +1 -1
  170. package/dist/runtime/helpers/composables/useBlockRegistration.d.ts +1 -1
  171. package/dist/runtime/helpers/composables/useBlockRegistration.js +12 -1
  172. package/dist/runtime/helpers/composables/useDebugLogger.d.ts +1 -1
  173. package/dist/runtime/helpers/composables/useDialog.d.ts +3 -0
  174. package/dist/runtime/helpers/composables/useDialog.js +16 -0
  175. package/dist/runtime/helpers/composables/useFocusTrap.d.ts +52 -0
  176. package/dist/runtime/helpers/composables/useFocusTrap.js +59 -0
  177. package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +1 -1
  178. package/dist/runtime/helpers/{useTransitionedValue.js → composables/useTransitionedValue.js} +1 -1
  179. package/dist/runtime/helpers/dropTargets/index.d.ts +1 -1
  180. package/dist/runtime/helpers/dropTargets/index.js +17 -3
  181. package/dist/runtime/helpers/imports/index.d.ts +2 -1
  182. package/dist/runtime/helpers/imports/index.js +10 -1
  183. package/dist/runtime/helpers/{animationProvider.d.ts → providers/animation.d.ts} +100 -7
  184. package/dist/runtime/helpers/{animationProvider.js → providers/animation.js} +21 -11
  185. package/dist/runtime/helpers/providers/blocks.d.ts +25 -3
  186. package/dist/runtime/helpers/providers/blocks.js +19 -0
  187. package/dist/runtime/helpers/providers/commands.d.ts +41 -0
  188. package/dist/runtime/helpers/{commandsProvider.js → providers/commands.js} +1 -1
  189. package/dist/runtime/helpers/providers/debug.d.ts +125 -0
  190. package/dist/runtime/helpers/{debugProvider.js → providers/debug.js} +2 -2
  191. package/dist/runtime/helpers/providers/definition.d.ts +87 -0
  192. package/dist/runtime/helpers/providers/directive.d.ts +88 -2
  193. package/dist/runtime/helpers/providers/directive.js +18 -2
  194. package/dist/runtime/helpers/providers/dom.d.ts +225 -0
  195. package/dist/runtime/helpers/{domProvider.js → providers/dom.js} +34 -76
  196. package/dist/runtime/helpers/providers/dropArea.d.ts +47 -0
  197. package/dist/runtime/helpers/{dropAreaProvider.js → providers/dropArea.js} +1 -1
  198. package/dist/runtime/helpers/providers/element.d.ts +58 -1
  199. package/dist/runtime/helpers/providers/features.d.ts +56 -0
  200. package/dist/runtime/helpers/{featuresProvider.js → providers/features.js} +1 -1
  201. package/dist/runtime/helpers/providers/fields.d.ts +19 -4
  202. package/dist/runtime/helpers/providers/fields.js +1 -1
  203. package/dist/runtime/helpers/providers/indicators.d.ts +44 -0
  204. package/dist/runtime/helpers/providers/keyboard.d.ts +76 -0
  205. package/dist/runtime/helpers/{keyboardProvider.js → providers/keyboard.js} +1 -8
  206. package/dist/runtime/helpers/providers/plugin.d.ts +81 -0
  207. package/dist/runtime/helpers/providers/plugin.js +64 -0
  208. package/dist/runtime/helpers/{selectionProvider.d.ts → providers/selection.d.ts} +4 -1
  209. package/dist/runtime/helpers/{selectionProvider.js → providers/selection.js} +1 -1
  210. package/dist/runtime/helpers/providers/state.d.ts +227 -0
  211. package/dist/runtime/helpers/{stateProvider.js → providers/state.js} +3 -3
  212. package/dist/runtime/helpers/providers/storage.d.ts +64 -0
  213. package/dist/runtime/helpers/{textProvider.d.ts → providers/texts.d.ts} +1 -1
  214. package/dist/runtime/helpers/providers/theme.d.ts +119 -0
  215. package/dist/runtime/helpers/{themeProvider.js → providers/theme.js} +3 -3
  216. package/dist/runtime/helpers/providers/tour.d.ts +49 -0
  217. package/dist/runtime/helpers/{tourProvider.js → providers/tour.js} +1 -1
  218. package/dist/runtime/helpers/providers/types.d.ts +170 -0
  219. package/dist/runtime/helpers/{typesProvider.js → providers/types.js} +45 -1
  220. package/dist/runtime/helpers/providers/ui.d.ts +339 -0
  221. package/dist/runtime/helpers/{uiProvider.js → providers/ui.js} +94 -86
  222. package/dist/runtime/helpers/runtimeHelpers/index.d.ts +1 -1
  223. package/dist/runtime/helpers/symbols.d.ts +1 -0
  224. package/dist/runtime/helpers/symbols.js +3 -0
  225. package/dist/runtime/icons/click.svg +1 -0
  226. package/dist/runtime/types/blockOptions.d.ts +349 -0
  227. package/dist/runtime/types/index.d.ts +34 -31
  228. package/package.json +2 -2
  229. package/dist/runtime/blokkliPlugins/AddAction/index.vue +0 -96
  230. package/dist/runtime/blokkliPlugins/AddAction/index.vue.d.ts +0 -26
  231. package/dist/runtime/blokkliPlugins/MenuButton/index.vue +0 -68
  232. package/dist/runtime/components/Edit/AddListItemIcon/index.vue +0 -19
  233. package/dist/runtime/helpers/commandsProvider.d.ts +0 -9
  234. package/dist/runtime/helpers/debugProvider.d.ts +0 -33
  235. package/dist/runtime/helpers/definitionProvider.d.ts +0 -19
  236. package/dist/runtime/helpers/domProvider.d.ts +0 -90
  237. package/dist/runtime/helpers/dropAreaProvider.d.ts +0 -9
  238. package/dist/runtime/helpers/featuresProvider.d.ts +0 -17
  239. package/dist/runtime/helpers/indicatorsProvider.d.ts +0 -10
  240. package/dist/runtime/helpers/keyboardProvider.d.ts +0 -20
  241. package/dist/runtime/helpers/pluginProvider.d.ts +0 -26
  242. package/dist/runtime/helpers/pluginProvider.js +0 -62
  243. package/dist/runtime/helpers/stateProvider.d.ts +0 -47
  244. package/dist/runtime/helpers/storageProvider.d.ts +0 -17
  245. package/dist/runtime/helpers/themeProvider.d.ts +0 -30
  246. package/dist/runtime/helpers/tourProvider.d.ts +0 -11
  247. package/dist/runtime/helpers/typesProvider.d.ts +0 -36
  248. package/dist/runtime/helpers/uiProvider.d.ts +0 -60
  249. package/dist/runtime/types/blokkOptions.d.ts +0 -100
  250. /package/dist/runtime/helpers/{addElementClasses.d.ts → composables/addElementClasses.d.ts} +0 -0
  251. /package/dist/runtime/helpers/{addElementClasses.js → composables/addElementClasses.js} +0 -0
  252. /package/dist/runtime/helpers/{useTransitionedValue.d.ts → composables/useTransitionedValue.d.ts} +0 -0
  253. /package/dist/runtime/helpers/{broadcastProvider.d.ts → providers/broadcast.d.ts} +0 -0
  254. /package/dist/runtime/helpers/{broadcastProvider.js → providers/broadcast.js} +0 -0
  255. /package/dist/runtime/helpers/{definitionProvider.js → providers/definition.js} +0 -0
  256. /package/dist/runtime/helpers/{indicatorsProvider.js → providers/indicators.js} +0 -0
  257. /package/dist/runtime/helpers/{storageProvider.js → providers/storage.js} +0 -0
  258. /package/dist/runtime/helpers/{textProvider.js → providers/texts.js} +0 -0
  259. /package/dist/runtime/types/{blokkOptions.js → blockOptions.js} +0 -0
@@ -0,0 +1,225 @@
1
+ import { type ComputedRef } from '#imports';
2
+ import type { DraggableExistingBlock, DraggableItem, EntityContext, Rectangle, RenderedFieldListItem, RegisteredField, RegisterFieldData } from '#blokkli/types';
3
+ import type { UiProvider } from './ui.js';
4
+ import type { DebugProvider } from './debug.js';
5
+ import type { StateProvider } from './state.js';
6
+ import type { ElementProvider } from './element.js';
7
+ type RegisteredFieldType = {
8
+ entityType: string;
9
+ entityBundle: string;
10
+ fieldName: string;
11
+ };
12
+ type MeasuredBlockRect = Rectangle & {
13
+ time: number;
14
+ };
15
+ export type DomProvider = {
16
+ /**
17
+ * Get the bounding client rect for an element.
18
+ *
19
+ * Wrapper around `getBoundingClientRect()` with debug logging.
20
+ */
21
+ getBoundingClientRect: (element: HTMLElement) => DOMRect;
22
+ /**
23
+ * Return the droppable markup for a draggable item.
24
+ */
25
+ getDropElementMarkup(item: DraggableItem | RenderedFieldListItem, checkSize?: boolean): string;
26
+ /**
27
+ * Register a block element for observation and tracking.
28
+ *
29
+ * Starts observing the element with IntersectionObserver and ResizeObserver
30
+ * to track visibility and dimensions.
31
+ *
32
+ * @param key - Unique key identifying the block's location (field + index)
33
+ * @param uuid - The block's UUID
34
+ * @param el - The block's root HTML element
35
+ */
36
+ registerBlock: (key: string, uuid: string, el: HTMLElement | null) => void;
37
+ /**
38
+ * Unregister a block element from observation.
39
+ *
40
+ * Stops observing the element and removes it from tracking.
41
+ *
42
+ * @param key - Unique key identifying the block's location
43
+ * @param uuid - The block's UUID
44
+ */
45
+ unregisterBlock: (key: string, uuid: string) => void;
46
+ /**
47
+ * Register a field element for observation.
48
+ *
49
+ * Starts observing the field element with IntersectionObserver to track
50
+ * visibility and position.
51
+ *
52
+ * @param entity - The entity context (UUID, type, bundle)
53
+ * @param fieldName - The field's machine name
54
+ * @param instance - The field's HTML element
55
+ * @param data - Additional field registration data
56
+ */
57
+ registerField: (entity: EntityContext, fieldName: string, instance: HTMLElement, data: RegisterFieldData) => void;
58
+ /**
59
+ * Update the element reference for an already registered field.
60
+ *
61
+ * Stops observing the old element and starts observing the new one.
62
+ *
63
+ * @param entity - The entity context
64
+ * @param fieldName - The field's machine name
65
+ * @param element - The new field HTML element
66
+ * @param data - Additional field registration data
67
+ */
68
+ updateFieldElement: (entity: EntityContext, fieldName: string, element: HTMLElement, data: RegisterFieldData) => void;
69
+ /**
70
+ * Unregister a field element from observation.
71
+ *
72
+ * @param entity - The entity context
73
+ * @param fieldName - The field's machine name
74
+ */
75
+ unregisterField: (entity: EntityContext, fieldName: string) => void;
76
+ /**
77
+ * Get a registered field by entity UUID and field name.
78
+ *
79
+ * @param uuid - The entity UUID
80
+ * @param fieldName - The field's machine name
81
+ * @returns The registered field data, or undefined if not found
82
+ */
83
+ getRegisteredField: (uuid: string, fieldName: string) => RegisteredField | undefined;
84
+ /**
85
+ * List of unique field types currently registered.
86
+ *
87
+ * Returns unique combinations of entity type, bundle, and field name.
88
+ */
89
+ registeredFieldTypes: ComputedRef<RegisteredFieldType[]>;
90
+ /**
91
+ * List of UUIDs for all blocks with registered elements.
92
+ *
93
+ * Only includes blocks that have a valid HTML element reference.
94
+ */
95
+ registeredBlockUuids: ComputedRef<string[]>;
96
+ /**
97
+ * Get UUIDs of all currently visible blocks.
98
+ *
99
+ * @returns Array of block UUIDs that are currently in the viewport
100
+ */
101
+ getVisibleBlocks(): string[];
102
+ /**
103
+ * Get keys of all currently visible fields.
104
+ *
105
+ * @returns Array of field keys (uuid:fieldName) that are currently in the viewport
106
+ */
107
+ getVisibleFields(): string[];
108
+ /**
109
+ * Check if a block is currently visible in the viewport.
110
+ *
111
+ * @param uuid - The block's UUID
112
+ * @returns True if the block is visible
113
+ */
114
+ isBlockVisible(uuid: string): boolean;
115
+ /**
116
+ * Get rectangles for all registered blocks.
117
+ *
118
+ * @returns Record mapping UUIDs to their measured rectangles with timestamps
119
+ */
120
+ getBlockRects: () => Record<string, MeasuredBlockRect>;
121
+ /**
122
+ * Get the rectangle for a specific block.
123
+ *
124
+ * @param uuid - The block's UUID
125
+ * @param refresh - Whether to refresh the rect before returning
126
+ * @returns The block's rectangle, or undefined if not found
127
+ */
128
+ getBlockRect: (uuid: string, refresh?: boolean) => MeasuredBlockRect | undefined;
129
+ /**
130
+ * Refresh the cached rectangle for a specific block.
131
+ *
132
+ * Recalculates the block's position and dimensions immediately.
133
+ *
134
+ * @param uuid - The block's UUID
135
+ */
136
+ refreshBlockRect: (uuid: string) => void;
137
+ /**
138
+ * Get the rectangle for a specific field.
139
+ *
140
+ * @param key - The field key (uuid:fieldName)
141
+ * @returns The field's rectangle, or undefined if not found
142
+ */
143
+ getFieldRect: (key: string) => Rectangle | undefined;
144
+ /**
145
+ * Record of all registered block elements.
146
+ *
147
+ * Maps UUIDs to their corresponding HTML elements.
148
+ */
149
+ registeredBlocks: ComputedRef<Record<string, HTMLElement | undefined>>;
150
+ /**
151
+ * Update rectangles for all visible blocks and fields.
152
+ *
153
+ * Recalculates positions and dimensions for currently visible items.
154
+ * For performance, only updates visible items when there are many blocks.
155
+ */
156
+ updateVisibleRects: () => void;
157
+ /**
158
+ * Whether the DOM provider is ready.
159
+ *
160
+ * Ready when IntersectionObserver is initialized and initial measurements are complete.
161
+ */
162
+ isReady: ComputedRef<boolean>;
163
+ /**
164
+ * Settlement key that increments after DOM changes settle.
165
+ *
166
+ * Useful for triggering reactivity after blocks/fields are registered/unregistered.
167
+ */
168
+ settleKey: ComputedRef<number>;
169
+ /**
170
+ * Initialize the DOM provider.
171
+ *
172
+ * Starts the IntersectionObserver and marks the provider as ready.
173
+ */
174
+ init: () => void;
175
+ /**
176
+ * Get the drag element for a block.
177
+ */
178
+ getDragElement: (block: DraggableExistingBlock | RenderedFieldListItem) => HTMLElement | undefined;
179
+ /**
180
+ * Get debug data for troubleshooting.
181
+ */
182
+ getDebugData: () => {
183
+ registeredBlocks: Array<{
184
+ uuid: string;
185
+ hasElement: boolean;
186
+ hasObservedElement: boolean;
187
+ hasRect: boolean;
188
+ hasCurrentKey: boolean;
189
+ isVisible: boolean;
190
+ elementInfo?: {
191
+ tagName: string;
192
+ bundle?: string;
193
+ hostBundle?: string;
194
+ fieldListType?: string;
195
+ };
196
+ }>;
197
+ fields: Array<{
198
+ key: string;
199
+ isVisible: boolean;
200
+ hasRect: boolean;
201
+ entityType: string;
202
+ entityBundle: string;
203
+ fieldName: string;
204
+ }>;
205
+ summary: {
206
+ totalRegisteredBlocks: number;
207
+ totalBlocksWithElements: number;
208
+ totalObservedElements: number;
209
+ totalBlockRects: number;
210
+ totalVisibleBlocks: number;
211
+ totalRegisteredFields: number;
212
+ totalVisibleFields: number;
213
+ totalFieldRects: number;
214
+ isInitializing: boolean;
215
+ isReady: boolean;
216
+ };
217
+ orphanedData: {
218
+ rectsWithoutRegistration: string[];
219
+ observedElementsWithoutRegistration: string[];
220
+ keysWithoutRegistration: string[];
221
+ };
222
+ };
223
+ };
224
+ export default function (ui: UiProvider, debug: DebugProvider, state: StateProvider, element: ElementProvider): DomProvider;
225
+ export {};
@@ -1,16 +1,15 @@
1
1
  import { reactive, ref, computed } from "#imports";
2
2
  import { falsy } from "#blokkli/helpers";
3
- import { cloneElementWithStyles } from "./dom/index.js";
4
- import onBlokkliEvent from "./composables/onBlokkliEvent.js";
5
- import useDelayedIntersectionObserver from "./composables/useDelayedIntersectionObserver.js";
6
- import { itemEntityType } from "#blokkli-build/config";
3
+ import { cloneElementWithStyles } from "../dom/index.js";
4
+ import onBlokkliEvent from "../composables/onBlokkliEvent.js";
5
+ import useDelayedIntersectionObserver from "../composables/useDelayedIntersectionObserver.js";
7
6
  function rectWithTime(rect, time) {
8
7
  return {
9
8
  ...rect,
10
9
  time: time || performance.now()
11
10
  };
12
11
  }
13
- export default function(ui, debug, definitions, state, element) {
12
+ export default function(ui, debug, state, element) {
14
13
  const logger = debug.createLogger("DomProvider");
15
14
  const mutationsReady = ref(true);
16
15
  const intersectionReady = ref(false);
@@ -23,10 +22,15 @@ export default function(ui, debug, definitions, state, element) {
23
22
  const blockRects = {};
24
23
  const fieldRects = {};
25
24
  const blockUuidCurrentKey = {};
26
- const observedElements = {};
27
25
  let initTimeout = null;
28
26
  const isInitalizing = ref(true);
29
- const observedElementCache = /* @__PURE__ */ new Map();
27
+ let settleTimeout = null;
28
+ const settleKey = ref(0);
29
+ const observedElements = {};
30
+ function getBoundingClientRect(element2) {
31
+ logger.log("getBoundingClientRect", element2);
32
+ return element2.getBoundingClientRect();
33
+ }
30
34
  const registeredBlockUuids = computed(() => {
31
35
  return Object.entries(registeredBlocks).map(([uuid, element2]) => {
32
36
  if (element2) {
@@ -150,6 +154,7 @@ export default function(ui, debug, definitions, state, element) {
150
154
  intersectionObserver.observe(element2);
151
155
  fieldElementToFieldKey.set(element2, key);
152
156
  doInitTimeout();
157
+ doSettleTimeout();
153
158
  };
154
159
  const updateFieldElement = (entity, fieldName, element2, data) => {
155
160
  const key = `${entity.uuid}:${fieldName}`;
@@ -175,36 +180,12 @@ export default function(ui, debug, definitions, state, element) {
175
180
  }
176
181
  visibleFields.delete(key);
177
182
  registeredFields[key] = void 0;
183
+ doSettleTimeout();
178
184
  };
179
185
  const getRegisteredField = (uuid, fieldName) => {
180
186
  const key = `${uuid}:${fieldName}`;
181
187
  return registeredFields[key];
182
188
  };
183
- function getElementToObserve(uuid, el, bundle, fieldListType, parentBlockBundle) {
184
- if (el.classList.contains("bk-block-proxy")) {
185
- return el;
186
- }
187
- const key = `${uuid}${bundle}${fieldListType}${parentBlockBundle ?? "none"}`;
188
- const cached = observedElementCache.get(key);
189
- if (cached) {
190
- return cached;
191
- }
192
- const definition = definitions.getBlockDefinition(
193
- bundle,
194
- fieldListType,
195
- parentBlockBundle
196
- );
197
- if (!definition) {
198
- throw new Error("Failed to load definition for bundle: " + bundle);
199
- }
200
- const observableElement = (definition.editor?.getDraggableElement ? definition.editor.getDraggableElement(el) : el) || el;
201
- if (observableElement instanceof HTMLElement) {
202
- observedElementCache.set(key, observableElement);
203
- return observableElement;
204
- }
205
- observedElementCache.set(key, el);
206
- return el;
207
- }
208
189
  const getDropElementMarkup = (item, checkSize) => {
209
190
  const getElement = () => {
210
191
  if ("itemType" in item) {
@@ -219,7 +200,7 @@ export default function(ui, debug, definitions, state, element) {
219
200
  if (!el) {
220
201
  return "";
221
202
  }
222
- if ("itemType" in item && item.itemType !== "new") {
203
+ if ("itemType" in item && item.itemType !== "existing_structure") {
223
204
  return el.outerHTML;
224
205
  }
225
206
  const childCount = element.queryAll(
@@ -261,21 +242,8 @@ export default function(ui, debug, definitions, state, element) {
261
242
  if (!fieldList) {
262
243
  return;
263
244
  }
264
- const fieldListType = getRegisteredField(fieldList.entityUuid, fieldList.name)?.fieldListType ?? "default";
265
- const parentBundle = fieldList.entityType === itemEntityType ? state.getFieldListItem(fieldList.entityUuid)?.bundle ?? null : null;
266
- const observableElement = getElementToObserve(
267
- uuid,
268
- el,
269
- item.bundle,
270
- fieldListType,
271
- parentBundle
272
- );
273
245
  blockRects[uuid] = rectWithTime(
274
- ui.getAbsoluteElementRect(
275
- observableElement.getBoundingClientRect(),
276
- scale,
277
- offset
278
- )
246
+ ui.getAbsoluteElementRect(el.getBoundingClientRect(), scale, offset)
279
247
  );
280
248
  }
281
249
  function refreshFieldRect(key) {
@@ -318,11 +286,7 @@ export default function(ui, debug, definitions, state, element) {
318
286
  );
319
287
  }
320
288
  }
321
- onBlokkliEvent("state:reload:before", () => {
322
- observedElementCache.clear();
323
- });
324
289
  onBlokkliEvent("state:reloaded", () => {
325
- observedElementCache.clear();
326
290
  if (stateReloadTimeout) {
327
291
  window.clearTimeout(stateReloadTimeout);
328
292
  }
@@ -331,6 +295,7 @@ export default function(ui, debug, definitions, state, element) {
331
295
  updateVisibleRects();
332
296
  }
333
297
  stateReloadTimeout = window.setTimeout(updateVisibleRects, 300);
298
+ doSettleTimeout();
334
299
  });
335
300
  function forceRefresh() {
336
301
  updateVisibleRects();
@@ -351,17 +316,7 @@ export default function(ui, debug, definitions, state, element) {
351
316
  if (!item) {
352
317
  return;
353
318
  }
354
- const el = registeredBlocks[item.uuid];
355
- if (!el) {
356
- return;
357
- }
358
- return getElementToObserve(
359
- item.uuid,
360
- el,
361
- item.bundle,
362
- item.fieldListType,
363
- item.parentBlockBundle
364
- );
319
+ return registeredBlocks[item.uuid];
365
320
  }
366
321
  function isBlockVisible(uuid) {
367
322
  return visibleBlocks.has(uuid);
@@ -389,10 +344,19 @@ export default function(ui, debug, definitions, state, element) {
389
344
  }, 500);
390
345
  }
391
346
  }
347
+ function doSettleTimeout() {
348
+ if (settleTimeout) {
349
+ window.clearTimeout(settleTimeout);
350
+ }
351
+ settleTimeout = window.setTimeout(() => {
352
+ settleKey.value++;
353
+ }, 50);
354
+ }
392
355
  function registerBlock(key, uuid, el) {
393
356
  logger.log("registerBlock: " + uuid);
394
357
  blockUuidCurrentKey[uuid] = key;
395
358
  doInitTimeout();
359
+ doSettleTimeout();
396
360
  if (!(el instanceof HTMLElement)) {
397
361
  logger.log("registerBlock call unregisterBlock because no element", uuid);
398
362
  unregisterBlock(key, uuid);
@@ -419,26 +383,18 @@ export default function(ui, debug, definitions, state, element) {
419
383
  uuid
420
384
  );
421
385
  }
422
- const fieldListType = getRegisteredField(fieldList.entityUuid, fieldList.name)?.fieldListType ?? "default";
423
- const parentBundle = fieldList.entityType === itemEntityType ? state.getFieldListItem(fieldList.entityUuid)?.bundle ?? null : null;
424
- const observableElement = getElementToObserve(
425
- item.uuid,
426
- el,
427
- item.bundle,
428
- fieldListType,
429
- parentBundle
430
- );
431
- blockElementToUuid.set(observableElement, uuid);
386
+ blockElementToUuid.set(el, uuid);
432
387
  registeredBlocks[uuid] = el;
433
- observedElements[uuid] = observableElement;
434
- intersectionObserver.observe(observableElement);
435
- resizeObserver.observe(observableElement);
388
+ observedElements[uuid] = el;
389
+ intersectionObserver.observe(el);
390
+ resizeObserver.observe(el);
436
391
  }
437
392
  function unregisterBlock(key, uuid) {
438
393
  const currentKey = blockUuidCurrentKey[uuid];
439
394
  if (currentKey && currentKey !== key) {
440
395
  return;
441
396
  }
397
+ doSettleTimeout();
442
398
  logger.log("unregisterBlock: " + uuid);
443
399
  const el = registeredBlocks[uuid];
444
400
  const observedElement = observedElements[uuid];
@@ -542,6 +498,7 @@ export default function(ui, debug, definitions, state, element) {
542
498
  isReady: computed(
543
499
  () => mutationsReady.value && intersectionReady.value && !isInitalizing.value
544
500
  ),
501
+ settleKey: computed(() => settleKey.value),
545
502
  init,
546
503
  getDragElement,
547
504
  updateVisibleRects,
@@ -551,6 +508,7 @@ export default function(ui, debug, definitions, state, element) {
551
508
  registeredBlockUuids,
552
509
  getDebugData,
553
510
  getRegisteredField,
554
- registeredBlocks: computed(() => registeredBlocks)
511
+ registeredBlocks: computed(() => registeredBlocks),
512
+ getBoundingClientRect
555
513
  };
556
514
  }
@@ -0,0 +1,47 @@
1
+ import type { DraggableItem, DropArea } from '#blokkli/types';
2
+ type DropAreaProviderFunction = (items: DraggableItem[]) => DropArea[] | DropArea | undefined;
3
+ export type DropAreaProvider = {
4
+ /**
5
+ * Register a drop area provider function.
6
+ *
7
+ * The function will be called when drop areas are requested during drag operations.
8
+ * It receives the currently dragged items and can return drop areas where those items can be dropped.
9
+ *
10
+ * @param fn - Function that returns drop areas based on dragged items
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * dropArea.add((items) => {
15
+ * // Only provide drop area for text blocks
16
+ * if (items.every(item => item.bundle === 'text')) {
17
+ * return {
18
+ * id: 'custom-area',
19
+ * label: 'Text Only Area',
20
+ * accepts: (item) => item.bundle === 'text',
21
+ * }
22
+ * }
23
+ * })
24
+ * ```
25
+ */
26
+ add: (fn: DropAreaProviderFunction) => void;
27
+ /**
28
+ * Unregister a drop area provider function.
29
+ *
30
+ * Removes a previously registered function so it no longer provides drop areas.
31
+ *
32
+ * @param fn - The function to remove (must be the same reference used in add)
33
+ */
34
+ remove: (fn: DropAreaProviderFunction) => void;
35
+ /**
36
+ * Get all drop areas from all registered providers.
37
+ *
38
+ * Calls all registered provider functions with the dragged items,
39
+ * flattens the results, and filters out undefined values.
40
+ *
41
+ * @param items - The currently dragged items
42
+ * @returns Array of all available drop areas for these items
43
+ */
44
+ getDropAreas: (items: DraggableItem[]) => DropArea[];
45
+ };
46
+ export default function (): DropAreaProvider;
47
+ export {};
@@ -1,4 +1,4 @@
1
- import { falsy } from "./index.js";
1
+ import { falsy } from "../index.js";
2
2
  export default function() {
3
3
  let functions = [];
4
4
  const add = (fn) => {
@@ -1,6 +1,63 @@
1
- import type { DebugProvider } from '../debugProvider.js';
1
+ import type { DebugProvider } from './debug.js';
2
2
  export type ElementProvider = {
3
+ /**
4
+ * Query all matching elements with debug logging.
5
+ *
6
+ * Wrapper around `querySelectorAll` that:
7
+ * - Logs the query and reason to debug console
8
+ * - Filters out non-HTMLElement results
9
+ * - Optionally maps/transforms results
10
+ * - Filters out null/undefined mapped results
11
+ *
12
+ * @param target - Element or document to query within
13
+ * @param query - CSS selector string
14
+ * @param reason - Human-readable reason for the query (for debugging)
15
+ * @param map - Optional function to transform each matched element
16
+ * @returns Array of matched (and optionally transformed) elements
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // Get all buttons
21
+ * const buttons = element.queryAll(document, 'button', 'Get all buttons')
22
+ *
23
+ * // Get all buttons with data attributes
24
+ * const buttonData = element.queryAll(
25
+ * document,
26
+ * 'button[data-action]',
27
+ * 'Get action buttons',
28
+ * (el) => el.dataset.action
29
+ * )
30
+ * ```
31
+ */
3
32
  queryAll: <T = HTMLElement>(target: HTMLElement | Document, query: string, reason: string, map?: (v: HTMLElement) => T | null | undefined) => T[];
33
+ /**
34
+ * Query the first matching element with debug logging.
35
+ *
36
+ * Wrapper around `querySelector` that:
37
+ * - Logs the query and reason to debug console
38
+ * - Returns null if no match or match is not HTMLElement
39
+ * - Optionally maps/transforms the result
40
+ *
41
+ * @param target - Element or document to query within
42
+ * @param query - CSS selector string
43
+ * @param reason - Human-readable reason for the query (for debugging)
44
+ * @param map - Optional function to transform the matched element
45
+ * @returns The first matched (and optionally transformed) element, or null
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * // Get first button
50
+ * const button = element.query(document, 'button', 'Get first button')
51
+ *
52
+ * // Get button action
53
+ * const action = element.query(
54
+ * document,
55
+ * 'button[data-action]',
56
+ * 'Get action button',
57
+ * (el) => el.dataset.action
58
+ * )
59
+ * ```
60
+ */
4
61
  query: <T = HTMLElement>(target: HTMLElement | Document, query: string, reason: string, map?: (v: HTMLElement) => T | null | undefined) => T | null;
5
62
  };
6
63
  export default function (debug: DebugProvider): ElementProvider;
@@ -0,0 +1,56 @@
1
+ import type { FeatureDefinition, AdapterMethods } from '#blokkli/types';
2
+ import { type ValidFeatureKey } from '#blokkli-build/features';
3
+ import { type ComputedRef } from '#imports';
4
+ import type { StorageProvider } from './storage.js';
5
+ export type FeaturesProvider = {
6
+ /**
7
+ * List of all registered feature definitions.
8
+ *
9
+ * Updates automatically via HMR during development.
10
+ */
11
+ features: ComputedRef<FeatureDefinition[]>;
12
+ /**
13
+ * List of currently mounted features.
14
+ *
15
+ * Features are mounted when their components are rendered in the editor.
16
+ * This list is used to track which features are active in the current session.
17
+ */
18
+ mountedFeatures: ComputedRef<FeatureDefinition<AdapterMethods[], ValidFeatureKey>[]>;
19
+ /**
20
+ * List of available beta features.
21
+ *
22
+ * Only includes features marked with `beta: true` in their definition.
23
+ * These features can be individually enabled/disabled by users.
24
+ */
25
+ betaFeatures: ComputedRef<{
26
+ id: ValidFeatureKey;
27
+ label: string;
28
+ description?: string;
29
+ }[]>;
30
+ /**
31
+ * List of beta features that are currently enabled.
32
+ *
33
+ * Derived from user settings stored in local storage.
34
+ * Users can toggle beta features on/off in the settings UI.
35
+ */
36
+ enabledBetaFeatures: ComputedRef<ValidFeatureKey[]>;
37
+ /**
38
+ * Mount a feature.
39
+ *
40
+ * Called when a feature component is mounted/rendered.
41
+ * Adds the feature to the mountedFeatures list.
42
+ *
43
+ * @param feature - The feature definition to mount
44
+ */
45
+ mount: (feature: FeatureDefinition<AdapterMethods[], ValidFeatureKey>) => void;
46
+ /**
47
+ * Unmount a feature.
48
+ *
49
+ * Called when a feature component is unmounted/destroyed.
50
+ * Removes the feature from the mountedFeatures list.
51
+ *
52
+ * @param id - The feature ID to unmount
53
+ */
54
+ unmount: (id: string) => void;
55
+ };
56
+ export default function (storage: StorageProvider): FeaturesProvider;
@@ -2,7 +2,7 @@ import {
2
2
  featureDefinitions
3
3
  } from "#blokkli-build/features";
4
4
  import { computed, ref } from "#imports";
5
- import { falsy } from "./index.js";
5
+ import { falsy } from "../index.js";
6
6
  export default function(storage) {
7
7
  const definitions = ref(featureDefinitions);
8
8
  const mountedFeatures = ref([]);
@@ -1,8 +1,23 @@
1
1
  import type { BlokkliFieldElement } from '#blokkli/types';
2
- import type { DomProvider } from '../domProvider.js';
3
- import type { StateProvider } from '../stateProvider.js';
4
- import type { BlockDefinitionProvider } from '../typesProvider.js';
2
+ import type { DomProvider } from './dom.js';
3
+ import type { BlockDefinitionProvider } from './types.js';
5
4
  export type FieldsProvider = {
5
+ /**
6
+ * Find a field element by host entity UUID and field name.
7
+ *
8
+ * Returns a BlokkliFieldElement with complete field metadata including:
9
+ * - Field configuration (label, cardinality, allowed bundles)
10
+ * - Host entity information
11
+ * - Nesting level and field list type
12
+ * - HTML element reference
13
+ * - Drop alignment settings
14
+ *
15
+ * Results are cached and invalidated on state reload.
16
+ *
17
+ * @param uuid - The host entity UUID
18
+ * @param fieldName - The name of the field
19
+ * @returns The field element with metadata, or undefined if not found
20
+ */
6
21
  find: (uuid: string, fieldName: string) => BlokkliFieldElement | undefined;
7
22
  };
8
- export default function (state: StateProvider, dom: DomProvider, types: BlockDefinitionProvider): FieldsProvider;
23
+ export default function (dom: DomProvider, types: BlockDefinitionProvider): FieldsProvider;
@@ -1,5 +1,5 @@
1
1
  import onBlokkliEvent from "../composables/onBlokkliEvent.js";
2
- export default function(state, dom, types) {
2
+ export default function(dom, types) {
3
3
  const fieldCache = /* @__PURE__ */ new Map();
4
4
  function find(uuid, fieldName) {
5
5
  const key = uuid + ":" + fieldName;