Skip to content

feat: angular 18 (#DS-2894) #298

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

Merged
merged 11 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ node_modules

# ignore nunjuck templates
/tools/api-gen/rendering/templates

# ignore index.html
**/index.html
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.13.0
18.19.0
934 changes: 524 additions & 410 deletions angular.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class DocsLiveExampleViewer {
// files. More details: https://webpack.js.org/api/module-methods/#magic-comments.
// module.importSpecifier
const moduleExports: any = await import(
/* webpackExclude: /\.map$/ */
/* @vite-ignore */
`@koobiq/docs-examples/fesm2022/${module.importPath}`
);
this.exampleComponentType = moduleExports[componentName];
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/assets/stackblitz/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
"maximumError": "6mb"
}
]
},
Expand Down
7 changes: 3 additions & 4 deletions apps/docs/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
href="https://7n2w9akem6-dsn.algolia.net"
rel="preconnect"
/>
</head>

<body class="docs-app-background kbq-theme-light docs">
<!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function (m, e, t, r, i, k, a) {
Expand Down Expand Up @@ -104,9 +106,6 @@
</div>
</noscript>
<!-- /Yandex.Metrika counter -->
</head>

<body class="docs-app-background kbq-theme-light docs">
<docs-app />
<docs-app></docs-app>
</body>
</html>
56 changes: 28 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
"url": "https://github.com/koobiq/angular-components.git"
},
"engines": {
"node": "^18.13.0"
"node": "^18.19.0"
},
"packageManager": "yarn@4.1.1",
"requiredAngularVersion": "^17.0.0",
"requiredAngularVersion": "^18.0.0",
"dependencies": {
"@angular/animations": "17.2.0",
"@angular/cdk": "17.2.0",
"@angular/common": "17.2.0",
"@angular/compiler": "17.2.0",
"@angular/core": "17.2.0",
"@angular/forms": "17.2.0",
"@angular/platform-browser": "17.2.0",
"@angular/animations": "18.2.5",
"@angular/cdk": "18.2.5",
"@angular/common": "18.2.5",
"@angular/compiler": "18.2.5",
"@angular/core": "18.2.5",
"@angular/forms": "18.2.5",
"@angular/platform-browser": "18.2.5",
"@docsearch/css": "^3.6.0",
"@docsearch/js": "^3.6.0",
"@koobiq/date-adapter": "^3.1.2",
Expand All @@ -36,25 +36,25 @@
"rxjs": "7.8.1",
"tslib": "^2.6.2",
"ua-parser-js": "^1.0.38",
"zone.js": "^0.14.4"
"zone.js": "^0.14.10"
},
"devDependencies": {
"@angular-builders/jest": "17.0.3",
"@angular-devkit/architect": "0.1702.0",
"@angular-devkit/architect-cli": "0.1702.0",
"@angular-devkit/build-angular": "17.2.0",
"@angular-devkit/core": "17.2.0",
"@angular-devkit/schematics": "17.2.0",
"@angular-eslint/builder": "17.2.0",
"@angular-eslint/eslint-plugin": "17.2.0",
"@angular-eslint/eslint-plugin-template": "17.2.0",
"@angular-eslint/schematics": "17.2.0",
"@angular-eslint/template-parser": "17.2.0",
"@angular/cli": "17.2.0",
"@angular/compiler-cli": "17.2.0",
"@angular/platform-browser-dynamic": "17.2.0",
"@angular/platform-server": "17.2.0",
"@angular/router": "17.2.0",
"@angular-builders/jest": "18.0.0",
"@angular-devkit/architect": "0.1802.5",
"@angular-devkit/architect-cli": "0.1802.5",
"@angular-devkit/build-angular": "18.2.5",
"@angular-devkit/core": "18.2.5",
"@angular-devkit/schematics": "18.2.5",
"@angular-eslint/builder": "18.3.1",
"@angular-eslint/eslint-plugin": "18.3.1",
"@angular-eslint/eslint-plugin-template": "18.3.1",
"@angular-eslint/schematics": "18.3.1",
"@angular-eslint/template-parser": "18.3.1",
"@angular/cli": "18.2.5",
"@angular/compiler-cli": "18.2.5",
"@angular/platform-browser-dynamic": "18.2.5",
"@angular/platform-server": "18.2.5",
"@angular/router": "18.2.5",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@cspell/dict-markdown": "^2.0.2",
Expand Down Expand Up @@ -130,7 +130,7 @@
"luxon": "^3.4.4",
"merge2": "^1.2.3",
"moment": "~2.29.2",
"ng-packagr": "^17.3.0",
"ng-packagr": "^18.2.1",
"ngx-highlightjs": "^10.0.0",
"node-fetch": "^3.3.1",
"nunjucks": "^3.2.4",
Expand All @@ -154,7 +154,7 @@
"ts-node": "^10.9.1",
"tsconfig-paths": "^3.9.0",
"tsickle": "^0.39.1",
"typescript": "5.3.3"
"typescript": "5.5.4"
},
"scripts": {
"ng": "ng",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"main": "./dist/cli.js",
"engines": {
"node": ">=18",
"node": ">=18.19",
"npm": ">=8",
"yarn": ">=1.22"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/components-dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
<title>Dev Example</title>
</head>
<body class="kbq-app-background kbq-theme-light">
<app />
<app></app>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('KbqAutocomplete', () => {
keydownEvents.forEach(() => trigger.handleKeydown(DOWN_ARROW_EVENT));

// Expect option bottom minus the panel height (50 * 6 - 256 = 44)
expect(scrollContainer.scrollTop).toEqual(275);
expect(Math.floor(scrollContainer.scrollTop)).toEqual(275);

expect(fixture.componentInstance.panel.keyManager.activeItemIndex).toEqual(5);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/components/core/common-behaviors/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InjectionToken } from '@angular/core';

export { CanColor, CanColorCtor, KbqComponentColors, ThemePalette, mixinColor } from './color';
export { CanColor, CanColorCtor, KbqComponentColors, mixinColor, ThemePalette } from './color';
export { KBQ_SANITY_CHECKS, KbqCommonModule } from './common-module';
export { CanDisable, CanDisableCtor, mixinDisabled } from './disabled';
export { CanUpdateErrorState, CanUpdateErrorStateCtor, mixinErrorState } from './error-state';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/dropdown/dropdown.karma-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ describe('KbqDropdown', () => {
const triggerRect = overlay.querySelector('#level-one-trigger')!.getBoundingClientRect();
const panelRect = overlay.querySelectorAll('.cdk-overlay-pane')[1].getBoundingClientRect();

expect(Math.round(triggerRect.left)).toBe(Math.round(panelRect.right) + NESTED_PANEL_LEFT_PADDING);
expect(Math.round(triggerRect.top)).toBe(Math.round(panelRect.top) + NESTED_PANEL_TOP_PADDING);
expect(Math.floor(triggerRect.left)).toBe(Math.floor(panelRect.right) + NESTED_PANEL_LEFT_PADDING);
expect(Math.floor(triggerRect.top)).toBe(Math.floor(panelRect.top) + NESTED_PANEL_TOP_PADDING);
});

it('should fall back to aligning to the right edge of the trigger in rtl', fakeAsync(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ describe('KbqSelect', () => {

// Note that we press down 5 times, but it will skip
// 3 options because the second group is disabled.
expect(panel.scrollTop).withContext('Expected scroll to be at the 9th option.').toBe(158);
expect(Math.floor(panel.scrollTop)).withContext('Expected scroll to be at the 9th option.').toBe(158);
}));

it('should scroll top the top when pressing HOME', fakeAsync(() => {
Expand Down
6 changes: 5 additions & 1 deletion tools/api-gen/extraction/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NgtscProgram } from '@angular/compiler-cli';
import { basename, join } from 'path';
import ts from 'typescript';
import { DocEntry } from '../rendering/entities';
import { ClassEntryMetadata, EntryCollection, ModuleInfo, PackageMetadata } from '../types';
import { src } from '../utils';
import { entryHandler, prepareMergedMetadata, updateEntries } from './helpers';
Expand Down Expand Up @@ -74,7 +75,10 @@ export function extractApiToJson(packages: ModuleInfo[]) {

return {
packageName,
entries: updateEntries(program.getApiDocumentation(resolvedPath), classesMetadata)
entries: updateEntries(
program.getApiDocumentation(resolvedPath, new Set<string>([])).entries as DocEntry[],
classesMetadata
)
};
})
} as EntryCollection);
Expand Down
2 changes: 1 addition & 1 deletion tools/api-gen/rendering/transforms/code-transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function getMethodCodeLine(
};

return `${memberTags.join(' ')} ${member.name}(${displayParamsInNewLines ? '\n ' : ''}${member.params
.map((param) => mapParamEntry(param))
?.map((param) => mapParamEntry(param))
.join(`,${displayParamsInNewLines ? '\n ' : ' '}`)}${
displayParamsInNewLines ? '\n' : ''
}): ${member.returnType};`.trim();
Expand Down
2 changes: 1 addition & 1 deletion tools/api-gen/rendering/transforms/member-transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function addMethodParamsDescription<T extends MemberEntry>(entry: T): T {
if (isClassMethodEntry(entry)) {
return {
...(entry as T),
params: entry.params.map((param) => addHtmlDescription(param))
params: entry.params?.map((param) => addHtmlDescription(param))
};
}
return entry;
Expand Down
2 changes: 1 addition & 1 deletion tools/api-gen/rendering/transforms/params-transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HasParams, HasRenderableParams } from '../entities/traits';
import { addHtmlDescription } from './jsdoc-transforms';

export function addRenderableFunctionParams<T extends HasParams>(entry: T): T & HasRenderableParams {
const params = entry.params.map((entry: ParameterEntry) => addHtmlDescription(entry));
const params = entry.params?.map((entry: ParameterEntry) => addHtmlDescription(entry));

return {
...entry,
Expand Down
25 changes: 1 addition & 24 deletions tools/public_api_guard/components/scrollbar.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,30 +86,7 @@ export class KbqScrollbar implements AfterViewInit, OnDestroy {

// @public (undocumented)
export class KbqScrollbarDirective implements OnDestroy {
constructor(ngZone: NgZone, scrollbarConfig?: {
paddingAbsolute?: boolean | undefined;
showNativeOverlaidScrollbars?: boolean | undefined;
update?: {
elementEvents?: [elementSelector: string, eventNames: string][] | null | undefined;
debounce?: number | [timeout: number, maxWait: number] | null | undefined;
attributes?: string[] | null | undefined;
ignoreMutation?: ((mutation: MutationRecord) => any) | null | undefined;
} | undefined;
overflow?: {
x?: OverflowBehavior | undefined;
y?: OverflowBehavior | undefined;
} | undefined;
scrollbars?: {
theme?: string | null | undefined;
visibility?: ScrollbarsVisibilityBehavior | undefined;
autoHide?: ScrollbarsAutoHideBehavior | undefined;
autoHideDelay?: number | undefined;
autoHideSuspend?: boolean | undefined;
dragScroll?: boolean | undefined;
clickScroll?: boolean | undefined;
pointers?: string[] | null | undefined;
} | undefined;
} | undefined);
constructor(ngZone: NgZone, scrollbarConfig?: KbqScrollbarOptions | undefined);
defer?: boolean | IdleRequestOptions;
set events(value: KbqScrollbarEvents);
// (undocumented)
Expand Down
Loading