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

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 (47) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +922 -2
  3. package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +4 -0
  4. package/dist/modules/drupal/graphql/features/publishNew.graphql +1 -4
  5. package/dist/modules/drupal/graphql/features/scheduler.graphql +31 -0
  6. package/dist/modules/drupal/index.mjs +17 -0
  7. package/dist/modules/drupal/runtime/adapter/index.js +31 -1
  8. package/dist/runtime/adapter/index.d.ts +36 -0
  9. package/dist/runtime/blokkliPlugins/MenuButton/index.vue.d.ts +2 -2
  10. package/dist/runtime/components/Edit/Dialog/index.vue +3 -0
  11. package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +2 -0
  12. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +7 -1
  13. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +22 -3
  14. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/vertex.glsl +1 -0
  15. package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +33 -1
  16. package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue +41 -14
  17. package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue.d.ts +2 -0
  18. package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue +47 -0
  19. package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue.d.ts +19 -0
  20. package/dist/runtime/components/Edit/Features/Publish/Dialog/ScheduleDate.vue +183 -0
  21. package/dist/runtime/components/Edit/Features/Publish/Dialog/ScheduleDate.vue.d.ts +13 -0
  22. package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue +83 -0
  23. package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue.d.ts +9 -0
  24. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +391 -129
  25. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue.d.ts +3 -14
  26. package/dist/runtime/components/Edit/Features/Publish/index.vue +34 -20
  27. package/dist/runtime/components/Edit/Features/Selection/index.vue +21 -7
  28. package/dist/runtime/components/Edit/Form/Datepicker/index.vue +198 -0
  29. package/dist/runtime/components/Edit/Form/Datepicker/index.vue.d.ts +15 -0
  30. package/dist/runtime/components/Edit/Konami/Game/index.vue +8 -1
  31. package/dist/runtime/components/Edit/index.d.ts +2 -1
  32. package/dist/runtime/components/Edit/index.js +2 -0
  33. package/dist/runtime/composables/defineBlokkli.js +1 -1
  34. package/dist/runtime/css/output.css +1 -1
  35. package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.d.ts +1 -1
  36. package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.js +3 -2
  37. package/dist/runtime/helpers/domProvider.js +6 -1
  38. package/dist/runtime/helpers/stateProvider.d.ts +2 -1
  39. package/dist/runtime/helpers/stateProvider.js +31 -0
  40. package/dist/runtime/helpers/uiProvider.d.ts +2 -0
  41. package/dist/runtime/helpers/uiProvider.js +23 -0
  42. package/dist/runtime/helpers/webgl/index.d.ts +11 -2
  43. package/dist/runtime/helpers/webgl/index.js +162 -7
  44. package/dist/runtime/icons/calendar-clock.svg +1 -0
  45. package/dist/runtime/icons/eye-off.svg +1 -0
  46. package/dist/runtime/types/index.d.ts +9 -1
  47. package/package.json +1 -1
