Skip to content

Conversation

@bsastregx
Copy link

Changes in this PR:

Offer a Mercury + Angular project that I worked on, that may be helpfull on this repo.

@bsastregx bsastregx added the feature Feature implementation pull request label Jul 10, 2025
@bsastregx bsastregx requested a review from ncamera July 10, 2025 12:43
@ncamera
Copy link
Collaborator

ncamera commented Jul 10, 2025

It would be nice to update the PR title to better reflect the meaning of the change. For example:

[angular-mercury] Add Angular with Mercury integration example

Copy link
Collaborator

@ncamera ncamera left a comment

Choose a reason for hiding this comment

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

Thanks for the example!

@@ -0,0 +1,11098 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

This monorepo uses yarn, not npm. Delete this file and install the dependencies with yarn.

"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Open the browser when executing the start command:

Suggested change
"start": "ng serve",
"start": "ng serve -o",

Comment on lines +37 to +38
"@genexus/chameleon-controls-library": "^6.16.0",
"@genexus/mercury": "^0.26.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since Mercury does not use semantic versioning, we can't recommend minor updates at this moment.

Suggested change
"@genexus/chameleon-controls-library": "^6.16.0",
"@genexus/mercury": "^0.26.0"
"@genexus/chameleon-controls-library": "~6.16.0",
"@genexus/mercury": "~0.26.0"

Comment on lines +45 to +52
"@types/jasmine": "~5.1.0",
"@types/node": "^20.17.19",
"jasmine-core": "~5.7.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can remove this dependencies, as they are not being used.

Suggested change
"@types/jasmine": "~5.1.0",
"@types/node": "^20.17.19",
"jasmine-core": "~5.7.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"@types/node": "^20.17.19",

Comment on lines +1 to +2
<ch-theme [model]="mercuryIconsBundle"></ch-theme>
<custom-dialog></custom-dialog>
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to match the design of the other examples (NextJS, React and SolidJS) to properly demonstrate that the same design can be achieved with any framework.

getImagePathCallbackDefinitions,
} from "@genexus/mercury";
setBundleMapping(bundleToHashMappings);
registerMercury();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
registerMercury();
// It registers a mapping between the icons metadata and its path.
registerMercury();

} from "@genexus/mercury";
setBundleMapping(bundleToHashMappings);
registerMercury();
registryProperty("getImagePathCallback", getImagePathCallbackDefinitions);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
registryProperty("getImagePathCallback", getImagePathCallbackDefinitions);
// Register the default value for the getImagePathCallback property in all Chameleon
// components. This implementation allows us to remove the need for binding the
// getImagePathCallback property in all Chameleon controls that must render icons.
registryProperty("getImagePathCallback", getImagePathCallbackDefinitions);

Comment on lines +91 to +105
"test": {
"builder": "@angular/build:karma",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": ["src/styles.scss"]
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are not using this.

Suggested change
"test": {
"builder": "@angular/build:karma",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": ["src/styles.scss"]
}
}
"test": {
"builder": "@angular/build:karma",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": ["src/styles.scss"]
}
}

standalone: true,
imports: [RouterOutlet, CustomDialogComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
templateUrl: "./app.html",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Angular components must use OnPush change detection strategy for better performance.

You can see an example here (selected the "Angular" tab in a code block):
https://mercury-showcase.genexus.com/mercury/components/button

Suggested change
templateUrl: "./app.html",
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: "./app.html",

Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this file and update the .gitignore file to untrack this Mac file.

Comment on lines +1 to +59
# Angular

This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.0.5.

## Development server

To start a local development server, run:

```bash
ng serve
```

Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.

## Code scaffolding

Angular CLI includes powerful code scaffolding tools. To generate a new component, run:

```bash
ng generate component component-name
```

For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:

```bash
ng generate --help
```

## Building

To build the project run:

```bash
ng build
```

This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.

## Running unit tests

To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:

```bash
ng test
```

## Running end-to-end tests

For end-to-end (e2e) testing, run:

```bash
ng e2e
```

Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.

## Additional Resources

For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This readme file should be simplified. It should also be consistent with the other readme files:
https://github.com/genexuslabs/chameleon-integrations/blob/main/packages/react-mercury/README.md

@ncamera
Copy link
Collaborator

ncamera commented Jul 10, 2025

@bsastregx Update the main readme file in this PR to reflect the new example.

@bsastregx bsastregx changed the title [angular-mercury] Initial commit [angular-mercury] Add Angular with Mercury integration example Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Feature implementation pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants