Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Angular wrapper #3267

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d6ac87d
feat: create angular wrapper library
kyubisation Sep 10, 2024
1e29a00
build: implement Angular generator as eslint rule
kyubisation Oct 28, 2024
40d4c4a
chore: generate empty Angular files
kyubisation Oct 29, 2024
70950dd
fix: integrity
DavideMininni-Fincons Oct 30, 2024
55ff7ed
chore: minor fixes on angular-generator-rule.ts
DavideMininni-Fincons Oct 30, 2024
21d7e8b
chore: add get/set for input
DavideMininni-Fincons Oct 31, 2024
b755059
Merge remote-tracking branch 'origin/main' into feat-angular-wrapper
DavideMininni-Fincons Nov 1, 2024
e91d964
feat: test for retrieve imports
DavideMininni-Fincons Nov 15, 2024
4e5b405
Revert "feat: test for retrieve imports"
DavideMininni-Fincons Nov 18, 2024
1e510ac
feat: mixin migration (TBC)
DavideMininni-Fincons Nov 21, 2024
51b2b56
Merge remote-tracking branch 'origin/main' into feat-angular-wrapper
DavideMininni-Fincons Nov 26, 2024
97e9c54
feat: add mixins outside core folder
DavideMininni-Fincons Nov 26, 2024
6454293
feat: add base classes
DavideMininni-Fincons Nov 27, 2024
50aada1
feat: add logic for output
DavideMininni-Fincons Nov 28, 2024
297caee
feat: add logic for methods
DavideMininni-Fincons Nov 28, 2024
138e91d
feat: add logic for get/set
DavideMininni-Fincons Nov 28, 2024
7a2a44d
feat: add logic for inheritance
DavideMininni-Fincons Dec 2, 2024
8cd6ceb
fix: remove generate-angular-wrapper.ts
DavideMininni-Fincons Dec 2, 2024
1ebcc51
fix: imports
DavideMininni-Fincons Dec 2, 2024
b279c56
fix: review
DavideMininni-Fincons Dec 3, 2024
41705ae
Merge remote-tracking branch 'origin/main' into feat-angular-wrapper
DavideMininni-Fincons Dec 3, 2024
d93b28a
fix: merge from main
DavideMininni-Fincons Dec 3, 2024
09e036c
fix: unique excluded mixin case
DavideMininni-Fincons Dec 3, 2024
4672eed
feat: generate component (partial)
DavideMininni-Fincons Dec 5, 2024
7946bc0
feat: fix script, generate component (partial)
DavideMininni-Fincons Dec 5, 2024
092b8b3
feat: fix script, generate component (partial)
DavideMininni-Fincons Dec 5, 2024
812b8db
feat: fix script, generate component (partial)
DavideMininni-Fincons Dec 5, 2024
9c2f2cb
feat: fix script, generate component (partial)
DavideMininni-Fincons Dec 5, 2024
de873a4
feat: fix mixins, generate component (partial)
DavideMininni-Fincons Dec 6, 2024
a2f8553
feat: fix mixins, generate component (partial)
DavideMininni-Fincons Dec 6, 2024
025e0fb
feat: fix script, fix generated components, generate components (part…
DavideMininni-Fincons Dec 6, 2024
2f5ba2e
feat: generate components
DavideMininni-Fincons Dec 6, 2024
445fd88
Merge remote-tracking branch 'origin/main' into feat-angular-wrapper
DavideMininni-Fincons Dec 9, 2024
483459b
fix: merge
DavideMininni-Fincons Dec 9, 2024
e8a50a5
fix: imports
DavideMininni-Fincons Dec 9, 2024
f31c44a
fix: minor fixes
DavideMininni-Fincons Dec 9, 2024
dd6e075
fix: imports
DavideMininni-Fincons Dec 9, 2024
05b7c85
fix: imports
DavideMininni-Fincons Dec 9, 2024
df570fe
fix: imports
DavideMininni-Fincons Dec 9, 2024
262d3ae
fix: minor fixes
DavideMininni-Fincons Dec 9, 2024
8948387
fix: imports
DavideMininni-Fincons Dec 9, 2024
13bdde0
fix: lint
DavideMininni-Fincons Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
41 changes: 41 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "src",
"cli": {
"cache": {
"path": "node_modules/.cache/angular"
}
},
"projects": {
"angular": {
"projectType": "library",
"root": "src/angular",
"sourceRoot": "src/angular",
"prefix": "sbb",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "src/angular/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "src/angular/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "src/angular/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:web-test-runner",
"options": {
"tsConfig": "src/angular/tsconfig.spec.json"
}
}
}
}
}
}
17 changes: 17 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ export default [
'lyne/test-describe-title-rule': 'off',
},
},
{
files: ['src/angular/**/*.ts', 'src/angular-experimental/**/*.ts'],
rules: {
'lyne/class-decorator-position-rule': 'off',
'lyne/decorator-order-rule': 'off',
'lyne/property-decorator-accessor-rule': 'off',
'lyne/property-type-rule': 'off',
'lyne/import-extension-rule': 'off',
'import-x/no-unresolved': 'off',
},
},
{
files: ['src/angular/core/**/*.ts', 'src/angular-experimental/core/**/*.ts'],
rules: {
'lyne/angular-generator-rule': 'off',
},
},
{
files: ['**/*.spec.ts'],
rules: {
Expand Down
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"build:elements:development": "NODE_ENV=development vite build --mode development --config src/elements/vite.config.ts",
"build:elements-experimental:production": "vite build --config src/elements-experimental/vite.config.ts",
"build:elements-experimental:development": "NODE_ENV=development vite build --mode development --config src/elements-experimental/vite.config.ts",
"build:angular": "ng build angular",
"build:react": "npm-run-all --sequential build:react:* build:react-experimental:*",
"build:react:production": "vite build --config src/react/vite.config.ts",
"build:react:development": "NODE_ENV=development vite build --mode development --config src/react/vite.config.ts",
Expand Down Expand Up @@ -54,6 +55,7 @@
"lint:tsc:components-spec": "tsc --noEmit --project src/elements/tsconfig.spec.json",
"lint:tsc:components-experimental": "tsc --noEmit --project src/elements-experimental/tsconfig.json",
"lint:tsc:components-experimental-spec": "tsc --noEmit --project src/elements-experimental/tsconfig.spec.json",
"lint:tsc:angular": "tsc --noEmit --project src/angular/tsconfig.lib.json",
"lint:tsc:visual-regression-app": "tsc --noEmit --project src/visual-regression-app/tsconfig.json",
"start": "storybook dev -p 6006",
"start:visual-regression-app": "vite --config src/visual-regression-app/vite.config.ts",
Expand All @@ -71,6 +73,16 @@
"lit": "3.2.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "19.0.1",
"@angular/cdk": "19.0.1",
"@angular/cli": "19.0.1",
"@angular/common": "19.0.1",
"@angular/compiler": "19.0.1",
"@angular/compiler-cli": "19.0.1",
"@angular/core": "19.0.1",
"@angular/forms": "19.0.1",
"@angular/platform-browser": "19.0.1",
"@angular/router": "19.0.1",
"@commitlint/cli": "19.6.0",
"@commitlint/config-conventional": "19.6.0",
"@custom-elements-manifest/analyzer": "0.10.3",
Expand Down Expand Up @@ -125,13 +137,15 @@
"lint-staged": "15.2.10",
"lit-analyzer": "2.0.3",
"madge": "8.0.0",
"ng-packagr": "19.0.1",
"npm-run-all2": "7.0.1",
"octokit": "4.0.2",
"playwright": "1.47.2",
"postcss": "8.4.49",
"prettier": "3.4.1",
"react": "18.3.1",
"rollup-plugin-postcss-lit": "2.1.0",
"rxjs": "~7.8.0",
"sass": "1.81.1",
"sinon": "19.0.2",
"storybook": "8.4.6",
Expand All @@ -145,7 +159,8 @@
"typescript-eslint": "8.17.0",
"urlpattern-polyfill": "10.0.0",
"vite": "6.0.2",
"vite-plugin-dts": "4.3.0"
"vite-plugin-dts": "4.3.0",
"zone.js": "0.15.0"
},
"resolutions": {
"@types/node": "20.17.9",
Expand Down
1 change: 1 addition & 0 deletions src/angular-experimental/journey-summary/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './journey-summary';
Empty file.
5 changes: 5 additions & 0 deletions src/angular-experimental/journey-summary/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
1 change: 1 addition & 0 deletions src/angular-experimental/pearl-chain-time/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './pearl-chain-time';
5 changes: 5 additions & 0 deletions src/angular-experimental/pearl-chain-time/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './pearl-chain-vertical-item';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular-experimental/pearl-chain-vertical/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './pearl-chain-vertical';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular-experimental/pearl-chain/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './pearl-chain';
5 changes: 5 additions & 0 deletions src/angular-experimental/pearl-chain/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular-experimental/timetable-duration/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './timetable-duration';
5 changes: 5 additions & 0 deletions src/angular-experimental/timetable-duration/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular-experimental/timetable-row/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './timetable-row';
5 changes: 5 additions & 0 deletions src/angular-experimental/timetable-row/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
Empty file.
1 change: 1 addition & 0 deletions src/angular/accordion/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './accordion';
5 changes: 5 additions & 0 deletions src/angular/accordion/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular/action-group/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './action-group';
5 changes: 5 additions & 0 deletions src/angular/action-group/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular/alert/alert-group/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './alert-group';
5 changes: 5 additions & 0 deletions src/angular/alert/alert-group/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular/alert/alert/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './alert';
5 changes: 5 additions & 0 deletions src/angular/alert/alert/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './autocomplete-grid-button';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './autocomplete-grid-cell';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './autocomplete-grid-optgroup';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './autocomplete-grid-option';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './autocomplete-grid-row';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular/autocomplete-grid/autocomplete-grid/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './autocomplete-grid';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
51 changes: 51 additions & 0 deletions src/angular/autocomplete/autocomplete-base-element.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* eslint-disable lyne/angular-generator-rule */
import { ElementRef, inject, Input, NgZone } from '@angular/core';

import { booleanAttribute } from '@sbb-esta/lyne-angular/core';
import { SbbOpenCloseBaseElement } from '@sbb-esta/lyne-angular/core/base-elements/open-close-base-element';
import { SbbNegativeMixin } from '@sbb-esta/lyne-angular/core/mixins/negative-mixin';

export abstract class SbbAutocompleteBaseElement extends SbbNegativeMixin(SbbOpenCloseBaseElement) {
#element = inject(ElementRef<SbbAutocompleteBaseElement>);
#ngZone = inject(NgZone);

@Input()
public set origin(value: string | HTMLElement | null) {
this.#ngZone.runOutsideAngular(() => (this.#element.nativeElement.origin = value));
}
public get origin(): string | HTMLElement | null {
return this.#element.nativeElement.origin;
}

@Input()
public set trigger(value: string | HTMLElement | null) {
this.#ngZone.runOutsideAngular(() => (this.#element.nativeElement.trigger = value));
}
public get trigger(): string | HTMLElement | null {
return this.#element.nativeElement.trigger;
}

@Input({ alias: 'preserve-icon-space', transform: booleanAttribute })
public set preserveIconSpace(value: boolean) {
this.#ngZone.runOutsideAngular(() => (this.#element.nativeElement.preserveIconSpace = value));
}
public get preserveIconSpace(): boolean {
return this.#element.nativeElement.preserveIconSpace;
}

public get originElement(): HTMLElement {
return this.#element.nativeElement.originElement;
}

public get triggerElement(): HTMLInputElement | undefined {
return this.#element.nativeElement.triggerElement;
}

public open(): void {
return this.#element.nativeElement.open();
}

public close(): void {
return this.#element.nativeElement.close();
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular/autocomplete/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './autocomplete';
5 changes: 5 additions & 0 deletions src/angular/autocomplete/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular/breadcrumb/breadcrumb-group/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './breadcrumb-group';
5 changes: 5 additions & 0 deletions src/angular/breadcrumb/breadcrumb-group/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular/breadcrumb/breadcrumb/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './breadcrumb';
5 changes: 5 additions & 0 deletions src/angular/breadcrumb/breadcrumb/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
10 changes: 10 additions & 0 deletions src/angular/button/accent-button-link/accent-button-link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Directive } from '@angular/core';
import '@sbb-esta/lyne-elements/button/accent-button-link.js';


@Directive({
selector: 'sbb-accent-button-link',
standalone: true,
})
export class SbbAccentButtonLink extends SbbButtonCommonElementMixin(SbbDisabledInteractiveMixin(SbbDisabledMixin(SbbLinkBaseElement))) {
}
1 change: 1 addition & 0 deletions src/angular/button/accent-button-link/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './accent-button-link';
5 changes: 5 additions & 0 deletions src/angular/button/accent-button-link/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
10 changes: 10 additions & 0 deletions src/angular/button/accent-button-static/accent-button-static.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Directive } from '@angular/core';
import '@sbb-esta/lyne-elements/button/accent-button-static.js';


@Directive({
selector: 'sbb-accent-button-static',
standalone: true,
})
export class SbbAccentButtonStatic extends SbbButtonCommonElementMixin(SbbDisabledMixin(SbbActionBaseElement)) {
}
1 change: 1 addition & 0 deletions src/angular/button/accent-button-static/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './accent-button-static';
5 changes: 5 additions & 0 deletions src/angular/button/accent-button-static/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
10 changes: 10 additions & 0 deletions src/angular/button/accent-button/accent-button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Directive } from '@angular/core';
import '@sbb-esta/lyne-elements/button/accent-button.js';


@Directive({
selector: 'sbb-accent-button',
standalone: true,
})
export class SbbAccentButton extends SbbButtonCommonElementMixin(SbbDisabledTabIndexActionMixin(SbbButtonBaseElement)) {
}
1 change: 1 addition & 0 deletions src/angular/button/accent-button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './accent-button';
5 changes: 5 additions & 0 deletions src/angular/button/accent-button/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
Empty file.
1 change: 1 addition & 0 deletions src/angular/button/button-link/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './button-link';
Loading
Loading