@blokkli/editor 2.0.0-alpha.16 → 2.0.0-alpha.18

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 (194) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +640 -137
  3. package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +1 -1
  4. package/dist/modules/drupal/graphql/base/fragment.paragraphsFieldItem.graphql +3 -1
  5. package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +1 -10
  6. package/dist/modules/drupal/graphql/features/comments.graphql +11 -8
  7. package/dist/modules/drupal/graphql/mutations/set_paragraph_schedule.graphql +15 -0
  8. package/dist/modules/drupal/index.mjs +33 -0
  9. package/dist/modules/drupal/runtime/adapter/index.js +12 -4
  10. package/dist/runtime/adapter/index.d.ts +21 -0
  11. package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +3 -0
  12. package/dist/runtime/blokkliPlugins/ItemAction/index.vue +23 -15
  13. package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +20 -44
  14. package/dist/runtime/blokkliPlugins/TourItem/index.vue +10 -5
  15. package/dist/runtime/components/Blocks/FromLibrary/index.vue +4 -2
  16. package/dist/runtime/components/BlokkliEditable.vue +32 -14
  17. package/dist/runtime/components/BlokkliField.vue +3 -0
  18. package/dist/runtime/components/BlokkliField.vue.d.ts +3 -3
  19. package/dist/runtime/components/BlokkliItem.vue +1 -1
  20. package/dist/runtime/components/BlokkliItem.vue.d.ts +4 -2
  21. package/dist/runtime/components/BlokkliProvider.vue +41 -28
  22. package/dist/runtime/components/BlokkliProvider.vue.d.ts +2 -1
  23. package/dist/runtime/components/Edit/Actions/index.vue +36 -20
  24. package/dist/runtime/components/Edit/AnimationCanvas/index.vue +436 -25
  25. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +83 -0
  26. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue.d.ts +32 -0
  27. package/dist/runtime/components/Edit/Banner/index.vue +51 -0
  28. package/dist/runtime/components/Edit/Banner/index.vue.d.ts +18 -0
  29. package/dist/runtime/components/Edit/Dialog/index.vue +6 -4
  30. package/dist/runtime/components/Edit/DraggableList.vue +15 -7
  31. package/dist/runtime/components/Edit/DraggableList.vue.d.ts +5 -5
  32. package/dist/runtime/components/Edit/EditIndicator.vue +118 -44
  33. package/dist/runtime/components/Edit/EditIndicator.vue.d.ts +3 -0
  34. package/dist/runtime/components/Edit/EditProvider.vue +101 -31
  35. package/dist/runtime/components/Edit/EditProvider.vue.d.ts +3 -0
  36. package/dist/runtime/components/Edit/Features/AddList/index.vue +9 -11
  37. package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +28 -26
  38. package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue +1 -1
  39. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -11
  40. package/dist/runtime/components/Edit/Features/Anchors/Renderer.vue +19 -102
  41. package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +3 -0
  42. package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +29 -53
  43. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue +154 -0
  44. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue.d.ts +27 -0
  45. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +222 -0
  46. package/dist/runtime/components/Edit/Features/{Selection/AddButtons/AddButtonsField.vue.d.ts → BlockScheduler/Dialog/index.vue.d.ts} +6 -9
  47. package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +96 -0
  48. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +15 -16
  49. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +51 -0
  50. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/{Group → Item}/index.vue.d.ts +9 -13
  51. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +46 -66
  52. package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +2 -0
  53. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +35 -20
  54. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue.d.ts +5 -3
  55. package/dist/runtime/components/Edit/Features/Comments/CommentInput/index.vue +29 -0
  56. package/dist/runtime/components/Edit/Features/{Publish/Dialog/ScheduleDate.vue.d.ts → Comments/CommentInput/index.vue.d.ts} +2 -2
  57. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +22 -16
  58. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue.d.ts +1 -0
  59. package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +15 -6
  60. package/dist/runtime/components/Edit/Features/Comments/index.vue +21 -9
  61. package/dist/runtime/components/Edit/Features/Conversions/index.vue +4 -7
  62. package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +26 -35
  63. package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +240 -0
  64. package/dist/runtime/components/Edit/Features/Debug/Renderer.vue.d.ts +6 -0
  65. package/dist/runtime/components/Edit/Features/Debug/index.vue +7 -165
  66. package/dist/runtime/components/Edit/Features/Delete/index.vue +1 -1
  67. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +14 -6
  68. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +55 -48
  69. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +30 -18
  70. package/dist/runtime/components/Edit/Features/Duplicate/index.vue +6 -8
  71. package/dist/runtime/components/Edit/Features/Edit/index.vue +16 -22
  72. package/dist/runtime/components/Edit/Features/EditForm/index.vue +7 -6
  73. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +69 -4
  74. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +2 -2
  75. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +13 -9
  76. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +45 -87
  77. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +2 -2
  78. package/dist/runtime/components/Edit/Features/EditableField/index.vue +41 -43
  79. package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +11 -9
  80. package/dist/runtime/components/Edit/Features/Fragments/index.vue +3 -3
  81. package/dist/runtime/components/Edit/Features/History/index.vue +5 -2
  82. package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +139 -0
  83. package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue +261 -0
  84. package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue.d.ts +6 -0
  85. package/dist/runtime/components/Edit/Features/Hover/Overlay/vertex.glsl +117 -0
  86. package/dist/runtime/components/Edit/Features/Hover/index.vue +25 -0
  87. package/dist/runtime/components/Edit/Features/Hover/index.vue.d.ts +2 -0
  88. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +5 -7
  89. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +19 -27
  90. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +32 -28
  91. package/dist/runtime/components/Edit/Features/Library/index.vue +28 -23
  92. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +6 -3
  93. package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +15 -12
  94. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +36 -29
  95. package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +2 -4
  96. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +6 -1
  97. package/dist/runtime/components/Edit/Features/Options/Form/index.vue +8 -6
  98. package/dist/runtime/components/Edit/Features/Options/index.vue +6 -6
  99. package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue +35 -0
  100. package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue.d.ts +6 -0
  101. package/dist/runtime/components/Edit/Features/Ownership/index.vue +7 -25
  102. package/dist/runtime/components/Edit/Features/ProxyView/index.vue +5 -1
  103. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +68 -15
  104. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +15 -15
  105. package/dist/runtime/components/Edit/Features/Search/index.vue +4 -1
  106. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +39 -74
  107. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +7 -5
  108. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +106 -0
  109. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +440 -0
  110. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue.d.ts +32 -0
  111. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +102 -0
  112. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +53 -125
  113. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +2 -2
  114. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +88 -29
  115. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +5 -3
  116. package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +11 -2
  117. package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +2 -2
  118. package/dist/runtime/components/Edit/Features/Selection/index.vue +66 -39
  119. package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +2 -2
  120. package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +13 -6
  121. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +3 -0
  122. package/dist/runtime/components/Edit/Features/Transform/index.vue +2 -27
  123. package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +17 -11
  124. package/dist/runtime/components/Edit/Features/Translations/index.vue +20 -23
  125. package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +5 -5
  126. package/dist/runtime/components/Edit/Features/index.vue +17 -7
  127. package/dist/runtime/components/Edit/Form/Text/index.vue +2 -1
  128. package/dist/runtime/components/Edit/Form/Text/index.vue.d.ts +1 -0
  129. package/dist/runtime/components/Edit/Form/Toggle/index.vue +4 -3
  130. package/dist/runtime/components/Edit/Form/Toggle/index.vue.d.ts +12 -2
  131. package/dist/runtime/components/Edit/Indicators/index.vue +1 -1
  132. package/dist/runtime/components/Edit/InfoBox/index.vue +6 -2
  133. package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +12 -2
  134. package/dist/runtime/components/Edit/Konami/Game/index.vue +5 -5
  135. package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue → ScheduleDate/index.vue} +6 -58
  136. package/dist/runtime/components/Edit/ScheduleDate/index.vue.d.ts +23 -0
  137. package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +3 -0
  138. package/dist/runtime/components/Edit/Transition/Height.vue +95 -0
  139. package/dist/runtime/components/Edit/Transition/Height.vue.d.ts +36 -0
  140. package/dist/runtime/components/Edit/index.d.ts +7 -3
  141. package/dist/runtime/components/Edit/index.js +12 -4
  142. package/dist/runtime/composables/defineBlokkli.js +4 -2
  143. package/dist/runtime/css/output.css +1 -1
  144. package/dist/runtime/helpers/animationProvider.d.ts +35 -1
  145. package/dist/runtime/helpers/animationProvider.js +179 -48
  146. package/dist/runtime/helpers/composables/defineRenderer.d.ts +8 -0
  147. package/dist/runtime/helpers/composables/defineRenderer.js +8 -0
  148. package/dist/runtime/helpers/composables/useStateBasedCache.d.ts +4 -0
  149. package/dist/runtime/helpers/composables/useStateBasedCache.js +13 -0
  150. package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +4 -1
  151. package/dist/runtime/helpers/composables/useStickyToolbar.js +53 -35
  152. package/dist/runtime/helpers/definitionProvider.d.ts +1 -1
  153. package/dist/runtime/helpers/dom/index.d.ts +1 -0
  154. package/dist/runtime/helpers/domProvider.d.ts +54 -14
  155. package/dist/runtime/helpers/domProvider.js +168 -134
  156. package/dist/runtime/helpers/index.d.ts +1 -8
  157. package/dist/runtime/helpers/index.js +1 -84
  158. package/dist/runtime/helpers/providers/blocks.d.ts +10 -0
  159. package/dist/runtime/helpers/providers/blocks.js +91 -0
  160. package/dist/runtime/helpers/providers/directive.d.ts +24 -0
  161. package/dist/runtime/helpers/providers/directive.js +205 -0
  162. package/dist/runtime/helpers/providers/element.d.ts +6 -0
  163. package/dist/runtime/helpers/providers/element.js +35 -0
  164. package/dist/runtime/helpers/providers/fields.d.ts +8 -0
  165. package/dist/runtime/helpers/providers/fields.js +47 -0
  166. package/dist/runtime/helpers/selectionProvider.d.ts +11 -11
  167. package/dist/runtime/helpers/selectionProvider.js +38 -45
  168. package/dist/runtime/helpers/stateProvider.d.ts +7 -2
  169. package/dist/runtime/helpers/stateProvider.js +83 -14
  170. package/dist/runtime/helpers/storageProvider.d.ts +3 -2
  171. package/dist/runtime/helpers/storageProvider.js +6 -2
  172. package/dist/runtime/helpers/symbols.d.ts +1 -0
  173. package/dist/runtime/helpers/symbols.js +1 -0
  174. package/dist/runtime/helpers/themeProvider.d.ts +2 -1
  175. package/dist/runtime/helpers/themeProvider.js +24 -14
  176. package/dist/runtime/helpers/typesProvider.js +10 -26
  177. package/dist/runtime/helpers/uiProvider.d.ts +11 -3
  178. package/dist/runtime/helpers/uiProvider.js +45 -17
  179. package/dist/runtime/icons/calendar.svg +1 -0
  180. package/dist/runtime/icons/clock.svg +1 -0
  181. package/dist/runtime/icons/comment_add.svg +1 -5
  182. package/dist/runtime/icons/delete.svg +1 -8
  183. package/dist/runtime/icons/duplicate.svg +1 -12
  184. package/dist/runtime/icons/edit.svg +1 -8
  185. package/dist/runtime/icons/reusable.svg +1 -5
  186. package/dist/runtime/plugins/blokkliDirectives.js +96 -0
  187. package/dist/runtime/types/index.d.ts +66 -35
  188. package/package.json +1 -1
  189. package/dist/runtime/components/Edit/DragInteractions/index.vue +0 -401
  190. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +0 -63
  191. package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue +0 -54
  192. package/dist/runtime/plugins/blokkliEditable.js +0 -31
  193. /package/dist/runtime/components/Edit/{DragInteractions → Features/BlockScheduler}/index.vue.d.ts +0 -0
  194. /package/dist/runtime/plugins/{blokkliEditable.d.ts → blokkliDirectives.d.ts} +0 -0
