misraj-mushaf-renderer 1.0.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 (36) hide show
  1. package/README.md +193 -0
  2. package/dist/App.d.ts +3 -0
  3. package/dist/classnames.d.ts +19 -0
  4. package/dist/components/MushafReader/ReadingView/Line.d.ts +12 -0
  5. package/dist/components/MushafReader/ReadingView/Page.d.ts +12 -0
  6. package/dist/components/MushafReader/ReadingView/PageNumber.d.ts +5 -0
  7. package/dist/components/MushafReader/ReadingView/groupLinesByVerses.d.ts +16 -0
  8. package/dist/components/MushafReader/ReadingView/page-metadata/PageMetaDataContainer.d.ts +6 -0
  9. package/dist/components/MushafReader/ReadingView/page-metadata/juz.constants.d.ts +2 -0
  10. package/dist/components/MushafReader/contexts/MushafPage/MushafPage.types.d.ts +15 -0
  11. package/dist/components/MushafReader/contexts/MushafPage/MushafPageProvider.d.ts +33 -0
  12. package/dist/components/MushafReader/contexts/MushafPage/helpers/fetch-verses.d.ts +3 -0
  13. package/dist/components/MushafReader/index.d.ts +13 -0
  14. package/dist/components/Verse/VerseText.d.ts +11 -0
  15. package/dist/components/Verse/pageUtils.d.ts +11 -0
  16. package/dist/components/chapters/ChapterHeader/index.d.ts +9 -0
  17. package/dist/components/chapters/ChapterIcon/ChapterIconContainer.d.ts +7 -0
  18. package/dist/components/chapters/ChapterIcon/index.d.ts +6 -0
  19. package/dist/components/dls/Bismillah/Bismillah.d.ts +2 -0
  20. package/dist/components/dls/MushafWord/MushafWord.d.ts +8 -0
  21. package/dist/config-global.d.ts +1 -0
  22. package/dist/hooks/use-media-query.d.ts +2 -0
  23. package/dist/index.cjs.js +6 -0
  24. package/dist/index.cjs.js.map +1 -0
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.es.js +2506 -0
  27. package/dist/index.es.js.map +1 -0
  28. package/dist/main.d.ts +0 -0
  29. package/dist/styles.css +1 -0
  30. package/dist/styles.d.ts +0 -0
  31. package/dist/types/MushafReader.d.ts +16 -0
  32. package/dist/types/Word.d.ts +3 -0
  33. package/dist/utils/fontFaceHelper.d.ts +13 -0
  34. package/dist/utils/narration-name.d.ts +1 -0
  35. package/dist/utils/verse.d.ts +41 -0
  36. package/package.json +79 -0
