waygraph 0.15.53 → 0.16.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/README.md +8 -3
- package/bin/waygraph +2 -2
- package/dist/analysis/check.d.ts +38 -0
- package/dist/analysis/check.js +87 -0
- package/dist/analysis/coverage-gap.d.ts +1 -1
- package/dist/analysis/coverage-gap.js +14 -37
- package/dist/analysis/flow-source.d.ts +9 -0
- package/dist/analysis/flow-source.js +25 -0
- package/dist/analysis/graph.d.ts +13 -14
- package/dist/analysis/graph.js +48 -371
- package/dist/analysis/map-check.js +4 -39
- package/dist/analysis/practices-check.d.ts +1 -1
- package/dist/analysis/practices-check.js +24 -45
- package/dist/cli/args.d.ts +23 -0
- package/dist/cli/args.js +20 -0
- package/dist/{cli.d.ts → cli/cli.d.ts} +0 -1
- package/dist/{cli.js → cli/cli.js} +10 -9
- package/dist/{commands → cli/commands}/agent-dive-scaffold.js +35 -64
- package/dist/cli/commands/agent-dive.js +42 -0
- package/dist/{commands → cli/commands}/check.d.ts +0 -1
- package/dist/cli/commands/check.js +104 -0
- package/dist/cli/commands/codemod-checkpoints.d.ts +18 -0
- package/dist/cli/commands/codemod-checkpoints.js +186 -0
- package/dist/cli/commands/codemod-flows.d.ts +18 -0
- package/dist/cli/commands/codemod-flows.js +284 -0
- package/dist/cli/commands/codemod-stubs.d.ts +10 -0
- package/dist/cli/commands/codemod-stubs.js +187 -0
- package/dist/{commands → cli/commands}/extensions.js +5 -4
- package/dist/{commands → cli/commands}/init.js +1 -2
- package/dist/{commands → cli/commands}/list.js +9 -7
- package/dist/cli/commands/manifest.d.ts +2 -0
- package/dist/cli/commands/manifest.js +20 -0
- package/dist/cli/commands/map.js +57 -0
- package/dist/{commands → cli/commands}/run.d.ts +0 -1
- package/dist/cli/commands/run.js +64 -0
- package/dist/{commands → cli/commands}/session.js +61 -88
- package/dist/{commands → cli/commands}/test.js +11 -14
- package/dist/cli/commands/traverse.js +105 -0
- package/dist/{commands → cli/commands}/try.js +29 -25
- package/dist/{commands → cli/commands}/upgrade.js +40 -4
- package/dist/cli/flags.d.ts +193 -16
- package/dist/cli/flags.js +179 -234
- package/dist/cli/run-chain.d.ts +1 -0
- package/dist/cli/run-chain.js +42 -7
- package/dist/cli/usage.d.ts +1 -1
- package/dist/cli/usage.js +21 -53
- package/dist/cli/util.d.ts +2 -2
- package/dist/cli/util.js +2 -3
- package/dist/{highlights → demo/narration}/css.d.ts +1 -1
- package/dist/{highlights → demo/narration}/css.js +2 -3
- package/dist/{highlights → demo/narration}/demo-pace.d.ts +7 -11
- package/dist/{highlights → demo/narration}/demo-pace.js +9 -11
- package/dist/{highlights → demo/narration}/device.d.ts +4 -2
- package/dist/{highlights → demo/narration}/device.js +3 -1
- package/dist/demo/narration/merge.d.ts +8 -0
- package/dist/demo/narration/merge.js +71 -0
- package/dist/{highlights/run-phase.d.ts → demo/narration/narration.d.ts} +10 -14
- package/dist/{highlights/run-phase.js → demo/narration/narration.js} +25 -94
- package/dist/{highlights → demo/narration}/shorthand.d.ts +1 -1
- package/dist/demo/narration/stub-ctx.d.ts +8 -0
- package/dist/demo/narration/stub-ctx.js +164 -0
- package/dist/{highlights → demo/narration}/style.d.ts +1 -7
- package/dist/{highlights → demo/narration}/style.js +1 -41
- package/dist/{highlights → demo/narration}/todo-dock.d.ts +3 -3
- package/dist/{highlights → demo/narration}/todo-dock.js +13 -30
- package/dist/demo/overlay/auto-chrome.d.ts +7 -0
- package/dist/demo/overlay/auto-chrome.js +97 -0
- package/dist/{session/overlay-beacon.d.ts → demo/overlay/beacon.d.ts} +7 -0
- package/dist/{session/overlay-beacon.js → demo/overlay/beacon.js} +5 -0
- package/dist/demo/overlay/cursor.d.ts +12 -0
- package/dist/demo/overlay/cursor.js +142 -0
- package/dist/demo/overlay/device-stage.d.ts +13 -0
- package/dist/demo/overlay/device-stage.js +396 -0
- package/dist/demo/overlay/inpage/banner.d.ts +1 -0
- package/dist/demo/overlay/inpage/banner.js +160 -0
- package/dist/demo/overlay/inpage/caption.d.ts +2 -0
- package/dist/demo/overlay/inpage/caption.js +24 -0
- package/dist/demo/overlay/inpage/core.d.ts +1 -0
- package/dist/demo/overlay/inpage/core.js +345 -0
- package/dist/demo/overlay/inpage/device-chip.d.ts +1 -0
- package/dist/demo/overlay/inpage/device-chip.js +191 -0
- package/dist/demo/overlay/inpage/network.d.ts +9 -0
- package/dist/demo/overlay/inpage/network.js +200 -0
- package/dist/demo/overlay/inpage/panel-chrome.d.ts +1 -0
- package/dist/demo/overlay/inpage/panel-chrome.js +203 -0
- package/dist/demo/overlay/inpage/stamp.d.ts +1 -0
- package/dist/demo/overlay/inpage/stamp.js +46 -0
- package/dist/demo/overlay/inpage/swipe-zoom.d.ts +1 -0
- package/dist/demo/overlay/inpage/swipe-zoom.js +220 -0
- package/dist/demo/overlay/inpage/todos.d.ts +1 -0
- package/dist/demo/overlay/inpage/todos.js +294 -0
- package/dist/demo/overlay/locator-theater.d.ts +25 -0
- package/dist/demo/overlay/locator-theater.js +76 -0
- package/dist/demo/overlay/network-capture.d.ts +22 -0
- package/dist/demo/overlay/network-capture.js +127 -0
- package/dist/demo/overlay/overlay-css.d.ts +3 -0
- package/dist/demo/overlay/overlay-css.js +369 -0
- package/dist/demo/overlay/overlay-stage.d.ts +23 -0
- package/dist/demo/overlay/overlay-stage.js +106 -0
- package/dist/demo/overlay/overlay.d.ts +10 -0
- package/dist/demo/overlay/overlay.js +89 -0
- package/dist/{pilot-overlay/overlay-fixtures.d.ts → demo/overlay/phase-fixtures.d.ts} +2 -2
- package/dist/{pilot-overlay/overlay-fixtures.js → demo/overlay/phase-fixtures.js} +2 -2
- package/dist/{pilot-overlay/action-ring.js → demo/overlay/pilot/actions.js} +2 -1
- package/dist/{pilot-overlay → demo/overlay/pilot}/fixtures.d.ts +6 -5
- package/dist/{pilot-overlay → demo/overlay/pilot}/fixtures.js +19 -18
- package/dist/{pilot-overlay → demo/overlay/pilot}/shell.d.ts +2 -2
- package/dist/{pilot-overlay → demo/overlay/pilot}/shell.js +13 -22
- package/dist/demo/overlay/reattach.d.ts +7 -0
- package/dist/demo/overlay/reattach.js +23 -0
- package/dist/demo/overlay/rings.d.ts +33 -0
- package/dist/demo/overlay/rings.js +448 -0
- package/dist/{ui → demo/overlay/ui}/components/ring.js +2 -2
- package/dist/{ui → demo/overlay/ui}/overlay.css +4 -4
- package/dist/{ui → demo/overlay/ui}/shadow.d.ts +1 -1
- package/dist/{ui → demo/overlay/ui}/shadow.js +39 -2
- package/dist/demo/stepper/after.d.ts +3 -0
- package/dist/demo/stepper/after.js +113 -0
- package/dist/demo/stepper/banner-log.d.ts +37 -0
- package/dist/demo/stepper/banner-log.js +63 -0
- package/dist/demo/stepper/before.d.ts +4 -0
- package/dist/demo/stepper/before.js +110 -0
- package/dist/demo/stepper/demo-log.d.ts +31 -0
- package/dist/demo/stepper/demo-log.js +309 -0
- package/dist/demo/stepper/gate.d.ts +11 -0
- package/dist/demo/stepper/gate.js +78 -0
- package/dist/demo/stepper/interaction-patch.d.ts +3 -0
- package/dist/demo/stepper/interaction-patch.js +323 -0
- package/dist/demo/stepper/pacing.d.ts +21 -0
- package/dist/demo/stepper/pacing.js +23 -0
- package/dist/demo/stepper/slides.d.ts +11 -0
- package/dist/demo/stepper/slides.js +233 -0
- package/dist/demo/stepper/step-panels.d.ts +21 -0
- package/dist/demo/stepper/step-panels.js +589 -0
- package/dist/demo/stepper/stepper.d.ts +24 -0
- package/dist/demo/stepper/stepper.js +122 -0
- package/dist/demo/stepper/teardown.d.ts +48 -0
- package/dist/demo/stepper/teardown.js +179 -0
- package/dist/demo/stepper/todo-advance.d.ts +14 -0
- package/dist/demo/stepper/todo-advance.js +110 -0
- package/dist/demo/stepper/view.d.ts +68 -0
- package/dist/demo/stepper/view.js +31 -0
- package/dist/demo/types.d.ts +17 -0
- package/dist/demo/verbose-log.js +15 -0
- package/dist/{types.d.ts → engine/block/block.d.ts} +106 -91
- package/dist/{core → engine/block}/block.js +10 -53
- package/dist/{core → engine/block}/compose.d.ts +10 -7
- package/dist/{core → engine/block}/compose.js +1 -1
- package/dist/{core/blocks → engine/block/kinds}/api.d.ts +17 -12
- package/dist/{core/blocks → engine/block/kinds}/api.js +26 -18
- package/dist/{core/blocks → engine/block/kinds}/effect.d.ts +13 -18
- package/dist/engine/block/kinds/effect.js +17 -0
- package/dist/{core/blocks → engine/block/kinds}/method.d.ts +19 -29
- package/dist/{core/blocks → engine/block/kinds}/method.js +7 -21
- package/dist/{core/blocks → engine/block/kinds}/nav.d.ts +22 -31
- package/dist/{core/blocks → engine/block/kinds}/nav.js +6 -12
- package/dist/{core/blocks → engine/block/kinds}/page.d.ts +15 -20
- package/dist/{core/blocks → engine/block/kinds}/page.js +5 -7
- package/dist/engine/checkpoint/checkpoint.d.ts +22 -0
- package/dist/engine/checkpoint/checkpoint.js +8 -0
- package/dist/engine/checkpoint/route.d.ts +28 -0
- package/dist/engine/checkpoint/route.js +28 -0
- package/dist/{core → engine}/config.d.ts +7 -2
- package/dist/engine/config.js +6 -0
- package/dist/engine/engine.d.ts +45 -0
- package/dist/{core → engine}/engine.js +6 -10
- package/dist/engine/env.d.ts +59 -0
- package/dist/engine/env.js +83 -0
- package/dist/{errors.d.ts → engine/errors.d.ts} +23 -22
- package/dist/{errors.js → engine/errors.js} +22 -22
- package/dist/{core → engine/flow}/branch-regression.d.ts +8 -7
- package/dist/{core → engine/flow}/branch-regression.js +4 -3
- package/dist/engine/flow/flow.d.ts +162 -0
- package/dist/engine/flow/flow.js +244 -0
- package/dist/{core → engine/flow}/map-builder.d.ts +42 -40
- package/dist/{core → engine/flow}/map-builder.js +46 -48
- package/dist/{core → engine}/locate.d.ts +1 -1
- package/dist/{core → engine}/locate.js +1 -2
- package/dist/{mem-stub.d.ts → engine/mem/mem-stub.d.ts} +9 -8
- package/dist/{mem-stub.js → engine/mem/mem-stub.js} +2 -2
- package/dist/{mem-page.d.ts → engine/mem/mem.d.ts} +1 -1
- package/dist/{mem-page.js → engine/mem/mem.js} +2 -1
- package/dist/engine/page-gone.d.ts +5 -0
- package/dist/engine/page-gone.js +20 -0
- package/dist/engine/run/connect.d.ts +28 -0
- package/dist/{types.js → engine/run/connect.js} +11 -10
- package/dist/engine/run/events.d.ts +67 -0
- package/dist/engine/run/events.js +90 -0
- package/dist/engine/run/hooks.d.ts +16 -0
- package/dist/engine/run/hooks.js +8 -0
- package/dist/engine/run/launch.d.ts +13 -0
- package/dist/engine/run/launch.js +27 -0
- package/dist/{core/run-graph.d.ts → engine/run/run.d.ts} +9 -11
- package/dist/{core/run-graph.js → engine/run/run.js} +22 -11
- package/dist/engine/stub/pace.d.ts +12 -0
- package/dist/engine/stub/pace.js +2 -0
- package/dist/engine/stub/ring.d.ts +130 -0
- package/dist/engine/stub/ring.js +41 -0
- package/dist/engine/stub/stub.d.ts +268 -0
- package/dist/engine/stub/stub.js +1 -0
- package/dist/engine/stub/todos.d.ts +104 -0
- package/dist/engine/stub/todos.js +2 -0
- package/dist/engine/stub/viewport.d.ts +26 -0
- package/dist/engine/stub/viewport.js +2 -0
- package/dist/{trait.d.ts → engine/trait/trait.d.ts} +1 -1
- package/dist/index.d.ts +84 -36
- package/dist/index.js +44 -19
- package/dist/{session/auto-explore-run.d.ts → live/auto/auto.d.ts} +10 -16
- package/dist/{session/auto-explore-run.js → live/auto/auto.js} +164 -248
- package/dist/{session/auto-explore.d.ts → live/auto/explore.d.ts} +4 -14
- package/dist/{session/auto-explore.js → live/auto/explore.js} +21 -127
- package/dist/{auto-session/session.d.ts → live/auto-session/auto-session.d.ts} +1 -1
- package/dist/{auto-session/session.js → live/auto-session/auto-session.js} +27 -24
- package/dist/{auto-session → live/auto-session}/helpers.d.ts +16 -5
- package/dist/{auto-session → live/auto-session}/helpers.js +1 -1
- package/dist/{session/auto-session-ipc.d.ts → live/auto-session/ipc.d.ts} +7 -5
- package/dist/{session/auto-session-ipc.js → live/auto-session/ipc.js} +31 -16
- package/dist/{session/browser.d.ts → live/auto-session/start.d.ts} +1 -2
- package/dist/{session/browser.js → live/auto-session/start.js} +2 -3
- package/dist/{pilot-overlay → live/pilot}/panel.d.ts +1 -1
- package/dist/{pilot-overlay → live/pilot}/panel.js +23 -31
- package/dist/{session → live/pilot}/pilot.d.ts +4 -3
- package/dist/{session → live/pilot}/pilot.js +4 -4
- package/dist/{traverse → live/traverse}/coverage.d.ts +4 -0
- package/dist/{traverse → live/traverse}/coverage.js +3 -0
- package/dist/{traverse → live/traverse}/lease.d.ts +1 -0
- package/dist/{traverse → live/traverse}/lease.js +1 -0
- package/dist/{traverse/run.d.ts → live/traverse/traverse.d.ts} +4 -1
- package/dist/{traverse/run.js → live/traverse/traverse.js} +26 -43
- package/dist/manifest/manifest.d.ts +52 -0
- package/dist/manifest/manifest.js +93 -0
- package/dist/manifest/map-imports.d.ts +7 -0
- package/dist/manifest/map-imports.js +22 -0
- package/dist/manifest/maps.d.ts +33 -0
- package/dist/manifest/maps.js +62 -0
- package/dist/manifest/pack.d.ts +21 -0
- package/dist/manifest/pack.js +109 -0
- package/dist/manifest/project.d.ts +60 -0
- package/dist/manifest/project.js +101 -0
- package/dist/{session/block-inject.js → manifest/roots.js} +1 -18
- package/dist/manifest/scan.d.ts +19 -0
- package/dist/manifest/scan.js +57 -0
- package/dist/{blocks-select.d.ts → manifest/select.d.ts} +3 -0
- package/dist/{blocks-select.js → manifest/select.js} +2 -0
- package/dist/manifest/source.d.ts +23 -0
- package/dist/manifest/source.js +86 -0
- package/dist/runner/mode.d.ts +71 -0
- package/dist/runner/mode.js +1 -0
- package/dist/runner/modes/branches.d.ts +5 -0
- package/dist/runner/modes/branches.js +37 -0
- package/dist/runner/modes/demo.d.ts +3 -0
- package/dist/runner/modes/demo.js +13 -0
- package/dist/runner/modes/report.d.ts +2 -0
- package/dist/runner/modes/report.js +54 -0
- package/dist/runner/modes/run.d.ts +2 -0
- package/dist/runner/modes/run.js +3 -0
- package/dist/runner/options.d.ts +31 -0
- package/dist/runner/options.js +42 -0
- package/dist/runner/plan/find.d.ts +18 -0
- package/dist/runner/plan/find.js +65 -0
- package/dist/runner/plan/plan.d.ts +11 -0
- package/dist/runner/plan/plan.js +97 -0
- package/dist/runner/plan/seed-mem.d.ts +12 -0
- package/dist/runner/plan/seed-mem.js +98 -0
- package/dist/runner/plan/spec.d.ts +5 -0
- package/dist/runner/plan/spec.js +17 -0
- package/dist/runner/play-steps.d.ts +2 -0
- package/dist/runner/play-steps.js +59 -0
- package/dist/runner/runner.d.ts +4 -0
- package/dist/runner/runner.js +64 -0
- package/dist/runner/session.d.ts +9 -0
- package/dist/runner/session.js +87 -0
- package/dist/{browser.js → runtime/browser.js} +4 -2
- package/dist/{env-file.js → runtime/env-file.js} +7 -12
- package/dist/{extensions.d.ts → runtime/extensions.d.ts} +2 -5
- package/dist/{extensions.js → runtime/extensions.js} +3 -1
- package/dist/runtime/full-launch.d.ts +1 -0
- package/dist/runtime/full-launch.js +34 -0
- package/dist/runtime/global-flag.d.ts +5 -0
- package/dist/runtime/global-flag.js +18 -0
- package/dist/{playwright-config.d.ts → runtime/playwright-config.d.ts} +1 -1
- package/dist/{playwright.config.js → runtime/playwright.config.js} +3 -2
- package/dist/runtime/run-log.d.ts +2 -0
- package/dist/runtime/run-log.js +17 -0
- package/dist/{video-dir.js → runtime/video-dir.js} +3 -2
- package/dist/{config.d.ts → runtime/waygraph-config.d.ts} +8 -9
- package/dist/{config.js → runtime/waygraph-config.js} +21 -51
- package/dist/{webserver.js → runtime/webserver.js} +5 -30
- package/examples/routed-demo/config/waygraph.config.ts +20 -0
- package/examples/routed-demo/package.json +1 -4
- package/examples/routed-demo/scripts/fixture-server.mjs +1 -1
- package/examples/routed-demo/src/flows/routed-demo-map.flow.ts +2 -4
- package/examples/routed-demo/src/flows/routed-demo.flow.ts +2 -3
- package/examples/routed-demo/src/map/(app_base)/dashboard/_methods/click-widget.block.ts +5 -4
- package/examples/routed-demo/src/map/(app_base)/dashboard/_nav.block.ts +3 -3
- package/examples/routed-demo/src/map/(app_base)/dashboard/_page.block.ts +3 -3
- package/examples/routed-demo/src/map/(external)/docs/_nav.block.ts +3 -3
- package/examples/routed-demo/src/map/(external)/docs/_page.block.ts +3 -3
- package/examples/routed-demo/src/states/routed-demo.states.ts +5 -3
- package/examples/routed-demo/tests/routed-demo.spec.ts +4 -4
- package/examples/routed-demo/tsconfig.json +1 -1
- package/examples/saucedemo/README.md +11 -12
- package/examples/saucedemo/config/waygraph.config.ts +17 -0
- package/examples/saucedemo/docs/CONVENTION.md +5 -7
- package/examples/saucedemo/docs/HELPERS.md +12 -12
- package/examples/saucedemo/package-lock.json +10 -3
- package/examples/saucedemo/package.json +12 -29
- package/examples/saucedemo/src/blocks/SITE-MAP.md +0 -1
- package/examples/saucedemo/src/blocks/saucedemo-web/NAV.md +1 -5
- package/examples/saucedemo/src/blocks/saucedemo-web/cart/nav-cart.block.ts +3 -52
- package/examples/saucedemo/src/blocks/saucedemo-web/cart/nav-checkout-info.block.ts +3 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-one/methods/fill-first-name.method.block.ts +5 -4
- package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-one/methods/fill-last-name.method.block.ts +5 -4
- package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-one/methods/fill-postal-code.method.block.ts +5 -4
- package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-one/methods/submit-checkout-info.method.block.ts +5 -4
- package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-two/methods/finish-order.method.block.ts +21 -27
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/inventory.page.block.ts +3 -9
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/methods/add-all-to-cart.method.block.ts +4 -6
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/methods/add-to-cart.effect.block.ts +10 -76
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/methods/remove-all-from-cart.method.block.ts +4 -6
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/methods/remove-from-cart.effect.block.ts +4 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory/nav-item-detail.block.ts +3 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory-item/nav-back-to-inventory.block.ts +3 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory-item/nav-back-to-products.block.ts +3 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/inventory-item/nav-continue-shopping.block.ts +3 -3
- package/examples/saucedemo/src/blocks/saucedemo-web/methods/fill-password.method.block.ts +5 -29
- package/examples/saucedemo/src/blocks/saucedemo-web/methods/fill-username.method.block.ts +5 -48
- package/examples/saucedemo/src/blocks/saucedemo-web/methods/submit-login.method.block.ts +13 -77
- package/examples/saucedemo/src/blocks/saucedemo-web/methods/submit-logout.method.block.ts +5 -4
- package/examples/saucedemo/src/blocks/saucedemo-web/nav-login.block.ts +3 -3
- package/examples/saucedemo/src/flows/api-demo.flow.ts +26 -18
- package/examples/saucedemo/src/flows/cart-bulk.flow.ts +19 -14
- package/examples/saucedemo/src/flows/cart-continue.flow.ts +10 -8
- package/examples/saucedemo/src/flows/cart-mem.flow.ts +7 -7
- package/examples/saucedemo/src/flows/catalog-logout.flow.ts +13 -8
- package/examples/saucedemo/src/flows/checkout-then-browse-again.flow.ts +26 -48
- package/examples/saucedemo/src/flows/checkout.flow.ts +70 -86
- package/examples/saucedemo/src/flows/device-showcase.flow.ts +24 -25
- package/examples/saucedemo/src/flows/login.flow.ts +11 -18
- package/examples/saucedemo/src/flows/mem-stub-demo.flow.ts +9 -20
- package/examples/saucedemo/src/flows/shop.flow.ts +15 -20
- package/examples/saucedemo/src/flows/smoke.flow.ts +12 -27
- package/examples/saucedemo/src/flows/stub-on-error.flow.ts +24 -43
- package/examples/saucedemo/src/flows/viewer-blocked.flow.ts +26 -34
- package/examples/saucedemo/src/states/checkout.mem-stubs.ts +11 -0
- package/examples/saucedemo/src/states/checkout.states.ts +21 -11
- package/examples/saucedemo/src/stubs/device-showcase.ts +191 -0
- package/examples/saucedemo/src/stubs/login.ts +37 -0
- package/examples/saucedemo/tests/auto-graph.spec.ts +4 -12
- package/examples/saucedemo/tests/chain-flow-episodes.spec.ts +7 -9
- package/examples/saucedemo/tests/submit-login-branch.spec.ts +18 -5
- package/package.json +12 -7
- package/templates/agents/waygraph-planner.agent.md +2 -2
- package/templates/quickstart/README.md +4 -7
- package/templates/quickstart/config/waygraph.config.ts +17 -0
- package/templates/quickstart/docs/CONVENTION.md +5 -6
- package/templates/quickstart/docs/HELPERS.md +11 -9
- package/templates/quickstart/package.json +14 -17
- package/templates/quickstart/src/blocks/SITE-MAP.md +13 -3
- package/templates/quickstart/src/blocks/saucedemo-web/NAV.md +1 -5
- package/templates/quickstart/src/blocks/saucedemo-web/cart/nav-cart.block.ts +3 -52
- package/templates/quickstart/src/blocks/saucedemo-web/cart/nav-checkout-info.block.ts +3 -3
- package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-one/methods/fill-first-name.method.block.ts +5 -4
- package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-one/methods/fill-last-name.method.block.ts +5 -4
- package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-one/methods/fill-postal-code.method.block.ts +5 -4
- package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-one/methods/submit-checkout-info.method.block.ts +5 -4
- package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-two/methods/finish-order.method.block.ts +21 -27
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/inventory.page.block.ts +3 -9
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/methods/add-all-to-cart.method.block.ts +4 -6
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/methods/add-to-cart.effect.block.ts +10 -76
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/methods/remove-all-from-cart.method.block.ts +4 -6
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/methods/remove-from-cart.effect.block.ts +4 -3
- package/templates/quickstart/src/blocks/saucedemo-web/inventory/nav-item-detail.block.ts +3 -3
- package/templates/quickstart/src/blocks/saucedemo-web/inventory-item/nav-back-to-inventory.block.ts +3 -3
- package/templates/quickstart/src/blocks/saucedemo-web/inventory-item/nav-back-to-products.block.ts +3 -3
- package/templates/quickstart/src/blocks/saucedemo-web/inventory-item/nav-continue-shopping.block.ts +3 -3
- package/templates/quickstart/src/blocks/saucedemo-web/methods/fill-password.method.block.ts +5 -29
- package/templates/quickstart/src/blocks/saucedemo-web/methods/fill-username.method.block.ts +5 -48
- package/templates/quickstart/src/blocks/saucedemo-web/methods/submit-login.method.block.ts +13 -77
- package/templates/quickstart/src/blocks/saucedemo-web/methods/submit-logout.method.block.ts +5 -4
- package/templates/quickstart/src/blocks/saucedemo-web/nav-login.block.ts +3 -3
- package/templates/quickstart/src/flows/api-demo.flow.ts +45 -0
- package/templates/quickstart/src/flows/cart-bulk.flow.ts +19 -14
- package/templates/quickstart/src/flows/cart-continue.flow.ts +10 -8
- package/templates/quickstart/src/flows/cart-mem.flow.ts +7 -7
- package/templates/quickstart/src/flows/catalog-logout.flow.ts +13 -8
- package/templates/quickstart/src/flows/checkout-then-browse-again.flow.ts +26 -48
- package/templates/quickstart/src/flows/checkout.flow.ts +70 -63
- package/templates/quickstart/src/flows/device-showcase.flow.ts +24 -25
- package/templates/quickstart/src/flows/login.flow.ts +11 -18
- package/templates/quickstart/src/flows/mem-stub-demo.flow.ts +12 -0
- package/templates/quickstart/src/flows/shop.flow.ts +15 -20
- package/templates/quickstart/src/flows/smoke.flow.ts +12 -27
- package/templates/quickstart/src/flows/stub-on-error.flow.ts +31 -0
- package/templates/quickstart/src/flows/viewer-blocked.flow.ts +26 -34
- package/templates/quickstart/src/states/checkout.mem-stubs.ts +11 -0
- package/templates/quickstart/src/states/checkout.states.ts +21 -11
- package/templates/quickstart/src/stubs/device-showcase.ts +191 -0
- package/templates/quickstart/src/stubs/login.ts +37 -0
- package/templates/quickstart/tests/chain-flow.spec.ts +7 -10
- package/templates/scaffold/README.md +2 -1
- package/templates/scaffold/STRUCTURE.md +5 -4
- package/templates/scaffold/config/waygraph.config.ts +1 -0
- package/templates/scaffold/gitignore +1 -0
- package/templates/scaffold/src/flows/README.md +2 -2
- package/templates/scaffold/src/map/(app_base)/docs/_nav.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/docs/_page.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/home/_methods/add-item.effect.block.ts +4 -4
- package/templates/scaffold/src/map/(app_base)/home/_methods/assert-hello.method.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/home/_methods/assert-item-added.method.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/home/_methods/clear-cart.method.block.ts +5 -4
- package/templates/scaffold/src/map/(app_base)/home/_methods/remove-item.effect.block.ts +4 -4
- package/templates/scaffold/src/map/(app_base)/home/_nav.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/home/_page.block.ts +3 -3
- package/templates/scaffold/src/map/(app_base)/home/nav-verification-link.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_keys.ts +21 -0
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/assert-response-body.method.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/assert-response-header.method.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/assert-status.method.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/pick-extension-interceptor.method.block.ts +5 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/read-response-body.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/read-response-headers.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/send-request.method.block.ts +5 -4
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-bearer-token.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-headers.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-json-body.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-method.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-query-params.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_methods/set-url.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/hoppscotch/_nav.block.ts +3 -3
- package/templates/scaffold/src/map/(external)/hoppscotch/_page.block.ts +3 -3
- package/templates/scaffold/src/map/(external)/hoppscotch/_states.ts +6 -0
- package/templates/scaffold/src/map/(external)/hoppscotch/settings/_nav.block.ts +3 -3
- package/templates/scaffold/src/map/(external)/mailpit/_keys.ts +13 -0
- package/templates/scaffold/src/map/(external)/mailpit/_methods/assert-email-content.method.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/mailpit/_methods/assert-email-received.method.block.ts +4 -4
- package/templates/scaffold/src/map/(external)/mailpit/_methods/extract-email-link.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/mailpit/_methods/open-message.method.block.ts +6 -5
- package/templates/scaffold/src/map/(external)/mailpit/_nav.block.ts +3 -3
- package/templates/scaffold/src/map/(external)/mailpit/_page.block.ts +3 -3
- package/templates/scaffold/src/map/(external)/mailpit/_states.ts +9 -0
- package/templates/scaffold/src/map/README.md +7 -0
- package/templates/scaffold/src/states/README.md +4 -1
- package/templates/scaffold/src/states/demo.mem-keys.ts +1 -29
- package/templates/scaffold/src/states/demo.states.ts +14 -20
- package/templates/scaffold/tests/hoppscotch.spec.ts +1 -11
- package/templates/scaffold/tests/mail-verify.spec.ts +2 -2
- package/templates/skills/waygraph-blind-pilot.skill.md +2 -6
- package/templates/skills/waygraph-convention.skill.md +23 -14
- package/templates/skills/waygraph-pilot.skill.md +7 -4
- package/dist/auto-session/verbose-log.js +0 -16
- package/dist/auto-session.d.ts +0 -2
- package/dist/auto-session.js +0 -3
- package/dist/cli/discover.d.ts +0 -40
- package/dist/cli/discover.js +0 -148
- package/dist/commands/agent-dive.js +0 -52
- package/dist/commands/check.js +0 -192
- package/dist/commands/map.js +0 -29
- package/dist/commands/run.js +0 -104
- package/dist/commands/traverse.js +0 -177
- package/dist/core/block.d.ts +0 -109
- package/dist/core/blocks/effect.js +0 -23
- package/dist/core/config.js +0 -17
- package/dist/core/engine.d.ts +0 -198
- package/dist/core/flow.d.ts +0 -293
- package/dist/core/flow.js +0 -432
- package/dist/core.d.ts +0 -14
- package/dist/core.js +0 -15
- package/dist/highlights/merge.d.ts +0 -8
- package/dist/highlights/merge.js +0 -173
- package/dist/highlights/stub-ctx.d.ts +0 -10
- package/dist/highlights/stub-ctx.js +0 -331
- package/dist/highlights/types.d.ts +0 -607
- package/dist/highlights.d.ts +0 -9
- package/dist/highlights.js +0 -10
- package/dist/pilot-overlay.d.ts +0 -5
- package/dist/pilot-overlay.js +0 -6
- package/dist/runner/banner-log.js +0 -63
- package/dist/runner/chain-run.js +0 -102
- package/dist/runner/cursor.js +0 -140
- package/dist/runner/demo-log.js +0 -316
- package/dist/runner/device-stage.d.ts +0 -9
- package/dist/runner/device-stage.js +0 -420
- package/dist/runner/discovery.js +0 -105
- package/dist/runner/index.js +0 -2
- package/dist/runner/inpage/banner.d.ts +0 -21
- package/dist/runner/inpage/banner.js +0 -156
- package/dist/runner/inpage/caption.d.ts +0 -3
- package/dist/runner/inpage/caption.js +0 -23
- package/dist/runner/inpage/core.d.ts +0 -4
- package/dist/runner/inpage/core.js +0 -316
- package/dist/runner/inpage/device.d.ts +0 -3
- package/dist/runner/inpage/device.js +0 -211
- package/dist/runner/inpage/network.d.ts +0 -15
- package/dist/runner/inpage/network.js +0 -217
- package/dist/runner/inpage/panel-chrome.js +0 -192
- package/dist/runner/inpage/stamp.js +0 -46
- package/dist/runner/inpage/swipe-zoom.js +0 -220
- package/dist/runner/inpage/todos.js +0 -337
- package/dist/runner/interaction-patch.js +0 -384
- package/dist/runner/main.js +0 -469
- package/dist/runner/network-capture.d.ts +0 -9
- package/dist/runner/network-capture.js +0 -126
- package/dist/runner/overlay-css.d.ts +0 -3
- package/dist/runner/overlay-css.js +0 -377
- package/dist/runner/overlay-install.js +0 -90
- package/dist/runner/overlay-stage.js +0 -110
- package/dist/runner/rings.js +0 -514
- package/dist/runner/seed-mem.js +0 -110
- package/dist/runner/slides.js +0 -278
- package/dist/runner/step-mode.js +0 -703
- package/dist/runner/step-panels.js +0 -729
- package/dist/runner/teardown.js +0 -202
- package/dist/runner/todo-dock.js +0 -142
- package/dist/session/step-overlay.d.ts +0 -37
- package/dist/session/step-overlay.js +0 -244
- package/examples/routed-demo/playwright.config.ts +0 -21
- package/examples/saucedemo/playwright.config.ts +0 -19
- package/examples/saucedemo/scripts/drive-auto-cli.mjs +0 -93
- package/examples/saucedemo/scripts/prove-add-to-cart-menu.mjs +0 -126
- package/examples/saucedemo/scripts/prove-auto-graph.mjs +0 -92
- package/examples/saucedemo/scripts/prove-wrong-login-runtime.mjs +0 -63
- package/examples/saucedemo/src/blocks/saucedemo-web/ff-owner-auth.block.ts +0 -22
- package/templates/quickstart/playwright.config.ts +0 -14
- package/templates/quickstart/scripts/drive-auto-cli.mjs +0 -93
- package/templates/quickstart/src/blocks/saucedemo-web/ff-owner-auth.block.ts +0 -22
- /package/dist/{commands → cli/commands}/agent-dive-scaffold.d.ts +0 -0
- /package/dist/{commands → cli/commands}/agent-dive.d.ts +0 -0
- /package/dist/{commands → cli/commands}/extensions.d.ts +0 -0
- /package/dist/{commands → cli/commands}/init.d.ts +0 -0
- /package/dist/{commands → cli/commands}/list.d.ts +0 -0
- /package/dist/{commands → cli/commands}/map.d.ts +0 -0
- /package/dist/{commands → cli/commands}/session.d.ts +0 -0
- /package/dist/{commands → cli/commands}/test.d.ts +0 -0
- /package/dist/{commands → cli/commands}/traverse.d.ts +0 -0
- /package/dist/{commands → cli/commands}/try.d.ts +0 -0
- /package/dist/{commands → cli/commands}/upgrade.d.ts +0 -0
- /package/dist/{highlights → demo/narration}/shorthand.js +0 -0
- /package/dist/{pilot-overlay/action-ring.d.ts → demo/overlay/pilot/actions.d.ts} +0 -0
- /package/dist/{ui → demo/overlay/ui}/components/ring.d.ts +0 -0
- /package/dist/{ui → demo/overlay/ui}/stylesheet.d.ts +0 -0
- /package/dist/{ui → demo/overlay/ui}/stylesheet.js +0 -0
- /package/dist/{ui → demo/overlay/ui}/tokens.d.ts +0 -0
- /package/dist/{ui → demo/overlay/ui}/tokens.js +0 -0
- /package/dist/{highlights → demo}/types.js +0 -0
- /package/dist/{auto-session → demo}/verbose-log.d.ts +0 -0
- /package/dist/{selector.d.ts → engine/trait/selector.d.ts} +0 -0
- /package/dist/{selector.js → engine/trait/selector.js} +0 -0
- /package/dist/{trait.js → engine/trait/trait.js} +0 -0
- /package/dist/{session/block-inject.d.ts → manifest/roots.d.ts} +0 -0
- /package/dist/{browser.d.ts → runtime/browser.d.ts} +0 -0
- /package/dist/{env-file.d.ts → runtime/env-file.d.ts} +0 -0
- /package/dist/{playwright-config.js → runtime/playwright-config.js} +0 -0
- /package/dist/{playwright.config.d.ts → runtime/playwright.config.d.ts} +0 -0
- /package/dist/{video-dir.d.ts → runtime/video-dir.d.ts} +0 -0
- /package/dist/{webserver.d.ts → runtime/webserver.d.ts} +0 -0
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
// In-page installer (runs inside the browser via page.evaluate): must stay self-contained - no module-scope closure.
|
|
2
|
-
// Split out of the former single installOverlay evaluate (see src/ARCHITECTURE.md). Shares state only via window.__wg*.
|
|
3
|
-
/* eslint-disable no-unused-vars */
|
|
4
|
-
export function installDevice({ title, favicon, bannerPos, todoPos, envAutoplay, todoDockUi }) {
|
|
5
|
-
// Device toast + chip (0.13.2+) - announce on set/clear; quiet chip on keep.
|
|
6
|
-
// Payload: { sync, device?, remain?, announce? }
|
|
7
|
-
window.__wgSyncDevice = (payload) => {
|
|
8
|
-
const sync =
|
|
9
|
-
payload && (payload.sync === "clear" || payload.sync === "keep" || payload.sync === "set")
|
|
10
|
-
? payload.sync
|
|
11
|
-
: "keep";
|
|
12
|
-
const device = payload && payload.device ? payload.device : null;
|
|
13
|
-
const cursor = __wgById("wg-cursor");
|
|
14
|
-
const MOUSE_SVG =
|
|
15
|
-
"<svg viewBox='0 0 32 32' width='24' height='24'>" +
|
|
16
|
-
"<path fill='#0C0C1A' stroke='#fff' stroke-width='1.4' stroke-linejoin='round' " +
|
|
17
|
-
"d='M6 3.5l1.4 22.5 5.8-5.4 4.2 9.4 3.6-1.6-4.2-9.2H26z'/></svg>";
|
|
18
|
-
const FINGER_SVG =
|
|
19
|
-
"<svg viewBox='0 0 32 32' width='28' height='28'>" +
|
|
20
|
-
"<ellipse cx='16' cy='22' rx='7' ry='8' fill='#0C0C1A' stroke='#fff' stroke-width='1.4'/>" +
|
|
21
|
-
"<rect x='12' y='6' width='8' height='16' rx='4' fill='#0C0C1A' stroke='#fff' stroke-width='1.4'/>" +
|
|
22
|
-
"</svg>";
|
|
23
|
-
const ICONS = {
|
|
24
|
-
mobile:
|
|
25
|
-
'<svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">' +
|
|
26
|
-
'<rect x="7" y="2.5" width="10" height="19" rx="2.2"/>' +
|
|
27
|
-
'<circle cx="12" cy="18.2" r="1.1" fill="#fff" stroke="none"/></svg>',
|
|
28
|
-
tablet:
|
|
29
|
-
'<svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">' +
|
|
30
|
-
'<rect x="3.5" y="4" width="17" height="16" rx="2"/>' +
|
|
31
|
-
'<circle cx="12" cy="17.2" r="1" fill="#fff" stroke="none"/></svg>',
|
|
32
|
-
desktop:
|
|
33
|
-
'<svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">' +
|
|
34
|
-
'<rect x="2.5" y="3.5" width="19" height="12.5" rx="1.5"/>' +
|
|
35
|
-
'<path d="M8 20h8M12 16v4"/></svg>',
|
|
36
|
-
};
|
|
37
|
-
const setCursor = (touch) => {
|
|
38
|
-
if (!cursor) return;
|
|
39
|
-
if (touch) {
|
|
40
|
-
cursor.setAttribute("data-touch", "1");
|
|
41
|
-
cursor.innerHTML = FINGER_SVG;
|
|
42
|
-
} else {
|
|
43
|
-
cursor.removeAttribute("data-touch");
|
|
44
|
-
cursor.innerHTML = MOUSE_SVG;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const ensureChip = (preset, touch, remain, orientation) => {
|
|
48
|
-
let badge = __wgById("wg-device-badge");
|
|
49
|
-
if (preset === "desktop" && !touch) {
|
|
50
|
-
if (badge) {
|
|
51
|
-
badge.classList.remove("wg-in");
|
|
52
|
-
setTimeout(() => {
|
|
53
|
-
const b = __wgById("wg-device-badge");
|
|
54
|
-
if (b) b.remove();
|
|
55
|
-
}, 320);
|
|
56
|
-
}
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (!badge) {
|
|
60
|
-
badge = document.createElement("div");
|
|
61
|
-
badge.id = "wg-device-badge";
|
|
62
|
-
badge.setAttribute("data-wg-ui", "1");
|
|
63
|
-
__wgAdd(badge);
|
|
64
|
-
}
|
|
65
|
-
badge.dataset.preset = preset;
|
|
66
|
-
badge.dataset.touch = touch ? "1" : "0";
|
|
67
|
-
const orient =
|
|
68
|
-
orientation === "landscape" || orientation === "portrait"
|
|
69
|
-
? orientation
|
|
70
|
-
: "";
|
|
71
|
-
if (orient) badge.dataset.orientation = orient;
|
|
72
|
-
const chipLabel =
|
|
73
|
-
preset === "desktop" && !touch
|
|
74
|
-
? "desktop"
|
|
75
|
-
: preset +
|
|
76
|
-
(orient ? " · " + (orient === "landscape" ? "land" : "port") : "") +
|
|
77
|
-
(remain ? " · remain" : "");
|
|
78
|
-
badge.innerHTML =
|
|
79
|
-
'<span class="wg-dev-icon">' +
|
|
80
|
-
(ICONS[preset] || ICONS.desktop) +
|
|
81
|
-
'</span><span class="wg-dev-label">' +
|
|
82
|
-
chipLabel +
|
|
83
|
-
"</span>";
|
|
84
|
-
void badge.offsetWidth;
|
|
85
|
-
badge.classList.add("wg-in");
|
|
86
|
-
};
|
|
87
|
-
const showToast = (preset, touch, title, sub, orientation) => {
|
|
88
|
-
let toast = __wgById("wg-device-toast");
|
|
89
|
-
if (toast && toast._wgTimer) {
|
|
90
|
-
clearTimeout(toast._wgTimer);
|
|
91
|
-
toast._wgTimer = null;
|
|
92
|
-
}
|
|
93
|
-
if (!toast) {
|
|
94
|
-
toast = document.createElement("div");
|
|
95
|
-
toast.id = "wg-device-toast";
|
|
96
|
-
toast.setAttribute("data-wg-ui", "1");
|
|
97
|
-
__wgAdd(toast);
|
|
98
|
-
}
|
|
99
|
-
// Hide chip while toast is up (same corner).
|
|
100
|
-
const badge = __wgById("wg-device-badge");
|
|
101
|
-
if (badge) badge.classList.remove("wg-in");
|
|
102
|
-
toast.dataset.preset = preset;
|
|
103
|
-
toast.innerHTML =
|
|
104
|
-
'<span class="wg-dev-icon">' +
|
|
105
|
-
(ICONS[preset] || ICONS.desktop) +
|
|
106
|
-
'</span><span class="wg-dev-copy"><div class="wg-dev-title">' +
|
|
107
|
-
title +
|
|
108
|
-
'</div><div class="wg-dev-sub">' +
|
|
109
|
-
sub +
|
|
110
|
-
"</div></span>";
|
|
111
|
-
toast.classList.remove("wg-out");
|
|
112
|
-
void toast.offsetWidth;
|
|
113
|
-
toast.classList.add("wg-in");
|
|
114
|
-
toast._wgTimer = setTimeout(() => {
|
|
115
|
-
toast.classList.add("wg-out");
|
|
116
|
-
toast.classList.remove("wg-in");
|
|
117
|
-
setTimeout(() => {
|
|
118
|
-
const t = __wgById("wg-device-toast");
|
|
119
|
-
if (t) t.remove();
|
|
120
|
-
if (preset !== "desktop" || touch) {
|
|
121
|
-
ensureChip(preset, touch, true, orientation);
|
|
122
|
-
}
|
|
123
|
-
}, 380);
|
|
124
|
-
}, 2200);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
if (sync === "keep" && !device) return;
|
|
128
|
-
|
|
129
|
-
const isDesktopClear =
|
|
130
|
-
sync === "clear" ||
|
|
131
|
-
(device && device.preset === "desktop" && !device.touchMode);
|
|
132
|
-
if (isDesktopClear) {
|
|
133
|
-
setCursor(false);
|
|
134
|
-
const announce = payload.announce !== false && sync !== "keep";
|
|
135
|
-
if (announce) {
|
|
136
|
-
const vp = device && device.viewport ? device.viewport : { width: 1280, height: 720 };
|
|
137
|
-
showToast(
|
|
138
|
-
"desktop",
|
|
139
|
-
false,
|
|
140
|
-
"Back to desktop",
|
|
141
|
-
vp.width + "×" + vp.height + " · mouse",
|
|
142
|
-
"landscape",
|
|
143
|
-
);
|
|
144
|
-
setTimeout(() => {
|
|
145
|
-
const badge = __wgById("wg-device-badge");
|
|
146
|
-
if (badge) badge.remove();
|
|
147
|
-
}, 2600);
|
|
148
|
-
} else {
|
|
149
|
-
const badge = __wgById("wg-device-badge");
|
|
150
|
-
if (badge) badge.remove();
|
|
151
|
-
const toast = __wgById("wg-device-toast");
|
|
152
|
-
if (toast) toast.remove();
|
|
153
|
-
}
|
|
154
|
-
window.__wgDevicePreset = "desktop";
|
|
155
|
-
window.__wgDeviceOrientation = "landscape";
|
|
156
|
-
window.__wgDeviceTouch = false;
|
|
157
|
-
document.documentElement.dataset.wgTouch = "0";
|
|
158
|
-
if (window.__wgEnsureZoomBadge) window.__wgEnsureZoomBadge();
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (!device) return;
|
|
163
|
-
const preset = device.preset || "desktop";
|
|
164
|
-
const touch = !!device.touchMode;
|
|
165
|
-
const remain = payload.remain !== false && sync !== "clear";
|
|
166
|
-
const vp = device.viewport || {};
|
|
167
|
-
const orient =
|
|
168
|
-
device.orientation === "landscape" || device.orientation === "portrait"
|
|
169
|
-
? device.orientation
|
|
170
|
-
: vp.height > vp.width
|
|
171
|
-
? "portrait"
|
|
172
|
-
: "landscape";
|
|
173
|
-
const prev = window.__wgDevicePreset || "";
|
|
174
|
-
const prevOrient = window.__wgDeviceOrientation || "";
|
|
175
|
-
const presetChanged = prev !== preset || (touch && prev === "desktop");
|
|
176
|
-
const orientChanged = prevOrient !== "" && prevOrient !== orient;
|
|
177
|
-
const changed = presetChanged || orientChanged || prev === "";
|
|
178
|
-
setCursor(touch);
|
|
179
|
-
window.__wgDevicePreset = preset;
|
|
180
|
-
window.__wgDeviceOrientation = orient;
|
|
181
|
-
window.__wgDeviceTouch = touch;
|
|
182
|
-
document.documentElement.dataset.wgTouch = touch ? "1" : "0";
|
|
183
|
-
if (window.__wgEnsureZoomBadge) window.__wgEnsureZoomBadge();
|
|
184
|
-
|
|
185
|
-
const announce =
|
|
186
|
-
payload.announce === true ||
|
|
187
|
-
(payload.announce !== false && (sync === "set" || sync === "clear") && changed);
|
|
188
|
-
|
|
189
|
-
const size =
|
|
190
|
-
(vp.width || "?") +
|
|
191
|
-
"×" +
|
|
192
|
-
(vp.height || "?") +
|
|
193
|
-
" · " +
|
|
194
|
-
orient +
|
|
195
|
-
(touch ? " · touch" : "");
|
|
196
|
-
let titleText = {
|
|
197
|
-
mobile: "Now in mobile mode",
|
|
198
|
-
tablet: "Now in tablet mode",
|
|
199
|
-
desktop: "Now in desktop mode",
|
|
200
|
-
}[preset] || "Device updated";
|
|
201
|
-
if (orientChanged && !presetChanged) {
|
|
202
|
-
titleText =
|
|
203
|
-
orient === "landscape" ? "Rotated to landscape" : "Rotated to portrait";
|
|
204
|
-
}
|
|
205
|
-
if (announce) {
|
|
206
|
-
showToast(preset, touch, titleText, size, orient);
|
|
207
|
-
} else {
|
|
208
|
-
ensureChip(preset, touch, remain, orient);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** In-page installer (page.evaluate target) - see network.js's own header. */
|
|
2
|
-
export interface NetworkEntry {
|
|
3
|
-
method: string;
|
|
4
|
-
url: string;
|
|
5
|
-
status: number;
|
|
6
|
-
ok: boolean;
|
|
7
|
-
ms?: number | undefined;
|
|
8
|
-
reqHeaders?: Record<string, string> | undefined;
|
|
9
|
-
resHeaders?: Record<string, string> | undefined;
|
|
10
|
-
reqBody?: string | undefined;
|
|
11
|
-
resBody?: string | undefined;
|
|
12
|
-
}
|
|
13
|
-
export function addNetworkEntry(entry: NetworkEntry): void;
|
|
14
|
-
export function setNetworkTabVisible(visible: boolean): void;
|
|
15
|
-
export function clearNetworkLog(): void;
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
// In-page installer (page.evaluate target) - must stay self-contained, no module-scope closure
|
|
2
|
-
// (page.evaluate serializes ONLY the passed function's own source, not sibling top-level
|
|
3
|
-
// functions in this file - every helper below is nested inside addNetworkEntry itself for exactly
|
|
4
|
-
// that reason; a row's click handler still works after addNetworkEntry returns because it's a
|
|
5
|
-
// closure over ITS OWN invocation's nested helpers, not a reference to module scope).
|
|
6
|
-
//
|
|
7
|
-
// A real network-tab overlay (`#wg-network-log`): the DevTools Network panel itself can't be
|
|
8
|
-
// embedded (it lives in browser chrome, not reachable from automation), but every entry's real
|
|
9
|
-
// data is - this renders that, on-page: method, url, status, and (click a row) request/response
|
|
10
|
-
// headers + bodies + a "copy as cURL" command, a Postman-style inspector for both real page
|
|
11
|
-
// traffic (installNetworkCapture, network-capture.js) and defineApiBlock's own page.request calls.
|
|
12
|
-
export function addNetworkEntry(entry) {
|
|
13
|
-
// No-op outside a demo/pilot/auto run - ensureShadowRoot() (and its __wgById/__wgAdd globals)
|
|
14
|
-
// is never installed for a plain `waygraph run`/Playwright test, and this must not throw there.
|
|
15
|
-
if (typeof __wgById !== "function" || typeof __wgAdd !== "function") return;
|
|
16
|
-
|
|
17
|
-
function esc(s) {
|
|
18
|
-
const d = document.createElement("div");
|
|
19
|
-
d.textContent = String(s == null ? "" : s);
|
|
20
|
-
return d.innerHTML;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function methodClass(method) {
|
|
24
|
-
const m = (method || "GET").toUpperCase();
|
|
25
|
-
if (m === "GET") return "get";
|
|
26
|
-
if (m === "POST") return "post";
|
|
27
|
-
if (m === "PUT" || m === "PATCH") return "put";
|
|
28
|
-
if (m === "DELETE") return "delete";
|
|
29
|
-
return "other";
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function toCurl(e) {
|
|
33
|
-
let cmd = "curl -X " + (e.method || "GET") + " '" + String(e.url || "").replace(/'/g, "'\\''") + "'";
|
|
34
|
-
const headers = e.reqHeaders || {};
|
|
35
|
-
for (const k of Object.keys(headers)) {
|
|
36
|
-
if (/^:/.test(k)) continue; // HTTP/2 pseudo-headers - not valid curl -H input
|
|
37
|
-
cmd += " \\\n -H '" + k + ": " + String(headers[k]).replace(/'/g, "'\\''") + "'";
|
|
38
|
-
}
|
|
39
|
-
if (e.reqBody) cmd += " \\\n --data '" + String(e.reqBody).replace(/'/g, "'\\''") + "'";
|
|
40
|
-
return cmd;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function renderHeaders(headers) {
|
|
44
|
-
const h = headers || {};
|
|
45
|
-
const keys = Object.keys(h);
|
|
46
|
-
if (keys.length === 0) return '<div class="wg-net-empty">(none)</div>';
|
|
47
|
-
return (
|
|
48
|
-
'<table class="wg-net-headers">' +
|
|
49
|
-
keys.map((k) => "<tr><td>" + esc(k) + "</td><td>" + esc(h[k]) + "</td></tr>").join("") +
|
|
50
|
-
"</table>"
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function renderBody(body) {
|
|
55
|
-
if (body === undefined || body === null || body === "") return '<div class="wg-net-empty">(empty)</div>';
|
|
56
|
-
let text = body;
|
|
57
|
-
try {
|
|
58
|
-
text = JSON.stringify(JSON.parse(body), null, 2);
|
|
59
|
-
} catch {
|
|
60
|
-
/* not JSON - show raw */
|
|
61
|
-
}
|
|
62
|
-
return "<pre class=\"wg-net-body\">" + esc(String(text).slice(0, 4000)) + "</pre>";
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function renderDetail(e) {
|
|
66
|
-
return (
|
|
67
|
-
'<div class="wg-net-detail-section"><h4>Request headers</h4>' +
|
|
68
|
-
renderHeaders(e.reqHeaders) +
|
|
69
|
-
"</div>" +
|
|
70
|
-
(e.reqBody
|
|
71
|
-
? '<div class="wg-net-detail-section"><h4>Request body</h4>' + renderBody(e.reqBody) + "</div>"
|
|
72
|
-
: "") +
|
|
73
|
-
'<div class="wg-net-detail-section"><h4>Response headers</h4>' +
|
|
74
|
-
renderHeaders(e.resHeaders) +
|
|
75
|
-
"</div>" +
|
|
76
|
-
'<div class="wg-net-detail-section"><h4>Response body</h4>' +
|
|
77
|
-
renderBody(e.resBody) +
|
|
78
|
-
"</div>" +
|
|
79
|
-
'<div class="wg-net-detail-section"><h4>cURL</h4>' +
|
|
80
|
-
'<pre class="wg-net-body wg-net-curl">' +
|
|
81
|
-
esc(toCurl(e)) +
|
|
82
|
-
"</pre>" +
|
|
83
|
-
'<button type="button" class="wg-net-copy" data-copy="1">Copy as cURL</button></div>'
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
let panel = __wgById("wg-network-log");
|
|
88
|
-
if (!panel) {
|
|
89
|
-
panel = document.createElement("div");
|
|
90
|
-
panel.id = "wg-network-log";
|
|
91
|
-
panel.setAttribute("data-wg-ui", "1");
|
|
92
|
-
const header = document.createElement("div");
|
|
93
|
-
header.className = "wg-net-header";
|
|
94
|
-
const title = document.createElement("span");
|
|
95
|
-
title.className = "wg-net-title";
|
|
96
|
-
title.textContent = "Network";
|
|
97
|
-
const count = document.createElement("span");
|
|
98
|
-
count.className = "wg-net-count";
|
|
99
|
-
count.textContent = "0";
|
|
100
|
-
const toggle = document.createElement("button");
|
|
101
|
-
toggle.type = "button";
|
|
102
|
-
toggle.className = "wg-net-collapse";
|
|
103
|
-
toggle.textContent = "−"; // minus
|
|
104
|
-
toggle.addEventListener("click", (ev) => {
|
|
105
|
-
ev.stopPropagation();
|
|
106
|
-
panel.classList.toggle("wg-net-collapsed");
|
|
107
|
-
toggle.textContent = panel.classList.contains("wg-net-collapsed") ? "+" : "−";
|
|
108
|
-
});
|
|
109
|
-
header.appendChild(title);
|
|
110
|
-
header.appendChild(count);
|
|
111
|
-
header.appendChild(toggle);
|
|
112
|
-
const list = document.createElement("ol");
|
|
113
|
-
list.className = "wg-net-list";
|
|
114
|
-
panel.appendChild(header);
|
|
115
|
-
panel.appendChild(list);
|
|
116
|
-
__wgAdd(panel);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const w = window;
|
|
120
|
-
w.__wgNetworkEntries = w.__wgNetworkEntries || [];
|
|
121
|
-
w.__wgNetworkEntries.push(entry);
|
|
122
|
-
while (w.__wgNetworkEntries.length > 30) w.__wgNetworkEntries.shift();
|
|
123
|
-
|
|
124
|
-
const list = panel.querySelector(".wg-net-list");
|
|
125
|
-
const row = document.createElement("li");
|
|
126
|
-
row.className = "wg-net-row";
|
|
127
|
-
row.dataset.ok = entry.ok ? "1" : "0";
|
|
128
|
-
let path = entry.url;
|
|
129
|
-
try {
|
|
130
|
-
const u = new URL(entry.url);
|
|
131
|
-
path = u.pathname + u.search;
|
|
132
|
-
} catch {
|
|
133
|
-
/* not an absolute URL - show as given */
|
|
134
|
-
}
|
|
135
|
-
row.innerHTML =
|
|
136
|
-
'<span class="wg-net-method wg-net-method-' +
|
|
137
|
-
methodClass(entry.method) +
|
|
138
|
-
'">' +
|
|
139
|
-
esc((entry.method || "GET").toUpperCase()) +
|
|
140
|
-
'</span><span class="wg-net-path" title="' +
|
|
141
|
-
esc(entry.url) +
|
|
142
|
-
'">' +
|
|
143
|
-
esc(path) +
|
|
144
|
-
'</span><span class="wg-net-status">' +
|
|
145
|
-
esc(entry.status) +
|
|
146
|
-
(entry.ms !== undefined ? '</span><span class="wg-net-ms">' + esc(entry.ms) + "ms</span>" : "</span>");
|
|
147
|
-
row.addEventListener("click", () => {
|
|
148
|
-
const open = row.classList.contains("wg-net-open");
|
|
149
|
-
__wgQA(".wg-net-row.wg-net-open").forEach((r) => {
|
|
150
|
-
r.classList.remove("wg-net-open");
|
|
151
|
-
const d = r.nextElementSibling;
|
|
152
|
-
if (d && d.classList && d.classList.contains("wg-net-detail")) d.remove();
|
|
153
|
-
});
|
|
154
|
-
if (open) return;
|
|
155
|
-
row.classList.add("wg-net-open");
|
|
156
|
-
const detail = document.createElement("li");
|
|
157
|
-
detail.className = "wg-net-detail";
|
|
158
|
-
detail.innerHTML = renderDetail(entry);
|
|
159
|
-
const copyBtn = detail.querySelector("[data-copy]");
|
|
160
|
-
if (copyBtn) {
|
|
161
|
-
copyBtn.addEventListener("click", (ev) => {
|
|
162
|
-
ev.stopPropagation();
|
|
163
|
-
const text = toCurl(entry);
|
|
164
|
-
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
165
|
-
navigator.clipboard.writeText(text).catch(() => {});
|
|
166
|
-
}
|
|
167
|
-
copyBtn.textContent = "Copied!";
|
|
168
|
-
setTimeout(() => {
|
|
169
|
-
copyBtn.textContent = "Copy as cURL";
|
|
170
|
-
}, 1200);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
row.after(detail);
|
|
174
|
-
});
|
|
175
|
-
list.appendChild(row);
|
|
176
|
-
while (list.children.length > 30) list.removeChild(list.firstChild);
|
|
177
|
-
const countEl = panel.querySelector(".wg-net-count");
|
|
178
|
-
if (countEl) countEl.textContent = String(w.__wgNetworkEntries.length);
|
|
179
|
-
// Always captured, only shown when explicitly turned on (ctx.showNetworkTab(); default hidden -
|
|
180
|
-
// see StubCtx's own doc comment) - the DOM/row still gets built either way, so toggling visible
|
|
181
|
-
// later shows the full history immediately, not just entries captured after that point.
|
|
182
|
-
if (w.__wgNetworkTabVisible) {
|
|
183
|
-
panel.classList.remove("wg-out");
|
|
184
|
-
void panel.offsetWidth;
|
|
185
|
-
panel.classList.add("wg-in");
|
|
186
|
-
void row.offsetWidth;
|
|
187
|
-
row.classList.add("wg-in");
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Shows or hides the network-tab panel - capture keeps happening either way (addNetworkEntry
|
|
193
|
-
* always builds the DOM row; this only toggles whether the panel itself is visible). Safe to call
|
|
194
|
-
* before any entry exists yet - it just remembers the flag for addNetworkEntry to check later.
|
|
195
|
-
*/
|
|
196
|
-
export function setNetworkTabVisible(visible) {
|
|
197
|
-
if (typeof __wgById !== "function") return;
|
|
198
|
-
window.__wgNetworkTabVisible = !!visible;
|
|
199
|
-
const panel = __wgById("wg-network-log");
|
|
200
|
-
if (!panel) return;
|
|
201
|
-
if (visible) {
|
|
202
|
-
panel.classList.remove("wg-out");
|
|
203
|
-
panel.classList.add("wg-in");
|
|
204
|
-
__wgQA(".wg-net-row").forEach((r) => r.classList.add("wg-in"));
|
|
205
|
-
} else {
|
|
206
|
-
panel.classList.remove("wg-in");
|
|
207
|
-
panel.classList.add("wg-out");
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/** Clears every captured entry and removes the panel - a fresh navigation/session starting over. */
|
|
212
|
-
export function clearNetworkLog() {
|
|
213
|
-
if (typeof __wgById !== "function") return;
|
|
214
|
-
window.__wgNetworkEntries = [];
|
|
215
|
-
const panel = __wgById("wg-network-log");
|
|
216
|
-
if (panel) panel.remove();
|
|
217
|
-
}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
// In-page installer (runs inside the browser via page.evaluate): must stay self-contained - no module-scope closure.
|
|
2
|
-
// Split out of the former single installOverlay evaluate (see src/ARCHITECTURE.md). Shares state only via window.__wg*.
|
|
3
|
-
/* eslint-disable no-unused-vars */
|
|
4
|
-
export function installPanelChrome({ title, favicon, bannerPos, todoPos, envAutoplay, todoDockUi }) {
|
|
5
|
-
// Hide/Show for #wg-panel - call after every panel.innerHTML refresh.
|
|
6
|
-
// Collapsed = "N / M · block" + Next (when not auto). Never pass
|
|
7
|
-
// forceCollapsed:false - omit so Hide/localStorage wins.
|
|
8
|
-
window.__wgWirePanelChrome = (panel, storageKey, chromeTitle, opts) => {
|
|
9
|
-
if (!panel) return;
|
|
10
|
-
opts = opts || {};
|
|
11
|
-
const ensureChrome = () => {
|
|
12
|
-
let chrome = panel.querySelector(":scope > .wg-chrome");
|
|
13
|
-
if (!chrome) {
|
|
14
|
-
const body = document.createElement("div");
|
|
15
|
-
body.className = "wg-body";
|
|
16
|
-
while (panel.firstChild) body.appendChild(panel.firstChild);
|
|
17
|
-
chrome = document.createElement("div");
|
|
18
|
-
chrome.className = "wg-chrome";
|
|
19
|
-
const titleEl = document.createElement("span");
|
|
20
|
-
titleEl.className = "wg-chrome-title";
|
|
21
|
-
titleEl.textContent = chromeTitle || "waygraph demo";
|
|
22
|
-
const actions = document.createElement("div");
|
|
23
|
-
actions.className = "wg-chrome-actions";
|
|
24
|
-
const nextBtn = document.createElement("button");
|
|
25
|
-
nextBtn.type = "button";
|
|
26
|
-
nextBtn.className = "wg-mini-next";
|
|
27
|
-
nextBtn.setAttribute("data-wg-mini-next", "1");
|
|
28
|
-
nextBtn.textContent = "Next ▶";
|
|
29
|
-
const btn = document.createElement("button");
|
|
30
|
-
btn.type = "button";
|
|
31
|
-
btn.className = "wg-hide-btn";
|
|
32
|
-
btn.setAttribute("data-wg-toggle", "1");
|
|
33
|
-
btn.textContent = "Hide";
|
|
34
|
-
actions.appendChild(nextBtn);
|
|
35
|
-
actions.appendChild(btn);
|
|
36
|
-
chrome.appendChild(titleEl);
|
|
37
|
-
chrome.appendChild(actions);
|
|
38
|
-
panel.appendChild(chrome);
|
|
39
|
-
panel.appendChild(body);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
// Yap slides ship a bare chrome - ensure actions + mini Next exist.
|
|
43
|
-
let actions = chrome.querySelector(".wg-chrome-actions");
|
|
44
|
-
if (!actions) {
|
|
45
|
-
actions = document.createElement("div");
|
|
46
|
-
actions.className = "wg-chrome-actions";
|
|
47
|
-
const hide = chrome.querySelector("[data-wg-toggle]");
|
|
48
|
-
if (hide) actions.appendChild(hide);
|
|
49
|
-
chrome.appendChild(actions);
|
|
50
|
-
}
|
|
51
|
-
if (!actions.querySelector("[data-wg-mini-next]")) {
|
|
52
|
-
const nextBtn = document.createElement("button");
|
|
53
|
-
nextBtn.type = "button";
|
|
54
|
-
nextBtn.className = "wg-mini-next";
|
|
55
|
-
nextBtn.setAttribute("data-wg-mini-next", "1");
|
|
56
|
-
nextBtn.textContent = "Next ▶";
|
|
57
|
-
actions.insertBefore(nextBtn, actions.firstChild);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
ensureChrome();
|
|
61
|
-
const stepLabel = opts.stepLabel || panel.dataset.wgStepLabel || "";
|
|
62
|
-
if (stepLabel) panel.dataset.wgStepLabel = stepLabel;
|
|
63
|
-
if (opts.fastForward !== undefined) {
|
|
64
|
-
panel.dataset.wgFastForward = opts.fastForward ? "1" : "0";
|
|
65
|
-
}
|
|
66
|
-
if (opts.isApi !== undefined) {
|
|
67
|
-
panel.dataset.wgIsApi = opts.isApi ? "1" : "0";
|
|
68
|
-
}
|
|
69
|
-
const buildFfIcon = () => {
|
|
70
|
-
const span = document.createElement("span");
|
|
71
|
-
span.className = "wg-ff-icon";
|
|
72
|
-
span.setAttribute("aria-hidden", "true");
|
|
73
|
-
span.innerHTML =
|
|
74
|
-
'<svg viewBox="0 0 16 16" fill="none">' +
|
|
75
|
-
'<path class="wg-ff-chev" d="M2 3l5 5-5 5" stroke="#c9a6ff" stroke-width="1.8" ' +
|
|
76
|
-
'stroke-linecap="round" stroke-linejoin="round"/>' +
|
|
77
|
-
'<path class="wg-ff-chev" d="M8 3l5 5-5 5" stroke="#c9a6ff" stroke-width="1.8" ' +
|
|
78
|
-
'stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
79
|
-
return span;
|
|
80
|
-
};
|
|
81
|
-
// Terminal icon: the current step is an API check (defineApiBlock) - no DOM change, no
|
|
82
|
-
// ring of its own, so without this it's an unexplained instant step with nothing visibly
|
|
83
|
-
// happening on the page at all (worse than a fast-forward block, which at least has the
|
|
84
|
-
// FF icon marking it as different).
|
|
85
|
-
const buildApiIcon = () => {
|
|
86
|
-
const span = document.createElement("span");
|
|
87
|
-
span.className = "wg-api-icon";
|
|
88
|
-
span.setAttribute("aria-hidden", "true");
|
|
89
|
-
span.innerHTML =
|
|
90
|
-
'<svg viewBox="0 0 16 16" fill="none">' +
|
|
91
|
-
'<rect x="1" y="2" width="14" height="12" rx="1.5" stroke="#7dd3fc" stroke-width="1.3"/>' +
|
|
92
|
-
'<path d="M3.5 5.5l2.5 2.5-2.5 2.5" stroke="#7dd3fc" stroke-width="1.3" ' +
|
|
93
|
-
'stroke-linecap="round" stroke-linejoin="round"/>' +
|
|
94
|
-
'<path d="M7.5 10.5h4" stroke="#7dd3fc" stroke-width="1.3" stroke-linecap="round"/></svg>';
|
|
95
|
-
return span;
|
|
96
|
-
};
|
|
97
|
-
const syncMiniNext = (hidden) => {
|
|
98
|
-
const miniNext = panel.querySelector("[data-wg-mini-next]");
|
|
99
|
-
if (!miniNext) return;
|
|
100
|
-
let auto = false;
|
|
101
|
-
try {
|
|
102
|
-
auto = localStorage.getItem("wg-autoplay") === "1";
|
|
103
|
-
} catch {
|
|
104
|
-
/* ignore */
|
|
105
|
-
}
|
|
106
|
-
const runBtn = __wgById("wg-run");
|
|
107
|
-
const show = !!hidden && !auto && !!runBtn;
|
|
108
|
-
miniNext.classList.toggle("wg-mini-next-show", show);
|
|
109
|
-
if (runBtn) {
|
|
110
|
-
miniNext.textContent = runBtn.textContent || "Next ▶";
|
|
111
|
-
miniNext.disabled = !!runBtn.disabled;
|
|
112
|
-
} else {
|
|
113
|
-
miniNext.disabled = true;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
const apply = (hidden, persist) => {
|
|
117
|
-
panel.classList.toggle("wg-collapsed", hidden);
|
|
118
|
-
panel.setAttribute("data-wg-collapsed", hidden ? "1" : "0");
|
|
119
|
-
const t = panel.querySelector("[data-wg-toggle]");
|
|
120
|
-
const titleEl = panel.querySelector(".wg-chrome-title");
|
|
121
|
-
const label = panel.dataset.wgStepLabel || stepLabel;
|
|
122
|
-
const isFf = panel.dataset.wgFastForward === "1";
|
|
123
|
-
const isApi = panel.dataset.wgIsApi === "1";
|
|
124
|
-
if (titleEl) {
|
|
125
|
-
const text = hidden
|
|
126
|
-
? (label || chromeTitle || "waygraph demo")
|
|
127
|
-
: (chromeTitle || "waygraph demo");
|
|
128
|
-
titleEl.textContent = "";
|
|
129
|
-
if (hidden && isFf) titleEl.appendChild(buildFfIcon());
|
|
130
|
-
if (hidden && isApi) titleEl.appendChild(buildApiIcon());
|
|
131
|
-
titleEl.appendChild(document.createTextNode(text));
|
|
132
|
-
}
|
|
133
|
-
if (t) t.textContent = hidden ? "Show" : "Hide";
|
|
134
|
-
syncMiniNext(hidden);
|
|
135
|
-
if (persist !== false) {
|
|
136
|
-
try {
|
|
137
|
-
localStorage.setItem(storageKey, hidden ? "1" : "0");
|
|
138
|
-
} catch {
|
|
139
|
-
/* private mode */
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
let hidden = false;
|
|
144
|
-
if (opts.forceCollapsed === true) {
|
|
145
|
-
hidden = true;
|
|
146
|
-
} else {
|
|
147
|
-
try {
|
|
148
|
-
hidden = localStorage.getItem(storageKey) === "1";
|
|
149
|
-
} catch {
|
|
150
|
-
/* ignore */
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
// force mini does not overwrite Hide preference in storage.
|
|
154
|
-
apply(hidden, opts.forceCollapsed === true ? false : true);
|
|
155
|
-
const toggle = panel.querySelector("[data-wg-toggle]");
|
|
156
|
-
if (toggle && !toggle.dataset.wgWired) {
|
|
157
|
-
toggle.dataset.wgWired = "1";
|
|
158
|
-
toggle.addEventListener("click", (e) => {
|
|
159
|
-
e.stopPropagation();
|
|
160
|
-
apply(!panel.classList.contains("wg-collapsed"), true);
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
const miniNext = panel.querySelector("[data-wg-mini-next]");
|
|
164
|
-
if (miniNext && !miniNext.dataset.wgWired) {
|
|
165
|
-
miniNext.dataset.wgWired = "1";
|
|
166
|
-
miniNext.addEventListener("click", (e) => {
|
|
167
|
-
e.stopPropagation();
|
|
168
|
-
const runBtn = __wgById("wg-run");
|
|
169
|
-
if (runBtn && !runBtn.disabled) {
|
|
170
|
-
runBtn.click();
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (typeof window.__wgNext === "function") window.__wgNext({});
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
const autoCb = __wgById("wg-autoplay-cb");
|
|
177
|
-
if (autoCb && !autoCb.dataset.wgMiniWired) {
|
|
178
|
-
autoCb.dataset.wgMiniWired = "1";
|
|
179
|
-
autoCb.addEventListener("change", () => {
|
|
180
|
-
syncMiniNext(panel.classList.contains("wg-collapsed"));
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
const cur = panel.querySelector("#wg-modules .wg-mod-current");
|
|
184
|
-
if (cur && typeof cur.scrollIntoView === "function") {
|
|
185
|
-
try {
|
|
186
|
-
cur.scrollIntoView({ inline: "center", block: "nearest", behavior: "smooth" });
|
|
187
|
-
} catch {
|
|
188
|
-
cur.scrollIntoView(false);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
}
|