@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ModalLayout, type ModalPosition, type ResponsiveModalPosition } from "./types";
|
|
2
|
+
export declare function hasHeightConstraint(className?: string): boolean;
|
|
3
|
+
export declare function isSidePosition(position: ModalPosition | null | undefined): boolean;
|
|
4
|
+
export declare function isVerticalEdgePosition(position: ModalPosition | null | undefined): boolean;
|
|
5
|
+
export declare function getModalPosition(position: ModalPosition): ModalPosition;
|
|
6
|
+
export declare function getModalLayout(position: ModalPosition, isMobile: boolean): ModalLayout;
|
|
7
|
+
export declare function getViewportIsMobile(): boolean;
|
|
8
|
+
export declare function resolveActivePosition(position: ModalPosition, responsivePosition: ResponsiveModalPosition | null | undefined, isMobileViewport: boolean): ModalPosition;
|
|
9
|
+
export declare function normalizePosition(input: ModalPosition | ResponsiveModalPosition | undefined): {
|
|
10
|
+
position: ModalPosition;
|
|
11
|
+
responsivePosition: ResponsiveModalPosition | null;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/modules/modal/layout.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC7B,MAAM,SAAS,CAAC;AAEjB,wBAAgB,mBAAmB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAI/D;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GACzC,OAAO,CAIT;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GACzC,OAAO,CAIT;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CAOvE;AACD,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,OAAO,GAChB,WAAW,CAQb;AAED,wBAAgB,mBAAmB,IAAI,OAAO,CAU7C;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EACvB,kBAAkB,EAAE,uBAAuB,GAAG,IAAI,GAAG,SAAS,EAC9D,gBAAgB,EAAE,OAAO,GACxB,aAAa,CAMf;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,aAAa,GAAG,uBAAuB,GAAG,SAAS,GACzD;IACD,QAAQ,EAAE,aAAa,CAAC;IACxB,kBAAkB,EAAE,uBAAuB,GAAG,IAAI,CAAC;CACpD,CAeA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/modules/modal/module.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/modules/modal/module.tsx"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,SAAS,CAAC;AAwCjB,eAAO,MAAM,WAAW,oIAiBtB,CAAC;AAEH,OAAO,QAAQ,gCAAgC,CAAC;IAC9C,UAAU,WAAW;QACnB,KAAK,EAAE,OAAO,WAAW,CAAC;KAC3B;IACD,UAAU,UAAU;QAClB,KAAK,CAAC,EAAE,eAAe,CAAC;KACzB;CACF;AAED,wBAAgB,WAAW,CACzB,UAAU,GAAE,kBAAuB,GAClC,eAAe,CAajB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/modules/modal/overlay.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAGL,KAAK,mBAAmB,EAIzB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/modules/modal/overlay.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAGL,KAAK,mBAAmB,EAIzB,MAAM,SAAS,CAAC;AAmHjB,wBAAgB,cAAc,CAAC,EAC7B,aAAa,EACb,QAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,EACN,MAAW,EACX,QAAe,GAChB,EAAE,mBAAmB,+BAoErB;AAuJD,wBAAgB,KAAK,uCAqDpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/modal/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAE3E,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/modal/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAE3E,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,MAA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,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,0BAA0B,GAAG,SAAS,GAAG,OAAO,CAAC;IAC1D,MAAM,CAAC,EAAE,0BAA0B,GAAG,SAAS,GAAG,OAAO,CAAC;IAC1D,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,cAAc,CAAC,CAAC;AAE/E,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9E,GAAG,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,MAAM,cAAc,GACtB,UAAU,GACV,MAAM,GACN,aAAa,GACb,SAAS,GACT,KAAK,GACL,OAAO,GACP,OAAO,GACP,OAAO,GACP,WAAW,GACX,aAAa,GACb,KAAK,GACL,WAAW,GACX,QAAQ,GACR,UAAU,GACV,UAAU,GACV,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,OAAO,CAAC;AAEZ,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,YAAY,GACZ,eAAe,GACf,aAAa,CAAC"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type NotificationContextValue, type NotificationProviderProps, type NotificationState } from "./types";
|
|
2
2
|
export declare const NotificationContext: import("react").Context<NotificationContextValue | null>;
|
|
3
|
+
export declare const NOOP_NOTIFICATION_STORE: import("@/utils").ExternalStore<NotificationState>;
|
|
3
4
|
export declare const NotificationProvider: ({ children, }: NotificationProviderProps) => import("react").JSX.Element;
|
|
4
|
-
export declare function useNotificationActions(): NotificationActions;
|
|
5
|
-
export declare function useNotificationState(): NotificationState;
|
|
6
|
-
export declare function useNotification(): NotificationState & NotificationActions;
|
|
7
|
-
export declare function useOptionalNotificationState(): NotificationState;
|
|
8
|
-
export declare function useOptionalNotificationState<T>(selector: (state: NotificationState) => T, isEqual?: (a: T, b: T) => boolean): T;
|
|
9
|
-
export declare function useOptionalNotificationActions(): NotificationActions;
|
|
10
|
-
export declare function useNotificationVisible(): boolean;
|
|
11
5
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/context.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,wBAAwB,EAE7B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EAEvB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,mBAAmB,0DAI7B,CAAC;AAEJ,eAAO,MAAM,uBAAuB,oDAEnC,CAAC;AAIF,eAAO,MAAM,oBAAoB,GAAI,eAElC,yBAAyB,gCAuF3B,CAAC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { type ToastController } from "./types";
|
|
1
|
+
import { type NotificationActions, type NotificationState, type ToastController } from "./types";
|
|
2
|
+
export declare function useNotificationActions(): NotificationActions;
|
|
3
|
+
export declare function useNotificationState(): NotificationState;
|
|
4
|
+
export declare function useNotification(): NotificationState & NotificationActions;
|
|
5
|
+
export declare function useOptionalNotificationState(): NotificationState;
|
|
6
|
+
export declare function useOptionalNotificationState<T>(selector: (state: NotificationState) => T, isEqual?: (a: T, b: T) => boolean): T;
|
|
7
|
+
export declare function useOptionalNotificationActions(): NotificationActions;
|
|
8
|
+
export declare function useNotificationVisible(): boolean;
|
|
2
9
|
export declare function useToast(defaultDuration?: number | null): ToastController;
|
|
3
10
|
export declare function NotificationListener(): null;
|
|
4
11
|
export declare function useNotificationContainerModel(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/hooks.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAGrB,MAAM,SAAS,CAAC;AAIjB,wBAAgB,sBAAsB,IAAI,mBAAmB,CAM5D;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAOxD;AAED,wBAAgB,eAAe,IAAI,iBAAiB,GAAG,mBAAmB,CAIzE;AAED,wBAAgB,4BAA4B,IAAI,iBAAiB,CAAC;AAClE,wBAAgB,4BAA4B,CAAC,CAAC,EAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,CAAC,EACzC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAChC,CAAC,CAAC;AAaL,wBAAgB,8BAA8B,IAAI,mBAAmB,CAGpE;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAIhD;AAED,wBAAgB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,CAoFzE;AAID,wBAAgB,oBAAoB,IAAI,IAAI,CAyB3C;AAED,wBAAgB,6BAA6B;;;;;EAgB5C"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DOCK_STACK_ELEMENT_ID, INITIAL_NOTIFICATION_STATE, INERT_NOTIFICATION_ACTIONS, SESSION_EXPIRED_MESSAGE, TOAST_DURATIONS, notificationTheme, } from "./constants";
|
|
2
|
-
export { NotificationContext, NotificationProvider,
|
|
3
|
-
export { useToast } from "./hooks";
|
|
2
|
+
export { NotificationContext, NotificationProvider, NOOP_NOTIFICATION_STORE, } from "./context";
|
|
3
|
+
export { NotificationListener, useNotification, useNotificationActions, useNotificationContainerModel, useNotificationState, useNotificationVisible, useOptionalNotificationActions, useOptionalNotificationState, useToast, } from "./hooks";
|
|
4
4
|
export { notificationModule } from "./module";
|
|
5
|
-
export
|
|
5
|
+
export { createNotificationEntry, getActiveNotification, getOutcomeMessage, isNotificationDataObject, normalizeDuration, normalizeFeedbackText, normalizeToastOptions, withDefaultDuration, } from "./state";
|
|
6
|
+
export type * from "./types";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,eAAe,EACf,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,8BAA8B,EAC9B,4BAA4B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,eAAe,EACf,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,EACtB,8BAA8B,EAC9B,4BAA4B,EAC5B,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,mBAAmB,SAAS,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext,
|
|
4
|
+
import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext, useSyncExternalStore, use, useLayoutEffect } from 'react';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import { AnimatePresence, motion } from 'motion/react';
|
|
@@ -347,7 +347,12 @@ var INERT_NOTIFICATION_ACTIONS = Object.freeze({
|
|
|
347
347
|
showNotification: () => null
|
|
348
348
|
});
|
|
349
349
|
|
|
350
|
-
// src/
|
|
350
|
+
// src/result.ts
|
|
351
|
+
function isResult(value) {
|
|
352
|
+
return typeof value === "object" && value !== null && "success" in value && typeof value.success === "boolean" && ("data" in value && value.success === true || "error" in value && value.success === false);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// src/modules/notification/state.ts
|
|
351
356
|
function normalizeFeedbackText(value) {
|
|
352
357
|
if (typeof value !== "string") return value;
|
|
353
358
|
return value.trim().replace(/[.\s]+$/, "");
|
|
@@ -362,6 +367,12 @@ function getActiveNotification(notifications) {
|
|
|
362
367
|
function normalizeToastOptions(options) {
|
|
363
368
|
return typeof options === "number" ? { duration: options } : options || {};
|
|
364
369
|
}
|
|
370
|
+
function normalizeDuration(value) {
|
|
371
|
+
if (value === null) return null;
|
|
372
|
+
if (value === void 0) return TOAST_DURATIONS.DEFAULT;
|
|
373
|
+
const duration = Number(value);
|
|
374
|
+
return Number.isFinite(duration) && duration > 0 ? duration : null;
|
|
375
|
+
}
|
|
365
376
|
function withDefaultDuration(duration, options) {
|
|
366
377
|
const normalized = normalizeToastOptions(options);
|
|
367
378
|
return {
|
|
@@ -372,17 +383,41 @@ function withDefaultDuration(duration, options) {
|
|
|
372
383
|
function isNotificationDataObject(value) {
|
|
373
384
|
return isObject(value) && "message" in value;
|
|
374
385
|
}
|
|
386
|
+
function resolveMessage(message, arg) {
|
|
387
|
+
return typeof message === "function" ? message(arg) : message;
|
|
388
|
+
}
|
|
389
|
+
function getOutcomeMessage(value, messages) {
|
|
390
|
+
if (!isResult(value)) return resolveMessage(messages.success, value);
|
|
391
|
+
return value.success ? resolveMessage(messages.success, value.data) : resolveMessage(messages.error, value.error) || toUserMessage(value.error);
|
|
392
|
+
}
|
|
393
|
+
function createNotificationEntry(messageOrData, options, fallbackId) {
|
|
394
|
+
const normalizedOptions = normalizeToastOptions(options);
|
|
395
|
+
const payload = isNotificationDataObject(messageOrData) ? { ...normalizedOptions, ...messageOrData } : { ...normalizedOptions, message: messageOrData };
|
|
396
|
+
const normalizedMessage = normalizeFeedbackText(payload.message);
|
|
397
|
+
if (normalizedMessage === null || normalizedMessage === void 0 || normalizedMessage === "") {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
const id = payload.dedupeKey || payload.id || (typeof normalizedMessage === "string" ? normalizedMessage.slice(0, 64) : fallbackId || `notification-${Date.now()}`);
|
|
401
|
+
const entry = {
|
|
402
|
+
dedupeKey: payload.dedupeKey,
|
|
403
|
+
duration: payload.duration,
|
|
404
|
+
id,
|
|
405
|
+
message: normalizedMessage,
|
|
406
|
+
timestamp: Date.now()
|
|
407
|
+
};
|
|
408
|
+
return {
|
|
409
|
+
duration: normalizeDuration(payload.duration),
|
|
410
|
+
entry
|
|
411
|
+
};
|
|
412
|
+
}
|
|
375
413
|
var NotificationContext = getOrCreateGlobalContext(
|
|
376
414
|
"NotificationContext",
|
|
377
415
|
null
|
|
378
416
|
);
|
|
417
|
+
var NOOP_NOTIFICATION_STORE = createStore(
|
|
418
|
+
INITIAL_NOTIFICATION_STATE
|
|
419
|
+
);
|
|
379
420
|
var notificationIdCounter = 0;
|
|
380
|
-
function normalizeDuration(value) {
|
|
381
|
-
if (value === null) return null;
|
|
382
|
-
if (value === void 0) return TOAST_DURATIONS.DEFAULT;
|
|
383
|
-
const duration = Number(value);
|
|
384
|
-
return Number.isFinite(duration) && duration > 0 ? duration : null;
|
|
385
|
-
}
|
|
386
421
|
var NotificationProvider = ({
|
|
387
422
|
children
|
|
388
423
|
}) => {
|
|
@@ -420,23 +455,17 @@ var NotificationProvider = ({
|
|
|
420
455
|
}, [clearTimers, store]);
|
|
421
456
|
const showNotification = useCallback(
|
|
422
457
|
(messageOrData, options) => {
|
|
423
|
-
const
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
458
|
+
const fallbackId = `notification-${++notificationIdCounter}`;
|
|
459
|
+
const result = createNotificationEntry(
|
|
460
|
+
messageOrData,
|
|
461
|
+
options,
|
|
462
|
+
fallbackId
|
|
463
|
+
);
|
|
464
|
+
if (!result) return null;
|
|
465
|
+
const { entry, duration } = result;
|
|
466
|
+
const { id } = entry;
|
|
430
467
|
clearTimers();
|
|
431
|
-
const entry = {
|
|
432
|
-
dedupeKey: payload.dedupeKey,
|
|
433
|
-
duration: payload.duration,
|
|
434
|
-
id,
|
|
435
|
-
message: normalizedMessage,
|
|
436
|
-
timestamp: Date.now()
|
|
437
|
-
};
|
|
438
468
|
store.publish({ notifications: { [id]: entry } });
|
|
439
|
-
const duration = normalizeDuration(payload.duration);
|
|
440
469
|
if (duration) {
|
|
441
470
|
timersRef.current.set(
|
|
442
471
|
id,
|
|
@@ -461,6 +490,7 @@ var NotificationProvider = ({
|
|
|
461
490
|
);
|
|
462
491
|
return /* @__PURE__ */ jsx(NotificationContext, { value, children });
|
|
463
492
|
};
|
|
493
|
+
var toastPromiseIdCounter = 0;
|
|
464
494
|
function useNotificationActions() {
|
|
465
495
|
return useRequiredContext(
|
|
466
496
|
NotificationContext,
|
|
@@ -481,9 +511,6 @@ function useNotification() {
|
|
|
481
511
|
const state = useNotificationState();
|
|
482
512
|
return useMemo(() => ({ ...actions, ...state }), [actions, state]);
|
|
483
513
|
}
|
|
484
|
-
var NOOP_NOTIFICATION_STORE = createStore(
|
|
485
|
-
INITIAL_NOTIFICATION_STATE
|
|
486
|
-
);
|
|
487
514
|
function useOptionalNotificationState(selector, isEqual) {
|
|
488
515
|
const ctx = useContext(NotificationContext);
|
|
489
516
|
return useStore(
|
|
@@ -501,21 +528,6 @@ function useNotificationVisible() {
|
|
|
501
528
|
({ notifications }) => Object.keys(notifications).length > 0
|
|
502
529
|
);
|
|
503
530
|
}
|
|
504
|
-
|
|
505
|
-
// src/result.ts
|
|
506
|
-
function isResult(value) {
|
|
507
|
-
return typeof value === "object" && value !== null && "success" in value && typeof value.success === "boolean" && ("data" in value && value.success === true || "error" in value && value.success === false);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
// src/modules/notification/hooks.ts
|
|
511
|
-
var toastPromiseIdCounter = 0;
|
|
512
|
-
function resolveMessage(message, arg) {
|
|
513
|
-
return typeof message === "function" ? message(arg) : message;
|
|
514
|
-
}
|
|
515
|
-
function getOutcomeMessage(value, messages) {
|
|
516
|
-
if (!isResult(value)) return resolveMessage(messages.success, value);
|
|
517
|
-
return value.success ? resolveMessage(messages.success, value.data) : resolveMessage(messages.error, value.error) || toUserMessage(value.error);
|
|
518
|
-
}
|
|
519
531
|
function useToast(defaultDuration) {
|
|
520
532
|
const { dismissAllNotifications, dismissNotification, showNotification } = useNotificationActions();
|
|
521
533
|
const resolvedDefaultDuration = defaultDuration ?? TOAST_DURATIONS.DEFAULT;
|
|
@@ -535,10 +547,8 @@ function useToast(defaultDuration) {
|
|
|
535
547
|
);
|
|
536
548
|
const fromResult = useCallback(
|
|
537
549
|
(result, messages = {}, options) => {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
if (message) triggerToast(message, options);
|
|
541
|
-
}
|
|
550
|
+
const message = getOutcomeMessage(result, messages);
|
|
551
|
+
if (message) triggerToast(message, options);
|
|
542
552
|
return result;
|
|
543
553
|
},
|
|
544
554
|
[triggerToast]
|
|
@@ -816,6 +826,6 @@ var notificationModule = defineModule({
|
|
|
816
826
|
}
|
|
817
827
|
});
|
|
818
828
|
|
|
819
|
-
export { DOCK_STACK_ELEMENT_ID, INERT_NOTIFICATION_ACTIONS, INITIAL_NOTIFICATION_STATE, NotificationContext, NotificationProvider, SESSION_EXPIRED_MESSAGE, TOAST_DURATIONS, notificationModule, notificationTheme, useNotification, useNotificationActions, useNotificationState, useNotificationVisible, useOptionalNotificationActions, useOptionalNotificationState, useToast };
|
|
829
|
+
export { DOCK_STACK_ELEMENT_ID, INERT_NOTIFICATION_ACTIONS, INITIAL_NOTIFICATION_STATE, NOOP_NOTIFICATION_STORE, NotificationContext, NotificationListener, NotificationProvider, SESSION_EXPIRED_MESSAGE, TOAST_DURATIONS, createNotificationEntry, getActiveNotification, getOutcomeMessage, isNotificationDataObject, normalizeDuration, normalizeFeedbackText, normalizeToastOptions, notificationModule, notificationTheme, useNotification, useNotificationActions, useNotificationContainerModel, useNotificationState, useNotificationVisible, useOptionalNotificationActions, useOptionalNotificationState, useToast, withDefaultDuration };
|
|
820
830
|
//# sourceMappingURL=index.js.map
|
|
821
831
|
//# sourceMappingURL=index.js.map
|