@pie-lib/mask-markup 3.1.3 → 4.0.0-next.37

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.
Files changed (113) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +4 -0
  2. package/dist/choices/choice.d.ts +28 -0
  3. package/dist/choices/choice.js +92 -0
  4. package/dist/choices/index.d.ts +29 -0
  5. package/dist/choices/index.js +59 -0
  6. package/dist/componentize.d.ts +12 -0
  7. package/dist/componentize.js +4 -0
  8. package/dist/components/blank.d.ts +45 -0
  9. package/dist/components/blank.js +273 -0
  10. package/dist/components/correct-input.d.ts +11 -0
  11. package/dist/components/dropdown.d.ts +37 -0
  12. package/dist/components/dropdown.js +311 -0
  13. package/dist/components/input.d.ts +37 -0
  14. package/dist/constructed-response.d.ts +44 -0
  15. package/dist/constructed-response.js +56 -0
  16. package/dist/customizable.d.ts +43 -0
  17. package/dist/customizable.js +8 -0
  18. package/dist/drag-in-the-blank.d.ts +47 -0
  19. package/dist/drag-in-the-blank.js +220 -0
  20. package/dist/index.d.ts +15 -0
  21. package/dist/index.js +7 -0
  22. package/dist/inline-dropdown.d.ts +44 -0
  23. package/dist/inline-dropdown.js +24 -0
  24. package/dist/keyboard-coordinates.d.ts +25 -0
  25. package/dist/keyboard-coordinates.js +49 -0
  26. package/dist/mask.d.ts +30 -0
  27. package/dist/mask.js +95 -0
  28. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
  29. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js +17 -0
  30. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js +9 -0
  31. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js +26 -0
  32. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js +11 -0
  33. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js +11 -0
  34. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js +11 -0
  35. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js +24 -0
  36. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js +32 -0
  37. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js +29 -0
  38. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js +14 -0
  39. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js +8 -0
  40. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js +12 -0
  41. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js +11 -0
  42. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js +10 -0
  43. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js +10 -0
  44. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js +55 -0
  45. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js +16 -0
  46. package/dist/serialization.d.ts +34 -0
  47. package/dist/serialization.js +132 -0
  48. package/dist/with-mask.d.ts +55 -0
  49. package/dist/with-mask.js +45 -0
  50. package/package.json +35 -19
  51. package/CHANGELOG.json +0 -17
  52. package/CHANGELOG.md +0 -1353
  53. package/LICENSE.md +0 -5
  54. package/lib/choices/choice.js +0 -138
  55. package/lib/choices/choice.js.map +0 -1
  56. package/lib/choices/index.js +0 -126
  57. package/lib/choices/index.js.map +0 -1
  58. package/lib/componentize.js +0 -21
  59. package/lib/componentize.js.map +0 -1
  60. package/lib/components/blank.js +0 -489
  61. package/lib/components/blank.js.map +0 -1
  62. package/lib/components/correct-input.js +0 -94
  63. package/lib/components/correct-input.js.map +0 -1
  64. package/lib/components/dropdown.js +0 -480
  65. package/lib/components/dropdown.js.map +0 -1
  66. package/lib/components/input.js +0 -50
  67. package/lib/components/input.js.map +0 -1
  68. package/lib/constructed-response.js +0 -101
  69. package/lib/constructed-response.js.map +0 -1
  70. package/lib/customizable.js +0 -42
  71. package/lib/customizable.js.map +0 -1
  72. package/lib/drag-in-the-blank.js +0 -363
  73. package/lib/drag-in-the-blank.js.map +0 -1
  74. package/lib/index.js +0 -55
  75. package/lib/index.js.map +0 -1
  76. package/lib/inline-dropdown.js +0 -40
  77. package/lib/inline-dropdown.js.map +0 -1
  78. package/lib/keyboard-coordinates.js +0 -156
  79. package/lib/keyboard-coordinates.js.map +0 -1
  80. package/lib/mask.js +0 -203
  81. package/lib/mask.js.map +0 -1
  82. package/lib/serialization.js +0 -261
  83. package/lib/serialization.js.map +0 -1
  84. package/lib/with-mask.js +0 -97
  85. package/lib/with-mask.js.map +0 -1
  86. package/src/__tests__/drag-in-the-blank.test.js +0 -256
  87. package/src/__tests__/index.test.js +0 -38
  88. package/src/__tests__/keyboard-coordinates.test.js +0 -202
  89. package/src/__tests__/mask.test.js +0 -479
  90. package/src/__tests__/serialization.test.js +0 -54
  91. package/src/__tests__/utils.js +0 -1
  92. package/src/__tests__/with-mask.test.js +0 -76
  93. package/src/choices/__tests__/index.test.js +0 -212
  94. package/src/choices/choice.jsx +0 -113
  95. package/src/choices/index.jsx +0 -88
  96. package/src/componentize.js +0 -13
  97. package/src/components/__tests__/blank.test.js +0 -413
  98. package/src/components/__tests__/correct-input.test.js +0 -90
  99. package/src/components/__tests__/dropdown.test.js +0 -129
  100. package/src/components/__tests__/input.test.js +0 -102
  101. package/src/components/blank.jsx +0 -504
  102. package/src/components/correct-input.jsx +0 -82
  103. package/src/components/dropdown.jsx +0 -421
  104. package/src/components/input.jsx +0 -48
  105. package/src/constructed-response.jsx +0 -87
  106. package/src/customizable.jsx +0 -34
  107. package/src/drag-in-the-blank.jsx +0 -351
  108. package/src/index.js +0 -16
  109. package/src/inline-dropdown.jsx +0 -29
  110. package/src/keyboard-coordinates.js +0 -147
  111. package/src/mask.jsx +0 -174
  112. package/src/serialization.js +0 -260
  113. package/src/with-mask.jsx +0 -75
