@leavepulse/ui 0.12.0 → 0.14.6
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/assets/LpCommandPalette-D315B47-.css +16 -0
- package/dist/chunks/LayoutCanvas-Dd20boUG.js +50 -0
- package/dist/chunks/LayoutNode-DGpZA9LX.js +225 -0
- package/dist/chunks/LpAlert-BAYHDSS1.js +69 -0
- package/dist/chunks/LpAppShell-DBTsNQaM.js +170 -0
- package/dist/chunks/LpAutocomplete-B9uoCs4t.js +196 -0
- package/dist/chunks/LpAvatar-B1Ez0ZAx.js +88 -0
- package/dist/chunks/LpBadge-CXzBPnwO.js +42 -0
- package/dist/chunks/LpBreadcrumbs-B7Aqatzw.js +42 -0
- package/dist/chunks/LpButton-5VXXCjwF.js +101 -0
- package/dist/chunks/LpCalendar-B7ZL0ty3.js +150 -0
- package/dist/chunks/LpCard-1yvWT9fx.js +66 -0
- package/dist/chunks/LpCheckbox-BO0zuuPh.js +55 -0
- package/dist/chunks/LpCodeBlock-CSiOSPs8.js +253 -0
- package/dist/chunks/LpConfirmDialog-KLtTtCiT.js +62 -0
- package/dist/chunks/LpContextMenu-D0mzXqA7.js +151 -0
- package/dist/chunks/LpDatePicker-dY2q4dr4.js +122 -0
- package/dist/chunks/LpDisclosure-DP6yfgfM.js +76 -0
- package/dist/chunks/LpDivider-CUX46KR0.js +43 -0
- package/dist/chunks/LpDrawer-Ce6g9ZMr.js +310 -0
- package/dist/chunks/LpDropdownMenu-DJpoqRCb.js +65 -0
- package/dist/chunks/LpEmptyState-CrfyRJUG.js +47 -0
- package/dist/chunks/LpFormField-Bn-ZwC6z.js +47 -0
- package/dist/chunks/LpIcon-CCnX5_2j.js +41 -0
- package/dist/chunks/LpInfraNode-C_PHcthC.js +99 -0
- package/dist/chunks/LpInput-BauZRyzm.js +136 -0
- package/dist/chunks/LpLaneNode-HtnQf2FF.js +33 -0
- package/dist/chunks/LpLink-DHwOEp4e.js +36 -0
- package/dist/chunks/LpLogViewer-hC0OKkeE.js +482 -0
- package/dist/chunks/LpModal-CWoOExzT.js +128 -0
- package/dist/chunks/LpNotificationBell-BDy0tQwr.js +232 -0
- package/dist/chunks/LpNumberField-C5ar-OwE.js +55 -0
- package/dist/chunks/LpOtpInput-DqaT0Z75.js +65 -0
- package/dist/chunks/LpPagination-CeGuNe_q.js +132 -0
- package/dist/chunks/LpPasswordInput-DIHFw4u0.js +64 -0
- package/dist/chunks/LpPhoneInput-LQvVFGMw.js +199 -0
- package/dist/chunks/LpPopover-8268UmlC.js +54 -0
- package/dist/chunks/LpProgress-BhI0IbjC.js +37 -0
- package/dist/chunks/LpRadio-CL-pI0_O.js +39 -0
- package/dist/chunks/LpRadioGroup-B4yDTmi6.js +52 -0
- package/dist/chunks/LpScrollArea-K1x-azgY.js +67 -0
- package/dist/chunks/LpSegmented-BmpanyAo.js +74 -0
- package/dist/chunks/LpSelect-DznhPEWX.js +222 -0
- package/dist/chunks/LpServiceNode-Dc-Ut5RS.js +51 -0
- package/dist/chunks/LpSidebar-BPQabjae.js +152 -0
- package/dist/chunks/LpSidebarNav-CpF7rZxx.js +126 -0
- package/dist/chunks/LpSkeleton-eSFIo4kD.js +22 -0
- package/dist/chunks/LpSlider-B1SF3pRV.js +53 -0
- package/dist/chunks/LpStat-CdbEFOvn.js +88 -0
- package/dist/chunks/LpStepper-5dFTrW21.js +53 -0
- package/dist/chunks/LpSwitch-v6fnccSM.js +28 -0
- package/dist/chunks/LpTable-CJ4Zt1UH.js +229 -0
- package/dist/chunks/LpTableOfContents-CjvxPMpU.js +155 -0
- package/dist/chunks/LpTabs-D7aTVPOb.js +115 -0
- package/dist/chunks/LpTextarea-CRAkhemZ.js +44 -0
- package/dist/chunks/LpThemeSwitcher-BgWwfkxs.js +601 -0
- package/dist/chunks/LpTilt-DuyKbpkA.js +49 -0
- package/dist/chunks/LpToaster-gDB1EaU3.js +196 -0
- package/dist/chunks/LpTooltip-CIwoRCag.js +49 -0
- package/dist/chunks/LpTopologyCanvas-DVwyQfKa.js +237 -0
- package/dist/chunks/LpUptimeBar-CB366k0O.js +127 -0
- package/dist/component-names.d.ts +1 -1
- package/dist/components/LayoutCanvas.vue.js +4 -0
- package/dist/components/LayoutNode.vue.js +4 -0
- package/dist/components/LpAlert.vue.js +4 -0
- package/dist/components/LpAppShell.vue.js +4 -0
- package/dist/components/LpAutocomplete.vue.js +4 -0
- package/dist/components/LpAvatar.vue.js +4 -0
- package/dist/components/LpBadge.vue.js +4 -0
- package/dist/components/LpBreadcrumbs.vue.js +4 -0
- package/dist/components/LpButton.vue.js +4 -0
- package/dist/components/LpCalendar.vue.js +4 -0
- package/dist/components/LpCard.vue.js +4 -0
- package/dist/components/LpCheckbox.vue.js +4 -0
- package/dist/components/LpCodeBlock.vue.js +4 -0
- package/dist/components/LpCommandPalette.vue.js +310 -0
- package/dist/components/LpConfirmDialog.vue.js +4 -0
- package/dist/components/LpContextMenu.vue.d.ts +7 -0
- package/dist/components/LpContextMenu.vue.js +4 -0
- package/dist/components/LpDatePicker.vue.js +4 -0
- package/dist/components/LpDisclosure.vue.js +4 -0
- package/dist/components/LpDivider.vue.js +4 -0
- package/dist/components/LpDrawer.vue.d.ts +8 -0
- package/dist/components/LpDrawer.vue.js +4 -0
- package/dist/components/LpDropdownMenu.vue.js +4 -0
- package/dist/components/LpEmptyState.vue.js +4 -0
- package/dist/components/LpFormField.vue.js +4 -0
- package/dist/components/LpIcon.vue.js +4 -0
- package/dist/components/LpInfraNode.vue.js +4 -0
- package/dist/components/LpInput.vue.js +4 -0
- package/dist/components/LpLaneNode.vue.js +4 -0
- package/dist/components/LpLink.vue.js +4 -0
- package/dist/components/LpLogViewer.vue.js +4 -0
- package/dist/components/LpModal.vue.js +4 -0
- package/dist/components/LpNotificationBell.vue.js +4 -0
- package/dist/components/LpNumberField.vue.js +4 -0
- package/dist/components/LpOtpInput.vue.js +4 -0
- package/dist/components/LpPagination.vue.js +4 -0
- package/dist/components/LpPasswordInput.vue.js +4 -0
- package/dist/components/LpPhoneInput.vue.js +4 -0
- package/dist/components/LpPopover.vue.js +4 -0
- package/dist/components/LpProgress.vue.js +4 -0
- package/dist/components/LpRadio.vue.js +4 -0
- package/dist/components/LpRadioGroup.vue.js +4 -0
- package/dist/components/LpScrollArea.vue.d.ts +2 -2
- package/dist/components/LpScrollArea.vue.js +4 -0
- package/dist/components/LpSegmented.vue.js +4 -0
- package/dist/components/LpSelect.vue.d.ts +2 -0
- package/dist/components/LpSelect.vue.js +4 -0
- package/dist/components/LpServiceNode.vue.js +4 -0
- package/dist/components/LpSidebar.vue.js +4 -0
- package/dist/components/LpSidebarNav.vue.js +4 -0
- package/dist/components/LpSkeleton.vue.js +4 -0
- package/dist/components/LpSlider.vue.js +4 -0
- package/dist/components/LpStat.vue.js +4 -0
- package/dist/components/LpStepper.vue.js +4 -0
- package/dist/components/LpSwitch.vue.js +4 -0
- package/dist/components/LpTable.vue.js +4 -0
- package/dist/components/LpTableOfContents.vue.js +4 -0
- package/dist/components/LpTabs.vue.d.ts +4 -2
- package/dist/components/LpTabs.vue.js +4 -0
- package/dist/components/LpTextarea.vue.js +4 -0
- package/dist/components/LpThemeSwitcher.vue.js +4 -0
- package/dist/components/LpTilt.vue.d.ts +31 -0
- package/dist/components/LpTilt.vue.js +4 -0
- package/dist/components/LpToaster.vue.js +4 -0
- package/dist/components/LpTooltip.vue.js +4 -0
- package/dist/components/LpTopologyCanvas.vue.js +4 -0
- package/dist/components/LpUptimeBar.vue.js +4 -0
- package/dist/components/codeHighlight.js +230 -0
- package/dist/{countries-data-9rgqJWHo.js → components/countries-data.js} +2 -2
- package/dist/components/countries.js +38 -0
- package/dist/components/dropdown.js +14 -0
- package/dist/components/sidebar.js +1 -0
- package/dist/composables/useInputFilter.js +44 -0
- package/dist/composables/usePillTransition.js +11 -0
- package/dist/composables/useTilt.d.ts +23 -0
- package/dist/composables/useTilt.js +57 -0
- package/dist/composables/useToast.d.ts +2 -0
- package/dist/composables/useToast.js +49 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +197 -17596
- package/dist/layout/registry.js +10 -0
- package/dist/layout/tree.js +192 -0
- package/dist/layout/useLayout.js +61 -0
- package/package.json +5 -3
- package/src/component-names.ts +1 -0
- package/src/components/LpContextMenu.vue +14 -4
- package/src/components/LpDrawer.vue +29 -1
- package/src/components/LpLogViewer.vue +180 -31
- package/src/components/LpScrollArea.vue +20 -15
- package/src/components/LpSelect.vue +0 -0
- package/src/components/LpSidebar.vue +5 -2
- package/src/components/LpTabs.vue +19 -6
- package/src/components/LpThemeSwitcher.vue +13 -2
- package/src/components/LpTilt.vue +61 -0
- package/src/components/LpToaster.vue +11 -4
- package/src/composables/useTilt.ts +103 -0
- package/src/composables/useToast.ts +2 -0
- package/src/index.ts +3 -0
- package/src/nuxt.ts +10 -1
- package/dist/index.css +0 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, normalizeClass, withCtx, createElementVNode } from "vue";
|
|
2
|
+
import { _ as _sfc_main$1 } from "./LpFormField-Bn-ZwC6z.js";
|
|
3
|
+
const _hoisted_1 = ["value", "placeholder", "rows", "disabled"];
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "LpTextarea",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: {},
|
|
8
|
+
placeholder: {},
|
|
9
|
+
rows: {},
|
|
10
|
+
invalid: { type: Boolean },
|
|
11
|
+
disabled: { type: Boolean },
|
|
12
|
+
label: {},
|
|
13
|
+
hint: {},
|
|
14
|
+
error: {}
|
|
15
|
+
},
|
|
16
|
+
emits: ["update:modelValue"],
|
|
17
|
+
setup(__props) {
|
|
18
|
+
const props = __props;
|
|
19
|
+
const hasField = computed(() => !!props.label || !!props.hint || !!props.error);
|
|
20
|
+
return (_ctx, _cache) => {
|
|
21
|
+
return openBlock(), createBlock(resolveDynamicComponent(hasField.value ? _sfc_main$1 : "div"), {
|
|
22
|
+
label: hasField.value ? __props.label : void 0,
|
|
23
|
+
hint: hasField.value ? __props.hint : void 0,
|
|
24
|
+
error: hasField.value ? __props.error : void 0,
|
|
25
|
+
class: normalizeClass(hasField.value ? void 0 : "contents")
|
|
26
|
+
}, {
|
|
27
|
+
default: withCtx(() => [
|
|
28
|
+
createElementVNode("textarea", {
|
|
29
|
+
value: __props.modelValue,
|
|
30
|
+
placeholder: __props.placeholder,
|
|
31
|
+
rows: __props.rows ?? 4,
|
|
32
|
+
disabled: __props.disabled,
|
|
33
|
+
class: normalizeClass(["w-full resize-y rounded-control border bg-surface-soft px-3 py-2 text-sm text-ink outline-none transition-colors duration-[var(--duration-fast)] placeholder:text-muted focus:border-brand focus:ring-2 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-55", __props.invalid || __props.error ? "border-danger focus:border-danger focus:ring-danger-soft" : "border-line"]),
|
|
34
|
+
onInput: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event.target.value))
|
|
35
|
+
}, null, 42, _hoisted_1)
|
|
36
|
+
]),
|
|
37
|
+
_: 1
|
|
38
|
+
}, 8, ["label", "hint", "error", "class"]);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export {
|
|
43
|
+
_sfc_main as _
|
|
44
|
+
};
|
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
import { computed, readonly, shallowRef, defineComponent, onMounted, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, createElementBlock, normalizeStyle, createVNode, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
+
import { _ as _sfc_main$1 } from "./LpContextMenu-D0mzXqA7.js";
|
|
3
|
+
import { _ as _sfc_main$2 } from "./LpIcon-CCnX5_2j.js";
|
|
4
|
+
const sharedShape = { radiusControl: 8, radiusCard: 14, radiusPill: 9999 };
|
|
5
|
+
const sharedDensity = { spacingUnit: 4, controlSm: 32, controlMd: 38, controlLg: 44 };
|
|
6
|
+
const interFont = {
|
|
7
|
+
sans: '"Inter", "Segoe UI", system-ui, sans-serif',
|
|
8
|
+
mono: '"JetBrains Mono", "SF Mono", ui-monospace, monospace'
|
|
9
|
+
};
|
|
10
|
+
const dark = {
|
|
11
|
+
name: "Dark",
|
|
12
|
+
mode: "dark",
|
|
13
|
+
colors: {
|
|
14
|
+
surface: "#080b0d",
|
|
15
|
+
surfaceRaised: "#12171d",
|
|
16
|
+
surfaceSoft: "#172027",
|
|
17
|
+
ink: "#eef5f1",
|
|
18
|
+
inkInverse: "#06100b",
|
|
19
|
+
muted: "#9aa8a2",
|
|
20
|
+
mutedStrong: "#c7d2cc",
|
|
21
|
+
brand: "#00bcff",
|
|
22
|
+
brandHover: "#19c6ff",
|
|
23
|
+
brandSoft: "rgba(0, 188, 255, 0.16)",
|
|
24
|
+
action: "#39e58c",
|
|
25
|
+
actionHover: "#4dffa1",
|
|
26
|
+
accent: "#f0b35a",
|
|
27
|
+
danger: "#ff6f6f",
|
|
28
|
+
dangerHover: "#ff8585",
|
|
29
|
+
dangerSoft: "rgba(255, 111, 111, 0.14)",
|
|
30
|
+
line: "rgba(255, 255, 255, 0.1)",
|
|
31
|
+
lineStrong: "rgba(255, 255, 255, 0.18)",
|
|
32
|
+
ring: "rgba(0, 188, 255, 0.45)"
|
|
33
|
+
},
|
|
34
|
+
shape: { ...sharedShape },
|
|
35
|
+
density: { ...sharedDensity },
|
|
36
|
+
font: { ...interFont }
|
|
37
|
+
};
|
|
38
|
+
const light = {
|
|
39
|
+
name: "Light",
|
|
40
|
+
mode: "light",
|
|
41
|
+
colors: {
|
|
42
|
+
surface: "#f6f8f7",
|
|
43
|
+
surfaceRaised: "#ffffff",
|
|
44
|
+
surfaceSoft: "#eceff0",
|
|
45
|
+
ink: "#0d1714",
|
|
46
|
+
inkInverse: "#f8fff9",
|
|
47
|
+
muted: "#5d6b65",
|
|
48
|
+
mutedStrong: "#34433d",
|
|
49
|
+
brand: "#0086c7",
|
|
50
|
+
brandHover: "#0095db",
|
|
51
|
+
brandSoft: "rgba(0, 134, 199, 0.12)",
|
|
52
|
+
action: "#1f9d5f",
|
|
53
|
+
actionHover: "#23b06b",
|
|
54
|
+
accent: "#aa6f1d",
|
|
55
|
+
danger: "#c2333b",
|
|
56
|
+
dangerHover: "#d23b44",
|
|
57
|
+
dangerSoft: "rgba(194, 51, 59, 0.12)",
|
|
58
|
+
line: "rgba(13, 23, 20, 0.12)",
|
|
59
|
+
lineStrong: "rgba(13, 23, 20, 0.22)",
|
|
60
|
+
ring: "rgba(0, 134, 199, 0.4)"
|
|
61
|
+
},
|
|
62
|
+
shape: { ...sharedShape },
|
|
63
|
+
density: { ...sharedDensity },
|
|
64
|
+
font: { ...interFont }
|
|
65
|
+
};
|
|
66
|
+
const lime = {
|
|
67
|
+
name: "Lime",
|
|
68
|
+
mode: "dark",
|
|
69
|
+
colors: {
|
|
70
|
+
surface: "#050505",
|
|
71
|
+
surfaceRaised: "#0c0d0a",
|
|
72
|
+
surfaceSoft: "#14160f",
|
|
73
|
+
ink: "#f4f7ee",
|
|
74
|
+
inkInverse: "#0a0c05",
|
|
75
|
+
muted: "#8b8f80",
|
|
76
|
+
mutedStrong: "#c3c8b6",
|
|
77
|
+
brand: "#c4f042",
|
|
78
|
+
brandHover: "#d2ff5c",
|
|
79
|
+
brandSoft: "rgba(196, 240, 66, 0.14)",
|
|
80
|
+
action: "#5fd97a",
|
|
81
|
+
actionHover: "#74e88d",
|
|
82
|
+
accent: "#ffb84d",
|
|
83
|
+
danger: "#ff6f6f",
|
|
84
|
+
dangerHover: "#ff8585",
|
|
85
|
+
dangerSoft: "rgba(255, 111, 111, 0.14)",
|
|
86
|
+
line: "rgba(255, 255, 255, 0.08)",
|
|
87
|
+
lineStrong: "rgba(196, 240, 66, 0.3)",
|
|
88
|
+
ring: "rgba(196, 240, 66, 0.4)"
|
|
89
|
+
},
|
|
90
|
+
// a sharper theme — overrides the shape axis too
|
|
91
|
+
shape: { radiusControl: 4, radiusCard: 6, radiusPill: 4 },
|
|
92
|
+
density: { ...sharedDensity },
|
|
93
|
+
// a distinct typeface so the theme has its own voice (not just colour)
|
|
94
|
+
font: {
|
|
95
|
+
sans: '"Space Grotesk", "Inter", system-ui, sans-serif',
|
|
96
|
+
mono: '"IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace'
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const glassSurface = {
|
|
100
|
+
borderWidth: "1px",
|
|
101
|
+
panelBlur: "10px",
|
|
102
|
+
panelSaturate: "120%",
|
|
103
|
+
panelOverlay: "linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01))",
|
|
104
|
+
panelShadow: "0 20px 60px rgba(0, 0, 0, 0.35)",
|
|
105
|
+
panelInset: "inset 0 1px 0 rgba(255, 255, 255, 0.08)"
|
|
106
|
+
};
|
|
107
|
+
const leavepulse = {
|
|
108
|
+
name: "LeavePulse",
|
|
109
|
+
mode: "dark",
|
|
110
|
+
colors: {
|
|
111
|
+
surface: "#020618",
|
|
112
|
+
surfaceRaised: "#0b1222",
|
|
113
|
+
surfaceSoft: "rgba(11, 18, 34, 0.7)",
|
|
114
|
+
ink: "#f3f6ff",
|
|
115
|
+
inkInverse: "#0b1222",
|
|
116
|
+
muted: "#94a3bf",
|
|
117
|
+
mutedStrong: "#cad5e2",
|
|
118
|
+
brand: "#00bcff",
|
|
119
|
+
brandHover: "#19c3ff",
|
|
120
|
+
brandSoft: "rgba(0, 188, 255, 0.2)",
|
|
121
|
+
action: "#44c2ad",
|
|
122
|
+
actionHover: "#56d3be",
|
|
123
|
+
accent: "#d36a2c",
|
|
124
|
+
danger: "#f87171",
|
|
125
|
+
dangerHover: "#fca5a5",
|
|
126
|
+
dangerSoft: "rgba(248, 113, 113, 0.14)",
|
|
127
|
+
line: "#1c2740",
|
|
128
|
+
lineStrong: "rgba(255, 255, 255, 0.15)",
|
|
129
|
+
ring: "rgba(0, 188, 255, 0.35)"
|
|
130
|
+
},
|
|
131
|
+
shape: { ...sharedShape, radiusControl: 12 },
|
|
132
|
+
density: { ...sharedDensity },
|
|
133
|
+
font: {
|
|
134
|
+
sans: '"Inter", "IBM Plex Sans", "Segoe UI", sans-serif',
|
|
135
|
+
mono: '"JetBrains Mono", "SF Mono", ui-monospace, monospace'
|
|
136
|
+
},
|
|
137
|
+
surface: glassSurface
|
|
138
|
+
};
|
|
139
|
+
const rose = {
|
|
140
|
+
name: "Rose",
|
|
141
|
+
mode: "dark",
|
|
142
|
+
colors: {
|
|
143
|
+
surface: "#120a0d",
|
|
144
|
+
surfaceRaised: "#1c1014",
|
|
145
|
+
surfaceSoft: "#26161b",
|
|
146
|
+
ink: "#fdeef1",
|
|
147
|
+
inkInverse: "#1a0d11",
|
|
148
|
+
muted: "#a98a92",
|
|
149
|
+
mutedStrong: "#d8c0c6",
|
|
150
|
+
brand: "#fb7185",
|
|
151
|
+
brandHover: "#fd8a9b",
|
|
152
|
+
brandSoft: "rgba(251, 113, 133, 0.14)",
|
|
153
|
+
action: "#34d399",
|
|
154
|
+
actionHover: "#4adeaa",
|
|
155
|
+
accent: "#fbbf24",
|
|
156
|
+
danger: "#ef4444",
|
|
157
|
+
dangerHover: "#f56565",
|
|
158
|
+
dangerSoft: "rgba(239, 68, 68, 0.14)",
|
|
159
|
+
line: "rgba(255, 255, 255, 0.1)",
|
|
160
|
+
lineStrong: "rgba(251, 113, 133, 0.3)",
|
|
161
|
+
ring: "rgba(251, 113, 133, 0.4)"
|
|
162
|
+
},
|
|
163
|
+
shape: { ...sharedShape },
|
|
164
|
+
density: { ...sharedDensity },
|
|
165
|
+
font: { ...interFont }
|
|
166
|
+
};
|
|
167
|
+
const amber = {
|
|
168
|
+
name: "Amber",
|
|
169
|
+
mode: "dark",
|
|
170
|
+
colors: {
|
|
171
|
+
surface: "#0f0b06",
|
|
172
|
+
surfaceRaised: "#1a130a",
|
|
173
|
+
surfaceSoft: "#241a0e",
|
|
174
|
+
ink: "#fdf3e6",
|
|
175
|
+
inkInverse: "#1a1206",
|
|
176
|
+
muted: "#a3927a",
|
|
177
|
+
mutedStrong: "#d6c6ad",
|
|
178
|
+
brand: "#f59e0b",
|
|
179
|
+
brandHover: "#fbb024",
|
|
180
|
+
brandSoft: "rgba(245, 158, 11, 0.14)",
|
|
181
|
+
action: "#4ade80",
|
|
182
|
+
actionHover: "#5cea90",
|
|
183
|
+
accent: "#38bdf8",
|
|
184
|
+
danger: "#f87171",
|
|
185
|
+
dangerHover: "#fa8a8a",
|
|
186
|
+
dangerSoft: "rgba(248, 113, 113, 0.14)",
|
|
187
|
+
line: "rgba(255, 255, 255, 0.1)",
|
|
188
|
+
lineStrong: "rgba(245, 158, 11, 0.3)",
|
|
189
|
+
ring: "rgba(245, 158, 11, 0.4)"
|
|
190
|
+
},
|
|
191
|
+
shape: { ...sharedShape },
|
|
192
|
+
density: { ...sharedDensity },
|
|
193
|
+
font: { ...interFont }
|
|
194
|
+
};
|
|
195
|
+
const violet = {
|
|
196
|
+
name: "Violet",
|
|
197
|
+
mode: "dark",
|
|
198
|
+
colors: {
|
|
199
|
+
surface: "#0c0a14",
|
|
200
|
+
surfaceRaised: "#15111f",
|
|
201
|
+
surfaceSoft: "#1d1729",
|
|
202
|
+
ink: "#f1eefb",
|
|
203
|
+
inkInverse: "#100b1a",
|
|
204
|
+
muted: "#948aa9",
|
|
205
|
+
mutedStrong: "#c6bedb",
|
|
206
|
+
brand: "#a78bfa",
|
|
207
|
+
brandHover: "#b69dfc",
|
|
208
|
+
brandSoft: "rgba(167, 139, 250, 0.14)",
|
|
209
|
+
action: "#34d399",
|
|
210
|
+
actionHover: "#4adeaa",
|
|
211
|
+
accent: "#fbbf24",
|
|
212
|
+
danger: "#f87171",
|
|
213
|
+
dangerHover: "#fa8a8a",
|
|
214
|
+
dangerSoft: "rgba(248, 113, 113, 0.14)",
|
|
215
|
+
line: "rgba(255, 255, 255, 0.1)",
|
|
216
|
+
lineStrong: "rgba(167, 139, 250, 0.3)",
|
|
217
|
+
ring: "rgba(167, 139, 250, 0.4)"
|
|
218
|
+
},
|
|
219
|
+
shape: { ...sharedShape },
|
|
220
|
+
density: { ...sharedDensity },
|
|
221
|
+
font: { ...interFont }
|
|
222
|
+
};
|
|
223
|
+
const nord = {
|
|
224
|
+
name: "Nord",
|
|
225
|
+
mode: "dark",
|
|
226
|
+
colors: {
|
|
227
|
+
surface: "#2e3440",
|
|
228
|
+
surfaceRaised: "#3b4252",
|
|
229
|
+
surfaceSoft: "#434c5e",
|
|
230
|
+
ink: "#eceff4",
|
|
231
|
+
inkInverse: "#2e3440",
|
|
232
|
+
muted: "#9aa4b8",
|
|
233
|
+
mutedStrong: "#d8dee9",
|
|
234
|
+
brand: "#88c0d0",
|
|
235
|
+
brandHover: "#9bccd9",
|
|
236
|
+
brandSoft: "rgba(136, 192, 208, 0.16)",
|
|
237
|
+
action: "#a3be8c",
|
|
238
|
+
actionHover: "#b3cb9f",
|
|
239
|
+
accent: "#ebcb8b",
|
|
240
|
+
danger: "#bf616a",
|
|
241
|
+
dangerHover: "#cb727b",
|
|
242
|
+
dangerSoft: "rgba(191, 97, 106, 0.16)",
|
|
243
|
+
line: "rgba(236, 239, 244, 0.1)",
|
|
244
|
+
lineStrong: "rgba(136, 192, 208, 0.35)",
|
|
245
|
+
ring: "rgba(136, 192, 208, 0.45)"
|
|
246
|
+
},
|
|
247
|
+
shape: { ...sharedShape },
|
|
248
|
+
density: { ...sharedDensity },
|
|
249
|
+
font: { ...interFont }
|
|
250
|
+
};
|
|
251
|
+
const presets = { dark, light, lime, leavepulse, rose, amber, violet, nord };
|
|
252
|
+
const COLOR_VARS = {
|
|
253
|
+
surface: "--color-surface",
|
|
254
|
+
surfaceRaised: "--color-surface-raised",
|
|
255
|
+
surfaceSoft: "--color-surface-soft",
|
|
256
|
+
ink: "--color-ink",
|
|
257
|
+
inkInverse: "--color-ink-inverse",
|
|
258
|
+
muted: "--color-muted",
|
|
259
|
+
mutedStrong: "--color-muted-strong",
|
|
260
|
+
brand: "--color-brand",
|
|
261
|
+
brandHover: "--color-brand-hover",
|
|
262
|
+
brandSoft: "--color-brand-soft",
|
|
263
|
+
action: "--color-action",
|
|
264
|
+
actionHover: "--color-action-hover",
|
|
265
|
+
accent: "--color-accent",
|
|
266
|
+
danger: "--color-danger",
|
|
267
|
+
dangerHover: "--color-danger-hover",
|
|
268
|
+
dangerSoft: "--color-danger-soft",
|
|
269
|
+
line: "--color-line",
|
|
270
|
+
lineStrong: "--color-line-strong",
|
|
271
|
+
ring: "--color-ring"
|
|
272
|
+
};
|
|
273
|
+
const SHAPE_VARS = {
|
|
274
|
+
radiusControl: "--radius-control",
|
|
275
|
+
radiusCard: "--radius-card",
|
|
276
|
+
radiusPill: "--radius-pill"
|
|
277
|
+
};
|
|
278
|
+
const DENSITY_VARS = {
|
|
279
|
+
spacingUnit: "--spacing-unit",
|
|
280
|
+
controlSm: "--size-control-sm",
|
|
281
|
+
controlMd: "--size-control-md",
|
|
282
|
+
controlLg: "--size-control-lg"
|
|
283
|
+
};
|
|
284
|
+
const FONT_VARS = {
|
|
285
|
+
sans: "--font-sans",
|
|
286
|
+
mono: "--font-mono"
|
|
287
|
+
};
|
|
288
|
+
const SURFACE_VARS = {
|
|
289
|
+
borderWidth: "--surface-border-width",
|
|
290
|
+
panelBlur: "--surface-panel-blur",
|
|
291
|
+
panelSaturate: "--surface-panel-saturate",
|
|
292
|
+
panelOverlay: "--surface-panel-overlay",
|
|
293
|
+
panelShadow: "--surface-panel-shadow",
|
|
294
|
+
panelInset: "--surface-panel-inset"
|
|
295
|
+
};
|
|
296
|
+
const DEFAULT_SURFACE = {
|
|
297
|
+
borderWidth: "1px",
|
|
298
|
+
panelBlur: "0px",
|
|
299
|
+
panelSaturate: "100%",
|
|
300
|
+
panelOverlay: "none",
|
|
301
|
+
panelShadow: "0 1px 2px rgba(0, 0, 0, 0.18)",
|
|
302
|
+
panelInset: "0 0 0 0 transparent"
|
|
303
|
+
};
|
|
304
|
+
const CACHE_KEY = "leavepulse-ui-theme";
|
|
305
|
+
const _current = shallowRef(null);
|
|
306
|
+
let _hydrated = false;
|
|
307
|
+
let _fallback = null;
|
|
308
|
+
function hydrateOnce() {
|
|
309
|
+
if (_hydrated || typeof window === "undefined") return;
|
|
310
|
+
_hydrated = true;
|
|
311
|
+
try {
|
|
312
|
+
const cached = localStorage.getItem(CACHE_KEY);
|
|
313
|
+
if (cached) {
|
|
314
|
+
_current.value = parseTheme(cached);
|
|
315
|
+
applyTheme(_current.value);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
} catch {
|
|
319
|
+
}
|
|
320
|
+
if (_fallback) {
|
|
321
|
+
_current.value = _fallback;
|
|
322
|
+
applyTheme(_fallback);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function applyTheme(theme, root = document.documentElement) {
|
|
326
|
+
for (const [key, cssVar] of Object.entries(COLOR_VARS)) {
|
|
327
|
+
root.style.setProperty(cssVar, theme.colors[key]);
|
|
328
|
+
}
|
|
329
|
+
for (const [key, cssVar] of Object.entries(SHAPE_VARS)) {
|
|
330
|
+
root.style.setProperty(cssVar, `${theme.shape[key]}px`);
|
|
331
|
+
}
|
|
332
|
+
for (const [key, cssVar] of Object.entries(DENSITY_VARS)) {
|
|
333
|
+
root.style.setProperty(cssVar, `${theme.density[key]}px`);
|
|
334
|
+
}
|
|
335
|
+
for (const [key, cssVar] of Object.entries(FONT_VARS)) {
|
|
336
|
+
root.style.setProperty(cssVar, theme.font[key]);
|
|
337
|
+
}
|
|
338
|
+
const surface = theme.surface ?? DEFAULT_SURFACE;
|
|
339
|
+
for (const [key, cssVar] of Object.entries(SURFACE_VARS)) {
|
|
340
|
+
root.style.setProperty(cssVar, surface[key]);
|
|
341
|
+
}
|
|
342
|
+
root.dataset.themeMode = theme.mode;
|
|
343
|
+
root.style.colorScheme = theme.mode;
|
|
344
|
+
}
|
|
345
|
+
function prefersReducedMotion() {
|
|
346
|
+
return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
347
|
+
}
|
|
348
|
+
function applyThemeWithTransition(theme, origin, root = document.documentElement, durationMs = 480) {
|
|
349
|
+
const doc = document;
|
|
350
|
+
if (typeof doc.startViewTransition !== "function" || prefersReducedMotion()) {
|
|
351
|
+
applyTheme(theme, root);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const x = origin?.x ?? window.innerWidth / 2;
|
|
355
|
+
const y = origin?.y ?? window.innerHeight / 2;
|
|
356
|
+
const endRadius = Math.hypot(
|
|
357
|
+
Math.max(x, window.innerWidth - x),
|
|
358
|
+
Math.max(y, window.innerHeight - y)
|
|
359
|
+
);
|
|
360
|
+
const transition = doc.startViewTransition(() => applyTheme(theme, root));
|
|
361
|
+
transition.ready.then(() => {
|
|
362
|
+
root.animate(
|
|
363
|
+
{
|
|
364
|
+
clipPath: [`circle(${endRadius}px at ${x}px ${y}px)`, `circle(0px at ${x}px ${y}px)`]
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
duration: durationMs,
|
|
368
|
+
easing: "cubic-bezier(0.2, 0, 0, 1)",
|
|
369
|
+
// Hold the fully-shrunk circle after the keyframes end. Without it the
|
|
370
|
+
// old snapshot snaps back to its default (un-clipped) state for the one
|
|
371
|
+
// frame between animation-end and the browser tearing down the
|
|
372
|
+
// view-transition pseudo-elements — that flash is the old theme
|
|
373
|
+
// "blinking" at the very end.
|
|
374
|
+
fill: "forwards",
|
|
375
|
+
pseudoElement: "::view-transition-old(root)"
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function serializeTheme(theme) {
|
|
381
|
+
return JSON.stringify(theme);
|
|
382
|
+
}
|
|
383
|
+
function themeToCssVars(theme) {
|
|
384
|
+
const decls = [];
|
|
385
|
+
for (const [key, cssVar] of Object.entries(COLOR_VARS)) {
|
|
386
|
+
decls.push(`${cssVar}: ${theme.colors[key]}`);
|
|
387
|
+
}
|
|
388
|
+
for (const [key, cssVar] of Object.entries(SHAPE_VARS)) {
|
|
389
|
+
decls.push(`${cssVar}: ${theme.shape[key]}px`);
|
|
390
|
+
}
|
|
391
|
+
for (const [key, cssVar] of Object.entries(DENSITY_VARS)) {
|
|
392
|
+
decls.push(`${cssVar}: ${theme.density[key]}px`);
|
|
393
|
+
}
|
|
394
|
+
for (const [key, cssVar] of Object.entries(FONT_VARS)) {
|
|
395
|
+
decls.push(`${cssVar}: ${theme.font[key]}`);
|
|
396
|
+
}
|
|
397
|
+
const surface = theme.surface ?? DEFAULT_SURFACE;
|
|
398
|
+
for (const [key, cssVar] of Object.entries(SURFACE_VARS)) {
|
|
399
|
+
decls.push(`${cssVar}: ${surface[key]}`);
|
|
400
|
+
}
|
|
401
|
+
return decls.join("; ");
|
|
402
|
+
}
|
|
403
|
+
function themeToCssRule(theme, selector = ":root") {
|
|
404
|
+
return `${selector} { color-scheme: ${theme.mode}; ${themeToCssVars(theme)}; }`;
|
|
405
|
+
}
|
|
406
|
+
const DEFAULT_FONT = {
|
|
407
|
+
sans: '"Inter", "Segoe UI", system-ui, sans-serif',
|
|
408
|
+
mono: '"JetBrains Mono", "SF Mono", ui-monospace, monospace'
|
|
409
|
+
};
|
|
410
|
+
function parseTheme(json) {
|
|
411
|
+
const raw = JSON.parse(json);
|
|
412
|
+
if (!raw || typeof raw !== "object" || !raw.colors || !raw.shape || !raw.density) {
|
|
413
|
+
throw new Error("Invalid theme: missing colors/shape/density");
|
|
414
|
+
}
|
|
415
|
+
return { ...raw, font: raw.font ?? DEFAULT_FONT };
|
|
416
|
+
}
|
|
417
|
+
function bootstrapTheme(fallback) {
|
|
418
|
+
let theme = fallback;
|
|
419
|
+
try {
|
|
420
|
+
const cached = localStorage.getItem(CACHE_KEY);
|
|
421
|
+
if (cached) theme = parseTheme(cached);
|
|
422
|
+
} catch {
|
|
423
|
+
}
|
|
424
|
+
applyTheme(theme);
|
|
425
|
+
return theme;
|
|
426
|
+
}
|
|
427
|
+
function cacheTheme(theme) {
|
|
428
|
+
try {
|
|
429
|
+
localStorage.setItem(CACHE_KEY, serializeTheme(theme));
|
|
430
|
+
} catch {
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function useTheme() {
|
|
434
|
+
hydrateOnce();
|
|
435
|
+
const setTheme = (theme, origin) => {
|
|
436
|
+
if (origin) applyThemeWithTransition(theme, origin);
|
|
437
|
+
else applyThemeWithTransition(theme);
|
|
438
|
+
cacheTheme(theme);
|
|
439
|
+
_current.value = theme;
|
|
440
|
+
};
|
|
441
|
+
return {
|
|
442
|
+
current: readonly(_current),
|
|
443
|
+
currentName: computed(() => _current.value?.name ?? ""),
|
|
444
|
+
setTheme,
|
|
445
|
+
init: (fallback) => {
|
|
446
|
+
_fallback = fallback;
|
|
447
|
+
if (!_hydrated) hydrateOnce();
|
|
448
|
+
if (!_current.value) {
|
|
449
|
+
_current.value = bootstrapTheme(fallback);
|
|
450
|
+
}
|
|
451
|
+
return _current.value;
|
|
452
|
+
},
|
|
453
|
+
apply: (theme) => {
|
|
454
|
+
applyTheme(theme);
|
|
455
|
+
cacheTheme(theme);
|
|
456
|
+
_current.value = theme;
|
|
457
|
+
},
|
|
458
|
+
/**
|
|
459
|
+
* Apply + cache a theme with the circular reveal animation. Pass the click
|
|
460
|
+
* point (e.g. from a toggle's `event`) as `origin` so the circle grows from
|
|
461
|
+
* the button; omit it to reveal from the viewport centre.
|
|
462
|
+
*/
|
|
463
|
+
applyWithTransition: (theme, origin) => {
|
|
464
|
+
applyThemeWithTransition(theme, origin);
|
|
465
|
+
cacheTheme(theme);
|
|
466
|
+
_current.value = theme;
|
|
467
|
+
},
|
|
468
|
+
serialize: serializeTheme,
|
|
469
|
+
parse: parseTheme,
|
|
470
|
+
bootstrap: bootstrapTheme
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
const _hoisted_1 = ["aria-label", "title"];
|
|
474
|
+
const _hoisted_2 = {
|
|
475
|
+
key: 2,
|
|
476
|
+
class: "text-sm font-medium"
|
|
477
|
+
};
|
|
478
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
479
|
+
__name: "LpThemeSwitcher",
|
|
480
|
+
props: {
|
|
481
|
+
modelValue: {},
|
|
482
|
+
themes: {},
|
|
483
|
+
variant: { default: "swatch" },
|
|
484
|
+
showLabel: { type: Boolean },
|
|
485
|
+
default: {},
|
|
486
|
+
transition: { type: Boolean, default: true },
|
|
487
|
+
size: { default: "md" },
|
|
488
|
+
"aria-label": {}
|
|
489
|
+
},
|
|
490
|
+
emits: ["update:modelValue", "change"],
|
|
491
|
+
setup(__props, { emit: __emit }) {
|
|
492
|
+
const props = __props;
|
|
493
|
+
const emit = __emit;
|
|
494
|
+
const theme = useTheme();
|
|
495
|
+
const list = computed(
|
|
496
|
+
() => props.themes && props.themes.length ? props.themes : Object.values(presets)
|
|
497
|
+
);
|
|
498
|
+
const activeName = computed(
|
|
499
|
+
() => props.modelValue ?? (theme.currentName.value || list.value[0]?.name || "")
|
|
500
|
+
);
|
|
501
|
+
const active = computed(
|
|
502
|
+
() => list.value.find((t) => t.name === activeName.value) ?? list.value[0]
|
|
503
|
+
);
|
|
504
|
+
onMounted(() => {
|
|
505
|
+
if (props.default == null) return;
|
|
506
|
+
const fallback = typeof props.default === "string" ? list.value.find((t) => t.name === props.default) : props.default;
|
|
507
|
+
if (fallback) theme.init(fallback);
|
|
508
|
+
});
|
|
509
|
+
const SIZES = { sm: "size-7", md: "size-8", lg: "size-9" };
|
|
510
|
+
const ICON_SIZE = { sm: 15, md: 16, lg: 18 };
|
|
511
|
+
const wantsLabel = computed(() => props.showLabel || props.variant === "pill");
|
|
512
|
+
const bareIcon = computed(() => props.variant === "icon" && !wantsLabel.value);
|
|
513
|
+
function applyTheme2(t, ev) {
|
|
514
|
+
if (props.transition) {
|
|
515
|
+
theme.setTheme(t, ev ? { x: ev.clientX, y: ev.clientY } : void 0);
|
|
516
|
+
} else {
|
|
517
|
+
theme.apply(t);
|
|
518
|
+
}
|
|
519
|
+
emit("update:modelValue", t.name);
|
|
520
|
+
emit("change", t);
|
|
521
|
+
}
|
|
522
|
+
function cycle(ev) {
|
|
523
|
+
const arr = list.value;
|
|
524
|
+
if (!arr.length) return;
|
|
525
|
+
const i = arr.findIndex((t) => t.name === activeName.value);
|
|
526
|
+
const next = arr[(i + 1) % arr.length];
|
|
527
|
+
if (next) applyTheme2(next, ev);
|
|
528
|
+
}
|
|
529
|
+
const menu = computed(
|
|
530
|
+
() => list.value.map((t) => ({
|
|
531
|
+
label: t.name,
|
|
532
|
+
icon: t.name === activeName.value ? "lucide:check" : t.mode === "dark" ? "lucide:moon" : "lucide:sun",
|
|
533
|
+
onSelect: () => applyTheme2(t)
|
|
534
|
+
}))
|
|
535
|
+
);
|
|
536
|
+
const triggerLabel = computed(
|
|
537
|
+
() => props["aria-label"] ?? `Theme: ${activeName.value}. Click to switch, right-click to choose.`
|
|
538
|
+
);
|
|
539
|
+
return (_ctx, _cache) => {
|
|
540
|
+
return openBlock(), createBlock(_sfc_main$1, { items: menu.value }, {
|
|
541
|
+
default: withCtx(() => [
|
|
542
|
+
createElementVNode("button", {
|
|
543
|
+
type: "button",
|
|
544
|
+
"aria-label": triggerLabel.value,
|
|
545
|
+
title: triggerLabel.value,
|
|
546
|
+
class: normalizeClass([
|
|
547
|
+
"inline-flex items-center justify-center gap-2 rounded-control outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",
|
|
548
|
+
bareIcon.value ? [SIZES[__props.size], "text-muted hover:bg-surface-soft hover:text-ink"] : [
|
|
549
|
+
"border border-line bg-surface-raised px-1.5 text-ink hover:border-line-strong",
|
|
550
|
+
wantsLabel.value ? "py-1 pr-2.5" : ""
|
|
551
|
+
]
|
|
552
|
+
]),
|
|
553
|
+
onClick: cycle
|
|
554
|
+
}, [
|
|
555
|
+
__props.variant !== "icon" ? (openBlock(), createElementBlock("span", {
|
|
556
|
+
key: 0,
|
|
557
|
+
class: normalizeClass(["grid shrink-0 place-items-center rounded-control border border-line/60", SIZES[__props.size]]),
|
|
558
|
+
style: normalizeStyle({ background: active.value?.colors.surface })
|
|
559
|
+
}, [
|
|
560
|
+
createElementVNode("span", {
|
|
561
|
+
class: "size-3 rounded-full",
|
|
562
|
+
style: normalizeStyle({ background: active.value?.colors.brand })
|
|
563
|
+
}, null, 4)
|
|
564
|
+
], 6)) : (openBlock(), createElementBlock("span", {
|
|
565
|
+
key: 1,
|
|
566
|
+
class: normalizeClass(["grid shrink-0 place-items-center", SIZES[__props.size]])
|
|
567
|
+
}, [
|
|
568
|
+
createVNode(_sfc_main$2, {
|
|
569
|
+
name: active.value?.mode === "dark" ? "lucide:moon" : "lucide:sun",
|
|
570
|
+
size: ICON_SIZE[__props.size]
|
|
571
|
+
}, null, 8, ["name", "size"])
|
|
572
|
+
], 2)),
|
|
573
|
+
wantsLabel.value ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(activeName.value), 1)) : createCommentVNode("", true)
|
|
574
|
+
], 10, _hoisted_1)
|
|
575
|
+
]),
|
|
576
|
+
_: 1
|
|
577
|
+
}, 8, ["items"]);
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
export {
|
|
582
|
+
DEFAULT_SURFACE as D,
|
|
583
|
+
_sfc_main as _,
|
|
584
|
+
parseTheme as a,
|
|
585
|
+
amber as b,
|
|
586
|
+
applyTheme as c,
|
|
587
|
+
applyThemeWithTransition as d,
|
|
588
|
+
bootstrapTheme as e,
|
|
589
|
+
dark as f,
|
|
590
|
+
light as g,
|
|
591
|
+
lime as h,
|
|
592
|
+
themeToCssVars as i,
|
|
593
|
+
leavepulse as l,
|
|
594
|
+
nord as n,
|
|
595
|
+
presets as p,
|
|
596
|
+
rose as r,
|
|
597
|
+
serializeTheme as s,
|
|
598
|
+
themeToCssRule as t,
|
|
599
|
+
useTheme as u,
|
|
600
|
+
violet as v
|
|
601
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, createElementVNode, unref, renderSlot, createCommentVNode } from "vue";
|
|
2
|
+
import { useTilt } from "../composables/useTilt.js";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "LpTilt",
|
|
5
|
+
props: {
|
|
6
|
+
max: { default: 10 },
|
|
7
|
+
lift: { default: 8 },
|
|
8
|
+
scale: { default: 1.03 },
|
|
9
|
+
glare: { type: Boolean, default: false },
|
|
10
|
+
perspective: { default: 900 }
|
|
11
|
+
},
|
|
12
|
+
setup(__props) {
|
|
13
|
+
const props = __props;
|
|
14
|
+
const tilt = useTilt({
|
|
15
|
+
max: props.max,
|
|
16
|
+
lift: props.lift,
|
|
17
|
+
scale: props.scale,
|
|
18
|
+
glare: props.glare
|
|
19
|
+
});
|
|
20
|
+
const stageStyle = computed(() => ({ perspective: `${props.perspective}px` }));
|
|
21
|
+
return (_ctx, _cache) => {
|
|
22
|
+
return openBlock(), createElementBlock("div", {
|
|
23
|
+
style: normalizeStyle(stageStyle.value),
|
|
24
|
+
class: "lp-tilt-stage"
|
|
25
|
+
}, [
|
|
26
|
+
createElementVNode("div", {
|
|
27
|
+
class: "lp-tilt-inner relative",
|
|
28
|
+
style: normalizeStyle(unref(tilt).style.value),
|
|
29
|
+
onPointermove: _cache[0] || (_cache[0] = //@ts-ignore
|
|
30
|
+
(...args) => unref(tilt).onPointerMove && unref(tilt).onPointerMove(...args)),
|
|
31
|
+
onPointerenter: _cache[1] || (_cache[1] = //@ts-ignore
|
|
32
|
+
(...args) => unref(tilt).onPointerEnter && unref(tilt).onPointerEnter(...args)),
|
|
33
|
+
onPointerleave: _cache[2] || (_cache[2] = //@ts-ignore
|
|
34
|
+
(...args) => unref(tilt).onPointerLeave && unref(tilt).onPointerLeave(...args))
|
|
35
|
+
}, [
|
|
36
|
+
renderSlot(_ctx.$slots, "default"),
|
|
37
|
+
__props.glare ? (openBlock(), createElementBlock("div", {
|
|
38
|
+
key: 0,
|
|
39
|
+
class: "pointer-events-none absolute inset-0 rounded-[inherit] mix-blend-overlay",
|
|
40
|
+
style: normalizeStyle(unref(tilt).glareStyle.value)
|
|
41
|
+
}, null, 4)) : createCommentVNode("", true)
|
|
42
|
+
], 36)
|
|
43
|
+
], 4);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export {
|
|
48
|
+
_sfc_main as _
|
|
49
|
+
};
|