@operato/help 8.0.0-alpha.8 → 8.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 +179 -0
- package/dist/src/components/ox-help-icon.d.ts +2 -2
- package/dist/src/components/ox-help-icon.js +2 -2
- package/dist/src/components/ox-help-icon.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/src/components/ox-help-icon.ts +0 -49
- package/src/components/ox-inline-help.ts +0 -29
- package/src/components/ox-title-with-help.ts +0 -39
- package/src/controller/help.ts +0 -13
- package/src/grist/help-decorated-renderer.ts +0 -19
- package/src/help-style.ts +0 -123
- package/src/index.ts +0 -5
- package/src/pages/ox-help-home.ts +0 -126
- package/src/themes/help-theme.css +0 -57
- package/src/viewparts/ox-help-panel.ts +0 -217
- package/tsconfig.json +0 -24
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
@@ -1,217 +0,0 @@
|
|
1
|
-
import '@material/web/icon/icon.js'
|
2
|
-
import '@operato/markdown/ox-markdown.js'
|
3
|
-
|
4
|
-
import { css, html, LitElement, PropertyValues } from 'lit'
|
5
|
-
import { customElement, property, query, state } from 'lit/decorators.js'
|
6
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
7
|
-
|
8
|
-
import Headroom from '@operato/headroom'
|
9
|
-
import { closeOverlay } from '@operato/layout'
|
10
|
-
import { navigate, store } from '@operato/shell'
|
11
|
-
import { HeadroomStyles, ScrollbarStyles } from '@operato/styles'
|
12
|
-
|
13
|
-
@customElement('ox-help-panel')
|
14
|
-
class HelpPanel extends connect(store)(LitElement) {
|
15
|
-
static styles = [
|
16
|
-
ScrollbarStyles,
|
17
|
-
HeadroomStyles,
|
18
|
-
css`
|
19
|
-
:host {
|
20
|
-
display: flex;
|
21
|
-
flex-direction: column;
|
22
|
-
background-color: var(--help-panel-background-color);
|
23
|
-
|
24
|
-
position: relative;
|
25
|
-
width: var(--help-panel-width);
|
26
|
-
max-height: 90%;
|
27
|
-
border-radius: var(--help-panel-border-raidus);
|
28
|
-
border: var(--help-panel-border);
|
29
|
-
box-shadow: var(--help-panel-box-shadow);
|
30
|
-
color: var(--help-panel-color);
|
31
|
-
margin: 4px;
|
32
|
-
|
33
|
-
overflow: hidden;
|
34
|
-
|
35
|
-
--md-icon-size: 24px;
|
36
|
-
}
|
37
|
-
|
38
|
-
:host(:focus) {
|
39
|
-
outline: none;
|
40
|
-
}
|
41
|
-
|
42
|
-
#navigation {
|
43
|
-
display: flex;
|
44
|
-
position: absolute;
|
45
|
-
width: 100%;
|
46
|
-
padding: var(--help-navigation-padding);
|
47
|
-
border-bottom: var(--help-navigation-bottom);
|
48
|
-
background-color: var(--md-sys-color-surface);
|
49
|
-
}
|
50
|
-
|
51
|
-
#navigation md-icon {
|
52
|
-
padding: var(--help-navigation-icon-padding, var(--padding-default));
|
53
|
-
border-right: var(--help-navigation-icon-border);
|
54
|
-
cursor: pointer;
|
55
|
-
color: var(--help-icon-color);
|
56
|
-
}
|
57
|
-
|
58
|
-
#close {
|
59
|
-
margin-left: auto;
|
60
|
-
border-right: 0;
|
61
|
-
}
|
62
|
-
|
63
|
-
#content {
|
64
|
-
flex: 1;
|
65
|
-
overflow: auto;
|
66
|
-
padding: var(--help-panel-content-padding);
|
67
|
-
margin: var(--help-panel-margin);
|
68
|
-
}
|
69
|
-
|
70
|
-
#upward {
|
71
|
-
--md-icon-size: 26px;
|
72
|
-
position: absolute;
|
73
|
-
bottom: var(--data-list-fab-position-vertical);
|
74
|
-
right: var(--data-list-fab-position-horizontal);
|
75
|
-
background-color: rgba(255, 255, 255, 0.7);
|
76
|
-
border-radius: 20px;
|
77
|
-
color: var(--data-list-fab-color);
|
78
|
-
box-shadow: var(--data-list-fab-shadow);
|
79
|
-
padding: 7px;
|
80
|
-
}
|
81
|
-
|
82
|
-
md-icon[filled] {
|
83
|
-
font-variation-settings: 'FILL' 1;
|
84
|
-
}
|
85
|
-
|
86
|
-
@media screen and (max-width: 460px) {
|
87
|
-
:host {
|
88
|
-
height: 100%;
|
89
|
-
max-height: 100%;
|
90
|
-
margin: 0;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
`
|
94
|
-
]
|
95
|
-
|
96
|
-
@property({ type: String }) topic!: string
|
97
|
-
@property({ type: Boolean }) showGotoTop: boolean = false
|
98
|
-
|
99
|
-
@state() historyIndex: number = -1
|
100
|
-
@state() history: string[] = []
|
101
|
-
|
102
|
-
@query('#content') content!: HTMLElement
|
103
|
-
@query('#navigation') navigation!: HTMLElement
|
104
|
-
|
105
|
-
render() {
|
106
|
-
const src = this.topic && `/helps/${this.topic}.md`
|
107
|
-
|
108
|
-
return html`
|
109
|
-
<div id="navigation">
|
110
|
-
<md-icon filled @click=${() => this.goHome()} ?disabled=${this.history[0] === this.history[this.historyIndex]}>
|
111
|
-
home
|
112
|
-
</md-icon>
|
113
|
-
<md-icon filled @click=${() => this.historyBack()} ?disabled=${this.historyIndex < 1}>
|
114
|
-
keyboard_arrow_left
|
115
|
-
</md-icon>
|
116
|
-
<md-icon filled @click=${() => this.historyForward()} ?disabled=${this.historyIndex >= this.history.length - 1}>
|
117
|
-
keyboard_arrow_right
|
118
|
-
</md-icon>
|
119
|
-
<md-icon filled @click=${() => navigate(`help?topic=${this.topic}`)}> open_in_new </md-icon>
|
120
|
-
<md-icon filled id="close" @click=${() => closeOverlay('help')}> close </md-icon>
|
121
|
-
</div>
|
122
|
-
|
123
|
-
${!this.showGotoTop
|
124
|
-
? html``
|
125
|
-
: html` <md-icon filled id="upward" @click=${(e: Event) => this.gotoTop(e)}>arrow_upward</md-icon> `}
|
126
|
-
<ox-markdown id="content" .src=${src}></ox-markdown>
|
127
|
-
`
|
128
|
-
}
|
129
|
-
|
130
|
-
async firstUpdated() {
|
131
|
-
this.setupRouter()
|
132
|
-
|
133
|
-
this.content.addEventListener('scroll', (e: Event) => {
|
134
|
-
this.showGotoTop = (e.target as HTMLElement)?.scrollTop !== 0
|
135
|
-
})
|
136
|
-
|
137
|
-
await this.requestUpdate()
|
138
|
-
|
139
|
-
var originPaddingTop = parseFloat(getComputedStyle(this.content, null).getPropertyValue('padding-top'))
|
140
|
-
this.content.style.paddingTop = this.navigation.clientHeight + originPaddingTop + 'px'
|
141
|
-
|
142
|
-
var headroom = new Headroom(this.navigation, {
|
143
|
-
scroller: this.content
|
144
|
-
})
|
145
|
-
headroom.init()
|
146
|
-
}
|
147
|
-
|
148
|
-
async updated(changes: PropertyValues<this>) {
|
149
|
-
if (changes.has('topic')) {
|
150
|
-
if (this.historyIndex === -1) {
|
151
|
-
this.history = [this.topic]
|
152
|
-
this.historyIndex = 0
|
153
|
-
}
|
154
|
-
}
|
155
|
-
|
156
|
-
if (changes.has('historyIndex')) {
|
157
|
-
this.topic = this.history[this.historyIndex]
|
158
|
-
this.content.scrollTop = 0
|
159
|
-
}
|
160
|
-
}
|
161
|
-
|
162
|
-
setupRouter() {
|
163
|
-
this.addEventListener('click', e => {
|
164
|
-
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey) {
|
165
|
-
return
|
166
|
-
}
|
167
|
-
|
168
|
-
const anchor = e.composedPath().filter(n => (n as HTMLElement).tagName === 'A')[0] as HTMLAnchorElement
|
169
|
-
if (!anchor || anchor.target || anchor.hasAttribute('download') || anchor.getAttribute('rel') === 'external') {
|
170
|
-
return
|
171
|
-
}
|
172
|
-
|
173
|
-
const href = anchor.href
|
174
|
-
const newUrl = new URL(href, document.baseURI)
|
175
|
-
if (!href || href.indexOf('mailto:') !== -1 || newUrl.origin !== location.origin) {
|
176
|
-
return
|
177
|
-
}
|
178
|
-
|
179
|
-
e.preventDefault()
|
180
|
-
e.stopPropagation()
|
181
|
-
|
182
|
-
const pathname = newUrl.pathname
|
183
|
-
const topic = newUrl.searchParams?.get('topic')
|
184
|
-
if (pathname.endsWith('/help') && topic) {
|
185
|
-
this.history = [...this.history.slice(0, this.historyIndex + 1), topic]
|
186
|
-
this.historyIndex++
|
187
|
-
this.topic = topic
|
188
|
-
} else {
|
189
|
-
navigate(href)
|
190
|
-
}
|
191
|
-
|
192
|
-
return
|
193
|
-
})
|
194
|
-
}
|
195
|
-
|
196
|
-
gotoTop(e: Event) {
|
197
|
-
this.content.scrollTop = 0
|
198
|
-
|
199
|
-
e.stopPropagation()
|
200
|
-
}
|
201
|
-
|
202
|
-
goHome() {
|
203
|
-
if (!this.history?.[0] || this.history[0] == this.topic) {
|
204
|
-
return
|
205
|
-
}
|
206
|
-
this.history.push(this.history[0])
|
207
|
-
this.historyIndex = this.history.length - 1
|
208
|
-
}
|
209
|
-
|
210
|
-
historyBack() {
|
211
|
-
this.historyIndex > 0 && this.historyIndex--
|
212
|
-
}
|
213
|
-
|
214
|
-
historyForward() {
|
215
|
-
this.history && this.historyIndex < this.history.length - 1 && this.historyIndex++
|
216
|
-
}
|
217
|
-
}
|
package/tsconfig.json
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"target": "es2018",
|
4
|
-
"module": "esnext",
|
5
|
-
"moduleResolution": "node",
|
6
|
-
"noEmitOnError": true,
|
7
|
-
"lib": ["es2017", "dom"],
|
8
|
-
"strict": true,
|
9
|
-
"esModuleInterop": false,
|
10
|
-
"allowSyntheticDefaultImports": true,
|
11
|
-
"experimentalDecorators": true,
|
12
|
-
"useDefineForClassFields": false,
|
13
|
-
"importHelpers": true,
|
14
|
-
"outDir": "dist",
|
15
|
-
"sourceMap": true,
|
16
|
-
"inlineSources": true,
|
17
|
-
"rootDir": "./",
|
18
|
-
"declaration": true,
|
19
|
-
"incremental": true,
|
20
|
-
"skipLibCheck": true,
|
21
|
-
"types": ["node", "mocha"]
|
22
|
-
},
|
23
|
-
"include": ["**/*.ts"]
|
24
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
2
|
-
|
3
|
-
/** Use Hot Module replacement by adding --hmr to the start command */
|
4
|
-
const hmr = process.argv.includes('--hmr');
|
5
|
-
|
6
|
-
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
7
|
-
open: '/demo/',
|
8
|
-
/** Use regular watch mode if HMR is not enabled. */
|
9
|
-
watch: !hmr,
|
10
|
-
/** Resolve bare module imports */
|
11
|
-
nodeResolve: {
|
12
|
-
exportConditions: ['browser', 'development'],
|
13
|
-
},
|
14
|
-
|
15
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
16
|
-
// esbuildTarget: 'auto'
|
17
|
-
|
18
|
-
/** Set appIndex to enable SPA routing */
|
19
|
-
// appIndex: 'demo/index.html',
|
20
|
-
|
21
|
-
plugins: [
|
22
|
-
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
23
|
-
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
24
|
-
],
|
25
|
-
|
26
|
-
// See documentation for all available options
|
27
|
-
});
|
@@ -1,41 +0,0 @@
|
|
1
|
-
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
2
|
-
|
3
|
-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
4
|
-
|
5
|
-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
6
|
-
/** Test files to run */
|
7
|
-
files: 'dist/test/**/*.test.js',
|
8
|
-
|
9
|
-
/** Resolve bare module imports */
|
10
|
-
nodeResolve: {
|
11
|
-
exportConditions: ['browser', 'development'],
|
12
|
-
},
|
13
|
-
|
14
|
-
/** Filter out lit dev mode logs */
|
15
|
-
filterBrowserLogs(log) {
|
16
|
-
for (const arg of log.args) {
|
17
|
-
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
18
|
-
return false;
|
19
|
-
}
|
20
|
-
}
|
21
|
-
return true;
|
22
|
-
},
|
23
|
-
|
24
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
25
|
-
// esbuildTarget: 'auto',
|
26
|
-
|
27
|
-
/** Amount of browsers to run concurrently */
|
28
|
-
// concurrentBrowsers: 2,
|
29
|
-
|
30
|
-
/** Amount of test files per browser to test concurrently */
|
31
|
-
// concurrency: 1,
|
32
|
-
|
33
|
-
/** Browsers to run tests on */
|
34
|
-
// browsers: [
|
35
|
-
// playwrightLauncher({ product: 'chromium' }),
|
36
|
-
// playwrightLauncher({ product: 'firefox' }),
|
37
|
-
// playwrightLauncher({ product: 'webkit' }),
|
38
|
-
// ],
|
39
|
-
|
40
|
-
// See documentation for all available options
|
41
|
-
});
|