oasis-editor 0.0.135 → 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 (37) hide show
  1. package/dist/{OasisEditorApp-207_qEC4.js → OasisEditorApp-DPrjPRTW.js} +650 -1005
  2. package/dist/app/controllers/documentIO/DocumentImporter.d.ts +3 -1
  3. package/dist/app/controllers/documentIO/importProgress.d.ts +1 -1
  4. package/dist/app/controllers/useEditorDocumentIO.d.ts +3 -1
  5. package/dist/core/commands/builtinCommands.d.ts +1 -1
  6. package/dist/core/commands/publicCommandTypes.d.ts +4 -0
  7. package/dist/core/commands/table/tableCellStyleCommands.d.ts +7 -0
  8. package/dist/core/smallCaps.d.ts +7 -0
  9. package/dist/core/tableStyleResolver.d.ts +5 -0
  10. package/dist/export/pdf/fonts/PdfFontRegistry.d.ts +1 -0
  11. package/dist/export/pdf/fonts/officeFontAssets.d.ts +2 -0
  12. package/dist/i18n/locales/en.d.ts +4 -2
  13. package/dist/i18n/locales/pt-BR.d.ts +4 -2
  14. package/dist/{index-CaKZARyM.js → index-Cbwb1bgI.js} +3165 -1540
  15. package/dist/oasis-editor.css +1 -1
  16. package/dist/oasis-editor.js +49 -49
  17. package/dist/oasis-editor.umd.cjs +4 -4
  18. package/dist/plugins/internal/essentialsCapabilities.d.ts +13 -0
  19. package/dist/text/fonts/FontMetricsProvider.d.ts +1 -1
  20. package/dist/text/fonts/core/types.d.ts +1 -1
  21. package/dist/text/fonts/decoders/WoffDecoder.d.ts +8 -0
  22. package/dist/text/fonts/preciseFontMetrics.d.ts +9 -0
  23. package/dist/text/fonts/remoteWebFonts.d.ts +16 -0
  24. package/dist/ui/OasisEditorAppProps.d.ts +4 -0
  25. package/dist/ui/OasisEditorEditorProps.d.ts +1 -0
  26. package/dist/ui/app/buildEditorViewProps.d.ts +1 -0
  27. package/dist/ui/app/documentFontPreparation.d.ts +23 -0
  28. package/dist/ui/canvas/canvasFontResolution.d.ts +2 -2
  29. package/dist/ui/canvas/paragraph/canvasTextEffects.d.ts +1 -0
  30. package/dist/ui/components/Toolbar/TableBordersMenu.d.ts +6 -0
  31. package/dist/ui/components/Toolbar/TableStyleGallery.d.ts +9 -0
  32. package/dist/ui/components/Toolbar/TableStyleOptions.d.ts +6 -0
  33. package/dist/ui/components/Toolbar/presets/defaultToolbar/buttonSpecs.d.ts +1 -0
  34. package/dist/ui/components/Toolbar/schema/items.d.ts +8 -0
  35. package/dist/ui/editorUiTypes.d.ts +1 -0
  36. package/dist/ui/textMeasurement/fontMetrics.d.ts +3 -2
  37. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { ImageBorderPatch } from '../../core/commands/image.js';
3
3
  import { TextCaseMode } from '../../core/commands/text.js';
4
4
  import { ToolbarStyleState } from '../../ui/toolbarStyleState.js';
5
5
  import { OasisBuiltinCommand } from '../../core/commands/builtinCommands.js';
6
+ import { TableBorderPreset } from '../../core/commands/table.js';
6
7
 
7
8
  export interface EssentialsFeatureGate {
8
9
  isCommandEnabled: (commandName: OasisBuiltinCommand) => boolean;
@@ -73,6 +74,13 @@ export interface EssentialsDocumentStyleDescriptor {
73
74
  color?: string;
74
75
  bold?: boolean;
75
76
  italic?: boolean;
77
+ tablePreview?: {
78
+ wholeFill?: string;
79
+ headerFill?: string;
80
+ bandFill?: string;
81
+ borderColor?: string;
82
+ headerColor?: string;
83
+ };
76
84
  }
77
85
  export interface EssentialsDocumentCapability {
78
86
  documentStyles: () => EssentialsDocumentStyleDescriptor[];
@@ -180,6 +188,11 @@ export interface EssentialsTableCapability {
180
188
  cellShading: (color: string | null) => void;
181
189
  cellBorders: () => void;
182
190
  cellNoBorders: () => void;
191
+ applyBorderPreset: (preset: TableBorderPreset) => void;
192
+ isDrawingBorders: () => boolean;
193
+ toggleDrawingBorders: () => void;
194
+ isShowingGridlines: () => boolean;
195
+ toggleGridlines: () => void;
183
196
  width100: () => void;
184
197
  alignLeft: () => void;
185
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;
@@ -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>;
@@ -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;
@@ -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<{
@@ -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
@@ -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.135",
3
+ "version": "0.0.136",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",