artifactuse 0.1.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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +771 -0
  3. package/dist/core/bridge.d.ts +37 -0
  4. package/dist/core/detector.d.ts +134 -0
  5. package/dist/core/highlight.d.ts +53 -0
  6. package/dist/core/index.d.ts +124 -0
  7. package/dist/core/processors/audio.d.ts +36 -0
  8. package/dist/core/processors/audioPlayer.d.ts +39 -0
  9. package/dist/core/processors/codeEmbed.d.ts +58 -0
  10. package/dist/core/processors/dataViz.d.ts +28 -0
  11. package/dist/core/processors/design.d.ts +50 -0
  12. package/dist/core/processors/document.d.ts +38 -0
  13. package/dist/core/processors/image.d.ts +23 -0
  14. package/dist/core/processors/index.d.ts +62 -0
  15. package/dist/core/processors/interactive.d.ts +57 -0
  16. package/dist/core/processors/map.d.ts +29 -0
  17. package/dist/core/processors/math.d.ts +75 -0
  18. package/dist/core/processors/mermaid.d.ts +72 -0
  19. package/dist/core/processors/social.d.ts +63 -0
  20. package/dist/core/processors/table.d.ts +43 -0
  21. package/dist/core/processors/video.d.ts +69 -0
  22. package/dist/core/state.d.ts +37 -0
  23. package/dist/core/theme.d.ts +109 -0
  24. package/dist/index-_nD5FZzs.js +4300 -0
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +115 -0
  27. package/dist/jszip.min-CdmYyw5L.js +2324 -0
  28. package/dist/react/ArtifactuseAgentMessage.d.ts +31 -0
  29. package/dist/react/ArtifactuseCard.d.ts +13 -0
  30. package/dist/react/ArtifactuseInlineForm.d.ts +16 -0
  31. package/dist/react/ArtifactusePanel.d.ts +12 -0
  32. package/dist/react/ArtifactusePanelToggle.d.ts +8 -0
  33. package/dist/react/ArtifactuseSocialPreview.d.ts +6 -0
  34. package/dist/react/ArtifactuseViewer.d.ts +14 -0
  35. package/dist/react/index.d.ts +108 -0
  36. package/dist/react/index.js +1387 -0
  37. package/dist/svelte/index.d.ts +439 -0
  38. package/dist/svelte/index.js +2556 -0
  39. package/dist/vue/index.d.ts +296 -0
  40. package/dist/vue/index.js +2745 -0
  41. package/dist/vue2/composables.d.ts +291 -0
  42. package/dist/vue2/index.d.ts +10 -0
  43. package/dist/vue2/index.js +27979 -0
  44. package/package.json +127 -0
