bootstrap-vue-next 1.2.2 → 1.2.4
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/dist/{BAccordion-FuQ6sMFy.js → BAccordion-ByAMZCS9.js} +2 -2
- package/dist/{BAccordion-FuQ6sMFy.js.map → BAccordion-ByAMZCS9.js.map} +1 -1
- package/dist/{BAlert-C9Mi4RDx.js → BAlert-DdfFcjWF.js} +2 -2
- package/dist/{BAlert-C9Mi4RDx.js.map → BAlert-DdfFcjWF.js.map} +1 -1
- package/dist/{BApp-Bg5xEz8H.js → BApp-DZ9AITOm.js} +22 -3
- package/dist/BApp-DZ9AITOm.js.map +1 -0
- package/dist/{BCarousel-DQgfW4DN.js → BCarousel-qHGRSVFe.js} +2 -2
- package/dist/{BCarousel-DQgfW4DN.js.map → BCarousel-qHGRSVFe.js.map} +1 -1
- package/dist/{BCollapse-B9fnWSzA.js → BCollapse-DtuJwN7B.js} +2 -2
- package/dist/{BCollapse-B9fnWSzA.js.map → BCollapse-DtuJwN7B.js.map} +1 -1
- package/dist/{BDropdown-CnxUzs42.js → BDropdown-BY-E0SHv.js} +3 -3
- package/dist/{BDropdown-CnxUzs42.js.map → BDropdown-BY-E0SHv.js.map} +1 -1
- package/dist/{BModal-NPsCBNo7.js → BModal-DtQlIFNn.js} +2 -2
- package/dist/{BModal-NPsCBNo7.js.map → BModal-DtQlIFNn.js.map} +1 -1
- package/dist/{BNav-CjXS9tQ5.js → BNav-BMWNXoNo.js} +2 -2
- package/dist/{BNav-CjXS9tQ5.js.map → BNav-BMWNXoNo.js.map} +1 -1
- package/dist/{BOffcanvas-BndaBJoP.js → BOffcanvas-BtvIDgH7.js} +2 -2
- package/dist/{BOffcanvas-BndaBJoP.js.map → BOffcanvas-BtvIDgH7.js.map} +1 -1
- package/dist/{BPagination-D_Hfk6OF.js → BPagination-C85wHRgS.js} +2 -2
- package/dist/{BPagination-D_Hfk6OF.js.map → BPagination-C85wHRgS.js.map} +1 -1
- package/dist/{BTabs-BKmkVWrZ.js → BTabs-Cfe8HOGE.js} +2 -2
- package/dist/{BTabs-BKmkVWrZ.js.map → BTabs-Cfe8HOGE.js.map} +1 -1
- package/dist/{BToast-Di9HwBOV.js → BToast-Cm7TZlZq.js} +2 -2
- package/dist/{BToast-Di9HwBOV.js.map → BToast-Cm7TZlZq.js.map} +1 -1
- package/dist/{BTooltip-BxaUtV4m.js → BTooltip-CAgQ77tS.js} +5 -11
- package/dist/BTooltip-CAgQ77tS.js.map +1 -0
- package/dist/bootstrap-vue-next.mjs +16 -16
- package/dist/{classes-BEWWGbj5.js → classes-DCjKFM2E.js} +12 -2
- package/dist/classes-DCjKFM2E.js.map +1 -0
- package/dist/components/BTooltip/BTooltip.vue.d.mts +3 -3
- package/dist/components/BTooltip/BTooltip.vue.d.ts +3 -3
- package/dist/composables/usePopover/index.d.mts +9 -9
- package/dist/composables/usePopover/index.d.ts +9 -9
- package/dist/{floatingUi-BlKoACvc.js → floatingUi-CSJCHfOw.js} +2 -2
- package/dist/{floatingUi-BlKoACvc.js.map → floatingUi-CSJCHfOw.js.map} +1 -1
- package/dist/src/components/BAccordion/index.mjs +1 -1
- package/dist/src/components/BAlert/index.mjs +1 -1
- package/dist/src/components/BApp/index.mjs +1 -1
- package/dist/src/components/BCarousel/index.mjs +1 -1
- package/dist/src/components/BCollapse/index.mjs +1 -1
- package/dist/src/components/BDropdown/index.mjs +1 -1
- package/dist/src/components/BModal/index.mjs +1 -1
- package/dist/src/components/BNav/index.mjs +1 -1
- package/dist/src/components/BOffcanvas/index.mjs +1 -1
- package/dist/src/components/BPagination/index.mjs +1 -1
- package/dist/src/components/BPopover/index.mjs +1 -1
- package/dist/src/components/BTabs/index.mjs +1 -1
- package/dist/src/components/BToast/index.mjs +1 -1
- package/dist/src/components/BTooltip/index.mjs +1 -1
- package/dist/src/components/index.mjs +14 -14
- package/dist/src/composables/orchestratorShared/index.mjs +169 -23
- package/dist/src/composables/orchestratorShared/index.mjs.map +1 -1
- package/dist/src/composables/useModal/index.mjs +1 -1
- package/dist/src/composables/usePopover/index.mjs +2 -2
- package/dist/src/composables/useToast/index.mjs +1 -1
- package/dist/src/directives/BPopover/index.mjs +2 -2
- package/dist/src/directives/BScrollspy/index.mjs +1 -1
- package/dist/src/directives/BToggle/index.mjs +1 -1
- package/dist/src/directives/BTooltip/index.mjs +2 -2
- package/dist/src/utils/index.mjs +1 -1
- package/dist/types/ComponentOrchestratorTypes.d.mts +8 -1
- package/dist/types/ComponentOrchestratorTypes.d.ts +8 -1
- package/dist/{useShowHide-C95Y9EKL.js → useShowHide-Dpld86ys.js} +124 -54
- package/dist/useShowHide-Dpld86ys.js.map +1 -0
- package/dist/utils/classes.d.mts +10 -0
- package/dist/utils/classes.d.ts +10 -0
- package/dist/{utils-nRGGHA_i.js → utils-DYdkCKBf.js} +2 -2
- package/dist/{utils-nRGGHA_i.js.map → utils-DYdkCKBf.js.map} +1 -1
- package/package.json +1 -1
- package/dist/BApp-Bg5xEz8H.js.map +0 -1
- package/dist/BTooltip-BxaUtV4m.js.map +0 -1
- package/dist/classes-BEWWGbj5.js.map +0 -1
- package/dist/useShowHide-C95Y9EKL.js.map +0 -1
|
@@ -1,35 +1,180 @@
|
|
|
1
|
+
import { r as BvTriggerableEvent } from "../../../classes-DCjKFM2E.js";
|
|
1
2
|
import { _ as orchestratorRegistryKey } from "../../../keys-BgLwJbLV.js";
|
|
2
|
-
import { inject, nextTick, provide, readonly, ref } from "vue";
|
|
3
|
+
import { effectScope, inject, nextTick, provide, readonly, ref, shallowRef, watch } from "vue";
|
|
3
4
|
//#region src/composables/orchestratorShared/index.ts
|
|
4
5
|
var buildController = (id, store) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* True from a show() request on a mounted component until the store records it as open (the
|
|
8
|
+
* component reveals it) or the cycle settles. A show can still be waiting for its frame or delay
|
|
9
|
+
*/
|
|
10
|
+
let showRequested = false;
|
|
11
|
+
/**
|
|
12
|
+
* The cycle waiting for a show requested through the store's modelValue: the mount-time show of
|
|
13
|
+
* an item that was not mounted when show() was called, or the show a mounted component starts
|
|
14
|
+
* when its modelValue changes. Only that show's show-prevented event may settle it
|
|
15
|
+
*/
|
|
16
|
+
let storeShowCycle;
|
|
17
|
+
/**
|
|
18
|
+
* True from a hide request until the store's modelValue changes or the component reports hidden.
|
|
19
|
+
* The store keeps recording the component as open until its hide delay has passed, so a show()
|
|
20
|
+
* in that window has to reach the component to cancel the hide
|
|
21
|
+
*/
|
|
22
|
+
let hideRequested = false;
|
|
23
|
+
/**
|
|
24
|
+
* The last numeric modelValue the item had: a toast's countdown. The component counts it down to
|
|
25
|
+
* 0, so showing the item again has to put it back. Forgotten once the item is shown with `true`
|
|
26
|
+
*/
|
|
27
|
+
let countdown;
|
|
28
|
+
/**
|
|
29
|
+
* The dismissal the current show/hide cycle is waiting for. Each cycle gets its own, so a
|
|
30
|
+
* controller can be shown again after it was dismissed
|
|
31
|
+
*/
|
|
32
|
+
let dismissal;
|
|
33
|
+
const currentDismissal = () => {
|
|
34
|
+
if (!dismissal) {
|
|
35
|
+
let resolve = () => {};
|
|
36
|
+
dismissal = {
|
|
37
|
+
promise: new Promise((r) => {
|
|
38
|
+
resolve = r;
|
|
39
|
+
}),
|
|
40
|
+
resolve
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return dismissal;
|
|
44
|
+
};
|
|
9
45
|
const findItem = () => store.value.get(id);
|
|
46
|
+
const scope = effectScope(true);
|
|
47
|
+
scope.run(() => {
|
|
48
|
+
watch(() => findItem()?.value.props.modelValue, (value) => {
|
|
49
|
+
hideRequested = false;
|
|
50
|
+
if (value) showRequested = false;
|
|
51
|
+
if (typeof value === "number" && value > 0) countdown = value;
|
|
52
|
+
else if (value === true) countdown = void 0;
|
|
53
|
+
}, { flush: "sync" });
|
|
54
|
+
});
|
|
55
|
+
const instance = shallowRef(null);
|
|
56
|
+
/**
|
|
57
|
+
* Called with the component's hide, hidden or show-prevented event. Settles the current cycle
|
|
58
|
+
*/
|
|
59
|
+
const finishCycle = (event) => {
|
|
60
|
+
showRequested = false;
|
|
61
|
+
storeShowCycle = void 0;
|
|
62
|
+
const current = dismissal;
|
|
63
|
+
dismissal = void 0;
|
|
64
|
+
current?.resolve(event);
|
|
65
|
+
};
|
|
66
|
+
const settle = (event) => {
|
|
67
|
+
if (event.eventType === "show-prevented" && (!dismissal || storeShowCycle !== dismissal)) return;
|
|
68
|
+
finishCycle(event);
|
|
69
|
+
hideRequested = event.eventType === "hide";
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Shows the item by writing its modelValue. Used when there is no component show() to call, and
|
|
73
|
+
* to restart a countdown, which the component only does for a numeric modelValue
|
|
74
|
+
*/
|
|
75
|
+
const showThroughStore = (cycle, modelValue) => {
|
|
76
|
+
storeShowCycle = cycle;
|
|
77
|
+
controller.set({ modelValue });
|
|
78
|
+
if (instance.value !== null) nextTick(() => {
|
|
79
|
+
if (storeShowCycle === cycle) storeShowCycle = void 0;
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
let unmountedHideTrigger;
|
|
83
|
+
/**
|
|
84
|
+
* Resolves with the component's own event. A hidden item with no mounted component never emits
|
|
85
|
+
* one: it was dismissed before it mounted, or it unmounted before its hide finished. In that case
|
|
86
|
+
* it resolves on its own. Mounted items always go through the component.
|
|
87
|
+
* Take the cycle before asking the component to show or hide: it may report synchronously
|
|
88
|
+
*/
|
|
89
|
+
const awaitDismissal = async (cycle = currentDismissal()) => {
|
|
90
|
+
let stopWatch = () => {};
|
|
91
|
+
const dismissedWithoutInstance = new Promise((resolve) => {
|
|
92
|
+
stopWatch = watch([() => findItem()?.value.props.modelValue, instance], ([modelValue, mounted]) => {
|
|
93
|
+
if (!modelValue && mounted === null) {
|
|
94
|
+
const event = new BvTriggerableEvent("hidden", {
|
|
95
|
+
trigger: unmountedHideTrigger ?? null,
|
|
96
|
+
ok: null
|
|
97
|
+
});
|
|
98
|
+
if (dismissal === cycle) finishCycle(event);
|
|
99
|
+
resolve(event);
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
immediate: true,
|
|
103
|
+
flush: "sync"
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
try {
|
|
107
|
+
return await Promise.race([cycle.promise, dismissedWithoutInstance]);
|
|
108
|
+
} finally {
|
|
109
|
+
stopWatch();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
10
112
|
const controller = {
|
|
11
113
|
id,
|
|
12
|
-
ref
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
114
|
+
get ref() {
|
|
115
|
+
return instance.value;
|
|
116
|
+
},
|
|
117
|
+
set ref(value) {
|
|
118
|
+
instance.value = value;
|
|
119
|
+
if (value !== null && storeShowCycle) {
|
|
120
|
+
const cycle = storeShowCycle;
|
|
121
|
+
Promise.resolve().then(() => {
|
|
122
|
+
if (storeShowCycle === cycle) storeShowCycle = void 0;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
async show({ signal } = {}) {
|
|
127
|
+
const withDispose = (event) => Object.assign(Object.create(event), { [Symbol.asyncDispose]: controller.destroy });
|
|
128
|
+
const currentModelValue = controller.get()?.value.props.modelValue;
|
|
129
|
+
const isShown = !!currentModelValue || showRequested || controller.ref?.visible === true;
|
|
130
|
+
if (signal?.aborted && !isShown) return withDispose(new BvTriggerableEvent("hidden", {
|
|
131
|
+
trigger: "abort",
|
|
132
|
+
ok: null
|
|
133
|
+
}));
|
|
134
|
+
const cycle = currentDismissal();
|
|
135
|
+
const abort = () => {
|
|
136
|
+
controller.hide("abort");
|
|
137
|
+
Promise.resolve().then(() => {
|
|
138
|
+
if (dismissal === cycle) controller.hide("abort");
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
142
|
+
try {
|
|
143
|
+
if (signal?.aborted) abort();
|
|
144
|
+
else if (!showRequested && (!currentModelValue || hideRequested)) {
|
|
145
|
+
const cancelsHide = !!currentModelValue;
|
|
146
|
+
if (!cancelsHide) unmountedHideTrigger = void 0;
|
|
147
|
+
const refWithMethods = controller.ref;
|
|
148
|
+
if (!cancelsHide && countdown !== void 0) showThroughStore(cycle, countdown);
|
|
149
|
+
else if (refWithMethods !== null && "show" in refWithMethods && typeof refWithMethods.show === "function") {
|
|
150
|
+
if (!cancelsHide) showRequested = true;
|
|
151
|
+
hideRequested = false;
|
|
152
|
+
Promise.resolve(refWithMethods.show()).then((result) => {
|
|
153
|
+
if (result === "show-prevented" && dismissal === cycle) finishCycle(new BvTriggerableEvent("show-prevented", { ok: null }));
|
|
154
|
+
});
|
|
155
|
+
} else if (!cancelsHide) showThroughStore(cycle, true);
|
|
156
|
+
if (signal?.aborted) abort();
|
|
157
|
+
}
|
|
158
|
+
return withDispose(await awaitDismissal(cycle));
|
|
159
|
+
} finally {
|
|
160
|
+
signal?.removeEventListener("abort", abort);
|
|
17
161
|
}
|
|
18
|
-
const refWithMethods = controller.ref;
|
|
19
|
-
if (refWithMethods !== null && "show" in refWithMethods && typeof refWithMethods.show === "function") refWithMethods.show();
|
|
20
|
-
else controller.set({ modelValue: true });
|
|
21
|
-
const event = await basePromise;
|
|
22
|
-
return Object.assign(Object.create(event), { [Symbol.asyncDispose]: controller.destroy });
|
|
23
162
|
},
|
|
24
163
|
hide(trigger) {
|
|
25
164
|
const refWithMethods = controller.ref;
|
|
26
|
-
if (refWithMethods !== null && "hide" in refWithMethods && typeof refWithMethods.hide === "function")
|
|
27
|
-
|
|
165
|
+
if (refWithMethods !== null && "hide" in refWithMethods && typeof refWithMethods.hide === "function") {
|
|
166
|
+
hideRequested = true;
|
|
167
|
+
refWithMethods.hide(trigger, true);
|
|
168
|
+
} else {
|
|
169
|
+
if (refWithMethods === null) unmountedHideTrigger = trigger;
|
|
170
|
+
controller.set({ modelValue: false });
|
|
171
|
+
}
|
|
28
172
|
},
|
|
29
173
|
toggle() {
|
|
30
174
|
const currentItem = controller.get();
|
|
31
175
|
const refWithMethods = controller.ref;
|
|
32
|
-
if (
|
|
176
|
+
if (!currentItem?.value.props.modelValue && countdown !== void 0) controller.set({ modelValue: countdown });
|
|
177
|
+
else if (refWithMethods !== null && "toggle" in refWithMethods && typeof refWithMethods.toggle === "function") refWithMethods.toggle();
|
|
33
178
|
else controller.set({ modelValue: !currentItem?.value.props.modelValue });
|
|
34
179
|
},
|
|
35
180
|
get: findItem,
|
|
@@ -45,15 +190,16 @@ var buildController = (id, store) => {
|
|
|
45
190
|
},
|
|
46
191
|
async destroy() {
|
|
47
192
|
const item = findItem();
|
|
48
|
-
if (!item) return;
|
|
49
193
|
try {
|
|
50
|
-
if (item.value.props.modelValue) {
|
|
194
|
+
if (item && (item.value.props.modelValue || showRequested)) {
|
|
195
|
+
const cycle = currentDismissal();
|
|
51
196
|
controller.hide("destroy");
|
|
52
|
-
await
|
|
197
|
+
await awaitDismissal(cycle);
|
|
53
198
|
await nextTick();
|
|
54
199
|
}
|
|
55
200
|
} finally {
|
|
56
|
-
store.value.delete(id);
|
|
201
|
+
if (item) store.value.delete(id);
|
|
202
|
+
scope.stop();
|
|
57
203
|
}
|
|
58
204
|
},
|
|
59
205
|
[Symbol.asyncDispose]() {
|
|
@@ -62,7 +208,7 @@ var buildController = (id, store) => {
|
|
|
62
208
|
};
|
|
63
209
|
return {
|
|
64
210
|
controller,
|
|
65
|
-
resolve:
|
|
211
|
+
resolve: settle
|
|
66
212
|
};
|
|
67
213
|
};
|
|
68
214
|
var _newOrchestratorRegistry = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/composables/orchestratorShared/index.ts"],"sourcesContent":["import {type ComponentPublicInstance, inject, nextTick, provide, readonly, type Ref, ref} from 'vue'\nimport type {ComponentController, ControllerKey, PromiseWithController} from '../../types'\nimport type {BvTriggerableEvent} from '../../utils'\nimport {orchestratorRegistryKey, type OrchestratorStoreObject} from '../../utils/keys'\n\n/* oxlint-disable-next-line no-explicit-any */\n/* eslint-disable-next-line @typescript-eslint/no-explicit-any */\nexport type ValueInMapRecord<MapRecord> = MapRecord extends Map<any, infer I> ? I : never\n\nexport const buildController = <\n TComponent,\n TStore extends Readonly<Ref<OrchestratorStoreObject[keyof OrchestratorStoreObject]>>,\n>(\n id: ControllerKey,\n store: TStore\n): PromiseWithController<TComponent, ValueInMapRecord<TStore['value']>> => {\n let resolveFunc: (value: BvTriggerableEvent) => void = () => {}\n\n const basePromise = new Promise<BvTriggerableEvent>((resolve) => {\n resolveFunc = resolve\n })\n\n type RefWithMethods = ComponentPublicInstance<TComponent> & {\n show?: () => void\n hide?: (trigger?: string, noEmit?: boolean) => void\n toggle?: () => void\n }\n const findItem = () => store.value.get(id)\n\n const controller = {\n id,\n ref: null as RefWithMethods | null,\n async show() {\n const currentModelValue = controller.get()?.value.props.modelValue\n if (currentModelValue) {\n const event = await basePromise\n return Object.assign(Object.create(event), {\n [Symbol.asyncDispose]: controller.destroy,\n })\n }\n const refWithMethods = controller.ref\n if (\n refWithMethods !== null &&\n 'show' in refWithMethods &&\n typeof refWithMethods.show === 'function'\n ) {\n refWithMethods.show()\n } else {\n controller.set({modelValue: true})\n }\n const event = await basePromise\n return Object.assign(Object.create(event), {\n [Symbol.asyncDispose]: controller.destroy,\n })\n },\n hide(trigger?: string) {\n const refWithMethods = controller.ref\n if (\n refWithMethods !== null &&\n 'hide' in refWithMethods &&\n typeof refWithMethods.hide === 'function'\n ) {\n refWithMethods.hide(trigger, true)\n } else {\n controller.set({modelValue: false})\n }\n },\n toggle() {\n const currentItem = controller.get()\n const refWithMethods = controller.ref\n if (\n refWithMethods !== null &&\n 'toggle' in refWithMethods &&\n typeof refWithMethods.toggle === 'function'\n ) {\n refWithMethods.toggle()\n } else {\n controller.set({modelValue: !currentItem?.value.props.modelValue})\n }\n },\n get: findItem,\n set(val: Partial<ValueInMapRecord<TStore['value']>['value']['props']>) {\n const current = findItem()\n if (current?.value) {\n current.value = {\n ...current.value,\n props: {\n ...current.value.props,\n ...val,\n /* oxlint-disable no-explicit-any */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n } as any,\n }\n }\n },\n async destroy() {\n const item = findItem()\n if (!item) return\n try {\n if (item.value.props.modelValue) {\n controller.hide('destroy')\n await basePromise\n await nextTick()\n }\n } finally {\n store.value.delete(id)\n }\n },\n [Symbol.asyncDispose]() {\n return controller.destroy()\n },\n } as ComponentController<TComponent, ValueInMapRecord<TStore['value']>>\n\n return {\n controller,\n resolve: resolveFunc,\n }\n}\n\nexport const _newOrchestratorRegistry = (): {\n store: Readonly<Ref<OrchestratorStoreObject>>\n _isToastAppend: Readonly<Ref<boolean>>\n _setToastAppend: (value: boolean) => void\n _isOrchestratorInstalled: Readonly<Ref<boolean>>\n _setOrchestratorInstalled: (value: boolean) => void\n} => {\n const _isOrchestratorInstalled = ref(false)\n const _isToastAppend = ref(false)\n\n return {\n store: ref({\n modal: new Map(),\n tooltip: new Map(),\n popover: new Map(),\n toast: new Map(),\n }),\n _isOrchestratorInstalled: readonly(_isOrchestratorInstalled),\n _setOrchestratorInstalled: (v) => {\n _isOrchestratorInstalled.value = v\n },\n _isToastAppend: readonly(_isToastAppend),\n _setToastAppend: (v) => {\n _isToastAppend.value = v\n },\n }\n}\n\nexport const useOrchestratorRegistry = () => {\n const orchestratorRegistry = inject(orchestratorRegistryKey, null)\n\n if (orchestratorRegistry) {\n return orchestratorRegistry\n }\n const newOrchestratorRegistry = _newOrchestratorRegistry()\n provide(orchestratorRegistryKey, newOrchestratorRegistry)\n return newOrchestratorRegistry\n}\n\nexport const getOrchestratorControllerId = (propId: string | undefined) => {\n const id: ControllerKey = propId || Symbol('OrchestratorItem')\n\n return {\n /**\n * This id is used for stability in the store, using the createIdWatcher will update the store if the id ever changes\n */\n storeId: id,\n /**\n * Do not pass in the symbol as a prop. Html attribute cannot be a symbol. Thus it's internal\n */\n htmlAttributeId: typ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GAAG;IAGL;GACF;EAEJ;EACA,MAAM,UAAU;GACd,MAAM,OAAO,SAAS;GACtB,IAAI,CAAC,MAAM;GACX,IAAI;IACF,IAAI,KAAK,MAAM,MAAM,YAAY;KAC/B,WAAW,KAAK,SAAS;KACzB,MAAM;KACN,MAAM,SAAS;IACjB;GACF,UAAU;IACR,MAAM,MAAM,OAAO,EAAE;GACvB;EACF;EACA,CAAC,OAAO,gBAAgB;GACtB,OAAO,WAAW,QAAQ;EAC5B;CACF;CAEA,OAAO;EACL;EACA,SAAS;CACX;AACF;AAEA,IAAa,iCAMR;CACH,MAAM,2BAA2B,IAAI,KAAK;CAC1C,MAAM,iBAAiB,IAAI,KAAK;CAEhC,OAAO;EACL,OAAO,IAAI;GACT,uBAAO,IAAI,IAAI;GACf,yBAAS,IAAI,IAAI;GACjB,yBAAS,IAAI,IAAI;GACjB,uBAAO,IAAI,IAAI;EACjB,CAAC;EACD,0BAA0B,SAAS,wBAAwB;EAC3D,4BAA4B,MAAM;GAChC,yBAAyB,QAAQ;EACnC;EACA,gBAAgB,SAAS,cAAc;EACvC,kBAAkB,MAAM;GACtB,eAAe,QAAQ;EACzB;CACF;AACF;AAEA,IAAa,gCAAgC;CAC3C,MAAM,uBAAuB,OAAO,yBAAyB,IAAI;CAEjE,IAAI,sBACF,OAAO;CAET,MAAM,0BAA0B,yBAAyB;CACzD,QAAQ,yBAAyB,uBAAuB;CACxD,OAAO;AACT;AAEA,IAAa,+BAA+B,WAA+B;CACzE,MAAM,KAAoB,UAAU,OAAO,kBAAkB;CAE7D,OAAO;;;;EAIL,SAAS;;;;EAIT,iBAAiB,OAAO,OAAO,WAAW,KAAK,KAAA;CACjD;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/composables/orchestratorShared/index.ts"],"sourcesContent":["import {\n type ComponentPublicInstance,\n effectScope,\n inject,\n nextTick,\n provide,\n readonly,\n type Ref,\n ref,\n shallowRef,\n watch,\n} from 'vue'\nimport type {\n ComponentController,\n ControllerKey,\n OrchestratorShowOptions,\n PromiseWithController,\n} from '../../types'\nimport {BvTriggerableEvent} from '../../utils'\nimport {orchestratorRegistryKey, type OrchestratorStoreObject} from '../../utils/keys'\n\n/* oxlint-disable-next-line no-explicit-any */\n/* eslint-disable-next-line @typescript-eslint/no-explicit-any */\nexport type ValueInMapRecord<MapRecord> = MapRecord extends Map<any, infer I> ? I : never\n\nexport const buildController = <\n TComponent,\n TStore extends Readonly<Ref<OrchestratorStoreObject[keyof OrchestratorStoreObject]>>,\n>(\n id: ControllerKey,\n store: TStore\n): PromiseWithController<TComponent, ValueInMapRecord<TStore['value']>> => {\n /**\n * True from a show() request on a mounted component until the store records it as open (the\n * component reveals it) or the cycle settles. A show can still be waiting for its frame or delay\n */\n let showRequested = false\n /**\n * The cycle waiting for a show requested through the store's modelValue: the mount-time show of\n * an item that was not mounted when show() was called, or the show a mounted component starts\n * when its modelValue changes. Only that show's show-prevented event may settle it\n */\n let storeShowCycle: Dismissal | undefined\n /**\n * True from a hide request until the store's modelValue changes or the component reports hidden.\n * The store keeps recording the component as open until its hide delay has passed, so a show()\n * in that window has to reach the component to cancel the hide\n */\n let hideRequested = false\n /**\n * The last numeric modelValue the item had: a toast's countdown. The component counts it down to\n * 0, so showing the item again has to put it back. Forgotten once the item is shown with `true`\n */\n let countdown: number | undefined\n\n type Dismissal = {promise: Promise<BvTriggerableEvent>; resolve: (e: BvTriggerableEvent) => void}\n /**\n * The dismissal the current show/hide cycle is waiting for. Each cycle gets its own, so a\n * controller can be shown again after it was dismissed\n */\n let dismissal: Dismissal | undefined\n const currentDismissal = (): Dismissal => {\n if (!dismissal) {\n let resolve: (e: BvTriggerableEvent) => void = () => {}\n const promise = new Promise<BvTriggerableEvent>((r) => {\n resolve = r\n })\n dismissal = {promise, resolve}\n }\n return dismissal\n }\n\n type RefWithMethods = ComponentPublicInstance<TComponent> & {\n show?: () => unknown\n hide?: (trigger?: string, noEmit?: boolean) => void\n toggle?: () => void\n visible?: boolean\n }\n const findItem = () => store.value.get(id)\n // Detached, so the watcher lives exactly as long as the controller whether or not it was created\n // inside a component's setup. destroy() stops it\n const scope = effectScope(true)\n scope.run(() => {\n watch(\n () => findItem()?.value.props.modelValue,\n (value) => {\n hideRequested = false\n if (value) showRequested = false\n if (typeof value === 'number' && value > 0) {\n countdown = value\n } else if (value === true) {\n countdown = undefined\n }\n },\n {flush: 'sync'}\n )\n })\n\n // Backs controller.ref. It has to be reactive so awaitDismissal notices the component unmounting,\n // shallow because component instances must not be made deeply reactive\n const instance = shallowRef<RefWithMethods | null>(null)\n /**\n * Called with the component's hide, hidden or show-prevented event. Settles the current cycle\n */\n const finishCycle = (event: BvTriggerableEvent) => {\n showRequested = false\n storeShowCycle = undefined\n const current = dismissal\n dismissal = undefined\n current?.resolve(event)\n }\n const settle = (event: BvTriggerableEvent) => {\n // A component reports show-prevented for any show. It only ends the cycle waiting for a show\n // requested through the store; a prevented show() call is read from that call's own result\n if (event.eventType === 'show-prevented' && (!dismissal || storeShowCycle !== dismissal)) return\n finishCycle(event)\n // A hide event only gets here with resolveOnHide. The component is still open at this point\n hideRequested = event.eventType === 'hide'\n }\n /**\n * Shows the item by writing its modelValue. Used when there is no component show() to call, and\n * to restart a countdown, which the component only does for a numeric modelValue\n */\n const showThroughStore = (cycle: Dismissal, modelValue: true | number) => {\n storeShowCycle = cycle\n controller.set({modelValue} as never)\n // A mounted component reacts to its new modelValue in the next flush. One that has yet to\n // mount shows in its mounted hook, see the ref setter\n if (instance.value !== null) {\n void nextTick(() => {\n if (storeShowCycle === cycle) storeShowCycle = undefined\n })\n }\n }\n // The trigger of a hide() made while no component is mounted, for the event awaitDismissal makes up\n let unmountedHideTrigger: string | undefined\n\n /**\n * Resolves with the component's own event. A hidden item with no mounted component never emits\n * one: it was dismissed before it mounted, or it unmounted before its hide finished. In that case\n * it resolves on its own. Mounted items always go through the component.\n * Take the cycle before asking the component to show or hide: it may report synchronously\n */\n const awaitDismissal = async (cycle: Dismissal = currentDismissal()) => {\n let stopWatch = () => {}\n const dismissedWithoutInstance = new Promise<BvTriggerableEvent>((resolve) => {\n stopWatch = watch(\n [() => findItem()?.value.props.modelValue, instance],\n ([modelValue, mounted]) => {\n if (!modelValue && mounted === null) {\n const event = new BvTriggerableEvent('hidden', {\n trigger: unmountedHideTrigger ?? null,\n ok: null,\n })\n // Settle now, so a show() right after this can't join the finished cycle\n if (dismissal === cycle) finishCycle(event)\n resolve(event)\n }\n },\n // immediate: destroy() hides before it awaits, so the dismissal may already have happened.\n // sync: decide before the orchestrator can mount the item\n {immediate: true, flush: 'sync'}\n )\n })\n try {\n return await Promise.race([cycle.promise, dismissedWithoutInstance])\n } finally {\n stopWatch()\n }\n }\n\n const controller = {\n id,\n // A getter so the public API keeps returning the instance itself rather than the ref\n // v100 TODO: expose it as `ref: readonly(instance)`. Exposing a Ref is a breaking change, so it waits for a major\n get ref(): RefWithMethods | null {\n return instance.value\n },\n set ref(value: RefWithMethods | null) {\n instance.value = value\n // The mount-time show runs in the component's mounted hook, right after its ref is set\n if (value !== null && storeShowCycle) {\n const cycle = storeShowCycle\n void Promise.resolve().then(() => {\n if (storeShowCycle === cycle) storeShowCycle = undefined\n })\n }\n },\n async show({signal}: OrchestratorShowOptions = {}) {\n const withDispose = (event: BvTriggerableEvent) =>\n Object.assign(Object.create(event), {\n [Symbol.asyncDispose]: controller.destroy,\n })\n const currentModelValue = controller.get()?.value.props.modelValue\n // The store learns the component is open only once its show is revealed, so also count a show\n // this controller requested and the component's own visible flag\n const isShown =\n !!currentModelValue ||\n showRequested ||\n (controller.ref as RefWithMethods | null)?.visible === true\n if (signal?.aborted && !isShown) {\n return withDispose(new BvTriggerableEvent('hidden', {trigger: 'abort', ok: null}))\n }\n const cycle = currentDismissal()\n const abort = () => {\n controller.hide('abort')\n // A show listener can abort before its show is committed, when there is nothing to hide\n // yet: the mount-time show of an item that was not mounted, or a show still being\n // requested. Hide again once it had the chance to commit; a repeated hide is ignored\n void Promise.resolve().then(() => {\n if (dismissal === cycle) controller.hide('abort')\n })\n }\n signal?.addEventListener('abort', abort, {once: true})\n try {\n if (signal?.aborted) {\n abort()\n } else if (!showRequested && (!currentModelValue || hideRequested)) {\n // With hideRequested the store still records the component as open, but it may be\n // waiting out a hide. Its show() cancels that hide, and does nothing if there is none\n const cancelsHide = !!currentModelValue\n if (!cancelsHide) unmountedHideTrigger = undefined\n const refWithMethods = controller.ref\n if (!cancelsHide && countdown !== undefined) {\n showThroughStore(cycle, countdown)\n } else if (\n refWithMethods !== null &&\n 'show' in refWithMethods &&\n typeof refWithMethods.show === 'function'\n ) {\n // The store clears showRequested when it records the open, which it already has here\n if (!cancelsHide) showRequested = true\n hideRequested = false\n void Promise.resolve(refWithMethods.show()).then((result) => {\n if (result === 'show-prevented' && dismissal === cycle) {\n finishCycle(new BvTriggerableEvent('show-prevented', {ok: null}))\n }\n })\n } else if (!cancelsHide) {\n showThroughStore(cycle, true)\n }\n // A show listener may have aborted while the show was being requested, before there was\n // anything to hide. Hide now that the show is committed\n if (signal?.aborted) abort()\n }\n return withDispose(await awaitDismissal(cycle))\n } finally {\n signal?.removeEventListener('abort', abort)\n }\n },\n hide(trigger?: string) {\n const refWithMethods = controller.ref\n if (\n refWithMethods !== null &&\n 'hide' in refWithMethods &&\n typeof refWithMethods.hide === 'function'\n ) {\n // Before the call: a hide that finishes at once is recorded by the store, which clears it\n hideRequested = true\n refWithMethods.hide(trigger, true)\n } else {\n if (refWithMethods === null) unmountedHideTrigger = trigger\n controller.set({modelValue: false})\n }\n },\n toggle() {\n const currentItem = controller.get()\n const refWithMethods = controller.ref\n if (!currentItem?.value.props.modelValue && countdown !== undefined) {\n controller.set({modelValue: countdown} as never)\n } else if (\n refWithMethods !== null &&\n 'toggle' in refWithMethods &&\n typeof refWithMethods.toggle === 'function'\n ) {\n refWithMethods.toggle()\n } else {\n controller.set({modelValue: !currentItem?.value.props.modelValue})\n }\n },\n get: findItem,\n set(val: Partial<ValueInMapRecord<TStore['value']>['value']['props']>) {\n const current = findItem()\n if (current?.value) {\n current.value = {\n ...current.value,\n props: {\n ...current.value.props,\n ...val,\n /* oxlint-disable no-explicit-any */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n } as any,\n }\n }\n },\n async destroy() {\n const item = findItem()\n try {\n if (item && (item.value.props.modelValue || showRequested)) {\n const cycle = currentDismissal()\n controller.hide('destroy')\n await awaitDismissal(cycle)\n await nextTick()\n }\n } finally {\n if (item) store.value.delete(id)\n scope.stop()\n }\n },\n [Symbol.asyncDispose]() {\n return controller.destroy()\n },\n } as ComponentController<TComponent, ValueInMapRecord<TStore['value']>>\n\n return {\n controller,\n resolve: settle,\n }\n}\n\nexport const _newOrchestratorRegistry = (): {\n store: Readonly<Ref<OrchestratorStoreObject>>\n _isToastAppend: Readonly<Ref<boolean>>\n _setToastAppend: (value: boolean) => void\n _isOrchestratorInstalled: Readonly<Ref<boolean>>\n _setOrchestratorInstalled: (value: boolean) => void\n} => {\n const _isOrchestratorInstalled = ref(false)\n const _isToastAppend = ref(false)\n\n return {\n store: ref({\n modal: new Map(),\n tooltip: new Map(),\n popover: new Map(),\n toast: new Map(),\n }),\n _isOrchestratorInstalled: readonly(_isOrchestratorInstalled),\n _setOrchestratorInstalled: (v) => {\n _isOrchestratorInstalled.value = v\n },\n _isToastAppend: readonly(_isToastAppend),\n _setToastAppend: (v) => {\n _isToastAppend.value = v\n },\n }\n}\n\nexport const useOrchestratorRegistry = () => {\n const orchestratorRegistry = inject(orchestratorRegistryKey, null)\n\n if (orchestratorRegistry) {\n return orchestratorRegistry\n }\n const newOrchestratorRegistry = _newOrchestratorRegistry()\n provide(orchestratorRegistryKey, newOrchestratorRegistry)\n return newOrchestratorRegistry\n}\n\nexport const getOrchestratorControllerId = (propId: string | undefined) => {\n const id: ControllerKey = propId || Symbol('OrchestratorItem')\n\n return {\n /**\n * This id is used for stability in the store, using the createIdWatcher will update the store if the id ever changes\n */\n storeId: id,\n /**\n * Do not pass in the symbol as a prop. Html attrib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I,sBACF,OAAO;CAET,MAAM,0BAA0B,yBAAyB;CACzD,QAAQ,yBAAyB,uBAAuB;CACxD,OAAO;AACT;AAEA,IAAa,+BAA+B,WAA+B;CACzE,MAAM,KAAoB,UAAU,OAAO,kBAAkB;CAE7D,OAAO;;;;EAIL,SAAS;;;;EAIT,iBAAiB,OAAO,OAAO,WAAW,KAAK,KAAA;CACjD;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as orchestratorRegistryKey } from "../../../keys-BgLwJbLV.js";
|
|
2
2
|
import { buildController, getOrchestratorControllerId } from "../orchestratorShared/index.mjs";
|
|
3
|
-
import { n as useSharedModalStack, t as BModal_default } from "../../../BModal-
|
|
3
|
+
import { n as useSharedModalStack, t as BModal_default } from "../../../BModal-DtQlIFNn.js";
|
|
4
4
|
import { computed, getCurrentInstance, inject, markRaw, onScopeDispose, ref, toValue } from "vue";
|
|
5
5
|
//#region src/composables/useModal/index.ts
|
|
6
6
|
var useModal = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as orchestratorRegistryKey } from "../../../keys-BgLwJbLV.js";
|
|
2
2
|
import { buildController, getOrchestratorControllerId } from "../orchestratorShared/index.mjs";
|
|
3
|
-
import { u as BPopover_default } from "../../../floatingUi-
|
|
4
|
-
import { t as BTooltip_default } from "../../../BTooltip-
|
|
3
|
+
import { u as BPopover_default } from "../../../floatingUi-CSJCHfOw.js";
|
|
4
|
+
import { t as BTooltip_default } from "../../../BTooltip-CAgQ77tS.js";
|
|
5
5
|
import { computed, inject, markRaw, onScopeDispose, ref } from "vue";
|
|
6
6
|
//#region src/composables/usePopover/index.ts
|
|
7
7
|
var usePopover = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as orchestratorRegistryKey, x as showHideRegistryKey } from "../../../keys-BgLwJbLV.js";
|
|
2
2
|
import { buildController, getOrchestratorControllerId } from "../orchestratorShared/index.mjs";
|
|
3
|
-
import { t as BToast_default } from "../../../BToast-
|
|
3
|
+
import { t as BToast_default } from "../../../BToast-Cm7TZlZq.js";
|
|
4
4
|
import { computed, inject, markRaw, onScopeDispose, ref } from "vue";
|
|
5
5
|
//#region src/composables/useToast/index.ts
|
|
6
6
|
var posDefault = "top-end";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as resolveDirectiveProps } from "../../../floatingUi-
|
|
2
|
-
import { t as createFloatingDirective } from "../../../utils-
|
|
1
|
+
import { s as resolveDirectiveProps } from "../../../floatingUi-CSJCHfOw.js";
|
|
2
|
+
import { t as createFloatingDirective } from "../../../utils-DYdkCKBf.js";
|
|
3
3
|
import "vue";
|
|
4
4
|
//#region src/directives/BPopover/index.ts
|
|
5
5
|
var vBPopover = createFloatingDirective("$__popover", "BPopover", (text, defaults, binding, el) => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as getSafeDocument } from "../../../dom-BdUQrX99.js";
|
|
2
2
|
import { i as omit } from "../../../object-C7YmCGEm.js";
|
|
3
3
|
import { useScrollspy } from "../../composables/useScrollspy/index.mjs";
|
|
4
|
-
import { r as getDirectiveUid } from "../../../utils-
|
|
4
|
+
import { r as getDirectiveUid } from "../../../utils-DYdkCKBf.js";
|
|
5
5
|
import "vue";
|
|
6
6
|
//#region src/directives/BScrollspy/index.ts
|
|
7
7
|
var bind = (el, binding) => {
|
|
@@ -2,7 +2,7 @@ import { x as showHideRegistryKey } from "../../../keys-BgLwJbLV.js";
|
|
|
2
2
|
import { n as warn } from "../../../console-DaUCJgpk.js";
|
|
3
3
|
import { h as RX_SPACE_SPLIT, l as RX_HASH, u as RX_HASH_ID } from "../../../constants-Cap5sNf8.js";
|
|
4
4
|
import { t as getActiveShowHide } from "../../../registryAccess-YFj5ZD5T.js";
|
|
5
|
-
import { n as findProvides } from "../../../utils-
|
|
5
|
+
import { n as findProvides } from "../../../utils-DYdkCKBf.js";
|
|
6
6
|
import "vue";
|
|
7
7
|
//#region src/directives/BToggle/index.ts
|
|
8
8
|
var getTargets = (binding, el) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as resolveDirectiveProps } from "../../../floatingUi-
|
|
2
|
-
import { t as createFloatingDirective } from "../../../utils-
|
|
1
|
+
import { s as resolveDirectiveProps } from "../../../floatingUi-CSJCHfOw.js";
|
|
2
|
+
import { t as createFloatingDirective } from "../../../utils-DYdkCKBf.js";
|
|
3
3
|
import "vue";
|
|
4
4
|
//#region src/directives/BTooltip/index.ts
|
|
5
5
|
var vBTooltip = createFloatingDirective("$__tooltip", "BTooltip", (text, defaults, binding, el) => ({
|
package/dist/src/utils/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "../../rolldown-runtime-BBjsoOtd.js";
|
|
2
|
-
import { n as BvEvent, r as BvTriggerableEvent, t as BvCarouselEvent } from "../../classes-
|
|
2
|
+
import { n as BvEvent, r as BvTriggerableEvent, t as BvCarouselEvent } from "../../classes-DCjKFM2E.js";
|
|
3
3
|
//#region src/utils/index.ts
|
|
4
4
|
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
BvCarouselEvent: () => BvCarouselEvent,
|
|
@@ -10,10 +10,17 @@ export type CamelCase<S extends string> = S extends `${infer P1}-${infer P2}${in
|
|
|
10
10
|
export type OrchestratorCreateOptions = {
|
|
11
11
|
resolveOnHide?: boolean;
|
|
12
12
|
};
|
|
13
|
+
export type OrchestratorShowOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* Hides the component with the trigger `'abort'` when aborted. If it is already aborted, the
|
|
16
|
+
* component is not shown and the promise resolves right away
|
|
17
|
+
*/
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
};
|
|
13
20
|
export interface ComponentController<Component, Props extends Ref<OrchestratorArrayValue>> extends AsyncDisposable {
|
|
14
21
|
id: ControllerKey;
|
|
15
22
|
ref: ComponentPublicInstance<Component> | null;
|
|
16
|
-
show: () => Promise<BvTriggerableEvent & AsyncDisposable>;
|
|
23
|
+
show: (options?: OrchestratorShowOptions) => Promise<BvTriggerableEvent & AsyncDisposable>;
|
|
17
24
|
hide: (trigger?: string) => void;
|
|
18
25
|
toggle: () => void;
|
|
19
26
|
set: (val: Partial<Props['value']['props']>) => void;
|
|
@@ -10,10 +10,17 @@ export type CamelCase<S extends string> = S extends `${infer P1}-${infer P2}${in
|
|
|
10
10
|
export type OrchestratorCreateOptions = {
|
|
11
11
|
resolveOnHide?: boolean;
|
|
12
12
|
};
|
|
13
|
+
export type OrchestratorShowOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* Hides the component with the trigger `'abort'` when aborted. If it is already aborted, the
|
|
16
|
+
* component is not shown and the promise resolves right away
|
|
17
|
+
*/
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
};
|
|
13
20
|
export interface ComponentController<Component, Props extends Ref<OrchestratorArrayValue>> extends AsyncDisposable {
|
|
14
21
|
id: ControllerKey;
|
|
15
22
|
ref: ComponentPublicInstance<Component> | null;
|
|
16
|
-
show: () => Promise<BvTriggerableEvent & AsyncDisposable>;
|
|
23
|
+
show: (options?: OrchestratorShowOptions) => Promise<BvTriggerableEvent & AsyncDisposable>;
|
|
17
24
|
hide: (trigger?: string) => void;
|
|
18
25
|
toggle: () => void;
|
|
19
26
|
set: (val: Partial<Props['value']['props']>) => void;
|