piral-notifications
Advanced tools
Comparing version 1.8.0-beta.7653 to 1.8.0-beta.7655
@@ -1,3 +0,2 @@ | ||
/// <reference types="react" /> | ||
export declare const PiralNotificationsHost: import("react").ComponentType<import("./types").NotificationsHostProps>; | ||
export declare const PiralNotificationsToast: import("react").ComponentType<import("./types").NotificationsToastProps>; |
{ | ||
"name": "piral-notifications", | ||
"version": "1.8.0-beta.7653", | ||
"version": "1.8.0-beta.7655", | ||
"description": "Plugin for triggering notifications in Piral.", | ||
@@ -55,6 +55,6 @@ "keywords": [ | ||
"@types/react": "^18.0.0", | ||
"piral-core": "1.8.0-beta.7653", | ||
"piral-core": "1.8.0-beta.7655", | ||
"react": "^18.0.0" | ||
}, | ||
"gitHead": "bcb81e936bf3e74c0a503382076ef1b8617e263f" | ||
"gitHead": "68e1232fe36c56cf7edaa546389bc635693907bf" | ||
} |
@@ -1,1 +0,1 @@ | ||
var piralNotifications=(()=>{var E=Object.create;var p=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var O=t=>p(t,"__esModule",{value:!0});var r=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(o,i)=>(typeof require!="undefined"?require:o)[i]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var g=(t,o)=>{O(t);for(var i in o)p(t,i,{get:o[i],enumerable:!0})},F=(t,o,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of w(o))!B.call(t,n)&&n!=="default"&&p(t,n,{get:()=>o[n],enumerable:!(i=I(o,n))||i.enumerable});return t},c=t=>F(O(p(t!=null?E(D(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var q={};g(q,{Notifications:()=>N,PiralNotificationsHost:()=>d,PiralNotificationsToast:()=>y,createNotificationsApi:()=>j});var u={};g(u,{closeNotification:()=>v,openNotification:()=>k});var l=c(r("piral-core"));function k(t,o){t.dispatch(i=>({...i,notifications:(0,l.prependItem)(i.notifications,o)}))}function v(t,o){t.dispatch(i=>({...i,notifications:(0,l.excludeOn)(i.notifications,n=>n.id===o.id)}))}var x=c(r("react")),f=c(r("piral-core"));var T=c(r("react")),b=c(r("piral-core")),h=t=>T.createElement("div",{className:"piral-notifications-host",key:"default_notifications"},t.children),R=({children:t})=>(0,b.defaultRender)(t);var m=c(r("react")),A=c(r("piral-core"));var C=c(r("piral-core")),d=(0,C.getPiralComponent)("NotificationsHost"),y=(0,C.getPiralComponent)("NotificationsToast");var N=()=>{let t=(0,A.useGlobalState)(o=>o.notifications);return m.createElement(d,null,t.map(({component:o,close:i,options:n,id:a})=>m.createElement(y,{onClose:i,options:n,key:a},m.createElement(o,{onClose:i,options:n}))))};N.displayName="Notifications";function $(t){return(0,x.isValidElement)(t)}function M(t){if(typeof t=="string"){let o=t;return()=>(0,f.defaultRender)(o)}else if((0,x.isValidElement)(t)){let o=t;return()=>o}return t}function G(t,o,i,n,a={}){let s={...n,...a},e={id:o,component:M(i),options:s,close(){setTimeout(()=>t.closeNotification(e),0)}};return typeof s.autoClose=="number"&&s.autoClose>0&&setTimeout(e.close,s.autoClose),e}function V(t,o,i){let n=[],a=0;for(let{content:s,options:e}of o)n.push(G(t,`global-${a++}`,s,i,e));return n}function _(t){return o=>({...o,components:{NotificationsHost:h,NotificationsToast:R,...o.components},notifications:t})}function j(t={}){let{defaultOptions:o={},selectId:i=()=>`${~~(Math.random()*1e4)}`,messages:n=[]}=t;return a=>(a.defineActions(u),a.dispatch((0,f.withAll)(_(V(a,n,o)),(0,f.withRootExtension)("piral-notifications",N))),s=>({showNotification(e,S){let H=typeof e=="string"||$(e)?e:(0,f.withApi)(a,e,s,"extension"),P=G(a,i(),H,o,S);return a.openNotification(P),P.close}}))}return q;})(); | ||
var piralNotifications=(()=>{var E=Object.create;var c=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var r=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(o,i)=>(typeof require<"u"?require:o)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var y=(t,o)=>{for(var i in o)c(t,i,{get:o[i],enumerable:!0})},O=(t,o,i,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of w(o))!B.call(t,n)&&n!==i&&c(t,n,{get:()=>o[n],enumerable:!(a=I(o,n))||a.enumerable});return t};var g=(t,o,i)=>(i=t!=null?E(D(t)):{},O(o||!t||!t.__esModule?c(i,"default",{value:t,enumerable:!0}):i,t)),F=t=>O(c({},"__esModule",{value:!0}),t);var q={};y(q,{Notifications:()=>m,PiralNotificationsHost:()=>C,PiralNotificationsToast:()=>d,createNotificationsApi:()=>j});var N={};y(N,{closeNotification:()=>v,openNotification:()=>k});var p=r("piral-core");function k(t,o){t.dispatch(i=>({...i,notifications:(0,p.prependItem)(i.notifications,o)}))}function v(t,o){t.dispatch(i=>({...i,notifications:(0,p.excludeOn)(i.notifications,a=>a.id===o.id)}))}var x=r("react"),f=r("piral-core");var T=g(r("react")),b=r("piral-core"),h=t=>T.createElement("div",{className:"piral-notifications-host",key:"default_notifications"},t.children),R=({children:t})=>(0,b.defaultRender)(t);var l=g(r("react")),A=r("piral-core");var u=r("piral-core"),C=(0,u.getPiralComponent)("NotificationsHost"),d=(0,u.getPiralComponent)("NotificationsToast");var m=()=>{let t=(0,A.useGlobalState)(o=>o.notifications);return l.createElement(C,null,t.map(({component:o,close:i,options:a,id:n})=>l.createElement(d,{onClose:i,options:a,key:n},l.createElement(o,{onClose:i,options:a}))))};m.displayName="Notifications";function $(t){return(0,x.isValidElement)(t)}function M(t){if(typeof t=="string"){let o=t;return()=>(0,f.defaultRender)(o)}else if((0,x.isValidElement)(t)){let o=t;return()=>o}return t}function G(t,o,i,a,n={}){let s={...a,...n},e={id:o,component:M(i),options:s,close(){setTimeout(()=>t.closeNotification(e),0)}};return typeof s.autoClose=="number"&&s.autoClose>0&&setTimeout(e.close,s.autoClose),e}function V(t,o,i){let a=[],n=0;for(let{content:s,options:e}of o)a.push(G(t,`global-${n++}`,s,i,e));return a}function _(t){return o=>({...o,components:{NotificationsHost:h,NotificationsToast:R,...o.components},notifications:t})}function j(t={}){let{defaultOptions:o={},selectId:i=()=>`${~~(Math.random()*1e4)}`,messages:a=[]}=t;return n=>(n.defineActions(N),n.dispatch((0,f.withAll)(_(V(n,a,o)),(0,f.withRootExtension)("piral-notifications",m))),s=>({showNotification(e,S){let H=typeof e=="string"||$(e)?e:(0,f.withApi)(n,e,s,"extension"),P=G(n,i(),H,o,S);return n.openNotification(P),P.close}}))}return F(q);})(); |
Sorry, the diff of this file is not supported yet
39397
701