@limetech/lime-elements 37.70.5 → 37.72.0
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 +17 -0
- package/dist/cjs/3d-tilt-hover-effect-f64da0a8.js +162 -0
- package/dist/cjs/3d-tilt-hover-effect-f64da0a8.js.map +1 -0
- package/dist/cjs/limel-card.cjs.entry.js +9 -2
- package/dist/cjs/limel-card.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-info-tile.cjs.entry.js +13 -8
- package/dist/cjs/limel-info-tile.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +6 -0
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/collection/components/card/card.css +76 -37
- package/dist/collection/components/card/card.js +9 -2
- package/dist/collection/components/card/card.js.map +1 -1
- package/dist/collection/components/info-tile/info-tile.css +73 -38
- package/dist/collection/components/info-tile/info-tile.js +13 -8
- package/dist/collection/components/info-tile/info-tile.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/inserter.js +6 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/inserter.js.map +1 -1
- package/dist/collection/components/text-editor/text-editor.types.js.map +1 -1
- package/dist/collection/style/mixins.scss +114 -0
- package/dist/collection/util/3d-tilt-hover-effect.js +157 -0
- package/dist/collection/util/3d-tilt-hover-effect.js.map +1 -0
- package/dist/esm/3d-tilt-hover-effect-a76fcd43.js +160 -0
- package/dist/esm/3d-tilt-hover-effect-a76fcd43.js.map +1 -0
- package/dist/esm/limel-card.entry.js +10 -3
- package/dist/esm/limel-card.entry.js.map +1 -1
- package/dist/esm/limel-info-tile.entry.js +14 -9
- package/dist/esm/limel-info-tile.entry.js.map +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +6 -0
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-05c10bed.entry.js +2 -0
- package/dist/lime-elements/p-05c10bed.entry.js.map +1 -0
- package/dist/lime-elements/{p-7098482d.entry.js → p-060bbefe.entry.js} +2 -2
- package/dist/lime-elements/{p-7098482d.entry.js.map → p-060bbefe.entry.js.map} +1 -1
- package/dist/lime-elements/p-23bc6de0.js +2 -0
- package/dist/lime-elements/p-23bc6de0.js.map +1 -0
- package/dist/lime-elements/p-a0944503.entry.js +2 -0
- package/dist/lime-elements/p-a0944503.entry.js.map +1 -0
- package/dist/lime-elements/style/mixins.scss +114 -0
- package/dist/scss/mixins.scss +114 -0
- package/dist/types/components/card/card.d.ts +4 -0
- package/dist/types/components/info-tile/info-tile.d.ts +5 -1
- package/dist/types/components/text-editor/text-editor.types.d.ts +1 -0
- package/dist/types/util/3d-tilt-hover-effect.d.ts +118 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-32844d2b.entry.js +0 -2
- package/dist/lime-elements/p-32844d2b.entry.js.map +0 -1
- package/dist/lime-elements/p-ca929a0e.entry.js +0 -2
- package/dist/lime-elements/p-ca929a0e.entry.js.map +0 -1
|
@@ -88,44 +88,9 @@ section {
|
|
|
88
88
|
:host(limel-card[orientation=landscape]) section {
|
|
89
89
|
flex-direction: row;
|
|
90
90
|
}
|
|
91
|
-
:
|
|
92
|
-
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);
|
|
93
|
-
cursor: pointer;
|
|
94
|
-
color: var(--mdc-theme-on-surface);
|
|
95
|
-
background-color: var(--card-background-color, rgb(var(--contrast-200)));
|
|
96
|
-
}
|
|
97
|
-
:host(limel-card[clickable]) section:focus {
|
|
98
|
-
outline: none;
|
|
99
|
-
}
|
|
100
|
-
:host(limel-card[clickable]) section:focus-visible {
|
|
101
|
-
outline: none;
|
|
102
|
-
box-shadow: var(--shadow-depth-8-focused);
|
|
103
|
-
}
|
|
104
|
-
:host(limel-card[clickable]) section:hover, :host(limel-card[clickable]) section:focus, :host(limel-card[clickable]) section:focus-visible {
|
|
105
|
-
will-change: color, background-color, box-shadow, transform;
|
|
106
|
-
}
|
|
107
|
-
:host(limel-card[clickable]) section:hover {
|
|
108
|
-
transform: translate3d(0, 0.01rem, 0);
|
|
109
|
-
color: var(--mdc-theme-on-surface);
|
|
110
|
-
background-color: var(--card-background-color--hovered, var(--card-background-color, rgb(var(--contrast-200))));
|
|
111
|
-
box-shadow: var(--button-shadow-hovered);
|
|
112
|
-
}
|
|
113
|
-
:host(limel-card[clickable]) section:active {
|
|
114
|
-
--limel-clickable-transform-timing-function: cubic-bezier(
|
|
115
|
-
0.83,
|
|
116
|
-
-0.15,
|
|
117
|
-
0.49,
|
|
118
|
-
1.16
|
|
119
|
-
);
|
|
120
|
-
transform: translate3d(0, 0.05rem, 0);
|
|
121
|
-
box-shadow: var(--button-shadow-pressed);
|
|
122
|
-
}
|
|
123
|
-
:host(limel-card[clickable]) section:hover, :host(limel-card[clickable]) section:active {
|
|
124
|
-
--limel-clickable-transition-speed: 0.2s;
|
|
125
|
-
--limel-clickable-transform-speed: 0.16s;
|
|
126
|
-
}
|
|
127
|
-
:host(limel-card[clickable]:hover) section {
|
|
91
|
+
section:hover {
|
|
128
92
|
border-color: transparent;
|
|
93
|
+
background-color: var(--card-background-color--hovered, var(--card-background-color, rgb(var(--contrast-200))));
|
|
129
94
|
}
|
|
130
95
|
|
|
131
96
|
.body {
|
|
@@ -201,4 +166,78 @@ limel-action-bar {
|
|
|
201
166
|
--action-bar-background-color: transparent;
|
|
202
167
|
padding: 0.5rem;
|
|
203
168
|
margin-left: auto;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.limel-3d-hover-effect-glow {
|
|
172
|
+
transition: background 0.4s ease, opacity 0.4s ease;
|
|
173
|
+
pointer-events: none;
|
|
174
|
+
position: absolute;
|
|
175
|
+
inset: 0;
|
|
176
|
+
border-radius: var(--card-border-radius, 0.95rem);
|
|
177
|
+
opacity: 0.1;
|
|
178
|
+
background-image: radial-gradient(circle at var(--limel-3d-hover-effect-glow-position, 50% -20%), rgb(var(--color-white), 0.3), rgb(var(--color-white), 0));
|
|
179
|
+
mix-blend-mode: plus-lighter;
|
|
180
|
+
}
|
|
181
|
+
section:hover .limel-3d-hover-effect-glow {
|
|
182
|
+
opacity: 0.5;
|
|
183
|
+
}
|
|
184
|
+
@media (prefers-reduced-motion) {
|
|
185
|
+
section:hover .limel-3d-hover-effect-glow {
|
|
186
|
+
opacity: 0.2;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
:host(limel-card) {
|
|
191
|
+
isolation: isolate;
|
|
192
|
+
transform-style: preserve-3d;
|
|
193
|
+
perspective: 1000px;
|
|
194
|
+
}
|
|
195
|
+
@media (prefers-reduced-motion) {
|
|
196
|
+
:host(limel-card) {
|
|
197
|
+
perspective: 2000px;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
section {
|
|
202
|
+
position: relative;
|
|
203
|
+
transition-duration: 0.8s;
|
|
204
|
+
transition-property: transform, box-shadow, background-color;
|
|
205
|
+
transition-timing-function: ease-out;
|
|
206
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
207
|
+
}
|
|
208
|
+
section:focus {
|
|
209
|
+
outline: none;
|
|
210
|
+
}
|
|
211
|
+
section:hover, section:focus, section:focus-visible, section:focus-within {
|
|
212
|
+
will-change: background-color, box-shadow, transform;
|
|
213
|
+
}
|
|
214
|
+
section:hover, section:focus, section:focus-visible, section:active {
|
|
215
|
+
transition-duration: 0.2s;
|
|
216
|
+
}
|
|
217
|
+
section:hover, section:focus-visible {
|
|
218
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
219
|
+
}
|
|
220
|
+
section:hover {
|
|
221
|
+
transform: scale3d(1.01, 1.01, 1.01) rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
222
|
+
}
|
|
223
|
+
section:focus-visible {
|
|
224
|
+
outline: none;
|
|
225
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
226
|
+
}
|
|
227
|
+
:host(limel-card[clickable]) section {
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
box-shadow: var(--button-shadow-normal);
|
|
230
|
+
}
|
|
231
|
+
:host(limel-card[clickable]) section:hover, :host(limel-card[clickable]) section:focus-visible {
|
|
232
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
233
|
+
}
|
|
234
|
+
:host(limel-card[clickable]) section:active {
|
|
235
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
236
|
+
box-shadow: var(--button-shadow-pressed);
|
|
237
|
+
}
|
|
238
|
+
:host(limel-card[clickable]) section:focus-visible {
|
|
239
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-hovered);
|
|
240
|
+
}
|
|
241
|
+
:host(limel-card[clickable]) section:focus-visible:active {
|
|
242
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-pressed);
|
|
204
243
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
1
|
+
import { h, Host, } from '@stencil/core';
|
|
2
2
|
import { isItem } from '../action-bar/isItem';
|
|
3
3
|
import { getIconName } from '../icon/get-icon-props';
|
|
4
|
+
import { getMouseEventHandlers } from '../../util/3d-tilt-hover-effect';
|
|
4
5
|
/**
|
|
5
6
|
* Card is a component that displays content about a single topic,
|
|
6
7
|
* in a structured way. It can contain a header, and some supporting media such
|
|
@@ -32,8 +33,13 @@ export class Card {
|
|
|
32
33
|
this.clickable = false;
|
|
33
34
|
this.orientation = 'portrait';
|
|
34
35
|
}
|
|
36
|
+
componentWillLoad() {
|
|
37
|
+
const { handleMouseEnter, handleMouseLeave } = getMouseEventHandlers(this.host);
|
|
38
|
+
this.handleMouseEnter = handleMouseEnter;
|
|
39
|
+
this.handleMouseLeave = handleMouseLeave;
|
|
40
|
+
}
|
|
35
41
|
render() {
|
|
36
|
-
return (h("section", { tabindex: this.clickable ? 0 : '' }, this.renderImage(), h("div", { class: "body" }, this.renderHeader(), this.renderSlot(), this.renderValue(), this.renderActionBar())));
|
|
42
|
+
return (h(Host, { onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave }, h("section", { tabindex: this.clickable ? 0 : '' }, this.renderImage(), h("div", { class: "body" }, this.renderHeader(), this.renderSlot(), this.renderValue(), this.renderActionBar()), h("div", { class: "limel-3d-hover-effect-glow" }))));
|
|
37
43
|
}
|
|
38
44
|
renderImage() {
|
|
39
45
|
if (!this.image) {
|
|
@@ -278,5 +284,6 @@ export class Card {
|
|
|
278
284
|
}
|
|
279
285
|
}];
|
|
280
286
|
}
|
|
287
|
+
static get elementRef() { return "host"; }
|
|
281
288
|
}
|
|
282
289
|
//# sourceMappingURL=card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,CAAC,EACD,IAAI,EACJ,KAAK,EAEL,OAAO,EACP,IAAI,GACP,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,IAAI;;IAoKL,uBAAkB,GAAG,CACzB,KAAiD,EACnD,EAAE;MACA,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,IAAI,MAAM,CAAC,K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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n h,\n Prop,\n Event,\n EventEmitter,\n Element,\n Host,\n} 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';\nimport { getMouseEventHandlers } from '../../util/3d-tilt-hover-effect';\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 @Element()\n private host: HTMLElement;\n\n private handleMouseEnter: () => void;\n private handleMouseLeave: () => void;\n\n public componentWillLoad() {\n const { handleMouseEnter, handleMouseLeave } = getMouseEventHandlers(\n this.host,\n );\n this.handleMouseEnter = handleMouseEnter;\n this.handleMouseLeave = handleMouseLeave;\n }\n\n public render() {\n return (\n <Host\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n >\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 <div class=\"limel-3d-hover-effect-glow\" />\n </section>\n </Host>\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"]}
|
|
@@ -103,7 +103,6 @@
|
|
|
103
103
|
--icon-min-size: 2rem;
|
|
104
104
|
--icon-preferred-size: 60cqh;
|
|
105
105
|
--icon-max-size: calc(100cqw - 0.5rem);
|
|
106
|
-
isolation: isolate;
|
|
107
106
|
container-type: size;
|
|
108
107
|
position: relative;
|
|
109
108
|
display: flex;
|
|
@@ -133,43 +132,6 @@ a {
|
|
|
133
132
|
border-radius: var(--info-tile-border-radius, 1rem);
|
|
134
133
|
background-color: var(--info-tile-background-color, var(--lime-elevated-surface-background-color));
|
|
135
134
|
}
|
|
136
|
-
a.is-clickable {
|
|
137
|
-
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);
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
color: var(--mdc-theme-on-surface);
|
|
140
|
-
background-color: var(--info-tile-background-color, var(--lime-elevated-surface-background-color));
|
|
141
|
-
box-shadow: var(--button-shadow-normal);
|
|
142
|
-
}
|
|
143
|
-
a.is-clickable:hover, a.is-clickable:focus, a.is-clickable:focus-visible {
|
|
144
|
-
will-change: color, background-color, box-shadow, transform;
|
|
145
|
-
}
|
|
146
|
-
a.is-clickable:hover {
|
|
147
|
-
transform: translate3d(0, -0.04rem, 0);
|
|
148
|
-
color: var(--mdc-theme-on-surface);
|
|
149
|
-
background-color: var(--info-tile-background-color, var(--lime-elevated-surface-background-color));
|
|
150
|
-
box-shadow: var(--button-shadow-hovered);
|
|
151
|
-
}
|
|
152
|
-
a.is-clickable:active {
|
|
153
|
-
--limel-clickable-transform-timing-function: cubic-bezier(
|
|
154
|
-
0.83,
|
|
155
|
-
-0.15,
|
|
156
|
-
0.49,
|
|
157
|
-
1.16
|
|
158
|
-
);
|
|
159
|
-
transform: translate3d(0, 0.05rem, 0);
|
|
160
|
-
box-shadow: var(--button-shadow-pressed);
|
|
161
|
-
}
|
|
162
|
-
a.is-clickable:hover, a.is-clickable:active {
|
|
163
|
-
--limel-clickable-transition-speed: 0.2s;
|
|
164
|
-
--limel-clickable-transform-speed: 0.16s;
|
|
165
|
-
}
|
|
166
|
-
a.is-clickable:focus {
|
|
167
|
-
outline: none;
|
|
168
|
-
}
|
|
169
|
-
a.is-clickable:focus-visible {
|
|
170
|
-
outline: none;
|
|
171
|
-
box-shadow: var(--shadow-depth-8-focused);
|
|
172
|
-
}
|
|
173
135
|
|
|
174
136
|
.icon {
|
|
175
137
|
z-index: 1;
|
|
@@ -375,4 +337,77 @@ limel-linear-progress {
|
|
|
375
337
|
right: 0.5rem;
|
|
376
338
|
--icon-max-size: 3rem;
|
|
377
339
|
}
|
|
340
|
+
}
|
|
341
|
+
.limel-3d-hover-effect-glow {
|
|
342
|
+
transition: background 0.4s ease, opacity 0.4s ease;
|
|
343
|
+
pointer-events: none;
|
|
344
|
+
position: absolute;
|
|
345
|
+
inset: 0;
|
|
346
|
+
border-radius: var(--info-tile-border-radius, 1rem);
|
|
347
|
+
opacity: 0.1;
|
|
348
|
+
background-image: radial-gradient(circle at var(--limel-3d-hover-effect-glow-position, 50% -20%), rgb(var(--color-white), 0.3), rgb(var(--color-white), 0));
|
|
349
|
+
mix-blend-mode: plus-lighter;
|
|
350
|
+
}
|
|
351
|
+
a:hover .limel-3d-hover-effect-glow {
|
|
352
|
+
opacity: 0.5;
|
|
353
|
+
}
|
|
354
|
+
@media (prefers-reduced-motion) {
|
|
355
|
+
a:hover .limel-3d-hover-effect-glow {
|
|
356
|
+
opacity: 0.2;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
:host(limel-info-tile) {
|
|
361
|
+
isolation: isolate;
|
|
362
|
+
transform-style: preserve-3d;
|
|
363
|
+
perspective: 1000px;
|
|
364
|
+
}
|
|
365
|
+
@media (prefers-reduced-motion) {
|
|
366
|
+
:host(limel-info-tile) {
|
|
367
|
+
perspective: 2000px;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
a {
|
|
372
|
+
position: relative;
|
|
373
|
+
transition-duration: 0.8s;
|
|
374
|
+
transition-property: transform, box-shadow, background-color;
|
|
375
|
+
transition-timing-function: ease-out;
|
|
376
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
377
|
+
}
|
|
378
|
+
a:focus {
|
|
379
|
+
outline: none;
|
|
380
|
+
}
|
|
381
|
+
a:hover, a:focus, a:focus-visible, a:focus-within {
|
|
382
|
+
will-change: background-color, box-shadow, transform;
|
|
383
|
+
}
|
|
384
|
+
a:hover, a:focus, a:focus-visible, a:active {
|
|
385
|
+
transition-duration: 0.2s;
|
|
386
|
+
}
|
|
387
|
+
a:hover, a:focus-visible {
|
|
388
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
389
|
+
}
|
|
390
|
+
a:hover {
|
|
391
|
+
transform: scale3d(1.01, 1.01, 1.01) rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
392
|
+
}
|
|
393
|
+
a:focus-visible {
|
|
394
|
+
outline: none;
|
|
395
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
396
|
+
}
|
|
397
|
+
a.is-clickable {
|
|
398
|
+
cursor: pointer;
|
|
399
|
+
box-shadow: var(--button-shadow-normal);
|
|
400
|
+
}
|
|
401
|
+
a.is-clickable:hover, a.is-clickable:focus-visible {
|
|
402
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
403
|
+
}
|
|
404
|
+
a.is-clickable:active {
|
|
405
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
406
|
+
box-shadow: var(--button-shadow-pressed);
|
|
407
|
+
}
|
|
408
|
+
a.is-clickable:focus-visible {
|
|
409
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-hovered);
|
|
410
|
+
}
|
|
411
|
+
a.is-clickable:focus-visible:active {
|
|
412
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-pressed);
|
|
378
413
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { getMouseEventHandlers } from '../../util/3d-tilt-hover-effect';
|
|
2
3
|
/**
|
|
3
4
|
* This component can be used on places such as a start page or a dashboard.
|
|
4
5
|
* It offers features for visualizing aggregated data along with supplementary
|
|
@@ -76,6 +77,11 @@ export class InfoTile {
|
|
|
76
77
|
this.link = undefined;
|
|
77
78
|
this.progress = undefined;
|
|
78
79
|
}
|
|
80
|
+
componentWillLoad() {
|
|
81
|
+
const { handleMouseEnter, handleMouseLeave } = getMouseEventHandlers(this.host);
|
|
82
|
+
this.handleMouseEnter = handleMouseEnter;
|
|
83
|
+
this.handleMouseLeave = handleMouseLeave;
|
|
84
|
+
}
|
|
79
85
|
render() {
|
|
80
86
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
81
87
|
const extendedAriaLabel = this.checkProps(this === null || this === void 0 ? void 0 : this.prefix) +
|
|
@@ -89,13 +95,11 @@ export class InfoTile {
|
|
|
89
95
|
this.checkProps((_c = this === null || this === void 0 ? void 0 : this.progress) === null || _c === void 0 ? void 0 : _c.suffix) +
|
|
90
96
|
this.checkProps((_d = this === null || this === void 0 ? void 0 : this.link) === null || _d === void 0 ? void 0 : _d.title);
|
|
91
97
|
const link = !this.disabled ? (_e = this.link) === null || _e === void 0 ? void 0 : _e.href : '#';
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.renderNotification(),
|
|
98
|
-
];
|
|
98
|
+
return (h(Host, { onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave }, h("a", { title: (_f = this.link) === null || _f === void 0 ? void 0 : _f.title, href: link, target: (_g = this.link) === null || _g === void 0 ? void 0 : _g.target, tabindex: "0", "aria-label": extendedAriaLabel, "aria-disabled": this.disabled, "aria-busy": this.loading ? 'true' : 'false', "aria-live": "polite", class: {
|
|
99
|
+
'is-clickable': !!((_h = this.link) === null || _h === void 0 ? void 0 : _h.href) && !this.disabled,
|
|
100
|
+
'has-circular-progress': !!((_j = this.progress) === null || _j === void 0 ? void 0 : _j.value) ||
|
|
101
|
+
((_k = this.progress) === null || _k === void 0 ? void 0 : _k.value) === 0,
|
|
102
|
+
} }, this.renderIcon(), this.renderProgress(), h("div", { class: "value-group" }, this.renderPrefix(), h("div", { class: "value-and-suffix" }, this.renderValue(), this.renderSuffix()), this.renderSpinner()), this.renderLabel()), this.renderNotification(), h("div", { class: "limel-3d-hover-effect-glow" })));
|
|
99
103
|
}
|
|
100
104
|
checkProps(propValue) {
|
|
101
105
|
return !propValue ? '' : propValue + ' ';
|
|
@@ -295,5 +299,6 @@ export class InfoTile {
|
|
|
295
299
|
}
|
|
296
300
|
};
|
|
297
301
|
}
|
|
302
|
+
static get elementRef() { return "host"; }
|
|
298
303
|
}
|
|
299
304
|
//# sourceMappingURL=info-tile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-tile.js","sourceRoot":"","sources":["../../../src/components/info-tile/info-tile.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAInD;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,QAAQ;;IAkIT,iBAAY,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,MAA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B,EAAE;KAC5B,CAAC;EACN,CAAC;EAEO,UAAU,CAAC,SAAS;IACxB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC;EAC7C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EJ","sourcesContent":["import { Component, Prop, h } from '@stencil/core';\nimport { InfoTileProgress } from '../info-tile/info-tile.types';\nimport { Link } from '../../global/shared-types/link.types';\n\n/**\n * This component can be used on places such as a start page or a dashboard.\n * It offers features for visualizing aggregated data along with supplementary\n * information.\n *\n * If clicking on the component should navigate the user to\n * a new screen or web page, you need to provide a URL,\n * using the `link` property.\n *\n * @exampleComponent limel-example-info-tile\n * @exampleComponent limel-example-info-tile-badge\n * @exampleComponent limel-example-info-tile-progress\n * @exampleComponent limel-example-info-tile-loading\n * @exampleComponent limel-example-info-tile-styling\n */\n@Component({\n tag: 'limel-info-tile',\n shadow: true,\n styleUrl: 'info-tile.scss',\n})\nexport class InfoTile {\n /**\n * A piece of text or number that is the main piece of information\n * which the component is intended to visualize.\n */\n @Prop({ reflect: true })\n public value: number | string;\n\n /**\n * Name of icon for the info tile.\n */\n @Prop()\n public icon?: string;\n\n /**\n * The text to show below the info tile. Long labels will be truncated.\n */\n @Prop({ reflect: true })\n public label?: string = null;\n\n /**\n * A string of text that is visually placed before the value.\n */\n @Prop({ reflect: true })\n public prefix?: string;\n\n /**\n * A string of text that is visually placed after the value.\n */\n @Prop({ reflect: true })\n public suffix?: string;\n\n /**\n * Set to `true` if info tile is disabled.\n */\n @Prop({ reflect: true })\n public disabled? = false;\n\n /**\n * If supplied, the info tile will display a notification badge.\n */\n @Prop({ reflect: true })\n public badge?: number | string;\n\n /**\n * Set to `true` to put the component in the `loading` state.\n * This does _not_ disable the link. To do so, the\n * `disabled` property should be set to `true` as well.\n */\n @Prop({ reflect: true })\n public loading? = false;\n\n /**\n * If supplied, the info tile will be a clickable link.\n *\n * Supplying a value also adds an elevated effect using a shadow,\n * as well as `cursor: pointer`, which appears on hover.\n * While we strongly recommend supplying a link whenever the\n * component should act as a link, if this is not possible, and\n * you need to provide interaction through a click handler,\n * you can still get the correct styling by supplying a `Link`\n * object with the `href` property set to `'#'`.\n */\n @Prop()\n public link?: Link;\n\n /**\n * Properties of the optional circular progress bar.\n *\n * Defaults:\n * - `maxValue`: 100\n * - `suffix`: %\n * - `displayPercentageColors`: false\n *\n * Colors change with intervals of 10 %.\n */\n @Prop()\n public progress?: InfoTileProgress;\n\n public render() {\n const extendedAriaLabel =\n this.checkProps(this?.prefix) +\n this.value +\n ' ' +\n this.checkProps(this?.suffix) +\n this.checkProps(this?.label) +\n '. ' +\n this.checkProps(this?.progress?.prefix) +\n this.checkProps(this?.progress?.value) +\n this.checkProps(this?.progress?.suffix) +\n this.checkProps(this?.link?.title);\n\n const link = !this.disabled ? this.link?.href : '#';\n\n return [\n <a\n title={this.link?.title}\n href={link}\n target={this.link?.target}\n tabindex=\"0\"\n aria-label={extendedAriaLabel}\n aria-disabled={this.disabled}\n aria-busy={this.loading ? 'true' : 'false'}\n aria-live=\"polite\"\n class={{\n 'is-clickable': !!this.link?.href && !this.disabled,\n 'has-circular-progress':\n !!this.progress?.value || this.progress?.value === 0,\n }}\n >\n {this.renderIcon()}\n {this.renderProgress()}\n <div class=\"value-group\">\n {this.renderPrefix()}\n <div class=\"value-and-suffix\">\n {this.renderValue()}\n {this.renderSuffix()}\n </div>\n {this.renderSpinner()}\n </div>\n {this.renderLabel()}\n </a>,\n this.renderNotification(),\n ];\n }\n\n private checkProps(propValue) {\n return !propValue ? '' : propValue + ' ';\n }\n\n private renderPrefix = () => {\n if (this.prefix) {\n return <span class=\"prefix\">{this.prefix}</span>;\n }\n };\n\n private renderValue = () => {\n const characterCount = (this.value ?? '').toString().length;\n\n if (!this.value && this.loading) {\n return <span class=\"value\">···</span>;\n }\n\n if (this.value) {\n return (\n <span\n class={{\n value: true,\n [`ch-${characterCount}`]: true,\n }}\n >\n {this.value}\n </span>\n );\n }\n };\n\n private renderSuffix = () => {\n if (this.suffix) {\n return <span class=\"suffix\">{this.suffix}</span>;\n }\n };\n\n private renderIcon = () => {\n if (this.icon) {\n return <limel-icon class=\"icon\" name={this.icon} />;\n }\n };\n\n private renderProgress = () => {\n if (this.progress?.value || this.progress?.value === 0) {\n return (\n <limel-circular-progress\n class=\"progress\"\n prefix={this.progress.prefix}\n value={this.progress.value}\n suffix={this.progress.suffix}\n maxValue={this.progress.maxValue}\n displayPercentageColors={\n this.progress.displayPercentageColors\n }\n />\n );\n }\n };\n\n private renderLabel = () => {\n if (this.label) {\n return <span class=\"label\">{this.label}</span>;\n }\n };\n\n private renderNotification = () => {\n if (this.badge) {\n return <limel-badge label={this.badge} />;\n }\n };\n\n private renderSpinner = () => {\n if (this.loading) {\n return <limel-linear-progress indeterminate={true} />;\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"info-tile.js","sourceRoot":"","sources":["../../../src/components/info-tile/info-tile.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,QAAQ;;IAuJT,iBAAY,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,MAAM,EAAE;QACb,OAAO,YAAM,KAAK,EAAC,QAAQ,IAAE,IAAI,CAAC,MAAM,CAAQ,CAAC;OACpD;IACL,CAAC,CAAC;IAEM,gBAAW,GAAG,GAAG,EAAE;;M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AC,kBAAkB;YACxB,IAAI,CAAC,WAAW,EAAE;YAClB,IAAI,CAAC,YAAY,EAAE,CAClB;UACL,IAAI,CAAC,aAAa,EAAE,CACnB;QACL,IAAI,CAAC,WAAW,EAAE,CACnB;MACH,IAAI,CAAC,kBAAkB,EAAE;MAC1B,WAAK,KAAK,EAAC,4BAA4B,GAAG,CACvC,CACV,CAAC;EACN,CAAC;EAEO,UAAU,CAAC,SAAS;IACxB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC;EAC7C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EJ","sourcesContent":["import { Component, Prop, h, Element, Host } from '@stencil/core';\nimport { InfoTileProgress } from '../info-tile/info-tile.types';\nimport { Link } from '../../global/shared-types/link.types';\nimport { getMouseEventHandlers } from '../../util/3d-tilt-hover-effect';\n\n/**\n * This component can be used on places such as a start page or a dashboard.\n * It offers features for visualizing aggregated data along with supplementary\n * information.\n *\n * If clicking on the component should navigate the user to\n * a new screen or web page, you need to provide a URL,\n * using the `link` property.\n *\n * @exampleComponent limel-example-info-tile\n * @exampleComponent limel-example-info-tile-badge\n * @exampleComponent limel-example-info-tile-progress\n * @exampleComponent limel-example-info-tile-loading\n * @exampleComponent limel-example-info-tile-styling\n */\n@Component({\n tag: 'limel-info-tile',\n shadow: true,\n styleUrl: 'info-tile.scss',\n})\nexport class InfoTile {\n /**\n * A piece of text or number that is the main piece of information\n * which the component is intended to visualize.\n */\n @Prop({ reflect: true })\n public value: number | string;\n\n /**\n * Name of icon for the info tile.\n */\n @Prop()\n public icon?: string;\n\n /**\n * The text to show below the info tile. Long labels will be truncated.\n */\n @Prop({ reflect: true })\n public label?: string = null;\n\n /**\n * A string of text that is visually placed before the value.\n */\n @Prop({ reflect: true })\n public prefix?: string;\n\n /**\n * A string of text that is visually placed after the value.\n */\n @Prop({ reflect: true })\n public suffix?: string;\n\n /**\n * Set to `true` if info tile is disabled.\n */\n @Prop({ reflect: true })\n public disabled? = false;\n\n /**\n * If supplied, the info tile will display a notification badge.\n */\n @Prop({ reflect: true })\n public badge?: number | string;\n\n /**\n * Set to `true` to put the component in the `loading` state.\n * This does _not_ disable the link. To do so, the\n * `disabled` property should be set to `true` as well.\n */\n @Prop({ reflect: true })\n public loading? = false;\n\n /**\n * If supplied, the info tile will be a clickable link.\n *\n * Supplying a value also adds an elevated effect using a shadow,\n * as well as `cursor: pointer`, which appears on hover.\n * While we strongly recommend supplying a link whenever the\n * component should act as a link, if this is not possible, and\n * you need to provide interaction through a click handler,\n * you can still get the correct styling by supplying a `Link`\n * object with the `href` property set to `'#'`.\n */\n @Prop()\n public link?: Link;\n\n /**\n * Properties of the optional circular progress bar.\n *\n * Defaults:\n * - `maxValue`: 100\n * - `suffix`: %\n * - `displayPercentageColors`: false\n *\n * Colors change with intervals of 10 %.\n */\n @Prop()\n public progress?: InfoTileProgress;\n\n @Element()\n private host: HTMLElement;\n\n private handleMouseEnter: () => void;\n private handleMouseLeave: () => void;\n\n public componentWillLoad() {\n const { handleMouseEnter, handleMouseLeave } = getMouseEventHandlers(\n this.host,\n );\n this.handleMouseEnter = handleMouseEnter;\n this.handleMouseLeave = handleMouseLeave;\n }\n\n public render() {\n const extendedAriaLabel =\n this.checkProps(this?.prefix) +\n this.value +\n ' ' +\n this.checkProps(this?.suffix) +\n this.checkProps(this?.label) +\n '. ' +\n this.checkProps(this?.progress?.prefix) +\n this.checkProps(this?.progress?.value) +\n this.checkProps(this?.progress?.suffix) +\n this.checkProps(this?.link?.title);\n\n const link = !this.disabled ? this.link?.href : '#';\n\n return (\n <Host\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n >\n <a\n title={this.link?.title}\n href={link}\n target={this.link?.target}\n tabindex=\"0\"\n aria-label={extendedAriaLabel}\n aria-disabled={this.disabled}\n aria-busy={this.loading ? 'true' : 'false'}\n aria-live=\"polite\"\n class={{\n 'is-clickable': !!this.link?.href && !this.disabled,\n 'has-circular-progress':\n !!this.progress?.value ||\n this.progress?.value === 0,\n }}\n >\n {this.renderIcon()}\n {this.renderProgress()}\n <div class=\"value-group\">\n {this.renderPrefix()}\n <div class=\"value-and-suffix\">\n {this.renderValue()}\n {this.renderSuffix()}\n </div>\n {this.renderSpinner()}\n </div>\n {this.renderLabel()}\n </a>\n {this.renderNotification()}\n <div class=\"limel-3d-hover-effect-glow\" />\n </Host>\n );\n }\n\n private checkProps(propValue) {\n return !propValue ? '' : propValue + ' ';\n }\n\n private renderPrefix = () => {\n if (this.prefix) {\n return <span class=\"prefix\">{this.prefix}</span>;\n }\n };\n\n private renderValue = () => {\n const characterCount = (this.value ?? '').toString().length;\n\n if (!this.value && this.loading) {\n return <span class=\"value\">···</span>;\n }\n\n if (this.value) {\n return (\n <span\n class={{\n value: true,\n [`ch-${characterCount}`]: true,\n }}\n >\n {this.value}\n </span>\n );\n }\n };\n\n private renderSuffix = () => {\n if (this.suffix) {\n return <span class=\"suffix\">{this.suffix}</span>;\n }\n };\n\n private renderIcon = () => {\n if (this.icon) {\n return <limel-icon class=\"icon\" name={this.icon} />;\n }\n };\n\n private renderProgress = () => {\n if (this.progress?.value || this.progress?.value === 0) {\n return (\n <limel-circular-progress\n class=\"progress\"\n prefix={this.progress.prefix}\n value={this.progress.value}\n suffix={this.progress.suffix}\n maxValue={this.progress.maxValue}\n displayPercentageColors={\n this.progress.displayPercentageColors\n }\n />\n );\n }\n };\n\n private renderLabel = () => {\n if (this.label) {\n return <span class=\"label\">{this.label}</span>;\n }\n };\n\n private renderNotification = () => {\n if (this.badge) {\n return <limel-badge label={this.badge} />;\n }\n };\n\n private renderSpinner = () => {\n if (this.loading) {\n return <limel-linear-progress indeterminate={true} />;\n }\n };\n}\n"]}
|
package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/inserter.js
CHANGED
|
@@ -20,6 +20,12 @@ export const inserterFactory = (view) => {
|
|
|
20
20
|
transaction.setMeta('stopTrigger', true);
|
|
21
21
|
dispatch(transaction);
|
|
22
22
|
},
|
|
23
|
+
stopTrigger: () => {
|
|
24
|
+
const { state, dispatch } = view;
|
|
25
|
+
const transaction = state.tr;
|
|
26
|
+
transaction.setMeta('stopTrigger', true);
|
|
27
|
+
dispatch(transaction);
|
|
28
|
+
},
|
|
23
29
|
};
|
|
24
30
|
};
|
|
25
31
|
const createNode = (input, schema) => {
|
package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/inserter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inserter.js","sourceRoot":"","sources":["../../../../../../src/components/text-editor/prosemirror-adapter/plugins/trigger/inserter.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAgB,EAAc,EAAE;EAC5D,MAAM,QAAQ,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;EAE/C,OAAO;IACH,MAAM,EAAE,CAAC,KAA8B,EAAE,EAAE;MACvC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;MACjC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;MACpC,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;MAE5B,IAAI,IAAU,CAAC;MAEf,IAAI;QACA,IAAI,GAAG,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;OACpC;MAAC,OAAO,KAAK,EAAE;QACZ,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE7B,OAAO;OACV;MAED,MAAM,SAAS,GAAG,MAAM,CAAC,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,KAAK,CAAC,CAAC,IAAI,CAC/C,CAAC,eAAe,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,KAAK,IAAI,CACrD,CAAC;EAEF,IAAI,CAAC,UAAU,EAAE;IACb,MAAM,IAAI,KAAK,CACX,oDAAoD,IAAI,EAAE,CAC7D,CAAC;GACL;EAED,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,IAAgB,EAAU,EAAE;;EACzD,OAAO,MAAA,MAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,0CAAE,KAAK,0CAAE,GAAG,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["import { Node, NodeType, Schema } from 'prosemirror-model';\nimport { EditorView } from 'prosemirror-view';\nimport {\n TextEditor,\n TextEditorNode,\n} from 'src/components/text-editor/text-editor.types';\n\nexport const inserterFactory = (view: EditorView): TextEditor => {\n const startPos = getTriggerStartPosition(view);\n\n return {\n insert: (input: TextEditorNode | string) => {\n const { state, dispatch } = view;\n const { schema, selection } = state;\n const { $from } = selection;\n\n let node: Node;\n\n try {\n node = createNode(input, schema);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error.message);\n\n return;\n }\n\n const spaceNode = schema.text(' ');\n\n const fragment = schema.nodes.doc.create(null, [node, spaceNode]);\n\n const transaction = state.tr.replaceWith(\n startPos,\n $from.pos,\n fragment,\n );\n\n transaction.setMeta('stopTrigger', true);\n dispatch(transaction);\n },\n };\n};\n\nconst createNode = (input: TextEditorNode | string, schema: Schema): Node => {\n if (typeof input === 'string') {\n return schema.text(input);\n }\n\n const node = input.node;\n\n if (typeof node === 'string') {\n return schema.text(node);\n }\n\n const customNode = getCustomNode(node.tagName, schema);\n\n const childNodes: Node[] = (input.children ?? [])\n .map((child) => createNode(child, schema))\n .filter(Boolean);\n\n return customNode.create(node.attributes, childNodes);\n};\n\nconst getCustomNode = (name: string, schema: Schema): NodeType => {\n const customNode = Object.values(schema.nodes).find(\n (prosemirrorNode) => prosemirrorNode.name === name,\n );\n\n if (!customNode) {\n throw new Error(\n `A custom element hasn't been registered for node ${name}`,\n );\n }\n\n return customNode;\n};\n\nconst getTriggerStartPosition = (view: EditorView): number => {\n return view.state?.selection?.$from?.pos;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"inserter.js","sourceRoot":"","sources":["../../../../../../src/components/text-editor/prosemirror-adapter/plugins/trigger/inserter.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAgB,EAAc,EAAE;EAC5D,MAAM,QAAQ,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;EAE/C,OAAO;IACH,MAAM,EAAE,CAAC,KAA8B,EAAE,EAAE;MACvC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;MACjC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;MACpC,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;MAE5B,IAAI,IAAU,CAAC;MAEf,IAAI;QACA,IAAI,GAAG,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;OACpC;MAAC,OAAO,KAAK,EAAE;QACZ,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE7B,OAAO;OACV;MAED,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;MAEnC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;MAElE,MAAM,WAAW,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,CACpC,QAAQ,EACR,KAAK,CAAC,GAAG,EACT,QAAQ,CACX,CAAC;MAEF,WAAW,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;MACzC,QAAQ,CAAC,WAAW,C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EF,IAAI,CAAC,UAAU,EAAE;IACb,MAAM,IAAI,KAAK,CACX,oDAAoD,IAAI,EAAE,CAC7D,CAAC;GACL;EAED,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,IAAgB,EAAU,EAAE;;EACzD,OAAO,MAAA,MAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,0CAAE,KAAK,0CAAE,GAAG,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["import { Node, NodeType, Schema } from 'prosemirror-model';\nimport { EditorView } from 'prosemirror-view';\nimport {\n TextEditor,\n TextEditorNode,\n} from 'src/components/text-editor/text-editor.types';\n\nexport const inserterFactory = (view: EditorView): TextEditor => {\n const startPos = getTriggerStartPosition(view);\n\n return {\n insert: (input: TextEditorNode | string) => {\n const { state, dispatch } = view;\n const { schema, selection } = state;\n const { $from } = selection;\n\n let node: Node;\n\n try {\n node = createNode(input, schema);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error.message);\n\n return;\n }\n\n const spaceNode = schema.text(' ');\n\n const fragment = schema.nodes.doc.create(null, [node, spaceNode]);\n\n const transaction = state.tr.replaceWith(\n startPos,\n $from.pos,\n fragment,\n );\n\n transaction.setMeta('stopTrigger', true);\n dispatch(transaction);\n },\n stopTrigger: () => {\n const { state, dispatch } = view;\n\n const transaction = state.tr;\n transaction.setMeta('stopTrigger', true);\n\n dispatch(transaction);\n },\n };\n};\n\nconst createNode = (input: TextEditorNode | string, schema: Schema): Node => {\n if (typeof input === 'string') {\n return schema.text(input);\n }\n\n const node = input.node;\n\n if (typeof node === 'string') {\n return schema.text(node);\n }\n\n const customNode = getCustomNode(node.tagName, schema);\n\n const childNodes: Node[] = (input.children ?? [])\n .map((child) => createNode(child, schema))\n .filter(Boolean);\n\n return customNode.create(node.attributes, childNodes);\n};\n\nconst getCustomNode = (name: string, schema: Schema): NodeType => {\n const customNode = Object.values(schema.nodes).find(\n (prosemirrorNode) => prosemirrorNode.name === name,\n );\n\n if (!customNode) {\n throw new Error(\n `A custom element hasn't been registered for node ${name}`,\n );\n }\n\n return customNode;\n};\n\nconst getTriggerStartPosition = (view: EditorView): number => {\n return view.state?.selection?.$from?.pos;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-editor.types.js","sourceRoot":"","sources":["../../../src/components/text-editor/text-editor.types.ts"],"names":[],"mappings":"","sourcesContent":["import { CustomElement } from '../../global/shared-types/custom-element.types';\n\n/**\n * @alpha\n */\nexport type TriggerCharacter =\n | '@'\n | '#'\n | '$'\n | '!'\n | '?'\n | '&'\n | '*'\n | '%'\n | '+'\n | '-'\n | '='\n | '/'\n | '\\\\'\n | '^'\n | '~'\n | '`'\n | ':'\n | ';'\n | '|'\n | '.'\n | ','\n | '<'\n | '>'\n | '['\n | ']'\n | '{'\n | '}'\n | '('\n | ')'\n | \"'\";\n\n/**\n * @alpha\n */\nexport type TextEditorNode = {\n /**\n * The top node\n */\n node: CustomElement | string;\n\n /**\n * One more more children under the top node\n */\n children?: Array<TextEditorNode | string>;\n};\n\n/**\n * @alpha\n */\nexport interface TextEditor {\n /**\n * Method to insert either text or a node at the cursor position\n *\n */\n insert: (input: TextEditorNode | string) => void;\n}\n\n/**\n * @alpha\n */\nexport interface TriggerEventDetail {\n /**\n * The trigger that triggered this event\n *\n */\n trigger: TriggerCharacter;\n\n /**\n * The text editor\n */\n textEditor: TextEditor;\n\n /**\n * Current value of the trigger\n */\n value: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"text-editor.types.js","sourceRoot":"","sources":["../../../src/components/text-editor/text-editor.types.ts"],"names":[],"mappings":"","sourcesContent":["import { CustomElement } from '../../global/shared-types/custom-element.types';\n\n/**\n * @alpha\n */\nexport type TriggerCharacter =\n | '@'\n | '#'\n | '$'\n | '!'\n | '?'\n | '&'\n | '*'\n | '%'\n | '+'\n | '-'\n | '='\n | '/'\n | '\\\\'\n | '^'\n | '~'\n | '`'\n | ':'\n | ';'\n | '|'\n | '.'\n | ','\n | '<'\n | '>'\n | '['\n | ']'\n | '{'\n | '}'\n | '('\n | ')'\n | \"'\";\n\n/**\n * @alpha\n */\nexport type TextEditorNode = {\n /**\n * The top node\n */\n node: CustomElement | string;\n\n /**\n * One more more children under the top node\n */\n children?: Array<TextEditorNode | string>;\n};\n\n/**\n * @alpha\n */\nexport interface TextEditor {\n /**\n * Method to insert either text or a node at the cursor position\n *\n */\n insert: (input: TextEditorNode | string) => void;\n stopTrigger: () => void;\n}\n\n/**\n * @alpha\n */\nexport interface TriggerEventDetail {\n /**\n * The trigger that triggered this event\n *\n */\n trigger: TriggerCharacter;\n\n /**\n * The text editor\n */\n textEditor: TextEditor;\n\n /**\n * Current value of the trigger\n */\n value: string;\n}\n"]}
|
|
@@ -456,3 +456,117 @@ $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
|
+
@media (prefers-reduced-motion) {
|
|
482
|
+
opacity: 0.2;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
background-image: radial-gradient(
|
|
487
|
+
circle at var(--limel-3d-hover-effect-glow-position, 50% -20%),
|
|
488
|
+
rgb(var(--color-white), 0.3),
|
|
489
|
+
rgb(var(--color-white), 0)
|
|
490
|
+
);
|
|
491
|
+
|
|
492
|
+
mix-blend-mode: plus-lighter;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// These mixins below are designed to apply the necessary visual effects,
|
|
497
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
498
|
+
// is implemented in a component.
|
|
499
|
+
@mixin parent-of-the-3d-element {
|
|
500
|
+
isolation: isolate;
|
|
501
|
+
transform-style: preserve-3d;
|
|
502
|
+
|
|
503
|
+
perspective: 1000px;
|
|
504
|
+
@media (prefers-reduced-motion) {
|
|
505
|
+
perspective: 2000px;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
@mixin the-3d-element {
|
|
510
|
+
position: relative;
|
|
511
|
+
|
|
512
|
+
transition-duration: 0.8s;
|
|
513
|
+
transition-property: transform, box-shadow, background-color;
|
|
514
|
+
transition-timing-function: ease-out;
|
|
515
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
516
|
+
|
|
517
|
+
&:focus {
|
|
518
|
+
outline: none;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
&:hover,
|
|
522
|
+
&:focus,
|
|
523
|
+
&:focus-visible,
|
|
524
|
+
&:focus-within {
|
|
525
|
+
will-change: background-color, box-shadow, transform;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
&:hover,
|
|
529
|
+
&:focus,
|
|
530
|
+
&:focus-visible,
|
|
531
|
+
&:active {
|
|
532
|
+
transition-duration: 0.2s;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
&:hover,
|
|
536
|
+
&:focus-visible {
|
|
537
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
&:hover {
|
|
541
|
+
transform: scale3d(1.01, 1.01, 1.01)
|
|
542
|
+
rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
543
|
+
}
|
|
544
|
+
&:focus-visible {
|
|
545
|
+
outline: none;
|
|
546
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
@mixin the-3d-element--clickable {
|
|
551
|
+
cursor: pointer;
|
|
552
|
+
box-shadow: var(--button-shadow-normal);
|
|
553
|
+
|
|
554
|
+
&:hover,
|
|
555
|
+
&:focus-visible {
|
|
556
|
+
// seems repetitive. But it's required for some scenarios, like for info tiles.
|
|
557
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
&:active {
|
|
561
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
562
|
+
box-shadow: var(--button-shadow-pressed);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
&:focus-visible {
|
|
566
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-hovered);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
&:focus-visible:active {
|
|
570
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-pressed);
|
|
571
|
+
}
|
|
572
|
+
}
|