@api-client/ui 0.5.38 → 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/src/md/list/internals/ListItem.d.ts +24 -15
- package/build/src/md/list/internals/ListItem.d.ts.map +1 -1
- package/build/src/md/list/internals/ListItem.js +85 -59
- package/build/src/md/list/internals/ListItem.js.map +1 -1
- package/build/src/md/list/internals/ListItem.styles.js +11 -11
- package/build/src/md/list/internals/ListItem.styles.js.map +1 -1
- package/build/src/md/select/internals/Option.d.ts +4 -14
- package/build/src/md/select/internals/Option.d.ts.map +1 -1
- package/build/src/md/select/internals/Option.js +13 -28
- package/build/src/md/select/internals/Option.js.map +1 -1
- package/build/src/md/select/internals/Select.d.ts +1 -1
- package/build/src/md/select/internals/Select.d.ts.map +1 -1
- package/build/src/md/select/internals/Select.js +15 -5
- package/build/src/md/select/internals/Select.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +1 -1
- package/src/md/list/internals/ListItem.styles.ts +11 -11
- package/src/md/list/internals/ListItem.ts +68 -43
- package/src/md/select/internals/Option.ts +14 -26
- package/src/md/select/internals/Select.ts +15 -5
- 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 -207
- 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
package/demo/md/tabs/tabs.ts
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { html, svg, TemplateResult } from 'lit'
|
|
2
|
-
import { DemoPage } from '../../../src/demo/DemoPage.js'
|
|
3
|
-
import '../../../src/md/tabs/ui-tab.js'
|
|
4
|
-
import '../../../src/md/tabs/ui-tabs.js'
|
|
5
|
-
import '../../../src/md/icons/ui-icon.js'
|
|
6
|
-
import { iconWrapper } from '../../../src/md/icons/Icons.js'
|
|
7
|
-
import { reactive } from '../../../src/decorators/index.js'
|
|
8
|
-
import { TabSelectionDetail } from '../../../src/md/tabs/internals/Tabs.js'
|
|
9
|
-
|
|
10
|
-
const travelIcon = iconWrapper(
|
|
11
|
-
svg`<path d="M8.5 22v-1.5l2-1.5v-5.5L2 16v-2l8.5-5V3.5q0-.625.438-1.062Q11.375 2 12 2t1.062.438q.438.437.438 1.062V9l8.5 5v2l-8.5-2.5V19l2 1.5V22L12 21Z"/>`
|
|
12
|
-
)
|
|
13
|
-
const hotelIcon = iconWrapper(
|
|
14
|
-
svg`<path d="M1 19V4h2v10h8V6h8q1.65 0 2.825 1.175Q23 8.35 23 10v9h-2v-3H3v3Zm6-6q-1.25 0-2.125-.875T4 10q0-1.25.875-2.125T7 7q1.25 0 2.125.875T10 10q0 1.25-.875 2.125T7 13Zm6 1h8v-4q0-.825-.587-1.413Q19.825 8 19 8h-6Zm-6-3q.425 0 .713-.288Q8 10.425 8 10t-.287-.713Q7.425 9 7 9t-.713.287Q6 9.575 6 10t.287.712Q6.575 11 7 11Zm0-1Zm6-2v6Z"/>`
|
|
15
|
-
)
|
|
16
|
-
const cityIcon = iconWrapper(
|
|
17
|
-
svg`<path d="M3 21V7h6V5l3-3 3 3v6h6v10Zm2-2h2v-2H5Zm0-4h2v-2H5Zm0-4h2V9H5Zm6 8h2v-2h-2Zm0-4h2v-2h-2Zm0-4h2V9h-2Zm0-4h2V5h-2Zm6 12h2v-2h-2Zm0-4h2v-2h-2Z"/>`
|
|
18
|
-
)
|
|
19
|
-
const taxiIcon = iconWrapper(
|
|
20
|
-
svg`<path d="M6 19v1q0 .425-.287.712Q5.425 21 5 21H4q-.425 0-.712-.288Q3 20.425 3 20v-8l2.1-6q.15-.45.538-.725Q6.025 5 6.5 5H9V3h6v2h2.5q.475 0 .863.275.387.275.537.725l2.1 6v8q0 .425-.288.712Q20.425 21 20 21h-1q-.425 0-.712-.288Q18 20.425 18 20v-1Zm-.2-9h12.4l-1.05-3H6.85ZM5 12v5Zm2.5 4q.625 0 1.062-.438Q9 15.125 9 14.5t-.438-1.062Q8.125 13 7.5 13t-1.062.438Q6 13.875 6 14.5t.438 1.062Q6.875 16 7.5 16Zm9 0q.625 0 1.062-.438Q18 15.125 18 14.5t-.438-1.062Q17.125 13 16.5 13t-1.062.438Q15 13.875 15 14.5t.438 1.062Q15.875 16 16.5 16ZM5 17h14v-5H5Z"/>`
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
class ComponentDemoPage extends DemoPage {
|
|
24
|
-
override accessor componentName = 'UI tabs'
|
|
25
|
-
|
|
26
|
-
@reactive() accessor selected1 = 'travel1'
|
|
27
|
-
|
|
28
|
-
@reactive() accessor selected2 = 'hotel2'
|
|
29
|
-
|
|
30
|
-
@reactive() accessor selected3 = 'travelHotel3'
|
|
31
|
-
|
|
32
|
-
@reactive() accessor selected4 = 'cars4'
|
|
33
|
-
|
|
34
|
-
@reactive() accessor selected5 = 'travel5'
|
|
35
|
-
|
|
36
|
-
handleTabsChange(e: CustomEvent): void {
|
|
37
|
-
const info = e.detail as TabSelectionDetail
|
|
38
|
-
console.log(info)
|
|
39
|
-
const property = (e.target as HTMLElement).dataset.property as 'selected1' | undefined
|
|
40
|
-
if (!property) {
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
this[property] = info.item.getAttribute('aria-controls') || ''
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
contentTemplate(): TemplateResult {
|
|
47
|
-
return html`
|
|
48
|
-
<a href="../">Back</a>
|
|
49
|
-
${this.renderPrimaryDemo()} ${this.renderSecondaryTabs()} ${this.renderIconTabs()} ${this.renderScrollableDemo()}
|
|
50
|
-
`
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
renderPrimaryDemo(): TemplateResult {
|
|
54
|
-
const { selected1 } = this
|
|
55
|
-
return html`
|
|
56
|
-
<section class="demo-section">
|
|
57
|
-
<h2 class="display-large">Primary tabs</h2>
|
|
58
|
-
|
|
59
|
-
<div class="frame">
|
|
60
|
-
<ui-tabs data-property="selected1" @change="${this.handleTabsChange}">
|
|
61
|
-
<ui-tab aria-controls="travel1">Travel</ui-tab>
|
|
62
|
-
<ui-tab aria-controls="hotel1">Hotel</ui-tab>
|
|
63
|
-
<ui-tab aria-controls="travelHotel1">Travel + Hotel</ui-tab>
|
|
64
|
-
<ui-tab aria-controls="cars1">Cars</ui-tab>
|
|
65
|
-
</ui-tabs>
|
|
66
|
-
|
|
67
|
-
<div class="page">
|
|
68
|
-
<p id="travel1" ?hidden="${selected1 !== 'travel1'}">Travel page</p>
|
|
69
|
-
<p id="hotel1" ?hidden="${selected1 !== 'hotel1'}">Hotel page</p>
|
|
70
|
-
<p id="travelHotel1" ?hidden="${selected1 !== 'travelHotel1'}">Hotel & travel page</p>
|
|
71
|
-
<p id="cars1" ?hidden="${selected1 !== 'cars1'}">Cars page</p>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</section>
|
|
75
|
-
`
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
renderSecondaryTabs(): TemplateResult {
|
|
79
|
-
const { selected2 } = this
|
|
80
|
-
return html`
|
|
81
|
-
<section class="demo-section">
|
|
82
|
-
<h2 class="display-large">Secondary tabs</h2>
|
|
83
|
-
|
|
84
|
-
<div class="frame">
|
|
85
|
-
<ui-tabs priority="secondary" data-property="selected2" @change="${this.handleTabsChange}">
|
|
86
|
-
<ui-tab aria-controls="travel2">Travel</ui-tab>
|
|
87
|
-
<ui-tab aria-controls="hotel2" selected>Hotel</ui-tab>
|
|
88
|
-
<ui-tab aria-controls="travelHotel2">Travel + Hotel</ui-tab>
|
|
89
|
-
<ui-tab aria-controls="cars2">Cars</ui-tab>
|
|
90
|
-
</ui-tabs>
|
|
91
|
-
|
|
92
|
-
<div class="page">
|
|
93
|
-
<p id="travel2" ?hidden="${selected2 !== 'travel2'}">Travel page</p>
|
|
94
|
-
<p id="hotel2" ?hidden="${selected2 !== 'hotel2'}">Hotel page</p>
|
|
95
|
-
<p id="travelHotel2" ?hidden="${selected2 !== 'travelHotel2'}">Hotel & travel page</p>
|
|
96
|
-
<p id="cars2" ?hidden="${selected2 !== 'cars2'}">Cars page</p>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</section>
|
|
100
|
-
`
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
renderIconTabs(): TemplateResult {
|
|
104
|
-
const { selected3, selected4 } = this
|
|
105
|
-
return html`
|
|
106
|
-
<section class="demo-section">
|
|
107
|
-
<h2 class="display-large">Primary icon tabs</h2>
|
|
108
|
-
<div class="frame">
|
|
109
|
-
<ui-tabs data-property="selected3" @change="${this.handleTabsChange}">
|
|
110
|
-
<ui-tab aria-controls="travel3">
|
|
111
|
-
<ui-icon slot="icon">${travelIcon}</ui-icon>
|
|
112
|
-
Travel
|
|
113
|
-
</ui-tab>
|
|
114
|
-
<ui-tab aria-controls="hotel3">
|
|
115
|
-
<ui-icon slot="icon">${hotelIcon}</ui-icon>
|
|
116
|
-
Hotel
|
|
117
|
-
</ui-tab>
|
|
118
|
-
<ui-tab aria-controls="travelHotel3" selected>
|
|
119
|
-
<ui-icon slot="icon">${cityIcon}</ui-icon>
|
|
120
|
-
Travel + Hotel
|
|
121
|
-
</ui-tab>
|
|
122
|
-
<ui-tab aria-controls="cars3">
|
|
123
|
-
<ui-icon slot="icon">${taxiIcon}</ui-icon>
|
|
124
|
-
Cars
|
|
125
|
-
</ui-tab>
|
|
126
|
-
</ui-tabs>
|
|
127
|
-
<div class="page">
|
|
128
|
-
<p id="travel3" ?hidden="${selected3 !== 'travel3'}">Travel page</p>
|
|
129
|
-
<p id="hotel3" ?hidden="${selected3 !== 'hotel3'}">Hotel page</p>
|
|
130
|
-
<p id="travelHotel3" ?hidden="${selected3 !== 'travelHotel3'}">Hotel & travel page</p>
|
|
131
|
-
<p id="cars3" ?hidden="${selected3 !== 'cars3'}">Cars page</p>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
</section>
|
|
135
|
-
<section class="demo-section">
|
|
136
|
-
<h2 class="display-large">Secondary icon tabs</h2>
|
|
137
|
-
|
|
138
|
-
<div class="frame">
|
|
139
|
-
<ui-tabs priority="secondary" data-property="selected4" @change="${this.handleTabsChange}">
|
|
140
|
-
<ui-tab aria-controls="travel4">
|
|
141
|
-
<ui-icon slot="icon">${travelIcon}</ui-icon>
|
|
142
|
-
Travel
|
|
143
|
-
</ui-tab>
|
|
144
|
-
<ui-tab aria-controls="hotel4">
|
|
145
|
-
<ui-icon slot="icon">${hotelIcon}</ui-icon>
|
|
146
|
-
Hotel
|
|
147
|
-
</ui-tab>
|
|
148
|
-
<ui-tab aria-controls="travelHotel4">
|
|
149
|
-
<ui-icon slot="icon">${cityIcon}</ui-icon>
|
|
150
|
-
Travel + Hotel
|
|
151
|
-
</ui-tab>
|
|
152
|
-
<ui-tab aria-controls="cars4" selected>
|
|
153
|
-
<ui-icon slot="icon">${taxiIcon}</ui-icon>
|
|
154
|
-
Cars
|
|
155
|
-
</ui-tab>
|
|
156
|
-
</ui-tabs>
|
|
157
|
-
<div class="page">
|
|
158
|
-
<p id="travel4" ?hidden="${selected4 !== 'travel4'}">Travel page</p>
|
|
159
|
-
<p id="hotel4" ?hidden="${selected4 !== 'hotel4'}">Hotel page</p>
|
|
160
|
-
<p id="travelHotel4" ?hidden="${selected4 !== 'travelHotel4'}">Hotel & travel page</p>
|
|
161
|
-
<p id="cars4" ?hidden="${selected4 !== 'cars4'}">Cars page</p>
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
</section>
|
|
165
|
-
`
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
renderScrollableDemo(): TemplateResult {
|
|
169
|
-
const { selected5 } = this
|
|
170
|
-
return html`
|
|
171
|
-
<section class="demo-section">
|
|
172
|
-
<h2 class="display-large">Scrollable tabs</h2>
|
|
173
|
-
<div class="frame scrollable">
|
|
174
|
-
<ui-tabs data-property="selected5" @change="${this.handleTabsChange}">
|
|
175
|
-
<ui-tab aria-controls="travel5" selected>Travel</ui-tab>
|
|
176
|
-
<ui-tab aria-controls="hotel5">Hotel</ui-tab>
|
|
177
|
-
<ui-tab aria-controls="travelHotel5">Travel + Hotel</ui-tab>
|
|
178
|
-
<ui-tab aria-controls="cars5" disabled>Cars</ui-tab>
|
|
179
|
-
|
|
180
|
-
<ui-tab aria-controls="travel51">Travel (1)</ui-tab>
|
|
181
|
-
<ui-tab aria-controls="hotel51">Hotel (1)</ui-tab>
|
|
182
|
-
<ui-tab aria-controls="travelHotel51">Travel + Hotel (1)</ui-tab>
|
|
183
|
-
<ui-tab aria-controls="cars51" disabled>Cars (1)</ui-tab>
|
|
184
|
-
|
|
185
|
-
<ui-tab aria-controls="travel52">Travel (2)</ui-tab>
|
|
186
|
-
<ui-tab aria-controls="hotel52">Hotel (2)</ui-tab>
|
|
187
|
-
<ui-tab aria-controls="travelHotel52">Travel + Hotel (2)</ui-tab>
|
|
188
|
-
<ui-tab aria-controls="cars52" disabled>Cars (2)</ui-tab>
|
|
189
|
-
</ui-tabs>
|
|
190
|
-
|
|
191
|
-
<div class="page">
|
|
192
|
-
<p id="travel5" ?hidden="${selected5 !== 'travel5'}">Travel page</p>
|
|
193
|
-
<p id="hotel5" ?hidden="${selected5 !== 'hotel5'}">Hotel page</p>
|
|
194
|
-
<p id="travelHotel5" ?hidden="${selected5 !== 'travelHotel5'}">Hotel & travel page</p>
|
|
195
|
-
<p id="cars5" ?hidden="${selected5 !== 'cars5'}">Cars page</p>
|
|
196
|
-
|
|
197
|
-
<p id="travel51" ?hidden="${selected5 !== 'travel51'}">Travel page (1)</p>
|
|
198
|
-
<p id="hotel51" ?hidden="${selected5 !== 'hotel51'}">Hotel page (1)</p>
|
|
199
|
-
<p id="travelHotel51" ?hidden="${selected5 !== 'travelHotel51'}">Hotel & travel page (1)</p>
|
|
200
|
-
<p id="cars51" ?hidden="${selected5 !== 'cars51'}">Cars page (1)</p>
|
|
201
|
-
|
|
202
|
-
<p id="travel52" ?hidden="${selected5 !== 'travel52'}">Travel page (2)</p>
|
|
203
|
-
<p id="hotel52" ?hidden="${selected5 !== 'hotel52'}">Hotel page (2)</p>
|
|
204
|
-
<p id="travelHotel52" ?hidden="${selected5 !== 'travelHotel52'}">Hotel & travel page (2)</p>
|
|
205
|
-
<p id="cars52" ?hidden="${selected5 !== 'cars52'}">Cars page (2)</p>
|
|
206
|
-
</div>
|
|
207
|
-
</div>
|
|
208
|
-
</section>
|
|
209
|
-
`
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const instance = new ComponentDemoPage()
|
|
214
|
-
instance.render()
|
package/demo/oauth-popup.html
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>Oauth2 callback window</title>
|
|
6
|
-
<style>*[hidden] { display: none; } </style>
|
|
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
|
-
<h1>Sending the authorization data to the application</h1>
|
|
17
|
-
<p id="general-error" hidden>
|
|
18
|
-
The window wasn't opened as a popup and therefore it can't pass the authorization information.<br/>
|
|
19
|
-
This is an error.
|
|
20
|
-
</p>
|
|
21
|
-
<script>
|
|
22
|
-
const messageTarget = (window.opener || window.parent || window.top);
|
|
23
|
-
if (!messageTarget || messageTarget === window || !messageTarget.postMessage) {
|
|
24
|
-
const elm = document.getElementById('general-error');
|
|
25
|
-
elm.removeAttribute('hidden');
|
|
26
|
-
} else {
|
|
27
|
-
const search = window.location.search.substr(1);
|
|
28
|
-
if (search) {
|
|
29
|
-
messageTarget.postMessage(search, '*');
|
|
30
|
-
} else {
|
|
31
|
-
messageTarget.postMessage(window.location.hash.substr(1), '*');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
</script>
|
|
35
|
-
</body>
|
|
36
|
-
</html>
|
package/demo/page.css
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/demo/resources/mood.png
DELETED
|
Binary file
|
package/demo/resources/print.png
DELETED
|
Binary file
|
package/demo/resources/stars.png
DELETED
|
Binary file
|
|
Binary file
|
package/demo/tsconfig.json
DELETED
package/eslint.config.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import globals from 'globals'
|
|
2
|
-
import pluginJs from '@eslint/js'
|
|
3
|
-
import tseslint from 'typescript-eslint'
|
|
4
|
-
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
|
|
5
|
-
import noOnlyTests from 'eslint-plugin-no-only-tests'
|
|
6
|
-
import { includeIgnoreFile } from '@eslint/compat'
|
|
7
|
-
import { fileURLToPath } from 'node:url'
|
|
8
|
-
|
|
9
|
-
const gitignorePath = fileURLToPath(new URL(".gitignore", import.meta.url));
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* List of files that must be ignored globally
|
|
13
|
-
*/
|
|
14
|
-
export const GLOBAL_IGNORE_LIST = [
|
|
15
|
-
'.github/',
|
|
16
|
-
'.husky/',
|
|
17
|
-
'.tmp/**/*',
|
|
18
|
-
'.vscode/*',
|
|
19
|
-
'.wireit/*',
|
|
20
|
-
'build/*',
|
|
21
|
-
'coverage/*',
|
|
22
|
-
'node_modules',
|
|
23
|
-
'scripts/*',
|
|
24
|
-
'eslint.config.js',
|
|
25
|
-
'*.min.*',
|
|
26
|
-
'*.d.ts',
|
|
27
|
-
'CHANGELOG.md',
|
|
28
|
-
'LICENSE*',
|
|
29
|
-
'coverage/**',
|
|
30
|
-
'package-lock.json',
|
|
31
|
-
'demo/apis/',
|
|
32
|
-
'demo/models/'
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
36
|
-
export default [
|
|
37
|
-
pluginJs.configs.recommended,
|
|
38
|
-
...tseslint.configs.strict,
|
|
39
|
-
...tseslint.configs.stylistic,
|
|
40
|
-
// eslintConfigPrettier,
|
|
41
|
-
eslintPluginPrettierRecommended,
|
|
42
|
-
includeIgnoreFile(gitignorePath),
|
|
43
|
-
{
|
|
44
|
-
files: ['**/*.ts', 'demo/**/*.ts', 'test/**/*.ts'],
|
|
45
|
-
languageOptions: {
|
|
46
|
-
globals: {
|
|
47
|
-
...globals.browser,
|
|
48
|
-
},
|
|
49
|
-
sourceType: 'module',
|
|
50
|
-
},
|
|
51
|
-
rules: {
|
|
52
|
-
'no-restricted-globals': [
|
|
53
|
-
'error',
|
|
54
|
-
...Object.keys(globals.node).filter(
|
|
55
|
-
// Disallow Node-specific globals (unless they are shared)
|
|
56
|
-
(g) => !Object.prototype.hasOwnProperty.call(globals.browser, g)
|
|
57
|
-
),
|
|
58
|
-
],
|
|
59
|
-
'max-len': [
|
|
60
|
-
'error',
|
|
61
|
-
{
|
|
62
|
-
code: 120,
|
|
63
|
-
comments: 120,
|
|
64
|
-
ignoreUrls: true,
|
|
65
|
-
ignoreTemplateLiterals: true,
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
'no-unreachable': ['error'],
|
|
69
|
-
'no-multi-spaces': ['error'],
|
|
70
|
-
'no-console': ['error'],
|
|
71
|
-
'no-redeclare': ['error'],
|
|
72
|
-
'@typescript-eslint/prefer-literal-enum-member': ['error', {
|
|
73
|
-
allowBitwiseExpressions: true,
|
|
74
|
-
}],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
files: ['test/**/*.ts'],
|
|
79
|
-
plugins: {
|
|
80
|
-
"no-only-tests": noOnlyTests,
|
|
81
|
-
},
|
|
82
|
-
rules: {
|
|
83
|
-
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
84
|
-
'@typescript-eslint/no-empty-function': 'off',
|
|
85
|
-
'no-only-tests/no-only-tests': 'error',
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
files: ['demo/**/*.ts'],
|
|
90
|
-
rules: {
|
|
91
|
-
'no-console': 'off'
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
ignores: GLOBAL_IGNORE_LIST,
|
|
96
|
-
},
|
|
97
|
-
]
|
package/scripts/copy-assets.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { copyFile, mkdir } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
async function copyStyles() {
|
|
5
|
-
const src = join('src', 'styles', 'm3');
|
|
6
|
-
const dest = join('build', 'src', 'styles', 'm3');
|
|
7
|
-
const files = [
|
|
8
|
-
'native.css',
|
|
9
|
-
'theme.css',
|
|
10
|
-
'tokens.css',
|
|
11
|
-
];
|
|
12
|
-
await mkdir(dest, { recursive: true });
|
|
13
|
-
await Promise.all(
|
|
14
|
-
files.map(async (name) => {
|
|
15
|
-
const destFile = join(dest, name);
|
|
16
|
-
await copyFile(join(src, name), destFile);
|
|
17
|
-
})
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
await copyStyles();
|
package/scripts/release.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { execSync } from 'child_process'
|
|
4
|
-
import { readFileSync, writeFileSync } from 'fs'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
|
-
import { dirname, join } from 'path'
|
|
7
|
-
import SemVer from '@pawel-up/semver/classes/semver.js'
|
|
8
|
-
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
10
|
-
const __dirname = dirname(__filename)
|
|
11
|
-
const packageJsonPath = join(__dirname, '..', 'package.json')
|
|
12
|
-
|
|
13
|
-
function updateVersion(type) {
|
|
14
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))
|
|
15
|
-
const currentVersion = packageJson.version
|
|
16
|
-
const ver = new SemVer(currentVersion)
|
|
17
|
-
ver.inc(type)
|
|
18
|
-
|
|
19
|
-
packageJson.version = ver.format()
|
|
20
|
-
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n')
|
|
21
|
-
|
|
22
|
-
return packageJson.version
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function main() {
|
|
26
|
-
const type = process.argv[2] || 'patch'
|
|
27
|
-
|
|
28
|
-
if (!['major', 'minor', 'patch'].includes(type)) {
|
|
29
|
-
console.error('Usage: node scripts/release.js [major|minor|patch]')
|
|
30
|
-
process.exit(1)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
// Check if working directory is clean
|
|
35
|
-
const status = execSync('git status --porcelain', { encoding: 'utf8' })
|
|
36
|
-
if (status.trim()) {
|
|
37
|
-
console.error('Working directory is not clean. Please commit or stash your changes.')
|
|
38
|
-
process.exit(1)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Update version
|
|
42
|
-
const newVersion = updateVersion(type)
|
|
43
|
-
console.log(`Updated version to ${newVersion}`)
|
|
44
|
-
|
|
45
|
-
// Build the project
|
|
46
|
-
console.log('Building project...')
|
|
47
|
-
execSync('npm run build', { stdio: 'inherit' })
|
|
48
|
-
|
|
49
|
-
// Commit version bump
|
|
50
|
-
execSync('git add package.json', { stdio: 'inherit' })
|
|
51
|
-
execSync(`git commit -m "chore: bump version to ${newVersion}"`, { stdio: 'inherit' })
|
|
52
|
-
|
|
53
|
-
// Create and push tag
|
|
54
|
-
execSync(`git tag v${newVersion}`, { stdio: 'inherit' })
|
|
55
|
-
execSync('git push origin main', { stdio: 'inherit' })
|
|
56
|
-
execSync(`git push origin v${newVersion}`, { stdio: 'inherit' })
|
|
57
|
-
|
|
58
|
-
console.log(`\n🎉 Release ${newVersion} created and pushed!`)
|
|
59
|
-
console.log('The GitHub Actions workflow will now create a release with changelog.')
|
|
60
|
-
} catch (error) {
|
|
61
|
-
console.error('Error during release:', error.message)
|
|
62
|
-
process.exit(1)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
main()
|
package/src/demo/DemoPage.ts
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { html, TemplateResult, CSSResult } from 'lit'
|
|
2
|
-
import { RenderableMixin } from '../mixins/RenderableMixin.js'
|
|
3
|
-
import reactive from '../decorators/reactive.js'
|
|
4
|
-
import styles from './DemoStyles.js'
|
|
5
|
-
import { RouteMixin } from '../mixins/RouteMixin.js'
|
|
6
|
-
import * as MonacoLoader from '../monaco/loader.js'
|
|
7
|
-
import typography from '../styles/m3/typography.module.js'
|
|
8
|
-
import surface from '../styles/m3/surface.module.js'
|
|
9
|
-
import type CheckboxElement from '../md/checkbox/internals/CheckboxElement.js'
|
|
10
|
-
import { adaptStatic } from '../decorators/styles.js'
|
|
11
|
-
|
|
12
|
-
import '../md/icons/ui-icon.js'
|
|
13
|
-
import '../md/button/ui-button.js'
|
|
14
|
-
|
|
15
|
-
const Base = RenderableMixin(RouteMixin(EventTarget))
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A base class for demo pages in the API Client ecosystem.
|
|
19
|
-
*/
|
|
20
|
-
export abstract class DemoPage extends Base {
|
|
21
|
-
@adaptStatic
|
|
22
|
-
static get styles(): CSSResult[] {
|
|
23
|
-
return [typography, styles, surface]
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Component name rendered in the header section.
|
|
28
|
-
*/
|
|
29
|
-
@reactive() accessor componentName = ''
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Determines whether the initial render had run and the `firstRender()`
|
|
33
|
-
* function was called.
|
|
34
|
-
*/
|
|
35
|
-
override accessor firstRendered = false
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Whether or not the dark theme is active
|
|
39
|
-
*/
|
|
40
|
-
@reactive() accessor darkThemeActive = false
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* For some demo pages, whether the user is authenticated in the store.
|
|
44
|
-
*/
|
|
45
|
-
authenticated = false
|
|
46
|
-
|
|
47
|
-
constructor() {
|
|
48
|
-
super()
|
|
49
|
-
this.handleMediaQuery = this.handleMediaQuery.bind(this)
|
|
50
|
-
this.initMediaQueries()
|
|
51
|
-
|
|
52
|
-
document.body.classList.add('demo')
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Initializes media queries and observers.
|
|
57
|
-
*/
|
|
58
|
-
initMediaQueries(): void {
|
|
59
|
-
const matcher = window.matchMedia('(prefers-color-scheme: dark)')
|
|
60
|
-
if (matcher.matches) {
|
|
61
|
-
this.darkThemeActive = true
|
|
62
|
-
}
|
|
63
|
-
this.themeActiveCallback()
|
|
64
|
-
matcher.addEventListener('change', this.handleMediaQuery)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
protected handleMediaQuery(e: MediaQueryListEvent): void {
|
|
68
|
-
this.darkThemeActive = e.matches
|
|
69
|
-
this.themeActiveCallback()
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* The callback is called when the `darkThemeActive` property change.
|
|
74
|
-
* Overwrite this function to change the theme of the demo page.
|
|
75
|
-
*
|
|
76
|
-
* Note, this is not called by the `darkThemeActive` setter. This is called during the
|
|
77
|
-
* initialization and then when the media query event is dispatched.
|
|
78
|
-
* Call this manually when changing this value in the child page.
|
|
79
|
-
*/
|
|
80
|
-
protected themeActiveCallback(): void {
|
|
81
|
-
const { darkThemeActive } = this
|
|
82
|
-
if (darkThemeActive) {
|
|
83
|
-
this.activateTheme('dark')
|
|
84
|
-
} else {
|
|
85
|
-
this.activateTheme('light')
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
protected activateTheme(type: 'light' | 'dark'): void {
|
|
90
|
-
const root = document.querySelector('html')
|
|
91
|
-
if (!root) {
|
|
92
|
-
return
|
|
93
|
-
}
|
|
94
|
-
const { classList } = root
|
|
95
|
-
// clear all themes
|
|
96
|
-
classList.forEach((value) => {
|
|
97
|
-
if (value.startsWith('theme-')) {
|
|
98
|
-
classList.remove(value)
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
const name = `theme-${type}`
|
|
102
|
-
classList.add(name)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* A handler for the `change` event for an element that has `checked` and `name` properties.
|
|
107
|
-
* This can be used with `ui-switch`, `ui-checkbox`, and `checkbox` elements.
|
|
108
|
-
*
|
|
109
|
-
* The `name` should correspond to a variable name to be set. The set value is the value
|
|
110
|
-
* of `checked` property read from the event's target.
|
|
111
|
-
*/
|
|
112
|
-
protected _toggleBooleanOption(e: Event): void {
|
|
113
|
-
const { name, checked } = e.target as CheckboxElement
|
|
114
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
115
|
-
;(this as any)[name as string] = checked
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
async loadMonaco(): Promise<void> {
|
|
119
|
-
const base = new URL('/node_modules/monaco-editor/', window.location.href).toString()
|
|
120
|
-
MonacoLoader.createEnvironment(base)
|
|
121
|
-
await MonacoLoader.loadMonaco(base)
|
|
122
|
-
await MonacoLoader.monacoReady()
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* The page render function. Usually you don't need to use it.
|
|
127
|
-
* It renders the header template, main section, and the content.
|
|
128
|
-
*/
|
|
129
|
-
override pageTemplate(): TemplateResult {
|
|
130
|
-
return html` ${this.headerTemplate()} ${this.navigationTemplate()}
|
|
131
|
-
<main>${this.contentTemplate()}</main>`
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Call this on the top of the `render()` method to render demo navigation
|
|
136
|
-
* @returns HTML template for demo header
|
|
137
|
-
*/
|
|
138
|
-
headerTemplate(): TemplateResult {
|
|
139
|
-
const { componentName } = this
|
|
140
|
-
return html` <header>${componentName ? html`<h1 class="api-title">${componentName}</h1>` : ''}</header>`
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
navigationTemplate(): TemplateResult {
|
|
144
|
-
return html``
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Abstract method. When not overriding `render()` method you can use
|
|
149
|
-
* this function to render content inside the standard API components layout.
|
|
150
|
-
*
|
|
151
|
-
* ```
|
|
152
|
-
* contentTemplate() {
|
|
153
|
-
* return html`<p>Demo content</p>`;
|
|
154
|
-
* }
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
abstract contentTemplate(): TemplateResult
|
|
158
|
-
|
|
159
|
-
handleAuthenticate(): void {
|
|
160
|
-
// ...
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
authenticateTemplate(): TemplateResult {
|
|
164
|
-
return html`
|
|
165
|
-
<p>Store authorization required.</p>
|
|
166
|
-
<ui-button color="filled" @click="${this.handleAuthenticate}">Authenticate</ui-button>
|
|
167
|
-
`
|
|
168
|
-
}
|
|
169
|
-
}
|