@operato/menu 8.0.0-beta.0 → 8.0.0-beta.2
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 +18 -0
- package/package.json +11 -11
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/demo/index.html +0 -40
- package/src/index.ts +0 -0
- package/src/menu-landscape-styles.ts +0 -149
- package/src/menu-portrait-styles.ts +0 -162
- package/src/ox-menu-landscape.ts +0 -105
- package/src/ox-menu-part.ts +0 -131
- package/src/ox-menu-portrait.ts +0 -91
- package/src/ox-top-menu-bar.ts +0 -147
- package/src/types.ts +0 -11
- package/stories/ox-menu-container.ts +0 -97
- package/stories/ox-menu-portrait.stories.ts +0 -65
- package/stories/test-menus.ts +0 -180
- package/tsconfig.json +0 -24
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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
|
+
## [8.0.0-beta.2](https://github.com/hatiolab/operato/compare/v8.0.0-beta.1...v8.0.0-beta.2) (2025-01-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* typo .npmignore ([d9c0c8c](https://github.com/hatiolab/operato/commit/d9c0c8c79abc688c3c2cfb6c37fcb689483a5977))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [8.0.0-beta.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### :bug: Bug Fix
|
|
19
|
+
|
|
20
|
+
* missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [8.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.56...v8.0.0-beta.0) (2025-01-07)
|
|
7
25
|
|
|
8
26
|
**Note:** Version bump only for package @operato/menu
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/menu",
|
|
3
3
|
"description": "Webcomponent menu following open-wc recommendations",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "8.0.0-beta.
|
|
5
|
+
"version": "8.0.0-beta.2",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"module": "dist/src/index.js",
|
|
8
8
|
"license": "MIT",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@material/web": "^2.0.0",
|
|
57
|
-
"@operato/data-grist": "^8.0.0-beta.
|
|
58
|
-
"@operato/graphql": "^8.0.0-beta.
|
|
59
|
-
"@operato/i18n": "^8.0.0-beta.
|
|
60
|
-
"@operato/input": "^8.0.0-beta.
|
|
61
|
-
"@operato/layout": "^8.0.0-beta.
|
|
62
|
-
"@operato/popup": "^8.0.0-beta.
|
|
63
|
-
"@operato/shell": "^8.0.0-beta.
|
|
64
|
-
"@operato/styles": "^8.0.0-beta.
|
|
65
|
-
"@operato/utils": "^8.0.0-beta.
|
|
57
|
+
"@operato/data-grist": "^8.0.0-beta.2",
|
|
58
|
+
"@operato/graphql": "^8.0.0-beta.2",
|
|
59
|
+
"@operato/i18n": "^8.0.0-beta.2",
|
|
60
|
+
"@operato/input": "^8.0.0-beta.2",
|
|
61
|
+
"@operato/layout": "^8.0.0-beta.2",
|
|
62
|
+
"@operato/popup": "^8.0.0-beta.2",
|
|
63
|
+
"@operato/shell": "^8.0.0-beta.2",
|
|
64
|
+
"@operato/styles": "^8.0.0-beta.2",
|
|
65
|
+
"@operato/utils": "^8.0.0-beta.2",
|
|
66
66
|
"lit": "^3.1.2"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"prettier --write"
|
|
98
98
|
]
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "ee1b5124995accb99272d3b5854f3df1d8746dda"
|
|
101
101
|
}
|
package/.editorconfig
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# EditorConfig helps developers define and maintain consistent
|
|
2
|
-
# coding styles between different editors and IDEs
|
|
3
|
-
# editorconfig.org
|
|
4
|
-
|
|
5
|
-
root = true
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[*]
|
|
9
|
-
|
|
10
|
-
# Change these settings to your own preference
|
|
11
|
-
indent_style = space
|
|
12
|
-
indent_size = 2
|
|
13
|
-
|
|
14
|
-
# We recommend you to keep these unchanged
|
|
15
|
-
end_of_line = lf
|
|
16
|
-
charset = utf-8
|
|
17
|
-
trim_trailing_whitespace = true
|
|
18
|
-
insert_final_newline = true
|
|
19
|
-
|
|
20
|
-
[*.md]
|
|
21
|
-
trim_trailing_whitespace = false
|
|
22
|
-
|
|
23
|
-
[*.json]
|
|
24
|
-
indent_size = 2
|
|
25
|
-
|
|
26
|
-
[*.{html,js,md}]
|
|
27
|
-
block_comment_start = /**
|
|
28
|
-
block_comment = *
|
|
29
|
-
block_comment_end = */
|
package/.storybook/main.js
DELETED
package/.storybook/preview.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { i18next } from '@operato/i18n'
|
|
2
|
-
|
|
3
|
-
export const globalTypes = {
|
|
4
|
-
locale: {
|
|
5
|
-
name: 'Locale',
|
|
6
|
-
description: 'Internationalization locale',
|
|
7
|
-
toolbar: {
|
|
8
|
-
icon: 'globe',
|
|
9
|
-
items: [
|
|
10
|
-
{ value: 'en', right: '🇺🇸', title: 'English' },
|
|
11
|
-
{ value: 'ko', right: '🇰🇷', title: '한국어' },
|
|
12
|
-
{ value: 'zh', right: '🇨🇳', title: '中文' },
|
|
13
|
-
{ value: 'ja', right: '🇯🇵', title: '日本語' },
|
|
14
|
-
{ value: 'ms', right: '🇲🇾', title: 'Bahasa Melayu' }
|
|
15
|
-
],
|
|
16
|
-
showName: true
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
theme: {
|
|
20
|
-
name: 'Theme',
|
|
21
|
-
description: 'Global theme for components',
|
|
22
|
-
toolbar: {
|
|
23
|
-
icon: 'paintbrush',
|
|
24
|
-
items: [
|
|
25
|
-
{ value: 'light', title: 'Light' },
|
|
26
|
-
{ value: 'dark', title: 'Dark' }
|
|
27
|
-
],
|
|
28
|
-
showName: true
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const decorators = [
|
|
34
|
-
(Story, context) => {
|
|
35
|
-
const { locale, theme } = context.globals
|
|
36
|
-
|
|
37
|
-
if (locale) {
|
|
38
|
-
i18next.changeLanguage(locale)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Set the theme class for the document
|
|
42
|
-
if (theme === 'dark') {
|
|
43
|
-
document.documentElement.classList.add('dark')
|
|
44
|
-
document.documentElement.classList.remove('light')
|
|
45
|
-
} else {
|
|
46
|
-
document.documentElement.classList.add('light')
|
|
47
|
-
document.documentElement.classList.remove('dark')
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return Story()
|
|
51
|
-
}
|
|
52
|
-
]
|
package/.storybook/server.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { storybookPlugin } from '@web/dev-server-storybook';
|
|
2
|
-
import baseConfig from '../web-dev-server.config.mjs';
|
|
3
|
-
|
|
4
|
-
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
5
|
-
...baseConfig,
|
|
6
|
-
open: '/',
|
|
7
|
-
plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins],
|
|
8
|
-
});
|
package/demo/index.html
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en-GB">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<style>
|
|
6
|
-
body {
|
|
7
|
-
background: #fafafa;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
#demo {
|
|
11
|
-
position: relative;
|
|
12
|
-
height: 100px;
|
|
13
|
-
background-color: lightgray;
|
|
14
|
-
text-align: center;
|
|
15
|
-
vertical-align: middle;
|
|
16
|
-
}
|
|
17
|
-
</style>
|
|
18
|
-
</head>
|
|
19
|
-
<body>
|
|
20
|
-
<div id="demo"></div>
|
|
21
|
-
|
|
22
|
-
<script type="module">
|
|
23
|
-
import { html, render } from 'lit'
|
|
24
|
-
import '../dist/src/ox-menu.js'
|
|
25
|
-
import { OxMenu } from '../dist/src/ox-menu.js'
|
|
26
|
-
|
|
27
|
-
const parent = document.querySelector('#demo')
|
|
28
|
-
parent.addEventListener('click', function (e) {
|
|
29
|
-
OxMenu.open({
|
|
30
|
-
template: html``,
|
|
31
|
-
top: e.pageY,
|
|
32
|
-
left: e.pageX,
|
|
33
|
-
parent
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
render(html`clike anywhere in this box to menu mini.`, parent)
|
|
38
|
-
</script>
|
|
39
|
-
</body>
|
|
40
|
-
</html>
|
package/src/index.ts
DELETED
|
File without changes
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit'
|
|
2
|
-
|
|
3
|
-
export const MenuLandscapeStyles = css`
|
|
4
|
-
:host {
|
|
5
|
-
overflow-x: auto;
|
|
6
|
-
background-color: var(--md-sys-color-on-secondary-container);
|
|
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-dim-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(--md-sys-color-on-primary-container);
|
|
42
|
-
margin: 0;
|
|
43
|
-
padding: 0;
|
|
44
|
-
border-left: var(--border-dim-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(--spacing-small) var(--spacing-large);
|
|
55
|
-
text-decoration: none;
|
|
56
|
-
font: normal 14px var(--theme-font);
|
|
57
|
-
color: var(--md-sys-color-surface);
|
|
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(--md-sys-color-surface);
|
|
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(--md-sys-color-on-primary-container);
|
|
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] md-icon {
|
|
97
|
-
background-color: rgba(0, 0, 0, 0.15);
|
|
98
|
-
margin-right: 4px;
|
|
99
|
-
padding: var(--spacing-small);
|
|
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(--spacing-large);
|
|
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(--spacing-large) var(--padding-default) var(--spacing-large) 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 md-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,162 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit'
|
|
2
|
-
|
|
3
|
-
export const MenuPortraitStyles = css`
|
|
4
|
-
:host {
|
|
5
|
-
display: flex;
|
|
6
|
-
overflow-y: auto;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
height: 100%;
|
|
9
|
-
background-color: var(--md-sys-color-on-primary);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
:host > ul {
|
|
13
|
-
margin-block-end: 1.5em;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
ul {
|
|
17
|
-
list-style: none;
|
|
18
|
-
margin: var(--spacing-none);
|
|
19
|
-
padding: var(--spacing-none);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
[group-label] {
|
|
23
|
-
padding: var(--spacing-huge) var(--spacing-none) var(--spacing-small) var(--spacing-large);
|
|
24
|
-
border-bottom: var(--border-dim-color);
|
|
25
|
-
font: var(--md-sys-typescale-label-large-weight, var(--md-ref-typeface-weight-medium, 500)) 12px var(--theme-font);
|
|
26
|
-
color: var(--md-sys-color-primary);
|
|
27
|
-
text-transform: uppercase;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
a {
|
|
31
|
-
display: flex;
|
|
32
|
-
align-items: center;
|
|
33
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.07);
|
|
34
|
-
padding: var(--spacing-medium);
|
|
35
|
-
padding-left: var(--spacing-large);
|
|
36
|
-
text-decoration: none;
|
|
37
|
-
font: normal var(--md-sys-typescale-label-large-size, 0.875rem) var(--theme-font);
|
|
38
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
39
|
-
text-transform: capitalize;
|
|
40
|
-
|
|
41
|
-
overflow: hidden;
|
|
42
|
-
white-space: nowrap;
|
|
43
|
-
text-overflow: ellipsis;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
a:hover {
|
|
47
|
-
color: var(--md-sys-color-primary);
|
|
48
|
-
font-weight: bold;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
a * {
|
|
52
|
-
vertical-align: middle;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
a md-icon {
|
|
56
|
-
--md-icon-size: var(--icon-size-tiny);
|
|
57
|
-
opacity: 0.7;
|
|
58
|
-
margin-right: var(--spacing-small);
|
|
59
|
-
color: var(--md-sys-color-primary);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
md-icon[filled] {
|
|
63
|
-
font-variation-settings: 'FILL' 1;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
a [submenu-button] {
|
|
67
|
-
--md-icon-size: var(--icon-size-tiny);
|
|
68
|
-
max-height: 1em;
|
|
69
|
-
margin-left: auto;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
a [submenu-button]::before {
|
|
73
|
-
content: 'chevron_right';
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
a > span {
|
|
77
|
-
flex: 1;
|
|
78
|
-
overflow: hidden;
|
|
79
|
-
white-space: nowrap;
|
|
80
|
-
text-overflow: ellipsis;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
li[active] > a [submenu-button]::before {
|
|
84
|
-
content: 'expand_more';
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
li[active] > a {
|
|
88
|
-
color: var(--md-sys-color-on-primary-container);
|
|
89
|
-
font-weight: bold;
|
|
90
|
-
border-left: 3px solid var(--md-sys-color-primary);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
li li a {
|
|
94
|
-
padding: var(--spacing-medium);
|
|
95
|
-
padding-left: var(--spacing-huge);
|
|
96
|
-
font: normal 13px var(--theme-font);
|
|
97
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
li li[active] a {
|
|
101
|
-
background-color: var(--md-sys-color-primary-container);
|
|
102
|
-
font: var(--md-sys-typescale-label-large-weight, var(--md-ref-typeface-weight-medium, 500))
|
|
103
|
-
var(--md-sys-typescale-label-large-size, 0.875rem) var(--theme-font);
|
|
104
|
-
color: var(--md-sys-color-primary);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
li > ul {
|
|
108
|
-
overflow-y: hidden;
|
|
109
|
-
max-height: 0;
|
|
110
|
-
background-color: var(--md-sys-color-surface);
|
|
111
|
-
|
|
112
|
-
transition-property: all;
|
|
113
|
-
transition-duration: 0.7s;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
li[active] > ul {
|
|
117
|
-
max-height: 500px;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
li[active] > ul[settled] {
|
|
121
|
-
overflow-y: auto;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
li li a::before {
|
|
125
|
-
margin-right: var(--spacing-small);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
a [badge] {
|
|
129
|
-
margin-left: auto;
|
|
130
|
-
background-color: var(--md-sys-color-primary);
|
|
131
|
-
border-radius: var(--md-sys-shape-corner-full);
|
|
132
|
-
padding: 0 var(--spacing-small);
|
|
133
|
-
color: var(--md-sys-color-on-primary);
|
|
134
|
-
font-size: 0.9em;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
@media only screen and (max-width: 460px) {
|
|
138
|
-
:host {
|
|
139
|
-
min-width: 100vw;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
a {
|
|
143
|
-
padding: var(--spacing-large);
|
|
144
|
-
font: normal 15px var(--theme-font);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
li li a {
|
|
148
|
-
display: block;
|
|
149
|
-
padding: var(--spacing-medium);
|
|
150
|
-
padding-left: var(--spacing-huge);
|
|
151
|
-
overflow: hidden;
|
|
152
|
-
text-overflow: ellipsis;
|
|
153
|
-
white-space: nowrap;
|
|
154
|
-
font: normal var(--md-sys-typescale-label-large-size, 0.875rem) var(--theme-font);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
li li[active] a {
|
|
158
|
-
font: var(--md-sys-typescale-label-large-weight, var(--md-ref-typeface-weight-medium, 500))
|
|
159
|
-
var(--md-sys-typescale-label-large-size, 0.875rem) var(--theme-font);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
`
|
package/src/ox-menu-landscape.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js'
|
|
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 { Menu } from './types'
|
|
11
|
-
import { MenuLandscapeStyles } from './menu-landscape-styles'
|
|
12
|
-
|
|
13
|
-
@customElement('ox-menu-landscape')
|
|
14
|
-
export class OxMenuLandscape extends connect(store)(LitElement) {
|
|
15
|
-
static styles = [ScrollbarStyles, MenuLandscapeStyles]
|
|
16
|
-
|
|
17
|
-
@property({ type: Array }) menus?: Menu[]
|
|
18
|
-
@property({ type: Object }) activeTopLevel?: Menu
|
|
19
|
-
@property({ type: Object }) activeMenu!: Menu
|
|
20
|
-
@property({ type: String }) path?: string
|
|
21
|
-
|
|
22
|
-
render() {
|
|
23
|
-
const { menus = [], activeTopLevel, activeMenu } = this
|
|
24
|
-
|
|
25
|
-
return html`
|
|
26
|
-
<div id="wrap" @mousewheel=${this.onWheelEvent.bind(this)}>
|
|
27
|
-
<ul>
|
|
28
|
-
${menus.map(menu =>
|
|
29
|
-
menu.type == 'group'
|
|
30
|
-
? html``
|
|
31
|
-
: html`
|
|
32
|
-
<li ?active=${menu === activeTopLevel}>
|
|
33
|
-
<a href=${menu.path || '#'}>
|
|
34
|
-
${menu.icon ? html`<md-icon>${menu.icon}</md-icon>` : html``} ${menu.label || menu.name}
|
|
35
|
-
</a>
|
|
36
|
-
|
|
37
|
-
<ul submenus>
|
|
38
|
-
${menu.menus?.map(
|
|
39
|
-
menu => html`
|
|
40
|
-
<li ?active=${menu === activeMenu}>
|
|
41
|
-
<a href=${menu.path || '#'}> ${menu.label || menu.name} </a>
|
|
42
|
-
</li>
|
|
43
|
-
`
|
|
44
|
-
)}
|
|
45
|
-
</ul>
|
|
46
|
-
|
|
47
|
-
<div description>
|
|
48
|
-
${menu.icon ? html`<md-icon>${menu.icon}</md-icon>` : html``} ${menu.description || ''}
|
|
49
|
-
</div>
|
|
50
|
-
</li>
|
|
51
|
-
`
|
|
52
|
-
)}
|
|
53
|
-
</ul>
|
|
54
|
-
</div>
|
|
55
|
-
`
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
firstUpdated() {
|
|
59
|
-
this.renderRoot.addEventListener('click', (e: Event) => {
|
|
60
|
-
//@ts-ignore
|
|
61
|
-
if (e.target.submenu) {
|
|
62
|
-
/* protect to act move to href. */
|
|
63
|
-
e.stopPropagation()
|
|
64
|
-
e.preventDefault()
|
|
65
|
-
|
|
66
|
-
//@ts-ignore
|
|
67
|
-
let menu = e.target.submenu
|
|
68
|
-
|
|
69
|
-
this.dispatchEvent(
|
|
70
|
-
new CustomEvent('active-toplevel', {
|
|
71
|
-
bubbles: true,
|
|
72
|
-
detail: this.activeTopLevel === menu ? undefined : menu
|
|
73
|
-
})
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/* to respond even if current acting menu is selected */
|
|
80
|
-
let href = (e.target as HTMLAnchorElement).href
|
|
81
|
-
href && location.href === href && navigate(href + '#force', true)
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
/* to hide scrollbar during transition */
|
|
85
|
-
this.renderRoot.addEventListener('transitionstart', e => {
|
|
86
|
-
;(e.target as HTMLElement).removeAttribute('settled')
|
|
87
|
-
})
|
|
88
|
-
this.renderRoot.addEventListener('transitionend', e => {
|
|
89
|
-
;(e.target as HTMLElement).setAttribute('settled', '')
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
onWheelEvent(e: WheelEvent) {
|
|
94
|
-
const { target, deltaY, detail } = e
|
|
95
|
-
|
|
96
|
-
if (!(target instanceof HTMLElement)) {
|
|
97
|
-
return
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const delta = deltaY || -detail
|
|
101
|
-
target.scrollLeft -= (delta / Math.abs(delta)) * 10
|
|
102
|
-
|
|
103
|
-
e.preventDefault()
|
|
104
|
-
}
|
|
105
|
-
}
|