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

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 (106) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +265 -83
  3. package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +1 -1
  4. package/dist/modules/drupal/graphql/features/comments.graphql +11 -8
  5. package/dist/modules/drupal/runtime/adapter/index.js +2 -2
  6. package/dist/runtime/blokkliPlugins/ItemAction/index.vue +1 -3
  7. package/dist/runtime/components/Blocks/FromLibrary/index.vue +4 -2
  8. package/dist/runtime/components/BlokkliEditable.vue +22 -4
  9. package/dist/runtime/components/BlokkliProvider.vue +29 -20
  10. package/dist/runtime/components/BlokkliProvider.vue.d.ts +2 -1
  11. package/dist/runtime/components/Edit/Actions/index.vue +9 -4
  12. package/dist/runtime/components/Edit/AnimationCanvas/index.vue +420 -25
  13. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +80 -0
  14. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue.d.ts +32 -0
  15. package/dist/runtime/components/Edit/Banner/index.vue +51 -0
  16. package/dist/runtime/components/Edit/Banner/index.vue.d.ts +18 -0
  17. package/dist/runtime/components/Edit/EditIndicator.vue +118 -44
  18. package/dist/runtime/components/Edit/EditIndicator.vue.d.ts +3 -0
  19. package/dist/runtime/components/Edit/EditProvider.vue +79 -22
  20. package/dist/runtime/components/Edit/EditProvider.vue.d.ts +2 -0
  21. package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +19 -20
  22. package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +1 -1
  23. package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +2 -0
  24. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +35 -20
  25. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue.d.ts +5 -3
  26. package/dist/runtime/components/Edit/Features/Comments/CommentInput/index.vue +29 -0
  27. package/dist/runtime/components/Edit/Features/Comments/CommentInput/index.vue.d.ts +13 -0
  28. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +22 -16
  29. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue.d.ts +1 -0
  30. package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +15 -6
  31. package/dist/runtime/components/Edit/Features/Comments/index.vue +20 -8
  32. package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +26 -35
  33. package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +240 -0
  34. package/dist/runtime/components/Edit/Features/Debug/Renderer.vue.d.ts +6 -0
  35. package/dist/runtime/components/Edit/Features/Debug/index.vue +4 -165
  36. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +1 -1
  37. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +41 -37
  38. package/dist/runtime/components/Edit/Features/Edit/index.vue +1 -1
  39. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +63 -3
  40. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +13 -9
  41. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +17 -76
  42. package/dist/runtime/components/Edit/Features/EditableField/index.vue +1 -1
  43. package/dist/runtime/components/Edit/Features/History/index.vue +5 -2
  44. package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +139 -0
  45. package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue +270 -0
  46. package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue.d.ts +6 -0
  47. package/dist/runtime/components/Edit/Features/Hover/Overlay/vertex.glsl +117 -0
  48. package/dist/runtime/components/Edit/Features/Hover/index.vue +25 -0
  49. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +19 -27
  50. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +27 -23
  51. package/dist/runtime/components/Edit/Features/Library/index.vue +2 -1
  52. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +34 -27
  53. package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +2 -4
  54. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +6 -1
  55. package/dist/runtime/components/Edit/Features/Options/Form/index.vue +1 -0
  56. package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue +35 -0
  57. package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue.d.ts +6 -0
  58. package/dist/runtime/components/Edit/Features/Ownership/index.vue +7 -25
  59. package/dist/runtime/components/Edit/Features/ProxyView/index.vue +5 -1
  60. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +39 -74
  61. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +4 -2
  62. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +106 -0
  63. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +417 -0
  64. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue.d.ts +32 -0
  65. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +102 -0
  66. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +33 -106
  67. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +88 -29
  68. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +2 -0
  69. package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +11 -2
  70. package/dist/runtime/components/Edit/Features/Selection/index.vue +5 -12
  71. package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +17 -11
  72. package/dist/runtime/components/Edit/Features/Translations/index.vue +13 -16
  73. package/dist/runtime/components/Edit/Form/Text/index.vue +2 -1
  74. package/dist/runtime/components/Edit/Form/Text/index.vue.d.ts +1 -0
  75. package/dist/runtime/components/Edit/Indicators/index.vue +1 -1
  76. package/dist/runtime/components/Edit/Konami/Game/index.vue +5 -5
  77. package/dist/runtime/components/Edit/index.d.ts +5 -3
  78. package/dist/runtime/components/Edit/index.js +8 -4
  79. package/dist/runtime/composables/defineBlokkli.js +4 -2
  80. package/dist/runtime/css/output.css +1 -1
  81. package/dist/runtime/helpers/animationProvider.d.ts +34 -1
  82. package/dist/runtime/helpers/animationProvider.js +175 -48
  83. package/dist/runtime/helpers/composables/defineRenderer.d.ts +8 -0
  84. package/dist/runtime/helpers/composables/defineRenderer.js +8 -0
  85. package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +4 -1
  86. package/dist/runtime/helpers/composables/useStickyToolbar.js +53 -35
  87. package/dist/runtime/helpers/dom/index.d.ts +1 -0
  88. package/dist/runtime/helpers/domProvider.d.ts +46 -0
  89. package/dist/runtime/helpers/domProvider.js +95 -6
  90. package/dist/runtime/helpers/editableProvider.d.ts +14 -0
  91. package/dist/runtime/helpers/editableProvider.js +144 -0
  92. package/dist/runtime/helpers/stateProvider.d.ts +6 -2
  93. package/dist/runtime/helpers/stateProvider.js +66 -3
  94. package/dist/runtime/helpers/storageProvider.d.ts +3 -2
  95. package/dist/runtime/helpers/storageProvider.js +6 -2
  96. package/dist/runtime/helpers/symbols.d.ts +1 -0
  97. package/dist/runtime/helpers/symbols.js +1 -0
  98. package/dist/runtime/helpers/uiProvider.d.ts +8 -1
  99. package/dist/runtime/helpers/uiProvider.js +34 -2
  100. package/dist/runtime/plugins/blokkliEditable.js +74 -3
  101. package/dist/runtime/types/index.d.ts +13 -1
  102. package/package.json +1 -1
  103. package/dist/runtime/components/Edit/DragInteractions/index.vue +0 -401
  104. package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue +0 -54
  105. package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue.d.ts +0 -14
  106. /package/dist/runtime/components/Edit/{DragInteractions → Features/Hover}/index.vue.d.ts +0 -0
