Files
NapCatQQ/.pnpm-store/v3/files/bf/b019966763a246847dcfb106b735d8984783e453048a046734d5a2a6623be4cc2ba5c1da5c69d72854bcc98628e6a366eb16524cf7accc65c52817223e6db8
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

51 lines
1.0 KiB
Plaintext

import type { Cell } from './autotracking'
import {
getValue as consumeTag,
createCell as createStorage,
setValue
} from './autotracking'
export type Tag = Cell<unknown>
const neverEq = (a: any, b: any): boolean => false
export function createTag(): Tag {
return createStorage(null, neverEq)
}
export { consumeTag }
export function dirtyTag(tag: Tag, value: any): void {
setValue(tag, value)
}
export interface Node<
T extends Array<unknown> | Record<string, unknown> =
| Array<unknown>
| Record<string, unknown>
> {
collectionTag: Tag | null
tag: Tag | null
tags: Record<string, Tag>
children: Record<string, Node>
proxy: T
value: T
id: number
}
export const consumeCollection = (node: Node): void => {
let tag = node.collectionTag
if (tag === null) {
tag = node.collectionTag = createTag()
}
consumeTag(tag)
}
export const dirtyCollection = (node: Node): void => {
const tag = node.collectionTag
if (tag !== null) {
dirtyTag(tag, null)
}
}