@threadlabs/looma 0.6.3 → 0.6.5

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 (250) hide show
  1. package/components/ui-tree-item/ui-tree-item.html +68 -12
  2. package/components/ui-tree-item/ui-tree-item.js +9 -1
  3. package/dist/index.js +1 -1
  4. package/package.json +2 -2
  5. package/styles/ui-affordance-scope.css +1 -1
  6. package/styles/ui-avatar-group.css +1 -1
  7. package/styles/ui-avatar.css +1 -1
  8. package/styles/ui-badge.css +1 -1
  9. package/styles/ui-button.css +1 -1
  10. package/styles/ui-callout.css +1 -1
  11. package/styles/ui-checkbox.css +1 -1
  12. package/styles/ui-cluster.css +1 -1
  13. package/styles/ui-combobox.css +1 -1
  14. package/styles/ui-container.css +1 -1
  15. package/styles/ui-context-menu.css +1 -1
  16. package/styles/ui-dialog.css +1 -1
  17. package/styles/ui-disclosure.css +1 -1
  18. package/styles/ui-editable.css +1 -1
  19. package/styles/ui-editor-insert-table-grid.css +1 -1
  20. package/styles/ui-editor-mention-menu.css +1 -1
  21. package/styles/ui-editor-slash-menu.css +1 -1
  22. package/styles/ui-editor-table-context-menu.css +1 -1
  23. package/styles/ui-editor-table-overlay.css +1 -1
  24. package/styles/ui-editor-table-toolbar.css +1 -1
  25. package/styles/ui-editor-toolbar.css +1 -1
  26. package/styles/ui-floating-action-button.css +1 -1
  27. package/styles/ui-form-field.css +1 -1
  28. package/styles/ui-grid.css +1 -1
  29. package/styles/ui-icon-button.css +1 -1
  30. package/styles/ui-icon.css +1 -1
  31. package/styles/ui-input.css +1 -1
  32. package/styles/ui-menu-item.css +1 -1
  33. package/styles/ui-menu.css +1 -1
  34. package/styles/ui-popover.css +1 -1
  35. package/styles/ui-radio-group.css +1 -1
  36. package/styles/ui-radio.css +1 -1
  37. package/styles/ui-reel.css +1 -1
  38. package/styles/ui-search-result-row.css +1 -1
  39. package/styles/ui-search-shell.css +1 -1
  40. package/styles/ui-select.css +1 -1
  41. package/styles/ui-separator.css +1 -1
  42. package/styles/ui-sidebar.css +1 -1
  43. package/styles/ui-stack.css +1 -1
  44. package/styles/ui-switch.css +1 -1
  45. package/styles/ui-switcher.css +1 -1
  46. package/styles/ui-tabs.css +1 -1
  47. package/styles/ui-textarea.css +1 -1
  48. package/styles/ui-toast-region.css +1 -1
  49. package/styles/ui-tooltip.css +1 -1
  50. package/styles/ui-top-bar.css +1 -1
  51. package/styles/ui-tree-item.css +75 -12
  52. package/styles/ui-tree.css +1 -1
  53. package/vanilla/UiAffordanceScope.d.ts +1 -1
  54. package/vanilla/UiAffordanceScope.js +1 -1
  55. package/vanilla/UiAvatar.d.ts +1 -1
  56. package/vanilla/UiAvatar.js +1 -1
  57. package/vanilla/UiAvatarGroup.d.ts +1 -1
  58. package/vanilla/UiAvatarGroup.js +1 -1
  59. package/vanilla/UiBadge.d.ts +1 -1
  60. package/vanilla/UiBadge.js +1 -1
  61. package/vanilla/UiButton.d.ts +1 -1
  62. package/vanilla/UiButton.js +1 -1
  63. package/vanilla/UiCallout.d.ts +1 -1
  64. package/vanilla/UiCallout.js +1 -1
  65. package/vanilla/UiCheckbox.d.ts +1 -1
  66. package/vanilla/UiCheckbox.js +1 -1
  67. package/vanilla/UiCluster.d.ts +1 -1
  68. package/vanilla/UiCluster.js +1 -1
  69. package/vanilla/UiCombobox.d.ts +1 -1
  70. package/vanilla/UiCombobox.js +1 -1
  71. package/vanilla/UiContainer.d.ts +1 -1
  72. package/vanilla/UiContainer.js +1 -1
  73. package/vanilla/UiContextMenu.d.ts +1 -1
  74. package/vanilla/UiContextMenu.js +1 -1
  75. package/vanilla/UiDialog.d.ts +1 -1
  76. package/vanilla/UiDialog.js +1 -1
  77. package/vanilla/UiDisclosure.d.ts +1 -1
  78. package/vanilla/UiDisclosure.js +1 -1
  79. package/vanilla/UiEditable.d.ts +1 -1
  80. package/vanilla/UiEditable.js +1 -1
  81. package/vanilla/UiEditorInsertTableGrid.d.ts +1 -1
  82. package/vanilla/UiEditorInsertTableGrid.js +1 -1
  83. package/vanilla/UiEditorMentionMenu.d.ts +1 -1
  84. package/vanilla/UiEditorMentionMenu.js +1 -1
  85. package/vanilla/UiEditorSlashMenu.d.ts +1 -1
  86. package/vanilla/UiEditorSlashMenu.js +1 -1
  87. package/vanilla/UiEditorTableContextMenu.d.ts +1 -1
  88. package/vanilla/UiEditorTableContextMenu.js +1 -1
  89. package/vanilla/UiEditorTableOverlay.d.ts +1 -1
  90. package/vanilla/UiEditorTableOverlay.js +1 -1
  91. package/vanilla/UiEditorTableToolbar.d.ts +1 -1
  92. package/vanilla/UiEditorTableToolbar.js +1 -1
  93. package/vanilla/UiEditorToolbar.d.ts +1 -1
  94. package/vanilla/UiEditorToolbar.js +1 -1
  95. package/vanilla/UiFloatingActionButton.d.ts +1 -1
  96. package/vanilla/UiFloatingActionButton.js +1 -1
  97. package/vanilla/UiFormField.d.ts +1 -1
  98. package/vanilla/UiFormField.js +1 -1
  99. package/vanilla/UiGrid.d.ts +1 -1
  100. package/vanilla/UiGrid.js +1 -1
  101. package/vanilla/UiIcon.d.ts +1 -1
  102. package/vanilla/UiIcon.js +1 -1
  103. package/vanilla/UiIconButton.d.ts +1 -1
  104. package/vanilla/UiIconButton.js +1 -1
  105. package/vanilla/UiInput.d.ts +1 -1
  106. package/vanilla/UiInput.js +1 -1
  107. package/vanilla/UiMenu.d.ts +1 -1
  108. package/vanilla/UiMenu.js +1 -1
  109. package/vanilla/UiMenuItem.d.ts +1 -1
  110. package/vanilla/UiMenuItem.js +1 -1
  111. package/vanilla/UiPopover.d.ts +1 -1
  112. package/vanilla/UiPopover.js +1 -1
  113. package/vanilla/UiRadio.d.ts +1 -1
  114. package/vanilla/UiRadio.js +1 -1
  115. package/vanilla/UiRadioGroup.d.ts +1 -1
  116. package/vanilla/UiRadioGroup.js +1 -1
  117. package/vanilla/UiReel.d.ts +1 -1
  118. package/vanilla/UiReel.js +1 -1
  119. package/vanilla/UiSearchResultRow.d.ts +1 -1
  120. package/vanilla/UiSearchResultRow.js +1 -1
  121. package/vanilla/UiSearchShell.d.ts +1 -1
  122. package/vanilla/UiSearchShell.js +1 -1
  123. package/vanilla/UiSelect.d.ts +1 -1
  124. package/vanilla/UiSelect.js +1 -1
  125. package/vanilla/UiSeparator.d.ts +1 -1
  126. package/vanilla/UiSeparator.js +1 -1
  127. package/vanilla/UiSidebar.d.ts +1 -1
  128. package/vanilla/UiSidebar.js +1 -1
  129. package/vanilla/UiStack.d.ts +1 -1
  130. package/vanilla/UiStack.js +1 -1
  131. package/vanilla/UiSwitch.d.ts +1 -1
  132. package/vanilla/UiSwitch.js +1 -1
  133. package/vanilla/UiSwitcher.d.ts +1 -1
  134. package/vanilla/UiSwitcher.js +1 -1
  135. package/vanilla/UiTabs.d.ts +1 -1
  136. package/vanilla/UiTabs.js +1 -1
  137. package/vanilla/UiTextarea.d.ts +1 -1
  138. package/vanilla/UiTextarea.js +1 -1
  139. package/vanilla/UiToastRegion.d.ts +1 -1
  140. package/vanilla/UiToastRegion.js +1 -1
  141. package/vanilla/UiTooltip.d.ts +1 -1
  142. package/vanilla/UiTooltip.js +1 -1
  143. package/vanilla/UiTopBar.d.ts +1 -1
  144. package/vanilla/UiTopBar.js +1 -1
  145. package/vanilla/UiTree.d.ts +1 -1
  146. package/vanilla/UiTree.js +1 -1
  147. package/vanilla/UiTreeItem.d.ts +1 -1
  148. package/vanilla/UiTreeItem.js +2 -2
  149. package/vue/UiAffordanceScope.vue +8 -84
  150. package/vue/UiAvatar.d.ts +1 -1
  151. package/vue/UiAvatar.vue +9 -106
  152. package/vue/UiAvatarGroup.vue +9 -96
  153. package/vue/UiBadge.vue +1 -1
  154. package/vue/UiButton.vue +1 -1
  155. package/vue/UiCallout.vue +1 -1
  156. package/vue/UiCheckbox.vue +22 -123
  157. package/vue/UiCluster.vue +1 -1
  158. package/vue/UiCombobox.d.ts +1 -1
  159. package/vue/UiCombobox.vue +224 -475
  160. package/vue/UiContainer.vue +1 -1
  161. package/vue/UiContextMenu.vue +34 -141
  162. package/vue/UiDialog.vue +25 -126
  163. package/vue/UiDisclosure.vue +26 -138
  164. package/vue/UiEditable.vue +46 -158
  165. package/vue/UiEditorInsertTableGrid.vue +19 -138
  166. package/vue/UiEditorMentionMenu.vue +17 -124
  167. package/vue/UiEditorSlashMenu.vue +17 -109
  168. package/vue/UiEditorTableContextMenu.vue +34 -122
  169. package/vue/UiEditorTableOverlay.vue +61 -167
  170. package/vue/UiEditorTableToolbar.vue +34 -142
  171. package/vue/UiEditorToolbar.vue +1 -1
  172. package/vue/UiFloatingActionButton.vue +1 -1
  173. package/vue/UiFormField.vue +7 -79
  174. package/vue/UiGrid.vue +1 -1
  175. package/vue/UiIcon.vue +8 -84
  176. package/vue/UiIconButton.vue +7 -79
  177. package/vue/UiInput.vue +7 -79
  178. package/vue/UiMenu.vue +42 -127
  179. package/vue/UiMenuItem.vue +1 -1
  180. package/vue/UiPopover.vue +25 -121
  181. package/vue/UiRadio.vue +22 -123
  182. package/vue/UiRadioGroup.d.ts +1 -1
  183. package/vue/UiRadioGroup.vue +32 -119
  184. package/vue/UiReel.vue +1 -1
  185. package/vue/UiSearchResultRow.vue +1 -1
  186. package/vue/UiSearchShell.vue +25 -121
  187. package/vue/UiSelect.vue +7 -79
  188. package/vue/UiSeparator.vue +1 -1
  189. package/vue/UiSidebar.vue +32 -133
  190. package/vue/UiStack.vue +1 -1
  191. package/vue/UiSwitch.vue +22 -123
  192. package/vue/UiSwitcher.vue +1 -1
  193. package/vue/UiTabs.vue +24 -128
  194. package/vue/UiTextarea.vue +7 -79
  195. package/vue/UiToastRegion.vue +37 -126
  196. package/vue/UiTooltip.vue +25 -124
  197. package/vue/UiTopBar.vue +1 -1
  198. package/vue/UiTree.vue +56 -137
  199. package/vue/UiTreeItem.vue +97 -153
  200. package/vue/chunks/UiAffordanceScope.js +9 -78
  201. package/vue/chunks/UiAvatar.js +13 -89
  202. package/vue/chunks/UiAvatarGroup.js +10 -80
  203. package/vue/chunks/UiBadge.js +1 -1
  204. package/vue/chunks/UiButton.js +1 -1
  205. package/vue/chunks/UiCallout.js +1 -1
  206. package/vue/chunks/UiCheckbox.js +17 -95
  207. package/vue/chunks/UiCluster.js +1 -1
  208. package/vue/chunks/UiCombobox.js +114 -325
  209. package/vue/chunks/UiContainer.js +1 -1
  210. package/vue/chunks/UiContextMenu.js +21 -113
  211. package/vue/chunks/UiDialog.js +20 -99
  212. package/vue/chunks/UiDisclosure.js +22 -112
  213. package/vue/chunks/UiEditable.js +32 -128
  214. package/vue/chunks/UiEditorInsertTableGrid.js +22 -116
  215. package/vue/chunks/UiEditorMentionMenu.js +18 -116
  216. package/vue/chunks/UiEditorSlashMenu.js +15 -101
  217. package/vue/chunks/UiEditorTableContextMenu.js +12 -91
  218. package/vue/chunks/UiEditorTableOverlay.js +29 -120
  219. package/vue/chunks/UiEditorTableToolbar.js +16 -111
  220. package/vue/chunks/UiEditorToolbar.js +1 -1
  221. package/vue/chunks/UiFloatingActionButton.js +1 -1
  222. package/vue/chunks/UiFormField.js +8 -73
  223. package/vue/chunks/UiGrid.js +1 -1
  224. package/vue/chunks/UiIcon.js +9 -78
  225. package/vue/chunks/UiIconButton.js +8 -73
  226. package/vue/chunks/UiInput.js +8 -73
  227. package/vue/chunks/UiMenu.js +25 -111
  228. package/vue/chunks/UiMenuItem.js +1 -1
  229. package/vue/chunks/UiPopover.js +18 -105
  230. package/vue/chunks/UiRadio.js +17 -95
  231. package/vue/chunks/UiRadioGroup.js +23 -105
  232. package/vue/chunks/UiReel.js +1 -1
  233. package/vue/chunks/UiSearchResultRow.js +1 -1
  234. package/vue/chunks/UiSearchShell.js +17 -94
  235. package/vue/chunks/UiSelect.js +8 -73
  236. package/vue/chunks/UiSeparator.js +1 -1
  237. package/vue/chunks/UiSidebar.js +23 -108
  238. package/vue/chunks/UiStack.js +1 -1
  239. package/vue/chunks/UiSwitch.js +17 -95
  240. package/vue/chunks/UiSwitcher.js +1 -1
  241. package/vue/chunks/UiTabs.js +22 -103
  242. package/vue/chunks/UiTextarea.js +8 -73
  243. package/vue/chunks/UiToastRegion.js +27 -112
  244. package/vue/chunks/UiTooltip.js +18 -106
  245. package/vue/chunks/UiTopBar.js +1 -1
  246. package/vue/chunks/UiTree.js +31 -109
  247. package/vue/chunks/UiTreeItem.js +35 -118
  248. package/vue/chunks/host.js +101 -0
  249. package/vue/components.css +759 -707
  250. package/vue/host.ts +154 -0
