@adminui-dev/layout 1.2.3 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { LayoutTheme, Theme } from "./typings";
1
+ import { LayoutTheme, Theme, ThemeSkin } from "./typings";
2
2
  declare function getAvatarInitials(name: string): string;
3
3
  declare const hexToRgba: (hex: string) => {
4
4
  r: number;
@@ -13,4 +13,5 @@ declare const hexToRgb: (color: string) => {
13
13
  };
14
14
  declare const hexToRgbaString: (color: string, alpha?: number) => string;
15
15
  declare const getLayoutTheme: (theme: Theme) => LayoutTheme;
16
- export { getAvatarInitials, hexToRgb, hexToRgba, hexToRgbaString, getLayoutTheme };
16
+ declare const defineThemeSkin: (themeSkin: ThemeSkin) => ThemeSkin;
17
+ export { getAvatarInitials, hexToRgb, hexToRgba, hexToRgbaString, getLayoutTheme, defineThemeSkin };
@@ -2,5 +2,5 @@ import { BaseLayout } from "./Layout";
2
2
  import FullScreenButton from "./FullScreenButton";
3
3
  import LayoutBackground from "./LayoutBackground";
4
4
  import { createConfigActionContext, createConfigStateContext, useConfigState, useConfigAction, useTheme, defaultConfig, defineConfig } from "./LayoutContext";
5
- import { getAvatarInitials, hexToRgb, hexToRgbaString, getLayoutTheme } from "./common";
6
- export { BaseLayout, LayoutBackground, FullScreenButton, createConfigActionContext, createConfigStateContext, useConfigState, useConfigAction, useTheme, getAvatarInitials, hexToRgb, hexToRgbaString, defaultConfig, getLayoutTheme, defineConfig };
5
+ import { getAvatarInitials, hexToRgb, hexToRgbaString, getLayoutTheme, defineThemeSkin } from "./common";
6
+ export { BaseLayout, LayoutBackground, FullScreenButton, createConfigActionContext, createConfigStateContext, useConfigState, useConfigAction, useTheme, getAvatarInitials, hexToRgb, hexToRgbaString, defaultConfig, getLayoutTheme, defineConfig, defineThemeSkin };
@@ -73,6 +73,7 @@ interface ThemeSkin {
73
73
  layoutConfig?: ThemeConfig;
74
74
  backgroundContent?: React.ReactNode;
75
75
  layoutBorderColor?: string;
76
+ logo?: string | React.ReactNode;
76
77
  headerStyle?: React.CSSProperties;
77
78
  asideStyle?: React.CSSProperties;
78
79
  }
package/dist/index.cjs.js CHANGED
@@ -7,4 +7,4 @@
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
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 b:return"Profiler";case h: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 g: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"),h=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),g=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 min-height: 100vh;\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:{system:[],custom:[]}}),p=()=>r.useContext(m);function h(e){return a.jsx("div",{className:s,children:a.jsx(a.Fragment,{children:e.children})})}function b(e){return a.jsx(a.Fragment,{children:e.children})}function g(e){return a.jsx(a.Fragment,{children:e.children})}function x(e){return a.jsx(a.Fragment,{children:e.children})}h.displayName="LayoutBackground",h.role=f,b.displayName="LayoutContent",b.role=u,g.displayName="LayoutAside",g.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;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)});const l=e.style||e.styles?.root;return a.jsx(a.Fragment,{children:a.jsxs("div",{ref:e.ref,className:v,style:l,children:[i,a.jsxs("div",{className:_,children:[o,a.jsxs("div",{className:k,style:{...e.styles?.main},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 min-height: 100vh;\r\n}\r\n"),w.Aside=g,w.Content=b,w.Header=x,w.Background=h;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=h,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;
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 b:return"Profiler";case h: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 g: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"),h=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),g=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 min-height: 100vh;\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:{system:[],custom:[]}}),p=()=>r.useContext(m);function h(e){return a.jsx("div",{className:s,children:a.jsx(a.Fragment,{children:e.children})})}function b(e){return a.jsx(a.Fragment,{children:e.children})}function g(e){return a.jsx(a.Fragment,{children:e.children})}function x(e){return a.jsx(a.Fragment,{children:e.children})}h.displayName="LayoutBackground",h.role=f,b.displayName="LayoutContent",b.role=u,g.displayName="LayoutAside",g.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;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)});const l=e.style||e.styles?.root;return a.jsx(a.Fragment,{children:a.jsxs("div",{ref:e.ref,className:v,style:l,children:[i,a.jsxs("div",{className:_,children:[o,a.jsxs("div",{className:k,style:{...e.styles?.main},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 min-height: 100vh;\r\n}\r\n"),w.Aside=g,w.Content=b,w.Header=x,w.Background=h;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=h,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.defineThemeSkin=e=>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.d.ts CHANGED
@@ -77,6 +77,7 @@ interface ThemeSkin {
77
77
  layoutConfig?: ThemeConfig;
78
78
  backgroundContent?: React.ReactNode;
79
79
  layoutBorderColor?: string;
80
+ logo?: string | React.ReactNode;
80
81
  headerStyle?: React.CSSProperties;
81
82
  asideStyle?: React.CSSProperties;
82
83
  }
