diff --git a/node/assets/navigation.js b/node/assets/navigation.js index 3ef918e..ed71dd4 100644 --- a/node/assets/navigation.js +++ b/node/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA5XUXU/CMBQG4P/SayJK/IjcCiRcoIsYbowXh/awNayntT1LWIz/3UyDbNIVvH7fPGc77fb6IRh3LMZigugy8KyhFAPhgAsxFlw7DMNWdFGwafKtJiXGo8v7u6ub0eegozzje6U9qhizz0450hoHHlfog7Z0kDYVSdaWwrDb6Hq31x3K1TNbKvRxZp+eRSxrkmmmaaQoj8A40yVGmd/0LKL3aTqN01T/dlp5gkGSVmFWWMLHyqzj1lEpAW6sN8AT4OiWDmmCyJGbBWTARZhT/yvGev9k+46hr5vgdXiwxgCp6U4HDjH1TyWJNeOf/M/klHjcS7DOW6MDvkDYxrRWnEA8uhIkrsBrWJcY5rRkrymPiX3dJP/9n1lYVcW/tE4hAQUJNEGHpJBkvQCCPH6PosUj+O0L1+qZu3EFAAA=" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA5XUTU8CMRAG4P/SMxElfkSuIAkHdCOGi/EwtAPbsJ3WdjZhY/zvZjXIrnTLen7fPJ1Mu/v6IRj3LMZiiugy8KyhEAPhgHMxFlw5DMNGdJGzqfOdJiXGo8v7u6ub0eegpTzje6k9qhhzyM450hoHHlfog7Z0lDYlSdaWwrDdaHu31y3KVTNbKPRx5pD2IpYVyTRTN1KUR2Cc6QKjzG/ai+icptU4T3Vvp5H3ZM7M1GdHSNIqzHJL+FiadXy0k1IC3FhvgKfA0aUf0wSxRZ4UOgMPJmY04jRSX0oGnIc5da891vsn23UNXd0Er8PEGgOkHvY6cIipfypJrD7+yf+cnBJPewnWeWt0wBcIu5jWiBOIR1eAxBV4DesCw5yW7DVtY2JXN8l///sWVpXxr79VSEBBAk3RISkkWS2AYBt/R9HiCfz2BVjZ+QYFBgAA" \ No newline at end of file diff --git a/node/assets/search.js b/node/assets/search.js index b6a7539..c428234 100644 --- a/node/assets/search.js +++ b/node/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA6VWy27bMBD8lz0Tjik/pWvTADmkDZoiF8EoGGntEJEolZTTGob/vaAkW2S8cmT0aHNmlprdlWYPuvhjIIr38CZVCtF8ykCJHCGCpMhLofEZtZGFAgZbnUEE661KKlkoc+MDRq9VngGDJBPGoIEI4MAIWVRJkeLja6Hw2zZ/QU0on2GGiq8LnYvqVlRIqHaHQ+VKXeTS4E9h3gg953SooMYyEwk+Cy3FS4bmXj1VWqoNod4HvVgqGIcLPgtO9W4Ry0ehKymyU4lqV6K5cU6uVvyBv7dSY0pIHo+GGpJoFBXeFVlKDoJ7PFRSmi9FnguVfv0rTWUI1Q+I4cJ3MsPvurnOBfVz2PD5qO17KNJtRo2wdz5U1CRC3WKJKkWV7B6EEhvSbBJ3ZSMlee3u8Hq5p51KLkpawGDZotw1femT9QDXy16UHCq3wco+2KOoXs29unjfPuj/lBpYhiqxYiBVin8h2sN7++GIIBhNRiEwWEvMUvu1aaoz+4nJUVWwas+eMakKbREN5GYMLB6zYDaahKsVi4+E+v/6jxrFgcWcQHEPFQCLAwIVeKgJsHhCoCYeagosnhKoqYeaAYtnBGrmoebA4jmBmnuoBbB4QaAWHmoJLF4SqKWHCoHFIYEKfVetyZxyn3+wv/afbIDfAW6t5lQPuN8Ebt3mVBu43wduDedUJ7jfCm4951QzuN8Nbm3nVD+43xBunedUS3jTk3oX3lFXmN43OxHHx1B13A22h1/twoyPO7mHMUT7w6FbD/urKVDu1u2KdkQ+65h89inV1C8Shz516NM+ev22Xddvd4caONTgU+pZ5YlDn1ymnz31ouMueqgpYlkew0/HdOzqc8sy9SnkdNR5R533UJvoWtroqtp46zyx88A9/CakpnWC7YiO0X0+b7CyJpf2FS0VMSaOY7zPMkrkrG2OC7zPBmmSJmJhG5M6/rKjL3vZ9haFbi5wLhF2EmGPRBvOqzq6d0xn5Pomrg3e78fgLZVpM3on4+xM38q085O3Uc7xz9l03rfqNoulpyyWHzObo+LOEjlMKwalLDGTCiGKV4fDP72CLNntDQAA"; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA6VXy47bOBD8lz4TM275rWsmAeaQ7GCzmItgLBip7SEiUQpJz8Yw/O8LSrJFxqQj7x7trqqmuvjoPoKq/9GQZkf4LmQB6WLGQPKKIIW8rhqu6JWUFrUEBntVQgrbvcyNqKV+9AEPb6YqgUFecq1JQwpwYgFZknld0MtbLenLvvpGKqB8hRkrvq1Vxc0TNxRQHYJj5RpVV0LTX1x/D+g50bGCipqS5/TKleDfStLP8qtRQu4C6jHozVTJZL3EeXLJ90TUvHBlBC8vKcyhIf3oRO5W/JN+7IWiIiB5Do0tiNAf6qrisvj4U2ijA3X4BTFe+JMo6Q/1qS4LUjfUr2HjzWy/9XNd7MvQfvPiY0V1zuUTNSQLkvnhM5d8FzwiQdzYJDsyH0rxwhWvAtJOdKxgrogbsqUM3ROX4P1yXw8yvylpAaNl6+bQGR2T9QD3y96UvMMc+2Ev3LzpZ3lzvTHo/0k1Ms2dVkbL44T/i+Tt/XGzIBsGQhb0E9IjvPePXArJw/RhDQy2gsrCvoxdVmafw4qkgU0fe6Xc1MoiOsjjBFg2YcniYbrGzYZlZ0YbaP9oYQgswxAMPVgCLEtCsMSDTYFl0xBs6sFmwLJZCDbzYHNg2TwEm3uwBbBsEYItPNgSWLYMwZYebAUsW4VgKw+2BpatQ7C1X15bbQz6gL8Y0ToRtsL3Am3NMegG+nagLTsGDUHfEbSVx6An6JuCtvgYtAV9X9DWH4POoG8NWgswaA767qB1AYP+oG8QWiMwaBF2HrUn7p2UoeK5O3lZdm4zzyeQHeHv/lhOzif+CBNIj6fTcAjtry5Bc9j2d8tAxPnAxPlvqbq9Qxz6zKHPYvT2htm2L55DTRxq8lvqVeapQ5/epl9/9cohr0aQr7KvHYF1RKAgappzRzlwnYrHCm6Z6tI5DtTFQF1EqN080Nh5QPYzg7NsZ9URftf5F+1YMBAdr2JW7cjkpWi6RslJ6eaMJd2RsR439tUUMuDX0hFZ3iFy5ZtTQYyVUOi8a6Opb4UHvrOO2DKEtquoVbeAawln68V2Xj8tmXaWGpjOjo9t+H4Sej9PQkLqfmgaZJwjGzux/d6r+nZ94DrbPrbrbbddXLrt6tyVOx44lxUGb6sNg0Y0VApJkGab0+lf+KpNPnwPAAA="; \ No newline at end of file diff --git a/node/functions/compareVersion.html b/node/functions/compareVersion.html index 88652e4..bc1ee64 100644 --- a/node/functions/compareVersion.html +++ b/node/functions/compareVersion.html @@ -5,4 +5,4 @@

