@blokkli/editor 2.0.0-alpha.14 → 2.0.0-alpha.15
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.
- package/dist/module.json +1 -1
- package/dist/module.mjs +867 -2
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +4 -0
- package/dist/modules/drupal/graphql/features/publishNew.graphql +1 -4
- package/dist/modules/drupal/graphql/features/scheduler.graphql +31 -0
- package/dist/modules/drupal/index.mjs +17 -0
- package/dist/modules/drupal/runtime/adapter/index.js +31 -1
- package/dist/runtime/adapter/index.d.ts +36 -0
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +33 -1
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue +41 -14
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue +47 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/ScheduleDate.vue +183 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/ScheduleDate.vue.d.ts +13 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue +83 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +381 -129
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue.d.ts +3 -14
- package/dist/runtime/components/Edit/Features/Publish/index.vue +34 -20
- package/dist/runtime/components/Edit/Form/Datepicker/index.vue +198 -0
- package/dist/runtime/components/Edit/Form/Datepicker/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Konami/Game/index.vue +8 -1
- package/dist/runtime/components/Edit/index.d.ts +2 -1
- package/dist/runtime/components/Edit/index.js +2 -0
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/stateProvider.d.ts +2 -1
- package/dist/runtime/helpers/stateProvider.js +31 -0
- package/dist/runtime/helpers/uiProvider.d.ts +2 -0
- package/dist/runtime/helpers/uiProvider.js +23 -0
- package/dist/runtime/icons/calendar-clock.svg +1 -0
- package/dist/runtime/icons/eye-off.svg +1 -0
- package/dist/runtime/types/index.d.ts +9 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Ref, type ComputedRef } from 'vue';
|
|
2
2
|
import type { BlokkliAdapter, AdapterContext } from '../adapter/index.js';
|
|
3
|
-
import type { MutatedField, EditEntity, MutatedOptions, TranslationState, MappedState, MutationItem, Validation, MutateWithLoadingStateFunction, EditMode, FieldListItem } from '#blokkli/types';
|
|
3
|
+
import type { MutatedField, EditEntity, MutatedOptions, TranslationState, MappedState, MutationItem, Validation, MutateWithLoadingStateFunction, EditMode, FieldListItem, PublishOptions } from '#blokkli/types';
|
|
4
4
|
import type { TextProvider } from './textProvider.js';
|
|
5
5
|
export type BlokkliOwner = {
|
|
6
6
|
name: string | undefined;
|
|
@@ -19,6 +19,7 @@ export type StateProvider = {
|
|
|
19
19
|
entity: Readonly<Ref<EditEntity>>;
|
|
20
20
|
mutatedOptions: MutatedOptions;
|
|
21
21
|
translation: Readonly<Ref<TranslationState>>;
|
|
22
|
+
publishOptions: Readonly<Ref<PublishOptions>>;
|
|
22
23
|
mutations: Readonly<Ref<MutationItem[]>>;
|
|
23
24
|
currentMutationIndex: Readonly<Ref<number>>;
|
|
24
25
|
violations: Readonly<Ref<Validation[]>>;
|
|
@@ -13,6 +13,17 @@ import { eventBus, emitMessage } from "#blokkli/helpers/eventBus";
|
|
|
13
13
|
import { nextTick } from "#imports";
|
|
14
14
|
import { addElementClasses } from "./addElementClasses.js";
|
|
15
15
|
const HOST_OPTION_KEY = "HOST";
|
|
16
|
+
function mapPublishOptions(context) {
|
|
17
|
+
return {
|
|
18
|
+
canPublish: !!context?.publishOptions?.canPublish,
|
|
19
|
+
isRevisionable: !!context?.publishOptions?.isRevisionable,
|
|
20
|
+
hasRevisionLogMessage: !!context?.publishOptions?.hasRevisionLogMessage,
|
|
21
|
+
canSchedule: !!context?.publishOptions?.canSchedule,
|
|
22
|
+
lastChanged: context?.publishOptions?.lastChanged ?? null,
|
|
23
|
+
publishOn: context?.publishOptions?.publishOn ?? null,
|
|
24
|
+
revisionLogMessage: context?.publishOptions?.revisionLogMessage ?? null
|
|
25
|
+
};
|
|
26
|
+
}
|
|
16
27
|
export default async function(adapter, context, $t, providerKey) {
|
|
17
28
|
let _mappedState = null;
|
|
18
29
|
const overrideHostOptions = useState("options:" + providerKey);
|
|
@@ -27,6 +38,15 @@ export default async function(adapter, context, $t, providerKey) {
|
|
|
27
38
|
const mutations = ref([]);
|
|
28
39
|
const violations = ref([]);
|
|
29
40
|
const mutatedEntity = ref(null);
|
|
41
|
+
const publishOptions = ref({
|
|
42
|
+
canPublish: false,
|
|
43
|
+
isRevisionable: false,
|
|
44
|
+
hasRevisionLogMessage: false,
|
|
45
|
+
lastChanged: null,
|
|
46
|
+
canSchedule: false,
|
|
47
|
+
publishOn: null,
|
|
48
|
+
revisionLogMessage: null
|
|
49
|
+
});
|
|
30
50
|
const currentMutationIndex = ref(-1);
|
|
31
51
|
const isLoading = ref(false);
|
|
32
52
|
const entity = ref({
|
|
@@ -63,6 +83,15 @@ export default async function(adapter, context, $t, providerKey) {
|
|
|
63
83
|
availableLanguages: [],
|
|
64
84
|
translations: []
|
|
65
85
|
});
|
|
86
|
+
function updatePublishOptions(newPublishOptions) {
|
|
87
|
+
publishOptions.value.canPublish = newPublishOptions.canPublish;
|
|
88
|
+
publishOptions.value.isRevisionable = newPublishOptions.isRevisionable;
|
|
89
|
+
publishOptions.value.hasRevisionLogMessage = newPublishOptions.hasRevisionLogMessage;
|
|
90
|
+
publishOptions.value.lastChanged = newPublishOptions.lastChanged;
|
|
91
|
+
publishOptions.value.canSchedule = newPublishOptions.canSchedule;
|
|
92
|
+
publishOptions.value.publishOn = newPublishOptions.publishOn;
|
|
93
|
+
publishOptions.value.revisionLogMessage = newPublishOptions.revisionLogMessage;
|
|
94
|
+
}
|
|
66
95
|
function setContext(context2, override) {
|
|
67
96
|
if (!override) {
|
|
68
97
|
_mappedState = context2 ?? null;
|
|
@@ -94,6 +123,7 @@ export default async function(adapter, context, $t, providerKey) {
|
|
|
94
123
|
entity.value.label = context2?.entity?.label;
|
|
95
124
|
entity.value.status = context2?.entity?.status;
|
|
96
125
|
entity.value.bundleLabel = context2?.entity?.bundleLabel || "";
|
|
126
|
+
updatePublishOptions(mapPublishOptions(context2));
|
|
97
127
|
translation.value.isTranslatable = !!context2?.translationState?.isTranslatable;
|
|
98
128
|
translation.value.translations = context2?.translationState?.translations?.filter(falsy) || [];
|
|
99
129
|
translation.value.sourceLanguage = context2?.translationState?.sourceLanguage || "";
|
|
@@ -273,6 +303,7 @@ export default async function(adapter, context, $t, providerKey) {
|
|
|
273
303
|
getMappedState,
|
|
274
304
|
refreshKey,
|
|
275
305
|
owner: readonly(owner),
|
|
306
|
+
publishOptions: readonly(publishOptions),
|
|
276
307
|
mutatedFields,
|
|
277
308
|
entity,
|
|
278
309
|
mutatedOptions,
|
|
@@ -40,6 +40,8 @@ export type UiProvider = {
|
|
|
40
40
|
artboardOffset: Ref<Coord>;
|
|
41
41
|
selectionTopLeft: Ref<Coord>;
|
|
42
42
|
interfaceLanguage: ComputedRef<string>;
|
|
43
|
+
locale: ComputedRef<string>;
|
|
44
|
+
formatDate: (date: string | Date, options?: Intl.DateTimeFormatOptions) => string;
|
|
43
45
|
getAbsoluteElementRect: (v: HTMLElement | Rectangle, scale?: number, offset?: Coord) => Rectangle;
|
|
44
46
|
getViewportRelativeRect: (rect: Rectangle, scale?: number, offset?: Coord) => Rectangle;
|
|
45
47
|
};
|
|
@@ -9,6 +9,12 @@ import { falsy } from "./index.js";
|
|
|
9
9
|
import { addElementClasses } from "./addElementClasses.js";
|
|
10
10
|
import { defaultLanguage, forceDefaultLanguage } from "#blokkli-build/config";
|
|
11
11
|
const CLASS_PROXY_MODE = "bk-is-proxy-mode";
|
|
12
|
+
const localeMap = {
|
|
13
|
+
de: "de-CH",
|
|
14
|
+
fr: "fr-CH",
|
|
15
|
+
it: "it-CH",
|
|
16
|
+
en: "en-GB"
|
|
17
|
+
};
|
|
12
18
|
export default function(storage, state, context) {
|
|
13
19
|
let cachedRootElement = null;
|
|
14
20
|
let cachedArtboardElement = null;
|
|
@@ -16,6 +22,10 @@ export default function(storage, state, context) {
|
|
|
16
22
|
const interfaceLanguage = computed(() => {
|
|
17
23
|
return forceDefaultLanguage ? defaultLanguage : context.value.language;
|
|
18
24
|
});
|
|
25
|
+
const locale = computed(() => {
|
|
26
|
+
const lang = interfaceLanguage.value;
|
|
27
|
+
return localeMap[lang] || lang;
|
|
28
|
+
});
|
|
19
29
|
const isProxyMode = ref(false);
|
|
20
30
|
const menuIsOpen = ref(false);
|
|
21
31
|
const hasDialogOpen = ref(false);
|
|
@@ -229,6 +239,17 @@ export default function(storage, state, context) {
|
|
|
229
239
|
function setTransform(label) {
|
|
230
240
|
transformLabel.value = label || "";
|
|
231
241
|
}
|
|
242
|
+
function formatDate(date, options) {
|
|
243
|
+
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
244
|
+
const defaultOptions = {
|
|
245
|
+
year: "numeric",
|
|
246
|
+
month: "2-digit",
|
|
247
|
+
day: "2-digit",
|
|
248
|
+
hour: "2-digit",
|
|
249
|
+
minute: "2-digit"
|
|
250
|
+
};
|
|
251
|
+
return dateObj.toLocaleString(locale.value, options || defaultOptions);
|
|
252
|
+
}
|
|
232
253
|
addElementClasses(document.documentElement, "bk-is-animating", isAnimating);
|
|
233
254
|
addElementClasses(
|
|
234
255
|
document.documentElement,
|
|
@@ -293,6 +314,8 @@ export default function(storage, state, context) {
|
|
|
293
314
|
getAbsoluteElementRect,
|
|
294
315
|
getViewportRelativeRect,
|
|
295
316
|
interfaceLanguage,
|
|
317
|
+
locale,
|
|
318
|
+
formatDate,
|
|
296
319
|
hasDialogOpen,
|
|
297
320
|
hasTransformOverlayOpen,
|
|
298
321
|
hasAddTooltipOpen
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" /></svg>
|
|
@@ -556,6 +556,7 @@ export interface MappedState {
|
|
|
556
556
|
fields?: MutatedField[];
|
|
557
557
|
violations?: Validation[];
|
|
558
558
|
};
|
|
559
|
+
publishOptions: PublishOptions;
|
|
559
560
|
entity: EditEntity;
|
|
560
561
|
mutatedEntity?: any;
|
|
561
562
|
translationState: TranslationState;
|
|
@@ -1068,6 +1069,10 @@ export type EventbusEvents = {
|
|
|
1068
1069
|
* Emitted when publishing failed.
|
|
1069
1070
|
*/
|
|
1070
1071
|
'publish:failed': undefined;
|
|
1072
|
+
/**
|
|
1073
|
+
* Show the publish dialog.
|
|
1074
|
+
*/
|
|
1075
|
+
'publish:show-dialog': undefined;
|
|
1071
1076
|
/**
|
|
1072
1077
|
* Edit a library item.
|
|
1073
1078
|
*/
|
|
@@ -1352,7 +1357,10 @@ export type PublishOptions = {
|
|
|
1352
1357
|
canPublish: boolean;
|
|
1353
1358
|
isRevisionable: boolean;
|
|
1354
1359
|
hasRevisionLogMessage: boolean;
|
|
1355
|
-
lastChanged
|
|
1360
|
+
lastChanged: string | null;
|
|
1361
|
+
canSchedule: boolean;
|
|
1362
|
+
publishOn: string | null;
|
|
1363
|
+
revisionLogMessage: string | null;
|
|
1356
1364
|
};
|
|
1357
1365
|
export type GetEditStatesItem = {
|
|
1358
1366
|
hostEntityType: string;
|