@siladev/qalam 0.1.9 → 0.1.10
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/{QalamEditor-B9TpSq98.js → QalamEditor-Db0zWaPG.js} +4 -1
- package/dist/{QalamRenderer-DrrLH1Fg.js → QalamRenderer-h6i48SCj.js} +27 -27
- package/dist/editor/extensions/ordered-list.d.ts.map +1 -1
- package/dist/editor/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/renderer/index.js +1 -1
- package/dist/styles.css +2 -8
- package/package.json +1 -1
|
@@ -17219,7 +17219,10 @@ const _b = Su.extend({
|
|
|
17219
17219
|
listType: {
|
|
17220
17220
|
default: "decimal",
|
|
17221
17221
|
parseHTML: (n) => n.dataset.listType || "decimal",
|
|
17222
|
-
renderHTML: (n) => n.listType === "abjad" ? {
|
|
17222
|
+
renderHTML: (n) => n.listType === "abjad" ? {
|
|
17223
|
+
"data-list-type": "abjad",
|
|
17224
|
+
style: "--qalam-ol-style: abjad"
|
|
17225
|
+
} : {}
|
|
17223
17226
|
}
|
|
17224
17227
|
};
|
|
17225
17228
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
1
|
+
import { jsx as a, jsxs as g, Fragment as $ } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as H, useCallback as P, useEffect as Q, useState as F, useLayoutEffect as G } from "react";
|
|
3
3
|
const T = "ـ", J = new Set("سشصض"), K = new Set("ةهد"), U = new Set("طلكگ"), z = new Set("عقف"), M = new Set(
|
|
4
4
|
"بتثجحخسشصضطظعغفقكلمنهيئپچژگ"
|
|
@@ -12,7 +12,7 @@ function A(e) {
|
|
|
12
12
|
const t = e.charCodeAt(0);
|
|
13
13
|
return t >= 1611 && t <= 1631;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function j(e, t) {
|
|
16
16
|
const n = e[t];
|
|
17
17
|
if (!M.has(n)) return !1;
|
|
18
18
|
for (let r = t + 1; r < e.length; r++)
|
|
@@ -43,7 +43,7 @@ function Y(e) {
|
|
|
43
43
|
for (let i = 0; i < r.length; i++) {
|
|
44
44
|
if (A(r[i])) continue;
|
|
45
45
|
const c = r[i];
|
|
46
|
-
if (J.has(c) &&
|
|
46
|
+
if (J.has(c) && j(r, i)) {
|
|
47
47
|
const l = { wordIndex: n, charIndex: i + 1, priority: 1 };
|
|
48
48
|
(!s || l.priority < s.priority) && (s = l);
|
|
49
49
|
continue;
|
|
@@ -56,7 +56,7 @@ function Y(e) {
|
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
if (M.has(c) &&
|
|
59
|
+
if (M.has(c) && j(r, i)) {
|
|
60
60
|
const l = { wordIndex: n, charIndex: i + 1, priority: 5 };
|
|
61
61
|
(!s || l.priority < s.priority) && (s = l);
|
|
62
62
|
}
|
|
@@ -65,7 +65,7 @@ function Y(e) {
|
|
|
65
65
|
}
|
|
66
66
|
return t;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function D(e, t, n = 1) {
|
|
69
69
|
return e.slice(0, t) + T.repeat(n) + e.slice(t);
|
|
70
70
|
}
|
|
71
71
|
function Z(e, t, n, r = 50) {
|
|
@@ -78,13 +78,13 @@ function Z(e, t, n, r = 50) {
|
|
|
78
78
|
if (u.length === 0) break;
|
|
79
79
|
for (const { word: p, index: f } of u) {
|
|
80
80
|
const q = p.indexOf(T);
|
|
81
|
-
if (l[f] =
|
|
81
|
+
if (l[f] = D(p, q, 1), s = l.join(" "), i = t(s), i >= n) return s;
|
|
82
82
|
}
|
|
83
83
|
continue;
|
|
84
84
|
}
|
|
85
85
|
o.sort((u, p) => u.priority - p.priority);
|
|
86
86
|
const d = o[0];
|
|
87
|
-
if (l[d.wordIndex] =
|
|
87
|
+
if (l[d.wordIndex] = D(l[d.wordIndex], d.charIndex), s = l.join(" "), i = t(s), i >= n) return s;
|
|
88
88
|
}
|
|
89
89
|
return s;
|
|
90
90
|
}
|
|
@@ -104,7 +104,7 @@ function B(e, t, n) {
|
|
|
104
104
|
case "link":
|
|
105
105
|
return /* @__PURE__ */ a("a", { href: r.attrs.href, target: r.attrs.target ?? "_blank", rel: "noopener noreferrer", children: s });
|
|
106
106
|
case "repeat":
|
|
107
|
-
return /* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ g("span", { className: "qalam-render-inline-repeat", children: [
|
|
108
108
|
s,
|
|
109
109
|
/* @__PURE__ */ a("span", { className: "qalam-render-inline-repeat-badge", children: E(r.attrs.count) })
|
|
110
110
|
] });
|
|
@@ -119,22 +119,22 @@ function ee({ node: e }) {
|
|
|
119
119
|
}
|
|
120
120
|
function te({ seg: e, index: t }) {
|
|
121
121
|
const n = /* @__PURE__ */ a("span", { className: "qalam-render-verse", children: e.textHafsSmart });
|
|
122
|
-
return e.repeat > 1 ? /* @__PURE__ */
|
|
122
|
+
return e.repeat > 1 ? /* @__PURE__ */ g($, { children: [
|
|
123
123
|
/* @__PURE__ */ a("span", { className: "qalam-render-repeat", children: n }),
|
|
124
124
|
/* @__PURE__ */ a("span", { className: "qalam-render-repeat-badge", children: E(e.repeat) })
|
|
125
125
|
] }) : n;
|
|
126
126
|
}
|
|
127
127
|
function ne({ node: e }) {
|
|
128
128
|
const { resolved: t } = e, n = t.segments.map((s) => s.textCopy).join(" "), r = t.basmalah ? `بِسْمِ اللَّهِ الرَّحْمَـٰنِ الرَّحِيمِ ${n}` : n;
|
|
129
|
-
return /* @__PURE__ */
|
|
129
|
+
return /* @__PURE__ */ g("span", { className: "qalam-render-quran", "data-copy": r, "data-citation": t.citation, children: [
|
|
130
130
|
/* @__PURE__ */ a("span", { className: "qalam-render-seo", "aria-hidden": "false", children: r }),
|
|
131
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ g("span", { "aria-hidden": "true", children: [
|
|
132
132
|
/* @__PURE__ */ a("span", { className: "qalam-render-bracket", children: "﴿" }),
|
|
133
|
-
t.basmalah && /* @__PURE__ */
|
|
133
|
+
t.basmalah && /* @__PURE__ */ g($, { children: [
|
|
134
134
|
/* @__PURE__ */ a("span", { className: "qalam-render-basmalah", children: "" }),
|
|
135
135
|
" "
|
|
136
136
|
] }),
|
|
137
|
-
t.segments.map((s, i) => /* @__PURE__ */
|
|
137
|
+
t.segments.map((s, i) => /* @__PURE__ */ g("span", { children: [
|
|
138
138
|
i > 0 && " ",
|
|
139
139
|
/* @__PURE__ */ a(te, { seg: s, index: i })
|
|
140
140
|
] }, i)),
|
|
@@ -160,12 +160,12 @@ function ae({ node: e }) {
|
|
|
160
160
|
const i = [];
|
|
161
161
|
for (let c = 0; c < n.length; c++)
|
|
162
162
|
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}`));
|
|
163
|
-
return /* @__PURE__ */
|
|
163
|
+
return /* @__PURE__ */ g("span", { className: "qalam-render-hadith", children: [
|
|
164
164
|
/* @__PURE__ */ a("span", { className: "qalam-render-hadith-bracket", children: "«" }),
|
|
165
165
|
i,
|
|
166
166
|
/* @__PURE__ */ a("span", { className: "qalam-render-hadith-bracket", children: "»" }),
|
|
167
167
|
t.citation && /* @__PURE__ */ a("span", { className: "qalam-render-hadith-citation", children: t.citation }),
|
|
168
|
-
t.grade && /* @__PURE__ */
|
|
168
|
+
t.grade && /* @__PURE__ */ g("span", { className: "qalam-render-hadith-grade", children: [
|
|
169
169
|
"(",
|
|
170
170
|
t.grade,
|
|
171
171
|
")"
|
|
@@ -198,19 +198,19 @@ function se({ node: e }) {
|
|
|
198
198
|
for (const h of e.content)
|
|
199
199
|
!h.attrs.separator && h.attrs.parts.length > q && (q = h.attrs.parts.length);
|
|
200
200
|
const R = p / q, b = R - f;
|
|
201
|
-
let
|
|
201
|
+
let y = !1, k = 0;
|
|
202
202
|
const C = [];
|
|
203
203
|
for (let h = 0; h < e.content.length; h++) {
|
|
204
204
|
const N = e.content[h];
|
|
205
205
|
if (!N.attrs.separator)
|
|
206
206
|
for (let w = 0; w < N.attrs.parts.length; w++) {
|
|
207
207
|
const I = N.attrs.parts[w], W = I ? u(I) : 0;
|
|
208
|
-
C.push({ key: `${h}-${w}`, text: I, naturalWidth: W }), I && (W > k && (k = W), N.attrs.parts.length > 1 && W > b && (
|
|
208
|
+
C.push({ key: `${h}-${w}`, text: I, naturalWidth: W }), I && (W > k && (k = W), N.attrs.parts.length > 1 && W > b && (y = !0));
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
i(
|
|
212
|
-
const m = k * 1.3 + f, S = Math.min(m, R), v =
|
|
213
|
-
l(
|
|
211
|
+
i(y);
|
|
212
|
+
const m = k * 1.3 + f, S = Math.min(m, R), v = y ? k : S - f;
|
|
213
|
+
l(y ? p : Math.min(S * q, p));
|
|
214
214
|
const x = /* @__PURE__ */ new Map();
|
|
215
215
|
for (const { key: h, text: N, naturalWidth: w } of C) {
|
|
216
216
|
if (!N) {
|
|
@@ -240,7 +240,7 @@ function L({ node: e }) {
|
|
|
240
240
|
switch (e.type) {
|
|
241
241
|
case "paragraph": {
|
|
242
242
|
const t = e.attrs?.repeat ?? 1;
|
|
243
|
-
return t > 1 ? /* @__PURE__ */
|
|
243
|
+
return t > 1 ? /* @__PURE__ */ g("p", { className: "qalam-render-block-repeat", children: [
|
|
244
244
|
e.content?.map((n, r) => /* @__PURE__ */ a(_, { node: n }, r)),
|
|
245
245
|
/* @__PURE__ */ a("span", { className: "qalam-render-block-repeat-ghost", children: E(t) }),
|
|
246
246
|
/* @__PURE__ */ a("span", { className: "qalam-render-block-repeat-badge", children: E(t) })
|
|
@@ -253,10 +253,10 @@ function L({ node: e }) {
|
|
|
253
253
|
case "bulletList":
|
|
254
254
|
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)) });
|
|
255
255
|
case "orderedList":
|
|
256
|
-
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)) });
|
|
256
|
+
return /* @__PURE__ */ a("ol", { ...e.attrs?.listType === "abjad" ? { "data-list-type": "abjad", style: { "--qalam-ol-style": "abjad" } } : {}, children: e.content.map((t, n) => /* @__PURE__ */ a("li", { children: t.content.map((r, s) => /* @__PURE__ */ a(L, { node: r }, s)) }, n)) });
|
|
257
257
|
case "blockquote": {
|
|
258
258
|
const t = e.attrs?.repeat ?? 1;
|
|
259
|
-
return /* @__PURE__ */
|
|
259
|
+
return /* @__PURE__ */ g("blockquote", { className: t > 1 ? "qalam-render-block-repeat" : void 0, children: [
|
|
260
260
|
e.content.map((n, r) => /* @__PURE__ */ a(L, { node: n }, r)),
|
|
261
261
|
t > 1 && /* @__PURE__ */ a("span", { className: "qalam-render-block-repeat-badge", children: E(t) })
|
|
262
262
|
] });
|
|
@@ -293,10 +293,10 @@ function le({ doc: e, className: t, dir: n = "rtl" }) {
|
|
|
293
293
|
const S = m.dataset.copy || "", v = m.dataset.citation || "", x = document.createElement("span");
|
|
294
294
|
x.textContent = `﴿${S}﴾ [${v}]`, m.replaceWith(x);
|
|
295
295
|
}
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
const k =
|
|
299
|
-
document.body.removeChild(
|
|
296
|
+
const y = document.createElement("div");
|
|
297
|
+
y.appendChild(f), document.body.appendChild(y);
|
|
298
|
+
const k = y.innerText, C = y.innerHTML;
|
|
299
|
+
document.body.removeChild(y), i.clipboardData?.setData("text/plain", k), i.clipboardData?.setData("text/html", C);
|
|
300
300
|
}, []);
|
|
301
301
|
return Q(() => {
|
|
302
302
|
const i = r.current;
|
|
@@ -1 +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,
|
|
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,uFA4C3B,CAAC"}
|
package/dist/editor/index.js
CHANGED
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-
|
|
3
|
-
import { Q as f } from "./QalamRenderer-
|
|
2
|
+
import { Q as s, a as t } from "./QalamEditor-Db0zWaPG.js";
|
|
3
|
+
import { Q as f } from "./QalamRenderer-h6i48SCj.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 {
|
package/dist/renderer/index.js
CHANGED
package/dist/styles.css
CHANGED
|
@@ -5,12 +5,6 @@
|
|
|
5
5
|
suffix: '. ';
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
ol[data-list-type="abjad"],
|
|
9
|
-
.qalam-editor__content ol[data-list-type="abjad"],
|
|
10
|
-
.qalam-renderer ol[data-list-type="abjad"] {
|
|
11
|
-
list-style-type: abjad !important;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
8
|
/* Qalam Editor Styles */
|
|
15
9
|
|
|
16
10
|
:root {
|
|
@@ -123,7 +117,7 @@ ol[data-list-type="abjad"],
|
|
|
123
117
|
}
|
|
124
118
|
|
|
125
119
|
.qalam-editor__content ol {
|
|
126
|
-
list-style-type: decimal !important;
|
|
120
|
+
list-style-type: var(--qalam-ol-style, decimal) !important;
|
|
127
121
|
padding-inline-start: 1.5em !important;
|
|
128
122
|
margin: 8px 0 !important;
|
|
129
123
|
}
|
|
@@ -535,7 +529,7 @@ ol[data-list-type="abjad"],
|
|
|
535
529
|
}
|
|
536
530
|
|
|
537
531
|
.qalam-renderer ol {
|
|
538
|
-
list-style-type: decimal !important;
|
|
532
|
+
list-style-type: var(--qalam-ol-style, decimal) !important;
|
|
539
533
|
padding-right: 24px !important;
|
|
540
534
|
padding-left: 0 !important;
|
|
541
535
|
margin: 8px 0 !important;
|