reborn-ui 0.1.71 → 0.1.74

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 (80) hide show
  1. package/dist/index.js +236 -10
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/registry/components/animate-grid.json +2 -2
  5. package/registry/components/color-picker.json +2 -2
  6. package/registry/components/dither-shader.json +2 -2
  7. package/registry/components/flip-words.json +2 -2
  8. package/registry/components/hyper-text.json +2 -2
  9. package/registry/components/images-slider.json +2 -2
  10. package/registry/components/reborn-affix.json +25 -0
  11. package/registry/components/reborn-back-top.json +30 -0
  12. package/registry/components/reborn-badge.json +3 -3
  13. package/registry/components/reborn-button.json +3 -3
  14. package/registry/components/reborn-checkbox.json +3 -3
  15. package/registry/components/reborn-chip.json +31 -0
  16. package/registry/components/reborn-collapse.json +31 -0
  17. package/registry/components/reborn-form.json +50 -0
  18. package/registry/components/reborn-image.json +35 -0
  19. package/registry/components/reborn-input-number.json +3 -3
  20. package/registry/components/reborn-input.json +4 -4
  21. package/registry/components/reborn-sticky.json +29 -0
  22. package/registry/components/reborn-switch.json +3 -3
  23. package/registry/components/reborn-tabs.json +8 -28
  24. package/registry/components/reborn-textarea.json +32 -0
  25. package/registry/components/shader-toy.json +3 -3
  26. package/registry/components/sparkles-text.json +2 -2
  27. package/registry/components/sparkles.json +2 -2
  28. package/registry/components/vanishing-input.json +2 -2
  29. package/registry/registry.json +267 -40
  30. package/registry/components/animated-beam.json +0 -22
  31. package/registry/components/aurora-background.json +0 -22
  32. package/registry/components/bending-gallery.json +0 -24
  33. package/registry/components/bg-black-hole.json +0 -20
  34. package/registry/components/bg-bubbles.json +0 -24
  35. package/registry/components/bg-falling-stars.json +0 -22
  36. package/registry/components/bg-neural.json +0 -20
  37. package/registry/components/bg-particle-whirlpool.json +0 -24
  38. package/registry/components/bg-silk.json +0 -22
  39. package/registry/components/bg-singularity.json +0 -22
  40. package/registry/components/bg-stars.json +0 -24
  41. package/registry/components/bg-stractium.json +0 -22
  42. package/registry/components/bg-thunderstorm.json +0 -22
  43. package/registry/components/border-beam.json +0 -22
  44. package/registry/components/card-spotlight.json +0 -22
  45. package/registry/components/carousel-3d.json +0 -25
  46. package/registry/components/confetti.json +0 -34
  47. package/registry/components/cosmic-portal.json +0 -24
  48. package/registry/components/file-tree.json +0 -52
  49. package/registry/components/flickering-grid.json +0 -22
  50. package/registry/components/fluid-cursor.json +0 -22
  51. package/registry/components/github-globe.json +0 -29
  52. package/registry/components/globe.json +0 -25
  53. package/registry/components/glow-border.json +0 -22
  54. package/registry/components/glowing-effect.json +0 -24
  55. package/registry/components/icon-cloud.json +0 -22
  56. package/registry/components/image-trail-cursor.json +0 -28
  57. package/registry/components/infinite-grid.json +0 -53
  58. package/registry/components/interactive-grid-pattern.json +0 -22
  59. package/registry/components/lamp-effect.json +0 -22
  60. package/registry/components/light-speed.json +0 -37
  61. package/registry/components/liquid-background.json +0 -24
  62. package/registry/components/liquid-glass.json +0 -22
  63. package/registry/components/liquid-logo.json +0 -30
  64. package/registry/components/logo-cloud.json +0 -42
  65. package/registry/components/logo-origami.json +0 -34
  66. package/registry/components/orbit.json +0 -22
  67. package/registry/components/particle-image.json +0 -30
  68. package/registry/components/particles-bg.json +0 -24
  69. package/registry/components/pattern-background.json +0 -24
  70. package/registry/components/sleek-line-cursor.json +0 -18
  71. package/registry/components/smooth-cursor.json +0 -35
  72. package/registry/components/snowfall-bg.json +0 -24
  73. package/registry/components/spline.json +0 -35
  74. package/registry/components/tailed-cursor.json +0 -20
  75. package/registry/components/tetris.json +0 -25
  76. package/registry/components/video-text.json +0 -22
  77. package/registry/components/vortex.json +0 -24
  78. package/registry/components/warp-background.json +0 -34
  79. package/registry/components/wavy-background.json +0 -24
  80. package/registry/components/world-map.json +0 -25
