yootd 0.2.38 → 0.2.40

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.
@@ -1,10 +1,9 @@
1
- import _ from 'lodash';
2
1
  import { useContext } from 'react';
3
2
  import { ConfigContext } from "../config-provider/context";
4
3
  export var useAssets = function useAssets() {
5
4
  var _useContext = useContext(ConfigContext),
6
5
  assetsURL = _useContext.assetsURL;
7
- if (_.isNil(assetsURL)) {
6
+ if (assetsURL == null) {
8
7
  throw new Error('assetsURL is not found');
9
8
  }
10
9
  return assetsURL;
@@ -1,10 +1,9 @@
1
- import _ from "lodash";
2
1
  import { useContext } from "react";
3
2
  import { ConfigContext } from "../config-provider/context";
4
3
  export var useBaseURL = function useBaseURL() {
5
4
  var _useContext = useContext(ConfigContext),
6
5
  baseURL = _useContext.baseURL;
7
- if (_.isNil(baseURL)) {
6
+ if (baseURL == null) {
8
7
  throw new Error('baseURL is not found');
9
8
  }
10
9
  return baseURL;
@@ -1,7 +1,6 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
- import _ from 'lodash';
5
4
  import { useRef } from 'react';
6
5
  var Bem = /*#__PURE__*/function () {
7
6
  function Bem(_namespace) {
@@ -17,7 +16,7 @@ var Bem = /*#__PURE__*/function () {
17
16
  key: "b",
18
17
  value: function b(block) {
19
18
  var suffix = this.suffix;
20
- if (!_.isEmpty(block)) {
19
+ if (block !== "") {
21
20
  suffix = suffix + '-' + block;
22
21
  }
23
22
  return new Bem(this.namespace).setSuffix(suffix);
@@ -28,7 +27,7 @@ var Bem = /*#__PURE__*/function () {
28
27
  key: "e",
29
28
  value: function e(element) {
30
29
  var suffix = this.suffix;
31
- if (!_.isEmpty(element)) {
30
+ if (element !== "") {
32
31
  suffix = suffix + '__' + element;
33
32
  }
34
33
  return new Bem(this.namespace).setSuffix(suffix);
@@ -39,7 +38,7 @@ var Bem = /*#__PURE__*/function () {
39
38
  key: "m",
40
39
  value: function m(modifier) {
41
40
  var suffix = this.suffix;
42
- if (!_.isEmpty(modifier)) {
41
+ if (modifier !== "") {
43
42
  suffix = suffix + '--' + modifier;
44
43
  }
45
44
  return new Bem(this.namespace).setSuffix(suffix);
@@ -59,7 +58,7 @@ var Bem = /*#__PURE__*/function () {
59
58
  key: "toString",
60
59
  value: function toString() {
61
60
  var className = "".concat(this.prefix, "-").concat(this.namespace);
62
- if (!_.isEmpty(this.suffix)) {
61
+ if (this.suffix !== "") {
63
62
  className = className + this.suffix;
64
63
  }
65
64
  return className;
@@ -1,10 +1,9 @@
1
- import _ from 'lodash';
2
1
  import { useContext } from 'react';
3
2
  import { ConfigContext } from "../config-provider/context";
4
3
  export var useOSS = function useOSS() {
5
4
  var _useContext = useContext(ConfigContext),
6
5
  ossURL = _useContext.ossURL;
7
- if (_.isNil(ossURL)) {
6
+ if (ossURL == null) {
8
7
  throw new Error('ossURL is not found');
9
8
  }
10
9
  return ossURL;
@@ -1,10 +1,9 @@
1
- import _ from 'lodash';
2
1
  import { useContext } from 'react';
3
2
  import { ConfigContext } from "../config-provider/context";
4
3
  export var useRequest = function useRequest() {
5
4
  var _useContext = useContext(ConfigContext),
6
5
  request = _useContext.request;
7
- if (_.isNil(request)) {
6
+ if (request == null) {
8
7
  throw new Error('request is not found');
9
8
  }
10
9
  return request;
@@ -1,7 +1,7 @@
1
- .yot-preview-phone {
2
- width: 398px;
3
- height: 829px;
4
- background-size: 100% 100%;
5
- padding: 96px 36px 20px 36px;
6
- box-sizing: border-box;
7
- }
1
+ .yot-preview-phone {
2
+ width: 398px;
3
+ height: 829px;
4
+ background-size: 100% 100%;
5
+ padding: 96px 36px 20px 36px;
6
+ box-sizing: border-box;
7
+ }
@@ -1,2 +1,3 @@
1
1
  export type { GetProp, GetProps, GetRef } from 'antd';
2
2
  export declare const arrayMove: (arr: any[], from: number, to: number) => any[];
3
+ export declare const throttle: <T extends unknown[]>(callback: (...args: T) => void, delay: number) => (...args: T) => void;
@@ -4,4 +4,17 @@ export var arrayMove = function arrayMove(arr, from, to) {
4
4
  newArr.splice(from, 1);
5
5
  newArr.splice(to, 0, arr[from]);
6
6
  return newArr;
7
+ };
8
+ export var throttle = function throttle(callback, delay) {
9
+ var isWaiting = false;
10
+ return function () {
11
+ if (isWaiting) {
12
+ return;
13
+ }
14
+ callback.apply(void 0, arguments);
15
+ isWaiting = true;
16
+ setTimeout(function () {
17
+ isWaiting = false;
18
+ }, delay);
19
+ };
7
20
  };
@@ -13,12 +13,12 @@ import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef,
13
13
  import { useBem } from "../hooks/useBem";
14
14
  import "./index.scss";
15
15
  import { useQuery } from '@tanstack/react-query';
16
- import { throttle } from 'lodash';
17
16
  import { Spin } from "./..";
18
17
  import { useBaseURL } from "../hooks/useBaseURL";
19
18
  import { useOSS } from "../hooks/useOSS";
20
19
  import { useRequest } from "../hooks/useRequest";
21
20
  import { loadScript } from "../utils/script";
21
+ import { throttle } from "../utils/utils";
22
22
  import controlBottomBg from "./assets/control-background.png";
23
23
  var PROGRESS_BAR_HEIGHT = 63;
24
24
  var MIN_SCORE = 0.5; // minimum score
@@ -40,8 +40,6 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
40
40
  style = _ref.style,
41
41
  _ref$aiFeatures = _ref.aiFeatures,
42
42
  aiFeatures = _ref$aiFeatures === void 0 ? ['emotion', 'character', 'anchor', 'pose'] : _ref$aiFeatures,
43
- _ref$retry = _ref.retry,
44
- retry = _ref$retry === void 0 ? false : _ref$retry,
45
43
  _ref$retryInterval = _ref.retryInterval,
46
44
  retryInterval = _ref$retryInterval === void 0 ? 5000 : _ref$retryInterval,
47
45
  className = _ref.className,
@@ -458,13 +456,13 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
458
456
  male: '男',
459
457
  female: '女'
460
458
  };
461
- /* neutral: 'calm',
462
- happy: 'happy',
463
- sad: 'depressed',
464
- angry: 'angry',
465
- fearful: 'dread',
466
- disgusted: 'detest',
467
- surprised: 'surprised',
459
+ /* neutral: 'calm',
460
+ happy: 'happy',
461
+ sad: 'depressed',
462
+ angry: 'angry',
463
+ fearful: 'dread',
464
+ disgusted: 'detest',
465
+ surprised: 'surprised',
468
466
  */
469
467
 
470
468
  var emotionMap = {
@@ -2,7 +2,6 @@
2
2
  display: flex;
3
3
  justify-content: center;
4
4
  align-items: center;
5
-
6
5
  &-container {
7
6
  width: 100%;
8
7
  height: 100%;
@@ -17,7 +16,9 @@
17
16
  &__progress {
18
17
  visibility: visible;
19
18
  }
20
-
19
+ &__controls-content {
20
+ visibility: visible;
21
+ }
21
22
  &__controls-bottom-progress__bar {
22
23
  visibility: hidden;
23
24
  }
@@ -79,6 +80,7 @@
79
80
  user-select: none;
80
81
  position: relative;
81
82
  z-index: 10;
83
+ visibility: hidden;
82
84
  }
83
85
 
84
86
  &__controls-icon {
@@ -334,4 +336,4 @@
334
336
  100% {
335
337
  transform: rotate(360deg);
336
338
  }
337
- }
339
+ }
package/package.json CHANGED
@@ -1,95 +1,93 @@
1
- {
2
- "name": "yootd",
3
- "version": "0.2.38",
4
- "description": "基于 Antd 二次开发的组件库",
5
- "license": "MIT",
6
- "sideEffects": [
7
- "*.scss"
8
- ],
9
- "module": "dist/index.js",
10
- "types": "dist/index.d.ts",
11
- "files": [
12
- "dist"
13
- ],
14
- "scripts": {
15
- "build": "father build",
16
- "build:watch": "father dev",
17
- "dev": "dumi dev",
18
- "docs:build": "dumi build",
19
- "docs:preview": "dumi preview",
20
- "doctor": "father doctor",
21
- "lint": "npm run lint:es && npm run lint:css",
22
- "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
23
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
24
- "prepare": "husky install && dumi setup",
25
- "prepublishOnly": "father doctor && npm run build",
26
- "start": "npm run dev"
27
- },
28
- "commitlint": {
29
- "extends": [
30
- "@commitlint/config-conventional"
31
- ]
32
- },
33
- "lint-staged": {
34
- "*.{md,json}": [
35
- "prettier --write --no-error-on-unmatched-pattern"
36
- ],
37
- "*.{css,less}": [
38
- "stylelint --fix",
39
- "prettier --write"
40
- ],
41
- "*.{js,jsx}": [
42
- "eslint --fix",
43
- "prettier --write"
44
- ],
45
- "*.{ts,tsx}": [
46
- "eslint --fix",
47
- "prettier --parser=typescript --write"
48
- ]
49
- },
50
- "dependencies": {
51
- "@ant-design/icons": "^6.0.0",
52
- "@babel/runtime": "^7.26.9"
53
- },
54
- "devDependencies": {
55
- "@commitlint/cli": "^17.1.2",
56
- "@commitlint/config-conventional": "^17.1.0",
57
- "@tensorflow-models/pose-detection": ">=2.1.3",
58
- "@tensorflow/tfjs": ">=4.22.0",
59
- "@types/lodash": "^4.17.12",
60
- "@types/react": "^18.0.0",
61
- "@types/react-dom": "^18.0.0",
62
- "@umijs/lint": "^4.0.0",
63
- "@vladmandic/face-api": ">=1.7.14",
64
- "cross-env": "^10.0.0",
65
- "dumi": "^2.3.0",
66
- "dumi-theme-antd": "^0.4.2",
67
- "eslint": "^8.23.0",
68
- "father": "^4.1.0",
69
- "husky": "^8.0.1",
70
- "lint-staged": "^13.0.3",
71
- "prettier": "^2.7.1",
72
- "prettier-plugin-organize-imports": "^3.0.0",
73
- "prettier-plugin-packagejson": "^2.2.18",
74
- "sass": "^1.80.0",
75
- "stylelint": "^14.9.1"
76
- },
77
- "peerDependencies": {
78
- "@dnd-kit/core": ">=6.1.0",
79
- "@dnd-kit/modifiers": ">=7.0.0",
80
- "@dnd-kit/sortable": ">=8.0.0",
81
- "@dnd-kit/utilities": ">=3.2.2",
82
- "@tanstack/react-query": ">=5.59.15",
83
- "@xyflow/react": ">=12.3.3",
84
- "antd": ">=5.21.4",
85
- "axios": ">=1.7.7",
86
- "dayjs": ">=1.11.13",
87
- "lodash": ">=4.17.21",
88
- "react": ">=18.0.0",
89
- "react-dom": ">=18.0.0"
90
- },
91
- "publishConfig": {
92
- "access": "public"
93
- },
94
- "authors": []
95
- }
1
+ {
2
+ "name": "yootd",
3
+ "version": "0.2.40",
4
+ "description": "基于 Antd 二次开发的组件库",
5
+ "license": "MIT",
6
+ "sideEffects": [
7
+ "*.scss"
8
+ ],
9
+ "module": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "build": "father build",
16
+ "build:watch": "father dev",
17
+ "dev": "dumi dev",
18
+ "docs:build": "dumi build",
19
+ "docs:preview": "dumi preview",
20
+ "doctor": "father doctor",
21
+ "lint": "npm run lint:es && npm run lint:css",
22
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
23
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
24
+ "prepare": "husky install && dumi setup",
25
+ "prepublishOnly": "father doctor && npm run build",
26
+ "start": "npm run dev"
27
+ },
28
+ "commitlint": {
29
+ "extends": [
30
+ "@commitlint/config-conventional"
31
+ ]
32
+ },
33
+ "lint-staged": {
34
+ "*.{md,json}": [
35
+ "prettier --write --no-error-on-unmatched-pattern"
36
+ ],
37
+ "*.{css,less}": [
38
+ "stylelint --fix",
39
+ "prettier --write"
40
+ ],
41
+ "*.{js,jsx}": [
42
+ "eslint --fix",
43
+ "prettier --write"
44
+ ],
45
+ "*.{ts,tsx}": [
46
+ "eslint --fix",
47
+ "prettier --parser=typescript --write"
48
+ ]
49
+ },
50
+ "dependencies": {
51
+ "@ant-design/icons": "^6.0.0",
52
+ "@babel/runtime": "^7.26.9"
53
+ },
54
+ "devDependencies": {
55
+ "@commitlint/cli": "^17.1.2",
56
+ "@commitlint/config-conventional": "^17.1.0",
57
+ "@tensorflow-models/pose-detection": ">=2.1.3",
58
+ "@tensorflow/tfjs": ">=4.22.0",
59
+ "@types/react": "^18.0.0",
60
+ "@types/react-dom": "^18.0.0",
61
+ "@umijs/lint": "^4.0.0",
62
+ "@vladmandic/face-api": ">=1.7.14",
63
+ "cross-env": "^10.0.0",
64
+ "dumi": "^2.3.0",
65
+ "dumi-theme-antd": "^0.4.2",
66
+ "eslint": "^8.23.0",
67
+ "father": "^4.1.0",
68
+ "husky": "^8.0.1",
69
+ "lint-staged": "^13.0.3",
70
+ "prettier": "^2.7.1",
71
+ "prettier-plugin-organize-imports": "^3.0.0",
72
+ "prettier-plugin-packagejson": "^2.2.18",
73
+ "sass": "^1.80.0",
74
+ "stylelint": "^14.9.1"
75
+ },
76
+ "peerDependencies": {
77
+ "@dnd-kit/core": ">=6.1.0",
78
+ "@dnd-kit/modifiers": ">=7.0.0",
79
+ "@dnd-kit/sortable": ">=8.0.0",
80
+ "@dnd-kit/utilities": ">=3.2.2",
81
+ "@tanstack/react-query": ">=5.59.15",
82
+ "@xyflow/react": ">=12.3.3",
83
+ "antd": ">=5.21.4",
84
+ "axios": ">=1.7.7",
85
+ "dayjs": ">=1.11.13",
86
+ "react": ">=18.0.0",
87
+ "react-dom": ">=18.0.0"
88
+ },
89
+ "publishConfig": {
90
+ "access": "public"
91
+ },
92
+ "authors": []
93
+ }