You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Vestride_Shuffle/assets/js/5fbc5cf1.058121d7.js

1 line
7.3 KiB
JavaScript

"use strict";(globalThis.webpackChunkshuffle_docs=globalThis.webpackChunkshuffle_docs||[]).push([[207],{876:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(2784);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,o,a=function(e,t){if(null==e)return{};var n,o,a={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=o.createContext({}),d=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=d(e.components);return o.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},c=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=d(n),m=a,f=c["".concat(s,".").concat(m)]||c[m]||u[m]||r;return n?o.createElement(f,i(i({ref:t},p),{},{components:n})):o.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,i=new Array(r);i[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d<r;d++)i[d]=n[d];return o.createElement.apply(null,i)}return o.createElement.apply(null,n)}c.displayName="MDXCreateElement"},1643:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>d});var o=n(8427),a=(n(2784),n(876));const r={sidebar_position:10},i="API",l={unversionedId:"api",id:"api",title:"API",description:"A list of the methods available to you and what they do.",source:"@site/docs/api.md",sourceDirName:".",slug:"/api",permalink:"/Shuffle/docs/api",draft:!1,editUrl:"https://github.com/Vestride/Shuffle/tree/main/apps/website/docs/docs/api.md",tags:[],version:"current",sidebarPosition:10,frontMatter:{sidebar_position:10},sidebar:"tutorialSidebar",previous:{title:"Adding and removing items",permalink:"/Shuffle/docs/adding-removing"},next:{title:"Custom styles",permalink:"/Shuffle/docs/custom-styles"}},s={},d=[{value:"<code>filter(category?, sortObject?)</code>",id:"filtercategory-sortobject",level:2},{value:"<code>sort(sortObject?)</code>",id:"sortsortobject",level:2},{value:"<code>update(options?)</code>",id:"updateoptions",level:2},{value:"<code>layout()</code>",id:"layout",level:2},{value:"<code>add(newItems)</code>",id:"addnewitems",level:2},{value:"<code>disable()</code>",id:"disable",level:2},{value:"<code>enable(isUpdateLayout?)</code>",id:"enableisupdatelayout",level:2},{value:"<code>remove(elements)</code>",id:"removeelements",level:2},{value:"<code>getItemByElement(element)</code>",id:"getitembyelementelement",level:2},{value:"<code>destroy()</code>",id:"destroy",level:2}],p={toc:d};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"api"},"API"),(0,a.kt)("p",null,"A list of the methods available to you and what they do."),(0,a.kt)("h2",{id:"filtercategory-sortobject"},(0,a.kt)("inlineCode",{parentName:"h2"},"filter(category?, sortObject?)")),(0,a.kt)("p",null,"Filters all the shuffle items and then sorts them."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"category")," can be a string, array of strings, or a function. Learn more in ",(0,a.kt)("a",{parentName:"li",href:"/Shuffle/docs/filters"},"filters"),"."),(0,a.kt)("li",{parentName:"ul"},"The ",(0,a.kt)("inlineCode",{parentName:"li"},"sortObject")," is optional, defaulting to the last-used sort object.")),(0,a.kt)("h2",{id:"sortsortobject"},(0,a.kt)("inlineCode",{parentName:"h2"},"sort(sortObject?)")),(0,a.kt)("p",null,"Sorts the currently filtered shuffle items."),(0,a.kt)("p",null,"Calling sort with an empty object will reset the elements to DOM order."),(0,a.kt)("p",null,"See the ",(0,a.kt)("a",{parentName:"p",href:"/Shuffle/docs/configuration#sorting-object"},"SortOptions")," for the available properties."),(0,a.kt)("h2",{id:"updateoptions"},(0,a.kt)("inlineCode",{parentName:"h2"},"update(options?)")),(0,a.kt)("p",null,"Repositions everything. Useful for when dimensions (like the window size) change."),(0,a.kt)("p",null,"You may provide an options object containing the following properties:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"recalculateSizes"),": Whether to recalculate column, gutter, and container widths again. Defaults to ",(0,a.kt)("inlineCode",{parentName:"li"},"true"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"force"),": By default, ",(0,a.kt)("inlineCode",{parentName:"li"},"update")," does nothing if the instance is disabled. Setting this to true forces the update to happen regardless.")),(0,a.kt)("h2",{id:"layout"},(0,a.kt)("inlineCode",{parentName:"h2"},"layout()")),(0,a.kt)("p",null,"Use this instead of ",(0,a.kt)("inlineCode",{parentName:"p"},"update()")," if you don't need the columns and gutters updated. Maybe an image inside ",(0,a.kt)("inlineCode",{parentName:"p"},"shuffle")," loaded (and now has a height), which means calculations could be off."),(0,a.kt)("h2",{id:"addnewitems"},(0,a.kt)("inlineCode",{parentName:"h2"},"add(newItems)")),(0,a.kt)("p",null,"New items have been appended to the shuffle container. ",(0,a.kt)("inlineCode",{parentName:"p"},"newItems")," is an array of elements."),(0,a.kt)("h2",{id:"disable"},(0,a.kt)("inlineCode",{parentName:"h2"},"disable()")),(0,a.kt)("p",null,"Disables Shuffle from updating dimensions and layout on resize."),(0,a.kt)("h2",{id:"enableisupdatelayout"},(0,a.kt)("inlineCode",{parentName:"h2"},"enable(isUpdateLayout?)")),(0,a.kt)("p",null,"Enables Shuffle again. If you pass ",(0,a.kt)("inlineCode",{parentName:"p"},"false")," as the first parameter, you can tell Shuffle to skip the layout recalculation."),(0,a.kt)("h2",{id:"removeelements"},(0,a.kt)("inlineCode",{parentName:"h2"},"remove(elements)")),(0,a.kt)("p",null,"Remove one or more shuffle items. ",(0,a.kt)("inlineCode",{parentName:"p"},"elements")," is an array containing one or more elements."),(0,a.kt)("h2",{id:"getitembyelementelement"},(0,a.kt)("inlineCode",{parentName:"h2"},"getItemByElement(element)")),(0,a.kt)("p",null,"Retrieve a ",(0,a.kt)("inlineCode",{parentName:"p"},"ShuffleItem")," by its element."),(0,a.kt)("h2",{id:"destroy"},(0,a.kt)("inlineCode",{parentName:"h2"},"destroy()")),(0,a.kt)("p",null,"Destroys Shuffle, removes events, styles, classes, and references."))}u.isMDXComponent=!0}}]);