@copilotkit/shared 2.0.0-rc.37 → 2.0.0-rc.39
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/generative-ui/clone-value.cjs +364 -0
- package/dist/generative-ui/clone-value.cjs.map +1 -0
- package/dist/generative-ui/clone-value.d.cts +51 -0
- package/dist/generative-ui/clone-value.d.cts.map +1 -0
- package/dist/generative-ui/clone-value.d.mts +51 -0
- package/dist/generative-ui/clone-value.d.mts.map +1 -0
- package/dist/generative-ui/clone-value.mjs +363 -0
- package/dist/generative-ui/clone-value.mjs.map +1 -0
- package/dist/generative-ui/index.cjs +39 -0
- package/dist/generative-ui/index.d.cts +8 -2
- package/dist/generative-ui/index.d.mts +8 -2
- package/dist/generative-ui/index.mjs +8 -2
- package/dist/generative-ui/is-record.d.cts +3 -1
- package/dist/generative-ui/is-record.d.cts.map +1 -1
- package/dist/generative-ui/is-record.d.mts +3 -1
- package/dist/generative-ui/is-record.d.mts.map +1 -1
- package/dist/generative-ui/schema-render.cjs +2 -1
- package/dist/generative-ui/schema-render.cjs.map +1 -1
- package/dist/generative-ui/schema-render.d.cts.map +1 -1
- package/dist/generative-ui/schema-render.d.mts.map +1 -1
- package/dist/generative-ui/schema-render.mjs +2 -1
- package/dist/generative-ui/schema-render.mjs.map +1 -1
- package/dist/generative-ui/standard/chart-config.cjs +347 -0
- package/dist/generative-ui/standard/chart-config.cjs.map +1 -0
- package/dist/generative-ui/standard/chart-config.d.cts +97 -0
- package/dist/generative-ui/standard/chart-config.d.cts.map +1 -0
- package/dist/generative-ui/standard/chart-config.d.mts +97 -0
- package/dist/generative-ui/standard/chart-config.d.mts.map +1 -0
- package/dist/generative-ui/standard/chart-config.mjs +342 -0
- package/dist/generative-ui/standard/chart-config.mjs.map +1 -0
- package/dist/generative-ui/standard/composites.d.cts +2 -2
- package/dist/generative-ui/standard/composites.d.mts +2 -2
- package/dist/generative-ui/standard/declarations.d.cts +68 -68
- package/dist/generative-ui/standard/declarations.d.mts +68 -68
- package/dist/generative-ui/standard/index.d.mts +5 -1
- package/dist/generative-ui/standard/inputs.d.cts +22 -22
- package/dist/generative-ui/standard/inputs.d.mts +22 -22
- package/dist/generative-ui/standard/layout.d.cts +90 -90
- package/dist/generative-ui/standard/layout.d.mts +90 -90
- package/dist/generative-ui/standard/map-helpers.cjs +104 -0
- package/dist/generative-ui/standard/map-helpers.cjs.map +1 -0
- package/dist/generative-ui/standard/map-helpers.d.cts +88 -0
- package/dist/generative-ui/standard/map-helpers.d.cts.map +1 -0
- package/dist/generative-ui/standard/map-helpers.d.mts +88 -0
- package/dist/generative-ui/standard/map-helpers.d.mts.map +1 -0
- package/dist/generative-ui/standard/map-helpers.mjs +95 -0
- package/dist/generative-ui/standard/map-helpers.mjs.map +1 -0
- package/dist/generative-ui/standard/media.d.cts +6 -6
- package/dist/generative-ui/standard/media.d.mts +6 -6
- package/dist/generative-ui/standard/style-helpers.cjs +151 -0
- package/dist/generative-ui/standard/style-helpers.cjs.map +1 -0
- package/dist/generative-ui/standard/style-helpers.d.cts +56 -0
- package/dist/generative-ui/standard/style-helpers.d.cts.map +1 -0
- package/dist/generative-ui/standard/style-helpers.d.mts +56 -0
- package/dist/generative-ui/standard/style-helpers.d.mts.map +1 -0
- package/dist/generative-ui/standard/style-helpers.mjs +142 -0
- package/dist/generative-ui/standard/style-helpers.mjs.map +1 -0
- package/dist/generative-ui/standard/text.d.cts +14 -14
- package/dist/generative-ui/standard/text.d.mts +14 -14
- package/dist/generative-ui/standard/url.cjs +54 -0
- package/dist/generative-ui/standard/url.cjs.map +1 -0
- package/dist/generative-ui/standard/url.d.cts +32 -0
- package/dist/generative-ui/standard/url.d.cts.map +1 -0
- package/dist/generative-ui/standard/url.d.mts +32 -0
- package/dist/generative-ui/standard/url.d.mts.map +1 -0
- package/dist/generative-ui/standard/url.mjs +50 -0
- package/dist/generative-ui/standard/url.mjs.map +1 -0
- package/dist/generative-ui/thrown.cjs +69 -0
- package/dist/generative-ui/thrown.cjs.map +1 -0
- package/dist/generative-ui/thrown.d.cts +21 -0
- package/dist/generative-ui/thrown.d.cts.map +1 -0
- package/dist/generative-ui/thrown.d.mts +21 -0
- package/dist/generative-ui/thrown.d.mts.map +1 -0
- package/dist/generative-ui/thrown.mjs +67 -0
- package/dist/generative-ui/thrown.mjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +368 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +1 -1
- package/src/__tests__/schema-render.test.ts +78 -0
- package/src/generative-ui/__tests__/clone-value-differential.test.ts +480 -0
- package/src/generative-ui/__tests__/clone-value.test.ts +226 -0
- package/src/generative-ui/clone-value.ts +511 -0
- package/src/generative-ui/index.ts +6 -2
- package/src/generative-ui/schema-render.ts +2 -1
- package/src/generative-ui/standard/__tests__/standard-helpers.test.ts +407 -0
- package/src/generative-ui/standard/chart-config.ts +434 -0
- package/src/generative-ui/standard/index.ts +36 -0
- package/src/generative-ui/standard/map-helpers.ts +155 -0
- package/src/generative-ui/standard/style-helpers.ts +170 -0
- package/src/generative-ui/standard/url.ts +51 -0
- package/src/generative-ui/thrown.ts +90 -0
- package/src/index.ts +5 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/generative-ui/clone-value.ts
|
|
3
|
+
/**
|
|
4
|
+
* A deep copy of `value` with `structuredClone` semantics. Uses the global
|
|
5
|
+
* `structuredClone` when there is one. Hermes (React Native) has none, so
|
|
6
|
+
* there a local copy runs. It decides the kind of an object by the same
|
|
7
|
+
* internal slots that `structuredClone` reads (brand checks), not by
|
|
8
|
+
* `instanceof` or `Symbol.toStringTag`, and gives what the native
|
|
9
|
+
* `structuredClone` of V8 gives:
|
|
10
|
+
*
|
|
11
|
+
* - `undefined`, `null`, strings, booleans, numbers (also `NaN`,
|
|
12
|
+
* `Infinity` and `-0`) and bigints are returned as they are.
|
|
13
|
+
* - Arrays and ordinary objects are copied deeply: own enumerable string
|
|
14
|
+
* keys only, so a class instance, or an object with its own
|
|
15
|
+
* `Symbol.toStringTag`, becomes a plain object. A sparse array keeps its
|
|
16
|
+
* holes and its length.
|
|
17
|
+
* - `Date`, `RegExp`, `Map`, `Set`, boxed primitives, `ArrayBuffer`s (a
|
|
18
|
+
* resizable one stays resizable), typed arrays (as the base type, never a
|
|
19
|
+
* subclass), `DataView`s, `Blob`s and `File`s are copied.
|
|
20
|
+
* - An `Error` becomes an `Error` of its standard type (a custom name or
|
|
21
|
+
* `AggregateError` becomes `Error`), with its own `message`, its `stack`
|
|
22
|
+
* and its own `cause`. A `DOMException` stays one where the global exists.
|
|
23
|
+
* - A `SharedArrayBuffer` is shared, not copied, like `structuredClone`.
|
|
24
|
+
* - Cycles and shared references are kept: an object reached twice is
|
|
25
|
+
* copied once.
|
|
26
|
+
* - Functions, symbols, `Symbol` wrappers, `arguments`, `WeakMap`,
|
|
27
|
+
* `WeakSet`, `WeakRef`, `Promise`, iterators, generators and the web
|
|
28
|
+
* platform objects that cannot be cloned (`URL`, `Headers`, streams...)
|
|
29
|
+
* throw an error named `"DataCloneError"`: a `DOMException` where the
|
|
30
|
+
* global exists, else an `Error` (Hermes has no `DOMException`).
|
|
31
|
+
*
|
|
32
|
+
* Two differences are left. A `Proxy` cannot be told from its target in
|
|
33
|
+
* JavaScript, so the local copy reads it through its traps, where the
|
|
34
|
+
* native one throws. And an ordinary object takes a fast path that runs no
|
|
35
|
+
* brand check (each failed one throws and catches an exception, slow on
|
|
36
|
+
* Hermes), so a `Map`, `Set`, `Promise` or other object whose prototype
|
|
37
|
+
* was changed to `Object.prototype` or `null` is copied as a plain object.
|
|
38
|
+
*
|
|
39
|
+
* It never installs a global `structuredClone`, and it does not use the
|
|
40
|
+
* JSON round trip of `structuredClone_` from `@ag-ui/client`, which turns
|
|
41
|
+
* `undefined` into `{}` and drops or changes values JSON cannot hold.
|
|
42
|
+
*
|
|
43
|
+
* @param value - The value to copy.
|
|
44
|
+
* @returns A copy that shares no object with `value`, except a
|
|
45
|
+
* `SharedArrayBuffer`.
|
|
46
|
+
* @throws An error named `"DataCloneError"` for a value that cannot be
|
|
47
|
+
* cloned.
|
|
48
|
+
*/
|
|
49
|
+
function cloneValue(value) {
|
|
50
|
+
const native = globalThis.structuredClone;
|
|
51
|
+
if (typeof native === "function") return native(value);
|
|
52
|
+
return cloneInto(value, /* @__PURE__ */ new Map());
|
|
53
|
+
}
|
|
54
|
+
/** A global, or `undefined` when this engine does not have it. */
|
|
55
|
+
function globalNamed(name) {
|
|
56
|
+
return globalThis[name];
|
|
57
|
+
}
|
|
58
|
+
/** True when `method` accepts `value` as its `this`: a brand check. */
|
|
59
|
+
function hasBrand(value, method, ...args) {
|
|
60
|
+
if (typeof method !== "function") return false;
|
|
61
|
+
try {
|
|
62
|
+
method.call(value, ...args);
|
|
63
|
+
return true;
|
|
64
|
+
} catch {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** The getter of `key` on `proto`, for a brand check. */
|
|
69
|
+
function getterOf(proto, key) {
|
|
70
|
+
if (!proto) return void 0;
|
|
71
|
+
return Object.getOwnPropertyDescriptor(proto, key)?.get;
|
|
72
|
+
}
|
|
73
|
+
function protoOf(name) {
|
|
74
|
+
return (globalNamed(name) ?? {}).prototype;
|
|
75
|
+
}
|
|
76
|
+
function methodOf(name, key) {
|
|
77
|
+
return protoOf(name)?.[key];
|
|
78
|
+
}
|
|
79
|
+
const ERROR_NAMES = new Set([
|
|
80
|
+
"Error",
|
|
81
|
+
"EvalError",
|
|
82
|
+
"RangeError",
|
|
83
|
+
"ReferenceError",
|
|
84
|
+
"SyntaxError",
|
|
85
|
+
"TypeError",
|
|
86
|
+
"URIError"
|
|
87
|
+
]);
|
|
88
|
+
/** Web platform objects that `structuredClone` refuses, where they exist. */
|
|
89
|
+
const PLATFORM_UNCLONEABLE = [
|
|
90
|
+
"URL",
|
|
91
|
+
"URLSearchParams",
|
|
92
|
+
"Headers",
|
|
93
|
+
"Request",
|
|
94
|
+
"Response",
|
|
95
|
+
"FormData",
|
|
96
|
+
"ReadableStream",
|
|
97
|
+
"WritableStream",
|
|
98
|
+
"TransformStream",
|
|
99
|
+
"MessagePort"
|
|
100
|
+
];
|
|
101
|
+
function* emptyGenerator() {}
|
|
102
|
+
/** The prototypes of the built-in iterators and generators. */
|
|
103
|
+
function iteratorPrototypes() {
|
|
104
|
+
const protos = [];
|
|
105
|
+
const add = (iterator) => {
|
|
106
|
+
const proto = iterator && Object.getPrototypeOf(iterator);
|
|
107
|
+
if (proto) protos.push(proto);
|
|
108
|
+
};
|
|
109
|
+
add([][Symbol.iterator]());
|
|
110
|
+
add((/* @__PURE__ */ new Map())[Symbol.iterator]());
|
|
111
|
+
add((/* @__PURE__ */ new Set())[Symbol.iterator]());
|
|
112
|
+
add(""[Symbol.iterator]());
|
|
113
|
+
protos.push(Object.getPrototypeOf(emptyGenerator.prototype));
|
|
114
|
+
const matchAllKey = Symbol.matchAll;
|
|
115
|
+
const matchAll = matchAllKey ? RegExp.prototype[matchAllKey] : void 0;
|
|
116
|
+
if (typeof matchAll === "function") add(matchAll.call(/a/g, ""));
|
|
117
|
+
return protos;
|
|
118
|
+
}
|
|
119
|
+
let iteratorProtos;
|
|
120
|
+
function inheritsFrom(value, protos) {
|
|
121
|
+
for (let proto = Object.getPrototypeOf(value); proto !== null; proto = Object.getPrototypeOf(proto)) if (protos.includes(proto)) return true;
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
function dataCloneError(what) {
|
|
125
|
+
const message = `${what} could not be cloned.`;
|
|
126
|
+
const DOMExceptionClass = globalNamed("DOMException");
|
|
127
|
+
if (typeof DOMExceptionClass === "function") return new DOMExceptionClass(message, "DataCloneError");
|
|
128
|
+
const error = new Error(message);
|
|
129
|
+
error.name = "DataCloneError";
|
|
130
|
+
return error;
|
|
131
|
+
}
|
|
132
|
+
function describe(value) {
|
|
133
|
+
if (typeof value === "function") return value.name ? `function ${value.name}` : "A function";
|
|
134
|
+
if (typeof value === "symbol") return String(value);
|
|
135
|
+
return Object.prototype.toString.call(value);
|
|
136
|
+
}
|
|
137
|
+
/** True for an object with the [[ErrorData]] slot. */
|
|
138
|
+
function isError(value) {
|
|
139
|
+
const isErrorCheck = Error.isError;
|
|
140
|
+
if (typeof isErrorCheck === "function") return isErrorCheck.call(Error, value) === true;
|
|
141
|
+
if (!(Symbol.toStringTag in value)) return Object.prototype.toString.call(value) === "[object Error]";
|
|
142
|
+
return value instanceof Error;
|
|
143
|
+
}
|
|
144
|
+
function isDOMException(value) {
|
|
145
|
+
return hasBrand(value, getterOf(protoOf("DOMException"), "code"));
|
|
146
|
+
}
|
|
147
|
+
/** The name of the base typed-array type of a view, or `undefined`. */
|
|
148
|
+
function typedArrayName(value) {
|
|
149
|
+
const getter = getterOf(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag);
|
|
150
|
+
if (!getter) return void 0;
|
|
151
|
+
const name = getter.call(value);
|
|
152
|
+
return typeof name === "string" ? name : void 0;
|
|
153
|
+
}
|
|
154
|
+
function cloneArrayBuffer(value) {
|
|
155
|
+
const source = value;
|
|
156
|
+
if (source.resizable === true) {
|
|
157
|
+
const copy = new ArrayBuffer(source.byteLength, { maxByteLength: source.maxByteLength });
|
|
158
|
+
new Uint8Array(copy).set(new Uint8Array(source));
|
|
159
|
+
return copy;
|
|
160
|
+
}
|
|
161
|
+
return ArrayBuffer.prototype.slice.call(value, 0);
|
|
162
|
+
}
|
|
163
|
+
function cloneError(value, seen) {
|
|
164
|
+
let copy;
|
|
165
|
+
const own = (key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
166
|
+
const messageDescriptor = Object.getOwnPropertyDescriptor(value, "message");
|
|
167
|
+
const message = messageDescriptor && "value" in messageDescriptor ? `${messageDescriptor.value}` : void 0;
|
|
168
|
+
if (isDOMException(value)) copy = new (globalNamed("DOMException"))(value.message, value.name);
|
|
169
|
+
else {
|
|
170
|
+
const ErrorClass = globalNamed(ERROR_NAMES.has(value.name) ? value.name : "Error") ?? Error;
|
|
171
|
+
copy = message === void 0 ? new ErrorClass() : new ErrorClass(message);
|
|
172
|
+
}
|
|
173
|
+
seen.set(value, copy);
|
|
174
|
+
if (typeof value.stack === "string") copy.stack = value.stack;
|
|
175
|
+
if (!isDOMException(value)) {
|
|
176
|
+
const causeDescriptor = Object.getOwnPropertyDescriptor(value, "cause");
|
|
177
|
+
if (own("cause") && causeDescriptor && "value" in causeDescriptor) Object.defineProperty(copy, "cause", {
|
|
178
|
+
value: cloneInto(causeDescriptor.value, seen),
|
|
179
|
+
writable: true,
|
|
180
|
+
enumerable: false,
|
|
181
|
+
configurable: true
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return copy;
|
|
185
|
+
}
|
|
186
|
+
function cloneInto(value, seen) {
|
|
187
|
+
if (typeof value === "function" || typeof value === "symbol") throw dataCloneError(describe(value));
|
|
188
|
+
if (typeof value !== "object" || value === null) return value;
|
|
189
|
+
const known = seen.get(value);
|
|
190
|
+
if (known !== void 0) return known;
|
|
191
|
+
if (Array.isArray(value)) {
|
|
192
|
+
const copy = [];
|
|
193
|
+
copy.length = value.length;
|
|
194
|
+
seen.set(value, copy);
|
|
195
|
+
copyKeys(value, copy, seen);
|
|
196
|
+
return copy;
|
|
197
|
+
}
|
|
198
|
+
if (isPlainObject(value)) {
|
|
199
|
+
const copy = {};
|
|
200
|
+
seen.set(value, copy);
|
|
201
|
+
copyKeys(value, copy, seen);
|
|
202
|
+
return copy;
|
|
203
|
+
}
|
|
204
|
+
if (hasBrand(value, Date.prototype.getTime)) {
|
|
205
|
+
const copy = new Date(Date.prototype.getTime.call(value));
|
|
206
|
+
seen.set(value, copy);
|
|
207
|
+
return copy;
|
|
208
|
+
}
|
|
209
|
+
if (hasBrand(value, getterOf(RegExp.prototype, "source"))) {
|
|
210
|
+
const source = getterOf(RegExp.prototype, "source").call(value);
|
|
211
|
+
const flags = getterOf(RegExp.prototype, "flags").call(value);
|
|
212
|
+
const copy = new RegExp(source, flags);
|
|
213
|
+
seen.set(value, copy);
|
|
214
|
+
return copy;
|
|
215
|
+
}
|
|
216
|
+
if (hasBrand(value, Map.prototype.has, void 0)) {
|
|
217
|
+
const copy = /* @__PURE__ */ new Map();
|
|
218
|
+
seen.set(value, copy);
|
|
219
|
+
const entries = [];
|
|
220
|
+
Map.prototype.forEach.call(value, (entry, key) => {
|
|
221
|
+
entries.push([key, entry]);
|
|
222
|
+
});
|
|
223
|
+
for (const [key, entry] of entries) copy.set(cloneInto(key, seen), cloneInto(entry, seen));
|
|
224
|
+
return copy;
|
|
225
|
+
}
|
|
226
|
+
if (hasBrand(value, Set.prototype.has, void 0)) {
|
|
227
|
+
const copy = /* @__PURE__ */ new Set();
|
|
228
|
+
seen.set(value, copy);
|
|
229
|
+
const entries = [];
|
|
230
|
+
Set.prototype.forEach.call(value, (entry) => {
|
|
231
|
+
entries.push(entry);
|
|
232
|
+
});
|
|
233
|
+
for (const entry of entries) copy.add(cloneInto(entry, seen));
|
|
234
|
+
return copy;
|
|
235
|
+
}
|
|
236
|
+
if (hasBrand(value, getterOf(ArrayBuffer.prototype, "byteLength"))) {
|
|
237
|
+
const copy = cloneArrayBuffer(value);
|
|
238
|
+
seen.set(value, copy);
|
|
239
|
+
return copy;
|
|
240
|
+
}
|
|
241
|
+
if (hasBrand(value, getterOf(protoOf("SharedArrayBuffer"), "byteLength"))) {
|
|
242
|
+
seen.set(value, value);
|
|
243
|
+
return value;
|
|
244
|
+
}
|
|
245
|
+
if (ArrayBuffer.isView(value)) {
|
|
246
|
+
const view = value;
|
|
247
|
+
const buffer = cloneInto(view.buffer, seen);
|
|
248
|
+
const isDataView = hasBrand(value, getterOf(DataView.prototype, "byteLength"));
|
|
249
|
+
let copy;
|
|
250
|
+
if (isDataView) copy = new DataView(buffer, view.byteOffset, view.byteLength);
|
|
251
|
+
else {
|
|
252
|
+
const name = typedArrayName(value);
|
|
253
|
+
const TypedArray = name ? globalNamed(name) : void 0;
|
|
254
|
+
if (!TypedArray) throw dataCloneError(describe(value));
|
|
255
|
+
const proto = Object.getPrototypeOf(Uint8Array.prototype);
|
|
256
|
+
copy = new TypedArray(buffer, getterOf(proto, "byteOffset").call(value), getterOf(proto, "length").call(value));
|
|
257
|
+
}
|
|
258
|
+
seen.set(value, copy);
|
|
259
|
+
return copy;
|
|
260
|
+
}
|
|
261
|
+
if (isError(value)) return cloneError(value, seen);
|
|
262
|
+
for (const [name, Boxed] of [
|
|
263
|
+
["Boolean", Boolean],
|
|
264
|
+
["Number", Number],
|
|
265
|
+
["String", String],
|
|
266
|
+
["BigInt", globalNamed("BigInt")]
|
|
267
|
+
]) {
|
|
268
|
+
const valueOf = methodOf(name, "valueOf");
|
|
269
|
+
if (Boxed && hasBrand(value, valueOf)) {
|
|
270
|
+
const copy = Object(valueOf.call(value));
|
|
271
|
+
seen.set(value, copy);
|
|
272
|
+
return copy;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (hasBrand(value, methodOf("Symbol", "valueOf"))) throw dataCloneError(describe(value));
|
|
276
|
+
const BlobClass = globalNamed("Blob");
|
|
277
|
+
if (typeof BlobClass === "function" && value instanceof BlobClass) {
|
|
278
|
+
const copy = cloneBlob(value);
|
|
279
|
+
seen.set(value, copy);
|
|
280
|
+
return copy;
|
|
281
|
+
}
|
|
282
|
+
if (isUncloneable(value)) throw dataCloneError(describe(value));
|
|
283
|
+
const copy = {};
|
|
284
|
+
seen.set(value, copy);
|
|
285
|
+
copyKeys(value, copy, seen);
|
|
286
|
+
return copy;
|
|
287
|
+
}
|
|
288
|
+
function cloneBlob(value) {
|
|
289
|
+
const FileClass = globalNamed("File");
|
|
290
|
+
if (typeof FileClass === "function" && value instanceof FileClass) {
|
|
291
|
+
const file = value;
|
|
292
|
+
return new FileClass([value], file.name, {
|
|
293
|
+
type: value.type,
|
|
294
|
+
lastModified: file.lastModified
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
return new (globalNamed("Blob"))([value], { type: value.type });
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* True for an ordinary object of this realm: its prototype is
|
|
301
|
+
* `Object.prototype` or `null`, it has no `Symbol.toStringTag`, and its
|
|
302
|
+
* built-in tag is "Object" (so not `arguments`, an `Error`, a `Date`, a
|
|
303
|
+
* `RegExp` or a boxed primitive, whatever their prototype). Throws nothing.
|
|
304
|
+
* An object with another slot (a `Map`, a `Set`, a `Promise`...) whose
|
|
305
|
+
* prototype was changed to one of those passes too; only a brand check,
|
|
306
|
+
* which throws, could tell, so it is copied as a plain object.
|
|
307
|
+
*/
|
|
308
|
+
function isPlainObject(value) {
|
|
309
|
+
const proto = Object.getPrototypeOf(value);
|
|
310
|
+
if (proto !== Object.prototype && proto !== null) return false;
|
|
311
|
+
if (Symbol.toStringTag in value) return false;
|
|
312
|
+
if (ArrayBuffer.isView(value)) return false;
|
|
313
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
314
|
+
}
|
|
315
|
+
/** The globals of PLATFORM_UNCLONEABLE and their prototypes, when last read. */
|
|
316
|
+
let platformCache;
|
|
317
|
+
/**
|
|
318
|
+
* The prototypes of the PLATFORM_UNCLONEABLE globals that exist. Kept
|
|
319
|
+
* between calls, and built again only when one of the globals changed (a
|
|
320
|
+
* polyfill installed late).
|
|
321
|
+
*/
|
|
322
|
+
function platformPrototypes() {
|
|
323
|
+
const globals = globalThis;
|
|
324
|
+
const cached = platformCache;
|
|
325
|
+
if (cached && PLATFORM_UNCLONEABLE.every((name, index) => globals[name] === cached.classes[index])) return cached.protos;
|
|
326
|
+
const classes = PLATFORM_UNCLONEABLE.map((name) => globals[name]);
|
|
327
|
+
const protos = PLATFORM_UNCLONEABLE.map(protoOf).filter((proto) => proto !== void 0);
|
|
328
|
+
platformCache = {
|
|
329
|
+
classes,
|
|
330
|
+
protos
|
|
331
|
+
};
|
|
332
|
+
return protos;
|
|
333
|
+
}
|
|
334
|
+
/** An object that structuredClone refuses, though it has no data slot. */
|
|
335
|
+
function isUncloneable(value) {
|
|
336
|
+
if (!(Symbol.toStringTag in value) && Object.prototype.toString.call(value) === "[object Arguments]") return true;
|
|
337
|
+
if (hasBrand(value, methodOf("WeakMap", "has"), {}) || hasBrand(value, methodOf("WeakSet", "has"), {}) || hasBrand(value, methodOf("WeakRef", "deref")) || hasBrand(value, methodOf("FinalizationRegistry", "unregister"), {})) return true;
|
|
338
|
+
const PromiseClass = globalNamed("Promise");
|
|
339
|
+
if (PromiseClass && value instanceof PromiseClass) return true;
|
|
340
|
+
if (!iteratorProtos) iteratorProtos = iteratorPrototypes();
|
|
341
|
+
if (inheritsFrom(value, iteratorProtos)) return true;
|
|
342
|
+
return inheritsFrom(value, platformPrototypes());
|
|
343
|
+
}
|
|
344
|
+
/** Copies the own enumerable string keys, as structuredClone does. */
|
|
345
|
+
function copyKeys(source, target, seen) {
|
|
346
|
+
for (const key of Object.keys(source)) assign(target, key, cloneInto(source[key], seen));
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Sets an own property. A plain assignment of "__proto__" would change the
|
|
350
|
+
* prototype of the copy instead (JSON.parse makes "__proto__" an own key).
|
|
351
|
+
*/
|
|
352
|
+
function assign(target, key, value) {
|
|
353
|
+
if (key === "__proto__") Object.defineProperty(target, key, {
|
|
354
|
+
value,
|
|
355
|
+
enumerable: true,
|
|
356
|
+
configurable: true,
|
|
357
|
+
writable: true
|
|
358
|
+
});
|
|
359
|
+
else target[key] = value;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
//#endregion
|
|
363
|
+
exports.cloneValue = cloneValue;
|
|
364
|
+
//# sourceMappingURL=clone-value.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone-value.cjs","names":[],"sources":["../../src/generative-ui/clone-value.ts"],"sourcesContent":["/**\n * A deep copy of `value` with `structuredClone` semantics. Uses the global\n * `structuredClone` when there is one. Hermes (React Native) has none, so\n * there a local copy runs. It decides the kind of an object by the same\n * internal slots that `structuredClone` reads (brand checks), not by\n * `instanceof` or `Symbol.toStringTag`, and gives what the native\n * `structuredClone` of V8 gives:\n *\n * - `undefined`, `null`, strings, booleans, numbers (also `NaN`,\n * `Infinity` and `-0`) and bigints are returned as they are.\n * - Arrays and ordinary objects are copied deeply: own enumerable string\n * keys only, so a class instance, or an object with its own\n * `Symbol.toStringTag`, becomes a plain object. A sparse array keeps its\n * holes and its length.\n * - `Date`, `RegExp`, `Map`, `Set`, boxed primitives, `ArrayBuffer`s (a\n * resizable one stays resizable), typed arrays (as the base type, never a\n * subclass), `DataView`s, `Blob`s and `File`s are copied.\n * - An `Error` becomes an `Error` of its standard type (a custom name or\n * `AggregateError` becomes `Error`), with its own `message`, its `stack`\n * and its own `cause`. A `DOMException` stays one where the global exists.\n * - A `SharedArrayBuffer` is shared, not copied, like `structuredClone`.\n * - Cycles and shared references are kept: an object reached twice is\n * copied once.\n * - Functions, symbols, `Symbol` wrappers, `arguments`, `WeakMap`,\n * `WeakSet`, `WeakRef`, `Promise`, iterators, generators and the web\n * platform objects that cannot be cloned (`URL`, `Headers`, streams...)\n * throw an error named `\"DataCloneError\"`: a `DOMException` where the\n * global exists, else an `Error` (Hermes has no `DOMException`).\n *\n * Two differences are left. A `Proxy` cannot be told from its target in\n * JavaScript, so the local copy reads it through its traps, where the\n * native one throws. And an ordinary object takes a fast path that runs no\n * brand check (each failed one throws and catches an exception, slow on\n * Hermes), so a `Map`, `Set`, `Promise` or other object whose prototype\n * was changed to `Object.prototype` or `null` is copied as a plain object.\n *\n * It never installs a global `structuredClone`, and it does not use the\n * JSON round trip of `structuredClone_` from `@ag-ui/client`, which turns\n * `undefined` into `{}` and drops or changes values JSON cannot hold.\n *\n * @param value - The value to copy.\n * @returns A copy that shares no object with `value`, except a\n * `SharedArrayBuffer`.\n * @throws An error named `\"DataCloneError\"` for a value that cannot be\n * cloned.\n */\nexport function cloneValue<T>(value: T): T {\n const native = (globalThis as { structuredClone?: <V>(value: V) => V })\n .structuredClone;\n if (typeof native === \"function\") return native(value);\n return cloneInto(value, new Map()) as T;\n}\n\ntype AnyFunction = (this: unknown, ...args: unknown[]) => unknown;\ntype Constructor = new (...args: unknown[]) => unknown;\n\n/** A global, or `undefined` when this engine does not have it. */\nfunction globalNamed<T = Constructor>(name: string): T | undefined {\n return (globalThis as unknown as Record<string, T | undefined>)[name];\n}\n\n/** True when `method` accepts `value` as its `this`: a brand check. */\nfunction hasBrand(\n value: object,\n method: AnyFunction | undefined,\n ...args: unknown[]\n) {\n if (typeof method !== \"function\") return false;\n try {\n method.call(value, ...args);\n return true;\n } catch {\n return false;\n }\n}\n\n/** The getter of `key` on `proto`, for a brand check. */\nfunction getterOf(proto: object | undefined, key: PropertyKey) {\n if (!proto) return undefined;\n return Object.getOwnPropertyDescriptor(proto, key)?.get as\n | AnyFunction\n | undefined;\n}\n\nfunction protoOf(name: string): object | undefined {\n return (globalNamed<{ prototype?: object }>(name) ?? {}).prototype;\n}\n\nfunction methodOf(name: string, key: string): AnyFunction | undefined {\n const proto = protoOf(name) as Record<string, AnyFunction> | undefined;\n return proto?.[key];\n}\n\nconst ERROR_NAMES = new Set([\n \"Error\",\n \"EvalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\",\n]);\n\n/** Web platform objects that `structuredClone` refuses, where they exist. */\nconst PLATFORM_UNCLONEABLE = [\n \"URL\",\n \"URLSearchParams\",\n \"Headers\",\n \"Request\",\n \"Response\",\n \"FormData\",\n \"ReadableStream\",\n \"WritableStream\",\n \"TransformStream\",\n \"MessagePort\",\n];\n\nfunction* emptyGenerator() {\n // Only its prototype chain is used.\n}\n\n/** The prototypes of the built-in iterators and generators. */\nfunction iteratorPrototypes(): object[] {\n const protos: object[] = [];\n const add = (iterator: unknown) => {\n const proto = iterator && Object.getPrototypeOf(iterator);\n if (proto) protos.push(proto);\n };\n add([][Symbol.iterator]());\n add(new Map()[Symbol.iterator]());\n add(new Set()[Symbol.iterator]());\n add(\"\"[Symbol.iterator]());\n // The prototype of a generator object is its function's own `prototype`;\n // the shared one is above it.\n protos.push(Object.getPrototypeOf(emptyGenerator.prototype) as object);\n const matchAllKey = (Symbol as unknown as Record<string, symbol | undefined>)\n .matchAll;\n const matchAll = matchAllKey\n ? (RegExp.prototype as unknown as Record<symbol, AnyFunction | undefined>)[\n matchAllKey\n ]\n : undefined;\n if (typeof matchAll === \"function\") add(matchAll.call(/a/g, \"\"));\n return protos;\n}\n\nlet iteratorProtos: object[] | undefined;\n\nfunction inheritsFrom(value: object, protos: readonly object[]) {\n for (\n let proto = Object.getPrototypeOf(value);\n proto !== null;\n proto = Object.getPrototypeOf(proto)\n ) {\n if (protos.includes(proto)) return true;\n }\n return false;\n}\n\nfunction dataCloneError(what: string): Error {\n const message = `${what} could not be cloned.`;\n const DOMExceptionClass =\n globalNamed<new (message: string, name: string) => Error>(\"DOMException\");\n if (typeof DOMExceptionClass === \"function\") {\n return new DOMExceptionClass(message, \"DataCloneError\");\n }\n const error = new Error(message);\n error.name = \"DataCloneError\";\n return error;\n}\n\nfunction describe(value: unknown): string {\n if (typeof value === \"function\") {\n return value.name ? `function ${value.name}` : \"A function\";\n }\n if (typeof value === \"symbol\") return String(value);\n return Object.prototype.toString.call(value);\n}\n\n/** True for an object with the [[ErrorData]] slot. */\nfunction isError(value: object) {\n const isErrorCheck = (Error as unknown as { isError?: AnyFunction }).isError;\n if (typeof isErrorCheck === \"function\") {\n return isErrorCheck.call(Error, value) === true;\n }\n // Without Error.isError the built-in tag shows the slot, unless a\n // Symbol.toStringTag hides it (a DOMException has one).\n if (!(Symbol.toStringTag in value)) {\n return Object.prototype.toString.call(value) === \"[object Error]\";\n }\n return value instanceof Error;\n}\n\nfunction isDOMException(value: object) {\n return hasBrand(value, getterOf(protoOf(\"DOMException\"), \"code\"));\n}\n\n/** The name of the base typed-array type of a view, or `undefined`. */\nfunction typedArrayName(value: object): string | undefined {\n const TypedArrayProto = Object.getPrototypeOf(Uint8Array.prototype) as object;\n const getter = getterOf(TypedArrayProto, Symbol.toStringTag);\n if (!getter) return undefined;\n const name = getter.call(value);\n return typeof name === \"string\" ? name : undefined;\n}\n\nfunction cloneArrayBuffer(value: ArrayBuffer): ArrayBuffer {\n const source = value as ArrayBuffer & {\n resizable?: boolean;\n maxByteLength?: number;\n };\n if (source.resizable === true) {\n const ArrayBufferClass = ArrayBuffer as unknown as new (\n length: number,\n options: { maxByteLength: number },\n ) => ArrayBuffer;\n const copy = new ArrayBufferClass(source.byteLength, {\n maxByteLength: source.maxByteLength as number,\n });\n new Uint8Array(copy).set(new Uint8Array(source));\n return copy;\n }\n return ArrayBuffer.prototype.slice.call(value, 0) as ArrayBuffer;\n}\n\nfunction cloneError(value: Error, seen: Map<object, unknown>): Error {\n let copy: Error;\n const own = (key: string) => Object.prototype.hasOwnProperty.call(value, key);\n const messageDescriptor = Object.getOwnPropertyDescriptor(value, \"message\");\n const message =\n messageDescriptor && \"value\" in messageDescriptor\n ? `${messageDescriptor.value}`\n : undefined;\n if (isDOMException(value)) {\n const DOMExceptionClass =\n globalNamed<new (message?: string, name?: string) => Error>(\n \"DOMException\",\n )!;\n copy = new DOMExceptionClass(value.message, value.name);\n } else {\n const name = ERROR_NAMES.has(value.name) ? value.name : \"Error\";\n const ErrorClass = globalNamed<ErrorConstructor>(name) ?? Error;\n copy = message === undefined ? new ErrorClass() : new ErrorClass(message);\n }\n seen.set(value, copy);\n if (typeof value.stack === \"string\") copy.stack = value.stack;\n if (!isDOMException(value)) {\n const causeDescriptor = Object.getOwnPropertyDescriptor(value, \"cause\");\n if (own(\"cause\") && causeDescriptor && \"value\" in causeDescriptor) {\n // Defined, not passed as an option: Hermes may not read ErrorOptions.\n Object.defineProperty(copy, \"cause\", {\n value: cloneInto(causeDescriptor.value, seen),\n writable: true,\n enumerable: false,\n configurable: true,\n });\n }\n }\n return copy;\n}\n\nfunction cloneInto(value: unknown, seen: Map<object, unknown>): unknown {\n if (typeof value === \"function\" || typeof value === \"symbol\") {\n throw dataCloneError(describe(value));\n }\n if (typeof value !== \"object\" || value === null) return value;\n const known = seen.get(value);\n if (known !== undefined) return known;\n\n if (Array.isArray(value)) {\n // The same length, so a sparse array keeps its holes.\n const copy: unknown[] = [];\n copy.length = value.length;\n seen.set(value, copy);\n copyKeys(value, copy, seen);\n return copy;\n }\n // The common case, before the brand checks below: each one that fails\n // throws and catches an exception, which is slow on Hermes.\n if (isPlainObject(value)) {\n const copy: Record<string, unknown> = {};\n seen.set(value, copy);\n copyKeys(value, copy, seen);\n return copy;\n }\n if (hasBrand(value, Date.prototype.getTime as AnyFunction)) {\n const copy = new Date(Date.prototype.getTime.call(value));\n seen.set(value, copy);\n return copy;\n }\n if (hasBrand(value, getterOf(RegExp.prototype, \"source\"))) {\n const source = getterOf(RegExp.prototype, \"source\")!.call(value) as string;\n const flags = getterOf(RegExp.prototype, \"flags\")!.call(value) as string;\n const copy = new RegExp(source, flags);\n seen.set(value, copy);\n return copy;\n }\n if (hasBrand(value, Map.prototype.has as AnyFunction, undefined)) {\n const copy = new Map<unknown, unknown>();\n seen.set(value, copy);\n const entries: [unknown, unknown][] = [];\n Map.prototype.forEach.call(value, (entry: unknown, key: unknown) => {\n entries.push([key, entry]);\n });\n for (const [key, entry] of entries) {\n copy.set(cloneInto(key, seen), cloneInto(entry, seen));\n }\n return copy;\n }\n if (hasBrand(value, Set.prototype.has as AnyFunction, undefined)) {\n const copy = new Set<unknown>();\n seen.set(value, copy);\n const entries: unknown[] = [];\n Set.prototype.forEach.call(value, (entry: unknown) => {\n entries.push(entry);\n });\n for (const entry of entries) copy.add(cloneInto(entry, seen));\n return copy;\n }\n if (hasBrand(value, getterOf(ArrayBuffer.prototype, \"byteLength\"))) {\n const copy = cloneArrayBuffer(value as ArrayBuffer);\n seen.set(value, copy);\n return copy;\n }\n if (hasBrand(value, getterOf(protoOf(\"SharedArrayBuffer\"), \"byteLength\"))) {\n // structuredClone shares the memory of a SharedArrayBuffer.\n seen.set(value, value);\n return value;\n }\n if (ArrayBuffer.isView(value)) {\n const view = value as ArrayBufferView;\n const buffer = cloneInto(view.buffer, seen) as ArrayBuffer;\n const isDataView = hasBrand(\n value,\n getterOf(DataView.prototype, \"byteLength\"),\n );\n let copy: ArrayBufferView;\n if (isDataView) {\n copy = new DataView(buffer, view.byteOffset, view.byteLength);\n } else {\n const name = typedArrayName(value);\n const TypedArray = name\n ? globalNamed<\n new (\n buffer: ArrayBuffer,\n byteOffset: number,\n length: number,\n ) => ArrayBufferView\n >(name)\n : undefined;\n if (!TypedArray) throw dataCloneError(describe(value));\n const proto = Object.getPrototypeOf(Uint8Array.prototype) as object;\n const offset = getterOf(proto, \"byteOffset\")!.call(value) as number;\n const length = getterOf(proto, \"length\")!.call(value) as number;\n copy = new TypedArray(buffer, offset, length);\n }\n seen.set(value, copy);\n return copy;\n }\n if (isError(value)) return cloneError(value as Error, seen);\n\n for (const [name, Boxed] of [\n [\"Boolean\", Boolean],\n [\"Number\", Number],\n [\"String\", String],\n [\"BigInt\", globalNamed(\"BigInt\")],\n ] as const) {\n const valueOf = methodOf(name, \"valueOf\");\n if (Boxed && hasBrand(value, valueOf)) {\n const copy = Object(valueOf!.call(value));\n seen.set(value, copy);\n return copy;\n }\n }\n if (hasBrand(value, methodOf(\"Symbol\", \"valueOf\"))) {\n throw dataCloneError(describe(value));\n }\n const BlobClass = globalNamed<{ prototype: Blob }>(\"Blob\");\n if (typeof BlobClass === \"function\" && value instanceof BlobClass) {\n const copy = cloneBlob(value as Blob);\n seen.set(value, copy);\n return copy;\n }\n if (isUncloneable(value)) throw dataCloneError(describe(value));\n\n const copy: Record<string, unknown> = {};\n seen.set(value, copy);\n copyKeys(value, copy, seen);\n return copy;\n}\n\nfunction cloneBlob(value: Blob): Blob {\n const FileClass =\n globalNamed<\n new (\n parts: Blob[],\n name: string,\n options: { type: string; lastModified: number },\n ) => Blob\n >(\"File\");\n if (typeof FileClass === \"function\" && value instanceof FileClass) {\n const file = value as Blob & { name: string; lastModified: number };\n return new FileClass([value], file.name, {\n type: value.type,\n lastModified: file.lastModified,\n });\n }\n const BlobClass =\n globalNamed<new (parts: Blob[], options: { type: string }) => Blob>(\n \"Blob\",\n )!;\n return new BlobClass([value], { type: value.type });\n}\n\n/**\n * True for an ordinary object of this realm: its prototype is\n * `Object.prototype` or `null`, it has no `Symbol.toStringTag`, and its\n * built-in tag is \"Object\" (so not `arguments`, an `Error`, a `Date`, a\n * `RegExp` or a boxed primitive, whatever their prototype). Throws nothing.\n * An object with another slot (a `Map`, a `Set`, a `Promise`...) whose\n * prototype was changed to one of those passes too; only a brand check,\n * which throws, could tell, so it is copied as a plain object.\n */\nfunction isPlainObject(value: object): boolean {\n const proto = Object.getPrototypeOf(value);\n if (proto !== Object.prototype && proto !== null) return false;\n if (Symbol.toStringTag in value) return false;\n if (ArrayBuffer.isView(value)) return false;\n return Object.prototype.toString.call(value) === \"[object Object]\";\n}\n\n/** The globals of PLATFORM_UNCLONEABLE and their prototypes, when last read. */\nlet platformCache: { classes: unknown[]; protos: object[] } | undefined;\n\n/**\n * The prototypes of the PLATFORM_UNCLONEABLE globals that exist. Kept\n * between calls, and built again only when one of the globals changed (a\n * polyfill installed late).\n */\nfunction platformPrototypes(): object[] {\n const globals = globalThis as unknown as Record<string, unknown>;\n const cached = platformCache;\n if (\n cached &&\n PLATFORM_UNCLONEABLE.every(\n (name, index) => globals[name] === cached.classes[index],\n )\n ) {\n return cached.protos;\n }\n const classes = PLATFORM_UNCLONEABLE.map((name) => globals[name]);\n const protos = PLATFORM_UNCLONEABLE.map(protoOf).filter(\n (proto): proto is object => proto !== undefined,\n );\n platformCache = { classes, protos };\n return protos;\n}\n\n/** An object that structuredClone refuses, though it has no data slot. */\nfunction isUncloneable(value: object) {\n // An arguments object: V8 refuses it. Only the built-in tag says so; an\n // object that only claims the tag is a plain object.\n if (\n !(Symbol.toStringTag in value) &&\n Object.prototype.toString.call(value) === \"[object Arguments]\"\n ) {\n return true;\n }\n if (\n hasBrand(value, methodOf(\"WeakMap\", \"has\"), {}) ||\n hasBrand(value, methodOf(\"WeakSet\", \"has\"), {}) ||\n hasBrand(value, methodOf(\"WeakRef\", \"deref\")) ||\n hasBrand(value, methodOf(\"FinalizationRegistry\", \"unregister\"), {})\n ) {\n return true;\n }\n const PromiseClass = globalNamed<{ prototype: object }>(\"Promise\");\n if (PromiseClass && value instanceof (PromiseClass as unknown as Constructor))\n return true;\n if (!iteratorProtos) iteratorProtos = iteratorPrototypes();\n if (inheritsFrom(value, iteratorProtos)) return true;\n return inheritsFrom(value, platformPrototypes());\n}\n\n/** Copies the own enumerable string keys, as structuredClone does. */\nfunction copyKeys(source: object, target: object, seen: Map<object, unknown>) {\n for (const key of Object.keys(source)) {\n assign(\n target as Record<string, unknown>,\n key,\n cloneInto((source as Record<string, unknown>)[key], seen),\n );\n }\n}\n\n/**\n * Sets an own property. A plain assignment of \"__proto__\" would change the\n * prototype of the copy instead (JSON.parse makes \"__proto__\" an own key).\n */\nfunction assign(target: Record<string, unknown>, key: string, value: unknown) {\n if (key === \"__proto__\") {\n Object.defineProperty(target, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true,\n });\n } else {\n target[key] = value;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,WAAc,OAAa;CACzC,MAAM,SAAU,WACb;AACH,KAAI,OAAO,WAAW,WAAY,QAAO,OAAO,MAAM;AACtD,QAAO,UAAU,uBAAO,IAAI,KAAK,CAAC;;;AAOpC,SAAS,YAA6B,MAA6B;AACjE,QAAQ,WAAwD;;;AAIlE,SAAS,SACP,OACA,QACA,GAAG,MACH;AACA,KAAI,OAAO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,OAAO,UAAU,SAAS,KAAK,MAAM,KAAK,qBAE1C,QAAO;AAET,KACE,SAAS,OAAO,SAAS,WAAW,MAAM,EAAE,EAAE,CAAC,IAC/C,SAAS,OAAO,SAAS,WAAW,MAAM,EAAE,EAAE,CAAC,IAC/C,SAAS,OAAO,SAAS,WAAW,QAAQ,CAAC,IAC7C,SAAS,OAAO,SAAS,wBAAwB,aAAa,EAAE,EAAE,CAAC,CAEnE,QAAO;CAET,MAAM,eAAe,YAAmC,UAAU;AAClE,KAAI,gBAAgB,iBAAkB,aACpC,QAAO;AACT,KAAI,CAAC,eAAgB,kBAAiB,oBAAoB;AAC1D,KAAI,aAAa,OAAO,eAAe,CAAE,QAAO;AAChD,QAAO,aAAa,OAAO,oBAAoB,CAAC;;;AAIlD,SAAS,SAAS,QAAgB,QAAgB,MAA4B;AAC5E,MAAK,MAAM,OAAO,OAAO,KAAK,OAAO,CACnC,QACE,QACA,KACA,UAAW,OAAmC,MAAM,KAAK,CAC1D;;;;;;AAQL,SAAS,OAAO,QAAiC,KAAa,OAAgB;AAC5E,KAAI,QAAQ,YACV,QAAO,eAAe,QAAQ,KAAK;EACjC;EACA,YAAY;EACZ,cAAc;EACd,UAAU;EACX,CAAC;KAEF,QAAO,OAAO"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/generative-ui/clone-value.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A deep copy of `value` with `structuredClone` semantics. Uses the global
|
|
4
|
+
* `structuredClone` when there is one. Hermes (React Native) has none, so
|
|
5
|
+
* there a local copy runs. It decides the kind of an object by the same
|
|
6
|
+
* internal slots that `structuredClone` reads (brand checks), not by
|
|
7
|
+
* `instanceof` or `Symbol.toStringTag`, and gives what the native
|
|
8
|
+
* `structuredClone` of V8 gives:
|
|
9
|
+
*
|
|
10
|
+
* - `undefined`, `null`, strings, booleans, numbers (also `NaN`,
|
|
11
|
+
* `Infinity` and `-0`) and bigints are returned as they are.
|
|
12
|
+
* - Arrays and ordinary objects are copied deeply: own enumerable string
|
|
13
|
+
* keys only, so a class instance, or an object with its own
|
|
14
|
+
* `Symbol.toStringTag`, becomes a plain object. A sparse array keeps its
|
|
15
|
+
* holes and its length.
|
|
16
|
+
* - `Date`, `RegExp`, `Map`, `Set`, boxed primitives, `ArrayBuffer`s (a
|
|
17
|
+
* resizable one stays resizable), typed arrays (as the base type, never a
|
|
18
|
+
* subclass), `DataView`s, `Blob`s and `File`s are copied.
|
|
19
|
+
* - An `Error` becomes an `Error` of its standard type (a custom name or
|
|
20
|
+
* `AggregateError` becomes `Error`), with its own `message`, its `stack`
|
|
21
|
+
* and its own `cause`. A `DOMException` stays one where the global exists.
|
|
22
|
+
* - A `SharedArrayBuffer` is shared, not copied, like `structuredClone`.
|
|
23
|
+
* - Cycles and shared references are kept: an object reached twice is
|
|
24
|
+
* copied once.
|
|
25
|
+
* - Functions, symbols, `Symbol` wrappers, `arguments`, `WeakMap`,
|
|
26
|
+
* `WeakSet`, `WeakRef`, `Promise`, iterators, generators and the web
|
|
27
|
+
* platform objects that cannot be cloned (`URL`, `Headers`, streams...)
|
|
28
|
+
* throw an error named `"DataCloneError"`: a `DOMException` where the
|
|
29
|
+
* global exists, else an `Error` (Hermes has no `DOMException`).
|
|
30
|
+
*
|
|
31
|
+
* Two differences are left. A `Proxy` cannot be told from its target in
|
|
32
|
+
* JavaScript, so the local copy reads it through its traps, where the
|
|
33
|
+
* native one throws. And an ordinary object takes a fast path that runs no
|
|
34
|
+
* brand check (each failed one throws and catches an exception, slow on
|
|
35
|
+
* Hermes), so a `Map`, `Set`, `Promise` or other object whose prototype
|
|
36
|
+
* was changed to `Object.prototype` or `null` is copied as a plain object.
|
|
37
|
+
*
|
|
38
|
+
* It never installs a global `structuredClone`, and it does not use the
|
|
39
|
+
* JSON round trip of `structuredClone_` from `@ag-ui/client`, which turns
|
|
40
|
+
* `undefined` into `{}` and drops or changes values JSON cannot hold.
|
|
41
|
+
*
|
|
42
|
+
* @param value - The value to copy.
|
|
43
|
+
* @returns A copy that shares no object with `value`, except a
|
|
44
|
+
* `SharedArrayBuffer`.
|
|
45
|
+
* @throws An error named `"DataCloneError"` for a value that cannot be
|
|
46
|
+
* cloned.
|
|
47
|
+
*/
|
|
48
|
+
declare function cloneValue<T>(value: T): T;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { cloneValue };
|
|
51
|
+
//# sourceMappingURL=clone-value.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone-value.d.cts","names":[],"sources":["../../src/generative-ui/clone-value.ts"],"mappings":";;AA8CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,UAAA,GAAA,CAAc,KAAA,EAAO,CAAA,GAAI,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/generative-ui/clone-value.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A deep copy of `value` with `structuredClone` semantics. Uses the global
|
|
4
|
+
* `structuredClone` when there is one. Hermes (React Native) has none, so
|
|
5
|
+
* there a local copy runs. It decides the kind of an object by the same
|
|
6
|
+
* internal slots that `structuredClone` reads (brand checks), not by
|
|
7
|
+
* `instanceof` or `Symbol.toStringTag`, and gives what the native
|
|
8
|
+
* `structuredClone` of V8 gives:
|
|
9
|
+
*
|
|
10
|
+
* - `undefined`, `null`, strings, booleans, numbers (also `NaN`,
|
|
11
|
+
* `Infinity` and `-0`) and bigints are returned as they are.
|
|
12
|
+
* - Arrays and ordinary objects are copied deeply: own enumerable string
|
|
13
|
+
* keys only, so a class instance, or an object with its own
|
|
14
|
+
* `Symbol.toStringTag`, becomes a plain object. A sparse array keeps its
|
|
15
|
+
* holes and its length.
|
|
16
|
+
* - `Date`, `RegExp`, `Map`, `Set`, boxed primitives, `ArrayBuffer`s (a
|
|
17
|
+
* resizable one stays resizable), typed arrays (as the base type, never a
|
|
18
|
+
* subclass), `DataView`s, `Blob`s and `File`s are copied.
|
|
19
|
+
* - An `Error` becomes an `Error` of its standard type (a custom name or
|
|
20
|
+
* `AggregateError` becomes `Error`), with its own `message`, its `stack`
|
|
21
|
+
* and its own `cause`. A `DOMException` stays one where the global exists.
|
|
22
|
+
* - A `SharedArrayBuffer` is shared, not copied, like `structuredClone`.
|
|
23
|
+
* - Cycles and shared references are kept: an object reached twice is
|
|
24
|
+
* copied once.
|
|
25
|
+
* - Functions, symbols, `Symbol` wrappers, `arguments`, `WeakMap`,
|
|
26
|
+
* `WeakSet`, `WeakRef`, `Promise`, iterators, generators and the web
|
|
27
|
+
* platform objects that cannot be cloned (`URL`, `Headers`, streams...)
|
|
28
|
+
* throw an error named `"DataCloneError"`: a `DOMException` where the
|
|
29
|
+
* global exists, else an `Error` (Hermes has no `DOMException`).
|
|
30
|
+
*
|
|
31
|
+
* Two differences are left. A `Proxy` cannot be told from its target in
|
|
32
|
+
* JavaScript, so the local copy reads it through its traps, where the
|
|
33
|
+
* native one throws. And an ordinary object takes a fast path that runs no
|
|
34
|
+
* brand check (each failed one throws and catches an exception, slow on
|
|
35
|
+
* Hermes), so a `Map`, `Set`, `Promise` or other object whose prototype
|
|
36
|
+
* was changed to `Object.prototype` or `null` is copied as a plain object.
|
|
37
|
+
*
|
|
38
|
+
* It never installs a global `structuredClone`, and it does not use the
|
|
39
|
+
* JSON round trip of `structuredClone_` from `@ag-ui/client`, which turns
|
|
40
|
+
* `undefined` into `{}` and drops or changes values JSON cannot hold.
|
|
41
|
+
*
|
|
42
|
+
* @param value - The value to copy.
|
|
43
|
+
* @returns A copy that shares no object with `value`, except a
|
|
44
|
+
* `SharedArrayBuffer`.
|
|
45
|
+
* @throws An error named `"DataCloneError"` for a value that cannot be
|
|
46
|
+
* cloned.
|
|
47
|
+
*/
|
|
48
|
+
declare function cloneValue<T>(value: T): T;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { cloneValue };
|
|
51
|
+
//# sourceMappingURL=clone-value.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone-value.d.mts","names":[],"sources":["../../src/generative-ui/clone-value.ts"],"mappings":";;AA8CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,UAAA,GAAA,CAAc,KAAA,EAAO,CAAA,GAAI,CAAA"}
|