@nocobase/plugin-theme-editor 2.3.0-alpha.1 → 3.0.0-alpha.2

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.
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- "use strict";(self.webpackChunk_nocobase_plugin_theme_editor_client_v2=self.webpackChunk_nocobase_plugin_theme_editor_client_v2||[]).push([["839"],{3306:function(e,t,n){n.r(t),n.d(t,{ThemeUserCenterItemModel:function(){return h}});var r=n(3485),o=n(4375),i=n(9488);function u(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 c(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){u(i,r,o,c,a,"next",e)}function a(e){u(i,r,o,c,a,"throw",e)}c(void 0)})}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function p(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 h=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,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=l(t),a(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,s()?Reflect.construct(t,r||[],l(this).constructor):t.apply(this,r)),"section","preferences"),a(e,"sort",310),a(e,"label","Theme"),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&f(n,e),t=[{key:"prepare",value:function(){return c(function(){var e,t,n,r,u,c;return p(this,function(a){switch(a.label){case 0:return e=this,[4,(0,o.qH)(this.context.api)];case 1:return n=(t=a.sent()).filter(function(e){return e.optional}),r=(0,o.TD)(this.context.user),u=(0,o.C5)(t),c=n.find(function(e){return e.id===r})||u,this.label=(0,i.Vp)(this.context,"Theme"),this.options=n.map(function(t){var n;return{label:(0,i.Vp)(e.context,(null==(n=t.config)?void 0:n.name)||""),value:String(t.id)}}),this.value=(null==c?void 0:c.id)==null?void 0:String(c.id),this.ready=this.options.length>0,[2]}})}).call(this)}},{key:"onChange",value:function(e){return c(function(){var t;return p(this,function(n){switch(n.label){case 0:return t=Number(e),[4,(0,o.W8)(this.context.api,Number.isFinite(t)?t:null)];case 1:return n.sent(),window.location.reload(),[2]}})}).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}(r.UserCenterSelectItemModel);a(h,"itemId","theme"),t.default=h}}]);
10
+ "use strict";(self.webpackChunk_nocobase_plugin_theme_editor_client_v2=self.webpackChunk_nocobase_plugin_theme_editor_client_v2||[]).push([["839"],{3306:function(e,t,n){n.r(t),n.d(t,{ThemeUserCenterItemModel:function(){return h}});var r=n(3485),o=n(4375),i=n(9488);function u(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 c(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){u(i,r,o,c,a,"next",e)}function a(e){u(i,r,o,c,a,"throw",e)}c(void 0)})}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function p(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 h=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,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=l(t),a(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,f()?Reflect.construct(t,r||[],l(this).constructor):t.apply(this,r)),"section","preferences"),a(e,"sort",310),a(e,"label","Theme"),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&s(n,e),t=[{key:"prepare",value:function(){return c(function(){var e,t,n,u,c,a;return p(this,function(l){switch(l.label){case 0:if(e=this,(0,r.isSettingsApp)(this.context.app))return this.ready=!1,[2];return[4,(0,o.qH)(this.context.api)];case 1:return n=(t=l.sent()).filter(function(e){return e.optional}),u=(0,o.TD)(this.context.user),c=(0,o.C5)(t),a=n.find(function(e){return e.id===u})||c,this.label=(0,i.Vp)(this.context,"Theme"),this.options=n.map(function(t){var n;return{label:(0,i.Vp)(e.context,(null==(n=t.config)?void 0:n.name)||""),value:String(t.id)}}),this.value=(null==a?void 0:a.id)==null?void 0:String(a.id),this.ready=this.options.length>0,[2]}})}).call(this)}},{key:"onChange",value:function(e){return c(function(){var t;return p(this,function(n){switch(n.label){case 0:return t=Number(e),[4,(0,o.W8)(this.context.api,Number.isFinite(t)?t:null)];case 1:return n.sent(),window.location.reload(),[2]}})}).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}(r.UserCenterSelectItemModel);a(h,"itemId","theme"),t.default=h}}]);
@@ -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 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){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-theme-editor/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-theme-editor/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var u=window.location.pathname||"/",c=u.indexOf(i);e=c>=0?u.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),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}()});
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:"3057a9b6323175ac",812:"a3ad9119daf9930f",839:"5033376a695fbe35"})[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){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-theme-editor/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-theme-editor/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var u=window.location.pathname||"/",c=u.indexOf(i);e=c>=0?u.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),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}()});
@@ -8,19 +8,19 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.3.0-alpha.1",
11
+ "@nocobase/client": "3.0.0-alpha.2",
12
12
  "react": "18.2.0",
