@blokkli/editor 1.1.3 → 1.3.0

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 (67) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1693 -41
  3. package/dist/runtime/adapter/drupal/graphql/base.graphql +40 -3
  4. package/dist/runtime/adapter/drupal/graphql/comments.graphql +6 -1
  5. package/dist/runtime/adapter/drupal/graphql/transform.graphql +10 -2
  6. package/dist/runtime/adapter/drupal/graphqlMiddleware.js +44 -18
  7. package/dist/runtime/adapter/index.d.ts +15 -2
  8. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +4 -1
  9. package/dist/runtime/components/BlokkliField.vue +8 -2
  10. package/dist/runtime/components/Edit/Actions/index.vue +27 -6
  11. package/dist/runtime/components/Edit/AnimationCanvas/index.vue +1 -0
  12. package/dist/runtime/components/Edit/DragInteractions/index.vue +7 -0
  13. package/dist/runtime/components/Edit/EditProvider.vue +23 -5
  14. package/dist/runtime/components/Edit/Features/Artboard/index.vue +4 -0
  15. package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +1 -0
  16. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +3 -1
  17. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +14 -2
  18. package/dist/runtime/components/Edit/Features/Debug/index.vue +26 -4
  19. package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +236 -0
  20. package/dist/runtime/components/Edit/Features/Diff/index.vue +37 -0
  21. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +14 -4
  22. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +3 -0
  23. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +20 -6
  24. package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +8 -1
  25. package/dist/runtime/components/Edit/Features/EditableField/index.vue +11 -5
  26. package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +1 -0
  27. package/dist/runtime/components/Edit/Features/History/index.vue +3 -1
  28. package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +5 -2
  29. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +10 -3
  30. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +46 -0
  31. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +66 -34
  32. package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +4 -1
  33. package/dist/runtime/components/Edit/Features/Options/Form/index.vue +14 -1
  34. package/dist/runtime/components/Edit/Features/Preview/index.vue +2 -1
  35. package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +2 -1
  36. package/dist/runtime/components/Edit/Features/Publish/index.vue +2 -0
  37. package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +2 -1
  38. package/dist/runtime/components/Edit/Features/Selection/Overlay/fragment.glsl +78 -44
  39. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +8 -8
  40. package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +6 -1
  41. package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +23 -2
  42. package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +71 -38
  43. package/dist/runtime/components/Edit/Features/Settings/index.vue +4 -0
  44. package/dist/runtime/components/Edit/Features/Transform/index.vue +5 -1
  45. package/dist/runtime/components/Edit/Features/Translations/index.vue +24 -2
  46. package/dist/runtime/components/Edit/Features/index.vue +4 -0
  47. package/dist/runtime/components/Edit/InfoBox/index.vue +14 -0
  48. package/dist/runtime/components/Edit/Messages/index.vue +10 -12
  49. package/dist/runtime/components/Edit/PreviewProvider.vue +9 -2
  50. package/dist/runtime/components/Edit/Sortli/index.vue +6 -1
  51. package/dist/runtime/components/Edit/index.d.ts +2 -1
  52. package/dist/runtime/components/Edit/index.js +3 -1
  53. package/dist/runtime/constants/index.d.ts +1 -1
  54. package/dist/runtime/constants/index.js +1 -0
  55. package/dist/runtime/css/output.css +1 -1
  56. package/dist/runtime/helpers/animationProvider.js +2 -1
  57. package/dist/runtime/helpers/featuresProvider.d.ts +7 -14
  58. package/dist/runtime/helpers/featuresProvider.js +29 -1
  59. package/dist/runtime/helpers/stateProvider.d.ts +1 -0
  60. package/dist/runtime/helpers/stateProvider.js +23 -4
  61. package/dist/runtime/helpers/uiProvider.d.ts +5 -1
  62. package/dist/runtime/helpers/uiProvider.js +10 -2
  63. package/dist/runtime/icons/diff.svg +1 -0
  64. package/dist/runtime/icons/info.svg +1 -0
  65. package/dist/runtime/types/generatedModuleTypes.d.ts +4 -4
  66. package/dist/runtime/types/index.d.ts +59 -1
  67. package/package.json +2 -1
