@hyperdart/frontend 1.0.13 → 2.0.0

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";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))};
1
+ "use strict";var e=require("react"),t=require("react-router-dom"),a=require("@mui/material/styles"),n=require("react-dom/client");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 n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r.apply(this,arguments)}const o={default:{palette:{mode:"light"},typography:{useNextVariants:!0}},light:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"light"},typography:{useNextVariants:!0}},lightsOut:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"dark"},typography:{useNextVariants:!0}},dark:{palette:{primary:{main:"#F05F40"},type:"dark",background:{default:"#000",paper:"#000"}},shadows:Array(25).fill("0px 4px 12px #888888"),typography:{useNextVariants:!0}}};function s(t,a){window.onmessage=function(r){if("dataRefresh"===r.data.type){const o=r.data.searchData&&r.data.searchData[0];!function(t,a,r,o){const s=n.createRoot(document.getElementById("root")),c=location.pathname.indexOf(a)<0?"":location.pathname.slice(0,location.pathname.indexOf(a));s.render(e.createElement(t,{baseURL:a,basename:c,searchData:r,UIOptions:o}))}(t,a,o,r.data.UIOptions)}};const r=new ResizeObserver((e=>{if(e.length>0){const t=e[0].target.clientHeight;window.parent.postMessage({type:"resizeIframe",height:t},"*")}})),o=document.getElementById("root");o&&r.observe(o)}class c extends e.Component{constructor(e){super(e),this.state={themeName:e.themeName||"light"},this.themeSource=e.theme||o,this.theme=a.createTheme(a.adaptV4Theme(this.themeSource[this.state.themeName]))}componentDidUpdate(e){this.props.themeName!==e.themeName&&(this.theme=a.createTheme(a.adaptV4Theme(this.themeSource[this.props.themeName])),this.setState({themeName:this.props.themeName}))}render(){return e.createElement(a.StyledEngineProvider,{injectFirst:!0},e.createElement(a.ThemeProvider,{theme:this.theme},this.props.children))}}const i=a=>{const n=e.useRef(!1),r=t.useNavigate(),o=t.useLocation();return e.useEffect((()=>{a.searchData&&a.searchData.componentPath&&r(a.searchData.componentPath,{replace:!0})}),[]),e.useEffect((()=>{const e=o.pathname+o.search;n.current?e&&(!a.searchData||!a.searchData.componentPath||a.searchData&&a.searchData.componentPath&&e!==a.searchData.componentPath)&&window.parent.postMessage({type:"updateComponentPath",componentPath:e},"*"):n.current=!0}),[o?.pathname,o?.search]),e.createElement(a.comp,a)};exports.themes=o,exports.withHD=a=>{const n=n=>{let{quickPanel:o,basename:s,searchData:h,UIOptions:m,...p}=n?{...n}:{};o=o||!0,s=s||"",p.search=p.search||(e=>console.log("New query = ",e));const l=h&&("object"==typeof h||Array.isArray(h)&&h.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||m&&m.sandbox||!u?n.match?e.createElement(i,n):e.createElement(t.BrowserRouter,{basename:s},e.createElement(c,{themeName:m&&m.themeName,theme:m&&m.theme},e.createElement(t.Routes,null,e.createElement(t.Route,{path:n.baseURL,element:e.createElement(i,r({},n,{comp:a,quickPanel:o}))}),e.createElement(t.Route,{path:"*",element:e.createElement(i,r({},n,{comp:a,quickPanel:!1}))})))):e.createElement(e.Fragment,null),!l&&m&&m.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))};return n.initHD=s,n};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
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};
1
+ import e,{Fragment as t,Component as a,useRef as n,useEffect as r}from"react";import{BrowserRouter as o,Routes as s,Route as c,useNavigate as m,useLocation as i}from"react-router-dom";import{createTheme as h,adaptV4Theme as p,StyledEngineProvider as l,ThemeProvider as d}from"@mui/material/styles";import u from"react-dom/client";function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},y.apply(this,arguments)}const g={default:{palette:{mode:"light"},typography:{useNextVariants:!0}},light:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"light"},typography:{useNextVariants:!0}},lightsOut:{palette:{primary:{main:"#F05F40"},secondary:{main:"#40f0bb"},type:"dark"},typography:{useNextVariants:!0}},dark:{palette:{primary:{main:"#F05F40"},type:"dark",background:{default:"#000",paper:"#000"}},shadows:Array(25).fill("0px 4px 12px #888888"),typography:{useNextVariants:!0}}};function f(t,a){window.onmessage=function(n){if("dataRefresh"===n.data.type){const r=n.data.searchData&&n.data.searchData[0];!function(t,a,n,r){const o=u.createRoot(document.getElementById("root")),s=location.pathname.indexOf(a)<0?"":location.pathname.slice(0,location.pathname.indexOf(a));o.render(e.createElement(t,{baseURL:a,basename:s,searchData:n,UIOptions:r}))}(t,a,r,n.data.UIOptions)}};const n=new ResizeObserver((e=>{if(e.length>0){const t=e[0].target.clientHeight;window.parent.postMessage({type:"resizeIframe",height:t},"*")}})),r=document.getElementById("root");r&&n.observe(r)}class w extends a{constructor(e){super(e),this.state={themeName:e.themeName||"light"},this.themeSource=e.theme||g,this.theme=h(p(this.themeSource[this.state.themeName]))}componentDidUpdate(e){this.props.themeName!==e.themeName&&(this.theme=h(p(this.themeSource[this.props.themeName])),this.setState({themeName:this.props.themeName}))}render(){return e.createElement(l,{injectFirst:!0},e.createElement(d,{theme:this.theme},this.props.children))}}const b=t=>{const a=n(!1),o=m(),s=i();return r((()=>{t.searchData&&t.searchData.componentPath&&o(t.searchData.componentPath,{replace:!0})}),[]),r((()=>{const e=s.pathname+s.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}),[s?.pathname,s?.search]),e.createElement(t.comp,t)},E=a=>{const n=n=>{let{quickPanel:r,basename:m,searchData:i,UIOptions:h,...p}=n?{...n}:{};r=r||!0,m=m||"",p.search=p.search||(e=>console.log("New query = ",e));const l=i&&("object"==typeof i||Array.isArray(i)&&i.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 d=!0;try{d=window.self!==window.top}catch(e){d=!0}return e.createElement(t,null,l||h&&h.sandbox||!d?n.match?e.createElement(b,n):e.createElement(o,{basename:m},e.createElement(w,{themeName:h&&h.themeName,theme:h&&h.theme},e.createElement(s,null,e.createElement(c,{path:n.baseURL,element:e.createElement(b,y({},n,{comp:a,quickPanel:r}))}),e.createElement(c,{path:"*",element:e.createElement(b,y({},n,{comp:a,quickPanel:!1}))})))):e.createElement(e.Fragment,null),!l&&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))};return n.initHD=f,n};export{g as themes,E as withHD};
2
2
  //# sourceMappingURL=index.modern.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperdart/frontend",
