1ch 0.4.0 → 0.6.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/README.md CHANGED
@@ -33,8 +33,8 @@ function DeployPanel() {
33
33
  <term-ui width="60" mode="dark">
34
34
  <section gap="1">
35
35
  <article title="deploy v2.4.1">
36
- <progress data-label="build" value={build} max="100"></progress>
37
- <progress data-label="tests" value="94" max="100"></progress>
36
+ <progress label="build" value={build} max="100"></progress>
37
+ <progress label="tests" value="94" max="100"></progress>
38
38
  </article>
39
39
  <figure height="4" fill>
40
40
  {metrics.map(v => <data value={v} />)}
@@ -67,7 +67,7 @@ Zero dependencies. Also does markdown and JSON (`source-format="markdown"` on th
67
67
  | Element | Becomes |
68
68
  |---------|---------|
69
69
  | `<article title="X">` | box |
70
- | `<figure>` | chart (text content, `<data>` children, or `data-values`) |
70
+ | `<figure>` | chart (text content, `<data>` children, or `values`) |
71
71
  | `<footer left="X" right="Y">` | status bar |
72
72
  | `<nav>` | horizontal stack |
73
73
  | `<progress>` | bar |
@@ -76,7 +76,7 @@ Zero dependencies. Also does markdown and JSON (`source-format="markdown"` on th
76
76
  | `<table>` | table |
77
77
  | `<section>`, `<div>` | container (layout from CSS) |
78
78
 
79
- `data-term="..."` and `term-*` tags available when you need to be explicit. Custom tag compilers via `registerHtmlTagCompiler()`. Full details in the [docs](https://1ch.app/docs).
79
+ Need custom behavior? Register your own compiler via `registerHtmlTagCompiler()`. Full details in the [docs](https://1ch.app/docs).
80
80
 
81
81
  ## License
82
82
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,11 @@
1
+ type MediaRef = {
2
+ tag: string;
3
+ src?: string;
4
+ alt?: string;
5
+ widthCells: number;
6
+ heightLines: number;
7
+ attrs?: Record<string, string>;
8
+ };
1
9
  type Style = {
2
10
  text: string;
3
11
  color?: string;
@@ -6,9 +14,11 @@ type Style = {
6
14
  dim?: boolean;
7
15
  inverted?: boolean;
8
16
  blink?: boolean;
17
+ interactionId?: string;
9
18
  onClick?: () => void;
10
19
  noSelect?: boolean;
11
20
  cell?: number;
21
+ media?: MediaRef;
12
22
  };
13
23
  type Segment = string | Style;
14
24
  type Line = Segment[];
@@ -360,6 +370,7 @@ type MarkdownThemeOverrides = Partial<ThemeMarkdown>;
360
370
 
361
371
  type TermAction = {
362
372
  type: "action";
373
+ key: string;
363
374
  id?: string;
364
375
  text: string;
365
376
  tag: string;
@@ -367,6 +378,7 @@ type TermAction = {
367
378
  sourceElement?: Element;
368
379
  } | {
369
380
  type: "link";
381
+ key: string;
370
382
  href?: string;
371
383
  text: string;
372
384
  tag: string;
@@ -478,6 +490,14 @@ type TermIRNode = {
478
490
  text: string;
479
491
  color?: string;
480
492
  action: TermAction;
493
+ } | {
494
+ kind: "media";
495
+ tag: string;
496
+ src?: string;
497
+ alt?: string;
498
+ widthCells?: number;
499
+ heightLines?: number;
500
+ attrs?: Record<string, string>;
481
501
  };
482
502
 
483
503
  type ActionSeed = {
@@ -584,9 +604,11 @@ declare class TermUIElement extends HTMLElement {
584
604
  private layoutOverride?;
585
605
  private resizeObserver?;
586
606
  private mutationObserver?;
607
+ private observedShadowRoots;
587
608
  private mediaQuery?;
588
609
  private mediaQueryListener?;
589
- private scheduled;
610
+ private renderQueued;
611
+ private renderFrameId;
590
612
  constructor();
591
613
  connectedCallback(): void;
592
614
  disconnectedCallback(): void;
@@ -595,6 +617,7 @@ declare class TermUIElement extends HTMLElement {
595
617
  get layout(): LayoutFn | undefined;
596
618
  set layout(next: LayoutFn | null | undefined);
597
619
  private queueRender;
620
+ private observeOpenShadowRoots;
598
621
  private onAction;
599
622
  private measureCharacterWidth;
600
623
  private resolveColumns;