@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/lite-menu",
3
- "version": "7.0.1-alpha.4",
3
+ "version": "7.0.1-alpha.9",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -33,17 +33,18 @@
33
33
  "@operato/i18n": "^2.0.0-alpha.0",
34
34
  "@operato/input": "^2.0.0-alpha.0",
35
35
  "@operato/layout": "^2.0.0-alpha.0",
36
+ "@operato/menu": "^2.0.0-alpha.0",
36
37
  "@operato/popup": "^2.0.0-alpha.0",
37
38
  "@operato/shell": "^2.0.0-alpha.0",
38
39
  "@operato/styles": "^2.0.0-alpha.0",
39
40
  "@operato/utils": "^2.0.0-alpha.0",
40
- "@things-factory/apptool-base": "^7.0.1-alpha.4",
41
- "@things-factory/auth-base": "^7.0.1-alpha.4",
42
- "@things-factory/board-service": "^7.0.1-alpha.4",
43
- "@things-factory/board-ui": "^7.0.1-alpha.4",
44
- "@things-factory/more-base": "^7.0.1-alpha.4",
45
- "@things-factory/setting-base": "^7.0.1-alpha.4",
41
+ "@things-factory/apptool-base": "^7.0.1-alpha.9",
42
+ "@things-factory/auth-base": "^7.0.1-alpha.9",
43
+ "@things-factory/board-service": "^7.0.1-alpha.9",
44
+ "@things-factory/board-ui": "^7.0.1-alpha.9",
45
+ "@things-factory/more-base": "^7.0.1-alpha.9",
46
+ "@things-factory/setting-base": "^7.0.1-alpha.9",
46
47
  "@things-factory/utils": "^7.0.1-alpha.4"
47
48
  },
48
- "gitHead": "41b951d71135f4e9ae936a85a3cd7a374c5664cc"
49
+ "gitHead": "e77082517f5483704f1e884cbc81b7f94c0eec15"
49
50
  }