@@ -2,7 +2,7 @@ fragment blokkliProps on ParagraphsBlokkliProps {
2
2
  entityUuid
3
3
  entityType
4
4
  entityBundle
5
- canEdit
5
+ permissions
6
6
  editLabel
7
7
  language
8
8
  hostOptions
@@ -32,30 +32,33 @@ query pbComments(
32
32
  mutation pbAddComment(
33
33
  $entityType: EntityType!
34
34
  $entityUuid: String!
35
+ $langcode: String!
35
36
  $blockUuids: [String]!
36
37
  $body: String!
37
38
  ) {
38
- state: paragraphsEditMutationState(
39
+ action: paragraphsBlokkliAddComment(
39
40
  entityType: $entityType
40
41
  entityUuid: $entityUuid
42
+ langcode: $langcode
43
+ body: $body
44
+ paragraphUuids: $blockUuids
41
45
  ) {
42
- action: addComment(body: $body, paragraphUuids: $blockUuids) {
43
- ...paragraphsBlokkliComment
44
- }
46
+ ...paragraphsBlokkliComment
45
47
  }
46
48
  }
47
49
 
48
50
  mutation pbResolveComment(
49
51
  $entityType: EntityType!
50
52
  $entityUuid: String!
53
+ $langcode: String!
51
54
  $uuid: String!
52
55
  ) {
53
- state: paragraphsEditMutationState(
56
+ action: paragraphsBlokkliResolveComment(
54
57
  entityType: $entityType
55
58
  entityUuid: $entityUuid
59
+ langcode: $langcode
60
+ uuid: $uuid
56
61
  ) {
57
- action: resolveComment(uuid: $uuid) {
58
- ...paragraphsBlokkliComment
59
- }
62
+ ...paragraphsBlokkliComment
60
63
  }
61
64
  }
@@ -527,13 +527,13 @@ export default defineBlokkliEditAdapter(
527
527
  ...ctx.value,
528
528
  blockUuids,
529
529
  body
530
- }).then((v) => mapComments(v.data.state?.action || []));
530
+ }).then((v) => mapComments(v.data.action || []));
531
531
  }