@@ -0,0 +1,96 @@
1
+ import {
2
+ INJECT_APP,
3
+ INJECT_ENTITY_CONTEXT,
4
+ INJECT_IS_IN_REUSABLE
5
+ } from "#blokkli/helpers/symbols";
6
+ import { defineNuxtPlugin } from "#imports";
7
+ function getInjection(vnode, symbol) {
8
+ return vnode.ctx?.provides?.[symbol];
9
+ }
10
+ function getBlokkliApp(vnode) {
11
+ return getInjection(vnode, INJECT_APP);
12
+ }
13
+ function getEntityContext(vnode) {
14
+ return getInjection(vnode, INJECT_ENTITY_CONTEXT);
15
+ }
16
+ function isInReusable(vnode) {
17
+ return !!getInjection(vnode, INJECT_IS_IN_REUSABLE);
18
+ }
19
+ function getFieldName(binding) {
20
+ const fieldName = binding.value?.name || binding.arg;
21
+ if (fieldName && typeof fieldName === "string") {
22
+ return fieldName;
23
+ }
24
+ }
25
+ function isEditing() {
26
+ if (import.meta.client) {
27
+ return window.location.search.includes("blokkliEditing");
28
+ }
29
+ return false;
30
+ }
31
+ function createDirective(type) {
32
+ const dataset = type === "editable" ? "blokkliEditableField" : "blokkliDroppableField";
33
+ return {
34
+ created(el, binding, vnode) {
35
+ if (import.meta.client) {
36
+ if (!isEditing()) {
37
+ return;
38
+ }
39
+ if (isInReusable(vnode)) {
40
+ return;
41
+ }
42
+ const fieldName = getFieldName(binding);
43
+ if (!fieldName) {
44
+ return;
45
+ }
46
+ el.dataset[dataset] = fieldName;
47
+ }
48
+ },
49
+ mounted(el, binding, vnode) {
50
+ if (!isEditing()) {
51
+ return;
52
+ }
53
+ if (isInReusable(vnode)) {
54
+ return;
55
+ }
56
+ const app = getBlokkliApp(vnode);
57
+ if (!app) {
58
+ return;
59
+ }
60
+ const entity = getEntityContext(vnode);
61
+ if (!entity) {
62
+ return;
63
+ }
64
+ const fieldName = getFieldName(binding);
65
+ if (!fieldName) {
66
+ return;
67
+ }
68
+ app.directive.registerDirectiveElement(el, fieldName, entity, type);
69
+ },
70
+ beforeUnmount(el, binding, vnode) {
71
+ if (!isEditing()) {
72
+ return;
73
+ }
74
+ const app = getBlokkliApp(vnode);
75
+ if (!app) {
76
+ return;
77
+ }
78
+ const entity = getEntityContext(vnode);
79
+ if (!entity) {
80
+ return;
81
+ }
82
+ const fieldName = getFieldName(binding);
83
+ if (!fieldName) {
84
+ return;
85
+ }
86
+ app.directive.unregisterDirectiveElement(el, fieldName, entity, type);
87
+ }
88
+ };
89
+ }
90
+ export default defineNuxtPlugin({
91
+ name: "blokkli:directives",
92
+ setup(nuxtApp) {
93
+ nuxtApp.vueApp.directive("blokkli-editable", createDirective("editable"));
94
+ nuxtApp.vueApp.directive("blokkli-droppable", createDirective("droppable"));
95
+ }
96
+ });
@@ -8,6 +8,7 @@ import type { KeyboardProvider } from '../helpers/keyboardProvider.js';
8
8
  import type { UiProvider } from '../helpers/uiProvider.js';
