Skip to content

Commit 147b98f

Browse files
committed
feat: 新增 StepAttribute GlobalAttribute useStepAttribute useGlobalAttribute useGlobal
1 parent 014f6f5 commit 147b98f

12 files changed

+165
-34
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "next-flow-interface",
3-
"version": "0.23.26",
3+
"version": "0.23.27",
44
"description": "Interface package for NEXT FlOW. You can use this package to build your own plugin that can control anything.",
55
"type": "module",
66
"module": "dist/index.js",

src/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { RsdSwitchProps } from '@/components/rsd/rsd-switch-props'
3333
import { RsdTargetInfoProps } from '@/components/rsd/rsd-target-info-props'
3434
import { RsdTitleProps } from '@/components/rsd/rsd-title-props'
3535
import { UseAllSelectedInfo } from '@/hook/use-all-selected-info.type'
36-
import { UseBase } from '@/hook/use-base.type'
36+
import { UseGlobal } from '@/hook/use-global.type'
3737
import { UseLastSelectedInfo } from '@/hook/use-last-selected-info.type'
3838
import { UseSelectedInfo } from '@/hook/use-selected-info.type'
3939
import { UseSelectedMaterialInfo } from '@/hook/use-selected-material-info.type'
@@ -187,7 +187,7 @@ export let targetStepService: TargetStepServiceApi
187187
export let showAttributeContextMenu: ShowAttributeContextMenu<unknown>
188188

189189
export let useAllSelectedInfo: UseAllSelectedInfo
190-
export let useBase: UseBase
190+
export let useBase: UseGlobal
191191
export let useLastSelectedInfo: UseLastSelectedInfo
192192
export let useSelectedInfo: UseSelectedInfo
193193
export let useSelectedMaterialInfo: UseSelectedMaterialInfo

src/hook/use-base.type.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { RecursiveCrossRhineVar, RvPath, StoredRhineVar } from 'rhine-var'
2+
3+
import IGlobalAttribute, {
4+
GlobalAttributeSubscriber,
5+
} from '@/service/sync/attribute/instance/global-attribute.interface'
6+
7+
export type UseGlobalAttribute = <T extends object = never>(
8+
path: string | RvPath,
9+
) => {
10+
state: StoredRhineVar<T> | T
11+
path: RvPath
12+
globalAttribute: IGlobalAttribute<T>
13+
initialize(): void
14+
isInitialized(): boolean
15+
mark(path: string | RvPath): void
16+
get(): RecursiveCrossRhineVar<T> | undefined
17+
set(path: string | RvPath, value: unknown): void
18+
read(): StoredRhineVar<T> | T | undefined
19+
edit(path: string | RvPath, value: unknown): void
20+
editMany(list: [string | RvPath, unknown][]): void
21+
subscribe(subscriber: GlobalAttributeSubscriber<T>): () => void
22+
unsubscribe(subscriber: GlobalAttributeSubscriber<T>): void
23+
}

src/hook/use-global.type.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export type UseGlobal = <T = unknown>(
2+
path?: string,
3+
) => {
4+
state: T
5+
}

