@rogieking/figui3 9.0.14 → 9.1.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/.cursor/skills/fig-lab/SKILL.md +2 -2
- package/.cursor/skills/fig-lab/components.md +0 -13
- package/.cursor/skills/fig-lab/reference.md +0 -6
- package/.cursor/skills/figui3/SKILL.md +1 -1
- package/.cursor/skills/figui3/components.md +20 -1
- package/.cursor/skills/figui3/react.md +1 -1
- package/.cursor/skills/figui3/reference.md +18 -0
- package/README.md +21 -11
- package/components.css +258 -39
- package/dist/components.css +1 -1
- package/dist/fig-editor.css +1 -1
- package/dist/fig-editor.js +3 -3
- package/dist/fig-lab.css +1 -1
- package/dist/fig-lab.js +1 -1
- package/dist/fig.css +1 -1
- package/dist/fig.js +6 -6
- package/fig-editor.css +1 -1
- package/fig-editor.js +22 -5
- package/fig-lab.css +0 -71
- package/fig-lab.js +1 -671
- package/fig.js +883 -26
- package/package.json +1 -1
package/fig-editor.css
CHANGED
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.#
|
|
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
|
|
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.#
|
|
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.#
|
|
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
|
@@ -488,77 +488,6 @@ fig-canvas-control {
|
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
-
/* Angle Input */
|
|
492
|
-
fig-input-angle {
|
|
493
|
-
--size: 1.5rem;
|
|
494
|
-
display: inline-flex;
|
|
495
|
-
align-items: center;
|
|
496
|
-
gap: var(--spacer-2);
|
|
497
|
-
user-select: none;
|
|
498
|
-
|
|
499
|
-
> fig-input-number {
|
|
500
|
-
flex: 0 0 auto;
|
|
501
|
-
width: auto;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
&[full]:not([full="false"]) {
|
|
505
|
-
display: flex;
|
|
506
|
-
width: 100%;
|
|
507
|
-
|
|
508
|
-
> fig-input-number {
|
|
509
|
-
flex: 1 1 auto;
|
|
510
|
-
min-width: 0;
|
|
511
|
-
width: auto;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
fig-field:not([direction="vertical"]) & {
|
|
516
|
-
flex: 1;
|
|
517
|
-
min-width: 0;
|
|
518
|
-
|
|
519
|
-
fig-input-number {
|
|
520
|
-
flex: 0 0 auto;
|
|
521
|
-
width: auto;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
.fig-input-angle-plane {
|
|
526
|
-
display: inline-grid;
|
|
527
|
-
place-items: center;
|
|
528
|
-
width: var(--size);
|
|
529
|
-
height: var(--size);
|
|
530
|
-
aspect-ratio: 1/1;
|
|
531
|
-
flex-shrink: 0;
|
|
532
|
-
background-color: var(--figma-color-bg-secondary);
|
|
533
|
-
border-radius: 100%;
|
|
534
|
-
box-shadow: inset 0 0 0 1px var(--figma-color-border);
|
|
535
|
-
&:focus {
|
|
536
|
-
outline: var(--figma-focus-outline);
|
|
537
|
-
outline-offset: var(--figma-focus-outline-offset);
|
|
538
|
-
}
|
|
539
|
-
&.dragging {
|
|
540
|
-
outline: 0;
|
|
541
|
-
box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
.fig-input-angle-handle {
|
|
545
|
-
display: inline-grid;
|
|
546
|
-
place-items: center;
|
|
547
|
-
grid-area: 1/1;
|
|
548
|
-
width: calc(0.5rem + 2px);
|
|
549
|
-
height: calc(0.5rem + 2px);
|
|
550
|
-
&::before {
|
|
551
|
-
content: "";
|
|
552
|
-
display: block;
|
|
553
|
-
width: 0.5rem;
|
|
554
|
-
height: 0.5rem;
|
|
555
|
-
background: var(--handle-color);
|
|
556
|
-
box-shadow: var(--handle-shadow);
|
|
557
|
-
border-radius: 50%;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
491
|
/* Oscillator Input */
|
|
563
492
|
fig-reorder {
|
|
564
493
|
display: contents;
|