@things-factory/lite-menu 7.0.1-alpha.4 → 7.0.1-alpha.9

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 (40) hide show
  1. package/client/actions/lite-menu.ts +4 -4
  2. package/client/bootstrap.ts +1 -4
  3. package/client/index.ts +0 -3
  4. package/client/lite-menu-setting-let.ts +1 -6
  5. package/dist-client/actions/lite-menu.d.ts +1 -1
  6. package/dist-client/actions/lite-menu.js +4 -4
  7. package/dist-client/actions/lite-menu.js.map +1 -1
  8. package/dist-client/bootstrap.js.map +1 -1
  9. package/dist-client/index.d.ts +0 -2
  10. package/dist-client/index.js +0 -2
  11. package/dist-client/index.js.map +1 -1
  12. package/dist-client/lite-menu-setting-let.js +1 -6
  13. package/dist-client/lite-menu-setting-let.js.map +1 -1
  14. package/dist-client/tsconfig.tsbuildinfo +1 -1
  15. package/dist-server/tsconfig.tsbuildinfo +1 -1
  16. package/package.json +9 -8
  17. package/client/viewparts/lite-menu-landscape-styles.ts +0 -149
  18. package/client/viewparts/lite-menu-landscape.ts +0 -104
  19. package/client/viewparts/lite-menu-part.ts +0 -129
  20. package/client/viewparts/lite-menu-portrait-styles.ts +0 -147
  21. package/client/viewparts/lite-menu-portrait.ts +0 -86
  22. package/client/viewparts/top-menu-bar.ts +0 -145
  23. package/dist-client/viewparts/lite-menu-landscape-styles.d.ts +0 -1
  24. package/dist-client/viewparts/lite-menu-landscape-styles.js +0 -149
  25. package/dist-client/viewparts/lite-menu-landscape-styles.js.map +0 -1
  26. package/dist-client/viewparts/lite-menu-landscape.d.ts +0 -20
  27. package/dist-client/viewparts/lite-menu-landscape.js +0 -103
  28. package/dist-client/viewparts/lite-menu-landscape.js.map +0 -1
  29. package/dist-client/viewparts/lite-menu-part.d.ts +0 -28
  30. package/dist-client/viewparts/lite-menu-part.js +0 -143
  31. package/dist-client/viewparts/lite-menu-part.js.map +0 -1
  32. package/dist-client/viewparts/lite-menu-portrait-styles.d.ts +0 -1
  33. package/dist-client/viewparts/lite-menu-portrait-styles.js +0 -147
  34. package/dist-client/viewparts/lite-menu-portrait-styles.js.map +0 -1
  35. package/dist-client/viewparts/lite-menu-portrait.d.ts +0 -12
  36. package/dist-client/viewparts/lite-menu-portrait.js +0 -89
  37. package/dist-client/viewparts/lite-menu-portrait.js.map +0 -1
  38. package/dist-client/viewparts/top-menu-bar.d.ts +0 -22
  39. package/dist-client/viewparts/top-menu-bar.js +0 -150
  40. package/dist-client/viewparts/top-menu-bar.js.map +0 -1
