@blokkli/editor 2.0.0-alpha.24 → 2.0.0-alpha.26

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 (182) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +191 -27
  3. package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue.d.ts +38 -0
  4. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +15 -0
  5. package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +6 -0
  6. package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +28 -3
  7. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +6 -4
  8. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +11 -3
  9. package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +138 -3
  10. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +114 -0
  11. package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +21 -0
  12. package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +98 -0
  13. package/dist/runtime/components/Blocks/NotImplemented/index.vue +24 -0
  14. package/dist/runtime/components/Blocks/NotImplemented/index.vue.d.ts +6 -0
  15. package/dist/runtime/components/BlokkliEditable.vue.d.ts +11 -0
  16. package/dist/runtime/components/BlokkliItem.vue +16 -3
  17. package/dist/runtime/components/BlokkliItem.vue.d.ts +4 -2
  18. package/dist/runtime/components/Edit/Actions/index.vue +1 -1
  19. package/dist/runtime/components/Edit/AddListItem/index.vue +1 -6
  20. package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +5 -13
  21. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +6 -0
  22. package/dist/runtime/components/Edit/BlockProxy/index.vue +2 -2
  23. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +3 -0
  24. package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +4 -1
  25. package/dist/runtime/components/Edit/Dialog/index.vue +15 -50
  26. package/dist/runtime/components/Edit/DraggableList.vue +12 -9
  27. package/dist/runtime/components/Edit/EditIndicator.vue +11 -4
  28. package/dist/runtime/components/Edit/EditProvider.vue +27 -24
  29. package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +1 -0
  30. package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue +2 -3
  31. package/dist/runtime/components/Edit/Features/AddList/index.vue +17 -5
  32. package/dist/runtime/components/Edit/Features/Analyze/Icon.vue +85 -0
  33. package/dist/runtime/components/Edit/Features/Analyze/Icon.vue.d.ts +5 -0
  34. package/dist/runtime/components/Edit/Features/Analyze/Main.vue +288 -59
  35. package/dist/runtime/components/Edit/Features/Analyze/Main.vue.d.ts +8 -1
  36. package/dist/runtime/components/Edit/Features/Analyze/Renderer/fragment.glsl +25 -13
  37. package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue +114 -52
  38. package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue.d.ts +16 -2
  39. package/dist/runtime/components/Edit/Features/Analyze/Renderer/vertex.glsl +31 -11
  40. package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue +2 -0
  41. package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue.d.ts +8 -1
  42. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue +4 -4
  43. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue.d.ts +20 -2
  44. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue +11 -18
  45. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue.d.ts +10 -3
  46. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +46 -40
  47. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue.d.ts +10 -4
  48. package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue +8 -4
  49. package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.js +1 -0
  50. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.d.ts +4 -3
  51. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.js +2 -1
  52. package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.js +61 -20
  53. package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.d.ts +15 -1
  54. package/dist/runtime/components/Edit/Features/Analyze/index.vue +23 -2
  55. package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +22 -8
  56. package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +1 -1
  57. package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +8 -3
  58. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +10 -1
  59. package/dist/runtime/components/Edit/Features/Debug/Main.vue.d.ts +1 -1
  60. package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +2 -2
  61. package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue.d.ts +1 -1
  62. package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +8 -2
  63. package/dist/runtime/components/Edit/Features/EditForm/index.vue +1 -7
  64. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +1 -1
  65. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +4 -3
  66. package/dist/runtime/components/Edit/Features/EditableMask/index.vue +1 -1
  67. package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +7 -2
  68. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +2 -2
  69. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +9 -2
  70. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +12 -3
  71. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +3 -2
  72. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +1 -1
  73. package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +1 -0
  74. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +9 -0
  75. package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +3 -2
  76. package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +3 -2
  77. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +8 -2
  78. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +12 -2
  79. package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +11 -3
  80. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +126 -33
  81. package/dist/runtime/components/Edit/Features/Selection/Renderer/index.vue +1 -1
  82. package/dist/runtime/components/Edit/Features/Settings/index.vue +1 -1
  83. package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +3 -3
  84. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +2 -2
  85. package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +7 -1
  86. package/dist/runtime/components/Edit/Form/Textarea/index.vue +1 -1
  87. package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
  88. package/dist/runtime/components/Edit/Indicators/index.vue +1 -1
  89. package/dist/runtime/components/Edit/InfoBox/index.vue +3 -2
  90. package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +6 -1
  91. package/dist/runtime/components/Edit/Overlay/index.vue +4 -0
  92. package/dist/runtime/components/Edit/PreviewProvider.vue +3 -3
  93. package/dist/runtime/components/Edit/ScaleToFit/index.vue +4 -4
  94. package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
  95. package/dist/runtime/composables/useBlokkli.d.ts +6 -1
  96. package/dist/runtime/composables/useBlokkli.js +4 -1
  97. package/dist/runtime/css/output.css +1 -1
  98. package/dist/runtime/helpers/composables/defineItemDropdownAction.d.ts +1 -1
  99. package/dist/runtime/helpers/composables/defineMenuButton.d.ts +1 -1
  100. package/dist/runtime/helpers/composables/defineRenderer.d.ts +1 -1
  101. package/dist/runtime/helpers/composables/onBroadcastEvent.d.ts +1 -1
  102. package/dist/runtime/helpers/composables/useBlockRegistration.d.ts +1 -1
  103. package/dist/runtime/helpers/composables/useBlockRegistration.js +12 -1
  104. package/dist/runtime/helpers/composables/useDebugLogger.d.ts +1 -1
  105. package/dist/runtime/helpers/composables/useFocusTrap.d.ts +52 -0
  106. package/dist/runtime/helpers/composables/useFocusTrap.js +59 -0
  107. package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +1 -1
  108. package/dist/runtime/helpers/{useTransitionedValue.js → composables/useTransitionedValue.js} +1 -1
  109. package/dist/runtime/helpers/imports/index.d.ts +2 -1
  110. package/dist/runtime/helpers/imports/index.js +10 -1
  111. package/dist/runtime/helpers/{animationProvider.d.ts → providers/animation.d.ts} +100 -7
  112. package/dist/runtime/helpers/{animationProvider.js → providers/animation.js} +21 -11
  113. package/dist/runtime/helpers/providers/blocks.d.ts +25 -3
  114. package/dist/runtime/helpers/providers/blocks.js +9 -0
  115. package/dist/runtime/helpers/providers/commands.d.ts +41 -0
  116. package/dist/runtime/helpers/{commandsProvider.js → providers/commands.js} +1 -1
  117. package/dist/runtime/helpers/providers/debug.d.ts +125 -0
  118. package/dist/runtime/helpers/{debugProvider.js → providers/debug.js} +2 -2
  119. package/dist/runtime/helpers/providers/definition.d.ts +87 -0
  120. package/dist/runtime/helpers/providers/directive.d.ts +88 -2
  121. package/dist/runtime/helpers/providers/directive.js +27 -3
  122. package/dist/runtime/helpers/providers/dom.d.ts +225 -0
  123. package/dist/runtime/helpers/{domProvider.js → providers/dom.js} +31 -75
  124. package/dist/runtime/helpers/providers/dropArea.d.ts +47 -0
  125. package/dist/runtime/helpers/{dropAreaProvider.js → providers/dropArea.js} +1 -1
  126. package/dist/runtime/helpers/providers/element.d.ts +58 -1
  127. package/dist/runtime/helpers/providers/features.d.ts +56 -0
  128. package/dist/runtime/helpers/{featuresProvider.js → providers/features.js} +1 -1
  129. package/dist/runtime/helpers/providers/fields.d.ts +18 -11
  130. package/dist/runtime/helpers/providers/fields.js +1 -1
  131. package/dist/runtime/helpers/providers/indicators.d.ts +44 -0
  132. package/dist/runtime/helpers/providers/keyboard.d.ts +76 -0
  133. package/dist/runtime/helpers/{keyboardProvider.js → providers/keyboard.js} +1 -8
  134. package/dist/runtime/helpers/{pluginProvider.d.ts → providers/plugin.d.ts} +36 -0
  135. package/dist/runtime/helpers/{selectionProvider.d.ts → providers/selection.d.ts} +4 -1
  136. package/dist/runtime/helpers/{selectionProvider.js → providers/selection.js} +1 -1
  137. package/dist/runtime/helpers/providers/state.d.ts +227 -0
  138. package/dist/runtime/helpers/{stateProvider.js → providers/state.js} +3 -3
  139. package/dist/runtime/helpers/providers/storage.d.ts +64 -0
  140. package/dist/runtime/helpers/{textProvider.d.ts → providers/texts.d.ts} +1 -1
  141. package/dist/runtime/helpers/providers/theme.d.ts +119 -0
  142. package/dist/runtime/helpers/{themeProvider.js → providers/theme.js} +3 -3
  143. package/dist/runtime/helpers/providers/tour.d.ts +49 -0
  144. package/dist/runtime/helpers/{tourProvider.js → providers/tour.js} +1 -1
  145. package/dist/runtime/helpers/providers/types.d.ts +170 -0
  146. package/dist/runtime/helpers/{typesProvider.js → providers/types.js} +45 -1
  147. package/dist/runtime/helpers/providers/ui.d.ts +339 -0
  148. package/dist/runtime/helpers/{uiProvider.js → providers/ui.js} +11 -5
  149. package/dist/runtime/helpers/runtimeHelpers/index.d.ts +1 -1
  150. package/dist/runtime/helpers/symbols.d.ts +1 -0
  151. package/dist/runtime/helpers/symbols.js +3 -0
  152. package/dist/runtime/types/blockOptions.d.ts +349 -0
  153. package/dist/runtime/types/index.d.ts +22 -26
  154. package/package.json +2 -2
  155. package/dist/runtime/helpers/commandsProvider.d.ts +0 -9
  156. package/dist/runtime/helpers/debugProvider.d.ts +0 -33
  157. package/dist/runtime/helpers/definitionProvider.d.ts +0 -19
  158. package/dist/runtime/helpers/domProvider.d.ts +0 -91
  159. package/dist/runtime/helpers/dropAreaProvider.d.ts +0 -9
  160. package/dist/runtime/helpers/featuresProvider.d.ts +0 -17
  161. package/dist/runtime/helpers/indicatorsProvider.d.ts +0 -10
  162. package/dist/runtime/helpers/keyboardProvider.d.ts +0 -20
  163. package/dist/runtime/helpers/stateProvider.d.ts +0 -47
  164. package/dist/runtime/helpers/storageProvider.d.ts +0 -17
  165. package/dist/runtime/helpers/themeProvider.d.ts +0 -30
  166. package/dist/runtime/helpers/tourProvider.d.ts +0 -11
  167. package/dist/runtime/helpers/typesProvider.d.ts +0 -36
  168. package/dist/runtime/helpers/uiProvider.d.ts +0 -57
  169. package/dist/runtime/types/blokkOptions.d.ts +0 -100
  170. /package/dist/runtime/helpers/{addElementClasses.d.ts → composables/addElementClasses.d.ts} +0 -0
  171. /package/dist/runtime/helpers/{addElementClasses.js → composables/addElementClasses.js} +0 -0
  172. /package/dist/runtime/helpers/{defineElementStyle.d.ts → composables/defineElementStyle.d.ts} +0 -0
  173. /package/dist/runtime/helpers/{defineElementStyle.js → composables/defineElementStyle.js} +0 -0
  174. /package/dist/runtime/helpers/{useTransitionedValue.d.ts → composables/useTransitionedValue.d.ts} +0 -0
  175. /package/dist/runtime/helpers/{broadcastProvider.d.ts → providers/broadcast.d.ts} +0 -0
  176. /package/dist/runtime/helpers/{broadcastProvider.js → providers/broadcast.js} +0 -0
  177. /package/dist/runtime/helpers/{definitionProvider.js → providers/definition.js} +0 -0
  178. /package/dist/runtime/helpers/{indicatorsProvider.js → providers/indicators.js} +0 -0
  179. /package/dist/runtime/helpers/{pluginProvider.js → providers/plugin.js} +0 -0
  180. /package/dist/runtime/helpers/{storageProvider.js → providers/storage.js} +0 -0
  181. /package/dist/runtime/helpers/{textProvider.js → providers/texts.js} +0 -0
  182. /package/dist/runtime/types/{blokkOptions.js → blockOptions.js} +0 -0
