release(tach-typography): v0.3.0
This commit is contained in:
@@ -56,21 +56,25 @@ export declare class TachTypographyHostPropsDirective implements OnChanges {
|
||||
static ɵfac: i0.ɵɵFactoryDeclaration<TachTypographyHostPropsDirective, never>;
|
||||
static ɵdir: i0.ɵɵDirectiveDeclaration<TachTypographyHostPropsDirective, "[tachTypographyHostProps]", never, { "tachTypographyHostProps": { "alias": "tachTypographyHostProps"; "required": false; }; }, {}, never, never, true, never>;
|
||||
}
|
||||
export declare class TachTypographyComponent {
|
||||
export declare class TachTypographyComponent implements OnChanges {
|
||||
hostTag: TachTypographyHostTag;
|
||||
variant: TypographyVariant;
|
||||
color: TypographyColor;
|
||||
weight: TypographyWeight;
|
||||
clickable: boolean;
|
||||
markdownEnabled: boolean;
|
||||
markdown: string | undefined;
|
||||
className: string | undefined;
|
||||
ellipsis: EllipsisOptions | undefined;
|
||||
nzProps: TachTypographyNzProps | undefined;
|
||||
hostProps: TachTypographyHostProps | undefined;
|
||||
preserveStyle: Record<string, string | number> | undefined;
|
||||
readonly tachClick: EventEmitter<MouseEvent>;
|
||||
renderedMarkdown: string;
|
||||
ngOnChanges(_changes: SimpleChanges): void;
|
||||
handleClick(event: MouseEvent): void;
|
||||
static ɵfac: i0.ɵɵFactoryDeclaration<TachTypographyComponent, never>;
|
||||
static ɵcmp: i0.ɵɵComponentDeclaration<TachTypographyComponent, "tach-typography", never, { "hostTag": { "alias": "as"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "weight": { "alias": "weight"; "required": false; }; "clickable": { "alias": "clickable"; "required": false; }; "className": { "alias": "className"; "required": false; }; "ellipsis": { "alias": "ellipsis"; "required": false; }; "nzProps": { "alias": "nzProps"; "required": false; }; "hostProps": { "alias": "hostProps"; "required": false; }; "preserveStyle": { "alias": "preserveStyle"; "required": false; }; }, { "tachClick": "tachClick"; }, never, ["*", "*", "*", "*", "*", "*", "*"], true, never>;
|
||||
static ɵcmp: i0.ɵɵComponentDeclaration<TachTypographyComponent, "tach-typography", never, { "hostTag": { "alias": "as"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "weight": { "alias": "weight"; "required": false; }; "clickable": { "alias": "clickable"; "required": false; }; "markdownEnabled": { "alias": "markdownEnabled"; "required": false; }; "markdown": { "alias": "markdown"; "required": false; }; "className": { "alias": "className"; "required": false; }; "ellipsis": { "alias": "ellipsis"; "required": false; }; "nzProps": { "alias": "nzProps"; "required": false; }; "hostProps": { "alias": "hostProps"; "required": false; }; "preserveStyle": { "alias": "preserveStyle"; "required": false; }; }, { "tachClick": "tachClick"; }, never, ["*", "*", "*", "*", "*", "*", "*"], true, never>;
|
||||
}
|
||||
export declare class TachTypographyNzModule {
|
||||
static ɵfac: i0.ɵɵFactoryDeclaration<TachTypographyNzModule, never>;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/angular/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,UAAU,EACV,YAAY,EAIZ,SAAS,EAET,SAAS,EACT,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,qBAAqB,EAAsB,MAAM,0BAA0B,CAAC;AAErF,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,SAAS,CAAC;;;AAEjB,MAAM,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;AAEjE,MAAM,WAAW,8BAA+B,SAAQ,uBAAuB;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CACjD;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACnF,KAAK,yBAAyB,CAAC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AQ,EAAE,eAAe,GAAG,SAAS,CAAC;IACtC,OAAO,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAC3C,SAAS,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAC/C,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS,CAAC;IAE1D,QAAQ,CAAC,SAAS,2BAAkC;IAE9D,gBAAgB,SAAM;IAEtB,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAM1C,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;yCAxBzB,uBAAuB;2CAAvB,uBAAuB;CA2BnC;AAED,qBAgBa,sBAAsB;yCAAtB,sBAAsB;0CAAtB,sBAAsB,+CApZtB,uBAAuB,SA0EvB,8BAA8B,SAyC9B,gCAAgC,SAoPhC,uBAAuB,yCAvWvB,uBAAuB,SA0EvB,8BAA8B,SAyC9B,gCAAgC,SAoPhC,uBAAuB;0CA6CvB,sBAAsB;CAAG"}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault } from "@angular/common";
|
||||
import { NgIf, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault } from "@angular/common";
|
||||
import { ChangeDetectionStrategy, Component, Directive, EventEmitter, inject, Input, NgModule, Output, } from "@angular/core";
|
||||
import { NzTypographyComponent, NzTypographyModule } from "ng-zorro-antd/typography";
|
||||
import { tachTypographyClassList, tachTypographyClassName, tachTypographyEllipsisStyle, } from "../core";
|
||||
import { tachTypographyClassList, tachTypographyClassName, tachTypographyEllipsisStyle, tachTypographyMarkdownToHtml, } from "../core";
|
||||
import * as i0 from "@angular/core";
|
||||
import * as i1 from "ng-zorro-antd/typography";
|
||||
const camelToKebab = (value) => value.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`);
|
||||
@@ -233,17 +233,25 @@ export class TachTypographyComponent {
|
||||
color = "primary";
|
||||
weight = "normal";
|
||||
clickable = false;
|
||||
markdownEnabled = false;
|
||||
markdown;
|
||||
className;
|
||||
ellipsis;
|
||||
nzProps;
|
||||
hostProps;
|
||||
preserveStyle;
|
||||
tachClick = new EventEmitter();
|
||||
renderedMarkdown = "";
|
||||
ngOnChanges(_changes) {
|
||||
this.renderedMarkdown = this.markdownEnabled
|
||||
? tachTypographyMarkdownToHtml(this.markdown ?? "")
|
||||
: "";
|
||||
}
|
||||
handleClick(event) {
|
||||
this.tachClick.emit(event);
|
||||
}
|
||||
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: TachTypographyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
||||
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: TachTypographyComponent, isStandalone: true, selector: "tach-typography", inputs: { hostTag: ["as", "hostTag"], variant: "variant", color: "color", weight: "weight", clickable: "clickable", className: "className", ellipsis: "ellipsis", nzProps: "nzProps", hostProps: "hostProps", preserveStyle: "preserveStyle" }, outputs: { tachClick: "tachClick" }, ngImport: i0, template: `
|
||||
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: TachTypographyComponent, isStandalone: true, selector: "tach-typography", inputs: { hostTag: ["as", "hostTag"], variant: "variant", color: "color", weight: "weight", clickable: "clickable", markdownEnabled: "markdownEnabled", markdown: "markdown", className: "className", ellipsis: "ellipsis", nzProps: "nzProps", hostProps: "hostProps", preserveStyle: "preserveStyle" }, outputs: { tachClick: "tachClick" }, usesOnChanges: true, ngImport: i0, template: `
|
||||
<ng-container [ngSwitch]="hostTag">
|
||||
<p
|
||||
*ngSwitchCase="'p'"
|
||||
@@ -259,7 +267,12 @@ export class TachTypographyComponent {
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentP">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentP>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</p>
|
||||
<a
|
||||
*ngSwitchCase="'a'"
|
||||
@@ -275,7 +288,12 @@ export class TachTypographyComponent {
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentA">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentA>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</a>
|
||||
<h1
|
||||
*ngSwitchCase="'h1'"
|
||||
@@ -291,7 +309,12 @@ export class TachTypographyComponent {
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentH1">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentH1>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</h1>
|
||||
<h2
|
||||
*ngSwitchCase="'h2'"
|
||||
@@ -307,7 +330,12 @@ export class TachTypographyComponent {
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentH2">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentH2>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</h2>
|
||||
<h3
|
||||
*ngSwitchCase="'h3'"
|
||||
@@ -323,7 +351,12 @@ export class TachTypographyComponent {
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentH3">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentH3>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</h3>
|
||||
<h4
|
||||
*ngSwitchCase="'h4'"
|
||||
@@ -339,7 +372,12 @@ export class TachTypographyComponent {
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentH4">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentH4>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</h4>
|
||||
<span
|
||||
*ngSwitchDefault
|
||||
@@ -355,10 +393,15 @@ export class TachTypographyComponent {
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentSpan">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentSpan>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</span>
|
||||
</ng-container>
|
||||
`, isInline: true, dependencies: [{ kind: "ngmodule", type: NzTypographyModule }, { kind: "component", type: i1.NzTypographyComponent, selector: " nz-typography, [nz-typography], p[nz-paragraph], span[nz-text], h1[nz-title], h2[nz-title], h3[nz-title], h4[nz-title] ", inputs: ["nzCopyable", "nzEditable", "nzDisabled", "nzExpandable", "nzEllipsis", "nzCopyTooltips", "nzCopyIcons", "nzEditTooltip", "nzEditIcon", "nzContent", "nzEllipsisRows", "nzType", "nzCopyText", "nzSuffix"], outputs: ["nzContentChange", "nzCopy", "nzExpandChange", "nzOnEllipsis"], exportAs: ["nzTypography"] }, { kind: "directive", type: TachTypographyDirective, selector: "[tachTypography]", inputs: ["tachTypography", "tachTypographyVariant", "tachTypographyColor", "tachTypographyWeight", "tachTypographyClickable", "tachTypographyClassName", "tachTypographyEllipsis"] }, { kind: "directive", type: TachTypographyNzPropsDirective, selector: "[tachTypographyNzProps]", inputs: ["tachTypographyNzProps"] }, { kind: "directive", type: TachTypographyHostPropsDirective, selector: "[tachTypographyHostProps]", inputs: ["tachTypographyHostProps"] }, { kind: "directive", type: NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
||||
`, isInline: true, dependencies: [{ kind: "ngmodule", type: NzTypographyModule }, { kind: "component", type: i1.NzTypographyComponent, selector: " nz-typography, [nz-typography], p[nz-paragraph], span[nz-text], h1[nz-title], h2[nz-title], h3[nz-title], h4[nz-title] ", inputs: ["nzCopyable", "nzEditable", "nzDisabled", "nzExpandable", "nzEllipsis", "nzCopyTooltips", "nzCopyIcons", "nzEditTooltip", "nzEditIcon", "nzContent", "nzEllipsisRows", "nzType", "nzCopyText", "nzSuffix"], outputs: ["nzContentChange", "nzCopy", "nzExpandChange", "nzOnEllipsis"], exportAs: ["nzTypography"] }, { kind: "directive", type: TachTypographyDirective, selector: "[tachTypography]", inputs: ["tachTypography", "tachTypographyVariant", "tachTypographyColor", "tachTypographyWeight", "tachTypographyClickable", "tachTypographyClassName", "tachTypographyEllipsis"] }, { kind: "directive", type: TachTypographyNzPropsDirective, selector: "[tachTypographyNzProps]", inputs: ["tachTypographyNzProps"] }, { kind: "directive", type: TachTypographyHostPropsDirective, selector: "[tachTypographyHostProps]", inputs: ["tachTypographyHostProps"] }, { kind: "directive", type: NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
||||
}
|
||||
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: TachTypographyComponent, decorators: [{
|
||||
type: Component,
|
||||
@@ -373,6 +416,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
||||
NgSwitch,
|
||||
NgSwitchCase,
|
||||
NgSwitchDefault,
|
||||
NgIf,
|
||||
NgStyle,
|
||||
],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
@@ -392,7 +436,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentP">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentP>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</p>
|
||||
<a
|
||||
*ngSwitchCase="'a'"
|
||||
@@ -408,7 +457,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentA">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentA>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</a>
|
||||
<h1
|
||||
*ngSwitchCase="'h1'"
|
||||
@@ -424,7 +478,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentH1">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentH1>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</h1>
|
||||
<h2
|
||||
*ngSwitchCase="'h2'"
|
||||
@@ -440,7 +499,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentH2">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentH2>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</h2>
|
||||
<h3
|
||||
*ngSwitchCase="'h3'"
|
||||
@@ -456,7 +520,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentH3">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentH3>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</h3>
|
||||
<h4
|
||||
*ngSwitchCase="'h4'"
|
||||
@@ -472,7 +541,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentH4">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentH4>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</h4>
|
||||
<span
|
||||
*ngSwitchDefault
|
||||
@@ -488,7 +562,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
||||
[ngStyle]="preserveStyle"
|
||||
(click)="handleClick($event)"
|
||||
>
|
||||
<ng-content />
|
||||
<ng-container *ngIf="markdownEnabled; else tachTypographyContentSpan">
|
||||
<span [innerHTML]="renderedMarkdown"></span>
|
||||
</ng-container>
|
||||
<ng-template #tachTypographyContentSpan>
|
||||
<ng-content />
|
||||
</ng-template>
|
||||
</span>
|
||||
</ng-container>
|
||||
`,
|
||||
@@ -504,6 +583,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
||||
type: Input
|
||||
}], clickable: [{
|
||||
type: Input
|
||||
}], markdownEnabled: [{
|
||||
type: Input
|
||||
}], markdown: [{
|
||||
type: Input
|
||||
}], className: [{
|
||||
type: Input
|
||||
}], ellipsis: [{
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,5 @@
|
||||
export * from "./types";
|
||||
export * from "./classnames";
|
||||
export * from "./ellipsis";
|
||||
export * from "./markdown";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from "./types";
|
||||
export * from "./classnames";
|
||||
export * from "./ellipsis";
|
||||
export * from "./markdown";
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
||||
2
packages/tach-typography/dist/angular/core/markdown.d.ts
vendored
Normal file
2
packages/tach-typography/dist/angular/core/markdown.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const tachTypographyMarkdownToHtml: (markdown: string) => string;
|
||||
//# sourceMappingURL=markdown.d.ts.map
|
||||
1
packages/tach-typography/dist/angular/core/markdown.d.ts.map
vendored
Normal file
1
packages/tach-typography/dist/angular/core/markdown.d.ts.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/core/markdown.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,4BAA4B,GAAI,UAAU,MAAM,KAAG,MAyC/D,CAAC"}
|
||||
47
packages/tach-typography/dist/angular/core/markdown.js
vendored
Normal file
47
packages/tach-typography/dist/angular/core/markdown.js
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
const TOKEN_PREFIX = "TACHMDTOKEN";
|
||||
const SAFE_HREF_PATTERN = /^(https?:|mailto:|tel:|\/|#)/i;
|
||||
const escapeHtml = (value) => value
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
const normalizeMarkdown = (value) => value.replace(/\r\n?/g, "\n");
|
||||
const sanitizeHref = (value) => {
|
||||
const href = value.trim();
|
||||
if (!href || !SAFE_HREF_PATTERN.test(href)) {
|
||||
return null;
|
||||
}
|
||||
return href;
|
||||
};
|
||||
export const tachTypographyMarkdownToHtml = (markdown) => {
|
||||
const source = normalizeMarkdown(markdown);
|
||||
const tokenMap = new Map();
|
||||
let tokenId = 0;
|
||||
const tokenized = source
|
||||
.replace(/`([^`\n]+)`/g, (_match, code) => {
|
||||
const token = `${TOKEN_PREFIX}${tokenId++}`;
|
||||
tokenMap.set(token, `<code class="tach-typography__md-code">${escapeHtml(code)}</code>`);
|
||||
return token;
|
||||
})
|
||||
.replace(/\[([^\]\n]+)\]\(([^)\n]+)\)/g, (_match, label, hrefRaw) => {
|
||||
const token = `${TOKEN_PREFIX}${tokenId++}`;
|
||||
const href = sanitizeHref(hrefRaw);
|
||||
if (!href) {
|
||||
tokenMap.set(token, escapeHtml(label));
|
||||
return token;
|
||||
}
|
||||
tokenMap.set(token, `<a class="tach-typography__md-link" href="${escapeHtml(href)}" target="_blank" rel="noopener noreferrer">${escapeHtml(label)}</a>`);
|
||||
return token;
|
||||
});
|
||||
let html = escapeHtml(tokenized)
|
||||
.replace(/\*\*([^*\n]+)\*\*/g, "<strong>$1</strong>")
|
||||
.replace(/__([^_\n]+)__/g, "<strong>$1</strong>")
|
||||
.replace(/\*([^*\n]+)\*/g, "<em>$1</em>")
|
||||
.replace(/_([^_\n]+)_/g, "<em>$1</em>")
|
||||
.replace(/~~([^~\n]+)~~/g, "<del>$1</del>")
|
||||
.replace(/\n/g, "<br />");
|
||||
html = html.replace(new RegExp(`${TOKEN_PREFIX}\\d+`, "g"), token => tokenMap.get(token) || token);
|
||||
return html;
|
||||
};
|
||||
//# sourceMappingURL=markdown.js.map
|
||||
1
packages/tach-typography/dist/angular/core/markdown.js.map
vendored
Normal file
1
packages/tach-typography/dist/angular/core/markdown.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../../src/core/markdown.ts"],"names":[],"mappings":"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