index.mjs 677 B

123456789101112131415161718192021
  1. import { componentSizes } from "../../constants/size.mjs";
  2. import { buildProp } from "../../utils/vue/props/runtime.mjs";
  3. import { computed, inject, unref } from "vue";
  4. //#region ../../packages/hooks/use-size/index.ts
  5. const useSizeProp = buildProp({
  6. type: String,
  7. values: componentSizes,
  8. required: false
  9. });
  10. const useSizeProps = { size: useSizeProp };
  11. const SIZE_INJECTION_KEY = Symbol("size");
  12. const useGlobalSize = () => {
  13. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  14. return computed(() => {
  15. return unref(injectedSize.size) || "";
  16. });
  17. };
  18. //#endregion
  19. export { SIZE_INJECTION_KEY, useGlobalSize, useSizeProp, useSizeProps };
  20. //# sourceMappingURL=index.mjs.map