@rogieking/figui3 3.18.0 → 3.20.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/README.md +26 -13
- package/components.css +49 -26
- package/dist/components.css +1 -1
- package/dist/fig.css +1 -1
- package/dist/fig.js +49 -49
- package/fig.js +328 -53
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ Minimal example:
|
|
|
82
82
|
| [Easing Curve](#easing-curve) | `<fig-easing-curve>` | Bezier/spring curve editor |
|
|
83
83
|
| [3D Rotate](#3d-rotate) | `<fig-3d-rotate>` | 3D cube rotation control |
|
|
84
84
|
| [Handle](#handle) | `<fig-handle>` | Draggable handle on a surface |
|
|
85
|
-
| [Canvas
|
|
85
|
+
| [Canvas Control](#canvas-control) | `<fig-canvas-control>` | Point with optional radius, angle, or second point |
|
|
86
86
|
| [Dialog](#dialog) | `<fig-dialog>` | Modal/non-modal dialog |
|
|
87
87
|
| [Popup](#popup) | `<fig-popup>` | Anchored floating surface |
|
|
88
88
|
| [Toast](#toast) | `<fig-toast>` | Toast notification |
|
|
@@ -784,36 +784,49 @@ A draggable handle element. Positioned on a `drag-surface` container with axis c
|
|
|
784
784
|
|
|
785
785
|
---
|
|
786
786
|
|
|
787
|
-
#### Canvas
|
|
787
|
+
#### Canvas Control
|
|
788
788
|
|
|
789
|
-
`<fig-canvas-
|
|
789
|
+
`<fig-canvas-control>` — [demo](https://rog.ie/figui3/#canvas-control)
|
|
790
790
|
|
|
791
|
-
A composite point control with optional radius circle
|
|
791
|
+
A composite point control with optional radius circle, angle handle, or second point. Place inside a positioned container; the component uses `display: contents` and does not create its own box.
|
|
792
792
|
|
|
793
793
|
| Attribute | Type | Default | Description |
|
|
794
794
|
|---|---|---|---|
|
|
795
|
-
| `type` | string | `"point"` | `"point"`, `"color"`, `"point-radius"`, `"point-radius-angle"` |
|
|
796
|
-
| `value` | JSON string | — | `{ "x": 50, "y": 50
|
|
795
|
+
| `type` | string | `"point"` | `"point"`, `"color"`, `"point-radius"`, `"point-radius-angle"`, `"point-point"` |
|
|
796
|
+
| `value` | JSON string | — | `{ "x": 50, "y": 50 }` — see type-specific shapes below |
|
|
797
|
+
| `name` | string | — | Tooltip label(s). Comma-separated for two handles: `"Start, End"` |
|
|
797
798
|
| `color` | string | — | Passthrough color for `type="color"` handle |
|
|
798
799
|
| `tooltips` | string | `"true"` | Show value tooltips on interaction |
|
|
799
800
|
| `disabled` | boolean | `false` | Disable all interaction |
|
|
800
801
|
| `drag-surface` | string | `"parent"` | Forwarded to inner `fig-handle`s |
|
|
801
|
-
| `snapping` | string | `"false"` | `"false"`, `"true"`, `"modifier"` — applies to
|
|
802
|
+
| `snapping` | string | `"false"` | `"false"`, `"true"`, `"modifier"` — applies to all handles |
|
|
803
|
+
|
|
804
|
+
**Value shapes by type:**
|
|
805
|
+
|
|
806
|
+
| Type | Value shape |
|
|
807
|
+
|---|---|
|
|
808
|
+
| `point`, `color` | `{ x, y }` |
|
|
809
|
+
| `point-radius` | `{ x, y, radius }` — radius: number (px) or `"25%"` |
|
|
810
|
+
| `point-radius-angle` | `{ x, y, radius, angle }` — angle in degrees |
|
|
811
|
+
| `point-point` | `{ x, y, x2, y2 }` — angle and length inferred |
|
|
802
812
|
|
|
803
813
|
**Events:**
|
|
804
814
|
|
|
805
815
|
| Event | Detail |
|
|
806
816
|
|---|---|
|
|
807
|
-
| `input` |
|
|
808
|
-
| `change` |
|
|
817
|
+
| `input` | Value object (shape depends on type) — while dragging |
|
|
818
|
+
| `change` | Value object (shape depends on type) — on release |
|
|
819
|
+
|
|
820
|
+
For `point-point`, both handles support direct drag (with a dynamic directional resize cursor) and rotation via their hit area (dragging from the hit area rotates around the opposite handle at fixed distance, with a rotate cursor).
|
|
809
821
|
|
|
810
822
|
```html
|
|
811
823
|
<div style="position: relative; width: 200px; height: 200px; background: #eee;">
|
|
812
|
-
<fig-canvas-
|
|
813
|
-
type="point-
|
|
814
|
-
|
|
824
|
+
<fig-canvas-control
|
|
825
|
+
type="point-point"
|
|
826
|
+
name="Start, End"
|
|
827
|
+
value='{"x":25,"y":25,"x2":75,"y2":75}'
|
|
815
828
|
snapping="modifier"
|
|
816
|
-
></fig-canvas-
|
|
829
|
+
></fig-canvas-control>
|
|
817
830
|
</div>
|
|
818
831
|
```
|
|
819
832
|
|
package/components.css
CHANGED
|
@@ -233,8 +233,8 @@
|
|
|
233
233
|
--handle-color: #fff;
|
|
234
234
|
--bg-selected: #f5f5f5;
|
|
235
235
|
--bg-selected-active: #e5f4ff;
|
|
236
|
-
--bg-tooltip: #1e1e1e;
|
|
237
|
-
--color-tooltip:
|
|
236
|
+
--bg-tooltip: light-dark(#ffffff, #1e1e1e);
|
|
237
|
+
--color-tooltip: var(--figma-color-text);
|
|
238
238
|
|
|
239
239
|
/* Transparent Backgrounds - use light-dark() */
|
|
240
240
|
--figma-color-bordertranslucent: light-dark(
|
|
@@ -2776,7 +2776,8 @@ fig-tooltip {
|
|
|
2776
2776
|
inset: unset;
|
|
2777
2777
|
display: inline-block;
|
|
2778
2778
|
overflow: visible;
|
|
2779
|
-
color:
|
|
2779
|
+
color-scheme: dark;
|
|
2780
|
+
color: var(--figma-color-text);
|
|
2780
2781
|
background-color: var(--bg-tooltip);
|
|
2781
2782
|
padding: var(--spacer-1) var(--spacer-2);
|
|
2782
2783
|
line-height: 1rem !important;
|
|
@@ -2784,7 +2785,8 @@ fig-tooltip {
|
|
|
2784
2785
|
border-radius: var(--radius-medium, 0.3125rem);
|
|
2785
2786
|
max-width: 180px;
|
|
2786
2787
|
width: max-content;
|
|
2787
|
-
box-shadow: inset 0 0.5px 0 0
|
|
2788
|
+
box-shadow: inset 0 0.5px 0 0
|
|
2789
|
+
light-dark(rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.06));
|
|
2788
2790
|
filter: drop-shadow(0px 1px 1.5px rgba(0, 0, 0, 0.1))
|
|
2789
2791
|
drop-shadow(0px 2.5px 6px rgba(0, 0, 0, 0.13))
|
|
2790
2792
|
drop-shadow(0px 0px 0.5px rgba(0, 0, 0, 0.15));
|
|
@@ -2814,6 +2816,12 @@ fig-tooltip {
|
|
|
2814
2816
|
transform: translate(-50%);
|
|
2815
2817
|
}
|
|
2816
2818
|
|
|
2819
|
+
&[pointer="false"] {
|
|
2820
|
+
&:after {
|
|
2821
|
+
display: none !important;
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2817
2825
|
&[position="bottom"] {
|
|
2818
2826
|
&:after {
|
|
2819
2827
|
top: 0px;
|
|
@@ -2821,6 +2829,18 @@ fig-tooltip {
|
|
|
2821
2829
|
transform: translate(-50%, -100%) scaleY(-1);
|
|
2822
2830
|
}
|
|
2823
2831
|
}
|
|
2832
|
+
&[theme="dark"] {
|
|
2833
|
+
color-scheme: dark;
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
&[theme="light"] {
|
|
2837
|
+
color-scheme: light;
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
&[theme="brand"] {
|
|
2841
|
+
background-color: var(--figma-color-bg-brand);
|
|
2842
|
+
color-scheme: dark;
|
|
2843
|
+
}
|
|
2824
2844
|
}
|
|
2825
2845
|
|
|
2826
2846
|
/* UI Icons */
|
|
@@ -4978,63 +4998,66 @@ fig-color-tip {
|
|
|
4978
4998
|
}
|
|
4979
4999
|
}
|
|
4980
5000
|
|
|
4981
|
-
/* Canvas
|
|
4982
|
-
fig-canvas-
|
|
5001
|
+
/* Canvas Control */
|
|
5002
|
+
fig-canvas-control {
|
|
4983
5003
|
display: contents;
|
|
4984
|
-
--fig-canvas-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
5004
|
+
--fig-canvas-control-line-stroke: light-dark(
|
|
5005
|
+
rgba(255, 255, 255, 1),
|
|
5006
|
+
rgba(255, 255, 255, 0.5)
|
|
5007
|
+
);
|
|
5008
|
+
--fig-canvas-control-line-stroke-hover: var(--figma-color-bg-brand);
|
|
5009
|
+
--fig-canvas-control-line-stroke-active: var(--figma-color-bg-brand);
|
|
5010
|
+
--fig-canvas-control-line-stroke-width: 1.25px;
|
|
4988
5011
|
|
|
4989
5012
|
& > fig-handle,
|
|
4990
5013
|
& > fig-tooltip:has(fig-handle:not([size="small"])) {
|
|
4991
5014
|
z-index: 1;
|
|
4992
5015
|
}
|
|
4993
5016
|
|
|
4994
|
-
.fig-canvas-
|
|
5017
|
+
.fig-canvas-control-radius {
|
|
4995
5018
|
position: absolute;
|
|
4996
5019
|
pointer-events: none;
|
|
4997
5020
|
overflow: visible;
|
|
4998
5021
|
|
|
4999
5022
|
circle {
|
|
5000
5023
|
fill: none;
|
|
5001
|
-
stroke: var(--fig-canvas-
|
|
5002
|
-
stroke-width: var(--fig-canvas-
|
|
5024
|
+
stroke: var(--fig-canvas-control-line-stroke);
|
|
5025
|
+
stroke-width: var(--fig-canvas-control-line-stroke-width);
|
|
5003
5026
|
paint-order: stroke fill;
|
|
5004
5027
|
filter: drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.3))
|
|
5005
5028
|
drop-shadow(0 0.5px 1px rgba(0, 0, 0, 0.12));
|
|
5006
5029
|
}
|
|
5007
5030
|
|
|
5008
|
-
.fig-canvas-
|
|
5031
|
+
.fig-canvas-control-radius-hit {
|
|
5009
5032
|
stroke: transparent;
|
|
5010
5033
|
stroke-width: 12px;
|
|
5011
5034
|
pointer-events: stroke;
|
|
5012
5035
|
filter: none;
|
|
5013
5036
|
|
|
5014
5037
|
&:hover ~ circle {
|
|
5015
|
-
stroke: var(--fig-canvas-
|
|
5038
|
+
stroke: var(--fig-canvas-control-line-stroke-hover);
|
|
5016
5039
|
}
|
|
5017
5040
|
}
|
|
5018
5041
|
}
|
|
5019
5042
|
|
|
5020
|
-
&:has(.fig-canvas-
|
|
5021
|
-
&.fig-canvas-
|
|
5022
|
-
stroke: var(--fig-canvas-
|
|
5043
|
+
&:has(.fig-canvas-control-radius-hit:hover) .fig-canvas-control-angle-line,
|
|
5044
|
+
&.fig-canvas-control-ring-active .fig-canvas-control-angle-line {
|
|
5045
|
+
stroke: var(--fig-canvas-control-line-stroke-active);
|
|
5023
5046
|
}
|
|
5024
5047
|
|
|
5025
|
-
&.fig-canvas-
|
|
5026
|
-
.fig-canvas-
|
|
5027
|
-
circle:not(.fig-canvas-
|
|
5028
|
-
stroke: var(--fig-canvas-
|
|
5048
|
+
&.fig-canvas-control-ring-active
|
|
5049
|
+
.fig-canvas-control-radius
|
|
5050
|
+
circle:not(.fig-canvas-control-radius-hit) {
|
|
5051
|
+
stroke: var(--fig-canvas-control-line-stroke-active);
|
|
5029
5052
|
}
|
|
5030
5053
|
|
|
5031
|
-
.fig-canvas-
|
|
5054
|
+
.fig-canvas-control-angle-svg {
|
|
5032
5055
|
pointer-events: none;
|
|
5033
5056
|
}
|
|
5034
5057
|
|
|
5035
|
-
.fig-canvas-
|
|
5036
|
-
stroke: var(--fig-canvas-
|
|
5037
|
-
stroke-width: var(--fig-canvas-
|
|
5058
|
+
.fig-canvas-control-angle-line {
|
|
5059
|
+
stroke: var(--fig-canvas-control-line-stroke);
|
|
5060
|
+
stroke-width: var(--fig-canvas-control-line-stroke-width);
|
|
5038
5061
|
paint-order: stroke fill;
|
|
5039
5062
|
filter: drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.3))
|
|
5040
5063
|
drop-shadow(0 0.5px 1px rgba(0, 0, 0, 0.12));
|