piral-modals 0.15.0-alpha.3548 → 0.15.0-alpha.3589

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.
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { ComponentType } from 'react';
2
2
  import { ModalsHostProps, ModalsDialogProps } from './types';
3
- export declare const PiralModalsHost: React.ComponentType<ModalsHostProps>;
4
- export declare const PiralModalsDialog: React.ComponentType<ModalsDialogProps>;
3
+ export declare const PiralModalsHost: ComponentType<ModalsHostProps>;
4
+ export declare const PiralModalsDialog: ComponentType<ModalsDialogProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,CAAC,MAAM,eAAe,GAAyC,iBAAiB,CAAC,YAAY,CAAC,CAAC;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAA2C,iBAAiB,CAAC,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,CAAC,MAAM,eAAe,GAAmC,iBAAiB,CAAC,YAAY,CAAC,CAAC;AAC/F,MAAM,CAAC,MAAM,iBAAiB,GAAqC,iBAAiB,CAAC,cAAc,CAAC,CAAC"}
package/esm/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ComponentType } from 'react';
2
- import { Dict, WrappedComponent, BaseComponentProps, BaseRegistration, Disposable, AnyComponent, RegistrationDisposer } from 'piral-core';
1
+ import type { ComponentType } from 'react';
2
+ import type { Dict, WrappedComponent, BaseComponentProps, BaseRegistration, Disposable, AnyComponent, RegistrationDisposer } from 'piral-core';
3
3
  declare module 'piral-core/lib/types/custom' {
4
4
  interface PiletCustomApi extends PiletModalsApi {
5
5
  }
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { ComponentType } from 'react';
2
2
  import { ModalsHostProps, ModalsDialogProps } from './types';
3
- export declare const PiralModalsHost: React.ComponentType<ModalsHostProps>;
4
- export declare const PiralModalsDialog: React.ComponentType<ModalsDialogProps>;
3
+ export declare const PiralModalsHost: ComponentType<ModalsHostProps>;
4
+ export declare const PiralModalsDialog: ComponentType<ModalsDialogProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AACA,2CAA+C;AAGlC,QAAA,eAAe,GAAyC,IAAA,8BAAiB,EAAC,YAAY,CAAC,CAAC;AACxF,QAAA,iBAAiB,GAA2C,IAAA,8BAAiB,EAAC,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AACA,2CAA+C;AAGlC,QAAA,eAAe,GAAmC,IAAA,8BAAiB,EAAC,YAAY,CAAC,CAAC;AAClF,QAAA,iBAAiB,GAAqC,IAAA,8BAAiB,EAAC,cAAc,CAAC,CAAC"}
package/lib/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ComponentType } from 'react';
2
- import { Dict, WrappedComponent, BaseComponentProps, BaseRegistration, Disposable, AnyComponent, RegistrationDisposer } from 'piral-core';
1
+ import type { ComponentType } from 'react';
2
+ import type { Dict, WrappedComponent, BaseComponentProps, BaseRegistration, Disposable, AnyComponent, RegistrationDisposer } from 'piral-core';
3
3
  declare module 'piral-core/lib/types/custom' {
4
4
  interface PiletCustomApi extends PiletModalsApi {
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-modals",
3
- "version": "0.15.0-alpha.3548",
3
+ "version": "0.15.0-alpha.3589",
4
4
  "description": "Plugin for the display of modal dialogs in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -24,7 +24,8 @@
24
24
  "files": [
25
25
  "esm",
26
26
  "lib",
27
- "src"
27
+ "src",
28
+ "piral-modals.min.js"
28
29
  ],
29
30
  "repository": {
30
31
  "type": "git",
@@ -34,17 +35,21 @@
34
35
  "url": "https://github.com/smapiot/piral/issues"
35
36
  },
36
37
  "scripts": {
37
- "build": "yarn build:commonjs && yarn build:esnext",
38
+ "build": "yarn build:bundle && yarn build:commonjs && yarn build:esnext",
39
+ "build:bundle": "esbuild src/index.ts --outfile=piral-modals.min.js --bundle --external:piral-core --external:react --minify --global-name=piralModals",
38
40
  "build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
39
41
  "build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
40
42
  "typedoc": "typedoc --json ../../../docs/types/piral-modals.json src --exclude \"src/**/*.test.*\"",
41
43
  "test": "echo \"Error: run tests from root\" && exit 1"
42
44
  },
43
45
  "devDependencies": {
44
- "piral-core": "0.15.0-alpha.3548"
46
+ "@types/react": "^17.0.0",
47
+ "piral-core": "0.15.0-alpha.3589",
48
+ "react": "^17.0.1"
45
49
  },
46
50
  "peerDependencies": {
47
- "piral-core": "0.14.x"
51
+ "piral-core": "0.14.x",
52
+ "react": ">=16.8.0"
48
53
  },
49
- "gitHead": "2edf7bbcee6a7e931348198d14139c7f958877e7"
54
+ "gitHead": "3de80e7857d8f95c5f7c6944dfad56d4a5e21f8d"
50
55
  }
@@ -0,0 +1 @@
1
+ var piralModals=(()=>{var k=Object.create;var u=Object.defineProperty,F=Object.defineProperties,N=Object.getOwnPropertyDescriptor,$=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertyNames,A=Object.getOwnPropertySymbols,E=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var S=(o,t,a)=>t in o?u(o,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[t]=a,l=(o,t)=>{for(var a in t||(t={}))G.call(t,a)&&S(o,a,t[a]);if(A)for(var a of A(t))K.call(t,a)&&S(o,a,t[a]);return o},i=(o,t)=>F(o,$(t)),v=o=>u(o,"__esModule",{value:!0});var c=(o=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(o,{get:(t,a)=>(typeof require!="undefined"?require:t)[a]}):o)(function(o){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});var w=(o,t)=>{v(o);for(var a in t)u(o,a,{get:t[a],enumerable:!0})},j=(o,t,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of B(t))!G.call(o,e)&&e!=="default"&&u(o,e,{get:()=>t[e],enumerable:!(a=N(t,e))||a.enumerable});return o},g=o=>j(v(u(o!=null?k(E(o)):{},"default",o&&o.__esModule&&"default"in o?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var X={};w(X,{Modals:()=>P,PiralModalsDialog:()=>b,PiralModalsHost:()=>R,createModalsApi:()=>W});var C={};w(C,{closeModal:()=>q,openModal:()=>_,registerModal:()=>z,unregisterModal:()=>J});var p=g(c("piral-core"));function _(o,t){o.dispatch(a=>i(l({},a),{modals:(0,p.prependItem)(a.modals,t)}))}function q(o,t){o.dispatch(a=>i(l({},a),{modals:(0,p.excludeOn)(a.modals,e=>e.id===t.id)}))}function z(o,t,a){o.dispatch(e=>i(l({},e),{registry:i(l({},e.registry),{modals:(0,p.withKey)(e.registry.modals,t,a)})}))}function J(o,t){o.dispatch(a=>i(l({},a),{registry:i(l({},a.registry),{modals:(0,p.withoutKey)(a.registry.modals,t)})}))}var n=g(c("piral-core"));var h=g(c("react")),O=g(c("piral-core")),I=o=>h.createElement("div",{className:"piral-modals-host",key:"default_modals"},o.open&&h.createElement("div",{className:"piral-modals-overlay"},o.children)),T=o=>(0,O.defaultRender)(o.children);var D=g(c("react")),H=g(c("piral-core"));var x=g(c("piral-core")),R=(0,x.getPiralComponent)("ModalsHost"),b=(0,x.getPiralComponent)("ModalsDialog");function L(o){o.forEach(t=>t.close())}function Q(o,t){if(t){let[a]=Object.keys(o).filter(e=>o[e].name===t).map(e=>o[e]);return a}}var P=()=>{let o=(0,H.useGlobalState)(r=>r.registry.modals),t=(0,H.useGlobalState)(r=>r.modals),a=()=>L(t),e=t.map(r=>{let d=o[r.name]||Q(o,r.alternative),s=d&&d.component,m=d&&d.defaults;return s&&D.createElement(b,i(l({},r),{key:r.name}),D.createElement(s,{onClose:r.close,options:l(l({},m),r.options)}))}).filter(r=>!!r),M=e.length>0;return D.createElement(R,{open:M,close:a},e)};P.displayName="Modals";function U(o){let t={};for(let{name:a,component:e,defaults:M}of o)t[`global-${a}`]={pilet:void 0,name:a,component:e,defaults:M};return t}function V(o){return t=>i(l({},t),{components:l({ModalsHost:I,ModalsDialog:T},t.components),registry:i(l({},t.registry),{modals:o}),modals:[]})}function W(o={}){let{dialogs:t=[],selectId:a=e=>`${e}-${~~(Math.random()*1e4)}`}=o;return e=>(e.defineActions(C),e.dispatch((0,n.withAll)(V(U(t)),(0,n.withRootExtension)("piral-modals",P))),(M,r)=>{let d=r.name;return{showModal(s,m){let y=(0,n.buildName)(d,s),f={id:a(y),name:y,alternative:s,options:m,close(){setTimeout(()=>e.closeModal(f),0)}};return e.openModal(f),f.close},registerModal(s,m,y){let f=(0,n.buildName)(d,s);return e.registerModal(f,{pilet:d,name:s,component:(0,n.withApi)(e,m,M,"modal"),defaults:y}),()=>M.unregisterModal(s)},unregisterModal(s){let m=(0,n.buildName)(d,s);e.unregisterModal(m)}}})}return X;})();
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
1
+ import { ComponentType } from 'react';
2
2
  import { getPiralComponent } from 'piral-core';
3
3
  import { ModalsHostProps, ModalsDialogProps } from './types';
4
4
 
5
- export const PiralModalsHost: React.ComponentType<ModalsHostProps> = getPiralComponent('ModalsHost');
6
- export const PiralModalsDialog: React.ComponentType<ModalsDialogProps> = getPiralComponent('ModalsDialog');
5
+ export const PiralModalsHost: ComponentType<ModalsHostProps> = getPiralComponent('ModalsHost');
6
+ export const PiralModalsDialog: ComponentType<ModalsDialogProps> = getPiralComponent('ModalsDialog');
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ComponentType } from 'react';
2
- import {
1
+ import type { ComponentType } from 'react';
2
+ import type {
3
3
  Dict,
4
4
  WrappedComponent,
5
5
  BaseComponentProps,