Files
webstudio/apps/builder/app/shared/pubsub/index.ts
T
Bogdan Chadkin 45aca18843 feat: select sibling after delete instance (#2476)
Quite requested improvement. Instead of selecting parent on delete
select next or previous sibling to be able to clean items within
collections with minimal amount of actions.

For testing
- delete first item in a list
- delete last item in a list
- delete the only item in a list
2023-10-15 12:49:22 +04:00

17 lines
400 B
TypeScript

import { atom } from "nanostores";
import { createPubsub } from "./create";
export interface PubsubMap {
command: {
source: string;
name: string;
};
}
export const { publish, usePublish, useSubscribe, subscribe } =
createPubsub<PubsubMap>();
export type Publish = typeof publish;
export type UsePublish = typeof usePublish;
export const $publisher = atom<{ publish?: Publish }>({});