@morscherlab/mint-sdk 1.0.0-beta.4 → 1.0.0-beta.6
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/components/AppSidebar.vue.d.ts +1 -1
- package/dist/components/index.js +2 -2
- package/dist/{components-BkGF4B4y.js → components-DihbSJjU.js} +2524 -2517
- package/dist/components-DihbSJjU.js.map +1 -0
- package/dist/composables/index.js +3 -3
- package/dist/{composables-CHsME9H1.js → composables-BcgZ6diz.js} +2 -2
- package/dist/{composables-CHsME9H1.js.map → composables-BcgZ6diz.js.map} +1 -1
- package/dist/index.js +5 -5
- package/dist/install.js +2 -2
- package/dist/styles.css +738 -738
- package/dist/templates/adapters.d.ts +7 -1
- package/dist/templates/catalog.d.ts +5 -5
- package/dist/templates/index.d.ts +2 -2
- package/dist/templates/index.js +2 -2
- package/dist/templates/presets.d.ts +4 -4
- package/dist/templates/types.d.ts +4 -1
- package/dist/{templates-B5jmTWuk.js → templates-Cyt0Suwf.js} +213 -19
- package/dist/{templates-B5jmTWuk.js.map → templates-Cyt0Suwf.js.map} +1 -1
- package/dist/{useScheduleDrag-BgzpQT53.js → useExperimentData-CM6Y0u5L.js} +183 -183
- package/dist/useExperimentData-CM6Y0u5L.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/components/AppSidebar.test.ts +4 -2
- package/src/__tests__/components/AppTopBar.test.ts +9 -3
- package/src/__tests__/components/{AppPageSelector.test.ts → AppTopBarPageSelector.test.ts} +8 -8
- package/src/__tests__/components/{AppPillNav.test.ts → AppTopBarPillNav.test.ts} +7 -7
- package/src/__tests__/components/BioTemplatePackWorkspaceView.test.ts +17 -0
- package/src/__tests__/components/BioTemplatePresetWorkspaceView.test.ts +22 -0
- package/src/__tests__/components/BioTemplateRenderer.test.ts +25 -0
- package/src/__tests__/components/ComponentBindingRenderer.test.ts +117 -0
- package/src/__tests__/composables/useBioTemplatePackWorkspace.test.ts +1 -1
- package/src/__tests__/composables/useBioTemplatePresetWorkspace.test.ts +1 -1
- package/src/__tests__/composables/useControlSchema.test.ts +1 -1
- package/src/__tests__/templates/templates.test.ts +44 -0
- package/src/components/AppSidebar.vue +3 -3
- package/src/components/AppTopBar.vue +7 -7
- package/src/components/BioTemplatePresetWorkspaceView.vue +3 -3
- package/src/components/BioTemplateRenderer.story.vue +2 -2
- package/src/components/ComponentBindingRenderer.story.vue +30 -0
- package/src/components/ComponentBindingRenderer.vue +9 -0
- package/src/components/ExperimentPopover.story.vue +2 -2
- package/src/styles/components/app-page-selector.css +1 -1
- package/src/styles/components/app-pill-nav.css +1 -1
- package/src/styles/components/experiment-popover.css +2 -2
- package/src/templates/adapters.ts +193 -0
- package/src/templates/catalog.ts +5 -5
- package/src/templates/componentBindings.ts +52 -3
- package/src/templates/index.ts +6 -0
- package/src/templates/packs.ts +10 -1
- package/src/templates/presets.ts +14 -4
- package/src/templates/types.ts +4 -0
- package/dist/components-BkGF4B4y.js.map +0 -1
- package/dist/useScheduleDrag-BgzpQT53.js.map +0 -1
- /package/dist/__tests__/components/{AppPageSelector.test.d.ts → AppTopBarPageSelector.test.d.ts} +0 -0
- /package/dist/__tests__/components/{AppPillNav.test.d.ts → AppTopBarPillNav.test.d.ts} +0 -0
- /package/dist/components/internal/{AppPageSelectorInternal.vue.d.ts → AppTopBarPageSelectorInternal.vue.d.ts} +0 -0
- /package/dist/components/internal/{AppPillNavInternal.vue.d.ts → AppTopBarPillNavInternal.vue.d.ts} +0 -0
- /package/src/components/internal/{AppPageSelectorInternal.vue → AppTopBarPageSelectorInternal.vue} +0 -0
- /package/src/components/internal/{AppPillNavInternal.vue → AppTopBarPillNavInternal.vue} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bn as useConcentrationUnits, Bt as extractTemplateCollection, Fn as useControlWorkspace, In as getFieldRegistryEntry, Ln as getTypeDefault, Nt as createTemplateCollection, _ as toBioTemplateComponentPropsByComponent$1, _t as createBioTemplatePresetCollectionFromControls, an as getBioTemplatePackInfo, b as toBioTemplateComponentUsage, d as getBioTemplateComponentProps$1, g as toBioTemplateComponentProps, gt as createBioTemplatePresetCollection, h as toBioTemplateComponentImports, ht as createBioTemplatePackCollection, i as createBioTemplateControlToolkit, m as toBioTemplateComponentBindingsById, p as toBioTemplateComponentBindings, tn as getBioTemplatePresetInfo, u as getBioTemplateComponentBindings, v as toBioTemplateComponentPropsById, y as toBioTemplateComponentSnippets, zt as ensureTemplateFromCollection } from "./templates-Cyt0Suwf.js";
|
|
2
2
|
import { r as useSettingsStore, t as useAuthStore } from "./auth-QQj2kkze.js";
|
|
3
3
|
import { computed, effectScope, getCurrentScope, onMounted, onScopeDispose, onUnmounted, provide, reactive, readonly, ref, shallowRef, toRaw, toValue, watch } from "vue";
|
|
4
4
|
import axios from "axios";
|
|
@@ -2709,6 +2709,186 @@ function normalizeIds(ids) {
|
|
|
2709
2709
|
return [...new Set(ids.filter(Boolean))];
|
|
2710
2710
|
}
|
|
2711
2711
|
//#endregion
|
|
2712
|
+
//#region src/composables/useScheduleDrag.ts
|
|
2713
|
+
/** Handles pointer-driven create, move, and resize drag interactions for the ScheduleCalendar grid. */
|
|
2714
|
+
function useScheduleDrag(options) {
|
|
2715
|
+
const isDragging = ref(false);
|
|
2716
|
+
const dragState = ref(null);
|
|
2717
|
+
const ghost = computed(() => {
|
|
2718
|
+
if (!dragState.value) return null;
|
|
2719
|
+
const state = dragState.value;
|
|
2720
|
+
const slotH = options.slotHeight.value;
|
|
2721
|
+
const slotMin = options.slotDuration.value;
|
|
2722
|
+
const dayStart = options.dayStartHour.value * 60;
|
|
2723
|
+
if (state.type === "create") {
|
|
2724
|
+
const deltaY = state.currentY - state.startY;
|
|
2725
|
+
const startOffset = state.startY;
|
|
2726
|
+
const endOffset = startOffset + deltaY;
|
|
2727
|
+
const topPx = Math.min(startOffset, endOffset);
|
|
2728
|
+
const bottomPx = Math.max(startOffset, endOffset);
|
|
2729
|
+
const startMinutes = dayStart + Math.round(topPx / slotH * slotMin);
|
|
2730
|
+
const endMinutes = dayStart + Math.round(bottomPx / slotH * slotMin);
|
|
2731
|
+
const snappedStart = snapMinutes(startMinutes, slotMin);
|
|
2732
|
+
const snappedEnd = Math.max(snapMinutes(endMinutes, slotMin), snappedStart + slotMin);
|
|
2733
|
+
const snappedTopPx = (snappedStart - dayStart) / slotMin * slotH;
|
|
2734
|
+
const snappedHeightPx = (snappedEnd - snappedStart) / slotMin * slotH;
|
|
2735
|
+
return {
|
|
2736
|
+
start: minutesToDate(state.startDate, snappedStart),
|
|
2737
|
+
end: minutesToDate(state.startDate, snappedEnd),
|
|
2738
|
+
dayIndex: state.dayIndex,
|
|
2739
|
+
style: {
|
|
2740
|
+
top: `${snappedTopPx}px`,
|
|
2741
|
+
height: `${snappedHeightPx}px`
|
|
2742
|
+
}
|
|
2743
|
+
};
|
|
2744
|
+
}
|
|
2745
|
+
if (state.type === "move" && state.event) {
|
|
2746
|
+
const deltaY = state.currentY - state.startY;
|
|
2747
|
+
const eventStart = dateToMinutes(new Date(state.event.start));
|
|
2748
|
+
const duration = dateToMinutes(new Date(state.event.end)) - eventStart;
|
|
2749
|
+
const newStart = snapMinutes(eventStart + Math.round(deltaY / slotH * slotMin), slotMin);
|
|
2750
|
+
const clamped = clampRange(newStart, newStart + duration, dayStart, options.dayEndHour.value * 60);
|
|
2751
|
+
const topPx = (clamped.start - dayStart) / slotMin * slotH;
|
|
2752
|
+
const heightPx = (clamped.end - clamped.start) / slotMin * slotH;
|
|
2753
|
+
return {
|
|
2754
|
+
start: minutesToDate(state.startDate, clamped.start),
|
|
2755
|
+
end: minutesToDate(state.startDate, clamped.end),
|
|
2756
|
+
dayIndex: state.currentDayIndex,
|
|
2757
|
+
style: {
|
|
2758
|
+
top: `${topPx}px`,
|
|
2759
|
+
height: `${heightPx}px`
|
|
2760
|
+
}
|
|
2761
|
+
};
|
|
2762
|
+
}
|
|
2763
|
+
if ((state.type === "resize-top" || state.type === "resize-bottom") && state.event) {
|
|
2764
|
+
const eventStart = dateToMinutes(new Date(state.event.start));
|
|
2765
|
+
const eventEnd = dateToMinutes(new Date(state.event.end));
|
|
2766
|
+
const deltaY = state.currentY - state.startY;
|
|
2767
|
+
const pixelDelta = Math.round(deltaY / slotH * slotMin);
|
|
2768
|
+
let newStart = eventStart;
|
|
2769
|
+
let newEnd = eventEnd;
|
|
2770
|
+
if (state.type === "resize-top") {
|
|
2771
|
+
newStart = snapMinutes(eventStart + pixelDelta, slotMin);
|
|
2772
|
+
newStart = Math.min(newStart, newEnd - slotMin);
|
|
2773
|
+
} else {
|
|
2774
|
+
newEnd = snapMinutes(eventEnd + pixelDelta, slotMin);
|
|
2775
|
+
newEnd = Math.max(newEnd, newStart + slotMin);
|
|
2776
|
+
}
|
|
2777
|
+
const clamped = clampRange(newStart, newEnd, dayStart, options.dayEndHour.value * 60);
|
|
2778
|
+
const topPx = (clamped.start - dayStart) / slotMin * slotH;
|
|
2779
|
+
const heightPx = (clamped.end - clamped.start) / slotMin * slotH;
|
|
2780
|
+
return {
|
|
2781
|
+
start: minutesToDate(state.startDate, clamped.start),
|
|
2782
|
+
end: minutesToDate(state.startDate, clamped.end),
|
|
2783
|
+
dayIndex: state.dayIndex,
|
|
2784
|
+
style: {
|
|
2785
|
+
top: `${topPx}px`,
|
|
2786
|
+
height: `${heightPx}px`
|
|
2787
|
+
}
|
|
2788
|
+
};
|
|
2789
|
+
}
|
|
2790
|
+
return null;
|
|
2791
|
+
});
|
|
2792
|
+
function startCreate(date, y, dayIndex) {
|
|
2793
|
+
if (options.readonly.value) return;
|
|
2794
|
+
isDragging.value = true;
|
|
2795
|
+
dragState.value = {
|
|
2796
|
+
type: "create",
|
|
2797
|
+
startDate: date,
|
|
2798
|
+
startY: y,
|
|
2799
|
+
currentY: y,
|
|
2800
|
+
dayIndex,
|
|
2801
|
+
currentDayIndex: dayIndex
|
|
2802
|
+
};
|
|
2803
|
+
addListeners();
|
|
2804
|
+
}
|
|
2805
|
+
function startMove(event, y, dayIndex) {
|
|
2806
|
+
if (options.readonly.value || event.draggable === false) return;
|
|
2807
|
+
isDragging.value = true;
|
|
2808
|
+
dragState.value = {
|
|
2809
|
+
type: "move",
|
|
2810
|
+
event,
|
|
2811
|
+
startDate: new Date(event.start),
|
|
2812
|
+
startY: y,
|
|
2813
|
+
currentY: y,
|
|
2814
|
+
dayIndex,
|
|
2815
|
+
currentDayIndex: dayIndex
|
|
2816
|
+
};
|
|
2817
|
+
addListeners();
|
|
2818
|
+
}
|
|
2819
|
+
function startResize(event, edge, y, dayIndex) {
|
|
2820
|
+
if (options.readonly.value || event.resizable === false) return;
|
|
2821
|
+
isDragging.value = true;
|
|
2822
|
+
dragState.value = {
|
|
2823
|
+
type: edge === "top" ? "resize-top" : "resize-bottom",
|
|
2824
|
+
event,
|
|
2825
|
+
startDate: new Date(event.start),
|
|
2826
|
+
startY: y,
|
|
2827
|
+
currentY: y,
|
|
2828
|
+
dayIndex,
|
|
2829
|
+
currentDayIndex: dayIndex
|
|
2830
|
+
};
|
|
2831
|
+
addListeners();
|
|
2832
|
+
}
|
|
2833
|
+
function onPointerMove(e) {
|
|
2834
|
+
if (!dragState.value) return;
|
|
2835
|
+
dragState.value = {
|
|
2836
|
+
...dragState.value,
|
|
2837
|
+
currentY: e.clientY
|
|
2838
|
+
};
|
|
2839
|
+
}
|
|
2840
|
+
function onPointerUp() {
|
|
2841
|
+
if (!dragState.value || !ghost.value) {
|
|
2842
|
+
cleanup();
|
|
2843
|
+
return;
|
|
2844
|
+
}
|
|
2845
|
+
const g = ghost.value;
|
|
2846
|
+
const state = dragState.value;
|
|
2847
|
+
if (state.type === "create" && options.onCreateComplete) options.onCreateComplete(g.start, g.end);
|
|
2848
|
+
else if (state.type === "move" && state.event && options.onMoveComplete) options.onMoveComplete(state.event, g.start, g.end);
|
|
2849
|
+
else if ((state.type === "resize-top" || state.type === "resize-bottom") && state.event && options.onResizeComplete) options.onResizeComplete(state.event, g.start, g.end);
|
|
2850
|
+
cleanup();
|
|
2851
|
+
}
|
|
2852
|
+
function addListeners() {
|
|
2853
|
+
document.addEventListener("pointermove", onPointerMove);
|
|
2854
|
+
document.addEventListener("pointerup", onPointerUp);
|
|
2855
|
+
}
|
|
2856
|
+
function cleanup() {
|
|
2857
|
+
isDragging.value = false;
|
|
2858
|
+
dragState.value = null;
|
|
2859
|
+
document.removeEventListener("pointermove", onPointerMove);
|
|
2860
|
+
document.removeEventListener("pointerup", onPointerUp);
|
|
2861
|
+
}
|
|
2862
|
+
onUnmounted(cleanup);
|
|
2863
|
+
return {
|
|
2864
|
+
isDragging,
|
|
2865
|
+
dragState,
|
|
2866
|
+
ghost,
|
|
2867
|
+
startCreate,
|
|
2868
|
+
startMove,
|
|
2869
|
+
startResize
|
|
2870
|
+
};
|
|
2871
|
+
}
|
|
2872
|
+
function snapMinutes(minutes, step) {
|
|
2873
|
+
return Math.round(minutes / step) * step;
|
|
2874
|
+
}
|
|
2875
|
+
function dateToMinutes(date) {
|
|
2876
|
+
return date.getHours() * 60 + date.getMinutes();
|
|
2877
|
+
}
|
|
2878
|
+
function minutesToDate(baseDate, minutes) {
|
|
2879
|
+
const d = new Date(baseDate);
|
|
2880
|
+
d.setHours(Math.floor(minutes / 60), minutes % 60, 0, 0);
|
|
2881
|
+
return d;
|
|
2882
|
+
}
|
|
2883
|
+
function clampRange(start, end, min, max) {
|
|
2884
|
+
const s = Math.max(start, min);
|
|
2885
|
+
const e = Math.min(end, max);
|
|
2886
|
+
return {
|
|
2887
|
+
start: s,
|
|
2888
|
+
end: Math.max(e, s)
|
|
2889
|
+
};
|
|
2890
|
+
}
|
|
2891
|
+
//#endregion
|
|
2712
2892
|
//#region src/composables/platformContextHelpers.ts
|
|
2713
2893
|
function getInjectedPlatformContext() {
|
|
2714
2894
|
if (typeof window === "undefined") return void 0;
|
|
@@ -4229,186 +4409,6 @@ function useExperimentData(options = {}) {
|
|
|
4229
4409
|
};
|
|
4230
4410
|
}
|
|
4231
4411
|
//#endregion
|
|
4232
|
-
|
|
4233
|
-
/** Handles pointer-driven create, move, and resize drag interactions for the ScheduleCalendar grid. */
|
|
4234
|
-
function useScheduleDrag(options) {
|
|
4235
|
-
const isDragging = ref(false);
|
|
4236
|
-
const dragState = ref(null);
|
|
4237
|
-
const ghost = computed(() => {
|
|
4238
|
-
if (!dragState.value) return null;
|
|
4239
|
-
const state = dragState.value;
|
|
4240
|
-
const slotH = options.slotHeight.value;
|
|
4241
|
-
const slotMin = options.slotDuration.value;
|
|
4242
|
-
const dayStart = options.dayStartHour.value * 60;
|
|
4243
|
-
if (state.type === "create") {
|
|
4244
|
-
const deltaY = state.currentY - state.startY;
|
|
4245
|
-
const startOffset = state.startY;
|
|
4246
|
-
const endOffset = startOffset + deltaY;
|
|
4247
|
-
const topPx = Math.min(startOffset, endOffset);
|
|
4248
|
-
const bottomPx = Math.max(startOffset, endOffset);
|
|
4249
|
-
const startMinutes = dayStart + Math.round(topPx / slotH * slotMin);
|
|
4250
|
-
const endMinutes = dayStart + Math.round(bottomPx / slotH * slotMin);
|
|
4251
|
-
const snappedStart = snapMinutes(startMinutes, slotMin);
|
|
4252
|
-
const snappedEnd = Math.max(snapMinutes(endMinutes, slotMin), snappedStart + slotMin);
|
|
4253
|
-
const snappedTopPx = (snappedStart - dayStart) / slotMin * slotH;
|
|
4254
|
-
const snappedHeightPx = (snappedEnd - snappedStart) / slotMin * slotH;
|
|
4255
|
-
return {
|
|
4256
|
-
start: minutesToDate(state.startDate, snappedStart),
|
|
4257
|
-
end: minutesToDate(state.startDate, snappedEnd),
|
|
4258
|
-
dayIndex: state.dayIndex,
|
|
4259
|
-
style: {
|
|
4260
|
-
top: `${snappedTopPx}px`,
|
|
4261
|
-
height: `${snappedHeightPx}px`
|
|
4262
|
-
}
|
|
4263
|
-
};
|
|
4264
|
-
}
|
|
4265
|
-
if (state.type === "move" && state.event) {
|
|
4266
|
-
const deltaY = state.currentY - state.startY;
|
|
4267
|
-
const eventStart = dateToMinutes(new Date(state.event.start));
|
|
4268
|
-
const duration = dateToMinutes(new Date(state.event.end)) - eventStart;
|
|
4269
|
-
const newStart = snapMinutes(eventStart + Math.round(deltaY / slotH * slotMin), slotMin);
|
|
4270
|
-
const clamped = clampRange(newStart, newStart + duration, dayStart, options.dayEndHour.value * 60);
|
|
4271
|
-
const topPx = (clamped.start - dayStart) / slotMin * slotH;
|
|
4272
|
-
const heightPx = (clamped.end - clamped.start) / slotMin * slotH;
|
|
4273
|
-
return {
|
|
4274
|
-
start: minutesToDate(state.startDate, clamped.start),
|
|
4275
|
-
end: minutesToDate(state.startDate, clamped.end),
|
|
4276
|
-
dayIndex: state.currentDayIndex,
|
|
4277
|
-
style: {
|
|
4278
|
-
top: `${topPx}px`,
|
|
4279
|
-
height: `${heightPx}px`
|
|
4280
|
-
}
|
|
4281
|
-
};
|
|
4282
|
-
}
|
|
4283
|
-
if ((state.type === "resize-top" || state.type === "resize-bottom") && state.event) {
|
|
4284
|
-
const eventStart = dateToMinutes(new Date(state.event.start));
|
|
4285
|
-
const eventEnd = dateToMinutes(new Date(state.event.end));
|
|
4286
|
-
const deltaY = state.currentY - state.startY;
|
|
4287
|
-
const pixelDelta = Math.round(deltaY / slotH * slotMin);
|
|
4288
|
-
let newStart = eventStart;
|
|
4289
|
-
let newEnd = eventEnd;
|
|
4290
|
-
if (state.type === "resize-top") {
|
|
4291
|
-
newStart = snapMinutes(eventStart + pixelDelta, slotMin);
|
|
4292
|
-
newStart = Math.min(newStart, newEnd - slotMin);
|
|
4293
|
-
} else {
|
|
4294
|
-
newEnd = snapMinutes(eventEnd + pixelDelta, slotMin);
|
|
4295
|
-
newEnd = Math.max(newEnd, newStart + slotMin);
|
|
4296
|
-
}
|
|
4297
|
-
const clamped = clampRange(newStart, newEnd, dayStart, options.dayEndHour.value * 60);
|
|
4298
|
-
const topPx = (clamped.start - dayStart) / slotMin * slotH;
|
|
4299
|
-
const heightPx = (clamped.end - clamped.start) / slotMin * slotH;
|
|
4300
|
-
return {
|
|
4301
|
-
start: minutesToDate(state.startDate, clamped.start),
|
|
4302
|
-
end: minutesToDate(state.startDate, clamped.end),
|
|
4303
|
-
dayIndex: state.dayIndex,
|
|
4304
|
-
style: {
|
|
4305
|
-
top: `${topPx}px`,
|
|
4306
|
-
height: `${heightPx}px`
|
|
4307
|
-
}
|
|
4308
|
-
};
|
|
4309
|
-
}
|
|
4310
|
-
return null;
|
|
4311
|
-
});
|
|
4312
|
-
function startCreate(date, y, dayIndex) {
|
|
4313
|
-
if (options.readonly.value) return;
|
|
4314
|
-
isDragging.value = true;
|
|
4315
|
-
dragState.value = {
|
|
4316
|
-
type: "create",
|
|
4317
|
-
startDate: date,
|
|
4318
|
-
startY: y,
|
|
4319
|
-
currentY: y,
|
|
4320
|
-
dayIndex,
|
|
4321
|
-
currentDayIndex: dayIndex
|
|
4322
|
-
};
|
|
4323
|
-
addListeners();
|
|
4324
|
-
}
|
|
4325
|
-
function startMove(event, y, dayIndex) {
|
|
4326
|
-
if (options.readonly.value || event.draggable === false) return;
|
|
4327
|
-
isDragging.value = true;
|
|
4328
|
-
dragState.value = {
|
|
4329
|
-
type: "move",
|
|
4330
|
-
event,
|
|
4331
|
-
startDate: new Date(event.start),
|
|
4332
|
-
startY: y,
|
|
4333
|
-
currentY: y,
|
|
4334
|
-
dayIndex,
|
|
4335
|
-
currentDayIndex: dayIndex
|
|
4336
|
-
};
|
|
4337
|
-
addListeners();
|
|
4338
|
-
}
|
|
4339
|
-
function startResize(event, edge, y, dayIndex) {
|
|
4340
|
-
if (options.readonly.value || event.resizable === false) return;
|
|
4341
|
-
isDragging.value = true;
|
|
4342
|
-
dragState.value = {
|
|
4343
|
-
type: edge === "top" ? "resize-top" : "resize-bottom",
|
|
4344
|
-
event,
|
|
4345
|
-
startDate: new Date(event.start),
|
|
4346
|
-
startY: y,
|
|
4347
|
-
currentY: y,
|
|
4348
|
-
dayIndex,
|
|
4349
|
-
currentDayIndex: dayIndex
|
|
4350
|
-
};
|
|
4351
|
-
addListeners();
|
|
4352
|
-
}
|
|
4353
|
-
function onPointerMove(e) {
|
|
4354
|
-
if (!dragState.value) return;
|
|
4355
|
-
dragState.value = {
|
|
4356
|
-
...dragState.value,
|
|
4357
|
-
currentY: e.clientY
|
|
4358
|
-
};
|
|
4359
|
-
}
|
|
4360
|
-
function onPointerUp() {
|
|
4361
|
-
if (!dragState.value || !ghost.value) {
|
|
4362
|
-
cleanup();
|
|
4363
|
-
return;
|
|
4364
|
-
}
|
|
4365
|
-
const g = ghost.value;
|
|
4366
|
-
const state = dragState.value;
|
|
4367
|
-
if (state.type === "create" && options.onCreateComplete) options.onCreateComplete(g.start, g.end);
|
|
4368
|
-
else if (state.type === "move" && state.event && options.onMoveComplete) options.onMoveComplete(state.event, g.start, g.end);
|
|
4369
|
-
else if ((state.type === "resize-top" || state.type === "resize-bottom") && state.event && options.onResizeComplete) options.onResizeComplete(state.event, g.start, g.end);
|
|
4370
|
-
cleanup();
|
|
4371
|
-
}
|
|
4372
|
-
function addListeners() {
|
|
4373
|
-
document.addEventListener("pointermove", onPointerMove);
|
|
4374
|
-
document.addEventListener("pointerup", onPointerUp);
|
|
4375
|
-
}
|
|
4376
|
-
function cleanup() {
|
|
4377
|
-
isDragging.value = false;
|
|
4378
|
-
dragState.value = null;
|
|
4379
|
-
document.removeEventListener("pointermove", onPointerMove);
|
|
4380
|
-
document.removeEventListener("pointerup", onPointerUp);
|
|
4381
|
-
}
|
|
4382
|
-
onUnmounted(cleanup);
|
|
4383
|
-
return {
|
|
4384
|
-
isDragging,
|
|
4385
|
-
dragState,
|
|
4386
|
-
ghost,
|
|
4387
|
-
startCreate,
|
|
4388
|
-
startMove,
|
|
4389
|
-
startResize
|
|
4390
|
-
};
|
|
4391
|
-
}
|
|
4392
|
-
function snapMinutes(minutes, step) {
|
|
4393
|
-
return Math.round(minutes / step) * step;
|
|
4394
|
-
}
|
|
4395
|
-
function dateToMinutes(date) {
|
|
4396
|
-
return date.getHours() * 60 + date.getMinutes();
|
|
4397
|
-
}
|
|
4398
|
-
function minutesToDate(baseDate, minutes) {
|
|
4399
|
-
const d = new Date(baseDate);
|
|
4400
|
-
d.setHours(Math.floor(minutes / 60), minutes % 60, 0, 0);
|
|
4401
|
-
return d;
|
|
4402
|
-
}
|
|
4403
|
-
function clampRange(start, end, min, max) {
|
|
4404
|
-
const s = Math.max(start, min);
|
|
4405
|
-
const e = Math.min(end, max);
|
|
4406
|
-
return {
|
|
4407
|
-
start: s,
|
|
4408
|
-
end: Math.max(e, s)
|
|
4409
|
-
};
|
|
4410
|
-
}
|
|
4411
|
-
//#endregion
|
|
4412
|
-
export { useTheme as $, useAutoGroup as A, DATE_PRESET_OPTIONS as B, useSampleGroups as C, DEFAULT_COLORS as D, hslToHex as E, usePlatformContext as F, datePresetToISO as G, EXPERIMENT_STATUS_OPTIONS as H, useExperimentSelector as I, getExperimentStatusVariant as J, formatExperimentDate as K, useRequestSyncState as L, useDoseCalculator as M, APP_EXPERIMENT_KEY as N, extractSamplesFromDesignData as O, useAppExperiment as P, useForm as Q, useDebouncedWatch as R, useExpansionSet as S, hexToHsl as T, EXPERIMENT_STATUS_VARIANT_MAP as U, EXPERIMENT_STATUS_LABELS as V, SORT_OPTIONS as W, evaluateCondition as X, resolveExperimentCode as Y, useFormBuilder as Z, useTemplateCollection as _, DEFAULT_UNITS as a, useSortedItems as at, getInjectedPlatformContext as b, useGroupAssignment as c, useBioTemplatePackWorkspace as d, useToast as et, useBioTemplateWorkspace as f, useBioTemplateControls as g, useBioTemplateComponents as h, DEFAULT_PRESETS as i, compareSortValues as it, useWellPlateEditor as j, parseCSV as k, useRackEditor as l, toBioTemplateComponentPropsByComponent as m, useExperimentData as n, normalizeSearchQuery as nt, generateDilutionSeries as o, getBioTemplateComponentProps as p, formatExperimentStatus as q, useProtocolTemplates as r, useTextSearch as rt, useReagentSeries as s, useScheduleDrag as t, candidateMatchesSearch as tt, useBioTemplatePresetWorkspace as u, useExperimentSave as v, deriveShade as w, resolveCurrentExperimentId as x, currentExperimentFromContext as y, useApi as z };
|
|
4412
|
+
export { useTheme as $, useAutoGroup as A, DATE_PRESET_OPTIONS as B, useSampleGroups as C, DEFAULT_COLORS as D, hslToHex as E, usePlatformContext as F, datePresetToISO as G, EXPERIMENT_STATUS_OPTIONS as H, useExperimentSelector as I, getExperimentStatusVariant as J, formatExperimentDate as K, useRequestSyncState as L, useDoseCalculator as M, APP_EXPERIMENT_KEY as N, extractSamplesFromDesignData as O, useAppExperiment as P, useForm as Q, useDebouncedWatch as R, useExpansionSet as S, hexToHsl as T, EXPERIMENT_STATUS_VARIANT_MAP as U, EXPERIMENT_STATUS_LABELS as V, SORT_OPTIONS as W, evaluateCondition as X, resolveExperimentCode as Y, useFormBuilder as Z, useExperimentSave as _, generateDilutionSeries as a, useSortedItems as at, resolveCurrentExperimentId as b, useRackEditor as c, useBioTemplateWorkspace as d, useToast as et, getBioTemplateComponentProps as f, useTemplateCollection as g, useBioTemplateControls as h, DEFAULT_UNITS as i, compareSortValues as it, useWellPlateEditor as j, parseCSV as k, useBioTemplatePresetWorkspace as l, useBioTemplateComponents as m, useProtocolTemplates as n, normalizeSearchQuery as nt, useReagentSeries as o, toBioTemplateComponentPropsByComponent as p, formatExperimentStatus as q, DEFAULT_PRESETS as r, useTextSearch as rt, useGroupAssignment as s, useExperimentData as t, candidateMatchesSearch as tt, useBioTemplatePackWorkspace as u, currentExperimentFromContext as v, deriveShade as w, useScheduleDrag as x, getInjectedPlatformContext as y, useApi as z };
|
|
4413
4413
|
|
|
4414
|
-
//# sourceMappingURL=
|
|
4414
|
+
//# sourceMappingURL=useExperimentData-CM6Y0u5L.js.map
|