@operato/shell 9.1.0 → 10.0.0-beta.1

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.
Files changed (50) hide show
  1. package/dist/src/actions/route.d.ts +0 -9
  2. package/dist/src/actions/route.js +0 -15
  3. package/dist/src/actions/route.js.map +1 -1
  4. package/dist/src/app/app.d.ts +4 -9
  5. package/dist/src/app/app.js +16 -12
  6. package/dist/src/app/app.js.map +1 -1
  7. package/dist/src/connect-mixin.d.ts +20 -0
  8. package/dist/src/connect-mixin.js +18 -0
  9. package/dist/src/connect-mixin.js.map +1 -0
  10. package/dist/src/controllers/app-controller.d.ts +33 -0
  11. package/dist/src/controllers/app-controller.js +35 -0
  12. package/dist/src/controllers/app-controller.js.map +1 -0
  13. package/dist/src/controllers/context-controller.d.ts +10 -0
  14. package/dist/src/controllers/context-controller.js +25 -0
  15. package/dist/src/controllers/context-controller.js.map +1 -0
  16. package/dist/src/controllers/font-controller.d.ts +20 -0
  17. package/dist/src/controllers/font-controller.js +22 -0
  18. package/dist/src/controllers/font-controller.js.map +1 -0
  19. package/dist/src/controllers/index.d.ts +11 -0
  20. package/dist/src/controllers/index.js +8 -0
  21. package/dist/src/controllers/index.js.map +1 -0
  22. package/dist/src/controllers/layout-controller.d.ts +13 -0
  23. package/dist/src/controllers/layout-controller.js +27 -0
  24. package/dist/src/controllers/layout-controller.js.map +1 -0
  25. package/dist/src/controllers/menu-controller.d.ts +11 -0
  26. package/dist/src/controllers/menu-controller.js +27 -0
  27. package/dist/src/controllers/menu-controller.js.map +1 -0
  28. package/dist/src/controllers/route-controller.d.ts +21 -0
  29. package/dist/src/controllers/route-controller.js +37 -0
  30. package/dist/src/controllers/route-controller.js.map +1 -0
  31. package/dist/src/controllers/snackbar-controller.d.ts +27 -0
  32. package/dist/src/controllers/snackbar-controller.js +38 -0
  33. package/dist/src/controllers/snackbar-controller.js.map +1 -0
  34. package/dist/src/index.d.ts +2 -0
  35. package/dist/src/index.js +2 -0
  36. package/dist/src/index.js.map +1 -1
  37. package/dist/src/lazy-reducer-enhancer.d.ts +7 -0
  38. package/dist/src/lazy-reducer-enhancer.js +13 -0
  39. package/dist/src/lazy-reducer-enhancer.js.map +1 -0
  40. package/dist/src/reducers/route.js +1 -4
  41. package/dist/src/reducers/route.js.map +1 -1
  42. package/dist/src/router.d.ts +5 -0
  43. package/dist/src/router.js +28 -0
  44. package/dist/src/router.js.map +1 -0
  45. package/dist/src/store.d.ts +1 -1
  46. package/dist/src/store.js +1 -1
  47. package/dist/src/store.js.map +1 -1
  48. package/dist/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +7 -8
  50. package/yarn-error.log +0 -17014
