@threadlabs/looma 0.28.4 → 0.28.5
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/components/ui-editor-image-toolbar/ui-editor-image-toolbar.html +96 -0
- package/components/ui-editor-image-toolbar/ui-editor-image-toolbar.js +56 -0
- package/dist/index.js +34 -33
- package/package.json +1 -1
- package/styles/ui-editor-image-toolbar.css +1 -0
- package/vanilla/UiEditorImageToolbar.d.ts +19 -0
- package/vanilla/UiEditorImageToolbar.js +171 -0
- package/vanilla/index.js +1 -0
- package/vue/UiEditorImageToolbar.d.ts +54 -0
- package/vue/UiEditorImageToolbar.js +2 -0
- package/vue/UiEditorImageToolbar.vue +625 -0
- package/vue/UiText.d.ts +1 -1
- package/vue/chunks/UiEditorImageToolbar.js +584 -0
- package/vue/components.css +2142 -2142
- package/vue/editor/index.js +41 -170
- package/vue/editor/primitives.d.ts +9 -1
- package/vue/index.d.ts +1 -0
- package/vue/index.js +9 -8
- package/vue/editor/image-controls.d.ts +0 -19
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
import { r as useComponentHost, t as createDispatch } from "./host.js";
|
|
2
|
+
import { a as vPropValidity, n as checkedProp, r as propValidityState, t as acceptsControllerWrite } from "./props.js";
|
|
3
|
+
import { t as UiIcon_default } from "./UiIcon.js";
|
|
4
|
+
import { t as UiButton_default } from "./UiButton.js";
|
|
5
|
+
import { t as UiCluster_default } from "./UiCluster.js";
|
|
6
|
+
import { t as UiTooltip_default } from "./UiTooltip.js";
|
|
7
|
+
import { t as UiEditorToolbar_default } from "./UiEditorToolbar.js";
|
|
8
|
+
import { t as UiFormField_default } from "./UiFormField.js";
|
|
9
|
+
import { t as UiIconButton_default } from "./UiIconButton.js";
|
|
10
|
+
import { t as UiInput_default } from "./UiInput.js";
|
|
11
|
+
import { t as UiPopover_default } from "./UiPopover.js";
|
|
12
|
+
import { t as UiStack_default } from "./UiStack.js";
|
|
13
|
+
import { t as UiText_default } from "./UiText.js";
|
|
14
|
+
import { computed, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, unref, watchSyncEffect, withCtx, withDirectives } from "vue";
|
|
15
|
+
//#region .build/vue/UiEditorImageToolbar.vue?vue&type=script&setup=true&lang.ts
|
|
16
|
+
var _hoisted_1 = [
|
|
17
|
+
"data-alt",
|
|
18
|
+
"data-placement",
|
|
19
|
+
"data-target"
|
|
20
|
+
];
|
|
21
|
+
var _hoisted_2 = { "aria-label": "Image description" };
|
|
22
|
+
var _hoisted_3 = ["for"];
|
|
23
|
+
var htmlNextAuthoredCheck2Reported = /* @__PURE__ */ new Set();
|
|
24
|
+
function htmlNextAuthoredCheck2(accepted, location, message) {
|
|
25
|
+
if (!accepted && !htmlNextAuthoredCheck2Reported.has(location)) {
|
|
26
|
+
htmlNextAuthoredCheck2Reported.add(location);
|
|
27
|
+
console.warn(message);
|
|
28
|
+
}
|
|
29
|
+
return accepted;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region .build/vue/UiEditorImageToolbar.vue
|
|
33
|
+
var UiEditorImageToolbar_default = /* @__PURE__ */ defineComponent({
|
|
34
|
+
inheritAttrs: false,
|
|
35
|
+
__name: "UiEditorImageToolbar",
|
|
36
|
+
props: {
|
|
37
|
+
alt: {
|
|
38
|
+
type: null,
|
|
39
|
+
default: ""
|
|
40
|
+
},
|
|
41
|
+
placement: {
|
|
42
|
+
type: null,
|
|
43
|
+
default: "block"
|
|
44
|
+
},
|
|
45
|
+
target: {
|
|
46
|
+
type: null,
|
|
47
|
+
default: ""
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
emits: [
|
|
51
|
+
"update:alt",
|
|
52
|
+
"update:placement",
|
|
53
|
+
"placement",
|
|
54
|
+
"describe",
|
|
55
|
+
"delete"
|
|
56
|
+
],
|
|
57
|
+
setup(__props, { emit: __emit }) {
|
|
58
|
+
const propValidityContract = { props: {
|
|
59
|
+
alt: {
|
|
60
|
+
type: {
|
|
61
|
+
kind: "terminal",
|
|
62
|
+
name: "string"
|
|
63
|
+
},
|
|
64
|
+
required: false,
|
|
65
|
+
target: { attribute: "alt" },
|
|
66
|
+
description: "The selected image's description, which the description form starts from.",
|
|
67
|
+
default: ""
|
|
68
|
+
},
|
|
69
|
+
placement: {
|
|
70
|
+
type: {
|
|
71
|
+
kind: "terminal",
|
|
72
|
+
name: "keyword"
|
|
73
|
+
},
|
|
74
|
+
required: false,
|
|
75
|
+
target: { attribute: "placement" },
|
|
76
|
+
description: "How the selected image sits in the text; its command shows as pressed.",
|
|
77
|
+
values: [
|
|
78
|
+
"block",
|
|
79
|
+
"center",
|
|
80
|
+
"wrap-left",
|
|
81
|
+
"wrap-right"
|
|
82
|
+
],
|
|
83
|
+
default: "block"
|
|
84
|
+
},
|
|
85
|
+
target: {
|
|
86
|
+
type: {
|
|
87
|
+
kind: "terminal",
|
|
88
|
+
name: "string"
|
|
89
|
+
},
|
|
90
|
+
required: false,
|
|
91
|
+
target: { attribute: "target" },
|
|
92
|
+
description: "Identifies the image the toolbar acts on. When it changes, an open description draft is cancelled rather than applied to another image.",
|
|
93
|
+
default: ""
|
|
94
|
+
}
|
|
95
|
+
} };
|
|
96
|
+
const props = __props;
|
|
97
|
+
const acceptedProps = {
|
|
98
|
+
alt: "",
|
|
99
|
+
placement: "block",
|
|
100
|
+
target: ""
|
|
101
|
+
};
|
|
102
|
+
const checkedProps = computed(() => ({
|
|
103
|
+
alt: checkedProp(props["alt"], {
|
|
104
|
+
kind: "terminal",
|
|
105
|
+
name: "string"
|
|
106
|
+
}, false, "alt", acceptedProps),
|
|
107
|
+
placement: checkedProp(props["placement"], {
|
|
108
|
+
kind: "terminal",
|
|
109
|
+
name: "keyword"
|
|
110
|
+
}, false, "placement", acceptedProps),
|
|
111
|
+
target: checkedProp(props["target"], {
|
|
112
|
+
kind: "terminal",
|
|
113
|
+
name: "string"
|
|
114
|
+
}, false, "target", acceptedProps)
|
|
115
|
+
}));
|
|
116
|
+
checkedProps.value;
|
|
117
|
+
watchSyncEffect(() => {
|
|
118
|
+
checkedProps.value;
|
|
119
|
+
});
|
|
120
|
+
function nativeAttrs(attrs) {
|
|
121
|
+
const names = Object.keys(attrs);
|
|
122
|
+
if (!names.some((name) => Object.hasOwn(Object.prototype, name))) return attrs;
|
|
123
|
+
return Object.fromEntries(names.map((name) => [Object.hasOwn(Object.prototype, name) ? name === "__proto__" ? "__Proto__" : name[0].toUpperCase() + name.slice(1) : name, attrs[name]]));
|
|
124
|
+
}
|
|
125
|
+
const componentInstance = getCurrentInstance();
|
|
126
|
+
function reflectedProp(name, kebab, value, fallback, bound, separator) {
|
|
127
|
+
const incoming = componentInstance?.vnode.props;
|
|
128
|
+
if (!bound && (incoming === null || incoming === void 0 || !Object.hasOwn(incoming, name) && !Object.hasOwn(incoming, kebab))) return fallback;
|
|
129
|
+
if (value === null || value === void 0) return void 0;
|
|
130
|
+
return Array.isArray(value) && separator !== void 0 ? value.join(separator) : typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
131
|
+
}
|
|
132
|
+
const hydrationInstance = getCurrentInstance();
|
|
133
|
+
const emit = __emit;
|
|
134
|
+
const root = ref(null);
|
|
135
|
+
const base = ref("ui-editor-image-toolbar");
|
|
136
|
+
const describing = ref(false);
|
|
137
|
+
const draft = ref("");
|
|
138
|
+
let guardedPrevious = null;
|
|
139
|
+
const guarded = computed(() => {
|
|
140
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-block'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedPrevious;
|
|
141
|
+
const candidate = concat(base.value, "-block");
|
|
142
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedPrevious;
|
|
143
|
+
return guardedPrevious = candidate;
|
|
144
|
+
});
|
|
145
|
+
let guardedBindingPrevious = null;
|
|
146
|
+
const guardedBinding = computed(() => {
|
|
147
|
+
const candidate = ((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
|
|
148
|
+
true: "outline",
|
|
149
|
+
false: "ghost"
|
|
150
|
+
}, concat(checkedProps.value.placement === "block"));
|
|
151
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBindingPrevious;
|
|
152
|
+
return guardedBindingPrevious = candidate;
|
|
153
|
+
});
|
|
154
|
+
let guardedBinding2Previous = null;
|
|
155
|
+
const guardedBinding2 = computed(() => {
|
|
156
|
+
const candidate = concat(checkedProps.value.placement === "block");
|
|
157
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding2Previous;
|
|
158
|
+
return guardedBinding2Previous = candidate;
|
|
159
|
+
});
|
|
160
|
+
let guardedBinding3Previous = null;
|
|
161
|
+
const guardedBinding3 = computed(() => {
|
|
162
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-center'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding3Previous;
|
|
163
|
+
const candidate = concat(base.value, "-center");
|
|
164
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding3Previous;
|
|
165
|
+
return guardedBinding3Previous = candidate;
|
|
166
|
+
});
|
|
167
|
+
let guardedBinding4Previous = null;
|
|
168
|
+
const guardedBinding4 = computed(() => {
|
|
169
|
+
const candidate = ((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
|
|
170
|
+
true: "outline",
|
|
171
|
+
false: "ghost"
|
|
172
|
+
}, concat(checkedProps.value.placement === "center"));
|
|
173
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding4Previous;
|
|
174
|
+
return guardedBinding4Previous = candidate;
|
|
175
|
+
});
|
|
176
|
+
let guardedBinding5Previous = null;
|
|
177
|
+
const guardedBinding5 = computed(() => {
|
|
178
|
+
const candidate = concat(checkedProps.value.placement === "center");
|
|
179
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding5Previous;
|
|
180
|
+
return guardedBinding5Previous = candidate;
|
|
181
|
+
});
|
|
182
|
+
let guardedBinding6Previous = null;
|
|
183
|
+
const guardedBinding6 = computed(() => {
|
|
184
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-wrap-left'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding6Previous;
|
|
185
|
+
const candidate = concat(base.value, "-wrap-left");
|
|
186
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding6Previous;
|
|
187
|
+
return guardedBinding6Previous = candidate;
|
|
188
|
+
});
|
|
189
|
+
let guardedBinding7Previous = null;
|
|
190
|
+
const guardedBinding7 = computed(() => {
|
|
191
|
+
const candidate = ((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
|
|
192
|
+
true: "outline",
|
|
193
|
+
false: "ghost"
|
|
194
|
+
}, concat(checkedProps.value.placement === "wrap-left"));
|
|
195
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding7Previous;
|
|
196
|
+
return guardedBinding7Previous = candidate;
|
|
197
|
+
});
|
|
198
|
+
let guardedBinding8Previous = null;
|
|
199
|
+
const guardedBinding8 = computed(() => {
|
|
200
|
+
const candidate = concat(checkedProps.value.placement === "wrap-left");
|
|
201
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding8Previous;
|
|
202
|
+
return guardedBinding8Previous = candidate;
|
|
203
|
+
});
|
|
204
|
+
let guardedBinding9Previous = null;
|
|
205
|
+
const guardedBinding9 = computed(() => {
|
|
206
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-wrap-right'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding9Previous;
|
|
207
|
+
const candidate = concat(base.value, "-wrap-right");
|
|
208
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding9Previous;
|
|
209
|
+
return guardedBinding9Previous = candidate;
|
|
210
|
+
});
|
|
211
|
+
let guardedBinding10Previous = null;
|
|
212
|
+
const guardedBinding10 = computed(() => {
|
|
213
|
+
const candidate = ((objectValue, indexValue) => objectValue === Symbol.for("html-next.invalid-result") || indexValue === Symbol.for("html-next.invalid-result") ? Symbol.for("html-next.invalid-result") : objectValue[indexValue])({
|
|
214
|
+
true: "outline",
|
|
215
|
+
false: "ghost"
|
|
216
|
+
}, concat(checkedProps.value.placement === "wrap-right"));
|
|
217
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding10Previous;
|
|
218
|
+
return guardedBinding10Previous = candidate;
|
|
219
|
+
});
|
|
220
|
+
let guardedBinding11Previous = null;
|
|
221
|
+
const guardedBinding11 = computed(() => {
|
|
222
|
+
const candidate = concat(checkedProps.value.placement === "wrap-right");
|
|
223
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding11Previous;
|
|
224
|
+
return guardedBinding11Previous = candidate;
|
|
225
|
+
});
|
|
226
|
+
let guardedBinding12Previous;
|
|
227
|
+
const guardedBinding12 = computed(() => {
|
|
228
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "$base:base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding12Previous;
|
|
229
|
+
return guardedBinding12Previous = base.value;
|
|
230
|
+
});
|
|
231
|
+
let guardedBinding13Previous = null;
|
|
232
|
+
const guardedBinding13 = computed(() => {
|
|
233
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-delete'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding13Previous;
|
|
234
|
+
const candidate = concat(base.value, "-delete");
|
|
235
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding13Previous;
|
|
236
|
+
return guardedBinding13Previous = candidate;
|
|
237
|
+
});
|
|
238
|
+
let guardedBinding14Previous = null;
|
|
239
|
+
const guardedBinding14 = computed(() => {
|
|
240
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-block'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding14Previous;
|
|
241
|
+
const candidate = concat(base.value, "-block");
|
|
242
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding14Previous;
|
|
243
|
+
return guardedBinding14Previous = candidate;
|
|
244
|
+
});
|
|
245
|
+
let guardedBinding15Previous = null;
|
|
246
|
+
const guardedBinding15 = computed(() => {
|
|
247
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-center'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding15Previous;
|
|
248
|
+
const candidate = concat(base.value, "-center");
|
|
249
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding15Previous;
|
|
250
|
+
return guardedBinding15Previous = candidate;
|
|
251
|
+
});
|
|
252
|
+
let guardedBinding16Previous = null;
|
|
253
|
+
const guardedBinding16 = computed(() => {
|
|
254
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-wrap-left'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding16Previous;
|
|
255
|
+
const candidate = concat(base.value, "-wrap-left");
|
|
256
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding16Previous;
|
|
257
|
+
return guardedBinding16Previous = candidate;
|
|
258
|
+
});
|
|
259
|
+
let guardedBinding17Previous = null;
|
|
260
|
+
const guardedBinding17 = computed(() => {
|
|
261
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-wrap-right'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding17Previous;
|
|
262
|
+
const candidate = concat(base.value, "-wrap-right");
|
|
263
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding17Previous;
|
|
264
|
+
return guardedBinding17Previous = candidate;
|
|
265
|
+
});
|
|
266
|
+
let guardedBinding18Previous;
|
|
267
|
+
const guardedBinding18 = computed(() => {
|
|
268
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "$base:base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding18Previous;
|
|
269
|
+
return guardedBinding18Previous = base.value;
|
|
270
|
+
});
|
|
271
|
+
let guardedBinding19Previous = null;
|
|
272
|
+
const guardedBinding19 = computed(() => {
|
|
273
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-delete'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding19Previous;
|
|
274
|
+
const candidate = concat(base.value, "-delete");
|
|
275
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding19Previous;
|
|
276
|
+
return guardedBinding19Previous = candidate;
|
|
277
|
+
});
|
|
278
|
+
let guardedBinding20Previous;
|
|
279
|
+
const guardedBinding20 = computed(() => {
|
|
280
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "$base:base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding20Previous;
|
|
281
|
+
return guardedBinding20Previous = base.value;
|
|
282
|
+
});
|
|
283
|
+
let guardedBinding21Previous;
|
|
284
|
+
const guardedBinding21 = computed(() => {
|
|
285
|
+
if (!htmlNextAuthoredCheck2(describing.value == null || typeof describing.value === "boolean", "$describing:describing", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference describing does not satisfy its declared type.")) return guardedBinding21Previous;
|
|
286
|
+
return guardedBinding21Previous = describing.value;
|
|
287
|
+
});
|
|
288
|
+
let guardedBinding22Previous = null;
|
|
289
|
+
const guardedBinding22 = computed(() => {
|
|
290
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-alt'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding22Previous;
|
|
291
|
+
const candidate = concat(base.value, "-alt");
|
|
292
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding22Previous;
|
|
293
|
+
return guardedBinding22Previous = candidate;
|
|
294
|
+
});
|
|
295
|
+
let guardedBinding23Previous = null;
|
|
296
|
+
const guardedBinding23 = computed(() => {
|
|
297
|
+
if (!htmlNextAuthoredCheck2(base.value == null || typeof base.value === "string", "concat($base, '-alt'):base", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference base does not satisfy its declared type.")) return guardedBinding23Previous;
|
|
298
|
+
const candidate = concat(base.value, "-alt");
|
|
299
|
+
if (candidate === Symbol.for("html-next.invalid-result")) return guardedBinding23Previous;
|
|
300
|
+
return guardedBinding23Previous = candidate;
|
|
301
|
+
});
|
|
302
|
+
let guardedBinding24Previous;
|
|
303
|
+
const guardedBinding24 = computed(() => {
|
|
304
|
+
if (!htmlNextAuthoredCheck2(draft.value == null || typeof draft.value === "string", "$draft:draft", "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html: HR007: Reference draft does not satisfy its declared type.")) return guardedBinding24Previous;
|
|
305
|
+
return guardedBinding24Previous = draft.value;
|
|
306
|
+
});
|
|
307
|
+
provide("html-next:ui-editor-image-toolbar:base", base);
|
|
308
|
+
provide("html-next:ui-editor-image-toolbar:describing", describing);
|
|
309
|
+
provide("html-next:ui-editor-image-toolbar:draft", draft);
|
|
310
|
+
const hydrationNode = hydrationInstance?.vnode.el;
|
|
311
|
+
if (typeof window !== "undefined" && hydrationNode != null && (!(hydrationNode instanceof Element) || hydrationNode.localName !== "div")) throw Object.assign(/* @__PURE__ */ new Error("HR005: Server markup for <ui-editor-image-toolbar> has an incompatible root."), {
|
|
312
|
+
name: "HtmlDiagnosticError",
|
|
313
|
+
diagnostic: Object.freeze({
|
|
314
|
+
code: "HR005",
|
|
315
|
+
message: "Server markup for <ui-editor-image-toolbar> has an incompatible root."
|
|
316
|
+
})
|
|
317
|
+
});
|
|
318
|
+
const isPlacementDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && (detail["placement"] === "block" || detail["placement"] === "center" || detail["placement"] === "wrap-left" || detail["placement"] === "wrap-right") && Object.keys(detail).every((key) => ["placement"].includes(key));
|
|
319
|
+
const isDescribeDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["alt"] === "string" && Object.keys(detail).every((key) => ["alt"].includes(key));
|
|
320
|
+
const isDeleteDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && Object.values(detail).every((item) => true);
|
|
321
|
+
const dispatch = createDispatch(root, emit, {
|
|
322
|
+
checks: {
|
|
323
|
+
placement: isPlacementDetail,
|
|
324
|
+
describe: isDescribeDetail,
|
|
325
|
+
delete: isDeleteDetail
|
|
326
|
+
},
|
|
327
|
+
modeled: ["alt", "placement"]
|
|
328
|
+
});
|
|
329
|
+
useComponentHost(() => import("@threadlabs/looma/components/ui-editor-image-toolbar/ui-editor-image-toolbar.js"), {
|
|
330
|
+
root,
|
|
331
|
+
dispatch,
|
|
332
|
+
acceptsState: (name, keys, value) => acceptsControllerWrite(value, {
|
|
333
|
+
base: {
|
|
334
|
+
kind: "terminal",
|
|
335
|
+
name: "string"
|
|
336
|
+
},
|
|
337
|
+
describing: {
|
|
338
|
+
kind: "terminal",
|
|
339
|
+
name: "boolean"
|
|
340
|
+
},
|
|
341
|
+
draft: {
|
|
342
|
+
kind: "terminal",
|
|
343
|
+
name: "string"
|
|
344
|
+
}
|
|
345
|
+
}[name], keys),
|
|
346
|
+
controllerSource: {
|
|
347
|
+
specifier: "../components/ui-editor-image-toolbar/ui-editor-image-toolbar.js",
|
|
348
|
+
definition: "./components/ui-editor-image-toolbar/ui-editor-image-toolbar.html"
|
|
349
|
+
},
|
|
350
|
+
props: checkedProps,
|
|
351
|
+
propInputs: (name) => {
|
|
352
|
+
const incoming = hydrationInstance?.vnode.props;
|
|
353
|
+
const kebab = name.replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());
|
|
354
|
+
return incoming !== null && incoming !== void 0 ? incoming[name] ?? incoming[kebab] ?? null : null;
|
|
355
|
+
},
|
|
356
|
+
propNames: [
|
|
357
|
+
"alt",
|
|
358
|
+
"placement",
|
|
359
|
+
"target"
|
|
360
|
+
],
|
|
361
|
+
propValidity: (name) => propValidityState({
|
|
362
|
+
contract: propValidityContract,
|
|
363
|
+
values: { ...props }
|
|
364
|
+
}, name),
|
|
365
|
+
state: {
|
|
366
|
+
base,
|
|
367
|
+
describing,
|
|
368
|
+
draft
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
function concat(...values) {
|
|
372
|
+
if (values.some((value) => value === Symbol.for("html-next.invalid-result"))) return Symbol.for("html-next.invalid-result");
|
|
373
|
+
if (values.some((value) => value === void 0)) return void 0;
|
|
374
|
+
if (values.length === 0 || values.some((value) => typeof value === "object" && value !== null)) return Symbol.for("html-next.invalid-result");
|
|
375
|
+
return values.map((value) => value === null ? "" : String(value)).join("");
|
|
376
|
+
}
|
|
377
|
+
return (_ctx, _cache) => {
|
|
378
|
+
return withDirectives((openBlock(), createElementBlock("div", mergeProps({ "data-component": "ui-editor-image-toolbar" }, nativeAttrs(_ctx.$attrs), {
|
|
379
|
+
"data-alt": reflectedProp("alt", "alt", checkedProps.value.alt, void 0, false),
|
|
380
|
+
"data-placement": reflectedProp("placement", "placement", checkedProps.value.placement, void 0, false),
|
|
381
|
+
"data-target": reflectedProp("target", "target", checkedProps.value.target, void 0, false),
|
|
382
|
+
ref_key: "root",
|
|
383
|
+
ref: root
|
|
384
|
+
}), [createVNode(UiText_default, {
|
|
385
|
+
as: "div",
|
|
386
|
+
font: "sans"
|
|
387
|
+
}, {
|
|
388
|
+
default: withCtx(() => [
|
|
389
|
+
createVNode(UiEditorToolbar_default, {
|
|
390
|
+
"aria-label": "Image actions",
|
|
391
|
+
floating: true
|
|
392
|
+
}, {
|
|
393
|
+
default: withCtx(() => [
|
|
394
|
+
createVNode(UiIconButton_default, {
|
|
395
|
+
label: "Image in line",
|
|
396
|
+
size: "sm",
|
|
397
|
+
"data-image-placement": "block",
|
|
398
|
+
id: guarded.value,
|
|
399
|
+
variant: guardedBinding.value,
|
|
400
|
+
"aria-pressed": guardedBinding2.value
|
|
401
|
+
}, {
|
|
402
|
+
default: withCtx(() => [createVNode(UiIcon_default, {
|
|
403
|
+
name: "panel-top",
|
|
404
|
+
size: "sm"
|
|
405
|
+
})]),
|
|
406
|
+
_: 1
|
|
407
|
+
}, 8, [
|
|
408
|
+
"id",
|
|
409
|
+
"variant",
|
|
410
|
+
"aria-pressed"
|
|
411
|
+
]),
|
|
412
|
+
createVNode(UiIconButton_default, {
|
|
413
|
+
label: "Center image",
|
|
414
|
+
size: "sm",
|
|
415
|
+
"data-image-placement": "center",
|
|
416
|
+
id: guardedBinding3.value,
|
|
417
|
+
variant: guardedBinding4.value,
|
|
418
|
+
"aria-pressed": guardedBinding5.value
|
|
419
|
+
}, {
|
|
420
|
+
default: withCtx(() => [createVNode(UiIcon_default, {
|
|
421
|
+
name: "align-center",
|
|
422
|
+
size: "sm"
|
|
423
|
+
})]),
|
|
424
|
+
_: 1
|
|
425
|
+
}, 8, [
|
|
426
|
+
"id",
|
|
427
|
+
"variant",
|
|
428
|
+
"aria-pressed"
|
|
429
|
+
]),
|
|
430
|
+
createVNode(UiIconButton_default, {
|
|
431
|
+
label: "Wrap text to the right",
|
|
432
|
+
size: "sm",
|
|
433
|
+
"data-image-placement": "wrap-left",
|
|
434
|
+
id: guardedBinding6.value,
|
|
435
|
+
variant: guardedBinding7.value,
|
|
436
|
+
"aria-pressed": guardedBinding8.value
|
|
437
|
+
}, {
|
|
438
|
+
default: withCtx(() => [createVNode(UiIcon_default, {
|
|
439
|
+
name: "panel-left",
|
|
440
|
+
size: "sm"
|
|
441
|
+
})]),
|
|
442
|
+
_: 1
|
|
443
|
+
}, 8, [
|
|
444
|
+
"id",
|
|
445
|
+
"variant",
|
|
446
|
+
"aria-pressed"
|
|
447
|
+
]),
|
|
448
|
+
createVNode(UiIconButton_default, {
|
|
449
|
+
label: "Wrap text to the left",
|
|
450
|
+
size: "sm",
|
|
451
|
+
"data-image-placement": "wrap-right",
|
|
452
|
+
id: guardedBinding9.value,
|
|
453
|
+
variant: guardedBinding10.value,
|
|
454
|
+
"aria-pressed": guardedBinding11.value
|
|
455
|
+
}, {
|
|
456
|
+
default: withCtx(() => [createVNode(UiIcon_default, {
|
|
457
|
+
name: "panel-right",
|
|
458
|
+
size: "sm"
|
|
459
|
+
})]),
|
|
460
|
+
_: 1
|
|
461
|
+
}, 8, [
|
|
462
|
+
"id",
|
|
463
|
+
"variant",
|
|
464
|
+
"aria-pressed"
|
|
465
|
+
]),
|
|
466
|
+
createVNode(UiIconButton_default, {
|
|
467
|
+
label: "Image description",
|
|
468
|
+
size: "sm",
|
|
469
|
+
variant: "ghost",
|
|
470
|
+
id: guardedBinding12.value
|
|
471
|
+
}, {
|
|
472
|
+
default: withCtx(() => [createVNode(UiIcon_default, {
|
|
473
|
+
name: "file-text",
|
|
474
|
+
size: "sm"
|
|
475
|
+
})]),
|
|
476
|
+
_: 1
|
|
477
|
+
}, 8, ["id"]),
|
|
478
|
+
createVNode(UiIconButton_default, {
|
|
479
|
+
label: "Delete image",
|
|
480
|
+
size: "sm",
|
|
481
|
+
variant: "ghost",
|
|
482
|
+
"data-image-action": "delete",
|
|
483
|
+
id: guardedBinding13.value
|
|
484
|
+
}, {
|
|
485
|
+
default: withCtx(() => [createVNode(UiIcon_default, {
|
|
486
|
+
name: "trash",
|
|
487
|
+
size: "sm"
|
|
488
|
+
})]),
|
|
489
|
+
_: 1
|
|
490
|
+
}, 8, ["id"])
|
|
491
|
+
]),
|
|
492
|
+
_: 1
|
|
493
|
+
}),
|
|
494
|
+
createVNode(UiTooltip_default, { for: guardedBinding14.value }, {
|
|
495
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("Image in line", -1)])]),
|
|
496
|
+
_: 1
|
|
497
|
+
}, 8, ["for"]),
|
|
498
|
+
createVNode(UiTooltip_default, { for: guardedBinding15.value }, {
|
|
499
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("Center image", -1)])]),
|
|
500
|
+
_: 1
|
|
501
|
+
}, 8, ["for"]),
|
|
502
|
+
createVNode(UiTooltip_default, { for: guardedBinding16.value }, {
|
|
503
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("Wrap text to the right", -1)])]),
|
|
504
|
+
_: 1
|
|
505
|
+
}, 8, ["for"]),
|
|
506
|
+
createVNode(UiTooltip_default, { for: guardedBinding17.value }, {
|
|
507
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("Wrap text to the left", -1)])]),
|
|
508
|
+
_: 1
|
|
509
|
+
}, 8, ["for"]),
|
|
510
|
+
createVNode(UiTooltip_default, { for: guardedBinding18.value }, {
|
|
511
|
+
default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("Image description", -1)])]),
|
|
512
|
+
_: 1
|
|
513
|
+
}, 8, ["for"]),
|
|
514
|
+
createVNode(UiTooltip_default, { for: guardedBinding19.value }, {
|
|
515
|
+
default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("Delete image", -1)])]),
|
|
516
|
+
_: 1
|
|
517
|
+
}, 8, ["for"]),
|
|
518
|
+
createVNode(UiPopover_default, {
|
|
519
|
+
"data-image-description": "",
|
|
520
|
+
size: "sm",
|
|
521
|
+
"aria-label": "Image description",
|
|
522
|
+
for: guardedBinding20.value,
|
|
523
|
+
open: guardedBinding21.value
|
|
524
|
+
}, {
|
|
525
|
+
default: withCtx(() => [createElementVNode("form", _hoisted_2, [createVNode(UiStack_default, { gap: "s" }, {
|
|
526
|
+
default: withCtx(() => [
|
|
527
|
+
createVNode(UiFormField_default, null, {
|
|
528
|
+
default: withCtx(() => [createElementVNode("label", {
|
|
529
|
+
slot: "label",
|
|
530
|
+
for: guardedBinding22.value
|
|
531
|
+
}, "Alt text", 8, _hoisted_3), createVNode(UiInput_default, {
|
|
532
|
+
"data-image-alt": "",
|
|
533
|
+
size: "sm",
|
|
534
|
+
id: guardedBinding23.value,
|
|
535
|
+
value: guardedBinding24.value
|
|
536
|
+
}, null, 8, ["id", "value"])]),
|
|
537
|
+
_: 1
|
|
538
|
+
}),
|
|
539
|
+
createVNode(UiText_default, {
|
|
540
|
+
size: "xs",
|
|
541
|
+
tone: "secondary"
|
|
542
|
+
}, {
|
|
543
|
+
default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("Describe the image for people using a screen reader.", -1)])]),
|
|
544
|
+
_: 1
|
|
545
|
+
}),
|
|
546
|
+
createVNode(UiCluster_default, {
|
|
547
|
+
justify: "end",
|
|
548
|
+
gap: "xs"
|
|
549
|
+
}, {
|
|
550
|
+
default: withCtx(() => [createVNode(UiButton_default, {
|
|
551
|
+
type: "button",
|
|
552
|
+
variant: "ghost",
|
|
553
|
+
tone: "neutral",
|
|
554
|
+
size: "sm",
|
|
555
|
+
"data-image-action": "cancel"
|
|
556
|
+
}, {
|
|
557
|
+
default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("Cancel", -1)])]),
|
|
558
|
+
_: 1
|
|
559
|
+
}), createVNode(UiButton_default, {
|
|
560
|
+
type: "submit",
|
|
561
|
+
variant: "solid",
|
|
562
|
+
size: "sm"
|
|
563
|
+
}, {
|
|
564
|
+
default: withCtx(() => [..._cache[8] || (_cache[8] = [createTextVNode("Save", -1)])]),
|
|
565
|
+
_: 1
|
|
566
|
+
})]),
|
|
567
|
+
_: 1
|
|
568
|
+
})
|
|
569
|
+
]),
|
|
570
|
+
_: 1
|
|
571
|
+
})])]),
|
|
572
|
+
_: 1
|
|
573
|
+
}, 8, ["for", "open"])
|
|
574
|
+
]),
|
|
575
|
+
_: 1
|
|
576
|
+
})], 16, _hoisted_1)), [[unref(vPropValidity), {
|
|
577
|
+
contract: propValidityContract,
|
|
578
|
+
values: { ...props }
|
|
579
|
+
}]]);
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
//#endregion
|
|
584
|
+
export { UiEditorImageToolbar_default as t };
|