@blokkli/editor 1.0.0 → 1.0.2

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 (27) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +35 -3
  3. package/dist/runtime/adapter/drupal/graphqlMiddleware.js +9 -1
  4. package/dist/runtime/adapter/index.d.ts +4 -0
  5. package/dist/runtime/components/Blocks/FromLibrary/index.vue +2 -3
  6. package/dist/runtime/components/Edit/Dialog/index.vue +14 -1
  7. package/dist/runtime/components/Edit/DragInteractions/index.vue +1 -4
  8. package/dist/runtime/components/Edit/EditProvider.vue +1 -0
  9. package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +33 -27
  10. package/dist/runtime/components/Edit/Features/Edit/index.vue +60 -14
  11. package/dist/runtime/components/Edit/Features/Exit/index.vue +2 -1
  12. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +206 -0
  13. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +7 -8
  14. package/dist/runtime/components/Edit/Features/Library/index.vue +25 -2
  15. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +11 -10
  16. package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +1 -1
  17. package/dist/runtime/components/Edit/Features/Publish/index.vue +4 -1
  18. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +1 -1
  19. package/dist/runtime/components/Edit/Features/Translations/index.vue +26 -1
  20. package/dist/runtime/css/output.css +1 -1
  21. package/dist/runtime/helpers/broadcastProvider.d.ts +10 -2
  22. package/dist/runtime/helpers/composables/onBroadcastEvent.d.ts +2 -0
  23. package/dist/runtime/helpers/composables/onBroadcastEvent.js +10 -0
  24. package/dist/runtime/helpers/featuresProvider.d.ts +2 -2
  25. package/dist/runtime/helpers/index.js +2 -2
  26. package/dist/runtime/types/index.d.ts +12 -2
  27. package/package.json +1 -1
@@ -1,7 +1,15 @@
1
1
  import { type Emitter } from 'mitt';
