@api-client/ui 0.5.39 → 0.5.40
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/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +1 -1
- package/.aiexclude +0 -3
- package/.cursor/rules/html-and-css-best-practices.mdc +0 -63
- package/.cursor/rules/lit-best-practices.mdc +0 -89
- package/.editorconfig +0 -29
- package/.github/CONTRIBUTING.md +0 -24
- package/.github/instructions/html-and-css-best-practices.instructions.md +0 -70
- package/.github/instructions/lit-best-practices.instructions.md +0 -90
- package/.github/release.yml +0 -14
- package/.github/stale.yml +0 -23
- package/.github/workflows/auto-release.yml +0 -182
- package/.github/workflows/release.yml +0 -82
- package/.prettierrc.js +0 -14
- package/.vscode/settings.json +0 -18
- package/RELEASE.md +0 -163
- package/RELEASE_SETUP.md +0 -235
- package/build/src/demo/DemoPage.d.ts +0 -81
- package/build/src/demo/DemoPage.d.ts.map +0 -1
- package/build/src/demo/DemoPage.js +0 -175
- package/build/src/demo/DemoPage.js.map +0 -1
- package/build/src/demo/DemoStyles.d.ts +0 -3
- package/build/src/demo/DemoStyles.d.ts.map +0 -1
- package/build/src/demo/DemoStyles.js +0 -60
- package/build/src/demo/DemoStyles.js.map +0 -1
- package/build/test/elements/navigation/Navigation.test.d.ts +0 -3
- package/build/test/elements/navigation/Navigation.test.d.ts.map +0 -1
- package/build/test/elements/navigation/Navigation.test.js +0 -113
- package/build/test/elements/navigation/Navigation.test.js.map +0 -1
- package/commitlint.config.cjs +0 -2
- package/demo/elements/authorization/AuthPlugin.js +0 -57
- package/demo/elements/authorization/AuthProxy.js +0 -215
- package/demo/elements/authorization/api-key.html +0 -27
- package/demo/elements/authorization/api-key.ts +0 -44
- package/demo/elements/authorization/basic.html +0 -27
- package/demo/elements/authorization/basic.ts +0 -43
- package/demo/elements/authorization/bearer.html +0 -27
- package/demo/elements/authorization/bearer.ts +0 -43
- package/demo/elements/authorization/env.js +0 -8
- package/demo/elements/authorization/index.html +0 -44
- package/demo/elements/authorization/ntlm.html +0 -27
- package/demo/elements/authorization/ntlm.ts +0 -43
- package/demo/elements/authorization/oauth-authorize.html +0 -75
- package/demo/elements/authorization/oauth-authorize.ts +0 -40
- package/demo/elements/authorization/oauth-error.html +0 -18
- package/demo/elements/authorization/oauth-error.ts +0 -10
- package/demo/elements/authorization/oauth-popup.html +0 -36
- package/demo/elements/authorization/oauth2.html +0 -27
- package/demo/elements/authorization/oauth2.ts +0 -100
- package/demo/elements/authorization/oidc.html +0 -27
- package/demo/elements/authorization/oidc.ts +0 -139
- package/demo/elements/authorization/private.crt +0 -31
- package/demo/elements/authorization/private.csr +0 -28
- package/demo/elements/authorization/private.key +0 -51
- package/demo/elements/authorization/private.pem +0 -31
- package/demo/elements/authorization/redirect.html +0 -20
- package/demo/elements/authorization/ssl-commands.sh +0 -30
- package/demo/elements/authorization/ssl.conf +0 -24
- package/demo/elements/autocomplete/index.html +0 -64
- package/demo/elements/autocomplete/index.ts +0 -171
- package/demo/elements/code-editor/CodeEditorDemo.ts +0 -173
- package/demo/elements/code-editor/index.html +0 -19
- package/demo/elements/context-menu/DemoIcons.ts +0 -21
- package/demo/elements/context-menu/basic.html +0 -25
- package/demo/elements/context-menu/basic.ts +0 -119
- package/demo/elements/context-menu/custom-data.html +0 -25
- package/demo/elements/context-menu/custom-data.ts +0 -62
- package/demo/elements/context-menu/demo.css +0 -28
- package/demo/elements/context-menu/enabled-state.html +0 -25
- package/demo/elements/context-menu/enabled-state.ts +0 -73
- package/demo/elements/context-menu/icons.html +0 -25
- package/demo/elements/context-menu/icons.ts +0 -64
- package/demo/elements/context-menu/index.html +0 -43
- package/demo/elements/context-menu/nested.html +0 -25
- package/demo/elements/context-menu/nestedt.ts +0 -152
- package/demo/elements/context-menu/no-execute.html +0 -25
- package/demo/elements/context-menu/no-execute.ts +0 -134
- package/demo/elements/context-menu/radio-menu.html +0 -25
- package/demo/elements/context-menu/radio-menu.ts +0 -83
- package/demo/elements/context-menu/separators.html +0 -25
- package/demo/elements/context-menu/separators.ts +0 -172
- package/demo/elements/currency/index.html +0 -91
- package/demo/elements/currency/index.ts +0 -352
- package/demo/elements/environment/environment-editor.html +0 -20
- package/demo/elements/environment/environment-editor.ts +0 -49
- package/demo/elements/environment/index.html +0 -33
- package/demo/elements/environment/server-editor.html +0 -20
- package/demo/elements/environment/server-editor.ts +0 -67
- package/demo/elements/environment/variables-editor.html +0 -20
- package/demo/elements/environment/variables-editor.ts +0 -94
- package/demo/elements/har/har-viewer.html +0 -20
- package/demo/elements/har/har-viewer.ts +0 -76
- package/demo/elements/har/har1.har +0 -3044
- package/demo/elements/har/har2.json +0 -439
- package/demo/elements/har/index.html +0 -26
- package/demo/elements/highlight/example.md +0 -27
- package/demo/elements/highlight/index.html +0 -31
- package/demo/elements/highlight/marked-highlight.html +0 -132
- package/demo/elements/highlight/marked-highlight.ts +0 -22
- package/demo/elements/highlight/prism-highlight.html +0 -62
- package/demo/elements/highlight/prism-highlight.ts +0 -17
- package/demo/elements/http/body-editor.html +0 -17
- package/demo/elements/http/body-editor.ts +0 -115
- package/demo/elements/http/headers.html +0 -17
- package/demo/elements/http/headers.ts +0 -59
- package/demo/elements/http/http-assertions.html +0 -20
- package/demo/elements/http/http-assertions.ts +0 -89
- package/demo/elements/http/http-flows.html +0 -23
- package/demo/elements/http/http-flows.ts +0 -89
- package/demo/elements/http/index.html +0 -45
- package/demo/elements/http/request-editor.html +0 -26
- package/demo/elements/http/request-editor.ts +0 -197
- package/demo/elements/http/request-log.html +0 -16
- package/demo/elements/http/request-log.ts +0 -136
- package/demo/elements/http/url-editing.html +0 -17
- package/demo/elements/http/url-editing.ts +0 -112
- package/demo/elements/icons/index.html +0 -81
- package/demo/elements/icons/index.ts +0 -52
- package/demo/elements/index.html +0 -72
- package/demo/elements/mention-textarea/index.html +0 -19
- package/demo/elements/mention-textarea/index.ts +0 -205
- package/demo/elements/navigation/navigation-item.html +0 -49
- package/demo/elements/navigation/navigation-item.ts +0 -131
- package/demo/elements/navigation/navigation.html +0 -20
- package/demo/elements/navigation/navigation.ts +0 -45
- package/demo/elements/project/index.html +0 -29
- package/demo/elements/project/project-run-report.html +0 -20
- package/demo/elements/project/project-run-report.ts +0 -132
- package/demo/elements/project/request-editor.html +0 -23
- package/demo/elements/project/request-editor.ts +0 -232
- package/demo/elements/user/user-avatar.html +0 -17
- package/demo/elements/user/user-avatar.ts +0 -60
- package/demo/env.js +0 -4
- package/demo/index.html +0 -34
- package/demo/layout/index.html +0 -94
- package/demo/layout/index.ts +0 -190
- package/demo/md/DemoStyles.ts +0 -61
- package/demo/md/UiDemoPage.ts +0 -6
- package/demo/md/buttons/button.html +0 -121
- package/demo/md/buttons/button.ts +0 -246
- package/demo/md/buttons/group.html +0 -36
- package/demo/md/buttons/group.ts +0 -171
- package/demo/md/checkbox/index.html +0 -39
- package/demo/md/checkbox/index.ts +0 -220
- package/demo/md/chip/chip.html +0 -70
- package/demo/md/chip/chip.ts +0 -219
- package/demo/md/chip/pawel6c9a.jpg +0 -0
- package/demo/md/collapse/CustomDetail.ts +0 -89
- package/demo/md/collapse/collapse.html +0 -21
- package/demo/md/collapse/collapse.ts +0 -78
- package/demo/md/date-picker/date-picker.ts +0 -336
- package/demo/md/date-picker/index.html +0 -171
- package/demo/md/dialog/confirm-dialog.html +0 -49
- package/demo/md/dialog/confirm-dialog.ts +0 -121
- package/demo/md/dialog/dialog.html +0 -25
- package/demo/md/dialog/dialog.ts +0 -468
- package/demo/md/dropdown-list/index.html +0 -31
- package/demo/md/dropdown-list/index.ts +0 -158
- package/demo/md/icon-button/index.html +0 -122
- package/demo/md/icon-button/index.ts +0 -132
- package/demo/md/index.html +0 -73
- package/demo/md/inputs/input.html +0 -73
- package/demo/md/inputs/input.ts +0 -278
- package/demo/md/inputs/radio.html +0 -39
- package/demo/md/inputs/radio.ts +0 -156
- package/demo/md/inputs/switch.html +0 -45
- package/demo/md/inputs/switch.ts +0 -144
- package/demo/md/list/list.html +0 -65
- package/demo/md/list/list.ts +0 -204
- package/demo/md/listbox/listbox.html +0 -31
- package/demo/md/listbox/listbox.ts +0 -27
- package/demo/md/menu/index.html +0 -19
- package/demo/md/menu/index.ts +0 -514
- package/demo/md/notification/snack.html +0 -21
- package/demo/md/notification/snack.ts +0 -70
- package/demo/md/progress/progress.html +0 -46
- package/demo/md/progress/progress.ts +0 -161
- package/demo/md/segmented-button/index.html +0 -21
- package/demo/md/segmented-button/index.ts +0 -55
- package/demo/md/select/index.html +0 -16
- package/demo/md/select/index.ts +0 -217
- package/demo/md/tabs/tabs.html +0 -40
- package/demo/md/tabs/tabs.ts +0 -214
- package/demo/oauth-popup.html +0 -36
- package/demo/page.css +0 -8
- package/demo/resources/calendar-month.png +0 -0
- package/demo/resources/favorite.png +0 -0
- package/demo/resources/fingerprint.png +0 -0
- package/demo/resources/home-work.png +0 -0
- package/demo/resources/mood.png +0 -0
- package/demo/resources/print.png +0 -0
- package/demo/resources/stars.png +0 -0
- package/demo/resources/theaters.png +0 -0
- package/demo/tsconfig.json +0 -4
- package/eslint.config.js +0 -97
- package/scripts/copy-assets.js +0 -21
- package/scripts/release.js +0 -66
- package/src/demo/DemoPage.ts +0 -169
- package/src/demo/DemoStyles.ts +0 -60
- package/test/README.md +0 -375
- package/test/contextual-menu/ContextMenu.test.ts +0 -760
- package/test/contextual-menu/ContextMenuElement.test.ts +0 -569
- package/test/core/activity.spec.ts +0 -413
- package/test/core/activity_manager.spec.ts +0 -544
- package/test/core/application.spec.ts +0 -218
- package/test/core/fragment.spec.ts +0 -565
- package/test/core/fragment_manager.spec.ts +0 -404
- package/test/core/live_data.spec.ts +0 -558
- package/test/core/renderer.spec.ts +0 -113
- package/test/dom-assertions.test.ts +0 -182
- package/test/elements/MonacoSetup.ts +0 -65
- package/test/elements/authorization/basic-method.test.ts +0 -177
- package/test/elements/authorization/bearer-method.test.ts +0 -143
- package/test/elements/authorization/ntlm-method.test.ts +0 -219
- package/test/elements/authorization/oauth2-client-credentials-method.test.ts +0 -334
- package/test/elements/authorization/oauth2-code-method.test.ts +0 -320
- package/test/elements/authorization/oauth2-custom-grant-method.test.ts +0 -255
- package/test/elements/authorization/oauth2-device-code-method.test.ts +0 -371
- package/test/elements/authorization/oauth2-implicit-method.test.ts +0 -407
- package/test/elements/authorization/oauth2-jwt-method.test.ts +0 -217
- package/test/elements/authorization/oauth2-password-method.test.ts +0 -275
- package/test/elements/authorization/openid-method.test.ts +0 -591
- package/test/elements/autocomplete/autocomplete-input.spec.ts +0 -646
- package/test/elements/code-editor/code-editor.accessibility.test.ts +0 -298
- package/test/elements/code-editor/code-editor.test.ts +0 -574
- package/test/elements/currency/CurrencyPicker.accessibility.test.ts +0 -328
- package/test/elements/currency/CurrencyPicker.core.test.ts +0 -318
- package/test/elements/currency/CurrencyPicker.integration.test.ts +0 -482
- package/test/elements/currency/CurrencyPicker.test.ts +0 -486
- package/test/elements/data-table/DataTable.browser.test.ts +0 -649
- package/test/elements/har/HarUtils.test.ts +0 -45
- package/test/elements/har/HarViewerElement.test.ts +0 -687
- package/test/elements/har/test-data/har1.har +0 -3044
- package/test/elements/highlight/MarkedHighlightElement.test.ts +0 -452
- package/test/elements/highlight/PrismHighlightElement.test.ts +0 -79
- package/test/elements/highlight/PrismHighlighter.test.ts +0 -94
- package/test/elements/highlight/remoteSanitization.md +0 -1
- package/test/elements/highlight/test.md +0 -3
- package/test/elements/highlight/test1.md +0 -3
- package/test/elements/highlight/test2.md +0 -1
- package/test/elements/http/BodyFormdataEditorElement.test.ts +0 -482
- package/test/elements/http/BodyMultipartEditorElement.test.ts +0 -658
- package/test/elements/http/BodyRawEditorElement.test.ts +0 -90
- package/test/elements/http/CertificateAdd.test.ts +0 -457
- package/test/elements/http/HttpAssertions.test.ts +0 -994
- package/test/elements/http/HttpFlows.test.ts +0 -502
- package/test/elements/http/UrlEncodeUtils.test.ts +0 -202
- package/test/elements/layout/SplitItem.test.ts +0 -440
- package/test/elements/layout/SplitLayoutManager.test.ts +0 -1501
- package/test/elements/layout/SplitPanel.test.ts +0 -1109
- package/test/elements/mention-textarea/MentionTextArea.basic.test.ts +0 -114
- package/test/elements/mention-textarea/MentionTextArea.test.ts +0 -613
- package/test/elements/navigation/Navigation.test.ts +0 -120
- package/test/env.ts +0 -15
- package/test/events/EventTypes.test.ts +0 -363
- package/test/events/EventsTestHelpers.ts +0 -16
- package/test/helpers/TestUtils.ts +0 -243
- package/test/helpers/UiMock.ts +0 -185
- package/test/lib/Dom.test.ts +0 -231
- package/test/md/button/UiButton.test.ts +0 -347
- package/test/md/button/UiIconButton.test.ts +0 -155
- package/test/md/chip/UiChip.test.ts +0 -219
- package/test/md/collapse/UiCollapse.test.ts +0 -250
- package/test/md/collapse/flex-layout.test.ts +0 -105
- package/test/md/date-time/DateTime.test.ts +0 -348
- package/test/md/dialog/UiConfirmDialog.test.ts +0 -131
- package/test/md/dialog/UiDialog.test.ts +0 -759
- package/test/md/menu/Menu.test.ts +0 -855
- package/test/md/menu/MenuIntegration.test.ts +0 -426
- package/test/md/menu/MenuItem.test.ts +0 -652
- package/test/md/menu/SubMenu.test.ts +0 -410
- package/test/md/progress/UiCircularProgressElement.test.ts +0 -481
- package/test/md/progress/UiProgressElement.test.ts +0 -117
- package/test/md/progress/UiRangeElement.test.ts +0 -156
- package/test/md/select/Select.test.ts +0 -925
- package/test/plugins/takeScreenshotPlugin.js +0 -35
- package/test/setup.test.ts +0 -217
- package/test/setup.ts +0 -117
- package/test/tsconfig.json +0 -7
- package/web-dev-server.config.js +0 -21
- package/web-test-runner.config.js +0 -90
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { CSSResult, html, TemplateResult } from 'lit'
|
|
2
|
-
import { ProjectMock } from '@api-client/core/mocking/ProjectMock.js'
|
|
3
|
-
import type { IApplication } from '@api-client/core/models/Application.js'
|
|
4
|
-
import { HttpProject, type IHttpProject } from '@api-client/core/models/HttpProject.js'
|
|
5
|
-
import type { IRequestUiMeta } from '@api-client/core/models/RequestUiMeta.js'
|
|
6
|
-
import { Environment } from '@api-client/core/models/Environment.js'
|
|
7
|
-
import JsonDiff from '@api-client/json/patch/diff.js'
|
|
8
|
-
import * as KeyVal from 'idb-keyval'
|
|
9
|
-
import { DemoPage } from '../../../src/demo/DemoPage.js'
|
|
10
|
-
import { reactive } from '../../../src/decorators/index.js'
|
|
11
|
-
import surfaceStyles from '../../../src/styles/m3/surface.module.js'
|
|
12
|
-
// import { WebHttpClientStoreBindings } from '../../../src/bindings/web/WebHttpClientStoreBindings.js'
|
|
13
|
-
import HttpProjectRequest from '../../../src/elements/project/HttpProjectRequest.js'
|
|
14
|
-
// import { WebProxyBindings } from '../../../src/bindings/web/WebProxyBindings.js'
|
|
15
|
-
// import env from '../../env.js'
|
|
16
|
-
import '../../../src/define/http-project/http-project-request.js'
|
|
17
|
-
import '../../../src/define/http-project/http-project-request-history.js'
|
|
18
|
-
import '../../../src/md/button/ui-button.js'
|
|
19
|
-
|
|
20
|
-
const PROJECT_STORE_KEY = 'demo.project-ui.http-editor.project-data'
|
|
21
|
-
const REQUEST_STORE_KEY = 'demo.project-ui.http-editor.request-data'
|
|
22
|
-
const UI_STORE_KEY = 'demo.project-ui.http-editor.request-ui'
|
|
23
|
-
|
|
24
|
-
// const workerUri = new URL('/src/http-client/store/IdbThread.ts', import.meta.url).toString()
|
|
25
|
-
const AppInfo: IApplication = { code: 'demo', name: 'Demo', version: '0' }
|
|
26
|
-
|
|
27
|
-
class ComponentDemoPage extends DemoPage {
|
|
28
|
-
static override get styles(): CSSResult[] {
|
|
29
|
-
return [...DemoPage.styles, surfaceStyles]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
override accessor componentName = 'HTTP project request editor'
|
|
33
|
-
|
|
34
|
-
mock = new ProjectMock()
|
|
35
|
-
|
|
36
|
-
@reactive() accessor project: HttpProject | undefined
|
|
37
|
-
|
|
38
|
-
@reactive() accessor requestKey: string | undefined
|
|
39
|
-
|
|
40
|
-
@reactive() accessor ui: IRequestUiMeta = {}
|
|
41
|
-
|
|
42
|
-
@reactive() accessor initialized: boolean
|
|
43
|
-
|
|
44
|
-
oauth2RedirectUri = 'https://auth.advancedrestclient.com/arc.html'
|
|
45
|
-
|
|
46
|
-
oauth2AuthorizationUri = `${window.location.protocol}//${window.location.host}${window.location.pathname}oauth-authorize.html`
|
|
47
|
-
|
|
48
|
-
// store = new WebHttpClientStoreBindings(AppInfo, workerUri)
|
|
49
|
-
|
|
50
|
-
// http = new WebProxyBindings(AppInfo, `${env.proxyUri}/open`)
|
|
51
|
-
|
|
52
|
-
constructor() {
|
|
53
|
-
super()
|
|
54
|
-
this.initialized = false
|
|
55
|
-
this.init()
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async init(): Promise<void> {
|
|
59
|
-
await this.restoreData()
|
|
60
|
-
// await this.store.initialize()
|
|
61
|
-
// await this.http.initialize()
|
|
62
|
-
await this.loadMonaco()
|
|
63
|
-
this.initialized = true
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async restoreData(): Promise<void> {
|
|
67
|
-
const data = await KeyVal.getMany([PROJECT_STORE_KEY, REQUEST_STORE_KEY, UI_STORE_KEY])
|
|
68
|
-
const [project, requestKey, ui] = data
|
|
69
|
-
this.setupProject(project, requestKey)
|
|
70
|
-
this.setupUi(ui)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
setupProject(project?: IHttpProject, requestKey?: string): void {
|
|
74
|
-
let instance: HttpProject
|
|
75
|
-
if (project) {
|
|
76
|
-
instance = new HttpProject(project)
|
|
77
|
-
} else {
|
|
78
|
-
instance = HttpProject.fromName('demo project')
|
|
79
|
-
}
|
|
80
|
-
this.project = instance
|
|
81
|
-
if (requestKey) {
|
|
82
|
-
const value = instance.findRequest(requestKey)
|
|
83
|
-
if (value) {
|
|
84
|
-
this.requestKey = requestKey
|
|
85
|
-
return
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const request = instance.addRequest('http://')
|
|
89
|
-
this.requestKey = request.key
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
setupUi(ui?: IRequestUiMeta): void {
|
|
93
|
-
if (ui) {
|
|
94
|
-
this.ui = ui
|
|
95
|
-
} else {
|
|
96
|
-
this.ui = {}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
async storeProject(): Promise<void> {
|
|
101
|
-
await KeyVal.setMany([
|
|
102
|
-
[PROJECT_STORE_KEY, this.project],
|
|
103
|
-
[REQUEST_STORE_KEY, this.requestKey],
|
|
104
|
-
])
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async storeUi(): Promise<void> {
|
|
108
|
-
await KeyVal.set(UI_STORE_KEY, this.ui)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
handleChange(): void {
|
|
112
|
-
console.log('change in the request')
|
|
113
|
-
this.storeProject()
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
handleUiChange(e: Event): void {
|
|
117
|
-
const editor = e.target as HttpProjectRequest
|
|
118
|
-
if (!editor.ui) {
|
|
119
|
-
return
|
|
120
|
-
}
|
|
121
|
-
this.ui = editor.ui
|
|
122
|
-
this.storeUi()
|
|
123
|
-
console.log('ui change', editor.ui)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
addEnvironment(): void {
|
|
127
|
-
const { project } = this
|
|
128
|
-
if (!project) {
|
|
129
|
-
return
|
|
130
|
-
}
|
|
131
|
-
const name = this.mock.lorem.words(2)
|
|
132
|
-
const localEnv = Environment.fromName(name)
|
|
133
|
-
localEnv.addVariable('port', '8000')
|
|
134
|
-
localEnv.addVariable('host', 'localhost')
|
|
135
|
-
localEnv.addServer('http://{host}:{port}/')
|
|
136
|
-
|
|
137
|
-
const snapshot = project.toJSON()
|
|
138
|
-
project.addEnvironment(localEnv)
|
|
139
|
-
const compare = project.toJSON()
|
|
140
|
-
const patches = JsonDiff(snapshot, compare)
|
|
141
|
-
const editor = document.querySelector('http-project-request')
|
|
142
|
-
if (editor) {
|
|
143
|
-
patches.forEach((patch) => editor.applyPatch(patch))
|
|
144
|
-
}
|
|
145
|
-
this.storeProject()
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
clearEnvironments(): void {
|
|
149
|
-
const { project } = this
|
|
150
|
-
if (!project) {
|
|
151
|
-
return
|
|
152
|
-
}
|
|
153
|
-
const snapshot = project.toJSON()
|
|
154
|
-
const all = project.listEnvironments()
|
|
155
|
-
all.forEach((localEnv) => project.removeEnvironment(localEnv.key))
|
|
156
|
-
const compare = project.toJSON()
|
|
157
|
-
const patches = JsonDiff(snapshot, compare)
|
|
158
|
-
const editor = document.querySelector('http-project-request')
|
|
159
|
-
if (editor) {
|
|
160
|
-
patches.forEach((patch) => editor.applyPatch(patch))
|
|
161
|
-
}
|
|
162
|
-
this.storeProject()
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
clearAll(): void {
|
|
166
|
-
const instance = HttpProject.fromName('demo project')
|
|
167
|
-
this.project = instance
|
|
168
|
-
const request = instance.addRequest('http://')
|
|
169
|
-
this.requestKey = request.key
|
|
170
|
-
this.ui = {}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
contentTemplate(): TemplateResult {
|
|
174
|
-
if (!this.initialized) {
|
|
175
|
-
return this.renderLoader()
|
|
176
|
-
}
|
|
177
|
-
return html`
|
|
178
|
-
<a href="./">Back</a>
|
|
179
|
-
${this.renderDataControl()} ${this.renderComponent()}
|
|
180
|
-
`
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
renderLoader(): TemplateResult {
|
|
184
|
-
return html`
|
|
185
|
-
<a href="./">Back</a>
|
|
186
|
-
<div class="screen-loader">
|
|
187
|
-
<p>Loading demo page</p>
|
|
188
|
-
<progress></progress>
|
|
189
|
-
</div>
|
|
190
|
-
`
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
renderDataControl(): TemplateResult {
|
|
194
|
-
return html`
|
|
195
|
-
<section class="demo-section">
|
|
196
|
-
<h2 class="title-large">Data control</h2>
|
|
197
|
-
<ui-button color="outlined" @click="${this.addEnvironment}">Add environment</ui-button>
|
|
198
|
-
<ui-button color="outlined" @click="${this.clearEnvironments}">Remove all environments</ui-button>
|
|
199
|
-
<ui-button color="outlined" @click="${this.clearAll}">Clear all data</ui-button>
|
|
200
|
-
</section>
|
|
201
|
-
`
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
renderComponent(): TemplateResult {
|
|
205
|
-
return html`
|
|
206
|
-
<section class="demo-section">
|
|
207
|
-
<h2 class="title-large">HTTP request editor</h2>
|
|
208
|
-
<div class="editor-wrapper surface1">
|
|
209
|
-
<http-project-request
|
|
210
|
-
.project="${this.project}"
|
|
211
|
-
.key="${this.requestKey}"
|
|
212
|
-
.ui="${this.ui}"
|
|
213
|
-
.oauth2RedirectUri="${this.oauth2RedirectUri}"
|
|
214
|
-
.oauth2AuthorizationUri="${this.oauth2AuthorizationUri}"
|
|
215
|
-
.appInfo="${AppInfo}"
|
|
216
|
-
@change="${this.handleChange}"
|
|
217
|
-
@uichange="${this.handleUiChange}"
|
|
218
|
-
></http-project-request>
|
|
219
|
-
</div>
|
|
220
|
-
<div class="editor-wrapper surface1">
|
|
221
|
-
<http-project-request-history
|
|
222
|
-
.project="${this.project && this.project.key}"
|
|
223
|
-
.request="${this.requestKey}"
|
|
224
|
-
></http-project-request-history>
|
|
225
|
-
</div>
|
|
226
|
-
</section>
|
|
227
|
-
`
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const instance = new ComponentDemoPage()
|
|
232
|
-
instance.render()
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
|
|
7
|
-
<title>User Avatar</title>
|
|
8
|
-
<link href="../../../src/styles/m3/tokens.css" rel="stylesheet" type="text/css" />
|
|
9
|
-
<link href="../../../src/styles/m3/theme.css" rel="stylesheet" type="text/css" />
|
|
10
|
-
</head>
|
|
11
|
-
|
|
12
|
-
<body class="demo">
|
|
13
|
-
<div id="app"></div>
|
|
14
|
-
<script type="module" src="/.tmp/demo/elements/user/user-avatar.js"></script>
|
|
15
|
-
</body>
|
|
16
|
-
|
|
17
|
-
</html>
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { IUser } from '@api-client/core/models/store/User.js'
|
|
2
|
-
import { DemoPage } from '../../../src/demo/DemoPage.js'
|
|
3
|
-
import { reactive } from '../../../src/decorators/index.js'
|
|
4
|
-
import { UserKind } from '@api-client/core/models/kinds.js'
|
|
5
|
-
import { html, TemplateResult } from 'lit'
|
|
6
|
-
import '../../../src/elements/user/ui-user-avatar.js'
|
|
7
|
-
|
|
8
|
-
class ComponentDemoPage extends DemoPage {
|
|
9
|
-
@reactive() accessor user1: IUser
|
|
10
|
-
@reactive() accessor user2: IUser
|
|
11
|
-
|
|
12
|
-
constructor() {
|
|
13
|
-
super()
|
|
14
|
-
this.componentName = 'User Avatar'
|
|
15
|
-
this.user1 = {
|
|
16
|
-
key: '1',
|
|
17
|
-
name: 'John Doe',
|
|
18
|
-
email: [{ email: 'john.doe @example.com', verified: true }],
|
|
19
|
-
picture: {
|
|
20
|
-
url: 'https://i.pravatar.cc/300',
|
|
21
|
-
},
|
|
22
|
-
kind: UserKind,
|
|
23
|
-
status: 'active',
|
|
24
|
-
grantType: 'editor',
|
|
25
|
-
created: new Date('2023-01-01T00:00:00Z').getTime(),
|
|
26
|
-
updated: new Date('2023-01-02T00:00:00Z').getTime(),
|
|
27
|
-
}
|
|
28
|
-
this.user2 = {
|
|
29
|
-
key: '2',
|
|
30
|
-
name: 'John Doe',
|
|
31
|
-
email: [{ email: 'john.doe @example.com', verified: true }],
|
|
32
|
-
kind: UserKind,
|
|
33
|
-
status: 'active',
|
|
34
|
-
grantType: 'editor',
|
|
35
|
-
created: new Date('2023-01-01T00:00:00Z').getTime(),
|
|
36
|
-
updated: new Date('2023-01-02T00:00:00Z').getTime(),
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
contentTemplate(): TemplateResult {
|
|
41
|
-
return html`
|
|
42
|
-
<a href="../">Back</a>
|
|
43
|
-
<section class="centered">
|
|
44
|
-
<h3>Full data</h3>
|
|
45
|
-
<ui-user-avatar .user="${this.user1}"></ui-user-avatar>
|
|
46
|
-
<h3>No image</h3>
|
|
47
|
-
<ui-user-avatar .user="${this.user2}"></ui-user-avatar>
|
|
48
|
-
<h3>No user</h3>
|
|
49
|
-
<ui-user-avatar></ui-user-avatar>
|
|
50
|
-
<h3>Custom size</h3>
|
|
51
|
-
<ui-user-avatar style="width: 128px; height: 128px" .user="${this.user1}"></ui-user-avatar>
|
|
52
|
-
<h3>Icon type</h3>
|
|
53
|
-
<ui-user-avatar .user="${this.user1}" type="icon"></ui-user-avatar>
|
|
54
|
-
</section>
|
|
55
|
-
`
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const instance = new ComponentDemoPage()
|
|
60
|
-
instance.render()
|
package/demo/env.js
DELETED
package/demo/index.html
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en-GB">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>API Client UI</title>
|
|
6
|
-
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0">
|
|
7
|
-
<link
|
|
8
|
-
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
|
|
9
|
-
rel="stylesheet"
|
|
10
|
-
/>
|
|
11
|
-
<link href="../src/styles/m3/tokens.css" rel="stylesheet" type="text/css" />
|
|
12
|
-
<link href="../src/styles/m3/theme.css" rel="stylesheet" type="text/css" />
|
|
13
|
-
<link href="./page.css" rel="stylesheet" type="text/css" />
|
|
14
|
-
</head>
|
|
15
|
-
<body>
|
|
16
|
-
<main>
|
|
17
|
-
<h1>The UI library for the API Client ecosystem applications</h1>
|
|
18
|
-
<nav>
|
|
19
|
-
<h2>Contents</h2>
|
|
20
|
-
|
|
21
|
-
<dl>
|
|
22
|
-
<dt><a href="/demo/elements/index.html">API Elements</a></dt>
|
|
23
|
-
<dd>The web components library.</dd>
|
|
24
|
-
|
|
25
|
-
<dt><a href="/demo/md/index.html">Material Elements</a></dt>
|
|
26
|
-
<dd>The material web components library.</dd>
|
|
27
|
-
|
|
28
|
-
<dt><a href="/demo/layout/index.html">Split layout</a></dt>
|
|
29
|
-
<dd>The Split layout library.</dd>
|
|
30
|
-
</dl>
|
|
31
|
-
</nav>
|
|
32
|
-
</main>
|
|
33
|
-
</body>
|
|
34
|
-
</html>
|
package/demo/layout/index.html
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0">
|
|
6
|
-
<!-- <meta http-equiv="Content-Security-Policy" content="default-src file: 'self' 'unsafe-inline'; script-src blob: web-module: 'self' 'unsafe-inline' https://apis.google.com; style-src 'self' themes: 'unsafe-inline' https://fonts.googleapis.com; font-src web-module: themes: 'self' https://fonts.gstatic.com; connect-src 'self' https: ws: wss: https://www.google-analytics.com https://app.advancedrestclient.com https://anypoint.mulesoft.com; img-src 'self' blob: data: https://exchange2-asset-manager-kprod.s3.amazonaws.com"> -->
|
|
7
|
-
<title>Split layout</title>
|
|
8
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
|
-
<link
|
|
11
|
-
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
|
|
12
|
-
rel="stylesheet"
|
|
13
|
-
/>
|
|
14
|
-
<link href="../../src/styles/m3/tokens.css" rel="stylesheet" type="text/css" />
|
|
15
|
-
<link href="../../src/styles/m3/theme.css" rel="stylesheet" type="text/css" />
|
|
16
|
-
<link href="../page.css" rel="stylesheet" type="text/css" />
|
|
17
|
-
<style>
|
|
18
|
-
.demo #app {
|
|
19
|
-
height: 100vh;
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
main {
|
|
26
|
-
flex: 1;
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.demo-container {
|
|
32
|
-
display: flex;
|
|
33
|
-
flex: 1;
|
|
34
|
-
overflow: hidden;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.data-control {
|
|
38
|
-
width: 33.333%;
|
|
39
|
-
padding-right: 20px;
|
|
40
|
-
box-sizing: border-box;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.layout-view {
|
|
44
|
-
width: 66.666%;
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-direction: column;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
split-view {
|
|
50
|
-
flex: 1;
|
|
51
|
-
overflow: hidden;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.empty-layout {
|
|
55
|
-
border-radius: 12px;
|
|
56
|
-
padding: 12px;
|
|
57
|
-
display: flex;
|
|
58
|
-
align-items: center;
|
|
59
|
-
justify-content: center;
|
|
60
|
-
flex: 1;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.draggable-items {
|
|
64
|
-
margin: 0;
|
|
65
|
-
padding: 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.draggable-items li {
|
|
69
|
-
display: flex;
|
|
70
|
-
align-items: center;
|
|
71
|
-
height: 56px;
|
|
72
|
-
border-radius: 12px;
|
|
73
|
-
background-color: var(--md-sys-color-primary-05a);
|
|
74
|
-
color: var(--md-sys-color-on-background);
|
|
75
|
-
border: 1px var(--md-sys-color-outline) solid;
|
|
76
|
-
margin: 8px 0;
|
|
77
|
-
box-sizing: border-box;
|
|
78
|
-
padding: 0 16px;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.draggable-items li:hover {
|
|
82
|
-
background-color: var(--md-sys-color-primary-08a);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.draggable-items li.dragged {
|
|
86
|
-
background-color: var(--md-sys-color-primary-13a);
|
|
87
|
-
}
|
|
88
|
-
</style>
|
|
89
|
-
</head>
|
|
90
|
-
<body>
|
|
91
|
-
<div id="app"></div>
|
|
92
|
-
<script type="module" src="/.tmp/demo/layout/index.js"></script>
|
|
93
|
-
</body>
|
|
94
|
-
</html>
|
package/demo/layout/index.ts
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { html, TemplateResult } from 'lit'
|
|
2
|
-
import { nanoid } from 'nanoid'
|
|
3
|
-
import { DemoPage } from '../../src/demo/DemoPage.js'
|
|
4
|
-
import { reactive } from '../../src/decorators/index.js'
|
|
5
|
-
import { ISplitLayout, SplitLayout } from '../../src/elements/layout/SplitLayout.js'
|
|
6
|
-
import { SplitItem } from '../../src/elements/layout/SplitItem.js'
|
|
7
|
-
import '../../src/md/button/ui-button.js'
|
|
8
|
-
import { SplitCloseDirection } from '../../src/elements/layout/type.js'
|
|
9
|
-
|
|
10
|
-
const storeKey = 'api-client.demo.layout.state'
|
|
11
|
-
|
|
12
|
-
class ComponentDemoPage extends DemoPage {
|
|
13
|
-
override accessor componentName = 'Split layout'
|
|
14
|
-
|
|
15
|
-
@reactive() accessor initialized = false
|
|
16
|
-
|
|
17
|
-
protected layout = new SplitLayout({
|
|
18
|
-
dragTypes: ['text/kind', 'text/key'],
|
|
19
|
-
constrain: true,
|
|
20
|
-
stateCallback: this.handlerLayoutStore.bind(this),
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
constructor() {
|
|
24
|
-
super()
|
|
25
|
-
this.initialize()
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async initialize(): Promise<void> {
|
|
29
|
-
this.layout.addEventListener('change', this.renderHandler.bind(this))
|
|
30
|
-
this.layout.addEventListener('nameitem', this.nameLayoutItemHandler.bind(this))
|
|
31
|
-
const state = this.restoreValues()
|
|
32
|
-
this.layout.initialize(state)
|
|
33
|
-
this.initialized = true
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
restoreValues(): ISplitLayout | undefined {
|
|
37
|
-
const data = localStorage.getItem(storeKey)
|
|
38
|
-
if (!data) {
|
|
39
|
-
return undefined
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
return JSON.parse(data) as ISplitLayout
|
|
43
|
-
} catch {
|
|
44
|
-
// ...
|
|
45
|
-
}
|
|
46
|
-
return undefined
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
protected async handlerLayoutStore(state: ISplitLayout): Promise<void> {
|
|
50
|
-
console.log('State change', state)
|
|
51
|
-
try {
|
|
52
|
-
localStorage.setItem(storeKey, JSON.stringify(state))
|
|
53
|
-
} catch {
|
|
54
|
-
// ...
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
protected renderHandler(): void {
|
|
59
|
-
this.render()
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
protected nameLayoutItemHandler(event: Event): void {
|
|
63
|
-
const item = (event as CustomEvent).detail as SplitItem
|
|
64
|
-
if (item.kind === 'data#itemA') {
|
|
65
|
-
item.label = 'Item A'
|
|
66
|
-
} else if (item.kind === 'data#itemB') {
|
|
67
|
-
item.label = 'Item B'
|
|
68
|
-
}
|
|
69
|
-
console.log('nameLayoutItemHandler', item)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
protected handleDragStart(e: DragEvent): void {
|
|
73
|
-
const item = e.currentTarget as HTMLElement
|
|
74
|
-
const { key, kind } = item.dataset
|
|
75
|
-
if (!key || !kind) {
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
const dt = e.dataTransfer
|
|
79
|
-
if (!dt) {
|
|
80
|
-
return
|
|
81
|
-
}
|
|
82
|
-
dt.effectAllowed = 'copyLink'
|
|
83
|
-
dt.setData('text/kind', kind)
|
|
84
|
-
dt.setData('text/key', key)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
protected handleAddItem(): void {
|
|
88
|
-
const key = nanoid()
|
|
89
|
-
const kind = 'data#item'
|
|
90
|
-
this.layout.addItem({ key, kind, label: 'Added item' })
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
protected handleReset(): void {
|
|
94
|
-
this.layout.items = []
|
|
95
|
-
this.layout.definitions = new Map()
|
|
96
|
-
this.layout.scheduleStore()
|
|
97
|
-
this.render()
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
protected handleClose2Left(): void {
|
|
101
|
-
const { layout } = this
|
|
102
|
-
const panel = layout.activePanel
|
|
103
|
-
if (!panel) {
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
if (!panel.selected) {
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
panel.removeRelative(panel.selected, SplitCloseDirection.left)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
protected handleClose2Right(): void {
|
|
113
|
-
const { layout } = this
|
|
114
|
-
const panel = layout.activePanel
|
|
115
|
-
if (!panel) {
|
|
116
|
-
return
|
|
117
|
-
}
|
|
118
|
-
if (!panel.selected) {
|
|
119
|
-
return
|
|
120
|
-
}
|
|
121
|
-
panel.removeRelative(panel.selected, SplitCloseDirection.right)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
contentTemplate(): TemplateResult {
|
|
125
|
-
if (!this.initialized) {
|
|
126
|
-
return html`<p>Loading demo page.</p>`
|
|
127
|
-
}
|
|
128
|
-
return html`
|
|
129
|
-
<a href="../">Back</a>
|
|
130
|
-
<div class="demo-container">
|
|
131
|
-
${this.renderOptions()}
|
|
132
|
-
<section aria-label="demo-content" class="layout-view">${this.renderLayout()}</section>
|
|
133
|
-
</div>
|
|
134
|
-
`
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
protected renderLayout(): TemplateResult[] {
|
|
138
|
-
const { layout } = this
|
|
139
|
-
if (layout.isEmpty()) {
|
|
140
|
-
return [this.renderEmptyLayout()]
|
|
141
|
-
}
|
|
142
|
-
return layout.render(this.renderItem.bind(this))
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
protected renderEmptyLayout(): TemplateResult {
|
|
146
|
-
return html`
|
|
147
|
-
<div class="empty-layout surface1">
|
|
148
|
-
<p class="body-large">The layout is empty.</p>
|
|
149
|
-
</div>
|
|
150
|
-
`
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
protected renderItem(item: SplitItem, visible: boolean): TemplateResult {
|
|
154
|
-
switch (item.kind) {
|
|
155
|
-
default:
|
|
156
|
-
return html`<p ?hidden="${!visible}" data-key="${item.key}">
|
|
157
|
-
Rendering: ${item.label} ${item.kind} ${item.key}
|
|
158
|
-
</p>`
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
protected renderOptions(): TemplateResult {
|
|
163
|
-
return html`
|
|
164
|
-
<section aria-label="Demo control" class="data-control">
|
|
165
|
-
<h2 class="title-medium">Data control</h2>
|
|
166
|
-
<h3 class="title-small">Imperative API</h3>
|
|
167
|
-
<ui-button color="outlined" @click="${this.handleAddItem}">Add item to current</ui-button>
|
|
168
|
-
<ui-button color="outlined" @click="${this.handleReset}">Reset</ui-button>
|
|
169
|
-
<ui-button color="outlined" @click="${this.handleClose2Left}">Close to left (selected)</ui-button>
|
|
170
|
-
<ui-button color="outlined" @click="${this.handleClose2Right}">Close to right (selected)</ui-button>
|
|
171
|
-
|
|
172
|
-
<h3 class="title-small">Declarative API</h3>
|
|
173
|
-
<p>Items on the list can be dragged onto the layout.</p>
|
|
174
|
-
<nav aria-label="drag and drop items">
|
|
175
|
-
<ul class="draggable-items">
|
|
176
|
-
<li data-kind="data#itemA" data-key="item-a" draggable="true" @dragstart="${this.handleDragStart}">
|
|
177
|
-
Item A
|
|
178
|
-
</li>
|
|
179
|
-
<li data-kind="data#itemB" data-key="item-b" draggable="true" @dragstart="${this.handleDragStart}">
|
|
180
|
-
Item B
|
|
181
|
-
</li>
|
|
182
|
-
</ul>
|
|
183
|
-
</nav>
|
|
184
|
-
</section>
|
|
185
|
-
`
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const instance = new ComponentDemoPage()
|
|
190
|
-
instance.render()
|
package/demo/md/DemoStyles.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit'
|
|
2
|
-
|
|
3
|
-
export default css`
|
|
4
|
-
:root {
|
|
5
|
-
--dot-size: 1px;
|
|
6
|
-
--dot-space: 7px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
html,
|
|
10
|
-
body {
|
|
11
|
-
margin: 0;
|
|
12
|
-
font-family: 'Roboto', 'Noto', sans-serif;
|
|
13
|
-
background-color: var(--md-sys-color-surface);
|
|
14
|
-
color: var(--md-sys-color-on-surface);
|
|
15
|
-
background-image: radial-gradient(var(--md-sys-color-inverse-on-surface) 1px, transparent 0);
|
|
16
|
-
background-size: var(--dot-space) var(--dot-space);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.demo {
|
|
20
|
-
margin: 0;
|
|
21
|
-
padding: 0;
|
|
22
|
-
min-height: 100vh;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
header {
|
|
26
|
-
padding: 12px 24px;
|
|
27
|
-
background-color: var(--md-sys-color-surface-variant);
|
|
28
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
29
|
-
display: flex;
|
|
30
|
-
align-items: center;
|
|
31
|
-
|
|
32
|
-
max-width: 900px;
|
|
33
|
-
margin: 20px auto;
|
|
34
|
-
padding: 0 24px;
|
|
35
|
-
border-radius: 40px;
|
|
36
|
-
|
|
37
|
-
font-family: var(--md-sys-typescale-title-large-font);
|
|
38
|
-
font-weight: var(--md-sys-typescale-title-large-weight);
|
|
39
|
-
font-size: var(--md-sys-typescale-title-large-size);
|
|
40
|
-
letter-spacing: var(--md-sys-typescale-title-large-tracking);
|
|
41
|
-
line-height: var(--md-sys-typescale-title-large-height);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
#app {
|
|
45
|
-
height: 100%;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
main {
|
|
49
|
-
max-width: 900px;
|
|
50
|
-
margin: 40px auto;
|
|
51
|
-
border-radius: 40px;
|
|
52
|
-
padding: 24px;
|
|
53
|
-
|
|
54
|
-
/* background-color: var(--md-sys-color-primary-container);
|
|
55
|
-
color: var(--md-sys-color-on-primary-container); */
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.demo-section {
|
|
59
|
-
margin: 60px 0;
|
|
60
|
-
}
|
|
61
|
-
`
|