@hyperdart/frontend 1.0.8 → 1.0.10

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.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-router-dom"),a=require("@material-ui/core/styles");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(e);function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},l.apply(this,arguments)}const s={default:{palette:{type:"light"},typography:{useNextVariants:!0}},light:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"light"},typography:{useNextVariants:!0}},dark:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"dark"},typography:{useNextVariants:!0}},lightsOut:{palette:{primary:{main:"#F05F40"},type:"dark",background:{default:"#000",paper:"#000"}},shadows:Array(25).fill("0px 4px 12px #888888"),typography:{useNextVariants:!0}}};class o extends e.Component{constructor(e){super(e),this.state={themeName:e.themeName||"light"},this.theme=a.createTheme(s[this.state.themeName])}componentDidUpdate(e){this.props.themeName!==e.themeName&&(this.theme=a.createTheme(s[this.props.themeName]),this.setState({themeName:this.props.themeName}))}render(){return n.default.createElement(a.ThemeProvider,{theme:this.theme},this.props.children)}}exports.themes=s,exports.withHD=a=>r=>{console.log("withHD rendering...");let{quickPanel:s,basename:i,searchData:m,UIOptions:c,...p}=r||{};s=s||!0,i=i||"",p.search=p.search||(e=>console.log("New query = ",e));const u=m&&("object"==typeof m||Array.isArray(m)&&m.length>0);return r.UIOptions&&(r.UIOptions.switchFullScreen=(e=!0)=>{window.parent.postMessage({type:"switchFullScreen",fullScreen:e},"*")}),n.default.createElement(e.Fragment,null,u||c&&c.sandbox?r.match?n.default.createElement(a,r):n.default.createElement(t.BrowserRouter,{basename:i},n.default.createElement(o,{themeName:c&&c.themeName},n.default.createElement(t.Switch,null,n.default.createElement(t.Route,{path:r.baseURL,exact:!0,render:e=>n.default.createElement(a,l({},e,r,{quickPanel:s}))}),n.default.createElement(t.Route,{path:r.baseURL,render:e=>n.default.createElement(a,l({},e,r,{quickPanel:!1}))})))):n.default.createElement(n.default.Fragment,null),!u&&c&&c.sandbox?n.default.createElement("div",{style:{position:"fixed",top:0,width:"100%",display:"flex",justifyContent:"center",backgroundColor:"red",color:"white"}},n.default.createElement("h6",{style:{margin:"5px"}}," No search data received. Component will not be loaded... ")):n.default.createElement(n.default.Fragment,null))};
1
+ "use strict";var e=require("react"),t=require("react-router-dom"),a=require("@material-ui/core/styles");function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},r.apply(this,arguments)}const n={default:{palette:{type:"light"},typography:{useNextVariants:!0}},light:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"light"},typography:{useNextVariants:!0}},dark:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"dark"},typography:{useNextVariants:!0}},lightsOut:{palette:{primary:{main:"#F05F40"},type:"dark",background:{default:"#000",paper:"#000"}},shadows:Array(25).fill("0px 4px 12px #888888"),typography:{useNextVariants:!0}}};class s extends e.Component{constructor(e){super(e),this.state={themeName:e.themeName||"light"};const t=e.theme||n;this.theme=a.createTheme(t[this.state.themeName])}componentDidUpdate(e){this.props.themeName!==e.themeName&&(this.theme=a.createTheme(this.props.theme[this.props.themeName]),this.setState({themeName:this.props.themeName}))}render(){return e.createElement(a.ThemeProvider,{theme:this.theme},this.props.children)}}const o=t=>{const a=e.useRef(!1);return e.useEffect((()=>{t.searchData&&t.searchData.componentPath&&t.history.replace(t.searchData.componentPath)}),[]),e.useEffect((()=>{const e=t.location.pathname+t.location.search;a.current?e&&(!t.searchData||!t.searchData.componentPath||t.searchData&&t.searchData.componentPath&&e!==t.searchData.componentPath)&&window.parent.postMessage({type:"updateComponentPath",componentPath:e},"*"):a.current=!0}),[t.location?.pathname,t.location?.search]),e.createElement(t.comp,t)};exports.themes=n,exports.withHD=a=>n=>{let{quickPanel:c,basename:h,searchData:p,UIOptions:i,...m}=n?{...n}:{};c=c||!0,h=h||"",m.search=m.search||(e=>console.log("New query = ",e));const l=p&&("object"==typeof p||Array.isArray(p)&&p.length>0);n.UIOptions&&(n.UIOptions.switchFullScreen=(e=!0,t=!1)=>{window.parent.postMessage({type:"switchFullScreen",fullScreen:e,navigatedViaRoute:t},"*")},n.UIOptions.showClose=()=>{window.parent.postMessage({type:"showClose"},"*")});let u=!0;try{u=window.self!==window.top}catch(e){u=!0}return e.createElement(e.Fragment,null,l||i&&i.sandbox||!u?n.match?e.createElement(o,n):e.createElement(t.BrowserRouter,{basename:h},e.createElement(s,{themeName:i&&i.themeName,theme:i&&i.theme},e.createElement(t.Switch,null,e.createElement(t.Route,{path:n.baseURL,exact:!0,render:t=>e.createElement(o,r({},t,n,{comp:a,quickPanel:c}))}),e.createElement(t.Route,{path:n.baseURL,render:t=>e.createElement(o,r({},t,n,{comp:a,quickPanel:!1}))})))):e.createElement(e.Fragment,null),!l&&i&&i.sandbox?e.createElement("div",{style:{position:"fixed",top:0,width:"100%",display:"flex",justifyContent:"center",backgroundColor:"red",color:"white"}},e.createElement("h6",{style:{margin:"5px"}}," No search data received. Component will not be loaded... ")):e.createElement(e.Fragment,null))};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import e,{Fragment as t,Component as a}from"react";import{BrowserRouter as r,Switch as n,Route as s}from"react-router-dom";import{createTheme as l,ThemeProvider as o}from"@material-ui/core/styles";function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},i.apply(this,arguments)}const m={default:{palette:{type:"light"},typography:{useNextVariants:!0}},light:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"light"},typography:{useNextVariants:!0}},dark:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"dark"},typography:{useNextVariants:!0}},lightsOut:{palette:{primary:{main:"#F05F40"},type:"dark",background:{default:"#000",paper:"#000"}},shadows:Array(25).fill("0px 4px 12px #888888"),typography:{useNextVariants:!0}}};class p extends a{constructor(e){super(e),this.state={themeName:e.themeName||"light"},this.theme=l(m[this.state.themeName])}componentDidUpdate(e){this.props.themeName!==e.themeName&&(this.theme=l(m[this.props.themeName]),this.setState({themeName:this.props.themeName}))}render(){return e.createElement(o,{theme:this.theme},this.props.children)}}var c=a=>l=>{console.log("withHD rendering...");let{quickPanel:o,basename:m,searchData:c,UIOptions:h,...d}=l||{};o=o||!0,m=m||"",d.search=d.search||(e=>console.log("New query = ",e));const u=c&&("object"==typeof c||Array.isArray(c)&&c.length>0);return l.UIOptions&&(l.UIOptions.switchFullScreen=(e=!0)=>{window.parent.postMessage({type:"switchFullScreen",fullScreen:e},"*")}),e.createElement(t,null,u||h&&h.sandbox?l.match?e.createElement(a,l):e.createElement(r,{basename:m},e.createElement(p,{themeName:h&&h.themeName},e.createElement(n,null,e.createElement(s,{path:l.baseURL,exact:!0,render:t=>e.createElement(a,i({},t,l,{quickPanel:o}))}),e.createElement(s,{path:l.baseURL,render:t=>e.createElement(a,i({},t,l,{quickPanel:!1}))})))):e.createElement(e.Fragment,null),!u&&h&&h.sandbox?e.createElement("div",{style:{position:"fixed",top:0,width:"100%",display:"flex",justifyContent:"center",backgroundColor:"red",color:"white"}},e.createElement("h6",{style:{margin:"5px"}}," No search data received. Component will not be loaded... ")):e.createElement(e.Fragment,null))};export{m as themes,c as withHD};
1
+ import e,{Fragment as t,Component as a,useRef as r,useEffect as n}from"react";import{BrowserRouter as o,Switch as s,Route as c}from"react-router-dom";import{createTheme as p,ThemeProvider as h}from"@material-ui/core/styles";function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},m.apply(this,arguments)}const i={default:{palette:{type:"light"},typography:{useNextVariants:!0}},light:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"light"},typography:{useNextVariants:!0}},dark:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"dark"},typography:{useNextVariants:!0}},lightsOut:{palette:{primary:{main:"#F05F40"},type:"dark",background:{default:"#000",paper:"#000"}},shadows:Array(25).fill("0px 4px 12px #888888"),typography:{useNextVariants:!0}}};class l extends a{constructor(e){super(e),this.state={themeName:e.themeName||"light"};const t=e.theme||i;this.theme=p(t[this.state.themeName])}componentDidUpdate(e){this.props.themeName!==e.themeName&&(this.theme=p(this.props.theme[this.props.themeName]),this.setState({themeName:this.props.themeName}))}render(){return e.createElement(h,{theme:this.theme},this.props.children)}}const d=t=>{const a=r(!1);return n((()=>{t.searchData&&t.searchData.componentPath&&t.history.replace(t.searchData.componentPath)}),[]),n((()=>{const e=t.location.pathname+t.location.search;a.current?e&&(!t.searchData||!t.searchData.componentPath||t.searchData&&t.searchData.componentPath&&e!==t.searchData.componentPath)&&window.parent.postMessage({type:"updateComponentPath",componentPath:e},"*"):a.current=!0}),[t.location?.pathname,t.location?.search]),e.createElement(t.comp,t)};var u=a=>r=>{let{quickPanel:n,basename:p,searchData:h,UIOptions:i,...u}=r?{...r}:{};n=n||!0,p=p||"",u.search=u.search||(e=>console.log("New query = ",e));const y=h&&("object"==typeof h||Array.isArray(h)&&h.length>0);r.UIOptions&&(r.UIOptions.switchFullScreen=(e=!0,t=!1)=>{window.parent.postMessage({type:"switchFullScreen",fullScreen:e,navigatedViaRoute:t},"*")},r.UIOptions.showClose=()=>{window.parent.postMessage({type:"showClose"},"*")});let g=!0;try{g=window.self!==window.top}catch(e){g=!0}return e.createElement(t,null,y||i&&i.sandbox||!g?r.match?e.createElement(d,r):e.createElement(o,{basename:p},e.createElement(l,{themeName:i&&i.themeName,theme:i&&i.theme},e.createElement(s,null,e.createElement(c,{path:r.baseURL,exact:!0,render:t=>e.createElement(d,m({},t,r,{comp:a,quickPanel:n}))}),e.createElement(c,{path:r.baseURL,render:t=>e.createElement(d,m({},t,r,{comp:a,quickPanel:!1}))})))):e.createElement(e.Fragment,null),!y&&i&&i.sandbox?e.createElement("div",{style:{position:"fixed",top:0,width:"100%",display:"flex",justifyContent:"center",backgroundColor:"red",color:"white"}},e.createElement("h6",{style:{margin:"5px"}}," No search data received. Component will not be loaded... ")):e.createElement(e.Fragment,null))};export{i as themes,u as withHD};
2
2
  //# sourceMappingURL=index.modern.js.map
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@hyperdart/frontend",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "hyperDart frontend for dart development",
5
5
  "author": "hyperDart",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.modern.js",
9
+ "type": "module",
9
10
  "source": "src/index.js",
10
11
  "engines": {
11
12
  "node": ">=10"
@@ -24,8 +25,12 @@
24
25
  "react-router-dom": "^4.3.1"
25
26
  },
26
27
  "devDependencies": {
28
+ "@rollup/plugin-babel": "^6.0.4",
29
+ "@rollup/plugin-commonjs": "^26.0.1",
30
+ "@rollup/plugin-node-resolve": "^15.2.4",
27
31
  "@rollup/plugin-replace": "^4.0.0",
28
- "microbundle": "^0.15.0",
29
- "rollup-plugin-postcss": "^4.0.2"
32
+ "rollup": "^4.22.4",
33
+ "rollup-plugin-postcss": "^4.0.2",
34
+ "rollup-plugin-terser": "^7.0.2"
30
35
  }
31
36
  }