Description

比较两个版本的大小

Example

compareVersion('v1.0.0', '2.0.0') // return -1
compareVersion('a2.0.0', 'B1.0.0', /a|b/ig) // return 1
compareVersion('v1.0.0', 'V1.0.0') // return 0
-

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/node/functions/copyFolder.html b/node/functions/copyFolder.html index db16cde..e2575db 100644 --- a/node/functions/copyFolder.html +++ b/node/functions/copyFolder.html @@ -1,4 +1,4 @@ copyFolder | Compass helpers for node platforms
  • Parameters

    • source: string

      源文件夹路径

    • destination: string

      目标文件夹路径

    Returns Promise<void>

    Description

    异步复制文件夹及其内容到目标文件夹

    -

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/node/functions/copyFolderSync.html b/node/functions/copyFolderSync.html index 3b7321a..4544065 100644 --- a/node/functions/copyFolderSync.html +++ b/node/functions/copyFolderSync.html @@ -1,4 +1,4 @@ copyFolderSync | Compass helpers for node platforms
  • Parameters

    • source: string

      源文件夹路径

    • destination: string

      目标文件夹路径

    Returns void

    Description

    同步复制文件夹及其内容到目标文件夹

    -

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/node/functions/createFile.html b/node/functions/createFile.html index 62f0e9f..7092ef9 100644 --- a/node/functions/createFile.html +++ b/node/functions/createFile.html @@ -4,4 +4,4 @@

