@templatical/core 0.0.1 → 0.0.3
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/dist/cloud/index.cjs +106 -24
- package/dist/cloud/index.cjs.map +1 -1
- package/dist/cloud/index.d.cts +17 -2
- package/dist/cloud/index.d.ts +17 -2
- package/dist/cloud/index.js +105 -24
- package/dist/cloud/index.js.map +1 -1
- package/dist/editor-K644r-hl.d.cts +39 -0
- package/dist/editor-K644r-hl.d.ts +39 -0
- package/dist/index.cjs +40 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -76
- package/dist/index.d.ts +13 -76
- package/dist/index.js +38 -3
- package/dist/index.js.map +1 -1
- package/package.json +17 -7
package/dist/cloud/index.d.cts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { AuthConfig, TestEmailConfig, UserConfig, SdkAuthConfig, TemplateContent, Template, TemplateSnapshot, CustomFont, Comment, PlanConfig, SavedModule, Block, WebSocketServerConfig, EditorState, ViewportSize, TemplateSettings, TemplateDefaults, McpOperationPayload, MergeTag, AiConfig, ScoringResult, ScoringFinding, ScoringCategory, CommentThread, CommentEvent, Collaborator, ExportResult, FontsConfig, PlanFeatures, HealthCheckResult } from '@templatical/types';
|
|
1
|
+
import { AuthConfig, TestEmailConfig, UserConfig, SdkAuthConfig, TemplateContent, Template, TemplateSnapshot, CustomFont, Comment, PlanConfig, SavedModule, Block, WebSocketServerConfig, EditorState, ViewportSize, UiTheme, TemplateSettings, TemplateDefaults, McpOperationPayload, MergeTag, AiConfig, ScoringResult, ScoringFinding, ScoringCategory, CommentThread, CommentEvent, Collaborator, ExportResult, FontsConfig, PlanFeatures, HealthCheckResult } from '@templatical/types';
|
|
2
2
|
export { AuthConfig, AuthRequestOptions, SdkAuthConfig, TestEmailConfig, UserConfig } from '@templatical/types';
|
|
3
3
|
import { PresenceChannel, Channel } from 'pusher-js';
|
|
4
4
|
import { DeepReadonly, Ref, ref, ComputedRef } from 'vue';
|
|
5
|
+
import { U as UseEditorReturn$1 } from '../editor-K644r-hl.cjs';
|
|
6
|
+
import '@vue/reactivity';
|
|
5
7
|
|
|
6
8
|
declare class AuthManager {
|
|
7
9
|
private static readonly DEFAULT_BASE_URL;
|
|
@@ -196,6 +198,7 @@ interface UseEditorReturn {
|
|
|
196
198
|
setViewport: (viewport: ViewportSize) => void;
|
|
197
199
|
setDarkMode: (darkMode: boolean) => void;
|
|
198
200
|
setPreviewMode: (previewMode: boolean) => void;
|
|
201
|
+
setUiTheme: (theme: UiTheme) => void;
|
|
199
202
|
updateBlock: (blockId: string, updates: Partial<Block>) => void;
|
|
200
203
|
updateSettings: (updates: Partial<TemplateSettings>) => void;
|
|
201
204
|
addBlock: (block: Block, targetSectionId?: string, columnIndex?: number, index?: number) => void;
|
|
@@ -362,6 +365,18 @@ declare function useCollaboration(options: UseCollaborationOptions): UseCollabor
|
|
|
362
365
|
_isProcessingRemoteOperation: () => boolean;
|
|
363
366
|
};
|
|
364
367
|
|
|
368
|
+
interface BroadcastTarget {
|
|
369
|
+
_broadcastOperation: (payload: McpOperationPayload) => void;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Wraps editor mutation methods to broadcast operations to collaboration
|
|
373
|
+
* peers after each mutation executes. Mutates the editor object in place.
|
|
374
|
+
*
|
|
375
|
+
* Must be applied **before** the history interceptor so the call chain is:
|
|
376
|
+
* history.record() → broadcast + original mutation.
|
|
377
|
+
*/
|
|
378
|
+
declare function useCollaborationBroadcast(editor: UseEditorReturn$1, collaboration: BroadcastTarget): void;
|
|
379
|
+
|
|
365
380
|
interface UseWebSocketOptions {
|
|
366
381
|
authManager: AuthManager;
|
|
367
382
|
onError?: (error: Error) => void;
|
|
@@ -462,4 +477,4 @@ interface UseMcpListenerOptions {
|
|
|
462
477
|
}
|
|
463
478
|
declare function useMcpListener(options: UseMcpListenerOptions): void;
|
|
464
479
|
|
|
465
|
-
export { API_ROUTES, ApiClient, AuthManager, type CommentBroadcastPayload, type DesignReferenceInput, type PresenceMember, type UseAiChatOptions, type UseAiChatReturn, type UseAiConfigReturn, type UseAiRewriteOptions, type UseAiRewriteReturn, type UseCollaborationOptions, type UseCollaborationReturn, type UseCommentListenerOptions, type UseCommentsOptions, type UseCommentsReturn, type UseDesignReferenceOptions, type UseDesignReferenceReturn, type UseEditorOptions, type UseEditorReturn, type UseExportOptions, type UseExportReturn, type UseMcpListenerOptions, type UsePlanConfigOptions, type UsePlanConfigReturn, type UseSavedModulesOptions, type UseSavedModulesReturn, type UseSnapshotHistoryOptions, type UseSnapshotHistoryReturn, type UseTemplateScoringOptions, type UseTemplateScoringReturn, type UseTestEmailOptions, type UseTestEmailReturn, type UseWebSocketOptions, type UseWebSocketReturn, WebSocketClient, type WebSocketClientOptions, type WebSocketConfig, buildUrl, createSdkAuthManager, handleOperation, performHealthCheck, resolveWebSocketConfig, useAiChat, useAiConfig, useAiRewrite, useCollaboration, useCommentListener, useComments, useDesignReference, useEditor, useExport, useMcpListener, usePlanConfig, useSavedModules, useSnapshotHistory, useTemplateScoring, useTestEmail, useWebSocket };
|
|
480
|
+
export { API_ROUTES, ApiClient, AuthManager, type CommentBroadcastPayload, type DesignReferenceInput, type PresenceMember, type UseAiChatOptions, type UseAiChatReturn, type UseAiConfigReturn, type UseAiRewriteOptions, type UseAiRewriteReturn, type UseCollaborationOptions, type UseCollaborationReturn, type UseCommentListenerOptions, type UseCommentsOptions, type UseCommentsReturn, type UseDesignReferenceOptions, type UseDesignReferenceReturn, type UseEditorOptions, type UseEditorReturn, type UseExportOptions, type UseExportReturn, type UseMcpListenerOptions, type UsePlanConfigOptions, type UsePlanConfigReturn, type UseSavedModulesOptions, type UseSavedModulesReturn, type UseSnapshotHistoryOptions, type UseSnapshotHistoryReturn, type UseTemplateScoringOptions, type UseTemplateScoringReturn, type UseTestEmailOptions, type UseTestEmailReturn, type UseWebSocketOptions, type UseWebSocketReturn, WebSocketClient, type WebSocketClientOptions, type WebSocketConfig, buildUrl, createSdkAuthManager, handleOperation, performHealthCheck, resolveWebSocketConfig, useAiChat, useAiConfig, useAiRewrite, useCollaboration, useCollaborationBroadcast, useCommentListener, useComments, useDesignReference, useEditor, useExport, useMcpListener, usePlanConfig, useSavedModules, useSnapshotHistory, useTemplateScoring, useTestEmail, useWebSocket };
|
package/dist/cloud/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { AuthConfig, TestEmailConfig, UserConfig, SdkAuthConfig, TemplateContent, Template, TemplateSnapshot, CustomFont, Comment, PlanConfig, SavedModule, Block, WebSocketServerConfig, EditorState, ViewportSize, TemplateSettings, TemplateDefaults, McpOperationPayload, MergeTag, AiConfig, ScoringResult, ScoringFinding, ScoringCategory, CommentThread, CommentEvent, Collaborator, ExportResult, FontsConfig, PlanFeatures, HealthCheckResult } from '@templatical/types';
|
|
1
|
+
import { AuthConfig, TestEmailConfig, UserConfig, SdkAuthConfig, TemplateContent, Template, TemplateSnapshot, CustomFont, Comment, PlanConfig, SavedModule, Block, WebSocketServerConfig, EditorState, ViewportSize, UiTheme, TemplateSettings, TemplateDefaults, McpOperationPayload, MergeTag, AiConfig, ScoringResult, ScoringFinding, ScoringCategory, CommentThread, CommentEvent, Collaborator, ExportResult, FontsConfig, PlanFeatures, HealthCheckResult } from '@templatical/types';
|
|
2
2
|
export { AuthConfig, AuthRequestOptions, SdkAuthConfig, TestEmailConfig, UserConfig } from '@templatical/types';
|
|
3
3
|
import { PresenceChannel, Channel } from 'pusher-js';
|
|
4
4
|
import { DeepReadonly, Ref, ref, ComputedRef } from 'vue';
|
|
5
|
+
import { U as UseEditorReturn$1 } from '../editor-K644r-hl.js';
|
|
6
|
+
import '@vue/reactivity';
|
|
5
7
|
|
|
6
8
|
declare class AuthManager {
|
|
7
9
|
private static readonly DEFAULT_BASE_URL;
|
|
@@ -196,6 +198,7 @@ interface UseEditorReturn {
|
|
|
196
198
|
setViewport: (viewport: ViewportSize) => void;
|
|
197
199
|
setDarkMode: (darkMode: boolean) => void;
|
|
198
200
|
setPreviewMode: (previewMode: boolean) => void;
|
|
201
|
+
setUiTheme: (theme: UiTheme) => void;
|
|
199
202
|
updateBlock: (blockId: string, updates: Partial<Block>) => void;
|
|
200
203
|
updateSettings: (updates: Partial<TemplateSettings>) => void;
|
|
201
204
|
addBlock: (block: Block, targetSectionId?: string, columnIndex?: number, index?: number) => void;
|
|
@@ -362,6 +365,18 @@ declare function useCollaboration(options: UseCollaborationOptions): UseCollabor
|
|
|
362
365
|
_isProcessingRemoteOperation: () => boolean;
|
|
363
366
|
};
|
|
364
367
|
|
|
368
|
+
interface BroadcastTarget {
|
|
369
|
+
_broadcastOperation: (payload: McpOperationPayload) => void;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Wraps editor mutation methods to broadcast operations to collaboration
|
|
373
|
+
* peers after each mutation executes. Mutates the editor object in place.
|
|
374
|
+
*
|
|
375
|
+
* Must be applied **before** the history interceptor so the call chain is:
|
|
376
|
+
* history.record() → broadcast + original mutation.
|
|
377
|
+
*/
|
|
378
|
+
declare function useCollaborationBroadcast(editor: UseEditorReturn$1, collaboration: BroadcastTarget): void;
|
|
379
|
+
|
|
365
380
|
interface UseWebSocketOptions {
|
|
366
381
|
authManager: AuthManager;
|
|
367
382
|
onError?: (error: Error) => void;
|
|
@@ -462,4 +477,4 @@ interface UseMcpListenerOptions {
|
|
|
462
477
|
}
|
|
463
478
|
declare function useMcpListener(options: UseMcpListenerOptions): void;
|
|
464
479
|
|
|
465
|
-
export { API_ROUTES, ApiClient, AuthManager, type CommentBroadcastPayload, type DesignReferenceInput, type PresenceMember, type UseAiChatOptions, type UseAiChatReturn, type UseAiConfigReturn, type UseAiRewriteOptions, type UseAiRewriteReturn, type UseCollaborationOptions, type UseCollaborationReturn, type UseCommentListenerOptions, type UseCommentsOptions, type UseCommentsReturn, type UseDesignReferenceOptions, type UseDesignReferenceReturn, type UseEditorOptions, type UseEditorReturn, type UseExportOptions, type UseExportReturn, type UseMcpListenerOptions, type UsePlanConfigOptions, type UsePlanConfigReturn, type UseSavedModulesOptions, type UseSavedModulesReturn, type UseSnapshotHistoryOptions, type UseSnapshotHistoryReturn, type UseTemplateScoringOptions, type UseTemplateScoringReturn, type UseTestEmailOptions, type UseTestEmailReturn, type UseWebSocketOptions, type UseWebSocketReturn, WebSocketClient, type WebSocketClientOptions, type WebSocketConfig, buildUrl, createSdkAuthManager, handleOperation, performHealthCheck, resolveWebSocketConfig, useAiChat, useAiConfig, useAiRewrite, useCollaboration, useCommentListener, useComments, useDesignReference, useEditor, useExport, useMcpListener, usePlanConfig, useSavedModules, useSnapshotHistory, useTemplateScoring, useTestEmail, useWebSocket };
|
|
480
|
+
export { API_ROUTES, ApiClient, AuthManager, type CommentBroadcastPayload, type DesignReferenceInput, type PresenceMember, type UseAiChatOptions, type UseAiChatReturn, type UseAiConfigReturn, type UseAiRewriteOptions, type UseAiRewriteReturn, type UseCollaborationOptions, type UseCollaborationReturn, type UseCommentListenerOptions, type UseCommentsOptions, type UseCommentsReturn, type UseDesignReferenceOptions, type UseDesignReferenceReturn, type UseEditorOptions, type UseEditorReturn, type UseExportOptions, type UseExportReturn, type UseMcpListenerOptions, type UsePlanConfigOptions, type UsePlanConfigReturn, type UseSavedModulesOptions, type UseSavedModulesReturn, type UseSnapshotHistoryOptions, type UseSnapshotHistoryReturn, type UseTemplateScoringOptions, type UseTemplateScoringReturn, type UseTestEmailOptions, type UseTestEmailReturn, type UseWebSocketOptions, type UseWebSocketReturn, WebSocketClient, type WebSocketClientOptions, type WebSocketConfig, buildUrl, createSdkAuthManager, handleOperation, performHealthCheck, resolveWebSocketConfig, useAiChat, useAiConfig, useAiRewrite, useCollaboration, useCollaborationBroadcast, useCommentListener, useComments, useDesignReference, useEditor, useExport, useMcpListener, usePlanConfig, useSavedModules, useSnapshotHistory, useTemplateScoring, useTestEmail, useWebSocket };
|
package/dist/cloud/index.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
// src/cloud/auth.ts
|
|
2
2
|
import { SdkError } from "@templatical/types";
|
|
3
|
-
var
|
|
3
|
+
var AuthManager = class _AuthManager {
|
|
4
|
+
static DEFAULT_BASE_URL = "https://templatical.com";
|
|
5
|
+
accessToken = null;
|
|
6
|
+
expiresAt = null;
|
|
7
|
+
_projectId = null;
|
|
8
|
+
_tenantId = null;
|
|
9
|
+
_tenantSlug = null;
|
|
10
|
+
_testEmailConfig = null;
|
|
11
|
+
_userConfig = null;
|
|
12
|
+
url;
|
|
13
|
+
baseUrl;
|
|
14
|
+
requestOptions;
|
|
15
|
+
onError;
|
|
16
|
+
refreshPromise = null;
|
|
17
|
+
static REFRESH_THRESHOLD_MS = 60 * 1e3;
|
|
4
18
|
constructor(config) {
|
|
5
|
-
this.accessToken = null;
|
|
6
|
-
this.expiresAt = null;
|
|
7
|
-
this._projectId = null;
|
|
8
|
-
this._tenantId = null;
|
|
9
|
-
this._tenantSlug = null;
|
|
10
|
-
this._testEmailConfig = null;
|
|
11
|
-
this._userConfig = null;
|
|
12
|
-
this.refreshPromise = null;
|
|
13
19
|
this.url = config.url;
|
|
14
20
|
this.baseUrl = (config.baseUrl ?? _AuthManager.DEFAULT_BASE_URL).replace(
|
|
15
21
|
/\/$/,
|
|
@@ -132,7 +138,7 @@ var _AuthManager = class _AuthManager {
|
|
|
132
138
|
}
|
|
133
139
|
return this.accessToken;
|
|
134
140
|
} catch (error) {
|
|
135
|
-
const wrappedError = error instanceof Error ? error : new Error("Token refresh failed");
|
|
141
|
+
const wrappedError = error instanceof Error ? error : new Error("Token refresh failed", { cause: error });
|
|
136
142
|
this.onError?.(wrappedError);
|
|
137
143
|
throw wrappedError;
|
|
138
144
|
}
|
|
@@ -157,9 +163,6 @@ var _AuthManager = class _AuthManager {
|
|
|
157
163
|
return response;
|
|
158
164
|
}
|
|
159
165
|
};
|
|
160
|
-
_AuthManager.DEFAULT_BASE_URL = "https://templatical.com";
|
|
161
|
-
_AuthManager.REFRESH_THRESHOLD_MS = 60 * 1e3;
|
|
162
|
-
var AuthManager = _AuthManager;
|
|
163
166
|
function createSdkAuthManager(config, onError) {
|
|
164
167
|
if (config.mode === "direct") {
|
|
165
168
|
const baseUrl = (config.baseUrl ?? "https://templatical.com").replace(
|
|
@@ -503,8 +506,11 @@ function resolveWebSocketConfig(serverConfig) {
|
|
|
503
506
|
};
|
|
504
507
|
}
|
|
505
508
|
var WebSocketClient = class {
|
|
509
|
+
pusher = null;
|
|
510
|
+
authManager;
|
|
511
|
+
config;
|
|
512
|
+
onError;
|
|
506
513
|
constructor(options) {
|
|
507
|
-
this.pusher = null;
|
|
508
514
|
this.authManager = options.authManager;
|
|
509
515
|
this.config = options.config;
|
|
510
516
|
this.onError = options.onError;
|
|
@@ -639,7 +645,8 @@ function useEditor(options) {
|
|
|
639
645
|
previewMode: false,
|
|
640
646
|
isDirty: false,
|
|
641
647
|
isSaving: false,
|
|
642
|
-
isLoading: false
|
|
648
|
+
isLoading: false,
|
|
649
|
+
uiTheme: "auto"
|
|
643
650
|
});
|
|
644
651
|
const content = computed({
|
|
645
652
|
get: () => state.content,
|
|
@@ -720,6 +727,9 @@ function useEditor(options) {
|
|
|
720
727
|
function setDarkMode(darkMode) {
|
|
721
728
|
state.darkMode = darkMode;
|
|
722
729
|
}
|
|
730
|
+
function setUiTheme(theme) {
|
|
731
|
+
state.uiTheme = theme;
|
|
732
|
+
}
|
|
723
733
|
function setPreviewMode(previewMode) {
|
|
724
734
|
state.previewMode = previewMode;
|
|
725
735
|
if (previewMode) {
|
|
@@ -875,6 +885,7 @@ function useEditor(options) {
|
|
|
875
885
|
selectBlock,
|
|
876
886
|
setViewport,
|
|
877
887
|
setDarkMode,
|
|
888
|
+
setUiTheme,
|
|
878
889
|
setPreviewMode,
|
|
879
890
|
updateBlock,
|
|
880
891
|
updateSettings,
|
|
@@ -1137,7 +1148,7 @@ function useAiChat(options) {
|
|
|
1137
1148
|
}
|
|
1138
1149
|
return result;
|
|
1139
1150
|
} catch (err) {
|
|
1140
|
-
const wrappedError = err instanceof Error ? err : new Error("Failed to generate template");
|
|
1151
|
+
const wrappedError = err instanceof Error ? err : new Error("Failed to generate template", { cause: err });
|
|
1141
1152
|
error.value = wrappedError.message;
|
|
1142
1153
|
failedPrompt.value = prompt;
|
|
1143
1154
|
onError?.(wrappedError);
|
|
@@ -1633,7 +1644,9 @@ function useDesignReference(options) {
|
|
|
1633
1644
|
}
|
|
1634
1645
|
return result;
|
|
1635
1646
|
} catch (err) {
|
|
1636
|
-
const wrappedError = err instanceof Error ? err : new Error("Failed to generate template from design"
|
|
1647
|
+
const wrappedError = err instanceof Error ? err : new Error("Failed to generate template from design", {
|
|
1648
|
+
cause: err
|
|
1649
|
+
});
|
|
1637
1650
|
error.value = wrappedError.message;
|
|
1638
1651
|
onError?.(wrappedError);
|
|
1639
1652
|
return null;
|
|
@@ -1737,7 +1750,7 @@ function useComments(options) {
|
|
|
1737
1750
|
try {
|
|
1738
1751
|
comments.value = await api.getComments(templateId);
|
|
1739
1752
|
} catch (err) {
|
|
1740
|
-
const wrappedError = err instanceof Error ? err : new Error("Failed to load comments");
|
|
1753
|
+
const wrappedError = err instanceof Error ? err : new Error("Failed to load comments", { cause: err });
|
|
1741
1754
|
onError?.(wrappedError);
|
|
1742
1755
|
} finally {
|
|
1743
1756
|
isLoading.value = false;
|
|
@@ -1771,7 +1784,7 @@ function useComments(options) {
|
|
|
1771
1784
|
emitEvent("created", comment);
|
|
1772
1785
|
return comment;
|
|
1773
1786
|
} catch (err) {
|
|
1774
|
-
const wrappedError = err instanceof Error ? err : new Error("Failed to create comment");
|
|
1787
|
+
const wrappedError = err instanceof Error ? err : new Error("Failed to create comment", { cause: err });
|
|
1775
1788
|
onError?.(wrappedError);
|
|
1776
1789
|
return null;
|
|
1777
1790
|
} finally {
|
|
@@ -1798,7 +1811,7 @@ function useComments(options) {
|
|
|
1798
1811
|
emitEvent("updated", updated);
|
|
1799
1812
|
return updated;
|
|
1800
1813
|
} catch (err) {
|
|
1801
|
-
const wrappedError = err instanceof Error ? err : new Error("Failed to update comment");
|
|
1814
|
+
const wrappedError = err instanceof Error ? err : new Error("Failed to update comment", { cause: err });
|
|
1802
1815
|
onError?.(wrappedError);
|
|
1803
1816
|
return null;
|
|
1804
1817
|
} finally {
|
|
@@ -1839,7 +1852,7 @@ function useComments(options) {
|
|
|
1839
1852
|
emitEvent("deleted", commentSnapshot);
|
|
1840
1853
|
return true;
|
|
1841
1854
|
} catch (err) {
|
|
1842
|
-
const wrappedError = err instanceof Error ? err : new Error("Failed to delete comment");
|
|
1855
|
+
const wrappedError = err instanceof Error ? err : new Error("Failed to delete comment", { cause: err });
|
|
1843
1856
|
onError?.(wrappedError);
|
|
1844
1857
|
return false;
|
|
1845
1858
|
} finally {
|
|
@@ -1864,7 +1877,7 @@ function useComments(options) {
|
|
|
1864
1877
|
emitEvent(eventType, updated);
|
|
1865
1878
|
return updated;
|
|
1866
1879
|
} catch (err) {
|
|
1867
|
-
const wrappedError = err instanceof Error ? err : new Error("Failed to toggle comment resolution");
|
|
1880
|
+
const wrappedError = err instanceof Error ? err : new Error("Failed to toggle comment resolution", { cause: err });
|
|
1868
1881
|
onError?.(wrappedError);
|
|
1869
1882
|
return null;
|
|
1870
1883
|
} finally {
|
|
@@ -2197,6 +2210,73 @@ function useCollaboration(options) {
|
|
|
2197
2210
|
};
|
|
2198
2211
|
}
|
|
2199
2212
|
|
|
2213
|
+
// src/cloud/collaboration-broadcast.ts
|
|
2214
|
+
function useCollaborationBroadcast(editor, collaboration) {
|
|
2215
|
+
const originalAddBlock = editor.addBlock;
|
|
2216
|
+
const originalUpdateBlock = editor.updateBlock;
|
|
2217
|
+
const originalRemoveBlock = editor.removeBlock;
|
|
2218
|
+
const originalMoveBlock = editor.moveBlock;
|
|
2219
|
+
const originalUpdateSettings = editor.updateSettings;
|
|
2220
|
+
const originalSetContent = editor.setContent;
|
|
2221
|
+
editor.addBlock = (block, targetSectionId, columnIndex) => {
|
|
2222
|
+
originalAddBlock(block, targetSectionId, columnIndex);
|
|
2223
|
+
collaboration._broadcastOperation({
|
|
2224
|
+
operation: "add_block",
|
|
2225
|
+
data: {
|
|
2226
|
+
block,
|
|
2227
|
+
section_id: targetSectionId,
|
|
2228
|
+
column_index: columnIndex
|
|
2229
|
+
},
|
|
2230
|
+
timestamp: Date.now()
|
|
2231
|
+
});
|
|
2232
|
+
};
|
|
2233
|
+
editor.updateBlock = (blockId, updates) => {
|
|
2234
|
+
originalUpdateBlock(blockId, updates);
|
|
2235
|
+
collaboration._broadcastOperation({
|
|
2236
|
+
operation: "update_block",
|
|
2237
|
+
data: { block_id: blockId, updates },
|
|
2238
|
+
timestamp: Date.now()
|
|
2239
|
+
});
|
|
2240
|
+
};
|
|
2241
|
+
editor.removeBlock = (blockId) => {
|
|
2242
|
+
originalRemoveBlock(blockId);
|
|
2243
|
+
collaboration._broadcastOperation({
|
|
2244
|
+
operation: "delete_block",
|
|
2245
|
+
data: { block_id: blockId },
|
|
2246
|
+
timestamp: Date.now()
|
|
2247
|
+
});
|
|
2248
|
+
};
|
|
2249
|
+
editor.moveBlock = (blockId, newIndex, targetSectionId, columnIndex) => {
|
|
2250
|
+
originalMoveBlock(blockId, newIndex, targetSectionId, columnIndex);
|
|
2251
|
+
collaboration._broadcastOperation({
|
|
2252
|
+
operation: "move_block",
|
|
2253
|
+
data: {
|
|
2254
|
+
block_id: blockId,
|
|
2255
|
+
index: newIndex,
|
|
2256
|
+
section_id: targetSectionId,
|
|
2257
|
+
column_index: columnIndex
|
|
2258
|
+
},
|
|
2259
|
+
timestamp: Date.now()
|
|
2260
|
+
});
|
|
2261
|
+
};
|
|
2262
|
+
editor.updateSettings = (updates) => {
|
|
2263
|
+
originalUpdateSettings(updates);
|
|
2264
|
+
collaboration._broadcastOperation({
|
|
2265
|
+
operation: "update_settings",
|
|
2266
|
+
data: { updates },
|
|
2267
|
+
timestamp: Date.now()
|
|
2268
|
+
});
|
|
2269
|
+
};
|
|
2270
|
+
editor.setContent = (content, markDirty) => {
|
|
2271
|
+
originalSetContent(content, markDirty);
|
|
2272
|
+
collaboration._broadcastOperation({
|
|
2273
|
+
operation: "set_content",
|
|
2274
|
+
data: { content },
|
|
2275
|
+
timestamp: Date.now()
|
|
2276
|
+
});
|
|
2277
|
+
};
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2200
2280
|
// src/cloud/web-socket.ts
|
|
2201
2281
|
import { ref as ref7 } from "vue";
|
|
2202
2282
|
function useWebSocket(options) {
|
|
@@ -2406,7 +2486,7 @@ function useTestEmail(options) {
|
|
|
2406
2486
|
signature: testEmailConfig.value.signature
|
|
2407
2487
|
});
|
|
2408
2488
|
} catch (err) {
|
|
2409
|
-
const wrappedError = err instanceof Error ? err : new Error("Failed to send test email");
|
|
2489
|
+
const wrappedError = err instanceof Error ? err : new Error("Failed to send test email", { cause: err });
|
|
2410
2490
|
error.value = wrappedError.message;
|
|
2411
2491
|
onError?.(wrappedError);
|
|
2412
2492
|
throw wrappedError;
|
|
@@ -2474,7 +2554,7 @@ function usePlanConfig(options) {
|
|
|
2474
2554
|
config.value = await apiClient.fetchConfig();
|
|
2475
2555
|
} catch (error) {
|
|
2476
2556
|
onError?.(
|
|
2477
|
-
error instanceof Error ? error : new Error("Failed to fetch config")
|
|
2557
|
+
error instanceof Error ? error : new Error("Failed to fetch config", { cause: error })
|
|
2478
2558
|
);
|
|
2479
2559
|
} finally {
|
|
2480
2560
|
isLoading.value = false;
|
|
@@ -2615,6 +2695,7 @@ export {
|
|
|
2615
2695
|
useAiConfig,
|
|
2616
2696
|
useAiRewrite,
|
|
2617
2697
|
useCollaboration,
|
|
2698
|
+
useCollaborationBroadcast,
|
|
2618
2699
|
useCommentListener,
|
|
2619
2700
|
useComments,
|
|
2620
2701
|
useDesignReference,
|