reborn-ui 0.1.79 → 0.1.82

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.
Files changed (44) hide show
  1. package/dist/index.js +5 -4
  2. package/dist/index.js.map +1 -1
  3. package/package.json +54 -53
  4. package/registry/components/fireworks.json +17 -0
  5. package/registry/components/icon-cloud.json +17 -0
  6. package/registry/components/liquid-glass.json +21 -0
  7. package/registry/components/pattern-background.json +19 -0
  8. package/registry/components/reborn-back-top.json +2 -2
  9. package/registry/components/reborn-badge.json +3 -3
  10. package/registry/components/reborn-button.json +5 -5
  11. package/registry/components/reborn-carousel.json +23 -0
  12. package/registry/components/reborn-checkbox.json +3 -3
  13. package/registry/components/reborn-chip.json +4 -4
  14. package/registry/components/reborn-container.json +19 -0
  15. package/registry/components/reborn-coupon.json +21 -0
  16. package/registry/components/reborn-date-picker-panel.json +20 -0
  17. package/registry/components/reborn-dialog.json +21 -0
  18. package/registry/components/reborn-draggable.json +2 -2
  19. package/registry/components/reborn-drawer.json +1 -1
  20. package/registry/components/reborn-fab.json +2 -2
  21. package/registry/components/reborn-form.json +5 -6
  22. package/registry/components/reborn-header.json +24 -0
  23. package/registry/components/reborn-image.json +3 -3
  24. package/registry/components/reborn-input-number.json +3 -3
  25. package/registry/components/reborn-input.json +5 -5
  26. package/registry/components/reborn-loading.json +3 -3
  27. package/registry/components/reborn-main.json +19 -0
  28. package/registry/components/reborn-overlay.json +3 -3
  29. package/registry/components/reborn-popover.json +2 -2
  30. package/registry/components/reborn-popup.json +18 -3
  31. package/registry/components/reborn-radio.json +4 -4
  32. package/registry/components/reborn-search-box.json +28 -0
  33. package/registry/components/reborn-select-date.json +4 -3
  34. package/registry/components/reborn-select-trigger.json +12 -2
  35. package/registry/components/reborn-select.json +4 -4
  36. package/registry/components/reborn-sku.json +17 -0
  37. package/registry/components/reborn-slider.json +3 -3
  38. package/registry/components/reborn-sticky.json +2 -2
  39. package/registry/components/reborn-switch.json +3 -3
  40. package/registry/components/reborn-tabs.json +2 -2
  41. package/registry/components/reborn-textarea.json +3 -3
  42. package/registry/components/reborn-time-picker.json +33 -0
  43. package/registry/components/reborn-transition.json +5 -5
  44. package/registry/registry.json +350 -69
