import {
  SlotDefinition as BaseSlotDefinition,
  SlotControl,
  StableValue
} from "@makeswift/controls";
import { renderSlot } from "../runtimes/react/controls/slot";
class BaseDefinition extends BaseSlotDefinition {
}
class SlotDefinition extends BaseDefinition {
  static deserialize(data) {
    if (data.type !== SlotDefinition.type) {
      throw new Error(`Slot: expected type ${SlotDefinition.type}, got ${data.type}`);
    }
    return Slot();
  }
  resolveValue(data, _resolver, _stylesheet, control) {
    const stableValue = StableValue({
      name: SlotDefinition.type,
      read: () => renderSlot({ data, control: control ?? null })
    });
    return {
      ...stableValue,
      triggerResolve: async () => {
      }
    };
  }
}
function Slot() {
  return new SlotDefinition();
}
export {
  Slot,
  SlotControl,
  SlotDefinition
};
//# sourceMappingURL=slot.js.map