@onlyworlds/sdk 4.117.2 → 4.118.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/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ earlier history lives in git log only.
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.118.0] - 2026-10-30
9
+
10
+ ### Added
11
+
12
+ - **`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).
13
+ - **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.
14
+
15
+ ### Fixed
16
+
17
+ - **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.
18
+
8
19
  ## [4.117.2] - 2026-10-30
9
20
 
10
21
  ### 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
 
@@ -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 rows = [
1273
- { id: "onlyworlds", name: "onlyworlds.com", href: kind === "element" ? page : elementAddress({ form: "human", world }), state: null }
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: fill(template), state });
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
@@ -5624,9 +5624,11 @@ interface OwOpenerSurface {
5624
5624
  browser?: boolean;
5625
5625
  /** True on a phone. Default false. */
5626
5626
  phone?: boolean;
5627
+ /** False when the device has no connection; then every row whose link is a web address says "Needs a connection". Default true. */
5628
+ online?: boolean;
5627
5629
  }
5628
5630
  /** 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';
5631
+ 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
5632
  /** One row of the menu. */
5631
5633
  interface OwOpener {
5632
5634
  /** `onlyworlds` for the site's own row, else the tool's id in the list. */
@@ -5640,19 +5642,22 @@ interface OwOpener {
5640
5642
  /**
5641
5643
  * The rows of the Open with menu for a world (`kind: 'world'`) or one element of it (`'element'`), in
5642
5644
  * 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, never a word, for every audience), then one row per `tools` row, in the
5644
- * list's order, that is `listed` and has a door for this kind. `tools` is the tools list's rows, `TOOLS`
5645
- * or the list as served; `address` is a reading from `parseOwLink` or what `elementAddress` takes, with
5646
- * the world's id. A lens and a moment on it ride on no href.
5645
+ * page on www.onlyworlds.com, for every audience, its one word "Needs a connection" when offline), then
5646
+ * one row per `tools` row, in the list's order, that is `listed` and has a door for this kind. `tools`
5647
+ * is the tools list's rows, `TOOLS` or the list as served; `address` is a reading from `parseOwLink` or
5648
+ * what `elementAddress` takes, with the world's id. A lens and a moment on it ride on no href.
5647
5649
  *
5648
5650
  * A row with `open: null`, or with no door for this kind, is not there. On an element, a tool with only
5649
5651
  * a world door is a row to its world door that says "Opens the world". For the `public` audience only
5650
5652
  * rows whose `open.needs` is null are there: a row that needs anything does not exist for the public.
5651
5653
  *
5652
5654
  * Each row's `state`, the first that holds: "You are here" for the surface's own tool (its `client` is
5653
- * `surface.tool`); then what `needs` asks of this surface: `account` outside a browser "Opens in your
5654
- * browser", in a browser signed out "Sign in to <name> first" (none when `signedIn` is null: a word shows
5655
- * only when the surface knows it is true), `device` on a phone "Needs the world on this phone"; then
5655
+ * `surface.tool`); then, when `surface.online` is false, "Needs a connection" for a row whose href is a
5656
+ * web address (scheme `http:` or `https:`; a row whose link opens an app on the device is unaffected,
5657
+ * and the href stays in the row either way); then what `needs` asks of this surface: `account` outside
5658
+ * a browser "Opens in your browser", in a browser signed out "Sign in to <name> first" (none when
5659
+ * `signedIn` is null: a word shows only when the surface knows it is true), `device` on a phone "Needs
5660
+ * the world on this phone"; then
5656
5661
  * "Opens the world" (a world door on an element: a sign-in the row needs is the more urgent word); else null.
5657
5662
  *
5658
5663
  * Refuses with `OwAddressError` whatever `elementAddress` refuses of the whole address, in its own form
package/dist/index.js CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  trimWhiteSpace,
38
38
  typeWord,
39
39
  unknownKey
40
- } from "./chunk-CH3ITUSR.js";
40
+ } from "./chunk-2FAAOQVM.js";
41
41
 
42
42
  // src/v2/keyed-id.ts
43
43
  var KEYED_IDS = "0199b6a0-6f0e-7c2a-9d1e-3b5c7a8e4f21";
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-CH3ITUSR.js";
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 rows = openersFor(tools, kind, address, { tool, audience: isPublic ? "public" : "member", signedIn, browser, phone });
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
- for (const r of rows) {
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
- openWith.appendChild(a);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlyworlds/sdk",
3
- "version": "4.117.2",
3
+ "version": "4.118.0",
4
4
  "description": "TypeScript SDK for the OnlyWorlds API - build world-building applications with type safety",
5
5
  "type": "module",
6
6
  "exports": {