2
- type BroadcastEvents = {
2
+ export type BroadcastEvents = {
3
3
  previewFocused: undefined;
4
+ published: {
5
+ uuid: string;
6
+ };
7
+ closeEditor: {
8
+ uuid: string;
9
+ };
10
+ editorLoaded: {
11
+ uuid: string;
12
+ };
4
13
  };
5
14
  export type BroadcastProvider = Emitter<BroadcastEvents>;
6
15
  export default function (): BroadcastProvider;
7
- export {};
@@ -0,0 +1,2 @@
1
+ import type { BroadcastEvents } from '../broadcastProvider.js';
2
+ export default function <T extends keyof BroadcastEvents>(name: T, cb: (e: BroadcastEvents[T]) => void): void;
@@ -0,0 +1,10 @@
1
+ import { onBeforeUnmount, onMounted, useBlokkli } from "#imports";
2
+ export default function(name, cb) {
3
+ const { broadcast } = useBlokkli();
4
+ onMounted(() => {
5
+ broadcast.on(name, cb);
6
+ });
7
+ onBeforeUnmount(() => {
8
+ broadcast.off(name, cb);
9
+ });
10
+ }
@@ -8,11 +8,11 @@ export type FeaturesProvider = {
8
8
  };
9
9
  export default function (): {
10
10
  features: ComputedRef<{
11
- id: "artboard" | "clipboard" | "delete" | "duplicate" | "edit" | "exit" | "grid" | "help" | "history" | "multi-select" | "preview" | "publish" | "revert" | "search" | "selection" | "options" | "add-list" | "assistant" | "block-add-list" | "command-palette" | "comments" | "conversions" | "debug" | "dragging-overlay" | "edit-form" | "editable-field" | "editable-mask" | "entity-title" | "field-areas" | "fragments" | "import-existing" | "library" | "media-library" | "ownership" | "preview-grant" | "responsive-preview" | "settings" | "structure" | "theme" | "touch-action-bar" | "tour" | "transform" | "translations" | "validations" | "demo-feature";
11
+ id: ValidFeatureKey;
12
12
  label?: string | undefined;
13
13
  icon: import("../../../playground/.nuxt/blokkli/icons").BlokkliIcon;
14
14
  description?: string | undefined;
15
- dependencies?: ("artboard" | "clipboard" | "delete" | "duplicate" | "edit" | "exit" | "grid" | "help" | "history" | "multi-select" | "preview" | "publish" | "revert" | "search" | "selection" | "options" | "add-list" | "assistant" | "block-add-list" | "command-palette" | "comments" | "conversions" | "debug" | "dragging-overlay" | "edit-form" | "editable-field" | "editable-mask" | "entity-title" | "field-areas" | "fragments" | "import-existing" | "library" | "media-library" | "ownership" | "preview-grant" | "responsive-preview" | "settings" | "structure" | "theme" | "touch-action-bar" | "tour" | "transform" | "translations" | "validations" | "demo-feature")[] | undefined;
15
+ dependencies?: ValidFeatureKey[] | undefined;
16
16
  viewports?: import("../constants").Viewport[] | undefined;
17
17
  requiredAdapterMethods?: (keyof import("../adapter").BlokkliAdapter<any>)[] | undefined;
18
18
  settings?: Record<string, import("#blokkli/types").FeatureDefinitionSetting> | undefined;
@@ -20,7 +20,7 @@ export function buildDraggableItem(element) {
20
20
  const hostFieldName = dataset.hostFieldName;
21
21
  const reusableBundle = dataset.reusableBundle;
22
22
  const hostFieldListType = dataset.hostFieldListType;
23
- const reusableUuid = dataset.reusableUuid;
23
+ const libraryItemUuid = dataset.bkLibraryItemUuid;
24
24
  const isNew = dataset.isNew === "true";
25
25
  const parentBlockBundle = hostType === itemEntityType ? hostBundle : void 0;
26
26
  if (uuid && hostType && hostUuid && hostFieldName && itemBundle && hostBundle && entityType && hostFieldListType) {
@@ -44,7 +44,7 @@ export function buildDraggableItem(element) {
44
44
  hostFieldName,
45
45
  hostFieldListType,
46
46
  reusableBundle,
47
- reusableUuid,
47
+ libraryItemUuid,
48
48
  editTitle: editTitle || void 0,
49
49
  isNew,
50
50
  parentBlockBundle
@@ -526,9 +526,9 @@ export interface DraggableExistingBlock {
526
526
  */
527
527
  reusableBundle?: string;
528
528
  /**
529
- * The reusable UUID if this block is a from_library type.
529
+ * The UUID of the library item this block belongs to.
530
530
  */
531
- reusableUuid?: string;
531
+ libraryItemUuid?: string;
532
532
  /**
533
533
  * The title to use when displaying the block in lists during editing.
534
534
  */
@@ -802,6 +802,11 @@ export type DropClipboardItemEvent = {
802
802
  host: DraggableHostData;
803
803
  afterUuid?: string;
804
804
  };
805
+ export type LibraryEditItemEvent = {
806
+ url: string;
807
+ uuid: string;
808
+ label?: string;
809
+ };
805
810
  export type EventbusEvents = {
806
811
  select: string | string[];
807
812
  'item:edit': EditBlockEvent;
@@ -827,6 +832,7 @@ export type EventbusEvents = {
827
832
  'select:next': undefined;
828
833
  'item:dropped': undefined;
829
834
  'block:append': BlockAppendEvent;
835
+ 'item:doubleClick': DraggableExistingBlock;
830
836
  scrollIntoView: ScrollIntoViewEvent;
831
837
  'animationFrame:before': undefined;
832
838
  'canvas:draw': CanvasDrawEvent;
@@ -853,6 +859,10 @@ export type EventbusEvents = {
853
859
  * Emitted when publishing failed.
854
860
  */
855
861
  'publish:failed': undefined;
862
+ /**
863
+ * Edit a library item.
864
+ */
865
+ 'library:edit-item': LibraryEditItemEvent;
856
866
  };
857
867
  export type Eventbus = Emitter<EventbusEvents>;
858
868
  export type ItemEditContext = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blokkli/editor",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Interactive page building experience for Nuxt",
5
5
  "repository": "blokkli/editor",
6
6
  "type": "module",