@pie-element/drawing-response 12.1.2-next.0 → 12.1.2-next.2
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/author/root.js +12 -12
- package/dist/browser/{MenuItem-Bi9BhmXG.js → MenuItem-N0xdzWSs.js} +2498 -3468
- package/dist/browser/MenuItem-N0xdzWSs.js.map +1 -0
- package/dist/browser/author/index.js +7571 -7756
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/browser-kkT1XVKw.js +13 -4
- package/dist/browser/delivery/index.js +9 -9
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/delivery/drawing-response/drawable-main.js +43 -45
- package/dist/delivery/index.js +7 -7
- package/dist/index.iife.js +40 -40
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +12 -9
- package/dist/browser/MenuItem-Bi9BhmXG.js.map +0 -1
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_apply.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFlatten.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseSlice.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnset.js +0 -19
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_customOmitClone.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_flatRest.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isFlattenable.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_parent.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/flatten.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isPlainObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/last.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/memoize.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/omit.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toString.js +0 -7
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import i from "
|
|
6
|
-
import a from "./factory.js";
|
|
7
|
-
import o from "react";
|
|
1
|
+
import e from "./button.js";
|
|
2
|
+
import t from "./drawable-image.js";
|
|
3
|
+
import n from "./factory.js";
|
|
4
|
+
import r from "react";
|
|
5
|
+
import { cloneDeep as i, isEqual as a, omit as o } from "@pie-element/shared-lodash";
|
|
8
6
|
import s from "prop-types";
|
|
9
7
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
10
8
|
import { styled as u } from "@mui/material/styles";
|
|
@@ -28,7 +26,7 @@ var g = h(p, "Stage"), _ = h(f, "Layer"), { translator: v } = d, y = u("div")({
|
|
|
28
26
|
marginTop: -43,
|
|
29
27
|
marginRight: 10,
|
|
30
28
|
position: "absolute"
|
|
31
|
-
}), S = class extends
|
|
29
|
+
}), S = class extends r.Component {
|
|
32
30
|
constructor(e) {
|
|
33
31
|
super(e), this.state = {
|
|
34
32
|
drawables: [],
|
|
@@ -39,35 +37,35 @@ var g = h(p, "Stage"), _ = h(f, "Layer"), { translator: v } = d, y = u("div")({
|
|
|
39
37
|
componentWillUnmount() {
|
|
40
38
|
this.stage = null, this.layer = null;
|
|
41
39
|
}
|
|
42
|
-
UNSAFE_componentWillReceiveProps(
|
|
43
|
-
if (
|
|
44
|
-
let { TextEntry:
|
|
45
|
-
if (
|
|
46
|
-
let s = e
|
|
47
|
-
if (JSON.stringify(
|
|
48
|
-
let
|
|
49
|
-
this.setState({ drawables:
|
|
40
|
+
UNSAFE_componentWillReceiveProps(e) {
|
|
41
|
+
if (e.session) {
|
|
42
|
+
let { TextEntry: t } = e, { drawables: r } = this.state;
|
|
43
|
+
if (e.session.drawables) {
|
|
44
|
+
let s = i(e.session.drawables);
|
|
45
|
+
if (JSON.stringify(r) !== JSON.stringify((s || []).map((e) => o(e, "type")))) {
|
|
46
|
+
let t = e.session.drawables;
|
|
47
|
+
this.setState({ drawables: t.map((e) => n(e.type, e)) });
|
|
50
48
|
}
|
|
51
|
-
t
|
|
49
|
+
a(t.all.map((e) => ({
|
|
52
50
|
...e,
|
|
53
|
-
...
|
|
54
|
-
value:
|
|
55
|
-
})),
|
|
51
|
+
...t[`text_${e.id}`] && t[`text_${e.id}`].attrs,
|
|
52
|
+
value: t[`textarea_${e.id}`] && t[`textarea_${e.id}`].value
|
|
53
|
+
})), e.session.texts) || t.setAll(e.session.texts || []);
|
|
56
54
|
}
|
|
57
55
|
} else this.handleSessionChange();
|
|
58
56
|
}
|
|
59
57
|
handleSessionChange = () => {
|
|
60
|
-
let { onSessionChange: e, session:
|
|
61
|
-
width:
|
|
62
|
-
drawables:
|
|
63
|
-
texts:
|
|
58
|
+
let { onSessionChange: e, session: t, TextEntry: n, drawableDimensions: r } = this.props, { drawables: i } = this.state, o = {
|
|
59
|
+
width: r.width,
|
|
60
|
+
drawables: i.map((e) => e.toJson()),
|
|
61
|
+
texts: n.all.map((e) => ({
|
|
64
62
|
...e,
|
|
65
|
-
...
|
|
66
|
-
value:
|
|
63
|
+
...n[`text_${e.id}`] && n[`text_${e.id}`].attrs,
|
|
64
|
+
value: n[`textarea_${e.id}`] && n[`textarea_${e.id}`].value
|
|
67
65
|
}))
|
|
68
66
|
};
|
|
69
|
-
|
|
70
|
-
...
|
|
67
|
+
a(o, t) || e({
|
|
68
|
+
...t,
|
|
71
69
|
...o
|
|
72
70
|
});
|
|
73
71
|
};
|
|
@@ -75,14 +73,14 @@ var g = h(p, "Stage"), _ = h(f, "Layer"), { translator: v } = d, y = u("div")({
|
|
|
75
73
|
onMouseOutElement = () => this.setState({ isOver: !1 });
|
|
76
74
|
handleMouseDown = (e) => {
|
|
77
75
|
document.body.style.overflow = "hidden";
|
|
78
|
-
let { newDrawable: t, textIsSelected:
|
|
79
|
-
if (t.length === 0 && !
|
|
76
|
+
let { newDrawable: t, textIsSelected: r } = this.state, { toolActive: i, fillColor: a, outlineColor: o, scale: s } = this.props;
|
|
77
|
+
if (t.length === 0 && !r) {
|
|
80
78
|
let t = e.target.getStage();
|
|
81
79
|
if (!t) return;
|
|
82
|
-
let { x:
|
|
83
|
-
startx:
|
|
80
|
+
let { x: r, y: c } = t.getPointerPosition(), l = n(i.type, {
|
|
81
|
+
startx: r / s,
|
|
84
82
|
starty: c / s,
|
|
85
|
-
fillColor:
|
|
83
|
+
fillColor: a,
|
|
86
84
|
outlineColor: o,
|
|
87
85
|
createdAt: /* @__PURE__ */ new Date()
|
|
88
86
|
});
|
|
@@ -126,11 +124,11 @@ var g = h(p, "Stage"), _ = h(f, "Layer"), { translator: v } = d, y = u("div")({
|
|
|
126
124
|
};
|
|
127
125
|
toggleTextSelected = (e) => this.setState({ textIsSelected: e });
|
|
128
126
|
render() {
|
|
129
|
-
let { disabled:
|
|
130
|
-
draggable: w && !
|
|
131
|
-
disabled:
|
|
127
|
+
let { disabled: n, drawableDimensions: r, fillColor: i, imageDimensions: a, imageUrl: o, paintColor: s, outlineColor: u, TextEntry: d, backgroundImageEnabled: f = !0, toolActive: { type: p }, scale: m, language: h } = this.props, { isOver: S, newDrawable: C } = this.state, w = p === "Select", T = p === "PaintBucket", E = [...this.state.drawables, ...this.state.newDrawable], D = {
|
|
128
|
+
draggable: w && !n,
|
|
129
|
+
disabled: n,
|
|
132
130
|
paint: T,
|
|
133
|
-
fillColor:
|
|
131
|
+
fillColor: i,
|
|
134
132
|
forceUpdate: () => this.setState({ updatedAt: /* @__PURE__ */ new Date() }),
|
|
135
133
|
paintColor: s,
|
|
136
134
|
outlineColor: u,
|
|
@@ -141,23 +139,23 @@ var g = h(p, "Stage"), _ = h(f, "Layer"), { translator: v } = d, y = u("div")({
|
|
|
141
139
|
onMouseOutElement: this.onMouseOutElement,
|
|
142
140
|
scale: m
|
|
143
141
|
}, O = {};
|
|
144
|
-
|
|
142
|
+
n || (O = {
|
|
145
143
|
onMouseUp: this.handleMouseUp,
|
|
146
144
|
onTouchEnd: this.handleMouseUp,
|
|
147
145
|
onMouseMove: this.handleMouseMove,
|
|
148
146
|
onTouchMove: this.handleMouseMove
|
|
149
147
|
}, w || (O.onMouseDown = this.handleMouseDown, O.onTouchStart = this.handleMouseDown));
|
|
150
148
|
let k = a?.height * m, A = a?.width * m;
|
|
151
|
-
return /* @__PURE__ */ l(y, { children: [/* @__PURE__ */ l(x, { children: [/* @__PURE__ */ c(
|
|
152
|
-
disabled:
|
|
149
|
+
return /* @__PURE__ */ l(y, { children: [/* @__PURE__ */ l(x, { children: [/* @__PURE__ */ c(e, {
|
|
150
|
+
disabled: n,
|
|
153
151
|
onClick: this.handleUndo,
|
|
154
152
|
label: v.t("common:undo", { lng: h })
|
|
155
|
-
}), /* @__PURE__ */ c(
|
|
156
|
-
disabled:
|
|
153
|
+
}), /* @__PURE__ */ c(e, {
|
|
154
|
+
disabled: n,
|
|
157
155
|
onClick: this.handleClearAll,
|
|
158
156
|
label: v.t("common:clearAll", { lng: h })
|
|
159
157
|
})] }), /* @__PURE__ */ l(b, { children: [
|
|
160
|
-
f && o && /* @__PURE__ */ c(
|
|
158
|
+
f && o && /* @__PURE__ */ c(t, {
|
|
161
159
|
dimensions: {
|
|
162
160
|
height: k,
|
|
163
161
|
width: A
|
|
@@ -177,8 +175,8 @@ var g = h(p, "Stage"), _ = h(f, "Layer"), { translator: v } = d, y = u("div")({
|
|
|
177
175
|
scaleX: m,
|
|
178
176
|
scaleY: m,
|
|
179
177
|
ref: (e) => this.stage = e,
|
|
180
|
-
height:
|
|
181
|
-
width:
|
|
178
|
+
height: r.height,
|
|
179
|
+
width: r.width,
|
|
182
180
|
...O,
|
|
183
181
|
children: /* @__PURE__ */ l(_, {
|
|
184
182
|
ref: (e) => this.layer = e,
|
package/dist/delivery/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "react";
|
|
4
|
-
import {
|
|
1
|
+
import e from "./drawing-response/index.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import { createRoot as n } from "react-dom/client";
|
|
4
|
+
import { isEmpty as r } from "@pie-element/shared-lodash";
|
|
5
5
|
import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
|
|
6
6
|
import { ModelSetEvent as a, SessionChangedEvent as o } from "@pie-element/shared-player-events";
|
|
7
7
|
//#region src/delivery/index.ts
|
|
@@ -13,7 +13,7 @@ var s = class extends HTMLElement {
|
|
|
13
13
|
this._model = e, this.dispatchEvent(new a(this.tagName.toLowerCase(), this.isComplete(), !!this._model)), this._render();
|
|
14
14
|
}
|
|
15
15
|
isComplete() {
|
|
16
|
-
return this._session && (!
|
|
16
|
+
return this._session && (!r(this._session.drawables) || !r(this._session.texts));
|
|
17
17
|
}
|
|
18
18
|
sessionChanged = (e) => {
|
|
19
19
|
this._session.drawables = e.drawables, this._session.texts = e.texts, this._session.width = e.width, this.dispatchEvent(new o(this.tagName.toLowerCase(), this.isComplete())), this._render();
|
|
@@ -29,12 +29,12 @@ var s = class extends HTMLElement {
|
|
|
29
29
|
}
|
|
30
30
|
_render() {
|
|
31
31
|
if (this._model && this._session) {
|
|
32
|
-
let
|
|
32
|
+
let r = t.createElement(e, {
|
|
33
33
|
model: this._model,
|
|
34
34
|
session: this._session,
|
|
35
35
|
onSessionChange: this.sessionChanged
|
|
36
36
|
});
|
|
37
|
-
this._root ||=
|
|
37
|
+
this._root ||= n(this), this._root.render(r), queueMicrotask(() => {
|
|
38
38
|
i(this);
|
|
39
39
|
});
|
|
40
40
|
}
|