@mmstack/primitives 21.6.0 → 21.6.1
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/package.json
CHANGED
|
@@ -2276,7 +2276,7 @@ type PointerDragState = {
|
|
|
2276
2276
|
/**
|
|
2277
2277
|
* The element the gesture started on: the `handleSelector` match when one is
|
|
2278
2278
|
* set (so a single delegated listener can tell which child started the drag),
|
|
2279
|
-
* otherwise the
|
|
2279
|
+
* otherwise the pressed element itself (`event.target`). `null` when idle.
|
|
2280
2280
|
*/
|
|
2281
2281
|
origin: HTMLElement | null;
|
|
2282
2282
|
/**
|
|
@@ -3491,6 +3491,23 @@ type MaybePromise<T> = T | Promise<T>;
|
|
|
3491
3491
|
* del: (k) => table.delete(k),
|
|
3492
3492
|
* };
|
|
3493
3493
|
* ```
|
|
3494
|
+
*
|
|
3495
|
+
* The backend is also the seam for cross-cutting storage concerns like encryption: wrap any
|
|
3496
|
+
* backend in a decorator (get/set may be async, so WebCrypto fits here — `serialize` is sync
|
|
3497
|
+
* by design and is for shape, not for the storage medium). Versioning and migration still work
|
|
3498
|
+
* because the version envelope is inspected on what the backend RETURNS, i.e. after decryption:
|
|
3499
|
+
*
|
|
3500
|
+
* ```ts
|
|
3501
|
+
* const encrypted = (inner: AsyncStore, cipher: MyCipher): AsyncStore => ({
|
|
3502
|
+
* get: async (k) => {
|
|
3503
|
+
* const raw = await inner.get(k);
|
|
3504
|
+
* return raw === undefined ? undefined : cipher.decrypt(raw);
|
|
3505
|
+
* },
|
|
3506
|
+
* set: async (k, v) => inner.set(k, await cipher.encrypt(v)),
|
|
3507
|
+
* del: (k) => inner.del(k),
|
|
3508
|
+
* });
|
|
3509
|
+
* providePersistedStoreOptions({ store: encrypted(idbKeyval, cipher) });
|
|
3510
|
+
* ```
|
|
3494
3511
|
*/
|
|
3495
3512
|
type AsyncStore = {
|
|
3496
3513
|
get(key: string): MaybePromise<unknown>;
|