@marianmeres/stuic 3.152.0 → 3.154.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/AGENTS.md +3 -0
- package/API.md +1 -0
- package/README.md +72 -0
- package/dist/components/FieldsBuilder/FieldsBuilder.svelte +1214 -0
- package/dist/components/FieldsBuilder/FieldsBuilder.svelte.d.ts +102 -0
- package/dist/components/FieldsBuilder/README.md +248 -0
- package/dist/components/FieldsBuilder/_internal/LocalizedTextInput.svelte +229 -0
- package/dist/components/FieldsBuilder/_internal/LocalizedTextInput.svelte.d.ts +30 -0
- package/dist/components/FieldsBuilder/_internal/OptionsEditor.svelte +296 -0
- package/dist/components/FieldsBuilder/_internal/OptionsEditor.svelte.d.ts +18 -0
- package/dist/components/FieldsBuilder/i18n-sk.d.ts +22 -0
- package/dist/components/FieldsBuilder/i18n-sk.js +81 -0
- package/dist/components/FieldsBuilder/i18n.d.ts +84 -0
- package/dist/components/FieldsBuilder/i18n.js +90 -0
- package/dist/components/FieldsBuilder/index.css +187 -0
- package/dist/components/FieldsBuilder/index.d.ts +5 -0
- package/dist/components/FieldsBuilder/index.js +4 -0
- package/dist/components/FieldsBuilder/types.d.ts +76 -0
- package/dist/components/FieldsBuilder/types.js +1 -0
- package/dist/components/FieldsBuilder/utils.d.ts +66 -0
- package/dist/components/FieldsBuilder/utils.js +153 -0
- package/dist/css/frame.css +109 -0
- package/dist/index.css +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/docs/RATIO_LOCKED_FRAME.md +466 -0
- package/docs/architecture.md +6 -0
- package/docs/domains/components.md +61 -1
- package/docs/domains/css-presets.md +304 -0
- package/docs/domains/theming.md +2 -0
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -28,6 +28,7 @@ src/lib/
|
|
|
28
28
|
├── attachments/ # Svelte attachments ({@attach} — preferred for new DOM helpers)
|
|
29
29
|
├── utils/ # 44 utility modules
|
|
30
30
|
├── icons/ # Icon re-exports from @marianmeres/icons-fns
|
|
31
|
+
├── css/ # CSS-only presets (ratio-locked frame / letterbox)
|
|
31
32
|
├── index.css # Centralized CSS imports
|
|
32
33
|
└── index.ts # Main exports
|
|
33
34
|
```
|
|
@@ -130,6 +131,7 @@ Global tokens that control cross-component visual properties. Defined in `src/li
|
|
|
130
131
|
|
|
131
132
|
- [Components](./docs/domains/components.md) — 63 component directories, Props pattern, snippets
|
|
132
133
|
- [Theming](./docs/domains/theming.md) — CSS tokens, dark mode, themes
|
|
134
|
+
- [CSS presets](./docs/domains/css-presets.md) — ratio-locked frame (letterbox), safe-area, scrollbar
|
|
133
135
|
- [Actions](./docs/domains/actions.md) — 15 Svelte directives
|
|
134
136
|
- [Attachments](./docs/domains/attachments.md) — `{@attach}` DOM helpers (preferred for new ones)
|
|
135
137
|
- [Utils](./docs/domains/utils.md) — 44 utility modules
|
|
@@ -138,6 +140,7 @@ Global tokens that control cross-component visual properties. Defined in `src/li
|
|
|
138
140
|
|
|
139
141
|
- [Design Tokens Manual](./docs/DESIGN_TOKENS_MANUAL.md) — Token philosophy
|
|
140
142
|
- [Tailwind v4 Variables](./docs/TAILWIND_V4_CSS_VARIABLES.md) — CSS variable reference
|
|
143
|
+
- [Ratio-Locked Frame](./docs/RATIO_LOCKED_FRAME.md) — Letterbox recipes + the measured gotcha list
|
|
141
144
|
|
|
142
145
|
---
|
|
143
146
|
|
package/API.md
CHANGED
|
@@ -2193,6 +2193,7 @@ Each component defines customization tokens. Override globally in `:root {}` or
|
|
|
2193
2193
|
| Cart | `--stuic-cart-*` | `gap`, `item-padding`, `item-radius`, `item-border-color`, `item-bg`, `thumbnail-size`, `quantity-border-color`, `remove-color`, `summary-border-color`, `compact-max-height`, `transition` |
|
|
2194
2194
|
| LoginForm | `--stuic-login-form-*` | `gap`, `gap-row`, `forgot-margin-y`, `forgot-margin-x`, `social-margin-top`, `social-gap`, `social-divider-color`, `social-divider-font-size`, `social-divider-margin-bottom` |
|
|
2195
2195
|
| Checkout | `--stuic-checkout-*` | `input-border`, `input-bg`, `input-focus-ring`, `input-radius`, `card-border`, `card-bg`, `card-radius`, `step-gap`, `progress-*`, `summary-*`, `guest-*`, `login-*`, `address-*`, `delivery-*`, `review-*`, `confirmation-*` |
|
|
2196
|
+
| Frame (CSS preset) | `--stuic-frame-*` | `aspect-ratio`, `width`, `height` — the ratio-locked frame / letterbox preset (see [CSS presets](docs/domains/css-presets.md)) |
|
|
2196
2197
|
|
|
2197
2198
|
### CSS Variable Naming Convention
|
|
2198
2199
|
|
package/README.md
CHANGED
|
@@ -248,6 +248,78 @@ All three are no-ops in a browser tab and need no prop.
|
|
|
248
248
|
|
|
249
249
|
**Not covered:** remaining fixed/edge-anchored components (e.g. `Float`, or a bare `ModalDialog` used directly) do not auto-handle insets — apply a `stuic-safe-area-*` class or the variables to their content as needed.
|
|
250
250
|
|
|
251
|
+
## Ratio-locked frame (letterbox)
|
|
252
|
+
|
|
253
|
+
Lock a box to an aspect ratio, size it to whichever axis binds first, centre it, and let the leftover space become letterboxing — a phone-proportioned column on a desktop, a portrait game board, a 16:9 scene nested under a header. The whole idea is one line:
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
width = min(available-width, available-height × ratio) /* aspect-ratio supplies the height */
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
That formula (plus two guards nobody remembers) is all stuic ships, because it is the only part Tailwind cannot express. The letterbox parent itself is plain utilities: `grid`, `overflow-hidden`, `fixed inset-0`, `bg-*`, and — where you need them — `contain-layout contain-paint`, `overflow-y-auto`, `@container-size`.
|
|
260
|
+
|
|
261
|
+
**Classes:**
|
|
262
|
+
|
|
263
|
+
- `.stuic-frame` — the ratio-locked box. Sized against the viewport (`100vw` / `100dvh`), centred with `margin: auto`, `overflow: hidden`.
|
|
264
|
+
- `.stuic-frame-cq` — the same box sized in container-query units, for a frame nested inside a layout rather than anchored to the window. Combine with `.stuic-frame`. **Requires** an ancestor with `container-type: size` (Tailwind `@container-size`); `inline-size` is not enough — `cqh` then falls through to the next container, or silently to the viewport, and you get a ratio-correct but wrongly-scaled frame that tracks the window as you resize.
|
|
265
|
+
- `.stuic-frame-col` — re-align a viewport-space element (a top-layer `<dialog>`, or an overlay portalled to `<body>`) onto the frame's column.
|
|
266
|
+
|
|
267
|
+
**Tokens** — all three are your inputs. stuic declares none of them anywhere; the defaults below live only as `var()` fallbacks at the usage sites, so a scoped override on the frame element or on any ancestor works:
|
|
268
|
+
|
|
269
|
+
| Token | Default | Meaning |
|
|
270
|
+
| ---------------------------- | ----------------------------------- | ---------------------------------------------------------------- |
|
|
271
|
+
| `--stuic-frame-aspect-ratio` | `1` | width ÷ height — anything `aspect-ratio:` accepts |
|
|
272
|
+
| `--stuic-frame-width` | `min(100vw, 100dvh × aspect-ratio)` | wholesale width override (bail-out value: `100vw`) |
|
|
273
|
+
| `--stuic-frame-height` | `auto` (⇒ ratio-locked) | wholesale height override (`100dvh` ⇒ fill height, derive width) |
|
|
274
|
+
|
|
275
|
+
**Viewport letterbox** — full screen, bars on exactly one axis:
|
|
276
|
+
|
|
277
|
+
```svelte
|
|
278
|
+
<div class="fixed inset-0 grid overflow-hidden bg-neutral-800">
|
|
279
|
+
<div
|
|
280
|
+
class="stuic-frame bg-[var(--stuic-color-surface)]"
|
|
281
|
+
style="--stuic-frame-aspect-ratio: 0.5"
|
|
282
|
+
>
|
|
283
|
+
…
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Nested frame** — sized against its parent box instead of the window:
|
|
289
|
+
|
|
290
|
+
```svelte
|
|
291
|
+
<div class="flex h-dvh flex-col">
|
|
292
|
+
<header>…</header>
|
|
293
|
+
<div class="@container-size grid min-h-0 grow overflow-hidden bg-neutral-800">
|
|
294
|
+
<div
|
|
295
|
+
class="stuic-frame stuic-frame-cq bg-[var(--stuic-color-surface)]"
|
|
296
|
+
style="--stuic-frame-aspect-ratio: calc(16 / 9)"
|
|
297
|
+
>
|
|
298
|
+
…
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
> ⚠️ **Don't reach for `max-width: 100%; max-height: 100%; aspect-ratio: R`** — the formulation everyone tries first. `max-*` never _grows_ a box, so in a centred grid/flex parent an empty frame measures **0×0**, and one with content shrink-wraps that content and overflows the parent. The ratio usually survives; the size is what's wrong.
|
|
305
|
+
|
|
306
|
+
> ⚠️ **Never make the frame both the fixed containing block and the scroll container.** `contain-layout contain-paint` together with `overflow-y-auto` on the same element demotes every `position: fixed` descendant to `absolute` against the scroll origin: at `scrollTop: 600` a `Drawer` and its backdrop render at `y = -600`, so the user taps and nothing appears — and `BodyScroll` cannot rescue it, because `document.body` has nothing to scroll in that layout. Scroll an inner element instead, or keep overlays in viewport space and reconcile them with `.stuic-frame-col`.
|
|
307
|
+
|
|
308
|
+
> ⚠️ **`--stuic-frame-height: 100dvh` is not ratio-locking.** An explicit height beats `aspect-ratio` unconditionally (which is exactly why the bail-out below needs no `!important`), so whenever `100vw < 100dvh × ratio` the frame degenerates to the raw viewport with zero bars on both axes. It looks perfect on a wide desktop and is wrong on the handset you were aiming at. Set it only inside a deliberate bail-out query, and gate that query on more than width:
|
|
309
|
+
|
|
310
|
+
```css
|
|
311
|
+
@media (max-width: 40rem) and (max-aspect-ratio: 3 / 5) {
|
|
312
|
+
:root {
|
|
313
|
+
--stuic-frame-width: 100vw;
|
|
314
|
+
--stuic-frame-height: 100dvh;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
See [CSS presets](docs/domains/css-presets.md) for the classes, the token contract and the decision tree, and [Ratio-Locked Frame](docs/RATIO_LOCKED_FRAME.md) for the full recipe set (including the unit-free `max-*` variant that _does_ work, given a positioned parent) and the measured gotcha list.
|
|
320
|
+
|
|
321
|
+
> **This preset does not make stuic's own overlays frame-aware.** `Backdrop`, `Modal`, `Drawer` and `Notifications` measure in viewport units — and top-layer geometry (`showModal()`, `popover`) ignores the frame outright, even for a DOM descendant of it. The portalled actions (`popover`, `spotlight`, `dimBehind`) additionally default to `document.body`, so they leave the frame entirely. Either way they fill the window, not the frame. Pass their `container` option where one exists, apply `.stuic-frame-col`, or tweak the affected call sites.
|
|
322
|
+
|
|
251
323
|
## TypeScript
|
|
252
324
|
|
|
253
325
|
All components export their Props types:
|