dou-ui 0.1.0-alpha.11 → 0.1.0-alpha.13

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.
Files changed (44) hide show
  1. package/dist/components/button/button.js.map +1 -1
  2. package/dist/components/button/button.vue_vue_type_script_setup_true_lang.js +29 -17
  3. package/dist/components/button/button.vue_vue_type_script_setup_true_lang.js.map +1 -1
  4. package/dist/components/chat-input/chat-input.vue_vue_type_script_setup_true_lang.js +8 -1
  5. package/dist/components/chat-input/chat-input.vue_vue_type_script_setup_true_lang.js.map +1 -1
  6. package/dist/components/chat-input/chat-input2.js.map +1 -1
  7. package/dist/components/check-tag/check-tag.vue_vue_type_script_setup_true_lang.js +8 -5
  8. package/dist/components/check-tag/check-tag.vue_vue_type_script_setup_true_lang.js.map +1 -1
  9. package/dist/components/check-tag/check-tag2.js.map +1 -1
  10. package/dist/components/command/command-dialog.js.map +1 -1
  11. package/dist/components/command/command-dialog.vue_vue_type_script_setup_true_lang.js +7 -1
  12. package/dist/components/command/command-dialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/components/command/command.js.map +1 -1
  14. package/dist/components/command/command.vue_vue_type_script_setup_true_lang.js +65 -12
  15. package/dist/components/command/command.vue_vue_type_script_setup_true_lang.js.map +1 -1
  16. package/dist/components/command/command2.js.map +1 -1
  17. package/dist/components/link/link.js.map +1 -1
  18. package/dist/components/link/link.vue_vue_type_script_setup_true_lang.js +6 -4
  19. package/dist/components/link/link.vue_vue_type_script_setup_true_lang.js.map +1 -1
  20. package/dist/components/menu/menu-actions.js +3 -13
  21. package/dist/components/menu/menu-actions.js.map +1 -1
  22. package/dist/components/status-dot/status-dot.vue_vue_type_script_lang.js +3 -11
  23. package/dist/components/status-dot/status-dot.vue_vue_type_script_lang.js.map +1 -1
  24. package/dist/components/status-dot/status-dot2.js.map +1 -1
  25. package/dist/components/tag/tag.js.map +1 -1
  26. package/dist/components/tag/tag.vue_vue_type_script_setup_true_lang.js +9 -6
  27. package/dist/components/tag/tag.vue_vue_type_script_setup_true_lang.js.map +1 -1
  28. package/dist/components/toast/toast-stack.js.map +1 -1
  29. package/dist/components/toast/toast-stack.vue_vue_type_script_setup_true_lang.js +32 -11
  30. package/dist/components/toast/toast-stack.vue_vue_type_script_setup_true_lang.js.map +1 -1
  31. package/dist/composables/use-grouped-window.js +4 -1
  32. package/dist/composables/use-grouped-window.js.map +1 -1
  33. package/dist/composables/use-measured-sizes.js +6 -5
  34. package/dist/composables/use-measured-sizes.js.map +1 -1
  35. package/dist/style.css +1 -1
  36. package/dist/types/components/command/command-dialog.vue.d.ts +1 -0
  37. package/dist/types/components/command/command.d.ts +7 -1
  38. package/dist/types/components/command/index.d.ts +3 -0
  39. package/dist/types/composables/use-grouped-window.d.ts +1 -0
  40. package/dist/types/composables/use-measured-sizes.d.ts +6 -0
  41. package/dist/types/utils/slot.d.ts +19 -0
  42. package/dist/utils/slot.js +36 -0
  43. package/dist/utils/slot.js.map +1 -0
  44. package/package.json +3 -3
@@ -1,7 +1,8 @@
1
1
  import { useNamespace } from "../../utils/namespace.js";
2
2
  import { useLocale } from "../config-provider/use-config.js";
3
3
  import { useFormSize } from "../form/use-form-item.js";
4
- import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderSlot, unref, useAttrs, useSlots, useTemplateRef } from "vue";
4
+ import { SlotNodes, filled } from "../../utils/slot.js";
5
+ import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderList, renderSlot, unref, useAttrs, useSlots, useTemplateRef } from "vue";
5
6
  import { CloseIcon } from "@dou-ui/icons";
6
7
  // src/components/tag/tag.vue?vue&type=script&setup=true&lang.ts
7
8
  var _hoisted_1 = ["title"];
@@ -51,10 +52,12 @@ var tag_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompon
51
52
  ]);
