diff --git a/src/components/layout/Collapsible.vue b/src/components/layout/Collapsible.vue new file mode 100644 index 0000000..a9554cc --- /dev/null +++ b/src/components/layout/Collapsible.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/src/util/vue.tsx b/src/util/vue.tsx index f11e63f..7606e55 100644 --- a/src/util/vue.tsx +++ b/src/util/vue.tsx @@ -5,7 +5,8 @@ import { Component as ComponentKey, GatherProps, GenericComponent, - JSXFunction + JSXFunction, + Visibility } from "features/feature"; import { Component, @@ -121,6 +122,21 @@ export function setupHoldToClick( return { start, stop, handleHolding }; } +export function getFirstFeature }>( + features: T[], + filter: (feature: T) => boolean +): { firstFeature: Ref; hiddenFeatures: Ref } { + const filteredFeatures = computed(() => + features.filter( + feature => unref(feature.visibility) === Visibility.Visible && filter(feature) + ) + ); + return { + firstFeature: computed(() => filteredFeatures.value[0]), + hiddenFeatures: computed(() => filteredFeatures.value.slice(1)) + }; +} + export function computeComponent( component: Ref>, defaultWrapper = "div"