@threadlabs/looma 0.6.4 → 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.
- package/package.json +2 -2
- package/styles/ui-affordance-scope.css +1 -1
- package/styles/ui-avatar-group.css +1 -1
- package/styles/ui-avatar.css +1 -1
- package/styles/ui-badge.css +1 -1
- package/styles/ui-button.css +1 -1
- package/styles/ui-callout.css +1 -1
- package/styles/ui-checkbox.css +1 -1
- package/styles/ui-cluster.css +1 -1
- package/styles/ui-combobox.css +1 -1
- package/styles/ui-container.css +1 -1
- package/styles/ui-context-menu.css +1 -1
- package/styles/ui-dialog.css +1 -1
- package/styles/ui-disclosure.css +1 -1
- package/styles/ui-editable.css +1 -1
- package/styles/ui-editor-insert-table-grid.css +1 -1
- package/styles/ui-editor-mention-menu.css +1 -1
- package/styles/ui-editor-slash-menu.css +1 -1
- package/styles/ui-editor-table-context-menu.css +1 -1
- package/styles/ui-editor-table-overlay.css +1 -1
- package/styles/ui-editor-table-toolbar.css +1 -1
- package/styles/ui-editor-toolbar.css +1 -1
- package/styles/ui-floating-action-button.css +1 -1
- package/styles/ui-form-field.css +1 -1
- package/styles/ui-grid.css +1 -1
- package/styles/ui-icon-button.css +1 -1
- package/styles/ui-icon.css +1 -1
- package/styles/ui-input.css +1 -1
- package/styles/ui-menu-item.css +1 -1
- package/styles/ui-menu.css +1 -1
- package/styles/ui-popover.css +1 -1
- package/styles/ui-radio-group.css +1 -1
- package/styles/ui-radio.css +1 -1
- package/styles/ui-reel.css +1 -1
- package/styles/ui-search-result-row.css +1 -1
- package/styles/ui-search-shell.css +1 -1
- package/styles/ui-select.css +1 -1
- package/styles/ui-separator.css +1 -1
- package/styles/ui-sidebar.css +1 -1
- package/styles/ui-stack.css +1 -1
- package/styles/ui-switch.css +1 -1
- package/styles/ui-switcher.css +1 -1
- package/styles/ui-tabs.css +1 -1
- package/styles/ui-textarea.css +1 -1
- package/styles/ui-toast-region.css +1 -1
- package/styles/ui-tooltip.css +1 -1
- package/styles/ui-top-bar.css +1 -1
- package/styles/ui-tree-item.css +1 -1
- package/styles/ui-tree.css +1 -1
- package/vanilla/UiAffordanceScope.d.ts +1 -1
- package/vanilla/UiAffordanceScope.js +1 -1
- package/vanilla/UiAvatar.d.ts +1 -1
- package/vanilla/UiAvatar.js +1 -1
- package/vanilla/UiAvatarGroup.d.ts +1 -1
- package/vanilla/UiAvatarGroup.js +1 -1
- package/vanilla/UiBadge.d.ts +1 -1
- package/vanilla/UiBadge.js +1 -1
- package/vanilla/UiButton.d.ts +1 -1
- package/vanilla/UiButton.js +1 -1
- package/vanilla/UiCallout.d.ts +1 -1
- package/vanilla/UiCallout.js +1 -1
- package/vanilla/UiCheckbox.d.ts +1 -1
- package/vanilla/UiCheckbox.js +1 -1
- package/vanilla/UiCluster.d.ts +1 -1
- package/vanilla/UiCluster.js +1 -1
- package/vanilla/UiCombobox.d.ts +1 -1
- package/vanilla/UiCombobox.js +1 -1
- package/vanilla/UiContainer.d.ts +1 -1
- package/vanilla/UiContainer.js +1 -1
- package/vanilla/UiContextMenu.d.ts +1 -1
- package/vanilla/UiContextMenu.js +1 -1
- package/vanilla/UiDialog.d.ts +1 -1
- package/vanilla/UiDialog.js +1 -1
- package/vanilla/UiDisclosure.d.ts +1 -1
- package/vanilla/UiDisclosure.js +1 -1
- package/vanilla/UiEditable.d.ts +1 -1
- package/vanilla/UiEditable.js +1 -1
- package/vanilla/UiEditorInsertTableGrid.d.ts +1 -1
- package/vanilla/UiEditorInsertTableGrid.js +1 -1
- package/vanilla/UiEditorMentionMenu.d.ts +1 -1
- package/vanilla/UiEditorMentionMenu.js +1 -1
- package/vanilla/UiEditorSlashMenu.d.ts +1 -1
- package/vanilla/UiEditorSlashMenu.js +1 -1
- package/vanilla/UiEditorTableContextMenu.d.ts +1 -1
- package/vanilla/UiEditorTableContextMenu.js +1 -1
- package/vanilla/UiEditorTableOverlay.d.ts +1 -1
- package/vanilla/UiEditorTableOverlay.js +1 -1
- package/vanilla/UiEditorTableToolbar.d.ts +1 -1
- package/vanilla/UiEditorTableToolbar.js +1 -1
- package/vanilla/UiEditorToolbar.d.ts +1 -1
- package/vanilla/UiEditorToolbar.js +1 -1
- package/vanilla/UiFloatingActionButton.d.ts +1 -1
- package/vanilla/UiFloatingActionButton.js +1 -1
- package/vanilla/UiFormField.d.ts +1 -1
- package/vanilla/UiFormField.js +1 -1
- package/vanilla/UiGrid.d.ts +1 -1
- package/vanilla/UiGrid.js +1 -1
- package/vanilla/UiIcon.d.ts +1 -1
- package/vanilla/UiIcon.js +1 -1
- package/vanilla/UiIconButton.d.ts +1 -1
- package/vanilla/UiIconButton.js +1 -1
- package/vanilla/UiInput.d.ts +1 -1
- package/vanilla/UiInput.js +1 -1
- package/vanilla/UiMenu.d.ts +1 -1
- package/vanilla/UiMenu.js +1 -1
- package/vanilla/UiMenuItem.d.ts +1 -1
- package/vanilla/UiMenuItem.js +1 -1
- package/vanilla/UiPopover.d.ts +1 -1
- package/vanilla/UiPopover.js +1 -1
- package/vanilla/UiRadio.d.ts +1 -1
- package/vanilla/UiRadio.js +1 -1
- package/vanilla/UiRadioGroup.d.ts +1 -1
- package/vanilla/UiRadioGroup.js +1 -1
- package/vanilla/UiReel.d.ts +1 -1
- package/vanilla/UiReel.js +1 -1
- package/vanilla/UiSearchResultRow.d.ts +1 -1
- package/vanilla/UiSearchResultRow.js +1 -1
- package/vanilla/UiSearchShell.d.ts +1 -1
- package/vanilla/UiSearchShell.js +1 -1
- package/vanilla/UiSelect.d.ts +1 -1
- package/vanilla/UiSelect.js +1 -1
- package/vanilla/UiSeparator.d.ts +1 -1
- package/vanilla/UiSeparator.js +1 -1
- package/vanilla/UiSidebar.d.ts +1 -1
- package/vanilla/UiSidebar.js +1 -1
- package/vanilla/UiStack.d.ts +1 -1
- package/vanilla/UiStack.js +1 -1
- package/vanilla/UiSwitch.d.ts +1 -1
- package/vanilla/UiSwitch.js +1 -1
- package/vanilla/UiSwitcher.d.ts +1 -1
- package/vanilla/UiSwitcher.js +1 -1
- package/vanilla/UiTabs.d.ts +1 -1
- package/vanilla/UiTabs.js +1 -1
- package/vanilla/UiTextarea.d.ts +1 -1
- package/vanilla/UiTextarea.js +1 -1
- package/vanilla/UiToastRegion.d.ts +1 -1
- package/vanilla/UiToastRegion.js +1 -1
- package/vanilla/UiTooltip.d.ts +1 -1
- package/vanilla/UiTooltip.js +1 -1
- package/vanilla/UiTopBar.d.ts +1 -1
- package/vanilla/UiTopBar.js +1 -1
- package/vanilla/UiTree.d.ts +1 -1
- package/vanilla/UiTree.js +1 -1
- package/vanilla/UiTreeItem.d.ts +1 -1
- package/vanilla/UiTreeItem.js +1 -1
- package/vue/UiAffordanceScope.vue +8 -84
- package/vue/UiAvatar.d.ts +1 -1
- package/vue/UiAvatar.vue +9 -106
- package/vue/UiAvatarGroup.vue +9 -96
- package/vue/UiBadge.vue +1 -1
- package/vue/UiButton.vue +1 -1
- package/vue/UiCallout.vue +1 -1
- package/vue/UiCheckbox.vue +22 -123
- package/vue/UiCluster.vue +1 -1
- package/vue/UiCombobox.d.ts +1 -1
- package/vue/UiCombobox.vue +224 -475
- package/vue/UiContainer.vue +1 -1
- package/vue/UiContextMenu.vue +34 -141
- package/vue/UiDialog.vue +25 -126
- package/vue/UiDisclosure.vue +26 -138
- package/vue/UiEditable.vue +46 -158
- package/vue/UiEditorInsertTableGrid.vue +19 -138
- package/vue/UiEditorMentionMenu.vue +17 -124
- package/vue/UiEditorSlashMenu.vue +17 -109
- package/vue/UiEditorTableContextMenu.vue +34 -122
- package/vue/UiEditorTableOverlay.vue +61 -167
- package/vue/UiEditorTableToolbar.vue +34 -142
- package/vue/UiEditorToolbar.vue +1 -1
- package/vue/UiFloatingActionButton.vue +1 -1
- package/vue/UiFormField.vue +7 -79
- package/vue/UiGrid.vue +1 -1
- package/vue/UiIcon.vue +8 -84
- package/vue/UiIconButton.vue +7 -79
- package/vue/UiInput.vue +7 -79
- package/vue/UiMenu.vue +42 -127
- package/vue/UiMenuItem.vue +1 -1
- package/vue/UiPopover.vue +25 -121
- package/vue/UiRadio.vue +22 -123
- package/vue/UiRadioGroup.d.ts +1 -1
- package/vue/UiRadioGroup.vue +32 -119
- package/vue/UiReel.vue +1 -1
- package/vue/UiSearchResultRow.vue +1 -1
- package/vue/UiSearchShell.vue +25 -121
- package/vue/UiSelect.vue +7 -79
- package/vue/UiSeparator.vue +1 -1
- package/vue/UiSidebar.vue +32 -133
- package/vue/UiStack.vue +1 -1
- package/vue/UiSwitch.vue +22 -123
- package/vue/UiSwitcher.vue +1 -1
- package/vue/UiTabs.vue +24 -128
- package/vue/UiTextarea.vue +7 -79
- package/vue/UiToastRegion.vue +37 -126
- package/vue/UiTooltip.vue +25 -124
- package/vue/UiTopBar.vue +1 -1
- package/vue/UiTree.vue +56 -137
- package/vue/UiTreeItem.vue +28 -144
- package/vue/chunks/UiAffordanceScope.js +9 -78
- package/vue/chunks/UiAvatar.js +13 -89
- package/vue/chunks/UiAvatarGroup.js +10 -80
- package/vue/chunks/UiBadge.js +1 -1
- package/vue/chunks/UiButton.js +1 -1
- package/vue/chunks/UiCallout.js +1 -1
- package/vue/chunks/UiCheckbox.js +17 -95
- package/vue/chunks/UiCluster.js +1 -1
- package/vue/chunks/UiCombobox.js +114 -325
- package/vue/chunks/UiContainer.js +1 -1
- package/vue/chunks/UiContextMenu.js +21 -113
- package/vue/chunks/UiDialog.js +20 -99
- package/vue/chunks/UiDisclosure.js +22 -112
- package/vue/chunks/UiEditable.js +32 -128
- package/vue/chunks/UiEditorInsertTableGrid.js +22 -116
- package/vue/chunks/UiEditorMentionMenu.js +18 -116
- package/vue/chunks/UiEditorSlashMenu.js +15 -101
- package/vue/chunks/UiEditorTableContextMenu.js +12 -91
- package/vue/chunks/UiEditorTableOverlay.js +29 -120
- package/vue/chunks/UiEditorTableToolbar.js +16 -111
- package/vue/chunks/UiEditorToolbar.js +1 -1
- package/vue/chunks/UiFloatingActionButton.js +1 -1
- package/vue/chunks/UiFormField.js +8 -73
- package/vue/chunks/UiGrid.js +1 -1
- package/vue/chunks/UiIcon.js +9 -78
- package/vue/chunks/UiIconButton.js +8 -73
- package/vue/chunks/UiInput.js +8 -73
- package/vue/chunks/UiMenu.js +25 -111
- package/vue/chunks/UiMenuItem.js +1 -1
- package/vue/chunks/UiPopover.js +18 -105
- package/vue/chunks/UiRadio.js +17 -95
- package/vue/chunks/UiRadioGroup.js +23 -105
- package/vue/chunks/UiReel.js +1 -1
- package/vue/chunks/UiSearchResultRow.js +1 -1
- package/vue/chunks/UiSearchShell.js +17 -94
- package/vue/chunks/UiSelect.js +8 -73
- package/vue/chunks/UiSeparator.js +1 -1
- package/vue/chunks/UiSidebar.js +23 -108
- package/vue/chunks/UiStack.js +1 -1
- package/vue/chunks/UiSwitch.js +17 -95
- package/vue/chunks/UiSwitcher.js +1 -1
- package/vue/chunks/UiTabs.js +22 -103
- package/vue/chunks/UiTextarea.js +8 -73
- package/vue/chunks/UiToastRegion.js +27 -112
- package/vue/chunks/UiTooltip.js +18 -106
- package/vue/chunks/UiTopBar.js +1 -1
- package/vue/chunks/UiTree.js +31 -109
- package/vue/chunks/UiTreeItem.js +29 -119
- package/vue/chunks/host.js +101 -0
- package/vue/components.css +706 -706
- package/vue/host.ts +154 -0
package/vue/chunks/UiTree.js
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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-
|
|
71
|
+
}), [["__scopeId", "data-v-89a4437c"]]);
|
|
150
72
|
//#endregion
|
|
151
73
|
export { UiTree_default as t };
|
package/vue/chunks/UiTreeItem.js
CHANGED
|
@@ -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,
|
|
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 = [
|
|
@@ -78,128 +79,37 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
78
79
|
const isContainer = ref(false);
|
|
79
80
|
/** The values the styles' :host-state() rules test. */
|
|
80
81
|
const hostState = computed(() => [props.selected && "selected", props.disabled && "disabled"].filter(Boolean).join(" "));
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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: {
|
|
84
89
|
bubbles: false,
|
|
85
90
|
composed: true,
|
|
86
91
|
cancelable: false
|
|
87
|
-
} }
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
emitEvent(name, detail);
|
|
96
|
-
if (detail !== null && typeof detail === "object" && "expanded" in detail) emitEvent("update:expanded", detail["expanded"]);
|
|
97
|
-
return root.value?.dispatchEvent(new CustomEvent(name, {
|
|
98
|
-
bubbles: true,
|
|
99
|
-
composed: true,
|
|
100
|
-
...declared[name],
|
|
101
|
-
detail
|
|
102
|
-
})) ?? true;
|
|
103
|
-
}
|
|
104
|
-
function read(name) {
|
|
105
|
-
if (name === "internalExpanded") return internalExpanded.value;
|
|
106
|
-
if (name === "structuralLevel") return structuralLevel.value;
|
|
107
|
-
if (name === "tabStop") return tabStop.value;
|
|
108
|
-
if (name === "isContainer") return isContainer.value;
|
|
109
|
-
return props[name];
|
|
110
|
-
}
|
|
111
|
-
function write(name, value) {
|
|
112
|
-
if (name === "internalExpanded") {
|
|
113
|
-
internalExpanded.value = value;
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
if (name === "structuralLevel") {
|
|
117
|
-
structuralLevel.value = value;
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
if (name === "tabStop") {
|
|
121
|
-
tabStop.value = value;
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
if (name === "isContainer") {
|
|
125
|
-
isContainer.value = value;
|
|
126
|
-
return true;
|
|
127
|
-
}
|
|
128
|
-
throw new TypeError(`Only declared state is writable; \`${name}\` is not.`);
|
|
129
|
-
}
|
|
130
|
-
const stops = [];
|
|
131
|
-
const host = {
|
|
132
|
-
get element() {
|
|
133
|
-
return root.value;
|
|
134
|
-
},
|
|
135
|
-
state: new Proxy({}, {
|
|
136
|
-
get: (_target, name) => typeof name === "string" ? read(name) : void 0,
|
|
137
|
-
set: (_target, name, value) => typeof name === "string" && write(name, value)
|
|
138
|
-
}),
|
|
92
|
+
} },
|
|
93
|
+
checks: { expand: isExpandDetail },
|
|
94
|
+
modeled: ["expanded"]
|
|
95
|
+
});
|
|
96
|
+
useComponentHost(controllerModule.default, {
|
|
97
|
+
root,
|
|
98
|
+
dispatch,
|
|
99
|
+
props,
|
|
139
100
|
refs: {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
},
|
|
146
|
-
get disclosure() {
|
|
147
|
-
return disclosureElement.value;
|
|
148
|
-
},
|
|
149
|
-
get actions() {
|
|
150
|
-
return actionsElement.value;
|
|
151
|
-
},
|
|
152
|
-
get children() {
|
|
153
|
-
return childrenElement.value;
|
|
154
|
-
}
|
|
101
|
+
row: rowElement,
|
|
102
|
+
dragHandle: dragHandleElement,
|
|
103
|
+
disclosure: disclosureElement,
|
|
104
|
+
actions: actionsElement,
|
|
105
|
+
children: childrenElement
|
|
155
106
|
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
get: () => value.value,
|
|
164
|
-
set: (next) => {
|
|
165
|
-
if (!Object.is(value.value, next)) value.value = next;
|
|
166
|
-
},
|
|
167
|
-
update: (next) => {
|
|
168
|
-
const updated = next(value.value);
|
|
169
|
-
if (!Object.is(value.value, updated)) value.value = updated;
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
},
|
|
173
|
-
computed(compute) {
|
|
174
|
-
const value = computed(compute);
|
|
175
|
-
return { get: () => value.value };
|
|
176
|
-
},
|
|
177
|
-
effect(run) {
|
|
178
|
-
const stop = watchEffect((onCleanup) => {
|
|
179
|
-
const cleanup = run();
|
|
180
|
-
if (typeof cleanup === "function") onCleanup(cleanup);
|
|
181
|
-
}, { flush: "post" });
|
|
182
|
-
stops.push(stop);
|
|
183
|
-
return stop;
|
|
184
|
-
},
|
|
185
|
-
on(event, listener) {
|
|
186
|
-
const element = root.value;
|
|
187
|
-
element?.addEventListener(event, listener);
|
|
188
|
-
const off = () => element?.removeEventListener(event, listener);
|
|
189
|
-
stops.push(off);
|
|
190
|
-
return off;
|
|
191
|
-
},
|
|
192
|
-
dispatch
|
|
193
|
-
};
|
|
194
|
-
let cleanup;
|
|
195
|
-
onMounted(() => {
|
|
196
|
-
Promise.resolve(controllerModule.default(host)).then((result) => {
|
|
197
|
-
cleanup = result;
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
onBeforeUnmount(() => {
|
|
201
|
-
for (const stop of stops.splice(0)) stop();
|
|
202
|
-
if (typeof cleanup === "function") cleanup();
|
|
107
|
+
state: {
|
|
108
|
+
internalExpanded,
|
|
109
|
+
structuralLevel,
|
|
110
|
+
tabStop,
|
|
111
|
+
isContainer
|
|
112
|
+
}
|
|
203
113
|
});
|
|
204
114
|
return (_ctx, _cache) => {
|
|
205
115
|
return openBlock(), createElementBlock("div", mergeProps({
|
|
@@ -300,6 +210,6 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
|
|
|
300
210
|
], 16, _hoisted_1);
|
|
301
211
|
};
|
|
302
212
|
}
|
|
303
|
-
}), [["__scopeId", "data-v-
|
|
213
|
+
}), [["__scopeId", "data-v-9b8fd08d"]]);
|
|
304
214
|
//#endregion
|
|
305
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 };
|