src/hook/use-target-node-attribute.type.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ export type UseTargetNodeAttribute = <T extends object = never>(
1010
state: StoredRhineVar<T> | T
1111
path: RvPath
1212
sid: string
13-
sidList: string[]
1413
nid: string
1514
nidList: string[]
16-
NodeAttribute: INodeAttribute<T>
15+
nodeAttribute: INodeAttribute<T>
1716
initialize(nid?: string): void
1817
isInitialized(nid?: string): boolean
1918
multiInitialize(nidList?: string[]): void
@@ -28,6 +27,8 @@ export type UseTargetNodeAttribute = <T extends object = never>(
2827
multiRead(sidList?: string[], nidList?: string[]): Map<string, Map<string, StoredRhineVar<T> | T>>
2928
edit(path: string | RvPath, value: unknown, sid?: string, nid?: string): void
3029
multiEdit(path: string | RvPath, value: unknown, sidList?: string[], nidList?: string[]): void
30+
editMany(list: [string | RvPath, unknown][], sid?: string, nid?: string): void
31+
multiEditMany(list: [string | RvPath, unknown][], sidList?: string[], nidList?: string[]): void
3132
subscribe(subscriber: NodeAttributeTargetSubscriber<T>): () => void
3233
unsubscribe(subscriber: NodeAttributeTargetSubscriber<T>): void
3334
}

src/hook/use-target-node.type.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ import { RvPath } from 'rhine-var'
33
export type UseTargetNode = <T = unknown>(
44
path?: string | RvPath,
55
) => {
6+
state: T | null
67
sid: string
78
nid: string
8-
state: T | null
9-
set: (key: string | RvPath, value: unknown) => void
10-
multiSet: (key: string | RvPath, value: unknown) => void
11-
mark: (key: string | RvPath) => void
12-
multiMark: (key: string | RvPath) => void
9+
nidList: string[]
1310
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { RecursiveCrossRhineVar, RvPath, StoredRhineVar } from 'rhine-var'
2+
3+
import IStepAttribute, {
4+
StepAttributeTargetSubscriber,
5+
} from '@/service/sync/attribute/instance/step-attribute.interface'
6+
7+
export type UseTargetStepAttribute = <T extends object = never>(
8+
path: string | RvPath,
9+
) => {
10+
state: StoredRhineVar<T> | T
11+
path: RvPath
12+
sid: string
13+
stepAttribute: IStepAttribute<T>
14+
initialize(): void
15+
isInitialized(): boolean
16+
mark(path: string | RvPath, sid?: string): void
17+
multiMark(path: string | RvPath, sidList?: string[]): void
18+
get(sid?: string): RecursiveCrossRhineVar<T> | undefined
19+
multiGet(sidList?: string[]): Map<string, StoredRhineVar<T>>
20+
set(path: string | RvPath, value: unknown, sid?: string): void
21+
multiSet(path: string | RvPath, value: unknown, sidList?: string[]): void
22+
read(sid?: string): StoredRhineVar<T> | T | undefined
23+
multiRead(sidList?: string[]): Map<string, StoredRhineVar<T> | T>
24+
edit(path: string | RvPath, value: unknown, sid?: string): void
25+
multiEdit(path: string | RvPath, value: unknown, sidList?: string[]): void
26+
editMany(list: [string | RvPath, unknown][], sid?: string): void
27+
multiEditMany(list: [string | RvPath, unknown][], sidList?: string[]): void
28+
subscribe(subscriber: StepAttributeTargetSubscriber<T>): () => void
29+
unsubscribe(subscriber: StepAttributeTargetSubscriber<T>): void
30+
}

src/hook/use-target-step.type.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { RvPath } from 'rhine-var'
33
export type UseTargetStep = <T = unknown>(
44
path?: string | RvPath,
55
) => {
6-
sid: string
76
state: T
8-
set: (key: string | RvPath, value: unknown) => void
9-
mark: (key: string | RvPath) => void
7+
sid: string
108
}

src/index.ts

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,15 @@ import DomNotFoundError from './error/dom-not-found.error'
6767
import NotFoundError from './error/not-found.error'
6868
import StaticClassInstantiationError from './error/static-class-instantiation.error'
6969
import { UseAllSelectedInfo } from './hook/use-all-selected-info.type'
70-
import { UseBase } from './hook/use-base.type'
70+
import { UseGlobalAttribute } from './hook/use-global-attribute.type'
71+
import { UseGlobal } from './hook/use-global.type'
7172
import { UseLastSelectedInfo } from './hook/use-last-selected-info.type'
7273
import { UseSelectedInfo } from './hook/use-selected-info.type'
7374
import { UseSelectedMaterialInfo } from './hook/use-selected-material-info.type'
7475
import { UseStepOptions } from './hook/use-step-options.type'
7576
import { UseTargetNodeAttribute } from './hook/use-target-node-attribute.type'
7677
import { UseTargetNode } from './hook/use-target-node.type'
78+
import { UseTargetStepAttribute } from './hook/use-target-step-attribute.type'
7779
import { UseTargetStep } from './hook/use-target-step.type'
7880
import BasePlugin from './plugin/base-plugin'
7981
import DialogPlugin from './plugin/dialog-plugin'
@@ -238,8 +240,12 @@ import UserAuth from './service/main/user/dto/user-auth.interface'
238240
import UserInfo from './service/main/user/dto/user-info.interface'
239241
import UserServiceApi from './service/main/user/user-service-api'
240242
import { AttributeType } from './service/sync/attribute/dto/attribute-type.enum'
241-
import IGlobalAttribute from './service/sync/attribute/instance/global-attribute.interface'
242-
import IStepAttribute from './service/sync/attribute/instance/step-attribute.interface'
243+
import IGlobalAttribute, {
244+
GlobalAttributeSubscriber,
245+
} from './service/sync/attribute/instance/global-attribute.interface'
246+
import IStepAttribute, {
247+
StepAttributeTargetSubscriber,
248+
} from './service/sync/attribute/instance/step-attribute.interface'
243249
import AttributeServiceApi from './service/sync/attribute/service/attribute-service-api'
244250
import TargetMultiNodeServiceApi, {
245251
TargetMultiNodeSubscriber,
@@ -340,12 +346,6 @@ import UrlUtils from './utils/url-utils'
340346
import VectorUtils from './utils/vector-utils'
341347

342348
export type {
343-
AttributeServiceApi,
344-
IBaseAttribute,
345-
IStepAttribute,
346-
INodeAttribute,
347-
IGlobalAttribute,
348-
IAttribute,
349349
Intl,
350350
MeetingState,
351351
PluginState,
@@ -489,9 +489,6 @@ export type {
489489
SelectedSubscriber,
490490
LastSubscriber,
491491
RsSelectionState,
492-
UseBase,
493-
UseTargetStep,
494-
UseTargetNode,
495492
UseStepOptions,
496493
V2,
497494
V3,
@@ -578,7 +575,20 @@ export type {
578575
ShowAttributeContextMenuOptions,
579576
StepBlockSelectProps,
580577
TargetMultiNodeServiceApi,
578+
UseGlobal,
579+
UseGlobalAttribute,
580+
UseTargetStep,
581+
UseTargetStepAttribute,
582+
UseTargetNode,
581583
UseTargetNodeAttribute,
584+
AttributeServiceApi,
585+
IAttribute,
586+
IBaseAttribute,
587+
IGlobalAttribute,
588+
GlobalAttributeSubscriber,
589+
IStepAttribute,
590+
StepAttributeTargetSubscriber,
591+
INodeAttribute,
582592
NodeAttributeTargetSubscriber,
583593
}
584594

0 commit comments

Comments
 (0)