@duskmoon-dev/components 0.5.7 → 0.6.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/README.md +111 -4
- package/dist/chunk-kg46s2vk.js +238 -0
- package/dist/chunk-rd10x4gc.js +733 -0
- package/dist/components/chat/Chat.types.d.ts +15 -0
- package/dist/components/chat/ChatAuthoritativeQueue.d.ts +4 -0
- package/dist/components/chat/ChatSessionComposer.d.ts +4 -0
- package/dist/components/chat/ChatSessionComposer.types.d.ts +46 -0
- package/dist/components/chat/ComposerAttachment.types.d.ts +80 -0
- package/dist/components/chat/ComposerDraft.types.d.ts +89 -0
- package/dist/components/chat/ComposerProvider.types.d.ts +70 -0
- package/dist/components/chat/ComposerQueue.types.d.ts +64 -0
- package/dist/components/chat/ComposerSession.types.d.ts +78 -0
- package/dist/components/chat/ComposerSettings.d.ts +4 -0
- package/dist/components/chat/composer/CompletionList.d.ts +15 -0
- package/dist/components/chat/composer/ComposerShell.d.ts +23 -4
- package/dist/components/chat/composer/DraftLifecycle.d.ts +19 -0
- package/dist/components/chat/composer/EditorAdapter.types.d.ts +36 -0
- package/dist/components/chat/composer/PlainEditor.d.ts +2 -0
- package/dist/components/chat/composer/PlainSemanticEditor.d.ts +6 -0
- package/dist/components/chat/composer/PreservedDraft.d.ts +7 -0
- package/dist/components/chat/composer/SemanticComposer.d.ts +10 -0
- package/dist/components/chat/composer/attachments.d.ts +4 -0
- package/dist/components/chat/composer/document.d.ts +3 -1
- package/dist/components/chat/composer/drafts.d.ts +2 -0
- package/dist/components/chat/composer/providers.d.ts +40 -0
- package/dist/components/chat/composer/session.d.ts +30 -0
- package/dist/components/chat/composer/useComposerAttachments.d.ts +3 -0
- package/dist/components/chat/composer/useComposerDraft.d.ts +3 -0
- package/dist/components/chat/composer/useComposerProviders.d.ts +7 -0
- package/dist/components/chat/composer/useComposerSession.d.ts +16 -0
- package/dist/components/chat/index.d.ts +17 -0
- package/dist/components/chat/index.js +4765 -1286
- package/dist/components/chat/rich/LexicalEditor.d.ts +10 -0
- package/dist/components/chat/rich/RichChatComposer.d.ts +4 -0
- package/dist/components/chat/rich/index.d.ts +2 -0
- package/dist/components/chat/rich/index.js +3478 -0
- package/dist/components/chat/rich/nodes.d.ts +49 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.js +11994 -8740
- package/dist/infrastructure.js +1 -1
- package/dist/styles.css +180 -2
- package/package.json +27 -6
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ChatSessionComposerProps } from "../ChatSessionComposer.types";
|
|
3
|
+
import type { ComposerEditorAdapterProps, ComposerEditorHandle } from "./EditorAdapter.types";
|
|
4
|
+
interface Props extends ChatSessionComposerProps {
|
|
5
|
+
Editor: React.ComponentType<ComposerEditorAdapterProps & React.RefAttributes<ComposerEditorHandle>>;
|
|
6
|
+
structured: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** One shell/lifecycle for semantic plain and optional rich editor adapters. */
|
|
9
|
+
export declare const SemanticComposer: React.ForwardRefExoticComponent<Props & React.RefAttributes<ComposerEditorHandle>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComposerAttachmentController, ComposerAttachmentIntakePolicy, ComposerAttachmentIntakeResult, ComposerAttachmentOptions, ComposerAttachmentSource } from "../ComposerAttachment.types";
|
|
2
|
+
/** Shared validation for native pickers, file paste and drops, including legacy APIs. */
|
|
3
|
+
export declare function validateComposerAttachmentIntake(files: readonly File[], existingCount: number, policy?: ComposerAttachmentIntakePolicy, source?: ComposerAttachmentSource): ComposerAttachmentIntakeResult;
|
|
4
|
+
export declare function createComposerAttachmentController(options: ComposerAttachmentOptions): ComposerAttachmentController;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComposerDocument, ComposerDraft, ComposerScope, ComposerSubmission } from "../Composer.types";
|
|
1
|
+
import type { ComposerDocument, ComposerDraft, ComposerJson, ComposerScope, ComposerSubmission } from "../Composer.types";
|
|
2
2
|
export type ComposerReadResult<T> = {
|
|
3
3
|
readonly status: "compatible";
|
|
4
4
|
readonly value: T;
|
|
@@ -8,6 +8,8 @@ export type ComposerReadResult<T> = {
|
|
|
8
8
|
readonly input: unknown;
|
|
9
9
|
readonly reason: string;
|
|
10
10
|
};
|
|
11
|
+
/** Internal portable-data boundary shared by the lifecycle adapters. */
|
|
12
|
+
export declare function snapshotComposerJson(value: unknown): ComposerJson;
|
|
11
13
|
/** A legacy string always becomes exactly one editable text node, even if empty. */
|
|
12
14
|
export declare function migrateLegacyComposerDocument(text: string): ComposerDocument;
|
|
13
15
|
/** Unknown versions, fields and nodes remain available as the original input. */
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ComposerProviderRequest } from "../Composer.types";
|
|
2
|
+
import type { ComposerCompletionProvider, ComposerProviderContext, ComposerProviderSelectionEffect, ComposerProviderSnapshot } from "../ComposerProvider.types";
|
|
3
|
+
type Trigger = ComposerProviderRequest["trigger"];
|
|
4
|
+
export declare function composerProviderItemId(providerId: string, candidateId: string): string;
|
|
5
|
+
/** Detect only editable text; atomic nodes and claimed commands stay adapter-owned. */
|
|
6
|
+
export declare function matchComposerProviderTrigger(context: ComposerProviderContext, provider: ComposerCompletionProvider): Trigger | undefined;
|
|
7
|
+
/** Scope-safe request bookkeeping; contains no editor state or submission behavior. */
|
|
8
|
+
export declare class ComposerProviderController {
|
|
9
|
+
private readonly prefix;
|
|
10
|
+
private requestSequence;
|
|
11
|
+
private generation;
|
|
12
|
+
private input?;
|
|
13
|
+
private disposed;
|
|
14
|
+
private dismissed;
|
|
15
|
+
private navigationProvider?;
|
|
16
|
+
private breadcrumbs;
|
|
17
|
+
private preferredActiveId?;
|
|
18
|
+
private readonly requests;
|
|
19
|
+
private readonly listeners;
|
|
20
|
+
private snapshot;
|
|
21
|
+
readonly getSnapshot: () => ComposerProviderSnapshot;
|
|
22
|
+
readonly subscribe: (listener: () => void) => () => boolean;
|
|
23
|
+
/** React StrictMode may reconnect a disposed effect without reusing old work. */
|
|
24
|
+
activate(): void;
|
|
25
|
+
update(context: ComposerProviderContext): void;
|
|
26
|
+
dismiss(): void;
|
|
27
|
+
retry(): void;
|
|
28
|
+
/** A depth of zero returns to all matching providers; default goes up one folder. */
|
|
29
|
+
back(depth?: number): void;
|
|
30
|
+
move(direction: 1 | -1): void;
|
|
31
|
+
/** Current adapter state can be supplied to close a just-invalidated selection race. */
|
|
32
|
+
select(itemId?: string | undefined, current?: ComposerProviderContext): ComposerProviderSelectionEffect | undefined;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
private cancel;
|
|
35
|
+
private disabledReason;
|
|
36
|
+
private publish;
|
|
37
|
+
private query;
|
|
38
|
+
private replaceGroup;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ComposerAttempt, ComposerActionEligibility, ComposerRecoveryOwner, ComposerSessionContext, ComposerSessionSnapshot } from "../ComposerSession.types";
|
|
2
|
+
import type { ComposerIntent, ComposerReceipt, ComposerScope, ComposerSubmission } from "../Composer.types";
|
|
3
|
+
export declare function sameComposerScope(a: ComposerScope, b: ComposerScope): boolean;
|
|
4
|
+
export declare class ComposerUncertainTransportError extends Error {
|
|
5
|
+
readonly code = "uncertain_transport";
|
|
6
|
+
}
|
|
7
|
+
/** All callbacks receive detached immutable snapshots, never live editor state. */
|
|
8
|
+
export declare function createComposerRecoveryOwner(initial?: readonly ComposerAttempt[], onRetain?: (attempt: ComposerAttempt) => void): ComposerRecoveryOwner & {
|
|
9
|
+
forget: (id: string) => void;
|
|
10
|
+
};
|
|
11
|
+
/** Visible actions and keyboard gestures must share this exact policy. */
|
|
12
|
+
export declare function composerActionEligibility(context: ComposerSessionContext, requestedIntent?: ComposerIntent): ComposerActionEligibility;
|
|
13
|
+
/** Untrusted host replies cannot manufacture acceptance or prompt identities. */
|
|
14
|
+
export declare function snapshotComposerReceipt(input: unknown, submission: ComposerSubmission): ComposerReceipt;
|
|
15
|
+
export declare function createComposerSessionController(initial: ComposerSessionContext, identity: {
|
|
16
|
+
readonly instanceId: string;
|
|
17
|
+
readonly nextSubmissionId?: () => string;
|
|
18
|
+
}): {
|
|
19
|
+
/** React StrictMode may replay effects; old attempts never regain editor ownership. */
|
|
20
|
+
activate(): void;
|
|
21
|
+
getSnapshot: () => ComposerSessionSnapshot;
|
|
22
|
+
subscribe: (listener: () => void) => () => boolean;
|
|
23
|
+
update(next: ComposerSessionContext): void;
|
|
24
|
+
eligibility: (intent?: ComposerIntent) => ComposerActionEligibility;
|
|
25
|
+
submit(intent?: ComposerIntent): Promise<ComposerReceipt | undefined>;
|
|
26
|
+
reconcile(id: string): Promise<ComposerReceipt | undefined>;
|
|
27
|
+
retry(id: string): Promise<ComposerReceipt | undefined>;
|
|
28
|
+
dispose(): void;
|
|
29
|
+
};
|
|
30
|
+
export type ComposerSessionController = ReturnType<typeof createComposerSessionController>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ComposerAttachmentOptions, UseComposerAttachmentsResult } from "../ComposerAttachment.types";
|
|
2
|
+
/** Mounted ownership only; hosts retain portable draft/recovery snapshots separately. */
|
|
3
|
+
export declare function useComposerAttachments(options: ComposerAttachmentOptions): UseComposerAttachmentsResult;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ComposerDraftContext, UseComposerDraftResult } from "../ComposerDraft.types";
|
|
2
|
+
/** Storage policy stays with the host; this hook does not impose an autosave cadence. */
|
|
3
|
+
export declare function useComposerDraft(context: ComposerDraftContext): UseComposerDraftResult;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComposerProviderContext } from "../ComposerProvider.types";
|
|
2
|
+
import { ComposerProviderController } from "./providers";
|
|
3
|
+
/** The adapter supplies semantic selection; this hook never reads editor DOM/history. */
|
|
4
|
+
export declare function useComposerProviders(context: ComposerProviderContext): {
|
|
5
|
+
controller: ComposerProviderController;
|
|
6
|
+
snapshot: import("..").ComposerProviderSnapshot;
|
|
7
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComposerSessionContext } from "../ComposerSession.types";
|
|
2
|
+
/** Editing stays controlled; only admission and recovery are stored here. */
|
|
3
|
+
export declare function useComposerSession(context: ComposerSessionContext): {
|
|
4
|
+
controller: {
|
|
5
|
+
activate(): void;
|
|
6
|
+
getSnapshot: () => import("..").ComposerSessionSnapshot;
|
|
7
|
+
subscribe: (listener: () => void) => () => boolean;
|
|
8
|
+
update(next: ComposerSessionContext): void;
|
|
9
|
+
eligibility: (intent?: import("..").ComposerIntent) => import("..").ComposerActionEligibility;
|
|
10
|
+
submit(intent?: import("..").ComposerIntent): Promise<import("..").ComposerReceipt | undefined>;
|
|
11
|
+
reconcile(id: string): Promise<import("..").ComposerReceipt | undefined>;
|
|
12
|
+
retry(id: string): Promise<import("..").ComposerReceipt | undefined>;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
};
|
|
15
|
+
snapshot: import("..").ComposerSessionSnapshot;
|
|
16
|
+
};
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
export * from "./Chat";
|
|
2
2
|
export * from "./ChatComposer";
|
|
3
|
+
export * from "./ChatSessionComposer";
|
|
4
|
+
export * from "./ChatAuthoritativeQueue";
|
|
5
|
+
export * from "./ComposerSettings";
|
|
3
6
|
export * from "./ChatPrimitives";
|
|
4
7
|
export type * from "./Chat.types";
|
|
5
8
|
export type * from "./Composer.types";
|
|
9
|
+
export type * from "./ChatSessionComposer.types";
|
|
10
|
+
export type * from "./ComposerAttachment.types";
|
|
11
|
+
export type * from "./ComposerProvider.types";
|
|
12
|
+
export type * from "./ComposerSession.types";
|
|
13
|
+
export type * from "./ComposerDraft.types";
|
|
14
|
+
export type * from "./ComposerQueue.types";
|
|
15
|
+
export { useComposerDraft } from "./composer/useComposerDraft";
|
|
16
|
+
export { createComposerDraftController } from "./composer/drafts";
|
|
17
|
+
export { useComposerAttachments } from "./composer/useComposerAttachments";
|
|
18
|
+
export { createComposerAttachmentController, validateComposerAttachmentIntake, } from "./composer/attachments";
|
|
19
|
+
export { useComposerProviders } from "./composer/useComposerProviders";
|
|
20
|
+
export { ComposerProviderController } from "./composer/providers";
|
|
21
|
+
export { useComposerSession } from "./composer/useComposerSession";
|
|
22
|
+
export { createComposerSessionController, createComposerRecoveryOwner, composerActionEligibility, ComposerUncertainTransportError, snapshotComposerReceipt, } from "./composer/session";
|
|
6
23
|
export { readComposerDocument, readComposerDraft, snapshotComposerDocument, snapshotComposerSubmission, exportComposerText, exportComposerMarkdown, } from "./composer/document";
|
|
7
24
|
export type { ComposerReadResult } from "./composer/document";
|