@zjlab-fe/data-hub-ui 0.26.1 → 0.26.3

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 (43) hide show
  1. package/es/components/FileUploader/FileUploadModal.js +2 -1
  2. package/es/components/FileUploader/FileUploaderImpl/FileUploaderFileReceiver.css.js +7 -3
  3. package/es/components/FileUploader/FileUploaderImpl/FileUploaderFileReceiver.js +2 -1
  4. package/es/components/FileUploader/index.css.js +7 -3
  5. package/es/components/FileUploader/index.js +3 -18
  6. package/es/components/FileUploader/utils/modalConfig.css.js +7 -3
  7. package/es/components/confirm-again/index.js +2 -1
  8. package/es/components/confirm-again/index.scss.js +7 -3
  9. package/es/components/feature-card/index.css.js +7 -3
  10. package/es/components/feature-card/index.js +2 -1
  11. package/es/components/file-uploader/components/circle-progress.css.js +7 -3
  12. package/es/components/file-uploader/components/circle-progress.js +2 -2
  13. package/es/components/file-uploader/components/theme.css.js +7 -3
  14. package/es/components/file-uploader/components/uploader-drop-zone.css.js +7 -3
  15. package/es/components/file-uploader/components/uploader-drop-zone.js +4 -2
  16. package/es/components/file-uploader/components/uploader-file-item.css.js +7 -3
  17. package/es/components/file-uploader/components/uploader-file-item.js +4 -2
  18. package/es/components/file-uploader/components/uploader-file-list.css.js +7 -3
  19. package/es/components/file-uploader/components/uploader-file-list.js +4 -2
  20. package/es/components/file-uploader/components/uploader.css.js +7 -3
  21. package/es/components/file-uploader/components/uploader.js +4 -2
  22. package/es/components/file-uploader/components/uploading-status.css.js +7 -3
  23. package/es/components/file-uploader/components/uploading-status.js +2 -1
  24. package/es/components/floating-layer/index.js +2 -1
  25. package/es/components/floating-layer/index.scss.js +7 -3
  26. package/es/components/notion-editor/index.js +6 -3
  27. package/es/components/notion-editor/index.scss.js +7 -3
  28. package/es/components/radio-card/index.js +2 -1
  29. package/es/components/radio-card/index.scss.js +7 -3
  30. package/es/components/section-heading/index.css.js +7 -3
  31. package/es/components/section-heading/index.js +2 -1
  32. package/es/components/tip-tap/index.js +7 -0
  33. package/es/components/tip-tap/styles/editor.css.js +7 -3
  34. package/es/components/uploadDrawer/index.css.js +7 -3
  35. package/es/components/uploadDrawer/index.js +2 -1
  36. package/es/index.js +7 -7
  37. package/package.json +9 -1
  38. package/jest.config.js +0 -10
  39. package/postcss.config.js +0 -7
  40. package/rollup.es.config.mjs +0 -181
  41. package/tailwind.config.js +0 -62
  42. package/tsconfig.rollup.json +0 -7
  43. package/webpack.common.js +0 -54
@@ -1,6 +1,6 @@
1
1
  import { __rest } from 'tslib';
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import './utils/modalConfig.css.js';
3
+ import useStyle from './utils/modalConfig.css.js';
4
4
  import { Modal, Alert, Button } from 'antd';
5
5
  import { useContext } from 'react';
6
6
  import { UploadStoreContext, TEMP_STORE } from './UploadStoreProvider/UploadStoreProvider.js';
@@ -8,6 +8,7 @@ import { useTranslate } from './Locale/useTranslate.js';
8
8
  import { modalConfig } from './utils/modalConfig.js';
9
9
  import FileUploader from './FileUploaderImpl/FileUploader.js';
10
10
 
