misraj-mushaf-renderer 1.3.40 → 2.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.
- package/README.md +154 -195
- package/dist/adapters/quranhub-entry.d.ts +1 -0
- package/dist/adapters/quranhub.d.ts +9 -0
- package/dist/adapters/quranhub.test.d.ts +1 -0
- package/dist/classnames.d.ts +1 -0
- package/dist/components/MushafReader/Provider.d.ts +8 -5
- package/dist/components/MushafReader/ReadingView/Line.d.ts +1 -3
- package/dist/components/MushafReader/ReadingView/Page.d.ts +1 -3
- package/dist/components/MushafReader/contexts/MushafPage/MushafPage.types.d.ts +2 -5
- package/dist/components/MushafReader/contexts/MushafPage/MushafPageProvider.d.ts +7 -45
- package/dist/components/MushafReader/contexts/Theme/ThemeProvider.d.ts +1 -1
- package/dist/components/MushafReader/contexts/Theme/type.d.ts +12 -20
- package/dist/components/MushafReader/slots.d.ts +5 -0
- package/dist/core/shaping.d.ts +9 -0
- package/dist/core/shaping.test.d.ts +1 -0
- package/dist/core/types.d.ts +117 -0
- package/dist/core/useControllableState.d.ts +8 -0
- package/dist/core/useMushafController.d.ts +3 -0
- package/dist/core.cjs.js +2 -0
- package/dist/core.cjs.js.map +1 -0
- package/dist/core.d.ts +3 -0
- package/dist/core.es.js +7 -0
- package/dist/core.es.js.map +1 -0
- package/dist/index.cjs.js +1 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.es.js +37 -2684
- package/dist/index.es.js.map +1 -1
- package/dist/quranhub-entry.cjs.js +2 -0
- package/dist/quranhub-entry.cjs.js.map +1 -0
- package/dist/quranhub-entry.es.js +41 -0
- package/dist/quranhub-entry.es.js.map +1 -0
- package/dist/react-ui.cjs.js +6 -0
- package/dist/react-ui.cjs.js.map +1 -0
- package/dist/react-ui.d.ts +10 -0
- package/dist/react-ui.es.js +1115 -0
- package/dist/react-ui.es.js.map +1 -0
- package/dist/react-ui.test.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/dist/test/fixtures.d.ts +5 -0
- package/dist/useMushafController-DScB4tp0.js +1736 -0
- package/dist/useMushafController-DScB4tp0.js.map +1 -0
- package/dist/useMushafController-SdcBr76-.cjs +2 -0
- package/dist/useMushafController-SdcBr76-.cjs.map +1 -0
- package/package.json +18 -2
- package/dist/components/MushafReader/contexts/MushafPage/helpers/fetch-differences.d.ts +0 -3
- package/dist/components/MushafReader/contexts/MushafPage/helpers/fetch-verses.d.ts +0 -4
package/README.md
CHANGED
|
@@ -28,198 +28,157 @@ A significant portion of this codebase is derived from the [quran.com-frontend-n
|
|
|
28
28
|
- **Easy Integration**: Simple to integrate into any React project with a straightforward provider-consumer pattern.
|
|
29
29
|
- **Customizable Styling**: Uses a flexible SCSS structure for easy theming and customization.
|
|
30
30
|
|
|
31
|
-
##
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
- `
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
- `
|
|
160
|
-
- `
|
|
161
|
-
- `
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
```ts
|
|
186
|
-
{
|
|
187
|
-
[ComponentName]?: {
|
|
188
|
-
[StyleKey]?: React.CSSProperties; // A CSS style object
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
- `ComponentName` corresponds to the components you want to style (e.g., `Page`, `MushafWord`, `MushafReader`).
|
|
194
|
-
- `StyleKey` corresponds to a stylable element within that component (e.g., `container`, `highlighted`, `twoPagesRow`).
|
|
195
|
-
|
|
196
|
-
You can find all available `ComponentName` and `StyleKey` values in the exported `classnames` object.
|
|
197
|
-
|
|
198
|
-
**Example:**
|
|
199
|
-
|
|
200
|
-
Let's say you want to remove the gap between the two pages in the two-page view. You can do this by passing a style object to the `twoPagesRow` style key of the `MushafReader` component.
|
|
201
|
-
|
|
202
|
-
```tsx
|
|
203
|
-
import { Mushaf, MushafReaderProvider } from 'misraj-mushaf-renderer';
|
|
204
|
-
|
|
205
|
-
const styleOverride = {
|
|
206
|
-
MushafReader: {
|
|
207
|
-
twoPagesRow: {
|
|
208
|
-
gap: 0,
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
function App() {
|
|
214
|
-
return (
|
|
215
|
-
<MushafReaderProvider
|
|
216
|
-
dataId="quran-hafs"
|
|
217
|
-
pageNumber={1}
|
|
218
|
-
styleOverride={styleOverride}
|
|
219
|
-
initialIsTwoPagesView={true}
|
|
220
|
-
>
|
|
221
|
-
<Mushaf />
|
|
222
|
-
</MushafReaderProvider>
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
```
|
|
31
|
+
## Package Structure
|
|
32
|
+
|
|
33
|
+
- `misraj-mushaf-renderer`: full package, including the default React UI, core helpers, and the Quranhub adapter
|
|
34
|
+
- `misraj-mushaf-renderer/core`: headless controller hook, public types, and shaping utilities
|
|
35
|
+
- `misraj-mushaf-renderer/react-ui`: the default React reader, provider, and context hook
|
|
36
|
+
- `misraj-mushaf-renderer/adapters/quranhub`: optional data-source adapter for Quranhub
|
|
37
|
+
|
|
38
|
+
## How to Use
|
|
39
|
+
|
|
40
|
+
Import the packaged styles once:
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import 'misraj-mushaf-renderer/dist/styles';
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 1. Drop-in Reader
|
|
47
|
+
|
|
48
|
+
Use `MushafReader` when you want a single self-contained component:
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { MushafReader } from 'misraj-mushaf-renderer';
|
|
52
|
+
|
|
53
|
+
function App() {
|
|
54
|
+
return (
|
|
55
|
+
<MushafReader
|
|
56
|
+
dataId="quran-hafs"
|
|
57
|
+
pageNumber={1}
|
|
58
|
+
defaultTwoPageView
|
|
59
|
+
theme={{
|
|
60
|
+
borderColor: 'sepia',
|
|
61
|
+
wordHighlightColor: '#D4AF37',
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2. Host-Controlled Data and State
|
|
69
|
+
|
|
70
|
+
Use the new core/controller API when the host app should own fetching, page state, or selected verse state:
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { MushafReader, useMushafController } from 'misraj-mushaf-renderer';
|
|
74
|
+
|
|
75
|
+
function ControlledReader({ pageData }) {
|
|
76
|
+
const controller = useMushafController({
|
|
77
|
+
dataId: 'quran-hafs',
|
|
78
|
+
pageNumber: 1,
|
|
79
|
+
pageData,
|
|
80
|
+
defaultTwoPageView: false,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<MushafReader
|
|
85
|
+
dataId="quran-hafs"
|
|
86
|
+
pageNumber={controller.pageNumber}
|
|
87
|
+
pageData={pageData}
|
|
88
|
+
selectedVerse={controller.selectedVerse}
|
|
89
|
+
onSelectedVerseChange={controller.setSelectedVerse}
|
|
90
|
+
fontScale={controller.fontScale}
|
|
91
|
+
onFontScaleChange={controller.setFontScale}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 3. Custom Data Source
|
|
98
|
+
|
|
99
|
+
Use `dataSource` for adapter mode without hardcoding Quranhub into your app shell:
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import { MushafReader } from 'misraj-mushaf-renderer';
|
|
103
|
+
import { createQuranhubDataSource } from 'misraj-mushaf-renderer/adapters/quranhub';
|
|
104
|
+
|
|
105
|
+
const dataSource = createQuranhubDataSource({ environment: 'production' });
|
|
106
|
+
|
|
107
|
+
function App() {
|
|
108
|
+
return (
|
|
109
|
+
<MushafReader
|
|
110
|
+
dataId="quran-hafs"
|
|
111
|
+
pageNumber={1}
|
|
112
|
+
dataSource={dataSource}
|
|
113
|
+
narrationDifferencesRequest={{
|
|
114
|
+
sourceEditionIdentifier: 'quran-warsh',
|
|
115
|
+
targetEditionIdentifier: 'quran-hafs',
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Styling and Customization
|
|
123
|
+
|
|
124
|
+
Theme variables are now scoped to each reader root instead of mutating `document.documentElement`, so multiple differently themed readers can coexist on the same page.
|
|
125
|
+
|
|
126
|
+
### `theme`
|
|
127
|
+
|
|
128
|
+
Use semantic theme tokens:
|
|
129
|
+
|
|
130
|
+
- `borderColor`
|
|
131
|
+
- `wordHighlightColor`
|
|
132
|
+
- `chapterHeaderFontSize`
|
|
133
|
+
- `primaryFontColor`
|
|
134
|
+
- `fontSize`
|
|
135
|
+
- `spacingMega`
|
|
136
|
+
|
|
137
|
+
### `classNames`, `styles`, and `slotProps`
|
|
138
|
+
|
|
139
|
+
Use stable slot names instead of internal SCSS module keys:
|
|
140
|
+
|
|
141
|
+
- `root`
|
|
142
|
+
- `twoPageLayout`
|
|
143
|
+
- `page`
|
|
144
|
+
- `pageBorder`
|
|
145
|
+
- `pageMeta`
|
|
146
|
+
- `pageNumber`
|
|
147
|
+
- `line`
|
|
148
|
+
- `verseText`
|
|
149
|
+
- `word`
|
|
150
|
+
- `wordHighlighted`
|
|
151
|
+
- `chapterHeader`
|
|
152
|
+
- `chapterIcon`
|
|
153
|
+
|
|
154
|
+
### Render Overrides
|
|
155
|
+
|
|
156
|
+
The default UI can be customized without forking internal components:
|
|
157
|
+
|
|
158
|
+
- `renderWord`
|
|
159
|
+
- `renderLine`
|
|
160
|
+
- `renderPageMeta`
|
|
161
|
+
- `renderChapterHeader`
|
|
162
|
+
|
|
163
|
+
Each renderer receives typed context plus `defaultNode`, so hosts can wrap or replace the default output.
|
|
164
|
+
|
|
165
|
+
## Compatibility
|
|
166
|
+
|
|
167
|
+
- `MushafReaderProvider` and `Mushaf` still exist for compatibility with the older provider-consumer pattern.
|
|
168
|
+
- The provider now uses the same explicit props as `MushafReader`, including `dataSource`, `defaultFontScale`, `defaultTwoPageView`, and `narrationDifferencesRequest`.
|
|
169
|
+
|
|
170
|
+
## Notes
|
|
171
|
+
|
|
172
|
+
- The default package still exports `useMushafContext` for apps that want access to the reader controller from inside the provider tree.
|
|
173
|
+
- The core layer is intentionally independent from any specific backend. Quranhub support now lives behind the shipped adapter.
|
|
174
|
+
```tsx
|
|
175
|
+
import { Mushaf, MushafReaderProvider } from 'misraj-mushaf-renderer';
|
|
176
|
+
|
|
177
|
+
function LegacyApp() {
|
|
178
|
+
return (
|
|
179
|
+
<MushafReaderProvider dataId="quran-hafs" pageNumber={1} defaultTwoPageView>
|
|
180
|
+
<Mushaf />
|
|
181
|
+
</MushafReaderProvider>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createQuranhubDataSource, type QuranhubDataSourceOptions } from './quranhub';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MushafDataSource } from '../core/types';
|
|
2
|
+
export type QuranhubEnvironment = 'production' | 'staging';
|
|
3
|
+
export type QuranhubDataSourceOptions = {
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
environment?: QuranhubEnvironment;
|
|
6
|
+
fetchImplementation?: typeof fetch;
|
|
7
|
+
};
|
|
8
|
+
export declare const createQuranhubDataSource: (options?: QuranhubDataSourceOptions) => MushafDataSource;
|
|
9
|
+
export default createQuranhubDataSource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/classnames.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const mushafSlots: readonly ["root", "twoPageLayout", "page", "pageBorder", "pageMeta", "pageNumber", "line", "verseText", "word", "wordHighlighted", "chapterHeader", "chapterIcon"];
|
|
1
2
|
declare const classnames: {
|
|
2
3
|
ChapterIconContainer: readonly ["iconContainer"];
|
|
3
4
|
MushafWord: readonly ["colored", "filled", "highlightOnHover", "highlighted", "differenceHighlight"];
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { MushafClassNames, MushafRenderers, MushafSlotProps, MushafStyles, MushafTheme } from '../../core';
|
|
1
2
|
import { MushafPageProviderProps } from './contexts/MushafPage/MushafPageProvider';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export type MushafReaderProviderProps = MushafPageProviderProps & {
|
|
4
|
+
theme?: MushafTheme;
|
|
5
|
+
classNames?: MushafClassNames;
|
|
6
|
+
styles?: MushafStyles;
|
|
7
|
+
slotProps?: MushafSlotProps;
|
|
8
|
+
renderers?: MushafRenderers;
|
|
6
9
|
};
|
|
7
|
-
declare const MushafReaderProvider: ({ children,
|
|
10
|
+
declare const MushafReaderProvider: ({ children, theme, classNames, styles, slotProps, renderers, ...props }: MushafReaderProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
11
|
export default MushafReaderProvider;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { default as Word } from '../../../types/Word';
|
|
2
|
-
import { BorderColor } from '../../../types/border-color';
|
|
3
2
|
type LineProps = {
|
|
4
3
|
words: Word[];
|
|
5
4
|
lineKey: string;
|
|
@@ -8,7 +7,6 @@ type LineProps = {
|
|
|
8
7
|
lineIndex: number;
|
|
9
8
|
onWordClick?: (word: Word, event: React.MouseEvent<HTMLElement>) => void;
|
|
10
9
|
onWordHover?: (word: Word, event: React.MouseEvent<HTMLElement>) => void;
|
|
11
|
-
borderColor?: BorderColor;
|
|
12
10
|
};
|
|
13
|
-
declare const _default: import('react').MemoExoticComponent<({ lineKey, words, isBigTextLayout, pageIndex, lineIndex, onWordClick, onWordHover, }: LineProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
|
+
declare const _default: import('react').MemoExoticComponent<({ lineKey, words, isBigTextLayout, pageIndex, lineIndex, onWordClick, onWordHover, }: LineProps) => string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined>;
|
|
14
12
|
export default _default;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { default as Word } from '../../../types/Word';
|
|
3
3
|
import { Ayah } from '../../../types/verses';
|
|
4
|
-
import { StyleOverride } from '../contexts/Theme/type';
|
|
5
4
|
type PageProps = {
|
|
6
5
|
verses: Ayah[];
|
|
7
6
|
pageNumber: number;
|
|
8
7
|
pageIndex: number;
|
|
9
8
|
onWordClick?: (word: Word, event: React.MouseEvent<HTMLElement>) => void;
|
|
10
9
|
onWordHover?: (word: Word, event: React.MouseEvent<HTMLElement>) => void;
|
|
11
|
-
pageStyleOverride?: StyleOverride['Page'];
|
|
12
10
|
};
|
|
13
|
-
declare const Page: ({ verses, pageNumber, pageIndex, onWordClick, onWordHover,
|
|
11
|
+
declare const Page: ({ verses, pageNumber, pageIndex, onWordClick, onWordHover, }: PageProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
12
|
export default Page;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { default as Word } from '../../../../types/Word';
|
|
2
1
|
import { default as React } from 'react';
|
|
3
|
-
|
|
4
|
-
type
|
|
5
|
-
export type DataId = NarrationId | ReciterId;
|
|
2
|
+
import { default as Word } from '../../../../types/Word';
|
|
3
|
+
export type { DataId } from '../../../../core/types';
|
|
6
4
|
export interface MushafPageProps {
|
|
7
5
|
onWordClick?: (word: Word, event: React.MouseEvent<HTMLElement>) => void;
|
|
8
6
|
onWordHover?: (word: Word, event: React.MouseEvent<HTMLElement>) => void;
|
|
9
7
|
}
|
|
10
|
-
export {};
|
|
@@ -1,46 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type
|
|
9
|
-
fontScale: number;
|
|
10
|
-
selectedVerse: Ayah | null;
|
|
11
|
-
ayat: IVersesListDto | null;
|
|
12
|
-
nextPageAyat: IVersesListDto | null;
|
|
13
|
-
narrationDifferences: NarrationDifferences | null;
|
|
14
|
-
error: Error | null;
|
|
15
|
-
pageNumber: number;
|
|
16
|
-
dataId: DataId;
|
|
17
|
-
hasBorder: boolean;
|
|
18
|
-
initialIsTwoPagesView: boolean;
|
|
19
|
-
};
|
|
20
|
-
type MushafPageActions = {
|
|
21
|
-
increaseFontScale: () => void;
|
|
22
|
-
decreaseFontScale: () => void;
|
|
23
|
-
setSelectedVerse: React.Dispatch<React.SetStateAction<Ayah | null>>;
|
|
24
|
-
refresh: () => void;
|
|
25
|
-
};
|
|
26
|
-
export type HostApiEnvironment = 'production' | 'staging';
|
|
27
|
-
export type MushafPageProviderProps = {
|
|
28
|
-
children: React.ReactNode;
|
|
29
|
-
dataId: DataId;
|
|
30
|
-
hostApiEnvironment?: HostApiEnvironment;
|
|
31
|
-
pageNumber: number;
|
|
32
|
-
initialFontScale?: number;
|
|
33
|
-
hasBorder?: boolean;
|
|
34
|
-
initialIsTwoPagesView?: boolean;
|
|
35
|
-
themeProps?: ThemeProviderProps['themeProps'];
|
|
36
|
-
styleOverride?: ThemeProviderProps['styleOverride'];
|
|
37
|
-
showNarrationDifferences?: {
|
|
38
|
-
sourceEditionIdentifier: string;
|
|
39
|
-
targetEditionIdentifier: string;
|
|
40
|
-
} | null;
|
|
41
|
-
};
|
|
42
|
-
export declare const MushafPageProvider: ({ children, dataId, pageNumber, initialFontScale, hasBorder, initialIsTwoPagesView, showNarrationDifferences, hostApiEnvironment, }: MushafPageProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
export type MushafContextStateTypes = MushafPageState & MushafPageActions;
|
|
44
|
-
/** Convenience: keep a compat hook name if you prefer */
|
|
45
|
-
export declare const useMushafContext: () => MushafContextStateTypes;
|
|
46
|
-
export {};
|
|
2
|
+
import { MushafReaderValue, useMushafController } from '../../../../core';
|
|
3
|
+
export type MushafPageProviderProps = React.PropsWithChildren<Parameters<typeof useMushafController>[0] & {
|
|
4
|
+
value?: MushafReaderValue;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const MushafPageProvider: ({ children, value, dataSource, ...controllerOptions }: MushafPageProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const useMushafContext: () => MushafReaderValue;
|
|
8
|
+
export type MushafContextStateTypes = MushafReaderValue;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ThemeProviderProps, ThemeState } from './type';
|
|
2
2
|
export declare const useThemeContext: () => ThemeState;
|
|
3
|
-
export declare const ThemeProvider: ({ children,
|
|
3
|
+
export declare const ThemeProvider: ({ children, theme, classNames, styles, slotProps, renderers, }: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { BorderColor } from '../../../../types/border-color';
|
|
4
|
-
type ThemeProps = {
|
|
5
|
-
borderColor?: BorderColor;
|
|
6
|
-
wordHighlightColor?: string;
|
|
7
|
-
chapterHeaderFontSize?: string;
|
|
8
|
-
primaryFontColor?: string;
|
|
9
|
-
fontSize?: string;
|
|
10
|
-
};
|
|
11
|
-
type ClassnameGroups = typeof classnames;
|
|
12
|
-
type GroupName = keyof ClassnameGroups;
|
|
13
|
-
type GroupKey<K extends GroupName> = ClassnameGroups[K][number];
|
|
14
|
-
export type StyleOverride = {
|
|
15
|
-
[K in GroupName]?: Partial<Record<GroupKey<K>, React.CSSProperties>>;
|
|
16
|
-
};
|
|
2
|
+
import { MushafClassNames, MushafRenderers, MushafSlotProps, MushafStyles, MushafTheme } from '../../../../core/types';
|
|
17
3
|
export type ThemeState = {
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
theme: MushafTheme;
|
|
5
|
+
classNames: MushafClassNames;
|
|
6
|
+
styles: MushafStyles;
|
|
7
|
+
slotProps: MushafSlotProps;
|
|
8
|
+
renderers: MushafRenderers;
|
|
9
|
+
rootStyle: React.CSSProperties;
|
|
20
10
|
};
|
|
21
11
|
export type ThemeProviderProps = {
|
|
22
12
|
children: React.ReactNode;
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
theme?: MushafTheme;
|
|
14
|
+
classNames?: MushafClassNames;
|
|
15
|
+
styles?: MushafStyles;
|
|
16
|
+
slotProps?: MushafSlotProps;
|
|
17
|
+
renderers?: MushafRenderers;
|
|
25
18
|
};
|
|
26
|
-
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { MushafSlot } from '../../core/types';
|
|
3
|
+
export declare const useSlotClassName: (slot: MushafSlot, defaultClassName?: string) => string;
|
|
4
|
+
export declare const useSlotStyle: (slot: MushafSlot, fallbackStyle?: CSSProperties) => CSSProperties;
|
|
5
|
+
export declare const mergeSlotStyles: (...styles: Array<CSSProperties | undefined>) => CSSProperties;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as Word } from '../types/Word';
|
|
2
|
+
import { NarrationDifference } from '../types/differences';
|
|
3
|
+
import { Ayah } from '../types/verses';
|
|
4
|
+
export declare const groupVersesByLines: (verses: Ayah[]) => Record<string, Word[]>;
|
|
5
|
+
export type NarrationDifferenceInfo = {
|
|
6
|
+
differenceText: string;
|
|
7
|
+
differenceContent: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const buildNarrationDifferencesMap: (narrationDifferences: NarrationDifference[] | null | undefined) => Map<string, NarrationDifferenceInfo> | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|