@koobiq/components 18.10.0 → 18.12.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.
- package/autocomplete/autocomplete-trigger.directive.d.ts +0 -1
- package/autocomplete/autocomplete.scss +2 -10
- package/button/button-tokens.scss +1 -1
- package/code-block/_code-block-theme.scss +35 -54
- package/code-block/code-block-highlight.d.ts +44 -0
- package/code-block/code-block-tokens.scss +7 -11
- package/code-block/code-block.d.ts +187 -0
- package/code-block/code-block.module.d.ts +2 -8
- package/code-block/code-block.scss +103 -127
- package/code-block/public-api.d.ts +3 -2
- package/code-block/types.d.ts +27 -0
- package/core/common-behaviors/error-state.d.ts +3 -3
- package/core/error/error-state-matcher.d.ts +3 -0
- package/core/locales/index.d.ts +1 -0
- package/core/locales/types.d.ts +11 -0
- package/core/pop-up/constants.d.ts +9 -0
- package/core/select/constants.d.ts +16 -4
- package/core/styles/theming/_scrollbar-theme.scss +2 -1
- package/esm2022/autocomplete/autocomplete-trigger.directive.mjs +7 -8
- package/esm2022/autocomplete/autocomplete.component.mjs +2 -2
- package/esm2022/button/button.component.mjs +2 -2
- package/esm2022/code-block/code-block-highlight.mjs +416 -0
- package/esm2022/code-block/code-block.mjs +395 -0
- package/esm2022/code-block/code-block.module.mjs +9 -30
- package/esm2022/code-block/public-api.mjs +4 -3
- package/esm2022/code-block/types.mjs +2 -0
- package/esm2022/core/common-behaviors/error-state.mjs +1 -1
- package/esm2022/core/error/error-state-matcher.mjs +15 -2
- package/esm2022/core/locales/en-US.mjs +1 -1
- package/esm2022/core/locales/es-LA.mjs +1 -1
- package/esm2022/core/locales/fa-IR.mjs +1 -1
- package/esm2022/core/locales/index.mjs +2 -1
- package/esm2022/core/locales/pt-BR.mjs +1 -1
- package/esm2022/core/locales/ru-RU.mjs +1 -1
- package/esm2022/core/locales/types.mjs +2 -0
- package/esm2022/core/locales/zh-CN.mjs +1 -1
- package/esm2022/core/pop-up/constants.mjs +6 -1
- package/esm2022/core/select/constants.mjs +17 -5
- package/esm2022/core/version.mjs +2 -2
- package/esm2022/datepicker/calendar-header.component.mjs +1 -1
- package/esm2022/file-upload/file-upload.mjs +40 -2
- package/esm2022/file-upload/multiple-file-upload.component.mjs +43 -47
- package/esm2022/file-upload/single-file-upload.component.mjs +41 -45
- package/esm2022/form-field/form-field.mjs +6 -6
- package/esm2022/form-field/hint.mjs +2 -2
- package/esm2022/form-field/password-hint.mjs +2 -2
- package/esm2022/loader-overlay/loader-overlay.component.mjs +6 -4
- package/esm2022/modal/modal.component.mjs +5 -3
- package/esm2022/modal/modal.service.mjs +6 -3
- package/esm2022/modal/modal.type.mjs +1 -1
- package/esm2022/modal/public-api.mjs +5 -5
- package/esm2022/scrollbar/scrollbar.directive.mjs +6 -3
- package/esm2022/select/select.component.mjs +22 -12
- package/esm2022/sidepanel/sidepanel-config.mjs +1 -1
- package/esm2022/sidepanel/sidepanel-container.component.mjs +6 -3
- package/esm2022/timezone/timezone-select.component.mjs +3 -1
- package/esm2022/toast/toast-container.component.mjs +3 -3
- package/esm2022/toast/toast.component.mjs +18 -9
- package/esm2022/toast/toast.module.mjs +14 -50
- package/esm2022/toast/toast.service.mjs +5 -2
- package/esm2022/tooltip/tooltip.component.mjs +5 -2
- package/esm2022/tree-select/tree-select.component.mjs +15 -40
- package/fesm2022/koobiq-components-autocomplete.mjs +9 -10
- package/fesm2022/koobiq-components-autocomplete.mjs.map +1 -1
- package/fesm2022/koobiq-components-button.mjs +2 -2
- package/fesm2022/koobiq-components-button.mjs.map +1 -1
- package/fesm2022/koobiq-components-code-block.mjs +378 -341
- package/fesm2022/koobiq-components-code-block.mjs.map +1 -1
- package/fesm2022/koobiq-components-core.mjs +36 -7
- package/fesm2022/koobiq-components-core.mjs.map +1 -1
- package/fesm2022/koobiq-components-datepicker.mjs +1 -1
- package/fesm2022/koobiq-components-datepicker.mjs.map +1 -1
- package/fesm2022/koobiq-components-file-upload.mjs +107 -76
- package/fesm2022/koobiq-components-file-upload.mjs.map +1 -1
- package/fesm2022/koobiq-components-form-field.mjs +9 -9
- package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
- package/fesm2022/koobiq-components-loader-overlay.mjs +5 -3
- package/fesm2022/koobiq-components-loader-overlay.mjs.map +1 -1
- package/fesm2022/koobiq-components-modal.mjs +10 -5
- package/fesm2022/koobiq-components-modal.mjs.map +1 -1
- package/fesm2022/koobiq-components-scrollbar.mjs +5 -2
- package/fesm2022/koobiq-components-scrollbar.mjs.map +1 -1
- package/fesm2022/koobiq-components-select.mjs +21 -11
- package/fesm2022/koobiq-components-select.mjs.map +1 -1
- package/fesm2022/koobiq-components-sidepanel.mjs +5 -2
- package/fesm2022/koobiq-components-sidepanel.mjs.map +1 -1
- package/fesm2022/koobiq-components-timezone.mjs +2 -0
- package/fesm2022/koobiq-components-timezone.mjs.map +1 -1
- package/fesm2022/koobiq-components-toast.mjs +138 -161
- package/fesm2022/koobiq-components-toast.mjs.map +1 -1
- package/fesm2022/koobiq-components-tooltip.mjs +4 -1
- package/fesm2022/koobiq-components-tooltip.mjs.map +1 -1
- package/fesm2022/koobiq-components-tree-select.mjs +14 -39
- package/fesm2022/koobiq-components-tree-select.mjs.map +1 -1
- package/file-upload/_file-upload-theme.scss +16 -2
- package/file-upload/file-upload.d.ts +29 -2
- package/file-upload/multiple-file-upload.component.d.ts +18 -18
- package/file-upload/single-file-upload.component.d.ts +17 -16
- package/form-field/_hint-theme.scss +1 -1
- package/form-field/form-field.d.ts +1 -1
- package/form-field/form-field.scss +0 -1
- package/loader-overlay/loader-overlay.component.d.ts +1 -0
- package/modal/modal.component.d.ts +4 -0
- package/modal/modal.service.d.ts +4 -0
- package/modal/modal.type.d.ts +6 -1
- package/modal/public-api.d.ts +4 -4
- package/package.json +4 -4
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/light-theme.css +1 -1
- package/prebuilt-themes/theme.css +1 -1
- package/schematics/ng-add/index.js +3 -4
- package/scrollbar/scrollbar.directive.d.ts +2 -1
- package/select/select.component.d.ts +15 -3
- package/sidepanel/sidepanel-config.d.ts +2 -0
- package/sidepanel/sidepanel-container.component.d.ts +1 -0
- package/timezone/timezone-select.component.d.ts +3 -1
- package/toast/toast-container.component.d.ts +1 -1
- package/toast/toast.component.d.ts +2 -2
- package/toast/toast.module.d.ts +1 -7
- package/toast/toast.service.d.ts +1 -1
- package/tooltip/tooltip.component.d.ts +2 -1
- package/tree-select/_tree-select-theme.scss +4 -0
- package/tree-select/tree-select.component.d.ts +1 -12
- package/accordion/README.md +0 -0
- package/alert/README.md +0 -0
- package/autocomplete/README.md +0 -0
- package/badge/README.md +0 -0
- package/button/README.md +0 -0
- package/button-toggle/README.md +0 -0
- package/checkbox/README.md +0 -1
- package/code-block/README.md +0 -36
- package/code-block/actionbar.component.d.ts +0 -32
- package/code-block/actionbar.component.scss +0 -43
- package/code-block/code-block-content.d.ts +0 -28
- package/code-block/code-block.component.d.ts +0 -98
- package/code-block/code-block.types.d.ts +0 -36
- package/datepicker/README.md +0 -0
- package/divider/README.md +0 -0
- package/dl/README.md +0 -0
- package/empty-state/README.md +0 -0
- package/esm2022/code-block/actionbar.component.mjs +0 -90
- package/esm2022/code-block/code-block-content.mjs +0 -393
- package/esm2022/code-block/code-block.component.mjs +0 -283
- package/esm2022/code-block/code-block.types.mjs +0 -5
- package/file-upload/README.md +0 -0
- package/form-field/README.md +0 -0
- package/icon/README.md +0 -0
- package/link/README.md +0 -0
- package/list/README.md +0 -0
- package/loader-overlay/README.md +0 -0
- package/modal/README.md +0 -35
- package/navbar/README.md +0 -42
- package/popover/README.md +0 -36
- package/progress-bar/README.md +0 -0
- package/progress-spinner/README.md +0 -0
- package/risk-level/README.md +0 -0
- package/table/README.md +0 -0
- package/tags/README.md +0 -0
- package/textarea/README.md +0 -0
- package/timepicker/README.md +0 -0
- package/timezone/README.md +0 -0
- package/tree-select/README.md +0 -0
|
@@ -16,7 +16,6 @@ import * as i0 from "@angular/core";
|
|
|
16
16
|
*/
|
|
17
17
|
/** The total height of the autocomplete panel. */
|
|
18
18
|
export declare const AUTOCOMPLETE_PANEL_HEIGHT = 256;
|
|
19
|
-
export declare const AUTOCOMPLETE_BORDER_WIDTH: number;
|
|
20
19
|
/** Injection token that determines the scroll handling while the autocomplete panel is open. */
|
|
21
20
|
export declare const KBQ_AUTOCOMPLETE_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
|
|
22
21
|
export declare function KBQ_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy;
|
|
@@ -10,17 +10,14 @@
|
|
|
10
10
|
overflow: hidden auto;
|
|
11
11
|
-webkit-overflow-scrolling: touch; // for momentum scroll on mobile
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
box-sizing: border-box;
|
|
15
14
|
min-width: 100%;
|
|
16
15
|
width: 100%;
|
|
17
16
|
max-width: none;
|
|
18
17
|
|
|
18
|
+
border-radius: var(--kbq-autocomplete-size-panel-border-radius, var(--kbq-size-border-radius));
|
|
19
19
|
max-height: var(--kbq-autocomplete-size-panel-max-height);
|
|
20
20
|
|
|
21
|
-
border-bottom-left-radius: var(--kbq-autocomplete-size-panel-border-radius);
|
|
22
|
-
border-bottom-right-radius: var(--kbq-autocomplete-size-panel-border-radius);
|
|
23
|
-
|
|
24
21
|
padding: var(--kbq-size-xxs);
|
|
25
22
|
|
|
26
23
|
&.kbq-autocomplete_visible {
|
|
@@ -51,11 +48,6 @@
|
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
.kbq-autocomplete-panel-above & {
|
|
55
|
-
border-radius: var(--kbq-autocomplete-size-panel-border-radius) var(--kbq-autocomplete-size-panel-border-radius)
|
|
56
|
-
0 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
51
|
// We need to offset horizontal dividers by their height, because
|
|
60
52
|
// they throw off the keyboard navigation inside the panel.
|
|
61
53
|
.kbq-divider-horizontal {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
--kbq-button-size-border-width: var(--kbq-size-border-width);
|
|
5
5
|
--kbq-button-size-border-radius: var(--kbq-size-border-radius);
|
|
6
6
|
--kbq-button-size-horizontal-padding: var(--kbq-size-m);
|
|
7
|
-
--kbq-button-size-content-padding: var(--kbq-size-
|
|
7
|
+
--kbq-button-size-content-padding: var(--kbq-size-s);
|
|
8
8
|
--kbq-button-icon-size-horizontal-padding: var(--kbq-size-s);
|
|
9
9
|
--kbq-button-icon-size-vertical-padding: var(--kbq-size-s);
|
|
10
10
|
--kbq-button-icon-size-content-padding: var(--kbq-size-xxs);
|
|
@@ -8,65 +8,56 @@
|
|
|
8
8
|
$base: code-block-#{$style-name};
|
|
9
9
|
|
|
10
10
|
background: var(--kbq-#{$base}-container-background);
|
|
11
|
+
border-color: var(--kbq-#{$base}-container-border-color);
|
|
11
12
|
|
|
12
|
-
& .kbq-
|
|
13
|
-
background: var(--kbq-#{$base}-header-background)
|
|
14
|
-
border-color: var(--kbq-#{$base}-container-border-color);
|
|
13
|
+
& .kbq-code-block__header {
|
|
14
|
+
background: var(--kbq-#{$base}-header-background);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.kbq-
|
|
18
|
-
border-color: var(--kbq-#{$base}-container-border-color);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&:not(.kbq-code-block_no-header) {
|
|
22
|
-
.kbq-tab-body__wrapper {
|
|
23
|
-
border-top-color: transparent;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
& .kbq-code-block-actionbar {
|
|
17
|
+
& .kbq-code-block__actionbar {
|
|
28
18
|
background: var(--kbq-#{$base}-actionbar-background);
|
|
29
|
-
|
|
30
|
-
&.kbq-actionbar-block_floating {
|
|
31
|
-
.kbq-actionbar-block__button-stack {
|
|
32
|
-
background: var(--kbq-#{$base}-actionbar-background);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
19
|
}
|
|
36
20
|
|
|
37
21
|
&.kbq-code-block_header-with-shadow {
|
|
38
|
-
& .kbq-
|
|
22
|
+
& .kbq-code-block__header {
|
|
39
23
|
box-shadow: var(--kbq-#{$base}-header-scroll-shadow);
|
|
40
24
|
}
|
|
41
25
|
}
|
|
42
26
|
|
|
43
|
-
&.kbq-code-
|
|
44
|
-
|
|
45
|
-
background:
|
|
27
|
+
&.kbq-code-block_hide-tabs {
|
|
28
|
+
.kbq-code-block__actionbar {
|
|
29
|
+
background: transparent;
|
|
30
|
+
|
|
31
|
+
.kbq-code-block__actionbar__fade-gradient {
|
|
32
|
+
background: var(--kbq-#{$base}-actionbar-fade-gradient);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.kbq-code-block__actionbar__button-stack {
|
|
36
|
+
background: var(--kbq-#{$base}-actionbar-background);
|
|
37
|
+
}
|
|
46
38
|
}
|
|
47
39
|
}
|
|
48
40
|
|
|
49
|
-
.kbq-code-
|
|
50
|
-
.
|
|
41
|
+
.kbq-code-block__view-all {
|
|
42
|
+
.kbq-code-block__view-all__wrapper {
|
|
51
43
|
background: var(--kbq-#{$base}-collapse-button-expand-background);
|
|
52
44
|
opacity: 90%;
|
|
53
45
|
}
|
|
54
|
-
}
|
|
55
46
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
&.kbq-code-block__view-all_expanded {
|
|
48
|
+
background: var(--kbq-#{$base}-collapse-expanded-background);
|
|
49
|
+
}
|
|
59
50
|
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
&.kbq-code-block__view-all_collapsed {
|
|
52
|
+
background: var(--kbq-#{$base}-collapse-collapsed-background);
|
|
53
|
+
}
|
|
62
54
|
}
|
|
63
55
|
}
|
|
64
56
|
|
|
65
57
|
@mixin kbq-code-block-theme() {
|
|
66
58
|
.kbq-code-block {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
overflow-x: auto;
|
|
59
|
+
&.kbq-code-block_no-border {
|
|
60
|
+
border-color: transparent !important;
|
|
70
61
|
}
|
|
71
62
|
|
|
72
63
|
.hljs-addition {
|
|
@@ -85,8 +76,8 @@
|
|
|
85
76
|
}
|
|
86
77
|
|
|
87
78
|
.hljs-built_in {
|
|
88
|
-
background-color: kbq-code-block-hljs-attr(
|
|
89
|
-
color: kbq-code-block-hljs-attr(
|
|
79
|
+
background-color: kbq-code-block-hljs-attr(built-in-background);
|
|
80
|
+
color: kbq-code-block-hljs-attr(built-in-color);
|
|
90
81
|
}
|
|
91
82
|
|
|
92
83
|
.hljs-bullet {
|
|
@@ -336,23 +327,13 @@
|
|
|
336
327
|
@include kbq-code-block-style(filled);
|
|
337
328
|
}
|
|
338
329
|
|
|
339
|
-
.kbq-
|
|
340
|
-
|
|
341
|
-
& .kbq-tab-header__pagination {
|
|
342
|
-
border-bottom-color: transparent;
|
|
343
|
-
}
|
|
330
|
+
.kbq-code-block__content {
|
|
331
|
+
border-color: transparent;
|
|
344
332
|
}
|
|
345
333
|
|
|
346
|
-
.kbq-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
box-shadow: 0 2px 0 -1px var(--kbq-states-line-focus-theme);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.kbq-tab-body__wrapper {
|
|
353
|
-
border-color: var(--kbq-states-line-focus-theme);
|
|
354
|
-
box-shadow: inset 0 0 0.1 1px var(--kbq-states-line-focus-theme);
|
|
355
|
-
}
|
|
334
|
+
.kbq-code-block__content.cdk-keyboard-focused {
|
|
335
|
+
outline: none;
|
|
336
|
+
border-color: var(--kbq-states-line-focus-theme);
|
|
356
337
|
}
|
|
357
338
|
}
|
|
358
339
|
}
|
|
@@ -361,10 +342,10 @@
|
|
|
361
342
|
.kbq-code-block {
|
|
362
343
|
@include kbq-typography-level-to-styles-css-variables(typography, mono-codeblock);
|
|
363
344
|
|
|
364
|
-
|
|
345
|
+
.kbq-code-block__content {
|
|
365
346
|
font: inherit;
|
|
366
347
|
|
|
367
|
-
|
|
348
|
+
.kbq-code-block__code {
|
|
368
349
|
font: inherit;
|
|
369
350
|
}
|
|
370
351
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
+
import { KbqCodeBlockFile } from './types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Fallback language for code block if language is not supported/specified.
|
|
6
|
+
*
|
|
7
|
+
* List of supported languages:
|
|
8
|
+
* @link https://highlightjs.readthedocs.io/en/stable/supported-languages.html
|
|
9
|
+
*/
|
|
10
|
+
export declare const KBQ_CODE_BLOCK_FALLBACK_FILE_LANGUAGE: InjectionToken<string>;
|
|
11
|
+
/** Utility provider for `KBQ_CODE_BLOCK_FALLBACK_FILE_LANGUAGE`. */
|
|
12
|
+
export declare const kbqCodeBlockFallbackFileLanguageProvider: (language: string) => Provider;
|
|
13
|
+
/** Directive which applies syntax highlighting to the code block content. */
|
|
14
|
+
export declare class KbqCodeBlockHighlight {
|
|
15
|
+
private readonly nativeElement;
|
|
16
|
+
private readonly document;
|
|
17
|
+
private readonly renderer;
|
|
18
|
+
private readonly domSanitizer;
|
|
19
|
+
private readonly fallbackFileLanguage;
|
|
20
|
+
/** The code file. */
|
|
21
|
+
set file({ language, content }: KbqCodeBlockFile);
|
|
22
|
+
/** The starting line number. */
|
|
23
|
+
startFrom: number;
|
|
24
|
+
/** Whether to display line numbers for single line code block. */
|
|
25
|
+
singleLine: boolean;
|
|
26
|
+
constructor();
|
|
27
|
+
/** Use defaultView of injected document if available or fallback to global window reference */
|
|
28
|
+
private getWindow;
|
|
29
|
+
/**
|
|
30
|
+
* Initialize the HighlightJS line numbers plugin. This method is called once when
|
|
31
|
+
* the component is constructed.
|
|
32
|
+
*/
|
|
33
|
+
private initLineNumbersPlugin;
|
|
34
|
+
/**
|
|
35
|
+
* This method is not intended for editing.
|
|
36
|
+
* Changes may lead to unpredictable behavior.
|
|
37
|
+
* Source code: https://github.com/wcoder/highlightjs-line-numbers.js/blob/v2.9.0/src/highlightjs-line-numbers.js
|
|
38
|
+
*/
|
|
39
|
+
private highlightJSLineNumbersPlugin;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KbqCodeBlockHighlight, never>;
|
|
41
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<KbqCodeBlockHighlight, "code[kbqCodeBlockHighlight]", never, { "file": { "alias": "file"; "required": true; }; "startFrom": { "alias": "startFrom"; "required": false; }; "singleLine": { "alias": "singleLine"; "required": false; }; }, {}, never, never, true, never>;
|
|
42
|
+
static ngAcceptInputType_startFrom: unknown;
|
|
43
|
+
static ngAcceptInputType_singleLine: unknown;
|
|
44
|
+
}
|
|
@@ -6,15 +6,10 @@
|
|
|
6
6
|
--kbq-code-block-size-with-header-content-padding-horizontal: var(--kbq-size-xl);
|
|
7
7
|
--kbq-code-block-size-with-header-content-content-gap-horizontal: var(--kbq-size-m);
|
|
8
8
|
--kbq-code-block-size-no-header-content-padding-vertical: 14px;
|
|
9
|
-
--kbq-code-block-size-no-header-content-padding-horizontal:
|
|
9
|
+
--kbq-code-block-size-no-header-content-padding-horizontal: var(--kbq-size-xl);
|
|
10
10
|
--kbq-code-block-size-no-header-content-content-gap-horizontal: var(--kbq-size-m);
|
|
11
|
-
--kbq-code-block-size-header-padding-vertical: var(--kbq-size-s);
|
|
12
|
-
--kbq-code-block-size-header-padding-left: var(--kbq-size-m);
|
|
13
|
-
--kbq-code-block-size-header-padding-right: var(--kbq-size-s);
|
|
14
11
|
--kbq-code-block-size-header-content-gap-horizontal: var(--kbq-size-l);
|
|
15
12
|
--kbq-code-block-size-actionbar-content-gap-horizontal: var(--kbq-size-3xs);
|
|
16
|
-
--kbq-code-block-size-actionbar-padding-vertical: var(--kbq-size-s);
|
|
17
|
-
--kbq-code-block-size-actionbar-padding-horizontal: var(--kbq-size-m);
|
|
18
13
|
--kbq-code-block-size-actionbar-fade-gradient-width: var(--kbq-size-3xl);
|
|
19
14
|
--kbq-code-block-size-collapse-expanded-padding-top: 0;
|
|
20
15
|
--kbq-code-block-size-collapse-expanded-padding-bottom: var(--kbq-size-l);
|
|
@@ -136,8 +131,8 @@
|
|
|
136
131
|
--kbq-code-block-filled-collapse-expanded-background: transparent;
|
|
137
132
|
--kbq-code-block-filled-collapse-collapsed-background: linear-gradient(
|
|
138
133
|
180deg,
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
transparent,
|
|
135
|
+
var(--kbq-background-bg-secondary) 100%
|
|
141
136
|
);
|
|
142
137
|
--kbq-code-block-filled-collapse-button-expand-background: var(--kbq-background-bg-secondary);
|
|
143
138
|
--kbq-code-block-outline-container-background: var(--kbq-background-card);
|
|
@@ -149,8 +144,8 @@
|
|
|
149
144
|
--kbq-code-block-outline-collapse-expanded-background: transparent;
|
|
150
145
|
--kbq-code-block-outline-collapse-collapsed-background: linear-gradient(
|
|
151
146
|
180deg,
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
transparent,
|
|
148
|
+
var(--kbq-background-bg) 100%
|
|
154
149
|
);
|
|
155
150
|
--kbq-code-block-outline-collapse-button-expand-background: var(--kbq-background-card);
|
|
156
151
|
--kbq-code-block-hljs-addition-background: var(--kbq-palette-green-95);
|
|
@@ -160,7 +155,7 @@
|
|
|
160
155
|
--kbq-code-block-hljs-attribute-background: null;
|
|
161
156
|
--kbq-code-block-hljs-attribute-color: null;
|
|
162
157
|
--kbq-code-block-hljs-built-in-background: null;
|
|
163
|
-
--kbq-code-block-hljs-built-in-color:
|
|
158
|
+
--kbq-code-block-hljs-built-in-color: var(--kbq-palette-blue-35);
|
|
164
159
|
--kbq-code-block-hljs-bullet-background: null;
|
|
165
160
|
--kbq-code-block-hljs-bullet-color: null;
|
|
166
161
|
--kbq-code-block-hljs-char-escape-background: null;
|
|
@@ -256,4 +251,5 @@
|
|
|
256
251
|
--kbq-code-block-hljs-variable-constant-color: null;
|
|
257
252
|
--kbq-code-block-hljs-variable-language-background: null;
|
|
258
253
|
--kbq-code-block-hljs-variable-language-color: null;
|
|
254
|
+
--kbq-code-block-tab-size: 4;
|
|
259
255
|
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { CdkScrollable } from '@angular/cdk/scrolling';
|
|
2
|
+
import { AfterViewInit, EventEmitter, InjectionToken, Provider } from '@angular/core';
|
|
3
|
+
import { KbqButtonStyles } from '@koobiq/components/button';
|
|
4
|
+
import { KbqCodeBlockLocaleConfiguration, KbqComponentColors } from '@koobiq/components/core';
|
|
5
|
+
import { KbqCodeBlockFile } from './types';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/** Localization configuration provider. */
|
|
8
|
+
export declare const KBQ_CODE_BLOCK_LOCALE_CONFIGURATION: InjectionToken<KbqCodeBlockLocaleConfiguration>;
|
|
9
|
+
/** Utility provider for `KBQ_CODE_BLOCK_LOCALE_CONFIGURATION`. */
|
|
10
|
+
export declare const kbqCodeBlockLocaleConfigurationProvider: (configuration: KbqCodeBlockLocaleConfiguration) => Provider;
|
|
11
|
+
/** Fallback file name for code block if file name is not specified. */
|
|
12
|
+
export declare const KBQ_CODE_BLOCK_FALLBACK_FILE_NAME: InjectionToken<string>;
|
|
13
|
+
/** Utility provider for `KBQ_CODE_BLOCK_FALLBACK_FILE_NAME`. */
|
|
14
|
+
export declare const kbqCodeBlockFallbackFileNameProvider: (fileName: string) => Provider;
|
|
15
|
+
/**
|
|
16
|
+
* Component which highlights blocks of code.
|
|
17
|
+
*/
|
|
18
|
+
export declare class KbqCodeBlock implements AfterViewInit {
|
|
19
|
+
private readonly copyButtonTooltip?;
|
|
20
|
+
readonly scrollableCodeContent: CdkScrollable;
|
|
21
|
+
/** Whether to display line numbers. */
|
|
22
|
+
lineNumbers: boolean;
|
|
23
|
+
/** Whether the code block should be filled. */
|
|
24
|
+
filled: boolean;
|
|
25
|
+
/** Added soft wrap toggle button. */
|
|
26
|
+
canToggleSoftWrap: boolean;
|
|
27
|
+
/** Whether sequences of whitespace should be preserved. */
|
|
28
|
+
softWrap: boolean;
|
|
29
|
+
/** Event emitted when `softWrap` is changed. */
|
|
30
|
+
readonly softWrapChange: EventEmitter<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Allows to view all the code, otherwise it will be hidden.
|
|
33
|
+
* Works only with `maxHeight` property.
|
|
34
|
+
*/
|
|
35
|
+
viewAll: boolean;
|
|
36
|
+
/** Event emitted when `viewAll` is changed. */
|
|
37
|
+
readonly viewAllChange: EventEmitter<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Maximum height of the code block content, other parts will be hidden.
|
|
40
|
+
* Can be toggled by `viewAll` property.
|
|
41
|
+
*/
|
|
42
|
+
maxHeight: number;
|
|
43
|
+
protected get calculatedMaxHeight(): number | null;
|
|
44
|
+
/** @deprecated Will be removed in next major release, use `canDownload` instead. */
|
|
45
|
+
set canLoad(value: boolean);
|
|
46
|
+
/** Added download code button. */
|
|
47
|
+
canDownload: boolean;
|
|
48
|
+
/** Added copy code button. */
|
|
49
|
+
canCopy: boolean;
|
|
50
|
+
/** @deprecated Will be removed in next major release, use `files` instead. */
|
|
51
|
+
set codeFiles(files: KbqCodeBlockFile[]);
|
|
52
|
+
/**
|
|
53
|
+
* @TODO Mark as `required`, after removing `codeFiles`
|
|
54
|
+
*
|
|
55
|
+
* Files to display.
|
|
56
|
+
*/
|
|
57
|
+
set files(files: KbqCodeBlockFile[]);
|
|
58
|
+
get files(): KbqCodeBlockFile[];
|
|
59
|
+
private _files;
|
|
60
|
+
/** Defines which file (index) is active. */
|
|
61
|
+
activeFileIndex: number;
|
|
62
|
+
readonly activeFileIndexChange: EventEmitter<number>;
|
|
63
|
+
/** Whether to hide border. */
|
|
64
|
+
noBorder: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether to hide header tabs.
|
|
67
|
+
* Always `true` if there is only one file without filename.
|
|
68
|
+
* Makes actionbar floating if tabs are hidden.
|
|
69
|
+
*/
|
|
70
|
+
set hideTabs(value: boolean);
|
|
71
|
+
get hideTabs(): boolean;
|
|
72
|
+
private _hideTabs;
|
|
73
|
+
/** Component locale configuration. */
|
|
74
|
+
protected get localeConfiguration(): KbqCodeBlockLocaleConfiguration;
|
|
75
|
+
private _localeConfiguration;
|
|
76
|
+
/** Code content tab index. */
|
|
77
|
+
protected get codeContentTabIndex(): number;
|
|
78
|
+
/**
|
|
79
|
+
* Determines whether the code content can be focused.
|
|
80
|
+
*
|
|
81
|
+
* This checks if the scrollable code content element is present,
|
|
82
|
+
* has a scroll, and the calculated maximum height is not set.
|
|
83
|
+
*/
|
|
84
|
+
private get canCodeContentBeFocused();
|
|
85
|
+
protected readonly componentColor: typeof KbqComponentColors;
|
|
86
|
+
protected readonly buttonStyle: typeof KbqButtonStyles;
|
|
87
|
+
private readonly elementRef;
|
|
88
|
+
private readonly changeDetectorRef;
|
|
89
|
+
private readonly localeService;
|
|
90
|
+
private readonly destroyRef;
|
|
91
|
+
private readonly renderer;
|
|
92
|
+
private readonly platform;
|
|
93
|
+
private readonly focusMonitor;
|
|
94
|
+
private readonly clipboard;
|
|
95
|
+
private readonly domSanitizer;
|
|
96
|
+
private readonly document;
|
|
97
|
+
protected readonly fallbackFileName: string;
|
|
98
|
+
constructor();
|
|
99
|
+
ngAfterViewInit(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Toggles the `viewAll` property.
|
|
102
|
+
*
|
|
103
|
+
* When `viewAll` is set to `true`, the content of the code block will be
|
|
104
|
+
* displayed in its entirety. When set to `false`, the content will be
|
|
105
|
+
* limited to the `maxHeight` property. If the content exceeds the
|
|
106
|
+
* `maxHeight`, it will be scrolled to the top and the `viewAll` button
|
|
107
|
+
* will be displayed.
|
|
108
|
+
*/
|
|
109
|
+
toggleViewAll(): void;
|
|
110
|
+
/**
|
|
111
|
+
* Toggles `softWrap` property.
|
|
112
|
+
*
|
|
113
|
+
* When `softWrap` is set to `true`, the content of the code block will be
|
|
114
|
+
* wrapped if it exceeds the height of the component. When set to `false`
|
|
115
|
+
* the content will not be wrapped.
|
|
116
|
+
*/
|
|
117
|
+
toggleSoftWrap(): void;
|
|
118
|
+
/**
|
|
119
|
+
* Handles the change of the selected tab by updating the active file index
|
|
120
|
+
* and scrolling to the top of the scrollable content.
|
|
121
|
+
*
|
|
122
|
+
* @param index - The index of the newly selected tab.
|
|
123
|
+
*/
|
|
124
|
+
protected onSelectedTabChange(index: number): void;
|
|
125
|
+
/**
|
|
126
|
+
* Handles the hover event on the code block element and updates the actionbar display accordingly.
|
|
127
|
+
*/
|
|
128
|
+
private handleHover;
|
|
129
|
+
/**
|
|
130
|
+
* Handles the scroll event on the scrollable code content element and updates the header shadow accordingly.
|
|
131
|
+
*/
|
|
132
|
+
private handleScroll;
|
|
133
|
+
/**
|
|
134
|
+
* Adds or removes the shadow class from the code block based on the specified condition.
|
|
135
|
+
*
|
|
136
|
+
* @param shouldShowShadow - A boolean indicating whether to add or remove the shadow class.
|
|
137
|
+
*/
|
|
138
|
+
private setupHeaderShadow;
|
|
139
|
+
/**
|
|
140
|
+
* Adds or removes the actionbar display class from the code block based on the specified condition.
|
|
141
|
+
*
|
|
142
|
+
* The actionbar is always visible on mobile devices and when the tabs are visible.
|
|
143
|
+
* Otherwise, the actionbar is only visible when the mouse is hovered over the code block.
|
|
144
|
+
*
|
|
145
|
+
* @param shouldShowActionbar - A boolean indicating whether the actionbar should be visible.
|
|
146
|
+
*/
|
|
147
|
+
private setupActionbarDisplay;
|
|
148
|
+
/** Whether the element has scroll. */
|
|
149
|
+
private hasScroll;
|
|
150
|
+
/** Handles the enter keydown event on `viewAll` button. */
|
|
151
|
+
protected onViewAllEnterKeydown(): void;
|
|
152
|
+
private updateLocaleParams;
|
|
153
|
+
/**
|
|
154
|
+
* Copies the file code to the clipboard.
|
|
155
|
+
*
|
|
156
|
+
* If the copy was successful, the copy button tooltip content is updated
|
|
157
|
+
* to show the "copied" message.
|
|
158
|
+
*/
|
|
159
|
+
protected copyCode(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Opens the file link in a new window.
|
|
162
|
+
*/
|
|
163
|
+
protected openLink(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Downloads the file as a blob.
|
|
166
|
+
*
|
|
167
|
+
* Creates a link with a blob as href and the file name as download attribute.
|
|
168
|
+
* Then simulates a click event on the link to initiate the download.
|
|
169
|
+
*/
|
|
170
|
+
protected downloadCode(): void;
|
|
171
|
+
/** Use defaultView of injected document if available or fallback to global window reference */
|
|
172
|
+
private getWindow;
|
|
173
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KbqCodeBlock, never>;
|
|
174
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<KbqCodeBlock, "kbq-code-block", ["kbqCodeBlock"], { "lineNumbers": { "alias": "lineNumbers"; "required": false; }; "filled": { "alias": "filled"; "required": false; }; "canToggleSoftWrap": { "alias": "canToggleSoftWrap"; "required": false; }; "softWrap": { "alias": "softWrap"; "required": false; }; "viewAll": { "alias": "viewAll"; "required": false; }; "maxHeight": { "alias": "maxHeight"; "required": false; }; "canLoad": { "alias": "canLoad"; "required": false; }; "canDownload": { "alias": "canDownload"; "required": false; }; "canCopy": { "alias": "canCopy"; "required": false; }; "codeFiles": { "alias": "codeFiles"; "required": false; }; "files": { "alias": "files"; "required": false; }; "activeFileIndex": { "alias": "activeFileIndex"; "required": false; }; "noBorder": { "alias": "noBorder"; "required": false; }; "hideTabs": { "alias": "hideTabs"; "required": false; }; }, { "softWrapChange": "softWrapChange"; "viewAllChange": "viewAllChange"; "activeFileIndexChange": "activeFileIndexChange"; }, never, never, true, never>;
|
|
175
|
+
static ngAcceptInputType_lineNumbers: unknown;
|
|
176
|
+
static ngAcceptInputType_filled: unknown;
|
|
177
|
+
static ngAcceptInputType_canToggleSoftWrap: unknown;
|
|
178
|
+
static ngAcceptInputType_softWrap: unknown;
|
|
179
|
+
static ngAcceptInputType_viewAll: unknown;
|
|
180
|
+
static ngAcceptInputType_maxHeight: unknown;
|
|
181
|
+
static ngAcceptInputType_canLoad: unknown;
|
|
182
|
+
static ngAcceptInputType_canDownload: unknown;
|
|
183
|
+
static ngAcceptInputType_canCopy: unknown;
|
|
184
|
+
static ngAcceptInputType_activeFileIndex: unknown;
|
|
185
|
+
static ngAcceptInputType_noBorder: unknown;
|
|
186
|
+
static ngAcceptInputType_hideTabs: unknown;
|
|
187
|
+
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import * as i1 from "./code-block
|
|
3
|
-
import * as i2 from "./actionbar.component";
|
|
4
|
-
import * as i3 from "@koobiq/components/button";
|
|
5
|
-
import * as i4 from "@koobiq/components/tooltip";
|
|
6
|
-
import * as i5 from "@koobiq/components/icon";
|
|
7
|
-
import * as i6 from "@koobiq/components/tabs";
|
|
8
|
-
import * as i7 from "./code-block-content";
|
|
2
|
+
import * as i1 from "./code-block";
|
|
9
3
|
export declare class KbqCodeBlockModule {
|
|
10
4
|
static ɵfac: i0.ɵɵFactoryDeclaration<KbqCodeBlockModule, never>;
|
|
11
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<KbqCodeBlockModule,
|
|
5
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<KbqCodeBlockModule, never, [typeof i1.KbqCodeBlock], [typeof i1.KbqCodeBlock]>;
|
|
12
6
|
static ɵinj: i0.ɵɵInjectorDeclaration<KbqCodeBlockModule>;
|
|
13
7
|
}
|