@threadlabs/looma 0.23.9 → 0.23.10

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.
@@ -9,6 +9,7 @@ var _hoisted_1 = [
9
9
  "data-label",
10
10
  "data-marquee",
11
11
  "data-max-depth",
12
+ "data-move-activation",
12
13
  "data-selection",
13
14
  "data-ui-tree-state"
14
15
  ];
@@ -38,6 +39,10 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
38
39
  type: null,
39
40
  default: 0
40
41
  },
42
+ moveActivation: {
43
+ type: null,
44
+ default: "click"
45
+ },
41
46
  selection: {
42
47
  type: null,
43
48
  default: "none"
@@ -103,6 +108,17 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
103
108
  description: "The deepest level a drag may produce, counting the top level as 1. A drop that would place the dragged item, or any item beneath it, deeper than this is\n refused and reported as reorder-rejected. 0 means no limit.",
104
109
  default: 0
105
110
  },
111
+ moveActivation: {
112
+ type: {
113
+ kind: "terminal",
114
+ name: "keyword"
115
+ },
116
+ required: false,
117
+ target: { attribute: "moveactivation" },
118
+ description: "Which handle activations start guided moving. click preserves two-click moving with any pointer. keyboard-touch leaves ordinary mouse and pen clicks inert\n while retaining keyboard activation and touch taps. Actual pointer dragging works in either mode. Guided moves show Cancel on the source row; Escape or\n reactivating that source handle also cancels without requesting a reorder.",
119
+ values: ["click", "keyboard-touch"],
120
+ default: "click"
121
+ },
106
122
  selection: {
107
123
  type: {
108
124
  kind: "terminal",
@@ -126,6 +142,7 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
126
142
  label: "Tree",
127
143
  marquee: false,
128
144
  maxDepth: 0,
145
+ moveActivation: "click",
129
146
  selection: "none"
130
147
  };
131
148
  const checkedProps = computed(() => ({
@@ -149,6 +166,10 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
149
166
  kind: "terminal",
150
167
  name: "number"
151
168
  }, false, "maxDepth", acceptedProps),
169
+ moveActivation: checkedProp(props["moveActivation"], {
170
+ kind: "terminal",
171
+ name: "keyword"
172
+ }, false, "moveActivation", acceptedProps),
152
173
  selection: checkedProp(props["selection"], {
153
174
  kind: "terminal",
154
175
  name: "keyword"
@@ -236,6 +257,7 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
236
257
  "label",
237
258
  "marquee",
238
259
  "maxDepth",
260
+ "moveActivation",
239
261
  "selection"
240
262
  ],
241
263
  propValidity: (name) => propValidityState({
@@ -253,6 +275,7 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
253
275
  "data-label": reflectedProp("label", "label", checkedProps.value.label, void 0, false),
254
276
  "data-marquee": reflectedProp("marquee", "marquee", checkedProps.value.marquee, void 0, false),
255
277
  "data-max-depth": reflectedProp("maxDepth", "max-depth", checkedProps.value.maxDepth, void 0, false),
278
+ "data-move-activation": reflectedProp("moveActivation", "move-activation", checkedProps.value.moveActivation, void 0, false),
256
279
  "data-selection": reflectedProp("selection", "selection", checkedProps.value.selection, void 0, false),
257
280
  "data-ui-tree-state": hostState.value || void 0,
258
281
  ref_key: "root",
@@ -263,6 +286,6 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
263
286
  }]]);
264
287
  };
265
288
  }
266
- }), [["__scopeId", "data-v-ba04ad17"]]);
289
+ }), [["__scopeId", "data-v-7845ed59"]]);
267
290
  //#endregion
268
291
  export { UiTree_default as t };
@@ -1,7 +1,8 @@
1
1
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
2
  import { r as useComponentHost, t as createDispatch } from "./host.js";
3
3
  import { i as vPropValidity, n as propValidityState, t as checkedProp } from "./props.js";
4
- import { computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, renderSlot, toDisplayString, unref, useTemplateRef, watchSyncEffect, withDirectives } from "vue";
4
+ import { t as UiButton_default } from "./UiButton.js";
5
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, getCurrentInstance, mergeProps, openBlock, provide, ref, renderSlot, toDisplayString, unref, useTemplateRef, watchSyncEffect, withCtx, withDirectives } from "vue";
5
6
  //#region .build/vue/UiTreeItem.vue?vue&type=script&setup=true&lang.ts
6
7
  var _hoisted_1 = [
7
8
  "aria-label",
@@ -245,7 +246,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
245
246
  },
246
247
  required: false,
247
248
  target: { attribute: "sortable" },
248
- description: "Gives the item a move handle. Drag it, or activate it and choose a target by a second click or the keyboard. The tree reports reorder and leaves moving the\n item to you. Needs itemId; disabled items show no handle.",
249
+ description: "Gives the item a move handle. Drag it, or activate it according to the tree's moveActivation and choose a target by a second click or the keyboard. A\n guided move exposes Cancel on this row. The tree reports reorder and leaves moving the item to you. Needs itemId; disabled items show no handle.",
249
250
  default: false
250
251
  },
