@siladev/qalam 0.1.15 → 0.2.1

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 (33) hide show
  1. package/dist/{QalamEditor-DJFh0zOj.js → QalamEditor-sYrI0Izl.js} +3871 -3693
  2. package/dist/QalamRenderer-CbbJYMLn.js +350 -0
  3. package/dist/editor/QalamEditor.d.ts.map +1 -1
  4. package/dist/editor/components/AutoInput.d.ts +9 -0
  5. package/dist/editor/components/AutoInput.d.ts.map +1 -0
  6. package/dist/editor/components/BlockquoteView.d.ts +3 -0
  7. package/dist/editor/components/BlockquoteView.d.ts.map +1 -0
  8. package/dist/editor/components/HadithRefView.d.ts.map +1 -1
  9. package/dist/editor/components/PoemView.d.ts +1 -1
  10. package/dist/editor/components/PoemView.d.ts.map +1 -1
  11. package/dist/editor/components/QuoteView.d.ts +3 -0
  12. package/dist/editor/components/QuoteView.d.ts.map +1 -0
  13. package/dist/editor/components/Toolbar.d.ts.map +1 -1
  14. package/dist/editor/extensions/blockquote-repeat.d.ts.map +1 -1
  15. package/dist/editor/extensions/poem.d.ts.map +1 -1
  16. package/dist/editor/extensions/quote.d.ts +12 -0
  17. package/dist/editor/extensions/quote.d.ts.map +1 -0
  18. package/dist/editor/index.js +1 -1
  19. package/dist/index.js +2 -2
  20. package/dist/renderer/QalamRenderer.d.ts.map +1 -1
  21. package/dist/renderer/index.js +1 -1
  22. package/dist/renderer/tatweel.d.ts.map +1 -1
  23. package/dist/resolver/index.js +18 -13
  24. package/dist/resolver/resolve.d.ts.map +1 -1
  25. package/dist/schema/index.d.ts +1 -1
  26. package/dist/schema/index.d.ts.map +1 -1
  27. package/dist/schema/index.js +58 -39
  28. package/dist/schema/schema.d.ts.map +1 -1
  29. package/dist/schema/types.d.ts +24 -2
  30. package/dist/schema/types.d.ts.map +1 -1
  31. package/dist/styles.css +228 -6
  32. package/package.json +1 -1
  33. package/dist/QalamRenderer-h6i48SCj.js +0 -309
