You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
2.2 KiB

{"ast":null,"code":"import { inject, computed, unref } from 'vue';\nimport '../../utils/index.mjs';\nimport '../../constants/index.mjs';\nimport { buildProp } from '../../utils/vue/props/runtime.mjs';\nimport { componentSizes } from '../../constants/size.mjs';\nconst useSizeProp = buildProp({\n type: String,\n values: componentSizes,\n required: false\n});\nconst useSizeProps = {\n size: useSizeProp\n};\nconst SIZE_INJECTION_KEY = Symbol(\"size\");\nconst useGlobalSize = () => {\n const injectedSize = inject(SIZE_INJECTION_KEY, {});\n return computed(() => {\n return unref(injectedSize.size) || \"\";\n });\n};\nexport { SIZE_INJECTION_KEY, useGlobalSize, useSizeProp, useSizeProps };","map":{"version":3,"names":["useSizeProp","buildProp","type","String","values","componentSizes","required","useSizeProps","size","SIZE_INJECTION_KEY","Symbol","useGlobalSize","injectedSize","inject","computed","unref"],"sources":["../../../../../packages/hooks/use-size/index.ts"],"sourcesContent":["import { computed, inject, unref } from 'vue'\nimport { buildProp } from '@element-plus/utils'\nimport { componentSizes } from '@element-plus/constants'\n\nimport type { InjectionKey, Ref } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\n\nexport const useSizeProp = buildProp({\n type: String,\n values: componentSizes,\n required: false,\n} as const)\n\nexport const useSizeProps = {\n size: useSizeProp,\n}\n\nexport interface SizeContext {\n size: Ref<ComponentSize>\n}\n\nexport const SIZE_INJECTION_KEY: InjectionKey<SizeContext> = Symbol('size')\n\nexport const useGlobalSize = () => {\n const injectedSize = inject(SIZE_INJECTION_KEY, {} as SizeContext)\n\n return computed<ComponentSize>(() => {\n return unref(injectedSize.size) || ''\n })\n}\n"],"mappings":";;;;;AAGY,MAACA,WAAW,GAAGC,SAAS,CAAC;EACnCC,IAAI,EAAEC,MAAM;EACZC,MAAM,EAAEC,cAAc;EACtBC,QAAQ,EAAE;AACZ,CAAC;AACW,MAACC,YAAY,GAAG;EAC1BC,IAAI,EAAER;AACR;AACY,MAACS,kBAAkB,GAAGC,MAAM,CAAC,MAAM;AACnC,MAACC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAMC,YAAY,GAAGC,MAAM,CAACJ,kBAAkB,EAAE,EAAE,CAAC;EACnD,OAAOK,QAAQ,CAAC,MAAM;IACpB,OAAOC,KAAK,CAACH,YAAY,CAACJ,IAAI,CAAC,IAAI,EAAE;EACzC,CAAG,CAAC;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}