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