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