13
13
  "antd": "5.24.2",
14
14
  "lodash": "4.18.1",
15
- "@nocobase/flow-engine": "2.3.0-alpha.1",
16
- "@nocobase/client-v2": "2.3.0-alpha.1",
17
- "@nocobase/server": "2.3.0-alpha.1",
18
- "@nocobase/utils": "2.3.0-alpha.1",
15
+ "@nocobase/flow-engine": "3.0.0-alpha.2",
16
+ "@nocobase/client-v2": "3.0.0-alpha.2",
17
+ "@nocobase/server": "3.0.0-alpha.2",
18
+ "@nocobase/utils": "3.0.0-alpha.2",
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.3.0-alpha.1",
25
- "@nocobase/database": "2.3.0-alpha.1"
24
+ "@nocobase/actions": "3.0.0-alpha.2",
25
+ "@nocobase/database": "3.0.0-alpha.2"
26
26
  };
@@ -19,6 +19,7 @@
19
19
  "Export": "Export",
20
20
  "Initializing Editor...": "Initializing Editor...",
21
21
  "Local": "Local",
22
+ "Minimal": "Minimal",
22
23
  "Non-optional": "Non-optional",
23
24
  "Optional": "Optional",
24
25
  "Please input the theme name": "Please input the theme name",
@@ -26,6 +27,7 @@
26
27
  "Save": "Save",
27
28
  "Save theme": "Save theme",
28
29
  "Saved successfully": "Saved successfully",
30
+ "Settings center": "Settings center",
29
31
  "The theme of the JSON format is incorrect": "The theme of the JSON format is incorrect",
30
32
  "Theme": "Theme",
31
33
  "Theme Editor": "Theme Editor",
@@ -19,6 +19,7 @@
19
19
  "Export": "导出",
20
20
  "Initializing Editor...": "正在初始化编辑器...",
21
21
  "Local": "Local",
22
+ "Minimal": "简约",
22
23
  "Non-optional": "不可选",
23
24
  "Optional": "可选",
24
25
  "Please input the theme name": "请输入主题名字",
@@ -26,6 +27,7 @@
26
27
  "Save": "保存",
27
28
  "Save theme": "保存主题",
28
29
  "Saved successfully": "保存成功",
30
+ "Settings center": "设置中心",
29
31
  "The theme of the JSON format is incorrect": "主题 JSON 格式错误",
30
32
  "Theme": "主题",
31
33
  "Theme Editor": "主题编辑器",
@@ -6,10 +6,32 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { ThemeItem } from '../types';
9
+ import type { ThemeItem } from '../types';
10
+ type BuiltInThemeAlgorithm = 'darkAlgorithm' | 'compactAlgorithm';
11
+ type BuiltInThemeConfig = Omit<NonNullable<ThemeItem['config']>, 'algorithm'> & {
12
+ algorithm?: BuiltInThemeAlgorithm | BuiltInThemeAlgorithm[];
13
+ };
14
+ type BuiltInThemeItem = Omit<ThemeItem, 'id' | 'config'> & {
15
+ config: BuiltInThemeConfig;
16
+ };
10
17
  /** antd 默认主题 */
11
- export declare const defaultTheme: Omit<ThemeItem, 'id'>;
12
- export declare const dark: Omit<ThemeItem, 'id'>;
13
- export declare const compact: Omit<ThemeItem, 'id'>;
18
+ export declare const defaultTheme: BuiltInThemeItem;
19
+ export declare const dark: BuiltInThemeItem;
20
+ export declare const compact: BuiltInThemeItem;
21
+ /**
22
+ * 简约主题:黑白灰、无强调色。
23
+ *
24
+ * 设置中心的外观由这条记录约束,不再写死在代码里:想调就在主题编辑器里改它,
25
+ * 删掉则回落到代码里的默认中性配色。
26
+ *
27
+ * `optional: false`:默认不进用户的主题下拉框。它是给设置中心这个作用域用的,
28
+ * 不是谁的业务端个人偏好;需要给别的应用复用时,在主题编辑器里把「可被用户选择」
29
+ * 打开即可,记录本身是通用的。
30
+ *
31
+ * 主色收成黑白后 antd 会派生出一整套中灰色板(近黑主色派生的「浅色背景」是 #5e5e5e 这种
32
+ * 中灰,会造成深底深字),所以派生出来的那几个必须显式钉住,取值就是 antd 默认的中性填充色。
33
+ */
34
+ export declare const minimal: BuiltInThemeItem;
14
35
  /** 同时包含 `紧凑` 和 `暗黑` 两种模式 */