Returns Promise<void>

Description

创建文件

-

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/node/functions/createFileSync.html b/node/functions/createFileSync.html index 3d6fd15..c677796 100644 --- a/node/functions/createFileSync.html +++ b/node/functions/createFileSync.html @@ -4,4 +4,4 @@

Returns void

Description

创建文件

-

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/node/functions/createFolder.html b/node/functions/createFolder.html index 6d7a373..53371da 100644 --- a/node/functions/createFolder.html +++ b/node/functions/createFolder.html @@ -2,4 +2,4 @@
  • Optional options: {
        cwd?: string;
    }

    配置项

  • Returns Promise<void>

    Description

    创建文件夹

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/createFolderSync.html b/node/functions/createFolderSync.html new file mode 100644 index 0000000..be628d8 --- /dev/null +++ b/node/functions/createFolderSync.html @@ -0,0 +1,5 @@ +createFolderSync | Compass helpers for node platforms
    • Parameters

      • targetPath: string

        目标路径

        +
      • Optional options: {
            cwd?: string;
        }

        配置项

        +
        • Optional cwd?: string

          执行路径

          +

      Returns void

      Description

      同步创建文件夹

      +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/encodePhoneNumber.html b/node/functions/encodePhoneNumber.html index a389722..82c7272 100644 --- a/node/functions/encodePhoneNumber.html +++ b/node/functions/encodePhoneNumber.html @@ -8,4 +8,4 @@

    Default

    *
     
  • Optional offsetLength?: number

    向右偏移长度,影响加密块离左边的距离

  • Returns string

    Description

    加密手机号码,脱敏处理

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/formatDate.html b/node/functions/formatDate.html index ec3f37a..b70db3a 100644 --- a/node/functions/formatDate.html +++ b/node/functions/formatDate.html @@ -5,4 +5,4 @@

    Returns string

    Description

    时间格式化

    Example

    import { formatDate } from '@compass-aiden/utils';

    formatDate(); // 返回当前时间,格式为 'YYYY-MM-DD hh:mm:ss'
    formatDate('2020/03/12'); // 指定可被Date处理的时间字符串,格式为 'YYYY-MM-DD hh:mm:ss'
    formatDate(Date.now(), 'YYYY/MM/DD'); // 指定可被Date处理的时间戳,格式为 'YYYY/MM/DD'
    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/getCliParam.html b/node/functions/getCliParam.html new file mode 100644 index 0000000..76b1741 --- /dev/null +++ b/node/functions/getCliParam.html @@ -0,0 +1,7 @@ +getCliParam | Compass helpers for node platforms
    • 获取命令行参数

      +

      Parameters

      • param: string

        参数名

        +
      • defaultValue: undefined = undefined

        默认值

        +
      • opt: {
            validator?: ((value?) => boolean);
            valueType?: string;
        } = {}

        配置项

        +
        • Optional validator?: ((value?) => boolean)

          参数的值自定义验证函数

          +
            • (value?): boolean
            • Parameters

              • Optional value: string

              Returns boolean

        • Optional valueType?: string

          参数的值类型

          +

      Returns undefined | string | boolean

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/getFilePathsInFolder.html b/node/functions/getFilePathsInFolder.html index 8406168..45012b1 100644 --- a/node/functions/getFilePathsInFolder.html +++ b/node/functions/getFilePathsInFolder.html @@ -3,4 +3,4 @@

    Returns Promise<string[]>

    文件路径数组

    Description

    获取文件夹内所有文件路径

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/getFilePathsInFolderSync.html b/node/functions/getFilePathsInFolderSync.html index caa9b81..cbf9f8b 100644 --- a/node/functions/getFilePathsInFolderSync.html +++ b/node/functions/getFilePathsInFolderSync.html @@ -3,4 +3,4 @@

    Returns string[]

    文件路径数组

    Description

    同步获取文件夹内所有文件路径

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/isCommandExists.html b/node/functions/isCommandExists.html index afbce2e..9e61613 100644 --- a/node/functions/isCommandExists.html +++ b/node/functions/isCommandExists.html @@ -1,2 +1,2 @@ isCommandExists | Compass helpers for node platforms

    Generated using TypeDoc

    \ No newline at end of file +

    Parameters

    Returns boolean

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/isFileOrFolderExists.html b/node/functions/isFileOrFolderExists.html index 01720ef..bd4ed03 100644 --- a/node/functions/isFileOrFolderExists.html +++ b/node/functions/isFileOrFolderExists.html @@ -1,3 +1,3 @@ isFileOrFolderExists | Compass helpers for node platforms

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/promiseTask.html b/node/functions/promiseTask.html index cc876db..4c8e58d 100644 --- a/node/functions/promiseTask.html +++ b/node/functions/promiseTask.html @@ -1,3 +1,3 @@ promiseTask | Compass helpers for node platforms

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/replaceVariablesInString.html b/node/functions/replaceVariablesInString.html index 8eb7c8e..7f5599f 100644 --- a/node/functions/replaceVariablesInString.html +++ b/node/functions/replaceVariablesInString.html @@ -1,4 +1,4 @@ replaceVariablesInString | Compass helpers for node platforms
    • Parameters

      • templateString: string

        字符串模板

      • params: Record<string, string>

        参数对象

      Returns string

      Description

      替换字符串中包裹起来的变量

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/requireModule.html b/node/functions/requireModule.html index a30155c..4ef3087 100644 --- a/node/functions/requireModule.html +++ b/node/functions/requireModule.html @@ -1,2 +1,2 @@ requireModule | Compass helpers for node platforms
    • Parameters

      • filePath: string

      Returns any

      Description

      读取模块文件,类似require()函数

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/functions/scanDependencyManager.html b/node/functions/scanDependencyManager.html index 1a9f451..78b5258 100644 --- a/node/functions/scanDependencyManager.html +++ b/node/functions/scanDependencyManager.html @@ -1,2 +1,2 @@ scanDependencyManager | Compass helpers for node platforms
    • Parameters

      • Optional opt: {
            cwd?: string;
        }
        • Optional cwd?: string

      Returns "npm" | "pnpm" | "yarn"

      Description

      扫描依赖管理器

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/index.html b/node/index.html index 6c645c6..f5a315e 100644 --- a/node/index.html +++ b/node/index.html @@ -5,14 +5,14 @@

    Node端使用文档

    Getting Started

    web项目使用

    npm方式安装:

    npm install @compass-aiden/helpers

    -
    // 自动识别导入esm文件
    import { formatDate } from '@compass-aiden/helpers';
    // 全量导入
    import * as allHelpers from '@compass-aiden/helpers';
    // 通过别名路径导入esm文件
    import { formatDate } from '@compass-aiden/helpers/esm'; +
    // 按需导入,自动识别导入esm文件
    import { formatDate } from '@compass-aiden/helpers';
    // 全量导入
    import * as allHelpers from '@compass-aiden/helpers';
    // 通过别名路径导入esm文件
    import { formatDate } from '@compass-aiden/helpers/web';

    浏览器script标签安装:

    <!-- 请根据个人需求采用unpkg或者jsdelivr链接 -->
    <script src="https://unpkg.com/@compass-aiden/helpers@latest/dist/compass-helpers.umd.js"></script>
    <script>
    console.log(window.CompassHelpers.formatDate());
    </script>

    node项目使用

    npm方式安装:

    npm install @compass-aiden/helpers

    -
    // 自动导入cjs文件
    const { createFile } = require('@compass-aiden/helpers');
    // 全量导入
    const { createFile } = require('@compass-aiden/helpers');

    /** 在type: module启用ESM环境下,请参考如下方式 */
    // 通过别名路径导入cjs文件,如果不能识别条件导出,tsconfig可设置 `{ "moduleResolution": "bundler" }`
    import { createFile } from '@compass-aiden/helpers/cjs';
    // 自动导入默认cjs文件, 当 tsconfig 配置包含 `{ "moduleResolution": "NodeNext" }`时可用
    import { createFile } from '@compass-aiden/helpers'; +
    // 按需导入 自动导入cjs文件
    const { createFile } = require('@compass-aiden/helpers');
    // 全量导入
    const helpers = require('@compass-aiden/helpers');

    /** 在type: module启用ESM环境下,请参考如下方式 */
    // 通过别名路径导入cjs文件,如果不能识别条件导出,tsconfig可设置 `{ "moduleResolution": "bundler" }`
    import { createFile } from '@compass-aiden/helpers/cjs';
    // 导入esm文件
    import { createFile } from '@compass-aiden/helpers/mjs';
    // 自动导入默认cjs文件, 当 tsconfig 配置包含 `{ "moduleResolution": "NodeNext" }`时可用
    import { createFile } from '@compass-aiden/helpers';

    Contributes

    Install

    pnpm install

    Base commands

      @@ -34,7 +34,6 @@

    更多文档注解参考 TypeDoc

    Publish library

      -
    1. 变更package.json内的version字段
    2. 提交合并请求至master即可

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/modules.html b/node/modules.html index 4c186f4..c528e7b 100644 --- a/node/modules.html +++ b/node/modules.html @@ -6,6 +6,7 @@ createFile createFileSync createFolder +createFolderSync getFilePathsInFolder getFilePathsInFolderSync isFileOrFolderExists @@ -13,6 +14,7 @@

    Tools

    辅助性的工具函数

    compareVersion encodePhoneNumber +getCliParam isCommandExists promiseTask replaceVariablesInString diff --git a/node/types/DeepPartial.html b/node/types/DeepPartial.html index f9acd7c..35bc6ce 100644 --- a/node/types/DeepPartial.html +++ b/node/types/DeepPartial.html @@ -1,2 +1,2 @@ DeepPartial | Compass helpers for node platforms
    DeepPartial<T>: {
        [P in keyof T]?: T[P] extends (infer U)[]
            ? DeepPartial<U>[]
            : T[P] extends ReadonlyArray<infer U>
                ? ReadonlyArray<DeepPartial<U>>
                : T[P] extends object
                    ? DeepPartial<T[P]>
                    : T[P]
    }

    将类型递归变成可选属性

    -

    Type Parameters

    • T

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    • T

    Generated using TypeDoc

    \ No newline at end of file diff --git a/node/types/DeepRequired.html b/node/types/DeepRequired.html index 331d8b1..c81295a 100644 --- a/node/types/DeepRequired.html +++ b/node/types/DeepRequired.html @@ -1,2 +1,2 @@ DeepRequired | Compass helpers for node platforms
    DeepRequired<T>: {
        [P in keyof T]-?: T[P] extends object
            ? DeepRequired<T[P]>
            : T[P]
    }

    将类型递归变成必填属性

    -

    Type Parameters

    • T

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    • T

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/classes/Logger.html b/web/classes/Logger.html index 406368a..ee8a99a 100644 --- a/web/classes/Logger.html +++ b/web/classes/Logger.html @@ -1,7 +1,7 @@ Logger | Compass helpers for web platforms

    Description

    日志记录器

    Example

    import { Logger } from '@compass-aiden/utils';

    // 单例模式使用
    console.log(Logger.config); // 默认配置项
    Logger.config.logLevel = 'debug'; // 修改单个配置
    Logger.updateConfig({
    logLevel: 'debug',
    dateFormat: 'YYYY-MM-DD hh:mm:ss:SSS',
    }); // 批量修改配置
    Logger.debug('Hello world');
    Logger.log('Hello world');
    Logger.info('Hello world');
    Logger.success('Hello world');
    Logger.warn('Hello world');
    Logger.error('Hello world');

    // 多例模式使用
    const loggerMulti = new Logger();
    console.log(loggerMulti.config); // 默认配置项
    loggerMulti.config.logLevel = 'debug'; // 修改单个配置
    loggerMulti.updateConfig({
    subject: 'Aiden2',
    logLevel: 'debug',
    dateFormat: 'YYYY-MM-DD hh:mm:ss',
    }); // 批量修改配置
    loggerMulti.debug('Hello world');
    loggerMulti.log('Hello world');
    loggerMulti.info('Hello world');
    loggerMulti.success('Hello world');
    loggerMulti.warn('Hello world');
    loggerMulti.error('Hello world');
    -

    Constructors

    Constructors

    Properties

    Methods

    debug @@ -18,4 +18,4 @@

    Example

    import<
     success
     updateConfig
     warn
    -

    Constructors

    Properties

    config: LoggerOption = ...
    config: LoggerOption = ...

    Methods

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    config: LoggerOption = ...
    config: LoggerOption = ...

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/classes/ThemeManager.html b/web/classes/ThemeManager.html index 120df1b..2430eb1 100644 --- a/web/classes/ThemeManager.html +++ b/web/classes/ThemeManager.html @@ -1,7 +1,7 @@ ThemeManager | Compass helpers for web platforms

    Description

    基于 CSS variables 与 DOM 的主题管理器

    Example

    const theme = new ThemeManager({
    baseVariables: { '--scope-font-color': '#212121' }, // 声明基础的公共变量,被所有注册主题继承
    hooks: {
    // 使用hook动态设置主题
    afterSystemThemeChange: (systemTheme) => {
    const currentTheme = theme.getCurrentTheme();
    if (!currentTheme || currentTheme === 'default') {
    theme.unregister('default')
    theme.register('default', ThemeConfig[theme])
    theme.toggle('default')
    }
    }
    }, // 各类hooks监听
    });
    console.log(theme.systemTheme); // 当前的系统主题
    // 主题注册
    theme.register('light', {
    '--scope-page-background-color': '#FFFFFF',
    }).register('dark', {
    '--scope-page-background-color': 'black',
    '--scope-font-color': '#FFFFFF',
    });
    theme.toggle('light'); // 切换light主题
    theme.toggle(); // 切换为空,不应用任何主题
    theme.getCurrentTheme(); // 获取当前使用的主题标识, 例如: 'light'
    theme.getThemeData(); // 返回当前使用主题的数据
    theme.getThemeData('dark'); // 获取指定主题变量,不提供参数,则默认返回当前使用主题的数据
    theme.unregister('purple'); // 移除已注册的主题
    theme.destroy(); // 移除主题管理器,释放内部引用资源
    -

    Constructors

    Constructors

    Properties

    container opt styleElement @@ -15,4 +15,4 @@

    Example

    constregister
     toggle
     unregister
    -

    Constructors

    Properties

    container: Element
    opt: TMConstructor
    styleElement: HTMLStyleElement
    styleSheet: CSSStyleSheet
    systemTheme: "light" | "dark"
    themeMap: Map<string, TMThemeConfig> = ...

    Methods

    Generated using TypeDoc

    \ No newline at end of file +

    Constructors

    Properties

    container: Element
    opt: TMConstructor
    styleElement: HTMLStyleElement
    styleSheet: CSSStyleSheet
    systemTheme: "light" | "dark"
    themeMap: Map<string, TMThemeConfig> = ...

    Methods

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/functions/compareVersion.html b/web/functions/compareVersion.html index 7ccdfbf..8613d5b 100644 --- a/web/functions/compareVersion.html +++ b/web/functions/compareVersion.html @@ -5,4 +5,4 @@

    Description

    比较两个版本的大小

    Example

    compareVersion('v1.0.0', '2.0.0') // return -1
    compareVersion('a2.0.0', 'B1.0.0', /a|b/ig) // return 1
    compareVersion('v1.0.0', 'V1.0.0') // return 0
    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/functions/downloadFile.html b/web/functions/downloadFile.html index 90e1fe0..a3bba5a 100644 --- a/web/functions/downloadFile.html +++ b/web/functions/downloadFile.html @@ -2,4 +2,4 @@
  • filename: string

    指定的文件名

  • Optional blobOption: BlobPropertyBag

    blob处理data时的配置选项

  • Returns void

    Description

    文件下载方法

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/functions/encodePhoneNumber.html b/web/functions/encodePhoneNumber.html index b9c618f..b6f25aa 100644 --- a/web/functions/encodePhoneNumber.html +++ b/web/functions/encodePhoneNumber.html @@ -8,4 +8,4 @@

    Default

    *
     
  • Optional offsetLength?: number

    向右偏移长度,影响加密块离左边的距离

  • Returns string

    Description

    加密手机号码,脱敏处理

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/functions/formatDate.html b/web/functions/formatDate.html index 4660c2b..63dcfdc 100644 --- a/web/functions/formatDate.html +++ b/web/functions/formatDate.html @@ -5,4 +5,4 @@

    Returns string

    Description

    时间格式化

    Example

    import { formatDate } from '@compass-aiden/utils';

    formatDate(); // 返回当前时间,格式为 'YYYY-MM-DD hh:mm:ss'
    formatDate('2020/03/12'); // 指定可被Date处理的时间字符串,格式为 'YYYY-MM-DD hh:mm:ss'
    formatDate(Date.now(), 'YYYY/MM/DD'); // 指定可被Date处理的时间戳,格式为 'YYYY/MM/DD'
    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/functions/promiseTask.html b/web/functions/promiseTask.html index 630fe00..869e83a 100644 --- a/web/functions/promiseTask.html +++ b/web/functions/promiseTask.html @@ -1,3 +1,3 @@ promiseTask | Compass helpers for web platforms

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/functions/replaceVariablesInString.html b/web/functions/replaceVariablesInString.html index 5b4d0c2..1d2b66f 100644 --- a/web/functions/replaceVariablesInString.html +++ b/web/functions/replaceVariablesInString.html @@ -1,4 +1,4 @@ replaceVariablesInString | Compass helpers for web platforms
    • Parameters

      • templateString: string

        字符串模板

      • params: Record<string, string>

        参数对象

      Returns string

      Description

      替换字符串中包裹起来的变量

      -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/index.html b/web/index.html index 70013e2..20c1f1d 100644 --- a/web/index.html +++ b/web/index.html @@ -5,14 +5,14 @@

    Node端使用文档

    Getting Started

    web项目使用

    npm方式安装:

    npm install @compass-aiden/helpers

    -
    // 自动识别导入esm文件
    import { formatDate } from '@compass-aiden/helpers';
    // 全量导入
    import * as allHelpers from '@compass-aiden/helpers';
    // 通过别名路径导入esm文件
    import { formatDate } from '@compass-aiden/helpers/esm'; +
    // 按需导入,自动识别导入esm文件
    import { formatDate } from '@compass-aiden/helpers';
    // 全量导入
    import * as allHelpers from '@compass-aiden/helpers';
    // 通过别名路径导入esm文件
    import { formatDate } from '@compass-aiden/helpers/web';

    浏览器script标签安装:

    <!-- 请根据个人需求采用unpkg或者jsdelivr链接 -->
    <script src="https://unpkg.com/@compass-aiden/helpers@latest/dist/compass-helpers.umd.js"></script>
    <script>
    console.log(window.CompassHelpers.formatDate());
    </script>

    node项目使用

    npm方式安装:

    npm install @compass-aiden/helpers

    -
    // 自动导入cjs文件
    const { createFile } = require('@compass-aiden/helpers');
    // 全量导入
    const { createFile } = require('@compass-aiden/helpers');

    /** 在type: module启用ESM环境下,请参考如下方式 */
    // 通过别名路径导入cjs文件,如果不能识别条件导出,tsconfig可设置 `{ "moduleResolution": "bundler" }`
    import { createFile } from '@compass-aiden/helpers/cjs';
    // 自动导入默认cjs文件, 当 tsconfig 配置包含 `{ "moduleResolution": "NodeNext" }`时可用
    import { createFile } from '@compass-aiden/helpers'; +
    // 按需导入 自动导入cjs文件
    const { createFile } = require('@compass-aiden/helpers');
    // 全量导入
    const helpers = require('@compass-aiden/helpers');

    /** 在type: module启用ESM环境下,请参考如下方式 */
    // 通过别名路径导入cjs文件,如果不能识别条件导出,tsconfig可设置 `{ "moduleResolution": "bundler" }`
    import { createFile } from '@compass-aiden/helpers/cjs';
    // 导入esm文件
    import { createFile } from '@compass-aiden/helpers/mjs';
    // 自动导入默认cjs文件, 当 tsconfig 配置包含 `{ "moduleResolution": "NodeNext" }`时可用
    import { createFile } from '@compass-aiden/helpers';

    Contributes

    Install

    pnpm install

    Base commands

      @@ -34,7 +34,6 @@

    更多文档注解参考 TypeDoc

    Publish library

      -
    1. 变更package.json内的version字段
    2. 提交合并请求至master即可

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/types/DeepPartial.html b/web/types/DeepPartial.html index 5b75512..3107f8a 100644 --- a/web/types/DeepPartial.html +++ b/web/types/DeepPartial.html @@ -1,2 +1,2 @@ DeepPartial | Compass helpers for web platforms
    DeepPartial<T>: {
        [P in keyof T]?: T[P] extends (infer U)[]
            ? DeepPartial<U>[]
            : T[P] extends ReadonlyArray<infer U>
                ? ReadonlyArray<DeepPartial<U>>
                : T[P] extends object
                    ? DeepPartial<T[P]>
                    : T[P]
    }

    将类型递归变成可选属性

    -

    Type Parameters

    • T

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    • T

    Generated using TypeDoc

    \ No newline at end of file diff --git a/web/types/DeepRequired.html b/web/types/DeepRequired.html index 0253469..f050233 100644 --- a/web/types/DeepRequired.html +++ b/web/types/DeepRequired.html @@ -1,2 +1,2 @@ DeepRequired | Compass helpers for web platforms
    DeepRequired<T>: {
        [P in keyof T]-?: T[P] extends object
            ? DeepRequired<T[P]>
            : T[P]
    }

    将类型递归变成必填属性

    -

    Type Parameters

    • T

    Generated using TypeDoc

    \ No newline at end of file +

    Type Parameters

    • T

    Generated using TypeDoc

    \ No newline at end of file