oasis-editor 0.0.134 → 0.0.136

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.
Files changed (54) hide show
  1. package/dist/{OasisEditorApp-B2f15Gpe.js → OasisEditorApp-DPrjPRTW.js} +772 -1033
  2. package/dist/app/controllers/EditorCommandsController.d.ts +2 -0
  3. package/dist/app/controllers/documentIO/DocumentImporter.d.ts +3 -1
  4. package/dist/app/controllers/documentIO/importProgress.d.ts +1 -1
  5. package/dist/app/controllers/useEditorDocumentIO.d.ts +3 -1
  6. package/dist/assets/{importDocxWorker-CCwhxVSR.js → importDocxWorker-B0cSSI12.js} +1 -1
  7. package/dist/core/commands/builtinCommands.d.ts +1 -1
  8. package/dist/core/commands/image.d.ts +15 -1
  9. package/dist/core/commands/publicCommandTypes.d.ts +4 -0
  10. package/dist/core/commands/table/tableCellStyleCommands.d.ts +7 -0
  11. package/dist/core/lineDash.d.ts +16 -0
  12. package/dist/core/model/index.d.ts +1 -1
  13. package/dist/core/model/types/primitives.d.ts +19 -0
  14. package/dist/core/smallCaps.d.ts +7 -0
  15. package/dist/core/tableStyleResolver.d.ts +5 -0
  16. package/dist/export/docx/docxTypes.d.ts +2 -1
  17. package/dist/export/docx/text/drawingContainerXml.d.ts +7 -1
  18. package/dist/export/pdf/draw/drawImageObject.d.ts +14 -0
  19. package/dist/export/pdf/fonts/PdfFontRegistry.d.ts +1 -0
  20. package/dist/export/pdf/fonts/officeFontAssets.d.ts +2 -0
  21. package/dist/export/pdf/writer/pdfTypes.d.ts +2 -0
  22. package/dist/i18n/locales/en.d.ts +19 -2
  23. package/dist/i18n/locales/pt-BR.d.ts +19 -2
  24. package/dist/{index-ogn0S9F3.js → index-Cbwb1bgI.js} +3771 -1616
  25. package/dist/oasis-editor.css +1 -1
  26. package/dist/oasis-editor.js +49 -49
  27. package/dist/oasis-editor.umd.cjs +4 -4
  28. package/dist/plugins/internal/essentialsCapabilities.d.ts +19 -1
  29. package/dist/text/fonts/FontMetricsProvider.d.ts +1 -1
  30. package/dist/text/fonts/core/types.d.ts +1 -1
  31. package/dist/text/fonts/decoders/WoffDecoder.d.ts +8 -0
  32. package/dist/text/fonts/preciseFontMetrics.d.ts +9 -0
  33. package/dist/text/fonts/remoteWebFonts.d.ts +16 -0
  34. package/dist/ui/OasisEditorAppProps.d.ts +4 -0
  35. package/dist/ui/OasisEditorEditorProps.d.ts +1 -0
  36. package/dist/ui/app/buildEditorViewProps.d.ts +1 -0
  37. package/dist/ui/app/createAppCommandsController.d.ts +2 -0
  38. package/dist/ui/app/createEditorCommandRuntime.d.ts +1 -0
  39. package/dist/ui/app/documentFontPreparation.d.ts +23 -0
  40. package/dist/ui/canvas/canvasFontResolution.d.ts +2 -2
  41. package/dist/ui/canvas/paragraph/canvasInlineImage.d.ts +1 -1
  42. package/dist/ui/canvas/paragraph/canvasTextEffects.d.ts +1 -0
  43. package/dist/ui/components/Toolbar/TableBordersMenu.d.ts +6 -0
  44. package/dist/ui/components/Toolbar/TableStyleGallery.d.ts +9 -0
  45. package/dist/ui/components/Toolbar/TableStyleOptions.d.ts +6 -0
  46. package/dist/ui/components/Toolbar/pictureBorderPresets.d.ts +19 -0
  47. package/dist/ui/components/Toolbar/presets/defaultToolbar/buttonSpecs.d.ts +1 -0
  48. package/dist/ui/components/Toolbar/primitives/ColorGrids.d.ts +20 -0
  49. package/dist/ui/components/Toolbar/primitives/PictureBorderPicker.d.ts +37 -0
  50. package/dist/ui/components/Toolbar/primitives/WideMenuButton.d.ts +27 -0
  51. package/dist/ui/components/Toolbar/schema/items.d.ts +23 -1
  52. package/dist/ui/editorUiTypes.d.ts +1 -0
  53. package/dist/ui/textMeasurement/fontMetrics.d.ts +3 -2
  54. package/package.json +1 -1
