@rogieking/figui3 2.38.3 → 3.0.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 +11 -8
- package/components.css +87 -23
- package/dist/fig.js +72 -72
- package/fig.js +540 -288
- package/package.json +2 -1
- package/polyfills/custom-elements-webkit.js +216 -0
package/README.md
CHANGED
|
@@ -46,14 +46,14 @@ import "@rogieking/figui3/fig.js";
|
|
|
46
46
|
|
|
47
47
|
```html
|
|
48
48
|
<link rel="stylesheet" href="https://unpkg.com/@rogieking/figui3@latest/fig.css" />
|
|
49
|
-
<script src="https://unpkg.com/@rogieking/figui3@latest/fig.js"></script>
|
|
49
|
+
<script type="module" src="https://unpkg.com/@rogieking/figui3@latest/fig.js"></script>
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
Or via esm.sh:
|
|
53
53
|
|
|
54
54
|
```html
|
|
55
55
|
<link rel="stylesheet" href="https://esm.sh/@rogieking/figui3@latest/fig.css" />
|
|
56
|
-
<script src="https://esm.sh/@rogieking/figui3@latest/fig.js"></script>
|
|
56
|
+
<script type="module" src="https://esm.sh/@rogieking/figui3@latest/fig.js"></script>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### Development
|
|
@@ -665,24 +665,25 @@ An image display or upload component.
|
|
|
665
665
|
|
|
666
666
|
---
|
|
667
667
|
|
|
668
|
-
###
|
|
668
|
+
### Joystick (`<fig-joystick>`)
|
|
669
669
|
|
|
670
670
|
A 2D position input control.
|
|
671
671
|
|
|
672
672
|
| Attribute | Type | Default | Description |
|
|
673
673
|
|-----------|------|---------|-------------|
|
|
674
|
-
| `value` | string |
|
|
674
|
+
| `value` | string | `"50% 50%"` | Position as percentages (for example `"50% 50%"` or `"25% 80%"`) |
|
|
675
675
|
| `precision` | number | — | Decimal places |
|
|
676
676
|
| `transform` | number | — | Output scaling |
|
|
677
|
-
| `
|
|
677
|
+
| `fields` | boolean | `false` | Show X/Y inputs |
|
|
678
678
|
| `coordinates` | string | `"screen"` | Coordinate system: `"screen"` (0,0 top-left) or `"math"` (0,0 bottom-left) |
|
|
679
|
+
| `aspect-ratio` | string | `"1 / 1"` | Plane container ratio (for example `16 / 9`) |
|
|
679
680
|
|
|
680
681
|
```html
|
|
681
|
-
<fig-
|
|
682
|
-
<fig-
|
|
682
|
+
<fig-joystick value="50% 50%"></fig-joystick>
|
|
683
|
+
<fig-joystick value="50% 50%" fields="true" precision="2"></fig-joystick>
|
|
683
684
|
|
|
684
685
|
<!-- Math coordinates (Y-axis inverted: 0,0 at bottom-left) -->
|
|
685
|
-
<fig-
|
|
686
|
+
<fig-joystick value="50% 50%" coordinates="math" fields="true"></fig-joystick>
|
|
686
687
|
```
|
|
687
688
|
|
|
688
689
|
---
|
|
@@ -892,6 +893,8 @@ function ColorPicker({ value, onChange }) {
|
|
|
892
893
|
```
|
|
893
894
|
|
|
894
895
|
> **Note:** Avoid setting the `value` prop directly on web components in JSX during re-renders, as `attributeChangedCallback` may trigger events that cause infinite loops. Use refs to control updates.
|
|
896
|
+
>
|
|
897
|
+
> **SSR note (Next.js/Remix/Astro):** import `@rogieking/figui3/fig.js` only on the client (for example in a client-only entry/module). This keeps server rendering safe while still allowing FigUI3 to auto-load its WebKit/iOS customized built-in polyfill when needed.
|
|
895
898
|
|
|
896
899
|
### Vue
|
|
897
900
|
|
package/components.css
CHANGED
|
@@ -1791,7 +1791,8 @@ fig-origin-grid {
|
|
|
1791
1791
|
|
|
1792
1792
|
&.overflow-right {
|
|
1793
1793
|
--origin-overflow-nudge-x: calc(
|
|
1794
|
-
var(--origin-overflow-nudge-base) *
|
|
1794
|
+
var(--origin-overflow-nudge-base) *
|
|
1795
|
+
var(--origin-overflow-nudge-x-scale) * -1
|
|
1795
1796
|
);
|
|
1796
1797
|
}
|
|
1797
1798
|
|
|
@@ -1803,7 +1804,8 @@ fig-origin-grid {
|
|
|
1803
1804
|
|
|
1804
1805
|
&.overflow-down {
|
|
1805
1806
|
--origin-overflow-nudge-y: calc(
|
|
1806
|
-
var(--origin-overflow-nudge-base) *
|
|
1807
|
+
var(--origin-overflow-nudge-base) *
|
|
1808
|
+
var(--origin-overflow-nudge-y-scale) * -1
|
|
1807
1809
|
);
|
|
1808
1810
|
}
|
|
1809
1811
|
}
|
|
@@ -3234,11 +3236,14 @@ fig-segmented-control {
|
|
|
3234
3236
|
}
|
|
3235
3237
|
}
|
|
3236
3238
|
|
|
3237
|
-
fig-
|
|
3238
|
-
--size:
|
|
3239
|
-
|
|
3239
|
+
fig-joystick {
|
|
3240
|
+
--size: 100%;
|
|
3241
|
+
--aspect-ratio: 1 / 1;
|
|
3242
|
+
display: flex;
|
|
3243
|
+
flex-direction: column;
|
|
3240
3244
|
gap: var(--spacer-2);
|
|
3241
3245
|
user-select: none;
|
|
3246
|
+
width: var(--size);
|
|
3242
3247
|
|
|
3243
3248
|
/* When inside horizontal fig-field, grow to fill and let inputs expand */
|
|
3244
3249
|
fig-field[direction="horizontal"] & {
|
|
@@ -3250,10 +3255,21 @@ fig-input-joystick {
|
|
|
3250
3255
|
width: auto;
|
|
3251
3256
|
}
|
|
3252
3257
|
}
|
|
3258
|
+
|
|
3259
|
+
.joystick-values {
|
|
3260
|
+
display: grid;
|
|
3261
|
+
grid-template-columns: 1fr 1fr;
|
|
3262
|
+
gap: var(--spacer-2);
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
.joystick-values > fig-input-number {
|
|
3266
|
+
width: 100%;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3253
3269
|
.fig-input-joystick-plane-container {
|
|
3254
3270
|
display: flex;
|
|
3255
|
-
width:
|
|
3256
|
-
|
|
3271
|
+
width: 100%;
|
|
3272
|
+
aspect-ratio: var(--aspect-ratio);
|
|
3257
3273
|
place-items: center;
|
|
3258
3274
|
flex-shrink: 0;
|
|
3259
3275
|
flex-grow: 0;
|
|
@@ -3264,22 +3280,61 @@ fig-input-joystick {
|
|
|
3264
3280
|
outline: 0;
|
|
3265
3281
|
}
|
|
3266
3282
|
}
|
|
3283
|
+
|
|
3284
|
+
.fig-joystick-axis-label {
|
|
3285
|
+
position: absolute;
|
|
3286
|
+
z-index: 2;
|
|
3287
|
+
pointer-events: none;
|
|
3288
|
+
user-select: none;
|
|
3289
|
+
color: var(--figma-color-text-tertiary);
|
|
3290
|
+
font-size: 10px;
|
|
3291
|
+
line-height: 1;
|
|
3292
|
+
letter-spacing: 0.01em;
|
|
3293
|
+
font-weight: 700;
|
|
3294
|
+
text-shadow:
|
|
3295
|
+
1px 0 0 var(--figma-color-bg-secondary),
|
|
3296
|
+
-1px 0 0 var(--figma-color-bg-secondary),
|
|
3297
|
+
0 1px 0 var(--figma-color-bg-secondary),
|
|
3298
|
+
0 -1px 0 var(--figma-color-bg-secondary);
|
|
3299
|
+
|
|
3300
|
+
&.top {
|
|
3301
|
+
top: var(--spacer-2);
|
|
3302
|
+
left: 50%;
|
|
3303
|
+
transform: translateX(-50%);
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
&.bottom {
|
|
3307
|
+
bottom: var(--spacer-2);
|
|
3308
|
+
left: 50%;
|
|
3309
|
+
transform: translateX(-50%);
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
&.left {
|
|
3313
|
+
left: var(--spacer-2);
|
|
3314
|
+
top: 50%;
|
|
3315
|
+
transform: translateY(-50%) rotate(-90deg);
|
|
3316
|
+
transform-origin: center;
|
|
3317
|
+
|
|
3318
|
+
&.no-rotate {
|
|
3319
|
+
transform: translateY(-50%);
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
&.right {
|
|
3324
|
+
right: var(--spacer-2);
|
|
3325
|
+
top: 50%;
|
|
3326
|
+
transform: translateY(-50%) rotate(90deg);
|
|
3327
|
+
transform-origin: center;
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3267
3331
|
.fig-input-joystick-plane {
|
|
3268
3332
|
display: inline-grid;
|
|
3269
3333
|
place-items: center;
|
|
3270
3334
|
position: relative;
|
|
3271
|
-
width:
|
|
3272
|
-
height:
|
|
3335
|
+
width: 100%;
|
|
3336
|
+
height: 100%;
|
|
3273
3337
|
flex-shrink: 0;
|
|
3274
|
-
&.dragging {
|
|
3275
|
-
cursor: grab;
|
|
3276
|
-
--size: 3rem;
|
|
3277
|
-
z-index: 2;
|
|
3278
|
-
position: absolute;
|
|
3279
|
-
top: 50%;
|
|
3280
|
-
left: 50%;
|
|
3281
|
-
transform: translate(-50%, -50%);
|
|
3282
|
-
}
|
|
3283
3338
|
}
|
|
3284
3339
|
.fig-input-joystick-plane > * {
|
|
3285
3340
|
grid-area: 1/1;
|
|
@@ -3288,7 +3343,6 @@ fig-input-joystick {
|
|
|
3288
3343
|
position: absolute;
|
|
3289
3344
|
width: var(--size);
|
|
3290
3345
|
height: var(--size);
|
|
3291
|
-
box-shadow: inset 0 0 0 1px var(--figma-color-border);
|
|
3292
3346
|
border-radius: var(--radius-medium);
|
|
3293
3347
|
overflow: hidden;
|
|
3294
3348
|
background: var(--figma-color-bg-secondary);
|
|
@@ -3340,12 +3394,22 @@ fig-input-joystick {
|
|
|
3340
3394
|
.fig-input-joystick-handle {
|
|
3341
3395
|
position: absolute;
|
|
3342
3396
|
z-index: 1;
|
|
3343
|
-
width:
|
|
3344
|
-
height:
|
|
3345
|
-
background: var(--
|
|
3346
|
-
box-shadow:
|
|
3397
|
+
width: 1rem;
|
|
3398
|
+
height: 1rem;
|
|
3399
|
+
background: var(--figma-color-bg-brand);
|
|
3400
|
+
box-shadow:
|
|
3401
|
+
inset 0 0 0 0.125rem var(--handle-color),
|
|
3402
|
+
0px 0 0 0.5px rgba(0, 0, 0, 0.1),
|
|
3403
|
+
var(--figma-elevation-200);
|
|
3347
3404
|
border-radius: 50%;
|
|
3348
3405
|
transform: translate(-50%, -50%);
|
|
3406
|
+
transition: box-shadow var(--slider-transition);
|
|
3407
|
+
&:hover {
|
|
3408
|
+
box-shadow:
|
|
3409
|
+
inset 0 0 0 0.25rem var(--handle-color),
|
|
3410
|
+
0px 0 0 0.5px rgba(0, 0, 0, 0.1),
|
|
3411
|
+
var(--figma-elevation-200);
|
|
3412
|
+
}
|
|
3349
3413
|
}
|
|
3350
3414
|
}
|
|
3351
3415
|
|