mix crosswake.gen.native_controls_ui (crosswake v0.2.4)

View Source

Generates host-owned, brand-tokenized native-controls fallback UI.

Copies exactly two files, verbatim from library templates, into the target Phoenix host:

  • lib/<app>_web/components/crosswake_fallbacks.ex — a Phoenix.Component module carrying confirm_modal/1 (two tones: neutral and destructive), action_menu/1, and fallback_alert/1
  • priv/static/assets/crosswake_fallback.css — its stylesheet, a scoped --cwfb-* alias layer over the library's --cw-* tokens

Why this ships as a generator, not an importable module

Crosswake.ComponentTierGuard (Phase 155) statically forbids any Phoenix.Component/~H/attr/slot usage anywhere under lib/ in this package. Presentation adopters restyle is a generator concern, never an importable-tier concern — the same rule that already governs mix crosswake.gen.offline_ui and mix crosswake.gen.bridge_hook.

The confirm modal is the current required fallback

Phoenix-owned confirmation is the current required fallback on every platform. Native alert/confirm is stopped and may be reconsidered only after passed physical-iPhone proof, a demonstrated active-adopter route blocker, and an explicit maintainer roadmap decision. The generated confirm_modal/1 makes zero Crosswake.Bridge calls: no push, no ref, no resolve/2, no denial branch.

If you can offer undo instead of asking "are you sure?", offer undo instead of this modal (Nielsen Norman Group).

No-clobber, stamped provenance

Re-running this task never overwrites either file — each existing file is reported as skipped, and re-running it after deleting only one file copies back just the missing one. There is no --force and no three-way merge. Both written files carry a crosswake:native-controls-ui provenance stamp naming the template version they were copied from (mix crosswake.gen.bridge_hook's stamp shape). You own both files outright from the moment they are written — Crosswake will never rewrite them.

Usage

mix crosswake.gen.native_controls_ui
mix crosswake.gen.native_controls_ui --app MyApp --dir /path/to/host

Options

  • --app — the target application module name (defaults to auto-detect)
  • --dir — the target host directory (defaults to the current directory)

Summary

Functions

The stamp slug both generated files' provenance header contains, so mix crosswake.doctor can regex-parse either file's stamp identically. The Elixir file carries it behind a # line comment; the CSS file behind a /* ... */ block comment — the slug itself is comment-syntax-agnostic.

Functions

stamp_prefix()

@spec stamp_prefix() :: String.t()

The stamp slug both generated files' provenance header contains, so mix crosswake.doctor can regex-parse either file's stamp identically. The Elixir file carries it behind a # line comment; the CSS file behind a /* ... */ block comment — the slug itself is comment-syntax-agnostic.