@teactjs/storage 0.1.0-alpha.6 → 0.1.0-alpha.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.
Files changed (2) hide show
  1. package/dist/index.js +6 -855
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,855 +1,6 @@
1
1
  // @bun
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
17
- };
18
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
-
20
- // ../../node_modules/.bun/react@19.2.4/node_modules/react/cjs/react.development.js
21
- var require_react_development = __commonJS((exports, module) => {
22
- (function() {
23
- function defineDeprecationWarning(methodName, info) {
24
- Object.defineProperty(Component.prototype, methodName, {
25
- get: function() {
26
- console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
27
- }
28
- });
29
- }
30
- function getIteratorFn(maybeIterable) {
31
- if (maybeIterable === null || typeof maybeIterable !== "object")
32
- return null;
33
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
34
- return typeof maybeIterable === "function" ? maybeIterable : null;
35
- }
36
- function warnNoop(publicInstance, callerName) {
37
- publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
38
- var warningKey = publicInstance + "." + callerName;
39
- didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, publicInstance), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
40
- }
41
- function Component(props, context, updater) {
42
- this.props = props;
43
- this.context = context;
44
- this.refs = emptyObject;
45
- this.updater = updater || ReactNoopUpdateQueue;
46
- }
47
- function ComponentDummy() {}
48
- function PureComponent(props, context, updater) {
49
- this.props = props;
50
- this.context = context;
51
- this.refs = emptyObject;
52
- this.updater = updater || ReactNoopUpdateQueue;
53
- }
54
- function noop() {}
55
- function testStringCoercion(value) {
56
- return "" + value;
57
- }
58
- function checkKeyStringCoercion(value) {
59
- try {
60
- testStringCoercion(value);
61
- var JSCompiler_inline_result = false;
62
- } catch (e) {
63
- JSCompiler_inline_result = true;
64
- }
65
- if (JSCompiler_inline_result) {
66
- JSCompiler_inline_result = console;
67
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
68
- var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
69
- JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
70
- return testStringCoercion(value);
71
- }
72
- }
73
- function getComponentNameFromType(type) {
74
- if (type == null)
75
- return null;
76
- if (typeof type === "function")
77
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
78
- if (typeof type === "string")
79
- return type;
80
- switch (type) {
81
- case REACT_FRAGMENT_TYPE:
82
- return "Fragment";
83
- case REACT_PROFILER_TYPE:
84
- return "Profiler";
85
- case REACT_STRICT_MODE_TYPE:
86
- return "StrictMode";
87
- case REACT_SUSPENSE_TYPE:
88
- return "Suspense";
89
- case REACT_SUSPENSE_LIST_TYPE:
90
- return "SuspenseList";
91
- case REACT_ACTIVITY_TYPE:
92
- return "Activity";
93
- }
94
- if (typeof type === "object")
95
- switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
96
- case REACT_PORTAL_TYPE:
97
- return "Portal";
98
- case REACT_CONTEXT_TYPE:
99
- return type.displayName || "Context";
100
- case REACT_CONSUMER_TYPE:
101
- return (type._context.displayName || "Context") + ".Consumer";
102
- case REACT_FORWARD_REF_TYPE:
103
- var innerType = type.render;
104
- type = type.displayName;
105
- type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
106
- return type;
107
- case REACT_MEMO_TYPE:
108
- return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
109
- case REACT_LAZY_TYPE:
110
- innerType = type._payload;
111
- type = type._init;
112
- try {
113
- return getComponentNameFromType(type(innerType));
114
- } catch (x) {}
115
- }
116
- return null;
117
- }
118
- function getTaskName(type) {
119
- if (type === REACT_FRAGMENT_TYPE)
120
- return "<>";
121
- if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
122
- return "<...>";
123
- try {
124
- var name = getComponentNameFromType(type);
125
- return name ? "<" + name + ">" : "<...>";
126
- } catch (x) {
127
- return "<...>";
128
- }
129
- }
130
- function getOwner() {
131
- var dispatcher = ReactSharedInternals.A;
132
- return dispatcher === null ? null : dispatcher.getOwner();
133
- }
134
- function UnknownOwner() {
135
- return Error("react-stack-top-frame");
136
- }
137
- function hasValidKey(config) {
138
- if (hasOwnProperty.call(config, "key")) {
139
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
140
- if (getter && getter.isReactWarning)
141
- return false;
142
- }
143
- return config.key !== undefined;
144
- }
145
- function defineKeyPropWarningGetter(props, displayName) {
146
- function warnAboutAccessingKey() {
147
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
148
- }
149
- warnAboutAccessingKey.isReactWarning = true;
150
- Object.defineProperty(props, "key", {
151
- get: warnAboutAccessingKey,
152
- configurable: true
153
- });
154
- }
155
- function elementRefGetterWithDeprecationWarning() {
156
- var componentName = getComponentNameFromType(this.type);
157
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
158
- componentName = this.props.ref;
159
- return componentName !== undefined ? componentName : null;
160
- }
161
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
162
- var refProp = props.ref;
163
- type = {
164
- $$typeof: REACT_ELEMENT_TYPE,
165
- type,
166
- key,
167
- props,
168
- _owner: owner
169
- };
170
- (refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
171
- enumerable: false,
172
- get: elementRefGetterWithDeprecationWarning
173
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
174
- type._store = {};
175
- Object.defineProperty(type._store, "validated", {
176
- configurable: false,
177
- enumerable: false,
178
- writable: true,
179
- value: 0
180
- });
181
- Object.defineProperty(type, "_debugInfo", {
182
- configurable: false,
183
- enumerable: false,
184
- writable: true,
185
- value: null
186
- });
187
- Object.defineProperty(type, "_debugStack", {
188
- configurable: false,
189
- enumerable: false,
190
- writable: true,
191
- value: debugStack
192
- });
193
- Object.defineProperty(type, "_debugTask", {
194
- configurable: false,
195
- enumerable: false,
196
- writable: true,
197
- value: debugTask
198
- });
199
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
200
- return type;
201
- }
202
- function cloneAndReplaceKey(oldElement, newKey) {
203
- newKey = ReactElement(oldElement.type, newKey, oldElement.props, oldElement._owner, oldElement._debugStack, oldElement._debugTask);
204
- oldElement._store && (newKey._store.validated = oldElement._store.validated);
205
- return newKey;
206
- }
207
- function validateChildKeys(node) {
208
- isValidElement(node) ? node._store && (node._store.validated = 1) : typeof node === "object" && node !== null && node.$$typeof === REACT_LAZY_TYPE && (node._payload.status === "fulfilled" ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
209
- }
210
- function isValidElement(object) {
211
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
212
- }
213
- function escape(key) {
214
- var escaperLookup = { "=": "=0", ":": "=2" };
215
- return "$" + key.replace(/[=:]/g, function(match) {
216
- return escaperLookup[match];
217
- });
218
- }
219
- function getElementKey(element, index) {
220
- return typeof element === "object" && element !== null && element.key != null ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
221
- }
222
- function resolveThenable(thenable) {
223
- switch (thenable.status) {
224
- case "fulfilled":
225
- return thenable.value;
226
- case "rejected":
227
- throw thenable.reason;
228
- default:
229
- switch (typeof thenable.status === "string" ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(function(fulfilledValue) {
230
- thenable.status === "pending" && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
231
- }, function(error) {
232
- thenable.status === "pending" && (thenable.status = "rejected", thenable.reason = error);
233
- })), thenable.status) {
234
- case "fulfilled":
235
- return thenable.value;
236
- case "rejected":
237
- throw thenable.reason;
238
- }
239
- }
240
- throw thenable;
241
- }
242
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
243
- var type = typeof children;
244
- if (type === "undefined" || type === "boolean")
245
- children = null;
246
- var invokeCallback = false;
247
- if (children === null)
248
- invokeCallback = true;
249
- else
250
- switch (type) {
251
- case "bigint":
252
- case "string":
253
- case "number":
254
- invokeCallback = true;
255
- break;
256
- case "object":
257
- switch (children.$$typeof) {
258
- case REACT_ELEMENT_TYPE:
259
- case REACT_PORTAL_TYPE:
260
- invokeCallback = true;
261
- break;
262
- case REACT_LAZY_TYPE:
263
- return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
264
- }
265
- }
266
- if (invokeCallback) {
267
- invokeCallback = children;
268
- callback = callback(invokeCallback);
269
- var childKey = nameSoFar === "" ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
270
- isArrayImpl(callback) ? (escapedPrefix = "", childKey != null && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
271
- return c;
272
- })) : callback != null && (isValidElement(callback) && (callback.key != null && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(callback, escapedPrefix + (callback.key == null || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + childKey), nameSoFar !== "" && invokeCallback != null && isValidElement(invokeCallback) && invokeCallback.key == null && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
273
- return 1;
274
- }
275
- invokeCallback = 0;
276
- childKey = nameSoFar === "" ? "." : nameSoFar + ":";
277
- if (isArrayImpl(children))
278
- for (var i = 0;i < children.length; i++)
279
- nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
280
- else if (i = getIteratorFn(children), typeof i === "function")
281
- for (i === children.entries && (didWarnAboutMaps || console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = true), children = i.call(children), i = 0;!(nameSoFar = children.next()).done; )
282
- nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
283
- else if (type === "object") {
284
- if (typeof children.then === "function")
285
- return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
286
- array = String(children);
287
- throw Error("Objects are not valid as a React child (found: " + (array === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead.");
288
- }
289
- return invokeCallback;
290
- }
291
- function mapChildren(children, func, context) {
292
- if (children == null)
293
- return children;
294
- var result = [], count = 0;
295
- mapIntoArray(children, result, "", "", function(child) {
296
- return func.call(context, child, count++);
297
- });
298
- return result;
299
- }
300
- function lazyInitializer(payload) {
301
- if (payload._status === -1) {
302
- var ioInfo = payload._ioInfo;
303
- ioInfo != null && (ioInfo.start = ioInfo.end = performance.now());
304
- ioInfo = payload._result;
305
- var thenable = ioInfo();
306
- thenable.then(function(moduleObject) {
307
- if (payload._status === 0 || payload._status === -1) {
308
- payload._status = 1;
309
- payload._result = moduleObject;
310
- var _ioInfo = payload._ioInfo;
311
- _ioInfo != null && (_ioInfo.end = performance.now());
312
- thenable.status === undefined && (thenable.status = "fulfilled", thenable.value = moduleObject);
313
- }
314
- }, function(error) {
315
- if (payload._status === 0 || payload._status === -1) {
316
- payload._status = 2;
317
- payload._result = error;
318
- var _ioInfo2 = payload._ioInfo;
319
- _ioInfo2 != null && (_ioInfo2.end = performance.now());
320
- thenable.status === undefined && (thenable.status = "rejected", thenable.reason = error);
321
- }
322
- });
323
- ioInfo = payload._ioInfo;
324
- if (ioInfo != null) {
325
- ioInfo.value = thenable;
326
- var displayName = thenable.displayName;
327
- typeof displayName === "string" && (ioInfo.name = displayName);
328
- }
329
- payload._status === -1 && (payload._status = 0, payload._result = thenable);
330
- }
331
- if (payload._status === 1)
332
- return ioInfo = payload._result, ioInfo === undefined && console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
333
-
334
- Your code should look like:
335
- const MyComponent = lazy(() => import('./MyComponent'))
336
-
337
- Did you accidentally put curly braces around the import?`, ioInfo), "default" in ioInfo || console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
338
-
339
- Your code should look like:
340
- const MyComponent = lazy(() => import('./MyComponent'))`, ioInfo), ioInfo.default;
341
- throw payload._result;
342
- }
343
- function resolveDispatcher() {
344
- var dispatcher = ReactSharedInternals.H;
345
- dispatcher === null && console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
346
- 1. You might have mismatching versions of React and the renderer (such as React DOM)
347
- 2. You might be breaking the Rules of Hooks
348
- 3. You might have more than one copy of React in the same app
349
- See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`);
350
- return dispatcher;
351
- }
352
- function releaseAsyncTransition() {
353
- ReactSharedInternals.asyncTransitions--;
354
- }
355
- function enqueueTask(task) {
356
- if (enqueueTaskImpl === null)
357
- try {
358
- var requireString = ("require" + Math.random()).slice(0, 7);
359
- enqueueTaskImpl = (module && module[requireString]).call(module, "timers").setImmediate;
360
- } catch (_err) {
361
- enqueueTaskImpl = function(callback) {
362
- didWarnAboutMessageChannel === false && (didWarnAboutMessageChannel = true, typeof MessageChannel === "undefined" && console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));
363
- var channel = new MessageChannel;
364
- channel.port1.onmessage = callback;
365
- channel.port2.postMessage(undefined);
366
- };
367
- }
368
- return enqueueTaskImpl(task);
369
- }
370
- function aggregateErrors(errors) {
371
- return 1 < errors.length && typeof AggregateError === "function" ? new AggregateError(errors) : errors[0];
372
- }
373
- function popActScope(prevActQueue, prevActScopeDepth) {
374
- prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
375
- actScopeDepth = prevActScopeDepth;
376
- }
377
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
378
- var queue = ReactSharedInternals.actQueue;
379
- if (queue !== null)
380
- if (queue.length !== 0)
381
- try {
382
- flushActQueue(queue);
383
- enqueueTask(function() {
384
- return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
385
- });
386
- return;
387
- } catch (error) {
388
- ReactSharedInternals.thrownErrors.push(error);
389
- }
390
- else
391
- ReactSharedInternals.actQueue = null;
392
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
393
- }
394
- function flushActQueue(queue) {
395
- if (!isFlushing) {
396
- isFlushing = true;
397
- var i = 0;
398
- try {
399
- for (;i < queue.length; i++) {
400
- var callback = queue[i];
401
- do {
402
- ReactSharedInternals.didUsePromise = false;
403
- var continuation = callback(false);
404
- if (continuation !== null) {
405
- if (ReactSharedInternals.didUsePromise) {
406
- queue[i] = callback;
407
- queue.splice(0, i);
408
- return;
409
- }
410
- callback = continuation;
411
- } else
412
- break;
413
- } while (1);
414
- }
415
- queue.length = 0;
416
- } catch (error) {
417
- queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
418
- } finally {
419
- isFlushing = false;
420
- }
421
- }
422
- }
423
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
424
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
425
- isMounted: function() {
426
- return false;
427
- },
428
- enqueueForceUpdate: function(publicInstance) {
429
- warnNoop(publicInstance, "forceUpdate");
430
- },
431
- enqueueReplaceState: function(publicInstance) {
432
- warnNoop(publicInstance, "replaceState");
433
- },
434
- enqueueSetState: function(publicInstance) {
435
- warnNoop(publicInstance, "setState");
436
- }
437
- }, assign = Object.assign, emptyObject = {};
438
- Object.freeze(emptyObject);
439
- Component.prototype.isReactComponent = {};
440
- Component.prototype.setState = function(partialState, callback) {
441
- if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null)
442
- throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
443
- this.updater.enqueueSetState(this, partialState, callback, "setState");
444
- };
445
- Component.prototype.forceUpdate = function(callback) {
446
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
447
- };
448
- var deprecatedAPIs = {
449
- isMounted: [
450
- "isMounted",
451
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
452
- ],
453
- replaceState: [
454
- "replaceState",
455
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
456
- ]
457
- };
458
- for (fnName in deprecatedAPIs)
459
- deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
460
- ComponentDummy.prototype = Component.prototype;
461
- deprecatedAPIs = PureComponent.prototype = new ComponentDummy;
462
- deprecatedAPIs.constructor = PureComponent;
463
- assign(deprecatedAPIs, Component.prototype);
464
- deprecatedAPIs.isPureReactComponent = true;
465
- var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
466
- H: null,
467
- A: null,
468
- T: null,
469
- S: null,
470
- actQueue: null,
471
- asyncTransitions: 0,
472
- isBatchingLegacy: false,
473
- didScheduleLegacyUpdate: false,
474
- didUsePromise: false,
475
- thrownErrors: [],
476
- getCurrentStack: null,
477
- recentlyCreatedOwnerStacks: 0
478
- }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
479
- return null;
480
- };
481
- deprecatedAPIs = {
482
- react_stack_bottom_frame: function(callStackForError) {
483
- return callStackForError();
484
- }
485
- };
486
- var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
487
- var didWarnAboutElementRef = {};
488
- var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(deprecatedAPIs, UnknownOwner)();
489
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
490
- var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = typeof reportError === "function" ? reportError : function(error) {
491
- if (typeof window === "object" && typeof window.ErrorEvent === "function") {
492
- var event = new window.ErrorEvent("error", {
493
- bubbles: true,
494
- cancelable: true,
495
- message: typeof error === "object" && error !== null && typeof error.message === "string" ? String(error.message) : String(error),
496
- error
497
- });
498
- if (!window.dispatchEvent(event))
499
- return;
500
- } else if (typeof process === "object" && typeof process.emit === "function") {
501
- process.emit("uncaughtException", error);
502
- return;
503
- }
504
- console.error(error);
505
- }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = typeof queueMicrotask === "function" ? function(callback) {
506
- queueMicrotask(function() {
507
- return queueMicrotask(callback);
508
- });
509
- } : enqueueTask;
510
- deprecatedAPIs = Object.freeze({
511
- __proto__: null,
512
- c: function(size) {
513
- return resolveDispatcher().useMemoCache(size);
514
- }
515
- });
516
- var fnName = {
517
- map: mapChildren,
518
- forEach: function(children, forEachFunc, forEachContext) {
519
- mapChildren(children, function() {
520
- forEachFunc.apply(this, arguments);
521
- }, forEachContext);
522
- },
523
- count: function(children) {
524
- var n = 0;
525
- mapChildren(children, function() {
526
- n++;
527
- });
528
- return n;
529
- },
530
- toArray: function(children) {
531
- return mapChildren(children, function(child) {
532
- return child;
533
- }) || [];
534
- },
535
- only: function(children) {
536
- if (!isValidElement(children))
537
- throw Error("React.Children.only expected to receive a single React element child.");
538
- return children;
539
- }
540
- };
541
- exports.Activity = REACT_ACTIVITY_TYPE;
542
- exports.Children = fnName;
543
- exports.Component = Component;
544
- exports.Fragment = REACT_FRAGMENT_TYPE;
545
- exports.Profiler = REACT_PROFILER_TYPE;
546
- exports.PureComponent = PureComponent;
547
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
548
- exports.Suspense = REACT_SUSPENSE_TYPE;
549
- exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
550
- exports.__COMPILER_RUNTIME = deprecatedAPIs;
551
- exports.act = function(callback) {
552
- var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
553
- actScopeDepth++;
554
- var queue = ReactSharedInternals.actQueue = prevActQueue !== null ? prevActQueue : [], didAwaitActCall = false;
555
- try {
556
- var result = callback();
557
- } catch (error) {
558
- ReactSharedInternals.thrownErrors.push(error);
559
- }
560
- if (0 < ReactSharedInternals.thrownErrors.length)
561
- throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
562
- if (result !== null && typeof result === "object" && typeof result.then === "function") {
563
- var thenable = result;
564
- queueSeveralMicrotasks(function() {
565
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
566
- });
567
- return {
568
- then: function(resolve, reject) {
569
- didAwaitActCall = true;
570
- thenable.then(function(returnValue) {
571
- popActScope(prevActQueue, prevActScopeDepth);
572
- if (prevActScopeDepth === 0) {
573
- try {
574
- flushActQueue(queue), enqueueTask(function() {
575
- return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
576
- });
577
- } catch (error$0) {
578
- ReactSharedInternals.thrownErrors.push(error$0);
579
- }
580
- if (0 < ReactSharedInternals.thrownErrors.length) {
581
- var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
582
- ReactSharedInternals.thrownErrors.length = 0;
583
- reject(_thrownError);
584
- }
585
- } else
586
- resolve(returnValue);
587
- }, function(error) {
588
- popActScope(prevActQueue, prevActScopeDepth);
589
- 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
590
- });
591
- }
592
- };
593
- }
594
- var returnValue$jscomp$0 = result;
595
- popActScope(prevActQueue, prevActScopeDepth);
596
- prevActScopeDepth === 0 && (flushActQueue(queue), queue.length !== 0 && queueSeveralMicrotasks(function() {
597
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));
598
- }), ReactSharedInternals.actQueue = null);
599
- if (0 < ReactSharedInternals.thrownErrors.length)
600
- throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
601
- return {
602
- then: function(resolve, reject) {
603
- didAwaitActCall = true;
604
- prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
605
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve, reject);
606
- })) : resolve(returnValue$jscomp$0);
607
- }
608
- };
609
- };
610
- exports.cache = function(fn) {
611
- return function() {
612
- return fn.apply(null, arguments);
613
- };
614
- };
615
- exports.cacheSignal = function() {
616
- return null;
617
- };
618
- exports.captureOwnerStack = function() {
619
- var getCurrentStack = ReactSharedInternals.getCurrentStack;
620
- return getCurrentStack === null ? null : getCurrentStack();
621
- };
622
- exports.cloneElement = function(element, config, children) {
623
- if (element === null || element === undefined)
624
- throw Error("The argument must be a React element, but you passed " + element + ".");
625
- var props = assign({}, element.props), key = element.key, owner = element._owner;
626
- if (config != null) {
627
- var JSCompiler_inline_result;
628
- a: {
629
- if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(config, "ref").get) && JSCompiler_inline_result.isReactWarning) {
630
- JSCompiler_inline_result = false;
631
- break a;
632
- }
633
- JSCompiler_inline_result = config.ref !== undefined;
634
- }
635
- JSCompiler_inline_result && (owner = getOwner());
636
- hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
637
- for (propName in config)
638
- !hasOwnProperty.call(config, propName) || propName === "key" || propName === "__self" || propName === "__source" || propName === "ref" && config.ref === undefined || (props[propName] = config[propName]);
639
- }
640
- var propName = arguments.length - 2;
641
- if (propName === 1)
642
- props.children = children;
643
- else if (1 < propName) {
644
- JSCompiler_inline_result = Array(propName);
645
- for (var i = 0;i < propName; i++)
646
- JSCompiler_inline_result[i] = arguments[i + 2];
647
- props.children = JSCompiler_inline_result;
648
- }
649
- props = ReactElement(element.type, key, props, owner, element._debugStack, element._debugTask);
650
- for (key = 2;key < arguments.length; key++)
651
- validateChildKeys(arguments[key]);
652
- return props;
653
- };
654
- exports.createContext = function(defaultValue) {
655
- defaultValue = {
656
- $$typeof: REACT_CONTEXT_TYPE,
657
- _currentValue: defaultValue,
658
- _currentValue2: defaultValue,
659
- _threadCount: 0,
660
- Provider: null,
661
- Consumer: null
662
- };
663
- defaultValue.Provider = defaultValue;
664
- defaultValue.Consumer = {
665
- $$typeof: REACT_CONSUMER_TYPE,
666
- _context: defaultValue
667
- };
668
- defaultValue._currentRenderer = null;
669
- defaultValue._currentRenderer2 = null;
670
- return defaultValue;
671
- };
672
- exports.createElement = function(type, config, children) {
673
- for (var i = 2;i < arguments.length; i++)
674
- validateChildKeys(arguments[i]);
675
- i = {};
676
- var key = null;
677
- if (config != null)
678
- for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
679
- hasOwnProperty.call(config, propName) && propName !== "key" && propName !== "__self" && propName !== "__source" && (i[propName] = config[propName]);
680
- var childrenLength = arguments.length - 2;
681
- if (childrenLength === 1)
682
- i.children = children;
683
- else if (1 < childrenLength) {
684
- for (var childArray = Array(childrenLength), _i = 0;_i < childrenLength; _i++)
685
- childArray[_i] = arguments[_i + 2];
686
- Object.freeze && Object.freeze(childArray);
687
- i.children = childArray;
688
- }
689
- if (type && type.defaultProps)
690
- for (propName in childrenLength = type.defaultProps, childrenLength)
691
- i[propName] === undefined && (i[propName] = childrenLength[propName]);
692
- key && defineKeyPropWarningGetter(i, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
693
- var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
694
- return ReactElement(type, key, i, getOwner(), propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
695
- };
696
- exports.createRef = function() {
697
- var refObject = { current: null };
698
- Object.seal(refObject);
699
- return refObject;
700
- };
701
- exports.forwardRef = function(render) {
702
- render != null && render.$$typeof === REACT_MEMO_TYPE ? console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).") : typeof render !== "function" ? console.error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render) : render.length !== 0 && render.length !== 2 && console.error("forwardRef render functions accept exactly two parameters: props and ref. %s", render.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
703
- render != null && render.defaultProps != null && console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");
704
- var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
705
- Object.defineProperty(elementType, "displayName", {
706
- enumerable: false,
707
- configurable: true,
708
- get: function() {
709
- return ownName;
710
- },
711
- set: function(name) {
712
- ownName = name;
713
- render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
714
- }
715
- });
716
- return elementType;
717
- };
718
- exports.isValidElement = isValidElement;
719
- exports.lazy = function(ctor) {
720
- ctor = { _status: -1, _result: ctor };
721
- var lazyType = {
722
- $$typeof: REACT_LAZY_TYPE,
723
- _payload: ctor,
724
- _init: lazyInitializer
725
- }, ioInfo = {
726
- name: "lazy",
727
- start: -1,
728
- end: -1,
729
- value: null,
730
- owner: null,
731
- debugStack: Error("react-stack-top-frame"),
732
- debugTask: console.createTask ? console.createTask("lazy()") : null
733
- };
734
- ctor._ioInfo = ioInfo;
735
- lazyType._debugInfo = [{ awaited: ioInfo }];
736
- return lazyType;
737
- };
738
- exports.memo = function(type, compare) {
739
- type == null && console.error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
740
- compare = {
741
- $$typeof: REACT_MEMO_TYPE,
742
- type,
743
- compare: compare === undefined ? null : compare
744
- };
745
- var ownName;
746
- Object.defineProperty(compare, "displayName", {
747
- enumerable: false,
748
- configurable: true,
749
- get: function() {
750
- return ownName;
751
- },
752
- set: function(name) {
753
- ownName = name;
754
- type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
755
- }
756
- });
757
- return compare;
758
- };
759
- exports.startTransition = function(scope) {
760
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
761
- currentTransition._updatedFibers = new Set;
762
- ReactSharedInternals.T = currentTransition;
763
- try {
764
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
765
- onStartTransitionFinish !== null && onStartTransitionFinish(currentTransition, returnValue);
766
- typeof returnValue === "object" && returnValue !== null && typeof returnValue.then === "function" && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
767
- } catch (error) {
768
- reportGlobalError(error);
769
- } finally {
770
- prevTransition === null && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")), prevTransition !== null && currentTransition.types !== null && (prevTransition.types !== null && prevTransition.types !== currentTransition.types && console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
771
- }
772
- };
773
- exports.unstable_useCacheRefresh = function() {
774
- return resolveDispatcher().useCacheRefresh();
775
- };
776
- exports.use = function(usable) {
777
- return resolveDispatcher().use(usable);
778
- };
779
- exports.useActionState = function(action, initialState, permalink) {
780
- return resolveDispatcher().useActionState(action, initialState, permalink);
781
- };
782
- exports.useCallback = function(callback, deps) {
783
- return resolveDispatcher().useCallback(callback, deps);
784
- };
785
- exports.useContext = function(Context) {
786
- var dispatcher = resolveDispatcher();
787
- Context.$$typeof === REACT_CONSUMER_TYPE && console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?");
788
- return dispatcher.useContext(Context);
789
- };
790
- exports.useDebugValue = function(value, formatterFn) {
791
- return resolveDispatcher().useDebugValue(value, formatterFn);
792
- };
793
- exports.useDeferredValue = function(value, initialValue) {
794
- return resolveDispatcher().useDeferredValue(value, initialValue);
795
- };
796
- exports.useEffect = function(create, deps) {
797
- create == null && console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");
798
- return resolveDispatcher().useEffect(create, deps);
799
- };
800
- exports.useEffectEvent = function(callback) {
801
- return resolveDispatcher().useEffectEvent(callback);
802
- };
803
- exports.useId = function() {
804
- return resolveDispatcher().useId();
805
- };
806
- exports.useImperativeHandle = function(ref, create, deps) {
807
- return resolveDispatcher().useImperativeHandle(ref, create, deps);
808
- };
809
- exports.useInsertionEffect = function(create, deps) {
810
- create == null && console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?");
811
- return resolveDispatcher().useInsertionEffect(create, deps);
812
- };
813
- exports.useLayoutEffect = function(create, deps) {
814
- create == null && console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?");
815
- return resolveDispatcher().useLayoutEffect(create, deps);
816
- };
817
- exports.useMemo = function(create, deps) {
818
- return resolveDispatcher().useMemo(create, deps);
819
- };
820
- exports.useOptimistic = function(passthrough, reducer) {
821
- return resolveDispatcher().useOptimistic(passthrough, reducer);
822
- };
823
- exports.useReducer = function(reducer, initialArg, init) {
824
- return resolveDispatcher().useReducer(reducer, initialArg, init);
825
- };
826
- exports.useRef = function(initialValue) {
827
- return resolveDispatcher().useRef(initialValue);
828
- };
829
- exports.useState = function(initialState) {
830
- return resolveDispatcher().useState(initialState);
831
- };
832
- exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
833
- return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
834
- };
835
- exports.useTransition = function() {
836
- return resolveDispatcher().useTransition();
837
- };
838
- exports.version = "19.2.4";
839
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
840
- })();
841
- });
842
-
843
- // ../../node_modules/.bun/react@19.2.4/node_modules/react/index.js
844
- var require_react = __commonJS((exports, module) => {
845
- var react_development = __toESM(require_react_development());
846
- if (false) {} else {
847
- module.exports = react_development;
848
- }
849
- });
850
-
851
2
  // src/plugin.ts
852
- var import_react = __toESM(require_react(), 1);
3
+ import React, { useState, useCallback, useContext, createContext } from "react";
853
4
  import { useChatId, usePlatform } from "@teactjs/runtime";
854
5
 
855
6
  // src/drivers/memory.ts
@@ -941,9 +92,9 @@ class FileDriver {
941
92
  }
942
93
 
943
94
  // src/plugin.ts
944
- var StorageCtx = import_react.createContext(null);
95
+ var StorageCtx = createContext(null);
945
96
  function useDriver() {
946
- const ctx = import_react.useContext(StorageCtx);
97
+ const ctx = useContext(StorageCtx);
947
98
  if (!ctx)
948
99
  throw new Error("useStorage requires the storagePlugin to be registered");
949
100
  return ctx;
@@ -953,11 +104,11 @@ function useStorage(key, defaultValue) {
953
104
  const chatId = useChatId();
954
105
  const platform = usePlatform();
955
106
  const scopedKey = `${platform}:${chatId}:${key}`;
956
- const [value, setValue] = import_react.useState(() => {
107
+ const [value, setValue] = useState(() => {
957
108
  const stored = driver.get(scopedKey);
958
109
  return stored !== undefined ? stored : defaultValue;
959
110
  });
960
- const setAndPersist = import_react.useCallback((next) => {
111
+ const setAndPersist = useCallback((next) => {
961
112
  setValue((prev) => {
962
113
  const resolved = typeof next === "function" ? next(prev) : next;
963
114
  driver.set(scopedKey, resolved);
@@ -980,7 +131,7 @@ function storagePlugin(opts = {}) {
980
131
  }
981
132
  return {
982
133
  name: "teact-storage",
983
- Provider: ({ children }) => import_react.default.createElement(StorageCtx.Provider, { value: driver }, children),
134
+ Provider: ({ children }) => React.createElement(StorageCtx.Provider, { value: driver }, children),
984
135
  onStop: () => {
985
136
  if ("flush" in driver && typeof driver.flush === "function") {
986
137
  driver.flush();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teactjs/storage",
3
- "version": "0.1.0-alpha.6",
3
+ "version": "0.1.0-alpha.8",
4
4
  "description": "Persistent storage plugin for Teact — file-based and in-memory drivers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,12 +13,12 @@
13
13
  },
14
14
  "files": ["dist", "README.md"],
15
15
  "scripts": {
16
- "build": "bun build ./src/index.ts --outdir ./dist --format esm --target bun --external @teactjs/renderer --external @teactjs/react --external @teactjs/runtime --external @teactjs/telegram --external @teactjs/storage && tsc --emitDeclarationOnly --outDir dist --declaration --project tsconfig.build.json"
16
+ "build": "bun build ./src/index.ts --outdir ./dist --format esm --target bun --external react --external react/jsx-runtime --external react/jsx-dev-runtime --external @teactjs/renderer --external @teactjs/react --external @teactjs/runtime --external @teactjs/telegram --external @teactjs/storage && tsc --emitDeclarationOnly --outDir dist --declaration --project tsconfig.build.json"
17
17
  },
18
18
  "dependencies": {},
19
19
  "peerDependencies": {
20
20
  "react": "^18.0.0 || ^19.0.0",
21
- "@teactjs/runtime": "^0.1.0-alpha.6"
21
+ "@teactjs/runtime": "^0.1.0-alpha.8"
22
22
  },
23
23
  "license": "MIT"
24
24
  }