@soul-refiner/design-system 2.0.0-alpha.18 → 2.0.0-alpha.19
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/_virtual/_cloneBuffer.js +5 -0
- package/dist/_virtual/_commonjsHelpers.js +10 -0
- package/dist/_virtual/_nodeUtil.js +5 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index3.js +5 -0
- package/dist/_virtual/isBuffer.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.production.min.js +5 -0
- package/dist/_virtual/util.js +5 -0
- package/dist/_virtual/with-selector.development.js +5 -0
- package/dist/_virtual/with-selector.js +5 -0
- package/dist/_virtual/with-selector.production.min.js +5 -0
- package/dist/node_modules/@udecode/plate-alignment/dist/index.js +98 -0
- package/dist/node_modules/@udecode/plate-core/dist/index.js +2656 -0
- package/dist/node_modules/@udecode/plate-link/dist/index.js +585 -0
- package/dist/node_modules/@udecode/plate-media/dist/index.js +211 -0
- package/dist/node_modules/@udecode/plate-normalizers/dist/index.js +20 -0
- package/dist/node_modules/@udecode/plate-resizable/dist/index.js +334 -0
- package/dist/node_modules/@udecode/plate-table/dist/index.js +1371 -0
- package/dist/node_modules/@udecode/plate-utils/dist/index.js +127 -0
- package/dist/node_modules/@udecode/slate/dist/index.js +316 -0
- package/dist/node_modules/@udecode/slate-react/dist/index.js +35 -0
- package/dist/node_modules/@udecode/slate-utils/dist/index.js +230 -0
- package/dist/node_modules/@udecode/utils/dist/index.js +61 -0
- package/dist/node_modules/clsx/dist/clsx.m.js +8 -0
- package/dist/node_modules/dequal/dist/index.js +88 -0
- package/dist/node_modules/immer/dist/immer.js +968 -0
- package/dist/node_modules/is-hotkey/lib/index.js +253 -0
- package/dist/node_modules/jotai/esm/react/utils.js +29 -0
- package/dist/node_modules/jotai/esm/react.js +116 -0
- package/dist/node_modules/jotai/esm/vanilla/utils.js +44 -0
- package/dist/node_modules/jotai/esm/vanilla.js +602 -0
- package/dist/node_modules/jotai-optics/dist/index.modern.js +8 -0
- package/dist/node_modules/jotai-x/dist/index.js +259 -0
- package/dist/node_modules/js-video-url-parser/lib/base.js +9 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/allocine.js +38 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/canalplus.js +50 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/coub.js +58 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/dailymotion.js +74 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/facebook.js +82 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/loom.js +55 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/soundcloud.js +129 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/teachertube.js +114 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/ted.js +100 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/tiktok.js +54 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/twitch.js +154 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/vimeo.js +93 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/wistia.js +116 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/youku.js +87 -0
- package/dist/node_modules/js-video-url-parser/lib/provider/youtube.js +209 -0
- package/dist/node_modules/js-video-url-parser/lib/urlParser.js +88 -0
- package/dist/node_modules/js-video-url-parser/lib/util.js +112 -0
- package/dist/node_modules/lodash/_DataView.js +14 -0
- package/dist/node_modules/lodash/_Hash.js +42 -0
- package/dist/node_modules/lodash/_ListCache.js +42 -0
- package/dist/node_modules/lodash/_Map.js +14 -0
- package/dist/node_modules/lodash/_MapCache.js +42 -0
- package/dist/node_modules/lodash/_Promise.js +14 -0
- package/dist/node_modules/lodash/_Set.js +14 -0
- package/dist/node_modules/lodash/_SetCache.js +35 -0
- package/dist/node_modules/lodash/_Stack.js +38 -0
- package/dist/node_modules/lodash/_Symbol.js +12 -0
- package/dist/node_modules/lodash/_Uint8Array.js +12 -0
- package/dist/node_modules/lodash/_WeakMap.js +14 -0
- package/dist/node_modules/lodash/_apply.js +26 -0
- package/dist/node_modules/lodash/_arrayAggregator.js +27 -0
- package/dist/node_modules/lodash/_arrayEach.js +27 -0
- package/dist/node_modules/lodash/_arrayFilter.js +30 -0
- package/dist/node_modules/lodash/_arrayLikeKeys.js +60 -0
- package/dist/node_modules/lodash/_arrayMap.js +26 -0
- package/dist/node_modules/lodash/_arrayPush.js +25 -0
- package/dist/node_modules/lodash/_arraySome.js +28 -0
- package/dist/node_modules/lodash/_assignMergeValue.js +27 -0
- package/dist/node_modules/lodash/_assignValue.js +35 -0
- package/dist/node_modules/lodash/_assocIndexOf.js +27 -0
- package/dist/node_modules/lodash/_baseAggregator.js +27 -0
- package/dist/node_modules/lodash/_baseAssign.js +24 -0
- package/dist/node_modules/lodash/_baseAssignIn.js +24 -0
- package/dist/node_modules/lodash/_baseAssignValue.js +31 -0
- package/dist/node_modules/lodash/_baseClone.js +193 -0
- package/dist/node_modules/lodash/_baseCreate.js +36 -0
- package/dist/node_modules/lodash/_baseEach.js +21 -0
- package/dist/node_modules/lodash/_baseFlatten.js +45 -0
- package/dist/node_modules/lodash/_baseFor.js +22 -0
- package/dist/node_modules/lodash/_baseForOwn.js +23 -0
- package/dist/node_modules/lodash/_baseGet.js +31 -0
- package/dist/node_modules/lodash/_baseGetAllKeys.js +27 -0
- package/dist/node_modules/lodash/_baseGetTag.js +36 -0
- package/dist/node_modules/lodash/_baseHasIn.js +18 -0
- package/dist/node_modules/lodash/_baseIsArguments.js +25 -0
- package/dist/node_modules/lodash/_baseIsEqual.js +35 -0
- package/dist/node_modules/lodash/_baseIsEqualDeep.js +96 -0
- package/dist/node_modules/lodash/_baseIsMap.js +25 -0
- package/dist/node_modules/lodash/_baseIsMatch.js +69 -0
- package/dist/node_modules/lodash/_baseIsNative.js +56 -0
- package/dist/node_modules/lodash/_baseIsSet.js +25 -0
- package/dist/node_modules/lodash/_baseIsTypedArray.js +68 -0
- package/dist/node_modules/lodash/_baseIteratee.js +41 -0
- package/dist/node_modules/lodash/_baseKeys.js +37 -0
- package/dist/node_modules/lodash/_baseKeysIn.js +41 -0
- package/dist/node_modules/lodash/_baseMap.js +29 -0
- package/dist/node_modules/lodash/_baseMatches.js +30 -0
- package/dist/node_modules/lodash/_baseMatchesProperty.js +45 -0
- package/dist/node_modules/lodash/_baseMerge.js +54 -0
- package/dist/node_modules/lodash/_baseMergeDeep.js +114 -0
- package/dist/node_modules/lodash/_baseProperty.js +19 -0
- package/dist/node_modules/lodash/_basePropertyDeep.js +22 -0
- package/dist/node_modules/lodash/_baseRest.js +25 -0
- package/dist/node_modules/lodash/_baseSetToString.js +30 -0
- package/dist/node_modules/lodash/_baseSlice.js +36 -0
- package/dist/node_modules/lodash/_baseTimes.js +25 -0
- package/dist/node_modules/lodash/_baseToString.js +46 -0
- package/dist/node_modules/lodash/_baseUnary.js +19 -0
- package/dist/node_modules/lodash/_baseUnset.js +29 -0
- package/dist/node_modules/lodash/_baseValues.js +25 -0
- package/dist/node_modules/lodash/_cacheHas.js +18 -0
- package/dist/node_modules/lodash/_castPath.js +30 -0
- package/dist/node_modules/lodash/_cloneArrayBuffer.js +22 -0
- package/dist/node_modules/lodash/_cloneBuffer.js +48 -0
- package/dist/node_modules/lodash/_cloneDataView.js +22 -0
- package/dist/node_modules/lodash/_cloneRegExp.js +22 -0
- package/dist/node_modules/lodash/_cloneSymbol.js +24 -0
- package/dist/node_modules/lodash/_cloneTypedArray.js +22 -0
- package/dist/node_modules/lodash/_copyArray.js +25 -0
- package/dist/node_modules/lodash/_copyObject.js +47 -0
- package/dist/node_modules/lodash/_copySymbols.js +23 -0
- package/dist/node_modules/lodash/_copySymbolsIn.js +23 -0
- package/dist/node_modules/lodash/_coreJsData.js +12 -0
- package/dist/node_modules/lodash/_createAggregator.js +32 -0
- package/dist/node_modules/lodash/_createAssigner.js +44 -0
- package/dist/node_modules/lodash/_createBaseEach.js +38 -0
- package/dist/node_modules/lodash/_createBaseFor.js +30 -0
- package/dist/node_modules/lodash/_customDefaultsMerge.js +35 -0
- package/dist/node_modules/lodash/_customOmitClone.js +22 -0
- package/dist/node_modules/lodash/_defineProperty.js +17 -0
- package/dist/node_modules/lodash/_equalArrays.js +92 -0
- package/dist/node_modules/lodash/_equalByTag.js +123 -0
- package/dist/node_modules/lodash/_equalObjects.js +96 -0
- package/dist/node_modules/lodash/_flatRest.js +24 -0
- package/dist/node_modules/lodash/_freeGlobal.js +11 -0
- package/dist/node_modules/lodash/_getAllKeys.js +24 -0
- package/dist/node_modules/lodash/_getAllKeysIn.js +25 -0
- package/dist/node_modules/lodash/_getMapData.js +24 -0
- package/dist/node_modules/lodash/_getMatchData.js +31 -0
- package/dist/node_modules/lodash/_getNative.js +24 -0
- package/dist/node_modules/lodash/_getPrototype.js +12 -0
- package/dist/node_modules/lodash/_getRawTag.js +52 -0
- package/dist/node_modules/lodash/_getSymbols.js +37 -0
- package/dist/node_modules/lodash/_getSymbolsIn.js +34 -0
- package/dist/node_modules/lodash/_getTag.js +70 -0
- package/dist/node_modules/lodash/_getValue.js +18 -0
- package/dist/node_modules/lodash/_hasPath.js +50 -0
- package/dist/node_modules/lodash/_hashClear.js +21 -0
- package/dist/node_modules/lodash/_hashDelete.js +22 -0
- package/dist/node_modules/lodash/_hashGet.js +36 -0
- package/dist/node_modules/lodash/_hashHas.js +29 -0
- package/dist/node_modules/lodash/_hashSet.js +29 -0
- package/dist/node_modules/lodash/_initCloneArray.js +31 -0
- package/dist/node_modules/lodash/_initCloneByTag.js +87 -0
- package/dist/node_modules/lodash/_initCloneObject.js +26 -0
- package/dist/node_modules/lodash/_isFlattenable.js +28 -0
- package/dist/node_modules/lodash/_isIndex.js +30 -0
- package/dist/node_modules/lodash/_isIterateeCall.js +39 -0
- package/dist/node_modules/lodash/_isKey.js +36 -0
- package/dist/node_modules/lodash/_isKeyable.js +20 -0
- package/dist/node_modules/lodash/_isMasked.js +26 -0
- package/dist/node_modules/lodash/_isPrototype.js +23 -0
- package/dist/node_modules/lodash/_isStrictComparable.js +21 -0
- package/dist/node_modules/lodash/_listCacheClear.js +18 -0
- package/dist/node_modules/lodash/_listCacheDelete.js +41 -0
- package/dist/node_modules/lodash/_listCacheGet.js +25 -0
- package/dist/node_modules/lodash/_listCacheHas.js +22 -0
- package/dist/node_modules/lodash/_listCacheSet.js +32 -0
- package/dist/node_modules/lodash/_mapCacheClear.js +29 -0
- package/dist/node_modules/lodash/_mapCacheDelete.js +24 -0
- package/dist/node_modules/lodash/_mapCacheGet.js +22 -0
- package/dist/node_modules/lodash/_mapCacheHas.js +22 -0
- package/dist/node_modules/lodash/_mapCacheSet.js +28 -0
- package/dist/node_modules/lodash/_mapToArray.js +23 -0
- package/dist/node_modules/lodash/_matchesStrictComparable.js +25 -0
- package/dist/node_modules/lodash/_memoizeCapped.js +32 -0
- package/dist/node_modules/lodash/_nativeCreate.js +12 -0
- package/dist/node_modules/lodash/_nativeKeys.js +12 -0
- package/dist/node_modules/lodash/_nativeKeysIn.js +25 -0
- package/dist/node_modules/lodash/_nodeUtil.js +43 -0
- package/dist/node_modules/lodash/_objectToString.js +27 -0
- package/dist/node_modules/lodash/_overArg.js +20 -0
- package/dist/node_modules/lodash/_overRest.js +42 -0
- package/dist/node_modules/lodash/_parent.js +23 -0
- package/dist/node_modules/lodash/_root.js +15 -0
- package/dist/node_modules/lodash/_safeGet.js +26 -0
- package/dist/node_modules/lodash/_setCacheAdd.js +24 -0
- package/dist/node_modules/lodash/_setCacheHas.js +19 -0
- package/dist/node_modules/lodash/_setToArray.js +23 -0
- package/dist/node_modules/lodash/_setToString.js +21 -0
- package/dist/node_modules/lodash/_shortOut.js +42 -0
- package/dist/node_modules/lodash/_stackClear.js +21 -0
- package/dist/node_modules/lodash/_stackDelete.js +23 -0
- package/dist/node_modules/lodash/_stackGet.js +19 -0
- package/dist/node_modules/lodash/_stackHas.js +19 -0
- package/dist/node_modules/lodash/_stackSet.js +42 -0
- package/dist/node_modules/lodash/_stringToPath.js +33 -0
- package/dist/node_modules/lodash/_toKey.js +27 -0
- package/dist/node_modules/lodash/_toSource.js +31 -0
- package/dist/node_modules/lodash/castArray.js +55 -0
- package/dist/node_modules/lodash/cloneDeep.js +40 -0
- package/dist/node_modules/lodash/constant.js +31 -0
- package/dist/node_modules/lodash/defaults.js +69 -0
- package/dist/node_modules/lodash/defaultsDeep.js +44 -0
- package/dist/node_modules/lodash/eq.js +42 -0
- package/dist/node_modules/lodash/flatten.js +28 -0
- package/dist/node_modules/lodash/get.js +39 -0
- package/dist/node_modules/lodash/hasIn.js +41 -0
- package/dist/node_modules/lodash/identity.js +26 -0
- package/dist/node_modules/lodash/isArguments.js +43 -0
- package/dist/node_modules/lodash/isArray.js +31 -0
- package/dist/node_modules/lodash/isArrayLike.js +40 -0
- package/dist/node_modules/lodash/isArrayLikeObject.js +40 -0
- package/dist/node_modules/lodash/isBuffer.js +52 -0
- package/dist/node_modules/lodash/isFunction.js +44 -0
- package/dist/node_modules/lodash/isLength.js +40 -0
- package/dist/node_modules/lodash/isMap.js +35 -0
- package/dist/node_modules/lodash/isObject.js +36 -0
- package/dist/node_modules/lodash/isObjectLike.js +34 -0
- package/dist/node_modules/lodash/isPlainObject.js +70 -0
- package/dist/node_modules/lodash/isSet.js +35 -0
- package/dist/node_modules/lodash/isSymbol.js +36 -0
- package/dist/node_modules/lodash/isTypedArray.js +35 -0
- package/dist/node_modules/lodash/keyBy.js +48 -0
- package/dist/node_modules/lodash/keys.js +45 -0
- package/dist/node_modules/lodash/keysIn.js +40 -0
- package/dist/node_modules/lodash/last.js +25 -0
- package/dist/node_modules/lodash/map.js +67 -0
- package/dist/node_modules/lodash/memoize.js +79 -0
- package/dist/node_modules/lodash/merge.js +51 -0
- package/dist/node_modules/lodash/mergeWith.js +46 -0
- package/dist/node_modules/lodash/omit.js +75 -0
- package/dist/node_modules/lodash/property.js +41 -0
- package/dist/node_modules/lodash/stubArray.js +28 -0
- package/dist/node_modules/lodash/stubFalse.js +23 -0
- package/dist/node_modules/lodash/toPlainObject.js +39 -0
- package/dist/node_modules/lodash/toString.js +34 -0
- package/dist/node_modules/lodash/values.js +46 -0
- package/dist/node_modules/lodash.mapvalues/index.js +2290 -0
- package/dist/node_modules/optics-ts/dist/mjs/index.js +31 -0
- package/dist/node_modules/optics-ts/dist/mjs/internals.js +460 -0
- package/dist/node_modules/proxy-compare/dist/index.modern.js +7 -0
- package/dist/node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.js +395 -0
- package/dist/node_modules/react-tracked/dist/index.modern.js +48 -0
- package/dist/node_modules/use-deep-compare/dist-web/index.js +35 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +181 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +32 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +254 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +30 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +21 -0
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js +19 -0
- package/dist/node_modules/zustand/esm/middleware.js +551 -0
- package/dist/node_modules/zustand/esm/traditional.js +25 -0
- package/dist/node_modules/zustand/esm/vanilla.js +34 -0
- package/dist/node_modules/zustand-x/dist/index.js +217 -0
- package/dist/src/common/styles.js +12 -12
- package/dist/src/components/actions/button/button.js +11 -10
- package/dist/src/components/actions/dropdown/dropdown.js +5 -5
- package/dist/src/components/actions/rate/rate.js +2 -2
- package/dist/src/components/actions/switch/switch.js +3 -3
- package/dist/src/components/actions/toggle/toggle.js +4 -4
- package/dist/src/components/actions/upload/upload.js +3 -3
- package/dist/src/components/atoms/box/box.js +2 -2
- package/dist/src/components/atoms/typography/display.js +2 -2
- package/dist/src/components/atoms/typography/heading.js +2 -2
- package/dist/src/components/atoms/typography/paragraph.js +2 -2
- package/dist/src/components/atoms/typography/typography.js +2 -2
- package/dist/src/components/card/action/action.js +6 -6
- package/dist/src/components/card/audio/audio.js +5 -5
- package/dist/src/components/card/feature/feature.js +7 -7
- package/dist/src/components/card/meeting/meeting.js +6 -6
- package/dist/src/components/card/person/person.js +5 -5
- package/dist/src/components/card/price/price.js +4 -4
- package/dist/src/components/card/regular/regular.js +2 -2
- package/dist/src/components/card/styles.js +2 -2
- package/dist/src/components/card/video/video.js +5 -5
- package/dist/src/components/card/written/written.js +5 -5
- package/dist/src/components/custom/courses_selection/courses_selection.js +5 -5
- package/dist/src/components/custom/users_selection/users_selection.js +6 -6
- package/dist/src/components/editor/editor.js +2 -2
- package/dist/src/components/editor/navbar/alignment_dropdown.js +3 -3
- package/dist/src/components/editor/navbar/button_modal.js +2 -2
- package/dist/src/components/editor/navbar/navbar.js +6 -6
- package/dist/src/components/editor/plugins/blocks/buttons.js +3 -3
- package/dist/src/components/editor/plugins/blocks/image.js +12 -11
- package/dist/src/components/editor/plugins/blocks/list.js +2 -2
- package/dist/src/components/editor/plugins/blocks/media-popover.js +9 -7
- package/dist/src/components/editor/plugins/blocks/qa.js +2 -2
- package/dist/src/components/editor/plugins/blocks/resizable.js +3 -3
- package/dist/src/components/editor/plugins/blocks/table-cell.js +7 -7
- package/dist/src/components/editor/plugins/blocks/table-row.js +2 -2
- package/dist/src/components/editor/plugins/blocks/table.js +16 -14
- package/dist/src/components/editor/plugins/leafs/leafs.js +2 -2
- package/dist/src/components/editor/plugins/leafs/link.js +2 -2
- package/dist/src/components/editor/plugins/plate.js +3 -3
- package/dist/src/components/editor/simple_editor/navbar.js +4 -4
- package/dist/src/components/editor/simple_editor/simple_editor.js +3 -3
- package/dist/src/components/editor/styles/menu_button.js +2 -2
- package/dist/src/components/feedback/animated_toast/animated_toast.js +3 -3
- package/dist/src/components/feedback/badge/badge.js +3 -3
- package/dist/src/components/feedback/banner/banner.js +2 -2
- package/dist/src/components/feedback/chip/chip.js +3 -3
- package/dist/src/components/feedback/loader/loader.js +4 -3
- package/dist/src/components/feedback/notification/notification.js +2 -2
- package/dist/src/components/feedback/progress/progress.js +5 -5
- package/dist/src/components/feedback/toast/toast.js +3 -3
- package/dist/src/components/iconography/avatar/avatar.js +6 -6
- package/dist/src/components/iconography/icon/icon.js +2 -2
- package/dist/src/components/input/calendar/calendar.js +13 -13
- package/dist/src/components/input/checkbox/checkbox.js +2 -2
- package/dist/src/components/input/date/date.js +13 -13
- package/dist/src/components/input/filter/filter.js +11 -10
- package/dist/src/components/input/filter/filter_option.js +3 -3
- package/dist/src/components/input/radio/radio.js +3 -3
- package/dist/src/components/input/search/search.js +4 -4
- package/dist/src/components/input/select/select.js +3 -3
- package/dist/src/components/input/text_area/text_area.js +6 -6
- package/dist/src/components/input/text_input/text_input.js +7 -7
- package/dist/src/components/input/time/time.js +3 -3
- package/dist/src/components/media/video-player/playlist-item.js +3 -3
- package/dist/src/components/media/video-player/video.js +6 -6
- package/dist/src/components/navigation/breadcrumb/breadcrumb.js +3 -3
- package/dist/src/components/navigation/inner/inner.js +8 -8
- package/dist/src/components/navigation/tabs/tabs.js +4 -4
- package/dist/src/components/surfaces/accordion/accordion.js +3 -3
- package/dist/src/components/surfaces/calendar_date/calendar_date.js +6 -6
- package/dist/src/components/surfaces/carousel/card/card.js +4 -4
- package/dist/src/components/surfaces/comment/comment.js +10 -10
- package/dist/src/components/surfaces/drawer/drawer.js +6 -6
- package/dist/src/components/surfaces/message/message.js +2 -2
- package/dist/src/components/surfaces/modal/modal.js +3 -3
- package/dist/src/components/surfaces/post/post.js +9 -9
- package/dist/src/components/table/table/table.js +7 -7
- package/dist/src/index.js +0 -1
- package/package.json +2 -1
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const trackedConnections = /* @__PURE__ */ new Map();
|
|
4
|
+
const getTrackedConnectionState = (name) => {
|
|
5
|
+
const api = trackedConnections.get(name);
|
|
6
|
+
if (!api)
|
|
7
|
+
return {};
|
|
8
|
+
return Object.fromEntries(
|
|
9
|
+
Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
const extractConnectionInformation = (store, extensionConnector, options) => {
|
|
13
|
+
if (store === void 0) {
|
|
14
|
+
return {
|
|
15
|
+
type: "untracked",
|
|
16
|
+
connection: extensionConnector.connect(options)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const existingConnection = trackedConnections.get(options.name);
|
|
20
|
+
if (existingConnection) {
|
|
21
|
+
return { type: "tracked", store, ...existingConnection };
|
|
22
|
+
}
|
|
23
|
+
const newConnection = {
|
|
24
|
+
connection: extensionConnector.connect(options),
|
|
25
|
+
stores: {}
|
|
26
|
+
};
|
|
27
|
+
trackedConnections.set(options.name, newConnection);
|
|
28
|
+
return { type: "tracked", store, ...newConnection };
|
|
29
|
+
};
|
|
30
|
+
const devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {
|
|
31
|
+
const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;
|
|
32
|
+
let extensionConnector;
|
|
33
|
+
try {
|
|
34
|
+
extensionConnector = (enabled != null ? enabled : (undefined ? undefined.MODE : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
|
|
35
|
+
} catch (e) {
|
|
36
|
+
}
|
|
37
|
+
if (!extensionConnector) {
|
|
38
|
+
if ((undefined ? undefined.MODE : void 0) !== "production" && enabled) {
|
|
39
|
+
console.warn(
|
|
40
|
+
"[zustand devtools middleware] Please install/enable Redux devtools extension"
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return fn(set, get, api);
|
|
44
|
+
}
|
|
45
|
+
const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);
|
|
46
|
+
let isRecording = true;
|
|
47
|
+
api.setState = (state, replace, nameOrAction) => {
|
|
48
|
+
const r = set(state, replace);
|
|
49
|
+
if (!isRecording)
|
|
50
|
+
return r;
|
|
51
|
+
const action = nameOrAction === void 0 ? { type: anonymousActionType || "anonymous" } : typeof nameOrAction === "string" ? { type: nameOrAction } : nameOrAction;
|
|
52
|
+
if (store === void 0) {
|
|
53
|
+
connection == null ? void 0 : connection.send(action, get());
|
|
54
|
+
return r;
|
|
55
|
+
}
|
|
56
|
+
connection == null ? void 0 : connection.send(
|
|
57
|
+
{
|
|
58
|
+
...action,
|
|
59
|
+
type: `${store}/${action.type}`
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
...getTrackedConnectionState(options.name),
|
|
63
|
+
[store]: api.getState()
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
return r;
|
|
67
|
+
};
|
|
68
|
+
const setStateFromDevtools = (...a) => {
|
|
69
|
+
const originalIsRecording = isRecording;
|
|
70
|
+
isRecording = false;
|
|
71
|
+
set(...a);
|
|
72
|
+
isRecording = originalIsRecording;
|
|
73
|
+
};
|
|
74
|
+
const initialState = fn(api.setState, get, api);
|
|
75
|
+
if (connectionInformation.type === "untracked") {
|
|
76
|
+
connection == null ? void 0 : connection.init(initialState);
|
|
77
|
+
} else {
|
|
78
|
+
connectionInformation.stores[connectionInformation.store] = api;
|
|
79
|
+
connection == null ? void 0 : connection.init(
|
|
80
|
+
Object.fromEntries(
|
|
81
|
+
Object.entries(connectionInformation.stores).map(([key, store2]) => [
|
|
82
|
+
key,
|
|
83
|
+
key === connectionInformation.store ? initialState : store2.getState()
|
|
84
|
+
])
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
if (api.dispatchFromDevtools && typeof api.dispatch === "function") {
|
|
89
|
+
let didWarnAboutReservedActionType = false;
|
|
90
|
+
const originalDispatch = api.dispatch;
|
|
91
|
+
api.dispatch = (...a) => {
|
|
92
|
+
if ((undefined ? undefined.MODE : void 0) !== "production" && a[0].type === "__setState" && !didWarnAboutReservedActionType) {
|
|
93
|
+
console.warn(
|
|
94
|
+
'[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'
|
|
95
|
+
);
|
|
96
|
+
didWarnAboutReservedActionType = true;
|
|
97
|
+
}
|
|
98
|
+
originalDispatch(...a);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
connection.subscribe((message) => {
|
|
102
|
+
var _a;
|
|
103
|
+
switch (message.type) {
|
|
104
|
+
case "ACTION":
|
|
105
|
+
if (typeof message.payload !== "string") {
|
|
106
|
+
console.error(
|
|
107
|
+
"[zustand devtools middleware] Unsupported action format"
|
|
108
|
+
);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
return parseJsonThen(
|
|
112
|
+
message.payload,
|
|
113
|
+
(action) => {
|
|
114
|
+
if (action.type === "__setState") {
|
|
115
|
+
if (store === void 0) {
|
|
116
|
+
setStateFromDevtools(action.state);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (Object.keys(action.state).length !== 1) {
|
|
120
|
+
console.error(
|
|
121
|
+
`
|
|
122
|
+
[zustand devtools middleware] Unsupported __setState action format.
|
|
123
|
+
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
124
|
+
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
|
125
|
+
`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
const stateFromDevtools = action.state[store];
|
|
129
|
+
if (stateFromDevtools === void 0 || stateFromDevtools === null) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {
|
|
133
|
+
setStateFromDevtools(stateFromDevtools);
|
|
134
|
+
}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (!api.dispatchFromDevtools)
|
|
138
|
+
return;
|
|
139
|
+
if (typeof api.dispatch !== "function")
|
|
140
|
+
return;
|
|
141
|
+
api.dispatch(action);
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
case "DISPATCH":
|
|
145
|
+
switch (message.payload.type) {
|
|
146
|
+
case "RESET":
|
|
147
|
+
setStateFromDevtools(initialState);
|
|
148
|
+
if (store === void 0) {
|
|
149
|
+
return connection == null ? void 0 : connection.init(api.getState());
|
|
150
|
+
}
|
|
151
|
+
return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
|
152
|
+
case "COMMIT":
|
|
153
|
+
if (store === void 0) {
|
|
154
|
+
connection == null ? void 0 : connection.init(api.getState());
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
|
158
|
+
case "ROLLBACK":
|
|
159
|
+
return parseJsonThen(message.state, (state) => {
|
|
160
|
+
if (store === void 0) {
|
|
161
|
+
setStateFromDevtools(state);
|
|
162
|
+
connection == null ? void 0 : connection.init(api.getState());
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
setStateFromDevtools(state[store]);
|
|
166
|
+
connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
|
167
|
+
});
|
|
168
|
+
case "JUMP_TO_STATE":
|
|
169
|
+
case "JUMP_TO_ACTION":
|
|
170
|
+
return parseJsonThen(message.state, (state) => {
|
|
171
|
+
if (store === void 0) {
|
|
172
|
+
setStateFromDevtools(state);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {
|
|
176
|
+
setStateFromDevtools(state[store]);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
case "IMPORT_STATE": {
|
|
180
|
+
const { nextLiftedState } = message.payload;
|
|
181
|
+
const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;
|
|
182
|
+
if (!lastComputedState)
|
|
183
|
+
return;
|
|
184
|
+
if (store === void 0) {
|
|
185
|
+
setStateFromDevtools(lastComputedState);
|
|
186
|
+
} else {
|
|
187
|
+
setStateFromDevtools(lastComputedState[store]);
|
|
188
|
+
}
|
|
189
|
+
connection == null ? void 0 : connection.send(
|
|
190
|
+
null,
|
|
191
|
+
// FIXME no-any
|
|
192
|
+
nextLiftedState
|
|
193
|
+
);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
case "PAUSE_RECORDING":
|
|
197
|
+
return isRecording = !isRecording;
|
|
198
|
+
}
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
return initialState;
|
|
203
|
+
};
|
|
204
|
+
const devtools = devtoolsImpl;
|
|
205
|
+
const parseJsonThen = (stringified, f) => {
|
|
206
|
+
let parsed;
|
|
207
|
+
try {
|
|
208
|
+
parsed = JSON.parse(stringified);
|
|
209
|
+
} catch (e) {
|
|
210
|
+
console.error(
|
|
211
|
+
"[zustand devtools middleware] Could not parse the received json",
|
|
212
|
+
e
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
if (parsed !== void 0)
|
|
216
|
+
f(parsed);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
function createJSONStorage(getStorage, options) {
|
|
220
|
+
let storage;
|
|
221
|
+
try {
|
|
222
|
+
storage = getStorage();
|
|
223
|
+
} catch (e) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const persistStorage = {
|
|
227
|
+
getItem: (name) => {
|
|
228
|
+
var _a;
|
|
229
|
+
const parse = (str2) => {
|
|
230
|
+
if (str2 === null) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
return JSON.parse(str2, options == null ? void 0 : options.reviver);
|
|
234
|
+
};
|
|
235
|
+
const str = (_a = storage.getItem(name)) != null ? _a : null;
|
|
236
|
+
if (str instanceof Promise) {
|
|
237
|
+
return str.then(parse);
|
|
238
|
+
}
|
|
239
|
+
return parse(str);
|
|
240
|
+
},
|
|
241
|
+
setItem: (name, newValue) => storage.setItem(
|
|
242
|
+
name,
|
|
243
|
+
JSON.stringify(newValue, options == null ? void 0 : options.replacer)
|
|
244
|
+
),
|
|
245
|
+
removeItem: (name) => storage.removeItem(name)
|
|
246
|
+
};
|
|
247
|
+
return persistStorage;
|
|
248
|
+
}
|
|
249
|
+
const toThenable = (fn) => (input) => {
|
|
250
|
+
try {
|
|
251
|
+
const result = fn(input);
|
|
252
|
+
if (result instanceof Promise) {
|
|
253
|
+
return result;
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
then(onFulfilled) {
|
|
257
|
+
return toThenable(onFulfilled)(result);
|
|
258
|
+
},
|
|
259
|
+
catch(_onRejected) {
|
|
260
|
+
return this;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
} catch (e) {
|
|
264
|
+
return {
|
|
265
|
+
then(_onFulfilled) {
|
|
266
|
+
return this;
|
|
267
|
+
},
|
|
268
|
+
catch(onRejected) {
|
|
269
|
+
return toThenable(onRejected)(e);
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
const oldImpl = (config, baseOptions) => (set, get, api) => {
|
|
275
|
+
let options = {
|
|
276
|
+
getStorage: () => localStorage,
|
|
277
|
+
serialize: JSON.stringify,
|
|
278
|
+
deserialize: JSON.parse,
|
|
279
|
+
partialize: (state) => state,
|
|
280
|
+
version: 0,
|
|
281
|
+
merge: (persistedState, currentState) => ({
|
|
282
|
+
...currentState,
|
|
283
|
+
...persistedState
|
|
284
|
+
}),
|
|
285
|
+
...baseOptions
|
|
286
|
+
};
|
|
287
|
+
let hasHydrated = false;
|
|
288
|
+
const hydrationListeners = /* @__PURE__ */ new Set();
|
|
289
|
+
const finishHydrationListeners = /* @__PURE__ */ new Set();
|
|
290
|
+
let storage;
|
|
291
|
+
try {
|
|
292
|
+
storage = options.getStorage();
|
|
293
|
+
} catch (e) {
|
|
294
|
+
}
|
|
295
|
+
if (!storage) {
|
|
296
|
+
return config(
|
|
297
|
+
(...args) => {
|
|
298
|
+
console.warn(
|
|
299
|
+
`[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
|
|
300
|
+
);
|
|
301
|
+
set(...args);
|
|
302
|
+
},
|
|
303
|
+
get,
|
|
304
|
+
api
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
const thenableSerialize = toThenable(options.serialize);
|
|
308
|
+
const setItem = () => {
|
|
309
|
+
const state = options.partialize({ ...get() });
|
|
310
|
+
let errorInSync;
|
|
311
|
+
const thenable = thenableSerialize({ state, version: options.version }).then(
|
|
312
|
+
(serializedValue) => storage.setItem(options.name, serializedValue)
|
|
313
|
+
).catch((e) => {
|
|
314
|
+
errorInSync = e;
|
|
315
|
+
});
|
|
316
|
+
if (errorInSync) {
|
|
317
|
+
throw errorInSync;
|
|
318
|
+
}
|
|
319
|
+
return thenable;
|
|
320
|
+
};
|
|
321
|
+
const savedSetState = api.setState;
|
|
322
|
+
api.setState = (state, replace) => {
|
|
323
|
+
savedSetState(state, replace);
|
|
324
|
+
void setItem();
|
|
325
|
+
};
|
|
326
|
+
const configResult = config(
|
|
327
|
+
(...args) => {
|
|
328
|
+
set(...args);
|
|
329
|
+
void setItem();
|
|
330
|
+
},
|
|
331
|
+
get,
|
|
332
|
+
api
|
|
333
|
+
);
|
|
334
|
+
let stateFromStorage;
|
|
335
|
+
const hydrate = () => {
|
|
336
|
+
var _a;
|
|
337
|
+
if (!storage)
|
|
338
|
+
return;
|
|
339
|
+
hasHydrated = false;
|
|
340
|
+
hydrationListeners.forEach((cb) => cb(get()));
|
|
341
|
+
const postRehydrationCallback = ((_a = options.onRehydrateStorage) == null ? void 0 : _a.call(options, get())) || void 0;
|
|
342
|
+
return toThenable(storage.getItem.bind(storage))(options.name).then((storageValue) => {
|
|
343
|
+
if (storageValue) {
|
|
344
|
+
return options.deserialize(storageValue);
|
|
345
|
+
}
|
|
346
|
+
}).then((deserializedStorageValue) => {
|
|
347
|
+
if (deserializedStorageValue) {
|
|
348
|
+
if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
|
|
349
|
+
if (options.migrate) {
|
|
350
|
+
return options.migrate(
|
|
351
|
+
deserializedStorageValue.state,
|
|
352
|
+
deserializedStorageValue.version
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
console.error(
|
|
356
|
+
`State loaded from storage couldn't be migrated since no migrate function was provided`
|
|
357
|
+
);
|
|
358
|
+
} else {
|
|
359
|
+
return deserializedStorageValue.state;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}).then((migratedState) => {
|
|
363
|
+
var _a2;
|
|
364
|
+
stateFromStorage = options.merge(
|
|
365
|
+
migratedState,
|
|
366
|
+
(_a2 = get()) != null ? _a2 : configResult
|
|
367
|
+
);
|
|
368
|
+
set(stateFromStorage, true);
|
|
369
|
+
return setItem();
|
|
370
|
+
}).then(() => {
|
|
371
|
+
postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
|
|
372
|
+
hasHydrated = true;
|
|
373
|
+
finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
|
|
374
|
+
}).catch((e) => {
|
|
375
|
+
postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
api.persist = {
|
|
379
|
+
setOptions: (newOptions) => {
|
|
380
|
+
options = {
|
|
381
|
+
...options,
|
|
382
|
+
...newOptions
|
|
383
|
+
};
|
|
384
|
+
if (newOptions.getStorage) {
|
|
385
|
+
storage = newOptions.getStorage();
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
clearStorage: () => {
|
|
389
|
+
storage == null ? void 0 : storage.removeItem(options.name);
|
|
390
|
+
},
|
|
391
|
+
getOptions: () => options,
|
|
392
|
+
rehydrate: () => hydrate(),
|
|
393
|
+
hasHydrated: () => hasHydrated,
|
|
394
|
+
onHydrate: (cb) => {
|
|
395
|
+
hydrationListeners.add(cb);
|
|
396
|
+
return () => {
|
|
397
|
+
hydrationListeners.delete(cb);
|
|
398
|
+
};
|
|
399
|
+
},
|
|
400
|
+
onFinishHydration: (cb) => {
|
|
401
|
+
finishHydrationListeners.add(cb);
|
|
402
|
+
return () => {
|
|
403
|
+
finishHydrationListeners.delete(cb);
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
hydrate();
|
|
408
|
+
return stateFromStorage || configResult;
|
|
409
|
+
};
|
|
410
|
+
const newImpl = (config, baseOptions) => (set, get, api) => {
|
|
411
|
+
let options = {
|
|
412
|
+
storage: createJSONStorage(() => localStorage),
|
|
413
|
+
partialize: (state) => state,
|
|
414
|
+
version: 0,
|
|
415
|
+
merge: (persistedState, currentState) => ({
|
|
416
|
+
...currentState,
|
|
417
|
+
...persistedState
|
|
418
|
+
}),
|
|
419
|
+
...baseOptions
|
|
420
|
+
};
|
|
421
|
+
let hasHydrated = false;
|
|
422
|
+
const hydrationListeners = /* @__PURE__ */ new Set();
|
|
423
|
+
const finishHydrationListeners = /* @__PURE__ */ new Set();
|
|
424
|
+
let storage = options.storage;
|
|
425
|
+
if (!storage) {
|
|
426
|
+
return config(
|
|
427
|
+
(...args) => {
|
|
428
|
+
console.warn(
|
|
429
|
+
`[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
|
|
430
|
+
);
|
|
431
|
+
set(...args);
|
|
432
|
+
},
|
|
433
|
+
get,
|
|
434
|
+
api
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
const setItem = () => {
|
|
438
|
+
const state = options.partialize({ ...get() });
|
|
439
|
+
return storage.setItem(options.name, {
|
|
440
|
+
state,
|
|
441
|
+
version: options.version
|
|
442
|
+
});
|
|
443
|
+
};
|
|
444
|
+
const savedSetState = api.setState;
|
|
445
|
+
api.setState = (state, replace) => {
|
|
446
|
+
savedSetState(state, replace);
|
|
447
|
+
void setItem();
|
|
448
|
+
};
|
|
449
|
+
const configResult = config(
|
|
450
|
+
(...args) => {
|
|
451
|
+
set(...args);
|
|
452
|
+
void setItem();
|
|
453
|
+
},
|
|
454
|
+
get,
|
|
455
|
+
api
|
|
456
|
+
);
|
|
457
|
+
api.getInitialState = () => configResult;
|
|
458
|
+
let stateFromStorage;
|
|
459
|
+
const hydrate = () => {
|
|
460
|
+
var _a, _b;
|
|
461
|
+
if (!storage)
|
|
462
|
+
return;
|
|
463
|
+
hasHydrated = false;
|
|
464
|
+
hydrationListeners.forEach((cb) => {
|
|
465
|
+
var _a2;
|
|
466
|
+
return cb((_a2 = get()) != null ? _a2 : configResult);
|
|
467
|
+
});
|
|
468
|
+
const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;
|
|
469
|
+
return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
|
|
470
|
+
if (deserializedStorageValue) {
|
|
471
|
+
if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
|
|
472
|
+
if (options.migrate) {
|
|
473
|
+
return options.migrate(
|
|
474
|
+
deserializedStorageValue.state,
|
|
475
|
+
deserializedStorageValue.version
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
console.error(
|
|
479
|
+
`State loaded from storage couldn't be migrated since no migrate function was provided`
|
|
480
|
+
);
|
|
481
|
+
} else {
|
|
482
|
+
return deserializedStorageValue.state;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}).then((migratedState) => {
|
|
486
|
+
var _a2;
|
|
487
|
+
stateFromStorage = options.merge(
|
|
488
|
+
migratedState,
|
|
489
|
+
(_a2 = get()) != null ? _a2 : configResult
|
|
490
|
+
);
|
|
491
|
+
set(stateFromStorage, true);
|
|
492
|
+
return setItem();
|
|
493
|
+
}).then(() => {
|
|
494
|
+
postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
|
|
495
|
+
stateFromStorage = get();
|
|
496
|
+
hasHydrated = true;
|
|
497
|
+
finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
|
|
498
|
+
}).catch((e) => {
|
|
499
|
+
postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
|
|
500
|
+
});
|
|
501
|
+
};
|
|
502
|
+
api.persist = {
|
|
503
|
+
setOptions: (newOptions) => {
|
|
504
|
+
options = {
|
|
505
|
+
...options,
|
|
506
|
+
...newOptions
|
|
507
|
+
};
|
|
508
|
+
if (newOptions.storage) {
|
|
509
|
+
storage = newOptions.storage;
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
clearStorage: () => {
|
|
513
|
+
storage == null ? void 0 : storage.removeItem(options.name);
|
|
514
|
+
},
|
|
515
|
+
getOptions: () => options,
|
|
516
|
+
rehydrate: () => hydrate(),
|
|
517
|
+
hasHydrated: () => hasHydrated,
|
|
518
|
+
onHydrate: (cb) => {
|
|
519
|
+
hydrationListeners.add(cb);
|
|
520
|
+
return () => {
|
|
521
|
+
hydrationListeners.delete(cb);
|
|
522
|
+
};
|
|
523
|
+
},
|
|
524
|
+
onFinishHydration: (cb) => {
|
|
525
|
+
finishHydrationListeners.add(cb);
|
|
526
|
+
return () => {
|
|
527
|
+
finishHydrationListeners.delete(cb);
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
if (!options.skipHydration) {
|
|
532
|
+
hydrate();
|
|
533
|
+
}
|
|
534
|
+
return stateFromStorage || configResult;
|
|
535
|
+
};
|
|
536
|
+
const persistImpl = (config, baseOptions) => {
|
|
537
|
+
if ("getStorage" in baseOptions || "serialize" in baseOptions || "deserialize" in baseOptions) {
|
|
538
|
+
if ((undefined ? undefined.MODE : void 0) !== "production") {
|
|
539
|
+
console.warn(
|
|
540
|
+
"[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
return oldImpl(config, baseOptions);
|
|
544
|
+
}
|
|
545
|
+
return newImpl(config, baseOptions);
|
|
546
|
+
};
|
|
547
|
+
const persist = persistImpl;
|
|
548
|
+
|
|
549
|
+
exports.createJSONStorage = createJSONStorage;
|
|
550
|
+
exports.devtools = devtools;
|
|
551
|
+
exports.persist = persist;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var withSelector = require('../../use-sync-external-store/shim/with-selector.js');
|
|
5
|
+
|
|
6
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
9
|
+
|
|
10
|
+
const { useDebugValue } = React__default.default;
|
|
11
|
+
const { useSyncExternalStoreWithSelector } = withSelector.default;
|
|
12
|
+
const identity = (arg) => arg;
|
|
13
|
+
function useStoreWithEqualityFn(api, selector = identity, equalityFn) {
|
|
14
|
+
const slice = useSyncExternalStoreWithSelector(
|
|
15
|
+
api.subscribe,
|
|
16
|
+
api.getState,
|
|
17
|
+
api.getServerState || api.getInitialState,
|
|
18
|
+
selector,
|
|
19
|
+
equalityFn
|
|
20
|
+
);
|
|
21
|
+
useDebugValue(slice);
|
|
22
|
+
return slice;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.useStoreWithEqualityFn = useStoreWithEqualityFn;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const createStoreImpl = (createState) => {
|
|
4
|
+
let state;
|
|
5
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
const setState = (partial, replace) => {
|
|
7
|
+
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
8
|
+
if (!Object.is(nextState, state)) {
|
|
9
|
+
const previousState = state;
|
|
10
|
+
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
11
|
+
listeners.forEach((listener) => listener(state, previousState));
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const getState = () => state;
|
|
15
|
+
const getInitialState = () => initialState;
|
|
16
|
+
const subscribe = (listener) => {
|
|
17
|
+
listeners.add(listener);
|
|
18
|
+
return () => listeners.delete(listener);
|
|
19
|
+
};
|
|
20
|
+
const destroy = () => {
|
|
21
|
+
if ((undefined ? undefined.MODE : void 0) !== "production") {
|
|
22
|
+
console.warn(
|
|
23
|
+
"[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
listeners.clear();
|
|
27
|
+
};
|
|
28
|
+
const api = { setState, getState, getInitialState, subscribe, destroy };
|
|
29
|
+
const initialState = state = createState(setState, getState, api);
|
|
30
|
+
return api;
|
|
31
|
+
};
|
|
32
|
+
const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
33
|
+
|
|
34
|
+
exports.createStore = createStore;
|