mce 0.17.0 → 0.17.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/dist/index.js CHANGED
@@ -417,7 +417,6 @@ function propsFactory(props, source) {
417
417
  }, {});
418
418
  };
419
419
  }
420
- crypto.getRandomValues.bind(crypto);
421
420
  const _0_config_base = defineMixin((editor, options) => {
422
421
  const {
423
422
  registerConfig,
@@ -442,13 +441,13 @@ const _0_config_base = defineMixin((editor, options) => {
442
441
  });
443
442
  const checkerboardConfig = registerConfig("canvas.checkerboard", {
444
443
  default: {
445
- enabled: false,
444
+ enabled: true,
446
445
  style: "grid"
447
446
  }
448
447
  });
449
448
  const pixelGridConfig = registerConfig("canvas.pixelGrid", {
450
449
  default: {
451
- enabled: false
450
+ enabled: true
452
451
  }
453
452
  });
454
453
  const pixelateConfig = registerConfig("canvas.pixelate", {
@@ -463,7 +462,7 @@ const _0_config_base = defineMixin((editor, options) => {
463
462
  });
464
463
  const cameraConfig = registerConfig("viewport.camera", {
465
464
  default: {
466
- enabled: false
465
+ enabled: true
467
466
  }
468
467
  });
469
468
  return () => {
@@ -758,7 +757,6 @@ class YDoc extends Observable {
758
757
  _yChildrenIds;
759
758
  _nodeMap = /* @__PURE__ */ new Map();
760
759
  indexeddb;
761
- _ready = false;
762
760
  _isSelfTransaction(transaction) {
763
761
  if (transaction) {
764
762
  return !transaction.origin || transaction.origin === this._yDoc.clientID;
@@ -788,6 +786,9 @@ class YDoc extends Observable {
788
786
  this.indexeddb = await indexeddb.whenSynced;
789
787
  console.info("loaded data from indexed db");
790
788
  }
789
+ load() {
790
+ this._yDoc.load();
791
+ }
791
792
  transact(fn, should = true) {
792
793
  if (this._transacting !== void 0) {
793
794
  return fn();
@@ -809,18 +810,6 @@ class YDoc extends Observable {
809
810
  this._transacting = void 0;
810
811
  return result;
811
812
  }
812
- async load(initFn) {
813
- if (this._ready) {
814
- return this;
815
- }
816
- this._ready = true;
817
- await this.transact(async () => {
818
- this._yDoc.load();
819
- await initFn?.();
820
- }, false);
821
- this.undoManager.clear();
822
- return this;
823
- }
824
813
  _debug(..._args) {
825
814
  }
826
815
  _yChildrenChange(event, transaction) {
@@ -1111,11 +1100,12 @@ class YDoc extends Observable {
1111
1100
  }
1112
1101
  }
1113
1102
  class Doc extends Node$1 {
1114
- constructor(source, _local = false) {
1103
+ _yDoc;
1104
+ _source;
1105
+ constructor(source) {
1115
1106
  super({
1116
1107
  name: "Doc"
1117
1108
  });
1118
- this._local = _local;
1119
1109
  let id;
1120
1110
  let _source;
1121
1111
  if (typeof source === "string") {
@@ -1143,11 +1133,10 @@ class Doc extends Node$1 {
1143
1133
  );
1144
1134
  _doc2.on("history", (um) => this.emit("history", um));
1145
1135
  _doc2._proxyRoot(this);
1136
+ _doc2.load();
1146
1137
  this._yDoc = _doc2;
1147
1138
  this._source = _source;
1148
1139
  }
1149
- _yDoc;
1150
- _source;
1151
1140
  transact = (fn, should = true) => {
1152
1141
  return this._yDoc.transact(fn, should);
1153
1142
  };
@@ -1176,17 +1165,14 @@ class Doc extends Node$1 {
1176
1165
  this._yDoc._transacting = oldTransacting;
1177
1166
  return this;
1178
1167
  };
1179
- load = async () => {
1168
+ loadIndexeddb = async () => {
1169
+ console.log(this._yDoc.id);
1170
+ await this._yDoc.loadIndexeddb();
1171
+ };
1172
+ init = () => {
1180
1173
  const source = this._source;
1181
1174
  this._source = void 0;
1182
- await this._yDoc.load(async () => {
1183
- if (this._local) {
1184
- try {
1185
- await this._yDoc.loadIndexeddb();
1186
- } catch (e) {
1187
- console.error(e);
1188
- }
1189
- }
1175
+ this.transact(() => {
1190
1176
  if (source && typeof source !== "string") {
1191
1177
  if (Array.isArray(source)) {
1192
1178
  this.set({ children: source });
@@ -1194,7 +1180,9 @@ class Doc extends Node$1 {
1194
1180
  this.set(source);
1195
1181
  }
1196
1182
  }
1197
- });
1183
+ }, false);
1184
+ this.clearHistory();
1185
+ return this;
1198
1186
  };
1199
1187
  destroy = () => {
1200
1188
  super.destroy();
@@ -1203,10 +1191,7 @@ class Doc extends Node$1 {
1203
1191
  }
1204
1192
  const _0_context = defineMixin((editor, options) => {
1205
1193
  const root = ref(
1206
- new Doc(
1207
- options.db?.local ? "doc" : void 0,
1208
- options.db?.local
1209
- )
1194
+ new Doc(options.db?.local ? "doc" : void 0)
1210
1195
  );
1211
1196
  const docLoading = ref(false);
1212
1197
  const fonts = markRaw(new Fonts());
@@ -1378,7 +1363,6 @@ const _0_context = defineMixin((editor, options) => {
1378
1363
  onBeforeMount(() => {
1379
1364
  on("setDoc", onSetDoc);
1380
1365
  renderEngine.value.start();
1381
- root2.value.load();
1382
1366
  document.addEventListener("mousemove", onMouseMove);
1383
1367
  });
1384
1368
  onScopeDispose(() => {
@@ -1457,8 +1441,8 @@ const en = {
1457
1441
  "pen": "Pen",
1458
1442
  "pencil": "Pencil",
1459
1443
  "file": "File",
1460
- "new": "New",
1461
- "open": "Open",
1444
+ "newDoc": "New",
1445
+ "openDoc": "Open",
1462
1446
  "import": "Import",
1463
1447
  "export": "Export",
1464
1448
  "saveAs:png": "Save as PNG",
@@ -1576,8 +1560,8 @@ const zhHans = {
1576
1560
  "pen": "钢笔",
1577
1561
  "pencil": "铅笔",
1578
1562
  "file": "文件",
1579
- "new": "新建",
1580
- "open": "打开",
1563
+ "newDoc": "新建",
1564
+ "openDoc": "打开",
1581
1565
  "import": "导入",
1582
1566
  "export": "导出",
1583
1567
  "saveAs:png": "另存为 PNG",
@@ -1710,286 +1694,31 @@ const _1_frame = defineMixin((editor) => {
1710
1694
  getAncestorFrame
1711
1695
  });
1712
1696
  });
1713
- const isff = typeof navigator !== "undefined" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : false;
1714
- const _keyMap = {
1715
- "backspace": 8,
1716
- "⌫": 8,
1717
- "tab": 9,
1718
- "clear": 12,
1719
- "enter": 13,
1720
- "↩": 13,
1721
- "return": 13,
1722
- "esc": 27,
1723
- "escape": 27,
1724
- "space": 32,
1725
- "left": 37,
1726
- "up": 38,
1727
- "right": 39,
1728
- "down": 40,
1729
- /// https://w3c.github.io/uievents/#events-keyboard-key-location
1730
- "arrowup": 38,
1731
- "arrowdown": 40,
1732
- "arrowleft": 37,
1733
- "arrowright": 39,
1734
- "del": 46,
1735
- "delete": 46,
1736
- "ins": 45,
1737
- "insert": 45,
1738
- "home": 36,
1739
- "end": 35,
1740
- "pageup": 33,
1741
- "pagedown": 34,
1742
- "capslock": 20,
1743
- "num_0": 96,
1744
- "num_1": 97,
1745
- "num_2": 98,
1746
- "num_3": 99,
1747
- "num_4": 100,
1748
- "num_5": 101,
1749
- "num_6": 102,
1750
- "num_7": 103,
1751
- "num_8": 104,
1752
- "num_9": 105,
1753
- "num_multiply": 106,
1754
- "num_add": 107,
1755
- "num_enter": 108,
1756
- "num_subtract": 109,
1757
- "num_decimal": 110,
1758
- "num_divide": 111,
1759
- "⇪": 20,
1760
- ",": 188,
1761
- "<": 188,
1762
- ".": 190,
1763
- ">": 190,
1764
- "/": 191,
1765
- "?": 191,
1766
- "`": 192,
1767
- "~": 192,
1768
- "-": isff ? 173 : 189,
1769
- "_": isff ? 173 : 189,
1770
- "=": isff ? 61 : 187,
1771
- "+": isff ? 61 : 187,
1772
- ";": isff ? 59 : 186,
1773
- ":": isff ? 59 : 186,
1774
- "'": 222,
1775
- '"': 222,
1776
- "[": 219,
1777
- "{": 219,
1778
- "]": 221,
1779
- "}": 221,
1780
- "\\": 220,
1781
- "|": 220
1782
- };
1783
- const _modifier = {
1784
- // shiftKey
1785
- "⇧": 16,
1786
- "shift": 16,
1787
- // altKey
1788
- "⌥": 18,
1789
- "alt": 18,
1790
- "option": 18,
1791
- // ctrlKey
1792
- "⌃": 17,
1793
- "ctrl": 17,
1794
- "control": 17,
1795
- // metaKey
1796
- "⌘": 91,
1797
- "cmd": 91,
1798
- "meta": 91,
1799
- "command": 91
1800
- };
1801
- const kbdMap = {
1802
- ArrowUp: "↑",
1803
- ArrowDown: "↓",
1804
- ArrowLeft: "←",
1805
- ArrowRight: "→",
1806
- Slash: "/",
1807
- Semicolon: ";",
1808
- BracketLeft: "[",
1809
- BracketRight: "]",
1810
- Backslash: "\\",
1811
- Quote: "'",
1812
- Comma: ",",
1813
- Minus: "-",
1814
- Equal: "=",
1815
- Backspace: "⌫",
1816
- Enter: "⏎",
1817
- Escape: "Esc",
1818
- Dead: "N"
1819
- };
1820
- function getCharCode(x) {
1821
- let code = _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
1822
- if (code === 93 || code === 224) {
1823
- code = 91;
1824
- }
1825
- if (code === 229) {
1826
- return 0;
1827
- }
1828
- return code;
1829
- }
1830
- function parseKey(key) {
1831
- return key.split("+").map((v) => {
1832
- switch (v) {
1833
- case "Meta":
1834
- case "Control":
1835
- case "Ctrl":
1836
- case "CommandOrControl":
1837
- case "CmdOrCtrl":
1838
- return "CmdOrCtrl";
1839
- case "Alt":
1840
- case "Shift":
1841
- return v;
1842
- default:
1843
- return String.fromCharCode(getCharCode(v));
1844
- }
1845
- }).filter(Boolean).sort().join("+");
1846
- }
1847
- function parseKeyboardEvent(event) {
1848
- if (event.key.toLowerCase() === "capslock") {
1849
- return;
1850
- }
1851
- const { code } = event;
1852
- let key = event.keyCode || event.which || event.charCode;
1853
- if (code && /^Key[A-Z]$/.test(code)) {
1854
- key = code.charCodeAt(3);
1855
- }
1856
- return [
1857
- (event.metaKey || event.ctrlKey) && "CmdOrCtrl",
1858
- event.altKey && "Alt",
1859
- event.shiftKey && "Shift",
1860
- !["Meta", "Control", "Alt", "Shift"].includes(event.key) && String.fromCharCode(key)
1861
- ].filter(Boolean).sort().join("+");
1862
- }
1863
- const _1_hotkey = defineMixin((editor) => {
1697
+ const _1_screen = defineMixin((editor) => {
1864
1698
  const {
1699
+ config,
1700
+ drawboardAabb,
1865
1701
  registerConfig
1866
1702
  } = editor;
1867
- const hotkeysData = registerConfig("hotkeys", {
1868
- default: () => []
1703
+ const screenPadding = registerConfig("viewport.screenPadding", {
1704
+ default: { left: 0, top: 0, bottom: 0, right: 0 }
1869
1705
  });
1870
- const hotkeys = reactive(/* @__PURE__ */ new Map());
1871
- function registerHotkey(value) {
1872
- if (Array.isArray(value)) {
1873
- value.forEach((item) => registerHotkey(item));
1874
- } else {
1875
- const {
1876
- when: _when,
1877
- handle: _handle,
1878
- ...hotkeyData
1879
- } = value;
1880
- const {
1881
- command
1882
- } = hotkeyData;
1883
- hotkeysData.value = [
1884
- ...hotkeysData.value.filter((v) => v.command !== command),
1885
- hotkeyData
1886
- ];
1887
- hotkeys.set(command, value);
1888
- }
1889
- }
1890
- function unregisterHotkey(command) {
1891
- hotkeysData.value = hotkeysData.value.filter((v) => v.command !== command);
1892
- }
1893
- function getKbd(command) {
1894
- if (!command) {
1895
- return "";
1706
+ const screenControlsOffset = computed(() => {
1707
+ const offset2 = {
1708
+ left: 0,
1709
+ top: 0,
1710
+ bottom: 0,
1711
+ right: 0
1712
+ };
1713
+ if (config.value.ui.ruler.visible) {
1714
+ offset2.left += 16;
1715
+ offset2.top += 16;
1896
1716
  }
1897
- let keys;
1898
- const hotkey = hotkeysData.value.find((v) => v.command === command);
1899
- if (hotkey) {
1900
- keys = Array.isArray(hotkey.key) ? hotkey.key : [hotkey.key];
1901
- } else {
1902
- keys = [command];
1717
+ if (config.value.ui.scrollbar.visible) {
1718
+ offset2.right += 8;
1719
+ offset2.bottom += 8;
1903
1720
  }
1904
- return keys[0].split("+").map((key) => {
1905
- switch (key) {
1906
- case "Control":
1907
- return isMac ? "⌃" : "Ctrl";
1908
- case "Ctrl":
1909
- return isMac ? "⌃" : "Ctrl";
1910
- case "Command":
1911
- return isMac ? "⌘" : isWindows ? "Win" : "Super";
1912
- case "Alt":
1913
- return isMac ? "⌥" : "Alt";
1914
- case "Shift":
1915
- return isMac ? "⇧" : "Shift";
1916
- case "CommandOrControl":
1917
- case "CmdOrCtrl":
1918
- return isMac ? "⌘" : "Ctrl";
1919
- default:
1920
- return kbdMap[key] ?? key.charAt(0).toUpperCase() + key.slice(1);
1921
- }
1922
- }).join("");
1923
- }
1924
- Object.assign(editor, {
1925
- hotkeys,
1926
- hotkeysData,
1927
- registerHotkey,
1928
- unregisterHotkey,
1929
- getKbd
1930
- });
1931
- return () => {
1932
- const {
1933
- exec
1934
- } = editor;
1935
- useEventListener(
1936
- isClient ? window : void 0,
1937
- "keydown",
1938
- (e) => {
1939
- if (isInputEvent(e)) {
1940
- return;
1941
- }
1942
- const eKey = parseKeyboardEvent(e);
1943
- hotkeysData.value.forEach((hotkeyData) => {
1944
- const command = hotkeyData.command;
1945
- const hotkey = hotkeys.get(command);
1946
- const keys = Array.isArray(hotkeyData.key) ? hotkeyData.key : [hotkeyData.key];
1947
- keys.forEach((key) => {
1948
- const tKey = parseKey(key);
1949
- if (eKey === tKey && (!hotkey?.when || hotkey.when(e))) {
1950
- if (hotkey?.preventDefault !== false) {
1951
- e.preventDefault();
1952
- e.stopPropagation();
1953
- }
1954
- if (hotkey?.handle) {
1955
- hotkey.handle(e);
1956
- } else {
1957
- exec(command);
1958
- }
1959
- editor.emit(`hotkey:${command}`, e);
1960
- }
1961
- });
1962
- });
1963
- },
1964
- false
1965
- );
1966
- };
1967
- });
1968
- const _1_screen = defineMixin((editor) => {
1969
- const {
1970
- config,
1971
- drawboardAabb,
1972
- registerConfig
1973
- } = editor;
1974
- const screenPadding = registerConfig("viewport.screenPadding", {
1975
- default: { left: 0, top: 0, bottom: 0, right: 0 }
1976
- });
1977
- const screenControlsOffset = computed(() => {
1978
- const offset2 = {
1979
- left: 0,
1980
- top: 0,
1981
- bottom: 0,
1982
- right: 0
1983
- };
1984
- if (config.value.ui.ruler.visible) {
1985
- offset2.left += 16;
1986
- offset2.top += 16;
1987
- }
1988
- if (config.value.ui.scrollbar.visible) {
1989
- offset2.right += 8;
1990
- offset2.bottom += 8;
1991
- }
1992
- return offset2;
1721
+ return offset2;
1993
1722
  });
1994
1723
  const screenCenterOffset = computed(() => {
1995
1724
  const _screenControlsOffset = screenControlsOffset.value;
@@ -2318,162 +2047,6 @@ const _2_box = defineMixin((editor) => {
2318
2047
  isPointerInSelection
2319
2048
  });
2320
2049
  });
2321
- const _2_export = defineMixin((editor) => {
2322
- const exporters = reactive(/* @__PURE__ */ new Map());
2323
- const exporting = ref(false);
2324
- const exportProgress = ref(0);
2325
- const registerExporter = (value) => {
2326
- if (Array.isArray(value)) {
2327
- value.forEach((item) => registerExporter(item));
2328
- } else {
2329
- exporters.set(value.name, value);
2330
- }
2331
- };
2332
- const unregisterExporter = (name) => {
2333
- exporters.delete(name);
2334
- };
2335
- const to = (name, options = {}) => {
2336
- const res = exporters.get(name)?.handle({
2337
- ...options,
2338
- onProgress: (progress) => {
2339
- exportProgress.value = progress;
2340
- options.onProgress?.(progress);
2341
- }
2342
- });
2343
- if (res instanceof Promise) {
2344
- exportProgress.value = 0;
2345
- exporting.value = true;
2346
- return res.finally(() => {
2347
- exporting.value = false;
2348
- });
2349
- } else {
2350
- return res;
2351
- }
2352
- };
2353
- Object.assign(editor, {
2354
- exporters,
2355
- exporting,
2356
- exportProgress,
2357
- registerExporter,
2358
- unregisterExporter,
2359
- export: to,
2360
- to
2361
- });
2362
- });
2363
- const _2_load = defineMixin((editor) => {
2364
- const {
2365
- state
2366
- } = editor;
2367
- const loaders = reactive(/* @__PURE__ */ new Map());
2368
- const registerLoader = (value) => {
2369
- if (Array.isArray(value)) {
2370
- value.forEach((v) => registerLoader(v));
2371
- } else {
2372
- loaders.set(value.name, value);
2373
- }
2374
- };
2375
- const unregisterLoader = (key) => {
2376
- loaders.delete(key);
2377
- };
2378
- const canLoad = async (source) => {
2379
- for (const loader of loaders.values()) {
2380
- if (await loader.test(source)) {
2381
- return true;
2382
- }
2383
- }
2384
- return false;
2385
- };
2386
- const load = async (source) => {
2387
- state.value = "loading";
2388
- const items = [];
2389
- let hasLoader = false;
2390
- try {
2391
- for (const loader of loaders.values()) {
2392
- if (await loader.test(source)) {
2393
- const res = await loader.load(source);
2394
- if (Array.isArray(res)) {
2395
- items.push(...res);
2396
- } else {
2397
- items.push(res);
2398
- }
2399
- hasLoader = true;
2400
- break;
2401
- }
2402
- }
2403
- } finally {
2404
- state.value = void 0;
2405
- }
2406
- if (!hasLoader) {
2407
- throw new Error(`Failed to load source "${source}"`);
2408
- }
2409
- return items;
2410
- };
2411
- const openFileDialog = (options = {}) => {
2412
- const {
2413
- multiple = false
2414
- } = options;
2415
- return new Promise((resolve) => {
2416
- const accepts = [];
2417
- for (const loader of loaders.values()) {
2418
- if (loader.accept) {
2419
- accepts.push(loader.accept);
2420
- }
2421
- }
2422
- const accept = accepts.join(",");
2423
- const { onChange, open } = useFileDialog({
2424
- accept,
2425
- reset: true,
2426
- multiple
2427
- });
2428
- onChange((files) => resolve(files ? Array.from(files) : []));
2429
- open();
2430
- });
2431
- };
2432
- Object.assign(editor, {
2433
- loaders,
2434
- registerLoader,
2435
- unregisterLoader,
2436
- canLoad,
2437
- load,
2438
- openFileDialog
2439
- });
2440
- });
2441
- const _3_view = defineMixin((editor) => {
2442
- const {
2443
- renderEngine
2444
- } = editor;
2445
- function bindRenderCanvas(canvas, eventTarget) {
2446
- function onRendered() {
2447
- const target = renderEngine.value.view;
2448
- if (!target.width || !target.height) {
2449
- return;
2450
- }
2451
- canvas.width = target.width;
2452
- canvas.height = target.height;
2453
- canvas.dataset.pixelRatio = target.dataset.pixelRatio;
2454
- canvas.getContext("2d")?.drawImage(target, 0, 0, target.width, target.height);
2455
- }
2456
- function unbind() {
2457
- if (canvas._onRendered) {
2458
- renderEngine.value.off("rendered", canvas._onRendered);
2459
- }
2460
- renderEngine.value.input.setTarget(renderEngine.value.view);
2461
- }
2462
- function bind() {
2463
- unbind();
2464
- canvas._onRendered = onRendered;
2465
- renderEngine.value.on("rendered", onRendered);
2466
- if (eventTarget) {
2467
- renderEngine.value.input.setTarget(eventTarget);
2468
- }
2469
- }
2470
- bind();
2471
- return unbind;
2472
- }
2473
- Object.assign(editor, {
2474
- bindRenderCanvas
2475
- });
2476
- });
2477
2050
  const _4_0_node = defineMixin((editor) => {
2478
2051
  const {
2479
2052
  root,
@@ -2752,23 +2325,320 @@ const _4_3_element = defineMixin((editor) => {
2752
2325
  style.height *= scaleY;
2753
2326
  el2?.requestRender?.();
2754
2327
  }
2755
- handle(el);
2756
- if (options.deep) {
2757
- el.findOne((node) => {
2758
- if (isElement(node)) {
2759
- handle(node, true);
2760
- }
2761
- return false;
2762
- });
2328
+ handle(el);
2329
+ if (options.deep) {
2330
+ el.findOne((node) => {
2331
+ if (isElement(node)) {
2332
+ handle(node, true);
2333
+ }
2334
+ return false;
2335
+ });
2336
+ }
2337
+ options.textToFit && exec("textToFit", el);
2338
+ options.textFontSizeToFit && exec("textFontSizeToFit", el, scaleX);
2339
+ }
2340
+ Object.assign(editor, {
2341
+ addElement,
2342
+ addElements: addElement,
2343
+ resizeElement
2344
+ });
2345
+ });
2346
+ const _exporter = defineMixin((editor) => {
2347
+ const exporters = reactive(/* @__PURE__ */ new Map());
2348
+ const exporting = ref(false);
2349
+ const exportProgress = ref(0);
2350
+ const registerExporter = (value) => {
2351
+ if (Array.isArray(value)) {
2352
+ value.forEach((item) => registerExporter(item));
2353
+ } else {
2354
+ exporters.set(value.name, value);
2355
+ }
2356
+ };
2357
+ const unregisterExporter = (name) => {
2358
+ exporters.delete(name);
2359
+ };
2360
+ const to = (name, options = {}) => {
2361
+ const res = exporters.get(name)?.handle({
2362
+ ...options,
2363
+ onProgress: (progress) => {
2364
+ exportProgress.value = progress;
2365
+ options.onProgress?.(progress);
2366
+ }
2367
+ });
2368
+ if (res instanceof Promise) {
2369
+ exportProgress.value = 0;
2370
+ exporting.value = true;
2371
+ return res.finally(() => {
2372
+ exporting.value = false;
2373
+ });
2374
+ } else {
2375
+ return res;
2376
+ }
2377
+ };
2378
+ Object.assign(editor, {
2379
+ exporters,
2380
+ exporting,
2381
+ exportProgress,
2382
+ registerExporter,
2383
+ unregisterExporter,
2384
+ export: to,
2385
+ to
2386
+ });
2387
+ });
2388
+ const isff = typeof navigator !== "undefined" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : false;
2389
+ const _keyMap = {
2390
+ "backspace": 8,
2391
+ "⌫": 8,
2392
+ "tab": 9,
2393
+ "clear": 12,
2394
+ "enter": 13,
2395
+ "↩": 13,
2396
+ "return": 13,
2397
+ "esc": 27,
2398
+ "escape": 27,
2399
+ "space": 32,
2400
+ "left": 37,
2401
+ "up": 38,
2402
+ "right": 39,
2403
+ "down": 40,
2404
+ /// https://w3c.github.io/uievents/#events-keyboard-key-location
2405
+ "arrowup": 38,
2406
+ "arrowdown": 40,
2407
+ "arrowleft": 37,
2408
+ "arrowright": 39,
2409
+ "del": 46,
2410
+ "delete": 46,
2411
+ "ins": 45,
2412
+ "insert": 45,
2413
+ "home": 36,
2414
+ "end": 35,
2415
+ "pageup": 33,
2416
+ "pagedown": 34,
2417
+ "capslock": 20,
2418
+ "num_0": 96,
2419
+ "num_1": 97,
2420
+ "num_2": 98,
2421
+ "num_3": 99,
2422
+ "num_4": 100,
2423
+ "num_5": 101,
2424
+ "num_6": 102,
2425
+ "num_7": 103,
2426
+ "num_8": 104,
2427
+ "num_9": 105,
2428
+ "num_multiply": 106,
2429
+ "num_add": 107,
2430
+ "num_enter": 108,
2431
+ "num_subtract": 109,
2432
+ "num_decimal": 110,
2433
+ "num_divide": 111,
2434
+ "⇪": 20,
2435
+ ",": 188,
2436
+ "<": 188,
2437
+ ".": 190,
2438
+ ">": 190,
2439
+ "/": 191,
2440
+ "?": 191,
2441
+ "`": 192,
2442
+ "~": 192,
2443
+ "-": isff ? 173 : 189,
2444
+ "_": isff ? 173 : 189,
2445
+ "=": isff ? 61 : 187,
2446
+ "+": isff ? 61 : 187,
2447
+ ";": isff ? 59 : 186,
2448
+ ":": isff ? 59 : 186,
2449
+ "'": 222,
2450
+ '"': 222,
2451
+ "[": 219,
2452
+ "{": 219,
2453
+ "]": 221,
2454
+ "}": 221,
2455
+ "\\": 220,
2456
+ "|": 220
2457
+ };
2458
+ const _modifier = {
2459
+ // shiftKey
2460
+ "⇧": 16,
2461
+ "shift": 16,
2462
+ // altKey
2463
+ "⌥": 18,
2464
+ "alt": 18,
2465
+ "option": 18,
2466
+ // ctrlKey
2467
+ "⌃": 17,
2468
+ "ctrl": 17,
2469
+ "control": 17,
2470
+ // metaKey
2471
+ "⌘": 91,
2472
+ "cmd": 91,
2473
+ "meta": 91,
2474
+ "command": 91
2475
+ };
2476
+ const kbdMap = {
2477
+ ArrowUp: "↑",
2478
+ ArrowDown: "↓",
2479
+ ArrowLeft: "←",
2480
+ ArrowRight: "→",
2481
+ Slash: "/",
2482
+ Semicolon: ";",
2483
+ BracketLeft: "[",
2484
+ BracketRight: "]",
2485
+ Backslash: "\\",
2486
+ Quote: "'",
2487
+ Comma: ",",
2488
+ Minus: "-",
2489
+ Equal: "=",
2490
+ Backspace: "⌫",
2491
+ Enter: "⏎",
2492
+ Escape: "Esc",
2493
+ Dead: "N"
2494
+ };
2495
+ function getCharCode(x) {
2496
+ let code = _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
2497
+ if (code === 93 || code === 224) {
2498
+ code = 91;
2499
+ }
2500
+ if (code === 229) {
2501
+ return 0;
2502
+ }
2503
+ return code;
2504
+ }
2505
+ function parseKey(key) {
2506
+ return key.split("+").map((v) => {
2507
+ switch (v) {
2508
+ case "Meta":
2509
+ case "Control":
2510
+ case "Ctrl":
2511
+ case "CommandOrControl":
2512
+ case "CmdOrCtrl":
2513
+ return "CmdOrCtrl";
2514
+ case "Alt":
2515
+ case "Shift":
2516
+ return v;
2517
+ default:
2518
+ return String.fromCharCode(getCharCode(v));
2519
+ }
2520
+ }).filter(Boolean).sort().join("+");
2521
+ }
2522
+ function parseKeyboardEvent(event) {
2523
+ if (event.key.toLowerCase() === "capslock") {
2524
+ return;
2525
+ }
2526
+ const { code } = event;
2527
+ let key = event.keyCode || event.which || event.charCode;
2528
+ if (code && /^Key[A-Z]$/.test(code)) {
2529
+ key = code.charCodeAt(3);
2530
+ }
2531
+ return [
2532
+ (event.metaKey || event.ctrlKey) && "CmdOrCtrl",
2533
+ event.altKey && "Alt",
2534
+ event.shiftKey && "Shift",
2535
+ !["Meta", "Control", "Alt", "Shift"].includes(event.key) && String.fromCharCode(key)
2536
+ ].filter(Boolean).sort().join("+");
2537
+ }
2538
+ const _hotkey = defineMixin((editor) => {
2539
+ const {
2540
+ registerConfig
2541
+ } = editor;
2542
+ const hotkeysData = registerConfig("hotkeys", {
2543
+ default: () => []
2544
+ });
2545
+ const hotkeys = reactive(/* @__PURE__ */ new Map());
2546
+ function registerHotkey(value) {
2547
+ if (Array.isArray(value)) {
2548
+ value.forEach((item) => registerHotkey(item));
2549
+ } else {
2550
+ const {
2551
+ when: _when,
2552
+ handle: _handle,
2553
+ ...hotkeyData
2554
+ } = value;
2555
+ const {
2556
+ command
2557
+ } = hotkeyData;
2558
+ hotkeysData.value = [
2559
+ ...hotkeysData.value.filter((v) => v.command !== command),
2560
+ hotkeyData
2561
+ ];
2562
+ hotkeys.set(command, value);
2563
+ }
2564
+ }
2565
+ function unregisterHotkey(command) {
2566
+ hotkeysData.value = hotkeysData.value.filter((v) => v.command !== command);
2567
+ }
2568
+ function getKbd(command) {
2569
+ if (!command) {
2570
+ return "";
2571
+ }
2572
+ let keys;
2573
+ const hotkey = hotkeysData.value.find((v) => v.command === command);
2574
+ if (hotkey) {
2575
+ keys = Array.isArray(hotkey.key) ? hotkey.key : [hotkey.key];
2576
+ } else {
2577
+ keys = [command];
2763
2578
  }
2764
- options.textToFit && exec("textToFit", el);
2765
- options.textFontSizeToFit && exec("textFontSizeToFit", el, scaleX);
2579
+ return keys[0].split("+").map((key) => {
2580
+ switch (key) {
2581
+ case "Control":
2582
+ return isMac ? "⌃" : "Ctrl";
2583
+ case "Ctrl":
2584
+ return isMac ? "⌃" : "Ctrl";
2585
+ case "Command":
2586
+ return isMac ? "⌘" : isWindows ? "Win" : "Super";
2587
+ case "Alt":
2588
+ return isMac ? "⌥" : "Alt";
2589
+ case "Shift":
2590
+ return isMac ? "⇧" : "Shift";
2591
+ case "CommandOrControl":
2592
+ case "CmdOrCtrl":
2593
+ return isMac ? "⌘" : "Ctrl";
2594
+ default:
2595
+ return kbdMap[key] ?? key.charAt(0).toUpperCase() + key.slice(1);
2596
+ }
2597
+ }).join("");
2766
2598
  }
2767
2599
  Object.assign(editor, {
2768
- addElement,
2769
- addElements: addElement,
2770
- resizeElement
2600
+ hotkeys,
2601
+ hotkeysData,
2602
+ registerHotkey,
2603
+ unregisterHotkey,
2604
+ getKbd
2771
2605
  });
2606
+ return () => {
2607
+ const {
2608
+ exec
2609
+ } = editor;
2610
+ useEventListener(
2611
+ isClient ? window : void 0,
2612
+ "keydown",
2613
+ (e) => {
2614
+ if (isInputEvent(e)) {
2615
+ return;
2616
+ }
2617
+ const eKey = parseKeyboardEvent(e);
2618
+ hotkeysData.value.forEach((hotkeyData) => {
2619
+ const command = hotkeyData.command;
2620
+ const hotkey = hotkeys.get(command);
2621
+ const keys = Array.isArray(hotkeyData.key) ? hotkeyData.key : [hotkeyData.key];
2622
+ keys.forEach((key) => {
2623
+ const tKey = parseKey(key);
2624
+ if (eKey === tKey && (!hotkey?.when || hotkey.when(e))) {
2625
+ if (hotkey?.preventDefault !== false) {
2626
+ e.preventDefault();
2627
+ e.stopPropagation();
2628
+ }
2629
+ if (hotkey?.handle) {
2630
+ hotkey.handle(e);
2631
+ } else {
2632
+ exec(command);
2633
+ }
2634
+ editor.emit(`hotkey:${command}`, e);
2635
+ }
2636
+ });
2637
+ });
2638
+ },
2639
+ false
2640
+ );
2641
+ };
2772
2642
  });
2773
2643
  function createHttp() {
2774
2644
  async function request(config) {
@@ -2836,7 +2706,85 @@ const _http = defineMixin((editor, options) => {
2836
2706
  http: options.http ?? createHttp()
2837
2707
  });
2838
2708
  });
2839
- const _snap = defineMixin((editor) => {
2709
+ const _loader = defineMixin((editor) => {
2710
+ const {
2711
+ state
2712
+ } = editor;
2713
+ const loaders = reactive(/* @__PURE__ */ new Map());
2714
+ const registerLoader = (value) => {
2715
+ if (Array.isArray(value)) {
2716
+ value.forEach((v) => registerLoader(v));
2717
+ } else {
2718
+ loaders.set(value.name, value);
2719
+ }
2720
+ };
2721
+ const unregisterLoader = (key) => {
2722
+ loaders.delete(key);
2723
+ };
2724
+ const canLoad = async (source) => {
2725
+ for (const loader of loaders.values()) {
2726
+ if (await loader.test(source)) {
2727
+ return true;
2728
+ }
2729
+ }
2730
+ return false;
2731
+ };
2732
+ const load = async (source) => {
2733
+ state.value = "loading";
2734
+ const items = [];
2735
+ let hasLoader = false;
2736
+ try {
2737
+ for (const loader of loaders.values()) {
2738
+ if (await loader.test(source)) {
2739
+ const res = await loader.load(source);
2740
+ if (Array.isArray(res)) {
2741
+ items.push(...res);
2742
+ } else {
2743
+ items.push(res);
2744
+ }
2745
+ hasLoader = true;
2746
+ break;
2747
+ }
2748
+ }
2749
+ } finally {
2750
+ state.value = void 0;
2751
+ }
2752
+ if (!hasLoader) {
2753
+ throw new Error(`Failed to load source "${source}"`);
2754
+ }
2755
+ return items;
2756
+ };
2757
+ const openFileDialog = (options = {}) => {
2758
+ const {
2759
+ multiple = false
2760
+ } = options;
2761
+ return new Promise((resolve) => {
2762
+ const accepts = [];
2763
+ for (const loader of loaders.values()) {
2764
+ if (loader.accept) {
2765
+ accepts.push(loader.accept);
2766
+ }
2767
+ }
2768
+ const accept = accepts.join(",");
2769
+ const { onChange, open } = useFileDialog({
2770
+ accept,
2771
+ reset: true,
2772
+ multiple
2773
+ });
2774
+ onChange((files) => resolve(files ? Array.from(files) : []));
2775
+ open();
2776
+ });
2777
+ };
2778
+ Object.assign(editor, {
2779
+ loaders,
2780
+ registerLoader,
2781
+ unregisterLoader,
2782
+ canLoad,
2783
+ load,
2784
+ openFileDialog
2785
+ });
2786
+ });
2787
+ const _snapper = defineMixin((editor) => {
2840
2788
  const {
2841
2789
  camera
2842
2790
  } = editor;
@@ -3009,19 +2957,18 @@ const mixins = [
3009
2957
  _0_font,
3010
2958
  _0_locale,
3011
2959
  _1_frame,
3012
- _1_hotkey,
3013
2960
  _1_screen,
3014
2961
  _1_timeline,
3015
2962
  _1_upload,
3016
2963
  _2_box,
3017
- _2_export,
3018
- _2_load,
3019
- _3_view,
3020
2964
  _4_0_node,
3021
2965
  _4_2_frame,
3022
2966
  _4_3_element,
2967
+ _exporter,
2968
+ _hotkey,
3023
2969
  _http,
3024
- _snap,
2970
+ _loader,
2971
+ _snapper,
3025
2972
  _snapshot,
3026
2973
  _tool$1
3027
2974
  ];
@@ -3293,30 +3240,6 @@ const _autoNest = definePlugin((editor) => {
3293
3240
  }
3294
3241
  };
3295
3242
  });
3296
- const _copyAs = definePlugin((editor) => {
3297
- const {
3298
- to,
3299
- exec,
3300
- exporters
3301
- } = editor;
3302
- const copyAs = async (key, options = {}) => {
3303
- let res = await to(key, {
3304
- selected: true,
3305
- ...options
3306
- });
3307
- const exporter = exporters.get(key);
3308
- if (exporter && typeof exporter.copyAs === "function") {
3309
- res = exporter.copyAs(res);
3310
- }
3311
- exec("copy", res);
3312
- };
3313
- return {
3314
- name: "mce:copyAs",
3315
- commands: [
3316
- { command: "copyAs", handle: copyAs }
3317
- ]
3318
- };
3319
- });
3320
3243
  const _doc = definePlugin((editor, options) => {
3321
3244
  const {
3322
3245
  root,
@@ -3327,17 +3250,17 @@ const _doc = definePlugin((editor, options) => {
3327
3250
  config,
3328
3251
  to,
3329
3252
  waitUntilFontLoad,
3330
- fonts
3253
+ fonts,
3254
+ openFileDialog
3331
3255
  } = editor;
3332
3256
  const getDoc = () => {
3333
3257
  return to("json");
3334
3258
  };
3335
- const setDoc = async (source) => {
3259
+ const setDoc = (source) => {
3336
3260
  fonts.clear();
3337
- await waitUntilFontLoad();
3338
- const oldRoot = root.value;
3339
- const _root = new Doc(source, config.value.db.local);
3340
- oldRoot.findOne((node) => {
3261
+ const oldDoc = root.value;
3262
+ const doc = source instanceof Doc ? source : new Doc(source);
3263
+ oldDoc.findOne((node) => {
3341
3264
  if (node instanceof Element2D) {
3342
3265
  node.foreground.texture?.destroy();
3343
3266
  node.foreground.animatedTexture?.destroy();
@@ -3348,22 +3271,28 @@ const _doc = definePlugin((editor, options) => {
3348
3271
  }
3349
3272
  return false;
3350
3273
  });
3351
- root.value = _root;
3352
- oldRoot.remove();
3353
- await _root.load();
3354
- renderEngine.value.root.append(_root);
3355
- emit("setDoc", _root, oldRoot);
3356
- oldRoot.destroy();
3357
- return _root;
3274
+ doc.init();
3275
+ root.value = doc;
3276
+ oldDoc.remove();
3277
+ renderEngine.value.root.append(doc);
3278
+ emit("setDoc", doc, oldDoc);
3279
+ oldDoc.destroy();
3280
+ return doc;
3358
3281
  };
3359
3282
  const loadDoc = async (source) => {
3360
3283
  docLoading.value = true;
3361
3284
  emit("docLoading", source);
3362
3285
  try {
3363
- const _doc2 = await setDoc(await load(source));
3364
- emit("docLoaded", source, _doc2);
3286
+ await waitUntilFontLoad();
3287
+ const data = await load(source);
3288
+ const doc = new Doc(data);
3289
+ if (config.value.db.local) {
3290
+ await doc.loadIndexeddb();
3291
+ }
3292
+ setDoc(doc);
3293
+ emit("docLoaded", source, doc);
3365
3294
  docLoading.value = false;
3366
- return _doc2;
3295
+ return doc;
3367
3296
  } catch (err) {
3368
3297
  emit("docLoaded", source, err);
3369
3298
  docLoading.value = false;
@@ -3373,13 +3302,36 @@ const _doc = definePlugin((editor, options) => {
3373
3302
  const clearDoc = async () => {
3374
3303
  setDoc([]);
3375
3304
  };
3305
+ const newDoc = async () => {
3306
+ setDoc([]);
3307
+ };
3308
+ const openDoc = async () => {
3309
+ const [file] = await openFileDialog();
3310
+ if (file) {
3311
+ await loadDoc(file);
3312
+ }
3313
+ };
3314
+ Object.assign(editor, {
3315
+ getDoc,
3316
+ setDoc,
3317
+ loadDoc,
3318
+ clearDoc,
3319
+ newDoc,
3320
+ openDoc
3321
+ });
3376
3322
  return {
3377
3323
  name: "mce:doc",
3378
3324
  commands: [
3379
3325
  { command: "getDoc", handle: getDoc },
3380
3326
  { command: "setDoc", handle: setDoc },
3381
3327
  { command: "loadDoc", handle: loadDoc },
3382
- { command: "clearDoc", handle: clearDoc }
3328
+ { command: "clearDoc", handle: clearDoc },
3329
+ { command: "newDoc", handle: clearDoc },
3330
+ { command: "openDoc", handle: openDoc }
3331
+ ],
3332
+ hotkeys: [
3333
+ { command: "newDoc", key: "Alt+CmdOrCtrl+Dead" },
3334
+ { command: "openDoc", key: "CmdOrCtrl+O" }
3383
3335
  ],
3384
3336
  setup: async () => {
3385
3337
  const {
@@ -3387,6 +3339,10 @@ const _doc = definePlugin((editor, options) => {
3387
3339
  } = options;
3388
3340
  if (source) {
3389
3341
  await setDoc(source);
3342
+ } else {
3343
+ if (options.db?.local) {
3344
+ await root.value.loadIndexeddb();
3345
+ }
3390
3346
  }
3391
3347
  }
3392
3348
  };
@@ -3399,7 +3355,9 @@ const _edit = definePlugin((editor, options) => {
3399
3355
  canLoad,
3400
3356
  load,
3401
3357
  addElements,
3402
- hoverElement
3358
+ hoverElement,
3359
+ to,
3360
+ exporters
3403
3361
  } = editor;
3404
3362
  const copiedData = ref();
3405
3363
  const useClipboard = options.clipboard !== false && SUPPORTS_CLIPBOARD;
@@ -3498,6 +3456,17 @@ const _edit = definePlugin((editor, options) => {
3498
3456
  }
3499
3457
  }
3500
3458
  };
3459
+ const copyAs = async (key, options2 = {}) => {
3460
+ let res = await to(key, {
3461
+ selected: true,
3462
+ ...options2
3463
+ });
3464
+ const exporter = exporters.get(key);
3465
+ if (exporter && typeof exporter.copyAs === "function") {
3466
+ res = exporter.copyAs(res);
3467
+ }
3468
+ exec("copy", res);
3469
+ };
3501
3470
  const cut = async () => {
3502
3471
  await copy();
3503
3472
  exec("delete");
@@ -3629,6 +3598,7 @@ const _edit = definePlugin((editor, options) => {
3629
3598
  { command: "cancel", handle: cancel },
3630
3599
  { command: "delete", handle: _delete },
3631
3600
  { command: "copy", handle: copy },
3601
+ { command: "copyAs", handle: copyAs },
3632
3602
  { command: "cut", handle: cut },
3633
3603
  { command: "paste", handle: paste },
3634
3604
  { command: "duplicate", handle: duplicate }
@@ -3755,8 +3725,8 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
3755
3725
  return openBlock(), createBlock(resolveDynamicComponent(unref(iconData).component), {
3756
3726
  icon: unref(iconData).icon,
3757
3727
  tag: props.tag,
3758
- class: normalizeClass(["mce-icon", {
3759
- "mce-icon--disabled": props.disabled
3728
+ class: normalizeClass(["m-icon", {
3729
+ "m-icon--disabled": props.disabled
3760
3730
  }]),
3761
3731
  role: hasClick ? "button" : void 0,
3762
3732
  "aria-hidden": !hasClick,
@@ -3774,7 +3744,7 @@ const SvgIcon = defineComponent({
3774
3744
  return createVNode(props.tag, mergeProps(attrs, { style: null }), {
3775
3745
  default: () => [
3776
3746
  createElementVNode("svg", {
3777
- "class": "mce-icon__svg",
3747
+ "class": "m-icon__svg",
3778
3748
  "xmlns": "http://www.w3.org/2000/svg",
3779
3749
  "viewBox": "0 0 24 24",
3780
3750
  "role": "img",
@@ -3884,8 +3854,8 @@ function useIcon(props) {
3884
3854
  iconData
3885
3855
  };
3886
3856
  }
3887
- const MceLayerKey = /* @__PURE__ */ Symbol.for("mce:layer");
3888
- const MceLayerItemKey = /* @__PURE__ */ Symbol.for("mce:layer-item");
3857
+ const LayerKey = /* @__PURE__ */ Symbol.for("layer");
3858
+ const LayerItemKey = /* @__PURE__ */ Symbol.for("layer-item");
3889
3859
  function createLayer() {
3890
3860
  const registered = ref([]);
3891
3861
  const nodeItems = /* @__PURE__ */ new Map();
@@ -3904,7 +3874,7 @@ function createLayer() {
3904
3874
  });
3905
3875
  return id;
3906
3876
  }
3907
- provide(MceLayerKey, {
3877
+ provide(LayerKey, {
3908
3878
  selecting,
3909
3879
  openedItems,
3910
3880
  dragging,
@@ -3920,7 +3890,7 @@ function createLayer() {
3920
3890
  openedItems.set(id, opened);
3921
3891
  domItems.set(id, dom);
3922
3892
  registered.value.push(id);
3923
- const instances = findChildrenWithProvide(MceLayerItemKey, rootVm?.vnode);
3893
+ const instances = findChildrenWithProvide(LayerItemKey, rootVm?.vnode);
3924
3894
  const instanceIndex = instances.indexOf(vm);
3925
3895
  if (instanceIndex > -1) {
3926
3896
  registered.value.splice(instanceIndex, 0, id);
@@ -3944,7 +3914,7 @@ function createLayer() {
3944
3914
  if (dragging.value) {
3945
3915
  const targets = e2.composedPath();
3946
3916
  const layer = targets.find((target) => {
3947
- return target instanceof HTMLElement && target.classList.contains("mce-layer");
3917
+ return target instanceof HTMLElement && target.classList.contains("m-layer");
3948
3918
  });
3949
3919
  const id2 = layer?.dataset?.id;
3950
3920
  if (id2) {
@@ -3984,7 +3954,7 @@ function createLayer() {
3984
3954
  };
3985
3955
  }
3986
3956
  function useLayerItem(options) {
3987
- const root = inject(MceLayerKey);
3957
+ const root = inject(LayerKey);
3988
3958
  if (!root)
3989
3959
  throw new Error("[mce] Could not find injected layer root");
3990
3960
  const id = `layer-item-${useId()}`;
@@ -3993,7 +3963,7 @@ function useLayerItem(options) {
3993
3963
  ...options
3994
3964
  };
3995
3965
  const vm = getCurrentInstance();
3996
- provide(MceLayerItemKey, { id });
3966
+ provide(LayerItemKey, { id });
3997
3967
  root.register(vm, item);
3998
3968
  onBeforeUnmount(() => root.unregister(id));
3999
3969
  return {
@@ -4035,8 +4005,8 @@ function useResizeObserver(callback, box = "content") {
4035
4005
  contentRect: readonly(contentRect)
4036
4006
  };
4037
4007
  }
4038
- const MceLayoutKey = /* @__PURE__ */ Symbol.for("mce:layout");
4039
- const MceLayoutItemKey = /* @__PURE__ */ Symbol.for("mce:layout-item");
4008
+ const LayoutKey = /* @__PURE__ */ Symbol.for("layout");
4009
+ const LayoutItemKey = /* @__PURE__ */ Symbol.for("layout-item");
4040
4010
  const ROOT_ZINDEX = 500;
4041
4011
  function makeLayoutProps() {
4042
4012
  return {
@@ -4059,7 +4029,7 @@ function makeLayoutItemProps() {
4059
4029
  };
4060
4030
  }
4061
4031
  function useLayout() {
4062
- const layout = inject(MceLayoutKey);
4032
+ const layout = inject(LayoutKey);
4063
4033
  if (!layout)
4064
4034
  throw new Error("[mce] Could not find injected layout");
4065
4035
  return {
@@ -4069,12 +4039,12 @@ function useLayout() {
4069
4039
  };
4070
4040
  }
4071
4041
  function useLayoutItem(options) {
4072
- const layout = inject(MceLayoutKey);
4042
+ const layout = inject(LayoutKey);
4073
4043
  if (!layout)
4074
4044
  throw new Error("[mce] Could not find injected layout");
4075
4045
  const id = options.id ?? `layout-item-${useId()}`;
4076
4046
  const vm = getCurrentInstance();
4077
- provide(MceLayoutItemKey, { id });
4047
+ provide(LayoutItemKey, { id });
4078
4048
  const isKeptAlive = shallowRef(false);
4079
4049
  onDeactivated(() => isKeptAlive.value = true);
4080
4050
  onActivated(() => isKeptAlive.value = false);
@@ -4111,7 +4081,7 @@ function generateLayers(layout, positions, layoutSizes, activeItems) {
4111
4081
  return layers;
4112
4082
  }
4113
4083
  function createLayout(props) {
4114
- const parentLayout = inject(MceLayoutKey, null);
4084
+ const parentLayout = inject(LayoutKey, null);
4115
4085
  const rootZIndex = computed(() => parentLayout ? parentLayout.rootZIndex.value - 100 : ROOT_ZINDEX);
4116
4086
  const registered = ref([]);
4117
4087
  const positions = reactive(/* @__PURE__ */ new Map());
@@ -4155,10 +4125,10 @@ function createLayout(props) {
4155
4125
  });
4156
4126
  const mainStyles = toRef(() => {
4157
4127
  return {
4158
- "--mce-layout-left": convertToUnit(mainRect.value.left),
4159
- "--mce-layout-right": convertToUnit(mainRect.value.right),
4160
- "--mce-layout-top": convertToUnit(mainRect.value.top),
4161
- "--mce-layout-bottom": convertToUnit(mainRect.value.bottom),
4128
+ "--m-layout-left": convertToUnit(mainRect.value.left),
4129
+ "--m-layout-right": convertToUnit(mainRect.value.right),
4130
+ "--m-layout-top": convertToUnit(mainRect.value.top),
4131
+ "--m-layout-bottom": convertToUnit(mainRect.value.bottom),
4162
4132
  ...transitionsEnabled.value ? void 0 : { transition: "none" }
4163
4133
  };
4164
4134
  });
@@ -4183,7 +4153,7 @@ function createLayout(props) {
4183
4153
  onMounted(() => {
4184
4154
  isMounted.value = true;
4185
4155
  });
4186
- provide(MceLayoutKey, {
4156
+ provide(LayoutKey, {
4187
4157
  register: (vm, {
4188
4158
  id,
4189
4159
  order,
@@ -4198,7 +4168,7 @@ function createLayout(props) {
4198
4168
  layoutSizes.set(id, layoutSize);
4199
4169
  activeItems.set(id, active);
4200
4170
  disableTransitions && disabledTransitions.set(id, disableTransitions);
4201
- const instances = findChildrenWithProvide(MceLayoutItemKey, rootVm?.vnode);
4171
+ const instances = findChildrenWithProvide(LayoutItemKey, rootVm?.vnode);
4202
4172
  const instanceIndex = instances.indexOf(vm);
4203
4173
  if (instanceIndex > -1)
4204
4174
  registered.value.splice(instanceIndex, 0, id);
@@ -4257,8 +4227,8 @@ function createLayout(props) {
4257
4227
  rootZIndex
4258
4228
  });
4259
4229
  const layoutClasses = toRef(() => [
4260
- "mce-layout",
4261
- { "mce-layout--full-height": props.fullHeight }
4230
+ "m-layout",
4231
+ { "m-layout--full-height": props.fullHeight }
4262
4232
  ]);
4263
4233
  const layoutStyles = toRef(() => ({
4264
4234
  zIndex: parentLayout ? rootZIndex.value : void 0,
@@ -4430,15 +4400,15 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
4430
4400
  return (_ctx, _cache) => {
4431
4401
  return withDirectives((openBlock(), createElementBlock("div", {
4432
4402
  style: normalizeStyle$1(unref(getObb)(frame.value, "drawboard").toCssStyle()),
4433
- class: normalizeClass(["mce-frame", [
4434
- __props.outline && "mce-frame--outline",
4435
- unref(hoverElement)?.equal(frame.value) && "mce-frame--hover",
4436
- unref(selection).some((v) => v.equal(frame.value)) && "mce-frame--selected",
4437
- unref(isLock)(frame.value) && "mce-frame--lock"
4403
+ class: normalizeClass(["m-frame", [
4404
+ __props.outline && "m-frame--outline",
4405
+ unref(hoverElement)?.equal(frame.value) && "m-frame--hover",
4406
+ unref(selection).some((v) => v.equal(frame.value)) && "m-frame--selected",
4407
+ unref(isLock)(frame.value) && "m-frame--lock"
4438
4408
  ]])
4439
4409
  }, [
4440
4410
  createElementVNode("div", {
4441
- class: "mce-frame__name",
4411
+ class: "m-frame__name",
4442
4412
  onDblclick: withModifiers(onDblclick, ["prevent", "stop"]),
4443
4413
  onPointerdown,
4444
4414
  onPointerenter: _cache[2] || (_cache[2] = ($event) => !unref(state) && !unref(isLock)(frame.value) && (hoverElement.value = frame.value)),
@@ -4461,7 +4431,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
4461
4431
  };
4462
4432
  }
4463
4433
  });
4464
- const _hoisted_1$s = { class: "mce-frames" };
4434
+ const _hoisted_1$s = { class: "m-frames" };
4465
4435
  const _sfc_main$D = /* @__PURE__ */ defineComponent({
4466
4436
  __name: "Frames",
4467
4437
  setup(__props) {
@@ -4594,45 +4564,6 @@ const _frame = definePlugin((editor) => {
4594
4564
  }
4595
4565
  };
4596
4566
  });
4597
- const _gif = definePlugin((editor, options) => {
4598
- const {
4599
- assets: assets2,
4600
- fonts,
4601
- to
4602
- } = editor;
4603
- const gifWorkerUrl = options.gifWorkerUrl;
4604
- assets2.gifWorkerUrl = gifWorkerUrl;
4605
- return {
4606
- name: "mce:gif",
4607
- exporters: [
4608
- {
4609
- name: "gif",
4610
- saveAs: true,
4611
- handle: async (options2) => {
4612
- const { Encoder } = await import("modern-gif");
4613
- const { onProgress, ...restOptions } = options2;
4614
- const data = to("json", restOptions);
4615
- const { startTime, endTime } = data.meta;
4616
- const width = Math.floor(data.style.width);
4617
- const height = Math.floor(data.style.height);
4618
- const encoder = new Encoder({ width, height, workerUrl: gifWorkerUrl });
4619
- await render({
4620
- data,
4621
- width,
4622
- height,
4623
- fonts,
4624
- keyframes: Array.from({ length: ~~((endTime - startTime) / 100) }, (_, i) => startTime + i * 100),
4625
- onKeyframe: async (data2, { duration, progress }) => {
4626
- await encoder.encode({ data: data2, delay: duration });
4627
- onProgress?.(progress);
4628
- }
4629
- });
4630
- return await encoder.flush("blob");
4631
- }
4632
- }
4633
- ]
4634
- };
4635
- });
4636
4567
  const _history = definePlugin((editor) => {
4637
4568
  const {
4638
4569
  root
@@ -4688,7 +4619,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
4688
4619
  return (_ctx, _cache) => {
4689
4620
  return unref(hoverElement) && !unref(selection).some((node) => node.equal(unref(hoverElement))) ? (openBlock(), createElementBlock("div", {
4690
4621
  key: 0,
4691
- class: "mce-hover",
4622
+ class: "m-hover",
4692
4623
  "data-name": unref(hoverElement).name,
4693
4624
  style: normalizeStyle$1({
4694
4625
  borderColor: "currentcolor",
@@ -4994,9 +4925,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
4994
4925
  setup(__props) {
4995
4926
  return (_ctx, _cache) => {
4996
4927
  return openBlock(), createElementBlock("div", {
4997
- class: normalizeClass(["mce-btn", {
4998
- "mce-btn--active": __props.active,
4999
- "mce-btn--icon": __props.icon
4928
+ class: normalizeClass(["m-btn", {
4929
+ "m-btn--active": __props.active,
4930
+ "m-btn--icon": __props.icon
5000
4931
  }])
5001
4932
  }, [
5002
4933
  renderSlot(_ctx.$slots, "default")
@@ -5005,8 +4936,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
5005
4936
  }
5006
4937
  });
5007
4938
  const _hoisted_1$q = ["data-id"];
5008
- const _hoisted_2$c = { class: "mce-layer__content" };
5009
- const _hoisted_3$b = { class: "mce-layer__prepend" };
4939
+ const _hoisted_2$c = { class: "m-layer__content" };
4940
+ const _hoisted_3$b = { class: "m-layer__prepend" };
5010
4941
  const _sfc_main$A = /* @__PURE__ */ defineComponent({
5011
4942
  ...{
5012
4943
  name: "MceLayer",
@@ -5212,13 +5143,13 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5212
5143
  createElementVNode("div", {
5213
5144
  ref_key: "dom",
5214
5145
  ref: dom,
5215
- class: normalizeClass(["mce-layer", [
5216
- props.root && "mce-layer--root",
5217
- (__props.active || selected.value) && "mce-layer--active",
5218
- selected.value && "mce-layer--selected",
5219
- opened.value && "mce-layer--open",
5220
- isHoverElement.value && "mce-layer--hover",
5221
- unref(dropping) && "mce-layer--dropping"
5146
+ class: normalizeClass(["m-layer", [
5147
+ props.root && "m-layer--root",
5148
+ (__props.active || selected.value) && "m-layer--active",
5149
+ selected.value && "m-layer--selected",
5150
+ opened.value && "m-layer--open",
5151
+ isHoverElement.value && "m-layer--hover",
5152
+ unref(dropping) && "m-layer--dropping"
5222
5153
  ]]),
5223
5154
  style: normalizeStyle$1({
5224
5155
  "--indent-padding": `${props.indent * 16}px`
@@ -5229,13 +5160,13 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5229
5160
  onMouseleave,
5230
5161
  onContextmenu
5231
5162
  }, [
5232
- _cache[5] || (_cache[5] = createElementVNode("span", { class: "mce-layer__underlay" }, null, -1)),
5233
- _cache[6] || (_cache[6] = createElementVNode("span", { class: "mce-layer__overlay" }, null, -1)),
5163
+ _cache[5] || (_cache[5] = createElementVNode("span", { class: "m-layer__underlay" }, null, -1)),
5164
+ _cache[6] || (_cache[6] = createElementVNode("span", { class: "m-layer__overlay" }, null, -1)),
5234
5165
  createElementVNode("div", _hoisted_2$c, [
5235
5166
  createElementVNode("div", _hoisted_3$b, [
5236
5167
  childrenLength.value ? (openBlock(), createBlock(unref(_sfc_main$F), {
5237
5168
  key: 0,
5238
- class: "mce-layer__arrow",
5169
+ class: "m-layer__arrow",
5239
5170
  icon: "$arrowRight",
5240
5171
  onClick: onClickExpand,
5241
5172
  onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
@@ -5243,13 +5174,13 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5243
5174
  })) : createCommentVNode("", true)
5244
5175
  ]),
5245
5176
  createElementVNode("div", {
5246
- class: "mce-layer__thumbnail",
5177
+ class: "m-layer__thumbnail",
5247
5178
  onDblclick: onDblclickThumbnail
5248
5179
  }, [
5249
5180
  createVNode(unref(_sfc_main$F), { icon: thumbnailIcon.value }, null, 8, ["icon"])
5250
5181
  ], 32),
5251
5182
  createElementVNode("div", {
5252
- class: "mce-layer__name",
5183
+ class: "m-layer__name",
5253
5184
  onDblclick: onDblclickName
5254
5185
  }, [
5255
5186
  editing.value ? withDirectives((openBlock(), createElementBlock("input", {
@@ -5259,7 +5190,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5259
5190
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => editValue.value = $event),
5260
5191
  name: "layer-name",
5261
5192
  type: "text",
5262
- class: "mce-layer__input",
5193
+ class: "m-layer__input",
5263
5194
  spellcheck: "false",
5264
5195
  autocapitalize: "off",
5265
5196
  autocorrect: "off",
@@ -5273,16 +5204,16 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5273
5204
  }, toDisplayString(editValue.value || thumbnailName.value), 5)
5274
5205
  ], 32),
5275
5206
  createElementVNode("div", {
5276
- class: normalizeClass(["mce-layer__action", {
5277
- "mce-layer__action--hover": hovering.value,
5278
- "mce-layer__action--show": hovering.value || unref(isLock)(props.node) || !unref(isVisible)(props.node)
5207
+ class: normalizeClass(["m-layer__action", {
5208
+ "m-layer__action--hover": hovering.value,
5209
+ "m-layer__action--show": hovering.value || unref(isLock)(props.node) || !unref(isVisible)(props.node)
5279
5210
  }])
5280
5211
  }, [
5281
5212
  props.root ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
5282
5213
  Array.from(unref(openedItems).values()).filter((v) => v.value).length > 1 ? (openBlock(), createBlock(_sfc_main$B, {
5283
5214
  key: 0,
5284
5215
  icon: "",
5285
- class: "mce-layer__btn mce-layer__btn--show",
5216
+ class: "m-layer__btn m-layer__btn--show",
5286
5217
  onMousedown: _cache[2] || (_cache[2] = withModifiers(($event) => unref(openedItems).forEach((item, _id) => {
5287
5218
  if (_id !== unref(id)) {
5288
5219
  item.value = false;
@@ -5297,8 +5228,8 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5297
5228
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
5298
5229
  createVNode(_sfc_main$B, {
5299
5230
  icon: "",
5300
- class: normalizeClass(["mce-layer__btn", {
5301
- "mce-layer__btn--show": unref(isLock)(props.node)
5231
+ class: normalizeClass(["m-layer__btn", {
5232
+ "m-layer__btn--show": unref(isLock)(props.node)
5302
5233
  }]),
5303
5234
  onClick: _cache[3] || (_cache[3] = withModifiers(($event) => unref(setLock)(props.node, !unref(isLock)(props.node)), ["prevent", "stop"]))
5304
5235
  }, {
@@ -5311,8 +5242,8 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5311
5242
  }, 8, ["class"]),
5312
5243
  createVNode(_sfc_main$B, {
5313
5244
  icon: "",
5314
- class: normalizeClass(["mce-layer__btn", {
5315
- "mce-layer__btn--show": !unref(isVisible)(props.node)
5245
+ class: normalizeClass(["m-layer__btn", {
5246
+ "m-layer__btn--show": !unref(isVisible)(props.node)
5316
5247
  }]),
5317
5248
  onClick: _cache[4] || (_cache[4] = withModifiers(($event) => unref(setVisible)(props.node, !unref(isVisible)(props.node)), ["prevent", "stop"]))
5318
5249
  }, {
@@ -5339,8 +5270,8 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
5339
5270
  };
5340
5271
  }
5341
5272
  });
5342
- const _hoisted_1$p = { class: "mce-layers" };
5343
- const _hoisted_2$b = { class: "mce-layers__wrapper" };
5273
+ const _hoisted_1$p = { class: "m-layers" };
5274
+ const _hoisted_2$b = { class: "m-layers__wrapper" };
5344
5275
  const _sfc_main$z = /* @__PURE__ */ defineComponent({
5345
5276
  __name: "Layers",
5346
5277
  setup(__props) {
@@ -5422,7 +5353,7 @@ const _export_sfc = (sfc, props) => {
5422
5353
  };
5423
5354
  const _sfc_main$y = {};
5424
5355
  const _hoisted_1$o = {
5425
- class: "mce-made-with",
5356
+ class: "m-made-with",
5426
5357
  href: "https://github.com/qq15725/mce",
5427
5358
  target: "_blank"
5428
5359
  };
@@ -5456,7 +5387,7 @@ const _madeWith = definePlugin((editor) => {
5456
5387
  ]
5457
5388
  };
5458
5389
  });
5459
- const _hoisted_1$n = { class: "mce-manage-memory" };
5390
+ const _hoisted_1$n = { class: "m-manage-memory" };
5460
5391
  const _sfc_main$x = /* @__PURE__ */ defineComponent({
5461
5392
  __name: "MemoryManager",
5462
5393
  setup(__props) {
@@ -5617,13 +5548,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
5617
5548
  }, [
5618
5549
  isActive.value ? (openBlock(), createElementBlock("div", mergeProps({
5619
5550
  key: 0,
5620
- class: "mce-overlay",
5551
+ class: "m-overlay",
5621
5552
  style: style.value
5622
5553
  }, _ctx.$attrs), [
5623
5554
  createElementVNode("div", {
5624
5555
  ref: "contentElTpl",
5625
5556
  style: normalizeStyle$1(contentStyle.value),
5626
- class: normalizeClass(["mce-overlay-content", props.contentClass])
5557
+ class: normalizeClass(["m-overlay-content", props.contentClass])
5627
5558
  }, [
5628
5559
  renderSlot(_ctx.$slots, "default")
5629
5560
  ], 6)
@@ -5637,20 +5568,20 @@ const _hoisted_1$m = ["onMouseenter"];
5637
5568
  const _hoisted_2$a = ["onClick"];
5638
5569
  const _hoisted_3$a = {
5639
5570
  key: 0,
5640
- class: "mce-list-item__checked"
5571
+ class: "m-list-item__checked"
5641
5572
  };
5642
5573
  const _hoisted_4$4 = {
5643
5574
  key: 1,
5644
- class: "mce-list-item__prepend"
5575
+ class: "m-list-item__prepend"
5645
5576
  };
5646
- const _hoisted_5$3 = { class: "mce-list-item__title" };
5577
+ const _hoisted_5$3 = { class: "m-list-item__title" };
5647
5578
  const _hoisted_6$3 = {
5648
5579
  key: 2,
5649
- class: "mce-list-item__kbd"
5580
+ class: "m-list-item__kbd"
5650
5581
  };
5651
5582
  const _hoisted_7$2 = {
5652
5583
  key: 3,
5653
- class: "mce-list-item__append"
5584
+ class: "m-list-item__append"
5654
5585
  };
5655
5586
  const _sfc_main$v = /* @__PURE__ */ defineComponent({
5656
5587
  ...{
@@ -5743,7 +5674,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
5743
5674
  offset: props.offset,
5744
5675
  target: props.target,
5745
5676
  attach: props.attach,
5746
- class: "mce-menu",
5677
+ class: "m-menu",
5747
5678
  "onClick:outside": onClickOutside2
5748
5679
  }, {
5749
5680
  activator: withCtx((slotProps) => [
@@ -5757,7 +5688,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
5757
5688
  default: withCtx(() => [
5758
5689
  __props.items?.length ? (openBlock(), createElementBlock("div", {
5759
5690
  key: 0,
5760
- class: "mce-list",
5691
+ class: "m-list",
5761
5692
  onMouseleave
5762
5693
  }, [
5763
5694
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
@@ -5766,18 +5697,18 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
5766
5697
  key: 0,
5767
5698
  ref_for: true,
5768
5699
  ref: (el) => menuItemRefs.value[index] = el ?? void 0,
5769
- class: "mce-list__divider"
5700
+ class: "m-list__divider"
5770
5701
  }, null, 512)) : (openBlock(), createElementBlock("div", {
5771
5702
  key: 1,
5772
5703
  ref_for: true,
5773
5704
  ref: (el) => menuItemRefs.value[index] = el ?? void 0,
5774
- class: "mce-list__item",
5705
+ class: "m-list__item",
5775
5706
  onMouseenter: ($event) => onMouseenter(item, index)
5776
5707
  }, [
5777
5708
  createElementVNode("div", {
5778
- class: normalizeClass(["mce-list-item", [
5779
- item.disabled && "mce-list-item--disabled",
5780
- opened.value === index && "mce-list-item--opened"
5709
+ class: normalizeClass(["m-list-item", [
5710
+ item.disabled && "m-list-item--disabled",
5711
+ opened.value === index && "m-list-item--opened"
5781
5712
  ]]),
5782
5713
  onClick: (e) => onClickItem(item, index, e)
5783
5714
  }, [
@@ -5947,7 +5878,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
5947
5878
  ref: "menuTplRef",
5948
5879
  modelValue: isActive.value,
5949
5880
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
5950
- class: "mce-context-menu",
5881
+ class: "m-context-menu",
5951
5882
  offset: 10,
5952
5883
  target,
5953
5884
  location: "right-start",
@@ -5995,8 +5926,8 @@ const _menu = definePlugin((editor, options) => {
5995
5926
  const fileMenu = computed(() => ({
5996
5927
  key: "file",
5997
5928
  children: [
5998
- { key: "new" },
5999
- { key: "open" },
5929
+ { key: "newDoc" },
5930
+ { key: "openDoc" },
6000
5931
  { type: "divider" },
6001
5932
  { key: "import" },
6002
5933
  exportMenu.value.children.length && exportMenu.value
@@ -6266,26 +6197,9 @@ const _menu = definePlugin((editor, options) => {
6266
6197
  ]
6267
6198
  };
6268
6199
  });
6269
- const _new = definePlugin((editor) => {
6270
- const {
6271
- exec
6272
- } = editor;
6273
- function _new2() {
6274
- exec("setDoc", []);
6275
- }
6276
- return {
6277
- name: "mce:new",
6278
- commands: [
6279
- { command: "new", handle: _new2 }
6280
- ],
6281
- hotkeys: [
6282
- { command: "new", key: "Alt+CmdOrCtrl+Dead" }
6283
- ]
6284
- };
6285
- });
6286
- const _hoisted_1$l = { class: "mce-creator" };
6287
- const _hoisted_2$9 = { class: "mce-creator__tree" };
6288
- const _hoisted_3$9 = { class: "mce-creator__actions" };
6200
+ const _hoisted_1$l = { class: "m-creator" };
6201
+ const _hoisted_2$9 = { class: "m-creator__tree" };
6202
+ const _hoisted_3$9 = { class: "m-creator__actions" };
6289
6203
  const _sfc_main$t = /* @__PURE__ */ defineComponent({
6290
6204
  __name: "Creator",
6291
6205
  props: {
@@ -6353,8 +6267,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
6353
6267
  return [
6354
6268
  h("div", {
6355
6269
  class: [
6356
- "mce-creator__node",
6357
- activeNodeName.value === node.name && "mce-creator__node--active"
6270
+ "m-creator__node",
6271
+ activeNodeName.value === node.name && "m-creator__node--active"
6358
6272
  ],
6359
6273
  style: {
6360
6274
  "--indent-padding": `${indent * 16}px`
@@ -6422,27 +6336,6 @@ const _node = definePlugin((editor) => {
6422
6336
  ]
6423
6337
  };
6424
6338
  });
6425
- const _open = definePlugin((editor) => {
6426
- const {
6427
- openFileDialog,
6428
- exec
6429
- } = editor;
6430
- async function open() {
6431
- const [file] = await openFileDialog();
6432
- if (file) {
6433
- await exec("loadDoc", file);
6434
- }
6435
- }
6436
- return {
6437
- name: "mce:open",
6438
- commands: [
6439
- { command: "open", handle: open }
6440
- ],
6441
- hotkeys: [
6442
- { command: "open", key: "CmdOrCtrl+O" }
6443
- ]
6444
- };
6445
- });
6446
6339
  function earcut(data, holeIndices, dim = 2) {
6447
6340
  const hasHoles = holeIndices && holeIndices.length;
6448
6341
  const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
@@ -10519,12 +10412,12 @@ const _pen = definePlugin((editor) => {
10519
10412
  });
10520
10413
  const _hoisted_1$k = {
10521
10414
  key: 0,
10522
- class: "mce-tooltip__arrow"
10415
+ class: "m-tooltip__arrow"
10523
10416
  };
10524
- const _hoisted_2$8 = { class: "mce-tooltip__content" };
10417
+ const _hoisted_2$8 = { class: "m-tooltip__content" };
10525
10418
  const _hoisted_3$8 = {
10526
10419
  key: 0,
10527
- class: "mce-tooltip__kbd"
10420
+ class: "m-tooltip__kbd"
10528
10421
  };
10529
10422
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
10530
10423
  __name: "Tooltip",
@@ -10546,8 +10439,8 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
10546
10439
  const contentClass = computed(() => {
10547
10440
  const [side, align = "center"] = props.location.split("-");
10548
10441
  return [
10549
- `mce-tooltip--side-${side}`,
10550
- `mce-tooltip--align-${align}`
10442
+ `m-tooltip--side-${side}`,
10443
+ `m-tooltip--align-${align}`
10551
10444
  ];
10552
10445
  });
10553
10446
  function updateLocation() {
@@ -10561,7 +10454,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
10561
10454
  ref: "overlayTpl",
10562
10455
  modelValue: isActive.value,
10563
10456
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
10564
- class: "mce-tooltip",
10457
+ class: "m-tooltip",
10565
10458
  "content-class": contentClass.value,
10566
10459
  location: props.location,
10567
10460
  offset: props.offset,
@@ -10643,7 +10536,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
10643
10536
  });
10644
10537
  const borderColor = computed(() => props.borderColor ?? colors.border);
10645
10538
  const textColor = computed(() => props.textColor ?? colors.text);
10646
- const lineColor = computed(() => props.lineColor ?? "rgb(var(--mce-theme-secondary))");
10539
+ const lineColor = computed(() => props.lineColor ?? "rgb(var(--m-theme-secondary))");
10647
10540
  function drawSelected() {
10648
10541
  if (!props.selected?.width || !props.selected?.height)
10649
10542
  return;
@@ -10871,8 +10764,8 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
10871
10764
  return (_ctx, _cache) => {
10872
10765
  return openBlock(), createElementBlock(Fragment, null, [
10873
10766
  withDirectives((openBlock(), createElementBlock("div", mergeProps({
10874
- class: ["mce-ruler", [
10875
- `mce-ruler--${props.vertical ? "vertical" : "horizontal"}`
10767
+ class: ["m-ruler", [
10768
+ `m-ruler--${props.vertical ? "vertical" : "horizontal"}`
10876
10769
  ]],
10877
10770
  style: { "--size": `${props.size}px` }
10878
10771
  }, unref(attrs), {
@@ -10882,7 +10775,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
10882
10775
  }), [
10883
10776
  createElementVNode("canvas", {
10884
10777
  ref: "canvasTpl",
10885
- class: "mce-ruler__canvas",
10778
+ class: "m-ruler__canvas",
10886
10779
  width: props.size,
10887
10780
  height: props.size
10888
10781
  }, null, 8, _hoisted_1$j)
@@ -10892,11 +10785,11 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
10892
10785
  (openBlock(true), createElementBlock(Fragment, null, renderList(lines.value, (item, index) => {
10893
10786
  return openBlock(), createElementBlock("div", {
10894
10787
  key: index,
10895
- class: normalizeClass(["mce-ruler-refline", {
10896
- "mce-ruler-refline--vertical": props.vertical,
10897
- "mce-ruler-refline--horizontal": !props.vertical,
10898
- "mce-ruler-refline--temp": item === tempLine.value,
10899
- "mce-ruler-refline--locked": props.locked
10788
+ class: normalizeClass(["m-ruler-refline", {
10789
+ "m-ruler-refline--vertical": props.vertical,
10790
+ "m-ruler-refline--horizontal": !props.vertical,
10791
+ "m-ruler-refline--temp": item === tempLine.value,
10792
+ "m-ruler-refline--locked": props.locked
10900
10793
  }]),
10901
10794
  style: normalizeStyle$1({
10902
10795
  [props.vertical ? "height" : "width"]: void 0,
@@ -10926,7 +10819,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
10926
10819
  };
10927
10820
  }
10928
10821
  });
10929
- const _hoisted_1$i = { class: "mce-rulers" };
10822
+ const _hoisted_1$i = { class: "m-rulers" };
10930
10823
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
10931
10824
  __name: "Rulers",
10932
10825
  props: {
@@ -10971,7 +10864,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
10971
10864
  "line-color": unref(config).lineColor,
10972
10865
  locked: unref(config).locked
10973
10866
  }, null, 8, ["modelValue", "zoom", "position", "selected", "line-color", "locked"]),
10974
- _cache[2] || (_cache[2] = createElementVNode("div", { class: "mce-rulers__left-top" }, null, -1))
10867
+ _cache[2] || (_cache[2] = createElementVNode("div", { class: "m-rulers__left-top" }, null, -1))
10975
10868
  ]);
10976
10869
  };
10977
10870
  }
@@ -10995,7 +10888,7 @@ const _ruler = definePlugin((editor) => {
10995
10888
  });
10996
10889
  const config = registerConfig("ui.ruler", {
10997
10890
  default: {
10998
- visible: false,
10891
+ visible: true,
10999
10892
  adsorbed: false,
11000
10893
  locked: false
11001
10894
  }
@@ -11057,7 +10950,7 @@ const _saveAs = definePlugin((editor) => {
11057
10950
  });
11058
10951
  const _hoisted_1$h = {
11059
10952
  ref: "trackTplRef",
11060
- class: "mce-scrollbar__track"
10953
+ class: "m-scrollbar__track"
11061
10954
  };
11062
10955
  const _sfc_main$p = /* @__PURE__ */ defineComponent({
11063
10956
  __name: "Scrollbar",
@@ -11126,9 +11019,9 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
11126
11019
  }
11127
11020
  return (_ctx, _cache) => {
11128
11021
  return withDirectives((openBlock(), createElementBlock("div", {
11129
- class: normalizeClass(["mce-scrollbar", {
11130
- "mce-scrollbar--vertical": props.vertical,
11131
- "mce-scrollbar--horizontal": !props.vertical
11022
+ class: normalizeClass(["m-scrollbar", {
11023
+ "m-scrollbar--vertical": props.vertical,
11024
+ "m-scrollbar--horizontal": !props.vertical
11132
11025
  }]),
11133
11026
  style: normalizeStyle$1({
11134
11027
  [props.vertical ? "height" : "width"]: `calc(100% - ${props.size + props.offset}px)`,
@@ -11139,8 +11032,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
11139
11032
  createElementVNode("div", _hoisted_1$h, [
11140
11033
  createElementVNode("div", {
11141
11034
  ref: "thumbTplRef",
11142
- class: normalizeClass(["mce-scrollbar__thumb", {
11143
- "mce-scrollbar__thumb--active": isActive.value
11035
+ class: normalizeClass(["m-scrollbar__thumb", {
11036
+ "m-scrollbar__thumb--active": isActive.value
11144
11037
  }]),
11145
11038
  style: normalizeStyle$1({
11146
11039
  top: thumbTop.value,
@@ -11157,7 +11050,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
11157
11050
  };
11158
11051
  }
11159
11052
  });
11160
- const _hoisted_1$g = { class: "mce-scrollbars" };
11053
+ const _hoisted_1$g = { class: "m-scrollbars" };
11161
11054
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
11162
11055
  __name: "Scrollbars",
11163
11056
  props: {
@@ -11200,7 +11093,7 @@ const _scroll = definePlugin((editor) => {
11200
11093
  } = editor;
11201
11094
  const config = registerConfig("ui.scrollbar", {
11202
11095
  default: {
11203
- visible: false
11096
+ visible: true
11204
11097
  }
11205
11098
  });
11206
11099
  const scrollTo = async (target, options = {}) => {
@@ -11353,7 +11246,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
11353
11246
  return (_ctx, _cache) => {
11354
11247
  return isActive.value ? (openBlock(), createElementBlock("div", {
11355
11248
  key: 0,
11356
- class: "mce-scroll-to-selection",
11249
+ class: "m-scroll-to-selection",
11357
11250
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(exec)("scrollToSelection", { behavior: "smooth" }), ["prevent"]))
11358
11251
  }, [
11359
11252
  createVNode(unref(_sfc_main$F), { icon: "$gps" }),
@@ -11372,11 +11265,11 @@ const _hoisted_7$1 = { "pointer-events": "all" };
11372
11265
  const _hoisted_8$1 = ["x", "y", "width", "height", "aria-label", "cursor", "onPointerdown"];
11373
11266
  const _hoisted_9$1 = {
11374
11267
  "pointer-events": "all",
11375
- class: "mce-transform__svg-slot"
11268
+ class: "m-transform__svg-slot"
11376
11269
  };
11377
11270
  const _hoisted_10$1 = {
11378
11271
  key: 0,
11379
- class: "mce-transform__tip"
11272
+ class: "m-transform__tip"
11380
11273
  };
11381
11274
  const _sfc_main$m = /* @__PURE__ */ defineComponent({
11382
11275
  __name: "Transform",
@@ -11906,7 +11799,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
11906
11799
  }
11907
11800
  if (handle === "resize-t" || handle === "resize-r" || handle === "resize-tr" || handle === "resize-bl") {
11908
11801
  return h("line", {
11909
- class: "mce-transform__diagonal",
11802
+ class: "m-transform__diagonal",
11910
11803
  x1: "100%",
11911
11804
  y1: "0",
11912
11805
  x2: "0",
@@ -11914,7 +11807,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
11914
11807
  });
11915
11808
  } else if (handle === "resize-l" || handle === "resize-b" || handle === "resize-tl" || handle === "resize-br") {
11916
11809
  return h("line", {
11917
- class: "mce-transform__diagonal",
11810
+ class: "m-transform__diagonal",
11918
11811
  x1: "0",
11919
11812
  y1: "0",
11920
11813
  x2: "100%",
@@ -11925,15 +11818,15 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
11925
11818
  }
11926
11819
  return (_ctx, _cache) => {
11927
11820
  return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
11928
- class: normalizeClass(["mce-transform", [
11929
- !props.ui && "mce-transform--ui-hide",
11930
- transforming.value && "mce-transform--transforming",
11931
- __props.resizeStrategy && `mce-transform--${__props.resizeStrategy}`,
11932
- activeHandle.value && `mce-transform--${activeHandle.value}`,
11933
- activeHandle.value === "move" && "mce-transform--moving",
11934
- activeHandle.value?.startsWith("resize") && "mce-transform--resizing",
11935
- activeHandle.value?.startsWith("rotate") && "mce-transform--rotateing",
11936
- props.borderStyle && `mce-transform--${props.borderStyle}`
11821
+ class: normalizeClass(["m-transform", [
11822
+ !props.ui && "m-transform--ui-hide",
11823
+ transforming.value && "m-transform--transforming",
11824
+ __props.resizeStrategy && `m-transform--${__props.resizeStrategy}`,
11825
+ activeHandle.value && `m-transform--${activeHandle.value}`,
11826
+ activeHandle.value === "move" && "m-transform--moving",
11827
+ activeHandle.value?.startsWith("resize") && "m-transform--resizing",
11828
+ activeHandle.value?.startsWith("rotate") && "m-transform--rotateing",
11829
+ props.borderStyle && `m-transform--${props.borderStyle}`
11937
11830
  ]]),
11938
11831
  style: normalizeStyle$1(style.value)
11939
11832
  }, {
@@ -11946,17 +11839,17 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
11946
11839
  start: onPointerDown
11947
11840
  }),
11948
11841
  (openBlock(), createElementBlock("svg", {
11949
- class: "mce-transform__svg",
11842
+ class: "m-transform__svg",
11950
11843
  style: normalizeStyle$1({ color: __props.color })
11951
11844
  }, [
11952
11845
  _cache[1] || (_cache[1] = createElementVNode("rect", {
11953
11846
  width: "100%",
11954
11847
  height: "100%",
11955
11848
  fill: "none",
11956
- class: "mce-transform__rect"
11849
+ class: "m-transform__rect"
11957
11850
  }, null, -1)),
11958
11851
  createElementVNode("rect", {
11959
- class: "mce-transform__rect",
11852
+ class: "m-transform__rect",
11960
11853
  width: "100%",
11961
11854
  height: "100%",
11962
11855
  fill: "none",
@@ -11975,14 +11868,14 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
11975
11868
  width: handle.width,
11976
11869
  height: handle.height,
11977
11870
  "aria-label": handle.type,
11978
- class: "mce-transform__handle"
11871
+ class: "m-transform__handle"
11979
11872
  }, null, 8, _hoisted_3$6)) : handle.width === handle.height ? (openBlock(), createElementBlock("circle", {
11980
11873
  key: 1,
11981
11874
  cx: handle.x + handle.width / 2,
11982
11875
  cy: handle.y + handle.width / 2,
11983
11876
  r: handle.width / 2,
11984
11877
  "aria-label": handle.type,
11985
- class: "mce-transform__handle"
11878
+ class: "m-transform__handle"
11986
11879
  }, null, 8, _hoisted_4$3)) : (openBlock(), createElementBlock("rect", {
11987
11880
  key: 2,
11988
11881
  x: handle.x,
@@ -11992,7 +11885,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
11992
11885
  "aria-label": handle.type,
11993
11886
  rx: handle.width / 4,
11994
11887
  ry: handle.height / 4,
11995
- class: "mce-transform__handle"
11888
+ class: "m-transform__handle"
11996
11889
  }, null, 8, _hoisted_5$2))
11997
11890
  ], 64)) : createCommentVNode("", true)
11998
11891
  ], 64);
@@ -12000,7 +11893,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
12000
11893
  __props.rotator ? (openBlock(), createElementBlock("g", {
12001
11894
  key: 0,
12002
11895
  transform: `matrix(1, 0, 0, 1, -32, ${model.value.height}) rotate(270 16 16)`,
12003
- class: "mce-transform__rotator"
11896
+ class: "m-transform__rotator"
12004
11897
  }, [..._cache[0] || (_cache[0] = [
12005
11898
  createElementVNode("path", { d: "M22.4789 9.45728L25.9935 12.9942L22.4789 16.5283V14.1032C18.126 14.1502 14.6071 17.6737 14.5675 22.0283H17.05L13.513 25.543L9.97889 22.0283H12.5674C12.6071 16.5691 17.0214 12.1503 22.4789 12.1031L22.4789 9.45728Z" }, null, -1)
12006
11899
  ])], 8, _hoisted_6$2)) : createCommentVNode("", true)
@@ -12017,7 +11910,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
12017
11910
  width: handle.width,
12018
11911
  height: handle.height,
12019
11912
  "aria-label": handle.type,
12020
- class: "mce-transform__handle-rect",
11913
+ class: "m-transform__handle-rect",
12021
11914
  cursor: transforming.value ? "auto" : getCursor(handle.type),
12022
11915
  onPointerdown: (event) => onPointerDown(event, index)
12023
11916
  }, null, 40, _hoisted_8$1);
@@ -12034,7 +11927,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
12034
11927
  };
12035
11928
  }
12036
11929
  });
12037
- const _hoisted_1$e = { class: "mce-cropper" };
11930
+ const _hoisted_1$e = { class: "m-cropper" };
12038
11931
  const _sfc_main$l = /* @__PURE__ */ defineComponent({
12039
11932
  __name: "Cropper",
12040
11933
  props: /* @__PURE__ */ mergeModels({
@@ -12195,7 +12088,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
12195
12088
  return (_ctx, _cache) => {
12196
12089
  return withDirectives((openBlock(), createElementBlock("div", _hoisted_1$e, [
12197
12090
  createElementVNode("div", {
12198
- class: "mce-cropper__source",
12091
+ class: "m-cropper__source",
12199
12092
  style: normalizeStyle$1(unref(boundingBoxToStyle)(sourceTransform.value))
12200
12093
  }, [
12201
12094
  createElementVNode("canvas", {
@@ -12206,11 +12099,11 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
12206
12099
  createVNode(_sfc_main$m, {
12207
12100
  modelValue: sourceTransform.value,
12208
12101
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => sourceTransform.value = $event),
12209
- class: "mce-cropper__transform",
12102
+ class: "m-cropper__transform",
12210
12103
  rotatable: false
12211
12104
  }, {
12212
12105
  default: withCtx(({ props: slotProps }) => [
12213
- createElementVNode("div", mergeProps({ class: "mce-cropper__transform_rect" }, slotProps), null, 16)
12106
+ createElementVNode("div", mergeProps({ class: "m-cropper__transform_rect" }, slotProps), null, 16)
12214
12107
  ]),
12215
12108
  _: 1
12216
12109
  }, 8, ["modelValue"]),
@@ -12267,7 +12160,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
12267
12160
  };
12268
12161
  }
12269
12162
  });
12270
- const _hoisted_1$d = { class: "mce-selection" };
12163
+ const _hoisted_1$d = { class: "m-selection" };
12271
12164
  const _sfc_main$j = /* @__PURE__ */ defineComponent({
12272
12165
  __name: "Selection",
12273
12166
  setup(__props, { expose: __expose }) {
@@ -12398,25 +12291,25 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
12398
12291
  (openBlock(true), createElementBlock(Fragment, null, renderList(parentObbStyles.value, (style, index) => {
12399
12292
  return openBlock(), createElementBlock("div", {
12400
12293
  key: index,
12401
- class: "mce-selection__parent",
12294
+ class: "m-selection__parent",
12402
12295
  style: normalizeStyle$1(style)
12403
12296
  }, null, 4);
12404
12297
  }), 128)),
12405
12298
  unref(state) !== "moving" && unref(state) !== "transforming" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(selectionObbStyles.value, (style, index) => {
12406
12299
  return openBlock(), createElementBlock("div", {
12407
12300
  key: index,
12408
- class: "mce-selection__node",
12301
+ class: "m-selection__node",
12409
12302
  style: normalizeStyle$1(style)
12410
12303
  }, null, 4);
12411
12304
  }), 128)) : createCommentVNode("", true),
12412
12305
  unref(state) === "selecting" || unref(state) === "painting" ? (openBlock(), createElementBlock("div", {
12413
12306
  key: 1,
12414
- class: "mce-selection__marquee",
12307
+ class: "m-selection__marquee",
12415
12308
  style: normalizeStyle$1(unref(selectionMarquee).toCssStyle())
12416
12309
  }, null, 4)) : createCommentVNode("", true),
12417
12310
  transformValue.value.width && transformValue.value.height ? (openBlock(), createElementBlock("div", {
12418
12311
  key: 2,
12419
- class: "mce-selection__slot",
12312
+ class: "m-selection__slot",
12420
12313
  style: normalizeStyle$1(unref(selectionObbInDrawboard).toCssStyle())
12421
12314
  }, [
12422
12315
  createVNode(_sfc_main$k, null, {
@@ -12438,7 +12331,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
12438
12331
  roundable: roundable.value,
12439
12332
  ui: unref(state) !== "moving",
12440
12333
  "border-style": unref(state) === "cropping" ? "dashed" : "solid",
12441
- class: "mce-selection__transform",
12334
+ class: "m-selection__transform",
12442
12335
  tip,
12443
12336
  scale: [unref(camera).zoom.x, unref(camera).zoom.y],
12444
12337
  offset: [-unref(camera).position.x, -unref(camera).position.y],
@@ -12945,7 +12838,7 @@ const _slice = definePlugin((editor) => {
12945
12838
  });
12946
12839
  const _hoisted_1$c = {
12947
12840
  key: 0,
12948
- class: "mce-smart-guides"
12841
+ class: "m-smart-guides"
12949
12842
  };
12950
12843
  const _sfc_main$i = /* @__PURE__ */ defineComponent({
12951
12844
  __name: "SmartGuides",
@@ -12961,7 +12854,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
12961
12854
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.snapLines, (item, key) => {
12962
12855
  return openBlock(), createElementBlock("div", {
12963
12856
  key,
12964
- class: normalizeClass(item.class.map((v) => `mce-smart-guides__${v}`)),
12857
+ class: normalizeClass(item.class.map((v) => `m-smart-guides__${v}`)),
12965
12858
  style: normalizeStyle$1({
12966
12859
  left: `${item.style.left}px`,
12967
12860
  top: `${item.style.top}px`,
@@ -14728,23 +14621,23 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
14728
14621
  return (_ctx, _cache) => {
14729
14622
  return info.value ? (openBlock(), createElementBlock("div", {
14730
14623
  key: 0,
14731
- class: normalizeClass(["mce-smart-selection", {
14732
- "mce-smart-selection--hover": !unref(state) && unref(isPointerInSelection),
14733
- [`mce-smart-selection--${info.value.direction}`]: true,
14734
- [`mce-smart-selection--${dragState.value}`]: dragState.value !== void 0
14624
+ class: normalizeClass(["m-smart-selection", {
14625
+ "m-smart-selection--hover": !unref(state) && unref(isPointerInSelection),
14626
+ [`m-smart-selection--${info.value.direction}`]: true,
14627
+ [`m-smart-selection--${dragState.value}`]: dragState.value !== void 0
14735
14628
  }])
14736
14629
  }, [
14737
14630
  unref(state) !== "moving" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
14738
14631
  (openBlock(true), createElementBlock(Fragment, null, renderList(boxes.value, (item, index) => {
14739
14632
  return openBlock(), createElementBlock("div", {
14740
14633
  key: index,
14741
- class: normalizeClass(["mce-smart-selection__node", {
14742
- "mce-smart-selection__node--active": item.el.equal(currentElement.value)
14634
+ class: normalizeClass(["m-smart-selection__node", {
14635
+ "m-smart-selection__node--active": item.el.equal(currentElement.value)
14743
14636
  }]),
14744
14637
  style: normalizeStyle$1(item.style)
14745
14638
  }, [
14746
14639
  createElementVNode("div", {
14747
- class: "mce-smart-selection__ring",
14640
+ class: "m-smart-selection__ring",
14748
14641
  onPointerdown: ($event) => onRingDrag($event, item)
14749
14642
  }, null, 40, _hoisted_1$b)
14750
14643
  ], 6);
@@ -14754,8 +14647,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
14754
14647
  "model-value": currentTransform.value
14755
14648
  }, transformProps, {
14756
14649
  handles: ["resize-l", "resize-r", "resize-t", "resize-b"],
14757
- class: "mce-smart-selection__transform",
14758
- color: "rgb(var(--mce-theme-secondary))",
14650
+ class: "m-smart-selection__transform",
14651
+ color: "rgb(var(--m-theme-secondary))",
14759
14652
  scale: [unref(camera).zoom.x, unref(camera).zoom.y],
14760
14653
  offset: [-unref(camera).position.x, -unref(camera).position.y]
14761
14654
  }), null, 16, ["model-value", "scale", "offset"])) : createCommentVNode("", true)
@@ -14763,18 +14656,18 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
14763
14656
  (openBlock(true), createElementBlock(Fragment, null, renderList(spacingHandles.value, (item, index) => {
14764
14657
  return openBlock(), createElementBlock("div", {
14765
14658
  key: index,
14766
- class: "mce-smart-selection__spacing",
14659
+ class: "m-smart-selection__spacing",
14767
14660
  style: normalizeStyle$1(item.style)
14768
14661
  }, [
14769
14662
  createElementVNode("div", {
14770
- class: "mce-smart-selection__spacing-line",
14663
+ class: "m-smart-selection__spacing-line",
14771
14664
  onPointerdown: _cache[0] || (_cache[0] = ($event) => onSpacingDrag($event))
14772
14665
  }, null, 32)
14773
14666
  ], 4);
14774
14667
  }), 128)),
14775
14668
  _globalAabb.value ? (openBlock(), createElementBlock("div", {
14776
14669
  key: 1,
14777
- class: "mce-smart-selection__ghost",
14670
+ class: "m-smart-selection__ghost",
14778
14671
  style: normalizeStyle$1(_globalAabb.value.toCssStyle())
14779
14672
  }, null, 4)) : createCommentVNode("", true)
14780
14673
  ], 2)) : createCommentVNode("", true);
@@ -14818,15 +14711,15 @@ const _state = definePlugin((editor) => {
14818
14711
  ]
14819
14712
  };
14820
14713
  });
14821
- const _hoisted_1$a = { class: "progress-indicator" };
14714
+ const _hoisted_1$a = { class: "m-progress-indicator" };
14822
14715
  const _hoisted_2$5 = {
14823
14716
  key: 0,
14824
- class: "progress-indicator__status"
14717
+ class: "m-progress-indicator__status"
14825
14718
  };
14826
- const _hoisted_3$5 = { class: "progress-indicator__bar" };
14719
+ const _hoisted_3$5 = { class: "m-progress-indicator__bar" };
14827
14720
  const _hoisted_4$2 = {
14828
14721
  key: 1,
14829
- class: "progress-indicator__bar-indeterminate"
14722
+ class: "m-progress-indicator__bar-indeterminate"
14830
14723
  };
14831
14724
  const _sfc_main$g = /* @__PURE__ */ defineComponent({
14832
14725
  __name: "ProgressIndicator",
@@ -14846,7 +14739,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
14846
14739
  createElementVNode("div", _hoisted_3$5, [
14847
14740
  !__props.indeterminate ? (openBlock(), createElementBlock("div", {
14848
14741
  key: 0,
14849
- class: "progress-indicator__bar-fill",
14742
+ class: "m-progress-indicator__bar-fill",
14850
14743
  style: normalizeStyle$1({ width: `${progress.value * 100}%` })
14851
14744
  }, null, 4)) : (openBlock(), createElementBlock("div", _hoisted_4$2))
14852
14745
  ])
@@ -14854,29 +14747,29 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
14854
14747
  };
14855
14748
  }
14856
14749
  });
14857
- const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-3b286483"]]);
14858
- const _hoisted_1$9 = { class: "mce-statusbar" };
14859
- const _hoisted_2$4 = { class: "mce-statusbar__main" };
14860
- const _hoisted_3$4 = { class: "mce-statusbar__item" };
14861
- const _hoisted_4$1 = { class: "mce-statusbar__kbd" };
14862
- const _hoisted_5$1 = { class: "mce-statusbar__kbd" };
14863
- const _hoisted_6$1 = { class: "mce-statusbar__item" };
14864
- const _hoisted_7 = { class: "mce-statusbar__kbd" };
14865
- const _hoisted_8 = { class: "mce-statusbar__item" };
14866
- const _hoisted_9 = { class: "mce-statusbar__item" };
14867
- const _hoisted_10 = { class: "mce-statusbar__kbd" };
14868
- const _hoisted_11 = { class: "mce-statusbar__item" };
14869
- const _hoisted_12 = { class: "mce-statusbar__kbd" };
14750
+ const ProgressIndicator = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-cc8ac0cb"]]);
14751
+ const _hoisted_1$9 = { class: "m-statusbar" };
14752
+ const _hoisted_2$4 = { class: "m-statusbar__main" };
14753
+ const _hoisted_3$4 = { class: "m-statusbar__item" };
14754
+ const _hoisted_4$1 = { class: "m-statusbar__kbd" };
14755
+ const _hoisted_5$1 = { class: "m-statusbar__kbd" };
14756
+ const _hoisted_6$1 = { class: "m-statusbar__item" };
14757
+ const _hoisted_7 = { class: "m-statusbar__kbd" };
14758
+ const _hoisted_8 = { class: "m-statusbar__item" };
14759
+ const _hoisted_9 = { class: "m-statusbar__item" };
14760
+ const _hoisted_10 = { class: "m-statusbar__kbd" };
14761
+ const _hoisted_11 = { class: "m-statusbar__item" };
14762
+ const _hoisted_12 = { class: "m-statusbar__kbd" };
14870
14763
  const _hoisted_13 = { key: 2 };
14871
- const _hoisted_14 = { class: "mce-statusbar__item" };
14872
- const _hoisted_15 = { class: "mce-statusbar__item" };
14873
- const _hoisted_16 = { class: "mce-statusbar__kbd" };
14874
- const _hoisted_17 = { class: "mce-statusbar__item" };
14875
- const _hoisted_18 = { class: "mce-statusbar__item" };
14876
- const _hoisted_19 = { class: "mce-statusbar__kbd" };
14877
- const _hoisted_20 = { class: "mce-statusbar__item" };
14878
- const _hoisted_21 = { class: "mce-statusbar__item" };
14879
- const _hoisted_22 = { class: "mce-statusbar__progress" };
14764
+ const _hoisted_14 = { class: "m-statusbar__item" };
14765
+ const _hoisted_15 = { class: "m-statusbar__item" };
14766
+ const _hoisted_16 = { class: "m-statusbar__kbd" };
14767
+ const _hoisted_17 = { class: "m-statusbar__item" };
14768
+ const _hoisted_18 = { class: "m-statusbar__item" };
14769
+ const _hoisted_19 = { class: "m-statusbar__kbd" };
14770
+ const _hoisted_20 = { class: "m-statusbar__item" };
14771
+ const _hoisted_21 = { class: "m-statusbar__item" };
14772
+ const _hoisted_22 = { class: "m-statusbar__progress" };
14880
14773
  const _sfc_main$f = /* @__PURE__ */ defineComponent({
14881
14774
  __name: "Statusbar",
14882
14775
  setup(__props) {
@@ -14912,7 +14805,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
14912
14805
  createElementVNode("span", null, toDisplayString(unref(t)("cancel")), 1)
14913
14806
  ]),
14914
14807
  unref(state) === "moving" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
14915
- _cache[2] || (_cache[2] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
14808
+ _cache[2] || (_cache[2] = createElementVNode("div", { class: "m-statusbar__divider" }, null, -1)),
14916
14809
  createElementVNode("div", _hoisted_11, [
14917
14810
  createElementVNode("span", _hoisted_12, toDisplayString(unref(getKbd)("Shift")), 1),
14918
14811
  createElementVNode("span", null, toDisplayString(unref(t)("constrainMovement")), 1)
@@ -14928,7 +14821,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
14928
14821
  createElementVNode("span", _hoisted_16, toDisplayString(unref(getKbd)("Shift")), 1),
14929
14822
  createElementVNode("span", null, toDisplayString(unref(t)("extend")), 1)
14930
14823
  ]),
14931
- _cache[6] || (_cache[6] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
14824
+ _cache[6] || (_cache[6] = createElementVNode("div", { class: "m-statusbar__divider" }, null, -1)),
14932
14825
  createElementVNode("div", _hoisted_17, [
14933
14826
  createVNode(unref(_sfc_main$F), { icon: "$mouseLeftClick" }),
14934
14827
  createElementVNode("span", null, toDisplayString(unref(t)("selectArea")), 1)
@@ -14938,13 +14831,13 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
14938
14831
  createElementVNode("span", _hoisted_19, toDisplayString(unref(getKbd)("Shift")), 1),
14939
14832
  createElementVNode("span", null, toDisplayString(unref(t)("extend")), 1)
14940
14833
  ]),
14941
- _cache[8] || (_cache[8] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
14834
+ _cache[8] || (_cache[8] = createElementVNode("div", { class: "m-statusbar__divider" }, null, -1)),
14942
14835
  createElementVNode("div", _hoisted_20, [
14943
14836
  createVNode(unref(_sfc_main$F), { icon: "$mouseLeftClick" }),
14944
14837
  createElementVNode("span", null, toDisplayString(unref(t)("dragSelected")), 1)
14945
14838
  ]),
14946
14839
  unref(selection).length === 1 && unref(isElement)(unref(selection)[0]) && unref(selection)[0].text.isValid() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
14947
- _cache[4] || (_cache[4] = createElementVNode("div", { class: "mce-statusbar__divider" }, null, -1)),
14840
+ _cache[4] || (_cache[4] = createElementVNode("div", { class: "m-statusbar__divider" }, null, -1)),
14948
14841
  createElementVNode("div", _hoisted_21, [
14949
14842
  createElementVNode("span", null, toDisplayString(unref(getKbd)("Enter")), 1),
14950
14843
  createElementVNode("span", null, toDisplayString(unref(t)("startTyping")), 1)
@@ -14964,14 +14857,14 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
14964
14857
  };
14965
14858
  }
14966
14859
  });
14967
- const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-39842d8e"]]);
14860
+ const Statusbar = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-12c3be94"]]);
14968
14861
  const _statusbar = definePlugin((editor) => {
14969
14862
  const {
14970
14863
  registerConfig
14971
14864
  } = editor;
14972
14865
  const config = registerConfig("ui.statusbar", {
14973
14866
  default: {
14974
- visible: false
14867
+ visible: true
14975
14868
  }
14976
14869
  });
14977
14870
  return {
@@ -15025,29 +14918,29 @@ const _test = definePlugin((editor) => {
15025
14918
  ]
15026
14919
  };
15027
14920
  });
15028
- const _hoisted_1$8 = { class: "mce-payhead" };
14921
+ const _hoisted_1$8 = { class: "m-payhead" };
15029
14922
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
15030
14923
  __name: "Playhead",
15031
14924
  setup(__props) {
15032
14925
  return (_ctx, _cache) => {
15033
14926
  return openBlock(), createElementBlock("div", _hoisted_1$8, [..._cache[0] || (_cache[0] = [
15034
- createElementVNode("header", { class: "mce-payhead__header" }, null, -1),
15035
- createElementVNode("main", { class: "mce-payhead__main" }, null, -1)
14927
+ createElementVNode("header", { class: "m-payhead__header" }, null, -1),
14928
+ createElementVNode("main", { class: "m-payhead__main" }, null, -1)
15036
14929
  ])]);
15037
14930
  };
15038
14931
  }
15039
14932
  });
15040
14933
  const _hoisted_1$7 = {
15041
14934
  key: 0,
15042
- class: "mce-segment__edge mce-segment__edge--front"
14935
+ class: "m-segment__edge m-segment__edge--front"
15043
14936
  };
15044
14937
  const _hoisted_2$3 = {
15045
- class: "mce-segment__node",
14938
+ class: "m-segment__node",
15046
14939
  style: { "overflow": "hidden" }
15047
14940
  };
15048
14941
  const _hoisted_3$3 = {
15049
14942
  key: 1,
15050
- class: "mce-segment__edge mce-segment__edge--end"
14943
+ class: "m-segment__edge m-segment__edge--end"
15051
14944
  };
15052
14945
  const _sfc_main$d = /* @__PURE__ */ defineComponent({
15053
14946
  __name: "Segment",
@@ -15102,16 +14995,16 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
15102
14995
  });
15103
14996
  return (_ctx, _cache) => {
15104
14997
  return openBlock(), createElementBlock("div", {
15105
- class: normalizeClass(["mce-segment", [
15106
- `mce-segment--${(__props.node.meta.inEditorIs ?? "none").toLowerCase()}`,
15107
- __props.active && `mce-segment--active`
14998
+ class: normalizeClass(["m-segment", [
14999
+ `m-segment--${(__props.node.meta.inEditorIs ?? "none").toLowerCase()}`,
15000
+ __props.active && `m-segment--active`
15108
15001
  ]]),
15109
15002
  style: normalizeStyle$1(style.value)
15110
15003
  }, [
15111
15004
  (openBlock(true), createElementBlock(Fragment, null, renderList(blocks.value, (block, index) => {
15112
15005
  return openBlock(), createElementBlock("div", {
15113
15006
  key: index,
15114
- class: "mce-segment__block",
15007
+ class: "m-segment__block",
15115
15008
  style: normalizeStyle$1(block.style)
15116
15009
  }, null, 4);
15117
15010
  }), 128)),
@@ -15122,7 +15015,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
15122
15015
  };
15123
15016
  }
15124
15017
  });
15125
- const _hoisted_1$6 = { class: "mce-track" };
15018
+ const _hoisted_1$6 = { class: "m-track" };
15126
15019
  const _sfc_main$c = /* @__PURE__ */ defineComponent({
15127
15020
  __name: "Track",
15128
15021
  setup(__props) {
@@ -15141,7 +15034,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
15141
15034
  setup(__props) {
15142
15035
  return (_ctx, _cache) => {
15143
15036
  return openBlock(), createElementBlock("div", {
15144
- class: "mce-trackhead",
15037
+ class: "m-trackhead",
15145
15038
  style: normalizeStyle$1({
15146
15039
  height: `var(--timeline-track-height__${__props.node.meta.inEditorIs}, 22px)`
15147
15040
  })
@@ -15149,12 +15042,12 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
15149
15042
  };
15150
15043
  }
15151
15044
  });
15152
- const _hoisted_1$5 = { class: "mce-timeline__toolbar" };
15153
- const _hoisted_2$2 = { class: "mce-timeline__main" };
15154
- const _hoisted_3$2 = { class: "mce-timeline__left-wrapper" };
15155
- const _hoisted_4 = { class: "mce-timeline__right-wrapper" };
15156
- const _hoisted_5 = { class: "mce-timeline__ruler" };
15157
- const _hoisted_6 = { class: "mce-timeline__track" };
15045
+ const _hoisted_1$5 = { class: "m-timeline__toolbar" };
15046
+ const _hoisted_2$2 = { class: "m-timeline__main" };
15047
+ const _hoisted_3$2 = { class: "m-timeline__left-wrapper" };
15048
+ const _hoisted_4 = { class: "m-timeline__right-wrapper" };
15049
+ const _hoisted_5 = { class: "m-timeline__ruler" };
15050
+ const _hoisted_6 = { class: "m-timeline__track" };
15158
15051
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
15159
15052
  __name: "Timeline",
15160
15053
  setup(__props) {
@@ -15252,13 +15145,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
15252
15145
  onBeforeUnmount(pause);
15253
15146
  return (_ctx, _cache) => {
15254
15147
  return openBlock(), createElementBlock("div", {
15255
- class: "mce-timeline",
15148
+ class: "m-timeline",
15256
15149
  onWheel: _cache[0] || (_cache[0] = withModifiers(() => {
15257
15150
  }, ["prevent"]))
15258
15151
  }, [
15259
15152
  createElementVNode("div", _hoisted_1$5, [
15260
15153
  createElementVNode("div", {
15261
- class: "mce-timeline__play",
15154
+ class: "m-timeline__play",
15262
15155
  onClick: toggle
15263
15156
  }, [
15264
15157
  createVNode(unref(_sfc_main$F), {
@@ -15268,7 +15161,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
15268
15161
  ]),
15269
15162
  createElementVNode("div", _hoisted_2$2, [
15270
15163
  createElementVNode("div", {
15271
- class: "mce-timeline__left",
15164
+ class: "m-timeline__left",
15272
15165
  onWheel
15273
15166
  }, [
15274
15167
  createElementVNode("div", _hoisted_3$2, [
@@ -15287,7 +15180,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
15287
15180
  ])
15288
15181
  ], 32),
15289
15182
  createElementVNode("div", {
15290
- class: "mce-timeline__right",
15183
+ class: "m-timeline__right",
15291
15184
  onWheel,
15292
15185
  onMousedown
15293
15186
  }, [
@@ -15394,7 +15287,7 @@ const _timeline = definePlugin((editor) => {
15394
15287
  });
15395
15288
  const _hoisted_1$4 = {
15396
15289
  key: 0,
15397
- class: "mce-drawing__tip"
15290
+ class: "m-drawing__tip"
15398
15291
  };
15399
15292
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15400
15293
  __name: "Drawing",
@@ -15408,7 +15301,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
15408
15301
  return (_ctx, _cache) => {
15409
15302
  return unref(state) === "drawing" && unref(drawboardPointer) ? (openBlock(), createElementBlock("div", {
15410
15303
  key: 0,
15411
- class: "mce-drawing",
15304
+ class: "m-drawing",
15412
15305
  style: normalizeStyle$1({
15413
15306
  left: `${unref(drawboardPointer).x}px`,
15414
15307
  top: `${unref(drawboardPointer).y}px`
@@ -15433,7 +15326,7 @@ const _tool = definePlugin((editor) => {
15433
15326
  ]
15434
15327
  };
15435
15328
  });
15436
- const _hoisted_1$3 = { class: "mce-toolbelt" };
15329
+ const _hoisted_1$3 = { class: "m-toolbelt" };
15437
15330
  const _hoisted_2$1 = { key: 0 };
15438
15331
  const _hoisted_3$1 = { key: 1 };
15439
15332
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
@@ -15539,7 +15432,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
15539
15432
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (tool, key) => {
15540
15433
  return openBlock(), createElementBlock("div", {
15541
15434
  key,
15542
- class: "mce-toolbelt__group"
15435
+ class: "m-toolbelt__group"
15543
15436
  }, [
15544
15437
  createVNode(_sfc_main$s, {
15545
15438
  location: "top",
@@ -15549,7 +15442,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
15549
15442
  activator: withCtx(({ props: slotProps }) => [
15550
15443
  createVNode(_sfc_main$B, mergeProps({
15551
15444
  icon: "",
15552
- class: "mce-toolbelt__btn",
15445
+ class: "m-toolbelt__btn",
15553
15446
  active: tool.active || tool.checked || false
15554
15447
  }, { ref_for: true }, slotProps, {
15555
15448
  onClick: tool.handle
@@ -15579,7 +15472,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
15579
15472
  activator: withCtx(({ props }) => [
15580
15473
  createVNode(_sfc_main$B, mergeProps({
15581
15474
  icon: "",
15582
- class: "mce-toolbelt__arrow"
15475
+ class: "m-toolbelt__arrow"
15583
15476
  }, { ref_for: true }, props), {
15584
15477
  default: withCtx(() => [
15585
15478
  createVNode(unref(_sfc_main$F), { icon: "$arrowDown" })
@@ -15599,7 +15492,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
15599
15492
  ]),
15600
15493
  prepend: withCtx(({ item }) => [
15601
15494
  createVNode(unref(_sfc_main$F), {
15602
- class: "mce-toolbelt__icon",
15495
+ class: "m-toolbelt__icon",
15603
15496
  icon: `$${item.key}`
15604
15497
  }, null, 8, ["icon"])
15605
15498
  ]),
@@ -15617,7 +15510,7 @@ const _toolbelt = definePlugin((editor) => {
15617
15510
  } = editor;
15618
15511
  const config = registerConfig("ui.toolbelt", {
15619
15512
  default: {
15620
- visible: false
15513
+ visible: true
15621
15514
  }
15622
15515
  });
15623
15516
  return {
@@ -15982,13 +15875,13 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
15982
15875
  });
15983
15876
  return (_ctx, _cache) => {
15984
15877
  return withDirectives((openBlock(), createElementBlock("div", {
15985
- class: "mce-text-editor",
15878
+ class: "m-text-editor",
15986
15879
  style: normalizeStyle$1({
15987
15880
  ...mainStyleWithScale.value
15988
15881
  })
15989
15882
  }, [
15990
15883
  createElementVNode("div", {
15991
- class: "mce-text-editor__wrapper",
15884
+ class: "m-text-editor__wrapper",
15992
15885
  style: normalizeStyle$1({
15993
15886
  ...textEditorStyle.value
15994
15887
  })
@@ -15996,9 +15889,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
15996
15889
  createElementVNode("text-editor", {
15997
15890
  ref_key: "textEditor",
15998
15891
  ref: textEditor,
15999
- class: "mce-text-editor__editor",
15892
+ class: "m-text-editor__editor",
16000
15893
  style: {
16001
- "--color": "var(--mce-theme-primary)"
15894
+ "--color": "var(--m-theme-primary)"
16002
15895
  },
16003
15896
  "data-pointerdown_to_drawboard": "",
16004
15897
  onSelected: onUpdateTextSelection,
@@ -17384,12 +17277,10 @@ const _zoom = definePlugin((editor) => {
17384
17277
  const plugins = [
17385
17278
  _arrange,
17386
17279
  _autoNest,
17387
- _copyAs,
17388
17280
  _doc,
17389
17281
  _edit,
17390
17282
  _formatPaint,
17391
17283
  _frame,
17392
- _gif,
17393
17284
  _history,
17394
17285
  _hover,
17395
17286
  _html,
@@ -17400,9 +17291,7 @@ const plugins = [
17400
17291
  _madeWith,
17401
17292
  _memory,
17402
17293
  _menu,
17403
- _new,
17404
17294
  _node,
17405
- _open,
17406
17295
  _pen,
17407
17296
  _ruler,
17408
17297
  _saveAs,
@@ -17674,7 +17563,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
17674
17563
  return openBlock(), createBlock(_sfc_main$w, {
17675
17564
  ref: "overlayTpl",
17676
17565
  "content-style": style.value,
17677
- class: "mce-floatbar",
17566
+ class: "m-floatbar",
17678
17567
  location: props.location,
17679
17568
  middlewares: props.middlewares,
17680
17569
  offset: offset2.value,
@@ -17692,7 +17581,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
17692
17581
  });
17693
17582
  const _hoisted_1$2 = {
17694
17583
  key: 0,
17695
- class: "mce-float-panel__title"
17584
+ class: "m-float-panel__title"
17696
17585
  };
17697
17586
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
17698
17587
  __name: "FloatPanel",
@@ -17722,13 +17611,13 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
17722
17611
  key: 0,
17723
17612
  modelValue: transform.value,
17724
17613
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => transform.value = $event),
17725
- class: "mce-float-panel",
17614
+ class: "m-float-panel",
17726
17615
  ui: false,
17727
17616
  onWheel: _cache[3] || (_cache[3] = withModifiers(() => {
17728
17617
  }, ["stop"]))
17729
17618
  }, {
17730
17619
  default: withCtx(({ props: slotProps }) => [
17731
- createElementVNode("div", mergeProps({ class: "mce-float-panel__card" }, slotProps), [
17620
+ createElementVNode("div", mergeProps({ class: "m-float-panel__card" }, slotProps), [
17732
17621
  __props.title ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
17733
17622
  createElementVNode("div", null, toDisplayString(__props.title), 1),
17734
17623
  createVNode(_sfc_main$B, {
@@ -17742,7 +17631,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
17742
17631
  })
17743
17632
  ])) : createCommentVNode("", true),
17744
17633
  createElementVNode("div", {
17745
- class: "mce-float-panel__content",
17634
+ class: "m-float-panel__content",
17746
17635
  onPointerdown: _cache[1] || (_cache[1] = withModifiers(() => {
17747
17636
  }, ["stop"]))
17748
17637
  }, [
@@ -17824,8 +17713,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
17824
17713
  return (_ctx, _cache) => {
17825
17714
  return openBlock(), createElementBlock("div", {
17826
17715
  class: normalizeClass(normalizeClass([
17827
- "mce-layout-item",
17828
- `mce-layout-item--${props.position}`,
17716
+ "m-layout-item",
17717
+ `m-layout-item--${props.position}`,
17829
17718
  props.class
17830
17719
  ])),
17831
17720
  style: normalizeStyle$1(normalizeStyle$1([unref(layoutItemStyles), props.style]))
@@ -17837,7 +17726,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
17837
17726
  });
17838
17727
  const _hoisted_1$1 = {
17839
17728
  key: 0,
17840
- class: "mce-main__scroller"
17729
+ class: "m-main__scroller"
17841
17730
  };
17842
17731
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17843
17732
  __name: "Main",
@@ -17849,8 +17738,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17849
17738
  const { mainStyles } = useLayout();
17850
17739
  return (_ctx, _cache) => {
17851
17740
  return openBlock(), createElementBlock("main", {
17852
- class: normalizeClass(["mce-main", [
17853
- { "mce-main--scrollable": props.scrollable }
17741
+ class: normalizeClass(["m-main", [
17742
+ { "m-main--scrollable": props.scrollable }
17854
17743
  ]]),
17855
17744
  style: normalizeStyle$1([unref(mainStyles)])
17856
17745
  }, [
@@ -17864,11 +17753,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17864
17753
  const _hoisted_1 = ["data-pixel-ratio"];
17865
17754
  const _hoisted_2 = {
17866
17755
  ref: "canvasTpl",
17867
- class: "mce-editor__canvas"
17756
+ class: "m-editor__canvas"
17868
17757
  };
17869
17758
  const _hoisted_3 = {
17870
17759
  ref: "overlayContainerTpl",
17871
- class: "mce-overlay-container"
17760
+ class: "m-overlay-container"
17872
17761
  };
17873
17762
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17874
17763
  __name: "EditorLayout",
@@ -17900,7 +17789,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17900
17789
  drawboardDom,
17901
17790
  renderEngine,
17902
17791
  camera,
17903
- bindRenderCanvas,
17904
17792
  hoverElement,
17905
17793
  state,
17906
17794
  setCursor,
@@ -17937,6 +17825,34 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17937
17825
  renderEngine.value.off("pointermove", onEnginePointerMove);
17938
17826
  renderEngine.value.off("pointerover", onEnginePointerOver);
17939
17827
  });
17828
+ function bindRenderCanvas(canvas2, eventTarget) {
17829
+ function onRendered() {
17830
+ const target = renderEngine.value.view;
17831
+ if (!target.width || !target.height) {
17832
+ return;
17833
+ }
17834
+ canvas2.width = target.width;
17835
+ canvas2.height = target.height;
17836
+ canvas2.dataset.pixelRatio = target.dataset.pixelRatio;
17837
+ canvas2.getContext("2d")?.drawImage(target, 0, 0, target.width, target.height);
17838
+ }
17839
+ function unbind() {
17840
+ if (canvas2._onRendered) {
17841
+ renderEngine.value.off("rendered", canvas2._onRendered);
17842
+ }
17843
+ renderEngine.value.input.setTarget(renderEngine.value.view);
17844
+ }
17845
+ function bind() {
17846
+ unbind();
17847
+ canvas2._onRendered = onRendered;
17848
+ renderEngine.value.on("rendered", onRendered);
17849
+ if (eventTarget) {
17850
+ renderEngine.value.input.setTarget(eventTarget);
17851
+ }
17852
+ }
17853
+ bind();
17854
+ return unbind;
17855
+ }
17940
17856
  function onHover(event) {
17941
17857
  let cursor;
17942
17858
  let hovered;
@@ -18228,10 +18144,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
18228
18144
  };
18229
18145
  return (_ctx, _cache) => {
18230
18146
  return openBlock(), createBlock(_sfc_main$4, {
18231
- class: normalizeClass(["mce-editor", [
18232
- unref(state) && `mce-editor--${unref(state)}`,
18233
- unref(activeTool) && `mce-editor--drawing-tool-${unref(activeTool).name}`,
18234
- grabbing.value && `mce-editor--grabbing`
18147
+ class: normalizeClass(["m-editor", [
18148
+ unref(state) && `m-editor--${unref(state)}`,
18149
+ unref(activeTool) && `m-editor--drawing-tool-${unref(activeTool).name}`,
18150
+ grabbing.value && `m-editor--grabbing`
18235
18151
  ]])
18236
18152
  }, {
18237
18153
  default: withCtx(() => [
@@ -18240,7 +18156,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
18240
18156
  createElementVNode("div", {
18241
18157
  ref_key: "drawboardDom",
18242
18158
  ref: drawboardDom,
18243
- class: "mce-editor__drawboard",
18159
+ class: "m-editor__drawboard",
18244
18160
  "data-pixel-ratio": unref(renderEngine).pixelRatio,
18245
18161
  onDblclick: _cache[0] || (_cache[0] = ($event) => onDoubleclick($event)),
18246
18162
  onScroll,
@@ -18369,7 +18285,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
18369
18285
  offset: props.offset,
18370
18286
  target: props.target,
18371
18287
  attach: props.attach,
18372
- class: "mce-dialog"
18288
+ class: "m-dialog"
18373
18289
  }, {
18374
18290
  activator: withCtx((slotProps) => [
18375
18291
  renderSlot(_ctx.$slots, "activator", mergeProps(slotProps, {