File without changes
@@ -0,0 +1,16 @@
1
+ export declare enum MushafReaderDataType {
2
+ Page = "page"
3
+ }
4
+ export declare enum MushafFont {
5
+ MadaniV1 = "code_v1",
6
+ MadaniV2 = "code_v2",
7
+ Uthmani = "text_uthmani",
8
+ IndoPak = "text_indopak",
9
+ QPCHafs = "qpc_uthmani_hafs",
10
+ Tajweed = "tajweed"
11
+ }
12
+ export declare const FALLBACK_FONT = MushafFont.QPCHafs;
13
+ export declare enum MushafLines {
14
+ FifteenLines = "15_lines",
15
+ SixteenLines = "16_lines"
16
+ }
@@ -0,0 +1,3 @@
1
+ import { Word as WordVerse } from './verses';
2
+ export type Word = WordVerse;
3
+ export default Word;
@@ -0,0 +1,13 @@
1
+ import { MushafLines, MushafFont } from '../types/MushafReader';
2
+ /**
3
+ * Dynamically generate the className of the combination between the font
4
+ * name + size + mushafLines(when its Indopak) that will match the output of
5
+ * generate-font-scales function inside {@see _utility.scss}.
6
+ *
7
+ * @param {MushafFont} mushafFont
8
+ * @param {number} fontScale
9
+ * @param {MushafLines} mushafLines
10
+ * @param {boolean} isFallbackFont
11
+ * @returns {string}
12
+ */
13
+ export declare const getFontClassName: (mushafFont: MushafFont, fontScale: number, mushafLines: MushafLines, isFallbackFont?: boolean) => string;
@@ -0,0 +1 @@
1
+ export declare const narrationIdentifierFromReciterId: (identifier: string | undefined) => string;
@@ -0,0 +1,41 @@
1
+ import { Ayah } from '../types/verses';
2
+ import { default as Word } from '../types/Word';
3
+ /**
4
+ * Split the word's location and get the surahNumber, verseNumber and wordNumber.
5
+ *
6
+ * @param {string} wordLocation the word location {surahNumber}:{verseNumber}:{wordNumber}
7
+ * @returns {[string, string, string]}
8
+ */
9
+ export declare const getWordDataByLocation: (wordLocation: string) => [string, string, string];
10
+ /**
11
+ * Extract the data related to a word. The first is the chapter Id,
12
+ * the second is whether the word is the first word of the first verse
13
+ * of the Surah. To do that we will have to split the word location
14
+ * which comes in the following format: {surahNumber}:{verseNumber}:{wordNumber}.
15
+ * For this to be true, the combination of {verseNumber}:{wordNumber} has to be
16
+ * 1:1.
17
+ *
18
+ * @param {string} wordLocation whose format is {surahNumber}:{verseNumber}:{wordNumber} e.g. "112:1:1"
19
+ * @returns {{ chapterId: string; isFirstWordOfSurah: boolean }}
20
+ */
21
+ export declare const getFirstWordOfSurah: (wordLocation: string) => {
22
+ chapterId: string;
23
+ isFirstWordOfSurah: boolean;
24
+ };
25
+ /**
26
+ * Get the words of each verse. This can be used to extend
27
+ * the BE response of each word to add custom fields.
28
+ *
29
+ * @param {Verse} verse
30
+ * @param {boolean} isReadingView
31
+ * @returns {Word[]}
32
+ */
33
+ export declare const getVerseWords: (verse: Ayah, isReadingView?: boolean) => Word[];
34
+ /**
35
+ * make wordLocation from verseKey and wordPosition, example "1:1:2"
36
+ *
37
+ * @param {string} verseKey
38
+ * @param {string} wordPosition
39
+ * @returns {string} wordLocation
40
+ */
41
+ export declare const makeWordLocation: (verseKey: string, wordPosition: number) => string;
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "misraj-mushaf-renderer",
3
+ "version": "1.0.0",
4
+ "license": "CC BY-NC 4.0",
5
+ "description": "A customizable React component for rendering Mushaf pages.",
6
+ "type": "module",
7
+ "main": "dist/index.cjs.js",
8
+ "module": "dist/index.es.js",
9
+ "types": "dist/index.d.ts",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "sideEffects": [
14
+ "**/*.css"
15
+ ],
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.es.js",
20
+ "require": "./dist/index.cjs.js"
21
+ },
22
+ "./styles": {
23
+ "types": "./dist/styles.d.ts",
24
+ "import": "./dist/styles.css",
25
+ "require": "./dist/styles.css"
26
+ }
27
+ },
28
+ "scripts": {
29
+ "dev": "vite",
30
+ "build": "vite build",
31
+ "lint": "eslint .",
32
+ "preview": "vite preview"
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^19.1.1",
36
+ "react-dom": "^19.1.1"
37
+ },
38
+ "dependencies": {
39
+ "@eslint/compat": "^1.4.0",
40
+ "@rollup/plugin-url": "^8.0.2",
41
+ "@types/lodash": "^4.17.20",
42
+ "classnames": "^2.5.1",
43
+ "eslint-plugin-jsx-a11y": "^6.10.2",
44
+ "lodash": "^4.17.21",
45
+ "vite-plugin-svgr": "^4.5.0"
46
+ },
47
+ "devDependencies": {
48
+ "@babel/eslint-parser": "^7.28.4",
49
+ "@eslint/eslintrc": "^3.3.1",
50
+ "@eslint/js": "^9.36.0",
51
+ "@types/node": "^24.5.2",
52
+ "@types/react": "^19.1.13",
53
+ "@types/react-dom": "^19.1.9",
54
+ "@typescript-eslint/eslint-plugin": "^8.45.0",
55
+ "@typescript-eslint/parser": "^8.45.0",
56
+ "@vitejs/plugin-react": "^5.0.3",
57
+ "eslint": "^9.36.0",
58
+ "eslint-config-airbnb": "^19.0.4",
59
+ "eslint-config-prettier": "^10.1.8",
60
+ "eslint-import-resolver-typescript": "^4.4.4",
61
+ "eslint-plugin-import": "^2.32.0",
62
+ "eslint-plugin-jsdoc": "^60.3.1",
63
+ "eslint-plugin-prettier": "^5.5.4",
64
+ "eslint-plugin-react": "^7.37.5",
65
+ "eslint-plugin-react-func": "^0.1.18",
66
+ "eslint-plugin-react-hooks": "^5.2.0",
67
+ "eslint-plugin-react-refresh": "^0.4.22",
68
+ "eslint-plugin-sonarjs": "^3.0.5",
69
+ "eslint-plugin-unicorn": "^61.0.2",
70
+ "react": "^19.1.1",
71
+ "react-dom": "^19.1.1",
72
+ "sass": "^1.93.2",
73
+ "typescript": "^5.9.2",
74
+ "typescript-eslint": "^8.45.0",
75
+ "vite": "^7.1.7",
76
+ "vite-plugin-dts": "^4.5.4",
77
+ "vitest": "^3.2.4"
78
+ }
79
+ }