@june-ai/june-ui 0.2.4 → 0.2.6
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/CHANGELOG.md +28 -0
- package/dist/chunk-VFZI3SEL.js +520 -0
- package/dist/{document-engine-C6ILFMRP.js → document-engine-RKD5SLXR.js} +1 -1
- package/dist/index.cjs +2469 -729
- package/dist/index.d.cts +48 -4
- package/dist/index.d.ts +48 -4
- package/dist/index.js +2015 -622
- package/dist/june.css +460 -118
- package/package.json +6 -1
- package/dist/chunk-HFHRSNIL.js +0 -174
package/dist/index.d.cts
CHANGED
|
@@ -139,6 +139,13 @@ interface DocumentStore {
|
|
|
139
139
|
remove(id: string): void;
|
|
140
140
|
}
|
|
141
141
|
declare function createDocumentStore(): DocumentStore;
|
|
142
|
+
/**
|
|
143
|
+
* Remembers content produced from the user's own edits (for example when JuneUI rewrites
|
|
144
|
+
* the OpenUI program). When that content comes back through the DocumentEditor props it is
|
|
145
|
+
* ignored instead of being treated as a new AI version.
|
|
146
|
+
*/
|
|
147
|
+
declare function rememberDocumentEcho(store: DocumentStore, id: string, content: string): void;
|
|
148
|
+
declare function isDocumentEcho(store: DocumentStore, id: string, content: string): boolean;
|
|
142
149
|
/** The shared in-memory store used when none is provided. Documents are keyed by documentId. */
|
|
143
150
|
declare function getDefaultDocumentStore(): DocumentStore;
|
|
144
151
|
|
|
@@ -281,13 +288,49 @@ type JuneRendererProps = Omit<OpenUIRendererProps, "library" | "response" | "isS
|
|
|
281
288
|
onJuneError?: (error: JuneError) => void;
|
|
282
289
|
/** Document editor callbacks and store. Memoize this object. */
|
|
283
290
|
documents?: JuneDocumentOptions;
|
|
291
|
+
/**
|
|
292
|
+
* Called with an updated OpenUI program when the user edits a document (body or title).
|
|
293
|
+
* The matching `DocumentEditor(id, title, content)` call is rewritten with the new title and
|
|
294
|
+
* the body as Markdown; nothing else in the program changes. Store the value and pass it back
|
|
295
|
+
* as `response` to keep your program (and any "OpenUI Lang" view) in sync with the editor.
|
|
296
|
+
*/
|
|
297
|
+
onResponseChange?: (response: string, change: ResponseChangeInfo) => void;
|
|
298
|
+
/** Debounce for onResponseChange in ms (default 300). */
|
|
299
|
+
responseChangeDelay?: number;
|
|
284
300
|
loadingFallback?: ReactNode;
|
|
285
301
|
emptyFallback?: ReactNode;
|
|
286
302
|
errorFallback?: ReactNode | ((args: FallbackArgs) => ReactNode);
|
|
287
303
|
resetKeys?: readonly unknown[];
|
|
288
304
|
};
|
|
305
|
+
interface ResponseChangeInfo {
|
|
306
|
+
documentId: string;
|
|
307
|
+
title: string;
|
|
308
|
+
/** The document body written into the program, as Markdown. */
|
|
309
|
+
markdown: string;
|
|
310
|
+
source: DocumentChange["source"];
|
|
311
|
+
}
|
|
289
312
|
declare function JuneRenderer(props: JuneRendererProps): react.JSX.Element;
|
|
290
313
|
|
|
314
|
+
/**
|
|
315
|
+
* Rewrites the arguments of a `DocumentEditor(documentId, title, content, ...)` call inside an
|
|
316
|
+
* OpenUI Lang program, leaving every other character of the program untouched.
|
|
317
|
+
*/
|
|
318
|
+
interface DocumentProgramUpdate {
|
|
319
|
+
title?: string;
|
|
320
|
+
/** New document body (Markdown or a Tiptap JSON string). */
|
|
321
|
+
content?: string;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Finds the DocumentEditor call whose first argument equals `documentId` and replaces its title
|
|
325
|
+
* and/or content. Returns the new program, or null when no matching call was found.
|
|
326
|
+
*/
|
|
327
|
+
declare function updateDocumentInProgram(program: string, documentId: string, update: DocumentProgramUpdate, componentName?: string): string | null;
|
|
328
|
+
/** Reads the current title and content of a DocumentEditor call, or null. */
|
|
329
|
+
declare function readDocumentFromProgram(program: string, documentId: string, componentName?: string): {
|
|
330
|
+
title: string;
|
|
331
|
+
content: string;
|
|
332
|
+
} | null;
|
|
333
|
+
|
|
291
334
|
declare function useResolvedTheme(mode: JuneThemeMode): JuneResolvedTheme;
|
|
292
335
|
interface JuneThemeProviderProps {
|
|
293
336
|
/**
|
|
@@ -413,9 +456,10 @@ type Extendable = Library & {
|
|
|
413
456
|
extend: NonNullable<Library["extend"]>;
|
|
414
457
|
};
|
|
415
458
|
/**
|
|
416
|
-
* Returns a library that contains every component of `library` plus DocumentEditor
|
|
417
|
-
*
|
|
418
|
-
*
|
|
459
|
+
* Returns a library that contains every component of `library` plus DocumentEditor.
|
|
460
|
+
* On Zod 4.1+ it also joins Card's children. Zod 3.25 (what the app bundles) has no
|
|
461
|
+
* `util.mergeDefs`, and OpenUI's slot clone calls that, so the slot step is skipped
|
|
462
|
+
* there. The component is still registered and can be rendered.
|
|
419
463
|
*/
|
|
420
464
|
declare function withDocumentEditor(library: Extendable): Required<_openuidev_lang_core.Library<_openuidev_react_lang.ComponentRenderer<any>, _openuidev_lang_core.DefinedAction<any, string>>>;
|
|
421
465
|
|
|
@@ -501,4 +545,4 @@ declare function JuneUI({ library, ...props }: JuneUIProps): react.JSX.Element;
|
|
|
501
545
|
*/
|
|
502
546
|
declare const juneLibrary: Required<_openuidev_lang_core.Library<_openuidev_react_lang.ComponentRenderer<any>, _openuidev_lang_core.DefinedAction<any, string>>>;
|
|
503
547
|
|
|
504
|
-
export { ALL_EXPORT_FORMATS, type ActionEventParser, type ActionOutcome, type ConfirmAction, type ConsumeStreamOptions, type DocJSON, type DocNode, type DocumentChange, type DocumentConflict, DocumentEditor, type DocumentEditorProps, type DocumentExportEvent, type DocumentExportFormat, type DocumentExporter, type DocumentInstructionOptions, type DocumentRecord, type DocumentSavePayload, type DocumentSnapshot, type DocumentStore, type ExportContext, type ExportResult, type FallbackArgs, type FetchStreamOptions, type JuneAction, type JuneActionContext, type JuneActionDefinition, type JuneActionMap, JuneDocumentContext, JuneDocumentEditorComponent, type JuneDocumentOptions, JuneError, JuneErrorBoundary, type JuneErrorBoundaryProps, type JuneErrorCode, type JuneErrorOptions, type JuneLibraryOptions, JuneRenderer, type JuneRendererProps, type JuneResolvedTheme, JuneRuntimeContext, type JuneStreamState, type JuneThemeMode, JuneThemeProvider, type JuneThemeProviderProps, type JuneThemeVars, JuneUI, type JuneUIProps, type OpenUIActionEvent, type OpenUILibrary, type OpenUIRendererProps, type ParsedActionEvent, type RunActionOptions, type SchemaLike, type SseOptions, type StreamChunk, type StreamSource, type StreamStarter, type StreamStatus, type UseJuneStreamOptions, type UseJuneStreamResult, consumeStream, copyDocumentToClipboard, createActionHandler, createDocumentStore, createJuneLibrary, darkTheme, defaultParseActionEvent, defineJuneAction, defineJuneComponent, documentPromptOptions, downloadResult, exportDocument, fetchStream, getDefaultDocumentStore, getDocumentEditorInstructions, getDocumentEditorRules, isJuneError, jsonFieldExtractor, juneLibrary, lightTheme, listDocumentExporters, mergeDocuments, registerDocumentExporter, runAction, serializeDocumentsForAgent, sseToText, toJuneError, useDocumentOptions, useJuneRuntime, useJuneStream, useJuneTheme, useResolvedTheme, withDocumentEditor };
|
|
548
|
+
export { ALL_EXPORT_FORMATS, type ActionEventParser, type ActionOutcome, type ConfirmAction, type ConsumeStreamOptions, type DocJSON, type DocNode, type DocumentChange, type DocumentConflict, DocumentEditor, type DocumentEditorProps, type DocumentExportEvent, type DocumentExportFormat, type DocumentExporter, type DocumentInstructionOptions, type DocumentProgramUpdate, type DocumentRecord, type DocumentSavePayload, type DocumentSnapshot, type DocumentStore, type ExportContext, type ExportResult, type FallbackArgs, type FetchStreamOptions, type JuneAction, type JuneActionContext, type JuneActionDefinition, type JuneActionMap, JuneDocumentContext, JuneDocumentEditorComponent, type JuneDocumentOptions, JuneError, JuneErrorBoundary, type JuneErrorBoundaryProps, type JuneErrorCode, type JuneErrorOptions, type JuneLibraryOptions, JuneRenderer, type JuneRendererProps, type JuneResolvedTheme, JuneRuntimeContext, type JuneStreamState, type JuneThemeMode, JuneThemeProvider, type JuneThemeProviderProps, type JuneThemeVars, JuneUI, type JuneUIProps, type OpenUIActionEvent, type OpenUILibrary, type OpenUIRendererProps, type ParsedActionEvent, type ResponseChangeInfo, type RunActionOptions, type SchemaLike, type SseOptions, type StreamChunk, type StreamSource, type StreamStarter, type StreamStatus, type UseJuneStreamOptions, type UseJuneStreamResult, consumeStream, copyDocumentToClipboard, createActionHandler, createDocumentStore, createJuneLibrary, darkTheme, defaultParseActionEvent, defineJuneAction, defineJuneComponent, documentPromptOptions, downloadResult, exportDocument, fetchStream, getDefaultDocumentStore, getDocumentEditorInstructions, getDocumentEditorRules, isDocumentEcho, isJuneError, jsonFieldExtractor, juneLibrary, lightTheme, listDocumentExporters, mergeDocuments, readDocumentFromProgram, registerDocumentExporter, rememberDocumentEcho, runAction, serializeDocumentsForAgent, sseToText, toJuneError, updateDocumentInProgram, useDocumentOptions, useJuneRuntime, useJuneStream, useJuneTheme, useResolvedTheme, withDocumentEditor };
|
package/dist/index.d.ts
CHANGED
|
@@ -139,6 +139,13 @@ interface DocumentStore {
|
|
|
139
139
|
remove(id: string): void;
|
|
140
140
|
}
|
|
141
141
|
declare function createDocumentStore(): DocumentStore;
|
|
142
|
+
/**
|
|
143
|
+
* Remembers content produced from the user's own edits (for example when JuneUI rewrites
|
|
144
|
+
* the OpenUI program). When that content comes back through the DocumentEditor props it is
|
|
145
|
+
* ignored instead of being treated as a new AI version.
|
|
146
|
+
*/
|
|
147
|
+
declare function rememberDocumentEcho(store: DocumentStore, id: string, content: string): void;
|
|
148
|
+
declare function isDocumentEcho(store: DocumentStore, id: string, content: string): boolean;
|
|
142
149
|
/** The shared in-memory store used when none is provided. Documents are keyed by documentId. */
|
|
143
150
|
declare function getDefaultDocumentStore(): DocumentStore;
|
|
144
151
|
|
|
@@ -281,13 +288,49 @@ type JuneRendererProps = Omit<OpenUIRendererProps, "library" | "response" | "isS
|
|
|
281
288
|
onJuneError?: (error: JuneError) => void;
|
|
282
289
|
/** Document editor callbacks and store. Memoize this object. */
|
|
283
290
|
documents?: JuneDocumentOptions;
|
|
291
|
+
/**
|
|
292
|
+
* Called with an updated OpenUI program when the user edits a document (body or title).
|
|
293
|
+
* The matching `DocumentEditor(id, title, content)` call is rewritten with the new title and
|
|
294
|
+
* the body as Markdown; nothing else in the program changes. Store the value and pass it back
|
|
295
|
+
* as `response` to keep your program (and any "OpenUI Lang" view) in sync with the editor.
|
|
296
|
+
*/
|
|
297
|
+
onResponseChange?: (response: string, change: ResponseChangeInfo) => void;
|
|
298
|
+
/** Debounce for onResponseChange in ms (default 300). */
|
|
299
|
+
responseChangeDelay?: number;
|
|
284
300
|
loadingFallback?: ReactNode;
|
|
285
301
|
emptyFallback?: ReactNode;
|
|
286
302
|
errorFallback?: ReactNode | ((args: FallbackArgs) => ReactNode);
|
|
287
303
|
resetKeys?: readonly unknown[];
|
|
288
304
|
};
|
|
305
|
+
interface ResponseChangeInfo {
|
|
306
|
+
documentId: string;
|
|
307
|
+
title: string;
|
|
308
|
+
/** The document body written into the program, as Markdown. */
|
|
309
|
+
markdown: string;
|
|
310
|
+
source: DocumentChange["source"];
|
|
311
|
+
}
|
|
289
312
|
declare function JuneRenderer(props: JuneRendererProps): react.JSX.Element;
|
|
290
313
|
|
|
314
|
+
/**
|
|
315
|
+
* Rewrites the arguments of a `DocumentEditor(documentId, title, content, ...)` call inside an
|
|
316
|
+
* OpenUI Lang program, leaving every other character of the program untouched.
|
|
317
|
+
*/
|
|
318
|
+
interface DocumentProgramUpdate {
|
|
319
|
+
title?: string;
|
|
320
|
+
/** New document body (Markdown or a Tiptap JSON string). */
|
|
321
|
+
content?: string;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Finds the DocumentEditor call whose first argument equals `documentId` and replaces its title
|
|
325
|
+
* and/or content. Returns the new program, or null when no matching call was found.
|
|
326
|
+
*/
|
|
327
|
+
declare function updateDocumentInProgram(program: string, documentId: string, update: DocumentProgramUpdate, componentName?: string): string | null;
|
|
328
|
+
/** Reads the current title and content of a DocumentEditor call, or null. */
|
|
329
|
+
declare function readDocumentFromProgram(program: string, documentId: string, componentName?: string): {
|
|
330
|
+
title: string;
|
|
331
|
+
content: string;
|
|
332
|
+
} | null;
|
|
333
|
+
|
|
291
334
|
declare function useResolvedTheme(mode: JuneThemeMode): JuneResolvedTheme;
|
|
292
335
|
interface JuneThemeProviderProps {
|
|
293
336
|
/**
|
|
@@ -413,9 +456,10 @@ type Extendable = Library & {
|
|
|
413
456
|
extend: NonNullable<Library["extend"]>;
|
|
414
457
|
};
|
|
415
458
|
/**
|
|
416
|
-
* Returns a library that contains every component of `library` plus DocumentEditor
|
|
417
|
-
*
|
|
418
|
-
*
|
|
459
|
+
* Returns a library that contains every component of `library` plus DocumentEditor.
|
|
460
|
+
* On Zod 4.1+ it also joins Card's children. Zod 3.25 (what the app bundles) has no
|
|
461
|
+
* `util.mergeDefs`, and OpenUI's slot clone calls that, so the slot step is skipped
|
|
462
|
+
* there. The component is still registered and can be rendered.
|
|
419
463
|
*/
|
|
420
464
|
declare function withDocumentEditor(library: Extendable): Required<_openuidev_lang_core.Library<_openuidev_react_lang.ComponentRenderer<any>, _openuidev_lang_core.DefinedAction<any, string>>>;
|
|
421
465
|
|
|
@@ -501,4 +545,4 @@ declare function JuneUI({ library, ...props }: JuneUIProps): react.JSX.Element;
|
|
|
501
545
|
*/
|
|
502
546
|
declare const juneLibrary: Required<_openuidev_lang_core.Library<_openuidev_react_lang.ComponentRenderer<any>, _openuidev_lang_core.DefinedAction<any, string>>>;
|
|
503
547
|
|
|
504
|
-
export { ALL_EXPORT_FORMATS, type ActionEventParser, type ActionOutcome, type ConfirmAction, type ConsumeStreamOptions, type DocJSON, type DocNode, type DocumentChange, type DocumentConflict, DocumentEditor, type DocumentEditorProps, type DocumentExportEvent, type DocumentExportFormat, type DocumentExporter, type DocumentInstructionOptions, type DocumentRecord, type DocumentSavePayload, type DocumentSnapshot, type DocumentStore, type ExportContext, type ExportResult, type FallbackArgs, type FetchStreamOptions, type JuneAction, type JuneActionContext, type JuneActionDefinition, type JuneActionMap, JuneDocumentContext, JuneDocumentEditorComponent, type JuneDocumentOptions, JuneError, JuneErrorBoundary, type JuneErrorBoundaryProps, type JuneErrorCode, type JuneErrorOptions, type JuneLibraryOptions, JuneRenderer, type JuneRendererProps, type JuneResolvedTheme, JuneRuntimeContext, type JuneStreamState, type JuneThemeMode, JuneThemeProvider, type JuneThemeProviderProps, type JuneThemeVars, JuneUI, type JuneUIProps, type OpenUIActionEvent, type OpenUILibrary, type OpenUIRendererProps, type ParsedActionEvent, type RunActionOptions, type SchemaLike, type SseOptions, type StreamChunk, type StreamSource, type StreamStarter, type StreamStatus, type UseJuneStreamOptions, type UseJuneStreamResult, consumeStream, copyDocumentToClipboard, createActionHandler, createDocumentStore, createJuneLibrary, darkTheme, defaultParseActionEvent, defineJuneAction, defineJuneComponent, documentPromptOptions, downloadResult, exportDocument, fetchStream, getDefaultDocumentStore, getDocumentEditorInstructions, getDocumentEditorRules, isJuneError, jsonFieldExtractor, juneLibrary, lightTheme, listDocumentExporters, mergeDocuments, registerDocumentExporter, runAction, serializeDocumentsForAgent, sseToText, toJuneError, useDocumentOptions, useJuneRuntime, useJuneStream, useJuneTheme, useResolvedTheme, withDocumentEditor };
|
|
548
|
+
export { ALL_EXPORT_FORMATS, type ActionEventParser, type ActionOutcome, type ConfirmAction, type ConsumeStreamOptions, type DocJSON, type DocNode, type DocumentChange, type DocumentConflict, DocumentEditor, type DocumentEditorProps, type DocumentExportEvent, type DocumentExportFormat, type DocumentExporter, type DocumentInstructionOptions, type DocumentProgramUpdate, type DocumentRecord, type DocumentSavePayload, type DocumentSnapshot, type DocumentStore, type ExportContext, type ExportResult, type FallbackArgs, type FetchStreamOptions, type JuneAction, type JuneActionContext, type JuneActionDefinition, type JuneActionMap, JuneDocumentContext, JuneDocumentEditorComponent, type JuneDocumentOptions, JuneError, JuneErrorBoundary, type JuneErrorBoundaryProps, type JuneErrorCode, type JuneErrorOptions, type JuneLibraryOptions, JuneRenderer, type JuneRendererProps, type JuneResolvedTheme, JuneRuntimeContext, type JuneStreamState, type JuneThemeMode, JuneThemeProvider, type JuneThemeProviderProps, type JuneThemeVars, JuneUI, type JuneUIProps, type OpenUIActionEvent, type OpenUILibrary, type OpenUIRendererProps, type ParsedActionEvent, type ResponseChangeInfo, type RunActionOptions, type SchemaLike, type SseOptions, type StreamChunk, type StreamSource, type StreamStarter, type StreamStatus, type UseJuneStreamOptions, type UseJuneStreamResult, consumeStream, copyDocumentToClipboard, createActionHandler, createDocumentStore, createJuneLibrary, darkTheme, defaultParseActionEvent, defineJuneAction, defineJuneComponent, documentPromptOptions, downloadResult, exportDocument, fetchStream, getDefaultDocumentStore, getDocumentEditorInstructions, getDocumentEditorRules, isDocumentEcho, isJuneError, jsonFieldExtractor, juneLibrary, lightTheme, listDocumentExporters, mergeDocuments, readDocumentFromProgram, registerDocumentExporter, rememberDocumentEcho, runAction, serializeDocumentsForAgent, sseToText, toJuneError, updateDocumentInProgram, useDocumentOptions, useJuneRuntime, useJuneStream, useJuneTheme, useResolvedTheme, withDocumentEditor };
|