@rogieking/figui3 8.9.23 → 8.9.25

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/fig-editor.css CHANGED
@@ -1,3 +1,4 @@
1
+ /* Copyright (c) 2026 Rogie King. PolyForm Shield 1.0.0. See LICENSE. */
1
2
  @import url("fig-layer.css");
2
3
 
3
4
  :root,
package/fig-editor.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* Copyright (c) 2026 Rogie King. PolyForm Shield 1.0.0. See LICENSE. */
1
2
  import "./fig.js";
2
3
  import "./fig-lab.js";
3
4
 
@@ -1957,7 +1958,6 @@ class FigFillPicker extends HTMLElement {
1957
1958
  }
1958
1959
  this.#webcamPosterStream = stream;
1959
1960
  this.#updateSwatch();
1960
- this.#emitInput();
1961
1961
  };
1962
1962
 
1963
1963
  const attempt = async () => {
@@ -2257,9 +2257,9 @@ class FigFillPicker extends HTMLElement {
2257
2257
  this.#dialog.anchor = this.anchorElement || this.#trigger;
2258
2258
  }
2259
2259
 
2260
+ this.#switchTab(this.#fillType, { emit: false });
2260
2261
  this.#valueAtOpen = JSON.stringify(this.value);
2261
2262
  this.#lastChangeValue = this.#valueAtOpen;
2262
- this.#switchTab(this.#fillType, { emit: false });
2263
2263
 
2264
2264
  if (this.#swatch) this.#swatch.setAttribute("selected", "true");
2265
2265
 
@@ -2608,7 +2608,7 @@ class FigFillPicker extends HTMLElement {
2608
2608
  });
2609
2609
  }
2610
2610
 