@@ -0,0 +1,37 @@
1
+ import { store } from '../store.js';
2
+ export class RouteController {
3
+ constructor(host) {
4
+ this.page = '';
5
+ this.resourceId = '';
6
+ this.params = {};
7
+ this.context = {};
8
+ this.activePage = null;
9
+ this.host = host;
10
+ host.addController(this);
11
+ }
12
+ hostConnected() {
13
+ this._apply(store.getState().route);
14
+ this._unsubscribe = store.subscribe(() => {
15
+ const next = store.getState().route;
16
+ if (this.page !== next.page ||
17
+ this.resourceId !== next.resourceId ||
18
+ this.params !== next.params ||
19
+ this.context !== next.context ||
20
+ this.activePage !== next.activePage) {
21
+ this._apply(next);
22
+ this.host.requestUpdate();
23
+ }
24
+ });
25
+ }
26
+ hostDisconnected() {
27
+ this._unsubscribe?.();
28
+ }
29
+ _apply(r = { page: '', resourceId: '', params: {}, context: {}, activePage: null }) {
30
+ this.page = r.page;
31
+ this.resourceId = r.resourceId;
32
+ this.params = r.params;
33
+ this.context = r.context;
34
+ this.activePage = r.activePage;
35
+ }
36
+ }
37
+ //# sourceMappingURL=route-controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-controller.js","sourceRoot":"","sources":["../../../src/controllers/route-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAUnC,MAAM,OAAO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,UAAU,CAAA;QAC9B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAA;QACxB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAA;IAChC,CAAC;CACF","sourcesContent":["import { ReactiveController, ReactiveControllerHost } from 'lit'\n\nimport { store } from '../store.js'\n\nexport interface RouteState {\n page: string\n resourceId: string\n params: Record<string, any>\n context: any\n activePage: any\n}\n\nexport class RouteController implements ReactiveController {\n host: ReactiveControllerHost\n\n page = ''\n resourceId = ''\n params: Record<string, any> = {}\n context: any = {}\n activePage: any = null\n\n private _unsubscribe?: () => void\n\n constructor(host: ReactiveControllerHost) {\n this.host = host\n host.addController(this)\n }\n\n hostConnected() {\n this._apply((store.getState() as any).route)\n\n this._unsubscribe = store.subscribe(() => {\n const next = (store.getState() as any).route\n if (\n this.page !== next.page ||\n this.resourceId !== next.resourceId ||\n this.params !== next.params ||\n this.context !== next.context ||\n this.activePage !== next.activePage\n ) {\n this._apply(next)\n this.host.requestUpdate()\n }\n })\n }\n\n hostDisconnected() {\n this._unsubscribe?.()\n }\n\n private _apply(r: RouteState = { page: '', resourceId: '', params: {}, context: {}, activePage: null }) {\n this.page = r.page\n this.resourceId = r.resourceId\n this.params = r.params\n this.context = r.context\n this.activePage = r.activePage\n }\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export type SnackbarLevel = 'info' | 'warn' | 'error';
3
+ export interface SnackbarState {
4
+ snackbarOpened: boolean;
5
+ level: SnackbarLevel | '';
6
+ message: string;
7
+ action: {
8
+ label?: string;
9
+ callback?: () => void;
10
+ };
11
+ }
12
+ export declare class SnackbarController implements ReactiveController {
13
+ host: ReactiveControllerHost;
14
+ opened: boolean;
15
+ level: SnackbarLevel | '';
16
+ message: string;
17
+ action: {
18
+ label?: string;
19
+ callback?: () => void;
20
+ };
21
+ private _unsubscribe?;
22
+ constructor(host: ReactiveControllerHost);
23
+ hostConnected(): void;
24
+ hostDisconnected(): void;
25
+ close(): void;
26
+ private _apply;
27
+ }
@@ -0,0 +1,38 @@
1
+ import { store } from '../store.js';
2
+ const INITIAL = { snackbarOpened: false, level: '', message: '', action: {} };
3
+ export class SnackbarController {
4
+ constructor(host) {
5
+ this.opened = false;
6
+ this.level = '';
7
+ this.message = '';
8
+ this.action = {};
9
+ this.host = host;
10
+ host.addController(this);
11
+ }
12
+ hostConnected() {
13
+ this._apply(store.getState().snackbar);
14
+ this._unsubscribe = store.subscribe(() => {
15
+ const next = store.getState().snackbar ?? INITIAL;
16
+ if (this.opened !== next.snackbarOpened ||
17
+ this.level !== next.level ||
18
+ this.message !== next.message ||
19
+ this.action !== next.action) {
20
+ this._apply(next);
21
+ this.host.requestUpdate();
22
+ }
23
+ });
24
+ }
25
+ hostDisconnected() {
26
+ this._unsubscribe?.();
27
+ }
28
+ close() {
29
+ store.dispatch({ type: 'CLOSE_SNACKBAR' });
30
+ }
31
+ _apply(s = INITIAL) {
32
+ this.opened = s.snackbarOpened;
33
+ this.level = s.level;
34
+ this.message = s.message;
35
+ this.action = s.action;
36
+ }
37
+ }
38
+ //# sourceMappingURL=snackbar-controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snackbar-controller.js","sourceRoot":"","sources":["../../../src/controllers/snackbar-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAWnC,MAAM,OAAO,GAAkB,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AAE5F,MAAM,OAAO,kBAAkB;IAU7B,YAAY,IAA4B;QAPxC,WAAM,GAAG,KAAK,CAAA;QACd,UAAK,GAAuB,EAAE,CAAA;QAC9B,YAAO,GAAG,EAAE,CAAA;QACZ,WAAM,GAA8C,EAAE,CAAA;QAKpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED,aAAa;QACX,IAAI,CAAC,MAAM,CAAE,KAAK,CAAC,QAAQ,EAAU,CAAC,QAAQ,CAAC,CAAA;QAE/C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACvC,MAAM,IAAI,GAAmB,KAAK,CAAC,QAAQ,EAAU,CAAC,QAAQ,IAAI,OAAO,CAAA;YACzE,IACE,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,cAAc;gBACnC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK;gBACzB,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO;gBAC7B,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAC3B,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;gBACjB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAA;YAC3B,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,YAAY,EAAE,EAAE,CAAA;IACvB,CAAC;IAED,KAAK;QACH,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAA;IAC5C,CAAC;IAEO,MAAM,CAAC,IAAmB,OAAO;QACvC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,cAAc,CAAA;QAC9B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAA;IACxB,CAAC;CACF","sourcesContent":["import { ReactiveController, ReactiveControllerHost } from 'lit'\n\nimport { store } from '../store.js'\n\nexport type SnackbarLevel = 'info' | 'warn' | 'error'\n\nexport interface SnackbarState {\n snackbarOpened: boolean\n level: SnackbarLevel | ''\n message: string\n action: { label?: string; callback?: () => void }\n}\n\nconst INITIAL: SnackbarState = { snackbarOpened: false, level: '', message: '', action: {} }\n\nexport class SnackbarController implements ReactiveController {\n host: ReactiveControllerHost\n\n opened = false\n level: SnackbarLevel | '' = ''\n message = ''\n action: { label?: string; callback?: () => void } = {}\n\n private _unsubscribe?: () => void\n\n constructor(host: ReactiveControllerHost) {\n this.host = host\n host.addController(this)\n }\n\n hostConnected() {\n this._apply((store.getState() as any).snackbar)\n\n this._unsubscribe = store.subscribe(() => {\n const next: SnackbarState = (store.getState() as any).snackbar ?? INITIAL\n if (\n this.opened !== next.snackbarOpened ||\n this.level !== next.level ||\n this.message !== next.message ||\n this.action !== next.action\n ) {\n this._apply(next)\n this.host.requestUpdate()\n }\n })\n }\n\n hostDisconnected() {\n this._unsubscribe?.()\n }\n\n close() {\n store.dispatch({ type: 'CLOSE_SNACKBAR' })\n }\n\n private _apply(s: SnackbarState = INITIAL) {\n this.opened = s.snackbarOpened\n this.level = s.level\n this.message = s.message\n this.action = s.action\n }\n}\n"]}
@@ -4,3 +4,5 @@ export * from './actions/index.js';
4
4
  export * from './app/pages/page-view.js';