15
- export declare const compactDark: Omit<ThemeItem, 'id'>;
36
+ export declare const compactDark: BuiltInThemeItem;
37
+ export {};
@@ -29,7 +29,8 @@ __export(builtinThemes_exports, {
29
29
  compact: () => compact,
30
30
  compactDark: () => compactDark,
31
31
  dark: () => dark,
32
- defaultTheme: () => defaultTheme
32
+ defaultTheme: () => defaultTheme,
33
+ minimal: () => minimal
33
34
  });
34
35
  module.exports = __toCommonJS(builtinThemes_exports);
35
36
  const defaultTheme = {
@@ -44,7 +45,6 @@ const defaultTheme = {
44
45
  const dark = {
45
46
  config: {
46
47
  name: "Dark",
47
- // @ts-ignore
48
48
  algorithm: "darkAlgorithm"
49
49
  },
50
50
  optional: true,
@@ -55,7 +55,6 @@ const dark = {
55
55
  const compact = {
56
56
  config: {
57
57
  name: "Compact",
58
- // @ts-ignore
59
58
  algorithm: "compactAlgorithm",
60
59
  token: {
61
60
  fontSize: 16
@@ -66,10 +65,79 @@ const compact = {
66
65
  uid: "compact",
67
66
  default: process.env.__E2E__ ? false : true
68
67
  };
68
+ const minimal = {
69
+ config: {
70
+ name: "Minimal",
71
+ // 间距和字号跟「紧凑」一致:这条主题是整套替换而不是叠加,不带算法的话
72
+ // 会退回 antd 默认的宽松间距,跟平台其他地方对不上。
73
+ algorithm: "compactAlgorithm",
74
+ token: {
75
+ fontSize: 16,
76
+ // 顶栏那几个 token(colorBgHeader / colorTextHeaderMenu…)刻意不进这条主题:
77
+ // 业务端顶栏是深色的,logo 和图标都按深底做的,翻成白底就得连 logo 一起反色。
78
+ // 设置中心自己那条白顶栏由 settingsTheme 在代码里补,不牵连用这套主题的其他应用。
79
+ colorPrimary: "#000000",
80
+ colorInfo: "#000000",
81
+ colorPrimaryHover: "#333333",
82
+ colorPrimaryActive: "#000000",
83
+ colorPrimaryBg: "rgba(0, 0, 0, 0.02)",
84
+ colorPrimaryBgHover: "rgba(0, 0, 0, 0.04)",
85
+ colorPrimaryBorder: "#d9d9d9",
86
+ colorPrimaryBorderHover: "rgba(0, 0, 0, 0.45)",
87
+ colorInfoBg: "rgba(0, 0, 0, 0.02)",
88
+ colorInfoBgHover: "rgba(0, 0, 0, 0.04)",
89
+ colorInfoBorder: "#f0f0f0",
90
+ colorInfoBorderHover: "#d9d9d9",
91
+ colorInfoText: "rgba(0, 0, 0, 0.88)",
92
+ controlItemBgActive: "rgba(0, 0, 0, 0.02)",
93
+ controlItemBgActiveHover: "rgba(0, 0, 0, 0.04)",
94
+ colorTextLightSolid: "#ffffff",
95
+ colorLink: "rgba(0, 0, 0, 0.65)",
96
+ colorLinkHover: "rgba(0, 0, 0, 0.88)",
97
+ colorLinkActive: "rgba(0, 0, 0, 0.88)",
98
+ // 自绘选中态(角色列表、部门树)读这一对;整行纯黑太重,用浅底 + 正文色。
99
+ colorBgItemActive: "rgba(0, 0, 0, 0.06)",
100
+ colorTextItemActive: ""
101
+ },
102
+ components: {
103
+ Menu: {
104
+ itemSelectedBg: "rgba(0, 0, 0, 0.06)",
105
+ itemSelectedColor: "rgba(0, 0, 0, 0.88)",
106
+ subMenuItemBg: "rgba(0, 0, 0, 0.02)",
107
+ subMenuItemSelectedColor: "rgba(0, 0, 0, 0.88)",
108
+ horizontalItemSelectedColor: "rgba(0, 0, 0, 0.88)",
109
+ horizontalItemSelectedBg: "transparent",
110
+ activeBarBorderWidth: 0
111
+ },
112
+ Spin: {
113
+ colorPrimary: "rgba(0, 0, 0, 0.45)"
114
+ },
115
+ Select: {
116
+ // 下拉选中项用浅灰底 + 正文色:整条纯黑压在下拉里太重,
117
+ // 而且下拉本来就是短暂出现的,不需要这么强的指示。
118
+ optionSelectedBg: "rgba(0, 0, 0, 0.06)",
119
+ optionSelectedColor: "rgba(0, 0, 0, 0.88)"
120
+ },
121
+ Switch: {
122
+ colorPrimary: "#000000",
123
+ colorPrimaryHover: "#000000"
124
+ },
125
+ Tabs: {
126
+ itemSelectedColor: "rgba(0, 0, 0, 0.88)",
127
+ itemHoverColor: "rgba(0, 0, 0, 0.88)",
128
+ itemActiveColor: "rgba(0, 0, 0, 0.88)",
129
+ inkBarColor: "rgba(0, 0, 0, 0.88)"
130
+ }
131
+ }
132
+ },
133
+ optional: false,
134
+ isBuiltIn: true,
135
+ uid: "minimal",
136
+ default: false
137
+ };
69
138
  const compactDark = {
70
139
  config: {
71
140
  name: "Compact dark",
72
- // @ts-ignore
73
141
  algorithm: ["compactAlgorithm", "darkAlgorithm"],
74
142
  token: {
75
143
  fontSize: 16,
@@ -87,5 +155,6 @@ const compactDark = {
87
155
  compact,
88
156
  compactDark,
89
157
  dark,
90
- defaultTheme
158
+ defaultTheme,
159
+ minimal
91
160
  });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Migration } from '@nocobase/server';
10
+ /**
11
+ * 给已有实例补一条简约主题。
12
+ *
13
+ * 设置中心的外观改由这条记录约束(见 `builtinThemes.minimal`),
14
+ * 新装实例在 install 时写入,老实例走这里补。
15
+ */
16
+ export default class extends Migration {
17
+ appVersion: string;
18
+ up(): Promise<void>;
19
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var add_minimal_theme_exports = {};
28
+ __export(add_minimal_theme_exports, {
29
+ default: () => add_minimal_theme_default
30
+ });
31
+ module.exports = __toCommonJS(add_minimal_theme_exports);
32
+ var import_server = require("@nocobase/server");
33
+ var import_builtinThemes = require("../builtinThemes");
34
+ class add_minimal_theme_default extends import_server.Migration {
35
+ appVersion = "<2.2.0-alpha.12";
36
+ async up() {
37
+ const repository = this.db.getRepository("themeConfig");
38
+ if (!repository) {
39
+ return;
40
+ }
41
+ const existed = await repository.findOne({ filter: { uid: import_builtinThemes.minimal.uid } });
42
+ if (existed) {
43
+ return;
44
+ }
45
+ await repository.create({ values: import_builtinThemes.minimal });
46
+ }
47
+ }
@@ -55,7 +55,7 @@ class PluginThemeEditorServer extends import_server.Plugin {
55
55
  }
56
56
  if (await themeRepo.count() === 0) {
57
57
  await themeRepo.create({
58
- values: [import_builtinThemes.defaultTheme, import_builtinThemes.dark, import_builtinThemes.compact, import_builtinThemes.compactDark]
58
+ values: [import_builtinThemes.defaultTheme, import_builtinThemes.dark, import_builtinThemes.compact, import_builtinThemes.compactDark, import_builtinThemes.minimal]
59
59
  });
60
60
  }
61
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-theme-editor",
3
- "version": "2.3.0-alpha.1",
3
+ "version": "3.0.0-alpha.2",
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": "2377df8ceb12549149017f7f14a61207bf6e49a2",
38
+ "gitHead": "a3faea21082b30989301de04591ee1b91fd4e6a5",
39
39
  "keywords": [
40
40
  "System management"
41
41
  ],