knight-web 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Knight={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,a={exports:{}},o={};var i,s={exports:{}};
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).index={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,a={exports:{}},o={};var i,s={exports:{}};
2
2
  /**
3
3
  * @license React
4
4
  * react.development.js
@@ -81,4 +81,4 @@ function Cf(){return Cf=Object.assign?Object.assign.bind():function(e){for(var t
81
81
  *
82
82
  * @license MIT
83
83
  */function ad(){return ad=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ad.apply(this,arguments)}function od(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}f.startTransition,new Promise((()=>{}));const id="get",sd="application/x-www-form-urlencoded";function ld(e){return null!=e&&"string"==typeof e.tagName}let cd=null;const ud=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function fd(e){return null==e||ud.has(e)?e:("production"!==process.env.NODE_ENV&&Ju(!1,'"'+e+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` and will default to "'+sd+'"'),null)}function dd(e,t){let n,r,a,o,i;if(ld(s=e)&&"form"===s.tagName.toLowerCase()){let i=e.getAttribute("action");r=i?bf(i,t):null,n=e.getAttribute("method")||id,a=fd(e.getAttribute("enctype"))||sd,o=new FormData(e)}else if(function(e){return ld(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return ld(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||i.getAttribute("action");if(r=s?bf(s,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||id,a=fd(e.getAttribute("formenctype"))||fd(i.getAttribute("enctype"))||sd,o=new FormData(i,e),!function(){if(null===cd)try{new FormData(document.createElement("form"),0),cd=!1}catch(e){cd=!0}return cd}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?t+".":"";o.append(e+"x","0"),o.append(e+"y","0")}else t&&o.append(t,r)}}else{if(ld(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=id,r=null,a=sd,i=e}var s;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}const hd=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],pd=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],md=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"];try{window.__reactRouterVersion="6"}catch(e){}const gd=c.createContext({isTransitioning:!1});"production"!==process.env.NODE_ENV&&(gd.displayName="ViewTransition");const vd=c.createContext(new Map);"production"!==process.env.NODE_ENV&&(vd.displayName="Fetchers");const yd=f.startTransition;x.flushSync;function bd(e){let{basename:t,children:n,future:r,window:a}=e,o=c.useRef();null==o.current&&(o.current=qu({window:a,v5Compat:!0}));let i=o.current,[s,l]=c.useState({action:i.action,location:i.location}),{v7_startTransition:u}=r||{},f=c.useCallback((e=>{u&&yd?yd((()=>l(e))):l(e)}),[l,u]);return c.useLayoutEffect((()=>i.listen(f)),[i,f]),c.useEffect((()=>{return null!=(e=r)&&e.v7_startTransition||Zf("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),null!=e&&e.v7_relativeSplatPath||t&&t.v7_relativeSplatPath||Zf("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),void(t&&(t.v7_fetcherPersist||Zf("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),t.v7_normalizeFormMethod||Zf("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),t.v7_partialHydration||Zf("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),t.v7_skipActionErrorRevalidation||Zf("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation")));var e,t}),[r]),c.createElement(td,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:i,future:r})}f.useId,process.env.NODE_ENV;const wd="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Ed=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,kd=c.forwardRef((function(e,t){let n,{onClick:r,relative:a,reloadDocument:o,replace:i,state:s,target:l,to:u,preventScrollReset:f,viewTransition:d}=e,h=od(e,hd),{basename:p}=c.useContext(Of),m=!1;if("string"==typeof u&&Ed.test(u)&&(n=u,wd))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),n=bf(t.pathname,p);t.origin===e.origin&&null!=n?u=n+t.search+t.hash:m=!0}catch(e){"production"!==process.env.NODE_ENV&&Ju(!1,'<Link to="'+u+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let g=function(e,t){let{relative:n}=void 0===t?{}:t;Lf()||("production"!==process.env.NODE_ENV?Qu(!1,"useHref() may be used only in the context of a <Router> component."):Qu(!1));let{basename:r,navigator:a}=c.useContext(Of),{hash:o,pathname:i,search:s}=Bf(e,{relative:n}),l=i;return"/"!==r&&(l="/"===i?r:Tf([r,i])),a.createHref({pathname:l,search:s,hash:o})}(u,{relative:a}),v=function(e,t){let{target:n,replace:r,state:a,preventScrollReset:o,relative:i,viewTransition:s}=void 0===t?{}:t,l=Uf(),u=Mf(),f=Bf(e,{relative:i});return c.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==r?r:tf(u)===tf(f);l(e,{replace:n,state:a,preventScrollReset:o,relative:i,viewTransition:s})}}),[u,l,f,r,a,n,e,o,i,s])}(u,{replace:i,state:s,target:l,preventScrollReset:f,relative:a,viewTransition:d});return c.createElement("a",ad({},h,{href:n||g,onClick:m||o?r:function(e){r&&r(e),e.defaultPrevented||v(e)},ref:t,target:l}))}));"production"!==process.env.NODE_ENV&&(kd.displayName="Link");const Td=c.forwardRef((function(e,t){let{"aria-current":n="page",caseSensitive:r=!1,className:a="",end:o=!1,style:i,to:s,viewTransition:l,children:u}=e,f=od(e,pd),d=Bf(s,{relative:f.relative}),h=Mf(),p=c.useContext(Af),{navigator:m,basename:g}=c.useContext(Of),v=null!=p&&function(e,t){void 0===t&&(t={});let n=c.useContext(gd);null==n&&("production"!==process.env.NODE_ENV?Qu(!1,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):Qu(!1));let{basename:r}=Cd(_d.useViewTransitionState),a=Bf(e,{relative:t.relative});if(!n.isTransitioning)return!1;let o=bf(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=bf(n.nextLocation.pathname,r)||n.nextLocation.pathname;return null!=vf(a.pathname,i)||null!=vf(a.pathname,o)}(d)&&!0===l,y=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,b=h.pathname,w=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;r||(b=b.toLowerCase(),w=w?w.toLowerCase():null,y=y.toLowerCase()),w&&g&&(w=bf(w,g)||w);const E="/"!==y&&y.endsWith("/")?y.length-1:y.length;let k,T=b===y||!o&&b.startsWith(y)&&"/"===b.charAt(E),S=null!=w&&(w===y||!o&&w.startsWith(y)&&"/"===w.charAt(y.length)),_={isActive:T,isPending:S,isTransitioning:v},x=T?n:void 0;k="function"==typeof a?a(_):[a,T?"active":null,S?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let C="function"==typeof i?i(_):i;return c.createElement(kd,ad({},f,{"aria-current":x,className:k,ref:t,style:C,to:s,viewTransition:l}),"function"==typeof u?u(_):u)}));"production"!==process.env.NODE_ENV&&(Td.displayName="NavLink");const Sd=c.forwardRef(((e,t)=>{let{fetcherKey:n,navigate:r,reloadDocument:a,replace:o,state:i,method:s=id,action:l,onSubmit:u,relative:f,preventScrollReset:d,viewTransition:h}=e,p=od(e,md),m=function(){let{router:e}=Cd(_d.UseSubmit),{basename:t}=c.useContext(Of),n=Xf(Yf.UseRouteId);return c.useCallback((function(r,a){void 0===a&&(a={}),function(){if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}();let{action:o,method:i,encType:s,formData:l,body:c}=dd(r,t);if(!1===a.navigate){let t=a.fetcherKey||Ad();e.fetch(t,n,a.action||o,{preventScrollReset:a.preventScrollReset,formData:l,body:c,formMethod:a.method||i,formEncType:a.encType||s,flushSync:a.flushSync})}else e.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:l,body:c,formMethod:a.method||i,formEncType:a.encType||s,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})}),[e,t,n])}(),g=function(e,t){let{relative:n}=void 0===t?{}:t,{basename:r}=c.useContext(Of),a=c.useContext(Df);a||("production"!==process.env.NODE_ENV?Qu(!1,"useFormAction must be used inside a RouteContext"):Qu(!1));let[o]=a.matches.slice(-1),i=ad({},Bf(e||".",{relative:n})),s=Mf();if(null==e){i.search=s.search;let e=new URLSearchParams(i.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();i.search=n?"?"+n:""}}e&&"."!==e||!o.route.index||(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index");"/"!==r&&(i.pathname="/"===i.pathname?r:Tf([r,i.pathname]));return tf(i)}(l,{relative:f}),v="get"===s.toLowerCase()?"get":"post";return c.createElement("form",ad({ref:t,method:v,action:g,onSubmit:a?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,a=(null==t?void 0:t.getAttribute("formmethod"))||s;m(t||e.currentTarget,{fetcherKey:n,method:a,navigate:r,replace:o,state:i,relative:f,preventScrollReset:d,viewTransition:h})}},p))}));var _d,xd;function Cd(e){let t=c.useContext(Rf);return t||("production"!==process.env.NODE_ENV?Qu(!1,function(e){return e+" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router."}(e)):Qu(!1)),t}"production"!==process.env.NODE_ENV&&(Sd.displayName="Form"),process.env.NODE_ENV,function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"}(_d||(_d={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(xd||(xd={}));let Rd=0,Ad=()=>"__"+String(++Rd)+"__";class Pd{static OnRegist(e){return function(t){null!=t&&null!=e&&Pd.navgations.push(Object.assign(Object.assign({},e),{type:t}))}}static OnRender(){const e=[];for(const t of this.navgations)if(null==t.path||""==t.path||"*"==t.path||"/"==t.path){const n=u.createElement(ed,{path:"*",element:u.createElement(t.type)});e.push(n)}else{const n=u.createElement(ed,{path:t.path,element:u.createElement(t.type)});e.push(n)}const t=u.createElement(nd,{},...e);return u.createElement(bd,{},t)}}Pd.navgations=new Array;var Od=Object.freeze({__proto__:null,Knight:Yu,Navgation:Pd});class Nd extends u.Component{get knight(){return Yu.Instance}constructor(e){super(e),this.id=mt.UUID.NewUUID(),this.state=Object.assign({key:this.id},this.props),this.knight.Objects.Add(this.id,this)}componentDidMount(){this.OnLoad()}componentDidUpdate(e,t,n){this.OnUpdate(e,t)}shouldComponentUpdate(e,t,n){return!0}componentWillUnmount(){this.knight.Objects.Remove(this.id),this.OnDestroy()}componentDidCatch(e,t){return!0}render(){return this.OnRender()}}var Dd=Object.freeze({__proto__:null,AbstractObject:Nd,AbstractObjectProps:class{},AbstractPanel:class extends Nd{}});e.Base=Dd,e.Core=Od,e.Utility=$u,Object.defineProperty(e,"__esModule",{value:!0})}));
84
- //# sourceMappingURL=knight-web.js.map
84
+ //# sourceMappingURL=index.js.map