@stll/folio-vue 0.2.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/ListButtons-B498PX1d.js +4256 -0
- package/dist/ListButtons-D-zMJ7rl.cjs +4 -0
- package/dist/PageSetupDialog-CGBaBVzo.cjs +15 -0
- package/dist/PageSetupDialog-DsjAfJy0.js +4873 -0
- package/dist/TablePropertiesDialog-A-1Pm1f9.cjs +1 -0
- package/dist/TablePropertiesDialog-PyXEJC_o.js +887 -0
- package/dist/components/DocxEditor/pagedEditorRef.d.ts +75 -0
- package/dist/components/DocxEditor/types.d.ts +528 -0
- package/dist/components/EditorToolbarContext.d.ts +9 -0
- package/dist/components/FormattingBar.types.d.ts +67 -0
- package/dist/components/Toolbar/presets.d.ts +25 -0
- package/dist/components/dialogs/index.d.ts +24 -0
- package/dist/components/imageContextMenuTypes.d.ts +30 -0
- package/dist/components/imageSelectionTypes.d.ts +13 -0
- package/dist/components/insertTableState.d.ts +9 -0
- package/dist/components/sidebar/cardStyles.d.ts +1 -0
- package/dist/components/sidebar/cardUtils.d.ts +1 -0
- package/dist/components/sidebar/resolveItemPositions.d.ts +22 -0
- package/dist/components/sidebar/sidebarUtils.d.ts +4 -0
- package/dist/components/tableStylePresets.d.ts +60 -0
- package/dist/components/toolbarUtils.d.ts +3 -0
- package/dist/components/ui/AlignmentButtons.types.d.ts +13 -0
- package/dist/components/ui/StylePicker.types.d.ts +16 -0
- package/dist/components/ui/ZoomControl.types.d.ts +21 -0
- package/dist/components/ui/fontPickerValue.d.ts +1 -0
- package/dist/components/ui/hyperlinkPopupTypes.d.ts +20 -0
- package/dist/composables/commentMarks.d.ts +32 -0
- package/dist/composables/imageOverlayRect.d.ts +44 -0
- package/dist/composables/index.d.ts +30 -0
- package/dist/composables/useAutoSave.d.ts +39 -0
- package/dist/composables/useClipboard.d.ts +21 -0
- package/dist/composables/useColorMode.d.ts +8 -0
- package/dist/composables/useCommentLifecycle.d.ts +39 -0
- package/dist/composables/useCommentManagement.d.ts +47 -0
- package/dist/composables/useCommentSidebarItems.d.ts +24 -0
- package/dist/composables/useContextMenus.d.ts +64 -0
- package/dist/composables/useControllableBoolean.d.ts +16 -0
- package/dist/composables/useDocumentLifecycle.d.ts +11 -0
- package/dist/composables/useDocxEditor.d.ts +123 -0
- package/dist/composables/useDocxEditorRefApi.d.ts +68 -0
- package/dist/composables/useDragAutoScroll.d.ts +11 -0
- package/dist/composables/useFileIO.d.ts +43 -0
- package/dist/composables/useFindReplace.d.ts +22 -0
- package/dist/composables/useFixedDropdown.d.ts +14 -0
- package/dist/composables/useFormattingActions.d.ts +21 -0
- package/dist/composables/useHistory.d.ts +9 -0
- package/dist/composables/useHostCallbacks.d.ts +24 -0
- package/dist/composables/useHyperlinkManagement.d.ts +40 -0
- package/dist/composables/useImageActions.d.ts +25 -0
- package/dist/composables/useKeyboardShortcuts.d.ts +25 -0
- package/dist/composables/useMenuActions.d.ts +36 -0
- package/dist/composables/useOutlineSidebar.d.ts +24 -0
- package/dist/composables/usePageSetupControls.d.ts +28 -0
- package/dist/composables/usePagesPointer.d.ts +87 -0
- package/dist/composables/useParagraphStyleOptions.d.ts +18 -0
- package/dist/composables/usePortalClass.d.ts +8 -0
- package/dist/composables/useSelectionHighlight.d.ts +19 -0
- package/dist/composables/useSelectionSync.d.ts +30 -0
- package/dist/composables/useTableResize.d.ts +7 -0
- package/dist/composables/useTableSelection.d.ts +10 -0
- package/dist/composables/useToolbarDropdowns.d.ts +15 -0
- package/dist/composables/useToolbarFontSize.d.ts +15 -0
- package/dist/composables/useTrackedChanges.d.ts +12 -0
- package/dist/composables/useVisualLineNavigation.d.ts +11 -0
- package/dist/composables/useWheelZoom.d.ts +10 -0
- package/dist/composables/useZoom.d.ts +16 -0
- package/dist/composables.cjs +61 -0
- package/dist/composables.js +378 -0
- package/dist/dialogs.cjs +1 -0
- package/dist/dialogs.js +3 -0
- package/dist/folio-vue.css +2 -0
- package/dist/i18n/index.d.ts +36 -0
- package/dist/i18n/messages.d.ts +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +4088 -0
- package/dist/messages.cjs +1 -0
- package/dist/messages.js +1 -0
- package/dist/renderAsync.d.ts +35 -0
- package/dist/styles/index.d.ts +12 -0
- package/dist/styles/zIndex.d.ts +18 -0
- package/dist/styles.cjs +1 -0
- package/dist/styles.js +5 -0
- package/dist/ui/folio-ui.d.ts +139 -0
- package/dist/ui.cjs +1 -0
- package/dist/ui.d.ts +67 -0
- package/dist/ui.js +446 -0
- package/dist/useZoom-BryUw3Cu.cjs +1 -0
- package/dist/useZoom-CIIRid8U.js +626 -0
- package/dist/utils/aiEditRange.d.ts +26 -0
- package/dist/utils/autoScroll.d.ts +22 -0
- package/dist/utils/cardStyles.d.ts +3 -0
- package/dist/utils/colorMode.d.ts +32 -0
- package/dist/utils/comments.d.ts +20 -0
- package/dist/utils/cssTypes.d.ts +7 -0
- package/dist/utils/domQueries.d.ts +39 -0
- package/dist/utils/fontOptions.d.ts +26 -0
- package/dist/utils/hostFonts.d.ts +25 -0
- package/dist/utils/imageClipboard.d.ts +9 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/listState.d.ts +22 -0
- package/dist/utils/reportIssue.d.ts +18 -0
- package/dist/utils/selectionHighlight.d.ts +44 -0
- package/dist/utils/sidebarConstants.d.ts +8 -0
- package/dist/utils/stylePreview.d.ts +53 -0
- package/dist/utils/textSelection.d.ts +40 -0
- package/dist/zIndex-BY0qa8Au.js +12 -0
- package/dist/zIndex-dFsQbASx.cjs +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color-mode resolution shared by every adapter so the light/dark/auto logic
|
|
3
|
+
* (and its SSR + prefers-color-scheme handling) can't drift between hosts. The
|
|
4
|
+
* adapters keep only their framework binding (useState/useEffect vs
|
|
5
|
+
* ref/watchEffect); the rules live here.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
/** UI color theme for the editor chrome and canvas. */
|
|
10
|
+
export type ColorMode = "light" | "dark" | "system";
|
|
11
|
+
/**
|
|
12
|
+
* Current OS dark-mode preference. Returns false when `matchMedia` is
|
|
13
|
+
* unavailable (e.g. server-side render), so it is safe to call as a state seed.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare function prefersColorSchemeDark(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the effective dark flag from a {@link ColorMode} and the current OS
|
|
20
|
+
* preference. `'system'` follows the OS; `'dark'`/`'light'` are explicit.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveIsDark(colorMode: ColorMode, systemDark: boolean): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Subscribe to OS dark-mode changes. Invokes `onChange` immediately with the
|
|
27
|
+
* current value (so a stale seed is corrected on entry), then on every change.
|
|
28
|
+
* Returns an unsubscribe function. A no-op under SSR.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export declare function subscribeSystemDark(onChange: (dark: boolean) => void): () => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Paragraph } from '@stll/folio-core/types/content';
|
|
2
|
+
/** Extract plain text from a Comment's paragraph content. */
|
|
3
|
+
export declare function getCommentText(paragraphs?: Paragraph[]): string;
|
|
4
|
+
export declare function formatDate(dateStr?: string): string;
|
|
5
|
+
export declare function getInitials(name: string): string;
|
|
6
|
+
export declare function getAvatarColor(name: string): string;
|
|
7
|
+
export declare function truncateText(text: string, maxLength?: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* One tracked change surfaced by `extractTrackedChanges`. Re-exported verbatim
|
|
10
|
+
* from core so the sidebar consumes the extractor's exact output type: the Vue
|
|
11
|
+
* adapter used to keep a stricter hand-written copy (required where core's is
|
|
12
|
+
* optional, `?: T` where core's is `?: T | undefined`), which made
|
|
13
|
+
* `extractTrackedChanges(state).entries` unassignable to the sidebar props under
|
|
14
|
+
* `exactOptionalPropertyTypes`. Sharing core's type removes that drift entirely
|
|
15
|
+
* and keeps the accept/reject-by-id contract (`revisionId`,
|
|
16
|
+
* `insertionRevisionId`, `coalescedRevisionIds`) in one place.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export type { TrackedChangeEntry } from '@stll/folio-core/prosemirror/utils/extractTrackedChanges';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny shared CSSProperties shape so framework-agnostic style
|
|
3
|
+
* objects don't need to import from React or Vue. Both adapters'
|
|
4
|
+
* `CSSProperties` types are structurally compatible with this looser
|
|
5
|
+
* shape (string | number values, camelCased keys).
|
|
6
|
+
*/
|
|
7
|
+
export type CSSProperties = Record<string, string | number | undefined>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the painted header/footer instance nearest the viewport center — the
|
|
4
|
+
* one the user is editing. The same HF is painted on every page (shared
|
|
5
|
+
* `r:id`), so the chrome outline must track the active page rather than snap to
|
|
6
|
+
* page one's copy (mirrors core's `getHfDomSnapshot` host pick; #691).
|
|
7
|
+
*/
|
|
8
|
+
export declare function nearestHfHostEl(position: "header" | "footer"): HTMLElement | null;
|
|
9
|
+
/**
|
|
10
|
+
* Find the painted span containing `pmPos`. By default scoped to body spans
|
|
11
|
+
* (which carry both pmStart and pmEnd) so HF runs in the separate PM document
|
|
12
|
+
* don't mis-resolve double-/triple-click selection. When `hfSection` is set
|
|
13
|
+
* (the user is editing a header/footer), scope to that section's painted host
|
|
14
|
+
* instead — the HF spans live in `.layout-page-header` / `.layout-page-footer`
|
|
15
|
+
* and carry PM positions from the HF document, so resolving against body spans
|
|
16
|
+
* would compute word/paragraph bounds from the wrong text (#691).
|
|
17
|
+
*/
|
|
18
|
+
export declare function findElementAtPosition(container: HTMLElement, pmPos: number, hfSection?: "header" | "footer"): HTMLElement | null;
|
|
19
|
+
/**
|
|
20
|
+
* Smooth-scroll the viewport so the painted element at `pmPos` is
|
|
21
|
+
* visible (48px top padding). Falls back to a CSS attribute selector
|
|
22
|
+
* when no body span carries pmPos in its [start,end] range.
|
|
23
|
+
*/
|
|
24
|
+
export declare function scrollVisiblePositionIntoView(pagesContainer: HTMLElement | null, viewport: HTMLElement | null, pmPos: number): void;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a viewport-space click coordinate to a PM document position,
|
|
27
|
+
* clamped to `doc.content.size`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolvePos(pagesContainer: HTMLElement | null, view: EditorView | null, clientX: number, clientY: number): number | null;
|
|
30
|
+
/**
|
|
31
|
+
* Double-click word selection — expand `pos` to its word bounds and
|
|
32
|
+
* hand the resulting range to `setPmSelection`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function selectWord(pagesContainer: HTMLElement | null, pos: number, setPmSelection: (from: number, to: number) => void, hfSection?: "header" | "footer"): void;
|
|
35
|
+
/**
|
|
36
|
+
* Triple-click paragraph selection — expand `pos` to the enclosing
|
|
37
|
+
* `.layout-paragraph` element's PM range.
|
|
38
|
+
*/
|
|
39
|
+
export declare function selectParagraph(pagesContainer: HTMLElement | null, pos: number, setPmSelection: (from: number, to: number) => void, hfSection?: "header" | "footer"): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared FontOption shape + normaliser used by FontPicker components.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type FontOption = {
|
|
7
|
+
name: string;
|
|
8
|
+
fontFamily: string;
|
|
9
|
+
category?: "sans-serif" | "serif" | "monospace" | "other";
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Normalize a `fontFamilies` prop (mix of strings and FontOption
|
|
13
|
+
* objects) into a uniform `FontOption[]`. Returns `undefined` for
|
|
14
|
+
* `undefined` input so callers fall back to their built-in defaults.
|
|
15
|
+
* Strings expand into the `'other'` group with no CSS fallback chain.
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeFontFamilies(fontFamilies: ReadonlyArray<string | FontOption> | undefined): FontOption[] | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Drop fonts whose names already appear in `existingNames` (case-insensitive),
|
|
20
|
+
* also deduping the input. Used by the toolbar's font picker to render the
|
|
21
|
+
* "Document fonts" group without repeating a font the built-in list covers.
|
|
22
|
+
*
|
|
23
|
+
* Ported from the upstream core util `utils/documentPickerFonts.ts`; folio-core
|
|
24
|
+
* has no equivalent, so it lives with the Vue adapter's font helpers.
|
|
25
|
+
*/
|
|
26
|
+
export declare function excludeFontsByName(fonts: readonly FontOption[] | undefined, existingNames: Iterable<string>): FontOption[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FontDefinition } from '../components/DocxEditor/types';
|
|
2
|
+
/** `FontFace` constructor inputs derived from a {@link FontDefinition}. */
|
|
3
|
+
export type FontFaceInput = {
|
|
4
|
+
family: string;
|
|
5
|
+
source: string;
|
|
6
|
+
descriptors: FontFaceDescriptors;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Normalize the `fonts` prop into `FontFace` constructor inputs. Pure: no DOM
|
|
10
|
+
* work, so it is unit-testable. Entries that are not objects with non-empty
|
|
11
|
+
* string family/src are skipped (best-effort — never throw on host input); `src`
|
|
12
|
+
* becomes a CSS `url(...)` source string.
|
|
13
|
+
*/
|
|
14
|
+
export declare function toFontFaceInputs(fonts: ReadonlyArray<FontDefinition> | undefined): FontFaceInput[];
|
|
15
|
+
/** The document's `FontFaceSet`, or `null` outside a DOM. */
|
|
16
|
+
export declare function getDocumentFontSet(): FontFaceSet | null;
|
|
17
|
+
/**
|
|
18
|
+
* Register the host's custom font faces with the browser via the `FontFace` API.
|
|
19
|
+
* No-op (returns `[]`) outside a DOM or when no valid fonts are given. Returns
|
|
20
|
+
* the faces that loaded successfully; each bad entry is skipped, never thrown.
|
|
21
|
+
* Pair with {@link removeFontFaces} to unregister on change/unmount.
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadHostFontFaces(fonts: ReadonlyArray<FontDefinition> | undefined): Promise<FontFace[]>;
|
|
24
|
+
/** Remove previously registered faces from the document font set. */
|
|
25
|
+
export declare function removeFontFaces(faces: readonly FontFace[]): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
export declare function copyImageToClipboard(view: EditorView, pmPos: number): void;
|
|
3
|
+
export declare function blobToDataUrl(blob: Blob): Promise<string>;
|
|
4
|
+
export declare function loadImageDimensions(src: string): Promise<{
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function pasteFromClipboard(view: EditorView): Promise<void>;
|
|
9
|
+
export declare function triggerReplaceImage(view: EditorView, pmPos: number): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './autoScroll';
|
|
2
|
+
export * from './cardStyles';
|
|
3
|
+
export * from './colorMode';
|
|
4
|
+
export * from './comments';
|
|
5
|
+
export * from './cssTypes';
|
|
6
|
+
export * from './fontOptions';
|
|
7
|
+
export * from './listState';
|
|
8
|
+
export * from './reportIssue';
|
|
9
|
+
export * from './selectionHighlight';
|
|
10
|
+
export * from './sidebarConstants';
|
|
11
|
+
export * from './stylePreview';
|
|
12
|
+
export * from './textSelection';
|
|
13
|
+
export { findVerticalScrollParent, findVerticalScrollParentOrRoot, } from '@stll/folio-core/utils/findVerticalScrollParent';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure list-state helpers used by adapter toolbars to track whether the
|
|
3
|
+
* selection is in a bullet/numbered list and at what indent level.
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type ListType = "bullet" | "numbered" | "none";
|
|
8
|
+
export type ListState = {
|
|
9
|
+
type: ListType;
|
|
10
|
+
level: number;
|
|
11
|
+
isInList: boolean;
|
|
12
|
+
numId?: number | undefined;
|
|
13
|
+
};
|
|
14
|
+
export declare function createDefaultListState(): ListState;
|
|
15
|
+
export declare function createBulletListState(level?: number, numId?: number): ListState;
|
|
16
|
+
export declare function createNumberedListState(level?: number, numId?: number): ListState;
|
|
17
|
+
export declare function isBulletListState(state: ListState | undefined): boolean;
|
|
18
|
+
export declare function isNumberedListState(state: ListState | undefined): boolean;
|
|
19
|
+
export declare function isAnyListState(state: ListState | undefined): boolean;
|
|
20
|
+
export declare function getNextIndentLevel(currentLevel: number): number;
|
|
21
|
+
export declare function getPreviousIndentLevel(currentLevel: number): number;
|
|
22
|
+
export declare function toggleListType(state: ListState | undefined, targetType: ListType): ListState;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic helper to open a pre-filled GitHub "new issue" URL for the
|
|
3
|
+
* Help > Report issue action. GitHub doesn't allow file attachments via URL
|
|
4
|
+
* params, so the body asks the user to drag-drop their DOCX onto the issue
|
|
5
|
+
* after it opens.
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type ReportIssueEnv = {
|
|
10
|
+
userAgent?: string;
|
|
11
|
+
viewport?: {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
pageUrl?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function buildReportIssueUrl(env?: ReportIssueEnv): string;
|
|
18
|
+
export declare function openReportIssue(env?: ReportIssueEnv): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection highlight utilities.
|
|
3
|
+
*
|
|
4
|
+
* Custom visual highlighting for text selection that spans multiple runs, where
|
|
5
|
+
* the browser's native `::selection` pseudo-element renders inconsistently
|
|
6
|
+
* across elements with different backgrounds. Framework-agnostic DOM helpers:
|
|
7
|
+
* the adapter layer wires them to reactive state.
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
/** Highlight rectangle representing a selected region, in pixels. */
|
|
12
|
+
export type HighlightRect = {
|
|
13
|
+
left: number;
|
|
14
|
+
top: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
/** Selection highlight configuration. */
|
|
19
|
+
export type SelectionHighlightConfig = {
|
|
20
|
+
/** Background color for selection. */
|
|
21
|
+
backgroundColor: string;
|
|
22
|
+
/** Optional border color for selection. */
|
|
23
|
+
borderColor?: string;
|
|
24
|
+
/** Optional border radius, in pixels. */
|
|
25
|
+
borderRadius?: number;
|
|
26
|
+
/** Z-index for overlay. */
|
|
27
|
+
zIndex?: number;
|
|
28
|
+
/** Opacity for highlight. */
|
|
29
|
+
opacity?: number;
|
|
30
|
+
/** CSS `mix-blend-mode` for the overlay. */
|
|
31
|
+
mixBlendMode?: string;
|
|
32
|
+
};
|
|
33
|
+
/** Default selection highlight style (matches Word / Google Docs). */
|
|
34
|
+
export declare const DEFAULT_SELECTION_STYLE: SelectionHighlightConfig;
|
|
35
|
+
/** Get selection rectangles with adjacent-rect merging applied. */
|
|
36
|
+
export declare function getMergedSelectionRects(containerElement?: HTMLElement | null): HighlightRect[];
|
|
37
|
+
/** Whether there is an active, non-collapsed text selection. */
|
|
38
|
+
export declare function hasActiveSelection(): boolean;
|
|
39
|
+
/** Whether the current selection is within a specific element. */
|
|
40
|
+
export declare function isSelectionWithin(element: HTMLElement): boolean;
|
|
41
|
+
/** Inject selection highlight CSS into the document head. */
|
|
42
|
+
export declare function injectSelectionStyles(config?: SelectionHighlightConfig): void;
|
|
43
|
+
/** Whether selection styles are currently injected. */
|
|
44
|
+
export declare function areSelectionStylesInjected(): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Sidebar geometry constants so the page-shift and card-gap math stays
|
|
2
|
+
* consistent across adapters.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
* @public */
|
|
5
|
+
export declare const SIDEBAR_WIDTH = 340;
|
|
6
|
+
export declare const SIDEBAR_PAGE_GAP = 12;
|
|
7
|
+
export declare const SIDEBAR_DOCUMENT_SHIFT: number;
|
|
8
|
+
export declare const MIN_CARD_GAP = 8;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Style } from '@stll/folio-core/types/document';
|
|
2
|
+
/**
|
|
3
|
+
* Inline preview style for a paragraph-style dropdown item.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type StylePreviewProps = {
|
|
7
|
+
fontSize: string;
|
|
8
|
+
lineHeight: string;
|
|
9
|
+
fontWeight?: "bold";
|
|
10
|
+
fontStyle?: "italic";
|
|
11
|
+
color?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A resolved paragraph-style option (document order, with extracted visual
|
|
15
|
+
* fields). Adapters add their own localized label on top of `name`.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export type ResolvedStyleOption = {
|
|
19
|
+
styleId: string;
|
|
20
|
+
name: string;
|
|
21
|
+
priority: number;
|
|
22
|
+
fontSize?: number | undefined;
|
|
23
|
+
bold?: boolean | undefined;
|
|
24
|
+
italic?: boolean | undefined;
|
|
25
|
+
color?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
/** Dropdown preview sizes (px) for well-known styles, matching Google Docs. @public */
|
|
28
|
+
export declare const STYLE_PREVIEW_SIZES: Record<string, number>;
|
|
29
|
+
/** Styles rendered bold in the dropdown preview by default. @public */
|
|
30
|
+
export declare const STYLE_DEFAULT_BOLD: ReadonlySet<string>;
|
|
31
|
+
/** Default preview text color (hex, no `#`) for styles that don't set one. @public */
|
|
32
|
+
export declare const STYLE_DEFAULT_COLOR: Record<string, string>;
|
|
33
|
+
/** Google-Docs heading preview color. @public */
|
|
34
|
+
export declare const HEADING_COLOR = "#4a6c8c";
|
|
35
|
+
/**
|
|
36
|
+
* Build the inline preview style for a style option. `fontSize` is in
|
|
37
|
+
* half-points (OOXML); known styles use {@link STYLE_PREVIEW_SIZES} instead.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare function getStylePreviewProps(input: {
|
|
41
|
+
styleId: string;
|
|
42
|
+
fontSize?: number | undefined;
|
|
43
|
+
bold?: boolean | undefined;
|
|
44
|
+
italic?: boolean | undefined;
|
|
45
|
+
color?: string | undefined;
|
|
46
|
+
}): StylePreviewProps;
|
|
47
|
+
/**
|
|
48
|
+
* Filter the document's styles to the visible paragraph styles, extract their
|
|
49
|
+
* visual fields, and sort by UI priority: the list a toolbar style picker
|
|
50
|
+
* shows. Returns `[]` when there are no styles (adapters fall back to presets).
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveParagraphStyleOptions(styles: Style[] | undefined): ResolvedStyleOption[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text Selection Utilities
|
|
3
|
+
*
|
|
4
|
+
* Pure word-level boundary detection used for double-click (word) selection.
|
|
5
|
+
* The DOM-driven selection + multi-click helpers live in the adapter layer.
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Check if a character is a word character
|
|
11
|
+
*/
|
|
12
|
+
export declare function isWordCharacter(char: string | undefined): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Check if a character is whitespace
|
|
15
|
+
*/
|
|
16
|
+
export declare function isWhitespace(char: string | undefined): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Find word boundaries around a position in text.
|
|
19
|
+
* Returns [startIndex, endIndex] inclusive start, exclusive end.
|
|
20
|
+
*/
|
|
21
|
+
export declare function findWordBoundaries(text: string, position: number): [number, number];
|
|
22
|
+
/**
|
|
23
|
+
* Get the word at a position in text
|
|
24
|
+
*/
|
|
25
|
+
export declare function getWordAt(text: string, position: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* Word selection result
|
|
28
|
+
*/
|
|
29
|
+
export type WordSelectionResult = {
|
|
30
|
+
/** The selected word */
|
|
31
|
+
word: string;
|
|
32
|
+
/** Start index in the text (inclusive) */
|
|
33
|
+
startIndex: number;
|
|
34
|
+
/** End index in the text (exclusive) */
|
|
35
|
+
endIndex: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Find the word at a position and return detailed info
|
|
39
|
+
*/
|
|
40
|
+
export declare function findWordAt(text: string, position: number): WordSelectionResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={selectionOverlay:10,decorationLayer:11,imageOverlay:15,hfInlineEditor:10,ruler:30,dropdown:100,contextMenu:1e4};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
|
package/package.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stll/folio-vue",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Vue 3 editor for folio: a Word-document (.docx) editor for the browser, built on @stll/folio-core and ProseMirror.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"document-editor",
|
|
7
|
+
"docx",
|
|
8
|
+
"editor",
|
|
9
|
+
"ooxml",
|
|
10
|
+
"prosemirror",
|
|
11
|
+
"vue",
|
|
12
|
+
"word",
|
|
13
|
+
"wysiwyg"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/stella/folio",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/stella/folio/issues"
|
|
18
|
+
},
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"author": "STLL",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/stella/folio.git",
|
|
24
|
+
"directory": "packages/vue"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"sideEffects": [
|
|
31
|
+
"**/*.css"
|
|
32
|
+
],
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.js",
|
|
37
|
+
"require": "./dist/index.cjs"
|
|
38
|
+
},
|
|
39
|
+
"./ui": {
|
|
40
|
+
"types": "./dist/ui.d.ts",
|
|
41
|
+
"import": "./dist/ui.js",
|
|
42
|
+
"require": "./dist/ui.cjs"
|
|
43
|
+
},
|
|
44
|
+
"./composables": {
|
|
45
|
+
"types": "./dist/composables/index.d.ts",
|
|
46
|
+
"import": "./dist/composables.js",
|
|
47
|
+
"require": "./dist/composables.cjs"
|
|
48
|
+
},
|
|
49
|
+
"./dialogs": {
|
|
50
|
+
"types": "./dist/components/dialogs/index.d.ts",
|
|
51
|
+
"import": "./dist/dialogs.js",
|
|
52
|
+
"require": "./dist/dialogs.cjs"
|
|
53
|
+
},
|
|
54
|
+
"./styles": {
|
|
55
|
+
"types": "./dist/styles/index.d.ts",
|
|
56
|
+
"import": "./dist/styles.js",
|
|
57
|
+
"require": "./dist/styles.cjs"
|
|
58
|
+
},
|
|
59
|
+
"./messages": {
|
|
60
|
+
"types": "./dist/i18n/messages.d.ts",
|
|
61
|
+
"import": "./dist/messages.js",
|
|
62
|
+
"require": "./dist/messages.cjs"
|
|
63
|
+
},
|
|
64
|
+
"./editor.css": "./dist/folio-vue.css"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public"
|
|
68
|
+
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"build": "rm -rf dist && vite build",
|
|
71
|
+
"prepack": "bun run build",
|
|
72
|
+
"pack:dry-run": "bun pm pack --dry-run",
|
|
73
|
+
"typecheck": "vue-tsc --noEmit -p tsconfig.build.json",
|
|
74
|
+
"test": "bun test src"
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@stll/folio-core": "^0.2.0",
|
|
78
|
+
"better-result": "2.9.2",
|
|
79
|
+
"use-intl": "^4.13.0",
|
|
80
|
+
"yjs": "^13.6.31"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@tailwindcss/cli": "4.3.1",
|
|
84
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
85
|
+
"tailwindcss": "4.3.1",
|
|
86
|
+
"vite": "8.0.16",
|
|
87
|
+
"vite-plugin-dts": "^5.0.3",
|
|
88
|
+
"vue": "^3.5.39",
|
|
89
|
+
"vue-tsc": "^3.3.6"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"prosemirror-history": "^1.4.0",
|
|
93
|
+
"prosemirror-model": "^1.19.4",
|
|
94
|
+
"prosemirror-state": "^1.4.3",
|
|
95
|
+
"prosemirror-tables": "^1.8.5",
|
|
96
|
+
"prosemirror-view": "^1.41.6",
|
|
97
|
+
"vue": "^3.3.0"
|
|
98
|
+
}
|
|
99
|
+
}
|