@rogieking/figui3 4.15.4 → 4.15.9

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
@@ -89,6 +89,7 @@ Minimal example:
89
89
  | [Tooltip](#tooltip) | `<fig-tooltip>` | Hover/click tooltip |
90
90
  | [Header](#header) | `<fig-header>` | Section header |
91
91
  | [Layer](#layer) | `<fig-layer>` | Collapsible layer list item |
92
+ | [Preview](#preview) | `<fig-preview>` | Thin visual preview layer |
92
93
  | [Media](#media) | `<fig-media>` | Shared media host for image/video |
93
94
  | [Image](#image) | `<fig-image>` | Image display/upload |
94
95
  | [Video](#video) | `<fig-video>` | Video display/upload with playback controls |
@@ -998,6 +999,29 @@ A collapsible layer list item with expand/collapse and visibility toggling. Supp
998
999
 
999
1000
  ---
1000
1001
 
1002
+ #### Preview
1003
+
1004
+ `<fig-preview>`
1005
+
1006
+ A thin styled layer for arbitrary visual content. Use it for generated previews, canvas output, SVG, images, or other custom rendered surfaces when you do not need media upload behavior.
1007
+
1008
+ | Attribute | Type | Default | Description |
1009
+ |---|---|---|---|
1010
+ | `full` | boolean | `false` | Stretch to the available width |
1011
+ | `checkerboard` | boolean | `false` | Show checkerboard behind transparent content |
1012
+
1013
+ ```html
1014
+ <fig-preview full style="height: 96px">
1015
+ <canvas width="320" height="180"></canvas>
1016
+ </fig-preview>
1017
+
1018
+ <fig-preview checkerboard>
1019
+ <img src="photo.png" alt="Preview">
1020
+ </fig-preview>
1021
+ ```
1022
+
1023
+ ---
1024
+
1001
1025
  #### Media
1002
1026
 
1003
1027
  `<fig-media>`
package/base.css CHANGED
@@ -104,6 +104,9 @@ p {
104
104
  margin: var(--spacer-2) 0;
105
105
  line-height: 1rem;
106
106
  color: var(--figma-color-text-secondary);
107
+ &:last-child{
108
+ margin-bottom: 0;
109
+ }
107
110
  }
108
111
 
109
112
  label {
@@ -114,3 +117,11 @@ h2 {
114
117
  font-weight: var(--body-medium-strong-fontWeight);
115
118
  margin: var(--spacer-2) 0;
116
119
  }
120
+
121
+ a{
122
+ color: var(--figma-color-text-brand);
123
+ text-decoration: none;
124
+ &:hover{
125
+ text-decoration: underline;
126
+ }
127
+ }
package/components.css CHANGED
@@ -2762,14 +2762,6 @@ dialog,
2762
2762
  overscroll-behavior: contain;
2763
2763
  }
2764
2764
 
2765
- footer,
2766
- fig-footer {
2767
- display: flex;
2768
- justify-content: flex-end;
2769
- padding: var(--spacer-2);
2770
- gap: var(--spacer-2);
2771
- }
2772
-
2773
2765
  p {
2774
2766
  padding: 0 var(--spacer-3);
2775
2767
  }
@@ -3028,10 +3020,6 @@ dialog[is="fig-toast"] {
3028
3020
  background-color: var(--figma-color-bg-success);
3029
3021
  color-scheme: dark;
3030
3022
  }
3031
-
3032
- &[theme="auto"] {
3033
- /* color-scheme is resolved at runtime by FigToast JS */
3034
- }
3035
3023
  }
3036
3024
 
3037
3025
 
@@ -3040,6 +3028,55 @@ dialog[is="fig-toast"] {
3040
3028
  fig-tooltip {
3041
3029
  display: contents;
3042
3030
  }
3031
+
3032
+ fig-preview {
3033
+ --fig-preview-fit: contain;
3034
+
3035
+ display: inline-grid;
3036
+ place-items: center;
3037
+ min-width: 0;
3038
+ max-width: 100%;
3039
+ background-color: var(--figma-color-bg-secondary);
3040
+ border-radius: var(--radius-medium);
3041
+ position: relative;
3042
+
3043
+ &[full]:not([full="false"]) {
3044
+ width: 100%;
3045
+ }
3046
+
3047
+ &[checkerboard]:not([checkerboard="false"]) {
3048
+ background: var(--checkerboard);
3049
+ }
3050
+
3051
+ &::after {
3052
+ content: "";
3053
+ grid-area: 1/1;
3054
+ place-self: stretch;
3055
+ border-radius: inherit;
3056
+ box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
3057
+ pointer-events: none;
3058
+ z-index: 2;
3059
+ }
3060
+
3061
+ > * {
3062
+ grid-area: 1/1;
3063
+ min-width: 0;
3064
+ min-height: 0;
3065
+ }
3066
+
3067
+ > :is(img, video, canvas, svg) {
3068
+ display: block;
3069
+ max-width: 100%;
3070
+ max-height: 100%;
3071
+ object-fit: var(--fig-preview-fit);
3072
+ object-position: center;
3073
+ border-radius: 0;
3074
+ }
3075
+ > canvas{
3076
+ border-radius: inherit;
3077
+ }
3078
+ }
3079
+
3043
3080
  /* Web Components */
3044
3081
  fig-button,
3045
3082
  fig-content,
@@ -3171,11 +3208,10 @@ fig-group {
3171
3208
 
3172
3209
  fig-footer {
3173
3210
  display: flex;
3174
- align-items: center;
3211
+ align-items: flex-start;
3175
3212
  justify-content: flex-end;
3176
3213
  gap: var(--spacer-2);
3177
- height: var(--spacer-6);
3178
- padding: var(--spacer-1) var(--spacer-2) var(--spacer-1) var(--spacer-3);
3214
+ padding: var(--spacer-2-5) var(--spacer-3);
3179
3215
  box-shadow: inset 0 1px 0 0 var(--figma-color-border);
3180
3216
 
3181
3217
  & h3 {
@@ -3186,6 +3222,19 @@ fig-footer {
3186
3222
  gap: var(--spacer-half);
3187
3223
  }
3188
3224
 
3225
+ & > label {
3226
+ flex-grow: 1;
3227
+ align-items: baseline;
3228
+ gap: var(--spacer-half);
3229
+ min-height: var(--spacer-4);
3230
+ display: flex;
3231
+ align-items: center;
3232
+ }
3233
+
3234
+ & > fig-button{
3235
+ flex-shrink: 0;
3236
+ }
3237
+
3189
3238
  &[borderless] {
3190
3239
  box-shadow: none;
3191
3240
  }
@@ -3202,6 +3251,11 @@ fig-footer {
3202
3251
  fig-content {
3203
3252
  padding: var(--spacer-2) 0;
3204
3253
  display: block;
3254
+
3255
+ p{
3256
+ margin: 0 0 var(--spacer-2) 0;
3257
+ padding: 0 var(--spacer-3);
3258
+ }
3205
3259
  }
3206
3260
 
3207
3261
  vstack,
@@ -3215,12 +3269,24 @@ vstack,
3215
3269
  }
3216
3270
 
3217
3271
  hstack,
3218
- .hstack,
3219
- [hstack] {
3272
+ .hstack{
3220
3273
  display: flex;
3221
- gap: var(--spacer-2);
3222
- align-items: start;
3223
- flex-wrap: nowrap;
3274
+ gap: var(--hstack-gap, var(--spacer-2));
3275
+ align-items: var(--hstack-align, center);
3276
+ justify-content: var(--hstack-justify, flex-start);
3277
+ flex-wrap: var(--hstack-wrap, nowrap);
3278
+
3279
+ &[align="start"] {
3280
+ --hstack-align: flex-start;
3281
+ }
3282
+
3283
+ &[align="end"] {
3284
+ --hstack-align: flex-end;
3285
+ }
3286
+
3287
+ &[align="stretch"] {
3288
+ --hstack-align: stretch;
3289
+ }
3224
3290
  }
3225
3291
 
3226
3292
  fig-input-text,
@@ -3671,11 +3737,6 @@ fig-field {
3671
3737
  margin-right: var(--fig-field-gap);
3672
3738
  min-width: 0;
3673
3739
  }
3674
- /* If the field has no label, set the input ratio to 1fr */
3675
- &:not(:has(> label)) {
3676
- /*--fig-field-input-ratio: 1fr;
3677
- --fig-field-label-ratio: 0fr;*/
3678
- }
3679
3740
  /* labelless fields can have a few inputs */
3680
3741
  &:not(:has(> label)) {
3681
3742
  grid-template-columns:
@@ -4340,33 +4401,6 @@ fig-fill-picker {
4340
4401
  }
4341
4402
  }
4342
4403
 
4343
- fig-preview {
4344
- display: inline-grid;
4345
- place-items: center;
4346
- aspect-ratio: 1;
4347
- width: calc(100% - var(--spacer-3) * 2);
4348
- margin: 0 var(--spacer-3);
4349
- margin-top: var(--spacer-2);
4350
- margin-bottom: var(--spacer-2);
4351
- border-radius: var(--radius-medium);
4352
- position: relative;
4353
- &::before,
4354
- &::after,
4355
- > * {
4356
- grid-area: 1/1;
4357
- place-self: center;
4358
- width: 100%;
4359
- height: 100%;
4360
- border-radius: inherit;
4361
- }
4362
- &::after {
4363
- content: "";
4364
- grid-area: 1/1;
4365
- place-self: center;
4366
- box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
4367
- }
4368
- }
4369
-
4370
4404
  .fig-fill-picker-dialog {
4371
4405
  contain: layout;
4372
4406
  width: 240px;
@@ -4406,6 +4440,17 @@ fig-preview {
4406
4440
  }
4407
4441
 
4408
4442
  .fig-fill-picker-color-area {
4443
+ aspect-ratio: 1;
4444
+ width: calc(100% - var(--spacer-3) * 2);
4445
+ margin: var(--spacer-2) var(--spacer-3);
4446
+
4447
+ > *:not(fig-handle) {
4448
+ place-self: center;
4449
+ width: 100%;
4450
+ height: 100%;
4451
+ border-radius: inherit;
4452
+ }
4453
+
4409
4454
  canvas {
4410
4455
  width: 100%;
4411
4456
  height: 100%;
@@ -4461,6 +4506,14 @@ fig-preview {
4461
4506
  }
4462
4507
 
4463
4508
  /* Gradient Tab */
4509
+ .fig-fill-picker-gradient-preview {
4510
+ aspect-ratio: auto;
4511
+ width: calc(100% - var(--spacer-3) * 2);
4512
+ margin: var(--spacer-2) var(--spacer-3);
4513
+ margin-top: var(--spacer-4);
4514
+ background: transparent;
4515
+ }
4516
+
4464
4517
  .fig-fill-picker-gradient-header {
4465
4518
  padding-right: var(--spacer-2);
4466
4519
  display: flex;
@@ -4482,12 +4535,6 @@ fig-preview {
4482
4535
  }
4483
4536
  }
4484
4537
 
4485
- .fig-fill-picker-gradient-preview {
4486
- aspect-ratio: auto;
4487
- padding: var(--spacer-2-5) 0 0 0;
4488
-
4489
- }
4490
-
4491
4538
  .fig-fill-picker-gradient-stops {
4492
4539
  .fig-fill-picker-gradient-stops-header {
4493
4540
  > span {
@@ -4597,7 +4644,7 @@ fig-preview {
4597
4644
  -8px 0px;
4598
4645
  }
4599
4646
 
4600
- .fig-fill-picker-image-preview {
4647
+ div.fig-fill-picker-image-preview {
4601
4648
  position: absolute;
4602
4649
  inset: 0;
4603
4650
  width: 100%;
@@ -4605,7 +4652,13 @@ fig-preview {
4605
4652
  display: none;
4606
4653
  }
4607
4654
 
4608
- .fig-fill-picker-video-preview {
4655
+ fig-image.fig-fill-picker-image-preview {
4656
+ max-width: none;
4657
+ max-height: none;
4658
+ width: auto;
4659
+ }
4660
+
4661
+ video.fig-fill-picker-video-preview {
4609
4662
  position: absolute;
4610
4663
  inset: 0;
4611
4664
  width: 100%;
@@ -4614,6 +4667,12 @@ fig-preview {
4614
4667
  display: none;
4615
4668
  }
4616
4669
 
4670
+ fig-media.fig-fill-picker-video-preview {
4671
+ max-width: none;
4672
+ max-height: none;
4673
+ width: auto;
4674
+ }
4675
+
4617
4676
  .fig-fill-picker-upload {
4618
4677
  position: relative;
4619
4678
  z-index: 1;
package/dist/base.css CHANGED
@@ -1 +1 @@
1
- html,:host{width:100%;height:100%;color:var(--figma-color-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:var(--font-family);font-size:16px;font-weight:var(--body-medium-fontWeight);letter-spacing:var(--body-letter-spacing);background-color:var(--figma-color-bg);margin:0;padding:0}body,:host{font-size:var(--body-medium-fontSize);letter-spacing:var(--body-letter-spacing)}h1,h2{font-weight:var(--body-large-strong-fontWeight);font-size:var(--body-large-fontSize)}h3{font-weight:var(--body-medium-strong-fontWeight);font-size:var(--body-medium-fontSize)}hr{background-color:var(--figma-color-border);width:100%;height:1px;margin:var(--spacer-2) 0;border:none;&[vertical]{width:1px;height:100%;margin:0 var(--spacer-2)}}iframe{background-color:#0000;border:0;flex:auto;width:100%;max-width:100%;height:max-content;min-height:0;max-height:100%;margin:0;display:block}*,:before,:after{box-sizing:border-box}::selection{background-color:var(--figma-color-text-selection)}::selection{background-color:var(--figma-color-text-selection)}::-webkit-scrollbar{width:var(--spacer-1);height:var(--spacer-1)}::-webkit-scrollbar-thumb{background-color:var(--figma-color-bg-tertiary);border-radius:calc(var(--spacer-1) / 2)}::-webkit-scrollbar-thumb:hover{background-color:var(--figma-color-bg-secondary)}*{scrollbar-width:thin;scrollbar-color:var(--figma-color-bg-tertiary) var(--figma-color-bg-secondary)}.subtle{color:var(--figma-color-text-tertiary)}p{margin:var(--spacer-2) 0;color:var(--figma-color-text-secondary);line-height:1rem}label{color:var(--figma-color-text-secondary)}h2{font-weight:var(--body-medium-strong-fontWeight);margin:var(--spacer-2) 0}
1
+ html,:host{width:100%;height:100%;color:var(--figma-color-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:var(--font-family);font-size:16px;font-weight:var(--body-medium-fontWeight);letter-spacing:var(--body-letter-spacing);background-color:var(--figma-color-bg);margin:0;padding:0}body,:host{font-size:var(--body-medium-fontSize);letter-spacing:var(--body-letter-spacing)}h1,h2{font-weight:var(--body-large-strong-fontWeight);font-size:var(--body-large-fontSize)}h3{font-weight:var(--body-medium-strong-fontWeight);font-size:var(--body-medium-fontSize)}hr{background-color:var(--figma-color-border);width:100%;height:1px;margin:var(--spacer-2) 0;border:none;&[vertical]{width:1px;height:100%;margin:0 var(--spacer-2)}}iframe{background-color:#0000;border:0;flex:auto;width:100%;max-width:100%;height:max-content;min-height:0;max-height:100%;margin:0;display:block}*,:before,:after{box-sizing:border-box}::selection{background-color:var(--figma-color-text-selection)}::selection{background-color:var(--figma-color-text-selection)}::-webkit-scrollbar{width:var(--spacer-1);height:var(--spacer-1)}::-webkit-scrollbar-thumb{background-color:var(--figma-color-bg-tertiary);border-radius:calc(var(--spacer-1) / 2)}::-webkit-scrollbar-thumb:hover{background-color:var(--figma-color-bg-secondary)}*{scrollbar-width:thin;scrollbar-color:var(--figma-color-bg-tertiary) var(--figma-color-bg-secondary)}.subtle{color:var(--figma-color-text-tertiary)}p{margin:var(--spacer-2) 0;color:var(--figma-color-text-secondary);line-height:1rem;&:last-child{margin-bottom:0}}label{color:var(--figma-color-text-secondary)}h2{font-weight:var(--body-medium-strong-fontWeight);margin:var(--spacer-2) 0}a{color:var(--figma-color-text-brand);text-decoration:none;&:hover{text-decoration:underline}}