@c2n/toast 0.0.6 → 0.0.7
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/toast.js +2 -1
- package/package.json +18 -6
- package/react.d.ts +25 -0
- package/react.js +3 -0
- package/types/src/toast.d.ts +19 -0
- package/types/src/toast.d.ts.map +1 -1
- package/vue.d.ts +49 -0
- package/vue.js +3 -0
package/dist/toast.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, isServer, nothing, unsafeCSS } from "lit";
|
|
2
|
-
import {
|
|
2
|
+
import { property } from "lit/decorators.js";
|
|
3
|
+
import { customElement } from "@c2n/core/element-helper.js";
|
|
3
4
|
import { styleMap } from "lit/directives/style-map.js";
|
|
4
5
|
import { repeat } from "lit/directives/repeat.js";
|
|
5
6
|
//#region src/toast-controller.ts
|
package/package.json
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c2n/toast",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/toast.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"types": "./types/src/toast.d.ts",
|
|
9
|
+
"default": "./dist/toast.js"
|
|
10
|
+
},
|
|
11
|
+
"./react": {
|
|
12
|
+
"types": "./react.d.ts",
|
|
13
|
+
"default": "./react.js"
|
|
14
|
+
},
|
|
15
|
+
"./vue": {
|
|
16
|
+
"types": "./vue.d.ts",
|
|
17
|
+
"default": "./vue.js"
|
|
10
18
|
},
|
|
11
19
|
"./custom-elements.json": "./custom-elements.json"
|
|
12
20
|
},
|
|
13
21
|
"files": [
|
|
14
22
|
"dist",
|
|
15
|
-
"types"
|
|
23
|
+
"types",
|
|
24
|
+
"react.d.ts",
|
|
25
|
+
"react.js",
|
|
26
|
+
"vue.d.ts",
|
|
27
|
+
"vue.js"
|
|
16
28
|
],
|
|
17
29
|
"keywords": [
|
|
18
30
|
"toast",
|
|
@@ -50,12 +62,12 @@
|
|
|
50
62
|
}
|
|
51
63
|
},
|
|
52
64
|
"dependencies": {
|
|
53
|
-
"@c2n/core": "0.0.
|
|
65
|
+
"@c2n/core": "0.0.7",
|
|
54
66
|
"lit": "3.3.3"
|
|
55
67
|
},
|
|
56
68
|
"devDependencies": {
|
|
57
69
|
"@c2n/config": "*"
|
|
58
70
|
},
|
|
59
71
|
"customElements": "custom-elements.json",
|
|
60
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "c8db398a27f7cd417d665fdf5da455fee2d4e910"
|
|
61
73
|
}
|
package/react.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// GENERATED by @c2n/framework-types. Do not edit by hand.
|
|
2
|
+
//
|
|
3
|
+
// JSX types for the custom elements of @c2n/toast. Import once, anywhere in the program:
|
|
4
|
+
//
|
|
5
|
+
// import '@c2n/toast/react'
|
|
6
|
+
//
|
|
7
|
+
// Register the elements at module scope before React renders, or React writes an object prop as an
|
|
8
|
+
// attribute and it stringifies.
|
|
9
|
+
|
|
10
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react'
|
|
11
|
+
import type { Toast, ToastRegion } from '@c2n/toast'
|
|
12
|
+
|
|
13
|
+
/** Standard React host-element attributes plus the element's own public properties. */
|
|
14
|
+
type C2Props<T> = DetailedHTMLProps<HTMLAttributes<T>, T> & Partial<Omit<T, keyof HTMLElement>>
|
|
15
|
+
|
|
16
|
+
declare module 'react' {
|
|
17
|
+
namespace JSX {
|
|
18
|
+
interface IntrinsicElements {
|
|
19
|
+
'c2-toast': C2Props<Toast>
|
|
20
|
+
'c2-toast-region': C2Props<ToastRegion>
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {}
|
package/react.js
ADDED
package/types/src/toast.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { LitElement, type PropertyValues } from 'lit';
|
|
2
|
+
import type { TypedAddEventListener, TypedRemoveEventListener } from '@c2n/core/event-helper.js';
|
|
2
3
|
import { type ToastOptions, type ToastDismissReason } from './toast-controller.js';
|
|
3
4
|
export type ToastAnimation = 'none' | 'fade' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'scale';
|
|
4
5
|
export type { ToastOptions, ToastRecord, ToastVariant, ToastDismissReason } from './toast-controller.js';
|
|
6
|
+
/** Events fired by {@link Toast}, keyed for `addEventListener`. */
|
|
7
|
+
export interface ToastEventMap {
|
|
8
|
+
'toast-close': CustomEvent;
|
|
9
|
+
'toast-action': CustomEvent;
|
|
10
|
+
}
|
|
11
|
+
export interface Toast {
|
|
12
|
+
addEventListener: TypedAddEventListener<Toast, ToastEventMap>;
|
|
13
|
+
removeEventListener: TypedRemoveEventListener<Toast, ToastEventMap>;
|
|
14
|
+
}
|
|
5
15
|
/**
|
|
6
16
|
* A notification card. Use c2-toast-region to manage stacking, queueing and timed dismissal.
|
|
7
17
|
* @tag c2-toast
|
|
@@ -65,6 +75,15 @@ export declare class Toast extends LitElement {
|
|
|
65
75
|
private renderIcon;
|
|
66
76
|
render(): import("lit-html").TemplateResult<1>;
|
|
67
77
|
}
|
|
78
|
+
/** Events fired by {@link ToastRegion}, keyed for `addEventListener`. */
|
|
79
|
+
export interface ToastRegionEventMap {
|
|
80
|
+
'toast-dismiss': CustomEvent;
|
|
81
|
+
'toast-action': CustomEvent;
|
|
82
|
+
}
|
|
83
|
+
export interface ToastRegion {
|
|
84
|
+
addEventListener: TypedAddEventListener<ToastRegion, ToastRegionEventMap>;
|
|
85
|
+
removeEventListener: TypedRemoveEventListener<ToastRegion, ToastRegionEventMap>;
|
|
86
|
+
}
|
|
68
87
|
/**
|
|
69
88
|
* Fixed notification stack with a FIFO overflow queue and independent visible lifetimes.
|
|
70
89
|
* @tag c2-toast-region
|
package/types/src/toast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../src/toast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsC,KAAK,cAAc,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../src/toast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsC,KAAK,cAAc,EAAE,MAAM,KAAK,CAAA;AAGzF,OAAO,KAAK,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAGhG,OAAO,EAAmB,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAInG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,OAAO,CAAA;AAEjH,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAExG,mEAAmE;AACnE,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,WAAW,CAAA;IAC1B,cAAc,EAAE,WAAW,CAAA;CAC5B;AAED,MAAM,WAAW,KAAK;IACpB,gBAAgB,EAAE,qBAAqB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;IAC7D,mBAAmB,EAAE,wBAAwB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;CACpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBACa,KAAM,SAAQ,UAAU;IACnC,OAAgB,MAAM,0BAAoB;IAC1C,2DAA2D;IAC/C,OAAO,SAAK;IACxB,wCAAwC;IAC5B,OAAO,SAAK;IACxB,6BAA6B;IACA,OAAO,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAY;IACtG,oEAAoE;IACjB,MAAM,UAAQ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O,CAAC,iBAAiB,CAGxB;;IAOQ,iBAAiB;IAiBjB,oBAAoB;cAaV,OAAO,CAAC,OAAO,EAAE,cAAc;IAWlD,OAAO,CAAC,cAAc,CAcrB;IAED,OAAO,CAAC,YAAY;IAkCpB,OAAO,CAAC,WAAW;IAanB,0DAA0D;IAC1D,IAAI,WAAW,WAEd;IACD,kDAAkD;IAClD,IAAI,KAAK,WAER;IACD,+EAA+E;IAC/E,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM;IAGnC,kEAAkE;IAClE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,GAAG,OAAO;IAG5E,yCAAyC;IACzC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAE,kBAAmC,GAAG,OAAO;IAGzE,6EAA6E;IAC7E,KAAK;IAGL,wDAAwD;IACxD,KAAK;IAGL,MAAM;IAIN,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,YAAY;IAQX,MAAM;CAkChB;AAGD,+FAA+F;AAC/F,wBAAgB,cAAc,IAAI,WAAW,CAO5C;AAED,gGAAgG;AAChG,eAAO,MAAM,KAAK;oBACA,YAAY;iBACf,MAAM,WAAW,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;kBACjD,MAAM;;CAErB,CAAA;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,KAAK,CAAA;QACjB,iBAAiB,EAAE,WAAW,CAAA;KAC/B;CACF"}
|
package/vue.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// GENERATED by @c2n/framework-types. Do not edit by hand.
|
|
2
|
+
//
|
|
3
|
+
// Vue template types for the custom elements of @c2n/toast. Import once, anywhere in the program:
|
|
4
|
+
//
|
|
5
|
+
// import '@c2n/toast/vue'
|
|
6
|
+
//
|
|
7
|
+
// Tell the compiler about the tags as well, or every c2-* tag is resolved as a Vue component and renders
|
|
8
|
+
// nothing: template.compilerOptions.isCustomElement = (tag) => tag.startsWith('c2-') in vite.config.ts.
|
|
9
|
+
|
|
10
|
+
import type { DefineComponent, HTMLAttributes } from 'vue'
|
|
11
|
+
import type { Toast, ToastEventMap, ToastRegion, ToastRegionEventMap } from '@c2n/toast'
|
|
12
|
+
|
|
13
|
+
/** The element's own public properties, plus every attribute Vue understands on a host element. */
|
|
14
|
+
type C2Props<T> = Partial<Omit<T, keyof HTMLElement>> & HTMLAttributes
|
|
15
|
+
|
|
16
|
+
declare module 'vue' {
|
|
17
|
+
interface GlobalComponents {
|
|
18
|
+
'c2-toast': DefineComponent<
|
|
19
|
+
C2Props<Toast> & {
|
|
20
|
+
'no-icon'?: unknown
|
|
21
|
+
'show-progress'?: unknown
|
|
22
|
+
'action-label'?: unknown
|
|
23
|
+
'close-label'?: unknown
|
|
24
|
+
onToastClose?: (event: ToastEventMap['toast-close']) => void
|
|
25
|
+
onToastAction?: (event: ToastEventMap['toast-action']) => void
|
|
26
|
+
}
|
|
27
|
+
>
|
|
28
|
+
'c2-toast-region': DefineComponent<
|
|
29
|
+
C2Props<ToastRegion> & {
|
|
30
|
+
'max-visible'?: unknown
|
|
31
|
+
'enter-animation'?: unknown
|
|
32
|
+
'exit-animation'?: unknown
|
|
33
|
+
'animation-duration'?: unknown
|
|
34
|
+
'show-progress'?: unknown
|
|
35
|
+
onToastAction?: (event: ToastRegionEventMap['toast-action']) => void
|
|
36
|
+
onToastDismiss?: (event: ToastRegionEventMap['toast-dismiss']) => void
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare module '@vue/runtime-dom' {
|
|
43
|
+
interface HTMLAttributes {
|
|
44
|
+
/** Vue's own definition omits it, and slotting a plain element into a component needs it. */
|
|
45
|
+
slot?: string
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {}
|
package/vue.js
ADDED