11
+ useStyle();
11
12
  /**
12
13
  * @deprecated This component is deprecated and will be removed in future releases.
13
14
  */
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.zjlab-fe-data-hub-ui-default-drag-area {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.zjlab-fe-data-hub-ui-default-drag-area {
3
4
 
4
5
  margin-bottom: 1.25rem;
5
6
 
@@ -33,4 +34,7 @@ style.textContent = `.zjlab-fe-data-hub-ui-default-drag-area {
33
34
  border-color: rgb(23 117 254 / var(--tw-border-opacity, 1))
34
35
  }
35
36
  `;
36
- document.head.appendChild(style);
37
+ document.head.appendChild(style);
38
+ }
39
+
40
+ export { useStyle as default };
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from 'tslib';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
- import './FileUploaderFileReceiver.css.js';
3
+ import useStyle from './FileUploaderFileReceiver.css.js';
4
4
  import { App } from 'antd';
5
5
  import { useRef, useMemo } from 'react';
6
6
  import '../utils/checkExpiryTime.js';
@@ -10,6 +10,7 @@ import { retrieveAllFiles as retrieveFilesFromEntry } from '../utils/retrieveAll
10
10
  import { useTranslate } from '../Locale/useTranslate.js';
11
11
  import FileUploaderFileReceiverContainer from './FileUploaderFileReceiverContainer.js';
12
12
 
13
+ useStyle();
13
14
  function FileUploaderFileReceiver({ accept = '', className = '', multiple = true, directory = true, dragAreaDescription, maxSizePerFile = 10 * GB, onFileReceived, }) {
14
15
  const t = useTranslate();
15
16
  const { message } = App.useApp();
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `@layer tailwind-base, antd;
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `@layer tailwind-base, antd;
3
4
  @layer tailwind-base {
4
5
  .zjlab-fe-data-hub-ui-file-uploader *, .zjlab-fe-data-hub-ui-file-uploader ::before, .zjlab-fe-data-hub-ui-file-uploader ::after {
5
6
  --tw-border-spacing-x: 0;
@@ -529,4 +530,7 @@ style.textContent = `@layer tailwind-base, antd;
529
530
  opacity: 1;
530
531
  }
531
532
  `;
532
- document.head.appendChild(style);
533
+ document.head.appendChild(style);
534
+ }
535
+
536
+ export { useStyle as default };
@@ -1,23 +1,8 @@
1
- import './index.css.js';
1
+ import useStyle from './index.css.js';
2
2
  export { default as UploadStoreProvider } from './UploadStoreProvider/UploadStoreProvider.js';
3
3
  import FileUploader from './FileUploader.js';
4
- import 'tslib';
5
- import 'react/jsx-runtime';
6
- import './utils/modalConfig.css.js';
7
- import 'antd';
8
- import 'react';
9
- import './FileUploaderImpl/FileUploaderFileReceiver.css.js';
10
- import './utils/checkExpiryTime.js';
11
- import './types.js';
12
- import './FileUploaderImpl/FileUploaderListItem.js';
13
- import './FileUploaderImpl/FileUploaderListItemUploading.js';
14
- import './FileUploaderImpl/FileUploaderlListItemFinished.js';
15
- import './FileUploaderImpl/FileUploaderListItemFail.js';
16
- import './FileUploaderImpl/FileUploaderListItemPaused.js';
17
- import 'jotai';
18
- import './hooks/useCurrentFile.js';
19
- import './FileUploaderImpl/FileUploaderContextProvider.js';
20
-
4
+ export { default as FileUploadModal } from './FileUploadModal.js';
21
5
 
6
+ useStyle();
22
7
 
23
8
  export { FileUploader as default };
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.zjlab-fe-data-hub-ui-modal .ant-modal-title,
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.zjlab-fe-data-hub-ui-modal .ant-modal-title,
3
4
  .zjlab-fe-data-hub-ui-modal .ant-modal-confirm-title {
4
5
  font-family: AlibabaPuHuiTi-3-65-Medium
5
6
  }
@@ -17,4 +18,7 @@ style.textContent = `.zjlab-fe-data-hub-ui-modal .ant-modal-title,
17
18
  line-height: 1.5rem
18
19
  }
19
20
  `;
20
- document.head.appendChild(style);
21
+ document.head.appendChild(style);
22
+ }
23
+
24
+ export { useStyle as default };
@@ -1,8 +1,9 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Modal } from 'antd';
3
3
  import classNames from 'classnames';
4
- import './index.scss.js';
4
+ import useStyle from './index.scss.js';
5
5
 
6
+ useStyle();
6
7
  function ConfirmAgain(props) {
7
8
  var _a;
8
9
  return (jsx(Modal, Object.assign({}, props, { width: (_a = props.width) !== null && _a !== void 0 ? _a : 400, wrapClassName: classNames('data-hub-ui-confirm-wrap', props.wrapClassName) })));
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `@charset "UTF-8";
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `@charset "UTF-8";
3
4
  @font-face {
4
5
  font-family: "AlibabaPuHuiTi-3-45-Light";
5
6
  src: url("https://haina-datahub.zero2x.org/ossRoute/frontend/resources/fonts/alibaba_puhuiti_3/AlibabaPuHuiTi-3-45-Light.ttf") format("truetype");
@@ -34,4 +35,7 @@ style.textContent = `@charset "UTF-8";
34
35
  text-align: center;
35
36
  margin-top: 28px;
36
37
  }`;
37
- document.head.appendChild(style);
38
+ document.head.appendChild(style);
39
+ }
40
+
41
+ export { useStyle as default };
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `@layer tailwind-base, antd;
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `@layer tailwind-base, antd;
3
4
 
4
5
  @layer tailwind-base {
5
6
  *, ::before, ::after{
@@ -652,4 +653,7 @@ style.textContent = `@layer tailwind-base, antd;
652
653
  opacity: 1;
653
654
  }
654
655
  `;
655
- document.head.appendChild(style);
656
+ document.head.appendChild(style);
657
+ }
658
+
659
+ export { useStyle as default };
@@ -1,12 +1,13 @@
1
1
  import { __rest } from 'tslib';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import React from 'react';
4
- import './index.css.js';
4
+ import useStyle from './index.css.js';
5
5
  import { cn } from '../../lib/utils.js';
6
6
  import { FeatureCardContext } from './context.js';
7
7
  import { getRootSizeClasses, getAlignClass, getTitleSizeClasses, getDescriptionSizeClasses, getIconAlignClass, getIconRoundedClass, getIconSizeClasses } from './classNames.js';
8
8
  import { Content, Description, Title, Body, Icon, Header } from './components.js';
9
9
 
10
+ useStyle();
10
11
  const FeatureCardRoot = React.forwardRef(function FeatureCardRoot(props, ref) {
11
12
  const { icon, cardTitle, description, titleAs = 'h3', align = 'left', size = 'lg', iconVariant = 'default', className, classNames, children } = props, rest = __rest(props, ["icon", "cardTitle", "description", "titleAs", "align", "size", "iconVariant", "className", "classNames", "children"]);
12
13
  const SemanticClassNames = typeof classNames === 'function' ? classNames(props) : classNames;
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.styled-progress-circle {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.styled-progress-circle {
3
4
  display: flex;
4
5
  align-items: center;
5
6
  justify-content: center;
@@ -36,4 +37,7 @@ style.textContent = `.styled-progress-circle {
36
37
 
37
38
 
38
39
  `;
39
- document.head.appendChild(style);
40
+ document.head.appendChild(style);
41
+ }
42
+
43
+ export { useStyle as default };
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import './circle-progress.css.js';
2
+ import useStyle from './circle-progress.css.js';
3
3
 
4
- // Circle Progress Component
4
+ useStyle();
5
5
  function CircleProgress({ percent, isFailed, isSuccess, }) {
6
6
  const radius = 50;
7
7
  const circumference = 2 * Math.PI * radius;
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `:root {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `:root {
3
4
  /* --- CSS Variables for Theming --- */
4
5
 
5
6
  /* Base Colors */
@@ -61,4 +62,7 @@ style.textContent = `:root {
61
62
  --uploader-progress-failed: #ef4444;
62
63
  }
63
64
  `;
64
- document.head.appendChild(style);
65
+ document.head.appendChild(style);
66
+ }
67
+
68
+ export { useStyle as default };
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.upload-drop-zone-container {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.upload-drop-zone-container {
3
4
  position: relative;
4
5
  width: 100%;
5
6
  margin-bottom: 1.5rem;
@@ -63,4 +64,7 @@ style.textContent = `.upload-drop-zone-container {
63
64
 
64
65
 
65
66
  `;
66
- document.head.appendChild(style);
67
+ document.head.appendChild(style);
68
+ }
69
+
70
+ export { useStyle as default };
@@ -3,9 +3,11 @@ import { useRef, useCallback } from 'react';
3
3
  import UploadIcon from './icons.js';
4
4
  import { useDropZone } from './hooks/use-drop-zone.js';
5
5
  import { useFileValidation } from './hooks/use-file-validation.js';
6
- import './theme.css.js';
7
- import './uploader-drop-zone.css.js';
6
+ import useStyle from './theme.css.js';
7
+ import useStyle$1 from './uploader-drop-zone.css.js';
8
8
 
9
+ useStyle();
10
+ useStyle$1();
9
11
  function UploaderDropZone(props) {
10
12
  const { accept = '', maxSize, maxFiles, directory = false, disabled = false, dragAreaDescription = '点击或拖拽上传文件', icon, classNames, onDrop, fileValidation, onError, } = props;
11
13
  const semanticClassNames = typeof classNames === 'function' ? classNames(props) : classNames;
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.upload-file-item {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.upload-file-item {
3
4
  display: flex;
4
5
  align-items: center;
5
6
  justify-content: space-between;
@@ -183,4 +184,7 @@ style.textContent = `.upload-file-item {
183
184
  background: var(--uploader-action-close-hover-bg);
184
185
  }
185
186
  `;
186
- document.head.appendChild(style);
187
+ document.head.appendChild(style);
188
+ }
189
+
190
+ export { useStyle as default };
@@ -3,9 +3,11 @@ import { UploadStatus } from '../constants.js';
3
3
  import { CircleProgress } from './circle-progress.js';
4
4
  import { FileIcon, PauseIcon, ResumeIcon, CloseIcon } from './icons.js';
5
5
  import { UploadingStatus } from './uploading-status.js';
6
- import './theme.css.js';
7
- import './uploader-file-item.css.js';
6
+ import useStyle from './theme.css.js';
7
+ import useStyle$1 from './uploader-file-item.css.js';
8
8
 
9
+ useStyle();
10
+ useStyle$1();
9
11
  function UploaderFileItem(props) {
10
12
  const { file, classNames, onCancel, onRemove, onPause, onResume } = props;
11
13
  const semanticClassNames = typeof classNames === 'function' ? classNames(props) : classNames;
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.upload-file-list-wrapper {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.upload-file-list-wrapper {
3
4
  width: 100%;
4
5
  margin-top: 1.5rem;
5
6
  }
@@ -40,4 +41,7 @@ style.textContent = `.upload-file-list-wrapper {
40
41
 
41
42
 
42
43
  `;
43
- document.head.appendChild(style);
44
+ document.head.appendChild(style);
45
+ }
46
+
47
+ export { useStyle as default };
@@ -1,8 +1,10 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useUpload } from '../hooks/use-upload.js';
3
- import './theme.css.js';
4
- import './uploader-file-list.css.js';
3
+ import useStyle from './theme.css.js';
4
+ import useStyle$1 from './uploader-file-list.css.js';
5
5
 
6
+ useStyle();
7
+ useStyle$1();
6
8
  /**
7
9
  * Simple file list component that displays all uploaded files.
8
10
  * Uses the useUploadFiles hook to access file state.
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `/* Styled File Uploader - shadcn/ui inspired */
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `/* Styled File Uploader - shadcn/ui inspired */
3
4
 
4
5
  .styled-uploader-container {
5
6
  /* --- Component Styles --- */
@@ -17,4 +18,7 @@ style.textContent = `/* Styled File Uploader - shadcn/ui inspired */
17
18
 
18
19
 
19
20
  `;
20
- document.head.appendChild(style);
21
+ document.head.appendChild(style);
22
+ }
23
+
24
+ export { useStyle as default };
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import './theme.css.js';
3
- import './uploader.css.js';
2
+ import useStyle from './theme.css.js';
3
+ import useStyle$1 from './uploader.css.js';
4
4
  import { useEffect, useCallback } from 'react';
5
5
  import { DEFAULT_MAX_FILE_SIZE } from '../constants.js';
6
6
  import { UploaderDropZone } from './uploader-drop-zone.js';
@@ -8,6 +8,8 @@ import { UploaderFileListLayout } from './uploader-file-list.js';
8
8
  import { UploaderFileItem } from './uploader-file-item.js';
9
9
  import { useUpload } from '../hooks/use-upload.js';
10
10
 
11
+ useStyle();
12
+ useStyle$1();
11
13
  /**
12
14
  * Styled File Uploader - Matches FileUploader capabilities with custom styling
13
15
  *
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.uploading-status {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.uploading-status {
3
4
  display: inline-block;
4
5
  position: relative;
5
6
  overflow: hidden;
@@ -49,4 +50,7 @@ style.textContent = `.uploading-status {
49
50
  text-align: left;
50
51
  }
51
52
  `;
52
- document.head.appendChild(style);
53
+ document.head.appendChild(style);
54
+ }
55
+
56
+ export { useStyle as default };
@@ -1,7 +1,8 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { useState, useEffect } from 'react';
3
- import './uploading-status.css.js';
3
+ import useStyle from './uploading-status.css.js';
4
4
 
5
+ useStyle();
5
6
  const UPLOADING_MESSAGES = [
6
7
  '上传中',
7
8
  '传输数据中',
@@ -1,9 +1,10 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { useState, useEffect } from 'react';
3
- import './index.scss.js';
3
+ import useStyle from './index.scss.js';
4
4
  import closeBtn from '../../assets/closeBtn.png.js';
5
5
  import classNames from 'classnames';
6
6
 
7
+ useStyle();
7
8
  function FloatingLayer({ visiable, children, onClose, className, style }) {
8
9
  const [open, setOpen] = useState(false);
9
10
  useEffect(() => {
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.data-hub-ui-floating-layer-wrap {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.data-hub-ui-floating-layer-wrap {
3
4
  min-width: 244px;
4
5
  min-height: 89px;
5
6
  background: #ffffff;
@@ -28,4 +29,7 @@ style.textContent = `.data-hub-ui-floating-layer-wrap {
28
29
  .data-hub-ui-floating-layer-slot {
29
30
  padding: 17px 10px;
30
31
  }`;
31
- document.head.appendChild(style);
32
+ document.head.appendChild(style);
33
+ }
34
+
35
+ export { useStyle as default };
@@ -7,13 +7,16 @@ import { TextSelection } from 'prosemirror-state';
7
7
  import { BlockNoteSchema, defaultStyleSpecs, defaultInlineContentSpecs, defaultBlockSpecs } from '@blocknote/core';
8
8
  import { BlockNoteView } from '@blocknote/mantine';
9
9
  import { zh } from '@blocknote/core/locales';
10
- import '@blocknote/core/fonts/inter.css';
11
- import '@blocknote/mantine/style.css';
12
- import './index.scss.js';
10
+ import __inject_css0 from '@blocknote/core/fonts/inter.css';
11
+ import __inject_css1 from '@blocknote/mantine/style.css';
12
+ import useStyle from './index.scss.js';
13
13
  import { CustomCodeBlock } from './code-block/index.js';
14
14
  import { detectLanguage } from './code-block/languageDetector.js';
15
15
  import { parsePastedMarkdown } from './parseMarkdown.js';
16
16
 
17
+ __inject_css0();
18
+ __inject_css1();
19
+ useStyle();
17
20
  // 自定义文件块,替换默认的文件块
18
21
  const CustomFileBlock = createReactBlockSpec({
19
22
  type: 'file',
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.data-hub-ui-blocknote-editor-wrapper {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.data-hub-ui-blocknote-editor-wrapper {
3
4
  position: relative;
4
5
  display: grid;
5
6
  grid-template-columns: minmax(0, 1fr) var(--blocknote-toc-width, 240px);
@@ -418,4 +419,7 @@ style.textContent = `.data-hub-ui-blocknote-editor-wrapper {
418
419
  text-overflow: ellipsis;
419
420
  white-space: nowrap;
420
421
  }`;
421
- document.head.appendChild(style);
422
+ document.head.appendChild(style);
423
+ }
424
+
425
+ export { useStyle as default };
@@ -1,8 +1,9 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { Radio } from 'antd';
3
- import './index.scss.js';
3
+ import useStyle from './index.scss.js';
4
4
  import classNames from 'classnames';
5
5
 
6
+ useStyle();
6
7
  const RadioCard = ({ options, value, onChange, className, style }) => {
7
8
  const handleChange = (e) => {
8
9
  if (onChange) {
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.data-hub-ui-radio-card-container {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.data-hub-ui-radio-card-container {
3
4
  display: flex;
4
5
  gap: 20px;
5
6
  }
@@ -55,4 +56,7 @@ style.textContent = `.data-hub-ui-radio-card-container {
55
56
  display: flex;
56
57
  flex-wrap: wrap;
57
58
  }`;
58
- document.head.appendChild(style);
59
+ document.head.appendChild(style);
60
+ }
61
+
62
+ export { useStyle as default };
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `@layer tailwind-base, antd;
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `@layer tailwind-base, antd;
3
4
 
4
5
  @layer tailwind-base {
5
6
  *, ::before, ::after{
@@ -645,4 +646,7 @@ style.textContent = `@layer tailwind-base, antd;
645
646
  opacity: 1;
646
647
  }
647
648
  `;
648
- document.head.appendChild(style);
649
+ document.head.appendChild(style);
650
+ }
651
+
652
+ export { useStyle as default };
@@ -1,12 +1,13 @@
1
1
  import { __rest } from 'tslib';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import React from 'react';
4
- import './index.css.js';
4
+ import useStyle from './index.css.js';
5
5
  import { cn } from '../../lib/utils.js';
6
6
  import { SectionHeadingContext } from './context.js';
7
7
  import { getTitleSizeClasses, getAlignClass } from './classNames.js';
8
8
  import { Description, Title, Kicker } from './components.js';
9
9
 
10
+ useStyle();
10
11
  const SectionHeadingRoot = React.forwardRef(function SectionHeadingRoot(props, ref) {
11
12
  const { kicker, mainTitle, description, align = 'center', size = 'lg', titleAs = 'h2', className, classNames, styles, children } = props, rest = __rest(props, ["kicker", "mainTitle", "description", "align", "size", "titleAs", "className", "classNames", "styles", "children"]);
12
13
  const SemanticClassNames = typeof classNames === 'function' ? classNames(props) : classNames;
@@ -0,0 +1,7 @@
1
+ import useStyle from './styles/editor.css.js';
2
+ export { default } from './editor.js';
3
+ import 'react/jsx-runtime';
4
+ import '@tiptap/react';
5
+ import './extensions/index.js';
6
+
7
+ useStyle();
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `/* TipTap Editor - Modern Rich Text Editor */
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `/* TipTap Editor - Modern Rich Text Editor */
3
4
  /* CSS Variables for TipTap Editor Theme */
4
5
  :root {
5
6
  /* Colors - Indigo Theme */
@@ -860,4 +861,7 @@ style.textContent = `/* TipTap Editor - Modern Rich Text Editor */
860
861
  background: #94a3b8;
861
862
  }
862
863
  `;
863
- document.head.appendChild(style);
864
+ document.head.appendChild(style);
865
+ }
866
+
867
+ export { useStyle as default };
@@ -1,5 +1,6 @@
1
- var style = document.createElement('style');
2
- style.textContent = `.mylib-upload-drawer *, .mylib-upload-drawer ::before, .mylib-upload-drawer ::after {
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = `.mylib-upload-drawer *, .mylib-upload-drawer ::before, .mylib-upload-drawer ::after {
3
4
  --tw-border-spacing-x: 0;
4
5
  --tw-border-spacing-y: 0;
5
6
  --tw-translate-x: 0;
@@ -508,4 +509,7 @@ style.textContent = `.mylib-upload-drawer *, .mylib-upload-drawer ::before, .myl
508
509
  .dhu-group:hover .group-hover\\:dhu-opacity-100 {
509
510
  opacity: 1
510
511
  }`;
511
- document.head.appendChild(style);
512
+ document.head.appendChild(style);
513
+ }
514
+
515
+ export { useStyle as default };
@@ -5,9 +5,10 @@ export { default as UploadDrawerUploadStoreProvider } from './UploadStoreProvide
5
5
  import FileUploadDrawer$1 from './fileUploadDrawer.js';
6
6
  import { createContext, useContext } from 'react';
7
7
  import { GB } from './utils/constant.js';
8
- import './index.css.js';
8
+ import useStyle from './index.css.js';
9
9
  import { Drawer, Alert } from 'antd';
10
10
 
11
+ useStyle();
11
12
  const FileUploadDrawerContext = createContext({
12
13
  identifier: '',
13
14
  getUploadUrls: () => __awaiter(void 0, void 0, void 0, function* () { return ({ status: false }); }),
package/es/index.js CHANGED
@@ -1,10 +1,7 @@
1
1
  export { default as Header } from './components/header/index.js';
2
2
  export { default as InputTag } from './components/input-tag/index.js';
3
3
  export { default as FileUploadDrawer } from './components/uploadDrawer/index.js';
4
- import './components/FileUploader/index.css.js';
5
- export { default as UploadStoreProvider } from './components/FileUploader/UploadStoreProvider/UploadStoreProvider.js';
6
- export { default as FileUploaderDeprecated } from './components/FileUploader/FileUploader.js';
7
- export { default as FileUploadModal } from './components/FileUploader/FileUploadModal.js';
4
+ import './components/FileUploader/index.js';
8
5
  export { UploadProvider } from './components/file-uploader/context/upload-provider.js';
9
6
  export { Uploader as FileUploader } from './components/file-uploader/components/uploader.js';
10
7
  export { UploaderDropZone } from './components/file-uploader/components/uploader-drop-zone.js';
@@ -23,9 +20,7 @@ export { default as FloatingLabelInput } from './components/floating-label-input
23
20
  export { default as PopoverSelect } from './components/popover-select/index.js';
24
21
  export { SectionHeading } from './components/section-heading/index.js';
25
22
  export { FeatureCard } from './components/feature-card/index.js';
26
- import './components/tip-tap/styles/editor.css.js';
27
- export { default as Tiptap } from './components/tip-tap/editor.js';
28
- export { default as TipTapReader } from './components/tip-tap/reader.js';
23
+ import './components/tip-tap/index.js';
29
24
  export { default as PermissionEditModal } from './components/permission-editor/permissionEditModal/index.js';
30
25
  export { default as PermissionViewPopover } from './components/permission-editor/permissionViewPopover/index.js';
31
26
  export { default as PermissionEditor } from './components/permission-editor/permissionEditor/index.js';
@@ -38,4 +33,9 @@ export { default as ModelCard } from './components/model-card/index.js';
38
33
  export { default as SDKModal } from './components/SDK-modal/index.js';
39
34
  export { default as TagView } from './components/tag-view/index.js';
40
35
  export { default as TagGroupFilter } from './components/tag-group-filter/index.js';
36
+ export { default as FileUploadModal } from './components/FileUploader/FileUploadModal.js';
37
+ export { default as FileUploaderDeprecated } from './components/FileUploader/FileUploader.js';
38
+ export { default as TipTapReader } from './components/tip-tap/reader.js';
41
39
  export { default as UploadDrawerUploadStoreProvider } from './components/uploadDrawer/UploadStoreProvider.js';
40
+ export { default as UploadStoreProvider } from './components/FileUploader/UploadStoreProvider/UploadStoreProvider.js';
41
+ export { default as Tiptap } from './components/tip-tap/editor.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zjlab-fe/data-hub-ui",
3
- "version": "0.26.1",
3
+ "version": "0.26.3",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -30,6 +30,14 @@
30
30
  },
31
31
  "./package.json": "./package.json"
32
32
  },
33
+ "files": [
34
+ "es",
35
+ "lib",
36
+ "dist",
37
+ "README.md",
38
+ "LICENSE",
39
+ "COMPONENTS_SKILL.md"
40
+ ],
33
41
  "sideEffects": [
34
42
  "**/*.css",
35
43
  "**/*.scss",
package/jest.config.js DELETED
@@ -1,10 +0,0 @@
1
- /** @type {import('ts-jest').JestConfigWithTsJest} **/
2
- module.exports = {
3
- testEnvironment: 'jsdom',
4
- transform: {
5
- '^.+.tsx?$': ['ts-jest', {}],
6
- },
7
- moduleNameMapper: {
8
- '\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
9
- },
10
- };
package/postcss.config.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- 'postcss-nested': {},
6
- },
7
- };
@@ -1,181 +0,0 @@
1
- import resolve from '@rollup/plugin-node-resolve';
2
- import commonjs from '@rollup/plugin-commonjs';
3
- import typescript from '@rollup/plugin-typescript';
4
- import peerDepsExternal from 'rollup-plugin-peer-deps-external';
5
- import alias from '@rollup/plugin-alias';
6
- import path from 'path';
7
- import fs from 'fs';
8
- import { fileURLToPath } from 'url';
9
- import * as sass from 'sass';
10
- import postcss from 'postcss';
11
- import postcssModules from 'postcss-modules';
12
- import tailwindcss from 'tailwindcss';
13
- import autoprefixer from 'autoprefixer';
14
- import postcssImport from 'postcss-import';
15
- import postcssNested from 'postcss-nested';
16
-
17
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
18
- const srcDir = path.resolve(__dirname, 'src');
19
-
20
- // PostCSS 基础插件
21
- const basePostcssPlugins = [postcssImport(), postcssNested(), tailwindcss(), autoprefixer()];
22
-
23
- // 图片插件:将图片全部 base64 内联到 JS 中
24
- // 消费端无需任何额外配置,无路径问题
25
- function imagePlugin() {
26
- return {
27
- name: 'images',
28
- async load(id) {
29
- const ext = path.extname(id).toLowerCase();
30
- if (!['.png', '.jpg', '.jpeg', '.gif', '.svg'].includes(ext)) return null;
31
- if (id.includes('node_modules')) return null;
32
-
33
- const buffer = fs.readFileSync(id);
34
- const mimeMap = {
35
- '.png': 'image/png',
36
- '.jpg': 'image/jpeg',
37
- '.jpeg': 'image/jpeg',
38
- '.gif': 'image/gif',
39
- '.svg': 'image/svg+xml',
40
- };
41
- const dataUrl = `data:${mimeMap[ext] || 'image/png'};base64,${buffer.toString('base64')}`;
42
-
43
- return { code: `export default ${JSON.stringify(dataUrl)};`, map: null };
44
- },
45
- };
46
- }
47
-
48
- // 自定义 SCSS/CSS 处理插件
49
- function stylePlugin() {
50
- return {
51
- name: 'styles',
52
-
53
- async transform(code, id) {
54
- // 处理 src 目录下的样式文件
55
- const isSrc = id.startsWith(srcDir);
56
- // 处理从 node_modules 导入的 CSS(经由 src 文件引用)
57
- const isNodeModuleCss = !isSrc && id.includes('node_modules') && id.endsWith('.css');
58
-
59
- if (!isSrc && !isNodeModuleCss) return null;
60
- if (!id.endsWith('.scss') && !id.endsWith('.css')) return null;
61
-
62
- const isModule = id.endsWith('.module.scss') && isSrc;
63
- const ext = path.extname(id);
64
- const dir = path.dirname(id);
65
-
66
- let processedCode = code;
67
-
68
- // 替换 SCSS @import 中的 @/ 为相对路径(仅 src 文件)
69
- if (isSrc) {
70
- processedCode = code.replace(
71
- /@(import|use)\s+['"]@\/([^'"]+)['"]/g,
72
- (_match, directive, importPath) => {
73
- const absolutePath = path.resolve(srcDir, importPath);
74
- const relativePath = path.relative(dir, absolutePath).replace(/\\/g, '/');
75
- return `@${directive} '${relativePath.startsWith('.') ? relativePath : './' + relativePath}'`;
76
- },
77
- );
78
- }
79
-
80
- // 编译 SCSS → CSS
81
- let css;
82
- try {
83
- if (ext === '.scss') {
84
- const result = sass.compileString(processedCode, {
85
- loadPaths: [dir, srcDir, path.resolve(srcDir, 'styles')],
86
- });
87
- css = result.css;
88
- } else {
89
- css = processedCode;
90
- }
91
- } catch (err) {
92
- this.error(`SCSS compile error: ${err.message}`);
93
- }
94
-
95
- // 对所有 CSS 运行 PostCSS(tailwindcss + postcss-nested + postcss-import)
96
- try {
97
- const tailwindResult = await postcss(basePostcssPlugins).process(css, {
98
- from: id,
99
- to: id.replace(/\.(scss|css)$/, '.css'),
100
- });
101
- css = tailwindResult.css;
102
- } catch (err) {
103
- this.error(`PostCSS error: ${err.message}`);
104
- }
105
-
106
- // 对 .module.scss 文件,用 postcss-modules 提取类名映射
107
- let classMap = {};
108
-
109
- if (isModule) {
110
- const modulesPlugin = postcssModules({
111
- generateScopedName: '[name]__[local]___[hash:base64:5]',
112
- getJSON(cssFileName, json) {
113
- classMap = json;
114
- },
115
- });
116
-
117
- const result = await postcss([modulesPlugin]).process(css, { from: id });
118
- css = result.css;
119
- }
120
-
121
- // 生成 JS 模块代码
122
- const escapedCss = css.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$/g, '\\$');
123
-
124
- let jsCode;
125
- if (isModule) {
126
- const namedExports = Object.entries(classMap)
127
- .map(([key, value]) => {
128
- const jsKey = key.replace(/[^a-zA-Z0-9_$]/g, '_');
129
- return `var ${jsKey} = ${JSON.stringify(value)}; export { ${jsKey} as ${JSON.stringify(key)} };`;
130
- })
131
- .join('\n');
132
-
133
- const mapJson = JSON.stringify(classMap);
134
-
135
- jsCode = `
136
- var style = document.createElement('style');
137
- style.textContent = \`${escapedCss}\`;
138
- document.head.appendChild(style);
139
-
140
- ${namedExports}
141
-
142
- var styles = ${mapJson};
143
- export default styles;
144
- `;
145
- } else {
146
- // 普通样式或 node_modules CSS:只注入 CSS,没有 export
147
- jsCode = `
148
- var style = document.createElement('style');
149
- style.textContent = \`${escapedCss}\`;
150
- document.head.appendChild(style);
151
- `;
152
- }
153
-
154
- return {
155
- code: jsCode,
156
- map: null,
157
- moduleSideEffects: 'no-treeshake',
158
- };
159
- },
160
- };
161
- }
162
-
163
- export default {
164
- input: ['src/index.tsx', 'src/components/notion-editor/index.tsx'],
165
- output: {
166
- dir: 'es',
167
- format: 'esm',
168
- preserveModules: true,
169
- preserveModulesRoot: 'src',
170
- entryFileNames: '[name].js',
171
- },
172
- plugins: [
173
- peerDepsExternal({ includeDependencies: true }),
174
- alias({ entries: [{ find: '@', replacement: srcDir }] }),
175
- imagePlugin(),
176
- resolve({ extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.scss'] }),
177
- commonjs(),
178
- stylePlugin(),
179
- typescript({ tsconfig: './tsconfig.rollup.json' }),
180
- ],
181
- };
@@ -1,62 +0,0 @@
1
- import { fontFamily as _fontFamily } from 'tailwindcss/defaultTheme';
2
-
3
- export const prefix = 'dhu-'; // data-hub-ui 缩写
4
-
5
- /** @type {import('tailwindcss').Config} */
6
- export const content = [
7
- './src/components/uploadDrawer/**/*.{js,jsx,ts,tsx}',
8
- './src/components/FileUploader/**/*.{js,jsx,ts,tsx}',
9
- './src/components/feature-card/**/*.{js,jsx,ts,tsx}',
10
- './src/components/section-heading/**/*.{js,jsx,ts,tsx}',
11
- ];
12
-
13
- export const corePlugins = {
14
- preflight: false,
15
- };
16
-
17
- export const theme = {
18
- extend: {
19
- fontFamily: {
20
- sans: ['AlibabaPuHuiTi-3-55-RegularL3', _fontFamily.sans],
21
- 'ali-55': 'AlibabaPuHuiTi-3-55-Regular',
22
- 'ali-65': 'AlibabaPuHuiTi-3-65-Medium',
23
- 'ali-75': 'AlibabaPuHuiTi-3-75-SemiBold',
24
- 'ali-85': 'AlibabaPuHuiTi-3-85-Bold',
25
- },
26
- colors: {
27
- 'blue-1': '#E8F1FF',
28
- 'blue-2': '#B9D6FF',
29
- 'blue-4': '#4591FE',
30
- 'blue-5': '#1775FE',
31
- 'red-red': '#FE4D4F',
32
- 'yellow-yellow': '#FAAD14',
33
- 'green-green': '#53C31B',
34
- 'assist-blue': '#1990FF',
35
- 'assist-bg-blue': '#F4F6FA',
36
- 'gray-2': '#EDF2FC',
37
- 'gray-3': '#D9E0ED',
38
- 'gray-5': '#87909E',
39
- 'gray-7': '#545B64',
40
- 'gray-9': '#30353A',
41
- 'gray-10': '#222427',
42
- },
43
- borderRadius: {
44
- ml: '10px',
45
- },
46
- height: {
47
- 162: '648px',
48
- },
49
- minHeight: {
50
- 162: '648px',
51
- },
52
- spacing: {
53
- 18: '72px',
54
- 29: '116px',
55
- 384: '1536px',
56
- },
57
- boxShadow: {
58
- float: '0px 12px 30px 0px rgba(32,60,48,0.2);',
59
- },
60
- },
61
- };
62
- export const plugins = [require('@tailwindcss/typography')];
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "declaration": false,
5
- "declarationDir": null
6
- }
7
- }
package/webpack.common.js DELETED
@@ -1,54 +0,0 @@
1
- module.exports = {
2
- module: {
3
- rules: [
4
- {
5
- test: /\.md$/,
6
- use: ['raw-loader'],
7
- },
8
- {
9
- test: /\.(svg|png|jpe?g)$/,
10
- use: [
11
- {
12
- loader: 'url-loader',
13
- options: {
14
- // 图片大小小于20kb,就会base64处理
15
- // limit: 300 * 1024,
16
- // url-loader默认使用es6模块化解析,html-loader引入图片使用的是commonjs规范
17
- // 关闭url-loader的es6模块化,使用commonjs解析
18
- // esModule: false,
19
- // outputPath: 'assets'
20
- // 图片编译之后重命名
21
- // [hash:10]获取图片hash前10位 [ext]取文件的原扩展名
22
- name: '[hash:10].[ext]',
23
- },
24
- },
25
- ],
26
-
27
- // type: 'asset/resource',
28
- // generator: {
29
- // filename: 'static/[contenthash].[ext]',
30
- // },
31
- },
32
- {
33
- test: /\.s?css$/,
34
- use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'],
35
- },
36
- {
37
- test: /\.(js|jsx|ts|tsx)$/,
38
- exclude: /node_modules/,
39
- use: [
40
- // {
41
- // loader: 'babel-loader',
42
- // options: {
43
- // // 开启 babel 缓存
44
- // cacheDirectory: true,
45
- // // 关闭缓存压缩
46
- // cacheCompression: false,
47
- // },
48
- // },
49
- { loader: 'ts-loader' },
50
- ],
51
- },
52
- ],
53
- },
54
- };