import { h } from '@stencil/core';
export const createContext = (defaultValue) => {
  const Provider = (props, children) => {
    let resolvedValue = (props && props.value) || defaultValue;
    return h("sc-provider", { STENCIL_CONTEXT: resolvedValue }, children);
  };
  const Consumer = (_, children) => {
    if (!children.length) {
      return console.warn('[sc-context] You must pass <Consumer> a single child that is a Function.');
    }
    const renderer = children[0];
    if (!(renderer instanceof Function)) {
      return console.warn('[sc-context] <Consumer> first child must be a Function.');
    }
    return h("sc-consumer", { renderer: renderer });
  };
  return {
    Provider,
    Consumer,
  };
};
