feat: sandbox plugins in null-origin iframes with postMessage RPC
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
'use client';
|
||||
|
||||
// Reactive accessor for sandboxed plugin slot offers. Components that gate
|
||||
// layout on the *presence* of a plugin-supplied slot (e.g. a detail
|
||||
// sidebar) read from here instead of the legacy `usePluginStore.slots` map.
|
||||
|
||||
import { useSyncExternalStore } from 'react';
|
||||
import type { SlotName } from '@/lib/plugin-types';
|
||||
import { offersForSlot, subscribe } from '@/lib/plugin-sandbox/registry';
|
||||
|
||||
export function usePluginSlotOffers(slotName: SlotName) {
|
||||
return useSyncExternalStore(
|
||||
subscribe,
|
||||
() => offersForSlot(slotName),
|
||||
() => [],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user