@qirtaas/core 0.0.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.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/client.d.ts +27 -0
- package/dist/components/EmbedEditorApp.vue.d.ts +29 -0
- package/dist/components/EmbedRendererApp.vue.d.ts +16 -0
- package/dist/composables/useDocumentAutosave.d.ts +41 -0
- package/dist/composables/useHadithDetail.d.ts +44 -0
- package/dist/composables/useIsMobile.d.ts +3 -0
- package/dist/composables/useVerseDetail.d.ts +66 -0
- package/dist/data/mushaf.d.ts +19 -0
- package/dist/editor/AtomBubbleMenu.vue.d.ts +26 -0
- package/dist/editor/DocumentEditor.vue.d.ts +29 -0
- package/dist/editor/EditorToolbar.vue.d.ts +19 -0
- package/dist/editor/EmojiMenu.vue.d.ts +20 -0
- package/dist/editor/FindReplaceBar.vue.d.ts +14 -0
- package/dist/editor/HadithDetailPanel.vue.d.ts +3 -0
- package/dist/editor/HadithNodeView.vue.d.ts +17 -0
- package/dist/editor/HadithSearchDialog.vue.d.ts +22 -0
- package/dist/editor/HonorificView.vue.d.ts +11 -0
- package/dist/editor/ImageUploadDialog.vue.d.ts +12 -0
- package/dist/editor/QuranSearchDialog.vue.d.ts +51 -0
- package/dist/editor/QuranVerseView.vue.d.ts +23 -0
- package/dist/editor/ReportDataDialog.vue.d.ts +12 -0
- package/dist/editor/SlashMenu.vue.d.ts +12 -0
- package/dist/editor/TableBubbleMenu.vue.d.ts +7 -0
- package/dist/editor/VerseDetailContainer.vue.d.ts +6 -0
- package/dist/editor/VerseDetailPanel.vue.d.ts +3 -0
- package/dist/editor/WordRangePicker.vue.d.ts +37 -0
- package/dist/editor/docUtils.d.ts +4 -0
- package/dist/editor/emojiSuggestion.d.ts +37 -0
- package/dist/editor/extensions/HadithNode.d.ts +8 -0
- package/dist/editor/extensions/Honorific.d.ts +9 -0
- package/dist/editor/extensions/ImageNode.d.ts +14 -0
- package/dist/editor/extensions/QuranMushaf.d.ts +18 -0
- package/dist/editor/extensions/QuranVerse.d.ts +15 -0
- package/dist/editor/extensions/SearchReplace.d.ts +31 -0
- package/dist/editor/extensions/SlashCommand.d.ts +8 -0
- package/dist/editor/extensions/resizableImageNodeView.d.ts +10 -0
- package/dist/editor/quran/MushafPage.vue.d.ts +17 -0
- package/dist/editor/quran/PagePicker.vue.d.ts +12 -0
- package/dist/editor/quran/QuranSearchStep.vue.d.ts +15 -0
- package/dist/editor/quran/SurahBrowserStep.vue.d.ts +65 -0
- package/dist/editor/quran/WordSelectStep.vue.d.ts +32 -0
- package/dist/editor/quran/formatReference.d.ts +12 -0
- package/dist/editor/quran/useQuranSelection.d.ts +50 -0
- package/dist/editor/runtime/analytics.d.ts +3 -0
- package/dist/editor/runtime/context.d.ts +8 -0
- package/dist/i18n/ar.d.ts +159 -0
- package/dist/i18n/en.d.ts +159 -0
- package/dist/index.d.ts +4 -0
- package/dist/mount/deleteDocument.d.ts +11 -0
- package/dist/mount/duplicateDocument.d.ts +15 -0
- package/dist/mount/editor.d.ts +11 -0
- package/dist/mount/overlay.d.ts +10 -0
- package/dist/mount/renderer.d.ts +10 -0
- package/dist/mount/types.d.ts +80 -0
- package/dist/qirtaas.css +1 -0
- package/dist/qirtaas.js +77248 -0
- package/dist/qirtaas.umd.js +2218 -0
- package/dist/services/contentChannel.d.ts +6 -0
- package/dist/services/documents.d.ts +23 -0
- package/dist/services/embedTransport.d.ts +11 -0
- package/dist/services/fetchChannel.d.ts +17 -0
- package/dist/services/hadith.d.ts +18 -0
- package/dist/services/images.d.ts +10 -0
- package/dist/services/quran.d.ts +52 -0
- package/dist/services/rendererTransport.d.ts +12 -0
- package/dist/services/tokenManager.d.ts +12 -0
- package/dist/services/transport.d.ts +18 -0
- package/dist/styles/primevuePreset.d.ts +12 -0
- package/package.json +59 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type Json = Record<string, unknown>;
|
|
2
|
+
export interface QirtaasDocument {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
content: Json | null;
|
|
6
|
+
status: string;
|
|
7
|
+
created_at: string;
|
|
8
|
+
updated_at: string;
|
|
9
|
+
}
|
|
10
|
+
export interface UpdateResult extends QirtaasDocument {
|
|
11
|
+
/** Image ids referenced in content that the server refused to link. */
|
|
12
|
+
rejected_image_ids: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare function getDocument(id: string): Promise<QirtaasDocument>;
|
|
15
|
+
export declare function createDocument(content?: Json): Promise<QirtaasDocument>;
|
|
16
|
+
export declare function updateDocument(id: string, content: Json): Promise<UpdateResult>;
|
|
17
|
+
export declare function deleteDocument(id: string): Promise<void>;
|
|
18
|
+
export interface SharedDocument {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
content: Json | null;
|
|
22
|
+
}
|
|
23
|
+
export declare function getSharedDocument(token: string): Promise<SharedDocument>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { QirtaasTransport } from './transport';
|
|
2
|
+
export interface EmbedTransportOptions {
|
|
3
|
+
apiUrl: string;
|
|
4
|
+
getToken: () => Promise<string> | string;
|
|
5
|
+
/** Forwarded to the token manager; fired when a forced refresh fails. */
|
|
6
|
+
onTokenExpired?: () => void;
|
|
7
|
+
/** Content API base (defaults to apiUrl) + key for quran/hadith/mushaf. */
|
|
8
|
+
contentApiUrl?: string;
|
|
9
|
+
contentApiKey?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function createEmbedTransport(opts: EmbedTransportOptions): QirtaasTransport;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Channel } from './transport';
|
|
2
|
+
export declare class QirtaasHttpError extends Error {
|
|
3
|
+
status: number;
|
|
4
|
+
path: string;
|
|
5
|
+
/** Parsed JSON error body, if any (backend uses { error: "code" }). */
|
|
6
|
+
body?: unknown | undefined;
|
|
7
|
+
constructor(status: number, path: string,
|
|
8
|
+
/** Parsed JSON error body, if any (backend uses { error: "code" }). */
|
|
9
|
+
body?: unknown | undefined);
|
|
10
|
+
}
|
|
11
|
+
export interface ChannelAuth {
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
params?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createFetchChannel(apiUrl: string, auth: () => Promise<ChannelAuth> | ChannelAuth,
|
|
16
|
+
/** Called on a 401 before a single retry — e.g. drop a stale cached token. */
|
|
17
|
+
onUnauthorized?: () => void): Channel;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface HadithResult {
|
|
2
|
+
id: number;
|
|
3
|
+
slug: string;
|
|
4
|
+
collection_name_arabic: string;
|
|
5
|
+
collection_name_english: string;
|
|
6
|
+
number: number | null;
|
|
7
|
+
text: string;
|
|
8
|
+
translation_en: string;
|
|
9
|
+
narrator_chain: string;
|
|
10
|
+
grade: string;
|
|
11
|
+
arabic_bab_name: string;
|
|
12
|
+
english_bab_name: string;
|
|
13
|
+
english_grade: string;
|
|
14
|
+
/** Trimmed excerpt with matched words wrapped in <mark>; null for ref lookups. */
|
|
15
|
+
text_highlighted?: string | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function searchHadith(query: string): Promise<HadithResult[]>;
|
|
18
|
+
export declare function getHadithByRef(slug: string, number: number): Promise<HadithResult[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const MAX_IMAGE_BYTES: number;
|
|
2
|
+
export interface UploadTicket {
|
|
3
|
+
image_id: string;
|
|
4
|
+
upload_url: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function requestUploadUrl(filename: string, contentType: string): Promise<UploadTicket>;
|
|
7
|
+
export declare function uploadToPresignedUrl(url: string, file: File): Promise<void>;
|
|
8
|
+
export declare function confirmUpload(imageId: string): Promise<void>;
|
|
9
|
+
export declare function invalidateImageUrl(imageId: string): void;
|
|
10
|
+
export declare function getImageUrl(imageId: string, documentId?: string): Promise<string>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface SurahBrief {
|
|
2
|
+
number: number;
|
|
3
|
+
name_arabic: string;
|
|
4
|
+
name_english: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AyahResult {
|
|
7
|
+
surah: SurahBrief;
|
|
8
|
+
number: number;
|
|
9
|
+
text: string;
|
|
10
|
+
}
|
|
11
|
+
export interface VerseTafsir {
|
|
12
|
+
slug: string;
|
|
13
|
+
name: string;
|
|
14
|
+
language: string;
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
export interface VerseDetail {
|
|
18
|
+
surah: number;
|
|
19
|
+
ayah: number;
|
|
20
|
+
surah_name_arabic: string;
|
|
21
|
+
surah_name_english: string;
|
|
22
|
+
arabic_text: string;
|
|
23
|
+
translation_en: string;
|
|
24
|
+
tafsirs: VerseTafsir[];
|
|
25
|
+
}
|
|
26
|
+
export declare function getVerseDetail(surah: number, ayah: number, _locale: string): Promise<VerseDetail>;
|
|
27
|
+
export interface SurahMatch {
|
|
28
|
+
number: number;
|
|
29
|
+
name_arabic: string;
|
|
30
|
+
name_english: string;
|
|
31
|
+
verse_count: number;
|
|
32
|
+
}
|
|
33
|
+
export interface QuranSearchResponse {
|
|
34
|
+
surahs: SurahMatch[];
|
|
35
|
+
verses: AyahResult[];
|
|
36
|
+
}
|
|
37
|
+
export declare function searchQuran(query: string): Promise<QuranSearchResponse>;
|
|
38
|
+
export { SURAHS, MUSHAF_PAGES, type SurahInfo, type MushafPage, type VerseRef, } from '../data/mushaf';
|
|
39
|
+
export interface VerseRangeResult {
|
|
40
|
+
surah: SurahBrief;
|
|
41
|
+
from_ayah: number;
|
|
42
|
+
to_ayah: number;
|
|
43
|
+
text: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function getVerseRange(surah: number, fromAyah: number, toAyah: number): Promise<VerseRangeResult>;
|
|
46
|
+
export declare function mushafSvgUrl(page: number): string;
|
|
47
|
+
export interface ClipRef {
|
|
48
|
+
page: number;
|
|
49
|
+
lineStart: number;
|
|
50
|
+
lineEnd: number;
|
|
51
|
+
}
|
|
52
|
+
export declare function mushafClipUrl(ref: ClipRef): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QirtaasTransport } from './transport';
|
|
2
|
+
export interface RendererTransportOptions {
|
|
3
|
+
apiUrl: string;
|
|
4
|
+
getToken?: () => Promise<string> | string;
|
|
5
|
+
getSignature?: () => Promise<{
|
|
6
|
+
signature: string;
|
|
7
|
+
exp: number;
|
|
8
|
+
}>;
|
|
9
|
+
contentApiUrl?: string;
|
|
10
|
+
contentApiKey?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function createRendererTransport(opts: RendererTransportOptions): QirtaasTransport;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface TokenManagerOptions {
|
|
2
|
+
getToken: () => Promise<string> | string;
|
|
3
|
+
/** Fired once when a forced refresh fails (host should prompt re-auth). */
|
|
4
|
+
onTokenExpired?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface TokenManager {
|
|
7
|
+
/** A token guaranteed fresh past REFRESH_SKEW_MS, refreshing if needed. */
|
|
8
|
+
getValidToken(): Promise<string>;
|
|
9
|
+
/** Drop the cache so the next getValidToken() re-fetches (used after a 401). */
|
|
10
|
+
invalidate(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createTokenManager(opts: TokenManagerOptions): TokenManager;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Channel {
|
|
2
|
+
/** Full versioned base URL, e.g. ".../v1" — also for static asset URLs. */
|
|
3
|
+
apiUrl: string;
|
|
4
|
+
get<T = unknown>(path: string, opts?: {
|
|
5
|
+
params?: Record<string, unknown>;
|
|
6
|
+
}): Promise<T>;
|
|
7
|
+
post<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
8
|
+
patch<T = unknown>(path: string, body?: unknown): Promise<T>;
|
|
9
|
+
delete<T = unknown>(path: string): Promise<T>;
|
|
10
|
+
}
|
|
11
|
+
export interface QirtaasTransport {
|
|
12
|
+
/** documents + images, authorized by the active mode (bearer/signature/share). */
|
|
13
|
+
data: Channel;
|
|
14
|
+
/** quran / hadith / mushaf, authorized by the content API key. */
|
|
15
|
+
content: Channel;
|
|
16
|
+
}
|
|
17
|
+
export declare function setTransport(transport: QirtaasTransport): void;
|
|
18
|
+
export declare function getTransport(): QirtaasTransport;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const qirtaasPreset: import('@primeuix/themes/types').Preset;
|
|
2
|
+
export declare const embedThemeOptions: {
|
|
3
|
+
prefix: string;
|
|
4
|
+
darkModeSelector: string;
|
|
5
|
+
cssLayer: {
|
|
6
|
+
name: string;
|
|
7
|
+
order: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare function embedPrimeVueOptions(): {
|
|
11
|
+
theme: unknown;
|
|
12
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qirtaas/core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Embeddable rich-text editor SDK for Islamic writings. Framework-agnostic mount API and CDN/UMD bundle.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Alrimaal",
|
|
7
|
+
"homepage": "https://github.com/alrimaal/qirtaas#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/alrimaal/qirtaas.git",
|
|
11
|
+
"directory": "packages/core"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/alrimaal/qirtaas/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"editor",
|
|
18
|
+
"rich-text",
|
|
19
|
+
"wysiwyg",
|
|
20
|
+
"tiptap",
|
|
21
|
+
"arabic",
|
|
22
|
+
"rtl",
|
|
23
|
+
"quran",
|
|
24
|
+
"hadith",
|
|
25
|
+
"qirtaas",
|
|
26
|
+
"embed",
|
|
27
|
+
"sdk"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"main": "./dist/qirtaas.umd.js",
|
|
34
|
+
"module": "./dist/qirtaas.js",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/qirtaas.js",
|
|
40
|
+
"require": "./dist/qirtaas.umd.js"
|
|
41
|
+
},
|
|
42
|
+
"./qirtaas.css": "./dist/qirtaas.css",
|
|
43
|
+
"./*.vue": "./src/*.vue",
|
|
44
|
+
"./*": "./src/*.ts"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "vite build",
|
|
48
|
+
"preview": "vite preview",
|
|
49
|
+
"prepublishOnly": "vite build"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@tailwindcss/postcss": "^4.2.2",
|
|
56
|
+
"postcss-prefix-selector": "^2.1.1",
|
|
57
|
+
"vite-plugin-dts": "^5.0.3"
|
|
58
|
+
}
|
|
59
|
+
}
|