@dumiflex/wp-kit 0.3.0 → 0.5.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 +92 -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 +146 -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 +293 -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 +127 -125
- package/src/InlineEdit.vue +183 -183
- package/src/Input.vue +99 -99
- package/src/Kbd.vue +56 -56
- package/src/Lightbox.vue +176 -173
- package/src/ListFilter.vue +85 -85
- package/src/ListRow.vue +204 -204
- package/src/LoadingMark.vue +217 -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 +98 -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/highlight.ts +199 -0
- 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/loading-mark-motion.ts +249 -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/Textarea.vue
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { nextTick, ref, watch } from "vue";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
modelValue: string;
|
|
6
|
-
rows?: number | undefined;
|
|
7
|
-
placeholder?: string | undefined;
|
|
8
|
-
autoResize?: boolean | undefined;
|
|
9
|
-
disabled?: boolean | undefined;
|
|
10
|
-
error?: boolean | undefined;
|
|
11
|
-
id?: string | undefined;
|
|
12
|
-
ariaLabel?: string | undefined;
|
|
13
|
-
}
|
|
14
|
-
const props = withDefaults(defineProps<Props>(), { rows: 3 });
|
|
15
|
-
|
|
16
|
-
const emit = defineEmits<{
|
|
17
|
-
(e: "update:modelValue", v: string): void;
|
|
18
|
-
(e: "blur", evt: FocusEvent): void;
|
|
19
|
-
(e: "focus", evt: FocusEvent): void;
|
|
20
|
-
}>();
|
|
21
|
-
|
|
22
|
-
const taRef = ref<HTMLTextAreaElement | null>(null);
|
|
23
|
-
|
|
24
|
-
function autosize() {
|
|
25
|
-
if (!props.autoResize) return;
|
|
26
|
-
const el = taRef.value;
|
|
27
|
-
if (!el) return;
|
|
28
|
-
el.style.height = "auto";
|
|
29
|
-
el.style.height = `${el.scrollHeight}px`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function onInput(e: Event) {
|
|
33
|
-
emit("update:modelValue", (e.target as HTMLTextAreaElement).value);
|
|
34
|
-
if (props.autoResize) nextTick(autosize);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
watch(() => props.modelValue, () => {
|
|
38
|
-
if (props.autoResize) nextTick(autosize);
|
|
39
|
-
});
|
|
40
|
-
</script>
|
|
41
|
-
|
|
42
|
-
<template>
|
|
43
|
-
<textarea
|
|
44
|
-
:id="id"
|
|
45
|
-
ref="taRef"
|
|
46
|
-
class="wp-textarea"
|
|
47
|
-
:rows="rows"
|
|
48
|
-
:value="modelValue"
|
|
49
|
-
:placeholder="placeholder"
|
|
50
|
-
:disabled="disabled"
|
|
51
|
-
:aria-label="ariaLabel"
|
|
52
|
-
:aria-invalid="error || undefined"
|
|
53
|
-
@input="onInput"
|
|
54
|
-
@blur="(e) => emit('blur', e)"
|
|
55
|
-
@focus="(e) => emit('focus', e)"
|
|
56
|
-
/>
|
|
57
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { nextTick, ref, watch } from "vue";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
modelValue: string;
|
|
6
|
+
rows?: number | undefined;
|
|
7
|
+
placeholder?: string | undefined;
|
|
8
|
+
autoResize?: boolean | undefined;
|
|
9
|
+
disabled?: boolean | undefined;
|
|
10
|
+
error?: boolean | undefined;
|
|
11
|
+
id?: string | undefined;
|
|
12
|
+
ariaLabel?: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), { rows: 3 });
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits<{
|
|
17
|
+
(e: "update:modelValue", v: string): void;
|
|
18
|
+
(e: "blur", evt: FocusEvent): void;
|
|
19
|
+
(e: "focus", evt: FocusEvent): void;
|
|
20
|
+
}>();
|
|
21
|
+
|
|
22
|
+
const taRef = ref<HTMLTextAreaElement | null>(null);
|
|
23
|
+
|
|
24
|
+
function autosize() {
|
|
25
|
+
if (!props.autoResize) return;
|
|
26
|
+
const el = taRef.value;
|
|
27
|
+
if (!el) return;
|
|
28
|
+
el.style.height = "auto";
|
|
29
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function onInput(e: Event) {
|
|
33
|
+
emit("update:modelValue", (e.target as HTMLTextAreaElement).value);
|
|
34
|
+
if (props.autoResize) nextTick(autosize);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
watch(() => props.modelValue, () => {
|
|
38
|
+
if (props.autoResize) nextTick(autosize);
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<textarea
|
|
44
|
+
:id="id"
|
|
45
|
+
ref="taRef"
|
|
46
|
+
class="wp-textarea"
|
|
47
|
+
:rows="rows"
|
|
48
|
+
:value="modelValue"
|
|
49
|
+
:placeholder="placeholder"
|
|
50
|
+
:disabled="disabled"
|
|
51
|
+
:aria-label="ariaLabel"
|
|
52
|
+
:aria-invalid="error || undefined"
|
|
53
|
+
@input="onInput"
|
|
54
|
+
@blur="(e) => emit('blur', e)"
|
|
55
|
+
@focus="(e) => emit('focus', e)"
|
|
56
|
+
/>
|
|
57
|
+
</template>
|
package/src/Timeline.vue
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* Timeline: events in order, each a dot on one line with its time, title
|
|
4
|
-
* and an optional body (History, an AI trace, a pack build log). Works on
|
|
5
|
-
* the canvas and in the manager.
|
|
6
|
-
*
|
|
7
|
-
* <Timeline :items="[{ id: 1, title: 'Saved Hair colour', time: '5 min ago', tone: 'success', icon: 'pi-check' }]" />
|
|
8
|
-
* <Timeline :items="steps"><template #body="{ item }"><CodeBlock :code="item.args" bare /></template></Timeline>
|
|
9
|
-
*
|
|
10
|
-
* It is an ordered list. `#body` and `#time` slots let a screen draw its own
|
|
11
|
-
* body (a diff, a code block) or a RelativeDate. The last item can be
|
|
12
|
-
* `pending` (a pulsing dot) while a job is still running.
|
|
13
|
-
*/
|
|
14
|
-
export interface TimelineItem {
|
|
15
|
-
id: string | number;
|
|
16
|
-
title: string;
|
|
17
|
-
/** Shown after the title, e.g. "5 min ago". */
|
|
18
|
-
time?: string | undefined;
|
|
19
|
-
/** A line or two of text under the title. */
|
|
20
|
-
body?: string | undefined;
|
|
21
|
-
tone?: "neutral" | "info" | "success" | "warn" | "danger" | "accent" | undefined;
|
|
22
|
-
/** A PrimeIcons class inside the dot. */
|
|
23
|
-
icon?: string | undefined;
|
|
24
|
-
/** Still running: the dot pulses. */
|
|
25
|
-
pending?: boolean | undefined;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
withDefaults(defineProps<{
|
|
29
|
-
items: TimelineItem[];
|
|
30
|
-
size?: "sm" | "md" | undefined;
|
|
31
|
-
ariaLabel?: string | undefined;
|
|
32
|
-
}>(), { size: "md", ariaLabel: undefined });
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<template>
|
|
36
|
-
<ol class="wp-timeline" :data-size="size" :aria-label="ariaLabel">
|
|
37
|
-
<li
|
|
38
|
-
v-for="it in items"
|
|
39
|
-
:key="it.id"
|
|
40
|
-
class="wp-timeline__item"
|
|
41
|
-
:data-tone="it.tone ?? 'neutral'"
|
|
42
|
-
:data-pending="it.pending || undefined"
|
|
43
|
-
:data-icon="it.icon ? 'true' : undefined"
|
|
44
|
-
>
|
|
45
|
-
<span class="wp-timeline__dot" aria-hidden="true"><i v-if="it.icon" class="pi" :class="it.icon" /></span>
|
|
46
|
-
<div class="wp-timeline__main">
|
|
47
|
-
<div class="wp-timeline__head">
|
|
48
|
-
<span class="wp-timeline__title">{{ it.title }}</span>
|
|
49
|
-
<span v-if="it.time || $slots.time" class="wp-timeline__time"><slot name="time" :item="it">{{ it.time }}</slot></span>
|
|
50
|
-
</div>
|
|
51
|
-
<div v-if="it.body || $slots.body" class="wp-timeline__body"><slot name="body" :item="it">{{ it.body }}</slot></div>
|
|
52
|
-
</div>
|
|
53
|
-
</li>
|
|
54
|
-
</ol>
|
|
55
|
-
</template>
|
|
56
|
-
|
|
57
|
-
<style scoped>
|
|
58
|
-
.wp-timeline { --_dot: 20px; margin: 0; padding: 0; list-style: none; font: 400 var(--wp-text-sm)/1.45 var(--wp-font-sans); min-width: 0; }
|
|
59
|
-
.wp-timeline[data-size="sm"] { --_dot: 16px; font-size: var(--wp-text-xs); }
|
|
60
|
-
.wp-timeline__item { --_tone: var(--wp-text-dim); position: relative; display: flex; gap: var(--wp-space-4); padding-bottom: var(--wp-space-5); }
|
|
61
|
-
.wp-timeline[data-size="sm"] .wp-timeline__item { gap: var(--wp-space-3); padding-bottom: var(--wp-space-4); }
|
|
62
|
-
.wp-timeline__item:last-child { padding-bottom: 0; }
|
|
63
|
-
.wp-timeline__item[data-tone="info"] { --_tone: var(--wp-info); }
|
|
64
|
-
.wp-timeline__item[data-tone="success"] { --_tone: var(--wp-success); }
|
|
65
|
-
.wp-timeline__item[data-tone="warn"] { --_tone: var(--wp-warn); }
|
|
66
|
-
.wp-timeline__item[data-tone="danger"] { --_tone: var(--wp-danger); }
|
|
67
|
-
.wp-timeline__item[data-tone="accent"] { --_tone: var(--wp-accent); }
|
|
68
|
-
.wp-timeline__item:not(:last-child)::before {
|
|
69
|
-
content: ""; position: absolute; top: calc(var(--_dot) + 2px); bottom: 2px; left: calc(var(--_dot) / 2 - 1px);
|
|
70
|
-
width: 2px; border-radius: min(1px, var(--wp-radius-cap, 999px)); background: var(--wp-border);
|
|
71
|
-
}
|
|
72
|
-
.wp-timeline__dot {
|
|
73
|
-
position: relative; display: grid; place-items: center; flex: none; box-sizing: border-box;
|
|
74
|
-
width: var(--_dot); height: var(--_dot); margin-top: 1px; border-radius: 50%; /* round: timeline dot */
|
|
75
|
-
border: 2px solid var(--_tone); background: var(--wp-bg-1); color: var(--_tone);
|
|
76
|
-
}
|
|
77
|
-
.wp-timeline__item:not([data-icon]) .wp-timeline__dot { transform: scale(0.6); background: var(--_tone); }
|
|
78
|
-
.wp-timeline__dot .pi { font-size: calc(var(--_dot) * 0.45); }
|
|
79
|
-
.wp-timeline__item[data-pending] .wp-timeline__dot::after {
|
|
80
|
-
content: ""; position: absolute; inset: -4px; border-radius: 50%; /* round: timeline dot ring */ border: 2px solid var(--_tone);
|
|
81
|
-
animation: wp-timeline-pulse 1.6s ease-out infinite;
|
|
82
|
-
}
|
|
83
|
-
@keyframes wp-timeline-pulse { from { opacity: 0.7; transform: scale(0.8); } to { opacity: 0; transform: scale(1.4); } }
|
|
84
|
-
.wp-timeline__main { flex: 1; min-width: 0; }
|
|
85
|
-
.wp-timeline__head { display: flex; align-items: baseline; gap: var(--wp-space-3); flex-wrap: wrap; }
|
|
86
|
-
.wp-timeline__title { color: var(--wp-text); font-weight: 500; }
|
|
87
|
-
.wp-timeline__time { color: var(--wp-text-dim); font-size: var(--wp-text-xs); font-variant-numeric: tabular-nums; }
|
|
88
|
-
.wp-timeline__body { margin-top: 2px; color: var(--wp-text-muted); overflow-wrap: anywhere; }
|
|
89
|
-
@media (prefers-reduced-motion: reduce) {
|
|
90
|
-
.wp-timeline__item[data-pending] .wp-timeline__dot::after { animation: none; display: none; }
|
|
91
|
-
}
|
|
92
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Timeline: events in order, each a dot on one line with its time, title
|
|
4
|
+
* and an optional body (History, an AI trace, a pack build log). Works on
|
|
5
|
+
* the canvas and in the manager.
|
|
6
|
+
*
|
|
7
|
+
* <Timeline :items="[{ id: 1, title: 'Saved Hair colour', time: '5 min ago', tone: 'success', icon: 'pi-check' }]" />
|
|
8
|
+
* <Timeline :items="steps"><template #body="{ item }"><CodeBlock :code="item.args" bare /></template></Timeline>
|
|
9
|
+
*
|
|
10
|
+
* It is an ordered list. `#body` and `#time` slots let a screen draw its own
|
|
11
|
+
* body (a diff, a code block) or a RelativeDate. The last item can be
|
|
12
|
+
* `pending` (a pulsing dot) while a job is still running.
|
|
13
|
+
*/
|
|
14
|
+
export interface TimelineItem {
|
|
15
|
+
id: string | number;
|
|
16
|
+
title: string;
|
|
17
|
+
/** Shown after the title, e.g. "5 min ago". */
|
|
18
|
+
time?: string | undefined;
|
|
19
|
+
/** A line or two of text under the title. */
|
|
20
|
+
body?: string | undefined;
|
|
21
|
+
tone?: "neutral" | "info" | "success" | "warn" | "danger" | "accent" | undefined;
|
|
22
|
+
/** A PrimeIcons class inside the dot. */
|
|
23
|
+
icon?: string | undefined;
|
|
24
|
+
/** Still running: the dot pulses. */
|
|
25
|
+
pending?: boolean | undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
withDefaults(defineProps<{
|
|
29
|
+
items: TimelineItem[];
|
|
30
|
+
size?: "sm" | "md" | undefined;
|
|
31
|
+
ariaLabel?: string | undefined;
|
|
32
|
+
}>(), { size: "md", ariaLabel: undefined });
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<ol class="wp-timeline" :data-size="size" :aria-label="ariaLabel">
|
|
37
|
+
<li
|
|
38
|
+
v-for="it in items"
|
|
39
|
+
:key="it.id"
|
|
40
|
+
class="wp-timeline__item"
|
|
41
|
+
:data-tone="it.tone ?? 'neutral'"
|
|
42
|
+
:data-pending="it.pending || undefined"
|
|
43
|
+
:data-icon="it.icon ? 'true' : undefined"
|
|
44
|
+
>
|
|
45
|
+
<span class="wp-timeline__dot" aria-hidden="true"><i v-if="it.icon" class="pi" :class="it.icon" /></span>
|
|
46
|
+
<div class="wp-timeline__main">
|
|
47
|
+
<div class="wp-timeline__head">
|
|
48
|
+
<span class="wp-timeline__title">{{ it.title }}</span>
|
|
49
|
+
<span v-if="it.time || $slots.time" class="wp-timeline__time"><slot name="time" :item="it">{{ it.time }}</slot></span>
|
|
50
|
+
</div>
|
|
51
|
+
<div v-if="it.body || $slots.body" class="wp-timeline__body"><slot name="body" :item="it">{{ it.body }}</slot></div>
|
|
52
|
+
</div>
|
|
53
|
+
</li>
|
|
54
|
+
</ol>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<style scoped>
|
|
58
|
+
.wp-timeline { --_dot: 20px; margin: 0; padding: 0; list-style: none; font: 400 var(--wp-text-sm)/1.45 var(--wp-font-sans); min-width: 0; }
|
|
59
|
+
.wp-timeline[data-size="sm"] { --_dot: 16px; font-size: var(--wp-text-xs); }
|
|
60
|
+
.wp-timeline__item { --_tone: var(--wp-text-dim); position: relative; display: flex; gap: var(--wp-space-4); padding-bottom: var(--wp-space-5); }
|
|
61
|
+
.wp-timeline[data-size="sm"] .wp-timeline__item { gap: var(--wp-space-3); padding-bottom: var(--wp-space-4); }
|
|
62
|
+
.wp-timeline__item:last-child { padding-bottom: 0; }
|
|
63
|
+
.wp-timeline__item[data-tone="info"] { --_tone: var(--wp-info); }
|
|
64
|
+
.wp-timeline__item[data-tone="success"] { --_tone: var(--wp-success); }
|
|
65
|
+
.wp-timeline__item[data-tone="warn"] { --_tone: var(--wp-warn); }
|
|
66
|
+
.wp-timeline__item[data-tone="danger"] { --_tone: var(--wp-danger); }
|
|
67
|
+
.wp-timeline__item[data-tone="accent"] { --_tone: var(--wp-accent); }
|
|
68
|
+
.wp-timeline__item:not(:last-child)::before {
|
|
69
|
+
content: ""; position: absolute; top: calc(var(--_dot) + 2px); bottom: 2px; left: calc(var(--_dot) / 2 - 1px);
|
|
70
|
+
width: 2px; border-radius: min(1px, var(--wp-radius-cap, 999px)); background: var(--wp-border);
|
|
71
|
+
}
|
|
72
|
+
.wp-timeline__dot {
|
|
73
|
+
position: relative; display: grid; place-items: center; flex: none; box-sizing: border-box;
|
|
74
|
+
width: var(--_dot); height: var(--_dot); margin-top: 1px; border-radius: 50%; /* round: timeline dot */
|
|
75
|
+
border: 2px solid var(--_tone); background: var(--wp-bg-1); color: var(--_tone);
|
|
76
|
+
}
|
|
77
|
+
.wp-timeline__item:not([data-icon]) .wp-timeline__dot { transform: scale(0.6); background: var(--_tone); }
|
|
78
|
+
.wp-timeline__dot .pi { font-size: calc(var(--_dot) * 0.45); }
|
|
79
|
+
.wp-timeline__item[data-pending] .wp-timeline__dot::after {
|
|
80
|
+
content: ""; position: absolute; inset: -4px; border-radius: 50%; /* round: timeline dot ring */ border: 2px solid var(--_tone);
|
|
81
|
+
animation: wp-timeline-pulse 1.6s ease-out infinite;
|
|
82
|
+
}
|
|
83
|
+
@keyframes wp-timeline-pulse { from { opacity: 0.7; transform: scale(0.8); } to { opacity: 0; transform: scale(1.4); } }
|
|
84
|
+
.wp-timeline__main { flex: 1; min-width: 0; }
|
|
85
|
+
.wp-timeline__head { display: flex; align-items: baseline; gap: var(--wp-space-3); flex-wrap: wrap; }
|
|
86
|
+
.wp-timeline__title { color: var(--wp-text); font-weight: 500; }
|
|
87
|
+
.wp-timeline__time { color: var(--wp-text-dim); font-size: var(--wp-text-xs); font-variant-numeric: tabular-nums; }
|
|
88
|
+
.wp-timeline__body { margin-top: 2px; color: var(--wp-text-muted); overflow-wrap: anywhere; }
|
|
89
|
+
@media (prefers-reduced-motion: reduce) {
|
|
90
|
+
.wp-timeline__item[data-pending] .wp-timeline__dot::after { animation: none; display: none; }
|
|
91
|
+
}
|
|
92
|
+
</style>
|
package/src/ToastCard.vue
CHANGED
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* One toast: the look both toast stacks share.
|
|
4
|
-
*
|
|
5
|
-
* The manager (`ui/ToastHost.vue`, fed by `useToast()`) and the canvas
|
|
6
|
-
* (`shared/Toast.vue`, fed by `toast-store`) used to draw toasts two ways:
|
|
7
|
-
* different surfaces, borders, icons and action buttons. Now each host keeps
|
|
8
|
-
* only its own store and its own place on screen, and renders this card.
|
|
9
|
-
* It reads only SHARED_TOKENS, so it wears the colours of the side it is on.
|
|
10
|
-
*
|
|
11
|
-
* `tone` follows the kit's names; the canvas store's `warning` maps to
|
|
12
|
-
* `warn` in its host.
|
|
13
|
-
*/
|
|
14
|
-
const props = defineProps<{
|
|
15
|
-
tone: "info" | "success" | "warn" | "error";
|
|
16
|
-
summary: string;
|
|
17
|
-
detail?: string | undefined;
|
|
18
|
-
/** Label of the inline action (Undo, Open…); emits `action`. */
|
|
19
|
-
actionLabel?: string | undefined;
|
|
20
|
-
}>();
|
|
21
|
-
|
|
22
|
-
const emit = defineEmits<{ action: []; dismiss: [] }>();
|
|
23
|
-
|
|
24
|
-
const ICONS = {
|
|
25
|
-
info: "pi-info-circle",
|
|
26
|
-
success: "pi-check-circle",
|
|
27
|
-
warn: "pi-exclamation-triangle",
|
|
28
|
-
error: "pi-times-circle",
|
|
29
|
-
} as const;
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<template>
|
|
33
|
-
<div :class="['wp-toast', `wp-toast--${props.tone}`]" role="status" data-test="toast">
|
|
34
|
-
<i :class="['pi', ICONS[props.tone], 'wp-toast__icon']" aria-hidden="true" />
|
|
35
|
-
<div class="wp-toast__text">
|
|
36
|
-
<div class="wp-toast__summary">{{ summary }}</div>
|
|
37
|
-
<div v-if="detail" class="wp-toast__detail">{{ detail }}</div>
|
|
38
|
-
</div>
|
|
39
|
-
<button
|
|
40
|
-
v-if="actionLabel"
|
|
41
|
-
type="button"
|
|
42
|
-
class="wp-toast__action"
|
|
43
|
-
data-test="toast-action"
|
|
44
|
-
@click="emit('action')"
|
|
45
|
-
>{{ actionLabel }}</button>
|
|
46
|
-
<button
|
|
47
|
-
type="button"
|
|
48
|
-
class="wp-toast__close"
|
|
49
|
-
aria-label="Dismiss"
|
|
50
|
-
@click="emit('dismiss')"
|
|
51
|
-
><i class="pi pi-times" aria-hidden="true" /></button>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
|
|
55
|
-
<style scoped>
|
|
56
|
-
.wp-toast {
|
|
57
|
-
--toast-tone: var(--wp-info);
|
|
58
|
-
pointer-events: auto;
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
gap: var(--wp-space-4);
|
|
62
|
-
min-width: 220px;
|
|
63
|
-
max-width: 420px;
|
|
64
|
-
padding: var(--wp-space-4) var(--wp-space-4) var(--wp-space-4) var(--wp-space-5);
|
|
65
|
-
/* Slightly see-through with a blur, so it reads as floating over
|
|
66
|
-
whatever is underneath without a heavy shadow. */
|
|
67
|
-
background: color-mix(in oklab, var(--wp-bg-3) 94%, transparent);
|
|
68
|
-
backdrop-filter: blur(10px);
|
|
69
|
-
-webkit-backdrop-filter: blur(10px);
|
|
70
|
-
border: 1px solid var(--wp-border-strong);
|
|
71
|
-
border-left: 3px solid var(--toast-tone);
|
|
72
|
-
border-radius: var(--wp-radius-md);
|
|
73
|
-
box-shadow: var(--wp-shadow-md);
|
|
74
|
-
color: var(--wp-text);
|
|
75
|
-
font-family: var(--wp-font-sans);
|
|
76
|
-
font-size: var(--wp-text-sm);
|
|
77
|
-
line-height: 1.4;
|
|
78
|
-
}
|
|
79
|
-
.wp-toast--success { --toast-tone: var(--wp-success); }
|
|
80
|
-
.wp-toast--warn { --toast-tone: var(--wp-warn); }
|
|
81
|
-
.wp-toast--error { --toast-tone: var(--wp-danger); }
|
|
82
|
-
|
|
83
|
-
.wp-toast__icon { flex-shrink: 0; font-size: 14px; color: var(--toast-tone); }
|
|
84
|
-
.wp-toast__text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
85
|
-
.wp-toast__summary { font-weight: 600; }
|
|
86
|
-
.wp-toast__detail { margin-top: 1px; color: var(--wp-text-muted); font-size: var(--wp-text-xs); }
|
|
87
|
-
|
|
88
|
-
.wp-toast__action {
|
|
89
|
-
flex-shrink: 0;
|
|
90
|
-
height: var(--wp-control-h-sm);
|
|
91
|
-
padding: 0 var(--wp-space-4);
|
|
92
|
-
background: transparent;
|
|
93
|
-
border: 1px solid var(--wp-border-strong);
|
|
94
|
-
border-radius: var(--wp-radius-sm);
|
|
95
|
-
color: var(--wp-text);
|
|
96
|
-
font: 600 var(--wp-text-xs) var(--wp-font-sans);
|
|
97
|
-
cursor: pointer;
|
|
98
|
-
transition: background var(--wp-motion-quick), border-color var(--wp-motion-quick);
|
|
99
|
-
}
|
|
100
|
-
.wp-toast__action:hover { background: var(--wp-bg-4); border-color: var(--wp-accent-500); }
|
|
101
|
-
|
|
102
|
-
.wp-toast__close {
|
|
103
|
-
display: grid;
|
|
104
|
-
place-items: center;
|
|
105
|
-
flex-shrink: 0;
|
|
106
|
-
width: 24px;
|
|
107
|
-
height: 24px;
|
|
108
|
-
padding: 0;
|
|
109
|
-
background: none;
|
|
110
|
-
border: 0;
|
|
111
|
-
border-radius: var(--wp-radius-sm);
|
|
112
|
-
color: var(--wp-text-dim);
|
|
113
|
-
cursor: pointer;
|
|
114
|
-
}
|
|
115
|
-
.wp-toast__close .pi { font-size: 10px; }
|
|
116
|
-
.wp-toast__close:hover { color: var(--wp-text); background: var(--wp-bg-4); }
|
|
117
|
-
.wp-toast__action:focus-visible,
|
|
118
|
-
.wp-toast__close:focus-visible { outline: none; box-shadow: var(--wp-focus-ring); }
|
|
119
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* One toast: the look both toast stacks share.
|
|
4
|
+
*
|
|
5
|
+
* The manager (`ui/ToastHost.vue`, fed by `useToast()`) and the canvas
|
|
6
|
+
* (`shared/Toast.vue`, fed by `toast-store`) used to draw toasts two ways:
|
|
7
|
+
* different surfaces, borders, icons and action buttons. Now each host keeps
|
|
8
|
+
* only its own store and its own place on screen, and renders this card.
|
|
9
|
+
* It reads only SHARED_TOKENS, so it wears the colours of the side it is on.
|
|
10
|
+
*
|
|
11
|
+
* `tone` follows the kit's names; the canvas store's `warning` maps to
|
|
12
|
+
* `warn` in its host.
|
|
13
|
+
*/
|
|
14
|
+
const props = defineProps<{
|
|
15
|
+
tone: "info" | "success" | "warn" | "error";
|
|
16
|
+
summary: string;
|
|
17
|
+
detail?: string | undefined;
|
|
18
|
+
/** Label of the inline action (Undo, Open…); emits `action`. */
|
|
19
|
+
actionLabel?: string | undefined;
|
|
20
|
+
}>();
|
|
21
|
+
|
|
22
|
+
const emit = defineEmits<{ action: []; dismiss: [] }>();
|
|
23
|
+
|
|
24
|
+
const ICONS = {
|
|
25
|
+
info: "pi-info-circle",
|
|
26
|
+
success: "pi-check-circle",
|
|
27
|
+
warn: "pi-exclamation-triangle",
|
|
28
|
+
error: "pi-times-circle",
|
|
29
|
+
} as const;
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div :class="['wp-toast', `wp-toast--${props.tone}`]" role="status" data-test="toast">
|
|
34
|
+
<i :class="['pi', ICONS[props.tone], 'wp-toast__icon']" aria-hidden="true" />
|
|
35
|
+
<div class="wp-toast__text">
|
|
36
|
+
<div class="wp-toast__summary">{{ summary }}</div>
|
|
37
|
+
<div v-if="detail" class="wp-toast__detail">{{ detail }}</div>
|
|
38
|
+
</div>
|
|
39
|
+
<button
|
|
40
|
+
v-if="actionLabel"
|
|
41
|
+
type="button"
|
|
42
|
+
class="wp-toast__action"
|
|
43
|
+
data-test="toast-action"
|
|
44
|
+
@click="emit('action')"
|
|
45
|
+
>{{ actionLabel }}</button>
|
|
46
|
+
<button
|
|
47
|
+
type="button"
|
|
48
|
+
class="wp-toast__close"
|
|
49
|
+
aria-label="Dismiss"
|
|
50
|
+
@click="emit('dismiss')"
|
|
51
|
+
><i class="pi pi-times" aria-hidden="true" /></button>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<style scoped>
|
|
56
|
+
.wp-toast {
|
|
57
|
+
--toast-tone: var(--wp-info);
|
|
58
|
+
pointer-events: auto;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: var(--wp-space-4);
|
|
62
|
+
min-width: 220px;
|
|
63
|
+
max-width: 420px;
|
|
64
|
+
padding: var(--wp-space-4) var(--wp-space-4) var(--wp-space-4) var(--wp-space-5);
|
|
65
|
+
/* Slightly see-through with a blur, so it reads as floating over
|
|
66
|
+
whatever is underneath without a heavy shadow. */
|
|
67
|
+
background: color-mix(in oklab, var(--wp-bg-3) 94%, transparent);
|
|
68
|
+
backdrop-filter: blur(10px);
|
|
69
|
+
-webkit-backdrop-filter: blur(10px);
|
|
70
|
+
border: 1px solid var(--wp-border-strong);
|
|
71
|
+
border-left: 3px solid var(--toast-tone);
|
|
72
|
+
border-radius: var(--wp-radius-md);
|
|
73
|
+
box-shadow: var(--wp-shadow-md);
|
|
74
|
+
color: var(--wp-text);
|
|
75
|
+
font-family: var(--wp-font-sans);
|
|
76
|
+
font-size: var(--wp-text-sm);
|
|
77
|
+
line-height: 1.4;
|
|
78
|
+
}
|
|
79
|
+
.wp-toast--success { --toast-tone: var(--wp-success); }
|
|
80
|
+
.wp-toast--warn { --toast-tone: var(--wp-warn); }
|
|
81
|
+
.wp-toast--error { --toast-tone: var(--wp-danger); }
|
|
82
|
+
|
|
83
|
+
.wp-toast__icon { flex-shrink: 0; font-size: 14px; color: var(--toast-tone); }
|
|
84
|
+
.wp-toast__text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
85
|
+
.wp-toast__summary { font-weight: 600; }
|
|
86
|
+
.wp-toast__detail { margin-top: 1px; color: var(--wp-text-muted); font-size: var(--wp-text-xs); }
|
|
87
|
+
|
|
88
|
+
.wp-toast__action {
|
|
89
|
+
flex-shrink: 0;
|
|
90
|
+
height: var(--wp-control-h-sm);
|
|
91
|
+
padding: 0 var(--wp-space-4);
|
|
92
|
+
background: transparent;
|
|
93
|
+
border: 1px solid var(--wp-border-strong);
|
|
94
|
+
border-radius: var(--wp-radius-sm);
|
|
95
|
+
color: var(--wp-text);
|
|
96
|
+
font: 600 var(--wp-text-xs) var(--wp-font-sans);
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
transition: background var(--wp-motion-quick), border-color var(--wp-motion-quick);
|
|
99
|
+
}
|
|
100
|
+
.wp-toast__action:hover { background: var(--wp-bg-4); border-color: var(--wp-accent-500); }
|
|
101
|
+
|
|
102
|
+
.wp-toast__close {
|
|
103
|
+
display: grid;
|
|
104
|
+
place-items: center;
|
|
105
|
+
flex-shrink: 0;
|
|
106
|
+
width: 24px;
|
|
107
|
+
height: 24px;
|
|
108
|
+
padding: 0;
|
|
109
|
+
background: none;
|
|
110
|
+
border: 0;
|
|
111
|
+
border-radius: var(--wp-radius-sm);
|
|
112
|
+
color: var(--wp-text-dim);
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
}
|
|
115
|
+
.wp-toast__close .pi { font-size: 10px; }
|
|
116
|
+
.wp-toast__close:hover { color: var(--wp-text); background: var(--wp-bg-4); }
|
|
117
|
+
.wp-toast__action:focus-visible,
|
|
118
|
+
.wp-toast__close:focus-visible { outline: none; box-shadow: var(--wp-focus-ring); }
|
|
119
|
+
</style>
|
package/src/ToastHost.vue
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* The manager's toast stack (bottom right). The toast itself is the shared
|
|
4
|
-
* ToastCard, the same one the canvas stack draws.
|
|
5
|
-
*/
|
|
6
|
-
import { useToast } from "./useToast";
|
|
7
|
-
import ToastCard from "./ToastCard.vue";
|
|
8
|
-
|
|
9
|
-
const { toasts, push, dismiss } = useToast();
|
|
10
|
-
|
|
11
|
-
async function runAction(id: string, handler: () => void | Promise<void>) {
|
|
12
|
-
try {
|
|
13
|
-
await handler();
|
|
14
|
-
} catch (e) {
|
|
15
|
-
push({
|
|
16
|
-
severity: "error",
|
|
17
|
-
summary: "Undo failed",
|
|
18
|
-
detail: e instanceof Error ? e.message : String(e),
|
|
19
|
-
life: 4000,
|
|
20
|
-
});
|
|
21
|
-
} finally {
|
|
22
|
-
dismiss(id);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<template>
|
|
28
|
-
<div class="wp-toast-stack" aria-live="polite" aria-atomic="true">
|
|
29
|
-
<ToastCard
|
|
30
|
-
v-for="t in toasts"
|
|
31
|
-
:key="t.id"
|
|
32
|
-
:tone="t.severity"
|
|
33
|
-
:summary="t.summary"
|
|
34
|
-
:detail="t.detail"
|
|
35
|
-
:action-label="t.action?.label"
|
|
36
|
-
@action="t.action && runAction(t.id, t.action.run)"
|
|
37
|
-
@dismiss="dismiss(t.id)"
|
|
38
|
-
/>
|
|
39
|
-
</div>
|
|
40
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The manager's toast stack (bottom right). The toast itself is the shared
|
|
4
|
+
* ToastCard, the same one the canvas stack draws.
|
|
5
|
+
*/
|
|
6
|
+
import { useToast } from "./useToast";
|
|
7
|
+
import ToastCard from "./ToastCard.vue";
|
|
8
|
+
|
|
9
|
+
const { toasts, push, dismiss } = useToast();
|
|
10
|
+
|
|
11
|
+
async function runAction(id: string, handler: () => void | Promise<void>) {
|
|
12
|
+
try {
|
|
13
|
+
await handler();
|
|
14
|
+
} catch (e) {
|
|
15
|
+
push({
|
|
16
|
+
severity: "error",
|
|
17
|
+
summary: "Undo failed",
|
|
18
|
+
detail: e instanceof Error ? e.message : String(e),
|
|
19
|
+
life: 4000,
|
|
20
|
+
});
|
|
21
|
+
} finally {
|
|
22
|
+
dismiss(id);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div class="wp-toast-stack" aria-live="polite" aria-atomic="true">
|
|
29
|
+
<ToastCard
|
|
30
|
+
v-for="t in toasts"
|
|
31
|
+
:key="t.id"
|
|
32
|
+
:tone="t.severity"
|
|
33
|
+
:summary="t.summary"
|
|
34
|
+
:detail="t.detail"
|
|
35
|
+
:action-label="t.action?.label"
|
|
36
|
+
@action="t.action && runAction(t.id, t.action.run)"
|
|
37
|
+
@dismiss="dismiss(t.id)"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|