{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-size/index.ts"],"sourcesContent":["import { computed, inject, unref } from 'vue'\r\nimport { buildProp } from '@sgui-plus/utils/props'\r\nimport { componentSizes } from '@sgui-plus/utils/size'\r\n\r\nimport type { InjectionKey, Ref } from 'vue'\r\nimport type { ComponentSize } from '@sgui-plus/utils/size'\r\n\r\nexport const useSizeProp = buildProp({\r\n  type: String,\r\n  values: componentSizes,\r\n  required: false,\r\n} as const)\r\n\r\nexport const useSizeProps = {\r\n  size: useSizeProp,\r\n}\r\n\r\nexport interface SizeContext {\r\n  size: Ref<ComponentSize>\r\n}\r\n\r\nexport const SIZE_INJECTION_KEY: InjectionKey<SizeContext> = Symbol('size')\r\n\r\nexport const useGlobalSize = () => {\r\n  const injectedSize = inject(SIZE_INJECTION_KEY, {} as SizeContext)\r\n\r\n  return computed<ComponentSize>(() => {\r\n    return unref(injectedSize.size) || ''\r\n  })\r\n}\r\n"],"names":[],"mappings":";;;;AAGY,MAAC,WAAW,GAAG,SAAS,CAAC;AACrC,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,MAAM,EAAE,cAAc;AACxB,EAAE,QAAQ,EAAE,KAAK;AACjB,CAAC,EAAE;AACS,MAAC,YAAY,GAAG;AAC5B,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE;AACU,MAAC,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE;AACrC,MAAC,aAAa,GAAG,MAAM;AACnC,EAAE,MAAM,YAAY,GAAG,MAAM,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;AACtD,EAAE,OAAO,QAAQ,CAAC,MAAM;AACxB,IAAI,OAAO,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AAC1C,GAAG,CAAC,CAAC;AACL;;;;"}