Skip to content

Feat/angular lang scaffold - #1167

Open
muhammedgider wants to merge 5 commits into
thesysdev:mainfrom
muhammedgider:feat/angular-lang-scaffold
Open

muhammedgider wants to merge 5 commits into
thesysdev:mainfrom
muhammedgider:feat/angular-lang-scaffold

Conversation

@muhammedgider

Copy link
Copy Markdown

Summary

This PR adds an initial @openuidev/angular-lang package for rendering OpenUI Lang in Angular applications, along with an Angular example app and test coverage for the core runtime behaviors.

It also fixes package distribution for @openuidev/angular-lang so the built package can be packed and installed correctly from the generated dist/angular-lang output.

Included

  • add @openuidev/angular-lang
  • add Angular example app under examples/app-frameworks/angular
  • add tests for:
    • component library creation
    • streaming renderer behavior
    • state hydration and updates
    • actions
    • query loading and mutations
    • render-error handling
    • validation/context helpers
  • add packaging fix for Angular dist output
    • build now patches dist/angular-lang/package.json
    • pack:check verifies npm pack --dry-run against the dist package

Packaging fix

Before this change, @openuidev/angular-lang built successfully but the packed tarball did not include the generated FESM/types output because the package root and dist output layout did not align.

This PR adds scripts/prepare-angular-lang-dist.mjs and wires it into the Angular package build to make the generated dist package publish/install-safe.

Verification

Ran:

  • pnpm --filter @openuidev/angular-lang run build
  • pnpm --filter @openuidev/angular-lang run pack:check

Also verified that the produced tarball can be installed in a clean temporary project.

@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

@muhammedgider is attempting to deploy a commit to the thesys-devs Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openui-docs Ready Ready Preview Sep 17, 2026 10:40am UTC

Request Review

@vishxrad vishxrad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this pr, we would love to publish a angular package for OpenUI. Here are some review comments.

Reviewed commit 6eb2093. Six actionable findings are attached inline.

Verification: the Angular package's 18 tests, build, typecheck, lint, formatting, and dist pack check passed; lang-core's 109 tests passed. The example builds with workspace dependencies on Node 26. Browser checks exercised static and nested rendering, query loading, mutation interaction, crash recovery, and the failing form scenario. Additional checks reproduced the packaging, reactive-input focus, TypeScript, and standalone-install issues below. The failed build-examples CI log confirms the Node-version mismatch. Real-model streaming and mobile behavior remain unverified.

Comment on lines +24 to +26
"@angular/build": "^22.1.7",
"@angular/cli": "^22.1.7",
"@angular/compiler-cli": "^22.1.5",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Update the CI Node version alongside Angular 22

The build-examples job in .github/workflows/build-js.yml still uses Node 20, but this Angular CLI requires Node >=22.22.3 (or supported newer majors). The current CI run reaches this example and exits with code 3: Node.js version v20.20.2 detected. The Angular CLI requires a minimum Node.js version of v22.22.3 or v24.15.0 or v26.0.0. I reproduced the same rejection locally under Node 20. Please update the example verification environment alongside these dependencies, or select an Angular version compatible with it.

CI log: https://github.com/thesysdev/openui/actions/runs/34600251868/job/105165209814

Comment thread packages/angular-lang/package.json Outdated
Comment on lines +8 to +11
"files": [
"dist",
"README.md"
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Route the actual release to the generated Angular package

ng-packagr writes to the repository-level dist/angular-lang directory, but this files list selects a package-local dist directory, and there is no publishConfig.directory redirect. The repository's Changesets release publishes workspace package directories. After a successful build, running pnpm pack from packages/angular-lang produced a tarball containing only package.json and README.md, with no runtime or declarations. The new pack:check passes because it explicitly packs a different directory. Please wire normal publishing to the generated package, or place the artifacts and entry-point metadata in the workspace package, and validate that same release path.

Comment on lines +101 to +103
this.destroyComponentRefs(this.componentRefs);
this.componentRefs = nextComponentRefs;
this.hostElement.nativeElement.replaceChildren();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Preserve component identity when reactive values update

For a tree with dynamic props, each store update produces a new evaluated node, and this path destroys all existing component instances and replaces their DOM. A regression test rendering root = Input($name) and updating $name from the input event confirmed that a single keystroke disconnects the original input and loses focus. This prevents continuous typing and also resets component-local state when responses update. Reconcile existing components by node identity and update their inputs instead of rebuilding the entire subtree on each change.

Comment thread pnpm-workspace.yaml Outdated
typescript: "^5.9.3"
rxjs: "^7.8.2"
tslib: "^2.8.1"
typescript: "^6.0.3"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Scope TypeScript 6 or migrate the existing package configurations

Upgrading the shared catalog changes the compiler used by existing packages as well as Angular. pnpm --filter @openuidev/lang-core typecheck now reports missing node:* modules, process, and NodeJS types in src/telemetry/install.ts. Running TypeScript 5.9.3 against the exact same unchanged lang-core source/configuration removes those Node-type errors; its separate type-mismatch error is pre-existing. Please give Angular its own compiler version, or update and verify the affected workspace tsconfigs as part of this upgrade.

"baseUrl": ".",
"ignoreDeprecations": "6.0",
"paths": {
"@openuidev/angular-lang": ["../../../packages/angular-lang/src/public-api.ts"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Make the example resolve dependencies after a standalone install

This alias loads Angular package source outside the example, so imports in that source resolve from packages/angular-lang rather than the example's node_modules. Following the documented example-only install without root workspace dependencies causes ng build to fail resolving @angular/core, @angular/common, @openuidev/lang-core, zod/v4/core, and tslib. I reproduced this with the example dependencies installed and the referenced package source present. The build-examples job also installs examples independently, so this remains a blocker after the Node-version fix. Consume the built package as a declared dependency, or explicitly arrange and document the necessary workspace setup.

Comment on lines +77 to +79
isStreaming: this.openUi.isStreaming,
shouldTriggerSaveCallback: false,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Pass the injected context when setting defaults from ngOnChanges

setDefaultValue resolves its omitted second argument by calling injectOpenUiContext(), but ngOnChanges does not run in an Angular injection context. Clicking Form state in the example reproduces NG0203 for OPENUI_CONTEXT, and the input never renders, even though initial state already supplies a value. Pass the already-injected this.openUi as the second argument so the helper does not call inject() from this lifecycle hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants