# @kurotako/gen-angular

## 0.5.0

### Minor Changes

- 147a177: Mode B packages now resolve their generator sub-paths: the generated `package.json` declares an explicit `exports` entry (`types`, `import`, `require`) for every generator in the namespace, so `<scope>/<ns>/zod`, `/typescript` and `/angular` resolve their `dist/<generator>/index.*` instead of the non-existent `dist/<generator>.js` (`ERR_MODULE_NOT_FOUND` / `TS2307`). The `./*` pattern still serves single files, so `<scope>/<ns>/zod/index` keeps working.
  
  Breaking: the synthesized root barrel `<ns>/index.ts` no longer re-exports UI-framework generators. `GeneratorArtifact` gains `exportFromRoot` (default `true`); `gen-angular` and `gen-react-tanstack` set it to `false`, so importing `<scope>/<ns>` from a plain Node process no longer loads `@angular/forms` or `@tanstack/react-form`. Import those from `<scope>/<ns>/angular` or `<scope>/<ns>/react-tanstack`.

### Patch Changes

- Updated dependencies [147a177]
- Updated dependencies [147a177]
- Updated dependencies [147a177]
- Updated dependencies [3050057]
  - @kurotako/ir@0.7.0
  - @kurotako/gen-zod@0.5.0
  - @kurotako/core@0.4.0
  - @kurotako/config@0.2.1

## 0.4.0

### Minor Changes

- f58eccc: `angularGenerator` now embeds its own private copy of `@kurotako/gen-zod` instead
  of requiring a `zod` entry in the config. The Zod schemas it imports are emitted
  under `<namespace>/angular/zod/`, so the generated imports become
  `<namespace>/angular/zod/...`. `@kurotako/gen-zod` moves from `peerDependencies`
  to `dependencies`, and the Zod peer range is merged into the package's
  `peerDependencies` in output mode B.
  
  New option `zodVersion` (`3 | 4`, default `4`) selects the Zod API flavor of that
  private copy, replacing the `zodVersion` previously set on the `zod` entry.
  
  Migration: remove `zodGenerator` from your config unless your own code imports
  `<namespace>/zod`; keeping it produces two copies (accepted). If you set
  `zodVersion: 3` on the `zod` entry, set it on the `angular` entry instead. Update
  any `outputs[].generators` filter that listed `zod` only for angular's sake.

### Patch Changes

- 0ea85b1: Internal refactor: the control initial-value logic now comes from the shared
  `formInitExpr` helper of `@kurotako/ir`. No change to the generated output.
- Updated dependencies [f58eccc]
- Updated dependencies [f58eccc]
- Updated dependencies [f58eccc]
- Updated dependencies [0ea85b1]
  - @kurotako/config@0.2.0
  - @kurotako/core@0.3.0
  - @kurotako/gen-zod@0.4.0
  - @kurotako/ir@0.6.0

## 0.3.5

### Patch Changes

- Updated dependencies [37a4e84]
  - @kurotako/ir@0.5.0
  - @kurotako/config@0.1.6
  - @kurotako/core@0.2.3
  - @kurotako/gen-zod@0.3.7

## 0.3.4

### Patch Changes

- Updated dependencies [a3d63ef]
- Updated dependencies [a3d63ef]
  - @kurotako/gen-zod@0.3.6
  - @kurotako/ir@0.4.0
  - @kurotako/config@0.1.5
  - @kurotako/core@0.2.2

## 0.3.3

### Patch Changes

- 475fb0a: Fix a `bigint` `FormControl`'s literal default seeding as a quoted string
  (`'0'`) instead of a bigint literal (`0n`), mismatching the control's
  declared `FormControl<bigint>` type.
- Updated dependencies [475fb0a]
- Updated dependencies [475fb0a]
  - @kurotako/gen-zod@0.3.5
  - @kurotako/ir@0.3.1

## 0.3.2

### Patch Changes

- 69f41ac: The two relative specifiers emitted by this generator's barrel (`./zod-forms.runtime`,
  `./<entity>.form`) now carry an explicit `.js` extension, so the generated code compiles
  under `moduleResolution: node16`/`nodenext` (previously `TS2307`/`TS2835`).
- Updated dependencies [69f41ac]
- Updated dependencies [69f41ac]
- Updated dependencies [69f41ac]
  - @kurotako/core@0.2.0
  - @kurotako/gen-zod@0.3.2
  - @kurotako/config@0.1.4

## 0.3.1

### Patch Changes

- c1437da: Same root cause as the `parser-openapi`/`gen-typescript` fix (`fix-stale-ir-dependency-range`, `fix-lockfile-workspace-resolution`): every package published before the `bun.lock` / release-workflow fix still carries a stale internal dependency range from the drifted lockfile.
  
  - `@kurotako/core@0.1.2` and `@kurotako/config@0.1.2` declare `"@kurotako/ir": "^0.2.0"`. `@kurotako/core` is what actually runs IR validation during `tako generate` — with this stale range, its own nested `@kurotako/ir@0.2.0` copy gets resolved instead of `^0.3.0`, so `array`/`map` field types still fail validation even with `parser-openapi@0.2.2`/`gen-typescript@0.3.2` installed.
  - `@kurotako/parser-prisma@0.2.1`, `@kurotako/gen-zod@0.3.0` and `@kurotako/gen-angular@0.2.0` declare the same stale `"@kurotako/ir": "^0.2.0"`.
  - `@kurotako/cli@0.1.1` declares `"@kurotako/core": "^0.1.1"` / `"@kurotako/config": "^0.1.1"`, both below the packages' actual current versions.
  
  No source change needed anywhere (`workspace:^` already resolves correctly with the fixed release workflow); this changeset only forces the patch releases needed to publish corrected tarballs.