@@ -0,0 +1,227 @@
1
+ import { type Ref, type ComputedRef } from 'vue';
2
+ import type { BlokkliAdapter, AdapterContext } from '../../adapter/index.js';
3
+ import type { MutatedField, EditEntity, MutatedOptions, TranslationState, MappedState, MutationItem, Validation, MutateWithLoadingStateFunction, EditMode, FieldListItem, PublishOptions, EditPermission } from '#blokkli/types';
4
+ import type { TextProvider } from './texts.js';
5
+ export type BlokkliOwner = {
6
+ name: string | undefined;
7
+ currentUserIsOwner: boolean;
8
+ };
9
+ export type RenderedBlock = {
10
+ item: FieldListItem;
11
+ parentEntityType: string;
12
+ parentEntityBundle: string;
13
+ parentEntityUuid: string;
14
+ };
15
+ export type StateProvider = {
16
+ /**
17
+ * Information about the editing session owner.
18
+ *
19
+ * Includes owner name and whether the current user is the owner.
20
+ */
21
+ owner: Readonly<Ref<BlokkliOwner | null>>;
22
+ /**
23
+ * Refresh key that changes when state is reloaded.
24
+ *
25
+ * Use as a component key to force remounting when state updates.
26
+ */
27
+ refreshKey: Readonly<Ref<string>>;
28
+ /**
29
+ * All mutated fields in the current editing session.
30
+ *
31
+ * Each field contains its entity context, field name, and list of blocks.
32
+ */
33
+ mutatedFields: Readonly<Ref<MutatedField[]>>;
34
+ /**
35
+ * The host entity being edited.
36
+ *
37
+ * Contains label, status, and bundle information.
38
+ */
39
+ entity: Readonly<Ref<EditEntity>>;
40
+ /**
41
+ * Mutated options for all blocks and the host entity.
42
+ *
43
+ * Maps block UUIDs (or 'HOST' for host options) to their option values.
44
+ */
45
+ mutatedOptions: MutatedOptions;
46
+ /**
47
+ * Translation state for the edited entity.
48
+ *
49
+ * Includes source language, available languages, and existing translations.
50
+ */
51
+ translation: Readonly<Ref<TranslationState>>;
52
+ /**
53
+ * Publishing options and capabilities.
54
+ *
55
+ * Indicates whether publishing, scheduling, and revisions are available.
56
+ */
57
+ publishOptions: Readonly<Ref<PublishOptions>>;
58
+ /**
59
+ * History of all mutations in the editing session.
60
+ *
61
+ * Used for undo/redo functionality and tracking changes.
62
+ */
63
+ mutations: Readonly<Ref<MutationItem[]>>;
64
+ /**
65
+ * Current position in the mutation history.
66
+ *
67
+ * -1 indicates no mutations, 0+ indicates active mutation index.
68
+ */
69
+ currentMutationIndex: Readonly<Ref<number>>;
70
+ /**
71
+ * Validation violations for the current state.
72
+ *
73
+ * Contains errors and warnings about invalid field values or configurations.
74
+ */
75
+ violations: Readonly<Ref<Validation[]>>;
76
+ /**
77
+ * Execute a mutation with loading state and error handling.
78
+ *
79
+ * Shows loading indicator, handles errors, updates state, and shows messages.
80
+ *
81
+ * @param callback - Function that performs the mutation
82
+ * @param errorMessage - Error message to show on failure (false to suppress)
83
+ * @param successMessage - Optional success message to show
84
+ * @returns True if successful, false if failed
85
+ */
86
+ mutateWithLoadingState: MutateWithLoadingStateFunction;
87
+ /**
88
+ * Current edit mode.
89
+ *
90
+ * - 'readonly': User cannot edit (no permission or not owner)
91
+ * - 'editing': User can edit
92
+ * - 'translating': User is editing a translation
93
+ */
94
+ editMode: Readonly<Ref<EditMode>>;
95
+ /**
96
+ * The raw mutated entity data from the adapter.
97
+ *
98
+ * Contains adapter-specific entity data (e.g., Drupal entity fields).
99
+ */
100
+ mutatedEntity: Readonly<Ref<any>>;
101
+ /**
102
+ * Whether the current user can edit.
103
+ *
104
+ * True when state is loaded, user is owner, no load errors, and has edit permission.
105
+ */
106
+ canEdit: ComputedRef<boolean>;
107
+ /**
108
+ * List of permissions for the current user.
109
+ *
110
+ * Includes 'edit', 'view', and other adapter-specific permissions.
111
+ */
112
+ permissions: ComputedRef<EditPermission[]>;
113
+ /**
114
+ * Whether state has been successfully loaded.
115
+ *
116
+ * True when state loaded without errors.
117
+ */
118
+ stateAvailable: ComputedRef<boolean>;
119
+ /**
120
+ * Whether a loading operation is in progress.
121
+ *
122
+ * Automatically adds 'bk-body-loading' class to document.body when true.
123
+ */
124
+ isLoading: Readonly<Ref<boolean>>;
125
+ /**
126
+ * UUIDs of all blocks loaded from the library.
127
+ *
128
+ * Blocks with bundle 'from_library'.
129
+ */
130
+ fromLibraryUuids: Readonly<Ref<Readonly<string[]>>>;
131
+ /**
132
+ * Get the number of blocks in a field.
133
+ *
134
+ * Results are cached for performance.
135
+ *
136
+ * @param key - The field key (entityUuid:fieldName)
137
+ * @returns Number of blocks in the field
138
+ */
139
+ getFieldBlockCount: (key: string) => number;
140
+ /**
141
+ * Get the total count of blocks with a specific bundle.
142
+ *
143
+ * @param bundle - The block bundle
144
+ * @returns Total number of blocks with this bundle
145
+ */
146
+ getBlockBundleCount: (bundle: string) => number;
147
+ /**
148
+ * Get a field list item by UUID.
149
+ *
150
+ * @param uuid - The block UUID
151
+ * @returns The field list item, or undefined if not found
152
+ */
153
+ getFieldListItem: (uuid: string) => FieldListItem | undefined;
154
+ /**
155
+ * Get the mutated field that contains a block.
156
+ *
157
+ * @param uuid - The block UUID
158
+ * @returns The field containing this block, or undefined if not found
159
+ */
160
+ getFieldListForBlock: (uuid: string) => MutatedField | undefined;
161
+ /**
162
+ * Get a mutated field by entity UUID and field name.
163
+ *
164
+ * @param uuid - The entity UUID
165
+ * @param fieldName - The field name
166
+ * @returns The mutated field, or undefined if not found
167
+ */
168
+ getMutatedField: (uuid: string, fieldName: string) => MutatedField | undefined;
169
+ /**
170
+ * Get all block UUIDs, optionally filtered by bundle.
171
+ *
172
+ * @param bundle - Optional bundle to filter by
173
+ * @returns Array of block UUIDs
174
+ */
175
+ getAllUuids: (bundle?: string) => string[];
176
+ /**
177
+ * Get the nesting level of a block.
178
+ *
179
+ * Level 0 = block in host entity field
180
+ * Level 1 = block in another block's field
181
+ * Level 2+ = deeper nesting
182
+ *
183
+ * @param uuid - The block UUID
184
+ * @returns The nesting level (0+)
185
+ */
186
+ getNestingLevel: (uuid: string) => number;
187
+ /**
188
+ * Check if a block is a child (direct or nested) of another block.
189
+ *
190
+ * Recursively checks parent relationships.
191
+ *
192
+ * @param childUuid - The potential child block UUID
193
+ * @param parentUuid - The potential parent block UUID
194
+ * @returns True if childUuid is a descendant of parentUuid
195
+ */
196
+ isChildOf: (childUuid: string, parentUuid: string) => boolean;
197
+ /**
198
+ * Get the current mapped state.
199
+ *
200
+ * Throws error if called before state is available.
201
+ *
202
+ * @returns The current mapped state
203
+ */
204
+ getMappedState: () => MappedState;
205
+ /**
206
+ * Temporarily override the state.
207
+ *
208
+ * Used for previewing changes without committing them.
209
+ *
210
+ * @param state - The temporary state to use
211
+ */
212
+ setOverrideState: (state: MappedState) => void;
213
+ /**
214
+ * Clear the temporary override and restore previous state.
215
+ *
216
+ * Throws error if no override is active.
217
+ */
218
+ clearOverrideState: () => void;
219
+ /**
220
+ * Get the field key for a block UUID.
221
+ *
222
+ * @param uuid - The block UUID
223
+ * @returns The field key (entityUuid:fieldName), or null if not found
224
+ */
225
+ getFieldKeyForUuid: (uuid: string) => string | null;
226
+ };
227
+ export default function (adapter: BlokkliAdapter<any>, context: ComputedRef<AdapterContext>, $t: TextProvider, providerKey: string, permissions: EditPermission[]): Promise<StateProvider>;
@@ -6,12 +6,12 @@ import {
6
6
  provide
7
7
  } from "vue";
