Skip to content

Commit 3689738

Browse files
committed
feat(highlightjs): highlight
1 parent efd9b9e commit 3689738

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+6160
-3612
lines changed

angular.json

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
"loader": {
6767
".html": "text",
6868
".scss": "text",
69-
".png": "file"
69+
".png": "file",
70+
".css": "file"
7071
},
7172
"scripts": [],
7273
"serviceWorker": "packages/demo/ngsw-config.json",
@@ -94,7 +95,8 @@
9495
"optimization": false,
9596
"extractLicenses": false,
9697
"sourceMap": true,
97-
"namedChunks": true
98+
"namedChunks": true,
99+
"outputHashing": "media"
98100
}
99101
},
100102
"defaultConfiguration": "production"
@@ -222,6 +224,48 @@
222224
}
223225
}
224226
},
227+
"highlightjs": {
228+
"projectType": "library",
229+
"root": "packages/highlightjs",
230+
"sourceRoot": "packages/highlightjs/src",
231+
"prefix": "nxt",
232+
"architect": {
233+
"build": {
234+
"builder": "@angular-devkit/build-angular:ng-packagr",
235+
"options": {
236+
"project": "packages/highlightjs/ng-package.json"
237+
},
238+
"configurations": {
239+
"production": {
240+
"tsConfig": "packages/highlightjs/tsconfig.lib.prod.json"
241+
},
242+
"development": {
243+
"tsConfig": "packages/highlightjs/tsconfig.lib.json"
244+
}
245+
},
246+
"defaultConfiguration": "production"
247+
},
248+
"test": {
249+
"builder": "@angular-devkit/build-angular:karma",
250+
"options": {
251+
"main": "packages/highlightjs/src/test.ts",
252+
"tsConfig": "packages/highlightjs/tsconfig.spec.json"
253+
}
254+
},
255+
"lint": {
256+
"builder": "@angular-eslint/builder:lint",
257+
"options": {
258+
"lintFilePatterns": [
259+
"packages/highlightjs/**/*.ts",
260+
"packages/highlightjs/**/*.js",
261+
"packages/highlightjs/**/*.cjs",
262+
"packages/highlightjs/**/*.html"
263+
],
264+
"eslintConfig": "packages/highlightjs/eslint.config.js"
265+
}
266+
}
267+
}
268+
},
225269
"json-view": {
226270
"projectType": "library",
227271
"root": "packages/json-view",

eslint.config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ import angular from 'angular-eslint'
66
// @ts-ignore
77
import importPlugin from 'eslint-plugin-import'
88
import jsdocPlugin from 'eslint-plugin-jsdoc'
9-
import _preferArrowPlugin from 'eslint-plugin-prefer-arrow-functions'
9+
import preferArrowPlugin from 'eslint-plugin-prefer-arrow-functions'
1010
import unusedImportsPlugin from 'eslint-plugin-unused-imports'
1111
import { config, parser } from 'typescript-eslint'
1212

13-
/** @type {any} */
14-
const preferArrowPlugin = 'default' in _preferArrowPlugin
15-
? _preferArrowPlugin['default']
16-
: _preferArrowPlugin
17-
1813
export default config(
1914
{
2015
ignores: ['dist', 'node_modules', 'coverage', 'docs', '.yarn', '.husky', 'tmp', '.angular', 'packages/**/*']

package.json

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
"release": "lerna version --sync-workspace-lock"
3232
},
3333
"dependencies": {
34-
"@angular/animations": "^19.0.6",
35-
"@angular/cdk": "^19.0.5",
36-
"@angular/common": "^19.0.6",
37-
"@angular/compiler": "^19.0.6",
38-
"@angular/core": "^19.0.6",
39-
"@angular/forms": "^19.0.6",
40-
"@angular/localize": "^19.0.6",
41-
"@angular/platform-browser": "^19.0.6",
42-
"@angular/platform-server": "^19.0.6",
34+
"@angular/animations": "^19.1.3",
35+
"@angular/cdk": "^19.1.1",
36+
"@angular/common": "^19.1.3",
37+
"@angular/compiler": "^19.1.3",
38+
"@angular/core": "^19.1.3",
39+
"@angular/forms": "^19.1.3",
40+
"@angular/localize": "^19.1.3",
41+
"@angular/platform-browser": "^19.1.3",
42+
"@angular/platform-server": "^19.1.3",
4343
"dropzone": "^6.0.0-beta.2",
4444
"moment": "^2.30.1",
4545
"rxjs": "^7.8.1",
@@ -48,30 +48,30 @@
4848
"zone.js": "^0.15.0"
4949
},
5050
"devDependencies": {
51-
"@angular-devkit/architect": "^0.1900.7",
52-
"@angular-devkit/build-angular": "^19.0.7",
53-
"@angular-devkit/core": "^19.0.7",
54-
"@angular-devkit/schematics": "^19.0.7",
55-
"@angular/cli": "^19.0.7",
56-
"@angular/compiler-cli": "^19.0.6",
51+
"@angular-devkit/architect": "^0.1901.4",
52+
"@angular-devkit/build-angular": "^19.1.4",
53+
"@angular-devkit/core": "^19.1.4",
54+
"@angular-devkit/schematics": "^19.1.4",
55+
"@angular/cli": "^19.1.4",
56+
"@angular/compiler-cli": "^19.1.3",
5757
"@commitlint/cli": "^19.6.1",
5858
"@commitlint/config-conventional": "^19.6.0",
5959
"@compodoc/compodoc": "^1.1.26",
6060
"@lerna-lite/cli": "^3.11.0",
6161
"@lerna-lite/version": "^3.11.0",
6262
"@liquid-js/angular-cli-ghpages": "^2.0.4",
6363
"@liquid-js/commitlint-plugin-workspace-scopes": "^2.1.0",
64-
"@stylistic/eslint-plugin": "^2.12.1",
64+
"@stylistic/eslint-plugin": "^3.0.0",
6565
"@types/jasmine": "^5.1.5",
6666
"@types/node": "<23.0.0",
6767
"@types/semver": "^7.5.8",
6868
"angular-eslint": "19.0.2",
6969
"conventional-changelog-cli": "^5.0.0",
7070
"cross-env": "^7.0.3",
71-
"eslint": "^9.17.0",
71+
"eslint": "^9.19.0",
7272
"eslint-plugin-import": "^2.31.0",
73-
"eslint-plugin-jsdoc": "^50.6.1",
74-
"eslint-plugin-prefer-arrow-functions": "^3.6.0",
73+
"eslint-plugin-jsdoc": "^50.6.3",
74+
"eslint-plugin-prefer-arrow-functions": "^3.6.2",
7575
"eslint-plugin-unused-imports": "^4.1.4",
7676
"globby": "^14.0.2",
7777
"husky": "^9.1.7",
@@ -82,35 +82,35 @@
8282
"karma-coverage": "^2.2.1",
8383
"karma-jasmine": "^5.1.0",
8484
"karma-jasmine-html-reporter": "^2.1.0",
85-
"ng-packagr": "^19.0.1",
86-
"npm-check-updates": "^17.1.13",
87-
"postcss": "^8.4.49",
85+
"ng-packagr": "^19.1.1",
86+
"npm-check-updates": "^17.1.14",
87+
"postcss": "^8.5.1",
8888
"rimraf": "^6.0.1",
8989
"semver": "^7.6.3",
9090
"stylelint": "<15.0.0",
9191
"stylelint-config-standard-scss": "<7.0.0",
92-
"ts-node-maintained": "^10.9.4",
92+
"ts-node-maintained": "^10.9.5",
9393
"typedoc": "^0.27.6",
94-
"typescript": ">=5.5 <5.7",
95-
"typescript-eslint": "^8.19.1"
94+
"typescript": ">=5.7 <5.8",
95+
"typescript-eslint": "^8.22.0"
9696
},
9797
"packageManager": "[email protected]",
9898
"resolutions": {
99-
"@angular-devkit/architect": "^0.1900.7",
100-
"@angular-devkit/build-angular": "^19.0.7",
101-
"@angular-devkit/core": "^19.0.7",
102-
"@angular-devkit/schematics": "^19.0.7",
103-
"@angular/cli": "^19.0.7",
104-
"@angular/compiler-cli": "^19.0.6",
105-
"@angular/animations": "^19.0.6",
106-
"@angular/cdk": "^19.0.5",
107-
"@angular/common": "^19.0.6",
108-
"@angular/compiler": "^19.0.6",
109-
"@angular/core": "^19.0.6",
110-
"@angular/forms": "^19.0.6",
111-
"@angular/localize": "^19.0.6",
112-
"@angular/platform-browser": "^19.0.6",
113-
"@angular/platform-server": "^19.0.6",
114-
"@angular/router": "^19.0.6"
99+
"@angular-devkit/architect": "^0.1901.4",
100+
"@angular-devkit/build-angular": "^19.1.4",
101+
"@angular-devkit/core": "^19.1.4",
102+
"@angular-devkit/schematics": "^19.1.4",
103+
"@angular/cli": "^19.1.4",
104+
"@angular/compiler-cli": "^19.1.3",
105+
"@angular/animations": "^19.1.3",
106+
"@angular/cdk": "^19.1.1",
107+
"@angular/common": "^19.1.3",
108+
"@angular/compiler": "^19.1.3",
109+
"@angular/core": "^19.1.3",
110+
"@angular/forms": "^19.1.3",
111+
"@angular/localize": "^19.1.3",
112+
"@angular/platform-browser": "^19.1.3",
113+
"@angular/platform-server": "^19.1.3",
114+
"@angular/router": "^19.1.3"
115115
}
116116
}

packages/demo/package.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
"lint:sass:fix": "yarn lint:sass --fix"
1616
},
1717
"dependencies": {
18-
"@angular/animations": "^19.0.6",
19-
"@angular/cdk": "^19.0.5",
20-
"@angular/common": "^19.0.6",
21-
"@angular/compiler": "^19.0.6",
22-
"@angular/core": "^19.0.6",
23-
"@angular/forms": "^19.0.6",
24-
"@angular/platform-browser": "^19.0.6",
25-
"@angular/platform-browser-dynamic": "^19.0.6",
26-
"@angular/platform-server": "^19.0.6",
27-
"@angular/router": "^19.0.6",
28-
"@angular/service-worker": "^19.0.6",
29-
"@angular/ssr": "^19.0.7",
18+
"@angular/animations": "^19.1.3",
19+
"@angular/cdk": "^19.1.1",
20+
"@angular/common": "^19.1.3",
21+
"@angular/compiler": "^19.1.3",
22+
"@angular/core": "^19.1.3",
23+
"@angular/forms": "^19.1.3",
24+
"@angular/platform-browser": "^19.1.3",
25+
"@angular/platform-browser-dynamic": "^19.1.3",
26+
"@angular/platform-server": "^19.1.3",
27+
"@angular/router": "^19.1.3",
28+
"@angular/service-worker": "^19.1.3",
29+
"@angular/ssr": "^19.1.4",
3030
"@popperjs/core": "^2.11.8",
3131
"bootstrap": "^5.3.3",
3232
"clipboard-polyfill": "^4.1.1",
@@ -35,9 +35,8 @@
3535
"i18n-iso-countries": "^7.13.0",
3636
"jquery": "^3.7.1",
3737
"ngx-bootstrap": "^19.0.2",
38-
"ngx-highlightjs": "^13.0.0",
3938
"rxjs": "^7.8.1",
40-
"sass": "^1.83.1",
39+
"sass": "^1.83.4",
4140
"sortablejs": "^1.15.6",
4241
"tslib": "^2.8.1",
4342
"zone.js": "^0.15.0"

packages/demo/src/app/app.component.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,20 @@ export class AppComponent {
105105
}
106106
]
107107
},
108+
{
109+
label: 'nxt-highlightjs',
110+
link: '/highlightjs',
111+
children: [
112+
{
113+
label: 'Getting started',
114+
link: 'getting-started'
115+
},
116+
{
117+
label: 'API docs',
118+
url: 'https://liquid-js.github.io/nxt-components/nxt-highlightjs'
119+
}
120+
]
121+
},
108122
{
109123
label: 'nxt-json-view',
110124
link: '/json-view',

packages/demo/src/app/app.config.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { provideAnimations } from '@angular/platform-browser/animations'
44
import { DefaultUrlSerializer, provideRouter, UrlSerializer, UrlTree, withInMemoryScrolling } from '@angular/router'
55
import { provideServiceWorker } from '@angular/service-worker'
66
import { TooltipModule } from 'ngx-bootstrap/tooltip'
7-
import { provideHighlightOptions } from 'ngx-highlightjs'
7+
import { provideHighlightOptions } from 'nxt-highlightjs'
88
import { DropzoneConfig, NXT_DROPZONE_CONFIG } from 'nxt-dropzone-wrapper'
99
import { provideNativeDateTimeAdapter } from 'packages/pick-datetime/native-adapter/src/native-adapter.module'
1010
import { routes } from './app.routes'
@@ -52,15 +52,15 @@ export const appConfig: ApplicationConfig = {
5252
registrationStrategy: 'registerWhenStable:30000'
5353
}),
5454
provideHighlightOptions({
55-
coreLibraryLoader: () => import('highlight.js/lib/core'),
56-
lineNumbersLoader: () => import('ngx-highlightjs/line-numbers'),
55+
coreLibraryLoader: () => import('highlight.js/lib/core').then(r => r.default),
56+
lineNumbersLoader: () => import('nxt-highlightjs/line-numbers'),
5757
languages: {
58-
typescript: () => import('highlight.js/lib/languages/typescript'),
59-
scss: () => import('highlight.js/lib/languages/scss'),
60-
xml: () => import('highlight.js/lib/languages/xml'),
61-
bash: () => import('highlight.js/lib/languages/bash'),
62-
shell: () => import('highlight.js/lib/languages/shell'),
63-
json: () => import('highlight.js/lib/languages/json')
58+
typescript: () => import('highlight.js/lib/languages/typescript').then(r => r.default),
59+
scss: () => import('highlight.js/lib/languages/scss').then(r => r.default),
60+
xml: () => import('highlight.js/lib/languages/xml').then(r => r.default),
61+
bash: () => import('highlight.js/lib/languages/bash').then(r => r.default),
62+
shell: () => import('highlight.js/lib/languages/shell').then(r => r.default),
63+
json: () => import('highlight.js/lib/languages/json').then(r => r.default)
6464
}
6565
}),
6666
{
@@ -71,3 +71,4 @@ export const appConfig: ApplicationConfig = {
7171
provideNativeDateTimeAdapter()
7272
]
7373
}
74+