9
9
  import type { AnimationProvider } from '../helpers/animationProvider.js';
10
10
  import type { StateProvider } from '../helpers/stateProvider.js';
11
+ import type { DirectiveProvider } from '../helpers/providers/directive.js';
11
12
  import type { TextProvider } from '../helpers/textProvider.js';
12
13
  import type { PluginProvider } from '../helpers/pluginProvider.js';
13
14
  import type { eventBus } from './../helpers/eventBus.js';
@@ -19,7 +20,7 @@ import type { BlokkliIcon } from '#blokkli-build/icons';
19
20
  import type { SettingsGroup, Viewport } from '#blokkli/constants';
20
21
  import type { BlockBundleWithNested, FieldListItemTyped, GlobalOptionsKey, ValidChunkNames, ValidFieldListTypes, ValidGlobalConfigKeys, BundleProps } from '#blokkli-build/generated-types';
21
22
  import type { ThemeProvider } from '#blokkli/helpers/themeProvider';
22
- import type { GlobalOptionsType } from '#blokkli-build/definitions';
23
+ import type { BlokkliFragmentName, GlobalOptionsType } from '#blokkli-build/definitions';
23
24
  import type { CommandsProvider } from '#blokkli/helpers/commandsProvider';
24
25
  import type { TourProvider } from '#blokkli/helpers/tourProvider';
