nxt-highlightjs 19.1.0 → 20.0.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,27 +0,0 @@
1
- import { OutputEmitterRef } from '@angular/core';
2
- import type { AutoHighlightResult } from 'highlight.js';
3
- import { HighlightBase } from './highlight-base.directive';
4
- import * as i0 from "@angular/core";
5
- export declare class HighlightAutoDirective extends HighlightBase {
6
- /**
7
- * Code to highlight
8
- */
9
- code: import("@angular/core").InputSignal<string | null | undefined>;
10
- /**
11
- * Highlighted result
12
- */
13
- highlightResult: import("@angular/core").WritableSignal<AutoHighlightResult | undefined>;
14
- /**
15
- * An optional array of language names and aliases restricting detection to only those languages
16
- *
17
- * The subset can also be set with configure, but the local parameter overrides the option if set.
18
- */
19
- readonly languages: import("@angular/core").InputSignal<string[] | undefined>;
20
- /**
21
- * Stream that emits when code string is highlighted
22
- */
23
- highlighted: OutputEmitterRef<AutoHighlightResult>;
24
- protected highlightElement(code: string): AutoHighlightResult | undefined;
25
- static ɵfac: i0.ɵɵFactoryDeclaration<HighlightAutoDirective, never>;
26
- static ɵdir: i0.ɵɵDirectiveDeclaration<HighlightAutoDirective, "[nxtHighlightAuto]", never, { "code": { "alias": "nxtHighlightAuto"; "required": false; "isSignal": true; }; "languages": { "alias": "languages"; "required": false; "isSignal": true; }; }, { "highlighted": "highlighted"; }, never, never, true, never>;
27
- }
@@ -1,27 +0,0 @@
1
- import { InputSignal, OutputEmitterRef, WritableSignal } from '@angular/core';
2
- import type { AutoHighlightResult, HighlightResult } from 'highlight.js';
3
- import { HighlightJS } from './highlight.service';
4
- import * as i0 from "@angular/core";
5
- export declare abstract class HighlightBase {
6
- protected readonly hljs: HighlightJS;
7
- private readonly nativeElement;
8
- private readonly sanitizer;
9
- /**
10
- * Code to highlight
11
- */
12
- abstract code: InputSignal<string | null | undefined>;
13
- /**
14
- * Highlighted result
15
- */
16
- abstract highlightResult: WritableSignal<HighlightResult | AutoHighlightResult | undefined>;
17
- /**
18
- * Stream that emits when code string is highlighted
19
- */
20
- abstract highlighted: OutputEmitterRef<HighlightResult | AutoHighlightResult | undefined>;
21
- constructor();
22
- protected abstract highlightElement(code: string): HighlightResult | AutoHighlightResult | undefined;
23
- private setTextContent;
24
- private setInnerHTML;
25
- static ɵfac: i0.ɵɵFactoryDeclaration<HighlightBase, never>;
26
- static ɵdir: i0.ɵɵDirectiveDeclaration<HighlightBase, never, never, {}, {}, never, never, true, never>;
27
- }
@@ -1,30 +0,0 @@
1
- import { InputSignal } from '@angular/core';
2
- import type { HighlightResult } from 'highlight.js';
3
- import { HighlightBase } from './highlight-base.directive';
4
- import * as i0 from "@angular/core";
5
- export declare class HighlightDirective extends HighlightBase {
6
- /**
7
- * Code to highlight
8
- */
9
- code: InputSignal<string | null | undefined>;
10
- /**
11
- * Highlighted result
12
- */
13
- highlightResult: import("@angular/core").WritableSignal<HighlightResult | undefined>;
14
- /**
15
- * The language name highlight only one language
16
- */
17
- readonly language: InputSignal<string>;
18
- /**
19
- * An optional flag, when set to true it forces highlighting to finish even in case of detecting
20
- * illegal syntax for the language instead of throwing an exception
21
- */
22
- readonly ignoreIllegals: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
23
- /**
24
- * Stream that emits when code string is highlighted
25
- */
26
- highlighted: import("@angular/core").OutputEmitterRef<HighlightResult>;
27
- highlightElement(code: string): HighlightResult | undefined;
28
- static ɵfac: i0.ɵɵFactoryDeclaration<HighlightDirective, never>;
29
- static ɵdir: i0.ɵɵ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>;
30
- }
@@ -1,28 +0,0 @@
1
- import type { HLJSApi } from 'highlight.js';
2
- import * as i0 from "@angular/core";
3
- export declare class HighlightLoader {
4
- private readonly document;
5
- private readonly options;
6
- private readonly pendingTasks;
7
- readonly ready: Promise<HLJSApi>;
8
- private themeLinkElement?;
9
- constructor();
10
- /**
11
- * Lazy-Load highlight.js library
12
- */
13
- private loadLibrary;
14
- /**
15
- * Lazy-load highlight.js languages
16
- */
17
- private loadLanguages;
18
- /**
19
- * Reload theme styles
20
- */
21
- setTheme(path: string): void;
22
- /**
23
- * Load theme
24
- */
25
- private loadTheme;
26
- static ɵfac: i0.ɵɵFactoryDeclaration<HighlightLoader, never>;
27
- static ɵprov: i0.ɵɵInjectableDeclaration<HighlightLoader>;
28
- }
@@ -1,22 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import type { HLJSApi, HLJSOptions, LanguageFn } from 'highlight.js';
3
- /**
4
- * Full documentation is available here https://highlightjs.readthedocs.io/en/latest/api.html
5
- */
6
- export interface LineNumbersOptions {
7
- startFrom?: number;
8
- singleLine?: boolean;
9
- }
10
- export interface HighlightJSOptions {
11
- highlightOptions?: Partial<HLJSOptions>;
12
- lineNumbersOptions?: LineNumbersOptions;
13
- languages?: Record<string, () => Promise<LanguageFn>>;
14
- coreLibraryLoader?: () => Promise<HLJSApi>;
15
- fullLibraryLoader?: () => Promise<HLJSApi>;
16
- lineNumbersLoader?: () => Promise<{
17
- activateLineNumbers: (document: Document) => (code: string, options?: LineNumbersOptions) => string;
18
- }>;
19
- themePath?: string;
20
- }
21
- export declare const NXT_HIGHLIGHT_OPTIONS: InjectionToken<HighlightJSOptions>;
22
- export declare function provideHighlightOptions(options: HighlightJSOptions): import("@angular/core").EnvironmentProviders;
@@ -1,8 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- import * as i1 from "./highlight.directive";
3
- import * as i2 from "./highlight-auto.directive";
4
- export declare class HighlightModule {
5
- static ɵfac: i0.ɵɵFactoryDeclaration<HighlightModule, never>;
6
- static ɵmod: i0.ɵɵNgModuleDeclaration<HighlightModule, never, [typeof i1.HighlightDirective, typeof i2.HighlightAutoDirective], [typeof i1.HighlightDirective, typeof i2.HighlightAutoDirective]>;
7
- static ɵinj: i0.ɵɵInjectorDeclaration<HighlightModule>;
8
- }
@@ -1,64 +0,0 @@
1
- import type { AutoHighlightResult, HLJSApi, HighlightOptions, HighlightResult, LanguageFn } from 'highlight.js';
2
- import { LineNumbersOptions } from './highlight.model';
3
- import * as i0 from "@angular/core";
4
- export declare class HighlightJS {
5
- private readonly loader;
6
- readonly hljs: import("@angular/core").Signal<HLJSApi | undefined>;
7
- constructor();
8
- /**
9
- * Core highlighting function. Accepts the code to highlight (string) and a list of options (object)
10
- */
11
- highlight(code: string, options: HighlightOptions): Promise<HighlightResult>;
12
- /**
13
- * Highlighting with language detection.
14
- */
15
- highlightAuto(value: string, languageSubset?: string[]): Promise<AutoHighlightResult>;
16
- /**
17
- * Applies highlighting to a DOM node containing code.
18
- * This function is the one to use to apply highlighting dynamically after page load or within initialization code of third-party JavaScript frameworks.
19
- * The function uses language detection by default but you can specify the language in the class attribute of the DOM node. See the scopes reference for all available language names and scopes.
20
- */
21
- highlightElement(element: HTMLElement): Promise<void>;
22
- /**
23
- * Applies highlighting to all elements on a page matching the configured cssSelector. The default cssSelector value is 'pre code',
24
- * which highlights all code blocks. This can be called before or after the page’s onload event has fired.
25
- */
26
- highlightAll(): Promise<void>;
27
- /**
28
- * Adds new language to the library under the specified name. Used mostly internally.
29
- * The function is passed the hljs object to be able to use common regular expressions defined within it.
30
- */
31
- registerLanguage(languageName: string, languageDefinition: LanguageFn): Promise<void>;
32
- /**
33
- * Removes a language and its aliases from the library. Used mostly internally
34
- */
35
- unregisterLanguage(languageName: string): Promise<void>;
36
- /**
37
- * Adds new language alias or aliases to the library for the specified language name defined under languageName key.
38
- */
39
- registerAliases(alias: string | string[], { languageName }: {
40
- languageName: string;
41
- }): Promise<void>;
42
- /**
43
- * @return The languages names list.
44
- */
45
- listLanguages(): Promise<string[]>;
46
- /**
47
- * Looks up a language by name or alias.
48
- */
49
- getLanguage(name: string): Promise<any>;
50
- /**
51
- * Enables safe mode. This is the default mode, providing the most reliable experience for production usage.
52
- */
53
- safeMode(): Promise<void>;
54
- /**
55
- * Enables debug/development mode.
56
- */
57
- debugMode(): Promise<void>;
58
- /**
59
- * Display line numbers
60
- */
61
- lineNumbersBlock(el: HTMLElement, options: LineNumbersOptions): Promise<void>;
62
- static ɵfac: i0.ɵɵFactoryDeclaration<HighlightJS, never>;
63
- static ɵprov: i0.ɵɵInjectableDeclaration<HighlightJS>;
64
- }
@@ -1,7 +0,0 @@
1
- export declare enum LoaderErrors {
2
- FULL_WITH_CORE_LIBRARY_IMPORTS = "The full library and the core library were imported, only one of them should be imported!",
3
- FULL_WITH_LANGUAGE_IMPORTS = "The highlighting languages were imported they are not needed!",
4
- CORE_WITHOUT_LANGUAGE_IMPORTS = "The highlighting languages were not imported!",
5
- LANGUAGE_WITHOUT_CORE_IMPORTS = "The core library was not imported!",
6
- NO_FULL_AND_NO_CORE_IMPORTS = "Highlight.js library was not imported!"
7
- }
package/lib/output.d.ts DELETED
@@ -1,103 +0,0 @@
1
- declare class TokenTree {
2
- constructor();
3
- get top(): any;
4
- get root(): any;
5
- /** @param node */
6
- add(node: any): void;
7
- /** @param scope */
8
- openNode(scope: any): void;
9
- closeNode(): any;
10
- closeAllNodes(): void;
11
- toJSON(): string;
12
- /**
13
- * @typedef { import("./html_renderer").Renderer } Renderer
14
- * @param builder
15
- */
16
- walk(builder: any): any;
17
- /**
18
- * @param builder
19
- * @param node
20
- */
21
- static _walk(builder: any, node: any): any;
22
- /**
23
- * @param node
24
- */
25
- static _collapse(node: any): void;
26
- }
27
- /**
28
- Currently this is all private API, but this is the minimal API necessary
29
- that an Emitter must implement to fully support the parser.
30
-
31
- Minimal interface:
32
-
33
- - addText(text)
34
- - __addSublanguage(emitter, subLanguageName)
35
- - startScope(scope)
36
- - endScope()
37
- - finalize()
38
- - toHTML()
39
-
40
- */
41
- /**
42
- * @implements {Emitter}
43
- */
44
- export declare class TokenTreeEmitter extends TokenTree {
45
- /**
46
- * @param options
47
- */
48
- constructor(options: any);
49
- /**
50
- * @param text
51
- */
52
- addText(text: any): void;
53
- /** @param scope */
54
- startScope(scope: any): void;
55
- endScope(): void;
56
- /**
57
- * @param emitter
58
- * @param name
59
- */
60
- __addSublanguage(emitter: any, name: any): void;
61
- toHTML(): any;
62
- finalize(): boolean;
63
- }
64
- /** @type {Renderer} */
65
- export declare class HTMLRenderer {
66
- /**
67
- * Creates a new HTMLRenderer
68
- *
69
- * @param parseTree - the parse tree (must support `walk` API)
70
- * @param options
71
- */
72
- constructor(parseTree: any, options: any);
73
- /**
74
- * Adds texts to the output stream
75
- *
76
- * @param text */
77
- addText(text: any): void;
78
- /**
79
- * Adds a node open to the output stream (if needed)
80
- *
81
- * @param node */
82
- openNode(node: any): void;
83
- /**
84
- * Adds a node close to the output stream (if needed)
85
- *
86
- * @param node */
87
- closeNode(node: any): void;
88
- /**
89
- * returns the accumulated buffer
90
- */
91
- value(): any;
92
- /**
93
- * Builds a span element
94
- *
95
- * @param className */
96
- span(className: any): void;
97
- }
98
- /**
99
- * @param value
100
- * @returns
101
- */
102
- export declare function escapeHTML(value: any): any;
103
- export {};
@@ -1 +0,0 @@
1
- export declare function trustedHTMLFromStringBypass(html: string): string | import("trusted-types/lib").TrustedHTML;
@@ -1,6 +0,0 @@
1
- interface LineNumbersOptions {
2
- startFrom?: number;
3
- singleLine?: boolean;
4
- }
5
- export declare function activateLineNumbers(document: Document): (code: string, options?: LineNumbersOptions) => string;
6
- export {};
@@ -1,12 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class HighlightLineNumbersDirective {
3
- private readonly options;
4
- private readonly hljs;
5
- private readonly highlight;
6
- private readonly nativeElement;
7
- readonly startFrom: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
8
- readonly singleLine: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
9
- constructor();
10
- static ɵfac: i0.ɵɵFactoryDeclaration<HighlightLineNumbersDirective, never>;
11
- static ɵdir: i0.ɵɵDirectiveDeclaration<HighlightLineNumbersDirective, "[nxtHighlight][lineNumbers], [nxtHighlightAuto][lineNumbers]", never, { "startFrom": { "alias": "startFrom"; "required": false; "isSignal": true; }; "singleLine": { "alias": "singleLine"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
12
- }
@@ -1,2 +0,0 @@
1
- export * from './line-numbers-lib';
2
- export * from './line-numbers.directive';
package/public-api.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from './lib/highlight-auto.directive';
2
- export * from './lib/highlight-base.directive';
3
- export * from './lib/highlight.directive';
4
- export * from './lib/highlight.loader';
5
- export * from './lib/highlight.model';
6
- export * from './lib/highlight.module';
7
- export * from './lib/highlight.service';