packages/demo/src/app/app.routes.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { Routes } from '@angular/router'
22
import { colorPickerRoutes } from './color-picker/color-picker.routes'
33
import { dropzoneWrapperRoutes } from './dropzone-wrapper/dropzone-wrapper.routes'
44
import { flagsRoutes } from './flags/flags.routes'
5+
import { highlightjsRoutes } from './highlightjs/highlightjs.routes'
56
import { jsonViewRoutes } from './json-view/json-view.routes'
67
import { pickDatetimeRoutes } from './pick-datetime/pick-datetime.routes'
7-
import { sortablejsRoutes } from './sortablejs/sortablejs.routes'
88
import { sitemapRoutes } from './sitemap/sitemap.routes'
9+
import { sortablejsRoutes } from './sortablejs/sortablejs.routes'
910

1011
export const routes: Routes = [
1112
{
@@ -25,6 +26,10 @@ export const routes: Routes = [
2526
path: 'flags',
2627
children: flagsRoutes
2728
},
29+
{
30+
path: 'highlightjs',
31+
children: highlightjsRoutes
32+
},
2833
{
2934
path: 'json-view',
3035
children: jsonViewRoutes

packages/demo/src/app/code-block/code-block.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<ng-container *ngIf="code">
2-
<pre><code [highlightAuto]="code"
2+
<pre><code [nxtHighlightAuto]="code"
33
[languages]="languages ?? []"></code></pre>
44

55
<button *ngIf="copy"

packages/demo/src/app/code-block/code-block.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { CommonModule } from '@angular/common'
22
import { Component, Input, ViewEncapsulation } from '@angular/core'
33
import { TooltipDirective, TooltipModule } from 'ngx-bootstrap/tooltip'
4-
import { HighlightModule } from 'ngx-highlightjs'
4+
import { HighlightModule } from 'nxt-highlightjs'
55
import { ClipboardDirective } from './clipboard.directive'
66

77
@Component({

0 commit comments

Comments
 (0)