@xfe-repo/mini-components 0.0.1

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.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # `@xfe-repo/web-components`
2
+
3
+ web组件库
package/dist/index.css ADDED
@@ -0,0 +1,100 @@
1
+ /* src/Loading/index.less */
2
+ .circle_loading {
3
+ display: flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ padding: 24px;
7
+ font-size: 12px;
8
+ color: #999;
9
+ }
10
+ .circle_loading .img_circle_wrapper {
11
+ position: relative;
12
+ margin-right: 12px;
13
+ width: 24px;
14
+ height: 24px;
15
+ animation: rotating 5s infinite linear;
16
+ }
17
+ .circle_loading .img_circle_wrapper .img_circle {
18
+ width: 100%;
19
+ height: 100%;
20
+ border-radius: 50%;
21
+ }
22
+ @keyframes rotating {
23
+ to {
24
+ transform: rotate(5turn);
25
+ }
26
+ }
27
+ .list_loading {
28
+ padding: 8px 0;
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ font-size: 12px;
33
+ color: #999;
34
+ }
35
+ .list_loading .loading {
36
+ margin-right: 10px;
37
+ width: 40px;
38
+ height: 20px;
39
+ }
40
+ .rect_loading {
41
+ display: flex;
42
+ justify-content: space-around;
43
+ width: 100%;
44
+ height: 100%;
45
+ min-width: 40px;
46
+ min-height: 20px;
47
+ }
48
+ .rect_loading .rect {
49
+ display: block;
50
+ flex-shrink: 0;
51
+ width: 3px;
52
+ height: 100%;
53
+ min-height: 20px;
54
+ background-color: #ffde39;
55
+ transform: scaleY(0.4);
56
+ animation: stretchDelay 1.2s infinite ease-in-out;
57
+ will-change: transform;
58
+ }
59
+ .rect_loading .rect_0 {
60
+ animation-delay: calc(0 * 0.13s);
61
+ }
62
+ .rect_loading .rect_1 {
63
+ animation-delay: calc(1 * 0.13s);
64
+ }
65
+ .rect_loading .rect_2 {
66
+ animation-delay: calc(2 * 0.13s);
67
+ }
68
+ .rect_loading .rect_3 {
69
+ animation-delay: calc(3 * 0.13s);
70
+ }
71
+ .rect_loading .rect_4 {
72
+ animation-delay: calc(4 * 0.13s);
73
+ }
74
+ .rect_loading .rect_5 {
75
+ animation-delay: calc(5 * 0.13s);
76
+ }
77
+ .rect_loading .rect_6 {
78
+ animation-delay: calc(6 * 0.13s);
79
+ }
80
+ .rect_loading .rect_7 {
81
+ animation-delay: calc(7 * 0.13s);
82
+ }
83
+ .rect_loading .rect_8 {
84
+ animation-delay: calc(8 * 0.13s);
85
+ }
86
+ .rect_loading .rect_9 {
87
+ animation-delay: calc(9 * 0.13s);
88
+ }
89
+ @keyframes stretchDelay {
90
+ 0%, 40%, 100% {
91
+ transform: scaleY(0.4);
92
+ }
93
+ 20% {
94
+ transform: scaleY(1);
95
+ }
96
+ }
97
+ .rect_tips {
98
+ font-size: 12px;
99
+ color: #999;
100
+ }
@@ -0,0 +1,32 @@
1
+ export * from '@tarojs/components';
2
+ import React from 'react';
3
+
4
+ interface LoadingRectProps extends LoadingProps {
5
+ tips?: string;
6
+ rectCount?: number;
7
+ }
8
+
9
+ interface LoadingListProps extends LoadingProps {
10
+ hasMore?: boolean;
11
+ loading?: boolean;
12
+ noMoreText?: string;
13
+ loadingText?: string;
14
+ loadMoreText?: string;
15
+ hide?: boolean;
16
+ }
17
+
18
+ interface LoadingCircleProps extends LoadingProps {
19
+ }
20
+
21
+ interface LoadingProps {
22
+ className?: string;
23
+ onClick?: () => void;
24
+ tips?: string;
25
+ }
26
+ declare const _default: React.FunctionComponent<LoadingProps> & {
27
+ Circle: React.NamedExoticComponent<LoadingCircleProps>;
28
+ List: React.NamedExoticComponent<LoadingListProps>;
29
+ Rect: React.NamedExoticComponent<LoadingRectProps>;
30
+ };
31
+
32
+ export { _default as Loading };
package/dist/index.js ADDED
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ function _define_property(obj, key, value) {
3
+ if (key in obj) {
4
+ Object.defineProperty(obj, key, {
5
+ value: value,
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true
9
+ });
10
+ } else {
11
+ obj[key] = value;
12
+ }
13
+ return obj;
14
+ }
15
+ function _object_spread(target) {
16
+ for(var i = 1; i < arguments.length; i++){
17
+ var source = arguments[i] != null ? arguments[i] : {};
18
+ var ownKeys = Object.keys(source);
19
+ if (typeof Object.getOwnPropertySymbols === "function") {
20
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
21
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
22
+ }));
23
+ }
24
+ ownKeys.forEach(function(key) {
25
+ _define_property(target, key, source[key]);
26
+ });
27
+ }
28
+ return target;
29
+ }
30
+ var __create = Object.create;
31
+ var __defProp = Object.defineProperty;
32
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
33
+ var __getOwnPropNames = Object.getOwnPropertyNames;
34
+ var __getProtoOf = Object.getPrototypeOf;
35
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
36
+ var __export = function(target, all) {
37
+ for(var name in all)__defProp(target, name, {
38
+ get: all[name],
39
+ enumerable: true
40
+ });
41
+ };
42
+ var __copyProps = function(to, from, except, desc) {
43
+ if (from && typeof from === "object" || typeof from === "function") {
44
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
45
+ try {
46
+ var _loop = function() {
47
+ var key = _step.value;
48
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
49
+ get: function() {
50
+ return from[key];
51
+ },
52
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
53
+ });
54
+ };
55
+ for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
56
+ } catch (err) {
57
+ _didIteratorError = true;
58
+ _iteratorError = err;
59
+ } finally{
60
+ try {
61
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
62
+ _iterator.return();
63
+ }
64
+ } finally{
65
+ if (_didIteratorError) {
66
+ throw _iteratorError;
67
+ }
68
+ }
69
+ }
70
+ }
71
+ return to;
72
+ };
73
+ var __reExport = function(target, mod, secondTarget) {
74
+ return __copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
75
+ };
76
+ var __toESM = function(mod, isNodeMode, target) {
77
+ return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
78
+ // file that has been converted to a CommonJS file using a Babel-
79
+ // compatible transform (i.e. "__esModule" has not been set), then set
80
+ // "default" to the CommonJS "module.exports" for node compatibility.
81
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
82
+ value: mod,
83
+ enumerable: true
84
+ }) : target, mod);
85
+ };
86
+ var __toCommonJS = function(mod) {
87
+ return __copyProps(__defProp({}, "__esModule", {
88
+ value: true
89
+ }), mod);
90
+ };
91
+ // src/index.ts
92
+ var src_exports = {};
93
+ __export(src_exports, {
94
+ Loading: function() {
95
+ return Loading_default;
96
+ }
97
+ });
98
+ module.exports = __toCommonJS(src_exports);
99
+ __reExport(src_exports, require("@tarojs/components"), module.exports);
100
+ // src/Loading/index.tsx
101
+ var import_react4 = require("react");
102
+ // src/Loading/LoadingCircle.tsx
103
+ var import_react = require("react");
104
+ var import_classnames = __toESM(require("classnames"));
105
+ var import_components = require("@tarojs/components");
106
+ var import_jsx_runtime = require("react/jsx-runtime");
107
+ var LoadingCircle = function(props) {
108
+ var className = props.className, _props_tips = props.tips, tips = _props_tips === void 0 ? "加载中" : _props_tips, onClick = props.onClick;
109
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.View, {
110
+ className: (0, import_classnames.default)("circle_loading", !!className && className),
111
+ onClick: onClick,
112
+ children: [
113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.View, {
114
+ className: "img_circle_wrapper",
115
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Image, {
116
+ className: "img_circle",
117
+ src: "https://imgs.eshetang.com/activity/a14fa2166ed698f3d04061f57e5ab9b9.png"
118
+ })
119
+ }),
120
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Text, {
121
+ children: tips
122
+ })
123
+ ]
124
+ });
125
+ };
126
+ var LoadingCircle_default = (0, import_react.memo)(LoadingCircle);
127
+ // src/Loading/LoadingList.tsx
128
+ var import_react3 = require("react");
129
+ var import_classnames3 = __toESM(require("classnames"));
130
+ var import_components3 = require("@tarojs/components");
131
+ // src/Loading/LoadingRect.tsx
132
+ var import_react2 = require("react");
133
+ var import_classnames2 = __toESM(require("classnames"));
134
+ var import_components2 = require("@tarojs/components");
135
+ var import_jsx_runtime2 = require("react/jsx-runtime");
136
+ var LoadingRect = function(props) {
137
+ var className = props.className, _props_rectCount = props.rectCount, rectCount = _props_rectCount === void 0 ? 5 : _props_rectCount, tips = props.tips, onClick = props.onClick;
138
+ var max = rectCount <= 10 ? rectCount : 10;
139
+ var rectNodes = [];
140
+ for(var i = 1; i <= max; i++){
141
+ rectNodes.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_components2.View, {
142
+ className: (0, import_classnames2.default)("rect", "rect_".concat(i))
143
+ }, "rect_".concat(i)));
144
+ }
145
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_components2.View, {
146
+ onClick: onClick,
147
+ children: [
148
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_components2.View, {
149
+ className: (0, import_classnames2.default)("rect_loading", !!className && className),
150
+ children: rectNodes
151
+ }),
152
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_components2.Text, {
153
+ className: "rect_tips",
154
+ children: tips
155
+ })
156
+ ]
157
+ });
158
+ };
159
+ var LoadingRect_default = (0, import_react2.memo)(LoadingRect);
160
+ // src/Loading/LoadingList.tsx
161
+ var import_jsx_runtime3 = require("react/jsx-runtime");
162
+ var LoadingList = function(props) {
163
+ var className = props.className, hasMore = props.hasMore, _props_loading = props.loading, loading = _props_loading === void 0 ? true : _props_loading, hide = props.hide, onClick = props.onClick;
164
+ var _props_noMoreText = props.noMoreText, noMoreText = _props_noMoreText === void 0 ? "没有更多了" : _props_noMoreText, _props_loadingText = props.loadingText, loadingText = _props_loadingText === void 0 ? "加载中" : _props_loadingText, _props_loadMoreText = props.loadMoreText, loadMoreText = _props_loadMoreText === void 0 ? "加载更多" : _props_loadMoreText;
165
+ if (hide) return null;
166
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_components3.View, {
167
+ className: (0, import_classnames3.default)("list_loading", !!className && className),
168
+ onClick: onClick,
169
+ children: [
170
+ (loading || hasMore) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_components3.View, {
171
+ className: "loading",
172
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LoadingRect_default, {})
173
+ }),
174
+ hasMore ? loading ? loadingText : loadMoreText : noMoreText
175
+ ]
176
+ });
177
+ };
178
+ var LoadingList_default = (0, import_react3.memo)(LoadingList);
179
+ // src/Loading/index.tsx
180
+ var import_jsx_runtime4 = require("react/jsx-runtime");
181
+ var Loading = (0, import_react4.memo)(function(props) {
182
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LoadingCircle_default, _object_spread({}, props));
183
+ });
184
+ var Loading_default = Object.assign(Loading, {
185
+ Circle: LoadingCircle_default,
186
+ List: LoadingList_default,
187
+ Rect: LoadingRect_default
188
+ });
189
+ // Annotate the CommonJS export names for ESM import in node:
190
+ 0 && (module.exports = _object_spread({
191
+ Loading: Loading
192
+ }, require("@tarojs/components")));
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@xfe-repo/mini-components",
3
+ "version": "0.0.1",
4
+ "sideEffects": false,
5
+ "module": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "dependencies": {
11
+ "classnames": "^2.5.1",
12
+ "@tarojs/components": "4.0.8",
13
+ "@tarojs/plugin-platform-weapp": "4.0.8"
14
+ },
15
+ "devDependencies": {
16
+ "@swc/core": "^1.3.100",
17
+ "@types/node": "^20.16.5",
18
+ "@types/react": "^18",
19
+ "esbuild-plugin-less": "^1.3.9",
20
+ "@xfe-repo/eslint-config": "0.0.5",
21
+ "@xfe-repo/typescript-config": "0.0.6"
22
+ },
23
+ "scripts": {
24
+ "build": "tsup",
25
+ "dev": "tsup --watch",
26
+ "lint": "eslint \"src/**/*.ts*\"",
27
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
28
+ }
29
+ }