{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "example-planar-synth",
  "type": "registry:block",
  "title": "Planar Synth",
  "description": "A silent planar instrument interface with neutral knobs, four section accents, interactive filter and exponential ADSR plots, waveform choices and a light/dark switch.",
  "dependencies": [
    "@base-ui/react",
    "maruaudio@>=0.0.3 <0.1.0"
  ],
  "registryDependencies": [
    "https://pluginui.com/r/core-envelope-editor.json",
    "https://pluginui.com/r/core-eq-editor.json",
    "https://pluginui.com/r/core-knob.json",
    "https://pluginui.com/r/core-lfo-visualizer.json",
    "https://pluginui.com/r/core-segmented-control.json",
    "https://pluginui.com/r/core-toggle-switch.json"
  ],
  "files": [
    {
      "path": "components/blocks/planar-synth.tsx",
      "content": "/**\n * Source: https://pluginui.com/examples/planar-synth\n * Copyright © [Maru](https://maru.audio)\n *\n * Maru UI Kit — https://maru.audio/ui-kit\n *\n * Installed from the Maru UI registry. This file is yours now: edit it\n * freely, it will not be overwritten unless you re-run the add command.\n *\n * Keep this item’s companion files and CSS imports together. Dependencies\n * declared by the registry are installed with the source.\n */\nimport { useState, type ReactNode } from \"react\"\nimport { Knob } from \"@/components/ui/knob\"\nimport {\n  EnvelopeEditor,\n  type ADSR,\n} from \"@/components/ui/envelope-editor\"\nimport {\n  EQEditor,\n  type EQEditorBand,\n} from \"@/components/ui/eq-editor\"\nimport {\n  LFOVisualizer,\n  type LFOWaveform,\n} from \"@/components/ui/lfo-visualizer\"\nimport { SegmentedControl } from \"@/components/ui/segmented-control\"\nimport { ToggleSwitch } from \"@/components/ui/toggle-switch\"\nimport { percent } from \"maruaudio/ui/shared/format\"\nimport {\n  PLANAR_ACCENTS,\n  PLANAR_THEMES,\n  themeStyle,\n  themeVars,\n} from \"maruaudio/ui/shared/theme\"\nimport { UI_KIT_TEXT_SELECTION_STYLES } from \"maruaudio/ui/shared/portable-styles\"\nimport \"@/components/blocks/planar-synth.css\"\n\nconst INITIAL_ENVELOPE: ADSR = {\n  attack: 0.008,\n  decay: 0.5,\n  sustain: 0.65,\n  release: 0.42,\n}\nconst INITIAL_FILTER_ENVELOPE: ADSR = {\n  attack: 0.015,\n  decay: 0.35,\n  sustain: 0.3,\n  release: 0.28,\n}\nconst INITIAL_FILTER: EQEditorBand[] = [\n  {\n    type: \"lowpass\",\n    freq: 2400,\n    gain: 0,\n    q: 0.8,\n    gainRange: null,\n    label: \"Cutoff\",\n  },\n]\nconst WAVE_OPTIONS = [\n  { value: \"sawtooth\", label: \"Saw\" },\n  { value: \"square\", label: \"Square\" },\n  { value: \"triangle\", label: \"Triangle\" },\n]\n\nfunction Zone({\n  title,\n  accent,\n  children,\n  className = \"\",\n}: {\n  title: string\n  accent: string\n  children: ReactNode\n  className?: string\n}) {\n  return (\n    <section\n      className={`planar-synth__zone ${className}`}\n      style={themeVars({ accent, accent2: accent })}\n      aria-label={title}\n    >\n      <h3 className=\"planar-synth__heading\">\n        <i aria-hidden />\n        {title}\n      </h3>\n      {children}\n    </section>\n  )\n}\n\nexport interface PlanarSynthProps {\n  initialMode?: \"dark\" | \"light\"\n  /** Optional per-zone accent overrides; surfaces and pointer ink stay neutral. */\n  accents?: Partial<Record<keyof typeof PLANAR_ACCENTS.dark, string>>\n}\n\n/** Silent, portable instrument layout. Plots and controls share local state. */\nexport function PlanarSynth({\n  initialMode = \"dark\",\n  accents: accentOverrides,\n}: PlanarSynthProps) {\n  const [dark, setDark] = useState(initialMode === \"dark\")\n  const [waves, setWaves] = useState([\"sawtooth\", \"square\"])\n  const [tunes, setTunes] = useState([0, -12])\n  const [levels, setLevels] = useState([0.8, 0.5])\n  const [bands, setBands] = useState(INITIAL_FILTER)\n  const [envelope, setEnvelope] = useState(INITIAL_ENVELOPE)\n  const [filterEnvelope, setFilterEnvelope] = useState(INITIAL_FILTER_ENVELOPE)\n  const [tracking, setTracking] = useState(0.5)\n  const [envAmount, setEnvAmount] = useState(0.4)\n  const [output, setOutput] = useState(0.75)\n  const [rate, setRate] = useState(2.4)\n  const [shape, setShape] = useState<LFOWaveform>(\"triangle\")\n  const [depths, setDepths] = useState([0.15, 0.45, 0.2])\n  const mode = dark ? \"dark\" : \"light\"\n  const accents = { ...PLANAR_ACCENTS[mode], ...accentOverrides }\n  const filter = bands[0]!\n  const update = (values: number[], index: number, next: number) =>\n    values.map((value, i) => (i === index ? next : value))\n  return (\n    <section\n      className=\"planar-synth\"\n      data-mode={mode}\n      data-text-selection=\"editable-only\"\n      style={themeStyle(PLANAR_THEMES[mode])}\n      aria-label=\"Planar Synth silent interface\"\n    >\n      <style>{UI_KIT_TEXT_SELECTION_STYLES}</style>\n      <header className=\"planar-synth__header\">\n        <div className=\"planar-synth__identity\">\n          <strong>\n            PLANAR<span> / 02</span>\n          </strong>\n          <span>Polyphonic synthesis · interface study</span>\n        </div>\n        <ToggleSwitch\n          label=\"Dark\"\n          variant=\"rocker\"\n          size={0.65}\n          hideValue\n          checked={dark}\n          onChange={setDark}\n        />\n      </header>\n      <div className=\"planar-synth__main\">\n        <Zone title=\"Oscillators\" accent={accents.oscillator}>\n          {waves.map((wave, index) => (\n            <div\n              className=\"planar-synth__oscillator\"\n              key={index}\n              role=\"group\"\n              aria-label={`Oscillator ${index + 1}`}\n            >\n              <div className=\"planar-synth__oscillator-title\">\n                <span>OSC {index + 1}</span>\n                <LFOVisualizer\n                  key={`${wave}-${accents.oscillator}`}\n                  paused\n                  type={wave as LFOWaveform}\n                  phase={0}\n                  cycles={2}\n                  height={52}\n                  showReadout={false}\n                  showGrid={false}\n                  color={accents.oscillator}\n                  aria-label={`Oscillator ${index + 1} waveform`}\n                />\n              </div>\n              <SegmentedControl\n                variant=\"panel\"\n                aria-label={`Oscillator ${index + 1} waveform`}\n                options={WAVE_OPTIONS}\n                value={wave}\n                onValueChange={(next) =>\n                  setWaves(\n                    waves.map((value, i) => (i === index ? next : value))\n                  )\n                }\n                size=\"lg\"\n              />\n              <div className=\"planar-synth__knobs\">\n                <Knob\n                  variant=\"panel\"\n                  label=\"Tune\"\n                  size={56}\n                  value={tunes[index]}\n                  defaultValue={index ? -12 : 0}\n                  min={-24}\n                  max={24}\n                  step={1}\n                  unit=\"st\"\n                  bipolar\n                  onChange={(next) => setTunes(update(tunes, index, next))}\n                />\n                <Knob\n                  variant=\"panel\"\n                  label=\"Level\"\n                  size={56}\n                  value={levels[index]}\n                  defaultValue={index ? 0.5 : 0.8}\n                  format={percent()}\n                  onChange={(next) => setLevels(update(levels, index, next))}\n                />\n              </div>\n            </div>\n          ))}\n        </Zone>\n        <Zone title=\"Filter\" accent={accents.filter}>\n          <div className=\"planar-synth__choices\">\n            <span>Response</span>\n            <SegmentedControl\n              variant=\"panel\"\n              aria-label=\"Filter type\"\n              size=\"md\"\n              options={[\n                { value: \"lowpass\", label: \"Low pass\" },\n                { value: \"highpass\", label: \"High pass\" },\n              ]}\n              value={filter.type}\n              onValueChange={(next) => {\n                setBands([\n                  {\n                    ...filter,\n                    type: next === \"highpass\" ? \"highpass\" : \"lowpass\",\n                  },\n                ])\n              }}\n            />\n          </div>\n          <div className=\"planar-synth__plot\">\n            <EQEditor\n              bands={bands}\n              onBandsChange={setBands}\n              height={142}\n              showGrid\n              showLabels={false}\n              decibelRange={36}\n              aria-label=\"Filter response\"\n            />\n          </div>\n          <div className=\"planar-synth__knobs planar-synth__knobs--filter\">\n            <Knob\n              variant=\"panel\"\n              label=\"Cutoff\"\n              size={76}\n              value={filter.freq}\n              defaultValue={2400}\n              min={20}\n              max={20000}\n              curve=\"log\"\n              unit=\"Hz\"\n              onChange={(freq) => setBands([{ ...filter, freq }])}\n            />\n            <Knob\n              variant=\"panel\"\n              label=\"Resonance\"\n              size={64}\n              value={filter.q ?? 0.8}\n              defaultValue={0.8}\n              min={0.1}\n              max={8}\n              curve=\"log\"\n              onChange={(q) => setBands([{ ...filter, q }])}\n            />\n            <Knob\n              variant=\"panel\"\n              label=\"Key track\"\n              size={48}\n              value={tracking}\n              defaultValue={0.5}\n              format={percent()}\n              onChange={setTracking}\n            />\n            <Knob\n              variant=\"panel\"\n              label=\"Env amt\"\n              size={48}\n              value={envAmount}\n              defaultValue={0.4}\n              format={percent()}\n              onChange={setEnvAmount}\n            />\n          </div>\n          <div className=\"planar-synth__subheading\">Filter envelope</div>\n          <EnvelopeEditor\n            aria-label=\"Filter envelope\"\n            defaultValue={INITIAL_FILTER_ENVELOPE}\n            value={filterEnvelope}\n            onChange={setFilterEnvelope}\n            variant=\"compact\"\n            knobVariant=\"panel\"\n            knobSize={36}\n            curve=\"exponential\"\n            displayHeight={82}\n            showSegmentLabels={false}\n          />\n        </Zone>\n        <Zone title=\"Amplitude\" accent={accents.envelope}>\n          <div className=\"planar-synth__choices\">\n            <span>Contour</span>\n            <span>ADSR</span>\n          </div>\n          <EnvelopeEditor\n            aria-label=\"Amplitude envelope\"\n            defaultValue={INITIAL_ENVELOPE}\n            value={envelope}\n            onChange={setEnvelope}\n            variant=\"compact\"\n            knobVariant=\"panel\"\n            knobSize={48}\n            curve=\"exponential\"\n            displayHeight={172}\n            showSegmentLabels={false}\n          />\n          <div className=\"planar-synth__output\">\n            <Knob\n              variant=\"panel\"\n              label=\"Output\"\n              size={72}\n              value={output}\n              defaultValue={0.75}\n              format={percent()}\n              onChange={setOutput}\n            />\n          </div>\n        </Zone>\n      </div>\n      <Zone\n        title=\"Modulation\"\n        accent={accents.modulation}\n        className=\"planar-synth__modulation\"\n      >\n        <div className=\"planar-synth__modulation-content\">\n          <div className=\"planar-synth__lfo\">\n            <LFOVisualizer\n              key={`${shape}-${rate}-${accents.modulation}`}\n              paused\n              type={shape}\n              phase={0.25}\n              frequency={rate}\n              cycles={rate / 2}\n              height={94}\n              showReadout={false}\n              color={accents.modulation}\n              aria-label=\"Modulation waveform\"\n            />\n            <SegmentedControl\n              variant=\"panel\"\n              aria-label=\"LFO shape\"\n              options={[\n                { value: \"triangle\", label: \"Triangle\" },\n                { value: \"sine\", label: \"Sine\" },\n                { value: \"square\", label: \"Square\" },\n              ]}\n              value={shape}\n              onValueChange={setShape}\n            />\n          </div>\n          <Knob\n            variant=\"panel\"\n            label=\"Rate\"\n            size={64}\n            value={rate}\n            defaultValue={2.4}\n            min={0.1}\n            max={12}\n            curve=\"log\"\n            unit=\"Hz\"\n            onChange={setRate}\n          />\n          <div className=\"planar-synth__destinations\">\n            {([\"Pitch\", \"Cutoff\", \"Amplitude\"] as const).map((label, index) => (\n              <Knob\n                key={label}\n                variant=\"panel\"\n                label={label}\n                size={56}\n                value={depths[index]}\n                defaultValue={[0.15, 0.45, 0.2][index]}\n                format={percent()}\n                onChange={(next) => setDepths(update(depths, index, next))}\n              />\n            ))}\n          </div>\n        </div>\n      </Zone>\n    </section>\n  )\n}\n",
      "type": "registry:component",
      "target": "@components/blocks/planar-synth.tsx"
    },
    {
      "path": "components/blocks/planar-synth.css",
      "content": "/**\n * Source: https://pluginui.com/examples/planar-synth\n * Copyright © [Maru](https://maru.audio)\n *\n * Maru UI Kit — https://maru.audio/ui-kit\n *\n * Installed from the Maru UI registry. This file is yours now: edit it\n * freely, it will not be overwritten unless you re-run the add command.\n *\n * Keep this item’s companion files and CSS imports together. Dependencies\n * declared by the registry are installed with the source.\n */\n.planar-synth {\n  box-sizing: border-box;\n  width: 1040px;\n  max-width: 100%;\n  min-width: 880px;\n  padding: 22px;\n  border: 1px solid var(--uikit-border);\n  font-size: 12px;\n  line-height: 1.4;\n}\n.planar-synth *,\n.planar-synth *::before,\n.planar-synth *::after {\n  box-sizing: border-box;\n}\n.planar-synth__header {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 24px;\n  padding: 0 0 20px;\n}\n.planar-synth__identity {\n  display: flex;\n  gap: 22px;\n  align-items: baseline;\n}\n.planar-synth__identity strong {\n  font-size: 26px;\n  letter-spacing: -0.04em;\n}\n.planar-synth__identity strong span {\n  color: var(--uikit-text-muted);\n  font-weight: 400;\n}\n.planar-synth__identity > span {\n  color: var(--uikit-text-muted);\n  font-size: 11px;\n}\n.planar-synth__main {\n  display: grid;\n  grid-template-columns: 0.85fr 1.35fr 1fr;\n  gap: 16px;\n}\n.planar-synth__zone {\n  min-width: 0;\n  padding: 18px;\n  border: 1px solid var(--uikit-border);\n}\n.planar-synth__heading {\n  display: flex;\n  align-items: center;\n  gap: 9px;\n  margin: 0 0 20px;\n  font-size: 12px;\n  font-weight: 650;\n  letter-spacing: 0.06em;\n  text-transform: uppercase;\n}\n.planar-synth__heading i {\n  width: 8px;\n  height: 8px;\n  border-radius: 50%;\n  background: var(--uikit-accent);\n}\n.planar-synth__oscillator + .planar-synth__oscillator {\n  margin-top: 22px;\n  padding-top: 18px;\n  border-top: 1px solid var(--uikit-border);\n}\n.planar-synth__oscillator-title {\n  display: flex;\n  align-items: center;\n  gap: 16px;\n  margin-bottom: 12px;\n}\n.planar-synth__oscillator-title > span {\n  flex-shrink: 0;\n  color: var(--uikit-text-muted);\n  font-size: 10px;\n  letter-spacing: 0.08em;\n}\n.planar-synth__knobs {\n  display: flex;\n  align-items: flex-end;\n  justify-content: space-around;\n  gap: 12px;\n  margin-top: 18px;\n}\n.planar-synth__knobs--filter {\n  gap: 4px;\n  margin-top: 16px;\n}\n.planar-synth__choices {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  min-height: 28px;\n  margin-bottom: 12px;\n  color: var(--uikit-text-muted);\n  font-size: 10px;\n}\n.planar-synth__plot,\n.planar-synth [role=\"group\"][aria-label=\"ADSR envelope\"] {\n  --uikit-surface: color-mix(in srgb, var(--uikit-cap) 35%, var(--planar-plot));\n}\n.planar-synth[data-mode=\"dark\"] {\n  --planar-plot: #101214;\n}\n.planar-synth[data-mode=\"light\"] {\n  --planar-plot: #fafafa;\n}\n.planar-synth__subheading {\n  margin: 22px 0 12px;\n  padding-top: 16px;\n  border-top: 1px solid var(--uikit-border);\n  color: var(--uikit-accent);\n  font-size: 10px;\n  font-weight: 600;\n  text-transform: uppercase;\n  letter-spacing: 0.04em;\n}\n.planar-synth__output {\n  display: flex;\n  justify-content: center;\n  gap: 24px;\n  align-items: center;\n  margin-top: 24px;\n  padding-top: 20px;\n  border-top: 1px solid var(--uikit-border);\n}\n.planar-synth__modulation {\n  margin-top: 16px;\n}\n.planar-synth__modulation-content {\n  display: grid;\n  grid-template-columns: 260px 96px 1fr;\n  gap: 28px;\n  align-items: center;\n}\n.planar-synth__lfo {\n  display: grid;\n  gap: 12px;\n}\n.planar-synth__destinations {\n  display: flex;\n  align-items: center;\n  justify-content: space-around;\n  border-left: 1px solid var(--uikit-border);\n  padding-left: 22px;\n}\n",
      "type": "registry:file",
      "target": "@components/blocks/planar-synth.css"
    }
  ]
}
