oasis-editor 0.0.19 → 0.0.21

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.
@@ -1,4 +1,5 @@
1
1
  import { OasisPlugin } from '../../core/plugin.js';
2
+ import { EditorPageMargins } from '../../core/model.js';
2
3
  import { TextCaseMode } from '../../core/commands/text.js';
3
4
  import { ToolbarStyleState } from '../../ui/toolbarStyleState.js';
4
5
 
@@ -108,10 +109,8 @@ export interface EssentialsSectionCapability {
108
109
  setOrientation: (orientation: "portrait" | "landscape") => void;
109
110
  breakNextPage: () => void;
110
111
  breakContinuous: () => void;
111
- setPageMargins: (margins: {
112
- left?: number;
113
- right?: number;
114
- }) => void;
112
+ getMargins: () => EditorPageMargins | undefined;
113
+ setPageMargins: (margins: Partial<EditorPageMargins>) => void;
115
114
  }
116
115
  export interface EssentialsTableCapability {
117
116
  insideTable: () => boolean;
@@ -0,0 +1,7 @@
1
+ import { JSX } from 'solid-js';
2
+ import { ToolbarActionApi } from '../schema/items.js';
3
+
4
+ /** Word-style page-margin presets dropdown plus an inline custom form. */
5
+ export declare function MarginsGroup(props: {
6
+ api: ToolbarActionApi;
7
+ }): JSX.Element;
@@ -1,6 +1,7 @@
1
+ import { JSX } from 'solid-js';
1
2
  import { ToolbarActionApi } from '../schema/items.js';
2
3
 
3
4
  /** Section page-setup panel (orientation, section breaks) — command-driven. */
4
5
  export declare function SectionGroup(props: {
5
6
  api: ToolbarActionApi;
6
- }): import("solid-js").JSX.Element;
7
+ }): JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { TranslationKey } from '../../../i18n/index.js';
2
+
3
+ /** Convert a centimetre measurement to a rounded pixel value. */
4
+ export declare function cmToPx(cm: number): number;
5
+ /** Convert pixels back to centimetres (for display in the custom form). */
6
+ export declare function pxToCm(px: number): number;
7
+ export interface MarginPreset {
8
+ id: string;
9
+ labelKey: TranslationKey;
10
+ /** Margins in centimetres, mirroring Word's presets. */
11
+ top: number;
12
+ bottom: number;
13
+ left: number;
14
+ right: number;
15
+ }
16
+ /**
17
+ * Word's built-in page-margin presets (values shown in the screenshot use the
18
+ * pt-BR localisation: "Normal" follows ABNT 2.5/2.5/3/3 cm rather than 1 inch).
19
+ */
20
+ export declare const MARGIN_PRESETS: MarginPreset[];
21
+ /** Preset margins converted to the px units stored on the page settings. */
22
+ export declare function presetMarginsPx(preset: MarginPreset): {
23
+ top: number;
24
+ bottom: number;
25
+ left: number;
26
+ right: number;
27
+ };
28
+ /** True when the current px margins match this preset (±1px tolerance). */
29
+ export declare function marginsMatchPreset(margins: {
30
+ top: number;
31
+ bottom: number;
32
+ left: number;
33
+ right: number;
34
+ }, preset: MarginPreset): boolean;
@@ -37,6 +37,7 @@ export declare const OASIS_TOOLBAR_ITEMS: {
37
37
  readonly lineSpacing: "editor-toolbar-line-spacing-control";
38
38
  readonly metrics: "editor-toolbar-metrics";
39
39
  readonly table: "editor-toolbar-table";
40
+ readonly margins: "editor-toolbar-margins";
40
41
  readonly section: "editor-toolbar-section";
41
42
  };
42
43
  export type OasisToolbarItemId = (typeof OASIS_TOOLBAR_ITEMS)[keyof typeof OASIS_TOOLBAR_ITEMS];
@@ -6,6 +6,7 @@ export interface ToolbarButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonE
6
6
  active?: boolean;
7
7
  tooltip?: string;
8
8
  wide?: boolean;
9
+ ribbonSize?: "normal" | "large";
9
10
  }
10
11
  /** Generic toolbar button primitive (icon and/or label, active/disabled). */
11
12
  export declare function Button(props: ToolbarButtonProps): JSX.Element;
@@ -8,6 +8,7 @@ export interface MenuProps {
8
8
  active?: boolean;
9
9
  disabled?: boolean;
10
10
  hideChevron?: boolean;
11
+ ribbonSize?: "normal" | "large";
11
12
  /** Extra class for the popover panel. */
12
13
  panelClass?: string;
13
14
  keepMounted?: boolean;
@@ -1,3 +1,4 @@
1
+ import { JSX } from 'solid-js';
1
2
  import { ToolbarActionApi } from '../schema/items.js';
2
3
  import { RibbonGroupModel } from './ribbonModel.js';
3
4
 
@@ -5,4 +6,4 @@ export interface RibbonGroupProps {
5
6
  group: RibbonGroupModel;
6
7
  api: ToolbarActionApi;
7
8
  }
8
- export declare function RibbonGroup(props: RibbonGroupProps): import("solid-js").JSX.Element;
9
+ export declare function RibbonGroup(props: RibbonGroupProps): JSX.Element;
@@ -7,6 +7,7 @@ export interface RibbonTabDefinition {
7
7
  export interface RibbonGroupModel {
8
8
  id: string;
9
9
  label: string;
10
+ largeItems: ToolbarItem[];
10
11
  rows: Record<RibbonRow, ToolbarItem[]>;
11
12
  order: number;
12
13
  }
@@ -17,5 +18,6 @@ export declare const DEFAULT_RIBBON_ROW: RibbonRow;
17
18
  export declare function normalizeRibbonTab(tab: ToolbarItem["tab"]): RibbonTabId;
18
19
  export declare function normalizeRibbonGroup(group: ToolbarItem["group"]): string;
19
20
  export declare function normalizeRibbonRow(row: ToolbarItem["row"]): RibbonRow;
21
+ export declare function isLargeRibbonItem(item: ToolbarItem): boolean;
20
22
  export declare function ribbonGroupLabel(group: string): string;
21
23
  export declare function buildRibbonGroups(items: ToolbarItem[], tab: RibbonTabId): RibbonGroupModel[];
@@ -7,6 +7,7 @@ import { ColorPalette } from './palette.js';
7
7
  export declare const RIBBON_TABS: readonly ["file", "home", "insert", "draw", "layout", "references", "collaboration", "protection", "view", "plugins", "ai"];
8
8
  export type RibbonTabId = (typeof RIBBON_TABS)[number];
9
9
  export type RibbonRow = 1 | 2;
10
+ export type RibbonSize = "normal" | "large";
10
11
  /** Reactive snapshot of a command's state, as consumed by toolbar items. */
11
12
  export interface ToolbarCommandState {
12
13
  isEnabled: boolean;
@@ -50,6 +51,8 @@ interface ToolbarItemBase extends ItemReactiveOverrides {
50
51
  group?: string;
51
52
  /** Two-row ribbon placement. Missing values default to row 1. */
52
53
  row?: RibbonRow;
54
+ /** Ribbon-only visual scale. Large items span both toolbar rows. */
55
+ ribbonSize?: RibbonSize;
53
56
  testId?: string;
54
57
  tooltipKey?: TranslationKey;
55
58
  tooltip?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",