@@ -233,6 +234,7 @@ declare const hexToRgb: (color: string) => {
233
234
  };
234
235
  declare const hexToRgbaString: (color: string, alpha?: number) => string;
235
236
  declare const getLayoutTheme: (theme: Theme) => LayoutTheme;
237
+ declare const defineThemeSkin: (themeSkin: ThemeSkin) => ThemeSkin;
236
238
 
237
- export { BaseLayout, export_default as FullScreenButton, LayoutBackground, createConfigActionContext, createConfigStateContext, defaultConfig, defineConfig, getAvatarInitials, getLayoutTheme, hexToRgb, hexToRgbaString, useConfigAction, useConfigState, useTheme };
239
+ export { BaseLayout, export_default as FullScreenButton, LayoutBackground, createConfigActionContext, createConfigStateContext, defaultConfig, defineConfig, defineThemeSkin, getAvatarInitials, getLayoutTheme, hexToRgb, hexToRgbaString, useConfigAction, useConfigState, useTheme };
238
240
  export type { AvatarPosition, BaseLayoutProps, BrandInfo, BreadcrumbIconVisible, ConfigActionDispatcher, ConfigStateDispatcher, ContainerMode, ContainerProps, ContainerStretch, Language, LayoutConfig, LayoutProps, LayoutTheme, LayoutType, LocaleMessageData, MenuData, MenuItemSelectColor, OutletContainer, Position, RootLayoutProps, SkinType, Theme, ThemeConfig, ThemeSkin, UserInfo };
package/dist/index.esm.js CHANGED
@@ -7,4 +7,4 @@ import e,{createContext as r,useContext as n,useState as t,useEffect as o}from"r
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
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 min-height: 100vh;\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:{system:[],custom:[]}}),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;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)});const a=r.style||r.styles?.root;return u.jsx(u.Fragment,{children:u.jsxs("div",{ref:r.ref,className:z,style:a,children:[i,u.jsxs("div",{className:T,children:[o,u.jsxs("div",{className:C,style:{...r.styles?.main},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 min-height: 100vh;\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};
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 min-height: 100vh;\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:{system:[],custom:[]}}),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;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)});const a=r.style||r.styles?.root;return u.jsx(u.Fragment,{children:u.jsxs("div",{ref:r.ref,className:z,style:a,children:[i,u.jsxs("div",{className:T,children:[o,u.jsxs("div",{className:C,style:{...r.styles?.main},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 min-height: 100vh;\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},U=e=>e;export{P as BaseLayout,$ as FullScreenButton,E as LayoutBackground,x as createConfigActionContext,k as createConfigStateContext,g as defaultConfig,y as defineConfig,U as defineThemeSkin,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.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "adminui.dev's layout",
5
5
  "keywords": [
6
6
  "layout",