@@ -1,149 +0,0 @@
1
- import { css } from 'lit'
2
-
3
- export const LiteMenuLandscapeStyles = css`
4
- :host {
5
- overflow-x: auto;
6
- background-color: var(--secondary-text-color);
7
- --focus-anchor-color: #e6ffa2;
8
- }
9
-
10
- :host > div {
11
- overflow-x: auto;
12
- }
13
-
14
- :host > div > ul {
15
- display: flex;
16
- flex-direction: row;
17
- list-style: none;
18
- margin: auto;
19
- padding: 0;
20
- border: var(--border-dark-color);
21
- border-width: 0 1px;
22
- max-width: 1250px;
23
- }
24
-
25
- :host > div > ul > li {
26
- flex: 1;
27
-
28
- display: flex;
29
- flex-direction: column;
30
- }
31
- :host > div > ul > li > a {
32
- display: none;
33
- font-weight: bold;
34
- font-size: var(--fontsize-large);
35
- }
36
-
37
- ul[submenus] {
38
- flex: 1;
39
- list-style: none;
40
- overflow-y: hidden;
41
- background-color: var(--primary-color);
42
- margin: 0;
43
- padding: 0;
44
- border-left: var(--border-dark-color);
45
- }
46
-
47
- ul[submenus] li {
48
- min-width: 120px;
49
- max-width: 180px;
50
- }
51
-
52
- a {
53
- display: block;
54
- padding: var(--padding-default) var(--padding-default) var(--padding-narrow) var(--padding-wide);
55
- text-decoration: none;
56
- font: normal 14px var(--theme-font);
57
- color: var(--theme-white-color);
58
- text-transform: capitalize;
59
-
60
- overflow: hidden;
61
- white-space: nowrap;
62
- text-overflow: ellipsis;
63
- }
64
-
65
- a:hover {
66
- font-weight: bold;
67
- }
68
-
69
- ul[submenus] a::before {
70
- content: '';
71
- display: inline-block;
72
- position: relative;
73
- top: -1px;
74
- width: 5px;
75
- height: 5px;
76
- border: 1px solid var(--theme-white-color);
77
- border-radius: 50%;
78
- background-color: transparent;
79
- margin-right: 3px;
80
- }
81
- ul[submenus] a:hover,
82
- ul[submenus] li[active] a {
83
- background-color: rgba(var(--secondary-color-rgb), 0.3);
84
- color: var(--focus-anchor-color);
85
- font-weight: bold;
86
- }
87
-
88
- [description] {
89
- background-color: var(--primary-color);
90
- margin: 0;
91
- padding: var(--padding-default) 0;
92
- border-left: 1px solid rgba(0, 0, 0, 0.1);
93
- color: var(--focus-anchor-color);
94
- font-size: 11px;
95
- }
96
- [description] mwc-icon {
97
- background-color: rgba(0, 0, 0, 0.15);
98
- margin-right: 4px;
99
- padding: var(--padding-narrow);
100
- border-radius: 0 5px 5px 0;
101
- float: left;
102
- font-size: 26px;
103
- }
104
-
105
- @media only screen and (max-width: 460px) {
106
- :host {
107
- min-width: 100vw;
108
- }
109
- :host > div {
110
- display: initial;
111
- }
112
- :host > div > ul {
113
- flex-direction: column;
114
- }
115
- a {
116
- padding: var(--padding-wide);
117
- font: normal 15px var(--theme-font);
118
- }
119
- li[active] ul {
120
- border-bottom: 2px solid rgba(0, 0, 0, 0.1);
121
- }
122
- li li a {
123
- display: block;
124
- padding: var(--padding-wide) var(--padding-default) var(--padding-wide) 35px;
125
- overflow: hidden;
126
- text-overflow: ellipsis;
127
- white-space: nowrap;
128
- font: normal 14px var(--theme-font);
129
- }
130
- li li[active] a {
131
- font: bold 14px var(--theme-font);
132
- }
133
- :host > div > ul > li > a {
134
- display: block;
135
- }
136
- :host > div > ul > li > a mwc-icon {
137
- font-size: 1em;
138
- position: relative;
139
- top: 2px;
140
- }
141
- [description] {
142
- display: none;
143
- }
144
- ul[submenus] a:hover,
145
- ul[submenus] li[active] a {
146
- background-color: rgba(var(--secondary-color-rgb), 0.3);
147
- }
148
- }
149
- `
@@ -1,104 +0,0 @@
1
- import '@material/mwc-icon'
2
-
3
- import { html, LitElement } from 'lit'
4
- import { customElement, property, query, state } from 'lit/decorators.js'
5
- import { connect } from 'pwa-helpers'
6
-
7
- import { navigate, store } from '@operato/shell'
8
- import { ScrollbarStyles } from '@operato/styles'
9
-
10
- import { LiteMenuLandscapeStyles } from './lite-menu-landscape-styles'
11
-
12
- @customElement('lite-menu-landscape')
13
- export class LiteMenuLandscape extends connect(store)(LitElement) {
14
- static styles = [ScrollbarStyles, LiteMenuLandscapeStyles]
15
-
16
- @property({ type: Array }) menus?: any[]
17
- @property({ type: Object }) activeTopLevel: any
18
- @property({ type: Object }) activeMenu: any
19
- @property({ type: String }) path?: string
20
-
21
- render() {
22
- const { menus = [], activeTopLevel, activeMenu } = this
23
-
24
- return html`
25
- <div id="wrap" @mousewheel=${this.onWheelEvent.bind(this)}>
26
- <ul>
27
- ${menus.map(menu =>
28
- menu.type == 'group'
29
- ? html``
30
- : html`
31
- <li ?active=${menu === activeTopLevel}>
32
- <a href=${menu.path || '#'}>
33
- ${menu.icon ? html`<mwc-icon>${menu.icon}</mwc-icon>` : html``} ${menu.name}
34
- </a>
35
-
36
- <ul submenus>
37
- ${menu.menus?.map(
38
- menu => html`
39
- <li ?active=${menu === activeMenu}>
40
- <a href=${menu.path || '#'}> ${menu.name} </a>
41
- </li>
42
- `
43
- )}
44
- </ul>
45
-
46
- <div description>
47
- ${menu.icon ? html`<mwc-icon>${menu.icon}</mwc-icon>` : html``} ${menu.description || ''}
48
- </div>
49
- </li>
50
- `
51
- )}
52
- </ul>
53
- </div>
54
- `
55
- }
56
-
57
- firstUpdated() {
58
- this.renderRoot.addEventListener('click', (e: Event) => {
59
- //@ts-ignore
60
- if (e.target.submenu) {
61
- /* protect to act move to href. */
62
- e.stopPropagation()
63
- e.preventDefault()
64
-
65
- //@ts-ignore
66
- let menu = e.target.submenu
67
-
68
- this.dispatchEvent(
69
- new CustomEvent('active-toplevel', {
70
- bubbles: true,
71
- detail: this.activeTopLevel === menu ? undefined : menu
72
- })
73
- )
74
-
75
- return
76
- }
77
-
78
- /* to respond even if current acting menu is selected */
79
- let href = (e.target as HTMLAnchorElement).href
80
- href && location.href === href && navigate(href + '#force', true)
81
- })
82
-
83
- /* to hide scrollbar during transition */
84
- this.renderRoot.addEventListener('transitionstart', e => {
85
- ;(e.target as HTMLElement).removeAttribute('settled')
86
- })
87
- this.renderRoot.addEventListener('transitionend', e => {
88
- ;(e.target as HTMLElement).setAttribute('settled', '')
89
- })
90
- }
91
-
92
- onWheelEvent(e: WheelEvent) {
93
- const { target, deltaY, detail } = e
94
-
95
- if (!(target instanceof HTMLElement)) {
96
- return
97
- }
98
-
99
- const delta = deltaY || -detail
100
- target.scrollLeft -= (delta / Math.abs(delta)) * 10
101
-
102
- e.preventDefault()
103
- }
104
- }
@@ -1,129 +0,0 @@
1
- import '@material/mwc-icon'
2
- import './lite-menu-portrait'
3
- import './lite-menu-landscape'
4
-
5
- import { css, html, LitElement, PropertyValues } from 'lit'
6
- import { customElement, property, query, state } from 'lit/decorators.js'
7
- import { connect } from 'pwa-helpers'
8
-
9
- import { store } from '@operato/shell'
10
- import { ScrollbarStyles } from '@operato/styles'
11
-
12
- function isActiveMenu(menu, path) {
13
- return (
14
- menu.path?.split('?')[0] === path ||
15
- (menu.active && typeof menu.active === 'function' && menu.active.call(menu, { path }))
16
- )
17
- }
18
-
19
- @customElement('lite-menu-part')
20
- export class LiteMenuPart extends connect(store)(LitElement) {
21
- static styles = [
22
- ScrollbarStyles,
23
- css`
24
- :host {
25
- display: flex;
26
- overflow-y: auto;
27
- flex-direction: column;
28
- height: 100%;
29
- min-width: 200px;
30
- background-color: var(--theme-white-color);
31
- }
32
-
33
- :host([landscape]) {
34
- overflow-x: auto;
35
- flex-direction: row;
36
- width: 100%;
37
- min-height: 20px;
38
- }
39
-
40
- lite-menu-portrait,
41
- lite-menu-landscape {
42
- flex: 1;
43
- }
44
- `
45
- ]
46
-
47
- @property({ type: String }) page?: string
48
- @property({ type: String }) resourceId?: string
49
- @property({ type: Array }) menus?: any[]
50
- @property({ type: String }) orientation?: string
51
-
52
- @state() slotTemplate: any
53
- @state() _activeTopLevel: any
54
- @state() _activeMenu: any
55
- @state() _path?: string
56
-
57
- render() {
58
- return html`
59
- <slot name="head"></slot>
60
- ${this.orientation !== 'landscape'
61
- ? html`<lite-menu-portrait
62
- .menus=${this.menus}
63
- .activeTopLevel=${this._activeTopLevel}
64
- .activeMenu=${this._activeMenu}
65
- .path=${this._path}
66
- ></lite-menu-portrait>`
67
- : html`<lite-menu-landscape
68
- .menus=${this.menus}
69
- .activeTopLevel=${this._activeTopLevel}
70
- .activeMenu=${this._activeMenu}
71
- .path=${this._path}
72
- ></lite-menu-landscape>`}
73
- <slot name="tail"></slot>
74
- `
75
- }
76
-
77
- firstUpdated() {
78
- this.renderRoot.addEventListener('active-toplevel', (e: Event) => {
79
- e.stopPropagation()
80
- e.preventDefault()
81
-
82
- this._activeTopLevel = (e as CustomEvent).detail
83
- })
84
- }
85
-
86
- updated(changes: PropertyValues<this>) {
87
- if (changes.has('menus') || changes.has('page') || changes.has('resourceId')) {
88
- this.findActivePage()
89
- }
90
-
91
- if (changes.has('orientation')) {
92
- if (this.orientation == 'portrait') {
93
- this.removeAttribute('landscape')
94
- } else {
95
- this.setAttribute('landscape', '')
96
- }
97
- }
98
-
99
- if (changes.has('slotTemplate')) {
100
- this.replaceChild(this.slotTemplate, this.renderRoot)
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
- private findActivePage() {
112
- var path = this.resourceId ? `${this.page}/${this.resourceId}` : this.page
113
- var menus = this.menus || []
114
- var activeMenu
115
-
116
- this._activeTopLevel = menus.find(menu => {
117
- if (isActiveMenu(menu, path)) {
118
- activeMenu = menu
119
- return true
120
- } else if (menu.menus) {
121
- activeMenu = menu.menus.find(menu => isActiveMenu(menu, path))
122
- return !!activeMenu
123
- }
124
- })
125
-
126
- this._path = path
127
- this._activeMenu = activeMenu || this._activeTopLevel
128
- }
129
- }
@@ -1,147 +0,0 @@
1
- import { css } from 'lit'
2
-
3
- export const LiteMenuPortraitStyles = css`
4
- :host {
5
- display: flex;
6
- overflow-y: auto;
7
- flex-direction: column;
8
- height: 100%;
9
- }
10
-
11
- :host > ul {
12
- margin-block-end: 1.5em;
13
- }
14
-
15
- ul {
16
- list-style: none;
17
- margin: 0;
18
- padding: 0;
19
- }
20
-
21
- [group-label] {
22
- padding: 25px 0 var(--padding-narrow) var(--padding-wide);
23
- border-bottom: var(--border-dark-color);
24
- font: bold 12px var(--theme-font);
25
- color: rgba(var(--primary-color-rgb), 0.9);
26
- text-transform: uppercase;
27
- }
28
-
29
- a {
30
- display: flex;
31
- align-items: center;
32
- border-bottom: 1px solid rgba(0, 0, 0, 0.07);
33
- padding: var(--padding-default) var(--padding-default) var(--padding-default) var(--padding-wide);
34
- text-decoration: none;
35
- font: normal 14px var(--theme-font);
36
- color: var(--secondary-color);
37
- text-transform: capitalize;
38
-
39
- overflow: hidden;
40
- white-space: nowrap;
41
- text-overflow: ellipsis;
42
- }
43
-
44
- a:hover {
45
- color: var(--primary-color);
46
- font-weight: bold;
47
- }
48
-
49
- a * {
50
- vertical-align: middle;
51
- }
52
-
53
- a mwc-icon {
54
- margin-right: var(--margin-narrow);
55
- font-size: 15px;
56
- color: rgba(var(--secondary-color-rgb), 0.7);
57
- }
58
-
59
- a [submenu-button] {
60
- float: left;
61
- font-size: 15px;
62
- max-height: 20px;
63
- }
64
-
65
- a [submenu-button]::before {
66
- content: 'add_box';
67
- }
68
-
69
- li[active] > a [submenu-button]::before {
70
- content: 'indeterminate_check_box';
71
- }
72
-
73
- li[active] > a {
74
- border-left: 3px solid var(--primary-color);
75
- font-weight: bold;
76
- color: var(--primary-color);
77
- }
78
-
79
- li li a {
80
- padding: 7px 0 7px 35px;
81
- font: normal 13px var(--theme-font);
82
- color: var(--secondary-color);
83
- }
84
-
85
- li li[active] a {
86
- background-color: rgba(var(--primary-color-rgb), 0.15);
87
- font: bold 13px var(--theme-font);
88
- color: var(--primary-color);
89
- }
90
-
91
- li > ul {
92
- overflow-y: hidden;
93
- max-height: 0;
94
- background-color: #f6f6f6;
95
-
96
- transition-property: all;
97
- transition-duration: 0.7s;
98
- }
99
-
100
- li[active] > ul {
101
- max-height: 500px;
102
- }
103
-
104
- li[active] > ul[settled] {
105
- overflow-y: auto;
106
- }
107
-
108
- li li a::before {
109
- margin-right: var(--margin-narrow);
110
- }
111
-
112
- a [badge] {
113
- margin-left: auto;
114
- background-color: var(--primary-background-color);
115
- color: white;
116
- border-radius: 999em;
117
- padding: 0px 6px;
118
- }
119
-
120
- @media only screen and (max-width: 460px) {
121
- :host {
122
- min-width: 100vw;
123
- }
124
-
125
- a {
126
- padding: var(--padding-wide);
127
- font: normal 15px var(--theme-font);
128
- }
129
-
130
- li[active] ul {
131
- border-bottom: 2px solid rgba(0, 0, 0, 0.1);
132
- }
133
-
134
- li li a {
135
- display: block;
136
- padding: var(--padding-wide) var(--padding-default) var(--padding-wide) 35px;
137
- overflow: hidden;
138
- text-overflow: ellipsis;
139
- white-space: nowrap;
140
- font: normal 14px var(--theme-font);
141
- }
142
-
143
- li li[active] a {
144
- font: bold 14px var(--theme-font);
145
- }
146
- }
147
- `
@@ -1,86 +0,0 @@
1
- import '@material/mwc-icon'
2
-
3
- import { html, LitElement } from 'lit'
4
- import { customElement, property, query, state } from 'lit/decorators.js'
5
-
6
- import { navigate } from '@operato/shell'
7
- import { ScrollbarStyles } from '@operato/styles'
8
-
9
- import { LiteMenuPortraitStyles } from './lite-menu-portrait-styles'
10
-
11
- @customElement('lite-menu-portrait')
12
- export class LiteMenuPortrait extends LitElement {
13
- static styles = [ScrollbarStyles, LiteMenuPortraitStyles]
14
-
15
- @property({ type: Array }) menus?: any[]
16
- @property({ type: Object }) activeTopLevel: any
17
- @property({ type: Object }) activeMenu: any
18
- @property({ type: String }) path?: string
19
-
20
- renderMenus(menus, activeTopLevel, activeMenu?) {
21
- return html`
22
- <ul>
23
- ${menus.map(menu => {
24
- var { type, active, path, name, badge, icon, menus } = menu
25
- active = active && typeof active === 'function' ? active.call(menu, { path: this.path }) : false
26
- badge = typeof badge === 'function' ? badge.call(menu) : badge ?? false
27
-
28
- return type == 'group'
29
- ? html`<li group-label>${name}</li>`
30
- : html`
31
- <li ?active=${activeTopLevel ? menu === activeTopLevel : active} .menu=${menu} menu>
32
- <a href=${path || '#'}>
33
- ${menus?.length > 0 ? html` <mwc-icon submenu-button></mwc-icon> ` : html``}
34
- <mwc-icon>${icon}</mwc-icon>
35
- ${name} ${badge !== false ? html`<div badge>${badge}</div>` : html``}
36
- </a>
37
- ${menus && this.renderMenus(menus, activeMenu)}
38
- </li>
39
- `
40
- })}
41
- </ul>
42
- `
43
- }
44
-
45
- render() {
46
- const { menus, activeTopLevel, activeMenu } = this
47
- return this.renderMenus(menus, activeTopLevel, activeMenu)
48
- }
49
-
50
- firstUpdated() {
51
- this.renderRoot.addEventListener('click', (e: Event) => {
52
- const menuElement = (e.target as Element)!.closest('[menu]')
53
-
54
- //@ts-ignore
55
- if (menuElement?.menu) {
56
- //@ts-ignore
57
- let menu = menuElement.menu
58
-
59
- if (!menu.path) {
60
- /* protect to act move to href. */
61
- e.stopPropagation()
62
- e.preventDefault()
63
- }
64
-
65
- this.dispatchEvent(
66
- new CustomEvent('active-toplevel', {
67
- bubbles: true,
68
- detail: this.activeTopLevel === menu ? undefined : menu
69
- })
70
- )
71
- }
72
-
73
- /* to respond even if current acting menu is selected */
74
- let href = (e.target as HTMLAnchorElement)!.href
75
- href && location.href === href && navigate(href + '#force', true)
76
- })
77
-
78
- /* to hide scrollbar during transition */
79
- this.renderRoot.addEventListener('transitionstart', e => {
80
- ;(e.target as Element).removeAttribute('settled')
81
- })
82
- this.renderRoot.addEventListener('transitionend', e => {
83
- ;(e.target as Element).setAttribute('settled', '')
84
- })
85
- }
86
- }