@openpicker/sdk 0.1.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,9 @@
1
1
  # @openpicker/sdk
2
2
 
3
- SDK for invoking the [openpicker](https://github.com/usertour/openpicker) browser extension to
4
- pick a CSS selector on any page.
3
+ SDK for invoking the [openpicker](https://openpicker.dev) browser extension to pick a CSS selector
4
+ on any page. Website: [openpicker.dev](https://openpicker.dev) · Docs:
5
+ [docs.openpicker.dev](https://docs.openpicker.dev) · Live demo:
6
+ [demo.openpicker.dev](https://demo.openpicker.dev)
5
7
 
6
8
  ```bash
7
9
  npm install @openpicker/sdk
package/dist/index.cjs CHANGED
@@ -1,15 +1,6 @@
1
1
  'use strict';
2
2
 
3
- // ../protocol/src/constants.ts
4
- var CHANNEL = "openpicker";
5
- var PROTOCOL_VERSION = 1;
6
-
7
- // ../protocol/src/envelope.ts
8
- function isEnvelope(value) {
9
- if (typeof value !== "object" || value === null) return false;
10
- const v = value;
11
- return v.channel === CHANNEL && typeof v.kind === "string";
12
- }
3
+ var protocol = require('@openpicker/protocol');
13
4
 
14
5
  // src/index.ts
15
6
  var OpenpickerError = class extends Error {
@@ -47,7 +38,7 @@ var Openpicker = class {
47
38
  if (event.source !== this.win) return;
48
39
  if (event.origin !== this.win.origin) return;
49
40
  const data = event.data;
50
- if (!isEnvelope(data) || data.kind !== "res") return;
41
+ if (!protocol.isEnvelope(data) || data.kind !== "res") return;
51
42
  const entry = this.pending.get(data.id);
52
43
  if (!entry) return;
53
44
  this.pending.delete(data.id);
@@ -71,8 +62,8 @@ var Openpicker = class {
71
62
  this.ensureListening();
72
63
  const id = `op:${this.instanceId}:${++this.seq}`;
73
64
  const envelope = {
74
- channel: CHANNEL,
75
- v: PROTOCOL_VERSION,
65
+ channel: protocol.CHANNEL,
66
+ v: protocol.PROTOCOL_VERSION,
76
67
  kind: "req",
77
68
  id,
78
69
  method,
@@ -174,6 +165,10 @@ function createOpenpicker(options) {
174
165
  return new Openpicker(options);
175
166
  }
176
167
 
168
+ Object.defineProperty(exports, "matchesSelectorConfig", {
169
+ enumerable: true,
170
+ get: function () { return protocol.matchesSelectorConfig; }
171
+ });
177
172
  exports.Openpicker = Openpicker;
178
173
  exports.OpenpickerError = OpenpickerError;
179
174
  exports.createOpenpicker = createOpenpicker;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PingResult, PickParams, PickResult, HighlightResult, ProtocolError } from '@openpicker/protocol';
2
- export { HighlightResult, PickParams, PickResult, PickedElement, PingResult, ProtocolError, ScreenshotMode } from '@openpicker/protocol';
2
+ export { HighlightResult, PickParams, PickResult, PickedElement, PingResult, ProtocolError, RegexSource, ScreenshotMode, SelectorAnchorConfig, SelectorConfig, SelectorToken, SelectorTokenType, matchesSelectorConfig } from '@openpicker/protocol';
3
3
 
4
4
  /** Error thrown by the SDK; carries a stable {@link ProtocolError.code}. */
5
5
  declare class OpenpickerError extends Error {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PingResult, PickParams, PickResult, HighlightResult, ProtocolError } from '@openpicker/protocol';
2
- export { HighlightResult, PickParams, PickResult, PickedElement, PingResult, ProtocolError, ScreenshotMode } from '@openpicker/protocol';
2
+ export { HighlightResult, PickParams, PickResult, PickedElement, PingResult, ProtocolError, RegexSource, ScreenshotMode, SelectorAnchorConfig, SelectorConfig, SelectorToken, SelectorTokenType, matchesSelectorConfig } from '@openpicker/protocol';
3
3
 
4
4
  /** Error thrown by the SDK; carries a stable {@link ProtocolError.code}. */
5
5
  declare class OpenpickerError extends Error {
package/dist/index.js CHANGED
@@ -1,13 +1,5 @@
1
- // ../protocol/src/constants.ts
2
- var CHANNEL = "openpicker";
3
- var PROTOCOL_VERSION = 1;
4
-
5
- // ../protocol/src/envelope.ts
6
- function isEnvelope(value) {
7
- if (typeof value !== "object" || value === null) return false;
8
- const v = value;
9
- return v.channel === CHANNEL && typeof v.kind === "string";
10
- }
1
+ import { isEnvelope, PROTOCOL_VERSION, CHANNEL } from '@openpicker/protocol';
2
+ export { matchesSelectorConfig } from '@openpicker/protocol';
11
3
 
12
4
  // src/index.ts
13
5
  var OpenpickerError = class extends Error {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@openpicker/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Open-source CSS element picker — SDK for invoking the openpicker browser extension.",
5
5
  "license": "MIT",
6
6
  "author": "Usertour (https://www.usertour.io)",
7
- "homepage": "https://github.com/usertour/openpicker#readme",
7
+ "homepage": "https://openpicker.dev",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/usertour/openpicker.git",
@@ -42,10 +42,12 @@
42
42
  "access": "public",
43
43
  "registry": "https://registry.npmjs.org/"
44
44
  },
45
+ "dependencies": {
46
+ "@openpicker/protocol": "^0.1.1"
47
+ },
45
48
  "devDependencies": {
46
49
  "tsup": "^8.5.0",
47
- "typescript": "^5.9.3",
48
- "@openpicker/protocol": "0.0.0"
50
+ "typescript": "^5.9.3"
49
51
  },
50
52
  "scripts": {
51
53
  "build": "tsup",