@@ -0,0 +1,32 @@
1
+ import { __commonJSMin as e } from "../../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region ../../../node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js
3
+ var t = /* @__PURE__ */ e(((e, t) => {
4
+ t.exports = {
5
+ "border-radius": 1,
6
+ "border-top-left-radius": 1,
7
+ "border-top-right-radius": 1,
8
+ "border-bottom-left-radius": 1,
9
+ "border-bottom-right-radius": 1,
10
+ "box-shadow": 1,
11
+ order: 1,
12
+ flex: function(e, t) {
13
+ return [t + "box-flex"];
14
+ },
15
+ "box-flex": 1,
16
+ "box-align": 1,
17
+ animation: 1,
18
+ "animation-duration": 1,
19
+ "animation-name": 1,
20
+ transition: 1,
21
+ "transition-duration": 1,
22
+ transform: 1,
23
+ "transform-style": 1,
24
+ "transform-origin": 1,
25
+ "backface-visibility": 1,
26
+ perspective: 1,
27
+ "box-pack": 1
28
+ };
29
+ }));
30
+ //#endregion
31
+ export default t();
32
+ export { t as require_prefixProperties };
@@ -0,0 +1,29 @@
1
+ import { __commonJSMin as e } from "../../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_prefixProperties as t } from "./prefixProperties.js";
3
+ import { require_toUpperFirst as n } from "./stringUtils/toUpperFirst.js";
4
+ import { require_prefixInfo as r } from "./prefixInfo.js";
5
+ import { require_camelize as i } from "./stringUtils/camelize.js";
6
+ import { require_hyphenate as a } from "./stringUtils/hyphenate.js";
7
+ import { require_toLowerFirst as o } from "./stringUtils/toLowerFirst.js";
8
+ //#region ../../../node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js
9
+ var s = /* @__PURE__ */ e(((e, s) => {
10
+ var c = i(), l = a(), u = o(), d = n(), f = r(), p = t(), m = typeof document > "u" ? {} : document.documentElement.style;
11
+ s.exports = function(e) {
12
+ return function(t, n) {
13
+ n ||= {};
14
+ var r = u(c(t)), i = l(t), a = e ? r : i, o = f.style ? e ? f.style : f.css : "";
15
+ if (r in m) return n.asString ? a : [a];
16
+ var s = a, h = p[i], g = [];
17
+ if (e && (s = d(a)), typeof h == "function") {
18
+ var _ = h(a, o) || [];
19
+ _ && !Array.isArray(_) && (_ = [_]), _.length && (_ = _.map(function(t) {
20
+ return e ? u(c(t)) : l(t);
21
+ })), g = g.concat(_);
22
+ }
23
+ return o && g.push(o + s), g.push(a), n.asString || g.length == 1 ? g[0] : g;
24
+ };
25
+ };
26
+ }));
27
+ //#endregion
28
+ export default s();
29
+ export { s as require_prefixer };
@@ -0,0 +1,14 @@
1
+ import { __commonJSMin as e } from "../../../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_hyphenRe as t } from "./hyphenRe.js";
3
+ //#region ../../../node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js
4
+ var n = /* @__PURE__ */ e(((e, n) => {
5
+ var r = function(e, t) {
6
+ return t ? t.toUpperCase() : "";
7
+ }, i = t();
8
+ n.exports = function(e) {
9
+ return e ? e.replace(i, r) : "";
10
+ };
11
+ }));
12
+ //#endregion
13
+ export default n();
14
+ export { n as require_camelize };
@@ -0,0 +1,8 @@
1
+ import { __commonJSMin as e } from "../../../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region ../../../node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js
3
+ var t = /* @__PURE__ */ e(((e, t) => {
4
+ t.exports = /[-\s]+(.)?/g;
5
+ }));
6
+ //#endregion
7
+ export default t();
8
+ export { t as require_hyphenRe };
@@ -0,0 +1,12 @@
1
+ import { __commonJSMin as e } from "../../../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_separate as t } from "./separate.js";
3
+ //#region ../../../node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js
4
+ var n = /* @__PURE__ */ e(((e, n) => {
5
+ var r = t();
6
+ n.exports = function(e) {
7
+ return r(e).toLowerCase();
8
+ };
9
+ }));
10
+ //#endregion
11
+ export default n();
12
+ export { n as require_hyphenate };
@@ -0,0 +1,11 @@
1
+ import { __commonJSMin as e } from "../../../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region ../../../node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js
3
+ var t = /* @__PURE__ */ e(((e, t) => {
4
+ var n = /::/g, r = /([A-Z]+)([A-Z][a-z])/g, i = /([a-z\d])([A-Z])/g, a = /_/g;
5
+ t.exports = function(e, t) {
6
+ return e ? e.replace(n, "/").replace(r, "$1_$2").replace(i, "$1_$2").replace(a, t || "-") : "";
7
+ };
8
+ }));
9
+ //#endregion
10
+ export default t();
11
+ export { t as require_separate };
@@ -0,0 +1,10 @@
1
+ import { __commonJSMin as e } from "../../../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region ../../../node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js
3
+ var t = /* @__PURE__ */ e(((e, t) => {
4
+ t.exports = function(e) {
5
+ return e.length ? e.charAt(0).toLowerCase() + e.substring(1) : e;
6
+ };
7
+ }));
8
+ //#endregion
9
+ export default t();
10
+ export { t as require_toLowerFirst };
@@ -0,0 +1,10 @@
1
+ import { __commonJSMin as e } from "../../../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region ../../../node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js
3
+ var t = /* @__PURE__ */ e(((e, t) => {
4
+ t.exports = function(e) {
5
+ return e.length ? e.charAt(0).toUpperCase() + e.substring(1) : e;
6
+ };
7
+ }));
8
+ //#endregion
9
+ export default t();
10
+ export { t as require_toUpperFirst };
@@ -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, d as parseStyleString, f as reactAttributes };
@@ -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,48 @@
1
1
  {
2
2
  "name": "@pie-lib/mask-markup",
3
- "version": "3.1.3",
3
+ "version": "4.0.0-next.37",
4
4
  "description": "",
5
- "main": "lib/index.js",
6
- "module": "src/index.js",
7
- "publishConfig": {
8
- "access": "public"
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/pie-framework/pie-elements-ng.git",
8
+ "directory": "packages/lib-react/mask-markup"
9
9
  },
10
- "repository": "pie-framework/pie-lib",
11
10
  "dependencies": {
12
11
  "@emotion/react": "^11.14.0",
13
12
  "@emotion/styled": "^11.14.1",
14
13
  "@mui/icons-material": "^7.3.4",
15
14
  "@mui/material": "^7.3.4",
16
- "@pie-lib/drag": "^4.1.3",
17
- "@pie-lib/editable-html-tip-tap": "^2.1.17",
18
- "@pie-lib/math-rendering": "^5.1.0",
19
- "@pie-lib/render-ui": "^7.0.2",
20
- "classnames": "^2.2.6",
15
+ "@pie-lib/drag": "4.1.0-next.41",
16
+ "@pie-lib/editable-html-tip-tap": "3.0.0-next.35",
17
+ "@pie-lib/render-ui": "6.2.0-next.41",
21
18
  "debug": "^4.1.1",
22
- "lodash-es": "^4.17.23",
23
19
  "prop-types": "^15.7.2",
24
- "react": "^18.2.0",
25
- "react-dom": "^18.2.0",
26
- "to-style": "^1.3.3"
20
+ "to-style": "^1.3.3",
21
+ "@dnd-kit/core": "^6.3.1",
22
+ "@pie-element/shared-math-rendering-mathjax": "0.1.1-next.0",
23
+ "@pie-element/shared-lodash": "0.1.1-next.1",
24
+ "clsx": "^2.1.1"
27
25
  },
28
- "keywords": [],
29
- "author": "",
30
- "license": "ISC",
31
- "gitHead": "1724b6e93ccb7692edb5b73235375d7ac1c239c8"
26
+ "type": "module",
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "default": "./dist/index.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "sideEffects": false,
39
+ "scripts": {
40
+ "build": "bun x vite build && bun x tsc --emitDeclarationOnly",
41
+ "dev": "bun x vite",
42
+ "test": "bun x vitest run"
43
+ },
44
+ "peerDependencies": {
45
+ "react": "^18.0.0",
46
+ "react-dom": "^18.0.0"
47
+ }
32
48
  }
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
- ]