@nocobase/plugin-theme-editor 2.1.0-beta.43 → 2.1.0-beta.45
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/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("@ant-design/cssinjs"),require("react"),require("antd"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-theme-editor",["react-i18next","@emotion/css","@ant-design/cssinjs","react","antd","@nocobase/client","@ant-design/icons","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-theme-editor"]=t(require("react-i18next"),require("@emotion/css"),require("@ant-design/cssinjs"),require("react"),require("antd"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-theme-editor"]=t(e["react-i18next"],e["@emotion/css"],e["@ant-design/cssinjs"],e.react,e.antd,e["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,i,u,a,c){return function(){"use strict";var l,s,f,p={485:function(e,t,n){n.d(t,{M:function(){return u}});var r=n(2059),o=n(6773),i=n.n(o);function u(e){return(e=i().cloneDeep(e)).algorithm&&(Array.isArray(e.algorithm)?e.algorithm=e.algorithm.map(function(e){return a(e)}).filter(Boolean):e.algorithm=a(e.algorithm),i().isEmpty(e.algorithm)&&delete e.algorithm),e}function a(e){return"string"==typeof e?e:e.toString()===r.theme.darkAlgorithm.toString()?"darkAlgorithm":e.toString()===r.theme.compactAlgorithm.toString()?"compactAlgorithm":void 0}},5705:function(e,t,n){n.d(t,{m:function(){return u}});var r=n(2059),o=n(6773),i=n.n(o);function u(e){var t;return e=i().cloneDeep(e),i().isString(e.config.algorithm)&&(e.config.algorithm=r.theme[e.config.algorithm]),Array.isArray(null==(t=e.config)?void 0:t.algorithm)&&(e.config.algorithm=e.config.algorithm.map(function(e){return i().isString(e)?r.theme[e]:e})),e}},4811:function(e,t,n){n.r(t),n.d(t,{useThemeId:function(){return f}});var r=n(3342),o=n(7768),i=n(9155),u=n.n(i),a=n(485),c=n(5705),l=n(5954),s=u().createContext({}),f=function(){return u().useContext(s)},p=function(e){var t,n,f,p=e.children,d=(0,r.useCurrentUserContext)(),h=(0,r.useGlobalTheme)().setTheme,m=(0,l.useThemeListContext)(),b=m.run,y=m.data,v=m.loading,g=(0,i.useMemo)(function(){return null==y?void 0:y.find(function(e){return e.default})},[y]),w=(0,i.useRef)(null),O=(0,r.useAPIClient)();(0,i.useEffect)(function(){var e=O.auth.getOption("theme");if(e)try{h((0,c.m)(JSON.parse(e)).config)}catch(e){(0,o.error)(e)}},[]),(0,i.useEffect)(function(){if(!y)return b();var e,t,n,o,i=null==d||null==(n=d.data)||null==(t=n.data)||null==(e=t.systemSettings)?void 0:e.themeId;null!=i&&(o=y.find(function(e){return e.id===i})),o||(o=g),o?(w.current=o.id,h(o.config),O.auth.setOption("theme",JSON.stringify(Object.assign(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},o),{config:(0,a.M)(o.config)})))):(h(r.defaultTheme),O.auth.setOption("theme",null))},[O.auth,null==d||null==(f=d.data)||null==(n=f.data)||null==(t=n.systemSettings)?void 0:t.themeId,y,b,h,g]);var j=v&&!y||d.loading?{}:{currentThemeId:w.current,defaultThemeId:null==g?void 0:g.id};return u().createElement(s.Provider,{value:j},p)};p.displayName="InitializeTheme",t.default=p},5954:function(e,t,n){n.r(t),n.d(t,{ThemeListProvider:function(){return s},useThemeListContext:function(){return l}});var r=n(3342),o=n(7768),i=n(9155),u=n.n(i),a=n(5705),c=(0,i.createContext)(null);c.displayName="ThemeListContext";var l=function(){return u().useContext(c)},s=function(e){var t=e.children,n=(0,r.useRequest)({url:"themeConfig:list",params:{sort:"id",paginate:!1}},{manual:!0}),l=n.data,s=n.error,f=n.run,p=n.refresh,d=n.loading,h=(0,i.useMemo)(function(){var e;return null==l||null==(e=l.data)?void 0:e.map(function(e){return(0,a.m)(e)})},[l]);return s&&(0,o.error)(s),u().createElement(c.Provider,{value:{data:h,error:s,run:f,refresh:p,loading:d}},t)};s.displayName="ThemeListProvider"},2166:function(e,t,n){n.d(t,{j:function(){return l}});var r=n(3342),o=n(7768),i=n(9155);function u(e,t,n,r,o,i,u){try{var a=e[i](u),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function c(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function l(){var e=(0,r.useAPIClient)(),t=(0,r.useCurrentUserContext)();return{updateUserThemeSettings:(0,i.useCallback)(function(n){var r;return(r=function(){var r;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:c(0)}),a(u,"throw",{value:c(1)}),a(u,"return",{value:c(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e.resource("users").updateTheme({values:{themeId:n}})];case 1:return i.sent(),t.mutate({data:c(a({},t.data.data),{systemSettings:c(a({},t.data.data.systemSettings||{}),{themeId:n})})}),window.location.reload(),[3,3];case 2:return r=i.sent(),console.log(o.error),(0,o.error)(r),[3,3];case 3:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){u(i,n,o,a,c,"next",e)}function c(e){u(i,n,o,a,c,"throw",e)}a(void 0)})})()},[e,t])}}},3872:function(e,t,n){n.d(t,{B:function(){return i},C:function(){return o}});var r=n(5953),o="theme-editor";function i(){return(0,r.useTranslation)([o,"client"],{nsMode:"fallback"})}},1802:function(e){e.exports=n},7375:function(e){e.exports=u},5477:function(e){e.exports=t},3342:function(e){e.exports=i},7768:function(e){e.exports=a},2059:function(e){e.exports=o},6773:function(e){e.exports=c},9155:function(e){e.exports=r},5953:function(t){t.exports=e}},d={};function h(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return p[e](n,n.exports,h),n.exports}h.m=p,h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return""+e+"."+({183:"ca521a6fcbf3b65b",200:"3bc0c983635aa103",405:"1cccb3f05ccc1acd",446:"c57735d7b4d0dea0",494:"a10daa3e98c1a447"})[e]+".js"},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},m={},h.l=function(e,t,n,r){if(m[e])return void m[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),a=0;a<u.length;a++){var c=u[a];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@nocobase/plugin-theme-editor:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,h.nc&&o.setAttribute("nonce",h.nc),o.setAttribute("data-rspack","@nocobase/plugin-theme-editor:"+n),o.src=e),m[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=m[e];if(delete m[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},h.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.nc=void 0,h.g.importScripts&&(b=h.g.location+"");var m,b,y=h.g.document;if(!b&&y&&(y.currentScript&&"SCRIPT"===y.currentScript.tagName.toUpperCase()&&(b=y.currentScript.src),!b)){var v=y.getElementsByTagName("script");if(v.length)for(var g=v.length-1;g>-1&&(!b||!/^http(s?):/.test(b));)b=v[g--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");h.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l={889:0},h.f.j=function(e,t){var n=h.o(l,e)?l[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=l[e]=[t,r]});t.push(n[2]=r);var o=h.p+h.u(e),i=Error();h.l(o,function(t){if(h.o(l,e)&&(0!==(n=l[e])&&(l[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},s=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],a=0;if(o.some(function(e){return 0!==l[e]})){for(n in i)h.o(i,n)&&(h.m[n]=i[n]);u&&u(h)}for(e&&e(t);a<o.length;a++)r=o[a],h.o(l,r)&&l[r]&&l[r][0](),l[r]=0},(f=self.webpackChunk_nocobase_plugin_theme_editor=self.webpackChunk_nocobase_plugin_theme_editor||[]).forEach(s.bind(null,0)),f.push=s.bind(null,f.push.bind(f));var w={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-theme-editor/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-theme-editor/dist/client/"}h.p=e}(),!function(){h.r(w),h.d(w,{PluginThemeEditorClient:function(){return k},default:function(){return _}});var e=h(3342),t=h(2059),n=h(6773),r=h.n(n),o=h(9155),i=h.n(o),u=h(7768),a=h(4811),c=h(5954),l=h(3872),s=h(2166),f=function(){var t=(0,l.B)().t,n=(0,c.useThemeListContext)(),r=n.run,f=n.error,p=n.data,d=(0,s.j)().updateUserThemeSettings,h=(0,a.useThemeId)().currentThemeId,m=(0,o.useMemo)(function(){return null==p?void 0:p.filter(function(e){return e.optional}).map(function(e){return{label:t(e.config.name),value:e.id}})},[p,t]);return((0,o.useEffect)(function(){p||r()},[]),f)?((0,u.error)(f),null):i().createElement(e.SchemaSettingsSelectItem,{title:t("Theme"),options:m,value:h,onChange:function(e){d(e)}})};function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t,n,r,o,i,u){try{var a=e[i](u),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function m(e,t,n){return(m=g()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&y(o,n.prototype),o}).apply(null,arguments)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){var t="function"==typeof Map?new Map:void 0;return(v=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return m(e,arguments,b(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,e)})(e)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function O(){var e,t,n=(e=["\n overflow: hidden;\n border-left: 1px solid ",";\n animation: 0.1s ease-out 0s 1 slideInFromRight;\n @keyframes slideInFromRight {\n 0% {\n transform: translateX(100%);\n }\n 100% {\n transform: translateX(0);\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return O=function(){return n},n}var j=(0,e.lazy)(function(){return Promise.resolve().then(h.bind(h,4811))}),S=(0,e.lazy)(function(){return h.e("446").then(h.bind(h,733))},"ThemeEditorProvider").ThemeEditorProvider,P=(0,e.lazy)(function(){return Promise.all([h.e("494"),h.e("405"),h.e("200")]).then(h.bind(h,7787))}),x=(0,e.lazy)(function(){return Promise.resolve().then(h.bind(h,5954))},"ThemeListProvider").ThemeListProvider,T=(0,e.lazy)(function(){return Promise.all([h.e("494"),h.e("405"),h.e("183")]).then(h.bind(h,8042))}),C=(0,e.createStyles)(function(e){var t=e.css,n=e.token;return{editor:t(O(),n.colorBorderSecondary)}}),E=i().memo(function(n){var u,a,c=function(e){if(Array.isArray(e))return e}(u=i().useState(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){u=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw n}}return o}}(u)||function(e){if(e){if("string"==typeof e)return p(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,2)}}(u)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=c[0],s=c[1],f=(0,e.useGlobalTheme)(),d=f.theme,h=f.setTheme,m=C().styles,b=(0,o.useMemo)(function(){return l?{transform:"rotate(0)",flexGrow:1,width:0,height:"100%"}:{flexGrow:1,width:0,height:"100%"}},[l]),y=i().createElement("div",{style:{display:"flex",overflow:"hidden",height:"100%"}},i().createElement("div",{style:b},n.children),l?i().createElement("div",{className:m.editor},i().createElement(T,{onThemeChange:h})):null);return(null==d||null==(a=d.token)?void 0:a.motionUnit)||r().set(d,"token.motionUnit",e.defaultTheme.token.motionUnit),i().createElement(t.ConfigProvider,{theme:d},i().createElement(x,null,i().createElement(j,null,i().createElement(S,{open:l,setOpen:s},y))))});E.displayName="CustomThemeProvider";var k=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=b(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,g()?Reflect.construct(e,t||[],b(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&y(n,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:c(0)}),a(u,"throw",{value:c(1)}),a(u,"return",{value:c(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.app.use(E),this.app.pluginSettingsManager.add(l.C,{title:'{{t("Theme editor", {ns:"'.concat(l.C,'"})}}'),icon:"BgColorsOutlined",Component:P,aclSnippet:"pm.theme-editor.themes"}),this.app.addUserCenterSettingsItem({name:"theme",sort:310,Component:f}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){d(i,r,o,u,a,"next",e)}function a(e){d(i,r,o,u,a,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(v(e.Plugin)),_=k}(),w}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("@ant-design/cssinjs"),require("react"),require("antd"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-theme-editor",["react-i18next","@emotion/css","@ant-design/cssinjs","react","antd","@nocobase/client","@ant-design/icons","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-theme-editor"]=t(require("react-i18next"),require("@emotion/css"),require("@ant-design/cssinjs"),require("react"),require("antd"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-theme-editor"]=t(e["react-i18next"],e["@emotion/css"],e["@ant-design/cssinjs"],e.react,e.antd,e["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,i,u,a,c){return function(){"use strict";var l,s,f,p={485:function(e,t,n){n.d(t,{M:function(){return u}});var r=n(2059),o=n(6773),i=n.n(o);function u(e){return(e=i().cloneDeep(e)).algorithm&&(Array.isArray(e.algorithm)?e.algorithm=e.algorithm.map(function(e){return a(e)}).filter(Boolean):e.algorithm=a(e.algorithm),i().isEmpty(e.algorithm)&&delete e.algorithm),e}function a(e){return"string"==typeof e?e:e.toString()===r.theme.darkAlgorithm.toString()?"darkAlgorithm":e.toString()===r.theme.compactAlgorithm.toString()?"compactAlgorithm":void 0}},5705:function(e,t,n){n.d(t,{m:function(){return u}});var r=n(2059),o=n(6773),i=n.n(o);function u(e){var t;return e=i().cloneDeep(e),i().isString(e.config.algorithm)&&(e.config.algorithm=r.theme[e.config.algorithm]),Array.isArray(null==(t=e.config)?void 0:t.algorithm)&&(e.config.algorithm=e.config.algorithm.map(function(e){return i().isString(e)?r.theme[e]:e})),e}},4811:function(e,t,n){n.r(t),n.d(t,{useThemeId:function(){return f}});var r=n(3342),o=n(7768),i=n(9155),u=n.n(i),a=n(485),c=n(5705),l=n(5954),s=u().createContext({}),f=function(){return u().useContext(s)},p=function(e){var t,n,f,p=e.children,d=(0,r.useCurrentUserContext)(),h=(0,r.useGlobalTheme)().setTheme,m=(0,l.useThemeListContext)(),b=m.run,y=m.data,v=m.loading,g=(0,i.useMemo)(function(){return null==y?void 0:y.find(function(e){return e.default})},[y]),w=(0,i.useRef)(null),O=(0,r.useAPIClient)();(0,i.useEffect)(function(){var e=O.auth.getOption("theme");if(e)try{h((0,c.m)(JSON.parse(e)).config)}catch(e){(0,o.error)(e)}},[]),(0,i.useEffect)(function(){if(!y)return b();var e,t,n,o,i=null==d||null==(n=d.data)||null==(t=n.data)||null==(e=t.systemSettings)?void 0:e.themeId;null!=i&&(o=y.find(function(e){return e.id===i})),o||(o=g),o?(w.current=o.id,h(o.config),O.auth.setOption("theme",JSON.stringify(Object.assign(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},o),{config:(0,a.M)(o.config)})))):(h(r.defaultTheme),O.auth.setOption("theme",null))},[O.auth,null==d||null==(f=d.data)||null==(n=f.data)||null==(t=n.systemSettings)?void 0:t.themeId,y,b,h,g]);var j=v&&!y||d.loading?{}:{currentThemeId:w.current,defaultThemeId:null==g?void 0:g.id};return u().createElement(s.Provider,{value:j},p)};p.displayName="InitializeTheme",t.default=p},5954:function(e,t,n){n.r(t),n.d(t,{ThemeListProvider:function(){return s},useThemeListContext:function(){return l}});var r=n(3342),o=n(7768),i=n(9155),u=n.n(i),a=n(5705),c=(0,i.createContext)(null);c.displayName="ThemeListContext";var l=function(){return u().useContext(c)},s=function(e){var t=e.children,n=(0,r.useRequest)({url:"themeConfig:list",params:{sort:"id",paginate:!1}},{manual:!0}),l=n.data,s=n.error,f=n.run,p=n.refresh,d=n.loading,h=(0,i.useMemo)(function(){var e;return null==l||null==(e=l.data)?void 0:e.map(function(e){return(0,a.m)(e)})},[l]);return s&&(0,o.error)(s),u().createElement(c.Provider,{value:{data:h,error:s,run:f,refresh:p,loading:d}},t)};s.displayName="ThemeListProvider"},2166:function(e,t,n){n.d(t,{j:function(){return l}});var r=n(3342),o=n(7768),i=n(9155);function u(e,t,n,r,o,i,u){try{var a=e[i](u),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function c(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function l(){var e=(0,r.useAPIClient)(),t=(0,r.useCurrentUserContext)();return{updateUserThemeSettings:(0,i.useCallback)(function(n){var r;return(r=function(){var r;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:c(0)}),a(u,"throw",{value:c(1)}),a(u,"return",{value:c(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e.resource("users").updateTheme({values:{themeId:n}})];case 1:return i.sent(),t.mutate({data:c(a({},t.data.data),{systemSettings:c(a({},t.data.data.systemSettings||{}),{themeId:n})})}),window.location.reload(),[3,3];case 2:return r=i.sent(),console.log(o.error),(0,o.error)(r),[3,3];case 3:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){u(i,n,o,a,c,"next",e)}function c(e){u(i,n,o,a,c,"throw",e)}a(void 0)})})()},[e,t])}}},3872:function(e,t,n){n.d(t,{B:function(){return i},C:function(){return o}});var r=n(5953),o="theme-editor";function i(){return(0,r.useTranslation)([o,"client"],{nsMode:"fallback"})}},1802:function(e){e.exports=n},7375:function(e){e.exports=u},5477:function(e){e.exports=t},3342:function(e){e.exports=i},7768:function(e){e.exports=a},2059:function(e){e.exports=o},6773:function(e){e.exports=c},9155:function(e){e.exports=r},5953:function(t){t.exports=e}},d={};function h(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return p[e](n,n.exports,h),n.exports}h.m=p,h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return""+e+"."+({183:"ca521a6fcbf3b65b",200:"3bc0c983635aa103",405:"1cccb3f05ccc1acd",446:"c57735d7b4d0dea0",494:"a10daa3e98c1a447"})[e]+".js"},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},m={},h.l=function(e,t,n,r){if(m[e])return void m[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),a=0;a<u.length;a++){var c=u[a];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@nocobase/plugin-theme-editor:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,h.nc&&o.setAttribute("nonce",h.nc),o.setAttribute("data-rspack","@nocobase/plugin-theme-editor:"+n),o.src=e),m[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=m[e];if(delete m[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},h.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.nc=void 0,h.g.importScripts&&(b=h.g.location+"");var m,b,y=h.g.document;if(!b&&y&&(y.currentScript&&"SCRIPT"===y.currentScript.tagName.toUpperCase()&&(b=y.currentScript.src),!b)){var v=y.getElementsByTagName("script");if(v.length)for(var g=v.length-1;g>-1&&(!b||!/^http(s?):/.test(b));)b=v[g--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");h.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l={889:0},h.f.j=function(e,t){var n=h.o(l,e)?l[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=l[e]=[t,r]});t.push(n[2]=r);var o=h.p+h.u(e),i=Error();h.l(o,function(t){if(h.o(l,e)&&(0!==(n=l[e])&&(l[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},s=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],a=0;if(o.some(function(e){return 0!==l[e]})){for(n in i)h.o(i,n)&&(h.m[n]=i[n]);u&&u(h)}for(e&&e(t);a<o.length;a++)r=o[a],h.o(l,r)&&l[r]&&l[r][0](),l[r]=0},(f=self.webpackChunk_nocobase_plugin_theme_editor=self.webpackChunk_nocobase_plugin_theme_editor||[]).forEach(s.bind(null,0)),f.push=s.bind(null,f.push.bind(f));var w={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-theme-editor/dist/client/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",u=i.indexOf(o);e=u>=0?i.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-theme-editor/dist/client/"}h.p=e}(),!function(){h.r(w),h.d(w,{PluginThemeEditorClient:function(){return E},default:function(){return k}});var e=h(3342),t=h(2059),n=h(6773),r=h.n(n),o=h(9155),i=h.n(o),u=h(7768),a=h(4811),c=h(5954),l=h(3872),s=h(2166),f=function(){var t=(0,l.B)().t,n=(0,c.useThemeListContext)(),r=n.run,f=n.error,p=n.data,d=(0,s.j)().updateUserThemeSettings,h=(0,a.useThemeId)().currentThemeId,m=(0,o.useMemo)(function(){return null==p?void 0:p.filter(function(e){return e.optional}).map(function(e){return{label:t(e.config.name),value:e.id}})},[p,t]);return((0,o.useEffect)(function(){p||r()},[]),f)?((0,u.error)(f),null):i().createElement(e.SchemaSettingsSelectItem,{title:t("Theme"),options:m,value:h,onChange:function(e){d(e)}})};function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t,n,r,o,i,u){try{var a=e[i](u),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function m(e,t,n){return(m=g()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&y(o,n.prototype),o}).apply(null,arguments)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){var t="function"==typeof Map?new Map:void 0;return(v=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return m(e,arguments,b(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,e)})(e)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function O(){var e,t,n=(e=["\n overflow: hidden;\n border-left: 1px solid ",";\n animation: 0.1s ease-out 0s 1 slideInFromRight;\n @keyframes slideInFromRight {\n 0% {\n transform: translateX(100%);\n }\n 100% {\n transform: translateX(0);\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return O=function(){return n},n}var j=(0,e.lazy)(function(){return Promise.resolve().then(h.bind(h,4811))}),S=(0,e.lazy)(function(){return h.e("446").then(h.bind(h,733))},"ThemeEditorProvider").ThemeEditorProvider,P=(0,e.lazy)(function(){return Promise.all([h.e("494"),h.e("405"),h.e("200")]).then(h.bind(h,7787))}),x=(0,e.lazy)(function(){return Promise.resolve().then(h.bind(h,5954))},"ThemeListProvider").ThemeListProvider,T=(0,e.lazy)(function(){return Promise.all([h.e("494"),h.e("405"),h.e("183")]).then(h.bind(h,8042))}),_=(0,e.createStyles)(function(e){var t=e.css,n=e.token;return{editor:t(O(),n.colorBorderSecondary)}}),C=i().memo(function(n){var u,a,c=function(e){if(Array.isArray(e))return e}(u=i().useState(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){u=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw n}}return o}}(u)||function(e){if(e){if("string"==typeof e)return p(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,2)}}(u)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=c[0],s=c[1],f=(0,e.useGlobalTheme)(),d=f.theme,h=f.setTheme,m=_().styles,b=(0,o.useMemo)(function(){return l?{transform:"rotate(0)",flexGrow:1,width:0,height:"100%"}:{flexGrow:1,width:0,height:"100%"}},[l]),y=i().createElement("div",{style:{display:"flex",overflow:"hidden",height:"100%"}},i().createElement("div",{style:b},n.children),l?i().createElement("div",{className:m.editor},i().createElement(T,{onThemeChange:h})):null);return(null==d||null==(a=d.token)?void 0:a.motionUnit)||r().set(d,"token.motionUnit",e.defaultTheme.token.motionUnit),i().createElement(t.ConfigProvider,{theme:d},i().createElement(x,null,i().createElement(j,null,i().createElement(S,{open:l,setOpen:s},y))))});C.displayName="CustomThemeProvider";var E=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=b(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,g()?Reflect.construct(e,t||[],b(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&y(n,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:c(0)}),a(u,"throw",{value:c(1)}),a(u,"return",{value:c(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.app.use(C),this.app.pluginSettingsManager.add(l.C,{title:'{{t("Theme editor", {ns:"'.concat(l.C,'"})}}'),icon:"BgColorsOutlined",Component:P,aclSnippet:"pm.theme-editor.themes"}),this.app.addUserCenterSettingsItem({name:"theme",sort:310,Component:f}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){d(i,r,o,u,a,"next",e)}function a(e){d(i,r,o,u,a,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(v(e.Plugin)),k=E}(),w}()});
|
package/dist/client-v2/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@emotion/css"),require("ahooks"),require("@nocobase/client-v2"),require("@ant-design/cssinjs"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-theme-editor/client-v2",["@emotion/css","ahooks","@nocobase/client-v2","@ant-design/cssinjs","react","antd","@ant-design/icons","@nocobase/flow-engine","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-theme-editor/client-v2"]=t(require("@emotion/css"),require("ahooks"),require("@nocobase/client-v2"),require("@ant-design/cssinjs"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-theme-editor/client-v2"]=t(e["@emotion/css"],e.ahooks,e["@nocobase/client-v2"],e["@ant-design/cssinjs"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,i,u,c,a,l){return function(){"use strict";var f,s,p,d={485:function(e,t,n){n.d(t,{M:function(){return u}});var r=n(2059),o=n(6773),i=n.n(o);function u(e){return(e=i().cloneDeep(e)).algorithm&&(Array.isArray(e.algorithm)?e.algorithm=e.algorithm.map(function(e){return c(e)}).filter(Boolean):e.algorithm=c(e.algorithm),i().isEmpty(e.algorithm)&&delete e.algorithm),e}function c(e){return"string"==typeof e?e:e.toString()===r.theme.darkAlgorithm.toString()?"darkAlgorithm":e.toString()===r.theme.compactAlgorithm.toString()?"compactAlgorithm":void 0}},5705:function(e,t,n){n.d(t,{m:function(){return u}});var r=n(2059),o=n(6773),i=n.n(o);function u(e){var t;return e=i().cloneDeep(e),i().isString(e.config.algorithm)&&(e.config.algorithm=r.theme[e.config.algorithm]),Array.isArray(null==(t=e.config)?void 0:t.algorithm)&&(e.config.algorithm=e.config.algorithm.map(function(e){return i().isString(e)?r.theme[e]:e})),e}},9488:function(e,t,n){n.d(t,{$x:function(){return i},CU:function(){return o},Vp:function(){return c},kj:function(){return u}});var r=n(7694),o="theme-editor",i="pm.theme-editor.themes";function u(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[o,"client"]},n))}}function c(e,t){return e.t(t,{ns:[o,"client"]})}},4375:function(e,t,n){n.d(t,{C5:function(){return h},TD:function(){return d},W8:function(){return p},Zn:function(){return w},jM:function(){return m},qH:function(){return s},qO:function(){return y},te:function(){return v},ww:function(){return f},zP:function(){return g}});var r=n(485),o=n(5705);function i(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function c(e){i(u,r,o,c,a,"next",e)}function a(e){i(u,r,o,c,a,"throw",e)}c(void 0)})}}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function a(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function l(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var f="theme-editor:runtime-refresh";function s(e){return u(function(){var t,n;return l(this,function(r){switch(r.label){case 0:return[4,e.request({url:"themeConfig:list",params:{sort:"id",paginate:!1}})];case 1:return[2,((null==(n=r.sent())||null==(t=n.data)?void 0:t.data)||[]).map(function(e){return(0,o.m)(e)})]}})})()}function p(e,t){return u(function(){return l(this,function(n){switch(n.label){case 0:return[4,e.resource("users").updateTheme({values:{themeId:t}})];case 1:return n.sent(),[2]}})})()}function d(e){var t;return null==e||null==(t=e.systemSettings)?void 0:t.themeId}function h(e){return null==e?void 0:e.find(function(e){return e.default})}function b(e,t){if(null!=t)return null==e?void 0:e.find(function(e){return e.id===t})}function v(e,t){return b(e,t)||h(e)}function m(e,t){var n;return null==(n=v(e,t))?void 0:n.id}function y(e,t){return!b(e,t)}function g(e){return JSON.stringify(a(c({},e),{config:(0,r.M)(e.config)}))}function w(e,t){var n,r,o;return e?a(c({},e),{token:a(c({},e.token),{motionUnit:null!=(n=null==(r=e.token)?void 0:r.motionUnit)?n:null==(o=t.token)?void 0:o.motionUnit})}):t}},1802:function(e){e.exports=r},7375:function(e){e.exports=u},5477:function(t){t.exports=e},3485:function(e){e.exports=n},7694:function(e){e.exports=c},7768:function(e){e.exports=a},2625:function(e){e.exports=t},2059:function(e){e.exports=i},6773:function(e){e.exports=l},9155:function(e){e.exports=o}},h={};function b(e){var t=h[e];if(void 0!==t)return t.exports;var n=h[e]={exports:{}};return d[e](n,n.exports,b),n.exports}b.m=d,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return""+e+"."+({438:"27f66987eb1a7721",812:"a3ad9119daf9930f",839:"6219b42f52e23dc2"})[e]+".js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v={},b.l=function(e,t,n,r){if(v[e])return void v[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-theme-editor/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,b.nc&&o.setAttribute("nonce",b.nc),o.setAttribute("data-rspack","@nocobase/plugin-theme-editor/client-v2:"+n),o.src=e),v[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=v[e];if(delete v[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.nc=void 0,b.g.importScripts&&(m=b.g.location+"");var v,m,y=b.g.document;if(!m&&y&&(y.currentScript&&"SCRIPT"===y.currentScript.tagName.toUpperCase()&&(m=y.currentScript.src),!m)){var g=y.getElementsByTagName("script");if(g.length)for(var w=g.length-1;w>-1&&(!m||!/^http(s?):/.test(m));)m=g[w--].src}if(!m)throw Error("Automatic publicPath is not supported in this browser");b.p=m.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),f={889:0},b.f.j=function(e,t){var n=b.o(f,e)?f[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=f[e]=[t,r]});t.push(n[2]=r);var o=b.p+b.u(e),i=Error();b.l(o,function(t){if(b.o(f,e)&&(0!==(n=f[e])&&(f[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},s=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==f[e]})){for(n in i)b.o(i,n)&&(b.m[n]=i[n]);u&&u(b)}for(e&&e(t);c<o.length;c++)r=o[c],b.o(f,r)&&f[r]&&f[r][0](),f[r]=0},(p=self.webpackChunk_nocobase_plugin_theme_editor_client_v2=self.webpackChunk_nocobase_plugin_theme_editor_client_v2||[]).forEach(s.bind(null,0)),p.push=s.bind(null,p.push.bind(p));var O={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-theme-editor/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-theme-editor/dist/client-v2/"}b.p=e}(),!function(){b.r(O),b.d(O,{PluginThemeEditorClientV2:function(){return y},default:function(){return g}});var e=b(3485),t=b(9488),n=b(9155),r=b.n(n),o=b(7694),i=b(7768),u=b(4375),c=b(5705);function a(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}var l=function(){var t=(0,o.useFlowContext)(),r=(0,e.useGlobalTheme)().setTheme,l=(0,n.useRef)(!1),f=t.user,s=(0,u.TD)(f);return(0,n.useEffect)(function(){if(!l.current){l.current=!0;var n=t.api.auth.getOption("theme");if(n)try{r((0,u.Zn)((0,c.m)(JSON.parse(n)).config,e.defaultTheme))}catch(e){(0,i.error)(e)}}},[t.api.auth,r]),(0,n.useEffect)(function(){if(null==f?void 0:f.id){var n,o,c=!1,l=function(){var n;return(n=function(){var n,o,a;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),[4,(0,u.qH)(t.api)];case 1:if(n=l.sent(),c)return[2];if(null==(o=(0,u.te)(n,s))?void 0:o.config)return r((0,u.Zn)(o.config,e.defaultTheme)),t.api.auth.setOption("theme",(0,u.zP)(o)),[2];return r(e.defaultTheme),t.api.auth.setOption("theme",null),[3,3];case 2:return a=l.sent(),(0,i.error)(a),[3,3];case 3:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function u(e){a(i,r,o,u,c,"next",e)}function c(e){a(i,r,o,u,c,"throw",e)}u(void 0)})})()};l();var p=function(){l()};return null==(o=t.app)||null==(n=o.eventBus)||n.addEventListener(u.ww,p),function(){var e,n;c=!0,null==(n=t.app)||null==(e=n.eventBus)||e.removeEventListener(u.ww,p)}}},[t,t.api,t.api.auth,s,null==f?void 0:f.id,r]),null};l.displayName="ThemeRuntime";var f=Symbol.for("nocobase.theme-editor.runtime.installed");function s(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function p(e,t,n){return(p=m()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&h(o,n.prototype),o}).apply(null,arguments)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){var t="function"==typeof Map?new Map:void 0;return(v=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return p(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,e)})(e)}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}var y=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function o(){var e,t;if(!(this instanceof o))throw TypeError("Cannot call a class as a function");return e=o,t=arguments,e=d(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,m()?Reflect.construct(e,t||[],d(this).constructor):e.apply(this,t))}return o.prototype=Object.create(e&&e.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),e&&h(o,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){var n=this.app.router;if(!n[f]){var o=n.getRouterComponent.bind(n);n.getRouterComponent=function(e){return o(r().createElement(r().Fragment,null,r().createElement(l,null),e))},n[f]=!0}return this.pluginSettingsManager.addMenuItem({key:t.CU,title:this.app.i18n.t("Theme editor",{ns:t.CU}),icon:"BgColorsOutlined",aclSnippet:t.$x}),this.pluginSettingsManager.addPageTabItem({menuKey:t.CU,key:"index",title:this.app.i18n.t("Theme editor",{ns:t.CU}),componentLoader:function(){return Promise.all([b.e("812"),b.e("438")]).then(b.bind(b,125))},aclSnippet:t.$x}),this.flowEngine.registerModelLoaders({ThemeUserCenterItemModel:{extends:"UserCenterItemModel",loader:function(){return b.e("839").then(b.bind(b,3306))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){s(i,r,o,u,c,"next",e)}function c(e){s(i,r,o,u,c,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(o.prototype,n),o}(v(e.Plugin)),g=y}(),O}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@emotion/css"),require("ahooks"),require("@nocobase/client-v2"),require("@ant-design/cssinjs"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-theme-editor/client-v2",["@emotion/css","ahooks","@nocobase/client-v2","@ant-design/cssinjs","react","antd","@ant-design/icons","@nocobase/flow-engine","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-theme-editor/client-v2"]=t(require("@emotion/css"),require("ahooks"),require("@nocobase/client-v2"),require("@ant-design/cssinjs"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-theme-editor/client-v2"]=t(e["@emotion/css"],e.ahooks,e["@nocobase/client-v2"],e["@ant-design/cssinjs"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,i,u,c,a,l){return function(){"use strict";var f,s,p,d={485:function(e,t,n){n.d(t,{M:function(){return u}});var r=n(2059),o=n(6773),i=n.n(o);function u(e){return(e=i().cloneDeep(e)).algorithm&&(Array.isArray(e.algorithm)?e.algorithm=e.algorithm.map(function(e){return c(e)}).filter(Boolean):e.algorithm=c(e.algorithm),i().isEmpty(e.algorithm)&&delete e.algorithm),e}function c(e){return"string"==typeof e?e:e.toString()===r.theme.darkAlgorithm.toString()?"darkAlgorithm":e.toString()===r.theme.compactAlgorithm.toString()?"compactAlgorithm":void 0}},5705:function(e,t,n){n.d(t,{m:function(){return u}});var r=n(2059),o=n(6773),i=n.n(o);function u(e){var t;return e=i().cloneDeep(e),i().isString(e.config.algorithm)&&(e.config.algorithm=r.theme[e.config.algorithm]),Array.isArray(null==(t=e.config)?void 0:t.algorithm)&&(e.config.algorithm=e.config.algorithm.map(function(e){return i().isString(e)?r.theme[e]:e})),e}},9488:function(e,t,n){n.d(t,{$x:function(){return i},CU:function(){return o},Vp:function(){return c},kj:function(){return u}});var r=n(7694),o="theme-editor",i="pm.theme-editor.themes";function u(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[o,"client"]},n))}}function c(e,t){return e.t(t,{ns:[o,"client"]})}},4375:function(e,t,n){n.d(t,{C5:function(){return h},TD:function(){return d},W8:function(){return p},Zn:function(){return w},jM:function(){return m},qH:function(){return s},qO:function(){return g},te:function(){return v},ww:function(){return f},zP:function(){return y}});var r=n(485),o=n(5705);function i(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function c(e){i(u,r,o,c,a,"next",e)}function a(e){i(u,r,o,c,a,"throw",e)}c(void 0)})}}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function a(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function l(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var f="theme-editor:runtime-refresh";function s(e){return u(function(){var t,n;return l(this,function(r){switch(r.label){case 0:return[4,e.request({url:"themeConfig:list",params:{sort:"id",paginate:!1}})];case 1:return[2,((null==(n=r.sent())||null==(t=n.data)?void 0:t.data)||[]).map(function(e){return(0,o.m)(e)})]}})})()}function p(e,t){return u(function(){return l(this,function(n){switch(n.label){case 0:return[4,e.resource("users").updateTheme({values:{themeId:t}})];case 1:return n.sent(),[2]}})})()}function d(e){var t;return null==e||null==(t=e.systemSettings)?void 0:t.themeId}function h(e){return null==e?void 0:e.find(function(e){return e.default})}function b(e,t){if(null!=t)return null==e?void 0:e.find(function(e){return e.id===t})}function v(e,t){return b(e,t)||h(e)}function m(e,t){var n;return null==(n=v(e,t))?void 0:n.id}function g(e,t){return!b(e,t)}function y(e){return JSON.stringify(a(c({},e),{config:(0,r.M)(e.config)}))}function w(e,t){var n,r,o;return e?a(c({},e),{token:a(c({},e.token),{motionUnit:null!=(n=null==(r=e.token)?void 0:r.motionUnit)?n:null==(o=t.token)?void 0:o.motionUnit})}):t}},1802:function(e){e.exports=r},7375:function(e){e.exports=u},5477:function(t){t.exports=e},3485:function(e){e.exports=n},7694:function(e){e.exports=c},7768:function(e){e.exports=a},2625:function(e){e.exports=t},2059:function(e){e.exports=i},6773:function(e){e.exports=l},9155:function(e){e.exports=o}},h={};function b(e){var t=h[e];if(void 0!==t)return t.exports;var n=h[e]={exports:{}};return d[e](n,n.exports,b),n.exports}b.m=d,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return""+e+"."+({438:"27f66987eb1a7721",812:"a3ad9119daf9930f",839:"6219b42f52e23dc2"})[e]+".js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v={},b.l=function(e,t,n,r){if(v[e])return void v[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-theme-editor/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,b.nc&&o.setAttribute("nonce",b.nc),o.setAttribute("data-rspack","@nocobase/plugin-theme-editor/client-v2:"+n),o.src=e),v[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=v[e];if(delete v[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.nc=void 0,b.g.importScripts&&(m=b.g.location+"");var v,m,g=b.g.document;if(!m&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(m=g.currentScript.src),!m)){var y=g.getElementsByTagName("script");if(y.length)for(var w=y.length-1;w>-1&&(!m||!/^http(s?):/.test(m));)m=y[w--].src}if(!m)throw Error("Automatic publicPath is not supported in this browser");b.p=m.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),f={889:0},b.f.j=function(e,t){var n=b.o(f,e)?f[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=f[e]=[t,r]});t.push(n[2]=r);var o=b.p+b.u(e),i=Error();b.l(o,function(t){if(b.o(f,e)&&(0!==(n=f[e])&&(f[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},s=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==f[e]})){for(n in i)b.o(i,n)&&(b.m[n]=i[n]);u&&u(b)}for(e&&e(t);c<o.length;c++)r=o[c],b.o(f,r)&&f[r]&&f[r][0](),f[r]=0},(p=self.webpackChunk_nocobase_plugin_theme_editor_client_v2=self.webpackChunk_nocobase_plugin_theme_editor_client_v2||[]).forEach(s.bind(null,0)),p.push=s.bind(null,p.push.bind(p));var O={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-theme-editor/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",u=i.indexOf(o);e=u>=0?i.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-theme-editor/dist/client-v2/"}b.p=e}(),!function(){b.r(O),b.d(O,{PluginThemeEditorClientV2:function(){return g},default:function(){return y}});var e=b(3485),t=b(9488),n=b(9155),r=b.n(n),o=b(7694),i=b(7768),u=b(4375),c=b(5705);function a(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}var l=function(){var t=(0,o.useFlowContext)(),r=(0,e.useGlobalTheme)().setTheme,l=(0,n.useRef)(!1),f=t.user,s=(0,u.TD)(f);return(0,n.useEffect)(function(){if(!l.current){l.current=!0;var n=t.api.auth.getOption("theme");if(n)try{r((0,u.Zn)((0,c.m)(JSON.parse(n)).config,e.defaultTheme))}catch(e){(0,i.error)(e)}}},[t.api.auth,r]),(0,n.useEffect)(function(){if(null==f?void 0:f.id){var n,o,c=!1,l=function(){var n;return(n=function(){var n,o,a;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),[4,(0,u.qH)(t.api)];case 1:if(n=l.sent(),c)return[2];if(null==(o=(0,u.te)(n,s))?void 0:o.config)return r((0,u.Zn)(o.config,e.defaultTheme)),t.api.auth.setOption("theme",(0,u.zP)(o)),[2];return r(e.defaultTheme),t.api.auth.setOption("theme",null),[3,3];case 2:return a=l.sent(),(0,i.error)(a),[3,3];case 3:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function u(e){a(i,r,o,u,c,"next",e)}function c(e){a(i,r,o,u,c,"throw",e)}u(void 0)})})()};l();var p=function(){l()};return null==(o=t.app)||null==(n=o.eventBus)||n.addEventListener(u.ww,p),function(){var e,n;c=!0,null==(n=t.app)||null==(e=n.eventBus)||e.removeEventListener(u.ww,p)}}},[t,t.api,t.api.auth,s,null==f?void 0:f.id,r]),null};l.displayName="ThemeRuntime";var f=Symbol.for("nocobase.theme-editor.runtime.installed");function s(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function p(e,t,n){return(p=m()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&h(o,n.prototype),o}).apply(null,arguments)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){var t="function"==typeof Map?new Map:void 0;return(v=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return p(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,e)})(e)}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}var g=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function o(){var e,t;if(!(this instanceof o))throw TypeError("Cannot call a class as a function");return e=o,t=arguments,e=d(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,m()?Reflect.construct(e,t||[],d(this).constructor):e.apply(this,t))}return o.prototype=Object.create(e&&e.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),e&&h(o,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){var n=this.app.router;if(!n[f]){var o=n.getRouterComponent.bind(n);n.getRouterComponent=function(e){return o(r().createElement(r().Fragment,null,r().createElement(l,null),e))},n[f]=!0}return this.pluginSettingsManager.addMenuItem({key:t.CU,title:this.app.i18n.t("Theme editor",{ns:t.CU}),icon:"BgColorsOutlined",aclSnippet:t.$x}),this.pluginSettingsManager.addPageTabItem({menuKey:t.CU,key:"index",title:this.app.i18n.t("Theme editor",{ns:t.CU}),componentLoader:function(){return Promise.all([b.e("812"),b.e("438")]).then(b.bind(b,125))},aclSnippet:t.$x}),this.flowEngine.registerModelLoaders({ThemeUserCenterItemModel:{extends:"UserCenterItemModel",loader:function(){return b.e("839").then(b.bind(b,3306))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){s(i,r,o,u,c,"next",e)}function c(e){s(i,r,o,u,c,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(o.prototype,n),o}(v(e.Plugin)),y=g}(),O}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-beta.
|
|
11
|
+
"@nocobase/client": "2.1.0-beta.45",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"antd": "5.24.2",
|
|
14
14
|
"lodash": "4.18.1",
|
|
15
|
-
"@nocobase/flow-engine": "2.1.0-beta.
|
|
16
|
-
"@nocobase/client-v2": "2.1.0-beta.
|
|
17
|
-
"@nocobase/server": "2.1.0-beta.
|
|
18
|
-
"@nocobase/utils": "2.1.0-beta.
|
|
15
|
+
"@nocobase/flow-engine": "2.1.0-beta.45",
|
|
16
|
+
"@nocobase/client-v2": "2.1.0-beta.45",
|
|
17
|
+
"@nocobase/server": "2.1.0-beta.45",
|
|
18
|
+
"@nocobase/utils": "2.1.0-beta.45",
|
|
19
19
|
"@ant-design/icons": "5.6.1",
|
|
20
20
|
"react-i18next": "11.18.6",
|
|
21
21
|
"@ant-design/cssinjs": "1.21.1",
|
|
22
22
|
"@emotion/css": "11.13.0",
|
|
23
23
|
"ahooks": "3.7.8",
|
|
24
|
-
"@nocobase/actions": "2.1.0-beta.
|
|
25
|
-
"@nocobase/database": "2.1.0-beta.
|
|
24
|
+
"@nocobase/actions": "2.1.0-beta.45",
|
|
25
|
+
"@nocobase/database": "2.1.0-beta.45"
|
|
26
26
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-theme-editor",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.45",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"homepage": "https://docs.nocobase.com/handbook/theme-editor",
|
|
6
6
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/theme-editor",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@nocobase/test": "2.x",
|
|
36
36
|
"@nocobase/utils": "2.x"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "42587115fc34c3eb01ef2b2549f1c998e5708318",
|
|
39
39
|
"keywords": [
|
|
40
40
|
"System management"
|
|
41
41
|
],
|