PageSourceSearch

https://touying-typ.github.io/assets/js/90abcdfb.b55a4ab2.js

js touying-typ.github.io collected 2026-10-03 10:08:32 UTC 5,179 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[6488],{63838:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>s,contentTitle:()=>a,default:()=>l,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var t=n(85893),c=n(11151);const i={sidebar_position:38,description:"Extend external packages with pause and meanwhile animation support.",toc_max_heading_level:2},a="touying-reducer",o={id:"reference/core/touying-reducer",title:"touying-reducer",description:"Extend external packages with pause and meanwhile animation support.",source:"@site/docs/reference/core/touying-reducer.mdx",sourceDirName:"reference/core",slug:"/reference/core/touying-reducer",permalink:"/docs/reference/core/touying-reducer",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:38,frontMatter:{sidebar_position:38,description:"Extend external packages with pause and meanwhile animation support.",toc_max_heading_level:2},sidebar:"tutorialSidebar",previous:{title:"touying-raw",permalink:"/docs/reference/core/touying-raw"},next:{title:"touying-reduce",permalink:"/docs/reference/core/touying-reduce"}},s={},d=[{value:"reduce : <TypeLink></TypeLink> <Default><code>arr =&gt; arr.sum()</code></Default>",id:"reduce",level:3},{value:"cover : <TypeLink></TypeLink> <Default><code>arr =&gt; none</code></Default>",id:"cover",level:3},{value:"..args : <TypeLink></TypeLink>",id:"args",level:3}];function u(e){const r={a:"a",code:"code",h1:"h1",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,c.a)(),...e.components},{Default:n,Param:i,Parameters:a,Signature:o,SignatureName:s,SignatureParam:d,SourceLink:u,TypeLink:l}=r;return n||h("Default",!0),i||h("Param",!0),a||h("Parameters",!0),o||h("Signature",!0),s||h("SignatureName",!0),d||h("SignatureParam",!0),u||h("SourceLink",!0),l||h("TypeLink",!0),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h1,{id:"touying-reducer",children:"touying-reducer"}),"\n",(0,t.jsx)(o,{children:(0,t.jsxs)("code",{children:[(0,t.jsx)(s,{children:"touying-reducer"}),"(",(0,t.jsxs)(d,{children:[(0,t.jsx)(r.a,{href:"#reduce",children:"reduce: arr => arr.sum()"}),", "]}),(0,t.jsxs)(d,{children:[(0,t.jsx)(r.a,{href:"#cover",children:"cover: arr => none"}),", "]}),(0,t.jsx)(d,{children:(0,t.jsx)(r.a,{href:"#args",children:"..args"})}),")",(0,t.jsx)(u,{href:"https://github.com/touying-typ/touying/blob/main/src/core.typ#L2737"})]})}),"\n",(0,t.jsxs)(r.p,{children:["Extend external packages with ",(0,t.jsx)(r.code,{children:"pause"})," and ",(0,t.jsx)(r.code,{children:"meanwhile"})," animation support."]}),"\n",(0,t.jsxs)(r.p,{children:["Wraps an external drawing/diagram function (like ",(0,t.jsx)(r.code,{children:"cetz.canvas"})," or ",(0,t.jsx)(r.code,{children:"fletcher.diagram"}),") so that Touying can intercept ",(0,t.jsx)(r.code,{children:"pause"}),"/",(0,t.jsx)(r.code,{children:"meanwhile"})," markers inside its content array and hide/cover items across subslides."]}),"\n",(0,t.jsx)(r.p,{children:"Define package-specific wrappers once at the top of your document:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typst",children:"// CeTZ\n#let cetz-canvas = touying-reduce.with(cetz)\n\n// Fletcher\n#let fletcher-diagram = touying-reduce.with(fletcher)\n"})}),"\n",(0,t.jsxs)(a,{children:[(0,t.jsxs)(r.h3,{id:"reduce",children:["reduce : ",(0,t.jsx)(l,{type:"function"})," ",(0,t.jsx)(n,{children:(0,t.jsx)(r.code,{children:"arr => arr.sum()"})})]}),(0,t.jsx)(i,{children:(0,t.jsxs)(r.p,{children:["The external drawing function. It should accept an array of drawing commands and return rendered content (e.g. ",(0,t.jsx)(r.code,{children:"cetz.canvas"})," or ",(0,t.jsx)(r.code,{children:"fletcher.diagram"}),")."]})}),(0,t.jsxs)(r.h3,{id:"cover",children:["cover : ",(0,t.jsx)(l,{type:"function"})," ",(0,t.jsx)(n,{children:(0,t.jsx)(r.code,{children:"arr => none"})})]}),(0,t.jsx)(i,{children:(0,t.jsxs)(r.p,{children:["Called with a drawing command when that command should be hidden on the current subslide. Should produce invisible but space-preserving content (e.g. ",(0,t.jsx)(r.code,{children:"cetz.draw.hide.with(bounds: true)"})," or ",(0,t.jsx)(r.code,{children:"fletcher.hide"}),")."]})}),(0,t.jsxs)(r.h3,{id:"args",children:["..args : ",(0,t.jsx)(l,{type:"arguments"})]}),(0,t.jsx)(i,{children:(0,t.jsxs)(r.p,{children:["The positional and named arguments passed to the ",(0,t.jsx)(r.code,{children:"reduce"})," function."]})})]}),"\n",(0,t.jsxs)(r.p,{children:[(0,t.jsx)(r.strong,{children:"Returns:"})," ",(0,t.jsx)(l,{type:"content"})]})]})}function l(e={}){const{wrapper:r}={...(0,c.a)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}function h(e,r){throw new Error("Expected "+(r?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}},11151:(e,r,n)=>{n.d(r,{Z:()=>o,a:()=>a});var t=n(67294);const c={},i=t.createContext(c);function a(e){const r=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function o(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:a(e.components),t.createElement(i.Provider,{value:r},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.