@rogieking/figui3 9.0.13 → 9.1.0

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.js CHANGED
@@ -2136,7 +2136,9 @@ class FigFillPicker extends HTMLElement {
2136
2136
  this.#discardDialog({ stopWebcam: true });
2137
2137
  this.#cancelFrames();
2138
2138
  this.#revokeOwnedBlobUrls();
2139
- if (this.#swatch) this.#swatch.removeAttribute("selected");
2139
+ if (this.#isNativeSwatch(this.#swatch)) {
2140
+ this.#swatch.removeAttribute("selected");
2141
+ }
2140
2142
  if (this.#trigger) {
2141
2143
  this.#trigger.removeEventListener("click", this.#boundTriggerClick);
2142
2144
  this.#trigger.removeEventListener("keydown", this.#boundTriggerKeydown);
@@ -2398,6 +2400,17 @@ class FigFillPicker extends HTMLElement {
2398
2400
  keep.forEach((url) => this.#ownedBlobUrls.add(url));
2399
2401
  }
2400
2402
 
2403
+ #isNativeSwatch(element) {
2404
+ return element?.matches("fig-swatch, fig-chit") ?? false;
2405
+ }
2406
+
2407
+ #isPreviewSwatch(element) {
2408
+ return (
2409
+ this.#isNativeSwatch(element) ||
2410
+ (element?.matches("[data-fig-fill-picker-swatch]") ?? false)
2411
+ );
2412
+ }
2413
+
2401
2414
  #setupTrigger() {
2402
2415
  const child = Array.from(this.children).find(
2403
2416
  (el) => !el.getAttribute("slot")?.startsWith("mode-"),
@@ -2409,7 +2422,7 @@ class FigFillPicker extends HTMLElement {
2409
2422
  this.#swatch.setAttribute("background", "#D9D9D9");
2410
2423
  this.appendChild(this.#swatch);
2411
2424
  this.#trigger = this.#swatch;
2412
- } else if (child.matches("fig-swatch, fig-chit")) {
2425
+ } else if (this.#isPreviewSwatch(child)) {
2413
2426
  // Scenario 2: Has swatch - use and populate it
2414
2427
  this.#swatch = child;
2415
2428
  this.#trigger = child;
@@ -2426,7 +2439,7 @@ class FigFillPicker extends HTMLElement {
2426
2439
  this.#trigger.addEventListener("keydown", this.#boundTriggerKeydown);
2427
2440
 
2428
2441
  // Prevent the swatch's internal color input from opening system picker
2429
- if (this.#swatch) {
2442
+ if (this.#isNativeSwatch(this.#swatch)) {
2430
2443
  this.#scheduleFrame(() => {
2431
2444
  const input = this.#swatch.querySelector('input[type="color"]');
2432
2445
  if (input) {
@@ -2659,7 +2672,9 @@ class FigFillPicker extends HTMLElement {
2659
2672
  this.#valueAtOpen = JSON.stringify(this.value);
2660
2673
  this.#lastChangeValue = this.#valueAtOpen;
2661
2674
 
2662
- if (this.#swatch) this.#swatch.setAttribute("selected", "true");
2675
+ if (this.#isNativeSwatch(this.#swatch)) {
2676
+ this.#swatch.setAttribute("selected", "true");
2677
+ }
2663
2678
 
2664
2679
  this.#dialog.open = true;
2665
2680
  this.#syncTriggerA11y();
@@ -2903,7 +2918,9 @@ class FigFillPicker extends HTMLElement {
2903
2918
  });
2904
2919
 
2905
2920
  const onDialogClose = () => {
2906
- if (this.#swatch) this.#swatch.removeAttribute("selected");
2921
+ if (this.#isNativeSwatch(this.#swatch)) {
2922
+ this.#swatch.removeAttribute("selected");
2923
+ }
2907
2924
  if (this.#shouldKeepWebcamLive()) this.#detachWebcamPreview();
2908
2925
  else this.#stopWebcam();
2909
2926
  const closingValue = JSON.stringify(this.value);
package/fig-lab.css CHANGED
@@ -101,6 +101,10 @@ fig-ai-context {
101
101
  }
102
102
  }
103
103
 
104
+ fig-ai-context:has(+ fig-ai-prompt) {
105
+ margin-bottom: calc(-1 * var(--spacer-3));
106
+ }
107
+
104
108
  fig-attachments {
105
109
  display: flex;
106
110
  flex-wrap: wrap;
@@ -484,77 +488,6 @@ fig-canvas-control {
484
488
  }
485
489
  }
486
490
 
487
- /* Angle Input */
488
- fig-input-angle {
489
- --size: 1.5rem;
490
- display: inline-flex;
491
- align-items: center;
492
- gap: var(--spacer-2);
493
- user-select: none;
494
-
495
- > fig-input-number {
496
- flex: 0 0 auto;
497
- width: auto;
498
- }
499
-
500
- &[full]:not([full="false"]) {
501
- display: flex;
502
- width: 100%;
503
-
504
- > fig-input-number {
505
- flex: 1 1 auto;
506
- min-width: 0;
507
- width: auto;
508
- }
509
- }
510
-
511
- fig-field:not([direction="vertical"]) & {
512
- flex: 1;
513
- min-width: 0;
514
-
515
- fig-input-number {
516
- flex: 0 0 auto;
517
- width: auto;
518
- }
519
- }
520
-
521
- .fig-input-angle-plane {
522
- display: inline-grid;
523
- place-items: center;
524
- width: var(--size);
525
- height: var(--size);
526
- aspect-ratio: 1/1;
527
- flex-shrink: 0;
528
- background-color: var(--figma-color-bg-secondary);
529
- border-radius: 100%;
530
- box-shadow: inset 0 0 0 1px var(--figma-color-border);
531
- &:focus {
532
- outline: var(--figma-focus-outline);
533
- outline-offset: var(--figma-focus-outline-offset);
534
- }
535
- &.dragging {
536
- outline: 0;
537
- box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
538
- }
539
- }
540
- .fig-input-angle-handle {
541
- display: inline-grid;
542
- place-items: center;
543
- grid-area: 1/1;
544
- width: calc(0.5rem + 2px);
545
- height: calc(0.5rem + 2px);
546
- &::before {
547
- content: "";
548
- display: block;
549
- width: 0.5rem;
550
- height: 0.5rem;
551
- background: var(--handle-color);
552
- box-shadow: var(--handle-shadow);
553
- border-radius: 50%;
554
- }
555
- }
556
- }
557
-
558
491
  /* Oscillator Input */
559
492
  fig-reorder {
560
493
  display: contents;