@onlyworlds/sdk 4.117.2 → 4.119.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +21 -0
- package/README.md +2 -2
- package/SCHEMA.md +1 -1
- package/dist/{chunk-CH3ITUSR.js → chunk-2FAAOQVM.js} +11 -6
- package/dist/index.d.ts +65 -9
- package/dist/index.js +55 -4
- package/dist/waymark.css +4 -4
- package/dist/waymark.d.ts +7 -0
- package/dist/waymark.js +45 -6
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# For AI agents using @onlyworlds/sdk
|
|
2
2
|
|
|
3
|
-
**Current as of**: SDK **4.x** · schema-dist **v0.33.0-dist.
|
|
3
|
+
**Current as of**: SDK **4.x** · schema-dist **v0.33.0-dist.98** (canonical 00.33.00).
|
|
4
4
|
This line is asserted by `codegen:check` in CI — if the pin moves and this file is not
|
|
5
5
|
re-read against it, the check fails rather than letting this document rot quietly.
|
|
6
6
|
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,27 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.119.0] - 2026-10-30
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`strandOf(world, reader)`, the strand profile's reader** (schema-dist serial 98, `profiles/strand.md`). A strand is a world in miniature: one story, one of its happenings, where that happened, the story's hero and where the hero is now, read off four links the standard already has. The World's mark `x_strand` (exported as `STRAND_FIELD`) is an object of three ids, `{narrative, event, location}`; any other shape is no mark. `strandOf` answers `{narrative, event, location, character, now, same}` as `reader` sees the world, each filled slot `{id, name}` and an empty one `null`: `narrative` is the marked Narrative; `event` the marked Event when it is in the story's `events`; `location` the marked Location when it is in that event's `locations`; `character` the story's `protagonist`; `now` the hero's `location`; `same` true when `now` and `location` are one place (compared by id), false when two, else `null`. A slot holds only its own kind, no list order is read, and no slot is filled from another. The world and the reader are `resolveLens`'s (`OwStrandWorld`, `OwLensReader`), so every slot is read through that reader's view and the bodies it is served: a story the reader knows only as a stub fills its own slot and nothing past it, and a public reader reads nothing of a world that is not open. Types `OwStrand`, `OwStrandSlot`. All 17 of the profile's fixture cases are the test.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **The schema pin moves to schema-dist serial 98** (`v0.33.0-dist.98`), which adds the strand profile and its fixture. No schema file moved: the generated output changes only its provenance lines.
|
|
17
|
+
|
|
18
|
+
## [4.118.0] - 2026-10-30
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **`openersFor` takes `online` on the surface.** With `online: false`, every row whose href is a web address (its scheme `http:` or `https:`, read from the row's own filled href) says "Needs a connection", the site's own `onlyworlds` row included, which had no word before. The words in order, the first that holds: "You are here" for the surface's own tool, then "Needs a connection", then the account, browser and phone words, then "Opens the world"; so offline, a row that needed a sign-in says the connection. A row whose link opens an app on the device (any other scheme) keeps its own word, and every row keeps its href. `online` defaults to true, which gives the rows as before; anything but `true` or `false` is a TypeError naming it. `OwOpenerState` gains the word. The shared fixture gains nine cases (54; the same bytes as the Python package's).
|
|
23
|
+
- **The Waymark draws the offline row.** At each open it reads `navigator.onLine` (no navigator reads as online) and draws the rows `openersFor` gives for it. Offline, a row that says "Needs a connection" is grey (`ow-waymark__row--cannot`, no new style) and is a link with no href and `aria-disabled="true"`, still a menu item in the arrow and Tab order; a click, Enter or Space on it does nothing, and the fan-out stays open. While the fan-out is open it listens to the window's `online` and `offline` events and redraws the rows in place: focus on a row stays on that row, and nothing else moves. The listeners go when it closes. Copy link is unchanged. No new option.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- **The Waymark's sheet and its toast clear a phone's safe area.** On a page with `viewport-fit=cover`, an iPhone's home indicator covered the lower part of the sheet's last row (Copy link) and the "Link copied" toast. The sheet's bottom padding is now `calc(18px + env(safe-area-inset-bottom, 0px))` and the toast sits at `calc(24px + env(safe-area-inset-bottom, 0px))`, at 480 px and below and in the sheet a narrow box takes alike. On a page without `viewport-fit=cover` the inset is 0 and nothing moves.
|
|
28
|
+
|
|
8
29
|
## [4.117.2] - 2026-10-30
|
|
9
30
|
|
|
10
31
|
### Fixed
|
package/README.md
CHANGED
|
@@ -471,7 +471,7 @@ const rows = openersFor(TOOLS, 'element', parseOwLink(link), { audience: 'member
|
|
|
471
471
|
// [{ id: 'onlyworlds', name: 'onlyworlds.com', href, state: null }, { id: 'atlas', name: 'Atlas', href, state: 'Sign in to Atlas first' }, ...]
|
|
472
472
|
```
|
|
473
473
|
|
|
474
|
-
`surface` says what the page knows and nothing is guessed: `audience` (`member` or `public`; the public sees only rows that need nothing first), `signedIn` (`null` when the page cannot know, and then no row says so), `browser` (false in a desktop app), `phone`, and `tool`, the page's own client name, whose row says "You are here". Draw the rows as given; the words are decided here, so every surface says the same.
|
|
474
|
+
`surface` says what the page knows and nothing is guessed: `audience` (`member` or `public`; the public sees only rows that need nothing first), `signedIn` (`null` when the page cannot know, and then no row says so), `browser` (false in a desktop app), `phone`, `online` (false with no connection: every row whose link is a web address then says "Needs a connection"), and `tool`, the page's own client name, whose row says "You are here". Draw the rows as given; the words are decided here, so every surface says the same.
|
|
475
475
|
|
|
476
476
|
### The Waymark: Open with, beside a name
|
|
477
477
|
|
|
@@ -491,7 +491,7 @@ const dispose = mountWaymark(document.querySelector('h1.name'), {
|
|
|
491
491
|
// later: dispose() removes every node, listener and timer it added
|
|
492
492
|
```
|
|
493
493
|
|
|
494
|
-
What it draws is decided in the core, never in the component: the rows and their words are `openersFor`'s, a member's "Last shaped in Atlas, 12 Oct" line is `doorsOf`'s newest entry in `doorWhere`'s words with its date, and Copy link copies `elementAddress`'s site address with the world's id (never a slug) and says "Link copied". When the page has no clipboard or the copy is refused, the fan-out stays open and the toast says "Could not copy the link." over the same address in a read-only line, selected for a copy by hand; it stays until the fan-out closes or Escape. The public face (`reader: 'public'`) shows the name and type, only the rows that need nothing first, and Copy link: no last door, no lenses. A row that cannot open now says why ("Sign in to Atlas first", "Needs the world on this phone") and is grey; grey means nothing else. The page's own tool says "You are here", and its row leads nowhere: a button with `aria-current="page"`, not a link, which closes the fan-out and returns focus to what opened it.
|
|
494
|
+
What it draws is decided in the core, never in the component: the rows and their words are `openersFor`'s, a member's "Last shaped in Atlas, 12 Oct" line is `doorsOf`'s newest entry in `doorWhere`'s words with its date, and Copy link copies `elementAddress`'s site address with the world's id (never a slug) and says "Link copied". When the page has no clipboard or the copy is refused, the fan-out stays open and the toast says "Could not copy the link." over the same address in a read-only line, selected for a copy by hand; it stays until the fan-out closes or Escape. The public face (`reader: 'public'`) shows the name and type, only the rows that need nothing first, and Copy link: no last door, no lenses. A row that cannot open now says why ("Sign in to Atlas first", "Needs the world on this phone", "Needs a connection") and is grey; grey means nothing else. The connection is read from `navigator.onLine` at each open, and while the fan-out is open its rows follow the window's `online` and `offline` events; offline, a web row is a link with no href, `aria-disabled="true"`, that does nothing when pressed. The page's own tool says "You are here", and its row leads nowhere: a button with `aria-current="page"`, not a link, which closes the fan-out and returns focus to what opened it.
|
|
495
495
|
|
|
496
496
|
Options, each refused by name when unknown, before anything is drawn: `world` (its `x_names`, when present, words the type), `element`, `reader`, `tool`, `signedIn`, `browser`, `phone`, `tools` (default `TOOLS`), `lenses` (`[{ id, name }]`, the Through row; absent, no row; a lens chosen rides on the copied link as `?lens=`), `ground`, `entry` and `returnFocus`.
|
|
497
497
|
|
package/SCHEMA.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OnlyWorlds Schema Reference
|
|
2
2
|
|
|
3
|
-
**Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.33.0-dist.
|
|
3
|
+
**Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.33.0-dist.98** — canonical schema **00.33.00**, published 2026-10-30.
|
|
4
4
|
|
|
5
5
|
GENERATED from the canonical schema YAML — do not hand-edit (regenerate: `python codegen/generate_types.py`).
|
|
6
6
|
Written for both humans and AI agents reading this package locally.
|
|
@@ -1234,9 +1234,11 @@ function parseOwLink(text) {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
|
|
1236
1236
|
// src/openers.ts
|
|
1237
|
-
var SURFACE_KEYS = ["tool", "audience", "signedIn", "browser", "phone"];
|
|
1237
|
+
var SURFACE_KEYS = ["tool", "audience", "signedIn", "browser", "phone", "online"];
|
|
1238
1238
|
var NEEDS = ["account", "device", null];
|
|
1239
1239
|
var PLACEHOLDER = /\{(world|type|id)\}/g;
|
|
1240
|
+
var WEB = /^https?:/i;
|
|
1241
|
+
var OFFLINE = "Needs a connection";
|
|
1240
1242
|
var fail = (what) => {
|
|
1241
1243
|
throw new TypeError(`openersFor: ${what}`);
|
|
1242
1244
|
};
|
|
@@ -1261,17 +1263,18 @@ function openersFor(tools, kind, address, surface) {
|
|
|
1261
1263
|
const id = hasElement ? a.id.toLowerCase() : "";
|
|
1262
1264
|
if (surface === null || typeof surface !== "object" || Array.isArray(surface)) fail("the surface is an object ({ audience, ... })");
|
|
1263
1265
|
refuseUnknownOptions("openersFor", surface, SURFACE_KEYS);
|
|
1264
|
-
const { tool = null, audience, signedIn = null, browser = true, phone = false } = surface;
|
|
1266
|
+
const { tool = null, audience, signedIn = null, browser = true, phone = false, online = true } = surface;
|
|
1265
1267
|
if (audience !== "member" && audience !== "public") fail(`surface.audience is 'member' or 'public'; got ${JSON.stringify(audience)}`);
|
|
1266
1268
|
if (tool !== null && typeof tool !== "string") fail("surface.tool is a client name or null");
|
|
1267
1269
|
if (signedIn !== null && typeof signedIn !== "boolean") fail("surface.signedIn is true, false or null");
|
|
1268
1270
|
if (typeof browser !== "boolean") fail("surface.browser is a boolean");
|
|
1269
1271
|
if (typeof phone !== "boolean") fail("surface.phone is a boolean");
|
|
1272
|
+
if (typeof online !== "boolean") fail("surface.online is a boolean");
|
|
1270
1273
|
const values = { world, type, id };
|
|
1271
1274
|
const fill = (template) => template.replace(PLACEHOLDER, (_, n) => values[n]);
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
];
|
|
1275
|
+
const offline = (href) => !online && WEB.test(href);
|
|
1276
|
+
const site = kind === "element" ? page : elementAddress({ form: "human", world });
|
|
1277
|
+
const rows = [{ id: "onlyworlds", name: "onlyworlds.com", href: site, state: offline(site) ? OFFLINE : null }];
|
|
1275
1278
|
for (const r of tools) {
|
|
1276
1279
|
if (r === null || typeof r !== "object" || typeof r.id !== "string" || typeof r.name !== "string") {
|
|
1277
1280
|
fail("each tools row is an object with an id and a name");
|
|
@@ -1288,13 +1291,15 @@ function openersFor(tools, kind, address, surface) {
|
|
|
1288
1291
|
if (audience === "public" && needs !== null) continue;
|
|
1289
1292
|
const template = kind === "element" ? elementDoor ?? worldDoor : worldDoor;
|
|
1290
1293
|
if (template === null) continue;
|
|
1294
|
+
const href = fill(template);
|
|
1291
1295
|
let state = null;
|
|
1292
1296
|
if (tool !== null && r.client === tool) state = "You are here";
|
|
1297
|
+
else if (offline(href)) state = OFFLINE;
|
|
1293
1298
|
else if (needs === "account" && !browser) state = "Opens in your browser";
|
|
1294
1299
|
else if (needs === "account" && signedIn === false) state = `Sign in to ${r.name} first`;
|
|
1295
1300
|
else if (needs === "device" && phone) state = "Needs the world on this phone";
|
|
1296
1301
|
else if (kind === "element" && elementDoor === null) state = "Opens the world";
|
|
1297
|
-
rows.push({ id: r.id, name: r.name, href
|
|
1302
|
+
rows.push({ id: r.id, name: r.name, href, state });
|
|
1298
1303
|
}
|
|
1299
1304
|
return rows;
|
|
1300
1305
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5346,6 +5346,57 @@ declare function charterOf(world: OwCharterWorld, reader: OwLensReader): OwReadi
|
|
|
5346
5346
|
/** The marked Domains alone, as `charterOf` lists them for the same reader. */
|
|
5347
5347
|
declare function domainsOf(world: OwCharterWorld, reader: OwLensReader): OwReadingAidsDomain[];
|
|
5348
5348
|
|
|
5349
|
+
/** The World's field that carries the strand's mark. */
|
|
5350
|
+
declare const STRAND_FIELD = "x_strand";
|
|
5351
|
+
/** The world snapshot a strand is read from: the lens reader's world, the World's mark, and whether it is open to anyone. */
|
|
5352
|
+
interface OwStrandWorld extends OwLensWorld {
|
|
5353
|
+
/** The mark, `{narrative, event, location}`, three ids; any other shape is no mark. */
|
|
5354
|
+
x_strand?: unknown;
|
|
5355
|
+
/** True for a world open to anyone: only then does the public rung read anything of it. */
|
|
5356
|
+
open?: boolean | null;
|
|
5357
|
+
}
|
|
5358
|
+
/** A filled slot. */
|
|
5359
|
+
interface OwStrandSlot {
|
|
5360
|
+
id: string;
|
|
5361
|
+
name: string;
|
|
5362
|
+
}
|
|
5363
|
+
/** A world's strand as one reader sees it: five slots and whether then and now are one place. An empty slot is null. */
|
|
5364
|
+
interface OwStrand {
|
|
5365
|
+
/** The story: the Narrative the mark names. */
|
|
5366
|
+
narrative: OwStrandSlot | null;
|
|
5367
|
+
/** The happening: the Event the mark names, when it is in the story's `events`. */
|
|
5368
|
+
event: OwStrandSlot | null;
|
|
5369
|
+
/** The place, then: the Location the mark names, when it is in the event's `locations`. */
|
|
5370
|
+
location: OwStrandSlot | null;
|
|
5371
|
+
/** The hero: the story's `protagonist`. */
|
|
5372
|
+
character: OwStrandSlot | null;
|
|
5373
|
+
/** The place, now: the hero's `location`. */
|
|
5374
|
+
now: OwStrandSlot | null;
|
|
5375
|
+
/** True when `now` and `location` are both filled and one place, false when both filled and two, null otherwise. */
|
|
5376
|
+
same: boolean | null;
|
|
5377
|
+
}
|
|
5378
|
+
/**
|
|
5379
|
+
* A world's strand as `reader` sees it (schema-dist profiles/strand.md): `{narrative, event, location, character,
|
|
5380
|
+
* now, same}`, each filled slot `{id, name}` and an empty one null.
|
|
5381
|
+
*
|
|
5382
|
+
* `narrative` is the element the mark names when it is a Narrative in the reader's view; with none, every slot is
|
|
5383
|
+
* empty. `event` is the element the mark names when it is an Event in the reader's view and in the story's `events`
|
|
5384
|
+
* as the reader is served them; `location` the element the mark names when it is a Location in the reader's view and
|
|
5385
|
+
* in that event's `locations`, empty when the event is. `character` is the story's `protagonist` when it is a
|
|
5386
|
+
* Character in the reader's view; `now` the hero's `location` when it is a Location in the reader's view, empty when
|
|
5387
|
+
* the hero is. `same` is true when `now` and `location` are both filled with one id, false when with two, else null.
|
|
5388
|
+
* A list's order is never read, and no slot is filled from another: not the hero from the event's `characters`, not
|
|
5389
|
+
* `location` from `now`, not `now` from `location`. Any mark that is not an object of three non-empty strings is no
|
|
5390
|
+
* mark, and the strand is empty.
|
|
5391
|
+
*
|
|
5392
|
+
* `world` holds the elements as the owner is served them (the hidden in `hidden` or each element's own `hidden`),
|
|
5393
|
+
* the World's `x_strand`, and `open: true` for a world open to anyone; `reader` is a lens reader (`OwLensReader`):
|
|
5394
|
+
* the owner, a contributor, a guest (its `whole` and `known_of` ids) or the public, which reads nothing of a world
|
|
5395
|
+
* that is not open. A slot's links are read from the body the reader is served, so a story known only as a stub
|
|
5396
|
+
* fills its own slot and nothing past it. Pure.
|
|
5397
|
+
*/
|
|
5398
|
+
declare function strandOf(world: OwStrandWorld, reader: OwLensReader): OwStrand;
|
|
5399
|
+
|
|
5349
5400
|
/**
|
|
5350
5401
|
* The review profile's proposed mark (schema-dist profiles/review.md): an element whose
|
|
5351
5402
|
* `x_review_proposed` is an object was written as proposed (an AI seat's new element on a world
|
|
@@ -5624,9 +5675,11 @@ interface OwOpenerSurface {
|
|
|
5624
5675
|
browser?: boolean;
|
|
5625
5676
|
/** True on a phone. Default false. */
|
|
5626
5677
|
phone?: boolean;
|
|
5678
|
+
/** False when the device has no connection; then every row whose link is a web address says "Needs a connection". Default true. */
|
|
5679
|
+
online?: boolean;
|
|
5627
5680
|
}
|
|
5628
5681
|
/** The word a row says when it cannot open now, or says where it lands. Sentence case, exactly. */
|
|
5629
|
-
type OwOpenerState = 'You are here' | `Sign in to ${string} first` | 'Opens in your browser' | 'Needs the world on this phone' | 'Opens the world';
|
|
5682
|
+
type OwOpenerState = 'You are here' | 'Needs a connection' | `Sign in to ${string} first` | 'Opens in your browser' | 'Needs the world on this phone' | 'Opens the world';
|
|
5630
5683
|
/** One row of the menu. */
|
|
5631
5684
|
interface OwOpener {
|
|
5632
5685
|
/** `onlyworlds` for the site's own row, else the tool's id in the list. */
|
|
@@ -5640,19 +5693,22 @@ interface OwOpener {
|
|
|
5640
5693
|
/**
|
|
5641
5694
|
* The rows of the Open with menu for a world (`kind: 'world'`) or one element of it (`'element'`), in
|
|
5642
5695
|
* order: first the site's own row (id `onlyworlds`, name `onlyworlds.com`, the world's or the element's
|
|
5643
|
-
* page on www.onlyworlds.com,
|
|
5644
|
-
* list's order, that is `listed` and has a door for this kind. `tools`
|
|
5645
|
-
* or the list as served; `address` is a reading from `parseOwLink` or
|
|
5646
|
-
* the world's id. A lens and a moment on it ride on no href.
|
|
5696
|
+
* page on www.onlyworlds.com, for every audience, its one word "Needs a connection" when offline), then
|
|
5697
|
+
* one row per `tools` row, in the list's order, that is `listed` and has a door for this kind. `tools`
|
|
5698
|
+
* is the tools list's rows, `TOOLS` or the list as served; `address` is a reading from `parseOwLink` or
|
|
5699
|
+
* what `elementAddress` takes, with the world's id. A lens and a moment on it ride on no href.
|
|
5647
5700
|
*
|
|
5648
5701
|
* A row with `open: null`, or with no door for this kind, is not there. On an element, a tool with only
|
|
5649
5702
|
* a world door is a row to its world door that says "Opens the world". For the `public` audience only
|
|
5650
5703
|
* rows whose `open.needs` is null are there: a row that needs anything does not exist for the public.
|
|
5651
5704
|
*
|
|
5652
5705
|
* Each row's `state`, the first that holds: "You are here" for the surface's own tool (its `client` is
|
|
5653
|
-
* `surface.tool`); then
|
|
5654
|
-
*
|
|
5655
|
-
*
|
|
5706
|
+
* `surface.tool`); then, when `surface.online` is false, "Needs a connection" for a row whose href is a
|
|
5707
|
+
* web address (scheme `http:` or `https:`; a row whose link opens an app on the device is unaffected,
|
|
5708
|
+
* and the href stays in the row either way); then what `needs` asks of this surface: `account` outside
|
|
5709
|
+
* a browser "Opens in your browser", in a browser signed out "Sign in to <name> first" (none when
|
|
5710
|
+
* `signedIn` is null: a word shows only when the surface knows it is true), `device` on a phone "Needs
|
|
5711
|
+
* the world on this phone"; then
|
|
5656
5712
|
* "Opens the world" (a world door on an element: a sign-in the row needs is the more urgent word); else null.
|
|
5657
5713
|
*
|
|
5658
5714
|
* Refuses with `OwAddressError` whatever `elementAddress` refuses of the whole address, in its own form
|
|
@@ -6823,4 +6879,4 @@ declare class TokenResource {
|
|
|
6823
6879
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
6824
6880
|
}
|
|
6825
6881
|
|
|
6826
|
-
export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, CHARTER_PAIRS, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, ELEMENT_FAMILIES, ELEMENT_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementGroup, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GROUP_COLORS, GROUP_ORDER, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAddress, OwAddressError, type OwAddressForm, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwCharterWorld, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDoor, type OwDragField, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwGraphCutReason, type OwGraphEdge, type OwGraphMark, type OwGraphNode, type OwGraphOptions, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLensCutReason, type OwLensMail, type OwLensOptions, type OwLensReader, type OwLensReading, type OwLensWorld, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberLenses, type OwMemberRole, type OwMessageMember, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwOpener, type OwOpenerKind, type OwOpenerState, type OwOpenerSurface, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwReadingAids, type OwReadingAidsCharter, type OwReadingAidsDomain, type OwReadingAidsGuide, type OwReadingAidsHub, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwTool, type OwToolNeeds, type OwToolOpen, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldGraph, type OwWorldIndex, type OwWorldLens, type OwWorldLensReading, type OwWorldLenses, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, TOOLS, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, charterOf, dateOf, degreeOf, detectKeyKind, displayYear, domainsOf, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, readingAidOf, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
|
|
6882
|
+
export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, CHARTER_PAIRS, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, ELEMENT_FAMILIES, ELEMENT_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementGroup, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GROUP_COLORS, GROUP_ORDER, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountWorld, type OwAddress, OwAddressError, type OwAddressForm, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, type OwAgentJoined, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwCharterWorld, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDoor, type OwDragField, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwGraphCutReason, type OwGraphEdge, type OwGraphMark, type OwGraphNode, type OwGraphOptions, type OwHiddenRow, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLensCutReason, type OwLensMail, type OwLensOptions, type OwLensReader, type OwLensReading, type OwLensWorld, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberLenses, type OwMemberRole, type OwMessageMember, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwOpener, type OwOpenerKind, type OwOpenerState, type OwOpenerSurface, type OwPage, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwReadingAids, type OwReadingAidsCharter, type OwReadingAidsDomain, type OwReadingAidsGuide, type OwReadingAidsHub, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwStrand, type OwStrandSlot, type OwStrandWorld, type OwTool, type OwToolNeeds, type OwToolOpen, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldGraph, type OwWorldIndex, type OwWorldLens, type OwWorldLensReading, type OwWorldLenses, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, STRAND_FIELD, type SectionInfo, type StepBreakdown, TOOLS, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, charterOf, dateOf, degreeOf, detectKeyKind, displayYear, domainsOf, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, lensesInUse, lookupWorld, monthStartSteps, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readWorldFile, readingAidOf, recipientsOf, renderElement, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, senderStatus, simpleCaseFold, strandOf, threadOf, typeWord, unreadFor, validateCalendarConfig, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
trimWhiteSpace,
|
|
38
38
|
typeWord,
|
|
39
39
|
unknownKey
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-2FAAOQVM.js";
|
|
41
41
|
|
|
42
42
|
// src/v2/keyed-id.ts
|
|
43
43
|
var KEYED_IDS = "0199b6a0-6f0e-7c2a-9d1e-3b5c7a8e4f21";
|
|
@@ -3435,6 +3435,55 @@ function domainsOf(world, reader) {
|
|
|
3435
3435
|
return charterOf(world, reader).domains;
|
|
3436
3436
|
}
|
|
3437
3437
|
|
|
3438
|
+
// src/strand.ts
|
|
3439
|
+
var STRAND_FIELD = "x_strand";
|
|
3440
|
+
var SLOTS = ["narrative", "event", "location"];
|
|
3441
|
+
var EMPTY = () => ({ narrative: null, event: null, location: null, character: null, now: null, same: null });
|
|
3442
|
+
function markOf(value) {
|
|
3443
|
+
if (!isBody2(value)) return null;
|
|
3444
|
+
const v = value;
|
|
3445
|
+
for (const slot of SLOTS) {
|
|
3446
|
+
if (typeof v[slot] !== "string" || v[slot] === "") return null;
|
|
3447
|
+
}
|
|
3448
|
+
return { narrative: v.narrative, event: v.event, location: v.location };
|
|
3449
|
+
}
|
|
3450
|
+
function strandOf(world, reader) {
|
|
3451
|
+
if (!isBody2(world) || !Array.isArray(world.elements)) {
|
|
3452
|
+
throw new TypeError("strandOf: world is an object with an elements list.");
|
|
3453
|
+
}
|
|
3454
|
+
checkReader(reader, "strandOf: reader");
|
|
3455
|
+
const out = EMPTY();
|
|
3456
|
+
const mark = markOf(world[STRAND_FIELD]);
|
|
3457
|
+
if (mark === null) return out;
|
|
3458
|
+
const r = new Reading(world, reader, null);
|
|
3459
|
+
if (r.seenRung === "public" && world.open !== true) return out;
|
|
3460
|
+
const seen = (id, type) => typeof id === "string" && r.view.has(id) && r.typeOf.get(id) === type;
|
|
3461
|
+
const slot = (id) => {
|
|
3462
|
+
const name = r.body(id).name;
|
|
3463
|
+
return { id, name: typeof name === "string" ? name : "" };
|
|
3464
|
+
};
|
|
3465
|
+
const listed = (holder, field, id) => {
|
|
3466
|
+
const v = r.body(holder)[field];
|
|
3467
|
+
return Array.isArray(v) && v.includes(id);
|
|
3468
|
+
};
|
|
3469
|
+
if (!seen(mark.narrative, "narrative")) return out;
|
|
3470
|
+
out.narrative = slot(mark.narrative);
|
|
3471
|
+
if (seen(mark.event, "event") && listed(mark.narrative, "events", mark.event)) {
|
|
3472
|
+
out.event = slot(mark.event);
|
|
3473
|
+
if (seen(mark.location, "location") && listed(mark.event, "locations", mark.location)) {
|
|
3474
|
+
out.location = slot(mark.location);
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
const hero = r.body(mark.narrative).protagonist;
|
|
3478
|
+
if (seen(hero, "character")) {
|
|
3479
|
+
out.character = slot(hero);
|
|
3480
|
+
const now = r.body(hero).location;
|
|
3481
|
+
if (seen(now, "location")) out.now = slot(now);
|
|
3482
|
+
}
|
|
3483
|
+
if (out.now !== null && out.location !== null) out.same = out.now.id === out.location.id;
|
|
3484
|
+
return out;
|
|
3485
|
+
}
|
|
3486
|
+
|
|
3438
3487
|
// src/graph.ts
|
|
3439
3488
|
var GRAPH_OPTION_KEYS = ["lens", "asOf", "clock", "rooms", "hidden", "proposed", "mapSpace"];
|
|
3440
3489
|
var DECLARED_LINKS = ["x_lens_leads_to", "x_spine_depends_on"];
|
|
@@ -4734,7 +4783,7 @@ function readOptions(opts) {
|
|
|
4734
4783
|
}
|
|
4735
4784
|
function buildAskContext(items, index, opts = {}) {
|
|
4736
4785
|
const o = readOptions(opts);
|
|
4737
|
-
const
|
|
4786
|
+
const markOf2 = (el) => {
|
|
4738
4787
|
if (!o.includeHidden && isHidden(el)) return "hidden";
|
|
4739
4788
|
if (!o.includeProposed && isProposed(el)) return "proposed";
|
|
4740
4789
|
if (!o.includeRoom && isRoomElement(el)) return "room";
|
|
@@ -4742,7 +4791,7 @@ function buildAskContext(items, index, opts = {}) {
|
|
|
4742
4791
|
};
|
|
4743
4792
|
const withheld = (id) => {
|
|
4744
4793
|
const el = index.byId.get(id);
|
|
4745
|
-
return el !== void 0 &&
|
|
4794
|
+
return el !== void 0 && markOf2(el) !== null;
|
|
4746
4795
|
};
|
|
4747
4796
|
const viewFor = (el) => {
|
|
4748
4797
|
const out2 = index.out.get(el.id) ?? [];
|
|
@@ -4760,7 +4809,7 @@ function buildAskContext(items, index, opts = {}) {
|
|
|
4760
4809
|
let full = false;
|
|
4761
4810
|
for (const item of items) {
|
|
4762
4811
|
const el = item && typeof item === "object" && "element" in item ? item.element : item;
|
|
4763
|
-
const mark =
|
|
4812
|
+
const mark = markOf2(el);
|
|
4764
4813
|
if (mark) {
|
|
4765
4814
|
out.leftOut[mark].push(el.id);
|
|
4766
4815
|
continue;
|
|
@@ -5839,6 +5888,7 @@ export {
|
|
|
5839
5888
|
REVIEW_PROPOSED_LABEL,
|
|
5840
5889
|
ROOM_PAIRS,
|
|
5841
5890
|
SPATIAL_TYPES,
|
|
5891
|
+
STRAND_FIELD,
|
|
5842
5892
|
TOOLS,
|
|
5843
5893
|
TokenResource,
|
|
5844
5894
|
WORLD_FILE_MAX_BYTES,
|
|
@@ -5924,6 +5974,7 @@ export {
|
|
|
5924
5974
|
resolveLens,
|
|
5925
5975
|
senderStatus,
|
|
5926
5976
|
simpleCaseFold,
|
|
5977
|
+
strandOf,
|
|
5927
5978
|
threadOf,
|
|
5928
5979
|
typeWord,
|
|
5929
5980
|
unreadFor,
|
package/dist/waymark.css
CHANGED
|
@@ -349,7 +349,7 @@
|
|
|
349
349
|
max-width: none;
|
|
350
350
|
max-height: 85vh;
|
|
351
351
|
overflow-y: auto;
|
|
352
|
-
padding: 8px 14px 18px;
|
|
352
|
+
padding: 8px 14px calc(18px + env(safe-area-inset-bottom, 0px));
|
|
353
353
|
border-width: 1px 0 0;
|
|
354
354
|
border-radius: 18px 18px 0 0;
|
|
355
355
|
box-shadow: none;
|
|
@@ -373,7 +373,7 @@
|
|
|
373
373
|
.ow-waymark--sheet .ow-waymark__toast {
|
|
374
374
|
position: fixed;
|
|
375
375
|
top: auto;
|
|
376
|
-
bottom: 24px;
|
|
376
|
+
bottom: calc(24px + env(safe-area-inset-bottom, 0px));
|
|
377
377
|
left: 50%;
|
|
378
378
|
transform: translateX(-50%);
|
|
379
379
|
}
|
|
@@ -404,7 +404,7 @@
|
|
|
404
404
|
max-width: none;
|
|
405
405
|
max-height: 85vh;
|
|
406
406
|
overflow-y: auto;
|
|
407
|
-
padding: 8px 14px 18px;
|
|
407
|
+
padding: 8px 14px calc(18px + env(safe-area-inset-bottom, 0px));
|
|
408
408
|
border-width: 1px 0 0;
|
|
409
409
|
border-radius: 18px 18px 0 0;
|
|
410
410
|
box-shadow: none;
|
|
@@ -429,7 +429,7 @@
|
|
|
429
429
|
.ow-waymark__toast {
|
|
430
430
|
position: fixed;
|
|
431
431
|
top: auto;
|
|
432
|
-
bottom: 24px;
|
|
432
|
+
bottom: calc(24px + env(safe-area-inset-bottom, 0px));
|
|
433
433
|
left: 50%;
|
|
434
434
|
transform: translateX(-50%);
|
|
435
435
|
}
|
package/dist/waymark.d.ts
CHANGED
|
@@ -88,6 +88,13 @@ interface OwWaymark {
|
|
|
88
88
|
* The surface's own row (the `tool` option's, "You are here") leads nowhere: a button with
|
|
89
89
|
* `aria-current="page"` and no link, which closes the fan-out and returns focus to what opened it.
|
|
90
90
|
*
|
|
91
|
+
* The connection is read at each open (`navigator.onLine`; no navigator reads as online), and the rows
|
|
92
|
+
* drawn for it: offline, every row whose link is a web address says "Needs a connection" (`openersFor`
|
|
93
|
+
* with `online: false`) and is drawn grey (`ow-waymark__row--cannot`) as a link with no href,
|
|
94
|
+
* `aria-disabled="true"`, still in the arrow and Tab order; pressing it (a click, Enter or Space) does
|
|
95
|
+
* nothing and the fan-out stays open. While the fan-out is open, the window's `online` and `offline`
|
|
96
|
+
* events redraw the rows in place, and focus on a row stays on that row. Copy link is unaffected.
|
|
97
|
+
*
|
|
91
98
|
* Keyboard: the mark is a button and the fan-out a menu; Tab goes from the mark through the rows in
|
|
92
99
|
* order, the arrow keys, Home and End move within it, Escape closes it and returns focus to what opened
|
|
93
100
|
* it: the mark, or for the entry `returnFocus` when given (the surface's "..." button, which stays
|
package/dist/waymark.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
openersFor,
|
|
7
7
|
refuseUnknownOptions,
|
|
8
8
|
typeWord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2FAAOQVM.js";
|
|
10
10
|
|
|
11
11
|
// src/waymark/glyphs.ts
|
|
12
12
|
var MARK_PATH = "M48.8 0.0 43.8 0.4 39.0 1.2 36.0 2.0 33.2 2.9 29.3 4.5 24.8 6.8 20.6 9.5 17.0 12.4 13.6 15.7 10.4 19.4 7.8 23.1 5.8 26.6 4.5 29.3 3.3 32.1 1.8 36.8 0.8 41.2 0.1 46.3 0.0 51.1 0.4 56.2 1.2 61.0 2.0 63.9 2.9 66.8 4.5 70.7 6.8 75.2 9.5 79.4 12.4 82.9 15.7 86.3 19.4 89.5 23.1 92.1 26.6 94.2 29.3 95.5 32.1 96.7 36.8 98.2 41.2 99.2 46.3 99.8 51.1 100.0 56.2 99.6 61.0 98.8 63.9 98.0 66.8 97.1 70.7 95.5 75.2 93.2 79.4 90.4 82.9 87.6 86.3 84.3 89.5 80.5 92.1 76.9 94.2 73.4 95.5 70.7 96.7 67.9 98.2 63.2 99.2 58.7 99.8 53.7 100.0 48.8 99.6 43.8 98.6 38.4 97.1 33.2 95.5 29.3 93.2 24.8 90.4 20.6 87.6 17.0 84.3 13.6 80.5 10.4 76.9 7.8 73.4 5.8 70.7 4.5 67.9 3.3 63.2 1.8 58.7 0.8 53.7 0.1ZM77.5 80.7 74.1 83.4 70.7 85.7 67.0 87.5 64.5 88.6 64.1 88.7 65.7 86.3 67.1 83.9 68.7 80.7 69.9 77.6 72.7 78.5 73.0 78.4ZM22.5 80.7 25.6 79.0 27.3 78.3 30.0 77.6 31.3 80.7 32.8 83.9 34.2 86.3 35.9 88.7 32.9 87.5 29.3 85.7 25.8 83.4ZM51.2 74.5 55.1 74.7 59.9 75.2 64.2 76.0 67.5 76.9 66.0 80.5 64.2 84.0 62.0 87.4 59.6 90.1 55.1 90.9 52.2 91.2 51.2 91.1ZM48.7 74.5 48.8 91.1 47.7 91.2 44.9 90.9 40.3 90.1 38.2 87.8 36.3 85.0 34.2 81.2 32.5 77.0 35.8 76.0 40.5 75.2 44.5 74.7ZM91.1 51.2 91.1 52.9 90.8 56.3 90.1 59.7 89.3 62.5 88.5 64.8 87.2 67.7 85.7 70.7 83.9 73.4 82.0 75.9 79.4 78.9 76.3 77.2 73.8 76.1 76.2 68.8 77.8 62.7 78.7 56.8 79.0 51.2ZM55.8 51.2 67.7 51.2 67.6 55.1 67.2 59.0 66.7 61.5 65.7 65.0 61.0 64.2 55.7 63.6ZM32.5 51.2 44.5 51.2 44.4 63.6 39.7 64.1 34.5 65.0 33.5 61.3 32.9 58.1 32.5 54.2ZM8.8 51.2 21.0 51.2 21.0 53.3 21.4 56.6 22.7 64.0 23.8 68.4 25.0 72.1 26.6 75.9 23.7 77.2 20.6 78.9 18.5 76.7 16.5 74.1 14.8 71.5 13.4 69.1 12.1 66.3 11.0 63.6 10.1 60.5 9.4 57.3 8.9 53.5 8.8 51.3ZM36.2 27.0 39.5 27.5 44.5 28.2 44.4 48.8 32.4 48.7 32.8 44.5 33.6 39.1 35.0 32.0ZM63.9 26.9 65.2 32.1 66.6 39.2 67.4 44.8 67.7 48.7 55.8 48.8 55.7 28.1 60.5 27.5ZM74.8 23.4 76.9 22.5 79.4 21.1 82.0 24.0 84.8 27.8 86.2 30.3 87.5 32.9 88.6 35.4 89.5 38.1 90.3 41.2 90.8 44.0 91.1 47.0 91.1 48.8 79.0 48.7 78.7 44.6 78.0 39.3 76.5 31.2 74.7 23.5ZM25.5 23.5 25.5 23.7 24.5 26.8 23.7 30.2 22.4 36.6 21.5 42.5 21.1 48.7 8.8 48.8 8.8 47.0 9.2 43.7 9.8 40.8 10.5 38.1 11.5 35.2 12.4 32.9 13.8 30.2 15.2 27.8 17.9 24.0 20.6 21.1 23.1 22.5ZM64.1 11.3 67.0 12.4 70.7 14.3 74.1 16.5 77.5 19.3 75.6 20.3 73.2 21.5 70.0 22.6 68.7 19.2 67.1 16.1 65.7 13.6ZM35.9 11.3 34.2 13.6 32.8 16.1 31.3 19.2 30.0 22.5 27.9 21.9 26.4 21.3 22.5 19.3 25.8 16.5 29.3 14.3 32.9 12.4 35.4 11.4ZM51.2 8.8 52.2 8.8 55.1 9.0 59.6 9.9 61.7 12.2 64.2 16.0 66.0 19.5 67.6 23.3 64.3 24.3 59.4 25.2 56.2 25.6 51.2 25.5ZM48.8 8.8 48.7 25.5 44.2 25.6 40.6 25.2 36.4 24.5 32.4 23.2 33.9 19.5 35.7 16.0 38.2 12.2 40.3 9.9 44.9 9.0 47.7 8.8Z";
|
|
@@ -54,12 +54,13 @@ var SHEET = "ow-waymark--sheet";
|
|
|
54
54
|
var COPIED = "Link copied";
|
|
55
55
|
var NOT_COPIED = "Could not copy the link.";
|
|
56
56
|
var HERE = "You are here";
|
|
57
|
+
var OFFLINE = "Needs a connection";
|
|
57
58
|
var mounted = 0;
|
|
58
59
|
var fail = (what) => {
|
|
59
60
|
throw new TypeError(`mountWaymark: ${what}`);
|
|
60
61
|
};
|
|
61
62
|
function cannotOpen(state) {
|
|
62
|
-
return state !== null && (state.startsWith("Sign in to ") || state === "Needs the world on this phone");
|
|
63
|
+
return state !== null && (state.startsWith("Sign in to ") || state === "Needs the world on this phone" || state === OFFLINE);
|
|
63
64
|
}
|
|
64
65
|
function shapedOn(at, now) {
|
|
65
66
|
const d = new Date(at);
|
|
@@ -108,13 +109,16 @@ function mountWaymark(target, options) {
|
|
|
108
109
|
const isPublic = reader === "public";
|
|
109
110
|
const kind = element === null ? "world" : "element";
|
|
110
111
|
const address = element === null ? { form: "human", world: world.id } : { form: "human", world: world.id, type: element.type, id: element.id };
|
|
111
|
-
const
|
|
112
|
+
const rowsFor = (online) => openersFor(tools, kind, address, { tool, audience: isPublic ? "public" : "member", signedIn, browser, phone, online });
|
|
113
|
+
const rowsOnline = rowsFor(true);
|
|
114
|
+
const rowsOffline = rowsFor(false);
|
|
112
115
|
const throughLenses = isPublic ? [] : [...lenses ?? []];
|
|
113
116
|
const linkFor = (lens) => elementAddress({ ...address, lens });
|
|
114
117
|
for (const l of throughLenses) linkFor(l.id);
|
|
115
118
|
const doc = target.ownerDocument;
|
|
116
119
|
const win = doc.defaultView;
|
|
117
120
|
const timers = win ?? globalThis;
|
|
121
|
+
const isOnline = () => timers.navigator?.onLine !== false;
|
|
118
122
|
const last = !isPublic && element !== null ? doorsOf(element, tools)[0] : void 0;
|
|
119
123
|
const doorLine = last === void 0 ? null : `Last shaped ${doorWhere(last)}, ${shapedOn(last.at, /* @__PURE__ */ new Date())}`;
|
|
120
124
|
const typeLine = element === null ? null : typeWord(world, element.type) ?? element.type.charAt(0).toUpperCase() + element.type.slice(1);
|
|
@@ -229,7 +233,7 @@ function mountWaymark(target, options) {
|
|
|
229
233
|
return group;
|
|
230
234
|
};
|
|
231
235
|
const openWith = section("Open with");
|
|
232
|
-
|
|
236
|
+
const rowNode = (r) => {
|
|
233
237
|
const cls = `ow-waymark__row${cannotOpen(r.state) ? " ow-waymark__row--cannot" : ""}`;
|
|
234
238
|
let a;
|
|
235
239
|
if (r.state === HERE) {
|
|
@@ -237,6 +241,10 @@ function mountWaymark(target, options) {
|
|
|
237
241
|
a.type = "button";
|
|
238
242
|
a.setAttribute("aria-current", "page");
|
|
239
243
|
a.dataset.here = "";
|
|
244
|
+
} else if (r.state === OFFLINE) {
|
|
245
|
+
a = el("a", cls);
|
|
246
|
+
a.tabIndex = 0;
|
|
247
|
+
a.setAttribute("aria-disabled", "true");
|
|
240
248
|
} else {
|
|
241
249
|
a = el("a", cls);
|
|
242
250
|
a.href = r.href;
|
|
@@ -246,8 +254,23 @@ function mountWaymark(target, options) {
|
|
|
246
254
|
a.appendChild(r.id === "onlyworlds" ? markSvg("ow-waymark__icon") : glyph(TOOL_GLYPH, "ow-waymark__icon"));
|
|
247
255
|
a.appendChild(el("span", "ow-waymark__label", r.name));
|
|
248
256
|
if (r.state !== null) a.appendChild(el("span", "ow-waymark__state", r.state));
|
|
249
|
-
|
|
250
|
-
}
|
|
257
|
+
return a;
|
|
258
|
+
};
|
|
259
|
+
let drawn = [];
|
|
260
|
+
let drawnOnline = null;
|
|
261
|
+
const drawRows = () => {
|
|
262
|
+
const online = isOnline();
|
|
263
|
+
if (online === drawnOnline) return;
|
|
264
|
+
drawnOnline = online;
|
|
265
|
+
const active = doc.activeElement;
|
|
266
|
+
const kept = active !== null && drawn.includes(active) ? active.dataset.opener : void 0;
|
|
267
|
+
const fresh = (online ? rowsOnline : rowsOffline).map(rowNode);
|
|
268
|
+
for (const a of fresh) openWith.appendChild(a);
|
|
269
|
+
if (kept !== void 0) fresh.find((a) => a.dataset.opener === kept)?.focus();
|
|
270
|
+
for (const a of drawn) a.remove();
|
|
271
|
+
drawn = fresh;
|
|
272
|
+
};
|
|
273
|
+
drawRows();
|
|
251
274
|
let chosenLens = null;
|
|
252
275
|
let lensToggle = null;
|
|
253
276
|
let lensList = null;
|
|
@@ -352,11 +375,16 @@ function mountWaymark(target, options) {
|
|
|
352
375
|
if (isOpen()) return;
|
|
353
376
|
openedBy = from;
|
|
354
377
|
pressedInside = false;
|
|
378
|
+
drawRows();
|
|
355
379
|
pop.hidden = false;
|
|
356
380
|
scrim.hidden = false;
|
|
357
381
|
placePop();
|
|
358
382
|
from.setAttribute("aria-expanded", "true");
|
|
359
383
|
on(openListeners, doc, "pointerdown", onOutside, true);
|
|
384
|
+
if (win !== null) {
|
|
385
|
+
on(openListeners, win, "online", onConnection);
|
|
386
|
+
on(openListeners, win, "offline", onConnection);
|
|
387
|
+
}
|
|
360
388
|
const list = items();
|
|
361
389
|
(focus === "first" ? list[0] : list[list.length - 1])?.focus();
|
|
362
390
|
};
|
|
@@ -432,6 +460,7 @@ function mountWaymark(target, options) {
|
|
|
432
460
|
close(true);
|
|
433
461
|
}
|
|
434
462
|
};
|
|
463
|
+
const disabled = (n2) => n2.getAttribute("aria-disabled") === "true";
|
|
435
464
|
const onMenuKey = (e) => {
|
|
436
465
|
pressedInside = false;
|
|
437
466
|
const list = items();
|
|
@@ -445,6 +474,9 @@ function mountWaymark(target, options) {
|
|
|
445
474
|
owned(e);
|
|
446
475
|
close(true);
|
|
447
476
|
return;
|
|
477
|
+
} else if ((e.key === "Enter" || e.key === " ") && disabled(e.target)) {
|
|
478
|
+
e.preventDefault();
|
|
479
|
+
return;
|
|
448
480
|
} else if (e.key === " " && e.target.tagName === "A") {
|
|
449
481
|
e.preventDefault();
|
|
450
482
|
e.target.click();
|
|
@@ -457,6 +489,10 @@ function mountWaymark(target, options) {
|
|
|
457
489
|
const t = e.target;
|
|
458
490
|
const row = t.closest(".ow-waymark__row");
|
|
459
491
|
if (row === null) return;
|
|
492
|
+
if (disabled(row)) {
|
|
493
|
+
e.preventDefault();
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
460
496
|
if (row === lensToggle) {
|
|
461
497
|
const show = lensList.hidden;
|
|
462
498
|
lensList.hidden = !show;
|
|
@@ -504,6 +540,9 @@ function mountWaymark(target, options) {
|
|
|
504
540
|
if (!inside(doc.activeElement)) close(false);
|
|
505
541
|
}, 0);
|
|
506
542
|
};
|
|
543
|
+
const onConnection = () => {
|
|
544
|
+
if (isOpen()) drawRows();
|
|
545
|
+
};
|
|
507
546
|
for (const b of openers) {
|
|
508
547
|
on(listeners, b, "pointerdown", onOpenerPress);
|
|
509
548
|
on(listeners, b, "click", onOpenerClick);
|