PageSourceSearch

https://touying-typ.github.io/assets/js/47d7e3d1.868ee676.js

js touying-typ.github.io collected 2026-10-03 10:06:12 UTC 5,094 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1064],{94512:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>l,frontMatter:()=>c,metadata:()=>s,toc:()=>d});var i=r(85893),t=r(11151);const c={sidebar_position:39,description:"Automatically reduces the content with the given package and given or predefined bindings.",toc_max_heading_level:2},o="touying-reduce",s={id:"reference/core/touying-reduce",title:"touying-reduce",description:"Automatically reduces the content with the given package and given or predefined bindings.",source:"@site/docs/reference/core/touying-reduce.mdx",sourceDirName:"reference/core",slug:"/reference/core/touying-reduce",permalink:"/docs/reference/core/touying-reduce",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:39,frontMatter:{sidebar_position:39,description:"Automatically reduces the content with the given package and given or predefined bindings.",toc_max_heading_level:2},sidebar:"tutorialSidebar",previous:{title:"touying-reducer",permalink:"/docs/reference/core/touying-reducer"},next:{title:"touying-diagram",permalink:"/docs/reference/core/touying-diagram"}},a={},d=[{value:"package : <TypeLink></TypeLink>",id:"package",level:3},{value:"bindings : <TypeLink></TypeLink> <Default><code>(reduce: none, cover: none)</code></Default>",id:"bindings",level:3},{value:"..args : <TypeLink></TypeLink>",id:"args",level:3}];function u(e){const n={a:"a",code:"code",h1:"h1",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,t.a)(),...e.components},{Default:r,Param:c,Parameters:o,Signature:s,SignatureName:a,SignatureParam:d,SourceLink:u,TypeLink:l}=n;return r||g("Default",!0),c||g("Param",!0),o||g("Parameters",!0),s||g("Signature",!0),a||g("SignatureName",!0),d||g("SignatureParam",!0),u||g("SourceLink",!0),l||g("TypeLink",!0),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"touying-reduce",children:"touying-reduce"}),"\n",(0,i.jsx)(s,{children:(0,i.jsxs)("code",{children:[(0,i.jsx)(a,{children:"touying-reduce"}),"(",(0,i.jsxs)(d,{children:[(0,i.jsx)(n.a,{href:"#package",children:"package"}),", "]}),(0,i.jsxs)(d,{children:[(0,i.jsx)(n.a,{href:"#bindings",children:"bindings: (reduce: none, cover: none)"}),", "]}),(0,i.jsx)(d,{children:(0,i.jsx)(n.a,{href:"#args",children:"..args"})}),")",(0,i.jsx)(u,{href:"https://github.com/touying-typ/touying/blob/main/src/core.typ#L2770"})]})}),"\n",(0,i.jsx)(n.p,{children:"Automatically reduces the content with the given package and given or predefined bindings. Only works if the package exposes the bindings or its name and touying defines the bindings for the name."}),"\n",(0,i.jsx)(n.p,{children:"Usage:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typst",children:'#touying-reduce(cetz, {\n  import cetz.draw: *\n\n  rect((0,0), (5,5))\n  (pause,)\n  rect((0,0), (1,1))\n  rect((1,1), (2,2))\n  rect((2,2), (3,3))\n  (pause,)\n  line((0,0), (2.5, 2.5), name: "line")\n})\n'})}),"\n",(0,i.jsxs)(o,{children:[(0,i.jsxs)(n.h3,{id:"package",children:["package : ",(0,i.jsx)(l,{type:"module"})]}),(0,i.jsx)(c,{children:(0,i.jsxs)(n.p,{children:["The external package to integrate with touying. It should expose its name for auto-binding to work (e.g. ",(0,i.jsx)(n.code,{children:"cetz"}),")."]})}),(0,i.jsxs)(n.h3,{id:"bindings",children:["bindings : ",(0,i.jsx)(l,{type:"dictionary"})," ",(0,i.jsx)(r,{children:(0,i.jsx)(n.code,{children:"(reduce: none, cover: none)"})})]}),(0,i.jsx)(c,{children:(0,i.jsxs)(n.p,{children:["Optional explicit bindings for the reduce and cover functions. Should be a dictionary with keys ",(0,i.jsx)(n.code,{children:"reduce"})," and ",(0,i.jsx)(n.code,{children:"cover"}
1),", where the values are paths (as arrays of strings) with an optionally last entry being arguments to pass to the function. If any fields are ",(0,i.jsx)(n.code,{children:"none"}),", it checks whether the package has ",(0,i.jsx)(n.code,{children:"touying-reducer-bindings"})," otherwise touying will look up predefined bindings in ",(0,i.jsx)(n.code,{children:"extern.auto-reducer-bindings"})," based on the package name."]})}),(0,i.jsxs)(n.h3,{id:"args",children:["..args : ",(0,i.jsx)(l,{type:"arguments"})]}),(0,i.jsx)(c,{children:(0,i.jsx)(n.p,{children:"The positional and named arguments passed to the reduce function."})})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"Returns:"})," ",(0,i.jsx)(l,{type:"content"})]})]})}function l(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(u,{...e})}):u(e)}function g(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}},11151:(e,n,r)=>{r.d(n,{Z:()=>s,a:()=>o});var i=r(67294);const t={},c=i.createContext(t);function o(e){const n=i.useContext(c);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:o(e.components),i.createElement(c.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.