@smartos-lib/components 2.0.2 → 2.0.4

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 (47) hide show
  1. package/.eslintrc-auto-import.json +1 -0
  2. package/dist/smart-docx-editor/index.js +21 -21
  3. package/dist/smart-file-preview/index.js +7 -7
  4. package/dist/smart-upload/index.js +1 -1
  5. package/package.json +4 -5
  6. package/scripts/components.vite.config.ts +1 -1
  7. package/src/composables/useElementStyle.ts +1 -3
  8. package/src/composables/useSmart.ts +1 -3
  9. package/src/pages/frame/index.vue +1 -1
  10. package/src/pages/index/type.ts +4 -4
  11. package/src/pages/index/utils/index.ts +2 -2
  12. package/src/shared/components.ts +5 -5
  13. package/src/shared/env.ts +1 -1
  14. package/src/shared/unocss.theme.ts +1 -1
  15. package/src/types.ts +3 -3
  16. package/src/utils/deepCloneESModule.ts +1 -1
  17. package/src/utils/formatComponentsGlob.ts +1 -1
  18. package/src/web-components/smart-docx-drive-page/apis/doc.ts +5 -5
  19. package/src/web-components/smart-docx-drive-page/apis/file.ts +24 -24
  20. package/src/web-components/smart-docx-drive-page/apis/folder.ts +7 -7
  21. package/src/web-components/smart-docx-drive-page/components/DocxDir.vue +7 -7
  22. package/src/web-components/smart-docx-drive-page/components/DocxDoc.vue +2 -2
  23. package/src/web-components/smart-docx-drive-page/components/DocxFileList.vue +11 -1
  24. package/src/web-components/smart-docx-drive-page/components-private/Header.vue +5 -5
  25. package/src/web-components/smart-docx-drive-page/components-private/Menu.vue +4 -3
  26. package/src/web-components/smart-docx-drive-page/types.ts +16 -16
  27. package/src/web-components/smart-docx-drive-page/utils/file-actions.ts +1 -2
  28. package/src/web-components/smart-docx-editor/App.vue +1 -1
  29. package/src/web-components/smart-docx-editor/MarkdownShortcuts/components/Markdown.vue +4 -4
  30. package/src/web-components/smart-docx-editor/MarkdownShortcuts/components/types.ts +1 -1
  31. package/src/web-components/smart-docx-editor/MarkdownShortcuts/components-react/Markdown.tsx +6 -5
  32. package/src/web-components/smart-docx-editor/MarkdownShortcuts/components-react/types/custom-types.d.ts +42 -42
  33. package/src/web-components/smart-docx-editor/MarkdownShortcuts/shared/const.ts +1 -1
  34. package/src/web-components/smart-docx-editor/demo.vue +1 -1
  35. package/src/web-components/smart-docx-editor/index.md +1 -1
  36. package/src/web-components/smart-file-preview/category/Code.vue +2 -2
  37. package/src/web-components/smart-file-preview/index.md +1 -1
  38. package/src/web-components/smart-file-preview/index.ts +1 -1
  39. package/src/web-components/smart-file-preview/index.vue +1 -1
  40. package/src/web-components/smart-file-preview/types.ts +1 -1
  41. package/src/web-components/smart-upload/index.ts +4 -4
  42. package/src/web-components/smart-upload/types.ts +27 -27
  43. package/types/auto-imports.d.ts +3 -0
  44. package/types/components.d.ts +1 -1
  45. package/types/env.d.ts +2 -2
  46. package/types/shims.d.ts +1 -0
  47. package/vite.config.ts +1 -0
@@ -2,7 +2,7 @@
2
2
  <div flex="~ col gap-1">
3
3
  <!-- 主页 -->
4
4
  <DocxDir
5
- :class="{ active: activeMenu === 'home' }" :showOpen="false" name="主页" hiddenActions
5
+ :class="{ active: activeMenu === 'home' }" :show-open="false" name="主页" hidden-actions
6
6
  @click="activeMenu = 'home'"
7
7
  >
8
8
  <template #icon>
@@ -12,7 +12,7 @@
12
12
  <!-- 我的空间 -->