251
252
  subtreeDepth: {
@@ -364,6 +365,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
364
365
  const structuralLevel = ref(1);
365
366
  const tabStop = ref(false);
366
367
  const isContainer = ref(false);
368
+ const moving = ref(false);
367
369
  let guardedPrevious;
368
370
  const guarded = computed(() => {
369
371
  if (!(structuralLevel.value == null || Number.isInteger(structuralLevel.value))) return guardedPrevious;
@@ -383,6 +385,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
383
385
  provide("html-next:ui-tree-item:structuralLevel", structuralLevel);
384
386
  provide("html-next:ui-tree-item:tabStop", tabStop);
385
387
  provide("html-next:ui-tree-item:isContainer", isContainer);
388
+ provide("html-next:ui-tree-item:moving", moving);
386
389
  const hydrationNode = hydrationInstance?.vnode.el;
387
390
  if (typeof window !== "undefined" && hydrationNode != null && (!(hydrationNode instanceof Element) || hydrationNode.localName !== "div")) throw Object.assign(/* @__PURE__ */ new Error("HR005: Server markup for <ui-tree-item> has an incompatible root."), {
388
391
  name: "HtmlDiagnosticError",
@@ -458,9 +461,18 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
458
461
  internalExpanded,
459
462
  structuralLevel,
460
463
  tabStop,
461
- isContainer
464
+ isContainer,
465
+ moving
462
466
  }
463
467
  });
468
+ function text(value) {
469
+ if (Array.isArray(value)) return value.map(text).join(" ");
470
+ return value === null || value === void 0 || typeof value === "object" ? "" : String(value);
471
+ }
472
+ function attribute(value) {
473
+ if (value === null || value === void 0 || value === false || typeof value === "object" && !Array.isArray(value)) return void 0;
474
+ return value === true ? "" : text(value);
475
+ }
464
476
  return (_ctx, _cache) => {
465
477
  return withDirectives((openBlock(), createElementBlock("div", mergeProps({
466
478
  "data-component": "ui-tree-item",
@@ -494,7 +506,16 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
494
506
  class: "drag-handle",
495
507
  type: "button",
496
508
  draggable: "true",
497
- "aria-label": `Drag ${checkedProps.value.label ?? ""} to reorder`,
509
+ "aria-label": typeof {
510
+ true: `Cancel moving ${checkedProps.value.label ?? ""}`,
511
+ false: `Drag ${checkedProps.value.label ?? ""} to reorder`
512
+ }[`${moving.value}`] === "boolean" ? String({
513
+ true: `Cancel moving ${checkedProps.value.label ?? ""}`,
514
+ false: `Drag ${checkedProps.value.label ?? ""} to reorder`
515
+ }[`${moving.value}`]) : attribute({
516
+ true: `Cancel moving ${checkedProps.value.label ?? ""}`,
517
+ false: `Drag ${checkedProps.value.label ?? ""} to reorder`
518
+ }[`${moving.value}`]),
498
519
  ref: "dragHandle"
499
520
  }, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
500
521
  "aria-hidden": "true",
@@ -557,8 +578,18 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
557
578
  }, null, 8, _hoisted_6)]),
558
579
  createElementVNode("span", _hoisted_7, [renderSlot(_ctx.$slots, "leading")], 512),
559
580
  createElementVNode("span", _hoisted_8, [createElementVNode("span", _hoisted_9, [renderSlot(_ctx.$slots, "label", {}, () => [createTextVNode(toDisplayString(checkedProps.value.label), 1)])], 512)], 512),
560
- createElementVNode("span", _hoisted_10, [renderSlot(_ctx.$slots, "actions")], 512),
561
- _cache[2] || (_cache[2] = createElementVNode("span", {
581
+ createElementVNode("span", _hoisted_10, [moving.value ? (openBlock(), createBlock(UiButton_default, {
582
+ key: 0,
583
+ "data-tree-cancel-move": "",
584
+ variant: "ghost",
585
+ tone: "neutral",
586
+ size: "sm",
587
+ "aria-label": "Cancel move"
588
+ }, {
589
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("Cancel", -1)])]),
590
+ _: 1
591
+ })) : createCommentVNode("v-if", true), createElementVNode("span", null, [renderSlot(_ctx.$slots, "actions")])], 512),
592
+ _cache[3] || (_cache[3] = createElementVNode("span", {
562
593
  class: "drop-indicator row-drop-indicator",
563
594
  "aria-hidden": "true"
564
595
  }, null, -1))
@@ -569,7 +600,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
569
600
  hidden: guardedBinding2.value,
570
601
  ref: "children"
571
602
  }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_11),
572
- _cache[3] || (_cache[3] = createElementVNode("span", {
603
+ _cache[4] || (_cache[4] = createElementVNode("span", {
573
604
  class: "drop-indicator subtree-drop-indicator",
574
605
  "aria-hidden": "true"
575
606
  }, null, -1))
@@ -579,6 +610,6 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
579
610
  }]]);
580
611
  };
581
612
  }
582
- }), [["__scopeId", "data-v-567c1a55"]]);
613
+ }), [["__scopeId", "data-v-d2b1bbe0"]]);
583
614
  //#endregion
584
615
  export { UiTreeItem_default as t };