@leavepulse/ui 0.22.19 → 0.22.20

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.
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, watch, computed, openBlock, createElementBlock, Fragment, renderList, normalizeStyle, createBlock, createVNode, withCtx, createElementVNode, renderSlot, mergeProps, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, createCommentVNode } from "vue";
2
2
  import { computeStats, formatSize, sortNodes, subtreeIds, ancestorIds } from "../components/fileTree.js";
3
3
  import { _ as _sfc_main$1 } from "./LpEmptyState-CrfyRJUG.js";
4
- import { _ as _sfc_main$3 } from "./LpFileTreeNode-DFg4PhOK.js";
4
+ import { _ as _sfc_main$3 } from "./LpFileTreeNode-Cgf68Tup.js";
5
5
  import { _ as _sfc_main$2 } from "./LpScrollArea-D8xyKXcF.js";
6
6
  const _hoisted_1 = {
7
7
  key: 0,
@@ -34,7 +34,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
34
34
  emptyLabel: { default: "No files" },
35
35
  emptyDescription: { default: "This folder is empty." }
36
36
  },
37
- emits: ["update:selected", "update:expanded", "select", "open", "expand", "collapse", "update:checked", "summary"],
37
+ emits: ["update:selected", "update:expanded", "select", "open", "expand", "collapse", "update:checked", "summary", "contextmenu"],
38
38
  setup(__props, { expose: __expose, emit: __emit }) {
39
39
  const props = __props;
40
40
  const emit = __emit;
@@ -360,7 +360,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
360
360
  onSelect,
361
361
  onToggle,
362
362
  onFocus: _cache[0] || (_cache[0] = ($event) => focusedId.value = $event.id),
363
- onCheck
363
+ onCheck,
364
+ onContextmenu: _cache[1] || (_cache[1] = (n, e) => emit("contextmenu", n, e))
364
365
  }, {
365
366
  row: withCtx((slotProps) => [
366
367
  renderSlot(_ctx.$slots, "row", mergeProps({ ref_for: true }, slotProps))
@@ -45,7 +45,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
45
45
  showSize: { type: Boolean },
46
46
  showModified: { type: Boolean }
47
47
  },
48
- emits: ["select", "toggle", "focus", "check"],
48
+ emits: ["select", "toggle", "focus", "check", "contextmenu"],
49
49
  setup(__props, { emit: __emit }) {
50
50
  const props = __props;
51
51
  const emit = __emit;
@@ -132,7 +132,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
132
132
  __props.node.disabled ? "cursor-not-allowed text-muted/50" : isSelected.value ? "bg-brand-soft text-ink" : "text-muted hover:bg-surface-soft hover:text-ink"
133
133
  ]]),
134
134
  style: normalizeStyle({ paddingLeft: `${__props.depth * 14 + 6}px` }),
135
- onClick: withModifiers(onActivate, ["stop"])
135
+ onClick: withModifiers(onActivate, ["stop"]),
136
+ onContextmenu: _cache[2] || (_cache[2] = ($event) => emit("contextmenu", __props.node, $event))
136
137
  }, [
137
138
  createElementVNode("span", _hoisted_3, [
138
139
  isLoading.value ? (openBlock(), createBlock(_sfc_main$2, {
@@ -177,7 +178,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
177
178
  __props.node.meta ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(__props.node.meta), 1)) : createCommentVNode("", true),
178
179
  modifiedLabel.value ? (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(modifiedLabel.value), 1)) : createCommentVNode("", true),
179
180
  sizeLabel.value ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(sizeLabel.value), 1)) : createCommentVNode("", true)
180
- ], 14, _hoisted_2)
181
+ ], 46, _hoisted_2)
181
182
  ]),
182
183
  _: 3
183
184
  }, 8, ["items"]),
@@ -206,10 +207,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
206
207
  stats: __props.stats,
207
208
  "show-size": __props.showSize,
208
209
  "show-modified": __props.showModified,
