@omerdlw/base-framework 1.0.2 → 1.0.4
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/index.js +5240 -5165
- package/dist/index.js.map +1 -1
- package/dist/kernel/compose.d.ts.map +1 -1
- package/dist/kernel/handlers.d.ts.map +1 -1
- package/dist/kernel/hooks.d.ts.map +1 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/kernel/operations.d.ts.map +1 -1
- package/dist/kernel/schema.d.ts +0 -2
- package/dist/kernel/schema.d.ts.map +1 -1
- package/dist/kernel/store.d.ts.map +1 -1
- package/dist/kernel/types.d.ts.map +1 -1
- package/dist/kernel/utils.d.ts +0 -2
- package/dist/kernel/utils.d.ts.map +1 -1
- package/dist/modules/ambient/color.d.ts +16 -0
- package/dist/modules/ambient/color.d.ts.map +1 -0
- package/dist/modules/ambient/constants.d.ts +0 -17
- package/dist/modules/ambient/constants.d.ts.map +1 -1
- package/dist/modules/ambient/context.d.ts +1 -7
- package/dist/modules/ambient/context.d.ts.map +1 -1
- package/dist/modules/ambient/dom.d.ts +19 -0
- package/dist/modules/ambient/dom.d.ts.map +1 -0
- package/dist/modules/ambient/extractor.d.ts +5 -0
- package/dist/modules/ambient/extractor.d.ts.map +1 -0
- package/dist/modules/ambient/hooks.d.ts +9 -0
- package/dist/modules/ambient/hooks.d.ts.map +1 -0
- package/dist/modules/ambient/index.d.ts +7 -4
- package/dist/modules/ambient/index.d.ts.map +1 -1
- package/dist/modules/ambient/index.js +66 -60
- package/dist/modules/ambient/index.js.map +1 -1
- package/dist/modules/ambient/module.d.ts +5 -1
- package/dist/modules/ambient/module.d.ts.map +1 -1
- package/dist/modules/background/constants.d.ts +1 -10
- package/dist/modules/background/constants.d.ts.map +1 -1
- package/dist/modules/background/context.d.ts +1 -13
- package/dist/modules/background/context.d.ts.map +1 -1
- package/dist/modules/background/hooks.d.ts +13 -118
- package/dist/modules/background/hooks.d.ts.map +1 -1
- package/dist/modules/background/index.d.ts +8 -3
- package/dist/modules/background/index.d.ts.map +1 -1
- package/dist/modules/background/index.js +975 -991
- package/dist/modules/background/index.js.map +1 -1
- package/dist/modules/background/module.d.ts +1 -0
- package/dist/modules/background/module.d.ts.map +1 -1
- package/dist/modules/background/overlay.d.ts +93 -2
- package/dist/modules/background/overlay.d.ts.map +1 -1
- package/dist/modules/background/playback.d.ts +10 -0
- package/dist/modules/background/playback.d.ts.map +1 -0
- package/dist/modules/background/state.d.ts +9 -0
- package/dist/modules/background/state.d.ts.map +1 -0
- package/dist/modules/background/{utils.d.ts → visual.d.ts} +6 -14
- package/dist/modules/background/visual.d.ts.map +1 -0
- package/dist/modules/background/youtube/player.d.ts +28 -0
- package/dist/modules/background/youtube/player.d.ts.map +1 -0
- package/dist/modules/context-menu/context.d.ts +1 -10
- package/dist/modules/context-menu/context.d.ts.map +1 -1
- package/dist/modules/context-menu/dom.d.ts +8 -0
- package/dist/modules/context-menu/dom.d.ts.map +1 -0
- package/dist/modules/context-menu/hooks.d.ts +11 -11
- package/dist/modules/context-menu/hooks.d.ts.map +1 -1
- package/dist/modules/context-menu/index.d.ts +8 -3
- package/dist/modules/context-menu/index.d.ts.map +1 -1
- package/dist/modules/context-menu/index.js +97 -101
- package/dist/modules/context-menu/index.js.map +1 -1
- package/dist/modules/context-menu/{utils.d.ts → items.d.ts} +2 -9
- package/dist/modules/context-menu/items.d.ts.map +1 -0
- package/dist/modules/context-menu/module.d.ts.map +1 -1
- package/dist/modules/context-menu/overlay.d.ts +13 -1
- package/dist/modules/context-menu/overlay.d.ts.map +1 -1
- package/dist/modules/context-menu/state.d.ts +1 -0
- package/dist/modules/context-menu/state.d.ts.map +1 -1
- package/dist/modules/controls/{utils.d.ts → entries.d.ts} +6 -5
- package/dist/modules/controls/entries.d.ts.map +1 -0
- package/dist/modules/controls/hooks.d.ts +0 -7
- package/dist/modules/controls/hooks.d.ts.map +1 -1
- package/dist/modules/controls/index.d.ts +5 -3
- package/dist/modules/controls/index.d.ts.map +1 -1
- package/dist/modules/controls/index.js +66 -61
- package/dist/modules/controls/index.js.map +1 -1
- package/dist/modules/controls/layout.d.ts +7 -0
- package/dist/modules/controls/layout.d.ts.map +1 -0
- package/dist/modules/controls/overlay.d.ts +9 -0
- package/dist/modules/controls/overlay.d.ts.map +1 -1
- package/dist/modules/dock/cards.d.ts.map +1 -1
- package/dist/modules/dock/dom.d.ts +24 -0
- package/dist/modules/dock/dom.d.ts.map +1 -0
- package/dist/modules/dock/helpers.d.ts +25 -0
- package/dist/modules/dock/helpers.d.ts.map +1 -0
- package/dist/modules/dock/hooks.d.ts +3 -918
- package/dist/modules/dock/hooks.d.ts.map +1 -1
- package/dist/modules/dock/index.d.ts +3 -2
- package/dist/modules/dock/index.d.ts.map +1 -1
- package/dist/modules/dock/index.js +3091 -3079
- package/dist/modules/dock/index.js.map +1 -1
- package/dist/modules/dock/layout.d.ts +26 -0
- package/dist/modules/dock/layout.d.ts.map +1 -0
- package/dist/modules/dock/module.d.ts.map +1 -1
- package/dist/modules/dock/overlay.d.ts.map +1 -1
- package/dist/modules/dock/paths.d.ts +10 -0
- package/dist/modules/dock/paths.d.ts.map +1 -0
- package/dist/modules/dock/provider.d.ts.map +1 -1
- package/dist/modules/dock/runtime/display.d.ts.map +1 -1
- package/dist/modules/dock/runtime/dock.d.ts.map +1 -1
- package/dist/modules/dock/runtime/pipeline.d.ts +32 -0
- package/dist/modules/dock/runtime/pipeline.d.ts.map +1 -0
- package/dist/modules/dock/status/events.d.ts.map +1 -1
- package/dist/modules/dock/styles.d.ts +900 -0
- package/dist/modules/dock/styles.d.ts.map +1 -0
- package/dist/modules/dock/surface/context.d.ts +1 -2
- package/dist/modules/dock/surface/context.d.ts.map +1 -1
- package/dist/modules/dock/surface/definition.d.ts.map +1 -1
- package/dist/modules/dock/surface/helpers.d.ts +7 -0
- package/dist/modules/dock/surface/helpers.d.ts.map +1 -0
- package/dist/modules/dock/surface/hooks.d.ts.map +1 -1
- package/dist/modules/dock/surface/machine.d.ts.map +1 -1
- package/dist/modules/dock/surface/stack.d.ts.map +1 -1
- package/dist/modules/dock/surface/view-model.d.ts.map +1 -1
- package/dist/modules/dock/types.d.ts.map +1 -1
- package/dist/modules/index.js +4861 -4788
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/loading/context.d.ts +2 -13
- package/dist/modules/loading/context.d.ts.map +1 -1
- package/dist/modules/loading/hooks.d.ts +15 -2
- package/dist/modules/loading/hooks.d.ts.map +1 -1
- package/dist/modules/loading/index.d.ts +3 -2
- package/dist/modules/loading/index.d.ts.map +1 -1
- package/dist/modules/loading/index.js +38 -34
- package/dist/modules/loading/index.js.map +1 -1
- package/dist/modules/loading/module.d.ts.map +1 -1
- package/dist/modules/loading/state.d.ts +6 -0
- package/dist/modules/loading/state.d.ts.map +1 -0
- package/dist/modules/media/constants.d.ts +0 -1
- package/dist/modules/media/constants.d.ts.map +1 -1
- package/dist/modules/media/context.d.ts +2 -6
- package/dist/modules/media/context.d.ts.map +1 -1
- package/dist/modules/media/hooks.d.ts +6 -1
- package/dist/modules/media/hooks.d.ts.map +1 -1
- package/dist/modules/media/index.d.ts +4 -3
- package/dist/modules/media/index.d.ts.map +1 -1
- package/dist/modules/media/index.js +100 -98
- package/dist/modules/media/index.js.map +1 -1
- package/dist/modules/media/module.d.ts.map +1 -1
- package/dist/modules/media/overlay.d.ts +0 -5
- package/dist/modules/media/overlay.d.ts.map +1 -1
- package/dist/modules/media/playback.d.ts +5 -0
- package/dist/modules/media/playback.d.ts.map +1 -0
- package/dist/modules/media/session.d.ts +8 -0
- package/dist/modules/media/session.d.ts.map +1 -0
- package/dist/modules/media/types.d.ts +0 -1
- package/dist/modules/media/types.d.ts.map +1 -1
- package/dist/modules/modal/context.d.ts +1 -12
- package/dist/modules/modal/context.d.ts.map +1 -1
- package/dist/modules/modal/dom.d.ts +4 -0
- package/dist/modules/modal/dom.d.ts.map +1 -0
- package/dist/modules/modal/header.d.ts +7 -0
- package/dist/modules/modal/header.d.ts.map +1 -0
- package/dist/modules/modal/hooks.d.ts +12 -1
- package/dist/modules/modal/hooks.d.ts.map +1 -1
- package/dist/modules/modal/identity.d.ts +7 -0
- package/dist/modules/modal/identity.d.ts.map +1 -0
- package/dist/modules/modal/index.d.ts +9 -4
- package/dist/modules/modal/index.d.ts.map +1 -1
- package/dist/modules/modal/index.js +118 -86
- package/dist/modules/modal/index.js.map +1 -1
- package/dist/modules/modal/layout.d.ts +13 -0
- package/dist/modules/modal/layout.d.ts.map +1 -0
- package/dist/modules/modal/module.d.ts.map +1 -1
- package/dist/modules/modal/overlay.d.ts.map +1 -1
- package/dist/modules/modal/types.d.ts.map +1 -1
- package/dist/modules/notification/context.d.ts +2 -8
- package/dist/modules/notification/context.d.ts.map +1 -1
- package/dist/modules/notification/hooks.d.ts +8 -1
- package/dist/modules/notification/hooks.d.ts.map +1 -1
- package/dist/modules/notification/index.d.ts +4 -3
- package/dist/modules/notification/index.d.ts.map +1 -1
- package/dist/modules/notification/index.js +56 -46
- package/dist/modules/notification/index.js.map +1 -1
- package/dist/modules/notification/state.d.ts +17 -0
- package/dist/modules/notification/state.d.ts.map +1 -0
- package/dist/provider.js.map +1 -1
- package/docs/modules/ambient.md +12 -8
- package/docs/modules/background.md +15 -13
- package/docs/modules/context-menu.md +13 -13
- package/docs/modules/controls.md +4 -3
- package/docs/modules/dock.md +8 -2
- package/docs/modules/loading.md +11 -11
- package/docs/modules/media.md +8 -7
- package/docs/modules/modal.md +4 -1
- package/docs/modules/notification.md +4 -4
- package/package.json +1 -1
- package/dist/modules/ambient/utils.d.ts +0 -18
- package/dist/modules/ambient/utils.d.ts.map +0 -1
- package/dist/modules/background/utils.d.ts.map +0 -1
- package/dist/modules/context-menu/utils.d.ts.map +0 -1
- package/dist/modules/controls/utils.d.ts.map +0 -1
- package/dist/modules/dock/utils.d.ts +0 -93
- package/dist/modules/dock/utils.d.ts.map +0 -1
- package/dist/modules/loading/utils.d.ts +0 -4
- package/dist/modules/loading/utils.d.ts.map +0 -1
- package/dist/modules/media/utils.d.ts +0 -17
- package/dist/modules/media/utils.d.ts.map +0 -1
- package/dist/modules/modal/utils.d.ts +0 -31
- package/dist/modules/modal/utils.d.ts.map +0 -1
- package/dist/modules/notification/utils.d.ts +0 -9
- package/dist/modules/notification/utils.d.ts.map +0 -1
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type LoadingActions, type LoadingContextValue, type LoadingPageConfig, type LoadingProviderProps, type LoadingStateWithPage } from "./types";
|
|
1
|
+
import { type LoadingContextValue, type LoadingProviderProps, type LoadingStateWithPage } from "./types";
|
|
3
2
|
export declare const LoadingContext: import("react").Context<LoadingContextValue | null>;
|
|
4
|
-
export declare
|
|
5
|
-
enabled?: boolean;
|
|
6
|
-
}): void;
|
|
3
|
+
export declare const NOOP_LOADING_STORE: import("@/utils").ExternalStore<LoadingStateWithPage>;
|
|
7
4
|
export declare function LoadingProvider({ children }: LoadingProviderProps): import("react").JSX.Element;
|
|
8
|
-
export declare function useLoadingState(): LoadingStateWithPage;
|
|
9
|
-
export declare function useLoadingActions(): LoadingActions;
|
|
10
|
-
export declare function useLoading(config?: LoadingPageConfig | null, options?: RegistryMetadata & {
|
|
11
|
-
enabled?: boolean;
|
|
12
|
-
}): LoadingStateWithPage & LoadingActions;
|
|
13
|
-
export declare function useOptionalLoadingState(): LoadingStateWithPage;
|
|
14
|
-
export declare function useOptionalLoadingState<T>(selector: (state: LoadingStateWithPage) => T, isEqual?: (a: T, b: T) => boolean): T;
|
|
15
|
-
export declare function useOptionalLoadingActions(): LoadingActions;
|
|
16
5
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/modules/loading/context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/modules/loading/context.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAEL,KAAK,mBAAmB,EAExB,KAAK,oBAAoB,EAEzB,KAAK,oBAAoB,EAE1B,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,cAAc,qDACmD,CAAC;AAE/E,eAAO,MAAM,kBAAkB,uDAE9B,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,oBAAoB,+BA8HjE"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
import { type RegistryMetadata } from "@/kernel";
|
|
2
|
+
import { type LoadingActions, type LoadingPageConfig, type LoadingStateWithPage, type LoadingTheme } from "./types";
|
|
3
|
+
export declare function useLoadingRegistration(config: LoadingPageConfig | null | undefined, options?: RegistryMetadata & {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
}): void;
|
|
6
|
+
export declare function useLoadingState(): LoadingStateWithPage;
|
|
7
|
+
export declare function useLoadingActions(): LoadingActions;
|
|
8
|
+
export declare function useLoading(config?: LoadingPageConfig | null, options?: RegistryMetadata & {
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
}): LoadingStateWithPage & LoadingActions;
|
|
11
|
+
export declare function useOptionalLoadingState(): LoadingStateWithPage;
|
|
12
|
+
export declare function useOptionalLoadingState<T>(selector: (state: LoadingStateWithPage) => T, isEqual?: (a: T, b: T) => boolean): T;
|
|
13
|
+
export declare function useOptionalLoadingActions(): LoadingActions;
|
|
1
14
|
export declare function useLoadingOverlayModel(): {
|
|
2
|
-
skeleton:
|
|
15
|
+
skeleton: React.ReactNode | null;
|
|
3
16
|
isVisible: boolean;
|
|
4
|
-
theme:
|
|
17
|
+
theme: LoadingTheme;
|
|
5
18
|
};
|
|
6
19
|
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/modules/loading/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/modules/loading/hooks.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,UAAU,CAAC;AAUlB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,EAC5C,OAAO,CAAC,EAAE,gBAAgB,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GACjD,IAAI,CAEN;AAED,wBAAgB,eAAe,IAAI,oBAAoB,CAOtD;AAED,wBAAgB,iBAAiB,IAAI,cAAc,CAMlD;AAED,wBAAgB,UAAU,CACxB,MAAM,CAAC,EAAE,iBAAiB,GAAG,IAAI,EACjC,OAAO,CAAC,EAAE,gBAAgB,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GACjD,oBAAoB,GAAG,cAAc,CAOvC;AAED,wBAAgB,uBAAuB,IAAI,oBAAoB,CAAC;AAChE,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,CAAC,EAC5C,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAChC,CAAC,CAAC;AAaL,wBAAgB,yBAAyB,IAAI,cAAc,CAG1D;AAED,wBAAgB,sBAAsB,IAAI;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;CACrB,CAQA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { LoadingOverlay } from "./overlay";
|
|
2
|
-
export { LoadingContext, LoadingProvider,
|
|
2
|
+
export { LoadingContext, LoadingProvider, NOOP_LOADING_STORE, } from "./context";
|
|
3
|
+
export { useLoading, useLoadingActions, useLoadingOverlayModel, useLoadingRegistration, useLoadingState, useOptionalLoadingActions, useOptionalLoadingState, } from "./hooks";
|
|
3
4
|
export { defineLoading, loadingModule } from "./module";
|
|
4
5
|
export { DEFAULT_LOADING_STATE, DEFAULT_LOADING_STATE_WITH_PAGE, INERT_LOADING_ACTIONS, LOADING_REGISTRY_KEY, loadingTheme, } from "./constants";
|
|
5
|
-
export { normalizeLoadingOptions, selectPageLoading } from "./
|
|
6
|
+
export { calculateRemainingMinDuration, normalizeLoadingOptions, resolveLoadingState, selectPageLoading, } from "./state";
|
|
6
7
|
export type * from "./types";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/loading/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/loading/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,mBAAmB,SAAS,CAAC"}
|
|
@@ -863,8 +863,6 @@ function useModuleRegistration(id, value, options) {
|
|
|
863
863
|
const config = coreModule && options?.enabled !== false && value != null ? { [id]: value } : null;
|
|
864
864
|
useRegistry(config, pickRegistryMetadata(options));
|
|
865
865
|
}
|
|
866
|
-
|
|
867
|
-
// src/theme.tsx
|
|
868
866
|
function defineThemeSpec(id) {
|
|
869
867
|
return Object.freeze({ id });
|
|
870
868
|
}
|
|
@@ -909,7 +907,7 @@ var INERT_LOADING_ACTIONS = Object.freeze({
|
|
|
909
907
|
var LOADING_REGISTRY_KEY = "page-loading";
|
|
910
908
|
var loadingTheme = defineThemeSpec("loading");
|
|
911
909
|
|
|
912
|
-
// src/modules/loading/
|
|
910
|
+
// src/modules/loading/state.ts
|
|
913
911
|
function normalizeLoadingOptions(options = {}) {
|
|
914
912
|
const minDuration = Number(options.minDuration);
|
|
915
913
|
return {
|
|
@@ -925,10 +923,30 @@ function selectPageLoading(loading) {
|
|
|
925
923
|
if (typeof loading === "string") return { isLoading: true, message: loading };
|
|
926
924
|
return loading;
|
|
927
925
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
926
|
+
function resolveLoadingState(manualState, registryLoading) {
|
|
927
|
+
if (registryLoading?.isLoading) {
|
|
928
|
+
const normalized = normalizeLoadingOptions(registryLoading);
|
|
929
|
+
return {
|
|
930
|
+
...normalized,
|
|
931
|
+
isLoading: true,
|
|
932
|
+
isPageLoading: true
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
return {
|
|
936
|
+
...manualState,
|
|
937
|
+
isPageLoading: manualState.isLoading
|
|
938
|
+
};
|
|
931
939
|
}
|
|
940
|
+
function calculateRemainingMinDuration(startTime, minDuration, now = Date.now()) {
|
|
941
|
+
if (startTime === null || minDuration <= 0) return 0;
|
|
942
|
+
const elapsed = now - startTime;
|
|
943
|
+
const remaining = minDuration - elapsed;
|
|
944
|
+
return remaining > 0 ? remaining : 0;
|
|
945
|
+
}
|
|
946
|
+
var LoadingContext = getOrCreateGlobalContext("LoadingContext", null);
|
|
947
|
+
var NOOP_LOADING_STORE = createStore(
|
|
948
|
+
DEFAULT_LOADING_STATE_WITH_PAGE
|
|
949
|
+
);
|
|
932
950
|
function LoadingProvider({ children }) {
|
|
933
951
|
const [manualState, setManualState] = useState(
|
|
934
952
|
DEFAULT_LOADING_STATE
|
|
@@ -966,14 +984,10 @@ function LoadingProvider({ children }) {
|
|
|
966
984
|
[clearStopTimer]
|
|
967
985
|
);
|
|
968
986
|
const stopLoading = useCallback(() => {
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
return;
|
|
974
|
-
}
|
|
975
|
-
const elapsed = Date.now() - startTime;
|
|
976
|
-
const remaining = activeMinDuration - elapsed;
|
|
987
|
+
const remaining = calculateRemainingMinDuration(
|
|
988
|
+
startTimeRef.current,
|
|
989
|
+
minDurationRef.current
|
|
990
|
+
);
|
|
977
991
|
if (remaining <= 0) {
|
|
978
992
|
resetState();
|
|
979
993
|
return;
|
|
@@ -1008,20 +1022,10 @@ function LoadingProvider({ children }) {
|
|
|
1008
1022
|
[startLoading, stopLoading]
|
|
1009
1023
|
);
|
|
1010
1024
|
useEffect(() => clearStopTimer, [clearStopTimer]);
|
|
1011
|
-
const state = useMemo(
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
...normalized,
|
|
1016
|
-
isLoading: true,
|
|
1017
|
-
isPageLoading: true
|
|
1018
|
-
};
|
|
1019
|
-
}
|
|
1020
|
-
return {
|
|
1021
|
-
...manualState,
|
|
1022
|
-
isPageLoading: manualState.isLoading
|
|
1023
|
-
};
|
|
1024
|
-
}, [manualState, registryLoading]);
|
|
1025
|
+
const state = useMemo(
|
|
1026
|
+
() => resolveLoadingState(manualState, registryLoading),
|
|
1027
|
+
[manualState, registryLoading]
|
|
1028
|
+
);
|
|
1025
1029
|
const actions = useMemo(
|
|
1026
1030
|
() => ({
|
|
1027
1031
|
setLoading,
|
|
@@ -1044,6 +1048,11 @@ function LoadingProvider({ children }) {
|
|
|
1044
1048
|
);
|
|
1045
1049
|
return /* @__PURE__ */ jsx(LoadingContext, { value, children });
|
|
1046
1050
|
}
|
|
1051
|
+
|
|
1052
|
+
// src/modules/loading/hooks.ts
|
|
1053
|
+
function useLoadingRegistration(config, options) {
|
|
1054
|
+
useModuleRegistration("loading", config, options);
|
|
1055
|
+
}
|
|
1047
1056
|
function useLoadingState() {
|
|
1048
1057
|
const { store } = useRequiredContext(
|
|
1049
1058
|
LoadingContext,
|
|
@@ -1065,9 +1074,6 @@ function useLoading(config, options) {
|
|
|
1065
1074
|
const state = useLoadingState();
|
|
1066
1075
|
return useMemo(() => ({ ...state, ...actions }), [actions, state]);
|
|
1067
1076
|
}
|
|
1068
|
-
var NOOP_LOADING_STORE = createStore(
|
|
1069
|
-
DEFAULT_LOADING_STATE_WITH_PAGE
|
|
1070
|
-
);
|
|
1071
1077
|
function useOptionalLoadingState(selector, isEqual) {
|
|
1072
1078
|
const ctx = useContext(LoadingContext);
|
|
1073
1079
|
return useStore(
|
|
@@ -1080,8 +1086,6 @@ function useOptionalLoadingActions() {
|
|
|
1080
1086
|
const ctx = useContext(LoadingContext);
|
|
1081
1087
|
return ctx?.actions ?? INERT_LOADING_ACTIONS;
|
|
1082
1088
|
}
|
|
1083
|
-
|
|
1084
|
-
// src/modules/loading/hooks.ts
|
|
1085
1089
|
function useLoadingOverlayModel() {
|
|
1086
1090
|
const { isLoading, skeleton, showOverlay } = useLoadingState();
|
|
1087
1091
|
const isFullscreenStateActive = useIsFullscreenStateActive();
|
|
@@ -1147,6 +1151,6 @@ var loadingModule = defineModule({
|
|
|
1147
1151
|
}
|
|
1148
1152
|
});
|
|
1149
1153
|
|
|
1150
|
-
export { DEFAULT_LOADING_STATE, DEFAULT_LOADING_STATE_WITH_PAGE, INERT_LOADING_ACTIONS, LOADING_REGISTRY_KEY, LoadingContext, LoadingOverlay, LoadingProvider, defineLoading, loadingModule, loadingTheme, normalizeLoadingOptions, selectPageLoading, useLoading, useLoadingActions, useLoadingRegistration, useLoadingState, useOptionalLoadingActions, useOptionalLoadingState };
|
|
1154
|
+
export { DEFAULT_LOADING_STATE, DEFAULT_LOADING_STATE_WITH_PAGE, INERT_LOADING_ACTIONS, LOADING_REGISTRY_KEY, LoadingContext, LoadingOverlay, LoadingProvider, NOOP_LOADING_STORE, calculateRemainingMinDuration, defineLoading, loadingModule, loadingTheme, normalizeLoadingOptions, resolveLoadingState, selectPageLoading, useLoading, useLoadingActions, useLoadingOverlayModel, useLoadingRegistration, useLoadingState, useOptionalLoadingActions, useOptionalLoadingState };
|
|
1151
1155
|
//# sourceMappingURL=index.js.map
|
|
1152
1156
|
//# sourceMappingURL=index.js.map
|