52
53
  return (_ctx, _cache) => {
53
54
  return openBlock(), createElementBlock("span", { class: normalizeClass(classes.value) }, [
54
- slots.leading ? (openBlock(), createElementBlock("span", {
55
- key: 0,
56
- class: normalizeClass(unref(ns).e("icon"))
57
- }, [renderSlot(_ctx.$slots, "leading")], 2)) : createCommentVNode("", true),
55
+ (openBlock(true), createElementBlock(Fragment, null, renderList([unref(filled)(slots.leading)], (leading) => {
56
+ return openBlock(), createElementBlock(Fragment, { key: 0 }, [leading ? (openBlock(), createElementBlock("span", {
57
+ key: 0,
58
+ class: normalizeClass(unref(ns).e("icon"))
59
+ }, [createVNode(unref(SlotNodes), { nodes: leading }, null, 8, ["nodes"])], 2)) : createCommentVNode("", true)], 64);
60
+ }), 128)),
58
61
  createElementVNode("span", {
59
62
  ref: "label",
60
63
  class: normalizeClass(unref(ns).e("label")),
@@ -62,7 +65,7 @@ var tag_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompon
62
65
  onPointerenter: onLabelEnter
63
66
  }, [renderSlot(_ctx.$slots, "default")], 42, _hoisted_1),
64
67
  __props.closable ? (openBlock(), createElementBlock("button", {
65
- key: 1,
68
+ key: 0,
66
69
  type: "button",
67
70
  class: normalizeClass(unref(ns).e("close")),
68
71
  "aria-label": __props.closeLabel ?? unref(t)("tag.remove"),
@@ -1 +1 @@
1
- {"version":3,"file":"tag.vue_vue_type_script_setup_true_lang.js","names":["_useSlots","_openBlock","_createElementBlock","_normalizeClass","_unref","_renderSlot","_createCommentVNode","_createElementVNode","_createVNode"],"sources":["../../../src/components/tag/tag.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CloseIcon } from '@dou-ui/icons'\nimport { computed, ref, useAttrs, useTemplateRef } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormSize } from '../form/use-form-item'\nimport type { TagEmits, TagProps, TagSlots } from './tag'\n\ndefineOptions({ name: 'DouTag' })\n\nconst props = withDefaults(defineProps<TagProps>(), {\n variant: 'soft',\n tone: 'neutral',\n closable: false,\n round: false,\n})\nconst emit = defineEmits<TagEmits>()\nconst slots = defineSlots<TagSlots>()\n\nconst ns = useNamespace('tag')\nconst { t } = useLocale()\nconst size = useFormSize(() => props.size)\n\n// A label cut short by the ellipsis shows the whole text on hover. Measured\n// only when the pointer arrives, so a page of tags costs nothing until then.\n// A `title` given to the tag is the user's own and always wins.\nconst attrs = useAttrs()\nconst labelRef = useTemplateRef<HTMLElement>('label')\nconst labelTitle = ref<string>()\nfunction onLabelEnter() {\n const el = labelRef.value\n if (!el || attrs.title != null) {\n labelTitle.value = undefined\n return\n }\n labelTitle.value =\n el.scrollWidth > el.clientWidth ? el.textContent?.trim() || undefined : undefined\n}\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(props.variant),\n ns.m(props.tone),\n ns.m(size.value),\n ns.is('round', props.round),\n])\n</script>\n\n<template>\n <span :class=\"classes\">\n <span v-if=\"slots.leading\" :class=\"ns.e('icon')\">\n <slot name=\"leading\" />\n </span>\n <span ref=\"label\" :class=\"ns.e('label')\" :title=\"labelTitle\" @pointerenter=\"onLabelEnter\">\n <slot />\n </span>\n <button\n v-if=\"closable\"\n type=\"button\"\n :class=\"ns.e('close')\"\n :aria-label=\"closeLabel ?? t('tag.remove')\"\n @click=\"emit('close', $event)\"\n >\n <CloseIcon />\n </button>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;EAMd,MAAM,OAAO;EACb,MAAM,QAAQA,SAAA;EAEd,MAAM,KAAK,aAAa,KAAK;EAC7B,MAAM,EAAE,MAAM,UAAU;EACxB,MAAM,OAAO,kBAAkB,MAAM,IAAI;EAKzC,MAAM,QAAQ,SAAS;EACvB,MAAM,WAAW,eAA4B,OAAO;EACpD,MAAM,aAAa,IAAY;EAC/B,SAAS,eAAe;GACtB,MAAM,KAAK,SAAS;GACpB,IAAI,CAAC,MAAM,MAAM,SAAS,MAAM;IAC9B,WAAW,QAAQ,KAAA;IACnB;GACF;GACA,WAAW,QACT,GAAG,cAAc,GAAG,cAAc,GAAG,aAAa,KAAK,KAAK,KAAA,IAAY,KAAA;EAC5E;EAEA,MAAM,UAAU,eAAe;GAC7B,GAAG,EAAE;GACL,GAAG,EAAE,MAAM,OAAO;GAClB,GAAG,EAAE,MAAM,IAAI;GACf,GAAG,EAAE,KAAK,KAAK;GACf,GAAG,GAAG,SAAS,MAAM,KAAK;EAC5B,CAAC;;GAIC,OAAAC,UAAA,GAAAC,mBAgBO,QAAA,EAhBA,OAAKC,eAAE,QAAA,KAAO,E;IACP,MAAM,WAAlBF,UAAA,GAAAC,mBAEO,QAAA;;KAFqB,OAAKC,eAAEC,MAAA,EAAA,CAAE,CAAC,EAAC,MAAA,CAAA;I,IACrCC,WAAuB,KAAA,QAAA,SAAA,C;IAEzBE,mBAEO,QAAA;KAFD,KAAI;KAAS,OAAKJ,eAAEC,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;KAAY,OAAO,WAAA;KAAa,gBAAc;I,IAC1EC,WAAQ,KAAA,QAAA,SAAA,C;IAGF,QAAA,YADRJ,UAAA,GAAAC,mBAQS,UAAA;;KANP,MAAK;KACJ,OAAKC,eAAEC,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;KACX,cAAY,QAAA,cAAcA,MAAA,CAAA,CAAC,CAAA,YAAA;KAC3B,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,SAAU,MAAM;I,IAE5BI,YAAaJ,MAAA,SAAA,CAAA,C"}
1
+ {"version":3,"file":"tag.vue_vue_type_script_setup_true_lang.js","names":["_useSlots","_openBlock","_createElementBlock","_normalizeClass","_Fragment","_renderList","_unref","_createVNode","_createCommentVNode","_createElementVNode","_renderSlot"],"sources":["../../../src/components/tag/tag.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CloseIcon } from '@dou-ui/icons'\nimport { computed, ref, useAttrs, useTemplateRef } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { SlotNodes, filled } from '../../utils/slot'\nimport { useLocale } from '../config-provider/use-config'\nimport { useFormSize } from '../form/use-form-item'\nimport type { TagEmits, TagProps, TagSlots } from './tag'\n\ndefineOptions({ name: 'DouTag' })\n\nconst props = withDefaults(defineProps<TagProps>(), {\n variant: 'soft',\n tone: 'neutral',\n closable: false,\n round: false,\n})\nconst emit = defineEmits<TagEmits>()\nconst slots = defineSlots<TagSlots>()\n\nconst ns = useNamespace('tag')\nconst { t } = useLocale()\nconst size = useFormSize(() => props.size)\n\n// A label cut short by the ellipsis shows the whole text on hover. Measured\n// only when the pointer arrives, so a page of tags costs nothing until then.\n// A `title` given to the tag is the user's own and always wins.\nconst attrs = useAttrs()\nconst labelRef = useTemplateRef<HTMLElement>('label')\nconst labelTitle = ref<string>()\nfunction onLabelEnter() {\n const el = labelRef.value\n if (!el || attrs.title != null) {\n labelTitle.value = undefined\n return\n }\n labelTitle.value =\n el.scrollWidth > el.clientWidth ? el.textContent?.trim() || undefined : undefined\n}\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(props.variant),\n ns.m(props.tone),\n ns.m(size.value),\n ns.is('round', props.round),\n])\n</script>\n\n<template>\n <span :class=\"classes\">\n <!-- rendered once: a leading slot that renders nothing leaves no icon -->\n <template v-for=\"leading in [filled(slots.leading)]\" :key=\"0\">\n <span v-if=\"leading\" :class=\"ns.e('icon')\"><SlotNodes :nodes=\"leading\" /></span>\n </template>\n <span ref=\"label\" :class=\"ns.e('label')\" :title=\"labelTitle\" @pointerenter=\"onLabelEnter\">\n <slot />\n </span>\n <button\n v-if=\"closable\"\n type=\"button\"\n :class=\"ns.e('close')\"\n :aria-label=\"closeLabel ?? t('tag.remove')\"\n @click=\"emit('close', $event)\"\n >\n <CloseIcon />\n </button>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EAMd,MAAM,OAAO;EACb,MAAM,QAAQA,SAAA;EAEd,MAAM,KAAK,aAAa,KAAK;E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,OAAKC,eAAEG,MAAA,EAAA,CAAE,CAAC,EAAC,OAAA,CAAA;KACX,cAAY,QAAA,cAAcA,MAAA,CAAA,CAAC,CAAA,YAAA;KAC3B,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,SAAU,MAAM;I,IAE5BC,YAAaD,MAAA,SAAA,CAAA,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"toast-stack.js","names":["_sfc_main"],"sources":["../../../src/components/toast/toast-stack.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { hasHover } from '../../utils/pointer'\nimport ToastItem from './toast-item.vue'\nimport type { ToastItemLayout } from './toast-item.vue'\nimport type { ToastRecord } from './toast'\n\ndefineOptions({ name: 'DouToastStack' })\n\nconst props = defineProps<{\n /** Oldest first, as they were shown. */\n items: ToastRecord[]\n stacked: boolean\n}>()\n\nconst emit = defineEmits<{ settled: [] }>()\n\nconst ns = useNamespace('toast')\n\n/** Space between open toasts. */\nconst GAP = 8\n/** How far each toast behind the newest one shows past it. */\nconst PEEK = 12\n/** How much smaller each toast behind is. */\nconst SHRINK = 0.05\n/** Toasts shown in a closed stack; the rest wait out of sight behind them. */\nconst VISIBLE = 3\n\nconst heights = reactive(new Map<number, number>())\nwatch(\n () => props.items.map((item) => item.id),\n (ids) => {\n for (const id of heights.keys()) if (!ids.includes(id)) heights.delete(id)\n },\n)\n\n// Open while the mouse is over the stack or focus is in it; a finger or\n// pen has no hover, so a tap opens it and a tap elsewhere closes it.\nconst hovered = ref(false)\nconst focused = ref(false)\nconst tapped = ref(false)\nconst held = computed(() => hovered.value || focused.value || tapped.value)\nconst expanded = computed(() => !props.stacked || held.value)\n\nconst list = ref<HTMLElement>()\n\nfunction onPointerEnter(event: PointerEvent) {\n if (hasHover(event.pointerType)) hovered.value = true\n}\nfunction onPointerLeave(event: PointerEvent) {\n if (hasHover(event.pointerType)) hovered.value = false\n}\nfunction onPointerDown(event: PointerEvent) {\n if (hasHover(event.pointerType) || tapped.value) return\n tapped.value = true\n document.addEventListener('pointerdown', onOutside, true)\n}\nfunction onOutside(event: PointerEvent) {\n if (list.value?.contains(event.target as Node)) return\n release()\n}\nfunction release() {\n tapped.value = false\n document.removeEventListener('pointerdown', onOutside, true)\n}\nonBeforeUnmount(release)\n\nfunction onFocusIn() {\n focused.value = true\n}\nfunction onFocusOut(event: FocusEvent) {\n if (!list.value?.contains(event.relatedTarget as Node | null)) focused.value = false\n}\n\n// A toast closed from the keyboard takes the focus with it, and not every\n// browser says so: once it is gone, check where the focus went.\nfunction onAfterLeave() {\n if (focused.value && !list.value?.contains(document.activeElement)) focused.value = false\n if (props.items.length === 0) {\n hovered.value = false\n release()\n emit('settled')\n }\n}\n\nconst newestFirst = computed(() => props.items.map((_, index, all) => all[all.length - 1 - index]!))\n\nconst layout = computed(() => {\n const result = new Map<number, ToastItemLayout>()\n const front = heights.get(newestFirst.value[0]?.id ?? -1)\n let offset = 0\n newestFirst.value.forEach((item, index) => {\n const height = heights.get(item.id)\n const zIndex = newestFirst.value.length - index\n if (expanded.value) {\n result.set(item.id, { offset, scale: 1, height, behind: false, hidden: false, zIndex })\n offset += (height ?? 0) + GAP\n return\n }\n // A closed stack shows the newest toast whole and the edges of the\n // ones behind it, each a little smaller, all at the newest one's height.\n const depth = Math.min(index, VISIBLE - 1)\n result.set(item.id, {\n offset: depth * PEEK,\n scale: 1 - Math.min(index, VISIBLE) * SHRINK,\n height: index === 0 ? height : front,\n behind: index > 0,\n hidden: index >= VISIBLE,\n zIndex,\n })\n })\n return result\n})\n\nconst height = computed(() => {\n const items = newestFirst.value\n if (expanded.value) {\n let total = 0\n for (const item of items) total += (heights.get(item.id) ?? 0) + GAP\n return Math.max(0, total - GAP)\n }\n const front = heights.get(items[0]?.id ?? -1) ?? 0\n return front + PEEK * Math.max(0, Math.min(items.length, VISIBLE) - 1)\n})\n</script>\n\n<template>\n <ol\n ref=\"list\"\n :class=\"[ns.e('list'), ns.is('expanded', expanded && items.length > 1)]\"\n :style=\"{ height: `${height}px` }\"\n @pointerenter=\"onPointerEnter\"\n @pointerleave=\"onPointerLeave\"\n @pointerdown=\"onPointerDown\"\n @focusin=\"onFocusIn\"\n @focusout=\"onFocusOut\"\n >\n <TransitionGroup name=\"dou-toast\" @after-leave=\"onAfterLeave\">\n <ToastItem\n v-for=\"item in items\"\n :key=\"item.id\"\n :toast=\"item\"\n :layout=\"layout.get(item.id)!\"\n :paused=\"held\"\n @resize=\"heights.set(item.id, $event)\"\n />\n </TransitionGroup>\n </ol>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"toast-stack.js","names":["_sfc_main"],"sources":["../../../src/components/toast/toast-stack.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { hasHover } from '../../utils/pointer'\nimport ToastItem from './toast-item.vue'\nimport type { ToastItemLayout } from './toast-item.vue'\nimport type { ToastRecord } from './toast'\n\ndefineOptions({ name: 'DouToastStack' })\n\nconst props = defineProps<{\n /** Oldest first, as they were shown. */\n items: ToastRecord[]\n stacked: boolean\n}>()\n\nconst emit = defineEmits<{ settled: [] }>()\n\nconst ns = useNamespace('toast')\n\n/** Space between open toasts. */\nconst GAP = 8\n/** How far each toast behind the newest one shows past it. */\nconst PEEK = 12\n/** How much smaller each toast behind is. */\nconst SHRINK = 0.05\n/** Toasts shown in a closed stack; the rest wait out of sight behind them. */\nconst VISIBLE = 3\n\nconst heights = reactive(new Map<number, number>())\nwatch(\n () => props.items.map((item) => item.id),\n (ids) => {\n for (const id of heights.keys()) if (!ids.includes(id)) heights.delete(id)\n },\n)\n\n// Open while the mouse is over the stack or focus is in it; a finger or\n// pen has no hover, so a tap opens it and a tap elsewhere closes it.\nconst hovered = ref(false)\nconst focused = ref(false)\nconst tapped = ref(false)\nconst held = computed(() => hovered.value || focused.value || tapped.value)\nconst expanded = computed(() => !props.stacked || held.value)\n\nconst list = ref<HTMLElement>()\n\nfunction onPointerEnter(event: PointerEvent) {\n if (hasHover(event.pointerType)) hovered.value = true\n}\nfunction onPointerLeave(event: PointerEvent) {\n if (hasHover(event.pointerType)) hovered.value = false\n}\nfunction onPointerDown(event: PointerEvent) {\n if (hasHover(event.pointerType) || tapped.value) return\n tapped.value = true\n document.addEventListener('pointerdown', onOutside, true)\n}\nfunction onOutside(event: PointerEvent) {\n if (list.value?.contains(event.target as Node)) return\n release()\n}\nfunction release() {\n tapped.value = false\n document.removeEventListener('pointerdown', onOutside, true)\n}\nonBeforeUnmount(release)\n\nfunction onFocusIn() {\n focused.value = true\n}\nfunction onFocusOut(event: FocusEvent) {\n if (!list.value?.contains(event.relatedTarget as Node | null)) focused.value = false\n}\n\n// A toast closed from the keyboard takes the focus with it, and not every\n// browser says so: once it is gone, check where the focus went.\nfunction onAfterLeave() {\n if (focused.value && !list.value?.contains(document.activeElement)) focused.value = false\n if (props.items.length === 0) {\n hovered.value = false\n release()\n emit('settled')\n }\n}\n\n// A toast just added has no height yet: it is measured as it mounts,\n// which makes the browser work out the styles right then. Leaving it out\n// of the layout until then keeps the others where they are at that moment,\n// so they move from their old places to the new ones in one transition\n// rather than starting from where a height of zero would put them.\nconst placed = computed(() => {\n const result: { id: number; height: number }[] = []\n for (let index = props.items.length - 1; index >= 0; index--) {\n const { id } = props.items[index]!\n const height = heights.get(id)\n if (height !== undefined) result.push({ id, height })\n }\n return result\n})\n\nconst layout = computed(() => {\n const result = new Map<number, ToastItemLayout>()\n const toasts = placed.value\n const front = toasts[0]?.height\n let offset = 0\n toasts.forEach(({ id, height }, index) => {\n const zIndex = toasts.length - index\n if (expanded.value) {\n result.set(id, { offset, scale: 1, height, behind: false, hidden: false, zIndex })\n offset += height + GAP\n return\n }\n // A closed stack shows the newest toast whole and the edges of the\n // ones behind it, each a little smaller, all at the newest one's height.\n const depth = Math.min(index, VISIBLE - 1)\n result.set(id, {\n offset: depth * PEEK,\n scale: 1 - Math.min(index, VISIBLE) * SHRINK,\n height: index === 0 ? height : front,\n behind: index > 0,\n hidden: index >= VISIBLE,\n zIndex,\n })\n })\n for (const { id } of props.items) {\n if (!result.has(id)) {\n const zIndex = toasts.length + 1\n result.set(id, { offset: 0, scale: 1, behind: false, hidden: false, zIndex })\n }\n }\n return result\n})\n\nconst height = computed(() => {\n const toasts = placed.value\n if (expanded.value) {\n let total = 0\n for (const toast of toasts) total += toast.height + GAP\n return Math.max(0, total - GAP)\n }\n const front = toasts[0]?.height ?? 0\n return front + PEEK * Math.max(0, Math.min(toasts.length, VISIBLE) - 1)\n})\n</script>\n\n<template>\n <ol\n ref=\"list\"\n :class=\"[ns.e('list'), ns.is('expanded', expanded && items.length > 1)]\"\n :style=\"{ height: `${height}px` }\"\n @pointerenter=\"onPointerEnter\"\n @pointerleave=\"onPointerLeave\"\n @pointerdown=\"onPointerDown\"\n @focusin=\"onFocusIn\"\n @focusout=\"onFocusOut\"\n >\n <TransitionGroup name=\"dou-toast\" @after-leave=\"onAfterLeave\">\n <ToastItem\n v-for=\"item in items\"\n :key=\"item.id\"\n :toast=\"item\"\n :layout=\"layout.get(item.id)!\"\n :paused=\"held\"\n @resize=\"heights.set(item.id, $event)\"\n />\n </TransitionGroup>\n </ol>\n</template>\n"],"mappings":""}
@@ -67,16 +67,27 @@ var toast_stack_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
67
67
  emit("settled");
68
68
  }
69
69
  }
70
- const newestFirst = computed(() => props.items.map((_, index, all) => all[all.length - 1 - index]));
70
+ const placed = computed(() => {
71
+ const result = [];
72
+ for (let index = props.items.length - 1; index >= 0; index--) {
73
+ const { id } = props.items[index];
74
+ const height = heights.get(id);
75
+ if (height !== void 0) result.push({
76
+ id,
77
+ height
78
+ });
79
+ }
80
+ return result;
81
+ });
71
82
  const layout = computed(() => {
72
83
  const result = /* @__PURE__ */ new Map();
73
- const front = heights.get(newestFirst.value[0]?.id ?? -1);
84
+ const toasts = placed.value;
85
+ const front = toasts[0]?.height;
74
86
  let offset = 0;
75
- newestFirst.value.forEach((item, index) => {
76
- const height = heights.get(item.id);
77
- const zIndex = newestFirst.value.length - index;
87
+ toasts.forEach(({ id, height }, index) => {
88
+ const zIndex = toasts.length - index;
78
89
  if (expanded.value) {
79
- result.set(item.id, {
90
+ result.set(id, {
80
91
  offset,
81
92
  scale: 1,
82
93
  height,
@@ -84,11 +95,11 @@ var toast_stack_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
84
95
  hidden: false,
85
96
  zIndex
86
97
  });
87
- offset += (height ?? 0) + GAP;
98
+ offset += height + GAP;
88
99
  return;
89
100
  }
90
101
  const depth = Math.min(index, 2);
91
- result.set(item.id, {
102
+ result.set(id, {
92
103
  offset: depth * PEEK,
93
104
  scale: 1 - Math.min(index, VISIBLE) * SHRINK,
94
105
  height: index === 0 ? height : front,
@@ -97,16 +108,26 @@ var toast_stack_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
97
108
  zIndex
98
109
  });
99
110
  });
111
+ for (const { id } of props.items) if (!result.has(id)) {
112
+ const zIndex = toasts.length + 1;
113
+ result.set(id, {
114
+ offset: 0,
115
+ scale: 1,
116
+ behind: false,
117
+ hidden: false,
118
+ zIndex
119
+ });
120
+ }
100
121
  return result;
101
122
  });
102
123
  const height = computed(() => {
103
- const items = newestFirst.value;
124
+ const toasts = placed.value;
104
125
  if (expanded.value) {
105
126
  let total = 0;
106
- for (const item of items) total += (heights.get(item.id) ?? 0) + GAP;
127
+ for (const toast of toasts) total += toast.height + GAP;
107
128
  return Math.max(0, total - GAP);
108
129
  }
109
- return (heights.get(items[0]?.id ?? -1) ?? 0) + PEEK * Math.max(0, Math.min(items.length, VISIBLE) - 1);
130
+ return (toasts[0]?.height ?? 0) + PEEK * Math.max(0, Math.min(toasts.length, VISIBLE) - 1);
110
131
  });
111
132
  return (_ctx, _cache) => {
112
133
  return openBlock(), createElementBlock("ol", {
@@ -1 +1 @@
1
- {"version":3,"file":"toast-stack.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_normalizeStyle","_createVNode","_TransitionGroup","_withCtx","_Fragment","_renderList","_createBlock","ToastItem"],"sources":["../../../src/components/toast/toast-stack.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { hasHover } from '../../utils/pointer'\nimport ToastItem from './toast-item.vue'\nimport type { ToastItemLayout } from './toast-item.vue'\nimport type { ToastRecord } from './toast'\n\ndefineOptions({ name: 'DouToastStack' })\n\nconst props = defineProps<{\n /** Oldest first, as they were shown. */\n items: ToastRecord[]\n stacked: boolean\n}>()\n\nconst emit = defineEmits<{ settled: [] }>()\n\nconst ns = useNamespace('toast')\n\n/** Space between open toasts. */\nconst GAP = 8\n/** How far each toast behind the newest one shows past it. */\nconst PEEK = 12\n/** How much smaller each toast behind is. */\nconst SHRINK = 0.05\n/** Toasts shown in a closed stack; the rest wait out of sight behind them. */\nconst VISIBLE = 3\n\nconst heights = reactive(new Map<number, number>())\nwatch(\n () => props.items.map((item) => item.id),\n (ids) => {\n for (const id of heights.keys()) if (!ids.includes(id)) heights.delete(id)\n },\n)\n\n// Open while the mouse is over the stack or focus is in it; a finger or\n// pen has no hover, so a tap opens it and a tap elsewhere closes it.\nconst hovered = ref(false)\nconst focused = ref(false)\nconst tapped = ref(false)\nconst held = computed(() => hovered.value || focused.value || tapped.value)\nconst expanded = computed(() => !props.stacked || held.value)\n\nconst list = ref<HTMLElement>()\n\nfunction onPointerEnter(event: PointerEvent) {\n if (hasHover(event.pointerType)) hovered.value = true\n}\nfunction onPointerLeave(event: PointerEvent) {\n if (hasHover(event.pointerType)) hovered.value = false\n}\nfunction onPointerDown(event: PointerEvent) {\n if (hasHover(event.pointerType) || tapped.value) return\n tapped.value = true\n document.addEventListener('pointerdown', onOutside, true)\n}\nfunction onOutside(event: PointerEvent) {\n if (list.value?.contains(event.target as Node)) return\n release()\n}\nfunction release() {\n tapped.value = false\n document.removeEventListener('pointerdown', onOutside, true)\n}\nonBeforeUnmount(release)\n\nfunction onFocusIn() {\n focused.value = true\n}\nfunction onFocusOut(event: FocusEvent) {\n if (!list.value?.contains(event.relatedTarget as Node | null)) focused.value = false\n}\n\n// A toast closed from the keyboard takes the focus with it, and not every\n// browser says so: once it is gone, check where the focus went.\nfunction onAfterLeave() {\n if (focused.value && !list.value?.contains(document.activeElement)) focused.value = false\n if (props.items.length === 0) {\n hovered.value = false\n release()\n emit('settled')\n }\n}\n\nconst newestFirst = computed(() => props.items.map((_, index, all) => all[all.length - 1 - index]!))\n\nconst layout = computed(() => {\n const result = new Map<number, ToastItemLayout>()\n const front = heights.get(newestFirst.value[0]?.id ?? -1)\n let offset = 0\n newestFirst.value.forEach((item, index) => {\n const height = heights.get(item.id)\n const zIndex = newestFirst.value.length - index\n if (expanded.value) {\n result.set(item.id, { offset, scale: 1, height, behind: false, hidden: false, zIndex })\n offset += (height ?? 0) + GAP\n return\n }\n // A closed stack shows the newest toast whole and the edges of the\n // ones behind it, each a little smaller, all at the newest one's height.\n const depth = Math.min(index, VISIBLE - 1)\n result.set(item.id, {\n offset: depth * PEEK,\n scale: 1 - Math.min(index, VISIBLE) * SHRINK,\n height: index === 0 ? height : front,\n behind: index > 0,\n hidden: index >= VISIBLE,\n zIndex,\n })\n })\n return result\n})\n\nconst height = computed(() => {\n const items = newestFirst.value\n if (expanded.value) {\n let total = 0\n for (const item of items) total += (heights.get(item.id) ?? 0) + GAP\n return Math.max(0, total - GAP)\n }\n const front = heights.get(items[0]?.id ?? -1) ?? 0\n return front + PEEK * Math.max(0, Math.min(items.length, VISIBLE) - 1)\n})\n</script>\n\n<template>\n <ol\n ref=\"list\"\n :class=\"[ns.e('list'), ns.is('expanded', expanded && items.length > 1)]\"\n :style=\"{ height: `${height}px` }\"\n @pointerenter=\"onPointerEnter\"\n @pointerleave=\"onPointerLeave\"\n @pointerdown=\"onPointerDown\"\n @focusin=\"onFocusIn\"\n @focusout=\"onFocusOut\"\n >\n <TransitionGroup name=\"dou-toast\" @after-leave=\"onAfterLeave\">\n <ToastItem\n v-for=\"item in items\"\n :key=\"item.id\"\n :toast=\"item\"\n :layout=\"layout.get(item.id)!\"\n :paused=\"held\"\n @resize=\"heights.set(item.id, $event)\"\n />\n </TransitionGroup>\n </ol>\n</template>\n"],"mappings":";;;;;AAqBA,IAAM,MAAM;;AAEZ,IAAM,OAAO;;AAEb,IAAM,SAAS;;AAEf,IAAM,UAAU;;;;;;;;;;EAjBhB,MAAM,QAAQ;EAMd,MAAM,OAAO;EAEb,MAAM,KAAK,aAAa,OAAO;;EAW/B,MAAM,UAAU,yBAAS,IAAI,IAAoB,CAAC;EAClD,YACQ,MAAM,MAAM,KAAK,SAAS,KAAK,EAAE,IACtC,QAAQ;GACP,KAAK,MAAM,MAAM,QAAQ,KAAK,GAAG,IAAI,CAAC,IAAI,SAAS,EAAE,GAAG,QAAQ,OAAO,EAAE;EAC3E,CACF;EAIA,MAAM,UAAU,IAAI,KAAK;EACzB,MAAM,UAAU,IAAI,KAAK;EACzB,MAAM,SAAS,IAAI,KAAK;EACxB,MAAM,OAAO,eAAe,QAAQ,SAAS,QAAQ,SAAS,OAAO,KAAK;EAC1E,MAAM,WAAW,eAAe,CAAC,MAAM,WAAW,KAAK,KAAK;EAE5D,MAAM,OAAO,IAAiB;EAE9B,SAAS,eAAe,OAAqB;GAC3C,IAAI,SAAS,MAAM,WAAW,GAAG,QAAQ,QAAQ;EACnD;EACA,SAAS,eAAe,OAAqB;GAC3C,IAAI,SAAS,MAAM,WAAW,GAAG,QAAQ,QAAQ;EACnD;EACA,SAAS,cAAc,OAAqB;GAC1C,IAAI,SAAS,MAAM,WAAW,KAAK,OAAO,OAAO;GACjD,OAAO,QAAQ;GACf,SAAS,iBAAiB,eAAe,WAAW,IAAI;EAC1D;EACA,SAAS,UAAU,OAAqB;GACtC,IAAI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;KACjB;IACF,CAAC;GACH,CAAC;GACD,OAAO;EACT,CAAC;EAED,MAAM,SAAS,eAAe;GAC5B,MAAM,QAAQ,YAAY;GAC1B,IAAI,SAAS,OAAO;IAClB,IAAI,QAAQ;IACZ,KAAK,MAAM,QAAQ,OAAO,UAAU,QAAQ,IAAI,KAAK,EAAE,KAAK,KAAK;IACjE,OAAO,KAAK,IAAI,GAAG,QAAQ,GAAG;GAChC;GAEA,QADc,QAAQ,IAAI,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,KAClC,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,QAAQ,OAAO,IAAI,CAAC;EACvE,CAAC;;GAIC,OAAAA,UAAA,GAAAC,mBAoBK,MAAA;IAnBC,SAAA;IAAJ,KAAI;IACH,OAAKC,eAAA,CAAGC,MAAA,EAAA,CAAE,CAAC,EAAC,MAAA,GAAUA,MAAA,EAAA,CAAE,CAAC,GAAE,YAAa,SAAA,SAAY,QAAA,MAAM,SAAM,CAAA,CAAA,CAAA;IAChE,OAAKC,eAAA,EAAA,QAAA,GAAe,OAAA,MAAM,IAAA,CAAA;IAC1B,gBAAc;IACd,gBAAc;IACd,eAAa;IACb,WAAS;IACT,YAAU;G,IAEXC,YASkBC,iBAAA;IATD,MAAK;IAA0B;;IAE5C,SAAAC,cAAqB,EADvBP,UAAA,IAAA,GAAAC,mBAOEO,UAAA,MAAAC,WANe,QAAA,QAAR,SAAI;KADb,OAAAT,UAAA,GAAAU,YAOEC,oBAAA;MALC,KAAK,KAAK;MACV,OAAO;MACP,QAAQ,OAAA,MAAO,IAAI,KAAK,EAAE;MAC1B,QAAQ,KAAA;MACR,WAAM,WAAE,QAAQ,IAAI,KAAK,IAAI,MAAM"}
1
+ {"version":3,"file":"toast-stack.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_normalizeStyle","_createVNode","_TransitionGroup","_withCtx","_Fragment","_renderList","_createBlock","ToastItem"],"sources":["../../../src/components/toast/toast-stack.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { hasHover } from '../../utils/pointer'\nimport ToastItem from './toast-item.vue'\nimport type { ToastItemLayout } from './toast-item.vue'\nimport type { ToastRecord } from './toast'\n\ndefineOptions({ name: 'DouToastStack' })\n\nconst props = defineProps<{\n /** Oldest first, as they were shown. */\n items: ToastRecord[]\n stacked: boolean\n}>()\n\nconst emit = defineEmits<{ settled: [] }>()\n\nconst ns = useNamespace('toast')\n\n/** Space between open toasts. */\nconst GAP = 8\n/** How far each toast behind the newest one shows past it. */\nconst PEEK = 12\n/** How much smaller each toast behind is. */\nconst SHRINK = 0.05\n/** Toasts shown in a closed stack; the rest wait out of sight behind them. */\nconst VISIBLE = 3\n\nconst heights = reactive(new Map<number, number>())\nwatch(\n () => props.items.map((item) => item.id),\n (ids) => {\n for (const id of heights.keys()) if (!ids.includes(id)) heights.delete(id)\n },\n)\n\n// Open while the mouse is over the stack or focus is in it; a finger or\n// pen has no hover, so a tap opens it and a tap elsewhere closes it.\nconst hovered = ref(false)\nconst focused = ref(false)\nconst tapped = ref(false)\nconst held = computed(() => hovered.value || focused.value || tapped.value)\nconst expanded = computed(() => !props.stacked || held.value)\n\nconst list = ref<HTMLElement>()\n\nfunction onPointerEnter(event: PointerEvent) {\n if (hasHover(event.pointerType)) hovered.value = true\n}\nfunction onPointerLeave(event: PointerEvent) {\n if (hasHover(event.pointerType)) hovered.value = false\n}\nfunction onPointerDown(event: PointerEvent) {\n if (hasHover(event.pointerType) || tapped.value) return\n tapped.value = true\n document.addEventListener('pointerdown', onOutside, true)\n}\nfunction onOutside(event: PointerEvent) {\n if (list.value?.contains(event.target as Node)) return\n release()\n}\nfunction release() {\n tapped.value = false\n document.removeEventListener('pointerdown', onOutside, true)\n}\nonBeforeUnmount(release)\n\nfunction onFocusIn() {\n focused.value = true\n}\nfunction onFocusOut(event: FocusEvent) {\n if (!list.value?.contains(event.relatedTarget as Node | null)) focused.value = false\n}\n\n// A toast closed from the keyboard takes the focus with it, and not every\n// browser says so: once it is gone, check where the focus went.\nfunction onAfterLeave() {\n if (focused.value && !list.value?.contains(document.activeElement)) focused.value = false\n if (props.items.length === 0) {\n hovered.value = false\n release()\n emit('settled')\n }\n}\n\n// A toast just added has no height yet: it is measured as it mounts,\n// which makes the browser work out the styles right then. Leaving it out\n// of the layout until then keeps the others where they are at that moment,\n// so they move from their old places to the new ones in one transition\n// rather than starting from where a height of zero would put them.\nconst placed = computed(() => {\n const result: { id: number; height: number }[] = []\n for (let index = props.items.length - 1; index >= 0; index--) {\n const { id } = props.items[index]!\n const height = heights.get(id)\n if (height !== undefined) result.push({ id, height })\n }\n return result\n})\n\nconst layout = computed(() => {\n const result = new Map<number, ToastItemLayout>()\n const toasts = placed.value\n const front = toasts[0]?.height\n let offset = 0\n toasts.forEach(({ id, height }, index) => {\n const zIndex = toasts.length - index\n if (expanded.value) {\n result.set(id, { offset, scale: 1, height, behind: false, hidden: false, zIndex })\n offset += height + GAP\n return\n }\n // A closed stack shows the newest toast whole and the edges of the\n // ones behind it, each a little smaller, all at the newest one's height.\n const depth = Math.min(index, VISIBLE - 1)\n result.set(id, {\n offset: depth * PEEK,\n scale: 1 - Math.min(index, VISIBLE) * SHRINK,\n height: index === 0 ? height : front,\n behind: index > 0,\n hidden: index >= VISIBLE,\n zIndex,\n })\n })\n for (const { id } of props.items) {\n if (!result.has(id)) {\n const zIndex = toasts.length + 1\n result.set(id, { offset: 0, scale: 1, behind: false, hidden: false, zIndex })\n }\n }\n return result\n})\n\nconst height = computed(() => {\n const toasts = placed.value\n if (expanded.value) {\n let total = 0\n for (const toast of toasts) total += toast.height + GAP\n return Math.max(0, total - GAP)\n }\n const front = toasts[0]?.height ?? 0\n return front + PEEK * Math.max(0, Math.min(toasts.length, VISIBLE) - 1)\n})\n</script>\n\n<template>\n <ol\n ref=\"list\"\n :class=\"[ns.e('list'), ns.is('expanded', expanded && items.length > 1)]\"\n :style=\"{ height: `${height}px` }\"\n @pointerenter=\"onPointerEnter\"\n @pointerleave=\"onPointerLeave\"\n @pointerdown=\"onPointerDown\"\n @focusin=\"onFocusIn\"\n @focusout=\"onFocusOut\"\n >\n <TransitionGroup name=\"dou-toast\" @after-leave=\"onAfterLeave\">\n <ToastItem\n v-for=\"item in items\"\n :key=\"item.id\"\n :toast=\"item\"\n :layout=\"layout.get(item.id)!\"\n :paused=\"held\"\n @resize=\"heights.set(item.id, $event)\"\n />\n </TransitionGroup>\n </ol>\n</template>\n"],"mappings":";;;;;AAqBA,IAAM,MAAM;;AAEZ,IAAM,OAAO;;AAEb,IAAM,SAAS;;AAEf,IAAM,UAAU;;;;;;;;;;EAjBhB,MAAM,QAAQ;EAMd,MAAM,OAAO;EAEb,MAAM,KAAK,aAAa,OAAO;;EAW/B,MAAM,UAAU,yBAAS,IAAI,IAAoB,CAAC;EAClD,YACQ,MAAM,MAAM,KAAK,SAAS,KAAK,EAAE,IACtC,QAAQ;GACP,KAAK,MAAM,MAAM,QAAQ,KAAK,GAAG,IAAI,CAAC,IAAI,SAAS,EAAE,GAAG,QAAQ,OAAO,EAAE;EAC3E,CACF;EAIA,MAAM,UAAU,IAAI,KAAK;EACzB,MAAM,UAAU,IAAI,KAAK;EACzB,MAAM,SAAS,IAAI,KAAK;EACxB,MAAM,OAAO,eAAe,QAAQ,SAAS,QAAQ,SAAS,OAAO,KAAK;EAC1E,MAAM,WAAW,eAAe,CAAC,MAAM,WAAW,KAAK,KAAK;EAE5D,MAAM,OAAO,IAAiB;EAE9B,SAAS,eAAe,OAAqB;GAC3C,IAAI,SAAS,MAAM,WAAW,GAAG,QAAQ,QAAQ;EACnD;EACA,SAAS,eAAe,OAAqB;GAC3C,IAAI,SAAS,MAAM,WAAW,GAAG,QAAQ,QAAQ;EACnD;EACA,SAAS,cAAc,OAAqB;GAC1C,IAAI,SAAS,MAAM,WAAW,KAAK,OAAO,OAAO;GACj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,MAAAC,WANe,QAAA,QAAR,SAAI;KADb,OAAAT,UAAA,GAAAU,YAOEC,oBAAA;MALC,KAAK,KAAK;MACV,OAAO;MACP,QAAQ,OAAA,MAAO,IAAI,KAAK,EAAE;MAC1B,QAAQ,KAAA;MACR,WAAM,WAAE,QAAQ,IAAI,KAAK,IAAI,MAAM"}
@@ -113,11 +113,14 @@ function useGroupedWindow(options) {
113
113
  observed?.removeEventListener("scroll", onScroll);
114
114
  observer?.disconnect();
115
115
  });
116
+ /** Where an item starts in the scrolled content. */
117
+ const startOf = (group, index) => (starts.value[group] ?? 0) + (offsets.value[group]?.start(index) ?? 0);
116
118
  return {
117
119
  enabled,
118
120
  windows,
119
121
  scrollToItem,
120
- measure
122
+ measure,
123
+ startOf
121
124
  };
122
125
  }
123
126
  export { GROUP_START, useGroupedWindow };
@@ -1 +1 @@
1
- {"version":3,"file":"use-grouped-window.js","names":[],"sources":["../../src/composables/use-grouped-window.ts"],"sourcesContent":["import { computed, onBeforeUnmount, onMounted, onUpdated, ref, watch } from 'vue'\nimport { createOffsets } from '../components/virtual-list/virtual-list'\nimport { shouldVirtualize } from '../utils/virtual'\n\nexport interface UseGroupedWindowOptions {\n /** The element that scrolls. */\n container: () => HTMLElement | null | undefined\n /** How many items each group holds, in order. */\n sizes: () => number[]\n /** The height of an item in px. */\n itemSize: (group: number, index: number) => number\n /** `virtual` as asked for; left undefined, it turns on for long lists. */\n virtual: () => boolean | undefined\n /** Extra items rendered above and below the viewport. */\n overscan?: number\n}\n\nexport interface GroupWindow {\n /** The first item to render. */\n from: number\n /** One past the last item to render. */\n to: number\n /** The height of a spacer standing in for the items before `from`. */\n before: number\n /** The height of a spacer standing in for the items from `to` on. */\n after: number\n}\n\n/** The attribute that marks where a group's items begin, on its leading spacer. */\nexport const GROUP_START = 'data-dou-group-start'\n\n/**\n * Render only the items in view of a list split into groups, such as\n * options under group labels. Items keep their place in the page between\n * two spacers, so labels, separators and padding stay as they are; where\n * each group's items begin is measured from a marker on its leading spacer.\n */\nexport function useGroupedWindow(options: UseGroupedWindowOptions) {\n const overscan = options.overscan ?? 4\n const scrollTop = ref(0)\n const viewport = ref(0)\n const measuredStarts = ref<number[]>([])\n\n const total = computed(() => options.sizes().reduce((sum, count) => sum + count, 0))\n const enabled = computed(() => shouldVirtualize(options.virtual(), total.value))\n const offsets = computed(() =>\n options.sizes().map((count, group) => createOffsets(count, (i) => options.itemSize(group, i))),\n )\n // Until measured, groups are assumed to follow each other with no gap.\n const starts = computed(() => {\n let estimate = 0\n return offsets.value.map((offset, group) => {\n const start = measuredStarts.value[group] ?? estimate\n estimate = start + offset.total\n return start\n })\n })\n\n function windowOf(group: number): GroupWindow {\n const count = options.sizes()[group] ?? 0\n if (!enabled.value) return { from: 0, to: count, before: 0, after: 0 }\n const offset = offsets.value[group]!\n const top = scrollTop.value - starts.value[group]!\n const height = Math.max(viewport.value, 1)\n let from: number\n let to: number\n if (!count || top + height <= 0) from = to = 0\n else if (top >= offset.total) from = to = count\n else {\n from = Math.max(0, offset.find(Math.max(0, top)) - overscan)\n to = Math.min(count, offset.find(top + height - 1) + 1 + overscan)\n }\n return { from, to, before: offset.start(from), after: offset.total - offset.start(to) }\n }\n const windows = computed(() => options.sizes().map((_, group) => windowOf(group)))\n\n function measure() {\n const el = options.container()\n if (!el || !enabled.value) return\n viewport.value = el.clientHeight\n const base = el.getBoundingClientRect().top - el.scrollTop\n const markers = el.querySelectorAll(`[${GROUP_START}]`)\n const next = Array.from(markers, (marker) =>\n Math.round(marker.getBoundingClientRect().top - base),\n )\n const current = measuredStarts.value\n if (next.length !== current.length || next.some((value, at) => value !== current[at])) {\n measuredStarts.value = next\n }\n }\n\n function onScroll() {\n const el = options.container()\n if (el && enabled.value) scrollTop.value = el.scrollTop\n }\n\n /** Scroll as little as needed to show an item, whether or not it is rendered. */\n function scrollToItem(group: number, index: number) {\n const el = options.container()\n const offset = offsets.value[group]\n if (!el || !offset) return\n const top = starts.value[group]! + offset.start(index)\n const bottom = starts.value[group]! + offset.start(index + 1)\n let target = el.scrollTop\n if (top < target) target = top\n else if (bottom > target + el.clientHeight) target = bottom - el.clientHeight\n if (target !== el.scrollTop) {\n el.scrollTop = Math.max(0, target)\n scrollTop.value = el.scrollTop\n }\n }\n\n let observed: HTMLElement | null | undefined\n let observer: ResizeObserver | undefined\n function bind() {\n const el = options.container()\n if (el === observed) return\n observed?.removeEventListener('scroll', onScroll)\n observer?.disconnect()\n observed = el\n if (!el) return\n el.addEventListener('scroll', onScroll, { passive: true })\n scrollTop.value = el.scrollTop\n if (typeof ResizeObserver !== 'undefined') {\n observer = new ResizeObserver(measure)\n observer.observe(el)\n }\n }\n onMounted(() => {\n bind()\n measure()\n })\n onUpdated(() => {\n bind()\n measure()\n })\n watch(enabled, (on) => {\n if (on) onScroll()\n })\n onBeforeUnmount(() => {\n observed?.removeEventListener('scroll', onScroll)\n observer?.disconnect()\n })\n\n return { enabled, windows, scrollToItem, measure }\n}\n"],"mappings":";;;;;AA6BA,IAAa,cAAc;;;;;;;AAQ3B,SAAgB,iBAAiB,SAAkC;CACjE,MAAM,WAAW,QAAQ,YAAY;CACrC,MAAM,YAAY,IAAI,CAAC;CACvB,MAAM,WAAW,IAAI,CAAC;CACtB,MAAM,iBAAiB,IAAc,CAAC,CAAC;CAEvC,MAAM,QAAQ,eAAe,QAAQ,MAAM,CAAC,CAAC,QAAQ,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC;CACnF,MAAM,UAAU,eAAe,iBAAiB,QAAQ,QAAQ,GAAG,MAAM,KAAK,CAAC;CAC/E,MAAM,UAAU,eACd,QAAQ,MAAM,CAAC,CAAC,KAAK,OAAO,UAAU,cAAc,QAAQ,MAAM,QAAQ,SAAS,OAAO,CAAC,CAAC,CAAC,CAC/F;CAEA,MAAM,SAAS,eAAe;EAC5B,IAAI,WAAW;EACf,OAAO,QAAQ,MAAM,KAAK,QAAQ,UAAU;GAC1C,MAAM,QAAQ,eAAe,MAAM,UAAU;GAC7C,WAAW,QAA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AED,OAAO;EAAE;EAAS;EAAS;EAAc;CAAQ;AACnD"}
1
+ {"version":3,"file":"use-grouped-window.js","names":[],"sources":["../../src/composables/use-grouped-window.ts"],"sourcesContent":["import { computed, onBeforeUnmount, onMounted, onUpdated, ref, watch } from 'vue'\nimport { createOffsets } from '../components/virtual-list/virtual-list'\nimport { shouldVirtualize } from '../utils/virtual'\n\nexport interface UseGroupedWindowOptions {\n /** The element that scrolls. */\n container: () => HTMLElement | null | undefined\n /** How many items each group holds, in order. */\n sizes: () => number[]\n /** The height of an item in px. */\n itemSize: (group: number, index: number) => number\n /** `virtual` as asked for; left undefined, it turns on for long lists. */\n virtual: () => boolean | undefined\n /** Extra items rendered above and below the viewport. */\n overscan?: number\n}\n\nexport interface GroupWindow {\n /** The first item to render. */\n from: number\n /** One past the last item to render. */\n to: number\n /** The height of a spacer standing in for the items before `from`. */\n before: number\n /** The height of a spacer standing in for the items from `to` on. */\n after: number\n}\n\n/** The attribute that marks where a group's items begin, on its leading spacer. */\nexport const GROUP_START = 'data-dou-group-start'\n\n/**\n * Render only the items in view of a list split into groups, such as\n * options under group labels. Items keep their place in the page between\n * two spacers, so labels, separators and padding stay as they are; where\n * each group's items begin is measured from a marker on its leading spacer.\n */\nexport function useGroupedWindow(options: UseGroupedWindowOptions) {\n const overscan = options.overscan ?? 4\n const scrollTop = ref(0)\n const viewport = ref(0)\n const measuredStarts = ref<number[]>([])\n\n const total = computed(() => options.sizes().reduce((sum, count) => sum + count, 0))\n const enabled = computed(() => shouldVirtualize(options.virtual(), total.value))\n const offsets = computed(() =>\n options.sizes().map((count, group) => createOffsets(count, (i) => options.itemSize(group, i))),\n )\n // Until measured, groups are assumed to follow each other with no gap.\n const starts = computed(() => {\n let estimate = 0\n return offsets.value.map((offset, group) => {\n const start = measuredStarts.value[group] ?? estimate\n estimate = start + offset.total\n return start\n })\n })\n\n function windowOf(group: number): GroupWindow {\n const count = options.sizes()[group] ?? 0\n if (!enabled.value) return { from: 0, to: count, before: 0, after: 0 }\n const offset = offsets.value[group]!\n const top = scrollTop.value - starts.value[group]!\n const height = Math.max(viewport.value, 1)\n let from: number\n let to: number\n if (!count || top + height <= 0) from = to = 0\n else if (top >= offset.total) from = to = count\n else {\n from = Math.max(0, offset.find(Math.max(0, top)) - overscan)\n to = Math.min(count, offset.find(top + height - 1) + 1 + overscan)\n }\n return { from, to, before: offset.start(from), after: offset.total - offset.start(to) }\n }\n const windows = computed(() => options.sizes().map((_, group) => windowOf(group)))\n\n function measure() {\n const el = options.container()\n if (!el || !enabled.value) return\n viewport.value = el.clientHeight\n const base = el.getBoundingClientRect().top - el.scrollTop\n const markers = el.querySelectorAll(`[${GROUP_START}]`)\n const next = Array.from(markers, (marker) =>\n Math.round(marker.getBoundingClientRect().top - base),\n )\n const current = measuredStarts.value\n if (next.length !== current.length || next.some((value, at) => value !== current[at])) {\n measuredStarts.value = next\n }\n }\n\n function onScroll() {\n const el = options.container()\n if (el && enabled.value) scrollTop.value = el.scrollTop\n }\n\n /** Scroll as little as needed to show an item, whether or not it is rendered. */\n function scrollToItem(group: number, index: number) {\n const el = options.container()\n const offset = offsets.value[group]\n if (!el || !offset) return\n const top = starts.value[group]! + offset.start(index)\n const bottom = starts.value[group]! + offset.start(index + 1)\n let target = el.scrollTop\n if (top < target) target = top\n else if (bottom > target + el.clientHeight) target = bottom - el.clientHeight\n if (target !== el.scrollTop) {\n el.scrollTop = Math.max(0, target)\n scrollTop.value = el.scrollTop\n }\n }\n\n let observed: HTMLElement | null | undefined\n let observer: ResizeObserver | undefined\n function bind() {\n const el = options.container()\n if (el === observed) return\n observed?.removeEventListener('scroll', onScroll)\n observer?.disconnect()\n observed = el\n if (!el) return\n el.addEventListener('scroll', onScroll, { passive: true })\n scrollTop.value = el.scrollTop\n if (typeof ResizeObserver !== 'undefined') {\n observer = new ResizeObserver(measure)\n observer.observe(el)\n }\n }\n onMounted(() => {\n bind()\n measure()\n })\n onUpdated(() => {\n bind()\n measure()\n })\n watch(enabled, (on) => {\n if (on) onScroll()\n })\n onBeforeUnmount(() => {\n observed?.removeEventListener('scroll', onScroll)\n observer?.disconnect()\n })\n\n /** Where an item starts in the scrolled content. */\n const startOf = (group: number, index: number) =>\n (starts.value[group] ?? 0) + (offsets.value[group]?.start(index) ?? 0)\n\n return { enabled, windows, scrollToItem, measure, startOf }\n}\n"],"mappings":";;;;;AA6BA,IAAa,cAAc;;;;;;;AAQ3B,SAAgB,iBAAiB,SAAkC;CACjE,MAAM,WAAW,QAAQ,YAAY;CACrC,MAAM,YAAY,IAAI,CAAC;CACvB,MAAM,WAAW,IAAI,CAAC;CACtB,MAAM,iBAAiB,IAAc,CAAC,CAAC;CAEvC,MAAM,QAAQ,eAAe,QAAQ,MAAM,CAAC,CAAC,QAAQ,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC;CACnF,MAAM,UAAU,eAAe,iBAAiB,QAAQ,QAAQ,GAAG,MAAM,KAAK,CAAC;CAC/E,MAAM,UAAU,eACd,QAAQ,MAAM,CAAC,CAAC,KAAK,OAAO,UAAU,cAAc,QAAQ,MAAM,QAAQ,SAAS,OAAO,CAAC,CAAC,CAAC,CAC/F;CAEA,MAAM,SAAS,eAAe;EAC5B,IAAI,WAAW;EACf,OAAO,QAAQ,MAAM,KAAK,QAAQ,UAAU;GAC1C,MAAM,QAAQ,eAAe,MAAM,UAAU;GAC7C,WAAW,QAAQ,OAAO;GAC1B,OAAO;EACT,CAAC;CACH,CAAC;CAED,SAAS,SAAS,OAA4B;EAC5C,MAAM,QAAQ,QAAQ,MAAM,CAAC,CAAC,UAAU;EACxC,IAAI,CAAC,QAAQ,OAAO,OAAO;GAAE,MAAM;GAAG,IAAI;GAAO,QAAQ;GAAG,OAAO;EAAE;EACrE,MAAM,SAAS,QAAQ,MAAM;EAC7B,MAAM,MAAM,UAAU,QAAQ,OAAO,MAAM;EAC3C,MAAM,SAAS,KAAK,IAAI,SAAS,OAAO,CAAC;EACzC,IAAI;EACJ,IAAI;EACJ,IAAI,CAAC,S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AAM,SAAU,OAAO,MAAM,QAAQ,CAAC;EAC5D,IAAI,SAAS,GAAG;EAChB,IAAI,MAAM,QAAQ,SAAS;OACtB,IAAI,SAAS,SAAS,GAAG,cAAc,SAAS,SAAS,GAAG;EACjE,IAAI,WAAW,GAAG,WAAW;GAC3B,GAAG,YAAY,KAAK,IAAI,GAAG,MAAM;GACjC,UAAU,QAAQ,GAAG;EACvB;CACF;CAEA,IAAI;CACJ,IAAI;CACJ,SAAS,OAAO;EACd,MAAM,KAAK,QAAQ,UAAU;EAC7B,IAAI,OAAO,UAAU;EACrB,UAAU,oBAAoB,UAAU,QAAQ;EAChD,UAAU,WAAW;EACrB,WAAW;EACX,IAAI,CAAC,IAAI;EACT,GAAG,iBAAiB,UAAU,UAAU,EAAE,SAAS,KAAK,CAAC;EACzD,UAAU,QAAQ,GAAG;EACrB,IAAI,OAAO,mBAAmB,aAAa;GACzC,WAAW,IAAI,eAAe,OAAO;GACrC,SAAS,QAAQ,EAAE;EACrB;CACF;CACA,gBAAgB;EACd,KAAK;EACL,QAAQ;CACV,CAAC;CACD,gBAAgB;EACd,KAAK;EACL,QAAQ;CACV,CAAC;CACD,MAAM,UAAU,OAAO;EACrB,IAAI,IAAI,SAAS;CACnB,CAAC;CACD,sBAAsB;EACpB,UAAU,oBAAoB,UAAU,QAAQ;EAChD,UAAU,WAAW;CACvB,CAAC;;CAGD,MAAM,WAAW,OAAe,WAC7B,OAAO,MAAM,UAAU,MAAM,QAAQ,MAAM,MAAM,EAAE,MAAM,KAAK,KAAK;CAEtE,OAAO;EAAE;EAAS;EAAS;EAAc;EAAS;CAAQ;AAC5D"}
@@ -15,11 +15,12 @@ function useMeasuredSizes(options) {
15
15
  const known = /* @__PURE__ */ new Map();
16
16
  const touch = useTouchScroll();
17
17
  const version = shallowRef(0);
18
- const sizeOf = (index) => known.get(options.keyOf(index)) ?? options.estimate(index);
19
- const offsets = computed(() => {
18
+ const sizeOf = (index) => {
20
19
  version.value;
21
- return createOffsets(options.count(), sizeOf);
22
- });
20
+ return known.get(options.keyOf(index)) ?? options.estimate(index);
21
+ };
22
+ const offsets = computed(() => createOffsets(options.count(), sizeOf));
23
+ const startOf = (index) => options.start?.(index) ?? offsets.value.start(index);
23
24
  const tracked = /* @__PURE__ */ new Map();
24
25
  const byKey = /* @__PURE__ */ new Map();
25
26
  const heightOf = (key) => {
@@ -42,7 +43,7 @@ function useMeasuredSizes(options) {
42
43
  if (size === before && known.has(key)) continue;
43
44
  known.set(key, size);
44
45
  changed = true;
45
- if (offsets.value.start(index) < top) shift += size - before;
46
+ if (startOf(index) < top) shift += size - before;
46
47
  }
47
48
  if (!changed) return;
48
49
  version.value++;
@@ -1 +1 @@
1
- {"version":3,"file":"use-measured-sizes.js","names":[],"sources":["../../src/composables/use-measured-sizes.ts"],"sourcesContent":["import { computed, onBeforeUnmount, shallowRef } from 'vue'\nimport { createOffsets } from '../components/virtual-list/virtual-list'\nimport { scrollPositionOf } from '../utils/scroll'\nimport { useTouchScroll } from './use-touch-scroll'\n\nexport interface UseMeasuredSizesOptions<K> {\n /** How many items there are. */\n count: () => number\n /** A key that follows an item as the list changes. */\n keyOf: (index: number) => K\n /** The height to assume for an item not measured yet. */\n estimate: (index: number) => number\n /** The element that scrolls, kept steady while items above the view change height. */\n container: () => HTMLElement | null | undefined\n}\n\n/**\n * Item offsets for a list whose items are measured once rendered.\n *\n * Unmeasured items count at their estimate. Rendered items are watched for\n * size changes; when one above the top of the view changes, the scroll\n * position moves by the same amount, so what the reader sees stays put;\n * a move iOS drops during a touch scroll is made once the scroll is over.\n */\nexport function useMeasuredSizes<K>(options: UseMeasuredSizesOptions<K>) {\n const known = new Map<K, number>()\n const touch = useTouchScroll()\n // Bumped when a measurement changes; reading it ties offsets to it.\n const version = shallowRef(0)\n\n const sizeOf = (index: number) => known.get(options.keyOf(index)) ?? options.estimate(index)\n const offsets = computed(() => {\n void version.value\n return createOffsets(options.count(), sizeOf)\n })\n\n // An item can span several elements, e.g. a table row and its detail row.\n const tracked = new Map<Element, { key: K; index: number }>()\n const byKey = new Map<K, Set<Element>>()\n const heightOf = (key: K) => {\n let size = 0\n for (const element of byKey.get(key) ?? []) size += (element as HTMLElement).offsetHeight\n return size\n }\n\n /** Record new heights for `keys`, keeping the view steady above the top. */\n function update(items: Iterable<{ key: K; index: number }>) {\n let shift = 0\n let changed = false\n const el = options.container()\n const top = el ? scrollPositionOf(el).top : 0\n const seen = new Set<K>()\n for (const { key, index } of items) {\n if (seen.has(key)) continue\n seen.add(key)\n const size = heightOf(key)\n const before = sizeOf(index)\n if (size === before && known.has(key)) continue\n known.set(key, size)\n changed = true\n if (offsets.value.start(index) < top) shift += size - before\n }\n if (!changed) return\n version.value++\n if (el && shift) touch.shiftScroll(el, shift)\n }\n\n const observer =\n typeof ResizeObserver === 'undefined'\n ? undefined\n : new ResizeObserver((entries) =>\n update(entries.flatMap((entry) => tracked.get(entry.target) ?? [])),\n )\n\n /** Watch an item's element; call it from a function ref on every render. */\n function track(element: Element | null, key: K, index: number) {\n if (!element) return\n const item = tracked.get(element)\n if (item) {\n if (item.key !== key) {\n byKey.get(item.key)?.delete(element)\n item.key = key\n add(element, key)\n }\n item.index = index\n return\n }\n tracked.set(element, { key, index })\n add(element, key)\n observer?.observe(element)\n }\n function add(element: Element, key: K) {\n let set = byKey.get(key)\n if (!set) byKey.set(key, (set = new Set()))\n set.add(element)\n }\n /** Stop watching elements that left the page, and re-measure what they belonged to. */\n function prune() {\n const touched: { key: K; index: number }[] = []\n for (const [element, item] of tracked) {\n if (element.isConnected) continue\n observer?.unobserve(element)\n tracked.delete(element)\n const set = byKey.get(item.key)\n set?.delete(element)\n // Only re-measure an item still on the page, e.g. a row whose detail closed.\n if (set?.size) touched.push(item)\n else byKey.delete(item.key)\n }\n if (touched.length) update(touched)\n }\n onBeforeUnmount(() => observer?.disconnect())\n\n return { offsets, sizeOf, track, prune }\n}\n"],"mappings":";;;;;;;;;;;;;AAwBA,SAAgB,iBAAoB,SAAqC;CACvE,M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AyB,KAAQ,OAAe;EAC7D,IAAI,CAAC,SAAS;EACd,MAAM,OAAO,QAAQ,IAAI,OAAO;EAChC,IAAI,MAAM;GACR,IAAI,KAAK,QAAQ,KAAK;IACpB,MAAM,IAAI,KAAK,GAAG,CAAC,EAAE,OAAO,OAAO;IACnC,KAAK,MAAM;IACX,IAAI,SAAS,GAAG;GAClB;GACA,KAAK,QAAQ;GACb;EACF;EACA,QAAQ,IAAI,SAAS;GAAE;GAAK;EAAM,CAAC;EACnC,IAAI,SAAS,GAAG;EAChB,UAAU,QAAQ,OAAO;CAC3B;CACA,SAAS,IAAI,SAAkB,KAAQ;EACrC,IAAI,MAAM,MAAM,IAAI,GAAG;EACvB,IAAI,CAAC,KAAK,MAAM,IAAI,KAAM,sBAAM,IAAI,IAAI,CAAE;EAC1C,IAAI,IAAI,OAAO;CACjB;;CAEA,SAAS,QAAQ;EACf,MAAM,UAAuC,CAAC;EAC9C,KAAK,MAAM,CAAC,SAAS,SAAS,SAAS;GACrC,IAAI,QAAQ,aAAa;GACzB,UAAU,UAAU,OAAO;GAC3B,QAAQ,OAAO,OAAO;GACtB,MAAM,MAAM,MAAM,IAAI,KAAK,GAAG;GAC9B,KAAK,OAAO,OAAO;GAEnB,IAAI,KAAK,MAAM,QAAQ,KAAK,IAAI;QAC3B,MAAM,OAAO,KAAK,GAAG;EAC5B;EACA,IAAI,QAAQ,QAAQ,OAAO,OAAO;CACpC;CACA,sBAAsB,UAAU,WAAW,CAAC;CAE5C,OAAO;EAAE;EAAS;EAAQ;EAAO;CAAM;AACzC"}
1
+ {"version":3,"file":"use-measured-sizes.js","names":[],"sources":["../../src/composables/use-measured-sizes.ts"],"sourcesContent":["import { computed, onBeforeUnmount, shallowRef } from 'vue'\nimport { createOffsets } from '../components/virtual-list/virtual-list'\nimport { scrollPositionOf } from '../utils/scroll'\nimport { useTouchScroll } from './use-touch-scroll'\n\nexport interface UseMeasuredSizesOptions<K> {\n /** How many items there are. */\n count: () => number\n /** A key that follows an item as the list changes. */\n keyOf: (index: number) => K\n /** The height to assume for an item not measured yet. */\n estimate: (index: number) => number\n /** The element that scrolls, kept steady while items above the view change height. */\n container: () => HTMLElement | null | undefined\n /**\n * Where an item starts in the scrolled content, when items don't simply\n * follow each other from the top, e.g. under group labels. Defaults to\n * the sum of the sizes before it.\n */\n start?: (index: number) => number\n}\n\n/**\n * Item offsets for a list whose items are measured once rendered.\n *\n * Unmeasured items count at their estimate. Rendered items are watched for\n * size changes; when one above the top of the view changes, the scroll\n * position moves by the same amount, so what the reader sees stays put;\n * a move iOS drops during a touch scroll is made once the scroll is over.\n */\nexport function useMeasuredSizes<K>(options: UseMeasuredSizesOptions<K>) {\n const known = new Map<K, number>()\n const touch = useTouchScroll()\n // Bumped when a measurement changes; reading it ties offsets to it.\n const version = shallowRef(0)\n\n const sizeOf = (index: number) => {\n void version.value\n return known.get(options.keyOf(index)) ?? options.estimate(index)\n }\n const offsets = computed(() => createOffsets(options.count(), sizeOf))\n const startOf = (index: number) => options.start?.(index) ?? offsets.value.start(index)\n\n // An item can span several elements, e.g. a table row and its detail row.\n const tracked = new Map<Element, { key: K; index: number }>()\n const byKey = new Map<K, Set<Element>>()\n const heightOf = (key: K) => {\n let size = 0\n for (const element of byKey.get(key) ?? []) size += (element as HTMLElement).offsetHeight\n return size\n }\n\n /** Record new heights for `keys`, keeping the view steady above the top. */\n function update(items: Iterable<{ key: K; index: number }>) {\n let shift = 0\n let changed = false\n const el = options.container()\n const top = el ? scrollPositionOf(el).top : 0\n const seen = new Set<K>()\n for (const { key, index } of items) {\n if (seen.has(key)) continue\n seen.add(key)\n const size = heightOf(key)\n const before = sizeOf(index)\n if (size === before && known.has(key)) continue\n known.set(key, size)\n changed = true\n if (startOf(index) < top) shift += size - before\n }\n if (!changed) return\n version.value++\n if (el && shift) touch.shiftScroll(el, shift)\n }\n\n const observer =\n typeof ResizeObserver === 'undefined'\n ? undefined\n : new ResizeObserver((entries) =>\n update(entries.flatMap((entry) => tracked.get(entry.target) ?? [])),\n )\n\n /** Watch an item's element; call it from a function ref on every render. */\n function track(element: Element | null, key: K, index: number) {\n if (!element) return\n const item = tracked.get(element)\n if (item) {\n if (item.key !== key) {\n byKey.get(item.key)?.delete(element)\n item.key = key\n add(element, key)\n }\n item.index = index\n return\n }\n tracked.set(element, { key, index })\n add(element, key)\n observer?.observe(element)\n }\n function add(element: Element, key: K) {\n let set = byKey.get(key)\n if (!set) byKey.set(key, (set = new Set()))\n set.add(element)\n }\n /** Stop watching elements that left the page, and re-measure what they belonged to. */\n function prune() {\n const touched: { key: K; index: number }[] = []\n for (const [element, item] of tracked) {\n if (element.isConnected) continue\n observer?.unobserve(element)\n tracked.delete(element)\n const set = byKey.get(item.key)\n set?.delete(element)\n // Only re-measure an item still on the page, e.g. a row whose detail closed.\n if (set?.size) touched.push(item)\n else byKey.delete(item.key)\n }\n if (touched.length) update(touched)\n }\n onBeforeUnmount(() => observer?.disconnect())\n\n return { offsets, sizeOf, track, prune }\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,iBAAoB,SAAqC;CACvE,MAAM,wBAAQ,IAAI,IAAe;CACjC,MAAM,QAAQ,eAAe;CAE7B,MAAM,UAAU,WAAW,CAAC;CAE5B,MAAM,UAAU,UAAkB;EAChC,QAAa;EACb,OAAO,MAAM,IAAI,QAAQ,MAAM,KAAK,CAAC,KAAK,QAAQ,SAAS,KAAK;CAClE;CACA,MAAM,UAAU,eAAe,cAAc,QAAQ,MAAM,GAAG,MAAM,CAAC;CACrE,MAAM,WAAW,UAAkB,QAAQ,QAAQ,KAAK,KAAK,QAAQ,MAAM,MAAM,KAAK;CAGtF,MAAM,0BAAU,IAAI,IAAwC;CAC5D,MAAM,wBAAQ,IAAI,IAAqB;CACvC,MAAM,YAAY,QAAW;EAC3B,IAAI,OAAO;EACX,KAAK,MAAM,WAAW,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,QAAS,QAAwB;EAC7E,OAAO;CACT;;CAGA,SAAS,OAAO,O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