rimelight-components 2.1.34 → 2.1.35
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/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/app/HeaderLayer.vue +4 -3
- package/dist/runtime/composables/useHeaderStack.d.ts +3 -2
- package/dist/runtime/composables/useHeaderStack.js +25 -9
- package/dist/runtime/composables/useHeaderStack.mjs +25 -9
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { readdirSync } from 'node:fs';
|
|
|
4
4
|
import { basename } from 'node:path';
|
|
5
5
|
|
|
6
6
|
const name = "rimelight-components";
|
|
7
|
-
const version = "2.1.
|
|
7
|
+
const version = "2.1.35";
|
|
8
8
|
const homepage = "https://rimelight.com/tools/rimelight-components";
|
|
9
9
|
|
|
10
10
|
const defaultOptions = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, onMounted, onUnmounted, watch, computed, nextTick } from "vue";
|
|
2
|
+
import { ref, onMounted, onUnmounted, watch, computed, nextTick, provide } from "vue";
|
|
3
3
|
import { useHeaderStack, useRC } from "../../composables";
|
|
4
4
|
import { useWindowScroll } from "@vueuse/core";
|
|
5
5
|
import { tv } from "../../internal/tv";
|
|
@@ -19,13 +19,14 @@ const headerLayerStyles = tv({
|
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
const { root, content } = headerLayerStyles();
|
|
22
|
-
const { registerHeader, unregisterHeader,
|
|
22
|
+
const { registerHeader, unregisterHeader, offsets } = useHeaderStack();
|
|
23
|
+
provide("header_layer_id", id);
|
|
23
24
|
const { y: scrollY } = useWindowScroll();
|
|
24
25
|
const contentRef = ref(null);
|
|
25
26
|
const isVisible = ref(true);
|
|
26
27
|
const lastScrollY = ref(0);
|
|
27
28
|
const naturalHeight = ref(0);
|
|
28
|
-
const topOffset = computed(() =>
|
|
29
|
+
const topOffset = computed(() => offsets.value[id] ?? 0);
|
|
29
30
|
watch(scrollY, (current) => {
|
|
30
31
|
if (!hideOnScroll) return;
|
|
31
32
|
const diff = current - lastScrollY.value;
|
|
@@ -6,8 +6,9 @@ interface HeaderLayer {
|
|
|
6
6
|
export declare const useHeaderStack: () => {
|
|
7
7
|
registerHeader: (id: string, height: number, order?: number) => void;
|
|
8
8
|
unregisterHeader: (id: string) => void;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
totalHeight: import("vue").ComputedRef<number>;
|
|
10
|
+
offsets: import("vue").ComputedRef<Record<string, number>>;
|
|
11
|
+
bottomOffsets: import("vue").ComputedRef<Record<string, number>>;
|
|
11
12
|
layers: import("vue").ComputedRef<HeaderLayer[]>;
|
|
12
13
|
};
|
|
13
14
|
export {};
|
|
@@ -10,23 +10,39 @@ export const useHeaderStack = () => {
|
|
|
10
10
|
}
|
|
11
11
|
} else {
|
|
12
12
|
layers.value.push({ id, height, order });
|
|
13
|
-
layers.value.sort((a, b) => a.order - b.order);
|
|
13
|
+
layers.value.sort((a, b) => a.order !== b.order ? a.order - b.order : 0);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
const unregisterHeader = (id) => {
|
|
17
17
|
layers.value = layers.value.filter((l) => l.id !== id);
|
|
18
18
|
};
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const totalHeight = computed(
|
|
20
|
+
() => layers.value.reduce((acc, l) => acc + l.height, 0)
|
|
21
|
+
);
|
|
22
|
+
const offsets = computed(() => {
|
|
23
|
+
const map = {};
|
|
24
|
+
let currentOffset = 0;
|
|
25
|
+
layers.value.forEach((layer) => {
|
|
26
|
+
map[layer.id] = currentOffset;
|
|
27
|
+
currentOffset += layer.height;
|
|
28
|
+
});
|
|
29
|
+
return map;
|
|
30
|
+
});
|
|
31
|
+
const bottomOffsets = computed(() => {
|
|
32
|
+
const map = {};
|
|
33
|
+
let currentOffset = 0;
|
|
34
|
+
layers.value.forEach((layer) => {
|
|
35
|
+
currentOffset += layer.height;
|
|
36
|
+
map[layer.id] = currentOffset;
|
|
37
|
+
});
|
|
38
|
+
return map;
|
|
39
|
+
});
|
|
25
40
|
return {
|
|
26
41
|
registerHeader,
|
|
27
42
|
unregisterHeader,
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
totalHeight,
|
|
44
|
+
offsets,
|
|
45
|
+
bottomOffsets,
|
|
30
46
|
layers: computed(() => layers.value)
|
|
31
47
|
};
|
|
32
48
|
};
|
|
@@ -10,23 +10,39 @@ export const useHeaderStack = () => {
|
|
|
10
10
|
}
|
|
11
11
|
} else {
|
|
12
12
|
layers.value.push({ id, height, order });
|
|
13
|
-
layers.value.sort((a, b) => a.order - b.order);
|
|
13
|
+
layers.value.sort((a, b) => a.order !== b.order ? a.order - b.order : 0);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
const unregisterHeader = (id) => {
|
|
17
17
|
layers.value = layers.value.filter((l) => l.id !== id);
|
|
18
18
|
};
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const totalHeight = computed(
|
|
20
|
+
() => layers.value.reduce((acc, l) => acc + l.height, 0)
|
|
21
|
+
);
|
|
22
|
+
const offsets = computed(() => {
|
|
23
|
+
const map = {};
|
|
24
|
+
let currentOffset = 0;
|
|
25
|
+
layers.value.forEach((layer) => {
|
|
26
|
+
map[layer.id] = currentOffset;
|
|
27
|
+
currentOffset += layer.height;
|
|
28
|
+
});
|
|
29
|
+
return map;
|
|
30
|
+
});
|
|
31
|
+
const bottomOffsets = computed(() => {
|
|
32
|
+
const map = {};
|
|
33
|
+
let currentOffset = 0;
|
|
34
|
+
layers.value.forEach((layer) => {
|
|
35
|
+
currentOffset += layer.height;
|
|
36
|
+
map[layer.id] = currentOffset;
|
|
37
|
+
});
|
|
38
|
+
return map;
|
|
39
|
+
});
|
|
25
40
|
return {
|
|
26
41
|
registerHeader,
|
|
27
42
|
unregisterHeader,
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
totalHeight,
|
|
44
|
+
offsets,
|
|
45
|
+
bottomOffsets,
|
|
30
46
|
layers: computed(() => layers.value)
|
|
31
47
|
};
|
|
32
48
|
};
|