@getcortexlabs/mavis-web 0.1.0-rc.12 → 0.1.0-rc.12.1
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/README.md +4 -4
- package/dist/components/DateCalendar.d.ts +1 -1
- package/dist/components/MButton.d.ts +3 -3
- package/dist/components/MCard.d.ts +1 -1
- package/dist/components/MCombobox.d.ts +3 -3
- package/dist/components/MDatePicker.d.ts +16 -16
- package/dist/components/MDialog.d.ts +2 -2
- package/dist/components/MGrid.d.ts +1 -1
- package/dist/components/MImageCompare.d.ts +2 -2
- package/dist/components/MImageViewer.d.ts +5 -5
- package/dist/components/MInput.d.ts +2 -2
- package/dist/components/MPopover.d.ts +1 -1
- package/dist/components/MProgress.d.ts +1 -1
- package/dist/components/MRangeSlider.d.ts +1 -1
- package/dist/components/MResizablePanels.d.ts +3 -3
- package/dist/components/MSelect.d.ts +2 -2
- package/dist/components/MSeparator.d.ts +1 -1
- package/dist/components/MStack.d.ts +6 -6
- package/dist/components/MTimePicker.d.ts +8 -8
- package/dist/components/advanced.d.ts +852 -0
- package/dist/components/advanced.d.ts.map +1 -0
- package/dist/components/advanced.js +331 -0
- package/dist/components/advanced.js.map +1 -0
- package/dist/components/configurator.d.ts +6 -6
- package/dist/components/creative.d.ts +3 -3
- package/dist/components/dashboard.d.ts +5 -5
- package/dist/components/discovery.d.ts +1 -1
- package/dist/components/interactive.d.ts +1 -1
- package/dist/components/navigation.d.ts +3 -3
- package/dist/components/screen-components.d.ts +5 -5
- package/dist/components/wayfinding.d.ts +6 -6
- package/dist/components/workflows.d.ts +3 -3
- package/dist/image-crop.d.ts +3 -0
- package/dist/image-crop.d.ts.map +1 -0
- package/dist/image-crop.js +62 -0
- package/dist/image-crop.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/advanced.ts +387 -0
- package/src/image-crop.ts +57 -0
- package/src/index.ts +20 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
h,
|
|
4
|
+
mergeProps,
|
|
5
|
+
onMounted,
|
|
6
|
+
onBeforeUnmount,
|
|
7
|
+
onActivated,
|
|
8
|
+
onDeactivated,
|
|
9
|
+
ref,
|
|
10
|
+
watch,
|
|
11
|
+
type PropType,
|
|
12
|
+
} from 'vue'
|
|
13
|
+
import {
|
|
14
|
+
createTreeSelect,
|
|
15
|
+
createMasonry,
|
|
16
|
+
createHeatmap,
|
|
17
|
+
createNotificationCenter,
|
|
18
|
+
createImageCropper,
|
|
19
|
+
createScheduler,
|
|
20
|
+
advancedCanvasProps,
|
|
21
|
+
advancedCellProps,
|
|
22
|
+
advancedGestureProps,
|
|
23
|
+
type AdvancedGesture,
|
|
24
|
+
} from '@getcortexlabs/mavis-core/vue'
|
|
25
|
+
import { civilDate, type CropSource, type SchedulerClock } from '@getcortexlabs/mavis-core'
|
|
26
|
+
import type { MotionSurface } from '@getcortexlabs/mavis-core/experimental'
|
|
27
|
+
import { loadCropImage } from '../image-crop.js'
|
|
28
|
+
import { MBox, MColumn, MRow } from './layout.js'
|
|
29
|
+
import { MStack } from './MStack.js'
|
|
30
|
+
import { MCard } from './MCard.js'
|
|
31
|
+
import { MText } from './MText.js'
|
|
32
|
+
import { MButton } from './MButton.js'
|
|
33
|
+
import { MInput } from './MInput.js'
|
|
34
|
+
import { MImage } from './MImage.js'
|
|
35
|
+
import { MCheckbox } from './MCheckbox.js'
|
|
36
|
+
import { MSlider } from './MSlider.js'
|
|
37
|
+
import { MPopover } from './MPopover.js'
|
|
38
|
+
const Host = defineComponent({
|
|
39
|
+
inheritAttrs: false,
|
|
40
|
+
props: { label: String },
|
|
41
|
+
setup(props, { attrs, slots, expose }) {
|
|
42
|
+
const root = ref<HTMLElement>()
|
|
43
|
+
expose({
|
|
44
|
+
focus(id?: string) {
|
|
45
|
+
const el = id ? root.value?.ownerDocument.getElementById(id) : root.value
|
|
46
|
+
if (el && root.value?.contains(el)) el.focus({ preventScroll: true })
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
return () =>
|
|
50
|
+
h(
|
|
51
|
+
'section',
|
|
52
|
+
mergeProps(attrs, {
|
|
53
|
+
ref: root,
|
|
54
|
+
'aria-label': props.label,
|
|
55
|
+
tabindex: -1,
|
|
56
|
+
style: { minWidth: 0 },
|
|
57
|
+
}),
|
|
58
|
+
slots.default?.(),
|
|
59
|
+
)
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
function measured(cell: boolean) {
|
|
63
|
+
return defineComponent({
|
|
64
|
+
inheritAttrs: false,
|
|
65
|
+
props: { ...advancedCellProps, width: { type: Number, default: 0 } },
|
|
66
|
+
emits: ['width', 'height'],
|
|
67
|
+
setup(props, { attrs, slots, emit }) {
|
|
68
|
+
const root = ref<HTMLElement>()
|
|
69
|
+
let observer: ResizeObserver | undefined,
|
|
70
|
+
last = -1,
|
|
71
|
+
frame = 0
|
|
72
|
+
function measure() {
|
|
73
|
+
const el = root.value
|
|
74
|
+
if (!el) return
|
|
75
|
+
if (cell && !props.measure) return
|
|
76
|
+
const v = cell ? el.offsetHeight : el.clientWidth
|
|
77
|
+
if (Math.abs(v - last) > 0.5) {
|
|
78
|
+
last = v
|
|
79
|
+
emit(cell ? 'height' : 'width', v)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function detach() {
|
|
83
|
+
cancelAnimationFrame(frame)
|
|
84
|
+
frame = 0
|
|
85
|
+
observer?.disconnect()
|
|
86
|
+
observer = undefined
|
|
87
|
+
}
|
|
88
|
+
function schedule() {
|
|
89
|
+
if (!frame)
|
|
90
|
+
frame = requestAnimationFrame(() => {
|
|
91
|
+
frame = 0
|
|
92
|
+
measure()
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
function attach() {
|
|
96
|
+
detach()
|
|
97
|
+
if (!root.value) return
|
|
98
|
+
if (cell && !props.measure) return
|
|
99
|
+
observer = new ResizeObserver(schedule)
|
|
100
|
+
observer.observe(root.value)
|
|
101
|
+
schedule()
|
|
102
|
+
}
|
|
103
|
+
onMounted(attach)
|
|
104
|
+
onActivated(attach)
|
|
105
|
+
onDeactivated(detach)
|
|
106
|
+
onBeforeUnmount(detach)
|
|
107
|
+
return () =>
|
|
108
|
+
cell
|
|
109
|
+
? h(
|
|
110
|
+
'div',
|
|
111
|
+
mergeProps(attrs, {
|
|
112
|
+
style: {
|
|
113
|
+
position: 'absolute',
|
|
114
|
+
left: `${props.x}px`,
|
|
115
|
+
top: `${props.y}px`,
|
|
116
|
+
width: `${props.width}px`,
|
|
117
|
+
height: props.height === undefined ? undefined : `${props.height}px`,
|
|
118
|
+
},
|
|
119
|
+
}),
|
|
120
|
+
h(
|
|
121
|
+
MBox,
|
|
122
|
+
{ width: '100%', height: props.height === undefined ? undefined : '100%' },
|
|
123
|
+
() =>
|
|
124
|
+
h(
|
|
125
|
+
'div',
|
|
126
|
+
{
|
|
127
|
+
ref: root,
|
|
128
|
+
style: {
|
|
129
|
+
display: 'flow-root',
|
|
130
|
+
height: props.height === undefined ? undefined : '100%',
|
|
131
|
+
minWidth: 0,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
slots.default?.(),
|
|
135
|
+
),
|
|
136
|
+
),
|
|
137
|
+
)
|
|
138
|
+
: h(
|
|
139
|
+
'div',
|
|
140
|
+
mergeProps(attrs, { ref: root, style: { minWidth: 0, width: '100%' } }),
|
|
141
|
+
slots.default?.(),
|
|
142
|
+
)
|
|
143
|
+
},
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
const Measure = measured(false),
|
|
147
|
+
Cell = measured(true)
|
|
148
|
+
const Canvas = defineComponent({
|
|
149
|
+
props: advancedCanvasProps,
|
|
150
|
+
setup(props, { slots }) {
|
|
151
|
+
return () =>
|
|
152
|
+
h(
|
|
153
|
+
'div',
|
|
154
|
+
{
|
|
155
|
+
style: {
|
|
156
|
+
position: 'relative',
|
|
157
|
+
height: `${props.height}px`,
|
|
158
|
+
width: props.width === undefined ? '100%' : `${props.width}px`,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
slots.default?.(),
|
|
162
|
+
)
|
|
163
|
+
},
|
|
164
|
+
})
|
|
165
|
+
const Scroll = defineComponent({
|
|
166
|
+
setup(_, { slots }) {
|
|
167
|
+
return () =>
|
|
168
|
+
h('div', { style: { overflowX: 'auto', minWidth: 0, maxWidth: '100%' } }, slots.default?.())
|
|
169
|
+
},
|
|
170
|
+
})
|
|
171
|
+
const Gesture = defineComponent({
|
|
172
|
+
inheritAttrs: false,
|
|
173
|
+
props: advancedGestureProps,
|
|
174
|
+
emits: ['gesture', 'step'],
|
|
175
|
+
setup(props, { attrs, slots, emit }) {
|
|
176
|
+
const root = ref<HTMLElement>()
|
|
177
|
+
const points = new Map<number, { x: number; y: number }>()
|
|
178
|
+
let origin = { x: 0, y: 0 },
|
|
179
|
+
distance = 0,
|
|
180
|
+
last = { x: 0, y: 0, scale: 1 },
|
|
181
|
+
active = false
|
|
182
|
+
function metrics() {
|
|
183
|
+
const values = [...points.values()]
|
|
184
|
+
return {
|
|
185
|
+
x: values.reduce((a, p) => a + p.x, 0) / values.length,
|
|
186
|
+
y: values.reduce((a, p) => a + p.y, 0) / values.length,
|
|
187
|
+
distance:
|
|
188
|
+
values.length === 2
|
|
189
|
+
? Math.hypot(values[0]!.x - values[1]!.x, values[0]!.y - values[1]!.y)
|
|
190
|
+
: 0,
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function send(phase: AdvancedGesture['phase']) {
|
|
194
|
+
emit('gesture', { phase, ...last })
|
|
195
|
+
}
|
|
196
|
+
function clear(cancel = true) {
|
|
197
|
+
if (active) {
|
|
198
|
+
active = false
|
|
199
|
+
send(cancel ? 'cancel' : 'end')
|
|
200
|
+
}
|
|
201
|
+
for (const id of points.keys()) {
|
|
202
|
+
if (root.value?.hasPointerCapture(id)) root.value.releasePointerCapture(id)
|
|
203
|
+
}
|
|
204
|
+
points.clear()
|
|
205
|
+
distance = 0
|
|
206
|
+
last = { x: 0, y: 0, scale: 1 }
|
|
207
|
+
}
|
|
208
|
+
function down(e: PointerEvent) {
|
|
209
|
+
if (props.disabled || e.button !== 0 || points.size >= 2) return
|
|
210
|
+
e.preventDefault()
|
|
211
|
+
root.value?.focus({ preventScroll: true })
|
|
212
|
+
points.set(e.pointerId, { x: e.clientX, y: e.clientY })
|
|
213
|
+
root.value?.setPointerCapture(e.pointerId)
|
|
214
|
+
const m = metrics()
|
|
215
|
+
origin = { x: m.x - last.x, y: m.y - last.y }
|
|
216
|
+
distance = m.distance / last.scale
|
|
217
|
+
if (!active) {
|
|
218
|
+
active = true
|
|
219
|
+
send('start')
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function move(e: PointerEvent) {
|
|
223
|
+
if (!points.has(e.pointerId)) return
|
|
224
|
+
points.set(e.pointerId, { x: e.clientX, y: e.clientY })
|
|
225
|
+
const m = metrics()
|
|
226
|
+
last = {
|
|
227
|
+
x: m.x - origin.x,
|
|
228
|
+
y: m.y - origin.y,
|
|
229
|
+
scale: distance && m.distance ? m.distance / distance : last.scale,
|
|
230
|
+
}
|
|
231
|
+
send('move')
|
|
232
|
+
}
|
|
233
|
+
function up(e: PointerEvent) {
|
|
234
|
+
if (!points.has(e.pointerId)) return
|
|
235
|
+
if (points.size === 1) {
|
|
236
|
+
clear(false)
|
|
237
|
+
return
|
|
238
|
+
}
|
|
239
|
+
points.delete(e.pointerId)
|
|
240
|
+
if (root.value?.hasPointerCapture(e.pointerId)) root.value.releasePointerCapture(e.pointerId)
|
|
241
|
+
const m = metrics()
|
|
242
|
+
origin = { x: m.x - last.x, y: m.y - last.y }
|
|
243
|
+
distance = 0
|
|
244
|
+
}
|
|
245
|
+
function cancel() {
|
|
246
|
+
clear()
|
|
247
|
+
}
|
|
248
|
+
function attach() {
|
|
249
|
+
window.addEventListener('resize', cancel)
|
|
250
|
+
window.addEventListener('blur', cancel)
|
|
251
|
+
window.addEventListener('scroll', cancel, true)
|
|
252
|
+
}
|
|
253
|
+
function detach() {
|
|
254
|
+
cancel()
|
|
255
|
+
window.removeEventListener('resize', cancel)
|
|
256
|
+
window.removeEventListener('blur', cancel)
|
|
257
|
+
window.removeEventListener('scroll', cancel, true)
|
|
258
|
+
}
|
|
259
|
+
onMounted(attach)
|
|
260
|
+
onActivated(attach)
|
|
261
|
+
onDeactivated(detach)
|
|
262
|
+
onBeforeUnmount(detach)
|
|
263
|
+
watch(() => props.disabled, cancel)
|
|
264
|
+
return () =>
|
|
265
|
+
h(
|
|
266
|
+
'div',
|
|
267
|
+
mergeProps(attrs, {
|
|
268
|
+
ref: root,
|
|
269
|
+
role: 'group',
|
|
270
|
+
'aria-label': props.label,
|
|
271
|
+
'aria-disabled': props.disabled || undefined,
|
|
272
|
+
tabindex: props.disabled ? -1 : 0,
|
|
273
|
+
style: {
|
|
274
|
+
touchAction: props.disabled ? 'auto' : 'none',
|
|
275
|
+
cursor: props.disabled ? 'default' : 'grab',
|
|
276
|
+
userSelect: 'none',
|
|
277
|
+
},
|
|
278
|
+
onPointerdown: down,
|
|
279
|
+
onPointermove: move,
|
|
280
|
+
onPointerup: up,
|
|
281
|
+
onPointercancel: cancel,
|
|
282
|
+
onLostpointercapture: (e: PointerEvent) => {
|
|
283
|
+
if (points.has(e.pointerId)) cancel()
|
|
284
|
+
},
|
|
285
|
+
onKeydown: (e: KeyboardEvent) => {
|
|
286
|
+
if (e.key === 'Escape') {
|
|
287
|
+
e.preventDefault()
|
|
288
|
+
cancel()
|
|
289
|
+
}
|
|
290
|
+
if (props.disabled) return
|
|
291
|
+
const d: Record<string, [number, number]> = {
|
|
292
|
+
ArrowLeft: [-1, 0],
|
|
293
|
+
ArrowRight: [1, 0],
|
|
294
|
+
ArrowUp: [0, -1],
|
|
295
|
+
ArrowDown: [0, 1],
|
|
296
|
+
}
|
|
297
|
+
if (d[e.key]) {
|
|
298
|
+
e.preventDefault()
|
|
299
|
+
emit('step', { x: d[e.key]![0], y: d[e.key]![1] })
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
}),
|
|
303
|
+
slots.default?.(),
|
|
304
|
+
)
|
|
305
|
+
},
|
|
306
|
+
})
|
|
307
|
+
const CropPreview = defineComponent({
|
|
308
|
+
props: {
|
|
309
|
+
source: { type: Object as PropType<CropSource>, required: true },
|
|
310
|
+
width: Number,
|
|
311
|
+
height: Number,
|
|
312
|
+
motionSurface: Object as PropType<MotionSurface>,
|
|
313
|
+
},
|
|
314
|
+
setup(props) {
|
|
315
|
+
return () =>
|
|
316
|
+
h(
|
|
317
|
+
MBox,
|
|
318
|
+
{
|
|
319
|
+
width: props.width,
|
|
320
|
+
height: props.height,
|
|
321
|
+
motionSurface: props.motionSurface,
|
|
322
|
+
style: { position: 'absolute', left: 0, top: 0, pointerEvents: 'none' },
|
|
323
|
+
},
|
|
324
|
+
() =>
|
|
325
|
+
h('img', {
|
|
326
|
+
src: props.source!.preview,
|
|
327
|
+
alt: '',
|
|
328
|
+
draggable: false,
|
|
329
|
+
width: props.width,
|
|
330
|
+
height: props.height,
|
|
331
|
+
style: { display: 'block', maxWidth: 'none', width: '100%', height: '100%' },
|
|
332
|
+
}),
|
|
333
|
+
)
|
|
334
|
+
},
|
|
335
|
+
})
|
|
336
|
+
const formats = new Map<string, Intl.DateTimeFormat>()
|
|
337
|
+
export const schedulerClock: SchedulerClock = {
|
|
338
|
+
parts(instant, timeZone) {
|
|
339
|
+
let format = formats.get(timeZone)
|
|
340
|
+
if (!format) {
|
|
341
|
+
format = new Intl.DateTimeFormat('en-CA', {
|
|
342
|
+
timeZone,
|
|
343
|
+
year: 'numeric',
|
|
344
|
+
month: '2-digit',
|
|
345
|
+
day: '2-digit',
|
|
346
|
+
hour: '2-digit',
|
|
347
|
+
minute: '2-digit',
|
|
348
|
+
hourCycle: 'h23',
|
|
349
|
+
})
|
|
350
|
+
if (formats.size >= 32) formats.clear()
|
|
351
|
+
formats.set(timeZone, format)
|
|
352
|
+
}
|
|
353
|
+
const parts = Object.fromEntries(format.formatToParts(instant).map((p) => [p.type, p.value]))
|
|
354
|
+
return {
|
|
355
|
+
date: civilDate(`${parts.year!.padStart(4, '0')}-${parts.month}-${parts.day}`),
|
|
356
|
+
minute: Number(parts.hour) * 60 + Number(parts.minute),
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
}
|
|
360
|
+
const ui = {
|
|
361
|
+
Box: MBox,
|
|
362
|
+
Column: MColumn,
|
|
363
|
+
Row: MRow,
|
|
364
|
+
Stack: MStack,
|
|
365
|
+
Card: MCard,
|
|
366
|
+
Text: MText,
|
|
367
|
+
Button: MButton,
|
|
368
|
+
Input: MInput,
|
|
369
|
+
Image: MImage,
|
|
370
|
+
Checkbox: MCheckbox,
|
|
371
|
+
Slider: MSlider,
|
|
372
|
+
Popover: MPopover,
|
|
373
|
+
Segmented: MBox,
|
|
374
|
+
Host,
|
|
375
|
+
Measure,
|
|
376
|
+
Cell,
|
|
377
|
+
Canvas,
|
|
378
|
+
Scroll,
|
|
379
|
+
Gesture,
|
|
380
|
+
CropPreview,
|
|
381
|
+
}
|
|
382
|
+
export const MTreeSelect = createTreeSelect(ui, 'web')
|
|
383
|
+
export const MMasonry = createMasonry(ui, 'web')
|
|
384
|
+
export const MHeatmap = createHeatmap(ui, 'web')
|
|
385
|
+
export const MNotificationCenter = createNotificationCenter(ui, 'web')
|
|
386
|
+
export const MImageCropper = createImageCropper(ui, 'web', loadCropImage)
|
|
387
|
+
export const MScheduler = createScheduler(ui, 'web', schedulerClock)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { cropOutputSize, validateImageCrop, type CropSource } from '@getcortexlabs/mavis-core'
|
|
2
|
+
export async function loadCropImage(src: string): Promise<CropSource> {
|
|
3
|
+
const image = new Image()
|
|
4
|
+
image.crossOrigin = 'anonymous'
|
|
5
|
+
image.src = src
|
|
6
|
+
await image.decode()
|
|
7
|
+
const width = image.naturalWidth,
|
|
8
|
+
height = image.naturalHeight
|
|
9
|
+
if (!width || !height || width * height > 40000000) {
|
|
10
|
+
image.src = ''
|
|
11
|
+
throw new RangeError('ImageCropper needs an image of at most 40 megapixels.')
|
|
12
|
+
}
|
|
13
|
+
let disposed = false
|
|
14
|
+
return {
|
|
15
|
+
width,
|
|
16
|
+
height,
|
|
17
|
+
preview: src,
|
|
18
|
+
dispose() {
|
|
19
|
+
disposed = true
|
|
20
|
+
image.src = ''
|
|
21
|
+
},
|
|
22
|
+
async export(crop, options) {
|
|
23
|
+
if (disposed) throw new Error('Image source has been released.')
|
|
24
|
+
validateImageCrop({ width, height }, crop)
|
|
25
|
+
const size = cropOutputSize(crop, options)
|
|
26
|
+
const canvas = document.createElement('canvas')
|
|
27
|
+
canvas.width = size.width
|
|
28
|
+
canvas.height = size.height
|
|
29
|
+
const ctx = canvas.getContext('2d')
|
|
30
|
+
if (!ctx) throw new Error('Canvas image export is unavailable.')
|
|
31
|
+
try {
|
|
32
|
+
if (options.mimeType === 'image/jpeg') {
|
|
33
|
+
ctx.fillStyle = '#FFFFFF'
|
|
34
|
+
ctx.fillRect(0, 0, size.width, size.height)
|
|
35
|
+
}
|
|
36
|
+
ctx.scale(size.width / crop.width, size.height / crop.height)
|
|
37
|
+
ctx.translate(-crop.x, -crop.y)
|
|
38
|
+
if (crop.rotation === 90) ctx.translate(height, 0)
|
|
39
|
+
if (crop.rotation === 180) ctx.translate(width, height)
|
|
40
|
+
if (crop.rotation === 270) ctx.translate(0, width)
|
|
41
|
+
ctx.rotate((crop.rotation * Math.PI) / 180)
|
|
42
|
+
ctx.drawImage(image, 0, 0)
|
|
43
|
+
const uri = canvas.toDataURL(options.mimeType, options.quality)
|
|
44
|
+
if (!uri.startsWith(`data:${options.mimeType};`))
|
|
45
|
+
throw new Error('Requested image encoding is unavailable.')
|
|
46
|
+
return { ...size, uri, mimeType: options.mimeType, async dispose() {} }
|
|
47
|
+
} catch (error) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`Image export failed. Remote images must allow CORS. ${error instanceof Error ? error.message : String(error)}`,
|
|
50
|
+
)
|
|
51
|
+
} finally {
|
|
52
|
+
canvas.width = 0
|
|
53
|
+
canvas.height = 0
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MTreeSelect,
|
|
3
|
+
MMasonry,
|
|
4
|
+
MHeatmap,
|
|
5
|
+
MImageCropper,
|
|
6
|
+
MScheduler,
|
|
7
|
+
MNotificationCenter,
|
|
8
|
+
} from './components/advanced.js'
|
|
1
9
|
import {
|
|
2
10
|
MKanban,
|
|
3
11
|
MDonutChart,
|
|
@@ -90,6 +98,12 @@ import { MReveal } from './components/MReveal.js'
|
|
|
90
98
|
import { MSheet } from './components/MSheet.js'
|
|
91
99
|
|
|
92
100
|
export {
|
|
101
|
+
MTreeSelect,
|
|
102
|
+
MMasonry,
|
|
103
|
+
MHeatmap,
|
|
104
|
+
MImageCropper,
|
|
105
|
+
MScheduler,
|
|
106
|
+
MNotificationCenter,
|
|
93
107
|
MKanban,
|
|
94
108
|
MDonutChart,
|
|
95
109
|
MSparkline,
|
|
@@ -214,6 +228,12 @@ export function createMavis(options: MavisOptions = {}) {
|
|
|
214
228
|
if (components === false) return
|
|
215
229
|
for (const [name, component] of Object.entries(
|
|
216
230
|
components ?? {
|
|
231
|
+
MTreeSelect,
|
|
232
|
+
MMasonry,
|
|
233
|
+
MHeatmap,
|
|
234
|
+
MImageCropper,
|
|
235
|
+
MScheduler,
|
|
236
|
+
MNotificationCenter,
|
|
217
237
|
MKanban,
|
|
218
238
|
MDonutChart,
|
|
219
239
|
MSparkline,
|