import { reactive, readonly, provide, inject } from 'vue';

function createContextFn(key = Symbol("InjectionKey"), context, options = {}) {
  const { writeable = false, reactiveable = true } = options;
  const reactiveContext = reactive(context);
  let provideData;
  if (!reactiveable)
    provideData = context;
  else
    provideData = !writeable ? readonly(reactiveContext) : reactiveContext;
  provide(key, provideData);
}
function useContext(key = Symbol("InjectionKey"), defaultValue) {
  return inject(key, defaultValue || {});
}

export { createContextFn, useContext };
//# sourceMappingURL=index.mjs.map
