@adminui-dev/layout 1.1.2 → 1.1.4

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.
@@ -48,6 +48,7 @@ interface LayoutConfig {
48
48
  asideTransparent?: boolean;
49
49
  headerTransparent?: boolean;
50
50
  containerTransparent?: boolean;
51
+ hideAsideMenuDataEmpty?: boolean;
51
52
  asideBlur?: boolean;
52
53
  headerBlur?: boolean;
53
54
  containerBlur?: boolean;
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("react/jsx-runtime"),n=require("react");function r(e,n){void 0===n&&(n={});var r=n.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var t="Layout-module_rootBackground__j3UVG";r("@layer base {\r\n html, body {\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n width: 100%; \r\n height: 100%;\r\n }\r\n #root { \r\n text-align: initial;\r\n width: 100%;\r\n height:100%\r\n } \r\n}\r\n*, *:before, *:after {\r\n box-sizing: border-box;\r\n}\r\n.Layout-module_rootBox__3JHjy {\r\n text-rendering: optimizeLegibility;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n text-align: initial;\r\n width: 100%;\r\n min-height: 100%;\r\n}\r\n.Layout-module_rootBackground__j3UVG {\r\n box-sizing: border-box; \r\n pointer-events: none;\r\n inset-block-start:0;\r\n inset-inline-start:0; \r\n width: 100%; \r\n min-width: 100vw;\r\n height:100%;\r\n min-height: 100vh;\r\n overflow: hidden;\r\n position: fixed;\r\n z-index: 0;\r\n}\r\n.Layout-module_rootBackground__j3UVG>div{\r\n width:100%;\r\n height: 100%;\r\n overflow: hidden;\r\n}\r\n.Layout-module_rootLayout__jVEEF {\r\n position: relative;\r\n z-index: 1;\r\n box-sizing: border-box; \r\n width: 100%;\r\n min-height: 100%;\r\n display: flex; \r\n flex-flow: row;\r\n background-color: transparent;\r\n container-type: inline-size;\r\n}\r\n\r\n.Layout-module_mainLayout__6W9W9 {\r\n box-sizing: border-box; \r\n display: flex;\r\n flex-flow: column; \r\n width: 100%;\r\n}\r\n");const o=Symbol("LayoutAside"),i=Symbol("LayoutContent"),a=Symbol("LayoutHeader"),l=Symbol("LayoutBackground"),s=n.createContext({setLayoutConfig:()=>{},setLocale:()=>{}}),d=n.createContext({locale:"en-US",languages:[],layoutConfig:{},themeSkinMap:{tidy:[],rich:[]}}),u=()=>n.useContext(d);function c(n){return e.jsx("div",{className:t,children:e.jsx(e.Fragment,{children:n.children})})}function h(n){return e.jsx(e.Fragment,{children:n.children})}function m(n){return e.jsx(e.Fragment,{children:n.children})}function g(n){return e.jsx(e.Fragment,{children:n.children})}c.displayName="LayoutBackground",c.role=l,h.displayName="LayoutContent",h.role=i,m.displayName="LayoutAside",m.role=o,g.displayName="LayoutHeader",g.role=a;var x="layout-module_rootBox__Y8bEx",y="layout-module_rootLayout__TePvr",f="layout-module_mainLayout__a8Tb9";function b(r){let t=null,s=null,d=null,u=null;return n.Children.forEach(r.children,e=>{const n=e.type.role;n===a?t=e:n===i?s=e:n===o?d=e:n===l&&(u=e)}),e.jsx(e.Fragment,{children:e.jsxs("div",{ref:r.ref,className:x,style:{...r.style},children:[u,e.jsxs("div",{className:y,children:[d,e.jsxs("div",{className:f,children:[t,s]})]})]})})}r("@layer base {\r\n html, body {\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n width: 100%; \r\n height: 100%;\r\n }\r\n #root { \r\n text-align: initial;\r\n width: 100%;\r\n height:100%\r\n } \r\n}\r\n*, *:before, *:after {\r\n box-sizing: border-box;\r\n}\r\n.layout-module_rootBox__Y8bEx {\r\n text-rendering: optimizeLegibility;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n text-align: initial;\r\n width: 100%;\r\n min-height: 100%;\r\n}\r\n.layout-module_rootBackground__vEs6e {\r\n box-sizing: border-box; \r\n pointer-events: none;\r\n inset-block-start:0;\r\n inset-inline-start:0; \r\n width: 100%; \r\n min-width: 100vw;\r\n height:100%;\r\n min-height: 100vh;\r\n overflow: hidden;\r\n position: fixed;\r\n z-index: 0;\r\n}\r\n.layout-module_rootBackground__vEs6e>div{\r\n width:100%;\r\n height: 100%;\r\n overflow: hidden;\r\n}\r\n.layout-module_rootLayout__TePvr {\r\n position: relative;\r\n z-index: 1;\r\n box-sizing: border-box; \r\n width: 100%;\r\n min-height: 100%;\r\n display: flex; \r\n flex-flow: row;\r\n background-color: transparent;\r\n container-type: inline-size;\r\n}\r\n\r\n.layout-module_mainLayout__a8Tb9 {\r\n box-sizing: border-box; \r\n display: flex;\r\n flex-flow: column; \r\n width: 100%;\r\n}\r\n"),b.Aside=m,b.Content=h,b.Header=g,b.Background=c;const p=e=>({r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:9===e.length?(parseInt(e.slice(7,9),16)/255).toFixed(2):1});exports.BaseLayout=b,exports.FullScreenButton=function(r){const t=!!document.fullscreenElement,[o,i]=n.useState(t),a=()=>{i(!!document.fullscreenElement)},l=e=>{"F11"===e.code&&(e.preventDefault(),s())};n.useEffect(()=>(document.addEventListener("fullscreenchange",a),document.addEventListener("keydown",l,!0),()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("keydown",l)}),[]);const s=()=>{o?document.exitFullscreen():document.documentElement.requestFullscreen()};if(!r.buttons||r.buttons.length<2)return e.jsx(e.Fragment,{});const[d,u]=r.buttons,c=o?d:u;return n.cloneElement(c,{onClick:e=>{console.log(e),s()}})},exports.LayoutBackground=c,exports.createConfigActionContext=()=>s,exports.createConfigStateContext=()=>d,exports.defaultConfig={headerHeight:50,asideWidth:260,layoutType:"leftMenu",collapsedPosition:"bottom",avatarPosition:"rightTop",theme:"system",visibleBreadcrumbIcon:"none",primaryColor:"#417ffb"},exports.defineConfig=function(e){return e},exports.getAvatarInitials=function(e){if(!e)return"";const n=Array.from(e);if(0===n.length)return"";const r=n[0];return function(e){if(0===e.length)return!1;const n=e.codePointAt(0);return n>=19968&&n<=40959||n>=13312&&n<=19903||n>=12352&&n<=12543||n>=44032&&n<=55215||n>=65280&&n<=65519||n>=126976&&n<=129791||n>=127744&&n<=128511||n>=128640&&n<=128767||n>=129280&&n<=129535||n>=9728&&n<=9983||n>=9984&&n<=10175}(r)?r:n.slice(0,2).join("")},exports.getLayoutTheme=e=>{if("system"==e){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return e},exports.hexToRgb=e=>{const{r:n,g:r,b:t}=p(e);return{r:n,g:r,b:t}},exports.hexToRgbaString=(e,n)=>{const{r:r,g:t,b:o,a:i}=p(e);return`rgba(${r}, ${t}, ${o}, ${n??i})`},exports.useConfigAction=()=>n.useContext(s),exports.useConfigState=u,exports.useTheme=()=>u().layoutConfig.theme;
1
+ "use strict";var n=require("react/jsx-runtime"),e=require("react");function r(n,e){void 0===e&&(e={});var r=e.insertAt;if(n&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=n:o.appendChild(document.createTextNode(n))}}var t="Layout-module_rootBackground__j3UVG";r("@layer base {\r\n html, body {\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n width: 100%; \r\n height: 100%;\r\n }\r\n #root { \r\n text-align: initial;\r\n width: 100%;\r\n height:100%\r\n } \r\n}\r\n*, *:before, *:after {\r\n box-sizing: border-box;\r\n}\r\n.Layout-module_rootBox__3JHjy {\r\n text-rendering: optimizeLegibility;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n text-align: initial;\r\n width: 100%;\r\n min-height: 100%;\r\n}\r\n.Layout-module_rootBackground__j3UVG {\r\n box-sizing: border-box; \r\n pointer-events: none;\r\n inset-block-start:0;\r\n inset-inline-start:0; \r\n width: 100%; \r\n min-width: 100vw;\r\n height:100%;\r\n min-height: 100vh;\r\n overflow: hidden;\r\n position: fixed;\r\n z-index: 0;\r\n}\r\n.Layout-module_rootBackground__j3UVG>div{\r\n width:100%;\r\n height: 100%;\r\n overflow: hidden;\r\n}\r\n.Layout-module_rootLayout__jVEEF {\r\n position: relative;\r\n z-index: 1;\r\n box-sizing: border-box; \r\n width: 100%;\r\n min-height: 100%;\r\n display: flex; \r\n flex-flow: row;\r\n background-color: transparent;\r\n}\r\n\r\n.Layout-module_mainLayout__6W9W9 {\r\n box-sizing: border-box; \r\n display: flex;\r\n flex-flow: column; \r\n width: 100%;\r\n min-width: 0px;\r\n}\r\n");const o=Symbol("LayoutAside"),i=Symbol("LayoutContent"),a=Symbol("LayoutHeader"),l=Symbol("LayoutBackground"),s=e.createContext({setLayoutConfig:()=>{},setLocale:()=>{}}),d=e.createContext({locale:"en-US",languages:[],layoutConfig:{},themeSkinMap:{tidy:[],rich:[]}}),u=()=>e.useContext(d);function c(e){return n.jsx("div",{className:t,children:n.jsx(n.Fragment,{children:e.children})})}function h(e){return n.jsx(n.Fragment,{children:e.children})}function m(e){return n.jsx(n.Fragment,{children:e.children})}function g(e){return n.jsx(n.Fragment,{children:e.children})}c.displayName="LayoutBackground",c.role=l,h.displayName="LayoutContent",h.role=i,m.displayName="LayoutAside",m.role=o,g.displayName="LayoutHeader",g.role=a;var x="layout-module_rootBox__Y8bEx",f="layout-module_rootLayout__TePvr",y="layout-module_mainLayout__a8Tb9";function b(r){let t=null,s=null,d=null,u=null;return e.Children.forEach(r.children,n=>{const e=n.type.role;e===a?t=n:e===i?s=n:e===o?d=n:e===l&&(u=n)}),n.jsx(n.Fragment,{children:n.jsxs("div",{ref:r.ref,className:x,style:{...r.style},children:[u,n.jsxs("div",{className:f,children:[d,n.jsxs("div",{className:y,children:[t,s]})]})]})})}r("@layer base {\r\n html, body {\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n width: 100%; \r\n height: 100%;\r\n }\r\n #root { \r\n text-align: initial;\r\n width: 100%;\r\n height:100%\r\n } \r\n}\r\n*, *:before, *:after {\r\n box-sizing: border-box;\r\n}\r\n.layout-module_rootBox__Y8bEx {\r\n text-rendering: optimizeLegibility;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n text-align: initial;\r\n width: 100%;\r\n min-height: 100%;\r\n}\r\n.layout-module_rootBackground__vEs6e {\r\n box-sizing: border-box; \r\n pointer-events: none;\r\n inset-block-start:0;\r\n inset-inline-start:0; \r\n width: 100%; \r\n min-width: 100vw;\r\n height:100%;\r\n min-height: 100vh;\r\n overflow: hidden;\r\n position: fixed;\r\n z-index: 0;\r\n}\r\n.layout-module_rootBackground__vEs6e>div{\r\n width:100%;\r\n height: 100%;\r\n overflow: hidden;\r\n}\r\n.layout-module_rootLayout__TePvr {\r\n position: relative;\r\n z-index: 1;\r\n box-sizing: border-box; \r\n width: 100%;\r\n min-height: 100%;\r\n display: flex; \r\n flex-flow: row;\r\n background-color: transparent;\r\n}\r\n\r\n.layout-module_mainLayout__a8Tb9 {\r\n box-sizing: border-box; \r\n display: flex;\r\n flex-flow: column; \r\n width: 100%;\r\n min-width: 0px;\r\n}\r\n"),b.Aside=m,b.Content=h,b.Header=g,b.Background=c;const p=n=>({r:parseInt(n.slice(1,3),16),g:parseInt(n.slice(3,5),16),b:parseInt(n.slice(5,7),16),a:9===n.length?(parseInt(n.slice(7,9),16)/255).toFixed(2):1});exports.BaseLayout=b,exports.FullScreenButton=function(r){const t=!!document.fullscreenElement,[o,i]=e.useState(t),a=()=>{i(!!document.fullscreenElement)},l=n=>{"F11"===n.code&&(n.preventDefault(),s())};e.useEffect(()=>(document.addEventListener("fullscreenchange",a),document.addEventListener("keydown",l,!0),()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("keydown",l)}),[]);const s=()=>{o?document.exitFullscreen():document.documentElement.requestFullscreen()};if(!r.buttons||r.buttons.length<2)return n.jsx(n.Fragment,{});const[d,u]=r.buttons,c=o?d:u;return e.cloneElement(c,{onClick:n=>{console.log(n),s()}})},exports.LayoutBackground=c,exports.createConfigActionContext=()=>s,exports.createConfigStateContext=()=>d,exports.defaultConfig={headerHeight:50,asideWidth:260,layoutType:"leftMenu",collapsedPosition:"bottom",avatarPosition:"rightTop",theme:"system",visibleBreadcrumbIcon:"none",primaryColor:"#417ffb"},exports.defineConfig=function(n){return n},exports.getAvatarInitials=function(n){if(!n)return"";const e=Array.from(n);if(0===e.length)return"";const r=e[0];return function(n){if(0===n.length)return!1;const e=n.codePointAt(0);return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=12352&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519||e>=126976&&e<=129791||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=129280&&e<=129535||e>=9728&&e<=9983||e>=9984&&e<=10175}(r)?r:e.slice(0,2).join("")},exports.getLayoutTheme=n=>{if("system"==n){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return n},exports.hexToRgb=n=>{const{r:e,g:r,b:t}=p(n);return{r:e,g:r,b:t}},exports.hexToRgbaString=(n,e)=>{const{r:r,g:t,b:o,a:i}=p(n);return`rgba(${r}, ${t}, ${o}, ${e??i})`},exports.useConfigAction=()=>e.useContext(s),exports.useConfigState=u,exports.useTheme=()=>u().layoutConfig.theme;
package/dist/index.d.ts CHANGED
@@ -52,6 +52,7 @@ interface LayoutConfig {
52
52
  asideTransparent?: boolean;
53
53
  headerTransparent?: boolean;
54
54
  containerTransparent?: boolean;
55
+ hideAsideMenuDataEmpty?: boolean;
55
56
  asideBlur?: boolean;
56
57
  headerBlur?: boolean;
57
58
  containerBlur?: boolean;
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- import{jsx as n,Fragment as e,jsxs as r}from"react/jsx-runtime";import t,{createContext as o,useContext as i,useState as l,useEffect as a}from"react";function d(n,e){void 0===e&&(e={});var r=e.insertAt;if(n&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=n:o.appendChild(document.createTextNode(n))}}var s="Layout-module_rootBackground__j3UVG";function u(n){return n}d("@layer base {\r\n html, body {\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n width: 100%; \r\n height: 100%;\r\n }\r\n #root { \r\n text-align: initial;\r\n width: 100%;\r\n height:100%\r\n } \r\n}\r\n*, *:before, *:after {\r\n box-sizing: border-box;\r\n}\r\n.Layout-module_rootBox__3JHjy {\r\n text-rendering: optimizeLegibility;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n text-align: initial;\r\n width: 100%;\r\n min-height: 100%;\r\n}\r\n.Layout-module_rootBackground__j3UVG {\r\n box-sizing: border-box; \r\n pointer-events: none;\r\n inset-block-start:0;\r\n inset-inline-start:0; \r\n width: 100%; \r\n min-width: 100vw;\r\n height:100%;\r\n min-height: 100vh;\r\n overflow: hidden;\r\n position: fixed;\r\n z-index: 0;\r\n}\r\n.Layout-module_rootBackground__j3UVG>div{\r\n width:100%;\r\n height: 100%;\r\n overflow: hidden;\r\n}\r\n.Layout-module_rootLayout__jVEEF {\r\n position: relative;\r\n z-index: 1;\r\n box-sizing: border-box; \r\n width: 100%;\r\n min-height: 100%;\r\n display: flex; \r\n flex-flow: row;\r\n background-color: transparent;\r\n container-type: inline-size;\r\n}\r\n\r\n.Layout-module_mainLayout__6W9W9 {\r\n box-sizing: border-box; \r\n display: flex;\r\n flex-flow: column; \r\n width: 100%;\r\n}\r\n");const c=Symbol("LayoutAside"),h=Symbol("LayoutContent"),m=Symbol("LayoutHeader"),g=Symbol("LayoutBackground"),y={headerHeight:50,asideWidth:260,layoutType:"leftMenu",collapsedPosition:"bottom",avatarPosition:"rightTop",theme:"system",visibleBreadcrumbIcon:"none",primaryColor:"#417ffb"},f=o({setLayoutConfig:()=>{},setLocale:()=>{}}),b=o({locale:"en-US",languages:[],layoutConfig:{},themeSkinMap:{tidy:[],rich:[]}}),x=()=>f,p=()=>b,_=()=>i(b),v=()=>i(f),w=()=>_().layoutConfig.theme;function L(r){return n("div",{className:s,children:n(e,{children:r.children})})}function k(r){return n(e,{children:r.children})}function z(r){return n(e,{children:r.children})}function E(r){return n(e,{children:r.children})}L.displayName="LayoutBackground",L.role=g,k.displayName="LayoutContent",k.role=h,z.displayName="LayoutAside",z.role=c,E.displayName="LayoutHeader",E.role=m;var B="layout-module_rootBox__Y8bEx",C="layout-module_rootLayout__TePvr",N="layout-module_mainLayout__a8Tb9";function T(o){let i=null,l=null,a=null,d=null;return t.Children.forEach(o.children,n=>{const e=n.type.role;e===m?i=n:e===h?l=n:e===c?a=n:e===g&&(d=n)}),n(e,{children:r("div",{ref:o.ref,className:B,style:{...o.style},children:[d,r("div",{className:C,children:[a,r("div",{className:N,children:[i,l]})]})]})})}function S(r){const o=!!document.fullscreenElement,[i,d]=l(o),s=()=>{d(!!document.fullscreenElement)},u=n=>{"F11"===n.code&&(n.preventDefault(),c())};a(()=>(document.addEventListener("fullscreenchange",s),document.addEventListener("keydown",u,!0),()=>{document.removeEventListener("fullscreenchange",s),document.removeEventListener("keydown",u)}),[]);const c=()=>{i?document.exitFullscreen():document.documentElement.requestFullscreen()};if(!r.buttons||r.buttons.length<2)return n(e,{});const[h,m]=r.buttons,g=i?h:m;return t.cloneElement(g,{onClick:n=>{console.log(n),c()}})}function j(n){if(!n)return"";const e=Array.from(n);if(0===e.length)return"";const r=e[0];return function(n){if(0===n.length)return!1;const e=n.codePointAt(0);return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=12352&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519||e>=126976&&e<=129791||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=129280&&e<=129535||e>=9728&&e<=9983||e>=9984&&e<=10175}(r)?r:e.slice(0,2).join("")}d("@layer base {\r\n html, body {\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n width: 100%; \r\n height: 100%;\r\n }\r\n #root { \r\n text-align: initial;\r\n width: 100%;\r\n height:100%\r\n } \r\n}\r\n*, *:before, *:after {\r\n box-sizing: border-box;\r\n}\r\n.layout-module_rootBox__Y8bEx {\r\n text-rendering: optimizeLegibility;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n text-align: initial;\r\n width: 100%;\r\n min-height: 100%;\r\n}\r\n.layout-module_rootBackground__vEs6e {\r\n box-sizing: border-box; \r\n pointer-events: none;\r\n inset-block-start:0;\r\n inset-inline-start:0; \r\n width: 100%; \r\n min-width: 100vw;\r\n height:100%;\r\n min-height: 100vh;\r\n overflow: hidden;\r\n position: fixed;\r\n z-index: 0;\r\n}\r\n.layout-module_rootBackground__vEs6e>div{\r\n width:100%;\r\n height: 100%;\r\n overflow: hidden;\r\n}\r\n.layout-module_rootLayout__TePvr {\r\n position: relative;\r\n z-index: 1;\r\n box-sizing: border-box; \r\n width: 100%;\r\n min-height: 100%;\r\n display: flex; \r\n flex-flow: row;\r\n background-color: transparent;\r\n container-type: inline-size;\r\n}\r\n\r\n.layout-module_mainLayout__a8Tb9 {\r\n box-sizing: border-box; \r\n display: flex;\r\n flex-flow: column; \r\n width: 100%;\r\n}\r\n"),T.Aside=z,T.Content=k,T.Header=E,T.Background=L;const A=n=>({r:parseInt(n.slice(1,3),16),g:parseInt(n.slice(3,5),16),b:parseInt(n.slice(5,7),16),a:9===n.length?(parseInt(n.slice(7,9),16)/255).toFixed(2):1}),F=n=>{const{r:e,g:r,b:t}=A(n);return{r:e,g:r,b:t}},H=(n,e)=>{const{r:r,g:t,b:o,a:i}=A(n);return`rgba(${r}, ${t}, ${o}, ${e??i})`},I=n=>{if("system"==n){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return n};export{T as BaseLayout,S as FullScreenButton,L as LayoutBackground,x as createConfigActionContext,p as createConfigStateContext,y as defaultConfig,u as defineConfig,j as getAvatarInitials,I as getLayoutTheme,F as hexToRgb,H as hexToRgbaString,v as useConfigAction,_ as useConfigState,w as useTheme};
1
+ import{jsx as n,Fragment as e,jsxs as r}from"react/jsx-runtime";import t,{createContext as o,useContext as i,useState as l,useEffect as d}from"react";function a(n,e){void 0===e&&(e={});var r=e.insertAt;if(n&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=n:o.appendChild(document.createTextNode(n))}}var s="Layout-module_rootBackground__j3UVG";function u(n){return n}a("@layer base {\r\n html, body {\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n width: 100%; \r\n height: 100%;\r\n }\r\n #root { \r\n text-align: initial;\r\n width: 100%;\r\n height:100%\r\n } \r\n}\r\n*, *:before, *:after {\r\n box-sizing: border-box;\r\n}\r\n.Layout-module_rootBox__3JHjy {\r\n text-rendering: optimizeLegibility;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n text-align: initial;\r\n width: 100%;\r\n min-height: 100%;\r\n}\r\n.Layout-module_rootBackground__j3UVG {\r\n box-sizing: border-box; \r\n pointer-events: none;\r\n inset-block-start:0;\r\n inset-inline-start:0; \r\n width: 100%; \r\n min-width: 100vw;\r\n height:100%;\r\n min-height: 100vh;\r\n overflow: hidden;\r\n position: fixed;\r\n z-index: 0;\r\n}\r\n.Layout-module_rootBackground__j3UVG>div{\r\n width:100%;\r\n height: 100%;\r\n overflow: hidden;\r\n}\r\n.Layout-module_rootLayout__jVEEF {\r\n position: relative;\r\n z-index: 1;\r\n box-sizing: border-box; \r\n width: 100%;\r\n min-height: 100%;\r\n display: flex; \r\n flex-flow: row;\r\n background-color: transparent;\r\n}\r\n\r\n.Layout-module_mainLayout__6W9W9 {\r\n box-sizing: border-box; \r\n display: flex;\r\n flex-flow: column; \r\n width: 100%;\r\n min-width: 0px;\r\n}\r\n");const c=Symbol("LayoutAside"),h=Symbol("LayoutContent"),m=Symbol("LayoutHeader"),g=Symbol("LayoutBackground"),y={headerHeight:50,asideWidth:260,layoutType:"leftMenu",collapsedPosition:"bottom",avatarPosition:"rightTop",theme:"system",visibleBreadcrumbIcon:"none",primaryColor:"#417ffb"},f=o({setLayoutConfig:()=>{},setLocale:()=>{}}),b=o({locale:"en-US",languages:[],layoutConfig:{},themeSkinMap:{tidy:[],rich:[]}}),x=()=>f,p=()=>b,_=()=>i(b),v=()=>i(f),w=()=>_().layoutConfig.theme;function L(r){return n("div",{className:s,children:n(e,{children:r.children})})}function k(r){return n(e,{children:r.children})}function E(r){return n(e,{children:r.children})}function z(r){return n(e,{children:r.children})}L.displayName="LayoutBackground",L.role=g,k.displayName="LayoutContent",k.role=h,E.displayName="LayoutAside",E.role=c,z.displayName="LayoutHeader",z.role=m;var B="layout-module_rootBox__Y8bEx",C="layout-module_rootLayout__TePvr",N="layout-module_mainLayout__a8Tb9";function T(o){let i=null,l=null,d=null,a=null;return t.Children.forEach(o.children,n=>{const e=n.type.role;e===m?i=n:e===h?l=n:e===c?d=n:e===g&&(a=n)}),n(e,{children:r("div",{ref:o.ref,className:B,style:{...o.style},children:[a,r("div",{className:C,children:[d,r("div",{className:N,children:[i,l]})]})]})})}function S(r){const o=!!document.fullscreenElement,[i,a]=l(o),s=()=>{a(!!document.fullscreenElement)},u=n=>{"F11"===n.code&&(n.preventDefault(),c())};d(()=>(document.addEventListener("fullscreenchange",s),document.addEventListener("keydown",u,!0),()=>{document.removeEventListener("fullscreenchange",s),document.removeEventListener("keydown",u)}),[]);const c=()=>{i?document.exitFullscreen():document.documentElement.requestFullscreen()};if(!r.buttons||r.buttons.length<2)return n(e,{});const[h,m]=r.buttons,g=i?h:m;return t.cloneElement(g,{onClick:n=>{console.log(n),c()}})}function j(n){if(!n)return"";const e=Array.from(n);if(0===e.length)return"";const r=e[0];return function(n){if(0===n.length)return!1;const e=n.codePointAt(0);return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=12352&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519||e>=126976&&e<=129791||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=129280&&e<=129535||e>=9728&&e<=9983||e>=9984&&e<=10175}(r)?r:e.slice(0,2).join("")}a("@layer base {\r\n html, body {\r\n padding: 0;\r\n margin: 0;\r\n border: 0;\r\n width: 100%; \r\n height: 100%;\r\n }\r\n #root { \r\n text-align: initial;\r\n width: 100%;\r\n height:100%\r\n } \r\n}\r\n*, *:before, *:after {\r\n box-sizing: border-box;\r\n}\r\n.layout-module_rootBox__Y8bEx {\r\n text-rendering: optimizeLegibility;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale;\r\n text-align: initial;\r\n width: 100%;\r\n min-height: 100%;\r\n}\r\n.layout-module_rootBackground__vEs6e {\r\n box-sizing: border-box; \r\n pointer-events: none;\r\n inset-block-start:0;\r\n inset-inline-start:0; \r\n width: 100%; \r\n min-width: 100vw;\r\n height:100%;\r\n min-height: 100vh;\r\n overflow: hidden;\r\n position: fixed;\r\n z-index: 0;\r\n}\r\n.layout-module_rootBackground__vEs6e>div{\r\n width:100%;\r\n height: 100%;\r\n overflow: hidden;\r\n}\r\n.layout-module_rootLayout__TePvr {\r\n position: relative;\r\n z-index: 1;\r\n box-sizing: border-box; \r\n width: 100%;\r\n min-height: 100%;\r\n display: flex; \r\n flex-flow: row;\r\n background-color: transparent;\r\n}\r\n\r\n.layout-module_mainLayout__a8Tb9 {\r\n box-sizing: border-box; \r\n display: flex;\r\n flex-flow: column; \r\n width: 100%;\r\n min-width: 0px;\r\n}\r\n"),T.Aside=E,T.Content=k,T.Header=z,T.Background=L;const A=n=>({r:parseInt(n.slice(1,3),16),g:parseInt(n.slice(3,5),16),b:parseInt(n.slice(5,7),16),a:9===n.length?(parseInt(n.slice(7,9),16)/255).toFixed(2):1}),F=n=>{const{r:e,g:r,b:t}=A(n);return{r:e,g:r,b:t}},H=(n,e)=>{const{r:r,g:t,b:o,a:i}=A(n);return`rgba(${r}, ${t}, ${o}, ${e??i})`},I=n=>{if("system"==n){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return n};export{T as BaseLayout,S as FullScreenButton,L as LayoutBackground,x as createConfigActionContext,p as createConfigStateContext,y as defaultConfig,u as defineConfig,j as getAvatarInitials,I as getLayoutTheme,F as hexToRgb,H as hexToRgbaString,v as useConfigAction,_ as useConfigState,w as useTheme};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminui-dev/layout",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "adminui.dev's layout",
5
5
  "keywords": [
6
6
  "layout",