spell-ui 0.8.10 → 0.8.11

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.
@@ -117,3 +117,10 @@ export declare function indented(text: string, indent: string | number): string;
117
117
  * - Not for security, only for noticing a difference.
118
118
  */
119
119
  export declare function textChecksum(text: string): string;
120
+ /**
121
+ * Does `text` have Markdown in it: a heading, a list, a quote, a fence, bold or italic, code, a link?
122
+ * - So a plain message stays plain text, drawn exactly as before Markdown was asked for:
123
+ * Spell UI's dialogs and toasts (`ModalDialogs`, `ToastStack`) draw a `<ui-markdown>` only for one that has some.
124
+ * - Italic needs a mark against a word on both sides, so `5 * 3 * 2` and `snake_case_name` stay plain.
125
+ */
126
+ export declare function hasMarkdown(text: string): boolean;
@@ -7,8 +7,9 @@ import { E } from 'spell/ui/core';
7
7
  * - Markup: `<ui-modal size="tiny" closedby="closerequest" closable heading="title">` holding
8
8
  * - a `<ui-content>`: the message as a `<p>`, or for `prompt()` a `<label>` around it and an `<input>`
9
9
  * - `size`: the message's text size (`ui-font-size-big`), the title and buttons keeping theirs
10
- * - `markdown`, and the message has Markdown in it (`hasMarkdown()`):
11
- * a `<ui-markdown sanitized breaks>` instead of the `<p>`, its family imported the first time one is needed;
10
+ * - `markdown`, and the message has Markdown in it (`hasMarkdown()`, `spell/util/string`):
11
+ * a `<ui-markdown sanitized breaks>` instead of the `<p>` (`prompt()`'s, above its input, in its label),
12
+ * its family imported the first time one is needed;
12
13
  * the dialog shows once it has drawn, so it never opens on a half-drawn message
13
14
  * - `<ui-actions>`: a deny button (`cancel`, first: it takes the initial focus, the least destructive choice)
14
15
  * and a primary approve button.
@@ -60,12 +61,6 @@ export declare class ModalDialogs implements E.ModalProvider {
60
61
  * - rejects if the family can't be imported
61
62
  */
62
63
  private markdown;
63
- /**
64
- * Whether `message` has Markdown in it: a heading, a list, a quote, a fence, bold or italic, code, a link.
65
- * - So a plain message stays a plain `<p>`, drawn exactly as before `markdown` was asked for.
66
- * - Static: pure text.
67
- */
68
- static hasMarkdown(message: string): boolean;
69
64
  /**
70
65
  * Resolves once `markdown` has drawn (`ui-drawn`), or after `DRAW_WAIT` seconds whatever happened:
71
66
  * a message that can't draw still opens, showing its error.
@@ -73,7 +68,10 @@ export declare class ModalDialogs implements E.ModalProvider {
73
68
  private static drawn;
74
69
  /** `prompt()`'s text input, focused when the dialog opens. */
75
70
  private input;
76
- /** The message as the input's `<label>`, in the opt-in native look (`native.css`). */
71
+ /**
72
+ * The message as the input's `<label>`, in the opt-in native look (`native.css`).
73
+ * - `markdown`: the message drawn as Markdown (`markdown()`), in place of its plain words.
74
+ */
77
75
  private label;
78
76
  /** A `<ui-button>` with Fomantic's action class (`approve` / `cancel`). */
79
77
  private button;
@@ -44,6 +44,11 @@ export declare class UIModal extends DialogComponent<Vocabulary> {
44
44
  readonly group: "appearance";
45
45
  readonly kind: "keyOnly";
46
46
  readonly description: "The dark scheme.";
47
+ }, {
48
+ readonly name: "transparent";
49
+ readonly group: "appearance";
50
+ readonly kind: "keyOnly";
51
+ readonly description: string;
47
52
  }, {
48
53
  readonly name: "fullscreen";
49
54
  readonly group: "appearance";
@@ -47,6 +47,11 @@ export declare const modalVocabulary: {
47
47
  readonly group: "appearance";
48
48
  readonly kind: "keyOnly";
49
49
  readonly description: "The dark scheme.";
50
+ }, {
51
+ readonly name: "transparent";
52
+ readonly group: "appearance";
53
+ readonly kind: "keyOnly";
54
+ readonly description: string;
50
55
  }, {
51
56
  readonly name: "fullscreen";
52
57
  readonly group: "appearance";
@@ -14,6 +14,8 @@ import { E } from 'spell/ui/core';
14
14
  * - `class` words sort themselves: a `type` word, a hue (`color`) or `inverted`.
15
15
  * Every word also stays on the `<ui-toast>`,
16
16
  * so a page can theme one toast by its own class (the `--ui-toast-*` tokens).
17
+ * - `markdown`, and the message has Markdown in it (`hasMarkdown()`, `spell/util/string`):
18
+ * a `<ui-markdown sanitized breaks>` in its body instead of its `message`, its family imported the first time.
17
19
  * - Actions become `<ui-button slot="actions">`s:
18
20
  * Fomantic's `class` on the button (so `.positive` / `.deny` … still approve / deny),
19
21
  * its button words and hue as attributes.
@@ -37,6 +39,13 @@ export declare class ToastStack implements E.ToastProvider {
37
39
  dismiss(id: string): void;
38
40
  /** The `<ui-toast>` for `options`. */
39
41
  private toastFor;
42
+ /**
43
+ * `message` as a `<ui-markdown sanitized breaks>`, the toast's own content: its family imported the first time.
44
+ * - `sanitized`: the message may hold what someone typed, so raw HTML in it goes through DOMPurify.
45
+ * - `breaks`: each `\n` a line break, as the plain message has.
46
+ * - Its text is the element's text content, never markup.
47
+ */
48
+ private markdownFor;
40
49
  /**
41
50
  * The actions:
42
51
  * `<ui-button slot="actions">`s, or one `<ui-buttons slot="actions">` around them for `attached` layouts