@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.
Files changed (68) hide show
  1. package/dist/HafsSmart_08.ttf +0 -0
  2. package/dist/QalamEditor-DlA4iLRR.js +18519 -0
  3. package/dist/QalamRenderer-CMsfcF02.js +306 -0
  4. package/dist/Symbols1_Ver02.otf +0 -0
  5. package/dist/editor/QalamEditor.d.ts +16 -0
  6. package/dist/editor/QalamEditor.d.ts.map +1 -0
  7. package/dist/editor/components/HadithRefView.d.ts +3 -0
  8. package/dist/editor/components/HadithRefView.d.ts.map +1 -0
  9. package/dist/editor/components/PoemView.d.ts +3 -0
  10. package/dist/editor/components/PoemView.d.ts.map +1 -0
  11. package/dist/editor/components/QuranRefPopover.d.ts +10 -0
  12. package/dist/editor/components/QuranRefPopover.d.ts.map +1 -0
  13. package/dist/editor/components/QuranRefView.d.ts +3 -0
  14. package/dist/editor/components/QuranRefView.d.ts.map +1 -0
  15. package/dist/editor/components/Toolbar.d.ts +12 -0
  16. package/dist/editor/components/Toolbar.d.ts.map +1 -0
  17. package/dist/editor/extensions/blockquote-repeat.d.ts +2 -0
  18. package/dist/editor/extensions/blockquote-repeat.d.ts.map +1 -0
  19. package/dist/editor/extensions/hadith-ref.d.ts +13 -0
  20. package/dist/editor/extensions/hadith-ref.d.ts.map +1 -0
  21. package/dist/editor/extensions/inline-repeat.d.ts +3 -0
  22. package/dist/editor/extensions/inline-repeat.d.ts.map +1 -0
  23. package/dist/editor/extensions/ordered-list.d.ts +9 -0
  24. package/dist/editor/extensions/ordered-list.d.ts.map +1 -0
  25. package/dist/editor/extensions/paragraph-repeat.d.ts +2 -0
  26. package/dist/editor/extensions/paragraph-repeat.d.ts.map +1 -0
  27. package/dist/editor/extensions/poem.d.ts +12 -0
  28. package/dist/editor/extensions/poem.d.ts.map +1 -0
  29. package/dist/editor/extensions/prophetic-speech.d.ts +3 -0
  30. package/dist/editor/extensions/prophetic-speech.d.ts.map +1 -0
  31. package/dist/editor/extensions/quran-ref.d.ts +21 -0
  32. package/dist/editor/extensions/quran-ref.d.ts.map +1 -0
  33. package/dist/editor/extensions/strict-schema.d.ts +7 -0
  34. package/dist/editor/extensions/strict-schema.d.ts.map +1 -0
  35. package/dist/editor/index.d.ts +4 -0
  36. package/dist/editor/index.d.ts.map +1 -0
  37. package/dist/editor/index.js +5 -0
  38. package/dist/index.d.ts +5 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +11 -0
  41. package/dist/lookup-C2v6jsEw.js +738 -0
  42. package/dist/quran/index.d.ts +3 -0
  43. package/dist/quran/index.d.ts.map +1 -0
  44. package/dist/quran/lookup.d.ts +9 -0
  45. package/dist/quran/lookup.d.ts.map +1 -0
  46. package/dist/quran/types.d.ts +43 -0
  47. package/dist/quran/types.d.ts.map +1 -0
  48. package/dist/quran-data.json +1 -0
  49. package/dist/renderer/QalamRenderer.d.ts +9 -0
  50. package/dist/renderer/QalamRenderer.d.ts.map +1 -0
  51. package/dist/renderer/index.d.ts +2 -0
  52. package/dist/renderer/index.d.ts.map +1 -0
  53. package/dist/renderer/index.js +4 -0
  54. package/dist/renderer/tatweel.d.ts +11 -0
  55. package/dist/renderer/tatweel.d.ts.map +1 -0
  56. package/dist/resolver/index.d.ts +2 -0
  57. package/dist/resolver/index.d.ts.map +1 -0
  58. package/dist/resolver/index.js +72 -0
  59. package/dist/resolver/resolve.d.ts +3 -0
  60. package/dist/resolver/resolve.d.ts.map +1 -0
  61. package/dist/schema/index.d.ts +3 -0
  62. package/dist/schema/index.d.ts.map +1 -0
  63. package/dist/schema/index.js +174 -0
  64. package/dist/schema/schema.d.ts +11 -0
  65. package/dist/schema/schema.d.ts.map +1 -0
  66. package/dist/schema/types.d.ts +177 -0
  67. package/dist/schema/types.d.ts.map +1 -0
  68. package/package.json +78 -0
