@bbki.ng/components 2.6.16 → 3.0.0

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 (149) hide show
  1. package/dist/Button.d.ts +1 -0
  2. package/dist/_virtual/_commonjsHelpers.mjs +6 -0
  3. package/dist/_virtual/index.mjs +4 -0
  4. package/dist/_virtual/jsx-runtime.mjs +7 -0
  5. package/dist/_virtual/jsx-runtime2.mjs +4 -0
  6. package/dist/_virtual/react-jsx-runtime.development.mjs +4 -0
  7. package/dist/_virtual/react-jsx-runtime.production.min.mjs +4 -0
  8. package/dist/article/Article.d.ts +11 -0
  9. package/dist/article/Article.mjs +43 -0
  10. package/dist/blink-dot/BlinkDot.d.ts +5 -0
  11. package/dist/blink-dot/BlinkDot.mjs +20 -0
  12. package/dist/blur-cover/BlurCover.d.ts +6 -0
  13. package/dist/blur-cover/BlurCover.mjs +28 -0
  14. package/dist/breadcrumb/Breadcrumb.d.ts +9 -0
  15. package/dist/breadcrumb/Breadcrumb.mjs +35 -0
  16. package/dist/button/Button.d.ts +18 -0
  17. package/dist/button/Button.mjs +35 -0
  18. package/dist/canvas/Canvas.d.ts +23 -0
  19. package/dist/canvas/Canvas.mjs +85 -0
  20. package/dist/canvas/useRenderer.d.ts +10 -0
  21. package/dist/canvas/useRenderer.mjs +31 -0
  22. package/dist/context-menu/index.d.ts +27 -0
  23. package/dist/context-menu/index.mjs +131 -0
  24. package/dist/drop-image/DropImage.d.ts +25 -0
  25. package/dist/drop-image/DropImage.mjs +151 -0
  26. package/dist/drop-image/useDropImage.d.ts +19 -0
  27. package/dist/drop-image/useDropImage.mjs +67 -0
  28. package/dist/drop-image/utils.d.ts +2 -0
  29. package/dist/drop-image/utils.mjs +4 -0
  30. package/dist/drop-zone/DropZone.d.ts +9 -0
  31. package/dist/drop-zone/DropZone.mjs +44 -0
  32. package/dist/img/Gallery.d.ts +11 -0
  33. package/dist/img/Gallery.mjs +37 -0
  34. package/dist/img/Img.d.ts +3 -0
  35. package/dist/img/Img.mjs +80 -0
  36. package/dist/img/RandomRowsLayout.d.ts +9 -0
  37. package/dist/img/RandomRowsLayout.mjs +49 -0
  38. package/dist/img/types.d.ts +21 -0
  39. package/dist/img/types.mjs +4 -0
  40. package/dist/img/utils.d.ts +7 -0
  41. package/dist/img/utils.mjs +15 -0
  42. package/dist/index.d.ts +25 -380
  43. package/dist/index.mjs +79 -0
  44. package/dist/input/index.d.ts +3 -0
  45. package/dist/input/index.mjs +17 -0
  46. package/dist/label/index.d.ts +5 -0
  47. package/dist/label/index.mjs +17 -0
  48. package/dist/layout/layout.d.ts +7 -0
  49. package/dist/layout/layout.mjs +27 -0
  50. package/dist/link/Link.d.ts +17 -0
  51. package/dist/link/Link.mjs +83 -0
  52. package/dist/list/list.d.ts +23 -0
  53. package/dist/list/list.mjs +76 -0
  54. package/dist/loading-spiral/LoadingSpiral.d.ts +5 -0
  55. package/dist/loading-spiral/LoadingSpiral.mjs +37 -0
  56. package/dist/loading-spiral/constants.d.ts +6 -0
  57. package/dist/loading-spiral/constants.mjs +61 -0
  58. package/dist/loading-spiral/createOptions.d.ts +17 -0
  59. package/dist/loading-spiral/createOptions.mjs +30 -0
  60. package/dist/loading-spiral/createSettings.d.ts +16 -0
  61. package/dist/loading-spiral/createSettings.mjs +21 -0
  62. package/dist/loading-spiral/useCanvasRef.d.ts +4 -0
  63. package/dist/loading-spiral/utils.d.ts +1 -0
  64. package/dist/logo/Logo.d.ts +6 -0
  65. package/dist/logo/Logo.mjs +36 -0
  66. package/dist/nav/Nav.d.ts +10 -0
  67. package/dist/nav/Nav.mjs +27 -0
  68. package/dist/node_modules/.pnpm/@babel_runtime@7.18.9/node_modules/@babel/runtime/helpers/esm/extends.mjs +13 -0
  69. package/dist/node_modules/.pnpm/@floating-ui_core@1.6.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs +519 -0
  70. package/dist/node_modules/.pnpm/@floating-ui_dom@1.6.3/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +373 -0
  71. package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.0.8_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs +182 -0
  72. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.1/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +108 -0
  73. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.1/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +120 -0
  74. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.0.1/node_modules/@radix-ui/primitive/dist/index.mjs +9 -0
  75. package/dist/node_modules/.pnpm/@radix-ui_react-arrow@1.0.3_@types_react-dom@18.0.6_@types_react@18.0.15_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-arrow/dist/index.mjs +19 -0
  76. package/dist/node_modules/.pnpm/@radix-ui_react-collection@1.0.3_@types_react-dom@18.0.6_@types_react@18.0.15_react-dom_04e7d2b59cf7ec97f40d26a998d7601d/node_modules/@radix-ui/react-collection/dist/index.mjs +60 -0
  77. package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.0.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.mjs +16 -0
  78. package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.mjs +25 -0
  79. package/dist/node_modules/.pnpm/@radix-ui_react-context-menu@2.1.5_@types_react-dom@18.0.6_@types_react@18.0.15_react-d_1ce4db5e792f73d797e22c043cc3d326/node_modules/@radix-ui/react-context-menu/dist/index.mjs +213 -0
  80. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.0.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-context/dist/index.mjs +88 -0
  81. package/dist/node_modules/.pnpm/@radix-ui_react-direction@1.0.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-direction/dist/index.mjs +9 -0
  82. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.0.5_@types_react-dom@18.0.6_@types_react@18.0.15_re_0263a24376d55e4c2bb8fa2f75f1db3c/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs +136 -0
  83. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.0.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.mjs +20 -0
  84. package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.0.4_@types_react-dom@18.0.6_@types_react@18.0.15_react-do_a79d961df31bbecb3b2c94878dbb0724/node_modules/@radix-ui/react-focus-scope/dist/index.mjs +188 -0
  85. package/dist/node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.mjs +61 -0
  86. package/dist/node_modules/.pnpm/@radix-ui_react-id@1.0.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-id/dist/index.mjs +18 -0
  87. package/dist/node_modules/.pnpm/@radix-ui_react-label@2.1.1_@types_react-dom@18.0.6_@types_react@18.0.15_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-label/dist/index.mjs +20 -0
  88. package/dist/node_modules/.pnpm/@radix-ui_react-menu@2.0.6_@types_react-dom@18.0.6_@types_react@18.0.15_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-menu/dist/index.mjs +657 -0
  89. package/dist/node_modules/.pnpm/@radix-ui_react-popper@1.1.3_@types_react-dom@18.0.6_@types_react@18.0.15_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-popper/dist/index.mjs +218 -0
  90. package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.0.4_@types_react-dom@18.0.6_@types_react@18.0.15_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-portal/dist/index.mjs +14 -0
  91. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.0.1_@types_react-dom@18.0.6_@types_react@18.0.15_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-presence/dist/index.mjs +81 -0
  92. package/dist/node_modules/.pnpm/@radix-ui_react-primitive@1.0.3_@types_react-dom@18.0.6_@types_react@18.0.15_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-primitive/dist/index.mjs +44 -0
  93. package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.0.1_@types_react-dom@18.0.6_@types_react@18.0.15_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-primitive/dist/index.mjs +31 -0
  94. package/dist/node_modules/.pnpm/@radix-ui_react-roving-focus@1.0.4_@types_react-dom@18.0.6_@types_react@18.0.15_react-d_69cf2e3e4b4e2c2fefdb8ea262543b5e/node_modules/@radix-ui/react-roving-focus/dist/index.mjs +199 -0
  95. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.0.2_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.mjs +53 -0
  96. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.1.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.mjs +48 -0
  97. package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.0.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs +16 -0
  98. package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.0.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs +37 -0
  99. package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.0.3_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs +17 -0
  100. package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.0.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs +6 -0
  101. package/dist/node_modules/.pnpm/@radix-ui_react-use-size@1.0.1_@types_react@18.0.15_react@18.2.0/node_modules/@radix-ui/react-use-size/dist/index.mjs +37 -0
  102. package/dist/node_modules/.pnpm/aria-hidden@1.2.3/node_modules/aria-hidden/dist/es2015/index.mjs +49 -0
  103. package/dist/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs +6 -0
  104. package/dist/node_modules/.pnpm/classnames@2.3.1/node_modules/classnames/index.mjs +40 -0
  105. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs +23 -0
  106. package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.mjs +7 -0
  107. package/dist/node_modules/.pnpm/phenomenon@1.6.0/node_modules/phenomenon/dist/phenomenon.mjs +109 -0
  108. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.5_@types_react@18.0.15_react@18.2.0/node_modules/react-remove-scroll-bar/dist/es2015/component.mjs +61 -0
  109. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.5_@types_react@18.0.15_react@18.2.0/node_modules/react-remove-scroll-bar/dist/es2015/constants.mjs +7 -0
  110. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.5_@types_react@18.0.15_react@18.2.0/node_modules/react-remove-scroll-bar/dist/es2015/utils.mjs +25 -0
  111. package/dist/node_modules/.pnpm/react-remove-scroll@2.5.5_@types_react@18.0.15_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.mjs +17 -0
  112. package/dist/node_modules/.pnpm/react-remove-scroll@2.5.5_@types_react@18.0.15_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.mjs +116 -0
  113. package/dist/node_modules/.pnpm/react-remove-scroll@2.5.5_@types_react@18.0.15_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/UI.mjs +46 -0
  114. package/dist/node_modules/.pnpm/react-remove-scroll@2.5.5_@types_react@18.0.15_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.mjs +16 -0
  115. package/dist/node_modules/.pnpm/react-remove-scroll@2.5.5_@types_react@18.0.15_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.mjs +62 -0
  116. package/dist/node_modules/.pnpm/react-remove-scroll@2.5.5_@types_react@18.0.15_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/medium.mjs +5 -0
  117. package/dist/node_modules/.pnpm/react-remove-scroll@2.5.5_@types_react@18.0.15_react@18.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.mjs +7 -0
  118. package/dist/node_modules/.pnpm/react-style-singleton@2.2.1_@types_react@18.0.15_react@18.2.0/node_modules/react-style-singleton/dist/es2015/component.mjs +11 -0
  119. package/dist/node_modules/.pnpm/react-style-singleton@2.2.1_@types_react@18.0.15_react@18.2.0/node_modules/react-style-singleton/dist/es2015/hook.mjs +15 -0
  120. package/dist/node_modules/.pnpm/react-style-singleton@2.2.1_@types_react@18.0.15_react@18.2.0/node_modules/react-style-singleton/dist/es2015/singleton.mjs +30 -0
  121. package/dist/node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react-jsx-runtime.development.mjs +589 -0
  122. package/dist/node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react-jsx-runtime.production.min.mjs +32 -0
  123. package/dist/node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.mjs +8 -0
  124. package/dist/node_modules/.pnpm/tslib@2.4.1/node_modules/tslib/tslib.es6.mjs +29 -0
  125. package/dist/node_modules/.pnpm/use-callback-ref@1.3.1_@types_react@18.0.15_react@18.2.0/node_modules/use-callback-ref/dist/es2015/assignRef.mjs +6 -0
  126. package/dist/node_modules/.pnpm/use-callback-ref@1.3.1_@types_react@18.0.15_react@18.2.0/node_modules/use-callback-ref/dist/es2015/useMergeRef.mjs +26 -0
  127. package/dist/node_modules/.pnpm/use-callback-ref@1.3.1_@types_react@18.0.15_react@18.2.0/node_modules/use-callback-ref/dist/es2015/useRef.mjs +25 -0
  128. package/dist/node_modules/.pnpm/use-sidecar@1.1.2_@types_react@18.0.15_react@18.2.0/node_modules/use-sidecar/dist/es2015/exports.mjs +21 -0
  129. package/dist/node_modules/.pnpm/use-sidecar@1.1.2_@types_react@18.0.15_react@18.2.0/node_modules/use-sidecar/dist/es2015/medium.mjs +67 -0
  130. package/dist/page/Page.d.ts +28 -0
  131. package/dist/page/Page.mjs +67 -0
  132. package/dist/panel/Panel.d.ts +6 -0
  133. package/dist/panel/Panel.mjs +17 -0
  134. package/dist/pop-confirm/PopConfirm.d.ts +10 -0
  135. package/dist/pop-confirm/PopConfirm.mjs +40 -0
  136. package/dist/skeleton/Seleton.d.ts +23 -0
  137. package/dist/skeleton/Seleton.mjs +69 -0
  138. package/dist/spinner/Spinner.d.ts +7 -0
  139. package/dist/table/Table.d.ts +18 -0
  140. package/dist/table/Table.mjs +34 -0
  141. package/dist/tag/Tag.d.ts +10 -0
  142. package/dist/tag/Tag.mjs +33 -0
  143. package/package.json +22 -13
  144. package/dist/index.cjs +0 -1816
  145. package/dist/index.cjs.map +0 -1
  146. package/dist/index.css +0 -1821
  147. package/dist/index.css.map +0 -1
  148. package/dist/index.js +0 -1738
  149. package/dist/index.js.map +0 -1
