@pie-lib/mask-markup 3.0.4-next.31 → 3.0.4-next.32
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/_virtual/_rolldown/runtime.js +4 -0
- package/dist/choices/choice.d.ts +24 -0
- package/dist/choices/choice.js +77 -0
- package/dist/choices/index.d.ts +25 -0
- package/dist/choices/index.js +49 -0
- package/dist/componentize.d.ts +12 -0
- package/dist/componentize.js +4 -0
- package/dist/components/blank.d.ts +39 -0
- package/dist/components/blank.js +240 -0
- package/dist/components/correct-input.d.ts +11 -0
- package/dist/components/dropdown.d.ts +37 -0
- package/dist/components/dropdown.js +320 -0
- package/dist/components/input.d.ts +37 -0
- package/dist/constructed-response.d.ts +44 -0
- package/dist/constructed-response.js +55 -0
- package/dist/customizable.d.ts +43 -0
- package/dist/customizable.js +8 -0
- package/dist/drag-in-the-blank.d.ts +37 -0
- package/dist/drag-in-the-blank.js +164 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +7 -0
- package/dist/inline-dropdown.d.ts +44 -0
- package/dist/inline-dropdown.js +24 -0
- package/dist/mask.d.ts +30 -0
- package/dist/mask.js +99 -0
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js +17 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js +9 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js +26 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js +24 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js +32 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js +29 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js +14 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js +8 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js +12 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js +10 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js +10 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js +55 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js +16 -0
- package/dist/serialization.d.ts +34 -0
- package/dist/serialization.js +132 -0
- package/dist/with-mask.d.ts +55 -0
- package/dist/with-mask.js +45 -0
- package/package.json +39 -20
- package/CHANGELOG.json +0 -17
- package/CHANGELOG.md +0 -1256
- package/LICENSE.md +0 -5
- package/lib/choices/choice.js +0 -116
- package/lib/choices/choice.js.map +0 -1
- package/lib/choices/index.js +0 -103
- package/lib/choices/index.js.map +0 -1
- package/lib/componentize.js +0 -21
- package/lib/componentize.js.map +0 -1
- package/lib/components/blank.js +0 -371
- package/lib/components/blank.js.map +0 -1
- package/lib/components/correct-input.js +0 -94
- package/lib/components/correct-input.js.map +0 -1
- package/lib/components/dropdown.js +0 -483
- package/lib/components/dropdown.js.map +0 -1
- package/lib/components/input.js +0 -50
- package/lib/components/input.js.map +0 -1
- package/lib/constructed-response.js +0 -101
- package/lib/constructed-response.js.map +0 -1
- package/lib/customizable.js +0 -42
- package/lib/customizable.js.map +0 -1
- package/lib/drag-in-the-blank.js +0 -254
- package/lib/drag-in-the-blank.js.map +0 -1
- package/lib/index.js +0 -55
- package/lib/index.js.map +0 -1
- package/lib/inline-dropdown.js +0 -40
- package/lib/inline-dropdown.js.map +0 -1
- package/lib/mask.js +0 -198
- package/lib/mask.js.map +0 -1
- package/lib/serialization.js +0 -261
- package/lib/serialization.js.map +0 -1
- package/lib/with-mask.js +0 -97
- package/lib/with-mask.js.map +0 -1
- package/src/__tests__/drag-in-the-blank.test.js +0 -111
- package/src/__tests__/index.test.js +0 -38
- package/src/__tests__/mask.test.js +0 -381
- package/src/__tests__/serialization.test.js +0 -54
- package/src/__tests__/utils.js +0 -1
- package/src/__tests__/with-mask.test.js +0 -76
- package/src/choices/__tests__/index.test.js +0 -75
- package/src/choices/choice.jsx +0 -97
- package/src/choices/index.jsx +0 -64
- package/src/componentize.js +0 -13
- package/src/components/__tests__/blank.test.js +0 -199
- package/src/components/__tests__/correct-input.test.js +0 -90
- package/src/components/__tests__/dropdown.test.js +0 -129
- package/src/components/__tests__/input.test.js +0 -102
- package/src/components/blank.jsx +0 -386
- package/src/components/correct-input.jsx +0 -82
- package/src/components/dropdown.jsx +0 -423
- package/src/components/input.jsx +0 -48
- package/src/constructed-response.jsx +0 -87
- package/src/customizable.jsx +0 -34
- package/src/drag-in-the-blank.jsx +0 -241
- package/src/index.js +0 -16
- package/src/inline-dropdown.jsx +0 -29
- package/src/mask.jsx +0 -172
- package/src/serialization.js +0 -260
- package/src/with-mask.jsx +0 -75
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { __commonJSMin as e } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_cssUnitless as t } from "./cssUnitless.js";
|
|
3
|
+
import { require_prefixInfo as n } from "./prefixInfo.js";
|
|
4
|
+
import { require_camelize as r } from "./stringUtils/camelize.js";
|
|
5
|
+
import { require_hyphenate as i } from "./stringUtils/hyphenate.js";
|
|
6
|
+
import { require_cssPrefix as a } from "./cssPrefix.js";
|
|
7
|
+
import { require_hasOwn as o } from "./hasOwn.js";
|
|
8
|
+
import { require_isObject as s } from "./isObject.js";
|
|
9
|
+
import { require_isFunction as c } from "./isFunction.js";
|
|
10
|
+
//#region ../../../node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js
|
|
11
|
+
var l = /* @__PURE__ */ e(((e, l) => {
|
|
12
|
+
n();
|
|
13
|
+
var u = a(), d = i(), f = r(), p = o(), m = s(), h = c(), g = function(e, t, n, r) {
|
|
14
|
+
u(t).forEach(function(t) {
|
|
15
|
+
e[r ? r(t) : t] = n;
|
|
16
|
+
});
|
|
17
|
+
}, _ = function(e) {
|
|
18
|
+
e = (e || "").split(";");
|
|
19
|
+
var t = {};
|
|
20
|
+
return e.forEach(function(e) {
|
|
21
|
+
var n = e.split(":");
|
|
22
|
+
n.length == 2 && (t[n[0].trim()] = n[1].trim());
|
|
23
|
+
}), t;
|
|
24
|
+
}, v = { cssUnitless: t() }, y = function(e, t, n, r) {
|
|
25
|
+
typeof e == "string" && (e = _(e)), t ||= v, t.cssUnitless = t.cssUnitless || v.cssUnitless, r ||= {};
|
|
26
|
+
var i = t.scope || {}, a = t.addUnits == null ? i && i.addUnits != null ? i.addUnits : !0 : t.addUnits, o = (t.cssUnitless == null ? i ? i.cssUnitless : null : t.cssUnitless) || {}, s = (t.cssUnit || i ? i.cssUnit : null) || "px", c = t.prefixProperties || (i ? i.prefixProperties : null) || {}, l = t.camelize ? f : d, u, b, x, S, C, w, T, E;
|
|
27
|
+
for (x in e) if (p(e, x)) {
|
|
28
|
+
if (S = e[x], b = d(n ? n + x : x), u = !1, E = !1, h(S) && (T = S.call(i || e, S, x, b, e), m(T) && T.value != null ? (S = T.value, E = T.prefix, b = T.name ? d(T.name) : b) : S = T), C = typeof S, w = C == "number" || C == "string" && S != "" && S * 1 == S, S == null || b == null || b === "") continue;
|
|
29
|
+
if ((w || C == "string") && (u = !0), !u && S.value != null && S.prefix && (u = !0, E = S.prefix, S = S.value), u) {
|
|
30
|
+
if (E ||= !!c[b], w && (S = a && !(b in o) ? S + s : S + ""), (b == "border" || !b.indexOf("border") && !~b.indexOf("radius") && !~b.indexOf("width")) && w && (b += "-width"), !b.indexOf("border-radius-") && (b.replace(/border(-radius)(-(.*))/, function(e, t, n) {
|
|
31
|
+
var r = {
|
|
32
|
+
"-top": ["-top-left", "-top-right"],
|
|
33
|
+
"-left": ["-top-left", "-bottom-left"],
|
|
34
|
+
"-right": ["-top-right", "-bottom-right"],
|
|
35
|
+
"-bottom": ["-bottom-left", "-bottom-right"]
|
|
36
|
+
};
|
|
37
|
+
n in r ? (b = [], r[n].forEach(function(e) {
|
|
38
|
+
b.push("border" + e + t);
|
|
39
|
+
})) : b = "border" + n + t;
|
|
40
|
+
}), Array.isArray(b))) {
|
|
41
|
+
b.forEach(function(e) {
|
|
42
|
+
E ? g(r, e, S, l) : r[l(e)] = S;
|
|
43
|
+
});
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
E ? g(r, b, S, l) : r[l(b)] = S;
|
|
47
|
+
} else y(S, t, b + "-", r);
|
|
48
|
+
}
|
|
49
|
+
return r;
|
|
50
|
+
};
|
|
51
|
+
l.exports = y;
|
|
52
|
+
}));
|
|
53
|
+
//#endregion
|
|
54
|
+
export default l();
|
|
55
|
+
export { l as require_toStyleObject };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __commonJSMin as e } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_hasOwn as t } from "./hasOwn.js";
|
|
3
|
+
import { require_toStyleObject as n } from "./toStyleObject.js";
|
|
4
|
+
//#region ../../../node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js
|
|
5
|
+
var r = /* @__PURE__ */ e(((e, r) => {
|
|
6
|
+
var i = n(), a = t();
|
|
7
|
+
r.exports = function(e, t) {
|
|
8
|
+
e = i(e, t);
|
|
9
|
+
var n = [], r;
|
|
10
|
+
for (r in e) a(e, r) && n.push(r + ": " + e[r]);
|
|
11
|
+
return n.join("; ");
|
|
12
|
+
};
|
|
13
|
+
}));
|
|
14
|
+
//#endregion
|
|
15
|
+
export default r();
|
|
16
|
+
export { r as require_toStyleString };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/serialization.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
export declare const parseStyleString: (s: any) => {};
|
|
10
|
+
export declare const reactAttributes: (o: any) => any;
|
|
11
|
+
/**
|
|
12
|
+
* Tags to marks.
|
|
13
|
+
*
|
|
14
|
+
* @type {Object}
|
|
15
|
+
*/
|
|
16
|
+
export declare const MARK_TAGS: {
|
|
17
|
+
b: string;
|
|
18
|
+
em: string;
|
|
19
|
+
u: string;
|
|
20
|
+
s: string;
|
|
21
|
+
code: string;
|
|
22
|
+
strong: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Deserialize HTML string to Slate JSON format
|
|
26
|
+
*/
|
|
27
|
+
export declare const deserialize: (htmlString: any) => {
|
|
28
|
+
object: string;
|
|
29
|
+
document: {
|
|
30
|
+
object: string;
|
|
31
|
+
data: {};
|
|
32
|
+
nodes: any;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { require_to_style as e } from "./node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js";
|
|
2
|
+
import t from "debug";
|
|
3
|
+
//#region src/serialization.ts
|
|
4
|
+
var n = e(), r = t("@pie-lib:mask-markup:serialization"), i = ["span"], a = [
|
|
5
|
+
"em",
|
|
6
|
+
"strong",
|
|
7
|
+
"u"
|
|
8
|
+
], o = 3, s = 8, c = 1, l = (e) => {
|
|
9
|
+
if (!e.attributes || e.attributes.length <= 0) return;
|
|
10
|
+
let t = {}, n;
|
|
11
|
+
for (n = 0; n < e.attributes.length; n++) {
|
|
12
|
+
let r = e.attributes[n];
|
|
13
|
+
t[r.name] = r.value;
|
|
14
|
+
}
|
|
15
|
+
return t;
|
|
16
|
+
}, u = (e) => i.includes(e) ? "inline" : a.includes(e) ? "mark" : "block", d = (e) => {
|
|
17
|
+
let t = /([\w-]*)\s*:\s*([^;]*)/g, n, r = {};
|
|
18
|
+
for (; n = t.exec(e);) r[n[1]] = n[2].trim();
|
|
19
|
+
return r;
|
|
20
|
+
}, f = (e) => (0, n.object)(e, {
|
|
21
|
+
camelize: !0,
|
|
22
|
+
addUnits: !1
|
|
23
|
+
}), p = (e, t) => f(d(e.getAttribute(t))), m = (e, t, n) => {
|
|
24
|
+
let r = e.getAttribute(n);
|
|
25
|
+
return delete t.class, r;
|
|
26
|
+
}, h = (e) => (t, n) => {
|
|
27
|
+
if (!e.getAttribute) return t;
|
|
28
|
+
if (e.getAttribute(n)) switch (n) {
|
|
29
|
+
case "style":
|
|
30
|
+
t.style = p(e, n);
|
|
31
|
+
break;
|
|
32
|
+
case "class":
|
|
33
|
+
t.className = m(e, t, n);
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
t[n] = e.getAttribute(n);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
return t;
|
|
40
|
+
}, g = [
|
|
41
|
+
"border",
|
|
42
|
+
"class",
|
|
43
|
+
"style"
|
|
44
|
+
], _ = {
|
|
45
|
+
b: "bold",
|
|
46
|
+
em: "italic",
|
|
47
|
+
u: "underline",
|
|
48
|
+
s: "strikethrough",
|
|
49
|
+
code: "code",
|
|
50
|
+
strong: "strong"
|
|
51
|
+
}, v = (e, t = []) => {
|
|
52
|
+
if (e.nodeType === s) return null;
|
|
53
|
+
if (e.nodeType === o) {
|
|
54
|
+
let n = { text: e.textContent };
|
|
55
|
+
return t.length > 0 && (n.marks = t.map((e) => ({
|
|
56
|
+
type: e,
|
|
57
|
+
data: void 0
|
|
58
|
+
}))), {
|
|
59
|
+
object: "text",
|
|
60
|
+
leaves: [n]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (e.nodeType === c) {
|
|
64
|
+
let n = e.tagName.toLowerCase(), i = _[n];
|
|
65
|
+
if (i) return r("[deserialize] mark: ", i), {
|
|
66
|
+
_flatten: !0,
|
|
67
|
+
nodes: y(e.childNodes, [...t, i])
|
|
68
|
+
};
|
|
69
|
+
if (n === "math") return {
|
|
70
|
+
isMath: !0,
|
|
71
|
+
nodes: [e]
|
|
72
|
+
};
|
|
73
|
+
let a = l(e) || {};
|
|
74
|
+
n === "audio" && a.controls === "" && (a.controls = !0);
|
|
75
|
+
let o = g.reduce(h(e), { ...a }), s = u(n), c = y(e.childNodes, t);
|
|
76
|
+
return {
|
|
77
|
+
object: s,
|
|
78
|
+
type: n,
|
|
79
|
+
data: {
|
|
80
|
+
dataset: { ...e.dataset },
|
|
81
|
+
attributes: { ...o }
|
|
82
|
+
},
|
|
83
|
+
nodes: c
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}, y = (e, t = []) => {
|
|
88
|
+
let n = [];
|
|
89
|
+
for (let r = 0; r < e.length; r++) {
|
|
90
|
+
let i = v(e[r], t);
|
|
91
|
+
i !== null && (i._flatten && i.nodes ? n.push(...i.nodes) : n.push(i));
|
|
92
|
+
}
|
|
93
|
+
return n;
|
|
94
|
+
}, b = (e) => {
|
|
95
|
+
if (!e || !e.trim()) return {
|
|
96
|
+
object: "value",
|
|
97
|
+
document: {
|
|
98
|
+
object: "document",
|
|
99
|
+
data: {},
|
|
100
|
+
nodes: [{
|
|
101
|
+
object: "block",
|
|
102
|
+
type: "span",
|
|
103
|
+
data: {},
|
|
104
|
+
isVoid: !1,
|
|
105
|
+
nodes: []
|
|
106
|
+
}]
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
let t = y(new DOMParser().parseFromString(e, "text/html").body.childNodes);
|
|
110
|
+
return !t.some((e) => e.object === "block" || e.object === "inline") && t.length > 0 && (t = [{
|
|
111
|
+
object: "block",
|
|
112
|
+
type: "span",
|
|
113
|
+
data: {},
|
|
114
|
+
isVoid: !1,
|
|
115
|
+
nodes: t
|
|
116
|
+
}]), t.length === 0 && (t = [{
|
|
117
|
+
object: "block",
|
|
118
|
+
type: "span",
|
|
119
|
+
data: {},
|
|
120
|
+
isVoid: !1,
|
|
121
|
+
nodes: []
|
|
122
|
+
}]), {
|
|
123
|
+
object: "value",
|
|
124
|
+
document: {
|
|
125
|
+
object: "document",
|
|
126
|
+
data: {},
|
|
127
|
+
nodes: t
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
//#endregion
|
|
132
|
+
export { _ as MARK_TAGS, b as deserialize };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/with-mask.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare const buildLayoutFromMarkup: (markup: any, type: any) => {
|
|
12
|
+
object: string;
|
|
13
|
+
data: {};
|
|
14
|
+
nodes: any;
|
|
15
|
+
};
|
|
16
|
+
export declare const withMask: (type: any, renderChildren: any) => {
|
|
17
|
+
new (props: any): {
|
|
18
|
+
componentDidUpdate(prevProps: any): void;
|
|
19
|
+
render(): React.JSX.Element;
|
|
20
|
+
context: unknown;
|
|
21
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
22
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
23
|
+
readonly props: Readonly<{}>;
|
|
24
|
+
state: Readonly<{}>;
|
|
25
|
+
refs: {
|
|
26
|
+
[key: string]: React.ReactInstance;
|
|
27
|
+
};
|
|
28
|
+
componentDidMount?(): void;
|
|
29
|
+
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
30
|
+
componentWillUnmount?(): void;
|
|
31
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
32
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
33
|
+
componentWillMount?(): void;
|
|
34
|
+
UNSAFE_componentWillMount?(): void;
|
|
35
|
+
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
36
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
37
|
+
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
38
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
39
|
+
};
|
|
40
|
+
propTypes: {
|
|
41
|
+
/**
|
|
42
|
+
* At the start we'll probably work with markup
|
|
43
|
+
*/
|
|
44
|
+
markup: PropTypes.Requireable<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Once we start authoring, it may make sense for use to us layout, which will be a simple js object that maps to `slate.Value`.
|
|
47
|
+
*/
|
|
48
|
+
layout: PropTypes.Requireable<object>;
|
|
49
|
+
value: PropTypes.Requireable<object>;
|
|
50
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
|
+
customMarkMarkupComponent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
52
|
+
elementType: PropTypes.Requireable<string>;
|
|
53
|
+
};
|
|
54
|
+
contextType?: React.Context<any> | undefined;
|
|
55
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { deserialize as e } from "./serialization.js";
|
|
2
|
+
import t from "./mask.js";
|
|
3
|
+
import n from "./componentize.js";
|
|
4
|
+
import r from "react";
|
|
5
|
+
import i from "prop-types";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
//#region src/with-mask.tsx
|
|
8
|
+
var o = (t, r) => {
|
|
9
|
+
let { markup: i } = n(t, r);
|
|
10
|
+
return e(i).document;
|
|
11
|
+
}, s = (e, n) => class extends r.Component {
|
|
12
|
+
static propTypes = {
|
|
13
|
+
markup: i.string,
|
|
14
|
+
layout: i.object,
|
|
15
|
+
value: i.object,
|
|
16
|
+
onChange: i.func,
|
|
17
|
+
customMarkMarkupComponent: i.func,
|
|
18
|
+
elementType: i.string
|
|
19
|
+
};
|
|
20
|
+
constructor(e) {
|
|
21
|
+
super(e), this.containerRef = r.createRef();
|
|
22
|
+
}
|
|
23
|
+
componentDidUpdate(e) {
|
|
24
|
+
if (this.props.markup !== e.markup) {
|
|
25
|
+
let e = this.containerRef.current;
|
|
26
|
+
(e && e.querySelectorAll("[data-latex][data-math-handled=\"true\"]") || []).forEach((e) => {
|
|
27
|
+
let t = e.querySelector("mjx-container");
|
|
28
|
+
t && e.removeChild(t), e.innerHTML = e.getAttribute("data-raw"), e.removeAttribute("data-math-handled");
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
let { markup: r, layout: i, value: s, onChange: c, elementType: l } = this.props, u = i || o(r, e);
|
|
34
|
+
return /* @__PURE__ */ a(t, {
|
|
35
|
+
containerRef: this.containerRef,
|
|
36
|
+
elementType: l,
|
|
37
|
+
layout: u,
|
|
38
|
+
value: s,
|
|
39
|
+
onChange: c,
|
|
40
|
+
renderChildren: n(this.props)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { o as buildLayoutFromMarkup, s as withMask };
|
package/package.json
CHANGED
|
@@ -1,32 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/mask-markup",
|
|
3
|
-
"version": "3.0.4-next.
|
|
3
|
+
"version": "3.0.4-next.32",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"module": "src/index.js",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
},
|
|
10
|
-
"repository": "pie-framework/pie-lib",
|
|
11
5
|
"dependencies": {
|
|
12
6
|
"@emotion/react": "^11.14.0",
|
|
13
7
|
"@emotion/style": "^0.8.0",
|
|
14
8
|
"@mui/icons-material": "^7.3.4",
|
|
15
9
|
"@mui/material": "^7.3.4",
|
|
16
|
-
"@pie-lib/drag": "
|
|
17
|
-
"@pie-lib/editable-html-tip-tap": "
|
|
18
|
-
"@pie-lib/
|
|
19
|
-
"@pie-lib/render-ui": "^6.1.0",
|
|
20
|
-
"classnames": "^2.2.6",
|
|
10
|
+
"@pie-lib/drag": "4.0.3-next.37",
|
|
11
|
+
"@pie-lib/editable-html-tip-tap": "2.1.2-next.30",
|
|
12
|
+
"@pie-lib/render-ui": "6.1.1-next.37",
|
|
21
13
|
"debug": "^4.1.1",
|
|
22
|
-
"lodash-es": "^4.17.23",
|
|
23
14
|
"prop-types": "^15.7.2",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
15
|
+
"to-style": "^1.3.3",
|
|
16
|
+
"@dnd-kit/core": "^6.3.1",
|
|
17
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.1-next.0",
|
|
18
|
+
"@pie-element/shared-lodash": "0.1.1-next.0",
|
|
19
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
20
|
+
"clsx": "^2.1.1"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "bun x vite build && bun x tsc --emitDeclarationOnly",
|
|
37
|
+
"dev": "bun x vite",
|
|
38
|
+
"test": "bun x vitest run"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"vite": "^8.0.1",
|
|
42
|
+
"typescript": "^5.9.3",
|
|
43
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
44
|
+
"@types/react": "^18.2.0",
|
|
45
|
+
"@types/react-dom": "^18.2.0"
|
|
27
46
|
},
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"react": "^18.0.0",
|
|
49
|
+
"react-dom": "^18.0.0"
|
|
50
|
+
}
|
|
32
51
|
}
|
package/CHANGELOG.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"type": "feat",
|
|
4
|
-
"scope": "mask-markup",
|
|
5
|
-
"subject": "merging with the develop branch",
|
|
6
|
-
"merge": null,
|
|
7
|
-
"header": "feat(mask-markup): merging with the develop branch",
|
|
8
|
-
"body": null,
|
|
9
|
-
"footer": null,
|
|
10
|
-
"notes": [],
|
|
11
|
-
"hash": "0153c1aba8a08ba6c974fcc69476a87b9086f6c5",
|
|
12
|
-
"gitTags": "",
|
|
13
|
-
"committerDate": "2019-05-02 07:12:59 +0300",
|
|
14
|
-
"isTagged": true,
|
|
15
|
-
"tag": "@pie-lib/mask-markup@1.0.0"
|
|
16
|
-
}
|
|
17
|
-
]
|