UNPKG

@wetspace/pro-components

Version:
28 lines (27 loc) 800 B
import { SymbolState as r } from "../layout/pro-page-labels/symbol.mjs"; import { inject as m } from "vue"; const v = () => { const { labelsMap: i } = m(r, {}); return { addPageLabel: (a, t, n = !1) => { const o = Object.values(i.value); let e, s = a; return n ? e = o.find((l) => l.labelinfo.pageKey === t.pageKey) : e = o.find((l) => l.uuid === a), e ? (s = e.uuid, i.value[e.uuid] = { ...e, createTime: t.isHome ? 0 : e.createTime, labelinfo: t }) : i.value[a] = { createTime: t.isHome ? 0 : (/* @__PURE__ */ new Date()).getTime(), labelinfo: t, isLeavedToEnter: !0, uuid: a }, s; }, leavedPageItem: (a) => { i.value[a].isLeavedToEnter = !1; } }; }; export { v as usePageLabels };