@taiga-ui/addon-doc 3.16.0-dev.main-be14e7c → 3.16.0-dev.main-0ee0b72
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 +32 -22
- package/bundles/taiga-ui-addon-doc.umd.js.map +1 -1
- package/components/code/code.component.d.ts +3 -0
- package/esm2015/components/code/code.component.js +13 -8
- package/esm2015/tokens/example-content-processor.js +3 -1
- package/fesm2015/taiga-ui-addon-doc.js +23 -17
- package/fesm2015/taiga-ui-addon-doc.js.map +1 -1
- package/package.json +1 -1
- package/tokens/example-content-processor.d.ts +1 -0
|
@@ -40,6 +40,24 @@
|
|
|
40
40
|
var i8__namespace$1 = /*#__PURE__*/_interopNamespace(i8$1);
|
|
41
41
|
var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
|
|
42
42
|
|
|
43
|
+
function tuiTryParseMarkdownCodeBlock(text) {
|
|
44
|
+
if (text === void 0) { text = ""; }
|
|
45
|
+
var tokens = new MarkdownIt__default["default"]().parse(text, {});
|
|
46
|
+
var result = tokens
|
|
47
|
+
.filter(function (_a) {
|
|
48
|
+
var tag = _a.tag, type = _a.type;
|
|
49
|
+
return tag === "code" && type === "fence";
|
|
50
|
+
})
|
|
51
|
+
.map(function (_a) {
|
|
52
|
+
var content = _a.content;
|
|
53
|
+
return content;
|
|
54
|
+
});
|
|
55
|
+
return result.length ? result : [text];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = new i0.InjectionToken("[TUI_DOC_EXAMPLE_CONTENT_PROCESSOR]: Processes content in example", { factory: function () { return i9.identity; } });
|
|
59
|
+
var TUI_DOC_EXAMPLE_MARKDOWN_CODE_PROCESSOR = new i0.InjectionToken("[TUI_DOC_EXAMPLE_MARKDOWN_CODE_PROCESSOR]: Processes markdown in code block", { factory: function () { return tuiTryParseMarkdownCodeBlock; } });
|
|
60
|
+
|
|
43
61
|
/******************************************************************************
|
|
44
62
|
Copyright (c) Microsoft Corporation.
|
|
45
63
|
|
|
@@ -387,26 +405,13 @@
|
|
|
387
405
|
});
|
|
388
406
|
}
|
|
389
407
|
|
|
390
|
-
function tuiTryParseMarkdownCodeBlock(text) {
|
|
391
|
-
if (text === void 0) { text = ""; }
|
|
392
|
-
var tokens = new MarkdownIt__default["default"]().parse(text, {});
|
|
393
|
-
var result = tokens
|
|
394
|
-
.filter(function (_a) {
|
|
395
|
-
var tag = _a.tag, type = _a.type;
|
|
396
|
-
return tag === "code" && type === "fence";
|
|
397
|
-
})
|
|
398
|
-
.map(function (_a) {
|
|
399
|
-
var content = _a.content;
|
|
400
|
-
return content;
|
|
401
|
-
});
|
|
402
|
-
return result.length ? result : [text];
|
|
403
|
-
}
|
|
404
|
-
|
|
405
408
|
var TuiDocCodeComponent = /** @class */ (function () {
|
|
406
|
-
function TuiDocCodeComponent() {
|
|
409
|
+
function TuiDocCodeComponent(markdownCodeProcessor) {
|
|
410
|
+
var _this = this;
|
|
411
|
+
this.markdownCodeProcessor = markdownCodeProcessor;
|
|
407
412
|
this.rawLoader$$ = new i9.BehaviorSubject('');
|
|
408
413
|
this.filename = '';
|
|
409
|
-
this.processor$ = this.rawLoader$$.pipe(operators.switchMap(tuiRawLoad), operators.map(
|
|
414
|
+
this.processor$ = this.rawLoader$$.pipe(operators.switchMap(tuiRawLoad), operators.map(function (value) { return _this.markdownCodeProcessor(value); }));
|
|
410
415
|
}
|
|
411
416
|
Object.defineProperty(TuiDocCodeComponent.prototype, "code", {
|
|
412
417
|
set: function (code) {
|
|
@@ -424,16 +429,22 @@
|
|
|
424
429
|
});
|
|
425
430
|
return TuiDocCodeComponent;
|
|
426
431
|
}());
|
|
427
|
-
TuiDocCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: TuiDocCodeComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
428
|
-
TuiDocCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: TuiDocCodeComponent, selector: "tui-doc-code", inputs: { filename: "filename", code: "code" }, host: { properties: { "class._has-filename": "this.hasFilename" } }, ngImport: i0__namespace, template: "<!-- eslint-disable @html-eslint/element-newline -->\n<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", styles: [":host{display:block}.t-header{font:var(--tui-font-text-s);font-weight:bold}.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);word-wrap:break-word;white-space:pre-wrap}@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .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}\n"], directives: [{ type: i5__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.Highlight, selector: "[highlight]", inputs: ["highlight", "languages", "lineNumbers"], outputs: ["highlighted"] }], pipes: { "async": i5__namespace.AsyncPipe } });
|
|
432
|
+
TuiDocCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: TuiDocCodeComponent, deps: [{ token: TUI_DOC_EXAMPLE_MARKDOWN_CODE_PROCESSOR }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
433
|
+
TuiDocCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: TuiDocCodeComponent, selector: "tui-doc-code", inputs: { filename: "filename", code: "code" }, host: { properties: { "class._has-filename": "this.hasFilename" } }, ngImport: i0__namespace, template: "<!-- eslint-disable @html-eslint/element-newline -->\n<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", styles: [":host{display:block}.t-header{font:var(--tui-font-text-s);font-weight:bold}.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);word-wrap:break-word;white-space:pre-wrap}@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .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}\n"], directives: [{ type: i5__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.Highlight, selector: "[highlight]", inputs: ["highlight", "languages", "lineNumbers"], outputs: ["highlighted"] }], pipes: { "async": i5__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
429
434
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: TuiDocCodeComponent, decorators: [{
|
|
430
435
|
type: i0.Component,
|
|
431
436
|
args: [{
|
|
432
437
|
selector: 'tui-doc-code',
|
|
433
438
|
templateUrl: './code.template.html',
|
|
434
439
|
styleUrls: ['./code.style.less'],
|
|
440
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
435
441
|
}]
|
|
436
|
-
}],
|
|
442
|
+
}], ctorParameters: function () {
|
|
443
|
+
return [{ type: undefined, decorators: [{
|
|
444
|
+
type: i0.Inject,
|
|
445
|
+
args: [TUI_DOC_EXAMPLE_MARKDOWN_CODE_PROCESSOR]
|
|
446
|
+
}] }];
|
|
447
|
+
}, propDecorators: { filename: [{
|
|
437
448
|
type: i0.Input
|
|
438
449
|
}], code: [{
|
|
439
450
|
type: i0.Input
|
|
@@ -1465,8 +1476,6 @@
|
|
|
1465
1476
|
|
|
1466
1477
|
var TUI_DOC_CODE_EDITOR = new i0.InjectionToken("[TUI_DOC_CODE_EDITOR]: Contains service for opening online IDE e.g. Stackblitz");
|
|
1467
1478
|
|
|
1468
|
-
var TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = new i0.InjectionToken("[TUI_DOC_EXAMPLE_CONTENT_PROCESSOR]: Processes content in example", { factory: function () { return i9.identity; } });
|
|
1469
|
-
|
|
1470
1479
|
function tuiRawLoadRecord(example) {
|
|
1471
1480
|
return __awaiter(this, void 0, void 0, function () {
|
|
1472
1481
|
var processedContent, _a, _b, _c, key, content, _d, _e, e_1_1;
|
|
@@ -2805,6 +2814,7 @@
|
|
|
2805
2814
|
exports.TUI_DOC_DEMO_TEXTS = TUI_DOC_DEMO_TEXTS;
|
|
2806
2815
|
exports.TUI_DOC_DOCUMENTATION_TEXTS = TUI_DOC_DOCUMENTATION_TEXTS;
|
|
2807
2816
|
exports.TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = TUI_DOC_EXAMPLE_CONTENT_PROCESSOR;
|
|
2817
|
+
exports.TUI_DOC_EXAMPLE_MARKDOWN_CODE_PROCESSOR = TUI_DOC_EXAMPLE_MARKDOWN_CODE_PROCESSOR;
|
|
2808
2818
|
exports.TUI_DOC_EXAMPLE_TEXTS = TUI_DOC_EXAMPLE_TEXTS;
|
|
2809
2819
|
exports.TUI_DOC_EXCLUDED_PROPERTIES = TUI_DOC_EXCLUDED_PROPERTIES;
|
|
2810
2820
|
exports.TUI_DOC_LOGO = TUI_DOC_LOGO;
|