@playcraft/adsdk 1.0.19 → 1.0.20

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/dist/esm/index.js CHANGED
@@ -733,7 +733,7 @@ function toCursor(src, size) {
733
733
  });
734
734
  }
735
735
  function enableCustomCursor(opts = {}) {
736
- var _a, _b;
736
+ var _a, _b, _c;
737
737
  cleanup == null ? void 0 : cleanup();
738
738
  cleanup = null;
739
739
  if (typeof document === "undefined") return () => {
@@ -761,10 +761,10 @@ function enableCustomCursor(opts = {}) {
761
761
  if (cleanup === dispose) cleanup = null;
762
762
  };
763
763
  cleanup = dispose;
764
- Promise.all([
765
- toCursor(FINGER_HOVERING, size),
766
- toCursor(FINGER_PRESSING, size)
767
- ]).then(([hover, press]) => {
764
+ const hoverSrc = opts.hoverImage;
765
+ const pressSrc = (_c = opts.pressImage) != null ? _c : opts.hoverImage;
766
+ const cursorPromises = hoverSrc ? [toCursor(hoverSrc, size), pressSrc ? toCursor(pressSrc, size) : toCursor(hoverSrc, size)] : [toCursor(FINGER_HOVERING, size), toCursor(FINGER_PRESSING, size)];
767
+ Promise.all(cursorPromises).then(([hover, press]) => {
768
768
  if (disposed) return;
769
769
  target.style.cursor = hover;
770
770
  down = () => {
@@ -1150,8 +1150,9 @@ var _sdk = class _sdk {
1150
1150
  initTrackingProtocols();
1151
1151
  document.readyState === "loading" ? window.addEventListener("DOMContentLoaded", initSDK) : initSDK();
1152
1152
  isSDKInitialized = true;
1153
- if ((options == null ? void 0 : options.useCustomCursor) !== false) {
1154
- enableCustomCursor();
1153
+ const customCursor = options == null ? void 0 : options.customCursor;
1154
+ if (customCursor !== false) {
1155
+ enableCustomCursor(typeof customCursor === "object" ? customCursor : void 0);
1155
1156
  }
1156
1157
  }
1157
1158
  /**
@@ -1585,7 +1586,7 @@ var _sdk = class _sdk {
1585
1586
  }
1586
1587
  };
1587
1588
  /** Current version of the SDK */
1588
- _sdk.version = "1.0.19";
1589
+ _sdk.version = "1.0.20";
1589
1590
  /** Current maximum width of the playable ad container in pixels */
1590
1591
  _sdk.maxWidth = Math.floor(window.innerWidth);
1591
1592
  /** Current maximum height of the playable ad container in pixels */
@@ -971,7 +971,7 @@
971
971
  });
972
972
  }
973
973
  function enableCustomCursor(opts = {}) {
974
- var _a, _b;
974
+ var _a, _b, _c;
975
975
  cleanup == null ? void 0 : cleanup();
976
976
  cleanup = null;
977
977
  if (typeof document === "undefined") return () => {
@@ -999,10 +999,10 @@
999
999
  if (cleanup === dispose) cleanup = null;
1000
1000
  };
1001
1001
  cleanup = dispose;
1002
- Promise.all([
1003
- toCursor(FINGER_HOVERING, size),
1004
- toCursor(FINGER_PRESSING, size)
1005
- ]).then(([hover, press]) => {
1002
+ const hoverSrc = opts.hoverImage;
1003
+ const pressSrc = (_c = opts.pressImage) != null ? _c : opts.hoverImage;
1004
+ const cursorPromises = hoverSrc ? [toCursor(hoverSrc, size), pressSrc ? toCursor(pressSrc, size) : toCursor(hoverSrc, size)] : [toCursor(FINGER_HOVERING, size), toCursor(FINGER_PRESSING, size)];
1005
+ Promise.all(cursorPromises).then(([hover, press]) => {
1006
1006
  if (disposed) return;
1007
1007
  target.style.cursor = hover;
1008
1008
  down = () => {
@@ -1388,8 +1388,9 @@
1388
1388
  initTrackingProtocols();
1389
1389
  document.readyState === "loading" ? window.addEventListener("DOMContentLoaded", initSDK) : initSDK();
1390
1390
  isSDKInitialized = true;
1391
- if ((options == null ? void 0 : options.useCustomCursor) !== false) {
1392
- enableCustomCursor();
1391
+ const customCursor = options == null ? void 0 : options.customCursor;
1392
+ if (customCursor !== false) {
1393
+ enableCustomCursor(typeof customCursor === "object" ? customCursor : void 0);
1393
1394
  }
1394
1395
  }
1395
1396
  /**
@@ -1823,7 +1824,7 @@
1823
1824
  }
1824
1825
  };
1825
1826
  /** Current version of the SDK */
1826
- _sdk.version = "1.0.19";
1827
+ _sdk.version = "1.0.20";
1827
1828
  /** Current maximum width of the playable ad container in pixels */
1828
1829
  _sdk.maxWidth = Math.floor(window.innerWidth);
1829
1830
  /** Current maximum height of the playable ad container in pixels */
package/dist/index.d.mts CHANGED
@@ -28,6 +28,17 @@ interface CursorOptions {
28
28
  target?: HTMLElement;
29
29
  /** 光标尺寸(像素),默认 64。热点固定为 size 的 1/8 */
30
30
  size?: number;
31
+ /**
32
+ * 自定义鼠标悬浮态图片(URL 或 dataURL)。
33
+ * 传入后覆盖内置的手指图标。
34
+ */
35
+ hoverImage?: string;
36
+ /**
37
+ * 自定义鼠标按压态图片(URL 或 dataURL)。
38
+ * 仅当同时传了 hoverImage 时生效。
39
+ * 未传时按压态复用 hoverImage,无状态切换效果。
40
+ */
41
+ pressImage?: string;
31
42
  }
32
43
  /**
33
44
  * 启用自定义鼠标指针。默认挂载到 `document.body`,作用于整个页面。
@@ -87,7 +98,7 @@ declare class sdk {
87
98
  * @fires playcraftReady When game instance is created and ready to load resources
88
99
  */
89
100
  static playcraftInit(callback?: InitCallbackType, options?: {
90
- useCustomCursor?: boolean;
101
+ customCursor?: boolean | CursorOptions;
91
102
  }): void;
92
103
  /**
93
104
  * Starts the playable ad experience.
package/dist/index.d.ts CHANGED
@@ -28,6 +28,17 @@ interface CursorOptions {
28
28
  target?: HTMLElement;
29
29
  /** 光标尺寸(像素),默认 64。热点固定为 size 的 1/8 */
30
30
  size?: number;
31
+ /**
32
+ * 自定义鼠标悬浮态图片(URL 或 dataURL)。
33
+ * 传入后覆盖内置的手指图标。
34
+ */
35
+ hoverImage?: string;
36
+ /**
37
+ * 自定义鼠标按压态图片(URL 或 dataURL)。
38
+ * 仅当同时传了 hoverImage 时生效。
39
+ * 未传时按压态复用 hoverImage,无状态切换效果。
40
+ */
41
+ pressImage?: string;
31
42
  }
32
43
  /**
33
44
  * 启用自定义鼠标指针。默认挂载到 `document.body`,作用于整个页面。
@@ -87,7 +98,7 @@ declare class sdk {
87
98
  * @fires playcraftReady When game instance is created and ready to load resources
88
99
  */
89
100
  static playcraftInit(callback?: InitCallbackType, options?: {
90
- useCustomCursor?: boolean;
101
+ customCursor?: boolean | CursorOptions;
91
102
  }): void;
92
103
  /**
93
104
  * Starts the playable ad experience.
package/dist/index.js CHANGED
@@ -763,7 +763,7 @@ function toCursor(src, size) {
763
763
  });
764
764
  }
765
765
  function enableCustomCursor(opts = {}) {
766
- var _a, _b;
766
+ var _a, _b, _c;
767
767
  cleanup == null ? void 0 : cleanup();
768
768
  cleanup = null;
769
769
  if (typeof document === "undefined") return () => {
@@ -791,10 +791,10 @@ function enableCustomCursor(opts = {}) {
791
791
  if (cleanup === dispose) cleanup = null;
792
792
  };
793
793
  cleanup = dispose;
794
- Promise.all([
795
- toCursor(FINGER_HOVERING, size),
796
- toCursor(FINGER_PRESSING, size)
797
- ]).then(([hover, press]) => {
794
+ const hoverSrc = opts.hoverImage;
795
+ const pressSrc = (_c = opts.pressImage) != null ? _c : opts.hoverImage;
796
+ const cursorPromises = hoverSrc ? [toCursor(hoverSrc, size), pressSrc ? toCursor(pressSrc, size) : toCursor(hoverSrc, size)] : [toCursor(FINGER_HOVERING, size), toCursor(FINGER_PRESSING, size)];
797
+ Promise.all(cursorPromises).then(([hover, press]) => {
798
798
  if (disposed) return;
799
799
  target.style.cursor = hover;
800
800
  down = () => {
@@ -1180,8 +1180,9 @@ var _sdk = class _sdk {
1180
1180
  initTrackingProtocols();
1181
1181
  document.readyState === "loading" ? window.addEventListener("DOMContentLoaded", initSDK) : initSDK();
1182
1182
  isSDKInitialized = true;
1183
- if ((options == null ? void 0 : options.useCustomCursor) !== false) {
1184
- enableCustomCursor();
1183
+ const customCursor = options == null ? void 0 : options.customCursor;
1184
+ if (customCursor !== false) {
1185
+ enableCustomCursor(typeof customCursor === "object" ? customCursor : void 0);
1185
1186
  }
1186
1187
  }
1187
1188
  /**
@@ -1615,7 +1616,7 @@ var _sdk = class _sdk {
1615
1616
  }
1616
1617
  };
1617
1618
  /** Current version of the SDK */
1618
- _sdk.version = "1.0.19";
1619
+ _sdk.version = "1.0.20";
1619
1620
  /** Current maximum width of the playable ad container in pixels */
1620
1621
  _sdk.maxWidth = Math.floor(window.innerWidth);
1621
1622
  /** Current maximum height of the playable ad container in pixels */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcraft/adsdk",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "统一的 Playable SDK,支持 MRAID、Google、Facebook、Vungle、BigoAds 等多广告渠道",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",