@@ -0,0 +1,9 @@
1
+ import type { QalamDocResolved } from "../schema/types";
2
+ interface QalamRendererProps {
3
+ doc: QalamDocResolved;
4
+ className?: string;
5
+ dir?: "rtl" | "ltr";
6
+ }
7
+ export declare function QalamRenderer({ doc, className, dir }: QalamRendererProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=QalamRenderer.d.ts.map
@@ -0,0 +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;AAkVD,wBAAgB,aAAa,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,GAAW,EAAE,EAAE,kBAAkB,2CAmFhF"}
@@ -0,0 +1,2 @@
1
+ export { QalamRenderer } from "./QalamRenderer";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/renderer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Q as a } from "../QalamRenderer-CMsfcF02.js";
2
+ export {
3
+ a as QalamRenderer
4
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Add tatweel characters to stretch text to a target width.
3
+ * Returns the stretched text.
4
+ *
5
+ * @param text - clean text without tatweel
6
+ * @param measureFn - function that returns pixel width of a string
7
+ * @param targetWidth - desired width in pixels
8
+ * @param maxIterations - safety limit
9
+ */
10
+ export declare function stretchToWidth(text: string, measureFn: (text: string) => number, targetWidth: number, maxIterations?: number): string;
11
+ //# sourceMappingURL=tatweel.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export { resolveAST } from "./resolve";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolver/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { a as d } from "../lookup-C2v6jsEw.js";
2
+ function s(t) {
3
+ return t.toString().replace(/\d/g, (n) => "٠١٢٣٤٥٦٧٨٩"[parseInt(n)]);
4
+ }
5
+ function c(t) {
6
+ if (t.type === "hadithRef") {
7
+ const e = t;
8
+ return {
9
+ ...e,
10
+ content: e.content?.map(c)
11
+ };
12
+ }
13
+ if (t.type !== "quranRef") return t;
14
+ const n = t, { surah: m, surahName: p, basmalah: f, segments: r } = n.attrs, h = r.map((e, A) => {
15
+ const o = d(
16
+ m,
17
+ e.fromAya,
18
+ e.fromWord ?? null,
19
+ e.toAya ?? null,
20
+ e.toWord ?? null,
21
+ A === 0 && f
22
+ );
23
+ return {
24
+ text: o?.text ?? "",
25
+ textHafsSmart: o?.textHafsSmart ?? "",
26
+ textCopy: o?.textCopy ?? "",
27
+ repeat: e.repeat
28
+ };
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)}`;
30
+ return { ...n, resolved: { segments: h, citation: y, basmalah: f && m !== 1 } };
31
+ }
32
+ function u(t) {
33
+ switch (t.type) {
34
+ case "paragraph":
35
+ return {
36
+ ...t,
37
+ content: t.content?.map(c)
38
+ };
39
+ case "heading":
40
+ return {
41
+ ...t,
42
+ content: t.content?.map(c)
43
+ };
44
+ case "bulletList":
45
+ case "orderedList":
46
+ return {
47
+ ...t,
48
+ content: t.content.map((n) => ({
49
+ ...n,
50
+ content: n.content.map(u)
51
+ }))
52
+ };
53
+ case "blockquote":
54
+ return {
55
+ ...t,
56
+ content: t.content.map(u)
57
+ };
58
+ case "poem":
59
+ return t;
60
+ default:
61
+ return t;
62
+ }
63
+ }
64
+ function S(t) {
65
+ return {
66
+ type: "doc",
67
+ content: t.content.map(u)
68
+ };
69
+ }
70
+ export {
71
+ S as resolveAST
72
+ };
@@ -0,0 +1,3 @@
1
+ import type { QalamDoc, QalamDocResolved } from "../schema/types";
2
+ export declare function resolveAST(doc: QalamDoc): QalamDocResolved;
3
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
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";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,174 @@
1
+ const m = /* @__PURE__ */ new Set([
2
+ "doc",
3
+ "paragraph",
4
+ "heading",
5
+ "text",
6
+ "bulletList",
7
+ "orderedList",
8
+ "listItem",
9
+ "blockquote",
10
+ "poem",
11
+ "bayt",
12
+ "quranRef",
13
+ "hadithRef",
14
+ "hardBreak"
15
+ ]), p = /* @__PURE__ */ new Set(["bold", "italic", "link", "repeat"]), h = /* @__PURE__ */ new Set(["bold", "italic", "repeat", "propheticSpeech"]), y = /* @__PURE__ */ new Set([1, 2, 3]);
16
+ function l(i, a, t, n) {
17
+ if (!i || typeof i != "object") {
18
+ t.push({ path: a, message: "Node must be an object" });
19
+ return;
20
+ }
21
+ const o = i.type;
22
+ if (!o || !m.has(o)) {
23
+ t.push({ path: a, message: `Invalid node type: "${o}"` });
24
+ return;
25
+ }
26
+ switch (("style" in i || "color" in i || "className" in i) && t.push({ path: a, message: "Custom styling not allowed" }), o) {
27
+ case "doc":
28
+ u(i, a, t);
29
+ break;
30
+ case "heading": {
31
+ const e = i.attrs;
32
+ (!e || !y.has(e.level)) && t.push({
33
+ path: a,
34
+ message: `Invalid heading level: ${e?.level}. Allowed: 1, 2, 3`
35
+ }), c(i, a, t);
36
+ break;
37
+ }
38
+ case "paragraph": {
39
+ const e = i.attrs;
40
+ e?.repeat !== void 0 && (typeof e.repeat != "number" || e.repeat < 1) && t.push({ path: a, message: `Invalid repeat: ${e.repeat}` }), c(i, a, t);
41
+ break;
42
+ }
43
+ case "bulletList":
44
+ u(i, a, t, "listItem");
45
+ break;
46
+ case "orderedList": {
47
+ const e = i.attrs;
48
+ e?.listType !== void 0 && e.listType !== "decimal" && e.listType !== "abjad" && t.push({ path: a, message: `Invalid listType: "${e.listType}"` }), u(i, a, t, "listItem");
49
+ break;
50
+ }
51
+ case "listItem":
52
+ u(i, a, t);
53
+ break;
54
+ case "blockquote": {
55
+ const e = i.attrs;
56
+ e?.repeat !== void 0 && (typeof e.repeat != "number" || e.repeat < 1) && t.push({ path: a, message: `Invalid repeat: ${e.repeat}` }), u(i, a, t);
57
+ break;
58
+ }
59
+ case "text":
60
+ typeof i.text != "string" && t.push({ path: a, message: "Text node must have a string text field" }), g(i, a, t, n ?? p);
61
+ break;
62
+ case "quranRef":
63
+ d(i, a, t);
64
+ break;
65
+ case "hadithRef":
66
+ b(i, a, t);
67
+ break;
68
+ case "poem":
69
+ u(i, a, t, "bayt");
70
+ break;
71
+ case "bayt": {
72
+ const e = i.attrs?.parts;
73
+ if (!Array.isArray(e) || e.length < 1 || e.length > 3)
74
+ t.push({ path: a, message: "bayt must have 1 to 3 parts" });
75
+ else
76
+ for (let s = 0; s < e.length; s++)
77
+ typeof e[s] != "string" && t.push({ path: `${a}.parts[${s}]`, message: "bayt part must be a string" });
78
+ break;
79
+ }
80
+ }
81
+ }
82
+ function u(i, a, t, n) {
83
+ const o = i.content;
84
+ if (!(!o || !Array.isArray(o)))
85
+ for (let e = 0; e < o.length; e++) {
86
+ const s = o[e], f = `${a}.content[${e}]`;
87
+ n && s.type !== n && t.push({
88
+ path: f,
89
+ message: `Expected ${n}, got ${s.type}`
90
+ }), l(s, f, t);
91
+ }
92
+ }
93
+ function c(i, a, t) {
94
+ const n = i.content;
95
+ if (!n || !Array.isArray(n)) return;
96
+ const o = /* @__PURE__ */ new Set(["text", "quranRef", "hadithRef", "hardBreak"]);
97
+ for (let e = 0; e < n.length; e++) {
98
+ const s = n[e], f = `${a}.content[${e}]`;
99
+ o.has(s.type) || t.push({
100
+ path: f,
101
+ message: `Invalid inline content type: "${s.type}"`
102
+ }), l(s, f, t);
103
+ }
104
+ }
105
+ function g(i, a, t, n) {
106
+ const o = i.marks;
107
+ if (!(!o || !Array.isArray(o)))
108
+ for (let e = 0; e < o.length; e++) {
109
+ const s = o[e], f = s.type;
110
+ if (n.has(f) || t.push({
111
+ path: `${a}.marks[${e}]`,
112
+ message: `Invalid mark type: "${f}"`
113
+ }), f === "link") {
114
+ const r = s.attrs;
115
+ (!r || typeof r.href != "string") && t.push({
116
+ path: `${a}.marks[${e}]`,
117
+ message: "Link mark must have an href attribute"
118
+ });
119
+ }
120
+ if (f === "repeat") {
121
+ const r = s.attrs;
122
+ (!r || typeof r.count != "number" || r.count < 2) && t.push({
123
+ path: `${a}.marks[${e}]`,
124
+ message: `Invalid repeat count: ${r?.count}`
125
+ });
126
+ }
127
+ }
128
+ }
129
+ function d(i, a, t) {
130
+ const n = i.attrs;
131
+ if (!n) {
132
+ t.push({ path: a, message: "quranRef must have attrs" });
133
+ return;
134
+ }
135
+ (typeof n.surah != "number" || n.surah < 1 || n.surah > 114) && t.push({ path: a, message: `Invalid surah number: ${n.surah}` }), (typeof n.surahName != "string" || !n.surahName) && t.push({ path: a, message: "quranRef must have a surahName" }), n.showCitation !== void 0 && typeof n.showCitation != "boolean" && t.push({ path: a, message: "showCitation must be a boolean" });
136
+ const o = n.segments;
137
+ if (!Array.isArray(o) || o.length === 0) {
138
+ t.push({ path: a, message: "quranRef must have a non-empty segments array" });
139
+ return;
140
+ }
141
+ for (let e = 0; e < o.length; e++) {
142
+ const s = o[e], f = `${a}.segments[${e}]`;
143
+ (typeof s.fromAya != "number" || s.fromAya < 1) && t.push({ path: f, message: `Invalid fromAya: ${s.fromAya}` }), s.fromWord !== null && s.fromWord !== void 0 && (typeof s.fromWord != "number" || s.fromWord < 1) && t.push({ path: f, message: `Invalid fromWord: ${s.fromWord}` }), s.toAya !== null && s.toAya !== void 0 && (typeof s.toAya != "number" || s.toAya < 1) && t.push({ path: f, message: `Invalid toAya: ${s.toAya}` }), s.toWord !== null && s.toWord !== void 0 && (typeof s.toWord != "number" || s.toWord < 1) && t.push({ path: f, message: `Invalid toWord: ${s.toWord}` }), (typeof s.repeat != "number" || s.repeat < 1) && t.push({ path: f, message: `Invalid repeat: ${s.repeat}` });
144
+ }
145
+ }
146
+ function b(i, a, t) {
147
+ const n = i.attrs;
148
+ if (!n) {
149
+ t.push({ path: a, message: "hadithRef must have attrs" });
150
+ return;
151
+ }
152
+ n.citation !== void 0 && typeof n.citation != "string" && t.push({ path: a, message: "hadithRef citation must be a string" }), n.grade !== void 0 && typeof n.grade != "string" && t.push({ path: a, message: "hadithRef grade must be a string" });
153
+ const o = i.content;
154
+ if (o && Array.isArray(o)) {
155
+ const e = /* @__PURE__ */ new Set(["text", "quranRef", "hardBreak"]);
156
+ for (let s = 0; s < o.length; s++) {
157
+ const f = o[s], r = `${a}.content[${s}]`;
158
+ e.has(f.type) || t.push({ path: r, message: `Invalid hadithRef content type: "${f.type}"` }), l(f, r, t, h);
159
+ }
160
+ }
161
+ }
162
+ function v(i) {
163
+ const a = [];
164
+ if (!i || typeof i != "object")
165
+ return { valid: !1, errors: [{ path: "", message: "AST must be an object" }] };
166
+ const t = i;
167
+ return t.type !== "doc" ? {
168
+ valid: !1,
169
+ errors: [{ path: "", message: `Root must be type "doc", got "${t.type}"` }]
170
+ } : (l(t, "doc", a), { valid: a.length === 0, errors: a });
171
+ }
172
+ export {
173
+ v as validateAST
174
+ };
@@ -0,0 +1,11 @@
1
+ interface ValidationError {
2
+ path: string;
3
+ message: string;
4
+ }
5
+ export interface ValidationResult {
6
+ valid: boolean;
7
+ errors: ValidationError[];
8
+ }
9
+ export declare function validateAST(ast: unknown): ValidationResult;
10
+ export {};
11
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema/schema.ts"],"names":[],"mappings":"AAqBA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AA+SD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAkB1D"}
@@ -0,0 +1,177 @@
1
+ export interface QalamDoc {
2
+ type: "doc";
3
+ content: QalamBlock[];
4
+ }
5
+ export type QalamBlock = QalamParagraph | QalamHeading | QalamBulletList | QalamOrderedList | QalamBlockquote | QalamPoem;
6
+ export interface QalamParagraph {
7
+ type: "paragraph";
8
+ attrs?: {
9
+ repeat?: number;
10
+ };
11
+ content?: QalamInline[];
12
+ }
13
+ export interface QalamHeading {
14
+ type: "heading";
15
+ attrs: {
16
+ level: 1 | 2 | 3;
17
+ };
18
+ content?: QalamInline[];
19
+ }
20
+ export interface QalamBulletList {
21
+ type: "bulletList";
22
+ content: QalamListItem[];
23
+ }
24
+ export interface QalamOrderedList {
25
+ type: "orderedList";
26
+ attrs?: {
27
+ listType?: "decimal" | "abjad";
28
+ };
29
+ content: QalamListItem[];
30
+ }
31
+ export interface QalamListItem {
32
+ type: "listItem";
33
+ content: QalamBlock[];
34
+ }
35
+ export interface QalamBlockquote {
36
+ type: "blockquote";
37
+ attrs?: {
38
+ repeat?: number;
39
+ };
40
+ content: QalamBlock[];
41
+ }
42
+ export interface QalamBayt {
43
+ type: "bayt";
44
+ attrs: {
45
+ parts: [string] | [string, string] | [string, string, string];
46
+ separator?: boolean;
47
+ };
48
+ }
49
+ export interface QalamPoem {
50
+ type: "poem";
51
+ content: QalamBayt[];
52
+ }
53
+ export type QalamInline = QalamText | QalamQuranRef | QalamHadithRef | QalamHardBreak;
54
+ export interface QalamText {
55
+ type: "text";
56
+ text: string;
57
+ marks?: QalamMark[];
58
+ }
59
+ export interface QalamHardBreak {
60
+ type: "hardBreak";
61
+ }
62
+ export type QalamMark = QalamBoldMark | QalamItalicMark | QalamLinkMark | QalamRepeatMark | QalamPropheticSpeechMark;
63
+ export interface QalamBoldMark {
64
+ type: "bold";
65
+ }
66
+ export interface QalamItalicMark {
67
+ type: "italic";
68
+ }
69
+ export interface QalamLinkMark {
70
+ type: "link";
71
+ attrs: {
72
+ href: string;
73
+ target?: string;
74
+ };
75
+ }
76
+ export interface QalamRepeatMark {
77
+ type: "repeat";
78
+ attrs: {
79
+ count: number;
80
+ };
81
+ }
82
+ export interface QalamPropheticSpeechMark {
83
+ type: "propheticSpeech";
84
+ }
85
+ export interface QuranSegment {
86
+ fromAya: number;
87
+ fromWord: number | null;
88
+ toAya: number | null;
89
+ toWord: number | null;
90
+ repeat: number;
91
+ }
92
+ export interface QuranRefAttrs {
93
+ surah: number;
94
+ surahName: string;
95
+ basmalah: boolean;
96
+ showCitation?: boolean;
97
+ segments: QuranSegment[];
98
+ }
99
+ export interface QalamQuranRef {
100
+ type: "quranRef";
101
+ attrs: QuranRefAttrs;
102
+ }
103
+ export interface ResolvedQuranSegment {
104
+ text: string;
105
+ textHafsSmart: string;
106
+ textCopy: string;
107
+ repeat: number;
108
+ }
109
+ export interface ResolvedQuranData {
110
+ segments: ResolvedQuranSegment[];
111
+ citation: string;
112
+ basmalah: boolean;
113
+ }
114
+ export interface QalamQuranRefResolved {
115
+ type: "quranRef";
116
+ attrs: QuranRefAttrs;
117
+ resolved: ResolvedQuranData;
118
+ }
119
+ export type QalamInlineResolved = QalamText | QalamQuranRefResolved | QalamHadithRefResolved | QalamHardBreak;
120
+ export interface QalamParagraphResolved {
121
+ type: "paragraph";
122
+ attrs?: {
123
+ repeat?: number;
124
+ };
125
+ content?: QalamInlineResolved[];
126
+ }
127
+ export interface QalamHeadingResolved {
128
+ type: "heading";
129
+ attrs: {
130
+ level: 1 | 2 | 3;
131
+ };
132
+ content?: QalamInlineResolved[];
133
+ }
134
+ export type QalamBlockResolved = QalamParagraphResolved | QalamHeadingResolved | QalamBulletListResolved | QalamOrderedListResolved | QalamBlockquoteResolved | QalamPoem;
135
+ export interface QalamListItemResolved {
136
+ type: "listItem";
137
+ content: QalamBlockResolved[];
138
+ }
139
+ export interface QalamBulletListResolved {
140
+ type: "bulletList";
141
+ content: QalamListItemResolved[];
142
+ }
143
+ export interface QalamOrderedListResolved {
144
+ type: "orderedList";
145
+ attrs?: {
146
+ listType?: "decimal" | "abjad";
147
+ };
148
+ content: QalamListItemResolved[];
149
+ }
150
+ export interface QalamBlockquoteResolved {
151
+ type: "blockquote";
152
+ attrs?: {
153
+ repeat?: number;
154
+ };
155
+ content: QalamBlockResolved[];
156
+ }
157
+ export interface QalamDocResolved {
158
+ type: "doc";
159
+ content: QalamBlockResolved[];
160
+ }
161
+ export type QalamHadithRefContent = QalamText | QalamQuranRef | QalamHardBreak;
162
+ export interface HadithRefAttrs {
163
+ citation: string;
164
+ grade?: string;
165
+ }
166
+ export interface QalamHadithRef {
167
+ type: "hadithRef";
168
+ attrs: HadithRefAttrs;
169
+ content?: QalamHadithRefContent[];
170
+ }
171
+ export interface QalamHadithRefResolved {
172
+ type: "hadithRef";
173
+ attrs: HadithRefAttrs;
174
+ content?: QalamHadithRefContentResolved[];
175
+ }
176
+ export type QalamHadithRefContentResolved = QalamText | QalamQuranRefResolved | QalamHardBreak;
177
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schema/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB;AAED,MAAM,MAAM,UAAU,GAClB,cAAc,GACd,YAAY,GACZ,eAAe,GACf,gBAAgB,GAChB,eAAe,GACf,SAAS,CAAC;AAEd,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;CACzB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GAAG,OAAO,CAAA;KAAE,CAAC;IAC3C,OAAO,EAAE,qBAAqB,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAID,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,aAAa,GAAG,cAAc,CAAC;AAE/E,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,CAAC,EAAE,6BAA6B,EAAE,CAAC;CAC3C;AAED,MAAM,MAAM,6BAA6B,GAAG,SAAS,GAAG,qBAAqB,GAAG,cAAc,CAAC"}
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@siladev/qalam",
3
+ "version": "0.1.0",
4
+ "description": "Islamic content editor with Quran verse references",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./editor": {
15
+ "import": "./dist/editor/index.js",
16
+ "types": "./dist/editor/index.d.ts"
17
+ },
18
+ "./renderer": {
19
+ "import": "./dist/renderer/index.js",
20
+ "types": "./dist/renderer/index.d.ts"
21
+ },
22
+ "./schema": {
23
+ "import": "./dist/schema/index.js",
24
+ "types": "./dist/schema/index.d.ts"
25
+ },
26
+ "./resolver": {
27
+ "import": "./dist/resolver/index.js",
28
+ "types": "./dist/resolver/index.d.ts"
29
+ },
30
+ "./styles.css": "./dist/styles.css",
31
+ "./quran-data": "./dist/quran-data.json"
32
+ },
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "scripts": {
37
+ "dev": "vite",
38
+ "build": "vite build && bun run build:types",
39
+ "build:types": "tsc --emitDeclarationOnly --declaration --outDir dist",
40
+ "preview": "vite preview",
41
+ "prepare-data": "bun run data/scripts/prepare.ts",
42
+ "test": "vitest run"
43
+ },
44
+ "peerDependencies": {
45
+ "react": "^18.0.0 || ^19.0.0",
46
+ "react-dom": "^18.0.0 || ^19.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/react": "^19.0.0",
50
+ "@types/react-dom": "^19.0.0",
51
+ "@vitejs/plugin-react": "^4.4.0",
52
+ "jsdom": "^28.1.0",
53
+ "react": "^19.0.0",
54
+ "react-dom": "^19.0.0",
55
+ "typescript": "^5.7.0",
56
+ "vite": "^7.0.0",
57
+ "vite-plugin-dts": "^4.5.0",
58
+ "vitest": "^4.0.18"
59
+ },
60
+ "dependencies": {
61
+ "@tiptap/core": "^3.20.1",
62
+ "@tiptap/extension-blockquote": "^3.20.1",
63
+ "@tiptap/extension-bold": "^3.20.1",
64
+ "@tiptap/extension-document": "^3.20.1",
65
+ "@tiptap/extension-dropcursor": "^3.20.1",
66
+ "@tiptap/extension-gapcursor": "^3.20.1",
67
+ "@tiptap/extension-hard-break": "^3.20.1",
68
+ "@tiptap/extension-heading": "^3.20.1",
69
+ "@tiptap/extension-history": "^3.20.1",
70
+ "@tiptap/extension-italic": "^3.20.1",
71
+ "@tiptap/extension-link": "^3.20.1",
72
+ "@tiptap/extension-list": "^3.20.1",
73
+ "@tiptap/extension-paragraph": "^3.20.1",
74
+ "@tiptap/extension-text": "^3.20.1",
75
+ "@tiptap/pm": "^3.20.1",
76
+ "@tiptap/react": "^3.20.1"
77
+ }
78
+ }