[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"github-stars":3,"guide-nav":5,"doc-\u002Fdocs\u002Fprimitives\u002Fslots":129},{"stars":4},5505,[6,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,72,76,80,84,88,93,97,101,105,109,113,117,121,125],{"path":7,"title":8,"description":9,"category":10},"\u002Fdocs\u002Fguide","Getting started","Shaders is a library of GPU effect components for Vue, React, Svelte, Solid, JavaScript and Framer, with a design editor for building with them.","code",{"path":12,"title":13,"description":14,"category":10},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":16,"title":17,"description":18,"category":10},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":20,"title":21,"description":22,"category":10},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":24,"title":25,"description":26,"category":10},"\u002Fdocs\u002Fguide\u002Fprops-reactivity","Props and reactivity","Bind props to your framework's state so effects update when it changes, and animate props with an animation library.",{"path":28,"title":29,"description":30,"category":10},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":32,"title":33,"description":34,"category":10},"\u002Fdocs\u002Fguide\u002Flayout-positioning","Layout and positioning","Size and place a shader in your page with CSS, as a background, a fill, or an inline block.",{"path":36,"title":37,"description":38,"category":10},"\u002Fdocs\u002Fguide\u002Fsizing-and-units","Sizing and units","Size and place layers in CSS units (px, %, vw, rem, and canvas units) that stay correct as the canvas and window resize.",{"path":40,"title":41,"description":42,"category":10},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":44,"title":45,"description":46,"category":10},"\u002Fdocs\u002Fguide\u002Fshape-effects","Shape effects","Pick the 2D, 3D or custom SVG shape that Glass, Neon, Emboss and other shape effects draw inside.",{"path":48,"title":49,"description":50,"category":10},"\u002Fdocs\u002Fguide\u002Fcolor-space","Color space","Match colors to your design tool with the output color space, and keep bright layers from clipping with tone mapping.",{"path":52,"title":53,"description":54,"category":10},"\u002Fdocs\u002Fguide\u002Fhooks-events","Hooks and events","Run code when an effect is ready to show, and show a fallback when the GPU can't run it.",{"path":56,"title":57,"description":58,"category":10},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":60,"title":61,"description":62,"category":10},"\u002Fdocs\u002Fguide\u002Fcustom-shaders","Custom components","Write your own component in TypeScript, use it like any component in the library, and write WGSL by hand when you need to.",{"path":64,"title":65,"description":66,"category":10},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":68,"title":69,"description":70,"category":71},"\u002Fdocs\u002Fguide\u002Fmcp","Shaders MCP","Connect your AI coding agent to Shaders so it can find, install and edit effects in your codebase.","workflows",{"path":73,"title":74,"description":75,"category":71},"\u002Fdocs\u002Fguide\u002Fcli","Shaders CLI","Install your own shaders and Pro shaders into your codebase as component files, and keep them in sync with the design editor.",{"path":77,"title":78,"description":79,"category":71},"\u002Fdocs\u002Fguide\u002Fagent-skill","Agent skill","Give your coding agent a skill that teaches it to build with Shaders components, the CLI and Pro shaders.",{"path":81,"title":82,"description":83,"category":10},"\u002Fdocs\u002Fguide\u002Fvideo-rendering","Rendering to video","Turn a shader effect into a video file, from the design editor or from a frame-by-frame pipeline such as Remotion, Hyperframes or Puppeteer.",{"path":85,"title":86,"description":87,"category":10},"\u002Fdocs\u002Fguide\u002Fssr","Server rendering","Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",{"path":89,"title":90,"description":91,"category":92},"\u002Fdocs\u002Fguide\u002Fquick-tour-of-the-design-editor","Quick tour of the design editor","A short walkthrough of the full Shaders workflow, from designing on the infinite canvas to exporting code.","editor",{"path":94,"title":95,"description":96,"category":92},"\u002Fdocs\u002Fguide\u002Fintro-to-the-interface","Intro to the interface","A tour of the design editor interface: the canvas, layers, the Properties panel, and the ways to share and export.",{"path":98,"title":99,"description":100,"category":92},"\u002Fdocs\u002Fguide\u002Fcomposing-your-first-shader-effect","Composing your first shader effect","Building a first shader effect in the design editor by stacking and nesting components as layers.",{"path":102,"title":103,"description":104,"category":92},"\u002Fdocs\u002Fguide\u002Fmasking-and-blending","Masking and blending","How blend modes and masks combine components in the design editor.",{"path":106,"title":107,"description":108,"category":92},"\u002Fdocs\u002Fguide\u002Fdynamic-prop-mapping","Dynamic prop mapping","Turning static props into dynamic ones in the design editor: mapping one layer's output into another's prop, following the cursor, or animating automatically.",{"path":110,"title":111,"description":112,"category":92},"\u002Fdocs\u002Fguide\u002Fcustom-media-and-transformations","Custom media and transformations","Uploading images, videos, and SVG files to the media gallery, adding them to a composition, and placing them with transformations.",{"path":114,"title":115,"description":116,"category":92},"\u002Fdocs\u002Fguide\u002Finstalling-a-shader-via-mcp","Installing a shader via MCP","Installing a shader from the design editor into a hero section with the Shaders MCP.",{"path":118,"title":119,"description":120,"category":92},"\u002Fdocs\u002Fguide\u002Fexploring-shape-effects","Exploring shape effects","Applying shape effects such as liquid glass, liquid metal, and glowing edges to built-in shapes and your own SVG.",{"path":122,"title":123,"description":124,"category":92},"\u002Fdocs\u002Fguide\u002Fglass-component-spotlight","Component spotlight: Glass","A short look at the Glass component and the liquid-glass look it creates.",{"path":126,"title":127,"description":128,"category":92},"\u002Fdocs\u002Fguide\u002Fdigital-looks-component-spotlight","Component spotlight: Digital looks","A look at the digital stylization components for glitchy, futuristic, or technical effects.",{"id":130,"title":131,"body":132,"categoryId":591,"categorySlug":591,"categoryTitle":592,"curated":324,"description":593,"editUrl":594,"extension":595,"group":596,"groupTitle":597,"kind":592,"meta":598,"navigation":324,"path":599,"seo":600,"sourceUrl":601,"stem":602,"wordCount":370,"__hash__":603},"primitives\u002Fdocs\u002Fprimitives\u002F3.slots\u002Findex.md","Identity & recompile rules",{"type":133,"value":134,"toc":586},"minimark",[135,139,160,167,196,201,299,303,512,516,582],[136,137,131],"h1",{"id":138},"identity-recompile-rules",[140,141,142,143,147,148,151,152,155,156,159],"p",{},"Two small kinds of rule that make a filter cheap. An ",[144,145,146],"strong",{},"identity rule"," sits on a filter\ndefinition's ",[10,149,150],{},"identityWhen:"," and says when the filter does nothing: while it holds, the layer\ninside passes through untouched and the effect costs no GPU time. A ",[144,153,154],{},"recompile rule"," sits\non a prop's ",[10,157,158],{},"recompile:"," and says which changes rebuild the shader rather than just update a\nvalue.",[140,161,162,163,166],{},"They pair up. The skip is decided when the shader is built, so a prop the identity rule reads\nneeds ",[10,164,165],{},"recompile: crosses(value)"," at the same value. Cross it and the shader rebuilds with\nthe filter switched on or off. A prop that is mapped per pixel by a driver disables the skip\non its own, since its value then varies across the canvas.",[168,169,174],"pre",{"className":170,"code":171,"language":172,"meta":173,"style":173},"language-ts shiki shiki-themes github-dark","import {crosses, isZero, isValue, …} from 'shaders\u002Fstd'\n","ts","",[10,175,176],{"__ignoreMap":173},[177,178,181,185,189,192],"span",{"class":179,"line":180},"line",1,[177,182,184],{"class":183},"snl16","import",[177,186,188],{"class":187},"s95oV"," {crosses, isZero, isValue, …} ",[177,190,191],{"class":183},"from",[177,193,195],{"class":194},"sU2Wk"," 'shaders\u002Fstd'\n",[197,198,200],"h2",{"id":199},"reach-for-it-when","Reach for it when",[202,203,204,217],"table",{},[205,206,207],"thead",{},[208,209,210,214],"tr",{},[211,212,213],"th",{},"When you need",[211,215,216],{},"Use",[218,219,220,243,260,273,286],"tbody",{},[208,221,222,226],{},[223,224,225],"td",{},"skip a filter while a prop is 0",[223,227,228,235,236,242],{},[229,230,232],"a",{"href":231},"\u002Fdocs\u002Fprimitives\u002Fslots\u002Fiszero",[10,233,234],{},"isZero",", with ",[229,237,239],{"href":238},"\u002Fdocs\u002Fprimitives\u002Fslots\u002Fcrosses",[10,240,241],{},"crosses"," on the prop",[208,244,245,248],{},[223,246,247],{},"skip while a prop sits at its neutral value (1 for a gain)",[223,249,250,235,256,242],{},[229,251,253],{"href":252},"\u002Fdocs\u002Fprimitives\u002Fslots\u002Fisvalue",[10,254,255],{},"isValue",[229,257,258],{"href":238},[10,259,241],{},[208,261,262,265],{},[223,263,264],{},"skip only when several props are all at rest",[223,266,267],{},[229,268,270],{"href":269},"\u002Fdocs\u002Fprimitives\u002Fslots\u002Fallof",[10,271,272],{},"allOf",[208,274,275,278],{},[223,276,277],{},"a no-op condition the rules cannot express",[223,279,280],{},[229,281,283],{"href":282},"\u002Fdocs\u002Fprimitives\u002Fslots\u002Fidentitywhenever",[10,284,285],{},"identityWhenever",[208,287,288,291],{},[223,289,290],{},"a rebuild threshold that is not a single value",[223,292,293],{},[229,294,296],{"href":295},"\u002Fdocs\u002Fprimitives\u002Fslots\u002Frecompilewhen",[10,297,298],{},"recompileWhen",[197,300,302],{"id":301},"example","Example",[168,304,306],{"className":170,"code":305,"language":172,"meta":173,"style":173},"import {defineShader, p, crosses, isValue, effects} from 'shaders\u002Fstd'\n\n\u002F\u002F Saturation: free while intensity sits at 1, rebuilt only when it leaves or returns.\nexport const Saturation = defineShader({\n  name: 'Saturation',\n  props: {\n    intensity: {\n      default: 1,\n      recompile: crosses(1),\n      ui: {type: 'range', min: 0, max: 3, step: 0.1, label: 'Intensity'},\n    },\n  },\n  effect: effects.color.saturate(p('intensity')),\n  identityWhen: isValue('intensity', 1),\n  missingChildMessage: 'Nest a layer inside Saturation to adjust its color.',\n})\n",[10,307,308,319,326,333,356,368,374,380,391,407,443,449,455,476,495,506],{"__ignoreMap":173},[177,309,310,312,315,317],{"class":179,"line":180},[177,311,184],{"class":183},[177,313,314],{"class":187}," {defineShader, p, crosses, isValue, effects} ",[177,316,191],{"class":183},[177,318,195],{"class":194},[177,320,322],{"class":179,"line":321},2,[177,323,325],{"emptyLinePlaceholder":324},true,"\n",[177,327,329],{"class":179,"line":328},3,[177,330,332],{"class":331},"sAwPA","\u002F\u002F Saturation: free while intensity sits at 1, rebuilt only when it leaves or returns.\n",[177,334,336,339,342,346,349,353],{"class":179,"line":335},4,[177,337,338],{"class":183},"export",[177,340,341],{"class":183}," const",[177,343,345],{"class":344},"sDLfK"," Saturation",[177,347,348],{"class":183}," =",[177,350,352],{"class":351},"svObZ"," defineShader",[177,354,355],{"class":187},"({\n",[177,357,359,362,365],{"class":179,"line":358},5,[177,360,361],{"class":187},"  name: ",[177,363,364],{"class":194},"'Saturation'",[177,366,367],{"class":187},",\n",[177,369,371],{"class":179,"line":370},6,[177,372,373],{"class":187},"  props: {\n",[177,375,377],{"class":179,"line":376},7,[177,378,379],{"class":187},"    intensity: {\n",[177,381,383,386,389],{"class":179,"line":382},8,[177,384,385],{"class":187},"      default: ",[177,387,388],{"class":344},"1",[177,390,367],{"class":187},[177,392,394,397,399,402,404],{"class":179,"line":393},9,[177,395,396],{"class":187},"      recompile: ",[177,398,241],{"class":351},[177,400,401],{"class":187},"(",[177,403,388],{"class":344},[177,405,406],{"class":187},"),\n",[177,408,410,413,416,419,422,425,428,431,434,437,440],{"class":179,"line":409},10,[177,411,412],{"class":187},"      ui: {type: ",[177,414,415],{"class":194},"'range'",[177,417,418],{"class":187},", min: ",[177,420,421],{"class":344},"0",[177,423,424],{"class":187},", max: ",[177,426,427],{"class":344},"3",[177,429,430],{"class":187},", step: ",[177,432,433],{"class":344},"0.1",[177,435,436],{"class":187},", label: ",[177,438,439],{"class":194},"'Intensity'",[177,441,442],{"class":187},"},\n",[177,444,446],{"class":179,"line":445},11,[177,447,448],{"class":187},"    },\n",[177,450,452],{"class":179,"line":451},12,[177,453,454],{"class":187},"  },\n",[177,456,458,461,464,466,468,470,473],{"class":179,"line":457},13,[177,459,460],{"class":187},"  effect: effects.color.",[177,462,463],{"class":351},"saturate",[177,465,401],{"class":187},[177,467,140],{"class":351},[177,469,401],{"class":187},[177,471,472],{"class":194},"'intensity'",[177,474,475],{"class":187},")),\n",[177,477,479,482,484,486,488,491,493],{"class":179,"line":478},14,[177,480,481],{"class":187},"  identityWhen: ",[177,483,255],{"class":351},[177,485,401],{"class":187},[177,487,472],{"class":194},[177,489,490],{"class":187},", ",[177,492,388],{"class":344},[177,494,406],{"class":187},[177,496,498,501,504],{"class":179,"line":497},15,[177,499,500],{"class":187},"  missingChildMessage: ",[177,502,503],{"class":194},"'Nest a layer inside Saturation to adjust its color.'",[177,505,367],{"class":187},[177,507,509],{"class":179,"line":508},16,[177,510,511],{"class":187},"})\n",[197,513,515],{"id":514},"words","Words",[517,518,520],"primitive-words",{":words":519},"[{\"name\":\"crosses\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fslots\u002Fcrosses\",\"summary\":\"Rebuild the shader only when the prop crosses `value`, not on every change.\"},{\"name\":\"isZero\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fslots\u002Fiszero\",\"summary\":\"Skip the filter entirely while `prop` is exactly 0.\"},{\"name\":\"isValue\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fslots\u002Fisvalue\",\"summary\":\"Skip the filter entirely while `prop` equals `value`, for a filter whose no-op is not 0.\"},{\"name\":\"allOf\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fslots\u002Fallof\",\"summary\":\"Skip the filter only while every rule holds, for a no-op that needs several props at rest.\"},{\"name\":\"identityWhenever\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fslots\u002Fidentitywhenever\",\"summary\":\"Skip the filter when your own test of the props' values says so.\"},{\"name\":\"recompileWhen\",\"path\":\"\u002Fdocs\u002Fprimitives\u002Fslots\u002Frecompilewhen\",\"summary\":\"Rebuild when your own test of the old and new value says so, for a threshold `crosses` cannot express.\"}]",[521,522,523,535,546,558,565,572],"ul",{},[524,525,526,530,531,534],"li",{},[229,527,528],{"href":238},[10,529,241],{}," — Rebuild the shader only when the prop crosses ",[10,532,533],{},"value",", not on every change.",[524,536,537,541,542,545],{},[229,538,539],{"href":231},[10,540,234],{}," — Skip the filter entirely while ",[10,543,544],{},"prop"," is exactly 0.",[524,547,548,541,552,554,555,557],{},[229,549,550],{"href":252},[10,551,255],{},[10,553,544],{}," equals ",[10,556,533],{},", for a filter whose no-op is not 0.",[524,559,560,564],{},[229,561,562],{"href":269},[10,563,272],{}," — Skip the filter only while every rule holds, for a no-op that needs several props at rest.",[524,566,567,571],{},[229,568,569],{"href":282},[10,570,285],{}," — Skip the filter when your own test of the props' values says so.",[524,573,574,578,579,581],{},[229,575,576],{"href":295},[10,577,298],{}," — Rebuild when your own test of the old and new value says so, for a threshold ",[10,580,241],{}," cannot express.",[583,584,585],"style",{},"html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}",{"title":173,"searchDepth":321,"depth":321,"links":587},[588,589,590],{"id":199,"depth":321,"text":200},{"id":301,"depth":321,"text":302},{"id":514,"depth":321,"text":515},"slots",null,"Two small kinds of rule that make a filter cheap.","https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fedit\u002Fmain\u002Fpackages\u002Fcore\u002Fdocs\u002Fstd\u002Fslots.md","md","define","Defining a shader",{},"\u002Fdocs\u002Fprimitives\u002Fslots",{"title":131,"description":593},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Fslots.ts","docs\u002Fprimitives\u002F3.slots\u002Findex","WrwYbH74ln2CyHTaSnubmshL-oqFke2J1fWpVzda8c0"]