From be0a83dde158245c50df8c3706d0f266e23f63ea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 11 Feb 2024 14:46:57 +0000 Subject: [PATCH] deploy: 62b37ebbc2ba84df30c7ab1ae674e00f4e6d087a --- 404.html | 2 +- assets/js/15d99295.37a03c04.js | 1 + assets/js/15d99295.7e439574.js | 1 - .../js/{runtime~main.1aeef9c6.js => runtime~main.ffe63d5c.js} | 2 +- docs/getting-started/examples/index.html | 2 +- docs/getting-started/installation/index.html | 2 +- docs/guides/commands/index.html | 2 +- docs/guides/index.html | 2 +- docs/guides/registration/index.html | 2 +- docs/guides/types/index.html | 2 +- docs/index.html | 4 ++-- index.html | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 assets/js/15d99295.37a03c04.js delete mode 100644 assets/js/15d99295.7e439574.js rename assets/js/{runtime~main.1aeef9c6.js => runtime~main.ffe63d5c.js} (98%) diff --git a/404.html b/404.html index 6fedf23b..8dec78fa 100644 --- a/404.html +++ b/404.html @@ -4,7 +4,7 @@ Page Not Found | Commander - + diff --git a/assets/js/15d99295.37a03c04.js b/assets/js/15d99295.37a03c04.js new file mode 100644 index 00000000..1f252a27 --- /dev/null +++ b/assets/js/15d99295.37a03c04.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[848],{500:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=t(2488),a=t(7052),s=t(5360),o=t(5320);const i={description:"Learn the basics for Commander usage",slug:"/"},l="Getting Started",c={id:"getting-started/index",title:"Getting Started",description:"Learn the basics for Commander usage",source:"@site/docs/getting-started/index.mdx",sourceDirName:"getting-started",slug:"/",permalink:"/commander/docs/",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{description:"Learn the basics for Commander usage",slug:"/"},sidebar:"docsSidebar",next:{title:"Installation",permalink:"/commander/docs/getting-started/installation"}},d={},u=[{value:"Installation",id:"installation",level:2},{value:"Starting Commander",id:"starting-commander",level:2},{value:"Registration",id:"registration",level:2}];function m(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",strong:"strong",...(0,a.M)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"getting-started",children:"Getting Started"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Commander"})," is a flexible and extensible command framework for roblox-ts that makes defining commands easy\nand readable."]}),"\n",(0,r.jsx)(n.h2,{id:"installation",children:"Installation"}),"\n",(0,r.jsxs)(o.c,{children:[(0,r.jsx)(s.c,{value:"npm",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:'title="Terminal"',children:"npm install @rbxts/commander\n"})})}),(0,r.jsxs)(s.c,{value:"Yarn",children:[(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsxs)(n.p,{children:["Installing through ",(0,r.jsx)(n.code,{children:"yarn"})," may cause errors due to the way dependencies are installed."]}),(0,r.jsxs)(n.p,{children:["It is recommended to use ",(0,r.jsx)(n.code,{children:"npm"})," instead to avoid any issues."]})]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:'title="Terminal"',children:"yarn add @rbxts/commander\n"})})]}),(0,r.jsxs)(s.c,{value:"pnpm",children:[(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsxs)(n.p,{children:["Installing through ",(0,r.jsx)(n.code,{children:"pnpm"})," may cause errors due to the way dependencies are installed."]}),(0,r.jsxs)(n.p,{children:["It is recommended to use ",(0,r.jsx)(n.code,{children:"npm"})," instead to avoid any issues."]})]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:'title="Terminal"',children:"pnpm add @rbxts/commander\n"})})]})]}),"\n",(0,r.jsx)(n.h2,{id:"starting-commander",children:"Starting Commander"}),"\n",(0,r.jsxs)(n.p,{children:["Commander needs to be started ",(0,r.jsx)(n.strong,{children:"once"})," on the client and server."]}),"\n",(0,r.jsxs)(o.c,{children:[(0,r.jsxs)(s.c,{value:"client",label:"Client",default:!0,children:[(0,r.jsx)(n.admonition,{type:"warning",children:(0,r.jsxs)(n.p,{children:["When using React in development mode (",(0,r.jsx)(n.code,{children:"_G.__DEV__"})," set to true), you ",(0,r.jsx)(n.strong,{children:"must"})," set\n",(0,r.jsx)(n.code,{children:"_G.__DEV__"})," to true ",(0,r.jsx)(n.strong,{children:"before importing"})," Commander."]})}),(0,r.jsx)(n.p,{children:"To start Commander on the client, you'll need to provide some extra options if you want to use\nits user interface."}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"showLineNumbers",children:'CommanderClient.start(\n (registry) => {\n // Register commands or types here\n },\n {\n interface: CommanderInterface({\n // You can configure the interface here, such as changing activation keys\n })\n\n // The options below are optional\n\n // The maximum terminal and command history length, default length is 1000\n historyLength: 1000,\n\n // If you don\'t want to register built-in types, you can change this option\n // This is set to true by default\n registerBuiltInTypes: true,\n },\n).catch((err) => warn("Commander could not be started:", tostring(err)));\n'})})]}),(0,r.jsx)(s.c,{value:"server",label:"Server",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"showLineNumbers",children:'CommanderServer.start(\n (registry) => {\n // Register commands or types here\n },\n {\n // If you don\'t want to register built-in types, you can change this option\n // This is set to true by default.\n registerBuiltInTypes: true,\n },\n).catch((err) => warn("Commander could not be started:", tostring(err)));\n'})})})]}),"\n",(0,r.jsx)(n.h2,{id:"registration",children:"Registration"}),"\n",(0,r.jsx)(n.p,{children:"The way commands and types are registered is the same on the server and client."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"showLineNumbers",children:'CommanderServer.start((registry) => {\n // Register commands by loading all command ModuleScripts under an Instance\n // You can also use this for types: ModuleScripts that export a function\n // will be called with the registry object, allowing you to do any\n // registration there.\n const commandContainer = script.Parent.commands;\n registry.register(commandContainer);\n\n // If you\'ve already loaded the command ModuleScripts\n // (e.g. through Flamework.addPaths) you can register\n // them like this:\n registry.registerCommands();\n\n // Type objects are registered like this:\n registry.registerType(someType);\n registry.registerTypes(someOtherType, anotherType);\n}).catch((err) => warn("Commander could not be started:", tostring(err)));\n'})}),"\n",(0,r.jsxs)(n.p,{children:["See the ",(0,r.jsx)(n.a,{href:"/commander/docs/guides/registration",children:"Registration"})," guide for more details on how these methods work."]})]})}function h(e={}){const{wrapper:n}={...(0,a.M)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(m,{...e})}):m(e)}},5360:(e,n,t)=>{t.d(n,{c:()=>o});t(6651);var r=t(6548);const a={tabItem:"tabItem_VAqR"};var s=t(2488);function o(e){let{children:n,hidden:t,className:o}=e;return(0,s.jsx)("div",{role:"tabpanel",className:(0,r.c)(a.tabItem,o),hidden:t,children:n})}},5320:(e,n,t)=>{t.d(n,{c:()=>w});var r=t(6651),a=t(6548),s=t(2440),o=t(4760),i=t(1440),l=t(3540),c=t(6904),d=t(6008);function u(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function m(e){const{values:n,children:t}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}(t);return function(e){const n=(0,c.w)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function h(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function g(e){let{queryString:n=!1,groupId:t}=e;const a=(0,o.Uz)(),s=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l._M)(s),(0,r.useCallback)((e=>{if(!s)return;const n=new URLSearchParams(a.location.search);n.set(s,e),a.replace({...a.location,search:n.toString()})}),[s,a])]}function p(e){const{defaultValue:n,queryString:t=!1,groupId:a}=e,s=m(e),[o,l]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!h({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:s}))),[c,u]=g({queryString:t,groupId:a}),[p,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[a,s]=(0,d.IN)(t);return[a,(0,r.useCallback)((e=>{t&&s.set(e)}),[t,s])]}({groupId:a}),b=(()=>{const e=c??p;return h({value:e,tabValues:s})?e:null})();(0,i.c)((()=>{b&&l(b)}),[b]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!h({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),f(e)}),[u,f,s]),tabValues:s}}var f=t(5168);const b={tabList:"tabList_zsOt",tabItem:"tabItem_wrWy"};var x=t(2488);function y(e){let{className:n,block:t,selectedValue:r,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,s.MV)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),a=i[t].value;a!==r&&(c(n),o(a))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,x.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,a.c)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:s}=e;return(0,x.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>l.push(e),onKeyDown:u,onClick:d,...s,className:(0,a.c)("tabs__item",b.tabItem,s?.className,{"tabs__item--active":r===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const s=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=s.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return(0,x.jsx)("div",{className:"margin-top--md",children:s.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function j(e){const n=p(e);return(0,x.jsxs)("div",{className:(0,a.c)("tabs-container",b.tabList),children:[(0,x.jsx)(y,{...e,...n}),(0,x.jsx)(v,{...e,...n})]})}function w(e){const n=(0,f.c)();return(0,x.jsx)(j,{...e,children:u(e.children)},String(n))}},7052:(e,n,t)=>{t.d(n,{I:()=>i,M:()=>o});var r=t(6651);const a={},s=r.createContext(a);function o(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/15d99295.7e439574.js b/assets/js/15d99295.7e439574.js deleted file mode 100644 index 3270fd4f..00000000 --- a/assets/js/15d99295.7e439574.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[848],{500:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=t(2488),a=t(7052),s=t(5360),o=t(5320);const i={description:"Learn the basics for Commander usage",slug:"/"},l="Getting Started",c={id:"getting-started/index",title:"Getting Started",description:"Learn the basics for Commander usage",source:"@site/docs/getting-started/index.mdx",sourceDirName:"getting-started",slug:"/",permalink:"/commander/docs/",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{description:"Learn the basics for Commander usage",slug:"/"},sidebar:"docsSidebar",next:{title:"Installation",permalink:"/commander/docs/getting-started/installation"}},d={},u=[{value:"Installation",id:"installation",level:2},{value:"Starting Commander",id:"starting-commander",level:2},{value:"Registration",id:"registration",level:2}];function m(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",strong:"strong",...(0,a.M)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"getting-started",children:"Getting Started"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Commander"})," is a flexible and extensible command framework for roblox-ts that makes defining commands easy\nand readable."]}),"\n",(0,r.jsx)(n.h2,{id:"installation",children:"Installation"}),"\n",(0,r.jsxs)(o.c,{children:[(0,r.jsx)(s.c,{value:"npm",default:!0,children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:'title="Terminal"',children:"npm install @rbxts/commander\n"})})}),(0,r.jsxs)(s.c,{value:"Yarn",children:[(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsxs)(n.p,{children:["Installing through ",(0,r.jsx)(n.code,{children:"yarn"})," may cause errors due to the way dependencies are installed."]}),(0,r.jsxs)(n.p,{children:["It is recommended to use ",(0,r.jsx)(n.code,{children:"npm"})," instead to avoid any issues."]})]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:'title="Terminal"',children:"yarn add @rbxts/commander\n"})})]}),(0,r.jsxs)(s.c,{value:"pnpm",children:[(0,r.jsxs)(n.admonition,{type:"warning",children:[(0,r.jsxs)(n.p,{children:["Installing through ",(0,r.jsx)(n.code,{children:"pnpm"})," may cause errors due to the way dependencies are installed."]}),(0,r.jsxs)(n.p,{children:["It is recommended to use ",(0,r.jsx)(n.code,{children:"npm"})," instead to avoid any issues."]})]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:'title="Terminal"',children:"pnpm add @rbxts/commander\n"})})]})]}),"\n",(0,r.jsx)(n.h2,{id:"starting-commander",children:"Starting Commander"}),"\n",(0,r.jsxs)(n.p,{children:["Commander needs to be started ",(0,r.jsx)(n.strong,{children:"once"})," on the client and server."]}),"\n",(0,r.jsxs)(o.c,{children:[(0,r.jsxs)(s.c,{value:"client",label:"Client",default:!0,children:[(0,r.jsx)(n.admonition,{type:"warning",children:(0,r.jsxs)(n.p,{children:["When using React in development mode (",(0,r.jsx)(n.code,{children:"_G.__DEV__"})," set to true), you ",(0,r.jsx)(n.strong,{children:"must"})," set\n",(0,r.jsx)(n.code,{children:"_G.__DEV__"})," to true ",(0,r.jsx)(n.strong,{children:"before importing"})," Commander."]})}),(0,r.jsx)(n.p,{children:"To start Commander on the client, you'll need to provide some extra options if you want to use\nits user interface."}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"showLineNumbers",children:'CommanderClient.start(\n (registry) => {\n // Register commands or types here\n },\n {\n // The interface that will be used to interact with Commander\n // Commander comes with a default interface, but you can create your own\n interface: CommanderInterface(),\n\n // You can also customize the interface by providing options\n interface: CommanderInterface({\n position: new UDim2(),\n size: new UDim2(),\n ...\n })\n\n // The options below are optional\n\n // The default key is F2, but you can change it here\n activationKeys: [Enum.KeyCode.F2],\n\n // The maximum terminal and command history length, default length is 1000\n historyLength: 1000,\n\n // If you don\'t want to register built-in types, you can change this option\n // This is set to true by default\n registerBuiltInTypes: true,\n },\n).catch((err) => warn("Commander could not be started:", tostring(err)));\n'})})]}),(0,r.jsx)(s.c,{value:"server",label:"Server",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"showLineNumbers",children:'CommanderServer.start(\n (registry) => {\n // Register commands or types here\n },\n {\n // If you don\'t want to register built-in types, you can change this option\n // This is set to true by default.\n registerBuiltInTypes: true,\n },\n).catch((err) => warn("Commander could not be started:", tostring(err)));\n'})})})]}),"\n",(0,r.jsx)(n.h2,{id:"registration",children:"Registration"}),"\n",(0,r.jsx)(n.p,{children:"The way commands and types are registered is the same on the server and client."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:"showLineNumbers",children:'CommanderServer.start((registry) => {\n // Register commands by loading all command ModuleScripts under an Instance\n // You can also use this for types: ModuleScripts that export a function\n // will be called with the registry object, allowing you to do any\n // registration there.\n const commandContainer = script.Parent.commands;\n registry.register(commandContainer);\n\n // If you\'ve already loaded the command ModuleScripts\n // (e.g. through Flamework.addPaths) you can register\n // them like this:\n registry.registerCommands();\n\n // Type objects are registered like this:\n registry.registerType(someType);\n registry.registerTypes(someOtherType, anotherType);\n}).catch((err) => warn("Commander could not be started:", tostring(err)));\n'})}),"\n",(0,r.jsxs)(n.p,{children:["See the ",(0,r.jsx)(n.a,{href:"/commander/docs/guides/registration",children:"Registration"})," guide for more details on how these methods work."]})]})}function h(e={}){const{wrapper:n}={...(0,a.M)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(m,{...e})}):m(e)}},5360:(e,n,t)=>{t.d(n,{c:()=>o});t(6651);var r=t(6548);const a={tabItem:"tabItem_VAqR"};var s=t(2488);function o(e){let{children:n,hidden:t,className:o}=e;return(0,s.jsx)("div",{role:"tabpanel",className:(0,r.c)(a.tabItem,o),hidden:t,children:n})}},5320:(e,n,t)=>{t.d(n,{c:()=>w});var r=t(6651),a=t(6548),s=t(2440),o=t(4760),i=t(1440),l=t(3540),c=t(6904),d=t(6008);function u(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function m(e){const{values:n,children:t}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return u(e).map((e=>{let{props:{value:n,label:t,attributes:r,default:a}}=e;return{value:n,label:t,attributes:r,default:a}}))}(t);return function(e){const n=(0,c.w)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[n,t])}function h(e){let{value:n,tabValues:t}=e;return t.some((e=>e.value===n))}function g(e){let{queryString:n=!1,groupId:t}=e;const a=(0,o.Uz)(),s=function(e){let{queryString:n=!1,groupId:t}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:n,groupId:t});return[(0,l._M)(s),(0,r.useCallback)((e=>{if(!s)return;const n=new URLSearchParams(a.location.search);n.set(s,e),a.replace({...a.location,search:n.toString()})}),[s,a])]}function p(e){const{defaultValue:n,queryString:t=!1,groupId:a}=e,s=m(e),[o,l]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!h({value:n,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=t.find((e=>e.default))??t[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:s}))),[c,u]=g({queryString:t,groupId:a}),[p,f]=function(e){let{groupId:n}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(n),[a,s]=(0,d.IN)(t);return[a,(0,r.useCallback)((e=>{t&&s.set(e)}),[t,s])]}({groupId:a}),b=(()=>{const e=c??p;return h({value:e,tabValues:s})?e:null})();(0,i.c)((()=>{b&&l(b)}),[b]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!h({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),f(e)}),[u,f,s]),tabValues:s}}var f=t(5168);const b={tabList:"tabList_zsOt",tabItem:"tabItem_wrWy"};var y=t(2488);function x(e){let{className:n,block:t,selectedValue:r,selectValue:o,tabValues:i}=e;const l=[],{blockElementScrollPositionUntilNextRender:c}=(0,s.MV)(),d=e=>{const n=e.currentTarget,t=l.indexOf(n),a=i[t].value;a!==r&&(c(n),o(a))},u=e=>{let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=l.indexOf(e.currentTarget)+1;n=l[t]??l[0];break}case"ArrowLeft":{const t=l.indexOf(e.currentTarget)-1;n=l[t]??l[l.length-1];break}}n?.focus()};return(0,y.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,a.c)("tabs",{"tabs--block":t},n),children:i.map((e=>{let{value:n,label:t,attributes:s}=e;return(0,y.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>l.push(e),onKeyDown:u,onClick:d,...s,className:(0,a.c)("tabs__item",b.tabItem,s?.className,{"tabs__item--active":r===n}),children:t??n},n)}))})}function v(e){let{lazy:n,children:t,selectedValue:a}=e;const s=(Array.isArray(t)?t:[t]).filter(Boolean);if(n){const e=s.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return(0,y.jsx)("div",{className:"margin-top--md",children:s.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==a})))})}function j(e){const n=p(e);return(0,y.jsxs)("div",{className:(0,a.c)("tabs-container",b.tabList),children:[(0,y.jsx)(x,{...e,...n}),(0,y.jsx)(v,{...e,...n})]})}function w(e){const n=(0,f.c)();return(0,y.jsx)(j,{...e,children:u(e.children)},String(n))}},7052:(e,n,t)=>{t.d(n,{I:()=>i,M:()=>o});var r=t(6651);const a={},s=r.createContext(a);function o(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.1aeef9c6.js b/assets/js/runtime~main.ffe63d5c.js similarity index 98% rename from assets/js/runtime~main.1aeef9c6.js rename to assets/js/runtime~main.ffe63d5c.js index 18446275..3f9b0d06 100644 --- a/assets/js/runtime~main.1aeef9c6.js +++ b/assets/js/runtime~main.ffe63d5c.js @@ -1 +1 @@ -(()=>{"use strict";var e,t,r,a,o,n={},f={};function d(e){var t=f[e];if(void 0!==t)return t.exports;var r=f[e]={id:e,loaded:!1,exports:{}};return n[e].call(r.exports,r,r.exports,d),r.loaded=!0,r.exports}d.m=n,d.c=f,e=[],d.O=(t,r,a,o)=>{if(!r){var n=1/0;for(u=0;u=o)&&Object.keys(d.O).every((e=>d.O[e](r[i])))?r.splice(i--,1):(f=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[r,a,o]},d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(e,a){if(1&a&&(e=this(e)),8&a)return e;if("object"==typeof e&&e){if(4&a&&e.__esModule)return e;if(16&a&&"function"==typeof e.then)return e}var o=Object.create(null);d.r(o);var n={};t=t||[null,r({}),r([]),r(r)];for(var f=2&a&&e;"object"==typeof f&&!~t.indexOf(f);f=r(f))Object.getOwnPropertyNames(f).forEach((t=>n[t]=()=>e[t]));return n.default=()=>e,d.d(o,n),o},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce(((t,r)=>(d.f[r](e,t),t)),[])),d.u=e=>"assets/js/"+({280:"6459b84b",304:"5e95c892",392:"efdcbdaa",400:"0042d53a",428:"f03df807",467:"bbaff741",500:"a7bd4aaa",544:"10589cea",552:"1df93b7f",666:"a94703ab",696:"935f2afb",752:"17896441",804:"a6e64c5a",812:"457515c8",848:"15d99295"}[e]||e)+"."+{32:"6a0c3c7f",280:"832ed3b9",304:"41f645b1",392:"0111216b",400:"82f479fd",428:"d4ce9e2c",467:"c2369502",500:"7792b917",544:"f4b1b1d6",552:"7bfcd251",666:"e3e2e656",696:"b918ad29",752:"4237ca6b",804:"2112a8d2",812:"6cc557a9",848:"7e439574"}[e]+".js",d.miniCssF=e=>{},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a={},o="docs:",d.l=(e,t,r,n)=>{if(a[e])a[e].push(t);else{var f,i;if(void 0!==r)for(var c=document.getElementsByTagName("script"),u=0;u{f.onerror=f.onload=null,clearTimeout(s);var o=a[e];if(delete a[e],f.parentNode&&f.parentNode.removeChild(f),o&&o.forEach((e=>e(r))),t)return t(r)},s=setTimeout(b.bind(null,void 0,{type:"timeout",target:f}),12e4);f.onerror=b.bind(null,f.onerror),f.onload=b.bind(null,f.onload),i&&document.head.appendChild(f)}},d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.p="/commander/",d.gca=function(e){return e={17896441:"752","6459b84b":"280","5e95c892":"304",efdcbdaa:"392","0042d53a":"400",f03df807:"428",bbaff741:"467",a7bd4aaa:"500","10589cea":"544","1df93b7f":"552",a94703ab:"666","935f2afb":"696",a6e64c5a:"804","457515c8":"812","15d99295":"848"}[e]||e,d.p+d.u(e)},(()=>{var e={296:0,176:0};d.f.j=(t,r)=>{var a=d.o(e,t)?e[t]:void 0;if(0!==a)if(a)r.push(a[2]);else if(/^(17|29)6$/.test(t))e[t]=0;else{var o=new Promise(((r,o)=>a=e[t]=[r,o]));r.push(a[2]=o);var n=d.p+d.u(t),f=new Error;d.l(n,(r=>{if(d.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var o=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;f.message="Loading chunk "+t+" failed.\n("+o+": "+n+")",f.name="ChunkLoadError",f.type=o,f.request=n,a[1](f)}}),"chunk-"+t,t)}},d.O.j=t=>0===e[t];var t=(t,r)=>{var a,o,n=r[0],f=r[1],i=r[2],c=0;if(n.some((t=>0!==e[t]))){for(a in f)d.o(f,a)&&(d.m[a]=f[a]);if(i)var u=i(d)}for(t&&t(r);c{"use strict";var e,t,r,a,o,n={},f={};function d(e){var t=f[e];if(void 0!==t)return t.exports;var r=f[e]={id:e,loaded:!1,exports:{}};return n[e].call(r.exports,r,r.exports,d),r.loaded=!0,r.exports}d.m=n,d.c=f,e=[],d.O=(t,r,a,o)=>{if(!r){var n=1/0;for(u=0;u=o)&&Object.keys(d.O).every((e=>d.O[e](r[i])))?r.splice(i--,1):(f=!1,o0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[r,a,o]},d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(e,a){if(1&a&&(e=this(e)),8&a)return e;if("object"==typeof e&&e){if(4&a&&e.__esModule)return e;if(16&a&&"function"==typeof e.then)return e}var o=Object.create(null);d.r(o);var n={};t=t||[null,r({}),r([]),r(r)];for(var f=2&a&&e;"object"==typeof f&&!~t.indexOf(f);f=r(f))Object.getOwnPropertyNames(f).forEach((t=>n[t]=()=>e[t]));return n.default=()=>e,d.d(o,n),o},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce(((t,r)=>(d.f[r](e,t),t)),[])),d.u=e=>"assets/js/"+({280:"6459b84b",304:"5e95c892",392:"efdcbdaa",400:"0042d53a",428:"f03df807",467:"bbaff741",500:"a7bd4aaa",544:"10589cea",552:"1df93b7f",666:"a94703ab",696:"935f2afb",752:"17896441",804:"a6e64c5a",812:"457515c8",848:"15d99295"}[e]||e)+"."+{32:"6a0c3c7f",280:"832ed3b9",304:"41f645b1",392:"0111216b",400:"82f479fd",428:"d4ce9e2c",467:"c2369502",500:"7792b917",544:"f4b1b1d6",552:"7bfcd251",666:"e3e2e656",696:"b918ad29",752:"4237ca6b",804:"2112a8d2",812:"6cc557a9",848:"37a03c04"}[e]+".js",d.miniCssF=e=>{},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a={},o="docs:",d.l=(e,t,r,n)=>{if(a[e])a[e].push(t);else{var f,i;if(void 0!==r)for(var c=document.getElementsByTagName("script"),u=0;u{f.onerror=f.onload=null,clearTimeout(s);var o=a[e];if(delete a[e],f.parentNode&&f.parentNode.removeChild(f),o&&o.forEach((e=>e(r))),t)return t(r)},s=setTimeout(b.bind(null,void 0,{type:"timeout",target:f}),12e4);f.onerror=b.bind(null,f.onerror),f.onload=b.bind(null,f.onload),i&&document.head.appendChild(f)}},d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.p="/commander/",d.gca=function(e){return e={17896441:"752","6459b84b":"280","5e95c892":"304",efdcbdaa:"392","0042d53a":"400",f03df807:"428",bbaff741:"467",a7bd4aaa:"500","10589cea":"544","1df93b7f":"552",a94703ab:"666","935f2afb":"696",a6e64c5a:"804","457515c8":"812","15d99295":"848"}[e]||e,d.p+d.u(e)},(()=>{var e={296:0,176:0};d.f.j=(t,r)=>{var a=d.o(e,t)?e[t]:void 0;if(0!==a)if(a)r.push(a[2]);else if(/^(17|29)6$/.test(t))e[t]=0;else{var o=new Promise(((r,o)=>a=e[t]=[r,o]));r.push(a[2]=o);var n=d.p+d.u(t),f=new Error;d.l(n,(r=>{if(d.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var o=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;f.message="Loading chunk "+t+" failed.\n("+o+": "+n+")",f.name="ChunkLoadError",f.type=o,f.request=n,a[1](f)}}),"chunk-"+t,t)}},d.O.j=t=>0===e[t];var t=(t,r)=>{var a,o,n=r[0],f=r[1],i=r[2],c=0;if(n.some((t=>0!==e[t]))){for(a in f)d.o(f,a)&&(d.m[a]=f[a]);if(i)var u=i(d)}for(t&&t(r);c Examples | Commander - + diff --git a/docs/getting-started/installation/index.html b/docs/getting-started/installation/index.html index 0b571a8e..bdbbee99 100644 --- a/docs/getting-started/installation/index.html +++ b/docs/getting-started/installation/index.html @@ -4,7 +4,7 @@ Installation | Commander - + diff --git a/docs/guides/commands/index.html b/docs/guides/commands/index.html index f4fcbf9d..34ddb0d5 100644 --- a/docs/guides/commands/index.html +++ b/docs/guides/commands/index.html @@ -4,7 +4,7 @@ Commands | Commander - + diff --git a/docs/guides/index.html b/docs/guides/index.html index b5a3139f..790eec7d 100644 --- a/docs/guides/index.html +++ b/docs/guides/index.html @@ -4,7 +4,7 @@ Guides | Commander - + diff --git a/docs/guides/registration/index.html b/docs/guides/registration/index.html index a1d28d91..34d89d51 100644 --- a/docs/guides/registration/index.html +++ b/docs/guides/registration/index.html @@ -4,7 +4,7 @@ Registration | Commander - + diff --git a/docs/guides/types/index.html b/docs/guides/types/index.html index 51cb4870..46a56aba 100644 --- a/docs/guides/types/index.html +++ b/docs/guides/types/index.html @@ -4,7 +4,7 @@ Types | Commander - + diff --git a/docs/index.html b/docs/index.html index 6672a82a..2b247009 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ Getting Started | Commander - + @@ -17,7 +17,7 @@

Starting

Commander needs to be started once on the client and server.

warning

When using React in development mode (_G.__DEV__ set to true), you must set _G.__DEV__ to true before importing Commander.

To start Commander on the client, you'll need to provide some extra options if you want to use -its user interface.

CommanderClient.start(
(registry) => {
// Register commands or types here
},
{
// The interface that will be used to interact with Commander
// Commander comes with a default interface, but you can create your own
interface: CommanderInterface(),

// You can also customize the interface by providing options
interface: CommanderInterface({
position: new UDim2(),
size: new UDim2(),
...
})

// The options below are optional

// The default key is F2, but you can change it here
activationKeys: [Enum.KeyCode.F2],

// The maximum terminal and command history length, default length is 1000
historyLength: 1000,

// If you don't want to register built-in types, you can change this option
// This is set to true by default
registerBuiltInTypes: true,
},
).catch((err) => warn("Commander could not be started:", tostring(err)));
+its user interface.

CommanderClient.start(
(registry) => {
// Register commands or types here
},
{
interface: CommanderInterface({
// You can configure the interface here, such as changing activation keys
})

// The options below are optional

// The maximum terminal and command history length, default length is 1000
historyLength: 1000,

// If you don't want to register built-in types, you can change this option
// This is set to true by default
registerBuiltInTypes: true,
},
).catch((err) => warn("Commander could not be started:", tostring(err)));

Registration

The way commands and types are registered is the same on the server and client.

CommanderServer.start((registry) => {
// Register commands by loading all command ModuleScripts under an Instance
// You can also use this for types: ModuleScripts that export a function
// will be called with the registry object, allowing you to do any
// registration there.
const commandContainer = script.Parent.commands;
registry.register(commandContainer);

// If you've already loaded the command ModuleScripts
// (e.g. through Flamework.addPaths) you can register
// them like this:
registry.registerCommands();

// Type objects are registered like this:
registry.registerType(someType);
registry.registerTypes(someOtherType, anotherType);
}).catch((err) => warn("Commander could not be started:", tostring(err)));
diff --git a/index.html b/index.html index d9ecb8e6..306d3caa 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Commander Documentation | Commander - +