@startside/swa 1.0.1 → 1.0.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@startside/swa",
3
- "version": "1.0.1",
4
- "description": "The Startside Widget API (SWA): the runtime a widget file loads, its TypeScript types, its specification in Markdown, and a command to check a widget file and inline its runtime.",
3
+ "version": "1.0.3",
4
+ "description": "The Startside Widget API (SWA): the runtime a widget file loads, its TypeScript types, its specification in Markdown, and a command to check a widget file and inline its runtime, and what another host needs to run a widget in a frame.",
5
5
  "keywords": [
6
6
  "swa",
7
7
  "startside",
package/swa/1.0/agents.md CHANGED
@@ -123,29 +123,40 @@ What it shows, in order:
123
123
  | SHOULD NOT | Put fetched or typed text into markup (`innerHTML`, a `setBody` string) | 7.3 |
124
124
  | SHOULD | Keep a game in progress or the person's data in a hidden setting, read defensively, and under the host's limit if it grows (Startside: 20,000 characters a setting) | 7.5, 7.8 |
125
125
  | SHOULD | Let the host set the width; the height is the content's; never `100vh` | 7.3.2 |
126
+ | SHOULD | While it loads, show a placeholder at the size of what's coming (a skeleton of its rows, its picture's box), not a one-line "Loading…": the widget doesn't change size as its content arrives | 7.3.1 |
126
127
  | SHOULD | Make a board, a grid or a list moved through with the arrow keys one Tab stop, the keys heard on the widget's own element; a list of plain links, as above, keeps its links in the Tab order | 7.3.1, 14 |
128
+ | SHOULD | Mark where the keyboard lands when the host moves the focus into the widget, when that isn't its first control: `autofocus` on a game's board (`<div class="board" tabindex="0" autofocus>`). Call `preventDefault()` on the Escape and arrow keys it uses itself: left uncancelled, a host may use Escape to leave the widget and an arrow to go to the next | 6.8 |
127
129
  | SHOULD | Announce results and errors in a `role="status"` element present from the start, nothing as it first draws; keep the focus through updates | 14 |
128
130
  | SHOULD | Write colors with `light-dark()`, other dark-mode changes under `:root[data-color-scheme="dark"]`, not `prefers-color-scheme` | 4.7 |
129
131
  | SHOULD | Scope every rule under the widget's root class (`.news li`); give each host property a fallback, `var(--text, #222)`; avoid the host's class names (`loading`, `spinner`) | 4.7 |
130
132
  | SHOULD | Do nothing at rest: an animation that draws the eye plays a few times; timers only for what changes on screen | 7.3.1 |
131
133
  | SHOULD | Follow its width with a `ResizeObserver` on its own element when its layout depends on it | 7.3.2 |
132
134
  | SHOULD | Meet WCAG 2.2 AA: keyboard alone, names on controls, 4.5:1 text, `prefers-reduced-motion` | 14 |
135
+ | MUST | Show only pictures it may show (public domain, or a licence or permission that allows it), their required credits kept; a picture opened large carries its own: `widget.openPhoto({ src, alt, credit })` | 7.12 |
136
+ | MAY | Read an API that wants the person's own key: `<input type="password" name="key" data-key-for="https://api.example">` in the settings, then `widget.fetch` to that origin. The host keeps the key and adds `Authorization: Bearer`; the widget never sees it (`widget.settings.get('key')` is `''`), and a 401 or 403 means no key yet: say to add one in the settings | 5.3, 8.2 |
137
+ | MAY | Declare actions of its own for its options menu, in the file: `<menu id="actions" hidden>` with one `<button type="button" name="reset">Reset</button>` each, five at most (`disabled` or `hidden` as it starts, `data-confirm="…?"` for a question the host asks first). Answer the `action` event (`event.detail.id`), and change their state as the widget's does with `widget.setActionStates({ reset: { disabled: false } })` | 7.13 |
138
+ | MAY | Hand the person a file it makes, from one of those actions only: `data-save=".cook"` on its button, then `widget.saveFile({ name, type, data }, { action: event })` in its `action` listener | 7.13 |
139
+ | MAY | Take a file dragged from the computer onto it: `<meta name="acceptFiles" content=".gpx">` (the extensions it takes), then its own `dragover` (`preventDefault()`) and `drop` listeners; a file it doesn't take, left uncancelled, is refused, never opened. A file input (`<input type="file" accept=".gpx">`) beside it, for the keyboard and a phone | 4.5, 10.1 |
133
140
  | MAY | Carry its icon in the file: `<link rel="icon" href="data:image/svg+xml,…">`, kept when the file is shared by itself (best: an SVG drawn for 16 pixels, or a 64 × 64 PNG) | 4.6 |