package/dist/index.js CHANGED
@@ -254,7 +254,7 @@ function addCommand() {
254
254
  if (opts.yes) {
255
255
  throw new Error("\u672A\u6307\u5B9A\u7EC4\u4EF6\u540D\uFF1B\u8BF7\u4F20\u5165\u7EC4\u4EF6\u53C2\u6570\u6216\u53BB\u6389 --yes \u4EE5\u4EA4\u4E92\u9009\u62E9\u3002");
256
256
  }
257
- const choices = registry.components.map((c) => ({
257
+ const choices = registry.components?.map((c) => ({
258
258
  title: c.name,
259
259
  value: c.name
260
260
  }));
@@ -431,11 +431,11 @@ function buildCommand() {
431
431
  const sourceDir = path5.join(rootDir, opts.source);
432
432
  const uniappSourceDir = opts.uniappSource ? path5.join(rootDir, opts.uniappSource) : "";
433
433
  const outPath = path5.join(rootDir, opts.out);
434
- const alsoOutPaths = (opts.alsoOut ?? []).map(
434
+ const alsoOutPaths = (opts.alsoOut ?? [])?.map(
435
435
  (p) => path5.join(rootDir, p)
436
436
  );
437
437
  const dirents = await fs4.readdir(sourceDir, { withFileTypes: true });
438
- const componentDirs = dirents.filter((d) => d.isDirectory()).map((d) => path5.join(sourceDir, d.name)).sort((a, b) => a.localeCompare(b));
438
+ const componentDirs = dirents.filter((d) => d.isDirectory())?.map((d) => path5.join(sourceDir, d.name)).sort((a, b) => a.localeCompare(b));
439
439
  const components = [];
440
440
  for (const absComponentDir of componentDirs) {
441
441
  const name = path5.basename(absComponentDir);
@@ -519,7 +519,7 @@ function buildCommand() {
519
519
  {
520
520
  ...c,
521
521
  fileCount: c.files.length,
522
- contentHash: sha1(JSON.stringify(c.files.map((f) => f.content)))
522
+ contentHash: sha1(JSON.stringify(c.files?.map((f) => f.content)))
523
523
  }
524
524
  );
525
525
  }
@@ -559,7 +559,7 @@ var TEMPLATES = {
559
559
  "web": {
560
560
  "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',
561
561
  "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',
562
- "composables/useFieldGroup.ts": "\r\nimport { ref } from 'vue'\r\n\r\nexport function useFieldGroup(props: any) {\r\n return {\r\n orientation: ref(undefined),\r\n size: ref(undefined)\r\n }\r\n}\r\n",
562
+ "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",
563
563
  "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',
564
564
  "composables/useNavigation.ts": `import type { ContentNavigationItem } from "@nuxt/content";\r
565
565
  \r
@@ -611,9 +611,235 @@ export function useNavigation(navigation?: Ref<ContentNavigationItem[]>) {\r
611
611
  `
612
612
  },
613
613
  "uniapp": {
614
- "lib/tv.ts": "// @ts-ignore\r\nimport { create } from '@weapp-tailwindcss/variants-v3'\r\n// @ts-ignore\r\nconst isH5 = process.env.UNI_PLATFORM === 'h5'\r\n\r\nconst { tv } = create({\r\n escape: !isH5,\r\n unescape: !isH5,\r\n})\r\n\r\nexport { tv }\r\n",
615
- "lib/utils.ts": "import { type ClassValue, clsx } from 'clsx'\r\nimport { create } from '@weapp-tailwindcss/merge-v3'\r\n\r\n// @ts-ignore\r\nconst isH5 = process.env.UNI_PLATFORM === 'h5'\r\nconst { twMerge } = create({\r\n escape: !isH5,\r\n unescape: !isH5,\r\n})\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return twMerge(clsx(inputs))\r\n}\r\n",
616
- "composables/useFieldGroup.ts": "import { ref } from 'vue'\r\n\r\nexport function useFieldGroup(props?: any) {\r\n return {\r\n disabled: ref(undefined),\r\n orientation: ref(undefined),\r\n size: ref(undefined)\r\n }\r\n}\r\n"
614
+ "lib/tv.ts": `// @ts-ignore\r
615
+ import type { TV } from "tailwind-variants";\r
616
+ import { create } from '@weapp-tailwindcss/variants-v3'\r
617
+ \r
618
+ // @ts-ignore\r
619
+ const isH5 = process.env.UNI_PLATFORM === 'h5'\r
620
+ \r
621
+ const { tv: createTV } = create({\r
622
+ // @ts-ignore\r
623
+ escape: !isH5,\r
624
+ // @ts-ignore\r
625
+ unescape: !isH5,\r
626
+ })\r
627
+ \r
628
+ const textSizeKeys = ['20', '22', '24', '26', '28', '30', '32', '36', '40', '48', '52']\r
629
+ \r
630
+ const twMergeConfig = {\r
631
+ extend: {\r
632
+ classGroups: {\r
633
+ 'font-size': [{ text: textSizeKeys }],\r
634
+ },\r
635
+ },\r
636
+ } as const\r
637
+ \r
638
+ export const tv: TV = (options, config) =>\r
639
+ createTV(options, {\r
640
+ ...config,\r
641
+ twMerge: config?.twMerge ?? true,\r
642
+ twMergeConfig: {\r
643
+ ...config?.twMergeConfig,\r
644
+ ...twMergeConfig,\r
645
+ },\r
646
+ });\r
647
+ `,
648
+ "lib/utils.ts": "import { type ClassValue, clsx } from 'clsx'\r\nimport { create } from '@weapp-tailwindcss/merge-v3'\r\n\r\n// @ts-ignore\r\nconst isH5 = process.env.UNI_PLATFORM === 'h5'\r\nconst { twMerge } = create({\r\n escape: !isH5,\r\n unescape: !isH5,\r\n // @ts-ignore\r\n extend: {\r\n classGroups: {\r\n 'font-size': [{ text: ['20', '22', '24', '26', '28', '30', '32', '36', '40', '48', '52'] }],\r\n },\r\n },\r\n})\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return twMerge(clsx(inputs))\r\n}\r\n",
649
+ "composables/useDarkMode.ts": "export const useDarkMode = () => {\r\n const isDark = ref(false)\r\n\r\n const toggleDarkMode = () => {\r\n isDark.value = !isDark.value\r\n updateTheme()\r\n }\r\n\r\n const updateTheme = () => {\r\n const value = isDark.value\r\n uni.setStorageSync('darkMode', value)\r\n\r\n // #ifdef H5\r\n if (value) {\r\n document.documentElement.classList.add('dark')\r\n } else {\r\n document.documentElement.classList.remove('dark')\r\n }\r\n // #endif\r\n\r\n }\r\n\r\n const initTheme = () => {\r\n const saved = uni.getStorageSync('darkMode')\r\n if (saved !== '') {\r\n isDark.value = !!saved\r\n } else {\r\n isDark.value = false\r\n }\r\n updateTheme()\r\n }\r\n\r\n initTheme()\r\n\r\n return {\r\n isDark,\r\n toggleDarkMode\r\n }\r\n}\r\n",
650
+ "composables/useFieldGroup.ts": `import { ref, provide, inject, computed, watch, onMounted, onUnmounted, getCurrentInstance } from 'vue';\r
651
+ import * as z from 'zod';\r
652
+ \r
653
+ export type FormValidateError = {\r
654
+ field: string;\r
655
+ message: string;\r
656
+ };\r
657
+ \r
658
+ export interface UseFieldGroupProps {\r
659
+ modelValue?: any;\r
660
+ }\r
661
+ \r
662
+ export function useFieldGroup() {\r
663
+ \r
664
+ // Data & Context\r
665
+ const errors = ref(new Map<string, string>());\r
666
+ const fields = ref(new Set<string>([]));\r
667
+ const fieldInstances = ref<any[]>([]);\r
668
+ \r
669
+ // --- Field Management ---\r
670
+ const addField = (field: any) => {\r
671
+ fieldInstances.value.push(field);\r
672
+ if (field.prop) {\r
673
+ fields.value.add(field.prop);\r
674
+ }\r
675
+ };\r
676
+ \r
677
+ const removeField = (field: any) => {\r
678
+ const index = fieldInstances.value.indexOf(field);\r
679
+ if (index > -1) {\r
680
+ fieldInstances.value.splice(index, 1);\r
681
+ }\r
682
+ if (field.prop) {\r
683
+ fields.value.delete(field.prop);\r
684
+ }\r
685
+ };\r
686
+ \r
687
+ // --- Error Management ---\r
688
+ const errorLock = ref(false);\r
689
+ \r
690
+ function setError(prop: string, error: string) {\r
691
+ if (errorLock.value) return;\r
692
+ if (prop !== "") errors.value.set(prop, error);\r
693
+ }\r
694
+ \r
695
+ function removeError(prop: string) {\r
696
+ if (prop !== "") errors.value.delete(prop);\r
697
+ }\r
698
+ \r
699
+ function getError(prop: string): string {\r
700
+ if (prop !== "") return errors.value.get(prop) ?? "";\r
701
+ return "";\r
702
+ }\r
703
+ \r
704
+ async function getErrors(): Promise<FormValidateError[]> {\r
705
+ const errs = [] as FormValidateError[];\r
706
+ errors.value.forEach((msg, field) => {\r
707
+ errs.push({ field, message: msg });\r
708
+ });\r
709
+ return errs;\r
710
+ }\r
711
+ \r
712
+ function clearValidate(fieldsToClear?: string | string[]) {\r
713
+ if (fieldsToClear) {\r
714
+ const propsArray = Array.isArray(fieldsToClear) ? fieldsToClear : [fieldsToClear];\r
715
+ propsArray.forEach(prop => removeError(prop));\r
716
+ } else {\r
717
+ errors.value.clear();\r
718
+ }\r
719
+ }\r
720
+ \r
721
+ return {\r
722
+ errors,\r
723
+ fields,\r
724
+ fieldInstances,\r
725
+ addField,\r
726
+ removeField,\r
727
+ setError,\r
728
+ removeError,\r
729
+ getError, // Used by children\r
730
+ getErrors, // Used by validate\r
731
+ clearValidate\r
732
+ };\r
733
+ }\r
734
+ \r
735
+ \r
736
+ export interface UseFieldGroupItemProps {\r
737
+ prop?: string;\r
738
+ label?: string;\r
739
+ labelPosition?: string;\r
740
+ labelWidth?: string | number;\r
741
+ ui?: any;\r
742
+ }\r
743
+ \r
744
+ export function useFieldGroupItem(props: UseFieldGroupItemProps) {\r
745
+ const form = inject<any>('rebornForm', undefined);\r
746
+ const instance = getCurrentInstance();\r
747
+ \r
748
+ \r
749
+ const error = computed(() => {\r
750
+ if (!form || !props.prop) return '';\r
751
+ return form.getError ? form.getError(props.prop) : '';\r
752
+ });\r
753
+ \r
754
+ const labelPosition = computed(() => {\r
755
+ return props.labelPosition || form?.props?.labelPosition || 'left';\r
756
+ });\r
757
+ \r
758
+ const labelWidth = computed(() => {\r
759
+ if (labelPosition.value === 'top') return 'auto';\r
760
+ return props.labelWidth || form?.props?.labelWidth || 'auto';\r
761
+ });\r
762
+ \r
763
+ const size = computed(() => {\r
764
+ const s = form?.props?.size;\r
765
+ if (s && ['sm', 'md', 'lg'].includes(s)) {\r
766
+ return s as "sm" | "md" | "lg";\r
767
+ }\r
768
+ return 'sm';\r
769
+ });\r
770
+ \r
771
+ const getBoundingClientRect = (callback: (res: any) => void) => {\r
772
+ uni.createSelectorQuery()\r
773
+ .in(instance?.proxy)\r
774
+ .select('.re-form-item')\r
775
+ .boundingClientRect(callback)\r
776
+ .exec();\r
777
+ };\r
778
+ \r
779
+ // Watch for prop changes to update registration\r
780
+ watch(() => props.prop, (newProp, oldProp) => {\r
781
+ if (form) {\r
782
+ if (oldProp) {\r
783
+ form.removeField({ uid: instance?.uid, prop: oldProp });\r
784
+ }\r
785
+ if (newProp) {\r
786
+ form.addField({ uid: instance?.uid, prop: newProp, getBoundingClientRect });\r
787
+ }\r
788
+ }\r
789
+ });\r
790
+ \r
791
+ onMounted(() => {\r
792
+ if (form && props.prop) {\r
793
+ form.addField({ uid: instance?.uid, prop: props.prop, getBoundingClientRect });\r
794
+ }\r
795
+ });\r
796
+ \r
797
+ onUnmounted(() => {\r
798
+ if (form && props.prop) {\r
799
+ form.removeField({ uid: instance?.uid, prop: props.prop });\r
800
+ }\r
801
+ });\r
802
+ \r
803
+ return {\r
804
+ form,\r
805
+ error,\r
806
+ labelPosition,\r
807
+ labelWidth,\r
808
+ size,\r
809
+ getBoundingClientRect\r
810
+ };\r
811
+ }\r
812
+ \r
813
+ // Consumer for inner components (Input, Select, etc.)\r
814
+ export function useFormInject(props: any) {\r
815
+ const form = inject<any>('rebornForm', null);\r
816
+ const formItem = inject<any>('rebornFormItem', null);\r
817
+ \r
818
+ const size = computed(() => {\r
819
+ return form?.props?.size || props.size;\r
820
+ });\r
821
+ \r
822
+ const disabled = computed(() => {\r
823
+ return form?.props?.disabled || props.disabled;\r
824
+ });\r
825
+ \r
826
+ const orientation = computed(() => {\r
827
+ return form?.props?.orientation || props.orientation;\r
828
+ });\r
829
+ \r
830
+ const isError = computed(() => {\r
831
+ return formItem?.isError?.value || false;\r
832
+ });\r
833
+ \r
834
+ return {\r
835
+ form,\r
836
+ size,\r
837
+ disabled,\r
838
+ orientation,\r
839
+ isError\r
840
+ };\r
841
+ }\r
842
+ `
617
843
  }
618
844
  };
619
845
 
@@ -686,7 +912,7 @@ async function copyTemplates(params) {
686
912
  fromDir: currentRepoPaths.composables,
687
913
  toDir: path7.join(cwd, cfg.composablesDir),
688
914
  overwrite,
689
- ignoreFileNames: platform === "web" ? /* @__PURE__ */ new Set(["useComponentCode.ts", "useCopyToClipboard.ts"]) : void 0
915
+ ignoreFileNames: platform === "web" ? /* @__PURE__ */ new Set(["useComponentCode.ts", "useCopyToClipboard.ts", "getComponentCode.ts", "getUniappCode.ts"]) : void 0
690
916
  });
691
917
  copiedFromRepo = true;
692
918
  }
@@ -861,7 +1087,7 @@ function initCommand() {
861
1087
  // package.json
862
1088
  var package_default = {
863
1089
  name: "reborn-ui",
864
- version: "0.1.71",
1090
+ version: "0.1.74",
865
1091
  description: "A CLI for Reborn UI",
866
1092
  author: "1997liuyh-boop",
867
1093
  license: "MIT",