@pie-lib/editable-html-tip-tap 0.1.0

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 (158) hide show
  1. package/dist/components/CharacterPicker.d.ts +31 -0
  2. package/dist/components/CharacterPicker.d.ts.map +1 -0
  3. package/dist/components/CharacterPicker.js +129 -0
  4. package/dist/components/EditableHtml.d.ts +11 -0
  5. package/dist/components/EditableHtml.d.ts.map +1 -0
  6. package/dist/components/EditableHtml.js +270 -0
  7. package/dist/components/MenuBar.d.ts +11 -0
  8. package/dist/components/MenuBar.d.ts.map +1 -0
  9. package/dist/components/MenuBar.js +460 -0
  10. package/dist/components/TiptapContainer.d.ts +11 -0
  11. package/dist/components/TiptapContainer.d.ts.map +1 -0
  12. package/dist/components/TiptapContainer.js +157 -0
  13. package/dist/components/characters/characterUtils.d.ts +36 -0
  14. package/dist/components/characters/characterUtils.d.ts.map +1 -0
  15. package/dist/components/characters/characterUtils.js +465 -0
  16. package/dist/components/characters/custom-popper.d.ts +14 -0
  17. package/dist/components/characters/custom-popper.d.ts.map +1 -0
  18. package/dist/components/characters/custom-popper.js +32 -0
  19. package/dist/components/common/done-button.d.ts +30 -0
  20. package/dist/components/common/done-button.d.ts.map +1 -0
  21. package/dist/components/common/done-button.js +26 -0
  22. package/dist/components/common/toolbar-buttons.d.ts +39 -0
  23. package/dist/components/common/toolbar-buttons.d.ts.map +1 -0
  24. package/dist/components/common/toolbar-buttons.js +91 -0
  25. package/dist/components/icons/CssIcon.d.ts +11 -0
  26. package/dist/components/icons/CssIcon.d.ts.map +1 -0
  27. package/dist/components/icons/CssIcon.js +14 -0
  28. package/dist/components/icons/RespArea.d.ts +26 -0
  29. package/dist/components/icons/RespArea.d.ts.map +1 -0
  30. package/dist/components/icons/RespArea.js +42 -0
  31. package/dist/components/icons/TableIcons.d.ts +14 -0
  32. package/dist/components/icons/TableIcons.d.ts.map +1 -0
  33. package/dist/components/icons/TableIcons.js +32 -0
  34. package/dist/components/icons/TextAlign.d.ts +18 -0
  35. package/dist/components/icons/TextAlign.d.ts.map +1 -0
  36. package/dist/components/icons/TextAlign.js +134 -0
  37. package/dist/components/image/AltDialog.d.ts +23 -0
  38. package/dist/components/image/AltDialog.d.ts.map +1 -0
  39. package/dist/components/image/AltDialog.js +61 -0
  40. package/dist/components/image/ImageToolbar.d.ts +25 -0
  41. package/dist/components/image/ImageToolbar.d.ts.map +1 -0
  42. package/dist/components/image/ImageToolbar.js +80 -0
  43. package/dist/components/image/InsertImageHandler.d.ts +33 -0
  44. package/dist/components/image/InsertImageHandler.d.ts.map +1 -0
  45. package/dist/components/image/InsertImageHandler.js +55 -0
  46. package/dist/components/media/MediaDialog.d.ts +44 -0
  47. package/dist/components/media/MediaDialog.d.ts.map +1 -0
  48. package/dist/components/media/MediaDialog.js +389 -0
  49. package/dist/components/media/MediaToolbar.d.ts +20 -0
  50. package/dist/components/media/MediaToolbar.d.ts.map +1 -0
  51. package/dist/components/media/MediaToolbar.js +41 -0
  52. package/dist/components/media/MediaWrapper.d.ts +20 -0
  53. package/dist/components/media/MediaWrapper.d.ts.map +1 -0
  54. package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts +23 -0
  55. package/dist/components/respArea/DragInTheBlank/DragInTheBlank.d.ts.map +1 -0
  56. package/dist/components/respArea/DragInTheBlank/DragInTheBlank.js +58 -0
  57. package/dist/components/respArea/DragInTheBlank/choice.d.ts +56 -0
  58. package/dist/components/respArea/DragInTheBlank/choice.d.ts.map +1 -0
  59. package/dist/components/respArea/DragInTheBlank/choice.js +156 -0
  60. package/dist/components/respArea/ExplicitConstructedResponse.d.ts +20 -0
  61. package/dist/components/respArea/ExplicitConstructedResponse.d.ts.map +1 -0
  62. package/dist/components/respArea/ExplicitConstructedResponse.js +67 -0
  63. package/dist/components/respArea/InlineDropdown.d.ts +18 -0
  64. package/dist/components/respArea/InlineDropdown.d.ts.map +1 -0
  65. package/dist/components/respArea/InlineDropdown.js +91 -0
  66. package/dist/components/respArea/MathTemplated.d.ts +19 -0
  67. package/dist/components/respArea/MathTemplated.d.ts.map +1 -0
  68. package/dist/components/respArea/MathTemplated.js +97 -0
  69. package/dist/components/respArea/ToolbarIcon.d.ts +14 -0
  70. package/dist/components/respArea/ToolbarIcon.d.ts.map +1 -0
  71. package/dist/components/respArea/ToolbarIcon.js +17 -0
  72. package/dist/constants.d.ts +14 -0
  73. package/dist/constants.d.ts.map +1 -0
  74. package/dist/constants.js +4 -0
  75. package/dist/extensions/css.d.ts +12 -0
  76. package/dist/extensions/css.d.ts.map +1 -0
  77. package/dist/extensions/css.js +115 -0
  78. package/dist/extensions/custom-toolbar-wrapper.d.ts +11 -0
  79. package/dist/extensions/custom-toolbar-wrapper.d.ts.map +1 -0
  80. package/dist/extensions/custom-toolbar-wrapper.js +58 -0
  81. package/dist/extensions/div-node.d.ts +11 -0
  82. package/dist/extensions/div-node.d.ts.map +1 -0
  83. package/dist/extensions/div-node.js +25 -0
  84. package/dist/extensions/extended-table.d.ts +11 -0
  85. package/dist/extensions/extended-table.d.ts.map +1 -0
  86. package/dist/extensions/extended-table.js +15 -0
  87. package/dist/extensions/image-component.d.ts +22 -0
  88. package/dist/extensions/image-component.d.ts.map +1 -0
  89. package/dist/extensions/image-component.js +200 -0
  90. package/dist/extensions/image.d.ts +11 -0
  91. package/dist/extensions/image.d.ts.map +1 -0
  92. package/dist/extensions/image.js +42 -0
  93. package/dist/extensions/index.d.ts +17 -0
  94. package/dist/extensions/index.d.ts.map +1 -0
  95. package/dist/extensions/index.js +65 -0
  96. package/dist/extensions/math.d.ts +15 -0
  97. package/dist/extensions/math.d.ts.map +1 -0
  98. package/dist/extensions/math.js +150 -0
  99. package/dist/extensions/media.d.ts +19 -0
  100. package/dist/extensions/media.d.ts.map +1 -0
  101. package/dist/extensions/media.js +147 -0
  102. package/dist/extensions/responseArea.d.ts +28 -0
  103. package/dist/extensions/responseArea.d.ts.map +1 -0
  104. package/dist/extensions/responseArea.js +259 -0
  105. package/dist/index.d.ts +13 -0
  106. package/dist/index.d.ts.map +1 -0
  107. package/dist/index.js +6 -0
  108. package/dist/styles/editorContainerStyles.d.ts +135 -0
  109. package/dist/styles/editorContainerStyles.d.ts.map +1 -0
  110. package/dist/theme.d.ts +10 -0
  111. package/dist/theme.d.ts.map +1 -0
  112. package/dist/utils/helper.d.ts +10 -0
  113. package/dist/utils/helper.d.ts.map +1 -0
  114. package/dist/utils/helper.js +7 -0
  115. package/dist/utils/size.d.ts +10 -0
  116. package/dist/utils/size.d.ts.map +1 -0
  117. package/dist/utils/size.js +14 -0
  118. package/package.json +71 -0
  119. package/src/components/CharacterPicker.tsx +210 -0
  120. package/src/components/EditableHtml.tsx +416 -0
  121. package/src/components/MenuBar.tsx +558 -0
  122. package/src/components/TiptapContainer.tsx +228 -0
  123. package/src/components/characters/characterUtils.ts +457 -0
  124. package/src/components/characters/custom-popper.tsx +48 -0
  125. package/src/components/common/done-button.tsx +37 -0
  126. package/src/components/common/toolbar-buttons.tsx +132 -0
  127. package/src/components/icons/CssIcon.tsx +25 -0
  128. package/src/components/icons/RespArea.tsx +81 -0
  129. package/src/components/icons/TableIcons.tsx +62 -0
  130. package/src/components/icons/TextAlign.tsx +124 -0
  131. package/src/components/image/AltDialog.tsx +92 -0
  132. package/src/components/image/ImageToolbar.tsx +109 -0
  133. package/src/components/image/InsertImageHandler.ts +121 -0
  134. package/src/components/media/MediaDialog.tsx +606 -0
  135. package/src/components/media/MediaToolbar.tsx +59 -0
  136. package/src/components/media/MediaWrapper.tsx +49 -0
  137. package/src/components/respArea/DragInTheBlank/DragInTheBlank.tsx +86 -0
  138. package/src/components/respArea/DragInTheBlank/choice.tsx +266 -0
  139. package/src/components/respArea/ExplicitConstructedResponse.tsx +122 -0
  140. package/src/components/respArea/InlineDropdown.tsx +152 -0
  141. package/src/components/respArea/MathTemplated.tsx +134 -0
  142. package/src/components/respArea/ToolbarIcon.tsx +76 -0
  143. package/src/constants.ts +15 -0
  144. package/src/extensions/css.tsx +230 -0
  145. package/src/extensions/custom-toolbar-wrapper.tsx +88 -0
  146. package/src/extensions/div-node.tsx +46 -0
  147. package/src/extensions/extended-table.ts +34 -0
  148. package/src/extensions/image-component.tsx +303 -0
  149. package/src/extensions/image.tsx +64 -0
  150. package/src/extensions/index.tsx +91 -0
  151. package/src/extensions/math.tsx +285 -0
  152. package/src/extensions/media.tsx +198 -0
  153. package/src/extensions/responseArea.tsx +404 -0
  154. package/src/index.tsx +15 -0
  155. package/src/styles/editorContainerStyles.ts +155 -0
  156. package/src/theme.ts +11 -0
  157. package/src/utils/helper.tsx +27 -0
  158. package/src/utils/size.ts +42 -0
