@leavepulse/ui 0.26.1 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{LpCard-BmrTvWOe.js → LpCard-gu11ZmSt.js} +9 -1
- package/dist/chunks/LpSection-aM6J_u51.js +93 -0
- package/dist/chunks/{LpSkeleton-DpXLDcQm.js → LpSkeleton-CTI-vBgW.js} +1 -1
- package/dist/component-names.d.ts +1 -1
- package/dist/components/LpCard.vue.js +1 -1
- package/dist/components/LpSection.vue.d.ts +120 -0
- package/dist/components/LpSection.vue.js +4 -0
- package/dist/components/LpSkeleton.vue.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +43 -41
- package/package.json +1 -1
- package/src/component-names.ts +1 -0
- package/src/components/LpCard.vue +9 -1
- package/src/components/LpSection.vue +137 -0
- package/src/components/LpSkeleton.vue +1 -1
- package/src/index.ts +1 -0
|
@@ -14,7 +14,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
14
14
|
},
|
|
15
15
|
setup(__props) {
|
|
16
16
|
const card = tv({
|
|
17
|
-
|
|
17
|
+
// break-words: a card is where text with no spaces in it ends up (a
|
|
18
|
+
// hostname, a URL, a container id, a stack frame), and an unbreakable run
|
|
19
|
+
// otherwise pushes straight out through the border, over whatever sits
|
|
20
|
+
// beside it. Set here rather than on the components that go inside, so that
|
|
21
|
+
// a paragraph written by hand behaves the same as one a kit component
|
|
22
|
+
// renders: two lines that look identical must not wrap differently.
|
|
23
|
+
// Anything that genuinely must not break (a code block, a log line) sets its
|
|
24
|
+
// own overflow and scrolls instead.
|
|
25
|
+
base: "rounded-card border bg-surface-raised break-words",
|
|
18
26
|
variants: {
|
|
19
27
|
variant: {
|
|
20
28
|
// raised opts into the skin painter (.lp-skin-panel) so it follows the
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, createBlock, createCommentVNode, resolveDynamicComponent, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
|
|
4
|
+
const _hoisted_1 = { class: "min-w-0 flex-1 break-words" };
|
|
5
|
+
const _hoisted_2 = { class: "flex flex-wrap items-center gap-2" };
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "LpSection",
|
|
8
|
+
props: {
|
|
9
|
+
title: {},
|
|
10
|
+
description: {},
|
|
11
|
+
icon: {},
|
|
12
|
+
level: { default: "md" },
|
|
13
|
+
as: { default: "h2" }
|
|
14
|
+
},
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const section = tv({
|
|
17
|
+
slots: {
|
|
18
|
+
root: "flex flex-wrap justify-between gap-x-4 gap-y-2",
|
|
19
|
+
title: "font-semibold text-ink",
|
|
20
|
+
description: "mt-1 text-sm text-muted",
|
|
21
|
+
actions: "flex shrink-0 flex-wrap items-center gap-2"
|
|
22
|
+
},
|
|
23
|
+
variants: {
|
|
24
|
+
// Where the actions sit against a two-line block. With a description the
|
|
25
|
+
// heading is the top line, so the actions belong level with THAT rather
|
|
26
|
+
// than floating to the middle of the pair. With no description there is
|
|
27
|
+
// only one line, and pinning to the top instead misaligns anything taller
|
|
28
|
+
// than the text (an input, a segmented control) by a couple of pixels.
|
|
29
|
+
described: {
|
|
30
|
+
true: { root: "items-start" },
|
|
31
|
+
false: { root: "items-center" }
|
|
32
|
+
},
|
|
33
|
+
level: {
|
|
34
|
+
sm: { title: "text-sm" },
|
|
35
|
+
md: { title: "text-base" },
|
|
36
|
+
lg: { title: "text-lg tracking-tight" },
|
|
37
|
+
xl: { title: "text-xl tracking-tight" }
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: { level: "md", described: false }
|
|
41
|
+
});
|
|
42
|
+
const props = __props;
|
|
43
|
+
const slots = useSlots();
|
|
44
|
+
const hasDescription = computed(() => !!props.description || !!slots.description);
|
|
45
|
+
const classes = computed(
|
|
46
|
+
() => section({ level: props.level, described: hasDescription.value })
|
|
47
|
+
);
|
|
48
|
+
return (_ctx, _cache) => {
|
|
49
|
+
return openBlock(), createElementBlock("div", {
|
|
50
|
+
class: normalizeClass(classes.value.root())
|
|
51
|
+
}, [
|
|
52
|
+
createElementVNode("div", _hoisted_1, [
|
|
53
|
+
createElementVNode("div", _hoisted_2, [
|
|
54
|
+
__props.icon ? (openBlock(), createBlock(_sfc_main$1, {
|
|
55
|
+
key: 0,
|
|
56
|
+
name: __props.icon,
|
|
57
|
+
size: 16,
|
|
58
|
+
class: "shrink-0 text-muted"
|
|
59
|
+
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
60
|
+
(openBlock(), createBlock(resolveDynamicComponent(__props.as), {
|
|
61
|
+
class: normalizeClass(classes.value.title())
|
|
62
|
+
}, {
|
|
63
|
+
default: withCtx(() => [
|
|
64
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
65
|
+
createTextVNode(toDisplayString(__props.title), 1)
|
|
66
|
+
])
|
|
67
|
+
]),
|
|
68
|
+
_: 3
|
|
69
|
+
}, 8, ["class"])),
|
|
70
|
+
renderSlot(_ctx.$slots, "meta")
|
|
71
|
+
]),
|
|
72
|
+
hasDescription.value ? (openBlock(), createElementBlock("p", {
|
|
73
|
+
key: 0,
|
|
74
|
+
class: normalizeClass(classes.value.description())
|
|
75
|
+
}, [
|
|
76
|
+
renderSlot(_ctx.$slots, "description", {}, () => [
|
|
77
|
+
createTextVNode(toDisplayString(__props.description), 1)
|
|
78
|
+
])
|
|
79
|
+
], 2)) : createCommentVNode("", true)
|
|
80
|
+
]),
|
|
81
|
+
_ctx.$slots.actions ? (openBlock(), createElementBlock("div", {
|
|
82
|
+
key: 0,
|
|
83
|
+
class: normalizeClass(classes.value.actions())
|
|
84
|
+
}, [
|
|
85
|
+
renderSlot(_ctx.$slots, "actions")
|
|
86
|
+
], 2)) : createCommentVNode("", true)
|
|
87
|
+
], 2);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
export {
|
|
92
|
+
_sfc_main as _
|
|
93
|
+
};
|
|
@@ -12,7 +12,7 @@ import '../assets/LpSkeleton-D7xU8IPV.css';const _sfc_main = /* @__PURE__ */ def
|
|
|
12
12
|
"aria-hidden": "true",
|
|
13
13
|
class: normalizeClass(["lp-skeleton", [
|
|
14
14
|
// `rounded` describes the PLACEHOLDER's own shape, so it only applies to
|
|
15
|
-
// the bare form. A wrapper is invisible
|
|
15
|
+
// the bare form. A wrapper is invisible, so rounding it would clip the
|
|
16
16
|
// layout inside without anything being drawn to justify the corner.
|
|
17
17
|
isBlock.value ? [
|
|
18
18
|
"lp-skeleton-item bg-surface-soft",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const COMPONENT_NAMES: readonly ["LayoutCanvas", "LayoutNode", "LpAddressInput", "LpAlert", "LpAppShell", "LpAutocomplete", "LpAvatar", "LpBadge", "LpBreadcrumbs", "LpButton", "LpCalendar", "LpCard", "LpChart", "LpCheckbox", "LpCodeBlock", "LpCommandPalette", "LpConfirmDialog", "LpContextMenu", "LpDatePicker", "LpDisclosure", "LpDivider", "LpDrawer", "LpDropdownMenu", "LpEmptyState", "LpFileTree", "LpFileTreeNode", "LpFormField", "LpIcon", "LpInfraNode", "LpInput", "LpLaneNode", "LpLightbox", "LpLink", "LpLogViewer", "LpMapPicker", "LpModal", "LpNotificationBell", "LpNumberField", "LpNumberFlow", "LpOtpInput", "LpPagination", "LpPasswordInput", "LpPhoneInput", "LpPie", "LpPopover", "LpProgress", "LpRadio", "LpRadioGroup", "LpRollingText", "LpScrollArea", "LpSegmented", "LpSelect", "LpServiceNode", "LpShift", "LpShortcutsDialog", "LpSidebar", "LpSidebarNav", "LpSkeleton", "LpSlider", "LpSparkline", "LpStat", "LpStepper", "LpSwitch", "LpTable", "LpTableOfContents", "LpTabs", "LpTextarea", "LpThemeSwitcher", "LpTilt", "LpToaster", "LpTooltip", "LpTopologyCanvas", "LpUptimeBar", "LpWaypointEdge"];
|
|
1
|
+
export declare const COMPONENT_NAMES: readonly ["LayoutCanvas", "LayoutNode", "LpAddressInput", "LpAlert", "LpAppShell", "LpAutocomplete", "LpAvatar", "LpBadge", "LpBreadcrumbs", "LpButton", "LpCalendar", "LpCard", "LpChart", "LpCheckbox", "LpCodeBlock", "LpCommandPalette", "LpConfirmDialog", "LpContextMenu", "LpDatePicker", "LpDisclosure", "LpDivider", "LpDrawer", "LpDropdownMenu", "LpEmptyState", "LpFileTree", "LpFileTreeNode", "LpFormField", "LpIcon", "LpInfraNode", "LpInput", "LpLaneNode", "LpLightbox", "LpLink", "LpLogViewer", "LpMapPicker", "LpModal", "LpNotificationBell", "LpNumberField", "LpNumberFlow", "LpOtpInput", "LpPagination", "LpPasswordInput", "LpPhoneInput", "LpPie", "LpPopover", "LpProgress", "LpRadio", "LpRadioGroup", "LpRollingText", "LpScrollArea", "LpSection", "LpSegmented", "LpSelect", "LpServiceNode", "LpShift", "LpShortcutsDialog", "LpSidebar", "LpSidebarNav", "LpSkeleton", "LpSlider", "LpSparkline", "LpStat", "LpStepper", "LpSwitch", "LpTable", "LpTableOfContents", "LpTabs", "LpTextarea", "LpThemeSwitcher", "LpTilt", "LpToaster", "LpTooltip", "LpTopologyCanvas", "LpUptimeBar", "LpWaypointEdge"];
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const section: import('tailwind-variants').TVReturnType<{
|
|
3
|
+
described: {
|
|
4
|
+
true: {
|
|
5
|
+
root: string;
|
|
6
|
+
};
|
|
7
|
+
false: {
|
|
8
|
+
root: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
level: {
|
|
12
|
+
sm: {
|
|
13
|
+
title: string;
|
|
14
|
+
};
|
|
15
|
+
md: {
|
|
16
|
+
title: string;
|
|
17
|
+
};
|
|
18
|
+
lg: {
|
|
19
|
+
title: string;
|
|
20
|
+
};
|
|
21
|
+
xl: {
|
|
22
|
+
title: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}, {
|
|
26
|
+
root: string;
|
|
27
|
+
title: string;
|
|
28
|
+
description: string;
|
|
29
|
+
actions: string;
|
|
30
|
+
}, undefined, {
|
|
31
|
+
described: {
|
|
32
|
+
true: {
|
|
33
|
+
root: string;
|
|
34
|
+
};
|
|
35
|
+
false: {
|
|
36
|
+
root: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
level: {
|
|
40
|
+
sm: {
|
|
41
|
+
title: string;
|
|
42
|
+
};
|
|
43
|
+
md: {
|
|
44
|
+
title: string;
|
|
45
|
+
};
|
|
46
|
+
lg: {
|
|
47
|
+
title: string;
|
|
48
|
+
};
|
|
49
|
+
xl: {
|
|
50
|
+
title: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}, {
|
|
54
|
+
root: string;
|
|
55
|
+
title: string;
|
|
56
|
+
description: string;
|
|
57
|
+
actions: string;
|
|
58
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
59
|
+
described: {
|
|
60
|
+
true: {
|
|
61
|
+
root: string;
|
|
62
|
+
};
|
|
63
|
+
false: {
|
|
64
|
+
root: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
level: {
|
|
68
|
+
sm: {
|
|
69
|
+
title: string;
|
|
70
|
+
};
|
|
71
|
+
md: {
|
|
72
|
+
title: string;
|
|
73
|
+
};
|
|
74
|
+
lg: {
|
|
75
|
+
title: string;
|
|
76
|
+
};
|
|
77
|
+
xl: {
|
|
78
|
+
title: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
}, {
|
|
82
|
+
root: string;
|
|
83
|
+
title: string;
|
|
84
|
+
description: string;
|
|
85
|
+
actions: string;
|
|
86
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
87
|
+
type SectionVariants = VariantProps<typeof section>;
|
|
88
|
+
type __VLS_Props = {
|
|
89
|
+
title?: string;
|
|
90
|
+
/** One line under the title. */
|
|
91
|
+
description?: string;
|
|
92
|
+
/** Iconify name shown before the title, e.g. "lucide:server". */
|
|
93
|
+
icon?: string;
|
|
94
|
+
/** Visual size. Independent of `as`, see the note above. */
|
|
95
|
+
level?: SectionVariants["level"];
|
|
96
|
+
/** The heading element to render. Pick it for the document outline. */
|
|
97
|
+
as?: "h1" | "h2" | "h3" | "h4" | "p";
|
|
98
|
+
};
|
|
99
|
+
type __VLS_Slots = {
|
|
100
|
+
/** Title markup, when a plain string is not enough. */
|
|
101
|
+
title?: () => unknown;
|
|
102
|
+
/** Description markup, when a plain string is not enough. */
|
|
103
|
+
description?: () => unknown;
|
|
104
|
+
/** Right-aligned controls: buttons, filters, a count. */
|
|
105
|
+
actions?: () => unknown;
|
|
106
|
+
/** Extra content beside the title: a badge, a count, a status dot. */
|
|
107
|
+
meta?: () => unknown;
|
|
108
|
+
};
|
|
109
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
110
|
+
as: "h1" | "h2" | "h3" | "h4" | "p";
|
|
111
|
+
level: "sm" | "md" | "lg" | "xl";
|
|
112
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
113
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
114
|
+
declare const _default: typeof __VLS_export;
|
|
115
|
+
export default _default;
|
|
116
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
117
|
+
new (): {
|
|
118
|
+
$slots: S;
|
|
119
|
+
};
|
|
120
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export { default as LpRollingText } from './components/LpRollingText.vue';
|
|
|
73
73
|
export { default as LpScrollArea } from './components/LpScrollArea.vue';
|
|
74
74
|
export { default as LpSegmented } from './components/LpSegmented.vue';
|
|
75
75
|
export type { SegmentedOption } from './components/LpSegmented.vue';
|
|
76
|
+
export { default as LpSection } from './components/LpSection.vue';
|
|
76
77
|
export { default as LpSelect } from './components/LpSelect.vue';
|
|
77
78
|
export type { SelectOption, SelectValue } from './components/LpSelect.vue';
|
|
78
79
|
export { default as LpServiceNode } from './components/LpServiceNode.vue';
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { _ as _8 } from "./chunks/LpBadge-BPodVcJa.js";
|
|
|
10
10
|
import { _ as _9 } from "./chunks/LpBreadcrumbs-5uvViCXi.js";
|
|
11
11
|
import { _ as _10 } from "./chunks/LpButton-5VXXCjwF.js";
|
|
12
12
|
import { _ as _11 } from "./chunks/LpCalendar-B7ZL0ty3.js";
|
|
13
|
-
import { _ as _12 } from "./chunks/LpCard-
|
|
13
|
+
import { _ as _12 } from "./chunks/LpCard-gu11ZmSt.js";
|
|
14
14
|
import { _ as _13 } from "./chunks/LpChart-tNXs1ttr.js";
|
|
15
15
|
import { CHART_PALETTE, axisTicks, formatTick, niceScale, resolveSlices } from "./components/chart.js";
|
|
16
16
|
import { _ as _14 } from "./chunks/LpCheckbox-BO0zuuPh.js";
|
|
@@ -51,28 +51,29 @@ import { _ as _44 } from "./chunks/LpRadioGroup-B4yDTmi6.js";
|
|
|
51
51
|
import { _ as _45 } from "./chunks/LpRollingText-CM5gkSeF.js";
|
|
52
52
|
import { _ as _46 } from "./chunks/LpScrollArea-D8xyKXcF.js";
|
|
53
53
|
import { _ as _47 } from "./chunks/LpSegmented-BmpanyAo.js";
|
|
54
|
-
import { _ as _48 } from "./chunks/
|
|
55
|
-
import { _ as _49 } from "./chunks/
|
|
56
|
-
import { _ as _50 } from "./chunks/
|
|
54
|
+
import { _ as _48 } from "./chunks/LpSection-aM6J_u51.js";
|
|
55
|
+
import { _ as _49 } from "./chunks/LpSelect-Cw8-gL5F.js";
|
|
56
|
+
import { _ as _50 } from "./chunks/LpServiceNode-D8uJ8sGk.js";
|
|
57
|
+
import { _ as _51 } from "./chunks/LpShift-DXNsauQZ.js";
|
|
57
58
|
import { default as default3 } from "./components/LpShortcutsDialog.vue.js";
|
|
58
|
-
import { _ as
|
|
59
|
-
import { _ as
|
|
60
|
-
import { _ as
|
|
61
|
-
import { _ as
|
|
62
|
-
import { _ as
|
|
63
|
-
import { _ as
|
|
64
|
-
import { _ as
|
|
65
|
-
import { _ as
|
|
66
|
-
import { _ as
|
|
67
|
-
import { _ as
|
|
68
|
-
import { _ as
|
|
59
|
+
import { _ as _52 } from "./chunks/LpSidebar-7Vpy2IJc.js";
|
|
60
|
+
import { _ as _53 } from "./chunks/LpSkeleton-CTI-vBgW.js";
|
|
61
|
+
import { _ as _54 } from "./chunks/LpSlider-B1SF3pRV.js";
|
|
62
|
+
import { _ as _55 } from "./chunks/LpSparkline-C6xQ2dwv.js";
|
|
63
|
+
import { _ as _56 } from "./chunks/LpStat-CDanpzU0.js";
|
|
64
|
+
import { _ as _57 } from "./chunks/LpStepper-Wtl-6nUh.js";
|
|
65
|
+
import { _ as _58 } from "./chunks/LpSwitch-v6fnccSM.js";
|
|
66
|
+
import { _ as _59 } from "./chunks/LpTable-DTj52qlg.js";
|
|
67
|
+
import { _ as _60 } from "./chunks/LpTableOfContents-CjvxPMpU.js";
|
|
68
|
+
import { _ as _61 } from "./chunks/LpTabs-Cefe_lys.js";
|
|
69
|
+
import { _ as _62 } from "./chunks/LpTextarea-1ENb3ZAO.js";
|
|
69
70
|
import { p as presets, a as parseTheme, s as serializeTheme } from "./chunks/LpThemeSwitcher-7mAK6bI7.js";
|
|
70
|
-
import { D, _ as
|
|
71
|
-
import { _ as
|
|
72
|
-
import { _ as
|
|
73
|
-
import { _ as
|
|
74
|
-
import { _ as
|
|
75
|
-
import { _ as
|
|
71
|
+
import { D, _ as _63, N, T, b, c, d, e, f, g, i, l, h, j, n, r, t, k, m, u, v } from "./chunks/LpThemeSwitcher-7mAK6bI7.js";
|
|
72
|
+
import { _ as _64 } from "./chunks/LpTilt-DuyKbpkA.js";
|
|
73
|
+
import { _ as _65 } from "./chunks/LpToaster-gDB1EaU3.js";
|
|
74
|
+
import { _ as _66 } from "./chunks/LpTooltip-hCLPAqMG.js";
|
|
75
|
+
import { _ as _67 } from "./chunks/LpTopologyCanvas-ebP67CLx.js";
|
|
76
|
+
import { _ as _68 } from "./chunks/LpUptimeBar-DcQ8HikG.js";
|
|
76
77
|
import { deserializeLayout, serializeLayout } from "./layout/tree.js";
|
|
77
78
|
import { addLeaf, addTab, countBlocks, countLeaves, makeLayout, moveLeaf, removeBlock, removeLeaf, reorderTab, resizeAt, setActiveTab } from "./layout/tree.js";
|
|
78
79
|
import { blockTitle, defineBlocks } from "./layout/registry.js";
|
|
@@ -167,28 +168,29 @@ export {
|
|
|
167
168
|
_44 as LpRadioGroup,
|
|
168
169
|
_45 as LpRollingText,
|
|
169
170
|
_46 as LpScrollArea,
|
|
171
|
+
_48 as LpSection,
|
|
170
172
|
_47 as LpSegmented,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
_49 as LpSelect,
|
|
174
|
+
_50 as LpServiceNode,
|
|
175
|
+
_51 as LpShift,
|
|
174
176
|
default3 as LpShortcutsDialog,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
177
|
+
_52 as LpSidebar,
|
|
178
|
+
_53 as LpSkeleton,
|
|
179
|
+
_54 as LpSlider,
|
|
180
|
+
_55 as LpSparkline,
|
|
181
|
+
_56 as LpStat,
|
|
182
|
+
_57 as LpStepper,
|
|
183
|
+
_58 as LpSwitch,
|
|
184
|
+
_59 as LpTable,
|
|
185
|
+
_60 as LpTableOfContents,
|
|
186
|
+
_61 as LpTabs,
|
|
187
|
+
_62 as LpTextarea,
|
|
188
|
+
_63 as LpThemeSwitcher,
|
|
189
|
+
_64 as LpTilt,
|
|
190
|
+
_65 as LpToaster,
|
|
191
|
+
_66 as LpTooltip,
|
|
192
|
+
_67 as LpTopologyCanvas,
|
|
193
|
+
_68 as LpUptimeBar,
|
|
192
194
|
N as NO_BACKDROP_ATTR,
|
|
193
195
|
OSM_TILES,
|
|
194
196
|
T as THEME_COOKIE,
|
package/package.json
CHANGED
package/src/component-names.ts
CHANGED
|
@@ -11,7 +11,15 @@ import { computed } from "vue"
|
|
|
11
11
|
import LpContextMenu, { type ContextMenuItemDef } from "./LpContextMenu.vue"
|
|
12
12
|
|
|
13
13
|
const card = tv({
|
|
14
|
-
|
|
14
|
+
// break-words: a card is where text with no spaces in it ends up (a
|
|
15
|
+
// hostname, a URL, a container id, a stack frame), and an unbreakable run
|
|
16
|
+
// otherwise pushes straight out through the border, over whatever sits
|
|
17
|
+
// beside it. Set here rather than on the components that go inside, so that
|
|
18
|
+
// a paragraph written by hand behaves the same as one a kit component
|
|
19
|
+
// renders: two lines that look identical must not wrap differently.
|
|
20
|
+
// Anything that genuinely must not break (a code block, a log line) sets its
|
|
21
|
+
// own overflow and scrolls instead.
|
|
22
|
+
base: "rounded-card border bg-surface-raised break-words",
|
|
15
23
|
variants: {
|
|
16
24
|
variant: {
|
|
17
25
|
// raised opts into the skin painter (.lp-skin-panel) so it follows the
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/*
|
|
3
|
+
* A section heading: a title, an optional line under it, and actions on the
|
|
4
|
+
* right.
|
|
5
|
+
*
|
|
6
|
+
* <LpSection title="Recent invoices">
|
|
7
|
+
* <template #actions><LpButton size="sm">Export</LpButton></template>
|
|
8
|
+
* </LpSection>
|
|
9
|
+
*
|
|
10
|
+
* This is the block every app rebuilt: ~140 hand-written headings across the
|
|
11
|
+
* three of them, each picking its own size, its own gap, its own alignment.
|
|
12
|
+
* LeaveHosting had already extracted its own `PageHeader.vue` with the same
|
|
13
|
+
* title, description and actions slot, which is the clearest evidence the
|
|
14
|
+
* shape is shared rather than one app's habit.
|
|
15
|
+
*
|
|
16
|
+
* What it deliberately does NOT do:
|
|
17
|
+
*
|
|
18
|
+
* - It draws no container. In the panel these headings sit inside LpCard; in
|
|
19
|
+
* the cabinet they sit inside `glass rounded-3xl` blocks and, more often,
|
|
20
|
+
* directly on the page. Owning a border here would fight two of the three.
|
|
21
|
+
* - It has no icon slot of its own beyond `icon`. The panel coloured each
|
|
22
|
+
* heading's icon from the raw palette (amber beside rose beside sky) in
|
|
23
|
+
* pages where none of those states were amber, rose or blue. One muted
|
|
24
|
+
* colour, or none.
|
|
25
|
+
*
|
|
26
|
+
* `level` is the visual size and is independent of `as`, the heading element:
|
|
27
|
+
* a page's main heading may need to be an h1 rendered small, and a card's
|
|
28
|
+
* heading an h3 rendered large. Tying them together is what made consumers
|
|
29
|
+
* reach past the component for a raw <h2> again.
|
|
30
|
+
*/
|
|
31
|
+
import { computed } from "vue"
|
|
32
|
+
import { tv, type VariantProps } from "tailwind-variants"
|
|
33
|
+
import LpIcon from "./LpIcon.vue"
|
|
34
|
+
|
|
35
|
+
const section = tv({
|
|
36
|
+
slots: {
|
|
37
|
+
root: "flex flex-wrap justify-between gap-x-4 gap-y-2",
|
|
38
|
+
title: "font-semibold text-ink",
|
|
39
|
+
description: "mt-1 text-sm text-muted",
|
|
40
|
+
actions: "flex shrink-0 flex-wrap items-center gap-2",
|
|
41
|
+
},
|
|
42
|
+
variants: {
|
|
43
|
+
// Where the actions sit against a two-line block. With a description the
|
|
44
|
+
// heading is the top line, so the actions belong level with THAT rather
|
|
45
|
+
// than floating to the middle of the pair. With no description there is
|
|
46
|
+
// only one line, and pinning to the top instead misaligns anything taller
|
|
47
|
+
// than the text (an input, a segmented control) by a couple of pixels.
|
|
48
|
+
described: {
|
|
49
|
+
true: { root: "items-start" },
|
|
50
|
+
false: { root: "items-center" },
|
|
51
|
+
},
|
|
52
|
+
level: {
|
|
53
|
+
sm: { title: "text-sm" },
|
|
54
|
+
md: { title: "text-base" },
|
|
55
|
+
lg: { title: "text-lg tracking-tight" },
|
|
56
|
+
xl: { title: "text-xl tracking-tight" },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: { level: "md", described: false },
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
type SectionVariants = VariantProps<typeof section>
|
|
63
|
+
|
|
64
|
+
const props = withDefaults(
|
|
65
|
+
defineProps<{
|
|
66
|
+
title?: string
|
|
67
|
+
/** One line under the title. */
|
|
68
|
+
description?: string
|
|
69
|
+
/** Iconify name shown before the title, e.g. "lucide:server". */
|
|
70
|
+
icon?: string
|
|
71
|
+
/** Visual size. Independent of `as`, see the note above. */
|
|
72
|
+
level?: SectionVariants["level"]
|
|
73
|
+
/** The heading element to render. Pick it for the document outline. */
|
|
74
|
+
as?: "h1" | "h2" | "h3" | "h4" | "p"
|
|
75
|
+
}>(),
|
|
76
|
+
{ level: "md", as: "h2" },
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
* `title` and `description` each come in two forms, and they are one opening
|
|
81
|
+
* rather than two: the prop is what the slot renders when nothing fills it.
|
|
82
|
+
* Both are a plain string nine times out of ten (usually a t() call), and
|
|
83
|
+
* making those pass through a <template> would tax the common case for the
|
|
84
|
+
* sake of the rare one. But the rare one is real (a name with an id after it,
|
|
85
|
+
* a description carrying a link), and without the slot it is what sends people
|
|
86
|
+
* back to hand-writing the block the component exists to standardise.
|
|
87
|
+
*/
|
|
88
|
+
const slots = defineSlots<{
|
|
89
|
+
/** Title markup, when a plain string is not enough. */
|
|
90
|
+
title?: () => unknown
|
|
91
|
+
/** Description markup, when a plain string is not enough. */
|
|
92
|
+
description?: () => unknown
|
|
93
|
+
/** Right-aligned controls: buttons, filters, a count. */
|
|
94
|
+
actions?: () => unknown
|
|
95
|
+
/** Extra content beside the title: a badge, a count, a status dot. */
|
|
96
|
+
meta?: () => unknown
|
|
97
|
+
}>()
|
|
98
|
+
|
|
99
|
+
// Either form counts as "described": the actions align against a two-line
|
|
100
|
+
// block whether the second line came from the prop or the slot.
|
|
101
|
+
const hasDescription = computed(() => !!props.description || !!slots.description)
|
|
102
|
+
|
|
103
|
+
const classes = computed(() =>
|
|
104
|
+
section({ level: props.level, described: hasDescription.value }),
|
|
105
|
+
)
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<template>
|
|
109
|
+
<div :class="classes.root()">
|
|
110
|
+
<!-- `flex-1` matters as much as `min-w-0`: without it a long description
|
|
111
|
+
stretches this column across the whole row, and the actions wrap to a
|
|
112
|
+
line of their own even when they would have fitted beside the title.
|
|
113
|
+
With it the column takes the space that is left and shrinks first.
|
|
114
|
+
|
|
115
|
+
`break-words` covers the title AND the description in one place. Both
|
|
116
|
+
routinely carry something with no spaces in it (a hostname, a URL, a
|
|
117
|
+
container id), and an unbreakable run pushes straight out through the
|
|
118
|
+
side of whatever card the section sits in. min-w-0 lets the column
|
|
119
|
+
shrink; only this lets the text inside it give way. -->
|
|
120
|
+
<div class="min-w-0 flex-1 break-words">
|
|
121
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
122
|
+
<LpIcon v-if="icon" :name="icon" :size="16" class="shrink-0 text-muted" />
|
|
123
|
+
<component :is="as" :class="classes.title()">
|
|
124
|
+
<slot name="title">{{ title }}</slot>
|
|
125
|
+
</component>
|
|
126
|
+
<slot name="meta" />
|
|
127
|
+
</div>
|
|
128
|
+
<p v-if="hasDescription" :class="classes.description()">
|
|
129
|
+
<slot name="description">{{ description }}</slot>
|
|
130
|
+
</p>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<div v-if="$slots.actions" :class="classes.actions()">
|
|
134
|
+
<slot name="actions" />
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</template>
|
|
@@ -44,7 +44,7 @@ const isBlock = computed(() => !slots.default)
|
|
|
44
44
|
class="lp-skeleton"
|
|
45
45
|
:class="[
|
|
46
46
|
// `rounded` describes the PLACEHOLDER's own shape, so it only applies to
|
|
47
|
-
// the bare form. A wrapper is invisible
|
|
47
|
+
// the bare form. A wrapper is invisible, so rounding it would clip the
|
|
48
48
|
// layout inside without anything being drawn to justify the corner.
|
|
49
49
|
isBlock
|
|
50
50
|
? [
|
package/src/index.ts
CHANGED
|
@@ -110,6 +110,7 @@ export { default as LpRollingText } from "./components/LpRollingText.vue"
|
|
|
110
110
|
export { default as LpScrollArea } from "./components/LpScrollArea.vue"
|
|
111
111
|
export { default as LpSegmented } from "./components/LpSegmented.vue"
|
|
112
112
|
export type { SegmentedOption } from "./components/LpSegmented.vue"
|
|
113
|
+
export { default as LpSection } from "./components/LpSection.vue"
|
|
113
114
|
export { default as LpSelect } from "./components/LpSelect.vue"
|
|
114
115
|
export type { SelectOption, SelectValue } from "./components/LpSelect.vue"
|
|
115
116
|
export { default as LpServiceNode } from "./components/LpServiceNode.vue"
|