@mdxui/do 4.0.1 → 4.0.8
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/app/index.d.ts +32 -186
- package/dist/app/index.js +19 -11
- package/dist/auth/index.d.ts +48 -0
- package/dist/auth/index.js +4 -0
- package/dist/{breadcrumbs-C9Qn3S7d.d.ts → breadcrumbs-DltlCiHt.d.ts} +3 -3
- package/dist/chunk-2FWXT4HH.js +576 -0
- package/dist/chunk-2FWXT4HH.js.map +1 -0
- package/dist/chunk-5PC6U46L.js +604 -0
- package/dist/chunk-5PC6U46L.js.map +1 -0
- package/dist/chunk-63VCRTDQ.js +2505 -0
- package/dist/chunk-63VCRTDQ.js.map +1 -0
- package/dist/chunk-7J3RSIG4.js +178 -0
- package/dist/chunk-7J3RSIG4.js.map +1 -0
- package/dist/chunk-7QCTRNEJ.js +173 -0
- package/dist/chunk-7QCTRNEJ.js.map +1 -0
- package/dist/chunk-7TFHUKS7.js +66 -0
- package/dist/chunk-7TFHUKS7.js.map +1 -0
- package/dist/{chunk-LJIWB7KE.js → chunk-BU5HMHGQ.js} +3 -3
- package/dist/chunk-BU5HMHGQ.js.map +1 -0
- package/dist/{chunk-GGO5GW72.js → chunk-BZURBNFD.js} +305 -51
- package/dist/chunk-BZURBNFD.js.map +1 -0
- package/dist/{chunk-XH3LVW7J.js → chunk-FM2RTAHV.js} +5 -65
- package/dist/chunk-FM2RTAHV.js.map +1 -0
- package/dist/{chunk-OHWWWONS.js → chunk-HC4PBXV4.js} +131 -58
- package/dist/chunk-HC4PBXV4.js.map +1 -0
- package/dist/{chunk-Y52IEYVM.js → chunk-JPZ6RZJE.js} +78 -45
- package/dist/chunk-JPZ6RZJE.js.map +1 -0
- package/dist/{chunk-KAZJ43F6.js → chunk-KLN5OTQH.js} +168 -361
- package/dist/chunk-KLN5OTQH.js.map +1 -0
- package/dist/chunk-LCYBQR35.js +79 -0
- package/dist/chunk-LCYBQR35.js.map +1 -0
- package/dist/chunk-PJYGRD7N.js +216 -0
- package/dist/chunk-PJYGRD7N.js.map +1 -0
- package/dist/chunk-QEXY4FZV.js +292 -0
- package/dist/chunk-QEXY4FZV.js.map +1 -0
- package/dist/chunk-SX4IIE2R.js +53 -0
- package/dist/chunk-SX4IIE2R.js.map +1 -0
- package/dist/chunk-UCWMSKCW.js +901 -0
- package/dist/chunk-UCWMSKCW.js.map +1 -0
- package/dist/{chunk-YMQRC6IC.js → chunk-WC6SFBAF.js} +59 -6
- package/dist/chunk-WC6SFBAF.js.map +1 -0
- package/dist/chunk-WIKU77ZY.js +18 -0
- package/dist/chunk-WIKU77ZY.js.map +1 -0
- package/dist/chunk-X3AWNFBF.js +47 -0
- package/dist/chunk-X3AWNFBF.js.map +1 -0
- package/dist/chunk-ZZTQGMLX.js +23 -0
- package/dist/chunk-ZZTQGMLX.js.map +1 -0
- package/dist/{lib → client}/index.d.ts +97 -345
- package/dist/client/index.js +3 -0
- package/dist/common-DW_JM2dW.d.ts +454 -0
- package/dist/components/index.d.ts +11 -2
- package/dist/components/index.js +8 -3
- package/dist/{config-CxvpD8Y6.d.ts → config-DB14_LhF.d.ts} +1 -1
- package/dist/{do-D27i5bU0.d.ts → do-D37hbmL9.d.ts} +6 -14
- package/dist/dotdo-client-2DkwXHM2.d.ts +344 -0
- package/dist/errors-BOY11CJs.d.ts +373 -0
- package/dist/features/data-browser/index.d.ts +51 -0
- package/dist/features/data-browser/index.js +12 -0
- package/dist/features/data-browser/index.js.map +1 -0
- package/dist/features/data-grid/index.d.ts +22 -0
- package/dist/features/data-grid/index.js +12 -0
- package/dist/features/data-grid/index.js.map +1 -0
- package/dist/features/document-editor/index.d.ts +26 -0
- package/dist/features/document-editor/index.js +12 -0
- package/dist/features/document-editor/index.js.map +1 -0
- package/dist/features/function-editor/index.d.ts +215 -0
- package/dist/features/function-editor/index.js +7 -0
- package/dist/features/function-editor/index.js.map +1 -0
- package/dist/hooks/index.d.ts +64 -7
- package/dist/hooks/index.js +8 -7
- package/dist/hooks/things/index.d.ts +5 -297
- package/dist/hooks/things/index.js +6 -6
- package/dist/index-C0m9UI6W.d.ts +444 -0
- package/dist/index.d.ts +41 -31
- package/dist/index.js +21 -13
- package/dist/providers/index.d.ts +16 -28
- package/dist/providers/index.js +3 -3
- package/dist/schemas/index.d.ts +4551 -109
- package/dist/schemas/index.js +2 -260
- package/dist/schemas/index.js.map +1 -1
- package/dist/shell/index.d.ts +92 -0
- package/dist/shell/index.js +6 -0
- package/dist/shell/index.js.map +1 -0
- package/dist/{thing-BF25aUtJ.d.ts → thing-Dc3AE2XI.d.ts} +22 -22
- package/dist/thing-adapters-aMjF0h9u.d.ts +1214 -0
- package/dist/types/index.d.ts +954 -7521
- package/dist/types/index.js +2 -2
- package/dist/ui-filters-BvrjMP_U.d.ts +108 -0
- package/dist/{errors-DratdVIz.d.ts → utils/index.d.ts} +38 -77
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist-app/assets/index-DWX3479M.js +7 -0
- package/dist-app/assets/index-DWX3479M.js.map +1 -0
- package/dist-app/assets/main-BptePr_C.js +318 -0
- package/dist-app/assets/main-BptePr_C.js.map +1 -0
- package/dist-app/assets/main-CS9jgKzj.css +1 -0
- package/dist-app/index.html +38 -0
- package/package.json +46 -33
- package/dist/agents-2_r9e9i7.d.ts +0 -1043
- package/dist/capnweb-client-Bq78FtEA.d.ts +0 -229
- package/dist/chunk-3XKYQRXY.js +0 -192
- package/dist/chunk-3XKYQRXY.js.map +0 -1
- package/dist/chunk-4KXVN3EQ.js +0 -56
- package/dist/chunk-4KXVN3EQ.js.map +0 -1
- package/dist/chunk-GGO5GW72.js.map +0 -1
- package/dist/chunk-GYIMQZE7.js +0 -1994
- package/dist/chunk-GYIMQZE7.js.map +0 -1
- package/dist/chunk-IQ23B4ME.js +0 -944
- package/dist/chunk-IQ23B4ME.js.map +0 -1
- package/dist/chunk-JJLAES6W.js +0 -76
- package/dist/chunk-JJLAES6W.js.map +0 -1
- package/dist/chunk-KAZJ43F6.js.map +0 -1
- package/dist/chunk-LJIWB7KE.js.map +0 -1
- package/dist/chunk-OHWWWONS.js.map +0 -1
- package/dist/chunk-VRLUXCLD.js +0 -31
- package/dist/chunk-VRLUXCLD.js.map +0 -1
- package/dist/chunk-XH3LVW7J.js.map +0 -1
- package/dist/chunk-Y52IEYVM.js.map +0 -1
- package/dist/chunk-YMQRC6IC.js.map +0 -1
- package/dist/lib/index.js +0 -6
- package/dist/query-keys-CZNFikIi.d.ts +0 -153
- package/dist/views/index.d.ts +0 -131
- package/dist/views/index.js +0 -11
- /package/dist/{lib → auth}/index.js.map +0 -0
- /package/dist/{views → client}/index.js.map +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { twMerge } from 'tailwind-merge';
|
|
3
3
|
|
|
4
|
-
// src/
|
|
4
|
+
// src/utils/cn.ts
|
|
5
5
|
function cn(...inputs) {
|
|
6
6
|
return twMerge(clsx(inputs));
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
// src/utils/format.ts
|
|
8
10
|
function formatSemanticId(ns, type, id) {
|
|
9
11
|
return `${ns}/${type}/${id}`;
|
|
10
12
|
}
|
|
@@ -65,7 +67,7 @@ function formatBytes(bytes) {
|
|
|
65
67
|
const k = 1024;
|
|
66
68
|
const sizes = ["B", "KB", "MB", "GB", "TB"];
|
|
67
69
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
68
|
-
return `${formatDecimal(bytes /
|
|
70
|
+
return `${formatDecimal(bytes / k ** i)} ${sizes[i]}`;
|
|
69
71
|
}
|
|
70
72
|
function formatDuration(ms) {
|
|
71
73
|
if (ms < 1e3) return `${ms}ms`;
|
|
@@ -83,49 +85,80 @@ function capitalize(text) {
|
|
|
83
85
|
function camelToTitle(text) {
|
|
84
86
|
return text.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).trim();
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
88
|
+
|
|
89
|
+
// src/utils/errors.ts
|
|
90
|
+
var APIError = class _APIError extends Error {
|
|
91
|
+
constructor(code, message, status, details) {
|
|
92
|
+
super(message);
|
|
93
|
+
this.code = code;
|
|
94
|
+
this.status = status;
|
|
95
|
+
this.details = details;
|
|
96
|
+
this.name = "APIError";
|
|
97
|
+
Object.setPrototypeOf(this, _APIError.prototype);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create an APIError from a fetch Response
|
|
101
|
+
*
|
|
102
|
+
* @param response - The Response object from fetch
|
|
103
|
+
* @param body - Optional response body text (if already read)
|
|
104
|
+
* @returns An APIError with HTTP status information
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const response = await fetch('/api/things')
|
|
109
|
+
* if (!response.ok) {
|
|
110
|
+
* throw APIError.fromResponse(response, await response.text())
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
static fromResponse(response, body) {
|
|
115
|
+
return new _APIError(`HTTP_${response.status}`, body || response.statusText, response.status);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Type guard to check if an error is an APIError
|
|
119
|
+
*/
|
|
120
|
+
static isAPIError(error) {
|
|
121
|
+
return error instanceof _APIError;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var NetworkError = class _NetworkError extends Error {
|
|
125
|
+
constructor(message, cause) {
|
|
126
|
+
super(message);
|
|
127
|
+
this.cause = cause;
|
|
128
|
+
this.name = "NetworkError";
|
|
129
|
+
Object.setPrototypeOf(this, _NetworkError.prototype);
|
|
125
130
|
}
|
|
126
|
-
|
|
131
|
+
};
|
|
132
|
+
var ValidationError = class _ValidationError extends Error {
|
|
133
|
+
constructor(message, fields) {
|
|
134
|
+
super(message);
|
|
135
|
+
this.fields = fields;
|
|
136
|
+
this.name = "ValidationError";
|
|
137
|
+
Object.setPrototypeOf(this, _ValidationError.prototype);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
var SyncError = class _SyncError extends Error {
|
|
141
|
+
constructor(message, operation, recoverable) {
|
|
142
|
+
super(message);
|
|
143
|
+
this.operation = operation;
|
|
144
|
+
this.recoverable = recoverable;
|
|
145
|
+
this.name = "SyncError";
|
|
146
|
+
Object.setPrototypeOf(this, _SyncError.prototype);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
function isAPIError(error) {
|
|
150
|
+
return error instanceof APIError;
|
|
151
|
+
}
|
|
152
|
+
function isNetworkError(error) {
|
|
153
|
+
return error instanceof NetworkError;
|
|
154
|
+
}
|
|
155
|
+
function isValidationError(error) {
|
|
156
|
+
return error instanceof ValidationError;
|
|
157
|
+
}
|
|
158
|
+
function isSyncError(error) {
|
|
159
|
+
return error instanceof SyncError;
|
|
127
160
|
}
|
|
128
161
|
|
|
129
|
-
export { camelToTitle, capitalize, cn,
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
131
|
-
//# sourceMappingURL=chunk-
|
|
162
|
+
export { APIError, NetworkError, SyncError, ValidationError, camelToTitle, capitalize, cn, formatBytes, formatDate, formatDateTime, formatDuration, formatNumber, formatRelativeTime, formatSemanticId, isAPIError, isNetworkError, isSyncError, isValidationError, parseSemanticId, truncate };
|
|
163
|
+
//# sourceMappingURL=chunk-JPZ6RZJE.js.map
|
|
164
|
+
//# sourceMappingURL=chunk-JPZ6RZJE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/cn.ts","../src/utils/format.ts","../src/utils/errors.ts"],"names":[],"mappings":";;;;AA0BO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;;;ACjBO,SAAS,gBAAA,CAAiB,EAAA,EAAY,IAAA,EAAc,EAAA,EAAoB;AAC7E,EAAA,OAAO,CAAA,EAAG,EAAE,CAAA,CAAA,EAAI,IAAI,IAAI,EAAE,CAAA,CAAA;AAC5B;AAOO,SAAS,gBAAgB,UAAA,EAAqE;AACnG,EAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,KAAA,CAAM,GAAG,CAAA;AAClC,EAAA,IAAI,KAAA,CAAM,SAAS,CAAA,EAAG;AACpB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,4BAAA,EAA+B,UAAU,CAAA,CAAE,CAAA;AAAA,EAC7D;AAIA,EAAA,MAAM,IAAA,GAAO,MAAM,CAAC,CAAA;AACpB,EAAA,MAAM,EAAA,GAAK,KAAA,CAAM,KAAA,CAAM,MAAA,GAAS,CAAC,CAAA;AACjC,EAAA,MAAM,YAAY,KAAA,CAAM,KAAA,CAAM,GAAG,EAAE,CAAA,CAAE,KAAK,GAAG,CAAA;AAE7C,EAAA,OAAO,EAAE,IAAA,EAAM,SAAA,EAAW,EAAA,EAAG;AAC/B;AAKO,SAAS,UAAA,CAAW,MAAqB,OAAA,EAA8C;AAC5F,EAAA,MAAM,IAAI,OAAO,IAAA,KAAS,WAAW,IAAI,IAAA,CAAK,IAAI,CAAA,GAAI,IAAA;AACtD,EAAA,OAAO,CAAA,CAAE,kBAAA,CAAmB,MAAA,EAAW,OAAA,IAAW;AAAA,IAChD,IAAA,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Ae,IAAA,EAAM,aAAA,CAAa,SAAS,CAAA;AAAA,EACpD;AACF;AAgBO,IAAM,eAAA,GAAN,MAAM,gBAAA,SAAwB,KAAA,CAAM;AAAA,EACzC,WAAA,CACE,SACgB,MAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAFG,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AACZ,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,gBAAA,CAAgB,SAAS,CAAA;AAAA,EACvD;AACF;AAkBO,IAAM,SAAA,GAAN,MAAM,UAAA,SAAkB,KAAA,CAAM;AAAA,EACnC,WAAA,CACE,OAAA,EACgB,SAAA,EACA,WAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA;AACA,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,WAAA;AACZ,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,UAAA,CAAU,SAAS,CAAA;AAAA,EACjD;AACF;AAKO,SAAS,WAAW,KAAA,EAAmC;AAC5D,EAAA,OAAO,KAAA,YAAiB,QAAA;AAC1B;AAKO,SAAS,eAAe,KAAA,EAAuC;AACpE,EAAA,OAAO,KAAA,YAAiB,YAAA;AAC1B;AAKO,SAAS,kBAAkB,KAAA,EAA0C;AAC1E,EAAA,OAAO,KAAA,YAAiB,eAAA;AAC1B;AAKO,SAAS,YAAY,KAAA,EAAoC;AAC9D,EAAA,OAAO,KAAA,YAAiB,SAAA;AAC1B","file":"chunk-JPZ6RZJE.js","sourcesContent":["/**\n * Class name merging utility\n *\n * Combines clsx with tailwind-merge for intelligent class name handling.\n *\n * @module\n */\n\nimport { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\n/**\n * Merge class names with Tailwind CSS support\n *\n * Uses clsx for conditional classes and tailwind-merge to handle\n * Tailwind CSS class conflicts intelligently.\n *\n * @example\n * ```typescript\n * cn('px-4 py-2', 'bg-blue-500', condition && 'opacity-50')\n * // => 'px-4 py-2 bg-blue-500 opacity-50' (if condition is true)\n *\n * cn('px-2', 'px-4')\n * // => 'px-4' (tailwind-merge resolves conflicts)\n * ```\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","/**\n * Formatting Utilities\n *\n * Pure functions for formatting dates, numbers, strings, and semantic IDs.\n *\n * @module\n */\n\n/**\n * Format a semantic ID (ns/type/id)\n */\nexport function formatSemanticId(ns: string, type: string, id: string): string {\n return `${ns}/${type}/${id}`\n}\n\n/**\n * Parse a semantic ID into components\n * Format: type/namespace/id where namespace can contain slashes\n * @throws Error if the semantic ID format is invalid\n */\nexport function parseSemanticId(semanticId: string): { type: string; namespace: string; id: string } {\n const parts = semanticId.split('/')\n if (parts.length < 3) {\n throw new Error(`Invalid semantic ID format: ${semanticId}`)\n }\n\n // Format is type/namespace.../id\n // Type is first, id is last, namespace is everything in between\n const type = parts[0]\n const id = parts[parts.length - 1]\n const namespace = parts.slice(1, -1).join('/')\n\n return { type, namespace, id }\n}\n\n/**\n * Format a date for display\n */\nexport function formatDate(date: Date | string, options?: Intl.DateTimeFormatOptions): string {\n const d = typeof date === 'string' ? new Date(date) : date\n return d.toLocaleDateString(undefined, options ?? {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n })\n}\n\n/**\n * Format a date and time for display\n */\nexport function formatDateTime(date: Date | string, options?: Intl.DateTimeFormatOptions): string {\n const d = typeof date === 'string' ? new Date(date) : date\n return d.toLocaleString(undefined, options ?? {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n })\n}\n\n/**\n * Format a relative time (e.g., \"2 hours ago\")\n */\nexport function formatRelativeTime(date: Date | string): string {\n const d = typeof date === 'string' ? new Date(date) : date\n const now = new Date()\n const diffMs = now.getTime() - d.getTime()\n const diffSec = Math.floor(diffMs / 1000)\n const diffMin = Math.floor(diffSec / 60)\n const diffHour = Math.floor(diffMin / 60)\n const diffDay = Math.floor(diffHour / 24)\n\n if (diffSec < 60) return `${diffSec} ${diffSec === 1 ? 'second' : 'seconds'} ago`\n if (diffMin < 60) return `${diffMin} ${diffMin === 1 ? 'minute' : 'minutes'} ago`\n if (diffHour < 24) return `${diffHour} ${diffHour === 1 ? 'hour' : 'hours'} ago`\n if (diffDay < 7) return `${diffDay} ${diffDay === 1 ? 'day' : 'days'} ago`\n return formatDate(d)\n}\n\n/**\n * Format a decimal, removing trailing .0 for whole numbers\n */\nfunction formatDecimal(value: number, decimals: number = 1): string {\n const fixed = value.toFixed(decimals)\n // Remove trailing .0 for whole numbers\n return fixed.endsWith('.0') ? fixed.slice(0, -2) : fixed\n}\n\n/**\n * Format a number with abbreviation (1K, 1M, etc.)\n */\nexport function formatNumber(num: number): string {\n if (num < 0) return `-${formatNumber(-num)}`\n if (num >= 1_000_000) return `${formatDecimal(num / 1_000_000)}M`\n if (num >= 1_000) return `${formatDecimal(num / 1_000)}K`\n return num.toString()\n}\n\n/**\n * Format bytes to human-readable string\n */\nexport function formatBytes(bytes: number): string {\n if (bytes === 0) return '0 B'\n const k = 1024\n const sizes = ['B', 'KB', 'MB', 'GB', 'TB']\n const i = Math.floor(Math.log(bytes) / Math.log(k))\n return `${formatDecimal(bytes / k ** i)} ${sizes[i]}`\n}\n\n/**\n * Format duration in milliseconds to human-readable string\n */\nexport function formatDuration(ms: number): string {\n if (ms < 1000) return `${ms}ms`\n if (ms < 60_000) return `${formatDecimal(ms / 1000)}s`\n if (ms < 3_600_000) return `${Math.floor(ms / 60_000)}m ${Math.floor((ms % 60_000) / 1000)}s`\n return `${Math.floor(ms / 3_600_000)}h ${Math.floor((ms % 3_600_000) / 60_000)}m`\n}\n\n/**\n * Truncate text with ellipsis\n */\nexport function truncate(text: string, maxLength: number, suffix: string = '...'): string {\n if (text.length <= maxLength) return text\n return text.slice(0, maxLength) + suffix\n}\n\n/**\n * Capitalize first letter\n */\nexport function capitalize(text: string): string {\n return text.charAt(0).toUpperCase() + text.slice(1)\n}\n\n/**\n * Convert camelCase to Title Case\n */\nexport function camelToTitle(text: string): string {\n return text\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (str) => str.toUpperCase())\n .trim()\n}\n","/**\n * Standardized error classes for @mdxui/do\n *\n * These classes provide consistent error handling across the package:\n * - APIError: HTTP/RPC errors from the backend\n * - NetworkError: Connection/fetch failures\n * - ValidationError: Input validation errors\n * - SyncError: Real-time sync errors\n *\n * @example\n * ```typescript\n * import { APIError, NetworkError, isAPIError } from '@mdxui/do'\n *\n * try {\n * const response = await fetch(url)\n * if (!response.ok) {\n * throw APIError.fromResponse(response)\n * }\n * } catch (error) {\n * if (isAPIError(error)) {\n * console.log(`API error ${error.code}: ${error.message}`)\n * if (error.status === 401) {\n * // Handle auth error\n * }\n * } else if (isNetworkError(error)) {\n * console.log('Network unavailable, will retry...')\n * }\n * }\n * ```\n */\n\n/**\n * API error from HTTP/RPC calls\n *\n * Provides structured error information including:\n * - code: Machine-readable error code (e.g., 'HTTP_404', 'VALIDATION_ERROR')\n * - message: Human-readable error message\n * - status: HTTP status code (when applicable)\n * - details: Additional error details from the server\n */\nexport class APIError extends Error {\n constructor(\n public readonly code: string,\n message: string,\n public readonly status?: number,\n public readonly details?: Record<string, unknown>\n ) {\n super(message)\n this.name = 'APIError'\n // Maintain proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, APIError.prototype)\n }\n\n /**\n * Create an APIError from a fetch Response\n *\n * @param response - The Response object from fetch\n * @param body - Optional response body text (if already read)\n * @returns An APIError with HTTP status information\n *\n * @example\n * ```typescript\n * const response = await fetch('/api/things')\n * if (!response.ok) {\n * throw APIError.fromResponse(response, await response.text())\n * }\n * ```\n */\n static fromResponse(response: Response, body?: string): APIError {\n return new APIError(`HTTP_${response.status}`, body || response.statusText, response.status)\n }\n\n /**\n * Type guard to check if an error is an APIError\n */\n static isAPIError(error: unknown): error is APIError {\n return error instanceof APIError\n }\n}\n\n/**\n * Network-level error (connection failures, timeouts, etc.)\n *\n * Use for errors that occur before an HTTP response is received:\n * - DNS resolution failures\n * - Connection refused\n * - Request timeouts\n * - CORS errors\n */\nexport class NetworkError extends Error {\n constructor(\n message: string,\n public readonly cause?: Error\n ) {\n super(message)\n this.name = 'NetworkError'\n Object.setPrototypeOf(this, NetworkError.prototype)\n }\n}\n\n/**\n * Validation error with field-level details\n *\n * Use when input data fails validation checks.\n * The fields property maps field names to arrays of error messages.\n *\n * @example\n * ```typescript\n * throw new ValidationError('Invalid input', {\n * email: ['Invalid email format'],\n * name: ['Name is required', 'Name must be at least 2 characters'],\n * })\n * ```\n */\nexport class ValidationError extends Error {\n constructor(\n message: string,\n public readonly fields: Record<string, string[]>\n ) {\n super(message)\n this.name = 'ValidationError'\n Object.setPrototypeOf(this, ValidationError.prototype)\n }\n}\n\n/**\n * Real-time sync error\n *\n * Use for errors in the sync protocol (WebSocket, EventSource, etc.).\n * The operation property indicates what sync operation failed.\n * The recoverable property indicates whether the client should retry.\n *\n * @example\n * ```typescript\n * // Recoverable connection error - client should retry\n * throw new SyncError('WebSocket disconnected', 'connect', true)\n *\n * // Non-recoverable push error - user intervention needed\n * throw new SyncError('Conflict: record modified by another user', 'push', false)\n * ```\n */\nexport class SyncError extends Error {\n constructor(\n message: string,\n public readonly operation: 'push' | 'pull' | 'connect',\n public readonly recoverable: boolean\n ) {\n super(message)\n this.name = 'SyncError'\n Object.setPrototypeOf(this, SyncError.prototype)\n }\n}\n\n/**\n * Type guard to check if an error is an APIError\n */\nexport function isAPIError(error: unknown): error is APIError {\n return error instanceof APIError\n}\n\n/**\n * Type guard to check if an error is a NetworkError\n */\nexport function isNetworkError(error: unknown): error is NetworkError {\n return error instanceof NetworkError\n}\n\n/**\n * Type guard to check if an error is a ValidationError\n */\nexport function isValidationError(error: unknown): error is ValidationError {\n return error instanceof ValidationError\n}\n\n/**\n * Type guard to check if an error is a SyncError\n */\nexport function isSyncError(error: unknown): error is SyncError {\n return error instanceof SyncError\n}\n"]}
|