@lotics/cli 0.256.0 → 0.257.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.
@@ -712,13 +712,14 @@ var __loticsProbe = (() => {
712
712
  }
713
713
 
714
714
  // src/probe_collectors/anatomy.ts
715
- var FRAME = ".lotics-record-frame";
715
+ var RECORD_FRAME = ".lotics-record-frame";
716
+ var SECTION_PAGES = `${RECORD_FRAME} nav [role="link"], ${RECORD_FRAME}__link [role="link"]`;
716
717
  var HEADER = ".lotics-record-header";
717
718
  var BLOCK = ".lotics-record-frame__block";
718
719
  var PRIMARY = '.lotics-button[data-variant="primary"]';
719
- var FIELD = `${FRAME}__fields .lotics-form-field, .lotics-fact-groups__field`;
720
+ var FIELD = `${RECORD_FRAME}__fields .lotics-form-field, .lotics-fact-groups__field`;
720
721
  function surfaces(root) {
721
- return within(root, FRAME).filter(onScreen).map((frame) => {
722
+ return within(root, RECORD_FRAME).filter(onScreen).map((frame) => {
722
723
  const head = frame.closest(".lotics-drawer__popup") ?? frame;
723
724
  const title = within(head, `${HEADER}__title`).find(onScreen);
724
725
  return { frame, root: head, name: words2(title) || nameOf(head) || "(unnamed record)" };
@@ -2183,10 +2184,10 @@ var __loticsProbe = (() => {
2183
2184
  item.click();
2184
2185
  return true;
2185
2186
  }
2186
- function recordLinks() {
2187
+ function recordLinks(surface) {
2187
2188
  const here = location.pathname + location.search;
2188
2189
  const doors2 = Array.from(
2189
- document.querySelectorAll('a[href], [data-opens="page"], [data-opens="event"], button, [role="button"], [role="link"]')
2190
+ surface.querySelectorAll('a[href], [data-opens="page"], [data-opens="event"], button, [role="button"], [role="link"]')
2190
2191
  ).filter((door) => door.matches('a[href], [data-opens="page"], [data-opens="event"]') || isEmptyDoor(door));
2191
2192
  return doors2.filter((door) => {
2192
2193
  if (door.closest('nav, [role="banner"], [role="tablist"]') !== null) return false;
@@ -2200,14 +2201,20 @@ var __loticsProbe = (() => {
2200
2201
  });
2201
2202
  }
2202
2203
  function recordRows() {
2203
- return recordLinks().map(doorName);
2204
+ const surface = workedSurface();
2205
+ return surface === null ? [] : recordLinks(surface).map(doorName);
2204
2206
  }
2205
2207
  function openRecord(index) {
2206
- const door = recordLinks()[index];
2208
+ const surface = workedSurface();
2209
+ const door = surface === null ? void 0 : recordLinks(surface)[index];
2207
2210
  if (door === void 0) return false;
2208
2211
  door.click();
2209
2212
  return true;
2210
2213
  }
2214
+ function workedSurface() {
2215
+ const surface = measuredSurface();
2216
+ return surface === document.body || within(surface, RECORD_FRAME).length > 0 ? surface : null;
2217
+ }
2211
2218
  var OVERLAY_ROLES = '[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]';
2212
2219
  var NEVER_PRESS = /delete|remove|archive|discard|revoke|unlink|detach|cancel|reset|clear|approve|reject|send|publish|\bpay|submit|confirm|void|deactivate|disable|merge|overwrite|\bsign\b|issue|export|download|print|\bsave\b|\bapply\b/i;
2213
2220
  var NEVER_PRESS_VI_WORDS = [
@@ -2252,9 +2259,9 @@ var __loticsProbe = (() => {
2252
2259
  function route() {
2253
2260
  return location.pathname;
2254
2261
  }
2255
- function partyLinks() {
2262
+ function partyLinks(surface) {
2256
2263
  const here = location.pathname + location.search;
2257
- const doors2 = recordLinks();
2264
+ const doors2 = recordLinks(surface);
2258
2265
  for (const door of doors2) {
2259
2266
  const row = isEmptyDoor(door) ? door.parentElement : door;
2260
2267
  if (row === null) continue;
@@ -2272,26 +2279,29 @@ var __loticsProbe = (() => {
2272
2279
  return [];
2273
2280
  }
2274
2281
  function doorElements() {
2275
- const open = Array.from(document.querySelectorAll(OVERLAY_ROLES)).filter(onScreen);
2276
- const reachable = (el) => onScreen(el) && !isChrome(el) && el.getAttribute("aria-disabled") !== "true" && !(el instanceof HTMLButtonElement && el.disabled) && // NEVER A CONTROL INSIDE AN OPEN OVERLAY. A dialog's own buttons are the
2277
- // ones that commit it, and the walk photographs a dialog rather than
2278
- // answering it.
2279
- !open.some((overlay) => overlay.contains(el));
2280
- const records = recordLinks().filter(
2282
+ const surface = workedSurface();
2283
+ if (surface === null) return [];
2284
+ const open = Array.from(document.querySelectorAll(OVERLAY_ROLES)).filter(
2285
+ (overlay) => onScreen(overlay) && overlay !== surface && !overlay.contains(surface)
2286
+ );
2287
+ const inFront = (el) => surface.contains(el) && onScreen(el) && !open.some((overlay) => overlay.contains(el));
2288
+ const reachable = (el) => inFront(el) && !isChrome(el) && el.getAttribute("aria-disabled") !== "true" && !(el instanceof HTMLButtonElement && el.disabled);
2289
+ const records = recordLinks(surface).filter(
2281
2290
  (el) => reachable(el) && el.getAttribute("aria-expanded") === null && el.getAttribute("aria-haspopup") === null
2282
2291
  );
2283
- const parties = partyLinks().filter(reachable);
2284
- const menus = Array.from(document.querySelectorAll("[aria-haspopup]")).filter(
2292
+ const parties = partyLinks(surface).filter(reachable);
2293
+ const menus = Array.from(surface.querySelectorAll("[aria-haspopup]")).filter(
2285
2294
  (el) => reachable(el) && el.getAttribute("aria-expanded") !== "true"
2286
2295
  );
2287
- const folds = Array.from(document.querySelectorAll('[aria-expanded="false"]')).filter(
2296
+ const folds = Array.from(surface.querySelectorAll('[aria-expanded="false"]')).filter(
2288
2297
  (el) => reachable(el) && el.getAttribute("aria-haspopup") === null
2289
2298
  );
2290
- const tabs = Array.from(document.querySelectorAll('[role="tab"][aria-selected="false"]')).filter(
2291
- (el) => onScreen(el) && el.closest('nav, [role="banner"]') === null && !open.some((overlay) => overlay.contains(el))
2299
+ const tabs = Array.from(surface.querySelectorAll('[role="tab"][aria-selected="false"]')).filter(
2300
+ (el) => inFront(el) && el.closest('nav, [role="banner"]') === null
2292
2301
  );
2302
+ const sections = within(surface, SECTION_PAGES).filter((el) => el instanceof HTMLElement && inFront(el));
2293
2303
  const acts = Array.from(
2294
- document.querySelectorAll('[data-variant="primary"], [data-variant="secondary"]')
2304
+ surface.querySelectorAll('[data-variant="primary"], [data-variant="secondary"]')
2295
2305
  ).filter((el) => {
2296
2306
  if (!reachable(el)) return false;
2297
2307
  if (el.tagName !== "BUTTON" && el.getAttribute("role") !== "button") return false;
@@ -2313,7 +2323,8 @@ var __loticsProbe = (() => {
2313
2323
  ...folds.slice(0, 1).map((el) => ({ kind: "fold", el })),
2314
2324
  ...acts.map((el) => ({ kind: "dialog", el })),
2315
2325
  ...parties.map((el) => ({ kind: "party", el })),
2316
- ...tabs.map((el) => ({ kind: "tab", el }))
2326
+ ...tabs.map((el) => ({ kind: "tab", el })),
2327
+ ...sections.map((el) => ({ kind: "section", el }))
2317
2328
  ];
2318
2329
  }
2319
2330
  function doors() {