@rogieking/figui3 3.18.0 → 3.19.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 +22 -22
- package/dist/components.css +1 -1
- package/dist/fig.css +1 -1
- package/dist/fig.js +49 -49
- package/fig.js +244 -27
- 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
|
@@ -4978,63 +4978,63 @@ fig-color-tip {
|
|
|
4978
4978
|
}
|
|
4979
4979
|
}
|
|
4980
4980
|
|
|
4981
|
-
/* Canvas
|
|
4982
|
-
fig-canvas-
|
|
4981
|
+
/* Canvas Control */
|
|
4982
|
+
fig-canvas-control {
|
|
4983
4983
|
display: contents;
|
|
4984
|
-
--fig-canvas-
|
|
4985
|
-
--fig-canvas-
|
|
4986
|
-
--fig-canvas-
|
|
4987
|
-
--fig-canvas-
|
|
4984
|
+
--fig-canvas-control-line-stroke: rgba(255, 255, 255, 0.5);
|
|
4985
|
+
--fig-canvas-control-line-stroke-hover: var(--figma-color-bg-brand);
|
|
4986
|
+
--fig-canvas-control-line-stroke-active: var(--figma-color-bg-brand);
|
|
4987
|
+
--fig-canvas-control-line-stroke-width: 1.5px;
|
|
4988
4988
|
|
|
4989
4989
|
& > fig-handle,
|
|
4990
4990
|
& > fig-tooltip:has(fig-handle:not([size="small"])) {
|
|
4991
4991
|
z-index: 1;
|
|
4992
4992
|
}
|
|
4993
4993
|
|
|
4994
|
-
.fig-canvas-
|
|
4994
|
+
.fig-canvas-control-radius {
|
|
4995
4995
|
position: absolute;
|
|
4996
4996
|
pointer-events: none;
|
|
4997
4997
|
overflow: visible;
|
|
4998
4998
|
|
|
4999
4999
|
circle {
|
|
5000
5000
|
fill: none;
|
|
5001
|
-
stroke: var(--fig-canvas-
|
|
5002
|
-
stroke-width: var(--fig-canvas-
|
|
5001
|
+
stroke: var(--fig-canvas-control-line-stroke);
|
|
5002
|
+
stroke-width: var(--fig-canvas-control-line-stroke-width);
|
|
5003
5003
|
paint-order: stroke fill;
|
|
5004
5004
|
filter: drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.3))
|
|
5005
5005
|
drop-shadow(0 0.5px 1px rgba(0, 0, 0, 0.12));
|
|
5006
5006
|
}
|
|
5007
5007
|
|
|
5008
|
-
.fig-canvas-
|
|
5008
|
+
.fig-canvas-control-radius-hit {
|
|
5009
5009
|
stroke: transparent;
|
|
5010
5010
|
stroke-width: 12px;
|
|
5011
5011
|
pointer-events: stroke;
|
|
5012
5012
|
filter: none;
|
|
5013
5013
|
|
|
5014
5014
|
&:hover ~ circle {
|
|
5015
|
-
stroke: var(--fig-canvas-
|
|
5015
|
+
stroke: var(--fig-canvas-control-line-stroke-hover);
|
|
5016
5016
|
}
|
|
5017
5017
|
}
|
|
5018
5018
|
}
|
|
5019
5019
|
|
|
5020
|
-
&:has(.fig-canvas-
|
|
5021
|
-
&.fig-canvas-
|
|
5022
|
-
stroke: var(--fig-canvas-
|
|
5020
|
+
&:has(.fig-canvas-control-radius-hit:hover) .fig-canvas-control-angle-line,
|
|
5021
|
+
&.fig-canvas-control-ring-active .fig-canvas-control-angle-line {
|
|
5022
|
+
stroke: var(--fig-canvas-control-line-stroke-active);
|
|
5023
5023
|
}
|
|
5024
5024
|
|
|
5025
|
-
&.fig-canvas-
|
|
5026
|
-
.fig-canvas-
|
|
5027
|
-
circle:not(.fig-canvas-
|
|
5028
|
-
stroke: var(--fig-canvas-
|
|
5025
|
+
&.fig-canvas-control-ring-active
|
|
5026
|
+
.fig-canvas-control-radius
|
|
5027
|
+
circle:not(.fig-canvas-control-radius-hit) {
|
|
5028
|
+
stroke: var(--fig-canvas-control-line-stroke-active);
|
|
5029
5029
|
}
|
|
5030
5030
|
|
|
5031
|
-
.fig-canvas-
|
|
5031
|
+
.fig-canvas-control-angle-svg {
|
|
5032
5032
|
pointer-events: none;
|
|
5033
5033
|
}
|
|
5034
5034
|
|
|
5035
|
-
.fig-canvas-
|
|
5036
|
-
stroke: var(--fig-canvas-
|
|
5037
|
-
stroke-width: var(--fig-canvas-
|
|
5035
|
+
.fig-canvas-control-angle-line {
|
|
5036
|
+
stroke: var(--fig-canvas-control-line-stroke);
|
|
5037
|
+
stroke-width: var(--fig-canvas-control-line-stroke-width);
|
|
5038
5038
|
paint-order: stroke fill;
|
|
5039
5039
|
filter: drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.3))
|
|
5040
5040
|
drop-shadow(0 0.5px 1px rgba(0, 0, 0, 0.12));
|