13
13
  <DocxDir
14
14
  :class="{ active: activeMenu === 'me' && (dirTree.isLoading || meActiveMenu === dirTree.data?.data.id) }"
15
- :info="dirTree.data?.data" name="我的空间" hiddenActions
15
+ :info="dirTree.data?.data" name="我的空间" hidden-actions
16
16
  @click="activeMenu = 'me'"
17
17
  >
18
18
  <template #icon="{ isActive }">
@@ -28,7 +28,8 @@
28
28
  import DocxDir from '../components/DocxDir.vue';
29
29
 
30
30
  const {
31
- activeMenu, meActiveMenu,
31
+ activeMenu,
32
+ meActiveMenu,
32
33
  dirTree,
33
34
  } = menuStore();
34
35
  </script>
@@ -5,13 +5,13 @@ export interface SmartDocxDrivePageProps {
5
5
  /**
6
6
  * Logo 图标地址
7
7
  * @default <i-system-uicons-document-stack />
8
- **/
9
- icon?: string
8
+ */
9
+ icon?: string;
10
10
  /**
11
11
  * 标题
12
12
  * @default 'SmartOS 云文档'
13
- */
14
- title?: string
13
+ */
14
+ title?: string;
15
15
 
16
16
  /**
17
17
  * 当前激活的菜单项
@@ -19,33 +19,33 @@ export interface SmartDocxDrivePageProps {
19
19
  * - me: 我的空间
20
20
  * @default 'home'
21
21
  */
22
- activeMenu?: 'home' | 'me'
22
+ activeMenu?: 'home' | 'me';
23
23
  }
24
24
 
25
25
  /** 上传文件信息 */
26
26
  export interface FileItem {
27
- id: string
27
+ id: string;
28
28
 
29
- ref?: Element | ComponentPublicInstance | HTMLDivElement | null
29
+ ref?: Element | ComponentPublicInstance | HTMLDivElement | null;
30
30
 
31
31
  /** 文件 */
32
- file: File
32
+ file: File;
33
33
  /** 文件名 */
34
- fileName: string
34
+ fileName: string;
35
35
  /** 文件名后缀 */
36
- fileExt: string
36
+ fileExt: string;
37
37
 
38
38
  /** 读取文件中 */
39
- isReading?: boolean
39
+ isReading?: boolean;
40
40
 
41
41
  /** 上传进度 */
42
- progress?: number
42
+ progress?: number;
43
43
  /** 上传中 */
44
- isUploading?: boolean
44
+ isUploading?: boolean;
45
45
  /** 上传成功 */
46
- isUploadSuccess?: boolean
46
+ isUploadSuccess?: boolean;
47
47
  /** 上传失败 */
48
- isUploadError?: boolean
48
+ isUploadError?: boolean;
49
49
  /** 是否是极速上传 */
50
- isQuickUpload?: boolean
50
+ isQuickUpload?: boolean;
51
51
  }
@@ -2,9 +2,8 @@ import { deleteFile, renameFile } from '../apis/file';
2
2
  import type { FileInfo } from '../apis/file';
3
3
  import { type DirInfo, getFolderList } from '../apis/folder';
4
4
  import { useConfirm, usePrompt } from '../composables/usePrompt';
5
- import { menuStore } from '../stores/menu';
6
5
 
7
- const { flatDirTree } = menuStore();
6
+ // const { flatDirTree } = menuStore();
8
7
 
9
8
  /** 重命名文件 */
10
9
  export function toRenameFile(file: FileInfo) {
@@ -17,7 +17,7 @@
17
17
  defineProps<Pick<MarkdownProps, 'initialValue'>>();
18
18
 
19
19
  const emit = defineEmits<{
20
- change: [value: Descendant[]]
20
+ change: [value: Descendant[]];
21
21
  }>();
22
22
 
23
23
  useSmart();
@@ -3,7 +3,7 @@
3
3
  <template>
4
4
  <MarkdownShortcuts
5
5
  v-bind="props"
6
- :withOverride="withOverride"
6
+ :with-override="withOverride"
7
7
  />
8
8
  </template>
9
9
 
@@ -29,9 +29,9 @@
29
29
  };
