@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 @@
|
|
|
1
|
+
var e=require("@stll/folio-core/i18n/messages");Object.keys(e).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@stll/folio-core/i18n/messages";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Document } from '@stll/folio-core/types/document';
|
|
2
|
+
import { DocxInput } from '@stll/folio-core/utils/docxInput';
|
|
3
|
+
import { DocxEditorProps } from './components/DocxEditor/types';
|
|
4
|
+
/** Framework-agnostic handle for an imperatively mounted editor instance. */
|
|
5
|
+
export type EditorHandle = {
|
|
6
|
+
/** Save the document and return the DOCX as a Blob. */
|
|
7
|
+
save: () => Promise<Blob | null>;
|
|
8
|
+
/** Get the current parsed document model. */
|
|
9
|
+
getDocument: () => Document | null;
|
|
10
|
+
/** Focus the editor. */
|
|
11
|
+
focus: () => void;
|
|
12
|
+
/** Unmount the editor and clean up. */
|
|
13
|
+
destroy: () => void;
|
|
14
|
+
};
|
|
15
|
+
/** Vue-specific handle with zoom and scroll helpers. */
|
|
16
|
+
export type DocxEditorHandle = EditorHandle & {
|
|
17
|
+
/** Set zoom level (1.0 = 100%). */
|
|
18
|
+
setZoom: (zoom: number) => void;
|
|
19
|
+
/** Scroll the visible pages to a raw ProseMirror document position. */
|
|
20
|
+
scrollToPosition: (pmPos: number) => void;
|
|
21
|
+
/** Scroll the visible pages to a 1-indexed page number. */
|
|
22
|
+
scrollToPage: (pageNumber: number) => void;
|
|
23
|
+
};
|
|
24
|
+
/** Options for {@link renderAsync}. */
|
|
25
|
+
export type RenderAsyncOptions = Omit<DocxEditorProps, "documentBuffer" | "document"> & {
|
|
26
|
+
/** BCP-47 locale for bundled folio UI strings (default: `en`). */
|
|
27
|
+
locale?: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Render a DOCX editor into a container element using Vue.
|
|
31
|
+
*
|
|
32
|
+
* Resolves once the document has parsed and the editor emits `ready`.
|
|
33
|
+
* Rejects if `error` runs before that milestone.
|
|
34
|
+
*/
|
|
35
|
+
export declare const renderAsync: (input: DocxInput, container: HTMLElement, options?: RenderAsyncOptions) => Promise<DocxEditorHandle>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@stll/folio-vue/styles`
|
|
3
|
+
*
|
|
4
|
+
* CSS import-path constant and shared layering tokens. Bring in the editor's
|
|
5
|
+
* base styles by importing `@stll/folio-vue/editor.css` directly; this module
|
|
6
|
+
* exists for tooling that prefers a JS-style import.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare const EDITOR_CSS_PATH = "@stll/folio-vue/editor.css";
|
|
12
|
+
export * from './zIndex';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Z-index stacking order for the Vue editor chrome — mirrors the React
|
|
3
|
+
* adapter's layering so layered UI stays consistent across adapters instead of
|
|
4
|
+
* drifting into ad-hoc per-component numbers.
|
|
5
|
+
*
|
|
6
|
+
* Order, low to high: page content (0) < selection overlay < decoration layer
|
|
7
|
+
* < image overlay < HF inline editor < ruler < dropdown/popover < context
|
|
8
|
+
* menu/modal.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Z_INDEX: {
|
|
11
|
+
readonly selectionOverlay: 10;
|
|
12
|
+
readonly decorationLayer: 11;
|
|
13
|
+
readonly imageOverlay: 15;
|
|
14
|
+
readonly hfInlineEditor: 10;
|
|
15
|
+
readonly ruler: 30;
|
|
16
|
+
readonly dropdown: 100;
|
|
17
|
+
readonly contextMenu: 10000;
|
|
18
|
+
};
|
package/dist/styles.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./zIndex-dFsQbASx.cjs");var t=`@stll/folio-vue/editor.css`;exports.EDITOR_CSS_PATH=t,exports.Z_INDEX=e.t;
|
package/dist/styles.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* The Button prop subset folio's chrome relies on. `variant` and `size` are
|
|
4
|
+
* narrow string-literal unions (a subset of the design-system Button's options)
|
|
5
|
+
* so an external Button stays assignable as an override. Native `<button>`
|
|
6
|
+
* attributes fall through Vue's attribute inheritance and are not re-declared.
|
|
7
|
+
*/
|
|
8
|
+
export type FolioButtonProps = {
|
|
9
|
+
variant?: "default" | "ghost";
|
|
10
|
+
size?: "sm" | "xs" | "icon-xs";
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A color preset rendered as a swatch in the picker. Mirrors the React contract
|
|
16
|
+
* so a cross-framework design system can share the preset shape; `color` is the
|
|
17
|
+
* optional CSS color for the swatch (falls back to `#${value}`), and `value` is
|
|
18
|
+
* what selection emits.
|
|
19
|
+
*/
|
|
20
|
+
export type ColorPreset = {
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
color?: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The ColorPicker prop subset folio's chrome relies on. Mirrors the Vue
|
|
27
|
+
* `ui/ColorPicker.vue` surface: `mode` selects the text/highlight/border
|
|
28
|
+
* behaviour, `value` is the current color, `theme` resolves theme colors, and
|
|
29
|
+
* the component emits `change` with the picked color. A design-system picker
|
|
30
|
+
* accepting a superset stays assignable as an override.
|
|
31
|
+
*/
|
|
32
|
+
export type FolioColorPickerProps = {
|
|
33
|
+
mode: "text" | "highlight" | "border";
|
|
34
|
+
value?: string | undefined;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
className?: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The Popover prop subset folio's chrome relies on. Mirrors the Vue
|
|
40
|
+
* `ui/Popover.vue` surface: `open` controls visibility, `placement` positions
|
|
41
|
+
* the panel, and the component emits `close` / `update:open`. Consumers supply
|
|
42
|
+
* the trigger and panel via the `trigger` / `panel` slots.
|
|
43
|
+
*/
|
|
44
|
+
export type FolioPopoverProps = {
|
|
45
|
+
open: boolean;
|
|
46
|
+
placement?: "bottom-left" | "bottom-right" | "top-left" | "top-right";
|
|
47
|
+
closeOnScroll?: boolean;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* One entry in a folio menu. Mirrors the Vue `ui/MenuDropdown.vue` `MenuEntry`
|
|
51
|
+
* shape so an external Menu stays assignable as an override.
|
|
52
|
+
*/
|
|
53
|
+
export type FolioMenuItem = {
|
|
54
|
+
type?: "item";
|
|
55
|
+
label: string;
|
|
56
|
+
onSelect?: () => void;
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
shortcut?: string;
|
|
59
|
+
};
|
|
60
|
+
export type FolioMenuProps = {
|
|
61
|
+
label: string;
|
|
62
|
+
items: ReadonlyArray<FolioMenuItem | {
|
|
63
|
+
type: "separator";
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* One entry in the document outline. Mirrors the React contract's item shape so
|
|
68
|
+
* a cross-framework design system can share it. The Vue adapter does not yet
|
|
69
|
+
* inject an OutlineRail primitive (no Vue default exists); the type is exported
|
|
70
|
+
* for parity with the React surface.
|
|
71
|
+
*/
|
|
72
|
+
export type OutlineItem = {
|
|
73
|
+
id: string;
|
|
74
|
+
label: string;
|
|
75
|
+
/** Nesting depth; drives indent + tick taper. */
|
|
76
|
+
level: number;
|
|
77
|
+
/** Optional trailing annotation in the panel (e.g. a page number). */
|
|
78
|
+
meta?: string;
|
|
79
|
+
/** Optional CSS custom-property name colouring this entry. */
|
|
80
|
+
color?: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The injectable chrome primitives. Each entry is a Vue component the chrome
|
|
84
|
+
* renders; a host overrides any subset through `DocxEditor`'s `components` prop.
|
|
85
|
+
*
|
|
86
|
+
* Values are typed as the loose Vue {@link Component} rather than
|
|
87
|
+
* `Component<FolioButtonProps>` etc.: Vue's `Component<P>` is invariant in `P`
|
|
88
|
+
* (unlike React's contravariant `ComponentType<P>`), so a default or override
|
|
89
|
+
* accepting a *superset* of props would not be assignable to a prop-parameterized
|
|
90
|
+
* slot. The per-primitive prop contract a host implements is documented by the
|
|
91
|
+
* exported `Folio*Props` types ({@link FolioButtonProps},
|
|
92
|
+
* {@link FolioColorPickerProps}, {@link FolioPopoverProps}, {@link FolioMenuProps});
|
|
93
|
+
* consumers render the resolved component and pass those props at the call site.
|
|
94
|
+
*/
|
|
95
|
+
export type FolioUIComponents = {
|
|
96
|
+
Button: Component;
|
|
97
|
+
ColorPicker: Component;
|
|
98
|
+
Popover: Component;
|
|
99
|
+
Menu: Component;
|
|
100
|
+
};
|
|
101
|
+
export declare const DEFAULT_COMPONENTS: FolioUIComponents;
|
|
102
|
+
/**
|
|
103
|
+
* Merge a consumer's partial overrides over the built-in defaults: every key is
|
|
104
|
+
* present (defaults fill the gaps), and each provided override wins. Pure, so
|
|
105
|
+
* the resolution contract is testable independently of Vue.
|
|
106
|
+
*/
|
|
107
|
+
export declare function resolveFolioComponents(components?: Partial<FolioUIComponents>): FolioUIComponents;
|
|
108
|
+
/**
|
|
109
|
+
* Provide the resolved primitive map to descendants. `DocxEditor` calls this in
|
|
110
|
+
* setup with its `components` prop; chrome descendants read it via
|
|
111
|
+
* {@link useFolioUI}.
|
|
112
|
+
*/
|
|
113
|
+
export declare function provideFolioUI(components?: Partial<FolioUIComponents>): void;
|
|
114
|
+
/**
|
|
115
|
+
* Read the resolved primitive map. Falls back to {@link DEFAULT_COMPONENTS} when
|
|
116
|
+
* no provider is present (chrome rendered standalone, outside `DocxEditor`).
|
|
117
|
+
*/
|
|
118
|
+
export declare function useFolioUI(): FolioUIComponents;
|
|
119
|
+
/**
|
|
120
|
+
* Provider component mirroring React's `FolioUIProvider`. Wraps a subtree and
|
|
121
|
+
* provides the resolved primitive map; renders its default slot unchanged.
|
|
122
|
+
* Defined here (a `.ts` module) rather than as a `.vue` SFC so it re-exports as
|
|
123
|
+
* a named export the Nuxt `tsc` typecheck can resolve.
|
|
124
|
+
*/
|
|
125
|
+
export declare const FolioUIProvider: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
126
|
+
components: {
|
|
127
|
+
type: () => Partial<FolioUIComponents> | undefined;
|
|
128
|
+
default: undefined;
|
|
129
|
+
};
|
|
130
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
131
|
+
[key: string]: any;
|
|
132
|
+
}>[] | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
133
|
+
components: {
|
|
134
|
+
type: () => Partial<FolioUIComponents> | undefined;
|
|
135
|
+
default: undefined;
|
|
136
|
+
};
|
|
137
|
+
}>> & Readonly<{}>, {
|
|
138
|
+
components: Partial<FolioUIComponents> | undefined;
|
|
139
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
package/dist/ui.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./PageSetupDialog-CGBaBVzo.cjs"),t=require("./ListButtons-D-zMJ7rl.cjs"),n=require("./TablePropertiesDialog-A-1Pm1f9.cjs");let r=require("vue");require("@stll/folio-core/utils/units");var i={class:`docx-editor-toolbar`},a={class:`docx-editor-toolbar__title-row`},o={class:`docx-editor-toolbar__title-left`},s={class:`docx-editor-toolbar__title-center`},c={class:`docx-editor-toolbar__title-right`},l=(0,r.defineComponent)({inheritAttrs:!1,__name:`EditorToolbar`,props:{showMenuBar:{type:Boolean,default:!0}},emits:[`menu-action`],setup(e){return(n,l)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,i,[(0,r.renderSlot)(n.$slots,`title-bar`,{},()=>[(0,r.createElementVNode)(`div`,a,[(0,r.createElementVNode)(`div`,o,[(0,r.renderSlot)(n.$slots,`title-bar-left`,{},void 0,!0)]),(0,r.createElementVNode)(`div`,s,[(0,r.renderSlot)(n.$slots,`document-name`,{},void 0,!0),e.showMenuBar?((0,r.openBlock)(),(0,r.createBlock)(t.A,{key:0,onAction:l[0]||=e=>n.$emit(`menu-action`,e)})):(0,r.createCommentVNode)(``,!0)]),(0,r.createElementVNode)(`div`,c,[(0,r.renderSlot)(n.$slots,`title-bar-right`,{},void 0,!0)])])],!0),(0,r.renderSlot)(n.$slots,`toolbar`,{},()=>[(0,r.createVNode)(t.b,(0,r.normalizeProps)((0,r.guardReactiveProps)(n.$attrs)),null,16)],!0)]))}}),u=e.u(l,[[`__scopeId`,`data-v-f2023632`]]),d={},f={class:`docx-title-bar`},p={class:`docx-title-bar__left`},m={class:`docx-title-bar__center`},h={class:`docx-title-bar__right`};function g(e,t){return(0,r.openBlock)(),(0,r.createElementBlock)(`div`,f,[(0,r.createElementVNode)(`div`,p,[(0,r.renderSlot)(e.$slots,`left`,{},void 0,!0)]),(0,r.createElementVNode)(`div`,m,[(0,r.renderSlot)(e.$slots,`default`,{},void 0,!0)]),(0,r.createElementVNode)(`div`,h,[(0,r.renderSlot)(e.$slots,`right`,{},void 0,!0)])])}var _=e.u(d,[[`render`,g],[`__scopeId`,`data-v-ae11d49f`]]);function v(e){let t=e.trim();if(!t)return``;let n=null,r=``;for(let e of t){if((e===`"`||e===`'`)&&n===null){n=e,r+=e;continue}if(e===n){n=null,r+=e;continue}if(e===`,`&&n===null)break;r+=e}return r.trim().replace(/^['"]|['"]$/g,``)}var y=[`value`,`disabled`],b={key:0,label:`Sans-serif`},x=[`value`],S={key:1,label:`Serif`},C=[`value`],w={key:2,label:`Monospace`},T=[`value`],E={key:3,label:`Other`},D=[`value`],O=(0,r.defineComponent)({__name:`FontPicker`,props:{value:{},fonts:{},disabled:{type:Boolean,default:!1},className:{},placeholder:{default:`Font`},showPreview:{type:Boolean,default:!0}},emits:[`change`],setup(e,{emit:t}){let n=e,i=t,a=[{name:`Arial`,fontFamily:`Arial, Helvetica, sans-serif`,category:`sans-serif`},{name:`Calibri`,fontFamily:`"Calibri", Arial, sans-serif`,category:`sans-serif`},{name:`Helvetica`,fontFamily:`Helvetica, Arial, sans-serif`,category:`sans-serif`},{name:`Verdana`,fontFamily:`Verdana, Geneva, sans-serif`,category:`sans-serif`},{name:`Open Sans`,fontFamily:`"Open Sans", sans-serif`,category:`sans-serif`},{name:`Roboto`,fontFamily:`Roboto, sans-serif`,category:`sans-serif`},{name:`Times New Roman`,fontFamily:`"Times New Roman", Times, serif`,category:`serif`},{name:`Georgia`,fontFamily:`Georgia, serif`,category:`serif`},{name:`Cambria`,fontFamily:`Cambria, Georgia, serif`,category:`serif`},{name:`Garamond`,fontFamily:`Garamond, serif`,category:`serif`},{name:`Courier New`,fontFamily:`"Courier New", monospace`,category:`monospace`},{name:`Consolas`,fontFamily:`Consolas, monospace`,category:`monospace`}],o=(0,r.computed)(()=>n.fonts??a),s=(0,r.computed)(()=>{let e={"sans-serif":[],serif:[],monospace:[],other:[]};for(let t of o.value)e[t.category??`other`].push(t);return e}),c=(0,r.computed)(()=>{let e=n.value;if(!e)return n.placeholder;let t=e.toLowerCase();return o.value.find(n=>n.fontFamily===e||n.name.toLowerCase()===t||v(n.fontFamily).toLowerCase()===t)?.name??e});function l(e){if(!(e.target instanceof HTMLSelectElement))return;let t=e.target.value,n=o.value.find(e=>e.name===t);i(`change`,n?v(n.fontFamily)||n.name:t)}return(t,n)=>((0,r.openBlock)(),(0,r.createElementBlock)(`select`,{class:(0,r.normalizeClass)([`docx-font-picker`,e.className]),value:c.value,disabled:e.disabled,"aria-label":`Font family`,onChange:l},[s.value[`sans-serif`].length?((0,r.openBlock)(),(0,r.createElementBlock)(`optgroup`,b,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(s.value[`sans-serif`],t=>((0,r.openBlock)(),(0,r.createElementBlock)(`option`,{key:t.name,value:t.name,style:(0,r.normalizeStyle)(e.showPreview?{fontFamily:t.fontFamily}:void 0)},(0,r.toDisplayString)(t.name),13,x))),128))])):(0,r.createCommentVNode)(``,!0),s.value.serif.length?((0,r.openBlock)(),(0,r.createElementBlock)(`optgroup`,S,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(s.value.serif,t=>((0,r.openBlock)(),(0,r.createElementBlock)(`option`,{key:t.name,value:t.name,style:(0,r.normalizeStyle)(e.showPreview?{fontFamily:t.fontFamily}:void 0)},(0,r.toDisplayString)(t.name),13,C))),128))])):(0,r.createCommentVNode)(``,!0),s.value.monospace.length?((0,r.openBlock)(),(0,r.createElementBlock)(`optgroup`,w,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(s.value.monospace,t=>((0,r.openBlock)(),(0,r.createElementBlock)(`option`,{key:t.name,value:t.name,style:(0,r.normalizeStyle)(e.showPreview?{fontFamily:t.fontFamily}:void 0)},(0,r.toDisplayString)(t.name),13,T))),128))])):(0,r.createCommentVNode)(``,!0),s.value.other.length?((0,r.openBlock)(),(0,r.createElementBlock)(`optgroup`,E,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(s.value.other,t=>((0,r.openBlock)(),(0,r.createElementBlock)(`option`,{key:t.name,value:t.name,style:(0,r.normalizeStyle)(e.showPreview?{fontFamily:t.fontFamily}:void 0)},(0,r.toDisplayString)(t.name),13,D))),128))])):(0,r.createCommentVNode)(``,!0)],42,y))}}),k=e.u(O,[[`__scopeId`,`data-v-1a9a9f88`]]),A={class:`docx-font-size`},j=[`disabled`],M=[`value`,`disabled`,`placeholder`],N=[`disabled`],P=(0,r.defineComponent)({__name:`FontSizePicker`,props:{value:{},sizes:{},disabled:{type:Boolean,default:!1},minSize:{default:1},maxSize:{default:1638},placeholder:{default:`11`}},emits:[`change`],setup(e,{emit:t}){let n=e,i=t,a=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],o=(0,r.computed)(()=>n.sizes??a),s=(0,r.computed)(()=>n.value??parseInt(n.placeholder,10)??11),c=(0,r.computed)(()=>n.value===void 0?n.placeholder:String(n.value));function l(e){return o.value.find(t=>t>e)??Math.min(e+1,n.maxSize)}function u(e){return[...o.value].reverse().find(t=>t<e)??Math.max(e-1,n.minSize)}function d(){n.disabled||i(`change`,u(s.value))}function f(){n.disabled||i(`change`,l(s.value))}function p(e){if(!(e.target instanceof HTMLInputElement))return;let t=parseFloat(e.target.value);!isNaN(t)&&t>=n.minSize&&t<=n.maxSize&&i(`change`,Math.round(t*2)/2)}return(t,n)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,A,[(0,r.createElementVNode)(`button`,{type:`button`,class:`docx-font-size__btn`,disabled:e.disabled||s.value<=e.minSize,title:`Decrease font size`,onClick:(0,r.withModifiers)(d,[`prevent`])},`−`,8,j),(0,r.createElementVNode)(`input`,{class:`docx-font-size__input`,type:`text`,value:c.value,disabled:e.disabled,placeholder:e.placeholder,onKeydown:[n[0]||=(0,r.withKeys)((0,r.withModifiers)(e=>{d(),e.stopPropagation()},[`prevent`]),[`up`]),n[1]||=(0,r.withKeys)((0,r.withModifiers)(e=>{f(),e.stopPropagation()},[`prevent`]),[`down`]),n[2]||=(0,r.withKeys)((0,r.withModifiers)(e=>p(e),[`prevent`]),[`enter`])],onBlur:n[3]||=e=>p(e)},null,40,M),(0,r.createElementVNode)(`button`,{type:`button`,class:`docx-font-size__btn`,disabled:e.disabled||s.value>=e.maxSize,title:`Increase font size`,onClick:(0,r.withModifiers)(f,[`prevent`])},`+`,8,N)]))}}),F=e.u(P,[[`__scopeId`,`data-v-4e8ada55`]]),I=[`value`,`disabled`],L=[`value`],R=(0,r.defineComponent)({__name:`LineSpacingPicker`,props:{value:{},options:{},disabled:{type:Boolean,default:!1},className:{}},emits:[`change`],setup(e,{emit:t}){let n=e,i=t,a=[{label:`Single`,value:1,twipsValue:240},{label:`1.15`,value:1.15,twipsValue:276},{label:`1.5`,value:1.5,twipsValue:360},{label:`Double`,value:2,twipsValue:480}],o=(0,r.computed)(()=>n.options??a),s=(0,r.computed)(()=>n.value??o.value[0]?.twipsValue??240);function c(e){if(!(e.target instanceof HTMLSelectElement))return;let t=parseInt(e.target.value,10);isNaN(t)||i(`change`,t)}return(t,n)=>((0,r.openBlock)(),(0,r.createElementBlock)(`select`,{class:(0,r.normalizeClass)([`docx-line-spacing`,e.className]),value:String(s.value),disabled:e.disabled,"aria-label":`Line spacing`,onChange:c},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(o.value,e=>((0,r.openBlock)(),(0,r.createElementBlock)(`option`,{key:e.twipsValue,value:String(e.twipsValue)},(0,r.toDisplayString)(e.label),9,L))),128))],42,I))}}),z=e.u(R,[[`__scopeId`,`data-v-fcda8ecc`]]),B=[`disabled`,`aria-expanded`,`title`,`onClick`],V={class:`docx-table-grid__panel`},H={class:`docx-table-grid__label`},U=[`onMouseenter`,`onClick`],W=(0,r.defineComponent)({__name:`TableGridPicker`,props:{disabled:{type:Boolean,default:!1},gridRows:{default:5},gridColumns:{default:5},tooltip:{default:`Insert table`}},emits:[`insert`],setup(e,{emit:n}){let i=e,a=n,o=(0,r.ref)(!1),s=(0,r.ref)({rows:1,cols:1}),c=(0,r.computed)(()=>{let e=[];for(let t=1;t<=i.gridRows;t++)for(let n=1;n<=i.gridColumns;n++)e.push({r:t,c:n});return e});function l(e,t){a(`insert`,e,t),o.value=!1}function u(){o.value=!1,s.value={rows:1,cols:1}}return(n,i)=>((0,r.openBlock)(),(0,r.createBlock)(t.N,{open:o.value,"onUpdate:open":i[0]||=e=>o.value=e,onClose:u},{trigger:(0,r.withCtx)(({toggle:n})=>[(0,r.createElementVNode)(`button`,{type:`button`,class:`docx-table-grid__btn`,disabled:e.disabled,"aria-expanded":o.value,"aria-haspopup":`grid`,title:e.tooltip,onClick:(0,r.withModifiers)(n,[`prevent`])},[(0,r.createVNode)(t.I,{name:`grid_on`,size:20})],8,B)]),panel:(0,r.withCtx)(()=>[(0,r.createElementVNode)(`div`,V,[(0,r.createElementVNode)(`div`,H,(0,r.toDisplayString)(s.value.rows)+` × `+(0,r.toDisplayString)(s.value.cols),1),(0,r.createElementVNode)(`div`,{class:`docx-table-grid__grid`,style:(0,r.normalizeStyle)({gridTemplateColumns:`repeat(${e.gridColumns}, 18px)`})},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(c.value,e=>((0,r.openBlock)(),(0,r.createElementBlock)(`button`,{key:`${e.r}-${e.c}`,class:(0,r.normalizeClass)([`docx-table-grid__cell`,{"docx-table-grid__cell--active":e.r<=s.value.rows&&e.c<=s.value.cols}]),onMouseenter:t=>s.value={rows:e.r,cols:e.c},onClick:(0,r.withModifiers)(t=>l(e.r,e.c),[`prevent`])},null,42,U))),128))],4)])]),_:1},8,[`open`]))}}),G=e.u(W,[[`__scopeId`,`data-v-34f6875c`]]),K=[`disabled`,`title`],q={key:0,class:`print-btn__icon`},J=(0,r.defineComponent)({__name:`PrintButton`,props:{disabled:{type:Boolean,default:!1},label:{default:`Print`},compact:{type:Boolean,default:!1}},emits:[`print`],setup(e,{emit:t}){let n=e,i=t;function a(){n.disabled||(i(`print`),window.print())}return(t,n)=>((0,r.openBlock)(),(0,r.createElementBlock)(`button`,{class:`print-btn`,disabled:e.disabled,title:e.label,onMousedown:(0,r.withModifiers)(a,[`prevent`])},[(0,r.createTextVNode)((0,r.toDisplayString)(e.compact?``:e.label)+` `,1),e.compact?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,q,`🖨`)):(0,r.createCommentVNode)(``,!0)],40,K))}}),Y=e.u(J,[[`__scopeId`,`data-v-3e413c06`]]),X={padding:`8px 10px`,borderRadius:8,backgroundColor:`var(--doc-card)`,cursor:`pointer`,boxShadow:`var(--doc-card-shadow)`},Z={padding:`10px 12px`,borderRadius:8,backgroundColor:`var(--doc-surface)`,cursor:`pointer`,boxShadow:`var(--doc-card-shadow-strong)`};exports.AddCommentCard=t.o,exports.AlignmentButtons=t.r,exports.Button=t.T,exports.CARD_STYLE_COLLAPSED=X,exports.CARD_STYLE_EXPANDED=Z,exports.ColorPicker=t.w,exports.CommentCard=t.l,exports.CommentMarginMarkers=t.F,exports.DocumentName=t.P,exports.EditingModeDropdown=t.E,exports.EditorToolbar=u,exports.FindReplaceDialog=e.a,exports.FontPicker=k,exports.FontSizePicker=F,exports.FootnotePropertiesDialog=n.i,exports.HorizontalRuler=t.y,exports.HyperlinkDialog=e.i,exports.IconGridDropdown=t.k,exports.ImagePositionDialog=n.r,exports.ImagePropertiesDialog=e.r,exports.ImageTransformDropdown=t.D,exports.ImageWrapDropdown=t.O,exports.InsertSymbolDialog=e.n,exports.InsertTableDialog=n.n,exports.LineSpacingPicker=z,exports.ListButtons=t.t,exports.MenuBar=t.A,exports.MenuDropdown=t.M,exports.PageSetupDialog=e.t,exports.Popover=t.N,exports.PrintButton=Y,exports.ReplyInput=t.u,exports.ReplyThread=t.d,exports.ResolvedCommentMarker=t.c,exports.StylePicker=t.i,exports.TableBorderColorPicker=t._,exports.TableBorderPicker=t.v,exports.TableBorderWidthPicker=t.g,exports.TableCellFillPicker=t.h,exports.TableGridInline=t.j,exports.TableGridPicker=G,exports.TableMoreDropdown=t.m,exports.TablePropertiesDialog=n.t,exports.TableStyleGallery=n.a,exports.TableToolbar=t.p,exports.TitleBar=_,exports.Toolbar=t.b,exports.TrackedChangeCard=t.s,exports.UnifiedSidebar=t.a,exports.VerticalRuler=t.f;
|
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@stll/folio-vue/ui`
|
|
3
|
+
*
|
|
4
|
+
* UI entry point — toolbar primitives, pickers, table/image controls, sidebar
|
|
5
|
+
* cards, and dialogs. Mirrors `packages/react/src/ui.ts` (and upstream's Vue
|
|
6
|
+
* `ui.ts`), limited to the components the fork has ported. Components without a
|
|
7
|
+
* Vue equivalent yet (ResponsiveToolbar, ZoomControl, Tooltip, LoadingIndicator,
|
|
8
|
+
* TableInsertButtons, TableMergeButton, UnsavedIndicator, PrintPreview, and the
|
|
9
|
+
* InsertImage / KeyboardShortcuts / PasteSpecial / SplitCell dialogs) are omitted.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Toolbar, FontPicker, ColorPicker } from "@stll/folio-vue/ui";
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export { default as Toolbar } from './components/Toolbar.vue';
|
|
20
|
+
export { default as EditorToolbar } from './components/EditorToolbar.vue';
|
|
21
|
+
export { default as TitleBar } from './components/TitleBar.vue';
|
|
22
|
+
export { default as MenuBar } from './components/MenuBar.vue';
|
|
23
|
+
export { default as MenuDropdown } from './components/ui/MenuDropdown.vue';
|
|
24
|
+
export { default as DocumentName } from './components/DocumentName.vue';
|
|
25
|
+
export { default as EditingModeDropdown } from './components/EditingModeDropdown.vue';
|
|
26
|
+
export { default as FontPicker } from './components/ui/FontPicker.vue';
|
|
27
|
+
export { default as FontSizePicker } from './components/ui/FontSizePicker.vue';
|
|
28
|
+
export { default as LineSpacingPicker } from './components/ui/LineSpacingPicker.vue';
|
|
29
|
+
export { default as StylePicker } from './components/ui/StylePicker.vue';
|
|
30
|
+
export { default as ColorPicker } from './components/ui/ColorPicker.vue';
|
|
31
|
+
export { default as AlignmentButtons } from './components/ui/AlignmentButtons.vue';
|
|
32
|
+
export { default as ListButtons } from './components/ui/ListButtons.vue';
|
|
33
|
+
export { default as Button } from './components/ui/Button.vue';
|
|
34
|
+
export { default as IconGridDropdown } from './components/ui/IconGridDropdown.vue';
|
|
35
|
+
export { default as Popover } from './components/ui/Popover.vue';
|
|
36
|
+
export { default as TableToolbar } from './components/ui/TableToolbar.vue';
|
|
37
|
+
export { default as TableStyleGallery } from './components/ui/TableStyleGallery.vue';
|
|
38
|
+
export { default as TableGridPicker } from './components/ui/TableGridPicker.vue';
|
|
39
|
+
export { default as TableGridInline } from './components/ui/TableGridInline.vue';
|
|
40
|
+
export { default as TableMoreDropdown } from './components/ui/TableMoreDropdown.vue';
|
|
41
|
+
export { default as TableCellFillPicker } from './components/ui/TableCellFillPicker.vue';
|
|
42
|
+
export { default as TableBorderPicker } from './components/ui/TableBorderPicker.vue';
|
|
43
|
+
export { default as TableBorderColorPicker } from './components/ui/TableBorderColorPicker.vue';
|
|
44
|
+
export { default as TableBorderWidthPicker } from './components/ui/TableBorderWidthPicker.vue';
|
|
45
|
+
export { default as ImageWrapDropdown } from './components/ui/ImageWrapDropdown.vue';
|
|
46
|
+
export { default as ImageTransformDropdown } from './components/ui/ImageTransformDropdown.vue';
|
|
47
|
+
export { default as UnifiedSidebar } from './components/UnifiedSidebar.vue';
|
|
48
|
+
export { default as CommentCard } from './components/sidebar/CommentCard.vue';
|
|
49
|
+
export { default as TrackedChangeCard } from './components/sidebar/TrackedChangeCard.vue';
|
|
50
|
+
export { default as AddCommentCard } from './components/sidebar/AddCommentCard.vue';
|
|
51
|
+
export { default as ReplyInput } from './components/sidebar/ReplyInput.vue';
|
|
52
|
+
export { default as ReplyThread } from './components/sidebar/ReplyThread.vue';
|
|
53
|
+
export { default as ResolvedCommentMarker } from './components/sidebar/ResolvedCommentMarker.vue';
|
|
54
|
+
export { default as CommentMarginMarkers } from './components/CommentMarginMarkers.vue';
|
|
55
|
+
export { default as FindReplaceDialog } from './components/dialogs/FindReplaceDialog.vue';
|
|
56
|
+
export { default as FootnotePropertiesDialog } from './components/dialogs/FootnotePropertiesDialog.vue';
|
|
57
|
+
export { default as HyperlinkDialog } from './components/dialogs/HyperlinkDialog.vue';
|
|
58
|
+
export { default as ImagePositionDialog } from './components/dialogs/ImagePositionDialog.vue';
|
|
59
|
+
export { default as ImagePropertiesDialog } from './components/dialogs/ImagePropertiesDialog.vue';
|
|
60
|
+
export { default as InsertSymbolDialog } from './components/dialogs/InsertSymbolDialog.vue';
|
|
61
|
+
export { default as InsertTableDialog } from './components/dialogs/InsertTableDialog.vue';
|
|
62
|
+
export { default as PageSetupDialog } from './components/dialogs/PageSetupDialog.vue';
|
|
63
|
+
export { default as TablePropertiesDialog } from './components/dialogs/TablePropertiesDialog.vue';
|
|
64
|
+
export { default as PrintButton } from './components/PrintButton.vue';
|
|
65
|
+
export { default as HorizontalRuler } from './components/ui/HorizontalRuler.vue';
|
|
66
|
+
export { default as VerticalRuler } from './components/ui/VerticalRuler.vue';
|
|
67
|
+
export { CARD_STYLE_COLLAPSED, CARD_STYLE_EXPANDED } from './components/sidebar/cardStyles';
|