zs_library 0.3.7 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +2319 -0
- package/dist/index.umd.js +468 -0
- package/dist/style.css +1 -0
- package/package.json +107 -102
- package/dist/index.js +0 -1696
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
(function(Y,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react"),require("@emotion/css"),require("react-slick"),require("react-sortablejs"),require("framer-motion"),require("ahooks"),require("uuid"),require("rc-tooltip"),require("@remixicon/react"),require("rc-dialog"),require("react-json-view"),require("@mdxeditor/editor")):typeof define=="function"&&define.amd?define(["exports","react","@emotion/css","react-slick","react-sortablejs","framer-motion","ahooks","uuid","rc-tooltip","@remixicon/react","rc-dialog","react-json-view","@mdxeditor/editor"],d):(Y=typeof globalThis<"u"?globalThis:Y||self,d(Y.zs_library={},Y.React,Y.css,Y.Slider,Y.reactSortablejs,Y.framerMotion,Y.ahooks,Y.uuid,Y.RcTooltip,Y.react,Y.Dialog,Y.ReactJson,Y.editor))})(this,function(Y,d,a,dt,Ee,B,Ye,We,ft,ye,ze,mt,g){"use strict";var qt=Object.defineProperty;var er=(Y,d,a)=>d in Y?qt(Y,d,{enumerable:!0,configurable:!0,writable:!0,value:a}):Y[d]=a;var Fe=(Y,d,a)=>er(Y,typeof d!="symbol"?d+"":d,a);var _e={exports:{}},xe={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ue;function gt(){if(Ue)return xe;Ue=1;var h=d,t=Symbol.for("react.element"),c=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,p=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function w(y,s,M){var v,L={},D=null,X=null;M!==void 0&&(D=""+M),s.key!==void 0&&(D=""+s.key),s.ref!==void 0&&(X=s.ref);for(v in s)i.call(s,v)&&!l.hasOwnProperty(v)&&(L[v]=s[v]);if(y&&y.defaultProps)for(v in s=y.defaultProps,s)L[v]===void 0&&(L[v]=s[v]);return{$$typeof:t,type:y,key:D,ref:X,props:L,_owner:p.current}}return xe.Fragment=c,xe.jsx=w,xe.jsxs=w,xe}var be={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Ve;function pt(){return Ve||(Ve=1,process.env.NODE_ENV!=="production"&&function(){var h=d,t=Symbol.for("react.element"),c=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),w=Symbol.for("react.provider"),y=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),X=Symbol.for("react.offscreen"),V=Symbol.iterator,f="@@iterator";function x(e){if(e===null||typeof e!="object")return null;var r=V&&e[V]||e[f];return typeof r=="function"?r:null}var E=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function m(e){{for(var r=arguments.length,o=new Array(r>1?r-1:0),u=1;u<r;u++)o[u-1]=arguments[u];J("error",e,o)}}function J(e,r,o){{var u=E.ReactDebugCurrentFrame,R=u.getStackAddendum();R!==""&&(r+="%s",o=o.concat([R]));var A=o.map(function(I){return String(I)});A.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,A)}}var b=!1,N=!1,_=!1,k=!1,S=!1,K;K=Symbol.for("react.module.reference");function ue(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===l||S||e===p||e===M||e===v||k||e===X||b||N||_||typeof e=="object"&&e!==null&&(e.$$typeof===D||e.$$typeof===L||e.$$typeof===w||e.$$typeof===y||e.$$typeof===s||e.$$typeof===K||e.getModuleId!==void 0))}function Z(e,r,o){var u=e.displayName;if(u)return u;var R=r.displayName||r.name||"";return R!==""?o+"("+R+")":o}function pe(e){return e.displayName||"Context"}function H(e){if(e==null)return null;if(typeof e.tag=="number"&&m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case c:return"Portal";case l:return"Profiler";case p:return"StrictMode";case M:return"Suspense";case v:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case y:var r=e;return pe(r)+".Consumer";case w:var o=e;return pe(o._context)+".Provider";case s:return Z(e,e.render,"ForwardRef");case L:var u=e.displayName||null;return u!==null?u:H(e.type)||"Memo";case D:{var R=e,A=R._payload,I=R._init;try{return H(I(A))}catch{return null}}}return null}var ne=Object.assign,le=0,W,ae,ce,Ce,we,Se,je;function T(){}T.__reactDisabledLog=!0;function q(){{if(le===0){W=console.log,ae=console.info,ce=console.warn,Ce=console.error,we=console.group,Se=console.groupCollapsed,je=console.groupEnd;var e={configurable:!0,enumerable:!0,value:T,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}le++}}function Q(){{if(le--,le===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ne({},e,{value:W}),info:ne({},e,{value:ae}),warn:ne({},e,{value:ce}),error:ne({},e,{value:Ce}),group:ne({},e,{value:we}),groupCollapsed:ne({},e,{value:Se}),groupEnd:ne({},e,{value:je})})}le<0&&m("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var O=E.ReactCurrentDispatcher,z;function F(e,r,o){{if(z===void 0)try{throw Error()}catch(R){var u=R.stack.trim().match(/\n( *(at )?)/);z=u&&u[1]||""}return`
|
|
18
|
+
`+z+e}}var j=!1,P;{var $=typeof WeakMap=="function"?WeakMap:Map;P=new $}function oe(e,r){if(!e||j)return"";{var o=P.get(e);if(o!==void 0)return o}var u;j=!0;var R=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var A;A=O.current,O.current=null,q();try{if(r){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(re){u=re}Reflect.construct(e,[],I)}else{try{I.call()}catch(re){u=re}e.call(I.prototype)}}else{try{throw Error()}catch(re){u=re}e()}}catch(re){if(re&&u&&typeof re.stack=="string"){for(var C=re.stack.split(`
|
|
19
|
+
`),ee=u.stack.split(`
|
|
20
|
+
`),U=C.length-1,G=ee.length-1;U>=1&&G>=0&&C[U]!==ee[G];)G--;for(;U>=1&&G>=0;U--,G--)if(C[U]!==ee[G]){if(U!==1||G!==1)do if(U--,G--,G<0||C[U]!==ee[G]){var ie=`
|
|
21
|
+
`+C[U].replace(" at new "," at ");return e.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",e.displayName)),typeof e=="function"&&P.set(e,ie),ie}while(U>=1&&G>=0);break}}}finally{j=!1,O.current=A,Q(),Error.prepareStackTrace=R}var ve=e?e.displayName||e.name:"",me=ve?F(ve):"";return typeof e=="function"&&P.set(e,me),me}function Ie(e,r,o){return oe(e,!1)}function Te(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function te(e,r,o){if(e==null)return"";if(typeof e=="function")return oe(e,Te(e));if(typeof e=="string")return F(e);switch(e){case M:return F("Suspense");case v:return F("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case s:return Ie(e.render);case L:return te(e.type,r,o);case D:{var u=e,R=u._payload,A=u._init;try{return te(A(R),r,o)}catch{}}}return""}var fe=Object.prototype.hasOwnProperty,Qe={},qe=E.ReactDebugCurrentFrame;function Re(e){if(e){var r=e._owner,o=te(e.type,e._source,r?r.type:null);qe.setExtraStackFrame(o)}else qe.setExtraStackFrame(null)}function Pt(e,r,o,u,R){{var A=Function.call.bind(fe);for(var I in e)if(A(e,I)){var C=void 0;try{if(typeof e[I]!="function"){var ee=Error((u||"React class")+": "+o+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ee.name="Invariant Violation",ee}C=e[I](r,I,u,o,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(U){C=U}C&&!(C instanceof Error)&&(Re(R),m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",u||"React class",o,I,typeof C),Re(null)),C instanceof Error&&!(C.message in Qe)&&(Qe[C.message]=!0,Re(R),m("Failed %s type: %s",o,C.message),Re(null))}}}var Mt=Array.isArray;function De(e){return Mt(e)}function Dt(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,o=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o}}function Nt(e){try{return et(e),!1}catch{return!0}}function et(e){return""+e}function tt(e){if(Nt(e))return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Dt(e)),et(e)}var ke=E.ReactCurrentOwner,Ot={key:!0,ref:!0,__self:!0,__source:!0},rt,nt,Ne;Ne={};function At(e){if(fe.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Bt(e){if(fe.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Lt(e,r){if(typeof e.ref=="string"&&ke.current&&r&&ke.current.stateNode!==r){var o=H(ke.current.type);Ne[o]||(m('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',H(ke.current.type),e.ref),Ne[o]=!0)}}function Ft(e,r){{var o=function(){rt||(rt=!0,m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};o.isReactWarning=!0,Object.defineProperty(e,"key",{get:o,configurable:!0})}}function Yt(e,r){{var o=function(){nt||(nt=!0,m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};o.isReactWarning=!0,Object.defineProperty(e,"ref",{get:o,configurable:!0})}}var Wt=function(e,r,o,u,R,A,I){var C={$$typeof:t,type:e,key:r,ref:o,props:I,_owner:A};return C._store={},Object.defineProperty(C._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(C,"_self",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.defineProperty(C,"_source",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.freeze&&(Object.freeze(C.props),Object.freeze(C)),C};function zt(e,r,o,u,R){{var A,I={},C=null,ee=null;o!==void 0&&(tt(o),C=""+o),Bt(r)&&(tt(r.key),C=""+r.key),At(r)&&(ee=r.ref,Lt(r,R));for(A in r)fe.call(r,A)&&!Ot.hasOwnProperty(A)&&(I[A]=r[A]);if(e&&e.defaultProps){var U=e.defaultProps;for(A in U)I[A]===void 0&&(I[A]=U[A])}if(C||ee){var G=typeof e=="function"?e.displayName||e.name||"Unknown":e;C&&Ft(I,G),ee&&Yt(I,G)}return Wt(e,C,ee,R,u,ke.current,I)}}var Oe=E.ReactCurrentOwner,ot=E.ReactDebugCurrentFrame;function he(e){if(e){var r=e._owner,o=te(e.type,e._source,r?r.type:null);ot.setExtraStackFrame(o)}else ot.setExtraStackFrame(null)}var Ae;Ae=!1;function Be(e){return typeof e=="object"&&e!==null&&e.$$typeof===t}function at(){{if(Oe.current){var e=H(Oe.current.type);if(e)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function Ut(e){return""}var it={};function Vt(e){{var r=at();if(!r){var o=typeof e=="string"?e:e.displayName||e.name;o&&(r=`
|
|
24
|
+
|
|
25
|
+
Check the top-level render call using <`+o+">.")}return r}}function st(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var o=Vt(r);if(it[o])return;it[o]=!0;var u="";e&&e._owner&&e._owner!==Oe.current&&(u=" It was passed a child from "+H(e._owner.type)+"."),he(e),m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',o,u),he(null)}}function lt(e,r){{if(typeof e!="object")return;if(De(e))for(var o=0;o<e.length;o++){var u=e[o];Be(u)&&st(u,r)}else if(Be(e))e._store&&(e._store.validated=!0);else if(e){var R=x(e);if(typeof R=="function"&&R!==e.entries)for(var A=R.call(e),I;!(I=A.next()).done;)Be(I.value)&&st(I.value,r)}}}function Gt(e){{var r=e.type;if(r==null||typeof r=="string")return;var o;if(typeof r=="function")o=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===s||r.$$typeof===L))o=r.propTypes;else return;if(o){var u=H(r);Pt(o,e.props,"prop",u,e)}else if(r.PropTypes!==void 0&&!Ae){Ae=!0;var R=H(r);m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Xt(e){{for(var r=Object.keys(e.props),o=0;o<r.length;o++){var u=r[o];if(u!=="children"&&u!=="key"){he(e),m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",u),he(null);break}}e.ref!==null&&(he(e),m("Invalid attribute `ref` supplied to `React.Fragment`."),he(null))}}var ct={};function ut(e,r,o,u,R,A){{var I=ue(e);if(!I){var C="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(C+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ee=Ut();ee?C+=ee:C+=at();var U;e===null?U="null":De(e)?U="array":e!==void 0&&e.$$typeof===t?(U="<"+(H(e.type)||"Unknown")+" />",C=" Did you accidentally export a JSX literal instead of a component?"):U=typeof e,m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",U,C)}var G=zt(e,r,o,R,A);if(G==null)return G;if(I){var ie=r.children;if(ie!==void 0)if(u)if(De(ie)){for(var ve=0;ve<ie.length;ve++)lt(ie[ve],e);Object.freeze&&Object.freeze(ie)}else m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else lt(ie,e)}if(fe.call(r,"key")){var me=H(e),re=Object.keys(r).filter(function(Qt){return Qt!=="key"}),Le=re.length>0?"{key: someKey, "+re.join(": ..., ")+": ...}":"{key: someKey}";if(!ct[me+Le]){var Zt=re.length>0?"{"+re.join(": ..., ")+": ...}":"{}";m(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
+
let props = %s;
|
|
27
|
+
<%s {...props} />
|
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
|
29
|
+
let props = %s;
|
|
30
|
+
<%s key={someKey} {...props} />`,Le,me,Zt,me),ct[me+Le]=!0}}return e===i?Xt(G):Gt(G),G}}function $t(e,r,o){return ut(e,r,o,!0)}function Jt(e,r,o){return ut(e,r,o,!1)}var Kt=Jt,Ht=$t;be.Fragment=i,be.jsx=Kt,be.jsxs=Ht}()),be}process.env.NODE_ENV==="production"?_e.exports=gt():_e.exports=pt();var n=_e.exports;const Ge={token:{itemNameColor:"#1a1a1a",itemIconBackgroundColor:"white",itemIconShadowColor:"rgba(0, 0, 0, 0.1)",groupItemIconBackgroundColor:"rgba(255, 255, 255, 0.1)",groupItemIconShadowColor:"rgba(0, 0, 0, 0.1)",groupItemModalBackgroundColor:"rgba(255, 255, 255, 0.8)",contextMenuTextColor:"black",contextMenuActiveColor:"#f3f4f6",contextMenuBackgroundColor:"white",contextMenuShadowColor:"rgba(0, 0, 0, 0.1)"}},Xe={token:{itemNameColor:"white",itemIconBackgroundColor:"#1f2937",itemIconShadowColor:"rgba(0, 0, 0, 0.1)",groupItemIconBackgroundColor:"rgba(0, 0, 0, 0.1)",groupItemIconShadowColor:"rgba(0, 0, 0, 0.1)",groupItemModalBackgroundColor:"rgba(0, 0, 0, 0.1)",contextMenuTextColor:"white",contextMenuActiveColor:"#1a1a1a",contextMenuBackgroundColor:"#1a1a1a",contextMenuShadowColor:"rgba(255, 255, 255, 0.1)"}},$e=d.createContext({}),ht=h=>{const{children:t,theme:c,...i}=h,p=d.useMemo(()=>c==="light"?Ge:c==="dark"?Xe:c,[c]);return n.jsx($e.Provider,{value:{theme:p,...i},children:t})},de=()=>d.useContext($e),Je={maxRow:2,maxCol:2},vt={...Je},Ke={app:Je,group:vt};class se{}Fe(se,"uniqueArray",t=>t.reduce((c,i)=>c.find(l=>l.id===i.id)?c:c.concat([i]),[])),Fe(se,"getTheme",t=>{const c=Ge.token,i=Xe.token,p={...c,...t==null?void 0:t.token},l={...i,...t==null?void 0:t.token};return{light:p,dark:l}});const He=d.createContext({list:[],setList:()=>{},contextMenu:null,setContextMenu:()=>{},listStatus:null,setListStatus:()=>{},contextMenuFuns:()=>{},hideContextMenu:()=>{},showInfoItemData:null,setShowInfoItemData:()=>{},openGroupItemData:null,setOpenGroupItemData:()=>{},longPressTriggered:!1,updateItem:()=>{},updateItemConfig:()=>{},removeItem:()=>{},addItem:()=>{},moveItemId:null,setMoveItemId:()=>{},moveTargetId:null,setMoveTargetId:()=>{}}),xt=h=>{const{children:t,list:c=[],onChange:i,storageKey:p="ZS_LIBRARY_DESKTOP_SORTABLE_CONFIG",enableCaching:l=!0}=h,[w,y]=d.useState(),[s,M]=d.useState(),[v,L]=d.useState(null),D=d.useRef(v),[X,V]=d.useState(null),[f,x]=d.useState([]),[E,m]=d.useState(null),[J,b]=d.useState(null),[N,_]=d.useState(!1),[k,S]=d.useState(null),[K,ue]=d.useState(null),[Z,pe]=d.useState(!1),[H,ne]=Ye.useLocalStorageState(p,{defaultValue:[],listenStorageChange:!0}),le=()=>{V(null),clearTimeout(w),y(void 0),D.current=null},W=(T,q)=>{V({...T,pageX:T.pageX,pageY:T.pageY,data:q}),clearTimeout(w)},ae=(T,q=!0)=>{const{config:Q={}}=T;return Q.allowContextMenu===!1?{}:{onMouseDown:O=>{y(setTimeout(()=>{q&&D.current===null&&W(O,T)},800)),_(!1),M(setTimeout(()=>{_(!0)},800))},onMouseUp:()=>{clearTimeout(s),M(void 0),clearTimeout(w),y(void 0)},onContextMenu:O=>{q&&(O.preventDefault(),W(O,T))}}},ce=(T,q)=>{const Q=[...q||[]];if(Q.length>0)x(O=>{const z=[...O],F=j=>{var Ie,Te;const P=Q.shift(),$=j.find(te=>te.id===P),oe=j.findIndex(te=>te.id===P);if(Q.length&&$){if(((Ie=$.children)==null?void 0:Ie.filter(te=>!T.some(fe=>fe.id===te.id)).length)===1&&T.length===1){const te={...T[0]};return j.splice(oe,1,te),i==null||i(j),j}return $.children=F($.children||[]),j.splice(oe,1,$),i==null||i(j),j}if($){if(!((Te=$.children)!=null&&Te.length)&&T.length){const te={...$};return $.data={name:"文件夹"},$.type="group",$.children=[te,...T],$.id=We.v4(),j.splice(oe,1,$),i==null||i(j),j}return $.children=se.uniqueArray(T),j.splice(oe,1,$),i==null||i(j),j}return se.uniqueArray(T)};return se.uniqueArray(F(z))});else{const O=se.uniqueArray(T);i==null||i(O),x(O)}},Ce=(T,q)=>{x(Q=>{const O=[...Q],z=F=>{var j;for(let P=0;P<F.length;P++)if(F[P].id===T){F[P].config=q;break}else((j=F[P].children)==null?void 0:j.length)!==void 0&&z(F[P].children)};return z(O),i==null||i(O),O})},we=(T,q)=>{x(Q=>{const O=[...Q],z=F=>{var j;for(let P=0;P<F.length;P++)if(F[P].id===T){F[P].data=q;break}else((j=F[P].children)==null?void 0:j.length)!==void 0&&z(F[P].children)};return z(O),i==null||i(O),O})},Se=T=>{x(q=>{const Q=[...q],O=z=>{var F;for(let j=0;j<z.length;j++)if(z[j].id===T){z.splice(j,1);break}else((F=z[j].children)==null?void 0:F.length)!==void 0&&O(z[j].children)};return O(Q),i==null||i(Q),Q})},je=(T,q)=>{const Q=[...f],O=(z,F)=>{const j=F.shift(),P=z.find(oe=>oe.id===j),$=z.findIndex(oe=>oe.id===j);if(P){if(F.length)P.children=O(P.children||[],F);else{const oe=(T==null?void 0:T.type)??"app";P.children=[...P.children??[],{...T,id:We.v4(),config:(T==null?void 0:T.config)??Ke[oe]}]}return z.splice($,1,P),z}else return z};x(O(Q,q))};return d.useEffect(()=>{(c==null?void 0:c.length)>0&&f.length===0&&ce(c)},[c]),d.useEffect(()=>{D.current=v,v!==null&&le()},[v]),d.useEffect(()=>{l&&H!=null&&H.length&&!Z&&(ce(H),pe(!0))},[H,Z,l]),Ye.useDebounceEffect(()=>{l&&ne(f)},[f,l],{wait:1e3}),n.jsx(He.Provider,{value:{list:f,setList:ce,contextMenu:X,setContextMenu:V,listStatus:v,setListStatus:L,contextMenuFuns:ae,hideContextMenu:le,showInfoItemData:E,setShowInfoItemData:m,openGroupItemData:J,setOpenGroupItemData:b,longPressTriggered:N,updateItemConfig:Ce,updateItem:we,removeItem:Se,addItem:je,moveItemId:k,setMoveItemId:S,moveTargetId:K,setMoveTargetId:ue},children:t})},ge=()=>d.useContext(He),bt={menuShow:{opacity:1,y:0,transition:{type:"spring",stiffness:300,damping:24}},menuHide:{opacity:0,y:20,transition:{duration:.2}}},Pe=h=>{const{icon:t,title:c,onClick:i}=h,{theme:p}=de(),{light:l,dark:w}=se.getTheme(p);return n.jsx(B.motion.div,{className:a.css`
|
|
31
|
+
&:hover {
|
|
32
|
+
background-color: ${l.contextMenuActiveColor};
|
|
33
|
+
@media (prefers-color-scheme: dark) {
|
|
34
|
+
background-color: ${w.contextMenuActiveColor};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
@media (prefers-color-scheme: dark) {
|
|
38
|
+
color: black;
|
|
39
|
+
}
|
|
40
|
+
font-size: 0.75rem;
|
|
41
|
+
line-height: 1rem;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
transition: all 0.3s;
|
|
44
|
+
user-select: none;
|
|
45
|
+
border-radius: 0.5rem;
|
|
46
|
+
`,onClick:y=>{y.stopPropagation(),i==null||i()},variants:bt,children:n.jsxs(B.motion.div,{className:a.cx("py-1.5 px-3 rounded-lg",a.css`
|
|
47
|
+
padding-top: 0.375rem;
|
|
48
|
+
padding-bottom: 0.375rem;
|
|
49
|
+
padding-left: 0.75rem;
|
|
50
|
+
padding-right: 0.75rem;
|
|
51
|
+
border-radius: 0.5rem;
|
|
52
|
+
`),whileTap:{scale:.9},children:[n.jsx(B.motion.div,{className:a.cx(a.css`
|
|
53
|
+
margin-bottom: 0.375rem;
|
|
54
|
+
display: flex;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
`),children:t}),n.jsx(B.motion.div,{children:c})]})})},kt=h=>{const{showInfoButton:t=!0,showRemoveButton:c=!0,showShareButton:i=!0,showSizeButton:p=!0,onInfoClick:l,onShareClick:w,onRemoveClick:y}=h,{contextMenu:s,setContextMenu:M,hideContextMenu:v,setShowInfoItemData:L,removeItem:D,updateItemConfig:X}=ge(),{theme:V}=de(),{light:f,dark:x}=se.getTheme(V),{data:E}=s??{},{config:m={}}=E??{},J=()=>{var _;const b=Ke[(_=s==null?void 0:s.data)==null?void 0:_.type],N=[];for(let k=1;k<=((b==null?void 0:b.maxRow)??2);k++)for(let S=1;S<=((b==null?void 0:b.maxCol)??2);S++)N.push(`${k}x${S}`);return N};return n.jsx(B.AnimatePresence,{children:s&&n.jsxs(B.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:b=>{b.stopPropagation(),b.preventDefault()},children:[n.jsx(B.motion.div,{className:a.cx(a.css`
|
|
57
|
+
border-radius: 0.5rem;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
background-color: ${f.contextMenuBackgroundColor};
|
|
60
|
+
box-shadow: 0 0 0.5rem ${f.contextMenuShadowColor};
|
|
61
|
+
@media (prefers-color-scheme: dark) {
|
|
62
|
+
background-color: ${x.contextMenuBackgroundColor};
|
|
63
|
+
box-shadow: 0 0 0.5rem ${x.contextMenuShadowColor};
|
|
64
|
+
}
|
|
65
|
+
`),children:p&&m.allowResize!==!1&&n.jsx(B.motion.ul,{className:a.css`
|
|
66
|
+
background-color: white;
|
|
67
|
+
padding: 0.25rem;
|
|
68
|
+
margin: 0;
|
|
69
|
+
`,children:[{label:"修改大小",key:"size",icon:n.jsx(ye.RiPencilRuler2Line,{size:14}),items:J().map(b=>({label:b,key:b,onClick:()=>{const[N,_]=b.split("x").map(Number);X(s.data.id,{row:N,col:_})}}))}].map(b=>n.jsxs(B.motion.li,{className:a.css`
|
|
70
|
+
padding-top: 0.5rem;
|
|
71
|
+
padding-bottom: 0.5rem;
|
|
72
|
+
padding-left: 0.75rem;
|
|
73
|
+
padding-right: 0.75rem;
|
|
74
|
+
`,children:[n.jsxs(B.motion.p,{className:a.css`
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
font-size: 0.875rem;
|
|
78
|
+
line-height: 1.25rem;
|
|
79
|
+
gap: 0.5rem;
|
|
80
|
+
padding-bottom: 0.5rem;
|
|
81
|
+
margin: 0;
|
|
82
|
+
`,children:[b.icon," ",b.label]}),n.jsx(B.motion.div,{className:a.css`
|
|
83
|
+
display: grid;
|
|
84
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
85
|
+
gap: 0.25rem;
|
|
86
|
+
`,children:b.items.map(N=>n.jsx(B.motion.div,{className:a.cx("py-1 px-2 hover:bg-gray-100 rounded transition-all cursor-pointer text-center text-sm",a.css`
|
|
87
|
+
padding-top: 0.25rem;
|
|
88
|
+
padding-bottom: 0.25rem;
|
|
89
|
+
padding-left: 0.5rem;
|
|
90
|
+
padding-right: 0.5rem;
|
|
91
|
+
border-radius: 0.25rem;
|
|
92
|
+
transition: all 0.3s;
|
|
93
|
+
font-size: 0.875rem;
|
|
94
|
+
line-height: 1.25rem;
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
text-align: center;
|
|
97
|
+
color: ${f.contextMenuTextColor};
|
|
98
|
+
@media (prefers-color-scheme: dark) {
|
|
99
|
+
color: ${x.contextMenuTextColor};
|
|
100
|
+
}
|
|
101
|
+
&:hover {
|
|
102
|
+
background-color: ${f.contextMenuActiveColor};
|
|
103
|
+
@media (prefers-color-scheme: dark) {
|
|
104
|
+
background-color: ${x.contextMenuActiveColor};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
`,`${m.row}x${m.col}`===N.key&&a.css`
|
|
108
|
+
background-color: ${f.contextMenuActiveColor};
|
|
109
|
+
@media (prefers-color-scheme: dark) {
|
|
110
|
+
background-color: ${x.contextMenuActiveColor};
|
|
111
|
+
}
|
|
112
|
+
`),onClick:N.onClick,children:N.label},N.key))})]},b.key))})}),n.jsxs(B.motion.div,{className:a.cx(a.css`
|
|
113
|
+
background-color: ${f.contextMenuBackgroundColor};
|
|
114
|
+
box-shadow: 0 0 0.5rem ${f.contextMenuShadowColor};
|
|
115
|
+
@media (prefers-color-scheme: dark) {
|
|
116
|
+
background-color: ${x.contextMenuBackgroundColor};
|
|
117
|
+
box-shadow: 0 0 0.5rem ${x.contextMenuShadowColor};
|
|
118
|
+
}
|
|
119
|
+
display: flex;
|
|
120
|
+
justify-content: space-around;
|
|
121
|
+
align-items: center;
|
|
122
|
+
margin-top: 0.5rem;
|
|
123
|
+
border-radius: 0.5rem;
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
padding: 0.25rem;
|
|
126
|
+
`),children:[i&&n.jsx(Pe,{icon:n.jsx(ye.RiShareLine,{size:20}),title:"分享",onClick:()=>{if(w){w(s.data);return}}}),t&&n.jsx(Pe,{icon:n.jsx(ye.RiInformationLine,{size:20}),title:"信息",onClick:()=>{if(l){l(s.data);return}L({...s.data,pageX:s.pageX,pageY:s.pageY}),v()}}),c&&n.jsx(Pe,{icon:n.jsx(ye.RiCloseCircleLine,{size:20}),title:"移除",onClick:()=>{if(y){y(s.data,D);return}M(null),D(s.data.id)}})]})]})})},yt=h=>{const{data:t,noLetters:c=!1}=h,{contextMenuFuns:i}=ge(),{itemIconBuilder:p,theme:l,contextMenu:w}=de(),{light:y,dark:s}=se.getTheme(l),{data:M={}}=t,{name:v}=M;return n.jsxs(n.Fragment,{children:[n.jsx(B.motion.div,{className:a.css`
|
|
127
|
+
width: 4rem;
|
|
128
|
+
height: 4rem;
|
|
129
|
+
background-color: ${y.itemIconBackgroundColor};
|
|
130
|
+
border-radius: 0.75rem;
|
|
131
|
+
box-shadow: 0 0 0.5rem ${y.itemIconShadowColor};
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
position: relative;
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
@media (prefers-color-scheme: dark) {
|
|
136
|
+
background-color: ${s.itemIconBackgroundColor};
|
|
137
|
+
box-shadow: 0 0 0.5rem ${s.itemIconShadowColor};
|
|
138
|
+
}
|
|
139
|
+
`,whileTap:{scale:.9},children:n.jsx("div",{className:a.css`
|
|
140
|
+
position: absolute;
|
|
141
|
+
left: 0;
|
|
142
|
+
top: 0;
|
|
143
|
+
width: 100%;
|
|
144
|
+
height: 100%;
|
|
145
|
+
color: ${y.itemNameColor};
|
|
146
|
+
@media (prefers-color-scheme: dark) {
|
|
147
|
+
color: ${s.itemNameColor};
|
|
148
|
+
}
|
|
149
|
+
`,...i(t,w!==!1),children:p==null?void 0:p(t)})}),n.jsx(B.motion.p,{className:a.cx(a.css`
|
|
150
|
+
text-align: center;
|
|
151
|
+
margin-top: 0.25rem;
|
|
152
|
+
margin-bottom: 0;
|
|
153
|
+
color: ${y.itemNameColor};
|
|
154
|
+
@media (prefers-color-scheme: dark) {
|
|
155
|
+
color: ${s.itemNameColor};
|
|
156
|
+
}
|
|
157
|
+
`,c&&a.css`
|
|
158
|
+
color: transparent;
|
|
159
|
+
`),children:v})]})},Me=h=>{const{data:t,className:c,itemIndex:i,onClick:p,disabledDrag:l=!1,children:w,parentIds:y,childrenLength:s}=h,{contextMenu:M,setContextMenu:v}=ge(),{contextMenu:L}=de();return n.jsx(ft,{placement:"bottom",overlayClassName:a.css`
|
|
160
|
+
background-color: transparent;
|
|
161
|
+
.rc-tooltip-inner {
|
|
162
|
+
background-color: transparent;
|
|
163
|
+
padding: 0;
|
|
164
|
+
border: none;
|
|
165
|
+
}
|
|
166
|
+
`,overlay:n.jsx(kt,{...L}),visible:(M==null?void 0:M.data.id)===t.id,onVisibleChange:D=>{D||v(null)},destroyTooltipOnHide:!0,children:n.jsx(B.motion.div,{"data-id":t.id,"data-index":i,"data-parent-ids":y==null?void 0:y.join(","),"data-children-length":s,onClick:()=>p==null?void 0:p(t),className:a.cx(l&&"drag-disabled",c),children:w??n.jsx(yt,{...h})})})},Ct=h=>{const{data:t,className:c,parentIds:i,itemIndex:p,onClick:l,noLetters:w=!1}=h,{contextMenuFuns:y,setList:s,setOpenGroupItemData:M,longPressTriggered:v,moveItemId:L,moveTargetId:D,setMoveTargetId:X,listStatus:V}=ge(),{itemIconBuilder:f,theme:x,contextMenu:E}=de(),{light:m,dark:J}=se.getTheme(x),{children:b,data:N,config:_}=t,{row:k=1,col:S=1}=_??{},K={visible:{opacity:1,scale:1},hidden:{opacity:0,scale:.95}},ue=((b==null?void 0:b.length)??0)===0,Z=ue?[t]:[...b??[]].slice(0,9),pe=d.useMemo(()=>L===t.id.toString(),[t.id,L]),H=d.useMemo(()=>D===t.id,[t.id,D]),ne=a.css`
|
|
167
|
+
overflow: hidden;
|
|
168
|
+
cursor: pointer;
|
|
169
|
+
background-color: ${m.itemIconBackgroundColor};
|
|
170
|
+
box-shadow: 0 0 0.5rem ${m.itemIconShadowColor};
|
|
171
|
+
@media (prefers-color-scheme: dark) {
|
|
172
|
+
background-color: ${J.itemIconBackgroundColor};
|
|
173
|
+
box-shadow: 0 0 0.5rem ${J.itemIconShadowColor};
|
|
174
|
+
}
|
|
175
|
+
`,le=()=>{if(ue)return n.jsx(B.motion.div,{className:a.cx("sortable-group-item",a.css`
|
|
176
|
+
overflow: hidden;
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
width: 100%;
|
|
179
|
+
height: 100%;
|
|
180
|
+
background-color: ${m.itemIconBackgroundColor};
|
|
181
|
+
position: absolute;
|
|
182
|
+
left: 0;
|
|
183
|
+
top: 0;
|
|
184
|
+
border-radius: 0.75rem;
|
|
185
|
+
@media (prefers-color-scheme: dark) {
|
|
186
|
+
background-color: ${J.itemIconBackgroundColor};
|
|
187
|
+
}
|
|
188
|
+
`),onClick:W=>{W.stopPropagation(),l==null||l(t)},children:f==null?void 0:f(t)});if(k===1&&S===1||k===2&&S===2)return n.jsx(B.motion.div,{className:a.css`
|
|
189
|
+
display: grid;
|
|
190
|
+
width: 100%;
|
|
191
|
+
height: 100%;
|
|
192
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
193
|
+
grid-template-rows: repeat(3, minmax(0, 1fr));
|
|
194
|
+
padding: ${S===1?"0.125rem":"0.25rem"};
|
|
195
|
+
gap: ${S===1?"0.125rem":"0.5rem"};
|
|
196
|
+
place-items: center;
|
|
197
|
+
`,children:Z==null?void 0:Z.slice(0,9).map(W=>n.jsx(B.motion.div,{className:a.cx(ne,a.css`
|
|
198
|
+
border-radius: ${S===1?"0.25rem":"0.5rem"};
|
|
199
|
+
width: 100%;
|
|
200
|
+
height: 100%;
|
|
201
|
+
`),onClick:ae=>{ae.stopPropagation(),l==null||l(W)},children:f==null?void 0:f(W)},W.id))});if(k===1&&S===2)return n.jsx(B.motion.div,{className:a.css`
|
|
202
|
+
display: grid;
|
|
203
|
+
grid-template-columns: repeat(10, minmax(0, 1fr));
|
|
204
|
+
grid-template-rows: repeat(4, minmax(0, 1fr));
|
|
205
|
+
column-gap: 0.5rem;
|
|
206
|
+
row-gap: 0.25rem;
|
|
207
|
+
width: 144px;
|
|
208
|
+
height: 52px;
|
|
209
|
+
place-items: center;
|
|
210
|
+
`,children:Z==null?void 0:Z.slice(0,4).map((W,ae)=>n.jsx(B.motion.div,{className:a.cx(ne,ae<2?a.css`
|
|
211
|
+
width: 52px;
|
|
212
|
+
height: 52px;
|
|
213
|
+
border-radius: 0.5rem;
|
|
214
|
+
grid-column: span 4 / span 4;
|
|
215
|
+
grid-row: span 4 / span 4;
|
|
216
|
+
`:a.css`
|
|
217
|
+
width: 1.5rem;
|
|
218
|
+
height: 1.5rem;
|
|
219
|
+
border-radius: 0.375rem;
|
|
220
|
+
grid-column: span 2 / span 2;
|
|
221
|
+
grid-row: span 2 / span 2;
|
|
222
|
+
`),onClick:ce=>{ae>2||(ce.stopPropagation(),l==null||l(W))},children:f==null?void 0:f(W)},W.id))});if(k===2&&S===1)return n.jsx(B.motion.div,{className:a.css`
|
|
223
|
+
display: grid;
|
|
224
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
225
|
+
grid-template-rows: repeat(10, minmax(0, 1fr));
|
|
226
|
+
column-gap: 0.25rem;
|
|
227
|
+
row-gap: 0.5rem;
|
|
228
|
+
width: 52px;
|
|
229
|
+
height: 144px;
|
|
230
|
+
place-items: center;
|
|
231
|
+
`,children:Z==null?void 0:Z.slice(0,4).map((W,ae)=>n.jsx(B.motion.div,{className:a.cx(ne,ae<2?a.css`
|
|
232
|
+
width: 52px;
|
|
233
|
+
height: 52px;
|
|
234
|
+
border-radius: 0.5rem;
|
|
235
|
+
grid-column: span 4 / span 4;
|
|
236
|
+
grid-row: span 4 / span 4;
|
|
237
|
+
`:a.css`
|
|
238
|
+
width: 1.5rem;
|
|
239
|
+
height: 1.5rem;
|
|
240
|
+
grid-column: span 2 / span 2;
|
|
241
|
+
grid-row: span 2 / span 2;
|
|
242
|
+
`),onClick:ce=>{ae>2||(ce.stopPropagation(),l==null||l(W))},children:f==null?void 0:f(W)},W.id))})};return n.jsxs(Me,{data:t,itemIndex:p,parentIds:i,childrenLength:b==null?void 0:b.length,className:a.cx(a.css`
|
|
243
|
+
grid-row: span ${k};
|
|
244
|
+
grid-column: span ${S};
|
|
245
|
+
`,c),children:[n.jsx(B.motion.div,{whileTap:{scale:.9},className:a.cx(H?"!scale-110":"",a.css`
|
|
246
|
+
cursor: pointer;
|
|
247
|
+
position: relative;
|
|
248
|
+
border-radius: 0.75rem;
|
|
249
|
+
background-color: ${m.groupItemIconBackgroundColor};
|
|
250
|
+
box-shadow: 0 0 0.5rem ${m.groupItemIconShadowColor};
|
|
251
|
+
@media (prefers-color-scheme: dark) {
|
|
252
|
+
background-color: ${J.groupItemIconBackgroundColor};
|
|
253
|
+
box-shadow: 0 0 0.5rem ${J.groupItemIconShadowColor};
|
|
254
|
+
}
|
|
255
|
+
/* overflow: hidden; */
|
|
256
|
+
transition: all 0.3s;
|
|
257
|
+
margin: 0 auto;
|
|
258
|
+
width: ${S*64+32*(S-1)}px;
|
|
259
|
+
height: ${k*64+32*(k-1)}px;
|
|
260
|
+
`),onClick:W=>{!ue&&!v&&(t.parentIds=i,t.pageX=W.pageX,t.pageY=W.pageY,M(t))},...y(t,E!==!1),children:n.jsxs(B.motion.div,{className:a.css`
|
|
261
|
+
position: relative;
|
|
262
|
+
width: 100%;
|
|
263
|
+
height: 100%;
|
|
264
|
+
display: flex;
|
|
265
|
+
justify-content: center;
|
|
266
|
+
align-items: center;
|
|
267
|
+
padding: 0.375rem;
|
|
268
|
+
`,children:[le(),n.jsx(Ee.ReactSortable,{className:a.cx("sortable-group-item",a.css`
|
|
269
|
+
position: absolute;
|
|
270
|
+
cursor: pointer;
|
|
271
|
+
left: 0.375rem;
|
|
272
|
+
top: 0.375rem;
|
|
273
|
+
width: calc(100% - 0.75rem);
|
|
274
|
+
height: calc(100% - 0.75rem);
|
|
275
|
+
pointer-events: ${V===null?"none":"auto"};
|
|
276
|
+
> * {
|
|
277
|
+
opacity: 0;
|
|
278
|
+
}
|
|
279
|
+
`),group:{name:"nested",pull:!1,put:!0},animation:150,fallbackOnBody:!0,list:b??[],setList:W=>s(W,i),filter:()=>!0,"data-id":t.id,onChange:()=>{X(t.id)}})]})}),n.jsx(B.motion.p,{className:a.cx(a.css`
|
|
280
|
+
text-align: center;
|
|
281
|
+
margin-top: 0.25rem;
|
|
282
|
+
margin-bottom: 0;
|
|
283
|
+
color: ${m.itemNameColor};
|
|
284
|
+
@media (prefers-color-scheme: dark) {
|
|
285
|
+
color: ${J.itemNameColor};
|
|
286
|
+
}
|
|
287
|
+
`,w&&a.css`
|
|
288
|
+
color: transparent;
|
|
289
|
+
`),variants:K,animate:pe?"hidden":"visible",children:(N==null?void 0:N.name)??"文件夹"})]})},Ze=a.css`
|
|
290
|
+
padding: 8px;
|
|
291
|
+
transition: all 0.2s;
|
|
292
|
+
> div {
|
|
293
|
+
transition: all 0.2s;
|
|
294
|
+
border: 2px solid aquamarine;
|
|
295
|
+
background-color: transparent;
|
|
296
|
+
> div {
|
|
297
|
+
opacity: 0;
|
|
298
|
+
transition: all 0.2s;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
`,wt=h=>{const{data:t,onClose:c,onItemClick:i}=h,{list:p,setList:l,setListStatus:w,setMoveItemId:y,setMoveTargetId:s,updateItem:M}=ge(),{theme:v}=de(),{light:L,dark:D}=se.getTheme(v),[X,V]=d.useState("文件夹"),f=[...(t==null?void 0:t.children)??[]];return d.useEffect(()=>{var x;t&&V((x=t.data)==null?void 0:x.name)},[t]),n.jsx(ze,{visible:!!t,onClose:()=>{c()},animation:"zoom",maskAnimation:"fade",mousePosition:t!=null&&t.pageX&&(t!=null&&t.pageY)?{x:t==null?void 0:t.pageX,y:t==null?void 0:t.pageY}:null,title:n.jsx("input",{className:a.css`
|
|
302
|
+
background-color: transparent;
|
|
303
|
+
border-style: none;
|
|
304
|
+
text-align: center;
|
|
305
|
+
font-size: 1.25rem;
|
|
306
|
+
line-height: 1.75rem;
|
|
307
|
+
color: white;
|
|
308
|
+
@media (prefers-color-scheme: dark) {
|
|
309
|
+
color: black;
|
|
310
|
+
}
|
|
311
|
+
&:focus {
|
|
312
|
+
outline: none;
|
|
313
|
+
}
|
|
314
|
+
`,value:X,onChange:x=>{V(x.target.value)},onBlur:()=>{t&&M(t.id,{...t.data,name:X})}}),footer:null,closable:!1,className:a.cx("group-item-modal",a.css`
|
|
315
|
+
.rc-dialog-content {
|
|
316
|
+
background-color: transparent;
|
|
317
|
+
box-shadow: none;
|
|
318
|
+
padding: 0;
|
|
319
|
+
.rc-dialog-header {
|
|
320
|
+
text-align: center;
|
|
321
|
+
background-color: transparent;
|
|
322
|
+
margin-bottom: 1rem;
|
|
323
|
+
border-bottom: none;
|
|
324
|
+
.ant-modal-name {
|
|
325
|
+
color: #fff;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
.rc-dialog-body {
|
|
329
|
+
background-color: ${L.groupItemModalBackgroundColor};
|
|
330
|
+
@media (prefers-color-scheme: dark) {
|
|
331
|
+
background-color: ${D.groupItemModalBackgroundColor};
|
|
332
|
+
}
|
|
333
|
+
border-radius: 0.5rem;
|
|
334
|
+
overflow: hidden;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
`),width:600,destroyOnClose:!0,children:n.jsx("div",{className:a.css`
|
|
338
|
+
overflow-y: auto;
|
|
339
|
+
max-height: 60vh;
|
|
340
|
+
padding: 1.25rem 0;
|
|
341
|
+
`,onDragLeave:x=>{const E=x.relatedTarget;E&&(x.currentTarget.contains(E)||setTimeout(()=>{c()},500))},children:n.jsx(Ee.ReactSortable,{className:a.css`
|
|
342
|
+
display: grid;
|
|
343
|
+
gap: 1rem;
|
|
344
|
+
place-items: center;
|
|
345
|
+
grid-template-columns: repeat(auto-fill, 96px);
|
|
346
|
+
grid-auto-flow: dense;
|
|
347
|
+
grid-auto-rows: 96px;
|
|
348
|
+
`,group:{name:"nested",pull:!0,put:!1},animation:150,fallbackOnBody:!0,list:(t==null?void 0:t.children)??[],setList:x=>{var J,b;const E=x.map(N=>N.id),m=(b=(J=p.find(N=>N.id===(t==null?void 0:t.id)))==null?void 0:J.children)==null?void 0:b.map(N=>N.id);E.length===(m==null?void 0:m.length)&&E.every((N,_)=>N===m[_])||E.length<((m==null?void 0:m.length)??0)||l(x,[...(t==null?void 0:t.parentIds)??[],t==null?void 0:t.id])},onMove:()=>(s(null),w("onMove"),!0),onStart:x=>{const E=x.item.dataset;E!=null&&E.id&&y(E.id),w("onMove")},onEnd:()=>{y(null),s(null),w(null)},ghostClass:Ze,children:f.map((x,E)=>n.jsx(Me,{data:x,itemIndex:E,onClick:i},x.id))})})})},St=h=>{var i;const{data:t,onClose:c}=h;return n.jsx(ze,{visible:!!t,onClose:()=>{c()},animation:"zoom",maskAnimation:"fade",mousePosition:t!=null&&t.pageX&&(t!=null&&t.pageY)?{x:t==null?void 0:t.pageX,y:t==null?void 0:t.pageY}:null,footer:null,title:((i=t==null?void 0:t.data)==null?void 0:i.name)??"信息",children:t&&n.jsxs("div",{children:[n.jsx("div",{className:"mb-2",children:"开发者信息"}),n.jsx("div",{className:"p-2 rounded-md bg-[#272822]",children:n.jsx(mt,{src:t,theme:"monokai"})})]})})},jt=h=>{const{pagination:t={position:"bottom"},className:c,sliderProps:i,sliderRef:p,onItemClick:l}=h,w=d.useRef(null),y=d.useRef(null),{list:s,setList:M,setListStatus:v,showInfoItemData:L,setShowInfoItemData:D,openGroupItemData:X,setOpenGroupItemData:V,setMoveItemId:f,setMoveTargetId:x,addItem:E}=ge(),{pagingDotBuilder:m,pagingDotsBuilder:J,itemBuilder:b}=de(),N=d.useMemo(()=>t===!1?{}:{top:a.css`
|
|
349
|
+
display: flex;
|
|
350
|
+
flex-direction: column;
|
|
351
|
+
.slick-list {
|
|
352
|
+
order: 1;
|
|
353
|
+
}
|
|
354
|
+
.slick-dots {
|
|
355
|
+
position: static;
|
|
356
|
+
}
|
|
357
|
+
`,bottom:a.css`
|
|
358
|
+
.slick-dots {
|
|
359
|
+
position: static;
|
|
360
|
+
}
|
|
361
|
+
`,left:a.css`
|
|
362
|
+
.slick-dots {
|
|
363
|
+
position: absolute;
|
|
364
|
+
width: auto;
|
|
365
|
+
left: 0;
|
|
366
|
+
top: 0;
|
|
367
|
+
bottom: 0;
|
|
368
|
+
transform: translateX(-100%);
|
|
369
|
+
display: flex;
|
|
370
|
+
justify-content: center;
|
|
371
|
+
align-items: center;
|
|
372
|
+
.slick-dots-default {
|
|
373
|
+
flex-direction: column;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
`,right:a.css`
|
|
377
|
+
.slick-dots {
|
|
378
|
+
position: absolute;
|
|
379
|
+
width: auto;
|
|
380
|
+
right: 0;
|
|
381
|
+
top: 0;
|
|
382
|
+
bottom: 0;
|
|
383
|
+
transform: translateX(100%);
|
|
384
|
+
display: flex;
|
|
385
|
+
justify-content: center;
|
|
386
|
+
align-items: center;
|
|
387
|
+
.slick-dots-default {
|
|
388
|
+
flex-direction: column;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
`}[t.position??"bottom"],[t]);return n.jsxs(n.Fragment,{children:[n.jsx(dt,{useCSS:!0,useTransform:!0,arrows:!1,ref:p??w,infinite:!1,dots:!0,touchMove:!1,lazyLoad:"anticipated",className:a.cx(N,a.css`
|
|
392
|
+
.slick-track {
|
|
393
|
+
display: flex;
|
|
394
|
+
align-items: stretch;
|
|
395
|
+
}
|
|
396
|
+
.slick-slide {
|
|
397
|
+
display: flex;
|
|
398
|
+
align-self: stretch;
|
|
399
|
+
height: unset;
|
|
400
|
+
> div {
|
|
401
|
+
display: flex;
|
|
402
|
+
align-self: stretch;
|
|
403
|
+
width: 100%;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
`,c),customPaging:_=>{var k,S;return m?m(s[_],_):n.jsx("div",{onDragEnter:()=>{var K;(K=(p??w).current)==null||K.slickGoTo(_)},children:(S=(k=s[_])==null?void 0:k.data)==null?void 0:S.name})},appendDots:_=>J?J(_):t===!1?n.jsx("div",{}):n.jsx("div",{children:n.jsx("ul",{ref:y,className:a.cx("slick-dots-default",a.css`
|
|
407
|
+
padding: 0.5rem;
|
|
408
|
+
display: inline-flex;
|
|
409
|
+
justify-content: center;
|
|
410
|
+
align-items: center;
|
|
411
|
+
gap: 0.5rem;
|
|
412
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
413
|
+
border-radius: 0.5rem;
|
|
414
|
+
.slick-active {
|
|
415
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
416
|
+
color: white;
|
|
417
|
+
padding: 0.25rem;
|
|
418
|
+
border-radius: 0.25rem;
|
|
419
|
+
}
|
|
420
|
+
li {
|
|
421
|
+
margin: 0;
|
|
422
|
+
width: auto;
|
|
423
|
+
height: auto;
|
|
424
|
+
}
|
|
425
|
+
`),children:_})}),...i,children:s.map(_=>n.jsx("div",{onDrop:k=>{k.preventDefault();const S=k.dataTransfer.getData("text/plain");if(S!=="")try{E(JSON.parse(S),[_.id])}catch(K){console.log("drag error",K)}},onDragOver:k=>{k.preventDefault()},children:n.jsx(Ee.ReactSortable,{className:a.cx(a.css`
|
|
426
|
+
display: grid;
|
|
427
|
+
transition: all 0.3s;
|
|
428
|
+
grid-template-columns: repeat(auto-fill, 96px);
|
|
429
|
+
grid-auto-flow: dense;
|
|
430
|
+
grid-auto-rows: 96px;
|
|
431
|
+
place-items: center;
|
|
432
|
+
justify-content: center;
|
|
433
|
+
align-items: center;
|
|
434
|
+
`),animation:150,fallbackOnBody:!0,swapThreshold:.65,group:"nested",list:_.children??[],setList:k=>M(k,[_.id]),filter:".drag-disabled",onMove:k=>{v("onMove");const{dragged:S,related:K}=k,ue=S.dataset,Z=K.dataset;return x(null),!((Object.keys(Z).length===0||Z.parentIds)&&Number(ue.childrenLength)>0&&K.classList.contains("sortable-group-item"))},onStart:k=>{const S=k.item.dataset;S!=null&&S.id&&f(S.id),v("onMove")},onEnd:()=>{f(null),x(null),v(null)},ghostClass:Ze,children:(_.children??[]).map((k,S)=>{let K;if(b)return b(k);switch(k.type){case"group":case"app":K=n.jsx(Ct,{data:k,itemIndex:S,parentIds:[_.id,k.id],onClick:l},k.id);break;default:K=n.jsx(Me,{data:k,itemIndex:S,onClick:l},k.id);break}return K})})},_.id))}),n.jsx(St,{data:L,onClose:()=>{D(null)}}),n.jsx(wt,{data:X,onClose:()=>{V(null)},onItemClick:l})]})},It=h=>{const{list:t,onChange:c,storageKey:i,enableCaching:p,theme:l,noLetters:w,contextMenu:y,contextMenuBuilder:s,itemBuilder:M,itemIconBuilder:v,pagingDotBuilder:L,pagingDotsBuilder:D,...X}=h,V={list:t,onChange:c,storageKey:i,enableCaching:p},f={theme:l,noLetters:w,contextMenu:y,pagingDotsBuilder:D,pagingDotBuilder:L,itemBuilder:M,itemIconBuilder:v,contextMenuBuilder:s};return n.jsx(xt,{...V,children:n.jsx(ht,{...f,children:n.jsx(jt,{...X})})})},Tt={frontmatterEditor:{title:"编辑前置元数据",key:"键",value:"值",addEntry:"添加项目"},dialogControls:{save:"保存",cancel:"取消"},uploadImage:{uploadInstructions:"从您的设备中上传图片:",addViaUrlInstructions:"或从网址新增图片:",autoCompletePlaceholder:"选择或粘贴图片",alt:"替代文本:",title:"标题:"},imageEditor:{editImage:"编辑图片"},createLink:{url:"网址",urlPlaceholder:"选择或粘贴网址",title:"标题",saveTooltip:"设置网址",cancelTooltip:"取消更改"},linkPreview:{open:"在新窗口中打开 {{url}}",edit:"编辑链接网址",copyToClipboard:"复制到剪贴板",copied:"已复制!",remove:"移除链接"},table:{deleteTable:"删除表格",columnMenu:"列菜单",textAlignment:"文字对齐",alignLeft:"左对齐",alignCenter:"居中对齐",alignRight:"右对齐",insertColumnLeft:"在当前列左侧插入一列",insertColumnRight:"在当前列右侧插入一列",deleteColumn:"删除此列",rowMenu:"行菜单",insertRowAbove:"在当前行上方插入一行",insertRowBelow:"在当前行下方插入一行",deleteRow:"删除此行"},toolbar:{blockTypes:{paragraph:"段落",quote:"引用",heading:"标题 {{level}}"},blockTypeSelect:{selectBlockTypeTooltip:"选择块类型",placeholder:"块类型"},toggleGroup:"切换组",removeBold:"移除粗体",bold:"粗体",removeItalic:"移除斜体",italic:"斜体",underline:"移除下划线",removeUnderline:"下划线",removeInlineCode:"移除内联代码样式",inlineCode:"内联代码样式",link:"创建链接",richText:"富文本",diffMode:"差异模式",source:"源码模式",admonition:"插入注释区块",codeBlock:"插入代码块",editFrontmatter:"编辑前置元数据",insertFrontmatter:"插入前置元数据",image:"插入图片",insertSandpack:"插入 Sandpack",table:"插入表格",thematicBreak:"插入主题换行",bulletedList:"无序列表",numberedList:"有序列表",checkList:"任务列表",deleteSandpack:"删除 Sandpack",undo:"撤销 {{shortcut}}",redo:"重做 {{shortcut}}",superscript:"上标",subscript:"下标",strikethrough:"删除线",removeSubscript:"移除下标",removeSuperscript:"移除上标",removeStrikethrough:"移除删除线"},admonitions:{note:"注意",tip:"提示",danger:"危险",info:"信息",caution:"警告",changeType:"选择注释区块类型",placeholder:"注释区块类型"},codeBlock:{language:"代码块语言",selectLanguage:"选择代码块语言",inlineLanguage:"代码块语言"},codeblock:{delete:"删除代码块"},contentArea:{editableMarkdown:"可编辑的 Markdown"},image:{delete:"删除图片"}},Rt=(h,t,c)=>{const p=h.split(".").reduce((l,w)=>typeof l=="string"?l:l[w],Tt);return typeof p!="string"?t:c?p.replace(/{{(.*?)}}/g,(l,w)=>c[w]):p};function Et(h){const t=h==null?void 0:h.rootNode;return!t||t.getType()!=="directive"?!1:["note","tip","danger","info","caution"].includes(t.getMdastNode().name)}const _t=h=>{const{value:t,onChange:c,translation:i,pluginConfig:p,...l}=h,{image:w,diffSource:y={viewMode:"rich-text"},headings:s,link:M,codeBlock:v,codeMirror:L={codeBlockLanguages:{js:"JavaScript",css:"CSS",txt:"Plain Text",tsx:"TypeScript","":"Unspecified"}},directives:D={directiveDescriptors:[g.AdmonitionDirectiveDescriptor]}}=p??{},[X,V]=d.useState("");return d.useEffect(()=>{t!==void 0&&V(t)},[t]),n.jsx(g.MDXEditor,{contentEditableClassName:a.cx("markdown-body",a.css`
|
|
435
|
+
table {
|
|
436
|
+
border-spacing: 0;
|
|
437
|
+
border-collapse: collapse;
|
|
438
|
+
width: 100%;
|
|
439
|
+
display: table;
|
|
440
|
+
th[data-tool-cell],
|
|
441
|
+
td[data-tool-cell] {
|
|
442
|
+
padding: 0;
|
|
443
|
+
border: none;
|
|
444
|
+
}
|
|
445
|
+
tr {
|
|
446
|
+
border-top: 0;
|
|
447
|
+
}
|
|
448
|
+
thead {
|
|
449
|
+
th {
|
|
450
|
+
padding: 0;
|
|
451
|
+
border: none;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
tfoot {
|
|
455
|
+
th {
|
|
456
|
+
padding: 0;
|
|
457
|
+
border: none;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
[class*="_addRowButton"],
|
|
461
|
+
[class*="_addColumnButton"],
|
|
462
|
+
[class*="_tableColumnEditorTrigger"],
|
|
463
|
+
[class*="_iconButton"] {
|
|
464
|
+
cursor: pointer;
|
|
465
|
+
transition: all 0.3s;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
`),markdown:X,onChange:f=>{!t&&!c&&V(f),c&&c(f)},translation:i??Rt,plugins:[g.toolbarPlugin({toolbarContents:()=>n.jsxs(g.DiffSourceToggleWrapper,{options:["rich-text","source"],children:[n.jsx(g.UndoRedo,{}),n.jsx(g.Separator,{}),n.jsx(g.BoldItalicUnderlineToggles,{}),n.jsx(g.CodeToggle,{}),n.jsx(g.Separator,{}),n.jsx(g.StrikeThroughSupSubToggles,{}),n.jsx(g.Separator,{}),n.jsx(g.ListsToggle,{}),n.jsx(g.Separator,{}),n.jsx(g.CreateLink,{}),n.jsx(g.InsertImage,{}),n.jsx(g.Separator,{}),n.jsx(g.InsertTable,{}),n.jsx(g.InsertThematicBreak,{}),n.jsx(g.Separator,{}),n.jsx(g.InsertCodeBlock,{}),n.jsx(g.ConditionalContents,{options:[{when:f=>!Et(f),contents:()=>n.jsxs(n.Fragment,{children:[n.jsx(g.Separator,{}),n.jsx(g.InsertAdmonition,{})]})}]}),n.jsx(g.Separator,{}),n.jsx(g.InsertFrontmatter,{})]})}),g.diffSourcePlugin(y),g.listsPlugin(),g.quotePlugin(),g.headingsPlugin(s),g.linkPlugin(M),g.linkDialogPlugin(),g.imagePlugin(w),g.tablePlugin(),g.thematicBreakPlugin(),g.frontmatterPlugin(),g.codeBlockPlugin(v),g.codeMirrorPlugin(L),g.markdownShortcutPlugin(),g.directivesPlugin(D)],...l})};Y.Desktop=It,Y.MdEditor=_t,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
|