on_close ()) />\nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet navigation_menu_example () =\n let open_ = Signal.make false in\n let link label =\n el ~cls:\"rounded px-3 py-1.5 text-neutral-700 hover:bg-neutral-100\"\n ~attrs:[ View.Attr.href (View.static \"#\") ] \"a\" [ txt label ]\n in\n el ~cls:\"relative w-full max-w-lg\" \"div\"\n [\n el ~cls:\"flex items-center gap-1 rounded-lg border border-neutral-200 bg-surface p-1 text-sm\"\n \"div\"\n [\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static\n \"inline-flex items-center gap-1 rounded px-3 py-1.5 text-neutral-700 \\\n hover:bg-neutral-100\");\n ]\n ~events:[ View.On.click (fun _ -> Signal.update open_ (fun v -> not v)) ]\n \"button\"\n [ txt \"Products\"; Icon.make ~name:\"chevron-down\" ~size:`sm () ];\n link \"Pricing\";\n link \"Company\";\n ];\n View.show\n (fun () -> Signal.get open_)\n (View.fragment\n [\n Backdrop.make ~on_close:(fun () -> Signal.set open_ false) ();\n el\n ~cls:\n \"absolute z-20 mt-1 grid w-96 grid-cols-2 gap-1 rounded-lg border \\\n border-neutral-200 bg-surface p-2 shadow-xl\"\n \"div\"\n (List.map\n (fun (t, d) ->\n el ~cls:\"rounded-md p-3 hover:bg-neutral-50\"\n ~attrs:[ View.Attr.href (View.static \"#\") ] \"a\"\n [\n el ~cls:\"text-sm font-medium text-neutral-900\" \"p\" [ txt t ];\n el ~cls:\"text-xs text-neutral-500\" \"p\" [ txt d ];\n ])\n [\n (\"Analytics\", \"Understand your traffic\");\n (\"Automations\", \"Build no-code workflows\");\n (\"Reports\", \"Share insights\");\n (\"Integrations\", \"Connect your stack\");\n ]);\n ])\n ]")
+ | "sidebar" => Some("let txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet sidebar_example () =\n let item ?(active = false) label =\n let cls =\n if active then \"block rounded-md bg-neutral-900 px-2 py-1.5 text-neutral-0\"\n else \"block rounded-md px-2 py-1.5 text-neutral-700 hover:bg-neutral-100\"\n in\n el ~cls ~attrs:[ View.Attr.href (View.static \"#\") ] \"a\" [ txt label ]\n in\n el ~cls:\"flex h-56 w-56 flex-col rounded-lg border border-neutral-200 bg-neutral-50 p-2\" \"div\"\n [\n el ~cls:\"px-2 py-1.5 text-sm font-semibold text-neutral-900\" \"div\" [ txt \"Workspace\" ];\n el ~cls:\"mt-1 space-y-0.5 text-sm\" \"nav\"\n [ item ~active:true \"Dashboard\"; item \"Projects\"; item \"Reports\"; item \"Settings\" ];\n ]")
+ | "resizable" => Some("let txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet resizable_example () =\n let split = Signal.make 55 in\n let left_style () = \"width:\" ^ string_of_int (Signal.get split) ^ \"%\" in\n let right_style () = \"width:\" ^ string_of_int (100 - Signal.get split) ^ \"%\" in\n el ~cls:\"w-96 space-y-3\" \"div\"\n [\n el ~cls:\"flex h-40 overflow-hidden rounded-lg border border-neutral-200\" \"div\"\n [\n el ~cls:\"flex items-center justify-center bg-neutral-50 text-sm text-neutral-500\"\n ~attrs:[ View.Attr.make \"style\" (View.dynamic left_style) ] \"div\" [ txt \"Panel A\" ];\n el ~cls:\"w-1.5 cursor-col-resize bg-neutral-200\" \"div\" [];\n el ~cls:\"flex items-center justify-center bg-surface text-sm text-neutral-500\"\n ~attrs:[ View.Attr.make \"style\" (View.dynamic right_style) ] \"div\" [ txt \"Panel B\" ];\n ];\n View.element\n ~attrs:\n [\n View.Attr.type_ (View.static \"range\");\n View.Attr.make \"min\" (View.static \"20\");\n View.Attr.make \"max\" (View.static \"80\");\n View.Attr.value_reactive (fun () -> string_of_int (Signal.get split));\n View.Attr.className (View.static \"w-full accent-neutral-900\");\n ]\n ~events:\n [\n View.On.input (fun e ->\n match int_of_string_opt (Ui.input_value e) with\n | Some n -> Signal.set split n\n | None -> Signal.set split 50);\n ]\n \"input\" [];\n ]")
+ | "search" => Some("module Icon = struct\n (* Fresh host ids so multiple icons of the same name never collide. *)\n let counter = ref 0\n\n let make ?(size : Contracts.Icon.size = `md) ?(label = \"\") ?(extra_class = \"\") ~name () =\n let dims =\n match size with\n | `xs -> \"size-3\"\n | `sm -> \"size-4\"\n | `md -> \"size-5\"\n | `lg -> \"size-6\"\n | `xl -> \"size-8\"\n in\n let body = match Icons.get name with Some b -> b | None -> [] in\n let meaningful = label <> \"\" in\n (* Meaningful icons expose an img role + accessible name; decorative ones are\n hidden so assistive tech doesn't announce them beside their label. *)\n let role_attrs =\n if meaningful then \"role=\\\"img\\\" aria-label=\\\"\" ^ label ^ \"\\\"\" else \"aria-hidden=\\\"true\\\"\"\n in\n let extra = if extra_class = \"\" then \"\" else \" \" ^ extra_class in\n let markup = Icons.svg ~dims ~extra ~role_attrs body in\n View.dyn (fun () ->\n incr counter;\n let id = \"prescriptive-reativa-icon-\" ^ string_of_int !counter in\n Ui.set_inner_html_by_id id markup;\n View.element ~attrs:[ View.Attr.id (View.static id) ] \"span\" [])\nend\n\nmodule IconButton = struct\n let make ?(variant : Contracts.IconButton.variant = `ghost) ?on_click ~label ~children () =\n let tone =\n match variant with\n | `solid -> \"bg-action text-on-action hover:bg-action-hover\"\n | `ghost -> \"text-ink hover:bg-action-subtle\"\n in\n let attrs =\n [\n View.Attr.type_ (View.static \"button\");\n View.Attr.make \"aria-label\" (View.static label);\n View.Attr.className\n (View.static\n (\"inline-flex size-9 items-center justify-center rounded-md text-sm transition-colors \\\n focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action \\\n focus-visible:ring-offset-2 \" ^ tone));\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n View.element ~attrs ~events \"button\" [ View.fragment children ]\nend\n\nmodule Backdrop = struct\n let make ~on_close () =\n
on_close ()) />\nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet search_example () =\n let query = Signal.make \"\" in\n let open_ = Signal.make false in\n let all = [ \"Dashboard\"; \"Settings\"; \"Billing\"; \"Team members\"; \"API keys\" ] in\n let filtered () = List.filter (fun o -> contains_ci o (Signal.get query)) all in\n el ~cls:\"relative w-72\" \"div\"\n [\n el ~cls:\"flex items-center gap-2 rounded-md border border-neutral-300 bg-surface pl-3 pr-1\" \"div\"\n [\n el ~cls:\"text-neutral-400\" \"span\" [ Icon.make ~name:\"search\" ~size:`sm () ];\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static \"flex-1 bg-transparent py-2 text-sm focus:outline-none\");\n View.Attr.placeholder (View.static {js|Search…|js});\n ]\n ~events:\n [\n View.On.on \"focus\" (fun _ -> Signal.set open_ true);\n View.On.input (fun e ->\n Signal.set query (Ui.input_value e);\n Signal.set open_ true);\n ]\n \"input\" [];\n View.show\n (fun () -> Signal.get query <> \"\")\n (IconButton.make ~label:\"Clear search\"\n ~on_click:(fun _ -> Signal.set query \"\")\n ~children:[ txt {js|×|js} ] ());\n ];\n View.show\n (fun () -> Signal.get open_)\n (View.fragment\n [\n Backdrop.make ~on_close:(fun () -> Signal.set open_ false) ();\n el\n ~cls:\n \"absolute z-20 mt-1 w-full rounded-md border border-neutral-200 bg-surface py-1 \\\n shadow-lg\"\n \"ul\"\n [\n View.for_ filtered (fun o ->\n el \"li\"\n [\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static\n \"block w-full px-3 py-1.5 text-left text-sm text-neutral-700 \\\n hover:bg-neutral-100\");\n ]\n ~events:\n [\n View.On.click (fun _ ->\n Signal.set query o;\n Signal.set open_ false);\n ]\n \"button\"\n [ txt o ];\n ]);\n ];\n ])\n ]")
+ | "comment" => Some("module Avatar = struct\n let make ?(size = \"size-10 text-sm\") ~initials () =\n
\n (initials)\n \nend\n\nmodule Badge = struct\n let make ?(variant : Contracts.Badge.variant = `solid) ~children () =\n let tone =\n match variant with\n | `solid -> \"bg-neutral-900 text-neutral-0\"\n | `soft -> \"bg-neutral-200 text-neutral-800\"\n | `outline -> \"border border-neutral-300 text-neutral-700\"\n in\n
\n (View.fragment children)\n \nend\n\nmodule Icon = struct\n (* Fresh host ids so multiple icons of the same name never collide. *)\n let counter = ref 0\n\n let make ?(size : Contracts.Icon.size = `md) ?(label = \"\") ?(extra_class = \"\") ~name () =\n let dims =\n match size with\n | `xs -> \"size-3\"\n | `sm -> \"size-4\"\n | `md -> \"size-5\"\n | `lg -> \"size-6\"\n | `xl -> \"size-8\"\n in\n let body = match Icons.get name with Some b -> b | None -> [] in\n let meaningful = label <> \"\" in\n (* Meaningful icons expose an img role + accessible name; decorative ones are\n hidden so assistive tech doesn't announce them beside their label. *)\n let role_attrs =\n if meaningful then \"role=\\\"img\\\" aria-label=\\\"\" ^ label ^ \"\\\"\" else \"aria-hidden=\\\"true\\\"\"\n in\n let extra = if extra_class = \"\" then \"\" else \" \" ^ extra_class in\n let markup = Icons.svg ~dims ~extra ~role_attrs body in\n View.dyn (fun () ->\n incr counter;\n let id = \"prescriptive-reativa-icon-\" ^ string_of_int !counter in\n Ui.set_inner_html_by_id id markup;\n View.element ~attrs:[ View.Attr.id (View.static id) ] \"span\" [])\nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet comment_example () =\n let liked = Signal.make false in\n let like_cls () =\n \"inline-flex items-center gap-1 \"\n ^ (if Signal.get liked then \"text-status-danger\" else \"hover:text-neutral-900\")\n in\n el ~cls:\"w-full max-w-lg\" \"div\"\n [\n el ~cls:\"flex gap-3\" \"div\"\n [\n Avatar.make ~initials:\"AT\" ~size:\"size-9 text-xs\" ();\n el ~cls:\"flex-1\" \"div\"\n [\n el ~cls:\"flex items-center gap-2\" \"div\"\n [\n el ~cls:\"text-sm font-medium text-neutral-900\" \"span\" [ txt \"Alan Turing\" ];\n Badge.make ~variant:`soft ~children:[ txt \"Author\" ] ();\n el ~cls:\"text-xs text-neutral-400\" \"span\" [ txt \"2h ago\" ];\n ];\n el ~cls:\"mt-1 text-sm text-neutral-700\" \"p\"\n [\n txt\n {js|Great write-up — the section on reuse really clicked for me. Shipping this to my team.|js};\n ];\n el ~cls:\"mt-2 flex gap-3 text-xs text-neutral-500\" \"div\"\n [\n View.element\n ~attrs:[ View.Attr.class_reactive like_cls ]\n ~events:[ View.On.click (fun _ -> Signal.update liked (fun v -> not v)) ]\n \"button\"\n [\n Icon.make ~name:\"heart\" ~size:`sm ();\n View.show ~fallback:(txt \"Like\") (fun () -> Signal.get liked) (txt \"Liked\");\n ];\n el ~cls:\"hover:text-neutral-900\" \"button\" [ txt \"Reply\" ];\n ];\n ];\n ];\n ]")
+ | "form" => Some("module Field = struct\n let make ?(hint = \"\") ~label ~for_ ~children () =\n let label_node =\n View.element\n ~attrs:[ View.Attr.className (View.static Ui.label); View.Attr.make \"for\" (View.static for_) ]\n \"label\"\n [ View.text (View.static label) ]\n in\n let hint_node =\n if hint = \"\" then View.empty\n else
(hint)
\n in\n
\n (label_node)\n (View.fragment children)\n (hint_node)\n
\nend\n\nmodule Input = struct\n let make ?(type_ = \"text\") ?id ?(placeholder = \"\") ?value ?(required = false) ?on_input\n ?(extra_class = \"\") () =\n let attrs =\n [\n View.Attr.type_ (View.static type_);\n View.Attr.placeholder (View.static placeholder);\n View.Attr.className (View.static (Ui.cx Ui.input_base extra_class));\n View.Attr.toggle \"required\" (fun () -> required);\n ]\n in\n let attrs = match id with Some i -> View.Attr.id (View.static i) :: attrs | None -> attrs in\n let attrs = match value with Some v -> View.Attr.value (View.static v) :: attrs | None -> attrs in\n let events = match on_input with Some f -> [ View.On.input f ] | None -> [] in\n View.element ~attrs ~events \"input\" []\nend\n\nmodule Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet form_example () =\n let sent = Signal.make false in\n View.element\n ~attrs:[ View.Attr.className (View.static \"w-80 space-y-4\") ]\n ~events:[ View.On.submit (fun e -> Ui.prevent_default e; Signal.set sent true) ]\n \"form\"\n [\n Field.make ~label:\"Name\" ~for_:\"frm-name\"\n ~children:[ Input.make ~id:\"frm-name\" ~placeholder:\"Ada Lovelace\" ~required:true () ] ();\n Field.make ~label:\"Message\" ~for_:\"frm-msg\"\n ~children:\n [\n View.element\n ~attrs:\n [\n View.Attr.id (View.static \"frm-msg\");\n View.Attr.make \"rows\" (View.static \"3\");\n View.Attr.className (View.static (Ui.input_base ^ \" resize-none\"));\n View.Attr.placeholder (View.static {js|Say hello…|js});\n ]\n \"textarea\" [];\n ]\n ();\n Button.make ~type_:`submit ~variant:`primary ~extra_class:\"w-full\"\n ~children:[ txt \"Send message\" ] ();\n View.show\n (fun () -> Signal.get sent)\n (el ~cls:\"rounded-md bg-neutral-100 px-3 py-2 text-center text-sm text-neutral-700\" \"p\"\n [ txt {js|Thanks — we'll be in touch.|js} ]);\n ]")
+ | "landing-page" => Some("module Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nmodule Badge = struct\n let make ?(variant : Contracts.Badge.variant = `solid) ~children () =\n let tone =\n match variant with\n | `solid -> \"bg-neutral-900 text-neutral-0\"\n | `soft -> \"bg-neutral-200 text-neutral-800\"\n | `outline -> \"border border-neutral-300 text-neutral-700\"\n in\n
\n (View.fragment children)\n \nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet landing_page_example () =\n el ~cls:\"w-full max-w-2xl overflow-hidden rounded-lg border border-neutral-200 bg-surface\" \"div\"\n [\n el ~cls:\"flex items-center justify-between border-b border-neutral-200 px-5 py-3\" \"div\"\n [\n el ~cls:\"font-semibold text-neutral-900\" \"span\" [ txt \"Acme\" ];\n Button.make ~variant:`primary ~children:[ txt \"Start free\" ] ();\n ];\n el ~cls:\"px-8 py-12 text-center\" \"div\"\n [\n Badge.make ~variant:`outline ~children:[ txt {js|New · v2 is here|js} ] ();\n el ~cls:\"mx-auto mt-4 max-w-md text-3xl font-bold tracking-tight text-neutral-900\" \"h2\"\n [ txt \"Ship your product faster\" ];\n el ~cls:\"mx-auto mt-3 max-w-sm text-sm text-neutral-500\" \"p\"\n [\n txt\n {js|One primary action, front and center — everything on the page builds toward it.|js};\n ];\n el ~cls:\"mt-6 flex justify-center gap-3\" \"div\"\n [\n Button.make ~variant:`primary ~children:[ txt \"Get started\" ] ();\n Button.make ~variant:`secondary ~children:[ txt \"Book a demo\" ] ();\n ];\n ];\n ]")
+ | "dashboard" => Some("module Badge = struct\n let make ?(variant : Contracts.Badge.variant = `solid) ~children () =\n let tone =\n match variant with\n | `solid -> \"bg-neutral-900 text-neutral-0\"\n | `soft -> \"bg-neutral-200 text-neutral-800\"\n | `outline -> \"border border-neutral-300 text-neutral-700\"\n in\n
\n (View.fragment children)\n \nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet dashboard_example () =\n let stat label value delta =\n el ~cls:(Ui.card ^ \" p-4\") \"div\"\n [\n el ~cls:\"text-xs text-neutral-500\" \"p\" [ txt label ];\n el ~cls:\"mt-1 text-2xl font-bold text-neutral-900\" \"p\" [ txt value ];\n el ~cls:\"mt-1 text-xs text-neutral-400\" \"p\" [ txt delta ];\n ]\n in\n let bars = [ 50; 72; 40; 88; 63; 45; 70 ] in\n el ~cls:\"w-full max-w-2xl space-y-4\" \"div\"\n [\n el ~cls:\"grid grid-cols-3 gap-4\" \"div\"\n [\n stat \"Revenue\" \"$48.2k\" \"+12% MoM\";\n stat \"Active users\" \"3,190\" \"+4% MoM\";\n stat \"Churn\" \"1.8%\" {js|−0.3% MoM|js};\n ];\n el ~cls:(Ui.card ^ \" p-4\") \"div\"\n [\n el ~cls:\"mb-3 flex items-center justify-between\" \"div\"\n [\n el ~cls:\"text-sm font-medium text-neutral-900\" \"p\" [ txt \"Signups this week\" ];\n Badge.make ~variant:`soft ~children:[ txt \"Live\" ] ();\n ];\n el ~cls:\"flex h-24 items-end gap-2\" \"div\"\n (List.map\n (fun v ->\n el ~cls:\"flex-1 rounded-t bg-neutral-900\"\n ~attrs:\n [ View.Attr.make \"style\" (View.static (\"height:\" ^ string_of_int v ^ \"%\")) ]\n \"div\" [])\n bars);\n ];\n ]")
+ | "settings" => Some("module Switch = struct\n let make ?(label = \"\") ?(disabled = false) ~checked () =\n let track () =\n \"relative inline-flex h-6 w-11 items-center rounded-full transition-colors \"\n ^ (if Signal.get checked then \"bg-action\" else \"bg-neutral-300\")\n ^ if disabled then \" opacity-40\" else \"\"\n in\n let knob () =\n \"inline-block size-5 transform rounded-full bg-surface shadow transition-transform \"\n ^ if Signal.get checked then \"translate-x-5\" else \"translate-x-0.5\"\n in\n let aria_checked () = if Signal.get checked then \"true\" else \"false\" in\n let knob_node = View.element ~attrs:[ View.Attr.class_reactive knob ] \"span\" [] in\n let control =\n View.element\n ~attrs:\n [\n View.Attr.type_ (View.static \"button\");\n View.Attr.make \"role\" (View.static \"switch\");\n View.Attr.make \"aria-checked\" (View.dynamic aria_checked);\n View.Attr.disabled (fun () -> disabled);\n View.Attr.class_reactive track;\n ]\n ~events:\n [ View.On.click (fun _ -> if disabled then () else Signal.update checked (fun v -> not v)) ]\n \"button\" [ knob_node ]\n in\n let label_cls = if disabled then \"flex items-center gap-3 cursor-not-allowed\" else \"flex items-center gap-3\" in\n View.element\n ~attrs:[ View.Attr.className (View.static label_cls) ]\n \"label\"\n [\n control;\n (if label = \"\" then View.empty\n else
(label));\n ]\nend\n\nmodule Field = struct\n let make ?(hint = \"\") ~label ~for_ ~children () =\n let label_node =\n View.element\n ~attrs:[ View.Attr.className (View.static Ui.label); View.Attr.make \"for\" (View.static for_) ]\n \"label\"\n [ View.text (View.static label) ]\n in\n let hint_node =\n if hint = \"\" then View.empty\n else
(hint)
\n in\n
\n (label_node)\n (View.fragment children)\n (hint_node)\n
\nend\n\nmodule Input = struct\n let make ?(type_ = \"text\") ?id ?(placeholder = \"\") ?value ?(required = false) ?on_input\n ?(extra_class = \"\") () =\n let attrs =\n [\n View.Attr.type_ (View.static type_);\n View.Attr.placeholder (View.static placeholder);\n View.Attr.className (View.static (Ui.cx Ui.input_base extra_class));\n View.Attr.toggle \"required\" (fun () -> required);\n ]\n in\n let attrs = match id with Some i -> View.Attr.id (View.static i) :: attrs | None -> attrs in\n let attrs = match value with Some v -> View.Attr.value (View.static v) :: attrs | None -> attrs in\n let events = match on_input with Some f -> [ View.On.input f ] | None -> [] in\n View.element ~attrs ~events \"input\" []\nend\n\nmodule Separator = struct\n let make ?(orientation : Contracts.Separator.orientation = `horizontal) ?(extra_class = \"\") () =\n let base =\n match orientation with\n | `horizontal -> \"h-px w-full bg-neutral-200\"\n | `vertical -> \"h-4 w-px bg-neutral-200\"\n in\n View.element\n ~attrs:\n [\n View.Attr.className (View.static (Ui.cx base extra_class));\n View.Attr.make \"role\" (View.static \"separator\");\n ]\n \"div\" []\nend\n\nmodule Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet settings_example () =\n let notifications = Signal.make true in\n let marketing = Signal.make false in\n let row text sig_ =\n el ~cls:\"flex items-center justify-between\" \"div\"\n [ el ~cls:\"text-sm text-neutral-800\" \"span\" [ txt text ]; Switch.make ~checked:sig_ () ]\n in\n el ~cls:\"w-full max-w-lg space-y-5 rounded-lg border border-neutral-200 bg-surface p-6\" \"div\"\n [\n el \"div\"\n [\n el ~cls:\"text-sm font-semibold text-neutral-900\" \"h3\" [ txt \"Profile\" ];\n el ~cls:\"text-xs text-neutral-500\" \"p\" [ txt \"Update your account details.\" ];\n ];\n Field.make ~label:\"Display name\" ~for_:\"set-name\"\n ~children:[ Input.make ~id:\"set-name\" ~value:\"Ada Lovelace\" () ] ();\n Separator.make ();\n el ~cls:\"space-y-3\" \"div\"\n [ row \"Product notifications\" notifications; row \"Marketing emails\" marketing ];\n el ~cls:\"flex justify-end gap-2\" \"div\"\n [\n Button.make ~variant:`ghost ~children:[ txt \"Cancel\" ] ();\n Button.make ~variant:`primary ~children:[ txt \"Save changes\" ] ();\n ];\n ]")
+ | "sign-in" => Some("module Field = struct\n let make ?(hint = \"\") ~label ~for_ ~children () =\n let label_node =\n View.element\n ~attrs:[ View.Attr.className (View.static Ui.label); View.Attr.make \"for\" (View.static for_) ]\n \"label\"\n [ View.text (View.static label) ]\n in\n let hint_node =\n if hint = \"\" then View.empty\n else
(hint)
\n in\n
\n (label_node)\n (View.fragment children)\n (hint_node)\n
\nend\n\nmodule Input = struct\n let make ?(type_ = \"text\") ?id ?(placeholder = \"\") ?value ?(required = false) ?on_input\n ?(extra_class = \"\") () =\n let attrs =\n [\n View.Attr.type_ (View.static type_);\n View.Attr.placeholder (View.static placeholder);\n View.Attr.className (View.static (Ui.cx Ui.input_base extra_class));\n View.Attr.toggle \"required\" (fun () -> required);\n ]\n in\n let attrs = match id with Some i -> View.Attr.id (View.static i) :: attrs | None -> attrs in\n let attrs = match value with Some v -> View.Attr.value (View.static v) :: attrs | None -> attrs in\n let events = match on_input with Some f -> [ View.On.input f ] | None -> [] in\n View.element ~attrs ~events \"input\" []\nend\n\nmodule Link = struct\n let make ?(href = \"#\") ?(variant : Contracts.Link.variant = `default) ?(new_tab = false)\n ?(extra_class = \"\") ~children () =\n let base =\n match variant with\n | `default ->\n \"text-neutral-900 underline decoration-neutral-300 underline-offset-4 hover:decoration-neutral-900\"\n | `muted -> \"text-neutral-500 transition-colors hover:text-neutral-900\"\n in\n let attrs =\n [\n View.Attr.href (View.static href);\n View.Attr.className (View.static (Ui.cx base extra_class));\n ]\n in\n let attrs =\n if new_tab then View.Attr.make \"target\" (View.static \"_blank\") :: attrs else attrs\n in\n View.element ~attrs \"a\" [ View.fragment children ]\nend\n\nmodule Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nmodule Link_ = Link\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet sign_in_example () =\n let remember = Signal.make true in\n el ~cls:\"w-full max-w-sm space-y-5 rounded-lg border border-neutral-200 bg-surface p-6\" \"div\"\n [\n el ~cls:\"text-center\" \"div\"\n [\n el\n ~cls:\n \"mx-auto mb-2 flex size-9 items-center justify-center rounded-md bg-neutral-900 \\\n text-sm font-bold text-neutral-0\"\n \"div\" [ txt \"U\" ];\n el ~cls:\"text-lg font-semibold text-neutral-900\" \"h3\" [ txt \"Welcome back\" ];\n el ~cls:\"text-sm text-neutral-500\" \"p\" [ txt \"Sign in to your account\" ];\n ];\n Field.make ~label:\"Email\" ~for_:\"si-email\"\n ~children:[ Input.make ~id:\"si-email\" ~type_:\"email\" ~placeholder:\"you@example.com\" () ]\n ();\n Field.make ~label:\"Password\" ~for_:\"si-pass\"\n ~children:[ Input.make ~id:\"si-pass\" ~type_:\"password\" ~placeholder:{js|••••••••|js} () ]\n ();\n el ~cls:\"flex items-center justify-between text-sm\" \"div\"\n [\n el ~cls:\"flex items-center gap-2\" \"div\"\n [\n View.element\n ~attrs:\n [\n View.Attr.type_ (View.static \"checkbox\");\n View.Attr.checked (View.dynamic (fun () -> Signal.get remember));\n View.Attr.className (View.static \"size-4 accent-neutral-900\");\n ]\n ~events:[ View.On.change (fun e -> Signal.set remember (Ui.checked e)) ]\n \"input\" [];\n el ~cls:\"text-neutral-700\" \"span\" [ txt \"Remember me\" ];\n ];\n Link_.make ~href:\"#\" ~children:[ txt \"Forgot?\" ] ();\n ];\n Button.make ~variant:`primary ~extra_class:\"w-full\" ~children:[ txt \"Sign in\" ] ();\n el ~cls:\"text-center text-sm text-neutral-500\" \"p\"\n [ txt \"No account? \"; Link_.make ~href:\"#\" ~children:[ txt \"Create one\" ] () ];\n ]")
+ | "pricing" => Some("module Badge = struct\n let make ?(variant : Contracts.Badge.variant = `solid) ~children () =\n let tone =\n match variant with\n | `solid -> \"bg-neutral-900 text-neutral-0\"\n | `soft -> \"bg-neutral-200 text-neutral-800\"\n | `outline -> \"border border-neutral-300 text-neutral-700\"\n in\n
\n (View.fragment children)\n \nend\n\nmodule Icon = struct\n (* Fresh host ids so multiple icons of the same name never collide. *)\n let counter = ref 0\n\n let make ?(size : Contracts.Icon.size = `md) ?(label = \"\") ?(extra_class = \"\") ~name () =\n let dims =\n match size with\n | `xs -> \"size-3\"\n | `sm -> \"size-4\"\n | `md -> \"size-5\"\n | `lg -> \"size-6\"\n | `xl -> \"size-8\"\n in\n let body = match Icons.get name with Some b -> b | None -> [] in\n let meaningful = label <> \"\" in\n (* Meaningful icons expose an img role + accessible name; decorative ones are\n hidden so assistive tech doesn't announce them beside their label. *)\n let role_attrs =\n if meaningful then \"role=\\\"img\\\" aria-label=\\\"\" ^ label ^ \"\\\"\" else \"aria-hidden=\\\"true\\\"\"\n in\n let extra = if extra_class = \"\" then \"\" else \" \" ^ extra_class in\n let markup = Icons.svg ~dims ~extra ~role_attrs body in\n View.dyn (fun () ->\n incr counter;\n let id = \"prescriptive-reativa-icon-\" ^ string_of_int !counter in\n Ui.set_inner_html_by_id id markup;\n View.element ~attrs:[ View.Attr.id (View.static id) ] \"span\" [])\nend\n\nmodule Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet pricing_example () =\n let plan name price feats recommended =\n let card_cls =\n if recommended then Ui.card ^ \" p-5 ring-2 ring-neutral-900\" else Ui.card ^ \" p-5\"\n in\n el ~cls:card_cls \"div\"\n [\n el ~cls:\"flex items-center justify-between\" \"div\"\n [\n el ~cls:\"text-sm font-semibold text-neutral-900\" \"p\" [ txt name ];\n (if recommended then Badge.make ~variant:`solid ~children:[ txt \"Popular\" ] ()\n else View.empty);\n ];\n el ~cls:\"mt-2\" \"p\"\n [\n el ~cls:\"text-3xl font-bold text-neutral-900\" \"span\" [ txt price ];\n el ~cls:\"text-sm text-neutral-500\" \"span\" [ txt \"/mo\" ];\n ];\n el ~cls:\"mt-3 space-y-1 text-sm text-neutral-600\" \"ul\"\n (List.map\n (fun f ->\n el ~cls:\"flex items-center gap-2\" \"li\"\n [\n Icon.make ~name:\"check\" ~size:`sm ~extra_class:\"text-status-success\" ();\n txt f;\n ])\n feats);\n el ~cls:\"mt-4\" \"div\"\n [\n Button.make\n ~variant:(if recommended then `primary else `secondary)\n ~extra_class:\"w-full\" ~children:[ txt \"Choose\" ] ();\n ];\n ]\n in\n el ~cls:\"grid w-full max-w-2xl grid-cols-3 gap-4\" \"div\"\n [\n plan \"Starter\" \"$0\" [ \"1 project\"; \"Community support\" ] false;\n plan \"Pro\" \"$12\" [ \"Unlimited projects\"; \"Priority support\"; \"Analytics\" ] true;\n plan \"Team\" \"$29\" [ \"Everything in Pro\"; \"SSO\"; \"Audit log\" ] false;\n ]")
+ | "authentication" => Some("module Field = struct\n let make ?(hint = \"\") ~label ~for_ ~children () =\n let label_node =\n View.element\n ~attrs:[ View.Attr.className (View.static Ui.label); View.Attr.make \"for\" (View.static for_) ]\n \"label\"\n [ View.text (View.static label) ]\n in\n let hint_node =\n if hint = \"\" then View.empty\n else
(hint)
\n in\n
\n (label_node)\n (View.fragment children)\n (hint_node)\n
\nend\n\nmodule Input = struct\n let make ?(type_ = \"text\") ?id ?(placeholder = \"\") ?value ?(required = false) ?on_input\n ?(extra_class = \"\") () =\n let attrs =\n [\n View.Attr.type_ (View.static type_);\n View.Attr.placeholder (View.static placeholder);\n View.Attr.className (View.static (Ui.cx Ui.input_base extra_class));\n View.Attr.toggle \"required\" (fun () -> required);\n ]\n in\n let attrs = match id with Some i -> View.Attr.id (View.static i) :: attrs | None -> attrs in\n let attrs = match value with Some v -> View.Attr.value (View.static v) :: attrs | None -> attrs in\n let events = match on_input with Some f -> [ View.On.input f ] | None -> [] in\n View.element ~attrs ~events \"input\" []\nend\n\nmodule Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet authentication_example () =\n let step = Signal.make 1 in\n let step_label () = \"Step \" ^ string_of_int (Signal.get step) ^ \" of 2\" in\n let on_step1 () = Signal.get step = 1 in\n el ~cls:\"w-full max-w-sm rounded-lg border border-neutral-200 bg-surface p-6\" \"div\"\n [\n el ~cls:\"text-xs text-neutral-400\" \"p\" [ View.dyn_text step_label ];\n View.show\n ~fallback:\n (el ~cls:\"mt-2 space-y-4\" \"div\"\n [\n el ~cls:\"text-lg font-semibold text-neutral-900\" \"h3\" [ txt \"Enter your code\" ];\n el ~cls:\"text-sm text-neutral-500\" \"p\"\n [ txt \"We sent a 6-digit code to your email.\" ];\n Field.make ~label:\"Verification code\" ~for_:\"auth-code\"\n ~children:[ Input.make ~id:\"auth-code\" ~placeholder:\"123456\" () ] ();\n Button.make ~variant:`primary ~extra_class:\"w-full\"\n ~on_click:(fun _ -> Signal.set step 1) ~children:[ txt \"Verify\" ] ();\n ])\n on_step1\n (el ~cls:\"mt-2 space-y-4\" \"div\"\n [\n el ~cls:\"text-lg font-semibold text-neutral-900\" \"h3\" [ txt \"Sign in\" ];\n Field.make ~label:\"Email\" ~for_:\"auth-email\"\n ~children:\n [ Input.make ~id:\"auth-email\" ~type_:\"email\" ~placeholder:\"you@example.com\" () ]\n ();\n Field.make ~label:\"Password\" ~for_:\"auth-pass\"\n ~children:\n [ Input.make ~id:\"auth-pass\" ~type_:\"password\" ~placeholder:{js|••••••••|js} () ]\n ();\n Button.make ~variant:`primary ~extra_class:\"w-full\"\n ~on_click:(fun _ -> Signal.set step 2) ~children:[ txt \"Continue\" ] ();\n ]);\n ]")
+ | "onboarding" => Some("module Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet onboarding_example () =\n let step = Signal.make 1 in\n let total = 3 in\n let pct () = \"height:100%;width:\" ^ string_of_int (Signal.get step * 100 / total) ^ \"%\" in\n let title () =\n match Signal.get step with\n | 1 -> \"Welcome to Acme\"\n | 2 -> \"Set up your workspace\"\n | _ -> \"Invite your team\"\n in\n let body () =\n match Signal.get step with\n | 1 -> \"Let's get you set up in a couple of steps.\"\n | 2 -> \"Name your workspace and pick a theme.\"\n | _ -> \"Add teammates to collaborate. You can skip this.\"\n in\n let next_label () = if Signal.get step = total then \"Finish\" else \"Next\" in\n el ~cls:\"w-full max-w-md rounded-lg border border-neutral-200 bg-surface p-6\" \"div\"\n [\n el ~cls:\"h-1.5 w-full overflow-hidden rounded-full bg-neutral-200\" \"div\"\n [\n el ~cls:\"rounded-full bg-neutral-900 transition-all\"\n ~attrs:[ View.Attr.make \"style\" (View.dynamic pct) ] \"div\" [];\n ];\n el ~cls:\"mt-4 text-lg font-semibold text-neutral-900\" \"h3\" [ View.dyn_text title ];\n el ~cls:\"mt-1 text-sm text-neutral-500\" \"p\" [ View.dyn_text body ];\n el ~cls:\"mt-5 flex justify-between\" \"div\"\n [\n Button.make ~variant:`ghost\n ~on_click:(fun _ -> Signal.update step (fun s -> if s > 1 then s - 1 else 1))\n ~children:[ txt \"Back\" ] ();\n Button.make ~variant:`primary\n ~on_click:(fun _ -> Signal.update step (fun s -> if s < total then s + 1 else 1))\n ~children:[ View.dyn_text next_label ] ();\n ];\n ]")
+ | "checkout" => Some("module Field = struct\n let make ?(hint = \"\") ~label ~for_ ~children () =\n let label_node =\n View.element\n ~attrs:[ View.Attr.className (View.static Ui.label); View.Attr.make \"for\" (View.static for_) ]\n \"label\"\n [ View.text (View.static label) ]\n in\n let hint_node =\n if hint = \"\" then View.empty\n else
(hint)
\n in\n
\n (label_node)\n (View.fragment children)\n (hint_node)\n
\nend\n\nmodule Input = struct\n let make ?(type_ = \"text\") ?id ?(placeholder = \"\") ?value ?(required = false) ?on_input\n ?(extra_class = \"\") () =\n let attrs =\n [\n View.Attr.type_ (View.static type_);\n View.Attr.placeholder (View.static placeholder);\n View.Attr.className (View.static (Ui.cx Ui.input_base extra_class));\n View.Attr.toggle \"required\" (fun () -> required);\n ]\n in\n let attrs = match id with Some i -> View.Attr.id (View.static i) :: attrs | None -> attrs in\n let attrs = match value with Some v -> View.Attr.value (View.static v) :: attrs | None -> attrs in\n let events = match on_input with Some f -> [ View.On.input f ] | None -> [] in\n View.element ~attrs ~events \"input\" []\nend\n\nmodule Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nmodule Separator = struct\n let make ?(orientation : Contracts.Separator.orientation = `horizontal) ?(extra_class = \"\") () =\n let base =\n match orientation with\n | `horizontal -> \"h-px w-full bg-neutral-200\"\n | `vertical -> \"h-4 w-px bg-neutral-200\"\n in\n View.element\n ~attrs:\n [\n View.Attr.className (View.static (Ui.cx base extra_class));\n View.Attr.make \"role\" (View.static \"separator\");\n ]\n \"div\" []\nend\n\nlet txt s = View.text (View.static s)\n\nlet el ?(cls = \"\") ?(attrs = []) ?(events = []) tag children =\n let attrs = if cls = \"\" then attrs else View.Attr.className (View.static cls) :: attrs in\n View.element ~attrs ~events tag children\n\nlet checkout_example () =\n let items = [ (\"Pro plan (annual)\", \"$120.00\"); (\"Add-on: Analytics\", \"$24.00\") ] in\n el ~cls:\"grid w-full max-w-2xl gap-4 sm:grid-cols-2\" \"div\"\n [\n el ~cls:\"space-y-4 rounded-lg border border-neutral-200 bg-surface p-5\" \"div\"\n [\n el ~cls:\"text-sm font-semibold text-neutral-900\" \"h3\" [ txt \"Payment details\" ];\n Field.make ~label:\"Card number\" ~for_:\"co-card\"\n ~children:[ Input.make ~id:\"co-card\" ~placeholder:\"4242 4242 4242 4242\" () ] ();\n el ~cls:\"grid grid-cols-2 gap-3\" \"div\"\n [\n Field.make ~label:\"Expiry\" ~for_:\"co-exp\"\n ~children:[ Input.make ~id:\"co-exp\" ~placeholder:\"MM/YY\" () ] ();\n Field.make ~label:\"CVC\" ~for_:\"co-cvc\"\n ~children:[ Input.make ~id:\"co-cvc\" ~placeholder:\"123\" () ] ();\n ];\n Button.make ~variant:`primary ~extra_class:\"w-full\"\n ~children:[ txt \"Pay $144.00\" ] ();\n ];\n el ~cls:\"space-y-3 rounded-lg border border-neutral-200 bg-neutral-50 p-5\" \"div\"\n [\n el ~cls:\"text-sm font-semibold text-neutral-900\" \"h3\" [ txt \"Order summary\" ];\n el ~cls:\"space-y-2 text-sm\" \"ul\"\n (List.map\n (fun (name, price) ->\n el ~cls:\"flex justify-between text-neutral-700\" \"li\"\n [ txt name; el ~cls:\"tabular-nums\" \"span\" [ txt price ] ])\n items);\n Separator.make ();\n el ~cls:\"flex justify-between text-sm font-semibold text-neutral-900\" \"div\"\n [ txt \"Total\"; el ~cls:\"tabular-nums\" \"span\" [ txt \"$144.00\" ] ];\n ];\n ]")
+ | "announcement-bar" => Some("module Icon = struct\n (* Fresh host ids so multiple icons of the same name never collide. *)\n let counter = ref 0\n\n let make ?(size : Contracts.Icon.size = `md) ?(label = \"\") ?(extra_class = \"\") ~name () =\n let dims =\n match size with\n | `xs -> \"size-3\"\n | `sm -> \"size-4\"\n | `md -> \"size-5\"\n | `lg -> \"size-6\"\n | `xl -> \"size-8\"\n in\n let body = match Icons.get name with Some b -> b | None -> [] in\n let meaningful = label <> \"\" in\n (* Meaningful icons expose an img role + accessible name; decorative ones are\n hidden so assistive tech doesn't announce them beside their label. *)\n let role_attrs =\n if meaningful then \"role=\\\"img\\\" aria-label=\\\"\" ^ label ^ \"\\\"\" else \"aria-hidden=\\\"true\\\"\"\n in\n let extra = if extra_class = \"\" then \"\" else \" \" ^ extra_class in\n let markup = Icons.svg ~dims ~extra ~role_attrs body in\n View.dyn (fun () ->\n incr counter;\n let id = \"prescriptive-reativa-icon-\" ^ string_of_int !counter in\n Ui.set_inner_html_by_id id markup;\n View.element ~attrs:[ View.Attr.id (View.static id) ] \"span\" [])\nend\n\nmodule IconButton = struct\n let make ?(variant : Contracts.IconButton.variant = `ghost) ?on_click ~label ~children () =\n let tone =\n match variant with\n | `solid -> \"bg-action text-on-action hover:bg-action-hover\"\n | `ghost -> \"text-ink hover:bg-action-subtle\"\n in\n let attrs =\n [\n View.Attr.type_ (View.static \"button\");\n View.Attr.make \"aria-label\" (View.static label);\n View.Attr.className\n (View.static\n (\"inline-flex size-9 items-center justify-center rounded-md text-sm transition-colors \\\n focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action \\\n focus-visible:ring-offset-2 \" ^ tone));\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n View.element ~attrs ~events \"button\" [ View.fragment children ]\nend\n\nmodule AnnouncementBar = struct\n let make ?(variant : Contracts.AnnouncementBar.variant = `neutral) ?(action_label = \"\")\n ?(action_href = \"#\") ?on_dismiss ~message () =\n let open_ = Signal.make true in\n let dismiss _ =\n Signal.set open_ false;\n match on_dismiss with Some f -> f () | None -> ()\n in\n let surface, icon_name, icon_cls =\n match variant with\n | `neutral -> (\"border-b border-border bg-surface text-ink\", \"info\", \"text-muted\")\n | `accent -> (\"bg-accent text-accent-contrast\", \"zap\", \"text-accent-contrast\")\n | `warning ->\n (\"border-b border-status-warning bg-surface text-ink\", \"alert-triangle\", \"text-status-warning\")\n in\n let link_cls =\n match variant with\n | `accent -> \"font-medium underline underline-offset-2 hover:opacity-80\"\n | `neutral | `warning ->\n \"font-medium text-ink underline underline-offset-2 hover:text-muted\"\n in\n View.show\n (fun () -> Signal.get open_)\n (View.element\n ~attrs:\n [\n View.Attr.className\n (View.static\n (\"flex w-full flex-wrap items-center justify-center gap-x-3 gap-y-1 px-4 py-2 text-sm \"\n ^ surface));\n ]\n \"div\"\n [\n
(Icon.make ~name:icon_name ~size:`sm ());\n
(message)
;\n (if action_label = \"\" then View.empty\n else\n View.element\n ~attrs:\n [ View.Attr.href (View.static action_href); View.Attr.className (View.static link_cls) ]\n \"a\"\n [ View.text (View.static action_label) ]);\n
\n (IconButton.make ~label:\"Dismiss announcement\" ~variant:`ghost ~on_click:dismiss\n ~children:[ Icon.make ~name:\"x\" ~size:`sm () ] ())\n ;\n ])\nend\n\nlet announcement_bar_example () =\n
\n (AnnouncementBar.make ~variant:`accent ~message:{js|v2 ships May 4 — everything gets faster.|js}\n ~action_label:\"See what's new\" ())\n (AnnouncementBar.make ~variant:`neutral ~message:\"We've updated our terms of service.\"\n ~action_label:\"Read the changes\" ())\n (AnnouncementBar.make ~variant:`warning\n ~message:{js|Scheduled maintenance Sunday 02:00–04:00 UTC.|js} ())\n
")
+ | "contact-section" => Some("module Icon = struct\n (* Fresh host ids so multiple icons of the same name never collide. *)\n let counter = ref 0\n\n let make ?(size : Contracts.Icon.size = `md) ?(label = \"\") ?(extra_class = \"\") ~name () =\n let dims =\n match size with\n | `xs -> \"size-3\"\n | `sm -> \"size-4\"\n | `md -> \"size-5\"\n | `lg -> \"size-6\"\n | `xl -> \"size-8\"\n in\n let body = match Icons.get name with Some b -> b | None -> [] in\n let meaningful = label <> \"\" in\n (* Meaningful icons expose an img role + accessible name; decorative ones are\n hidden so assistive tech doesn't announce them beside their label. *)\n let role_attrs =\n if meaningful then \"role=\\\"img\\\" aria-label=\\\"\" ^ label ^ \"\\\"\" else \"aria-hidden=\\\"true\\\"\"\n in\n let extra = if extra_class = \"\" then \"\" else \" \" ^ extra_class in\n let markup = Icons.svg ~dims ~extra ~role_attrs body in\n View.dyn (fun () ->\n incr counter;\n let id = \"prescriptive-reativa-icon-\" ^ string_of_int !counter in\n Ui.set_inner_html_by_id id markup;\n View.element ~attrs:[ View.Attr.id (View.static id) ] \"span\" [])\nend\n\nmodule Field = struct\n let make ?(hint = \"\") ~label ~for_ ~children () =\n let label_node =\n View.element\n ~attrs:[ View.Attr.className (View.static Ui.label); View.Attr.make \"for\" (View.static for_) ]\n \"label\"\n [ View.text (View.static label) ]\n in\n let hint_node =\n if hint = \"\" then View.empty\n else
(hint)
\n in\n
\n (label_node)\n (View.fragment children)\n (hint_node)\n
\nend\n\nmodule Input = struct\n let make ?(type_ = \"text\") ?id ?(placeholder = \"\") ?value ?(required = false) ?on_input\n ?(extra_class = \"\") () =\n let attrs =\n [\n View.Attr.type_ (View.static type_);\n View.Attr.placeholder (View.static placeholder);\n View.Attr.className (View.static (Ui.cx Ui.input_base extra_class));\n View.Attr.toggle \"required\" (fun () -> required);\n ]\n in\n let attrs = match id with Some i -> View.Attr.id (View.static i) :: attrs | None -> attrs in\n let attrs = match value with Some v -> View.Attr.value (View.static v) :: attrs | None -> attrs in\n let events = match on_input with Some f -> [ View.On.input f ] | None -> [] in\n View.element ~attrs ~events \"input\" []\nend\n\nmodule Textarea = struct\n let make ?(placeholder = \"\") ?(rows = 3) ?(required = false) ?id ?(extra_class = \"\") ?on_input\n ~value () =\n let handle ev =\n Signal.set value (Ui.input_value ev);\n match on_input with Some f -> f ev | None -> ()\n in\n let attrs =\n [\n View.Attr.make \"rows\" (View.static (string_of_int rows));\n View.Attr.placeholder (View.static placeholder);\n View.Attr.className (View.static (Ui.cx (Ui.input_base ^ \" resize-y\") extra_class));\n View.Attr.toggle \"required\" (fun () -> required);\n ]\n in\n let attrs = match id with Some i -> View.Attr.id (View.static i) :: attrs | None -> attrs in\n View.element ~attrs ~events:[ View.On.input handle ] \"textarea\" []\nend\n\nmodule Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nmodule ContactSection = struct\n let make ?(description = \"\") ?(details = []) ?on_submit ~heading () =\n let name = Signal.make \"\" in\n let email = Signal.make \"\" in\n let message = Signal.make \"\" in\n let sent = Signal.make false in\n let submit ev =\n Ui.prevent_default ev;\n (match on_submit with\n | Some f -> f (Signal.get name, Signal.get email, Signal.get message)\n | None -> ());\n Signal.set sent true\n in\n let detail_row (icon, label, href) =\n View.element ~attrs:[] \"li\"\n [\n View.element\n ~attrs:\n [\n View.Attr.href (View.static href);\n View.Attr.className (View.static \"group inline-flex items-center gap-3 text-sm text-ink\");\n ]\n \"a\"\n [\n
\n (Icon.make ~name:icon ())\n ;\n
(label);\n ];\n ]\n in\n let form_node =\n View.element\n ~attrs:[ View.Attr.className (View.static \"mt-6 space-y-4\") ]\n ~events:[ View.On.submit submit ]\n \"form\"\n [\n
\n (Field.make ~label:\"Name\" ~for_:\"contact-name\"\n ~children:\n [\n Input.make ~id:\"contact-name\" ~placeholder:\"Ada Lovelace\" ~required:true\n ~on_input:(fun e -> Signal.set name (Ui.input_value e))\n ();\n ]\n ())\n (Field.make ~label:\"Email\" ~for_:\"contact-email\"\n ~children:\n [\n Input.make ~id:\"contact-email\" ~type_:\"email\" ~placeholder:\"ada@example.com\"\n ~required:true\n ~on_input:(fun e -> Signal.set email (Ui.input_value e))\n ();\n ]\n ())\n
;\n (Field.make ~label:\"Message\" ~for_:\"contact-message\"\n ~children:\n [\n Textarea.make ~id:\"contact-message\" ~rows:4 ~required:true ~extra_class:\"resize-none\"\n ~placeholder:\"How can we help?\" ~value:message ();\n ]\n ());\n (Button.make ~type_:`submit ~variant:`primary\n ~children:[ View.text (View.static \"Send message\") ] ());\n (View.element\n ~attrs:[ View.Attr.make \"role\" (View.static \"status\") ]\n \"div\"\n [\n View.show\n (fun () -> Signal.get sent)\n (
\n ({js|Thanks — your message is on its way. We reply within one business day.|js})\n
);\n ]);\n ]\n in\n View.element\n ~attrs:[ View.Attr.className (View.static \"grid w-full gap-10 md:grid-cols-5\") ]\n \"section\"\n [\n
\n
(heading)
\n (if description = \"\" then View.empty\n else
(description)
)\n (form_node)\n
;\n (if details = [] then View.empty\n else\n View.element\n ~attrs:[ View.Attr.className (View.static \"space-y-4 md:col-span-2 md:pt-12\") ]\n \"ul\"\n (List.map detail_row details));\n ]\nend\n\nlet contact_section_example () =\n
\n (ContactSection.make ~heading:\"Talk to us\"\n ~description:\"Questions about specs, tokens, or the agent skill? We reply within one business day.\"\n ~details:\n [\n (\"mail\", \"hello@acme.dev\", \"mailto:hello@acme.dev\");\n (\"github\", \"acme/support\", \"https://github.com\");\n ]\n ())\n
")
| "logo-cloud" => Some("module LogoCloud = struct\n let make ?(heading = \"\") ~logos () =\n let logo_item name =\n View.element ~attrs:[] \"li\"\n [\n View.element\n ~attrs:\n [\n View.Attr.make \"role\" (View.static \"img\");\n View.Attr.make \"aria-label\" (View.static name);\n View.Attr.className\n (View.static \"text-lg font-semibold tracking-tight text-neutral-400 select-none\");\n ]\n \"span\"\n [ View.text (View.static name) ];\n ]\n in\n View.element\n ~attrs:[ View.Attr.className (View.static \"w-full py-6 text-center\") ]\n \"section\"\n [\n (if heading = \"\" then View.empty\n else\n
(heading)
);\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static \"flex flex-wrap items-center justify-center gap-x-10 gap-y-5\");\n ]\n \"ul\"\n (List.map logo_item logos);\n ]\nend\n\nlet logo_cloud_example () =\n
\n (LogoCloud.make ~heading:\"Trusted by teams at\"\n ~logos:[ \"Acme\"; \"Northwind\"; \"Globex\"; \"Initech\"; \"Umbrella\"; \"Aperture\" ] ())\n
")
- | "newsletter" => Some("module Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nmodule Icon = struct\n (* Fresh host ids so multiple icons of the same name never collide. *)\n let counter = ref 0\n\n let make ?(size : Contracts.Icon.size = `md) ?(label = \"\") ?(extra_class = \"\") ~name () =\n let dims =\n match size with\n | `xs -> \"size-3\"\n | `sm -> \"size-4\"\n | `md -> \"size-5\"\n | `lg -> \"size-6\"\n | `xl -> \"size-8\"\n in\n let body = match Icons.get name with Some b -> b | None -> [] in\n let meaningful = label <> \"\" in\n (* Meaningful icons expose an img role + accessible name; decorative ones are\n hidden so assistive tech doesn't announce them beside their label. *)\n let role_attrs =\n if meaningful then \"role=\\\"img\\\" aria-label=\\\"\" ^ label ^ \"\\\"\" else \"aria-hidden=\\\"true\\\"\"\n in\n let extra = if extra_class = \"\" then \"\" else \" \" ^ extra_class in\n let markup = Icons.svg ~dims ~extra ~role_attrs body in\n View.dyn (fun () ->\n incr counter;\n let id = \"prescriptive-reativa-icon-\" ^ string_of_int !counter in\n Ui.set_inner_html_by_id id markup;\n View.element ~attrs:[ View.Attr.id (View.static id) ] \"span\" [])\nend\n\nmodule Newsletter = struct\n let make ?(description = \"\") ?(consent = \"\") ?on_subscribe ~heading () =\n let email = Signal.make \"\" in\n let done_ = Signal.make false in\n let submit ev =\n Ui.prevent_default ev;\n (match on_subscribe with Some f -> f (Signal.get email) | None -> ());\n Signal.set done_ true\n in\n let form_node =\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static \"mx-auto mt-5 flex w-full max-w-md flex-col gap-2 sm:flex-row\");\n ]\n ~events:[ View.On.submit submit ]\n \"form\"\n [\n View.element\n ~attrs:\n [\n View.Attr.type_ (View.static \"email\");\n View.Attr.toggle \"required\" (fun () -> true);\n View.Attr.make \"aria-label\" (View.static \"Email address\");\n View.Attr.placeholder (View.static \"you@example.com\");\n View.Attr.className (View.static (Ui.input_base ^ \" flex-1\"));\n ]\n ~events:[ View.On.input (fun e -> Signal.set email (Ui.input_value e)) ]\n \"input\" [];\n (Button.make ~type_:`submit ~variant:`primary\n ~children:[ View.text (View.static \"Subscribe\") ] ());\n ]\n in\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static \"w-full rounded-2xl border border-border bg-surface p-8 text-center\");\n ]\n \"section\"\n [\n
(heading)
;\n (if description = \"\" then View.empty\n else
(description)
);\n (View.show (fun () -> not (Signal.get done_)) form_node);\n (View.element\n ~attrs:[ View.Attr.make \"role\" (View.static \"status\") ]\n \"div\"\n [\n View.show\n (fun () -> Signal.get done_)\n (
\n (Icon.make ~name:\"check-circle\" ())\n (\"Almost there \\xe2\\x80\\x94 check your inbox to confirm.\")\n
);\n ]);\n (if consent = \"\" then View.empty\n else
(consent)
);\n ]\nend\n\nlet newsletter_example () =\n
\n (Newsletter.make ~heading:\"Get the monthly digest\"\n ~description:\"One email a month: new specs, patterns, and releases. No spam.\"\n ~consent:\"By subscribing you agree to the privacy policy. Unsubscribe anytime.\" ())\n
")
+ | "newsletter" => Some("module Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nmodule Icon = struct\n (* Fresh host ids so multiple icons of the same name never collide. *)\n let counter = ref 0\n\n let make ?(size : Contracts.Icon.size = `md) ?(label = \"\") ?(extra_class = \"\") ~name () =\n let dims =\n match size with\n | `xs -> \"size-3\"\n | `sm -> \"size-4\"\n | `md -> \"size-5\"\n | `lg -> \"size-6\"\n | `xl -> \"size-8\"\n in\n let body = match Icons.get name with Some b -> b | None -> [] in\n let meaningful = label <> \"\" in\n (* Meaningful icons expose an img role + accessible name; decorative ones are\n hidden so assistive tech doesn't announce them beside their label. *)\n let role_attrs =\n if meaningful then \"role=\\\"img\\\" aria-label=\\\"\" ^ label ^ \"\\\"\" else \"aria-hidden=\\\"true\\\"\"\n in\n let extra = if extra_class = \"\" then \"\" else \" \" ^ extra_class in\n let markup = Icons.svg ~dims ~extra ~role_attrs body in\n View.dyn (fun () ->\n incr counter;\n let id = \"prescriptive-reativa-icon-\" ^ string_of_int !counter in\n Ui.set_inner_html_by_id id markup;\n View.element ~attrs:[ View.Attr.id (View.static id) ] \"span\" [])\nend\n\nmodule Newsletter = struct\n let make ?(description = \"\") ?(consent = \"\") ?on_subscribe ~heading () =\n let email = Signal.make \"\" in\n let done_ = Signal.make false in\n let submit ev =\n Ui.prevent_default ev;\n (match on_subscribe with Some f -> f (Signal.get email) | None -> ());\n Signal.set done_ true\n in\n let form_node =\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static \"mx-auto mt-5 flex w-full max-w-md flex-col gap-2 sm:flex-row\");\n ]\n ~events:[ View.On.submit submit ]\n \"form\"\n [\n View.element\n ~attrs:\n [\n View.Attr.type_ (View.static \"email\");\n View.Attr.toggle \"required\" (fun () -> true);\n View.Attr.make \"aria-label\" (View.static \"Email address\");\n View.Attr.placeholder (View.static \"you@example.com\");\n View.Attr.className (View.static (Ui.input_base ^ \" flex-1\"));\n ]\n ~events:[ View.On.input (fun e -> Signal.set email (Ui.input_value e)) ]\n \"input\" [];\n (Button.make ~type_:`submit ~variant:`primary\n ~children:[ View.text (View.static \"Subscribe\") ] ());\n ]\n in\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static \"w-full rounded-2xl border border-border bg-surface p-8 text-center\");\n ]\n \"section\"\n [\n
(heading)
;\n (if description = \"\" then View.empty\n else
(description)
);\n (View.show (fun () -> not (Signal.get done_)) form_node);\n (View.element\n ~attrs:[ View.Attr.make \"role\" (View.static \"status\") ]\n \"div\"\n [\n View.show\n (fun () -> Signal.get done_)\n (
\n (Icon.make ~name:\"check-circle\" ())\n ({js|Almost there — check your inbox to confirm.|js})\n
);\n ]);\n (if consent = \"\" then View.empty\n else
(consent)
);\n ]\nend\n\nlet newsletter_example () =\n
\n (Newsletter.make ~heading:\"Get the monthly digest\"\n ~description:\"One email a month: new specs, patterns, and releases. No spam.\"\n ~consent:\"By subscribing you agree to the privacy policy. Unsubscribe anytime.\" ())\n
")
| "page-header" => Some("module Icon = struct\n (* Fresh host ids so multiple icons of the same name never collide. *)\n let counter = ref 0\n\n let make ?(size : Contracts.Icon.size = `md) ?(label = \"\") ?(extra_class = \"\") ~name () =\n let dims =\n match size with\n | `xs -> \"size-3\"\n | `sm -> \"size-4\"\n | `md -> \"size-5\"\n | `lg -> \"size-6\"\n | `xl -> \"size-8\"\n in\n let body = match Icons.get name with Some b -> b | None -> [] in\n let meaningful = label <> \"\" in\n (* Meaningful icons expose an img role + accessible name; decorative ones are\n hidden so assistive tech doesn't announce them beside their label. *)\n let role_attrs =\n if meaningful then \"role=\\\"img\\\" aria-label=\\\"\" ^ label ^ \"\\\"\" else \"aria-hidden=\\\"true\\\"\"\n in\n let extra = if extra_class = \"\" then \"\" else \" \" ^ extra_class in\n let markup = Icons.svg ~dims ~extra ~role_attrs body in\n View.dyn (fun () ->\n incr counter;\n let id = \"prescriptive-reativa-icon-\" ^ string_of_int !counter in\n Ui.set_inner_html_by_id id markup;\n View.element ~attrs:[ View.Attr.id (View.static id) ] \"span\" [])\nend\n\nmodule PageHeader = struct\n let make ?(description = \"\") ?(breadcrumb = []) ~title ~children () =\n let crumb_item (label, href) =\n let inner =\n if href = \"\" then
(label)\n else\n
\n (label)\n (Icon.make ~name:\"chevron-right\" ~size:`xs ())\n \n in\n
(inner)\n in\n let breadcrumb_node =\n if breadcrumb = [] then View.empty\n else\n View.element\n ~attrs:\n [\n View.Attr.make \"aria-label\" (View.static \"Breadcrumb\");\n View.Attr.className (View.static \"mb-1.5\");\n ]\n \"nav\"\n [\n View.element\n ~attrs:[ View.Attr.className (View.static \"flex items-center gap-1.5 text-xs text-muted\") ]\n \"ul\"\n (List.map crumb_item breadcrumb);\n ]\n in\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static\n \"flex w-full flex-wrap items-start justify-between gap-x-6 gap-y-4 border-b border-border pb-5\");\n ]\n \"header\"\n [\n
\n (breadcrumb_node)\n
(title)
\n (if description = \"\" then View.empty\n else
(description)
)\n
;\n
(View.fragment children)
;\n ]\nend\n\nmodule Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nlet txt s = View.text (View.static s)\n\nlet page_header_example () =\n
\n (PageHeader.make ~title:\"Deployments\"\n ~description:\"Everything your team shipped in the last 30 days.\"\n ~breadcrumb:[ (\"Acme\", \"#\"); (\"Production\", \"#\"); (\"Deployments\", \"\") ]\n ~children:\n [\n Button.make ~variant:`secondary ~size:`sm ~children:[ txt \"Export\" ] ();\n Button.make ~variant:`primary ~size:`sm ~children:[ txt \"New deploy\" ] ();\n ]\n ())\n
")
- | "stat-grid" => Some("module Skeleton = struct\n let make ?(shape : Contracts.Skeleton.shape = `text) ?(extra_class = \"\") () =\n let shape_cls =\n match shape with\n | `text -> \"h-3 rounded\"\n | `circle -> \"rounded-full\"\n | `rect -> \"rounded-lg\"\n in\n
\nend\n\nmodule Icon = struct\n (* Fresh host ids so multiple icons of the same name never collide. *)\n let counter = ref 0\n\n let make ?(size : Contracts.Icon.size = `md) ?(label = \"\") ?(extra_class = \"\") ~name () =\n let dims =\n match size with\n | `xs -> \"size-3\"\n | `sm -> \"size-4\"\n | `md -> \"size-5\"\n | `lg -> \"size-6\"\n | `xl -> \"size-8\"\n in\n let body = match Icons.get name with Some b -> b | None -> [] in\n let meaningful = label <> \"\" in\n (* Meaningful icons expose an img role + accessible name; decorative ones are\n hidden so assistive tech doesn't announce them beside their label. *)\n let role_attrs =\n if meaningful then \"role=\\\"img\\\" aria-label=\\\"\" ^ label ^ \"\\\"\" else \"aria-hidden=\\\"true\\\"\"\n in\n let extra = if extra_class = \"\" then \"\" else \" \" ^ extra_class in\n let markup = Icons.svg ~dims ~extra ~role_attrs body in\n View.dyn (fun () ->\n incr counter;\n let id = \"prescriptive-reativa-icon-\" ^ string_of_int !counter in\n Ui.set_inner_html_by_id id markup;\n View.element ~attrs:[ View.Attr.id (View.static id) ] \"span\" [])\nend\n\nmodule StatGrid = struct\n let make ?(heading = \"\") ?(loading = false) ~stats () =\n let loading_tile _ =\n View.element\n ~attrs:\n [\n View.Attr.className (View.static (Ui.card ^ \" p-4\"));\n View.Attr.make \"aria-hidden\" (View.static \"true\");\n ]\n \"li\"\n [\n Skeleton.make ~shape:`text ~extra_class:\"w-20\" ();\n Skeleton.make ~shape:`text ~extra_class:\"mt-3 h-7 w-28\" ();\n Skeleton.make ~shape:`text ~extra_class:\"mt-3 w-16\" ();\n ]\n in\n let stat_tile (label, value, delta, trend) =\n (* Direction is conveyed by icon + text, not color alone. *)\n let trend_icon, trend_cls =\n match trend with\n | `up -> (\"arrow-up\", \"text-status-success\")\n | `down -> (\"arrow-down\", \"text-status-danger\")\n | `flat -> (\"minus\", \"text-muted\")\n in\n View.element\n ~attrs:[ View.Attr.className (View.static (Ui.card ^ \" p-4\")) ]\n \"li\"\n [\n
(label)
;\n
(value)
;\n (if delta = \"\" then View.empty\n else\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static (\"mt-1 flex items-center gap-1 text-xs font-medium \" ^ trend_cls));\n ]\n \"p\"\n [ Icon.make ~name:trend_icon ~size:`xs (); View.text (View.static delta) ]);\n ]\n in\n let tiles = if loading then List.map loading_tile stats else List.map stat_tile stats in\n View.element\n ~attrs:[ View.Attr.className (View.static \"w-full\") ]\n \"section\"\n [\n (if heading = \"\" then View.empty\n else
(heading)
);\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static \"grid w-full grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\");\n ]\n \"ul\" tiles;\n ]\nend\n\nmodule Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nlet txt s = View.text (View.static s)\n\nlet stat_grid_example () =\n let loading = Signal.make false in\n let stats =\n [\n (\"Revenue\", \"$48.2k\", \"+12% vs. last month\", `up);\n (\"Active users\", \"1,203\", \"+3% vs. last month\", `up);\n (\"Signups\", \"312\", \"\\xe2\\x88\\x925% vs. last month\", `down);\n (\"Uptime\", \"99.98%\", \"flat vs. last month\", `flat);\n ]\n in\n
\n (View.show\n ~fallback:(StatGrid.make ~heading:\"This month\" ~stats ())\n (fun () -> Signal.get loading)\n (StatGrid.make ~heading:\"This month\" ~stats ~loading:true ()))\n (Button.make ~variant:`secondary ~size:`sm\n ~on_click:(fun _ ->\n Signal.set loading true;\n Ui.set_timeout (fun () -> Signal.set loading false) 1500)\n ~children:[ txt \"Simulate loading\" ] ())\n
")
+ | "stat-grid" => Some("module Skeleton = struct\n let make ?(shape : Contracts.Skeleton.shape = `text) ?(extra_class = \"\") () =\n let shape_cls =\n match shape with\n | `text -> \"h-3 rounded\"\n | `circle -> \"rounded-full\"\n | `rect -> \"rounded-lg\"\n in\n
\nend\n\nmodule Icon = struct\n (* Fresh host ids so multiple icons of the same name never collide. *)\n let counter = ref 0\n\n let make ?(size : Contracts.Icon.size = `md) ?(label = \"\") ?(extra_class = \"\") ~name () =\n let dims =\n match size with\n | `xs -> \"size-3\"\n | `sm -> \"size-4\"\n | `md -> \"size-5\"\n | `lg -> \"size-6\"\n | `xl -> \"size-8\"\n in\n let body = match Icons.get name with Some b -> b | None -> [] in\n let meaningful = label <> \"\" in\n (* Meaningful icons expose an img role + accessible name; decorative ones are\n hidden so assistive tech doesn't announce them beside their label. *)\n let role_attrs =\n if meaningful then \"role=\\\"img\\\" aria-label=\\\"\" ^ label ^ \"\\\"\" else \"aria-hidden=\\\"true\\\"\"\n in\n let extra = if extra_class = \"\" then \"\" else \" \" ^ extra_class in\n let markup = Icons.svg ~dims ~extra ~role_attrs body in\n View.dyn (fun () ->\n incr counter;\n let id = \"prescriptive-reativa-icon-\" ^ string_of_int !counter in\n Ui.set_inner_html_by_id id markup;\n View.element ~attrs:[ View.Attr.id (View.static id) ] \"span\" [])\nend\n\nmodule StatGrid = struct\n let make ?(heading = \"\") ?(loading = false) ~stats () =\n let loading_tile _ =\n View.element\n ~attrs:\n [\n View.Attr.className (View.static (Ui.card ^ \" p-4\"));\n View.Attr.make \"aria-hidden\" (View.static \"true\");\n ]\n \"li\"\n [\n Skeleton.make ~shape:`text ~extra_class:\"w-20\" ();\n Skeleton.make ~shape:`text ~extra_class:\"mt-3 h-7 w-28\" ();\n Skeleton.make ~shape:`text ~extra_class:\"mt-3 w-16\" ();\n ]\n in\n let stat_tile (label, value, delta, trend) =\n (* Direction is conveyed by icon + text, not color alone. *)\n let trend_icon, trend_cls =\n match trend with\n | `up -> (\"arrow-up\", \"text-status-success\")\n | `down -> (\"arrow-down\", \"text-status-danger\")\n | `flat -> (\"minus\", \"text-muted\")\n in\n View.element\n ~attrs:[ View.Attr.className (View.static (Ui.card ^ \" p-4\")) ]\n \"li\"\n [\n
(label)
;\n
(value)
;\n (if delta = \"\" then View.empty\n else\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static (\"mt-1 flex items-center gap-1 text-xs font-medium \" ^ trend_cls));\n ]\n \"p\"\n [ Icon.make ~name:trend_icon ~size:`xs (); View.text (View.static delta) ]);\n ]\n in\n let tiles = if loading then List.map loading_tile stats else List.map stat_tile stats in\n View.element\n ~attrs:[ View.Attr.className (View.static \"w-full\") ]\n \"section\"\n [\n (if heading = \"\" then View.empty\n else
(heading)
);\n View.element\n ~attrs:\n [\n View.Attr.className\n (View.static \"grid w-full grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\");\n ]\n \"ul\" tiles;\n ]\nend\n\nmodule Spinner = struct\n let make ?(size = \"size-4\") ?(tone = `ink) () =\n let colors =\n match tone with\n | `ink -> \"border-neutral-300 border-t-neutral-900\"\n | `on_accent -> \"border-white/40 border-t-white\"\n in\n
\nend\n\nmodule Button = struct\n let make ?(variant : Contracts.Button.variant = `primary) ?(size : Contracts.Button.size = `md)\n ?(type_ : Contracts.Button.type_ = `button) ?(disabled = false) ?(loading = false) ?on_click\n ?(extra_class = \"\") ~children () =\n let type_str = match type_ with `button -> \"button\" | `submit -> \"submit\" | `reset -> \"reset\" in\n let size_cls = match size with `sm -> Ui.btn_sm | `md -> Ui.btn_md | `lg -> Ui.btn_lg in\n let colors =\n match variant with\n | `primary -> Ui.btn_primary_colors\n | `secondary -> Ui.btn_secondary_colors\n | `ghost -> Ui.btn_ghost_colors\n | `destructive -> Ui.btn_destructive_colors\n in\n (* Dark-surface variants need an on-accent spinner; light ones use ink. *)\n let spinner_tone =\n match variant with `primary | `destructive -> `on_accent | `secondary | `ghost -> `ink\n in\n let cls = Ui.cx (Ui.btn_core ^ \" \" ^ size_cls ^ \" \" ^ colors) extra_class in\n let attrs =\n [\n View.Attr.type_ (View.static type_str);\n View.Attr.className (View.static cls);\n View.Attr.disabled (fun () -> disabled || loading);\n ]\n in\n let events = match on_click with Some f -> [ View.On.click f ] | None -> [] in\n let spinner = if loading then Spinner.make ~tone:spinner_tone () else View.empty in\n View.element ~attrs ~events \"button\" [ spinner; View.fragment children ]\nend\n\nlet txt s = View.text (View.static s)\n\nlet stat_grid_example () =\n let loading = Signal.make false in\n let stats =\n [\n (\"Revenue\", \"$48.2k\", \"+12% vs. last month\", `up);\n (\"Active users\", \"1,203\", \"+3% vs. last month\", `up);\n (\"Signups\", \"312\", {js|−5% vs. last month|js}, `down);\n (\"Uptime\", \"99.98%\", \"flat vs. last month\", `flat);\n ]\n in\n
\n (View.show\n ~fallback:(StatGrid.make ~heading:\"This month\" ~stats ())\n (fun () -> Signal.get loading)\n (StatGrid.make ~heading:\"This month\" ~stats ~loading:true ()))\n (Button.make ~variant:`secondary ~size:`sm\n ~on_click:(fun _ ->\n Signal.set loading true;\n Ui.set_timeout (fun () -> Signal.set loading false) 1500)\n ~children:[ txt \"Simulate loading\" ] ())\n
")
| "steps" => Some("module Steps = struct\n let make ?(orientation : Contracts.Steps.orientation = `horizontal) ?(heading = \"\") ~steps () =\n let n = List.length steps in\n let numbered =\n List.mapi (fun i (title, description) -> (string_of_int (i + 1), title, description, i = n - 1)) steps\n in\n let list_cls =\n match orientation with\n | `horizontal -> \"flex flex-col gap-8 md:flex-row md:gap-6\"\n | `vertical -> \"flex flex-col gap-8\"\n in\n let step_item (number, title, description, is_last) =\n
\n (View.element\n ~attrs:\n [\n View.Attr.className (View.static \"flex flex-col items-center\");\n View.Attr.make \"aria-hidden\" (View.static \"true\");\n ]\n \"div\"\n [\n \n (number)\n ;\n (* The vertical connector between markers; the last step ends the path. *)\n (if (not is_last) && orientation = `vertical then\n \n else View.empty);\n ])\n \n
(title)
\n
(description)
\n
\n \n in\n View.element\n ~attrs:[ View.Attr.className (View.static \"w-full\") ]\n \"section\"\n [\n (if heading = \"\" then View.empty\n else\n
(heading)
);\n View.element\n ~attrs:[ View.Attr.className (View.static list_cls) ]\n \"ol\"\n (List.map step_item numbered);\n ]\nend\n\nlet steps_example () =\n let steps =\n [\n (\"Connect your repo\", \"Authorize once; we pick up every branch automatically.\");\n (\"Push a commit\", \"Each push builds, tests, and previews in isolation.\");\n (\"Ship it\", \"Promote the preview to production with one click.\");\n ]\n in\n
(Steps.make ~heading:\"How it works\" ~steps ())
")
| _ => None
}