5
5
  export * from './object-store.js';
6
6
  export * from './custom-alert.js';
7
+ export { connect } from './connect-mixin.js';
8
+ export * from './controllers/index.js';
package/dist/src/index.js CHANGED
@@ -4,4 +4,6 @@ export * from './actions/index.js';
4
4
  export * from './app/pages/page-view.js';
5
5
  export * from './object-store.js';
6
6
  export * from './custom-alert.js';
7
+ export { connect } from './connect-mixin.js';
8
+ export * from './controllers/index.js';
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA","sourcesContent":["export * from './types/index.js'\nexport * from './store.js'\nexport * from './actions/index.js'\nexport * from './app/pages/page-view.js'\nexport * from './object-store.js'\nexport * from './custom-alert.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,cAAc,wBAAwB,CAAA","sourcesContent":["export * from './types/index.js'\nexport * from './store.js'\nexport * from './actions/index.js'\nexport * from './app/pages/page-view.js'\nexport * from './object-store.js'\nexport * from './custom-alert.js'\nexport { connect } from './connect-mixin.js'\nexport * from './controllers/index.js'\n"]}
@@ -0,0 +1,7 @@
1
+ import { Reducer, ReducersMapObject, StoreEnhancer } from 'redux';
2
+ export interface LazyStore {
3
+ addReducers(newReducers: ReducersMapObject): void;
4
+ }
5
+ export declare const lazyReducerEnhancer: (combineReducers: (reducers: ReducersMapObject) => Reducer) => StoreEnhancer<{
6
+ addReducers(newReducers: ReducersMapObject): void;
7
+ }>;
@@ -0,0 +1,13 @@
1
+ export const lazyReducerEnhancer = (combineReducers) => {
2
+ return nextCreator => (origReducer, preloadedState) => {
3
+ let lazyReducers = {};
4
+ const nextStore = nextCreator(origReducer, preloadedState);
5
+ return Object.assign({}, nextStore, {
6
+ addReducers(newReducers) {
7
+ const combinedReducerMap = Object.assign({}, lazyReducers, newReducers);
8
+ nextStore.replaceReducer(combineReducers((lazyReducers = combinedReducerMap)));
9
+ }
10
+ });
11
+ };
12
+ };
13
+ //# sourceMappingURL=lazy-reducer-enhancer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-reducer-enhancer.js","sourceRoot":"","sources":["../../src/lazy-reducer-enhancer.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,eAAyD,EACa,EAAE;IACxE,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,cAAc,EAAE,EAAE;QACpD,IAAI,YAAY,GAAsB,EAAE,CAAA;QACxC,MAAM,SAAS,GAAG,WAAW,CAAC,WAAW,EAAE,cAAc,CAAC,CAAA;QAC1D,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE;YAClC,WAAW,CAAC,WAA8B;gBACxC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,YAAY,EAAE,WAAW,CAAC,CAAA;gBACvE,SAAS,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,YAAY,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAA;YAChF,CAAC;SACF,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { Reducer, ReducersMapObject, StoreEnhancer } from 'redux'\n\nexport interface LazyStore {\n addReducers(newReducers: ReducersMapObject): void\n}\n\nexport const lazyReducerEnhancer = (\n combineReducers: (reducers: ReducersMapObject) => Reducer\n): StoreEnhancer<{ addReducers(newReducers: ReducersMapObject): void }> => {\n return nextCreator => (origReducer, preloadedState) => {\n let lazyReducers: ReducersMapObject = {}\n const nextStore = nextCreator(origReducer, preloadedState)\n return Object.assign({}, nextStore, {\n addReducers(newReducers: ReducersMapObject) {\n const combinedReducerMap = Object.assign({}, lazyReducers, newReducers)\n nextStore.replaceReducer(combineReducers((lazyReducers = combinedReducerMap)))\n }\n })\n }\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  import startCase from 'lodash-es/startCase.js';
2
- import { updateMetadata } from 'pwa-helpers/metadata.js';
3
2
  import { REGISTER_NAVIGATION_CALLBACK, UNREGISTER_NAVIGATION_CALLBACK, UPDATE_ACTIVE_PAGE, UPDATE_CONTEXT, UPDATE_PAGE } from '../actions/const.js';
