@adminui-dev/layout 1.1.5 → 1.1.6

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.cjs.js CHANGED
@@ -1 +1,10 @@
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 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 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",y="layout-module_rootLayout__TePvr",f="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:y,children:[d,n.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 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;
1
+ "use strict";var e,r=require("react"),n={exports:{}},t={};var o,i={};
2
+ /**
3
+ * @license React
4
+ * react-jsx-runtime.development.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */"production"===process.env.NODE_ENV?n.exports=function(){if(e)return t;e=1;var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function o(e,n,t){var o=null;if(void 0!==t&&(o=""+t),void 0!==n.key&&(o=""+n.key),"key"in n)for(var i in t={},n)"key"!==i&&(t[i]=n[i]);else t=n;return n=t.ref,{$$typeof:r,type:e,key:o,ref:void 0!==n?n:null,props:t}}return t.Fragment=n,t.jsx=o,t.jsxs=o,t}():n.exports=(o||(o=1,"production"!==process.env.NODE_ENV&&function(){function e(r){if(null==r)return null;if("function"==typeof r)return r.$$typeof===L?null:r.displayName||r.name||null;if("string"==typeof r)return r;switch(r){case p:return"Fragment";case g:return"Profiler";case b:return"StrictMode";case _:return"Suspense";case k:return"SuspenseList";case j:return"Activity"}if("object"==typeof r)switch("number"==typeof r.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case m:return"Portal";case x:return r.displayName||"Context";case h:return(r._context.displayName||"Context")+".Consumer";case v:var n=r.render;return(r=r.displayName)||(r=""!==(r=n.displayName||n.name||"")?"ForwardRef("+r+")":"ForwardRef"),r;case w:return null!==(n=r.displayName||null)?n:e(r.type)||"Memo";case S:n=r._payload,r=r._init;try{return e(r(n))}catch(e){}}return null}function n(e){return""+e}function t(e){try{n(e);var r=!1}catch(e){r=!0}if(r){var t=(r=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),n(e)}}function o(r){if(r===p)return"<>";if("object"==typeof r&&null!==r&&r.$$typeof===S)return"<...>";try{var n=e(r);return n?"<"+n+">":"<...>"}catch(e){return"<...>"}}function a(){return Error("react-stack-top-frame")}function l(){var r=e(this.type);return O[r]||(O[r]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(r=this.props.ref)?r:null}function s(r,n,o,i,a,s){var u,f=n.children;if(void 0!==f)if(i)if(N(f)){for(i=0;i<f.length;i++)c(f[i]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else c(f);if(E.call(n,"key")){f=e(r);var m=Object.keys(n).filter(function(e){return"key"!==e});i=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",B[f+i]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',i,f,m,f),B[f+i]=!0)}if(f=null,void 0!==o&&(t(o),f=""+o),function(e){if(E.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return void 0!==e.key}(n)&&(t(n.key),f=""+n.key),"key"in n)for(var p in o={},n)"key"!==p&&(o[p]=n[p]);else o=n;return f&&function(e,r){function n(){d||(d=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(o,"function"==typeof r?r.displayName||r.name||"Unknown":r),function(e,r,n,t,o,i){var a=n.ref;return e={$$typeof:y,type:e,key:r,props:n,_owner:t},null!==(void 0!==a?a:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:l}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:o}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(r,f,o,null===(u=C.A)?null:u.getOwner(),a,s)}function c(e){u(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===S&&("fulfilled"===e._payload.status?u(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function u(e){return"object"==typeof e&&null!==e&&e.$$typeof===y}var d,f=r,y=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),x=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),L=Symbol.for("react.client.reference"),C=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,E=Object.prototype.hasOwnProperty,N=Array.isArray,T=console.createTask?console.createTask:function(){return null},O={},z=(f={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(f,a)(),A=T(o(a)),B={};i.Fragment=p,i.jsx=function(e,r,n){var t=1e4>C.recentlyCreatedOwnerStacks++;return s(e,r,n,!1,t?Error("react-stack-top-frame"):z,t?T(o(e)):A)},i.jsxs=function(e,r,n){var t=1e4>C.recentlyCreatedOwnerStacks++;return s(e,r,n,!0,t?Error("react-stack-top-frame"):z,t?T(o(e)):A)}}()),i);var a=n.exports;function l(e,r){void 0===r&&(r={});var n=r.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var s="Layout-module_rootBackground__j3UVG";l("@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 min-width: 0px;\r\n}\r\n");const c=Symbol("LayoutAside"),u=Symbol("LayoutContent"),d=Symbol("LayoutHeader"),f=Symbol("LayoutBackground"),y=r.createContext({setLayoutConfig:()=>{},setLocale:()=>{}}),m=r.createContext({locale:"en-US",languages:[],layoutConfig:{},themeSkinMap:{tidy:[],rich:[]}}),p=()=>r.useContext(m);function b(e){return a.jsx("div",{className:s,children:a.jsx(a.Fragment,{children:e.children})})}function g(e){return a.jsx(a.Fragment,{children:e.children})}function h(e){return a.jsx(a.Fragment,{children:e.children})}function x(e){return a.jsx(a.Fragment,{children:e.children})}b.displayName="LayoutBackground",b.role=f,g.displayName="LayoutContent",g.role=u,h.displayName="LayoutAside",h.role=c,x.displayName="LayoutHeader",x.role=d;var v="layout-module_rootBox__Y8bEx",_="layout-module_rootLayout__TePvr",k="layout-module_mainLayout__a8Tb9";function w(e){let n=null,t=null,o=null,i=null;return r.Children.forEach(e.children,e=>{const r=e.type.role;r===d?n=e:r===u?t=e:r===c?o=e:r===f&&(i=e)}),a.jsx(a.Fragment,{children:a.jsxs("div",{ref:e.ref,className:v,style:{...e.style},children:[i,a.jsxs("div",{className:_,children:[o,a.jsxs("div",{className:k,children:[n,t]})]})]})})}l("@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 min-width: 0px;\r\n}\r\n"),w.Aside=h,w.Content=g,w.Header=x,w.Background=b;const S=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=w,exports.FullScreenButton=function(e){const n=!!document.fullscreenElement,[t,o]=r.useState(n),i=()=>{o(!!document.fullscreenElement)},l=e=>{"F11"===e.code&&(e.preventDefault(),s())};r.useEffect(()=>(document.addEventListener("fullscreenchange",i),document.addEventListener("keydown",l,!0),()=>{document.removeEventListener("fullscreenchange",i),document.removeEventListener("keydown",l)}),[]);const s=()=>{t?document.exitFullscreen():document.documentElement.requestFullscreen()};if(!e.buttons||e.buttons.length<2)return a.jsx(a.Fragment,{});const[c,u]=e.buttons,d=t?c:u;return r.cloneElement(d,{onClick:e=>{console.log(e),s()}})},exports.LayoutBackground=b,exports.createConfigActionContext=()=>y,exports.createConfigStateContext=()=>m,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 r=Array.from(e);if(0===r.length)return"";const n=r[0];return function(e){if(0===e.length)return!1;const r=e.codePointAt(0);return r>=19968&&r<=40959||r>=13312&&r<=19903||r>=12352&&r<=12543||r>=44032&&r<=55215||r>=65280&&r<=65519||r>=126976&&r<=129791||r>=127744&&r<=128511||r>=128640&&r<=128767||r>=129280&&r<=129535||r>=9728&&r<=9983||r>=9984&&r<=10175}(n)?n:r.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:r,g:n,b:t}=S(e);return{r:r,g:n,b:t}},exports.hexToRgbaString=(e,r)=>{const{r:n,g:t,b:o,a:i}=S(e);return`rgba(${n}, ${t}, ${o}, ${r??i})`},exports.useConfigAction=()=>r.useContext(y),exports.useConfigState=p,exports.useTheme=()=>p().layoutConfig.theme;
package/dist/index.esm.js CHANGED
@@ -1 +1,10 @@
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 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 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 min-width: 0px;\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 e,{createContext as r,useContext as n,useState as t,useEffect as o}from"react";var i,a={exports:{}},l={};var s,c={};
2
+ /**
3
+ * @license React
4
+ * react-jsx-runtime.development.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */"production"===process.env.NODE_ENV?a.exports=function(){if(i)return l;i=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function n(r,n,t){var o=null;if(void 0!==t&&(o=""+t),void 0!==n.key&&(o=""+n.key),"key"in n)for(var i in t={},n)"key"!==i&&(t[i]=n[i]);else t=n;return n=t.ref,{$$typeof:e,type:r,key:o,ref:void 0!==n?n:null,props:t}}return l.Fragment=r,l.jsx=n,l.jsxs=n,l}():a.exports=(s||(s=1,"production"!==process.env.NODE_ENV&&function(){function r(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===E?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case p:return"Fragment";case h:return"Profiler";case b:return"StrictMode";case x:return"Suspense";case k:return"SuspenseList";case S:return"Activity"}if("object"==typeof e)switch("number"==typeof e.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case m:return"Portal";case v:return e.displayName||"Context";case g:return(e._context.displayName||"Context")+".Consumer";case _:var n=e.render;return(e=e.displayName)||(e=""!==(e=n.displayName||n.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case w:return null!==(n=e.displayName||null)?n:r(e.type)||"Memo";case j:n=e._payload,e=e._init;try{return r(e(n))}catch(e){}}return null}function n(e){return""+e}function t(e){try{n(e);var r=!1}catch(e){r=!0}if(r){var t=(r=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),n(e)}}function o(e){if(e===p)return"<>";if("object"==typeof e&&null!==e&&e.$$typeof===j)return"<...>";try{var n=r(e);return n?"<"+n+">":"<...>"}catch(e){return"<...>"}}function i(){return Error("react-stack-top-frame")}function a(){var e=r(this.type);return T[e]||(T[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(e=this.props.ref)?e:null}function l(e,n,o,i,l,c){var u,f=n.children;if(void 0!==f)if(i)if(O(f)){for(i=0;i<f.length;i++)s(f[i]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else s(f);if(N.call(n,"key")){f=r(e);var m=Object.keys(n).filter(function(e){return"key"!==e});i=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",$[f+i]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',i,f,m,f),$[f+i]=!0)}if(f=null,void 0!==o&&(t(o),f=""+o),function(e){if(N.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return void 0!==e.key}(n)&&(t(n.key),f=""+n.key),"key"in n)for(var p in o={},n)"key"!==p&&(o[p]=n[p]);else o=n;return f&&function(e,r){function n(){d||(d=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(o,"function"==typeof e?e.displayName||e.name||"Unknown":e),function(e,r,n,t,o,i){var l=n.ref;return e={$$typeof:y,type:e,key:r,props:n,_owner:t},null!==(void 0!==l?l:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:a}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:o}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(e,f,o,null===(u=L.A)?null:u.getOwner(),l,c)}function s(e){u(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===j&&("fulfilled"===e._payload.status?u(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function u(e){return"object"==typeof e&&null!==e&&e.$$typeof===y}var d,f=e,y=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),v=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),E=Symbol.for("react.client.reference"),L=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,O=Array.isArray,z=console.createTask?console.createTask:function(){return null},T={},C=(f={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(f,i)(),P=z(o(i)),$={};c.Fragment=p,c.jsx=function(e,r,n){var t=1e4>L.recentlyCreatedOwnerStacks++;return l(e,r,n,!1,t?Error("react-stack-top-frame"):C,t?z(o(e)):P)},c.jsxs=function(e,r,n){var t=1e4>L.recentlyCreatedOwnerStacks++;return l(e,r,n,!0,t?Error("react-stack-top-frame"):C,t?z(o(e)):P)}}()),c);var u=a.exports;function d(e,r){void 0===r&&(r={});var n=r.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var f="Layout-module_rootBackground__j3UVG";function y(e){return e}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 min-width: 0px;\r\n}\r\n");const m=Symbol("LayoutAside"),p=Symbol("LayoutContent"),b=Symbol("LayoutHeader"),h=Symbol("LayoutBackground"),g={headerHeight:50,asideWidth:260,layoutType:"leftMenu",collapsedPosition:"bottom",avatarPosition:"rightTop",theme:"system",visibleBreadcrumbIcon:"none",primaryColor:"#417ffb"},v=r({setLayoutConfig:()=>{},setLocale:()=>{}}),_=r({locale:"en-US",languages:[],layoutConfig:{},themeSkinMap:{tidy:[],rich:[]}}),x=()=>v,k=()=>_,w=()=>n(_),j=()=>n(v),S=()=>w().layoutConfig.theme;function E(e){return u.jsx("div",{className:f,children:u.jsx(u.Fragment,{children:e.children})})}function L(e){return u.jsx(u.Fragment,{children:e.children})}function N(e){return u.jsx(u.Fragment,{children:e.children})}function O(e){return u.jsx(u.Fragment,{children:e.children})}E.displayName="LayoutBackground",E.role=h,L.displayName="LayoutContent",L.role=p,N.displayName="LayoutAside",N.role=m,O.displayName="LayoutHeader",O.role=b;var z="layout-module_rootBox__Y8bEx",T="layout-module_rootLayout__TePvr",C="layout-module_mainLayout__a8Tb9";function P(r){let n=null,t=null,o=null,i=null;return e.Children.forEach(r.children,e=>{const r=e.type.role;r===b?n=e:r===p?t=e:r===m?o=e:r===h&&(i=e)}),u.jsx(u.Fragment,{children:u.jsxs("div",{ref:r.ref,className:z,style:{...r.style},children:[i,u.jsxs("div",{className:T,children:[o,u.jsxs("div",{className:C,children:[n,t]})]})]})})}function $(r){const n=!!document.fullscreenElement,[i,a]=t(n),l=()=>{a(!!document.fullscreenElement)},s=e=>{"F11"===e.code&&(e.preventDefault(),c())};o(()=>(document.addEventListener("fullscreenchange",l),document.addEventListener("keydown",s,!0),()=>{document.removeEventListener("fullscreenchange",l),document.removeEventListener("keydown",s)}),[]);const c=()=>{i?document.exitFullscreen():document.documentElement.requestFullscreen()};if(!r.buttons||r.buttons.length<2)return u.jsx(u.Fragment,{});const[d,f]=r.buttons,y=i?d:f;return e.cloneElement(y,{onClick:e=>{console.log(e),c()}})}function F(e){if(!e)return"";const r=Array.from(e);if(0===r.length)return"";const n=r[0];return function(e){if(0===e.length)return!1;const r=e.codePointAt(0);return r>=19968&&r<=40959||r>=13312&&r<=19903||r>=12352&&r<=12543||r>=44032&&r<=55215||r>=65280&&r<=65519||r>=126976&&r<=129791||r>=127744&&r<=128511||r>=128640&&r<=128767||r>=129280&&r<=129535||r>=9728&&r<=9983||r>=9984&&r<=10175}(n)?n:r.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 min-width: 0px;\r\n}\r\n"),P.Aside=N,P.Content=L,P.Header=O,P.Background=E;const A=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}),R=e=>{const{r:r,g:n,b:t}=A(e);return{r:r,g:n,b:t}},B=(e,r)=>{const{r:n,g:t,b:o,a:i}=A(e);return`rgba(${n}, ${t}, ${o}, ${r??i})`},I=e=>{if("system"==e){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return e};export{P as BaseLayout,$ as FullScreenButton,E as LayoutBackground,x as createConfigActionContext,k as createConfigStateContext,g as defaultConfig,y as defineConfig,F as getAvatarInitials,I as getLayoutTheme,R as hexToRgb,B as hexToRgbaString,j as useConfigAction,w as useConfigState,S as useTheme};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminui-dev/layout",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "adminui.dev's layout",
5
5
  "keywords": [
6
6
  "layout",
@@ -49,7 +49,8 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@rollup/plugin-commonjs": "^25.0.0",
52
- "@rollup/plugin-node-resolve": "^15.0.0",
52
+ "@rollup/plugin-node-resolve": "^15.0.0",
53
+ "@rollup/plugin-terser": "^0.4.4",
53
54
  "@rollup/plugin-typescript": "^11.0.0",
54
55
  "@types/commander": "^2.12.5",
55
56
  "@types/react": "^19.2.0",
@@ -57,9 +58,8 @@
57
58
  "postcss": "^8.5.6",
58
59
  "postcss-modules": "^6.0.1",
59
60
  "rollup": "^4.0.0",
60
- "rollup-plugin-dts": "^6.0.0",
61
61
  "rollup-plugin-postcss": "^4.0.2",
62
- "rollup-plugin-terser": "^7.0.2",
62
+ "rollup-plugin-dts": "^6.3.0",
63
63
  "typescript": "^5.0.3"
64
64
  },
65
65
  "peerDependencies": {