@@ -1,5 +1,6 @@
1
+ import { n as useComponentHost, t as createDispatch } from "./host.js";
1
2
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
- import { computed, createElementBlock, createElementVNode, defineComponent, mergeProps, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, shallowRef, watchEffect } from "vue";
3
+ import { computed, createElementBlock, createElementVNode, defineComponent, mergeProps, openBlock, ref, renderSlot } from "vue";
3
4
  import * as controllerModule from "@threadlabs/looma/components/ui-tooltip/ui-tooltip.js";
4
5
  //#region .build/vue/UiTooltip.vue?vue&type=script&setup=true&lang.ts
5
6
  var _hoisted_1 = ["hidden", "data-ui-tooltip-state"];
@@ -41,112 +42,23 @@ var UiTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
41
42
  props.placement && "placement",
42
43
  `placement=${encodeURIComponent(props.placement)}`
43
44
  ].filter(Boolean).join(" "));
44
- /** Dispatches a component event to Vue listeners and, for controllers and page code, on the root. */
45
- function dispatch(name, detail) {
46
- const declared = {
47
- open: {
48
- bubbles: true,
49
- composed: true,
50
- cancelable: false
51
- },
52
- close: {
53
- bubbles: true,
54
- composed: true,
55
- cancelable: false
56
- }
57
- };
58
- const checks = {
59
- open: (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["open"] === "boolean" && (detail["reason"] === "action" || detail["reason"] === "programmatic" || detail["reason"] === "light-dismiss" || detail["reason"] === "escape") && (detail["trigger"] === "keyboard" || detail["trigger"] === "pointer" || detail["trigger"] === "programmatic") && Object.keys(detail).every((key) => [
60
- "open",
61
- "reason",
62
- "trigger"
63
- ].includes(key)),
64
- close: (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["open"] === "boolean" && (detail["reason"] === "action" || detail["reason"] === "programmatic" || detail["reason"] === "light-dismiss" || detail["reason"] === "escape") && (detail["trigger"] === "keyboard" || detail["trigger"] === "pointer" || detail["trigger"] === "programmatic") && Object.keys(detail).every((key) => [
65
- "open",
66
- "reason",
67
- "trigger"
68
- ].includes(key))
69
- };
70
- if (detail !== void 0 && checks[name] !== void 0 && !checks[name](detail)) throw new TypeError(`HR002: Event \`${name}\` detail does not satisfy its declared type.`);
71
- const emitEvent = emit;
72
- emitEvent(name, detail);
73
- if (detail !== null && typeof detail === "object" && "open" in detail) emitEvent("update:open", detail["open"]);
74
- if (detail !== null && typeof detail === "object" && "trigger" in detail) emitEvent("update:trigger", detail["trigger"]);
75
- return root.value?.dispatchEvent(new CustomEvent(name, {
76
- bubbles: true,
77
- composed: true,
78
- ...declared[name],
79
- detail
80
- })) ?? true;
81
- }
82
- function read(name) {
83
- if (name === "internalOpen") return internalOpen.value;
84
- return props[name];
85
- }
86
- function write(name, value) {
87
- if (name === "internalOpen") {
88
- internalOpen.value = value;
89
- return true;
90
- }
91
- throw new TypeError(`Only declared state is writable; \`${name}\` is not.`);
92
- }
93
- const stops = [];
94
- const host = {
95
- get element() {
96
- return root.value;
45
+ const isOpenDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["open"] === "boolean" && (detail["reason"] === "action" || detail["reason"] === "programmatic" || detail["reason"] === "light-dismiss" || detail["reason"] === "escape") && (detail["trigger"] === "keyboard" || detail["trigger"] === "pointer" || detail["trigger"] === "programmatic") && Object.keys(detail).every((key) => [
46
+ "open",
47
+ "reason",
48
+ "trigger"
49
+ ].includes(key));
50
+ const dispatch = createDispatch(root, emit, {
51
+ checks: {
52
+ open: isOpenDetail,
53
+ close: isOpenDetail
97
54
  },
98
- state: new Proxy({}, {
99
- get: (_target, name) => typeof name === "string" ? read(name) : void 0,
100
- set: (_target, name, value) => typeof name === "string" && write(name, value)
101
- }),
102
- refs: {},
103
- elements: new Proxy({}, { get: (_target, name) => {
104
- if (typeof name !== "string" || root.value === null) return void 0;
105
- return (root.value instanceof HTMLFormElement ? root.value : root.value.querySelector("form"))?.elements.namedItem(name) ?? root.value.querySelector(`[name="${CSS.escape(name)}"]`) ?? void 0;
106
- } }),
107
- signal(initialValue) {
108
- const value = shallowRef(initialValue);
109
- return {
110
- get: () => value.value,
111
- set: (next) => {
112
- if (!Object.is(value.value, next)) value.value = next;
113
- },
114
- update: (next) => {
115
- const updated = next(value.value);
116
- if (!Object.is(value.value, updated)) value.value = updated;
117
- }
118
- };
119
- },
120
- computed(compute) {
121
- const value = computed(compute);
122
- return { get: () => value.value };
123
- },
124
- effect(run) {
125
- const stop = watchEffect((onCleanup) => {
126
- const cleanup = run();
127
- if (typeof cleanup === "function") onCleanup(cleanup);
128
- }, { flush: "post" });
129
- stops.push(stop);
130
- return stop;
131
- },
132
- on(event, listener) {
133
- const element = root.value;
134
- element?.addEventListener(event, listener);
135
- const off = () => element?.removeEventListener(event, listener);
136
- stops.push(off);
137
- return off;
138
- },
139
- dispatch
140
- };
141
- let cleanup;
142
- onMounted(() => {
143
- Promise.resolve(controllerModule.default(host)).then((result) => {
144
- cleanup = result;
145
- });
55
+ modeled: ["open", "trigger"]
146
56
  });
147
- onBeforeUnmount(() => {
148
- for (const stop of stops.splice(0)) stop();
149
- if (typeof cleanup === "function") cleanup();
57
+ useComponentHost(controllerModule.default, {
58
+ root,
59
+ dispatch,
60
+ props,
61
+ state: { internalOpen }
150
62
  });
151
63
  return (_ctx, _cache) => {
152
64
  return openBlock(), createElementBlock("span", mergeProps({
@@ -160,6 +72,6 @@ var UiTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
160
72
  }), [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "default", {}, void 0, true)])], 16, _hoisted_1);
161
73
  };
162
74
  }
163
- }), [["__scopeId", "data-v-3af2132e"]]);
75
+ }), [["__scopeId", "data-v-5952fbd4"]]);
164
76
  //#endregion
