mce 0.15.34 → 0.15.35

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
@@ -100,8 +100,7 @@ npm i mce
100
100
  <template>
101
101
  <div style="width: 100vw; height: 100vh">
102
102
  <EditorLayout :editor="editor">
103
- <template #selector="{ box }" />
104
- <template #transformer="{ box }" />
103
+ <template #selection />
105
104
  <template #floatbar />
106
105
  <template #drawboard />
107
106
  <EditorLayoutItem position="top" :size="56" />
@@ -1,12 +1,6 @@
1
- import type { OrientedBoundingBox } from '../types';
1
+ import type { Slots } from '../editor';
2
2
  import { Editor } from '../editor';
3
- type __VLS_Slots = {
4
- 'selector'?: (props: {
5
- box: OrientedBoundingBox;
6
- }) => void;
7
- 'transformer'?: (props: {
8
- box: Partial<OrientedBoundingBox>;
9
- }) => void;
3
+ type __VLS_Slots = Slots & {
10
4
  'floatbar'?: () => void;
11
5
  'floatbar-top'?: () => void;
12
6
  'floatbar-bottom'?: () => void;
@@ -1,9 +1,4 @@
1
1
  import type { TransformValue } from './shared/TransformControls.vue';
2
- import { Aabb2D } from 'modern-canvas';
3
- type __VLS_Props = {
4
- resizeStrategy?: 'lockAspectRatio' | 'lockAspectRatioDiagonal';
5
- selectedArea?: Aabb2D;
6
- };
7
2
  declare var __VLS_14: {
8
3
  box: {
9
4
  left: number;
@@ -14,7 +9,7 @@ declare var __VLS_14: {
14
9
  borderRadius: number;
15
10
  };
16
11
  }, __VLS_16: {
17
- box: {
12
+ transform: {
18
13
  left: number;
19
14
  top: number;
20
15
  width: number;
@@ -24,12 +19,12 @@ declare var __VLS_14: {
24
19
  };
25
20
  };
26
21
  type __VLS_Slots = {} & {
27
- transformable?: (props: typeof __VLS_14) => any;
22
+ transform?: (props: typeof __VLS_14) => any;
28
23
  } & {
29
24
  default?: (props: typeof __VLS_16) => any;
30
25
  };
31
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
32
- transformable: Readonly<import("vue").ShallowRef<({
26
+ declare const __VLS_base: import("vue").DefineComponent<{}, {
27
+ transformControls: Readonly<import("vue").ShallowRef<({
33
28
  $: import("vue").ComponentInternalInstance;
34
29
  $data: {};
35
30
  $props: {
@@ -50,7 +45,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
50
45
  readonly hideUi?: boolean | undefined;
51
46
  readonly initialSize?: boolean | undefined;
52
47
  readonly borderStyle?: "solid" | "dashed" | undefined;
53
- readonly tipFormat?: ((type: "size") => string) | undefined;
48
+ readonly tip?: string | ((type: "size") => string) | undefined;
54
49
  readonly modelValue?: Partial<TransformValue> | undefined;
55
50
  readonly modelModifiers?: Partial<Record<string, true>> | undefined;
56
51
  readonly onMove?: ((args_0: TransformValue, args_1: TransformValue) => any) | undefined;
@@ -90,7 +85,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
90
85
  hideUi?: boolean;
91
86
  initialSize?: boolean;
92
87
  borderStyle?: "solid" | "dashed";
93
- tipFormat?: (type: "size") => string;
88
+ tip?: string | ((type: "size") => string);
94
89
  } & {
95
90
  modelValue?: Partial<TransformValue>;
96
91
  modelModifiers?: Partial<Record<string, true>>;
@@ -166,7 +161,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
166
161
  hideUi?: boolean;
167
162
  initialSize?: boolean;
168
163
  borderStyle?: "solid" | "dashed";
169
- tipFormat?: (type: "size") => string;
164
+ tip?: string | ((type: "size") => string);
170
165
  } & {
171
166
  modelValue?: Partial<TransformValue>;
172
167
  modelModifiers?: Partial<Record<string, true>>;
@@ -228,7 +223,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
228
223
  readonly hideUi?: boolean | undefined;
229
224
  readonly initialSize?: boolean | undefined;
230
225
  readonly borderStyle?: "solid" | "dashed" | undefined;
231
- readonly tipFormat?: ((type: "size") => string) | undefined;
226
+ readonly tip?: string | ((type: "size") => string) | undefined;
232
227
  readonly modelValue?: Partial<TransformValue> | undefined;
233
228
  readonly modelModifiers?: Partial<Record<string, true>> | undefined;
234
229
  readonly onMove?: ((args_0: TransformValue, args_1: TransformValue) => any) | undefined;
@@ -268,7 +263,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
268
263
  hideUi?: boolean;
269
264
  initialSize?: boolean;
270
265
  borderStyle?: "solid" | "dashed";
271
- tipFormat?: (type: "size") => string;
266
+ tip?: string | ((type: "size") => string);
272
267
  } & {
273
268
  modelValue?: Partial<TransformValue>;
274
269
  modelModifiers?: Partial<Record<string, true>>;
@@ -344,7 +339,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
344
339
  hideUi?: boolean;
345
340
  initialSize?: boolean;
346
341
  borderStyle?: "solid" | "dashed";
347
- tipFormat?: (type: "size") => string;
342
+ tip?: string | ((type: "size") => string);
348
343
  } & {
349
344
  modelValue?: Partial<TransformValue>;
350
345
  modelModifiers?: Partial<Record<string, true>>;
@@ -386,9 +381,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
386
381
  }) => any;
387
382
  };
388
383
  }) | null>>;
389
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
390
- selectedArea: Aabb2D;
391
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
384
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
392
385
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
393
386
  declare const _default: typeof __VLS_export;
394
387
  export default _default;
@@ -25,7 +25,7 @@ type __VLS_Props = {
25
25
  hideUi?: boolean;
26
26
  initialSize?: boolean;
27
27
  borderStyle?: 'solid' | 'dashed';
28
- tipFormat?: (type: 'size') => string;
28
+ tip?: string | ((type: 'size') => string);
29
29
  };
30
30
  declare function start(event?: MouseEvent, index?: number): boolean;
31
31
  type __VLS_ModelProps = {
package/dist/editor.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { EffectScope } from '@vue/reactivity';
2
2
  import type { RemovableRef } from '@vueuse/core';
3
3
  import type { ObservableEvents } from 'modern-idoc';
4
- import type { App, InjectionKey } from 'vue';
4
+ import type { App, ComponentPublicInstance, InjectionKey } from 'vue';
5
5
  import type { Mixin } from './mixin';
6
- import type { OverlayPluginComponent, PanelPluginComponent, Plugin, PluginComponent, PluginObject } from './plugin';
6
+ import type { Plugin, PluginComponent, PluginObject } from './plugin';
7
7
  import { Observable } from 'modern-idoc';
8
8
  export interface Options extends Mce.Options {
9
9
  debug?: boolean;
@@ -14,20 +14,24 @@ export interface Editor extends Mce.Editor {
14
14
  }
15
15
  export interface Events extends Mce.Events, ObservableEvents {
16
16
  }
17
+ export interface Slots extends Mce.Slots {
18
+ }
19
+ export type EditorComponent = PluginComponent & {
20
+ plugin: string;
21
+ indexInPlugin: number;
22
+ };
17
23
  export declare class Editor extends Observable<Events> {
18
24
  static injectionKey: InjectionKey<Editor>;
19
25
  debug: import("vue").Ref<boolean, boolean>;
20
26
  config: RemovableRef<Mce.Config>;
21
27
  onEmit?: <K extends keyof Events & string>(event: K, ...args: Events[K]) => void;
22
28
  plugins: Map<string, PluginObject>;
23
- pluginsComponents: import("vue").ComputedRef<{
24
- overlay: OverlayPluginComponent[];
25
- panel: PanelPluginComponent[];
26
- }>;
29
+ protected _pluginComponentTypes: string[];
30
+ components: import("vue").ComputedRef<EditorComponent[]>;
31
+ componentRefs: import("vue").Ref<Record<string, (HTMLElement | ComponentPublicInstance | null)[]>, Record<string, (HTMLElement | ComponentPublicInstance | null)[]>>;
27
32
  protected _setups: (() => void | Promise<void>)[];
28
33
  constructor(options?: Options);
29
34
  protected _setupObservable(): void;
30
- getPlugins: (type: PluginComponent["type"]) => PluginComponent[];
31
35
  log: (...args: any[]) => void;
32
36
  emit: <K extends keyof Events & string>(event: K, ...args: Events[K]) => this;
33
37
  protected _setupOptions(options: Options): void;
package/dist/index.css CHANGED
@@ -636,52 +636,6 @@
636
636
  font-size: 0.875rem;
637
637
  cursor: pointer;
638
638
  white-space: nowrap;
639
- }.mce-smart-guides {
640
- position: absolute;
641
- overflow: hidden;
642
- left: 0;
643
- right: 0;
644
- top: 0;
645
- bottom: 0;
646
- }
647
- .mce-smart-guides__alignment {
648
- position: absolute;
649
- background-color: #FF4AFF;
650
- height: 1px;
651
- width: 1px;
652
- }
653
- .mce-smart-guides__area {
654
- position: absolute;
655
- display: flex;
656
- align-items: center;
657
- justify-content: center;
658
- background-color: rgba(244, 36, 253, 0.2);
659
- }
660
- .mce-smart-guides__area:before {
661
- content: "";
662
- background: #1690ff;
663
- height: 1px;
664
- width: 100%;
665
- }
666
- .mce-smart-guides__area:after {
667
- position: absolute;
668
- content: "";
669
- height: 5px;
670
- width: 100%;
671
- border-left: 1px solid #1690ff;
672
- border-right: 1px solid #1690ff;
673
- }
674
- .mce-smart-guides__area--vertical:before {
675
- height: 100%;
676
- width: 1px;
677
- }
678
- .mce-smart-guides__area--vertical:after {
679
- height: 100%;
680
- width: 5px;
681
- border-left: none;
682
- border-right: none;
683
- border-top: 1px solid #1690ff;
684
- border-bottom: 1px solid #1690ff;
685
639
  }.mce-transform-controls {
686
640
  left: 0;
687
641
  top: 0;
@@ -757,6 +711,86 @@
757
711
  .mce-transform-controls--hide-ui .mce-transform-controls__rotator,
758
712
  .mce-transform-controls--hide-ui .mce-transform-controls__tip {
759
713
  visibility: hidden;
714
+ }.mce-selection {
715
+ position: absolute;
716
+ left: 0;
717
+ right: 0;
718
+ top: 0;
719
+ bottom: 0;
720
+ }
721
+ .mce-selection__slot {
722
+ position: absolute;
723
+ }
724
+ .mce-selection__parent {
725
+ position: absolute;
726
+ pointer-events: none;
727
+ border-width: 1px;
728
+ border-style: dashed;
729
+ color: rgba(var(--mce-theme-primary), 1);
730
+ opacity: 0.5;
731
+ }
732
+ .mce-selection__area {
733
+ position: absolute;
734
+ border-width: 1px;
735
+ border-style: solid;
736
+ color: rgba(var(--mce-theme-primary), 1);
737
+ background-color: rgba(var(--mce-theme-primary), 0.1);
738
+ }
739
+ .mce-selection__transform {
740
+ position: absolute;
741
+ color: rgba(var(--mce-theme-primary), 1);
742
+ }
743
+ .mce-selection__node {
744
+ position: absolute;
745
+ border-width: 1px;
746
+ border-style: solid;
747
+ color: rgba(var(--mce-theme-primary), 1);
748
+ }.mce-smart-guides {
749
+ position: absolute;
750
+ overflow: hidden;
751
+ left: 0;
752
+ right: 0;
753
+ top: 0;
754
+ bottom: 0;
755
+ }
756
+ .mce-smart-guides__alignment {
757
+ position: absolute;
758
+ background-color: #FF4AFF;
759
+ height: 1px;
760
+ width: 1px;
761
+ }
762
+ .mce-smart-guides__area {
763
+ position: absolute;
764
+ display: flex;
765
+ align-items: center;
766
+ justify-content: center;
767
+ background-color: rgba(244, 36, 253, 0.2);
768
+ }
769
+ .mce-smart-guides__area:before {
770
+ content: "";
771
+ background: #1690ff;
772
+ height: 1px;
773
+ width: 100%;
774
+ }
775
+ .mce-smart-guides__area:after {
776
+ position: absolute;
777
+ content: "";
778
+ height: 5px;
779
+ width: 100%;
780
+ border-left: 1px solid #1690ff;
781
+ border-right: 1px solid #1690ff;
782
+ }
783
+ .mce-smart-guides__area--vertical:before {
784
+ height: 100%;
785
+ width: 1px;
786
+ }
787
+ .mce-smart-guides__area--vertical:after {
788
+ height: 100%;
789
+ width: 5px;
790
+ border-left: none;
791
+ border-right: none;
792
+ border-top: 1px solid #1690ff;
793
+ border-bottom: 1px solid #1690ff;
760
794
  }.mce-smart-selection {
761
795
  position: absolute;
762
796
  overflow: hidden;
@@ -873,6 +907,20 @@
873
907
  font-size: 0.75rem;
874
908
  padding: 0 2px;
875
909
  font-family: system-ui, -apple-system, sans-serif;
910
+ }.mce-text-editor {
911
+ position: absolute;
912
+ width: 0;
913
+ height: 0;
914
+ left: 0;
915
+ top: 0;
916
+ overflow: visible;
917
+ }
918
+ .mce-text-editor__wrapper {
919
+ position: absolute;
920
+ }
921
+ .mce-text-editor__editor {
922
+ pointer-events: auto !important;
923
+ cursor: move;
876
924
  }.mce-payhead {
877
925
  bottom: 0;
878
926
  left: -5px;
@@ -1181,67 +1229,6 @@
1181
1229
  border-radius: 4px;
1182
1230
  }.mce-floatbar .mce-overlay-content {
1183
1231
  overflow: visible;
1184
- }.mce-cropper {
1185
- pointer-events: auto;
1186
- position: absolute;
1187
- left: 0;
1188
- top: 0;
1189
- width: 100%;
1190
- height: 100%;
1191
- }
1192
- .mce-cropper__source {
1193
- position: absolute;
1194
- width: 100%;
1195
- height: 100%;
1196
- transform-origin: top left;
1197
- }
1198
- .mce-cropper__source canvas {
1199
- position: absolute;
1200
- width: 100%;
1201
- height: 100%;
1202
- }
1203
- .mce-cropper__transform {
1204
- position: absolute;
1205
- color: rgba(var(--mce-theme-primary), 1);
1206
- opacity: 0.5;
1207
- }
1208
- .mce-cropper__transform_rect {
1209
- width: 100%;
1210
- height: 100%;
1211
- }.mce-selector {
1212
- position: absolute;
1213
- left: 0;
1214
- right: 0;
1215
- top: 0;
1216
- bottom: 0;
1217
- }
1218
- .mce-selector__slot {
1219
- position: absolute;
1220
- }
1221
- .mce-selector__parent {
1222
- position: absolute;
1223
- pointer-events: none;
1224
- border-width: 1px;
1225
- border-style: dashed;
1226
- color: rgba(var(--mce-theme-primary), 1);
1227
- opacity: 0.5;
1228
- }
1229
- .mce-selector__area {
1230
- position: absolute;
1231
- border-width: 1px;
1232
- border-style: solid;
1233
- color: rgba(var(--mce-theme-primary), 1);
1234
- background-color: rgba(var(--mce-theme-primary), 0.1);
1235
- }
1236
- .mce-selector__transform {
1237
- position: absolute;
1238
- color: rgba(var(--mce-theme-primary), 1);
1239
- }
1240
- .mce-selector__node {
1241
- position: absolute;
1242
- border-width: 1px;
1243
- border-style: solid;
1244
- color: rgba(var(--mce-theme-primary), 1);
1245
1232
  }.mce-float-panel {
1246
1233
  position: absolute;
1247
1234
  pointer-events: auto !important;
@@ -1323,20 +1310,6 @@
1323
1310
  --v-layout-right: 0px;
1324
1311
  --v-layout-top: 0px;
1325
1312
  --v-layout-bottom: 0px;
1326
- }.mce-text-editor {
1327
- position: absolute;
1328
- width: 0;
1329
- height: 0;
1330
- left: 0;
1331
- top: 0;
1332
- overflow: visible;
1333
- }
1334
- .mce-text-editor__wrapper {
1335
- position: absolute;
1336
- }
1337
- .mce-text-editor__editor {
1338
- pointer-events: auto !important;
1339
- cursor: move;
1340
1313
  }.mce-editor {
1341
1314
  --mce-theme-primary: 69, 151, 248;
1342
1315
  --mce-theme-on-primary: 255, 255, 255;
@@ -1407,6 +1380,33 @@
1407
1380
  width: 100%;
1408
1381
  height: 100%;
1409
1382
  pointer-events: none;
1383
+ }.mce-cropper {
1384
+ pointer-events: auto;
1385
+ position: absolute;
1386
+ left: 0;
1387
+ top: 0;
1388
+ width: 100%;
1389
+ height: 100%;
1390
+ }
1391
+ .mce-cropper__source {
1392
+ position: absolute;
1393
+ width: 100%;
1394
+ height: 100%;
1395
+ transform-origin: top left;
1396
+ }
1397
+ .mce-cropper__source canvas {
1398
+ position: absolute;
1399
+ width: 100%;
1400
+ height: 100%;
1401
+ }
1402
+ .mce-cropper__transform {
1403
+ position: absolute;
1404
+ color: rgba(var(--mce-theme-primary), 1);
1405
+ opacity: 0.5;
1406
+ }
1407
+ .mce-cropper__transform_rect {
1408
+ width: 100%;
1409
+ height: 100%;
1410
1410
  }.mce-dialog > * {
1411
1411
  box-shadow: var(--mce-shadow);
1412
1412
  }