@dumiflex/wp-kit 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -51
- package/LICENSE +674 -674
- package/README.md +73 -76
- package/package.json +78 -77
- package/src/Avatar.vue +83 -83
- package/src/Badge.vue +97 -97
- package/src/Banner.vue +118 -118
- package/src/BookmarkButton.vue +27 -27
- package/src/BundleMeta.vue +51 -51
- package/src/Button.vue +103 -103
- package/src/Card.vue +68 -68
- package/src/Checkbox.vue +109 -107
- package/src/Chip.vue +163 -97
- package/src/ChoiceCards.vue +133 -133
- package/src/CloseButton.vue +69 -69
- package/src/CodeBlock.vue +119 -119
- package/src/ColorField.vue +188 -206
- package/src/ColorPicker.vue +201 -201
- package/src/Combobox.vue +331 -334
- package/src/ConfirmDialog.vue +165 -163
- package/src/ConfirmModal.vue +147 -147
- package/src/ConstraintMatrixPreview.vue +708 -708
- package/src/ContextMenu.vue +386 -379
- package/src/CopyButton.vue +156 -156
- package/src/DataTable.vue +292 -292
- package/src/DatePicker.vue +234 -234
- package/src/DescriptionList.vue +73 -73
- package/src/DiffView.vue +68 -68
- package/src/Disclosure.vue +166 -166
- package/src/DragHandle.vue +49 -49
- package/src/Drawer.vue +131 -131
- package/src/DropZone.vue +196 -196
- package/src/DropdownMenu.vue +72 -72
- package/src/EmptyState.vue +111 -111
- package/src/Field.vue +28 -28
- package/src/HsvPicker.vue +208 -208
- package/src/Icon.vue +39 -39
- package/src/IconPicker.vue +209 -209
- package/src/ImageGrid.vue +125 -125
- package/src/InlineEdit.vue +183 -183
- package/src/Input.vue +99 -99
- package/src/Kbd.vue +56 -56
- package/src/Lightbox.vue +173 -173
- package/src/ListFilter.vue +85 -85
- package/src/ListRow.vue +204 -204
- package/src/LoadingMark.vue +175 -161
- package/src/Logo.vue +60 -60
- package/src/Modal.vue +78 -76
- package/src/ModalShell.vue +109 -107
- package/src/Pagination.vue +106 -106
- package/src/Popover.vue +180 -171
- package/src/PostCard.vue +210 -211
- package/src/ProgressBar.vue +90 -90
- package/src/RadioGroup.vue +177 -177
- package/src/RangeSlider.vue +183 -183
- package/src/RelativeDate.vue +35 -35
- package/src/ResizeHandle.vue +143 -143
- package/src/SearchInput.vue +192 -199
- package/src/Select.vue +644 -641
- package/src/Separator.vue +54 -54
- package/src/Skeleton.vue +82 -82
- package/src/Slider.vue +198 -198
- package/src/SortableList.vue +260 -260
- package/src/SplitPane.vue +68 -68
- package/src/StarButton.vue +40 -40
- package/src/Stepper.vue +141 -141
- package/src/SupportLinks.vue +93 -93
- package/src/TagInput.vue +297 -300
- package/src/Textarea.vue +57 -57
- package/src/Timeline.vue +92 -92
- package/src/ToastCard.vue +119 -119
- package/src/ToastHost.vue +40 -40
- package/src/Toggle.vue +36 -36
- package/src/TokenizedValue.vue +310 -310
- package/src/Toolbar.vue +110 -110
- package/src/VirtualList.vue +87 -87
- package/src/VisuallyHidden.vue +29 -29
- package/src/WpButton.vue +75 -75
- package/src/WpCheck.vue +104 -102
- package/src/WpIconButton.vue +107 -107
- package/src/WpImageZoom.vue +544 -544
- package/src/WpNumber.vue +178 -183
- package/src/WpSegmented.vue +175 -175
- package/src/WpSelect.vue +93 -89
- package/src/WpSwitch.vue +163 -163
- package/src/WpTabs.vue +188 -188
- package/src/_modal-motion.css +33 -33
- package/src/_skeleton.css +50 -50
- package/src/axis-color.ts +42 -42
- package/src/button.css +169 -169
- package/src/calendar.ts +59 -59
- package/src/clipboard.ts +50 -50
- package/src/colour-presets.ts +12 -12
- package/src/diff.ts +51 -51
- package/src/drop-zone.ts +41 -41
- package/src/field.css +50 -0
- package/src/flip.ts +237 -237
- package/src/floating-layer.ts +48 -0
- package/src/floating.ts +99 -99
- package/src/hsv.ts +100 -100
- package/src/icon-catalog.ts +52 -52
- package/src/image-zoom.ts +93 -93
- package/src/kind-colour.ts +28 -0
- package/src/logo-paths.ts +21 -21
- package/src/matrix-axis.ts +91 -91
- package/src/pagination.ts +27 -27
- package/src/platform-keys.ts +29 -29
- package/src/rich-tokenize.ts +357 -357
- package/src/select-types.ts +32 -32
- package/src/slider-math.ts +45 -45
- package/src/sortable.ts +22 -22
- package/src/theme/fonts/OFL-Fraunces.txt +93 -93
- package/src/theme/fonts/OFL-JetBrainsMono.txt +93 -93
- package/src/theme/fonts/OFL-Manrope.txt +93 -93
- package/src/theme/looks.css +428 -428
- package/src/theme/palettes.css +254 -254
- package/src/theme/tokens.css +2896 -2894
- package/src/tokens.ts +56 -56
- package/src/tooltip.css +43 -43
- package/src/tooltip.ts +146 -146
- package/src/useDialogFocus.ts +73 -73
- package/src/useGrowableField.ts +357 -357
- package/src/useModalKeyShield.ts +116 -116
- package/src/useToast.ts +48 -48
- package/src/wp-logo.svg +14 -14
- package/src/ChipToggle.vue +0 -92
- package/src/KindChip.vue +0 -53
- package/src/RatingBadge.vue +0 -42
package/src/PostCard.vue
CHANGED
|
@@ -1,211 +1,210 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* A community post as a card: type chip, NSFW / Featured / recommended
|
|
4
|
-
* badges, version, `owner/name` slug, bundle contents, description, up to
|
|
5
|
-
* four tags, then stars, downloads and when it was updated. A coloured stripe
|
|
6
|
-
* on top says the type; a featured card is tinted, a deleted one faded.
|
|
7
|
-
*
|
|
8
|
-
* The whole card is one link. It renders an `<a>` by default; pass the app's
|
|
9
|
-
* router link as `as` (and its `to`) so the kit never imports a router:
|
|
10
|
-
*
|
|
11
|
-
* <PostCard :as="RouterLink" :to="`/p/${post.slug}`" :post="card(post)" />
|
|
12
|
-
* <PostCard href="/p/dumi/warm" :post="…" />
|
|
13
|
-
* <PostCard as="button" type="button" :post="…" @click="open" />
|
|
14
|
-
*/
|
|
15
|
-
import { computed, type Component } from "vue";
|
|
16
|
-
import BundleMeta from "./BundleMeta.vue";
|
|
17
|
-
import Icon from "./Icon.vue";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import RelativeDate from "./RelativeDate.vue";
|
|
21
|
-
|
|
22
|
-
export interface PostCardData {
|
|
23
|
-
/** `owner/name`. */
|
|
24
|
-
slug: string;
|
|
25
|
-
kind: "module" | "bundle";
|
|
26
|
-
subtype?:
|
|
27
|
-
description?: string | undefined;
|
|
28
|
-
tags?: string[] | undefined;
|
|
29
|
-
stars: number;
|
|
30
|
-
downloads: number;
|
|
31
|
-
/** ISO time of the last update. */
|
|
32
|
-
updatedAt: string;
|
|
33
|
-
rating?: "sfw" | "nsfw" | undefined;
|
|
34
|
-
featured?: boolean | undefined;
|
|
35
|
-
/** The latest version is marked recommended. */
|
|
36
|
-
recommended?: boolean | undefined;
|
|
37
|
-
/** Soft-deleted: the card fades and shows "deleted" where the version goes. */
|
|
38
|
-
deleted?: boolean | undefined;
|
|
39
|
-
version?: number | null | undefined;
|
|
40
|
-
bundleModules?: { count: number; names: string[] } | null | undefined;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const props = withDefaults(defineProps<{
|
|
44
|
-
post: PostCardData;
|
|
45
|
-
/** The viewer starred it: the star in the footer fills. */
|
|
46
|
-
starred?: boolean | undefined;
|
|
47
|
-
/** Element or component for the link, e.g. the app's RouterLink. */
|
|
48
|
-
as?: string | Component | undefined;
|
|
49
|
-
}>(), { starred: false, as: "a" });
|
|
50
|
-
|
|
51
|
-
const type = computed(() => (props.post.kind
|
|
52
|
-
const owner = computed(() => props.post.slug.split("/")[0]);
|
|
53
|
-
const name = computed(() => props.post.slug.split("/").slice(1).join("/"));
|
|
54
|
-
const tags = computed(() => props.post.tags ?? []);
|
|
55
|
-
</script>
|
|
56
|
-
|
|
57
|
-
<template>
|
|
58
|
-
<component
|
|
59
|
-
:is="as"
|
|
60
|
-
class="wp-post-card"
|
|
61
|
-
:data-type="type"
|
|
62
|
-
:data-featured="post.featured || undefined"
|
|
63
|
-
:data-deleted="post.deleted || undefined"
|
|
64
|
-
>
|
|
65
|
-
<div class="wp-post-card__top">
|
|
66
|
-
<div class="wp-post-card__badges">
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</
|
|
73
|
-
<span v-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<span v-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
text-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
border:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
.wp-post-card[data-type="
|
|
138
|
-
.wp-post-card[data-type="
|
|
139
|
-
.wp-post-card[data-type="
|
|
140
|
-
.wp-post-card[data-type="
|
|
141
|
-
.wp-post-card[data-type="
|
|
142
|
-
.wp-post-card
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
.wp-post-card:
|
|
149
|
-
.wp-post-card
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
.wp-post-card[data-
|
|
155
|
-
.wp-post-card[data-deleted] { opacity: 0.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
.wp-post-
|
|
167
|
-
|
|
168
|
-
font-
|
|
169
|
-
font-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
.wp-post-
|
|
177
|
-
.wp-post-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
-webkit-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
.wp-post-card__tags {
|
|
190
|
-
.wp-post-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
font-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
.wp-post-card__stat :deep(.pi) { color: var(--wp-text
|
|
209
|
-
.wp-post-
|
|
210
|
-
|
|
211
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A community post as a card: type chip, NSFW / Featured / recommended
|
|
4
|
+
* badges, version, `owner/name` slug, bundle contents, description, up to
|
|
5
|
+
* four tags, then stars, downloads and when it was updated. A coloured stripe
|
|
6
|
+
* on top says the type; a featured card is tinted, a deleted one faded.
|
|
7
|
+
*
|
|
8
|
+
* The whole card is one link. It renders an `<a>` by default; pass the app's
|
|
9
|
+
* router link as `as` (and its `to`) so the kit never imports a router:
|
|
10
|
+
*
|
|
11
|
+
* <PostCard :as="RouterLink" :to="`/p/${post.slug}`" :post="card(post)" />
|
|
12
|
+
* <PostCard href="/p/dumi/warm" :post="…" />
|
|
13
|
+
* <PostCard as="button" type="button" :post="…" @click="open" />
|
|
14
|
+
*/
|
|
15
|
+
import { computed, type Component } from "vue";
|
|
16
|
+
import BundleMeta from "./BundleMeta.vue";
|
|
17
|
+
import Icon from "./Icon.vue";
|
|
18
|
+
import Chip from "./Chip.vue";
|
|
19
|
+
import { itemType, kindColour, type ItemType } from "./kind-colour";
|
|
20
|
+
import RelativeDate from "./RelativeDate.vue";
|
|
21
|
+
|
|
22
|
+
export interface PostCardData {
|
|
23
|
+
/** `owner/name`. */
|
|
24
|
+
slug: string;
|
|
25
|
+
kind: "module" | "bundle";
|
|
26
|
+
subtype?: ItemType | null | undefined;
|
|
27
|
+
description?: string | undefined;
|
|
28
|
+
tags?: string[] | undefined;
|
|
29
|
+
stars: number;
|
|
30
|
+
downloads: number;
|
|
31
|
+
/** ISO time of the last update. */
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
rating?: "sfw" | "nsfw" | undefined;
|
|
34
|
+
featured?: boolean | undefined;
|
|
35
|
+
/** The latest version is marked recommended. */
|
|
36
|
+
recommended?: boolean | undefined;
|
|
37
|
+
/** Soft-deleted: the card fades and shows "deleted" where the version goes. */
|
|
38
|
+
deleted?: boolean | undefined;
|
|
39
|
+
version?: number | null | undefined;
|
|
40
|
+
bundleModules?: { count: number; names: string[] } | null | undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const props = withDefaults(defineProps<{
|
|
44
|
+
post: PostCardData;
|
|
45
|
+
/** The viewer starred it: the star in the footer fills. */
|
|
46
|
+
starred?: boolean | undefined;
|
|
47
|
+
/** Element or component for the link, e.g. the app's RouterLink. */
|
|
48
|
+
as?: string | Component | undefined;
|
|
49
|
+
}>(), { starred: false, as: "a" });
|
|
50
|
+
|
|
51
|
+
const type = computed(() => itemType(props.post.kind, props.post.subtype));
|
|
52
|
+
const owner = computed(() => props.post.slug.split("/")[0]);
|
|
53
|
+
const name = computed(() => props.post.slug.split("/").slice(1).join("/"));
|
|
54
|
+
const tags = computed(() => props.post.tags ?? []);
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<component
|
|
59
|
+
:is="as"
|
|
60
|
+
class="wp-post-card"
|
|
61
|
+
:data-type="type"
|
|
62
|
+
:data-featured="post.featured || undefined"
|
|
63
|
+
:data-deleted="post.deleted || undefined"
|
|
64
|
+
>
|
|
65
|
+
<div class="wp-post-card__top">
|
|
66
|
+
<div class="wp-post-card__badges">
|
|
67
|
+
<Chip :color="kindColour(type)">{{ type }}</Chip>
|
|
68
|
+
<Chip v-if="post.rating === 'nsfw'" tone="danger">NSFW</Chip>
|
|
69
|
+
<Chip v-if="post.featured" tone="warn" icon="star-fill">Featured</Chip>
|
|
70
|
+
<Chip v-if="post.recommended" tone="success" dot>recommended</Chip>
|
|
71
|
+
</div>
|
|
72
|
+
<span v-if="post.deleted" class="wp-chip wp-chip--danger"><Icon name="trash" :size="10" />deleted</span>
|
|
73
|
+
<span v-else class="wp-chip">v{{ post.version ?? 1 }}</span>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div class="wp-post-card__slug">
|
|
77
|
+
<span class="wp-post-card__owner">{{ owner }}</span><span class="wp-post-card__sep">/</span>{{ name }}
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<BundleMeta
|
|
81
|
+
v-if="post.kind === 'bundle' && post.bundleModules"
|
|
82
|
+
:count="post.bundleModules.count"
|
|
83
|
+
:names="post.bundleModules.names"
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
<p v-if="post.description" class="wp-post-card__desc">{{ post.description }}</p>
|
|
87
|
+
|
|
88
|
+
<div v-if="tags.length" class="wp-post-card__tags">
|
|
89
|
+
<span v-for="t in tags.slice(0, 4)" :key="t" class="wp-chip">{{ t }}</span>
|
|
90
|
+
<span v-if="tags.length > 4" class="wp-chip">+{{ tags.length - 4 }}</span>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div class="wp-post-card__foot">
|
|
94
|
+
<span class="wp-post-card__stat" :data-active="starred || undefined">
|
|
95
|
+
<Icon :name="starred ? 'star-fill' : 'star'" :size="11" />{{ post.stars.toLocaleString() }}
|
|
96
|
+
</span>
|
|
97
|
+
<span class="wp-post-card__stat">
|
|
98
|
+
<Icon name="download" :size="11" />{{ post.downloads.toLocaleString() }}
|
|
99
|
+
</span>
|
|
100
|
+
<RelativeDate class="wp-post-card__when" :value="post.updatedAt" />
|
|
101
|
+
</div>
|
|
102
|
+
</component>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<style scoped>
|
|
106
|
+
.wp-post-card {
|
|
107
|
+
--post-card-c: var(--wp-text-dim);
|
|
108
|
+
position: relative;
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
gap: 14px;
|
|
112
|
+
width: 100%;
|
|
113
|
+
padding: 20px 20px 18px;
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
break-inside: avoid;
|
|
116
|
+
/* The page spaces its cards (a grid gap or margins); one set here would
|
|
117
|
+
beat the page's rule, since scoped styles win ties. */
|
|
118
|
+
font: inherit;
|
|
119
|
+
color: inherit;
|
|
120
|
+
text-align: left;
|
|
121
|
+
text-decoration: none;
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
background: var(--wp-bg-1);
|
|
124
|
+
border: 1px solid var(--wp-border);
|
|
125
|
+
border-radius: min(12px, var(--wp-radius-cap, 999px));
|
|
126
|
+
transition: transform var(--wp-motion-quick) ease, border-color var(--wp-motion-quick) ease, box-shadow var(--wp-motion-quick) ease;
|
|
127
|
+
}
|
|
128
|
+
.wp-post-card::before {
|
|
129
|
+
content: "";
|
|
130
|
+
position: absolute;
|
|
131
|
+
inset: 0 0 auto;
|
|
132
|
+
height: 3px;
|
|
133
|
+
opacity: 0.85;
|
|
134
|
+
background: linear-gradient(90deg, var(--post-card-c), color-mix(in oklab, var(--post-card-c) 50%, transparent));
|
|
135
|
+
}
|
|
136
|
+
.wp-post-card[data-type="fixed_values"] { --post-card-c: var(--wp-kind-fixed); }
|
|
137
|
+
.wp-post-card[data-type="combine"] { --post-card-c: var(--wp-kind-combine); }
|
|
138
|
+
.wp-post-card[data-type="wildcard"] { --post-card-c: var(--wp-kind-wildcard); }
|
|
139
|
+
.wp-post-card[data-type="constraint"] { --post-card-c: var(--wp-kind-constraint); }
|
|
140
|
+
.wp-post-card[data-type="derivation"] { --post-card-c: var(--wp-kind-derivation); }
|
|
141
|
+
.wp-post-card[data-type="bundle"] { --post-card-c: var(--wp-bundle-default); }
|
|
142
|
+
.wp-post-card:hover {
|
|
143
|
+
transform: translateY(-3px);
|
|
144
|
+
border-color: var(--wp-border-strong);
|
|
145
|
+
box-shadow: var(--wp-shadow-lg);
|
|
146
|
+
}
|
|
147
|
+
.wp-post-card:focus-visible { outline: none; box-shadow: var(--wp-focus-ring); }
|
|
148
|
+
.wp-post-card:hover .wp-post-card__slug { color: var(--wp-accent-text-strong); }
|
|
149
|
+
.wp-post-card[data-featured] {
|
|
150
|
+
background: linear-gradient(180deg, color-mix(in oklab, var(--wp-warn) 5%, var(--wp-bg-1)), var(--wp-bg-1) 60%);
|
|
151
|
+
border-color: color-mix(in oklab, var(--wp-warn) 25%, var(--wp-border));
|
|
152
|
+
}
|
|
153
|
+
.wp-post-card[data-featured]:hover { border-color: color-mix(in oklab, var(--wp-warn) 40%, var(--wp-border)); }
|
|
154
|
+
.wp-post-card[data-deleted] { opacity: 0.62; filter: grayscale(40%); }
|
|
155
|
+
.wp-post-card[data-deleted]:hover { opacity: 0.85; filter: none; }
|
|
156
|
+
|
|
157
|
+
.wp-post-card__top {
|
|
158
|
+
display: flex;
|
|
159
|
+
flex-wrap: wrap;
|
|
160
|
+
align-items: flex-start;
|
|
161
|
+
justify-content: space-between;
|
|
162
|
+
gap: 8px;
|
|
163
|
+
min-height: 22px;
|
|
164
|
+
}
|
|
165
|
+
.wp-post-card__badges { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
|
|
166
|
+
.wp-post-card__slug {
|
|
167
|
+
font-family: var(--wp-font-mono);
|
|
168
|
+
font-size: 15.5px;
|
|
169
|
+
font-weight: 500;
|
|
170
|
+
line-height: 1.35;
|
|
171
|
+
color: var(--wp-text);
|
|
172
|
+
word-break: break-word;
|
|
173
|
+
transition: color var(--wp-motion-quick) ease;
|
|
174
|
+
}
|
|
175
|
+
.wp-post-card__owner { font-weight: 400; color: var(--wp-text-muted); }
|
|
176
|
+
.wp-post-card__sep { color: var(--wp-accent-text); }
|
|
177
|
+
.wp-post-card__desc {
|
|
178
|
+
display: -webkit-box;
|
|
179
|
+
margin: 0;
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
font-size: 13px;
|
|
182
|
+
line-height: 19px;
|
|
183
|
+
color: var(--wp-text-muted);
|
|
184
|
+
text-wrap: pretty;
|
|
185
|
+
-webkit-line-clamp: 3;
|
|
186
|
+
-webkit-box-orient: vertical;
|
|
187
|
+
}
|
|
188
|
+
.wp-post-card__tags { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
189
|
+
.wp-post-card__tags .wp-chip { padding: 2px 8px; font-size: 11px; }
|
|
190
|
+
.wp-post-card__foot {
|
|
191
|
+
display: flex;
|
|
192
|
+
align-items: center;
|
|
193
|
+
gap: 16px;
|
|
194
|
+
margin-top: 4px;
|
|
195
|
+
padding-top: 16px;
|
|
196
|
+
border-top: 1px solid var(--wp-border);
|
|
197
|
+
font-size: 12px;
|
|
198
|
+
color: var(--wp-text-muted);
|
|
199
|
+
}
|
|
200
|
+
.wp-post-card__stat {
|
|
201
|
+
display: inline-flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
gap: 5px;
|
|
204
|
+
font-family: var(--wp-font-mono);
|
|
205
|
+
font-variant-numeric: tabular-nums;
|
|
206
|
+
}
|
|
207
|
+
.wp-post-card__stat :deep(.pi) { color: var(--wp-text-dim); }
|
|
208
|
+
.wp-post-card__stat[data-active] :deep(.pi) { color: var(--wp-accent-text); }
|
|
209
|
+
.wp-post-card__when { margin-left: auto; font-size: 11.5px; color: var(--wp-text-dim); }
|
|
210
|
+
</style>
|
package/src/ProgressBar.vue
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* Progress bar: how far along a job is. Give `value` (0 to `max`) for a bar that
|
|
4
|
-
* fills; leave it out (or `null`) when nobody knows yet, and the bar sweeps.
|
|
5
|
-
* Works on the canvas (`size="sm"`) and in the manager (`md`).
|
|
6
|
-
*
|
|
7
|
-
* <ProgressBar :value="done" :max="total" label="Testing seeds" show-value />
|
|
8
|
-
* <ProgressBar label="Loading the model" />
|
|
9
|
-
*
|
|
10
|
-
* It is an APG progressbar: `aria-valuenow` only while the value is known,
|
|
11
|
-
* so a screen reader says "busy" instead of a made-up number. The sweep
|
|
12
|
-
* stands still under reduced motion.
|
|
13
|
-
*/
|
|
14
|
-
import { computed } from "vue";
|
|
15
|
-
|
|
16
|
-
const props = withDefaults(defineProps<{
|
|
17
|
-
/** How far along, 0 to `max`; `null` or left out = not known yet. */
|
|
18
|
-
value?: number | null | undefined;
|
|
19
|
-
max?: number | undefined;
|
|
20
|
-
tone?: "accent" | "success" | "warn" | "danger" | undefined;
|
|
21
|
-
size?: "sm" | "md" | undefined;
|
|
22
|
-
/** The job's name for screen readers, and the line above the bar with `show-value`. */
|
|
23
|
-
label?: string | undefined;
|
|
24
|
-
/** Show the label and the percentage above the bar. */
|
|
25
|
-
showValue?: boolean | undefined;
|
|
26
|
-
}>(), { value: null, max: 100, tone: "accent", size: "md", label: undefined });
|
|
27
|
-
|
|
28
|
-
const known = computed(() => typeof props.value === "number" && Number.isFinite(props.value));
|
|
29
|
-
const pct = computed(() => {
|
|
30
|
-
if (!known.value || props.max <= 0) return 0;
|
|
31
|
-
return Math.min(100, Math.max(0, ((props.value as number) / props.max) * 100));
|
|
32
|
-
});
|
|
33
|
-
const pctText = computed(() => `${Math.round(pct.value)}%`);
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<template>
|
|
37
|
-
<div class="wp-progress" :data-size="size" :data-tone="tone">
|
|
38
|
-
<div v-if="showValue && (label || known)" class="wp-progress__head" aria-hidden="true">
|
|
39
|
-
<span class="wp-progress__label">{{ label }}</span>
|
|
40
|
-
<span v-if="known" class="wp-progress__value">{{ pctText }}</span>
|
|
41
|
-
</div>
|
|
42
|
-
<div
|
|
43
|
-
class="wp-progress__track"
|
|
44
|
-
role="progressbar"
|
|
45
|
-
:aria-label="label"
|
|
46
|
-
aria-valuemin="0"
|
|
47
|
-
:aria-valuemax="known ? max : undefined"
|
|
48
|
-
:aria-valuenow="known ? value ?? undefined : undefined"
|
|
49
|
-
:aria-valuetext="known ? pctText : undefined"
|
|
50
|
-
:aria-busy="known ? undefined : 'true'"
|
|
51
|
-
:data-indeterminate="known ? undefined : 'true'"
|
|
52
|
-
>
|
|
53
|
-
<div class="wp-progress__fill" :style="known ? { width: `${pct}%` } : undefined" />
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</template>
|
|
57
|
-
|
|
58
|
-
<style scoped>
|
|
59
|
-
.wp-progress { --_tone: var(--wp-accent); display: flex; flex-direction: column; gap: var(--wp-space-2); min-width: 0; width: 100%; }
|
|
60
|
-
.wp-progress[data-tone="success"] { --_tone: var(--wp-success); }
|
|
61
|
-
.wp-progress[data-tone="warn"] { --_tone: var(--wp-warn); }
|
|
62
|
-
.wp-progress[data-tone="danger"] { --_tone: var(--wp-danger); }
|
|
63
|
-
.wp-progress__head {
|
|
64
|
-
display: flex; justify-content: space-between; gap: var(--wp-space-3);
|
|
65
|
-
color: var(--wp-text-muted); font: 500 var(--wp-text-xs)/1.3 var(--wp-font-sans);
|
|
66
|
-
}
|
|
67
|
-
.wp-progress__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
68
|
-
.wp-progress__value { flex: none; font-variant-numeric: tabular-nums; color: var(--wp-text); }
|
|
69
|
-
.wp-progress__track {
|
|
70
|
-
position: relative; overflow: hidden; height: 6px;
|
|
71
|
-
border-radius: var(--wp-radius-cap, 999px); background: var(--wp-bg-3);
|
|
72
|
-
}
|
|
73
|
-
.wp-progress[data-size="sm"] .wp-progress__track { height: 4px; }
|
|
74
|
-
.wp-progress__fill {
|
|
75
|
-
height: 100%; border-radius: inherit; background: var(--_tone);
|
|
76
|
-
transition: width var(--wp-motion-swap);
|
|
77
|
-
}
|
|
78
|
-
.wp-progress__track[data-indeterminate] .wp-progress__fill {
|
|
79
|
-
position: absolute; inset: 0 auto 0 0; width: 40%;
|
|
80
|
-
animation: wp-progress-sweep 1.4s var(--wp-motion-curve-collapse) infinite;
|
|
81
|
-
}
|
|
82
|
-
@keyframes wp-progress-sweep {
|
|
83
|
-
from { transform: translateX(-100%); }
|
|
84
|
-
to { transform: translateX(250%); }
|
|
85
|
-
}
|
|
86
|
-
@media (prefers-reduced-motion: reduce) {
|
|
87
|
-
.wp-progress__fill { transition: none; }
|
|
88
|
-
.wp-progress__track[data-indeterminate] .wp-progress__fill { animation: none; width: 100%; opacity: 0.45; }
|
|
89
|
-
}
|
|
90
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Progress bar: how far along a job is. Give `value` (0 to `max`) for a bar that
|
|
4
|
+
* fills; leave it out (or `null`) when nobody knows yet, and the bar sweeps.
|
|
5
|
+
* Works on the canvas (`size="sm"`) and in the manager (`md`).
|
|
6
|
+
*
|
|
7
|
+
* <ProgressBar :value="done" :max="total" label="Testing seeds" show-value />
|
|
8
|
+
* <ProgressBar label="Loading the model" />
|
|
9
|
+
*
|
|
10
|
+
* It is an APG progressbar: `aria-valuenow` only while the value is known,
|
|
11
|
+
* so a screen reader says "busy" instead of a made-up number. The sweep
|
|
12
|
+
* stands still under reduced motion.
|
|
13
|
+
*/
|
|
14
|
+
import { computed } from "vue";
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(defineProps<{
|
|
17
|
+
/** How far along, 0 to `max`; `null` or left out = not known yet. */
|
|
18
|
+
value?: number | null | undefined;
|
|
19
|
+
max?: number | undefined;
|
|
20
|
+
tone?: "accent" | "success" | "warn" | "danger" | undefined;
|
|
21
|
+
size?: "sm" | "md" | undefined;
|
|
22
|
+
/** The job's name for screen readers, and the line above the bar with `show-value`. */
|
|
23
|
+
label?: string | undefined;
|
|
24
|
+
/** Show the label and the percentage above the bar. */
|
|
25
|
+
showValue?: boolean | undefined;
|
|
26
|
+
}>(), { value: null, max: 100, tone: "accent", size: "md", label: undefined });
|
|
27
|
+
|
|
28
|
+
const known = computed(() => typeof props.value === "number" && Number.isFinite(props.value));
|
|
29
|
+
const pct = computed(() => {
|
|
30
|
+
if (!known.value || props.max <= 0) return 0;
|
|
31
|
+
return Math.min(100, Math.max(0, ((props.value as number) / props.max) * 100));
|
|
32
|
+
});
|
|
33
|
+
const pctText = computed(() => `${Math.round(pct.value)}%`);
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<div class="wp-progress" :data-size="size" :data-tone="tone">
|
|
38
|
+
<div v-if="showValue && (label || known)" class="wp-progress__head" aria-hidden="true">
|
|
39
|
+
<span class="wp-progress__label">{{ label }}</span>
|
|
40
|
+
<span v-if="known" class="wp-progress__value">{{ pctText }}</span>
|
|
41
|
+
</div>
|
|
42
|
+
<div
|
|
43
|
+
class="wp-progress__track"
|
|
44
|
+
role="progressbar"
|
|
45
|
+
:aria-label="label"
|
|
46
|
+
aria-valuemin="0"
|
|
47
|
+
:aria-valuemax="known ? max : undefined"
|
|
48
|
+
:aria-valuenow="known ? value ?? undefined : undefined"
|
|
49
|
+
:aria-valuetext="known ? pctText : undefined"
|
|
50
|
+
:aria-busy="known ? undefined : 'true'"
|
|
51
|
+
:data-indeterminate="known ? undefined : 'true'"
|
|
52
|
+
>
|
|
53
|
+
<div class="wp-progress__fill" :style="known ? { width: `${pct}%` } : undefined" />
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<style scoped>
|
|
59
|
+
.wp-progress { --_tone: var(--wp-accent); display: flex; flex-direction: column; gap: var(--wp-space-2); min-width: 0; width: 100%; }
|
|
60
|
+
.wp-progress[data-tone="success"] { --_tone: var(--wp-success); }
|
|
61
|
+
.wp-progress[data-tone="warn"] { --_tone: var(--wp-warn); }
|
|
62
|
+
.wp-progress[data-tone="danger"] { --_tone: var(--wp-danger); }
|
|
63
|
+
.wp-progress__head {
|
|
64
|
+
display: flex; justify-content: space-between; gap: var(--wp-space-3);
|
|
65
|
+
color: var(--wp-text-muted); font: 500 var(--wp-text-xs)/1.3 var(--wp-font-sans);
|
|
66
|
+
}
|
|
67
|
+
.wp-progress__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
68
|
+
.wp-progress__value { flex: none; font-variant-numeric: tabular-nums; color: var(--wp-text); }
|
|
69
|
+
.wp-progress__track {
|
|
70
|
+
position: relative; overflow: hidden; height: 6px;
|
|
71
|
+
border-radius: var(--wp-radius-cap, 999px); background: var(--wp-bg-3);
|
|
72
|
+
}
|
|
73
|
+
.wp-progress[data-size="sm"] .wp-progress__track { height: 4px; }
|
|
74
|
+
.wp-progress__fill {
|
|
75
|
+
height: 100%; border-radius: inherit; background: var(--_tone);
|
|
76
|
+
transition: width var(--wp-motion-swap);
|
|
77
|
+
}
|
|
78
|
+
.wp-progress__track[data-indeterminate] .wp-progress__fill {
|
|
79
|
+
position: absolute; inset: 0 auto 0 0; width: 40%;
|
|
80
|
+
animation: wp-progress-sweep 1.4s var(--wp-motion-curve-collapse) infinite;
|
|
81
|
+
}
|
|
82
|
+
@keyframes wp-progress-sweep {
|
|
83
|
+
from { transform: translateX(-100%); }
|
|
84
|
+
to { transform: translateX(250%); }
|
|
85
|
+
}
|
|
86
|
+
@media (prefers-reduced-motion: reduce) {
|
|
87
|
+
.wp-progress__fill { transition: none; }
|
|
88
|
+
.wp-progress__track[data-indeterminate] .wp-progress__fill { animation: none; width: 100%; opacity: 0.45; }
|
|
89
|
+
}
|
|
90
|
+
</style>
|