yummies 7.10.0 → 7.12.0
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/async.cjs +162 -48
- package/async.cjs.map +1 -1
- package/async.d.ts +112 -13
- package/async.js +163 -54
- package/async.js.map +1 -1
- package/chunk-CVq3Gv4J.cjs +50 -0
- package/chunk-YKewjYmz.js +37 -0
- package/common.cjs +48 -8
- package/common.cjs.map +1 -1
- package/common.d.ts +35 -2
- package/common.js +49 -11
- package/common.js.map +1 -1
- package/complex.cjs +275 -104
- package/complex.cjs.map +1 -1
- package/complex.d.ts +133 -13
- package/complex.js +275 -109
- package/complex.js.map +1 -1
- package/cookie.cjs +17 -7
- package/cookie.cjs.map +1 -1
- package/cookie.d.ts +8 -0
- package/cookie.js +18 -9
- package/cookie.js.map +1 -1
- package/css.cjs +147 -39
- package/css.cjs.map +1 -1
- package/css.d.ts +98 -6
- package/css.js +143 -41
- package/css.js.map +1 -1
- package/data.cjs +90 -55
- package/data.cjs.map +1 -1
- package/data.d.ts +32 -0
- package/data.js +91 -61
- package/data.js.map +1 -1
- package/date-time.cjs +578 -412
- package/date-time.cjs.map +1 -1
- package/date-time.d.ts +88 -0
- package/date-time.js +575 -421
- package/date-time.js.map +1 -1
- package/device.cjs +48 -23
- package/device.cjs.map +1 -1
- package/device.d.ts +32 -0
- package/device.js +49 -31
- package/device.js.map +1 -1
- package/encodings.cjs +275 -266
- package/encodings.cjs.map +1 -1
- package/encodings.d.ts +8 -0
- package/encodings.js +276 -268
- package/encodings.js.map +1 -1
- package/errors.cjs +20 -18
- package/errors.cjs.map +1 -1
- package/errors.js +19 -19
- package/errors.js.map +1 -1
- package/file.cjs +42 -24
- package/file.cjs.map +1 -1
- package/file.d.ts +16 -0
- package/file.js +43 -27
- package/file.js.map +1 -1
- package/format.cjs +125 -83
- package/format.cjs.map +1 -1
- package/format.d.ts +89 -4
- package/format.js +118 -82
- package/format.js.map +1 -1
- package/html.cjs +226 -137
- package/html.cjs.map +1 -1
- package/html.d.ts +67 -3
- package/html.js +223 -150
- package/html.js.map +1 -1
- package/id.cjs +74 -17
- package/id.cjs.map +1 -1
- package/id.d.ts +10 -10
- package/id.js +73 -24
- package/id.js.map +1 -1
- package/imports.cjs +41 -29
- package/imports.cjs.map +1 -1
- package/imports.d.ts +13 -4
- package/imports.js +40 -31
- package/imports.js.map +1 -1
- package/math.cjs +32 -6
- package/math.cjs.map +1 -1
- package/math.d.ts +17 -1
- package/math.js +33 -10
- package/math.js.map +1 -1
- package/media.cjs +275 -84
- package/media.cjs.map +1 -1
- package/media.d.ts +188 -2
- package/media.js +274 -93
- package/media.js.map +1 -1
- package/mobx.cjs +353 -193
- package/mobx.cjs.map +1 -1
- package/mobx.d.ts +172 -6
- package/mobx.js +351 -200
- package/mobx.js.map +1 -1
- package/ms.cjs +21 -10
- package/ms.cjs.map +1 -1
- package/ms.d.ts +1 -1
- package/ms.js +22 -13
- package/ms.js.map +1 -1
- package/number.cjs +13 -7
- package/number.cjs.map +1 -1
- package/number.js +14 -9
- package/number.js.map +1 -1
- package/package.json +13 -5
- package/parser.cjs +117 -64
- package/parser.cjs.map +1 -1
- package/parser.d.ts +63 -0
- package/parser.js +111 -64
- package/parser.js.map +1 -1
- package/price.cjs +24 -18
- package/price.cjs.map +1 -1
- package/price.d.ts +8 -0
- package/price.js +25 -20
- package/price.js.map +1 -1
- package/random.cjs +79 -13
- package/random.cjs.map +1 -1
- package/random.d.ts +64 -0
- package/random.js +80 -22
- package/random.js.map +1 -1
- package/react.cjs +673 -214
- package/react.cjs.map +1 -1
- package/react.d.ts +428 -9
- package/react.js +674 -239
- package/react.js.map +1 -1
- package/sound.cjs +14 -9
- package/sound.cjs.map +1 -1
- package/sound.d.ts +1 -1
- package/sound.js +15 -11
- package/sound.js.map +1 -1
- package/storage.cjs +49 -50
- package/storage.cjs.map +1 -1
- package/storage.d.ts +15 -6
- package/storage.js +50 -53
- package/storage.js.map +1 -1
- package/text.cjs +51 -34
- package/text.cjs.map +1 -1
- package/text.d.ts +5 -5
- package/text.js +52 -37
- package/text.js.map +1 -1
- package/type-guard.cjs +292 -72
- package/type-guard.cjs.map +1 -1
- package/type-guard.d.ts +199 -42
- package/type-guard.js +288 -73
- package/type-guard.js.map +1 -1
- package/types.cjs +0 -2
- package/types.global.cjs +0 -2
- package/types.global.js +0 -2
- package/types.js +0 -2
- package/vibrate.cjs +31 -6
- package/vibrate.cjs.map +1 -1
- package/vibrate.d.ts +23 -1
- package/vibrate.js +32 -8
- package/vibrate.js.map +1 -1
- package/types.cjs.map +0 -1
- package/types.global.cjs.map +0 -1
- package/types.global.js.map +0 -1
- package/types.js.map +0 -1
package/mobx.d.ts
CHANGED
|
@@ -5,14 +5,51 @@ type ObservableAnnotationsArray<T extends AnyObject = AnyObject> = [
|
|
|
5
5
|
AnnotationMapEntry,
|
|
6
6
|
...(keyof T | (string & {}))[]
|
|
7
7
|
][];
|
|
8
|
+
/**
|
|
9
|
+
* Applies a compact list of MobX annotations to an object using either
|
|
10
|
+
* decorator-style invocation or the annotation map form accepted by `makeObservable`.
|
|
11
|
+
*
|
|
12
|
+
* @template T Target object type.
|
|
13
|
+
* @param context Object that should become observable.
|
|
14
|
+
* @param annotationsArray Tuples of annotation followed by annotated field names.
|
|
15
|
+
* @param useDecorators Enables decorator-style application before calling `makeObservable`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* applyObservable(store, [[observable, 'items'], [action, 'setItems']]);
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* applyObservable(viewModel, [[computed, 'fullName']], true);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
8
27
|
declare const applyObservable: <T extends AnyObject>(context: T, annotationsArray: ObservableAnnotationsArray<T>, useDecorators?: boolean) => void;
|
|
9
28
|
|
|
10
29
|
interface IEnhancedAtom<TMeta extends AnyObject = AnyObject> extends IAtom {
|
|
11
30
|
meta: TMeta;
|
|
12
31
|
}
|
|
13
32
|
/**
|
|
14
|
-
* Creates
|
|
15
|
-
*
|
|
33
|
+
* Creates a MobX atom extended with metadata and bound reporting methods.
|
|
34
|
+
*
|
|
35
|
+
* @template TMeta Metadata object stored on the atom.
|
|
36
|
+
* @param name Atom name used by MobX for debugging.
|
|
37
|
+
* @param onBecomeObservedHandler Callback fired when the atom becomes observed.
|
|
38
|
+
* @param onBecomeUnobservedHandler Callback fired when the atom is no longer observed.
|
|
39
|
+
* @param meta Optional metadata attached to the atom.
|
|
40
|
+
* @returns Atom instance with `meta`, `reportChanged` and `reportObserved`.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const atom = createEnhancedAtom('user-status');
|
|
45
|
+
* atom.reportChanged();
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const atom = createEnhancedAtom('cache', undefined, undefined, { scope: 'users' });
|
|
51
|
+
* atom.meta.scope;
|
|
52
|
+
* ```
|
|
16
53
|
*/
|
|
17
54
|
declare const createEnhancedAtom: <TMeta extends AnyObject>(name: string, onBecomeObservedHandler?: (atom: IEnhancedAtom<TMeta>) => void, onBecomeUnobservedHandler?: (atom: IEnhancedAtom<TMeta>) => void, meta?: TMeta) => IEnhancedAtom<TMeta>;
|
|
18
55
|
|
|
@@ -43,12 +80,97 @@ interface CreateRefConfig<T = any, TMeta = AnyObject> {
|
|
|
43
80
|
comparer?: IEqualsComparer<T | null>;
|
|
44
81
|
}
|
|
45
82
|
/**
|
|
46
|
-
* Creates ref
|
|
83
|
+
* Creates a MobX-aware ref that behaves like a callback ref and exposes
|
|
84
|
+
* observable `current` and `meta` fields.
|
|
85
|
+
*
|
|
86
|
+
* @template T Referenced value type.
|
|
87
|
+
* @template TMeta Additional observable metadata stored on the ref.
|
|
88
|
+
* @param cfg Optional callbacks, initial value and comparer configuration.
|
|
89
|
+
* @returns Observable ref function object.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const inputRef = createRef<HTMLInputElement>();
|
|
94
|
+
* inputRef.set(document.createElement('input'));
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const ref = createRef<number>();
|
|
100
|
+
* ref(3);
|
|
101
|
+
* ref.current; // 3
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* const nodeRef = createRef({
|
|
107
|
+
* onUnset: () => console.log('detached'),
|
|
108
|
+
* meta: { mounted: false },
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
47
111
|
*/
|
|
48
112
|
declare const createRef: <T = any, TMeta = AnyObject>(cfg?: CreateRefConfig<T, TMeta>) => Ref<T, TMeta>;
|
|
113
|
+
/**
|
|
114
|
+
* Checks whether the provided value is a ref created by `createRef`.
|
|
115
|
+
*
|
|
116
|
+
* @template T Referenced value type.
|
|
117
|
+
* @template TMeta Ref metadata type.
|
|
118
|
+
* @param value Value to inspect.
|
|
119
|
+
* @returns `true` when the value is a ref-like function with `current`.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* const ref = createRef<number>();
|
|
124
|
+
* isRef(ref); // true
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* isRef({ current: 1 }); // false
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
49
132
|
declare const isRef: <T, TMeta = any>(value: T | Ref<T, TMeta>) => value is Ref<T, TMeta>;
|
|
133
|
+
/**
|
|
134
|
+
* Normalizes a plain value or an existing ref into a `Ref` instance.
|
|
135
|
+
*
|
|
136
|
+
* @template T Referenced value type.
|
|
137
|
+
* @template TMeta Ref metadata type.
|
|
138
|
+
* @param value Existing ref or initial plain value.
|
|
139
|
+
* @param cfg Optional ref configuration applied when a new ref is created.
|
|
140
|
+
* @returns Existing ref or a newly created ref initialized with `value`.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* const ref = toRef(document.body);
|
|
145
|
+
* ref.current === document.body;
|
|
146
|
+
* ```
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* const existingRef = createRef<number>();
|
|
151
|
+
* const sameRef = toRef(existingRef);
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
50
154
|
declare const toRef: <T, TMeta = any>(value: T | Ref<T, TMeta>, cfg?: Omit<CreateRefConfig<T, TMeta>, "initial">) => Ref<T, TMeta>;
|
|
51
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Wraps a plain object into a deeply observable structure and allows
|
|
158
|
+
* patch-like updates while preserving nested observable references where possible.
|
|
159
|
+
*
|
|
160
|
+
* @template TData Observable object shape.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* const state = new DeepObservableStruct({ user: { name: 'Ann' } });
|
|
165
|
+
* state.set({ user: { name: 'Bob' } });
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* const state = new DeepObservableStruct({ filters: { active: true } });
|
|
171
|
+
* state.set({ filters: { active: false, archived: true } });
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
52
174
|
declare class DeepObservableStruct<TData extends AnyObject> {
|
|
53
175
|
data: TData;
|
|
54
176
|
constructor(data: TData);
|
|
@@ -56,13 +178,57 @@ declare class DeepObservableStruct<TData extends AnyObject> {
|
|
|
56
178
|
}
|
|
57
179
|
|
|
58
180
|
type ObservableObjectAdministration = Parameters<Exclude<AnnotationMapEntry, boolean>['make_']>[0];
|
|
181
|
+
/**
|
|
182
|
+
* Returns the internal MobX administration object associated with an observable target.
|
|
183
|
+
*
|
|
184
|
+
* @param context Observable object instance.
|
|
185
|
+
* @returns MobX administration internals stored under `$mobx`.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* const admin = getMobxAdministration(store);
|
|
190
|
+
* admin.name_;
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```ts
|
|
195
|
+
* const values = getMobxAdministration(formState).values_;
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
59
198
|
declare const getMobxAdministration: (context: AnyObject) => ObservableObjectAdministration;
|
|
60
199
|
|
|
61
200
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
201
|
+
* Starts side effects only while one or more MobX observables are being observed.
|
|
202
|
+
*
|
|
203
|
+
* When the first property becomes observed, `onStart` is called. When all tracked
|
|
204
|
+
* properties become unobserved, `onEnd` is called with the value returned by
|
|
205
|
+
* `onStart`. Cleanup can be delayed via `endDelay`.
|
|
206
|
+
*
|
|
207
|
+
* It uses MobX `onBecomeObserved` and `onBecomeUnobserved` hooks to perform
|
|
208
|
+
* lazy subscription management.
|
|
209
|
+
*
|
|
210
|
+
* @template TMetaData Data returned from `onStart` and forwarded to `onEnd`.
|
|
211
|
+
* @param config Configuration for tracked properties and lifecycle callbacks.
|
|
212
|
+
* @returns Cleanup function that clears the tracked state and runs `onEnd`.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```ts
|
|
216
|
+
* const stop = lazyObserve({
|
|
217
|
+
* context: store,
|
|
218
|
+
* property: 'items',
|
|
219
|
+
* onStart: () => api.subscribe(),
|
|
220
|
+
* onEnd: (subscription) => subscription.unsubscribe(),
|
|
221
|
+
* });
|
|
222
|
+
* ```
|
|
64
223
|
*
|
|
65
|
-
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* lazyObserve({
|
|
227
|
+
* property: [boxA, boxB],
|
|
228
|
+
* onStart: () => console.log('observed'),
|
|
229
|
+
* endDelay: 300,
|
|
230
|
+
* });
|
|
231
|
+
* ```
|
|
66
232
|
*/
|
|
67
233
|
declare const lazyObserve: <TMetaData = void>({ context, property, onStart, onEnd, endDelay, }: {
|
|
68
234
|
context?: any;
|