134
141
 
135
142
  ## Checklist
136
143
 
144
+ - [ ] `npx @startside/swa validate name.swa.html` reports no error (Appendix F): it reads the file without running it.
137
145
  - [ ] It opens in a browser, from disk and from a server, with no error in the widget or the console.
138
146
  - [ ] Each setting changed in the menu (▾) applies, and Refresh keeps what it should.
139
147
  - [ ] It reads well light and dark, narrow (300 pixels) and wide, maximized: open it as
140
148
  `name.swa.html#mode=dark&width=300`, then light and wider.
141
- - [ ] Everything works with the keyboard alone; the focus is visible and never lost.
149
+ - [ ] Everything works with the keyboard alone; the focus is visible and never lost. A game plays with its keys once the
150
+ focus is on it, and the keys it doesn't use are left uncancelled.
142
151
  - [ ] Saved data from an older version, or edited by hand, doesn't break it.
143
152
  - [ ] Nothing moves or runs when nobody uses it.
144
153
 
145
154
  ## Next
146
155
 
147
156
  - The types, for an editor: `https://startside.app/swa/1.0/swa.d.ts` (Appendix F).
148
- - More examples: a blog (Example 4), a game (Example 6), a to-do list (Example 7), in Appendix A of the specification.
157
+ - The tools: the npm package `@startside/swa`, its `validate` and `inline` commands (Appendix F).
158
+ - More examples: a blog (Example 4), a game (Example 6), a to-do list with an action of its own in the options menu
159
+ (Example 7), in Appendix A of the specification.
149
160
 
150
161
  ---
151
162
 
@@ -175,6 +186,9 @@ licence (CC BY 4.0).*
175
186
  (`https://cdn.jsdelivr.net/npm/@startside/swa@1/swa/1.0/agents.md`). Served by jsDelivr and unpkg (4.3), installed
176
187
  with `npm install @startside/swa`. Since 1.0.1 too, a command, for Node 20 or later, with nothing else to install:
177
188
  `validate` and `inline`, below.
189
+ - **Running widgets in another page.** Since 1.0.3, `@startside/swa` also carries the runtime a host writes into a
190
+ widget's frame (`swa/1.0/frame.js`, SWA files only), its base styles (`frame.css`), and `host.md`: how a host runs a
191
+ frame (10.1), the configuration that runtime reads and the messages a host answers.
178
192
  - **Checking a file.** `npx @startside/swa validate my-widget.swa.html` reads a widget file without running it, with no
179
193
  network: the file's name and document, its runtime tag, metadata and settings form, and its scripts against this
180
194
  API, UWA's members and globals named with what replaces them. Each finding is `file:line:col: error|warning:
@@ -242,12 +256,18 @@ declare global {
242
256
  fullscreen: WidgetEvent<boolean>;
243
257
  /** Cancelable: canceling skips the refresh that follows. */
244
258
  settingschange: WidgetEvent<{ names: string[] }>;
259
+ /** One of the widget's own actions (declared in `<menu id="actions">`, 7.13) chosen in its options menu. */
260
+ action: WidgetEvent<{ id: string }>;
261
+ /** A picture opened with `openPhoto({ deletable: true, id })`, deleted by the person in the host's window. */
262
+ photodelete: WidgetEvent<{ id: string }>;
263
+ /** Its pictures (`storage.files`) changed: Sync, another copy of the page, or its own call. List them again. */
264
+ fileschange: WidgetEvent<null>;
245
265
  }
246
266
 
