@progressive-development/pd-spa-helper 0.9.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PdSpaHelper.d.ts +83 -0
- package/dist/PdSpaHelper.d.ts.map +1 -0
- package/dist/PdSpaHelper.js +492 -0
- package/dist/defaultpage/default-confirm-popup.d.ts +19 -0
- package/dist/defaultpage/default-confirm-popup.d.ts.map +1 -0
- package/dist/defaultpage/default-confirm-popup.js +70 -0
- package/dist/defaultpage/default-dialog-popup.d.ts +19 -0
- package/dist/defaultpage/default-dialog-popup.d.ts.map +1 -0
- package/dist/defaultpage/default-dialog-popup.js +103 -0
- package/dist/defaultpage/default-login.d.ts +6 -0
- package/dist/defaultpage/default-login.d.ts.map +1 -0
- package/dist/defaultpage/default-login.js +33 -0
- package/dist/defaultpage/default-not-found.d.ts +6 -0
- package/dist/defaultpage/default-not-found.d.ts.map +1 -0
- package/dist/{components/default-not-found/DefaultNotFound.js → defaultpage/default-not-found.js} +3 -10
- package/dist/defaultpage/default-popup.d.ts +7 -0
- package/dist/defaultpage/default-popup.d.ts.map +1 -0
- package/dist/defaultpage/default-popup.js +24 -0
- package/dist/defaultpage/default-step-address.d.ts +14 -0
- package/dist/defaultpage/default-step-address.d.ts.map +1 -0
- package/dist/defaultpage/default-step-address.js +77 -0
- package/dist/defaultpage/default-step-summary.d.ts +28 -0
- package/dist/defaultpage/default-step-summary.d.ts.map +1 -0
- package/dist/defaultpage/default-step-summary.js +67 -0
- package/dist/defaultpage/default-view-page.d.ts +10 -0
- package/dist/defaultpage/default-view-page.d.ts.map +1 -0
- package/dist/defaultpage/default-view-page.js +70 -0
- package/dist/defaultpage/default-wizard.d.ts +37 -0
- package/dist/defaultpage/default-wizard.d.ts.map +1 -0
- package/dist/defaultpage/default-wizard.js +255 -0
- package/dist/defaultpage/pd-default-wizard-step.d.ts +60 -0
- package/dist/defaultpage/pd-default-wizard-step.d.ts.map +1 -0
- package/dist/defaultpage/pd-default-wizard-step.js +144 -0
- package/dist/generated/locale-wrapper/be-wrapper.d.ts +14 -49
- package/dist/generated/locale-wrapper/be-wrapper.d.ts.map +1 -1
- package/dist/generated/locale-wrapper/de-wrapper.d.ts +14 -49
- package/dist/generated/locale-wrapper/de-wrapper.d.ts.map +1 -1
- package/dist/generated/locale-wrapper/en-wrapper.d.ts +14 -49
- package/dist/generated/locale-wrapper/en-wrapper.d.ts.map +1 -1
- package/dist/generated/locales/be.d.ts +15 -1
- package/dist/generated/locales/be.d.ts.map +1 -1
- package/dist/generated/locales/be.js +15 -1
- package/dist/generated/locales/de.d.ts +15 -1
- package/dist/generated/locales/de.d.ts.map +1 -1
- package/dist/generated/locales/de.js +15 -1
- package/dist/generated/locales/en.d.ts +15 -1
- package/dist/generated/locales/en.d.ts.map +1 -1
- package/dist/generated/locales/en.js +15 -1
- package/dist/helper/blob-helper.d.ts +3 -0
- package/dist/helper/blob-helper.d.ts.map +1 -0
- package/dist/helper/blob-helper.js +35 -0
- package/dist/helper/date-helper.d.ts +27 -0
- package/dist/helper/date-helper.d.ts.map +1 -0
- package/dist/helper/date-helper.js +129 -0
- package/dist/helper/locale-format.d.ts +4 -0
- package/dist/helper/locale-format.d.ts.map +1 -0
- package/dist/helper/locale-format.js +16 -0
- package/dist/helper/logger.d.ts +12 -11
- package/dist/helper/logger.d.ts.map +1 -1
- package/dist/helper/logger.js +49 -10
- package/dist/helper/number-helper.d.ts +2 -0
- package/dist/helper/number-helper.d.ts.map +1 -0
- package/dist/helper/number-helper.js +13 -0
- package/dist/helper/price-helper.d.ts +5 -0
- package/dist/helper/price-helper.d.ts.map +1 -0
- package/dist/helper/price-helper.js +22 -0
- package/dist/helper/refresh-id-token.d.ts.map +1 -1
- package/dist/helper/refresh-id-token.js +4 -6
- package/dist/helper/text-helper.d.ts +3 -0
- package/dist/helper/text-helper.d.ts.map +1 -0
- package/dist/helper/text-helper.js +4 -0
- package/dist/index.d.ts +29 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -27
- package/dist/model/spa-model.d.ts +15 -14
- package/dist/model/spa-model.d.ts.map +1 -1
- package/dist/popup/wizard-close-popup.d.ts +11 -0
- package/dist/popup/wizard-close-popup.d.ts.map +1 -0
- package/dist/popup/wizard-close-popup.js +63 -0
- package/dist/popup/wizard-reload-popup.d.ts +14 -0
- package/dist/popup/wizard-reload-popup.d.ts.map +1 -0
- package/dist/popup/wizard-reload-popup.js +76 -0
- package/dist/router/PdRouterService.d.ts +1 -4
- package/dist/router/PdRouterService.d.ts.map +1 -1
- package/dist/router/PdRouterService.js +16 -40
- package/dist/service-provider/firebase/auth.d.ts +19 -0
- package/dist/service-provider/firebase/auth.d.ts.map +1 -0
- package/dist/service-provider/firebase/auth.js +62 -0
- package/dist/service-provider/firebase/firestorage-client.d.ts +22 -0
- package/dist/service-provider/firebase/firestorage-client.d.ts.map +1 -0
- package/dist/service-provider/firebase/firestorage-client.js +226 -0
- package/dist/service-provider/firebase/firestore-client.d.ts +12 -0
- package/dist/service-provider/firebase/firestore-client.d.ts.map +1 -0
- package/dist/service-provider/firebase/firestore-client.js +25 -0
- package/dist/service-provider/firebase/functions-client.d.ts +10 -0
- package/dist/service-provider/firebase/functions-client.d.ts.map +1 -0
- package/dist/service-provider/firebase/functions-client.js +63 -0
- package/dist/service-provider/firebase/messagingFirebaseClient.d.ts +9 -0
- package/dist/service-provider/firebase/messagingFirebaseClient.d.ts.map +1 -0
- package/dist/service-provider/firebase/messagingFirebaseClient.js +69 -0
- package/dist/service-provider/mock/auth.d.ts +6 -0
- package/dist/service-provider/mock/auth.d.ts.map +1 -0
- package/dist/service-provider/mock/auth.js +60 -0
- package/dist/service-provider/mock/function-client.d.ts +7 -0
- package/dist/service-provider/mock/function-client.d.ts.map +1 -0
- package/dist/service-provider/mock/function-client.js +30 -0
- package/dist/service-provider/mock/storage-client.d.ts +11 -0
- package/dist/service-provider/mock/storage-client.d.ts.map +1 -0
- package/dist/service-provider/mock/storage-client.js +106 -0
- package/dist/service-provider/service-provider-impl.d.ts +27 -0
- package/dist/service-provider/service-provider-impl.d.ts.map +1 -0
- package/dist/service-provider/service-provider-impl.js +222 -0
- package/dist/service-provider/service-provider-model.d.ts +10 -55
- package/dist/service-provider/service-provider-model.d.ts.map +1 -1
- package/dist/{db → store}/indexDB.d.ts +9 -9
- package/dist/store/indexDB.d.ts.map +1 -0
- package/dist/{db → store}/indexDB.js +12 -14
- package/dist/store/mini-rx.store.d.ts.map +1 -1
- package/dist/store/mini-rx.store.js +3 -1
- package/dist/store/spa-app-actions.d.ts +22 -5
- package/dist/store/spa-app-actions.d.ts.map +1 -1
- package/dist/store/spa-app-actions.js +8 -4
- package/dist/store/spa-app-effects.d.ts +17 -0
- package/dist/store/spa-app-effects.d.ts.map +1 -1
- package/dist/store/spa-app-effects.js +40 -2
- package/dist/store/spa-app-reducer.d.ts +10 -5
- package/dist/store/spa-app-reducer.d.ts.map +1 -1
- package/dist/store/spa-app-reducer.js +8 -13
- package/dist/store/spa-app-selector.d.ts +2 -2
- package/dist/store/spa-app-selector.d.ts.map +1 -1
- package/dist/store/spa-app-selector.js +1 -1
- package/dist/stories/address-edit.stories.d.ts +27 -0
- package/dist/stories/address-edit.stories.d.ts.map +1 -0
- package/dist/stories/address-new.stories.d.ts +33 -0
- package/dist/stories/address-new.stories.d.ts.map +1 -0
- package/dist/stories/default-confirm-popup.stories.d.ts +24 -0
- package/dist/stories/default-confirm-popup.stories.d.ts.map +1 -0
- package/dist/stories/default-dialog-popup.stories.d.ts +23 -0
- package/dist/stories/default-dialog-popup.stories.d.ts.map +1 -0
- package/dist/stories/default-login.stories.d.ts +10 -0
- package/dist/stories/default-login.stories.d.ts.map +1 -0
- package/dist/stories/default-popup.stories.d.ts +9 -0
- package/dist/stories/default-popup.stories.d.ts.map +1 -0
- package/dist/stories/pd-loading-state.stories.d.ts +30 -0
- package/dist/stories/pd-loading-state.stories.d.ts.map +1 -0
- package/dist/stories/pd-toast.stories.d.ts +27 -0
- package/dist/stories/pd-toast.stories.d.ts.map +1 -0
- package/dist/stories/routing.stories.d.ts +24 -0
- package/dist/stories/routing.stories.d.ts.map +1 -0
- package/dist/stories/test-impls/address-test.d.ts +6 -0
- package/dist/stories/test-impls/address-test.d.ts.map +1 -0
- package/dist/stories/test-impls/test-mock-app.d.ts +15 -0
- package/dist/stories/test-impls/test-mock-app.d.ts.map +1 -0
- package/dist/stories/test-impls/test-pages/test-home-page.d.ts +7 -0
- package/dist/stories/test-impls/test-pages/test-home-page.d.ts.map +1 -0
- package/dist/stories/test-impls/test-pages/test-not-found-page.d.ts +5 -0
- package/dist/stories/test-impls/test-pages/test-not-found-page.d.ts.map +1 -0
- package/dist/stories/test-impls/test-pages/test-wizard-step.d.ts +17 -0
- package/dist/stories/test-impls/test-pages/test-wizard-step.d.ts.map +1 -0
- package/dist/stories/test-impls/test-pages/test-wizard.d.ts +16 -0
- package/dist/stories/test-impls/test-pages/test-wizard.d.ts.map +1 -0
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-error.d.ts +8 -0
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-error.d.ts.map +1 -0
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-info.d.ts +8 -0
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-info.d.ts.map +1 -0
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-warn.d.ts +8 -0
- package/dist/stories/test-impls/test-popups/default-confirm-popup-test-warn.d.ts.map +1 -0
- package/dist/stories/test-impls/test-popups/default-dialog-popup-test.d.ts +13 -0
- package/dist/stories/test-impls/test-popups/default-dialog-popup-test.d.ts.map +1 -0
- package/dist/stories/test-impls/test-popups/default-popup-test.d.ts +5 -0
- package/dist/stories/test-impls/test-popups/default-popup-test.d.ts.map +1 -0
- package/dist/stories/test-wizard-step.stories.d.ts +11 -0
- package/dist/stories/test-wizard-step.stories.d.ts.map +1 -0
- package/dist/stories/test-wizard.stories.d.ts +9 -0
- package/dist/stories/test-wizard.stories.d.ts.map +1 -0
- package/dist/tmpown/pd-loading-state.d.ts +9 -0
- package/dist/tmpown/pd-loading-state.d.ts.map +1 -0
- package/dist/tmpown/pd-loading-state.js +196 -0
- package/dist/tmpown/pd-login.d.ts +13 -0
- package/dist/tmpown/pd-login.d.ts.map +1 -0
- package/dist/tmpown/pd-login.js +165 -0
- package/dist/tmpown/pd-toast.d.ts +13 -0
- package/dist/tmpown/pd-toast.d.ts.map +1 -0
- package/dist/tmpown/pd-toast.js +127 -0
- package/package.json +9 -14
- package/dist/auth/AuthController.d.ts +0 -37
- package/dist/auth/AuthController.d.ts.map +0 -1
- package/dist/auth/AuthController.js +0 -65
- package/dist/auth/auth-directives.d.ts +0 -59
- package/dist/auth/auth-directives.d.ts.map +0 -1
- package/dist/auth/auth-directives.js +0 -81
- package/dist/auth/auth-utils.d.ts +0 -45
- package/dist/auth/auth-utils.d.ts.map +0 -1
- package/dist/auth/auth-utils.js +0 -42
- package/dist/auth/index.d.ts +0 -7
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/components/default-login/DefaultLogin.d.ts +0 -15
- package/dist/components/default-login/DefaultLogin.d.ts.map +0 -1
- package/dist/components/default-login/DefaultLogin.js +0 -120
- package/dist/components/default-not-found/DefaultNotFound.d.ts +0 -6
- package/dist/components/default-not-found/DefaultNotFound.d.ts.map +0 -1
- package/dist/components/pd-section-page/PdSectionPage.d.ts +0 -55
- package/dist/components/pd-section-page/PdSectionPage.d.ts.map +0 -1
- package/dist/components/pd-section-page/PdSectionPage.js +0 -37
- package/dist/components/pd-spa-helper/PdSpaHelper.d.ts +0 -196
- package/dist/components/pd-spa-helper/PdSpaHelper.d.ts.map +0 -1
- package/dist/components/pd-spa-helper/PdSpaHelper.js +0 -603
- package/dist/components/pd-spa-helper/controllers/ScrollController.d.ts +0 -77
- package/dist/components/pd-spa-helper/controllers/ScrollController.d.ts.map +0 -1
- package/dist/components/pd-spa-helper/controllers/ScrollController.js +0 -102
- package/dist/components/pd-spa-helper/spa-config.d.ts +0 -95
- package/dist/components/pd-spa-helper/spa-config.d.ts.map +0 -1
- package/dist/components/pd-spa-helper/spa-config.js +0 -175
- package/dist/components/pd-spa-helper/spa-events.d.ts +0 -132
- package/dist/components/pd-spa-helper/spa-events.d.ts.map +0 -1
- package/dist/components/pd-spa-helper/spa-events.js +0 -18
- package/dist/db/index.d.ts +0 -3
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/indexDB.d.ts.map +0 -1
- package/dist/model/index.d.ts +0 -4
- package/dist/model/index.d.ts.map +0 -1
- package/dist/router/index.d.ts +0 -3
- package/dist/router/index.d.ts.map +0 -1
- package/dist/screen-size/ScreenSizeController.d.ts +0 -34
- package/dist/screen-size/ScreenSizeController.d.ts.map +0 -1
- package/dist/screen-size/ScreenSizeController.js +0 -58
- package/dist/screen-size/ScreenSizeService.d.ts +0 -49
- package/dist/screen-size/ScreenSizeService.d.ts.map +0 -1
- package/dist/screen-size/ScreenSizeService.js +0 -107
- package/dist/screen-size/index.d.ts +0 -13
- package/dist/screen-size/index.d.ts.map +0 -1
- package/dist/screen-size/responsive-directives.d.ts +0 -59
- package/dist/screen-size/responsive-directives.d.ts.map +0 -1
- package/dist/screen-size/responsive-directives.js +0 -71
- package/dist/screen-size/types.d.ts +0 -44
- package/dist/screen-size/types.d.ts.map +0 -1
- package/dist/service-provider/ServiceRegistry.d.ts +0 -67
- package/dist/service-provider/ServiceRegistry.d.ts.map +0 -1
- package/dist/service-provider/ServiceRegistry.js +0 -76
- package/dist/service-provider/function-utils.d.ts +0 -55
- package/dist/service-provider/function-utils.d.ts.map +0 -1
- package/dist/service-provider/function-utils.js +0 -30
- package/dist/service-provider/index.d.ts +0 -10
- package/dist/service-provider/index.d.ts.map +0 -1
- package/dist/service-provider/interfaces/IAuthProvider.d.ts +0 -68
- package/dist/service-provider/interfaces/IAuthProvider.d.ts.map +0 -1
- package/dist/service-provider/interfaces/IDatabaseProvider.d.ts +0 -75
- package/dist/service-provider/interfaces/IDatabaseProvider.d.ts.map +0 -1
- package/dist/service-provider/interfaces/IFunctionProvider.d.ts +0 -49
- package/dist/service-provider/interfaces/IFunctionProvider.d.ts.map +0 -1
- package/dist/service-provider/interfaces/IStorageProvider.d.ts +0 -118
- package/dist/service-provider/interfaces/IStorageProvider.d.ts.map +0 -1
- package/dist/service-provider/interfaces/ServiceProvider.d.ts +0 -24
- package/dist/service-provider/interfaces/ServiceProvider.d.ts.map +0 -1
- package/dist/service-provider/interfaces/common.d.ts +0 -5
- package/dist/service-provider/interfaces/common.d.ts.map +0 -1
- package/dist/services/fire-once-service.d.ts +0 -35
- package/dist/services/fire-once-service.d.ts.map +0 -1
- package/dist/services/fire-once-service.js +0 -61
- package/dist/store/async-action-effects.d.ts +0 -179
- package/dist/store/async-action-effects.d.ts.map +0 -1
- package/dist/store/async-action-effects.js +0 -98
- package/dist/store/async-action-utils.d.ts +0 -154
- package/dist/store/async-action-utils.d.ts.map +0 -1
- package/dist/store/async-action-utils.js +0 -42
- package/dist/store/index.d.ts +0 -9
- package/dist/store/index.d.ts.map +0 -1
- package/dist/stories/introduction.stories.d.ts +0 -11
- package/dist/stories/introduction.stories.d.ts.map +0 -1
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Breakpoint, BreakpointConfig } from './types.js';
|
|
2
|
-
declare class ScreenSizeServiceImpl {
|
|
3
|
-
private _listeners;
|
|
4
|
-
private _currentBreakpoint;
|
|
5
|
-
private _width;
|
|
6
|
-
private _breakpoints;
|
|
7
|
-
constructor(breakpoints?: BreakpointConfig);
|
|
8
|
-
/** Current breakpoint name */
|
|
9
|
-
get breakpoint(): Breakpoint;
|
|
10
|
-
/** Current viewport width in pixels */
|
|
11
|
-
get width(): number;
|
|
12
|
-
/** True if viewport is extra small or small (< 768px) */
|
|
13
|
-
get isMobile(): boolean;
|
|
14
|
-
/** True if viewport is medium (768px - 1023px) */
|
|
15
|
-
get isTablet(): boolean;
|
|
16
|
-
/** True if viewport is large or extra large (>= 1024px) */
|
|
17
|
-
get isDesktop(): boolean;
|
|
18
|
-
/** Breakpoint order for fallback resolution */
|
|
19
|
-
get breakpointOrder(): readonly Breakpoint[];
|
|
20
|
-
/**
|
|
21
|
-
* Subscribe to breakpoint changes.
|
|
22
|
-
* Callback is called when the breakpoint changes (not on every resize).
|
|
23
|
-
*
|
|
24
|
-
* @param callback - Function to call when breakpoint changes
|
|
25
|
-
* @returns Unsubscribe function
|
|
26
|
-
*/
|
|
27
|
-
subscribe(callback: () => void): () => void;
|
|
28
|
-
/**
|
|
29
|
-
* Check if the current breakpoint matches the given breakpoint.
|
|
30
|
-
*/
|
|
31
|
-
is(breakpoint: Breakpoint): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Check if the current breakpoint is at least the given breakpoint.
|
|
34
|
-
* E.g., isAtLeast('md') returns true for md, lg, xl.
|
|
35
|
-
*/
|
|
36
|
-
isAtLeast(breakpoint: Breakpoint): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Check if the current breakpoint is at most the given breakpoint.
|
|
39
|
-
* E.g., isAtMost('md') returns true for xs, sm, md.
|
|
40
|
-
*/
|
|
41
|
-
isAtMost(breakpoint: Breakpoint): boolean;
|
|
42
|
-
private _handleResize;
|
|
43
|
-
private _updateSize;
|
|
44
|
-
private _notifyListeners;
|
|
45
|
-
}
|
|
46
|
-
/** Singleton instance of the screen size service */
|
|
47
|
-
export declare const screenSizeService: ScreenSizeServiceImpl;
|
|
48
|
-
export {};
|
|
49
|
-
//# sourceMappingURL=ScreenSizeService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenSizeService.d.ts","sourceRoot":"","sources":["../../src/screen-size/ScreenSizeService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAc/D,cAAM,qBAAqB;IACzB,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,kBAAkB,CAAoB;IAC9C,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,YAAY,CAAmB;gBAE3B,WAAW,GAAE,gBAAsC;IAS/D,8BAA8B;IAC9B,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED,uCAAuC;IACvC,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,yDAAyD;IACzD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,kDAAkD;IAClD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,2DAA2D;IAC3D,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,+CAA+C;IAC/C,IAAI,eAAe,IAAI,SAAS,UAAU,EAAE,CAE3C;IAED;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAK3C;;OAEG;IACH,EAAE,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAInC;;;OAGG;IACH,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAM1C;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAMzC,OAAO,CAAC,aAAa,CAOnB;IAEF,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,gBAAgB;CAGzB;AAED,oDAAoD;AACpD,eAAO,MAAM,iBAAiB,uBAA8B,CAAC"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
const DEFAULT_BREAKPOINTS = {
|
|
2
|
-
xs: 0,
|
|
3
|
-
sm: 640,
|
|
4
|
-
md: 768,
|
|
5
|
-
lg: 1024,
|
|
6
|
-
xl: 1280
|
|
7
|
-
};
|
|
8
|
-
const BREAKPOINT_ORDER = ["xs", "sm", "md", "lg", "xl"];
|
|
9
|
-
class ScreenSizeServiceImpl {
|
|
10
|
-
constructor(breakpoints = DEFAULT_BREAKPOINTS) {
|
|
11
|
-
this._listeners = /* @__PURE__ */ new Set();
|
|
12
|
-
this._currentBreakpoint = "lg";
|
|
13
|
-
this._width = 0;
|
|
14
|
-
this._handleResize = () => {
|
|
15
|
-
const oldBreakpoint = this._currentBreakpoint;
|
|
16
|
-
this._updateSize();
|
|
17
|
-
if (oldBreakpoint !== this._currentBreakpoint) {
|
|
18
|
-
this._notifyListeners();
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
this._breakpoints = breakpoints;
|
|
22
|
-
if (typeof window !== "undefined") {
|
|
23
|
-
this._updateSize();
|
|
24
|
-
window.addEventListener("resize", this._handleResize);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/** Current breakpoint name */
|
|
28
|
-
get breakpoint() {
|
|
29
|
-
return this._currentBreakpoint;
|
|
30
|
-
}
|
|
31
|
-
/** Current viewport width in pixels */
|
|
32
|
-
get width() {
|
|
33
|
-
return this._width;
|
|
34
|
-
}
|
|
35
|
-
/** True if viewport is extra small or small (< 768px) */
|
|
36
|
-
get isMobile() {
|
|
37
|
-
return this._currentBreakpoint === "xs" || this._currentBreakpoint === "sm";
|
|
38
|
-
}
|
|
39
|
-
/** True if viewport is medium (768px - 1023px) */
|
|
40
|
-
get isTablet() {
|
|
41
|
-
return this._currentBreakpoint === "md";
|
|
42
|
-
}
|
|
43
|
-
/** True if viewport is large or extra large (>= 1024px) */
|
|
44
|
-
get isDesktop() {
|
|
45
|
-
return this._currentBreakpoint === "lg" || this._currentBreakpoint === "xl";
|
|
46
|
-
}
|
|
47
|
-
/** Breakpoint order for fallback resolution */
|
|
48
|
-
get breakpointOrder() {
|
|
49
|
-
return BREAKPOINT_ORDER;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Subscribe to breakpoint changes.
|
|
53
|
-
* Callback is called when the breakpoint changes (not on every resize).
|
|
54
|
-
*
|
|
55
|
-
* @param callback - Function to call when breakpoint changes
|
|
56
|
-
* @returns Unsubscribe function
|
|
57
|
-
*/
|
|
58
|
-
subscribe(callback) {
|
|
59
|
-
this._listeners.add(callback);
|
|
60
|
-
return () => this._listeners.delete(callback);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Check if the current breakpoint matches the given breakpoint.
|
|
64
|
-
*/
|
|
65
|
-
is(breakpoint) {
|
|
66
|
-
return this._currentBreakpoint === breakpoint;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Check if the current breakpoint is at least the given breakpoint.
|
|
70
|
-
* E.g., isAtLeast('md') returns true for md, lg, xl.
|
|
71
|
-
*/
|
|
72
|
-
isAtLeast(breakpoint) {
|
|
73
|
-
const currentIndex = BREAKPOINT_ORDER.indexOf(this._currentBreakpoint);
|
|
74
|
-
const targetIndex = BREAKPOINT_ORDER.indexOf(breakpoint);
|
|
75
|
-
return currentIndex >= targetIndex;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Check if the current breakpoint is at most the given breakpoint.
|
|
79
|
-
* E.g., isAtMost('md') returns true for xs, sm, md.
|
|
80
|
-
*/
|
|
81
|
-
isAtMost(breakpoint) {
|
|
82
|
-
const currentIndex = BREAKPOINT_ORDER.indexOf(this._currentBreakpoint);
|
|
83
|
-
const targetIndex = BREAKPOINT_ORDER.indexOf(breakpoint);
|
|
84
|
-
return currentIndex <= targetIndex;
|
|
85
|
-
}
|
|
86
|
-
_updateSize() {
|
|
87
|
-
this._width = window.innerWidth;
|
|
88
|
-
const bp = this._breakpoints;
|
|
89
|
-
if (this._width >= bp.xl) {
|
|
90
|
-
this._currentBreakpoint = "xl";
|
|
91
|
-
} else if (this._width >= bp.lg) {
|
|
92
|
-
this._currentBreakpoint = "lg";
|
|
93
|
-
} else if (this._width >= bp.md) {
|
|
94
|
-
this._currentBreakpoint = "md";
|
|
95
|
-
} else if (this._width >= bp.sm) {
|
|
96
|
-
this._currentBreakpoint = "sm";
|
|
97
|
-
} else {
|
|
98
|
-
this._currentBreakpoint = "xs";
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
_notifyListeners() {
|
|
102
|
-
this._listeners.forEach((cb) => cb());
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
const screenSizeService = new ScreenSizeServiceImpl();
|
|
106
|
-
|
|
107
|
-
export { screenSizeService };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Screen Size module - Utilities for responsive behavior in Lit applications
|
|
3
|
-
*
|
|
4
|
-
* Provides:
|
|
5
|
-
* - ScreenSizeService: Singleton service for tracking viewport size
|
|
6
|
-
* - ScreenSizeController: Reactive controller for Lit components
|
|
7
|
-
* - responsiveText/responsiveValue: Directives for responsive values in templates
|
|
8
|
-
*/
|
|
9
|
-
export { screenSizeService } from './ScreenSizeService.js';
|
|
10
|
-
export { ScreenSizeController } from './ScreenSizeController.js';
|
|
11
|
-
export { responsiveText, responsiveValue } from './responsive-directives.js';
|
|
12
|
-
export type { Breakpoint, BreakpointConfig, ResponsiveTextOptions, ResponsiveValueOptions, } from './types.js';
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/screen-size/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7E,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { AsyncDirective } from 'lit/async-directive.js';
|
|
2
|
-
import { ResponsiveTextOptions, ResponsiveValueOptions } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* ResponsiveTextDirective - Returns different text based on screen size
|
|
5
|
-
*/
|
|
6
|
-
declare class ResponsiveTextDirective extends AsyncDirective {
|
|
7
|
-
private _options?;
|
|
8
|
-
private _unsubscribe?;
|
|
9
|
-
render(options: ResponsiveTextOptions): string;
|
|
10
|
-
disconnected(): void;
|
|
11
|
-
reconnected(): void;
|
|
12
|
-
private _getText;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* ResponsiveValueDirective - Returns different values based on screen size (generic)
|
|
16
|
-
*/
|
|
17
|
-
declare class ResponsiveValueDirective<T> extends AsyncDirective {
|
|
18
|
-
private _options?;
|
|
19
|
-
private _unsubscribe?;
|
|
20
|
-
render(options: ResponsiveValueOptions<T>): T;
|
|
21
|
-
disconnected(): void;
|
|
22
|
-
reconnected(): void;
|
|
23
|
-
private _getValue;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Directive for responsive text values.
|
|
27
|
-
* Returns different text based on the current screen size breakpoint.
|
|
28
|
-
*
|
|
29
|
-
* @param options - Object with default and optional breakpoint-specific texts
|
|
30
|
-
* @returns The text for the current breakpoint (with fallback to smaller breakpoints)
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* html`<pd-button text="${responsiveText({
|
|
35
|
-
* default: 'Click here to continue',
|
|
36
|
-
* sm: 'Continue',
|
|
37
|
-
* xs: 'Go'
|
|
38
|
-
* })}"></pd-button>`
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare const responsiveText: (options: ResponsiveTextOptions) => import('lit/async-directive.js').DirectiveResult<typeof ResponsiveTextDirective>;
|
|
42
|
-
/**
|
|
43
|
-
* Directive for responsive generic values.
|
|
44
|
-
* Returns different values based on the current screen size breakpoint.
|
|
45
|
-
*
|
|
46
|
-
* @param options - Object with default and optional breakpoint-specific values
|
|
47
|
-
* @returns The value for the current breakpoint (with fallback to smaller breakpoints)
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```typescript
|
|
51
|
-
* html`<my-component
|
|
52
|
-
* columns="${responsiveValue({ default: 4, md: 2, sm: 1 })}"
|
|
53
|
-
* .showSidebar="${responsiveValue({ default: true, sm: false })}"
|
|
54
|
-
* ></my-component>`
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
export declare const responsiveValue: (options: ResponsiveValueOptions<unknown>) => import('lit/async-directive.js').DirectiveResult<typeof ResponsiveValueDirective>;
|
|
58
|
-
export {};
|
|
59
|
-
//# sourceMappingURL=responsive-directives.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"responsive-directives.d.ts","sourceRoot":"","sources":["../../src/screen-size/responsive-directives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,cAAc,EAAa,MAAM,wBAAwB,CAAC;AAEnE,OAAO,KAAK,EAEV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAgCpB;;GAEG;AACH,cAAM,uBAAwB,SAAQ,cAAc;IAClD,OAAO,CAAC,QAAQ,CAAC,CAAwB;IACzC,OAAO,CAAC,YAAY,CAAC,CAAa;IAElC,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM;IAa9C,YAAY,IAAI,IAAI;IAKpB,WAAW,IAAI,IAAI;IASnB,OAAO,CAAC,QAAQ;CAIjB;AAED;;GAEG;AACH,cAAM,wBAAwB,CAAC,CAAC,CAAE,SAAQ,cAAc;IACtD,OAAO,CAAC,QAAQ,CAAC,CAA4B;IAC7C,OAAO,CAAC,YAAY,CAAC,CAAa;IAElC,MAAM,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC;IAa7C,YAAY,IAAI,IAAI;IAKpB,WAAW,IAAI,IAAI;IASnB,OAAO,CAAC,SAAS;CAIlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,sHAAqC,CAAC;AAEjE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,iIAAsC,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { directive, AsyncDirective } from 'lit/async-directive.js';
|
|
2
|
-
import { screenSizeService } from './ScreenSizeService.js';
|
|
3
|
-
|
|
4
|
-
function resolveResponsiveValue(options, currentBreakpoint) {
|
|
5
|
-
const breakpointOrder = screenSizeService.breakpointOrder;
|
|
6
|
-
const currentIndex = breakpointOrder.indexOf(currentBreakpoint);
|
|
7
|
-
for (let i = currentIndex; i < breakpointOrder.length; i++) {
|
|
8
|
-
const bp = breakpointOrder[i];
|
|
9
|
-
const value = options[bp];
|
|
10
|
-
if (value !== void 0) {
|
|
11
|
-
return value;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return options.default;
|
|
15
|
-
}
|
|
16
|
-
class ResponsiveTextDirective extends AsyncDirective {
|
|
17
|
-
render(options) {
|
|
18
|
-
this._options = options;
|
|
19
|
-
if (!this._unsubscribe) {
|
|
20
|
-
this._unsubscribe = screenSizeService.subscribe(() => {
|
|
21
|
-
this.setValue(this._getText());
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return this._getText();
|
|
25
|
-
}
|
|
26
|
-
disconnected() {
|
|
27
|
-
this._unsubscribe?.();
|
|
28
|
-
this._unsubscribe = void 0;
|
|
29
|
-
}
|
|
30
|
-
reconnected() {
|
|
31
|
-
if (!this._unsubscribe) {
|
|
32
|
-
this._unsubscribe = screenSizeService.subscribe(() => {
|
|
33
|
-
this.setValue(this._getText());
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
_getText() {
|
|
38
|
-
if (!this._options) return "";
|
|
39
|
-
return resolveResponsiveValue(this._options, screenSizeService.breakpoint);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
class ResponsiveValueDirective extends AsyncDirective {
|
|
43
|
-
render(options) {
|
|
44
|
-
this._options = options;
|
|
45
|
-
if (!this._unsubscribe) {
|
|
46
|
-
this._unsubscribe = screenSizeService.subscribe(() => {
|
|
47
|
-
this.setValue(this._getValue());
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return this._getValue();
|
|
51
|
-
}
|
|
52
|
-
disconnected() {
|
|
53
|
-
this._unsubscribe?.();
|
|
54
|
-
this._unsubscribe = void 0;
|
|
55
|
-
}
|
|
56
|
-
reconnected() {
|
|
57
|
-
if (!this._unsubscribe) {
|
|
58
|
-
this._unsubscribe = screenSizeService.subscribe(() => {
|
|
59
|
-
this.setValue(this._getValue());
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
_getValue() {
|
|
64
|
-
if (!this._options) return void 0;
|
|
65
|
-
return resolveResponsiveValue(this._options, screenSizeService.breakpoint);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const responsiveText = directive(ResponsiveTextDirective);
|
|
69
|
-
const responsiveValue = directive(ResponsiveValueDirective);
|
|
70
|
-
|
|
71
|
-
export { responsiveText, responsiveValue };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Screen size types and interfaces
|
|
3
|
-
*/
|
|
4
|
-
/** Available breakpoint names (mobile-first) */
|
|
5
|
-
export type Breakpoint = "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
-
/** Breakpoint threshold configuration (min-width values in pixels) */
|
|
7
|
-
export interface BreakpointConfig {
|
|
8
|
-
xs: number;
|
|
9
|
-
sm: number;
|
|
10
|
-
md: number;
|
|
11
|
-
lg: number;
|
|
12
|
-
xl: number;
|
|
13
|
-
}
|
|
14
|
-
/** Options for responsive text directive */
|
|
15
|
-
export interface ResponsiveTextOptions {
|
|
16
|
-
/** Default text (used when no breakpoint-specific text matches) */
|
|
17
|
-
default: string;
|
|
18
|
-
/** Text for extra small screens (< 640px) */
|
|
19
|
-
xs?: string;
|
|
20
|
-
/** Text for small screens (640px - 767px) */
|
|
21
|
-
sm?: string;
|
|
22
|
-
/** Text for medium screens (768px - 1023px) */
|
|
23
|
-
md?: string;
|
|
24
|
-
/** Text for large screens (1024px - 1279px) */
|
|
25
|
-
lg?: string;
|
|
26
|
-
/** Text for extra large screens (>= 1280px) */
|
|
27
|
-
xl?: string;
|
|
28
|
-
}
|
|
29
|
-
/** Options for responsive value directive (generic version) */
|
|
30
|
-
export interface ResponsiveValueOptions<T> {
|
|
31
|
-
/** Default value (used when no breakpoint-specific value matches) */
|
|
32
|
-
default: T;
|
|
33
|
-
/** Value for extra small screens */
|
|
34
|
-
xs?: T;
|
|
35
|
-
/** Value for small screens */
|
|
36
|
-
sm?: T;
|
|
37
|
-
/** Value for medium screens */
|
|
38
|
-
md?: T;
|
|
39
|
-
/** Value for large screens */
|
|
40
|
-
lg?: T;
|
|
41
|
-
/** Value for extra large screens */
|
|
42
|
-
xl?: T;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/screen-size/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gDAAgD;AAChD,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1D,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,4CAA4C;AAC5C,MAAM,WAAW,qBAAqB;IACpC,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,+DAA+D;AAC/D,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,qEAAqE;IACrE,OAAO,EAAE,CAAC,CAAC;IACX,oCAAoC;IACpC,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,8BAA8B;IAC9B,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,+BAA+B;IAC/B,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,8BAA8B;IAC9B,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,oCAAoC;IACpC,EAAE,CAAC,EAAE,CAAC,CAAC;CACR"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { ServiceProvider, IAuthProvider, IFunctionProvider, IStorageProvider, IDatabaseProvider } from '@progressive-development/pd-provider-interfaces';
|
|
2
|
-
/**
|
|
3
|
-
* Central service container for dependency injection
|
|
4
|
-
*
|
|
5
|
-
* Usage:
|
|
6
|
-
* ```typescript
|
|
7
|
-
* // In app initialization (e.g., main.ts)
|
|
8
|
-
* import { services } from "pd-helper-app";
|
|
9
|
-
* import { createFirebaseProvider } from "pd-provider-firebase";
|
|
10
|
-
*
|
|
11
|
-
* services.initialize(createFirebaseProvider(firebaseConfig));
|
|
12
|
-
*
|
|
13
|
-
* // In components/services
|
|
14
|
-
* import { services } from "pd-helper-app";
|
|
15
|
-
*
|
|
16
|
-
* const user = services.auth.getCurrentUser();
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare class ServiceRegistry {
|
|
20
|
-
private provider;
|
|
21
|
-
/**
|
|
22
|
-
* Initialize the service registry with a provider
|
|
23
|
-
* @param provider The service provider to use
|
|
24
|
-
* @throws Error if already initialized
|
|
25
|
-
*/
|
|
26
|
-
initialize(provider: ServiceProvider): void;
|
|
27
|
-
/**
|
|
28
|
-
* Check if the registry has been initialized
|
|
29
|
-
*/
|
|
30
|
-
get isInitialized(): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Ensure the registry is initialized before accessing providers
|
|
33
|
-
* @throws Error if not initialized
|
|
34
|
-
*/
|
|
35
|
-
private ensureInitialized;
|
|
36
|
-
/**
|
|
37
|
-
* Get the auth provider
|
|
38
|
-
*/
|
|
39
|
-
get auth(): IAuthProvider;
|
|
40
|
-
/**
|
|
41
|
-
* Get the functions provider
|
|
42
|
-
*/
|
|
43
|
-
get functions(): IFunctionProvider;
|
|
44
|
-
/**
|
|
45
|
-
* Get the storage provider
|
|
46
|
-
*/
|
|
47
|
-
get storage(): IStorageProvider;
|
|
48
|
-
/**
|
|
49
|
-
* Get the database provider (optional)
|
|
50
|
-
* @returns Database provider or undefined if not configured
|
|
51
|
-
*/
|
|
52
|
-
get database(): IDatabaseProvider | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* Reset the registry (primarily for testing)
|
|
55
|
-
*
|
|
56
|
-
* Warning: This should only be used in tests.
|
|
57
|
-
* In production, providers should be initialized once at app startup.
|
|
58
|
-
*/
|
|
59
|
-
reset(): void;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Global service registry instance
|
|
63
|
-
*
|
|
64
|
-
* This is the main entry point for accessing services throughout the application.
|
|
65
|
-
*/
|
|
66
|
-
export declare const services: ServiceRegistry;
|
|
67
|
-
//# sourceMappingURL=ServiceRegistry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceRegistry.d.ts","sourceRoot":"","sources":["../../src/service-provider/ServiceRegistry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,iDAAiD,CAAC;AAEzD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAgC;IAEhD;;;;OAIG;IACH,UAAU,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAS3C;;OAEG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACH,IAAI,IAAI,IAAI,aAAa,CAGxB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,iBAAiB,CAGjC;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,gBAAgB,CAG9B;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,iBAAiB,GAAG,SAAS,CAG5C;IAED;;;;;OAKG;IACH,KAAK,IAAI,IAAI;CAGd;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,iBAAwB,CAAC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
class ServiceRegistry {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.provider = null;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Initialize the service registry with a provider
|
|
7
|
-
* @param provider The service provider to use
|
|
8
|
-
* @throws Error if already initialized
|
|
9
|
-
*/
|
|
10
|
-
initialize(provider) {
|
|
11
|
-
if (this.provider !== null) {
|
|
12
|
-
throw new Error(
|
|
13
|
-
"ServiceRegistry already initialized. Call reset() first if re-initialization is needed."
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
this.provider = provider;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Check if the registry has been initialized
|
|
20
|
-
*/
|
|
21
|
-
get isInitialized() {
|
|
22
|
-
return this.provider !== null;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Ensure the registry is initialized before accessing providers
|
|
26
|
-
* @throws Error if not initialized
|
|
27
|
-
*/
|
|
28
|
-
ensureInitialized() {
|
|
29
|
-
if (this.provider === null) {
|
|
30
|
-
throw new Error(
|
|
31
|
-
"ServiceRegistry not initialized. Call services.initialize(provider) before accessing services."
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Get the auth provider
|
|
37
|
-
*/
|
|
38
|
-
get auth() {
|
|
39
|
-
this.ensureInitialized();
|
|
40
|
-
return this.provider.auth;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Get the functions provider
|
|
44
|
-
*/
|
|
45
|
-
get functions() {
|
|
46
|
-
this.ensureInitialized();
|
|
47
|
-
return this.provider.functions;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Get the storage provider
|
|
51
|
-
*/
|
|
52
|
-
get storage() {
|
|
53
|
-
this.ensureInitialized();
|
|
54
|
-
return this.provider.storage;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Get the database provider (optional)
|
|
58
|
-
* @returns Database provider or undefined if not configured
|
|
59
|
-
*/
|
|
60
|
-
get database() {
|
|
61
|
-
this.ensureInitialized();
|
|
62
|
-
return this.provider?.database;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Reset the registry (primarily for testing)
|
|
66
|
-
*
|
|
67
|
-
* Warning: This should only be used in tests.
|
|
68
|
-
* In production, providers should be initialized once at app startup.
|
|
69
|
-
*/
|
|
70
|
-
reset() {
|
|
71
|
-
this.provider = null;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const services = new ServiceRegistry();
|
|
75
|
-
|
|
76
|
-
export { ServiceRegistry, services };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { BusinessError, FunctionResult, FunctionDefinition } from './service-provider-model.js';
|
|
2
|
-
/**
|
|
3
|
-
* Validates a function result against the expected success codes and extracts the data.
|
|
4
|
-
*
|
|
5
|
-
* @param result - The raw function result from the provider
|
|
6
|
-
* @param functionDef - The function definition with successCodes
|
|
7
|
-
* @returns The extracted resultData, typed as T
|
|
8
|
-
* @throws BusinessError if statusCode is not in successCodes
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* public loadGalleryList(): Observable<DJGalleryItem[]> {
|
|
13
|
-
* const call = { object: "galleryList" };
|
|
14
|
-
* return from(
|
|
15
|
-
* services.functions.callFunction(handlePutFunc.name, call)
|
|
16
|
-
* .then((result) => validateFunctionResult<DJGalleryItem[]>(result, handlePutFunc))
|
|
17
|
-
* );
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function validateFunctionResult<T>(result: FunctionResult, functionDef: FunctionDefinition): T;
|
|
22
|
-
/**
|
|
23
|
-
* Validates a function result with a custom success code array.
|
|
24
|
-
* Use this when you don't have a full FunctionDefinition available.
|
|
25
|
-
*
|
|
26
|
-
* @param result - The raw function result from the provider
|
|
27
|
-
* @param successCodes - Array of valid status codes (default: [200])
|
|
28
|
-
* @returns The extracted resultData, typed as T
|
|
29
|
-
* @throws BusinessError if statusCode is not in successCodes
|
|
30
|
-
*/
|
|
31
|
-
export declare function validateResult<T>(result: FunctionResult, successCodes?: number[]): T;
|
|
32
|
-
/**
|
|
33
|
-
* Type guard to check if an error is a BusinessError.
|
|
34
|
-
* Useful in catch blocks to distinguish business errors from technical errors.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```typescript
|
|
38
|
-
* catchError((err) => {
|
|
39
|
-
* if (isBusinessError(err)) {
|
|
40
|
-
* console.log("Business error:", err.code, err.message);
|
|
41
|
-
* }
|
|
42
|
-
* return of(failAction(err));
|
|
43
|
-
* })
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function isBusinessError(error: unknown): error is BusinessError;
|
|
47
|
-
/**
|
|
48
|
-
* Extracts error information for logging/display.
|
|
49
|
-
* Handles both BusinessError and standard Error.
|
|
50
|
-
*/
|
|
51
|
-
export declare function extractErrorInfo(error: unknown): {
|
|
52
|
-
message: string;
|
|
53
|
-
code: number;
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=function-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function-utils.d.ts","sourceRoot":"","sources":["../../src/service-provider/function-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,aAAa,EACb,cAAc,EACd,kBAAkB,EAEnB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,kBAAkB,GAC9B,CAAC,CASH;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,MAAM,EAAE,cAAc,EACtB,YAAY,GAAE,MAAM,EAAU,GAC7B,CAAC,CASH;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAQA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { SC_TECHNICAL_FAILURE, BusinessError } from './service-provider-model.js';
|
|
2
|
-
|
|
3
|
-
function validateFunctionResult(result, functionDef) {
|
|
4
|
-
if (!functionDef.successCodes.includes(result.statusCode)) {
|
|
5
|
-
const message = typeof result.resultData === "string" ? result.resultData : `Function call failed with code ${result.statusCode}`;
|
|
6
|
-
throw new BusinessError(message, result.statusCode);
|
|
7
|
-
}
|
|
8
|
-
return result.resultData;
|
|
9
|
-
}
|
|
10
|
-
function validateResult(result, successCodes = [200]) {
|
|
11
|
-
if (!successCodes.includes(result.statusCode)) {
|
|
12
|
-
const message = typeof result.resultData === "string" ? result.resultData : `Function call failed with code ${result.statusCode}`;
|
|
13
|
-
throw new BusinessError(message, result.statusCode);
|
|
14
|
-
}
|
|
15
|
-
return result.resultData;
|
|
16
|
-
}
|
|
17
|
-
function isBusinessError(error) {
|
|
18
|
-
return error instanceof BusinessError;
|
|
19
|
-
}
|
|
20
|
-
function extractErrorInfo(error) {
|
|
21
|
-
if (isBusinessError(error)) {
|
|
22
|
-
return { message: error.message, code: error.code };
|
|
23
|
-
}
|
|
24
|
-
if (error instanceof Error) {
|
|
25
|
-
return { message: error.message, code: SC_TECHNICAL_FAILURE };
|
|
26
|
-
}
|
|
27
|
-
return { message: String(error), code: SC_TECHNICAL_FAILURE };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export { extractErrorInfo, isBusinessError, validateFunctionResult, validateResult };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { ServiceRegistry, services } from './ServiceRegistry.js';
|
|
2
|
-
export type { IAuthProvider, AuthUser, UserToken, AuthStateCallback, } from './interfaces/IAuthProvider.js';
|
|
3
|
-
export type { IFunctionProvider, FunctionDefinition, FunctionResult, } from './interfaces/IFunctionProvider.js';
|
|
4
|
-
export type { IStorageProvider, UploadFileRequest, UploadResult, StorageDocument, ListFilesOptions, GetFileOptions, } from './interfaces/IStorageProvider.js';
|
|
5
|
-
export type { IDatabaseProvider, QueryConstraint, QueryOperator, DocumentSnapshot, CollectionCallback, } from './interfaces/IDatabaseProvider.js';
|
|
6
|
-
export type { ServiceProvider } from './interfaces/ServiceProvider.js';
|
|
7
|
-
export type { Unsubscribe } from './interfaces/common.js';
|
|
8
|
-
export { SC_INVALID_USER, SC_TECHNICAL_FAILURE, BusinessError, } from './service-provider-model.js';
|
|
9
|
-
export type { ServiceProviderConfiguration, FunctionParam, FunctionsConfig, MenuElement, NavigationPage, NavigationConfig, LinkObj, Footer, StoreConfig, FileStorage, FileStorageConfig, MessagingConfig, AppConfiguration, UploadFile, CollectionContraint, } from './service-provider-model.js';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service-provider/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKjE,YAAY,EACV,aAAa,EACb,QAAQ,EACR,SAAS,EACT,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AAKvC,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,mCAAmC,CAAC;AAK3C,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,cAAc,GACf,MAAM,kCAAkC,CAAC;AAK1C,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAK3C,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAKvE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK1D,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,aAAa,GACd,MAAM,6BAA6B,CAAC;AAErC,YAAY,EACV,4BAA4B,EAC5B,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,mBAAmB,GACpB,MAAM,6BAA6B,CAAC"}
|