@rozie-ui/toast-lit 0.1.0 → 0.1.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/dist/index.cjs +11 -7
- package/dist/index.d.cts +8 -2
- package/dist/index.d.mts +8 -2
- package/dist/index.mjs +11 -7
- package/package.json +2 -2
- package/src/Toaster.ts +11 -8
package/dist/index.cjs
CHANGED
|
@@ -263,12 +263,9 @@ let Toaster = class Toaster extends (0, _lit_labs_preact_signals.SignalWatcher)(
|
|
|
263
263
|
if (this._swipeGesture.value && this._swipeGesture.value.id === t.id) this._swipeGesture.value = null;
|
|
264
264
|
if (this._swipe.value && this._swipe.value.id === t.id) this._swipe.value = null;
|
|
265
265
|
};
|
|
266
|
-
this.depth = (
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
};
|
|
270
|
-
this.toastStyle = (t) => {
|
|
271
|
-
const depthDecl = "--rozie-toast-depth: " + this.depth(t) + ";";
|
|
266
|
+
this.depth = (ti) => this._toasts.value.length - 1 - ti;
|
|
267
|
+
this.toastStyle = (t, ti) => {
|
|
268
|
+
const depthDecl = "--rozie-toast-depth: " + this.depth(ti) + ";";
|
|
272
269
|
if (t.exiting) return t.swipeExitSign != null ? depthDecl + " --rozie-toast-swipe-exit: " + t.swipeExitSign + ";" : depthDecl;
|
|
273
270
|
const dragState = this._swipe.value;
|
|
274
271
|
if (!dragState || dragState.id !== t.id) return depthDecl;
|
|
@@ -483,7 +480,7 @@ to[data-rozie-s-12d4265c] { transform: rotate(360deg); }
|
|
|
483
480
|
this.onMouseLeave();
|
|
484
481
|
}} ${(0, _rozie_runtime_lit.rozieListeners)(this.$listeners)} data-rozie-s-12d4265c>
|
|
485
482
|
|
|
486
|
-
${(0, lit_directives_repeat_js.repeat)(this._toasts.value, (t,
|
|
483
|
+
${(0, lit_directives_repeat_js.repeat)(this._toasts.value, (t, ti) => t.id, (t, ti) => lit.html`<div class="rozie-toast ${(0, _rozie_runtime_lit.rozieClass)("rozie-toast--" + t.type + (t.exiting ? " rozie-toast--exiting" : "") + (t.swipeExitSign != null ? " rozie-toast--swipe-exit" : ""))}" key=${(0, _rozie_runtime_lit.rozieAttr)(t.id)} style=${(0, _rozie_runtime_lit.rozieStyle)(this.toastStyle(t, ti))} role="status" aria-live=${(0, _rozie_runtime_lit.rozieAttr)(this.liveFor(t.type))} @animationend=${($event) => {
|
|
487
484
|
t.exiting && this.removeToast(t.id);
|
|
488
485
|
}} @pointerdown=${($event) => {
|
|
489
486
|
this.onToastPointerDown(t, $event);
|
|
@@ -524,9 +521,16 @@ to[data-rozie-s-12d4265c] { transform: rotate(360deg); }
|
|
|
524
521
|
* with React/Vue/Svelte/Solid/Angular). Both Lit attribute-naming
|
|
525
522
|
* forms are folded into the skip set: kebab-case for model props
|
|
526
523
|
* (explicit `attribute:`) AND lowercased property name (Lit's default).
|
|
524
|
+
*
|
|
525
|
+
* command-palette-per-level-virtual / portal-through-portal cluster —
|
|
526
|
+
* `data-rozie-ref` is ALWAYS skipped too (a reserved compiler bookkeeping
|
|
527
|
+
* attribute, never a consumer prop) so a parent-assigned `ref=` on this
|
|
528
|
+
* component's own host tag can never clobber this component's OWN
|
|
529
|
+
* internal `data-rozie-ref` ref markers via fallthrough re-application.
|
|
527
530
|
*/
|
|
528
531
|
get $attrs() {
|
|
529
532
|
const __skip = new Set([
|
|
533
|
+
"data-rozie-ref",
|
|
530
534
|
"position",
|
|
531
535
|
"duration",
|
|
532
536
|
"max",
|
package/dist/index.d.cts
CHANGED
|
@@ -77,8 +77,8 @@ declare class Toaster extends Toaster_base {
|
|
|
77
77
|
onToastPointerMove: (t: any, event: any) => void;
|
|
78
78
|
onToastPointerUp: (t: any, event: any) => void;
|
|
79
79
|
onToastPointerCancel: (t: any) => void;
|
|
80
|
-
depth: (
|
|
81
|
-
toastStyle: (t: any) => string;
|
|
80
|
+
depth: (ti: any) => number;
|
|
81
|
+
toastStyle: (t: any, ti: any) => string;
|
|
82
82
|
onMouseEnter: () => void;
|
|
83
83
|
onMouseLeave: () => void;
|
|
84
84
|
regionLabel: () => string;
|
|
@@ -94,6 +94,12 @@ declare class Toaster extends Toaster_base {
|
|
|
94
94
|
* with React/Vue/Svelte/Solid/Angular). Both Lit attribute-naming
|
|
95
95
|
* forms are folded into the skip set: kebab-case for model props
|
|
96
96
|
* (explicit `attribute:`) AND lowercased property name (Lit's default).
|
|
97
|
+
*
|
|
98
|
+
* command-palette-per-level-virtual / portal-through-portal cluster —
|
|
99
|
+
* `data-rozie-ref` is ALWAYS skipped too (a reserved compiler bookkeeping
|
|
100
|
+
* attribute, never a consumer prop) so a parent-assigned `ref=` on this
|
|
101
|
+
* component's own host tag can never clobber this component's OWN
|
|
102
|
+
* internal `data-rozie-ref` ref markers via fallthrough re-application.
|
|
97
103
|
*/
|
|
98
104
|
private get $attrs();
|
|
99
105
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -77,8 +77,8 @@ declare class Toaster extends Toaster_base {
|
|
|
77
77
|
onToastPointerMove: (t: any, event: any) => void;
|
|
78
78
|
onToastPointerUp: (t: any, event: any) => void;
|
|
79
79
|
onToastPointerCancel: (t: any) => void;
|
|
80
|
-
depth: (
|
|
81
|
-
toastStyle: (t: any) => string;
|
|
80
|
+
depth: (ti: any) => number;
|
|
81
|
+
toastStyle: (t: any, ti: any) => string;
|
|
82
82
|
onMouseEnter: () => void;
|
|
83
83
|
onMouseLeave: () => void;
|
|
84
84
|
regionLabel: () => string;
|
|
@@ -94,6 +94,12 @@ declare class Toaster extends Toaster_base {
|
|
|
94
94
|
* with React/Vue/Svelte/Solid/Angular). Both Lit attribute-naming
|
|
95
95
|
* forms are folded into the skip set: kebab-case for model props
|
|
96
96
|
* (explicit `attribute:`) AND lowercased property name (Lit's default).
|
|
97
|
+
*
|
|
98
|
+
* command-palette-per-level-virtual / portal-through-portal cluster —
|
|
99
|
+
* `data-rozie-ref` is ALWAYS skipped too (a reserved compiler bookkeeping
|
|
100
|
+
* attribute, never a consumer prop) so a parent-assigned `ref=` on this
|
|
101
|
+
* component's own host tag can never clobber this component's OWN
|
|
102
|
+
* internal `data-rozie-ref` ref markers via fallthrough re-application.
|
|
97
103
|
*/
|
|
98
104
|
private get $attrs();
|
|
99
105
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -259,12 +259,9 @@ let Toaster = class Toaster extends SignalWatcher(LitElement) {
|
|
|
259
259
|
if (this._swipeGesture.value && this._swipeGesture.value.id === t.id) this._swipeGesture.value = null;
|
|
260
260
|
if (this._swipe.value && this._swipe.value.id === t.id) this._swipe.value = null;
|
|
261
261
|
};
|
|
262
|
-
this.depth = (
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
};
|
|
266
|
-
this.toastStyle = (t) => {
|
|
267
|
-
const depthDecl = "--rozie-toast-depth: " + this.depth(t) + ";";
|
|
262
|
+
this.depth = (ti) => this._toasts.value.length - 1 - ti;
|
|
263
|
+
this.toastStyle = (t, ti) => {
|
|
264
|
+
const depthDecl = "--rozie-toast-depth: " + this.depth(ti) + ";";
|
|
268
265
|
if (t.exiting) return t.swipeExitSign != null ? depthDecl + " --rozie-toast-swipe-exit: " + t.swipeExitSign + ";" : depthDecl;
|
|
269
266
|
const dragState = this._swipe.value;
|
|
270
267
|
if (!dragState || dragState.id !== t.id) return depthDecl;
|
|
@@ -479,7 +476,7 @@ to[data-rozie-s-12d4265c] { transform: rotate(360deg); }
|
|
|
479
476
|
this.onMouseLeave();
|
|
480
477
|
}} ${rozieListeners(this.$listeners)} data-rozie-s-12d4265c>
|
|
481
478
|
|
|
482
|
-
${repeat(this._toasts.value, (t,
|
|
479
|
+
${repeat(this._toasts.value, (t, ti) => t.id, (t, ti) => html`<div class="rozie-toast ${rozieClass("rozie-toast--" + t.type + (t.exiting ? " rozie-toast--exiting" : "") + (t.swipeExitSign != null ? " rozie-toast--swipe-exit" : ""))}" key=${rozieAttr(t.id)} style=${rozieStyle(this.toastStyle(t, ti))} role="status" aria-live=${rozieAttr(this.liveFor(t.type))} @animationend=${($event) => {
|
|
483
480
|
t.exiting && this.removeToast(t.id);
|
|
484
481
|
}} @pointerdown=${($event) => {
|
|
485
482
|
this.onToastPointerDown(t, $event);
|
|
@@ -520,9 +517,16 @@ to[data-rozie-s-12d4265c] { transform: rotate(360deg); }
|
|
|
520
517
|
* with React/Vue/Svelte/Solid/Angular). Both Lit attribute-naming
|
|
521
518
|
* forms are folded into the skip set: kebab-case for model props
|
|
522
519
|
* (explicit `attribute:`) AND lowercased property name (Lit's default).
|
|
520
|
+
*
|
|
521
|
+
* command-palette-per-level-virtual / portal-through-portal cluster —
|
|
522
|
+
* `data-rozie-ref` is ALWAYS skipped too (a reserved compiler bookkeeping
|
|
523
|
+
* attribute, never a consumer prop) so a parent-assigned `ref=` on this
|
|
524
|
+
* component's own host tag can never clobber this component's OWN
|
|
525
|
+
* internal `data-rozie-ref` ref markers via fallthrough re-application.
|
|
523
526
|
*/
|
|
524
527
|
get $attrs() {
|
|
525
528
|
const __skip = new Set([
|
|
529
|
+
"data-rozie-ref",
|
|
526
530
|
"position",
|
|
527
531
|
"duration",
|
|
528
532
|
"max",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rozie-ui/toast-lit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"src"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@rozie/runtime-lit": "0.2.
|
|
48
|
+
"@rozie/runtime-lit": "0.2.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"lit": "^3.2",
|
package/src/Toaster.ts
CHANGED
|
@@ -248,7 +248,7 @@ to[data-rozie-s-12d4265c] { transform: rotate(360deg); }
|
|
|
248
248
|
return html`
|
|
249
249
|
<div class="rozie-toaster ${(rozieClass('rozie-toaster--' + this.position + (this.stacked ? ' rozie-toaster--stacked' : '')))}" role="region" aria-label=${rozieAttr(this.regionLabel())} ${rozieSpread(this.$attrs)} @mouseenter=${($event: MouseEvent & { currentTarget: HTMLDivElement; target: HTMLDivElement }) => { this.onMouseEnter(); }} @mouseleave=${($event: MouseEvent & { currentTarget: HTMLDivElement; target: HTMLDivElement }) => { this.onMouseLeave(); }} ${rozieListeners(this.$listeners)} data-rozie-s-12d4265c>
|
|
250
250
|
|
|
251
|
-
${repeat<any>(this._toasts.value, (t,
|
|
251
|
+
${repeat<any>(this._toasts.value, (t, ti) => t.id, (t, ti) => html`<div class="rozie-toast ${(rozieClass('rozie-toast--' + t.type + (t.exiting ? ' rozie-toast--exiting' : '') + (t.swipeExitSign != null ? ' rozie-toast--swipe-exit' : '')))}" key=${rozieAttr(t.id)} style=${rozieStyle(this.toastStyle(t, ti))} role="status" aria-live=${rozieAttr(this.liveFor(t.type))} @animationend=${($event: Event & { currentTarget: HTMLDivElement; target: HTMLDivElement }) => { t.exiting && this.removeToast(t.id); }} @pointerdown=${($event: PointerEvent & { currentTarget: HTMLDivElement; target: HTMLDivElement }) => { this.onToastPointerDown(t, $event); }} @pointermove=${($event: PointerEvent & { currentTarget: HTMLDivElement; target: HTMLDivElement }) => { this.onToastPointerMove(t, $event); }} @pointerup=${($event: PointerEvent & { currentTarget: HTMLDivElement; target: HTMLDivElement }) => { this.onToastPointerUp(t, $event); }} @pointercancel=${($event: PointerEvent & { currentTarget: HTMLDivElement; target: HTMLDivElement }) => { this.onToastPointerCancel(t); }} data-rozie-s-12d4265c>
|
|
252
252
|
${this.toast !== undefined ? this.toast({toast: t, dismiss: this.dismiss}) : html`<slot name="toast" data-rozie-params=${(() => { try { return JSON.stringify({toast: t}); } catch { return '{}'; } })()} @rozie-toast-dismiss=${($event: CustomEvent) => ((this.dismiss) as (...args: any[]) => any)($event.detail)}>
|
|
253
253
|
${t.type === 'loading' ? html`<span class="rozie-toast-spinner" aria-hidden="true" data-rozie-s-12d4265c></span>` : nothing}<span class="rozie-toast-message" data-rozie-s-12d4265c>${rozieDisplay(t.message)}</span>
|
|
254
254
|
<button class="rozie-toast-close" type="button" aria-label="Dismiss" @click=${($event: MouseEvent & { currentTarget: HTMLButtonElement; target: HTMLButtonElement }) => { this.dismissBegin(t.id, 'close'); }} data-rozie-s-12d4265c>×</button>
|
|
@@ -590,13 +590,10 @@ to[data-rozie-s-12d4265c] { transform: rotate(360deg); }
|
|
|
590
590
|
if (this._swipe.value && this._swipe.value.id === t.id) this._swipe.value = null;
|
|
591
591
|
};
|
|
592
592
|
|
|
593
|
-
depth = (
|
|
594
|
-
const idx = this._toasts.value.findIndex((x: any) => x.id === t.id);
|
|
595
|
-
return idx === -1 ? 0 : this._toasts.value.length - 1 - idx;
|
|
596
|
-
};
|
|
593
|
+
depth = (ti: any) => this._toasts.value.length - 1 - ti;
|
|
597
594
|
|
|
598
|
-
toastStyle = (t: any) => {
|
|
599
|
-
const depthDecl = '--rozie-toast-depth: ' + this.depth(
|
|
595
|
+
toastStyle = (t: any, ti: any) => {
|
|
596
|
+
const depthDecl = '--rozie-toast-depth: ' + this.depth(ti) + ';';
|
|
600
597
|
if (t.exiting) {
|
|
601
598
|
return t.swipeExitSign != null ? depthDecl + ' --rozie-toast-swipe-exit: ' + t.swipeExitSign + ';' : depthDecl;
|
|
602
599
|
}
|
|
@@ -635,9 +632,15 @@ to[data-rozie-s-12d4265c] { transform: rotate(360deg); }
|
|
|
635
632
|
* with React/Vue/Svelte/Solid/Angular). Both Lit attribute-naming
|
|
636
633
|
* forms are folded into the skip set: kebab-case for model props
|
|
637
634
|
* (explicit `attribute:`) AND lowercased property name (Lit's default).
|
|
635
|
+
*
|
|
636
|
+
* command-palette-per-level-virtual / portal-through-portal cluster —
|
|
637
|
+
* `data-rozie-ref` is ALWAYS skipped too (a reserved compiler bookkeeping
|
|
638
|
+
* attribute, never a consumer prop) so a parent-assigned `ref=` on this
|
|
639
|
+
* component's own host tag can never clobber this component's OWN
|
|
640
|
+
* internal `data-rozie-ref` ref markers via fallthrough re-application.
|
|
638
641
|
*/
|
|
639
642
|
private get $attrs(): Record<string, string> {
|
|
640
|
-
const __skip = new Set<string>(['position', 'duration', 'max', 'disable-pause-on-hover', 'disablepauseonhover', 'aria-label', 'arialabel', 'disable-swipe', 'disableswipe', 'stacked']);
|
|
643
|
+
const __skip = new Set<string>(['data-rozie-ref', 'position', 'duration', 'max', 'disable-pause-on-hover', 'disablepauseonhover', 'aria-label', 'arialabel', 'disable-swipe', 'disableswipe', 'stacked']);
|
|
641
644
|
const out: Record<string, string> = {};
|
|
642
645
|
for (const a of Array.from(this.attributes)) {
|
|
643
646
|
if (__skip.has(a.name)) continue;
|