Decisions
1. Why
Short architecture decision records (ADRs), so that later you (or a viewer, or an AI agent) can see why Camouflage is shaped the way it is, and what it would cost to change. Add a new ADR whenever a base contract changes.
2. Shape
Each ADR has three parts: Context → Decision → Consequences. The status is Accepted unless marked otherwise. Numbers are never reused, and superseded ADRs stay, marked "Superseded by ADR-N".
3. API
ADR-1 Skin and Theme are separate layers
- Context: a single "theme" can't express both "the brand is purple" and "dialogs are iOS alerts". Making everything a theme gives fake Cupertino; making everything a skin brings back per-project components.
- Decision: Theme = token values only. Skin = structure, behavior and surface.
- Consequences: a new brand is a theme only. A new design language is a skin. Two concepts to learn instead of one.
ADR-2 Core components delegate rendering to the active skin
- Context: apps must be able to switch design language without changing call sites.
- Decision: apps call core
Camo*components, which callskin.x.render(state, slots, theme). The skin is resolved from the tree. - Consequences: one-line skin switching, nested skins, adaptive roots. Core must define a complete contract for every component before a skin can draw it.
ADR-3 Skins ship as separate libraries
- Context: apps shouldn't pay for skins they don't use, and skins should version on their own.
- Decision:
camouflage-coreplus one module per skin. Skins use only core's public API. - Consequences: proves the contract is enough for third-party or AI-built skins. More modules to publish.
ADR-4 Semantic variants in core (amended by ADR-11)
- Context:
filled/tonalare Material words, and a Cupertino skin has no "tonal". - Decision: core uses design-language-neutral variants and roles (
SurfaceLevel,ElevationLevel,Tone, and the variant enums from ADR-11). Skins map them. - Consequences: a neutral API. Designs needing a fourth variant use a renderer override or a custom token set (see CamoButton §5).
ADR-5 Kotlin first, then Flutter, per milestone
- Context: Android is the author's main platform, and a mirrored series makes good content.
- Decision: each milestone is built in Kotlin (Compose Multiplatform), then ported to Flutter.
- Consequences: Flutter may reveal contract issues late. Fix the base note first.
ADR-6 Figma integration via the Figma MCP + an agent, not a custom generator
- Context: Figma's MCP server already exposes variables, design context and Code Connect to AI agents.
- Decision: Camouflage provides a naming contract, precise contracts, an agent guide and Code Connect mappings. There's no bespoke codegen tool.
- Consequences: less tooling to maintain. The results depend on agent quality and on the Figma file following the conventions.
ADR-7 Material is the only skin in v1 (superseded by ADR-22)
- Context: Material is the author's daily design system. Liquid Glass needs hard rendering work (backdrop blur and refraction).
- Decision: v1 ships
MaterialSkin. Cupertino, Liquid Glass and Fluent come Later, each as its own module. - Consequences: the Skin abstraction is proven by
DebugSkin+MaterialSkinonly. A second real skin may still find gaps in the contract.
ADR-8 Components are controlled
- Context: runtime skin and theme switches must not lose user data, and apps need to filter or confirm changes.
- Decision: components hold no source of truth. Values in, callbacks out. Only visual interaction state is internal.
- Consequences: a little more code at call sites. Skin switches are safe, and validation, confirmation and async toggles need no special API.
ADR-9 No default skin or theme in core; fail fast
- Context: a silent default hides a missing provider until someone notices the wrong look.
- Decision: a missing provider throws a clear error naming the component and what is missing. Starter themes ship from skin modules.
- Consequences: a one-time setup line for every app. Core stays visually neutral.
ADR-10 The editable text node lives in core, not in the renderer
- Context: if a renderer created the text input, a skin switch would recreate it, losing focus, cursor and keyboard.
- Decision:
CamoTextFieldowns the platform editable node and passes it to the renderer as theinputslot to place. - Consequences: skins can't replace the input engine itself. Focus survives skin switches.
ADR-11 Variants use designer vocabulary
- Context:
Emphasis { High, Medium, Low }(ADR-4's first naming) is Material's internal term. Developers and designers say "primary button" or "outlined card", and Figma component variants use those words. - Decision: buttons and icon buttons take
variant: ButtonVariant { Primary, Secondary, Tertiary }. Cards takevariant: CardVariant { Filled, Elevated, Outlined }, because "primary card" isn't common language, and filled, raised and bordered boxes exist in every design language. - Consequences: Figma
variant=primarymaps directly to code, which helps Code Connect (Figma and AI).ButtonVariant.Primaryandcolors.primaryshare a word; in Material they line up (a Primary button is filled withprimary), and other skins document their mapping.
ADR-12 Text is a value, icons are widgets, layout is a slot
- Context: the first contract used slots everywhere (
CamoButton(onClick) { CamoText("Save") }), Compose style. The author's working style (Flutter and Android) is: text as a value, icons as app-level icon widgets that pick up size and color from the component's icon theme, and prefix/suffix icons as in design files. - Decision: labels, titles and messages are
Stringvalues drawn by the renderer. Icons are passed as widgets (prefixIcon,suffixIcon,icon), and every renderer sets an ambientIconStyle(size, color)around them. Nested actions are Camouflage components. Only free layout (CamoSurface,CamoCard,CamoDialog.content) is a slot.CamoCheckboxandCamoSwitchtake an optionallabeland build the whole row. - Consequences: one obvious way to call each component, matching Figma properties (text layer →
text, prefix icon →prefixIcon), which is good for Code Connect and AI agents. Custom content inside a button or title (badges, logos) needs a renderer override or an app widget. In Compose, icon parameters are small@Composablelambdas, because that's how Compose passes widgets.
ADR-13 A 42-role color model with status tones
- Context: the first 20 roles followed Material 3 closely. Comparing Apple HIG, Fluent 2 and IBM Carbon showed that every other system has status colors (success, warning, info), several surface levels, and inverse colors. Material has only
error. Camouflage must be able to carry other design systems. - Decision:
CamoColorshas 42 roles in 7 groups: brand (primary, secondary, tertiary × 4), surfaces (6 levels), content (2), lines (2), status (error, success, warning, info × 4), inverse (3), scrim. ATone { Default, Error, Success, Warning, Info }parameter on buttons, icon buttons and cards picks the color family, independently of the variant. Destructive =tone = Error.CamoColors.fromSeedgenerates all roles from a few seeds with the Material tonal-palette algorithm. - Consequences: a mapping table from each major design system onto Camouflage roles (Theme §3.3) makes future skins and Figma imports mechanical. More roles for Figma files to define, offset by
fromSeed.CamoSurfaceuseslevel: SurfaceLevel(no clash withTone).
ADR-14 Text styles and colors are passed as values; rich text through spans
- Context: the author defines complete text styles (weight included) as constants and adjusts them with
copy. Real screens need links and bold words inside sentences (consent checkboxes, terms). - Decision:
CamoText(style: CamoTextStyle, color: Color?)takes values (typography.titleMedium.copy(fontWeight = Bold),Camouflage.colors.success), not role enums.CamoText.rich(spans)withCamoSpan(text, fontWeight?, italic?, color?, underline?, link?)maps to FlutterTextSpan/ ComposeAnnotatedString. Checkbox and switch acceptlabelSpans. - Consequences: full flexibility for callers. A skin can't restyle a caller's text by role (it can still style links and component-owned text). Links are real accessible links on both platforms.
ADR-15 Component themes: theme overrides merged over skin defaults
- Context: changing a button's height or radius, the most common Figma request, required a full renderer override. Flutter solves it with per-component theme data (
FilledButtonThemeData), and the author uses that pattern, including the button configuring its icon theme. - Decision:
CamoTheme.componentsholds optional per-component themes (ButtonTheme,TextFieldTheme…) whose fields are all nullable. Each renderer declaresdefaults(theme), a complete component theme that may reference global tokens. Core resolvesstyle = defaults(theme).merge(theme.components.x)and passes it torender. Renderers take every adjustable size and color fromstyle. - Consequences: most Figma designs need only a theme (global tokens + component overrides), with no code. Brand themes stay portable across skins, because unset fields use each skin's own defaults. Renderer overrides are only for structural differences. Each component gains a theme class with a
merge. A test per renderer guards against literals.
ADR-16 Text field keeps value: String; filtering and formatting live in core
- Context: with a plain
String, formatting insideonValueChangemakes the cursor jump to the end. A cursor-aware value type (TextFieldValue,TextEditingController) fixes that, but pushes selection handling onto every call site and differs a lot between platforms. - Decision: keep
value: String. AddinputFilter: CamoInputFilter?anddisplayFormat: CamoDisplayFormat?, applied by core (which owns the editable node, ADR-10) through each platform's cursor-safe mechanism (ComposeInputTransformation/OutputTransformation, FlutterTextInputFormatter).valueis always the raw text. - Consequences: simple call sites, no cursor jumps, and raw values ready for validation and APIs. The app can't set the cursor programmatically in v1; a state-based overload can add that later without breaking the API.
ADR-17 Forms: Flutter's Form/FormField model on both platforms, rules as objects
- Context: apps rewrite form validation every time. The author likes Flutter's
Form+FormField+AutovalidateMode, and already uses validator objects (constants or classes) in Flutter and Android. Compose has no Form equivalent. Building UI and rules from JSON is a separate product, Camouflage Blueprint. - Decision: core ships
CamoForm,CamoFormState,CamoFormField<T>, andCamoTextFormField/CamoCheckboxFormField/CamoSwitchFormField, with Flutter semantics (fields register with the nearest form;validate,save,reset;ValidateMode=AutovalidateMode, defaultDisabled;forceError). Checks areCamoRule<T>objects (fun interface) plusCamoRulesbuilt-ins. There's no JSON or registry in core; that's Blueprint's job. Form fields hold their own value, a deliberate exception to ADR-8, as in Flutter. - Consequences: Flutter-familiar forms in Compose. Unlike Flutter, the form owns field state by key, so forms work in lazy lists (off-screen fields keep values, validate and save;
revealFieldscrolls to the first invalid one). Form fields inside a form need akey. Plain controlled components remain for apps that manage state themselves.CamoTextFieldgainsonFocusChanged, and the toggles gainerror. Async checks stay app-side (setErrors) in v1.
ADR-18 Every platform from M0; live docs deferred
- Context: Camouflage already targets iOS, so its Kotlin code has to be common-only anyway. Compiling for desktop and web as well costs little: Gradle targets, CI jobs, and dependency checks. The author also wants to explore KMP fully. Live component previews in the Docusaurus docs site (
srctool/camouflage) are real extra work, and Compose web was Beta when this was decided (2026-09). - Decision: from M0, core and skins compile for Android, iOS, desktop (JVM) and web (
wasmJs) on Kotlin, and for all six Flutter platforms. The sample app runs on each. Live docs (a gallery app +<LivePreview>iframes in Docusaurus) are deferred until Compose web is stable. - Consequences:
- Dependencies must support all four Kotlin targets.
- CI runs one build per platform (iOS needs a macOS runner).
- Web and desktop need a few
actuals (see Architecture §2.4). - Desktop exercises hover, focus rings and keyboard traversal for real.
- If a web-only (Beta) problem blocks a release, the web job can be skipped for that release without touching other code.
- Accessibility testing stays on Android and iOS, because web renders to a canvas.
ADR-19 Overlays open through each platform's navigator, the way Material does
- Context: the author wants dialogs and sheets written like small pages in their own files (own state, own ViewModel/notifier, typed result), with no dialog flags in screens. Camouflage is a peer of
material_ui/cupertino_ui(Flutter) and material3 (Compose), and Material doesn't bring its own overlay system: it plugs into the platform's navigator. Navigation 3 (stable, multiplatform via JetBrains) supports dialog and sheet entries through scene strategies, with a per-entry ViewModel scope. - Decision:
- Flutter:
showCamoDialog/showCamoBottomSheetpush Camouflage routes and returnFuture<T?>, exactly likematerial_ui. - Compose: dialogs and sheets are registered Navigation 3 entries with Camouflage scene metadata, rendered by
CamoDialogSceneStrategy/CamoBottomSheetSceneStrategyfrom the officialcamouflage-navigation3artifact. Results go throughCamoNavResults. - Core provides the frames (usable standalone, like Material's
ModalBottomSheet) and the content components (CamoDialog,CamoBottomSheet, which joins v1). - Core contains no router.
- Flutter:
- Consequences:
- The same content and look on both platforms, with a platform-idiomatic way to open them.
- Compose sheets are deep-linkable and restorable (process death); Flutter's aren't by default (as in Material).
CamoDialogloses itsonDismissRequestparameter (dismissal goes through the frame).- An earlier draft with a custom Compose
showhost was dropped in favor of this. - Review follow-ups: Compose gets
showForResult(suspend) on top ofCamoNavResults. Flutter also getsCamoSheetPage/CamoDialogPage, so overlays can be GoRouter routes without modifying GoRouter. Overlays are non-opaque: the page behind stays visible under the scrim.widePresentationandstackedScrimare design-team options in the component themes.
ADR-20 Camouflage is its own design system; one Appearance scale replaces per-component variants
- Context:
ButtonVariant { Primary, Secondary, Tertiary }(ADR-11) named rank, and couldn't express the styles designers actually use (filled, tonal, elevated, outlined, text, link). Rank names also mean different things across systems (Carbon's "tertiary" is outlined, Polaris's is text-like).CardVariantused Material's style words. The author wants Camouflage to be a design system of its own, whose language adapts to other systems through skins. - Decision: Camouflage has its own design language (Design Language): principles, foundations, vocabulary, components and an interaction model. Skins are dialects that must publish an alignment table. Components with visual variants take
appearance: Appearance { Solid, Soft, Raised, Outline, Ghost, Link }plustone, with per-component subsets and core fallbacks.ButtonVariantandCardVariantare removed. This supersedes the naming part of ADR-11. - Consequences:
- One vocabulary across code, Figma (
appearance=…) and docs. It's future-proof for chips, badges and tags. - Material maps directly (Filled, Tonal, Elevated, Outlined, Text); Link and Solid cards are Camouflage additions.
- Other dialects map by table, with documented fallbacks.
- One vocabulary across code, Figma (
ADR-21 The full component set is v1; the project follows a waterfall lifecycle
- Context: the component inventory (Component Inventory) showed that the original 15 components cover only the core of each design system. The author prefers to include the next wave in v1, and works waterfall-style: the complete design documentation first, then implementation.
- Decision: v1 = 34 component notes (15 original + 20 former-v2, with
CamoSelectreusing other renderers). The lifecycle has four phases:- Design: all base contracts, reviewed.
- Platform design: all Kotlin notes, then all Flutter notes, each reviewed.
- Implementation: in milestone order M0–M8, Kotlin then Flutter.
- Verification + release: M9 (testing, publishing v0.1).
- Consequences:
- The skin contract has 33 renderers (35 after ADR-29, 39 after ADR-35), so a new skin is a bigger job (the checklist and
DebugSkinstill apply). - v0.1 ships later but covers 75–85% of each major design system.
- Milestones remain the build and episode order, not separate releases.
- The skin contract has 33 renderers (35 after ADR-29, 39 after ADR-35), so a new skin is a bigger job (the checklist and
ADR-22 Camouflage's own Minimal skin is the v1 skin; other dialects are documented for Later
- Context: copying an existing design system's skin (Material, Apple, Fluent, Carbon) means matching hundreds of exact external measurements and behaviors. The author wants Camouflage to have its own look, following a minimalism concept, and to build that first.
- Decision:
- v1 ships
MinimalSkin(modulecamouflage-skin-minimal): flat surfaces (no shadows), hairline borders, monochrome ink by default with one optional accent, opacity feedback, and system fonts (Minimal Skin). - Material, Cupertino (with Liquid Glass as a surface option), Fluent and Carbon are fully documented as Later skins. Shipping any of them is a separate decision.
CamoColors.fromSeedgains aneutralseed.- Supersedes ADR-7.
- v1 ships
- Consequences:
- The v1 skin needs no Material dependency on either platform (
material3,material-ripple,material_uiaren't needed in v1). - The component notes keep a "Material mapping preview" as a reference dialect. The v1 values live in the Minimal skin's defaults table.
- The four other skin notes prove the contract against very different anatomies (Apple alerts and wheel pickers, Carbon bottom-border fields) before implementation.
- The v1 skin needs no Material dependency on either platform (
ADR-23 Core contracts are the common ground of every dialect
- Context: documenting five skins showed where dialects differ: Apple stacks alert buttons, Carbon puts dialog actions in a full-width row, only Material has a hero icon in dialogs. If core took on each dialect's extras, it would stop being neutral, and every new skin would need to handle features it doesn't have.
- Decision:
- A component parameter belongs in core only if every documented dialect (Minimal, Material, Cupertino, Fluent, Carbon) can render it meaningfully.
- Dialect-only features stay out of core. The developer composes them in a slot (e.g. dialog
content), or the skin exposes them as a skin option or component-theme field. - The component owns semantics, input, dismissal, focus and results. The renderer owns the look and the arrangement of the slots it receives. Contracts pass separate slots (e.g.
confirm,dismiss) rather than one opaque row whenever a dialect needs to arrange them.
- Consequences:
- Adding a parameter means checking the component's row in every skin note.
CamoDialoggets noiconparameter (Material only).- The first audit of all 33 contracts (2026-09-27) changed:
CamoSegmentedControl: the multi-select overload is removed (iOS and Carbon are single-select); multi-select uses filter chips.CamoFab.size→FabTheme.size;CamoBottomSheet.showHandle→BottomSheetTheme.showHandle;CamoNavigationRail.alignment→NavigationRailTheme.alignment;showLabels→NavigationBarTheme/NavigationRailTheme.CamoTopBar.scrolled: Boolean→scrollOffset: Dp, so collapsing dialects work.- Wording:
CamoTabsSolid/Ghost mean prominent/quiet;CamoListSection.levelsets the fill only. - Cupertino fallbacks documented: scrollable tabs, horizontal radio groups.
- Components pass the same test: a component stays in core if every skin can draw a reasonable equivalent (e.g.
CamoFabas a plain floating button). - Skin notes stay the edge-case reference, even for skins that never ship.
ADR-24 Core token defaults are Camouflage's own values
- Context: core's default shapes, motion and
fromSeedneutrals were Material's numbers, so a theme built only from core looked like Material. Camouflage is its own design system (ADR-20) and Minimal is its dialect (ADR-22). - Decision:
- Core defaults take the Minimal values: gray neutrals in
fromSeed(neutral = null→ zero chroma), Camouflage's neutral tone table, radii 4/6/8/12/16, motion 120/200/300 ms, andCamoTypography.system()(system font, weights 600/500/400). - Core copies the numbers. It never depends on the skin module.
CamoSpacinggainsnone = 0. The default status seeds stay.
- Core defaults take the Minimal values: gray neutrals in
- Consequences:
- A theme with only a brand color looks like Camouflage.
minimalTheme()mostly adds the ink primary. - Later dialects bring their own numbers (e.g. the Material skin's
materialColors(seed)with tinted neutrals and M3 shapes and motion). - The Kotlin neutral tones are snapshot-pinned, not compared with MaterialKolor's scheme output.
- A theme with only a brand color looks like Camouflage.
ADR-25 Overlay dismissal and drag reach the renderer
- Context: the Architecture review (2026-09-27). Carbon and Fluent draw a ✕ on dialogs and Cupertino sheets can show "Done", but only when the overlay may be dismissed. The slider kept its own
draggingflag, and the switch thumb couldn't be dragged. - Decision:
DialogStateandBottomSheetStatecarrydismissibleandonDismissRequest, supplied by the overlay frame. A close affordance callsonDismissRequest, which takes the same path as back/Esc, so vetoes still apply.InteractionStategainsdragged.SliderState.draggingis removed in favor of it, and the switch thumb is draggable in v1.Camouflage.skinOrNull/themeOrNull(Flutter:maybeSkinOf/maybeThemeOf) let optional libraries detect a provider.Camo*components never use them.
- Consequences: skins without a close affordance ignore the new fields. Every interactive component reports
dragged = falseunless it supports dragging.
ADR-26 The camouflage repo hosts the family packages
- Context: the family grew (Blueprint, Storybook, a generator, page templates like a camera page). Separate repos each need their own build, CI and version pinning against core.
- Decision:
- A package that depends on Camouflage, or generates code for it, lives in the camouflage repo as its own package (a Gradle module in
camouflage-kotlin, a pub package incamouflage-dart): Blueprint, Storybook,camouflage-filesystem(its browser/picker UI is built with Camouflage, like Storybook),camouflage-generator, templates (one package each, e.g.camouflage-camera). - A package that works without Camouflage would live in its own repo (none today; srctool gradle-conventions after extraction).
- Core, skins and
camouflage-navigation3are versioned together. The other packages are versioned and released independently (Melos independent versioning; per-module versions in Gradle), and the Kotlin BOM pins them at tested versions (ADR-27). - Docs stay per package in the vault (
projects/camouflage-*).
- A package that depends on Camouflage, or generates code for it, lives in the camouflage repo as its own package (a Gradle module in
- Consequences: family packages build against the current core, with no composite build. CI builds only the packages a change touches. Core never depends on a family package (Roadmap dependency rules).
ADR-27 Dependency layers, and safe use of several packages
- Context: with the family in one repo, a convenient import (a skin shipping stories, camera saving through filesystem, a core uploader using filesystem, a generator depending on core) could create a cycle. Apps that combine several packages risk version skew.
- Decision:
- Layers 0 (core) → 1 (skins, navigation3) → 2 (family packages and templates) → 3 (glue modules, samples, apps). Dependencies only go to lower layers, never within a layer. Build tools (generator, build-logic) depend on nothing from Camouflage.
- Same-layer packages cooperate through callbacks or slots, connected by the app or a layer-3 glue module. Core components that need a family feature take callbacks (
CamoFileUploader(onPick)). - The Kotlin BOM pins every package at versions tested together. Dart family packages use caret ranges on core and are re-released by CI when core's minor version bumps.
- A CI check enforces the layers on both platforms, including Dart
dev_dependencies. Test-only dependencies (Kotlin*Test*configurations, Dartdev_dependencies) may also point at the same layer, never a higher one: they don't ship, and the skins test themselves withcamouflage-skin-testing, a layer-1 package (ruling 2026-10-25).
- Consequences: no cycles by construction. Apps import the BOM (Kotlin) or let pub resolve (Dart). Family packages carry a "works with core" table.
ADR-28 Brand designs are expressed through themes first
- Context: in practice, a product's designers make their own design system, benchmarked against others but not following any of them. The author's usual path was to take Material and rebuild each component to match the Figma design. Camouflage exists to replace that: the common case is one brand design on top of the Minimal skin, not switching between Material and Cupertino.
- Decision:
- The customization ladder, cheapest first: (1) theme tokens → (2) component-theme fields → (3) a renderer override (
MinimalSkin.copy(button = …)), either written by the app or borrowed from another skin (MinimalSkin.copy(tabs = CupertinoSkin.tabs)) → (4) a new skin. A typical brand needs 1 and 2; product feedback like "make the tabs behave like Apple's" is answered with 3. - Skins are therefore also libraries of renderers: each one exposes its renderers individually, and a borrowed renderer keeps its structure and behavior while using the app's theme and the host skin's surface treatment and feedback (Skin Contract §3.5).
- Any layout or proportion choice a brand design commonly changes is a component-theme field with a per-skin default, not a hard-coded renderer decision and not a per-call parameter. Examples:
TextFieldTheme.labelPlacement,CheckboxTheme.labelPosition,SwitchTheme.labelPosition,RadioTheme.labelPosition,NavigationBarTheme.showLabels,FabTheme.size,BottomSheetTheme.showHandle. - Components with an
appearancetakeAppearance? = null;nullresolves toXTheme.defaultAppearance, then the skin's default (Button, IconButton, Fab, Card, Chip, Badge, Banner, Tabs). - Every component review asks: "would a brand's Figma change this?" If yes, it becomes a theme field.
- The customization ladder, cheapest first: (1) theme tokens → (2) component-theme fields → (3) a renderer override (
- Consequences: more component-theme fields, all optional. The Minimal skin's renderers read them instead of constants (already required by the "no literals" rule). ADR-23 still decides what goes into the component API; ADR-28 decides what goes into its theme.
ADR-29 CamoPagedList and CamoSkeleton join v1; the data side is Sinew
- Context: every app rebuilds an API-backed list (refresh, next page, skeletons, empty and error states). The author's own list container worked like a framework: it spanned data → domain → presentation through generic response models and a state-management type.
- Decision:
- Split at a plain state object. Camouflage core gets
CamoPagedListState<T>(items,PagedLoadNone/Initial/Refresh/More,endReached,PagedErrorwith a FirstPage/NextPage scope) andCamoPagedList, a controlled component withonLoadMore,onRefresh,onRetry. It never fetches. CamoSkeletonmoves from Later to v1 (the loading rows).CamoAsyncSelecttakes the same state and callbacks instead of aloadOptionsfunction (a delegate pattern: the app drives it).- The data side (generic
Response/PagingResponsemapping, paging use cases,Result, view state) is Sinew, a sibling project (Overview). Neither depends on the other; an optional glue package adapts Sinew's state.
- Split at a plain state object. Camouflage core gets
- Consequences: v1 = 36 component notes and 39 renderers. Refresh and load-more are distinct
PagedLoadvalues. Sinew'sPagingStatecarries an explicitloadType(itsPager<T>owns the paging convention), so its adapter is a direct mapping.
ADR-30 Room for imaginative designs: options, behavior inputs, building blocks
- Context: product designs go beyond any design system: a bottom navigation that is pinned, floating or hides on scroll, or one that drags up into a sheet with a menu. The same happens to other components (tabs, text fields, top bars). A fixed component API can't anticipate every idea, and a renderer override is too heavy for a one-screen idea.
- Decision: each complex component offers four levels, cheapest first:
- Theme options for variants that recur across products (
NavigationBarTheme.placement: Pinned | Floating, indicator styles, title alignment). - Behavior inputs that stay controlled: the component reacts to a value (
visible,scrollOffset) and a platform helper computes it (rememberHideOnScroll), instead of hidden built-in scroll magic. - Building blocks: the component's skin-styled, accessible parts are public (
CamoNavBarContainer,CamoNavItemButton), so an app can build a one-off design that still looks and behaves like the rest of the app. - A renderer override, or the app's own component.
- Theme options for variants that recur across products (
- Consequences: component notes get a "building blocks" part where designs commonly go their own way. Every review asks: "what do designs imagine for this component, and which level covers it?"
ADR-31 Tooling works without Figma, around one tokens format
- Context: the Figma MCP needs a paid Figma seat, and Figma's variables REST API is limited to its top plan. Many designers and teams have neither, and some use Penpot, Tokens Studio or no design tool at all.
- Decision:
- One interchange format: Camouflage tokens JSON (W3C Design Tokens + the naming contract), covering theme tokens and component themes (sizes, role references, layout choices as strings and Booleans).
camouflage-contract.json, generated from core's code, describes every component and component-theme field; the tools validate against it, so they never drift.- Tools, in order: the
camocommand incamouflage-generator(import, validate, export, lint),camouflage-mcp(Camouflage's own MCP server, including screenshot-to-theme), a free-plan Figma plugin, Camouflage Studio. - All are build tools (ADR-27): they depend on nothing from Camouflage's runtime.
- Consequences: the Figma MCP becomes one optional source among several. Brand themes can round-trip between code and tokens files. Studio previews each target with its real renderer (one canvas per platform), and the generator's targets can grow (web, once a web port exists).
ADR-32 Brand vocabularies are typed token sets, generated by Camouflage's codegen
- Context: brands name tokens their own way (Tailwind scales, Mantine indexed shades, named sizes). On the web those can be CSS variables used anywhere; in Kotlin and Dart they must be typed and mapped to Camouflage. Flutter's
ThemeExtensionneeds hand-writtencopyWith/lerpand can't be referenced by theme roles. The untypedextensionsmap was weaker still. - Decision:
CamoTheme.extensionsis replaced bytokenSets: List<CamoTokenSet<*>>: typed classes, read withCamouflage.tokens<T>(), scoped by providers and blended by animated theme switches.CamoColorScale/CamoDimensionScalekeep numeric names (brand[600]).- The intended path is codegen: the tokens JSON's
customgroups (andskinsection) → thecamogenerator writes the token-set classes, the themes (roles referencing brand tokens), the component themes and the skin (a base skin plus borrowed renderers). This is the "define your own theme or skin" loop from the project's start. - Import and export for Tailwind and Mantine themes, so an existing brand comes in and a web team shares the same source.
- Consequences: Figma's
ext/*convention becomescustom/<set>/…in the brand's own naming. Hand-written token sets still work for small cases.
ADR-33 Skins never bundle fonts
- Context: the Material note asked whether to bundle Roboto, and the Carbon note bundled IBM Plex Sans. Fonts add hundreds of KB per app, and some can't be redistributed (Apple's SF Pro may not ship outside Apple platforms).
- Decision: no skin bundles a font. Every starter theme takes
fontFamily, defaulting to the platform font (CamoTypography.system()); each skin note names the font for the authentic look, and the app adds it. - Consequences: the font stays a brand decision in the theme (ADR-28). Tooling reports fonts a tokens file uses but the app doesn't have; it never adds font files.
ADR-34 The web port (Later) is built as Web Components
- Context: Studio's web canvas and a web export need Camouflage on the web. Covering React, Vue, Svelte and Angular separately would be several ports.
- Decision: a Later third platform, Camouflage for web, built as framework-neutral Web Components (custom elements), with its own
web/docs mirroringbase/. Themes map to CSS custom properties (which cross the Shadow DOM), a nested provider becomes a wrapper element, and form fields useElementInternals. - Consequences: one web implementation for every framework. The
camogenerator gains a web target (CSS variables and a typed theme object), and Studio a web canvas. - Amended by ADR-43 (how web themes are written and extended).
ADR-35 Camouflage builds what apps would borrow from Material
- Context: without a component, apps mix in Material widgets (a date picker first), which brings Material's look and theme into a Camouflage app. A
ThemeData/MaterialThemebridge was considered and rejected: the goal is to never need Material. - Decision: the components apps would borrow in a first release move from Later to v1:
CamoDatePicker(single and range, plus theCamoCalendarbuilding block),CamoTimePicker,CamoStepper,CamoAccordion. No Material bridge package. - Consequences: v1 = 40 component notes and 39 renderers. Core gains its first non-UI dependencies for dates:
kotlinx-datetime(plus a smallexpect/actualfor localized names, the first day of the week and the 12/24-hour setting) and Dart'sintl. Pickers' forms (calendar or wheel; fields, dial or wheel) are theme choices (ADR-28).
ADR-36 Publishing namespace is com.srctool
- Context: the Maven group was open between
org.srctool(if the author could verifysrctool.org) andio.github.srctool. The author bought srctool.com instead (verification in progress on 2026-10-02). - Decision: Maven group
com.srctool.camouflage, Kotlin package rootcom.srctool.camouflage.*, convention plugin idscom.srctool.*, the pub.dev verified publishersrctool.com, and the tokens schema underhttps://srctool.com/. If verification fails, the fallback group isio.github.srctool.camouflage. - Consequences: only the
srctool { publishing { groupId } }value would change on fallback. Sinew uses the same domain (com.srctool.sinew).
4. Build steps
- When a base contract changes, add an ADR here before editing the notes.
- Link the ADR from the changed note's §5.
- If it breaks the public API, plan a deprecation cycle (mark the old API deprecated for one minor version, then remove it in the next major).
Done when
- Every change to a base contract has an ADR number here.
5. Edge cases
| Case | Decided behavior |
|---|---|
| A platform can't follow an ADR | Record it as a platform exception in that platform note's §5, linked here. Don't fork the ADR. |
| An ADR turns out wrong | Add a new ADR that supersedes it. Never edit history. |
ADR-37 Sinew's final shape, as Camouflage sees it
- Context: ADR-29 described Sinew as it was planned then ("generic
Response/PagingResponsemapping, paging use cases, view state"). Sinew's own docs have since settled a different shape. - Decision: nothing in Camouflage's contracts changes.
CamoPagedListStatestays a plain state with aPagedError(message: String). The current description of Sinew, which supersedes the descriptive part of ADR-29:- Sinew's paging is a
Pager<T>writing aPagingStatewhoseViewStateisLoading | Done | Failed(noIdle). A list starts asLoading+Initial, soCamoPagedListshows its skeleton from the first frame. - Sinew's error messages are keys or backend text, rendered at display time. The glue (
sinew_camouflage, which depends onsinew_l10n) renders the message with the app's localizer when it buildsCamoPagedListState, so the list's error text follows the current language. - Sinew drops a list's items on refresh, so
PagedListTheme.refreshKeepsItems = trueisn't supported through Sinew's glue. Other sources can still use it. - The glue is
PagingState<T>.toCamo(localizer). Kotlin adds a@Composable toCamo(), and FluttertoCamoOf(context).
- Sinew's paging is a
- Consequences: none for Camouflage's code. The dependency rule is unchanged: Camouflage never depends on Sinew, and only
sinew_camouflageknows both.
ADR-38 The Fluent skin ships in v0.1, alongside Minimal
- Context: Graft, the author's desktop git client (Kotlin, Compose Desktop), is styled as Fluent 2 using the token mapping of Fluent Skin, and plans to switch its
ui-kitto Camouflage'sfluentSkin()once a desktop skin is published. Fluent is also the natural dialect for desktop and enterprise apps. And a second, structurally different skin built from M3 tests the Skin contract with two real dialects before 39 components depend on it. - Decision:
- v0.1 ships two skins: Minimal and Fluent (module
camouflage-skin-fluent, packagecamouflage_skin_fluent), on Kotlin and Flutter. Kotlin is built first, as for every milestone. - Fluent is built alongside each milestone, not as a milestone of its own: M3 adds the
Subtlefeedback, the double-stroke focus, theSolidsurface with Fluent's shadow ramp,fluentThemeand the M3 renderers; M5 to M8 add the Fluent renderers for their components; Acrylic comes with the overlays (M6) and Mica with the navigation chrome (M8). - The full scope of the Fluent note:
Solid,AcrylicandMica, plus the compact desktop density (24 small / 32 medium) through component themes. - Supersedes ADR-22 for Fluent only. Material, Cupertino and Carbon stay Later.
- v0.1 ships two skins: Minimal and Fluent (module
- Consequences:
- From M3, every component milestone builds two renderer sets, and the M4 demo can switch skin as well as brand.
- No Material dependency is added: like Minimal, Fluent draws everything on Compose foundation and Flutter widgets.
- Acrylic and Mica bring the first platform-specific dependencies into a skin (a backdrop blur in Compose; Windows window-backdrop interop on both platforms). They stay inside the Fluent module, chosen in its platform notes.
- Graft becomes the first real app on Camouflage once v0.1 is published.
ADR-39 Contract types arrive with their component
- Context: The Theme and Skin Contract notes asked for the whole contract up front: every
XTheme(component theme) in M1, and all 39 renderer interfaces,CamoSkinfields andDebugSkinrenderers in M2. But a renderer'sXState,XSlotsandXStyleare defined by its component note and only arrive with that component (M3 to M8). Writing them early means designing 39 components' data ahead of their milestones, then revising them when each component is built. Kotlin also can't declare the empty data classes the Theme note planned as placeholders. - Decision:
- M1 ships
CamoComponentThemesas an empty holder. M2 ships the contract mechanism: the shared types (InteractionState,IconStyle),SurfaceTreatment,InteractionFeedback,CamoSkin(name, surfaceTreatment, feedback), the skin-author helpers, the provider andDebugSkin's no-op surface and feedback. - Each component's milestone adds, together: its
XThemefield inCamoComponentThemes, itsXState/XSlots/XStyle, itsXRendererinterface, its required field inCamoSkin, and its renderer inDebugSkin, Minimal and Fluent. - Until the icon renderer exists (M3), the provider's root icon style is core's default (20,
onSurface, the Minimal value under ADR-24).
- M1 ships
- Consequences:
CamoSkinstill has no defaults, so adding a field breaks every skin at compile time. Before v0.1 nothing is published, so that is the intended forcing function: a milestone isn't done until every skin implements its new renderers.- M2's behavior-modifier test (Kotlin) uses a test-only renderer. The
ButtonStyle.mergetest andDebugSkin's labelled button come withCamoButtonin M3. - Kotlin's "
CamoDialogFrameinside a nested provider" test moves to M6 with the frame.
ADR-40 v0.1 ships all five skins and the full component set
- Context: M0 to M7 are built with Minimal and Fluent (ADR-38). Material, Cupertino and Carbon, and the "Later" rows of Component Inventory, waited for after v0.1. The user wants v0.1 to be the complete library: every skin, every component, and charts as a core component.
- Decision:
- v0.1 ships five skins: Minimal, Fluent, Material, Cupertino (with Liquid Glass) and Carbon, on Kotlin and Flutter. Supersedes ADR-22's "Later" for the other skins and ADR-38's "Material, Cupertino and Carbon stay Later".
- Every "Later" row of the inventory moves into v0.1, plus charts in their own package,
camouflage-charts/camouflage_charts(layer 1, ADR-27: it depends only on core, and no skin depends on it; pinned by the BOM with the core set): a family on one shared chart frame (axes, grid, legend, tooltip, series colors from the theme, animation, RTL, and an accessible data-table fallback), drawn without a third-party chart library:CamoLineChart(line, area, stacked area),CamoBarChart(vertical, horizontal, grouped, stacked),CamoPieChart(pie, donut with a center label) andCamoSparkline(axis-less inline trend). Other chart types (scatter, combo, radar, heatmap, candlestick, gauge, funnel, sankey, treemap, maps) come in later versions of the same package. - How a skin reaches a chart without either package importing the other: (1) the theme's tokens (series palette from the color families, typography, shapes, spacing, motion); (2) the active skin's parts at runtime: the tooltip renderer,
CamoChip/CamoTextlegend,CamoSkeletonloading,CamoCardframe,Camouflage.skin.feedbackandsurfaceTreatment; (3) aChartStylepreset per skin name shipped as data in the charts package (minimal, fluent, material, cupertino, carbon), for what tokens can't say (gridlines, line width, markers, area opacity, bar corners); (4) overrides: a brand'sChartTokenstoken set (ADR-32),CamoCharts.registerPreset(name)for third-party skins, and aChartRendererthroughCamoChartsProviderfor full control. Resolution order: theme-derived defaults → preset forCamouflage.skin.name→ChartTokens→ per-chart parameters; an unknown skin gets the theme-derived defaults. - Charts are not part of the skin contract:
CamoSkinandCamoComponentThemesgain no chart fields. - The milestones after M7 become: M8 Navigation chrome (with the context layer, ADR-41, and the materials rule, ADR-42); M9 Overlays and actions (popover, side sheet, toolbar, button group, split button); M10 Data (data table, tree, carousel, image, rating, file uploader, pagination, breadcrumb, progress steps); M11 Charts (the four chart components); M12 Material skin; M13 Cupertino skin; M14 Carbon skin; M15 Test + publish (the former M9).
- Components keep the ADR-39 rule: each lands with its Minimal and Fluent renderers. A skin milestone (M12 to M14) builds that skin's renderers for every component that exists by then.
- Consequences:
- v0.1 moves later; its scope is fixed by this list. Anything new after this goes to v0.2.
- Each skin adds a module (
camouflage-skin-material,-cupertino,-carbon; Flutter packages likewise) and joins the golden matrix. - The GitHub milestone "M9 Test + publish" and its issues are renamed to M15; M9 to M14 are new milestones with their own issues on board #7.
ADR-41 The context layer: environment, breakpoints and adaptive themes
- Context: Themes describe a brand, but UI conventions also depend on where the app runs: a phone or a desktop window, touch or a pointer, iOS or Windows. Tailwind (
md:variants), Mantine (theme.breakpoints) and Material (window size classes) all model this. Camouflage didn't: skins hard-coded such choices (Fluent's density, the snackbar's alignment), and apps had no theme-level way to say "denser on desktop". - Decision:
CamoEnvironment, computed by the root provider and overridable by any provider:windowSize(Compact/Medium/Expanded/Large),input(Touch/Pointer),platform(Android,Ios,MacOs,Windows,Linux,Web) andcapabilities(ADR-42). Read withCamouflage.environment(Kotlin) andCamouflage.environmentOf(context)(Flutter). It updates on resize and when a pointer appears.- Breakpoints in the theme:
CamoTheme.breakpoints(defaults 600 / 840 / 1200, Material's window size classes), so a brand can move them. - Adaptive themes: a theme can carry rules,
CamoTheme.adapt { env -> … }returning a copy for that environment (denser component themes onPointer, a larger type scale onExpanded, different token sets per platform). The provider applies them once per environment change, like reduced motion, so every component and renderer still reads one plain theme. - The effective theme carries its environment (
theme.environment), so a skin'sdefaults(theme)can follow a platform convention (touch-target size, hover affordances, density) without a contract change.
- Consequences:
- M8's adaptive navigation (bar, rail, drawer) is the first consumer; Fluent's density and the snackbar's alignment become environment-driven defaults.
- Tests and previews set the environment explicitly; goldens add a
Pointer+Expandedcombo. - The tokens JSON (Tooling) gains adaptive sections later; the runtime mechanism comes first.
ADR-42 Materials: the same behavior everywhere, the best surface each platform allows
- Context: Some materials only exist on some systems: Mica is a Windows 11 window backdrop, Liquid Glass an iOS 26 material, Acrylic needs a backdrop blur. They can't be reproduced identically everywhere, and a design system that promised that would either fail or fake it badly.
- Decision:
- Camouflage guarantees behavior and layout parity, not pixel parity, for materials. A material is a
SurfaceTreatmentwith a fallback chain (Liquid Glass → Classic blur → opaque; Mica → Solid; Acrylic → own blur → tint + noise over Solid), chosen at runtime. CamoCapabilitiesin the environment (ADR-41):backdropBlur,runtimeShaders,windowMaterial, and the user'sreduceTransparency. Skins choose their fallback from it, and apps can read it.- Each skin note keeps a material availability table (material × platform × what's drawn), and the Skins overview a summary.
- Reduce Transparency (or its platform equivalent) always wins: the opaque end of the chain.
- Camouflage guarantees behavior and layout parity, not pixel parity, for materials. A material is a
- Consequences:
- The Fluent and Cupertino skins test each step of their chains (goldens with capabilities forced off).
- Platform interop (Windows backdrop, macOS vibrancy) stays inside the skin modules, behind the capability check.
ADR-43 Web theming follows Tailwind and Mantine conventions, adjusted to Camouflage
- Context: the web port (ADR-34) needs a theming model. Tailwind (CSS-first theme variables) and Mantine (a provider, a theme object merged onto defaults, a color scheme attribute) already work for web teams, and Kotlin and Dart have no deep-merge
extend(a nested provider's theme replaces the whole theme). On the web, CSS gives partial overrides for free. Tauri apps (a webview with a Rust backend) are a first target for the port. - Decision:
- Theme is CSS custom properties with a
--camo-prefix, named from the Figma naming contract (Theme §3.12):color/on-primary-containerbecomes--camo-color-on-primary-container,shape/mediumbecomes--camo-shape-medium. Figma, CSS, Kotlin and Dart names stay one to one. - Brand token sets keep the brand's own names (ADR-32), unprefixed:
--brand-600,--radius-card. Roles alias them (--camo-color-primary: var(--brand-600)), the same way Tailwind scales and Mantine shades are used. - A provider element (
<camo-provider>) writes a theme's variables on itself. Nested providers override only the variables they set, so a partial theme needs no merge code. A skin is chosen by attribute (skin="cupertino"). - Color scheme is an attribute (
data-camo-scheme="light|dark") on any element, defaulting toprefers-color-scheme, so a subtree can be dark inside a light page. - A JS theme object is deep-merged onto a starter theme (
createCamoTheme({...}), Mantine style) and applied to an element. A TypeScript type mirrorsCamoTheme, andvalidateTheme()runs the same checks asvalidate(). - Component themes are variables (
--camo-button-height) with the same fields as the Kotlin and Dart component themes. Outside styling uses::part()hooks, not class names or style props. - Tailwind v4 interop: a preset (an
@themefile) maps Tailwind's variables to Camouflage's, so utilities such asbg-primaryfollow the Camouflage theme. Importers turn a Tailwind or Mantine theme into the tokens JSON. - Not copied: utility classes as the way to restyle components, and Mantine-style style props. Components read roles, and a skin decides the look.
- Theme is CSS custom properties with a
- Consequences:
- The web gets partial overrides and a per-subtree color scheme that Kotlin and Dart lack. Whether Kotlin and Dart should gain the same deep merge is a separate question, recorded in the Theme note.
- The
camogenerator's web target emits the variables file, the Tailwind preset and the typed theme object from the same tokens JSON. - Extensions still only change the UI through roles and component themes that reference them (the same limit as ADR-32).
- Tauri apps use the same Web Components in the webview. No Rust port is needed; Rust passes data through commands and events.
ADR-44 (Proposed, after v0.1) Providers can adjust the inherited theme
- Status: proposed. It changes the provider contract, so it waits for review and does not block v0.1.
- Context: in Kotlin and Dart a provider's
themereplaces the inherited theme completely. To change one thing for a subtree (a different accent on a promo banner, one more token set), the app must hold the base theme and callcopy/copyWithitself. Tailwind'sextendand Mantine'screateThememerge a partial theme onto the defaults, and on the web (ADR-43) a nested provider gets this from the CSS cascade. The three platforms should behave the same. - Decision (proposed):
CamouflageProvidergains an optionaladjustThemefunction applied to the effective theme (its owntheme, else the inherited one): KotlinadjustTheme: ((CamoTheme) -> CamoTheme)?, FlutteradjustTheme: CamoTheme Function(CamoTheme)?. Typical use:adjustTheme = { it.copy(colors = it.colors.copy(primary = promo)) }.- A token set added by
adjustThemereplaces an existing set of the same type (a theme never holds two of a type;validate()still reportsDuplicateTokenSetfor a hand-built theme that does). - No new partial-theme types: a function over the existing immutable classes avoids a second parallel set of "optional" classes and keeps
copyas the one mechanism. - The web provider keeps its attribute and cascade model (ADR-43);
createCamoThemeis the equivalent ofadjustThemefor a JS theme object.
- Consequences:
- No breaking change:
adjustThemedefaults to null. - Animated theme switches (
lerp) work as before, since the result is an ordinaryCamoTheme. - The provider note, the Kotlin and Flutter provider notes and the Theme note get the new parameter and an edge case (
adjustThemeruns before the provider's system adjustments, so reduced motion still wins). - Not decided here: whether
adjustThemeshould also be allowed onCamouflageApp(Flutter), and whether Studio exports an adjust function.
- No breaking change:
ADR-45 (Accepted, M16) The skin contract grows by two renderers for desktop: split pane and scrollbar
- Status: accepted and built (proposed 2026-11-11, built 2026-11-21); ships in 0.2.0. The five skins and the test skins implement both renderers; document tabs, the dock layout and the command palette added none.
- Context: Graft, a desktop Git client that builds its
ui-kiton the Carbon skin, needs a resizable split pane and themed scrollbars (srctool/camouflage#71, #78). Both need a skin to draw something (a divider line, a thumb), and the contract has no defaults (a skin cannot forget a component). - Decision:
CamoSkingainssplitPaneandscrollbarrenderers (52 → 54). All five included skins implement them, and the debug and plain test skins too.- Density (srctool/camouflage#70) and submenus (#77) add no renderer: density is a token set read by existing renderers; a submenu row is the menu's Item part with two more state fields.
- Because adding a renderer breaks third-party skins, the release that carries it is 0.2.0, and the changelog says so. Skins written against 0.1 add the two renderers (the contract's compile error names them).
- Consequences:
- The skin contract note counts 54 renderers; the skin notes' "52 renderers" done-when lines become 54 for M16 work only.
- Later desktop pieces (document tabs, the dock layout, the command palette) should prefer composing existing renderers, and add a renderer only when nothing existing can draw them.
ADR-46 (Accepted, W0; amended) The web port: TypeScript and Lit, skins as render functions in separate packages, server rendering as a goal
- Status: accepted after the W0 spike (srctool/camouflage-web#1, #5, #6), with the amendments below. One check is still open and named: the Tauri window on Windows and Linux (W1; macOS matches). Next.js App Router passed (ADR-47).
- Context: ADR-34 and ADR-43 settle that the web port is Web Components with CSS-variable themes. Still open were the implementation language and library, how skins work (they change structure, so CSS alone can't express them), and whether server rendering is supported. The target is parity with v0.2.0 of the Kotlin and Dart libraries, usable from any web framework and from Tauri.
- Decision (proposed):
- TypeScript, strict. The contract is typed (
CamoSkinwith one required renderer per component, finished withsatisfies CamoSkin), as the Kotlin data class and Dart class are. - Lit 3 for the elements,
@lit/context(the W3C context protocol) for the skin and environment. Stencil was considered and rejected for now because it ties skin packages to its compiler; wrappers can be generated later from the Custom Elements Manifest. - Skin model B: a component element owns state, behavior and accessibility, and calls the skin's pure render function (state, slots, theme, style → a template). Skins are separate packages with a side-effect-free main entry and an opt-in
registerentry. Slots are native<slot>elements. A skin object may be spread to override or borrow renderers. - Server rendering is a goal. Components use shadow DOM, renderers are pure, the skin is named by attribute, initial state comes from attributes, and measured values correct after hydration. Lit's server rendering (
@lit-labs/ssr, a labs package) is the first choice; a small renderer of our own over the same pure functions is the fallback, decided at the end of the spike. - Scope and version: parity with Kotlin and Dart v0.2.0, with milestones W0 to W10 in the web Overview. The web packages use
0.2.0-alpha.Nuntil parity, then0.2.0.
- TypeScript, strict. The contract is typed (
- Consequences:
- The contract notes need no change. A new
web/note tree implements them (Overview, Project Setup, Skin Contract, Provider and Scoping, SSR and Hydration). - The sync script shows web notes as a "Web (planned)" section; it does not add a language switch.
- A new repository check (layers, side effects, size budget) and a shared scenario list keep the three libraries aligned.
- The component-provider fallback (a lone component with no provider uses Minimal) differs from Kotlin and Flutter and needs review.
- The contract notes need no change. A new
- Amendments from the spike:
- Lit's server rendering carried the skin and provider model, so it is the choice and our own renderer stays plan B (ADR-47).
- A component with no provider is not a Minimal fallback by default: the fallback is an opt-in registration, and without one the element renders unstyled and warns once (ADR-48).
- The package uses
static propertieswithdeclarefields, not decorators. - The contract's single
contentslot is the default slot on the web. - Each class carries
@tagname,@slot,@firesand@attrJSDoc for the Custom Elements Manifest, and a test compares the manifest with the contract.
ADR-47 (Accepted, W0) Web server rendering uses Lit's server package
- Status: accepted. The spike's pages render on the server, are correct with scripts off, and hydrate with no layout jump in Chromium and WebKit (Firefox runs in CI).
- Context: ADR-46 made server rendering a goal, with
@lit-labs/ssrfirst and our own renderer as the fallback. - Decision: use
@lit-labs/ssr4.x with@lit-labs/ssr-clientfor hydration. The rules the spike found:- Install the DOM shim first, then
await importthedefineandregisterentries (static imports are hoisted and run before the shim), then setLitElementRenderer.renderOptionsto callconnectedCallback, so context reaches the elements. - Initial state comes from attributes only. Role and name are set from
willUpdateand mirrored as attributes markeddata-camo-ssr-aria, which the client removes onceElementInternalstake over. - A server-rendered dialog is open but not modal, so core centres it with a frame style and the skin paints the scrim with a
box-shadow; on hydration it is closed and shown as a modal, and theclosethat causes is ignored once. The two paints differ by under 50 pixels in a Playwright test. - The hydrated modal must draw no focus ring of its own (WebKit did), so initial focus goes to an action.
<html>cannot be part of a Lit template; the page shell is a string around the streamed template.
- Install the DOM shim first, then
- Consequences:
- The labs status stays a risk: pin the versions and re-run the hydration tests on every upgrade (they are in CI).
- Plan B (our own renderer over the pure render functions) is not built. Build it only if a later milestone finds something Lit's server cannot carry.
- Next.js 16 App Router is proven: a Server Component renders the Lit template and a Client Component defines the elements (the skins before
define, which goes last).@lit-labs/nextjsis not used, since it supports Next 13 to 15 only. Plain JSX tags give no server shadow DOM, so apps use the Lit-template boundary, and a React wrapper from the manifest can hide it (W10).
ADR-48 (Accepted, W0) A web component with no provider renders unstyled and warns, and the fallback skin is opt-in
- Status: accepted; this keeps web different from Kotlin and Flutter on purpose.
- Context: the Provider note proposed that a lone
<camo-button>in plain HTML falls back to Minimal. Kotlin and Flutter fail fast. - Decision:
- A skin's
registerentry registers it by name, and may mark itself the fallback (registerSkin(skin, { theme, fallback: true })). Minimal'sregisterentry does. Importing a skin's main entry registers nothing. - With a fallback registered, a component with no provider uses it and the skin's starter theme.
- With none, a component renders an unstyled but working element (slots and text) and logs one warning naming the missing
<camo-provider>; it does not throw, because a throw would break server rendering of the whole page. - A
skinattribute that names an unregistered skin logs a warning naming it, then falls back the same way.
- A skin's
- Consequences: plain-HTML use works after one import; apps that want strictness simply do not import a fallback. A test covers each case on the server.