fix(core): update

This commit is contained in:
Philipp Kunz 2023-01-13 00:30:56 +01:00
parent 310910e8ee
commit 2abd91ab4a
6 changed files with 273 additions and 510 deletions

View File

@ -23,7 +23,7 @@
"@fortawesome/free-regular-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",
"@pushrocks/smartpromise": "^3.1.7",
"@tsclass/tsclass": "^4.0.28",
"@tsclass/tsclass": "^4.0.29",
"pdfjs-dist": "^2.15.349"
},
"devDependencies": {

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@designestate/dees-catalog',
version: '1.0.135',
version: '1.0.136',
description: 'website for lossless.com'
}

View File

@ -11,6 +11,7 @@ import {
} from '@designestate/dees-element';
import * as domtools from '@designestate/dees-domtools';
import { DeesWindowLayer } from './dees-windowlayer.js';
declare global {
interface HTMLElementTagNameMap {
@ -20,24 +21,53 @@ declare global {
@customElement('dees-contextmenu')
export class DeesContextmenu extends DeesElement {
// DEMO
public static demo = () => html`
<dees-button>Hello</dees-button>
<dees-contextmenu .menuItems=${[
{
name: 'copy',
action: async () => {}
},
{
name: 'edit',
action: async () => {}
<style>
.withMargin {
display: block;
margin: 20px;
}
] as plugins.tsclass.website.IMenuItem[]}></dees-contextmenu>
</style>
<dees-button @click=${() => {
DeesContextmenu.openContextMenuWithOptions();
}}>Hello</dees-button>
<dees-contextmenu class="withMargin"></dees-contextmenu>
<dees-contextmenu
class="withMargin"
.menuItems=${[
{
name: 'copy',
iconName: 'copySolid',
action: async () => {},
},
{
name: 'edit',
iconName: 'penToSquare',
action: async () => {},
},{
name: 'paste',
iconName: 'pasteSolid',
action: async () => {},
},
] as plugins.tsclass.website.IMenuItem[]}
></dees-contextmenu>
`;
@property({
type: Array,
})
public menuItems: plugins.tsclass.website.IMenuItem[] = [];
// STATIC
public static openContextMenuWithOptions(eventArg, contextOptions: plugins.tsclass.website.IMenuItem[]) {
const contextMenu = new DeesContextmenu();
contextMenu.style.position = 'absolute';
contextMenu;
const windowLayer = new DeesWindowLayer();
windowLayer.append(contextMenu);
document.body.append(windowLayer);
}
@property({
type: Array,
})
public menuItems: plugins.tsclass.website.IMenuItem[] = [];
constructor() {
super();
@ -48,48 +78,62 @@ public menuItems: plugins.tsclass.website.IMenuItem[] = [];
css`
:host {
display: block;
box-sizing: border-box;
}
.mainbox {
color: ${cssManager.bdTheme('#222', '#ccc')};
font-size: 14px;
width: 200px;
border: 1px solid #444;
min-height: 40px;
border-radius: 3px;
background: #222;
box-shadow: 0px 1px 4px #000;
user-select: none;
}
.mainbox .menuitem {
padding: 8px;
}
.mainbox .menuitem dees-icon {
display: inline-block;
margin-right: 8px;
width: 14px;
transform: translateY(2px);
}
.mainbox .menuitem:hover {
cursor: pointer;
background: #ffffff10;
}
.mainbox .menuitem:active {
cursor: pointer;
background: #ffffff05;
}
`,
];
public render(): TemplateResult {
return html`
<div class="mainbox">
${this.menuItems.map((menuItemArg) => {
return html`
<div class="menuitem">
<dees-icon .iconFA=${(menuItemArg.iconName as any) || 'minus'}></dees-icon
>${menuItemArg.name}
</div>
`;
})}
</div>
`;
}
public async firstUpdated() {
if (!this.textContent) {
this.textContent = 'Button';
this.performUpdate();
if (!this.menuItems || this.menuItems.length === 0) {
const mainbox = this.shadowRoot.querySelector('.mainbox');
mainbox.textContent = 'no menu items present';
}
}
public async selectChip(chipArg: string) {
if (this.selectionMode === 'single') {
if (this.selectedChip === chipArg) {
this.selectedChip = null;
this.selectedChips = [];
} else {
this.selectedChip = chipArg;
this.selectedChips = [chipArg];
}
} else if (this.selectionMode === 'multiple') {
if (this.selectedChips.includes(chipArg)) {
this.selectedChips = this.selectedChips.filter((chipArg2) => chipArg !== chipArg2);
} else {
this.selectedChips.push(chipArg);
}
this.requestUpdate();
}
console.log(this.selectedChips);
}
}

View File

@ -22,19 +22,28 @@ import {
} from '@fortawesome/free-brands-svg-icons';
import {
faCopy as faCopyRegular,
faMessage as faMessageRegular,
faPaste as faPasteRegular,
faSun as faSunRegular,
} from '@fortawesome/free-regular-svg-icons';
import {
faArrowRight as faArrowRightSolid,
faArrowUpRightFromSquare as faArrowUpRightFromSquareSolid,
faBell as faBellSolid,
faBug as faBugSolid,
faBuilding as faBuildingSolid,
faCaretLeft as faCaretLeftSolid,
faCaretRight as faCaretRightSolid,
faCheck as faCheckSolid,
faCircleInfo as faCircleInfoSolid,
faCopy as faCopySolid,
faDesktop as faDesktopSolid,
faGrip as faGripSolid,
faMessage as faMessageSolid,
faMinus as faMinusSolid,
faPaste as faPasteSolid,
faPenToSquare as faPenToSquareSolid,
faRss as faRssSolid,
faUsers as faUsersSolid,
faShare as faShareSolid,
@ -44,6 +53,7 @@ import {
export const faIcons = {
// normal
arrowRight: faArrowRightSolid,
arrowUpRightFromSquare: faArrowUpRightFromSquareSolid,
arrowUpRightFromSquareSolid: faArrowUpRightFromSquareSolid,
bell: faBellSolid,
@ -54,14 +64,26 @@ export const faIcons = {
buildingSolid: faBuildingSolid,
caretLeft: faCaretLeftSolid,
caretLeftSolid: faCaretLeftSolid,
caretRight: faCaretRightSolid,
caretRightSolid: faCaretRightSolid,
check: faCheckSolid,
checkSolid: faCheckSolid,
circleinfo: faCircleInfoSolid,
circleinfoSolid: faCircleInfoSolid,
copy: faCopyRegular,
copySolid: faCopySolid,
desktop: faDesktopSolid,
desktopSolid: faDesktopSolid,
grip: faGripSolid,
gripSolid: faGripSolid,
message: faMessageRegular,
messageSolid: faMessageSolid,
minus: faMinusSolid,
minusSolid: faMinusSolid,
paste: faPasteRegular,
pasteSolid: faPasteSolid,
penToSquare: faPenToSquareSolid,
penToSquareSolid: faPenToSquareSolid,
rss: faRssSolid,
rssSolid: faRssSolid,
share: faShareSolid,

View File

@ -23,6 +23,8 @@ export class DeesSpinner extends DeesElement {
<dees-spinner></dees-spinner>
<dees-spinner status="success"></dees-spinner>
<dees-spinner status="error"></dees-spinner>
<dees-spinner size=${64} status="success"></dees-spinner>
<dees-spinner .size=${64} status="error"></dees-spinner>
`;
@property({
@ -45,6 +47,7 @@ export class DeesSpinner extends DeesElement {
}
#loading {
position: relative;
transition: none;
display: flex;
justify-content: center;
@ -84,36 +87,11 @@ export class DeesSpinner extends DeesElement {
}
}
#loading .checkmark {
display: inline-block;
width: 22px;
height: 22px;
-ms-transform: rotate(45deg); /* IE 9 */
-webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */
transform: rotate(45deg);
}
#loading .checkmark_stem {
dees-icon {
color: #fff;
position: absolute;
width: 3px;
height: 9px;
background-color: #fff;
left: 9px;
top: 5px;
}
#loading .checkmark_kick {
position: absolute;
width: 3px;
height: 3px;
background-color: #fff;
left: 6px;
top: 11px;
}
#loading.disabled .checkmark_stem,
#loading.disabled .checkmark_kick {
background-color: ${cssManager.bdTheme('#333', '#fff')};
height: 100%;
width: 100%;
}
`,
];
@ -125,16 +103,18 @@ export class DeesSpinner extends DeesElement {
width: ${this.size}px;
height: ${this.size}px;
}
dees-icon {
font-size: ${Math.round(this.size * 0.6)}px;
}
</style>
<div class="${this.status}" id="loading">
${this.status === 'success' || this.status === 'error'
? html`
<span class="checkmark">
<div class="checkmark_stem"></div>
<div class="checkmark_kick"></div>
</span>
`
: null}
${(() => {
if (this.status === 'success') {
return html`<dees-icon style="transform: translateX(1%) translateY(3%);" .iconFA=${'check' as any}></dees-icon>`;
} else if (this.status === 'error') {
return html`<dees-icon .iconFA=${'xmark' as any}></dees-icon>`;
}
})()}
</div>
`;
}