@opencraw/studio 0.0.5 → 0.0.6

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.
Files changed (30) hide show
  1. package/dist/index.esm.js +888 -10
  2. package/dist/src/index.d.ts +2 -2
  3. package/dist/src/page-snapshot/hidden-marks.algorithm.d.ts +23 -0
  4. package/dist/src/page-snapshot/index.d.ts +7 -0
  5. package/dist/src/page-snapshot/rewrite-document.mapper.d.ts +27 -0
  6. package/dist/src/page-snapshot/snapshot.store.d.ts +14 -0
  7. package/dist/src/page-snapshot/take-snapshot.use-case.d.ts +34 -0
  8. package/dist/src/sample-run/run-sample.use-case.d.ts +3 -1
  9. package/dist/src/selector-inference/class-token.policy.d.ts +35 -0
  10. package/dist/src/selector-inference/dom-path.model.d.ts +73 -0
  11. package/dist/src/selector-inference/index.d.ts +12 -0
  12. package/dist/src/selector-inference/list-inference.algorithm.d.ts +43 -0
  13. package/dist/src/selector-inference/selector-candidates.algorithm.d.ts +22 -0
  14. package/dist/src/selector-inference/selector-ranking.policy.d.ts +27 -0
  15. package/dist/src/selector-inference/shadow-dom.error.d.ts +11 -0
  16. package/dist/src/selector-inference/take-kind.policy.d.ts +12 -0
  17. package/dist/src/studio-api/command.contract.d.ts +44 -0
  18. package/dist/src/studio-api/index.d.ts +8 -2
  19. package/dist/src/studio-api/infer-selector-view.contract.d.ts +68 -0
  20. package/dist/src/studio-api/snapshot-view.contract.d.ts +9 -0
  21. package/dist/src/studio-api/verify-selector-view.contract.d.ts +18 -0
  22. package/dist/src/studio-server/infer-selector.handler.d.ts +18 -0
  23. package/dist/src/studio-server/studio-http.use-case.d.ts +3 -0
  24. package/dist/src/studio-server/take-snapshot.handler.d.ts +16 -0
  25. package/dist/src/studio-server/verify-selector.handler.d.ts +18 -0
  26. package/dist/src/studio-server/workspace.store.d.ts +7 -2
  27. package/dist/ui/assets/index-BfbrsfCv.js +13 -0
  28. package/dist/ui/index.html +1 -1
  29. package/package.json +5 -3
  30. package/dist/ui/assets/index-DYb-tdmr.js +0 -12
@@ -0,0 +1,18 @@
1
+ import type { VerifySelectorCommand, VerifySelectorView } from '../studio-api/index.js';
2
+ import type { StudioState } from './workspace.store.js';
3
+ /**
4
+ * Handles `verify-selector`: runs a candidate through the engine's own
5
+ * selection (`@opencraw/core`'s `countMatches`) against the cached
6
+ * snapshot, and, best-effort, against the live page too — issue #91's "flag
7
+ * a selector that matches the snapshot but not the live page". The live
8
+ * page is fetched raw (`page-snapshot`'s `fetchStartPage`, the same reach
9
+ * `take-snapshot` has: only `"start"` today), not through the rewritten
10
+ * snapshot, so its match count is the site's own, not the studio's.
11
+ *
12
+ * @param state - The server state.
13
+ * @param command - The command; `command.path` must already have a cached snapshot (call `take-snapshot` first).
14
+ * @returns The match counts.
15
+ * @throws Error when no workspace is open, the recipe cannot be found, or `command.path` has no cached snapshot yet.
16
+ */
17
+ export declare function handleVerifySelector(state: StudioState, command: VerifySelectorCommand): Promise<VerifySelectorView>;
18
+ //# sourceMappingURL=verify-selector.handler.d.ts.map
@@ -1,13 +1,18 @@
1
+ import type { BrowserSessionConfig } from '@opencraw/core';
2
+ import type { SnapshotCache } from '../page-snapshot/index.js';
1
3
  import type { SampleRunHandle } from '../sample-run/index.js';
2
4
  import type { StudioEvent } from '../studio-api/index.js';
3
5
  import type { WsConnection } from './websocket.client.js';
4
- /** The server's mutable state: the opened folder, the run in progress (if any), and the connected event sockets. */
6
+ /** The server's mutable state: the opened folder, the run in progress (if any), the connected event sockets, the per-recipe snapshot cache `take-snapshot`/`verify-selector`/`infer-selector` share, and the browser launch settings every web-mode command (`take-snapshot`, `verify-selector`, `run-sample`) shares. */
5
7
  export interface StudioState {
6
8
  folder?: string;
7
9
  activeRun?: SampleRunHandle;
8
10
  sockets: Set<WsConnection>;
11
+ snapshots: SnapshotCache;
12
+ /** Set once at server start (`StudioServerOptions.browser`); every web-mode command reads it from here rather than each accepting its own. */
13
+ browser?: BrowserSessionConfig;
9
14
  }
10
- /** @returns Fresh state for a new server instance: no workspace open, no run, no sockets. */
15
+ /** @returns Fresh state for a new server instance: no workspace open, no run, no sockets, an empty snapshot cache, Playwright's own default browser. */
11
16
  export declare function createStudioState(): StudioState;
12
17
  /**
13
18
  * Sends one event to every connected client. A socket that errors while