@@ -0,0 +1,350 @@
1
+ import { jsx as r, jsxs as g, Fragment as A } from "react/jsx-runtime";
2
+ import { useRef as O, useCallback as G, useEffect as J, useState as F, useLayoutEffect as K } from "react";
3
+ const v = "ـ", U = new Set("سشصض"), V = new Set("ةهد"), z = new Set("طلكگ"), X = new Set("عقف"), M = new Set(
4
+ "بتثجحخسشصضطظعغفقكلمنهيئپچژگ"
5
+ );
6
+ new Set("ادذرزوأإآؤ");
7
+ const Y = new Set("اأإآ");
8
+ function B(e) {
9
+ const t = e.charCodeAt(0);
10
+ return t >= 1569 && t <= 1610 || t >= 1646 && t <= 1747 || t >= 64336 && t <= 65023;
11
+ }
12
+ function S(e) {
13
+ const t = e.charCodeAt(0);
14
+ return t >= 1611 && t <= 1631;
15
+ }
16
+ function D(e, t) {
17
+ const n = e[t];
18
+ if (!M.has(n)) return !1;
19
+ for (let a = t + 1; a < e.length; a++)
20
+ if (!S(e[a]))
21
+ return B(e[a]);
22
+ return !1;
23
+ }
24
+ function Z(e, t) {
25
+ for (let n = t + 1; n < e.length; n++)
26
+ if (!S(e[n])) {
27
+ if (B(e[n])) return !1;
28
+ break;
29
+ }
30
+ return !0;
31
+ }
32
+ function ee(e, t) {
33
+ for (let n = t - 1; n >= 0; n--)
34
+ if (!S(e[n]))
35
+ return M.has(e[n]);
36
+ return !1;
37
+ }
38
+ function H(e, t) {
39
+ if (e[t] !== "ل") return !1;
40
+ for (let n = t + 1; n < e.length; n++)
41
+ if (!S(e[n]))
42
+ return Y.has(e[n]);
43
+ return !1;
44
+ }
45
+ function te(e) {
46
+ const t = [];
47
+ for (let n = 0; n < e.length; n++) {
48
+ const a = e[n];
49
+ if (a.includes(v)) continue;
50
+ let s = null;
51
+ for (let i = 0; i < a.length; i++) {
52
+ if (S(a[i])) continue;
53
+ const c = a[i];
54
+ if (U.has(c) && D(a, i) && !H(a, i)) {
55
+ const l = { wordIndex: n, charIndex: i + 1, priority: 1 };
56
+ (!s || l.priority < s.priority) && (s = l);
57
+ continue;
58
+ }
59
+ if (Z(a, i) && ee(a, i)) {
60
+ let l = 0;
61
+ if (V.has(c) ? l = 2 : z.has(c) ? l = 3 : X.has(c) && (l = 4), l > 0) {
62
+ const d = { wordIndex: n, charIndex: i, priority: l };
63
+ (!s || d.priority < s.priority) && (s = d);
64
+ continue;
65
+ }
66
+ }
67
+ if (M.has(c) && D(a, i) && !H(a, i)) {
68
+ const l = { wordIndex: n, charIndex: i + 1, priority: 5 };
69
+ (!s || l.priority < s.priority) && (s = l);
70
+ }
71
+ }
72
+ s && t.push(s);
73
+ }
74
+ return t;
75
+ }
76
+ function P(e, t) {
77
+ for (; t < e.length && S(e[t]); ) t++;
78
+ return t;
79
+ }
80
+ function j(e, t, n = 1) {
81
+ const a = P(e, t);
82
+ return e.slice(0, a) + v.repeat(n) + e.slice(a);
83
+ }
84
+ function ne(e, t, n, a = 50) {
85
+ let s = e, i = t(s);
86
+ if (i >= n) return s;
87
+ for (let c = 0; c < a; c++) {
88
+ const l = s.split(" "), d = te(l);
89
+ if (d.length === 0) {
90
+ const m = l.map((o, h) => ({ word: o, index: h })).filter(({ word: o }) => o.includes(v));
91
+ if (m.length === 0) break;
92
+ for (const { word: o, index: h } of m) {
93
+ const f = o.indexOf(v), k = o.split(v).length - 1;
94
+ if (k === 2) {
95
+ const b = P(o, f + k);
96
+ if (b < o.length && o[b] === "ا") {
97
+ const q = j(o, f, 2), y = [...l];
98
+ y[h] = q;
99
+ const R = t(y.join(" "));
100
+ R <= n && (l[h] = q, s = y.join(" "), i = R);
101
+ continue;
102
+ }
103
+ }
104
+ if (l[h] = j(o, f, 1), s = l.join(" "), i = t(s), i >= n) return s;
105
+ }
106
+ continue;
107
+ }
108
+ d.sort((m, o) => m.priority - o.priority);
109
+ const p = d[0];
110
+ if (l[p.wordIndex] = j(l[p.wordIndex], p.charIndex), s = l.join(" "), i = t(s), i >= n) return s;
111
+ }
112
+ return s;
113
+ }
114
+ function C(e) {
115
+ if (e === 2) return "(مرتان)";
116
+ const t = e.toString().replace(/\d/g, (n) => "٠١٢٣٤٥٦٧٨٩"[parseInt(n)]);
117
+ return e > 10 ? `(${t} مرة)` : `(${t} مرات)`;
118
+ }
119
+ function Q(e, t, n) {
120
+ if (n >= t.length) return /* @__PURE__ */ r(A, { children: e });
121
+ const a = t[n], s = Q(e, t, n + 1);
122
+ switch (a.type) {
123
+ case "bold":
124
+ return /* @__PURE__ */ r("strong", { children: s });
125
+ case "italic":
126
+ return /* @__PURE__ */ r("em", { children: s });
127
+ case "link":
128
+ return /* @__PURE__ */ r("a", { href: a.attrs.href, target: a.attrs.target ?? "_blank", rel: "noopener noreferrer", children: s });
129
+ case "repeat":
130
+ return /* @__PURE__ */ g("span", { className: "qalam-render-inline-repeat", children: [
131
+ s,
132
+ /* @__PURE__ */ r("span", { className: "qalam-render-inline-repeat-badge", children: C(a.attrs.count) })
133
+ ] });
134
+ case "propheticSpeech":
135
+ return /* @__PURE__ */ r("span", { className: "qalam-render-prophetic-speech", children: s });
136
+ default:
137
+ return s;
138
+ }
139
+ }
140
+ function ae({ node: e }) {
141
+ return e.marks?.length ? Q(e.text, e.marks, 0) : /* @__PURE__ */ r(A, { children: e.text });
142
+ }
143
+ function re({ seg: e, index: t }) {
144
+ const n = /* @__PURE__ */ r("span", { className: "qalam-render-verse", children: e.textHafsSmart });
145
+ return e.repeat > 1 ? /* @__PURE__ */ g(A, { children: [
146
+ /* @__PURE__ */ r("span", { className: "qalam-render-repeat", children: n }),
147
+ /* @__PURE__ */ r("span", { className: "qalam-render-repeat-badge", children: C(e.repeat) })
148
+ ] }) : n;
149
+ }
150
+ function se({ node: e }) {
151
+ const { resolved: t } = e, n = t.segments.map((s) => s.textCopy).join(" "), a = t.basmalah ? `بِسْمِ اللَّهِ الرَّحْمَـٰنِ الرَّحِيمِ ${n}` : n;
152
+ return /* @__PURE__ */ g("span", { className: "qalam-render-quran", "data-copy": a, "data-citation": t.citation, children: [
153
+ /* @__PURE__ */ r("span", { className: "qalam-render-seo", "aria-hidden": "false", children: a }),
154
+ /* @__PURE__ */ g("span", { "aria-hidden": "true", children: [
155
+ /* @__PURE__ */ r("span", { className: "qalam-render-bracket", children: "﴿" }),
156
+ t.basmalah && /* @__PURE__ */ g(A, { children: [
157
+ /* @__PURE__ */ r("span", { className: "qalam-render-basmalah", children: "" }),
158
+ " "
159
+ ] }),
160
+ t.segments.map((s, i) => /* @__PURE__ */ g("span", { children: [
161
+ i > 0 && " ",
162
+ /* @__PURE__ */ r(re, { seg: s, index: i })
163
+ ] }, i)),
164
+ /* @__PURE__ */ r("span", { className: "qalam-render-bracket", children: "﴾" })
165
+ ] }),
166
+ e.attrs.showCitation !== !1 && /* @__PURE__ */ r("span", { className: "qalam-render-citation", children: `[${t.citation}]` })
167
+ ] });
168
+ }
169
+ function ce(e) {
170
+ return e.type !== "text" ? !1 : e.marks?.some((t) => t.type === "propheticSpeech") ?? !1;
171
+ }
172
+ function ie({ node: e }) {
173
+ const { attrs: t, content: n } = e;
174
+ if (!n || n.length === 0)
175
+ return /* @__PURE__ */ r("span", { className: "qalam-render-hadith qalam-render-hadith--empty", children: "[حديث]" });
176
+ const a = n.map((c) => ce(c));
177
+ let s = !0;
178
+ for (; s; ) {
179
+ s = !1;
180
+ for (let c = 0; c < n.length; c++)
181
+ n[c].type === "quranRef" && !a[c] && (c > 0 && a[c - 1] || c < n.length - 1 && a[c + 1]) && (a[c] = !0, s = !0);
182
+ }
183
+ const i = [];
184
+ for (let c = 0; c < n.length; c++)
185
+ a[c] && (c === 0 || !a[c - 1]) && i.push(/* @__PURE__ */ r("span", { className: "qalam-render-prophetic-quote", children: "”" }, `q-open-${c}`)), i.push(/* @__PURE__ */ r(_, { node: n[c] }, c)), a[c] && (c === n.length - 1 || !a[c + 1]) && i.push(/* @__PURE__ */ r("span", { className: "qalam-render-prophetic-quote", children: "“" }, `q-close-${c}`));
186
+ return /* @__PURE__ */ g("span", { className: "qalam-render-hadith", children: [
187
+ /* @__PURE__ */ r("span", { className: "qalam-render-hadith-bracket", children: "«" }),
188
+ i,
189
+ /* @__PURE__ */ r("span", { className: "qalam-render-hadith-bracket", children: "»" }),
190
+ t.citation && /* @__PURE__ */ r("span", { className: "qalam-render-hadith-citation", children: `[${t.citation}]` }),
191
+ t.grade && /* @__PURE__ */ g("span", { className: "qalam-render-hadith-grade", children: [
192
+ "(",
193
+ t.grade,
194
+ ")"
195
+ ] })
196
+ ] });
197
+ }
198
+ function le({ node: e }) {
199
+ const t = e.attrs?.citation;
200
+ return /* @__PURE__ */ g("span", { className: "qalam-render-quote", children: [
201
+ /* @__PURE__ */ r("span", { className: "qalam-render-quote-bracket", children: "”" }),
202
+ e.content?.map((n, a) => /* @__PURE__ */ r(_, { node: n }, a)),
203
+ /* @__PURE__ */ r("span", { className: "qalam-render-quote-bracket", children: "“" }),
204
+ t && /* @__PURE__ */ r("cite", { className: "qalam-render-quote-citation", children: ` [${t}]` })
205
+ ] });
206
+ }
207
+ function _({ node: e }) {
208
+ switch (e.type) {
209
+ case "text":
210
+ return /* @__PURE__ */ r(ae, { node: e });
211
+ case "quranRef":
212
+ return /* @__PURE__ */ r(se, { node: e });
213
+ case "hadithRef":
214
+ return /* @__PURE__ */ r(ie, { node: e });
215
+ case "quote":
216
+ return /* @__PURE__ */ r(le, { node: e });
217
+ case "hardBreak":
218
+ return /* @__PURE__ */ r("br", {});
219
+ default:
220
+ return null;
221
+ }
222
+ }
223
+ function oe({ node: e }) {
224
+ const t = O(null), [n, a] = F(null), [s, i] = F(!1), [c, l] = F(void 0);
225
+ return K(() => {
226
+ const d = t.current;
227
+ if (!d) return;
228
+ const p = document.createElement("span");
229
+ p.className = "qalam-render-poem__shatr", p.style.position = "absolute", p.style.visibility = "hidden", p.style.whiteSpace = "nowrap", p.style.width = "auto", d.appendChild(p);
230
+ const m = (u) => (p.textContent = u, p.scrollWidth), o = d.parentElement?.clientWidth ?? d.clientWidth, h = 32;
231
+ let f = 1;
232
+ for (const u of e.content)
233
+ !u.attrs.separator && u.attrs.parts.length > f && (f = u.attrs.parts.length);
234
+ const k = o / f, b = k - h;
235
+ let q = !1, y = 0;
236
+ const R = [];
237
+ for (let u = 0; u < e.content.length; u++) {
238
+ const x = e.content[u];
239
+ if (!x.attrs.separator)
240
+ for (let w = 0; w < x.attrs.parts.length; w++) {
241
+ const W = x.attrs.parts[w], $ = W ? m(W) : 0;
242
+ R.push({ key: `${u}-${w}`, text: W, naturalWidth: $ }), W && ($ > y && (y = $), x.attrs.parts.length > 1 && $ > b && (q = !0));
243
+ }
244
+ }
245
+ i(q);
246
+ const N = y * 1.3 + h, I = Math.min(N, k), L = q ? y : I - h;
247
+ l(q ? o : Math.min(I * f, o));
248
+ const E = /* @__PURE__ */ new Map();
249
+ for (const { key: u, text: x, naturalWidth: w } of R) {
250
+ if (!x) {
251
+ E.set(u, x);
252
+ continue;
253
+ }
254
+ w >= L ? E.set(u, x) : E.set(u, ne(x, m, L));
255
+ }
256
+ d.removeChild(p), a(E);
257
+ }, [e]), /* @__PURE__ */ g("div", { ref: t, className: `qalam-render-poem${s ? " qalam-render-poem--stacked" : ""}`, style: c ? { maxWidth: c } : void 0, children: [
258
+ e.content.map(
259
+ (d, p) => d.attrs.separator ? /* @__PURE__ */ r("div", { className: "qalam-render-poem__separator", children: "* * *" }, p) : /* @__PURE__ */ g("div", { className: "qalam-render-poem__bayt", children: [
260
+ d.attrs.parts.map((m, o) => {
261
+ const h = `${p}-${o}`, f = n?.get(h) ?? m;
262
+ return /* @__PURE__ */ r(
263
+ "span",
264
+ {
265
+ className: "qalam-render-poem__shatr",
266
+ "data-shatr-key": h,
267
+ "data-shatr-text": m,
268
+ children: f
269
+ },
270
+ o
271
+ );
272
+ }),
273
+ (d.attrs.repeat ?? 1) > 1 && /* @__PURE__ */ r("span", { className: "qalam-render-poem__repeat-badge", children: C(d.attrs.repeat) })
274
+ ] }, p)
275
+ ),
276
+ e.attrs?.citation && /* @__PURE__ */ r("cite", { className: "qalam-render-poem-citation", children: `[${e.attrs.citation}]` })
277
+ ] });
278
+ }
279
+ function T({ node: e }) {
280
+ switch (e.type) {
281
+ case "paragraph": {
282
+ const t = e.attrs?.repeat ?? 1;
283
+ return t > 1 ? /* @__PURE__ */ g("p", { className: "qalam-render-block-repeat", children: [
284
+ e.content?.map((n, a) => /* @__PURE__ */ r(_, { node: n }, a)),
285
+ /* @__PURE__ */ r("span", { className: "qalam-render-block-repeat-ghost", children: C(t) }),
286
+ /* @__PURE__ */ r("span", { className: "qalam-render-block-repeat-badge", children: C(t) })
287
+ ] }) : /* @__PURE__ */ r("p", { children: e.content?.map((n, a) => /* @__PURE__ */ r(_, { node: n }, a)) });
288
+ }
289
+ case "heading": {
290
+ const t = `h${e.attrs.level}`;
291
+ return /* @__PURE__ */ r(t, { children: e.content?.map((n, a) => /* @__PURE__ */ r(_, { node: n }, a)) });
292
+ }
293
+ case "bulletList":
294
+ return /* @__PURE__ */ r("ul", { children: e.content.map((t, n) => /* @__PURE__ */ r("li", { children: t.content.map((a, s) => /* @__PURE__ */ r(T, { node: a }, s)) }, n)) });
295
+ case "orderedList":
296
+ return /* @__PURE__ */ r("ol", { ...e.attrs?.listType === "abjad" ? { "data-list-type": "abjad", style: { "--qalam-ol-style": "abjad" } } : {}, children: e.content.map((t, n) => /* @__PURE__ */ r("li", { children: t.content.map((a, s) => /* @__PURE__ */ r(T, { node: a }, s)) }, n)) });
297
+ case "blockquote": {
298
+ const t = e.attrs?.repeat ?? 1, n = e.attrs?.citation;
299
+ return /* @__PURE__ */ g("blockquote", { className: t > 1 ? "qalam-render-block-repeat" : void 0, ...n ? { "data-citation": n } : {}, children: [
300
+ e.content.map((a, s) => /* @__PURE__ */ r(T, { node: a }, s)),
301
+ n && /* @__PURE__ */ r("cite", { className: "qalam-render-blockquote-citation", children: `[${n}]` }),
302
+ t > 1 && /* @__PURE__ */ r("span", { className: "qalam-render-block-repeat-badge", children: C(t) })
303
+ ] });
304
+ }
305
+ case "poem":
306
+ return /* @__PURE__ */ r(oe, { node: e });
307
+ default:
308
+ return null;
309
+ }
310
+ }
311
+ function he({ doc: e, className: t, dir: n = "rtl" }) {
312
+ const a = O(null), s = G((i) => {
313
+ const c = window.getSelection();
314
+ if (!c || c.isCollapsed) return;
315
+ const l = a.current;
316
+ if (!l) return;
317
+ const d = c.getRangeAt(0), p = l.querySelectorAll(".qalam-render-quran");
318
+ let m = !1;
319
+ for (const N of p)
320
+ if (d.intersectsNode(N)) {
321
+ m = !0;
322
+ break;
323
+ }
324
+ if (!m) return;
325
+ i.preventDefault();
326
+ const o = d.cloneRange();
327
+ for (const N of p)
328
+ d.intersectsNode(N) && (N.contains(d.startContainer) && o.setStartBefore(N), N.contains(d.endContainer) && o.setEndAfter(N));
329
+ const h = o.cloneContents(), f = document.createTreeWalker(h, NodeFilter.SHOW_ELEMENT), k = [];
330
+ let b = f.currentNode;
331
+ for (; b; )
332
+ b instanceof HTMLElement && b.classList.contains("qalam-render-quran") && k.push(b), b = f.nextNode();
333
+ for (const N of k) {
334
+ const I = N.dataset.copy || "", L = N.dataset.citation || "", E = document.createElement("span");
335
+ E.textContent = `﴿${I}﴾ [${L}]`, N.replaceWith(E);
336
+ }
337
+ const q = document.createElement("div");
338
+ q.appendChild(h), document.body.appendChild(q);
339
+ const y = q.innerText, R = q.innerHTML;
340
+ document.body.removeChild(q), i.clipboardData?.setData("text/plain", y), i.clipboardData?.setData("text/html", R);
341
+ }, []);
342
+ return J(() => {
343
+ const i = a.current;
344
+ if (i)
345
+ return i.addEventListener("copy", s), () => i.removeEventListener("copy", s);
346
+ }, [s]), /* @__PURE__ */ r("div", { ref: a, className: `qalam-renderer ${t ?? ""}`, dir: n, children: e.content.map((i, c) => /* @__PURE__ */ r(T, { node: i }, c)) });
347
+ }
348
+ export {
349
+ he as Q
350
+ };
@@ -1 +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"}
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,kDAwDlB"}
@@ -0,0 +1,9 @@
1
+ interface AutoInputProps {
2
+ className?: string;
3
+ value: string;
4
+ placeholder: string;
5
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
6
+ }
7
+ export declare function AutoInput({ className, value, placeholder, onChange }: AutoInputProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=AutoInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoInput.d.ts","sourceRoot":"","sources":["../../../src/editor/components/AutoInput.tsx"],"names":[],"mappings":"AAAA,UAAU,cAAc;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC5D;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,cAAc,2CAapF"}
@@ -0,0 +1,3 @@
1
+ import type { NodeViewProps } from "@tiptap/react";
2
+ export declare function BlockquoteView({ node, updateAttributes }: NodeViewProps): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=BlockquoteView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlockquoteView.d.ts","sourceRoot":"","sources":["../../../src/editor/components/BlockquoteView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AASnD,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,aAAa,2CAqBvE"}
@@ -1 +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"}
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;AAGnD,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,EAAE,aAAa,2CA8BhF"}
@@ -1,3 +1,3 @@
1
1
  import type { NodeViewProps } from "@tiptap/react";
2
- export declare function PoemView({ node, getPos, editor }: NodeViewProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function PoemView({ node, getPos, editor, updateAttributes }: NodeViewProps): import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=PoemView.d.ts.map
@@ -1 +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"}
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;AAInD,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,aAAa,2CAsMjF"}
@@ -0,0 +1,3 @@
1
+ import type { NodeViewProps } from "@tiptap/react";
2
+ export declare function QuoteView({ node, updateAttributes, selected }: NodeViewProps): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=QuoteView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuoteView.d.ts","sourceRoot":"","sources":["../../../src/editor/components/QuoteView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,EAAE,aAAa,2CAuB5E"}
@@ -1 +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,2CA8P7D"}
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,2CA4Q7D"}
@@ -1 +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"}
1
+ {"version":3,"file":"blockquote-repeat.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/blockquote-repeat.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,4FAyB3B,CAAC"}
@@ -1 +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"}
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,gBA4CR,CAAC;AAEH,QAAA,MAAM,IAAI,gBAgDR,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Node } from "@tiptap/core";
2
+ declare module "@tiptap/core" {
3
+ interface Commands<ReturnType> {
4
+ quote: {
5
+ insertQuote: (attrs?: {
6
+ citation?: string;
7
+ }) => ReturnType;
8
+ };
9
+ }
10
+ }
11
+ export declare const Quote: Node<any, any>;
12
+ //# sourceMappingURL=quote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quote.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/quote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAIrD,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,KAAK,EAAE;YACL,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE;gBAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;aAAE,KAAK,UAAU,CAAC;SAC5D,CAAC;KACH;CACF;AAED,eAAO,MAAM,KAAK,gBA0EhB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Q as o, a as Q } from "../QalamEditor-DJFh0zOj.js";
1
+ import { Q as o, a as Q } from "../QalamEditor-sYrI0Izl.js";
2
2
  export {
3
3
  o as QalamEditor,
4
4
  Q as QuranRef
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { validateAST as e } from "./schema/index.js";
2
- import { Q as s, a as t } from "./QalamEditor-DJFh0zOj.js";
3
- import { Q as f } from "./QalamRenderer-h6i48SCj.js";
2
+ import { Q as s, a as t } from "./QalamEditor-sYrI0Izl.js";
3
+ import { Q as f } from "./QalamRenderer-CbbJYMLn.js";
4
4
  import { resolveAST as d } from "./resolver/index.js";
5
5
  import { g as Q, a as p, b as u, i as S, l as g, r as i } from "./lookup-CFbcujyG.js";
6
6
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"QalamRenderer.d.ts","sourceRoot":"","sources":["../../src/renderer/QalamRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EASjB,MAAM,iBAAiB,CAAC;AAIzB,UAAU,kBAAkB;IAC1B,GAAG,EAAE,gBAAgB,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;CACrB;AAqVD,wBAAgB,aAAa,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,GAAW,EAAE,EAAE,kBAAkB,2CAmFhF"}
1
+ {"version":3,"file":"QalamRenderer.d.ts","sourceRoot":"","sources":["../../src/renderer/QalamRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAUjB,MAAM,iBAAiB,CAAC;AAIzB,UAAU,kBAAkB;IAC1B,GAAG,EAAE,gBAAgB,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;CACrB;AA2WD,wBAAgB,aAAa,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,GAAW,EAAE,EAAE,kBAAkB,2CAmFhF"}
@@ -1,4 +1,4 @@
1
- import { Q as a } from "../QalamRenderer-h6i48SCj.js";
1
+ import { Q as a } from "../QalamRenderer-CbbJYMLn.js";
2
2
  export {
3
3
  a as QalamRenderer
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tatweel.d.ts","sourceRoot":"","sources":["../../src/renderer/tatweel.ts"],"names":[],"mappings":"AAuHA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EACnC,WAAW,EAAE,MAAM,EACnB,aAAa,GAAE,MAAW,GACzB,MAAM,CA0CR"}
1
+ {"version":3,"file":"tatweel.d.ts","sourceRoot":"","sources":["../../src/renderer/tatweel.ts"],"names":[],"mappings":"AA2IA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EACnC,WAAW,EAAE,MAAM,EACnB,aAAa,GAAE,MAAW,GACzB,MAAM,CA6DR"}
@@ -1,18 +1,23 @@
1
- import { b as d } from "../lookup-CFbcujyG.js";
2
- function s(t) {
1
+ import { b as x } from "../lookup-CFbcujyG.js";
2
+ function c(t) {
3
3
  return t.toString().replace(/\d/g, (n) => "٠١٢٣٤٥٦٧٨٩"[parseInt(n)]);
4
4
  }
5
- function c(t) {
5
+ function o(t) {
6
+ if (t.type === "quote")
7
+ return {
8
+ ...t,
9
+ content: t.content?.map(o)
10
+ };
6
11
  if (t.type === "hadithRef") {
7
12
  const e = t;
8
13
  return {
9
14
  ...e,
10
- content: e.content?.map(c)
15
+ content: e.content?.map(o)
11
16
  };
12
17
  }
13
18
  if (t.type !== "quranRef") return t;
14
19
  const n = t, { surah: m, surahName: p, basmalah: f, segments: r } = n.attrs, h = r.map((e, A) => {
15
- const o = d(
20
+ const s = x(
16
21
  m,
17
22
  e.fromAya,
18
23
  e.fromWord ?? null,
@@ -21,12 +26,12 @@ function c(t) {
21
26
  A === 0 && f
22
27
  );
23
28
  return {
24
- text: o?.text ?? "",
25
- textHafsSmart: o?.textHafsSmart ?? "",
26
- textCopy: o?.textCopy ?? "",
29
+ text: s?.text ?? "",
30
+ textHafsSmart: s?.textHafsSmart ?? "",
31
+ textCopy: s?.textCopy ?? "",
27
32
  repeat: e.repeat
28
33
  };
29
- }), a = r[0]?.fromAya ?? 1, l = r[r.length - 1], i = l?.toAya ?? l?.fromAya ?? a, y = a === i ? `${p}: ${s(a)}` : `${p}: ${s(a)}-${s(i)}`;
34
+ }), a = r[0]?.fromAya ?? 1, i = r[r.length - 1], l = i?.toAya ?? i?.fromAya ?? a, y = a === l ? `${p}: ${c(a)}` : `${p}: ${c(a)}-${c(l)}`;
30
35
  return { ...n, resolved: { segments: h, citation: y, basmalah: f && m !== 1 } };
31
36
  }
32
37
  function u(t) {
@@ -34,12 +39,12 @@ function u(t) {
34
39
  case "paragraph":
35
40
  return {
36
41
  ...t,
37
- content: t.content?.map(c)
42
+ content: t.content?.map(o)
38
43
  };
39
44
  case "heading":
40
45
  return {
41
46
  ...t,
42
- content: t.content?.map(c)
47
+ content: t.content?.map(o)
43
48
  };
44
49
  case "bulletList":
45
50
  case "orderedList":
@@ -61,12 +66,12 @@ function u(t) {
61
66
  return t;
62
67
  }
63
68
  }
64
- function S(t) {
69
+ function d(t) {
65
70
  return {
66
71
  type: "doc",
67
72
  content: t.content.map(u)
68
73
  };
69
74
  }
70
75
  export {
71
- S as resolveAST
76
+ d as resolveAST
72
77
  };
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/resolver/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAWjB,MAAM,iBAAiB,CAAC;AAuFzB,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,gBAAgB,CAK1D"}
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/resolver/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAWjB,MAAM,iBAAiB,CAAC;AA6FzB,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,gBAAgB,CAK1D"}
@@ -1,3 +1,3 @@
1
1
  export { validateAST, type ValidationResult } from "./schema";
2
- export type { QalamDoc, QalamDocResolved, QalamBlock, QalamBlockResolved, QalamInline, QalamInlineResolved, QalamParagraph, QalamHeading, QalamText, QalamQuranRef, QalamQuranRefResolved, QalamBoldMark, QalamItalicMark, QalamLinkMark, QalamMark, QuranSegment, QuranRefAttrs, ResolvedQuranSegment, ResolvedQuranData, } from "./types";
2
+ export type { QalamDoc, QalamDocResolved, QalamBlock, QalamBlockResolved, QalamInline, QalamInlineResolved, QalamParagraph, QalamHeading, QalamText, QalamQuranRef, QalamQuranRefResolved, QalamBoldMark, QalamItalicMark, QalamLinkMark, QalamMark, QalamQuote, QalamQuoteResolved, QalamQuoteContent, QalamQuoteContentResolved, QuranSegment, QuranRefAttrs, ResolvedQuranSegment, ResolvedQuranData, } from "./types";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EACzB,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,SAAS,CAAC"}