@@ -0,0 +1,156 @@
1
+ import { GripIcon as e } from "../../icons/RespArea.js";
2
+ import { useEffect as t, useRef as n, useState as r } from "react";
3
+ import { styled as i } from "@mui/material/styles";
4
+ import a from "prop-types";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ import { useDraggable as c, useDroppable as l } from "@dnd-kit/core";
7
+ import { color as u } from "@pie-lib/render-ui";
8
+ import { renderMath as d } from "@pie-element/shared-math-rendering-mathjax";
9
+ import f from "classnames";
10
+ //#region src/components/respArea/DragInTheBlank/choice.tsx
11
+ var p = i("span")(({ theme: e }) => ({
12
+ border: `solid 0px ${e.palette.primary.main}`,
13
+ "& mjx-frac": { fontSize: "120% !important" }
14
+ }));
15
+ function m({ n: i, children: a, isDragging: c, isOver: l, dragItem: f, value: p, selected: m }) {
16
+ let [h, g] = r(null), _ = n(null), v = (e) => {
17
+ _.current && (_.current.contains(e.target) ? _.current.classList.add("selected") : _.current.classList.remove("selected"));
18
+ };
19
+ t(() => (document.addEventListener("click", v), () => {
20
+ document.removeEventListener("click", v);
21
+ }), []), t(() => {
22
+ _.current && typeof d == "function" && d(_.current);
23
+ }, [
24
+ p?.value,
25
+ l,
26
+ f?.value?.value
27
+ ]), t(() => {
28
+ if (l && _.current && !h) {
29
+ let e = _.current;
30
+ g({
31
+ width: e.offsetWidth,
32
+ height: e.offsetHeight
33
+ });
34
+ } else !l && h && g(null);
35
+ }, [l, h]);
36
+ let y = f && l ? f.value.value : p.value || "\xA0", b = c ? "\xA0" : y, x = b !== "\xA0", S = f && l, C = m ? `2px solid ${u.primaryDark()}` : S ? `1px solid ${u.defaults.BORDER_DARK}` : `1px solid ${u.defaults.BORDER_LIGHT}`;
37
+ return /* @__PURE__ */ s("div", {
38
+ ref: _,
39
+ className: m ? "selected" : void 0,
40
+ style: {
41
+ display: "inline-flex",
42
+ minWidth: "178px",
43
+ minHeight: "36px",
44
+ background: S ? `${u.defaults.BORDER_LIGHT}` : `${u.defaults.WHITE}`,
45
+ border: C,
46
+ boxSizing: "border-box",
47
+ borderRadius: "3px",
48
+ overflow: "hidden",
49
+ position: "relative",
50
+ padding: "8px 8px 8px 35px",
51
+ width: h ? h.width : void 0,
52
+ height: h ? h.height : void 0,
53
+ touchAction: "none"
54
+ },
55
+ "data-key": i.index,
56
+ contentEditable: !1,
57
+ children: [
58
+ x && /* @__PURE__ */ o(e, {
59
+ style: {
60
+ position: "absolute",
61
+ top: "6px",
62
+ left: "15px",
63
+ color: "#9B9B9B"
64
+ },
65
+ contentEditable: !1
66
+ }),
67
+ /* @__PURE__ */ o("span", { dangerouslySetInnerHTML: { __html: b } }),
68
+ a
69
+ ]
70
+ });
71
+ }
72
+ m.propTypes = {
73
+ n: a.object,
74
+ children: a.node,
75
+ isDragging: a.bool,
76
+ isOver: a.bool,
77
+ dragItem: a.object,
78
+ value: a.object,
79
+ selected: a.bool
80
+ };
81
+ function h({ value: e, disabled: t, instanceId: n, children: r, n: i, onChange: a, removeResponse: s, duplicates: u, pos: d, selected: h }) {
82
+ let { attributes: g, listeners: _, setNodeRef: v, isDragging: y } = c({
83
+ id: `drag-${i.index}`,
84
+ disabled: t || !e?.value,
85
+ data: {
86
+ id: `drag-${i.index}`,
87
+ value: e,
88
+ instanceId: n,
89
+ n: i,
90
+ pos: d,
91
+ opts: { duplicates: u },
92
+ type: "drag-in-the-blank-placed-choice",
93
+ fromChoice: !e,
94
+ onRemove: (e) => s(e),
95
+ onDrop: (e, t) => {
96
+ t?.type === "drag-in-the-blank-drop-choice" && (a(e), !u && e.fromChoice && s(e));
97
+ }
98
+ }
99
+ }), { setNodeRef: b, isOver: x, active: S } = l({
100
+ id: `drop-${i.index}`,
101
+ data: {
102
+ type: "drag-in-the-blank-drop-choice",
103
+ accepts: ["drag-in-the-blank-choice", "drag-in-the-blank-placed-choice"],
104
+ instanceId: n,
105
+ value: e,
106
+ id: `drop-${i.index}`,
107
+ pos: d,
108
+ n: i,
109
+ opts: { duplicates: u },
110
+ onDrop: (e, t) => {
111
+ if (t?.type === "drag-in-the-blank-drop-choice" && e.value.id !== t.value.id) {
112
+ if (e.type === "drag-in-the-blank-choice") {
113
+ a(e), !u && e.fromChoice && s(e);
114
+ return;
115
+ }
116
+ e.type === "drag-in-the-blank-placed-choice" && (s(t), a(e), setTimeout(() => s(e), 10));
117
+ }
118
+ }
119
+ }
120
+ }), C = (e) => {
121
+ v(e), b(e);
122
+ }, w = /* @__PURE__ */ o(m, {
123
+ n: i,
124
+ isDragging: y,
125
+ isOver: x,
126
+ dragItem: S?.data?.current,
127
+ value: e,
128
+ selected: h,
129
+ children: r
130
+ }), T = e ? /* @__PURE__ */ o("span", {
131
+ ref: C,
132
+ ...g,
133
+ ..._,
134
+ children: w
135
+ }) : /* @__PURE__ */ o("span", {
136
+ ref: b,
137
+ children: w
138
+ });
139
+ return /* @__PURE__ */ o(p, {
140
+ className: f(x && "over"),
141
+ children: T
142
+ });
143
+ }
144
+ h.propTypes = {
145
+ value: a.object,
146
+ disabled: a.bool,
147
+ instanceId: a.string,
148
+ children: a.node,
149
+ n: a.object.isRequired,
150
+ onChange: a.func.isRequired,
151
+ removeResponse: a.func.isRequired,
152
+ duplicates: a.bool,
153
+ selected: a.bool
154
+ };
155
+ //#endregion
156
+ export { h as default };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/ExplicitConstructedResponse.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 PropTypes from 'prop-types';
10
+ declare const ExplicitConstructedResponse: {
11
+ (props: any): JSX.Element;
12
+ propTypes: {
13
+ attributes: PropTypes.Requireable<object>;
14
+ error: PropTypes.Requireable<any>;
15
+ value: PropTypes.Requireable<string>;
16
+ isFocused: PropTypes.Requireable<boolean>;
17
+ };
18
+ };
19
+ export default ExplicitConstructedResponse;
20
+ //# sourceMappingURL=ExplicitConstructedResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExplicitConstructedResponse.d.ts","sourceRoot":"","sources":["../../../src/components/respArea/ExplicitConstructedResponse.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAIH,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,QAAA,MAAM,2BAA2B;;;;;;;;CAkGhC,CAAC;AASF,eAAe,2BAA2B,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { useEffect as e, useRef as t, useState as n } from "react";
2
+ import { NodeViewWrapper as r } from "@tiptap/react";
3
+ import i from "prop-types";
4
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ //#region src/components/respArea/ExplicitConstructedResponse.tsx
6
+ var s = (i) => {
7
+ let { editor: s, node: c, getPos: l, options: u, selected: d } = i, { attrs: f } = c, { value: p } = f, { respAreaToolbar: m, error: h } = u, g = l(), [_, v] = n(!1), y = m([c, g], s, () => {}), b = t(null), x;
8
+ if (h) {
9
+ let e = h(), t = parseInt(f.index, 10);
10
+ x = !!e?.[t]?.[0];
11
+ }
12
+ return e(() => {
13
+ let { selection: e } = s.state, t = e.from + c.nodeSize === e.to;
14
+ d ? t && v(d) : v(d);
15
+ }, [
16
+ s,
17
+ c,
18
+ d
19
+ ]), e(() => {
20
+ let e = (e) => {
21
+ b.current && !b.current.contains(e.target) && !e.target.closest("[data-inline-node]") && v(!1);
22
+ };
23
+ return _ ? document.addEventListener("mousedown", e) : document.removeEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
24
+ }, [_]), /* @__PURE__ */ o(r, {
25
+ className: "drag-in-the-blank",
26
+ "data-selected": d,
27
+ style: {
28
+ display: "inline-flex",
29
+ minHeight: "55px",
30
+ position: "relative",
31
+ cursor: "pointer"
32
+ },
33
+ children: [/* @__PURE__ */ a("div", {
34
+ ...f,
35
+ style: {
36
+ display: "inline-flex",
37
+ width: "100%",
38
+ minHeight: "46px",
39
+ height: "46px",
40
+ backgroundColor: "#FFF",
41
+ border: `1px solid ${x ? "red" : "#C0C3CF"}`,
42
+ boxSizing: "border-box",
43
+ borderRadius: "4px",
44
+ overflow: "hidden",
45
+ padding: "12px 21px",
46
+ margin: "0 4px",
47
+ minWidth: "178px",
48
+ visibility: _ ? "hidden" : "visible"
49
+ },
50
+ onClick: () => v(!0),
51
+ dangerouslySetInnerHTML: { __html: p || "<div>&nbsp;</div>" }
52
+ }), _ && /* @__PURE__ */ a("div", {
53
+ ref: b,
54
+ className: "absolute z-50 bg-white shadow-lg rounded p-2",
55
+ style: { zIndex: 1 },
56
+ children: /* @__PURE__ */ a(y, {})
57
+ })]
58
+ });
59
+ };
60
+ s.propTypes = {
61
+ attributes: i.object,
62
+ error: i.any,
63
+ value: i.string,
64
+ isFocused: i.bool
65
+ };
66
+ //#endregion
67
+ export { s as default };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/InlineDropdown.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 PropTypes from 'prop-types';
10
+ declare const InlineDropdown: {
11
+ (props: any): JSX.Element;
12
+ propTypes: {
13
+ attributes: PropTypes.Requireable<object>;
14
+ selectedItem: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
15
+ };
16
+ };
17
+ export default InlineDropdown;
18
+ //# sourceMappingURL=InlineDropdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InlineDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/respArea/InlineDropdown.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,QAAA,MAAM,cAAc;;;;;;CAgInB,CAAC;AAOF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { Chevron as e } from "../icons/RespArea.js";
2
+ import { useEffect as t, useRef as n, useState as r } from "react";
3
+ import { NodeViewWrapper as i } from "@tiptap/react";
4
+ import a from "prop-types";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ import c from "react-dom";
7
+ //#region src/components/respArea/InlineDropdown.tsx
8
+ var l = (a) => {
9
+ let { editor: l, node: u, getPos: d, options: f, selected: p } = a, { attrs: m } = u, { value: h, error: g } = m, _ = h || "<div>&nbsp</div>", v = d(), y = n(null), b = n(null), [x, S] = r(!1), [C, w] = r({
10
+ top: 0,
11
+ left: 0
12
+ }), T = f.respAreaToolbar([u, v], l, () => {});
13
+ return t(() => {
14
+ let { selection: e } = l.state, t = e.from + u.nodeSize === e.to;
15
+ p ? t && S(p) : S(p);
16
+ }, [
17
+ l,
18
+ u,
19
+ p
20
+ ]), t(() => {
21
+ let e = document.body.getBoundingClientRect(), { from: t } = l.state.selection, n = l.view.coordsAtPos(t);
22
+ w({
23
+ top: n.top + Math.abs(e.top) + 40,
24
+ left: n.left
25
+ });
26
+ let r = (e) => {
27
+ let t = e.target.closest("[data-toolbar-for]");
28
+ (!t || t.dataset.toolbarFor !== b.current.instanceId) && !l._toolbarOpened && y.current && !y.current.contains(e.target) && !e.target.closest("[data-inline-node]") && S(!1);
29
+ };
30
+ return x ? document.addEventListener("mousedown", r) : document.removeEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
31
+ }, [x]), /* @__PURE__ */ s(i, {
32
+ className: "inline-dropdown",
33
+ "data-selected": p,
34
+ style: {
35
+ display: "inline-flex",
36
+ height: "50px",
37
+ margin: "0 5px",
38
+ cursor: "pointer"
39
+ },
40
+ children: [/* @__PURE__ */ s("div", {
41
+ style: {
42
+ display: "inline-flex",
43
+ minWidth: "178px",
44
+ height: "36px",
45
+ background: "#FFF",
46
+ border: "1px solid #C0C3CF",
47
+ boxSizing: "border-box",
48
+ borderRadius: "3px",
49
+ margin: "0 4px",
50
+ position: "relative",
51
+ alignItems: "center"
52
+ },
53
+ onClick: () => S(!0),
54
+ children: [/* @__PURE__ */ o("div", {
55
+ style: {
56
+ flex: 1,
57
+ overflow: "hidden",
58
+ padding: "0 25px 0 8px",
59
+ whiteSpace: "nowrap",
60
+ textOverflow: "ellipsis"
61
+ },
62
+ children: /* @__PURE__ */ o("span", {
63
+ style: {
64
+ display: "inline-block",
65
+ verticalAlign: "middle"
66
+ },
67
+ dangerouslySetInnerHTML: { __html: _ }
68
+ })
69
+ }), /* @__PURE__ */ o(e, {
70
+ direction: "down",
71
+ style: {
72
+ position: "absolute",
73
+ top: "5px",
74
+ right: "5px"
75
+ }
76
+ })]
77
+ }), x && c.createPortal(/* @__PURE__ */ o("div", {
78
+ ref: y,
79
+ style: { zIndex: 1 },
80
+ children: /* @__PURE__ */ o(T, { editorCallback: (e) => {
81
+ b.current = e;
82
+ } })
83
+ }), document.body)]
84
+ });
85
+ };
86
+ l.propTypes = {
87
+ attributes: a.object,
88
+ selectedItem: a.oneOfType([a.string, a.object])
89
+ };
90
+ //#endregion
91
+ export { l as default };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/MathTemplated.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 PropTypes from 'prop-types';
10
+ declare const MathTemplated: {
11
+ (props: any): JSX.Element;
12
+ propTypes: {
13
+ attributes: PropTypes.Requireable<object>;
14
+ value: PropTypes.Requireable<string>;
15
+ keyToDisplay: PropTypes.Requireable<string>;
16
+ };
17
+ };
18
+ export default MathTemplated;
19
+ //# sourceMappingURL=MathTemplated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MathTemplated.d.ts","sourceRoot":"","sources":["../../../src/components/respArea/MathTemplated.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AAsFnC,QAAA,MAAM,aAAa;;;;;;;CA4BlB,CAAC;AAQF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,97 @@
1
+ import "react";
2
+ import { NodeViewWrapper as e } from "@tiptap/react";
3
+ import { styled as t } from "@mui/material/styles";
4
+ import n from "prop-types";
5
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
+ import { mq as a } from "@pie-lib/math-input";
7
+ //#region src/components/respArea/MathTemplated.tsx
8
+ var o = t("span")(() => ({
9
+ display: "inline-flex",
10
+ border: "1px solid #C0C3CF",
11
+ margin: "1px 5px",
12
+ cursor: "pointer",
13
+ alignItems: "center",
14
+ justifyContent: "center",
15
+ minWidth: "50px",
16
+ minHeight: "36px",
17
+ height: "fit-content"
18
+ })), s = t("div")(({ theme: e }) => ({
19
+ background: e.palette.grey.A100,
20
+ color: e.palette.grey.A700,
21
+ display: "inline-flex",
22
+ borderRight: "2px solid #C0C3CF",
23
+ boxSizing: "border-box",
24
+ overflow: "hidden",
25
+ fontSize: "12px",
26
+ minHeight: "36px",
27
+ height: "100%",
28
+ alignItems: "center",
29
+ fontFamily: "Symbola, Times New Roman, serif",
30
+ padding: "0 2px"
31
+ })), c = t("div")(() => ({
32
+ flex: 8,
33
+ color: "var(--pie-text, black)",
34
+ padding: "4px !important",
35
+ display: "flex",
36
+ alignItems: "center",
37
+ justifyContent: "center",
38
+ backgroundColor: "var(--pie-background, rgba(255, 255, 255, 0))",
39
+ "& > .mq-math-mode sup.mq-nthroot": {
40
+ fontSize: "70% !important",
41
+ verticalAlign: "1em !important"
42
+ },
43
+ "& > .mq-math-mode .mq-sqrt-stem": {
44
+ borderTop: "0.07em solid",
45
+ marginLeft: "-1.5px",
46
+ marginTop: "-2px !important",
47
+ paddingTop: "5px !important"
48
+ },
49
+ "& .mq-overarrow-inner": {
50
+ paddingTop: "0 !important",
51
+ border: "none !important"
52
+ },
53
+ "& .mq-overarrow.mq-arrow-both": {
54
+ marginTop: "0px",
55
+ minWidth: "1.23em",
56
+ "& *": { lineHeight: "1 !important" },
57
+ "&:before": {
58
+ top: "-0.4em",
59
+ left: "-1px"
60
+ },
61
+ "&:after": {
62
+ top: "0px !important",
63
+ position: "absolute !important",
64
+ right: "-2px"
65
+ },
66
+ "&.mq-empty:after": { top: "-0.45em" }
67
+ },
68
+ "& .mq-overarrow.mq-arrow-right": { "&:before": {
69
+ top: "-0.4em",
70
+ right: "-1px"
71
+ } },
72
+ "& .mq-overarrow-inner-right": { display: "none !important" },
73
+ "& .mq-overarrow-inner-left": { display: "none !important" }
74
+ })), l = (t) => {
75
+ let { node: n, options: l, selected: u } = t, { attrs: d } = n, { value: f, index: p } = d, m = `R ${parseInt(p) + 1}`;
76
+ return /* @__PURE__ */ r(e, {
77
+ className: "math-templated",
78
+ "data-selected": u,
79
+ style: {
80
+ display: "inline-flex",
81
+ minHeight: "36px",
82
+ minWidth: "50px",
83
+ cursor: "pointer"
84
+ },
85
+ children: /* @__PURE__ */ i(o, {
86
+ ...d,
87
+ children: [/* @__PURE__ */ r(s, { children: m }), /* @__PURE__ */ r(c, { children: /* @__PURE__ */ r(a.Static, { latex: f }) })]
88
+ })
89
+ });
90
+ };
91
+ l.propTypes = {
92
+ attributes: n.object,
93
+ value: n.string,
94
+ keyToDisplay: n.string
95
+ };
96
+ //#endregion
97
+ export { l as default };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/editable-html-tip-tap/src/components/respArea/ToolbarIcon.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
+ export declare const Chevron: (props: any) => JSX.Element;
10
+ export declare const GripIcon: ({ style }: {
11
+ style: any;
12
+ }) => JSX.Element;
13
+ export declare const ToolbarIcon: () => JSX.Element;
14
+ //# sourceMappingURL=ToolbarIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolbarIcon.d.ts","sourceRoot":"","sources":["../../../src/components/respArea/ToolbarIcon.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAKH,eAAO,MAAM,OAAO,GAAI,UAAK,gBA6B5B,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI;;CAAS,gBAiBjC,CAAC;AAcF,eAAO,MAAM,WAAW,mBAA+D,CAAC"}
@@ -0,0 +1,17 @@
1
+ import "react";
2
+ import { styled as e } from "@mui/material/styles";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ //#region src/components/respArea/ToolbarIcon.tsx
5
+ var n = e("div")(({ theme: e }) => ({
6
+ fontFamily: "Cerebri Sans !important",
7
+ fontSize: e.typography.fontSize,
8
+ fontWeight: "bold",
9
+ lineHeight: "14px",
10
+ position: "relative",
11
+ top: "7px",
12
+ width: "110px",
13
+ height: "28px",
14
+ whiteSpace: "nowrap"
15
+ })), r = () => /* @__PURE__ */ t(n, { children: "+ Response Area" });
16
+ //#endregion
17
+ export { r as ToolbarIcon };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/editable-html-tip-tap/src/constants.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 PIE_TOOLBAR__CLASS = "pie-toolbar";
10
+ declare const _default: {
11
+ PIE_TOOLBAR__CLASS: string;
12
+ };
13
+ export default _default;
14
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;;;;AAEhD,wBAEE"}
@@ -0,0 +1,4 @@
1
+ //#region src/constants.ts
2
+ var e = "pie-toolbar";
3
+ //#endregion
4
+ export { e as PIE_TOOLBAR__CLASS };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/editable-html-tip-tap/src/extensions/css.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
+ import { Mark } from '@tiptap/core';
10
+ export declare const removeDialogs: () => void;
11
+ export declare const CSSMark: Mark<any, any>;
12
+ //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/extensions/css.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAIH,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAIrD,eAAO,MAAM,aAAa,YAIzB,CAAC;AA0IF,eAAO,MAAM,OAAO,gBAuElB,CAAC"}
@@ -0,0 +1,115 @@
1
+ import "react";
2
+ import { Mark as e, mergeAttributes as t } from "@tiptap/core";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import i from "react-dom";
5
+ import a from "@mui/material/List";
6
+ import o from "@mui/material/ListItem";
7
+ //#region src/extensions/css.tsx
8
+ var s = () => {
9
+ document.querySelectorAll(".insert-css-dialog").forEach((e) => e.remove());
10
+ }, c = ({ editor: e, callback: t, opts: c, selectedText: l, parentNode: u }) => {
11
+ let d = e.options.element, f = document.createElement("div"), { selection: p } = e.state;
12
+ s(), f.className = "insert-css-dialog";
13
+ let m = !1, h = (e) => {
14
+ if (m) {
15
+ let t = f.contains(e.target) || void 0, n = d.contains(e.target);
16
+ t || n || g();
17
+ } else m = !0;
18
+ }, g = () => {
19
+ t(void 0, !0), f.remove(), document.body.removeEventListener("click", h);
20
+ }, _ = (e) => {
21
+ t(e, !0), f.remove(), document.body.removeEventListener("click", h);
22
+ }, v = u?.attrs.class, y = (e) => {
23
+ let t = `<span class="${e}">${l}</span>`;
24
+ if (u) {
25
+ let e = "span";
26
+ u?.object === "inline" && (e = "span"), u?.object === "block" && (e = "div"), t = `<${e} class="${v}">${u.text.slice(0, p.$anchor.textOffset)}${t}${u.text.slice(p.$head.textOffset)}</${e}>`;
27
+ }
28
+ return t;
29
+ }, b = /* @__PURE__ */ r("div", {
30
+ style: {
31
+ background: "white",
32
+ height: 500,
33
+ padding: 20,
34
+ overflow: "hidden",
35
+ display: "flex",
36
+ flexFlow: "column"
37
+ },
38
+ children: [
39
+ /* @__PURE__ */ n("h2", { children: "Please choose a css class" }),
40
+ v && /* @__PURE__ */ r("div", { children: ["The current parent has this class ", v] }),
41
+ /* @__PURE__ */ n(a, {
42
+ component: "nav",
43
+ style: { overflow: "scroll" },
44
+ children: c.names.map((e, t) => /* @__PURE__ */ r(o, {
45
+ button: !0,
46
+ onClick: () => _(e),
47
+ children: [/* @__PURE__ */ n("div", {
48
+ style: { marginRight: 20 },
49
+ children: e
50
+ }), /* @__PURE__ */ n("div", { dangerouslySetInnerHTML: { __html: y(e) } })]
51
+ }, `rule-${t}`))
52
+ })
53
+ ]
54
+ });
55
+ i.render(b, f, () => {
56
+ let t = e.view.nodeDOM(e.state.selection.from)?.parentNode;
57
+ if (t) {
58
+ let e = d.parentElement.parentElement.parentElement.getBoundingClientRect(), n = t.getBoundingClientRect();
59
+ d.parentElement.parentElement.parentElement.appendChild(f), f.style.maxWidth = "500px", f.style.position = "absolute", f.style.top = 0, f.style.zIndex = 99999;
60
+ let r = `${n.left + Math.abs(e.left) + t.offsetWidth + 10}px`, i = `${n.x}px`;
61
+ f.style.left = r;
62
+ let a = f.offsetWidth;
63
+ f.style.left = "unset", f.style.right = i;
64
+ let o = f.offsetWidth;
65
+ f.style.left = "unset", f.style.right = "unset", a >= o ? f.style.left = r : f.style.right = i, document.body.addEventListener("click", h);
66
+ }
67
+ });
68
+ }, l = e.create({
69
+ name: "cssmark",
70
+ addOptions() {
71
+ return { classes: [] };
72
+ },
73
+ addAttributes() {
74
+ return { class: {
75
+ default: null,
76
+ parseHTML: (e) => e.getAttribute("class"),
77
+ renderHTML: (e) => e.class ? { class: e.class } : {}
78
+ } };
79
+ },
80
+ parseHTML() {
81
+ return [{
82
+ tag: "span[class]",
83
+ getAttrs: (e) => {
84
+ let t = e.getAttribute("class") || "", n = this.options.classes.find((e) => t.includes(e));
85
+ return n ? { class: n } : !1;
86
+ }
87
+ }];
88
+ },
89
+ renderHTML({ HTMLAttributes: e }) {
90
+ return [
91
+ "span",
92
+ t(e),
93
+ 0
94
+ ];
95
+ },
96
+ addCommands() {
97
+ return {
98
+ setCSSClass: (e) => ({ commands: t }) => t.setMark(this.name, { class: e }),
99
+ unsetCSSClass: () => ({ commands: e }) => e.unsetMark(this.name),
100
+ openCSSClassDialog: () => ({ editor: e }) => {
101
+ c({
102
+ editor: e,
103
+ selectedText: e.state.doc.textBetween(e.state.selection.from, e.state.selection.to),
104
+ parentNode: e.state.selection.$from.nodeAfter,
105
+ opts: this.options.extraCSSRules,
106
+ callback: (t) => {
107
+ t && e.chain().focus().setCSSClass(t).run();
108
+ }
109
+ });
110
+ }
111
+ };
112
+ }
113
+ });
114
+ //#endregion
115
+ export { l as CSSMark };