532
532
  if (hasMutation("pbResolveComment")) {
533
533
  adapter.resolveComment = (uuid) => useGraphqlMutation("pbResolveComment", {
534
534
  ...ctx.value,
535
535
  uuid
536
- }).then((v) => mapComments(v.data.state?.action || []));
536
+ }).then((v) => mapComments(v.data.action || []));
537
537
  }
538
538
  if (hasQuery("pbLibraryItems")) {
539
539
  adapter.getLibraryItems = (data) => {
@@ -23,9 +23,7 @@
23
23
  </div>
24
24
  </button>
25
25
  </Teleport>
26
- <Teleport to="#bk-blokkli-item-actions-after">
27
- <slot :items="selection.blocks.value" :uuids="uuids" />
28
- </Teleport>
26
+ <slot :items="selection.blocks.value" :uuids="uuids" />
29
27
  </template>
30
28
 
31
29
  <script setup>
@@ -18,16 +18,18 @@
18
18
  import { computed, provide, defineBlokkli } from "#imports";
19
19
  import {
20
20
  INJECT_IS_IN_REUSABLE,
21
- INJECT_REUSABLE_OPTIONS
21
+ INJECT_REUSABLE_OPTIONS,
22
+ INJECT_REUSABLE_UUID
22
23
  } from "#blokkli/helpers/symbols";
23
24
  const props = defineProps({
24
25
  libraryItem: { type: Object, required: false }
25
26
  });
26
- const { index, options, parentType, isEditing } = defineBlokkli({
27
+ const { index, options, parentType, isEditing, uuid } = defineBlokkli({
27
28
  bundle: "from_library"
28
29
  });
29
30
  provide(INJECT_REUSABLE_OPTIONS, options);
30
31
  provide(INJECT_IS_IN_REUSABLE, true);
32
+ provide(INJECT_REUSABLE_UUID, uuid);
31
33
  const item = computed(() => {
32
34
  const v = props.libraryItem?.block;
33
35
  if (v && "uuid" in v) {
@@ -1,15 +1,24 @@
1
1
  <template>
2
- <component :is="tag" v-bind="attrs">
2
+ <component :is="tag" v-bind="attrs" ref="root">
3
3
  <slot :value="renderedValue" />
4
4
  </component>
5
5
  </template>
6
6
 
7
7
  <script setup>
8
- import { ref, computed, inject, onMounted, onBeforeUnmount } from "#imports";
9
8
  import {
9
+ ref,
10
+ computed,
11
+ inject,
12
+ onMounted,
13
+ onBeforeUnmount,
14
+ useTemplateRef
15
+ } from "#imports";
16
+ import {
17
+ INJECT_APP,
10
18
  INJECT_EDIT_CONTEXT,
11
19
  INJECT_ENTITY_CONTEXT,
12
- INJECT_IS_EDITING
20
+ INJECT_IS_EDITING,
21
+ INJECT_IS_IN_REUSABLE
13
22
  } from "#blokkli/helpers/symbols";
14
23
  const props = defineProps({
15
24
  name: { type: String, required: true },
@@ -17,10 +26,13 @@ const props = defineProps({
17
26
  tag: { type: String, required: false, default: "div" }
18
27
  });
19
28
  defineSlots();
29
+ const root = useTemplateRef("root");
20
30
  const valueOverride = ref("");
21
31
  const isEditing = inject(INJECT_IS_EDITING, false);
22
32
  const entity = inject(INJECT_ENTITY_CONTEXT);
23
33
  const editContext = inject(INJECT_EDIT_CONTEXT, null);
34
+ const app = inject(INJECT_APP, null);
35
+ const isInReusable = inject(INJECT_IS_IN_REUSABLE, false);
24
36
  if (!entity) {
25
37
  throw new Error("Missing entity context.");
26
38
  }
@@ -41,14 +53,20 @@ const onEditableUpdateValue = (e) => {
41
53
  }
42
54
  };
43
55
  onMounted(() => {
44
- if (!isEditing || !editContext) {
56
+ if (!isEditing || !editContext || !app || isInReusable) {
45
57
  return;
46
58
  }
47
59
  editContext.eventBus.on("editable:update", onEditableUpdateValue);
60
+ if (root.value instanceof HTMLElement && entity) {
61
+ app.editable.registerEditableField(root.value, props.name, entity);
62
+ }
48
63
  });
49
64
  onBeforeUnmount(() => {
50
65
  if (editContext) {
51
66
  editContext.eventBus.off("editable:update", onEditableUpdateValue);
52
67
  }
68
+ if (app && root.value instanceof HTMLElement && entity) {
69
+ app.editable.unregisterEditableField(root.value, props.name, entity);
70
+ }
53
71
  });
54
72
  </script>
@@ -9,16 +9,16 @@
9
9
  <PreviewProvider
10
10
  v-if="isPreviewing"
11
11
  v-slot="{ mutatedEntity }"
12
- :entity="entity"
13
- :entity-type="entityType"
14
- :entity-uuid="entityUuid"
15
- :entity-bundle="entityBundle"
16
- :language="language"
12
+ :entity
13
+ :entity-type
14
+ :entity-uuid
15
+ :entity-bundle
16
+ :language
17
17
  >
18
18
  <slot
19
19
  :entity="mutatedEntity"
20
- :is-editing="isEditing"
21
- :can-edit="canEdit"
20
+ :is-editing
21
+ :can-edit
22
22
  :is-preview="isPreviewing"
23
23
  />
24
24
  </PreviewProvider>
@@ -31,10 +31,11 @@
31
31
  :entity-bundle="entityBundle"
32
32
  :language="language"
33
33
  :isolate="isolate"
34
+ :permissions
34
35
  >
35
36
  <slot
36
- :is-editing="isEditing"
37
- :can-edit="canEdit"
37
+ :is-editing
38
+ :can-edit
38
39
  :is-preview="isPreviewing"
39
40
  :entity="mutatedEntity"
40
41
  />
@@ -43,18 +44,22 @@
43
44
 
44
45
  <slot
45
46
  v-else
46
- :is-editing="isEditing"
47
- :can-edit="canEdit"
47
+ :is-editing
48
+ :can-edit
48
49
  :is-preview="isPreviewing"
49
50
  :entity="entity"
50
51
  />
51
52
 
52
- <EditIndicator
53
- v-if="showIndicator"
54
- :uuid="entityUuid"
55
- :edit-label="editLabel"
56
- @edit="edit"
57
- />
53
+ <ClientOnly>
54
+ <EditIndicator
55
+ v-if="showIndicator"
56
+ :uuid="entityUuid"
57
+ :entity-type
58
+ :edit-label
59
+ :permissions
60
+ @edit="edit"
61
+ />
62
+ </ClientOnly>
58
63
  </div>
59
64
  </template>
60
65
 
@@ -92,26 +97,30 @@ const props = defineProps({
92
97
  entityType: { type: String, required: true },
93
98
  entityBundle: { type: String, required: true },
94
99
  entityUuid: { type: String, required: true },
95
- canEdit: { type: Boolean, required: true },
96
100
  tag: { type: String, required: false, default: "div" },
97
101
  language: { type: String, required: false, default: "" },
98
102
  editLabel: { type: String, required: false, default: "" },
99
103
  editPath: { type: String, required: false, default: void 0 },
100
104
  hostOptions: { type: null, required: false, default: void 0 },
105
+ permissions: { type: Array, required: false, default: () => {
106
+ return [];
107
+ } },
101
108
  isolate: { type: Boolean, required: false }
102
109
  });
103
110
  const shouldRender = ref(false);
104
111
  const isInEditor = computed(
105
112
  () => props.entityUuid && props.entityType && props.entityBundle && (isPreviewing.value || isEditing.value)
106
113
  );
114
+ const canEdit = computed(() => props.permissions.includes("edit"));
115
+ const canUseBlokkli = computed(() => !!props.permissions.length);
107
116
  const isEditing = computed(
108
- () => props.canEdit && !!props.entityUuid && route.query.blokkliEditing === props.entityUuid
117
+ () => canUseBlokkli.value && !!props.entityUuid && route.query.blokkliEditing === props.entityUuid
109
118
  );
110
119
  const isPreviewing = computed(
111
120
  () => !!props.entityUuid && route.query.blokkliPreview === props.entityUuid
112
121
  );
113
122
  const showIndicator = computed(
114
- () => props.canEdit && !route.query.blokkliEditing && !route.query.blokkliPreview
123
+ () => !!props.permissions.length && !route.query.blokkliEditing && !route.query.blokkliPreview
115
124
  );
116
125
  function edit() {
117
126
  router.push({
@@ -1,15 +1,16 @@
1
+ import type { EditPermission } from '#blokkli/types';
1
2
  declare const _default: <T extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
2
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
3
4
  entity?: T;
4
5
  entityType: string;
5
6
  entityBundle: string;
6
7
  entityUuid: string;
7
- canEdit: boolean;
8
8
  tag?: string;
9
9
  language?: string;
10
10
  editLabel?: string;
11
11
  editPath?: string;
12
12
  hostOptions?: any;
13
+ permissions?: EditPermission[];
13
14
  /**
14
15
  * When set to true, during editing, everything except the provider element will be hidden.
15
16
  */
@@ -3,7 +3,7 @@
3
3
  <div class="bk bk-blokkli-item-actions bk-control" @click.stop>
4
4
  <div
5
5
  v-show="
6
- !selection.isDragging.value && !selection.editableActive.value && !ui.isAnimating.value && !ui.hasTransformOverlayOpen.value && hasAnythingSelected && shouldRender && !ui.hasAddTooltipOpen.value
6
+ !selection.isDragging.value && !selection.editableActive.value && !ui.isAnimating.value && !ui.hasTransformOverlayOpen.value && hasAnythingSelected && shouldRender && !ui.hasTooltipOpen.value
7
7
  "
8
8
  ref="el"
9
9
  class="bk-blokkli-item-actions-inner"
@@ -39,6 +39,12 @@
39
39
  <Icon v-if="ui.isTransforming.value" name="loader" />
40
40
  <ItemIcon v-else-if="bundleIcon" :bundle="bundleIcon" />
41
41
  <Icon v-else name="selection" />
42
+ <div
43
+ v-if="itemBundle?.id === 'from_library'"
44
+ class="bk-blokkli-item-actions-title-icon-reusable"
45
+ >
46
+ <Icon name="reusable" />
47
+ </div>
42
48
  </div>
43
49
  <span class="bk-blokkli-item-actions-title-label">{{
44
50
  title
@@ -57,8 +63,6 @@
57
63
  />
58
64
  </div>
59
65
 
60
- <div id="bk-blokkli-item-actions-after" />
61
-
62
66
  <div
63
67
  v-show="selection.blocks.value.length"
64
68
  id="bk-blokkli-item-actions"
@@ -96,7 +100,8 @@ const { shouldRender } = useStickyToolbar(el, {
96
100
  shouldUpdate: () => !selection.isChangingOptions.value,
97
101
  getHeight: () => ACTIONS_HEIGHT,
98
102
  getWidth: () => scrollWidth,
99
- getMargin: () => 20
103
+ getMargin: () => 20,
104
+ allowHorizontalOverflow: true
100
105
  });
101
106
  const controlsEl = ref(null);
102
107
  const mountedPlugins = ref([]);