-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: complete UX API rework of panel-plugins
- Loading branch information
Showing
21 changed files
with
298 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Default theme definition | ||
html { | ||
--uip-prview-max-height: 500px; | ||
|
||
--uip-plugin-fg: #000; | ||
--uip-plugin-bg: #f5f2f0; | ||
--uip-plugin-divider: #ccc; | ||
--uip-plugin-divider-v: #ebebeb; | ||
--uip-plugin-header-bg: #ccc; | ||
--uip-plugin-header-fg: #000; | ||
} | ||
|
||
// Default dark theme definition | ||
[dark-theme] { | ||
--uip-plugin-fg: #ccc; | ||
--uip-plugin-bg: #2f2f2f; | ||
--uip-plugin-divider: #ebebeb; | ||
--uip-plugin-divider-v: #ebebeb; | ||
--uip-plugin-header-bg: #2f2f2f; | ||
--uip-plugin-header-fg: #ccc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,9 @@ | |
&-inner { | ||
padding: 10px; | ||
} | ||
|
||
&-inner-bg { | ||
color: var(--uip-plugin-fg); | ||
background: var(--uip-plugin-bg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
.uip-plugin-header { | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
|
||
flex: 0 0 auto; | ||
|
||
color: var(--uip-plugin-header-fg, #000); | ||
background: var(--uip-plugin-header-bg, transparent); | ||
|
||
font-weight: 500; | ||
|
||
.uip-plugin[label] &, | ||
.uip-plugin[collapsible] & { | ||
padding: 2px 10px; | ||
} | ||
|
||
&-icon { | ||
display: inline-flex; | ||
width: 1.25rem; | ||
height: 1.25rem; | ||
margin-inline-end: 5px; | ||
transform-origin: center center; | ||
|
||
> svg { | ||
fill: currentColor; | ||
stroke: currentColor; | ||
} | ||
} | ||
|
||
&-title { | ||
margin-inline-end: auto; | ||
} | ||
|
||
&-title:not(:empty) { | ||
flex: 1 1 auto; | ||
padding: 5px; | ||
line-height: 1em; | ||
} | ||
|
||
&-trigger { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
z-index: 1; | ||
|
||
background: transparent; | ||
border: none; | ||
box-shadow: none; | ||
appearance: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.uip-plugin-panel { | ||
display: flex; | ||
position: relative; | ||
max-height: var(--uip-prview-max-height); | ||
|
||
.no-animate & .uip-plugin-inner { | ||
transition: none; | ||
} | ||
} | ||
|
||
@import "./plugin-panel.header.less"; | ||
@import "./plugin-panel.horizontal.less"; | ||
@import "./plugin-panel.vertical.less"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import {CSSClassUtils} from '@exadel/esl/modules/esl-utils/dom'; | ||
import {skipOneRender} from '@exadel/esl/modules/esl-utils/async'; | ||
import {ESLMediaQuery} from '@exadel/esl/modules/esl-media-query/core'; | ||
import {attr, boolAttr, listen} from '@exadel/esl/modules/esl-utils/decorators'; | ||
|
||
import {UIPPlugin} from '../base/plugin'; | ||
|
||
export class UIPPluginPanel extends UIPPlugin { | ||
|
||
public static observedAttributes: string[] = ['vertical', 'collapsed', 'compact', ...UIPPlugin.observedAttributes]; | ||
|
||
/** Marker to make header compact */ | ||
@boolAttr() public compact: boolean; | ||
|
||
/** Marker to collapse editor area */ | ||
@boolAttr() public collapsed: boolean; | ||
|
||
/** Marker to make enable toggle collapse action for section header */ | ||
@boolAttr() public collapsible: boolean; | ||
|
||
/** Marker to make plugin panel vertical */ | ||
@attr({defaultValue: 'not all'}) public vertical: string; | ||
|
||
protected override connectedCallback(): void { | ||
super.connectedCallback(); | ||
this.classList.add('uip-plugin-panel'); | ||
this._onLayoutModeChange(); | ||
} | ||
|
||
protected attributeChangedCallback(attrName: string, oldVal: string, newVal: string): void { | ||
super.attributeChangedCallback(attrName, oldVal, newVal); | ||
const type = this.constructor as typeof UIPPluginPanel; | ||
if (attrName === 'vertical') { | ||
this.$$off(this._onLayoutModeChange); | ||
this.$$on(this._onLayoutModeChange); | ||
this._onLayoutModeChange(); | ||
} | ||
if (attrName === 'compact') { | ||
this.root?.classList.toggle(type.is + '-compact', this.compact); | ||
} | ||
} | ||
|
||
/** Handle collapsing trigger clicks */ | ||
@listen({ | ||
event: 'click', | ||
selector: '.uip-plugin-header-trigger', | ||
}) | ||
protected _onCollapseClick(): void { | ||
if (this.collapsible) this.collapsed = !this.collapsed; | ||
} | ||
|
||
@listen({ | ||
event: 'change', | ||
target: (settings: UIPPluginPanel) => ESLMediaQuery.for(settings.vertical) | ||
}) | ||
protected _onLayoutModeChange(): void { | ||
const type = this.constructor as typeof UIPPluginPanel; | ||
const isVertical = ESLMediaQuery.for(this.vertical).matches; | ||
this.$$cls('vertical', isVertical); | ||
this.root && CSSClassUtils.toggle(this.root, type.is + '-vertical', isVertical); | ||
this.root && CSSClassUtils.add(this.root, 'no-animate', this); | ||
skipOneRender(() => this.root && CSSClassUtils.remove(this.root, 'no-animate', this)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.uip-plugin-panel.vertical.vertical { | ||
--uip-plugin-header-bg: transparent; | ||
|
||
grid-area: sidebar; | ||
flex-direction: row; | ||
|
||
.uip-plugin-inner { | ||
width: 250px; | ||
max-width: 250px; | ||
max-height: 100%; | ||
|
||
transition: | ||
visibility 0s linear, | ||
padding-left 0.3s linear, | ||
padding-right 0.3s linear, | ||
max-width 0.3s linear; | ||
} | ||
|
||
&[collapsed] .uip-plugin-inner { | ||
max-width: 0; | ||
padding-left: 0; | ||
padding-right: 0; | ||
|
||
transition: | ||
visibility 0.3s linear, | ||
padding-left 0.3s linear, | ||
padding-right 0.3s linear, | ||
max-width 0.3s linear; | ||
} | ||
|
||
.uip-plugin-header { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
padding: 10px 4px; | ||
border-inline-end: 1px solid var(--uip-plugin-divider-v, transparent); | ||
} | ||
|
||
.uip-plugin-header-title { | ||
display: none; | ||
} | ||
|
||
.uip-plugin-header-icon { | ||
width: 1.25rem; | ||
margin-inline-end: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
@import "./base/base.less"; | ||
@import './base/root.less'; | ||
@import './base/plugin.less'; | ||
|
||
@import './panel/plugin-panel.less'; | ||
|
||
@import './preview/preview.less'; |
Oops, something went wrong.