package/dist/index.cjs DELETED
@@ -1,1816 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
-
26
- // lib/index.ts
27
- var lib_exports = {};
28
- __export(lib_exports, {
29
- Article: () => Article,
30
- ArticleSkeleton: () => ArticleSkeleton,
31
- BlinkDot: () => BlinkDot,
32
- BlurCover: () => BlurCover,
33
- Breadcrumb: () => Breadcrumb,
34
- Button: () => Button,
35
- ButtonType: () => ButtonType,
36
- Canvas: () => Canvas,
37
- ContextMenu: () => ContextMenu,
38
- ContextMenuCheckboxItem: () => ContextMenuCheckboxItem,
39
- ContextMenuContent: () => ContextMenuContent,
40
- ContextMenuGroup: () => ContextMenuGroup,
41
- ContextMenuItem: () => ContextMenuItem,
42
- ContextMenuLabel: () => ContextMenuLabel,
43
- ContextMenuPortal: () => ContextMenuPortal,
44
- ContextMenuRadioGroup: () => ContextMenuRadioGroup,
45
- ContextMenuRadioItem: () => ContextMenuRadioItem,
46
- ContextMenuSeparator: () => ContextMenuSeparator,
47
- ContextMenuShortcut: () => ContextMenuShortcut,
48
- ContextMenuSub: () => ContextMenuSub,
49
- ContextMenuSubContent: () => ContextMenuSubContent,
50
- ContextMenuSubTrigger: () => ContextMenuSubTrigger,
51
- ContextMenuTrigger: () => ContextMenuTrigger,
52
- DropImage: () => DropImage,
53
- DropZone: () => DropZone,
54
- Error: () => Error2,
55
- ErrorBoundary: () => ErrorBoundary,
56
- Form: () => Form,
57
- FormControl: () => FormControl,
58
- FormDescription: () => FormDescription,
59
- FormField: () => FormField,
60
- FormItem: () => FormItem,
61
- FormLabel: () => FormLabel,
62
- FormMessage: () => FormMessage,
63
- Gallery: () => Gallery,
64
- Img: () => Img,
65
- Input: () => Input,
66
- Label: () => Label2,
67
- Link: () => Link,
68
- LinkColor: () => LinkColor,
69
- LinkList: () => LinkList,
70
- LinkListSkeleton: () => LinkListSkeleton,
71
- List: () => List,
72
- LoadingSpiral: () => LoadingSpiral,
73
- Logo: () => Logo,
74
- Nav: () => Nav,
75
- NotFound: () => NotFound,
76
- Page: () => Page,
77
- Panel: () => Panel,
78
- PopConfirm: () => PopConfirm,
79
- Skeleton: () => Skeleton,
80
- SkeletonColor: () => SkeletonColor,
81
- Table: () => Table,
82
- Tag: () => Tag,
83
- Tags: () => Tags,
84
- ThreeColLayout: () => ThreeColLayout,
85
- TitledList: () => TitledList,
86
- ossProcessType: () => ossProcessType,
87
- useForm: () => import_react_hook_form.useForm,
88
- useFormField: () => useFormField,
89
- z: () => import_zod.z,
90
- zodResolver: () => import_zod2.zodResolver
91
- });
92
- module.exports = __toCommonJS(lib_exports);
93
-
94
- // lib/article/Article.tsx
95
- var import_classnames3 = __toESM(require("classnames"), 1);
96
- var import_react3 = __toESM(require("react"), 1);
97
-
98
- // lib/blink-dot/BlinkDot.tsx
99
- var import_classnames = __toESM(require("classnames"), 1);
100
- var import_react = __toESM(require("react"), 1);
101
- var BlinkDot = (props) => {
102
- const { className } = props;
103
- const status = props.status || "hidden";
104
- const statusCls = (0, import_classnames.default)({
105
- "animate-ping-fast": status === "blink",
106
- hidden: status === "hidden"
107
- });
108
- return /* @__PURE__ */ import_react.default.createElement("span", {
109
- className: (0, import_classnames.default)("inline-flex justify-center items-center relative")
110
- }, /* @__PURE__ */ import_react.default.createElement("span", {
111
- className: `absolute inline-flex h-full w-full rounded-full text-red-600 -top-[28px] -left-[3px] ${statusCls} ${className}`
112
- }, "."));
113
- };
114
-
115
- // lib/blur-cover/BlurCover.tsx
116
- var import_react2 = __toESM(require("react"), 1);
117
- var import_classnames2 = __toESM(require("classnames"), 1);
118
- var BlurCover = (props) => {
119
- const { status } = props;
120
- const coverCls = (0, import_classnames2.default)(
121
- "absolute",
122
- "block",
123
- "text-blur",
124
- "transition-all",
125
- "duration-200",
126
- "top-0",
127
- "left-0",
128
- "h-full",
129
- "w-full",
130
- {
131
- "z-[49]": status === "show",
132
- "opacity-0": status === "silent",
133
- "opacity-100": status === "show",
134
- "pointer-events-none": status === "silent"
135
- },
136
- props.className
137
- );
138
- return /* @__PURE__ */ import_react2.default.createElement("div", {
139
- className: coverCls
140
- });
141
- };
142
-
143
- // lib/article/Article.tsx
144
- var Article = (props) => {
145
- const { title, content, children, date, className, description } = props;
146
- return /* @__PURE__ */ import_react3.default.createElement("div", {
147
- className: (0, import_classnames3.default)("article", className)
148
- }, /* @__PURE__ */ import_react3.default.createElement("div", {
149
- className: "mb-16 leading-none"
150
- }, /* @__PURE__ */ import_react3.default.createElement("span", {
151
- className: "text-[2.25rem] p-16"
152
- }, title), props.loading && title && /* @__PURE__ */ import_react3.default.createElement(BlinkDot, {
153
- status: "blink",
154
- className: "!-top-[42px] !-left-16"
155
- }), date ? /* @__PURE__ */ import_react3.default.createElement("div", {
156
- className: "py-16 px-18 pb-0 text-gray-400"
157
- }, /* @__PURE__ */ import_react3.default.createElement("small", null, date)) : null), description && /* @__PURE__ */ import_react3.default.createElement("div", {
158
- className: "mb-128"
159
- }, description), /* @__PURE__ */ import_react3.default.createElement("div", {
160
- className: "text-black relative p-16"
161
- }, children || content, /* @__PURE__ */ import_react3.default.createElement(BlurCover, {
162
- status: props.loading ? "show" : "silent"
163
- })));
164
- };
165
-
166
- // lib/button/Button.tsx
167
- var import_react4 = __toESM(require("react"), 1);
168
- var import_classnames4 = __toESM(require("classnames"), 1);
169
- var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
170
- ButtonType2["DANGER"] = "danger";
171
- ButtonType2["PRIMARY"] = "primary";
172
- ButtonType2["NORMAL"] = "normal";
173
- ButtonType2["DISABLED"] = "disabled";
174
- return ButtonType2;
175
- })(ButtonType || {});
176
- function Button(props) {
177
- const typeClsMap = {
178
- ["danger" /* DANGER */]: "text-red-500",
179
- ["primary" /* PRIMARY */]: "text-blue-600",
180
- ["disabled" /* DISABLED */]: "text-gray-400 cursor-not-allowed",
181
- ["normal" /* NORMAL */]: "text-black"
182
- };
183
- const [pressed, setPressed] = import_react4.default.useState(false);
184
- const { type = "normal" /* NORMAL */, className = "", onClick, btnType } = props;
185
- const shadowTransCls = type === "disabled" /* DISABLED */ ? "" : (0, import_classnames4.default)(
186
- "transition-all duration-200 ease-in-out shadow-button active:shadow-empty",
187
- {
188
- "shadow-empty": pressed,
189
- "hover:shadow-button-hover": !pressed
190
- }
191
- );
192
- const handleClick = (e) => {
193
- if (type === "disabled" /* DISABLED */) {
194
- return;
195
- }
196
- setPressed(true);
197
- setTimeout(() => {
198
- setPressed(false);
199
- onClick(e);
200
- }, 280);
201
- };
202
- return /* @__PURE__ */ import_react4.default.createElement("button", {
203
- className: `${typeClsMap[type]} ${className} ${shadowTransCls} py-8 px-16 transition-all duration-200 ease-in-out`,
204
- onClick: handleClick,
205
- type: btnType
206
- }, props.children);
207
- }
208
- Button.displayName = "Button";
209
-
210
- // lib/logo/Logo.tsx
211
- var React5 = __toESM(require("react"), 1);
212
- var Logo = React5.memo(
213
- (props) => /* @__PURE__ */ React5.createElement("svg", {
214
- xmlns: "http://www.w3.org/2000/svg",
215
- width: "48",
216
- height: "48",
217
- viewBox: "0 0 48 48",
218
- fill: "none",
219
- onClick: props.onClick,
220
- className: props.className
221
- }, /* @__PURE__ */ React5.createElement("path", {
222
- d: "M29.1152 21.3106C32.0605 21.3106 34.4481 18.9101 34.4481 15.9489V24.6457C34.4481 25.7585 33.5508 26.6607 32.444 26.6607H15.1207C14.0138 26.6607 13.1166 25.7585 13.1166 24.6457V15.9489C13.1166 18.9101 15.5042 21.3106 18.4494 21.3106C21.3947 21.3106 23.7823 18.9101 23.7823 15.9489C23.7823 18.9101 26.17 21.3106 29.1152 21.3106Z",
223
- fill: "#9CA3AF"
224
- }), /* @__PURE__ */ React5.createElement("path", {
225
- d: "M23.7823 15.9373L23.7823 15.9489C23.7823 15.9451 23.7823 15.9412 23.7823 15.9373Z",
226
- fill: "#9CA3AF"
227
- }), /* @__PURE__ */ React5.createElement("path", {
228
- d: "M23.1143 28.004C23.1205 30.9598 25.5057 33.3541 28.4472 33.3541C31.3886 33.3541 33.7738 30.9598 33.7801 28.004H23.1143Z",
229
- fill: "#9CA3AF"
230
- }), /* @__PURE__ */ React5.createElement("path", {
231
- d: "M13.7846 28.004C13.7846 28.0079 13.7846 28.0117 13.7846 28.0156C13.7908 30.9714 16.1761 33.3657 19.1175 33.3657C22.0589 33.3657 24.4442 30.9714 24.4504 28.0156H13.7846V28.004Z",
232
- fill: "#9CA3AF"
233
- }), /* @__PURE__ */ React5.createElement("path", {
234
- d: "M14.4527 15.9373C14.4527 16.6792 13.8545 17.2806 13.1166 17.2806C12.3786 17.2806 11.7805 16.6792 11.7805 15.9373C11.7805 15.1954 12.3786 14.594 13.1166 14.594C13.8545 14.594 14.4527 15.1954 14.4527 15.9373Z",
235
- fill: "#9CA3AF"
236
- }), /* @__PURE__ */ React5.createElement("path", {
237
- d: "M25.1184 15.2657C25.1184 16.0076 24.5202 16.609 23.7823 16.609C23.0444 16.609 22.4462 16.0076 22.4462 15.2657C22.4462 14.5238 23.0444 13.9224 23.7823 13.9224C24.5202 13.9224 25.1184 14.5238 25.1184 15.2657Z",
238
- fill: "#9CA3AF"
239
- }), /* @__PURE__ */ React5.createElement("path", {
240
- d: "M35.7842 15.9373C35.7842 16.6792 35.186 17.2806 34.4481 17.2806C33.7102 17.2806 33.112 16.6792 33.112 15.9373C33.112 15.1954 33.7102 14.594 34.4481 14.594C35.186 14.594 35.7842 15.1954 35.7842 15.9373Z",
241
- fill: "#9CA3AF"
242
- })),
243
- () => {
244
- return true;
245
- }
246
- );
247
-
248
- // lib/nav/Nav.tsx
249
- var import_react7 = __toESM(require("react"), 1);
250
-
251
- // lib/breadcrumb/Breadcrumb.tsx
252
- var import_react6 = __toESM(require("react"), 1);
253
- var import_classnames6 = __toESM(require("classnames"), 1);
254
-
255
- // lib/link/Link.tsx
256
- var import_classnames5 = __toESM(require("classnames"), 1);
257
- var import_react_router_dom = require("react-router-dom");
258
- var import_react5 = __toESM(require("react"), 1);
259
- var LinkColor = /* @__PURE__ */ ((LinkColor2) => {
260
- LinkColor2["BLUE"] = "blue";
261
- LinkColor2["RED"] = "red";
262
- LinkColor2["GRAY"] = "gray";
263
- return LinkColor2;
264
- })(LinkColor || {});
265
- var COLOR_MAPPING = {
266
- ["blue" /* BLUE */]: "text-blue-600",
267
- ["red" /* RED */]: "text-red-500",
268
- ["gray" /* GRAY */]: "text-gray-400"
269
- };
270
- var HOVER_COLOR_MAPPING = {
271
- ["blue" /* BLUE */]: "[&:not(:focus)]:hover:md:bg-blue-100 [&:not(:focus)]:hover:md:text-blue-600",
272
- ["red" /* RED */]: "[&:not(:focus)]:hover:md:bg-red-100 [&:not(:focus)]:hover:md:text-red-500",
273
- ["gray" /* GRAY */]: "[&:not(:focus)]:hover:md:bg-gray-100 [&:not(:focus)]:hover:md:text-gray-400"
274
- };
275
- var FOCUS_BG_COLOR_MAPPING = {
276
- ["blue" /* BLUE */]: "focus:bg-blue-100",
277
- ["red" /* RED */]: "focus:bg-red-100",
278
- ["gray" /* GRAY */]: "focus:bg-gray-100"
279
- };
280
- var Link = (props) => {
281
- const {
282
- color = "blue" /* BLUE */,
283
- external,
284
- className,
285
- children,
286
- status,
287
- readonly,
288
- ...rest
289
- } = props;
290
- const linkCls = (0, import_classnames5.default)(
291
- className,
292
- "rounded",
293
- "!no-underline",
294
- "inline-block",
295
- "transition-colors",
296
- "active:scale-[0.97]",
297
- COLOR_MAPPING[color],
298
- HOVER_COLOR_MAPPING[color],
299
- FOCUS_BG_COLOR_MAPPING[color]
300
- );
301
- if (external) {
302
- return /* @__PURE__ */ import_react5.default.createElement("a", {
303
- href: props.to,
304
- className: linkCls,
305
- target: "_blank",
306
- rel: "noreferrer",
307
- style: { padding: 4 }
308
- }, children);
309
- }
310
- if (readonly) {
311
- const isNonEnName = !/^[a-zA-Z~]+$/.test(children);
312
- const offsetCls = (0, import_classnames5.default)({ "relative top-[2px]": isNonEnName });
313
- return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement("span", {
314
- className: (0, import_classnames5.default)("text-gray-400", offsetCls),
315
- style: { padding: 4 }
316
- }, children), /* @__PURE__ */ import_react5.default.createElement(BlinkDot, {
317
- status
318
- }));
319
- }
320
- return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(import_react_router_dom.Link, {
321
- ...rest,
322
- className: linkCls,
323
- style: { padding: 4 }
324
- }, children), /* @__PURE__ */ import_react5.default.createElement(BlinkDot, {
325
- className: "-top-3 left-1",
326
- status
327
- }));
328
- };
329
-
330
- // lib/breadcrumb/Breadcrumb.tsx
331
- var Breadcrumb = (props) => {
332
- const { paths, loading } = props;
333
- const PathElements = paths.map(({ path, name }, index) => {
334
- const slash = index === 0 ? null : /* @__PURE__ */ import_react6.default.createElement("span", {
335
- className: "text-gray-400"
336
- }, "/");
337
- const isNonEnName = !/^[a-zA-Z~]+$/.test(name);
338
- const offsetCls = (0, import_classnames6.default)({ "relative top-[2px]": isNonEnName });
339
- const isLast = index === paths.length - 1;
340
- const status = loading && isLast ? "blink" : "hidden";
341
- return /* @__PURE__ */ import_react6.default.createElement("span", {
342
- key: path || name
343
- }, slash, /* @__PURE__ */ import_react6.default.createElement(Link, {
344
- to: path ?? "",
345
- className: offsetCls,
346
- readonly: !path,
347
- status
348
- }, name));
349
- });
350
- return /* @__PURE__ */ import_react6.default.createElement("div", {
351
- className: "breadcrumb"
352
- }, PathElements);
353
- };
354
-
355
- // lib/nav/Nav.tsx
356
- var import_react_router_dom2 = require("react-router-dom");
357
- var Nav = (props) => {
358
- if (props.mini) {
359
- return /* @__PURE__ */ import_react7.default.createElement("div", {
360
- className: `p-8 w-full flex items-center ${props.className}`
361
- }, /* @__PURE__ */ import_react7.default.createElement(Breadcrumb, {
362
- paths: props.paths
363
- }));
364
- }
365
- const nav = (0, import_react_router_dom2.useNavigate)();
366
- return /* @__PURE__ */ import_react7.default.createElement("div", {
367
- className: `p-8 w-full flex items-center ${props.className}`
368
- }, props.customLogo || /* @__PURE__ */ import_react7.default.createElement(Logo, {
369
- className: "mr-8",
370
- onClick: () => {
371
- nav("/");
372
- }
373
- }), /* @__PURE__ */ import_react7.default.createElement(Breadcrumb, {
374
- paths: props.paths,
375
- loading: props.loading
376
- }));
377
- };
378
-
379
- // lib/tag/Tag.tsx
380
- var import_classnames7 = __toESM(require("classnames"), 1);
381
- var import_react8 = __toESM(require("react"), 1);
382
- var Tag = (props) => {
383
- return /* @__PURE__ */ import_react8.default.createElement(Link, {
384
- ...props,
385
- color: "gray" /* GRAY */
386
- }, /* @__PURE__ */ import_react8.default.createElement("small", null, props.prefix || "#", props.children));
387
- };
388
- var Tags = (props) => {
389
- const { tags, className } = props;
390
- return /* @__PURE__ */ import_react8.default.createElement("div", {
391
- className: (0, import_classnames7.default)(className, "inline-block")
392
- }, tags.map((tag, index) => {
393
- const isLast = index === tags.length - 1;
394
- return /* @__PURE__ */ import_react8.default.createElement(Tag, {
395
- ...tag,
396
- key: tag.to,
397
- className: (0, import_classnames7.default)({ "mr-8": !isLast })
398
- });
399
- }));
400
- };
401
-
402
- // lib/panel/Panel.tsx
403
- var import_react9 = __toESM(require("react"), 1);
404
- var Panel = (props) => {
405
- const { className = "", children } = props;
406
- const [show, setShow] = (0, import_react9.useState)(false);
407
- (0, import_react9.useEffect)(() => {
408
- setShow(true);
409
- }, []);
410
- return /* @__PURE__ */ import_react9.default.createElement("div", {
411
- className: `transition-all ease-in-out duration-900 ${className} ${show ? "shadow-panel" : "shadow-empty"} p-32`
412
- }, children);
413
- };
414
-
415
- // lib/page/Page.tsx
416
- var import_react10 = __toESM(require("react"), 1);
417
- var Page = (props) => {
418
- const { nav, main } = props;
419
- return /* @__PURE__ */ import_react10.default.createElement("main", {
420
- className: "flex flex-col h-full"
421
- }, /* @__PURE__ */ import_react10.default.createElement("div", {
422
- className: `flx-grow-0 w-full fixed top-0 z-50`
423
- }, nav), /* @__PURE__ */ import_react10.default.createElement("section", {
424
- className: "flex-grow flex-shrink-0 px-6"
425
- }, main));
426
- };
427
- var NotFound = (props) => {
428
- return /* @__PURE__ */ import_react10.default.createElement(Error2, {
429
- error: { name: "404", message: "Not Found" }
430
- });
431
- };
432
- var Error2 = (props) => {
433
- const { error } = props;
434
- return /* @__PURE__ */ import_react10.default.createElement("div", {
435
- className: "prose"
436
- }, /* @__PURE__ */ import_react10.default.createElement("pre", null, /* @__PURE__ */ import_react10.default.createElement("code", {
437
- className: "javascript language-javascript"
438
- }, error.name, ":", error.message)));
439
- };
440
- var ErrorBoundary = class extends import_react10.default.Component {
441
- constructor(props) {
442
- super(props);
443
- this.state = { hasError: false };
444
- }
445
- static getDerivedStateFromError(error) {
446
- return { hasError: true, error };
447
- }
448
- render() {
449
- if (this.state.error && this.state.hasError) {
450
- return /* @__PURE__ */ import_react10.default.createElement(Article, {
451
- title: "\u51FA\u9519"
452
- }, /* @__PURE__ */ import_react10.default.createElement("div", {
453
- className: "relative h-256"
454
- }, /* @__PURE__ */ import_react10.default.createElement(Error2, {
455
- error: this.state.error
456
- })));
457
- }
458
- return this.props.children;
459
- }
460
- };
461
-
462
- // lib/pop-confirm/PopConfirm.tsx
463
- var import_react11 = __toESM(require("react"), 1);
464
- var PopConfirm = (props) => {
465
- const [loading, setLoading] = (0, import_react11.useState)(false);
466
- const { onOk, onCancel, children, content, className } = props;
467
- return /* @__PURE__ */ import_react11.default.createElement(Panel, {
468
- className
469
- }, /* @__PURE__ */ import_react11.default.createElement("div", {
470
- className: "mb-32"
471
- }, children || content), /* @__PURE__ */ import_react11.default.createElement("div", {
472
- className: "flex justify-end"
473
- }, onCancel && /* @__PURE__ */ import_react11.default.createElement(Button, {
474
- onClick: onCancel,
475
- type: "normal" /* NORMAL */
476
- }, "Cancel"), onOk && /* @__PURE__ */ import_react11.default.createElement(Button, {
477
- onClick: async (e) => {
478
- setLoading(true);
479
- await onOk(e);
480
- setLoading(false);
481
- },
482
- className: "ml-16 relative",
483
- type: loading ? "disabled" /* DISABLED */ : "primary" /* PRIMARY */
484
- }, "OK", loading && /* @__PURE__ */ import_react11.default.createElement(BlinkDot, {
485
- className: "!absolute top-2 right-2"
486
- }))));
487
- };
488
-
489
- // lib/table/Table.tsx
490
- var import_react12 = __toESM(require("react"), 1);
491
- var Table = (props) => {
492
- const { rowCount, rowRenderer, headerRenderer, className } = props;
493
- const rows = [];
494
- for (let i = 0; i < rowCount; i++) {
495
- rows.push(/* @__PURE__ */ import_react12.default.createElement("tr", {
496
- key: i
497
- }, rowRenderer(i)));
498
- }
499
- return /* @__PURE__ */ import_react12.default.createElement("table", {
500
- className
501
- }, headerRenderer && /* @__PURE__ */ import_react12.default.createElement("thead", null, /* @__PURE__ */ import_react12.default.createElement("tr", null, headerRenderer())), /* @__PURE__ */ import_react12.default.createElement("tbody", null, rows));
502
- };
503
- Table.HCell = (props) => /* @__PURE__ */ import_react12.default.createElement("th", {
504
- ...props
505
- }, props.children);
506
- Table.Cell = (props) => /* @__PURE__ */ import_react12.default.createElement("td", {
507
- ...props
508
- }, props.children);
509
-
510
- // lib/skeleton/Seleton.tsx
511
- var import_classnames9 = __toESM(require("classnames"), 1);
512
- var import_react14 = __toESM(require("react"), 1);
513
-
514
- // lib/list/list.tsx
515
- var import_classnames8 = __toESM(require("classnames"), 1);
516
- var import_react13 = __toESM(require("react"), 1);
517
- var List = (props) => {
518
- const { items, itemRenderer, className, horizontal, compact, footer } = props;
519
- const spaceCls = compact ? "" : horizontal ? "mr-3" : "mb-16";
520
- return /* @__PURE__ */ import_react13.default.createElement("ul", {
521
- className: (0, import_classnames8.default)(className, "list-style-none", {
522
- flex: horizontal,
523
- "items-center": horizontal
524
- })
525
- }, items.map((item, index) => {
526
- return /* @__PURE__ */ import_react13.default.createElement("li", {
527
- key: item.id || index,
528
- className: (0, import_classnames8.default)(spaceCls, "flex-shrink-0", { "!my-0": horizontal })
529
- }, itemRenderer(item, index));
530
- }), footer && /* @__PURE__ */ import_react13.default.createElement("li", {
531
- key: "footer",
532
- className: (0, import_classnames8.default)(spaceCls, "flex-shrink-0", { "!my-0": horizontal })
533
- }, footer));
534
- };
535
- var TitledList = (props) => {
536
- const { title, description, ...rest } = props;
537
- if (!title) {
538
- return /* @__PURE__ */ import_react13.default.createElement(List, {
539
- ...rest
540
- });
541
- }
542
- return /* @__PURE__ */ import_react13.default.createElement(Article, {
543
- title,
544
- description,
545
- className: "w-fit"
546
- }, /* @__PURE__ */ import_react13.default.createElement(List, {
547
- ...rest
548
- }));
549
- };
550
- var LinkList = (props) => {
551
- const { title, description, links, ...rest } = props;
552
- const renderLink = ({ name, to, external, ...rest2 }) => {
553
- return /* @__PURE__ */ import_react13.default.createElement(Link, {
554
- to,
555
- key: name,
556
- external,
557
- ...rest2
558
- }, name);
559
- };
560
- return /* @__PURE__ */ import_react13.default.createElement(TitledList, {
561
- title,
562
- description,
563
- items: links,
564
- itemRenderer: renderLink,
565
- ...rest
566
- });
567
- };
568
-
569
- // lib/skeleton/Seleton.tsx
570
- var SkeletonColor = /* @__PURE__ */ ((SkeletonColor2) => {
571
- SkeletonColor2["BLUE"] = "blue";
572
- SkeletonColor2["RED"] = "red";
573
- SkeletonColor2["GRAY"] = "gray";
574
- SkeletonColor2["BLACK"] = "black";
575
- return SkeletonColor2;
576
- })(SkeletonColor || {});
577
- var COLOR_MAPPING2 = {
578
- ["blue" /* BLUE */]: "bg-blue-100",
579
- ["red" /* RED */]: "bg-red-100",
580
- ["gray" /* GRAY */]: "bg-gray-100",
581
- ["black" /* BLACK */]: "bg-gray-200"
582
- };
583
- var Skeleton = (props) => {
584
- const {
585
- bgColor = "gray" /* GRAY */,
586
- width = 26,
587
- height = 24,
588
- className
589
- } = props;
590
- return /* @__PURE__ */ import_react14.default.createElement("div", {
591
- className: (0, import_classnames9.default)(
592
- COLOR_MAPPING2[bgColor],
593
- "animate-pulse",
594
- "rounded",
595
- className
596
- ),
597
- style: { width, height }
598
- });
599
- };
600
- var ArticleSkeleton = (props) => {
601
- const { children, titleLength = 0, descriptionLength } = props;
602
- return /* @__PURE__ */ import_react14.default.createElement(Article, {
603
- title: /* @__PURE__ */ import_react14.default.createElement(Skeleton, {
604
- width: 36 * titleLength,
605
- height: 36,
606
- bgColor: "black" /* BLACK */
607
- }),
608
- description: descriptionLength && /* @__PURE__ */ import_react14.default.createElement(Skeleton, {
609
- width: 16 * descriptionLength
610
- })
611
- }, children);
612
- };
613
- var LinkListSkeleton = (props) => {
614
- const { linksLength, ...rest } = props;
615
- const renderSkeleton = (length) => {
616
- return /* @__PURE__ */ import_react14.default.createElement(Skeleton, {
617
- className: "inline-block align-middle",
618
- width: length * 16,
619
- bgColor: "blue" /* BLUE */
620
- });
621
- };
622
- if (!rest.titleLength) {
623
- return /* @__PURE__ */ import_react14.default.createElement(List, {
624
- items: linksLength,
625
- itemRenderer: renderSkeleton
626
- });
627
- }
628
- return /* @__PURE__ */ import_react14.default.createElement(ArticleSkeleton, {
629
- ...rest
630
- }, /* @__PURE__ */ import_react14.default.createElement(List, {
631
- items: linksLength,
632
- itemRenderer: renderSkeleton
633
- }));
634
- };
635
-
636
- // lib/drop-image/DropImage.tsx
637
- var import_classnames10 = __toESM(require("classnames"), 1);
638
- var import_react16 = __toESM(require("react"), 1);
639
- var import_react17 = require("react");
640
-
641
- // lib/drop-image/utils.ts
642
- var wait = (d) => new Promise((r) => setTimeout(r, d));
643
-
644
- // lib/drop-image/useDropImage.ts
645
- var import_react15 = require("react");
646
- var useDropImage = (params) => {
647
- const [isDragOver, setIsDragOver] = (0, import_react15.useState)(false);
648
- const [imageSrc, setImageSrc] = (0, import_react15.useState)("");
649
- const [imageSize, setImageSize] = (0, import_react15.useState)({ width: 0, height: 0 });
650
- const imageFile = (0, import_react15.useRef)();
651
- const {
652
- portraitImageWidth = 384,
653
- landscapeImageWidth = 500,
654
- onDrop = () => {
655
- },
656
- onImageLoad = () => {
657
- }
658
- } = params || {};
659
- const reset = () => {
660
- setImageSrc("");
661
- setImageSize({ width: 0, height: 0 });
662
- setIsDragOver(false);
663
- imageFile.current = null;
664
- };
665
- const calcDefaultImgSize2 = (img, defaultWidth) => {
666
- const { width, height } = img;
667
- const whRatio = width / height;
668
- const isHorizontal = width > height;
669
- const finalWidth = defaultWidth || (isHorizontal ? landscapeImageWidth : portraitImageWidth);
670
- return {
671
- width: finalWidth,
672
- height: finalWidth / whRatio
673
- };
674
- };
675
- const setPreviewImageSrcByFile = (file) => {
676
- try {
677
- setImageSrc(URL.createObjectURL(file));
678
- } catch (e) {
679
- setImageSrc("");
680
- }
681
- };
682
- const handleDragOver = (0, import_react15.useCallback)((ev) => {
683
- ev.preventDefault();
684
- setIsDragOver(true);
685
- if (!ev.dataTransfer) {
686
- return;
687
- }
688
- ev.dataTransfer.dropEffect = "move";
689
- }, []);
690
- const handleDragLeave = (0, import_react15.useCallback)(() => {
691
- setIsDragOver(false);
692
- }, []);
693
- const handleDrop = (0, import_react15.useCallback)((ev) => {
694
- ev.preventDefault();
695
- setIsDragOver(false);
696
- const file = ev.dataTransfer ? ev.dataTransfer.files[0] : void 0;
697
- if (!file || !file.type.startsWith("image")) {
698
- return;
699
- }
700
- imageFile.current = file;
701
- setPreviewImageSrcByFile(file);
702
- onDrop(ev, file);
703
- }, []);
704
- const handleImgLoad = (img) => {
705
- const updateFunc = async () => {
706
- const p = "decode" in img ? img.decode : Promise.resolve;
707
- try {
708
- await p();
709
- } catch (e) {
710
- }
711
- setImageSize(
712
- calcDefaultImgSize2({
713
- width: img.naturalWidth,
714
- height: img.naturalHeight
715
- })
716
- );
717
- if (!imageFile.current) {
718
- return;
719
- }
720
- onImageLoad(img, imageFile.current);
721
- };
722
- if (img.complete) {
723
- updateFunc().then();
724
- return;
725
- }
726
- img.onload = updateFunc;
727
- };
728
- const imageRef = (0, import_react15.useCallback)((input) => {
729
- if (!input) {
730
- return;
731
- }
732
- handleImgLoad(input);
733
- }, []);
734
- return {
735
- isDragOver,
736
- imageSrc,
737
- imageRef,
738
- imageSize,
739
- handleDragOver,
740
- handleDragLeave,
741
- handleDrop,
742
- reset
743
- };
744
- };
745
-
746
- // lib/drop-image/DropImage.tsx
747
- var ImagePreviewer = (props) => {
748
- const {
749
- visible: showImagePreviewer,
750
- imageRef,
751
- imageSize,
752
- imageSrc,
753
- className
754
- } = props;
755
- return /* @__PURE__ */ import_react16.default.createElement("img", {
756
- className: (0, import_classnames10.default)(
757
- className,
758
- "max-w-[100%]",
759
- "h-[auto]",
760
- "duration-300",
761
- "transition-opacity",
762
- "opacity-100",
763
- {
764
- "opacity-0": !showImagePreviewer,
765
- "!m-0": !showImagePreviewer,
766
- "!p-0": !showImagePreviewer
767
- }
768
- ),
769
- ref: imageRef,
770
- src: imageSrc,
771
- width: imageSize.width,
772
- height: imageSize.height
773
- });
774
- };
775
- var GhostDropImage = (props) => {
776
- const {
777
- onDrop = () => {
778
- },
779
- onUploadFinish = () => {
780
- },
781
- uploader,
782
- waitTimeAfterFinish = 2e3,
783
- className = "",
784
- children,
785
- placeholder
786
- } = props;
787
- const [coverVisible, setCoverVisible] = (0, import_react17.useState)(false);
788
- const [imageVisible, setImageVisible] = (0, import_react17.useState)(false);
789
- const handleDocDragEnter = (0, import_react16.useCallback)(() => {
790
- setCoverVisible(true);
791
- }, []);
792
- const {
793
- handleDragLeave,
794
- handleDragOver,
795
- handleDrop,
796
- imageRef,
797
- imageSize,
798
- imageSrc,
799
- reset
800
- } = useDropImage({
801
- onImageLoad: () => {
802
- setImageVisible(true);
803
- },
804
- onDrop: async (e, file) => {
805
- onDrop(e, file);
806
- setCoverVisible(false);
807
- const result = await uploader(file);
808
- await wait(waitTimeAfterFinish);
809
- onUploadFinish(result);
810
- setImageVisible(false);
811
- reset();
812
- }
813
- });
814
- (0, import_react16.useEffect)(() => {
815
- document.addEventListener("dragenter", handleDocDragEnter);
816
- return () => {
817
- document.removeEventListener("dragenter", handleDocDragEnter);
818
- };
819
- }, []);
820
- const coverCls = (0, import_classnames10.default)("fixed", "top-0", "left-0", "h-full", "w-full", {
821
- "lqip-blur": coverVisible,
822
- "z-[999]": coverVisible,
823
- block: coverVisible,
824
- hidden: !coverVisible
825
- });
826
- return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement("div", {
827
- className: coverCls,
828
- onDragLeave: () => {
829
- handleDragLeave();
830
- setCoverVisible(false);
831
- },
832
- onDragOver: handleDragOver,
833
- onDrop: handleDrop
834
- }), !imageVisible && placeholder, children ? children({
835
- visible: imageVisible,
836
- imageRef,
837
- imageSize,
838
- imageSrc
839
- }) : /* @__PURE__ */ import_react16.default.createElement(ImagePreviewer, {
840
- className,
841
- visible: imageVisible,
842
- imageRef,
843
- imageSrc,
844
- imageSize
845
- }));
846
- };
847
- var DropImage = (props) => {
848
- const {
849
- uploader,
850
- defaultBgColor = "#F3F4F6",
851
- onDrop,
852
- dragOverBgColor = "#EFF6FF",
853
- waitTimeAfterFinish = 2e3,
854
- placeholder = "",
855
- className = "",
856
- onUploadFinish = () => {
857
- },
858
- ghost,
859
- children,
860
- dropAreaStyle = {
861
- width: 300,
862
- height: 300
863
- }
864
- } = props;
865
- if (ghost) {
866
- return /* @__PURE__ */ import_react16.default.createElement(GhostDropImage, {
867
- ...props
868
- });
869
- }
870
- const [showImagePreviewer, setShowImagePreviewer] = (0, import_react17.useState)(false);
871
- const {
872
- handleDragLeave,
873
- handleDragOver,
874
- handleDrop,
875
- imageRef,
876
- imageSize,
877
- imageSrc,
878
- isDragOver,
879
- reset
880
- } = useDropImage({
881
- onDrop,
882
- onImageLoad: async (image, file) => {
883
- await wait(500);
884
- setShowImagePreviewer(true);
885
- await onUploadFinish(await uploader(file, image));
886
- await wait(waitTimeAfterFinish);
887
- setShowImagePreviewer(false);
888
- await wait(500);
889
- reset();
890
- }
891
- });
892
- const getDropAreaStyle = () => {
893
- return Object.assign({}, dropAreaStyle, {
894
- background: isDragOver ? dragOverBgColor : defaultBgColor,
895
- width: imageSize.width || dropAreaStyle.width,
896
- height: imageSize.height || dropAreaStyle.height
897
- });
898
- };
899
- return /* @__PURE__ */ import_react16.default.createElement("div", {
900
- className: (0, import_classnames10.default)(
901
- className,
902
- "transition-all items-center justify-center flex duration-200 ease-in-out",
903
- {
904
- "shadow-input": !imageSrc,
905
- "shadow-empty": imageSrc
906
- }
907
- ),
908
- onDragLeave: handleDragLeave,
909
- onDragOver: handleDragOver,
910
- onDrop: handleDrop,
911
- style: getDropAreaStyle()
912
- }, children ? children({
913
- visible: showImagePreviewer,
914
- imageRef,
915
- imageSize,
916
- imageSrc
917
- }) : /* @__PURE__ */ import_react16.default.createElement(ImagePreviewer, {
918
- visible: showImagePreviewer,
919
- imageRef,
920
- imageSrc,
921
- imageSize
922
- }), !imageSrc && placeholder);
923
- };
924
-
925
- // lib/layout/layout.tsx
926
- var import_classnames11 = __toESM(require("classnames"), 1);
927
- var import_react18 = __toESM(require("react"), 1);
928
- var ThreeColLayout = (props) => {
929
- const { leftRenderer, middleRenderer, rightRenderer } = props;
930
- const colCls = (0, import_classnames11.default)("max-h-full overflow-auto xl:!block py-128");
931
- return /* @__PURE__ */ import_react18.default.createElement("div", {
932
- className: "grid grid-cols-1 xl:grid-cols-3 gap-4 h-full w-full"
933
- }, /* @__PURE__ */ import_react18.default.createElement("div", {
934
- className: (0, import_classnames11.default)("hidden", colCls)
935
- }, leftRenderer && leftRenderer()), /* @__PURE__ */ import_react18.default.createElement("div", {
936
- className: (0, import_classnames11.default)(colCls, "sm:px-128 xl:px-0 no-scrollbar", "relative", {
937
- hidden: !middleRenderer
938
- })
939
- }, middleRenderer && middleRenderer()), /* @__PURE__ */ import_react18.default.createElement("div", {
940
- className: (0, import_classnames11.default)("hidden", colCls)
941
- }, rightRenderer && rightRenderer()));
942
- };
943
-
944
- // lib/img/Img.tsx
945
- var import_classnames12 = __toESM(require("classnames"), 1);
946
- var import_react19 = __toESM(require("react"), 1);
947
-
948
- // lib/img/types.ts
949
- var ossProcessType = /* @__PURE__ */ ((ossProcessType2) => {
950
- ossProcessType2["THUMBNAIL"] = "thumbnail";
951
- ossProcessType2["WEBP"] = "webp";
952
- ossProcessType2["NULL"] = "null";
953
- ossProcessType2["oWEBP"] = "owebp";
954
- ossProcessType2["PROG"] = "prog";
955
- return ossProcessType2;
956
- })(ossProcessType || {});
957
-
958
- // lib/img/utils.ts
959
- var addOssWebpProcessStyle = (originUrl, style) => {
960
- const OSS_ADDRESS = "https://zjh-im-res.oss-cn-shenzhen.aliyuncs.com";
961
- const isInvalidOSSImgUrl = !originUrl.startsWith(OSS_ADDRESS);
962
- const isProcessedOssImg = /x-oss-process=style\/\w+/.test(originUrl);
963
- const isWebpImg = /webp$/.test(originUrl);
964
- if (isInvalidOSSImgUrl || isProcessedOssImg || isWebpImg && style === "webp" /* WEBP */ || style === "null" /* NULL */) {
965
- return originUrl;
966
- }
967
- return `${originUrl}?x-oss-process=style/${style}`;
968
- };
969
- var calcDefaultImgSize = (img, defaultWidth, scale) => {
970
- const { width, height } = img;
971
- const whRatio = width / height;
972
- const isHorizontal = width > height;
973
- const finalWidth = (defaultWidth || (isHorizontal ? 576 : 384)) * (scale || 1);
974
- return {
975
- width: finalWidth,
976
- height: finalWidth / whRatio
977
- };
978
- };
979
-
980
- // lib/img/Img.tsx
981
- var emptyDataURL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
982
- var Img = (props) => {
983
- const {
984
- src,
985
- className,
986
- renderedWidth,
987
- avgColor,
988
- thumbnailSrc,
989
- processType,
990
- size,
991
- removeBlurBgAfterLoad
992
- } = props;
993
- const { width, height } = calcDefaultImgSize(
994
- props,
995
- renderedWidth,
996
- size === "normal" ? 0.6 : 1
997
- );
998
- const [loaded, setLoaded] = (0, import_react19.useState)(false);
999
- const [decoded, setDecoded] = (0, import_react19.useState)(false);
1000
- const baseWrapperStyle = {
1001
- width: "initial",
1002
- height: "initial",
1003
- backgroundSize: "cover",
1004
- backgroundColor: avgColor || "#f1f1f1",
1005
- backgroundPosition: "0% 0%",
1006
- backgroundImage: `url(${thumbnailSrc ? thumbnailSrc : addOssWebpProcessStyle(src, "thumbnail" /* THUMBNAIL */)})`
1007
- };
1008
- const dynamicWrapperStyle = loaded && removeBlurBgAfterLoad ? { backgroundImage: "none" } : {};
1009
- const handleImgLoad = (img) => {
1010
- const updateFunc = async () => {
1011
- const p = "decode" in img ? img.decode : Promise.resolve;
1012
- try {
1013
- await p();
1014
- } catch (e) {
1015
- }
1016
- setDecoded(true);
1017
- setLoaded(true);
1018
- };
1019
- if (img.complete) {
1020
- updateFunc().then();
1021
- return;
1022
- }
1023
- img.onload = updateFunc;
1024
- };
1025
- return /* @__PURE__ */ import_react19.default.createElement("span", {
1026
- className: (0, import_classnames12.default)(
1027
- className,
1028
- "inline-block",
1029
- "relative",
1030
- "overflow-hidden",
1031
- "duration-500",
1032
- "leading-none",
1033
- "align-bottom",
1034
- "border-0"
1035
- ),
1036
- draggable: false,
1037
- style: Object.assign({}, baseWrapperStyle, dynamicWrapperStyle)
1038
- }, /* @__PURE__ */ import_react19.default.createElement("img", {
1039
- ref: (input) => {
1040
- if (!input) {
1041
- return;
1042
- }
1043
- handleImgLoad(input);
1044
- },
1045
- width,
1046
- height,
1047
- src: addOssWebpProcessStyle(src, processType || "webp" /* WEBP */),
1048
- decoding: "async",
1049
- loading: "lazy",
1050
- crossOrigin: "anonymous",
1051
- style: {
1052
- contentVisibility: "auto"
1053
- },
1054
- className: (0, import_classnames12.default)(
1055
- "transition-opacity",
1056
- "opacity-100",
1057
- "duration-500",
1058
- {
1059
- "opacity-0": !decoded
1060
- }
1061
- )
1062
- }), /* @__PURE__ */ import_react19.default.createElement("img", {
1063
- src: emptyDataURL,
1064
- className: (0, import_classnames12.default)(
1065
- "lqip-blur",
1066
- "absolute",
1067
- "h-full",
1068
- "w-full",
1069
- "duration-500",
1070
- "transition-opacity",
1071
- {
1072
- "opacity-100": !decoded,
1073
- "opacity-0": decoded
1074
- }
1075
- ),
1076
- crossOrigin: "anonymous",
1077
- style: { top: 0, left: 0 }
1078
- }));
1079
- };
1080
-
1081
- // lib/img/Gallery.tsx
1082
- var import_classnames14 = __toESM(require("classnames"), 1);
1083
- var import_react21 = __toESM(require("react"), 1);
1084
-
1085
- // lib/img/RandomRowsLayout.tsx
1086
- var import_classnames13 = __toESM(require("classnames"), 1);
1087
- var import_react20 = __toESM(require("react"), 1);
1088
- var last = (arr) => {
1089
- if (arr.length < 2) {
1090
- return arr[0];
1091
- }
1092
- return arr[arr.length - 1];
1093
- };
1094
- var defaultCellClsGenerator = (colNum, isCenterSingleCell) => {
1095
- const isSingleCell = colNum === 1;
1096
- const singleCellWidth = isCenterSingleCell ? "full" : "1/2";
1097
- const cellWidth = isSingleCell ? singleCellWidth : "1/2";
1098
- return `md:basis-${cellWidth}`;
1099
- };
1100
- var generateRandomBoolean = (p = 0.5) => Math.random() < p;
1101
- var generateRandomColNum = (total) => {
1102
- const colNumArr = [];
1103
- if (total <= 2) {
1104
- return [total];
1105
- }
1106
- let colSum = 0;
1107
- while (colSum < total) {
1108
- const p = last(colNumArr) === 2 ? 0.9 : 0.5;
1109
- const num = generateRandomBoolean(p) ? 1 : 2;
1110
- colNumArr.push(num);
1111
- colSum += num;
1112
- }
1113
- return colNumArr;
1114
- };
1115
- var sumColNumByIdx = (colNums, idx) => {
1116
- let sum = 0;
1117
- for (let i = 0; i < idx; i++) {
1118
- sum += colNums[i];
1119
- }
1120
- return sum;
1121
- };
1122
- var RandomRowsLayout = import_react20.default.memo(
1123
- (props) => {
1124
- const {
1125
- cellsCount,
1126
- cellRenderer,
1127
- classNames: classNames9 = "",
1128
- cellWrapperClsGenerator = defaultCellClsGenerator
1129
- } = props;
1130
- const colNums = generateRandomColNum(cellsCount);
1131
- return /* @__PURE__ */ import_react20.default.createElement("div", {
1132
- className: classNames9
1133
- }, colNums.map((colNum, row) => {
1134
- const randBool = generateRandomBoolean(
1135
- colNum < 2 ? 0.6 : 0.5
1136
- );
1137
- const randBoolArr = [randBool, !randBool];
1138
- return /* @__PURE__ */ import_react20.default.createElement("div", {
1139
- className: "flex items-center flex-wrap",
1140
- key: row
1141
- }, new Array(colNum).fill(null).map((_, col) => {
1142
- const generatedCls = cellWrapperClsGenerator(
1143
- colNum,
1144
- generateRandomBoolean()
1145
- );
1146
- const currentIdx = sumColNumByIdx(colNums, row) + col;
1147
- const cls6 = (0, import_classnames13.default)(
1148
- "flex items-center justify-center flex-shrink-0 flex-grow-0",
1149
- "basis-full",
1150
- generatedCls
1151
- );
1152
- return /* @__PURE__ */ import_react20.default.createElement("div", {
1153
- className: cls6,
1154
- key: col
1155
- }, cellRenderer(currentIdx, randBoolArr[col], col));
1156
- }));
1157
- }));
1158
- },
1159
- (prevProps, nextProps) => {
1160
- return prevProps.cellsCount === nextProps.cellsCount;
1161
- }
1162
- );
1163
-
1164
- // lib/img/Gallery.tsx
1165
- var defaultImageRenderer = (img, index, col) => {
1166
- return /* @__PURE__ */ import_react21.default.createElement("div", {
1167
- className: (0, import_classnames14.default)("mb-128", {
1168
- "md:mr-64": col === 0,
1169
- "md:ml-64": col !== 0
1170
- })
1171
- }, img);
1172
- };
1173
- var Gallery = (props) => {
1174
- const {
1175
- images,
1176
- children,
1177
- imageRenderer = defaultImageRenderer,
1178
- className = "",
1179
- ...rest
1180
- } = props;
1181
- const renderImage = (index, isLargeImage, col) => {
1182
- const image = images[index];
1183
- if (!image) {
1184
- return null;
1185
- }
1186
- return imageRenderer(
1187
- /* @__PURE__ */ import_react21.default.createElement(Img, {
1188
- ...image,
1189
- size: isLargeImage ? "large" : "normal"
1190
- }),
1191
- index,
1192
- col,
1193
- isLargeImage
1194
- );
1195
- };
1196
- return /* @__PURE__ */ import_react21.default.createElement("div", {
1197
- className: (0, import_classnames14.default)("w-full flex justify-center", className)
1198
- }, /* @__PURE__ */ import_react21.default.createElement(RandomRowsLayout, {
1199
- classNames: "mx-32 mt-128 max-w-screen-xl",
1200
- cellsCount: images.length,
1201
- cellRenderer: renderImage,
1202
- ...rest
1203
- }), children);
1204
- };
1205
-
1206
- // lib/loading-spiral/LoadingSpiral.tsx
1207
- var import_phenomenon = __toESM(require("phenomenon"), 1);
1208
- var import_classnames15 = __toESM(require("classnames"), 1);
1209
- var import_react22 = __toESM(require("react"), 1);
1210
-
1211
- // lib/loading-spiral/createSettings.ts
1212
- var createSettings = (settings) => {
1213
- const { canvas, step = 0.09 } = settings;
1214
- const uniforms = {
1215
- uProgress: {
1216
- type: "float",
1217
- value: 0
1218
- }
1219
- };
1220
- return {
1221
- uniforms,
1222
- devicePixelRatio: window.devicePixelRatio,
1223
- shouldRender: true,
1224
- canvas,
1225
- onRender: (r) => {
1226
- const { uProgress } = r.uniforms;
1227
- uProgress.value += step;
1228
- }
1229
- };
1230
- };
1231
-
1232
- // lib/loading-spiral/constants.ts
1233
- var VERTEX_SHADER = `
1234
- attribute float ${"aPercent" /* PERCENT */};
1235
- attribute float ${"aPointSize" /* POINT_SIZE */};
1236
-
1237
- uniform mat4 uProjectionMatrix;
1238
- uniform mat4 uModelMatrix;
1239
- uniform mat4 uViewMatrix;
1240
- uniform float uProgress;
1241
-
1242
- varying vec3 vColor;
1243
-
1244
- vec3 curve(float _percent) {
1245
- const float PI2 = 3.141592653589793 * 2.0;
1246
- const float _length = 0.3;
1247
- const float radius = 0.056;
1248
- float t = mod(_percent, 0.25) / 0.25;
1249
- t = mod(_percent, 0.25) - (2.0 * (1.0 - t) * t * -0.0185 + t * t * 0.25);
1250
- float x = _length * sin(PI2 * _percent);
1251
- float y = radius * cos(PI2 * 3.0 * _percent);
1252
-
1253
- if (
1254
- floor(_percent / 0.25) == 0.0
1255
- || floor(_percent / 0.25) == 2.0
1256
- ) {
1257
- t = t * -1.0;
1258
- }
1259
- float z = radius * sin(PI2 * 2.0 * (_percent - t));
1260
- return vec3(x, y, z);
1261
- }
1262
-
1263
- mat4 rotateX(float _angle){
1264
- return mat4(
1265
- 1.0, 0.0, 0.0, 0.0,
1266
- 0.0, cos(_angle), -sin(_angle), 0.0,
1267
- 0.0, sin(_angle), cos(_angle), 0.0,
1268
- 0.0, 0.0, 0.0, 1.0
1269
- );
1270
- }
1271
-
1272
- void main(){
1273
- gl_Position = uProjectionMatrix
1274
- * uModelMatrix
1275
- * uViewMatrix
1276
- * rotateX(uProgress)
1277
- * vec4(curve(${"aPercent" /* PERCENT */}), 1.0);
1278
-
1279
- gl_PointSize = ${"aPointSize" /* POINT_SIZE */};
1280
- }
1281
- `;
1282
- var FRAGMENT_SHADER = `
1283
- precision mediump float;
1284
- uniform float uProgress;
1285
- void main(){
1286
- gl_FragColor = vec4(0.81, 0.83, 0.85, 1.0);
1287
- }
1288
- `;
1289
-
1290
- // lib/loading-spiral/createOptions.ts
1291
- var createOptions = () => {
1292
- const attributes = [
1293
- {
1294
- name: "aPercent" /* PERCENT */,
1295
- data: (i, total) => [i / total],
1296
- size: 1
1297
- },
1298
- {
1299
- name: "aPointSize" /* POINT_SIZE */,
1300
- data: () => [window.devicePixelRatio * 1.3],
1301
- size: 1
1302
- }
1303
- ];
1304
- const uniforms = {
1305
- uProgress: {
1306
- type: "float",
1307
- value: [0]
1308
- }
1309
- };
1310
- return {
1311
- uniforms,
1312
- attributes,
1313
- multiplier: 4e3,
1314
- vertex: VERTEX_SHADER,
1315
- fragment: FRAGMENT_SHADER
1316
- };
1317
- };
1318
-
1319
- // lib/loading-spiral/LoadingSpiral.tsx
1320
- var LoadingSpiral = (props) => {
1321
- const { className, step } = props || {};
1322
- const canvasRef = (0, import_react22.useRef)(null);
1323
- (0, import_react22.useEffect)(() => {
1324
- if (!canvasRef.current) {
1325
- return;
1326
- }
1327
- const phenomenon = new import_phenomenon.default({
1328
- settings: createSettings({ canvas: canvasRef.current, step }),
1329
- context: {
1330
- antialias: true,
1331
- alpha: true
1332
- }
1333
- });
1334
- phenomenon.add(
1335
- "spiral",
1336
- createOptions()
1337
- );
1338
- }, []);
1339
- return /* @__PURE__ */ import_react22.default.createElement("canvas", {
1340
- style: {
1341
- maxWidth: 500,
1342
- maxHeight: 500,
1343
- imageRendering: "pixelated"
1344
- },
1345
- ref: canvasRef,
1346
- className: (0, import_classnames15.default)(
1347
- "h-full w-full overflow-hidden flex justify-center items-center aspect-1",
1348
- className
1349
- )
1350
- });
1351
- };
1352
-
1353
- // lib/drop-zone/DropZone.tsx
1354
- var import_react23 = __toESM(require("react"), 1);
1355
- var import_classnames16 = __toESM(require("classnames"), 1);
1356
- var DropZone = (props) => {
1357
- const { onDrop, children, className, style } = props;
1358
- const [coverVisible, setCoverVisible] = (0, import_react23.useState)(false);
1359
- const handleDrop = (e) => {
1360
- e.preventDefault();
1361
- setCoverVisible(false);
1362
- const file = e.dataTransfer.files[0];
1363
- onDrop(file);
1364
- };
1365
- const handleDocDragEnter = (0, import_react23.useCallback)((e) => {
1366
- e.preventDefault();
1367
- setCoverVisible(true);
1368
- }, []);
1369
- (0, import_react23.useEffect)(() => {
1370
- document.addEventListener("dragenter", handleDocDragEnter);
1371
- return () => {
1372
- document.removeEventListener("dragenter", handleDocDragEnter);
1373
- };
1374
- }, []);
1375
- if (props.disabled) {
1376
- return /* @__PURE__ */ import_react23.default.createElement(import_react23.default.Fragment, null, children);
1377
- }
1378
- const handleDragOver = (e) => {
1379
- e.preventDefault();
1380
- setCoverVisible(true);
1381
- };
1382
- const coverCls = (0, import_classnames16.default)("fixed", "top-0", "left-0", "h-full", "w-full", {
1383
- "text-blur": coverVisible,
1384
- "z-[999]": coverVisible,
1385
- block: coverVisible,
1386
- hidden: !coverVisible
1387
- });
1388
- return /* @__PURE__ */ import_react23.default.createElement(import_react23.default.Fragment, null, /* @__PURE__ */ import_react23.default.createElement("div", {
1389
- className: coverCls,
1390
- onDragLeave: () => {
1391
- setCoverVisible(false);
1392
- },
1393
- onDragOver: handleDragOver,
1394
- onDrop: handleDrop
1395
- }), children);
1396
- };
1397
-
1398
- // lib/context-menu/index.tsx
1399
- var React23 = __toESM(require("react"), 1);
1400
- var ContextMenuPrimitive = __toESM(require("@radix-ui/react-context-menu"), 1);
1401
- var import_react_icons = require("@radix-ui/react-icons");
1402
- var import_classnames17 = __toESM(require("classnames"), 1);
1403
- "use client";
1404
- var ContextMenu = ContextMenuPrimitive.Root;
1405
- var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
1406
- var ContextMenuGroup = ContextMenuPrimitive.Group;
1407
- var ContextMenuPortal = ContextMenuPrimitive.Portal;
1408
- var ContextMenuSub = ContextMenuPrimitive.Sub;
1409
- var ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
1410
- var ContextMenuSubTrigger = React23.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.SubTrigger, {
1411
- ref,
1412
- className: (0, import_classnames17.default)(
1413
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
1414
- inset && "pl-32",
1415
- className
1416
- ),
1417
- ...props
1418
- }, children, /* @__PURE__ */ React23.createElement(import_react_icons.ChevronRightIcon, {
1419
- className: "ml-auto"
1420
- })));
1421
- ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
1422
- var ContextMenuSubContent = React23.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.SubContent, {
1423
- ref,
1424
- className: (0, import_classnames17.default)(
1425
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
1426
- className
1427
- ),
1428
- ...props
1429
- }));
1430
- ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
1431
- var ContextMenuContent = React23.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.Portal, null, /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.Content, {
1432
- ref,
1433
- className: (0, import_classnames17.default)(
1434
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
1435
- className
1436
- ),
1437
- ...props
1438
- })));
1439
- ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
1440
- var ContextMenuItem = React23.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.Item, {
1441
- ref,
1442
- className: (0, import_classnames17.default)(
1443
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
1444
- inset && "pl-32",
1445
- className
1446
- ),
1447
- ...props
1448
- }));
1449
- ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
1450
- var ContextMenuCheckboxItem = React23.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.CheckboxItem, {
1451
- ref,
1452
- className: (0, import_classnames17.default)(
1453
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-32 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
1454
- className
1455
- ),
1456
- checked,
1457
- ...props
1458
- }, /* @__PURE__ */ React23.createElement("span", {
1459
- className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center"
1460
- }, /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React23.createElement(import_react_icons.CheckIcon, {
1461
- className: "h-4 w-4"
1462
- }))), children));
1463
- ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
1464
- var ContextMenuRadioItem = React23.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.RadioItem, {
1465
- ref,
1466
- className: (0, import_classnames17.default)(
1467
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-32 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
1468
- className
1469
- ),
1470
- ...props
1471
- }, /* @__PURE__ */ React23.createElement("span", {
1472
- className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center"
1473
- }, /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React23.createElement(import_react_icons.DotFilledIcon, {
1474
- className: "h-4 w-4 fill-current"
1475
- }))), children));
1476
- ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
1477
- var ContextMenuLabel = React23.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.Label, {
1478
- ref,
1479
- className: (0, import_classnames17.default)(
1480
- "px-2 py-1.5 text-sm font-semibold text-foreground",
1481
- inset && "pl-32",
1482
- className
1483
- ),
1484
- ...props
1485
- }));
1486
- ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
1487
- var ContextMenuSeparator = React23.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React23.createElement(ContextMenuPrimitive.Separator, {
1488
- ref,
1489
- className: (0, import_classnames17.default)("-mx-1 my-1 h-px bg-border", className),
1490
- ...props
1491
- }));
1492
- ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
1493
- var ContextMenuShortcut = ({
1494
- className,
1495
- ...props
1496
- }) => {
1497
- return /* @__PURE__ */ React23.createElement("span", {
1498
- className: (0, import_classnames17.default)(
1499
- "ml-auto text-xs tracking-widest text-muted-foreground",
1500
- className
1501
- ),
1502
- ...props
1503
- });
1504
- };
1505
- ContextMenuShortcut.displayName = "ContextMenuShortcut";
1506
-
1507
- // lib/form/index.tsx
1508
- var React25 = __toESM(require("react"), 1);
1509
- var import_zod = require("zod");
1510
- var import_react_slot = require("@radix-ui/react-slot");
1511
- var import_zod2 = require("@hookform/resolvers/zod");
1512
- var import_react_hook_form = require("react-hook-form");
1513
- var import_classnames19 = __toESM(require("classnames"), 1);
1514
-
1515
- // lib/label/index.tsx
1516
- var React24 = __toESM(require("react"), 1);
1517
- var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
1518
- var import_class_variance_authority = require("class-variance-authority");
1519
- var import_classnames18 = __toESM(require("classnames"), 1);
1520
- "use client";
1521
- var labelVariants = (0, import_class_variance_authority.cva)(
1522
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1523
- );
1524
- var Label2 = React24.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React24.createElement(LabelPrimitive.Root, {
1525
- ref,
1526
- className: (0, import_classnames18.default)(labelVariants(), className),
1527
- ...props
1528
- }));
1529
- Label2.displayName = LabelPrimitive.Root.displayName;
1530
-
1531
- // lib/form/index.tsx
1532
- "use client";
1533
- var Form = import_react_hook_form.FormProvider;
1534
- var FormFieldContext = React25.createContext(
1535
- {}
1536
- );
1537
- var FormField = ({
1538
- ...props
1539
- }) => {
1540
- return /* @__PURE__ */ React25.createElement(FormFieldContext.Provider, {
1541
- value: { name: props.name }
1542
- }, /* @__PURE__ */ React25.createElement(import_react_hook_form.Controller, {
1543
- ...props
1544
- }));
1545
- };
1546
- var useFormField = () => {
1547
- const fieldContext = React25.useContext(FormFieldContext);
1548
- const itemContext = React25.useContext(FormItemContext);
1549
- const { getFieldState, formState } = (0, import_react_hook_form.useFormContext)();
1550
- const fieldState = getFieldState(fieldContext.name, formState);
1551
- if (!fieldContext) {
1552
- throw new Error("useFormField should be used within <FormField>");
1553
- }
1554
- const { id } = itemContext;
1555
- return {
1556
- id,
1557
- name: fieldContext.name,
1558
- formItemId: `${id}-form-item`,
1559
- formDescriptionId: `${id}-form-item-description`,
1560
- formMessageId: `${id}-form-item-message`,
1561
- ...fieldState
1562
- };
1563
- };
1564
- var FormItemContext = React25.createContext(
1565
- {}
1566
- );
1567
- var FormItem = React25.forwardRef(({ className, ...props }, ref) => {
1568
- const id = React25.useId();
1569
- return /* @__PURE__ */ React25.createElement(FormItemContext.Provider, {
1570
- value: { id }
1571
- }, /* @__PURE__ */ React25.createElement("div", {
1572
- ref,
1573
- className: (0, import_classnames19.default)("space-y-2", className),
1574
- ...props
1575
- }));
1576
- });
1577
- FormItem.displayName = "FormItem";
1578
- var FormLabel = React25.forwardRef(({ className, ...props }, ref) => {
1579
- const { error, formItemId } = useFormField();
1580
- return /* @__PURE__ */ React25.createElement(Label2, {
1581
- ref,
1582
- className: (0, import_classnames19.default)(error && "text-destructive", className),
1583
- htmlFor: formItemId,
1584
- ...props
1585
- });
1586
- });
1587
- FormLabel.displayName = "FormLabel";
1588
- var FormControl = React25.forwardRef(({ ...props }, ref) => {
1589
- const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
1590
- return /* @__PURE__ */ React25.createElement(import_react_slot.Slot, {
1591
- ref,
1592
- id: formItemId,
1593
- "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
1594
- "aria-invalid": !!error,
1595
- ...props
1596
- });
1597
- });
1598
- FormControl.displayName = "FormControl";
1599
- var FormDescription = React25.forwardRef(({ className, ...props }, ref) => {
1600
- const { formDescriptionId } = useFormField();
1601
- return /* @__PURE__ */ React25.createElement("p", {
1602
- ref,
1603
- id: formDescriptionId,
1604
- className: (0, import_classnames19.default)("text-sm text-muted-foreground", className),
1605
- ...props
1606
- });
1607
- });
1608
- FormDescription.displayName = "FormDescription";
1609
- var FormMessage = React25.forwardRef(({ className, children, ...props }, ref) => {
1610
- const { error, formMessageId } = useFormField();
1611
- const body = error ? String(error == null ? void 0 : error.message) : children;
1612
- if (!body) {
1613
- return null;
1614
- }
1615
- return /* @__PURE__ */ React25.createElement("p", {
1616
- ref,
1617
- id: formMessageId,
1618
- className: (0, import_classnames19.default)("text-sm font-medium text-destructive", className),
1619
- ...props
1620
- }, body);
1621
- });
1622
- FormMessage.displayName = "FormMessage";
1623
-
1624
- // lib/input/index.tsx
1625
- var React26 = __toESM(require("react"), 1);
1626
- var import_classnames20 = __toESM(require("classnames"), 1);
1627
- var Input = React26.forwardRef(
1628
- ({ className, type, ...props }, ref) => {
1629
- return /* @__PURE__ */ React26.createElement("input", {
1630
- type,
1631
- className: (0, import_classnames20.default)(
1632
- "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1633
- className
1634
- ),
1635
- ref,
1636
- ...props
1637
- });
1638
- }
1639
- );
1640
- Input.displayName = "Input";
1641
-
1642
- // lib/canvas/Canvas.tsx
1643
- var import_react25 = __toESM(require("react"), 1);
1644
-
1645
- // lib/canvas/useRenderer.ts
1646
- var import_react24 = require("react");
1647
- var import_phenomenon2 = __toESM(require("phenomenon"), 1);
1648
- var useRenderer = (uniform) => {
1649
- const canvasRef = (0, import_react24.useRef)(null);
1650
- const [renderer, setRenderer] = (0, import_react24.useState)(null);
1651
- (0, import_react24.useEffect)(() => {
1652
- if (!canvasRef.current) {
1653
- return;
1654
- }
1655
- const renderer2 = new import_phenomenon2.default({
1656
- settings: {
1657
- uniforms: uniform,
1658
- devicePixelRatio: window.devicePixelRatio,
1659
- shouldRender: true,
1660
- canvas: canvasRef.current,
1661
- mode: 4
1662
- },
1663
- context: {
1664
- antialias: true,
1665
- alpha: true
1666
- }
1667
- });
1668
- setRenderer(renderer2);
1669
- return () => {
1670
- renderer2 == null ? void 0 : renderer2.destroy();
1671
- window.removeEventListener("resize", renderer2 == null ? void 0 : renderer2.resize);
1672
- };
1673
- }, [canvasRef.current]);
1674
- return {
1675
- canvasRef,
1676
- renderer
1677
- };
1678
- };
1679
-
1680
- // lib/canvas/Canvas.tsx
1681
- var Canvas = (props) => {
1682
- const {
1683
- fragment,
1684
- vertex,
1685
- uniforms = {},
1686
- name,
1687
- attributes = [],
1688
- onRender,
1689
- ...rest
1690
- } = props;
1691
- const { canvasRef, renderer } = useRenderer(uniforms);
1692
- const instName = name ?? "default";
1693
- (0, import_react25.useEffect)(() => {
1694
- if (renderer == null || canvasRef.current == null) {
1695
- return;
1696
- }
1697
- const aCopy = attributes.map((attr) => ({
1698
- ...attr,
1699
- data: (i, total) => attr.data(i, total)
1700
- }));
1701
- const uCopy = Object.keys(uniforms).reduce((acc, key) => {
1702
- acc[key] = {
1703
- ...uniforms[key],
1704
- value: [...uniforms[key].value]
1705
- };
1706
- return acc;
1707
- }, {});
1708
- const vertices = [
1709
- { x: -100, y: 100, z: 0 },
1710
- { x: -100, y: -100, z: 0 },
1711
- { x: 100, y: 100, z: 0 },
1712
- { x: 100, y: -100, z: 0 },
1713
- { x: -100, y: -100, z: 0 },
1714
- { x: 100, y: 100, z: 0 }
1715
- ];
1716
- renderer.add(instName, {
1717
- uniforms: {
1718
- ...uCopy,
1719
- uProgress: {
1720
- type: "float",
1721
- value: 0
1722
- }
1723
- },
1724
- attributes: aCopy,
1725
- fragment,
1726
- vertex,
1727
- mode: 4,
1728
- geometry: { vertices },
1729
- onRender: (inst) => {
1730
- if (inst.uniforms.uProgress != void 0) {
1731
- inst.uniforms.uProgress.value += 0.09;
1732
- }
1733
- if (onRender) {
1734
- onRender(inst);
1735
- }
1736
- }
1737
- });
1738
- return () => {
1739
- renderer.remove(instName);
1740
- };
1741
- }, [renderer]);
1742
- return /* @__PURE__ */ import_react25.default.createElement("canvas", {
1743
- style: {
1744
- ...props.style,
1745
- imageRendering: "pixelated"
1746
- },
1747
- ref: canvasRef,
1748
- ...rest
1749
- });
1750
- };
1751
- // Annotate the CommonJS export names for ESM import in node:
1752
- 0 && (module.exports = {
1753
- Article,
1754
- ArticleSkeleton,
1755
- BlinkDot,
1756
- BlurCover,
1757
- Breadcrumb,
1758
- Button,
1759
- ButtonType,
1760
- Canvas,
1761
- ContextMenu,
1762
- ContextMenuCheckboxItem,
1763
- ContextMenuContent,
1764
- ContextMenuGroup,
1765
- ContextMenuItem,
1766
- ContextMenuLabel,
1767
- ContextMenuPortal,
1768
- ContextMenuRadioGroup,
1769
- ContextMenuRadioItem,
1770
- ContextMenuSeparator,
1771
- ContextMenuShortcut,
1772
- ContextMenuSub,
1773
- ContextMenuSubContent,
1774
- ContextMenuSubTrigger,
1775
- ContextMenuTrigger,
1776
- DropImage,
1777
- DropZone,
1778
- Error,
1779
- ErrorBoundary,
1780
- Form,
1781
- FormControl,
1782
- FormDescription,
1783
- FormField,
1784
- FormItem,
1785
- FormLabel,
1786
- FormMessage,
1787
- Gallery,
1788
- Img,
1789
- Input,
1790
- Label,
1791
- Link,
1792
- LinkColor,
1793
- LinkList,
1794
- LinkListSkeleton,
1795
- List,
1796
- LoadingSpiral,
1797
- Logo,
1798
- Nav,
1799
- NotFound,
1800
- Page,
1801
- Panel,
1802
- PopConfirm,
1803
- Skeleton,
1804
- SkeletonColor,
1805
- Table,
1806
- Tag,
1807
- Tags,
1808
- ThreeColLayout,
1809
- TitledList,
1810
- ossProcessType,
1811
- useForm,
1812
- useFormField,
1813
- z,
1814
- zodResolver
1815
- });
1816
- //# sourceMappingURL=index.cjs.map