30
30
  }
31
31
  /** 匹配当前焦点所在的节点 */
32
- const matchElement = {
33
- match: (n: Node) => Element.isElement(n),
34
- };
32
+ // const matchElement = {
33
+ // match: (n: Node) => Element.isElement(n),
34
+ // };
35
35
 
36
36
  /** 编辑器功能重写 */
37
37
  const withOverride: MarkdownShortcutsProps['withOverride'] = (editor) => {
@@ -2,5 +2,5 @@ import type { MarkdownShortcutsProps } from '../components-react/Markdown';
2
2
 
3
3
  export interface MarkdownProps {
4
4
  /** 初始值 */
5
- initialValue?: MarkdownShortcutsProps['initialValue']
5
+ initialValue?: MarkdownShortcutsProps['initialValue'];
6
6
  }
@@ -9,17 +9,18 @@ import { RenderElement, RenderLeaf } from './MarkdownElement';
9
9
 
10
10
  export interface MarkdownShortcutsProps {
11
11
  /** 初始值 */
12
- initialValue?: Descendant[]
12
+ initialValue?: Descendant[];
13
13
  /** 编辑器功能重写 */
14
- withOverride?: (editor: Editor) => Editor
14
+ withOverride?: (editor: Editor) => Editor;
15
15
  /** 用户输入前的事件回调 */
16
- onBeforeInput?: (event: InputEvent) => void
16
+ onBeforeInput?: (event: InputEvent) => void;
17
17
  }
18
18
 
19
19
  export default function MarkdownShortcuts(props: MarkdownShortcutsProps) {
20
20
  const {
21
21
  initialValue = [{
22
- type: 'paragraph', children: [{ text: '' }],
22
+ type: 'paragraph',
23
+ children: [{ text: '' }],
23
24
  }],
24
25
  onBeforeInput,
25
26
  withOverride = (editor: Editor) => editor,
@@ -61,7 +62,7 @@ export default function MarkdownShortcuts(props: MarkdownShortcutsProps) {
61
62
  onValueChange={onValueChange}
62
63
  >
63
64
  <Editable
64
- className='smart-docx-editor'
65
+ className="smart-docx-editor"
65
66
  renderElement={renderElement}
66
67
  renderLeaf={renderLeaf}
67
68
  onDOMBeforeInput={handleDOMBeforeInput}
@@ -1,39 +1,39 @@
1
- import { BaseEditor, BaseRange, Descendant } from "slate"
2
- import { ReactEditor } from "slate-react"
3
- import { HistoryEditor } from 'slate-history'
1
+ import type { BaseEditor, BaseRange, Descendant } from 'slate';
2
+ import type { ReactEditor } from 'slate-react';
3
+ import type { HistoryEditor } from 'slate-history';
4
4
 
5
5
  /** 段落节点 */
6
- export type ParagraphElement = {
7
- type: 'paragraph'
8
- align?: string
9
- children: Descendant[]
10
- }
6
+ export interface ParagraphElement {
7
+ type: 'paragraph';
8
+ align?: string;
9
+ children: Descendant[];
10
+ };
11
11
 
12
12
  /** 标题节点 - H1 ~ H6 */
13
- export type HeadingElement = {
14
- type: 'heading'
15
- level: string
16
- children: Descendant[]
17
- }
13
+ export interface HeadingElement {
14
+ type: 'heading';
15
+ level: string;
16
+ children: Descendant[];
17
+ };
18
18
 
19
19
  /** 引用节点 */
20
- export type BlockquoteElement = {
21
- type: 'blockquote'
22
- children: Descendant[]
23
- }
20
+ export interface BlockquoteElement {
21
+ type: 'blockquote';
22
+ children: Descendant[];
23
+ };
24
24
 
25
25
  /** 列表节点 */
26
- export type ListElement = {
27
- type: 'list'
26
+ export interface ListElement {
27
+ type: 'list';
28
28
  /** 是否为有序列表 */
29
- ordered?: boolean
30
- children: Descendant[]
31
- }
29
+ ordered?: boolean;
30
+ children: Descendant[];
31
+ };
32
32
  /** 列表项节点 */
33
- export type ListItemElement = {
34
- type: 'list-item'
35
- children: Descendant[]
36
- }
33
+ export interface ListItemElement {
34
+ type: 'list-item';
35
+ children: Descendant[];
36
+ };
37
37
 
38
38
  /** 所有自定义节点 */
39
39
  type CustomElement = ParagraphElement |
@@ -43,27 +43,27 @@ type CustomElement = ParagraphElement |
43
43
  ListItemElement;
44
44
 
45
45
  /** 文本节点 */
46
- type CustomText = {
47
- bold?: boolean
48
- italic?: boolean
49
- del?: boolean
50
- underline?: boolean
51
- code?: boolean
52
- text: string
53
- }
46
+ interface CustomText {
47
+ bold?: boolean;
48
+ italic?: boolean;
49
+ del?: boolean;
50
+ underline?: boolean;
51
+ code?: boolean;
52
+ text: string;
53
+ };
54
54
 
55
55
  /** 扩展的编辑器类型 */
56
56
  type CustomEditor = BaseEditor & ReactEditor & HistoryEditor & {
57
- nodeToDecorations?: Map<Element, Range[]>
58
- }
57
+ nodeToDecorations?: Map<Element, Range[]>;
58
+ };
59
59
 
60
60
  declare module 'slate' {
61
61
  interface CustomTypes {
62
- Editor: CustomEditor
63
- Element: CustomElement
64
- Text: CustomText
62
+ Editor: CustomEditor;
63
+ Element: CustomElement;
64
+ Text: CustomText;
65
65
  Range: BaseRange & {
66
- [key: string]: unknown
67
- }
66
+ [key: string]: unknown;
67
+ };
68
68
  }
69
- }
69
+ }
@@ -9,7 +9,7 @@ export const editor = ref() as Ref<Editor>;
9
9
  * 编辑器 ShadowRoot
10
10
  */
11
11
  export const shadowRoot = ref() as Ref<ShadowRoot & {
12
- getSelection: Window['getSelection']
12
+ getSelection: Window['getSelection'];
13
13
  }>;
14
14
 
15
15
  /**
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <smart-docx-editor
3
- :initialValue.prop="所有支持的节点.initialValue"
3
+ :initial-value.prop="所有支持的节点.initialValue"
4
4
  />
5
5
  </template>
6
6
 
@@ -1,3 +1,3 @@
1
1
  ::: warning
2
2
  开发中
3
- :::
3
+ :::
@@ -60,12 +60,12 @@
60
60
  await until(() => fastestCDN.isSuccess).toBeTruthy();
61
61
 
62
62
  loader.config({
63
- "vs/nls": {
63
+ 'vs/nls': {
64
64
  availableLanguages: {
65
65
  '*': 'zh-cn',
66
66
  },
67
67
  },
68
- "paths": {
68
+ 'paths': {
69
69
  vs: `${fastestCDN.response}/min/vs`,
70
70
  },
71
71
  });
@@ -2,4 +2,4 @@
2
2
 
3
3
  ::: warning
4
4
  开发中
5
- :::
5
+ :::
@@ -25,5 +25,5 @@ export type SmartFilePreviewElement = typeof VueCustomElement & {
25
25
  * @param fileName 文件名
26
26
  * @param file 文件 Blob 对象
27
27
  */
28
- previewFile: PreviewFile
28
+ previewFile: PreviewFile;
29
29
  };
