oasis-editor 0.0.108 → 0.0.110

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,6 +1,29 @@
1
1
  import { EditorEditingZone } from '../../core/model.js';
2
2
  import { CanvasSnapshotInlineImage, CanvasSnapshotInlineTextBox, ResolveTextBoxRenderHeight } from './canvasSnapshotTypes.js';
3
3
 
4
+ /**
5
+ * Single source of truth for the on-canvas rectangle of an inline object
6
+ * (image or text box) that occupies a line slot. The painter (rendering) and
7
+ * the snapshot readers (hit-testing / selection overlays) MUST agree on this
8
+ * geometry; computing it here prevents the two paths from drifting (audit #6).
9
+ *
10
+ * The object is bottom-aligned within the line: its top sits at the line
11
+ * baseline minus the object height, mirroring how Word flows inline drawings.
12
+ */
13
+ export declare function resolveInlineObjectRect(params: {
14
+ originLeft: number;
15
+ originTop: number;
16
+ lineTop: number;
17
+ lineHeight: number;
18
+ slotLeft: number;
19
+ objectWidth: number;
20
+ objectHeight: number;
21
+ }): {
22
+ left: number;
23
+ top: number;
24
+ width: number;
25
+ height: number;
26
+ };
4
27
  export declare function collectInlineImagesFromLines(options: {
5
28
  lines: Array<{
6
29
  top: number;
@@ -0,0 +1,11 @@
1
+ import { JSX } from 'solid-js';
2
+ import { ToolbarActionApi } from './schema/items.js';
3
+
4
+ /**
5
+ * Word-style "Formas" gallery: recently-used shapes followed by categorized
6
+ * grids of outline thumbnails. Each tile dispatches the existing `insertShape`
7
+ * command; the enclosing {@link Menu} auto-closes on the button click.
8
+ */
9
+ export declare function ShapeGallery(props: {
10
+ api: ToolbarActionApi;
11
+ }): JSX.Element;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Recently inserted shapes, most-recent first, persisted to `localStorage`.
3
+ * All access is guarded so private mode / SSR / quota errors degrade to an
4
+ * empty list rather than throwing.
5
+ */
6
+ export declare function getRecentShapes(): string[];
7
+ /** Record a freshly inserted shape, moving it to the front and de-duping. */
8
+ export declare function pushRecentShape(preset: string): string[];
@@ -0,0 +1,23 @@
1
+ import { Locale, TranslationKey } from '../../../i18n/index.js';
2
+
3
+ /** One Word-style section of the shapes gallery. */
4
+ export interface ShapeCategory {
5
+ /** i18n key for the section header. */
6
+ headerKey: TranslationKey;
7
+ /** DrawingML preset names (all present in the preset-geometry catalog). */
8
+ presets: string[];
9
+ }
10
+ /**
11
+ * Ordered shape categories mirroring Word's "Formas" gallery. Every preset
12
+ * listed here is supported by `getPresetPathSegments` (see
13
+ * `src/layoutProjection/presetGeometry/catalog.ts`), so each renders as an
14
+ * outline thumbnail and inserts via the existing `insertShape` command.
15
+ */
16
+ export declare const SHAPE_CATEGORIES: ShapeCategory[];
17
+ /**
18
+ * Presets rendered as open strokes (no closed fill) in thumbnails — lines and
19
+ * connectors. Visual only; insertion is unchanged.
20
+ */
21
+ export declare const STROKE_ONLY_PRESETS: Set<string>;
22
+ /** Localized display name for a preset, falling back to the raw name. */
23
+ export declare function shapeLabel(preset: string, locale: Locale): string;
@@ -0,0 +1,16 @@
1
+ import { JSX } from 'solid-js';
2
+
3
+ /**
4
+ * Builds an SVG path `d` string for a preset by reusing the same
5
+ * backend-agnostic geometry the canvas/PDF renderers use
6
+ * ({@link getPresetPathSegments}). `move→M`, `line→L`, `cubic→C`, `close→Z`.
7
+ */
8
+ export declare function presetToSvgPath(preset: string, x: number, y: number, width: number, height: number): string;
9
+ /**
10
+ * Small monochrome outline preview of a DrawingML preset shape, stroked with
11
+ * `currentColor` so it adapts to light/dark themes. Lines and connectors are
12
+ * drawn without a fill ({@link STROKE_ONLY_PRESETS}).
13
+ */
14
+ export declare function ShapeThumbnail(props: {
15
+ preset: string;
16
+ }): JSX.Element;
@@ -1,3 +1,3 @@
1
1
  /** 11pt expressed in CSS pixels (11 * 96 / 72). */
2
- export declare const DEFAULT_FONT_SIZE = 14.6667;
2
+ export { DEFAULT_FONT_SIZE_PX as DEFAULT_FONT_SIZE } from '../../core/units.js';
3
3
  export { PX_PER_POINT } from '../../core/units.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.108",
3
+ "version": "0.0.110",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",