165
77
  export { UiTooltip_default as t };
@@ -20,6 +20,6 @@ var UiTopBar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
20
20
  ], 16);
21
21
  };
22
22
  }
23
- }), [["__scopeId", "data-v-88437f08"]]);
23
+ }), [["__scopeId", "data-v-d08120f9"]]);
24
24
  //#endregion
25
25
  export { UiTopBar_default as t };
@@ -1,5 +1,6 @@
1
+ import { n as useComponentHost, t as createDispatch } from "./host.js";
1
2
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
- import { computed, createElementBlock, defineComponent, mergeProps, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, shallowRef, watchEffect } from "vue";
3
+ import { computed, createElementBlock, defineComponent, mergeProps, openBlock, ref, renderSlot } from "vue";
3
4
  import * as controllerModule from "@threadlabs/looma/components/ui-tree/ui-tree.js";
4
5
  //#region .build/vue/UiTree.vue?vue&type=script&setup=true&lang.ts
5
6
  var _hoisted_1 = ["data-ui-tree-state"];
@@ -25,115 +26,36 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
25
26
  const root = ref(null);
26
27
  /** The values the styles' :host-state() rules test. */
27
28
  const hostState = computed(() => [props.density && `density density=${props.density}`].filter(Boolean).join(" "));
28
- /** Dispatches a component event to Vue listeners and, for controllers and page code, on the root. */
29
- function dispatch(name, detail) {
30
- const declared = {
31
- reorder: {
32
- bubbles: true,
33
- composed: true,
34
- cancelable: false
35
- },
36
- "reorder-rejected": {
37
- bubbles: true,
38
- composed: true,
39
- cancelable: false
40
- }
41
- };
42
- const checks = {
43
- reorder: (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["sourceId"] === "string" && typeof detail["targetId"] === "string" && (detail["position"] === "before" || detail["position"] === "inside" || detail["position"] === "after") && typeof detail["sourceType"] === "string" && typeof detail["targetType"] === "string" && typeof detail["sourceScope"] === "string" && typeof detail["targetScope"] === "string" && (detail["trigger"] === "keyboard" || detail["trigger"] === "pointer" || detail["trigger"] === "programmatic") && Object.keys(detail).every((key) => [
44
- "sourceId",
45
- "targetId",
46
- "position",
47
- "sourceType",
48
- "targetType",
49
- "sourceScope",
50
- "targetScope",
51
- "trigger"
52
- ].includes(key)),
53
- "reorder-rejected": (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["sourceId"] === "string" && typeof detail["targetId"] === "string" && (detail["position"] === "before" || detail["position"] === "inside" || detail["position"] === "after") && detail["reason"] === "max-depth" && Number.isInteger(detail["maxDepth"]) && Number.isInteger(detail["resultingDepth"]) && (detail["trigger"] === "keyboard" || detail["trigger"] === "pointer" || detail["trigger"] === "programmatic") && Object.keys(detail).every((key) => [
54
- "sourceId",
55
- "targetId",
56
- "position",
57
- "reason",
58
- "maxDepth",
59
- "resultingDepth",
60
- "trigger"
61
- ].includes(key))
62
- };
63
- if (detail !== void 0 && checks[name] !== void 0 && !checks[name](detail)) throw new TypeError(`HR002: Event \`${name}\` detail does not satisfy its declared type.`);
64
- const emitEvent = emit;
65
- emitEvent(name, detail);
66
- if (detail !== null && typeof detail === "object" && "maxDepth" in detail) emitEvent("update:maxDepth", detail["maxDepth"]);
67
- return root.value?.dispatchEvent(new CustomEvent(name, {
68
- bubbles: true,
69
- composed: true,
70
- ...declared[name],
71
- detail
72
- })) ?? true;
73
- }
74
- function read(name) {
75
- return props[name];
76
- }
77
- function write(name, value) {
78
- throw new TypeError(`Only declared state is writable; \`${name}\` is not.`);
79
- }
80
- const stops = [];
81
- const host = {
82
- get element() {
83
- return root.value;
29
+ const isReorderDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["sourceId"] === "string" && typeof detail["targetId"] === "string" && (detail["position"] === "before" || detail["position"] === "inside" || detail["position"] === "after") && typeof detail["sourceType"] === "string" && typeof detail["targetType"] === "string" && typeof detail["sourceScope"] === "string" && typeof detail["targetScope"] === "string" && (detail["trigger"] === "keyboard" || detail["trigger"] === "pointer" || detail["trigger"] === "programmatic") && Object.keys(detail).every((key) => [
30
+ "sourceId",
31
+ "targetId",
32
+ "position",
33
+ "sourceType",
34
+ "targetType",
35
+ "sourceScope",
36
+ "targetScope",
37
+ "trigger"
38
+ ].includes(key));
39
+ const isReorderRejectedDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["sourceId"] === "string" && typeof detail["targetId"] === "string" && (detail["position"] === "before" || detail["position"] === "inside" || detail["position"] === "after") && detail["reason"] === "max-depth" && Number.isInteger(detail["maxDepth"]) && Number.isInteger(detail["resultingDepth"]) && (detail["trigger"] === "keyboard" || detail["trigger"] === "pointer" || detail["trigger"] === "programmatic") && Object.keys(detail).every((key) => [
40
+ "sourceId",
41
+ "targetId",
42
+ "position",
43
+ "reason",
44
+ "maxDepth",
45
+ "resultingDepth",
46
+ "trigger"
47
+ ].includes(key));
48
+ const dispatch = createDispatch(root, emit, {
49
+ checks: {
50
+ reorder: isReorderDetail,
51
+ "reorder-rejected": isReorderRejectedDetail
84
52
  },
85
- state: new Proxy({}, {
86
- get: (_target, name) => typeof name === "string" ? read(name) : void 0,
87
- set: (_target, name, value) => typeof name === "string" && write(name, value)
88
- }),
89
- refs: {},
90
- elements: new Proxy({}, { get: (_target, name) => {
91
- if (typeof name !== "string" || root.value === null) return void 0;
92
- return (root.value instanceof HTMLFormElement ? root.value : root.value.querySelector("form"))?.elements.namedItem(name) ?? root.value.querySelector(`[name="${CSS.escape(name)}"]`) ?? void 0;
93
- } }),
94
- signal(initialValue) {
95
- const value = shallowRef(initialValue);
96
- return {
97
- get: () => value.value,
98
- set: (next) => {
99
- if (!Object.is(value.value, next)) value.value = next;
100
- },
101
- update: (next) => {
102
- const updated = next(value.value);
103
- if (!Object.is(value.value, updated)) value.value = updated;
104
- }
105
- };
106
- },
107
- computed(compute) {
108
- const value = computed(compute);
109
- return { get: () => value.value };
110
- },
111
- effect(run) {
112
- const stop = watchEffect((onCleanup) => {
113
- const cleanup = run();
114
- if (typeof cleanup === "function") onCleanup(cleanup);
115
- }, { flush: "post" });
116
- stops.push(stop);
117
- return stop;
118
- },
119
- on(event, listener) {
120
- const element = root.value;
121
- element?.addEventListener(event, listener);
122
- const off = () => element?.removeEventListener(event, listener);
123
- stops.push(off);
124
- return off;
125
- },
126
- dispatch
127
- };
128
- let cleanup;
129
- onMounted(() => {
130
- Promise.resolve(controllerModule.default(host)).then((result) => {
131
- cleanup = result;
132
- });
53
+ modeled: ["maxDepth"]
133
54
  });
134
- onBeforeUnmount(() => {
135
- for (const stop of stops.splice(0)) stop();
136
- if (typeof cleanup === "function") cleanup();
55
+ useComponentHost(controllerModule.default, {
56
+ root,
57
+ dispatch,
58
+ props
137
59
  });
138
60
  return (_ctx, _cache) => {
139
61
  return openBlock(), createElementBlock("div", mergeProps({
@@ -146,6 +68,6 @@ var UiTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE_
146
68
  }), [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_1);
147
69
  };
148
70
  }
149
- }), [["__scopeId", "data-v-e94f7a5c"]]);
71
+ }), [["__scopeId", "data-v-89a4437c"]]);
150
72
  //#endregion
151
73
  export { UiTree_default as t };
@@ -1,5 +1,6 @@
1
+ import { n as useComponentHost, t as createDispatch } from "./host.js";
1
2
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
- import { computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeProps, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, shallowRef, toDisplayString, useTemplateRef, watchEffect } from "vue";
3
+ import { computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeProps, openBlock, ref, renderSlot, toDisplayString, useTemplateRef } from "vue";
3
4
  import * as controllerModule from "@threadlabs/looma/components/ui-tree-item/ui-tree-item.js";
4
5
  //#region .build/vue/UiTreeItem.vue?vue&type=script&setup=true&lang.ts
5
6
  var _hoisted_1 = [
@@ -23,7 +24,10 @@ var _hoisted_3 = ["aria-label"];
23
24
  var _hoisted_4 = ["disabled", "hidden"];
24
25
  var _hoisted_5 = { class: "leading" };
25
26
  var _hoisted_6 = { class: "label" };
26
- var _hoisted_7 = { class: "actions" };
27
+ var _hoisted_7 = {
28
+ class: "actions",
29
+ ref: "actions"
30
+ };
27
31
  var _hoisted_8 = ["hidden"];
28
32
  //#endregion
29
33
  //#region .build/vue/UiTreeItem.vue
@@ -67,6 +71,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
67
71
  const rowElement = useTemplateRef("row");
68
72
  const dragHandleElement = useTemplateRef("dragHandle");
69
73
  const disclosureElement = useTemplateRef("disclosure");
74
+ const actionsElement = useTemplateRef("actions");
70
75
  const childrenElement = useTemplateRef("children");
71
76
  const internalExpanded = ref(false);
72
77
  const structuralLevel = ref(1);
@@ -74,125 +79,37 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
74
79
  const isContainer = ref(false);
75
80
  /** The values the styles' :host-state() rules test. */
76
81
  const hostState = computed(() => [props.selected && "selected", props.disabled && "disabled"].filter(Boolean).join(" "));
77
- /** Dispatches a component event to Vue listeners and, for controllers and page code, on the root. */
78
- function dispatch(name, detail) {
79
- const declared = { expand: {
82
+ const isExpandDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["id"] === "string" && typeof detail["expanded"] === "boolean" && (detail["trigger"] === "keyboard" || detail["trigger"] === "pointer" || detail["trigger"] === "programmatic") && Object.keys(detail).every((key) => [
83
+ "id",
84
+ "expanded",
85
+ "trigger"
86
+ ].includes(key));
87
+ const dispatch = createDispatch(root, emit, {
88
+ declared: { expand: {
80
89
  bubbles: false,
81
90
  composed: true,
82
91
  cancelable: false
83
- } };
84
- const checks = { expand: (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && typeof detail["id"] === "string" && typeof detail["expanded"] === "boolean" && (detail["trigger"] === "keyboard" || detail["trigger"] === "pointer" || detail["trigger"] === "programmatic") && Object.keys(detail).every((key) => [
85
- "id",
86
- "expanded",
87
- "trigger"
88
- ].includes(key)) };
89
- if (detail !== void 0 && checks[name] !== void 0 && !checks[name](detail)) throw new TypeError(`HR002: Event \`${name}\` detail does not satisfy its declared type.`);
90
- const emitEvent = emit;
91
- emitEvent(name, detail);
92
- if (detail !== null && typeof detail === "object" && "expanded" in detail) emitEvent("update:expanded", detail["expanded"]);
93
- return root.value?.dispatchEvent(new CustomEvent(name, {
94
- bubbles: true,
95
- composed: true,
96
- ...declared[name],
97
- detail
98
- })) ?? true;
99
- }
100
- function read(name) {
101
- if (name === "internalExpanded") return internalExpanded.value;
102
- if (name === "structuralLevel") return structuralLevel.value;
103
- if (name === "tabStop") return tabStop.value;
104
- if (name === "isContainer") return isContainer.value;
105
- return props[name];
106
- }
107
- function write(name, value) {
108
- if (name === "internalExpanded") {
109
- internalExpanded.value = value;
110
- return true;
111
- }
112
- if (name === "structuralLevel") {
113
- structuralLevel.value = value;
114
- return true;
115
- }
116
- if (name === "tabStop") {
117
- tabStop.value = value;
118
- return true;
119
- }
120
- if (name === "isContainer") {
121
- isContainer.value = value;
122
- return true;
123
- }
124
- throw new TypeError(`Only declared state is writable; \`${name}\` is not.`);
125
- }
126
- const stops = [];
127
- const host = {
128
- get element() {
129
- return root.value;
130
- },
131
- state: new Proxy({}, {
132
- get: (_target, name) => typeof name === "string" ? read(name) : void 0,
133
- set: (_target, name, value) => typeof name === "string" && write(name, value)
134
- }),
92
+ } },
93
+ checks: { expand: isExpandDetail },
94
+ modeled: ["expanded"]
95
+ });
96
+ useComponentHost(controllerModule.default, {
97
+ root,
98
+ dispatch,
99
+ props,
135
100
  refs: {
136
- get row() {
137
- return rowElement.value;
138
- },
139
- get dragHandle() {
140
- return dragHandleElement.value;
141
- },
142
- get disclosure() {
143
- return disclosureElement.value;
144
- },
145
- get children() {
146
- return childrenElement.value;
147
- }
101
+ row: rowElement,
102
+ dragHandle: dragHandleElement,
103
+ disclosure: disclosureElement,
104
+ actions: actionsElement,
105
+ children: childrenElement
148
106
  },
149
- elements: new Proxy({}, { get: (_target, name) => {
150
- if (typeof name !== "string" || root.value === null) return void 0;
151
- return (root.value instanceof HTMLFormElement ? root.value : root.value.querySelector("form"))?.elements.namedItem(name) ?? root.value.querySelector(`[name="${CSS.escape(name)}"]`) ?? void 0;
152
- } }),
153
- signal(initialValue) {
154
- const value = shallowRef(initialValue);
155
- return {
156
- get: () => value.value,
157
- set: (next) => {
158
- if (!Object.is(value.value, next)) value.value = next;
159
- },
160
- update: (next) => {
161
- const updated = next(value.value);
162
- if (!Object.is(value.value, updated)) value.value = updated;
163
- }
164
- };
165
- },
166
- computed(compute) {
167
- const value = computed(compute);
168
- return { get: () => value.value };
169
- },
170
- effect(run) {
171
- const stop = watchEffect((onCleanup) => {
172
- const cleanup = run();
173
- if (typeof cleanup === "function") onCleanup(cleanup);
174
- }, { flush: "post" });
175
- stops.push(stop);
176
- return stop;
177
- },
178
- on(event, listener) {
179
- const element = root.value;
180
- element?.addEventListener(event, listener);
181
- const off = () => element?.removeEventListener(event, listener);
182
- stops.push(off);
183
- return off;
184
- },
185
- dispatch
186
- };
187
- let cleanup;
188
- onMounted(() => {
189
- Promise.resolve(controllerModule.default(host)).then((result) => {
190
- cleanup = result;
191
- });
192
- });
193
- onBeforeUnmount(() => {
194
- for (const stop of stops.splice(0)) stop();
195
- if (typeof cleanup === "function") cleanup();
107
+ state: {
108
+ internalExpanded,
109
+ structuralLevel,
110
+ tabStop,
111
+ isContainer
112
+ }
196
113
  });
197
114
  return (_ctx, _cache) => {
198
115
  return openBlock(), createElementBlock("div", mergeProps({
@@ -274,7 +191,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
274
191
  }, null, -1)])], 8, _hoisted_4),
275
192
  createElementVNode("span", _hoisted_5, [renderSlot(_ctx.$slots, "leading")]),
276
193
  createElementVNode("span", _hoisted_6, [renderSlot(_ctx.$slots, "label", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])]),
277
- createElementVNode("span", _hoisted_7, [renderSlot(_ctx.$slots, "actions")]),
194
+ createElementVNode("span", _hoisted_7, [renderSlot(_ctx.$slots, "actions")], 512),
278
195
  _cache[2] || (_cache[2] = createElementVNode("span", {
279
196
  class: "drop-indicator row-drop-indicator",
280
197
  "aria-hidden": "true"
@@ -293,6 +210,6 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
293
210
  ], 16, _hoisted_1);
294
211
  };
295
212
  }
296
- }), [["__scopeId", "data-v-b57a29c6"]]);
213
+ }), [["__scopeId", "data-v-9b8fd08d"]]);
297
214
  //#endregion
