@m3ui-vue/m3ui-vue 1.2.2 → 1.3.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/dist/API.md +3010 -376
- package/dist/MButton-Bl_BSUep.js +172 -0
- package/dist/MButton-Bl_BSUep.js.map +1 -0
- package/dist/MDialog-D_Yik8ou.js +173 -0
- package/dist/MDialog-D_Yik8ou.js.map +1 -0
- package/dist/MIconButton-DoNotQ9v.js +282 -0
- package/dist/MIconButton-DoNotQ9v.js.map +1 -0
- package/dist/MListItem-BxifHJdU.js +824 -0
- package/dist/MListItem-BxifHJdU.js.map +1 -0
- package/dist/MLoadingIndicator-BxbFhSX6.js +115 -0
- package/dist/MLoadingIndicator-BxbFhSX6.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-BeN9QcB3.js +435 -0
- package/dist/MSeekBar-BeN9QcB3.js.map +1 -0
- package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
- package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
- package/dist/MSlider-BVSbJlGS.js +691 -0
- package/dist/MSlider-BVSbJlGS.js.map +1 -0
- package/dist/MSpinner-C2SUnWk4.js +65 -0
- package/dist/MSpinner-C2SUnWk4.js.map +1 -0
- package/dist/MTextField-CEkWSZ2v.js +296 -0
- package/dist/MTextField-CEkWSZ2v.js.map +1 -0
- package/dist/MTooltip-CodJGEO-.js +756 -0
- package/dist/MTooltip-CodJGEO-.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 +150 -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 +248 -0
- package/dist/components/MFloorPlanInspector.vue.d.ts +56 -0
- package/dist/components/MFloorPlanToolbar.vue.d.ts +51 -0
- package/dist/components/MFlow.vue.d.ts +318 -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/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 +2 -2
- 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/_flowPanel.d.ts +2 -0
- package/dist/composables/_flowSlot.d.ts +5 -0
- package/dist/composables/_ganttTime.d.ts +41 -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/useDrawing.d.ts +44 -0
- package/dist/composables/useFloorPlan.d.ts +58 -0
- package/dist/composables/useFlow.d.ts +266 -0
- package/dist/composables/useGantt.d.ts +87 -0
- package/dist/composables/useLocale.d.ts +204 -0
- package/dist/composables/useMediaPlayer.d.ts +101 -0
- package/dist/composables/usePdf.d.ts +119 -0
- package/dist/composables/useResourceTimeline.d.ts +70 -0
- package/dist/draw.d.ts +7 -0
- package/dist/draw.js +1702 -0
- package/dist/draw.js.map +1 -0
- package/dist/flow.d.ts +14 -0
- package/dist/flow.js +3547 -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 +9 -0
- package/dist/locales/index.js +1435 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +8248 -7637
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +113 -108
- 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/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-CaWwi-b6.js} +206 -2
- package/dist/useLocale-CaWwi-b6.js.map +1 -0
- package/dist/{useThemeTokens-y0HZpyhL.js → useThemeTokens-DQQcaWbE.js} +40 -54
- 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 +118 -0
- package/src/__tests__/MFloorPlan.test.ts +299 -0
- package/src/__tests__/MFlow.test.ts +590 -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__/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__/useMediaPlayer.test.ts +182 -0
- package/src/__tests__/usePdf.test.ts +102 -0
- package/src/components/MAudioPlayer.vue +319 -0
- package/src/components/MDrawCanvas.vue +819 -0
- package/src/components/MDrawLayers.vue +114 -0
- package/src/components/MDrawToolbar.vue +171 -0
- package/src/components/MFloorPlan.vue +1080 -0
- package/src/components/MFloorPlanInspector.vue +169 -0
- package/src/components/MFloorPlanToolbar.vue +128 -0
- package/src/components/MFlow.vue +2060 -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/MMaskField.vue +13 -0
- package/src/components/MNumberField.vue +13 -0
- package/src/components/MPdfViewer.vue +1270 -0
- package/src/components/MResourceTimeline.vue +1020 -0
- package/src/components/MTagInput.vue +13 -0
- package/src/components/MTextField.vue +16 -0
- 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/_flowPanel.ts +13 -0
- package/src/composables/_flowSlot.ts +6 -0
- package/src/composables/_ganttTime.ts +200 -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/useDrawing.ts +53 -0
- package/src/composables/useFloorPlan.ts +73 -0
- package/src/composables/useFlow.ts +250 -0
- package/src/composables/useGantt.ts +92 -0
- package/src/composables/useLocale.ts +410 -0
- package/src/composables/useMediaPlayer.ts +406 -0
- package/src/composables/usePdf.ts +456 -0
- package/src/composables/useResourceTimeline.ts +76 -0
- package/src/draw.ts +25 -0
- package/src/flow.ts +26 -0
- package/src/gantt.ts +12 -0
- package/src/index.ts +9 -0
- package/src/locales/de.ts +204 -0
- package/src/locales/es.ts +204 -0
- package/src/locales/fr.ts +204 -0
- package/src/locales/ja.ts +204 -0
- package/src/locales/ko.ts +204 -0
- package/src/locales/pt.ts +204 -0
- package/src/locales/zh.ts +204 -0
- package/src/media.ts +5 -0
- package/src/pdf.ts +15 -0
- package/dist/MMenuItem-D4Gx_l3F.js +0 -929
- package/dist/MMenuItem-D4Gx_l3F.js.map +0 -1
- package/dist/MSlider-Dx_S3vJ9.js +0 -1506
- package/dist/MSlider-Dx_S3vJ9.js.map +0 -1
- package/dist/MTextField-Bz8JIsnl.js +0 -633
- package/dist/MTextField-Bz8JIsnl.js.map +0 -1
- package/dist/useLocale-JYxDDeXC.js.map +0 -1
- package/dist/useThemeTokens-y0HZpyhL.js.map +0 -1
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import { computed, getCurrentScope, onScopeDispose, ref, shallowRef, toValue, watch, type MaybeRefOrGetter, type Ref, type ShallowRef } from 'vue'
|
|
2
|
+
import type * as Pdfjs from 'pdfjs-dist'
|
|
3
|
+
|
|
4
|
+
/** The `pdfjs-dist` module */
|
|
5
|
+
export type PdfjsModule = typeof import('pdfjs-dist')
|
|
6
|
+
export type PdfDocument = Pdfjs.PDFDocumentProxy
|
|
7
|
+
export type PdfPage = Pdfjs.PDFPageProxy
|
|
8
|
+
|
|
9
|
+
/** What `usePdf` loads: a URL, the file's bytes, or a `File`/`Blob` (an upload) */
|
|
10
|
+
export type PdfSource = string | URL | Uint8Array | ArrayBuffer | Blob
|
|
11
|
+
|
|
12
|
+
export interface PdfOutlineItem {
|
|
13
|
+
title: string
|
|
14
|
+
/** 1-based page it points to (undefined for an external link or a destination that can't be resolved) */
|
|
15
|
+
page?: number
|
|
16
|
+
/** Where on that page, in PDF points from the bottom, when the destination says */
|
|
17
|
+
top?: number
|
|
18
|
+
/** An external link */
|
|
19
|
+
url?: string
|
|
20
|
+
children: PdfOutlineItem[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PdfSearchMatch {
|
|
24
|
+
/** 1-based page */
|
|
25
|
+
page: number
|
|
26
|
+
/** Index of the match on its page */
|
|
27
|
+
index: number
|
|
28
|
+
/** Character offsets in the page's text (see `pageText`) */
|
|
29
|
+
start: number
|
|
30
|
+
end: number
|
|
31
|
+
/** The text around it, for a results list */
|
|
32
|
+
context: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface PdfMetadata {
|
|
36
|
+
title?: string
|
|
37
|
+
author?: string
|
|
38
|
+
subject?: string
|
|
39
|
+
creator?: string
|
|
40
|
+
producer?: string
|
|
41
|
+
creationDate?: Date
|
|
42
|
+
modificationDate?: Date
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** A page's text as `usePdf` indexes it: its text items joined, and where each item starts */
|
|
46
|
+
export interface PdfPageText {
|
|
47
|
+
text: string
|
|
48
|
+
/** Start offset of each text item (the text layer's spans, in order) */
|
|
49
|
+
starts: number[]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface PdfOptions {
|
|
53
|
+
/** A password to try first (the `needsPassword` flow handles the rest) */
|
|
54
|
+
password?: MaybeRefOrGetter<string | undefined>
|
|
55
|
+
/** Send cookies with a cross-origin URL */
|
|
56
|
+
withCredentials?: boolean
|
|
57
|
+
/**
|
|
58
|
+
* The pdf.js worker's URL (with Vite: `import workerSrc from 'pdfjs-dist/build/pdf.worker.min.mjs?url'`), or
|
|
59
|
+
* set it once for the app with `setPdfWorker()`. Without one, pdf.js runs on the main thread: it works, but
|
|
60
|
+
* parsing a big file blocks the page meanwhile
|
|
61
|
+
*/
|
|
62
|
+
workerSrc?: string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface PdfState {
|
|
66
|
+
/** The pdf.js document, once loaded */
|
|
67
|
+
doc: ShallowRef<PdfDocument | null>
|
|
68
|
+
/** The `pdfjs-dist` module, loaded with the first document */
|
|
69
|
+
pdfjs: ShallowRef<PdfjsModule | null>
|
|
70
|
+
loading: Readonly<Ref<boolean>>
|
|
71
|
+
/** Download progress, 0 to 1 (0 while the size is unknown) */
|
|
72
|
+
progress: Readonly<Ref<number>>
|
|
73
|
+
error: Readonly<Ref<Error | null>>
|
|
74
|
+
/** The file is encrypted: call `submitPassword()` */
|
|
75
|
+
needsPassword: Readonly<Ref<boolean>>
|
|
76
|
+
/** The last password was wrong */
|
|
77
|
+
wrongPassword: Readonly<Ref<boolean>>
|
|
78
|
+
submitPassword: (password: string) => void
|
|
79
|
+
numPages: Readonly<Ref<number>>
|
|
80
|
+
/**
|
|
81
|
+
* Each page's size in PDF points at zoom 1, with its own rotation (index 0 = page 1). Every page starts as the
|
|
82
|
+
* first one's size and gets its own as the pages are read, in the background
|
|
83
|
+
*/
|
|
84
|
+
pageSizes: Readonly<Ref<{ width: number; height: number }[]>>
|
|
85
|
+
outline: Readonly<Ref<PdfOutlineItem[]>>
|
|
86
|
+
metadata: Readonly<Ref<PdfMetadata>>
|
|
87
|
+
getPage: (page: number) => Promise<PdfPage>
|
|
88
|
+
/** A page's text (cached) */
|
|
89
|
+
pageText: (page: number) => Promise<PdfPageText>
|
|
90
|
+
/** Finds text in every page (case and accent insensitive unless `caseSensitive`) */
|
|
91
|
+
search: (query: string, options?: { caseSensitive?: boolean; signal?: AbortSignal }) => Promise<PdfSearchMatch[]>
|
|
92
|
+
/** A picture of a page `width` CSS pixels wide, as an object URL (cached; revoked when the document changes) */
|
|
93
|
+
thumbnail: (page: number, width?: number) => Promise<string>
|
|
94
|
+
/** Resolves a link destination (a name or an explicit array) to a page and a position */
|
|
95
|
+
resolveDest: (dest: unknown) => Promise<{ page: number; top?: number } | null>
|
|
96
|
+
/** The file's bytes */
|
|
97
|
+
getData: () => Promise<Uint8Array>
|
|
98
|
+
/** Saves the file */
|
|
99
|
+
download: (fileName?: string) => Promise<void>
|
|
100
|
+
/** Opens the browser's print dialog for the file */
|
|
101
|
+
print: () => Promise<void>
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
let globalWorkerSrc: string | undefined
|
|
105
|
+
|
|
106
|
+
/** Sets the pdf.js worker URL for every `usePdf`/`MPdfViewer` of the app (see `PdfOptions.workerSrc`) */
|
|
107
|
+
export function setPdfWorker(src: string) {
|
|
108
|
+
globalWorkerSrc = src
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let pdfjsPromise: Promise<PdfjsModule> | null = null
|
|
112
|
+
|
|
113
|
+
/** Internal: loads pdf.js once, with its worker (or, without one, the worker's code on the main thread) */
|
|
114
|
+
export function loadPdfjs(workerSrc?: string): Promise<PdfjsModule> {
|
|
115
|
+
pdfjsPromise ??= (async () => {
|
|
116
|
+
const pdfjs = await import('pdfjs-dist')
|
|
117
|
+
const src = workerSrc ?? globalWorkerSrc
|
|
118
|
+
if (src) pdfjs.GlobalWorkerOptions.workerSrc = src
|
|
119
|
+
// @ts-ignore: the worker module has no types (importing it registers globalThis.pdfjsWorker)
|
|
120
|
+
else if (!pdfjs.GlobalWorkerOptions.workerSrc) await import('pdfjs-dist/build/pdf.worker.min.mjs')
|
|
121
|
+
return pdfjs
|
|
122
|
+
})()
|
|
123
|
+
return pdfjsPromise
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Case and accent folding that keeps one character per character, so offsets stay valid
|
|
127
|
+
function fold(s: string, caseSensitive: boolean) {
|
|
128
|
+
let out = ''
|
|
129
|
+
for (const c of s) {
|
|
130
|
+
const base = c.normalize('NFD').replace(/\p{M}/gu, '')
|
|
131
|
+
const one = base.length === 1 ? base : c
|
|
132
|
+
out += caseSensitive ? one : one.toLowerCase()
|
|
133
|
+
}
|
|
134
|
+
return out
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function parseDate(pdfjs: PdfjsModule, v: unknown) {
|
|
138
|
+
return typeof v === 'string' ? pdfjs.PDFDateString.toDateObject(v) ?? undefined : undefined
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Loads a PDF with pdf.js and exposes what a viewer needs: pages and their sizes, the outline, metadata, text
|
|
143
|
+
* search, thumbnails, download and print. `MPdfViewer` is built on it; use it for a viewer of your own, a
|
|
144
|
+
* thumbnail grid, or a search over a document. Reactive to `src`: a new one replaces the document.
|
|
145
|
+
*
|
|
146
|
+
* ```ts
|
|
147
|
+
* const pdf = usePdf(() => file.value)
|
|
148
|
+
* watchEffect(async () => { if (pdf.doc.value) cover.value = await pdf.thumbnail(1, 160) })
|
|
149
|
+
* const hits = await pdf.search('invoice')
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
export function usePdf(src: MaybeRefOrGetter<PdfSource | null | undefined>, options: PdfOptions = {}): PdfState {
|
|
153
|
+
const doc = shallowRef<PdfDocument | null>(null)
|
|
154
|
+
const pdfjs = shallowRef<PdfjsModule | null>(null)
|
|
155
|
+
const loading = ref(false)
|
|
156
|
+
const progress = ref(0)
|
|
157
|
+
const error = shallowRef<Error | null>(null)
|
|
158
|
+
const needsPassword = ref(false)
|
|
159
|
+
const wrongPassword = ref(false)
|
|
160
|
+
const pageSizes = shallowRef<{ width: number; height: number }[]>([])
|
|
161
|
+
const outline = shallowRef<PdfOutlineItem[]>([])
|
|
162
|
+
const metadata = shallowRef<PdfMetadata>({})
|
|
163
|
+
const numPages = computed(() => doc.value?.numPages ?? 0)
|
|
164
|
+
|
|
165
|
+
let task: Pdfjs.PDFDocumentLoadingTask | null = null
|
|
166
|
+
let passwordCallback: ((pw: string) => void) | null = null
|
|
167
|
+
let generation = 0
|
|
168
|
+
const texts = new Map<number, Promise<PdfPageText>>()
|
|
169
|
+
const thumbs = new Map<string, Promise<string>>()
|
|
170
|
+
|
|
171
|
+
function reset() {
|
|
172
|
+
for (const p of thumbs.values()) p.then((url) => URL.revokeObjectURL(url), () => {})
|
|
173
|
+
thumbs.clear()
|
|
174
|
+
texts.clear()
|
|
175
|
+
const old = task
|
|
176
|
+
task = null
|
|
177
|
+
old?.destroy()
|
|
178
|
+
doc.value = null
|
|
179
|
+
pageSizes.value = []
|
|
180
|
+
outline.value = []
|
|
181
|
+
metadata.value = {}
|
|
182
|
+
needsPassword.value = false
|
|
183
|
+
wrongPassword.value = false
|
|
184
|
+
passwordCallback = null
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async function load(source: PdfSource | null | undefined) {
|
|
188
|
+
const gen = ++generation
|
|
189
|
+
reset()
|
|
190
|
+
error.value = null
|
|
191
|
+
progress.value = 0
|
|
192
|
+
if (!source || typeof window === 'undefined') {
|
|
193
|
+
loading.value = false
|
|
194
|
+
return
|
|
195
|
+
}
|
|
196
|
+
loading.value = true
|
|
197
|
+
try {
|
|
198
|
+
const lib = await loadPdfjs(options.workerSrc)
|
|
199
|
+
if (gen !== generation) return
|
|
200
|
+
pdfjs.value = lib
|
|
201
|
+
let data: Uint8Array | undefined
|
|
202
|
+
let url: string | undefined
|
|
203
|
+
if (typeof source === 'string' || source instanceof URL) url = String(source)
|
|
204
|
+
else if (source instanceof Blob) data = new Uint8Array(await source.arrayBuffer())
|
|
205
|
+
// pdf.js transfers the buffer to its worker: give it a copy, so the caller's stays usable
|
|
206
|
+
else data = new Uint8Array(source instanceof ArrayBuffer ? source.slice(0) : source.slice())
|
|
207
|
+
if (gen !== generation) return
|
|
208
|
+
task = lib.getDocument({ url, data, password: toValue(options.password), withCredentials: options.withCredentials })
|
|
209
|
+
task.onProgress = ({ loaded, total }: { loaded: number; total: number }) => {
|
|
210
|
+
if (gen === generation && total) progress.value = Math.min(1, loaded / total)
|
|
211
|
+
}
|
|
212
|
+
task.onPassword = (update: (pw: string) => void, reason: number) => {
|
|
213
|
+
if (gen !== generation) return
|
|
214
|
+
passwordCallback = update
|
|
215
|
+
wrongPassword.value = reason === lib.PasswordResponses.INCORRECT_PASSWORD
|
|
216
|
+
needsPassword.value = true
|
|
217
|
+
}
|
|
218
|
+
const mine = task
|
|
219
|
+
const d = await mine.promise
|
|
220
|
+
if (gen !== generation) {
|
|
221
|
+
mine.destroy()
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
needsPassword.value = false
|
|
225
|
+
wrongPassword.value = false
|
|
226
|
+
progress.value = 1
|
|
227
|
+
const first = (await d.getPage(1)).getViewport({ scale: 1 })
|
|
228
|
+
pageSizes.value = Array.from({ length: d.numPages }, () => ({ width: first.width, height: first.height }))
|
|
229
|
+
doc.value = d
|
|
230
|
+
loading.value = false
|
|
231
|
+
readSizes(d, gen)
|
|
232
|
+
readOutline(d, gen)
|
|
233
|
+
readMetadata(d, lib, gen)
|
|
234
|
+
} catch (e) {
|
|
235
|
+
if (gen !== generation) return
|
|
236
|
+
error.value = e instanceof Error ? e : new Error(String(e))
|
|
237
|
+
loading.value = false
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Every page's own size, a batch at a time so a long document lays out right without blocking anything
|
|
242
|
+
async function readSizes(d: PdfDocument, gen: number) {
|
|
243
|
+
const sizes = pageSizes.value.slice()
|
|
244
|
+
let changed = false
|
|
245
|
+
for (let i = 2; i <= d.numPages; i++) {
|
|
246
|
+
if (gen !== generation) return
|
|
247
|
+
const v = (await d.getPage(i)).getViewport({ scale: 1 })
|
|
248
|
+
const s = sizes[i - 1]!
|
|
249
|
+
if (s.width !== v.width || s.height !== v.height) {
|
|
250
|
+
sizes[i - 1] = { width: v.width, height: v.height }
|
|
251
|
+
changed = true
|
|
252
|
+
}
|
|
253
|
+
if (changed && (i % 25 === 0 || i === d.numPages)) {
|
|
254
|
+
pageSizes.value = sizes.slice()
|
|
255
|
+
changed = false
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async function resolveDest(dest: unknown): Promise<{ page: number; top?: number } | null> {
|
|
261
|
+
const d = doc.value
|
|
262
|
+
if (!d || !dest) return null
|
|
263
|
+
try {
|
|
264
|
+
const explicit = typeof dest === 'string' ? await d.getDestination(dest) : (dest as unknown[])
|
|
265
|
+
if (!Array.isArray(explicit)) return null
|
|
266
|
+
const ref = explicit[0]
|
|
267
|
+
const index = typeof ref === 'number' ? ref : await d.getPageIndex(ref as Parameters<PdfDocument['getPageIndex']>[0])
|
|
268
|
+
// [ref, { name: 'XYZ' }, left, top, zoom] or [ref, { name: 'FitH' }, top]
|
|
269
|
+
const kind = (explicit[1] as { name?: string } | undefined)?.name
|
|
270
|
+
const top = kind === 'XYZ' ? explicit[3] : kind === 'FitH' || kind === 'FitBH' ? explicit[2] : null
|
|
271
|
+
return { page: index + 1, top: typeof top === 'number' ? top : undefined }
|
|
272
|
+
} catch {
|
|
273
|
+
return null
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async function readOutline(d: PdfDocument, gen: number) {
|
|
278
|
+
const raw = await d.getOutline().catch(() => null)
|
|
279
|
+
if (!raw || gen !== generation) return
|
|
280
|
+
type Raw = { title: string; dest: unknown; url: string | null; items: Raw[] }
|
|
281
|
+
const walk = async (items: Raw[]): Promise<PdfOutlineItem[]> =>
|
|
282
|
+
Promise.all(items.map(async (it) => {
|
|
283
|
+
const at = it.dest ? await resolveDest(it.dest) : null
|
|
284
|
+
return { title: it.title, page: at?.page, top: at?.top, url: it.url ?? undefined, children: await walk(it.items ?? []) }
|
|
285
|
+
}))
|
|
286
|
+
const tree = await walk(raw as Raw[])
|
|
287
|
+
if (gen === generation) outline.value = tree
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
async function readMetadata(d: PdfDocument, lib: PdfjsModule, gen: number) {
|
|
291
|
+
const m = await d.getMetadata().catch(() => null)
|
|
292
|
+
if (!m || gen !== generation) return
|
|
293
|
+
const info = m.info as Record<string, unknown>
|
|
294
|
+
const str = (v: unknown) => (typeof v === 'string' && v.trim() ? v : undefined)
|
|
295
|
+
metadata.value = {
|
|
296
|
+
title: str(m.metadata?.get('dc:title')) ?? str(info.Title),
|
|
297
|
+
author: str(m.metadata?.get('dc:creator')) ?? str(info.Author),
|
|
298
|
+
subject: str(info.Subject),
|
|
299
|
+
creator: str(info.Creator),
|
|
300
|
+
producer: str(info.Producer),
|
|
301
|
+
creationDate: parseDate(lib, info.CreationDate),
|
|
302
|
+
modificationDate: parseDate(lib, info.ModDate),
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
async function getPage(n: number) {
|
|
307
|
+
const d = doc.value
|
|
308
|
+
if (!d) throw new Error('No document loaded')
|
|
309
|
+
return d.getPage(n)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function pageText(n: number): Promise<PdfPageText> {
|
|
313
|
+
let p = texts.get(n)
|
|
314
|
+
if (!p) {
|
|
315
|
+
p = getPage(n).then(async (page) => {
|
|
316
|
+
const content = await page.getTextContent()
|
|
317
|
+
let text = ''
|
|
318
|
+
const starts: number[] = []
|
|
319
|
+
for (const item of content.items) {
|
|
320
|
+
if (!('str' in item)) continue
|
|
321
|
+
starts.push(text.length)
|
|
322
|
+
text += item.str
|
|
323
|
+
// A line break reads as a space, so a phrase split across lines is still found
|
|
324
|
+
if (item.hasEOL) text += ' '
|
|
325
|
+
}
|
|
326
|
+
return { text, starts }
|
|
327
|
+
})
|
|
328
|
+
texts.set(n, p)
|
|
329
|
+
}
|
|
330
|
+
return p
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
async function search(query: string, opts: { caseSensitive?: boolean; signal?: AbortSignal } = {}) {
|
|
334
|
+
const q = fold(query.trim(), !!opts.caseSensitive)
|
|
335
|
+
const out: PdfSearchMatch[] = []
|
|
336
|
+
if (!q || !doc.value) return out
|
|
337
|
+
for (let n = 1; n <= numPages.value; n++) {
|
|
338
|
+
if (opts.signal?.aborted) break
|
|
339
|
+
const { text } = await pageText(n)
|
|
340
|
+
const hay = fold(text, !!opts.caseSensitive)
|
|
341
|
+
let index = 0
|
|
342
|
+
for (let at = hay.indexOf(q); at >= 0; at = hay.indexOf(q, at + q.length)) {
|
|
343
|
+
const a = Math.max(0, at - 40)
|
|
344
|
+
const b = Math.min(text.length, at + q.length + 40)
|
|
345
|
+
out.push({ page: n, index: index++, start: at, end: at + q.length, context: (a ? '…' : '') + text.slice(a, b).trim() + (b < text.length ? '…' : '') })
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return out
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function thumbnail(n: number, width = 160): Promise<string> {
|
|
352
|
+
const ratio = typeof window !== 'undefined' ? Math.min(2, window.devicePixelRatio || 1) : 1
|
|
353
|
+
const key = `${n}@${width}`
|
|
354
|
+
let p = thumbs.get(key)
|
|
355
|
+
if (!p) {
|
|
356
|
+
p = getPage(n).then(async (page) => {
|
|
357
|
+
const base = page.getViewport({ scale: 1 })
|
|
358
|
+
const viewport = page.getViewport({ scale: (width / base.width) * ratio })
|
|
359
|
+
const canvas = document.createElement('canvas')
|
|
360
|
+
canvas.width = Math.ceil(viewport.width)
|
|
361
|
+
canvas.height = Math.ceil(viewport.height)
|
|
362
|
+
await page.render({ canvas, viewport }).promise
|
|
363
|
+
const blob = await new Promise<Blob | null>((resolve) => canvas.toBlob(resolve, 'image/png'))
|
|
364
|
+
if (!blob) throw new Error('Thumbnail failed')
|
|
365
|
+
return URL.createObjectURL(blob)
|
|
366
|
+
})
|
|
367
|
+
thumbs.set(key, p)
|
|
368
|
+
}
|
|
369
|
+
return p
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const getData = async () => {
|
|
373
|
+
const d = doc.value
|
|
374
|
+
if (!d) throw new Error('No document loaded')
|
|
375
|
+
return d.getData()
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
async function blobUrl() {
|
|
379
|
+
const bytes = await getData()
|
|
380
|
+
return URL.createObjectURL(new Blob([bytes as BlobPart], { type: 'application/pdf' }))
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
async function download(fileName?: string) {
|
|
384
|
+
const url = await blobUrl()
|
|
385
|
+
const s = toValue(src)
|
|
386
|
+
const fromUrl = typeof s === 'string' ? decodeURIComponent(s.split(/[?#]/)[0]!.split('/').pop() ?? '') : ''
|
|
387
|
+
const a = document.createElement('a')
|
|
388
|
+
a.href = url
|
|
389
|
+
a.download = fileName ?? (s instanceof File ? s.name : fromUrl.toLowerCase().endsWith('.pdf') ? fromUrl : `${metadata.value.title ?? 'document'}.pdf`)
|
|
390
|
+
document.body.appendChild(a)
|
|
391
|
+
a.click()
|
|
392
|
+
a.remove()
|
|
393
|
+
setTimeout(() => URL.revokeObjectURL(url), 30_000)
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// The browser's own PDF viewer prints it, in a hidden frame
|
|
397
|
+
async function print() {
|
|
398
|
+
const url = await blobUrl()
|
|
399
|
+
const frame = document.createElement('iframe')
|
|
400
|
+
frame.style.cssText = 'position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden'
|
|
401
|
+
frame.src = url
|
|
402
|
+
frame.onload = () => {
|
|
403
|
+
try {
|
|
404
|
+
frame.contentWindow?.focus()
|
|
405
|
+
frame.contentWindow?.print()
|
|
406
|
+
} catch {
|
|
407
|
+
window.open(url, '_blank')
|
|
408
|
+
}
|
|
409
|
+
setTimeout(() => {
|
|
410
|
+
frame.remove()
|
|
411
|
+
URL.revokeObjectURL(url)
|
|
412
|
+
}, 60_000)
|
|
413
|
+
}
|
|
414
|
+
document.body.appendChild(frame)
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function submitPassword(pw: string) {
|
|
418
|
+
const cb = passwordCallback
|
|
419
|
+
if (!cb) return
|
|
420
|
+
passwordCallback = null
|
|
421
|
+
needsPassword.value = false
|
|
422
|
+
cb(pw)
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
watch(() => toValue(src), (s) => { load(s) }, { immediate: true })
|
|
426
|
+
|
|
427
|
+
if (getCurrentScope()) {
|
|
428
|
+
onScopeDispose(() => {
|
|
429
|
+
generation++
|
|
430
|
+
reset()
|
|
431
|
+
})
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return {
|
|
435
|
+
doc,
|
|
436
|
+
pdfjs,
|
|
437
|
+
loading,
|
|
438
|
+
progress,
|
|
439
|
+
error,
|
|
440
|
+
needsPassword,
|
|
441
|
+
wrongPassword,
|
|
442
|
+
submitPassword,
|
|
443
|
+
numPages,
|
|
444
|
+
pageSizes,
|
|
445
|
+
outline,
|
|
446
|
+
metadata,
|
|
447
|
+
getPage,
|
|
448
|
+
pageText,
|
|
449
|
+
search,
|
|
450
|
+
thumbnail,
|
|
451
|
+
resolveDest,
|
|
452
|
+
getData,
|
|
453
|
+
download,
|
|
454
|
+
print,
|
|
455
|
+
}
|
|
456
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { inject, type ComputedRef, type InjectionKey, type Ref } from 'vue'
|
|
2
|
+
import type { GanttScale } from './useGantt'
|
|
3
|
+
|
|
4
|
+
/** A booking on a resource's row: a shift, a reservation, a job */
|
|
5
|
+
export interface TimelineEvent<D = any> {
|
|
6
|
+
id: string
|
|
7
|
+
/** The resource (row) it's on */
|
|
8
|
+
resourceId: string
|
|
9
|
+
/** A datetime (`YYYY-MM-DDTHH:mm`, local, or ISO with a zone), or `YYYY-MM-DD` for whole days */
|
|
10
|
+
start: string
|
|
11
|
+
/** A datetime is when it ends; a date is the last day (inclusive) */
|
|
12
|
+
end: string
|
|
13
|
+
title: string
|
|
14
|
+
subtitle?: string
|
|
15
|
+
/** An M3 role (default the resource's, else `primary`) */
|
|
16
|
+
color?: 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' | 'neutral'
|
|
17
|
+
/** `false` keeps it from being moved (in time or to another resource), resized, deleted or selected */
|
|
18
|
+
draggable?: boolean
|
|
19
|
+
resizable?: boolean
|
|
20
|
+
deletable?: boolean
|
|
21
|
+
selectable?: boolean
|
|
22
|
+
class?: string
|
|
23
|
+
data?: D
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A row: a person, a table, a room, a machine */
|
|
27
|
+
export interface TimelineResource<D = any> {
|
|
28
|
+
id: string
|
|
29
|
+
name: string
|
|
30
|
+
subtitle?: string
|
|
31
|
+
/** Rows with the same group sit under a header that folds */
|
|
32
|
+
group?: string
|
|
33
|
+
/** A picture; else `icon`, else initials */
|
|
34
|
+
avatar?: string
|
|
35
|
+
icon?: string
|
|
36
|
+
color?: TimelineEvent['color']
|
|
37
|
+
/** Bookings it can hold at once before they conflict (default 1) */
|
|
38
|
+
capacity?: number
|
|
39
|
+
data?: D
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** What MResourceTimeline provides to components in its default slot, and its template ref exposes */
|
|
43
|
+
export interface ResourceTimelineContext {
|
|
44
|
+
events: ComputedRef<TimelineEvent[]>
|
|
45
|
+
selection: ComputedRef<string[]>
|
|
46
|
+
/** Ids of events that overlap more than their resource's capacity */
|
|
47
|
+
conflicts: ComputedRef<Set<string>>
|
|
48
|
+
scale: ComputedRef<GanttScale>
|
|
49
|
+
pxPerDay: Readonly<Ref<number>>
|
|
50
|
+
canUndo: ComputedRef<boolean>
|
|
51
|
+
canRedo: ComputedRef<boolean>
|
|
52
|
+
undo(): void
|
|
53
|
+
redo(): void
|
|
54
|
+
zoomIn(): void
|
|
55
|
+
zoomOut(): void
|
|
56
|
+
setScale(scale: GanttScale): void
|
|
57
|
+
scrollToDate(date?: string, opts?: { align?: 'start' | 'center'; animate?: boolean }): 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
|
+
|
|
69
|
+
export const RESOURCE_TIMELINE_KEY: InjectionKey<ResourceTimelineContext> = Symbol('m3-resource-timeline')
|
|
70
|
+
|
|
71
|
+
/** The enclosing `<MResourceTimeline>`'s state and controls, from a component in its default slot */
|
|
72
|
+
export function useResourceTimeline(): ResourceTimelineContext {
|
|
73
|
+
const ctx = inject(RESOURCE_TIMELINE_KEY, null)
|
|
74
|
+
if (!ctx) throw new Error('useResourceTimeline() must be called inside <MResourceTimeline>')
|
|
75
|
+
return ctx
|
|
76
|
+
}
|
package/src/draw.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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 {
|
|
7
|
+
strokePath,
|
|
8
|
+
shapePath,
|
|
9
|
+
smoothPoints,
|
|
10
|
+
simulatePressure,
|
|
11
|
+
constrain,
|
|
12
|
+
itemBox,
|
|
13
|
+
unionBox,
|
|
14
|
+
textBox,
|
|
15
|
+
hitItem,
|
|
16
|
+
eraseAt,
|
|
17
|
+
inLasso,
|
|
18
|
+
transformItem,
|
|
19
|
+
sortByLayer,
|
|
20
|
+
itemSvg,
|
|
21
|
+
toDrawSvg,
|
|
22
|
+
svgToPng,
|
|
23
|
+
drawId,
|
|
24
|
+
} from './composables/drawGeometry'
|
|
25
|
+
export type { DrawItem, DrawStroke, DrawShape, DrawText, DrawLayer, DrawPoint, DrawPen, DrawShapeKind, DrawBox, DrawSvgOptions } from './composables/drawGeometry'
|
package/src/flow.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { default as MFlow } from './components/MFlow.vue'
|
|
2
|
+
export { default as MFlowNode } from './components/MFlowNode.vue'
|
|
3
|
+
export { default as MFlowHandle } from './components/MFlowHandle.vue'
|
|
4
|
+
export { default as MFlowControls } from './components/MFlowControls.vue'
|
|
5
|
+
export { default as MFlowMinimap } from './components/MFlowMinimap.vue'
|
|
6
|
+
export { useFlow, useFlowNode } from './composables/useFlow'
|
|
7
|
+
export type {
|
|
8
|
+
FlowCircleData,
|
|
9
|
+
FlowConnection,
|
|
10
|
+
FlowContext,
|
|
11
|
+
FlowEdge,
|
|
12
|
+
FlowFitOptions,
|
|
13
|
+
FlowHandleBounds,
|
|
14
|
+
FlowMarker,
|
|
15
|
+
FlowNode,
|
|
16
|
+
FlowSelection,
|
|
17
|
+
FlowViewport,
|
|
18
|
+
FlowXY,
|
|
19
|
+
} from './composables/useFlow'
|
|
20
|
+
export { getBezierPath, getSmoothStepPath, getStepPath, getStraightPath, smoothStepPoints, arrowPath } from './composables/flowPaths'
|
|
21
|
+
export type { FlowEdgePath, FlowEdgePathParams, FlowPosition } from './composables/flowPaths'
|
|
22
|
+
export { layoutTree, layoutLayered } from './composables/flowLayout'
|
|
23
|
+
export type { FlowLayout, FlowLayoutDirection, FlowLayoutOptions, FlowLayoutResult } from './composables/flowLayout'
|
|
24
|
+
export type { FlowPanelPosition } from './composables/_flowPanel'
|
|
25
|
+
export { parseDot, toDot, parseMermaid, toMermaid } from './composables/flowFormats'
|
|
26
|
+
export type { FlowGraph, FlowImportOptions, FlowExportOptions, FlowDotExportOptions } from './composables/flowFormats'
|
package/src/gantt.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as MGantt } from './components/MGantt.vue'
|
|
2
|
+
export { default as MGanttControls } from './components/MGanttControls.vue'
|
|
3
|
+
export { useGantt } from './composables/useGantt'
|
|
4
|
+
export type { GanttColumn, GanttContext, GanttScale } from './composables/useGantt'
|
|
5
|
+
export { scheduleTasks, criticalPath, rollupSummaries, workingDays, addWorkingDays, taskSpan } from './composables/ganttSchedule'
|
|
6
|
+
export type { GanttTask, GanttDependency, GanttCalendar, GanttScheduleOptions, GanttCriticalPath } from './composables/ganttSchedule'
|
|
7
|
+
export { toGanttCsv, parseGanttCsv, toGanttJson, parseGanttJson, toMsProjectXml, parseMsProjectXml } from './composables/ganttFormats'
|
|
8
|
+
export type { GanttCsvOptions, GanttXmlOptions } from './composables/ganttFormats'
|
|
9
|
+
export { default as MResourceTimeline } from './components/MResourceTimeline.vue'
|
|
10
|
+
export { useResourceTimeline } from './composables/useResourceTimeline'
|
|
11
|
+
export type { TimelineEvent, TimelineResource, ResourceTimelineContext } from './composables/useResourceTimeline'
|
|
12
|
+
export type { TimelineControls } from './composables/useGantt'
|
package/src/index.ts
CHANGED
|
@@ -126,6 +126,14 @@ export { default as MExportButton } from './components/MExportButton.vue'
|
|
|
126
126
|
export { default as MFab } from './components/MFab.vue'
|
|
127
127
|
export { default as MFabMenu } from './components/MFabMenu.vue'
|
|
128
128
|
export { default as MFileUpload } from './components/MFileUpload.vue'
|
|
129
|
+
export { default as MFloorPlan } from './components/MFloorPlan.vue'
|
|
130
|
+
export { default as MFloorPlanToolbar } from './components/MFloorPlanToolbar.vue'
|
|
131
|
+
export type { FloorTablePreset } from './components/MFloorPlanToolbar.vue'
|
|
132
|
+
export { default as MFloorPlanInspector } from './components/MFloorPlanInspector.vue'
|
|
133
|
+
export { useFloorPlan, floorDecorName } from './composables/useFloorPlan'
|
|
134
|
+
export type { FloorPlanContext, FloorTool, FloorItemKind } from './composables/useFloorPlan'
|
|
135
|
+
export type { FloorTable, FloorMerge, FloorStatus, FloorArea, FloorWall, FloorDecor, FloorPick, FloorDecorKind, FloorDecorBuiltin } from './components/MFloorPlan.vue'
|
|
136
|
+
export { default as MImageCropper } from './components/MImageCropper.vue'
|
|
129
137
|
export { default as MFixed } from './components/MFixed.vue'
|
|
130
138
|
export { default as MFooter } from './components/MFooter.vue'
|
|
131
139
|
export { default as MFlex } from './components/MFlex.vue'
|
|
@@ -254,6 +262,7 @@ export type { DataTableColumn, DataTableFetchParams } from './components/MDataTa
|
|
|
254
262
|
export type { DateRange } from './components/MDateRangePicker.vue'
|
|
255
263
|
export type { DragDropItem } from './components/MDragDropList.vue'
|
|
256
264
|
export type { UploadFile } from './components/MFileUpload.vue'
|
|
265
|
+
export type { CropRect, CropAspect, CropOutputOptions } from './components/MImageCropper.vue'
|
|
257
266
|
export type { HotkeyBinding } from './components/MHotkeys.vue'
|
|
258
267
|
export type { KanbanColumn, KanbanCard } from './components/MKanban.vue'
|
|
259
268
|
export type { NavBarItem } from './components/MNavigationBar.vue'
|