@limetech/lime-elements 37.69.1 → 37.70.1
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/CHANGELOG.md +16 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-card.cjs.entry.js +1 -1
- package/dist/cjs/limel-card.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +5 -9
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js +2 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/card/card.css +18 -16
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +6 -10
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/collection/components/text-editor/text-editor.js +2 -1
- package/dist/collection/components/text-editor/text-editor.js.map +1 -1
- package/dist/collection/style/mixins.scss +95 -0
- package/dist/collection/util/3d-tilt-hover-effect.js +124 -0
- package/dist/collection/util/3d-tilt-hover-effect.js.map +1 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-card.entry.js +1 -1
- package/dist/esm/limel-card.entry.js.map +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +6 -10
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/esm/limel-text-editor.entry.js +2 -1
- package/dist/esm/limel-text-editor.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/{p-8d388c5c.entry.js → p-78b1aac6.entry.js} +2 -2
- package/dist/lime-elements/p-78b1aac6.entry.js.map +1 -0
- package/dist/lime-elements/p-a82a82b7.entry.js +2 -0
- package/dist/lime-elements/p-a82a82b7.entry.js.map +1 -0
- package/dist/lime-elements/p-ca929a0e.entry.js +2 -0
- package/dist/lime-elements/p-ca929a0e.entry.js.map +1 -0
- package/dist/lime-elements/style/mixins.scss +95 -0
- package/dist/scss/mixins.scss +95 -0
- package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +2 -2
- package/dist/types/util/3d-tilt-hover-effect.d.ts +93 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-617cfacf.entry.js +0 -2
- package/dist/lime-elements/p-617cfacf.entry.js.map +0 -1
- package/dist/lime-elements/p-7f9e0f52.entry.js +0 -2
- package/dist/lime-elements/p-7f9e0f52.entry.js.map +0 -1
- package/dist/lime-elements/p-8d388c5c.entry.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,c as r,h as i}from"./p-443111b3.js";import{i as o}from"./p-91741e79.js";import{g as a}from"./p-2f777fdb.js";const t='@charset "UTF-8";*{box-sizing:border-box;min-width:0;min-height:0}:host(limel-card){display:flex;border-radius:var(--card-border-radius, 0.95rem)}section{box-sizing:border-box;display:flex;gap:0.5rem;flex-direction:column;border-radius:var(--card-border-radius, 0.95rem);border:1px solid rgb(var(--contrast-500));padding:0.25rem;background-color:var(--card-background-color, rgb(var(--contrast-300)))}:host(limel-card[orientation=landscape]) section{flex-direction:row}:host(limel-card[clickable]) section{transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--card-background-color, rgb(var(--contrast-200)))}:host(limel-card[clickable]) section:focus{outline:none}:host(limel-card[clickable]) section:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limel-card[clickable]) section:hover,:host(limel-card[clickable]) section:focus,:host(limel-card[clickable]) section:focus-visible{will-change:color, background-color, box-shadow, transform}:host(limel-card[clickable]) section:hover{transform:translate3d(0, 0.01rem, 0);color:var(--mdc-theme-on-surface);background-color:var(--card-background-color--hovered, var(--card-background-color, rgb(var(--contrast-200))));box-shadow:var(--button-shadow-hovered)}:host(limel-card[clickable]) section:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}:host(limel-card[clickable]) section:hover,:host(limel-card[clickable]) section:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host(limel-card[clickable]:hover) section{border-color:transparent}.body{flex-grow:1;display:flex;flex-direction:column;gap:0.5rem}img{transition:filter 0.6s ease;object-fit:cover;border-radius:calc(var(--card-border-radius, 0.95rem) / 1.4)}:host(limel-card[orientation=portrait]) img{width:100%}:host(limel-card[orientation=landscape]) img{max-width:40%;height:100%}section:hover img,section:focus-visible img{transition-duration:0.2s;filter:saturate(1.3)}limel-markdown{padding:0.5rem 0.75rem}header{display:flex;justify-content:center;gap:0.5rem;padding:0.25rem 0.75rem}:host(limel-card[orientation=landscape]) header{padding-top:0.5rem}header:has(limel-icon){padding-left:0.25rem}header .headings{flex-grow:1;display:flex;flex-direction:column;gap:0.125rem}header limel-icon{flex-shrink:0;width:2rem}header h1{font-size:1.125rem;font-weight:500;color:var(--card-heading-color, rgb(var(--contrast-1100)));letter-spacing:-0.03125rem}header h2{font-size:0.875rem;font-weight:400;color:var(--card-subheading-color, rgb(var(--contrast-1000)))}header h1,header h2{word-break:break-word;hyphens:auto;-webkit-hyphens:auto;margin:0}limel-action-bar{--action-bar-background-color:transparent;padding:0.5rem;margin-left:auto}';const n=class{constructor(i){e(this,i);this.actionSelected=r(this,"actionSelected",7);this.handleActionSelect=e=>{e.stopPropagation();if(o(e.detail)){this.actionSelected.emit(e.detail)}};this.heading=undefined;this.subheading=undefined;this.image=undefined;this.icon=undefined;this.value=undefined;this.actions=[];this.clickable=false;this.orientation="portrait"}render(){return i("section",{tabindex:this.clickable?0:""},this.renderImage(),i("div",{class:"body"},this.renderHeader(),this.renderSlot(),this.renderValue(),this.renderActionBar()))}renderImage(){if(!this.image){return}return i("img",{src:this.image.src,alt:this.image.alt,loading:"lazy"})}renderHeader(){if(!this.heading&&!this.subheading&&!this.icon){return}return i("header",null,this.renderIcon(),i("div",{class:"headings"},this.renderHeading(),this.renderSubheading()))}renderIcon(){var e;const r=a(this.icon);const o=typeof this.icon!=="string"?(e=this.icon)===null||e===void 0?void 0:e.color:undefined;if(!r){return}return i("limel-icon",{style:{color:`${o}`},badge:true,name:r})}renderHeading(){if(!this.heading){return}return i("h1",null,this.heading)}renderSubheading(){if(!this.subheading){return}return i("h2",null,this.subheading)}renderSlot(){return i("slot",{name:"component"})}renderValue(){return i("limel-markdown",{value:this.value})}renderActionBar(){if(!this.actions.length){return}return i("limel-action-bar",{actions:this.actions,onItemSelected:this.handleActionSelect})}};n.style=t;export{n as limel_card};
|
|
2
|
+
//# sourceMappingURL=p-ca929a0e.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["cardCss","Card","this","handleActionSelect","event","stopPropagation","isItem","detail","actionSelected","emit","render","h","tabindex","clickable","renderImage","class","renderHeader","renderSlot","renderValue","renderActionBar","image","src","alt","loading","heading","subheading","icon","renderIcon","renderHeading","renderSubheading","getIconName","color","_a","undefined","style","badge","name","value","actions","length","onItemSelected"],"sources":["./src/components/card/card.scss?tag=limel-card&encapsulation=shadow","./src/components/card/card.tsx"],"sourcesContent":["/**\n* @prop --card-heading-color: color of the heading. Defaults to `--contrast-1100`;\n* @prop --card-subheading-color: color of the sub heading. Defaults to `--contrast-1000`;\n* @prop --card-border-radius: border radius of the card. Defaults to `0.95rem`;\n* @prop --card-background-color: background color of the card.\n* @prop --card-background-color--hovered: background color of the card, when hovered.\n*/\n\n@use '../../style/mixins';\n\n$default-border-radius: 0.95rem;\n\n* {\n box-sizing: border-box;\n min-width: 0;\n min-height: 0;\n}\n\n:host(limel-card) {\n display: flex;\n border-radius: var(--card-border-radius, $default-border-radius);\n}\n\nsection {\n box-sizing: border-box;\n\n display: flex;\n gap: 0.5rem;\n\n flex-direction: column;\n :host(limel-card[orientation='landscape']) & {\n flex-direction: row;\n }\n\n border-radius: var(--card-border-radius, $default-border-radius);\n border: 1px solid rgb(var(--contrast-500));\n\n padding: 0.25rem;\n background-color: var(--card-background-color, rgb(var(--contrast-300)));\n\n :host(limel-card[clickable]) & {\n @include mixins.visualize-keyboard-focus;\n @include mixins.is-flat-clickable(\n $background-color:\n var(--card-background-color, rgb(var(--contrast-200))),\n $background-color--hovered:\n var(\n --card-background-color--hovered,\n var(--card-background-color, rgb(var(--contrast-200)))\n )\n );\n }\n\n :host(limel-card[clickable]:hover) & {\n border-color: transparent;\n }\n}\n\n.body {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\nimg {\n transition: filter 0.6s ease;\n object-fit: cover;\n border-radius: calc(\n var(--card-border-radius, $default-border-radius) / 1.4\n );\n :host(limel-card[orientation='portrait']) & {\n width: 100%;\n }\n\n :host(limel-card[orientation='landscape']) & {\n max-width: 40%;\n height: 100%;\n }\n\n section:hover &,\n section:focus-visible & {\n transition-duration: 0.2s;\n filter: saturate(1.3);\n }\n}\n\nlimel-markdown {\n padding: 0.5rem 0.75rem;\n}\n\nheader {\n display: flex;\n justify-content: center;\n\n gap: 0.5rem;\n\n padding: 0.25rem 0.75rem;\n :host(limel-card[orientation='landscape']) & {\n padding-top: 0.5rem;\n }\n\n &:has(limel-icon) {\n padding-left: 0.25rem;\n }\n\n .headings {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n }\n\n limel-icon {\n flex-shrink: 0;\n width: 2rem;\n }\n\n h1 {\n font-size: 1.125rem;\n font-weight: 500;\n color: var(--card-heading-color, rgb(var(--contrast-1100)));\n letter-spacing: -0.03125rem; // 0.5px\n }\n\n h2 {\n font-size: 0.875rem;\n font-weight: 400;\n color: var(--card-subheading-color, rgb(var(--contrast-1000)));\n }\n\n h1,\n h2 {\n word-break: break-word;\n hyphens: auto;\n -webkit-hyphens: auto;\n margin: 0;\n }\n}\n\nlimel-action-bar {\n --action-bar-background-color: transparent;\n padding: 0.5rem;\n margin-left: auto;\n}\n","import { Component, h, Prop, Event, EventEmitter } from '@stencil/core';\nimport { Image } from '../../global/shared-types/image.types';\nimport { Icon } from '../../global/shared-types/icon.types';\nimport { isItem } from '../action-bar/isItem';\nimport { getIconName } from '../icon/get-icon-props';\nimport { ListSeparator } from '../../global/shared-types/separator.types';\nimport { ActionBarItem } from '../action-bar/action-bar.types';\n\n/**\n * Card is a component that displays content about a single topic,\n * in a structured way. It can contain a header, and some supporting media such\n * as an image or an icon, a body of text, or optional actions.\n *\n * @exampleComponent limel-example-card-basic\n * @exampleComponent limel-example-card-image\n * @exampleComponent limel-example-card-actions\n * @exampleComponent limel-example-card-clickable\n * @exampleComponent limel-example-card-orientation\n * @exampleComponent limel-example-card-slot\n * @exampleComponent limel-example-card-styling\n * @beta\n */\n@Component({\n tag: 'limel-card',\n shadow: true,\n styleUrl: 'card.scss',\n})\nexport class Card {\n /**\n * Heading of the card,\n * to provide a short title about the context.\n */\n @Prop({ reflect: true })\n public heading?: string;\n\n /**\n * Subheading of the card\n * to provide a short description of the context.\n */\n @Prop({ reflect: true })\n public subheading?: string;\n\n /**\n * A hero image to display in the card,\n * to enrich the content with visual information.\n */\n @Prop()\n public image?: Image;\n\n /**\n * An icon, to display along with the heading and subheading.\n */\n @Prop({ reflect: true })\n public icon?: string | Icon;\n\n /**\n * The content of the card.\n * Supports markdown, to provide a rich text experience.\n */\n @Prop()\n public value?: string;\n\n /**\n * Actions to display in the card,\n * to provide the user with options to interact with the content.\n */\n @Prop()\n public actions?: Array<ActionBarItem | ListSeparator> = [];\n\n /**\n * When true, improve the accessibility of the component and hints the user\n * that the card can be interacted width.\n */\n @Prop({ reflect: true })\n public clickable: boolean = false;\n\n /**\n * The orientation of the card,\n * specially useful when the card has an image.\n */\n @Prop({ reflect: true })\n public orientation: 'landscape' | 'portrait' = 'portrait';\n\n /**\n * Fired when a action bar item has been clicked.\n */\n @Event()\n public actionSelected: EventEmitter<ActionBarItem>;\n\n public render() {\n return (\n <section tabindex={this.clickable ? 0 : ''}>\n {this.renderImage()}\n <div class=\"body\">\n {this.renderHeader()}\n {this.renderSlot()}\n {this.renderValue()}\n {this.renderActionBar()}\n </div>\n </section>\n );\n }\n\n private renderImage() {\n if (!this.image) {\n return;\n }\n\n return <img src={this.image.src} alt={this.image.alt} loading=\"lazy\" />;\n }\n\n private renderHeader() {\n if (!this.heading && !this.subheading && !this.icon) {\n return;\n }\n\n return (\n <header>\n {this.renderIcon()}\n <div class=\"headings\">\n {this.renderHeading()}\n {this.renderSubheading()}\n </div>\n </header>\n );\n }\n\n private renderIcon() {\n const icon = getIconName(this.icon);\n const color =\n typeof this.icon !== 'string' ? this.icon?.color : undefined;\n\n if (!icon) {\n return;\n }\n\n return (\n <limel-icon\n style={{\n color: `${color}`,\n }}\n badge={true}\n name={icon}\n />\n );\n }\n\n private renderHeading() {\n if (!this.heading) {\n return;\n }\n\n return <h1>{this.heading}</h1>;\n }\n\n private renderSubheading() {\n if (!this.subheading) {\n return;\n }\n\n return <h2>{this.subheading}</h2>;\n }\n\n private renderSlot() {\n return <slot name=\"component\" />;\n }\n\n private renderValue() {\n return <limel-markdown value={this.value} />;\n }\n\n private handleActionSelect = (\n event: CustomEvent<ActionBarItem | ListSeparator>,\n ) => {\n event.stopPropagation();\n if (isItem(event.detail)) {\n this.actionSelected.emit(event.detail);\n }\n };\n\n private renderActionBar() {\n if (!this.actions.length) {\n return;\n }\n\n return (\n <limel-action-bar\n actions={this.actions}\n onItemSelected={this.handleActionSelect}\n />\n );\n }\n}\n"],"mappings":"0HAAA,MAAMA,EAAU,gnG,MC2BHC,EAAI,M,wEAgJLC,KAAAC,mBACJC,IAEAA,EAAMC,kBACN,GAAIC,EAAOF,EAAMG,QAAS,CACtBL,KAAKM,eAAeC,KAAKL,EAAMG,O,+HA7GiB,G,eAO5B,M,iBAOmB,U,CAQxCG,SACH,OACIC,EAAA,WAASC,SAAUV,KAAKW,UAAY,EAAI,IACnCX,KAAKY,cACNH,EAAA,OAAKI,MAAM,QACNb,KAAKc,eACLd,KAAKe,aACLf,KAAKgB,cACLhB,KAAKiB,mB,CAMdL,cACJ,IAAKZ,KAAKkB,MAAO,CACb,M,CAGJ,OAAOT,EAAA,OAAKU,IAAKnB,KAAKkB,MAAMC,IAAKC,IAAKpB,KAAKkB,MAAME,IAAKC,QAAQ,Q,CAG1DP,eACJ,IAAKd,KAAKsB,UAAYtB,KAAKuB,aAAevB,KAAKwB,KAAM,CACjD,M,CAGJ,OACIf,EAAA,cACKT,KAAKyB,aACNhB,EAAA,OAAKI,MAAM,YACNb,KAAK0B,gBACL1B,KAAK2B,oB,CAMdF,a,MACJ,MAAMD,EAAOI,EAAY5B,KAAKwB,MAC9B,MAAMK,SACK7B,KAAKwB,OAAS,UAAWM,EAAA9B,KAAKwB,QAAI,MAAAM,SAAA,SAAAA,EAAED,MAAQE,UAEvD,IAAKP,EAAM,CACP,M,CAGJ,OACIf,EAAA,cACIuB,MAAO,CACHH,MAAO,GAAGA,KAEdI,MAAO,KACPC,KAAMV,G,CAKVE,gBACJ,IAAK1B,KAAKsB,QAAS,CACf,M,CAGJ,OAAOb,EAAA,UAAKT,KAAKsB,Q,CAGbK,mBACJ,IAAK3B,KAAKuB,WAAY,CAClB,M,CAGJ,OAAOd,EAAA,UAAKT,KAAKuB,W,CAGbR,aACJ,OAAON,EAAA,QAAMyB,KAAK,a,CAGdlB,cACJ,OAAOP,EAAA,kBAAgB0B,MAAOnC,KAAKmC,O,CAY/BlB,kBACJ,IAAKjB,KAAKoC,QAAQC,OAAQ,CACtB,M,CAGJ,OACI5B,EAAA,oBACI2B,QAASpC,KAAKoC,QACdE,eAAgBtC,KAAKC,oB"}
|
|
@@ -456,3 +456,98 @@ $clickable-normal-state-transitions: (
|
|
|
456
456
|
clip-path: inset(50%);
|
|
457
457
|
white-space: nowrap;
|
|
458
458
|
}
|
|
459
|
+
|
|
460
|
+
// This mixin designed to enhance the visual effects,
|
|
461
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
462
|
+
// is implemented in a component.
|
|
463
|
+
// This adds styles to a `<div class"limel-3d-hover-effect-glow" />`, needed to create
|
|
464
|
+
// a glow effect on a 3D element when the parent element is hovered.
|
|
465
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
466
|
+
// Parts of these styles are controlled by the `titleFollowingTheCursor` function.
|
|
467
|
+
@mixin limel-3d-hover-effect-glow($the3dElement, $border-radius) {
|
|
468
|
+
.limel-3d-hover-effect-glow {
|
|
469
|
+
transition:
|
|
470
|
+
background 0.4s ease,
|
|
471
|
+
opacity 0.4s ease;
|
|
472
|
+
pointer-events: none;
|
|
473
|
+
|
|
474
|
+
position: absolute;
|
|
475
|
+
inset: 0;
|
|
476
|
+
border-radius: $border-radius;
|
|
477
|
+
|
|
478
|
+
opacity: 0.1;
|
|
479
|
+
#{$the3dElement}:hover & {
|
|
480
|
+
opacity: 0.5;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
background-image: radial-gradient(
|
|
484
|
+
circle at var(--limel-3d-hover-effect-glow-position, 50% -20%),
|
|
485
|
+
rgb(var(--color-white), 0.3),
|
|
486
|
+
rgb(var(--color-white), 0)
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
mix-blend-mode: plus-lighter;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// These mixins below are designed to apply the necessary visual effects,
|
|
494
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
495
|
+
// is implemented in a component.
|
|
496
|
+
@mixin parent-of-the-3d-element {
|
|
497
|
+
isolation: isolate;
|
|
498
|
+
transform-style: preserve-3d;
|
|
499
|
+
perspective: 1000px;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
@mixin the-3d-element {
|
|
503
|
+
position: relative;
|
|
504
|
+
|
|
505
|
+
transition-duration: 0.8s;
|
|
506
|
+
transition-property: transform, box-shadow, background-color;
|
|
507
|
+
transition-timing-function: ease-out;
|
|
508
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
509
|
+
|
|
510
|
+
&:hover,
|
|
511
|
+
&:focus,
|
|
512
|
+
&:focus-visible,
|
|
513
|
+
&:focus-within {
|
|
514
|
+
will-change: background-color, box-shadow, transform;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
&:hover,
|
|
518
|
+
&:focus,
|
|
519
|
+
&:focus-visible,
|
|
520
|
+
&:active {
|
|
521
|
+
transition-duration: 0.2s;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
&:hover,
|
|
525
|
+
&:focus-visible {
|
|
526
|
+
box-shadow: var(--button-shadow-hovered);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
&:hover {
|
|
530
|
+
transform: scale3d(1.01, 1.01, 1.01)
|
|
531
|
+
rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
532
|
+
}
|
|
533
|
+
&:focus-visible {
|
|
534
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
@mixin the-3d-element--clickable {
|
|
539
|
+
cursor: pointer;
|
|
540
|
+
box-shadow: var(--button-shadow-normal);
|
|
541
|
+
|
|
542
|
+
&:active {
|
|
543
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
544
|
+
box-shadow: var(--button-shadow-pressed);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
&:focus-visible {
|
|
548
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-8-focused);
|
|
549
|
+
}
|
|
550
|
+
&:focus-visible:active {
|
|
551
|
+
box-shadow: var(--button-shadow-pressed), var(--shadow-depth-8-focused);
|
|
552
|
+
}
|
|
553
|
+
}
|
package/dist/scss/mixins.scss
CHANGED
|
@@ -456,3 +456,98 @@ $clickable-normal-state-transitions: (
|
|
|
456
456
|
clip-path: inset(50%);
|
|
457
457
|
white-space: nowrap;
|
|
458
458
|
}
|
|
459
|
+
|
|
460
|
+
// This mixin designed to enhance the visual effects,
|
|
461
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
462
|
+
// is implemented in a component.
|
|
463
|
+
// This adds styles to a `<div class"limel-3d-hover-effect-glow" />`, needed to create
|
|
464
|
+
// a glow effect on a 3D element when the parent element is hovered.
|
|
465
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
466
|
+
// Parts of these styles are controlled by the `titleFollowingTheCursor` function.
|
|
467
|
+
@mixin limel-3d-hover-effect-glow($the3dElement, $border-radius) {
|
|
468
|
+
.limel-3d-hover-effect-glow {
|
|
469
|
+
transition:
|
|
470
|
+
background 0.4s ease,
|
|
471
|
+
opacity 0.4s ease;
|
|
472
|
+
pointer-events: none;
|
|
473
|
+
|
|
474
|
+
position: absolute;
|
|
475
|
+
inset: 0;
|
|
476
|
+
border-radius: $border-radius;
|
|
477
|
+
|
|
478
|
+
opacity: 0.1;
|
|
479
|
+
#{$the3dElement}:hover & {
|
|
480
|
+
opacity: 0.5;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
background-image: radial-gradient(
|
|
484
|
+
circle at var(--limel-3d-hover-effect-glow-position, 50% -20%),
|
|
485
|
+
rgb(var(--color-white), 0.3),
|
|
486
|
+
rgb(var(--color-white), 0)
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
mix-blend-mode: plus-lighter;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// These mixins below are designed to apply the necessary visual effects,
|
|
494
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
495
|
+
// is implemented in a component.
|
|
496
|
+
@mixin parent-of-the-3d-element {
|
|
497
|
+
isolation: isolate;
|
|
498
|
+
transform-style: preserve-3d;
|
|
499
|
+
perspective: 1000px;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
@mixin the-3d-element {
|
|
503
|
+
position: relative;
|
|
504
|
+
|
|
505
|
+
transition-duration: 0.8s;
|
|
506
|
+
transition-property: transform, box-shadow, background-color;
|
|
507
|
+
transition-timing-function: ease-out;
|
|
508
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
509
|
+
|
|
510
|
+
&:hover,
|
|
511
|
+
&:focus,
|
|
512
|
+
&:focus-visible,
|
|
513
|
+
&:focus-within {
|
|
514
|
+
will-change: background-color, box-shadow, transform;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
&:hover,
|
|
518
|
+
&:focus,
|
|
519
|
+
&:focus-visible,
|
|
520
|
+
&:active {
|
|
521
|
+
transition-duration: 0.2s;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
&:hover,
|
|
525
|
+
&:focus-visible {
|
|
526
|
+
box-shadow: var(--button-shadow-hovered);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
&:hover {
|
|
530
|
+
transform: scale3d(1.01, 1.01, 1.01)
|
|
531
|
+
rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
532
|
+
}
|
|
533
|
+
&:focus-visible {
|
|
534
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
@mixin the-3d-element--clickable {
|
|
539
|
+
cursor: pointer;
|
|
540
|
+
box-shadow: var(--button-shadow-normal);
|
|
541
|
+
|
|
542
|
+
&:active {
|
|
543
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
544
|
+
box-shadow: var(--button-shadow-pressed);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
&:focus-visible {
|
|
548
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-8-focused);
|
|
549
|
+
}
|
|
550
|
+
&:focus-visible:active {
|
|
551
|
+
box-shadow: var(--button-shadow-pressed), var(--shadow-depth-8-focused);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
@@ -68,7 +68,7 @@ export declare class ProsemirrorAdapter {
|
|
|
68
68
|
componentDidLoad(): void;
|
|
69
69
|
connectedCallback(): void;
|
|
70
70
|
disconnectedCallback(): void;
|
|
71
|
-
render(): any
|
|
71
|
+
render(): any;
|
|
72
72
|
renderLinkMenu(): any;
|
|
73
73
|
private setupContentConverter;
|
|
74
74
|
private getActionBarItems;
|
|
@@ -84,7 +84,7 @@ export declare class ProsemirrorAdapter {
|
|
|
84
84
|
private handleCancelLinkMenu;
|
|
85
85
|
private handleSaveLinkMenu;
|
|
86
86
|
private handleLinkChange;
|
|
87
|
-
|
|
87
|
+
private handleFocus;
|
|
88
88
|
private handleNewLinkSelection;
|
|
89
89
|
private handleOpenLinkMenu;
|
|
90
90
|
private changeEmitter;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for creating a 3D tilt hover effect.
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions that enables consumer components to display a nice 3D effect,
|
|
5
|
+
* when being hovered; enabling them to follow the cursor's position and tilt towards it.
|
|
6
|
+
*
|
|
7
|
+
* ## What you need, to make this work
|
|
8
|
+
* ### Typescript
|
|
9
|
+
* 1. Import the functions:
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import {
|
|
13
|
+
* tiltFollowingTheCursor,
|
|
14
|
+
* handleMouseEnter,
|
|
15
|
+
* handleMouseLeave,
|
|
16
|
+
* } from './path/to/3d-tilt-hover-effect';
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* 2. In your component, define the necessary properties:
|
|
20
|
+
*
|
|
21
|
+
* ```tsx
|
|
22
|
+
* @Element() private element: HTMLElement;
|
|
23
|
+
* private the3dElementBounds: DOMRect;
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* 3. If your component does not already have event handlers,
|
|
27
|
+
* implement them using the imported functions from this file:
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* private handleMouseEnter = () => {
|
|
31
|
+
* handleMouseEnter(this.element, 'section', (bounds) => {
|
|
32
|
+
* this.the3dElementBounds = bounds;
|
|
33
|
+
* }, this.tiltFollowingTheCursor);
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* private handleMouseLeave = () => {
|
|
37
|
+
* handleMouseLeave(this.element, this.tiltFollowingTheCursor);
|
|
38
|
+
* };
|
|
39
|
+
*
|
|
40
|
+
* private tiltFollowingTheCursor = (e: MouseEvent) => {
|
|
41
|
+
* tiltFollowingTheCursor(e, this.the3dElementBounds, this.element);
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* 4. Attach the event handlers to the relevant elements in your render method:
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* public render() {
|
|
49
|
+
* return (
|
|
50
|
+
* <section
|
|
51
|
+
* onMouseEnter={this.handleMouseEnter}
|
|
52
|
+
* onMouseLeave={this.handleMouseLeave}
|
|
53
|
+
* >
|
|
54
|
+
* Your content here
|
|
55
|
+
* </section>
|
|
56
|
+
* );
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* :::note
|
|
61
|
+
* - Ensure that the `element` and `the3dElementBounds` properties are properly
|
|
62
|
+
* defined in your component.
|
|
63
|
+
* - The `selector` parameter in `handleMouseEnter` should match the selector
|
|
64
|
+
* of the element you want to apply the 3D effect to.
|
|
65
|
+
* - The `tiltFollowingTheCursor` function calculates the 3D rotation and glow
|
|
66
|
+
* position based on the cursor's position relative to the element's bounds.
|
|
67
|
+
* :::
|
|
68
|
+
*
|
|
69
|
+
* ### HTML elements + CSS
|
|
70
|
+
* 1. Add a `<div class="limel-3d-hover-effect-glow" />` element to your component's template,
|
|
71
|
+
* inside the element you want to apply the 3D effect to, and preferably at the bottom of all
|
|
72
|
+
* other elements within that element (to avoid the need to specifying `z-index`es).
|
|
73
|
+
* 2. Add the following `mixin` to your component's SCSS file:
|
|
74
|
+
* `limel-3d-hover-effect-glow($the3dElement, $border-radius);`
|
|
75
|
+
*
|
|
76
|
+
* and don't forget to define the `$the3dElement` variables for the mixin to work
|
|
77
|
+
* (and optionally the `$border-radius`).
|
|
78
|
+
* 3. Keep in mind that the `<div class="limel-3d-hover-effect-glow" />` will be
|
|
79
|
+
* absolutely positioned inside the parent element, so make sure the parent element
|
|
80
|
+
* has `position` set.
|
|
81
|
+
* 4. Add the following `mixin` to the host element: `parent-of-the-3d-element`.
|
|
82
|
+
* 5. Add the following `mixin` to the 3D element: `the-3d-element`.
|
|
83
|
+
* 6. And if your element is supposed to be clickable, add this `mixin` as well: `the-3d-element--clickable`.
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
export declare const MOUSE_SCALE_FACTOR = 100;
|
|
87
|
+
export declare const ROTATION_DEGREE_MULTIPLIER = 1.6;
|
|
88
|
+
export declare const GLOW_POSITION_MULTIPLIER = 2;
|
|
89
|
+
export declare const CENTER_DIVISOR = 2;
|
|
90
|
+
export declare function tiltFollowingTheCursor(e: MouseEvent, the3dElementBounds: DOMRect, element: HTMLElement): void;
|
|
91
|
+
export declare function handleMouseEnter(element: HTMLElement, selector: string, setBounds: (bounds: DOMRect) => void, tiltCallback: (e: MouseEvent) => void): void;
|
|
92
|
+
export declare function handleMouseLeave(element: HTMLElement, selector: string, tiltCallback: (e: MouseEvent) => void): void;
|
|
93
|
+
//# sourceMappingURL=3d-tilt-hover-effect.d.ts.map
|