@@ -0,0 +1,296 @@
1
+ /**
2
+ * Create and provide Artifactuse instance
3
+ *
4
+ * @param {object} config - Configuration options
5
+ * @param {string} config.cdnUrl - Base CDN URL for panels
6
+ * @param {object} config.panels - Panel configuration (add/override/disable)
7
+ * @param {string} config.theme - Theme: 'dark' | 'light' | 'auto'
8
+ * @param {object} config.colors - Custom theme colors
9
+ * @param {object} config.processors - Enable/disable processors
10
+ * @param {boolean} config.branding - Show branding
11
+ *
12
+ * @example
13
+ * // Basic usage
14
+ * const { state, processMessage } = provideArtifactuse();
15
+ *
16
+ * @example
17
+ * // With custom panels
18
+ * const { state } = provideArtifactuse({
19
+ * panels: {
20
+ * 'chart': 'chart-panel',
21
+ * 'video': 'https://my-cdn.com/video-panel',
22
+ * 'canvas': null, // disable
23
+ * }
24
+ * });
25
+ */
26
+ export function provideArtifactuse(config?: {
27
+ cdnUrl: string;
28
+ panels: object;
29
+ theme: string;
30
+ colors: object;
31
+ processors: object;
32
+ branding: boolean;
33
+ }): {
34
+ instance: {
35
+ config: any;
36
+ state: {
37
+ getState: () => {
38
+ artifacts: any[];
39
+ activeArtifactId: any;
40
+ isPanelOpen: boolean;
41
+ viewMode: string;
42
+ isFullscreen: boolean;
43
+ };
44
+ subscribe: (callback: any) => () => void;
45
+ addArtifact: (artifact: any) => void;
46
+ addArtifacts: (artifacts: any) => void;
47
+ removeArtifact: (artifactId: any) => void;
48
+ getArtifact: (artifactId: any) => any;
49
+ getActiveArtifact: () => any;
50
+ getArtifactsByMessageId: (messageId: any) => any[];
51
+ getArtifactsByType: (type: any) => any[];
52
+ getArtifactCount: () => number;
53
+ setActiveArtifact: (artifactId: any) => void;
54
+ clearActiveArtifact: () => void;
55
+ setPanelOpen: (isOpen: any) => void;
56
+ setViewMode: (mode: any) => void;
57
+ setFullscreen: (isFullscreen: any) => void;
58
+ clear: () => void;
59
+ batch: (updateFn: any) => void;
60
+ };
61
+ getState: () => {
62
+ artifacts: any[];
63
+ activeArtifactId: any;
64
+ isPanelOpen: boolean;
65
+ viewMode: string;
66
+ isFullscreen: boolean;
67
+ };
68
+ subscribe: (callback: any) => () => void;
69
+ processMessage: (content: any, messageId: any) => {
70
+ html: string | Promise<string>;
71
+ artifacts: any[];
72
+ };
73
+ initializeContent: (container?: Document) => Promise<void>;
74
+ openArtifact: (artifact: any) => void;
75
+ closePanel: () => void;
76
+ togglePanel: () => void;
77
+ toggleFullscreen: () => void;
78
+ setViewMode: (mode: any) => void;
79
+ getPanelUrl: (artifact: any, options?: {}) => any;
80
+ sendToPanel: (action: any, data: any) => void;
81
+ hasPanel: (artifact: any) => any;
82
+ registerPanel: (typesOrLang: string | string[], panel: string | object) => void;
83
+ unregisterPanel: (typesOrLang: string | string[]) => void;
84
+ getPanelTypes: () => any;
85
+ panelResolver: any;
86
+ theme: {
87
+ readonly current: string;
88
+ readonly resolved: string;
89
+ readonly colors: any;
90
+ getResolvedTheme: () => string;
91
+ getColors: () => any;
92
+ getCSSVariables: () => string;
93
+ getCSS: () => string;
94
+ apply: (container?: HTMLElement) => void;
95
+ set: (theme: any) => void;
96
+ toggle: () => void;
97
+ setColors: (newColors: any, theme?: any) => void;
98
+ watchSystemTheme: (callback: any) => () => void;
99
+ };
100
+ applyTheme: () => void;
101
+ setTheme: (newTheme: any) => void;
102
+ getTheme: () => string;
103
+ on: (event: any, callback: any) => () => void;
104
+ off: (event: any, callback: any) => void;
105
+ emit: (event: any, data: any) => void;
106
+ bridge: {
107
+ setIframe: (iframe: any) => void;
108
+ send: (action: any, data: any, requestId?: any) => any;
109
+ request: (action: any, data: any, timeout?: number) => Promise<any>;
110
+ on: (action: any, callback: any) => () => void;
111
+ off: (action: any, callback: any) => void;
112
+ loadArtifact: (artifact: any) => any;
113
+ updateArtifact: (artifactId: any, updates: any) => any;
114
+ requestSave: () => Promise<any>;
115
+ requestExport: (format?: string) => Promise<any>;
116
+ sendAIResponse: (response: any, requestId: any) => any;
117
+ destroy: () => void;
118
+ readonly isReady: boolean;
119
+ readonly iframe: any;
120
+ };
121
+ destroy: () => void;
122
+ };
123
+ state: {
124
+ artifacts: any[];
125
+ activeArtifactId: any;
126
+ isPanelOpen: boolean;
127
+ viewMode: string;
128
+ isFullscreen: boolean;
129
+ };
130
+ activeArtifact: import("vue").ComputedRef<any>;
131
+ artifactCount: import("vue").ComputedRef<number>;
132
+ hasArtifacts: import("vue").ComputedRef<boolean>;
133
+ panelTypes: import("vue").ComputedRef<any>;
134
+ activePanelUrl: import("vue").ComputedRef<any>;
135
+ processMessage: (content: any, messageId: any) => {
136
+ html: string | Promise<string>;
137
+ artifacts: any[];
138
+ };
139
+ initializeContent: (container?: Document) => Promise<void>;
140
+ openArtifact: (artifact: any) => void;
141
+ closePanel: () => void;
142
+ togglePanel: () => void;
143
+ toggleFullscreen: () => void;
144
+ setViewMode: (mode: any) => void;
145
+ getPanelUrl: (artifact: any, options?: {}) => any;
146
+ sendToPanel: (action: any, data: any) => void;
147
+ hasPanel: (artifact: any) => any;
148
+ registerPanel: (typesOrLang: string | string[], panel: string | object) => void;
149
+ unregisterPanel: (typesOrLang: string | string[]) => void;
150
+ getPanelTypes: () => any;
151
+ on: (event: any, callback: any) => () => void;
152
+ off: (event: any, callback: any) => void;
153
+ applyTheme: () => void;
154
+ setTheme: (theme: any) => void;
155
+ getTheme: () => string;
156
+ };
157
+ /**
158
+ * Use Artifactuse composable
159
+ */
160
+ export function useArtifactuse(): any;
161
+ /**
162
+ * Create standalone composable (without provider)
163
+ */
164
+ export function createArtifactuseComposable(config?: {}): {
165
+ instance: {
166
+ config: any;
167
+ state: {
168
+ getState: () => {
169
+ artifacts: any[];
170
+ activeArtifactId: any;
171
+ isPanelOpen: boolean;
172
+ viewMode: string;
173
+ isFullscreen: boolean;
174
+ };
175
+ subscribe: (callback: any) => () => void;
176
+ addArtifact: (artifact: any) => void;
177
+ addArtifacts: (artifacts: any) => void;
178
+ removeArtifact: (artifactId: any) => void;
179
+ getArtifact: (artifactId: any) => any;
180
+ getActiveArtifact: () => any;
181
+ getArtifactsByMessageId: (messageId: any) => any[];
182
+ getArtifactsByType: (type: any) => any[];
183
+ getArtifactCount: () => number;
184
+ setActiveArtifact: (artifactId: any) => void;
185
+ clearActiveArtifact: () => void;
186
+ setPanelOpen: (isOpen: any) => void;
187
+ setViewMode: (mode: any) => void;
188
+ setFullscreen: (isFullscreen: any) => void;
189
+ clear: () => void;
190
+ batch: (updateFn: any) => void;
191
+ };
192
+ getState: () => {
193
+ artifacts: any[];
194
+ activeArtifactId: any;
195
+ isPanelOpen: boolean;
196
+ viewMode: string;
197
+ isFullscreen: boolean;
198
+ };
199
+ subscribe: (callback: any) => () => void;
200
+ processMessage: (content: any, messageId: any) => {
201
+ html: string | Promise<string>;
202
+ artifacts: any[];
203
+ };
204
+ initializeContent: (container?: Document) => Promise<void>;
205
+ openArtifact: (artifact: any) => void;
206
+ closePanel: () => void;
207
+ togglePanel: () => void;
208
+ toggleFullscreen: () => void;
209
+ setViewMode: (mode: any) => void;
210
+ getPanelUrl: (artifact: any, options?: {}) => any;
211
+ sendToPanel: (action: any, data: any) => void;
212
+ hasPanel: (artifact: any) => any;
213
+ registerPanel: (typesOrLang: string | string[], panel: string | object) => void;
214
+ unregisterPanel: (typesOrLang: string | string[]) => void;
215
+ getPanelTypes: () => any;
216
+ panelResolver: any;
217
+ theme: {
218
+ readonly current: string;
219
+ readonly resolved: string;
220
+ readonly colors: any;
221
+ getResolvedTheme: () => string;
222
+ getColors: () => any;
223
+ getCSSVariables: () => string;
224
+ getCSS: () => string;
225
+ apply: (container?: HTMLElement) => void;
226
+ set: (theme: any) => void;
227
+ toggle: () => void;
228
+ setColors: (newColors: any, theme?: any) => void;
229
+ watchSystemTheme: (callback: any) => () => void;
230
+ };
231
+ applyTheme: () => void;
232
+ setTheme: (newTheme: any) => void;
233
+ getTheme: () => string;
234
+ on: (event: any, callback: any) => () => void;
235
+ off: (event: any, callback: any) => void;
236
+ emit: (event: any, data: any) => void;
237
+ bridge: {
238
+ setIframe: (iframe: any) => void;
239
+ send: (action: any, data: any, requestId?: any) => any;
240
+ request: (action: any, data: any, timeout?: number) => Promise<any>;
241
+ on: (action: any, callback: any) => () => void;
242
+ off: (action: any, callback: any) => void;
243
+ loadArtifact: (artifact: any) => any;
244
+ updateArtifact: (artifactId: any, updates: any) => any;
245
+ requestSave: () => Promise<any>;
246
+ requestExport: (format?: string) => Promise<any>;
247
+ sendAIResponse: (response: any, requestId: any) => any;
248
+ destroy: () => void;
249
+ readonly isReady: boolean;
250
+ readonly iframe: any;
251
+ };
252
+ destroy: () => void;
253
+ };
254
+ state: {
255
+ artifacts: any[];
256
+ activeArtifactId: any;
257
+ isPanelOpen: boolean;
258
+ viewMode: string;
259
+ isFullscreen: boolean;
260
+ };
261
+ activeArtifact: import("vue").ComputedRef<any>;
262
+ artifactCount: import("vue").ComputedRef<number>;
263
+ hasArtifacts: import("vue").ComputedRef<boolean>;
264
+ panelTypes: import("vue").ComputedRef<any>;
265
+ activePanelUrl: import("vue").ComputedRef<any>;
266
+ processMessage: (content: any, messageId: any) => {
267
+ html: string | Promise<string>;
268
+ artifacts: any[];
269
+ };
270
+ initializeContent: (container?: Document) => Promise<void>;
271
+ openArtifact: (artifact: any) => void;
272
+ closePanel: () => void;
273
+ togglePanel: () => void;
274
+ toggleFullscreen: () => void;
275
+ setViewMode: (mode: any) => void;
276
+ getPanelUrl: (artifact: any, options?: {}) => any;
277
+ sendToPanel: (action: any, data: any) => void;
278
+ hasPanel: (artifact: any) => any;
279
+ registerPanel: (typesOrLang: string | string[], panel: string | object) => void;
280
+ unregisterPanel: (typesOrLang: string | string[]) => void;
281
+ getPanelTypes: () => any;
282
+ on: (event: any, callback: any) => () => void;
283
+ off: (event: any, callback: any) => void;
284
+ applyTheme: () => void;
285
+ setTheme: (theme: any) => void;
286
+ getTheme: () => string;
287
+ };
288
+ export { DEFAULT_PANELS };
289
+ declare namespace _default {
290
+ export { provideArtifactuse };
291
+ export { useArtifactuse };
292
+ export { createArtifactuseComposable };
293
+ export { DEFAULT_PANELS };
294
+ }
295
+ export default _default;
296
+ import { DEFAULT_PANELS } from '../core/index.js';