@tansy/theme-storefront 0.1.0 → 0.1.1

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/styles.css CHANGED
@@ -159,6 +159,159 @@ body:has(.site-root[data-theme="storefront"]) { margin: 0; }
159
159
  .sf-prose :where(hr) { border: 0; border-top: 1px solid var(--site-color-border); }
160
160
  }
161
161
 
162
+ /* ------------------------------------------------- feeling like an app */
163
+
164
+ /*
165
+ * Touch: no grey flash on tap, no wait for a double tap, and things that answer a press by
166
+ * giving way a little. Rows that scroll sideways snap and keep the page from moving with them.
167
+ */
168
+ .sf-shell { -webkit-tap-highlight-color: transparent; }
169
+ .sf-shell :where(a, button, summary, label, input, select) { touch-action: manipulation; }
170
+ .sf-shell :where(.sf-press, .sf-tab) { transition-property: transform, color; transition-duration: 0.15s; }
171
+ .sf-shell :where(.sf-press, .sf-tab):active { transform: scale(0.97); }
172
+ .sf-chips, .sf-track { scrollbar-width: none; overscroll-behavior-x: contain; }
173
+ /* A back arrow returns to a list at a product's card: it lands a third of the way down, not under the header. */
174
+ .sf-card { scroll-margin-block: 30dvh; }
175
+ .sf-chips::-webkit-scrollbar, .sf-track::-webkit-scrollbar { display: none; }
176
+ .sf-chips { scroll-snap-type: x proximity; }
177
+ .sf-chips > ul > li, .sf-chips > li { scroll-snap-align: start; scroll-margin-inline: var(--site-space-gutter); }
178
+ .sf-track { -webkit-overflow-scrolling: touch; }
179
+
180
+ /* The tab bar's own count, over its icon rather than in the corner of the tab. */
181
+ .sf-tabbar .shop-count { inset-block-start: 0.25rem; inset-inline-end: calc(50% - 1.5rem); }
182
+ .sf-tabbar { padding-bottom: env(safe-area-inset-bottom); }
183
+ /* The cart's tab is the shop's CartLink, which takes no aria-current, so the cart page marks it here. */
184
+ .sf-shell[data-page="shop-cart"] .sf-tab-cart { color: var(--site-color-accent); }
185
+ /* Its frosted glass is a layer behind it: backdrop-filter on the bar itself would pin the menu sheet, which is fixed, to the bar instead of the screen. */
186
+ .sf-tabbar::before {
187
+ content: "";
188
+ position: absolute;
189
+ inset: 0;
190
+ z-index: -1;
191
+ background: color-mix(in srgb, var(--site-color-page) 85%, transparent);
192
+ -webkit-backdrop-filter: blur(24px);
193
+ backdrop-filter: blur(24px);
194
+ }
195
+
196
+ /* The dot under the current tab, which slides between tabs as pages change. */
197
+ .sf-tab-dot {
198
+ position: absolute;
199
+ inset-block-end: 0.2rem;
200
+ inset-inline-start: calc(50% - 0.6rem);
201
+ width: 1.2rem;
202
+ height: 0.2rem;
203
+ border-radius: 999px;
204
+ background: var(--site-color-accent);
205
+ }
206
+
207
+ /* A product's picture zoomed to fill the screen, over a frosted page. */
208
+ .sf-zoom {
209
+ background: color-mix(in srgb, var(--site-color-page) 92%, transparent);
210
+ -webkit-backdrop-filter: blur(20px);
211
+ backdrop-filter: blur(20px);
212
+ touch-action: pinch-zoom;
213
+ }
214
+
215
+ /* Payments' Subscribe and Billing buttons, in the theme's shape. */
216
+ .sf-shell .sf-plan-action .payments-button {
217
+ width: 100%;
218
+ height: 3.25rem;
219
+ border: 0;
220
+ border-radius: 999px;
221
+ background: var(--site-color-accent);
222
+ color: var(--site-color-on-accent);
223
+ font-weight: 600;
224
+ cursor: pointer;
225
+ transition: filter 0.15s, transform 0.15s;
226
+ }
227
+ .sf-shell .sf-plan-action .payments-button:hover { filter: brightness(1.1); }
228
+ .sf-shell .sf-plan-action .payments-button:active { transform: scale(0.98); }
229
+ .sf-shell .sf-plan-action .payments-error { margin-top: 0.5rem; font-size: 0.875rem; color: var(--site-color-muted); }
230
+
231
+ /* The menu as a sheet that rises from the bottom, over a dimmed page. Tapping the page closes it. */
232
+ .sf-sheet > summary::before {
233
+ content: "";
234
+ position: fixed;
235
+ inset: 0;
236
+ z-index: 45;
237
+ background: rgb(0 0 0 / 0.35);
238
+ opacity: 0;
239
+ pointer-events: none;
240
+ transition: opacity 0.25s;
241
+ }
242
+ .sf-sheet[open] > summary::before { opacity: 1; pointer-events: auto; }
243
+ .sf-sheet-panel { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
244
+ .sf-sheet[open] > .sf-sheet-panel { animation: sf-sheet-up 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
245
+ .sf-sheet-panel a { padding-block: 0.875rem; font-size: 1.0625rem; }
246
+ @keyframes sf-sheet-up { from { transform: translateY(100%); } }
247
+
248
+ @media (max-width: 63.99rem) {
249
+ /* Room at the bottom for the tab bar, so nothing sits under it. */
250
+ .sf-shell { padding-bottom: calc(4.25rem + env(safe-area-inset-bottom)); }
251
+ /* The cart is in the tab bar, except on a product page, which has no tab bar, as a pushed screen in an app has none. */
252
+ .sf-shell:not([data-page="shop-products"]) .sf-header-cart { display: none; }
253
+ .sf-shell[data-page="shop-products"] .sf-tabbar { display: none; }
254
+ /* A product's buttons pinned to the bottom of the screen instead. */
255
+ .sf-shell[data-page="shop-products"] { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
256
+ .sf-buybar {
257
+ position: fixed;
258
+ inset-inline: 0;
259
+ inset-block-end: 0;
260
+ z-index: 40;
261
+ padding: 0.75rem var(--site-space-gutter) calc(0.75rem + env(safe-area-inset-bottom));
262
+ border-top: 1px solid color-mix(in srgb, var(--site-color-border) 70%, transparent);
263
+ background: color-mix(in srgb, var(--site-color-page) 88%, transparent);
264
+ -webkit-backdrop-filter: blur(24px);
265
+ backdrop-filter: blur(24px);
266
+ }
267
+ .sf-shell footer { margin-top: 4rem; }
268
+ }
269
+
270
+ /*
271
+ * Moving between pages. The layout switches cross-document view transitions on (render.tsx);
272
+ * these say how they look. Each starts at html:has(.sf-shell), so they apply only to this
273
+ * theme's pages. The header and tab bar hold still while the page beneath them changes, a
274
+ * product's picture flies between its card and its page, and the bars that come and go slide.
275
+ */
276
+ @media (prefers-reduced-motion: no-preference) {
277
+ html:has(.sf-shell)::view-transition-old(root) { animation: 160ms cubic-bezier(0.4, 0, 1, 1) both sf-page-out; }
278
+ html:has(.sf-shell)::view-transition-new(root) { animation: 340ms cubic-bezier(0.2, 0.8, 0.2, 1) both sf-page-in; }
279
+ /* The picture flies above everything else, so it never passes under the header or a bar. */
280
+ html:has(.sf-shell)::view-transition-group(*.sf-product) { z-index: 10; animation-duration: 460ms; animation-timing-function: cubic-bezier(0.2, 0.9, 0.1, 1); }
281
+ /* The chosen category chip and the tab dot slide to their new place. */
282
+ html:has(.sf-shell)::view-transition-group(sf-chip),
283
+ html:has(.sf-shell)::view-transition-group(sf-tab-dot) { animation-duration: 380ms; animation-timing-function: cubic-bezier(0.3, 1.25, 0.4, 1); }
284
+ html:has(.sf-shell)::view-transition-old(*.sf-product),
285
+ html:has(.sf-shell)::view-transition-new(*.sf-product) { height: 100%; object-fit: contain; }
286
+ html:has(.sf-shell)::view-transition-new(sf-tabbar):only-child,
287
+ html:has(.sf-shell)::view-transition-new(sf-buybar):only-child { animation: 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both sf-bar-in; }
288
+ html:has(.sf-shell)::view-transition-old(sf-tabbar):only-child,
289
+ html:has(.sf-shell)::view-transition-old(sf-buybar):only-child { animation: 200ms ease-in both sf-bar-out; }
290
+
291
+ /*
292
+ * Zooming a picture on its page (a same-document transition of type sf-zoom): the page beneath
293
+ * only crossfades to the frosted backdrop, and nothing else takes part, so no named header, bar
294
+ * or other product paints over the backdrop while the picture grows.
295
+ */
296
+ html:active-view-transition-type(sf-zoom)::view-transition-old(root) { animation: 260ms ease both sf-fade-out; }
297
+ html:active-view-transition-type(sf-zoom)::view-transition-new(root) { animation: 260ms ease both sf-fade-in; }
298
+ html:active-view-transition-type(sf-zoom) :is(.sf-header, .sf-tabbar, .sf-buybar, .sf-vt-product:not(.sf-zoom-target)) { view-transition-name: none !important; }
299
+ html:active-view-transition-type(sf-zoom)::view-transition-group(*) { animation-duration: 380ms; animation-timing-function: cubic-bezier(0.2, 0.9, 0.1, 1); }
300
+
301
+ .sf-header { view-transition-name: sf-header; }
302
+ .sf-vt-product { view-transition-class: sf-product; }
303
+ @media (max-width: 63.99rem) {
304
+ .sf-tabbar { view-transition-name: sf-tabbar; }
305
+ .sf-buybar { view-transition-name: sf-buybar; }
306
+ }
307
+ }
308
+ @keyframes sf-page-out { to { opacity: 0; transform: scale(0.985); } }
309
+ @keyframes sf-page-in { from { opacity: 0; transform: translateY(1.25rem); } }
310
+ @keyframes sf-fade-out { to { opacity: 0; } }
311
+ @keyframes sf-fade-in { from { opacity: 0; } }
312
+ @keyframes sf-bar-in { from { transform: translateY(100%); } }
313
+ @keyframes sf-bar-out { to { transform: translateY(100%); } }
314
+
162
315
  /* ------------------------------------------------------- the shop's parts */
163
316
 
164
317
  /*