@rogieking/figui3 6.32.1 → 6.33.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 CHANGED
@@ -1308,7 +1308,7 @@ A thin styled layer for arbitrary visual content. Use it for generated previews,
1308
1308
 
1309
1309
  | Attribute | Type | Default | Description |
1310
1310
  |---|---|---|---|
1311
- | `aspect-ratio` | string | `auto` | CSS aspect ratio such as `"1/1"` or `"16/9"` |
1311
+ | `aspect-ratio` | string | `"4/3"` | CSS aspect ratio such as `"1/1"` or `"16/9"` |
1312
1312
  | `fit` | string | `contain` | Object fit for direct media children |
1313
1313
  | `full` | boolean | `false` | Stretch to the available width |
1314
1314
  | `checkerboard` | boolean | `false` | Show checkerboard behind transparent content |
@@ -1339,6 +1339,7 @@ Unified media component that supports image/video modes and shared sizing/upload
1339
1339
  | `src` | string | — | Media URL |
1340
1340
  | `alt` | string | `""` | Alt text forwarded to the generated `<img>` (image mode) |
1341
1341
  | `upload` | boolean | `false` | Show upload overlay (`fig-input-file`) |
1342
+ | `loading-indicator` | boolean | `true` | Set to `"false"` to disable the delayed loading spinner for generated images |
1342
1343
  | `label` | string | `"Upload"` | Upload button label |
1343
1344
  | `size` | string | — | `small` \| `medium` \| `large` \| `auto` (token-sized square) |
1344
1345
  | `aspect-ratio` | string | — | CSS aspect-ratio (e.g. `"16 / 9"`); fills container width |
@@ -1365,6 +1366,10 @@ Use meaningful `alt` text for informative images. Use `alt=""` only when the ima
1365
1366
 
1366
1367
  Use the `caption` attribute for a plain-text caption, or a direct `<figcaption>` child for authored caption content.
1367
1368
 
1369
+ Native load lifecycle events are re-emitted from the `fig-media` host as bubbling, composed `CustomEvent`s. Image mode emits `load` and `error`. Video mode forwards `loadstart`, `progress`, `suspend`, `abort`, `error`, `emptied`, `stalled`, `loadedmetadata`, `loadeddata`, `canplay`, `canplaythrough`, `playing`, `waiting`, `seeking`, `seeked`, `durationchange`, `timeupdate`, `ratechange`, `resize`, and `volumechange`; existing `play`, `pause`, and `ended` events remain available. Event `detail` includes `src`, `media`, and `originalEvent`, plus video timing and readiness state.
1370
+
1371
+ For generated images, a spinner appears when loading exceeds 150ms and is removed on `load` or `error`. The host reflects `aria-busy="true"` while pending. Authored media or preview content does not receive an automatic spinner.
1372
+
1368
1373
  ---
1369
1374
 
1370
1375
  #### Image
@@ -1378,6 +1383,7 @@ An image display component with optional upload, aspect ratio, and object-fit co
1378
1383
  | `src` | string | — | Image URL |
1379
1384
  | `alt` | string | `""` | Alt text forwarded to the generated `<img>` |
1380
1385
  | `upload` | boolean | `false` | Show upload overlay (`fig-input-file`) |
1386
+ | `loading-indicator` | boolean | `true` | Set to `"false"` to disable the delayed loading spinner |
1381
1387
  | `label` | string | `"Upload"` | Upload button label |
1382
1388
  | `size` | string | — | `small` \| `medium` \| `large` \| `auto` (token-sized square) |
1383
1389
  | `aspect-ratio` | string | — | CSS aspect-ratio (e.g. `"16 / 9"`); fills container width |
@@ -1387,6 +1393,8 @@ An image display component with optional upload, aspect ratio, and object-fit co
1387
1393
 
1388
1394
  Use meaningful `alt` text for informative images. Use `alt=""` for decorative previews, thumbnails with visible labels, or upload placeholders.
1389
1395
 