package/dist/index.js CHANGED
@@ -727,8 +727,8 @@ function findNearestPackageRoot2(from) {
727
727
  var TEMPLATES = {
728
728
  "web": {
729
729
  "lib/tv.ts": 'import { createTV } from "tailwind-variants";\r\nimport { twMergeConfig } from "./utils";\r\n\r\nexport const tv = createTV({\r\n twMergeConfig,\r\n});\r\nexport type { VariantProps } from "tailwind-variants";\r\n',
730
- "lib/utils.ts": 'import type { ClassValue } from "clsx";\r\nimport { clsx } from "clsx";\r\nimport { extendTailwindMerge } from "tailwind-merge";\r\n\r\nexport const twMergeConfig = {\r\n extend: {\r\n classGroups: {\r\n "font-size": [{ text: [(value: string) => !isNaN(Number(value))] }],\r\n },\r\n },\r\n};\r\n\r\nconst customTwMerge = extendTailwindMerge(twMergeConfig);\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return customTwMerge(clsx(inputs));\r\n}\r\n\r\nexport type ObjectValues<T> = T[keyof T];\r\n',
731
- "composables/useFieldGroup.ts": "\r\nimport { ref } from 'vue'\r\n\r\nexport function useFieldGroup(props: any) {\r\n return {\r\n disabled: ref(undefined),\r\n isError: ref(undefined),\r\n orientation: ref(undefined),\r\n size: ref(undefined)\r\n }\r\n}\r\n",
730
+ "lib/utils.ts": 'import type { ClassValue } from "clsx";\r\nimport { clsx } from "clsx";\r\nimport { extendTailwindMerge } from "tailwind-merge";\r\n\r\nexport const twMergeConfig = {\r\n extend: {\r\n classGroups: {\r\n "font-size": [\r\n {\r\n text: [\r\n (value: string) => !isNaN(Number(value)),\r\n (value: string) => value.startsWith("caption-"),\r\n (value: string) => value.startsWith("body-"),\r\n (value: string) => value.startsWith("title-"),\r\n ],\r\n },\r\n ],\r\n },\r\n },\r\n};\r\n\r\nconst customTwMerge = extendTailwindMerge(twMergeConfig);\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return customTwMerge(clsx(inputs));\r\n}\r\n\r\nexport type ObjectValues<T> = T[keyof T];\r\n',
731
+ "composables/useFieldGroup.ts": "import { computed, getCurrentInstance, inject, onMounted, onUnmounted, ref, watch } from 'vue'\r\n\r\nexport interface FormValidateError {\r\n field: string\r\n message: string\r\n}\r\n\r\n/**\r\n * \u8868\u5355\u5168\u5C40\u72B6\u6001\u7BA1\u7406\r\n */\r\nexport function useFieldGroup() {\r\n const errors = ref<Record<string, string>>({})\r\n const fields = ref(new Set<string>([]))\r\n const fieldInstances = ref<any[]>([])\r\n\r\n const addField = (field: any) => {\r\n fieldInstances.value.push(field)\r\n if (field.prop) {\r\n fields.value.add(field.prop)\r\n }\r\n }\r\n\r\n const removeField = (field: any) => {\r\n const index = fieldInstances.value.indexOf(field)\r\n if (index > -1) {\r\n fieldInstances.value.splice(index, 1)\r\n }\r\n if (field.prop) {\r\n fields.value.delete(field.prop)\r\n }\r\n }\r\n\r\n const errorLock = ref(false)\r\n\r\n function setError(prop: string, error: string) {\r\n if (errorLock.value) { return }\r\n if (prop !== '') {\r\n errors.value = { ...errors.value, [prop]: error }\r\n }\r\n }\r\n\r\n function removeError(prop: string) {\r\n if (prop !== '' && errors.value[prop] !== undefined) {\r\n const newErrors = { ...errors.value }\r\n delete newErrors[prop]\r\n errors.value = newErrors\r\n }\r\n }\r\n\r\n function getError(prop: string): string {\r\n if (prop !== '') { return errors.value[prop] ?? '' }\r\n return ''\r\n }\r\n\r\n async function getErrors(): Promise<FormValidateError[]> {\r\n return Object.entries(errors.value).map(([field, message]) => ({ field, message }))\r\n }\r\n\r\n function clearValidate(fieldsToClear?: string | string[]) {\r\n if (fieldsToClear) {\r\n const propsArray = Array.isArray(fieldsToClear) ? fieldsToClear : [fieldsToClear]\r\n propsArray.forEach(prop => removeError(prop))\r\n }\r\n else {\r\n errors.value = {}\r\n }\r\n }\r\n\r\n return {\r\n errors,\r\n fields,\r\n fieldInstances,\r\n addField,\r\n removeField,\r\n setError,\r\n removeError,\r\n getError,\r\n getErrors,\r\n clearValidate,\r\n }\r\n}\r\n\r\nexport interface UseFieldGroupItemProps {\r\n prop?: string\r\n label?: string\r\n labelPosition?: string\r\n labelWidth?: string | number\r\n trigger?: 'blur' | 'change' | 'none' | Array<'blur' | 'change'>\r\n ui?: any\r\n}\r\n\r\n/**\r\n * \u8868\u5355\u9879 (FormItem) \u72B6\u6001\u7BA1\u7406\r\n */\r\nexport function useFieldGroupItem(props: UseFieldGroupItemProps) {\r\n const form = inject<any>('rebornForm', undefined)\r\n const instance = getCurrentInstance()\r\n\r\n const error = computed(() => {\r\n if (!form || !props.prop) { return '' }\r\n return form.getError ? form.getError(props.prop) : ''\r\n })\r\n\r\n const labelPosition = computed(() => {\r\n return props.labelPosition || form?.props?.labelPosition || 'left'\r\n })\r\n\r\n const labelWidth = computed(() => {\r\n if (labelPosition.value === 'top') { return 'auto' }\r\n return props.labelWidth || form?.props?.labelWidth || 'auto'\r\n })\r\n\r\n const size = computed(() => {\r\n const s = form?.props?.size\r\n if (s && ['sm', 'md', 'lg'].includes(s)) {\r\n return s as 'sm' | 'md' | 'lg'\r\n }\r\n return 'sm'\r\n })\r\n\r\n // Web \u7248\u83B7\u53D6\u4F4D\u7F6E\u65B9\u6CD5\r\n const getBoundingClientRect = (callback: (res: DOMRect) => void) => {\r\n if (instance?.proxy?.$el) {\r\n const rect = instance.proxy.$el.getBoundingClientRect()\r\n callback(rect)\r\n }\r\n }\r\n\r\n const validate = (trigger: 'blur' | 'change') => {\r\n if (!form || !props.prop) { return }\r\n\r\n let currentTrigger = props.trigger\r\n if (currentTrigger === undefined) {\r\n currentTrigger = form.props?.trigger\r\n }\r\n\r\n if (!currentTrigger || currentTrigger === 'none') { return }\r\n\r\n let shouldValidate = false\r\n if (Array.isArray(currentTrigger)) {\r\n shouldValidate = currentTrigger.includes(trigger)\r\n }\r\n else {\r\n shouldValidate = currentTrigger === trigger\r\n }\r\n\r\n if (shouldValidate && form.validateField) {\r\n form.validateField(props.prop)\r\n }\r\n }\r\n\r\n watch(() => props.prop, (newProp, oldProp) => {\r\n if (form) {\r\n if (oldProp) {\r\n form.removeField({ uid: instance?.uid, prop: oldProp })\r\n }\r\n if (newProp) {\r\n form.addField({ uid: instance?.uid, prop: newProp, getBoundingClientRect })\r\n }\r\n }\r\n })\r\n\r\n onMounted(() => {\r\n if (form && props.prop) {\r\n form.addField({ uid: instance?.uid, prop: props.prop, getBoundingClientRect })\r\n }\r\n })\r\n\r\n onUnmounted(() => {\r\n if (form && props.prop) {\r\n form.removeField({ uid: instance?.uid, prop: props.prop })\r\n }\r\n })\r\n\r\n return {\r\n form,\r\n error,\r\n labelPosition,\r\n labelWidth,\r\n size,\r\n getBoundingClientRect,\r\n validate,\r\n }\r\n}\r\n\r\n/**\r\n * \u4F9B\u8868\u5355\u5185\u90E8\u7EC4\u4EF6 (Input/Select \u7B49) \u4F7F\u7528\u7684\u6CE8\u5165\u5DE5\u5177\r\n */\r\nexport function useFormInject(props: any = {}) {\r\n const form = inject<any>('rebornForm', null)\r\n const formItem = inject<any>('rebornFormItem', null)\r\n\r\n const size = computed(() => {\r\n return formItem?.size?.value || form?.props?.size || props.size\r\n })\r\n\r\n const disabled = computed(() => {\r\n return form?.props?.disabled || props.disabled\r\n })\r\n\r\n const orientation = computed(() => {\r\n return form?.props?.orientation || props.orientation\r\n })\r\n\r\n const isError = computed(() => {\r\n return formItem?.isError?.value || false\r\n })\r\n\r\n const validate = (trigger: 'blur' | 'change') => {\r\n if (formItem?.validate) {\r\n formItem.validate(trigger)\r\n }\r\n }\r\n\r\n return {\r\n form,\r\n size,\r\n disabled,\r\n orientation,\r\n isError,\r\n validate,\r\n }\r\n}\r\n",
732
732
  "composables/useMouseState.ts": 'import { readonly, ref } from "vue";\r\n\r\nexport function useMouseState() {\r\n const isMouseEntered = ref(false);\r\n\r\n function setMouseEntered(value: boolean) {\r\n isMouseEntered.value = value;\r\n }\r\n\r\n return {\r\n isMouseEntered: readonly(isMouseEntered),\r\n setMouseEntered,\r\n };\r\n}\r\n',
733
733
  "composables/useNavigation.ts": `import type { ContentNavigationItem } from "@nuxt/content";\r
734
734
  \r
@@ -1041,7 +1041,7 @@ function initCommand() {
1041
1041
  // package.json
1042
1042
  var package_default = {
1043
1043
  name: "reborn-ui",
1044
- version: "0.1.79",
1044
+ version: "0.1.82",
1045
1045
  description: "A CLI for Reborn UI",
1046
1046
  author: "1997liuyh-boop",
1047
1047
  license: "MIT",
@@ -1067,10 +1067,11 @@ var package_default = {
1067
1067
  dev: "tsx src/index.ts",
1068
1068
  clean: "rimraf dist",
1069
1069
  prepare: "tsup",
1070
+ "publish:version": "tsx src/scripts/prepare-publish-version.ts",
1070
1071
  "templates:sync": "tsx src/scripts/sync-templates.ts",
1071
1072
  "registry:build": "tsx src/index.ts build --root ../.. --uniapp-source packages/uniapp-project/src/components",
1072
1073
  prepack: "npm run templates:sync && npm run build && npm run registry:build",
1073
- prepublishOnly: "npm run templates:sync && npm run build && npm run registry:build"
1074
+ prepublishOnly: "npm run publish:version && npm run templates:sync && npm run build && npm run registry:build"
1074
1075
  },
1075
1076
  dependencies: {
1076
1077
  chalk: "^5.6.2",