@operato/shell 9.0.34 → 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.
- package/CHANGELOG.md +8 -0
- package/dist/src/actions/route.d.ts +0 -9
- package/dist/src/actions/route.js +0 -15
- package/dist/src/actions/route.js.map +1 -1
- package/dist/src/app/app.d.ts +4 -9
- package/dist/src/app/app.js +16 -12
- package/dist/src/app/app.js.map +1 -1
- package/dist/src/connect-mixin.d.ts +20 -0
- package/dist/src/connect-mixin.js +18 -0
- package/dist/src/connect-mixin.js.map +1 -0
- package/dist/src/controllers/app-controller.d.ts +33 -0
- package/dist/src/controllers/app-controller.js +35 -0
- package/dist/src/controllers/app-controller.js.map +1 -0
- package/dist/src/controllers/context-controller.d.ts +10 -0
- package/dist/src/controllers/context-controller.js +25 -0
- package/dist/src/controllers/context-controller.js.map +1 -0
- package/dist/src/controllers/font-controller.d.ts +20 -0
- package/dist/src/controllers/font-controller.js +22 -0
- package/dist/src/controllers/font-controller.js.map +1 -0
- package/dist/src/controllers/index.d.ts +11 -0
- package/dist/src/controllers/index.js +8 -0
- package/dist/src/controllers/index.js.map +1 -0
- package/dist/src/controllers/layout-controller.d.ts +13 -0
- package/dist/src/controllers/layout-controller.js +27 -0
- package/dist/src/controllers/layout-controller.js.map +1 -0
- package/dist/src/controllers/menu-controller.d.ts +11 -0
- package/dist/src/controllers/menu-controller.js +27 -0
- package/dist/src/controllers/menu-controller.js.map +1 -0
- package/dist/src/controllers/route-controller.d.ts +21 -0
- package/dist/src/controllers/route-controller.js +37 -0
- package/dist/src/controllers/route-controller.js.map +1 -0
- package/dist/src/controllers/snackbar-controller.d.ts +27 -0
- package/dist/src/controllers/snackbar-controller.js +38 -0
- package/dist/src/controllers/snackbar-controller.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/lazy-reducer-enhancer.d.ts +7 -0
- package/dist/src/lazy-reducer-enhancer.js +13 -0
- package/dist/src/lazy-reducer-enhancer.js.map +1 -0
- package/dist/src/reducers/route.js +1 -4
- package/dist/src/reducers/route.js.map +1 -1
- package/dist/src/router.d.ts +5 -0
- package/dist/src/router.js +28 -0
- package/dist/src/router.js.map +1 -0
- package/dist/src/store.d.ts +1 -1
- package/dist/src/store.js +1 -1
- package/dist/src/store.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [9.1.0](https://github.com/hatiolab/operato/compare/v9.0.35...v9.1.0) (2025-09-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @operato/shell
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
### [9.0.34](https://github.com/hatiolab/operato/compare/v9.0.33...v9.0.34) (2025-09-15)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @operato/shell
|
|
@@ -35,12 +35,3 @@ export declare const navigateWithSilence: ({ pathname: path, search, params }: {
|
|
|
35
35
|
export declare const loadPage: (page: string, id: string, params: {
|
|
36
36
|
[key: string]: any;
|
|
37
37
|
}) => (dispatch: any) => Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Route to a given URL by creating a link element and triggering a click event.
|
|
40
|
-
* This approach does not work properly in a mobile environment and therefore should not be used.
|
|
41
|
-
*
|
|
42
|
-
* @deprecated
|
|
43
|
-
*
|
|
44
|
-
* @param url - The URL to route to.
|
|
45
|
-
*/
|
|
46
|
-
export declare const route: (url: string) => void;
|
|
@@ -91,19 +91,4 @@ export const loadPage = (page, id, params) => async (dispatch) => {
|
|
|
91
91
|
params
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
|
-
/**
|
|
95
|
-
* Route to a given URL by creating a link element and triggering a click event.
|
|
96
|
-
* This approach does not work properly in a mobile environment and therefore should not be used.
|
|
97
|
-
*
|
|
98
|
-
* @deprecated
|
|
99
|
-
*
|
|
100
|
-
* @param url - The URL to route to.
|
|
101
|
-
*/
|
|
102
|
-
export const route = (url) => {
|
|
103
|
-
const link = document.createElement('a');
|
|
104
|
-
link.setAttribute('href', url);
|
|
105
|
-
document.body.appendChild(link);
|
|
106
|
-
link.click();
|
|
107
|
-
document.body.removeChild(link);
|
|
108
|
-
};
|
|
109
94
|
//# sourceMappingURL=route.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/actions/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAAE,OAAiB,EAAE,EAAE;IAC9D,IAAI,OAAO;QAAE,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAA;;QACzD,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAA;IAExC,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAA;AAC7C,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC9B,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAA0E,EAAE,EAAE,CAC/G,CAAC,QAAa,EAAE,EAAE;IAChB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC,IAAI,CA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C;QACZ,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7C,IAAI,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;YACvB,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;YAC9D,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,KAAK,CAAA;YACd,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAU,EAAE,MAA8B,EAAE,EAAE,CAAC,KAAK,EAAE,QAAa,EAAE,EAAE;IAC5G,IAAI,OAAO,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAA;IAEtC,IAAI,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,QAAQ,CACN,mBAAmB,CAAC;YAClB,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO;YAC3C,MAAM;SACP,CAAC,CACH,CAAA;QACD,OAAM;IACR,CAAC;IAED,QAAQ,CAAC;QACP,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,EAAE;QACd,MAAM;KACP,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { getPathInfo } from '@operato/utils'\n\nimport { HOMEPAGE, UPDATE_PAGE } from '../actions/const.js'\nimport { store } from '../store.js'\n\n/**\n * Navigate to a page using one of two methods:\n * 1. Using a page link: <a href='page'>goto page</a> (equivalent to route(page))\n * 2. Using the navigate('page') function.\n *\n * 페이지를 이동하는 방법으로는 다음 두가지가 있다.\n * 1. page link를 사용하는 방법 <a href='page'>goto page</a>\n * 이 방법은 route(page)와 동일하다.\n * 2. navigate('page')를 사용하는 방법\n *\n * @param location - The path of the page to navigate to.\n * @param replace - Optional. If true, replaces the current page in the browser's history.\n */\nexport const navigate = (location: string, replace?: boolean) => {\n if (replace) history.replaceState(history.state, '', location)\n else history.pushState({}, '', location)\n\n window.dispatchEvent(new Event('popstate'))\n}\n\n/**\n * Navigate to a page with optional query parameters, and dispatch a Redux action to load the page.\n *\n * @param pathInfo - Object containing pathname, search, and optional params.\n * @param dispatch - Redux dispatch function.\n */\nexport const navigateWithSilence =\n ({ pathname: path, search, params }: { pathname: string; search?: string; params?: { [key: string]: any } }) =>\n (dispatch: any) => {\n const { path: pathname } = getPathInfo(path)\n\n const reg = /\\/([^\\/]+)\\/*([^\\/]*)/\n const decodePath = decodeURIComponent(pathname!)\n const matchReturn = decodePath.match(reg) || []\n const page = matchReturn[1] || HOMEPAGE\n const id = matchReturn[2]\n\n if (!params) {\n params = {}\n\n new URLSearchParams(search).forEach((value, key) => {\n params![key] = value\n })\n }\n\n // Any other info you might want to extract from the path (like page type),\n // you can do here\n dispatch(loadPage(page, id, params))\n }\n\n/**\n * Preload a page by performing any necessary preprocessing before loading.\n *\n * @param page - The page to preload.\n * @returns - The new page path or routing result after preprocessing.\n */\nconst _preLoadPage = async (page: any) => {\n /*\n * _preLoadPage 에서는 page를 load하기 전처리를 수행한다.\n * 예를 들면, page dynamic import 또는 page re-routing\n */\n var state: any = store.getState()\n\n /* override 기능을 위해서 dependency 관계의 역순으로 route를 실행한다. */\n var modules = state.app.modules\n if (modules) {\n for (let i = modules.length - 1; i >= 0; i--) {\n let module = modules[i]\n let _page = module.route && (await module.route(page, module))\n if (_page) {\n return _page\n }\n }\n }\n}\n\n/**\n * Load a page by dispatching a Redux action, and handle page navigation if necessary.\n *\n * @param page - The page to load.\n * @param id - The associated resource ID.\n * @param params - Additional parameters to pass to the page.\n */\nexport const loadPage = (page: string, id: string, params: { [key: string]: any }) => async (dispatch: any) => {\n var newPage = await _preLoadPage(page)\n\n if (page !== newPage && newPage.indexOf('/') == 0) {\n dispatch(\n navigateWithSilence({\n pathname: id ? `${newPage}/${id}` : newPage,\n params\n })\n )\n return\n }\n\n dispatch({\n type: UPDATE_PAGE,\n page: newPage,\n resourceId: id,\n params\n })\n}\n"]}
|
package/dist/src/app/app.d.ts
CHANGED
|
@@ -5,14 +5,7 @@ declare enum MODULES_STATE {
|
|
|
5
5
|
INITIALIZING = 1,
|
|
6
6
|
INITIALIZED = 2
|
|
7
7
|
}
|
|
8
|
-
declare
|
|
9
|
-
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
10
|
-
connectedCallback(): void;
|
|
11
|
-
disconnectedCallback(): void;
|
|
12
|
-
stateChanged(_state: unknown): void;
|
|
13
|
-
readonly isConnected: boolean;
|
|
14
|
-
}) & typeof LitElement;
|
|
15
|
-
export declare class ThingsApp extends ThingsApp_base {
|
|
8
|
+
export declare class ThingsApp extends LitElement {
|
|
16
9
|
static styles: import("lit").CSSResult[];
|
|
17
10
|
static moduleInitialized: MODULES_STATE;
|
|
18
11
|
static modules: Array<any>;
|
|
@@ -26,6 +19,8 @@ export declare class ThingsApp extends ThingsApp_base {
|
|
|
26
19
|
}>;
|
|
27
20
|
static callbacks: Array<any>;
|
|
28
21
|
static contextPath?: string;
|
|
22
|
+
private _routeCtrl;
|
|
23
|
+
private _appCtrl;
|
|
29
24
|
contextPathPrefix?: string;
|
|
30
25
|
resourceId?: string;
|
|
31
26
|
page?: string;
|
|
@@ -41,7 +36,7 @@ export declare class ThingsApp extends ThingsApp_base {
|
|
|
41
36
|
routeToPage(): Promise<void>;
|
|
42
37
|
updated(changes: PropertyValues<this>): Promise<void>;
|
|
43
38
|
shouldUpdate(): boolean;
|
|
44
|
-
|
|
39
|
+
protected willUpdate(): void;
|
|
45
40
|
static registerPages(): Promise<void>;
|
|
46
41
|
setBase(): void;
|
|
47
42
|
}
|
package/dist/src/app/app.js
CHANGED
|
@@ -2,12 +2,13 @@ var ThingsApp_1;
|
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
3
|
import { html, LitElement } from 'lit';
|
|
4
4
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
5
|
-
import {
|
|
6
|
-
import { installRouter } from 'pwa-helpers/router.js';
|
|
5
|
+
import { installRouter } from '../router.js';
|
|
7
6
|
import { ScrollbarStyles } from '@operato/styles';
|
|
8
7
|
import { setContextPathPrefix, getPathInfo } from '@operato/utils';
|
|
9
8
|
import { navigateWithSilence, UPDATE_ACTIVE_PAGE, UPDATE_CONTEXT_PATH, UPDATE_MODULES } from '../actions/index.js';
|
|
10
9
|
import { store } from '../store.js';
|
|
10
|
+
import { RouteController } from '../controllers/route-controller.js';
|
|
11
|
+
import { AppController } from '../controllers/app-controller.js';
|
|
11
12
|
import { AppStyle } from './app-style.js';
|
|
12
13
|
var MODULES_STATE;
|
|
13
14
|
(function (MODULES_STATE) {
|
|
@@ -15,9 +16,11 @@ var MODULES_STATE;
|
|
|
15
16
|
MODULES_STATE[MODULES_STATE["INITIALIZING"] = 1] = "INITIALIZING";
|
|
16
17
|
MODULES_STATE[MODULES_STATE["INITIALIZED"] = 2] = "INITIALIZED";
|
|
17
18
|
})(MODULES_STATE || (MODULES_STATE = {}));
|
|
18
|
-
let ThingsApp = class ThingsApp extends
|
|
19
|
+
let ThingsApp = class ThingsApp extends LitElement {
|
|
19
20
|
constructor() {
|
|
20
21
|
super(...arguments);
|
|
22
|
+
this._routeCtrl = new RouteController(this);
|
|
23
|
+
this._appCtrl = new AppController(this);
|
|
21
24
|
this.contextPathPrefix = undefined;
|
|
22
25
|
this.contextPath = ThingsApp_1.contextPath;
|
|
23
26
|
this.modules = ThingsApp_1.modules;
|
|
@@ -160,7 +163,7 @@ let ThingsApp = class ThingsApp extends connect(store)(LitElement) {
|
|
|
160
163
|
if (changes.has('modules')) {
|
|
161
164
|
ThingsApp_1.registerPages();
|
|
162
165
|
}
|
|
163
|
-
if (changes.has('page') || changes.has('resourceId') || changes.has('params')) {
|
|
166
|
+
if ((changes.has('page') || changes.has('resourceId') || changes.has('params')) && this.page) {
|
|
164
167
|
this.routeToPage();
|
|
165
168
|
}
|
|
166
169
|
if (changes.has('contextPath')) {
|
|
@@ -170,14 +173,15 @@ let ThingsApp = class ThingsApp extends connect(store)(LitElement) {
|
|
|
170
173
|
shouldUpdate() {
|
|
171
174
|
return ThingsApp_1.moduleInitialized == 2;
|
|
172
175
|
}
|
|
173
|
-
|
|
174
|
-
this.page =
|
|
175
|
-
this.params =
|
|
176
|
-
this.resourceId =
|
|
177
|
-
this.context =
|
|
178
|
-
|
|
179
|
-
ThingsApp_1.
|
|
180
|
-
ThingsApp_1.
|
|
176
|
+
willUpdate() {
|
|
177
|
+
this.page = this._routeCtrl.page;
|
|
178
|
+
this.params = this._routeCtrl.params;
|
|
179
|
+
this.resourceId = this._routeCtrl.resourceId;
|
|
180
|
+
this.context = this._routeCtrl.context;
|
|
181
|
+
this.activePage = this._routeCtrl.activePage;
|
|
182
|
+
ThingsApp_1.modules = this.modules = this._appCtrl.modules;
|
|
183
|
+
ThingsApp_1.contextPath = this.contextPath = this._appCtrl.contextPath;
|
|
184
|
+
ThingsApp_1.callbacks = store.getState().route?.callbacks || [];
|
|
181
185
|
}
|
|
182
186
|
static async registerPages() {
|
|
183
187
|
ThingsApp_1.pages = new Promise(resolve => (ThingsApp_1.pagesResolver = resolve));
|
package/dist/src/app/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/app/app.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACtD,OAAO,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,MAAM,CAAC,CAAA;QAC3C,IAAI,EAAE,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAC7E,CAAC;;AAxO6D;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;oDAAuC;AAE3F;IAAR,KAAK,EAAE;6CAAoB;AACnB;IAAR,KAAK,EAAE;uCAAc;AACb;IAAR,KAAK,EAAE;yCAAa;AACZ;IAAR,KAAK,EAAE;6CAAsB;AACrB;IAAR,KAAK,EAAE;0CAAa;AACZ;IAAR,KAAK,EAAE;8CAA6C;AAC5C;IAAR,KAAK,EAAE;0CAAwC;AAEzB;IAAtB,KAAK,CAAC,MAAM,CAAC;uCAA2B;AAjC9B,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAgQrB","sourcesContent":["import { html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\nimport { installRouter } from 'pwa-helpers/router.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { setContextPathPrefix, getPathInfo } from '@operato/utils'\n\nimport { navigateWithSilence, UPDATE_ACTIVE_PAGE, UPDATE_CONTEXT_PATH, UPDATE_MODULES } from '../actions/index.js'\nimport { store } from '../store.js'\nimport { AppStyle } from './app-style.js'\nimport { PageView } from './pages/page-view.js'\n\nenum MODULES_STATE {\n NOT_INITIALIZED,\n INITIALIZING,\n INITIALIZED\n}\n\n@customElement('things-app')\nexport class ThingsApp extends connect(store)(LitElement) {\n static styles = [ScrollbarStyles, AppStyle]\n\n static moduleInitialized: MODULES_STATE = MODULES_STATE.NOT_INITIALIZED\n static modules: Array<any> = []\n\n /* \n 모든 모듈의 routes 리스트가 수집될 때까지, routeToPage(..) 를 hold 시키기 위해서 ThingsApp.pages를 Promise로 정의한다. \n */\n static pagesResolver: (\n value:\n | {\n [path: string]: string\n }\n | PromiseLike<{\n [path: string]: string\n }>\n ) => void\n static pages: Promise<{ [path: string]: string }>\n\n static callbacks: Array<any> = []\n static contextPath?: string\n\n @property({ type: String, attribute: 'context-path-prefix' }) contextPathPrefix?: string = undefined\n\n @state() resourceId?: string\n @state() page?: string\n @state() params?: any\n @state() activePage?: PageView\n @state() context: any\n @state() contextPath?: string = ThingsApp.contextPath\n @state() modules: Array<any> = ThingsApp.modules\n\n @query('main') private main!: HTMLElement\n\n render() {\n var params = this.params || {}\n var fullbleed = (this.context && this.context.fullbleed) || (params.fullbleed && params.fullbleed == 'Y')\n var widebleed = (this.context && this.context.widebleed) || (params.widebleed && params.widebleed == 'Y')\n\n return html`\n <div>\n <ox-page-header-bar header></ox-page-header-bar>\n <main></main>\n <ox-page-footer-bar footer></ox-page-footer-bar>\n </div>\n\n <ox-header-bar ?fullbleed=${fullbleed}></ox-header-bar>\n\n <ox-nav-bar ?fullbleed=${fullbleed || widebleed}></ox-nav-bar>\n\n <ox-aside-bar ?fullbleed=${fullbleed || widebleed}></ox-aside-bar>\n\n <ox-footer-bar ?fullbleed=${fullbleed}></ox-footer-bar>\n\n <ox-snack-bar></ox-snack-bar>\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.setBase()\n\n if (ThingsApp.moduleInitialized != MODULES_STATE.NOT_INITIALIZED) {\n /* 첫번째 이후로 생성되는 경우에는 강제로 'popstate'를 발생시켜서, routing 기회를 준다 */\n window.dispatchEvent(new CustomEvent('popstate'))\n\n return\n }\n\n ThingsApp.moduleInitialized = MODULES_STATE.INITIALIZING\n\n /* 모듈 임포트를 동적으로 처리한다. */\n import(\n /* webpackPrefetch: true */\n /* webpackPreload: true */\n /* webpackChunkName: \"modules\" */\n '../module-importer.import'\n ).then(async module => {\n var modules: {\n name: string\n bootstrap: (m?: any /* self */) => void\n }[] = module.modules\n\n /* lifecycle - bootstrapping */\n for (let idx = 0; idx < modules.length; idx++) {\n const m = modules[idx]\n try {\n if (m.bootstrap) {\n await m.bootstrap(m)\n }\n } catch (e) {\n console.error(`[${idx} BOOTSTRAP ERROR -${m.name}]`, e)\n }\n }\n\n /* shouldUpdate를 활성화한다. */\n ThingsApp.moduleInitialized = MODULES_STATE.INITIALIZED\n\n /* modules를 store에 dispatch 함으로써, update를 invoke 시킨다. */\n store.dispatch({\n type: UPDATE_MODULES,\n modules\n })\n\n var lastPathName: string = ''\n\n installRouter(async (location, e) => {\n var { pathname } = location\n var { contextPath } = getPathInfo(pathname)\n\n /* 페이지를 나가기 전에 옮기지 않도록 개입할 기회를 준다 */\n if (\n lastPathName &&\n lastPathName != pathname &&\n this.activePage &&\n this.activePage.canDeactivate &&\n !(await this.activePage.canDeactivate())\n ) {\n history.pushState({}, this.activePage.title, lastPathName)\n return\n }\n\n lastPathName = pathname\n\n if (ThingsApp.contextPath !== contextPath) {\n store.dispatch({\n type: UPDATE_CONTEXT_PATH,\n contextPath\n })\n }\n\n store.dispatch(navigateWithSilence(location) as any)\n\n ThingsApp.callbacks &&\n ThingsApp.callbacks.forEach(callback => {\n try {\n callback.call(this, location, e)\n } catch (ex) {\n console.error(ex)\n }\n })\n })\n })\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback()\n }\n\n async routeToPage() {\n const activePages = this.renderRoot.querySelectorAll('main > .page[active]')\n activePages.forEach(page => {\n page.removeAttribute('active')\n })\n\n this.activePage = this.renderRoot.querySelector(`main > .page[data-page=${this.page}]`) as PageView\n\n if (!this.activePage) {\n /* 해당 route에 연결된 page가 없는 경우에 main 섹션에 해당 element를 추가해준다. */\n const tagname = (await ThingsApp.pages)[this.page!]\n if (tagname) {\n const el = document.createElement(tagname) as PageView\n el.setAttribute('class', 'page')\n el.setAttribute('data-page', this.page!)\n\n this.main.appendChild(el)\n\n this.activePage = el\n }\n }\n\n if (this.activePage) {\n this.activePage.setAttribute('active', '')\n this.activePage.setAttribute('context-path', this.contextPath!)\n this.activePage.lifecycle = {\n ...(this.activePage.lifecycle || {}),\n active: true,\n params: this.params,\n resourceId: this.resourceId,\n page: this.page\n }\n }\n\n store.dispatch({\n type: UPDATE_ACTIVE_PAGE,\n activePage: this.activePage\n })\n }\n\n async updated(changes: PropertyValues<this>) {\n if (changes.has('contextPathPrefix')) {\n setContextPathPrefix(this.contextPathPrefix)\n }\n\n if (changes.has('modules')) {\n ThingsApp.registerPages()\n }\n\n if (changes.has('page') || changes.has('resourceId') || changes.has('params')) {\n this.routeToPage()\n }\n\n if (changes.has('contextPath')) {\n this.setBase()\n }\n }\n\n shouldUpdate() {\n return ThingsApp.moduleInitialized == 2\n }\n\n stateChanged(state: any) {\n this.page = state.route.page\n this.params = state.route.params\n this.resourceId = state.route.resourceId\n this.context = state.route.context\n\n ThingsApp.modules = this.modules = state.app.modules\n ThingsApp.contextPath = this.contextPath = state.app.contextPath\n ThingsApp.callbacks = state.route.callbacks\n }\n\n static async registerPages() {\n ThingsApp.pages = new Promise<{ [path: string]: string }>(resolve => (ThingsApp.pagesResolver = resolve))\n\n var reversedModules = [...ThingsApp.modules].reverse()\n const pages: { [path: string]: string } = {}\n\n /* 모듈 참조 순서 역순으로 page를 추가한다. (for overidable) */\n for (const m of reversedModules) {\n if (!m.routes) {\n continue\n }\n\n /* \n 각 모듈의 routes가 모두 완성될 때까지 ThingsApp.pages 구성을 지연한다.\n 각 모듈의 routes를 동적으로도 구성할 수 있도록 하기 위해서이다.\n */\n const routes = await m.routes\n\n routes.forEach((route: any) => {\n if (!pages[route.page]) {\n pages[route.page] = route.tagname\n }\n })\n }\n\n ThingsApp.pagesResolver(pages)\n }\n\n setBase() {\n const base = document.querySelector('base')\n base?.setAttribute('href', this.contextPath ? `${this.contextPath}/` : '/')\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/app/app.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM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ACF,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,MAAM,CAAA;YAE7B,MAAM,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;gBAC5B,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;oBACvB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAA;gBACnC,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,WAAS,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC;IAED,OAAO;QACL,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAC3C,IAAI,EAAE,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAC7E,CAAC;;AAzO6D;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;oDAAuC;AAE3F;IAAR,KAAK,EAAE;6CAAoB;AACnB;IAAR,KAAK,EAAE;uCAAc;AACb;IAAR,KAAK,EAAE;yCAAa;AACZ;IAAR,KAAK,EAAE;6CAAsB;AACrB;IAAR,KAAK,EAAE;0CAAa;AACZ;IAAR,KAAK,EAAE;8CAA6C;AAC5C;IAAR,KAAK,EAAE;0CAAwC;AAEzB;IAAtB,KAAK,CAAC,MAAM,CAAC;uCAA2B;AApC9B,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAoQrB","sourcesContent":["import { html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { installRouter } from '../router.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { setContextPathPrefix, getPathInfo } from '@operato/utils'\n\nimport { navigateWithSilence, UPDATE_ACTIVE_PAGE, UPDATE_CONTEXT_PATH, UPDATE_MODULES } from '../actions/index.js'\nimport { store } from '../store.js'\nimport { RouteController } from '../controllers/route-controller.js'\nimport { AppController } from '../controllers/app-controller.js'\nimport { AppStyle } from './app-style.js'\nimport { PageView } from './pages/page-view.js'\n\nenum MODULES_STATE {\n NOT_INITIALIZED,\n INITIALIZING,\n INITIALIZED\n}\n\n@customElement('things-app')\nexport class ThingsApp extends LitElement {\n static styles = [ScrollbarStyles, AppStyle]\n\n static moduleInitialized: MODULES_STATE = MODULES_STATE.NOT_INITIALIZED\n static modules: Array<any> = []\n\n /* \n 모든 모듈의 routes 리스트가 수집될 때까지, routeToPage(..) 를 hold 시키기 위해서 ThingsApp.pages를 Promise로 정의한다. \n */\n static pagesResolver: (\n value:\n | {\n [path: string]: string\n }\n | PromiseLike<{\n [path: string]: string\n }>\n ) => void\n static pages: Promise<{ [path: string]: string }>\n\n static callbacks: Array<any> = []\n static contextPath?: string\n\n private _routeCtrl = new RouteController(this)\n private _appCtrl = new AppController(this)\n\n @property({ type: String, attribute: 'context-path-prefix' }) contextPathPrefix?: string = undefined\n\n @state() resourceId?: string\n @state() page?: string\n @state() params?: any\n @state() activePage?: PageView\n @state() context: any\n @state() contextPath?: string = ThingsApp.contextPath\n @state() modules: Array<any> = ThingsApp.modules\n\n @query('main') private main!: HTMLElement\n\n render() {\n var params = this.params || {}\n var fullbleed = (this.context && this.context.fullbleed) || (params.fullbleed && params.fullbleed == 'Y')\n var widebleed = (this.context && this.context.widebleed) || (params.widebleed && params.widebleed == 'Y')\n\n return html`\n <div>\n <ox-page-header-bar header></ox-page-header-bar>\n <main></main>\n <ox-page-footer-bar footer></ox-page-footer-bar>\n </div>\n\n <ox-header-bar ?fullbleed=${fullbleed}></ox-header-bar>\n\n <ox-nav-bar ?fullbleed=${fullbleed || widebleed}></ox-nav-bar>\n\n <ox-aside-bar ?fullbleed=${fullbleed || widebleed}></ox-aside-bar>\n\n <ox-footer-bar ?fullbleed=${fullbleed}></ox-footer-bar>\n\n <ox-snack-bar></ox-snack-bar>\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.setBase()\n\n if (ThingsApp.moduleInitialized != MODULES_STATE.NOT_INITIALIZED) {\n /* 첫번째 이후로 생성되는 경우에는 강제로 'popstate'를 발생시켜서, routing 기회를 준다 */\n window.dispatchEvent(new CustomEvent('popstate'))\n\n return\n }\n\n ThingsApp.moduleInitialized = MODULES_STATE.INITIALIZING\n\n /* 모듈 임포트를 동적으로 처리한다. */\n import(\n /* webpackPrefetch: true */\n /* webpackPreload: true */\n /* webpackChunkName: \"modules\" */\n '../module-importer.import'\n ).then(async module => {\n var modules: {\n name: string\n bootstrap: (m?: any /* self */) => void\n }[] = module.modules\n\n /* lifecycle - bootstrapping */\n for (let idx = 0; idx < modules.length; idx++) {\n const m = modules[idx]\n try {\n if (m.bootstrap) {\n await m.bootstrap(m)\n }\n } catch (e) {\n console.error(`[${idx} BOOTSTRAP ERROR -${m.name}]`, e)\n }\n }\n\n /* shouldUpdate를 활성화한다. */\n ThingsApp.moduleInitialized = MODULES_STATE.INITIALIZED\n\n /* modules를 store에 dispatch 함으로써, update를 invoke 시킨다. */\n store.dispatch({\n type: UPDATE_MODULES,\n modules\n })\n\n var lastPathName: string = ''\n\n installRouter(async (location, e) => {\n var { pathname } = location\n var { contextPath } = getPathInfo(pathname)\n\n /* 페이지를 나가기 전에 옮기지 않도록 개입할 기회를 준다 */\n if (\n lastPathName &&\n lastPathName != pathname &&\n this.activePage &&\n this.activePage.canDeactivate &&\n !(await this.activePage.canDeactivate())\n ) {\n history.pushState({}, this.activePage.title, lastPathName)\n return\n }\n\n lastPathName = pathname\n\n if (ThingsApp.contextPath !== contextPath) {\n store.dispatch({\n type: UPDATE_CONTEXT_PATH,\n contextPath\n })\n }\n\n store.dispatch(navigateWithSilence(location) as any)\n\n ThingsApp.callbacks &&\n ThingsApp.callbacks.forEach(callback => {\n try {\n callback.call(this, location, e)\n } catch (ex) {\n console.error(ex)\n }\n })\n })\n })\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback()\n }\n\n async routeToPage() {\n const activePages = this.renderRoot.querySelectorAll('main > .page[active]')\n activePages.forEach(page => {\n page.removeAttribute('active')\n })\n\n this.activePage = this.renderRoot.querySelector(`main > .page[data-page=${this.page}]`) as PageView\n\n if (!this.activePage) {\n /* 해당 route에 연결된 page가 없는 경우에 main 섹션에 해당 element를 추가해준다. */\n const tagname = (await ThingsApp.pages)[this.page!]\n if (tagname) {\n const el = document.createElement(tagname) as PageView\n el.setAttribute('class', 'page')\n el.setAttribute('data-page', this.page!)\n\n this.main.appendChild(el)\n\n this.activePage = el\n }\n }\n\n if (this.activePage) {\n this.activePage.setAttribute('active', '')\n this.activePage.setAttribute('context-path', this.contextPath!)\n this.activePage.lifecycle = {\n ...(this.activePage.lifecycle || {}),\n active: true,\n params: this.params,\n resourceId: this.resourceId,\n page: this.page\n }\n }\n\n store.dispatch({\n type: UPDATE_ACTIVE_PAGE,\n activePage: this.activePage\n })\n }\n\n async updated(changes: PropertyValues<this>) {\n if (changes.has('contextPathPrefix')) {\n setContextPathPrefix(this.contextPathPrefix)\n }\n\n if (changes.has('modules')) {\n ThingsApp.registerPages()\n }\n\n if ((changes.has('page') || changes.has('resourceId') || changes.has('params')) && this.page) {\n this.routeToPage()\n }\n\n if (changes.has('contextPath')) {\n this.setBase()\n }\n }\n\n shouldUpdate() {\n return ThingsApp.moduleInitialized == 2\n }\n\n protected willUpdate() {\n this.page = this._routeCtrl.page\n this.params = this._routeCtrl.params\n this.resourceId = this._routeCtrl.resourceId\n this.context = this._routeCtrl.context\n this.activePage = this._routeCtrl.activePage\n\n ThingsApp.modules = this.modules = this._appCtrl.modules\n ThingsApp.contextPath = this.contextPath = this._appCtrl.contextPath\n ThingsApp.callbacks = (store.getState() as any).route?.callbacks || []\n }\n\n static async registerPages() {\n ThingsApp.pages = new Promise<{ [path: string]: string }>(resolve => (ThingsApp.pagesResolver = resolve))\n\n var reversedModules = [...ThingsApp.modules].reverse()\n const pages: { [path: string]: string } = {}\n\n /* 모듈 참조 순서 역순으로 page를 추가한다. (for overidable) */\n for (const m of reversedModules) {\n if (!m.routes) {\n continue\n }\n\n /* \n 각 모듈의 routes가 모두 완성될 때까지 ThingsApp.pages 구성을 지연한다.\n 각 모듈의 routes를 동적으로도 구성할 수 있도록 하기 위해서이다.\n */\n const routes = await m.routes\n\n routes.forEach((route: any) => {\n if (!pages[route.page]) {\n pages[route.page] = route.tagname\n }\n })\n }\n\n ThingsApp.pagesResolver(pages)\n }\n\n setBase() {\n const base = document.querySelector('base')\n base?.setAttribute('href', this.contextPath ? `${this.contextPath}/` : '/')\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Store } from 'redux';
|
|
2
|
+
type Constructor<T = {}> = new (...args: any[]) => T;
|
|
3
|
+
interface CustomElement {
|
|
4
|
+
connectedCallback?(): void;
|
|
5
|
+
disconnectedCallback?(): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use ReactiveController adapters from `@operato/shell` instead
|
|
9
|
+
* (e.g. RouteController, LayoutController, ContextController, etc.).
|
|
10
|
+
* Kept for backward compatibility with things-factory consumers.
|
|
11
|
+
*/
|
|
12
|
+
export declare const connect: <S>(store: Store<S>) => <T extends Constructor<CustomElement>>(baseElement: T) => {
|
|
13
|
+
new (...args: any[]): {
|
|
14
|
+
_storeUnsubscribe: () => void;
|
|
15
|
+
connectedCallback(): void;
|
|
16
|
+
disconnectedCallback(): void;
|
|
17
|
+
stateChanged(_state: S): void;
|
|
18
|
+
};
|
|
19
|
+
} & T;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use ReactiveController adapters from `@operato/shell` instead
|
|
3
|
+
* (e.g. RouteController, LayoutController, ContextController, etc.).
|
|
4
|
+
* Kept for backward compatibility with things-factory consumers.
|
|
5
|
+
*/
|
|
6
|
+
export const connect = (store) => (baseElement) => class extends baseElement {
|
|
7
|
+
connectedCallback() {
|
|
8
|
+
super.connectedCallback?.();
|
|
9
|
+
this._storeUnsubscribe = store.subscribe(() => this.stateChanged(store.getState()));
|
|
10
|
+
this.stateChanged(store.getState());
|
|
11
|
+
}
|
|
12
|
+
disconnectedCallback() {
|
|
13
|
+
this._storeUnsubscribe();
|
|
14
|
+
super.disconnectedCallback?.();
|
|
15
|
+
}
|
|
16
|
+
stateChanged(_state) { }
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=connect-mixin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-mixin.js","sourceRoot":"","sources":["../../src/connect-mixin.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAClB,CAAI,KAAe,EAAE,EAAE,CACvB,CAAuC,WAAc,EAAE,EAAE,CACvD,KAAM,SAAQ,WAAW;IAGvB,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,EAAE,CAAA;QAC3B,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;QACnF,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;IACrC,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,iBAAiB,EAAE,CAAA;QACxB,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAA;IAChC,CAAC;IAED,YAAY,CAAC,MAAS,IAAG,CAAC;CAC3B,CAAA","sourcesContent":["import { Store } from 'redux'\n\ntype Constructor<T = {}> = new (...args: any[]) => T\n\ninterface CustomElement {\n connectedCallback?(): void\n disconnectedCallback?(): void\n}\n\n/**\n * @deprecated Use ReactiveController adapters from `@operato/shell` instead\n * (e.g. RouteController, LayoutController, ContextController, etc.).\n * Kept for backward compatibility with things-factory consumers.\n */\nexport const connect =\n <S>(store: Store<S>) =>\n <T extends Constructor<CustomElement>>(baseElement: T) =>\n class extends baseElement {\n _storeUnsubscribe!: () => void\n\n connectedCallback() {\n super.connectedCallback?.()\n this._storeUnsubscribe = store.subscribe(() => this.stateChanged(store.getState()))\n this.stateChanged(store.getState())\n }\n\n disconnectedCallback() {\n this._storeUnsubscribe()\n super.disconnectedCallback?.()\n }\n\n stateChanged(_state: S) {}\n }\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export interface AppState {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
contextPath: string;
|
|
5
|
+
modules: any[];
|
|
6
|
+
domains: {
|
|
7
|
+
name: string;
|
|
8
|
+
subdomain: string;
|
|
9
|
+
}[];
|
|
10
|
+
domain?: {
|
|
11
|
+
name: string;
|
|
12
|
+
subdomain: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare class AppController implements ReactiveController {
|
|
16
|
+
host: ReactiveControllerHost;
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
contextPath: string;
|
|
19
|
+
modules: any[];
|
|
20
|
+
domains: {
|
|
21
|
+
name: string;
|
|
22
|
+
subdomain: string;
|
|
23
|
+
}[];
|
|
24
|
+
domain?: {
|
|
25
|
+
name: string;
|
|
26
|
+
subdomain: string;
|
|
27
|
+
};
|
|
28
|
+
private _unsubscribe?;
|
|
29
|
+
constructor(host: ReactiveControllerHost);
|
|
30
|
+
hostConnected(): void;
|
|
31
|
+
hostDisconnected(): void;
|
|
32
|
+
private _apply;
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { store } from '../store.js';
|
|
2
|
+
export class AppController {
|
|
3
|
+
constructor(host) {
|
|
4
|
+
this.baseUrl = '';
|
|
5
|
+
this.contextPath = '';
|
|
6
|
+
this.modules = [];
|
|
7
|
+
this.domains = [];
|
|
8
|
+
this.host = host;
|
|
9
|
+
host.addController(this);
|
|
10
|
+
}
|
|
11
|
+
hostConnected() {
|
|
12
|
+
this._apply(store.getState().app);
|
|
13
|
+
this._unsubscribe = store.subscribe(() => {
|
|
14
|
+
const next = store.getState().app;
|
|
15
|
+
if (this.modules !== next?.modules ||
|
|
16
|
+
this.contextPath !== next?.contextPath ||
|
|
17
|
+
this.baseUrl !== next?.baseUrl ||
|
|
18
|
+
this.domains !== next?.domains) {
|
|
19
|
+
this._apply(next);
|
|
20
|
+
this.host.requestUpdate();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
hostDisconnected() {
|
|
25
|
+
this._unsubscribe?.();
|
|
26
|
+
}
|
|
27
|
+
_apply(s) {
|
|
28
|
+
this.baseUrl = s?.baseUrl || '';
|
|
29
|
+
this.contextPath = s?.contextPath || '';
|
|
30
|
+
this.modules = s?.modules || [];
|
|
31
|
+
this.domains = s?.domains || [];
|
|
32
|
+
this.domain = s?.domain;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=app-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-controller.js","sourceRoot":"","sources":["../../../src/controllers/app-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAUnC,MAAM,OAAO,aAAa;IAWxB,YAAY,IAA4B;QARxC,YAAO,GAAG,EAAE,CAAA;QACZ,gBAAW,GAAG,EAAE,CAAA;QAChB,YAAO,GAAU,EAAE,CAAA;QACnB,YAAO,GAA0C,EAAE,CAAA;QAMjD,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,GAAG,CAAC,CAAA;QAE1C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACvC,MAAM,IAAI,GAAI,KAAK,CAAC,QAAQ,EAAU,CAAC,GAAG,CAAA;YAC1C,IACE,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,OAAO;gBAC9B,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE,WAAW;gBACtC,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,OAAO;gBAC9B,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,OAAO,EAC9B,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;IAEO,MAAM,CAAC,CAAM;QACnB,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,EAAE,CAAA;QAC/B,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,WAAW,IAAI,EAAE,CAAA;QACvC,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,EAAE,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,EAAE,CAAA;QAC/B,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,CAAA;IACzB,CAAC;CACF","sourcesContent":["import { ReactiveController, ReactiveControllerHost } from 'lit'\n\nimport { store } from '../store.js'\n\nexport interface AppState {\n baseUrl: string\n contextPath: string\n modules: any[]\n domains: { name: string; subdomain: string }[]\n domain?: { name: string; subdomain: string }\n}\n\nexport class AppController implements ReactiveController {\n host: ReactiveControllerHost\n\n baseUrl = ''\n contextPath = ''\n modules: any[] = []\n domains: { name: string; subdomain: string }[] = []\n domain?: { name: string; subdomain: string }\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).app)\n\n this._unsubscribe = store.subscribe(() => {\n const next = (store.getState() as any).app\n if (\n this.modules !== next?.modules ||\n this.contextPath !== next?.contextPath ||\n this.baseUrl !== next?.baseUrl ||\n this.domains !== next?.domains\n ) {\n this._apply(next)\n this.host.requestUpdate()\n }\n })\n }\n\n hostDisconnected() {\n this._unsubscribe?.()\n }\n\n private _apply(s: any) {\n this.baseUrl = s?.baseUrl || ''\n this.contextPath = s?.contextPath || ''\n this.modules = s?.modules || []\n this.domains = s?.domains || []\n this.domain = s?.domain\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export declare class ContextController implements ReactiveController {
|
|
3
|
+
host: ReactiveControllerHost;
|
|
4
|
+
tools: any[];
|
|
5
|
+
private _unsubscribe?;
|
|
6
|
+
constructor(host: ReactiveControllerHost);
|
|
7
|
+
hostConnected(): void;
|
|
8
|
+
hostDisconnected(): void;
|
|
9
|
+
private _apply;
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { store } from '../store.js';
|
|
2
|
+
export class ContextController {
|
|
3
|
+
constructor(host) {
|
|
4
|
+
this.tools = [];
|
|
5
|
+
this.host = host;
|
|
6
|
+
host.addController(this);
|
|
7
|
+
}
|
|
8
|
+
hostConnected() {
|
|
9
|
+
this._apply(store.getState().context);
|
|
10
|
+
this._unsubscribe = store.subscribe(() => {
|
|
11
|
+
const next = store.getState().context;
|
|
12
|
+
if (this.tools !== next?.tools) {
|
|
13
|
+
this._apply(next);
|
|
14
|
+
this.host.requestUpdate();
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
hostDisconnected() {
|
|
19
|
+
this._unsubscribe?.();
|
|
20
|
+
}
|
|
21
|
+
_apply(s) {
|
|
22
|
+
this.tools = s?.tools || [];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=context-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-controller.js","sourceRoot":"","sources":["../../../src/controllers/context-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,MAAM,OAAO,iBAAiB;IAO5B,YAAY,IAA4B;QAJxC,UAAK,GAAU,EAAE,CAAA;QAKf,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,OAAO,CAAC,CAAA;QAE9C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACvC,MAAM,IAAI,GAAI,KAAK,CAAC,QAAQ,EAAU,CAAC,OAAO,CAAA;YAC9C,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;gBAC/B,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;IAEO,MAAM,CAAC,CAAM;QACnB,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,EAAE,CAAA;IAC7B,CAAC;CACF","sourcesContent":["import { ReactiveController, ReactiveControllerHost } from 'lit'\n\nimport { store } from '../store.js'\n\nexport class ContextController implements ReactiveController {\n host: ReactiveControllerHost\n\n tools: any[] = []\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).context)\n\n this._unsubscribe = store.subscribe(() => {\n const next = (store.getState() as any).context\n if (this.tools !== next?.tools) {\n this._apply(next)\n this.host.requestUpdate()\n }\n })\n }\n\n hostDisconnected() {\n this._unsubscribe?.()\n }\n\n private _apply(s: any) {\n this.tools = s?.tools || []\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export interface Font {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
provider: string;
|
|
6
|
+
uri: string;
|
|
7
|
+
active: boolean;
|
|
8
|
+
files: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
fullpath: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export declare class FontController implements ReactiveController {
|
|
14
|
+
host: ReactiveControllerHost;
|
|
15
|
+
fonts: Font[];
|
|
16
|
+
private _unsubscribe?;
|
|
17
|
+
constructor(host: ReactiveControllerHost);
|
|
18
|
+
hostConnected(): void;
|
|
19
|
+
hostDisconnected(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { store } from '../store.js';
|
|
2
|
+
export class FontController {
|
|
3
|
+
constructor(host) {
|
|
4
|
+
this.fonts = [];
|
|
5
|
+
this.host = host;
|
|
6
|
+
host.addController(this);
|
|
7
|
+
}
|
|
8
|
+
hostConnected() {
|
|
9
|
+
this.fonts = store.getState().font ?? [];
|
|
10
|
+
this._unsubscribe = store.subscribe(() => {
|
|
11
|
+
const next = store.getState().font ?? [];
|
|
12
|
+
if (this.fonts !== next) {
|
|
13
|
+
this.fonts = next;
|
|
14
|
+
this.host.requestUpdate();
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
hostDisconnected() {
|
|
19
|
+
this._unsubscribe?.();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=font-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-controller.js","sourceRoot":"","sources":["../../../src/controllers/font-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAWnC,MAAM,OAAO,cAAc;IAOzB,YAAY,IAA4B;QAJxC,UAAK,GAAW,EAAE,CAAA;QAKhB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED,aAAa;QACX,IAAI,CAAC,KAAK,GAAI,KAAK,CAAC,QAAQ,EAAU,CAAC,IAAI,IAAI,EAAE,CAAA;QAEjD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACvC,MAAM,IAAI,GAAY,KAAK,CAAC,QAAQ,EAAU,CAAC,IAAI,IAAI,EAAE,CAAA;YACzD,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;gBACxB,IAAI,CAAC,KAAK,GAAG,IAAI,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;CACF","sourcesContent":["import { ReactiveController, ReactiveControllerHost } from 'lit'\n\nimport { store } from '../store.js'\n\nexport interface Font {\n id: string\n name: string\n provider: string\n uri: string\n active: boolean\n files: Array<{ name: string; fullpath: string }>\n}\n\nexport class FontController implements ReactiveController {\n host: ReactiveControllerHost\n\n fonts: Font[] = []\n\n private _unsubscribe?: () => void\n\n constructor(host: ReactiveControllerHost) {\n this.host = host\n host.addController(this)\n }\n\n hostConnected() {\n this.fonts = (store.getState() as any).font ?? []\n\n this._unsubscribe = store.subscribe(() => {\n const next: Font[] = (store.getState() as any).font ?? []\n if (this.fonts !== next) {\n this.fonts = next\n this.host.requestUpdate()\n }\n })\n }\n\n hostDisconnected() {\n this._unsubscribe?.()\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { AppController } from './app-controller.js';
|
|
2
|
+
export type { AppState } from './app-controller.js';
|
|
3
|
+
export { ContextController } from './context-controller.js';
|
|
4
|
+
export { FontController } from './font-controller.js';
|
|
5
|
+
export { LayoutController } from './layout-controller.js';
|
|
6
|
+
export type { Font } from './font-controller.js';
|
|
7
|
+
export { MenuController } from './menu-controller.js';
|
|
8
|
+
export { RouteController } from './route-controller.js';
|
|
9
|
+
export type { RouteState } from './route-controller.js';
|
|
10
|
+
export { SnackbarController } from './snackbar-controller.js';
|
|
11
|
+
export type { SnackbarLevel, SnackbarState } from './snackbar-controller.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { AppController } from './app-controller.js';
|
|
2
|
+
export { ContextController } from './context-controller.js';
|
|
3
|
+
export { FontController } from './font-controller.js';
|
|
4
|
+
export { LayoutController } from './layout-controller.js';
|
|
5
|
+
export { MenuController } from './menu-controller.js';
|
|
6
|
+
export { RouteController } from './route-controller.js';
|
|
7
|
+
export { SnackbarController } from './snackbar-controller.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA","sourcesContent":["export { AppController } from './app-controller.js'\nexport type { AppState } from './app-controller.js'\nexport { ContextController } from './context-controller.js'\nexport { FontController } from './font-controller.js'\nexport { LayoutController } from './layout-controller.js'\nexport type { Font } from './font-controller.js'\nexport { MenuController } from './menu-controller.js'\nexport { RouteController } from './route-controller.js'\nexport type { RouteState } from './route-controller.js'\nexport { SnackbarController } from './snackbar-controller.js'\nexport type { SnackbarLevel, SnackbarState } from './snackbar-controller.js'\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export declare class LayoutController implements ReactiveController {
|
|
3
|
+
host: ReactiveControllerHost;
|
|
4
|
+
viewparts: {
|
|
5
|
+
[name: string]: any;
|
|
6
|
+
};
|
|
7
|
+
width: 'WIDE' | 'NARROW';
|
|
8
|
+
private _unsubscribe?;
|
|
9
|
+
constructor(host: ReactiveControllerHost);
|
|
10
|
+
hostConnected(): void;
|
|
11
|
+
hostDisconnected(): void;
|
|
12
|
+
private _apply;
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { store } from '../store.js';
|
|
2
|
+
export class LayoutController {
|
|
3
|
+
constructor(host) {
|
|
4
|
+
this.viewparts = {};
|
|
5
|
+
this.width = 'WIDE';
|
|
6
|
+
this.host = host;
|
|
7
|
+
host.addController(this);
|
|
8
|
+
}
|
|
9
|
+
hostConnected() {
|
|
10
|
+
this._apply(store.getState().layout);
|
|
11
|
+
this._unsubscribe = store.subscribe(() => {
|
|
12
|
+
const next = store.getState().layout;
|
|
13
|
+
if (this.viewparts !== next?.viewparts || this.width !== next?.width) {
|
|
14
|
+
this._apply(next);
|
|
15
|
+
this.host.requestUpdate();
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
hostDisconnected() {
|
|
20
|
+
this._unsubscribe?.();
|
|
21
|
+
}
|
|
22
|
+
_apply(s) {
|
|
23
|
+
this.viewparts = s?.viewparts || {};
|
|
24
|
+
this.width = s?.width || 'WIDE';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=layout-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-controller.js","sourceRoot":"","sources":["../../../src/controllers/layout-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,MAAM,OAAO,gBAAgB;IAQ3B,YAAY,IAA4B;QALxC,cAAS,GAA4B,EAAE,CAAA;QACvC,UAAK,GAAsB,MAAM,CAAA;QAK/B,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,MAAM,CAAC,CAAA;QAE7C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACvC,MAAM,IAAI,GAAI,KAAK,CAAC,QAAQ,EAAU,CAAC,MAAM,CAAA;YAC7C,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;gBACrE,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;IAEO,MAAM,CAAC,CAAM;QACnB,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,SAAS,IAAI,EAAE,CAAA;QACnC,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,MAAM,CAAA;IACjC,CAAC;CACF","sourcesContent":["import { ReactiveController, ReactiveControllerHost } from 'lit'\n\nimport { store } from '../store.js'\n\nexport class LayoutController implements ReactiveController {\n host: ReactiveControllerHost\n\n viewparts: { [name: string]: any } = {}\n width: 'WIDE' | 'NARROW' = 'WIDE'\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).layout)\n\n this._unsubscribe = store.subscribe(() => {\n const next = (store.getState() as any).layout\n if (this.viewparts !== next?.viewparts || this.width !== next?.width) {\n this._apply(next)\n this.host.requestUpdate()\n }\n })\n }\n\n hostDisconnected() {\n this._unsubscribe?.()\n }\n\n private _apply(s: any) {\n this.viewparts = s?.viewparts || {}\n this.width = s?.width || 'WIDE'\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export declare class MenuController implements ReactiveController {
|
|
3
|
+
host: ReactiveControllerHost;
|
|
4
|
+
menus: any[];
|
|
5
|
+
slotTemplate: any;
|
|
6
|
+
private _unsubscribe?;
|
|
7
|
+
constructor(host: ReactiveControllerHost);
|
|
8
|
+
hostConnected(): void;
|
|
9
|
+
hostDisconnected(): void;
|
|
10
|
+
private _apply;
|
|
11
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { store } from '../store.js';
|
|
2
|
+
export class MenuController {
|
|
3
|
+
constructor(host) {
|
|
4
|
+
this.menus = [];
|
|
5
|
+
this.slotTemplate = null;
|
|
6
|
+
this.host = host;
|
|
7
|
+
host.addController(this);
|
|
8
|
+
}
|
|
9
|
+
hostConnected() {
|
|
10
|
+
this._apply(store.getState().liteMenu);
|
|
11
|
+
this._unsubscribe = store.subscribe(() => {
|
|
12
|
+
const next = store.getState().liteMenu;
|
|
13
|
+
if (this.menus !== next?.menus || this.slotTemplate !== next?.slotTemplate) {
|
|
14
|
+
this._apply(next);
|
|
15
|
+
this.host.requestUpdate();
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
hostDisconnected() {
|
|
20
|
+
this._unsubscribe?.();
|
|
21
|
+
}
|
|
22
|
+
_apply(s) {
|
|
23
|
+
this.menus = s?.menus || [];
|
|
24
|
+
this.slotTemplate = s?.slotTemplate ?? null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=menu-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-controller.js","sourceRoot":"","sources":["../../../src/controllers/menu-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,MAAM,OAAO,cAAc;IAQzB,YAAY,IAA4B;QALxC,UAAK,GAAU,EAAE,CAAA;QACjB,iBAAY,GAAQ,IAAI,CAAA;QAKtB,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,GAAI,KAAK,CAAC,QAAQ,EAAU,CAAC,QAAQ,CAAA;YAC/C,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,KAAK,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,EAAE,YAAY,EAAE,CAAC;gBAC3E,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;IAEO,MAAM,CAAC,CAAM;QACnB,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,EAAE,CAAA;QAC3B,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE,YAAY,IAAI,IAAI,CAAA;IAC7C,CAAC;CACF","sourcesContent":["import { ReactiveController, ReactiveControllerHost } from 'lit'\n\nimport { store } from '../store.js'\n\nexport class MenuController implements ReactiveController {\n host: ReactiveControllerHost\n\n menus: any[] = []\n slotTemplate: 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).liteMenu)\n\n this._unsubscribe = store.subscribe(() => {\n const next = (store.getState() as any).liteMenu\n if (this.menus !== next?.menus || this.slotTemplate !== next?.slotTemplate) {\n this._apply(next)\n this.host.requestUpdate()\n }\n })\n }\n\n hostDisconnected() {\n this._unsubscribe?.()\n }\n\n private _apply(s: any) {\n this.menus = s?.menus || []\n this.slotTemplate = s?.slotTemplate ?? null\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export interface RouteState {
|
|
3
|
+
page: string;
|
|
4
|
+
resourceId: string;
|
|
5
|
+
params: Record<string, any>;
|
|
6
|
+
context: any;
|
|
7
|
+
activePage: any;
|
|
8
|
+
}
|
|
9
|
+
export declare class RouteController implements ReactiveController {
|
|
10
|
+
host: ReactiveControllerHost;
|
|
11
|
+
page: string;
|
|
12
|
+
resourceId: string;
|
|
13
|
+
params: Record<string, any>;
|
|
14
|
+
context: any;
|
|
15
|
+
activePage: any;
|
|
16
|
+
private _unsubscribe?;
|
|
17
|
+
constructor(host: ReactiveControllerHost);
|
|
18
|
+
hostConnected(): void;
|
|
19
|
+
hostDisconnected(): void;
|
|
20
|
+
private _apply;
|
|
21
|
+
}
|