@cck-ui/core 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -320,13 +320,6 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
320
320
  const hasResponsive = (0, vue.computed)(() => parsedStyleProps.value.hasResponsiveStyles);
321
321
  const responsiveClassName = (0, vue.ref)(null);
322
322
  let currentStyleKey = null;
323
- function buildMediaQueriesFromObject(mediaObj) {
324
- if (!mediaObj) return [];
325
- return Object.entries(mediaObj).map(([query, styles]) => ({
326
- query,
327
- styles
328
- }));
329
- }
330
323
  function updateResponsiveStyles() {
331
324
  if (currentStyleKey) {
332
325
  require_responsive_style_manager.responsiveStyleManager.unregister(currentStyleKey);
@@ -334,7 +327,7 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
334
327
  responsiveClassName.value = null;
335
328
  }
336
329
  if (!hasResponsive) return;
337
- const mediaArray = buildMediaQueriesFromObject(parsedStyleProps.value.media);
330
+ const mediaArray = parsedStyleProps.value.media || [];
338
331
  const className = require_hash_styles.hashStyleProps(parsedStyleProps.value.styles, mediaArray);
339
332
  const cssText = require_styles_to_string.stylesToString({
340
333
  selector: className,
@@ -397,7 +390,6 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
397
390
  set currentStyleKey(v) {
398
391
  currentStyleKey = v;
399
392
  },
400
- buildMediaQueriesFromObject,
401
393
  updateResponsiveStyles,
402
394
  _props,
403
395
  rootTag
@@ -1 +1 @@
1
- {"version":3,"file":"box.cjs","names":[],"sources":["../../../src/core/box/box.vue"],"sourcesContent":["<template>\n <component ref=\"_root\" :is=\"rootTag\" v-bind=\"_props\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport cx from 'clsx'\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { isNumberLike } from '../utils'\nimport type { BoxComponentProps } from './box.types'\nimport { useCckTheme } from '../config-provider'\nimport { extractStyleProps, parseStyleProps, STYLE_PROPS_DATA } from './style-props'\nimport { getBoxStyle } from './get-box-style/get-box-style'\nimport {\n hashStyleProps,\n responsiveStyleManager,\n StylesMediaQuery,\n stylesToString,\n} from '../responsive-style-manager'\nimport { getBoxMod } from './get-box-mod/get-box-mod'\n\ndefineOptions({\n name: 'CBox',\n})\n\nconst _root = ref<HTMLElement | null>(null)\n\nconst props = withDefaults(\n defineProps<\n BoxComponentProps & {\n className: string\n renderRoot?: (props: Record<string, any>) => any\n tag?: any\n }\n >(),\n {\n tag: 'div',\n }\n)\n\nconst theme = useCckTheme()\n\nconst parsedStyleProps = computed(() => {\n const { styleProps, rest } = extractStyleProps(props)\n return {\n ...parseStyleProps({\n styleProps,\n theme: theme.value,\n data: STYLE_PROPS_DATA,\n }),\n rest,\n }\n})\n\nconst hasResponsive = computed(() => parsedStyleProps.value.hasResponsiveStyles)\nconst responsiveClassName = ref<string | null>(null)\nlet currentStyleKey: string | null = null\n\nfunction buildMediaQueriesFromObject(\n mediaObj: Record<string, any> | undefined\n): StylesMediaQuery[] {\n if (!mediaObj) {\n return []\n }\n return Object.entries(mediaObj).map(([query, styles]) => ({\n query,\n styles,\n }))\n}\n\nfunction updateResponsiveStyles() {\n if (currentStyleKey) {\n responsiveStyleManager.unregister(currentStyleKey)\n currentStyleKey = null\n responsiveClassName.value = null\n }\n\n if (!hasResponsive) {\n return\n }\n\n const mediaArray = buildMediaQueriesFromObject(parsedStyleProps.value.media)\n const hash = hashStyleProps(parsedStyleProps.value.styles, mediaArray)\n const className = hash\n\n const cssText = stylesToString({\n selector: className,\n styles: parsedStyleProps.value.styles,\n media: mediaArray,\n })\n\n const registeredKey = responsiveStyleManager.register(cssText, className)\n currentStyleKey = registeredKey\n responsiveClassName.value = className\n}\n\nupdateResponsiveStyles()\n\nwatch(\n () => [parsedStyleProps.value.styles, parsedStyleProps.value.media],\n () => {\n updateResponsiveStyles()\n },\n { deep: true, immediate: false }\n)\n\nonBeforeUnmount(() => {\n if (currentStyleKey) {\n responsiveStyleManager.unregister(currentStyleKey)\n }\n})\n\nconst _props = computed(() => {\n const { rest, inlineStyles } = parsedStyleProps.value\n\n const finalStyle = getBoxStyle({\n theme: theme.value,\n style: props.style,\n vars: props.__vars,\n styleProps: inlineStyles,\n })\n\n const finalClassName = cx(props.className, responsiveClassName.value, {\n 'c-light-hidden': props.lightHidden,\n 'c-dark-hidden': props.darkHidden,\n [`c-hidden-from-${props.hiddenFrom}`]: props.hiddenFrom,\n [`c-visible-from-${props.visibleFrom}`]: props.visibleFrom,\n })\n\n const {\n tag,\n style,\n __vars,\n className,\n variant,\n mod,\n size,\n hiddenFrom,\n visibleFrom,\n lightHidden,\n darkHidden,\n __size,\n ...restProps\n } = rest || {}\n\n return {\n ...restProps,\n style: finalStyle,\n className: finalClassName,\n 'data-variant': props.variant,\n 'data-size': isNumberLike(props.size) ? undefined : props.size || undefined,\n size: props.__size,\n ...getBoxMod(props.mod),\n }\n})\n\nconst rootTag = computed(() => {\n if (props.renderRoot) {\n return (p: Record<string, any>) => p.renderRoot(p)\n }\n\n return props.tag\n})\n\ndefineExpose({\n root: _root,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BA,MAAM,SAAA,GAAA,IAAA,IAAA,CAAgC,IAAI;EAE1C,MAAM,QAAQ;EAad,MAAM,QAAQ,gCAAA,YAAY;EAE1B,MAAM,oBAAA,GAAA,IAAA,SA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B;GAEhD,MAAM,aAAa,sBAAA,YAAY;IAC7B,OAAO,MAAM;IACb,OAAO,MAAM;IACb,MAAM,MAAM;IACZ,YAAY;GACd,CAAC;GAED,MAAM,kBAAA,GAAA,KAAA,QAAA,CAAoB,MAAM,WAAW,oBAAoB,OAAO;IACpE,kBAAkB,MAAM;IACxB,iBAAiB,MAAM;KACtB,iBAAiB,MAAM,eAAe,MAAM;KAC5C,kBAAkB,MAAM,gBAAgB,MAAM;GACjD,CAAC;GAED,MAAM,EACJ,KACA,OACA,QACA,WACA,SACA,KACA,MACA,YACA,aACA,aACA,YACA,QACA,GAAG,cACD,QAAQ,CAAC;GAEb,OAAO;IACL,GAAG;IACH,OAAO;IACP,WAAW;IACX,gBAAgB,MAAM;IACtB,aAAa,uBAAA,aAAa,MAAM,IAAI,IAAI,KAAA,IAAY,MAAM,QAAQ,KAAA;IAClE,MAAM,MAAM;IACZ,GAAG,oBAAA,UAAU,MAAM,GAAG;GACxB;EACF,CAAC;EAED,MAAM,WAAA,GAAA,IAAA,SAAA,OAAyB;GAC7B,IAAI,MAAM,YACR,QAAQ,MAA2B,EAAE,WAAW,CAAC;GAGnD,OAAO,MAAM;EACf,CAAC;EAED,SAAa,EACX,MAAM,MACR,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;oFAtK6B,OAAA,OAAO,IAAA,GAAA,IAAA,WAAA,CAEvB,EAFD,KAAI,QAAO,GAAuB,OAAA,MAAM,GAAA;kCACzC,EAAA,GAAA,IAAA,WAAA,CAAA,KAAA,QAAA,SAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"box.cjs","names":[],"sources":["../../../src/core/box/box.vue"],"sourcesContent":["<template>\n <component ref=\"_root\" :is=\"rootTag\" v-bind=\"_props\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport cx from 'clsx'\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { isNumberLike } from '../utils'\nimport type { BoxComponentProps } from './box.types'\nimport { useCckTheme } from '../config-provider'\nimport { extractStyleProps, parseStyleProps, STYLE_PROPS_DATA } from './style-props'\nimport { getBoxStyle } from './get-box-style/get-box-style'\nimport {\n hashStyleProps,\n responsiveStyleManager,\n StylesMediaQuery,\n stylesToString,\n} from '../responsive-style-manager'\nimport { getBoxMod } from './get-box-mod/get-box-mod'\n\ndefineOptions({\n name: 'CBox',\n})\n\nconst _root = ref<HTMLElement | null>(null)\n\nconst props = withDefaults(\n defineProps<\n BoxComponentProps & {\n className: string\n renderRoot?: (props: Record<string, any>) => any\n tag?: any\n }\n >(),\n {\n tag: 'div',\n }\n)\n\nconst theme = useCckTheme()\n\nconst parsedStyleProps = computed(() => {\n const { styleProps, rest } = extractStyleProps(props)\n return {\n ...parseStyleProps({\n styleProps,\n theme: theme.value,\n data: STYLE_PROPS_DATA,\n }),\n rest,\n }\n})\n\nconst hasResponsive = computed(() => parsedStyleProps.value.hasResponsiveStyles)\nconst responsiveClassName = ref<string | null>(null)\nlet currentStyleKey: string | null = null\n\nfunction updateResponsiveStyles() {\n if (currentStyleKey) {\n responsiveStyleManager.unregister(currentStyleKey)\n currentStyleKey = null\n responsiveClassName.value = null\n }\n\n if (!hasResponsive) {\n return\n }\n\n const mediaArray = parsedStyleProps.value.media || []\n const hash = hashStyleProps(parsedStyleProps.value.styles, mediaArray)\n const className = hash\n\n const cssText = stylesToString({\n selector: className,\n styles: parsedStyleProps.value.styles,\n media: mediaArray,\n })\n\n const registeredKey = responsiveStyleManager.register(cssText, className)\n currentStyleKey = registeredKey\n responsiveClassName.value = className\n}\n\nupdateResponsiveStyles()\n\nwatch(\n () => [parsedStyleProps.value.styles, parsedStyleProps.value.media],\n () => {\n updateResponsiveStyles()\n },\n { deep: true, immediate: false }\n)\n\nonBeforeUnmount(() => {\n if (currentStyleKey) {\n responsiveStyleManager.unregister(currentStyleKey)\n }\n})\n\nconst _props = computed(() => {\n const { rest, inlineStyles } = parsedStyleProps.value\n\n const finalStyle = getBoxStyle({\n theme: theme.value,\n style: props.style,\n vars: props.__vars,\n styleProps: inlineStyles,\n })\n\n const finalClassName = cx(props.className, responsiveClassName.value, {\n 'c-light-hidden': props.lightHidden,\n 'c-dark-hidden': props.darkHidden,\n [`c-hidden-from-${props.hiddenFrom}`]: props.hiddenFrom,\n [`c-visible-from-${props.visibleFrom}`]: props.visibleFrom,\n })\n\n const {\n tag,\n style,\n __vars,\n className,\n variant,\n mod,\n size,\n hiddenFrom,\n visibleFrom,\n lightHidden,\n darkHidden,\n __size,\n ...restProps\n } = rest || {}\n\n return {\n ...restProps,\n style: finalStyle,\n className: finalClassName,\n 'data-variant': props.variant,\n 'data-size': isNumberLike(props.size) ? undefined : props.size || undefined,\n size: props.__size,\n ...getBoxMod(props.mod),\n }\n})\n\nconst rootTag = computed(() => {\n if (props.renderRoot) {\n return (p: Record<string, any>) => p.renderRoot(p)\n }\n\n return props.tag\n})\n\ndefineExpose({\n root: _root,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BA,MAAM,SAAA,GAAA,IAAA,IAAA,CAAgC,IAAI;EAE1C,MAAM,QAAQ;EAad,MAAM,QAAQ,gCAAA,YAAY;EAE1B,MAAM,oBAAA,GAAA,IAAA,SAAA,OAAkC;GACtC,MAAM,EAAE,YAAY,SAAS,4BAAA,kBAAkB,KAAK;GACpD,OAAO;IACL,GAAG,0BAAA,gBAAgB;KACjB;KACA,OAAO,MAAM;KACb,MAAM,yBAAA;IAC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GAED,MAAM,EACJ,KACA,OACA,QACA,WACA,SACA,KACA,MACA,YACA,aACA,aACA,YACA,QACA,GAAG,cACD,QAAQ,CAAC;GAEb,OAAO;IACL,GAAG;IACH,OAAO;IACP,WAAW;IACX,gBAAgB,MAAM;IACtB,aAAa,uBAAA,aAAa,MAAM,IAAI,IAAI,KAAA,IAAY,MAAM,QAAQ,KAAA;IAClE,MAAM,MAAM;IACZ,GAAG,oBAAA,UAAU,MAAM,GAAG;GACxB;EACF,CAAC;EAED,MAAM,WAAA,GAAA,IAAA,SAAA,OAAyB;GAC7B,IAAI,MAAM,YACR,QAAQ,MAA2B,EAAE,WAAW,CAAC;GAGnD,OAAO,MAAM;EACf,CAAC;EAED,SAAa,EACX,MAAM,MACR,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;oFA1J6B,OAAA,OAAO,IAAA,GAAA,IAAA,WAAA,CAEvB,EAFD,KAAI,QAAO,GAAuB,OAAA,MAAM,GAAA;kCACzC,EAAA,GAAA,IAAA,WAAA,CAAA,KAAA,QAAA,SAAA,CAAA,CAAA"}
@@ -318,13 +318,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
318
318
  const hasResponsive = computed(() => parsedStyleProps.value.hasResponsiveStyles);
319
319
  const responsiveClassName = ref(null);
320
320
  let currentStyleKey = null;
321
- function buildMediaQueriesFromObject(mediaObj) {
322
- if (!mediaObj) return [];
323
- return Object.entries(mediaObj).map(([query, styles]) => ({
324
- query,
325
- styles
326
- }));
327
- }
328
321
  function updateResponsiveStyles() {
329
322
  if (currentStyleKey) {
330
323
  responsiveStyleManager.unregister(currentStyleKey);
@@ -332,7 +325,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
332
325
  responsiveClassName.value = null;
333
326
  }
334
327
  if (!hasResponsive) return;
335
- const mediaArray = buildMediaQueriesFromObject(parsedStyleProps.value.media);
328
+ const mediaArray = parsedStyleProps.value.media || [];
336
329
  const className = hashStyleProps(parsedStyleProps.value.styles, mediaArray);
337
330
  const cssText = stylesToString({
338
331
  selector: className,
@@ -395,7 +388,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
395
388
  set currentStyleKey(v) {
396
389
  currentStyleKey = v;
397
390
  },
398
- buildMediaQueriesFromObject,
399
391
  updateResponsiveStyles,
400
392
  _props,
401
393
  rootTag
@@ -1 +1 @@
1
- {"version":3,"file":"box.mjs","names":[],"sources":["../../../src/core/box/box.vue"],"sourcesContent":["<template>\n <component ref=\"_root\" :is=\"rootTag\" v-bind=\"_props\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport cx from 'clsx'\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { isNumberLike } from '../utils'\nimport type { BoxComponentProps } from './box.types'\nimport { useCckTheme } from '../config-provider'\nimport { extractStyleProps, parseStyleProps, STYLE_PROPS_DATA } from './style-props'\nimport { getBoxStyle } from './get-box-style/get-box-style'\nimport {\n hashStyleProps,\n responsiveStyleManager,\n StylesMediaQuery,\n stylesToString,\n} from '../responsive-style-manager'\nimport { getBoxMod } from './get-box-mod/get-box-mod'\n\ndefineOptions({\n name: 'CBox',\n})\n\nconst _root = ref<HTMLElement | null>(null)\n\nconst props = withDefaults(\n defineProps<\n BoxComponentProps & {\n className: string\n renderRoot?: (props: Record<string, any>) => any\n tag?: any\n }\n >(),\n {\n tag: 'div',\n }\n)\n\nconst theme = useCckTheme()\n\nconst parsedStyleProps = computed(() => {\n const { styleProps, rest } = extractStyleProps(props)\n return {\n ...parseStyleProps({\n styleProps,\n theme: theme.value,\n data: STYLE_PROPS_DATA,\n }),\n rest,\n }\n})\n\nconst hasResponsive = computed(() => parsedStyleProps.value.hasResponsiveStyles)\nconst responsiveClassName = ref<string | null>(null)\nlet currentStyleKey: string | null = null\n\nfunction buildMediaQueriesFromObject(\n mediaObj: Record<string, any> | undefined\n): StylesMediaQuery[] {\n if (!mediaObj) {\n return []\n }\n return Object.entries(mediaObj).map(([query, styles]) => ({\n query,\n styles,\n }))\n}\n\nfunction updateResponsiveStyles() {\n if (currentStyleKey) {\n responsiveStyleManager.unregister(currentStyleKey)\n currentStyleKey = null\n responsiveClassName.value = null\n }\n\n if (!hasResponsive) {\n return\n }\n\n const mediaArray = buildMediaQueriesFromObject(parsedStyleProps.value.media)\n const hash = hashStyleProps(parsedStyleProps.value.styles, mediaArray)\n const className = hash\n\n const cssText = stylesToString({\n selector: className,\n styles: parsedStyleProps.value.styles,\n media: mediaArray,\n })\n\n const registeredKey = responsiveStyleManager.register(cssText, className)\n currentStyleKey = registeredKey\n responsiveClassName.value = className\n}\n\nupdateResponsiveStyles()\n\nwatch(\n () => [parsedStyleProps.value.styles, parsedStyleProps.value.media],\n () => {\n updateResponsiveStyles()\n },\n { deep: true, immediate: false }\n)\n\nonBeforeUnmount(() => {\n if (currentStyleKey) {\n responsiveStyleManager.unregister(currentStyleKey)\n }\n})\n\nconst _props = computed(() => {\n const { rest, inlineStyles } = parsedStyleProps.value\n\n const finalStyle = getBoxStyle({\n theme: theme.value,\n style: props.style,\n vars: props.__vars,\n styleProps: inlineStyles,\n })\n\n const finalClassName = cx(props.className, responsiveClassName.value, {\n 'c-light-hidden': props.lightHidden,\n 'c-dark-hidden': props.darkHidden,\n [`c-hidden-from-${props.hiddenFrom}`]: props.hiddenFrom,\n [`c-visible-from-${props.visibleFrom}`]: props.visibleFrom,\n })\n\n const {\n tag,\n style,\n __vars,\n className,\n variant,\n mod,\n size,\n hiddenFrom,\n visibleFrom,\n lightHidden,\n darkHidden,\n __size,\n ...restProps\n } = rest || {}\n\n return {\n ...restProps,\n style: finalStyle,\n className: finalClassName,\n 'data-variant': props.variant,\n 'data-size': isNumberLike(props.size) ? undefined : props.size || undefined,\n size: props.__size,\n ...getBoxMod(props.mod),\n }\n})\n\nconst rootTag = computed(() => {\n if (props.renderRoot) {\n return (p: Record<string, any>) => p.renderRoot(p)\n }\n\n return props.tag\n})\n\ndefineExpose({\n root: _root,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;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\n <component ref=\"_root\" :is=\"rootTag\" v-bind=\"_props\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport cx from 'clsx'\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport { isNumberLike } from '../utils'\nimport type { BoxComponentProps } from './box.types'\nimport { useCckTheme } from '../config-provider'\nimport { extractStyleProps, parseStyleProps, STYLE_PROPS_DATA } from './style-props'\nimport { getBoxStyle } from './get-box-style/get-box-style'\nimport {\n hashStyleProps,\n responsiveStyleManager,\n StylesMediaQuery,\n stylesToString,\n} from '../responsive-style-manager'\nimport { getBoxMod } from './get-box-mod/get-box-mod'\n\ndefineOptions({\n name: 'CBox',\n})\n\nconst _root = ref<HTMLElement | null>(null)\n\nconst props = withDefaults(\n defineProps<\n BoxComponentProps & {\n className: string\n renderRoot?: (props: Record<string, any>) => any\n tag?: any\n }\n >(),\n {\n tag: 'div',\n }\n)\n\nconst theme = useCckTheme()\n\nconst parsedStyleProps = computed(() => {\n const { styleProps, rest } = extractStyleProps(props)\n return {\n ...parseStyleProps({\n styleProps,\n theme: theme.value,\n data: STYLE_PROPS_DATA,\n }),\n rest,\n }\n})\n\nconst hasResponsive = computed(() => parsedStyleProps.value.hasResponsiveStyles)\nconst responsiveClassName = ref<string | null>(null)\nlet currentStyleKey: string | null = null\n\nfunction updateResponsiveStyles() {\n if (currentStyleKey) {\n responsiveStyleManager.unregister(currentStyleKey)\n currentStyleKey = null\n responsiveClassName.value = null\n }\n\n if (!hasResponsive) {\n return\n }\n\n const mediaArray = parsedStyleProps.value.media || []\n const hash = hashStyleProps(parsedStyleProps.value.styles, mediaArray)\n const className = hash\n\n const cssText = stylesToString({\n selector: className,\n styles: parsedStyleProps.value.styles,\n media: mediaArray,\n })\n\n const registeredKey = responsiveStyleManager.register(cssText, className)\n currentStyleKey = registeredKey\n responsiveClassName.value = className\n}\n\nupdateResponsiveStyles()\n\nwatch(\n () => [parsedStyleProps.value.styles, parsedStyleProps.value.media],\n () => {\n updateResponsiveStyles()\n },\n { deep: true, immediate: false }\n)\n\nonBeforeUnmount(() => {\n if (currentStyleKey) {\n responsiveStyleManager.unregister(currentStyleKey)\n }\n})\n\nconst _props = computed(() => {\n const { rest, inlineStyles } = parsedStyleProps.value\n\n const finalStyle = getBoxStyle({\n theme: theme.value,\n style: props.style,\n vars: props.__vars,\n styleProps: inlineStyles,\n })\n\n const finalClassName = cx(props.className, responsiveClassName.value, {\n 'c-light-hidden': props.lightHidden,\n 'c-dark-hidden': props.darkHidden,\n [`c-hidden-from-${props.hiddenFrom}`]: props.hiddenFrom,\n [`c-visible-from-${props.visibleFrom}`]: props.visibleFrom,\n })\n\n const {\n tag,\n style,\n __vars,\n className,\n variant,\n mod,\n size,\n hiddenFrom,\n visibleFrom,\n lightHidden,\n darkHidden,\n __size,\n ...restProps\n } = rest || {}\n\n return {\n ...restProps,\n style: finalStyle,\n className: finalClassName,\n 'data-variant': props.variant,\n 'data-size': isNumberLike(props.size) ? undefined : props.size || undefined,\n size: props.__size,\n ...getBoxMod(props.mod),\n }\n})\n\nconst rootTag = computed(() => {\n if (props.renderRoot) {\n return (p: Record<string, any>) => p.renderRoot(p)\n }\n\n return props.tag\n})\n\ndefineExpose({\n root: _root,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BA,MAAM,QAAQ,IAAwB,IAAI;EAE1C,MAAM,QAAQ;EAad,MAAM,QAAQ,YAAY;EAE1B,MAA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,SACA,KACA,MACA,YACA,aACA,aACA,YACA,QACA,GAAG,cACD,QAAQ,CAAC;GAEb,OAAO;IACL,GAAG;IACH,OAAO;IACP,WAAW;IACX,gBAAgB,MAAM;IACtB,aAAa,aAAa,MAAM,IAAI,IAAI,KAAA,IAAY,MAAM,QAAQ,KAAA;IAClE,MAAM,MAAM;IACZ,GAAG,UAAU,MAAM,GAAG;GACxB;EACF,CAAC;EAED,MAAM,UAAU,eAAe;GAC7B,IAAI,MAAM,YACR,QAAQ,MAA2B,EAAE,WAAW,CAAC;GAGnD,OAAO,MAAM;EACf,CAAC;EAED,SAAa,EACX,MAAM,MACR,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;qBA1JC,YAEY,wBAFgB,OAAA,OAAO,GAAnC,WAEY,EAFD,KAAI,QAAO,GAAuB,OAAA,MAAM,GAAA;yBACzC,CAAR,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cck-ui/core",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Vue component library focused on usability, accessibility and developer experience",
5
5
  "homepage": "https://cck-ui.jackatlas.xyz",
6
6
  "license": "ISC",