@@ -0,0 +1,183 @@
1
+ <template>
2
+ <div class="bk-schedule-date">
3
+ <div class="bk-schedule-date-picker">
4
+ <FormDatepicker
5
+ v-model="selectedDate"
6
+ :min="minDate"
7
+ :disabled="disabled"
8
+ :error="!!error"
9
+ />
10
+ </div>
11
+ <div v-if="selectedDate" class="bk-schedule-date-time">
12
+ <div v-if="formattedDateTime" class="bk-schedule-date-formatted">
13
+ {{ formattedDateTime }}
14
+ </div>
15
+ <div class="bk-schedule-date-time-input">
16
+ <input
17
+ id="schedule-time"
18
+ v-model="selectedTime"
19
+ type="time"
20
+ class="bk-form-input"
21
+ :disabled="disabled"
22
+ :class="{
23
+ 'bk-is-invalid': error
24
+ }"
25
+ />
26
+ <button
27
+ type="button"
28
+ class="bk-button bk-schedule-date-time-button bk-is-icon-only"
29
+ :disabled="disabled"
30
+ @click="decrementHour"
31
+ >
32
+ <Icon name="minus" />
33
+ </button>
34
+ <button
35
+ type="button"
36
+ class="bk-button bk-schedule-date-time-button bk-is-icon-only"
37
+ :disabled="disabled"
38
+ @click="incrementHour"
39
+ >
40
+ <Icon name="plus" />
41
+ </button>
42
+ </div>
43
+
44
+ <div class="bk-schedule-date-presets">
45
+ <button
46
+ type="button"
47
+ class="bk-button bk-is-small"
48
+ :disabled="disabled"
49
+ @click="setTomorrow"
50
+ >
51
+ {{ $t("publishScheduleTomorrow", "Tomorrow") }}
52
+ </button>
53
+ <button
54
+ type="button"
55
+ class="bk-button bk-is-small"
56
+ :disabled="disabled"
57
+ @click="setInSevenDays"
58
+ >
59
+ {{ $t("publishScheduleInSevenDays", "In 7 days") }}
60
+ </button>
61
+ <button
62
+ type="button"
63
+ class="bk-button bk-is-small"
64
+ :disabled="disabled"
65
+ @click="setNextMonday"
66
+ >
67
+ {{ $t("publishScheduleNextMonday", "Next Monday") }}
68
+ </button>
69
+ </div>
70
+ <div
71
+ class="bk-schedule-date-info"
72
+ v-text="
73
+ $t(
74
+ 'publishScheduledInfo',
75
+ 'You can still make changes until the scheduled publication date.'
76
+ )
77
+ "
78
+ />
79
+ <div v-if="error" class="bk-schedule-date-error">
80
+ {{ error }}
81
+ </div>
82
+ </div>
83
+ </div>
84
+ </template>
85
+
86
+ <script setup>
87
+ import { ref, computed, watch, useBlokkli } from "#imports";
88
+ import { FormDatepicker, Icon } from "#blokkli/components";
89
+ const { $t, ui } = useBlokkli();
90
+ defineProps({
91
+ disabled: { type: Boolean, required: false },
92
+ error: { type: String, required: false }
93
+ });
94
+ const modelValue = defineModel({ type: String });
95
+ const selectedDate = ref("");
96
+ const selectedTime = ref("12:00");
97
+ const formattedDateTime = computed(() => {
98
+ if (!selectedDate.value || !selectedTime.value) {
99
+ return "";
100
+ }
101
+ const dateTimeString = `${selectedDate.value}T${selectedTime.value}:00`;
102
+ const date = new Date(dateTimeString);
103
+ return ui.formatDate(date, {
104
+ weekday: "long",
105
+ year: "numeric",
106
+ month: "long",
107
+ day: "numeric",
108
+ hour: "2-digit",
109
+ minute: "2-digit"
110
+ });
111
+ });
112
+ if (modelValue.value) {
113
+ const date = new Date(modelValue.value);
114
+ selectedDate.value = formatDate(date);
115
+ selectedTime.value = formatTime(date);
116
+ }
117
+ const minDate = computed(() => {
118
+ const today = /* @__PURE__ */ new Date();
119
+ return formatDate(today);
120
+ });
121
+ function formatDate(date) {
122
+ const year = date.getFullYear();
123
+ const month = String(date.getMonth() + 1).padStart(2, "0");
124
+ const day = String(date.getDate()).padStart(2, "0");
125
+ return `${year}-${month}-${day}`;
126
+ }
127
+ function formatTime(date) {
128
+ const hours = String(date.getHours()).padStart(2, "0");
129
+ const minutes = String(date.getMinutes()).padStart(2, "0");
130
+ return `${hours}:${minutes}`;
131
+ }
132
+ watch([selectedDate, selectedTime], () => {
133
+ if (!selectedDate.value) {
134
+ modelValue.value = void 0;
135
+ return;
136
+ }
137
+ const dateTimeString = `${selectedDate.value}T${selectedTime.value}:00`;
138
+ const date = new Date(dateTimeString);
139
+ modelValue.value = date.toISOString();
140
+ });
141
+ watch(modelValue, (newValue) => {
142
+ if (!newValue) {
143
+ selectedDate.value = "";
144
+ selectedTime.value = "12:00";
145
+ return;
146
+ }
147
+ const date = new Date(newValue);
148
+ const newDate = formatDate(date);
149
+ const newTime = formatTime(date);
150
+ if (newDate !== selectedDate.value || newTime !== selectedTime.value) {
151
+ selectedDate.value = newDate;
152
+ selectedTime.value = newTime;
153
+ }
154
+ });
155
+ function setTomorrow() {
156
+ const tomorrow = /* @__PURE__ */ new Date();
157
+ tomorrow.setDate(tomorrow.getDate() + 1);
158
+ selectedDate.value = formatDate(tomorrow);
159
+ }
160
+ function setInSevenDays() {
161
+ const date = /* @__PURE__ */ new Date();
162
+ date.setDate(date.getDate() + 7);
163
+ selectedDate.value = formatDate(date);
164
+ }
165
+ function setNextMonday() {
166
+ const today = /* @__PURE__ */ new Date();
167
+ const dayOfWeek = today.getDay();
168
+ const daysUntilMonday = dayOfWeek === 0 ? 1 : 8 - dayOfWeek;
169
+ const nextMonday = /* @__PURE__ */ new Date();
170
+ nextMonday.setDate(today.getDate() + daysUntilMonday);
171
+ selectedDate.value = formatDate(nextMonday);
172
+ }
173
+ function incrementHour() {
174
+ const [hours = 0, minutes = 0] = selectedTime.value.split(":").map(Number);
175
+ const newHours = (hours + 1) % 24;
176
+ selectedTime.value = `${String(newHours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`;
177
+ }
178
+ function decrementHour() {
179
+ const [hours = 0, minutes = 0] = selectedTime.value.split(":").map(Number);
180
+ const newHours = hours === 0 ? 23 : hours - 1;
181
+ selectedTime.value = `${String(newHours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`;
182
+ }
183
+ </script>
@@ -0,0 +1,13 @@
1
+ type __VLS_Props = {
2
+ disabled?: boolean;
3
+ error?: string;
4
+ };
5
+ type __VLS_PublicProps = __VLS_Props & {
6
+ modelValue?: string;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ "update:modelValue": (value: string | undefined) => any;
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
11
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ export default _default;
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <div class="bk-publish-summary">
3
+ <!-- Current State -->
4
+ <div class="bk-publish-summary-state">
5
+ <div class="bk-publish-summary-state-icon" :class="currentStateClass">
6
+ <Icon :name="currentStateIcon" />
7
+ </div>
8
+ <div class="bk-publish-summary-state-label">
9
+ {{ currentStateLabel }}
10
+ </div>
11
+ </div>
12
+
13
+ <!-- Arrow -->
14
+ <div class="bk-publish-summary-arrow">
15
+ <Icon name="arrow-right" />
16
+ </div>
17
+
18
+ <!-- Action -->
19
+ <div class="bk-publish-summary-action">
20
+ <div class="bk-publish-summary-action-icon" :class="actionClass">
21
+ <Icon :name="actionIcon" />
22
+ </div>
23
+ <div class="bk-publish-summary-action-label">
24
+ {{ actionLabel }}
25
+ </div>
26
+ </div>
27
+
28
+ <!-- Arrow -->
29
+ <div class="bk-publish-summary-arrow">
30
+ <Icon name="arrow-right" />
31
+ </div>
32
+
33
+ <!-- Result State -->
34
+ <div class="bk-publish-summary-state" :class="resultStateClass">
35
+ <div>
36
+ <Icon :name="resultStateIcon" />
37
+ </div>
38
+ <div class="bk-publish-summary-state-label">
39
+ {{ resultStateLabel }}
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </template>
44
+
45
+ <script setup>
46
+ import { computed } from "#imports";
47
+ import { Icon } from "#blokkli/components";
48
+ const props = defineProps({
49
+ isPublished: { type: Boolean, required: true },
50
+ mode: { type: String, required: true },
51
+ currentStateLabel: { type: String, required: true },
52
+ actionLabel: { type: String, required: true },
53
+ resultStateLabel: { type: String, required: true }
54
+ });
55
+ const currentStateIcon = computed(
56
+ () => props.isPublished ? "eye" : "eye-off"
57
+ );
58
+ const currentStateClass = computed(
59
+ () => props.isPublished ? "bk-is-published" : "bk-is-unpublished"
60
+ );
61
+ const resultStateIcon = computed(() => {
62
+ if (props.mode === "save") {
63
+ return "eye-off";
64
+ }
65
+ return "eye";
66
+ });
67
+ const resultStateClass = computed(() => {
68
+ if (props.mode === "save") {
69
+ return "bk-is-unpublished";
70
+ }
71
+ return "bk-is-published";
72
+ });
73
+ const actionIcon = computed(() => {
74
+ if (props.mode === "save") return "save";
75
+ if (props.mode === "scheduled") return "calendar-clock";
76
+ return "publish";
77
+ });
78
+ const actionClass = computed(() => {
79
+ if (props.mode === "save") return "bk-is-save";
80
+ if (props.mode === "scheduled") return "bk-is-scheduled";
81
+ return "bk-is-publish";
82
+ });
83
+ </script>
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ isPublished: boolean;
3
+ mode: 'immediate' | 'scheduled' | 'save';
4
+ currentStateLabel: string;
5
+ actionLabel: string;
6
+ resultStateLabel: string;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ export default _default;