@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.
Files changed (162) hide show
  1. package/dist/assets/LpCommandPalette-D315B47-.css +16 -0
  2. package/dist/chunks/LayoutCanvas-Dd20boUG.js +50 -0
  3. package/dist/chunks/LayoutNode-DGpZA9LX.js +225 -0
  4. package/dist/chunks/LpAlert-BAYHDSS1.js +69 -0
  5. package/dist/chunks/LpAppShell-DBTsNQaM.js +170 -0
  6. package/dist/chunks/LpAutocomplete-B9uoCs4t.js +196 -0
  7. package/dist/chunks/LpAvatar-B1Ez0ZAx.js +88 -0
  8. package/dist/chunks/LpBadge-CXzBPnwO.js +42 -0
  9. package/dist/chunks/LpBreadcrumbs-B7Aqatzw.js +42 -0
  10. package/dist/chunks/LpButton-5VXXCjwF.js +101 -0
  11. package/dist/chunks/LpCalendar-B7ZL0ty3.js +150 -0
  12. package/dist/chunks/LpCard-1yvWT9fx.js +66 -0
  13. package/dist/chunks/LpCheckbox-BO0zuuPh.js +55 -0
  14. package/dist/chunks/LpCodeBlock-CSiOSPs8.js +253 -0
  15. package/dist/chunks/LpConfirmDialog-KLtTtCiT.js +62 -0
  16. package/dist/chunks/LpContextMenu-D0mzXqA7.js +151 -0
  17. package/dist/chunks/LpDatePicker-dY2q4dr4.js +122 -0
  18. package/dist/chunks/LpDisclosure-DP6yfgfM.js +76 -0
  19. package/dist/chunks/LpDivider-CUX46KR0.js +43 -0
  20. package/dist/chunks/LpDrawer-Ce6g9ZMr.js +310 -0
  21. package/dist/chunks/LpDropdownMenu-DJpoqRCb.js +65 -0
  22. package/dist/chunks/LpEmptyState-CrfyRJUG.js +47 -0
  23. package/dist/chunks/LpFormField-Bn-ZwC6z.js +47 -0
  24. package/dist/chunks/LpIcon-CCnX5_2j.js +41 -0
  25. package/dist/chunks/LpInfraNode-C_PHcthC.js +99 -0
  26. package/dist/chunks/LpInput-BauZRyzm.js +136 -0
  27. package/dist/chunks/LpLaneNode-HtnQf2FF.js +33 -0
  28. package/dist/chunks/LpLink-DHwOEp4e.js +36 -0
  29. package/dist/chunks/LpLogViewer-hC0OKkeE.js +482 -0
  30. package/dist/chunks/LpModal-CWoOExzT.js +128 -0
  31. package/dist/chunks/LpNotificationBell-BDy0tQwr.js +232 -0
  32. package/dist/chunks/LpNumberField-C5ar-OwE.js +55 -0
  33. package/dist/chunks/LpOtpInput-DqaT0Z75.js +65 -0
  34. package/dist/chunks/LpPagination-CeGuNe_q.js +132 -0
  35. package/dist/chunks/LpPasswordInput-DIHFw4u0.js +64 -0
  36. package/dist/chunks/LpPhoneInput-LQvVFGMw.js +199 -0
  37. package/dist/chunks/LpPopover-8268UmlC.js +54 -0
  38. package/dist/chunks/LpProgress-BhI0IbjC.js +37 -0
  39. package/dist/chunks/LpRadio-CL-pI0_O.js +39 -0
  40. package/dist/chunks/LpRadioGroup-B4yDTmi6.js +52 -0
  41. package/dist/chunks/LpScrollArea-K1x-azgY.js +67 -0
  42. package/dist/chunks/LpSegmented-BmpanyAo.js +74 -0
  43. package/dist/chunks/LpSelect-DznhPEWX.js +222 -0
  44. package/dist/chunks/LpServiceNode-Dc-Ut5RS.js +51 -0
  45. package/dist/chunks/LpSidebar-BPQabjae.js +152 -0
  46. package/dist/chunks/LpSidebarNav-CpF7rZxx.js +126 -0
  47. package/dist/chunks/LpSkeleton-eSFIo4kD.js +22 -0
  48. package/dist/chunks/LpSlider-B1SF3pRV.js +53 -0
  49. package/dist/chunks/LpStat-CdbEFOvn.js +88 -0
  50. package/dist/chunks/LpStepper-5dFTrW21.js +53 -0
  51. package/dist/chunks/LpSwitch-v6fnccSM.js +28 -0
  52. package/dist/chunks/LpTable-CJ4Zt1UH.js +229 -0
  53. package/dist/chunks/LpTableOfContents-CjvxPMpU.js +155 -0
  54. package/dist/chunks/LpTabs-D7aTVPOb.js +115 -0
  55. package/dist/chunks/LpTextarea-CRAkhemZ.js +44 -0
  56. package/dist/chunks/LpThemeSwitcher-BgWwfkxs.js +601 -0
  57. package/dist/chunks/LpTilt-DuyKbpkA.js +49 -0
  58. package/dist/chunks/LpToaster-gDB1EaU3.js +196 -0
  59. package/dist/chunks/LpTooltip-CIwoRCag.js +49 -0
  60. package/dist/chunks/LpTopologyCanvas-DVwyQfKa.js +237 -0
  61. package/dist/chunks/LpUptimeBar-CB366k0O.js +127 -0
  62. package/dist/component-names.d.ts +1 -1
  63. package/dist/components/LayoutCanvas.vue.js +4 -0
  64. package/dist/components/LayoutNode.vue.js +4 -0
  65. package/dist/components/LpAlert.vue.js +4 -0
  66. package/dist/components/LpAppShell.vue.js +4 -0
  67. package/dist/components/LpAutocomplete.vue.js +4 -0
  68. package/dist/components/LpAvatar.vue.js +4 -0
  69. package/dist/components/LpBadge.vue.js +4 -0
  70. package/dist/components/LpBreadcrumbs.vue.js +4 -0
  71. package/dist/components/LpButton.vue.js +4 -0
  72. package/dist/components/LpCalendar.vue.js +4 -0
  73. package/dist/components/LpCard.vue.js +4 -0
  74. package/dist/components/LpCheckbox.vue.js +4 -0
  75. package/dist/components/LpCodeBlock.vue.js +4 -0
  76. package/dist/components/LpCommandPalette.vue.js +310 -0
  77. package/dist/components/LpConfirmDialog.vue.js +4 -0
  78. package/dist/components/LpContextMenu.vue.d.ts +7 -0
  79. package/dist/components/LpContextMenu.vue.js +4 -0
  80. package/dist/components/LpDatePicker.vue.js +4 -0
  81. package/dist/components/LpDisclosure.vue.js +4 -0
  82. package/dist/components/LpDivider.vue.js +4 -0
  83. package/dist/components/LpDrawer.vue.d.ts +8 -0
  84. package/dist/components/LpDrawer.vue.js +4 -0
  85. package/dist/components/LpDropdownMenu.vue.js +4 -0
  86. package/dist/components/LpEmptyState.vue.js +4 -0
  87. package/dist/components/LpFormField.vue.js +4 -0
  88. package/dist/components/LpIcon.vue.js +4 -0
  89. package/dist/components/LpInfraNode.vue.js +4 -0
  90. package/dist/components/LpInput.vue.js +4 -0
  91. package/dist/components/LpLaneNode.vue.js +4 -0
  92. package/dist/components/LpLink.vue.js +4 -0
  93. package/dist/components/LpLogViewer.vue.js +4 -0
  94. package/dist/components/LpModal.vue.js +4 -0
  95. package/dist/components/LpNotificationBell.vue.js +4 -0
  96. package/dist/components/LpNumberField.vue.js +4 -0
  97. package/dist/components/LpOtpInput.vue.js +4 -0
  98. package/dist/components/LpPagination.vue.js +4 -0
  99. package/dist/components/LpPasswordInput.vue.js +4 -0
  100. package/dist/components/LpPhoneInput.vue.js +4 -0
  101. package/dist/components/LpPopover.vue.js +4 -0
  102. package/dist/components/LpProgress.vue.js +4 -0
  103. package/dist/components/LpRadio.vue.js +4 -0
  104. package/dist/components/LpRadioGroup.vue.js +4 -0
  105. package/dist/components/LpScrollArea.vue.d.ts +2 -2
  106. package/dist/components/LpScrollArea.vue.js +4 -0
  107. package/dist/components/LpSegmented.vue.js +4 -0
  108. package/dist/components/LpSelect.vue.d.ts +2 -0
  109. package/dist/components/LpSelect.vue.js +4 -0
  110. package/dist/components/LpServiceNode.vue.js +4 -0
  111. package/dist/components/LpSidebar.vue.js +4 -0
  112. package/dist/components/LpSidebarNav.vue.js +4 -0
  113. package/dist/components/LpSkeleton.vue.js +4 -0
  114. package/dist/components/LpSlider.vue.js +4 -0
  115. package/dist/components/LpStat.vue.js +4 -0
  116. package/dist/components/LpStepper.vue.js +4 -0
  117. package/dist/components/LpSwitch.vue.js +4 -0
  118. package/dist/components/LpTable.vue.js +4 -0
  119. package/dist/components/LpTableOfContents.vue.js +4 -0
  120. package/dist/components/LpTabs.vue.d.ts +4 -2
  121. package/dist/components/LpTabs.vue.js +4 -0
  122. package/dist/components/LpTextarea.vue.js +4 -0
  123. package/dist/components/LpThemeSwitcher.vue.js +4 -0
  124. package/dist/components/LpTilt.vue.d.ts +31 -0
  125. package/dist/components/LpTilt.vue.js +4 -0
  126. package/dist/components/LpToaster.vue.js +4 -0
  127. package/dist/components/LpTooltip.vue.js +4 -0
  128. package/dist/components/LpTopologyCanvas.vue.js +4 -0
  129. package/dist/components/LpUptimeBar.vue.js +4 -0
  130. package/dist/components/codeHighlight.js +230 -0
  131. package/dist/{countries-data-9rgqJWHo.js → components/countries-data.js} +2 -2
  132. package/dist/components/countries.js +38 -0
  133. package/dist/components/dropdown.js +14 -0
  134. package/dist/components/sidebar.js +1 -0
  135. package/dist/composables/useInputFilter.js +44 -0
  136. package/dist/composables/usePillTransition.js +11 -0
  137. package/dist/composables/useTilt.d.ts +23 -0
  138. package/dist/composables/useTilt.js +57 -0
  139. package/dist/composables/useToast.d.ts +2 -0
  140. package/dist/composables/useToast.js +49 -0
  141. package/dist/index.d.ts +3 -0
  142. package/dist/index.js +197 -17596
  143. package/dist/layout/registry.js +10 -0
  144. package/dist/layout/tree.js +192 -0
  145. package/dist/layout/useLayout.js +61 -0
  146. package/package.json +5 -3
  147. package/src/component-names.ts +1 -0
  148. package/src/components/LpContextMenu.vue +14 -4
  149. package/src/components/LpDrawer.vue +29 -1
  150. package/src/components/LpLogViewer.vue +180 -31
  151. package/src/components/LpScrollArea.vue +20 -15
  152. package/src/components/LpSelect.vue +0 -0
  153. package/src/components/LpSidebar.vue +5 -2
  154. package/src/components/LpTabs.vue +19 -6
  155. package/src/components/LpThemeSwitcher.vue +13 -2
  156. package/src/components/LpTilt.vue +61 -0
  157. package/src/components/LpToaster.vue +11 -4
  158. package/src/composables/useTilt.ts +103 -0
  159. package/src/composables/useToast.ts +2 -0
  160. package/src/index.ts +3 -0
  161. package/src/nuxt.ts +10 -1
  162. package/dist/index.css +0 -1
