feat(user-apps): appearance settings (dark mode + reduced motion), product morph, filter sheet
Applies to both user-app and user-app-v2. Logic and structure are shared; each app keeps its own look. Appearance settings - New "تنظیمات ظاهری" page (/settings/appearance), opened from the dashboard and available without login. It offers a light/dark/system theme and a "fast & light" motion switch. - appearanceStore saves the choice to localStorage. A small inline boot script in index.html applies it before first paint so there is no white flash. The "system" option follows OS changes live. - New ToggleSwitch component. Dark mode - Theme LESS tokens now compile to CSS custom properties. Light/dark values come from a generated virtual:palette.css (themeConfig/ appearance.ts, with colors.json + new colors.dark.json). - New LESS alpha() plugin replaces fade() on theme tokens. - New semantic tokens: page, onInk, heroSurface, hairlineStrong, photoMat, photoStage. - The dark palette is layered (page < card < panel < border) so surfaces separate without shadows. - Hard-coded colors were replaced by tokens according to their role. - antd inputs/text get dark overrides; vant uses its own .van-theme-dark. - Light mode looks the same as before. Reduced motion - With html.motion-reduced, transitions are capped at 120ms, keyframe loops stop, and backdrop blurs and permanent will-change are dropped. - Spinners and the toast progress bar (which closes the toast) are exempt via .keep-motion. - Carousel autoplay, the v1 Lottie and the product morph honor the setting. Product detail - Opening a product is now a container-transform morph from the tapped card (ProductMorph). It replaces the bottom Drawer and uses composited transform/opacity only. - The detail view is seeded with the card's data, so it no longer opens blank and jumps. Filters and sheets - Filters are now a full-width bottom sheet. Selections stay a draft until applied, so the result list no longer re-renders while dragging the slider. - DropDown collapse animates grid-template-rows instead of a capped max-height. - v2 IslandSheet is restyled to the v2 design language (API unchanged). Fixes - filtersStore.reset() shallow-copied shared arrays, so clearing the filters never cleared the selected brands.
This commit is contained in:
@@ -1,14 +1,26 @@
|
||||
<!--
|
||||
Floating "island" action sheet: the app's confirm/notice modal.
|
||||
The app's confirm/notice action sheet (logout, place order, sign in, update,
|
||||
done).
|
||||
|
||||
Replaces DialogVant / DialogVantOneButton (centered Vant dialogs whose
|
||||
content was poured into img/title/button slots). The sheet rises from the
|
||||
bottom but stays inset from the screen edges with rounded corners all
|
||||
round, the same island shape as the ant-Drawer `island-sheet` in
|
||||
style.less, so the two kinds of sheet read as one family.
|
||||
content was poured into img/title/button slots).
|
||||
|
||||
Structured props instead of slots for the buttons, so every call site gets
|
||||
the same button styling without passing its own markup and color classes:
|
||||
RESTYLED into user-app-v2's own design language. It used to be a floating
|
||||
island inset from the screen edges, with a tinted dot-grid header, dashed
|
||||
rings, twinkling sparks, gradient buttons with a sheen and a per-sheet
|
||||
colour (navy / gold / green) — none of which appears anywhere else in this
|
||||
app. It now uses the same parts as the rest of v2:
|
||||
- a white sheet attached to the bottom edge, with the 32px top radius and
|
||||
grip of the product detail sheet and the search filter sheet;
|
||||
- the illustration centred on a borderless @hairlineSoft panel — the
|
||||
ProductPanel / catalogue-card treatment of a piece of jewellery;
|
||||
- a centred title and description under it, as on those cards;
|
||||
- the detail page's action bar: an outlined pill beside a filled pill.
|
||||
The filled pill is @ink, or @wine for the destructive tone (logout).
|
||||
The component name, props, events and illustrations are unchanged, so no
|
||||
call site had to change.
|
||||
|
||||
Usage:
|
||||
|
||||
<IslandSheet
|
||||
v-model:show="open"
|
||||
@@ -21,18 +33,18 @@
|
||||
/>
|
||||
|
||||
- `art` picks an illustration from SheetArt, and with it the sheet's tone
|
||||
(header wash + primary button); `tone` overrides it. An `#art` slot can
|
||||
(the filled button's colour); `tone` overrides it. An `#art` slot can
|
||||
replace the illustration entirely.
|
||||
- No `cancel-text` → a single-button sheet.
|
||||
- No `cancel-text` → a single, full-width button.
|
||||
- `closeOnClickOverlay` (default true) also governs swipe-down-to-dismiss;
|
||||
with it off the sheet can only be left through its own buttons, and a
|
||||
swipe just rubber-bands. No close (×) button: cancel, the backdrop and
|
||||
the swipe already cover it.
|
||||
- Performance: every decorative animation is held paused until the slide-in
|
||||
has finished (`is-ready`, set on Vant's `opened`), so the slide has the
|
||||
frame budget to itself; the content arrives as one piece, not staggered,
|
||||
and nothing uses backdrop-filter (blurring the page behind a fading
|
||||
overlay recomputes every frame and was the main source of jank on phones).
|
||||
- Performance: the illustration's own animations are held paused until the
|
||||
slide-in has finished (`is-ready`, set on Vant's `opened`), so the slide has
|
||||
the frame budget to itself; nothing uses backdrop-filter (blurring the page
|
||||
behind a fading overlay recomputes every frame and was the main source of
|
||||
jank on phones).
|
||||
- Cancel closes the sheet itself and emits `cancel`; confirm only emits
|
||||
`confirm` — the caller decides whether it closes (e.g. a redirect).
|
||||
-->
|
||||
@@ -50,11 +62,10 @@
|
||||
@update:show="emit('update:show', $event)"
|
||||
@opened="ready = true"
|
||||
@closed="onClosed"
|
||||
@click="onGapClick"
|
||||
>
|
||||
<div
|
||||
class="iSheet__card"
|
||||
:class="[`iSheet--${resolvedTone}`, { 'is-dragging': dragging, 'is-ready': ready }]"
|
||||
:class="[`iSheet--${resolvedTone}`, { 'is-dragging': dragging, 'is-ready': ready, 'is-single': !cancelText }]"
|
||||
:style="cardStyle"
|
||||
dir="rtl"
|
||||
role="dialog"
|
||||
@@ -64,11 +75,9 @@
|
||||
@touchend="onTouchEnd"
|
||||
@touchcancel="onTouchEnd"
|
||||
>
|
||||
<div class="iSheet__stage">
|
||||
<span class="iSheet__handle" />
|
||||
<span class="iSheet__ring iSheet__ring--outer" />
|
||||
<span class="iSheet__ring iSheet__ring--inner" />
|
||||
<span v-for="n in 4" :key="n" class="iSheet__spark" :class="`iSheet__spark--${n}`" />
|
||||
<span class="iSheet__grip" aria-hidden="true"></span>
|
||||
|
||||
<div class="iSheet__panel">
|
||||
<div class="iSheet__art">
|
||||
<slot name="art">
|
||||
<SheetArt v-if="art" :name="art" />
|
||||
@@ -79,13 +88,15 @@
|
||||
<h3 class="iSheet__title">{{ title }}</h3>
|
||||
<p v-if="description" class="iSheet__desc">{{ description }}</p>
|
||||
|
||||
<!-- The detail page's bar order: the secondary pill first in markup, so
|
||||
RTL lays it on the right, and the filled pill fills the rest. -->
|
||||
<div class="iSheet__actions">
|
||||
<button type="button" class="iSheet__btn iSheet__btn--primary" @click="emit('confirm')">
|
||||
{{ confirmText }}
|
||||
</button>
|
||||
<button v-if="cancelText" type="button" class="iSheet__btn iSheet__btn--ghost" @click="cancel">
|
||||
{{ cancelText }}
|
||||
</button>
|
||||
<button type="button" class="iSheet__btn iSheet__btn--primary" @click="emit('confirm')">
|
||||
{{ confirmText }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</Popup>
|
||||
@@ -96,6 +107,8 @@ import { computed, ref } from 'vue'
|
||||
import { Popup } from 'vant'
|
||||
import SheetArt, { type SheetArtName } from './SheetArt.vue'
|
||||
|
||||
// Kept as the original five for API compatibility; v2 renders them as two
|
||||
// looks — destructive (wine) and everything else (ink). See the styles.
|
||||
type Tone = 'ink' | 'wine' | 'navy' | 'gold' | 'green'
|
||||
|
||||
const props = withDefaults(
|
||||
@@ -125,7 +138,6 @@ const artTone: Record<SheetArtName, Tone> = {
|
||||
update: 'navy',
|
||||
success: 'green',
|
||||
}
|
||||
|
||||
const resolvedTone = computed<Tone>(() => props.tone ?? (props.art ? artTone[props.art] : 'ink'))
|
||||
|
||||
const ready = ref(false)
|
||||
@@ -144,12 +156,6 @@ function cancel() {
|
||||
close()
|
||||
}
|
||||
|
||||
// The popup is a full-width transparent strip with the card inset inside it;
|
||||
// a tap in that inset gap is visually a tap on the backdrop, so treat it as one.
|
||||
function onGapClick(e: MouseEvent) {
|
||||
if (props.closeOnClickOverlay && e.target === e.currentTarget) close()
|
||||
}
|
||||
|
||||
// Swipe down to dismiss. Only the card moves while dragging; on release it
|
||||
// either springs back or the popup's own leave transition carries it off
|
||||
// from wherever the finger left it (reset once fully closed).
|
||||
@@ -195,14 +201,14 @@ function onTouchEnd() {
|
||||
<style lang="less">
|
||||
// Global, not scoped: the popup is teleported to <body>.
|
||||
|
||||
// See-through dim, no blur — the same backdrop as the filter sheet.
|
||||
.iSheet__overlay {
|
||||
background: rgba(20, 22, 26, 0.48);
|
||||
background: rgba(20, 22, 26, 0.42);
|
||||
}
|
||||
|
||||
.iSheet.van-popup {
|
||||
background: transparent;
|
||||
overflow: visible;
|
||||
padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
|
||||
// The iOS sheet curve: fast out of the gate, long soft landing. Transform
|
||||
@@ -211,81 +217,47 @@ function onTouchEnd() {
|
||||
.iSheet-slide-leave-active {
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.iSheet-slide-enter-active {
|
||||
transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
|
||||
}
|
||||
|
||||
.iSheet-slide-leave-active {
|
||||
transition: transform 0.24s cubic-bezier(0.4, 0, 1, 1);
|
||||
}
|
||||
|
||||
// Hold every decorative animation (the stage's rings and sparks, and the
|
||||
// illustration's own) until the sheet has landed.
|
||||
.iSheet__card:not(.is-ready) *,
|
||||
.iSheet__card:not(.is-ready) *::after {
|
||||
animation-play-state: paused !important;
|
||||
}
|
||||
|
||||
.iSheet-slide-enter-from,
|
||||
.iSheet-slide-leave-to {
|
||||
transform: translate3d(0, 100%, 0);
|
||||
}
|
||||
|
||||
// Tones: one accent per job. --t is the accent, --t-rgb its channels for
|
||||
// translucent uses, --t-hi the lighter top of the button gradient, --t-wash
|
||||
// and --t-wash2 the header's two background stops.
|
||||
.iSheet--ink {
|
||||
--t: @ink;
|
||||
--t-rgb: 20, 22, 26;
|
||||
--t-hi: @inkSoft;
|
||||
--t-wash: #F7F7F8;
|
||||
--t-wash2: #ECEDEF;
|
||||
// Hold the illustration's animations until the sheet has landed.
|
||||
.iSheet__card:not(.is-ready) *,
|
||||
.iSheet__card:not(.is-ready) *::after {
|
||||
animation-play-state: paused !important;
|
||||
}
|
||||
|
||||
// Two looks, one per job: the filled button is @wine for the destructive
|
||||
// action (logout) and @ink — the app's primary surface — for everything else.
|
||||
.iSheet__card {
|
||||
--t: @ink;
|
||||
--t-on: @onInk;
|
||||
--t-rgb: 20, 22, 26;
|
||||
}
|
||||
.iSheet--wine {
|
||||
--t: @wine;
|
||||
--t-on: #fff;
|
||||
--t-rgb: 122, 27, 51;
|
||||
--t-hi: @wineSoft;
|
||||
--t-wash: #FDF6F7;
|
||||
--t-wash2: #F7E2E7;
|
||||
}
|
||||
|
||||
.iSheet--navy {
|
||||
--t: @primary;
|
||||
--t-rgb: 28, 45, 86;
|
||||
--t-hi: #2D4682;
|
||||
--t-wash: #F5F7FC;
|
||||
--t-wash2: #E2E8F4;
|
||||
}
|
||||
|
||||
.iSheet--gold {
|
||||
--t: @secondary;
|
||||
--t-rgb: 141, 106, 70;
|
||||
--t-hi: #C39350;
|
||||
--t-wash: #FDF9F2;
|
||||
--t-wash2: #F5E7CF;
|
||||
}
|
||||
|
||||
.iSheet--green {
|
||||
--t: #15803d;
|
||||
--t-rgb: 22, 163, 74;
|
||||
--t-hi: #22a052;
|
||||
--t-wash: #F4FBF6;
|
||||
--t-wash2: #D9F1E1;
|
||||
}
|
||||
|
||||
// The detail page's / filter sheet's shell: white, attached to the bottom
|
||||
// edge, 32px top radius, a centred column on wide screens.
|
||||
.iSheet__card {
|
||||
position: relative;
|
||||
max-width: 440px;
|
||||
max-width: 768px;
|
||||
margin: 0 auto;
|
||||
padding: 8px 8px 12px;
|
||||
border-radius: 30px;
|
||||
padding: 8px 16px calc(14px + env(safe-area-inset-bottom, 0px));
|
||||
border-radius: 32px 32px 0 0;
|
||||
background: @canvas;
|
||||
text-align: center;
|
||||
box-shadow:
|
||||
0 30px 60px -22px rgba(20, 22, 26, 0.5),
|
||||
0 0 0 1px rgba(20, 22, 26, 0.04);
|
||||
box-shadow: 0 -18px 40px -30px rgba(20, 22, 26, 0.55);
|
||||
transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
touch-action: none;
|
||||
|
||||
@@ -294,84 +266,29 @@ function onTouchEnd() {
|
||||
}
|
||||
}
|
||||
|
||||
// Header: a tinted window with a faint dot grid that fades out towards the
|
||||
// edges, two soft rings framing the illustration, and a few twinkles.
|
||||
.iSheet__stage {
|
||||
position: relative;
|
||||
height: 172px;
|
||||
border-radius: 23px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: radial-gradient(130% 95% at 50% 0%, var(--t-wash2) 0%, var(--t-wash) 72%);
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image: radial-gradient(rgba(var(--t-rgb), 0.13) 1px, transparent 1.3px);
|
||||
background-size: 14px 14px;
|
||||
-webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
|
||||
mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
|
||||
}
|
||||
}
|
||||
|
||||
.iSheet__handle {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 50%;
|
||||
.iSheet__grip {
|
||||
display: block;
|
||||
width: 38px;
|
||||
height: 4px;
|
||||
margin-left: -19px;
|
||||
border-radius: 4px;
|
||||
background: rgba(var(--t-rgb), 0.18);
|
||||
z-index: 2;
|
||||
margin: 0 auto 12px;
|
||||
border-radius: 999px;
|
||||
background: @hairline;
|
||||
}
|
||||
|
||||
.iSheet__ring {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
border-radius: 50%;
|
||||
pointer-events: none;
|
||||
|
||||
&--outer {
|
||||
width: 196px;
|
||||
height: 196px;
|
||||
margin: -98px 0 0 -98px;
|
||||
border: 1.5px dashed rgba(var(--t-rgb), 0.16);
|
||||
}
|
||||
|
||||
&--inner {
|
||||
width: 132px;
|
||||
height: 132px;
|
||||
margin: -66px 0 0 -66px;
|
||||
background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.55) 62%, rgba(255, 255, 255, 0) 72%);
|
||||
box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.35);
|
||||
animation: iSheet-breathe 3.2s ease-in-out infinite;
|
||||
}
|
||||
}
|
||||
|
||||
.iSheet__spark {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: rgba(var(--t-rgb), 0.45);
|
||||
clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
|
||||
animation: iSheet-twinkle 2.6s ease-in-out infinite;
|
||||
|
||||
&--1 { top: 30px; right: 24%; }
|
||||
&--2 { top: 62px; left: 19%; width: 7px; height: 7px; animation-delay: 0.7s; }
|
||||
&--3 { bottom: 32px; right: 17%; width: 8px; height: 8px; animation-delay: 1.3s; }
|
||||
&--4 { bottom: 26px; left: 27%; width: 6px; height: 6px; animation-delay: 1.9s; }
|
||||
// The ProductPanel treatment: the subject centred on a borderless soft-grey
|
||||
// panel at the catalogue cards' 32px radius (one step in, 26px, since it sits
|
||||
// inside the sheet's own 32px corner).
|
||||
.iSheet__panel {
|
||||
height: 150px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border-radius: 26px;
|
||||
background: @hairlineSoft;
|
||||
}
|
||||
|
||||
.iSheet__art {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 128px;
|
||||
height: 128px;
|
||||
width: 112px;
|
||||
height: 112px;
|
||||
|
||||
> img,
|
||||
> svg,
|
||||
@@ -383,18 +300,19 @@ function onTouchEnd() {
|
||||
}
|
||||
|
||||
// Every element sets its own font-size: style.less's `*` rule pins each one
|
||||
// to 14px, so nothing inherits.
|
||||
// to 14px, so nothing inherits. Sizes are the detail page's: 16px for the
|
||||
// heading (its section titles), 12.5px / line-height 2 for body copy.
|
||||
.iSheet__title {
|
||||
margin: 20px 16px 0;
|
||||
font-size: 16.5px;
|
||||
font-weight: 800;
|
||||
margin: 18px 8px 0;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
line-height: 1.75;
|
||||
color: @ink;
|
||||
}
|
||||
|
||||
.iSheet__desc {
|
||||
margin: 6px 20px 0;
|
||||
font-size: 13px;
|
||||
margin: 6px 12px 0;
|
||||
font-size: 12.5px;
|
||||
font-weight: 400;
|
||||
line-height: 2;
|
||||
color: @inkMuted;
|
||||
@@ -402,9 +320,9 @@ function onTouchEnd() {
|
||||
|
||||
.iSheet__actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
margin: 22px 4px 0;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
// Scoped under the card on purpose: Tailwind's preflight resets
|
||||
@@ -413,64 +331,44 @@ function onTouchEnd() {
|
||||
// imported before main.ts loads tailwind.css — so a bare `.iSheet__btn--primary`
|
||||
// loses on source order and the button renders white-on-white.
|
||||
.iSheet__card .iSheet__btn {
|
||||
position: relative;
|
||||
height: 52px;
|
||||
border: 0;
|
||||
border-radius: 18px;
|
||||
font-size: 14.5px;
|
||||
font-weight: 700;
|
||||
height: 48px;
|
||||
border-radius: 999px;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
font-weight: 800;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
|
||||
transition: transform 0.18s ease, background-color 0.18s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
|
||||
&--primary {
|
||||
color: #fff;
|
||||
background: linear-gradient(180deg, var(--t-hi) 0%, var(--t) 100%);
|
||||
box-shadow:
|
||||
0 12px 24px -12px rgba(var(--t-rgb), 0.75),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.18);
|
||||
|
||||
// A single sheen across the button once the sheet has settled.
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 40%;
|
||||
background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
|
||||
transform: translateX(-130%) skewX(-18deg);
|
||||
animation: iSheet-sheen 0.9s ease-in-out 0.15s both;
|
||||
}
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
// The detail page's outlined pill.
|
||||
&--ghost {
|
||||
color: @inkMuted;
|
||||
background: transparent;
|
||||
flex: 0 0 auto;
|
||||
min-width: 108px;
|
||||
padding: 0 22px;
|
||||
color: @ink;
|
||||
background: @canvas;
|
||||
border: 1px solid @hairline;
|
||||
|
||||
&:active {
|
||||
background: @hairlineSoft;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes iSheet-breathe {
|
||||
50% { transform: scale(1.06); }
|
||||
}
|
||||
|
||||
@keyframes iSheet-twinkle {
|
||||
0%, 100% { transform: scale(0.4) rotate(0deg); opacity: 0.2; }
|
||||
50% { transform: scale(1) rotate(45deg); opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes iSheet-sheen {
|
||||
from { transform: translateX(-130%) skewX(-18deg); }
|
||||
to { transform: translateX(300%) skewX(-18deg); }
|
||||
// The detail page's primary pill.
|
||||
&--primary {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 0 18px;
|
||||
border: 0;
|
||||
color: var(--t-on);
|
||||
background: var(--t);
|
||||
box-shadow: 0 14px 30px -18px rgba(var(--t-rgb), 0.9);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
@@ -478,7 +376,6 @@ function onTouchEnd() {
|
||||
.iSheet-slide-leave-active {
|
||||
transition-duration: 0.01s;
|
||||
}
|
||||
|
||||
.iSheet__card *,
|
||||
.iSheet__card *::after {
|
||||
animation: none !important;
|
||||
|
||||
Reference in New Issue
Block a user