@@ -43,12 +43,16 @@ const { settings } = defineBlokkliFeature({
43
43
  type: 'checkbox',
44
44
  default: true,
45
45
  label: 'Use animations',
46
+ description:
47
+ 'Animates UI elements like dialogs or drawers or interactions like drag and drop or scroll changes.',
46
48
  group: 'advanced',
47
49
  },
48
50
  lowPerformanceMode: {
49
51
  type: 'checkbox',
50
52
  default: false,
51
53
  label: 'Enable low performance mode',
54
+ description:
55
+ 'Reduces the animations and interactivity to a minimum for devices with low performance.',
52
56
  group: 'advanced',
53
57
  },
54
58
  resetAllSettings: {
@@ -44,7 +44,7 @@ const { adapter } = defineBlokkliFeature({
44
44
  screenshot: 'feature-transform.jpg',
45
45
  })
46
46
 
47
- const { types, selection, state, $t, dom } = useBlokkli()
47
+ const { types, selection, state, $t, dom, ui } = useBlokkli()
48
48
 
49
49
  const {
50
50
  data: plugins,
@@ -64,6 +64,8 @@ watch(selection.uuids, async () => {
64
64
  })
65
65
 
66
66
  async function onTransform(plugin: TransformPlugin, uuids: string[]) {
67
+ ui.setTransform(plugin.label)
68
+
67
69
  await state.mutateWithLoadingState(
68
70
  () =>
69
71
  adapter.applyTransformPlugin({
@@ -75,6 +77,8 @@ async function onTransform(plugin: TransformPlugin, uuids: string[]) {
75
77
  'The action "@name" could not be executed.',
76
78
  ).replace('@name', plugin.label),
77
79
  )
80
+
81
+ ui.setTransform()
78
82
  }
79
83
 
80
84
  const itemBundleIds = computed(() =>
@@ -50,7 +50,7 @@
50
50
  </PluginTourItem>
51
51
  </Teleport>
52
52
 
53
- <Teleport to="body">
53
+ <Teleport to="#bk-banner-container">
54
54
  <Banner
55
55
  v-if="state.editMode.value === 'translating'"
56
56
  :active-language="activeLanguage"
@@ -116,7 +116,20 @@ const { translation, editMode } = state
116
116
 
117
117
  const isOpen = ref(false)
118
118
 
119
- const isDropdown = computed(() => ui.isMobile.value || items.value.length > 5)
119
+ const isDropdown = computed(() => {
120
+ // Always a dropdown on mobile.
121
+ if (ui.isMobile.value) {
122
+ return true
123
+ }
124
+
125
+ // It is a dropdown if all langcodes combined is greater than 15.
126
+ // That way up to 7 languages with 2-char langcodes are displayed as radio buttons.
127
+ // This handles cases where langcodes are e.g. 'en-US', 'en-GB', 'de-CH', etc.
128
+ // In this case it switches to a dropdown. This is better than relying on the number
129
+ // languages.
130
+ const allCodes = items.value.map((v) => v.code).join('')
131
+ return allCodes.length > 15
132
+ })
120
133
  const activeLangcode = computed(() => context.value.language)
121
134
  const activeLanguage = computed<Language>(() => {
122
135
  return (
@@ -212,6 +225,15 @@ onBlokkliEvent('item:doubleClick', function (block) {
212
225
  }
213
226
  })
214
227
 
228
+ onBlokkliEvent('entity:translated', (langcode) => {
229
+ const targetTranslation = translation.value.translations?.find(
230
+ (v) => v.id === langcode,
231
+ )
232
+ if (targetTranslation) {
233
+ adapter.changeLanguage(targetTranslation)
234
+ }
235
+ })
236
+
215
237
  onMounted(() => {
216
238
  // Make sure the user is not trying to edit a translation that does not exist.
217
239
  const translationExists = !!translation.value.translations?.find(
@@ -48,6 +48,10 @@ const availableFeatures = computed(() => {
48
48
  return false
49
49
  }
50
50
 
51
+ if (v.beta && !features.enabledBetaFeatures.value.includes(v.id)) {
52
+ return false
53
+ }
54
+
51
55
  return !v.viewports.length || v.viewports.includes(ui.appViewport.value)
52
56
  })
53
57
  })
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <div class="bk-info-box">
3
+ <Icon name="info" />
4
+ <p v-html="text" />
5
+ </div>
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import { Icon } from '#blokkli/components'
10
+
11
+ defineProps<{
12
+ text: string
13
+ }>()
14
+ </script>
@@ -1,16 +1,14 @@
1
1
  <template>
2
- <Teleport to="body">
3
- <div class="bk bk-messages">
4
- <TransitionGroup name="bk-message">
5
- <Item
6
- v-for="(message, index) in messages"
7
- v-bind="message"
8
- :key="index"
9
- @close="removeMessage(index)"
10
- />
11
- </TransitionGroup>
12
- </div>
13
- </Teleport>
2
+ <div class="bk bk-messages">
3
+ <TransitionGroup name="bk-message">
4
+ <Item
5
+ v-for="(message, index) in messages"
6
+ v-bind="message"
7
+ :key="index"
8
+ @close="removeMessage(index)"
9
+ />
10
+ </TransitionGroup>
11
+ </div>
14
12
  </template>
15
13
 
16
14
  <script lang="ts" setup>
@@ -62,7 +62,7 @@ const mutatedEntity = computed(
62
62
  () => mutatedEntityFromState.value || props.entity,
63
63
  )
64
64
 
65
- const { data, refresh } = await useAsyncData(() =>
65
+ const { data, refresh, error } = await useAsyncData(() =>
66
66
  adapter.loadState().then((v) => adapter.mapState(v)),
67
67
  )
68
68
 
@@ -94,8 +94,10 @@ const updateState = () => {
94
94
 
95
95
  updateState()
96
96
 
97
+ const isPreview = computed(() => !error.value)
98
+
97
99
  provide(INJECT_MUTATED_FIELDS_MAP, mutatedFieldsMap)
98
- provide(INJECT_IS_PREVIEW, true)
100
+ provide(INJECT_IS_PREVIEW, isPreview)
99
101
  provide<ItemEditContext>(INJECT_EDIT_CONTEXT, {
100
102
  mutatedOptions,
101
103
  eventBus,
@@ -127,6 +129,11 @@ const onMouseDown = () => {
127
129
  * update.
128
130
  */
129
131
  function checkChangedDate() {
132
+ // State loading has failed, so we can return here; no need to poll.
133
+ if (!isPreview.value) {
134
+ return
135
+ }
136
+
130
137
  clearTimeout(timeout)
131
138
 
132
139
  const delay = adapter.getLastChanged ? 1000 : 5000
@@ -19,6 +19,10 @@ import {
19
19
 
20
20
  const { eventBus } = useBlokkli()
21
21
 
22
+ const props = defineProps<{
23
+ getDragItems?: (activeItem?: DraggableItem) => DraggableItem[] | null
24
+ }>()
25
+
22
26
  let pointerStartCoords: Coord | null = null
23
27
  let activeItem: DraggableItem | null = null
24
28
 
@@ -55,8 +59,9 @@ function onPointerMove(e: PointerEvent) {
55
59
  const distance = getDistance(coords, pointerStartCoords)
56
60
 
57
61
  if (distance > 7) {
62
+ const dragItems = props.getDragItems ? props.getDragItems(activeItem) : null
58
63
  eventBus.emit('dragging:start', {
59
- items: [activeItem],
64
+ items: dragItems && dragItems.length ? dragItems : [activeItem],
60
65
  coords,
61
66
  mode: 'mouse',
62
67
  })
@@ -12,4 +12,5 @@ import Loading from './Loading/index.vue.js';
12
12
  import Highlight from './Highlight/index.vue.js';
13
13
  import ViewportBlockingRect from './ViewportBlockingRect/index.vue.js';
14
14
  import ScrollBoundary from './ScrollBoundary/index.vue.js';
15
- export { ItemIcon, ShortcutIndicator, RelativeTime, Icon, Resizable, DialogModal, ScaleToFit, Sortli, FormOverlay, AddListItem, Loading, Highlight, ViewportBlockingRect, ScrollBoundary, };
15
+ import InfoBox from './InfoBox/index.vue.js';
16
+ export { ItemIcon, ShortcutIndicator, RelativeTime, Icon, Resizable, DialogModal, ScaleToFit, Sortli, FormOverlay, AddListItem, Loading, Highlight, ViewportBlockingRect, ScrollBoundary, InfoBox, };
@@ -12,6 +12,7 @@ import Loading from "./Loading/index.vue";
12
12
  import Highlight from "./Highlight/index.vue";
13
13
  import ViewportBlockingRect from "./ViewportBlockingRect/index.vue";
14
14
  import ScrollBoundary from "./ScrollBoundary/index.vue";
15
+ import InfoBox from "./InfoBox/index.vue";
15
16
  export {
16
17
  ItemIcon,
17
18
  ShortcutIndicator,
@@ -26,5 +27,6 @@ export {
26
27
  Loading,
27
28
  Highlight,
28
29
  ViewportBlockingRect,
29
- ScrollBoundary
30
+ ScrollBoundary,
31
+ InfoBox
30
32
  };
@@ -1,4 +1,4 @@
1
- export declare const SETTINGS_GROUP: readonly ["appearance", "artboard", "behavior", "advanced"];
1
+ export declare const SETTINGS_GROUP: readonly ["appearance", "artboard", "behavior", "beta", "advanced"];
2
2
  export declare const VIEWPORT: readonly ["mobile", "desktop"];
3
3
  export type SettingsGroup = (typeof SETTINGS_GROUP)[number];
4
4
  export type Viewport = (typeof VIEWPORT)[number];
@@ -2,6 +2,7 @@ export const SETTINGS_GROUP = [
2
2
  "appearance",
3
3
  "artboard",
4
4
  "behavior",
5
+ "beta",
5
6
  "advanced"
6
7
  ];
7
8
  export const VIEWPORT = ["mobile", "desktop"];