@mlightcad/mtext-input-box 0.2.30 → 0.3.1

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/README.md CHANGED
@@ -9,7 +9,7 @@ Three.js-based MTEXT editor component with built-in IME bridge, cursor/selection
9
9
  - MTEXT-style editing in Three.js
10
10
  - Keyboard/mouse/IME editing, selection, formatting, and undo/redo
11
11
  - Built-in toolbar (configurable theme, font list, container, and offset)
12
- - Integration with `@mlightcad/mtext-renderer` and `@mlightcad/text-box-cursor`
12
+ - Integration with `@mlightcad/mtext-parser`, `@mlightcad/mtext-renderer`, and `@mlightcad/text-box-cursor`
13
13
 
14
14
  ## Technical Details
15
15
 
@@ -20,17 +20,17 @@ Three.js-based MTEXT editor component with built-in IME bridge, cursor/selection
20
20
  ## Install
21
21
 
22
22
  ```bash
23
- pnpm add @mlightcad/mtext-input-box three @mlightcad/mtext-renderer
23
+ pnpm add @mlightcad/mtext-input-box three @mlightcad/mtext-parser @mlightcad/mtext-renderer
24
24
  ```
25
25
 
26
- `three` and `@mlightcad/mtext-renderer` are peer dependencies of `@mlightcad/mtext-input-box`, so your app should install them directly.
26
+ `three`, `@mlightcad/mtext-parser`, and `@mlightcad/mtext-renderer` are peer dependencies of `@mlightcad/mtext-input-box`, so your app should install them directly.
27
27
 
28
28
  ## Basic Usage
29
29
 
30
30
  ```ts
31
31
  import * as THREE from 'three';
32
32
  import { MTextInputBox } from '@mlightcad/mtext-input-box';
33
- import { MTextColor } from '@mlightcad/mtext-renderer';
33
+ import { MTextColor } from '@mlightcad/mtext-parser';
34
34
 
35
35
  const scene = new THREE.Scene();
36
36
  const camera = new THREE.OrthographicCamera(0, 1000, 600, 0, -1000, 1000);
@@ -108,7 +108,8 @@ Example (mount a Vue color picker):
108
108
 
109
109
  ```ts
110
110
  import { createApp, h, ref } from 'vue';
111
- import { getColorByIndex, MTextColor } from '@mlightcad/mtext-renderer';
111
+ import { MTextColor } from '@mlightcad/mtext-parser';
112
+ import { getColorByIndex } from '@mlightcad/mtext-renderer';
112
113
 