@@ -5,7 +5,7 @@
5
5
  <component
6
6
  v-if="file"
7
7
  :is="components[fileCategory] || Code"
8
- :file="file" :fileName="fileName" :fileExt="fileExt"
8
+ :file="file" :file-name="fileName" :file-ext="fileExt"
9
9
  v-bind="attrs"
10
10
  />
11
11
  </div>
@@ -4,7 +4,7 @@ export interface SmartFilePreviewProps {
4
4
 
5
5
  /** 预览文件方法 */
6
6
  export interface PreviewFile {
7
- (fileName: string, file: Blob): void
7
+ (fileName: string, file: Blob): void;
8
8
  }
9
9
 
10
10
  /** 文件后缀对应的分类 */
@@ -31,8 +31,8 @@ defineCustomElements(tag, VueCustomElement);
31
31
 
32
32
  // 暴露组件类型
33
33
  export type SmartUploadElement = typeof VueCustomElement & {
34
- getUploadRef: () => UploadRef
35
- getFileList: () => UploadFileInfo[]
36
- submit: UploadRef['submit']
37
- clear: UploadRef['clear']
34
+ getUploadRef: () => UploadRef;
35
+ getFileList: () => UploadFileInfo[];
36
+ submit: UploadRef['submit'];
37
+ clear: UploadRef['clear'];
38
38
  };
@@ -3,34 +3,34 @@ import type { UploadProps } from 'naive-ui';
3
3
 
4
4
  export interface Props {
5
5
  /** 发起请求前的钩子, 用于修改请求配置 */
6
- beforeUpload?: <T extends AxiosRequestConfig>(config: T) => T
6
+ beforeUpload?: <T extends AxiosRequestConfig>(config: T) => T;
7
7
 
8
8
  /* ------------------ 以下为 NaiveUI 上传组件原有 Props ------------------ */
9
9
 
10
- accept?: UploadProps['accept']
11
- defaultFileList?: UploadProps['defaultFileList']
12
- defaultUpload?: UploadProps['defaultUpload']
13
- disabled?: UploadProps['disabled']
14
- directory?: UploadProps['directory']
15
- directoryDnd: UploadProps['directoryDnd']
16
- fileListClass?: UploadProps['fileListClass']
17
- fileListStyle?: UploadProps['fileListStyle']
18
- imageGroupProps?: UploadProps['imageGroupProps']
19
- inputProps?: UploadProps['inputProps']
20
- listType?: UploadProps['listType']
21
- max?: UploadProps['max']
22
- multiple?: UploadProps['multiple']
23
- renderIcon?: UploadProps['renderIcon']
24
- shouldUseThumbnailUrl?: UploadProps['shouldUseThumbnailUrl']
25
- showCancelButton?: UploadProps['showCancelButton']
26
- showDownloadButton?: UploadProps['showDownloadButton']
27
- showRemoveButton?: UploadProps['showRemoveButton']
28
- showRetryButton?: UploadProps['showRetryButton']
29
- showFileList?: UploadProps['showFileList']
30
- showPreviewButton?: UploadProps['showPreviewButton']
31
- showTrigger?: UploadProps['showTrigger']
32
- triggerClass?: UploadProps['triggerClass']
33
- triggerStyle?: UploadProps['triggerStyle']
34
- onError?: UploadProps['onError']
35
- onFinish?: UploadProps['onFinish']
10
+ accept?: UploadProps['accept'];
11
+ defaultFileList?: UploadProps['defaultFileList'];
12
+ defaultUpload?: UploadProps['defaultUpload'];
13
+ disabled?: UploadProps['disabled'];
14
+ directory?: UploadProps['directory'];
15
+ directoryDnd: UploadProps['directoryDnd'];
16
+ fileListClass?: UploadProps['fileListClass'];
17
+ fileListStyle?: UploadProps['fileListStyle'];
18
+ imageGroupProps?: UploadProps['imageGroupProps'];
19
+ inputProps?: UploadProps['inputProps'];
20
+ listType?: UploadProps['listType'];
21
+ max?: UploadProps['max'];
22
+ multiple?: UploadProps['multiple'];
23
+ renderIcon?: UploadProps['renderIcon'];
24
+ shouldUseThumbnailUrl?: UploadProps['shouldUseThumbnailUrl'];
25
+ showCancelButton?: UploadProps['showCancelButton'];
26
+ showDownloadButton?: UploadProps['showDownloadButton'];
27
+ showRemoveButton?: UploadProps['showRemoveButton'];
28
+ showRetryButton?: UploadProps['showRetryButton'];
29
+ showFileList?: UploadProps['showFileList'];
30
+ showPreviewButton?: UploadProps['showPreviewButton'];
31
+ showTrigger?: UploadProps['showTrigger'];
32
+ triggerClass?: UploadProps['triggerClass'];
33
+ triggerStyle?: UploadProps['triggerStyle'];
34
+ onError?: UploadProps['onError'];
35
+ onFinish?: UploadProps['onFinish'];
36
36
  };
@@ -180,6 +180,7 @@ declare global {
180
180
  const useFavicon: typeof import('@vueuse/core')['useFavicon']
181
181
  const useFetch: typeof import('@vueuse/core')['useFetch']
182
182
  const useFileDialog: typeof import('@vueuse/core')['useFileDialog']
183
+ const useFileReader: typeof import('@mixte/use')['useFileReader']
183
184
  const useFileSystemAccess: typeof import('@vueuse/core')['useFileSystemAccess']
184
185
  const useFloor: typeof import('@vueuse/math')['useFloor']
185
186
  const useFocus: typeof import('@vueuse/core')['useFocus']
@@ -507,6 +508,7 @@ declare module 'vue' {
507
508
  readonly useFavicon: UnwrapRef<typeof import('@vueuse/core')['useFavicon']>
508
509
  readonly useFetch: UnwrapRef<typeof import('@vueuse/core')['useFetch']>
509
510
  readonly useFileDialog: UnwrapRef<typeof import('@vueuse/core')['useFileDialog']>
511
+ readonly useFileReader: UnwrapRef<typeof import('@mixte/use')['useFileReader']>
510
512
  readonly useFileSystemAccess: UnwrapRef<typeof import('@vueuse/core')['useFileSystemAccess']>
511
513
  readonly useFloor: UnwrapRef<typeof import('@vueuse/math')['useFloor']>
512
514
  readonly useFocus: UnwrapRef<typeof import('@vueuse/core')['useFocus']>
@@ -827,6 +829,7 @@ declare module '@vue/runtime-core' {
827
829
  readonly useFavicon: UnwrapRef<typeof import('@vueuse/core')['useFavicon']>
828
830
  readonly useFetch: UnwrapRef<typeof import('@vueuse/core')['useFetch']>
829
831
  readonly useFileDialog: UnwrapRef<typeof import('@vueuse/core')['useFileDialog']>
832
+ readonly useFileReader: UnwrapRef<typeof import('@mixte/use')['useFileReader']>
830
833
  readonly useFileSystemAccess: UnwrapRef<typeof import('@vueuse/core')['useFileSystemAccess']>
831
834
  readonly useFloor: UnwrapRef<typeof import('@vueuse/math')['useFloor']>
832
835
  readonly useFocus: UnwrapRef<typeof import('@vueuse/core')['useFocus']>
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable */
2
- /* prettier-ignore */
3
2
  // @ts-nocheck
4
3
  // Generated by unplugin-vue-components
5
4
  // Read more: https://github.com/vuejs/core/pull/3399
6
5
  export {}
7
6
 
7
+ /* prettier-ignore */
8
8
  declare module 'vue' {
9
9
  export interface GlobalComponents {
10
10
  Logo: typeof import('./../src/components/Logo/index.vue')['default']
package/types/env.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  interface ImportMetaEnv {
2
2
  /** 主机名 ( 目前用于配置站点地图, 上线前需要更改成正式环境的域名 ) */
3
- readonly APP_HOSTNAME: string
3
+ readonly APP_HOSTNAME: string;
4
4
  }
5
5
 
6
6
  interface ImportMeta {
7
- readonly env: ImportMetaEnv
7
+ readonly env: ImportMetaEnv;
8
8
  }
package/types/shims.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  declare module '*.vue' {
2
2
  import type { DefineComponent } from 'vue';
3
3
 
4
+ // eslint-disable-next-line ts/ban-types
4
5
  const component: DefineComponent<{}, {}, any>;
5
6
  export default component;
6
7
  }
package/vite.config.ts CHANGED
@@ -14,6 +14,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
14
14
 
15
15
  export default defineConfig(({ mode }) => {
16
16
  /** 是否是开发模式 */
17
+ // eslint-disable-next-line unused-imports/no-unused-vars
17
18
  const isDev = mode === 'development';
18
19
 
19
20
  return deepMerge(