247
267
  interface Widget extends EventTarget {
248
268
  // 7.2 Identity and environment
249
269
  readonly id: string;
250
- /** The title shown: the person's name for the widget if they renamed it (then `settingschange` with `title`), else its own (7.3). */
270
+ /** The title shown: the widget's own, its file's `<title>` until it sets another (7.3). */
251
271
  readonly title: string;
252
272
  /** The widget file's address. */
253
273
  readonly uwaUrl: string;
@@ -305,8 +325,9 @@ declare global {
305
325
  clearPeriodical(name: string): void;
306
326
 
307
327
  // 7.7 Lists and grips
308
- countGrip(box: Element, itemSelector: string, options?: CountGripOptions): void;
309
- heightGrip(box: Element, scroller: Element, options?: HeightGripOptions): void;
328
+ /** `box` an HTML element: the grip sets its style. */
329
+ countGrip(box: HTMLElement, itemSelector: string, options?: CountGripOptions): void;
330
+ heightGrip(box: HTMLElement, scroller: HTMLElement, options?: HeightGripOptions): void;
310
331
 
311
332
  // 7.8 Memory and stored data
312
333
  readonly storage: WidgetStorage;
@@ -316,6 +337,11 @@ declare global {
316
337
  fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
317
338
  /** RSS, Atom or JSON Feed as a JSON Feed 1.1, kept by the host: a kept copy answers at once. */
318
339
  fetchFeed(url: string, options?: FetchFeedOptions): Promise<ContentFeed>;
340
+ /**
341
+ * A picture fetched by the host as itself (with its Referer; 8.6): an address to show in an `img`, the same for the
342
+ * same picture. https, a raster picture of 2 MB at most; rejects with a TypeError otherwise.
343
+ */
344
+ fetchImage(url: string, options?: { signal?: AbortSignal | null }): Promise<string>;
319
345
 
320
346
  // 7.10 Read state and counts
321
347
  readItems(box: Element, itemSelector: string, options?: { key?: (item: Element) => string }): void;
@@ -344,9 +370,12 @@ declare global {
344
370
  // 7.13 The page
345
371
  shareUrl(): string | null;
346
372
  share(data?: { text?: string; url?: string }): unknown;
373
+ /** Startside's extension: the page's Send to… for this widget; nothing where environment.people is null. */
374
+ sendTo(): void;
347
375
  /** Absent where no widget can be added (a preview, a widget on its own page): `if (widget.addWidget)`. */
348
376
  addWidget?(spec: AddWidgetSpec): unknown;
349
- dragWidget(element: Element, spec: AddWidgetSpec | (() => AddWidgetSpec)): boolean;
377
+ /** `spec`, or a function giving it as the drag starts, given the drag's event; nothing given, the drag doesn't start. */
378
+ dragWidget(element: Element, spec: AddWidgetSpec | ((event: DragEvent) => AddWidgetSpec | null | undefined)): boolean;
350
379
  readonly canFullSize: boolean;
351
380
  readonly fullSize: boolean;
352
381
  openFull(): void;
@@ -354,6 +383,30 @@ declare global {
354
383
  /** Full screen: the browser's, or the widget alone over the window where the browser has none (7.13). */
355
384
  readonly fullScreen: boolean;
356
385
  setFullScreen(on: boolean): void;
386
+ /**
387
+ * Changes the state of actions the file declares (`<menu id="actions">`, 7.13), by id: greyed, hidden, another
388
+ * label. An id the file doesn't declare throws a TypeError. States last while the widget runs.
389
+ */
390
+ setActionStates(states: Record<string, WidgetActionState>): void;
391
+ /**
392
+ * A file the widget made, for the person to keep (7.13): the host checks its name, its extension and its type,
393
+ * and delivers it. `options.action`: the `action` event of a choice of an action whose declaration carries
394
+ * `data-save`; one file per choice, within 30 seconds. Resolves once the host handed the file to the browser
395
+ * (not "saved"); rejects with a DOMException: NotAllowedError (no such choice, or already used), NotSupportedError
396
+ * (a name, an extension or a type the action or the host doesn't take), QuotaExceededError (over 8 MiB),
397
+ * AbortError (the person cancelled). Without `options.action`: NotAllowedError.
398
+ */
399
+ saveFile(file: WidgetSaveFile, options?: { action?: WidgetEvent<{ id: string }> }): Promise<void>;
400
+ }
401
+
402
+ /** A file a widget saves (7.13). */
403
+ interface WidgetSaveFile {
404
+ /** Its name, with its extension: one the action declares (`data-save`). The host cleans it. */
405
+ name: string;
406
+ /** Its type, one its extension takes ('' for the usual one): "text/plain;charset=utf-8". */
407
+ type: string;
408
+ /** Its content, 8 MiB at most (a string's as UTF-8); copied as the call is made. */
409
+ data: string | Blob | ArrayBuffer;
357
410
  }
358
411
 
359
412
  /** Settings typed by the control that declares them (7.5): a checkbox's a boolean, a range's or a number's a number. */
@@ -376,6 +429,31 @@ declare global {
376
429
  readonly memory: WidgetStorageArea;
377
430
  /** Across reloads, shared by every widget of the same file: scores. */
378
431
  readonly local: WidgetStorageArea;
432
+ /** Its own pictures, kept for good and the same on the person's other devices (synced): photos it took. */
433
+ readonly files: WidgetFiles;
434
+ }
435
+
436
+ /** A widget's pictures (7.8): JPEG, PNG, WebP or GIF, 10 MB each at most. */
437
+ interface WidgetFiles {
438
+ /** Every one, oldest first, from this device at once. */
439
+ list(): Promise<WidgetFile[]>;
440
+ /** Its bytes, from this device or the server; rejects `NotFoundError`, or `NetworkError` offline without them. */
441
+ get(id: string): Promise<Blob>;
442
+ /** Kept here at once, sent when the host can; its id. Rejects `TypeError` (not a picture, a meta not JSON or over 1,024 bytes), `RangeError` (over 10 MB). */
443
+ add(file: Blob, meta?: unknown): Promise<string>;
444
+ /** Deleted here and on the person's other devices. */
445
+ delete(id: string): Promise<void>;
446
+ }
447
+
448
+ interface WidgetFile {
449
+ readonly id: string;
450
+ /** `image/jpeg`, `image/png`, `image/webp` or `image/gif`, told by its bytes. */
451
+ readonly type: string;
452
+ readonly size: number;
453
+ /** When it was added, in milliseconds. */
454
+ readonly at: number;
455
+ /** What the widget gave `add`. */
456
+ readonly meta: unknown;
379
457
  }
380
458
 
381
459
  interface WidgetStorageArea {
@@ -391,6 +469,11 @@ declare global {
391
469
  readonly inline: boolean;
392
470
  /** The page's style, or "" standalone. */
393
471
  readonly style: string;
472
+ /**
473
+ * Startside's extension: who plays, in the beta's conversations (this person's name, and who sent this copy,
474
+ * null on their own page); null elsewhere.
475
+ */
476
+ readonly people: Readonly<{ me: string; from: string | null; to: string | null }> | null;
394
477
  }
395
478
 
396
479
  /** A setting as the file declares it: frozen, as `preferences` and `getPreference` give it. */
@@ -493,6 +576,20 @@ declare global {
493
576
  /** Played without a Referer, through the host's relay. */
494
577
  relay?: boolean;
495
578
  live?: boolean;
579
+ /**
580
+ * For a file (`live: false`): the files the host plays after it, each as the one before ends, with no further click,
581
+ * until a pause (7.12). `audioState.url` says which plays. 100 at most.
582
+ */
583
+ next?: NextAudio[];
584
+ }
585
+
586
+ interface NextAudio {
587
+ /** https */
588
+ url: string;
589
+ relay?: boolean;
590
+ /** What the host says plays as it starts (`audioInfo`'s title and artist). */
591
+ title?: string;
592
+ artist?: string;
496
593
  }
497
594
 
498
595
  interface AudioState {
@@ -503,6 +600,21 @@ declare global {
503
600
  /** Seconds, for a file. */
504
601
  time?: number | null;
505
602
  duration?: number | null;
603
+ /**
604
+ * A file (`live: false`) another widget of the page plays, playing or loading, else null. While this widget plays
605
+ * nothing itself, `pauseAudio` and `seekAudio` act on it; `playAudio` of a file another widget holds goes on there.
606
+ */
607
+ elsewhere?: ElsewhereAudio | null;
608
+ }
609
+
610
+ interface ElsewhereAudio {
611
+ url: string;
612
+ playing: boolean;
613
+ loading: boolean;
614
+ time: number | null;
615
+ duration: number | null;
616
+ /** Its `audioInfo`'s source. */
617
+ source: string | null;
506
618
  }
507
619
 
508
620
  interface AudioControls {
@@ -540,13 +652,57 @@ declare global {
540
652
  }
541
653
 
542
654
  interface PhotoSpec {
543
- src: string;
655
+ /** An `https` picture or one of the host's; `file` instead for one of the widget's own files. */
656
+ src?: string;
657
+ /** One of its own pictures (`storage.files`), by id: the host reads it, `src` aside. */
658
+ file?: string;
659
+ /** Its own pictures to step through from `file` (their ids, in order, 5,000 at most): ‹ › and the arrow keys. */
660
+ files?: string[];
544
661
  alt?: string;
545
662
  title?: string;
546
663
  preview?: string;
664
+ /** A larger picture of the same, asked only when the person zooms in. */
665
+ zoom?: string;
547
666
  width?: number;
548
667
  height?: number;
549
- credit?: string;
668
+ /** What the picture's licence asks to go with it. A plain string is its credit text. */
669
+ credit?: PhotoCredit | string;
670
+ /** The window offers Delete, which asks the person first; the widget hears it as `photodelete`. */
671
+ deletable?: boolean;
672
+ /** Given back in `photodelete`'s detail: which picture (100 characters at most). With `file`, the file's id instead. */
673
+ id?: string;
674
+ }
675
+
676
+ /**
677
+ * A picture's credit, in schema.org's ImageObject names (https://schema.org/ImageObject), every member optional.
678
+ * Addresses are `https`.
679
+ */
680
+ interface PhotoCredit {
681
+ /** The work's title. */
682
+ name?: string;
683
+ /** Who made it. */
684
+ creator?: string;
685
+ /** The credit line: who keeps or gives the picture (a museum, an agency). */
686
+ creditText?: string;
687
+ /** Who the licence says to name, as it asks ("Photo: …", "© …"). */
688
+ copyrightNotice?: string;
689
+ /** The licence's address. */
690
+ license?: string;
691
+ /** The picture's page at its source. */
692
+ url?: string;
693
+ }
694
+
695
+ /**
696
+ * What a running widget may change of an action its file declares (7.13). A field left out stays as it was; `null`
697
+ * puts it back to what the file declares.
698
+ */
699
+ interface WidgetActionState {
700
+ /** Greyed: nothing to act on. */
701
+ disabled?: boolean | null;
702
+ /** Not in the menu. */
703
+ hidden?: boolean | null;
704
+ /** Another label, 1 to 40 characters: a word that depends on its state, or a translation. */
705
+ label?: string | null;
550
706
  }
551
707
 
552
708
  interface AddWidgetSpec {
@@ -593,6 +749,7 @@ The full text: https://startside.app/swa/1.0/ (Markdown: https://startside.app/s
593
749
  - [6.5 Applying a setting](https://startside.app/swa/1.0/#65-applying-a-setting)
594
750
  - [6.6 Starting and refreshing](https://startside.app/swa/1.0/#66-starting-and-refreshing)
595
751
  - [6.7 Activation-gated operations](https://startside.app/swa/1.0/#67-activation-gated-operations)
752
+ - [6.8 The keyboard coming into a widget](https://startside.app/swa/1.0/#68-the-keyboard-coming-into-a-widget)
596
753
  - [7. The `Widget` interface](https://startside.app/swa/1.0/#7-the-widget-interface)
597
754
  - [7.1 The `widget` object](https://startside.app/swa/1.0/#71-the-widget-object)
598
755
  - [7.2 Identity and environment](https://startside.app/swa/1.0/#72-identity-and-environment)
@@ -615,6 +772,7 @@ The full text: https://startside.app/swa/1.0/ (Markdown: https://startside.app/s
615
772
  - [8.3 `widget.fetchFeed`](https://startside.app/swa/1.0/#83-widgetfetchfeed)
616
773
  - [8.4 Freshness](https://startside.app/swa/1.0/#84-freshness)
617
774
  - [8.5 Content feeds](https://startside.app/swa/1.0/#85-content-feeds)
775
+ - [8.6 `widget.fetchImage`](https://startside.app/swa/1.0/#86-widgetfetchimage)
618
776
  - [9. Built-in objects](https://startside.app/swa/1.0/#9-built-in-objects)
619
777
  - [10. Execution environments](https://startside.app/swa/1.0/#10-execution-environments)
620
778
  - [10.1 Framed](https://startside.app/swa/1.0/#101-framed)
@@ -0,0 +1,245 @@
1
+ /* Base styles for every widget, UWA, SWA and RWA, in its frame, inline and on its own page (the shared runtime, XWA:
2
+ docs/plans/xwa-rename.md), in the spirit of Netvibes' uwa-iframe.css,
3
+ using the dashboard skin's colors (the --variables are injected per frame). */
4
+ html,
5
+ body {
6
+ margin: 0;
7
+ padding: 0;
8
+ background: transparent;
9
+ }
10
+ body {
11
+ color: var(--text, #333);
12
+ font: 11px/1.45 var(--font-body, Verdana, Tahoma, Geneva, sans-serif);
13
+ overflow: hidden;
14
+ }
15
+ .moduleContent {
16
+ padding: 6px 8px;
17
+ }
18
+ /* A widget with viewport-fit=cover in its viewport meta draws to its edges (srcdoc.ts, runtime.js: uwa-cover; SWA 7.3.2). */
19
+ :root.uwa-cover .moduleContent {
20
+ padding: 0;
21
+ }
22
+ a {
23
+ color: var(--link, #1e5bb8);
24
+ text-decoration: none;
25
+ }
26
+ a:hover {
27
+ text-decoration: underline;
28
+ }
29
+ p {
30
+ margin: 0 0 6px;
31
+ }
32
+ ul {
33
+ margin: 0;
34
+ padding: 0;
35
+ list-style: none;
36
+ }
37
+ li {
38
+ padding: 2px 0 2px 12px;
39
+ position: relative;
40
+ }
41
+ li::before {
42
+ content: '';
43
+ position: absolute;
44
+ left: 2px;
45
+ top: 7px;
46
+ width: 4px;
47
+ height: 4px;
48
+ background: var(--link, #1e5bb8);
49
+ }
50
+ input,
51
+ select,
52
+ textarea,
53
+ button {
54
+ font: inherit;
55
+ }
56
+ table {
57
+ border-collapse: collapse;
58
+ font: inherit;
59
+ }
60
+ .buttonClean,
61
+ button {
62
+ cursor: pointer;
63
+ padding: 2px 10px;
64
+ border: 1px solid #8e99a6;
65
+ border-radius: 3px;
66
+ color: #222;
67
+ background: linear-gradient(#ffffff, #e8ecf1 50%, #d6dde5 51%, #e9edf2);
68
+ }
69
+ /* On a dark page the same glossy button, dark: unstyled buttons stayed pale grey with dark text there (found by an
70
+ agent's screenshot, November 2026). data-color-scheme is set on a frame's and the standalone page's root. It weighs
71
+ more than a widget's `.x`, which still wins: this file sits under the widget's rules everywhere, in a cascade layer
72
+ in a frame (srcdoc.ts) and on the widget's own page (server/widgetRuntime.ts), the widget's rules scoped by a doubled
73
+ id inline (inline.ts; issue #87). */
74
+ :root[data-color-scheme='dark'] .buttonClean,
75
+ :root[data-color-scheme='dark'] button {
76
+ border-color: #5c6672;
77
+ color: #e6e9ed;
78
+ background: linear-gradient(#3e4650, #313841 50%, #2a3038 51%, #323941);
79
+ }
80
+ .uwa-error {
81
+ margin: 0 0 6px;
82
+ padding: 4px 8px;
83
+ color: #b3261e;
84
+ background: #fdecea;
85
+ border-bottom: 1px solid #f3c1bc;
86
+ }
87
+ .nv-pager {
88
+ display: flex;
89
+ align-items: baseline;
90
+ gap: 10px;
91
+ margin-top: 6px;
92
+ padding-top: 5px;
93
+ border-top: 1px dotted var(--border, #ccc);
94
+ }
95
+ .nv-pager .status {
96
+ color: var(--muted, #888);
97
+ font-size: 10px;
98
+ }
99
+ .nv-pager .next {
100
+ margin-left: auto;
101
+ }
102
+ /* Keep images in proportion when a widget sets only their width. */
103
+ img {
104
+ max-width: 100%;
105
+ height: auto;
106
+ }
107
+ /* The dashboard's loading indicator (src/widgetBox/Loading.tsx and base.css), so a widget
108
+ can show the same one:
109
+ <div class="loading"><span class="spinner"><i/><i/><i/><i/><i/><i/><i/><i/></span>Loading…</div> */
110
+ .loading {
111
+ display: flex;
112
+ align-items: center;
113
+ gap: 6px;
114
+ padding: 10px 8px;
115
+ color: var(--muted, #888);
116
+ }
117
+ .spinner {
118
+ position: relative;
119
+ width: 16px;
120
+ height: 16px;
121
+ }
122
+ .spinner i {
123
+ position: absolute;
124
+ left: 7px;
125
+ top: 0;
126
+ width: 2px;
127
+ height: 5px;
128
+ border-radius: 1px;
129
+ background: var(--muted, #888);
130
+ transform-origin: 1px 8px;
131
+ animation: spin-fade 0.8s steps(1) infinite;
132
+ }
133
+ .spinner i:nth-child(1) {
134
+ transform: rotate(0deg);
135
+ animation-delay: -0.8s;
136
+ }
137
+ .spinner i:nth-child(2) {
138
+ transform: rotate(45deg);
139
+ animation-delay: -0.7s;
140
+ }
141
+ .spinner i:nth-child(3) {
142
+ transform: rotate(90deg);
143
+ animation-delay: -0.6s;
144
+ }
145
+ .spinner i:nth-child(4) {
146
+ transform: rotate(135deg);
147
+ animation-delay: -0.5s;
148
+ }
149
+ .spinner i:nth-child(5) {
150
+ transform: rotate(180deg);
151
+ animation-delay: -0.4s;
152
+ }
153
+ .spinner i:nth-child(6) {
154
+ transform: rotate(225deg);
155
+ animation-delay: -0.3s;
156
+ }
157
+ .spinner i:nth-child(7) {
158
+ transform: rotate(270deg);
159
+ animation-delay: -0.2s;
160
+ }
161
+ .spinner i:nth-child(8) {
162
+ transform: rotate(315deg);
163
+ animation-delay: -0.1s;
164
+ }
165
+ @keyframes spin-fade {
166
+ 0% {
167
+ opacity: 1;
168
+ }
169
+ 12.5% {
170
+ opacity: 0.8;
171
+ }
172
+ 25% {
173
+ opacity: 0.6;
174
+ }
175
+ 37.5% {
176
+ opacity: 0.45;
177
+ }
178
+ 50% {
179
+ opacity: 0.3;
180
+ }
181
+ 62.5%,
182
+ 100% {
183
+ opacity: 0.15;
184
+ }
185
+ }
186
+
187
+ /* A link that leaves the dashboard (a new tab on another site, not the reader): a small "open
188
+ in new" icon after its text, in its own color, faded. Widgets put it on their headlines. */
189
+ /* The icon takes no room of its own (margin-right cancels it) and the link's end padding holds
190
+ its place: the padding sticks to the last word, so the icon never wraps onto a line alone. */
191
+ .ext-link {
192
+ padding-right: 1.02em;
193
+ }
194
+ .ext-link::after {
195
+ content: '';
196
+ display: inline-block;
197
+ flex: none;
198
+ width: 0.72em;
199
+ height: 0.72em;
200
+ margin: 0 -1.02em 0 0.3em;
201
+ vertical-align: 0;
202
+ background: currentColor;
203
+ opacity: 0.45;
204
+ -webkit-mask: var(--ext-icon) no-repeat center / contain;
205
+ mask: var(--ext-icon) no-repeat center / contain;
206
+ --ext-icon: url('data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42L17.59 5H14V3zM5 5h6v2H5v12h12v-6h2v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z%27/%3E%3C/svg%3E');
207
+ }
208
+ .ext-link:hover::after {
209
+ opacity: 0.8;
210
+ }
211
+
212
+ /* The corner grip of list widgets (widget.countGrip): drag it down for more items, up for fewer. */
213
+ .count-grip {
214
+ position: absolute;
215
+ right: 0;
216
+ bottom: 0;
217
+ width: 20px;
218
+ height: 20px;
219
+ display: grid;
220
+ place-items: center;
221
+ cursor: ns-resize;
222
+ touch-action: none;
223
+ color: currentColor;
224
+ opacity: 0.35;
225
+ }
226
+ .count-grip:hover,
227
+ .count-grip-dragging .count-grip {
228
+ opacity: 0.9;
229
+ }
230
+ /* Focused from the keyboard (↑ ↓, Home, End): the grip at full strength in a ring of the text's colour. */
231
+ .count-grip:focus-visible {
232
+ opacity: 1;
233
+ outline: 2px solid currentColor;
234
+ outline-offset: -2px;
235
+ border-radius: 3px;
236
+ }
237
+ .count-grip svg {
238
+ width: 10px;
239
+ height: 10px;
240
+ }
241
+ .count-grip-dragging,
242
+ .count-grip-dragging * {
243
+ cursor: ns-resize !important;
244
+ user-select: none;
245
+ }