298
215
  export { UiTreeItem_default as t };
@@ -0,0 +1,101 @@
1
+ import { computed, onBeforeUnmount, onMounted, shallowRef, watchEffect } from "vue";
2
+ //#region .build/vue/host.ts
3
+ /**
4
+ * The controller host, built from Vue refs, effects, and lifecycle. Reads and writes reach the
5
+ * component's own refs, so a controller's change renders as any other Vue change does, and the
6
+ * effects and listeners it opens close when the component unmounts.
7
+ */
8
+ function useComponentHost(controller, options) {
9
+ const { root, dispatch, props, refs = {}, state = {}, computed: computedValues = {} } = options;
10
+ const stops = [];
11
+ const read = (name) => Object.hasOwn(state, name) ? state[name].value : Object.hasOwn(computedValues, name) ? computedValues[name].value : props?.[name];
12
+ const host = {
13
+ get element() {
14
+ return root.value;
15
+ },
16
+ state: new Proxy({}, {
17
+ get: (_target, name) => typeof name === "string" ? read(name) : void 0,
18
+ set: (_target, name, value) => {
19
+ if (typeof name !== "string" || !Object.hasOwn(state, name)) throw new TypeError(`Only declared state is writable; \`${String(name)}\` is not.`);
20
+ state[name].value = value;
21
+ return true;
22
+ }
23
+ }),
24
+ refs: Object.defineProperties({}, Object.fromEntries(Object.entries(refs).map(([name, ref]) => [name, {
25
+ enumerable: true,
26
+ get: () => ref.value
27
+ }]))),
28
+ elements: new Proxy({}, { get: (_target, name) => {
29
+ if (typeof name !== "string" || root.value === null) return void 0;
30
+ return (root.value instanceof HTMLFormElement ? root.value : root.value.querySelector("form"))?.elements.namedItem(name) ?? root.value.querySelector(`[name="${CSS.escape(name)}"]`) ?? void 0;
31
+ } }),
32
+ signal(initialValue) {
33
+ const value = shallowRef(initialValue);
34
+ return {
35
+ get: () => value.value,
36
+ set: (next) => {
37
+ value.value = next;
38
+ },
39
+ update: (next) => {
40
+ value.value = next(value.value);
41
+ }
42
+ };
43
+ },
44
+ computed(compute) {
45
+ const value = computed(compute);
46
+ return { get: () => value.value };
47
+ },
48
+ effect(run) {
49
+ const stop = watchEffect((onCleanup) => {
50
+ const cleanup = run();
51
+ if (typeof cleanup === "function") onCleanup(cleanup);
52
+ }, { flush: "post" });
53
+ stops.push(stop);
54
+ return stop;
55
+ },
56
+ on(event, listener) {
57
+ const element = root.value;
58
+ element?.addEventListener(event, listener);
59
+ const off = () => element?.removeEventListener(event, listener);
60
+ stops.push(off);
61
+ return off;
62
+ },
63
+ dispatch
64
+ };
65
+ let cleanup;
66
+ let started;
67
+ onMounted(() => {
68
+ started = Promise.resolve(controller?.(host)).then((result) => {
69
+ if (typeof result === "function") cleanup = result;
70
+ });
71
+ });
72
+ onBeforeUnmount(() => {
73
+ for (const stop of stops.splice(0)) stop();
74
+ if (typeof cleanup === "function") cleanup();
75
+ });
76
+ /** `ready` settles once the controller has started; a method exposed by the component awaits it. */
77
+ return {
78
+ host,
79
+ ready: () => started
80
+ };
81
+ }
82
+ /** Dispatches a component event to Vue listeners and, for controllers and page code, on the root. */
83
+ function createDispatch(root, emit, options = {}) {
84
+ const { declared = {}, checks = {}, modeled = [] } = options;
85
+ return (name, detail) => {
86
+ const check = checks[name];
87
+ if (detail !== void 0 && check !== void 0 && !check(detail)) throw new TypeError(`HR002: Event \`${name}\` detail does not satisfy its declared type.`);
88
+ emit?.(name, detail);
89
+ if (detail !== null && typeof detail === "object") {
90
+ for (const prop of modeled) if (prop in detail) emit?.(`update:${prop}`, detail[prop]);
91
+ }
92
+ return root.value?.dispatchEvent(new CustomEvent(name, {
93
+ bubbles: true,
94
+ composed: true,
95
+ ...declared[name],
96
+ detail
97
+ })) ?? true;
98
+ };
99
+ }
100
+ //#endregion
101
+ export { useComponentHost as n, createDispatch as t };