@m3ui-vue/m3ui-vue 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/API.md +2914 -348
- package/dist/MButton-CuNzpoxm.js +172 -0
- package/dist/MButton-CuNzpoxm.js.map +1 -0
- package/dist/MDialog-HxEL-m58.js +173 -0
- package/dist/MDialog-HxEL-m58.js.map +1 -0
- package/dist/MIconButton-DoNotQ9v.js +282 -0
- package/dist/MIconButton-DoNotQ9v.js.map +1 -0
- package/dist/MListItem-DnPtv-hY.js +824 -0
- package/dist/MListItem-DnPtv-hY.js.map +1 -0
- package/dist/MLoadingIndicator-BQMNX6Dx.js +115 -0
- package/dist/MLoadingIndicator-BQMNX6Dx.js.map +1 -0
- package/dist/MMenuItem-Bih0h4-n.js +604 -0
- package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
- package/dist/MProgressBar-BCoruxA-.js +184 -0
- package/dist/MProgressBar-BCoruxA-.js.map +1 -0
- package/dist/MSeekBar-LURE1Ah7.js +435 -0
- package/dist/MSeekBar-LURE1Ah7.js.map +1 -0
- package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
- package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
- package/dist/MSlider-_J4IS2_z.js +691 -0
- package/dist/MSlider-_J4IS2_z.js.map +1 -0
- package/dist/MSpinner-BhkMYKOM.js +65 -0
- package/dist/MSpinner-BhkMYKOM.js.map +1 -0
- package/dist/MTextField-CkzwNBWS.js +296 -0
- package/dist/MTextField-CkzwNBWS.js.map +1 -0
- package/dist/MTooltip-B67ZDSGp.js +756 -0
- package/dist/MTooltip-B67ZDSGp.js.map +1 -0
- package/dist/_storageKeys-CYXsUBwK.js +18 -0
- package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
- package/dist/_useEscapeStack-CjndQhqg.js +19 -0
- package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +115 -0
- package/dist/components/MBadge.vue.d.ts +1 -1
- package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
- package/dist/components/MBox.vue.d.ts +1 -1
- package/dist/components/MButton.vue.d.ts +1 -1
- package/dist/components/MConfirmDialog.vue.d.ts +1 -1
- package/dist/components/MCopyButton.vue.d.ts +2 -2
- package/dist/components/MDataTable.vue.d.ts +2 -2
- package/dist/components/MDialog.vue.d.ts +2 -2
- package/dist/components/MDivider.vue.d.ts +1 -1
- package/dist/components/MDragHandle.vue.d.ts +1 -1
- package/dist/components/MDrawCanvas.vue.d.ts +148 -0
- package/dist/components/MDrawLayers.vue.d.ts +3 -0
- package/dist/components/MDrawToolbar.vue.d.ts +34 -0
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MFabMenu.vue.d.ts +2 -2
- package/dist/components/MFixed.vue.d.ts +1 -1
- package/dist/components/MFlex.vue.d.ts +2 -2
- package/dist/components/MFloorPlan.vue.d.ts +160 -0
- package/dist/components/MFlow.vue.d.ts +305 -0
- package/dist/components/MFlowControls.vue.d.ts +33 -0
- package/dist/components/MFlowHandle.vue.d.ts +16 -0
- package/dist/components/MFlowMinimap.vue.d.ts +22 -0
- package/dist/components/MFlowNode.vue.d.ts +35 -0
- package/dist/components/MGantt.vue.d.ts +141 -0
- package/dist/components/MGanttControls.vue.d.ts +32 -0
- package/dist/components/MIconButton.vue.d.ts +3 -1
- package/dist/components/MImageCropper.vue.d.ts +110 -0
- package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
- package/dist/components/MLightbox.vue.d.ts +2 -2
- package/dist/components/MList.vue.d.ts +1 -1
- package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
- package/dist/components/MMap.vue.d.ts +1 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MMapSearch.vue.d.ts +1 -1
- package/dist/components/MMaskField.vue.d.ts +12 -1
- package/dist/components/MMenu.vue.d.ts +1 -1
- package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +11 -2
- package/dist/components/MPdfViewer.vue.d.ts +174 -0
- package/dist/components/MPullToRefresh.vue.d.ts +1 -1
- package/dist/components/MResourceTimeline.vue.d.ts +149 -0
- package/dist/components/MScheduler.vue.d.ts +3 -3
- package/dist/components/MScheme.vue.d.ts +1 -1
- package/dist/components/MSearchField.vue.d.ts +1 -1
- package/dist/components/MSeekBar.vue.d.ts +1 -1
- package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
- package/dist/components/MSkeleton.vue.d.ts +1 -1
- package/dist/components/MSlider.vue.d.ts +4 -4
- package/dist/components/MSparkline.vue.d.ts +1 -1
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MStack.vue.d.ts +2 -2
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +12 -1
- package/dist/components/MTextField.vue.d.ts +13 -2
- package/dist/components/MToolbar.vue.d.ts +1 -1
- package/dist/components/MTree.vue.d.ts +2 -2
- package/dist/components/MVideoPlayer.vue.d.ts +253 -0
- package/dist/components/MVirtualTable.vue.d.ts +1 -1
- package/dist/components/MWindow.vue.d.ts +3 -3
- package/dist/components/_MFlowEdge.vue.d.ts +9 -0
- package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
- package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
- package/dist/components/_MPdfPage.vue.d.ts +76 -0
- package/dist/components/_MTimeBackground.vue.d.ts +14 -0
- package/dist/components/_MTimeHeader.vue.d.ts +20 -0
- package/dist/composables/_effectCanvas.d.ts +23 -0
- package/dist/composables/_flowPanel.d.ts +2 -0
- package/dist/composables/_flowSlot.d.ts +5 -0
- package/dist/composables/_ganttTime.d.ts +41 -0
- package/dist/composables/_storageKeys.d.ts +9 -0
- package/dist/composables/_useTimeAxis.d.ts +90 -0
- package/dist/composables/drawGeometry.d.ts +119 -0
- package/dist/composables/flowFormats.d.ts +79 -0
- package/dist/composables/flowLayout.d.ts +45 -0
- package/dist/composables/flowPaths.d.ts +53 -0
- package/dist/composables/ganttFormats.d.ts +52 -0
- package/dist/composables/ganttSchedule.d.ts +99 -0
- package/dist/composables/themeInitScript.d.ts +2 -0
- package/dist/composables/useConfetti.d.ts +19 -8
- package/dist/composables/useDrawing.d.ts +44 -0
- package/dist/composables/useFireworks.d.ts +37 -0
- package/dist/composables/useFlow.d.ts +266 -0
- package/dist/composables/useGantt.d.ts +87 -0
- package/dist/composables/useLocale.d.ts +163 -0
- package/dist/composables/useMediaPlayer.d.ts +101 -0
- package/dist/composables/usePdf.d.ts +119 -0
- package/dist/composables/useReactions.d.ts +32 -0
- package/dist/composables/useResourceTimeline.d.ts +70 -0
- package/dist/composables/viewportHints.d.ts +2 -0
- package/dist/directives/vSparkle.d.ts +27 -0
- package/dist/draw.d.ts +7 -0
- package/dist/draw.js +1700 -0
- package/dist/draw.js.map +1 -0
- package/dist/flow.d.ts +14 -0
- package/dist/flow.js +3542 -0
- package/dist/flow.js.map +1 -0
- package/dist/flowPaths-CUc6X373.js +161 -0
- package/dist/flowPaths-CUc6X373.js.map +1 -0
- package/dist/gantt.d.ts +12 -0
- package/dist/gantt.js +3575 -0
- package/dist/gantt.js.map +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/locales/index.js +1148 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7822 -7809
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +593 -588
- package/dist/map.js.map +1 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.js +1311 -0
- package/dist/media.js.map +1 -0
- package/dist/pdf.d.ts +4 -0
- package/dist/pdf.js +1871 -0
- package/dist/pdf.js.map +1 -0
- package/dist/plugin.d.ts +10 -0
- package/dist/rich-text-editor.js +28 -26
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-JYxDDeXC.js → useLocale-BpGxplLV.js} +165 -2
- package/dist/useLocale-BpGxplLV.js.map +1 -0
- package/dist/{useThemeTokens-Bv-Uv8eX.js → useThemeTokens-DQQcaWbE.js} +41 -40
- package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
- package/package.json +29 -5
- package/src/__tests__/MAudioPlayer.test.ts +75 -0
- package/src/__tests__/MDrawCanvas.test.ts +110 -0
- package/src/__tests__/MFloorPlan.test.ts +97 -0
- package/src/__tests__/MFlow.test.ts +575 -0
- package/src/__tests__/MGantt.test.ts +130 -0
- package/src/__tests__/MImageCropper.test.ts +89 -0
- package/src/__tests__/MPdfViewer.test.ts +235 -0
- package/src/__tests__/MResourceTimeline.test.ts +102 -0
- package/src/__tests__/MSlider.test.ts +36 -0
- package/src/__tests__/MVideoPlayer.test.ts +201 -0
- package/src/__tests__/drawGeometry.test.ts +58 -0
- package/src/__tests__/fieldExpose.test.ts +30 -0
- package/src/__tests__/flowFormats.test.ts +185 -0
- package/src/__tests__/flowLayout.test.ts +113 -0
- package/src/__tests__/ganttFormats.test.ts +76 -0
- package/src/__tests__/ganttSchedule.test.ts +136 -0
- package/src/__tests__/pdfMock.ts +83 -0
- package/src/__tests__/plugin.test.ts +56 -1
- package/src/__tests__/ssr.test.ts +1 -1
- package/src/__tests__/themeInitScript.test.ts +10 -0
- package/src/__tests__/useConfetti.test.ts +33 -2
- package/src/__tests__/useFireworks.test.ts +104 -0
- package/src/__tests__/useMediaPlayer.test.ts +182 -0
- package/src/__tests__/usePdf.test.ts +102 -0
- package/src/__tests__/useReactions.test.ts +51 -0
- package/src/__tests__/vSparkle.test.ts +83 -0
- package/src/components/MAudioPlayer.vue +319 -0
- package/src/components/MDrawCanvas.vue +813 -0
- package/src/components/MDrawLayers.vue +114 -0
- package/src/components/MDrawToolbar.vue +171 -0
- package/src/components/MEmojiSelector.vue +3 -2
- package/src/components/MFloorPlan.vue +581 -0
- package/src/components/MFlow.vue +2049 -0
- package/src/components/MFlowControls.vue +110 -0
- package/src/components/MFlowHandle.vue +60 -0
- package/src/components/MFlowMinimap.vue +134 -0
- package/src/components/MFlowNode.vue +98 -0
- package/src/components/MGantt.vue +1609 -0
- package/src/components/MGanttControls.vue +77 -0
- package/src/components/MIconButton.vue +3 -1
- package/src/components/MImageCropper.vue +507 -0
- package/src/components/MMap.vue +3 -2
- package/src/components/MMaskField.vue +13 -0
- package/src/components/MNumberField.vue +13 -0
- package/src/components/MPdfViewer.vue +1269 -0
- package/src/components/MResourceTimeline.vue +1020 -0
- package/src/components/MSlider.vue +22 -4
- package/src/components/MTagInput.vue +13 -0
- package/src/components/MTextField.vue +24 -4
- package/src/components/MVideoPlayer.vue +839 -0
- package/src/components/_MFlowEdge.vue +100 -0
- package/src/components/_MFlowEdgeLabel.vue +56 -0
- package/src/components/_MFlowNodeShell.vue +111 -0
- package/src/components/_MPdfPage.vue +456 -0
- package/src/components/_MTimeBackground.vue +16 -0
- package/src/components/_MTimeHeader.vue +31 -0
- package/src/composables/_colorUtils.ts +4 -2
- package/src/composables/_effectCanvas.ts +109 -0
- package/src/composables/_flowPanel.ts +13 -0
- package/src/composables/_flowSlot.ts +6 -0
- package/src/composables/_ganttTime.ts +200 -0
- package/src/composables/_ssrState.ts +2 -2
- package/src/composables/_storageKeys.ts +28 -0
- package/src/composables/_useTimeAxis.ts +224 -0
- package/src/composables/drawGeometry.ts +405 -0
- package/src/composables/flowFormats.ts +916 -0
- package/src/composables/flowLayout.ts +297 -0
- package/src/composables/flowPaths.ts +239 -0
- package/src/composables/ganttFormats.ts +366 -0
- package/src/composables/ganttSchedule.ts +403 -0
- package/src/composables/themeInitScript.ts +5 -2
- package/src/composables/useColorPalette.ts +36 -8
- package/src/composables/useConfetti.ts +84 -107
- package/src/composables/useDrawing.ts +53 -0
- package/src/composables/useFireworks.ts +360 -0
- package/src/composables/useFlow.ts +250 -0
- package/src/composables/useGantt.ts +92 -0
- package/src/composables/useLocale.ts +328 -0
- package/src/composables/useMediaPlayer.ts +406 -0
- package/src/composables/usePdf.ts +456 -0
- package/src/composables/useReactions.ts +131 -0
- package/src/composables/useResourceTimeline.ts +76 -0
- package/src/composables/useTheme.ts +21 -4
- package/src/composables/viewportHints.ts +6 -5
- package/src/directives/vSparkle.ts +180 -0
- package/src/draw.ts +25 -0
- package/src/flow.ts +26 -0
- package/src/gantt.ts +12 -0
- package/src/index.ts +11 -1
- package/src/locales/de.ts +163 -0
- package/src/locales/es.ts +163 -0
- package/src/locales/fr.ts +163 -0
- package/src/locales/ja.ts +163 -0
- package/src/locales/ko.ts +163 -0
- package/src/locales/pt.ts +163 -0
- package/src/locales/zh.ts +163 -0
- package/src/media.ts +5 -0
- package/src/pdf.ts +15 -0
- package/src/plugin.ts +21 -5
- package/dist/MMenuItem-DI351kIf.js +0 -929
- package/dist/MMenuItem-DI351kIf.js.map +0 -1
- package/dist/MSlider-BnEy5ieZ.js +0 -1500
- package/dist/MSlider-BnEy5ieZ.js.map +0 -1
- package/dist/MTextField-BBmkaIbO.js +0 -633
- package/dist/MTextField-BBmkaIbO.js.map +0 -1
- package/dist/useLocale-JYxDDeXC.js.map +0 -1
- package/dist/useThemeTokens-Bv-Uv8eX.js.map +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter, type Ref, type WritableComputedRef } from 'vue';
|
|
2
|
+
/** What the lock screen and the system's media notification show (the Media Session API's metadata) */
|
|
3
|
+
export interface MediaPlayerMetadata {
|
|
4
|
+
title?: string;
|
|
5
|
+
artist?: string;
|
|
6
|
+
album?: string;
|
|
7
|
+
/** Cover images, largest last is fine: `[{ src, sizes: '512x512', type: 'image/png' }]` or plain URLs */
|
|
8
|
+
artwork?: (string | {
|
|
9
|
+
src: string;
|
|
10
|
+
sizes?: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
})[];
|
|
13
|
+
}
|
|
14
|
+
export interface MediaPlayerOptions {
|
|
15
|
+
/**
|
|
16
|
+
* The `<audio>` or `<video>` element to drive (a ref or a getter; it may come and go). Without one the player
|
|
17
|
+
* runs its own clock over `duration`: for anything that isn't a media file (a canvas, a shader, generated audio)
|
|
18
|
+
* that should still play, pause, seek and change speed like one.
|
|
19
|
+
*/
|
|
20
|
+
media?: MaybeRefOrGetter<HTMLMediaElement | null | undefined>;
|
|
21
|
+
/** The length in seconds, for the clock (without `media`) */
|
|
22
|
+
duration?: MaybeRefOrGetter<number | undefined>;
|
|
23
|
+
/** Shown on the lock screen and the system's media notification while this player plays (Media Session API) */
|
|
24
|
+
metadata?: MaybeRefOrGetter<MediaPlayerMetadata | null | undefined>;
|
|
25
|
+
/** The previous button (and the lock screen's); without it there is none */
|
|
26
|
+
onPrevious?: () => void;
|
|
27
|
+
/** The next button (and the lock screen's); without it there is none */
|
|
28
|
+
onNext?: () => void;
|
|
29
|
+
/** Whether there is a previous item right now (the first of a playlist has none). Default: `onPrevious` was given */
|
|
30
|
+
hasPrevious?: MaybeRefOrGetter<boolean>;
|
|
31
|
+
/** Whether there is a next item right now. Default: `onNext` was given */
|
|
32
|
+
hasNext?: MaybeRefOrGetter<boolean>;
|
|
33
|
+
/** Seconds `skip()` and the lock screen's seek buttons move by default. Default 10 */
|
|
34
|
+
seekStep?: number;
|
|
35
|
+
/** The clock starts over at the end instead of stopping (with `media`, set the element's `loop`) */
|
|
36
|
+
loop?: MaybeRefOrGetter<boolean | undefined>;
|
|
37
|
+
}
|
|
38
|
+
export interface MediaPlayer {
|
|
39
|
+
/** The media element being driven, or null (clock, or not mounted yet) */
|
|
40
|
+
media: Readonly<Ref<HTMLMediaElement | null>>;
|
|
41
|
+
/** Playing or paused; writing it plays or pauses */
|
|
42
|
+
playing: WritableComputedRef<boolean>;
|
|
43
|
+
/** Position in seconds; writing it seeks */
|
|
44
|
+
currentTime: WritableComputedRef<number>;
|
|
45
|
+
/** Length in seconds: 0 until known, Infinity for a live stream */
|
|
46
|
+
duration: Readonly<Ref<number>>;
|
|
47
|
+
/** Loaded time ranges, `[[start, end], …]` (the clock reports all of it) */
|
|
48
|
+
buffered: Readonly<Ref<[number, number][]>>;
|
|
49
|
+
/** Playback speed; writing it changes it */
|
|
50
|
+
rate: WritableComputedRef<number>;
|
|
51
|
+
/** Volume, 0 to 1; writing it changes it */
|
|
52
|
+
volume: WritableComputedRef<number>;
|
|
53
|
+
/** Muted; writing it mutes or unmutes */
|
|
54
|
+
muted: WritableComputedRef<boolean>;
|
|
55
|
+
/** Stalled for data (a spinner's moment). Writable for the clock, to simulate buffering: it stops advancing meanwhile */
|
|
56
|
+
waiting: Ref<boolean>;
|
|
57
|
+
/** Reached the end; `play()` or `toggle()` start over */
|
|
58
|
+
ended: Readonly<Ref<boolean>>;
|
|
59
|
+
/** A live stream (infinite duration): no seeking */
|
|
60
|
+
live: Readonly<Ref<boolean>>;
|
|
61
|
+
/** The media element's error, if loading or decoding failed */
|
|
62
|
+
error: Readonly<Ref<MediaError | null>>;
|
|
63
|
+
/** The browser refused to start playing (autoplay with sound before any user gesture) */
|
|
64
|
+
blocked: Readonly<Ref<boolean>>;
|
|
65
|
+
/** Whether there is a previous / next item (see the options of the same names) */
|
|
66
|
+
hasPrevious: Readonly<Ref<boolean>>;
|
|
67
|
+
hasNext: Readonly<Ref<boolean>>;
|
|
68
|
+
play: () => Promise<void>;
|
|
69
|
+
pause: () => void;
|
|
70
|
+
toggle: () => Promise<void>;
|
|
71
|
+
/** Seeks to a time in seconds (clamped to the media) */
|
|
72
|
+
seek: (time: number) => void;
|
|
73
|
+
/** Seeks by an offset in seconds, `seekStep` by default (negative goes back) */
|
|
74
|
+
skip: (seconds?: number) => void;
|
|
75
|
+
/** Pauses and goes back to the start */
|
|
76
|
+
stop: () => void;
|
|
77
|
+
previous: () => void;
|
|
78
|
+
next: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Drives this element instead of the `media` option (null: the clock; undefined: back to `media`). What
|
|
81
|
+
* `MVideoPlayer`/`MAudioPlayer` call with their own element when given a `player`: rate, volume and mute carry over
|
|
82
|
+
*/
|
|
83
|
+
attach: (el: HTMLMediaElement | null | undefined) => void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The state and controls of something that plays: an `<audio>`/`<video>` element, or a clock of its own for
|
|
87
|
+
* anything else. Everything is reactive, the writable parts (`playing`, `currentTime`, `rate`, `volume`, `muted`)
|
|
88
|
+
* act on the media when written, and the player takes the Media Session while it plays (lock screen and
|
|
89
|
+
* notification controls, with `metadata`). `MVideoPlayer` and `MAudioPlayer` are built on it; pass one to their
|
|
90
|
+
* `player` prop to keep playing across pages, or build a player UI of your own on it.
|
|
91
|
+
*
|
|
92
|
+
* ```ts
|
|
93
|
+
* const audio = ref<HTMLAudioElement>()
|
|
94
|
+
* const player = useMediaPlayer({ media: audio, metadata: () => ({ title: track.value.title }) })
|
|
95
|
+
* // <audio ref="audio" :src="track.src" /> … <button @click="player.toggle()">
|
|
96
|
+
*
|
|
97
|
+
* // A shader "video" 90 seconds long: its time is player.currentTime
|
|
98
|
+
* const clock = useMediaPlayer({ duration: 90 })
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function useMediaPlayer(options?: MediaPlayerOptions): MediaPlayer;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter, type Ref, type ShallowRef } from 'vue';
|
|
2
|
+
import type * as Pdfjs from 'pdfjs-dist';
|
|
3
|
+
/** The `pdfjs-dist` module */
|
|
4
|
+
export type PdfjsModule = typeof import('pdfjs-dist');
|
|
5
|
+
export type PdfDocument = Pdfjs.PDFDocumentProxy;
|
|
6
|
+
export type PdfPage = Pdfjs.PDFPageProxy;
|
|
7
|
+
/** What `usePdf` loads: a URL, the file's bytes, or a `File`/`Blob` (an upload) */
|
|
8
|
+
export type PdfSource = string | URL | Uint8Array | ArrayBuffer | Blob;
|
|
9
|
+
export interface PdfOutlineItem {
|
|
10
|
+
title: string;
|
|
11
|
+
/** 1-based page it points to (undefined for an external link or a destination that can't be resolved) */
|
|
12
|
+
page?: number;
|
|
13
|
+
/** Where on that page, in PDF points from the bottom, when the destination says */
|
|
14
|
+
top?: number;
|
|
15
|
+
/** An external link */
|
|
16
|
+
url?: string;
|
|
17
|
+
children: PdfOutlineItem[];
|
|
18
|
+
}
|
|
19
|
+
export interface PdfSearchMatch {
|
|
20
|
+
/** 1-based page */
|
|
21
|
+
page: number;
|
|
22
|
+
/** Index of the match on its page */
|
|
23
|
+
index: number;
|
|
24
|
+
/** Character offsets in the page's text (see `pageText`) */
|
|
25
|
+
start: number;
|
|
26
|
+
end: number;
|
|
27
|
+
/** The text around it, for a results list */
|
|
28
|
+
context: string;
|
|
29
|
+
}
|
|
30
|
+
export interface PdfMetadata {
|
|
31
|
+
title?: string;
|
|
32
|
+
author?: string;
|
|
33
|
+
subject?: string;
|
|
34
|
+
creator?: string;
|
|
35
|
+
producer?: string;
|
|
36
|
+
creationDate?: Date;
|
|
37
|
+
modificationDate?: Date;
|
|
38
|
+
}
|
|
39
|
+
/** A page's text as `usePdf` indexes it: its text items joined, and where each item starts */
|
|
40
|
+
export interface PdfPageText {
|
|
41
|
+
text: string;
|
|
42
|
+
/** Start offset of each text item (the text layer's spans, in order) */
|
|
43
|
+
starts: number[];
|
|
44
|
+
}
|
|
45
|
+
export interface PdfOptions {
|
|
46
|
+
/** A password to try first (the `needsPassword` flow handles the rest) */
|
|
47
|
+
password?: MaybeRefOrGetter<string | undefined>;
|
|
48
|
+
/** Send cookies with a cross-origin URL */
|
|
49
|
+
withCredentials?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The pdf.js worker's URL (with Vite: `import workerSrc from 'pdfjs-dist/build/pdf.worker.min.mjs?url'`), or
|
|
52
|
+
* set it once for the app with `setPdfWorker()`. Without one, pdf.js runs on the main thread: it works, but
|
|
53
|
+
* parsing a big file blocks the page meanwhile
|
|
54
|
+
*/
|
|
55
|
+
workerSrc?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface PdfState {
|
|
58
|
+
/** The pdf.js document, once loaded */
|
|
59
|
+
doc: ShallowRef<PdfDocument | null>;
|
|
60
|
+
/** The `pdfjs-dist` module, loaded with the first document */
|
|
61
|
+
pdfjs: ShallowRef<PdfjsModule | null>;
|
|
62
|
+
loading: Readonly<Ref<boolean>>;
|
|
63
|
+
/** Download progress, 0 to 1 (0 while the size is unknown) */
|
|
64
|
+
progress: Readonly<Ref<number>>;
|
|
65
|
+
error: Readonly<Ref<Error | null>>;
|
|
66
|
+
/** The file is encrypted: call `submitPassword()` */
|
|
67
|
+
needsPassword: Readonly<Ref<boolean>>;
|
|
68
|
+
/** The last password was wrong */
|
|
69
|
+
wrongPassword: Readonly<Ref<boolean>>;
|
|
70
|
+
submitPassword: (password: string) => void;
|
|
71
|
+
numPages: Readonly<Ref<number>>;
|
|
72
|
+
/**
|
|
73
|
+
* Each page's size in PDF points at zoom 1, with its own rotation (index 0 = page 1). Every page starts as the
|
|
74
|
+
* first one's size and gets its own as the pages are read, in the background
|
|
75
|
+
*/
|
|
76
|
+
pageSizes: Readonly<Ref<{
|
|
77
|
+
width: number;
|
|
78
|
+
height: number;
|
|
79
|
+
}[]>>;
|
|
80
|
+
outline: Readonly<Ref<PdfOutlineItem[]>>;
|
|
81
|
+
metadata: Readonly<Ref<PdfMetadata>>;
|
|
82
|
+
getPage: (page: number) => Promise<PdfPage>;
|
|
83
|
+
/** A page's text (cached) */
|
|
84
|
+
pageText: (page: number) => Promise<PdfPageText>;
|
|
85
|
+
/** Finds text in every page (case and accent insensitive unless `caseSensitive`) */
|
|
86
|
+
search: (query: string, options?: {
|
|
87
|
+
caseSensitive?: boolean;
|
|
88
|
+
signal?: AbortSignal;
|
|
89
|
+
}) => Promise<PdfSearchMatch[]>;
|
|
90
|
+
/** A picture of a page `width` CSS pixels wide, as an object URL (cached; revoked when the document changes) */
|
|
91
|
+
thumbnail: (page: number, width?: number) => Promise<string>;
|
|
92
|
+
/** Resolves a link destination (a name or an explicit array) to a page and a position */
|
|
93
|
+
resolveDest: (dest: unknown) => Promise<{
|
|
94
|
+
page: number;
|
|
95
|
+
top?: number;
|
|
96
|
+
} | null>;
|
|
97
|
+
/** The file's bytes */
|
|
98
|
+
getData: () => Promise<Uint8Array>;
|
|
99
|
+
/** Saves the file */
|
|
100
|
+
download: (fileName?: string) => Promise<void>;
|
|
101
|
+
/** Opens the browser's print dialog for the file */
|
|
102
|
+
print: () => Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
/** Sets the pdf.js worker URL for every `usePdf`/`MPdfViewer` of the app (see `PdfOptions.workerSrc`) */
|
|
105
|
+
export declare function setPdfWorker(src: string): void;
|
|
106
|
+
/** Internal: loads pdf.js once, with its worker (or, without one, the worker's code on the main thread) */
|
|
107
|
+
export declare function loadPdfjs(workerSrc?: string): Promise<PdfjsModule>;
|
|
108
|
+
/**
|
|
109
|
+
* Loads a PDF with pdf.js and exposes what a viewer needs: pages and their sizes, the outline, metadata, text
|
|
110
|
+
* search, thumbnails, download and print. `MPdfViewer` is built on it; use it for a viewer of your own, a
|
|
111
|
+
* thumbnail grid, or a search over a document. Reactive to `src`: a new one replaces the document.
|
|
112
|
+
*
|
|
113
|
+
* ```ts
|
|
114
|
+
* const pdf = usePdf(() => file.value)
|
|
115
|
+
* watchEffect(async () => { if (pdf.doc.value) cover.value = await pdf.thumbnail(1, 160) })
|
|
116
|
+
* const hits = await pdf.search('invoice')
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare function usePdf(src: MaybeRefOrGetter<PdfSource | null | undefined>, options?: PdfOptions): PdfState;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type EffectOrigin } from './_effectCanvas';
|
|
2
|
+
/** What floats up: any text (an emoji, `'+1'`), or a Material Symbol (`{ icon: 'favorite' }`, filled by default). */
|
|
3
|
+
export type ReactionContent = string | {
|
|
4
|
+
icon: string;
|
|
5
|
+
filled?: boolean;
|
|
6
|
+
color?: string;
|
|
7
|
+
};
|
|
8
|
+
export interface ReactionOptions {
|
|
9
|
+
/** How many float up together, a little apart (default 1) */
|
|
10
|
+
count?: number;
|
|
11
|
+
/** Size in px (default 32) */
|
|
12
|
+
size?: number;
|
|
13
|
+
/** How far it rises, in px (default 260) */
|
|
14
|
+
distance?: number;
|
|
15
|
+
/** How long it floats, in ms (default 2200) */
|
|
16
|
+
duration?: number;
|
|
17
|
+
/** How far it sways to each side, in px (default 20) */
|
|
18
|
+
sway?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Where a reaction starts: the pointer of an event, an element's center, or a point in viewport pixels */
|
|
21
|
+
export type ReactionOrigin = EffectOrigin;
|
|
22
|
+
/** Sends a reaction floating up from a point. Browser only. */
|
|
23
|
+
export declare function fireReaction(origin: ReactionOrigin | undefined, content: ReactionContent, options?: ReactionOptions): void;
|
|
24
|
+
/**
|
|
25
|
+
* Floating reactions for a component: `react(event, '🎉')` from the pointer, `react(el, { icon: 'favorite' })` from
|
|
26
|
+
* an element, `react(el, '👏', { count: 5 })` for a handful.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useReactions(): {
|
|
29
|
+
react: typeof fireReaction;
|
|
30
|
+
};
|
|
31
|
+
/** Removes every reaction at once. Internal, for tests; not exported from index.ts. */
|
|
32
|
+
export declare function __resetReactions(): void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type ComputedRef, type InjectionKey, type Ref } from 'vue';
|
|
2
|
+
import type { GanttScale } from './useGantt';
|
|
3
|
+
/** A booking on a resource's row: a shift, a reservation, a job */
|
|
4
|
+
export interface TimelineEvent<D = any> {
|
|
5
|
+
id: string;
|
|
6
|
+
/** The resource (row) it's on */
|
|
7
|
+
resourceId: string;
|
|
8
|
+
/** A datetime (`YYYY-MM-DDTHH:mm`, local, or ISO with a zone), or `YYYY-MM-DD` for whole days */
|
|
9
|
+
start: string;
|
|
10
|
+
/** A datetime is when it ends; a date is the last day (inclusive) */
|
|
11
|
+
end: string;
|
|
12
|
+
title: string;
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
/** An M3 role (default the resource's, else `primary`) */
|
|
15
|
+
color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' | 'neutral';
|
|
16
|
+
/** `false` keeps it from being moved (in time or to another resource), resized, deleted or selected */
|
|
17
|
+
draggable?: boolean;
|
|
18
|
+
resizable?: boolean;
|
|
19
|
+
deletable?: boolean;
|
|
20
|
+
selectable?: boolean;
|
|
21
|
+
class?: string;
|
|
22
|
+
data?: D;
|
|
23
|
+
}
|
|
24
|
+
/** A row: a person, a table, a room, a machine */
|
|
25
|
+
export interface TimelineResource<D = any> {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
/** Rows with the same group sit under a header that folds */
|
|
30
|
+
group?: string;
|
|
31
|
+
/** A picture; else `icon`, else initials */
|
|
32
|
+
avatar?: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
color?: TimelineEvent['color'];
|
|
35
|
+
/** Bookings it can hold at once before they conflict (default 1) */
|
|
36
|
+
capacity?: number;
|
|
37
|
+
data?: D;
|
|
38
|
+
}
|
|
39
|
+
/** What MResourceTimeline provides to components in its default slot, and its template ref exposes */
|
|
40
|
+
export interface ResourceTimelineContext {
|
|
41
|
+
events: ComputedRef<TimelineEvent[]>;
|
|
42
|
+
selection: ComputedRef<string[]>;
|
|
43
|
+
/** Ids of events that overlap more than their resource's capacity */
|
|
44
|
+
conflicts: ComputedRef<Set<string>>;
|
|
45
|
+
scale: ComputedRef<GanttScale>;
|
|
46
|
+
pxPerDay: Readonly<Ref<number>>;
|
|
47
|
+
canUndo: ComputedRef<boolean>;
|
|
48
|
+
canRedo: ComputedRef<boolean>;
|
|
49
|
+
undo(): void;
|
|
50
|
+
redo(): void;
|
|
51
|
+
zoomIn(): void;
|
|
52
|
+
zoomOut(): void;
|
|
53
|
+
setScale(scale: GanttScale): void;
|
|
54
|
+
scrollToDate(date?: string, opts?: {
|
|
55
|
+
align?: 'start' | 'center';
|
|
56
|
+
animate?: boolean;
|
|
57
|
+
}): void;
|
|
58
|
+
scrollToEvent(id: string): void;
|
|
59
|
+
setSelection(ids: string[]): void;
|
|
60
|
+
addEvents(events: TimelineEvent | TimelineEvent[]): void;
|
|
61
|
+
updateEvent(id: string, patch: Partial<TimelineEvent> | ((e: TimelineEvent) => TimelineEvent)): void;
|
|
62
|
+
removeEvents(ids: string[]): void;
|
|
63
|
+
/** The time (snapped, as a datetime) under a page x */
|
|
64
|
+
dateAt(clientX: number): string;
|
|
65
|
+
/** The resource whose row is under a page y */
|
|
66
|
+
resourceAt(clientY: number): TimelineResource | undefined;
|
|
67
|
+
}
|
|
68
|
+
export declare const RESOURCE_TIMELINE_KEY: InjectionKey<ResourceTimelineContext>;
|
|
69
|
+
/** The enclosing `<MResourceTimeline>`'s state and controls, from a component in its default slot */
|
|
70
|
+
export declare function useResourceTimeline(): ResourceTimelineContext;
|
|
@@ -16,6 +16,7 @@ export declare const VIEWPORT_HINTS = "Sec-CH-Viewport-Width, Sec-CH-Viewport-He
|
|
|
16
16
|
* cookies: true })` keeps in the `m3-viewport` cookie (any visit after the first); the viewport client hints
|
|
17
17
|
* (Chromium, once the server asked for them with `VIEWPORT_HINTS`); or, on a first visit, a size standing for the
|
|
18
18
|
* kind of device (`Sec-CH-UA-Mobile`, then the user agent: a phone, a tablet or a desktop), unless `guess: false`.
|
|
19
|
+
* With `createM3UI({ storagePrefix })`, pass the same `storagePrefix` so the right cookie is read.
|
|
19
20
|
* Undefined when nothing tells: the layouts then render compact.
|
|
20
21
|
*
|
|
21
22
|
* ```ts
|
|
@@ -24,4 +25,5 @@ export declare const VIEWPORT_HINTS = "Sec-CH-Viewport-Width, Sec-CH-Viewport-He
|
|
|
24
25
|
*/
|
|
25
26
|
export declare function viewportFromHeaders(headers: RequestHeaders, options?: {
|
|
26
27
|
guess?: boolean;
|
|
28
|
+
storagePrefix?: string;
|
|
27
29
|
}): ViewportSize | undefined;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Directive } from 'vue';
|
|
2
|
+
import { type ShapeName } from 'shape-morph';
|
|
3
|
+
/** Options for `v-sparkle`. */
|
|
4
|
+
export interface SparkleOptions {
|
|
5
|
+
/** No sparkles while true */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** `'always'` (default) sparkles all the time; `'hover'` only while the pointer is over it or focus is in it */
|
|
8
|
+
trigger?: 'always' | 'hover';
|
|
9
|
+
/** Any CSS colors, one picked per sparkle. Default: the theme's primary and tertiary where the element is */
|
|
10
|
+
color?: string | string[];
|
|
11
|
+
/** Sparkle size in px, each one a bit bigger or smaller (default 14) */
|
|
12
|
+
size?: number;
|
|
13
|
+
/** Sparkles per second (default 3) */
|
|
14
|
+
rate?: number;
|
|
15
|
+
/** MShape's shapes instead of the four-pointed star */
|
|
16
|
+
shapes?: ShapeName[];
|
|
17
|
+
}
|
|
18
|
+
/** `v-sparkle` value: nothing or `true` (on), `false` (off), `'hover'`, a CSS color, or an options object. */
|
|
19
|
+
export type SparkleValue = boolean | string | SparkleOptions | null | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Sparkles that twinkle over an element, to draw the eye to something new or special: `v-sparkle`,
|
|
22
|
+
* `v-sparkle="'hover'"`, `v-sparkle="'#f5b400'"` or `v-sparkle="{ trigger, color, size, rate, shapes, disabled }"`.
|
|
23
|
+
* They're drawn in a layer over the element (a statically positioned one is made `position: relative`), hidden from
|
|
24
|
+
* assistive technology, and pause while it's off screen or the tab is hidden; none under reduced motion.
|
|
25
|
+
* Registered globally as `v-sparkle` by `createM3UI()`; import `vSparkle` to use it without the plugin.
|
|
26
|
+
*/
|
|
27
|
+
export declare const vSparkle: Directive<HTMLElement, SparkleValue>;
|
package/dist/draw.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as MDrawCanvas } from './components/MDrawCanvas.vue';
|
|
2
|
+
export { default as MDrawToolbar } from './components/MDrawToolbar.vue';
|
|
3
|
+
export { default as MDrawLayers } from './components/MDrawLayers.vue';
|
|
4
|
+
export { useDrawing } from './composables/useDrawing';
|
|
5
|
+
export type { DrawTool, DrawContext, DrawExportOptions } from './composables/useDrawing';
|
|
6
|
+
export { strokePath, shapePath, smoothPoints, simulatePressure, constrain, itemBox, unionBox, textBox, hitItem, eraseAt, inLasso, transformItem, sortByLayer, itemSvg, toDrawSvg, svgToPng, drawId, } from './composables/drawGeometry';
|
|
7
|
+
export type { DrawItem, DrawStroke, DrawShape, DrawText, DrawLayer, DrawPoint, DrawPen, DrawShapeKind, DrawBox, DrawSvgOptions } from './composables/drawGeometry';
|