Files
Teffen EllisandPlaypen Agent fd5aee1fd1 web: Replace JSDoc types with TypeScript (#25525)
* web: replace JSDoc types with TypeScript sources for build tooling

Node runs TypeScript directly now, so the build scripts, bundler plugins,
and `@goauthentik/core` no longer need to be JavaScript annotated with
JSDoc. Every module reachable from `scripts/build-web.ts` is now real
TypeScript, run under Node's type stripping.

The package.json `imports`/`exports` maps point at the `.ts` sources
instead of pairing a `.js` runtime entry with a generated `.d.ts` under
`out/`, so types resolve on a clean checkout without a declaration build
first. Type stripping does not rewrite `.js` specifiers back to `.ts`,
so relative imports name the real file on disk and `web/tsconfig.json`
enables `allowImportingTsExtensions`.

Two suppressions in the locale scripts turned out to be a real
soundness gap rather than the `@lit/localize-tools` bug the tsconfig
comment claimed. `Config["output"]` is a union, and `outputDir` is only
required on its runtime variant, so the unnarrowed access was
legitimately `string | undefined`. `build-locales` only works in
runtime mode, so it now validates `output.mode` up front the way it
already validated `interchange.format`; the narrowing that follows
removes both the cast and the `@ts-expect-error`, and a misconfigured
`lit-localize.json` fails with a clear message instead of a TypeError
inside the library. Regenerating all 18 locale modules produces
byte-identical output.

Co-Authored-By: Playpen Agent <[email protected]>

* web/elements: show forms slotted into a wizard step

A Form renders nothing while `visible` is false, and that flag is driven by an
IntersectionObserver on the form itself. The two states feed each other: an
invisible form renders nothing, a form that renders nothing has no box, and an
element with no box never reports as intersecting. A step that lands in that
state stays blank permanently -- no error, no console message, just an empty
wizard page whose Create button then posts an empty payload.

ModalForm and ak-modal already set the flag when they slot a form in. Nothing
did so for a wizard step, which left it to chance whether the observer happened
to catch the element while it still had layout.

Confirmed against a running instance: the provider wizard's OAuth2 step mounted
ak-provider-oauth2-form with an empty shadow root, `visible === false` and a 0x0
box, and setting `visible = true` by hand rendered all nine inputs immediately.

This was surfacing as an intermittent e2e failure in every suite that drives the
provider wizard -- the dialog never closes, because the wizard cannot advance
past a step whose form was never there.

* web/elements: keep the current selection in a search select's options

fetchObjects returns a single page, so an object selected out of band -- one just
created through the dropdown's own action, say -- is frequently absent from it.
The view resolves a value's label from the options alone and prints the raw value
when it finds none, so the control would sit there showing a bare primary key
while holding a perfectly good selected object.

Confirmed on the invitation form, whose flow select creates an enrollment flow
from its own action: the new flow sorts by slug into a page the select had not
fetched, so it displayed a UUID. Include the selection in the options when the
fetched page omits it.

* Fix drift.

---------

Co-authored-by: Playpen Agent <[email protected]>
2026-09-18 04:23:25 +00:00
..