nxt-highlightjs 22.0.0 → 22.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,141 +1,167 @@
1
- import * as _angular_core from '@angular/core';
2
- import { InputSignal, WritableSignal, OutputEmitterRef, InjectionToken } from '@angular/core';
3
- import * as highlight_js from 'highlight.js';
4
- import { HighlightResult, AutoHighlightResult, HLJSApi, HLJSOptions, LanguageFn } from 'highlight.js';
5
-
6
- declare class HighlightJS {
7
- private readonly loader;
8
- readonly hljs: _angular_core.Signal<highlight_js.HLJSApi | undefined>;
9
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HighlightJS, never>;
10
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<HighlightJS>;
1
+ import { AutoHighlightResult, HLJSApi, HLJSOptions, HighlightResult, LanguageFn } from "highlight.js";
2
+ import * as i0 from "@angular/core";
3
+ import { InjectionToken, InputSignal, OutputEmitterRef, WritableSignal } from "@angular/core";
4
+ export declare class HighlightJS {
5
+ private readonly loader;
6
+ readonly hljs: import("@angular/core").Signal<import("highlight.js").HLJSApi | undefined>;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<HighlightJS, never>;
8
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
11
9
  }
12
-
13
- declare abstract class HighlightBase {
14
- protected readonly hljs: HighlightJS;
15
- private readonly nativeElement;
16
- private readonly sanitizer;
17
- /**
18
- * Code to highlight
19
- */
20
- abstract readonly code: InputSignal<string | undefined>;
21
- /**
22
- * Highlighted result
23
- */
24
- abstract readonly highlightResult: WritableSignal<HighlightResult | AutoHighlightResult | undefined>;
25
- /**
26
- * Stream that emits when code string is highlighted
27
- */
28
- abstract readonly highlighted: OutputEmitterRef<HighlightResult | AutoHighlightResult | undefined>;
29
- constructor();
30
- protected abstract highlightElement(code: string): HighlightResult | AutoHighlightResult | undefined;
31
- private setTextContent;
32
- private setInnerHTML;
33
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HighlightBase, never>;
34
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HighlightBase, never, never, {}, {}, never, never, true, never>;
10
+ export declare abstract class HighlightBase {
11
+ protected readonly hljs: HighlightJS;
12
+ private readonly nativeElement;
13
+ private readonly sanitizer;
14
+ /**
15
+ * Code to highlight
16
+ */
17
+ abstract readonly code: InputSignal<string | undefined>;
18
+ /**
19
+ * Highlighted result
20
+ */
21
+ abstract readonly highlightResult: WritableSignal<HighlightResult | AutoHighlightResult | undefined>;
22
+ /**
23
+ * Stream that emits when code string is highlighted
24
+ */
25
+ abstract readonly highlighted: OutputEmitterRef<HighlightResult | AutoHighlightResult | undefined>;
26
+ constructor();
27
+ /**
28
+ * Highlights the code with the loaded Highlight.js, or returns `undefined` to show it as text
29
+ */
30
+ protected abstract highlightElement(code: string): HighlightResult | AutoHighlightResult | undefined;
31
+ private setTextContent;
32
+ private setInnerHTML;
33
+ static ɵfac: i0.ɵɵFactoryDeclaration<HighlightBase, never>;
34
+ static ɵdir: i0.ɵɵDirectiveDeclaration<HighlightBase, never, never, {}, {}, never, never, true, never>;
35
35
  }
36
-
37
- declare class HighlightAutoDirective extends HighlightBase {
38
- /**
39
- * Code to highlight
40
- */
41
- readonly code: _angular_core.InputSignal<string | undefined>;
42
- /**
43
- * Highlighted result
44
- */
45
- readonly highlightResult: _angular_core.WritableSignal<AutoHighlightResult | undefined>;
46
- /**
47
- * An optional array of language names and aliases restricting detection to only those languages
48
- *
49
- * The subset can also be set with configure, but the local parameter overrides the option if set.
50
- */
51
- readonly languages: _angular_core.InputSignal<string[] | undefined>;
52
- /**
53
- * Stream that emits when code string is highlighted
54
- */
55
- readonly highlighted: _angular_core.OutputEmitterRef<AutoHighlightResult>;
56
- protected highlightElement(code: string): AutoHighlightResult | undefined;
57
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HighlightAutoDirective, never>;
58
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HighlightAutoDirective, "[nxtHighlightAuto]", never, { "code": { "alias": "nxtHighlightAuto"; "required": false; "isSignal": true; }; "languages": { "alias": "languages"; "required": false; "isSignal": true; }; }, { "highlighted": "highlighted"; }, never, never, true, never>;
36
+ export declare class HighlightAutoDirective extends HighlightBase {
37
+ /**
38
+ * Code to highlight
39
+ */
40
+ readonly code: import("@angular/core").InputSignal<string | undefined>;
41
+ /**
42
+ * Highlighted result
43
+ */
44
+ readonly highlightResult: import("@angular/core").WritableSignal<AutoHighlightResult | undefined>;
45
+ /**
46
+ * An optional array of language names and aliases restricting detection to only those languages
47
+ *
48
+ * The subset can also be set with configure, but the local parameter overrides the option if set.
49
+ */
50
+ readonly languages: import("@angular/core").InputSignal<string[] | undefined>;
51
+ /**
52
+ * Stream that emits when code string is highlighted
53
+ */
54
+ readonly highlighted: import("@angular/core").OutputEmitterRef<AutoHighlightResult>;
55
+ protected highlightElement(code: string): AutoHighlightResult | undefined;
56
+ static ɵfac: i0.ɵɵFactoryDeclaration<HighlightAutoDirective, never>;
57
+ static ɵdir: i0.ɵɵDirectiveDeclaration<HighlightAutoDirective, "[nxtHighlightAuto]", never, {
58
+ "code": {
59
+ "alias": "nxtHighlightAuto";
60
+ "required": false;
61
+ "isSignal": true;
62
+ };
63
+ "languages": {
64
+ "alias": "languages";
65
+ "required": false;
66
+ "isSignal": true;
67
+ };
68
+ }, {
69
+ "highlighted": "highlighted";
70
+ }, never, never, true, never>;
59
71
  }
60
-
61
- declare class HighlightDirective extends HighlightBase {
62
- /**
63
- * Code to highlight
64
- */
65
- readonly code: _angular_core.InputSignal<string | undefined>;
66
- /**
67
- * Highlighted result
68
- */
69
- readonly highlightResult: _angular_core.WritableSignal<HighlightResult | undefined>;
70
- /**
71
- * The language name highlight only one language
72
- */
73
- readonly language: _angular_core.InputSignal<string>;
74
- /**
75
- * An optional flag, when set to true it forces highlighting to finish even in case of detecting
76
- * illegal syntax for the language instead of throwing an exception
77
- */
78
- readonly ignoreIllegals: _angular_core.InputSignalWithTransform<boolean | undefined, unknown>;
79
- /**
80
- * Stream that emits when code string is highlighted
81
- */
82
- readonly highlighted: _angular_core.OutputEmitterRef<HighlightResult>;
83
- highlightElement(code: string): HighlightResult | undefined;
84
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HighlightDirective, never>;
85
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HighlightDirective, "[nxtHighlight]", never, { "code": { "alias": "nxtHighlight"; "required": false; "isSignal": true; }; "language": { "alias": "language"; "required": true; "isSignal": true; }; "ignoreIllegals": { "alias": "ignoreIllegals"; "required": false; "isSignal": true; }; }, { "highlighted": "highlighted"; }, never, never, true, never>;
72
+ export declare class HighlightDirective extends HighlightBase {
73
+ /**
74
+ * Code to highlight
75
+ */
76
+ readonly code: import("@angular/core").InputSignal<string | undefined>;
77
+ /**
78
+ * Highlighted result
79
+ */
80
+ readonly highlightResult: import("@angular/core").WritableSignal<HighlightResult | undefined>;
81
+ /**
82
+ * The language name highlight only one language
83
+ *
84
+ * Without it, or with a language that isn't loaded, the code shows as text.
85
+ */
86
+ readonly language: import("@angular/core").InputSignal<string | undefined>;
87
+ /**
88
+ * An optional flag, when set to true it forces highlighting to finish even in case of detecting
89
+ * illegal syntax for the language instead of throwing an exception
90
+ */
91
+ readonly ignoreIllegals: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
92
+ /**
93
+ * Stream that emits when code string is highlighted
94
+ */
95
+ readonly highlighted: import("@angular/core").OutputEmitterRef<HighlightResult>;
96
+ highlightElement(code: string): HighlightResult | undefined;
97
+ static ɵfac: i0.ɵɵFactoryDeclaration<HighlightDirective, never>;
98
+ static ɵdir: i0.ɵɵDirectiveDeclaration<HighlightDirective, "[nxtHighlight]", never, {
99
+ "code": {
100
+ "alias": "nxtHighlight";
101
+ "required": false;
102
+ "isSignal": true;
103
+ };
104
+ "language": {
105
+ "alias": "language";
106
+ "required": false;
107
+ "isSignal": true;
108
+ };
109
+ "ignoreIllegals": {
110
+ "alias": "ignoreIllegals";
111
+ "required": false;
112
+ "isSignal": true;
113
+ };
114
+ }, {
115
+ "highlighted": "highlighted";
116
+ }, never, never, true, never>;
86
117
  }
87
-
88
- declare class HighlightLoader {
89
- private readonly document;
90
- private readonly options;
91
- private readonly pendingTasks;
92
- private _t;
93
- readonly hljs: _angular_core.Resource<HLJSApi | undefined>;
94
- private themeLinkElement?;
95
- constructor();
96
- /**
97
- * Lazy-Load highlight.js library
98
- */
99
- private loadLibrary;
100
- /**
101
- * Lazy-load highlight.js languages
102
- */
103
- private loadLanguages;
104
- /**
105
- * Reload theme styles
106
- */
107
- setTheme(path: string): void;
108
- /**
109
- * Load theme
110
- */
111
- private loadTheme;
112
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HighlightLoader, never>;
113
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<HighlightLoader>;
118
+ export declare class HighlightLoader {
119
+ private readonly document;
120
+ private readonly options;
121
+ private readonly pendingTasks;
122
+ private _t;
123
+ readonly hljs: import("@angular/core").Resource<HLJSApi | undefined>;
124
+ private themeLinkElement?;
125
+ constructor();
126
+ /**
127
+ * Lazy-Load highlight.js library
128
+ */
129
+ private loadLibrary;
130
+ /**
131
+ * Lazy-load highlight.js languages
132
+ */
133
+ private loadLanguages;
134
+ /**
135
+ * Reload theme styles
136
+ */
137
+ setTheme(path: string): void;
138
+ /**
139
+ * Load theme
140
+ */
141
+ private loadTheme;
142
+ static ɵfac: i0.ɵɵFactoryDeclaration<HighlightLoader, never>;
143
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
114
144
  }
115
-
116
145
  /**
117
146
  * Full documentation is available here https://highlightjs.readthedocs.io/en/latest/api.html
118
147
  */
119
- interface LineNumbersOptions {
120
- startFrom?: number;
121
- singleLine?: boolean;
148
+ export interface LineNumbersOptions {
149
+ startFrom?: number;
150
+ singleLine?: boolean;
122
151
  }
123
- interface HighlightJSOptions {
124
- highlightOptions?: Partial<HLJSOptions>;
125
- lineNumbersOptions?: LineNumbersOptions;
126
- languages?: Record<string, () => Promise<LanguageFn>>;
127
- coreLibraryLoader?: () => Promise<HLJSApi>;
128
- fullLibraryLoader?: () => Promise<HLJSApi>;
129
- lineNumbersLoader?: () => Promise<{
130
- activateLineNumbers: (document: Document) => (code: string, options?: LineNumbersOptions) => string;
131
- }>;
132
- themePath?: string;
152
+ export interface HighlightJSOptions {
153
+ highlightOptions?: Partial<HLJSOptions>;
154
+ lineNumbersOptions?: LineNumbersOptions;
155
+ languages?: Record<string, () => Promise<LanguageFn>>;
156
+ coreLibraryLoader?: () => Promise<HLJSApi>;
157
+ fullLibraryLoader?: () => Promise<HLJSApi>;
158
+ lineNumbersLoader?: () => Promise<{
159
+ activateLineNumbers: (document: Document) => (code: string, options?: LineNumbersOptions) => string;
160
+ }>;
161
+ themePath?: string;
133
162
  }
134
163
  /**
135
164
  * @internal
136
165
  */
137
- declare const NXT_HIGHLIGHT_OPTIONS: InjectionToken<HighlightJSOptions>;
138
- declare function provideHighlightOptions(options: HighlightJSOptions): _angular_core.EnvironmentProviders;
139
-
140
- export { HighlightAutoDirective, HighlightBase, HighlightDirective, HighlightJS, HighlightLoader, NXT_HIGHLIGHT_OPTIONS, provideHighlightOptions };
141
- export type { HighlightJSOptions, LineNumbersOptions };
166
+ export declare const NXT_HIGHLIGHT_OPTIONS: InjectionToken<HighlightJSOptions>;
167
+ export declare function provideHighlightOptions(options: HighlightJSOptions): import("@angular/core").EnvironmentProviders;