@taiga-ui/addon-doc 2.54.0 → 2.56.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/bundles/taiga-ui-addon-doc.umd.js +241 -225
- package/bundles/taiga-ui-addon-doc.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-doc.umd.min.js +1 -1
- package/bundles/taiga-ui-addon-doc.umd.min.js.map +1 -1
- package/components/example/example.component.d.ts +7 -1
- package/esm2015/components/code/code.component.js +5 -5
- package/esm2015/components/code/parse-code-block.js +3 -3
- package/esm2015/components/copy/copy.component.js +2 -2
- package/esm2015/components/demo/demo.component.js +12 -12
- package/esm2015/components/documentation/documentation-property-connector.directive.js +11 -11
- package/esm2015/components/documentation/documentation.component.js +30 -30
- package/esm2015/components/example/example-capitalize.pipe.js +3 -3
- package/esm2015/components/example/example-get-tabs.pipe.js +2 -2
- package/esm2015/components/example/example.component.js +29 -11
- package/esm2015/components/main/main.component.js +8 -8
- package/esm2015/components/navigation/navigation.component.js +16 -16
- package/esm2015/components/navigation/navigation.providers.js +4 -4
- package/esm2015/components/page/page-tab.directive.js +2 -2
- package/esm2015/components/page/page.component.js +10 -10
- package/esm2015/components/page/page.providers.js +4 -4
- package/esm2015/directives/scroll-into-view/scroll-into-view.directive.js +3 -3
- package/esm2015/interfaces/page.js +4 -4
- package/esm2015/internal/header/header.component.js +3 -3
- package/esm2015/internal/input-opacity/input-opacity.directive.js +3 -3
- package/esm2015/internal/see-also/see-also.component.js +4 -4
- package/esm2015/internal/source-code/source-code.component.js +6 -6
- package/esm2015/languages/russian.js +12 -12
- package/esm2015/tokens/code-actions.js +3 -3
- package/esm2015/tokens/code-editor.js +2 -2
- package/esm2015/tokens/default-tabs.js +2 -2
- package/esm2015/tokens/example-content-processor.js +2 -2
- package/esm2015/tokens/i18n.js +19 -19
- package/esm2015/tokens/logo.js +3 -3
- package/esm2015/tokens/page-loaded.js +2 -2
- package/esm2015/tokens/pages.js +2 -2
- package/esm2015/tokens/scroll-behavior.js +2 -2
- package/esm2015/tokens/see-also.js +2 -2
- package/esm2015/tokens/source-code.js +3 -3
- package/esm2015/tokens/title.js +3 -3
- package/esm2015/utils/coerce-value.js +6 -6
- package/esm2015/utils/color-conversion.js +5 -5
- package/esm2015/utils/generate-routes.js +3 -3
- package/esm2015/utils/inspect.js +13 -13
- package/esm2015/utils/transliterate-keyboard-layout.js +34 -34
- package/esm5/components/code/code.component.js +5 -5
- package/esm5/components/code/parse-code-block.js +3 -3
- package/esm5/components/copy/copy.component.js +2 -2
- package/esm5/components/demo/demo.component.js +12 -12
- package/esm5/components/documentation/documentation-property-connector.directive.js +11 -11
- package/esm5/components/documentation/documentation.component.js +30 -30
- package/esm5/components/example/example-capitalize.pipe.js +3 -3
- package/esm5/components/example/example-get-tabs.pipe.js +2 -2
- package/esm5/components/example/example.component.js +29 -11
- package/esm5/components/main/main.component.js +8 -8
- package/esm5/components/navigation/navigation.component.js +16 -16
- package/esm5/components/navigation/navigation.providers.js +4 -4
- package/esm5/components/page/page-tab.directive.js +2 -2
- package/esm5/components/page/page.component.js +10 -10
- package/esm5/components/page/page.providers.js +4 -4
- package/esm5/directives/scroll-into-view/scroll-into-view.directive.js +3 -3
- package/esm5/interfaces/page.js +4 -4
- package/esm5/internal/header/header.component.js +3 -3
- package/esm5/internal/input-opacity/input-opacity.directive.js +3 -3
- package/esm5/internal/see-also/see-also.component.js +4 -4
- package/esm5/internal/source-code/source-code.component.js +6 -6
- package/esm5/languages/russian.js +12 -12
- package/esm5/tokens/code-actions.js +3 -3
- package/esm5/tokens/code-editor.js +2 -2
- package/esm5/tokens/default-tabs.js +2 -2
- package/esm5/tokens/example-content-processor.js +2 -2
- package/esm5/tokens/i18n.js +19 -19
- package/esm5/tokens/logo.js +3 -3
- package/esm5/tokens/page-loaded.js +2 -2
- package/esm5/tokens/pages.js +2 -2
- package/esm5/tokens/scroll-behavior.js +2 -2
- package/esm5/tokens/see-also.js +2 -2
- package/esm5/tokens/source-code.js +3 -3
- package/esm5/tokens/title.js +3 -3
- package/esm5/utils/coerce-value.js +6 -6
- package/esm5/utils/color-conversion.js +5 -5
- package/esm5/utils/generate-routes.js +3 -3
- package/esm5/utils/inspect.js +13 -13
- package/esm5/utils/transliterate-keyboard-layout.js +34 -34
- package/fesm2015/taiga-ui-addon-doc.js +241 -225
- package/fesm2015/taiga-ui-addon-doc.js.map +1 -1
- package/fesm5/taiga-ui-addon-doc.js +241 -225
- package/fesm5/taiga-ui-addon-doc.js.map +1 -1
- package/package.json +5 -5
- package/taiga-ui-addon-doc.metadata.json +1 -1
|
@@ -32,10 +32,10 @@ const tuiRawLoad = rawLoad;
|
|
|
32
32
|
* @deprecated: use {@link tuiTryParseMarkdownCodeBlock} instead
|
|
33
33
|
*/
|
|
34
34
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
35
|
-
function tryParseMarkdownCodeBlock(text =
|
|
35
|
+
function tryParseMarkdownCodeBlock(text = ``) {
|
|
36
36
|
const tokens = new MarkdownIt().parse(text, {});
|
|
37
37
|
const result = tokens
|
|
38
|
-
.filter(({ tag, type }) => tag ===
|
|
38
|
+
.filter(({ tag, type }) => tag === `code` && type === `fence`)
|
|
39
39
|
.map(({ content }) => content);
|
|
40
40
|
return result.length ? result : [text];
|
|
41
41
|
}
|
|
@@ -43,8 +43,8 @@ const tuiTryParseMarkdownCodeBlock = tryParseMarkdownCodeBlock;
|
|
|
43
43
|
|
|
44
44
|
let TuiDocCodeComponent = class TuiDocCodeComponent {
|
|
45
45
|
constructor() {
|
|
46
|
-
this.rawLoader$$ = new BehaviorSubject(
|
|
47
|
-
this.filename =
|
|
46
|
+
this.rawLoader$$ = new BehaviorSubject(``);
|
|
47
|
+
this.filename = ``;
|
|
48
48
|
this.processor$ = this.rawLoader$$.pipe(switchMap(rawLoad), map(tryParseMarkdownCodeBlock));
|
|
49
49
|
}
|
|
50
50
|
set code(code) {
|
|
@@ -61,11 +61,11 @@ __decorate([
|
|
|
61
61
|
Input()
|
|
62
62
|
], TuiDocCodeComponent.prototype, "code", null);
|
|
63
63
|
__decorate([
|
|
64
|
-
HostBinding(
|
|
64
|
+
HostBinding(`class._has-filename`)
|
|
65
65
|
], TuiDocCodeComponent.prototype, "hasFilename", null);
|
|
66
66
|
TuiDocCodeComponent = __decorate([
|
|
67
67
|
Component({
|
|
68
|
-
selector:
|
|
68
|
+
selector: `tui-doc-code`,
|
|
69
69
|
template: "<p\n *ngIf=\"filename\"\n class=\"t-header\"\n>\n {{ filename }}\n</p>\n<pre\n *ngFor=\"let content of processor$ | async\"\n class=\"t-code\"\n><code [lineNumbers]=\"true\" [highlight]=\"content\"></code></pre>\n",
|
|
70
70
|
styles: [":host{display:block}.t-header{font:var(--tui-font-text-s);font-weight:700}.t-code{margin:0}.t-code+.t-code{margin-top:1rem}.hljs:not(:empty){font:var(--tui-font-text-m);padding:1.5rem 2rem;font-family:monospace;background:var(--tui-clear-disabled);word-wrap:break-word;white-space:pre-wrap}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.hljs:not(:empty)::-webkit-scrollbar,.hljs:not(:empty)::-webkit-scrollbar-thumb{width:1rem;height:1rem;border-radius:6.25rem;background-clip:padding-box;border:2.667rem solid transparent}.hljs:not(:empty)::-webkit-scrollbar{background-color:transparent}.hljs:not(:empty)::-webkit-scrollbar-thumb{background-color:var(--tui-clear-hover)}.hljs:not(:empty)::-webkit-scrollbar-thumb:hover{background-color:var(--tui-clear-active)}.hljs:not(:empty)::-webkit-scrollbar-thumb:active{background-color:var(--tui-text-03)}}:host._has-filename .hljs:not(:empty){border-radius:.75rem}:host-context(tui-root._mobile) .hljs:not(:empty){padding:1rem}"]
|
|
71
71
|
})
|
|
@@ -103,7 +103,7 @@ __decorate([
|
|
|
103
103
|
], TuiDocCopyComponent.prototype, "copied$", null);
|
|
104
104
|
TuiDocCopyComponent = __decorate([
|
|
105
105
|
Component({
|
|
106
|
-
selector:
|
|
106
|
+
selector: `tui-doc-copy`,
|
|
107
107
|
template: "<button\n *ngIf=\"texts$ | async as texts\"\n tuiButton\n type=\"button\"\n appearance=\"\"\n size=\"s\"\n class=\"t-copy\"\n [title]=\"texts[0]\"\n (click)=\"onClick()\"\n>\n <span\n class=\"t-content\"\n [class.t-content_moved]=\"copied$ | async\"\n >\n <span\n class=\"t-initial\"\n [attr.data-text]=\"texts[0]\"\n >\n <ng-content></ng-content>\n </span>\n {{ texts[1] }}\n </span>\n</button>\n",
|
|
108
108
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
109
109
|
providers: [TuiDestroyService],
|
|
@@ -129,8 +129,8 @@ TuiDocCopyModule = __decorate([
|
|
|
129
129
|
* Works with a tuple
|
|
130
130
|
* [@string tuiMode tooltip content, @string word 'background', @string 'form value']
|
|
131
131
|
*/
|
|
132
|
-
const TUI_DOC_DEMO_TEXTS = new InjectionToken(
|
|
133
|
-
factory: () => [
|
|
132
|
+
const TUI_DOC_DEMO_TEXTS = new InjectionToken(`tui-doc-demo i18n texts`, {
|
|
133
|
+
factory: () => [`Read more more about modes: `, `Background`, `Form value`],
|
|
134
134
|
});
|
|
135
135
|
/**
|
|
136
136
|
* Works with a tuple
|
|
@@ -142,13 +142,13 @@ const TUI_DOC_DEMO_TEXTS = new InjectionToken('tui-doc-demo i18n texts', {
|
|
|
142
142
|
* @string message for tooltip about ng-polymorpheus
|
|
143
143
|
* ]
|
|
144
144
|
*/
|
|
145
|
-
const TUI_DOC_DOCUMENTATION_TEXTS = new InjectionToken(
|
|
145
|
+
const TUI_DOC_DOCUMENTATION_TEXTS = new InjectionToken(`tui-doc-documentation i18n texts`, {
|
|
146
146
|
factory: () => [
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
`Argument`,
|
|
148
|
+
`Type`,
|
|
149
|
+
`Name and description`,
|
|
150
|
+
`Value`,
|
|
151
|
+
`Learn about our dynamic templates from `,
|
|
152
152
|
],
|
|
153
153
|
});
|
|
154
154
|
/**
|
|
@@ -159,20 +159,20 @@ const TUI_DOC_DOCUMENTATION_TEXTS = new InjectionToken('tui-doc-documentation i1
|
|
|
159
159
|
* @string link to a sample copied message label
|
|
160
160
|
* ]
|
|
161
161
|
*/
|
|
162
|
-
const TUI_DOC_EXAMPLE_TEXTS = new InjectionToken(
|
|
163
|
-
factory: () => [
|
|
162
|
+
const TUI_DOC_EXAMPLE_TEXTS = new InjectionToken(`tui-doc-example i18n texts`, {
|
|
163
|
+
factory: () => [`Preview`, `Link to a sample was successfully copied`, `Done`],
|
|
164
164
|
});
|
|
165
|
-
const TUI_DOC_MENU_TEXT = new InjectionToken(
|
|
166
|
-
factory: () =>
|
|
165
|
+
const TUI_DOC_MENU_TEXT = new InjectionToken(`menu i18n text`, {
|
|
166
|
+
factory: () => `Menu`,
|
|
167
167
|
});
|
|
168
|
-
const TUI_DOC_SEARCH_TEXT = new InjectionToken(
|
|
169
|
-
factory: () =>
|
|
168
|
+
const TUI_DOC_SEARCH_TEXT = new InjectionToken(`search i18n text`, {
|
|
169
|
+
factory: () => `Search`,
|
|
170
170
|
});
|
|
171
|
-
const TUI_DOC_SEE_ALSO_TEXT = new InjectionToken(
|
|
172
|
-
factory: () =>
|
|
171
|
+
const TUI_DOC_SEE_ALSO_TEXT = new InjectionToken(`tui-doc-see-also i18n text`, {
|
|
172
|
+
factory: () => `See also`,
|
|
173
173
|
});
|
|
174
|
-
const TUI_DOC_SOURCE_CODE_TEXT = new InjectionToken(
|
|
175
|
-
factory: () =>
|
|
174
|
+
const TUI_DOC_SOURCE_CODE_TEXT = new InjectionToken(`tui-doc-source-code i18n text`, {
|
|
175
|
+
factory: () => `Source code`,
|
|
176
176
|
});
|
|
177
177
|
|
|
178
178
|
var TuiDocDemoComponent_1;
|
|
@@ -188,14 +188,14 @@ let TuiDocDemoComponent = TuiDocDemoComponent_1 = class TuiDocDemoComponent {
|
|
|
188
188
|
this.wrapperWidth = 0;
|
|
189
189
|
this.control = null;
|
|
190
190
|
this.template = null;
|
|
191
|
-
this.updateOnVariants = [
|
|
192
|
-
this.updateOn =
|
|
191
|
+
this.updateOnVariants = [`change`, `blur`, `submit`];
|
|
192
|
+
this.updateOn = `change`;
|
|
193
193
|
this.expanded = false;
|
|
194
194
|
this.opaque = true;
|
|
195
195
|
this.modeControl = new FormControl();
|
|
196
196
|
this.mode = null;
|
|
197
197
|
this.change$ = new Subject();
|
|
198
|
-
this.items = [
|
|
198
|
+
this.items = [`onLight`, `onDark`];
|
|
199
199
|
this.isBrowser = isPlatformBrowser(platformId);
|
|
200
200
|
const parsedMode = locationRef.path().match(/tuiMode=(onDark|onLight)/);
|
|
201
201
|
if (parsedMode !== null && parsedMode.length > 0) {
|
|
@@ -226,9 +226,9 @@ let TuiDocDemoComponent = TuiDocDemoComponent_1 = class TuiDocDemoComponent {
|
|
|
226
226
|
}
|
|
227
227
|
const paddingLeft = this.isBrowser
|
|
228
228
|
? getComputedStyle(this.content.nativeElement).paddingLeft
|
|
229
|
-
:
|
|
229
|
+
: `0`;
|
|
230
230
|
const { offsetWidth } = this.content.nativeElement;
|
|
231
|
-
this.resizerText.nativeElement.textContent = String(offsetWidth - parseInt(paddingLeft ||
|
|
231
|
+
this.resizerText.nativeElement.textContent = String(offsetWidth - parseInt(paddingLeft || `0`, 10) * 2);
|
|
232
232
|
}
|
|
233
233
|
onDragStart(event) {
|
|
234
234
|
event.preventDefault();
|
|
@@ -261,7 +261,7 @@ let TuiDocDemoComponent = TuiDocDemoComponent_1 = class TuiDocDemoComponent {
|
|
|
261
261
|
if (!this.wrapper) {
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
|
-
this.renderer.setStyle(this.wrapper.nativeElement,
|
|
264
|
+
this.renderer.setStyle(this.wrapper.nativeElement, `width`, px(Math.max(this.wrapperWidth - delta, MIN_COMPONENT_WIDTH)));
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
267
|
TuiDocDemoComponent.ctorParameters = () => [
|
|
@@ -274,13 +274,13 @@ TuiDocDemoComponent.ctorParameters = () => [
|
|
|
274
274
|
{ type: Array, decorators: [{ type: Inject, args: [TUI_DOC_DEMO_TEXTS,] }] }
|
|
275
275
|
];
|
|
276
276
|
__decorate([
|
|
277
|
-
ViewChild(
|
|
277
|
+
ViewChild(`content`)
|
|
278
278
|
], TuiDocDemoComponent.prototype, "content", void 0);
|
|
279
279
|
__decorate([
|
|
280
|
-
ViewChild(
|
|
280
|
+
ViewChild(`wrapper`)
|
|
281
281
|
], TuiDocDemoComponent.prototype, "wrapper", void 0);
|
|
282
282
|
__decorate([
|
|
283
|
-
ViewChild(
|
|
283
|
+
ViewChild(`resizerText`)
|
|
284
284
|
], TuiDocDemoComponent.prototype, "resizerText", void 0);
|
|
285
285
|
__decorate([
|
|
286
286
|
Input()
|
|
@@ -289,11 +289,11 @@ __decorate([
|
|
|
289
289
|
ContentChild(TemplateRef)
|
|
290
290
|
], TuiDocDemoComponent.prototype, "template", void 0);
|
|
291
291
|
__decorate([
|
|
292
|
-
HostListener(
|
|
292
|
+
HostListener(`window:resize`)
|
|
293
293
|
], TuiDocDemoComponent.prototype, "onResize", null);
|
|
294
294
|
TuiDocDemoComponent = TuiDocDemoComponent_1 = __decorate([
|
|
295
295
|
Component({
|
|
296
|
-
selector:
|
|
296
|
+
selector: `tui-doc-demo`,
|
|
297
297
|
template: "<div\n class=\"t-bg-toggle\"\n [tuiMode]=\"null\"\n>\n <ng-template #tooltip>\n {{ texts[0] }}\n <a\n tuiLink\n tuiMode=\"onDark\"\n routerLink=\"/directives/mode\"\n >\n <code>tuiMode</code>\n </a>\n </ng-template>\n <ng-container *ngIf=\"isMobile; else desktop\">\n <tui-select\n tuiTextfieldSize=\"s\"\n class=\"t-mode\"\n [tuiTextfieldCleaner]=\"true\"\n [tuiHintContent]=\"tooltip\"\n [formControl]=\"modeControl\"\n >\n tuiMode\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"items\"\n ></tui-data-list-wrapper>\n </tui-select>\n </ng-container>\n <ng-template #desktop>\n tuiMode:\n <tui-tooltip\n describeId=\"form\"\n [content]=\"tooltip\"\n ></tui-tooltip>\n <div\n tuiGroup\n class=\"t-group\"\n [collapsed]=\"true\"\n >\n <tui-radio-block\n size=\"s\"\n nativeId=\"form\"\n class=\"tui-group__auto-width-item\"\n [item]=\"null\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n null\n </tui-radio-block>\n <tui-radio-block\n item=\"onDark\"\n size=\"s\"\n nativeId=\"form\"\n class=\"tui-group__auto-width-item\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n onDark\n </tui-radio-block>\n <tui-radio-block\n item=\"onLight\"\n size=\"s\"\n nativeId=\"form\"\n class=\"tui-group__auto-width-item\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n onLight\n </tui-radio-block>\n </div>\n </ng-template>\n <tui-checkbox-labeled\n size=\"m\"\n class=\"t-checkbox\"\n [(ngModel)]=\"opaque\"\n >\n {{ texts[1] }}\n </tui-checkbox-labeled>\n</div>\n<div\n #wrapper\n class=\"t-wrapper\"\n [class.t-wrapper_dark]=\"modeControl.value === 'onDark'\"\n [class.t-wrapper_gray]=\"modeControl.value === 'onLight'\"\n [class.t-wrapper_transparent]=\"!opaque\"\n>\n <div\n #content\n id=\"demoContent\"\n class=\"t-content\"\n >\n <form\n *ngIf=\"testForm\"\n class=\"t-form\"\n [formGroup]=\"testForm\"\n >\n <div class=\"t-input-wrapper\">\n <ng-container [ngTemplateOutlet]=\"template\"></ng-container>\n </div>\n <button\n tuiButton\n type=\"button\"\n size=\"s\"\n class=\"t-button\"\n [iconRight]=\"icon\"\n (click)=\"toggleDetails()\"\n >\n {{ texts[2] }}\n </button>\n <ng-template #icon>\n <tui-svg\n src=\"tuiIconChevronDown\"\n class=\"t-icon\"\n [class.t-icon_rotated]=\"expanded\"\n ></tui-svg>\n </ng-template>\n <tui-expand\n class=\"t-expand\"\n [expanded]=\"expanded\"\n >\n <ng-template tuiExpandContent>\n <pre class=\"t-value\">Form data: {{ testForm.value | json }}</pre>\n <div\n tuiGroup\n class=\"t-form-controls\"\n >\n <tui-select\n tuiTextfieldSize=\"s\"\n class=\"t-select\"\n [ngModel]=\"updateOn\"\n [ngModelOptions]=\"{standalone: true}\"\n (ngModelChange)=\"updateOnChange($event)\"\n >\n updateOn\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"updateOnVariants\"\n ></tui-data-list-wrapper>\n </tui-select>\n <button\n tuiButton\n type=\"reset\"\n size=\"s\"\n class=\"tui-group__auto-width-item\"\n >\n Reset\n </button>\n <button\n tuiButton\n type=\"submit\"\n size=\"s\"\n class=\"tui-group__auto-width-item\"\n >\n Submit\n </button>\n </div>\n </ng-template>\n </tui-expand>\n </form>\n <ng-content></ng-content>\n </div>\n <button\n tabindex=\"-1\"\n class=\"t-resizer\"\n (tuiDragStart)=\"onDragStart($event)\"\n (tuiDragContinues)=\"onDragContinues($event)\"\n (tuiDragEnd)=\"onDragEnd()\"\n >\n <span\n #resizerText\n class=\"t-resizer-text\"\n ></span>\n </button>\n</div>\n",
|
|
298
298
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
299
299
|
providers: [
|
|
@@ -351,7 +351,7 @@ TuiDocDemoModule = __decorate([
|
|
|
351
351
|
*/
|
|
352
352
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
353
353
|
function rgbToHex(r, g, b) {
|
|
354
|
-
return `#${[r, g, b].map(x => x.toString(16).padStart(2,
|
|
354
|
+
return `#${[r, g, b].map(x => x.toString(16).padStart(2, `0`)).join(``)}`;
|
|
355
355
|
}
|
|
356
356
|
const tuiRgbToHex = rgbToHex;
|
|
357
357
|
/**
|
|
@@ -360,10 +360,10 @@ const tuiRgbToHex = rgbToHex;
|
|
|
360
360
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
361
361
|
function hexToRgb(hex) {
|
|
362
362
|
const matches = hex
|
|
363
|
-
.replace(
|
|
364
|
-
.split(
|
|
363
|
+
.replace(`#`, ``)
|
|
364
|
+
.split(``)
|
|
365
365
|
.map((char, _, array) => (array.length === 3 ? char + char : char))
|
|
366
|
-
.join(
|
|
366
|
+
.join(``)
|
|
367
367
|
.match(/.{2}/g);
|
|
368
368
|
return matches
|
|
369
369
|
? matches.map(x => Number.parseInt(x, 16))
|
|
@@ -373,18 +373,18 @@ const tuiHexToRgb = hexToRgb;
|
|
|
373
373
|
|
|
374
374
|
function inspectArray(array, depth) {
|
|
375
375
|
if (depth === 0) {
|
|
376
|
-
return
|
|
376
|
+
return `[…]`;
|
|
377
377
|
}
|
|
378
|
-
let result =
|
|
378
|
+
let result = ``;
|
|
379
379
|
let first = true;
|
|
380
380
|
for (let index = 0; index < array.length; index++) {
|
|
381
381
|
if (first) {
|
|
382
382
|
first = false;
|
|
383
383
|
}
|
|
384
384
|
else {
|
|
385
|
-
result +=
|
|
385
|
+
result += `, `;
|
|
386
386
|
}
|
|
387
|
-
result += index in array ? inspectAny(array[index], depth - 1) :
|
|
387
|
+
result += index in array ? inspectAny(array[index], depth - 1) : `empty`;
|
|
388
388
|
}
|
|
389
389
|
return `[${result}]`;
|
|
390
390
|
}
|
|
@@ -392,7 +392,7 @@ function inspectObject(object, depth) {
|
|
|
392
392
|
if (depth === 0) {
|
|
393
393
|
return `{…}`;
|
|
394
394
|
}
|
|
395
|
-
let result =
|
|
395
|
+
let result = ``;
|
|
396
396
|
let first = true;
|
|
397
397
|
for (const key in object) {
|
|
398
398
|
if (!object.hasOwnProperty(key)) {
|
|
@@ -402,7 +402,7 @@ function inspectObject(object, depth) {
|
|
|
402
402
|
first = false;
|
|
403
403
|
}
|
|
404
404
|
else {
|
|
405
|
-
result +=
|
|
405
|
+
result += `, `;
|
|
406
406
|
}
|
|
407
407
|
result += `${key}: ${inspectAny(object[key], depth - 1)}`;
|
|
408
408
|
}
|
|
@@ -418,15 +418,15 @@ function inspectObject(object, depth) {
|
|
|
418
418
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
419
419
|
function inspectAny(data, depth) {
|
|
420
420
|
if (data === null) {
|
|
421
|
-
return
|
|
421
|
+
return `null`;
|
|
422
422
|
}
|
|
423
423
|
switch (typeof data) {
|
|
424
|
-
case
|
|
424
|
+
case `string`:
|
|
425
425
|
return `'${data}'`;
|
|
426
|
-
case
|
|
427
|
-
case
|
|
428
|
-
case
|
|
429
|
-
case
|
|
426
|
+
case `undefined`:
|
|
427
|
+
case `number`:
|
|
428
|
+
case `boolean`:
|
|
429
|
+
case `function`:
|
|
430
430
|
return String(data);
|
|
431
431
|
}
|
|
432
432
|
if (data instanceof RegExp) {
|
|
@@ -449,7 +449,7 @@ function coerceValue(value) {
|
|
|
449
449
|
return null;
|
|
450
450
|
}
|
|
451
451
|
else if (isBooleanParamValue(prepared)) {
|
|
452
|
-
return String(prepared) ===
|
|
452
|
+
return String(prepared) === `true`;
|
|
453
453
|
}
|
|
454
454
|
else if (isNumberParamValue(prepared)) {
|
|
455
455
|
return Number(prepared);
|
|
@@ -466,10 +466,10 @@ function coerceValue(value) {
|
|
|
466
466
|
}
|
|
467
467
|
const tuiCoerceValue = coerceValue;
|
|
468
468
|
function isEmptyParamValue(value) {
|
|
469
|
-
return [
|
|
469
|
+
return [`undefined`, `null`, `NaN`, `Infinity`].includes(value);
|
|
470
470
|
}
|
|
471
471
|
function isBooleanParamValue(value) {
|
|
472
|
-
return value ===
|
|
472
|
+
return value === `true` || value === `false`;
|
|
473
473
|
}
|
|
474
474
|
function isNumberParamValue(value) {
|
|
475
475
|
// TODO: investigate to disallow potentially catastrophic exponential-time regular expressions.
|
|
@@ -477,13 +477,13 @@ function isNumberParamValue(value) {
|
|
|
477
477
|
return /^-?[\d.]+(?:e-?\d+)?$/.test(value);
|
|
478
478
|
}
|
|
479
479
|
function isPossibleArray(value) {
|
|
480
|
-
return value.startsWith(
|
|
480
|
+
return value.startsWith(`[`) && value.endsWith(`]`);
|
|
481
481
|
}
|
|
482
482
|
function isPossibleObject(value) {
|
|
483
|
-
return value.startsWith(
|
|
483
|
+
return value.startsWith(`{`) && value.endsWith(`}`);
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
-
const SERIALIZED_SUFFIX =
|
|
486
|
+
const SERIALIZED_SUFFIX = `$`;
|
|
487
487
|
// @bad TODO: refactor output and value sync
|
|
488
488
|
let TuiDocDocumentationPropertyConnectorDirective = class TuiDocDocumentationPropertyConnectorDirective {
|
|
489
489
|
constructor(template, locationRef, activatedRoute, urlSerializer) {
|
|
@@ -491,9 +491,9 @@ let TuiDocDocumentationPropertyConnectorDirective = class TuiDocDocumentationPro
|
|
|
491
491
|
this.locationRef = locationRef;
|
|
492
492
|
this.activatedRoute = activatedRoute;
|
|
493
493
|
this.urlSerializer = urlSerializer;
|
|
494
|
-
this.documentationPropertyName =
|
|
494
|
+
this.documentationPropertyName = ``;
|
|
495
495
|
this.documentationPropertyMode = null;
|
|
496
|
-
this.documentationPropertyType =
|
|
496
|
+
this.documentationPropertyType = ``;
|
|
497
497
|
this.documentationPropertyDeprecated = false;
|
|
498
498
|
this.documentationPropertyValues = null;
|
|
499
499
|
this.documentationPropertyValueChange = new EventEmitter();
|
|
@@ -505,11 +505,11 @@ let TuiDocDocumentationPropertyConnectorDirective = class TuiDocDocumentationPro
|
|
|
505
505
|
}
|
|
506
506
|
get attrName() {
|
|
507
507
|
switch (this.documentationPropertyMode) {
|
|
508
|
-
case
|
|
508
|
+
case `input`:
|
|
509
509
|
return `[${this.documentationPropertyName}]`;
|
|
510
|
-
case
|
|
510
|
+
case `output`:
|
|
511
511
|
return `(${this.documentationPropertyName})`;
|
|
512
|
-
case
|
|
512
|
+
case `input-output`:
|
|
513
513
|
return `[(${this.documentationPropertyName})]`;
|
|
514
514
|
default:
|
|
515
515
|
return this.documentationPropertyName;
|
|
@@ -519,7 +519,7 @@ let TuiDocDocumentationPropertyConnectorDirective = class TuiDocDocumentationPro
|
|
|
519
519
|
return !!this.documentationPropertyValues;
|
|
520
520
|
}
|
|
521
521
|
get shouldShowValues() {
|
|
522
|
-
return this.documentationPropertyMode !==
|
|
522
|
+
return this.documentationPropertyMode !== `output`;
|
|
523
523
|
}
|
|
524
524
|
ngOnChanges() {
|
|
525
525
|
this.changed$.next();
|
|
@@ -551,7 +551,7 @@ let TuiDocDocumentationPropertyConnectorDirective = class TuiDocDocumentationPro
|
|
|
551
551
|
const computedValue = isValueAvailableByKey && this.documentationPropertyValues
|
|
552
552
|
? this.documentationPropertyValues.indexOf(value)
|
|
553
553
|
: value;
|
|
554
|
-
const suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX :
|
|
554
|
+
const suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX : ``;
|
|
555
555
|
const propName = this.documentationPropertyName + suffix;
|
|
556
556
|
tree.queryParams = Object.assign(Object.assign({}, tree.queryParams), { [propName]: computedValue });
|
|
557
557
|
this.locationRef.go(String(tree));
|
|
@@ -586,8 +586,8 @@ __decorate([
|
|
|
586
586
|
], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValueChange", void 0);
|
|
587
587
|
TuiDocDocumentationPropertyConnectorDirective = __decorate([
|
|
588
588
|
Directive({
|
|
589
|
-
selector:
|
|
590
|
-
exportAs:
|
|
589
|
+
selector: `ng-template[documentationPropertyName]`,
|
|
590
|
+
exportAs: `documentationProperty`,
|
|
591
591
|
}),
|
|
592
592
|
__param(0, Inject(TemplateRef)),
|
|
593
593
|
__param(1, Inject(Location$1)),
|
|
@@ -602,7 +602,7 @@ let TuiDocDocumentationComponent = class TuiDocDocumentationComponent {
|
|
|
602
602
|
constructor(changeDetectorRef, texts) {
|
|
603
603
|
this.changeDetectorRef = changeDetectorRef;
|
|
604
604
|
this.texts = texts;
|
|
605
|
-
this.heading =
|
|
605
|
+
this.heading = ``;
|
|
606
606
|
this.showValues = true;
|
|
607
607
|
this.isAPI = false;
|
|
608
608
|
this.propertiesConnectors = EMPTY_QUERY;
|
|
@@ -619,71 +619,71 @@ let TuiDocDocumentationComponent = class TuiDocDocumentationComponent {
|
|
|
619
619
|
getColor(color) {
|
|
620
620
|
if (color.length === 4) {
|
|
621
621
|
return color
|
|
622
|
-
.split(
|
|
622
|
+
.split(``)
|
|
623
623
|
.reduce((result, current) => [...result, current, current], [])
|
|
624
|
-
.join(
|
|
625
|
-
.replace(
|
|
624
|
+
.join(``)
|
|
625
|
+
.replace(`#`, ``);
|
|
626
626
|
}
|
|
627
|
-
if (color.startsWith(
|
|
627
|
+
if (color.startsWith(`#`)) {
|
|
628
628
|
return color;
|
|
629
629
|
}
|
|
630
|
-
if (color ===
|
|
631
|
-
return
|
|
630
|
+
if (color === `transparent`) {
|
|
631
|
+
return `#000000`;
|
|
632
632
|
}
|
|
633
633
|
const parsed = color
|
|
634
|
-
.replace(
|
|
635
|
-
.replace(
|
|
636
|
-
.replace(
|
|
637
|
-
.replace(
|
|
638
|
-
.split(
|
|
634
|
+
.replace(`rgb(`, ``)
|
|
635
|
+
.replace(`rgba(`, ``)
|
|
636
|
+
.replace(`)`, ``)
|
|
637
|
+
.replace(` `, ``)
|
|
638
|
+
.split(`,`)
|
|
639
639
|
.map(v => Number.parseInt(v, 10));
|
|
640
640
|
return rgbToHex(...parsed);
|
|
641
641
|
}
|
|
642
642
|
getOpacity(color) {
|
|
643
|
-
if (color.startsWith(
|
|
643
|
+
if (color.startsWith(`#`) || color.startsWith(`rgb(`)) {
|
|
644
644
|
return 100;
|
|
645
645
|
}
|
|
646
|
-
if (color ===
|
|
646
|
+
if (color === `transparent`) {
|
|
647
647
|
return 0;
|
|
648
648
|
}
|
|
649
|
-
const lastComma = color.lastIndexOf(
|
|
649
|
+
const lastComma = color.lastIndexOf(`,`);
|
|
650
650
|
const parsed = color
|
|
651
651
|
.slice(lastComma)
|
|
652
|
-
.replace(
|
|
653
|
-
.replace(
|
|
654
|
-
.replace(
|
|
652
|
+
.replace(`)`, ``)
|
|
653
|
+
.replace(` `, ``)
|
|
654
|
+
.replace(`,`, ``);
|
|
655
655
|
return Math.round(Number.parseFloat(parsed) * 100);
|
|
656
656
|
}
|
|
657
657
|
onColorChange(connector, color) {
|
|
658
|
-
const opacity = this.getOpacity(connector.documentationPropertyValue ||
|
|
658
|
+
const opacity = this.getOpacity(connector.documentationPropertyValue || ``);
|
|
659
659
|
if (opacity === 100) {
|
|
660
660
|
connector.onValueChange(color);
|
|
661
661
|
return;
|
|
662
662
|
}
|
|
663
|
-
const rgb = hexToRgb(color).join(
|
|
663
|
+
const rgb = hexToRgb(color).join(`, `);
|
|
664
664
|
const result = `rgba(${rgb}, ${opacity / 100})`;
|
|
665
665
|
connector.onValueChange(result);
|
|
666
666
|
}
|
|
667
667
|
onOpacityChange(connector, opacity) {
|
|
668
|
-
const hex = this.getColor(connector.documentationPropertyValue ||
|
|
668
|
+
const hex = this.getColor(connector.documentationPropertyValue || ``);
|
|
669
669
|
const rgb = hexToRgb(hex);
|
|
670
670
|
const result = `rgba(${rgb}, ${opacity / 100})`;
|
|
671
671
|
connector.onValueChange(result);
|
|
672
672
|
}
|
|
673
673
|
stripOptional(name) {
|
|
674
|
-
return name.replace(
|
|
674
|
+
return name.replace(`?`, ``);
|
|
675
675
|
}
|
|
676
676
|
isOptional(name) {
|
|
677
|
-
return name.includes(
|
|
677
|
+
return name.includes(`?`);
|
|
678
678
|
}
|
|
679
679
|
isPrimitivePolymorpheusContent(value) {
|
|
680
|
-
return typeof value ===
|
|
680
|
+
return typeof value === `string` || typeof value === `number`;
|
|
681
681
|
}
|
|
682
682
|
showCleaner(type) {
|
|
683
|
-
return type.includes(
|
|
683
|
+
return type.includes(`null`);
|
|
684
684
|
}
|
|
685
685
|
showContentTooltip(type) {
|
|
686
|
-
return type.includes(
|
|
686
|
+
return type.includes(`PolymorpheusContent`);
|
|
687
687
|
}
|
|
688
688
|
inspectAny(data) {
|
|
689
689
|
return inspectAny(data, 2);
|
|
@@ -707,12 +707,12 @@ __decorate([
|
|
|
707
707
|
], TuiDocDocumentationComponent.prototype, "propertiesConnectors", void 0);
|
|
708
708
|
TuiDocDocumentationComponent = __decorate([
|
|
709
709
|
Component({
|
|
710
|
-
selector:
|
|
710
|
+
selector: `tui-doc-documentation`,
|
|
711
711
|
template: "<h1\n *ngIf=\"heading\"\n class=\"t-heading\"\n>\n {{ heading }}\n</h1>\n<ng-content></ng-content>\n<table class=\"t-table\">\n <tr class=\"t-row t-row_header\">\n <th class=\"t-th t-cell t-cell_prop\">{{ texts[2] }}</th>\n <th class=\"t-th\">{{ type }}</th>\n <th\n *ngIf=\"showValues && !isAPI\"\n class=\"t-th t-cell t-cell_value\"\n >\n {{ texts[3] }}\n </th>\n </tr>\n <tr\n *ngFor=\"let propertyConnector of propertiesConnectors\"\n class=\"t-row\"\n [class.t-deprecated]=\"propertyConnector.documentationPropertyDeprecated\"\n >\n <td class=\"t-cell\">\n <div\n automation-id=\"tui-documentation__property-name\"\n class=\"t-property\"\n >\n {{ stripOptional(propertyConnector.attrName) }}\n <tui-badge\n *ngIf=\"isOptional(propertyConnector.attrName)\"\n size=\"s\"\n value=\"Optional\"\n ></tui-badge>\n </div>\n <span\n *ngIf=\"propertyConnector.documentationPropertyDeprecated\"\n class=\"t-deprecated-label\"\n >\n deprecated\n </span>\n <ng-container [ngTemplateOutlet]=\"propertyConnector.template\"></ng-container>\n </td>\n <td class=\"t-cell\">\n <span class=\"type\">\n {{ propertyConnector.documentationPropertyType }}\n <tui-tooltip\n *ngIf=\"showContentTooltip(propertyConnector.documentationPropertyType)\"\n [describeId]=\"propertyConnector.attrName\"\n [content]=\"content\"\n >\n <ng-template #content>\n {{ texts[4] }}\n <a\n tuiLink\n tuiMode=\"onDark\"\n target=\"_blank\"\n href=\"https://github.com/tinkoff/ng-polymorpheus\"\n >\n <code>ng-polymorpheus</code>\n </a>\n </ng-template>\n </tui-tooltip>\n </span>\n </td>\n <td\n *ngIf=\"showValues\"\n class=\"t-cell\"\n >\n <ng-container *ngIf=\"propertyConnector.shouldShowValues; else elseEmitter\">\n <tui-select\n *ngIf=\"propertyConnector.hasItems; else noItems\"\n tuiTextfieldSize=\"m\"\n tuiDropdownLimitWidth=\"min\"\n [tuiTextfieldCleaner]=\"showCleaner(propertyConnector.documentationPropertyType)\"\n [tuiTextfieldLabelOutside]=\"true\"\n [nativeId]=\"propertyConnector.attrName\"\n [valueContent]=\"selectContent\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n >\n <code class=\"t-exception\">null</code>\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"propertyConnector.documentationPropertyValues\"\n [itemContent]=\"selectContent\"\n ></tui-data-list-wrapper>\n </tui-select>\n <ng-template\n #selectContent\n let-data\n >\n <code>{{ inspectAny(data) }}</code>\n </ng-template>\n\n <ng-template #noItems>\n <ng-container [ngSwitch]=\"propertyConnector.documentationPropertyType\">\n <tui-toggle\n *ngSwitchCase=\"'boolean'\"\n size=\"l\"\n [nativeId]=\"propertyConnector.attrName\"\n [showIcons]=\"true\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-toggle>\n\n <tui-primitive-textfield\n *ngSwitchCase=\"'string'\"\n tuiTextfieldSize=\"m\"\n [nativeId]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [tuiTextfieldCleaner]=\"true\"\n [value]=\"propertyConnector.documentationPropertyValue || ''\"\n (valueChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-primitive-textfield>\n\n <div\n *ngSwitchCase=\"'color'\"\n tuiGroup\n >\n <tui-primitive-textfield\n tuiTextfieldType=\"text\"\n tuiTextfieldSize=\"m\"\n [attr.id]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [tuiInputOpacity]=\"getOpacity(propertyConnector.documentationPropertyValue)\"\n [value]=\"getColor(propertyConnector.documentationPropertyValue)\"\n (valueChange)=\"onColorChange(propertyConnector, $event)\"\n ></tui-primitive-textfield>\n <tui-input-count\n tuiTextfieldSize=\"m\"\n [max]=\"100\"\n [ngModel]=\"getOpacity(propertyConnector.documentationPropertyValue)\"\n (ngModelChange)=\"onOpacityChange(propertyConnector, $event)\"\n >\n Opacity\n </tui-input-count>\n </div>\n\n <tui-input-count\n *ngSwitchCase=\"'number'\"\n tuiTextfieldSize=\"m\"\n [nativeId]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-input-count>\n\n <ng-container *ngSwitchCase=\"'PolymorpheusContent'\">\n <tui-primitive-textfield\n *ngIf=\"isPrimitivePolymorpheusContent(propertyConnector.documentationPropertyValue)\"\n tuiTextfieldSize=\"m\"\n [nativeId]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [tuiTextfieldCleaner]=\"true\"\n [value]=\"propertyConnector.documentationPropertyValue.toString()\"\n (valueChange)=\"propertyConnector.onValueChange($event)\"\n >\n Default content\n </tui-primitive-textfield>\n </ng-container>\n </ng-container>\n </ng-template>\n </ng-container>\n\n <ng-template #elseEmitter>\n <tui-notification\n class=\"t-output\"\n [@emitEvent]=\"propertyConnector.emits$ | async\"\n >\n Emit!\n </tui-notification>\n </ng-template>\n </td>\n </tr>\n</table>\n",
|
|
712
712
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
713
713
|
animations: [
|
|
714
|
-
trigger(
|
|
715
|
-
transition(
|
|
714
|
+
trigger(`emitEvent`, [
|
|
715
|
+
transition(`:increment`, [style({ opacity: 1 }), animate(`500ms ease-in`)]),
|
|
716
716
|
]),
|
|
717
717
|
],
|
|
718
718
|
styles: [":host{display:block;min-width:100%}.t-table{width:100%;table-layout:fixed}.t-row:not(:last-child){border-bottom:1px solid var(--tui-base-03)}:host-context(tui-root._mobile) .t-row{display:flex;flex-wrap:wrap}:host-context(tui-root._mobile) .t-row_header{display:none}.t-cell{padding:1rem 1rem .875rem}.t-cell:first-child{padding-left:0}.t-cell:last-child{padding-right:0;text-align:right}.t-cell_prop{width:40%}.t-cell_value{max-width:20rem}:host-context(tui-root._mobile) .t-cell_value{width:9.375rem}:host-context(tui-root._mobile) .t-cell{width:100%;height:auto;padding:.5rem 0;text-align:left}.t-th{padding:.5rem 1rem;color:var(--tui-text-02);font-weight:400;text-align:left}.t-property{font:var(--tui-font-text-m);margin-bottom:.25rem;font-family:monospace;color:#8f75d1}:host-context(tui-root._mobile) .t-property{padding:.5rem 0}.t-type{font-family:monospace}.t-deprecated{background-color:var(--tui-error-bg);box-shadow:-1rem 0 var(--tui-error-bg),1rem 0 var(--tui-error-bg)}.t-deprecated-label{margin-right:.125rem;color:var(--tui-error-fill)}.t-exception{display:block;width:-webkit-max-content;width:-moz-max-content;width:max-content}.t-output{text-align:left;opacity:0}.t-heading{font:var(--tui-font-heading-4)}"]
|
|
@@ -729,7 +729,7 @@ let TuiInputOpacityDirective = class TuiInputOpacityDirective {
|
|
|
729
729
|
set tuiInputOpacity(opacity) {
|
|
730
730
|
const { nativeFocusableElement } = this.tuiFocusableComponent;
|
|
731
731
|
if (nativeFocusableElement) {
|
|
732
|
-
this.renderer.setStyle(nativeFocusableElement,
|
|
732
|
+
this.renderer.setStyle(nativeFocusableElement, `opacity`, opacity / 100);
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
735
|
};
|
|
@@ -742,7 +742,7 @@ __decorate([
|
|
|
742
742
|
], TuiInputOpacityDirective.prototype, "tuiInputOpacity", null);
|
|
743
743
|
TuiInputOpacityDirective = __decorate([
|
|
744
744
|
Directive({
|
|
745
|
-
selector:
|
|
745
|
+
selector: `[tuiInputOpacity]`,
|
|
746
746
|
}),
|
|
747
747
|
__param(0, Inject(Renderer2)),
|
|
748
748
|
__param(1, Inject(TUI_FOCUSABLE_ITEM_ACCESSOR))
|
|
@@ -793,13 +793,13 @@ TuiDocDocumentationModule = __decorate([
|
|
|
793
793
|
})
|
|
794
794
|
], TuiDocDocumentationModule);
|
|
795
795
|
|
|
796
|
-
const TUI_DOC_CODE_ACTIONS = new InjectionToken(
|
|
797
|
-
factory: () =>
|
|
796
|
+
const TUI_DOC_CODE_ACTIONS = new InjectionToken(`Code actions for the opened tab with code example`, {
|
|
797
|
+
factory: () => ``,
|
|
798
798
|
});
|
|
799
799
|
|
|
800
|
-
const TUI_DOC_CODE_EDITOR = new InjectionToken(
|
|
800
|
+
const TUI_DOC_CODE_EDITOR = new InjectionToken(`Contains service for opening online IDE e.g. Stackblitz`);
|
|
801
801
|
|
|
802
|
-
const TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = new InjectionToken(
|
|
802
|
+
const TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = new InjectionToken(`Processes content in example`, { factory: () => identity });
|
|
803
803
|
|
|
804
804
|
/**
|
|
805
805
|
* @deprecated: use {@link tuiRawLoadRecord} instead
|
|
@@ -821,7 +821,7 @@ const tuiRawLoadRecord = rawLoadRecord;
|
|
|
821
821
|
// Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
|
|
822
822
|
// @dynamic
|
|
823
823
|
let TuiDocExampleComponent = class TuiDocExampleComponent {
|
|
824
|
-
constructor(id, clipboard, notifications, location, copyTexts$, texts, codeEditor, processContent, isCypress, codeActions) {
|
|
824
|
+
constructor(id, clipboard, notifications, location, copyTexts$, texts, codeEditor, processContent, isCypress, codeActions, router, route, ngLocation) {
|
|
825
825
|
this.id = id;
|
|
826
826
|
this.clipboard = clipboard;
|
|
827
827
|
this.notifications = notifications;
|
|
@@ -832,9 +832,12 @@ let TuiDocExampleComponent = class TuiDocExampleComponent {
|
|
|
832
832
|
this.processContent = processContent;
|
|
833
833
|
this.isCypress = isCypress;
|
|
834
834
|
this.codeActions = codeActions;
|
|
835
|
+
this.router = router;
|
|
836
|
+
this.route = route;
|
|
837
|
+
this.ngLocation = ngLocation;
|
|
835
838
|
this.rawLoader$$ = new BehaviorSubject({});
|
|
836
|
-
this.heading =
|
|
837
|
-
this.description =
|
|
839
|
+
this.heading = ``;
|
|
840
|
+
this.description = ``;
|
|
838
841
|
this.componentName = this.location.pathname.slice(1);
|
|
839
842
|
this.defaultTabIndex = 0;
|
|
840
843
|
this.defaultTab = this.texts[this.defaultTabIndex];
|
|
@@ -847,11 +850,12 @@ let TuiDocExampleComponent = class TuiDocExampleComponent {
|
|
|
847
850
|
this.rawLoader$$.next(content);
|
|
848
851
|
}
|
|
849
852
|
copyExampleLink() {
|
|
850
|
-
const hashPosition = this.location.href.indexOf(
|
|
853
|
+
const hashPosition = this.location.href.indexOf(`#`);
|
|
851
854
|
const currentUrl = hashPosition > -1
|
|
852
855
|
? this.location.href.slice(0, Math.max(0, hashPosition))
|
|
853
856
|
: this.location.href;
|
|
854
857
|
const url = `${currentUrl}#${this.id}`;
|
|
858
|
+
this.setFragmentWithoutRedirect(this.id);
|
|
855
859
|
this.clipboard.copy(url);
|
|
856
860
|
this.notifications
|
|
857
861
|
.show(this.texts[1], {
|
|
@@ -863,11 +867,17 @@ let TuiDocExampleComponent = class TuiDocExampleComponent {
|
|
|
863
867
|
edit(files) {
|
|
864
868
|
var _a, _b;
|
|
865
869
|
this.loading$.next(true);
|
|
866
|
-
(_a = this.codeEditor) === null || _a === void 0 ? void 0 : _a.edit(this.componentName, (_b = this.id) !== null && _b !== void 0 ? _b :
|
|
870
|
+
(_a = this.codeEditor) === null || _a === void 0 ? void 0 : _a.edit(this.componentName, (_b = this.id) !== null && _b !== void 0 ? _b : ``, files).finally(() => this.loading$.next(false));
|
|
871
|
+
}
|
|
872
|
+
setFragmentWithoutRedirect(id) {
|
|
873
|
+
const url = this.router
|
|
874
|
+
.createUrlTree([], { relativeTo: this.route, fragment: id || `` })
|
|
875
|
+
.toString();
|
|
876
|
+
this.ngLocation.go(url);
|
|
867
877
|
}
|
|
868
878
|
};
|
|
869
879
|
TuiDocExampleComponent.ctorParameters = () => [
|
|
870
|
-
{ type: String, decorators: [{ type: Attribute, args: [
|
|
880
|
+
{ type: String, decorators: [{ type: Attribute, args: [`id`,] }] },
|
|
871
881
|
{ type: Clipboard, decorators: [{ type: Inject, args: [Clipboard,] }] },
|
|
872
882
|
{ type: TuiNotificationsService, decorators: [{ type: Inject, args: [TuiNotificationsService,] }] },
|
|
873
883
|
{ type: Location, decorators: [{ type: Inject, args: [LOCATION,] }] },
|
|
@@ -876,7 +886,10 @@ TuiDocExampleComponent.ctorParameters = () => [
|
|
|
876
886
|
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TUI_DOC_CODE_EDITOR,] }] },
|
|
877
887
|
{ type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_CONTENT_PROCESSOR,] }] },
|
|
878
888
|
{ type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_CYPRESS,] }] },
|
|
879
|
-
{ type: Array, decorators: [{ type: Inject, args: [TUI_DOC_CODE_ACTIONS,] }] }
|
|
889
|
+
{ type: Array, decorators: [{ type: Inject, args: [TUI_DOC_CODE_ACTIONS,] }] },
|
|
890
|
+
{ type: Router, decorators: [{ type: Inject, args: [Router,] }] },
|
|
891
|
+
{ type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] },
|
|
892
|
+
{ type: Location$1, decorators: [{ type: Inject, args: [Location$1,] }] }
|
|
880
893
|
];
|
|
881
894
|
__decorate([
|
|
882
895
|
Input()
|
|
@@ -892,12 +905,12 @@ __decorate([
|
|
|
892
905
|
], TuiDocExampleComponent.prototype, "componentName", void 0);
|
|
893
906
|
TuiDocExampleComponent = __decorate([
|
|
894
907
|
Component({
|
|
895
|
-
selector:
|
|
908
|
+
selector: `tui-doc-example`,
|
|
896
909
|
template: "<h3\n *ngIf=\"heading\"\n class=\"t-title\"\n>\n <span\n polymorpheus-outlet\n [content]=\"heading | tuiDocExampleCapitalize\"\n ></span>\n <button\n *ngIf=\"id\"\n tuiIconButton\n type=\"button\"\n size=\"xs\"\n icon=\"tuiIconLinkLarge\"\n appearance=\"icon\"\n class=\"t-link-icon\"\n [title]=\"copy$ | async\"\n (click)=\"copyExampleLink()\"\n ></button>\n</h3>\n<h4\n *ngIf=\"description\"\n polymorpheus-outlet\n class=\"t-description\"\n [content]=\"description | tuiDocExampleCapitalize\"\n></h4>\n\n<div\n *ngIf=\"processor$ | async as files\"\n class=\"t-example\"\n>\n <ng-container *ngIf=\"files | tuiDocExampleGetTabs: defaultTab as tabs\">\n <div class=\"t-tabs-wrapper\">\n <tui-tabs-with-more\n class=\"t-tabs\"\n [(activeItemIndex)]=\"activeItemIndex\"\n >\n <ng-container *ngFor=\"let tab of tabs\">\n <button\n *tuiTab\n tuiTab\n >\n {{ tab }}\n </button>\n </ng-container>\n </tui-tabs-with-more>\n\n <button\n *ngIf=\"codeEditor\"\n tuiButton\n appearance=\"flat\"\n size=\"s\"\n [showLoader]=\"!!(loading$ | async)\"\n (click)=\"edit(files)\"\n >\n Edit on {{ codeEditor.name }}\n </button>\n </div>\n\n <div\n *ngFor=\"let tab of tabs; let index = index\"\n class=\"t-content\"\n [class.t-content_animated]=\"!isCypress\"\n [class.t-content_visible]=\"activeItemIndex === index\"\n >\n <ng-container\n *ngIf=\"index === defaultTabIndex; else anotherTab\"\n [ngTemplateOutlet]=\"preview\"\n ></ng-container>\n <ng-template #anotherTab>\n <ng-container\n [ngTemplateOutlet]=\"codeSection\"\n [ngTemplateOutletContext]=\"{$implicit: files[tabs[activeItemIndex]] || ''}\"\n ></ng-container>\n </ng-template>\n </div>\n </ng-container>\n</div>\n\n<ng-template #preview>\n <div\n automation-id=\"tui-doc-example\"\n class=\"t-demo\"\n >\n <ng-content></ng-content>\n </div>\n</ng-template>\n\n<ng-template\n #codeSection\n let-code\n>\n <section class=\"t-code-actions\">\n <ng-container *ngFor=\"let action of codeActions\">\n <div\n polymorpheus-outlet\n [content]=\"action\"\n [context]=\"{$implicit: code}\"\n ></div>\n </ng-container>\n <tui-doc-copy [cdkCopyToClipboard]=\"code\"></tui-doc-copy>\n </section>\n <tui-doc-code [code]=\"code\"></tui-doc-code>\n</ng-template>\n",
|
|
897
910
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
898
911
|
styles: [":host{position:relative;display:block;padding-top:3.5rem;clear:right}:host :host-context(tui-root._mobile){padding-top:2rem}.t-title{font:var(--tui-font-heading-5);margin:0 0 .5rem}:host-context(tui-root._mobile) .t-title{font:var(--tui-font-heading-6)}.t-description{font:var(--tui-font-text-m);font-weight:400;margin:0}.t-example{position:relative;margin-top:1.5rem;border:1px solid var(--tui-base-03);border-radius:var(--tui-radius-m);box-shadow:0 .125rem .1875rem rgba(0,0,0,.1)}:host-context(tui-root._mobile) .t-example{margin-top:.75rem}.t-tabs-wrapper{display:flex;padding:0 2rem;box-shadow:inset 0 -1px var(--tui-base-03);justify-content:space-between;align-items:center}:host-context(tui-root._mobile) .t-tabs-wrapper{padding:0 1rem}.t-tabs{flex-grow:1}.t-demo{padding:2rem;overflow-x:auto}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.t-demo::-webkit-scrollbar,.t-demo::-webkit-scrollbar-thumb{width:1rem;height:1rem;border-radius:6.25rem;background-clip:padding-box;border:2.667rem solid transparent}.t-demo::-webkit-scrollbar{background-color:transparent}.t-demo::-webkit-scrollbar-thumb{background-color:var(--tui-clear-hover)}.t-demo::-webkit-scrollbar-thumb:hover{background-color:var(--tui-clear-active)}.t-demo::-webkit-scrollbar-thumb:active{background-color:var(--tui-text-03)}}:host-context(tui-root._mobile) .t-demo{padding:1rem}.t-code-actions{position:absolute;top:4.375rem;right:1rem;display:flex;justify-content:flex-end;align-items:center}.t-code-actions>*{margin-left:.5rem}.t-link-icon{margin-left:.3rem;vertical-align:baseline}.t-content{will-change:opacity;height:0;visibility:hidden;opacity:0}.t-content_animated{transition:opacity .3s ease-in-out}.t-content_visible{height:auto;visibility:visible;opacity:1}"]
|
|
899
912
|
}),
|
|
900
|
-
__param(0, Attribute(
|
|
913
|
+
__param(0, Attribute(`id`)),
|
|
901
914
|
__param(1, Inject(Clipboard)),
|
|
902
915
|
__param(2, Inject(TuiNotificationsService)),
|
|
903
916
|
__param(3, Inject(LOCATION)),
|
|
@@ -907,16 +920,19 @@ TuiDocExampleComponent = __decorate([
|
|
|
907
920
|
__param(6, Inject(TUI_DOC_CODE_EDITOR)),
|
|
908
921
|
__param(7, Inject(TUI_DOC_EXAMPLE_CONTENT_PROCESSOR)),
|
|
909
922
|
__param(8, Inject(TUI_IS_CYPRESS)),
|
|
910
|
-
__param(9, Inject(TUI_DOC_CODE_ACTIONS))
|
|
923
|
+
__param(9, Inject(TUI_DOC_CODE_ACTIONS)),
|
|
924
|
+
__param(10, Inject(Router)),
|
|
925
|
+
__param(11, Inject(ActivatedRoute)),
|
|
926
|
+
__param(12, Inject(Location$1))
|
|
911
927
|
], TuiDocExampleComponent);
|
|
912
928
|
|
|
913
929
|
let TuiDocExampleCapitalizePipe = class TuiDocExampleCapitalizePipe {
|
|
914
930
|
transform(content) {
|
|
915
|
-
return typeof content ===
|
|
931
|
+
return typeof content === `string` ? capitalizeFirstLetter(content) : content;
|
|
916
932
|
}
|
|
917
933
|
};
|
|
918
934
|
TuiDocExampleCapitalizePipe = __decorate([
|
|
919
|
-
Pipe({ name:
|
|
935
|
+
Pipe({ name: `tuiDocExampleCapitalize` })
|
|
920
936
|
], TuiDocExampleCapitalizePipe);
|
|
921
937
|
|
|
922
938
|
let TuiDocExampleGetTabsPipe = class TuiDocExampleGetTabsPipe {
|
|
@@ -925,7 +941,7 @@ let TuiDocExampleGetTabsPipe = class TuiDocExampleGetTabsPipe {
|
|
|
925
941
|
}
|
|
926
942
|
};
|
|
927
943
|
TuiDocExampleGetTabsPipe = __decorate([
|
|
928
|
-
Pipe({ name:
|
|
944
|
+
Pipe({ name: `tuiDocExampleGetTabs` })
|
|
929
945
|
], TuiDocExampleGetTabsPipe);
|
|
930
946
|
|
|
931
947
|
let TuiDocExampleModule = class TuiDocExampleModule {
|
|
@@ -960,18 +976,18 @@ let TuiDocMainComponent = TuiDocMainComponent_1 = class TuiDocMainComponent {
|
|
|
960
976
|
constructor(storage, windowRef) {
|
|
961
977
|
this.storage = storage;
|
|
962
978
|
this.windowRef = windowRef;
|
|
963
|
-
this.night = this.storage.getItem(
|
|
964
|
-
(this.storage.getItem(
|
|
965
|
-
this.windowRef.matchMedia(
|
|
979
|
+
this.night = this.storage.getItem(`night`) === `true` ||
|
|
980
|
+
(this.storage.getItem(`night`) === null &&
|
|
981
|
+
this.windowRef.matchMedia(`(prefers-color-scheme: dark)`).matches);
|
|
966
982
|
this.change$ = new Subject();
|
|
967
983
|
}
|
|
968
984
|
get mode() {
|
|
969
|
-
return this.night ?
|
|
985
|
+
return this.night ? `onDark` : null;
|
|
970
986
|
}
|
|
971
987
|
onMode(night) {
|
|
972
988
|
this.night = night;
|
|
973
989
|
this.change$.next();
|
|
974
|
-
this.storage.setItem(
|
|
990
|
+
this.storage.setItem(`night`, String(night));
|
|
975
991
|
}
|
|
976
992
|
};
|
|
977
993
|
TuiDocMainComponent.ctorParameters = () => [
|
|
@@ -979,11 +995,11 @@ TuiDocMainComponent.ctorParameters = () => [
|
|
|
979
995
|
{ type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] }
|
|
980
996
|
];
|
|
981
997
|
__decorate([
|
|
982
|
-
HostBinding(
|
|
998
|
+
HostBinding(`attr.data-mode`)
|
|
983
999
|
], TuiDocMainComponent.prototype, "mode", null);
|
|
984
1000
|
TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
|
|
985
1001
|
Component({
|
|
986
|
-
selector:
|
|
1002
|
+
selector: `tui-doc-main`,
|
|
987
1003
|
template: "<tui-theme-night *ngIf=\"night\"></tui-theme-night>\n<tui-root>\n <div class=\"tui-doc-page\">\n <tui-doc-navigation class=\"tui-doc-navigation\">\n <ng-content select=\"tuiDocNavigation\"></ng-content>\n </tui-doc-navigation>\n <div class=\"tui-doc-content\">\n <router-outlet class=\"tui-doc-outlet\"></router-outlet>\n </div>\n </div>\n <header tuiDocHeader>\n <label class=\"night-mode\">\n Night mode\n <tui-toggle\n class=\"tui-toggle\"\n [ngModel]=\"night\"\n (ngModelChange)=\"onMode($event)\"\n ></tui-toggle>\n </label>\n <ng-content select=\"tuiDocHeader\"></ng-content>\n </header>\n <ng-container ngProjectAs=\"tuiOverContent\">\n <ng-content select=\"tuiOverContent\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverDialogs\">\n <ng-content select=\"tuiOverDialogs\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverAlerts\">\n <ng-content select=\"tuiOverAlerts\"></ng-content>\n </ng-container>\n <!-- TODO: 3.0 Remove-->\n <ng-container ngProjectAs=\"tuiOverNotifications\">\n <ng-content select=\"tuiOverNotifications\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverPortals\">\n <ng-content select=\"tuiOverPortals\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverHints\">\n <ng-content select=\"tuiOverHints\"></ng-content>\n </ng-container>\n</tui-root>\n",
|
|
988
1004
|
encapsulation: ViewEncapsulation.None,
|
|
989
1005
|
providers: [
|
|
@@ -999,7 +1015,7 @@ TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
|
|
|
999
1015
|
__param(1, Inject(WINDOW))
|
|
1000
1016
|
], TuiDocMainComponent);
|
|
1001
1017
|
|
|
1002
|
-
const TUI_DOC_PAGE_LOADED = new InjectionToken(
|
|
1018
|
+
const TUI_DOC_PAGE_LOADED = new InjectionToken(`[TUI_DOC_PAGE_LOADED] Stream that emits if loading of page is over (for example, to begin scrollIntoView)`, { factory: () => defer(() => timer(200).pipe(switchMapTo(of(true)))) });
|
|
1003
1019
|
|
|
1004
1020
|
/**
|
|
1005
1021
|
* @deprecated: use {@link TuiScrollIntoViewLinkDirective}
|
|
@@ -1031,7 +1047,7 @@ __decorate([
|
|
|
1031
1047
|
], ScrollIntoViewDirective.prototype, "scrollIntoView", null);
|
|
1032
1048
|
ScrollIntoViewDirective = __decorate([
|
|
1033
1049
|
Directive({
|
|
1034
|
-
selector:
|
|
1050
|
+
selector: `[scrollIntoView]`,
|
|
1035
1051
|
providers: [TuiDestroyService],
|
|
1036
1052
|
})
|
|
1037
1053
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -1044,7 +1060,7 @@ let TuiScrollIntoViewLinkDirective = class TuiScrollIntoViewLinkDirective extend
|
|
|
1044
1060
|
};
|
|
1045
1061
|
TuiScrollIntoViewLinkDirective = __decorate([
|
|
1046
1062
|
Directive({
|
|
1047
|
-
selector:
|
|
1063
|
+
selector: `[tuiScrollIntoViewLink]`,
|
|
1048
1064
|
providers: [TuiDestroyService],
|
|
1049
1065
|
})
|
|
1050
1066
|
], TuiScrollIntoViewLinkDirective);
|
|
@@ -1073,41 +1089,41 @@ TuiScrollIntoViewLinkModule = __decorate([
|
|
|
1073
1089
|
})
|
|
1074
1090
|
], TuiScrollIntoViewLinkModule);
|
|
1075
1091
|
|
|
1076
|
-
const TUI_DOC_SCROLL_BEHAVIOR = new InjectionToken(
|
|
1092
|
+
const TUI_DOC_SCROLL_BEHAVIOR = new InjectionToken(`[TUI_DOC_SCROLL_BEHAVIOR] Defines the transition animation for scroll`, { factory: () => `smooth` });
|
|
1077
1093
|
|
|
1078
1094
|
const MAP = {
|
|
1079
|
-
а:
|
|
1080
|
-
б:
|
|
1081
|
-
в:
|
|
1082
|
-
г:
|
|
1083
|
-
д:
|
|
1084
|
-
е:
|
|
1085
|
-
ё:
|
|
1086
|
-
ж:
|
|
1087
|
-
з:
|
|
1088
|
-
и:
|
|
1089
|
-
й:
|
|
1090
|
-
к:
|
|
1091
|
-
л:
|
|
1092
|
-
м:
|
|
1093
|
-
н:
|
|
1094
|
-
о:
|
|
1095
|
-
п:
|
|
1096
|
-
р:
|
|
1097
|
-
с:
|
|
1098
|
-
т:
|
|
1099
|
-
у:
|
|
1100
|
-
ф:
|
|
1101
|
-
х:
|
|
1102
|
-
ц:
|
|
1103
|
-
ч:
|
|
1104
|
-
ш:
|
|
1105
|
-
щ:
|
|
1106
|
-
ъ:
|
|
1107
|
-
ы:
|
|
1108
|
-
ь:
|
|
1109
|
-
ю:
|
|
1110
|
-
я:
|
|
1095
|
+
а: `f`,
|
|
1096
|
+
б: `,`,
|
|
1097
|
+
в: `d`,
|
|
1098
|
+
г: `u`,
|
|
1099
|
+
д: `l`,
|
|
1100
|
+
е: `t`,
|
|
1101
|
+
ё: `\``,
|
|
1102
|
+
ж: `;`,
|
|
1103
|
+
з: `p`,
|
|
1104
|
+
и: `b`,
|
|
1105
|
+
й: `q`,
|
|
1106
|
+
к: `r`,
|
|
1107
|
+
л: `k`,
|
|
1108
|
+
м: `v`,
|
|
1109
|
+
н: `y`,
|
|
1110
|
+
о: `j`,
|
|
1111
|
+
п: `g`,
|
|
1112
|
+
р: `h`,
|
|
1113
|
+
с: `c`,
|
|
1114
|
+
т: `n`,
|
|
1115
|
+
у: `e`,
|
|
1116
|
+
ф: `a`,
|
|
1117
|
+
х: `[`,
|
|
1118
|
+
ц: `w`,
|
|
1119
|
+
ч: `x`,
|
|
1120
|
+
ш: `i`,
|
|
1121
|
+
щ: `o`,
|
|
1122
|
+
ъ: `]`,
|
|
1123
|
+
ы: `s`,
|
|
1124
|
+
ь: `m`,
|
|
1125
|
+
ю: `.`,
|
|
1126
|
+
я: `z`,
|
|
1111
1127
|
};
|
|
1112
1128
|
/**
|
|
1113
1129
|
* @deprecated: use {@link tuiTransliterateKeyboardLayout} instead
|
|
@@ -1117,7 +1133,7 @@ const MAP = {
|
|
|
1117
1133
|
*/
|
|
1118
1134
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1119
1135
|
function transliterateKeyboardLayout(string) {
|
|
1120
|
-
let newStr =
|
|
1136
|
+
let newStr = ``;
|
|
1121
1137
|
for (let i = 0; i < string.length; i++) {
|
|
1122
1138
|
newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
|
|
1123
1139
|
}
|
|
@@ -1125,17 +1141,17 @@ function transliterateKeyboardLayout(string) {
|
|
|
1125
1141
|
}
|
|
1126
1142
|
const tuiTransliterateKeyboardLayout = transliterateKeyboardLayout;
|
|
1127
1143
|
|
|
1128
|
-
const TUI_DOC_PAGES = new InjectionToken(
|
|
1144
|
+
const TUI_DOC_PAGES = new InjectionToken(`Documentation pages`, {
|
|
1129
1145
|
factory: () => [],
|
|
1130
1146
|
});
|
|
1131
1147
|
|
|
1132
|
-
const TUI_DOC_TITLE = new InjectionToken(
|
|
1133
|
-
factory: () =>
|
|
1148
|
+
const TUI_DOC_TITLE = new InjectionToken(`Page title`, {
|
|
1149
|
+
factory: () => ``,
|
|
1134
1150
|
});
|
|
1135
1151
|
|
|
1136
|
-
const NAVIGATION_TITLE = new InjectionToken(
|
|
1137
|
-
const NAVIGATION_LABELS = new InjectionToken(
|
|
1138
|
-
const NAVIGATION_ITEMS = new InjectionToken(
|
|
1152
|
+
const NAVIGATION_TITLE = new InjectionToken(`Page title`);
|
|
1153
|
+
const NAVIGATION_LABELS = new InjectionToken(`Navigation sections labels for search`);
|
|
1154
|
+
const NAVIGATION_ITEMS = new InjectionToken(`Navigation pages`);
|
|
1139
1155
|
const NAVIGATION_PROVIDERS = [
|
|
1140
1156
|
TuiDestroyService,
|
|
1141
1157
|
{
|
|
@@ -1189,12 +1205,12 @@ let TuiDocNavigationComponent = class TuiDocNavigationComponent {
|
|
|
1189
1205
|
this.readyToScroll$ = readyToScroll$;
|
|
1190
1206
|
this.scrollBehavior = scrollBehavior;
|
|
1191
1207
|
this.menuOpen = false;
|
|
1192
|
-
this.search =
|
|
1208
|
+
this.search = ``;
|
|
1193
1209
|
this.open = false;
|
|
1194
1210
|
this.openPagesArr = [];
|
|
1195
1211
|
this.openPagesGroupsArr = [];
|
|
1196
|
-
this.active =
|
|
1197
|
-
this.mode$ = this.mode.change$.pipe(startWith(null), map(() => this.mode.mode ||
|
|
1212
|
+
this.active = ``;
|
|
1213
|
+
this.mode$ = this.mode.change$.pipe(startWith(null), map(() => this.mode.mode || `onLight`));
|
|
1198
1214
|
// Angular can't navigate no anchor links
|
|
1199
1215
|
// https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
|
|
1200
1216
|
title$.subscribe(title => {
|
|
@@ -1229,11 +1245,11 @@ let TuiDocNavigationComponent = class TuiDocNavigationComponent {
|
|
|
1229
1245
|
onClick() {
|
|
1230
1246
|
this.open = false;
|
|
1231
1247
|
this.menuOpen = false;
|
|
1232
|
-
this.search =
|
|
1248
|
+
this.search = ``;
|
|
1233
1249
|
this.openActivePageGroup();
|
|
1234
1250
|
}
|
|
1235
1251
|
filterItems(items, search) {
|
|
1236
|
-
return items.map(section => uniqBy(section.filter(({ title, keywords =
|
|
1252
|
+
return items.map(section => uniqBy(section.filter(({ title, keywords = `` }) => {
|
|
1237
1253
|
title = title.toLowerCase();
|
|
1238
1254
|
search = search.toLowerCase();
|
|
1239
1255
|
keywords = keywords.toLowerCase();
|
|
@@ -1241,13 +1257,13 @@ let TuiDocNavigationComponent = class TuiDocNavigationComponent {
|
|
|
1241
1257
|
keywords.includes(search) ||
|
|
1242
1258
|
title.includes(transliterateKeyboardLayout(search)) ||
|
|
1243
1259
|
keywords.includes(transliterateKeyboardLayout(search)) ||
|
|
1244
|
-
search.replace(/-/gi,
|
|
1245
|
-
}),
|
|
1260
|
+
search.replace(/-/gi, ``).includes(title));
|
|
1261
|
+
}), `title`));
|
|
1246
1262
|
}
|
|
1247
1263
|
flattenSubPages(items) {
|
|
1248
1264
|
return items.reduce((array, item) => [
|
|
1249
1265
|
...array,
|
|
1250
|
-
item.reduce((pages, page) =>
|
|
1266
|
+
item.reduce((pages, page) => `subPages` in page
|
|
1251
1267
|
? [...pages, ...page.subPages]
|
|
1252
1268
|
: [...pages, page], []),
|
|
1253
1269
|
], []);
|
|
@@ -1263,11 +1279,11 @@ let TuiDocNavigationComponent = class TuiDocNavigationComponent {
|
|
|
1263
1279
|
openActivePageGroup() {
|
|
1264
1280
|
this.items.forEach((pages, pagesIndex) => {
|
|
1265
1281
|
pages.forEach((page, pageIndex) => {
|
|
1266
|
-
if (
|
|
1282
|
+
if (`route` in page && this.isActiveRoute(page.route)) {
|
|
1267
1283
|
this.openPagesArr[pagesIndex] = true;
|
|
1268
1284
|
this.active = page.route;
|
|
1269
1285
|
}
|
|
1270
|
-
if (
|
|
1286
|
+
if (`subPages` in page) {
|
|
1271
1287
|
page.subPages.forEach(subPage => {
|
|
1272
1288
|
if (this.isActiveRoute(subPage.route)) {
|
|
1273
1289
|
this.openPagesArr[pagesIndex] = true;
|
|
@@ -1284,10 +1300,10 @@ let TuiDocNavigationComponent = class TuiDocNavigationComponent {
|
|
|
1284
1300
|
if (!element) {
|
|
1285
1301
|
return;
|
|
1286
1302
|
}
|
|
1287
|
-
element.classList.add(
|
|
1303
|
+
element.classList.add(`tui-doc-animated-example`);
|
|
1288
1304
|
element.scrollIntoView({
|
|
1289
|
-
block:
|
|
1290
|
-
inline:
|
|
1305
|
+
block: `start`,
|
|
1306
|
+
inline: `nearest`,
|
|
1291
1307
|
behavior: this.scrollBehavior,
|
|
1292
1308
|
});
|
|
1293
1309
|
}
|
|
@@ -1309,7 +1325,7 @@ TuiDocNavigationComponent.ctorParameters = () => [
|
|
|
1309
1325
|
{ type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_SCROLL_BEHAVIOR,] }] }
|
|
1310
1326
|
];
|
|
1311
1327
|
__decorate([
|
|
1312
|
-
HostBinding(
|
|
1328
|
+
HostBinding(`class._open`)
|
|
1313
1329
|
], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
|
|
1314
1330
|
__decorate([
|
|
1315
1331
|
tuiPure
|
|
@@ -1319,7 +1335,7 @@ __decorate([
|
|
|
1319
1335
|
], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
|
|
1320
1336
|
TuiDocNavigationComponent = __decorate([
|
|
1321
1337
|
Component({
|
|
1322
|
-
selector:
|
|
1338
|
+
selector: `tui-doc-navigation`,
|
|
1323
1339
|
template: "<tui-hosted-dropdown\n *tuiLet=\"filteredItems as filtered\"\n tuiAutoFocus\n tuiDropdownLimitWidth=\"fixed\"\n class=\"t-input\"\n [autoFocus]=\"!!sidebar\"\n [content]=\"dropdown\"\n [canOpen]=\"canOpen\"\n [(open)]=\"open\"\n>\n <tui-primitive-textfield\n iconAlign=\"left\"\n tuiTextfieldSize=\"m\"\n iconContent=\"tuiIconSearch\"\n [pseudoFocused]=\"open || null\"\n [tuiTextfieldCleaner]=\"true\"\n [tuiTextfieldLabelOutside]=\"true\"\n [value]=\"search\"\n (valueChange)=\"onSearchChange($event)\"\n >\n {{ searchText }}\n </tui-primitive-textfield>\n <ng-template\n #dropdown\n let-activeZone\n >\n <tui-data-list>\n <tui-opt-group\n *ngFor=\"let group of filtered; let index = index\"\n [label]=\"labels[index] || ''\"\n >\n <a\n *ngFor=\"let item of group\"\n tuiOption\n [routerLink]=\"item.route\"\n (click)=\"onClick()\"\n >\n {{ item.title }}\n </a>\n </tui-opt-group>\n </tui-data-list>\n </ng-template>\n</tui-hosted-dropdown>\n\n<nav class=\"t-navigation\">\n <tui-scrollbar\n class=\"t-scrollbar\"\n [tuiMode]=\"mode$ | async\"\n >\n <tui-accordion\n [closeOthers]=\"false\"\n [rounded]=\"false\"\n >\n <tui-accordion-item\n *ngFor=\"let label of labels; index as index\"\n size=\"s\"\n [borders]=\"null\"\n [(open)]=\"!!openPagesArr[index]\"\n >\n <span class=\"t-label\">\n <strong>{{ label }}</strong>\n </span>\n <ng-template tuiAccordionItemContent>\n <div class=\"t-section\">\n <ng-container\n *ngFor=\"let item of items[index]; index as subIndex\"\n [ngTemplateOutlet]=\"pages\"\n [ngTemplateOutletContext]=\"{item: item, index: index * 100 + subIndex}\"\n ></ng-container>\n </div>\n </ng-template>\n </tui-accordion-item>\n </tui-accordion>\n <div class=\"t-items-container\">\n <ng-container\n *ngFor=\"let item of itemsWithoutSections; let index = index\"\n [ngTemplateOutlet]=\"pages\"\n [ngTemplateOutletContext]=\"{item: item, index: items.length - 1 + index}\"\n ></ng-container>\n </div>\n\n <ng-template\n #pages\n let-item=\"item\"\n let-index=\"index\"\n >\n <a\n *ngIf=\"!item.subPages; else subPages\"\n tuiLink\n routerLinkActive=\"t-sublink_active\"\n class=\"t-sublink\"\n [routerLink]=\"item.route\"\n [scrollIntoView]=\"isActive(item.route)\"\n (click)=\"closeMenu()\"\n >\n {{ item.title }}\n </a>\n <ng-template #subPages>\n <div\n routerLinkActive\n class=\"t-subsection\"\n [routerLinkActiveOptions]=\"{exact: false}\"\n >\n <button\n *ngIf=\"item.subPages\"\n tuiLink\n type=\"button\"\n class=\"t-sublink t-sublink_subsection\"\n (click)=\"onGroupClick(index)\"\n >\n <tui-svg\n src=\"tuiIconChevronRight\"\n class=\"t-chevron\"\n [class.t-chevron_active]=\"!!openPagesGroupsArr[index]\"\n ></tui-svg>\n {{ item.title }}\n </button>\n <tui-expand\n class=\"t-expand\"\n [expanded]=\"!!openPagesGroupsArr[index]\"\n >\n <div class=\"t-section t-section_bordered\">\n <a\n *ngFor=\"let subPage of item.subPages\"\n tuiLink\n routerLinkActive=\"t-sublink_active\"\n class=\"t-sublink t-sublink_small\"\n [routerLink]=\"subPage.route\"\n [scrollIntoView]=\"isActive(subPage.route)\"\n (click)=\"closeMenu()\"\n >\n {{ subPage.title }}\n </a>\n </div>\n </tui-expand>\n </div>\n </ng-template>\n </ng-template>\n </tui-scrollbar>\n</nav>\n\n<ng-content></ng-content>\n",
|
|
1324
1340
|
providers: NAVIGATION_PROVIDERS,
|
|
1325
1341
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -1373,8 +1389,8 @@ TuiDocNavigationModule = __decorate([
|
|
|
1373
1389
|
})
|
|
1374
1390
|
], TuiDocNavigationModule);
|
|
1375
1391
|
|
|
1376
|
-
const TUI_DOC_LOGO = new InjectionToken(
|
|
1377
|
-
factory: () =>
|
|
1392
|
+
const TUI_DOC_LOGO = new InjectionToken(`Main logo`, {
|
|
1393
|
+
factory: () => ``,
|
|
1378
1394
|
});
|
|
1379
1395
|
|
|
1380
1396
|
let TuiDocHeaderComponent = class TuiDocHeaderComponent {
|
|
@@ -1384,7 +1400,7 @@ let TuiDocHeaderComponent = class TuiDocHeaderComponent {
|
|
|
1384
1400
|
this.router = router;
|
|
1385
1401
|
this.swipes$ = swipes$;
|
|
1386
1402
|
this.stream$ = new Subject();
|
|
1387
|
-
this.open$ = merge(this.router.events.pipe(mapTo(false)), this.stream$, this.swipes$.pipe(filter(swipe => swipe.direction ===
|
|
1403
|
+
this.open$ = merge(this.router.events.pipe(mapTo(false)), this.stream$, this.swipes$.pipe(filter(swipe => swipe.direction === `left` || swipe.direction === `right`), map(swipe => swipe.direction === `right`))).pipe(startWith(false), distinctUntilChanged());
|
|
1388
1404
|
}
|
|
1389
1405
|
onClick() {
|
|
1390
1406
|
this.stream$.next(true);
|
|
@@ -1403,7 +1419,7 @@ TuiDocHeaderComponent.ctorParameters = () => [
|
|
|
1403
1419
|
];
|
|
1404
1420
|
TuiDocHeaderComponent = __decorate([
|
|
1405
1421
|
Component({
|
|
1406
|
-
selector:
|
|
1422
|
+
selector: `header[tuiDocHeader]`,
|
|
1407
1423
|
template: "<button\n tuiIconButton\n icon=\"tuiIconMenuLarge\"\n appearance=\"icon\"\n class=\"t-menu\"\n [title]=\"menu\"\n (click)=\"onClick()\"\n (tuiActiveZoneChange)=\"onActiveZone($event)\"\n>\n <tui-doc-navigation\n *tuiSidebar=\"!!(open$ | async)\"\n class=\"t-navigation\"\n ></tui-doc-navigation>\n</button>\n<div\n polymorpheus-outlet\n class=\"t-logo\"\n [content]=\"logo\"\n>\n <ng-template let-src>\n <img\n alt=\"Logo\"\n class=\"t-img\"\n [src]=\"src\"\n />\n </ng-template>\n</div>\n<ng-content></ng-content>\n",
|
|
1408
1424
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1409
1425
|
styles: [":host{box-shadow:0 .125rem 1rem rgba(0,0,0,.08);position:fixed;top:0;left:0;right:0;z-index:1;display:flex;height:3.9375rem;align-items:center;padding:0 1.25rem;background:var(--tui-base-01);border-bottom:1px solid var(--tui-base-03)}.t-logo{margin-right:auto;font:var(--tui-font-heading-5)}.t-img{display:block}.t-menu{margin-left:-1.25rem}@media screen and (min-width:48em){.t-menu{display:none}}.t-navigation{min-height:100%}"]
|
|
@@ -1452,15 +1468,15 @@ TuiDocMainModule = __decorate([
|
|
|
1452
1468
|
})
|
|
1453
1469
|
], TuiDocMainModule);
|
|
1454
1470
|
|
|
1455
|
-
const TUI_DOC_DEFAULT_TABS = new InjectionToken(
|
|
1471
|
+
const TUI_DOC_DEFAULT_TABS = new InjectionToken(`Array of default tab names`, {
|
|
1456
1472
|
factory: () => [],
|
|
1457
1473
|
});
|
|
1458
1474
|
|
|
1459
|
-
const TUI_DOC_SEE_ALSO = new InjectionToken(
|
|
1475
|
+
const TUI_DOC_SEE_ALSO = new InjectionToken(`Array of arrays of related pages`, {
|
|
1460
1476
|
factory: () => [],
|
|
1461
1477
|
});
|
|
1462
1478
|
|
|
1463
|
-
const PAGE_SEE_ALSO = new InjectionToken(
|
|
1479
|
+
const PAGE_SEE_ALSO = new InjectionToken(`Page see also`);
|
|
1464
1480
|
const PAGE_PROVIDERS = [
|
|
1465
1481
|
{
|
|
1466
1482
|
provide: PAGE_SEE_ALSO,
|
|
@@ -1470,11 +1486,11 @@ const PAGE_PROVIDERS = [
|
|
|
1470
1486
|
];
|
|
1471
1487
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1472
1488
|
function seeAlsoProviderFactory({ nativeElement }, seeAlsoGroups) {
|
|
1473
|
-
const currentHeader = nativeElement.getAttribute(
|
|
1489
|
+
const currentHeader = nativeElement.getAttribute(`header`);
|
|
1474
1490
|
const groups = seeAlsoGroups.filter(group => group.includes(currentHeader)) || [];
|
|
1475
1491
|
const seeAlsoSet = new Set(groups
|
|
1476
1492
|
.join()
|
|
1477
|
-
.split(
|
|
1493
|
+
.split(`,`)
|
|
1478
1494
|
.filter(component => component && component !== currentHeader));
|
|
1479
1495
|
return Array.from(seeAlsoSet);
|
|
1480
1496
|
}
|
|
@@ -1493,7 +1509,7 @@ __decorate([
|
|
|
1493
1509
|
], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
|
|
1494
1510
|
TuiDocPageTabConnectorDirective = __decorate([
|
|
1495
1511
|
Directive({
|
|
1496
|
-
selector:
|
|
1512
|
+
selector: `[pageTab]`,
|
|
1497
1513
|
}),
|
|
1498
1514
|
__param(0, Inject(TemplateRef))
|
|
1499
1515
|
], TuiDocPageTabConnectorDirective);
|
|
@@ -1505,22 +1521,22 @@ let TuiDocPageComponent = class TuiDocPageComponent {
|
|
|
1505
1521
|
this.deprecated = deprecated;
|
|
1506
1522
|
this.defaultTabs = defaultTabs;
|
|
1507
1523
|
this.seeAlso = seeAlso;
|
|
1508
|
-
this.header =
|
|
1509
|
-
this.package =
|
|
1510
|
-
this.type =
|
|
1511
|
-
this.path =
|
|
1524
|
+
this.header = ``;
|
|
1525
|
+
this.package = ``;
|
|
1526
|
+
this.type = ``;
|
|
1527
|
+
this.path = ``;
|
|
1512
1528
|
this.tabConnectors = EMPTY_QUERY;
|
|
1513
1529
|
this.activeItemIndex = NaN;
|
|
1514
1530
|
}
|
|
1515
1531
|
get showSeeAlso() {
|
|
1516
1532
|
return !!this.seeAlso.length && this.activeItemIndex === 0;
|
|
1517
1533
|
}
|
|
1518
|
-
getRouterLink(tab =
|
|
1519
|
-
return `./${tab.replace(/ /g,
|
|
1534
|
+
getRouterLink(tab = ``) {
|
|
1535
|
+
return `./${tab.replace(/ /g, `_`)}`;
|
|
1520
1536
|
}
|
|
1521
1537
|
};
|
|
1522
1538
|
TuiDocPageComponent.ctorParameters = () => [
|
|
1523
|
-
{ type: String, decorators: [{ type: Attribute, args: [
|
|
1539
|
+
{ type: String, decorators: [{ type: Attribute, args: [`deprecated`,] }] },
|
|
1524
1540
|
{ type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_DEFAULT_TABS,] }] },
|
|
1525
1541
|
{ type: undefined, decorators: [{ type: Inject, args: [PAGE_SEE_ALSO,] }] }
|
|
1526
1542
|
];
|
|
@@ -1541,13 +1557,13 @@ __decorate([
|
|
|
1541
1557
|
], TuiDocPageComponent.prototype, "tabConnectors", void 0);
|
|
1542
1558
|
TuiDocPageComponent = __decorate([
|
|
1543
1559
|
Component({
|
|
1544
|
-
selector:
|
|
1560
|
+
selector: `tui-doc-page`,
|
|
1545
1561
|
template: "<header class=\"t-header\">\n <h1 class=\"t-title\">\n {{ header }}\n <tui-tag\n *ngIf=\"deprecated !== null\"\n value=\"deprecated\"\n status=\"custom\"\n class=\"t-tag t-tag_deprecated\"\n ></tui-tag>\n <tui-tag\n *ngIf=\"package\"\n status=\"custom\"\n class=\"t-tag t-tag_package\"\n [value]=\"package\"\n [autoColor]=\"true\"\n ></tui-tag>\n </h1>\n <tui-tabs-with-more\n *ngIf=\"tabConnectors.length\"\n class=\"t-tabs\"\n [(activeItemIndex)]=\"activeItemIndex\"\n >\n <ng-container *ngFor=\"let tab of tabConnectors; first as first; index as index\">\n <ng-container *ngIf=\"first; else dynamicTab\">\n <a\n *tuiTab\n tuiTab\n routerLink=\"./\"\n routerLinkActive\n [routerLinkActiveOptions]=\"{exact: true}\"\n >\n {{ tab.pageTab || defaultTabs[index] }}\n </a>\n </ng-container>\n <ng-template #dynamicTab>\n <a\n *tuiTab\n tuiTab\n routerLinkActive\n [routerLink]=\"getRouterLink(tab.pageTab || defaultTabs[index])\"\n >\n {{ tab.pageTab || defaultTabs[index] }}\n </a>\n </ng-template>\n </ng-container>\n </tui-tabs-with-more>\n <tui-doc-source-code\n class=\"t-source-code\"\n [header]=\"header\"\n [package]=\"package\"\n [type]=\"type\"\n [path]=\"path\"\n ></tui-doc-source-code>\n</header>\n<div class=\"t-content\">\n <ng-content></ng-content>\n <tui-doc-see-also\n *ngIf=\"showSeeAlso\"\n class=\"t-see-also\"\n [seeAlso]=\"seeAlso\"\n ></tui-doc-see-also>\n <ng-container *ngFor=\"let tab of tabConnectors; index as index\">\n <ng-container\n *ngIf=\"index === activeItemIndex\"\n [ngTemplateOutlet]=\"tab.template\"\n ></ng-container>\n </ng-container>\n</div>\n",
|
|
1546
1562
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1547
1563
|
providers: PAGE_PROVIDERS,
|
|
1548
1564
|
styles: [":host{display:flex;flex-direction:column;min-height:0;flex-basis:0;flex-grow:1}.t-header{display:flex;font:var(--tui-font-heading-3);flex-wrap:wrap;min-height:7.25rem;color:var(--tui-text-01);box-shadow:inset 0 -1px 0 0 var(--tui-base-03);padding:3.75rem 0 0;box-sizing:border-box;flex-shrink:0;margin:0 min(10vw,8.75rem)}:host-context(tui-root._mobile) .t-header{font:var(--tui-font-heading-4);min-height:4.5rem;padding:1.25rem 1.25rem 0;margin:0}.t-title{min-width:100%;font-size:inherit;margin:0}.t-tag{vertical-align:middle;text-transform:uppercase;margin-right:.5rem}.t-tag_deprecated{background-color:var(--tui-error-fill)}.t-tag.t-tag_package{color:#000}.t-tabs{flex:1;margin:1.125rem .3125rem 0 0}:host-context(tui-root._mobile) .t-tabs{margin-top:.25rem}.t-content{padding:2rem 0;margin:0 min(10vw,8.75rem)}:host-context(tui-root._mobile) .t-content{padding:2rem 1.25rem;margin:0}.t-see-also{min-width:18.75rem;width:30%;float:right;margin-left:1.5rem}:host-context(tui-root._mobile) .t-see-also{float:none;width:100%;margin:0 0 1.5rem}.t-source-code{align-self:flex-end;line-height:2.75rem}"]
|
|
1549
1565
|
}),
|
|
1550
|
-
__param(0, Attribute(
|
|
1566
|
+
__param(0, Attribute(`deprecated`)),
|
|
1551
1567
|
__param(1, Inject(TUI_DOC_DEFAULT_TABS)),
|
|
1552
1568
|
__param(2, Inject(PAGE_SEE_ALSO))
|
|
1553
1569
|
], TuiDocPageComponent);
|
|
@@ -1562,14 +1578,14 @@ let TuiDocSeeAlsoComponent = class TuiDocSeeAlsoComponent {
|
|
|
1562
1578
|
getRouterLink(pageTitle) {
|
|
1563
1579
|
for (let i = 0; i < this.pages.length; i++) {
|
|
1564
1580
|
const page = this.pages
|
|
1565
|
-
.map(page => (
|
|
1581
|
+
.map(page => (`subPages` in page ? page.subPages : [page]))
|
|
1566
1582
|
.reduce((pages, subPages) => [...pages, ...subPages], [])
|
|
1567
1583
|
.find((page) => page.title === pageTitle);
|
|
1568
1584
|
if (page === null || page === void 0 ? void 0 : page.route) {
|
|
1569
1585
|
return page.route;
|
|
1570
1586
|
}
|
|
1571
1587
|
}
|
|
1572
|
-
return
|
|
1588
|
+
return ``;
|
|
1573
1589
|
}
|
|
1574
1590
|
};
|
|
1575
1591
|
TuiDocSeeAlsoComponent.ctorParameters = () => [
|
|
@@ -1581,7 +1597,7 @@ __decorate([
|
|
|
1581
1597
|
], TuiDocSeeAlsoComponent.prototype, "seeAlso", void 0);
|
|
1582
1598
|
TuiDocSeeAlsoComponent = __decorate([
|
|
1583
1599
|
Component({
|
|
1584
|
-
selector:
|
|
1600
|
+
selector: `tui-doc-see-also`,
|
|
1585
1601
|
template: "<h5 class=\"header\">{{ text }}</h5>\n<ng-container *ngFor=\"let item of seeAlso; last as last\">\n <a\n tuiLink\n [routerLink]=\"getRouterLink(item)\"\n >\n {{ item }}\n </a>\n <ng-container *ngIf=\"!last\">{{ ', ' }}</ng-container>\n</ng-container>\n",
|
|
1586
1602
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1587
1603
|
styles: [":host{display:block}.header{font-size:.6875rem;line-height:1rem;text-transform:uppercase;letter-spacing:.075em;color:var(--tui-text-02);margin:0 0 .5rem;white-space:nowrap}"]
|
|
@@ -1600,18 +1616,18 @@ TuiDocSeeAlsoModule = __decorate([
|
|
|
1600
1616
|
})
|
|
1601
1617
|
], TuiDocSeeAlsoModule);
|
|
1602
1618
|
|
|
1603
|
-
const TUI_DOC_SOURCE_CODE = new InjectionToken(
|
|
1604
|
-
factory: () =>
|
|
1619
|
+
const TUI_DOC_SOURCE_CODE = new InjectionToken(`Source code link`, {
|
|
1620
|
+
factory: () => ``,
|
|
1605
1621
|
});
|
|
1606
1622
|
|
|
1607
1623
|
let TuiDocSourceCodeComponent = class TuiDocSourceCodeComponent {
|
|
1608
1624
|
constructor(sourceCode, text) {
|
|
1609
1625
|
this.sourceCode = sourceCode;
|
|
1610
1626
|
this.text = text;
|
|
1611
|
-
this.header =
|
|
1612
|
-
this.package =
|
|
1613
|
-
this.type =
|
|
1614
|
-
this.path =
|
|
1627
|
+
this.header = ``;
|
|
1628
|
+
this.package = ``;
|
|
1629
|
+
this.type = ``;
|
|
1630
|
+
this.path = ``;
|
|
1615
1631
|
}
|
|
1616
1632
|
get pathOptions() {
|
|
1617
1633
|
return this.getPathOptions(this.header, this.package, this.type, this.path);
|
|
@@ -1646,7 +1662,7 @@ __decorate([
|
|
|
1646
1662
|
], TuiDocSourceCodeComponent.prototype, "getPathOptions", null);
|
|
1647
1663
|
TuiDocSourceCodeComponent = __decorate([
|
|
1648
1664
|
Component({
|
|
1649
|
-
selector:
|
|
1665
|
+
selector: `tui-doc-source-code`,
|
|
1650
1666
|
template: "<div\n *ngIf=\"!!sourceCode\"\n polymorpheus-outlet\n [content]=\"sourceCode\"\n [context]=\"pathOptions\"\n>\n <ng-template let-link>\n <a\n *ngIf=\"link\"\n tuiIconButton\n type=\"button\"\n icon=\"tuiIconCodeLarge\"\n appearance=\"icon\"\n target=\"_blank\"\n size=\"s\"\n [title]=\"text\"\n [href]=\"link\"\n ></a>\n </ng-template>\n</div>\n",
|
|
1651
1667
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1652
1668
|
}),
|
|
@@ -1682,21 +1698,21 @@ TuiDocPageModule = __decorate([
|
|
|
1682
1698
|
], TuiDocPageModule);
|
|
1683
1699
|
|
|
1684
1700
|
const TUI_EXAMPLE_PRIMARY_FILE_NAME = {
|
|
1685
|
-
TS:
|
|
1686
|
-
LESS:
|
|
1687
|
-
HTML:
|
|
1701
|
+
TS: `TypeScript`,
|
|
1702
|
+
LESS: `LESS`,
|
|
1703
|
+
HTML: `HTML`,
|
|
1688
1704
|
};
|
|
1689
1705
|
|
|
1690
1706
|
// TODO: 3.0 remove in ivy compilation
|
|
1691
|
-
const DEMO_TEXTS = [
|
|
1707
|
+
const DEMO_TEXTS = [`Сделано с помощью директивы: `, `Фон`, `Детали формы`];
|
|
1692
1708
|
const DOC_TEXTS = [
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1709
|
+
`Аргумент`,
|
|
1710
|
+
`Тип`,
|
|
1711
|
+
`Имя и описание`,
|
|
1712
|
+
`Значение`,
|
|
1713
|
+
`Для работы с динамическими шаблонами используется`,
|
|
1698
1714
|
];
|
|
1699
|
-
const EXAMPLE_TEXTS = [
|
|
1715
|
+
const EXAMPLE_TEXTS = [`Превью`, `Ссылка на пример скопирована`, `Готово`];
|
|
1700
1716
|
const TUI_DOC_RUSSIAN = [
|
|
1701
1717
|
{
|
|
1702
1718
|
provide: TUI_DOC_DEMO_TEXTS,
|
|
@@ -1712,19 +1728,19 @@ const TUI_DOC_RUSSIAN = [
|
|
|
1712
1728
|
},
|
|
1713
1729
|
{
|
|
1714
1730
|
provide: TUI_DOC_MENU_TEXT,
|
|
1715
|
-
useValue:
|
|
1731
|
+
useValue: `Меню`,
|
|
1716
1732
|
},
|
|
1717
1733
|
{
|
|
1718
1734
|
provide: TUI_DOC_SEARCH_TEXT,
|
|
1719
|
-
useValue:
|
|
1735
|
+
useValue: `Поиск`,
|
|
1720
1736
|
},
|
|
1721
1737
|
{
|
|
1722
1738
|
provide: TUI_DOC_SEE_ALSO_TEXT,
|
|
1723
|
-
useValue:
|
|
1739
|
+
useValue: `Смотрите также`,
|
|
1724
1740
|
},
|
|
1725
1741
|
{
|
|
1726
1742
|
provide: TUI_DOC_SOURCE_CODE_TEXT,
|
|
1727
|
-
useValue:
|
|
1743
|
+
useValue: `Исходный код`,
|
|
1728
1744
|
},
|
|
1729
1745
|
];
|
|
1730
1746
|
|
|
@@ -1750,11 +1766,11 @@ TuiAddonDocModule = __decorate([
|
|
|
1750
1766
|
function generateRoutes(type) {
|
|
1751
1767
|
return [
|
|
1752
1768
|
{
|
|
1753
|
-
path:
|
|
1769
|
+
path: ``,
|
|
1754
1770
|
component: type,
|
|
1755
1771
|
children: [
|
|
1756
1772
|
{
|
|
1757
|
-
path:
|
|
1773
|
+
path: `:tab`,
|
|
1758
1774
|
component: type,
|
|
1759
1775
|
},
|
|
1760
1776
|
],
|