@hufe921/canvas-editor 0.9.133 → 0.9.135

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.
@@ -0,0 +1,14 @@
1
+ import { Draw } from '../draw/Draw';
2
+ export declare class Accessibility {
3
+ private draw;
4
+ private i18n;
5
+ private disabled;
6
+ private assertiveDom;
7
+ private rangeChangeHandler;
8
+ constructor(draw: Draw);
9
+ private handleRangeChange;
10
+ selection(): void;
11
+ input(data: string): void;
12
+ assertive(message: string): void;
13
+ destroy(): void;
14
+ }
@@ -42,6 +42,7 @@ import { Area } from './interactive/Area';
42
42
  import { Badge } from './frame/Badge';
43
43
  import { Graffiti } from './graffiti/Graffiti';
44
44
  import { Magnifier } from './interactive/Magnifier';
45
+ import { Accessibility } from '../accessibility/Accessibility';
45
46
  export declare class Draw {
46
47
  private container;
47
48
  private pageContainer;
@@ -107,6 +108,7 @@ export declare class Draw {
107
108
  private selectionObserver;
108
109
  private imageObserver;
109
110
  private graffiti;
111
+ private accessibility;
110
112
  private LETTER_REG;
111
113
  private WORD_LIKE_REG;
112
114
  private rowList;
@@ -212,6 +214,7 @@ export declare class Draw {
212
214
  getImageObserver(): ImageObserver;
213
215
  getI18n(): I18n;
214
216
  getGraffiti(): Graffiti;
217
+ getAccessibility(): Accessibility;
215
218
  getRowCount(): number;
216
219
  getDataURL(payload?: IGetImageOption): Promise<string[]>;
217
220
  getPainterStyle(): IElementStyle | null;
@@ -17,10 +17,11 @@ export declare class Search {
17
17
  constructor(draw: Draw);
18
18
  getSearchKeyword(): string | null;
19
19
  setSearchKeyword(payload: string | null, options?: ISearchOption): void;
20
+ private getSearchMatchGroupStartIndex;
20
21
  searchNavigatePre(): number | null;
21
22
  searchNavigateNext(): number | null;
22
23
  searchNavigateScrollIntoView(position: IElementPosition): void;
23
- getSearchNavigateIndexList(): any[];
24
+ getSearchNavigateIndexList(): number[];
24
25
  getSearchMatchList(): ISearchResult[];
25
26
  getSearchNavigateInfo(): null | INavigateInfo;
26
27
  getMatchList(payload: string, originalElementList: IElement[]): ISearchResult[];
@@ -16,6 +16,20 @@ export interface IDatePickerLang {
16
16
  };
17
17
  year: string;
18
18
  month: string;
19
+ months: {
20
+ jan: string;
21
+ feb: string;
22
+ mar: string;
23
+ apr: string;
24
+ may: string;
25
+ jun: string;
26
+ jul: string;
27
+ aug: string;
28
+ sep: string;
29
+ oct: string;
30
+ nov: string;
31
+ dec: string;
32
+ };
19
33
  hour: string;
20
34
  minute: string;
21
35
  second: string;
@@ -37,15 +51,24 @@ export declare class DatePicker {
37
51
  private isDatePicker;
38
52
  private pickDate;
39
53
  private lang;
54
+ private datePickerType;
55
+ private viewMode;
56
+ private yearPageStart;
40
57
  constructor(draw: Draw, options?: IDatePickerOption);
41
58
  private _createDom;
42
59
  private _bindEvent;
43
60
  private _setPosition;
44
61
  isInvalidDate(value: Date): boolean;
45
62
  private _setValue;
63
+ private _getDatePickerType;
46
64
  private _getLang;
47
65
  private _setLangChange;
48
66
  private _update;
67
+ private _updateTitleVisibility;
68
+ private _updateDateView;
69
+ private _updateYearView;
70
+ private _updateMonthView;
71
+ private _switchView;
49
72
  private _toggleDateTimePicker;
50
73
  private _setDatePick;
51
74
  private _setTimePick;
@@ -53,6 +76,8 @@ export declare class DatePicker {
53
76
  private _nextMonth;
54
77
  private _preYear;
55
78
  private _nextYear;
79
+ private _preYearPage;
80
+ private _nextYearPage;
56
81
  private _now;
57
82
  private _toggleVisible;
58
83
  private _submit;
@@ -20,6 +20,11 @@ export declare class Position {
20
20
  getSelectionPositionList(): IElementPosition[] | null;
21
21
  setPositionList(payload: IElementPosition[]): void;
22
22
  setFloatPositionList(payload: IFloatPosition[]): void;
23
+ getFloatPositionByElement(element: IElement): IFloatPosition | null;
24
+ getFloatPositionCoordinate(floatPosition: IFloatPosition): {
25
+ x: number;
26
+ y: number;
27
+ };
23
28
  computePageRowPosition(payload: IComputePageRowPositionPayload): IComputePageRowPositionResult;
24
29
  computePositionList(): void;
25
30
  computeRowPosition(payload: IComputeRowPositionPayload): IElementPosition[];
@@ -0,0 +1,2 @@
1
+ import { IAccessibilityOption } from '../../interface/Accessibility';
2
+ export declare const defaultAccessibilityOption: Readonly<Required<IAccessibilityOption>>;
@@ -0,0 +1,5 @@
1
+ export declare enum DatePickerMode {
2
+ DATE = "date",
3
+ MONTH = "month",
4
+ YEAR = "year"
5
+ }
@@ -0,0 +1,3 @@
1
+ export interface IAccessibilityOption {
2
+ disabled?: boolean;
3
+ }
@@ -28,6 +28,7 @@ import { IRange } from './Range';
28
28
  import { IGraffitiData, IGraffitiOption } from './Graffiti';
29
29
  import { IWhiteSpaceOption } from './WhiteSpace';
30
30
  import { IMagnifierOption } from './Magnifier';
31
+ import { IAccessibilityOption } from './Accessibility';
31
32
  export interface IEditorData {
32
33
  header?: IElement[];
33
34
  main: IElement[];
@@ -106,6 +107,7 @@ export interface IEditorOption {
106
107
  imgCaption?: IImgCaptionOption;
107
108
  list?: IListOption;
108
109
  magnifier?: IMagnifierOption;
110
+ accessibility?: IAccessibilityOption;
109
111
  }
110
112
  export interface IEditorResult {
111
113
  version: string;
@@ -132,6 +134,7 @@ export interface IPrintModeRule {
132
134
  imagePreviewerDisabled?: boolean;
133
135
  backgroundDisabled?: boolean;
134
136
  filterEmptyControl?: boolean;
137
+ filterHideElementRow?: boolean;
135
138
  }
136
139
  export interface IReadonlyModeRule {
137
140
  imagePreviewerDisabled?: boolean;
@@ -1,4 +1,4 @@
1
- import { IContentChange, IControlChange, IControlContentChange, IImageDblclick, IImageMousedown, IImageSizeChange, IInputEventChange, IIntersectionPageNoChange, ILabelMousedown, IMouseEventChange, IPageModeChange, IPageScaleChange, IPageSizeChange, IPositionContextChange, IRangeStyleChange, ISaved, IVisiblePageNoListChange, IZoneChange } from './Listener';
1
+ import { IContentChange, IControlChange, IControlContentChange, IImageDblclick, IImageMousedown, IImageSizeChange, IInputEventChange, IIntersectionPageNoChange, ILabelMousedown, IMouseEventChange, IPageModeChange, IPageScaleChange, IPageSizeChange, IPositionContextChange, IRangeChange, IRangeStyleChange, ISaved, IVisiblePageNoListChange, IZoneChange } from './Listener';
2
2
  export interface EventBusMap {
3
3
  rangeStyleChange: IRangeStyleChange;
4
4
  visiblePageNoListChange: IVisiblePageNoListChange;
@@ -23,4 +23,5 @@ export interface EventBusMap {
23
23
  imageMousedown: IImageMousedown;
24
24
  imageDblclick: IImageDblclick;
25
25
  labelMousedown: ILabelMousedown;
26
+ rangeChange: IRangeChange;
26
27
  }
@@ -7,6 +7,7 @@ import { IControlChangeResult, IControlContentChangeResult } from './Control';
7
7
  import { IEditorResult } from './Editor';
8
8
  import { IElement } from './Element';
9
9
  import { IPositionContext } from './Position';
10
+ import { IRange } from './Range';
10
11
  import { ITextDecoration } from './Text';
11
12
  export interface IRangeStyle {
12
13
  type: ElementType | null;
@@ -64,3 +65,4 @@ export type ILabelMousedown = (payload: {
64
65
  evt: MouseEvent;
65
66
  element: IElement;
66
67
  }) => void;
68
+ export type IRangeChange = (payload: IRange) => void;
@@ -71,6 +71,7 @@ export interface IComputePageRowPositionPayload {
71
71
  trIndex?: number;
72
72
  tdValueIndex?: number;
73
73
  zone?: EditorZone;
74
+ tablePosition?: IElementPosition;
74
75
  }
75
76
  export interface IComputePageRowPositionResult {
76
77
  x: number;
@@ -0,0 +1,4 @@
1
+ export interface IAccessibilityLang {
2
+ selected: string;
3
+ input: string;
4
+ }
@@ -1,6 +1,8 @@
1
1
  import { IDatePickerLang } from '../../core/draw/particle/date/DatePicker';
2
2
  import { IContextmenuLang } from '../contextmenu/ContextMenu';
3
+ import { IAccessibilityLang } from './Accessibility';
3
4
  export interface ILang {
4
5
  contextmenu: IContextmenuLang;
5
6
  datePicker: IDatePickerLang;
7
+ accessibility: IAccessibilityLang;
6
8
  }
package/package.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "name": "@hufe921/canvas-editor",
3
3
  "author": "Hufe",
4
4
  "license": "MIT",
5
- "version": "0.9.133",
6
- "description": "rich text editor by canvas/svg",
5
+ "version": "0.9.135",
6
+ "description": "A Canvas/SVG-based rich text editor",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/",
9
9
  "access": "public"
@@ -50,27 +50,27 @@
50
50
  "devDependencies": {
51
51
  "@eslint/js": "^10.0.1",
52
52
  "@rollup/plugin-typescript": "^12.3.0",
53
- "@types/jsdom": "^28.0.1",
54
- "@types/node": "^24.0.0",
53
+ "@types/jsdom": "^28.0.3",
54
+ "@types/node": "^24.12.4",
55
55
  "@types/prismjs": "^1.26.6",
56
- "@typescript-eslint/eslint-plugin": "^8.59.1",
57
- "@typescript-eslint/parser": "^8.59.1",
58
- "@vitest/coverage-v8": "^4.1.5",
59
- "cypress": "^15.14.2",
56
+ "@typescript-eslint/eslint-plugin": "^8.59.3",
57
+ "@typescript-eslint/parser": "^8.59.3",
58
+ "@vitest/coverage-v8": "^4.1.6",
59
+ "cypress": "^15.15.0",
60
60
  "cypress-file-upload": "^5.0.8",
61
- "eslint": "^10.3.0",
61
+ "eslint": "^10.4.0",
62
62
  "globals": "^17.6.0",
63
63
  "jsdom": "^29.1.1",
64
64
  "simple-git-hooks": "^2.13.1",
65
65
  "tslib": "^2.8.1",
66
66
  "typescript": "^6.0.3",
67
- "typescript-eslint": "^8.59.1",
68
- "vite": "^8.0.10",
67
+ "typescript-eslint": "^8.59.3",
68
+ "vite": "^8.0.13",
69
69
  "vite-plugin-css-injected-by-js": "^5.0.1",
70
70
  "vitepress": "^1.6.4",
71
- "vitest": "^4.1.5",
71
+ "vitest": "^4.1.6",
72
72
  "vitest-canvas-mock": "^1.1.4",
73
- "vue": "^3.5.33"
73
+ "vue": "^3.5.34"
74
74
  },
75
75
  "simple-git-hooks": {
76
76
  "pre-commit": "npm run lint && npm run type:check",