@siladev/qalam 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.
- package/dist/HafsSmart_08.ttf +0 -0
- package/dist/QalamEditor-DlA4iLRR.js +18519 -0
- package/dist/QalamRenderer-CMsfcF02.js +306 -0
- package/dist/Symbols1_Ver02.otf +0 -0
- package/dist/editor/QalamEditor.d.ts +16 -0
- package/dist/editor/QalamEditor.d.ts.map +1 -0
- package/dist/editor/components/HadithRefView.d.ts +3 -0
- package/dist/editor/components/HadithRefView.d.ts.map +1 -0
- package/dist/editor/components/PoemView.d.ts +3 -0
- package/dist/editor/components/PoemView.d.ts.map +1 -0
- package/dist/editor/components/QuranRefPopover.d.ts +10 -0
- package/dist/editor/components/QuranRefPopover.d.ts.map +1 -0
- package/dist/editor/components/QuranRefView.d.ts +3 -0
- package/dist/editor/components/QuranRefView.d.ts.map +1 -0
- package/dist/editor/components/Toolbar.d.ts +12 -0
- package/dist/editor/components/Toolbar.d.ts.map +1 -0
- package/dist/editor/extensions/blockquote-repeat.d.ts +2 -0
- package/dist/editor/extensions/blockquote-repeat.d.ts.map +1 -0
- package/dist/editor/extensions/hadith-ref.d.ts +13 -0
- package/dist/editor/extensions/hadith-ref.d.ts.map +1 -0
- package/dist/editor/extensions/inline-repeat.d.ts +3 -0
- package/dist/editor/extensions/inline-repeat.d.ts.map +1 -0
- package/dist/editor/extensions/ordered-list.d.ts +9 -0
- package/dist/editor/extensions/ordered-list.d.ts.map +1 -0
- package/dist/editor/extensions/paragraph-repeat.d.ts +2 -0
- package/dist/editor/extensions/paragraph-repeat.d.ts.map +1 -0
- package/dist/editor/extensions/poem.d.ts +12 -0
- package/dist/editor/extensions/poem.d.ts.map +1 -0
- package/dist/editor/extensions/prophetic-speech.d.ts +3 -0
- package/dist/editor/extensions/prophetic-speech.d.ts.map +1 -0
- package/dist/editor/extensions/quran-ref.d.ts +21 -0
- package/dist/editor/extensions/quran-ref.d.ts.map +1 -0
- package/dist/editor/extensions/strict-schema.d.ts +7 -0
- package/dist/editor/extensions/strict-schema.d.ts.map +1 -0
- package/dist/editor/index.d.ts +4 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/lookup-C2v6jsEw.js +738 -0
- package/dist/quran/index.d.ts +3 -0
- package/dist/quran/index.d.ts.map +1 -0
- package/dist/quran/lookup.d.ts +9 -0
- package/dist/quran/lookup.d.ts.map +1 -0
- package/dist/quran/types.d.ts +43 -0
- package/dist/quran/types.d.ts.map +1 -0
- package/dist/quran-data.json +1 -0
- package/dist/renderer/QalamRenderer.d.ts +9 -0
- package/dist/renderer/QalamRenderer.d.ts.map +1 -0
- package/dist/renderer/index.d.ts +2 -0
- package/dist/renderer/index.d.ts.map +1 -0
- package/dist/renderer/index.js +4 -0
- package/dist/renderer/tatweel.d.ts +11 -0
- package/dist/renderer/tatweel.d.ts.map +1 -0
- package/dist/resolver/index.d.ts +2 -0
- package/dist/resolver/index.d.ts.map +1 -0
- package/dist/resolver/index.js +72 -0
- package/dist/resolver/resolve.d.ts +3 -0
- package/dist/resolver/resolve.d.ts.map +1 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +174 -0
- package/dist/schema/schema.d.ts +11 -0
- package/dist/schema/schema.d.ts.map +1 -0
- package/dist/schema/types.d.ts +177 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { jsx as a, jsxs as N, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as H, useCallback as P, useEffect as Q, useState as F, useLayoutEffect as G } from "react";
|
|
3
|
+
const T = "ـ", J = new Set("سشصض"), K = new Set("ةهد"), U = new Set("طلكگ"), z = new Set("عقف"), M = new Set(
|
|
4
|
+
"بتثجحخسشصضطظعغفقكلمنهيئپچژگ"
|
|
5
|
+
);
|
|
6
|
+
new Set("ادذرزوأإآؤ");
|
|
7
|
+
function O(e) {
|
|
8
|
+
const t = e.charCodeAt(0);
|
|
9
|
+
return t >= 1569 && t <= 1610 || t >= 1646 && t <= 1747 || t >= 64336 && t <= 65023;
|
|
10
|
+
}
|
|
11
|
+
function A(e) {
|
|
12
|
+
const t = e.charCodeAt(0);
|
|
13
|
+
return t >= 1611 && t <= 1631;
|
|
14
|
+
}
|
|
15
|
+
function D(e, t) {
|
|
16
|
+
const n = e[t];
|
|
17
|
+
if (!M.has(n)) return !1;
|
|
18
|
+
for (let r = t + 1; r < e.length; r++)
|
|
19
|
+
if (!A(e[r]))
|
|
20
|
+
return O(e[r]);
|
|
21
|
+
return !1;
|
|
22
|
+
}
|
|
23
|
+
function V(e, t) {
|
|
24
|
+
for (let n = t + 1; n < e.length; n++)
|
|
25
|
+
if (!A(e[n])) {
|
|
26
|
+
if (O(e[n])) return !1;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
return !0;
|
|
30
|
+
}
|
|
31
|
+
function X(e, t) {
|
|
32
|
+
for (let n = t - 1; n >= 0; n--)
|
|
33
|
+
if (!A(e[n]))
|
|
34
|
+
return M.has(e[n]);
|
|
35
|
+
return !1;
|
|
36
|
+
}
|
|
37
|
+
function Y(e) {
|
|
38
|
+
const t = [];
|
|
39
|
+
for (let n = 0; n < e.length; n++) {
|
|
40
|
+
const r = e[n];
|
|
41
|
+
if (r.includes(T)) continue;
|
|
42
|
+
let s = null;
|
|
43
|
+
for (let i = 0; i < r.length; i++) {
|
|
44
|
+
if (A(r[i])) continue;
|
|
45
|
+
const c = r[i];
|
|
46
|
+
if (J.has(c) && D(r, i)) {
|
|
47
|
+
const o = { wordIndex: n, charIndex: i + 1, priority: 1 };
|
|
48
|
+
(!s || o.priority < s.priority) && (s = o);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (V(r, i) && X(r, i)) {
|
|
52
|
+
let o = 0;
|
|
53
|
+
if (K.has(c) ? o = 2 : U.has(c) ? o = 3 : z.has(c) && (o = 4), o > 0) {
|
|
54
|
+
const l = { wordIndex: n, charIndex: i, priority: o };
|
|
55
|
+
(!s || l.priority < s.priority) && (s = l);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (M.has(c) && D(r, i)) {
|
|
60
|
+
const o = { wordIndex: n, charIndex: i + 1, priority: 5 };
|
|
61
|
+
(!s || o.priority < s.priority) && (s = o);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
s && t.push(s);
|
|
65
|
+
}
|
|
66
|
+
return t;
|
|
67
|
+
}
|
|
68
|
+
function j(e, t, n = 1) {
|
|
69
|
+
return e.slice(0, t) + T.repeat(n) + e.slice(t);
|
|
70
|
+
}
|
|
71
|
+
function Z(e, t, n, r = 50) {
|
|
72
|
+
let s = e, i = t(s);
|
|
73
|
+
if (i >= n) return s;
|
|
74
|
+
for (let c = 0; c < r; c++) {
|
|
75
|
+
const o = s.split(" "), l = Y(o);
|
|
76
|
+
if (l.length === 0) {
|
|
77
|
+
const u = o.map((p, f) => ({ word: p, index: f })).filter(({ word: p }) => p.includes(T));
|
|
78
|
+
if (u.length === 0) break;
|
|
79
|
+
for (const { word: p, index: f } of u) {
|
|
80
|
+
const q = p.indexOf(T);
|
|
81
|
+
if (o[f] = j(p, q, 1), s = o.join(" "), i = t(s), i >= n) return s;
|
|
82
|
+
}
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
l.sort((u, p) => u.priority - p.priority);
|
|
86
|
+
const d = l[0];
|
|
87
|
+
if (o[d.wordIndex] = j(o[d.wordIndex], d.charIndex), s = o.join(" "), i = t(s), i >= n) return s;
|
|
88
|
+
}
|
|
89
|
+
return s;
|
|
90
|
+
}
|
|
91
|
+
function E(e) {
|
|
92
|
+
if (e === 2) return "(مرتان)";
|
|
93
|
+
const t = e.toString().replace(/\d/g, (n) => "٠١٢٣٤٥٦٧٨٩"[parseInt(n)]);
|
|
94
|
+
return e > 10 ? `(${t} مرة)` : `(${t} مرات)`;
|
|
95
|
+
}
|
|
96
|
+
function B(e, t, n) {
|
|
97
|
+
if (n >= t.length) return /* @__PURE__ */ a($, { children: e });
|
|
98
|
+
const r = t[n], s = B(e, t, n + 1);
|
|
99
|
+
switch (r.type) {
|
|
100
|
+
case "bold":
|
|
101
|
+
return /* @__PURE__ */ a("strong", { children: s });
|
|
102
|
+
case "italic":
|
|
103
|
+
return /* @__PURE__ */ a("em", { children: s });
|
|
104
|
+
case "link":
|
|
105
|
+
return /* @__PURE__ */ a("a", { href: r.attrs.href, target: r.attrs.target ?? "_blank", rel: "noopener noreferrer", children: s });
|
|
106
|
+
case "repeat":
|
|
107
|
+
return /* @__PURE__ */ N("span", { className: "qalam-render-inline-repeat", children: [
|
|
108
|
+
s,
|
|
109
|
+
/* @__PURE__ */ a("span", { className: "qalam-render-inline-repeat-badge", children: E(r.attrs.count) })
|
|
110
|
+
] });
|
|
111
|
+
case "propheticSpeech":
|
|
112
|
+
return /* @__PURE__ */ a("span", { className: "qalam-render-prophetic-speech", children: s });
|
|
113
|
+
default:
|
|
114
|
+
return s;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function ee({ node: e }) {
|
|
118
|
+
return e.marks?.length ? B(e.text, e.marks, 0) : /* @__PURE__ */ a($, { children: e.text });
|
|
119
|
+
}
|
|
120
|
+
function te({ seg: e, index: t }) {
|
|
121
|
+
const n = /* @__PURE__ */ a("span", { className: "qalam-render-verse", children: e.textHafsSmart });
|
|
122
|
+
return e.repeat > 1 ? /* @__PURE__ */ N($, { children: [
|
|
123
|
+
/* @__PURE__ */ a("span", { className: "qalam-render-repeat", children: n }),
|
|
124
|
+
/* @__PURE__ */ a("span", { className: "qalam-render-repeat-badge", children: E(e.repeat) })
|
|
125
|
+
] }) : n;
|
|
126
|
+
}
|
|
127
|
+
function ne({ node: e }) {
|
|
128
|
+
const { resolved: t } = e, n = t.segments.map((s) => s.textCopy).join(" "), r = t.basmalah ? `بِسْمِ اللَّهِ الرَّحْمَـٰنِ الرَّحِيمِ ${n}` : n;
|
|
129
|
+
return /* @__PURE__ */ N("span", { className: "qalam-render-quran", "data-copy": r, "data-citation": t.citation, children: [
|
|
130
|
+
/* @__PURE__ */ a("span", { className: "qalam-render-bracket", children: "﴿" }),
|
|
131
|
+
t.basmalah && /* @__PURE__ */ N($, { children: [
|
|
132
|
+
/* @__PURE__ */ a("span", { className: "qalam-render-basmalah", children: "" }),
|
|
133
|
+
" "
|
|
134
|
+
] }),
|
|
135
|
+
t.segments.map((s, i) => /* @__PURE__ */ N("span", { children: [
|
|
136
|
+
i > 0 && " ",
|
|
137
|
+
/* @__PURE__ */ a(te, { seg: s, index: i })
|
|
138
|
+
] }, i)),
|
|
139
|
+
/* @__PURE__ */ a("span", { className: "qalam-render-bracket", children: "﴾" }),
|
|
140
|
+
e.attrs.showCitation !== !1 && /* @__PURE__ */ a("span", { className: "qalam-render-citation", children: t.citation })
|
|
141
|
+
] });
|
|
142
|
+
}
|
|
143
|
+
function re(e) {
|
|
144
|
+
return e.type !== "text" ? !1 : e.marks?.some((t) => t.type === "propheticSpeech") ?? !1;
|
|
145
|
+
}
|
|
146
|
+
function ae({ node: e }) {
|
|
147
|
+
const { attrs: t, content: n } = e;
|
|
148
|
+
if (!n || n.length === 0)
|
|
149
|
+
return /* @__PURE__ */ a("span", { className: "qalam-render-hadith qalam-render-hadith--empty", children: "[حديث]" });
|
|
150
|
+
const r = n.map((c) => re(c));
|
|
151
|
+
let s = !0;
|
|
152
|
+
for (; s; ) {
|
|
153
|
+
s = !1;
|
|
154
|
+
for (let c = 0; c < n.length; c++)
|
|
155
|
+
n[c].type === "quranRef" && !r[c] && (c > 0 && r[c - 1] || c < n.length - 1 && r[c + 1]) && (r[c] = !0, s = !0);
|
|
156
|
+
}
|
|
157
|
+
const i = [];
|
|
158
|
+
for (let c = 0; c < n.length; c++)
|
|
159
|
+
r[c] && (c === 0 || !r[c - 1]) && i.push(/* @__PURE__ */ a("span", { className: "qalam-render-prophetic-quote", children: "”" }, `q-open-${c}`)), i.push(/* @__PURE__ */ a(_, { node: n[c] }, c)), r[c] && (c === n.length - 1 || !r[c + 1]) && i.push(/* @__PURE__ */ a("span", { className: "qalam-render-prophetic-quote", children: "“" }, `q-close-${c}`));
|
|
160
|
+
return /* @__PURE__ */ N("span", { className: "qalam-render-hadith", children: [
|
|
161
|
+
/* @__PURE__ */ a("span", { className: "qalam-render-hadith-bracket", children: "«" }),
|
|
162
|
+
i,
|
|
163
|
+
/* @__PURE__ */ a("span", { className: "qalam-render-hadith-bracket", children: "»" }),
|
|
164
|
+
t.citation && /* @__PURE__ */ a("span", { className: "qalam-render-hadith-citation", children: t.citation }),
|
|
165
|
+
t.grade && /* @__PURE__ */ N("span", { className: "qalam-render-hadith-grade", children: [
|
|
166
|
+
"(",
|
|
167
|
+
t.grade,
|
|
168
|
+
")"
|
|
169
|
+
] })
|
|
170
|
+
] });
|
|
171
|
+
}
|
|
172
|
+
function _({ node: e }) {
|
|
173
|
+
switch (e.type) {
|
|
174
|
+
case "text":
|
|
175
|
+
return /* @__PURE__ */ a(ee, { node: e });
|
|
176
|
+
case "quranRef":
|
|
177
|
+
return /* @__PURE__ */ a(ne, { node: e });
|
|
178
|
+
case "hadithRef":
|
|
179
|
+
return /* @__PURE__ */ a(ae, { node: e });
|
|
180
|
+
case "hardBreak":
|
|
181
|
+
return /* @__PURE__ */ a("br", {});
|
|
182
|
+
default:
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function se({ node: e }) {
|
|
187
|
+
const t = H(null), [n, r] = F(null), [s, i] = F(!1), [c, o] = F(void 0);
|
|
188
|
+
return G(() => {
|
|
189
|
+
const l = t.current;
|
|
190
|
+
if (!l) return;
|
|
191
|
+
const d = document.createElement("span");
|
|
192
|
+
d.className = "qalam-render-poem__shatr", d.style.position = "absolute", d.style.visibility = "hidden", d.style.whiteSpace = "nowrap", d.style.width = "auto", l.appendChild(d);
|
|
193
|
+
const u = (h) => (d.textContent = h, d.scrollWidth), p = l.parentElement?.clientWidth ?? l.clientWidth, f = 32;
|
|
194
|
+
let q = 1;
|
|
195
|
+
for (const h of e.content)
|
|
196
|
+
!h.attrs.separator && h.attrs.parts.length > q && (q = h.attrs.parts.length);
|
|
197
|
+
const R = p / q, b = R - f;
|
|
198
|
+
let g = !1, k = 0;
|
|
199
|
+
const C = [];
|
|
200
|
+
for (let h = 0; h < e.content.length; h++) {
|
|
201
|
+
const y = e.content[h];
|
|
202
|
+
if (!y.attrs.separator)
|
|
203
|
+
for (let w = 0; w < y.attrs.parts.length; w++) {
|
|
204
|
+
const I = y.attrs.parts[w], W = I ? u(I) : 0;
|
|
205
|
+
C.push({ key: `${h}-${w}`, text: I, naturalWidth: W }), I && (W > k && (k = W), y.attrs.parts.length > 1 && W > b && (g = !0));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
i(g);
|
|
209
|
+
const m = k * 1.3 + f, S = Math.min(m, R), v = g ? k : S - f;
|
|
210
|
+
o(g ? p : Math.min(S * q, p));
|
|
211
|
+
const x = /* @__PURE__ */ new Map();
|
|
212
|
+
for (const { key: h, text: y, naturalWidth: w } of C) {
|
|
213
|
+
if (!y) {
|
|
214
|
+
x.set(h, y);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
w >= v ? x.set(h, y) : x.set(h, Z(y, u, v));
|
|
218
|
+
}
|
|
219
|
+
l.removeChild(d), r(x);
|
|
220
|
+
}, [e]), /* @__PURE__ */ a("div", { ref: t, className: `qalam-render-poem${s ? " qalam-render-poem--stacked" : ""}`, style: c ? { maxWidth: c } : void 0, children: e.content.map(
|
|
221
|
+
(l, d) => l.attrs.separator ? /* @__PURE__ */ a("div", { className: "qalam-render-poem__separator", children: "* * *" }, d) : /* @__PURE__ */ a("div", { className: "qalam-render-poem__bayt", children: l.attrs.parts.map((u, p) => {
|
|
222
|
+
const f = `${d}-${p}`, q = n?.get(f) ?? u;
|
|
223
|
+
return /* @__PURE__ */ a(
|
|
224
|
+
"span",
|
|
225
|
+
{
|
|
226
|
+
className: "qalam-render-poem__shatr",
|
|
227
|
+
"data-shatr-key": f,
|
|
228
|
+
"data-shatr-text": u,
|
|
229
|
+
children: q
|
|
230
|
+
},
|
|
231
|
+
p
|
|
232
|
+
);
|
|
233
|
+
}) }, d)
|
|
234
|
+
) });
|
|
235
|
+
}
|
|
236
|
+
function L({ node: e }) {
|
|
237
|
+
switch (e.type) {
|
|
238
|
+
case "paragraph": {
|
|
239
|
+
const t = e.attrs?.repeat ?? 1;
|
|
240
|
+
return t > 1 ? /* @__PURE__ */ N("p", { className: "qalam-render-block-repeat", children: [
|
|
241
|
+
e.content?.map((n, r) => /* @__PURE__ */ a(_, { node: n }, r)),
|
|
242
|
+
/* @__PURE__ */ a("span", { className: "qalam-render-block-repeat-ghost", children: E(t) }),
|
|
243
|
+
/* @__PURE__ */ a("span", { className: "qalam-render-block-repeat-badge", children: E(t) })
|
|
244
|
+
] }) : /* @__PURE__ */ a("p", { children: e.content?.map((n, r) => /* @__PURE__ */ a(_, { node: n }, r)) });
|
|
245
|
+
}
|
|
246
|
+
case "heading": {
|
|
247
|
+
const t = `h${e.attrs.level}`;
|
|
248
|
+
return /* @__PURE__ */ a(t, { children: e.content?.map((n, r) => /* @__PURE__ */ a(_, { node: n }, r)) });
|
|
249
|
+
}
|
|
250
|
+
case "bulletList":
|
|
251
|
+
return /* @__PURE__ */ a("ul", { children: e.content.map((t, n) => /* @__PURE__ */ a("li", { children: t.content.map((r, s) => /* @__PURE__ */ a(L, { node: r }, s)) }, n)) });
|
|
252
|
+
case "orderedList":
|
|
253
|
+
return /* @__PURE__ */ a("ol", { ...e.attrs?.listType === "abjad" ? { "data-list-type": "abjad" } : {}, children: e.content.map((t, n) => /* @__PURE__ */ a("li", { children: t.content.map((r, s) => /* @__PURE__ */ a(L, { node: r }, s)) }, n)) });
|
|
254
|
+
case "blockquote": {
|
|
255
|
+
const t = e.attrs?.repeat ?? 1;
|
|
256
|
+
return /* @__PURE__ */ N("blockquote", { className: t > 1 ? "qalam-render-block-repeat" : void 0, children: [
|
|
257
|
+
e.content.map((n, r) => /* @__PURE__ */ a(L, { node: n }, r)),
|
|
258
|
+
t > 1 && /* @__PURE__ */ a("span", { className: "qalam-render-block-repeat-badge", children: E(t) })
|
|
259
|
+
] });
|
|
260
|
+
}
|
|
261
|
+
case "poem":
|
|
262
|
+
return /* @__PURE__ */ a(se, { node: e });
|
|
263
|
+
default:
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function oe({ doc: e, className: t, dir: n = "rtl" }) {
|
|
268
|
+
const r = H(null), s = P((i) => {
|
|
269
|
+
const c = window.getSelection();
|
|
270
|
+
if (!c || c.isCollapsed) return;
|
|
271
|
+
const o = r.current;
|
|
272
|
+
if (!o) return;
|
|
273
|
+
const l = c.getRangeAt(0), d = o.querySelectorAll(".qalam-render-quran");
|
|
274
|
+
let u = !1;
|
|
275
|
+
for (const m of d)
|
|
276
|
+
if (l.intersectsNode(m)) {
|
|
277
|
+
u = !0;
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
if (!u) return;
|
|
281
|
+
i.preventDefault();
|
|
282
|
+
const p = l.cloneRange();
|
|
283
|
+
for (const m of d)
|
|
284
|
+
l.intersectsNode(m) && (m.contains(l.startContainer) && p.setStartBefore(m), m.contains(l.endContainer) && p.setEndAfter(m));
|
|
285
|
+
const f = p.cloneContents(), q = document.createTreeWalker(f, NodeFilter.SHOW_ELEMENT), R = [];
|
|
286
|
+
let b = q.currentNode;
|
|
287
|
+
for (; b; )
|
|
288
|
+
b instanceof HTMLElement && b.classList.contains("qalam-render-quran") && R.push(b), b = q.nextNode();
|
|
289
|
+
for (const m of R) {
|
|
290
|
+
const S = m.dataset.copy || "", v = m.dataset.citation || "", x = document.createElement("span");
|
|
291
|
+
x.textContent = `﴿${S}﴾ [${v}]`, m.replaceWith(x);
|
|
292
|
+
}
|
|
293
|
+
const g = document.createElement("div");
|
|
294
|
+
g.appendChild(f), document.body.appendChild(g);
|
|
295
|
+
const k = g.innerText, C = g.innerHTML;
|
|
296
|
+
document.body.removeChild(g), i.clipboardData?.setData("text/plain", k), i.clipboardData?.setData("text/html", C);
|
|
297
|
+
}, []);
|
|
298
|
+
return Q(() => {
|
|
299
|
+
const i = r.current;
|
|
300
|
+
if (i)
|
|
301
|
+
return i.addEventListener("copy", s), () => i.removeEventListener("copy", s);
|
|
302
|
+
}, [s]), /* @__PURE__ */ a("div", { ref: r, className: `qalam-renderer ${t ?? ""}`, dir: n, children: e.content.map((i, c) => /* @__PURE__ */ a(L, { node: i }, c)) });
|
|
303
|
+
}
|
|
304
|
+
export {
|
|
305
|
+
oe as Q
|
|
306
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { QalamDoc } from "../schema/types";
|
|
2
|
+
export interface RepeatConfig {
|
|
3
|
+
quran?: boolean;
|
|
4
|
+
inline?: boolean;
|
|
5
|
+
block?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface QalamEditorProps {
|
|
8
|
+
content?: QalamDoc;
|
|
9
|
+
onChange?: (doc: QalamDoc) => void;
|
|
10
|
+
editable?: boolean;
|
|
11
|
+
dir?: "rtl" | "ltr";
|
|
12
|
+
className?: string;
|
|
13
|
+
repeat?: boolean | RepeatConfig;
|
|
14
|
+
}
|
|
15
|
+
export declare function QalamEditor({ content, onChange, editable, dir, className, repeat, }: QalamEditorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
//# sourceMappingURL=QalamEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QalamEditor.d.ts","sourceRoot":"","sources":["../../src/editor/QalamEditor.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AA0BhD,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;CACjC;AAQD,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,QAAQ,EACR,QAAe,EACf,GAAW,EACX,SAAS,EACT,MAAM,GACP,EAAE,gBAAgB,kDAuDlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HadithRefView.d.ts","sourceRoot":"","sources":["../../../src/editor/components/HadithRefView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,EAAE,aAAa,2CAmChF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PoemView.d.ts","sourceRoot":"","sources":["../../../src/editor/components/PoemView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,aAAa,2CA8K/D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface QuranRefPopoverProps {
|
|
2
|
+
attrs: Record<string, unknown>;
|
|
3
|
+
anchorRef: React.RefObject<HTMLElement | null>;
|
|
4
|
+
onSave: (attrs: Record<string, unknown>) => void;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
enableRepeat?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function QuranRefPopover({ attrs, anchorRef, onSave, onClose, enableRepeat }: QuranRefPopoverProps): import("react").ReactPortal;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=QuranRefPopover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuranRefPopover.d.ts","sourceRoot":"","sources":["../../../src/editor/components/QuranRefPopover.tsx"],"names":[],"mappings":"AAMA,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACjD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAiBD,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,YAAmB,EAAE,EAAE,oBAAoB,+BAmV/G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuranRefView.d.ts","sourceRoot":"","sources":["../../../src/editor/components/QuranRefView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAwBnD,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,aAAa,2CAwFvF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/react";
|
|
2
|
+
interface ToolbarProps {
|
|
3
|
+
editor: Editor;
|
|
4
|
+
repeatConfig: {
|
|
5
|
+
quran: boolean;
|
|
6
|
+
inline: boolean;
|
|
7
|
+
block: boolean;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare function Toolbar({ editor, repeatConfig }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=Toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../src/editor/components/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAI5C,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;CACnE;AAED,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,YAAY,2CAmP7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockquote-repeat.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/blockquote-repeat.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,4FAgB3B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
|
+
declare module "@tiptap/core" {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
hadithRef: {
|
|
5
|
+
insertHadithRef: (attrs?: {
|
|
6
|
+
citation?: string;
|
|
7
|
+
grade?: string;
|
|
8
|
+
}) => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const HadithRef: Node<any, any>;
|
|
13
|
+
//# sourceMappingURL=hadith-ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hadith-ref.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/hadith-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAMrD,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,SAAS,EAAE;YACT,eAAe,EAAE,CAAC,KAAK,CAAC,EAAE;gBACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAClB,KAAK,CAAC,EAAE,MAAM,CAAC;aAChB,KAAK,UAAU,CAAC;SAClB,CAAC;KACH;CACF;AAED,eAAO,MAAM,SAAS,gBAmIpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-repeat.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/inline-repeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAQrD,eAAO,MAAM,YAAY,gBA2BvB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare module "@tiptap/core" {
|
|
2
|
+
interface Commands<ReturnType> {
|
|
3
|
+
qalamOrderedList: {
|
|
4
|
+
setOrderedListType: (listType: "decimal" | "abjad") => ReturnType;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare const QalamOrderedList: import("@tiptap/core").Node<import("@tiptap/extension-list").OrderedListOptions, any>;
|
|
9
|
+
//# sourceMappingURL=ordered-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ordered-list.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/ordered-list.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,gBAAgB,EAAE;YAChB,kBAAkB,EAAE,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,KAAK,UAAU,CAAC;SACnE,CAAC;KACH;CACF;AAED,eAAO,MAAM,gBAAgB,uFAyC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paragraph-repeat.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/paragraph-repeat.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,0FA8B1B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
|
+
declare module "@tiptap/core" {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
poem: {
|
|
5
|
+
insertPoem: () => ReturnType;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
declare const Bayt: Node<any, any>;
|
|
10
|
+
declare const Poem: Node<any, any>;
|
|
11
|
+
export { Poem, Bayt };
|
|
12
|
+
//# sourceMappingURL=poem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poem.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/poem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAIrD,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,IAAI,EAAE;YACJ,UAAU,EAAE,MAAM,UAAU,CAAC;SAC9B,CAAC;KACH;CACF;AAED,QAAA,MAAM,IAAI,gBAoCR,CAAC;AAEH,QAAA,MAAM,IAAI,gBAmCR,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prophetic-speech.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/prophetic-speech.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAErD,eAAO,MAAM,eAAe,gBAgB1B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
|
+
import type { QuranSegment } from "../../schema/types";
|
|
3
|
+
export interface QuranRefOptions {
|
|
4
|
+
HTMLAttributes: Record<string, unknown>;
|
|
5
|
+
enableRepeat: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare module "@tiptap/core" {
|
|
8
|
+
interface Commands<ReturnType> {
|
|
9
|
+
quranRef: {
|
|
10
|
+
insertQuranRef: (attrs: {
|
|
11
|
+
surah: number;
|
|
12
|
+
surahName: string;
|
|
13
|
+
basmalah?: boolean;
|
|
14
|
+
showCitation?: boolean;
|
|
15
|
+
segments?: QuranSegment[];
|
|
16
|
+
}) => ReturnType;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare const QuranRef: Node<QuranRefOptions, any>;
|
|
21
|
+
//# sourceMappingURL=quran-ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quran-ref.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/quran-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAIrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,YAAY,EAAE,OAAO,CAAC;CACvB;AAUD,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,QAAQ,EAAE;YACR,cAAc,EAAE,CAAC,KAAK,EAAE;gBACtB,KAAK,EAAE,MAAM,CAAC;gBACd,SAAS,EAAE,MAAM,CAAC;gBAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;gBACnB,YAAY,CAAC,EAAE,OAAO,CAAC;gBACvB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;aAC3B,KAAK,UAAU,CAAC;SAClB,CAAC;KACH;CACF;AAED,eAAO,MAAM,QAAQ,4BA2EnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
/**
|
|
3
|
+
* Strips disallowed marks/attrs on paste.
|
|
4
|
+
* Only allows: bold, italic, link, text, paragraph, heading, bulletList, orderedList, listItem, blockquote, hardBreak, quranRef
|
|
5
|
+
*/
|
|
6
|
+
export declare const StrictSchema: Extension<any, any>;
|
|
7
|
+
//# sourceMappingURL=strict-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strict-schema.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/strict-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC;;;GAGG;AACH,eAAO,MAAM,YAAY,qBAevB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { validateAST as e } from "./schema/index.js";
|
|
2
|
+
import { Q as m, a as t } from "./QalamEditor-DlA4iLRR.js";
|
|
3
|
+
import { Q } from "./QalamRenderer-CMsfcF02.js";
|
|
4
|
+
import { resolveAST as p } from "./resolver/index.js";
|
|
5
|
+
export {
|
|
6
|
+
m as QalamEditor,
|
|
7
|
+
Q as QalamRenderer,
|
|
8
|
+
t as QuranRef,
|
|
9
|
+
p as resolveAST,
|
|
10
|
+
e as validateAST
|
|
11
|
+
};
|