mix joby_kit.gen.wrapper (JobyKit v0.1.1)

Copy Markdown View Source

Scaffolds a new wrapper component end-to-end:

  1. Inserts a function-component skeleton in the target module (<App>Web.CoreComponents or <App>Web.CompositeComponents). The skeleton already satisfies the wrapper contract: data-component, attr :rest, :global, declared slot.
  2. Inserts a component/3 registration in <App>Web.DesignManifest (immediately before def daisy_overrides, falling back to the module's closing end).
  3. Inserts a <name>_preview/1 function in <App>Web.DesignPreviews, adding an alias line for the host module if necessary.

After the task runs, mix joby_kit.lint should report clean for the new component.

Usage

mix joby_kit.gen.wrapper modal --daisy modal
mix joby_kit.gen.wrapper chat_panel --category composite

Options

  • --categorycore (default) or composite.
  • --daisy — daisyUI primitive id (see JobyKit.DaisyCatalogue). Only meaningful for --category core. Pre-populates the root element's class with the primitive's daisy class string.
  • --manifest — manifest module name. Defaults to <App>Web.DesignManifest.
  • --web — web module name. Defaults to <App>Web derived from mix.exs.

Conventions

Component names must be snake_case. The function name and the preview name (<name>_preview) must not already exist in the respective files; the task fails loudly rather than overwriting.

Domain composites

Domain composites (category: :domain) live in host-specific modules and aren't supported by the generator yet — register those by hand or use this task with --category composite and re-categorize the manifest entry afterward.