1396
+ The generated image's native `load` and `error` events are re-emitted from `fig-image` as bubbling, composed `CustomEvent`s with `src`, `media`, and `originalEvent` in `event.detail`.
1397
+
1390
1398
  ```html
1391
1399
  <fig-image src="photo.jpg" alt="Selected image"></fig-image>
1392
1400
  <fig-image src="photo.jpg" alt="Cover image" aspect-ratio="16 / 9" fit="cover" caption="Cover image"></fig-image>
package/components.css CHANGED
@@ -133,7 +133,7 @@
133
133
  --figma-color-icon-onwarning-secondary: #00000080;
134
134
  --figma-color-icon-onwarning-tertiary: #0000004d;
135
135
  --figma-color-icon-pressed: light-dark(#007be5, #0a6dc2);
136
- --figma-color-icon-secondary: light-dark(#00000099, #ffffffcc);
136
+ --figma-color-icon-secondary: light-dark(#00000080, #ffffffb3);
137
137
  --figma-color-icon-secondary-hover: light-dark(#000000e5, #ffffff);
138
138
  --figma-color-icon-selected: light-dark(#007be5, #7cc4f8);
139
139
  --figma-color-icon-selected-secondary: light-dark(#007be5, #7cc4f8);
@@ -1226,6 +1226,7 @@ fig-avatar,
1226
1226
  contain: layout paint;
1227
1227
  --size: 1.5rem;
1228
1228
  width: var(--size);
1229
+ flex-shrink: 0;
1229
1230
  display: inline-grid;
1230
1231
  place-items: center;
1231
1232
  height: var(--size);
@@ -1608,6 +1609,13 @@ fig-video {
1608
1609
  z-index: 0;
1609
1610
  }
1610
1611
 
1612
+ > fig-spinner[slot="overlay"][data-loading-indicator][data-generated] {
1613
+ place-self: center;
1614
+ z-index: 1;
1615
+ opacity: 1;
1616
+ pointer-events: none;
1617
+ }
1618
+
1611
1619
  &:is(:not([src]), [src=""]):is(:not([poster]), [poster=""])
1612
1620
  > fig-preview > video.fig-media-element[data-generated] {
1613
1621
  opacity: 0;
@@ -1627,7 +1635,7 @@ fig-video {
1627
1635
  z-index: 2;
1628
1636
  max-width: calc(100% - var(--spacer-4));
1629
1637
  }
1630
- &:not(:has(> fig-preview > img.fig-media-element[data-generated][src]:not([src=""]))) > fig-preview > fig-input-file:is([data-generated], [variant="overlay"]),
1638
+ &:not(:has(> fig-preview > :is(img, video).fig-media-element[data-generated][src]:not([src=""]))) > fig-preview > fig-input-file:is([data-generated], [variant="overlay"]),
1631
1639
  > fig-preview:hover > fig-input-file:is([data-generated], [variant="overlay"]),
1632
1640
  > fig-preview:focus-within > fig-input-file:is([data-generated], [variant="overlay"]) {
1633
1641
  opacity: 1;
@@ -1642,7 +1650,7 @@ fig-video {
1642
1650
  max-width: calc(100% - var(--spacer-4));
1643
1651
  }
1644
1652
 
1645
- &:not(:has(> fig-preview > img.fig-media-element[data-generated][src]:not([src=""]))) > :is([slot="overlay"], fig-input-file[variant="overlay"]),
1653
+ &:not(:has(> fig-preview > :is(img, video).fig-media-element[data-generated][src]:not([src=""]))) > :is([slot="overlay"], fig-input-file[variant="overlay"]),
1646
1654
  &:has(> fig-preview:hover) > :is([slot="overlay"], fig-input-file[variant="overlay"]),
1647
1655
  &:has(> fig-preview:focus-within) > :is([slot="overlay"], fig-input-file[variant="overlay"]),
1648
1656
  &:has(> [slot="overlay"]:is(:focus, :focus-within, :active)) > [slot="overlay"],
@@ -3176,7 +3184,7 @@ fig-tooltip {
3176
3184
  fig-preview {
3177
3185
  --fig-preview-fit: contain;
3178
3186
  --fig-preview-background: var(--figma-color-bg-secondary);
3179
- --fig-preview-aspect-ratio: auto;
3187
+ --fig-preview-aspect-ratio: 4/3;
3180
3188
 
3181
3189
  display: block;
3182
3190
  aspect-ratio: var(--fig-preview-aspect-ratio);