@@ -1,7 +1,9 @@
1
- import { EditorPageMargins } from '../../core/model.js';
1
+ import { EditorImageBorder, EditorPageMargins } from '../../core/model.js';
2
+ import { ImageBorderPatch } from '../../core/commands/image.js';
2
3
  import { TextCaseMode } from '../../core/commands/text.js';
3
4
  import { ToolbarStyleState } from '../../ui/toolbarStyleState.js';
4
5
  import { OasisBuiltinCommand } from '../../core/commands/builtinCommands.js';
6
+ import { TableBorderPreset } from '../../core/commands/table.js';
5
7
 
6
8
  export interface EssentialsFeatureGate {
7
9
  isCommandEnabled: (commandName: OasisBuiltinCommand) => boolean;
@@ -72,6 +74,13 @@ export interface EssentialsDocumentStyleDescriptor {
72
74
  color?: string;
73
75
  bold?: boolean;
74
76
  italic?: boolean;
77
+ tablePreview?: {
78
+ wholeFill?: string;
79
+ headerFill?: string;
80
+ bandFill?: string;
81
+ borderColor?: string;
82
+ headerColor?: string;
83
+ };
75
84
  }
76
85
  export interface EssentialsDocumentCapability {
77
86
  documentStyles: () => EssentialsDocumentStyleDescriptor[];
@@ -105,6 +114,10 @@ export interface EssentialsImageCapability {
105
114
  toggleCrop: () => void;
106
115
  /** Apply an aspect-ratio crop preset (e.g. "16:9", "1:1", "reset"). */
107
116
  applyCropAspect: (preset: string) => void;
117
+ /** Outline of the selected image (`pic:spPr/a:ln`), or `null`. */
118
+ getBorder: () => EditorImageBorder | null;
119
+ /** Merge a partial outline edit; `{ color: null }` removes the outline. */
120
+ setBorder: (patch: ImageBorderPatch) => void;
108
121
  }
109
122
  export interface EssentialsBrowserCapability {
110
123
  print: () => void;
@@ -175,6 +188,11 @@ export interface EssentialsTableCapability {
175
188
  cellShading: (color: string | null) => void;
176
189
  cellBorders: () => void;
177
190
  cellNoBorders: () => void;
191
+ applyBorderPreset: (preset: TableBorderPreset) => void;
192
+ isDrawingBorders: () => boolean;
193
+ toggleDrawingBorders: () => void;
194
+ isShowingGridlines: () => boolean;
195
+ toggleGridlines: () => void;
178
196
  width100: () => void;
179
197
  alignLeft: () => void;
180
198
  alignCenter: () => void;
@@ -35,4 +35,4 @@ export declare function getFontMetricsProvider(): FontMetricsProvider;
35
35
  * browser. Call this before the first layout/mount. In Node it is unnecessary
36
36
  * (synchronous `fs` loading covers it) but harmless.
37
37
  */
38
- export declare function preloadLayoutFonts(families?: Iterable<string | null | undefined>): Promise<void>;
38
+ export declare function preloadLayoutFonts(families?: Iterable<string | null | undefined>): Promise<boolean>;
@@ -1,6 +1,6 @@
1
1
  import { Os2VerticalMetrics, VerticalMetrics } from '../../truetype/tableParsers.js';
2
2
 
3
- export type FontFormat = "ttf" | "woff2";
3
+ export type FontFormat = "ttf" | "woff" | "woff2";
4
4
  export interface FontDecoder {
5
5
  readonly format: FontFormat;
6
6
  canDecode(bytes: Uint8Array): boolean;
@@ -0,0 +1,8 @@
1
+ import { FontDecoder } from '../core/types.js';
2
+
3
+ export declare class WoffDecoder implements FontDecoder {
4
+ readonly format: "woff";
5
+ canDecode(bytes: Uint8Array): boolean;
6
+ decode(bytes: Uint8Array): Promise<Uint8Array>;
7
+ decodeSync(bytes: Uint8Array): Uint8Array;
8
+ }
@@ -2,6 +2,15 @@ import { SfntFontProgram } from './sfnt/SfntFontProgram.js';
2
2
 
3
3
  export declare function registerPreciseFont(family: string, bold: boolean, italic: boolean, program: SfntFontProgram): void;
4
4
  export declare function clearPreciseFonts(): void;
5
+ /**
6
+ * Registers the exact locally-read bytes under an Oasis-owned CSS family.
7
+ * Using a private alias prevents a previously loaded remote @font-face with the
8
+ * document family name from painting different glyphs than the local program
9
+ * used by the layout engine.
10
+ */
11
+ export declare function registerPreciseBrowserFontFace(family: string, bold: boolean, italic: boolean, bytes: Uint8Array): Promise<string | null>;
12
+ /** Exact CSS family registered for a locally-read precise font, when present. */
13
+ export declare function getPreciseBrowserFontFamily(family: string | null | undefined): string | null;
5
14
  /** Whether any real face is loaded for the family (ignores the mode flag). */
6
15
  export declare function hasPreciseFont(family: string | null | undefined): boolean;
7
16
  /** Whether a specific face has already been registered (used to skip reloads). */
@@ -0,0 +1,16 @@
1
+ export interface RemotePdfFontFace {
2
+ family: string;
3
+ bold: boolean;
4
+ italic: boolean;
5
+ fontData: Uint8Array;
6
+ postscriptName?: string;
7
+ }
8
+ export declare function isRemoteWebFontActive(fontFamily: string | null | undefined): boolean;
9
+ /**
10
+ * Loads unbundled document fonts from fixed, HTTPS-only providers. Requests are
11
+ * browser-only, lazy, and deduplicated for the page lifetime. A failed request
12
+ * is non-fatal: the existing bundled metric substitute remains active.
13
+ */
14
+ export declare function loadRemoteWebFonts(families: Iterable<string | null | undefined>): Promise<boolean>;
15
+ /** Returns decoded SFNT data already requested by the browser font loader. */
16
+ export declare function getRemotePdfFontFaces(families: Iterable<string | null | undefined>): Promise<RemotePdfFontFace[]>;
@@ -14,6 +14,8 @@ export interface OasisEditorLoadingOptions {
14
14
  style?: JSX.CSSProperties;
15
15
  }
16
16
  export interface OasisEditorAppUiProps {
17
+ /** Visual chrome palette. Defaults to light to preserve existing embeds. */
18
+ theme?: "light" | "dark";
17
19
  showChrome?: boolean;
18
20
  shell?: "document" | "inline" | "balloon";
19
21
  uiVariant?: "classic" | "docs";
@@ -34,6 +36,8 @@ export interface OasisEditorAppUiProps {
34
36
  export interface OasisEditorAppDocumentProps {
35
37
  initialDocument?: EditorDocument;
36
38
  initialState?: EditorState;
39
+ /** Load otherwise unavailable document fonts from Google Fonts/CDNFonts. */
40
+ remoteWebFonts?: boolean;
37
41
  onStateChange?: (state: EditorState) => void;
38
42
  readOnly?: boolean;
39
43
  persistenceEnabled?: boolean;
@@ -8,6 +8,7 @@ import { ResizeHandleDirection } from './resizeGeometry.js';
8
8
  type ImportProgress = ImportProgressState;
9
9
  export interface OasisEditorEditorLayoutProps {
10
10
  documentLayout: Accessor<EditorLayoutDocument>;
11
+ remoteWebFonts?: boolean;
11
12
  measuredBlockHeights?: Accessor<Record<string, number>>;
12
13
  measuredParagraphLayouts?: Accessor<Record<string, EditorLayoutParagraph>>;
13
14
  viewportHeight?: number | string;
@@ -14,6 +14,7 @@ type ImportProgress = NonNullable<ReturnType<NonNullable<OasisEditorEditorOverla
14
14
  /** Page sizing / zoom inputs that shape the layout prop bundle. */
15
15
  export interface EditorViewLayoutInput {
16
16
  documentLayout: Accessor<EditorLayoutDocument>;
17
+ remoteWebFonts?: boolean;
17
18
  viewportHeight: number | string | undefined;
18
19
  className: string | undefined;
19
20
  style: JSX.CSSProperties | undefined;
@@ -72,6 +72,7 @@ declare function createAppCommandsControllerImpl(deps: AppCommandsControllerDeps
72
72
  applyImageWidthCmCommand: (cm: number) => void;
73
73
  applyImageHeightCmCommand: (cm: number) => void;
74
74
  applyImageCropAspectCommand: (preset: string) => void;
75
+ applyImageBorderCommand: (patch: import('../../core/commands/image.js').ImageBorderPatch) => void;
75
76
  handleListTab: (direction: "indent" | "outdent") => boolean;
76
77
  handleListEnter: () => boolean;
77
78
  handleListBoundaryBackspace: (event: KeyboardEvent & {
@@ -109,6 +110,7 @@ declare function createAppCommandsControllerImpl(deps: AppCommandsControllerDeps
109
110
  applyImageWidthCmCommand: (cm: number) => void;
110
111
  applyImageHeightCmCommand: (cm: number) => void;
111
112
  applyImageCropAspectCommand: (preset: string) => void;
113
+ applyImageBorderCommand: (patch: import('../../core/commands/image.js').ImageBorderPatch) => void;
112
114
  handleListTab: (direction: "indent" | "outdent") => boolean;
113
115
  handleListEnter: () => boolean;
114
116
  handleListBoundaryBackspace: (event: KeyboardEvent & {
@@ -87,6 +87,7 @@ declare function createEditorCommandRuntimeImpl(deps: EditorCommandRuntimeDeps):
87
87
  applyImageWidthCmCommand: (cm: number) => void;
88
88
  applyImageHeightCmCommand: (cm: number) => void;
89
89
  applyImageCropAspectCommand: (preset: string) => void;
90
+ applyImageBorderCommand: (patch: import('../../core/commands/image.js').ImageBorderPatch) => void;
90
91
  handleListTab: (direction: "indent" | "outdent") => boolean;
91
92
  handleListEnter: () => boolean;
92
93
  handleListBoundaryBackspace: (event: KeyboardEvent & {
@@ -0,0 +1,23 @@
1
+ import { EditorDocument } from '../../core/model.js';
2
+
3
+ export type DocumentFontSource = "local" | "remote" | "bundled" | "fallback";
4
+ export interface DocumentFontPreparationResult {
5
+ changed: boolean;
6
+ families: Array<{
7
+ requested: string;
8
+ metricFamily: string;
9
+ source: DocumentFontSource;
10
+ browserFamily: string | null;
11
+ }>;
12
+ }
13
+ export interface DocumentFontPreparationOptions {
14
+ remoteWebFonts?: boolean;
15
+ }
16
+ /**
17
+ * Prepares every face needed by a parsed document before its editor state is
18
+ * applied. The promise is cached by family set/mode so the surface effect can
19
+ * safely call the same service without triggering a second relayout.
20
+ */
21
+ export declare function prepareDocumentFonts(document: EditorDocument, options?: DocumentFontPreparationOptions): Promise<DocumentFontPreparationResult>;
22
+ /** Test-only reset for the module-level deduplication cache. */
23
+ export declare function clearDocumentFontPreparationCache(): void;
@@ -4,7 +4,7 @@ export declare function resolveCanvasTextRenderMetrics(styles: {
4
4
  subscript?: boolean;
5
5
  smallCaps?: boolean;
6
6
  baselineShift?: number | null;
7
- } | undefined, fontSize: number): {
7
+ } | undefined, fontSize: number, sourceChar?: string): {
8
8
  fontSize: number;
9
9
  baselineOffset: number;
10
10
  };
@@ -48,7 +48,7 @@ type RunStyleInput = {
48
48
  smallCaps?: boolean;
49
49
  baselineShift?: number | null;
50
50
  } | undefined;
51
- export declare function resolveCanvasRunPaintStyle(styles: RunStyleInput): {
51
+ export declare function resolveCanvasRunPaintStyle(styles: RunStyleInput, sourceChar?: string): {
52
52
  font: string;
53
53
  fillStyle: string;
54
54
  renderMetrics: ReturnType<typeof resolveCanvasTextRenderMetrics>;
@@ -2,7 +2,7 @@ import { EditorImageRunData, EditorLayoutLine, EditorPageSettings, EditorState }
2
2
 
3
3
  /**
4
4
  * Draw an inline image fragment, honoring crop (`a:srcRect`), rotation
5
- * (`a:xfrm/@rot`) and horizontal/vertical flips.
5
+ * (`a:xfrm/@rot`), horizontal/vertical flips and the picture outline.
6
6
  */
7
7
  export declare function drawImageFragment(ctx: CanvasRenderingContext2D, img: CanvasImageSource & {
8
8
  naturalWidth: number;
@@ -40,4 +40,5 @@ export declare function drawFragmentReflection(ctx: CanvasRenderingContext2D, fr
40
40
  }): void;
41
41
  export declare function getRenderedChar(char: string, styles: {
42
42
  allCaps?: boolean;
43
+ smallCaps?: boolean;
43
44
  }): string;
@@ -0,0 +1,6 @@
1
+ import { JSX } from 'solid-js';
2
+ import { ToolbarActionApi } from './schema/items.js';
3
+
4
+ export declare function TableBordersMenu(props: {
5
+ api: ToolbarActionApi;
6
+ }): JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { JSX } from 'solid-js';
2
+ import { ToolbarActionApi, ToolbarDocumentStyle } from './schema/items.js';
3
+
4
+ export interface TableStyleGalleryProps {
5
+ api: ToolbarActionApi;
6
+ styles: ToolbarDocumentStyle[];
7
+ testId?: string;
8
+ }
9
+ export declare function TableStyleGallery(props: TableStyleGalleryProps): JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { JSX } from 'solid-js';
2
+ import { ToolbarActionApi } from './schema/items.js';
3
+
4
+ export declare function TableStyleOptions(props: {
5
+ api: ToolbarActionApi;
6
+ }): JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { EditorLineDash } from '../../../core/model.js';
2
+ import { TranslationKey } from '../../../i18n/index.js';
3
+
4
+ /** Border weights offered by Word's Picture Border ▸ Weight submenu, in points. */
5
+ export declare const PICTURE_BORDER_WEIGHTS_PT: number[];
6
+ /** `0.25` → `"¼"`, `1.5` → `"1½"`, `3` → `"3"`. */
7
+ export declare function formatBorderWeight(widthPt: number): string;
8
+ export interface PictureBorderDashOption {
9
+ value: EditorLineDash;
10
+ labelKey: TranslationKey;
11
+ }
12
+ /** Ordered as Word's Dashes flyout: shortest pattern first. */
13
+ export declare const PICTURE_BORDER_DASH_OPTIONS: PictureBorderDashOption[];
14
+ /**
15
+ * `stroke-dasharray` for a menu preview stroke, derived from the same point
16
+ * table the canvas and PDF renderers use — so a preview can never disagree with
17
+ * what gets painted. Solid yields `undefined` (no attribute).
18
+ */
19
+ export declare function dashPreviewArray(dash: EditorLineDash): string | undefined;
@@ -18,6 +18,7 @@ export declare const TABLE_LAYOUT_BUTTONS: Array<{
18
18
  command: string;
19
19
  icon: string;
20
20
  tooltipKey: TranslationKey;
21
+ ribbonSize?: "large";
21
22
  }>;
22
23
  /** tblLook conditional-formatting toggles on the Table Design tab. */
23
24
  export declare const TABLE_DESIGN_TOGGLES: Array<{
@@ -0,0 +1,20 @@
1
+ import { JSX } from 'solid-js';
2
+ import { ColorPalette } from '../schema/palette.js';
3
+
4
+ export interface ColorGridsProps {
5
+ palette: ColorPalette;
6
+ themeColorsLabel: string;
7
+ standardColorsLabel: string;
8
+ /** Lowercased hex of the currently applied colour, for the active ring. */
9
+ activeColor: string;
10
+ testId: string;
11
+ onPreview: (color: string | null) => void;
12
+ onPick: (color: string) => void;
13
+ }
14
+ /**
15
+ * The theme-colour columns and standard-colour row shared by every colour popup
16
+ * (font colour, highlight, shading, picture border). Owns only the swatches —
17
+ * the surrounding "automatic"/"no colour" and "more colours" actions differ per
18
+ * consumer and stay with them.
19
+ */
20
+ export declare function ColorGrids(props: ColorGridsProps): JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { JSX } from 'solid-js';
2
+ import { ColorPalette } from '../schema/palette.js';
3
+ import { EditorImageBorder, EditorLineDash } from '../../../../core/model.js';
4
+ import { ImageBorderPatch } from '../../../../core/commands/image.js';
5
+
6
+ export interface PictureBorderPickerProps {
7
+ /** The outline currently on the selected picture, or `null`. */
8
+ border: EditorImageBorder | null;
9
+ palette: ColorPalette;
10
+ disabled?: boolean;
11
+ testId: string;
12
+ label: string;
13
+ noOutlineLabel: string;
14
+ moreColorsLabel: string;
15
+ weightLabel: string;
16
+ dashesLabel: string;
17
+ themeColorsLabel: string;
18
+ standardColorsLabel: string;
19
+ /** Ordered dash presets with their translated names. */
20
+ dashOptions: Array<{
21
+ value: EditorLineDash;
22
+ label: string;
23
+ }>;
24
+ onApply: (patch: ImageBorderPatch) => void;
25
+ }
26
+ /**
27
+ * Word's Picture Border popup: theme/standard colour grids, "No Outline",
28
+ * "More Outline Colors…", and Weight/Dashes flyouts. Purely presentational —
29
+ * every action reports a partial patch, so a colour pick keeps the current
30
+ * weight and vice-versa.
31
+ *
32
+ * The flyouts render *inside* the popover panel rather than in their own
33
+ * portal: `Popover`'s dismiss watcher only knows about the trigger and the
34
+ * panel, so a portalled child would read as an outside click and close its own
35
+ * parent.
36
+ */
37
+ export declare function PictureBorderPicker(props: PictureBorderPickerProps): JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { JSX } from 'solid-js';
2
+
3
+ export interface WideMenuButtonProps {
4
+ open: boolean;
5
+ onOpenChange: (open: boolean) => void;
6
+ icon?: string;
7
+ label: string;
8
+ tooltip?: string;
9
+ testId?: string;
10
+ active?: boolean;
11
+ disabled?: boolean;
12
+ /** A swatch strip under the icon, e.g. the current border colour. */
13
+ indicatorColor?: string | null;
14
+ panelClass?: string;
15
+ children: JSX.Element;
16
+ }
17
+ /**
18
+ * A dropdown whose trigger lays icon, label and chevron out on a single
19
+ * horizontal line, sized to span a ribbon group's full height. This is the
20
+ * shape Word gives its Picture Border / Picture Effects / Picture Layout
21
+ * buttons, and it is the third trigger geometry in the toolbar — distinct from
22
+ * the icon-only (`normal`) and icon-above-label (`large`) `Button`s.
23
+ *
24
+ * Unlike `Menu`, no click inside the panel is intercepted: consumers own when
25
+ * the popup closes, which nested flyouts need.
26
+ */
27
+ export declare function WideMenuButton(props: WideMenuButtonProps): JSX.Element;
@@ -30,6 +30,14 @@ export interface ToolbarDocumentStyle {
30
30
  color?: string;
31
31
  bold?: boolean;
32
32
  italic?: boolean;
33
+ /** Narrow, renderer-safe colour data for the table-style ribbon gallery. */
34
+ tablePreview?: {
35
+ wholeFill?: string;
36
+ headerFill?: string;
37
+ bandFill?: string;
38
+ borderColor?: string;
39
+ headerColor?: string;
40
+ };
33
41
  }
34
42
  /**
35
43
  * Narrow surface every toolbar item depends on (DIP/ISP). Items only dispatch
@@ -143,6 +151,20 @@ export interface ColorPickerItem extends ToolbarItemBase {
143
151
  labelKey?: TranslationKey;
144
152
  label?: string;
145
153
  }
154
+ /**
155
+ * Word's Picture Border control: a wide horizontal trigger over a popup that
156
+ * carries colour grids plus Weight/Dashes flyouts. Its own item type (rather
157
+ * than a `colorPicker` variant) because a border is three facets — colour,
158
+ * weight, dash — dispatched as partial patches of one command.
159
+ */
160
+ export interface PictureBorderItem extends ToolbarItemBase {
161
+ type: "pictureBorder";
162
+ /** Command dispatched with an `ImageBorderPatch` payload. */
163
+ command: CommandRef;
164
+ palette?: ColorPalette;
165
+ labelKey?: TranslationKey;
166
+ label?: string;
167
+ }
146
168
  export interface GridPickerItem extends ToolbarItemBase {
147
169
  type: "gridPicker";
148
170
  /** Command dispatched with `{ rows, cols }` as payload. */
@@ -171,5 +193,5 @@ export interface CustomItem extends ToolbarItemBase {
171
193
  type: "custom";
172
194
  render: (api: ToolbarActionApi) => JSX.Element;
173
195
  }
174
- export type ToolbarItem = ButtonItem | ToggleItem | SplitItem | MenuItem | SelectItem | StyleGalleryItem | ColorPickerItem | GridPickerItem | SeparatorItem | GroupItem | CustomItem;
196
+ export type ToolbarItem = ButtonItem | ToggleItem | SplitItem | MenuItem | SelectItem | StyleGalleryItem | ColorPickerItem | PictureBorderItem | GridPickerItem | SeparatorItem | GroupItem | CustomItem;
175
197
  export type ToolbarItemType = ToolbarItem["type"];
@@ -81,6 +81,7 @@ export interface LayoutOptionsOverlay {
81
81
  export interface EditorSurfaceProps {
82
82
  state: Accessor<EditorState>;
83
83
  documentLayout: Accessor<EditorLayoutDocument>;
84
+ remoteWebFonts?: boolean;
84
85
  measuredBlockHeights?: Accessor<Record<string, number>>;
85
86
  measuredParagraphLayouts?: Accessor<Record<string, EditorLayoutParagraph>>;
86
87
  /**
@@ -1,8 +1,9 @@
1
1
  import { EditorTextStyle } from '../../core/model.js';
2
2
 
3
- export declare function getMeasuredFontSize(styles: EditorTextStyle | undefined, fallbackFontSize: number): number;
3
+ export declare function getMeasuredFontSize(styles: EditorTextStyle | undefined, fallbackFontSize: number, sourceChar?: string): number;
4
4
  export declare function getRenderedMeasureChar(char: string, styles: EditorTextStyle | undefined): string;
5
- export declare function buildCanvasFont(styles: EditorTextStyle | undefined, fallbackFontSize: number): string;
5
+ export declare function buildCanvasFont(styles: EditorTextStyle | undefined, fallbackFontSize: number, sourceChar?: string): string;
6
+ export declare function measureCanvasTextWidth(text: string, font: string): number | null;
6
7
  /**
7
8
  * Clears the cached natural line heights. Required after the metric source for a
8
9
  * family changes (precise font mode toggling, or real metrics arriving), since
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.134",
3
+ "version": "0.0.136",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",