@widgetic/creator 0.3.49
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 +116 -0
- package/dist/CreatorApp.svelte +11821 -0
- package/dist/CreatorApp.svelte.d.ts +41 -0
- package/dist/components/EditableName.svelte +94 -0
- package/dist/components/EditableName.svelte.d.ts +27 -0
- package/dist/components/SelectorDropdown.svelte +238 -0
- package/dist/components/SelectorDropdown.svelte.d.ts +41 -0
- package/dist/components/WidgetDetails.svelte +3127 -0
- package/dist/components/WidgetDetails.svelte.d.ts +235 -0
- package/dist/components/index.d.ts +0 -0
- package/dist/components/index.js +4 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/creator-types.d.ts +64 -0
- package/dist/creator-types.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/localCacheGate.d.ts +7 -0
- package/dist/localCacheGate.js +29 -0
- package/dist/pageHelpers.d.ts +15 -0
- package/dist/pageHelpers.js +194 -0
- package/dist/stores/userSession.d.ts +7 -0
- package/dist/stores/userSession.js +32 -0
- package/dist/stores/websocketStore.d.ts +53 -0
- package/dist/stores/websocketStore.js +289 -0
- package/dist/syncSiteAuth.d.ts +9 -0
- package/dist/syncSiteAuth.js +53 -0
- package/dist/utils/creatorDraftStorage.d.ts +17 -0
- package/dist/utils/creatorDraftStorage.js +87 -0
- package/dist/utils/embedCode.d.ts +51 -0
- package/dist/utils/embedCode.js +69 -0
- package/dist/utils/models.d.ts +4 -0
- package/dist/utils/models.js +94 -0
- package/dist/utils/operationStream.d.ts +29 -0
- package/dist/utils/operationStream.js +116 -0
- package/dist/utils/prototypes.d.ts +0 -0
- package/dist/utils/prototypes.js +20 -0
- package/dist/utils/widgeticChatUpload.d.ts +26 -0
- package/dist/utils/widgeticChatUpload.js +148 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.js +38 -0
- package/package.json +124 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation status streaming via the backend SSE endpoint
|
|
3
|
+
* (GET /v1/operations/stream?operationId=...).
|
|
4
|
+
*
|
|
5
|
+
* Uses a fetch-based reader so we can send the Authorization header —
|
|
6
|
+
* native EventSource cannot set custom headers and the gateway's auth
|
|
7
|
+
* middleware only accepts Bearer tokens.
|
|
8
|
+
*/
|
|
9
|
+
export type OperationStatusPayload = {
|
|
10
|
+
id: string;
|
|
11
|
+
type: string;
|
|
12
|
+
status: string;
|
|
13
|
+
progress?: number | null;
|
|
14
|
+
metadata?: Record<string, unknown> | null;
|
|
15
|
+
error?: string | null;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Subscribe to operation updates over SSE. Resolves with the terminal
|
|
21
|
+
* payload once status reaches completed/failed/cancelled, or rejects on
|
|
22
|
+
* stream failure or premature close so the caller can fall back to polling.
|
|
23
|
+
*/
|
|
24
|
+
export declare function streamOperationUpdates(operationId: string, options: {
|
|
25
|
+
basePath: string;
|
|
26
|
+
accessToken: string;
|
|
27
|
+
onMessage?: (op: OperationStatusPayload) => void;
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}): Promise<OperationStatusPayload>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operation status streaming via the backend SSE endpoint
|
|
3
|
+
* (GET /v1/operations/stream?operationId=...).
|
|
4
|
+
*
|
|
5
|
+
* Uses a fetch-based reader so we can send the Authorization header —
|
|
6
|
+
* native EventSource cannot set custom headers and the gateway's auth
|
|
7
|
+
* middleware only accepts Bearer tokens.
|
|
8
|
+
*/
|
|
9
|
+
const TERMINAL_STATUSES = new Set(['completed', 'failed', 'cancelled']);
|
|
10
|
+
/**
|
|
11
|
+
* Subscribe to operation updates over SSE. Resolves with the terminal
|
|
12
|
+
* payload once status reaches completed/failed/cancelled, or rejects on
|
|
13
|
+
* stream failure or premature close so the caller can fall back to polling.
|
|
14
|
+
*/
|
|
15
|
+
export function streamOperationUpdates(operationId, options) {
|
|
16
|
+
const { basePath, accessToken, onMessage, signal } = options;
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
let settled = false;
|
|
19
|
+
let abortController = null;
|
|
20
|
+
let reader = null;
|
|
21
|
+
const cleanup = () => {
|
|
22
|
+
try {
|
|
23
|
+
reader?.cancel();
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
/* noop */
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
abortController?.abort();
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
/* noop */
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const settle = (fn, value) => {
|
|
36
|
+
if (settled)
|
|
37
|
+
return;
|
|
38
|
+
settled = true;
|
|
39
|
+
cleanup();
|
|
40
|
+
if (fn === 'resolve')
|
|
41
|
+
resolve(value);
|
|
42
|
+
else
|
|
43
|
+
reject(value);
|
|
44
|
+
};
|
|
45
|
+
const run = async () => {
|
|
46
|
+
abortController = new AbortController();
|
|
47
|
+
// Propagate caller aborts into the fetch request.
|
|
48
|
+
if (signal) {
|
|
49
|
+
if (signal.aborted) {
|
|
50
|
+
abortController.abort();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
signal.addEventListener('abort', () => abortController?.abort(), { once: true });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const response = await fetch(`${basePath}/operations/stream?operationId=${encodeURIComponent(operationId)}`, {
|
|
57
|
+
method: 'GET',
|
|
58
|
+
headers: {
|
|
59
|
+
Authorization: `Bearer ${accessToken}`,
|
|
60
|
+
Accept: 'text/event-stream',
|
|
61
|
+
'Cache-Control': 'no-cache'
|
|
62
|
+
},
|
|
63
|
+
signal: abortController.signal
|
|
64
|
+
});
|
|
65
|
+
if (!response.ok || !response.body) {
|
|
66
|
+
throw new Error(`Operation stream unavailable (${response.status})`);
|
|
67
|
+
}
|
|
68
|
+
reader = response.body.getReader();
|
|
69
|
+
const decoder = new TextDecoder();
|
|
70
|
+
let buffer = '';
|
|
71
|
+
while (true) {
|
|
72
|
+
const { done, value } = await reader.read();
|
|
73
|
+
if (done)
|
|
74
|
+
break;
|
|
75
|
+
buffer += decoder.decode(value, { stream: true });
|
|
76
|
+
// SSE frames are `data: {...}\n\n`
|
|
77
|
+
let frameEnd = buffer.indexOf('\n\n');
|
|
78
|
+
while (frameEnd !== -1) {
|
|
79
|
+
const frame = buffer.slice(0, frameEnd);
|
|
80
|
+
buffer = buffer.slice(frameEnd + 2);
|
|
81
|
+
const dataLine = frame
|
|
82
|
+
.split('\n')
|
|
83
|
+
.filter((line) => line.startsWith('data:'))
|
|
84
|
+
.map((line) => line.slice(5).trimStart())
|
|
85
|
+
.join('\n');
|
|
86
|
+
// Skip empty frames and keepalive comment frames.
|
|
87
|
+
if (!dataLine || !dataLine.startsWith('{'))
|
|
88
|
+
continue;
|
|
89
|
+
try {
|
|
90
|
+
const op = JSON.parse(dataLine);
|
|
91
|
+
onMessage?.(op);
|
|
92
|
+
const status = String(op?.status || '').toLowerCase();
|
|
93
|
+
if (TERMINAL_STATUSES.has(status)) {
|
|
94
|
+
settle('resolve', op);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (parseError) {
|
|
99
|
+
console.warn('[OperationStream] Failed to parse SSE frame', parseError);
|
|
100
|
+
}
|
|
101
|
+
frameEnd = buffer.indexOf('\n\n');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Server closed without a terminal event — reject so the caller
|
|
105
|
+
// can fall back to polling.
|
|
106
|
+
settle('reject', new Error('Operation stream closed before completion'));
|
|
107
|
+
};
|
|
108
|
+
run().catch((error) => {
|
|
109
|
+
if (signal?.aborted) {
|
|
110
|
+
settle('reject', new DOMException('Operation aborted', 'AbortError'));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
settle('reject', error instanceof Error ? error : new Error(String(error)));
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
String.prototype.capitalize = function () {
|
|
2
|
+
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
3
|
+
};
|
|
4
|
+
String.prototype.rmFirstAtUser = function () {
|
|
5
|
+
let newString = this.charAt(0) === "@" ? (this.indexOf(" ") > 0 ? this.slice(this.indexOf(" ") + 1) : "") : this;
|
|
6
|
+
return newString;
|
|
7
|
+
};
|
|
8
|
+
// remove punctuation from the transcript
|
|
9
|
+
String.prototype.rmPunctuation = function () {
|
|
10
|
+
let newString = this.toLowerCase().replace(/[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/g, '');
|
|
11
|
+
return newString;
|
|
12
|
+
};
|
|
13
|
+
String.prototype.splitByWordCount = function (count) {
|
|
14
|
+
var arr = this.split(' ');
|
|
15
|
+
var r = [];
|
|
16
|
+
while (arr.length) {
|
|
17
|
+
r.push(arr.splice(0, count).join(' '));
|
|
18
|
+
}
|
|
19
|
+
return r;
|
|
20
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Matches api-gateway MULTIPART_MAX_UPLOAD_BYTES. */
|
|
2
|
+
export declare const CHAT_MULTIPART_MAX_BYTES: number;
|
|
3
|
+
export type ChatUploadConfig = {
|
|
4
|
+
apiBasePath: string;
|
|
5
|
+
accessToken: string;
|
|
6
|
+
contextType?: 'widget-codegen' | 'browser-ic' | 'content-property';
|
|
7
|
+
source?: string;
|
|
8
|
+
widgetId?: string;
|
|
9
|
+
conversationId?: string;
|
|
10
|
+
};
|
|
11
|
+
export type ChatUploadResult = {
|
|
12
|
+
id: string;
|
|
13
|
+
url: string;
|
|
14
|
+
fileType: string;
|
|
15
|
+
fileName: string;
|
|
16
|
+
fileSize: number;
|
|
17
|
+
};
|
|
18
|
+
export type ChatUploadOptions = {
|
|
19
|
+
onProgress?: (percentage: number) => void;
|
|
20
|
+
abortSignal?: AbortSignal;
|
|
21
|
+
};
|
|
22
|
+
export declare function shouldUseTusForChatUpload(file: File): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Upload a chat attachment via multipart (≤10MB) or TUS (>10MB).
|
|
25
|
+
*/
|
|
26
|
+
export declare function uploadChatFileToWidgeticApi(file: File, config: ChatUploadConfig, options?: ChatUploadOptions): Promise<ChatUploadResult>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import * as tus from 'tus-js-client';
|
|
2
|
+
/** Matches api-gateway MULTIPART_MAX_UPLOAD_BYTES. */
|
|
3
|
+
export const CHAT_MULTIPART_MAX_BYTES = 10 * 1024 * 1024;
|
|
4
|
+
const DEFAULT_TUS_CHUNK_SIZE = 5 * 1024 * 1024;
|
|
5
|
+
function parseErrorMessage(response, fallback) {
|
|
6
|
+
return response
|
|
7
|
+
.json()
|
|
8
|
+
.then((json) => json?.message || json?.error?.message || fallback)
|
|
9
|
+
.catch(() => fallback);
|
|
10
|
+
}
|
|
11
|
+
function mapUploadResponse(data, file) {
|
|
12
|
+
const url = data.url || '';
|
|
13
|
+
if (!url) {
|
|
14
|
+
throw new Error('Upload response missing url');
|
|
15
|
+
}
|
|
16
|
+
const id = data.id || '';
|
|
17
|
+
if (!id) {
|
|
18
|
+
throw new Error('Upload response missing id');
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
id,
|
|
22
|
+
url,
|
|
23
|
+
fileType: (data.mime_type || data.mimeType || file.type),
|
|
24
|
+
fileName: (data.file_name || data.fileName || file.name),
|
|
25
|
+
fileSize: (data.file_size ?? data.fileSize ?? file.size),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function extractTusId(uploadUrl) {
|
|
29
|
+
if (!uploadUrl)
|
|
30
|
+
return null;
|
|
31
|
+
const trimmed = uploadUrl.replace(/\/+$/, '');
|
|
32
|
+
return trimmed.split('/').pop() || null;
|
|
33
|
+
}
|
|
34
|
+
async function uploadMultipart(file, config) {
|
|
35
|
+
const basePath = config.apiBasePath.replace(/\/+$/, '');
|
|
36
|
+
const token = config.accessToken.replace(/^Bearer\s+/i, '');
|
|
37
|
+
const formData = new FormData();
|
|
38
|
+
formData.append('file', file);
|
|
39
|
+
formData.append('context_type', config.contextType || 'widget-codegen');
|
|
40
|
+
formData.append('source', config.source || 'chat-upload');
|
|
41
|
+
if (config.widgetId)
|
|
42
|
+
formData.append('widget_id', config.widgetId);
|
|
43
|
+
if (config.conversationId)
|
|
44
|
+
formData.append('conversation_id', config.conversationId);
|
|
45
|
+
const response = await fetch(`${basePath}/uploads`, {
|
|
46
|
+
method: 'POST',
|
|
47
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
48
|
+
body: formData,
|
|
49
|
+
});
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
throw new Error(await parseErrorMessage(response, `Upload failed (${response.status})`));
|
|
52
|
+
}
|
|
53
|
+
const json = await response.json();
|
|
54
|
+
const data = (json?.data ?? json);
|
|
55
|
+
return mapUploadResponse(data, file);
|
|
56
|
+
}
|
|
57
|
+
function uploadTus(file, config, options = {}) {
|
|
58
|
+
const basePath = config.apiBasePath.replace(/\/+$/, '');
|
|
59
|
+
const token = config.accessToken.replace(/^Bearer\s+/i, '');
|
|
60
|
+
const endpoint = `${basePath}/uploads/tus`;
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
let tusUpload = null;
|
|
63
|
+
const abortHandler = () => {
|
|
64
|
+
tusUpload?.abort(true);
|
|
65
|
+
reject(new Error('Upload cancelled.'));
|
|
66
|
+
};
|
|
67
|
+
if (options.abortSignal?.aborted) {
|
|
68
|
+
reject(new Error('Upload cancelled.'));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
options.abortSignal?.addEventListener('abort', abortHandler, { once: true });
|
|
72
|
+
const metadata = {
|
|
73
|
+
filename: file.name,
|
|
74
|
+
filetype: file.type || 'application/octet-stream',
|
|
75
|
+
context_type: config.contextType || 'widget-codegen',
|
|
76
|
+
source: config.source || 'chat-upload',
|
|
77
|
+
};
|
|
78
|
+
if (config.widgetId)
|
|
79
|
+
metadata.widget_id = config.widgetId;
|
|
80
|
+
if (config.conversationId)
|
|
81
|
+
metadata.conversation_id = config.conversationId;
|
|
82
|
+
tusUpload = new tus.Upload(file, {
|
|
83
|
+
endpoint,
|
|
84
|
+
chunkSize: DEFAULT_TUS_CHUNK_SIZE,
|
|
85
|
+
retryDelays: [0, 1000, 3000, 5000],
|
|
86
|
+
metadata,
|
|
87
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
88
|
+
onError: (error) => {
|
|
89
|
+
options.abortSignal?.removeEventListener('abort', abortHandler);
|
|
90
|
+
reject(error);
|
|
91
|
+
},
|
|
92
|
+
onProgress: (bytesUploaded, bytesTotal) => {
|
|
93
|
+
const percentage = bytesTotal > 0 ? Math.round((bytesUploaded / bytesTotal) * 100) : 0;
|
|
94
|
+
options.onProgress?.(percentage);
|
|
95
|
+
},
|
|
96
|
+
onSuccess: async () => {
|
|
97
|
+
options.abortSignal?.removeEventListener('abort', abortHandler);
|
|
98
|
+
const tusId = extractTusId(tusUpload?.url);
|
|
99
|
+
if (!tusId) {
|
|
100
|
+
reject(new Error('TUS upload finished without upload id.'));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
const completeResponse = await fetch(`${endpoint}/${tusId}/complete`, {
|
|
105
|
+
method: 'POST',
|
|
106
|
+
headers: {
|
|
107
|
+
Authorization: `Bearer ${token}`,
|
|
108
|
+
'Content-Type': 'application/json',
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
if (!completeResponse.ok) {
|
|
112
|
+
reject(new Error(await parseErrorMessage(completeResponse, `Complete failed (${completeResponse.status})`)));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const json = await completeResponse.json();
|
|
116
|
+
const data = (json?.data ?? json);
|
|
117
|
+
resolve(mapUploadResponse(data, file));
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
reject(error instanceof Error ? error : new Error('Failed to finalize upload.'));
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
tusUpload.findPreviousUploads().then((previousUploads) => {
|
|
125
|
+
if (previousUploads.length > 0) {
|
|
126
|
+
tusUpload?.resumeFromPreviousUpload(previousUploads[0]);
|
|
127
|
+
}
|
|
128
|
+
tusUpload?.start();
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export function shouldUseTusForChatUpload(file) {
|
|
133
|
+
return file.size > CHAT_MULTIPART_MAX_BYTES;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Upload a chat attachment via multipart (≤10MB) or TUS (>10MB).
|
|
137
|
+
*/
|
|
138
|
+
export async function uploadChatFileToWidgeticApi(file, config, options = {}) {
|
|
139
|
+
if (shouldUseTusForChatUpload(file)) {
|
|
140
|
+
console.log('[ChatUpload] TUS upload:', file.name, `${(file.size / 1024 / 1024).toFixed(1)}MB`);
|
|
141
|
+
return uploadTus(file, config, options);
|
|
142
|
+
}
|
|
143
|
+
console.log('[ChatUpload] Multipart upload:', file.name);
|
|
144
|
+
options.onProgress?.(50);
|
|
145
|
+
const result = await uploadMultipart(file, config);
|
|
146
|
+
options.onProgress?.(100);
|
|
147
|
+
return result;
|
|
148
|
+
}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ClassValue } from "clsx";
|
|
2
|
+
import type { TransitionConfig } from "svelte/transition";
|
|
3
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
4
|
+
type FlyAndScaleParams = {
|
|
5
|
+
y?: number;
|
|
6
|
+
x?: number;
|
|
7
|
+
start?: number;
|
|
8
|
+
duration?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const flyAndScale: (node: Element, params?: FlyAndScaleParams) => TransitionConfig;
|
|
11
|
+
export {};
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { cubicOut } from "svelte/easing";
|
|
4
|
+
export function cn(...inputs) {
|
|
5
|
+
return twMerge(clsx(inputs));
|
|
6
|
+
}
|
|
7
|
+
export const flyAndScale = (node, params = { y: -8, x: 0, start: 0.95, duration: 150 }) => {
|
|
8
|
+
const style = getComputedStyle(node);
|
|
9
|
+
const transform = style.transform === "none" ? "" : style.transform;
|
|
10
|
+
const scaleConversion = (valueA, scaleA, scaleB) => {
|
|
11
|
+
const [minA, maxA] = scaleA;
|
|
12
|
+
const [minB, maxB] = scaleB;
|
|
13
|
+
const percentage = (valueA - minA) / (maxA - minA);
|
|
14
|
+
const valueB = percentage * (maxB - minB) + minB;
|
|
15
|
+
return valueB;
|
|
16
|
+
};
|
|
17
|
+
const styleToString = (style) => {
|
|
18
|
+
return Object.keys(style).reduce((str, key) => {
|
|
19
|
+
if (style[key] === undefined)
|
|
20
|
+
return str;
|
|
21
|
+
return str + `${key}:${style[key]};`;
|
|
22
|
+
}, "");
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
duration: params.duration ?? 200,
|
|
26
|
+
delay: 0,
|
|
27
|
+
css: (t) => {
|
|
28
|
+
const y = scaleConversion(t, [0, 1], [params.y ?? 5, 0]);
|
|
29
|
+
const x = scaleConversion(t, [0, 1], [params.x ?? 0, 0]);
|
|
30
|
+
const scale = scaleConversion(t, [0, 1], [params.start ?? 0.95, 1]);
|
|
31
|
+
return styleToString({
|
|
32
|
+
transform: `${transform} translate3d(${x}px, ${y}px, 0) scale(${scale})`,
|
|
33
|
+
opacity: t
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
easing: cubicOut
|
|
37
|
+
};
|
|
38
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@widgetic/creator",
|
|
3
|
+
"version": "0.3.49",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"peerDependencies": {
|
|
6
|
+
"@sveltejs/kit": "^2.20.0",
|
|
7
|
+
"svelte": "^5.25.0",
|
|
8
|
+
"@widgetic/api-sdk": "*",
|
|
9
|
+
"@widgetic/canvas": "^0.5.3",
|
|
10
|
+
"@widgetic/cache-layer": "^0.1.1",
|
|
11
|
+
"@widgetic/chat": "^0.1.3",
|
|
12
|
+
"@widgetic/design-system": ">=0.3.0",
|
|
13
|
+
"@widgetic/editor": "^4.0.0",
|
|
14
|
+
"@widgetic/file-browser": "^0.5.16"
|
|
15
|
+
},
|
|
16
|
+
"svelte": "./dist/index.js",
|
|
17
|
+
"module": "./dist/index.js",
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"**/*.css",
|
|
22
|
+
"**/*.svelte"
|
|
23
|
+
],
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"svelte": "./dist/index.js",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"i": "rm -rf node_modules && npm i && npm run lps",
|
|
36
|
+
"start": "node build/index.js",
|
|
37
|
+
"render-build": "bash render-build.sh",
|
|
38
|
+
"build": "NODE_ENV=production vite build && npm run package",
|
|
39
|
+
"package": "NODE_ENV=production svelte-package",
|
|
40
|
+
"package:watch": "NODE_ENV=development svelte-package --watch",
|
|
41
|
+
"stop-dev": "lsof -i :5174 | awk 'NR>1 {print $2}' | xargs kill",
|
|
42
|
+
"predev": "node scripts/suppress-postcss-from-warning.js",
|
|
43
|
+
"dev": "npm run stop-dev && npm run dev-sv",
|
|
44
|
+
"predev-sv": "node scripts/suppress-postcss-from-warning.js",
|
|
45
|
+
"dev-sv": "VITE_APP_VERSION=$(node -p \"require('./package.json').version\") VITE_BUILD_SHA=$(git rev-parse --short HEAD 2>/dev/null || echo local) NODE_ENV=development vite dev --port 5174",
|
|
46
|
+
"lps": "volta run npm link --save @widgetic/design-system && volta run npm link --save @widgetic/api-sdk && volta run npm link --save @widgetic/canvas",
|
|
47
|
+
"llinks": "ls -la node_modules/@widgetic",
|
|
48
|
+
"clean-npm-cache": "npm cache clean --force",
|
|
49
|
+
"clean-svelte-cache": "rm -rf .svelte-kit && npx svelte-kit sync",
|
|
50
|
+
"clean-vite-cache": "rm -rf node_modules/.vite",
|
|
51
|
+
"find-sveltekit-running": "lsof -i :5173",
|
|
52
|
+
"find-vite-running": "ps aux | grep vite",
|
|
53
|
+
"preview": "vite preview",
|
|
54
|
+
"test": "npm run test:integration && npm run test:unit",
|
|
55
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
56
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
57
|
+
"lint": "prettier --check . && eslint .",
|
|
58
|
+
"format": "prettier --write .",
|
|
59
|
+
"test:integration": "playwright test",
|
|
60
|
+
"test:unit": "vitest"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@playwright/test": "^1.28.1",
|
|
64
|
+
"@sveltejs/adapter-auto": "^3.0.0",
|
|
65
|
+
"@sveltejs/kit": "^2.20.2",
|
|
66
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
67
|
+
"@tailwindcss/postcss": "^4.1.4",
|
|
68
|
+
"@tailwindcss/typography": "^0.5.15",
|
|
69
|
+
"@types/eslint": "^9.6.0",
|
|
70
|
+
"autoprefixer": "^10.4.20",
|
|
71
|
+
"eslint": "^9.0.0",
|
|
72
|
+
"eslint-config-prettier": "^9.1.0",
|
|
73
|
+
"eslint-plugin-svelte": "^2.36.0",
|
|
74
|
+
"globals": "^15.0.0",
|
|
75
|
+
"postcss": "^8.5.3",
|
|
76
|
+
"prettier": "^3.1.1",
|
|
77
|
+
"prettier-plugin-svelte": "^3.1.2",
|
|
78
|
+
"svelte": "^5.25.6",
|
|
79
|
+
"svelte-check": "^4.0.0",
|
|
80
|
+
"svelte-preprocess": "^6.0.3",
|
|
81
|
+
"tailwind-merge": "^2.5.2",
|
|
82
|
+
"tailwind-variants": "^0.2.1",
|
|
83
|
+
"tailwindcss": "^4.1.4",
|
|
84
|
+
"tailwindcss-animate": "^1.0.7",
|
|
85
|
+
"terser": "^5.46.0",
|
|
86
|
+
"ts-node": "^10.9.2",
|
|
87
|
+
"typescript": "^5.8.3",
|
|
88
|
+
"typescript-eslint": "^8.20.0",
|
|
89
|
+
"vite": "^6.2.6",
|
|
90
|
+
"vite-imagetools": "^7.0.4",
|
|
91
|
+
"vitest": "^2.0.0",
|
|
92
|
+
"@widgetic/api-sdk": "*",
|
|
93
|
+
"@widgetic/canvas": "^0.5.3",
|
|
94
|
+
"@widgetic/cache-layer": "^0.1.1",
|
|
95
|
+
"@widgetic/chat": "^0.1.3",
|
|
96
|
+
"@widgetic/design-system": ">=0.3.0",
|
|
97
|
+
"@widgetic/editor": "^4.0.0",
|
|
98
|
+
"@widgetic/file-browser": "^0.5.16"
|
|
99
|
+
},
|
|
100
|
+
"dependencies": {
|
|
101
|
+
"@codesandbox/sandpack-react": "^2.19.9",
|
|
102
|
+
"@emotion/styled": "^11.13.0",
|
|
103
|
+
"@mdi/js": "^7.4.47",
|
|
104
|
+
"@mui/material": "^6.1.1",
|
|
105
|
+
"@sveltejs/adapter-node": "^5.2.4",
|
|
106
|
+
"@sveltejs/package": "^2.5.8",
|
|
107
|
+
"@xterm/addon-fit": "^0.11.0",
|
|
108
|
+
"@xterm/xterm": "^6.0.0",
|
|
109
|
+
"clsx": "^2.1.1",
|
|
110
|
+
"dotenv": "^16.4.5",
|
|
111
|
+
"fabric": "^6.9.1",
|
|
112
|
+
"mode-watcher": "^1.1.0",
|
|
113
|
+
"sandpack-file-explorer": "^0.0.7",
|
|
114
|
+
"socket.io-client": "^4.8.3",
|
|
115
|
+
"tus-js-client": "^4.3.1"
|
|
116
|
+
},
|
|
117
|
+
"publishConfig": {
|
|
118
|
+
"access": "public"
|
|
119
|
+
},
|
|
120
|
+
"repository": {
|
|
121
|
+
"type": "git",
|
|
122
|
+
"url": "https://gitlab.com/widgeticai/Frontend/widget-creator.git"
|
|
123
|
+
}
|
|
124
|
+
}
|