4
3
  const APP_TITLE_EL = document.querySelector('meta[name="application-name"]');
5
4
  var appTitle;
@@ -26,9 +25,7 @@ const route = (state = INITIAL_STATE, action) => {
26
25
  case UPDATE_CONTEXT:
27
26
  let title = action.context?.title;
28
27
  let text = typeof title === 'object' ? title.text : title;
29
- updateMetadata({
30
- title: appTitle + (text ? ` - ${startCase(text)}` : '')
31
- });
28
+ document.title = appTitle + (text ? ` - ${startCase(text)}` : '');
32
29
  return {
33
30
  ...state,
34
31
  context: action.context || (state.activePage && state.activePage.context) || {}
@@ -1 +1 @@
1
- {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/reducers/route.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,EAC9B,kBAAkB,EAClB,cAAc,EACd,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAE5B,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,+BAA+B,CAAoB,CAAA;AAE/F,IAAI,QAA4B,CAAA;AAChC,IAAI,YAAY,EAAE,CAAC;IACjB,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAA;AACjC,CAAC;AAED,MAAM,aAAa,GAOf;IACF,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,EAAE;IACd,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,EAAE;CACd,CAAA;AAED,MAAM,KAAK,GAAG,CAAC,KAAK,GAAG,aAAa,EAAE,MAAW,EAAE,EAAE;IACnD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,WAAW;YACd,OAAO;gBACL,GAAG,KAAK;gBACR,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB,CAAA;QACH,KAAK,cAAc;YACjB,IAAI,KAAK,GAAG,MAAM,CAAC,OAAO,EAAE,KAAK,CAAA;YACjC,IAAI,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;YAEzD,cAAc,CAAC;gBACb,KAAK,EAAE,QAAQ,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACxD,CAAC,CAAA;YACF,OAAO;gBACL,GAAG,KAAK;gBACR,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE;aAChF,CAAA;QACH,KAAK,kBAAkB;YACrB,OAAO;gBACL,GAAG,KAAK;gBACR,UAAU,EAAE,MAAM,CAAC,UAAU;aAC9B,CAAA;QAEH,KAAK,4BAA4B;YAC/B,OAAO;gBACL,GAAG,KAAK;gBACR,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC;aACjD,CAAA;QACH,KAAK,8BAA8B;YACjC,OAAO;gBACL,GAAG,KAAK;gBACR,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC;aAC5E,CAAA;QAEH;YACE,OAAO,KAAK,CAAA;IAChB,CAAC;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAA","sourcesContent":["import startCase from 'lodash-es/startCase.js'\nimport { updateMetadata } from 'pwa-helpers/metadata.js'\n\nimport {\n REGISTER_NAVIGATION_CALLBACK,\n UNREGISTER_NAVIGATION_CALLBACK,\n UPDATE_ACTIVE_PAGE,\n UPDATE_CONTEXT,\n UPDATE_PAGE\n} from '../actions/const.js'\n\nconst APP_TITLE_EL = document.querySelector('meta[name=\"application-name\"]') as HTMLMetaElement\n\nvar appTitle: string | undefined\nif (APP_TITLE_EL) {\n appTitle = APP_TITLE_EL.content\n}\n\nconst INITIAL_STATE: {\n page: string\n resourceId: string\n params: any\n activePage: any\n context: any\n callbacks: any[]\n} = {\n page: '',\n resourceId: '',\n params: {},\n activePage: null,\n context: {},\n callbacks: []\n}\n\nconst route = (state = INITIAL_STATE, action: any) => {\n switch (action.type) {\n case UPDATE_PAGE:\n return {\n ...state,\n page: action.page,\n resourceId: action.resourceId,\n params: action.params\n }\n case UPDATE_CONTEXT:\n let title = action.context?.title\n let text = typeof title === 'object' ? title.text : title\n\n updateMetadata({\n title: appTitle + (text ? ` - ${startCase(text)}` : '')\n })\n return {\n ...state,\n context: action.context || (state.activePage && state.activePage.context) || {}\n }\n case UPDATE_ACTIVE_PAGE:\n return {\n ...state,\n activePage: action.activePage\n }\n\n case REGISTER_NAVIGATION_CALLBACK:\n return {\n ...state,\n callbacks: [...state.callbacks, action.callback]\n }\n case UNREGISTER_NAVIGATION_CALLBACK:\n return {\n ...state,\n callbacks: state.callbacks.filter(callback => callback !== action.callback)\n }\n\n default:\n return state\n }\n}\n\nexport default route\n"]}
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/reducers/route.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,EAC9B,kBAAkB,EAClB,cAAc,EACd,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAE5B,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,+BAA+B,CAAoB,CAAA;AAE/F,IAAI,QAA4B,CAAA;AAChC,IAAI,YAAY,EAAE,CAAC;IACjB,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAA;AACjC,CAAC;AAED,MAAM,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G,KAAK;gBACR,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC;aAC5E,CAAA;QAEH;YACE,OAAO,KAAK,CAAA;IAChB,CAAC;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAA","sourcesContent":["import startCase from 'lodash-es/startCase.js'\nimport {\n REGISTER_NAVIGATION_CALLBACK,\n UNREGISTER_NAVIGATION_CALLBACK,\n UPDATE_ACTIVE_PAGE,\n UPDATE_CONTEXT,\n UPDATE_PAGE\n} from '../actions/const.js'\n\nconst APP_TITLE_EL = document.querySelector('meta[name=\"application-name\"]') as HTMLMetaElement\n\nvar appTitle: string | undefined\nif (APP_TITLE_EL) {\n appTitle = APP_TITLE_EL.content\n}\n\nconst INITIAL_STATE: {\n page: string\n resourceId: string\n params: any\n activePage: any\n context: any\n callbacks: any[]\n} = {\n page: '',\n resourceId: '',\n params: {},\n activePage: null,\n context: {},\n callbacks: []\n}\n\nconst route = (state = INITIAL_STATE, action: any) => {\n switch (action.type) {\n case UPDATE_PAGE:\n return {\n ...state,\n page: action.page,\n resourceId: action.resourceId,\n params: action.params\n }\n case UPDATE_CONTEXT:\n let title = action.context?.title\n let text = typeof title === 'object' ? title.text : title\n\n document.title = appTitle + (text ? ` - ${startCase(text)}` : '')\n return {\n ...state,\n context: action.context || (state.activePage && state.activePage.context) || {}\n }\n case UPDATE_ACTIVE_PAGE:\n return {\n ...state,\n activePage: action.activePage\n }\n\n case REGISTER_NAVIGATION_CALLBACK:\n return {\n ...state,\n callbacks: [...state.callbacks, action.callback]\n }\n case UNREGISTER_NAVIGATION_CALLBACK:\n return {\n ...state,\n callbacks: state.callbacks.filter(callback => callback !== action.callback)\n }\n\n default:\n return state\n }\n}\n\nexport default route\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Lightweight client-side router that intercepts same-origin link clicks
3
+ * and listens for popstate events. Replaces pwa-helpers/router.js.
4
+ */
5
+ export declare const installRouter: (locationUpdatedCallback: (location: Location, event: Event | null) => void) => void;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Lightweight client-side router that intercepts same-origin link clicks
3
+ * and listens for popstate events. Replaces pwa-helpers/router.js.
4
+ */
5
+ export const installRouter = (locationUpdatedCallback) => {
6
+ document.body.addEventListener('click', e => {
7
+ if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey)
8
+ return;
9
+ const anchor = e.composedPath().filter((n) => n.tagName === 'A')[0];
10
+ if (!anchor || anchor.target || anchor.hasAttribute('download') || anchor.getAttribute('rel') === 'external')
11
+ return;
12
+ const href = anchor.href;
13
+ if (!href || href.indexOf('mailto:') !== -1)
14
+ return;
15
+ const location = window.location;
16
+ const origin = location.origin || location.protocol + '//' + location.host;
17
+ if (href.indexOf(origin) !== 0)
18
+ return;
19
+ e.preventDefault();
20
+ if (href !== location.href) {
21
+ window.history.pushState({}, '', href);
22
+ locationUpdatedCallback(location, e);
23
+ }
24
+ });
25
+ window.addEventListener('popstate', e => locationUpdatedCallback(window.location, e));
26
+ locationUpdatedCallback(window.location, null);
27
+ };
28
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/router.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,uBAA0E,EAAE,EAAE;IAC1G,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;QAC1C,IAAI,CAAC,CAAC,gBAAgB,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ;YAAE,OAAM;QAExF,MAAM,MAAM,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAA0B,EAAE,CAAE,CAAiB,CAAC,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QAC5G,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,UAAU;YAAE,OAAM;QAEpH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAAE,OAAM;QAEnD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;QAChC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAA;QAC1E,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;YAAE,OAAM;QAEtC,CAAC,CAAC,cAAc,EAAE,CAAA;QAElB,IAAI,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC3B,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAA;YACtC,uBAAuB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;QACtC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IACrF,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;AAChD,CAAC,CAAA","sourcesContent":["/**\n * Lightweight client-side router that intercepts same-origin link clicks\n * and listens for popstate events. Replaces pwa-helpers/router.js.\n */\nexport const installRouter = (locationUpdatedCallback: (location: Location, event: Event | null) => void) => {\n document.body.addEventListener('click', e => {\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey) return\n\n const anchor = e.composedPath().filter((n): n is HTMLAnchorElement => (n as HTMLElement).tagName === 'A')[0]\n if (!anchor || anchor.target || anchor.hasAttribute('download') || anchor.getAttribute('rel') === 'external') return\n\n const href = anchor.href\n if (!href || href.indexOf('mailto:') !== -1) return\n\n const location = window.location\n const origin = location.origin || location.protocol + '//' + location.host\n if (href.indexOf(origin) !== 0) return\n\n e.preventDefault()\n\n if (href !== location.href) {\n window.history.pushState({}, '', href)\n locationUpdatedCallback(location, e)\n }\n })\n\n window.addEventListener('popstate', e => locationUpdatedCallback(window.location, e))\n locationUpdatedCallback(window.location, null)\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { LazyStore } from 'pwa-helpers/lazy-reducer-enhancer.js';
1
+ import { LazyStore } from './lazy-reducer-enhancer.js';
2
2
  import { Action, Store } from 'redux';
3
3
  declare global {
4
4
  var __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any;
package/dist/src/store.js CHANGED
@@ -1,4 +1,4 @@
1
- import { lazyReducerEnhancer } from 'pwa-helpers/lazy-reducer-enhancer.js';
1
+ import { lazyReducerEnhancer } from './lazy-reducer-enhancer.js';
2
2
  import { applyMiddleware, combineReducers, compose, createStore } from 'redux';
3
3
  import thunk from 'redux-thunk';
4
4
  import app from './reducers/app.js';
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAa,MAAM,sCAAsC,CAAA;AACrF,OAAO,EAAU,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAS,MAAM,OAAO,CAAA;AAC7F,OAAO,KAAK,MAAM,aAAa,CAAA;AAE/B,OAAO,GAAG,MAAM,mBAAmB,CAAA;AACnC,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,IAAI,MAAM,oBAAoB,CAAA;AAMrC,wDAAwD;AACxD,mFAAmF;AACnF,MAAM,UAAU,GAAG,MAAM,CAAC,oCAAoC,IAAI,OAAO,CAAA;AAEzE,2FAA2F;AAC3F,IAAI,OAAO,MAAM,CAAC,OAAO,IAAI,WAAW,EAAE,CAAC;IACzC,MAAM,CAAC,OAAO,GAAG;QACf,GAAG,EAAE;YACH,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;SACxC;KACK,CAAA;AACV,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAA4C,WAAW,CACvE,KAAK,CAAC,EAAE,CAAC,KAAK,EACd,UAAU,CAAC,mBAAmB,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CACzE,CAAA;AAED,6BAA6B;AAC7B,KAAK,CAAC,WAAW,CAAC;IAChB,GAAG;IACH,KAAK;IACL,IAAI;CACL,CAAC,CAAA","sourcesContent":["import { lazyReducerEnhancer, LazyStore } from 'pwa-helpers/lazy-reducer-enhancer.js'\nimport { Action, applyMiddleware, combineReducers, compose, createStore, Store } from 'redux'\nimport thunk from 'redux-thunk'\n\nimport app from './reducers/app.js'\nimport route from './reducers/route.js'\nimport busy from './reducers/busy.js'\n\ndeclare global {\n var __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any\n}\n\n// Sets up a Chrome extension for time travel debugging.\n// See https://github.com/zalmoxisus/redux-devtools-extension for more information.\nconst devCompose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose\n\n// Only for providing test environment - combineReducers 에서 process.env.NODE_ENV를 접근하기 때문에.\nif (typeof window.process == 'undefined') {\n window.process = {\n env: {\n NODE_ENV: JSON.stringify('development')\n }\n } as any\n}\n\nexport const store: Store<unknown, Action<any>> & LazyStore = createStore(\n state => state,\n devCompose(lazyReducerEnhancer(combineReducers), applyMiddleware(thunk))\n)\n\n// Initially loaded reducers.\nstore.addReducers({\n app,\n route,\n busy\n})\n"]}
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAa,MAAM,4BAA4B,CAAA;AAC3E,OAAO,EAAU,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAS,MAAM,OAAO,CAAA;AAC7F,OAAO,KAAK,MAAM,aAAa,CAAA;AAE/B,OAAO,GAAG,MAAM,mBAAmB,CAAA;AACnC,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,IAAI,MAAM,oBAAoB,CAAA;AAMrC,wDAAwD;AACxD,mFAAmF;AACnF,MAAM,UAAU,GAAG,MAAM,CAAC,oCAAoC,IAAI,OAAO,CAAA;AAEzE,2FAA2F;AAC3F,IAAI,OAAO,MAAM,CAAC,OAAO,IAAI,WAAW,EAAE,CAAC;IACzC,MAAM,CAAC,OAAO,GAAG;QACf,GAAG,EAAE;YACH,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;SACxC;KACK,CAAA;AACV,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAA4C,WAAW,CACvE,KAAK,CAAC,EAAE,CAAC,KAAK,EACd,UAAU,CAAC,mBAAmB,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CACzE,CAAA;AAED,6BAA6B;AAC7B,KAAK,CAAC,WAAW,CAAC;IAChB,GAAG;IACH,KAAK;IACL,IAAI;CACL,CAAC,CAAA","sourcesContent":["import { lazyReducerEnhancer, LazyStore } from './lazy-reducer-enhancer.js'\nimport { Action, applyMiddleware, combineReducers, compose, createStore, Store } from 'redux'\nimport thunk from 'redux-thunk'\n\nimport app from './reducers/app.js'\nimport route from './reducers/route.js'\nimport busy from './reducers/busy.js'\n\ndeclare global {\n var __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any\n}\n\n// Sets up a Chrome extension for time travel debugging.\n// See https://github.com/zalmoxisus/redux-devtools-extension for more information.\nconst devCompose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose\n\n// Only for providing test environment - combineReducers 에서 process.env.NODE_ENV를 접근하기 때문에.\nif (typeof window.process == 'undefined') {\n window.process = {\n env: {\n NODE_ENV: JSON.stringify('development')\n }\n } as any\n}\n\nexport const store: Store<unknown, Action<any>> & LazyStore = createStore(\n state => state,\n devCompose(lazyReducerEnhancer(combineReducers), applyMiddleware(thunk))\n)\n\n// Initially loaded reducers.\nstore.addReducers({\n app,\n route,\n busy\n})\n"]}