3
- "version": "1.0.13",
3
+ "version": "2.0.0",
4
4
  "description": "hyperDart frontend for dart development",
5
5
  "author": "hyperDart",
6
6
  "license": "MIT",
@@ -18,22 +18,23 @@
18
18
  "dist/*.js"
19
19
  ],
20
20
  "peerDependencies": {
21
- "@material-ui/core": "^4.11.4",
22
- "react": "^17.0.0",
23
- "react-dom": "^17.0.0",
24
- "react-router-dom": "^5.3.4"
21
+ "@mui/icons-material": "^6.0.0",
22
+ "react": ">=17.0.0",
23
+ "react-dom": ">=17.0.0",
24
+ "react-router-dom": "^6.14.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@material-ui/core": "^4.11.4",
27
+ "@mui/icons-material": "^6.0.0",
28
28
  "@rollup/plugin-babel": "^6.0.4",
29
29
  "@rollup/plugin-commonjs": "^26.0.1",
30
30
  "@rollup/plugin-node-resolve": "^15.2.4",
31
31
  "@rollup/plugin-replace": "^4.0.0",
32
- "react": "^17.0.0",
33
- "react-dom": "^17.0.0",
34
- "react-router-dom": "^5.3.4",
32
+ "react": ">=17.0.0",
33
+ "react-dom": ">=17.0.0",
34
+ "react-router-dom": "^6.14.0",
35
35
  "rollup": "^4.22.4",
36
36
  "rollup-plugin-postcss": "^4.0.2",
37
- "rollup-plugin-terser": "^7.0.2"
37
+ "rollup-plugin-terser": "^7.0.2",
38
+ "rollup-plugin-visualizer": "^5.14.0"
38
39
  }
39
40
  }