@coolon/angular-ui-powerups 16.1.0-alpha.348 → 16.1.0-alpha.349

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.
@@ -4,6 +4,10 @@ import { MarkdownService } from '../../../services/markdown/markdown.service';
4
4
  import { DisposableComponent } from '../../disposable-component';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
+ * Renders Markdown into the page as HTML, with nothing sanitised: its content is trusted, as an i18n
8
+ * string is, and HTML in it is kept. Text a user typed belongs in it only inside a pill,
9
+ * "(({name}))", whose text is escaped (`markdownPillExtension`).
10
+ *
7
11
  * @example
8
12
  * <aup-markdown [content]="..."></aup-markdown>
9
13
  * <aup-markdown [content$]="stringValueModel$"></aup-markdown>
@@ -2,7 +2,11 @@ import * as i0 from "@angular/core";
2
2
  export declare class MarkdownService {
3
3
  render(content: string): string;
4
4
  renderInline(content: string): string;
5
- usePillExtension(renderer?: (content: string) => string): void;
5
+ /**
6
+ * Draws "((text))" as a pill (`markdownPillExtension`). [renderer] is given the pill's text
7
+ * HTML-escaped, and returns the pill's HTML.
8
+ */
9
+ usePillExtension(renderer?: (escapedText: string) => string): void;
6
10
  static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownService, never>;
7
11
  static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownService>;
8
12
  }
@@ -2,7 +2,23 @@ import { marked } from 'marked';
2
2
  import RendererThis = marked.RendererThis;
3
3
  import TokenizerThis = marked.TokenizerThis;
4
4
  import Tokens = marked.Tokens;
5
- export declare const markdownPillExtension: (renderPill: (text: string) => string) => {
5
+ /**
6
+ * Draws "((text))" in Markdown as a pill, with [renderPill]'s HTML.
7
+ *
8
+ * A pill's text may hold brackets of its own, as a file named "WDK_972P_APP (1).otap" or a group
9
+ * named "Loading dock (theirs)" does: brackets that pair up stay inside the pill, and it ends at the
10
+ * first "))" outside them. So "((Loading dock (theirs)))" is one pill of "Loading dock (theirs)",
11
+ * and "(see ((Night)))" a pill of "Night" inside a parenthetical. A ")" with no "(" to pair with
12
+ * ends the pill early when another ")" follows it: "((Lobby :)))" is a pill of "Lobby :". A "(" with
13
+ * no ")" to pair with leaves the brackets unpaired to the end, and the pill then ends at the first
14
+ * "))": "((Bay (north))" is a pill of "Bay (north". The pill used to end at the first "))" whatever
15
+ * came before, so a name ending in a bracket lost it.
16
+ *
17
+ * [renderPill] is given the text HTML-escaped, as Markdown escapes the text around it. The text is
18
+ * often a name a user typed, and the pill's HTML goes into the page as it is, so a name such as
19
+ * `<img src=x onerror=…>` would otherwise run in every message that names it.
20
+ */
21
+ export declare const markdownPillExtension: (renderPill: (escapedText: string) => string) => {
6
22
  name: string;
7
23
  level: string;
8
24
  start: (src: string) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "16.1.0-alpha.348",
3
+ "version": "16.1.0-alpha.349",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^16.2.9",
6
6
  "@angular/common": "^16.2.9",
@@ -12,7 +12,7 @@
12
12
  "@angular/platform-browser-dynamic": "^16.2.9",
13
13
  "@angular/material-moment-adapter": "^16.2.10",
14
14
  "@angular/router": "^16.2.9",
15
- "@coolon/pectin": "^5.0.0-alpha.152",
15
+ "@coolon/pectin": "^5.0.0-alpha.153",
16
16
  "fast-typescript-memoize": "^1.1.1",
17
17
  "lodash-es": "^4.17.21",
18
18
  "marked": "4.0.10",