@@ -1,145 +0,0 @@
1
- import '@material/mwc-icon'
2
-
3
- import { css, html, LitElement } from 'lit'
4
- import { customElement, property, query, state } from 'lit/decorators.js'
5
- import { connect } from 'pwa-helpers'
6
-
7
- import { toggleOverlay } from '@operato/layout'
8
- import { store } from '@operato/shell'
9
-
10
- @customElement('top-menu-bar')
11
- export class TopMenuBar extends connect(store)(LitElement) {
12
- static styles = [
13
- css`
14
- :host {
15
- display: flex;
16
- flex-direction: row;
17
- }
18
-
19
- span {
20
- flex: 1;
21
- }
22
-
23
- ul {
24
- display: flex;
25
- align-items: center;
26
- list-style: none;
27
- margin: 0;
28
- padding: 0;
29
- }
30
-
31
- li {
32
- display: inline-flex;
33
- flex-direction: row nowrap;
34
- float: left;
35
- overflow: none;
36
- }
37
-
38
- a {
39
- display: inline-block;
40
- white-space: nowrap;
41
- overflow: hidden;
42
- text-overflow: ellipsis;
43
- padding: var(--padding-default) var(--padding-wide) var(--padding-narrow) var(--padding-wide);
44
- text-decoration: none;
45
- color: white;
46
- }
47
- a * {
48
- vertical-align: middle;
49
- }
50
- a mwc-icon {
51
- opacity: 0.5;
52
- position: relative;
53
- top: -2px;
54
- font-size: 1em;
55
- }
56
-
57
- li[active] a {
58
- font-weight: bold;
59
- }
60
- li[active] a mwc-icon {
61
- opacity: 1;
62
- }
63
- `
64
- ]
65
-
66
- @property({ type: String }) page?: string
67
- @property({ type: String }) resourceId?: string
68
- @property({ type: Array }) menus?: any[]
69
-
70
- @state() private slotTemplate: any
71
- @state() private _activeTopLevel: any
72
-
73
- render() {
74
- const { menus = [], _activeTopLevel } = this
75
-
76
- return html`
77
- <slot name="head"></slot>
78
- <ul>
79
- ${menus.map(menu =>
80
- menu.type == 'group'
81
- ? html``
82
- : html`
83
- <li ?active=${menu === _activeTopLevel}>
84
- <a
85
- href="#"
86
- @click=${e => {
87
- e.preventDefault()
88
- toggleOverlay('lite-menu-part', {
89
- backdrop: true
90
- })
91
- }}
92
- >
93
- ${menu.name}
94
- <mwc-icon>expand_more</mwc-icon>
95
- </a>
96
- </li>
97
- `
98
- )}
99
- </ul>
100
- <slot name="tail"></slot>
101
- `
102
- }
103
-
104
- stateChanged(state) {
105
- this.page = state.route.page
106
- this.resourceId = state.route.resourceId
107
- this.menus = state.liteMenu.menus || []
108
- this.slotTemplate = state.liteMenu.slotTemplate
109
- }
110
-
111
- // firstUpdated() {
112
- // this.addEventListener('mousewheel', this.onWheelEvent.bind(this), false)
113
- // }
114
-
115
- updated(changes) {
116
- if (changes.has('menus') || changes.has('page') || changes.has('resourceId')) {
117
- this._findActivePage()
118
- }
119
-
120
- if (changes.has('slotTemplate')) {
121
- this.replaceChild(this.slotTemplate, this.renderRoot)
122
- }
123
- }
124
-
125
- // onWheelEvent(e) {
126
- // var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))
127
- // this.scrollLeft -= delta * 40
128
- // console.log('delta', this.scrollLeft, delta, e.wheelDelta || -e.detail)
129
-
130
- // e.preventDefault()
131
- // }
132
-
133
- _findActivePage() {
134
- var path = this.resourceId ? `${this.page}/${this.resourceId}` : this.page
135
- var menus = this.menus || []
136
-
137
- this._activeTopLevel = menus.find(menu => {
138
- if (menu.path?.split('?')[0] === path) {
139
- return true
140
- } else if (menu.menus) {
141
- return !!menu.menus.find(menu => menu.path?.split('?')[0] === path)
142
- }
143
- })
144
- }
145
- }
@@ -1 +0,0 @@
1
- export declare const LiteMenuLandscapeStyles: import("lit").CSSResult;
@@ -1,149 +0,0 @@
1
- import { css } from 'lit';
2
- export const LiteMenuLandscapeStyles = css `
3
- :host {
4
- overflow-x: auto;
5
- background-color: var(--secondary-text-color);
6
- --focus-anchor-color: #e6ffa2;
7
- }
8
-
9
- :host > div {
10
- overflow-x: auto;
11
- }
12
-
13
- :host > div > ul {
14
- display: flex;
15
- flex-direction: row;
16
- list-style: none;
17
- margin: auto;
18
- padding: 0;
19
- border: var(--border-dark-color);
20
- border-width: 0 1px;
21
- max-width: 1250px;
22
- }
23
-
24
- :host > div > ul > li {
25
- flex: 1;
26
-
27
- display: flex;
28
- flex-direction: column;
29
- }
30
- :host > div > ul > li > a {
31
- display: none;
32
- font-weight: bold;
33
- font-size: var(--fontsize-large);
34
- }
35
-
36
- ul[submenus] {
37
- flex: 1;
38
- list-style: none;
39
- overflow-y: hidden;
40
- background-color: var(--primary-color);
41
- margin: 0;
42
- padding: 0;
43
- border-left: var(--border-dark-color);
44
- }
45
-
46
- ul[submenus] li {
47
- min-width: 120px;
48
- max-width: 180px;
49
- }
50
-
51
- a {
52
- display: block;
53
- padding: var(--padding-default) var(--padding-default) var(--padding-narrow) var(--padding-wide);
54
- text-decoration: none;
55
- font: normal 14px var(--theme-font);
56
- color: var(--theme-white-color);
57
- text-transform: capitalize;
58
-
59
- overflow: hidden;
60
- white-space: nowrap;
61
- text-overflow: ellipsis;
62
- }
63
-
64
- a:hover {
65
- font-weight: bold;
66
- }
67
-
68
- ul[submenus] a::before {
69
- content: '';
70
- display: inline-block;
71
- position: relative;
72
- top: -1px;
73
- width: 5px;
74
- height: 5px;
75
- border: 1px solid var(--theme-white-color);
76
- border-radius: 50%;
77
- background-color: transparent;
78
- margin-right: 3px;
79
- }
80
- ul[submenus] a:hover,
81
- ul[submenus] li[active] a {
82
- background-color: rgba(var(--secondary-color-rgb), 0.3);
83
- color: var(--focus-anchor-color);
84
- font-weight: bold;
85
- }
86
-
87
- [description] {
88
- background-color: var(--primary-color);
89
- margin: 0;
90
- padding: var(--padding-default) 0;
91
- border-left: 1px solid rgba(0, 0, 0, 0.1);
92
- color: var(--focus-anchor-color);
93
- font-size: 11px;
94
- }
95
- [description] mwc-icon {
96
- background-color: rgba(0, 0, 0, 0.15);
97
- margin-right: 4px;
98
- padding: var(--padding-narrow);
99
- border-radius: 0 5px 5px 0;
100
- float: left;
101
- font-size: 26px;
102
- }
103
-
104
- @media only screen and (max-width: 460px) {
105
- :host {
106
- min-width: 100vw;
107
- }
108
- :host > div {
109
- display: initial;
110
- }
111
- :host > div > ul {
112
- flex-direction: column;
113
- }
114
- a {
115
- padding: var(--padding-wide);
116
- font: normal 15px var(--theme-font);
117
- }
118
- li[active] ul {
119
- border-bottom: 2px solid rgba(0, 0, 0, 0.1);
120
- }
121
- li li a {
122
- display: block;
123
- padding: var(--padding-wide) var(--padding-default) var(--padding-wide) 35px;
124
- overflow: hidden;
125
- text-overflow: ellipsis;
126
- white-space: nowrap;
127
- font: normal 14px var(--theme-font);
128
- }
129
- li li[active] a {
130
- font: bold 14px var(--theme-font);
131
- }
132
- :host > div > ul > li > a {
133
- display: block;
134
- }
135
- :host > div > ul > li > a mwc-icon {
136
- font-size: 1em;
137
- position: relative;
138
- top: 2px;
139
- }
140
- [description] {
141
- display: none;
142
- }
143
- ul[submenus] a:hover,
144
- ul[submenus] li[active] a {
145
- background-color: rgba(var(--secondary-color-rgb), 0.3);
146
- }
147
- }
148
- `;
149
- //# sourceMappingURL=lite-menu-landscape-styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lite-menu-landscape-styles.js","sourceRoot":"","sources":["../../client/viewparts/lite-menu-landscape-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkJzC,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const LiteMenuLandscapeStyles = css`\n :host {\n overflow-x: auto;\n background-color: var(--secondary-text-color);\n --focus-anchor-color: #e6ffa2;\n }\n\n :host > div {\n overflow-x: auto;\n }\n\n :host > div > ul {\n display: flex;\n flex-direction: row;\n list-style: none;\n margin: auto;\n padding: 0;\n border: var(--border-dark-color);\n border-width: 0 1px;\n max-width: 1250px;\n }\n\n :host > div > ul > li {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n :host > div > ul > li > a {\n display: none;\n font-weight: bold;\n font-size: var(--fontsize-large);\n }\n\n ul[submenus] {\n flex: 1;\n list-style: none;\n overflow-y: hidden;\n background-color: var(--primary-color);\n margin: 0;\n padding: 0;\n border-left: var(--border-dark-color);\n }\n\n ul[submenus] li {\n min-width: 120px;\n max-width: 180px;\n }\n\n a {\n display: block;\n padding: var(--padding-default) var(--padding-default) var(--padding-narrow) var(--padding-wide);\n text-decoration: none;\n font: normal 14px var(--theme-font);\n color: var(--theme-white-color);\n text-transform: capitalize;\n\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n\n a:hover {\n font-weight: bold;\n }\n\n ul[submenus] a::before {\n content: '';\n display: inline-block;\n position: relative;\n top: -1px;\n width: 5px;\n height: 5px;\n border: 1px solid var(--theme-white-color);\n border-radius: 50%;\n background-color: transparent;\n margin-right: 3px;\n }\n ul[submenus] a:hover,\n ul[submenus] li[active] a {\n background-color: rgba(var(--secondary-color-rgb), 0.3);\n color: var(--focus-anchor-color);\n font-weight: bold;\n }\n\n [description] {\n background-color: var(--primary-color);\n margin: 0;\n padding: var(--padding-default) 0;\n border-left: 1px solid rgba(0, 0, 0, 0.1);\n color: var(--focus-anchor-color);\n font-size: 11px;\n }\n [description] mwc-icon {\n background-color: rgba(0, 0, 0, 0.15);\n margin-right: 4px;\n padding: var(--padding-narrow);\n border-radius: 0 5px 5px 0;\n float: left;\n font-size: 26px;\n }\n\n @media only screen and (max-width: 460px) {\n :host {\n min-width: 100vw;\n }\n :host > div {\n display: initial;\n }\n :host > div > ul {\n flex-direction: column;\n }\n a {\n padding: var(--padding-wide);\n font: normal 15px var(--theme-font);\n }\n li[active] ul {\n border-bottom: 2px solid rgba(0, 0, 0, 0.1);\n }\n li li a {\n display: block;\n padding: var(--padding-wide) var(--padding-default) var(--padding-wide) 35px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font: normal 14px var(--theme-font);\n }\n li li[active] a {\n font: bold 14px var(--theme-font);\n }\n :host > div > ul > li > a {\n display: block;\n }\n :host > div > ul > li > a mwc-icon {\n font-size: 1em;\n position: relative;\n top: 2px;\n }\n [description] {\n display: none;\n }\n ul[submenus] a:hover,\n ul[submenus] li[active] a {\n background-color: rgba(var(--secondary-color-rgb), 0.3);\n }\n }\n`\n"]}
@@ -1,20 +0,0 @@
1
- import '@material/mwc-icon';
2
- import { LitElement } from 'lit';
3
- declare const LiteMenuLandscape_base: (new (...args: any[]) => {
4
- _storeUnsubscribe: import("redux").Unsubscribe;
5
- connectedCallback(): void;
6
- disconnectedCallback(): void;
7
- stateChanged(_state: unknown): void;
8
- readonly isConnected: boolean;
9
- }) & typeof LitElement;
10
- export declare class LiteMenuLandscape extends LiteMenuLandscape_base {
11
- static styles: import("lit").CSSResult[];
12
- menus?: any[];
13
- activeTopLevel: any;
14
- activeMenu: any;
15
- path?: string;
16
- render(): import("lit").TemplateResult<1>;
17
- firstUpdated(): void;
18
- onWheelEvent(e: WheelEvent): void;
19
- }
20
- export {};
@@ -1,103 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import '@material/mwc-icon';
3
- import { html, LitElement } from 'lit';
4
- import { customElement, property } from 'lit/decorators.js';
5
- import { connect } from 'pwa-helpers';
6
- import { navigate, store } from '@operato/shell';
7
- import { ScrollbarStyles } from '@operato/styles';
8
- import { LiteMenuLandscapeStyles } from './lite-menu-landscape-styles';
9
- let LiteMenuLandscape = class LiteMenuLandscape extends connect(store)(LitElement) {
10
- render() {
11
- const { menus = [], activeTopLevel, activeMenu } = this;
12
- return html `
13
- <div id="wrap" @mousewheel=${this.onWheelEvent.bind(this)}>
14
- <ul>
15
- ${menus.map(menu => {
16
- var _a;
17
- return menu.type == 'group'
18
- ? html ``
19
- : html `
20
- <li ?active=${menu === activeTopLevel}>
21
- <a href=${menu.path || '#'}>
22
- ${menu.icon ? html `<mwc-icon>${menu.icon}</mwc-icon>` : html ``} ${menu.name}
23
- </a>
24
-
25
- <ul submenus>
26
- ${(_a = menu.menus) === null || _a === void 0 ? void 0 : _a.map(menu => html `
27
- <li ?active=${menu === activeMenu}>
28
- <a href=${menu.path || '#'}> ${menu.name} </a>
29
- </li>
30
- `)}
31
- </ul>
32
-
33
- <div description>
34
- ${menu.icon ? html `<mwc-icon>${menu.icon}</mwc-icon>` : html ``} ${menu.description || ''}
35
- </div>
36
- </li>
37
- `;
38
- })}
39
- </ul>
40
- </div>
41
- `;
42
- }
43
- firstUpdated() {
44
- this.renderRoot.addEventListener('click', (e) => {
45
- //@ts-ignore
46
- if (e.target.submenu) {
47
- /* protect to act move to href. */
48
- e.stopPropagation();
49
- e.preventDefault();
50
- //@ts-ignore
51
- let menu = e.target.submenu;
52
- this.dispatchEvent(new CustomEvent('active-toplevel', {
53
- bubbles: true,
54
- detail: this.activeTopLevel === menu ? undefined : menu
55
- }));
56
- return;
57
- }
58
- /* to respond even if current acting menu is selected */
59
- let href = e.target.href;
60
- href && location.href === href && navigate(href + '#force', true);
61
- });
62
- /* to hide scrollbar during transition */
63
- this.renderRoot.addEventListener('transitionstart', e => {
64
- ;
65
- e.target.removeAttribute('settled');
66
- });
67
- this.renderRoot.addEventListener('transitionend', e => {
68
- ;
69
- e.target.setAttribute('settled', '');
70
- });
71
- }
72
- onWheelEvent(e) {
73
- const { target, deltaY, detail } = e;
74
- if (!(target instanceof HTMLElement)) {
75
- return;
76
- }
77
- const delta = deltaY || -detail;
78
- target.scrollLeft -= (delta / Math.abs(delta)) * 10;
79
- e.preventDefault();
80
- }
81
- };
82
- LiteMenuLandscape.styles = [ScrollbarStyles, LiteMenuLandscapeStyles];
83
- __decorate([
84
- property({ type: Array }),
85
- __metadata("design:type", Array)
86
- ], LiteMenuLandscape.prototype, "menus", void 0);
87
- __decorate([
88
- property({ type: Object }),
89
- __metadata("design:type", Object)
90
- ], LiteMenuLandscape.prototype, "activeTopLevel", void 0);
91
- __decorate([
92
- property({ type: Object }),
93
- __metadata("design:type", Object)
94
- ], LiteMenuLandscape.prototype, "activeMenu", void 0);
95
- __decorate([
96
- property({ type: String }),
97
- __metadata("design:type", String)
98
- ], LiteMenuLandscape.prototype, "path", void 0);
99
- LiteMenuLandscape = __decorate([
100
- customElement('lite-menu-landscape')
101
- ], LiteMenuLandscape);
102
- export { LiteMenuLandscape };
103
- //# sourceMappingURL=lite-menu-landscape.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lite-menu-landscape.js","sourceRoot":"","sources":["../../client/viewparts/lite-menu-landscape.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAgB,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAG/D,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;IAQ/D,MAAM;QACJ,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,cAAc,EAAE,UAAU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IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;gDAAc;AACxC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAgB;AAC3C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAc;AAN9B,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA2F7B;SA3FY,iBAAiB","sourcesContent":["import '@material/mwc-icon'\n\nimport { html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers'\n\nimport { navigate, store } from '@operato/shell'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { LiteMenuLandscapeStyles } from './lite-menu-landscape-styles'\n\n@customElement('lite-menu-landscape')\nexport class LiteMenuLandscape extends connect(store)(LitElement) {\n static styles = [ScrollbarStyles, LiteMenuLandscapeStyles]\n\n @property({ type: Array }) menus?: any[]\n @property({ type: Object }) activeTopLevel: any\n @property({ type: Object }) activeMenu: any\n @property({ type: String }) path?: string\n\n render() {\n const { menus = [], activeTopLevel, activeMenu } = this\n\n return html`\n <div id=\"wrap\" @mousewheel=${this.onWheelEvent.bind(this)}>\n <ul>\n ${menus.map(menu =>\n menu.type == 'group'\n ? html``\n : html`\n <li ?active=${menu === activeTopLevel}>\n <a href=${menu.path || '#'}>\n ${menu.icon ? html`<mwc-icon>${menu.icon}</mwc-icon>` : html``} ${menu.name}\n </a>\n\n <ul submenus>\n ${menu.menus?.map(\n menu => html`\n <li ?active=${menu === activeMenu}>\n <a href=${menu.path || '#'}> ${menu.name} </a>\n </li>\n `\n )}\n </ul>\n\n <div description>\n ${menu.icon ? html`<mwc-icon>${menu.icon}</mwc-icon>` : html``} ${menu.description || ''}\n </div>\n </li>\n `\n )}\n </ul>\n </div>\n `\n }\n\n firstUpdated() {\n this.renderRoot.addEventListener('click', (e: Event) => {\n //@ts-ignore\n if (e.target.submenu) {\n /* protect to act move to href. */\n e.stopPropagation()\n e.preventDefault()\n\n //@ts-ignore\n let menu = e.target.submenu\n\n this.dispatchEvent(\n new CustomEvent('active-toplevel', {\n bubbles: true,\n detail: this.activeTopLevel === menu ? undefined : menu\n })\n )\n\n return\n }\n\n /* to respond even if current acting menu is selected */\n let href = (e.target as HTMLAnchorElement).href\n href && location.href === href && navigate(href + '#force', true)\n })\n\n /* to hide scrollbar during transition */\n this.renderRoot.addEventListener('transitionstart', e => {\n ;(e.target as HTMLElement).removeAttribute('settled')\n })\n this.renderRoot.addEventListener('transitionend', e => {\n ;(e.target as HTMLElement).setAttribute('settled', '')\n })\n }\n\n onWheelEvent(e: WheelEvent) {\n const { target, deltaY, detail } = e\n\n if (!(target instanceof HTMLElement)) {\n return\n }\n\n const delta = deltaY || -detail\n target.scrollLeft -= (delta / Math.abs(delta)) * 10\n\n e.preventDefault()\n }\n}\n"]}
@@ -1,28 +0,0 @@
1
- import '@material/mwc-icon';
2
- import './lite-menu-portrait';
3
- import './lite-menu-landscape';
4
- import { LitElement, PropertyValues } from 'lit';
5
- declare const LiteMenuPart_base: (new (...args: any[]) => {
6
- _storeUnsubscribe: import("redux").Unsubscribe;
7
- connectedCallback(): void;
8
- disconnectedCallback(): void;
9
- stateChanged(_state: unknown): void;
10
- readonly isConnected: boolean;
11
- }) & typeof LitElement;
12
- export declare class LiteMenuPart extends LiteMenuPart_base {
13
- static styles: import("lit").CSSResult[];
14
- page?: string;
15
- resourceId?: string;
16
- menus?: any[];
17
- orientation?: string;
18
- slotTemplate: any;
19
- _activeTopLevel: any;
20
- _activeMenu: any;
21
- _path?: string;
22
- render(): import("lit").TemplateResult<1>;
23
- firstUpdated(): void;
24
- updated(changes: PropertyValues<this>): void;
25
- stateChanged(state: any): void;
26
- private findActivePage;
27
- }
28
- export {};
@@ -1,143 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import '@material/mwc-icon';
3
- import './lite-menu-portrait';
4
- import './lite-menu-landscape';
5
- import { css, html, LitElement } from 'lit';
6
- import { customElement, property, state } from 'lit/decorators.js';
7
- import { connect } from 'pwa-helpers';
8
- import { store } from '@operato/shell';
9
- import { ScrollbarStyles } from '@operato/styles';
10
- function isActiveMenu(menu, path) {
11
- var _a;
12
- return (((_a = menu.path) === null || _a === void 0 ? void 0 : _a.split('?')[0]) === path ||
13
- (menu.active && typeof menu.active === 'function' && menu.active.call(menu, { path })));
14
- }
15
- let LiteMenuPart = class LiteMenuPart extends connect(store)(LitElement) {
16
- render() {
17
- return html `
18
- <slot name="head"></slot>
19
- ${this.orientation !== 'landscape'
20
- ? html `<lite-menu-portrait
21
- .menus=${this.menus}
22
- .activeTopLevel=${this._activeTopLevel}
23
- .activeMenu=${this._activeMenu}
24
- .path=${this._path}
25
- ></lite-menu-portrait>`
26
- : html `<lite-menu-landscape
27
- .menus=${this.menus}
28
- .activeTopLevel=${this._activeTopLevel}
29
- .activeMenu=${this._activeMenu}
30
- .path=${this._path}
31
- ></lite-menu-landscape>`}
32
- <slot name="tail"></slot>
33
- `;
34
- }
35
- firstUpdated() {
36
- this.renderRoot.addEventListener('active-toplevel', (e) => {
37
- e.stopPropagation();
38
- e.preventDefault();
39
- this._activeTopLevel = e.detail;
40
- });
41
- }
42
- updated(changes) {
43
- if (changes.has('menus') || changes.has('page') || changes.has('resourceId')) {
44
- this.findActivePage();
45
- }
46
- if (changes.has('orientation')) {
47
- if (this.orientation == 'portrait') {
48
- this.removeAttribute('landscape');
49
- }
50
- else {
51
- this.setAttribute('landscape', '');
52
- }
53
- }
54
- if (changes.has('slotTemplate')) {
55
- this.replaceChild(this.slotTemplate, this.renderRoot);
56
- }
57
- }
58
- stateChanged(state) {
59
- this.page = state.route.page;
60
- this.resourceId = state.route.resourceId;
61
- this.menus = state.liteMenu.menus || [];
62
- this.slotTemplate = state.liteMenu.slotTemplate;
63
- }
64
- findActivePage() {
65
- var path = this.resourceId ? `${this.page}/${this.resourceId}` : this.page;
66
- var menus = this.menus || [];
67
- var activeMenu;
68
- this._activeTopLevel = menus.find(menu => {
69
- if (isActiveMenu(menu, path)) {
70
- activeMenu = menu;
71
- return true;
72
- }
73
- else if (menu.menus) {
74
- activeMenu = menu.menus.find(menu => isActiveMenu(menu, path));
75
- return !!activeMenu;
76
- }
77
- });
78
- this._path = path;
79
- this._activeMenu = activeMenu || this._activeTopLevel;
80
- }
81
- };
82
- LiteMenuPart.styles = [
83
- ScrollbarStyles,
84
- css `
85
- :host {
86
- display: flex;
87
- overflow-y: auto;
88
- flex-direction: column;
89
- height: 100%;
90
- min-width: 200px;
91
- background-color: var(--theme-white-color);
92
- }
93
-
94
- :host([landscape]) {
95
- overflow-x: auto;
96
- flex-direction: row;
97
- width: 100%;
98
- min-height: 20px;
99
- }
100
-
101
- lite-menu-portrait,
102
- lite-menu-landscape {
103
- flex: 1;
104
- }
105
- `
106
- ];
107
- __decorate([
108
- property({ type: String }),
109
- __metadata("design:type", String)
110
- ], LiteMenuPart.prototype, "page", void 0);
111
- __decorate([
112
- property({ type: String }),
113
- __metadata("design:type", String)
114
- ], LiteMenuPart.prototype, "resourceId", void 0);
115
- __decorate([
116
- property({ type: Array }),
117
- __metadata("design:type", Array)
118
- ], LiteMenuPart.prototype, "menus", void 0);
119
- __decorate([
120
- property({ type: String }),
121
- __metadata("design:type", String)
122
- ], LiteMenuPart.prototype, "orientation", void 0);
123
- __decorate([
124
- state(),
125
- __metadata("design:type", Object)
126
- ], LiteMenuPart.prototype, "slotTemplate", void 0);
127
- __decorate([
128
- state(),
129
- __metadata("design:type", Object)
130
- ], LiteMenuPart.prototype, "_activeTopLevel", void 0);
131
- __decorate([
132
- state(),
133
- __metadata("design:type", Object)
134
- ], LiteMenuPart.prototype, "_activeMenu", void 0);
135
- __decorate([
136
- state(),
137
- __metadata("design:type", String)
138
- ], LiteMenuPart.prototype, "_path", void 0);
139
- LiteMenuPart = __decorate([
140
- customElement('lite-menu-part')
141
- ], LiteMenuPart);
142
- export { LiteMenuPart };
143
- //# sourceMappingURL=lite-menu-part.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lite-menu-part.js","sourceRoot":"","sources":["../../client/viewparts/lite-menu-part.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,uBAAuB,CAAA;AAE9B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,SAAS,YAAY,CAAC,IAAI,EAAE,IAAI;;IAC9B,OAAO,CACL,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,MAAK,IAAI;QACjC,CAAC,IAAI,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CACvF,CAAA;AACH,CAAC;AAGM,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;IAqC1D,MAAM;QACJ,OAAO,IAAI,CAAA;;QAEP,IAAI,CAAC,WAAW,KAAK,WAAW;YAChC,CAAC,CAAC,IAAI,CAAA;qBACO,IAAI,CAAC,KAAK;8BACD,IAAI,CAAC,eAAe;0BACxB,IAAI,CAAC,WAAW;oBACtB,IAAI,CAAC,KAAK;iCACG;YACzB,CAAC,CAAC,IAAI,CAAA;qB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AqB;AAEhD;IAAC,KAAK,EAAE;;kDAAkB;AAC1B;IAAC,KAAK,EAAE;;qDAAqB;AAC7B;IAAC,KAAK,EAAE;;iDAAiB;AACzB;IAAC,KAAK,EAAE;;2CAAe;AAnCZ,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CA6GxB;SA7GY,YAAY","sourcesContent":["import '@material/mwc-icon'\nimport './lite-menu-portrait'\nimport './lite-menu-landscape'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers'\n\nimport { store } from '@operato/shell'\nimport { ScrollbarStyles } from '@operato/styles'\n\nfunction isActiveMenu(menu, path) {\n return (\n menu.path?.split('?')[0] === path ||\n (menu.active && typeof menu.active === 'function' && menu.active.call(menu, { path }))\n )\n}\n\n@customElement('lite-menu-part')\nexport class LiteMenuPart extends connect(store)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n overflow-y: auto;\n flex-direction: column;\n height: 100%;\n min-width: 200px;\n background-color: var(--theme-white-color);\n }\n\n :host([landscape]) {\n overflow-x: auto;\n flex-direction: row;\n width: 100%;\n min-height: 20px;\n }\n\n lite-menu-portrait,\n lite-menu-landscape {\n flex: 1;\n }\n `\n ]\n\n @property({ type: String }) page?: string\n @property({ type: String }) resourceId?: string\n @property({ type: Array }) menus?: any[]\n @property({ type: String }) orientation?: string\n\n @state() slotTemplate: any\n @state() _activeTopLevel: any\n @state() _activeMenu: any\n @state() _path?: string\n\n render() {\n return html`\n <slot name=\"head\"></slot>\n ${this.orientation !== 'landscape'\n ? html`<lite-menu-portrait\n .menus=${this.menus}\n .activeTopLevel=${this._activeTopLevel}\n .activeMenu=${this._activeMenu}\n .path=${this._path}\n ></lite-menu-portrait>`\n : html`<lite-menu-landscape\n .menus=${this.menus}\n .activeTopLevel=${this._activeTopLevel}\n .activeMenu=${this._activeMenu}\n .path=${this._path}\n ></lite-menu-landscape>`}\n <slot name=\"tail\"></slot>\n `\n }\n\n firstUpdated() {\n this.renderRoot.addEventListener('active-toplevel', (e: Event) => {\n e.stopPropagation()\n e.preventDefault()\n\n this._activeTopLevel = (e as CustomEvent).detail\n })\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('menus') || changes.has('page') || changes.has('resourceId')) {\n this.findActivePage()\n }\n\n if (changes.has('orientation')) {\n if (this.orientation == 'portrait') {\n this.removeAttribute('landscape')\n } else {\n this.setAttribute('landscape', '')\n }\n }\n\n if (changes.has('slotTemplate')) {\n this.replaceChild(this.slotTemplate, this.renderRoot)\n }\n }\n\n stateChanged(state) {\n this.page = state.route.page\n this.resourceId = state.route.resourceId\n this.menus = state.liteMenu.menus || []\n this.slotTemplate = state.liteMenu.slotTemplate\n }\n\n private findActivePage() {\n var path = this.resourceId ? `${this.page}/${this.resourceId}` : this.page\n var menus = this.menus || []\n var activeMenu\n\n this._activeTopLevel = menus.find(menu => {\n if (isActiveMenu(menu, path)) {\n activeMenu = menu\n return true\n } else if (menu.menus) {\n activeMenu = menu.menus.find(menu => isActiveMenu(menu, path))\n return !!activeMenu\n }\n })\n\n this._path = path\n this._activeMenu = activeMenu || this._activeTopLevel\n }\n}\n"]}
@@ -1 +0,0 @@
1
- export declare const LiteMenuPortraitStyles: import("lit").CSSResult;