@rogieking/figui3 6.25.0 → 6.26.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.
@@ -87,6 +87,8 @@ export default defineConfig({
87
87
  - Preserve value shape expectations:
88
88
  - `fig-input-color` expects solid color data (`detail.color`, optional `detail.alpha`) from the picker.
89
89
  - `fig-fill-picker` custom modes use JSON with `type` set to mode name and remaining data in payload.
90
+ - Direct color events expose additive `{ color, alpha, opacity }` aliases: opaque `#RRGGBB`, `0–1`, and `0–100`, respectively.
91
+ - Keep `fig-input-color`'s legacy `value`, `hex`, and `rgba` event-detail fields unchanged; consume the aliases for a shared contract.
90
92
 
91
93
  ## Critical Rules
92
94
 
@@ -180,7 +182,7 @@ attributeChangedCallback(name, oldValue, newValue) {
180
182
  ```txt
181
183
  Event contract quick map:
182
184
  - fig-slider: input/change -> current value on e.target.value
183
- - fig-input-color: input/change -> value on e.target.value, structured color via e.detail (when available)
185
+ - fig-input-color: input/change -> legacy value/hex/rgba plus color/alpha/opacity aliases in e.detail
184
186
  - fig-input-fill / fig-fill-picker: input/change -> fill payload in e.detail
185
187
  ```
186
188
 
package/README.md CHANGED
@@ -559,8 +559,8 @@ A compact solid-color swatch. Uses `<fig-fill-picker>` when the optional picker
559
559
 
560
560
  | Event | Detail |
561
561
  |---|---|
562
- | `input` | `{ color, opacity? }` — while editing |
563
- | `change` | `{ color, opacity? }` — on commit |
562
+ | `input` | `{ color, alpha, opacity }` — while editing |
563
+ | `change` | `{ color, alpha, opacity }` — on commit |
564
564
  | `add` | — (when `control="add"` is clicked) |
565
565
  | `remove` | — (when `control="remove"` is clicked) |
566
566
 
@@ -588,8 +588,10 @@ A compact solid-color swatch. Uses `<fig-fill-picker>` when the optional picker
588
588
 
589
589
  | Event | Detail |
590
590
  |---|---|
591
- | `input` | `{ color, alpha, hsv: { h, s, v, a } }` |
592
- | `change` | `{ color, alpha, hsv: { h, s, v, a } }` |
591
+ | `input` | `{ value, hex, rgba, color, alpha, opacity }` |
592
+ | `change` | `{ value, hex, rgba, color, alpha, opacity }` |
593
+
594
+ `value`, `hex`, and `rgba` retain their legacy values. The additive aliases use opaque `#RRGGBB` for `color`, `0–1` for `alpha`, and `0–100` for `opacity`.
593
595
 
594
596
  ```html
595
597
  <fig-input-color value="#FF5733" text="true"></fig-input-color>
@@ -959,8 +961,8 @@ A draggable handle element. Positioned on a `drag-surface` container with axis c
959
961
  |---|---|
960
962
  | `input` | `{ x, y, px, py, shiftKey }` — while dragging |
961
963
  | `change` | `{ x, y, px, py }` — on release |
962
- | `input` | `{ color, opacity }` — while editing a `type="color"` handle |
963
- | `change` | `{ color, opacity }` — when committing a `type="color"` handle |
964
+ | `input` | `{ color, alpha, opacity }` — while editing a `type="color"` handle |
965
+ | `change` | `{ color, alpha, opacity }` — when committing a `type="color"` handle |
964
966
  | `add` | — (when `tip="add"`) |
965
967
  | `remove` | — (when `tip="remove"`) |
966
968
  | `hitareadown` | `{ originalEvent }` — when `hit-area-mode="delegate"` and the hit area is clicked |
@@ -1008,6 +1010,8 @@ A composite point control with optional radius circle, angle handle, or second p
1008
1010
  | `input` | Value object (shape depends on type) — while dragging |
1009
1011
  | `change` | Value object (shape depends on type) — on release |
1010
1012
 
1013
+ For `type="color"`, color edits add `{ color, alpha, opacity }` to the positional value object.
1014
+
1011
1015
  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).
1012
1016
 
1013
1017
  ```html
@@ -1255,6 +1259,8 @@ A thin styled layer for arbitrary visual content. Use it for generated previews,
1255
1259
  | `full` | boolean | `false` | Stretch to the available width |
1256
1260
  | `checkerboard` | boolean | `false` | Show checkerboard behind transparent content |
1257
1261
 
1262
+ Set `--fig-preview-background` to customize the surface color, including `transparent` to remove it.
1263
+
1258
1264
  ```html
1259
1265
  <fig-preview full style="height: 96px">
1260
1266
  <canvas width="320" height="180"></canvas>
@@ -1345,7 +1351,7 @@ Use `slot="overlay"` for custom overlay controls. Slotted overlays stay as direc
1345
1351
 
1346
1352
  `<fig-card>` — [demo](https://rog.ie/figui3/#card)
1347
1353
 
1348
- A media card with a truncated label, optional link, and attribute-only selection chrome. Composes a generated `fig-image` (or an authored `fig-image` / `fig-media` / `fig-preview` child).
1354
+ A media card with a truncated label, optional link, and attribute-only selection chrome. With `src`, it composes a generated `fig-image`. Without `src`, authored children stay in place and only generated label content is added.
1349
1355
 
1350
1356
  | Attribute | Type | Default | Description |
1351
1357
  |---|---|---|---|
@@ -1368,8 +1374,13 @@ A media card with a truncated label, optional link, and attribute-only selection
1368
1374
  <fig-card src="photo.jpg" label="Shader pill" sublabel="Generative tools/effects" selected></fig-card>
1369
1375
  <fig-card src="photo.jpg" label="Open asset" href="#asset"></fig-card>
1370
1376
  <fig-card src="photo.jpg" label="Wide card" aspect-ratio="16/9" full></fig-card>
1377
+ <fig-card label="Custom preview">
1378
+ <fig-preview>...</fig-preview>
1379
+ </fig-card>
1371
1380
  ```
1372
1381
 
1382
+ When `src` is omitted, authored direct children such as `fig-image`, `fig-media`, or `fig-preview` remain direct children of the card.
1383
+
1373
1384
  Place cards in a CSS grid for multi-column layouts — there is no built-in columns attribute. Prefer `full` in fluid layouts for consistency with other FigUI controls.
1374
1385
 
1375
1386
  ---
package/components.css CHANGED
@@ -1153,7 +1153,8 @@ fig-tabs,
1153
1153
  .tabs {
1154
1154
  --fig-overflow-size: calc(var(--spacer-4) + var(--spacer-2));
1155
1155
  --fig-tabs-inline-padding: 0;
1156
- --fig-tabs-inline-margin: var(--spacer-2-5);
1156
+ --fig-tabs-margin-left: var(--spacer-1);
1157
+ --fig-tabs-margin-right: var(--spacer-2);
1157
1158
  box-sizing: border-box;
1158
1159
  display: flex;
1159
1160
  flex-direction: row;
@@ -1161,11 +1162,14 @@ fig-tabs,
1161
1162
  gap: var(--spacer-1);
1162
1163
  min-width: 0;
1163
1164
  overflow: auto hidden;
1164
- padding: var(--spacer-2) var(--fig-tabs-inline-padding);
1165
- margin: 0 var(--fig-tabs-inline-margin);
1165
+ padding: var(--spacer-2) 0;
1166
+ padding-inline: var(--fig-tabs-inline-padding);
1167
+ margin: 0;
1168
+ margin-left: var(--fig-tabs-margin-left);
1169
+ margin-right: var(--fig-tabs-margin-right);
1166
1170
  position: relative;
1167
1171
  scrollbar-width: none;
1168
- width: calc(100% - var(--fig-tabs-inline-margin) * 2);
1172
+ width: calc(100% - var(--fig-tabs-margin-left) - var(--fig-tabs-margin-right));
1169
1173
 
1170
1174
  > fig-tab {
1171
1175
  flex-shrink: 0;
@@ -1562,6 +1566,10 @@ fig-video {
1562
1566
  width: 100%;
1563
1567
  }
1564
1568
 
1569
+ &[aspect-ratio] {
1570
+ width: 100%;
1571
+ }
1572
+
1565
1573
  > fig-preview {
1566
1574
  --fig-preview-fit: var(--fig-media-fit);
1567
1575
  width: 100%;
@@ -3165,12 +3173,13 @@ fig-tooltip {
3165
3173
 
3166
3174
  fig-preview {
3167
3175
  --fig-preview-fit: contain;
3176
+ --fig-preview-background: var(--figma-color-bg-secondary);
3168
3177
 
3169
3178
  display: block;
3170
3179
  place-items: center;
3171
3180
  min-width: 0;
3172
3181
  max-width: 100%;
3173
- background-color: var(--figma-color-bg-secondary);
3182
+ background-color: var(--fig-preview-background);
3174
3183
  border-radius: var(--radius-medium);
3175
3184
  position: relative;
3176
3185
  overflow: hidden;
@@ -4992,7 +5001,9 @@ fig-chooser {
4992
5001
  fig-card {
4993
5002
  --fig-card-label-line-clamp: 1;
4994
5003
  --fig-card-media-radius: var(--radius-medium);
4995
- display: block;
5004
+ display: flex;
5005
+ flex-direction: column;
5006
+ gap: var(--spacer-1);
4996
5007
  width: 100%;
4997
5008
  min-width: 0;
4998
5009
 
@@ -5000,6 +5011,12 @@ fig-card {
5000
5011
  width: 100%;
5001
5012
  }
5002
5013
 
5014
+ &:is(:not([src]), [src=""]) {
5015
+ padding: var(--spacer-1);
5016
+ border-radius: 0.5625rem;
5017
+ box-sizing: border-box;
5018
+ }
5019
+
5003
5020
  .fig-card-link {
5004
5021
  display: flex;
5005
5022
  flex-direction: column;
@@ -5019,17 +5036,12 @@ fig-card {
5019
5036
  outline-offset: var(--figma-focus-outline-offset);
5020
5037
  }
5021
5038
 
5022
- .fig-card-media {
5023
- position: relative;
5024
- border-radius: var(--fig-card-media-radius);
5025
- background: var(--figma-color-bg-secondary);
5026
- overflow: hidden;
5027
- min-width: 0;
5028
- }
5029
-
5030
- .fig-card-media > fig-image,
5031
- .fig-card-media > fig-media,
5032
- .fig-card-media > fig-preview {
5039
+ .fig-card-link > fig-image,
5040
+ .fig-card-link > fig-media,
5041
+ .fig-card-link > fig-preview,
5042
+ &:is(:not([src]), [src=""]) > fig-image,
5043
+ &:is(:not([src]), [src=""]) > fig-media,
5044
+ &:is(:not([src]), [src=""]) > fig-preview {
5033
5045
  display: block;
5034
5046
  width: 100%;
5035
5047
  max-width: none;
@@ -5037,9 +5049,12 @@ fig-card {
5037
5049
  border-radius: var(--fig-card-media-radius);
5038
5050
  }
5039
5051
 
5040
- .fig-card-media > fig-image > fig-preview,
5041
- .fig-card-media > fig-media > fig-preview,
5042
- .fig-card-media > fig-preview {
5052
+ .fig-card-link > fig-image > fig-preview,
5053
+ .fig-card-link > fig-media > fig-preview,
5054
+ .fig-card-link > fig-preview,
5055
+ &:is(:not([src]), [src=""]) > fig-image > fig-preview,
5056
+ &:is(:not([src]), [src=""]) > fig-media > fig-preview,
5057
+ &:is(:not([src]), [src=""]) > fig-preview {
5043
5058
  width: 100%;
5044
5059
  max-width: none;
5045
5060
  border-radius: var(--fig-card-media-radius);
@@ -5092,24 +5107,39 @@ fig-card {
5092
5107
  &:hover:not([selected]:not([selected="false"])):not(
5093
5108
  [disabled]:not([disabled="false"])
5094
5109
  ):not([aria-disabled="true"])
5095
- .fig-card-link {
5110
+ .fig-card-link,
5111
+ &:is(:not([src]), [src=""]):hover:not(
5112
+ [selected]:not([selected="false"])
5113
+ ):not([disabled]:not([disabled="false"])):not([aria-disabled="true"]) {
5096
5114
  background: var(--figma-color-bg-secondary);
5097
5115
  }
5098
5116
 
5099
- &[selected]:not([selected="false"]) .fig-card-link {
5117
+ &[selected]:not([selected="false"]) .fig-card-link,
5118
+ &:is(:not([src]), [src=""])[selected]:not([selected="false"]) {
5100
5119
  background: var(--figma-color-bg-selected);
5101
5120
  }
5102
5121
 
5103
- &[selected]:not([selected="false"]) .fig-card-media {
5122
+ &[selected]:not([selected="false"])
5123
+ .fig-card-link
5124
+ > :is(fig-image, fig-media, fig-preview),
5125
+ &:is(:not([src]), [src=""])[selected]:not([selected="false"])
5126
+ > :is(fig-image, fig-media, fig-preview) {
5104
5127
  outline: var(--figma-focus-outline);
5105
5128
  outline-offset: var(--figma-focus-outline-offset);
5106
5129
  }
5107
5130
 
5108
5131
  &[selected]:not([selected="false"])
5109
- .fig-card-media
5132
+ .fig-card-link
5133
+ > :is(fig-image, fig-media)
5134
+ > fig-preview::after,
5135
+ &[selected]:not([selected="false"])
5136
+ .fig-card-link
5137
+ > fig-preview::after,
5138
+ &:is(:not([src]), [src=""])[selected]:not([selected="false"])
5110
5139
  > :is(fig-image, fig-media)
5111
5140
  > fig-preview::after,
5112
- &[selected]:not([selected="false"]) .fig-card-media > fig-preview::after {
5141
+ &:is(:not([src]), [src=""])[selected]:not([selected="false"])
5142
+ > fig-preview::after {
5113
5143
  box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
5114
5144
  }
5115
5145