设计tracer

This commit is contained in:
2025-10-27 17:03:08 +08:00
parent bac4df0e24
commit beac8e222b
3 changed files with 43 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
export const ARRAY_TRACER_ACTIONS = [
'define',
'preset',
'expand',
'reduce',
'pick',
'drop',
'patch',
'reset',
] as const;
export type ArrayTracerAction = (typeof ARRAY_TRACER_ACTIONS)[number];
export const STACK_TRACER_ACTIONS = [
//
'define',
'push',
] as const;
export type StackTracerAction = (typeof STACK_TRACER_ACTIONS)[number];
export type TracerAction = ArrayTracerAction | StackTracerAction;

View File

@@ -13,9 +13,8 @@ type TracerTypeKey = keyof typeof TracerType;
type TracerTypeVal = (typeof TracerType)[TracerTypeKey];
const Action = {
const ArrayTracerAction = {
Define: 'define',
Preset: 'preset',
Expand: 'expand',
Reduce: 'reduce',
@@ -25,6 +24,14 @@ const Action = {
Reset: 'reset',
} as const;
type ArrayTracerActionKey = keyof typeof ArrayTracerAction;
type ArrayTracerActionVal = (typeof ArrayTracerAction)[ArrayTracerActionKey];
const Action = {
...ArrayTracerAction,
} as const;
type ActionKey = keyof typeof Action;
type ActionVal = (typeof Action)[ActionKey];

View File

@@ -0,0 +1,12 @@
export const TRACER_TYPES = [
'ArrayTracer',
'StackTracer',
'QueueTracer',
'MatrixTracer',
'SortTracer',
'LinkTracer',
'TreeTracer',
'GraphTracer',
] as const;
export type TracerType = typeof TRACER_TYPES[number];