- Updated dependencies [c1437da]
  - @kurotako/core@0.1.3
  - @kurotako/config@0.1.3
  - @kurotako/gen-zod@0.3.1

## 0.3.0

### Minor Changes

- 9fe08b3: Add an `array` field type to the IR and bump the IR format to `'4'`.
  
  - `@kurotako/ir`: new `{ kind: 'array', element: FieldType }` field type, so an
    array-typed type alias, union variant or map value can be represented (the
    boolean `Field.list` fast path stays as an optimisation for a plain
    `property: { type: 'array', items: <scalar|ref> }`). Builders (`.array(...)`),
    validation, reference traversal, cycle analysis and TypeScript-type helpers
    recurse through it. The strict compatibility check now requires `irVersion` `'4'`.
  - `@kurotako/gen-zod`: renders an array as `z.array(<element>)` and its TS type as
    `<element>[]`.
  - `@kurotako/gen-typescript`: renders an array as `<element>[]`, parenthesising a
    union element.
  - `@kurotako/gen-angular`: renders an array field as `FormControl<<element>[]>`
    seeded with `[]`.
  - `@kurotako/parser-openapi`: an array schema that is not a plain object property
    (an array-typed response/component alias, a nested array, an array inside a
    `oneOf`/`additionalProperties`) now maps to the `array` field type instead of
    silently dropping the array wrapper. Nested arrays are supported.
- ecdb02c: Add the OpenAPI parser and IR typed maps.
  
  - `@kurotako/ir`: adds the `{ kind: 'map', value: FieldType }`
    field type and the optional `Entity.additionalProperties` slot. Builders,
    validation, reference traversal, cycle analysis and TypeScript-type helpers
    recurse through both.
  - `@kurotako/gen-zod`: renders map values as `z.record(z.string(), value)` and an
    entity catch-all as `.catchall(value)`.
  - `@kurotako/gen-typescript`: renders map values as `Record<string, Value>` and an
    entity catch-all as an index signature.
  - `@kurotako/gen-angular`: renders a map field as `FormControl<Record<string, Value>>`
    seeded with `{}`; entity-level catch-all values stay under the emitted Zod validator.
  - `@kurotako/parser-openapi`: new package. Turns an OpenAPI 3.0/3.1 document (local
    JSON/YAML or an unauthenticated HTTP(S) URL) into one `SourceIR`, mapping component
    and inline operation schemas to deterministic entities, aliases, enums and typed maps.

### Patch Changes

- 0c8e725: Fix reactive form generation for `FieldType.ref` / non-discriminated `union` fallback
  fields (produced by `@kurotako/parser-openapi` from `$ref` payload properties): the
  emitted interface member is now `FormControl<T | null>` and the control is seeded with
  `null`, matching the type Angular's `FormControl` constructor actually produces for a
  non-`nonNullable` control. Previously the interface declared `FormControl<T>` while the
  `new FormControl<T>(...)` call resolved to `FormControl<T | null>`, so the generated
  `*.form.ts` failed to type-check.
- Updated dependencies [9fe08b3]
- Updated dependencies [ecdb02c]
- Updated dependencies [22e6559]
  - @kurotako/gen-zod@0.3.0
  - @kurotako/ir@0.3.0
  - @kurotako/core@0.1.2
  - @kurotako/config@0.1.2

## 0.2.0

### Minor Changes

- da7dd32: Union-type control support. A `{ kind: 'ref' }` field now types its control as
  the Zod-emitted DTO / alias name (`FormControl<AddressDto>`); a non-discriminated
  `union` types as the variant types joined (`FormControl<string | number>`), a branch whose ref is
  in `GenerateContext.cycles` widening the control to `unknown`. Both fallback
  controls carry a `// union: validated by zodValidator(schema)` note and a
  `logger.warn`.
  
  A **discriminated** union field (`discriminator.mapping` set, every target an
  entity in the same source) becomes a nested `FormGroup` holding a discriminator
  `FormControl` plus one `FormGroup<<Variant>FormControls>` per discriminator
  value, built by delegating to the target entity's injected `FormFactory`. A new
  runtime helper `switchDiscriminatedGroup` toggles the active sub-group on the
  discriminator control's `valueChanges` and rewrites the group's `getRawValue()`
  to the flat active-variant shape a root `z.discriminatedUnion` schema can parse.
  
  A `{ kind: 'ref' }` field whose target is an alias resolves its type through the
  Zod artifact's alias entry; `gen-angular` itself adds no alias entry to its own
  artifact (aliases produce no Angular form and `gen-zod`'s `<ns>/zod/aliases.ts`
  is the single exporter — re-declaring them would make the root-barrel ambiguity
  check flag a phantom conflict).

### Patch Changes

- Updated dependencies [489a50d]
- Updated dependencies [c575bc1]
- Updated dependencies [6307397]
- Updated dependencies [7a50439]
  - @kurotako/core@0.1.1
  - @kurotako/gen-zod@0.2.0
  - @kurotako/ir@0.2.0
  - @kurotako/config@0.1.1

## 0.1.0

### Minor Changes

- First public release.

### Patch Changes

- Updated dependencies
  - @kurotako/ir@0.1.0
  - @kurotako/core@0.1.0
  - @kurotako/config@0.1.0
  - @kurotako/gen-zod@0.1.0
