@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/LICENSE +7 -6
- package/README.md +15 -4
- package/bin/swa.mjs +10 -10
- package/package.json +2 -2
- package/swa/1.0/agents.md +166 -8
- package/swa/1.0/frame.css +245 -0
- package/swa/1.0/frame.js +4 -0
- package/swa/1.0/host.md +126 -0
- package/swa/1.0/quickstart.md +13 -2
- package/swa/1.0/runtime.js +3 -3
- package/swa/1.0/spec.md +429 -46
- package/swa/1.0/swa.d.ts +148 -6
package/swa/1.0/spec.md
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
<dl>
|
|
6
6
|
<dt>This version:</dt><dd><a href="https://startside.app/swa/1.0/">https://startside.app/swa/1.0/</a> (Markdown: <a href="https://startside.app/swa/1.0/spec.md">spec.md</a>; for agents: <a href="https://startside.app/swa/1.0/agents.md">agents.md</a>)</dd>
|
|
7
|
-
<dt>Previous version:</dt><dd><a href="https://startside.app/uwa/1.2/spec.md">Universal Widget API (UWA) 1.2.4</a>, Netvibes, 2008–2010</dd>
|
|
8
|
-
<dt>Specifications built on this one:</dt><dd><a href="https://startside.app/rwa/1.0/spec.md">React Widget API (RWA) 1.0</a></dd>
|
|
9
7
|
<dt>Editor:</dt><dd>François Hodierne (Startside)</dd>
|
|
10
8
|
<dt>Licence:</dt><dd>© 2026 François Hodierne. This document is shared under the <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International</a> licence (CC BY 4.0).</dd>
|
|
11
9
|
<dt>Implementation:</dt><dd>Startside, <a href="https://startside.app/">startside.app</a> (its status: <a href="#appendix-c-implementation-status-and-features-at-risk">Appendix C</a>)</dd>
|
|
@@ -22,7 +20,8 @@ settings; its scripts draw it through one object, `widget`, which gives it the h
|
|
|
22
20
|
settings and memory, a shared article reader, read and unread items, kept content, the page's audio and video
|
|
23
21
|
players, sharing, and its accounts. Hosts run widgets in sandboxed frames, under the same rules for every author.
|
|
24
22
|
|
|
25
|
-
SWA is
|
|
23
|
+
SWA is a successor of the [Universal Widget API (UWA) 1.2](https://startside.app/uwa/1.2/spec.md) (Netvibes, 2008–2010), whose JavaScript interface
|
|
24
|
+
it keeps.
|
|
26
25
|
|
|
27
26
|
**New to SWA?** [SWA in 60 lines](https://startside.app/swa/1.0/quickstart.md) has a complete widget, the rules as a table and a checklist;
|
|
28
27
|
this document is the reference behind it.
|
|
@@ -166,7 +165,7 @@ instantiated many times.</dd>
|
|
|
166
165
|
<dd>The runtime script running a widget file opened on its own, at its URL or from disk.</dd>
|
|
167
166
|
|
|
168
167
|
<dt><a id="dfn-trusted"></a><b>trusted</b></dt>
|
|
169
|
-
<dd>A widget file served from the host's own widget directory (in Startside, <code>/
|
|
168
|
+
<dd>A widget file served from the host's own widget directory (in Startside, <code>/xwa/</code>). Any other file is
|
|
170
169
|
<b>untrusted</b>: one from another site, or dropped from the person's computer.</dd>
|
|
171
170
|
|
|
172
171
|
<dt><a id="dfn-setting"></a><b>setting</b></dt>
|
|
@@ -319,7 +318,9 @@ optional.
|
|
|
319
318
|
<tr><td><code>feed</code></td><td>a URL template</td><td>The feed it reads (section 6.4)</td></tr>
|
|
320
319
|
<tr><td><code>accountService</code></td><td>a service name</td><td>The service of its account (section 7.13)</td></tr>
|
|
321
320
|
<tr><td><code>accountScope</code></td><td>permissions, space-separated</td><td>Only accounts allowing one of them are offered</td></tr>
|
|
321
|
+
<tr><td><code>acceptFiles</code></td><td>file extensions, space-separated (<code>.gpx</code>)</td><td>It takes a file dragged from the computer onto it: a host lets the drag reach the widget rather than its own page (10.1). The extensions are what it takes, a hint as <code>accept</code> on a file input is: what is dragged has no name until it is dropped, so the widget checks the file it gets</td></tr>
|
|
322
322
|
<tr><td><code>debugMode</code></td><td><code>true</code></td><td><code>widget.log</code> writes to the console</td></tr>
|
|
323
|
+
<tr><td><code>export</code></td><td><code>false</code></td><td>Not sent as a file: a host offers no way to send this widget with its settings to someone else, and refuses a file claiming it. For a widget showing its signed-in account's own data, which means nothing without it</td></tr>
|
|
323
324
|
</tbody>
|
|
324
325
|
</table>
|
|
325
326
|
|
|
@@ -352,7 +353,7 @@ elements carry plain class names (`title`, `options`, `hint`), which an unscoped
|
|
|
352
353
|
| class `uwa-full-window` on the root | the widget is full screen, alone over the window, whatever its `maximize` says |
|
|
353
354
|
| custom properties `--module-color`, `--module-paper` | the person gave the widget a palette color: its shade, and a pastel of it |
|
|
354
355
|
| custom properties `--text`, `--muted`, `--link`, `--link-visited`, `--widget-bg`, `--border`, `--hover` | always: the page style's colors |
|
|
355
|
-
| custom properties `--accent`, `--accent-ink`, `--accent-glow` | always: the page's accent
|
|
356
|
+
| custom properties `--accent`, `--accent-ink`, `--accent-glow` | always: the page's accent; its ink, the accent darkened until it reads at 4.5:1 or more on white (for text and lines in the accent's hue on a light ground; white text reads as well on it as a fill); its glow, the accent lightened until it reads at 4.5:1 or more on a dark ground (the same, in the dark). Not text to set on `--accent` itself, which may be pale (a yellow); changed in place, the widget not restarted, when the person picks another accent (a widget reads them in its CSS, not once in script) |
|
|
356
357
|
| custom property `--font-body` | always: the page style's font family |
|
|
357
358
|
|
|
358
359
|
The root is the widget's `html` element, framed and on its own page; a selector such as
|
|
@@ -448,7 +449,9 @@ attribute is the empty string.
|
|
|
448
449
|
|
|
449
450
|
The setting's **label** is the text content of the `label` element containing the control, without the text of the
|
|
450
451
|
controls inside it; else that of the `label` whose `for` is the control's `id`; else its `aria-label`; else its name.
|
|
451
|
-
Labels **SHOULD** be short and in English
|
|
452
|
+
Labels **SHOULD** be short and in English, and **SHOULD NOT** end with a colon: the host shows a label as it
|
|
453
|
+
likes, a colon after it or none (*Week starts on*, not *Week starts on:*). A host **MUST** drop a colon that ends a
|
|
454
|
+
label.
|
|
452
455
|
|
|
453
456
|
### 5.3 Attributes
|
|
454
457
|
|
|
@@ -457,8 +460,12 @@ Labels **SHOULD** be short and in English.
|
|
|
457
460
|
| `data-hint` | any control | A text completing the label, which the host shows on request beside it |
|
|
458
461
|
| `data-when` | any control | A **condition**, `name=value`, `name=a\|b` or `name!=value`: the setting is shown only while it holds. A hidden setting keeps its value. An unreadable condition is ignored |
|
|
459
462
|
| `data-commit="ok"` | a `text` control | Its value applies only when confirmed (section 6.5) |
|
|
463
|
+
| `data-key-for` | a `password` control | An `https` origin, no path (`https://api.example`): the setting is the person's **key for that site**. The host keeps the key and adds it to the widget's `widget.fetch` requests to that origin (section 8.2); the widget never receives it, and reads the setting as an empty string. The file gives the control no `value` |
|
|
460
464
|
| `data-share` | a `hidden` control | A shared link may carry its value |
|
|
465
|
+
| `data-send` | a `hidden` control | Its value goes with the widget when it's sent to someone (a host's conversations); every other hidden value stays home. A game's result, never its progress |
|
|
461
466
|
| `data-load` | a `hidden` control with `data-share` | A label, at most 40 characters: a person who already has the widget is offered a button with it, loading the shared value into their copy |
|
|
467
|
+
| `maxlength` | a `hidden` control with `data-share` | The longest value a shared link may carry for it, line breaks and tabs included (a whole text); a host **MAY** cap it (Startside: 16,000). Without it, a short value with no line breaks |
|
|
468
|
+
| `data-file` | a `hidden` control | File extensions, space-separated (`.cook`): a file of one of them, opened in the host (dropped on the page, chosen), makes this widget with the file's text as this setting's value; a host that exports a widget as files **SHOULD** write this setting's value as a file of that extension rather than among the settings. *At risk* (Appendix C) |
|
|
462
469
|
| `data-feed` | an `option` | The feed of that choice (section 6.4); `none`: the choice has no feed |
|
|
463
470
|
|
|
464
471
|
A `button` or `input` with `type="submit"` in the settings form asks the host for a button confirming the settings,
|
|
@@ -542,7 +549,8 @@ When the person changes a setting, the host applies it:
|
|
|
542
549
|
If `livePreferences` is `false`, every change waits for the settings to close; if `instant`, changes apply at once,
|
|
543
550
|
ungrouped. Applying settings stores the values, then **refreshes** the widget (6.6).
|
|
544
551
|
|
|
545
|
-
A password setting's value **MUST NOT** be given to a framed widget, nor carried by a link.
|
|
552
|
+
A password setting's value **MUST NOT** be given to a framed widget, nor carried by a link. A key for a site
|
|
553
|
+
(`data-key-for`, 5.3) **MUST NOT** be given to the widget in any environment; the host uses it only as section 8.2 says.
|
|
546
554
|
|
|
547
555
|
### 6.6 Starting and refreshing
|
|
548
556
|
|
|
@@ -601,6 +609,52 @@ back for 1 second instead of an activation's 5: a browser on a touch screen may
|
|
|
601
609
|
> **Note:** A tap in a widget within 5 seconds of a click on the host's page, or 1 second of a tap on it, is ignored: a
|
|
602
610
|
> host can't tell it from a frame taking the focus.
|
|
603
611
|
|
|
612
|
+
### 6.8 The keyboard coming into a widget
|
|
613
|
+
|
|
614
|
+
A host that lets people go from widget to widget with the keyboard **MAY** move the focus into a widget's document
|
|
615
|
+
on a key of its own. When it does, the focus goes to:
|
|
616
|
+
|
|
617
|
+
1. the first element of the widget's body that has the `autofocus` attribute [[HTML](#ref-html)], if it can take the
|
|
618
|
+
focus;
|
|
619
|
+
2. else the first element inside that one that can (a grid whose cells take the focus in turn);
|
|
620
|
+
3. else the first element of the widget's body that can;
|
|
621
|
+
4. else the document itself.
|
|
622
|
+
|
|
623
|
+
An element can take the focus here when it is shown, not disabled, and in the sequential focus order. A host
|
|
624
|
+
**SHOULD NOT** let `autofocus` take the focus as a widget loads among others; on a widget's own page the browser's
|
|
625
|
+
own behaviour applies.
|
|
626
|
+
|
|
627
|
+
The focus given this way is given by the host (6.7): what the person then does in the widget counts as theirs.
|
|
628
|
+
|
|
629
|
+
A host **MAY** take the focus back, to its own control for the widget, on an `Escape` `keydown` that reaches the
|
|
630
|
+
widget's `window` uncancelled, with no modifier, while the widget's document has the focus. A widget that uses
|
|
631
|
+
Escape itself (to close a panel of its own) calls `preventDefault()` on it.
|
|
632
|
+
|
|
633
|
+
A host **MUST NOT** act on these keys for a widget that took the focus by itself (6.7): only for one that was given it,
|
|
634
|
+
by the person or by the host. It decides once the event's dispatch is over, whichever listener cancels it.
|
|
635
|
+
|
|
636
|
+
A host **MAY** give a widget that has the focus the directions of a game controller it reads itself (its D-pad) as
|
|
637
|
+
arrow keys: a `keydown` event as a direction is pressed and a `keyup` as it is let go, with `key` and `code` set to
|
|
638
|
+
`ArrowUp`, `ArrowDown`, `ArrowLeft` or `ArrowRight`, dispatched on the widget's focused element (its `body` with none);
|
|
639
|
+
a back button of its choice as `Escape`, and an action button of the controller as `Enter`, after whose uncancelled `keydown` the host activates the focused
|
|
640
|
+
element when it is a button or a link (its `click()`).
|
|
641
|
+
These events are not trusted (`isTrusted` is false) and trigger no default action of the browser's: a widget that
|
|
642
|
+
handles the arrow keys in its own listeners needs nothing more to be played with a controller.
|
|
643
|
+
|
|
644
|
+
When a host gives the focus back to a widget after a window of the host's that the widget opened (7's `openPhoto`,
|
|
645
|
+
`openItems` and the like) closes, the focus **SHOULD** return to the element of the widget that had it; if that element
|
|
646
|
+
is gone, to where the keyboard comes in (the steps above).
|
|
647
|
+
|
|
648
|
+
A host **MAY** likewise act on an arrow key's `keydown` that reaches the widget's `window` uncancelled, with no
|
|
649
|
+
modifier (moving to the next widget that way), unless the event's target is, or is inside, an element where the
|
|
650
|
+
browser uses arrows itself: a text field, a `select`, an editable element, a media element, an element with the role
|
|
651
|
+
`slider`, `spinbutton`, `listbox`, `combobox`, `menu`, `menubar`, `tablist`, `radiogroup`, `tree`, `grid` or
|
|
652
|
+
`application`, or an element that can still scroll that way. A widget that uses the arrows itself (a game's moves)
|
|
653
|
+
calls `preventDefault()` on them.
|
|
654
|
+
|
|
655
|
+
> **Note:** A game marks its board: `<div class="board" tabindex="0" autofocus>`. A widget whose first control is
|
|
656
|
+
> already the one to use needs nothing.
|
|
657
|
+
|
|
604
658
|
## 7. The `Widget` interface
|
|
605
659
|
|
|
606
660
|
### 7.1 The `widget` object
|
|
@@ -648,8 +702,8 @@ interface Widget : EventTarget {
|
|
|
648
702
|
undefined clearPeriodical(DOMString name);
|
|
649
703
|
|
|
650
704
|
// 7.7 Lists and grips
|
|
651
|
-
undefined countGrip(
|
|
652
|
-
undefined heightGrip(
|
|
705
|
+
undefined countGrip(HTMLElement box, DOMString itemSelector, optional CountGripOptions options = {});
|
|
706
|
+
undefined heightGrip(HTMLElement box, HTMLElement scroller, optional HeightGripOptions options = {});
|
|
653
707
|
|
|
654
708
|
// 7.8 Memory and stored data
|
|
655
709
|
readonly attribute WidgetStorage storage;
|
|
@@ -657,6 +711,7 @@ interface Widget : EventTarget {
|
|
|
657
711
|
// 8 Data access
|
|
658
712
|
Promise<Response> fetch(RequestInfo input, optional RequestInit init = {});
|
|
659
713
|
Promise<ContentFeed> fetchFeed(USVString url, optional FetchFeedOptions options = {});
|
|
714
|
+
Promise<USVString> fetchImage(USVString url, optional FetchFeedOptions options = {});
|
|
660
715
|
|
|
661
716
|
// 7.10 Read state and counts
|
|
662
717
|
undefined readItems(Element box, DOMString itemSelector, optional ReadItemsOptions options = {});
|
|
@@ -684,14 +739,17 @@ interface Widget : EventTarget {
|
|
|
684
739
|
// 7.13 The page
|
|
685
740
|
USVString? shareUrl();
|
|
686
741
|
any share(optional ShareData data = {});
|
|
742
|
+
undefined sendTo();
|
|
687
743
|
any addWidget(AddWidgetSpec spec);
|
|
688
|
-
boolean dragWidget(Element element, (AddWidgetSpec or
|
|
744
|
+
boolean dragWidget(Element element, (AddWidgetSpec or DragWidgetCallback) spec);
|
|
689
745
|
readonly attribute boolean canFullSize;
|
|
690
746
|
readonly attribute boolean fullSize;
|
|
691
747
|
undefined openFull();
|
|
692
748
|
undefined closeFull();
|
|
693
749
|
readonly attribute boolean fullScreen;
|
|
694
750
|
undefined setFullScreen(boolean on);
|
|
751
|
+
undefined setActionStates(record<DOMString, WidgetActionState> states);
|
|
752
|
+
Promise<undefined> saveFile(WidgetSaveFile file, optional WidgetSaveOptions options = {});
|
|
695
753
|
};
|
|
696
754
|
```
|
|
697
755
|
|
|
@@ -739,13 +797,15 @@ dictionary WidgetSettingOption {
|
|
|
739
797
|
};
|
|
740
798
|
```
|
|
741
799
|
|
|
742
|
-
- `id`: the widget's identifier, unique on the page. `title`: the title it's shown under,
|
|
743
|
-
they renamed it, else its own (7.3). `uwaUrl`: its file's URL. `lang`,
|
|
800
|
+
- `id`: the widget's identifier, unique on the page. `title`: the title it's shown under, its own (7.3). `uwaUrl`: its file's URL. `lang`,
|
|
744
801
|
`locale`: the person's language (`en_US`) and region (`us`), in UWA's form, kept (11): a language tag for `Intl` is
|
|
745
802
|
`widget.lang.replace('_', '-')`. `metas`: its metadata. `preferences`: its setting
|
|
746
803
|
declarations.
|
|
747
804
|
- `environment.style` names the page's style (in Startside: `classic`, `early`, `coriander`, `ginger`, `mac`, `aw`,
|
|
748
805
|
`neo`, `modern`). A framed widget is rebuilt when it changes.
|
|
806
|
+
- `environment.people` (a host's extension, Startside's conversations): `{ me, from, to }`, the person's name, for a copy someone sent them the sender's name, for a copy they
|
|
807
|
+
sent the recipient's (`null` on their own page); `null` where the host has no conversations or
|
|
808
|
+
the person isn't in them. A widget may key what it sends by name (`data-send`) and tell a received copy's from its own.
|
|
749
809
|
- `log(…)` writes its arguments to the console when `debugMode` is `true`.
|
|
750
810
|
|
|
751
811
|
### 7.3 Content and title
|
|
@@ -766,12 +826,11 @@ dictionary WidgetSettingOption {
|
|
|
766
826
|
- `createElement(tagName, attributes)` returns a new `HTMLElement` (section 9). In *attributes*,
|
|
767
827
|
`class` sets its class, `styles` its style, `events` its listeners, and any other key an attribute.
|
|
768
828
|
- `setTitle(title)` sets the title shown in its title bar. *title* may contain `a` elements with `http` or `https`
|
|
769
|
-
addresses, shown as links; any other markup is reduced to its text. It is kept as the widget's title
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
toy, in a heading) redraws it there.
|
|
829
|
+
addresses, shown as links; any other markup is reduced to its text. It is kept as the widget's title and shown: a
|
|
830
|
+
widget's title is its own, and the host offers no way of its own to rename it. Until the widget sets one, its title
|
|
831
|
+
is its file's `title` element. `widget.title` is the title shown, its links' markup included; `getTitle()` returns
|
|
832
|
+
its text. A widget that lets the person name it declares a setting named `title` (7.5) and uses it as it sees fit:
|
|
833
|
+
in its title bar (`setTitle` with it), lettered on a toy, in a heading.
|
|
775
834
|
- `setStyle(css)` adds a style sheet for the widget.
|
|
776
835
|
|
|
777
836
|
#### 7.3.1 Drawing in place
|
|
@@ -781,6 +840,11 @@ dictionary WidgetSettingOption {
|
|
|
781
840
|
- **Every state in the skeleton.** The content, and what shows while loading, when there is nothing, and after a
|
|
782
841
|
failure, are elements of the skeleton, shown or hidden with the `hidden` attribute. A style giving one of them a
|
|
783
842
|
`display` overrides `hidden`: add `.x[hidden] { display: none; }`.
|
|
843
|
+
- **Loading at its size.** What shows while loading has the shape and size of what is coming: a skeleton of its
|
|
844
|
+
rows, its picture's box at its proportions, its title's line. A widget that is a line of "Loading…" until its
|
|
845
|
+
content arrives jumps as it draws, and moves the page around it; one drawn from what it kept (7.8, 7.9) shows no
|
|
846
|
+
placeholder at all. On a first load the host knows no height to hold for it: the widget's own placeholder is all
|
|
847
|
+
there is.
|
|
784
848
|
- **Repeated items from a `template`.** A list's row, a grid's cell: a `template` element in the skeleton, its content
|
|
785
849
|
cloned for each item (`template.content.firstElementChild.cloneNode(true)`).
|
|
786
850
|
- **Parts found under `widget.body`.** In the `load` listener, `widget.body.querySelector('.count')`: on its own page
|
|
@@ -880,17 +944,21 @@ interface WidgetSettings {
|
|
|
880
944
|
choice made in the widget itself): a boolean for a checkbox, a finite number for a `range` or `number` field, else
|
|
881
945
|
anything, converted to a string (`null` and `undefined` to `""`). A value of the wrong type, or a name the form doesn't declare, throws a
|
|
882
946
|
`TypeError`. `settings.reset(name)` restores the declared default.
|
|
883
|
-
- **`title
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
widget's own give it its own title back. The host saves it; no event fires and no refresh follows (the widget made
|
|
888
|
-
the change). A host **MAY** limit a setting's length (the
|
|
947
|
+
- **`title`**: declaring a setting of that name is how a widget offers the person to name it (7.3); it is then a
|
|
948
|
+
setting like any other, which the widget uses as it sees fit. Undeclared, `settings.get('title')` returns the title
|
|
949
|
+
shown, as text, read-only: `settings.set('title', …)` and `settings.reset('title')` throw a `TypeError`, as for any
|
|
950
|
+
undeclared name. A host **MAY** limit a setting's length (the
|
|
889
951
|
Appendix gives Startside's); a value over it isn't kept: `settings.get` returns it until the widget reloads, and the
|
|
890
952
|
host **SHOULD** say so in the widget's console. A widget keeping something that grows (a drawing, a long game) keeps it
|
|
891
953
|
under the limit itself.
|
|
954
|
+
- **`countInTab`**: a checkbox of that name lets the person choose whether the widget's unread count (7.10) adds up in
|
|
955
|
+
the host's totals (Startside: its tab's count, and an installed app's badge, the sum of the tabs'). Unticked, the host
|
|
956
|
+
**MUST** still show the count after the widget's title, and **MUST NOT** add it to those totals, nor make the widget's
|
|
957
|
+
items read when a total is activated. Undeclared, the count adds up. The checkbox **MUST** be declared `checked`: the
|
|
958
|
+
count adds up until the person unticks it (a host reads only a value the person saved). It suits a count the person
|
|
959
|
+
can't bring to zero in the widget (a mailbox's unread mail, read elsewhere).
|
|
892
960
|
- When the person applies settings (6.5), the host fires `settingschange` (7.6), its `detail.names` the settings whose
|
|
893
|
-
values changed
|
|
961
|
+
values changed; canceling it skips the refresh that follows, for a
|
|
894
962
|
widget that applies them in place. Nothing
|
|
895
963
|
changed (an OK with the same values): no event, the refresh as before.
|
|
896
964
|
- `refresh()` refreshes the widget as applying settings does (6.6): for a setting the widget changed with its own
|
|
@@ -948,7 +1016,11 @@ and ends its part of the load as settling does.
|
|
|
948
1016
|
| `videostate` | `videoState` changed | the new `VideoState`, or null | no | `onVideoState` |
|
|
949
1017
|
| `fullsize` | it was maximized or restored, its box at its new size | `fullSize`'s new value | no | `onFullSize` |
|
|
950
1018
|
| `fullscreen` | it went full screen or left it, after `fullsize` when both change | `fullScreen`'s new value | no | `onFullScreen` |
|
|
951
|
-
| `settingschange` | the person applied settings that changed
|
|
1019
|
+
| `settingschange` | the person applied settings that changed (7.5) | `{ names }`: the settings changed | yes: canceling skips the refresh | none |
|
|
1020
|
+
| `action` | the person chose one of the widget's own actions in its options menu (7.13) | `{ id }`: the action's | no | none |
|
|
1021
|
+
| `photodelete` | the person deleted a picture the widget opened with `deletable` (7.12) | `{ id }`: the `id` it gave, or `""` | no | none |
|
|
1022
|
+
| `storagechange` | another copy of the same widget changed a value of `storage.local` (this copy's already updated) | `{ key }` | no | none |
|
|
1023
|
+
| `fileschange` | the widget's files (`storage.files`, 7.8) changed: on another device, in another copy of the page, or by its own call | null | no | none |
|
|
952
1024
|
|
|
953
1025
|
Event types are lowercase, as the platform's are. A host **MAY** fire other events; their types **MUST** be lowercase and
|
|
954
1026
|
**MUST NOT** begin with `on`. Such an event isn't cancelable, and has a null `detail` unless the host says otherwise.
|
|
@@ -1021,9 +1093,18 @@ dictionary HeightGripOptions {
|
|
|
1021
1093
|
`onDone(default)`, *default* being the default value of `setting` (else of the widget's `count` or `limit` setting);
|
|
1022
1094
|
maximized, it fits the window again instead.
|
|
1023
1095
|
- `heightGrip(box, scroller, options)` gives the same grip to a list that keeps every item and scrolls in *scroller*: its
|
|
1024
|
-
height follows the drag, never taller than the list, then settles on whole items
|
|
1096
|
+
height follows the drag, never taller than the list, then settles on whole items, never ending on a heading among
|
|
1097
|
+
them (a title with nothing under it: it ends on the item before), and calls `onDone(pixels)`. Maximized,
|
|
1025
1098
|
the list takes the window's height instead.
|
|
1026
1099
|
|
|
1100
|
+
Either grip also works from the keyboard, as WAI-ARIA's window splitter: it takes the focus (shown), is named, and says
|
|
1101
|
+
its value (the items shown, "6 of 20 items"). ↓ shows one item more (the grip goes down as the list grows), ↑ one
|
|
1102
|
+
fewer, Home the fewest (`min`), End every item the box has; for `heightGrip`, ↓ and ↑ go to the next whole item and End
|
|
1103
|
+
shows the whole list. A key on `countGrip` is a drag of one row: `onStart()`, then `onDone(count)`. When ↓ asks for an
|
|
1104
|
+
item past those the box has, the host gives the items `onStart()` fetched a moment to arrive (2 seconds at most, less
|
|
1105
|
+
when it knows no request is pending), then keeps one more if one came. Height changes ease, at once under
|
|
1106
|
+
`prefers-reduced-motion`.
|
|
1107
|
+
|
|
1027
1108
|
Framed, the host follows the pointer once it leaves the frame and relays its moves. Either grip stays under the
|
|
1028
1109
|
pointer: maximized in a centered window, which grows both ways, the height follows twice the pointer's move until the
|
|
1029
1110
|
window is full, then the move itself.
|
|
@@ -1031,13 +1112,15 @@ window is full, then the move itself.
|
|
|
1031
1112
|
### 7.8 Memory and stored data
|
|
1032
1113
|
|
|
1033
1114
|
Where a widget keeps what, in short (the table below): a choice of the person, or a game in progress, is a setting;
|
|
1034
|
-
`memory` is a cache, which a host may drop; `local` lasts across reloads
|
|
1115
|
+
`memory` is a cache, which a host may drop; `local` lasts across reloads; `files` keeps pictures for good, on the
|
|
1116
|
+
person's other devices too.
|
|
1035
1117
|
|
|
1036
1118
|
```webidl
|
|
1037
1119
|
[Exposed=Window]
|
|
1038
1120
|
interface WidgetStorage {
|
|
1039
1121
|
readonly attribute WidgetStorageArea memory;
|
|
1040
1122
|
readonly attribute WidgetStorageArea local;
|
|
1123
|
+
readonly attribute WidgetFiles files;
|
|
1041
1124
|
};
|
|
1042
1125
|
|
|
1043
1126
|
[Exposed=Window]
|
|
@@ -1046,6 +1129,22 @@ interface WidgetStorageArea {
|
|
|
1046
1129
|
Promise<undefined> set(DOMString key, any value);
|
|
1047
1130
|
Promise<undefined> delete(DOMString key);
|
|
1048
1131
|
};
|
|
1132
|
+
|
|
1133
|
+
[Exposed=Window]
|
|
1134
|
+
interface WidgetFiles {
|
|
1135
|
+
Promise<sequence<WidgetFile>> list();
|
|
1136
|
+
Promise<Blob> get(DOMString id);
|
|
1137
|
+
Promise<DOMString> add(Blob file, optional any meta);
|
|
1138
|
+
Promise<undefined> delete(DOMString id);
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1141
|
+
dictionary WidgetFile {
|
|
1142
|
+
DOMString id;
|
|
1143
|
+
DOMString type;
|
|
1144
|
+
unsigned long size;
|
|
1145
|
+
unsigned long long at;
|
|
1146
|
+
any meta;
|
|
1147
|
+
};
|
|
1049
1148
|
```
|
|
1050
1149
|
|
|
1051
1150
|
`widget.storage` holds what a widget keeps, in two **storage areas**, each a map of keys to JSON values:
|
|
@@ -1065,11 +1164,32 @@ starts, and draw what it kept without showing a load.
|
|
|
1065
1164
|
|
|
1066
1165
|
UWA's `remember`, `recall`, `setStored` and `getStored` are UWA files' (11.1): the same data, `memory` and `local`.
|
|
1067
1166
|
|
|
1167
|
+
`widget.storage.files` holds the widget's own **files**: pictures it keeps for good (a camera's photos), the same on the
|
|
1168
|
+
person's other devices where the host syncs (Startside: with Sync on). Each copy of a widget has its own; a host
|
|
1169
|
+
**MUST NOT** let a widget reach another's.
|
|
1170
|
+
|
|
1171
|
+
- **`list()`** resolves with the widget's files, oldest first, each a `WidgetFile`: its `id`, its `type`, its `size` in
|
|
1172
|
+
bytes, `at` (when it was added, in milliseconds since the epoch) and the `meta` the widget gave `add`. It resolves
|
|
1173
|
+
from what the host has at once, offline included; files added on another device are listed once the host has
|
|
1174
|
+
learned of them, and `fileschange` says so.
|
|
1175
|
+
- **`get(id)`** resolves with the file's bytes, a `Blob` of its type: a widget makes its own address for it
|
|
1176
|
+
(`URL.createObjectURL`), since a framed widget can't load one the host made. It rejects with a `NotFoundError`
|
|
1177
|
+
`DOMException` for an id that isn't the widget's, and a `NetworkError` when the bytes are elsewhere and can't be
|
|
1178
|
+
fetched.
|
|
1179
|
+
- **`add(file, meta)`** keeps `file` and resolves with its new id. A host **MUST** take only a JPEG, PNG, WebP or GIF
|
|
1180
|
+
picture, told by its first bytes, never by the `Blob`'s type (in Startside, 10 MB at most); anything else rejects
|
|
1181
|
+
with a `TypeError`, too big with a `RangeError`. `meta`, optional, **MUST** be serializable as JSON, 1,024 bytes at
|
|
1182
|
+
most as UTF-8 (a `TypeError` otherwise). A host **MAY** refuse more files past its limits (Startside: 5,000 files
|
|
1183
|
+
and 1 GB a widget), with a `QuotaExceededError`.
|
|
1184
|
+
- **`delete(id)`** removes the file, on the person's other devices too; an id already gone resolves.
|
|
1185
|
+
- **`fileschange`** (7.6.1) fires when the list changed, whatever changed it: a widget lists its files again.
|
|
1186
|
+
|
|
1068
1187
|
| To keep | Use |
|
|
1069
1188
|
|---|---|
|
|
1070
1189
|
| a choice of the person, or a game in progress | a setting (`settings.set`), hidden if not edited by hand |
|
|
1071
1190
|
| data across rebuilds, a cache | `storage.memory` |
|
|
1072
1191
|
| data across reloads, shared by copies of the file | `storage.local` |
|
|
1192
|
+
| pictures to keep, on the person's other devices too | `storage.files` |
|
|
1073
1193
|
| a feed | nothing: `fetchFeed` keeps it (7.9) |
|
|
1074
1194
|
|
|
1075
1195
|
Saved data outlives the code that wrote it: widget code **MUST** read it defensively.
|
|
@@ -1099,7 +1219,8 @@ dictionary ReadItemsOptions {
|
|
|
1099
1219
|
the widget's unread count, and makes them all read when the count is activated, as `readall`'s default action, unless
|
|
1100
1220
|
a listener cancels the event.
|
|
1101
1221
|
- `isRead(key)` and `setRead(keys, read)` do it by hand. `setUnreadCount(count)` shows *count*, when positive, after the
|
|
1102
|
-
title and in the tab's count
|
|
1222
|
+
title and in the tab's count (unless the person turned the widget's `countInTab` setting off, 7.5); activating it
|
|
1223
|
+
fires `readall` (7.6). `setSearchResultCount(count)` is accepted.
|
|
1103
1224
|
|
|
1104
1225
|
A host keeps the last 500 read keys of a widget. A widget file replacing another **MUST** keep its read keys.
|
|
1105
1226
|
Headline links to another site **SHOULD** have the class `ext-link`.
|
|
@@ -1143,6 +1264,14 @@ dictionary PlayAudioOptions {
|
|
|
1143
1264
|
required USVString url; // https
|
|
1144
1265
|
boolean relay = false; // played without a Referer, through the host's relay
|
|
1145
1266
|
boolean live = true;
|
|
1267
|
+
sequence<NextAudio> next; // for a file: the files to play after it
|
|
1268
|
+
};
|
|
1269
|
+
|
|
1270
|
+
dictionary NextAudio {
|
|
1271
|
+
required USVString url; // https
|
|
1272
|
+
boolean relay = false;
|
|
1273
|
+
DOMString title; // what the host says plays, as audioInfo's
|
|
1274
|
+
DOMString artist;
|
|
1146
1275
|
};
|
|
1147
1276
|
|
|
1148
1277
|
dictionary AudioState {
|
|
@@ -1152,6 +1281,16 @@ dictionary AudioState {
|
|
|
1152
1281
|
DOMString? error; // null, "blocked" or "failed"
|
|
1153
1282
|
unsigned long? time; // seconds, for a file
|
|
1154
1283
|
unsigned long? duration;
|
|
1284
|
+
ElsewhereAudio? elsewhere; // a file another widget plays
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
dictionary ElsewhereAudio {
|
|
1288
|
+
USVString url;
|
|
1289
|
+
boolean playing;
|
|
1290
|
+
boolean loading;
|
|
1291
|
+
unsigned long? time;
|
|
1292
|
+
unsigned long? duration;
|
|
1293
|
+
DOMString? source; // its audioInfo's source
|
|
1155
1294
|
};
|
|
1156
1295
|
|
|
1157
1296
|
dictionary AudioControls {
|
|
@@ -1184,13 +1323,27 @@ dictionary VideoState {
|
|
|
1184
1323
|
};
|
|
1185
1324
|
|
|
1186
1325
|
dictionary PhotoSpec {
|
|
1187
|
-
|
|
1326
|
+
USVString src;
|
|
1327
|
+
DOMString file;
|
|
1328
|
+
sequence<DOMString> files;
|
|
1188
1329
|
DOMString alt;
|
|
1189
1330
|
DOMString title;
|
|
1190
1331
|
USVString preview;
|
|
1332
|
+
USVString zoom;
|
|
1191
1333
|
unsigned long width;
|
|
1192
1334
|
unsigned long height;
|
|
1193
|
-
DOMString credit;
|
|
1335
|
+
(PhotoCredit or DOMString) credit;
|
|
1336
|
+
boolean deletable = false;
|
|
1337
|
+
DOMString id;
|
|
1338
|
+
};
|
|
1339
|
+
|
|
1340
|
+
dictionary PhotoCredit {
|
|
1341
|
+
DOMString name;
|
|
1342
|
+
DOMString creator;
|
|
1343
|
+
DOMString creditText;
|
|
1344
|
+
DOMString copyrightNotice;
|
|
1345
|
+
USVString license;
|
|
1346
|
+
USVString url;
|
|
1194
1347
|
};
|
|
1195
1348
|
```
|
|
1196
1349
|
|
|
@@ -1199,6 +1352,18 @@ dictionary PhotoSpec {
|
|
|
1199
1352
|
- `playAudio(options)` plays an `https` stream in the host's page, not in the widget, so that nothing happening to the
|
|
1200
1353
|
widget interrupts it; a `live` stream is never played behind its live point. `pauseAudio()`; `seekAudio(seconds)` for a
|
|
1201
1354
|
file. `audioState` is its state, and `audiostate` (`onAudioState`) is fired as it changes. Activation-gated.
|
|
1355
|
+
- A file (`live` false) may come with a programme, `next`: the files the host plays after it, in order, each as the one
|
|
1356
|
+
before plays to its end, with no further activation (the one that started the first covers exactly what the widget
|
|
1357
|
+
declared with it). `audioState.url` is the file playing; where an entry has a `title`, the host says it plays (as
|
|
1358
|
+
`audioInfo`'s title and artist, the rest of the widget's `audioInfo` kept). A pause, from the widget, the host or the
|
|
1359
|
+
system, ends the programme: playing again plays that file, not the rest, unless the widget's `playAudio()` declares
|
|
1360
|
+
them again; another `playAudio()` replaces it. The host plays the first 100 entries at most, and leaves out an entry
|
|
1361
|
+
whose address it wouldn't play as the first.
|
|
1362
|
+
- `audioState.elsewhere` is a file (`live` false) another widget of the page plays, playing or loading, else null: two
|
|
1363
|
+
widgets offering the same recording both show it playing. While the widget plays nothing itself, `pauseAudio()` and
|
|
1364
|
+
`seekAudio()` act on that file; `playAudio()` of a file another widget holds, playing or paused, goes on with it there,
|
|
1365
|
+
from its place, rather than starting it again. `playing` and `url` stay the widget's own sound: a widget that reads
|
|
1366
|
+
them alone is never told another's sound is its own. A host without other widgets keeps it null.
|
|
1202
1367
|
- A widget playing with a player of its own calls `audioStarted(stop, controls)` as it starts: the host stops the sound
|
|
1203
1368
|
playing before, and calls *stop* when another starts or the person pauses it. `audioStopped()` says it stopped by itself;
|
|
1204
1369
|
`audioInfo(info)` says what plays.
|
|
@@ -1209,8 +1374,23 @@ URL the widget gives. `videoState` and the `videostate` event (`onVideoState`) r
|
|
|
1209
1374
|
standalone, the video opens on its site.
|
|
1210
1375
|
|
|
1211
1376
|
**Pictures.** `openPhoto(photo)` shows a picture at full size in the host's window: an `https` URL or one of the host's.
|
|
1212
|
-
`preview` is shown while `src` loads; `
|
|
1213
|
-
|
|
1377
|
+
`preview` is shown while `src` loads; `zoom`, a larger picture of the same, is asked only when the person zooms in
|
|
1378
|
+
(else `src` is enlarged); `width` and `height` give its proportions at once; `credit` is what its licence asks
|
|
1379
|
+
to go with it: a `PhotoCredit`, whose members are schema.org's `ImageObject` properties of the same names (the work's
|
|
1380
|
+
`name`, its `creator` as a name, the `creditText` naming who keeps or gives the picture, the `copyrightNotice` naming who
|
|
1381
|
+
the licence says to name, the `license`'s address, the picture's page `url`; all optional, the addresses `https`), or a
|
|
1382
|
+
plain string, read as its `creditText`. The host shares it with the picture as text and keeps it with what it makes of
|
|
1383
|
+
the picture; it **MAY** shorten its text, and drops what it can't read. With `deletable` true, the window also offers
|
|
1384
|
+
Delete: the host **MUST** ask the person first, and once they confirm, closes the window and fires `photodelete` at the
|
|
1385
|
+
widget, its `detail` the `id` the widget gave (at most 100 characters; `""` without one); the widget removes the picture
|
|
1386
|
+
itself. A picture the widget keeps (one it took or made) is what this is for. Standalone, a new tab.
|
|
1387
|
+
|
|
1388
|
+
One of the widget's own files (`storage.files`, 7.8) opens by its id, `file`, in place of `src`: the host reads it, and
|
|
1389
|
+
an id that isn't the widget's shows nothing. With `files` too (ids of its files, in the order to show them, `file` among
|
|
1390
|
+
them; at most 5,000), the window steps through them: a previous and a next control beside the picture and the left and
|
|
1391
|
+
right arrow keys (not while zoomed in), each named for assistive technology, and which of how many is shown said
|
|
1392
|
+
politely as it changes. A file gone meanwhile is skipped. Delete then fires `photodelete` with the shown file's id
|
|
1393
|
+
(the widget removes it) and shows the next one, or the one before at the end, closing when none is left. Pictures a widget shows **MUST** be ones it may show: public domain, or under a licence or permission that allows it,
|
|
1214
1394
|
their required credits kept.
|
|
1215
1395
|
|
|
1216
1396
|
### 7.13 The page
|
|
@@ -1226,20 +1406,150 @@ dictionary AddWidgetSpec {
|
|
|
1226
1406
|
DOMString title;
|
|
1227
1407
|
record<DOMString, DOMString> values; // at most 12, 200 characters each
|
|
1228
1408
|
};
|
|
1409
|
+
|
|
1410
|
+
callback DragWidgetCallback = any (DragEvent event); // an AddWidgetSpec; nothing: the drag doesn't start
|
|
1411
|
+
|
|
1412
|
+
dictionary WidgetSaveFile {
|
|
1413
|
+
required DOMString name; // with its extension; cleaned by the host
|
|
1414
|
+
required DOMString type; // one its extension takes; "" for the usual one
|
|
1415
|
+
required (DOMString or Blob or ArrayBuffer) data; // 8 MiB at most
|
|
1416
|
+
};
|
|
1417
|
+
|
|
1418
|
+
dictionary WidgetSaveOptions {
|
|
1419
|
+
WidgetEvent action; // the `action` event of the choice this file answers
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1422
|
+
dictionary WidgetActionState { // a member left out: as it was; null: as the file declares it
|
|
1423
|
+
boolean? disabled; // greyed: nothing to act on
|
|
1424
|
+
boolean? hidden; // not in the menu
|
|
1425
|
+
DOMString? label; // another label, 1 to 40 characters
|
|
1426
|
+
};
|
|
1229
1427
|
```
|
|
1230
1428
|
|
|
1231
1429
|
- `shareUrl()` returns the widget's address on its host (`/add/<key>`), or null for an untrusted file.
|
|
1232
1430
|
- `share(data)` shares *data* through the system's share sheet where there is one, else the clipboard. Activation-gated.
|
|
1431
|
+
- `sendTo()` (a host's extension) opens the host's own way to send this widget to someone (Startside: Send to…), its
|
|
1432
|
+
`data-send` values going with it. Activation-gated; does nothing where `environment.people` is `null`.
|
|
1233
1433
|
- `addWidget(spec)` adds a widget of the host's directory after this one, with *spec*'s title and values. Trusted files
|
|
1234
1434
|
only; activation-gated. The member is **absent** where no widget can be added (a preview, standalone).
|
|
1235
1435
|
- `dragWidget(element, spec)` makes *element* draggable onto the page, creating the widget *spec* names (or returns, if
|
|
1236
|
-
a function, as the drag starts
|
|
1436
|
+
a function, as the drag starts: it is given the drag's `DragEvent`, and returning nothing cancels the drag) where it
|
|
1437
|
+
is dropped; it returns false, leaving *element* alone, where drags can't
|
|
1237
1438
|
reach the page (framed, standalone).
|
|
1238
1439
|
- **Maximized.** A person may maximize any widget. `canFullSize` says whether the host can; `openFull()` and
|
|
1239
1440
|
`closeFull()` do it from a control of the widget's own; `fullSize` says which; `fullsize` (`onFullSize`) is fired once its
|
|
1240
1441
|
box has its new size. `setFullScreen(on)`, activation-gated, puts the widget alone over the window, maximized first if it isn't, in the browser's full screen where there is one; `false` puts
|
|
1241
1442
|
the widget back as it was before (on the page if the full screen maximized it). `fullScreen` says whether it is, the
|
|
1242
1443
|
person's Esc included; `fullscreen` (`onFullScreen`) is fired as it changes.
|
|
1444
|
+
- **Its own actions.** A widget may have actions of its own in its options menu, for what belongs to the widget but
|
|
1445
|
+
not in its body (a recipe's *Reset*). **They are declared in the file**, as its settings are (section 5), and read
|
|
1446
|
+
by the host without running the widget:
|
|
1447
|
+
|
|
1448
|
+
```html
|
|
1449
|
+
<menu id="actions" hidden>
|
|
1450
|
+
<button type="button" name="reset" data-icon="reset" data-confirm="Reset checked items and timers?" disabled>Reset</button>
|
|
1451
|
+
</menu>
|
|
1452
|
+
```
|
|
1453
|
+
|
|
1454
|
+
Each `button` that is a child of the `menu` declares one action, in document order: `name` is its id (1 to 40
|
|
1455
|
+
letters, digits, `-`, `_` or `.`, unique), its text the label (text, never markup, 40 characters at most),
|
|
1456
|
+
`disabled` and `hidden` its state as the widget starts (greyed; not in the menu until the widget says otherwise),
|
|
1457
|
+
`data-icon` and `data-confirm` optional. Five at most, the hidden ones counted. A host reads
|
|
1458
|
+
the declaration strictly: an action whose id, label or question breaks these bounds is left out whole, never
|
|
1459
|
+
shortened, and the ones past the fifth are left out. The declaration is data: the host removes it from the
|
|
1460
|
+
widget's body, as the settings form, and never moves its elements or their handlers into its own page. What makes
|
|
1461
|
+
an action usable (its name, its greyed state, the keyboard, the focus given back) is the host's menu, not these
|
|
1462
|
+
hidden buttons.
|
|
1463
|
+
- `data-icon` hints at the picture the widget would like beside the label: one of the generic names `reset`,
|
|
1464
|
+
`refresh`, `undo`, `redo`, `copy`, `download`, `upload`, `share`, `add`, `remove`, `clear`, `edit`, `search`,
|
|
1465
|
+
`print`, `play`, `pause`, `stop`, `check`, `star`, `info`, `settings`, for which the host draws its own picture,
|
|
1466
|
+
or one emoji (a pictograph, one character as people see it: not a letter or another symbol), shown as given; a
|
|
1467
|
+
host **MAY** ignore it, and shows nothing for anything else.
|
|
1468
|
+
- `data-confirm` is a question (200 characters at most) the host asks in a dialog of its own before firing
|
|
1469
|
+
`action`, the action's label naming the answer that goes ahead; it fires only on that answer, and only if the
|
|
1470
|
+
widget still offers that action, with the same label, then. A host that can't ask **MUST NOT** fire. A widget
|
|
1471
|
+
asks nothing of its own for it (10.1: no browser dialogs).
|
|
1472
|
+
- **The running widget only changes their state**: `setActionStates(states)`, keyed by declared id, sets
|
|
1473
|
+
`disabled`, `hidden` or another `label` (a word that depends on its state, or a translation) of the actions it
|
|
1474
|
+
names, leaving the others and the members not given as they were. A member given as `null` goes back to what
|
|
1475
|
+
the file declares: `{ label: null }` restores the declared label. An id the file doesn't declare, or a label
|
|
1476
|
+
that isn't 1 to 40 characters, throws a `TypeError`. A widget **SHOULD** call it whenever what an action acts on
|
|
1477
|
+
changes. States last while the widget runs: a reload, or a widget the host builds again (6.4), starts from the
|
|
1478
|
+
declaration, and the widget says them again as it loads.
|
|
1479
|
+
- **Declared is not ready.** The host lists a declared action from the start, greyed until the widget has started:
|
|
1480
|
+
its first `load` dispatched, or its first `setActionStates`. One chosen then fires `action` (7.6.1) with its id
|
|
1481
|
+
in `detail.id`; a host **MUST NOT** fire it before, nor for an action disabled or hidden. Started means the
|
|
1482
|
+
`load` event was dispatched, not that what its listeners began has finished: a widget whose `load` fetches its
|
|
1483
|
+
data can be sent `action` before the data is there. A widget whose action needs that data declares the button
|
|
1484
|
+
`disabled` (or `hidden`) and enables it with `setActionStates` once the data has come.
|
|
1485
|
+
- The choice was made in the host's menu, not in the widget: it does not count as activation in the widget (6.7),
|
|
1486
|
+
so an action that needs one (a file picker, the clipboard) opens a control of the widget's own for the person
|
|
1487
|
+
to press. A download is the exception: the host delivers it (`saveFile`, below).
|
|
1488
|
+
- **A file to keep.** An action may produce one file for the person to download. Its declaration says which, in
|
|
1489
|
+
`data-save`: the extensions it may produce, space-separated, each a dot and 1 to 10 letters or digits.
|
|
1490
|
+
|
|
1491
|
+
```html
|
|
1492
|
+
<button type="button" name="download" data-icon="download" data-save=".cook" disabled>Download as .cook</button>
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
```js
|
|
1496
|
+
widget.addEventListener('action', (event) => {
|
|
1497
|
+
if (event.detail.id !== 'download') return;
|
|
1498
|
+
widget.saveFile({ name: title + '.cook', type: 'text/plain;charset=utf-8', data: text }, { action: event });
|
|
1499
|
+
});
|
|
1500
|
+
```
|
|
1501
|
+
|
|
1502
|
+
The widget builds the content; the host authorizes, checks and delivers it. `data-save` is read from the file
|
|
1503
|
+
with the rest of the declaration, and `setActionStates` can't change it. It is independent of a setting's
|
|
1504
|
+
`data-file` (5.3), which keeps its meaning.
|
|
1505
|
+
- **What a choice allows.** `saveFile(file, { action: event })` answers one choice in the menu: *event* is the
|
|
1506
|
+
`action` event the host fired for it. One file per choice, within 30 seconds of it, and one save at a time
|
|
1507
|
+
per widget. The choice belongs to the widget as it runs then: it ends with a reload or a widget the host
|
|
1508
|
+
builds again (6.4), and never passes to what replaces it. An event the widget makes itself, an id it supplies
|
|
1509
|
+
or a claim of activation allow nothing. A call without `action` rejects with `NotAllowedError`: a download
|
|
1510
|
+
from a control of the widget's own is not specified yet (it needs a host dialog showing the final name and a
|
|
1511
|
+
declaration for the whole widget; [Issue 32](#issue-32)).
|
|
1512
|
+
- **The data** is a string, a `Blob` or an `ArrayBuffer`, 8 MiB at most in bytes (a string counted as UTF-8),
|
|
1513
|
+
copied as the call is made: the caller's buffer stays usable. Never an address, a stream or anything the host
|
|
1514
|
+
would fetch.
|
|
1515
|
+
- **The name** (1,024 characters at most as given, the type 255) is cleaned by the host: its last part only (no folders), no control or direction characters,
|
|
1516
|
+
nothing a disk refuses, no dots or spaces at its ends, never a device's name, 120 characters at most before
|
|
1517
|
+
its extension, a fallback when nothing is left. Its extension is read after cleaning and is the last one; an
|
|
1518
|
+
extension before it loses its dot (`invoice.exe.cook` becomes `invoice-exe.cook`).
|
|
1519
|
+
- **The extension** must be one the action declares **and** one the host allows. A host keeps an allow-list of
|
|
1520
|
+
data formats, never a block-list; Startside's is `.cook`, `.txt`, `.md`, `.csv`, `.json`, `.ics`, `.opml`
|
|
1521
|
+
and `.gpx`.
|
|
1522
|
+
An action declaring another extension gets nothing for it.
|
|
1523
|
+
- **The type** must be one the extension takes (Startside: `text/plain` for each of them; also `text/markdown`
|
|
1524
|
+
for `.md`, `text/csv` for `.csv`, `application/json` for `.json`, `text/calendar` for `.ics`, `text/x-opml`,
|
|
1525
|
+
`application/xml` and `text/xml` for `.opml`, `application/gpx+xml`, `application/xml` and `text/xml` for `.gpx`); `""` asks for the usual one. A `Blob`'s own type is ignored:
|
|
1526
|
+
the host makes the file. A host **MUST NOT** render, preview or open the content, nor give the widget the
|
|
1527
|
+
file's address.
|
|
1528
|
+
- **Delivery.** While the person's choice still counts as activation in the host's page, the download starts.
|
|
1529
|
+
If it no longer does (a handler that computed or fetched first), the host shows a control of its own naming
|
|
1530
|
+
the file ("Download “name”?"), for those exact bytes: pressing it delivers the file, Cancel gives it up. A
|
|
1531
|
+
widget that stops while it is shown (removed, reloaded, built again) takes the control and the file with it. No
|
|
1532
|
+
other question is asked for a declared download: choosing it is the intent. `data-confirm` works as for any
|
|
1533
|
+
action, before `action` fires.
|
|
1534
|
+
- **The promise** resolves once the host has handed the file to the browser, which is not "saved": the browser
|
|
1535
|
+
may still block it or the person cancel it there. It rejects with a `DOMException`: `NotAllowedError` (no
|
|
1536
|
+
such choice, one already used or too old, or another save going on), `NotSupportedError` (a name, an
|
|
1537
|
+
extension, a type or data the action or the host doesn't take), `QuotaExceededError` (over 8 MiB),
|
|
1538
|
+
`AbortError` (the person cancelled the host's control). A refused file uses its choice up. A host shows no
|
|
1539
|
+
"Saved" notice and no path.
|
|
1540
|
+
- On a widget's own page (10.3) the call and its rules are the same; there they shape the API and do not
|
|
1541
|
+
protect, since the widget isn't sandboxed ([Issue 15](#issue-15)).
|
|
1542
|
+
- **An album of its pictures** (a host's extension; Startside's since November 24, 2026). An action declaring
|
|
1543
|
+
`data-album` is the host's to carry out: chosen, the host makes a photo widget of its own holding the widget's
|
|
1544
|
+
pictures (its files, 7.8), in the order they were kept, right after it, and fires no `action` event. The widget only
|
|
1545
|
+
offers it and says when it can (`setActionStates`: greyed while it has no picture). A host without photo widgets
|
|
1546
|
+
leaves such an action out of the menu; so does a widget's own page (10.3).
|
|
1547
|
+
|
|
1548
|
+
```html
|
|
1549
|
+
<button type="button" name="album" data-album data-icon="add" disabled>Make an album</button>
|
|
1550
|
+
```
|
|
1551
|
+
- There is no way to make a list of actions in script: none of the widgets written so far needs one only known as
|
|
1552
|
+
it runs ([Issue 32](#issue-32)).
|
|
1243
1553
|
- **Accounts.** A trusted widget declaring `accountService` and a hidden setting named `account` has its account in its
|
|
1244
1554
|
settings: the host lists the page's accounts of that service (those allowing one of `accountScope`'s permissions; an
|
|
1245
1555
|
account reporting none allows none, an account's permissions read space- or comma-separated) and
|
|
@@ -1282,7 +1592,13 @@ local and private networks, including through redirects, and its own addresses o
|
|
|
1282
1592
|
**MAY** answer from a cache of 5 minutes (8.4). In this version:
|
|
1283
1593
|
|
|
1284
1594
|
- only `GET` requests are made: another `method` rejects with a `TypeError`;
|
|
1285
|
-
- an `Accept` header naming JSON asks with JSON headers (a GraphQL query by `GET`); no other request header
|
|
1595
|
+
- an `Accept` header naming JSON asks with JSON headers (a GraphQL query by `GET`); no other request header of the
|
|
1596
|
+
widget's is sent;
|
|
1597
|
+
- to the origin of a setting declared `data-key-for` (5.3), when the person has given a key for it, the host adds
|
|
1598
|
+
`Authorization: Bearer <key>`: only to that exact origin (scheme, host and port), never through a redirect to another,
|
|
1599
|
+
and it **MUST NOT** answer one key's request from what it kept for another key or for none. Without a key the request
|
|
1600
|
+
goes as any other, and the site's refusal (401, 403) reaches the widget as that status. A host that can't keep keys
|
|
1601
|
+
sends none;
|
|
1286
1602
|
- the `Response` carries the body, as text, with the status 200 for a success (the relay keeps no other); an HTTP
|
|
1287
1603
|
error gives a `Response` with its status and no
|
|
1288
1604
|
body, `ok` false; a network failure, or a refused address, rejects with a `TypeError`, as the platform's does;
|
|
@@ -1330,6 +1646,23 @@ To **normalize** a content feed, keep only those members, give every item an `id
|
|
|
1330
1646
|
an item with neither), and write dates in [[RFC3339](#ref-rfc3339)] format. The host normalizes the feeds `fetchFeed`
|
|
1331
1647
|
gives; UWA's `UWA.Content` helpers are UWA files' (11.1).
|
|
1332
1648
|
|
|
1649
|
+
### 8.6 `widget.fetchImage`
|
|
1650
|
+
|
|
1651
|
+
`fetchImage(url, options)` resolves with an address the widget shows in an `img`: the picture at *url*, fetched by the
|
|
1652
|
+
host as itself. Framed, the widget's own requests carry no `Referer` (its origin is opaque), and some sites refuse a
|
|
1653
|
+
picture asked without one (OpenStreetMap's tiles, whose usage policy asks for it); fetched by the host, the request
|
|
1654
|
+
carries the host's. The host:
|
|
1655
|
+
|
|
1656
|
+
- fetches only an `https` address that isn't its own nor one on the person's computer or network (an IP address,
|
|
1657
|
+
`localhost`, a `.local` name), without credentials, as CORS allows: a site that doesn't allow it rejects;
|
|
1658
|
+
- accepts only a raster picture (PNG, JPEG, GIF, WebP, AVIF, BMP, an icon; not SVG) of 2 MB at most;
|
|
1659
|
+
- answers the same address for the same picture while the widget lives, at once once it came, and **MAY** let go of
|
|
1660
|
+
the oldest past a few hundred.
|
|
1661
|
+
|
|
1662
|
+
A picture refused or failing rejects with a `TypeError`; `options.signal` aborts the wait (its `fresh` is ignored). On
|
|
1663
|
+
its own page (10.2) the widget isn't sandboxed: the host **MAY** resolve with *url* itself. A widget **SHOULD** credit
|
|
1664
|
+
the pictures as their licence asks (a map's data).
|
|
1665
|
+
|
|
1333
1666
|
## 9. Built-in objects
|
|
1334
1667
|
|
|
1335
1668
|
SWA adds nothing to the objects of the platform. In an SWA widget's realm (its frame, or its own page: 10.2):
|
|
@@ -1387,6 +1720,11 @@ A dashboard **MUST** run every widget in a frame of its own, sandboxed with an o
|
|
|
1387
1720
|
6. The browser's dialogs are off: `alert()` does nothing, `confirm()` answers false and `prompt()` null, at once. A
|
|
1388
1721
|
widget **MUST NOT** use them, on its own page either (they work there, so a widget relying on them behaves
|
|
1389
1722
|
differently framed): a question is asked in the widget's own box, its safe answer focused, Esc for it (14).
|
|
1723
|
+
7. A file dragged from the computer over the page is the host's (a host may make a widget of it where it is dropped),
|
|
1724
|
+
and doesn't reach a frame on its way, except a frame whose file declares `acceptFiles` (4.5): there the drag and
|
|
1725
|
+
the drop are the widget's, which takes the file with its own `dragover` and `drop` listeners. A file its listeners
|
|
1726
|
+
leave uncancelled is refused in the frame (no drop effect): never opened by the browser in place of the page, never
|
|
1727
|
+
passed on to the host.
|
|
1390
1728
|
|
|
1391
1729
|
A widget **MUST** work framed. One that can't **MUST** say so in its box, and how to change it, rather than fail.
|
|
1392
1730
|
|
|
@@ -1403,7 +1741,6 @@ UWA 1.2 files keep their `inline` metadata (section 11).
|
|
|
1403
1741
|
Opened on its own, a widget file runs in the standalone host: its box, centred on the page, with a title bar.
|
|
1404
1742
|
|
|
1405
1743
|
- **The options menu.** The title bar's options button (▾) opens the widget's options menu, as a dashboard's:
|
|
1406
|
-
- its **Title**: a rename the page keeps; emptied, the widget's own;
|
|
1407
1744
|
- its **Look**, when it has two: *Own* (its `chromeColor` and `background`) or *Page* (the page's bar and colors, the
|
|
1408
1745
|
widget flattened under `html.uwa-neutral`, as on a dashboard);
|
|
1409
1746
|
- its **Color**: the dashboard's palette, as `--module-color` and `--module-paper`;
|
|
@@ -1567,7 +1904,10 @@ as in UWA.
|
|
|
1567
1904
|
addresses, through redirects too, and the host's own.
|
|
1568
1905
|
- **Activation.** Operations that cover the page (the reader, the video player, full screen) or leave it (sharing,
|
|
1569
1906
|
sign-in windows) are activation-gated, so a widget can't take over the page by itself.
|
|
1570
|
-
- **Passwords.** A password setting never reaches a framed widget.
|
|
1907
|
+
- **Passwords.** A password setting never reaches a framed widget. A key for a site (`data-key-for`, 5.3) never reaches
|
|
1908
|
+
the widget from the host: the host adds it only to requests to that one origin (8.2). The widget chooses the paths it
|
|
1909
|
+
asks there, so a site whose answers carry the key (one echoing `Authorization`) lets the widget read it; a person
|
|
1910
|
+
gives a key only to a widget they trust, and a host **MAY** review the widgets it offers for that.
|
|
1571
1911
|
- **Code.** Widget code **MUST NOT** evaluate fetched text as code.
|
|
1572
1912
|
|
|
1573
1913
|
## 13. Privacy Considerations
|
|
@@ -1575,6 +1915,8 @@ as in UWA.
|
|
|
1575
1915
|
- A widget's settings, memory, stored data, kept content and read keys are kept by the host, as the host's privacy
|
|
1576
1916
|
notice describes; a framed widget keeps nothing itself.
|
|
1577
1917
|
- A shared link carries only settings marked `data-share`, never a password.
|
|
1918
|
+
- A key given for a `data-key-for` setting is kept by the host, as its privacy notice describes, and sent only to its
|
|
1919
|
+
site, with the widget's requests there.
|
|
1578
1920
|
- Framed requests come from an opaque origin; whether a site's cookies go with them is the browser's third-party
|
|
1579
1921
|
cookie policy. A site asked directly (`fetch` from the frame) sees the person's network address; one asked through the
|
|
1580
1922
|
host (`widget.fetch`, `fetchFeed`, `UWA.Data`) sees the host's, and the host sees the address asked.
|
|
@@ -1818,7 +2160,8 @@ defensively; the keyboard's help as the board's description, a win announced by
|
|
|
1818
2160
|
**Example 7.** A small application: a to-do list kept with the widget (a hidden setting, 7.8), its rows from a
|
|
1819
2161
|
`template`, filled with text (what's typed is never markup), one listener on the list for every row; the browser's own
|
|
1820
2162
|
controls for the keyboard (a form submitted by Enter, checkboxes); the focus moved to the next row when one is removed,
|
|
1821
|
-
and each change announced.
|
|
2163
|
+
and each change announced. An action of its own in the options menu (7.13), declared in the file: *Remove done items*,
|
|
2164
|
+
greyed until an item is done, the host asking before it runs.
|
|
1822
2165
|
|
|
1823
2166
|
```html
|
|
1824
2167
|
<!doctype html>
|
|
@@ -1846,6 +2189,9 @@ and each change announced.
|
|
|
1846
2189
|
<form id="preferences" hidden>
|
|
1847
2190
|
<input type="hidden" name="items" value="[]" />
|
|
1848
2191
|
</form>
|
|
2192
|
+
<menu id="actions" hidden>
|
|
2193
|
+
<button type="button" name="clear" data-icon="clear" data-confirm="Remove the done items?" disabled>Remove done items</button>
|
|
2194
|
+
</menu>
|
|
1849
2195
|
<div class="todo">
|
|
1850
2196
|
<form class="add">
|
|
1851
2197
|
<label class="visually-hidden">New item <input type="text" name="text" maxlength="200" autocomplete="off" required /></label>
|
|
@@ -1888,7 +2234,10 @@ and each change announced.
|
|
|
1888
2234
|
);
|
|
1889
2235
|
list.hidden = !Todo.items.length;
|
|
1890
2236
|
widget.body.querySelector('.empty').hidden = !!Todo.items.length;
|
|
2237
|
+
Todo.actions();
|
|
1891
2238
|
};
|
|
2239
|
+
// The menu's action follows the list: usable once an item is done (7.13), said again whenever that changes.
|
|
2240
|
+
Todo.actions = () => widget.setActionStates({ clear: { disabled: !Todo.items.some((item) => item.done) } });
|
|
1892
2241
|
// Wired once, on the first load: one listener on the list for every row's checkbox and button.
|
|
1893
2242
|
widget.addEventListener('load', () => {
|
|
1894
2243
|
Todo.items = Todo.read();
|
|
@@ -1912,6 +2261,7 @@ and each change announced.
|
|
|
1912
2261
|
item.done = e.target.checked;
|
|
1913
2262
|
li.classList.toggle('done', item.done);
|
|
1914
2263
|
Todo.save();
|
|
2264
|
+
Todo.actions();
|
|
1915
2265
|
});
|
|
1916
2266
|
list.addEventListener('click', (e) => {
|
|
1917
2267
|
const button = e.target.closest('.remove');
|
|
@@ -1927,6 +2277,15 @@ and each change announced.
|
|
|
1927
2277
|
});
|
|
1928
2278
|
Todo.draw();
|
|
1929
2279
|
});
|
|
2280
|
+
// Chosen in the options menu, and confirmed there: the host asked the question the file declares.
|
|
2281
|
+
widget.addEventListener('action', (event) => {
|
|
2282
|
+
if (event.detail.id !== 'clear') return;
|
|
2283
|
+
const before = Todo.items.length;
|
|
2284
|
+
Todo.items = Todo.items.filter((item) => !item.done);
|
|
2285
|
+
Todo.save();
|
|
2286
|
+
Todo.draw();
|
|
2287
|
+
Todo.say('Removed ' + (before - Todo.items.length) + ' done');
|
|
2288
|
+
});
|
|
1930
2289
|
widget.addEventListener('refresh', () => {
|
|
1931
2290
|
Todo.items = Todo.read();
|
|
1932
2291
|
Todo.draw();
|
|
@@ -1966,24 +2325,31 @@ and each change announced.
|
|
|
1966
2325
|
| `apiVersion` `1.0` | read as any metadata |
|
|
1967
2326
|
| Readonly attributes and `FrozenArray` (7.1) | accessors without a setter, or non-writable properties, on `widget` itself (not on a `Widget` prototype); `preferences` a frozen array of frozen copies, made again when the declared settings change, so not the same array across such a change |
|
|
1968
2327
|
| Starting on its own page (6.6, 10.3) | the widget code runs as the page reads it, before `widget.body` is set: a widget finds its parts in `load` (7.3.1), where every environment has it |
|
|
2328
|
+
| `maxlength` and `data-file` on a `hidden` control (5.3) | added November 8, 2026 for the Recipe widget (a Cooklang text in a link, a `.cook` file opened): implemented in Startside only; `data-file` read from the file by the host's catalogue, the first widget declaring an extension taking it, text only, 16,000 characters at most |
|
|
1969
2329
|
| Host limits (unspecified) | a framed widget's settings: a value of 20,000 characters, a name of 100, all of them 100,000 together (a value over isn't kept; the widget's console says so); read keys over 2000 characters dropped; feeds cut to 99 items and an item's HTML to 120,000 characters; the unread count shown up to 99; the reader's list 500 items, titles 300 and content 200,000 characters; an added widget's file name 40 characters |
|
|
2330
|
+
| The keyboard coming into a widget (6.8) | implemented in Startside (November 13, 2026): Enter on a widget's title bar moves the focus in, by `autofocus` and the steps of 6.8; an uncancelled Escape gives it back, an uncancelled arrow goes on to the next widget; a game controller read by the page is given as arrow keys, Enter and Escape. On a widget's own page there is no other widget: the browser's own `autofocus` applies |
|
|
2331
|
+
| A widget's own actions and `saveFile` (7.13) | implemented in Startside (November 12, 2026): actions declared in `<menu id="actions" hidden>`, listed in the options menu, `setActionStates`, the `action` event, `data-confirm` asked by the host, and one file per choice through `saveFile` (8 MiB at most, the extension among the action's `data-save` and the host's allow-list). On a widget's own page the runtime's menu lists them the same way. Used by the Recipe (Reset, Download as .cook), Dial Slate (Reset), Bluesky and Mastodon (Disconnect); Example 7 declares one |
|
|
2332
|
+
| `acceptFiles` (4.5, 10.1) | added November 21, 2026 for Startside Run (a run's GPX dropped on it): implemented in Startside only; while a file is dragged over the page, a frame keeps the pointer when its file declares `acceptFiles`, every other frame giving it to the page; a dragover no listener of the widget cancelled is cancelled by the runtime with the drop effect `none`. The extensions aren't checked by the host. `.gpx` joined `saveFile`'s allow-list the same day (7.13) |
|
|
2333
|
+
| A picture's credit in fields (7.12) | implemented in Startside (November 13, 2026): `PhotoCredit`, schema.org's `ImageObject` property names, or a plain string read as `creditText`; shared with the picture as text |
|
|
1970
2334
|
|
|
1971
2335
|
The runtime is served at `https://startside.app/swa/1.0/runtime.js` (one minified script, its styles in it, with none of
|
|
1972
2336
|
UWA's API, globals or extensions of built-in objects: it runs SWA files only); a Startside
|
|
1973
2337
|
page skips it, and its catalogue lists the files that load it. The same runtime and types make the npm package
|
|
1974
2338
|
`@startside/swa` (1.0.0 published November 8, 2026; 1.0.1 adds this specification, the quickstart and the guide for
|
|
1975
|
-
agents in Markdown, and the command `validate` and `inline`: Appendix F
|
|
2339
|
+
agents in Markdown, and the command `validate` and `inline`: Appendix F; 1.0.2, November 16, the API's additions since,
|
|
2340
|
+
declared actions and saved files (7.13), a photo's zoom and credit (7.12), and its types corrected; 1.0.3, not yet published, what another host needs to run widgets in frames: Appendix F), served by jsDelivr and unpkg (4.3). jsDelivr keeps a
|
|
1976
2341
|
range's file (`@1`) up to 12 hours and lets a browser keep it up to 7 days, an exact version's for good; unpkg sends
|
|
1977
|
-
`@1` on to the exact version: a runtime fix reaches a CDN address within those times, startside.app's at once. Startside's own widgets are
|
|
1978
|
-
files; Appendix A's first example is
|
|
2342
|
+
`@1` on to the exact version: a runtime fix reaches a CDN address within those times, startside.app's at once. Startside's own widgets are 57 SWA files (51 of
|
|
2343
|
+
them its UWA widgets, rewritten November 11, 2026), 29 RWA files and one UWA 1.2 file (xkcd), as of November 15, 2026; Appendix A's first example is
|
|
2344
|
+
an SWA one.
|
|
1979
2345
|
|
|
1980
2346
|
## Appendix D. IDL Index
|
|
1981
2347
|
|
|
1982
2348
|
*This appendix is non-normative.* The interfaces defined here: `Widget` (7.1), `WidgetEvent` (7.6.1); the dictionaries `WidgetEnvironment`,
|
|
1983
2349
|
`WidgetSetting`, `WidgetSettingOption` (7.2), `ChromeColorOptions` (7.4), `CountGripOptions`, `HeightGripOptions` (7.7),
|
|
1984
2350
|
`ReadItemsOptions` (7.10), `ReaderItem`, `OpenItemsOptions` (7.11),
|
|
1985
|
-
`PlayAudioOptions`, `AudioState`, `AudioControls`, `AudioInfo`, `VideoSpec`, `VideoState`, `PhotoSpec` (7.12),
|
|
1986
|
-
`ShareData`, `AddWidgetSpec` (7.13), `WidgetEventInit` (7.6.1), `FetchFeedOptions` (8.2); the
|
|
2351
|
+
`PlayAudioOptions`, `AudioState`, `ElsewhereAudio`, `AudioControls`, `AudioInfo`, `VideoSpec`, `VideoState`, `PhotoSpec` (7.12),
|
|
2352
|
+
`ShareData`, `AddWidgetSpec`, `WidgetActionState` (7.13), `WidgetEventInit` (7.6.1), `FetchFeedOptions` (8.2); the callbacks `ReadKey` (7.10) and `DragWidgetCallback` (7.13); the typedef `ContentFeed` (8.5); the mixin `WidgetElement` (11.2, for UWA files).
|
|
1987
2353
|
|
|
1988
2354
|
## Appendix E. Open issues
|
|
1989
2355
|
|
|
@@ -2004,7 +2370,7 @@ draft. Each is to be resolved before the specification is considered complete.
|
|
|
2004
2370
|
|
|
2005
2371
|
<a id="issue-7"></a>**Issue 7. Settings: edge cases and applying them.** Define empty and multiple `select`s, duplicate options, disabled controls, `step="any"`, malformed numbers, labels with several `label`s; the timing of a pause and of grouping; the precedence of `livePreferences`, `data-commit` and the type; the grammar of `data-when`; what applying a password does (an empty field keeping the stored one?); the validation of `url` and `number` values against their `step`; whether `setValue` accepts undeclared names, validates, or fires an event.
|
|
2006
2372
|
|
|
2007
|
-
<a id="issue-8"></a>**Issue 8. Passwords on every path.** Section 6.5 keeps a password's value from a framed widget. Name every path
|
|
2373
|
+
<a id="issue-8"></a>**Issue 8. Passwords on every path.** Section 6.5 keeps a password's value from a framed widget, and a key for a site (`data-key-for`, 5.3) from every widget. Name every path a password must not take: `preferences`, `getPreference`, restored values, the declared feed's template, shared links, diagnostics; and whether a file may declare a password's default.
|
|
2008
2374
|
|
|
2009
2375
|
<a id="issue-9"></a>**Issue 9. URLs, proxies and the fetch relay.** Define one URL resolution and authorization algorithm (what a relative URL resolves against, which of the host's addresses are public services), the proxies' address checks (resolved addresses, IPv4 and IPv6, redirects, credentials in URLs), and the subset of Fetch the relay supports: methods, bodies, headers, aborts, redirects, response URLs, CORS.
|
|
2010
2376
|
|
|
@@ -2050,6 +2416,19 @@ draft. Each is to be resolved before the specification is considered complete.
|
|
|
2050
2416
|
|
|
2051
2417
|
<a id="issue-30"></a>**Issue 30. The room a widget has.** A widget's height is its content's (7.3.2). Define whether a host tells a widget the room it has (a window shorter than the widget, a host that frames it at a fixed height: `widget.layout` or a `resize` event's `detail` with the width and the height available), and whether a widget may ask for more.
|
|
2052
2418
|
|
|
2419
|
+
<a id="issue-31"></a>**Issue 31. Libraries from npm.** A framed widget's scripts may come from any `https` address today
|
|
2420
|
+
(4.8, 10.1 limits connections, not scripts), and nothing says how. Consider dependencies declared in an import map in
|
|
2421
|
+
the file, from one source (npm through jsDelivr's `/+esm`), at exact versions with integrity: a host can then read them
|
|
2422
|
+
without running the widget, the validator refuse a version that isn't pinned, the person be told code comes from
|
|
2423
|
+
elsewhere (Privacy), a host keep them offline and, later, serve them itself. Its plan: `docs/plans/swa-npm-dependencies.md`.
|
|
2424
|
+
|
|
2425
|
+
<a id="issue-32"></a>**Issue 32. A widget's own actions.** *Resolved* (7.13, November 12, 2026: actions declared in the file, `<menu id="actions">`, their state changed by `setActionStates`, the `action` event, an icon hint and a question the host asks; a first version made the list in script, `setActions`, dropped the same day for the declaration; then a file to keep, `data-save` and `saveFile`, answering a choice in the menu). Open: a list only known as the widget runs, should a widget need one; a download from a control of the widget's own (`saveFile` without `action`: a host dialog showing the final name, and a declaration for the whole widget); opening a file from the menu (the same extension syntax and limits, its own authorization: the host opening the picker from its own click). A widget's options menu (▾; on its own page, 10.3) holds the host's actions
|
|
2426
|
+
only (Refresh, Maximize, Mark all as read). Some actions are the widget's but don't belong in its body: the Recipe
|
|
2427
|
+
widget's *Start over*, which unticks everything and stops its timers, is a button at the bottom of the recipe for now
|
|
2428
|
+
(the Startside user, November 2026: "Start Over should be a widget action"). Consider actions a widget declares (in its
|
|
2429
|
+
metadata, or `widget.setActions([{ id, label }])` as its state changes) that the host lists in the menu with its own,
|
|
2430
|
+
and an `action` event carrying the `id` when one is chosen; a question it then asks stays in the widget's body.
|
|
2431
|
+
|
|
2053
2432
|
---
|
|
2054
2433
|
|
|
2055
2434
|
## Appendix F. Tools for authors
|
|
@@ -2071,6 +2450,9 @@ draft. Each is to be resolved before the specification is considered complete.
|
|
|
2071
2450
|
(`https://cdn.jsdelivr.net/npm/@startside/swa@1/swa/1.0/agents.md`). Served by jsDelivr and unpkg (4.3), installed
|
|
2072
2451
|
with `npm install @startside/swa`. Since 1.0.1 too, a command, for Node 20 or later, with nothing else to install:
|
|
2073
2452
|
`validate` and `inline`, below.
|
|
2453
|
+
- **Running widgets in another page.** Since 1.0.3, `@startside/swa` also carries the runtime a host writes into a
|
|
2454
|
+
widget's frame (`swa/1.0/frame.js`, SWA files only), its base styles (`frame.css`), and `host.md`: how a host runs a
|
|
2455
|
+
frame (10.1), the configuration that runtime reads and the messages a host answers.
|
|
2074
2456
|
- **Checking a file.** `npx @startside/swa validate my-widget.swa.html` reads a widget file without running it, with no
|
|
2075
2457
|
network: the file's name and document, its runtime tag, metadata and settings form, and its scripts against this
|
|
2076
2458
|
API, UWA's members and globals named with what replaces them. Each finding is `file:line:col: error|warning:
|
|
@@ -2121,5 +2503,6 @@ draft. Each is to be resolved before the specification is considered complete.
|
|
|
2121
2503
|
|
|
2122
2504
|
## Acknowledgements
|
|
2123
2505
|
|
|
2124
|
-
SWA keeps the interface of the Universal Widget API, designed at Netvibes
|
|
2125
|
-
|
|
2506
|
+
SWA keeps the interface of the [Universal Widget API](https://startside.app/uwa/1.2/spec.md), designed at Netvibes, whose runtime Netvibes.org
|
|
2507
|
+
published as open source (NVO; [an archive](https://github.com/znarf/nvo), forked from the original); its 1.2 Working
|
|
2508
|
+
Draft was edited by Xavier Borderie and François Hodierne (2008).
|