@plq/use-persisted-state 1.3.0 → 1.4.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/LICENSE +1 -1
- package/README.md +165 -50
- package/esm/index.d.mts +13 -0
- package/esm/index.mjs +10 -0
- package/esm/storages/browser-storage.d.mts +1 -0
- package/esm/storages/browser-storage.mjs +5 -0
- package/esm/storages/chrome-storage.d.mts +1 -0
- package/esm/storages/chrome-storage.mjs +5 -0
- package/esm/storages/local-storage.d.mts +1 -0
- package/esm/storages/local-storage.mjs +3 -0
- package/esm/storages/session-storage.d.mts +1 -0
- package/esm/storages/session-storage.mjs +3 -0
- package/lib/@types/storage.d.ts.map +1 -1
- package/lib/create-async-persisted-state.d.ts +2 -2
- package/lib/create-async-persisted-state.d.ts.map +1 -1
- package/lib/create-async-persisted-state.js +62 -12
- package/lib/create-async-persisted-state.js.map +1 -1
- package/lib/create-persisted-state.d.ts +2 -2
- package/lib/create-persisted-state.d.ts.map +1 -1
- package/lib/create-persisted-state.js +31 -13
- package/lib/create-persisted-state.js.map +1 -1
- package/lib/index.d.ts +6 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/storages/browser-storage.d.ts +2 -2
- package/lib/storages/browser-storage.d.ts.map +1 -1
- package/lib/storages/browser-storage.js +6 -26
- package/lib/storages/browser-storage.js.map +1 -1
- package/lib/storages/chrome-storage.d.ts +2 -2
- package/lib/storages/chrome-storage.d.ts.map +1 -1
- package/lib/storages/chrome-storage.js +10 -27
- package/lib/storages/chrome-storage.js.map +1 -1
- package/lib/storages/local-storage.d.ts +1 -1
- package/lib/storages/local-storage.d.ts.map +1 -1
- package/lib/storages/local-storage.js +3 -1
- package/lib/storages/local-storage.js.map +1 -1
- package/lib/storages/session-storage.d.ts +1 -1
- package/lib/storages/session-storage.d.ts.map +1 -1
- package/lib/storages/session-storage.js +3 -1
- package/lib/storages/session-storage.js.map +1 -1
- package/lib/utils/change-notifier.d.ts +18 -0
- package/lib/utils/change-notifier.d.ts.map +1 -0
- package/lib/utils/change-notifier.js +38 -0
- package/lib/utils/change-notifier.js.map +1 -0
- package/lib/utils/create-web-storage.d.ts +10 -2
- package/lib/utils/create-web-storage.d.ts.map +1 -1
- package/lib/utils/create-web-storage.js +72 -75
- package/lib/utils/create-web-storage.js.map +1 -1
- package/lib/utils/extension-storage.d.ts +38 -0
- package/lib/utils/extension-storage.d.ts.map +1 -0
- package/lib/utils/extension-storage.js +66 -0
- package/lib/utils/extension-storage.js.map +1 -0
- package/lib/utils/get-new-item.d.ts.map +1 -1
- package/lib/utils/get-new-item.js.map +1 -1
- package/lib/utils/get-new-value.d.ts +1 -1
- package/lib/utils/get-new-value.d.ts.map +1 -1
- package/lib/utils/get-persisted-value.d.ts +8 -1
- package/lib/utils/get-persisted-value.d.ts.map +1 -1
- package/lib/utils/get-persisted-value.js +19 -5
- package/lib/utils/get-persisted-value.js.map +1 -1
- package/lib/utils/is-async-storage.d.ts +7 -0
- package/lib/utils/is-async-storage.d.ts.map +1 -1
- package/lib/utils/is-async-storage.js +51 -20
- package/lib/utils/is-async-storage.js.map +1 -1
- package/lib/utils/storage-event-router.d.ts +17 -0
- package/lib/utils/storage-event-router.d.ts.map +1 -0
- package/lib/utils/storage-event-router.js +54 -0
- package/lib/utils/storage-event-router.js.map +1 -0
- package/lib/utils/use-storage-handler.d.ts +3 -3
- package/lib/utils/use-storage-handler.d.ts.map +1 -1
- package/lib/utils/use-storage-handler.js +80 -26
- package/lib/utils/use-storage-handler.js.map +1 -1
- package/package.json +97 -41
- package/src/@types/storage.ts +13 -13
- package/src/create-async-persisted-state.ts +81 -18
- package/src/create-persisted-state.ts +48 -22
- package/src/index.ts +12 -7
- package/src/storages/browser-storage.ts +8 -36
- package/src/storages/chrome-storage.ts +24 -46
- package/src/storages/local-storage.ts +3 -1
- package/src/storages/session-storage.ts +3 -1
- package/src/utils/change-notifier.ts +43 -0
- package/src/utils/create-web-storage.ts +74 -77
- package/src/utils/extension-storage.ts +79 -0
- package/src/utils/get-new-item.ts +1 -1
- package/src/utils/get-new-value.ts +1 -1
- package/src/utils/get-persisted-value.ts +22 -7
- package/src/utils/is-async-storage.ts +72 -27
- package/src/utils/storage-event-router.ts +67 -0
- package/src/utils/use-storage-handler.ts +112 -36
- package/storages/browser-storage.d.ts +1 -0
- package/storages/browser-storage.js +11 -0
- package/storages/chrome-storage.d.ts +1 -0
- package/storages/chrome-storage.js +11 -0
- package/storages/local-storage.d.ts +1 -0
- package/storages/local-storage.js +9 -0
- package/storages/session-storage.d.ts +1 -0
- package/storages/session-storage.js +9 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Resolution stub for tooling that predates the exports map: TypeScript's
|
|
2
|
+
// node10 resolver and older bundlers look for a real file at this path and
|
|
3
|
+
// would otherwise fail. Node 16+ never reaches this file — the exports map
|
|
4
|
+
// answers first. Each area is re-exported by reference, so both paths hand out
|
|
5
|
+
// the same adapter instance and the listener registry stays single.
|
|
6
|
+
const source = require('../lib/storages/browser-storage.js')
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
9
|
+
exports.local = source.local
|
|
10
|
+
exports.sync = source.sync
|
|
11
|
+
exports.managed = source.managed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { local, sync, managed } from '../lib/storages/chrome-storage'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Resolution stub for tooling that predates the exports map: TypeScript's
|
|
2
|
+
// node10 resolver and older bundlers look for a real file at this path and
|
|
3
|
+
// would otherwise fail. Node 16+ never reaches this file — the exports map
|
|
4
|
+
// answers first. Each area is re-exported by reference, so both paths hand out
|
|
5
|
+
// the same adapter instance and the listener registry stays single.
|
|
6
|
+
const source = require('../lib/storages/chrome-storage.js')
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
9
|
+
exports.local = source.local
|
|
10
|
+
exports.sync = source.sync
|
|
11
|
+
exports.managed = source.managed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../lib/storages/local-storage'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Resolution stub for tooling that predates the exports map: TypeScript's
|
|
2
|
+
// node10 resolver and older bundlers look for a real file at this path and
|
|
3
|
+
// would otherwise fail. Node 16+ never reaches this file — the exports map
|
|
4
|
+
// answers first. The lib module's shape is mirrored rather than re-assigned to
|
|
5
|
+
// module.exports, so the declaration beside it stays true for both resolvers.
|
|
6
|
+
const source = require('../lib/storages/local-storage.js')
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
9
|
+
exports.default = source.default
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../lib/storages/session-storage'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Resolution stub for tooling that predates the exports map: TypeScript's
|
|
2
|
+
// node10 resolver and older bundlers look for a real file at this path and
|
|
3
|
+
// would otherwise fail. Node 16+ never reaches this file — the exports map
|
|
4
|
+
// answers first. The lib module's shape is mirrored rather than re-assigned to
|
|
5
|
+
// module.exports, so the declaration beside it stays true for both resolvers.
|
|
6
|
+
const source = require('../lib/storages/session-storage.js')
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
9
|
+
exports.default = source.default
|