|
| 1 | +import { css } from 'lit-element'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Enumeration stating the Subscribe status of a IED to a GOOSE. |
| 5 | + */ |
| 6 | +export enum SubscribeStatus { |
| 7 | + Full, |
| 8 | + Partial, |
| 9 | + None, |
| 10 | +} |
| 11 | + |
| 12 | +export interface GOOSESelectDetail { |
| 13 | + gseControl: Element; |
| 14 | + dataset: Element; |
| 15 | +} |
| 16 | +export type GOOSESelectEvent = CustomEvent<GOOSESelectDetail>; |
| 17 | +export function newGOOSESelectEvent( |
| 18 | + gseControl: Element, |
| 19 | + dataset: Element, |
| 20 | + eventInitDict?: CustomEventInit<GOOSESelectDetail> |
| 21 | +): GOOSESelectEvent { |
| 22 | + return new CustomEvent<GOOSESelectDetail>('goose-dataset', { |
| 23 | + bubbles: true, |
| 24 | + composed: true, |
| 25 | + ...eventInitDict, |
| 26 | + detail: { gseControl, dataset, ...eventInitDict?.detail }, |
| 27 | + }); |
| 28 | +} |
| 29 | + |
| 30 | +export interface IEDSubscriptionDetail { |
| 31 | + element: Element; |
| 32 | + subscribeStatus: SubscribeStatus; |
| 33 | +} |
| 34 | +export type IEDSubscriptionEvent = CustomEvent<IEDSubscriptionDetail>; |
| 35 | +export function newIEDSubscriptionEvent( |
| 36 | + element: Element, |
| 37 | + subscribeStatus: SubscribeStatus |
| 38 | +): IEDSubscriptionEvent { |
| 39 | + return new CustomEvent<IEDSubscriptionDetail>('ied-subscription', { |
| 40 | + bubbles: true, |
| 41 | + composed: true, |
| 42 | + detail: { element, subscribeStatus }, |
| 43 | + }); |
| 44 | +} |
| 45 | + |
| 46 | +/** Common `CSS` styles used by DataTypeTemplate subeditors */ |
| 47 | +export const styles = css` |
| 48 | + :host(.moving) section { |
| 49 | + opacity: 0.3; |
| 50 | + } |
| 51 | +
|
| 52 | + section { |
| 53 | + background-color: var(--mdc-theme-surface); |
| 54 | + transition: all 200ms linear; |
| 55 | + outline-color: var(--mdc-theme-primary); |
| 56 | + outline-style: solid; |
| 57 | + outline-width: 0px; |
| 58 | + opacity: 1; |
| 59 | + } |
| 60 | +
|
| 61 | + section:focus { |
| 62 | + box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14), |
| 63 | + 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2); |
| 64 | + } |
| 65 | +
|
| 66 | + section:focus-within { |
| 67 | + outline-width: 2px; |
| 68 | + transition: all 250ms linear; |
| 69 | + } |
| 70 | +
|
| 71 | + h1, |
| 72 | + h2, |
| 73 | + h3 { |
| 74 | + color: var(--mdc-theme-on-surface); |
| 75 | + font-family: 'Roboto', sans-serif; |
| 76 | + font-weight: 300; |
| 77 | + overflow: hidden; |
| 78 | + white-space: nowrap; |
| 79 | + text-overflow: ellipsis; |
| 80 | + margin: 0px; |
| 81 | + line-height: 48px; |
| 82 | + padding-left: 0.3em; |
| 83 | + transition: background-color 150ms linear; |
| 84 | + } |
| 85 | +
|
| 86 | + section:focus-within > h1, |
| 87 | + section:focus-within > h2, |
| 88 | + section:focus-within > h3 { |
| 89 | + color: var(--mdc-theme-surface); |
| 90 | + background-color: var(--mdc-theme-primary); |
| 91 | + transition: background-color 200ms linear; |
| 92 | + } |
| 93 | +
|
| 94 | + h1 > nav, |
| 95 | + h2 > nav, |
| 96 | + h3 > nav, |
| 97 | + h1 > abbr > mwc-icon-button, |
| 98 | + h2 > abbr > mwc-icon-button, |
| 99 | + h3 > abbr > mwc-icon-button { |
| 100 | + float: right; |
| 101 | + } |
| 102 | +
|
| 103 | + abbr[title] { |
| 104 | + border-bottom: none !important; |
| 105 | + cursor: inherit !important; |
| 106 | + text-decoration: none !important; |
| 107 | + } |
| 108 | +`; |
| 109 | + |
| 110 | +declare global { |
| 111 | + interface ElementEventMap { |
| 112 | + ['goose-dataset']: GOOSESelectEvent; |
| 113 | + ['ied-subscription']: IEDSubscriptionEvent; |
| 114 | + } |
| 115 | +} |
0 commit comments