clxx 2.0.7 → 2.0.9

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 CHANGED
@@ -1,3 +1,35 @@
1
- # v2.0.0
1
+ # v2.0.8
2
2
 
3
- Completely reconstructed,Documentation coming soon...
3
+ ## 功能函数
4
+
5
+ - [`ago`](./src/Ago/index.tsx):显示多久以前
6
+ - [`calendarTable`](./src/utils/calendarTable.ts):创建一个月历视图的原始数据表
7
+ - [`Countdown`](./src/utils/Countdown.ts):倒计时器,最大可以到天
8
+ - [`createApp`](./src/utils/createApp.tsx):创建一个带路由的 APP 对象,这是个非常实用的功能函数
9
+ - [`defaultScroll`](./src/utils/defaultScroll.ts):禁用和启用默认滚动
10
+ - [`createPortalDOM`](./src/utils/dom.tsx):任意位置创建一个 DOM 节点,用来挂载和卸载 React 组件
11
+ - [`is`](./src/utils/is.ts):一些简单的环境判断
12
+ - [`jsonp`](./src/utils/jsonp.ts):发送一个 jsonp 请求
13
+ - [`GET,POST`](./src/utils/request.ts):ajax 请求的简单封装
14
+ - [`Tick`](./src/utils/tick.ts):嘀嗒器,每帧都会执行
15
+ - [`uniqKey`](./src/utils/uniqKey.ts):生成一个全局唯一的 key
16
+ - [`waitUntil`](./src/utils/wait.ts):执行某种检测,直接条件为真或者超时才返回
17
+
18
+ ## 基础组件
19
+
20
+ - [`<Ago>`](./src/Ago/index.tsx):显示多久以前
21
+ - [`<AutoGrid>`](./src/AutoGrid/index.tsx):里面的对象会自动网格排列
22
+ - [`<CarouselNotice>`](./src/CarouselNotice/index.tsx):滚动走马灯
23
+ - [`<Clickable>`](./src/Clickable/index.tsx):一个可点击的对象
24
+ - [`<Container>`](./src/Container/index.tsx):这是一个全局容器,主要设置移动端环境,自适应等逻辑
25
+ - [`<Countdowner>`](./src/Countdowner/index.tsx):倒计时器
26
+ - [`<Row>|<RowStart>|<RowEnd>|<RowBetween>|<RowCenter>|<RowAround>|<RowEvenly>`](./src/Flex/Row.tsx):水平弹性布局
27
+ - [`<Col>|<ColStart>|<ColEnd>|<ColBetween>|<ColCenter>|<ColAround>|<ColEvenly>`](./src/Flex/Col.tsx):垂直弹性布局
28
+ - [`<Indicator>`](./src/Indicator/index.tsx):转动的菊花,用来作为Loading组件的一部分
29
+ - [`<Overlay>`](./src/Overlay/index.tsx):一个全屏覆盖框,会覆盖可操作区域
30
+ - [`<SafeArea>`](./src/SafeArea/index.tsx):这个组件会自动剔除手机的非操作区域
31
+ - [`<ScrollView>`](./src/ScrollView/index.tsx):滚动容器,自带原生滚动条
32
+ - [`showDialog`](./src/Dialog/index.tsx):函数式调用,显示一个弹框组件
33
+ - [`showAlert`](./src/Alert/index.tsx):函数式调用,模拟`window.alert`,但UI可定制
34
+ - [`showToast|showUniqToast`](./src/Toast/index.tsx):函数式调用,显示一个Toast组件
35
+ - [`showLoading|showLoadingAtLeast`](./src/Loading/index.tsx):函数式调用,显示一个Loading组件
@@ -1,7 +1,7 @@
1
1
  import { Keyframes } from "@emotion/serialize";
2
2
  export declare const maskHide: Keyframes;