8
8
  import { refreshNuxtData, useState } from "nuxt/app";
9
- import { INJECT_MUTATED_FIELDS_MAP } from "./symbols.js";
10
- import onBlokkliEvent from "./composables/onBlokkliEvent.js";
9
+ import { INJECT_MUTATED_FIELDS_MAP } from "../symbols.js";
10
+ import onBlokkliEvent from "../composables/onBlokkliEvent.js";
11
11
  import { falsy, getFieldKey } from "#blokkli/helpers";
12
12
  import { eventBus, emitMessage } from "#blokkli/helpers/eventBus";
13
13
  import { nextTick } from "#imports";
14
- import { addElementClasses } from "./addElementClasses.js";
14
+ import { addElementClasses } from "../composables/addElementClasses.js";
15
15
  import { BUNDLE_FROM_LIBRARY } from "#blokkli/constants";
16
16
  const HOST_OPTION_KEY = "HOST";
17
17
  function mapPublishOptions(context) {
@@ -0,0 +1,64 @@
1
+ import { type ComputedRef, type WritableComputedRef } from '#imports';
2
+ import type { AdapterContext, BlokkliAdapter } from '#blokkli/adapter';
3
+ export type StorageProvider = {
4
+ /**
5
+ * Create a reactive storage value synced to localStorage.
6
+ *
7
+ * The value is automatically persisted to localStorage on change.
8
+ * Can optionally be synced to user settings on the server.
9
+ *
10
+ * @param key - Storage key (will be prefixed with 'blokkli:')
11
+ * @param defaultValue - Default value if no stored value exists
12
+ * @param persist - Whether to sync to server user settings (default: false)
13
+ * @returns Reactive writable computed ref synced to storage
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const showGrid = storage.use('showGrid', false)
18
+ * showGrid.value = true // Automatically saved to localStorage
19
+ * ```
20
+ */
21
+ use: <T>(key: string | ComputedRef<string>, defaultValue: T, persist?: boolean) => WritableComputedRef<T>;
22
+ /**
23
+ * Create a reactive storage value with entity context prefix.
24
+ *
25
+ * Same as `use()` but automatically prefixes the key with entity type and UUID.
26
+ * Useful for entity-specific settings (e.g., sidebar state per page).
27
+ *
28
+ * @param key - Storage key (will be prefixed with context)
29
+ * @param defaultValue - Default value if no stored value exists
30
+ * @param persist - Whether to sync to server user settings (default: false)
31
+ * @returns Reactive writable computed ref synced to storage
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * // If context is node:abc123, key becomes 'sidebarOpen:node:abc123'
36
+ * const sidebarOpen = storage.useWithContextPrefix('sidebarOpen', false)
37
+ * ```
38
+ */
39
+ useWithContextPrefix: <T>(key: string, defaultValue: T, persist?: boolean) => WritableComputedRef<T>;
40
+ /**
41
+ * Clear all blokkli storage values.
42
+ *
43
+ * Removes all localStorage entries starting with 'blokkli:' prefix.
44
+ * Does not affect server user settings.
45
+ */
46
+ clearAll: () => void;
47
+ /**
48
+ * Clear a specific storage value.
49
+ *
50
+ * Removes the value from localStorage (without prefix).
51
+ *
52
+ * @param key - The storage key to clear (without 'blokkli:' prefix)
53
+ */
54
+ clear: (key: string) => void;
55
+ };
56
+ /**
57
+ * Create a reactive variable that is synced to local storage using the
58
+ * given key. The sync only happens client side and after the component
59
+ * has been mounted.
60
+ *
61
+ * This composable can be used to keep state across page navigations and
62
+ * even after a refresh.
63
+ */
64
+ export default function (adapter: BlokkliAdapter<any>, context: ComputedRef<AdapterContext>): Promise<StorageProvider>;
@@ -1,4 +1,4 @@
1
1
  import { type ComputedRef } from 'vue';
2
- import type { AdapterContext } from '../adapter/index.js';
2
+ import type { AdapterContext } from '../../adapter/index.js';
3
3
  export type TextProvider = (key: string, defaultValue?: string) => string;
4
4
  export default function (context?: ComputedRef<AdapterContext>): TextProvider;
@@ -0,0 +1,119 @@
1
+ import type { DraggableStyle } from '#blokkli/types';
2
+ import type { RGB, ThemeColorGroup, ThemeColorShade, ThemeColors, ThemeContextColorGroup, ThemeContextColorShade, ThemeContextColors, ThemeName } from '#blokkli/types/theme';
3
+ import { type Ref } from '#imports';
4
+ import type { ElementProvider } from './element.js';
5
+ type ThemeMap = {
6
+ accent: Ref<ThemeColors>;
7
+ mono: Ref<ThemeColors>;
8
+ teal: Ref<ThemeContextColors>;
9
+ yellow: Ref<ThemeContextColors>;
10
+ red: Ref<ThemeContextColors>;
11
+ lime: Ref<ThemeContextColors>;
12
+ orange: Ref<ThemeContextColors>;
13
+ };
14
+ export type ThemeProvider = {
15
+ /**
16
+ * Accent color palette (primary brand color).
17
+ *
18
+ * Available shades: 50-950
19
+ */
20
+ accent: Ref<ThemeColors>;
21
+ /**
22
+ * Monochrome color palette (grays).
23
+ *
24
+ * Available shades: 50-950
25
+ */
26
+ mono: Ref<ThemeColors>;
27
+ /**
28
+ * Teal context color palette.
29
+ *
30
+ * Available shades: bg, fg, fgHover, bgHover
31
+ */
32
+ teal: Ref<ThemeContextColors>;
33
+ /**
34
+ * Yellow context color palette.
35
+ *
36
+ * Available shades: bg, fg, fgHover, bgHover
37
+ */
38
+ yellow: Ref<ThemeContextColors>;
39
+ /**
40
+ * Red context color palette.
41
+ *
42
+ * Available shades: bg, fg, fgHover, bgHover
43
+ */
44
+ red: Ref<ThemeContextColors>;
45
+ /**
46
+ * Lime context color palette.
47
+ *
48
+ * Available shades: bg, fg, fgHover, bgHover
49
+ */
50
+ lime: Ref<ThemeContextColors>;
51
+ /**
52
+ * Orange context color palette.
53
+ *
54
+ * Available shades: bg, fg, fgHover, bgHover
55
+ */
56
+ orange: Ref<ThemeContextColors>;
57
+ /**
58
+ * Get the draggable style for an element.
59
+ *
60
+ * Computes and caches the visual style to use when dragging this element.
61
+ * Includes background color, text color, and border radius.
62
+ *
63
+ * @param el - The element to get style for
64
+ * @returns The draggable style configuration
65
+ */
66
+ getDraggableStyle: (el: HTMLElement | SVGElement) => DraggableStyle;
67
+ /**
68
+ * Set a theme color value.
69
+ *
70
+ * Updates both the reactive ref and the CSS custom property on :root.
71
+ *
72
+ * @param group - The color group (accent, mono, teal, etc.)
73
+ * @param shade - The shade (50-950 for accent/mono, bg/fg/etc for context colors)
74
+ * @param value - RGB color as [r, g, b] array
75
+ */
76
+ setColor: <Group extends ThemeColorGroup | ThemeContextColorGroup>(group: Group, shade: Group extends ThemeColorGroup ? ThemeColorShade : ThemeContextColorShade, value: RGB) => void;
77
+ /**
78
+ * Apply a theme by name.
79
+ *
80
+ * Replaces all theme colors with the selected theme.
81
+ * Use 'custom' to restore previously customized colors.
82
+ *
83
+ * @param name - Theme name or 'custom' for customized theme
84
+ */
85
+ applyTheme: (name: ThemeName | 'custom') => void;
86
+ /**
87
+ * Invalidate cached style for an element.
88
+ *
89
+ * Forces recalculation of draggable style next time it's requested.
90
+ * Useful when element styling changes dynamically.
91
+ *
92
+ * @param el - The element to invalidate
93
+ */
94
+ invalidateCachedStyle: (el: HTMLElement | SVGElement) => void;
95
+ /**
96
+ * Get an RGB color value from the theme.
97
+ *
98
+ * @param color - The color group
99
+ * @param key - The shade key
100
+ * @returns RGB color as [r, g, b] array
101
+ */
102
+ getColor<K extends keyof ThemeMap, T extends ThemeMap[K]['value']>(color: K, key: keyof T): RGB;
103
+ /**
104
+ * Get a color as an rgba() CSS string.
105
+ *
106
+ * @param color - The color group
107
+ * @param key - The shade key
108
+ * @param alpha - Optional alpha value (0-1, default: 1)
109
+ * @returns CSS rgba() string
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * theme.getColorString('accent', 700, 0.5) // 'rgba(59, 130, 246, 0.5)'
114
+ * ```
115
+ */
116
+ getColorString<K extends keyof ThemeMap, T extends ThemeMap[K]['value']>(color: K, key: keyof T, alpha?: number): string;
117
+ };
118
+ export default function (element: ElementProvider): ThemeProvider;
119
+ export {};
@@ -1,8 +1,8 @@
1
1
  import { theme, themes } from "#blokkli-build/config";
2
2
  import { ref, onMounted, onBeforeUnmount } from "#imports";
3
- import { rgbaToString } from "./index.js";
4
- import { DragStyle } from "./DragStyle/index.js";
5
- import onBlokkliEvent from "./composables/onBlokkliEvent.js";
3
+ import { rgbaToString } from "../index.js";
4
+ import { DragStyle } from "../DragStyle/index.js";
5
+ import onBlokkliEvent from "../composables/onBlokkliEvent.js";
6
6
  export default function(element) {
7
7
  const rootElement = element.query(
8
8
  document,
@@ -0,0 +1,49 @@
1
+ import type { TourItem } from '#blokkli/types';
2
+ import { type Ref } from '#imports';
3
+ type TourProviderFunction = () => TourItem[] | TourItem | undefined;
4
+ export type TourProvider = {
5
+ /**
6
+ * Register a tour provider function.
7
+ *
8
+ * The function will be called when tour items are requested.
9
+ * It can return a single tour item, an array of tour items, or undefined.
10
+ *
11
+ * @param fn - Function that returns tour item(s)
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * tour.add(() => ({
16
+ * id: 'welcome',
17
+ * title: 'Welcome',
18
+ * text: 'Welcome to the editor!',
19
+ * element: '.bk-main-canvas',
20
+ * }))
21
+ * ```
22
+ */
23
+ add: (fn: TourProviderFunction) => void;
24
+ /**
25
+ * Unregister a tour provider function.
26
+ *
27
+ * Removes a previously registered function so it no longer provides tour items.
28
+ *
29
+ * @param fn - The function to remove (must be the same reference used in add)
30
+ */
31
+ remove: (fn: TourProviderFunction) => void;
32
+ /**
33
+ * Get all tour items from all registered providers.
34
+ *
35
+ * Calls all registered provider functions, flattens the results,
36
+ * and filters out undefined values.
37
+ *
38
+ * @returns Array of all available tour items
39
+ */
40
+ getTourItems: () => TourItem[];
41
+ /**
42
+ * Whether a tour is currently active.
43
+ *
44
+ * Set to true when a tour starts, false when it ends.
45
+ */
46
+ isTouring: Ref<boolean>;
47
+ };
48
+ export default function (): TourProvider;
49
+ export {};
@@ -1,4 +1,4 @@
1
- import { falsy } from "./index.js";
1
+ import { falsy } from "../index.js";
2
2
  import { ref } from "#imports";
3
3
  export default function() {
4
4
  let functions = [];
@@ -0,0 +1,170 @@
1
+ import type { ComputedRef } from 'vue';
2
+ import type { FieldConfig, BlockBundleDefinition, EditableFieldConfig, BlockDefinitionInput, BlockDefinitionOptionsInput, DroppableFieldConfig, DraggableExistingBlock, EntityContext } from '../../types/index.js';
3
+ import type { AdapterContext, BlokkliAdapter } from '../../adapter/index.js';
4
+ import type { SelectionProvider } from './selection.js';
5
+ export type BlokkliBlockType = BlockBundleDefinition & {
6
+ definition: BlockDefinitionInput<BlockDefinitionOptionsInput, never[]> | undefined;
7
+ };
8
+ /**
9
+ * Base interface for configuration objects that can be mapped by entity context.
10
+ *
11
+ * Used by ConfigMap to organize configuration data by entity type, bundle, and name
12
+ * for efficient lookup.
13
+ */
14
+ interface MappableConfig {
15
+ /**
16
+ * The entity type (e.g., 'paragraph', 'node', 'block_content').
17
+ */
18
+ entityType: string;
19
+ /**
20
+ * The entity bundle (e.g., 'text', 'image', 'article').
21
+ */
22
+ entityBundle: string;
23
+ /**
24
+ * The configuration name (typically a field name like 'field_paragraphs').
25
+ */
26
+ name: string;
27
+ }
28
+ /**
29
+ * Efficient lookup map for configuration objects organized by entity context.
30
+ *
31
+ * Provides O(1) lookups by entity type, entity type + bundle, and
32
+ * entity type + bundle + name combinations. Used for field configurations,
33
+ * editable field configurations, and droppable field configurations.
34
+ *
35
+ * @template T - Configuration type extending MappableConfig
36
+ */
37
+ declare class ConfigMap<T extends MappableConfig> {
38
+ private configs;
39
+ private mapEntityType;
40
+ private mapEntityTypeBundle;
41
+ private mapEntityTypeBundleName;
42
+ constructor(items: T[]);
43
+ /**
44
+ * Get all configurations for a specific entity type.
45
+ *
46
+ * @param entityType - The entity type to filter by
47
+ * @returns Array of matching configurations
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * // Get all field configs for paragraph entities
52
+ * const paragraphFields = fieldConfig.forEntityType('paragraph')
53
+ * ```
54
+ */
55
+ forEntityType(entityType: string): T[];
56
+ /**
57
+ * Get all configurations for a specific entity type and bundle combination.
58
+ *
59
+ * @param entityType - The entity type
60
+ * @param entityBundle - The entity bundle
61
+ * @returns Array of matching configurations
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * // Get all field configs for text paragraph bundle
66
+ * const textFields = fieldConfig.forEntityTypeAndBundle('paragraph', 'text')
67
+ * ```
68
+ */
69
+ forEntityTypeAndBundle(entityType: string, entityBundle: string): T[];
70
+ /**
71
+ * Get a specific configuration by entity type, bundle, and name.
72
+ *
73
+ * @param entityType - The entity type
74
+ * @param entityBundle - The entity bundle
75
+ * @param name - The configuration name (typically field name)
76
+ * @returns The matching configuration, or undefined if not found
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * // Get field config for specific field on text paragraph
81
+ * const config = fieldConfig.forName('paragraph', 'text', 'field_items')
82
+ * ```
83
+ */
84
+ forName(entityType: string, entityBundle: string, name: string): T | undefined;
85
+ /**
86
+ * Get all configurations.
87
+ *
88
+ * @returns Array of all configurations in the map
89
+ */
90
+ all(): T[];
91
+ }
92
+ export type BlockDefinitionProvider = {
93
+ /**
94
+ * List of block bundles that contain nested blocks.
95
+ *
96
+ * A bundle is included if it has any field configurations
97
+ * where it can contain other blocks.
98
+ */
99
+ itemBundlesWithNested: string[];
100
+ /**
101
+ * Allowed block types in the currently selected list.
102
+ *
103
+ * Computed based on the parent field of selected blocks.
104
+ * Returns empty array if:
105
+ * - No blocks are selected
106
+ * - Selected blocks are in different fields
107
+ */
108
+ allowedTypesInList: ComputedRef<string[]>;
109
+ /**
110
+ * Block bundles that can be used somewhere in the current context.
111
+ *
112
+ * Includes bundles allowed:
113
+ * - Directly on the current entity
114
+ * - In nested blocks allowed on the current entity
115
+ *
116
+ * Used for add dialogs, library, and other "available blocks" UIs.
117
+ */
118
+ generallyAvailableBundles: BlockBundleDefinition[];
119
+ /**
120
+ * Get the bundle definition for a specific block type.
121
+ *
122
+ * @param bundle - The block bundle ID (e.g., 'text', 'image')
123
+ * @returns The bundle definition, or undefined if not found
124
+ */
125
+ getBlockBundleDefinition: (bundle: string) => BlockBundleDefinition | undefined;
126
+ /**
127
+ * Get the field configuration for a specific field on an entity.
128
+ *
129
+ * Field configurations define allowed bundles, cardinality, and other
130
+ * field-level settings.
131
+ *
132
+ * @param entityType - The entity type
133
+ * @param entityBundle - The entity bundle
134
+ * @param fieldName - The field name
135
+ * @returns The field configuration, or undefined if not found
136
+ */
137
+ getFieldConfig: (entityType: string, entityBundle: string, fieldName: string) => FieldConfig | undefined;
138
+ /**
139
+ * Map of all field configurations.
140
+ *
141
+ * Provides efficient lookups by entity type, bundle, and field name.
142
+ */
143
+ fieldConfig: ConfigMap<FieldConfig>;
144
+ /**
145
+ * Map of editable field configurations.
146
+ *
147
+ * Defines which fields support inline editing and their configuration.
148
+ */
149
+ editableFieldConfig: ConfigMap<EditableFieldConfig>;
150
+ /**
151
+ * Map of droppable field configurations.
152
+ *
153
+ * Defines which fields can accept dropped blocks and their behavior.
154
+ */
155
+ droppableFieldConfig: ConfigMap<DroppableFieldConfig>;
156
+ /**
157
+ * Get droppable field configuration for a field on a host.
158
+ *
159
+ * Throws an error if configuration is not found, as droppable fields
160
+ * should always have configuration when accessed.
161
+ *
162
+ * @param fieldName - The field name
163
+ * @param host - The host block or entity context
164
+ * @returns The droppable field configuration
165
+ * @throws Error if configuration not found
166
+ */
167
+ getDroppableFieldConfig: (fieldName: string, host: DraggableExistingBlock | EntityContext) => DroppableFieldConfig;
168
+ };
169
+ export default function (adapter: BlokkliAdapter<any>, selection: SelectionProvider, context: ComputedRef<AdapterContext>): Promise<BlockDefinitionProvider>;
170
+ export {};