@qirtaas/core 0.1.0 → 0.2.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 +9 -1
- package/dist/client.d.ts +21 -4
- package/dist/index.d.ts +2 -0
- package/dist/mount/listDocuments.d.ts +12 -0
- package/dist/mount/sharing.d.ts +17 -0
- package/dist/qirtaas.js +3588 -3545
- package/dist/qirtaas.umd.js +74 -74
- package/dist/services/documents.d.ts +9 -0
- package/package.json +35 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @qirtaas/core
|
|
2
2
|
|
|
3
|
-
Framework-agnostic, embeddable rich-text editor SDK for Islamic
|
|
3
|
+
Framework-agnostic, embeddable rich-text editor SDK for Islamic
|
|
4
4
|
writing (Qur'an verses, hadith, RTL/Arabic typography). Ships a single bundle
|
|
5
5
|
with a self-contained mount API and its own scoped styles, so it drops into any
|
|
6
6
|
host page without leaking CSS or fighting the host's framework.
|
|
@@ -55,6 +55,14 @@ qirtaas.mountRenderer("#renderer", {
|
|
|
55
55
|
The host must give the editor mount element a bounded height; the renderer grows
|
|
56
56
|
with its content.
|
|
57
57
|
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
Full docs at [docs.qirtaas.io](https://docs.qirtaas.io). For AI coding
|
|
61
|
+
assistants: the complete docs as one markdown file at
|
|
62
|
+
[docs.qirtaas.io/llms-full.txt](https://docs.qirtaas.io/llms-full.txt), and
|
|
63
|
+
ready-made integration prompts at
|
|
64
|
+
[docs.qirtaas.io/ai/build-with-ai](https://docs.qirtaas.io/ai/build-with-ai).
|
|
65
|
+
|
|
58
66
|
## License
|
|
59
67
|
|
|
60
68
|
MIT
|
package/dist/client.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { DuplicateDocumentResult } from './mount/duplicateDocument';
|
|
2
|
+
import { DocumentSummary } from './mount/listDocuments';
|
|
3
|
+
import { ShareInfo } from './mount/sharing';
|
|
2
4
|
import { EditorMountOptions, EditorInstance, RendererMountOptions, RendererInstance } from './mount/types';
|
|
3
5
|
export interface QirtaasClientOptions {
|
|
4
6
|
/** Qirtaas API base URL. Default: https://api.qirtaas.io */
|
|
5
7
|
apiUrl?: string;
|
|
6
8
|
/**
|
|
7
|
-
* Returns a short-lived embed token, shared by the editor
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Returns a short-lived embed token, shared by the editor and the mount-less
|
|
10
|
+
* ops (listDocuments, deleteDocument, duplicateDocument; called on init,
|
|
11
|
+
* before exp, and on 401). Optional: a renderer-only client — which carries
|
|
12
|
+
* its own per-read auth — can omit it; the editor and the mount-less ops
|
|
13
|
+
* throw if it is missing.
|
|
11
14
|
*/
|
|
12
15
|
getToken?: () => Promise<string> | string;
|
|
13
16
|
}
|
|
@@ -16,6 +19,12 @@ export interface QirtaasClient {
|
|
|
16
19
|
mountEditor(el: Element | string, options?: EditorMountOptions): EditorInstance;
|
|
17
20
|
/** Boot the read-only renderer; auth (signature/token/shareToken) is per-call. */
|
|
18
21
|
mountRenderer(el: Element | string, options: RendererMountOptions): RendererInstance;
|
|
22
|
+
/**
|
|
23
|
+
* List the identity's documents (id + server-derived title, no content) over
|
|
24
|
+
* the embed-token channel — lets a host render a document list without
|
|
25
|
+
* keeping its own index of ids.
|
|
26
|
+
*/
|
|
27
|
+
listDocuments(): Promise<DocumentSummary[]>;
|
|
19
28
|
/** Delete a document over the embed-token channel (no mount required). */
|
|
20
29
|
deleteDocument(documentId: string): Promise<void>;
|
|
21
30
|
/**
|
|
@@ -23,5 +32,13 @@ export interface QirtaasClient {
|
|
|
23
32
|
* host keep a stable published document while the author edits a private clone.
|
|
24
33
|
*/
|
|
25
34
|
duplicateDocument(documentId: string): Promise<DuplicateDocumentResult>;
|
|
35
|
+
/** Read a document's sharing state (and token, if shared) over the embed-token channel. */
|
|
36
|
+
getShareInfo(documentId: string): Promise<ShareInfo>;
|
|
37
|
+
/**
|
|
38
|
+
* Turn public sharing on or off. Enabling mints (or returns the existing)
|
|
39
|
+
* share token — pass it to `mountRenderer({ shareToken })` for public reads.
|
|
40
|
+
* Disabling revokes it.
|
|
41
|
+
*/
|
|
42
|
+
setSharing(documentId: string, isShared: boolean): Promise<ShareInfo>;
|
|
26
43
|
}
|
|
27
44
|
export declare function createQirtaasClient(config?: QirtaasClientOptions): QirtaasClient;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { createQirtaasClient } from './client';
|
|
2
2
|
export type { QirtaasClient, QirtaasClientOptions } from './client';
|
|
3
3
|
export type { DuplicateDocumentResult } from './mount/duplicateDocument';
|
|
4
|
+
export type { DocumentSummary } from './mount/listDocuments';
|
|
5
|
+
export type { ShareInfo } from './mount/sharing';
|
|
4
6
|
export type { EditorMountOptions, EditorInstance, RendererMountOptions, RendererInstance, Json, Locale, Theme, SaveState, ErrorCode, AutosaveOptions, } from './mount/types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DocumentSummary } from '../services/documents';
|
|
2
|
+
export type { DocumentSummary };
|
|
3
|
+
/**
|
|
4
|
+
* Internal boot options. apiUrl + getToken are resolved by the client; hosts
|
|
5
|
+
* call `createQirtaasClient({ apiUrl, getToken }).listDocuments()`.
|
|
6
|
+
*/
|
|
7
|
+
export interface ListDocumentsOptions {
|
|
8
|
+
apiUrl: string;
|
|
9
|
+
/** Embed token source — the same the editor uses (shared at the client). */
|
|
10
|
+
getToken: () => Promise<string> | string;
|
|
11
|
+
}
|
|
12
|
+
export declare function listDocuments(opts: ListDocumentsOptions): Promise<DocumentSummary[]>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ShareInfo } from '../services/documents';
|
|
2
|
+
export type { ShareInfo };
|
|
3
|
+
/**
|
|
4
|
+
* Internal boot options. apiUrl + getToken are resolved by the client; hosts
|
|
5
|
+
* call `createQirtaasClient({ apiUrl, getToken }).setSharing(documentId, isShared)`
|
|
6
|
+
* or `.getShareInfo(documentId)`.
|
|
7
|
+
*/
|
|
8
|
+
export interface SharingOptions {
|
|
9
|
+
apiUrl: string;
|
|
10
|
+
documentId: string;
|
|
11
|
+
/** Embed token source — the same the editor uses (shared at the client). */
|
|
12
|
+
getToken: () => Promise<string> | string;
|
|
13
|
+
}
|
|
14
|
+
export declare function getShareInfo(opts: SharingOptions): Promise<ShareInfo>;
|
|
15
|
+
export declare function setSharing(opts: SharingOptions & {
|
|
16
|
+
isShared: boolean;
|
|
17
|
+
}): Promise<ShareInfo>;
|