2611
- if (tabName === "video") this.#applyDefaultVideo();
2611
+ if (tabName === "video") this.#applyDefaultVideo({ emit: false });
2612
2612
  if (tabName === "webcam") {
2613
2613
  this.#webcam.live = this.#webcamMode() === "live";
2614
2614
  this.#webcamStart?.(this.#webcam.deviceId);
@@ -4298,10 +4298,17 @@ class FigFillPicker extends HTMLElement {
4298
4298
  preview.addEventListener("loaded", (e) => {
4299
4299
  const src = e.detail?.src || preview.src;
4300
4300
  if (!src) return;
4301
+ const changed = src !== this.#image.url;
4301
4302
  this.#image.url = src;
4302
4303
  this.#updateImagePreview(preview);
4303
4304
  this.#updateSwatch();
4304
- this.#emitInput();
4305
+ if (changed) this.#emitInput();
4306
+ this.dispatchEvent(
4307
+ new CustomEvent("loaded", {
4308
+ bubbles: true,
4309
+ detail: e.detail ?? { src },
4310
+ }),
4311
+ );
4305
4312
  });
4306
4313
 
4307
4314
  preview.addEventListener("change", () => {
@@ -4461,7 +4468,7 @@ class FigFillPicker extends HTMLElement {
4461
4468
  container.replaceChildren(header, preview);
4462
4469
 
4463
4470
  this.#setupVideoEvents(container);
4464
- this.#applyDefaultVideo();
4471
+ this.#applyDefaultVideo({ emit: false });
4465
4472
  }
4466
4473
 
4467
4474
  #revokeVideoPoster() {
@@ -4472,7 +4479,7 @@ class FigFillPicker extends HTMLElement {
4472
4479
  this.#video.poster = null;
4473
4480
  }
4474
4481
 
4475
- #applyDefaultVideo({ emit = true } = {}) {
4482
+ #applyDefaultVideo({ emit = false } = {}) {
4476
4483
  if (this.#video.url) {
4477
4484
  this.#video.missing = false;
4478
4485
  if (!this.#video.poster) this.#captureVideoPoster(this.#video.url);
@@ -4602,12 +4609,19 @@ class FigFillPicker extends HTMLElement {
4602
4609
  preview.addEventListener("loaded", (e) => {
4603
4610
  const src = e.detail?.src || preview.src;
4604
4611
  if (!src) return;
4612
+ const changed = src !== this.#video.url;
4605
4613
  this.#video.url = src;
4606
4614
  this.#video.missing = false;
4607
4615
  this.#updateVideoPreviewStyle(preview);
4608
4616
  this.#captureVideoPoster(src);
4609
4617
  this.#updateSwatch();
4610
- this.#emitInput();
4618
+ if (changed) this.#emitInput();
4619
+ this.dispatchEvent(
4620
+ new CustomEvent("loaded", {
4621
+ bubbles: true,
4622
+ detail: e.detail ?? { src },
4623
+ }),
4624
+ );
4611
4625
  });
4612
4626
 
4613
4627
  preview.addEventListener("change", () => {
package/fig-lab.css CHANGED
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * FigUI3 Lab — Experimental component styles
3
+ * Copyright (c) 2026 Rogie King. PolyForm Shield 1.0.0. See LICENSE.
3
4
  *
4
5
  * Depends on base.css and components.css tokens.
5
6
  * Import alongside components.css for opt-in access:
package/fig-lab.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * FigUI3 Lab — Experimental components
3
+ * Copyright (c) 2026 Rogie King. PolyForm Shield 1.0.0. See LICENSE.
3
4
  *
4
5
  * These components are unstable and may change or be removed without notice.
5
6
  * Import alongside fig.js for opt-in access:
package/fig.js CHANGED
@@ -9476,6 +9476,16 @@ class FigInputFill extends HTMLElement {
9476
9476
  this.#emitChange();
9477
9477
  });
9478
9478
 
9479
+ this.#fillPicker.addEventListener("loaded", (e) => {
9480
+ e.stopPropagation();
9481
+ this.dispatchEvent(
9482
+ new CustomEvent("loaded", {
9483
+ bubbles: true,
9484
+ detail: e.detail,
9485
+ }),
9486
+ );
9487
+ });
9488
+
9479
9489
  this.#fillPicker.addEventListener("webcamstream", (e) => {
9480
9490
  this.dispatchEvent(
9481
9491
  new CustomEvent("webcamstream", {
@@ -9773,7 +9783,10 @@ class FigInputFill extends HTMLElement {
9773
9783
  #webcamValue() {
9774
9784
  return {
9775
9785
  live: this.#webcam.live !== false,
9776
- snapshot: this.#webcam.snapshot ?? null,
9786
+ snapshot:
9787
+ this.#webcam.snapshot ??
9788
+ this.#fillPicker?.value?.webcam?.snapshot ??
9789
+ null,
9777
9790
  deviceId: this.#webcam.deviceId ?? null,
9778
9791
  scaleMode: this.#webcam.scaleMode || "fill",
9779
9792
  scale: this.#webcam.scale ?? 50,
@@ -12992,6 +13005,23 @@ class FigMedia extends HTMLElement {
12992
13005
  detail,
12993
13006
  }),
12994
13007
  );
13008
+ if (
13009
+ (media.tagName === "IMG" && event.type === "load") ||
13010
+ (media.tagName === "VIDEO" && event.type === "loadeddata")
13011
+ ) {
13012
+ this.dispatchEvent(
13013
+ new CustomEvent("loaded", {
13014
+ bubbles: true,
13015
+ cancelable: true,
13016
+ composed: true,
13017
+ detail: {
13018
+ src: detail.src,
13019
+ file: this.#file,
13020
+ media,
13021
+ },
13022
+ }),
13023
+ );
13024
+ }
12995
13025
  }
12996
13026
 
12997
13027
  #handleMediaPlay() {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "8.9.23",
3
+ "version": "8.9.25",
4
4
  "description": "A lightweight web components library for building Figma plugin and widget UIs with native look and feel",
5
5
  "author": "Rogie King",
6
- "license": "MIT",
6
+ "license": "SEE LICENSE IN LICENSE",
7
7
  "type": "module",
8
8
  "main": "dist/fig.js",
9
9
  "module": "dist/fig.js",