@compas-oscd/open-scd 0.34.22 → 0.34.23
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/dist/WizardDivider.d.ts +1 -0
- package/dist/WizardDivider.d.ts.map +1 -0
- package/dist/Wizarding.d.ts +20 -0
- package/dist/Wizarding.d.ts.map +1 -0
- package/dist/Wizarding.js +4 -1
- package/dist/Wizarding.js.map +1 -1
- package/dist/action-icon.d.ts +1 -0
- package/dist/action-icon.d.ts.map +1 -0
- package/dist/action-pane.d.ts +1 -0
- package/dist/action-pane.d.ts.map +1 -0
- package/dist/addons/Editor.d.ts +1 -0
- package/dist/addons/Editor.d.ts.map +1 -0
- package/dist/addons/History.d.ts +11 -0
- package/dist/addons/History.d.ts.map +1 -0
- package/dist/addons/History.js +10 -0
- package/dist/addons/History.js.map +1 -1
- package/dist/addons/Layout.d.ts +1 -0
- package/dist/addons/Layout.d.ts.map +1 -0
- package/dist/addons/Settings.d.ts +1 -0
- package/dist/addons/Settings.d.ts.map +1 -0
- package/dist/addons/Waiter.d.ts +1 -0
- package/dist/addons/Waiter.d.ts.map +1 -0
- package/dist/addons/Wizards.d.ts +1 -0
- package/dist/addons/Wizards.d.ts.map +1 -0
- package/dist/addons/editor/edit-action-to-v1-converter.d.ts +1 -0
- package/dist/addons/editor/edit-action-to-v1-converter.d.ts.map +1 -0
- package/dist/addons/editor/edit-v1-to-v2-converter.d.ts +1 -0
- package/dist/addons/editor/edit-v1-to-v2-converter.d.ts.map +1 -0
- package/dist/addons/history/get-log-text.d.ts +1 -0
- package/dist/addons/history/get-log-text.d.ts.map +1 -0
- package/dist/addons/menu-tabs/menu-tabs.d.ts +1 -0
- package/dist/addons/menu-tabs/menu-tabs.d.ts.map +1 -0
- package/dist/addons/plugin-manager/custom-plugin-dialog.d.ts +1 -0
- package/dist/addons/plugin-manager/custom-plugin-dialog.d.ts.map +1 -0
- package/dist/addons/plugin-manager/plugin-manager.d.ts +1 -0
- package/dist/addons/plugin-manager/plugin-manager.d.ts.map +1 -0
- package/dist/filtered-list.d.ts +1 -0
- package/dist/filtered-list.d.ts.map +1 -0
- package/dist/finder-list.d.ts +1 -0
- package/dist/finder-list.d.ts.map +1 -0
- package/dist/foundation/compare.d.ts +1 -0
- package/dist/foundation/compare.d.ts.map +1 -0
- package/dist/foundation/dai.d.ts +1 -0
- package/dist/foundation/dai.d.ts.map +1 -0
- package/dist/foundation/generators.d.ts +1 -0
- package/dist/foundation/generators.d.ts.map +1 -0
- package/dist/foundation/ied.d.ts +1 -0
- package/dist/foundation/ied.d.ts.map +1 -0
- package/dist/foundation/nsd.d.ts +1 -0
- package/dist/foundation/nsd.d.ts.map +1 -0
- package/dist/foundation/nsdoc.d.ts +1 -0
- package/dist/foundation/nsdoc.d.ts.map +1 -0
- package/dist/foundation/scl.d.ts +1 -0
- package/dist/foundation/scl.d.ts.map +1 -0
- package/dist/foundation.d.ts +1 -0
- package/dist/foundation.d.ts.map +1 -0
- package/dist/icons/compare.d.ts +1 -0
- package/dist/icons/compare.d.ts.map +1 -0
- package/dist/icons/icons.d.ts +1 -0
- package/dist/icons/icons.d.ts.map +1 -0
- package/dist/icons/ied-icons.d.ts +1 -0
- package/dist/icons/ied-icons.d.ts.map +1 -0
- package/dist/icons/lnode.d.ts +1 -0
- package/dist/icons/lnode.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/open-scd.d.ts +1 -0
- package/dist/open-scd.d.ts.map +1 -0
- package/dist/oscd-filter-button.d.ts +1 -0
- package/dist/oscd-filter-button.d.ts.map +1 -0
- package/dist/plain-compare-list.d.ts +1 -0
- package/dist/plain-compare-list.d.ts.map +1 -0
- package/dist/plugin-tag.d.ts +1 -0
- package/dist/plugin-tag.d.ts.map +1 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.events.d.ts +1 -0
- package/dist/plugin.events.d.ts.map +1 -0
- package/dist/plugins.d.ts +1 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/schemas.d.ts +1 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/themes.d.ts +1 -0
- package/dist/themes.d.ts.map +1 -0
- package/dist/translations/de.d.ts +1 -0
- package/dist/translations/de.d.ts.map +1 -0
- package/dist/translations/en.d.ts +1 -0
- package/dist/translations/en.d.ts.map +1 -0
- package/dist/translations/loader.d.ts +1 -0
- package/dist/translations/loader.d.ts.map +1 -0
- package/dist/wizard-checkbox.d.ts +1 -0
- package/dist/wizard-checkbox.d.ts.map +1 -0
- package/dist/wizard-dialog.d.ts +1 -0
- package/dist/wizard-dialog.d.ts.map +1 -0
- package/dist/wizard-select.d.ts +1 -0
- package/dist/wizard-select.d.ts.map +1 -0
- package/dist/wizard-textfield.d.ts +2 -1
- package/dist/wizard-textfield.d.ts.map +1 -0
- package/dist/wizards.d.ts +1 -0
- package/dist/wizards.d.ts.map +1 -0
- package/package.json +317 -47
- package/dist/core/api/api.js +0 -7
- package/dist/core/api/api.js.map +0 -1
- package/dist/core/api/editor/subject.js +0 -22
- package/dist/core/api/editor/subject.js.map +0 -1
- package/dist/core/api/editor/xml-editor.js +0 -82
- package/dist/core/api/editor/xml-editor.js.map +0 -1
- package/dist/core/api/plugin-state-api.js +0 -27
- package/dist/core/api/plugin-state-api.js.map +0 -1
- package/dist/core/foundation/cyrb64.js +0 -26
- package/dist/core/foundation/cyrb64.js.map +0 -1
- package/dist/core/foundation/deprecated/edit-event.js +0 -44
- package/dist/core/foundation/deprecated/edit-event.js.map +0 -1
- package/dist/core/foundation/deprecated/editor.js +0 -94
- package/dist/core/foundation/deprecated/editor.js.map +0 -1
- package/dist/core/foundation/deprecated/history.js +0 -17
- package/dist/core/foundation/deprecated/history.js.map +0 -1
- package/dist/core/foundation/deprecated/open-event.js +0 -9
- package/dist/core/foundation/deprecated/open-event.js.map +0 -1
- package/dist/core/foundation/deprecated/settings.js +0 -19
- package/dist/core/foundation/deprecated/settings.js.map +0 -1
- package/dist/core/foundation/deprecated/validation.js +0 -8
- package/dist/core/foundation/deprecated/validation.js.map +0 -1
- package/dist/core/foundation/deprecated/waiter.js +0 -12
- package/dist/core/foundation/deprecated/waiter.js.map +0 -1
- package/dist/core/foundation/edit-completed-event.js +0 -11
- package/dist/core/foundation/edit-completed-event.js.map +0 -1
- package/dist/core/foundation/edit-event.js +0 -8
- package/dist/core/foundation/edit-event.js.map +0 -1
- package/dist/core/foundation/edit.js +0 -31
- package/dist/core/foundation/edit.js.map +0 -1
- package/dist/core/foundation/handle-edit.js +0 -151
- package/dist/core/foundation/handle-edit.js.map +0 -1
- package/dist/core/foundation/open-event.js +0 -8
- package/dist/core/foundation/open-event.js.map +0 -1
- package/dist/core/foundation/plugin.js +0 -2
- package/dist/core/foundation/plugin.js.map +0 -1
- package/dist/core/foundation.js +0 -14
- package/dist/core/foundation.js.map +0 -1
- package/dist/core/locales.js +0 -21
- package/dist/core/locales.js.map +0 -1
- package/dist/openscd/src/WizardDivider.js +0 -37
- package/dist/openscd/src/WizardDivider.js.map +0 -1
- package/dist/openscd/src/Wizarding.js +0 -38
- package/dist/openscd/src/Wizarding.js.map +0 -1
- package/dist/openscd/src/action-icon.js +0 -220
- package/dist/openscd/src/action-icon.js.map +0 -1
- package/dist/openscd/src/action-pane.js +0 -176
- package/dist/openscd/src/action-pane.js.map +0 -1
- package/dist/openscd/src/addons/Editor.js +0 -106
- package/dist/openscd/src/addons/Editor.js.map +0 -1
- package/dist/openscd/src/addons/History.js +0 -581
- package/dist/openscd/src/addons/History.js.map +0 -1
- package/dist/openscd/src/addons/Layout.js +0 -619
- package/dist/openscd/src/addons/Layout.js.map +0 -1
- package/dist/openscd/src/addons/Settings.js +0 -465
- package/dist/openscd/src/addons/Settings.js.map +0 -1
- package/dist/openscd/src/addons/Waiter.js +0 -45
- package/dist/openscd/src/addons/Waiter.js.map +0 -1
- package/dist/openscd/src/addons/Wizards.js +0 -48
- package/dist/openscd/src/addons/Wizards.js.map +0 -1
- package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js +0 -96
- package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js.map +0 -1
- package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js +0 -37
- package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js.map +0 -1
- package/dist/openscd/src/addons/history/get-log-text.js +0 -26
- package/dist/openscd/src/addons/history/get-log-text.js.map +0 -1
- package/dist/openscd/src/addons/menu-tabs/menu-tabs.js +0 -74
- package/dist/openscd/src/addons/menu-tabs/menu-tabs.js.map +0 -1
- package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js +0 -177
- package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js.map +0 -1
- package/dist/openscd/src/addons/plugin-manager/plugin-manager.js +0 -165
- package/dist/openscd/src/addons/plugin-manager/plugin-manager.js.map +0 -1
- package/dist/openscd/src/filtered-list.js +0 -168
- package/dist/openscd/src/filtered-list.js.map +0 -1
- package/dist/openscd/src/finder-list.js +0 -207
- package/dist/openscd/src/finder-list.js.map +0 -1
- package/dist/openscd/src/foundation/compare.js +0 -273
- package/dist/openscd/src/foundation/compare.js.map +0 -1
- package/dist/openscd/src/foundation/dai.js +0 -127
- package/dist/openscd/src/foundation/dai.js.map +0 -1
- package/dist/openscd/src/foundation/generators.js +0 -67
- package/dist/openscd/src/foundation/generators.js.map +0 -1
- package/dist/openscd/src/foundation/ied.js +0 -84
- package/dist/openscd/src/foundation/ied.js.map +0 -1
- package/dist/openscd/src/foundation/nsd.js +0 -13
- package/dist/openscd/src/foundation/nsd.js.map +0 -1
- package/dist/openscd/src/foundation/nsdoc.js +0 -180
- package/dist/openscd/src/foundation/nsdoc.js.map +0 -1
- package/dist/openscd/src/foundation/scl.js +0 -64
- package/dist/openscd/src/foundation/scl.js.map +0 -1
- package/dist/openscd/src/foundation.js +0 -1922
- package/dist/openscd/src/foundation.js.map +0 -1
- package/dist/openscd/src/icons/compare.js +0 -11
- package/dist/openscd/src/icons/compare.js.map +0 -1
- package/dist/openscd/src/icons/icons.js +0 -611
- package/dist/openscd/src/icons/icons.js.map +0 -1
- package/dist/openscd/src/icons/ied-icons.js +0 -11
- package/dist/openscd/src/icons/ied-icons.js.map +0 -1
- package/dist/openscd/src/icons/lnode.js +0 -50
- package/dist/openscd/src/icons/lnode.js.map +0 -1
- package/dist/openscd/src/open-scd.js +0 -483
- package/dist/openscd/src/open-scd.js.map +0 -1
- package/dist/openscd/src/oscd-filter-button.js +0 -89
- package/dist/openscd/src/oscd-filter-button.js.map +0 -1
- package/dist/openscd/src/plain-compare-list.js +0 -132
- package/dist/openscd/src/plain-compare-list.js.map +0 -1
- package/dist/openscd/src/plugin-tag.js +0 -23
- package/dist/openscd/src/plugin-tag.js.map +0 -1
- package/dist/openscd/src/plugin.events.js +0 -12
- package/dist/openscd/src/plugin.events.js.map +0 -1
- package/dist/openscd/src/plugin.js +0 -2
- package/dist/openscd/src/plugin.js.map +0 -1
- package/dist/openscd/src/plugins.js +0 -256
- package/dist/openscd/src/plugins.js.map +0 -1
- package/dist/openscd/src/schemas.js +0 -9325
- package/dist/openscd/src/schemas.js.map +0 -1
- package/dist/openscd/src/themes.js +0 -122
- package/dist/openscd/src/themes.js.map +0 -1
- package/dist/openscd/src/translations/de.js +0 -954
- package/dist/openscd/src/translations/de.js.map +0 -1
- package/dist/openscd/src/translations/en.js +0 -950
- package/dist/openscd/src/translations/en.js.map +0 -1
- package/dist/openscd/src/translations/loader.js +0 -10
- package/dist/openscd/src/translations/loader.js.map +0 -1
- package/dist/openscd/src/wizard-checkbox.js +0 -152
- package/dist/openscd/src/wizard-checkbox.js.map +0 -1
- package/dist/openscd/src/wizard-dialog.js +0 -374
- package/dist/openscd/src/wizard-dialog.js.map +0 -1
- package/dist/openscd/src/wizard-select.js +0 -115
- package/dist/openscd/src/wizard-select.js.map +0 -1
- package/dist/openscd/src/wizard-textfield.js +0 -191
- package/dist/openscd/src/wizard-textfield.js.map +0 -1
- package/dist/openscd/src/wizards.js +0 -196
- package/dist/openscd/src/wizards.js.map +0 -1
- package/dist/xml/src/foundation.js +0 -67
- package/dist/xml/src/foundation.js.map +0 -1
- package/dist/xml/src/index.js +0 -2
- package/dist/xml/src/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Wizarding.js","sourceRoot":"","sources":["../../../src/Wizarding.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAkB,KAAK,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,aAAa,GAKd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,oBAAoB,CAAC;AAO5B,MAAM,UAAU,SAAS,CAAsC,IAAW;IACxE,MAAM,gBAAiB,SAAQ,IAAI;QAOzB,QAAQ,CAAC,EAAe;YAC9B,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;YAChC,IAAI,MAAM,KAAK,IAAI;gBAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;iBACtC,IAAI,EAAE,CAAC,MAAM,CAAC,SAAS;gBAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;;gBACvD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAC/B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CAC5B,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CACrC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CAC7C,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,CAC9B,CACF,CACF,CAAC;QACJ,CAAC;QAED,YAAY,GAAG,IAAW;YACxB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAtBjB,8CAA8C;YAE9C,aAAQ,GAAoB,EAAE,CAAC;YAsB7B,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC/C,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,GAAG,EAAE,CAC1C,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAC9B,CAAC;QACJ,CAAC;QAED,MAAM;YACJ,OAAO,IAAI,CAAA,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;iCAChB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,mBAAmB,CAAC;QAC3E,CAAC;KACF;IAhCC;QADC,KAAK,EAAE;sDACuB;IAEP;QAAvB,KAAK,CAAC,eAAe,CAAC;sDAAyB;IAgClD,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["import { html, state, TemplateResult, query } from 'lit-element';\nimport {\n ifImplemented,\n LitElementConstructor,\n Mixin,\n WizardEvent,\n WizardFactory,\n} from './foundation.js';\n\nimport './wizard-dialog.js';\nimport { WizardDialog } from './wizard-dialog.js';\n\n/** `LitElement` mixin that adds a `workflow` property which [[`Wizard`]]s are\n * queued onto on incoming [[`WizardEvent`]]s, first come first displayed. */\nexport type WizardingElement = Mixin<typeof Wizarding>;\n\nexport function Wizarding<TBase extends LitElementConstructor>(Base: TBase) {\n class WizardingElement extends Base {\n /** FIFO queue of [[`Wizard`]]s to display. */\n @state()\n workflow: WizardFactory[] = [];\n\n @query('wizard-dialog') wizardUI!: WizardDialog;\n\n private onWizard(we: WizardEvent) {\n const wizard = we.detail.wizard;\n if (wizard === null) this.workflow.shift();\n else if (we.detail.subwizard) this.workflow.unshift(wizard);\n else this.workflow.push(wizard);\n this.requestUpdate('workflow');\n this.updateComplete.then(() =>\n this.wizardUI.updateComplete.then(() =>\n this.wizardUI.dialog?.updateComplete.then(() =>\n this.wizardUI.dialog?.focus()\n )\n )\n );\n }\n\n constructor(...args: any[]) {\n super(...args);\n\n this.addEventListener('wizard', this.onWizard);\n this.addEventListener('editor-action', () =>\n this.wizardUI.requestUpdate()\n );\n }\n\n render(): TemplateResult {\n return html`${ifImplemented(super.render())}\n <wizard-dialog .wizard=${this.workflow[0]?.() ?? []}></wizard-dialog>`;\n }\n }\n\n return WizardingElement;\n}\n"]}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { css, customElement, html, LitElement, property, } from 'lit-element';
|
|
3
|
-
import { nothing } from 'lit-html';
|
|
4
|
-
import '@material/mwc-icon';
|
|
5
|
-
/**
|
|
6
|
-
* A responsive container rendering actions in a header.
|
|
7
|
-
*
|
|
8
|
-
* The "action" slot may contain up to eight icon buttons.
|
|
9
|
-
* The "icon" slot, if filled overrides the icon property.
|
|
10
|
-
* The default slot will be rendered into the pane body in a single column.
|
|
11
|
-
*/
|
|
12
|
-
let ActionIcon = class ActionIcon extends LitElement {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
/** color header with secondary theme color while focus is within */
|
|
16
|
-
this.secondary = false;
|
|
17
|
-
/** highlight pane with dotted outline */
|
|
18
|
-
this.highlighted = false;
|
|
19
|
-
/** disables CSS adoption to action buttons */
|
|
20
|
-
this.hideActions = false;
|
|
21
|
-
}
|
|
22
|
-
async firstUpdated() {
|
|
23
|
-
this.tabIndex = 0;
|
|
24
|
-
}
|
|
25
|
-
renderIcon() {
|
|
26
|
-
return html `<span>
|
|
27
|
-
<slot name="icon"
|
|
28
|
-
>${this.icon ? html `<mwc-icon>${this.icon}</mwc-icon>` : nothing}</slot
|
|
29
|
-
></span
|
|
30
|
-
> `;
|
|
31
|
-
}
|
|
32
|
-
render() {
|
|
33
|
-
return html `<header>${this.label ?? nothing}</header>
|
|
34
|
-
<section>${this.renderIcon()}<slot name="action"></slot></section>
|
|
35
|
-
<footer>${this.label ?? nothing}</footer>`;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
ActionIcon.styles = css `
|
|
39
|
-
:host {
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
outline: none;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
section {
|
|
46
|
-
align-self: center;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
::slotted([slot='icon']),
|
|
50
|
-
mwc-icon {
|
|
51
|
-
display: block;
|
|
52
|
-
color: var(--mdc-theme-on-surface);
|
|
53
|
-
transition: transform 150ms linear, box-shadow 200ms linear;
|
|
54
|
-
outline-color: var(--mdc-theme-primary);
|
|
55
|
-
outline-style: solid;
|
|
56
|
-
margin: 0px;
|
|
57
|
-
outline-width: 0px;
|
|
58
|
-
width: 64px;
|
|
59
|
-
height: 64px;
|
|
60
|
-
--mdc-icon-size: 64px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
:host([secondary]) ::slotted([slot='icon']),
|
|
64
|
-
:host([secondary]) mwc-icon {
|
|
65
|
-
outline-color: var(--mdc-theme-secondary);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
:host([highlighted]) ::slotted([slot='icon']),
|
|
69
|
-
:host([highlighted]) mwc-icon {
|
|
70
|
-
outline-style: dotted;
|
|
71
|
-
outline-width: 2px;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
:host(:focus-within) ::slotted([slot='icon']),
|
|
75
|
-
:host(:focus-within) mwc-icon {
|
|
76
|
-
outline-style: solid;
|
|
77
|
-
outline-width: 4px;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
:host(:focus-within:not([hideActions])) ::slotted([slot='icon']),
|
|
81
|
-
:host(:focus-within:not([hideActions])) mwc-icon {
|
|
82
|
-
transform: scale(0.8);
|
|
83
|
-
transition: all 250ms linear;
|
|
84
|
-
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
|
|
85
|
-
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
::slotted([slot='icon']:hover),
|
|
89
|
-
mwc-icon:hover {
|
|
90
|
-
outline-style: dashed;
|
|
91
|
-
outline-width: 2px;
|
|
92
|
-
transition: transform 200ms linear, box-shadow 250ms linear;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
::slotted([slot='action']) {
|
|
96
|
-
color: var(--mdc-theme-on-surface);
|
|
97
|
-
transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
98
|
-
opacity 200ms linear;
|
|
99
|
-
position: absolute;
|
|
100
|
-
pointer-events: none;
|
|
101
|
-
z-index: 1;
|
|
102
|
-
opacity: 0;
|
|
103
|
-
margin-top: -56px;
|
|
104
|
-
margin-left: 8px;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
:host(:focus-within) ::slotted([slot='action']) {
|
|
108
|
-
transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
109
|
-
opacity 250ms linear;
|
|
110
|
-
pointer-events: auto;
|
|
111
|
-
opacity: 1;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
:host(:focus-within) ::slotted([slot='action']:nth-of-type(1)) {
|
|
115
|
-
transform: translate(0px, -52px);
|
|
116
|
-
}
|
|
117
|
-
:host(:focus-within) ::slotted([slot='action']:nth-of-type(2)) {
|
|
118
|
-
transform: translate(0px, 52px);
|
|
119
|
-
}
|
|
120
|
-
:host(:focus-within) ::slotted([slot='action']:nth-of-type(3)) {
|
|
121
|
-
transform: translate(52px, 0px);
|
|
122
|
-
}
|
|
123
|
-
:host(:focus-within) ::slotted([slot='action']:nth-of-type(4)) {
|
|
124
|
-
transform: translate(-52px, 0px);
|
|
125
|
-
}
|
|
126
|
-
:host(:focus-within) ::slotted([slot='action']:nth-of-type(5)) {
|
|
127
|
-
transform: translate(52px, -52px);
|
|
128
|
-
}
|
|
129
|
-
:host(:focus-within) ::slotted([slot='action']:nth-of-type(6)) {
|
|
130
|
-
transform: translate(-52px, 52px);
|
|
131
|
-
}
|
|
132
|
-
:host(:focus-within) ::slotted([slot='action']:nth-of-type(7)) {
|
|
133
|
-
transform: translate(-52px, -52px);
|
|
134
|
-
}
|
|
135
|
-
:host(:focus-within) ::slotted([slot='action']:nth-of-type(8)) {
|
|
136
|
-
transform: translate(52px, 52px);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
footer {
|
|
140
|
-
color: var(--mdc-theme-on-surface);
|
|
141
|
-
font-family: 'Roboto', sans-serif;
|
|
142
|
-
font-weight: 300;
|
|
143
|
-
overflow: hidden;
|
|
144
|
-
white-space: nowrap;
|
|
145
|
-
text-overflow: ellipsis;
|
|
146
|
-
margin: 0px;
|
|
147
|
-
text-align: center;
|
|
148
|
-
align-self: center;
|
|
149
|
-
max-width: 100%;
|
|
150
|
-
direction: rtl;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
header {
|
|
154
|
-
color: var(--mdc-theme-on-primary);
|
|
155
|
-
background-color: var(--mdc-theme-primary);
|
|
156
|
-
font-family: 'Roboto', sans-serif;
|
|
157
|
-
font-weight: 500;
|
|
158
|
-
font-size: 1.2em;
|
|
159
|
-
position: absolute;
|
|
160
|
-
text-align: center;
|
|
161
|
-
align-self: center;
|
|
162
|
-
max-width: 100vw;
|
|
163
|
-
padding: 4px 8px;
|
|
164
|
-
border-radius: 4px;
|
|
165
|
-
opacity: 0;
|
|
166
|
-
transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
167
|
-
opacity 200ms linear;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
:host([secondary]) header {
|
|
171
|
-
background-color: var(--mdc-theme-secondary);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
:host(:hover) header {
|
|
175
|
-
position: absolute;
|
|
176
|
-
opacity: 1;
|
|
177
|
-
transform: translate(0, -40px);
|
|
178
|
-
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
|
|
179
|
-
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
|
|
180
|
-
transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
181
|
-
opacity 250ms linear;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
:host(:focus-within) header {
|
|
185
|
-
position: absolute;
|
|
186
|
-
opacity: 1;
|
|
187
|
-
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
|
|
188
|
-
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
|
|
189
|
-
transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
|
|
190
|
-
opacity 250ms linear;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
:host(:focus-within:not([hideActions])) header {
|
|
194
|
-
transform: translate(0, -80px);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
:host(:focus-within[hideActions]) header {
|
|
198
|
-
transform: translate(0, -40px);
|
|
199
|
-
}
|
|
200
|
-
`;
|
|
201
|
-
__decorate([
|
|
202
|
-
property({ type: String })
|
|
203
|
-
], ActionIcon.prototype, "label", void 0);
|
|
204
|
-
__decorate([
|
|
205
|
-
property({ type: String })
|
|
206
|
-
], ActionIcon.prototype, "icon", void 0);
|
|
207
|
-
__decorate([
|
|
208
|
-
property({ type: Boolean })
|
|
209
|
-
], ActionIcon.prototype, "secondary", void 0);
|
|
210
|
-
__decorate([
|
|
211
|
-
property({ type: Boolean })
|
|
212
|
-
], ActionIcon.prototype, "highlighted", void 0);
|
|
213
|
-
__decorate([
|
|
214
|
-
property({ type: Boolean })
|
|
215
|
-
], ActionIcon.prototype, "hideActions", void 0);
|
|
216
|
-
ActionIcon = __decorate([
|
|
217
|
-
customElement('action-icon')
|
|
218
|
-
], ActionIcon);
|
|
219
|
-
export { ActionIcon };
|
|
220
|
-
//#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AAE,CAAC;yCACZ;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CACV;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACR;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACR;AAfT,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAsMtB;SAtMY,UAAU","sourcesContent":["import {\n css,\n customElement,\n html,\n LitElement,\n property,\n TemplateResult,\n} from 'lit-element';\nimport { nothing } from 'lit-html';\n\nimport '@material/mwc-icon';\n\n/**\n * A responsive container rendering actions in a header.\n *\n * The \"action\" slot may contain up to eight icon buttons.\n * The \"icon\" slot, if filled overrides the icon property.\n * The default slot will be rendered into the pane body in a single column.\n */\n@customElement('action-icon')\nexport class ActionIcon extends LitElement {\n /** caption text, displayed in the header */\n @property({ type: String })\n label?: string;\n /** icon name, displayed unless the \"icon\" slot is filled */\n @property({ type: String })\n icon?: string;\n /** color header with secondary theme color while focus is within */\n @property({ type: Boolean })\n secondary = false;\n /** highlight pane with dotted outline */\n @property({ type: Boolean })\n highlighted = false;\n /** disables CSS adoption to action buttons */\n @property({ type: Boolean })\n hideActions = false;\n\n async firstUpdated(): Promise<void> {\n this.tabIndex = 0;\n }\n\n private renderIcon(): TemplateResult {\n return html`<span>\n <slot name=\"icon\"\n >${this.icon ? html`<mwc-icon>${this.icon}</mwc-icon>` : nothing}</slot\n ></span\n > `;\n }\n\n render(): TemplateResult {\n return html`<header>${this.label ?? nothing}</header>\n <section>${this.renderIcon()}<slot name=\"action\"></slot></section>\n <footer>${this.label ?? nothing}</footer>`;\n }\n\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n outline: none;\n }\n\n section {\n align-self: center;\n }\n\n ::slotted([slot='icon']),\n mwc-icon {\n display: block;\n color: var(--mdc-theme-on-surface);\n transition: transform 150ms linear, box-shadow 200ms linear;\n outline-color: var(--mdc-theme-primary);\n outline-style: solid;\n margin: 0px;\n outline-width: 0px;\n width: 64px;\n height: 64px;\n --mdc-icon-size: 64px;\n }\n\n :host([secondary]) ::slotted([slot='icon']),\n :host([secondary]) mwc-icon {\n outline-color: var(--mdc-theme-secondary);\n }\n\n :host([highlighted]) ::slotted([slot='icon']),\n :host([highlighted]) mwc-icon {\n outline-style: dotted;\n outline-width: 2px;\n }\n\n :host(:focus-within) ::slotted([slot='icon']),\n :host(:focus-within) mwc-icon {\n outline-style: solid;\n outline-width: 4px;\n }\n\n :host(:focus-within:not([hideActions])) ::slotted([slot='icon']),\n :host(:focus-within:not([hideActions])) mwc-icon {\n transform: scale(0.8);\n transition: all 250ms linear;\n box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),\n 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);\n }\n\n ::slotted([slot='icon']:hover),\n mwc-icon:hover {\n outline-style: dashed;\n outline-width: 2px;\n transition: transform 200ms linear, box-shadow 250ms linear;\n }\n\n ::slotted([slot='action']) {\n color: var(--mdc-theme-on-surface);\n transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1),\n opacity 200ms linear;\n position: absolute;\n pointer-events: none;\n z-index: 1;\n opacity: 0;\n margin-top: -56px;\n margin-left: 8px;\n }\n\n :host(:focus-within) ::slotted([slot='action']) {\n transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),\n opacity 250ms linear;\n pointer-events: auto;\n opacity: 1;\n }\n\n :host(:focus-within) ::slotted([slot='action']:nth-of-type(1)) {\n transform: translate(0px, -52px);\n }\n :host(:focus-within) ::slotted([slot='action']:nth-of-type(2)) {\n transform: translate(0px, 52px);\n }\n :host(:focus-within) ::slotted([slot='action']:nth-of-type(3)) {\n transform: translate(52px, 0px);\n }\n :host(:focus-within) ::slotted([slot='action']:nth-of-type(4)) {\n transform: translate(-52px, 0px);\n }\n :host(:focus-within) ::slotted([slot='action']:nth-of-type(5)) {\n transform: translate(52px, -52px);\n }\n :host(:focus-within) ::slotted([slot='action']:nth-of-type(6)) {\n transform: translate(-52px, 52px);\n }\n :host(:focus-within) ::slotted([slot='action']:nth-of-type(7)) {\n transform: translate(-52px, -52px);\n }\n :host(:focus-within) ::slotted([slot='action']:nth-of-type(8)) {\n transform: translate(52px, 52px);\n }\n\n footer {\n color: var(--mdc-theme-on-surface);\n font-family: 'Roboto', sans-serif;\n font-weight: 300;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n margin: 0px;\n text-align: center;\n align-self: center;\n max-width: 100%;\n direction: rtl;\n }\n\n header {\n color: var(--mdc-theme-on-primary);\n background-color: var(--mdc-theme-primary);\n font-family: 'Roboto', sans-serif;\n font-weight: 500;\n font-size: 1.2em;\n position: absolute;\n text-align: center;\n align-self: center;\n max-width: 100vw;\n padding: 4px 8px;\n border-radius: 4px;\n opacity: 0;\n transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1),\n opacity 200ms linear;\n }\n\n :host([secondary]) header {\n background-color: var(--mdc-theme-secondary);\n }\n\n :host(:hover) header {\n position: absolute;\n opacity: 1;\n transform: translate(0, -40px);\n box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),\n 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);\n transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),\n opacity 250ms linear;\n }\n\n :host(:focus-within) header {\n position: absolute;\n opacity: 1;\n box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),\n 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);\n transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),\n opacity 250ms linear;\n }\n\n :host(:focus-within:not([hideActions])) header {\n transform: translate(0, -80px);\n }\n\n :host(:focus-within[hideActions]) header {\n transform: translate(0, -40px);\n }\n `;\n}\n"]}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { css, customElement, html, LitElement, property, } from 'lit-element';
|
|
3
|
-
import { classMap } from 'lit-html/directives/class-map';
|
|
4
|
-
import '@material/mwc-icon';
|
|
5
|
-
import { nothing } from 'lit-html';
|
|
6
|
-
function closestTo(node, selector) {
|
|
7
|
-
const closest = node.nodeType === Node.ELEMENT_NODE
|
|
8
|
-
? node.closest(selector)
|
|
9
|
-
: null;
|
|
10
|
-
if (closest)
|
|
11
|
-
return closest;
|
|
12
|
-
const root = node.getRootNode();
|
|
13
|
-
if (root instanceof ShadowRoot)
|
|
14
|
-
return closestTo(root.host, selector);
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A responsive container rendering actions in a header.
|
|
19
|
-
*
|
|
20
|
-
* The "action" slot may contain up to eight icon buttons.
|
|
21
|
-
* The "icon" slot, if filled overrides the icon property.
|
|
22
|
-
* The default slot will be rendered into the pane body in a single column.
|
|
23
|
-
*/
|
|
24
|
-
let ActionPane = class ActionPane extends LitElement {
|
|
25
|
-
constructor() {
|
|
26
|
-
super(...arguments);
|
|
27
|
-
/** color header with secondary theme color while focus is within */
|
|
28
|
-
this.secondary = false;
|
|
29
|
-
/** highlight pane with dotted outline */
|
|
30
|
-
this.highlighted = false;
|
|
31
|
-
/** nesting level, default (closest pane ancestor's level) + 1 */
|
|
32
|
-
this.level = 1;
|
|
33
|
-
}
|
|
34
|
-
async firstUpdated() {
|
|
35
|
-
this.tabIndex = 0;
|
|
36
|
-
const parentPane = closestTo(this.parentNode, 'action-pane');
|
|
37
|
-
if (parentPane)
|
|
38
|
-
this.level = parentPane.level + 1;
|
|
39
|
-
this.level = Math.floor(this.level);
|
|
40
|
-
}
|
|
41
|
-
renderHeader() {
|
|
42
|
-
const content = html `<span
|
|
43
|
-
><slot name="icon"
|
|
44
|
-
>${this.icon
|
|
45
|
-
? html `<mwc-icon>${this.icon}</mwc-icon>`
|
|
46
|
-
: nothing}</slot
|
|
47
|
-
></span
|
|
48
|
-
>
|
|
49
|
-
${this.label ?? nothing}
|
|
50
|
-
<nav><slot name="action"></slot></nav>`;
|
|
51
|
-
const headingLevel = Math.floor(Math.max(this.level, 1));
|
|
52
|
-
// Sometimes a TemplateResult is passed in as Label, not a string. So only when it's a string show a title.
|
|
53
|
-
const title = typeof this.label === 'string' ? this.label : '';
|
|
54
|
-
switch (headingLevel) {
|
|
55
|
-
case 1:
|
|
56
|
-
return html `<h1 title="${title}">${content}</h1>`;
|
|
57
|
-
case 2:
|
|
58
|
-
return html `<h2 title="${title}">${content}</h2>`;
|
|
59
|
-
case 3:
|
|
60
|
-
return html `<h3 title="${title}">${content}</h3>`;
|
|
61
|
-
default:
|
|
62
|
-
return html `<h4 title="${title}">${content}</h4>`;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
render() {
|
|
66
|
-
return html `<section
|
|
67
|
-
class="${classMap({
|
|
68
|
-
secondary: this.secondary,
|
|
69
|
-
highlighted: this.highlighted,
|
|
70
|
-
contrasted: this.level % 2 === 0,
|
|
71
|
-
})}"
|
|
72
|
-
>
|
|
73
|
-
${this.renderHeader()}
|
|
74
|
-
<div><slot></slot></div>
|
|
75
|
-
</section>`;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
ActionPane.styles = css `
|
|
79
|
-
:host {
|
|
80
|
-
outline: none;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
:host(:focus-within) section {
|
|
84
|
-
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
|
|
85
|
-
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
|
|
86
|
-
outline-width: 4px;
|
|
87
|
-
transition: all 250ms linear;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
section {
|
|
91
|
-
background-color: var(--mdc-theme-surface);
|
|
92
|
-
transition: all 200ms linear;
|
|
93
|
-
outline-style: solid;
|
|
94
|
-
margin: 0px;
|
|
95
|
-
outline-width: 0px;
|
|
96
|
-
outline-color: var(--mdc-theme-primary);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
section.secondary {
|
|
100
|
-
outline-color: var(--mdc-theme-secondary);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
section > div {
|
|
104
|
-
display: flex;
|
|
105
|
-
flex-direction: column;
|
|
106
|
-
gap: 12px;
|
|
107
|
-
padding: 8px 12px 16px;
|
|
108
|
-
clear: right;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.highlighted {
|
|
112
|
-
outline-style: dotted;
|
|
113
|
-
outline-width: 2px;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
:host(:focus-within) .highlighted {
|
|
117
|
-
outline-style: solid;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.contrasted {
|
|
121
|
-
background-color: var(--mdc-theme-on-primary);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
h1,
|
|
125
|
-
h2,
|
|
126
|
-
h3,
|
|
127
|
-
h4 {
|
|
128
|
-
color: var(--mdc-theme-on-surface);
|
|
129
|
-
font-family: 'Roboto', sans-serif;
|
|
130
|
-
font-weight: 300;
|
|
131
|
-
overflow: clip visible;
|
|
132
|
-
white-space: nowrap;
|
|
133
|
-
text-overflow: ellipsis;
|
|
134
|
-
margin: 0px;
|
|
135
|
-
line-height: 52px;
|
|
136
|
-
padding-left: 0.3em;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
nav {
|
|
140
|
-
float: right;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
mwc-icon {
|
|
144
|
-
vertical-align: middle;
|
|
145
|
-
position: relative;
|
|
146
|
-
top: -0.1em;
|
|
147
|
-
--mdc-icon-size: 1em;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
::slotted([slot='icon']) {
|
|
151
|
-
vertical-align: middle;
|
|
152
|
-
position: relative;
|
|
153
|
-
top: -0.1em;
|
|
154
|
-
--mdc-icon-size: 1em;
|
|
155
|
-
}
|
|
156
|
-
`;
|
|
157
|
-
__decorate([
|
|
158
|
-
property({ type: String })
|
|
159
|
-
], ActionPane.prototype, "label", void 0);
|
|
160
|
-
__decorate([
|
|
161
|
-
property({ type: String })
|
|
162
|
-
], ActionPane.prototype, "icon", void 0);
|
|
163
|
-
__decorate([
|
|
164
|
-
property({ type: Boolean })
|
|
165
|
-
], ActionPane.prototype, "secondary", void 0);
|
|
166
|
-
__decorate([
|
|
167
|
-
property({ type: Boolean })
|
|
168
|
-
], ActionPane.prototype, "highlighted", void 0);
|
|
169
|
-
__decorate([
|
|
170
|
-
property({ type: Number })
|
|
171
|
-
], ActionPane.prototype, "level", void 0);
|
|
172
|
-
ActionPane = __decorate([
|
|
173
|
-
customElement('action-pane')
|
|
174
|
-
], ActionPane);
|
|
175
|
-
export { ActionPane };
|
|
176
|
-
//# sourceMappingURL=action-pane.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-pane.js","sourceRoot":"","sources":["../../../src/action-pane.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,aAAa,EACb,IAAI,EACJ,UAAU,EACV,QAAQ,GAET,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,SAAS,SAAS,CAAoB,IAAU,EAAE,QAAgB;IAChE,MAAM,OAAO,GACX,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;QACjC,CAAC,CAAW,IAAK,CAAC,OAAO,CAAI,QAAQ,CAAC;QACtC,CAAC,CAAC,IAAI,CAAC;IAEX,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAE5B,MAAM,IA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YACpB,KAAK,CAAC;gBACJ,OAAO,IAAI,CAAA,cAAc,KAAK,KAAK,OAAO,OAAO,CAAC;YACpD,KAAK,CAAC;gBACJ,OAAO,IAAI,CAAA,cAAc,KAAK,KAAK,OAAO,OAAO,CAAC;YACpD,KAAK,CAAC;gBACJ,OAAO,IAAI,CAAA,cAAc,KAAK,KAAK,OAAO,OAAO,CAAC;YACpD;gBACE,OAAO,IAAI,CAAA,cAAc,KAAK,KAAK,OAAO,OAAO,CAAC;SACrD;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;eACA,QAAQ,CAAC;YAChB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC;SACjC,CAAC;;QAEA,IAAI,CAAC,YAAY,EAAE;;eAEZ,CAAC;IACd,CAAC;;AAEM,iBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8ElB,CAAC;AA5IF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCACZ;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CACV;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACR;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCACjB;AAfC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAgJtB;SAhJY,UAAU","sourcesContent":["import {\n css,\n customElement,\n html,\n LitElement,\n property,\n TemplateResult,\n} from 'lit-element';\nimport { classMap } from 'lit-html/directives/class-map';\n\nimport '@material/mwc-icon';\nimport { nothing } from 'lit-html';\n\nfunction closestTo<E extends Element>(node: Node, selector: string): E | null {\n const closest =\n node.nodeType === Node.ELEMENT_NODE\n ? (<Element>node).closest<E>(selector)\n : null;\n\n if (closest) return closest;\n\n const root = <Document | DocumentFragment>node.getRootNode();\n\n if (root instanceof ShadowRoot) return closestTo(root.host, selector);\n\n return null;\n}\n\n/**\n * A responsive container rendering actions in a header.\n *\n * The \"action\" slot may contain up to eight icon buttons.\n * The \"icon\" slot, if filled overrides the icon property.\n * The default slot will be rendered into the pane body in a single column.\n */\n@customElement('action-pane')\nexport class ActionPane extends LitElement {\n /** caption text, displayed in the header */\n @property({ type: String })\n label?: string;\n /** icon name, displayed unless the \"icon\" slot is filled */\n @property({ type: String })\n icon?: string;\n /** color header with secondary theme color while focus is within */\n @property({ type: Boolean })\n secondary = false;\n /** highlight pane with dotted outline */\n @property({ type: Boolean })\n highlighted = false;\n /** nesting level, default (closest pane ancestor's level) + 1 */\n @property({ type: Number })\n level = 1;\n\n async firstUpdated(): Promise<void> {\n this.tabIndex = 0;\n\n const parentPane = closestTo<ActionPane>(this.parentNode!, 'action-pane');\n if (parentPane) this.level = parentPane.level + 1;\n\n this.level = Math.floor(this.level);\n }\n\n private renderHeader(): TemplateResult {\n const content = html`<span\n ><slot name=\"icon\"\n >${this.icon\n ? html`<mwc-icon>${this.icon}</mwc-icon>`\n : nothing}</slot\n ></span\n >\n ${this.label ?? nothing}\n <nav><slot name=\"action\"></slot></nav>`;\n\n const headingLevel = Math.floor(Math.max(this.level, 1));\n // Sometimes a TemplateResult is passed in as Label, not a string. So only when it's a string show a title.\n const title = typeof this.label === 'string' ? this.label : '';\n switch (headingLevel) {\n case 1:\n return html`<h1 title=\"${title}\">${content}</h1>`;\n case 2:\n return html`<h2 title=\"${title}\">${content}</h2>`;\n case 3:\n return html`<h3 title=\"${title}\">${content}</h3>`;\n default:\n return html`<h4 title=\"${title}\">${content}</h4>`;\n }\n }\n\n render(): TemplateResult {\n return html`<section\n class=\"${classMap({\n secondary: this.secondary,\n highlighted: this.highlighted,\n contrasted: this.level % 2 === 0,\n })}\"\n >\n ${this.renderHeader()}\n <div><slot></slot></div>\n </section>`;\n }\n\n static styles = css`\n :host {\n outline: none;\n }\n\n :host(:focus-within) section {\n box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),\n 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);\n outline-width: 4px;\n transition: all 250ms linear;\n }\n\n section {\n background-color: var(--mdc-theme-surface);\n transition: all 200ms linear;\n outline-style: solid;\n margin: 0px;\n outline-width: 0px;\n outline-color: var(--mdc-theme-primary);\n }\n\n section.secondary {\n outline-color: var(--mdc-theme-secondary);\n }\n\n section > div {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 8px 12px 16px;\n clear: right;\n }\n\n .highlighted {\n outline-style: dotted;\n outline-width: 2px;\n }\n\n :host(:focus-within) .highlighted {\n outline-style: solid;\n }\n\n .contrasted {\n background-color: var(--mdc-theme-on-primary);\n }\n\n h1,\n h2,\n h3,\n h4 {\n color: var(--mdc-theme-on-surface);\n font-family: 'Roboto', sans-serif;\n font-weight: 300;\n overflow: clip visible;\n white-space: nowrap;\n text-overflow: ellipsis;\n margin: 0px;\n line-height: 52px;\n padding-left: 0.3em;\n }\n\n nav {\n float: right;\n }\n\n mwc-icon {\n vertical-align: middle;\n position: relative;\n top: -0.1em;\n --mdc-icon-size: 1em;\n }\n\n ::slotted([slot='icon']) {\n vertical-align: middle;\n position: relative;\n top: -0.1em;\n --mdc-icon-size: 1em;\n }\n `;\n}\n"]}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { newEditEvent, newEditEventV2 } from '@openscd/core';
|
|
3
|
-
import { property, LitElement, customElement, html, } from 'lit-element';
|
|
4
|
-
import { get } from 'lit-translate';
|
|
5
|
-
import { newLogEvent } from '@openscd/core/foundation/deprecated/history.js';
|
|
6
|
-
import { newValidateEvent } from '@openscd/core/foundation/deprecated/validation.js';
|
|
7
|
-
import { isComplex, isInsert, isRemove, isUpdate, } from '@openscd/core';
|
|
8
|
-
import { convertEditActiontoV1 } from './editor/edit-action-to-v1-converter.js';
|
|
9
|
-
import { convertEditV1toV2 } from './editor/edit-v1-to-v2-converter.js';
|
|
10
|
-
let OscdEditor = class OscdEditor extends LitElement {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments);
|
|
13
|
-
/** The `XMLDocument` to be edited */
|
|
14
|
-
this.doc = null;
|
|
15
|
-
/** The name of the current [[`doc`]] */
|
|
16
|
-
this.docName = '';
|
|
17
|
-
/** The UUID of the current [[`doc`]] */
|
|
18
|
-
this.docId = '';
|
|
19
|
-
}
|
|
20
|
-
onAction(event) {
|
|
21
|
-
const edit = convertEditActiontoV1(event.detail.action);
|
|
22
|
-
const editV2 = convertEditV1toV2(edit);
|
|
23
|
-
this.host.dispatchEvent(newEditEventV2(editV2));
|
|
24
|
-
}
|
|
25
|
-
handleEditEvent(event) {
|
|
26
|
-
/**
|
|
27
|
-
* This is a compatibility fix for plugins based on open energy tools edit events
|
|
28
|
-
* because their edit event look slightly different
|
|
29
|
-
* see https://github.com/OpenEnergyTools/open-scd-core/blob/main/foundation/edit-event-v1.ts for details
|
|
30
|
-
*/
|
|
31
|
-
if (isOpenEnergyEditEvent(event)) {
|
|
32
|
-
event = convertOpenEnergyEditEventToEditEvent(event);
|
|
33
|
-
}
|
|
34
|
-
const edit = event.detail.edit;
|
|
35
|
-
const editV2 = convertEditV1toV2(edit);
|
|
36
|
-
this.host.dispatchEvent(newEditEventV2(editV2));
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
* @deprecated [Move to handleOpenDoc instead]
|
|
41
|
-
*/
|
|
42
|
-
async onOpenDoc(event) {
|
|
43
|
-
this.doc = event.detail.doc;
|
|
44
|
-
this.docName = event.detail.docName;
|
|
45
|
-
this.docId = event.detail.docId ?? '';
|
|
46
|
-
await this.updateComplete;
|
|
47
|
-
this.dispatchEvent(newValidateEvent());
|
|
48
|
-
this.dispatchEvent(newLogEvent({
|
|
49
|
-
kind: 'info',
|
|
50
|
-
title: get('openSCD.loaded', { name: this.docName }),
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
handleOpenDoc({ detail: { docName, doc } }) {
|
|
54
|
-
this.doc = doc;
|
|
55
|
-
this.docName = docName;
|
|
56
|
-
}
|
|
57
|
-
connectedCallback() {
|
|
58
|
-
super.connectedCallback();
|
|
59
|
-
// Deprecated editor action API, use 'oscd-edit' instead.
|
|
60
|
-
this.host.addEventListener('editor-action', this.onAction.bind(this));
|
|
61
|
-
// Deprecated edit event API, use 'oscd-edit-v2' instead.
|
|
62
|
-
this.host.addEventListener('oscd-edit', event => this.handleEditEvent(event));
|
|
63
|
-
this.host.addEventListener('oscd-edit-v2', event => this.handleEditEventV2(event));
|
|
64
|
-
this.host.addEventListener('open-doc', this.onOpenDoc);
|
|
65
|
-
this.host.addEventListener('oscd-open', this.handleOpenDoc);
|
|
66
|
-
}
|
|
67
|
-
render() {
|
|
68
|
-
return html `<slot></slot>`;
|
|
69
|
-
}
|
|
70
|
-
async handleEditEventV2(event) {
|
|
71
|
-
const { edit, title, squash } = event.detail;
|
|
72
|
-
this.editor.commit(edit, { title, squash });
|
|
73
|
-
await this.updateComplete;
|
|
74
|
-
this.dispatchEvent(newValidateEvent());
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
__decorate([
|
|
78
|
-
property({ attribute: false })
|
|
79
|
-
], OscdEditor.prototype, "doc", void 0);
|
|
80
|
-
__decorate([
|
|
81
|
-
property({ type: String })
|
|
82
|
-
], OscdEditor.prototype, "docName", void 0);
|
|
83
|
-
__decorate([
|
|
84
|
-
property({ type: String })
|
|
85
|
-
], OscdEditor.prototype, "docId", void 0);
|
|
86
|
-
__decorate([
|
|
87
|
-
property({ type: Object })
|
|
88
|
-
], OscdEditor.prototype, "editor", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
property({
|
|
91
|
-
type: Object,
|
|
92
|
-
})
|
|
93
|
-
], OscdEditor.prototype, "host", void 0);
|
|
94
|
-
OscdEditor = __decorate([
|
|
95
|
-
customElement('oscd-editor')
|
|
96
|
-
], OscdEditor);
|
|
97
|
-
export { OscdEditor };
|
|
98
|
-
function isOpenEnergyEditEvent(event) {
|
|
99
|
-
const eventDetail = event.detail;
|
|
100
|
-
return isComplex(eventDetail) || isInsert(eventDetail) || isUpdate(eventDetail) || isRemove(eventDetail);
|
|
101
|
-
}
|
|
102
|
-
function convertOpenEnergyEditEventToEditEvent(event) {
|
|
103
|
-
const eventDetail = event.detail;
|
|
104
|
-
return newEditEvent(eventDetail);
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=Editor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../../src/addons/Editor.ts"],"names":[],"mappings":";AAAA,OAAO,EAGL,YAAY,EACZ,cAAc,EAEf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,aAAa,EAEb,IAAI,GACL,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAGrF,OAAO,EAGL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAGjE,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACL,qCAAqC;QAErC,QAAG,GAAuB,IAAI,CAAC;QAC/B,wCAAwC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ADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uCACA;AAEH;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAc;AAEb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAY;AAEX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAoB;AAK/C;IAHC,QAAQ,CAAC;QACR,IAAI,EAAE,MAAM;KACb,CAAC;wCACiB;AAdR,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA0FtB;SA1FY,UAAU;AA4FvB,SAAS,qBAAqB,CAAC,KAA2B;IACxD,MAAM,WAAW,GAAG,KAAK,CAAC,MAAc,CAAC;IACzC,OAAO,SAAS,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC3G,CAAC;AAED,SAAS,qCAAqC,CAAC,KAA2B;IACxE,MAAM,WAAW,GAAG,KAAK,CAAC,MAAc,CAAC;IACzC,OAAO,YAAY,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import {\n EditEventV2,\n OpenEvent,\n newEditEvent,\n newEditEventV2,\n XMLEditor\n} from '@openscd/core';\nimport {\n property,\n LitElement,\n customElement,\n TemplateResult,\n html,\n} from 'lit-element';\nimport { get } from 'lit-translate';\n\nimport {\n EditorAction,\n EditorActionEvent,\n} from '@openscd/core/foundation/deprecated/editor.js';\n\nimport { newLogEvent } from '@openscd/core/foundation/deprecated/history.js';\nimport { newValidateEvent } from '@openscd/core/foundation/deprecated/validation.js';\nimport { OpenDocEvent } from '@openscd/core/foundation/deprecated/open-event.js';\n\nimport {\n Edit,\n EditEvent,\n isComplex,\n isInsert,\n isRemove,\n isUpdate,\n} from '@openscd/core';\n\nimport { convertEditActiontoV1 } from './editor/edit-action-to-v1-converter.js';\nimport { convertEditV1toV2 } from './editor/edit-v1-to-v2-converter.js';\n\n@customElement('oscd-editor')\nexport class OscdEditor extends LitElement {\n /** The `XMLDocument` to be edited */\n @property({ attribute: false })\n doc: XMLDocument | null = null;\n /** The name of the current [[`doc`]] */\n @property({ type: String }) docName = '';\n /** The UUID of the current [[`doc`]] */\n @property({ type: String }) docId = '';\n /** XML Editor to apply changes to the scd */\n @property({ type: Object }) editor!: XMLEditor;\n\n @property({\n type: Object,\n })\n host!: HTMLElement;\n\n private onAction(event: EditorActionEvent<EditorAction>) {\n const edit = convertEditActiontoV1(event.detail.action);\n const editV2 = convertEditV1toV2(edit);\n\n this.host.dispatchEvent(newEditEventV2(editV2));\n }\n\n handleEditEvent(event: EditEvent) {\n /**\n * This is a compatibility fix for plugins based on open energy tools edit events\n * because their edit event look slightly different\n * see https://github.com/OpenEnergyTools/open-scd-core/blob/main/foundation/edit-event-v1.ts for details\n */\n if (isOpenEnergyEditEvent(event)) {\n event = convertOpenEnergyEditEventToEditEvent(event);\n }\n\n const edit = event.detail.edit;\n const editV2 = convertEditV1toV2(edit);\n\n this.host.dispatchEvent(newEditEventV2(editV2));\n }\n\n /**\n *\n * @deprecated [Move to handleOpenDoc instead]\n */\n private async onOpenDoc(event: OpenDocEvent) {\n this.doc = event.detail.doc;\n this.docName = event.detail.docName;\n this.docId = event.detail.docId ?? '';\n\n await this.updateComplete;\n\n this.dispatchEvent(newValidateEvent());\n\n this.dispatchEvent(\n newLogEvent({\n kind: 'info',\n title: get('openSCD.loaded', { name: this.docName }),\n })\n );\n }\n\n handleOpenDoc({ detail: { docName, doc } }: OpenEvent) {\n this.doc = doc;\n this.docName = docName;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n\n // Deprecated editor action API, use 'oscd-edit' instead.\n this.host.addEventListener('editor-action', this.onAction.bind(this));\n // Deprecated edit event API, use 'oscd-edit-v2' instead.\n this.host.addEventListener('oscd-edit', event => this.handleEditEvent(event));\n\n this.host.addEventListener('oscd-edit-v2', event => this.handleEditEventV2(event));\n this.host.addEventListener('open-doc', this.onOpenDoc);\n this.host.addEventListener('oscd-open', this.handleOpenDoc);\n }\n\n render(): TemplateResult {\n return html`<slot></slot>`;\n }\n\n async handleEditEventV2(event: EditEventV2) {\n const { edit, title, squash } = event.detail;\n\n this.editor.commit(edit, { title, squash });\n\n await this.updateComplete;\n this.dispatchEvent(newValidateEvent());\n }\n}\n\nfunction isOpenEnergyEditEvent(event: CustomEvent<unknown>): boolean {\n const eventDetail = event.detail as Edit;\n return isComplex(eventDetail) || isInsert(eventDetail) || isUpdate(eventDetail) || isRemove(eventDetail);\n}\n\nfunction convertOpenEnergyEditEventToEditEvent(event: CustomEvent<unknown>): EditEvent {\n const eventDetail = event.detail as Edit;\n return newEditEvent(eventDetail);\n}\n"]}
|