25
26
  import type { DropAreaProvider } from '#blokkli/helpers/dropAreaProvider';
@@ -28,7 +29,10 @@ import type { DebugProvider } from '#blokkli/helpers/debugProvider';
28
29
  import type getVideoId from 'get-video-id';
29
30
  import type { DefinitionProvider } from '../helpers/definitionProvider.js';
30
31
  import type { IndicatorsProvider } from '#blokkli/helpers/indicatorsProvider';
31
- export type MutateWithLoadingStateFunction = (promise: () => Promise<MutationResponseLike<any>> | undefined, errorMessage?: string, successMessage?: string) => Promise<boolean>;
32
+ import type { BlocksProvider } from '#blokkli/helpers/providers/blocks';
33
+ import type { FieldsProvider } from '#blokkli/helpers/providers/fields';
34
+ import type { ElementProvider } from '#blokkli/helpers/providers/element';
35
+ export type MutateWithLoadingStateFunction = (promise: () => Promise<MutationResponseLike<any>> | undefined, errorMessage?: string | false, successMessage?: string) => Promise<boolean>;
32
36
  type GetType<T> = T extends {
33
37
  options: infer O;
34
38
  } ? T extends {
@@ -341,8 +345,8 @@ export type InjectedBlokkliItem = {
341
345
  export type FieldListItem = {
342
346
  uuid: string;
343
347
  bundle: string;
344
- isNew?: boolean;
345
348
  options?: Record<string, any>;
349
+ editContext?: BlockEditContext;
346
350
  props?: Record<string, any>;
347
351
  };
348
352
  export type MutatedField = {
@@ -381,6 +385,7 @@ export type BlokkliProviderEntityContext = {
381
385
  bundle: string;
382
386
  language?: string;
383
387
  };
388
+ export type EditPermission = 'view' | 'edit' | 'review';
384
389
  export type EditEntity = {
385
390
  label?: string;
386
391
  status?: boolean;
@@ -568,8 +573,10 @@ export interface BlockBundleDefinition {
568
573
  description?: string;
569
574
  allowReusable?: boolean;
570
575
  isTranslatable?: boolean;
576
+ hasPublishOn?: boolean;
577
+ hasUnpublishOn?: boolean;
571
578
  }
572
- export type EditMode = 'readonly' | 'editing' | 'translating';
579
+ export type EditMode = 'readonly' | 'editing' | 'translating' | 'review';
573
580
  export type MutatedOptions = {
574
581
  [uuid: string]: {
575
582
  [key: string]: string;
@@ -684,36 +691,12 @@ export type DraggableStyle = {
684
691
  };
685
692
  export interface DraggableExistingStructureBlock {
686
693
  itemType: 'existing_structure';
687
- uuid: string;
688
- itemBundle: string;
694
+ block: RenderedFieldListItem;
689
695
  element: () => HTMLElement;
690
696
  }
691
697
  export interface DraggableExistingBlock {
692
698
  itemType: 'existing';
693
- element: () => HTMLElement;
694
- entityType: string;
695
- hostType: string;
696
- hostBundle: string;
697
- hostUuid: string;
698
- hostFieldName: string;
699
- hostFieldListType: ValidFieldListTypes;
700
- itemBundle: string;
701
- isNew: boolean;
702
- uuid: string;
703
- isNested: boolean;
704
- /**
705
- * The bundle if this item is reusable.
706
- */
707
- reusableBundle?: string;
708
- /**
709
- * The UUID of the library item this block belongs to.
710
- */
711
- libraryItemUuid?: string;
712
- /**
713
- * The title to use when displaying the block in lists during editing.
714
- */
715
- editTitle?: string;
716
- parentBlockBundle: BlockBundleWithNested | undefined;
699
+ block: RenderedFieldListItem;
717
700
  }
718
701
  export interface DraggableNewItem {
719
702
  itemType: 'new';
@@ -848,11 +831,15 @@ export type Coord = {
848
831
  };
849
832
  export type Rectangle = Size & Coord;
850
833
  export type CanvasDrawEvent = {
834
+ gl: WebGLRenderingContext;
851
835
  mouseX: number;
852
836
  mouseY: number;
837
+ mouseArtboard: Coord;
853
838
  artboardOffset: Coord;
854
839
  artboardScale: number;
840
+ artboardSize: Size;
855
841
  time: number;
842
+ selectedUuids: string[];
856
843
  };
857
844
  export type MakeReusableEvent = {
858
845
  label: string;
@@ -936,8 +923,9 @@ export type BlokkliFieldElement = {
936
923
  allowedFragments: string[];
937
924
  cardinality: number;
938
925
  element: HTMLElement;
939
- dropAlignment?: 'vertical' | 'horizontal';
926
+ dropAlignment: FieldDropAlignment | null;
940
927
  };
928
+ export type FieldDropAlignment = 'vertical' | 'horizontal';
941
929
  export type ActionPlacedEvent = {
942
930
  id: string;
943
931
  preceedingUuid?: string;
@@ -1021,7 +1009,6 @@ export type EventbusEvents = {
1021
1009
  'dragging:start': DraggableStartEvent;
1022
1010
  'dragging:drop': DropTargetEvent;
1023
1011
  'dragging:end': undefined;
1024
- setActiveFieldKey: string;
1025
1012
  'add:block:new': AddNewBlockEvent;
1026
1013
  updateMutatedFields: UpdateMutatedFieldsEvent;
1027
1014
  animationFrame: AnimationFrameEvent;
@@ -1036,17 +1023,20 @@ export type EventbusEvents = {
1036
1023
  'select:toggle': string;
1037
1024
  'select:shiftToggle': string;
1038
1025
  'select:end': string[] | undefined;
1039
- 'select:previous': undefined;
1040
- 'select:next': undefined;
1041
1026
  'item:dropped': undefined;
1042
1027
  'block:append': BlockAppendEvent;
1043
- 'item:doubleClick': DraggableExistingBlock;
1028
+ 'item:doubleClick': RenderedFieldListItem;
1044
1029
  scrollIntoView: ScrollIntoViewEvent;
1045
1030
  'animationFrame:before': AnimationFrameBeforeEvent;
1031
+ 'animationFrame:after': undefined;
1046
1032
  'canvas:draw': CanvasDrawEvent;
1047
1033
  'state:reloaded': undefined;
1048
1034
  addContentSearchItem: AddContentSearchItemEvent;
1049
1035
  'option:update': UpdateBlockOptionEvent;
1036
+ /**
1037
+ * Emitted after finishing changing options.
1038
+ */
1039
+ 'option:finish-change': undefined;
1050
1040
  'plugin:mount': PluginMountEvent;
1051
1041
  'plugin:unmount': PluginUnmountEvent;
1052
1042
  'editable:focus': EditableFieldFocusEvent;
@@ -1113,7 +1103,9 @@ export interface BlokkliApp {
1113
1103
  storage: StorageProvider;
1114
1104
  types: BlockDefinitionProvider;
1115
1105
  selection: SelectionProvider;
1106
+ blocks: BlocksProvider;
1116
1107
  keyboard: KeyboardProvider;
1108
+ element: ElementProvider;
1117
1109
  ui: UiProvider;
1118
1110
  animation: AnimationProvider;
1119
1111
  definitions: DefinitionProvider;
@@ -1129,6 +1121,8 @@ export interface BlokkliApp {
1129
1121
  debug: DebugProvider;
1130
1122
  indicators: IndicatorsProvider;
1131
1123
  plugins: PluginProvider;
1124
+ directive: DirectiveProvider;
1125
+ fields: FieldsProvider;
1132
1126
  }
1133
1127
  export type PasteExistingBlocksEvent = {
1134
1128
  uuids: string[];
@@ -1384,5 +1378,42 @@ export type AddAction = {
1384
1378
  description?: string;
1385
1379
  enabled?: boolean;
1386
1380
  };
1381
+ export type BlockEditContext = {
1382
+ isPublished: boolean;
1383
+ isNew: boolean;
1384
+ publishOn?: string | null;
1385
+ unpublishOn?: string | null;
1386
+ };
1387
+ export type RenderedFieldListItem = {
1388
+ uuid: string;
1389
+ bundle: string;
1390
+ isNew: boolean;
1391
+ isPublished: boolean;
1392
+ host: DraggableHostData & {
1393
+ bundle: string;
1394
+ };
1395
+ fieldListType: ValidFieldListTypes;
1396
+ parentBlockBundle: BlockBundleWithNested | null;
1397
+ library: {
1398
+ label: string;
1399
+ libraryItemUuid: string;
1400
+ reusableBundle: string;
1401
+ } | null;
1402
+ isNested: boolean;
1403
+ publishOn?: string | null;
1404
+ unpublishOn?: string | null;
1405
+ };
1406
+ export type BlokkliDirectiveType = 'editable' | 'droppable';
1407
+ export type RegisteredField = {
1408
+ element: HTMLElement;
1409
+ entity: EntityContext;
1410
+ fieldName: string;
1411
+ fieldListType: ValidFieldListTypes;
1412
+ allowedFragments: BlokkliFragmentName[];
1413
+ isNested: boolean;
1414
+ nestingLevel: number;
1415
+ dropAlignment: FieldDropAlignment | null;
1416
+ };
1417
+ export type RegisterFieldData = Pick<RegisteredField, 'fieldListType' | 'allowedFragments' | 'isNested' | 'nestingLevel' | 'dropAlignment'>;
1387
1418
  declare const _default: {};
1388
1419
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blokkli/editor",
3
- "version": "2.0.0-alpha.16",
3
+ "version": "2.0.0-alpha.18",
4
4
  "description": "Interactive page building experience for Nuxt",
5
5
  "repository": "blokkli/editor",
6
6
  "type": "module",