113
114
  toolbar: {
114
115
  colorPicker: ({ container, initialColor, theme, onChange }) => {
@@ -1,4 +1,4 @@
1
- import { MTextContext, type MTextParserOptions } from '@mlightcad/mtext-renderer';
1
+ import { MTextContext, type MTextParserOptions } from '@mlightcad/mtext-parser';
2
2
  import type { MTextAst, MTextStyle } from './types';
3
3
  /** Parse mtext into a character-level AST suitable for insert/delete/replace workflows. */
4
4
  export declare function parseMTextToAst(content: string, ctx?: MTextContext, options?: Omit<MTextParserOptions, 'yieldPropertyCommands'>): MTextAst;
package/dist/model/ast.js CHANGED
@@ -1,4 +1,4 @@
1
- import { MTextContext, MTextParser, TokenType } from '@mlightcad/mtext-renderer';
1
+ import { MTextContext, MTextParser, TokenType } from '@mlightcad/mtext-parser';
2
2
  import { cloneStyle, contextToStyle, hasNodeStyle, serializeStyleDelta } from './style';
3
3
  /** Parse mtext into a character-level AST suitable for insert/delete/replace workflows. */
4
4
  export function parseMTextToAst(content, ctx, options = {}) {
@@ -1,4 +1,4 @@
1
- import { MTextContext } from '@mlightcad/mtext-renderer';
1
+ import { MTextContext } from '@mlightcad/mtext-parser';
2
2
  import type { EditorSelection, MTextAst, MTextStyle } from './types';
3
3
  /** Minimal mtext editor document wrapper on top of AST. */
4
4
  export declare class MTextDocument {
@@ -1,4 +1,4 @@
1
- import { MTextContext } from '@mlightcad/mtext-renderer';
1
+ import { MTextContext } from '@mlightcad/mtext-parser';
2
2
  import { buildMTextFromAst, deleteRangeInAst, inferInsertStyle, parseMTextToAst, replaceRangeInAst } from './ast';
3
3
  import { cloneStyle, contextToStyle } from './style';
4
4
  /** Minimal mtext editor document wrapper on top of AST. */
@@ -1,4 +1,4 @@
1
- import { MTextContext } from '@mlightcad/mtext-renderer';
1
+ import { MTextContext } from '@mlightcad/mtext-parser';
2
2
  import type { MTextAstCharNode, MTextAstColumnBreakNode, MTextAstNode, MTextAstParagraphBreakNode, MTextAstStackNode, MTextAstWrapAtDimLineNode, MTextStyle } from './types';
3
3
  export declare function contextToStyle(ctx: MTextContext): MTextStyle;
4
4
  export declare function cloneStyle(style: MTextStyle): MTextStyle;
@@ -1,4 +1,4 @@
1
- import { MTextContext, MTextLineAlignment, MTextParagraphAlignment, rgb2int } from '@mlightcad/mtext-renderer';
1
+ import { MTextContext, MTextLineAlignment, MTextParagraphAlignment, rgb2int } from '@mlightcad/mtext-parser';
2
2
  function scriptFromAlign(align) {
3
3
  if (align === MTextLineAlignment.TOP)
4
4
  return 'superscript';
@@ -1,4 +1,4 @@
1
- import type { FactorValue, FontFace, MTextLineAlignment, ParagraphProperties, RGB } from '@mlightcad/mtext-renderer';
1
+ import type { FactorValue, FontFace, MTextLineAlignment, ParagraphProperties, RGB } from '@mlightcad/mtext-parser';
2
2
  export type MTextScript = 'normal' | 'superscript' | 'subscript';
3
3
  /** Snapshot of resolved text style for editable AST nodes. */
4
4
  export interface MTextStyle {
@@ -1,5 +1,5 @@
1
1
  import { getColorByIndex } from '@mlightcad/mtext-renderer';
2
- import { MTextColor } from '@mlightcad/mtext-renderer';
2
+ import { MTextColor } from '@mlightcad/mtext-parser';
3
3
  import { toolbarIcons } from './icons';
4
4
  const STYLE_ID = 'mlightcad-mtext-toolbar-style';
5
5
  const DEFAULT_FONT_FAMILIES = [
@@ -1,4 +1,4 @@
1
- import { MTextParagraphAlignment } from '@mlightcad/mtext-renderer';
1
+ import { MTextParagraphAlignment } from '@mlightcad/mtext-parser';
2
2
  export const DEFAULT_FONT_FAMILY = 'simkai';
3
3
  /** Returns default character format. */
4
4
  export function defaultCharFormat() {
@@ -1,5 +1,6 @@
1
1
  import type { Box, CursorStyle, SelectionStyle } from '@mlightcad/text-box-cursor';
2
- import type { ColorSettings, MTextAttachmentPoint, MTextColor, MTextParagraphAlignment, TextStyle } from '@mlightcad/mtext-renderer';
2
+ import type { MTextColor, MTextParagraphAlignment } from '@mlightcad/mtext-parser';
3
+ import type { ColorSettings, MTextAttachmentPoint, TextStyle } from '@mlightcad/mtext-renderer';
3
4
  import type * as THREE from 'three';
4
5
  /** Vertical script style for a character run. */
5
6
  export type CharScript = 'normal' | 'superscript' | 'subscript';
@@ -1,5 +1,6 @@
1
1
  import { CursorRenderer, TextBoxCursor, ThreeJsRendererAdapter } from '@mlightcad/text-box-cursor';
2
- import { getColorByIndex, LINE_SPACING_SCALE_FACTOR, MText, MTextAttachmentPoint, MTextColor, MTextContext, MTextFlowDirection, MTextLineAlignment, MTextParagraphAlignment, UnifiedRenderer } from '@mlightcad/mtext-renderer';
2
+ import { getColorByIndex, LINE_SPACING_SCALE_FACTOR, MText, MTextAttachmentPoint, MTextFlowDirection, UnifiedRenderer } from '@mlightcad/mtext-renderer';
3
+ import { MTextColor, MTextContext, MTextLineAlignment, MTextParagraphAlignment } from '@mlightcad/mtext-parser';
3
4
  import * as THREE from 'three';
4
5
  import { DEFAULT_FONT_FAMILY, defaultCharFormat, sameFormat } from './format';
5
6
  import { hasNodeStyle, MTextDocument } from '../model';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/mtext-input-box",
3
- "version": "0.2.30",
3
+ "version": "0.3.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,12 +23,14 @@
23
23
  "@mlightcad/text-box-cursor": "0.1.1"
24
24
  },
25
25
  "peerDependencies": {
26
- "@mlightcad/mtext-renderer": "^0.12.13",
26
+ "@mlightcad/mtext-parser": "^1.5.3",
27
+ "@mlightcad/mtext-renderer": "^0.13.1",
27
28
  "three": "^0.172.0"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@eslint/js": "^9.34.0",
31
- "@mlightcad/mtext-renderer": "^0.12.13",
32
+ "@mlightcad/mtext-parser": "^1.5.3",
33
+ "@mlightcad/mtext-renderer": "^0.13.1",
32
34
  "@types/node": "^24.4.0",
33
35
  "@types/three": "^0.172.0",
34
36
  "@typescript-eslint/eslint-plugin": "^8.41.0",