@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
@@ -113,7 +113,12 @@ const showLabel = computed(() => {
113
113
  const label = computed(
114
114
  () => $blokkliText(`blockOption_${props.property}_label`, props.option.label)
115
115
  );
116
- const description = computed(() => props.option.description);
116
+ const description = computed(
117
+ () => $blokkliText(
118
+ `blockOption_${props.property}_description`,
119
+ props.option.description
120
+ )
121
+ );
117
122
  const checkboxOptions = computed(() => {
118
123
  if (props.option.type !== "checkboxes") {
119
124
  return [];
@@ -56,6 +56,7 @@ import {
56
56
  BK_VISIBLE_LANGUAGES
57
57
  } from "#blokkli/helpers/symbols";
58
58
  import { BUNDLE_FROM_LIBRARY } from "#blokkli/constants";
59
+ import { itemEntityType } from "#blokkli-build/config";
59
60
  if (import.meta.hot) {
60
61
  import.meta.hot.accept("#blokkli/runtime-helpers", () => {
61
62
  });
@@ -94,11 +95,11 @@ const {
94
95
  eventBus,
95
96
  state,
96
97
  selection,
97
- runtimeConfig,
98
98
  dom,
99
99
  theme,
100
100
  context,
101
- definitions
101
+ definitions,
102
+ blocks
102
103
  } = useBlokkli();
103
104
  const props = defineProps({
104
105
  uuids: { type: [Array, String], required: true },
@@ -136,7 +137,7 @@ function stopChangingOptions() {
136
137
  if (Array.isArray(props.uuids)) {
137
138
  props.uuids.forEach((uuid) => {
138
139
  dom.refreshBlockRect(uuid);
139
- const block = dom.findBlock(uuid);
140
+ const block = blocks.getBlock(uuid);
140
141
  if (block) {
141
142
  const el = dom.getDragElement(block);
142
143
  if (el) {
@@ -146,6 +147,7 @@ function stopChangingOptions() {
146
147
  });
147
148
  }
148
149
  selection.isChangingOptions.value = false;
150
+ eventBus.emit("option:finish-change");
149
151
  }
150
152
  class OptionCollector {
151
153
  options;
@@ -247,11 +249,11 @@ const visibleOptions = computed(() => {
247
249
  }
248
250
  const uuid = props.uuids[0];
249
251
  const item = state.getFieldListItem(uuid);
250
- const block = selection.blocks.value.find((v) => v.uuid === uuid);
252
+ const block = selection.items.value.find((v) => v.uuid === uuid);
251
253
  if (!item) {
252
254
  return [];
253
255
  }
254
- const parentType = block?.hostType === runtimeConfig.itemEntityType ? block.parentBlockBundle : void 0;
256
+ const parentType = block?.host.type === itemEntityType ? block.parentBlockBundle : void 0;
255
257
  const ctxProps = item?.bundle === BUNDLE_FROM_LIBRARY ? item?.props?.libraryItem?.block?.props : item?.props;
256
258
  const visibleKeys = (
257
259
  // We have to cast to any here because the types are guaranteed to be correct.
@@ -260,7 +262,7 @@ const visibleOptions = computed(() => {
260
262
  parentType,
261
263
  props: ctxProps,
262
264
  entity: context.value,
263
- fieldListType: block?.hostFieldListType || "default"
265
+ fieldListType: block?.fieldListType ?? "default"
264
266
  })
265
267
  );
266
268
  return availableOptions.value.filter(
@@ -24,7 +24,7 @@ defineBlokkliFeature({
24
24
  });
25
25
  const { selection, state, ui, definitions, context } = useBlokkli();
26
26
  const uuids = computed(() => {
27
- const uuids2 = selection.blocks.value.map((v) => v.uuid);
27
+ const uuids2 = selection.items.value.map((v) => v.uuid);
28
28
  if (uuids2.length) {
29
29
  return uuids2;
30
30
  } else if (selection.hasHostSelected.value) {
@@ -47,14 +47,14 @@ const definition = computed(() => {
47
47
  context.value.entityBundle
48
48
  );
49
49
  }
50
- const bundles = selection.blocks.value.map((v) => v.reusableBundle || v.itemBundle).filter(onlyUnique);
50
+ const bundles = selection.items.value.map((v) => v.library?.reusableBundle || v.bundle).filter(onlyUnique);
51
51
  if (bundles.length !== 1) {
52
52
  return;
53
53
  }
54
54
  const bundle = bundles[0];
55
55
  if (bundle === "blokkli_fragment") {
56
- const fragments = selection.blocks.value.filter(
57
- (v) => v.itemBundle === "blokkli_fragment"
56
+ const fragments = selection.items.value.filter(
57
+ (v) => v.bundle === "blokkli_fragment"
58
58
  );
59
59
  const fragmentNames = fragments.map((v) => {
60
60
  const props = state.getFieldListItem(v.uuid)?.props;
@@ -67,10 +67,10 @@ const definition = computed(() => {
67
67
  }
68
68
  return definitions.getFragmentDefinition(fragmentNames[0]);
69
69
  }
70
- return selection.blocks.value.map((block) => {
70
+ return selection.items.value.map((block) => {
71
71
  return definitions.getBlockDefinition(
72
72
  bundle,
73
- block.hostFieldListType,
73
+ block.fieldListType,
74
74
  block.parentBlockBundle
75
75
  );
76
76
  }).filter(falsy).at(0);
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <Banner
3
+ id="ownership"
4
+ icon="user"
5
+ :text
6
+ :button="$t('ownershipTakeOwnership', 'Assign to me')"
7
+ @click="$emit('submit')"
8
+ />
9
+ </template>
10
+
11
+ <script setup>
12
+ import { computed, useBlokkli, onMounted, onBeforeUnmount } from "#imports";
13
+ import { Banner } from "#blokkli/components";
14
+ defineEmits(["submit"]);
15
+ const { state, $t, ui } = useBlokkli();
16
+ const name = computed(() => {
17
+ const v = state.owner.value?.name;
18
+ if (v) {
19
+ return `<strong>${v}</strong>`;
20
+ }
21
+ return "";
22
+ });
23
+ const text = computed(() => {
24
+ return $t(
25
+ "ownershipNote",
26
+ "This page is currently being edited by @name. Changes can only be made by one person at a time."
27
+ ).replace("@name", name.value);
28
+ });
29
+ onMounted(() => {
30
+ ui.setSelectionColor("ownership", "mono");
31
+ });
32
+ onBeforeUnmount(() => {
33
+ ui.removeSelectionColor("ownership");
34
+ });
35
+ </script>
@@ -0,0 +1,6 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
2
+ submit: () => any;
3
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
4
+ onSubmit?: (() => any) | undefined;
5
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ export default _default;
@@ -1,26 +1,12 @@
1
1
  <template>
2
- <Teleport to="body">
3
- <div
4
- v-if="!state.owner.value?.currentUserIsOwner"
5
- class="bk-owner-indicator"
6
- >
7
- <p
8
- v-html="
9
- $t(
10
- 'ownershipNote',
11
- 'This page is currently being edited by @name. Changes can only be made by one person at a time.'
12
- ).replace('@name', name)
13
- "
14
- />
15
- <button class="bk-button bk-is-danger" @click="takeOwnership">
16
- {{ $t("ownershipTakeOwnership", "Assign to me") }}
17
- </button>
18
- </div>
2
+ <Teleport to="#bk-banner-list">
3
+ <Renderer v-if="shouldRender" @submit="takeOwnership" />
19
4
  </Teleport>
20
5
  </template>
21
6
 
22
7
  <script setup>
23
- import { computed, useBlokkli, defineBlokkliFeature } from "#imports";
8
+ import { useBlokkli, defineBlokkliFeature, computed } from "#imports";
9
+ import Renderer from "./Renderer.vue";
24
10
  const { adapter } = defineBlokkliFeature({
25
11
  id: "ownership",
26
12
  icon: "user",
@@ -29,18 +15,14 @@ const { adapter } = defineBlokkliFeature({
29
15
  description: "Renders a large button to take ownership of the current edit state."
30
16
  });
31
17
  const { state, $t } = useBlokkli();
18
+ const shouldRender = computed(
19
+ () => !state.owner.value?.currentUserIsOwner && state.permissions.value.includes("edit")
20
+ );
32
21
  const takeOwnership = () => state.mutateWithLoadingState(
33
22
  () => adapter.takeOwnership(),
34
23
  $t("ownershipError", "Error in assigning"),
35
24
  $t("ownershipSuccess", "You are now the owner.")
36
25
  );
37
- const name = computed(() => {
38
- const v = state.owner.value?.name;
39
- if (v) {
40
- return `<strong>${v}</strong>`;
41
- }
42
- return "";
43
- });
44
26
  </script>
45
27
 
46
28
  <script>
@@ -13,6 +13,7 @@
13
13
  "
14
14
  key-code="P"
15
15
  icon="tree"
16
+ @update:model-value="onToggleProxyMode"
16
17
  />
17
18
  </template>
18
19
 
@@ -26,7 +27,10 @@ defineBlokkliFeature({
26
27
  description: "Displays the blocks as a structure in the preview.",
27
28
  viewports: ["desktop"]
28
29
  });
29
- const { $t, ui } = useBlokkli();
30
+ const { $t, ui, eventBus } = useBlokkli();
31
+ function onToggleProxyMode() {
32
+ eventBus.emit("state:reloaded");
33
+ }
30
34
  </script>
31
35
 
32
36
  <script>
@@ -37,23 +37,24 @@
37
37
  </label>
38
38
  <div class="bk-publish-schedule-date-wrapper">
39
39
  <div v-if="isAlreadyScheduled" class="bk-publish-scheduled-display">
40
- {{
41
- ui.formatDate(scheduleDate, {
42
- weekday: "long",
43
- year: "numeric",
44
- month: "2-digit",
45
- day: "2-digit",
46
- hour: "2-digit",
47
- minute: "2-digit"
48
- })
49
- }}
40
+ {{ formatScheduleDate(scheduleDate) }}
50
41
  </div>
51
42
  <ScheduleDate
52
43
  v-else
53
44
  v-model="scheduleDate"
54
45
  :disabled="isLoading"
55
46
  :error="scheduleDateError"
56
- />
47
+ >
48
+ <div
49
+ class="bk-schedule-date-info"
50
+ v-text="
51
+ $t(
52
+ 'publishScheduledInfo',
53
+ 'You can still make changes until the scheduled publication date.'
54
+ )
55
+ "
56
+ />
57
+ </ScheduleDate>
57
58
  <button
58
59
  v-if="isAlreadyScheduled"
59
60
  type="button"
@@ -90,6 +91,16 @@
90
91
  />
91
92
  </FormItem>
92
93
 
94
+ <FormItem v-if="publishMode !== 'save' && scheduledBlocks.length">
95
+ <InfoBox>
96
+ <p
97
+ v-for="(text, index) in scheduledBlocks"
98
+ :key="'infobox' + index"
99
+ v-html="text"
100
+ />
101
+ </InfoBox>
102
+ </FormItem>
103
+
93
104
  <FormItem v-if="successItems.length && showTable">
94
105
  <h2 class="bk-heading-2">
95
106
  {{ $t("publishSuccessfullyPublished", "Successfully published") }}
@@ -171,14 +182,29 @@ import {
171
182
  onMounted,
172
183
  onUnmounted
173
184
  } from "#imports";
174
- import { DialogModal, FormTextarea, FormItem } from "#blokkli/components";
185
+ import {
186
+ DialogModal,
187
+ FormTextarea,
188
+ FormItem,
189
+ ScheduleDate,
190
+ InfoBox
191
+ } from "#blokkli/components";
175
192
  import { emitMessage } from "#blokkli/helpers/eventBus";
176
193
  import Item from "./Item.vue";
177
194
  import PublishOption, {} from "./PublishOption.vue";
178
195
  import Summary from "./Summary.vue";
179
- import ScheduleDate from "./ScheduleDate.vue";
180
196
  const showTable = false;
181
197
  const { adapter, $t, state, context, ui } = useBlokkli();
198
+ const formatScheduleDate = (date) => {
199
+ return ui.formatDate(date, {
200
+ weekday: "long",
201
+ year: "numeric",
202
+ month: "long",
203
+ day: "numeric",
204
+ hour: "2-digit",
205
+ minute: "2-digit"
206
+ });
207
+ };
182
208
  const isMutating = ref(false);
183
209
  const mutationStatusItems = ref({});
184
210
  const publishedIds = ref([]);
@@ -205,6 +231,33 @@ const {
205
231
  } = await useAsyncData(() => {
206
232
  return adapter.getPublishOptions();
207
233
  });
234
+ const scheduledBlocks = computed(() => {
235
+ const referenceTimestamp = publishMode.value === "scheduled" && scheduleDate.value ? new Date(scheduleDate.value).getTime() : currentTimestamp.value;
236
+ const grouped = state.getAllUuids().reduce((acc, uuid) => {
237
+ const item = state.getFieldListItem(uuid);
238
+ if (!item?.editContext?.publishOn) {
239
+ return acc;
240
+ }
241
+ const publishDate = new Date(item.editContext.publishOn).getTime();
242
+ if (publishDate <= referenceTimestamp) {
243
+ return acc;
244
+ }
245
+ const dateKey = item.editContext.publishOn;
246
+ acc[dateKey] = (acc[dateKey] || 0) + 1;
247
+ return acc;
248
+ }, {});
249
+ return Object.entries(grouped).map(([date, count]) => {
250
+ const formattedDate = formatScheduleDate(date);
251
+ const message = count === 1 ? $t(
252
+ "publishScheduledBlockSingular",
253
+ "1 block is scheduled to be published on @date"
254
+ ) : $t(
255
+ "publishScheduledBlockPlural",
256
+ "@count blocks are scheduled to be published on @date"
257
+ );
258
+ return message.replace("@count", count.toString()).replace("@date", `<strong>${formattedDate}</strong>`);
259
+ });
260
+ });
208
261
  const canSchedule = computed(() => !!publishOptions.value?.canSchedule);
209
262
  const publishOn = computed(
210
263
  () => publishOptions.value?.publishOn ?? null
@@ -403,7 +456,7 @@ const resultStateLabel = computed(() => {
403
456
  );
404
457
  }
405
458
  if (publishMode.value === "scheduled" && scheduleDate.value) {
406
- const formattedDate = ui.formatDate(scheduleDate.value);
459
+ const formattedDate = formatScheduleDate(scheduleDate.value);
407
460
  if (isCurrentlyPublished.value) {
408
461
  return $t(
409
462
  "publishResultScheduledChanges",
@@ -500,7 +553,7 @@ async function onSubmit() {
500
553
  return;
501
554
  }
502
555
  if (publishMode.value === "scheduled") {
503
- const formattedDate = ui.formatDate(scheduleDate.value);
556
+ const formattedDate = formatScheduleDate(scheduleDate.value);
504
557
  const message = $t(
505
558
  "publishScheduleSuccess",
506
559
  "Publication scheduled for @date"
@@ -10,7 +10,7 @@
10
10
  @mouseenter="index = i"
11
11
  >
12
12
  <div class="bk-search-item-icon">
13
- <ItemIcon :bundle="item.item.itemBundle" />
13
+ <ItemIcon :bundle="item.item.bundle" />
14
14
  </div>
15
15
  <div class="bk-search-item-content">
16
16
  <Highlight
@@ -49,7 +49,7 @@ const props = defineProps({
49
49
  search: { type: String, required: true },
50
50
  tab: { type: String, required: true }
51
51
  });
52
- const { eventBus, state, types, dom } = useBlokkli();
52
+ const { eventBus, state, types, dom, blocks, element } = useBlokkli();
53
53
  const buildForKey = ref("");
54
54
  const items = ref([]);
55
55
  const index = ref(0);
@@ -92,28 +92,28 @@ const scrollItemIntoView = () => {
92
92
  }
93
93
  };
94
94
  const buildSearchText = (el) => {
95
- let text = el.textContent || "";
96
- el.querySelectorAll("img").forEach((img) => {
97
- if (img.alt) {
98
- text += " " + img.alt;
99
- }
100
- if (img.title) {
101
- text += " " + img.title;
95
+ if (!el) {
96
+ return "";
97
+ }
98
+ const altTexts = element.queryAll(el, "img", "buildSearchText", (el2) => {
99
+ if (el2 instanceof HTMLImageElement) {
100
+ return [el2.alt, el2.title].filter(Boolean).join("");
102
101
  }
103
- });
104
- return text;
102
+ }).join(" ");
103
+ return (el.textContent ?? "") + altTexts;
105
104
  };
106
105
  const buildIndex = () => {
107
106
  if (buildForKey.value === state.refreshKey.value) {
108
107
  return;
109
108
  }
110
- const newItems = dom.getAllBlocks().map((item) => {
111
- const title = types.getBlockBundleDefinition(item.itemBundle)?.label || item.itemBundle;
109
+ const newItems = blocks.getAllBlocks().map((item) => {
110
+ const title = types.getBlockBundleDefinition(item.bundle)?.label || item.bundle;
111
+ const element2 = dom.getDragElement(item);
112
112
  return {
113
113
  item,
114
- title: item.editTitle || title,
114
+ title,
115
115
  context: title,
116
- text: buildSearchText(item.element())
116
+ text: buildSearchText(element2)
117
117
  };
118
118
  }).filter(falsy);
119
119
  items.value = newItems;
@@ -46,7 +46,7 @@ defineBlokkliFeature({
46
46
  label: "Search",
47
47
  description: "Provides an overlay with shortcut to search for blocks on the current page or existing content to add as blocks."
48
48
  });
49
- const { $t, selection } = useBlokkli();
49
+ const { $t, selection, ui } = useBlokkli();
50
50
  const isRendered = ref(false);
51
51
  const isVisible = ref(false);
52
52
  const overlay = ref(null);
@@ -60,6 +60,9 @@ function onClick() {
60
60
  });
61
61
  }
62
62
  onBlokkliEvent("keyPressed", (e) => {
63
+ if (ui.hasDialogOpen.value) {
64
+ return;
65
+ }
63
66
  if (e.code === "Escape") {
64
67
  isVisible.value = false;
65
68
  }
@@ -1,86 +1,57 @@
1
1
  <template>
2
- <div
3
- ref="el"
4
- class="bk bk-selection-add-overlay"
5
- :class="'bk-is-' + placementY"
6
- :style="{
7
- '--bk-caret-x': caretX
8
- }"
2
+ <ArtboardTooltip
3
+ id="add-buttons"
4
+ :title="label"
5
+ :anchor-el
6
+ :anchor-coordinates
7
+ class="bk-selection-add-overlay"
8
+ @close="$emit('close')"
9
9
  >
10
- <div class="bk bk-selection-add-overlay-inner bk-caret-tooltip-inner">
11
- <div v-if="label" class="bk-selection-add-overlay-label">
12
- <div v-html="label" />
13
- <button @click="$emit('close')">
14
- <Icon name="close" />
15
- </button>
16
- </div>
17
- <div
18
- ref="listEl"
19
- class="bk-selection-add-overlay-list bk-scrollbar-dark"
20
- @wheel="onWheel"
10
+ <div
11
+ ref="listEl"
12
+ class="bk-selection-add-overlay-list bk-scrollbar-dark"
13
+ @wheel="onWheel"
14
+ >
15
+ <button
16
+ v-for="item in items"
17
+ :key="item.bundle"
18
+ tabindex="-1"
19
+ @click.prevent="$emit('select', item.bundle)"
21
20
  >
22
- <button
23
- v-for="item in items"
24
- :key="item.bundle"
25
- tabindex="-1"
26
- @click.prevent="$emit('select', item.bundle)"
27
- >
28
- <AddListItemIcon
29
- :bundle="item.bundle"
30
- :color="item.isFavorite ? 'yellow' : 'default'"
31
- />
32
- <span>{{ item.label }}</span>
33
- </button>
34
- <button
35
- v-for="action in actions"
36
- :key="'action:' + action.id"
37
- tabindex="-1"
38
- @click.prevent="$emit('action', action.id)"
39
- >
40
- <AddListItemIcon :icon="action.icon" :color="action.color" />
41
- <span>{{ action.title }}</span>
42
- </button>
43
- </div>
21
+ <AddListItemIcon
22
+ :bundle="item.bundle"
23
+ :color="item.isFavorite ? 'yellow' : 'default'"
24
+ />
25
+ <span>{{ item.label }}</span>
26
+ </button>
27
+ <button
28
+ v-for="action in actions"
29
+ :key="'action:' + action.id"
30
+ tabindex="-1"
31
+ @click.prevent="$emit('action', action.id)"
32
+ >
33
+ <AddListItemIcon :icon="action.icon" :color="action.color" />
34
+ <span>{{ action.title }}</span>
35
+ </button>
44
36
  </div>
45
- </div>
37
+ </ArtboardTooltip>
46
38
  </template>
47
39
 
48
40
  <script setup>
49
- import useStickyToolbar from "#blokkli/helpers/composables/useStickyToolbar";
50
- import {
51
- useTemplateRef,
52
- useBlokkli,
53
- computed,
54
- onMounted,
55
- onBeforeUnmount
56
- } from "#imports";
57
- import { Icon, AddListItemIcon } from "#blokkli/components";
41
+ import { useTemplateRef, useBlokkli, computed } from "#imports";
42
+ import { AddListItemIcon, ArtboardTooltip } from "#blokkli/components";
58
43
  import { isInternalBundle } from "#blokkli/helpers/bundles";
59
44
  const props = defineProps({
60
45
  bundles: { type: Array, required: true },
61
- anchorEl: { type: null, required: true },
62
- label: { type: String, required: false }
46
+ anchorEl: { type: null, required: false },
47
+ anchorCoordinates: { type: Object, required: false },
48
+ label: { type: String, required: true }
63
49
  });
64
50
  defineEmits(["select", "action", "close"]);
65
- const el = useTemplateRef("el");
66
51
  const listEl = useTemplateRef("listEl");
67
52
  let hasScrollbar = null;
68
- const { types, ui, plugins, storage } = useBlokkli();
53
+ const { types, plugins, storage } = useBlokkli();
69
54
  const favorites = storage.use("blockFavorites", []);
70
- const { placementY, caretX } = useStickyToolbar(el, {
71
- getAnchorElement() {
72
- return props.anchorEl;
73
- },
74
- getPlacementY() {
75
- return "auto";
76
- },
77
- getPlacementX() {
78
- return "center";
79
- },
80
- getCaretWidth() {
81
- return 30;
82
- }
83
- });
84
55
  const items = computed(() => {
85
56
  return props.bundles.filter((bundle) => !isInternalBundle(bundle)).map((bundle) => {
86
57
  return {
@@ -111,10 +82,4 @@ const onWheel = (e) => {
111
82
  e.stopPropagation();
112
83
  }
113
84
  };
114
- onMounted(() => {
115
- ui.hasAddTooltipOpen.value = true;
116
- });
117
- onBeforeUnmount(() => {
118
- ui.hasAddTooltipOpen.value = false;
119
- });
120
85
  </script>
@@ -1,15 +1,17 @@
1
+ import type { Coord } from '#blokkli/types';
1
2
  type __VLS_Props = {
2
3
  bundles: string[];
3
- anchorEl: HTMLElement;
4
- label?: string;
4
+ anchorEl?: HTMLElement;
5
+ anchorCoordinates?: Coord;
6
+ label: string;
5
7
  };
6
8
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
- select: (id: string) => void;
8
9
  action: (id: string) => void;
10
+ select: (id: string) => void;
9
11
  close: () => void;
10
12
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
- onClose?: (() => any) | undefined;
12
- onSelect?: ((id: string) => any) | undefined;
13
13
  onAction?: ((id: string) => any) | undefined;
14
+ onSelect?: ((id: string) => any) | undefined;
15
+ onClose?: (() => any) | undefined;
14
16
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
17
  export default _default;