209
- onSelect: _cache[2] || (_cache[2] = ($event) => emit("select", $event)),
210
- onToggle: _cache[3] || (_cache[3] = ($event) => emit("toggle", $event)),
211
- onFocus: _cache[4] || (_cache[4] = ($event) => emit("focus", $event)),
212
- onCheck: _cache[5] || (_cache[5] = (n, v) => emit("check", n, v))
210
+ onSelect: _cache[3] || (_cache[3] = ($event) => emit("select", $event)),
211
+ onToggle: _cache[4] || (_cache[4] = ($event) => emit("toggle", $event)),
212
+ onFocus: _cache[5] || (_cache[5] = ($event) => emit("focus", $event)),
213
+ onCheck: _cache[6] || (_cache[6] = (n, v) => emit("check", n, v)),
214
+ onContextmenu: _cache[7] || (_cache[7] = (n, e) => emit("contextmenu", n, e))
213
215
  }, {
214
216
  row: withCtx((slotProps) => [
215
217
  renderSlot(_ctx.$slots, "row", mergeProps({ ref_for: true }, slotProps))
@@ -71,6 +71,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
71
71
  expand: (node: FileNode) => any;
72
72
  select: (node: FileNode) => any;
73
73
  summary: (summary: FileTreeSummary) => any;
74
+ contextmenu: (node: FileNode, event: MouseEvent) => any;
74
75
  open: (node: FileNode) => any;
75
76
  collapse: (node: FileNode) => any;
76
77
  "update:selected": (id: string) => any;
@@ -80,6 +81,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {
80
81
  onExpand?: ((node: FileNode) => any) | undefined;
81
82
  onSelect?: ((node: FileNode) => any) | undefined;
82
83
  onSummary?: ((summary: FileTreeSummary) => any) | undefined;
84
+ onContextmenu?: ((node: FileNode, event: MouseEvent) => any) | undefined;
83
85
  onOpen?: ((node: FileNode) => any) | undefined;
84
86
  onCollapse?: ((node: FileNode) => any) | undefined;
85
87
  "onUpdate:selected"?: ((id: string) => any) | undefined;
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "../chunks/LpFileTree-Cw50eG_y.js";
1
+ import { _ as _sfc_main } from "../chunks/LpFileTree-CMy2qQ1m.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -30,11 +30,13 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {},
30
30
  check: (node: FileNode, value: boolean) => any;
31
31
  focus: (node: FileNode) => any;
32
32
  select: (node: FileNode) => any;
33
+ contextmenu: (node: FileNode, event: MouseEvent) => any;
33
34
  toggle: (node: FileNode) => any;
34
35
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
35
36
  onCheck?: ((node: FileNode, value: boolean) => any) | undefined;
36
37
  onFocus?: ((node: FileNode) => any) | undefined;
37
38
  onSelect?: ((node: FileNode) => any) | undefined;
39
+ onContextmenu?: ((node: FileNode, event: MouseEvent) => any) | undefined;
38
40
  onToggle?: ((node: FileNode) => any) | undefined;
39
41
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
40
42
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "../chunks/LpFileTreeNode-DFg4PhOK.js";
1
+ import { _ as _sfc_main } from "../chunks/LpFileTreeNode-Cgf68Tup.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import { _ as _19 } from "./chunks/LpDivider-CUX46KR0.js";
22
22
  import { _ as _20 } from "./chunks/LpDrawer-DAJN5rGK.js";
23
23
  import { _ as _21 } from "./chunks/LpDropdownMenu-DJpoqRCb.js";
24
24
  import { _ as _22 } from "./chunks/LpEmptyState-CrfyRJUG.js";
25
- import { _ as _23 } from "./chunks/LpFileTree-Cw50eG_y.js";
25
+ import { _ as _23 } from "./chunks/LpFileTree-CMy2qQ1m.js";
26
26
  import { ancestorIds, checkStateOf, checkedCount, computeStats, fileIcon, formatModified, formatSize, sortNodes, subtreeIds, subtreeSize } from "./components/fileTree.js";
27
27
  import { _ as _24 } from "./chunks/LpFormField-Bn-ZwC6z.js";
28
28
  import { _ as _25 } from "./chunks/LpIcon-CCnX5_2j.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leavepulse/ui",
3
- "version": "0.22.19",
3
+ "version": "0.22.20",
4
4
  "type": "module",
5
5
  "description": "LeavePulse token-driven Vue component kit.",
6
6
  "repository": {
@@ -103,6 +103,9 @@ const emit = defineEmits<{
103
103
  (e: "update:checked", ids: string[]): void
104
104
  /** Ticked set changed, with the rolled-up stats already computed. */
105
105
  (e: "summary", summary: FileTreeSummary): void
106
+ /* Not prevented here: a caller that wants the native menu on some rows needs
107
+ the event intact to decide. */
108
+ (e: "contextmenu", node: FileNode, event: MouseEvent): void
106
109
  }>()
107
110
 
108
111
  defineSlots<{
@@ -528,6 +531,7 @@ defineExpose({ reveal, expandAll, collapseAll, checkAll, clearChecked, summary }
528
531
  @toggle="onToggle"
529
532
  @focus="focusedId = $event.id"
530
533
  @check="onCheck"
534
+ @contextmenu="(n, e) => emit('contextmenu', n, e)"
531
535
  >
532
536
  <template #row="slotProps">
533
537
  <slot name="row" v-bind="slotProps" />
@@ -47,6 +47,7 @@ const emit = defineEmits<{
47
47
  (e: "toggle", node: FileNode): void
48
48
  (e: "focus", node: FileNode): void
49
49
  (e: "check", node: FileNode, value: boolean): void
50
+ (e: "contextmenu", node: FileNode, event: MouseEvent): void
50
51
  }>()
51
52
 
52
53
  // Declared explicitly: the component renders itself, so an inferred slot type
@@ -176,6 +177,7 @@ function onActivate() {
176
177
  ]"
177
178
  :style="{ paddingLeft: `${depth * 14 + 6}px` }"
178
179
  @click.stop="onActivate"
180
+ @contextmenu="emit('contextmenu', node, $event)"
179
181
  >
180
182
  <!-- Chevron sits in a fixed-width slot so names line up whether or not
181
183
  the row can expand. Leaves get the same gutter, left empty. -->
@@ -281,6 +283,7 @@ function onActivate() {
281
283
  @toggle="emit('toggle', $event)"
282
284
  @focus="emit('focus', $event)"
283
285
  @check="(n, v) => emit('check', n, v)"
286
+ @contextmenu="(n, e) => emit('contextmenu', n, e)"
284
287
  >
285
288
  <template #row="slotProps">
286
289
  <slot name="row" v-bind="slotProps" />