@dice-plus/sdk 1.3.0 → 1.3.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/dist/index.js CHANGED
@@ -69,7 +69,7 @@ function formatRoomCode(roomId) {
69
69
  }
70
70
  //#endregion
71
71
  //#region src/index.ts
72
- var SDK_VERSION = "1.3.0";
72
+ var SDK_VERSION = "1.3.1";
73
73
  var DEFAULT_BASE_URL = "https://dice-plus.missinglinkdev.com";
74
74
  /** Room Code and Passcode helpers, so a page never has to guess our formats. */
75
75
  var rooms = {
@@ -86,7 +86,7 @@ var rooms = {
86
86
  };
87
87
  /** One of our iframes: the handshake, calls and events every embed shares. */
88
88
  var Embed = class {
89
- constructor(options, path, title, style) {
89
+ constructor(options, path, title, style, attributes = {}) {
90
90
  this.listeners = /* @__PURE__ */ new Map();
91
91
  this.pending = /* @__PURE__ */ new Map();
92
92
  this.queued = [];
@@ -114,6 +114,7 @@ var Embed = class {
114
114
  const frame = document.createElement("iframe");
115
115
  frame.src = new URL(path, base).href;
116
116
  frame.title = title;
117
+ for (const [name, value] of Object.entries(attributes)) frame.setAttribute(name, value);
117
118
  Object.assign(frame.style, {
118
119
  position: "absolute",
119
120
  inset: "0",
@@ -264,13 +265,14 @@ var DicePlusTray = class extends Embed {
264
265
  background: "transparent",
265
266
  colorScheme: "normal",
266
267
  pointerEvents: "none"
268
+ }, {
269
+ allow: "autoplay",
270
+ "aria-hidden": "true",
271
+ tabindex: "-1"
267
272
  });
268
273
  this.settings = { ...options.settings ?? {} };
269
274
  this.identity = options.identity;
270
275
  this.dice = options.dice;
271
- this.frame.setAttribute("allow", "autoplay");
272
- this.frame.setAttribute("aria-hidden", "true");
273
- this.frame.tabIndex = -1;
274
276
  }
275
277
  helloExtras() {
276
278
  return {
@@ -354,8 +356,7 @@ var DicePlusTray = class extends Embed {
354
356
  */
355
357
  var DicePlusBag = class extends Embed {
356
358
  constructor(options) {
357
- super(options, "/embed/bag.html", "Dice+ dice bag", {});
358
- this.frame.setAttribute("allow", "clipboard-write");
359
+ super(options, "/embed/bag.html", "Dice+ dice bag", {}, { allow: "clipboard-write" });
359
360
  }
360
361
  /** Whether the player is signed in and a patron, once the bag has said. */
361
362
  premium() {
@@ -2,7 +2,7 @@ import { type BagEvents, type EmbedTheme, type HelloMessage, type SiteDice, type
2
2
  import { normalizeRoomId } from '../../src/platform/relay/protocol';
3
3
  import { formatRoomCode } from '../../src/platform/relay/roomCode';
4
4
  export type * from '../../src/embed/protocol';
5
- export declare const SDK_VERSION = "1.3.0";
5
+ export declare const SDK_VERSION = "1.3.1";
6
6
  export declare const DEFAULT_BASE_URL = "https://dice-plus.missinglinkdev.com";
7
7
  /** Room Code and Passcode helpers, so a page never has to guess our formats. */
8
8
  export declare const rooms: {
@@ -70,7 +70,7 @@ declare abstract class Embed<Events extends CommonEvents> {
70
70
  private refused;
71
71
  private theme;
72
72
  private readonly onMessage;
73
- protected constructor(options: EmbedOptions, path: string, title: string, style: Partial<CSSStyleDeclaration>);
73
+ protected constructor(options: EmbedOptions, path: string, title: string, style: Partial<CSSStyleDeclaration>, attributes?: Record<string, string>);
74
74
  /** Listen for an event. Returns an unsubscribe. */
75
75
  on<E extends keyof Events>(name: E, listener: Listener<Events[E]>): () => void;
76
76
  once<E extends keyof Events>(name: E, listener: Listener<Events[E]>): () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dice-plus/sdk",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Embed the Dice+ 3D physics dice tray and dice bag on your site",
5
5
  "type": "module",
6
6
  "license": "MIT",