mce 0.15.15 → 0.15.16
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.css +10 -0
- package/dist/index.js +70 -14
- package/dist/locale/en.d.ts +2 -0
- package/dist/locale/zh-Hans.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -900,6 +900,16 @@
|
|
|
900
900
|
white-space: nowrap;
|
|
901
901
|
overflow: hidden;
|
|
902
902
|
text-overflow: ellipsis;
|
|
903
|
+
}
|
|
904
|
+
.mce-segment__block {
|
|
905
|
+
position: absolute;
|
|
906
|
+
left: 0;
|
|
907
|
+
top: 0;
|
|
908
|
+
font-size: 12px;
|
|
909
|
+
padding: 0 8px;
|
|
910
|
+
text-wrap: nowrap;
|
|
911
|
+
overflow: visible;
|
|
912
|
+
border-bottom: 1px solid rgb(var(--mce-theme-surface));
|
|
903
913
|
}.mce-track {
|
|
904
914
|
position: relative;
|
|
905
915
|
display: flex;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Node as Node$1, Element2D, Timeline, Engine, Camera2D, DrawboardEffect, Aabb2D, IN_BROWSER, clamp, assets, TimelineNode, Video2D, Transform2D, Obb2D, render, Vector2 as Vector2$1, customNodes, Animation, IN_MAC_OS } from "modern-canvas";
|
|
2
|
-
import { reactive, computed, watch, markRaw, isReactive, ref, warn, shallowRef, onBeforeUnmount, defineComponent, createElementBlock, createCommentVNode, unref, openBlock, normalizeStyle, toDisplayString, createVNode, useAttrs, createBlock, resolveDynamicComponent, normalizeClass, mergeProps, createElementVNode, inject, toValue, getCurrentInstance, provide, useId, readonly, toRef, onMounted, onDeactivated, onActivated, onScopeDispose, useModel, useTemplateRef, withDirectives, vShow, vModelText, nextTick, Fragment, renderList, renderSlot, mergeModels, resolveComponent,
|
|
1
|
+
import { Node as Node$1, Element2D, Timeline, Engine, Camera2D, DrawboardEffect, Aabb2D, IN_BROWSER, clamp, assets, TimelineNode, Video2D, Transform2D, Obb2D, render, Vector2 as Vector2$1, Lottie2D, customNodes, Animation, IN_MAC_OS } from "modern-canvas";
|
|
2
|
+
import { reactive, computed, watch, markRaw, isReactive, ref, warn, shallowRef, onBeforeUnmount, defineComponent, createElementBlock, createCommentVNode, unref, openBlock, normalizeStyle, toDisplayString, createVNode, useAttrs, createBlock, resolveDynamicComponent, normalizeClass, mergeProps, createElementVNode, inject, toValue, getCurrentInstance, provide, useId, readonly, toRef, onMounted, onDeactivated, onActivated, onScopeDispose, useModel, useTemplateRef, withDirectives, withModifiers, vShow, vModelText, nextTick, Fragment, renderList, renderSlot, mergeModels, resolveComponent, withCtx, Teleport, createTextVNode, createSlots, normalizeProps, guardReactiveProps, onBeforeMount, h, isRef, useSlots } from "vue";
|
|
3
3
|
import { useFileDialog, useEventListener, isClient, onClickOutside, useDebounceFn, useResizeObserver as useResizeObserver$1, useLocalStorage, useImage } from "@vueuse/core";
|
|
4
4
|
import { getObjectValueByPath, setObjectValueByPath, Observable, Reactivable, idGenerator, property, normalizeTextContent, normalizeCRLF, isEqualObject } from "modern-idoc";
|
|
5
5
|
import { saveAs } from "file-saver";
|
|
@@ -1089,6 +1089,8 @@ const en = {
|
|
|
1089
1089
|
"polygon": "Polygon",
|
|
1090
1090
|
"star": "Star",
|
|
1091
1091
|
"image": "Image",
|
|
1092
|
+
"video": "Video",
|
|
1093
|
+
"lottie": "Lottie",
|
|
1092
1094
|
"pen": "Pen",
|
|
1093
1095
|
"pencil": "Pencil",
|
|
1094
1096
|
"file": "File",
|
|
@@ -1195,6 +1197,8 @@ const zhHans = {
|
|
|
1195
1197
|
"polygon": "多边形",
|
|
1196
1198
|
"star": "星形",
|
|
1197
1199
|
"image": "图片",
|
|
1200
|
+
"video": "视频",
|
|
1201
|
+
"lottie": "Lottie",
|
|
1198
1202
|
"pen": "钢笔",
|
|
1199
1203
|
"pencil": "铅笔",
|
|
1200
1204
|
"file": "文件",
|
|
@@ -1808,10 +1812,6 @@ const _1_timeline = defineMixin((editor) => {
|
|
|
1808
1812
|
on
|
|
1809
1813
|
} = editor;
|
|
1810
1814
|
async function updateEndTime() {
|
|
1811
|
-
console.log("updateEndTime");
|
|
1812
|
-
await renderEngine.value.nextTick();
|
|
1813
|
-
await renderEngine.value.nextTick();
|
|
1814
|
-
await renderEngine.value.nextTick();
|
|
1815
1815
|
await renderEngine.value.nextTick();
|
|
1816
1816
|
timeline.value.endTime = root.value ? getTimeRange(root.value).endTime : 0;
|
|
1817
1817
|
}
|
|
@@ -3542,7 +3542,18 @@ const _clipboard = definePlugin((editor, options) => {
|
|
|
3542
3542
|
return;
|
|
3543
3543
|
}
|
|
3544
3544
|
addElements(
|
|
3545
|
-
selection.value.map((v) =>
|
|
3545
|
+
selection.value.map((v) => {
|
|
3546
|
+
const el = v.toJSON();
|
|
3547
|
+
if (el.style) {
|
|
3548
|
+
if (el.style.left) {
|
|
3549
|
+
el.style.left += 20;
|
|
3550
|
+
}
|
|
3551
|
+
if (el.style.top) {
|
|
3552
|
+
el.style.top += 20;
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
return el;
|
|
3556
|
+
}),
|
|
3546
3557
|
{
|
|
3547
3558
|
parent: selection.value[0].parent,
|
|
3548
3559
|
index: selection.value[0].getIndex(),
|
|
@@ -3793,6 +3804,8 @@ const aliases = {
|
|
|
3793
3804
|
shape: "M8 17.95q.25.025.488.038T9 18t.513-.012t.487-.038V20h10V10h-2.05q.025-.25.038-.488T18 9t-.012-.513T17.95 8H20q.825 0 1.413.588T22 10v10q0 .825-.587 1.413T20 22H10q-.825 0-1.412-.587T8 20zM9 16q-2.925 0-4.962-2.037T2 9t2.038-4.962T9 2t4.963 2.038T16 9t-2.037 4.963T9 16m0-2q2.075 0 3.538-1.463T14 9t-1.463-3.537T9 4T5.463 5.463T4 9t1.463 3.538T9 14m0-5",
|
|
3794
3805
|
text: "m18.5 4l1.16 4.35l-.96.26c-.45-.87-.91-1.74-1.44-2.18C16.73 6 16.11 6 15.5 6H13v10.5c0 .5 0 1 .33 1.25c.34.25 1 .25 1.67.25v1H9v-1c.67 0 1.33 0 1.67-.25c.33-.25.33-.75.33-1.25V6H8.5c-.61 0-1.23 0-1.76.43c-.53.44-.99 1.31-1.44 2.18l-.96-.26L5.5 4z",
|
|
3795
3806
|
image: "M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-2h14V5H5zm1-2h12l-3.75-5l-3 4L9 13zm-1 2V5zm3.5-9q.625 0 1.063-.437T10 8.5t-.437-1.062T8.5 7t-1.062.438T7 8.5t.438 1.063T8.5 10",
|
|
3807
|
+
lottie: "M17 6c-2.8 0-4.4 2.8-5.9 5.5C9.9 13.8 8.7 16 7 16c-.6 0-1 .4-1 1s.4 1 1 1c2.8 0 4.4-2.8 5.9-5.5C14.1 10.2 15.3 8 17 8c.6 0 1-.4 1-1s-.4-1-1-1m2-4H5C3.3 2 2 3.3 2 5v14c0 1.7 1.3 3 3 3h14c1.7 0 3-1.3 3-3V5c0-1.7-1.3-3-3-3m1 17c0 .6-.4 1-1 1H5c-.6 0-1-.4-1-1V5c0-.6.4-1 1-1h14c.6 0 1 .4 1 1z",
|
|
3808
|
+
video: "M15 8v8H5V8zm1-2H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4V7a1 1 0 0 0-1-1",
|
|
3796
3809
|
lock: "M6 22q-.825 0-1.412-.587T4 20V10q0-.825.588-1.412T6 8h1V6q0-2.075 1.463-3.537T12 1t3.538 1.463T17 6v2h1q.825 0 1.413.588T20 10v10q0 .825-.587 1.413T18 22zm0-2h12V10H6zm6-3q.825 0 1.413-.587T14 15t-.587-1.412T12 13t-1.412.588T10 15t.588 1.413T12 17M9 8h6V6q0-1.25-.875-2.125T12 3t-2.125.875T9 6zM6 20V10z",
|
|
3797
3810
|
unlock: "M6 8h9V6q0-1.25-.875-2.125T12 3t-2.125.875T9 6H7q0-2.075 1.463-3.537T12 1t3.538 1.463T17 6v2h1q.825 0 1.413.588T20 10v10q0 .825-.587 1.413T18 22H6q-.825 0-1.412-.587T4 20V10q0-.825.588-1.412T6 8m0 12h12V10H6zm6-3q.825 0 1.413-.587T14 15t-.587-1.412T12 13t-1.412.588T10 15t.588 1.413T12 17m-6 3V10z",
|
|
3798
3811
|
visible: "M12 16q1.875 0 3.188-1.312T16.5 11.5t-1.312-3.187T12 7T8.813 8.313T7.5 11.5t1.313 3.188T12 16m0-1.8q-1.125 0-1.912-.788T9.3 11.5t.788-1.912T12 8.8t1.913.788t.787 1.912t-.787 1.913T12 14.2m0 4.8q-3.65 0-6.65-2.037T1 11.5q1.35-3.425 4.35-5.462T12 4t6.65 2.038T23 11.5q-1.35 3.425-4.35 5.463T12 19m0-2q2.825 0 5.188-1.487T20.8 11.5q-1.25-2.525-3.613-4.012T12 6T6.813 7.488T3.2 11.5q1.25 2.525 3.613 4.013T12 17",
|
|
@@ -4386,8 +4399,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
4386
4399
|
const editing = ref(false);
|
|
4387
4400
|
async function onDblclick() {
|
|
4388
4401
|
editing.value = true;
|
|
4389
|
-
await nextTick();
|
|
4390
4402
|
if (input.value) {
|
|
4403
|
+
await nextTick();
|
|
4391
4404
|
input.value.focus();
|
|
4392
4405
|
input.value.select();
|
|
4393
4406
|
}
|
|
@@ -4413,7 +4426,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
4413
4426
|
}, [
|
|
4414
4427
|
withDirectives(createElementVNode("div", {
|
|
4415
4428
|
class: "mce-frame__name",
|
|
4416
|
-
onDblclick,
|
|
4429
|
+
onDblclick: withModifiers(onDblclick, ["prevent", "stop"]),
|
|
4417
4430
|
onPointerdown,
|
|
4418
4431
|
onPointerenter: _cache[2] || (_cache[2] = ($event) => !unref(state) && (hoverElement.value = frame.value)),
|
|
4419
4432
|
onPointerleave: _cache[3] || (_cache[3] = ($event) => !unref(state) && (hoverElement.value = void 0))
|
|
@@ -5181,6 +5194,10 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5181
5194
|
return "$frame";
|
|
5182
5195
|
} else if (node.children.filter(isElement).length) {
|
|
5183
5196
|
return "$group";
|
|
5197
|
+
} else if (node instanceof Lottie2D) {
|
|
5198
|
+
return "$lottie";
|
|
5199
|
+
} else if (node instanceof Video2D) {
|
|
5200
|
+
return "$video";
|
|
5184
5201
|
} else if (isElement(node)) {
|
|
5185
5202
|
if (node.foreground.isValid() && node.foreground.image) {
|
|
5186
5203
|
return "$image";
|
|
@@ -5197,8 +5214,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
5197
5214
|
if (!value) {
|
|
5198
5215
|
if (isFrame(node)) {
|
|
5199
5216
|
return t("frame");
|
|
5200
|
-
} else if (node.children.length) {
|
|
5217
|
+
} else if (node.children.filter(isElement).length) {
|
|
5201
5218
|
value = t("group");
|
|
5219
|
+
} else if (node instanceof Lottie2D) {
|
|
5220
|
+
value = t("lottie");
|
|
5221
|
+
} else if (node instanceof Video2D) {
|
|
5222
|
+
value = t("video");
|
|
5202
5223
|
} else if (isElement(node)) {
|
|
5203
5224
|
if (node.foreground.isValid() && node.foreground.image) {
|
|
5204
5225
|
value = t("image");
|
|
@@ -13023,10 +13044,38 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
13023
13044
|
},
|
|
13024
13045
|
setup(__props) {
|
|
13025
13046
|
const props = __props;
|
|
13047
|
+
const blocks = computed(() => {
|
|
13048
|
+
const node = props.node;
|
|
13049
|
+
if (node instanceof Element2D) {
|
|
13050
|
+
return node.children.filter((child) => child instanceof Animation).map((anim) => {
|
|
13051
|
+
const box = {
|
|
13052
|
+
left: anim.delay / props.msPerPx,
|
|
13053
|
+
top: 0,
|
|
13054
|
+
width: anim.duration / props.msPerPx
|
|
13055
|
+
};
|
|
13056
|
+
if (box.width) {
|
|
13057
|
+
box.width = `${box.width}px`;
|
|
13058
|
+
} else {
|
|
13059
|
+
box.width = "100%";
|
|
13060
|
+
}
|
|
13061
|
+
return {
|
|
13062
|
+
name: anim.name,
|
|
13063
|
+
style: {
|
|
13064
|
+
width: box.width,
|
|
13065
|
+
transform: `matrix(1, 0, 0, 1, ${box.left}, ${box.top})`
|
|
13066
|
+
}
|
|
13067
|
+
};
|
|
13068
|
+
});
|
|
13069
|
+
}
|
|
13070
|
+
return [];
|
|
13071
|
+
});
|
|
13026
13072
|
const style = computed(() => {
|
|
13027
|
-
const
|
|
13028
|
-
box
|
|
13029
|
-
|
|
13073
|
+
const node = props.node;
|
|
13074
|
+
const box = {
|
|
13075
|
+
left: node.delay / props.msPerPx,
|
|
13076
|
+
top: 0,
|
|
13077
|
+
width: node.duration / props.msPerPx
|
|
13078
|
+
};
|
|
13030
13079
|
if (box.width) {
|
|
13031
13080
|
box.width = `${box.width}px`;
|
|
13032
13081
|
} else {
|
|
@@ -13040,11 +13089,18 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
13040
13089
|
return (_ctx, _cache) => {
|
|
13041
13090
|
return openBlock(), createElementBlock("div", {
|
|
13042
13091
|
class: normalizeClass(["mce-segment", [
|
|
13043
|
-
`mce-segment--${__props.node.meta.inEditorIs}`,
|
|
13092
|
+
`mce-segment--${(__props.node.meta.inEditorIs ?? "none").toLowerCase()}`,
|
|
13044
13093
|
__props.active && `mce-segment--active`
|
|
13045
13094
|
]]),
|
|
13046
13095
|
style: normalizeStyle(style.value)
|
|
13047
13096
|
}, [
|
|
13097
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(blocks.value, (block, index) => {
|
|
13098
|
+
return openBlock(), createElementBlock("div", {
|
|
13099
|
+
key: index,
|
|
13100
|
+
class: "mce-segment__block",
|
|
13101
|
+
style: normalizeStyle(block.style)
|
|
13102
|
+
}, toDisplayString(block.name), 5);
|
|
13103
|
+
}), 128)),
|
|
13048
13104
|
__props.active ? (openBlock(), createElementBlock("div", _hoisted_1$8)) : createCommentVNode("", true),
|
|
13049
13105
|
createElementVNode("span", _hoisted_2$4, toDisplayString(props.node.name), 1),
|
|
13050
13106
|
__props.active ? (openBlock(), createElementBlock("div", _hoisted_3$4)) : createCommentVNode("", true)
|
package/dist/locale/en.d.ts
CHANGED
package/dist/locale/zh-Hans.d.ts
CHANGED