1
This commit is contained in:
@@ -1,562 +0,0 @@
|
||||
---
|
||||
version: alpha
|
||||
name: Apple
|
||||
description: A photography-first interface that turns marketing into a museum gallery. Edge-to-edge product tiles alternate light and dark canvases, framed by SF Pro Display headlines with negative letter-spacing and a single Action Blue (#0066cc) interactive color. UI chrome recedes so the product can speak — no decorative gradients, no shadows on chrome, only the one signature drop-shadow under product imagery resting on a surface.
|
||||
|
||||
colors:
|
||||
primary: "#0066cc"
|
||||
primary-focus: "#0071e3"
|
||||
primary-on-dark: "#2997ff"
|
||||
ink: "#1d1d1f"
|
||||
body: "#1d1d1f"
|
||||
body-on-dark: "#ffffff"
|
||||
body-muted: "#cccccc"
|
||||
ink-muted-80: "#333333"
|
||||
ink-muted-48: "#7a7a7a"
|
||||
divider-soft: "#f0f0f0"
|
||||
hairline: "#e0e0e0"
|
||||
canvas: "#ffffff"
|
||||
canvas-parchment: "#f5f5f7"
|
||||
surface-pearl: "#fafafc"
|
||||
surface-tile-1: "#272729"
|
||||
surface-tile-2: "#2a2a2c"
|
||||
surface-tile-3: "#252527"
|
||||
surface-black: "#000000"
|
||||
surface-chip-translucent: "#d2d2d7"
|
||||
on-primary: "#ffffff"
|
||||
on-dark: "#ffffff"
|
||||
|
||||
typography:
|
||||
hero-display:
|
||||
fontFamily: "SF Pro Display, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 56px
|
||||
fontWeight: 600
|
||||
lineHeight: 1.07
|
||||
letterSpacing: -0.28px
|
||||
display-lg:
|
||||
fontFamily: "SF Pro Display, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 40px
|
||||
fontWeight: 600
|
||||
lineHeight: 1.1
|
||||
letterSpacing: 0
|
||||
display-md:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 34px
|
||||
fontWeight: 600
|
||||
lineHeight: 1.47
|
||||
letterSpacing: -0.374px
|
||||
lead:
|
||||
fontFamily: "SF Pro Display, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 28px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.14
|
||||
letterSpacing: 0.196px
|
||||
lead-airy:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 24px
|
||||
fontWeight: 300
|
||||
lineHeight: 1.5
|
||||
letterSpacing: 0
|
||||
tagline:
|
||||
fontFamily: "SF Pro Display, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 21px
|
||||
fontWeight: 600
|
||||
lineHeight: 1.19
|
||||
letterSpacing: 0.231px
|
||||
body-strong:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 17px
|
||||
fontWeight: 600
|
||||
lineHeight: 1.24
|
||||
letterSpacing: -0.374px
|
||||
body:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 17px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.47
|
||||
letterSpacing: -0.374px
|
||||
dense-link:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 17px
|
||||
fontWeight: 400
|
||||
lineHeight: 2.41
|
||||
letterSpacing: 0
|
||||
caption:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 14px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.43
|
||||
letterSpacing: -0.224px
|
||||
caption-strong:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 14px
|
||||
fontWeight: 600
|
||||
lineHeight: 1.29
|
||||
letterSpacing: -0.224px
|
||||
button-large:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 18px
|
||||
fontWeight: 300
|
||||
lineHeight: 1.0
|
||||
letterSpacing: 0
|
||||
button-utility:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 14px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.29
|
||||
letterSpacing: -0.224px
|
||||
fine-print:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 12px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.0
|
||||
letterSpacing: -0.12px
|
||||
micro-legal:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 10px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.3
|
||||
letterSpacing: -0.08px
|
||||
nav-link:
|
||||
fontFamily: "SF Pro Text, system-ui, -apple-system, sans-serif"
|
||||
fontSize: 12px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.0
|
||||
letterSpacing: -0.12px
|
||||
|
||||
rounded:
|
||||
none: 0px
|
||||
xs: 5px
|
||||
sm: 8px
|
||||
md: 11px
|
||||
lg: 18px
|
||||
pill: 9999px
|
||||
full: 9999px
|
||||
|
||||
spacing:
|
||||
xxs: 4px
|
||||
xs: 8px
|
||||
sm: 12px
|
||||
md: 17px
|
||||
lg: 24px
|
||||
xl: 32px
|
||||
xxl: 48px
|
||||
section: 80px
|
||||
|
||||
components:
|
||||
button-primary:
|
||||
backgroundColor: "{colors.primary}"
|
||||
textColor: "{colors.on-primary}"
|
||||
typography: "{typography.body}"
|
||||
rounded: "{rounded.pill}"
|
||||
padding: 11px 22px
|
||||
button-primary-focus:
|
||||
backgroundColor: "{colors.primary}"
|
||||
textColor: "{colors.on-primary}"
|
||||
rounded: "{rounded.pill}"
|
||||
button-primary-active:
|
||||
backgroundColor: "{colors.primary}"
|
||||
textColor: "{colors.on-primary}"
|
||||
rounded: "{rounded.pill}"
|
||||
button-secondary-pill:
|
||||
backgroundColor: "{colors.canvas}"
|
||||
textColor: "{colors.primary}"
|
||||
typography: "{typography.body}"
|
||||
rounded: "{rounded.pill}"
|
||||
padding: 11px 22px
|
||||
button-dark-utility:
|
||||
backgroundColor: "{colors.ink}"
|
||||
textColor: "{colors.on-dark}"
|
||||
typography: "{typography.button-utility}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 8px 15px
|
||||
button-pearl-capsule:
|
||||
backgroundColor: "{colors.surface-pearl}"
|
||||
textColor: "{colors.ink-muted-80}"
|
||||
typography: "{typography.caption}"
|
||||
rounded: "{rounded.md}"
|
||||
padding: 8px 14px
|
||||
button-store-hero:
|
||||
backgroundColor: "{colors.primary}"
|
||||
textColor: "{colors.on-primary}"
|
||||
typography: "{typography.button-large}"
|
||||
rounded: "{rounded.pill}"
|
||||
padding: 14px 28px
|
||||
button-icon-circular:
|
||||
backgroundColor: "{colors.surface-chip-translucent}"
|
||||
textColor: "{colors.ink}"
|
||||
rounded: "{rounded.full}"
|
||||
size: 44px
|
||||
text-link:
|
||||
backgroundColor: transparent
|
||||
textColor: "{colors.primary}"
|
||||
typography: "{typography.body}"
|
||||
text-link-on-dark:
|
||||
backgroundColor: transparent
|
||||
textColor: "{colors.primary-on-dark}"
|
||||
typography: "{typography.body}"
|
||||
global-nav:
|
||||
backgroundColor: "{colors.surface-black}"
|
||||
textColor: "{colors.on-dark}"
|
||||
typography: "{typography.nav-link}"
|
||||
height: 44px
|
||||
sub-nav-frosted:
|
||||
backgroundColor: "{colors.canvas-parchment}"
|
||||
textColor: "{colors.ink}"
|
||||
typography: "{typography.tagline}"
|
||||
height: 52px
|
||||
product-tile-light:
|
||||
backgroundColor: "{colors.canvas}"
|
||||
textColor: "{colors.ink}"
|
||||
typography: "{typography.display-lg}"
|
||||
rounded: "{rounded.none}"
|
||||
padding: 80px
|
||||
product-tile-parchment:
|
||||
backgroundColor: "{colors.canvas-parchment}"
|
||||
textColor: "{colors.ink}"
|
||||
typography: "{typography.display-lg}"
|
||||
rounded: "{rounded.none}"
|
||||
padding: 80px
|
||||
product-tile-dark:
|
||||
backgroundColor: "{colors.surface-tile-1}"
|
||||
textColor: "{colors.on-dark}"
|
||||
typography: "{typography.display-lg}"
|
||||
rounded: "{rounded.none}"
|
||||
padding: 80px
|
||||
product-tile-dark-2:
|
||||
backgroundColor: "{colors.surface-tile-2}"
|
||||
textColor: "{colors.on-dark}"
|
||||
rounded: "{rounded.none}"
|
||||
product-tile-dark-3:
|
||||
backgroundColor: "{colors.surface-tile-3}"
|
||||
textColor: "{colors.on-dark}"
|
||||
rounded: "{rounded.none}"
|
||||
store-utility-card:
|
||||
backgroundColor: "{colors.canvas}"
|
||||
textColor: "{colors.ink}"
|
||||
typography: "{typography.body-strong}"
|
||||
rounded: "{rounded.lg}"
|
||||
padding: 24px
|
||||
configurator-option-chip:
|
||||
backgroundColor: "{colors.canvas}"
|
||||
textColor: "{colors.ink}"
|
||||
typography: "{typography.caption}"
|
||||
rounded: "{rounded.pill}"
|
||||
padding: 12px 16px
|
||||
configurator-option-chip-selected:
|
||||
backgroundColor: "{colors.canvas}"
|
||||
textColor: "{colors.ink}"
|
||||
rounded: "{rounded.pill}"
|
||||
search-input:
|
||||
backgroundColor: "{colors.canvas}"
|
||||
textColor: "{colors.ink}"
|
||||
typography: "{typography.body}"
|
||||
rounded: "{rounded.pill}"
|
||||
padding: 12px 20px
|
||||
height: 44px
|
||||
floating-sticky-bar:
|
||||
backgroundColor: "{colors.canvas-parchment}"
|
||||
textColor: "{colors.ink}"
|
||||
typography: "{typography.body}"
|
||||
height: 64px
|
||||
padding: 12px 32px
|
||||
environment-quote-card:
|
||||
backgroundColor: "{colors.surface-tile-1}"
|
||||
textColor: "{colors.on-dark}"
|
||||
typography: "{typography.display-lg}"
|
||||
rounded: "{rounded.none}"
|
||||
padding: 80px
|
||||
footer:
|
||||
backgroundColor: "{colors.canvas-parchment}"
|
||||
textColor: "{colors.ink-muted-80}"
|
||||
typography: "{typography.fine-print}"
|
||||
padding: 64px
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Apple's web presence is a masterclass in **reverent product photography framed by near-invisible UI**. Every page is a stack of edge-to-edge product "tiles" — alternating light and dark canvases, each centered on a hero headline, a one-line tagline, two tiny blue pill CTAs, and an impossibly crisp product render. Nothing competes with the product. Typography is confident but quiet; color is either pure white, an off-white parchment, or a near-black tile; interactive elements are a single, quiet blue.
|
||||
|
||||
Density is unusually low even by contemporary SaaS standards. Each tile occupies roughly one viewport, and there is no decorative chrome — no borders, no gradients, no decorative frames, no shadows on headlines. Elevation appears only when a product image rests on a surface (a single soft `rgba(0, 0, 0, 0.22) 3px 5px 30px` drop for visual weight). The result is a catalog that feels more like a museum gallery: the wall disappears and the artifact takes over.
|
||||
|
||||
Store and shop surfaces retain the same chassis but switch modes. The product configurator (iPhone 17 Pro, accessories grid) introduces a tight grid of white utility cards at `{rounded.lg}` (18px) radius with a thin border, paired with a persistent thin sub-nav strip. The environment page leans darker and more editorial. Across all five surfaces the typographic system, spacing rhythm, and the single blue accent are consistent — this is one design language expressed at different volumes.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Photography-first presentation; UI recedes so the product can speak.
|
||||
- Alternating full-bleed tile sections: white/parchment ↔ near-black, with the color change itself acting as the section divider.
|
||||
- Single blue accent (`{colors.primary}` — #0066cc) carries every interactive element. No second brand color exists.
|
||||
- Two button grammars: tiny blue pill CTAs (`{rounded.pill}`) and compact utility rects (`{rounded.sm}`).
|
||||
- SF Pro Display + SF Pro Text — negative letter-spacing at display sizes for the signature "Apple tight" headline feel.
|
||||
- Whisper-soft elevation used only when a product image needs to breathe — exactly one drop-shadow in the entire system.
|
||||
- Tight two-row nav: slim `{component.global-nav}` + product-specific `{component.sub-nav-frosted}` with persistent right-aligned primary CTA.
|
||||
- Section rhythm across multiple pages: light hero → dark product tile → light utility tile → dark tile → parchment footer — a predictable pulse.
|
||||
|
||||
## Colors
|
||||
|
||||
> **Source pages analyzed:** homepage, environment, store, iPhone 17 Pro buy page, accessories index. The color system is identical across all five surfaces; only the surface-mode mix differs.
|
||||
|
||||
### Brand & Accent
|
||||
- **Action Blue** (`{colors.primary}` — #0066cc): The single brand-level interactive color. All text links, all blue pill CTAs ("Learn more", "Buy"), and the focus ring root. This is Apple's quiet but universal "click me" signal. Press state shifts to a slightly darker variant via the active scale transform rather than a hex change.
|
||||
- **Focus Blue** (`{colors.primary-focus}` — #0071e3): A marginally brighter sibling of Action Blue, reserved for the keyboard focus ring on buttons (`outline: 2px solid`).
|
||||
- **Sky Link Blue** (`{colors.primary-on-dark}` — #2997ff): A brighter blue used on dark surfaces for in-copy links and inline callouts, where Action Blue would disappear against the tile background.
|
||||
|
||||
### Surface
|
||||
- **Pure White** (`{colors.canvas}` — #ffffff): The dominant canvas. Content, utility cards, store tiles, configurator grids.
|
||||
- **Parchment** (`{colors.canvas-parchment}` — #f5f5f7): The signature Apple off-white. Used for alternating light tiles, footer region, and the default page canvas in store utility sections. Just different enough from white to create rhythm.
|
||||
- **Pearl Button** (`{colors.surface-pearl}` — #fafafc): A near-white used as the fill for secondary "ghost" buttons — lighter than the parchment canvas so the button still reads as a button against `{colors.canvas-parchment}`.
|
||||
- **Near-Black Tile 1** (`{colors.surface-tile-1}` — #272729): The primary dark-tile surface on the homepage product grid.
|
||||
- **Near-Black Tile 2** (`{colors.surface-tile-2}` — #2a2a2c): A micro-step lighter — used where a dark tile sits directly above or below Tile 1 to create the faintest separation.
|
||||
- **Near-Black Tile 3** (`{colors.surface-tile-3}` — #252527): A micro-step darker — used at the bottom of the stack and in embedded video/player frames.
|
||||
- **Pure Black** (`{colors.surface-black}` — #000000): Reserved for true void — video player backgrounds, edge-to-edge photographic overlays, the global nav bar background.
|
||||
- **Translucent Chip Gray** (`{colors.surface-chip-translucent}` — #d2d2d7): The base hex of the translucent gray chip used over photography for circular control buttons. In production, applied at ~64% alpha as `rgba(210, 210, 215, 0.64)`.
|
||||
|
||||
### Text
|
||||
- **Near-Black Ink** (`{colors.ink}` — #1d1d1f): The voice of every headline, every body paragraph, and the dark utility button's fill. Chosen instead of pure black to keep the page feeling photographic rather than printed.
|
||||
- **Body** (`{colors.body}` — #1d1d1f): Same hex as ink — Apple uses one near-black tone for all text on light surfaces.
|
||||
- **Body On Dark** (`{colors.body-on-dark}` — #ffffff): All text on dark tiles and on the global nav bar.
|
||||
- **Body Muted** (`{colors.body-muted}` — #cccccc): Secondary copy on dark tiles where pure white would be too loud.
|
||||
- **Ink Muted 80** (`{colors.ink-muted-80}` — #333333): Body text on the white Pearl Button surface — slightly softer than pure black.
|
||||
- **Ink Muted 48** (`{colors.ink-muted-48}` — #7a7a7a): Disabled button text and legal fine-print.
|
||||
|
||||
### Hairlines & Borders
|
||||
- **Divider Soft** (`{colors.divider-soft}` — #f0f0f0): The "border" tone on secondary buttons — functions as a ring shadow rather than a hard line. In production, often applied as `rgba(0, 0, 0, 0.04)`.
|
||||
- **Hairline** (`{colors.hairline}` — #e0e0e0): The 1px hairline border on store utility cards and configurator chips.
|
||||
|
||||
### Brand Gradient
|
||||
**No decorative gradients.** Atmospheric depth on product photography (the iPhone 17 Pro camera plate, the Apple Watch bands, AirPods reflections) is inherent to the imagery, not a CSS gradient overlay. The environment page's hero uses photographic atmosphere (mountain vista at dawn) but no gradient tokens are defined. Apple is the rare luxury-brand site with zero gradient-based design tokens.
|
||||
|
||||
## Typography
|
||||
|
||||
### Font Family
|
||||
- **Display**: `SF Pro Display, system-ui, -apple-system, sans-serif` — Apple's proprietary display face, optimized for sizes ≥ 19px. Defines the voice of every headline.
|
||||
- **Body / UI**: `SF Pro Text, system-ui, -apple-system, sans-serif` — the text-optimized variant used for body copy, captions, buttons, and links below 20px.
|
||||
- **OpenType features**: `font-variant-numeric: numerator` is enabled on numeric links (pricing tables, spec sheets). Display sizes rely on tight tracking rather than contextual ligatures.
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Token | Size | Weight | Line Height | Letter Spacing | Use |
|
||||
|---|---|---|---|---|---|
|
||||
| `{typography.hero-display}` | 56px | 600 | 1.07 | -0.28px | Hero headline; the signature "Apple tight" tracking |
|
||||
| `{typography.display-lg}` | 40px | 600 | 1.10 | 0 | Tile headlines atop every product tile |
|
||||
| `{typography.display-md}` | 34px | 600 | 1.47 | -0.374px | Section heads (SF Pro Text at display proportions) |
|
||||
| `{typography.lead}` | 28px | 400 | 1.14 | 0.196px | Product tile subcopy |
|
||||
| `{typography.lead-airy}` | 24px | 300 | 1.5 | 0 | Environment-page lead paragraphs (the rare weight 300) |
|
||||
| `{typography.tagline}` | 21px | 600 | 1.19 | 0.231px | Sub-tile tagline; sub-nav category name |
|
||||
| `{typography.body-strong}` | 17px | 600 | 1.24 | -0.374px | Inline strong emphasis |
|
||||
| `{typography.body}` | 17px | 400 | 1.47 | -0.374px | Default paragraph |
|
||||
| `{typography.dense-link}` | 17px | 400 | 2.41 | 0 | Footer / store utility link lists (relaxed leading) |
|
||||
| `{typography.caption}` | 14px | 400 | 1.43 | -0.224px | Secondary captions, button text |
|
||||
| `{typography.caption-strong}` | 14px | 600 | 1.29 | -0.224px | Emphasized captions |
|
||||
| `{typography.button-large}` | 18px | 300 | 1.0 | 0 | Store hero CTAs (the rare weight 300) |
|
||||
| `{typography.button-utility}` | 14px | 400 | 1.29 | -0.224px | Utility/nav button labels |
|
||||
| `{typography.fine-print}` | 12px | 400 | 1.0 | -0.12px | Fine-print, footer body |
|
||||
| `{typography.micro-legal}` | 10px | 400 | 1.3 | -0.08px | Micro legal disclaimers |
|
||||
| `{typography.nav-link}` | 12px | 400 | 1.0 | -0.12px | Global nav menu items |
|
||||
|
||||
### Principles
|
||||
|
||||
- **Negative letter-spacing at display sizes.** Every headline at 17px and up carries a slight tracking tighten (`-0.12 → -0.374px`). This produces the iconic "Apple tight" headline cadence. Never used at 12px or below.
|
||||
- **Body copy at 17px, not 16px.** Apple breaks the SaaS convention and runs paragraph text at 17px. The extra pixel gives the page an unmistakable "reading, not scanning" pace.
|
||||
- **Weight 300 is real and rare.** Used deliberately on a handful of large-size reads (`{typography.button-large}` at 18px/300 and `{typography.lead-airy}` at 24px/300). It's not an accident — it's a light-atmosphere cue reserved for moments where the content should feel airy.
|
||||
- **Weight 600, not 700, for headlines.** Apple's headlines sit at weight 600. Weight 700 is used sparingly for `{typography.tagline}` (21px) when a touch more assertion is needed.
|
||||
- **Line-height is context-specific.** Display sizes use 1.07–1.19 (tight). Body uses 1.47. Utility link stacks in the footer/store use an unusually relaxed 2.41 (`{typography.dense-link}`). The 2.41 is not a bug — it's how the footer's dense link columns breathe.
|
||||
- **Weight 500 is deliberately absent.** The ladder is 300 / 400 / 600 / 700. Mid-weight readings always use 600.
|
||||
|
||||
### Note on Font Substitutes
|
||||
SF Pro is Apple's proprietary system font. When building off-system:
|
||||
|
||||
- Use `system-ui, -apple-system, BlinkMacSystemFont` as the first stack entry — on macOS/iOS/Safari this resolves to the real SF Pro.
|
||||
- For non-Apple platforms, **Inter** (Google Fonts, variable) is the closest open-source equivalent. Inter at weight 600 with `font-feature-settings: "ss03"` approximates SF Pro's rounded "a" character.
|
||||
- Nudge `letter-spacing` down by `-0.01em` on display sizes to re-create the Apple tight feel; Inter's default tracking runs slightly wider than SF Pro.
|
||||
- For body text, tighten line-height by `0.03` (from 1.47 → 1.44) when substituting Inter — Inter's taller x-height needs less leading.
|
||||
|
||||
## Layout
|
||||
|
||||
### Spacing System
|
||||
- **Base unit:** 8px. Sub-base values (2, 4, 5, 6, 7) are used for tight typographic adjustments; structural layout snaps to 8/12/16/20/24.
|
||||
- **Tokens:** `{spacing.xxs}` 4px · `{spacing.xs}` 8px · `{spacing.sm}` 12px · `{spacing.md}` 17px · `{spacing.lg}` 24px · `{spacing.xl}` 32px · `{spacing.xxl}` 48px · `{spacing.section}` 80px.
|
||||
- **Section vertical padding:** `{spacing.section}` (80px) inside a product tile; tiles stack edge-to-edge with 0 gap (the color change provides the break).
|
||||
- **Card padding:** `{spacing.lg}` (24px) inside utility grid cards.
|
||||
- **Button padding:** 8–11px vertical, 15–22px horizontal.
|
||||
- **Universal rhythm constants:** the 17px body line-height multiplier (~25px line) and 21px tagline size show up on every analyzed page.
|
||||
|
||||
### Grid & Container
|
||||
- **Max content width:** ~980px on text-heavy sections (environment), ~1440px on product grids (store, accessories), full-bleed for product tiles (homepage).
|
||||
- **Column patterns:** 3 to 5 column utility card grid on store/accessories; 2-column side-by-side tiles on homepage occasional sections; single-column centered stack on product tile heroes.
|
||||
- **Gutters:** 20–24px between cards in a utility grid.
|
||||
|
||||
### Whitespace Philosophy
|
||||
Apple's whitespace is the product's pedestal. Every tile begins with at least 64px of air above its headline and 48–64px below. Product renders are never crowded; the nearest content to a product image is at least 40px away. The footer is the only area that breaks this — there, Apple goes deliberately dense to make the full information architecture visible at a glance.
|
||||
|
||||
## Elevation & Depth
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|---|---|---|
|
||||
| Flat | No shadow, no border | Full-bleed tiles, global nav, footer, body sections |
|
||||
| Soft hairline | 1px `rgba(0, 0, 0, 0.08)` border | Utility cards, sub-nav frosted-glass separator |
|
||||
| Backdrop blur | `backdrop-filter: blur(N)` on Parchment 80% | Sub-nav and the iPhone buy floating sticky bar |
|
||||
| Product shadow | `rgba(0, 0, 0, 0.22) 3px 5px 30px 0` | Product renders resting on a surface (the only true "shadow" in the system) |
|
||||
|
||||
**Shadow philosophy.** Apple uses **exactly one** drop-shadow, and it is applied to photographic product imagery — never to cards, never to buttons, never to text. Elevation in the UI comes from (a) surface-color change (light tile ↔ dark tile) and (b) backdrop-blur on sticky bars. The single shadow is about giving the product weight, not about UI hierarchy.
|
||||
|
||||
### Decorative Depth
|
||||
- **Atmospheric imagery** on the environment page (photographic vista) supplies mood; no CSS gradient involved.
|
||||
- **Edge-to-edge tile alternation** creates rhythm without borders or shadows — the color change itself is the divider.
|
||||
- **Backdrop-filter blur** on `{component.sub-nav-frosted}` and `{component.floating-sticky-bar}` creates a "floating over content" effect that's functional, not decorative.
|
||||
|
||||
## Shapes
|
||||
|
||||
### Border Radius Scale
|
||||
|
||||
| Token | Value | Use |
|
||||
|---|---|---|
|
||||
| `{rounded.none}` | 0px | Full-bleed product tiles (no corner rounding) |
|
||||
| `{rounded.xs}` | 5px | Inline links when styled as subtle chips (rare) |
|
||||
| `{rounded.sm}` | 8px | Dark utility buttons (Sign In, Bag), inline card imagery |
|
||||
| `{rounded.md}` | 11px | White Pearl Button capsules |
|
||||
| `{rounded.lg}` | 18px | Store utility cards, accessories grid cards |
|
||||
| `{rounded.pill}` | 9999px | Primary blue pill CTAs, sub-nav buy button, configurator option chips, search input — the signature Apple pill |
|
||||
| `{rounded.full}` | 9999px / 50% | Circular control chips floating over photography |
|
||||
|
||||
### Photography Geometry
|
||||
- **Hero imagery**: full-bleed, 21:9 or taller on the homepage; 16:9 on environment and shop pages. Product renders are photographic-realistic, often shot on a tinted surface that becomes the tile background.
|
||||
- **Product renders**: PNG/WebP with transparency; rest on a surface tile and pick up the system shadow.
|
||||
- **Accessory grid**: square 1:1 crops at `{rounded.lg}` (18px) radius, light neutral backgrounds, product centered with 20–40px internal padding.
|
||||
- **No rounded imagery in hero tiles** — images are full-bleed rectangular. Rounding (`{rounded.sm}`, `{rounded.lg}`) appears only on inline card imagery.
|
||||
- Lazy-loading via responsive `srcset` and `sizes` across all breakpoints; CDN-optimized WebP.
|
||||
|
||||
## Components
|
||||
|
||||
### Top Navigation
|
||||
|
||||
**`global-nav`** — Persistent, ultra-thin black nav bar pinned to the top of every page. Background `{colors.surface-black}`, height 44px, text `{colors.on-dark}` in `{typography.nav-link}` (12px / 400 / -0.12px tracking). Links are quiet, spaced ~20px apart, running edge-to-edge across the top. Right-aligned cluster: Search, Bag icons — always visible. On mobile, collapses to hamburger at ~834px and the Apple logo centers.
|
||||
|
||||
**`sub-nav-frosted`** — Surface-specific nav that sticks below the global nav. Background `{colors.canvas-parchment}` at 80% opacity with backdrop-filter blur, creating a frosted-glass effect. Height 52px. Content on left: product category name ("iPhone", "Store", "Accessories") in `{typography.tagline}` (21px / 600). Content right: inline nav links in `{typography.button-utility}` (14px), ending in a persistent `{component.button-primary}` ("Buy") or a utility link.
|
||||
|
||||
### Buttons
|
||||
|
||||
**`button-primary`** — The signature Apple action. Background `{colors.primary}` (Action Blue #0066cc), text `{colors.on-primary}` in `{typography.body}` (SF Pro Text 17px / 400), rounded `{rounded.pill}` (full pill — capsule-shaped), padding 11px × 22px. The full-pill radius IS the brand action signal.
|
||||
- Active state: `{component.button-primary-active}` — `transform: scale(0.95)` (the system-wide micro-interaction).
|
||||
- Focus state: `{component.button-primary-focus}` — 2px solid `{colors.primary-focus}` outline.
|
||||
|
||||
**`button-secondary-pill`** — Used as the second CTA when two blue pills appear together ("Learn more" / "Buy"). Background transparent, text `{colors.primary}`, 1px solid `{colors.primary}` border, rounded `{rounded.pill}`, padding 11px × 22px. Reads as a "ghost pill."
|
||||
|
||||
**`button-dark-utility`** — Global nav actions (Sign In, Bag, language selector). Background `{colors.ink}` (#1d1d1f), text `{colors.on-dark}` in `{typography.button-utility}` (14px / 400 / -0.224px tracking), rounded `{rounded.sm}` (8px), padding 8px × 15px. Active state shrinks via `transform: scale(0.95)`.
|
||||
|
||||
**`button-pearl-capsule`** — Product-card secondary button. Background `{colors.surface-pearl}` (#fafafc), text `{colors.ink-muted-80}` in `{typography.caption}` (14px), 3px solid `{colors.divider-soft}` border (functions as a soft ring rather than a visible line), rounded `{rounded.md}` (11px), padding 8px × 14px.
|
||||
|
||||
**`button-store-hero`** — A larger primary CTA used on store hero surfaces. Same Action Blue + Paper White as `{component.button-primary}`, but with `{typography.button-large}` (18px / 300 — note the rare weight 300) and slightly more padding (14px × 28px). Used sparingly on the store landing.
|
||||
|
||||
**`button-icon-circular`** — Floats over photography. 44 × 44px, background `{colors.surface-chip-translucent}` at ~64% alpha, icon in `{colors.ink}`, rounded `{rounded.full}`. Used for carousel controls, close buttons, and in-image controls (product image thumbnails on the iPhone buy page).
|
||||
|
||||
**`text-link`** — Inline body links in `{colors.primary}` (Action Blue). Underlined or non-underlined per context.
|
||||
|
||||
**`text-link-on-dark`** — Inline body links on dark tiles in `{colors.primary-on-dark}` (Sky Link Blue #2997ff) — Action Blue would disappear against `{colors.surface-tile-1}`.
|
||||
|
||||
### Cards & Containers
|
||||
|
||||
**`product-tile-light`** — Full-bleed light tile. Background `{colors.canvas}` (white), text `{colors.ink}`, rounded `{rounded.none}` (0 — tiles touch edges), vertical padding `{spacing.section}` (80px). Centered stack: product name in `{typography.display-lg}` (40px / 600) → one-line tagline in `{typography.lead}` (28px / 400) → two `{component.button-primary}` CTAs ("Learn more" / "Buy") → product render resting on the surface with the system shadow.
|
||||
|
||||
**`product-tile-parchment`** — Same as `{component.product-tile-light}` but on `{colors.canvas-parchment}` (#f5f5f7). Used to break two consecutive white tiles.
|
||||
|
||||
**`product-tile-dark`** — Full-bleed dark tile. Background `{colors.surface-tile-1}` (#272729), text `{colors.on-dark}`, rounded `{rounded.none}`, vertical padding `{spacing.section}` (80px). Same content stack as the light tile but with `{component.text-link-on-dark}` for inline copy and `{component.button-primary}` (Action Blue still works on the dark surface). Used on the homepage product grid as the alternating dark band.
|
||||
|
||||
**`product-tile-dark-2`** — Variant on `{colors.surface-tile-2}` (#2a2a2c). Used where a dark tile sits directly above or below `{component.product-tile-dark}` to create the faintest separation through micro-step lightness change.
|
||||
|
||||
**`product-tile-dark-3`** — Variant on `{colors.surface-tile-3}` (#252527). Used at the bottom of the stack and in embedded video/player frames.
|
||||
|
||||
**`store-utility-card`** — Used in store grid and accessories grid. Background `{colors.canvas}` (white), 1px solid `{colors.hairline}` border, rounded `{rounded.lg}` (18px), padding `{spacing.lg}` (24px). Top: product image (1:1 crop with `{rounded.sm}` (8px) inner image radius). Below: product name in `{typography.body-strong}` (17px / 600), price in `{typography.body}` (17px / 400), and a `{component.text-link}` ("Buy" or "Learn more"). No shadow by default; product render itself carries the system product-shadow.
|
||||
|
||||
**`configurator-option-chip`** — Pill-shaped tappable cell used in the iPhone 17 Pro buy page. Background `{colors.canvas}`, text `{colors.ink}` in `{typography.caption}`, rounded `{rounded.pill}`, padding 12px × 16px. Contains a small product thumbnail + label + price delta. Arranged in a grid of 4–5 options per row.
|
||||
|
||||
**`configurator-option-chip-selected`** — Selected state. Border upgrades to 2px solid `{colors.primary-focus}`. Same shape, same content.
|
||||
|
||||
**`environment-quote-card`** — A photographic-canvas hero specific to the environment page. Dark photographic backdrop (mountain vista at dawn) with `{colors.surface-tile-1}` as the fallback color, centered white-text headline in `{typography.display-lg}` (40px), small green "Apple 2030" pictographic logo above the headline, single `{component.button-primary}` below. Padding `{spacing.section}` (80px).
|
||||
|
||||
**`floating-sticky-bar`** — Floats at the bottom of the viewport on the iPhone 17 Pro buy page during scroll. Background `{colors.canvas-parchment}` at 80% opacity with `backdrop-filter: blur(N)`, height 64px, padding 12px × 32px. Left: running price total in `{typography.body}`. Right: `{component.button-primary}` ("Add to Bag").
|
||||
|
||||
### Inputs & Forms
|
||||
|
||||
**`search-input`** — The accessories search input. Background `{colors.canvas}`, text `{colors.ink}` in `{typography.body}` (17px), 1px solid `rgba(0, 0, 0, 0.08)` border, rounded `{rounded.pill}` (full pill — search is also pill-shaped, matching the CTA grammar), padding 12px × 20px, height 44px. Leading icon: search glyph at 14px, muted tint.
|
||||
|
||||
Error and validation states were not surfaced in the analyzed pages.
|
||||
|
||||
### Footer
|
||||
|
||||
**`footer`** — Background `{colors.canvas-parchment}` (#f5f5f7), text `{colors.ink-muted-80}`. Link columns in `{typography.dense-link}` (17px / 400 / 2.41 line-height — the relaxed leading is what makes the dense columns scannable). Column headings in `{typography.caption-strong}` (14px / 600). Legal row at the very bottom in `{typography.fine-print}` (12px / 400) with `{colors.ink-muted-48}` text. Vertical padding 64px.
|
||||
|
||||
## Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use `{colors.primary}` (Action Blue #0066cc) for every interactive element — links, pill CTAs, focus signals — and nothing else. The single accent is non-negotiable.
|
||||
- Set headlines in `{typography.hero-display}` or `{typography.display-lg}` with negative letter-spacing (`-0.28 → -0.374px`) to get the signature "Apple tight" cadence.
|
||||
- Run body copy at `{typography.body}` (17px / 400 / 1.47 / -0.374px) — not 16px. The extra pixel defines the brand's reading pace.
|
||||
- Alternate `{component.product-tile-light}` (or parchment) and `{component.product-tile-dark}` for full-bleed section rhythm. The color change IS the divider.
|
||||
- Reserve `{rounded.pill}` for the primary blue CTA and any other element that should read as an "action" (configurator chips, search input, sticky bar CTA).
|
||||
- Apply the single product-shadow (`rgba(0, 0, 0, 0.22) 3px 5px 30px`) only to product renders resting on a surface — never on cards, buttons, or text.
|
||||
- Use `transform: scale(0.95)` as the active/press state on every button — it's the system-wide micro-interaction.
|
||||
- Keep the global nav `{colors.surface-black}` (true black) — it's the only place pure black appears on most pages.
|
||||
|
||||
### Don't
|
||||
- Don't introduce a second accent color; every "click me" signal is `{colors.primary}` (Action Blue).
|
||||
- Don't add shadows to cards, buttons, or text — shadow is reserved for product imagery.
|
||||
- Don't use gradients as decorative backgrounds; atmosphere comes from photography.
|
||||
- Don't set body copy at weight 500 — Apple's ladder is 300 / 400 / 600 / 700, with 500 deliberately absent. Body is always 400; strong inline is 600; display is 600.
|
||||
- Don't round full-bleed tiles — tiles are rectangular and edge-to-edge; the color change is the divider.
|
||||
- Don't tighten line-height below 1.47 for body copy — the editorial leading is part of the brand.
|
||||
- Don't mix radii grammars — use `{rounded.sm}` for compact utility, `{rounded.lg}` for utility cards, `{rounded.pill}` for pills, and nothing in between (except the rare `{rounded.md}` Pearl Button).
|
||||
- Don't use `{colors.primary-on-dark}` (Sky Link Blue) on light surfaces — it's the dark-tile-only variant. Action Blue is for light surfaces.
|
||||
|
||||
## Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
|
||||
| Name | Width | Key Changes |
|
||||
|---|---|---|
|
||||
| Small phone | ≤ 419px | Single-column tiles; sub-nav collapses to category name + primary CTA only; hero typography drops to 28px |
|
||||
| Phone | 420–640px | Single-column stack; product renders scale to 80% of tile width; hero h1 drops to 34px |
|
||||
| Large phone | 641–735px | Tiles transition to tighter padding (48px vertical vs 80px); fine-print wraps |
|
||||
| Tablet portrait | 736–833px | Global nav collapses to hamburger; sub-nav hides category chips, keeps primary CTA |
|
||||
| Tablet landscape | 834–1023px | Global nav returns fully expanded; 3-column utility grids become 2-column |
|
||||
| Small desktop | 1024–1068px | Product tiles use 2/3 width with margin gutters; hero h1 stays at 40px |
|
||||
| Desktop | 1069–1440px | Full layout; 4–5 column store grids; 1440px content max |
|
||||
| Wide desktop | ≥ 1441px | Content locks at 1440px, margins absorb extra width |
|
||||
|
||||
The structural breakpoints that matter for agents: 1440px (content lock), 1068px (small-desktop), 833px (tablet landscape switch), 734px (tablet portrait), 640px (phone), 480px (small phone).
|
||||
|
||||
### Touch Targets
|
||||
- Minimum 44 × 44px. `{component.button-primary}` lands at ~44 × 100px (with the full-pill radius making the visible hit area more generous than the label suggests).
|
||||
- `{component.button-icon-circular}` is exactly 44 × 44px.
|
||||
- Global nav utility links are smaller (~32 × 80px) — they deliberately sit at a tighter target because they're precision desktop actions, and the mobile hamburger replaces them at ≤ 833px.
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Global nav**: full horizontal link row on desktop → collapses to Apple logo + hamburger + bag icon at 834px and below.
|
||||
- **Sub-nav**: category name + inline links + primary CTA → category name + primary CTA only at mobile; inline links move into a hamburger tray.
|
||||
- **Product tiles**: stack from 2-column to 1-column at 834px; vertical padding tightens from 80px → 48px at small-phone.
|
||||
- **Utility grids** (store, accessories): 5-col → 4-col (1440px) → 3-col (1068px) → 2-col (834px) → 1-col (640px).
|
||||
- **Hero typography**: `{typography.hero-display}` (56px) → `{typography.display-lg}` (40px) at 1068px → 34px at 640px → 28px at 419px.
|
||||
|
||||
### Image Behavior
|
||||
- All product imagery uses responsive `srcset` with breakpoint-matched crops.
|
||||
- Hero photography may switch art direction at mobile (e.g., the environment page's vista crops to a taller aspect ratio on mobile, framing the subject differently).
|
||||
- Product renders maintain their 1:1 or 4:3 aspect ratios across breakpoints; only scale changes.
|
||||
- Lazy-loading is default; the above-fold hero loads eagerly.
|
||||
|
||||
## Iteration Guide
|
||||
|
||||
1. Focus on ONE component at a time. Reference its YAML key directly (`{component.product-tile-dark}`, `{component.search-input}`).
|
||||
2. Variants of an existing component (`-active`, `-focus`, `-2`, `-3`) live as separate entries in `components:`.
|
||||
3. Use `{token.refs}` everywhere — never inline hex.
|
||||
4. Never document hover. Default and Active/Pressed states only.
|
||||
5. Display headlines stay SF Pro Display 600 with negative letter-spacing. Body stays SF Pro Text 400 at 17px. The boundary is unbreakable.
|
||||
6. The single drop-shadow (`rgba(0, 0, 0, 0.22) 3px 5px 30px`) is reserved for product photography only.
|
||||
7. When in doubt about emphasis: alternate surface (light → dark tile) before adding chrome.
|
||||
|
||||
## Known Gaps
|
||||
|
||||
- Form validation and error states were not surfaced on the analyzed pages; only the neutral search input is documented.
|
||||
- The homepage's embedded video/player frame uses `{colors.surface-black}`; interior player controls are not documented (they're a platform widget, not a web-design token).
|
||||
- Some component imagery is dynamic (rotating product hero) and its specific copy varies per surface — component specs name the structure, not the rotating content.
|
||||
- Dark-mode counterparts for store and accessories utility cards were not surfaced on the analyzed pages; the system documented is the daytime/light-dominant variant Apple ships by default.
|
||||
- Atmospheric photography (environment page mountain vista) is a content asset, not a design token; the documented `{component.environment-quote-card}` describes the structural surface only.
|
||||
- The exact backdrop-filter blur radius on `{component.sub-nav-frosted}` and `{component.floating-sticky-bar}` is platform-dependent; production CSS uses `saturate(180%) blur(20px)` as a typical baseline but the value isn't formalized as a token.
|
||||
+16
-2
@@ -1,10 +1,24 @@
|
||||
<!doctype html>
|
||||
<html lang="">
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>DNF Tools</title>
|
||||
<meta http-equiv="Expires" content="0" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
<meta http-equiv="Cache-control" content="no-cache" />
|
||||
<meta http-equiv="Cache" content="no-cache" />
|
||||
<meta name="baidu-site-verification" content="codeva-hGziQg28WN" />
|
||||
<title>DNF计算器</title>
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function () {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?472775d2edd6fb31b00828eef60ba388";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -0,0 +1,710 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from "vue";
|
||||
import type { IResultSkill } from "@/api/calc/type";
|
||||
import { useConfigStore, useInfoStore } from "@/stores";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
|
||||
import Tabs from "@/components/ui/tabs/Tabs.vue";
|
||||
import TabsList from "@/components/ui/tabs/TabsList.vue";
|
||||
import TabsTrigger from "@/components/ui/tabs/TabsTrigger.vue";
|
||||
import { getImageURL } from "@/utils";
|
||||
import EquList from "@/components/dnf/Equipment/List/index.vue";
|
||||
import OathList from "@/components/dnf/Equipment/Oath/index.vue";
|
||||
|
||||
const configStore = useConfigStore();
|
||||
const infoStore = useInfoStore();
|
||||
|
||||
/* ─── UI state ─── */
|
||||
const displayTab = ref<"equ" | "oath">("equ");
|
||||
const equippedPart = ref("");
|
||||
const equippedOathPart = ref("0");
|
||||
const skillSort = ref<"damage" | "cd" | "buff-main" | "buff-atk" | "buff-str" | "buff-ratio">(
|
||||
"damage",
|
||||
);
|
||||
|
||||
/* ─── Computed ─── */
|
||||
const resultState = computed(() => configStore.result.state);
|
||||
const isLoading = computed(() => configStore.result.isLoading);
|
||||
const isBufferClass = computed(() => !!resultState.value?.buffer);
|
||||
const standard = computed(() => infoStore.standard);
|
||||
|
||||
const resultError = computed(() => {
|
||||
const error = configStore.result.error;
|
||||
if (!error) return "";
|
||||
return error instanceof Error ? error.message : String(error);
|
||||
});
|
||||
|
||||
const hasVisibleResult = computed(() => {
|
||||
return (resultState.value?.skills?.length ?? 0) > 0 || (resultState.value?.info?.length ?? 0) > 0;
|
||||
});
|
||||
|
||||
/* ─── Skill helpers ─── */
|
||||
const getSkillCountEntry = (skill: IResultSkill) => {
|
||||
const name = skill.name;
|
||||
const mode = skill.mode;
|
||||
const existed = configStore.skillCountConfig.find(
|
||||
(item) => item.name === name && item.mode === mode,
|
||||
);
|
||||
if (existed) return existed;
|
||||
const created = { name, mode, count: 1 };
|
||||
configStore.skillCountConfig.push(created);
|
||||
return created;
|
||||
};
|
||||
|
||||
const getSkillCount = (skill: IResultSkill) => {
|
||||
return Math.max(0, Number(getSkillCountEntry(skill).count) || 0);
|
||||
};
|
||||
|
||||
const setSkillCount = (skill: IResultSkill, raw: string | number) => {
|
||||
const parsed = Number(raw);
|
||||
const entry = getSkillCountEntry(skill);
|
||||
entry.count = Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
|
||||
};
|
||||
|
||||
const getStandardSkill = (skill: IResultSkill) => {
|
||||
return standard.value?.skills.find(
|
||||
(item) => item.name === skill.name && item.mode === skill.mode,
|
||||
);
|
||||
};
|
||||
|
||||
const getStandardSkillCount = (skill: IResultSkill) => {
|
||||
const count = standard.value?.skillCount.find(
|
||||
(item) => item.name === skill.name && item.mode === skill.mode,
|
||||
)?.count;
|
||||
return Number(count ?? 0);
|
||||
};
|
||||
|
||||
const sortedSkills = computed(() => {
|
||||
const skills = [...(resultState.value?.skills ?? [])];
|
||||
if (isBufferClass.value) {
|
||||
const metricIndexMap: Record<string, number> = {
|
||||
"buff-main": 0,
|
||||
"buff-atk": 1,
|
||||
"buff-str": 2,
|
||||
"buff-ratio": 3,
|
||||
};
|
||||
const metricIndex = metricIndexMap[skillSort.value] ?? 2;
|
||||
return skills.sort(
|
||||
(left, right) => (right.buff?.[metricIndex] ?? 0) - (left.buff?.[metricIndex] ?? 0),
|
||||
);
|
||||
}
|
||||
if (skillSort.value === "cd") {
|
||||
return skills.sort((left, right) => left.cd - right.cd);
|
||||
}
|
||||
return skills.sort((left, right) => right.damage - left.damage);
|
||||
});
|
||||
|
||||
const totalWeightedDamage = computed(() => {
|
||||
return sortedSkills.value.reduce((sum, item) => sum + item.damage * getSkillCount(item), 0);
|
||||
});
|
||||
|
||||
const totalStandardDamage = computed(() => {
|
||||
if (!standard.value) return 0;
|
||||
return sortedSkills.value.reduce((sum, item) => {
|
||||
const base = getStandardSkill(item);
|
||||
if (!base) return sum;
|
||||
const count = getStandardSkillCount(item);
|
||||
return sum + base.damage * count;
|
||||
}, 0);
|
||||
});
|
||||
|
||||
const totalDiffLabel = computed(() => {
|
||||
if (!totalStandardDamage.value) return formatNumber(totalWeightedDamage.value);
|
||||
const diff =
|
||||
((totalWeightedDamage.value - totalStandardDamage.value) / totalStandardDamage.value) * 100;
|
||||
const prefix = diff >= 0 ? "+" : "";
|
||||
return `${prefix}${diff.toFixed(2)}%`;
|
||||
});
|
||||
|
||||
const totalDiffClass = computed(() => {
|
||||
if (!totalStandardDamage.value) return "text-foreground";
|
||||
return totalWeightedDamage.value >= totalStandardDamage.value
|
||||
? "text-emerald-600"
|
||||
: "text-red-600";
|
||||
});
|
||||
|
||||
/* ─── Format helpers ─── */
|
||||
const formatNumber = (value: number) => {
|
||||
if (!Number.isFinite(value)) return "0";
|
||||
if (Math.abs(value) >= 100000000) {
|
||||
return `${(value / 100000000).toFixed(2)}e`;
|
||||
}
|
||||
return value.toLocaleString("zh-CN", { maximumFractionDigits: 2 });
|
||||
};
|
||||
|
||||
const formatPercent = (value: number) => `${value.toFixed(2)}%`;
|
||||
|
||||
const formatDeltaPercent = (current: number, baseline: number) => {
|
||||
if (!baseline) return formatNumber(current);
|
||||
const ratio = ((current - baseline) / baseline) * 100;
|
||||
return `${ratio >= 0 ? "+" : ""}${ratio.toFixed(2)}%`;
|
||||
};
|
||||
|
||||
const diffClass = (current: number, baseline: number) => {
|
||||
if (!baseline) return "text-foreground";
|
||||
return current >= baseline ? "text-emerald-600" : "text-red-600";
|
||||
};
|
||||
|
||||
/* ─── Actions ─── */
|
||||
const retryCalc = async () => {
|
||||
await configStore.result.execute();
|
||||
};
|
||||
|
||||
const setStandard = () => {
|
||||
if (!resultState.value?.uuid) return;
|
||||
infoStore.setStandard(resultState.value, configStore.skillCountConfig);
|
||||
};
|
||||
|
||||
const clearStandard = () => {
|
||||
infoStore.setStandard(undefined);
|
||||
};
|
||||
|
||||
/* ─── Suit / oath skill ─── */
|
||||
const suit = computed(() => resultState.value?.suits?.suit);
|
||||
const oathSuit = computed(() => resultState.value?.suits?.oath);
|
||||
|
||||
const oathSkillsSorted = computed(() => {
|
||||
const skillOrder = ["2", "1", "3"];
|
||||
const res = [...(oathSuit.value?.skills ?? [])].sort((a, b) => {
|
||||
const ai = skillOrder.indexOf(a.skillId);
|
||||
const bi = skillOrder.indexOf(b.skillId);
|
||||
return (ai === -1 ? skillOrder.length : ai) - (bi === -1 ? skillOrder.length : bi);
|
||||
});
|
||||
return res.map((a) => ({
|
||||
...a,
|
||||
active:
|
||||
a.enable &&
|
||||
(a.skillId === configStore.config.oathSkill ||
|
||||
(!configStore.config.oathSkill && a.id === oathSuit.value?.id)),
|
||||
}));
|
||||
});
|
||||
|
||||
const selectOathSkill = (skill: { skillId: string; enable: boolean }) => {
|
||||
if (!skill.enable) return;
|
||||
configStore.config.oathSkill = skill.skillId;
|
||||
};
|
||||
|
||||
/* ─── Equipped items list ─── */
|
||||
const partOrder = [
|
||||
"武器", "上衣", "下装", "头肩", "腰带", "鞋",
|
||||
"项链", "手镯", "戒指", "辅助装备", "魔法石", "耳环",
|
||||
];
|
||||
|
||||
const equById = (id: string) => infoStore.equips.find((item) => item.id === id);
|
||||
|
||||
const adaptation = (part: string) => {
|
||||
const eq = equById(configStore.config.equips?.[part]?.id ?? "");
|
||||
return Math.min(eq?.max_adaptation ?? 0, configStore.config.equips?.[part]?.adaptation ?? 0);
|
||||
};
|
||||
|
||||
const rarityColor = (rarity: string): string => {
|
||||
switch (rarity) {
|
||||
case "太初": return "text-[#5aff62]";
|
||||
case "史诗":
|
||||
case "智慧产物": return "text-[#fcb600]";
|
||||
case "神话": return "text-[#f8c63d]";
|
||||
case "神器": return "text-[#ef28c1]";
|
||||
case "稀有": return "text-[#9879da]";
|
||||
case "传说": return "text-[#ff7700]";
|
||||
case "勇者": return "text-[#ff6666]";
|
||||
case "高级": return "text-[#68d5ed]";
|
||||
default: return "text-[#fcb600]";
|
||||
}
|
||||
};
|
||||
|
||||
const equippedParts = computed(() =>
|
||||
partOrder.filter((part) => !!configStore.config.equips?.[part]?.id),
|
||||
);
|
||||
|
||||
/* ─── Change sources ─── */
|
||||
const changeSources = computed(() => configStore.changeSourceLogs.slice(0, 8));
|
||||
const clearChangeSources = () => configStore.clearChangeSource();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex h-full min-h-0 flex-col gap-4 lg:flex-row">
|
||||
<!-- ══ Left panel: character info ══ -->
|
||||
<div
|
||||
class="flex w-full flex-none flex-col gap-3 lg:w-72 lg:overflow-y-auto lg:overflow-x-hidden"
|
||||
>
|
||||
<!-- Equipment / Oath grid -->
|
||||
<Card>
|
||||
<CardContent class="space-y-2 p-3">
|
||||
<Tabs :model-value="displayTab">
|
||||
<TabsList class="grid w-full grid-cols-2">
|
||||
<TabsTrigger value="equ" @click="displayTab = 'equ'">装备</TabsTrigger>
|
||||
<TabsTrigger value="oath" @click="displayTab = 'oath'">誓约</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
<div v-if="displayTab === 'equ'">
|
||||
<EquList
|
||||
v-model:part="equippedPart"
|
||||
:detail="configStore.config.equips"
|
||||
:with-sub-weapon="infoStore.infos?.alter?.includes('vegabond') ?? false"
|
||||
:with-pet="true"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<OathList v-model:part="equippedOathPart" :detail="configStore.config.oaths" />
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<!-- Character stats -->
|
||||
<Card v-if="resultState?.info?.length">
|
||||
<CardHeader class="pb-1 pt-3">
|
||||
<CardTitle class="text-xs text-muted-foreground">角色属性</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="pb-3">
|
||||
<div class="grid grid-cols-2 gap-x-3 gap-y-0.5 text-xs">
|
||||
<template v-for="info in resultState.info" :key="info.id">
|
||||
<div
|
||||
class="flex justify-between gap-1"
|
||||
:class="
|
||||
typeof info.value === 'string' && info.value.includes('/') ? 'col-span-2' : ''
|
||||
"
|
||||
>
|
||||
<span class="shrink-0 text-muted-foreground">{{ info.name }}</span>
|
||||
<span class="text-right font-medium text-emerald-600">{{ info.value }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<!-- Suit info + oath skills -->
|
||||
<Card v-if="suit || oathSuit">
|
||||
<CardContent class="space-y-1 px-3 py-2 text-xs">
|
||||
<div v-if="suit" class="flex items-center gap-1.5">
|
||||
<img
|
||||
:src="getImageURL(`/equipment${suit.imageUrl}`)"
|
||||
alt=""
|
||||
class="size-5 object-contain"
|
||||
/>
|
||||
<span :class="rarityColor(suit.rarity)" class="flex-1">{{ suit.name }} 套装</span>
|
||||
<span class="shrink-0 text-muted-foreground">{{ suit.rarity }}</span>
|
||||
<span class="shrink-0 font-medium">{{ suit.point }}点</span>
|
||||
</div>
|
||||
<div v-if="oathSuit" class="flex items-center gap-1.5">
|
||||
<img
|
||||
:src="getImageURL(`/equipment${oathSuit.imageUrl}`)"
|
||||
alt=""
|
||||
class="size-5 object-contain"
|
||||
/>
|
||||
<span :class="rarityColor(oathSuit.rarity)" class="flex-1"
|
||||
>{{ oathSuit.name }} 誓约</span
|
||||
>
|
||||
<span class="shrink-0 text-muted-foreground">{{ oathSuit.rarity }}</span>
|
||||
<span class="shrink-0 font-medium">{{ oathSuit.point }}点</span>
|
||||
</div>
|
||||
<!-- Oath skill selector -->
|
||||
<div
|
||||
v-if="oathSkillsSorted.length"
|
||||
class="flex items-center justify-center gap-4 pt-1"
|
||||
>
|
||||
<button
|
||||
v-for="skill in oathSkillsSorted"
|
||||
:key="skill.id"
|
||||
type="button"
|
||||
:disabled="!skill.enable"
|
||||
class="rounded-full transition-opacity"
|
||||
:class="[
|
||||
skill.enable ? 'cursor-pointer opacity-100' : 'cursor-not-allowed opacity-40',
|
||||
skill.active ? 'ring-2 ring-amber-400 ring-offset-1' : '',
|
||||
]"
|
||||
@click="selectOathSkill(skill)"
|
||||
>
|
||||
<img
|
||||
:src="getImageURL(skill.imageUrl)"
|
||||
:alt="skill.name"
|
||||
class="size-8 rounded-full object-contain"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<!-- Equipped items list -->
|
||||
<Card v-if="equippedParts.length">
|
||||
<CardHeader class="pb-1 pt-3">
|
||||
<CardTitle class="text-xs text-muted-foreground">穿戴装备信息</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="pb-2">
|
||||
<ScrollArea class="max-h-64">
|
||||
<div class="space-y-0.5 text-xs">
|
||||
<div
|
||||
v-for="part in equippedParts"
|
||||
:key="part"
|
||||
class="flex items-center gap-1.5 rounded px-1 py-0.5 hover:bg-muted/40"
|
||||
>
|
||||
<img
|
||||
:src="getImageURL(`/equipment/part/${part}.png`)"
|
||||
:alt="part"
|
||||
class="size-4 shrink-0 object-contain"
|
||||
/>
|
||||
<img
|
||||
v-if="adaptation(part) > 0"
|
||||
:src="getImageURL(`/equipment/adaptation/${adaptation(part)}.png`)"
|
||||
alt=""
|
||||
class="h-2.5 w-3 shrink-0 object-contain"
|
||||
/>
|
||||
<span
|
||||
v-if="(configStore.config.equips[part]?.reinforce ?? 0) > 0"
|
||||
class="shrink-0 font-medium"
|
||||
:class="
|
||||
configStore.config.equips[part]?.reinforceType === 1
|
||||
? 'text-[#ef28c1]'
|
||||
: 'text-[#68d5ed]'
|
||||
"
|
||||
>+{{ configStore.config.equips[part]?.reinforce }}</span
|
||||
>
|
||||
<span
|
||||
v-if="(configStore.config.equips[part]?.refine ?? 0) > 0"
|
||||
class="shrink-0 text-[#9879da]"
|
||||
>({{ configStore.config.equips[part]?.refine }})</span
|
||||
>
|
||||
<span
|
||||
class="truncate"
|
||||
:class="
|
||||
rarityColor(equById(configStore.config.equips[part]?.id ?? '')?.rarity ?? '')
|
||||
"
|
||||
>{{ equById(configStore.config.equips[part]?.id ?? '')?.name ?? "—" }}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<template #scrollbar>
|
||||
<ScrollBar orientation="vertical" />
|
||||
</template>
|
||||
</ScrollArea>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<!-- ══ Right panel: skill damage table ══ -->
|
||||
<div class="flex min-w-0 flex-1 flex-col gap-3">
|
||||
<!-- Action row -->
|
||||
<Card>
|
||||
<CardContent class="flex flex-wrap gap-2 pt-3 pb-3">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-8 px-2.5 text-xs sm:text-sm"
|
||||
@click="setStandard"
|
||||
>设为基准</Button
|
||||
>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-8 px-2.5 text-xs sm:text-sm"
|
||||
@click="clearStandard"
|
||||
>清空基准</Button
|
||||
>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<!-- Skill table card -->
|
||||
<Card class="min-h-0 flex-1">
|
||||
<CardHeader class="pb-2">
|
||||
<CardTitle class="text-sm">{{ isBufferClass ? "技能加成" : "技能伤害" }}</CardTitle>
|
||||
<CardDescription class="flex flex-wrap items-center gap-1.5">
|
||||
<Button
|
||||
v-if="!isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'damage' }"
|
||||
@click="skillSort = 'damage'"
|
||||
>
|
||||
按伤害
|
||||
</Button>
|
||||
<Button
|
||||
v-if="!isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'cd' }"
|
||||
@click="skillSort = 'cd'"
|
||||
>
|
||||
按 CD
|
||||
</Button>
|
||||
<Button
|
||||
v-if="isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'buff-main' }"
|
||||
@click="skillSort = 'buff-main'"
|
||||
>
|
||||
适用
|
||||
</Button>
|
||||
<Button
|
||||
v-if="isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'buff-atk' }"
|
||||
@click="skillSort = 'buff-atk'"
|
||||
>
|
||||
三攻
|
||||
</Button>
|
||||
<Button
|
||||
v-if="isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'buff-str' }"
|
||||
@click="skillSort = 'buff-str'"
|
||||
>
|
||||
力智
|
||||
</Button>
|
||||
<Button
|
||||
v-if="isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'buff-ratio' }"
|
||||
@click="skillSort = 'buff-ratio'"
|
||||
>
|
||||
增伤
|
||||
</Button>
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent class="flex h-full min-h-0 flex-col">
|
||||
<div v-if="isLoading" class="py-6 text-center text-sm text-muted-foreground">
|
||||
计算中...
|
||||
</div>
|
||||
<div
|
||||
v-else-if="resultError"
|
||||
class="flex flex-col items-center gap-3 py-6 text-center text-sm text-destructive"
|
||||
>
|
||||
<span>{{ resultError }}</span>
|
||||
<Button size="sm" variant="outline" @click="retryCalc">重试计算</Button>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="!hasVisibleResult || sortedSkills.length === 0"
|
||||
class="py-6 text-center text-sm text-muted-foreground"
|
||||
>
|
||||
暂无结果,请先编辑配置。
|
||||
</div>
|
||||
<div v-else class="flex h-full min-h-0 flex-col">
|
||||
<div class="min-h-0 flex-1 overflow-hidden rounded-md border">
|
||||
<ScrollArea class="h-full w-full">
|
||||
<table class="w-full table-fixed text-[11px] sm:text-xs">
|
||||
<colgroup v-if="!isBufferClass">
|
||||
<col class="w-[9.5rem] sm:w-[11rem]" />
|
||||
<col class="hidden sm:table-column sm:w-[4.25rem]" />
|
||||
<col class="w-[4.5rem]" />
|
||||
<col class="hidden md:table-column md:w-[5.5rem]" />
|
||||
<col class="w-[5.5rem] sm:w-[6rem]" />
|
||||
<col class="w-[4.5rem]" />
|
||||
</colgroup>
|
||||
<colgroup v-else>
|
||||
<col class="w-[9rem] sm:w-[10rem]" />
|
||||
<col class="hidden sm:table-column sm:w-[4.25rem]" />
|
||||
<col class="w-[4.75rem]" />
|
||||
<col class="w-[4.75rem]" />
|
||||
<col class="w-[4.75rem]" />
|
||||
<col class="w-[4.75rem]" />
|
||||
</colgroup>
|
||||
<thead class="sticky top-0 z-10 bg-muted/60">
|
||||
<tr v-if="!isBufferClass">
|
||||
<th class="px-1.5 py-1.5 text-left">技能</th>
|
||||
<th class="hidden px-1.5 py-1.5 text-right sm:table-cell">CD</th>
|
||||
<th class="px-1.5 py-1.5 text-right">次数</th>
|
||||
<th class="hidden px-1.5 py-1.5 text-right md:table-cell">秒伤</th>
|
||||
<th class="px-1.5 py-1.5 text-right">总伤害</th>
|
||||
<th class="px-1.5 py-1.5 text-right">占比</th>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<th class="px-1.5 py-1.5 text-left">技能</th>
|
||||
<th class="hidden px-1.5 py-1.5 text-right sm:table-cell">CD</th>
|
||||
<th class="px-1.5 py-1.5 text-right">适用</th>
|
||||
<th class="px-1.5 py-1.5 text-right">三攻</th>
|
||||
<th class="px-1.5 py-1.5 text-right">力智</th>
|
||||
<th class="px-1.5 py-1.5 text-right">增伤</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="skill in sortedSkills"
|
||||
:key="`${skill.name}-${skill.mode}`"
|
||||
class="border-t hover:bg-muted/30"
|
||||
>
|
||||
<td class="px-1.5 py-1.5">
|
||||
<div class="flex items-center gap-2">
|
||||
<img
|
||||
:src="skill.icon"
|
||||
:alt="skill.name"
|
||||
class="size-4 rounded-sm object-cover sm:size-5"
|
||||
/>
|
||||
<span class="max-w-[6.5rem] truncate sm:max-w-[8.5rem]"
|
||||
>{{ skill.name }}{{ skill.mode ? ` [${skill.mode}]` : "" }}</span
|
||||
>
|
||||
</div>
|
||||
</td>
|
||||
<td class="hidden px-1.5 py-1.5 text-right sm:table-cell">
|
||||
{{ skill.cd.toFixed(1) }}
|
||||
</td>
|
||||
<template v-if="!isBufferClass">
|
||||
<td class="px-1.5 py-1.5 text-right">
|
||||
<Input
|
||||
class="ml-auto h-7 w-12 px-1 text-right sm:w-14"
|
||||
type="number"
|
||||
:model-value="getSkillCount(skill)"
|
||||
@update:model-value="(value) => setSkillCount(skill, value)"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
class="hidden px-1.5 py-1.5 text-right text-muted-foreground md:table-cell"
|
||||
>
|
||||
{{
|
||||
formatNumber(
|
||||
skill.cd > 0 ? (skill.damage * getSkillCount(skill)) / skill.cd : 0,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
class="px-1.5 py-1.5 text-right font-medium"
|
||||
:class="
|
||||
diffClass(
|
||||
skill.damage * getSkillCount(skill),
|
||||
(getStandardSkill(skill)?.damage ?? 0) * getStandardSkillCount(skill),
|
||||
)
|
||||
"
|
||||
>
|
||||
{{
|
||||
formatDeltaPercent(
|
||||
skill.damage * getSkillCount(skill),
|
||||
(getStandardSkill(skill)?.damage ?? 0) * getStandardSkillCount(skill),
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td class="px-1.5 py-1.5 text-right text-muted-foreground">
|
||||
{{
|
||||
totalWeightedDamage > 0
|
||||
? formatPercent(
|
||||
(skill.damage * getSkillCount(skill) * 100) / totalWeightedDamage,
|
||||
)
|
||||
: "0.00%"
|
||||
}}
|
||||
</td>
|
||||
</template>
|
||||
<template v-else>
|
||||
<td class="hidden px-1.5 py-1.5 text-right sm:table-cell">
|
||||
{{ skill.cd.toFixed(1) }}
|
||||
</td>
|
||||
<td
|
||||
class="px-1.5 py-1.5 text-right"
|
||||
:class="
|
||||
diffClass(skill.buff?.[0] ?? 0, getStandardSkill(skill)?.buff?.[0] ?? 0)
|
||||
"
|
||||
>
|
||||
{{
|
||||
formatDeltaPercent(
|
||||
skill.buff?.[0] ?? 0,
|
||||
getStandardSkill(skill)?.buff?.[0] ?? 0,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
class="px-1.5 py-1.5 text-right"
|
||||
:class="
|
||||
diffClass(skill.buff?.[1] ?? 0, getStandardSkill(skill)?.buff?.[1] ?? 0)
|
||||
"
|
||||
>
|
||||
{{
|
||||
formatDeltaPercent(
|
||||
skill.buff?.[1] ?? 0,
|
||||
getStandardSkill(skill)?.buff?.[1] ?? 0,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
class="px-1.5 py-1.5 text-right"
|
||||
:class="
|
||||
diffClass(skill.buff?.[2] ?? 0, getStandardSkill(skill)?.buff?.[2] ?? 0)
|
||||
"
|
||||
>
|
||||
{{
|
||||
formatDeltaPercent(
|
||||
skill.buff?.[2] ?? 0,
|
||||
getStandardSkill(skill)?.buff?.[2] ?? 0,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
class="px-1.5 py-1.5 text-right"
|
||||
:class="
|
||||
diffClass(skill.buff?.[3] ?? 0, getStandardSkill(skill)?.buff?.[3] ?? 0)
|
||||
"
|
||||
>
|
||||
{{
|
||||
formatDeltaPercent(
|
||||
skill.buff?.[3] ?? 0,
|
||||
getStandardSkill(skill)?.buff?.[3] ?? 0,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
</template>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<template #scrollbar>
|
||||
<ScrollBar orientation="horizontal" />
|
||||
<ScrollBar orientation="vertical" />
|
||||
</template>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
<div
|
||||
v-if="!isBufferClass"
|
||||
class="mt-2 text-right text-sm font-semibold"
|
||||
:class="totalDiffClass"
|
||||
>
|
||||
合计:{{ totalDiffLabel }}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<!-- Change sources -->
|
||||
<Card>
|
||||
<CardHeader class="pb-1 pt-3">
|
||||
<CardTitle class="text-xs text-muted-foreground">配置变更来源</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="pb-3">
|
||||
<div class="space-y-1 text-xs">
|
||||
<div class="flex items-center justify-between pb-1">
|
||||
<span class="text-muted-foreground">用于回归定位最近触发计算的操作来源。</span>
|
||||
<Button size="sm" variant="ghost" class="h-6 px-2 text-xs" @click="clearChangeSources"
|
||||
>清空</Button
|
||||
>
|
||||
</div>
|
||||
<div v-if="changeSources.length === 0" class="text-muted-foreground">
|
||||
暂无变更来源记录。
|
||||
</div>
|
||||
<ScrollArea v-else class="max-h-40 rounded-md border border-border/60 p-2">
|
||||
<div class="space-y-1">
|
||||
<div
|
||||
v-for="item in changeSources"
|
||||
:key="item.id"
|
||||
class="rounded-md border border-border/60 bg-muted/20 px-2 py-1"
|
||||
>
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="font-medium">{{ item.source }}</span>
|
||||
<span class="text-muted-foreground">{{ item.time }}</span>
|
||||
</div>
|
||||
<div class="text-muted-foreground">{{ item.detail }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<template #scrollbar>
|
||||
<ScrollBar orientation="vertical" />
|
||||
</template>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -37,12 +37,14 @@ const tabs = [
|
||||
{ label: "装备", key: "equipment" },
|
||||
{ label: "技能", key: "skill" },
|
||||
{ label: "打造", key: "forge" },
|
||||
{ label: "计算详情", key: "result" },
|
||||
] as const;
|
||||
|
||||
const activeTab = computed(() => {
|
||||
const path = route.path;
|
||||
if (path.endsWith("/skill")) return "skill";
|
||||
if (path.endsWith("/forge")) return "forge";
|
||||
if (path.endsWith("/result")) return "result";
|
||||
return "equipment";
|
||||
});
|
||||
|
||||
@@ -111,39 +113,18 @@ onUnmounted(() => {
|
||||
|
||||
<template>
|
||||
<section class="mx-auto flex min-h-full w-full max-w-7xl flex-col gap-4 px-4 py-6 md:px-8">
|
||||
<Card class="flex-none">
|
||||
<CardHeader>
|
||||
<CardTitle class="flex items-center justify-between">
|
||||
<span>角色配置</span>
|
||||
<Button variant="outline" size="sm" :disabled="loading" @click="loadCharacter">
|
||||
<RefreshCcw :class="{ 'animate-spin': loading }" />
|
||||
刷新
|
||||
</Button>
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="flex flex-col gap-3 md:flex-row md:items-center md:justify-between">
|
||||
<Tabs :model-value="activeTab" class="gap-0">
|
||||
<TabsList>
|
||||
<TabsTrigger
|
||||
v-for="tab in tabs"
|
||||
:key="tab.key"
|
||||
:value="tab.key"
|
||||
@click="switchTab(tab.key)"
|
||||
>
|
||||
{{ tab.label }}
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
<div class="text-sm text-muted-foreground">
|
||||
<span v-if="loading" class="inline-flex items-center gap-2">
|
||||
<LoaderCircle class="size-4 animate-spin" />
|
||||
正在同步角色数据...
|
||||
</span>
|
||||
<span v-else-if="loadError">{{ loadError }}</span>
|
||||
<span v-else>数据源已就绪,可继续编辑配置。</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Tabs :model-value="activeTab" class="gap-0">
|
||||
<TabsList>
|
||||
<TabsTrigger
|
||||
v-for="tab in tabs"
|
||||
:key="tab.key"
|
||||
:value="tab.key"
|
||||
@click="switchTab(tab.key)"
|
||||
>
|
||||
{{ tab.label }}
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
|
||||
<div
|
||||
:class="[
|
||||
|
||||
@@ -3,14 +3,7 @@ import { computed, ref } from "vue";
|
||||
import type { IResultSkill } from "@/api/calc/type";
|
||||
import { useConfigStore, useInfoStore } from "@/stores";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import {
|
||||
Accordion,
|
||||
AccordionContent,
|
||||
AccordionItem,
|
||||
AccordionTrigger,
|
||||
} from "@/components/ui/accordion";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
|
||||
import Tabs from "@/components/ui/tabs/Tabs.vue";
|
||||
import TabsList from "@/components/ui/tabs/TabsList.vue";
|
||||
@@ -24,9 +17,6 @@ const infoStore = useInfoStore();
|
||||
const displayTab = ref<"equ" | "oath">("equ");
|
||||
const equippedPart = ref("");
|
||||
const equippedOathPart = ref("0");
|
||||
const skillSort = ref<"damage" | "cd" | "buff-main" | "buff-atk" | "buff-str" | "buff-ratio">(
|
||||
"damage",
|
||||
);
|
||||
|
||||
const resultState = computed(() => configStore.result.state);
|
||||
const isLoading = computed(() => configStore.result.isLoading);
|
||||
@@ -55,21 +45,11 @@ const getSkillCountEntry = (skill: IResultSkill) => {
|
||||
return created;
|
||||
};
|
||||
|
||||
const getSkillCount = (skill: IResultSkill) => {
|
||||
return Math.max(0, Number(getSkillCountEntry(skill).count) || 0);
|
||||
};
|
||||
const getSkillCount = (skill: IResultSkill) =>
|
||||
Math.max(0, Number(getSkillCountEntry(skill).count) || 0);
|
||||
|
||||
const setSkillCount = (skill: IResultSkill, raw: string | number) => {
|
||||
const parsed = Number(raw);
|
||||
const entry = getSkillCountEntry(skill);
|
||||
entry.count = Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
|
||||
};
|
||||
|
||||
const getStandardSkill = (skill: IResultSkill) => {
|
||||
return standard.value?.skills.find(
|
||||
(item) => item.name === skill.name && item.mode === skill.mode,
|
||||
);
|
||||
};
|
||||
const getStandardSkill = (skill: IResultSkill) =>
|
||||
standard.value?.skills.find((item) => item.name === skill.name && item.mode === skill.mode);
|
||||
|
||||
const getStandardSkillCount = (skill: IResultSkill) => {
|
||||
const count = standard.value?.skillCount.find(
|
||||
@@ -78,50 +58,32 @@ const getStandardSkillCount = (skill: IResultSkill) => {
|
||||
return Number(count ?? 0);
|
||||
};
|
||||
|
||||
const sortedSkills = computed(() => {
|
||||
const skills = [...(resultState.value?.skills ?? [])];
|
||||
if (isBufferClass.value) {
|
||||
const metricIndexMap: Record<string, number> = {
|
||||
"buff-main": 0,
|
||||
"buff-atk": 1,
|
||||
"buff-str": 2,
|
||||
"buff-ratio": 3,
|
||||
};
|
||||
const metricIndex = metricIndexMap[skillSort.value] ?? 2;
|
||||
return skills.sort(
|
||||
(left, right) => (right.buff?.[metricIndex] ?? 0) - (left.buff?.[metricIndex] ?? 0),
|
||||
);
|
||||
}
|
||||
if (skillSort.value === "cd") {
|
||||
return skills.sort((left, right) => left.cd - right.cd);
|
||||
}
|
||||
return skills.sort((left, right) => right.damage - left.damage);
|
||||
});
|
||||
const skills = computed(() => resultState.value?.skills ?? []);
|
||||
|
||||
const totalDamage = computed(() => {
|
||||
return sortedSkills.value.reduce((sum, item) => sum + item.damage, 0);
|
||||
});
|
||||
|
||||
const totalWeightedDamage = computed(() => {
|
||||
return sortedSkills.value.reduce((sum, item) => sum + item.damage * getSkillCount(item), 0);
|
||||
});
|
||||
const totalWeightedDamage = computed(() =>
|
||||
skills.value.reduce((sum, item) => sum + item.damage * getSkillCount(item), 0),
|
||||
);
|
||||
|
||||
const totalStandardDamage = computed(() => {
|
||||
if (!standard.value) return 0;
|
||||
return sortedSkills.value.reduce((sum, item) => {
|
||||
return skills.value.reduce((sum, item) => {
|
||||
const base = getStandardSkill(item);
|
||||
if (!base) return sum;
|
||||
const count = getStandardSkillCount(item);
|
||||
return sum + base.damage * count;
|
||||
return sum + base.damage * getStandardSkillCount(item);
|
||||
}, 0);
|
||||
});
|
||||
|
||||
const formatNumber = (value: number) => {
|
||||
if (!Number.isFinite(value)) return "0";
|
||||
if (Math.abs(value) >= 100000000) return `${(value / 100000000).toFixed(2)}e`;
|
||||
return value.toLocaleString("zh-CN", { maximumFractionDigits: 2 });
|
||||
};
|
||||
|
||||
const totalDiffLabel = computed(() => {
|
||||
if (!totalStandardDamage.value) return formatNumber(totalWeightedDamage.value);
|
||||
const diff =
|
||||
((totalWeightedDamage.value - totalStandardDamage.value) / totalStandardDamage.value) * 100;
|
||||
const prefix = diff >= 0 ? "+" : "";
|
||||
return `${prefix}${diff.toFixed(2)}%`;
|
||||
return `${diff >= 0 ? "+" : ""}${diff.toFixed(2)}%`;
|
||||
});
|
||||
|
||||
const totalDiffClass = computed(() => {
|
||||
@@ -131,400 +93,62 @@ const totalDiffClass = computed(() => {
|
||||
: "text-red-600";
|
||||
});
|
||||
|
||||
const formatNumber = (value: number) => {
|
||||
if (!Number.isFinite(value)) return "0";
|
||||
if (Math.abs(value) >= 100000000) {
|
||||
return `${(value / 100000000).toFixed(2)}e`;
|
||||
}
|
||||
return value.toLocaleString("zh-CN", { maximumFractionDigits: 2 });
|
||||
};
|
||||
|
||||
const setStandard = () => {
|
||||
if (!resultState.value?.uuid) return;
|
||||
infoStore.setStandard(resultState.value, configStore.skillCountConfig);
|
||||
};
|
||||
|
||||
const clearStandard = () => {
|
||||
infoStore.setStandard(undefined);
|
||||
};
|
||||
|
||||
const changeSources = computed(() => configStore.changeSourceLogs.slice(0, 8));
|
||||
|
||||
const clearChangeSources = () => {
|
||||
configStore.clearChangeSource();
|
||||
};
|
||||
|
||||
const formatPercent = (value: number) => `${value.toFixed(2)}%`;
|
||||
|
||||
const formatDeltaPercent = (current: number, baseline: number) => {
|
||||
if (!baseline) return formatNumber(current);
|
||||
const ratio = ((current - baseline) / baseline) * 100;
|
||||
return `${ratio >= 0 ? "+" : ""}${ratio.toFixed(2)}%`;
|
||||
};
|
||||
|
||||
const diffClass = (current: number, baseline: number) => {
|
||||
if (!baseline) return "text-foreground";
|
||||
return current >= baseline ? "text-emerald-600" : "text-red-600";
|
||||
};
|
||||
|
||||
const hasVisibleResult = computed(() => {
|
||||
return (resultState.value?.skills?.length ?? 0) > 0 || (resultState.value?.info?.length ?? 0) > 0;
|
||||
});
|
||||
|
||||
const defaultOpenSections = ["equipped", "changes"];
|
||||
const hasVisibleResult = computed(
|
||||
() => (resultState.value?.skills?.length ?? 0) > 0 || (resultState.value?.info?.length ?? 0) > 0,
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex h-full min-h-0 flex-col gap-3">
|
||||
<!-- 装备 / 誓约 列表 -->
|
||||
<Card>
|
||||
<CardHeader class="pb-2">
|
||||
<CardTitle class="text-base">结果面板</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent class="flex flex-wrap gap-2">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-8 px-2.5 text-xs sm:text-sm"
|
||||
@click="setStandard"
|
||||
>设为基准</Button
|
||||
>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-8 px-2.5 text-xs sm:text-sm"
|
||||
@click="clearStandard"
|
||||
>清空基准</Button
|
||||
>
|
||||
<CardContent class="pt-3 pb-3">
|
||||
<div class="space-y-2 text-xs">
|
||||
<Tabs :model-value="displayTab">
|
||||
<TabsList class="grid w-full grid-cols-2">
|
||||
<TabsTrigger value="equ" @click="displayTab = 'equ'">装备</TabsTrigger>
|
||||
<TabsTrigger value="oath" @click="displayTab = 'oath'">誓约</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
<ScrollArea class="max-h-56 rounded-md border p-2">
|
||||
<div v-if="displayTab === 'equ'">
|
||||
<EquList
|
||||
v-model:part="equippedPart"
|
||||
:detail="configStore.config.equips"
|
||||
:with-sub-weapon="(infoStore.infos?.alter?.includes('vegabond') ?? false)"
|
||||
:with-pet="true"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<OathList v-model:part="equippedOathPart" :detail="configStore.config.oaths" />
|
||||
</div>
|
||||
<template #scrollbar>
|
||||
<ScrollBar orientation="vertical" />
|
||||
</template>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<!-- 合计伤害 -->
|
||||
<Card>
|
||||
<CardContent class="pt-3">
|
||||
<Accordion type="multiple" :default-value="defaultOpenSections" class="w-full">
|
||||
<AccordionItem value="equipped" class="border-border/60">
|
||||
<AccordionTrigger>穿戴信息</AccordionTrigger>
|
||||
<AccordionContent>
|
||||
<div class="space-y-2 text-xs">
|
||||
<Tabs :model-value="displayTab">
|
||||
<TabsList class="grid w-full grid-cols-2">
|
||||
<TabsTrigger value="equ" @click="displayTab = 'equ'">装备</TabsTrigger>
|
||||
<TabsTrigger value="oath" @click="displayTab = 'oath'">誓约</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
|
||||
<ScrollArea class="max-h-56 rounded-md border p-2">
|
||||
<div v-if="displayTab === 'equ'">
|
||||
<EquList
|
||||
v-model:part="equippedPart"
|
||||
:detail="configStore.config.equips"
|
||||
:with-sub-weapon="(infoStore.infos?.alter?.includes('vegabond') ?? false)"
|
||||
:with-pet="true"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<OathList v-model:part="equippedOathPart" :detail="configStore.config.oaths" />
|
||||
</div>
|
||||
<template #scrollbar>
|
||||
<ScrollBar orientation="vertical" />
|
||||
</template>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem value="changes" class="border-border/60">
|
||||
<AccordionTrigger>配置变更来源</AccordionTrigger>
|
||||
<AccordionContent>
|
||||
<div class="space-y-1 text-xs">
|
||||
<div class="flex items-center justify-between pb-1">
|
||||
<span class="text-muted-foreground">用于回归定位最近触发计算的操作来源。</span>
|
||||
<Button size="sm" variant="ghost" @click="clearChangeSources">清空</Button>
|
||||
</div>
|
||||
|
||||
<div v-if="changeSources.length === 0" class="text-muted-foreground">
|
||||
暂无变更来源记录。
|
||||
</div>
|
||||
<ScrollArea v-else class="max-h-44 rounded-md border border-border/60 p-2">
|
||||
<div class="space-y-1">
|
||||
<div
|
||||
v-for="item in changeSources"
|
||||
:key="item.id"
|
||||
class="rounded-md border border-border/60 bg-muted/20 px-2 py-1"
|
||||
>
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="font-medium">{{ item.source }}</span>
|
||||
<span class="text-muted-foreground">{{ item.time }}</span>
|
||||
</div>
|
||||
<div class="text-muted-foreground">{{ item.detail }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<template #scrollbar>
|
||||
<ScrollBar orientation="vertical" />
|
||||
</template>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card class="min-h-0 flex-1">
|
||||
<CardHeader class="pb-2">
|
||||
<CardTitle class="text-sm">{{ isBufferClass ? "技能加成" : "技能伤害" }}</CardTitle>
|
||||
<CardDescription class="flex flex-wrap items-center gap-1.5">
|
||||
<Button
|
||||
v-if="!isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'damage' }"
|
||||
@click="skillSort = 'damage'"
|
||||
>
|
||||
按伤害
|
||||
</Button>
|
||||
<Button
|
||||
v-if="!isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'cd' }"
|
||||
@click="skillSort = 'cd'"
|
||||
>
|
||||
按 CD
|
||||
</Button>
|
||||
<Button
|
||||
v-if="isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'buff-main' }"
|
||||
@click="skillSort = 'buff-main'"
|
||||
>
|
||||
适用
|
||||
</Button>
|
||||
<Button
|
||||
v-if="isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'buff-atk' }"
|
||||
@click="skillSort = 'buff-atk'"
|
||||
>
|
||||
三攻
|
||||
</Button>
|
||||
<Button
|
||||
v-if="isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'buff-str' }"
|
||||
@click="skillSort = 'buff-str'"
|
||||
>
|
||||
力智
|
||||
</Button>
|
||||
<Button
|
||||
v-if="isBufferClass"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
class="h-7 px-2 text-xs"
|
||||
:class="{ 'text-foreground': skillSort === 'buff-ratio' }"
|
||||
@click="skillSort = 'buff-ratio'"
|
||||
>
|
||||
增伤
|
||||
</Button>
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent class="min-h-0 flex h-full flex-col">
|
||||
<div v-if="isLoading" class="py-6 text-center text-sm text-muted-foreground">计算中...</div>
|
||||
<CardContent class="px-4 py-3">
|
||||
<div v-if="isLoading" class="text-center text-sm text-muted-foreground">计算中...</div>
|
||||
<div
|
||||
v-else-if="resultError"
|
||||
class="flex flex-col items-center gap-3 py-6 text-center text-sm text-destructive"
|
||||
class="flex flex-col items-center gap-2 text-center text-sm text-destructive"
|
||||
>
|
||||
<span>{{ resultError }}</span>
|
||||
<Button size="sm" variant="outline" @click="retryCalc">重试计算</Button>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="!hasVisibleResult || sortedSkills.length === 0"
|
||||
class="py-6 text-center text-sm text-muted-foreground"
|
||||
>
|
||||
<div v-else-if="!hasVisibleResult" class="text-center text-sm text-muted-foreground">
|
||||
暂无结果,请先编辑配置。
|
||||
</div>
|
||||
<div v-else class="flex min-h-0 h-full flex-col">
|
||||
<div class="min-h-0 flex-1 overflow-hidden rounded-md border">
|
||||
<ScrollArea class="h-full w-full">
|
||||
<table class="w-full table-fixed text-[11px] sm:text-xs">
|
||||
<colgroup v-if="!isBufferClass">
|
||||
<col class="w-[9.5rem] sm:w-[11rem]" />
|
||||
<col class="hidden sm:table-column sm:w-[4.25rem]" />
|
||||
<col class="w-[4.5rem]" />
|
||||
<col class="hidden md:table-column md:w-[5.5rem]" />
|
||||
<col class="w-[5.5rem] sm:w-[6rem]" />
|
||||
<col class="w-[4.5rem]" />
|
||||
</colgroup>
|
||||
<colgroup v-else>
|
||||
<col class="w-[9rem] sm:w-[10rem]" />
|
||||
<col class="hidden sm:table-column sm:w-[4.25rem]" />
|
||||
<col class="w-[4.75rem]" />
|
||||
<col class="w-[4.75rem]" />
|
||||
<col class="w-[4.75rem]" />
|
||||
<col class="w-[4.75rem]" />
|
||||
</colgroup>
|
||||
<thead class="bg-muted/60 sticky top-0 z-10">
|
||||
<tr v-if="!isBufferClass">
|
||||
<th class="px-1.5 py-1.5 text-left">技能</th>
|
||||
<th class="hidden px-1.5 py-1.5 text-right sm:table-cell">CD</th>
|
||||
<th class="px-1.5 py-1.5 text-right">次数</th>
|
||||
<th class="hidden px-1.5 py-1.5 text-right md:table-cell">秒伤</th>
|
||||
<th class="px-1.5 py-1.5 text-right">总伤害</th>
|
||||
<th class="px-1.5 py-1.5 text-right">占比</th>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<th class="px-1.5 py-1.5 text-left">技能</th>
|
||||
<th class="hidden px-1.5 py-1.5 text-right sm:table-cell">CD</th>
|
||||
<th class="px-1.5 py-1.5 text-right">适用</th>
|
||||
<th class="px-1.5 py-1.5 text-right">三攻</th>
|
||||
<th class="px-1.5 py-1.5 text-right">力智</th>
|
||||
<th class="px-1.5 py-1.5 text-right">增伤</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="skill in sortedSkills"
|
||||
:key="`${skill.name}-${skill.mode}`"
|
||||
class="border-t hover:bg-muted/30"
|
||||
>
|
||||
<td class="px-1.5 py-1.5">
|
||||
<div class="flex items-center gap-2">
|
||||
<img
|
||||
:src="skill.icon"
|
||||
:alt="skill.name"
|
||||
class="size-4 rounded-sm object-cover sm:size-5"
|
||||
/>
|
||||
<span class="max-w-[6.5rem] truncate sm:max-w-[8.5rem]"
|
||||
>{{ skill.name }}{{ skill.mode ? ` [${skill.mode}]` : "" }}</span
|
||||
>
|
||||
</div>
|
||||
</td>
|
||||
<td class="hidden px-1.5 py-1.5 text-right sm:table-cell">
|
||||
{{ skill.cd.toFixed(1) }}
|
||||
</td>
|
||||
<template v-if="!isBufferClass">
|
||||
<td class="px-1.5 py-1.5 text-right">
|
||||
<Input
|
||||
class="ml-auto h-7 w-12 px-1 text-right sm:w-14"
|
||||
type="number"
|
||||
:model-value="getSkillCount(skill)"
|
||||
@update:model-value="(value) => setSkillCount(skill, value)"
|
||||
/>
|
||||
</td>
|
||||
<td class="hidden px-1.5 py-1.5 text-right text-muted-foreground md:table-cell">
|
||||
{{
|
||||
formatNumber(
|
||||
skill.cd > 0 ? (skill.damage * getSkillCount(skill)) / skill.cd : 0,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
class="px-1.5 py-1.5 text-right font-medium"
|
||||
:class="
|
||||
diffClass(
|
||||
skill.damage * getSkillCount(skill),
|
||||
(getStandardSkill(skill)?.damage ?? 0) * getStandardSkillCount(skill),
|
||||
)
|
||||
"
|
||||
>
|
||||
{{
|
||||
formatDeltaPercent(
|
||||
skill.damage * getSkillCount(skill),
|
||||
(getStandardSkill(skill)?.damage ?? 0) * getStandardSkillCount(skill),
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td class="px-1.5 py-1.5 text-right text-muted-foreground">
|
||||
{{
|
||||
totalWeightedDamage > 0
|
||||
? formatPercent(
|
||||
(skill.damage * getSkillCount(skill) * 100) / totalWeightedDamage,
|
||||
)
|
||||
: "0.00%"
|
||||
}}
|
||||
</td>
|
||||
</template>
|
||||
<template v-else>
|
||||
<td class="hidden px-1.5 py-1.5 text-right sm:table-cell">
|
||||
{{ skill.cd.toFixed(1) }}
|
||||
</td>
|
||||
<td
|
||||
class="px-1.5 py-1.5 text-right"
|
||||
:class="
|
||||
diffClass(skill.buff?.[0] ?? 0, getStandardSkill(skill)?.buff?.[0] ?? 0)
|
||||
"
|
||||
>
|
||||
{{
|
||||
formatDeltaPercent(
|
||||
skill.buff?.[0] ?? 0,
|
||||
getStandardSkill(skill)?.buff?.[0] ?? 0,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
class="px-1.5 py-1.5 text-right"
|
||||
:class="
|
||||
diffClass(skill.buff?.[1] ?? 0, getStandardSkill(skill)?.buff?.[1] ?? 0)
|
||||
"
|
||||
>
|
||||
{{
|
||||
formatDeltaPercent(
|
||||
skill.buff?.[1] ?? 0,
|
||||
getStandardSkill(skill)?.buff?.[1] ?? 0,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
class="px-1.5 py-1.5 text-right"
|
||||
:class="
|
||||
diffClass(skill.buff?.[2] ?? 0, getStandardSkill(skill)?.buff?.[2] ?? 0)
|
||||
"
|
||||
>
|
||||
{{
|
||||
formatDeltaPercent(
|
||||
skill.buff?.[2] ?? 0,
|
||||
getStandardSkill(skill)?.buff?.[2] ?? 0,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
class="px-1.5 py-1.5 text-right"
|
||||
:class="
|
||||
diffClass(skill.buff?.[3] ?? 0, getStandardSkill(skill)?.buff?.[3] ?? 0)
|
||||
"
|
||||
>
|
||||
{{
|
||||
formatDeltaPercent(
|
||||
skill.buff?.[3] ?? 0,
|
||||
getStandardSkill(skill)?.buff?.[3] ?? 0,
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
</template>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<template #scrollbar>
|
||||
<ScrollBar orientation="horizontal" />
|
||||
<ScrollBar orientation="vertical" />
|
||||
</template>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
<div
|
||||
v-if="!isBufferClass"
|
||||
class="mt-2 text-right text-sm font-semibold"
|
||||
:class="totalDiffClass"
|
||||
>
|
||||
合计:{{ totalDiffLabel }}
|
||||
</div>
|
||||
<div v-else-if="!isBufferClass" class="flex items-center justify-between">
|
||||
<span class="text-sm text-muted-foreground">合计伤害</span>
|
||||
<span class="text-sm font-semibold" :class="totalDiffClass">{{ totalDiffLabel }}</span>
|
||||
</div>
|
||||
<div v-else class="text-center text-sm text-muted-foreground">请前往计算详情查看。</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import api from "@/api";
|
||||
|
||||
const props = defineProps<{
|
||||
skillId: string;
|
||||
level: number;
|
||||
}>();
|
||||
|
||||
const skillInfo = asyncComputed(async () => {
|
||||
if (!props.skillId || props.level == null) return undefined;
|
||||
return await api.skillDetail(props.skillId, props.level);
|
||||
});
|
||||
|
||||
const basic = computed(() => {
|
||||
const info = skillInfo.value;
|
||||
if (!info) return [];
|
||||
return [
|
||||
{ label: "技能等级", value: info.attribute.level },
|
||||
{ label: "学习等级", value: info.requiredLevel },
|
||||
{ label: "等级上限", value: info.maxLevel },
|
||||
{
|
||||
label: "冷却时间",
|
||||
value: info.attribute.coolTime ? `${info.attribute.coolTime.toFixed(1)}秒` : undefined,
|
||||
},
|
||||
{
|
||||
label: "施放时间",
|
||||
value: !info.attribute.castingTime
|
||||
? "瞬发"
|
||||
: `${info.attribute.castingTime.toFixed(1)}秒`,
|
||||
},
|
||||
{ label: "魔法值", value: info.attribute.consumeMp },
|
||||
{
|
||||
label: "消耗无色小晶块",
|
||||
value: info.consumeItem?.value ? `${info.consumeItem.value}个` : undefined,
|
||||
},
|
||||
].filter((item) => item.value !== undefined && item.value !== null && item.value !== "");
|
||||
});
|
||||
|
||||
const descLines = computed(() => skillInfo.value?.descDetail.split("\n") ?? []);
|
||||
|
||||
const detailLines = computed(() => {
|
||||
const items =
|
||||
skillInfo.value?.attribute.optionDesc?.split("\n").filter((item) => !!item) ?? [];
|
||||
return items.map((a) => {
|
||||
// highlight value placeholder prefix
|
||||
const beforeReplace = a.match(/^(.+?)\s*(\{value\d+\}.*)$/);
|
||||
if (beforeReplace) {
|
||||
a = `${beforeReplace[1]}<span class="detail-label-suffix">${beforeReplace[2]}</span>`;
|
||||
}
|
||||
const matches = a.match(/\{([^}]+)\}/g);
|
||||
if (matches) {
|
||||
matches.forEach((match) => {
|
||||
const key = match.replace(/[{}]/g, "");
|
||||
if (/^value.+/.test(key)) {
|
||||
const value =
|
||||
skillInfo.value?.attribute.optionValue[key as `value${string}`] ?? "-";
|
||||
a = a.replace(
|
||||
match,
|
||||
`<span style="padding:0 2px;color:var(--color-skill-value,#4AA256)">${value}</span>`,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
return a;
|
||||
});
|
||||
});
|
||||
|
||||
const hasEvolution = computed(() => (skillInfo.value?.evolution?.length ?? 0) > 0);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="!skillInfo" class="flex items-center justify-center h-16 text-xs text-muted-foreground">
|
||||
加载中…
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<!-- ── 基本信息 ── -->
|
||||
<div>
|
||||
<div class="text-xs font-semibold text-muted-foreground mb-1.5 uppercase tracking-wide">
|
||||
基本信息
|
||||
</div>
|
||||
<div class="rounded-md border border-border/40 bg-muted/10 divide-y divide-border/30">
|
||||
<div
|
||||
v-for="item in basic"
|
||||
:key="item.label"
|
||||
class="flex items-center justify-between px-3 py-1.5 text-xs"
|
||||
>
|
||||
<span class="text-muted-foreground">{{ item.label }}</span>
|
||||
<span class="tabular-nums font-medium">{{ item.value }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── 技能描述 ── -->
|
||||
<div v-if="descLines.length">
|
||||
<div class="text-xs font-semibold text-muted-foreground mb-1.5 uppercase tracking-wide">
|
||||
技能描述
|
||||
</div>
|
||||
<div
|
||||
class="rounded-md border border-border/40 bg-muted/10 px-3 py-2 text-xs leading-relaxed max-h-48 overflow-y-auto"
|
||||
>
|
||||
<div
|
||||
v-for="(line, i) in descLines"
|
||||
:key="i"
|
||||
class="min-h-[1em] whitespace-pre-wrap text-muted-foreground"
|
||||
>
|
||||
{{ line }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── 技能属性 ── -->
|
||||
<div v-if="detailLines.length">
|
||||
<div class="text-xs font-semibold text-muted-foreground mb-1.5 uppercase tracking-wide">
|
||||
技能属性
|
||||
</div>
|
||||
<div class="rounded-md border border-border/40 bg-muted/10 divide-y divide-border/30">
|
||||
<div
|
||||
v-for="(line, i) in detailLines"
|
||||
:key="i"
|
||||
class="flex items-center justify-between px-3 py-1.5 text-xs"
|
||||
v-html="line"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── 技能进化 (VP 描述) ── -->
|
||||
<div v-if="hasEvolution">
|
||||
<div class="text-xs font-semibold text-muted-foreground mb-1.5 uppercase tracking-wide">
|
||||
技能进化
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<div
|
||||
v-for="(evo, i) in skillInfo.evolution"
|
||||
:key="i"
|
||||
class="rounded-md border border-border/40 bg-muted/10 p-3"
|
||||
>
|
||||
<div class="text-xs font-semibold text-purple-400 mb-1.5">{{ evo.name }}</div>
|
||||
<div
|
||||
class="text-xs leading-relaxed text-muted-foreground whitespace-pre-wrap max-h-36 overflow-y-auto"
|
||||
>{{ evo.descDetail }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
@@ -8,6 +8,14 @@ import TabsTrigger from "@/components/ui/tabs/TabsTrigger.vue";
|
||||
import { getImageURL } from "@/utils";
|
||||
import type { ISkill } from "@/api/info/type";
|
||||
import ResultPanel from "@/pages/Dcalc/Character/Result/Index.vue";
|
||||
import SkillDetailPanel from "./components/SkillDetail/index.vue";
|
||||
import vp1Img from "./img/vp_1.png";
|
||||
import vp2Img from "./img/vp_2.png";
|
||||
import up1Img from "./img/up_1.png";
|
||||
import up2Img from "./img/up_2.png";
|
||||
|
||||
const vpImg = (mode: number) => (mode === 1 ? vp1Img : vp2Img);
|
||||
const upImg = (mode: number) => (mode === 1 ? up1Img : up2Img);
|
||||
|
||||
const infoStore = useInfoStore();
|
||||
const configStore = useConfigStore();
|
||||
@@ -307,12 +315,16 @@ const resetAllSkills = () => {
|
||||
@click.stop="chooseSkill(skill.id.toString())"
|
||||
>
|
||||
<div class="badge-row">
|
||||
<span v-if="skillCfg(skill.id.toString()).vp > 0" class="badge badge-vp"
|
||||
>VP</span
|
||||
>
|
||||
<span v-if="skillCfg(skill.id.toString()).up > 0" class="badge badge-up"
|
||||
>UP</span
|
||||
>
|
||||
<img
|
||||
v-if="skillCfg(skill.id.toString()).vp > 0"
|
||||
:src="vpImg(skillCfg(skill.id.toString()).vp)"
|
||||
class="badge-img"
|
||||
/>
|
||||
<img
|
||||
v-if="skillCfg(skill.id.toString()).up > 0"
|
||||
:src="upImg(skillCfg(skill.id.toString()).up)"
|
||||
class="badge-img"
|
||||
/>
|
||||
</div>
|
||||
<img
|
||||
:src="getImageURL(skill.icon)"
|
||||
@@ -357,12 +369,16 @@ const resetAllSkills = () => {
|
||||
>
|
||||
<template v-if="cell">
|
||||
<div class="badge-row">
|
||||
<span v-if="skillCfg(cell.id.toString()).vp > 0" class="badge badge-vp"
|
||||
>VP</span
|
||||
>
|
||||
<span v-if="skillCfg(cell.id.toString()).up > 0" class="badge badge-up"
|
||||
>UP</span
|
||||
>
|
||||
<img
|
||||
v-if="skillCfg(cell.id.toString()).vp > 0"
|
||||
:src="vpImg(skillCfg(cell.id.toString()).vp)"
|
||||
class="badge-img"
|
||||
/>
|
||||
<img
|
||||
v-if="skillCfg(cell.id.toString()).up > 0"
|
||||
:src="upImg(skillCfg(cell.id.toString()).up)"
|
||||
class="badge-img"
|
||||
/>
|
||||
</div>
|
||||
<img
|
||||
:src="getImageURL(cell.icon)"
|
||||
@@ -643,61 +659,63 @@ const resetAllSkills = () => {
|
||||
|
||||
<!-- Skill detail -->
|
||||
<div v-if="selectedSkill" class="flex-1 overflow-y-auto p-5 space-y-5">
|
||||
<!-- Header -->
|
||||
<div class="flex items-center gap-3">
|
||||
<img
|
||||
:src="getImageURL(selectedSkill.icon)"
|
||||
:alt="selectedSkill.name"
|
||||
class="w-14 h-14 rounded-lg object-cover border border-border/60"
|
||||
/>
|
||||
<div>
|
||||
<div class="text-base font-semibold">{{ selectedSkill.name }}</div>
|
||||
<div class="text-xs text-muted-foreground mt-1">
|
||||
{{ selectedSkill.type === "passive" ? "被动" : "主动" }} · Lv
|
||||
{{ selectedSkill.learnLv }} 解锁
|
||||
<!-- Header + Level control: left-right layout -->
|
||||
<div class="flex items-center gap-4">
|
||||
<!-- Left: icon + name + type -->
|
||||
<div class="flex items-center gap-3 flex-1 min-w-0">
|
||||
<img
|
||||
:src="getImageURL(selectedSkill.icon)"
|
||||
:alt="selectedSkill.name"
|
||||
class="w-14 h-14 shrink-0 rounded-lg object-cover border border-border/60"
|
||||
/>
|
||||
<div class="min-w-0">
|
||||
<div class="text-base font-semibold truncate">{{ selectedSkill.name }}</div>
|
||||
<div class="text-xs text-muted-foreground mt-1">
|
||||
{{ selectedSkill.type === "passive" ? "被动" : "主动" }} · Lv
|
||||
{{ selectedSkill.learnLv }} 解锁
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Level control -->
|
||||
<div>
|
||||
<div class="flex items-baseline gap-2 mb-2.5">
|
||||
<span
|
||||
class="text-4xl font-bold tabular-nums"
|
||||
:style="{ color: lvColor(selectedSkill.id.toString(), selectedSkill.maxLearnLv) }"
|
||||
>{{ skillCfg(selectedSkill.id.toString()).lv }}</span
|
||||
>
|
||||
<span class="text-xs text-muted-foreground">/ 满 {{ selectedSkill.maxLearnLv }}</span>
|
||||
</div>
|
||||
<div class="flex gap-1.5">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-7 px-2.5 text-xs"
|
||||
@click="resetLv(selectedSkill.id.toString())"
|
||||
>归零</Button
|
||||
>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-7 px-2.5 text-xs"
|
||||
@click="stepLv(selectedSkill.id.toString(), -1)"
|
||||
>−1</Button
|
||||
>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-7 px-2.5 text-xs"
|
||||
@click="stepLv(selectedSkill.id.toString(), 1)"
|
||||
>+1</Button
|
||||
>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-7 px-2.5 text-xs"
|
||||
@click="setMaxLv(selectedSkill.id.toString())"
|
||||
>满级</Button
|
||||
>
|
||||
<!-- Right: level number + buttons -->
|
||||
<div class="shrink-0 flex flex-col items-end gap-2">
|
||||
<div class="flex items-baseline gap-1.5">
|
||||
<span
|
||||
class="text-3xl font-bold tabular-nums"
|
||||
:style="{ color: lvColor(selectedSkill.id.toString(), selectedSkill.maxLearnLv) }"
|
||||
>{{ skillCfg(selectedSkill.id.toString()).lv }}</span
|
||||
>
|
||||
<span class="text-xs text-muted-foreground">/ {{ selectedSkill.maxLearnLv }}</span>
|
||||
</div>
|
||||
<div class="flex gap-1">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-7 px-2 text-xs"
|
||||
@click="resetLv(selectedSkill.id.toString())"
|
||||
>归零</Button
|
||||
>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-7 px-2 text-xs"
|
||||
@click="stepLv(selectedSkill.id.toString(), -1)"
|
||||
>−1</Button
|
||||
>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-7 px-2 text-xs"
|
||||
@click="stepLv(selectedSkill.id.toString(), 1)"
|
||||
>+1</Button
|
||||
>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
class="h-7 px-2 text-xs"
|
||||
@click="setMaxLv(selectedSkill.id.toString())"
|
||||
>满级</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -749,6 +767,12 @@ const resetAllSkills = () => {
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- API-fetched skill detail: 基本信息 / 技能描述 / 技能属性 / 技能进化 -->
|
||||
<SkillDetailPanel
|
||||
:skill-id="selectedSkill.uuid"
|
||||
:level="skillCfg(selectedSkill.id.toString()).lv"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Empty state -->
|
||||
@@ -788,17 +812,11 @@ const resetAllSkills = () => {
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
}
|
||||
.badge {
|
||||
font-size: 8px;
|
||||
line-height: 14px;
|
||||
font-weight: 700;
|
||||
.badge-img {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
object-fit: contain;
|
||||
}
|
||||
.badge-vp {
|
||||
color: #c084fc;
|
||||
} /* purple-400 */
|
||||
.badge-up {
|
||||
color: #fb923c;
|
||||
} /* amber-400 */
|
||||
|
||||
/* 28×28px icon at y=14px */
|
||||
.skill-icon {
|
||||
|
||||
@@ -52,6 +52,11 @@ const router = createRouter({
|
||||
name: "character-forge",
|
||||
component: () => import("@/pages/Dcalc/Character/Forge/index.vue"),
|
||||
},
|
||||
{
|
||||
path: "result",
|
||||
name: "character-result",
|
||||
component: () => import("@/pages/Dcalc/Character/CalcDetail/index.vue"),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user