@@ -0,0 +1,66 @@
1
+ import { defineComponent, computed, openBlock, createBlock, withCtx, createElementVNode, mergeProps, renderSlot, createElementBlock } from "vue";
2
+ import { tv } from "tailwind-variants";
3
+ import { _ as _sfc_main$1 } from "./LpContextMenu-D0mzXqA7.js";
4
+ const __default__ = { inheritAttrs: false };
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ ...__default__,
7
+ __name: "LpCard",
8
+ props: {
9
+ variant: { default: "raised" },
10
+ padded: { type: Boolean, default: true },
11
+ interactive: { type: Boolean, default: false },
12
+ menuItems: {}
13
+ },
14
+ setup(__props) {
15
+ const card = tv({
16
+ base: "rounded-card border bg-surface-raised",
17
+ variants: {
18
+ variant: {
19
+ // raised opts into the skin painter (.lp-skin-panel) so it follows the
20
+ // active surface tokens (flat → glass) instead of a fixed shadow.
21
+ raised: "lp-skin-panel border-line",
22
+ flat: "border-line",
23
+ ghost: "border-transparent bg-transparent"
24
+ },
25
+ padded: { true: "p-5", false: "" },
26
+ // Lift on hover with a BRAND-tinted glow + brand border (a black drop-shadow
27
+ // was invisible on dark themes — it only showed on light). We write the glow
28
+ // through `--surface-panel-shadow`, the very variable the skin-painter feeds
29
+ // into .lp-skin-panel's box-shadow, AND set box-shadow directly — so the glow
30
+ // lands on both the `raised` variant (skin panel, whose own box-shadow would
31
+ // otherwise win, being declared outside @layer) and `flat`/`ghost`.
32
+ // NOTE: in Tailwind v4 `translate-*` writes the native `translate` property
33
+ // (not `transform`), so the transition list MUST name `translate` explicitly
34
+ // or the lift snaps while the rest eases.
35
+ interactive: {
36
+ true: "cursor-pointer transition-[translate,box-shadow,border-color] duration-medium ease-[var(--ease-emphasized)] hover:-translate-y-0.5 hover:border-brand/40 hover:shadow-[var(--lp-card-glow)] hover:[--surface-panel-shadow:var(--lp-card-glow)] [--lp-card-glow:0_8px_24px_-6px_color-mix(in_srgb,var(--color-brand)_38%,transparent)] motion-reduce:transition-none motion-reduce:hover:translate-y-0"
37
+ }
38
+ }
39
+ });
40
+ const props = __props;
41
+ const classes = computed(
42
+ () => card({ variant: props.variant, padded: props.padded, interactive: props.interactive })
43
+ );
44
+ return (_ctx, _cache) => {
45
+ return __props.menuItems?.length ? (openBlock(), createBlock(_sfc_main$1, {
46
+ key: 0,
47
+ items: __props.menuItems
48
+ }, {
49
+ default: withCtx(() => [
50
+ createElementVNode("div", mergeProps({ class: classes.value }, _ctx.$attrs), [
51
+ renderSlot(_ctx.$slots, "default")
52
+ ], 16)
53
+ ]),
54
+ _: 3
55
+ }, 8, ["items"])) : (openBlock(), createElementBlock("div", mergeProps({
56
+ key: 1,
57
+ class: classes.value
58
+ }, _ctx.$attrs), [
59
+ renderSlot(_ctx.$slots, "default")
60
+ ], 16));
61
+ };
62
+ }
63
+ });
64
+ export {
65
+ _sfc_main as _
66
+ };
@@ -0,0 +1,55 @@
1
+ import { defineComponent, openBlock, createElementBlock, createVNode, unref, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
2
+ import { CheckboxRoot, CheckboxIndicator } from "reka-ui";
3
+ import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
4
+ const _hoisted_1 = { class: "group inline-flex cursor-pointer items-center gap-2 text-sm text-ink" };
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ __name: "LpCheckbox",
7
+ props: {
8
+ modelValue: { type: Boolean },
9
+ indeterminate: { type: Boolean },
10
+ disabled: { type: Boolean },
11
+ label: {},
12
+ id: {},
13
+ name: {}
14
+ },
15
+ emits: ["update:modelValue", "change"],
16
+ setup(__props, { emit: __emit }) {
17
+ const emit = __emit;
18
+ function onUpdate(v) {
19
+ const checked = v === true;
20
+ emit("update:modelValue", checked);
21
+ emit("change", checked);
22
+ }
23
+ return (_ctx, _cache) => {
24
+ return openBlock(), createElementBlock("label", _hoisted_1, [
25
+ createVNode(unref(CheckboxRoot), {
26
+ id: __props.id,
27
+ name: __props.name,
28
+ "model-value": __props.indeterminate ? "indeterminate" : __props.modelValue,
29
+ disabled: __props.disabled,
30
+ class: "flex size-[18px] items-center justify-center rounded-[5px] border border-line-strong bg-surface-soft outline-none transition-[color,background-color,border-color,box-shadow,scale] duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] not-data-[state=checked]:not-data-[state=indeterminate]:group-hover:border-brand active:scale-90 motion-reduce:active:scale-100 focus-visible:ring-2 focus-visible:ring-ring data-[state=checked]:border-transparent data-[state=checked]:bg-brand data-[state=indeterminate]:border-transparent data-[state=indeterminate]:bg-brand disabled:cursor-not-allowed disabled:opacity-55",
31
+ "onUpdate:modelValue": onUpdate
32
+ }, {
33
+ default: withCtx(() => [
34
+ createVNode(unref(CheckboxIndicator), { class: "flex items-center justify-center text-ink-inverse data-[state=checked]:animate-[indicator-in_140ms_var(--ease-emphasized)] data-[state=indeterminate]:animate-[indicator-in_140ms_var(--ease-emphasized)]" }, {
35
+ default: withCtx(() => [
36
+ createVNode(_sfc_main$1, {
37
+ name: __props.indeterminate ? "lucide:minus" : "lucide:check",
38
+ size: 13
39
+ }, null, 8, ["name"])
40
+ ]),
41
+ _: 1
42
+ })
43
+ ]),
44
+ _: 1
45
+ }, 8, ["id", "name", "model-value", "disabled"]),
46
+ renderSlot(_ctx.$slots, "default", {}, () => [
47
+ createTextVNode(toDisplayString(__props.label), 1)
48
+ ])
49
+ ]);
50
+ };
51
+ }
52
+ });
53
+ export {
54
+ _sfc_main as _
55
+ };
@@ -0,0 +1,253 @@
1
+ import { defineComponent, computed, reactive, watch, ref, openBlock, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, createVNode, normalizeClass, normalizeStyle, Fragment, renderList } from "vue";
2
+ import { tokenizeLine } from "../components/codeHighlight.js";
3
+ import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
4
+ const _hoisted_1 = { class: "overflow-hidden rounded-card border border-line bg-surface font-mono text-xs" };
5
+ const _hoisted_2 = {
6
+ key: 0,
7
+ class: "flex items-center gap-2 border-b border-line bg-surface-soft px-3 py-1.5 text-muted"
8
+ };
9
+ const _hoisted_3 = {
10
+ key: 0,
11
+ class: "truncate text-ink"
12
+ };
13
+ const _hoisted_4 = {
14
+ key: 1,
15
+ class: "rounded bg-surface px-1.5 py-0.5 text-[10px] uppercase tracking-wide"
16
+ };
17
+ const _hoisted_5 = { class: "ml-auto flex items-center gap-1" };
18
+ const _hoisted_6 = ["aria-label"];
19
+ const _hoisted_7 = ["aria-label"];
20
+ const _hoisted_8 = ["value"];
21
+ const _hoisted_9 = { class: "block" };
22
+ const _hoisted_10 = {
23
+ key: 0,
24
+ class: "mr-3 inline-block w-7 select-none text-right text-muted/60",
25
+ "aria-hidden": "true"
26
+ };
27
+ const _hoisted_11 = ["aria-expanded", "onClick"];
28
+ const _hoisted_12 = { class: "select-none" };
29
+ const _hoisted_13 = {
30
+ key: 0,
31
+ class: "select-none text-muted/50"
32
+ };
33
+ const _hoisted_14 = {
34
+ key: 0,
35
+ class: "mr-3 inline-block w-7 select-none text-right text-muted/60",
36
+ "aria-hidden": "true"
37
+ };
38
+ const _sfc_main = /* @__PURE__ */ defineComponent({
39
+ __name: "LpCodeBlock",
40
+ props: {
41
+ modelValue: {},
42
+ lang: { default: "plain" },
43
+ lineNumbers: { type: Boolean, default: false },
44
+ wrap: { type: Boolean, default: false },
45
+ locked: { type: Boolean, default: true },
46
+ lockToggle: { type: Boolean, default: false },
47
+ copyable: { type: Boolean, default: true },
48
+ title: {},
49
+ height: {},
50
+ foldImports: { type: Boolean, default: false }
51
+ },
52
+ emits: ["update:modelValue", "update:locked"],
53
+ setup(__props, { emit: __emit }) {
54
+ const props = __props;
55
+ const emit = __emit;
56
+ const code = computed(() => props.modelValue ?? "");
57
+ const rawLines = computed(() => code.value.replace(/\n$/, "").split("\n"));
58
+ const REGION_START = /^\s*(?:\/\/|#|--)\s*#region\b\s*(.*?)\s*$/;
59
+ const REGION_END = /^\s*(?:\/\/|#|--)\s*#endregion\b/;
60
+ const IMPORT_LINE = /^\s*(?:import|package|use|from|#include|using)\b/;
61
+ const segments = computed(() => {
62
+ const out = [];
63
+ const src = rawLines.value;
64
+ let plain = [];
65
+ let foldId = 0;
66
+ const flushPlain = () => {
67
+ if (plain.length) {
68
+ out.push({ kind: "lines", lines: plain });
69
+ plain = [];
70
+ }
71
+ };
72
+ let i = 0;
73
+ if (props.foldImports && !REGION_START.test(src[0] ?? "")) {
74
+ let start = 0;
75
+ while (start < src.length && src[start].trim() === "") start++;
76
+ let end = start;
77
+ while (end < src.length && (IMPORT_LINE.test(src[end]) || src[end].trim() === "")) end++;
78
+ let realEnd = end;
79
+ while (realEnd > start && src[realEnd - 1].trim() === "") realEnd--;
80
+ if (realEnd - start >= 1) {
81
+ for (let k = 0; k < start; k++) plain.push({ n: k + 1, text: src[k] });
82
+ flushPlain();
83
+ const lines = [];
84
+ for (let k = start; k < realEnd; k++) lines.push({ n: k + 1, text: src[k] });
85
+ out.push({ kind: "fold", id: foldId++, label: "imports", defaultOpen: false, lines });
86
+ i = realEnd;
87
+ }
88
+ }
89
+ for (; i < src.length; i++) {
90
+ const line = src[i];
91
+ const startMatch = line.match(REGION_START);
92
+ if (startMatch) {
93
+ flushPlain();
94
+ const rest = startMatch[1] ?? "";
95
+ const defaultOpen = /\bopen\b/.test(rest);
96
+ const label = rest.replace(/\bopen\b/, "").trim() || "details";
97
+ const lines = [];
98
+ i++;
99
+ for (; i < src.length; i++) {
100
+ if (REGION_END.test(src[i])) break;
101
+ lines.push({ n: i + 1, text: src[i] });
102
+ }
103
+ out.push({ kind: "fold", id: foldId++, label, defaultOpen, lines });
104
+ continue;
105
+ }
106
+ plain.push({ n: i + 1, text: line });
107
+ }
108
+ flushPlain();
109
+ return out;
110
+ });
111
+ const hasFolds = computed(() => segments.value.some((s) => s.kind === "fold"));
112
+ const openState = reactive({});
113
+ watch(
114
+ segments,
115
+ (segs) => {
116
+ for (const key of Object.keys(openState)) delete openState[Number(key)];
117
+ for (const s of segs) if (s.kind === "fold") openState[s.id] = s.defaultOpen;
118
+ },
119
+ { immediate: true }
120
+ );
121
+ function toggleFold(id) {
122
+ openState[id] = !openState[id];
123
+ }
124
+ function tokens(text) {
125
+ return tokenizeLine(text, props.lang);
126
+ }
127
+ const copyText = computed(
128
+ () => segments.value.flatMap((s) => s.lines.map((l) => l.text)).join("\n")
129
+ );
130
+ const showHeader = computed(
131
+ () => Boolean(props.title || props.lang !== "plain" || props.copyable || props.lockToggle)
132
+ );
133
+ const copied = ref(false);
134
+ async function copy() {
135
+ try {
136
+ await navigator.clipboard.writeText(copyText.value);
137
+ copied.value = true;
138
+ window.setTimeout(() => copied.value = false, 1400);
139
+ } catch {
140
+ }
141
+ }
142
+ function toggleLock() {
143
+ emit("update:locked", !props.locked);
144
+ }
145
+ function onInput(e) {
146
+ emit("update:modelValue", e.target.value);
147
+ }
148
+ return (_ctx, _cache) => {
149
+ return openBlock(), createElementBlock("div", _hoisted_1, [
150
+ showHeader.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
151
+ __props.title ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
152
+ __props.lang !== "plain" ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(__props.lang), 1)) : createCommentVNode("", true),
153
+ createElementVNode("div", _hoisted_5, [
154
+ __props.lockToggle ? (openBlock(), createElementBlock("button", {
155
+ key: 0,
156
+ type: "button",
157
+ class: "group/lock flex items-center gap-1 rounded px-1.5 py-1 outline-none transition-colors duration-[var(--duration-fast)] hover:text-ink focus-visible:ring-2 focus-visible:ring-ring",
158
+ "aria-label": __props.locked ? "Unlock to edit" : "Lock (read-only)",
159
+ onClick: toggleLock
160
+ }, [
161
+ createVNode(_sfc_main$1, {
162
+ name: __props.locked ? "lucide:lock" : "lucide:lock-open",
163
+ size: 13,
164
+ class: "transition-transform duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-active/lock:scale-90"
165
+ }, null, 8, ["name"])
166
+ ], 8, _hoisted_6)) : createCommentVNode("", true),
167
+ __props.copyable ? (openBlock(), createElementBlock("button", {
168
+ key: 1,
169
+ type: "button",
170
+ class: "group/copy flex items-center gap-1 rounded px-1.5 py-1 outline-none transition-colors duration-[var(--duration-fast)] hover:text-ink focus-visible:ring-2 focus-visible:ring-ring",
171
+ "aria-label": copied.value ? "Copied" : "Copy code",
172
+ onClick: copy
173
+ }, [
174
+ createVNode(_sfc_main$1, {
175
+ name: copied.value ? "lucide:check" : "lucide:copy",
176
+ size: 13,
177
+ class: normalizeClass(copied.value ? "text-action" : "")
178
+ }, null, 8, ["name", "class"])
179
+ ], 8, _hoisted_7)) : createCommentVNode("", true)
180
+ ])
181
+ ])) : createCommentVNode("", true),
182
+ createElementVNode("div", {
183
+ class: normalizeClass(["lp-scrollbar-none relative", __props.height ? "overflow-auto" : ""]),
184
+ style: normalizeStyle(__props.height ? { height: __props.height } : void 0)
185
+ }, [
186
+ !__props.locked && !hasFolds.value ? (openBlock(), createElementBlock("textarea", {
187
+ key: 0,
188
+ value: code.value,
189
+ spellcheck: "false",
190
+ class: normalizeClass(["lp-scrollbar-none absolute inset-0 size-full resize-none overflow-auto whitespace-pre bg-transparent p-3 leading-relaxed text-transparent caret-brand outline-none", [__props.wrap ? "whitespace-pre-wrap break-words" : "whitespace-pre", __props.lineNumbers ? "pl-12" : ""]]),
191
+ onInput
192
+ }, null, 42, _hoisted_8)) : createCommentVNode("", true),
193
+ createElementVNode("pre", {
194
+ class: normalizeClass(["lp-scrollbar-none m-0 overflow-auto p-3 leading-relaxed", [__props.wrap ? "whitespace-pre-wrap break-words" : "whitespace-pre", !__props.locked && !hasFolds.value ? "pointer-events-none" : ""]])
195
+ }, [
196
+ createElementVNode("code", _hoisted_9, [
197
+ (openBlock(true), createElementBlock(Fragment, null, renderList(segments.value, (seg, s) => {
198
+ return openBlock(), createElementBlock(Fragment, { key: s }, [
199
+ seg.kind === "lines" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(seg.lines, (ln) => {
200
+ return openBlock(), createElementBlock("span", {
201
+ key: "l" + ln.n,
202
+ class: "block min-h-[1.4em]"
203
+ }, [
204
+ __props.lineNumbers ? (openBlock(), createElementBlock("span", _hoisted_10, toDisplayString(ln.n), 1)) : createCommentVNode("", true),
205
+ (openBlock(true), createElementBlock(Fragment, null, renderList(tokens(ln.text), (tok, j) => {
206
+ return openBlock(), createElementBlock("span", {
207
+ key: j,
208
+ class: normalizeClass(tok.cls)
209
+ }, toDisplayString(tok.text), 3);
210
+ }), 128))
211
+ ]);
212
+ }), 128)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
213
+ createElementVNode("button", {
214
+ type: "button",
215
+ class: "lp-fold-toggle flex w-full items-center gap-1.5 rounded px-1 py-0.5 text-left text-muted outline-none transition-colors duration-[var(--duration-fast)] hover:text-ink focus-visible:ring-2 focus-visible:ring-ring",
216
+ "aria-expanded": openState[seg.id],
217
+ onClick: ($event) => toggleFold(seg.id)
218
+ }, [
219
+ createVNode(_sfc_main$1, {
220
+ name: openState[seg.id] ? "lucide:chevron-down" : "lucide:chevron-right",
221
+ size: 12,
222
+ class: "shrink-0"
223
+ }, null, 8, ["name"]),
224
+ createElementVNode("span", _hoisted_12, toDisplayString(openState[seg.id] ? seg.label : seg.label + " …"), 1),
225
+ !openState[seg.id] ? (openBlock(), createElementBlock("span", _hoisted_13, "(" + toDisplayString(seg.lines.length) + " lines)", 1)) : createCommentVNode("", true)
226
+ ], 8, _hoisted_11),
227
+ openState[seg.id] ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(seg.lines, (ln) => {
228
+ return openBlock(), createElementBlock("span", {
229
+ key: "f" + ln.n,
230
+ class: "block min-h-[1.4em]"
231
+ }, [
232
+ __props.lineNumbers ? (openBlock(), createElementBlock("span", _hoisted_14, toDisplayString(ln.n), 1)) : createCommentVNode("", true),
233
+ (openBlock(true), createElementBlock(Fragment, null, renderList(tokens(ln.text), (tok, j) => {
234
+ return openBlock(), createElementBlock("span", {
235
+ key: j,
236
+ class: normalizeClass(tok.cls)
237
+ }, toDisplayString(tok.text), 3);
238
+ }), 128))
239
+ ]);
240
+ }), 128)) : createCommentVNode("", true)
241
+ ], 64))
242
+ ], 64);
243
+ }), 128))
244
+ ])
245
+ ], 2)
246
+ ], 6)
247
+ ]);
248
+ };
249
+ }
250
+ });
251
+ export {
252
+ _sfc_main as _
253
+ };
@@ -0,0 +1,62 @@
1
+ import { defineComponent, openBlock, createBlock, withCtx, renderSlot, createVNode, createTextVNode, toDisplayString } from "vue";
2
+ import { _ as _sfc_main$2 } from "./LpButton-5VXXCjwF.js";
3
+ import { _ as _sfc_main$1 } from "./LpModal-CWoOExzT.js";
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "LpConfirmDialog",
6
+ props: {
7
+ open: { type: Boolean },
8
+ title: {},
9
+ description: {},
10
+ confirmLabel: { default: "Confirm" },
11
+ cancelLabel: { default: "Cancel" },
12
+ danger: { type: Boolean }
13
+ },
14
+ emits: ["update:open", "confirm", "cancel"],
15
+ setup(__props, { emit: __emit }) {
16
+ const emit = __emit;
17
+ function confirm() {
18
+ emit("confirm");
19
+ emit("update:open", false);
20
+ }
21
+ function cancel() {
22
+ emit("cancel");
23
+ emit("update:open", false);
24
+ }
25
+ return (_ctx, _cache) => {
26
+ return openBlock(), createBlock(_sfc_main$1, {
27
+ open: __props.open,
28
+ title: __props.title,
29
+ description: __props.description,
30
+ "onUpdate:open": _cache[0] || (_cache[0] = (v) => _ctx.$emit("update:open", v))
31
+ }, {
32
+ footer: withCtx(() => [
33
+ createVNode(_sfc_main$2, {
34
+ variant: "ghost",
35
+ onClick: cancel
36
+ }, {
37
+ default: withCtx(() => [
38
+ createTextVNode(toDisplayString(__props.cancelLabel), 1)
39
+ ]),
40
+ _: 1
41
+ }),
42
+ createVNode(_sfc_main$2, {
43
+ variant: __props.danger ? "danger" : "solid",
44
+ onClick: confirm
45
+ }, {
46
+ default: withCtx(() => [
47
+ createTextVNode(toDisplayString(__props.confirmLabel), 1)
48
+ ]),
49
+ _: 1
50
+ }, 8, ["variant"])
51
+ ]),
52
+ default: withCtx(() => [
53
+ renderSlot(_ctx.$slots, "default")
54
+ ]),
55
+ _: 3
56
+ }, 8, ["open", "title", "description"]);
57
+ };
58
+ }
59
+ });
60
+ export {
61
+ _sfc_main as _
62
+ };
@@ -0,0 +1,151 @@
1
+ import { defineComponent, computed, renderSlot, openBlock, createBlock, unref, withCtx, createVNode, normalizeClass, createElementBlock, Fragment, renderList, createCommentVNode, createElementVNode, createTextVNode, toDisplayString } from "vue";
2
+ import { ContextMenuRoot, ContextMenuTrigger, ContextMenuPortal, ContextMenuContent, ContextMenuSeparator, ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent, ContextMenuItem } from "reka-ui";
3
+ import { POPOVER_PANEL } from "../components/dropdown.js";
4
+ import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
5
+ const _hoisted_1 = { class: "flex items-center gap-2" };
6
+ const _hoisted_2 = { class: "flex items-center gap-2" };
7
+ const _hoisted_3 = {
8
+ key: 0,
9
+ class: "text-xs text-muted"
10
+ };
11
+ const _hoisted_4 = { class: "flex items-center gap-2" };
12
+ const _hoisted_5 = {
13
+ key: 0,
14
+ class: "text-xs text-muted"
15
+ };
16
+ const ITEM = "group/item flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm outline-none transition-[background-color,color] duration-[var(--duration-fast)] data-[disabled]:pointer-events-none data-[disabled]:opacity-45 data-[highlighted]:bg-brand-soft";
17
+ const ICON = "transition-transform duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-data-[highlighted]/item:translate-x-0.5";
18
+ const _sfc_main = /* @__PURE__ */ defineComponent({
19
+ __name: "LpContextMenu",
20
+ props: {
21
+ items: {},
22
+ always: { type: Boolean }
23
+ },
24
+ setup(__props) {
25
+ const props = __props;
26
+ const enabled = computed(() => props.always || props.items.length > 0);
27
+ const PANEL = `${POPOVER_PANEL} z-(--z-popover) min-w-48 p-1 outline-none`;
28
+ return (_ctx, _cache) => {
29
+ return !enabled.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createBlock(unref(ContextMenuRoot), { key: 1 }, {
30
+ default: withCtx(() => [
31
+ createVNode(unref(ContextMenuTrigger), { "as-child": "" }, {
32
+ default: withCtx(() => [
33
+ renderSlot(_ctx.$slots, "default")
34
+ ]),
35
+ _: 3
36
+ }),
37
+ __props.items.length ? (openBlock(), createBlock(unref(ContextMenuPortal), { key: 0 }, {
38
+ default: withCtx(() => [
39
+ createVNode(unref(ContextMenuContent), {
40
+ class: normalizeClass(PANEL)
41
+ }, {
42
+ default: withCtx(() => [
43
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, i) => {
44
+ return openBlock(), createElementBlock(Fragment, { key: i }, [
45
+ item.separatorBefore ? (openBlock(), createBlock(unref(ContextMenuSeparator), {
46
+ key: 0,
47
+ class: "my-1 h-px bg-line"
48
+ })) : createCommentVNode("", true),
49
+ item.children?.length ? (openBlock(), createBlock(unref(ContextMenuSub), { key: 1 }, {
50
+ default: withCtx(() => [
51
+ createVNode(unref(ContextMenuSubTrigger), {
52
+ class: normalizeClass([ITEM, "justify-between text-ink data-[highlighted]:text-brand data-[state=open]:bg-brand-soft data-[state=open]:text-brand"])
53
+ }, {
54
+ default: withCtx(() => [
55
+ createElementVNode("span", _hoisted_1, [
56
+ item.icon ? (openBlock(), createBlock(_sfc_main$1, {
57
+ key: 0,
58
+ name: item.icon,
59
+ size: 15,
60
+ class: normalizeClass(ICON)
61
+ }, null, 8, ["name"])) : createCommentVNode("", true),
62
+ createTextVNode(" " + toDisplayString(item.label), 1)
63
+ ]),
64
+ createVNode(_sfc_main$1, {
65
+ name: "lucide:chevron-right",
66
+ size: 14,
67
+ class: "text-muted"
68
+ })
69
+ ]),
70
+ _: 2
71
+ }, 1032, ["class"]),
72
+ createVNode(unref(ContextMenuPortal), null, {
73
+ default: withCtx(() => [
74
+ createVNode(unref(ContextMenuSubContent), {
75
+ class: normalizeClass(PANEL),
76
+ "side-offset": 2,
77
+ "align-offset": -4
78
+ }, {
79
+ default: withCtx(() => [
80
+ (openBlock(true), createElementBlock(Fragment, null, renderList(item.children, (sub, j) => {
81
+ return openBlock(), createElementBlock(Fragment, { key: j }, [
82
+ sub.separatorBefore ? (openBlock(), createBlock(unref(ContextMenuSeparator), {
83
+ key: 0,
84
+ class: "my-1 h-px bg-line"
85
+ })) : createCommentVNode("", true),
86
+ createVNode(unref(ContextMenuItem), {
87
+ class: normalizeClass([ITEM, "justify-between", sub.danger ? "text-danger data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger" : "text-ink data-[highlighted]:text-brand"]),
88
+ disabled: sub.disabled,
89
+ onSelect: ($event) => sub.onSelect?.()
90
+ }, {
91
+ default: withCtx(() => [
92
+ createElementVNode("span", _hoisted_2, [
93
+ sub.icon ? (openBlock(), createBlock(_sfc_main$1, {
94
+ key: 0,
95
+ name: sub.icon,
96
+ size: 15,
97
+ class: normalizeClass(ICON)
98
+ }, null, 8, ["name"])) : createCommentVNode("", true),
99
+ createTextVNode(" " + toDisplayString(sub.label), 1)
100
+ ]),
101
+ sub.shortcut ? (openBlock(), createElementBlock("kbd", _hoisted_3, toDisplayString(sub.shortcut), 1)) : createCommentVNode("", true)
102
+ ]),
103
+ _: 2
104
+ }, 1032, ["class", "disabled", "onSelect"])
105
+ ], 64);
106
+ }), 128))
107
+ ]),
108
+ _: 2
109
+ }, 1024)
110
+ ]),
111
+ _: 2
112
+ }, 1024)
113
+ ]),
114
+ _: 2
115
+ }, 1024)) : (openBlock(), createBlock(unref(ContextMenuItem), {
116
+ key: 2,
117
+ class: normalizeClass([ITEM, "justify-between", item.danger ? "text-danger data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger" : "text-ink data-[highlighted]:text-brand"]),
118
+ disabled: item.disabled,
119
+ onSelect: ($event) => item.onSelect?.()
120
+ }, {
121
+ default: withCtx(() => [
122
+ createElementVNode("span", _hoisted_4, [
123
+ item.icon ? (openBlock(), createBlock(_sfc_main$1, {
124
+ key: 0,
125
+ name: item.icon,
126
+ size: 15,
127
+ class: normalizeClass(ICON)
128
+ }, null, 8, ["name"])) : createCommentVNode("", true),
129
+ createTextVNode(" " + toDisplayString(item.label), 1)
130
+ ]),
131
+ item.shortcut ? (openBlock(), createElementBlock("kbd", _hoisted_5, toDisplayString(item.shortcut), 1)) : createCommentVNode("", true)
132
+ ]),
133
+ _: 2
134
+ }, 1032, ["class", "disabled", "onSelect"]))
135
+ ], 64);
136
+ }), 128))
137
+ ]),
138
+ _: 1
139
+ })
140
+ ]),
141
+ _: 1
142
+ })) : createCommentVNode("", true)
143
+ ]),
144
+ _: 3
145
+ }));
146
+ };
147
+ }
148
+ });
149
+ export {
150
+ _sfc_main as _
151
+ };