3
- export declare type DialogType = "center" | "pullUp" | "pullDown" | "pullLeft" | "pullRight";
4
- export declare type AnimationStatus = "show" | "hide";
3
+ export type DialogType = "center" | "pullUp" | "pullDown" | "pullLeft" | "pullRight";
4
+ export type AnimationStatus = "show" | "hide";
5
5
  export declare function getAnimation(type: DialogType, status: AnimationStatus): {
6
6
  keyframes: Keyframes;
7
7
  animation: import("@emotion/utils").SerializedStyles;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import * as CSS from "csstype";
2
+ import * as CSS from 'csstype';
3
3
  export interface FlexProps extends React.HTMLProps<HTMLDivElement> {
4
4
  children?: React.ReactNode;
5
5
  alignItems?: CSS.Property.AlignItems;
@@ -11,9 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
13
  export function Flex(props) {
14
- const { children, alignItems = "center", alignContent, justifyContent, flexFlow, flexWrap, flexDirection } = props, extra = __rest(props, ["children", "alignItems", "alignContent", "justifyContent", "flexFlow", "flexWrap", "flexDirection"]);
14
+ const { children, alignItems = 'center', alignContent, justifyContent, flexFlow, flexWrap, flexDirection } = props, extra = __rest(props, ["children", "alignItems", "alignContent", "justifyContent", "flexFlow", "flexWrap", "flexDirection"]);
15
15
  return (_jsx("div", Object.assign({ css: {
16
- display: "flex",
16
+ display: 'flex',
17
17
  alignItems,
18
18
  alignContent,
19
19
  justifyContent,
package/build/index.d.ts CHANGED
@@ -1,32 +1,32 @@
1
- export { Tick } from "./utils/tick";
2
- export { setContextValue, getContextValue } from "./context";
3
- export { jsonp } from "./utils/jsonp";
4
- export { uniqKey } from "./utils/uniqKey";
5
- export { ago } from "./utils/ago";
6
- export { GET, POST, sendJSON, sugarSend, sendRequest, buildUrlByOption, registerHostAlias } from "./utils/request";
7
- export { calendarTable } from "./utils/calendarTable";
8
- export { Countdown } from "./utils/Countdown";
9
- export { defaultScroll } from "./utils/defaultScroll";
10
- export { is } from "./utils/is";
11
- export { waitFor, waitUntil } from "./utils/wait";
12
- export { normalizeUnit, splitValue } from "./utils/cssUtil";
13
- export { createApp, history, getHistory } from "./utils/createApp";
14
- export { useInterval } from "./Effect/useInterval";
15
- export { useTick } from "./Effect/useTick";
16
- export { Ago } from "./Ago";
17
- export { Container } from "./Container";
18
- export { Flex, FlexItem } from "./Flex";
19
- export { Row, RowAround, RowBetween, RowCenter, RowEnd, RowEvenly, RowStart } from "./Flex/Row";
20
- export { Col, ColAround, ColBetween, ColCenter, ColEnd, ColEvenly, ColStart } from "./Flex/Col";
21
- export { Countdowner } from "./Countdowner";
22
- export { Overlay } from "./Overlay";
23
- export { showToast, showUniqToast } from "./Toast";
24
- export { showDialog } from "./Dialog";
25
- export { Clickable } from "./Clickable";
26
- export { Indicator } from "./Indicator";
27
- export { showLoading, showLoadingAtLeast } from "./Loading";
28
- export { SafeArea } from "./SafeArea";
29
- export { AutoGrid } from "./AutoGrid";
30
- export { showAlert } from "./Alert";
31
- export { ScrollView } from "./ScrollView";
32
- export { CarouselNotice } from "./CarouselNotice";
1
+ export { Tick } from './utils/tick';
2
+ export { setContextValue, getContextValue } from './context';
3
+ export { jsonp } from './utils/jsonp';
4
+ export { uniqKey } from './utils/uniqKey';
5
+ export { ago } from './utils/ago';
6
+ export { GET, POST, sendJSON, sugarSend, sendRequest, buildUrlByOption, registerHostAlias, } from './utils/request';
7
+ export { calendarTable } from './utils/calendarTable';
8
+ export { Countdown } from './utils/Countdown';
9
+ export { defaultScroll } from './utils/defaultScroll';
10
+ export { is } from './utils/is';
11
+ export { waitFor, waitUntil } from './utils/wait';
12
+ export { normalizeUnit, splitValue, adaptive } from './utils/cssUtil';
13
+ export { createApp, history, getHistory } from './utils/createApp';
14
+ export { useInterval } from './Effect/useInterval';
15
+ export { useTick } from './Effect/useTick';
16
+ export { Ago } from './Ago';
17
+ export { Container } from './Container';
18
+ export { Flex, FlexItem } from './Flex';
19
+ export { Row, RowAround, RowBetween, RowCenter, RowEnd, RowEvenly, RowStart, } from './Flex/Row';
20
+ export { Col, ColAround, ColBetween, ColCenter, ColEnd, ColEvenly, ColStart, } from './Flex/Col';
21
+ export { Countdowner } from './Countdowner';
22
+ export { Overlay } from './Overlay';
23
+ export { showToast, showUniqToast } from './Toast';
24
+ export { showDialog } from './Dialog';
25
+ export { Clickable } from './Clickable';
26
+ export { Indicator } from './Indicator';
27
+ export { showLoading, showLoadingAtLeast } from './Loading';
28
+ export { SafeArea } from './SafeArea';
29
+ export { AutoGrid } from './AutoGrid';
30
+ export { showAlert } from './Alert';
31
+ export { ScrollView } from './ScrollView';
32
+ export { CarouselNotice } from './CarouselNotice';
package/build/index.js CHANGED
@@ -1,32 +1,32 @@
1
- export { Tick } from "./utils/tick";
2
- export { setContextValue, getContextValue } from "./context";
3
- export { jsonp } from "./utils/jsonp";
4
- export { uniqKey } from "./utils/uniqKey";
5
- export { ago } from "./utils/ago";
6
- export { GET, POST, sendJSON, sugarSend, sendRequest, buildUrlByOption, registerHostAlias } from "./utils/request";
7
- export { calendarTable } from "./utils/calendarTable";
8
- export { Countdown } from "./utils/Countdown";
9
- export { defaultScroll } from "./utils/defaultScroll";
10
- export { is } from "./utils/is";
11
- export { waitFor, waitUntil } from "./utils/wait";
12
- export { normalizeUnit, splitValue } from "./utils/cssUtil";
13
- export { createApp, history, getHistory } from "./utils/createApp";
14
- export { useInterval } from "./Effect/useInterval";
15
- export { useTick } from "./Effect/useTick";
16
- export { Ago } from "./Ago";
17
- export { Container } from "./Container";
18
- export { Flex, FlexItem } from "./Flex";
19
- export { Row, RowAround, RowBetween, RowCenter, RowEnd, RowEvenly, RowStart } from "./Flex/Row";
20
- export { Col, ColAround, ColBetween, ColCenter, ColEnd, ColEvenly, ColStart } from "./Flex/Col";
21
- export { Countdowner } from "./Countdowner";
22
- export { Overlay } from "./Overlay";
23
- export { showToast, showUniqToast } from "./Toast";
24
- export { showDialog } from "./Dialog";
25
- export { Clickable } from "./Clickable";
26
- export { Indicator } from "./Indicator";
27
- export { showLoading, showLoadingAtLeast } from "./Loading";
28
- export { SafeArea } from "./SafeArea";
29
- export { AutoGrid } from "./AutoGrid";
30
- export { showAlert } from "./Alert";
31
- export { ScrollView } from "./ScrollView";
32
- export { CarouselNotice } from "./CarouselNotice";
1
+ export { Tick } from './utils/tick';
2
+ export { setContextValue, getContextValue } from './context';
3
+ export { jsonp } from './utils/jsonp';
4
+ export { uniqKey } from './utils/uniqKey';
5
+ export { ago } from './utils/ago';
6
+ export { GET, POST, sendJSON, sugarSend, sendRequest, buildUrlByOption, registerHostAlias, } from './utils/request';
7
+ export { calendarTable } from './utils/calendarTable';
8
+ export { Countdown } from './utils/Countdown';
9
+ export { defaultScroll } from './utils/defaultScroll';
10
+ export { is } from './utils/is';
11
+ export { waitFor, waitUntil } from './utils/wait';
12
+ export { normalizeUnit, splitValue, adaptive } from './utils/cssUtil';
13
+ export { createApp, history, getHistory } from './utils/createApp';
14
+ export { useInterval } from './Effect/useInterval';
15
+ export { useTick } from './Effect/useTick';
16
+ export { Ago } from './Ago';
17
+ export { Container } from './Container';
18
+ export { Flex, FlexItem } from './Flex';
19
+ export { Row, RowAround, RowBetween, RowCenter, RowEnd, RowEvenly, RowStart, } from './Flex/Row';
20
+ export { Col, ColAround, ColBetween, ColCenter, ColEnd, ColEvenly, ColStart, } from './Flex/Col';
21
+ export { Countdowner } from './Countdowner';
22
+ export { Overlay } from './Overlay';
23
+ export { showToast, showUniqToast } from './Toast';
24
+ export { showDialog } from './Dialog';
25
+ export { Clickable } from './Clickable';
26
+ export { Indicator } from './Indicator';
27
+ export { showLoading, showLoadingAtLeast } from './Loading';
28
+ export { SafeArea } from './SafeArea';
29
+ export { AutoGrid } from './AutoGrid';
30
+ export { showAlert } from './Alert';
31
+ export { ScrollView } from './ScrollView';
32
+ export { CarouselNotice } from './CarouselNotice';
@@ -1,8 +1,8 @@
1
- export declare type CountdownValueIndex = "d" | "h" | "i" | "s";
2
- export declare type CountdownValue = {
1
+ export type CountdownValueIndex = "d" | "h" | "i" | "s";
2
+ export type CountdownValue = {
3
3
  [key in CountdownValueIndex]?: number;
4
4
  };
5
- export declare type UpdateCallback = (value: CountdownValue) => void;
5
+ export type UpdateCallback = (value: CountdownValue) => void;
6
6
  export interface CountdownOption {
7
7
  remain?: number | string;
8
8
  onUpdate?: UpdateCallback;
@@ -1,5 +1,5 @@
1
1
  import dayjs from 'dayjs';
2
- export declare type AgoValue = {
2
+ export type AgoValue = {
3
3
  num: number;
4
4
  unit: 'y' | 'm' | 'd' | 'h' | 'i' | 's';
5
5
  format: string;
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  import { History } from 'history';
3
3
  import { ContainerProps } from '../Container';
4
4
  import { ContextValue } from '../context';
5
- export declare type RouteMethod = 'browser' | 'hash' | 'memory';
6
- export declare type AwaitValue<T> = T | Promise<T>;
5
+ export type RouteMethod = 'browser' | 'hash' | 'memory';
6
+ export type AwaitValue<T> = T | Promise<T>;
7
7
  export interface CreateAppOption extends Omit<ContainerProps, 'children'>, ContextValue {
8
8
  onBeforeRenderPage?: (pathname?: string) => AwaitValue<void>;
9
9
  onAfterRenderPage?: (pathname?: string) => AwaitValue<void>;
10
- renderLoading?: (pathname?: string) => AwaitValue<React.ReactNode>;
10
+ onLoadingPage?: (pathname?: string) => AwaitValue<React.ReactNode>;
11
11
  renderPage?: (pathname?: string) => AwaitValue<React.ReactNode>;
12
12
  routeMethod?: RouteMethod;
13
13
  defaultRoute?: string;
@@ -51,7 +51,7 @@ export function createApp(option) {
51
51
  'designWidth',
52
52
  'globalStyle',
53
53
  ]);
54
- const { onBeforeRenderPage, onAfterRenderPage, renderLoading, renderPage } = option;
54
+ const { onBeforeRenderPage, onAfterRenderPage, onLoadingPage, renderPage } = option;
55
55
  // 设置上下文属性
56
56
  setContextValue(context);
57
57
  /**
@@ -70,8 +70,8 @@ export function createApp(option) {
70
70
  pathname = option.defaultRoute.replace(pathReg, '');
71
71
  }
72
72
  // 如果有loading,要先显示loading
73
- if (typeof renderLoading === 'function') {
74
- setPage(yield (renderLoading === null || renderLoading === void 0 ? void 0 : renderLoading(pathname)));
73
+ if (typeof onLoadingPage === 'function') {
74
+ setPage(yield (onLoadingPage === null || onLoadingPage === void 0 ? void 0 : onLoadingPage(pathname)));
75
75
  }
76
76
  // 加载页面之前可能会存在的逻辑
77
77
  yield (onBeforeRenderPage === null || onBeforeRenderPage === void 0 ? void 0 : onBeforeRenderPage(pathname));
@@ -7,8 +7,8 @@
7
7
  * params: 请求体为URLSearchParams,data为JSON对象或URLSearchParams
8
8
  * buffer: 请求体data只能为ArrayBuffer、TypeArray、DataView
9
9
  */
10
- export declare type SendType = "normal" | "text" | "form" | "json" | "blob" | "params" | "buffer";
11
- export declare type SendDataType = BodyInit | Record<string, any>;
10
+ export type SendType = "normal" | "text" | "form" | "json" | "blob" | "params" | "buffer";
11
+ export type SendDataType = BodyInit | Record<string, any>;
12
12
  /**
13
13
  * 请求对象参数
14
14
  */
@@ -20,8 +20,8 @@ export interface RequestOption extends RequestInit {
20
20
  transmitPageParam?: boolean;
21
21
  timeout?: number;
22
22
  }
23
- export declare type BuildUrlOption = Pick<RequestOption, "url" | "data" | "disableUrlCache" | "transmitPageParam" | "sendType">;
24
- export declare type StandardAjaxResult = {
23
+ export type BuildUrlOption = Pick<RequestOption, "url" | "data" | "disableUrlCache" | "transmitPageParam" | "sendType">;
24
+ export type StandardAjaxResult = {
25
25
  code: number;
26
26
  message?: string;
27
27
  data?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clxx",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "Basic JS library for mobile devices",
5
5
  "main": "./build/index.js",
6
6
  "module": "./build/index.js",
@@ -9,7 +9,8 @@
9
9
  },
10
10
  "scripts": {
11
11
  "start": "tsc -w --pretty",
12
- "build": "rm -rfv ./build && tsc"
12
+ "build": "rm -rfv ./build && tsc",
13
+ "pub": "npm run build && npm publish"
13
14
  },
14
15
  "repository": {
15
16
  "type": "git",
@@ -33,20 +34,18 @@
33
34
  "access": "public"
34
35
  },
35
36
  "dependencies": {
36
- "@emotion/react": "^11.10.0",
37
+ "@emotion/react": "^11.10.6",
37
38
  "dayjs": "^1.11.5",
38
39
  "history": "^5.3.0",
39
40
  "lodash": "^4.17.21",
40
41
  "react": "^18.2.0",
41
- "react-dom": "^18.2.0",
42
- "swiper": "^8.3.2"
42
+ "react-dom": "^18.2.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/lodash": "^4.14.182",
46
- "@types/react": "^18.0.17",
47
- "@types/react-dom": "^18.0.6",
48
- "@types/swiper": "^6.0.0",
46
+ "@types/react": "^18.0.37",
47
+ "@types/react-dom": "^18.0.11",
49
48
  "csstype": "^3.1.0",
50
- "typescript": "^4.7.4"
49
+ "typescript": "^4.9.5"
51
50
  }
52
51
  }