fluekit 1.0.0 → 1.1.0
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 +84 -36
- package/dist/Align.d.ts +3 -3
- package/dist/Alignment.d.ts +38 -0
- package/dist/AnimatedContainer.d.ts +5 -5
- package/dist/AnimatedOpacity.d.ts +29 -21
- package/dist/Border.d.ts +35 -4
- package/dist/BorderRadius.d.ts +37 -5
- package/dist/BoxConstraints.d.ts +26 -3
- package/dist/BoxDecoration.d.ts +36 -37
- package/dist/BoxShadow.d.ts +28 -0
- package/dist/Container.d.ts +5 -5
- package/dist/EdgeInsets.d.ts +40 -12
- package/dist/Expanded.d.ts +2 -2
- package/dist/Fixed.d.ts +1 -1
- package/dist/FlexBox.d.ts +1 -1
- package/dist/FlexItem.d.ts +3 -3
- package/dist/FlexProps.d.ts +4 -83
- package/dist/Gradient.d.ts +26 -0
- package/dist/GridView.d.ts +4 -4
- package/dist/IgnorePointer.d.ts +3 -1
- package/dist/ListView.d.ts +1 -1
- package/dist/Opacity.d.ts +19 -19
- package/dist/Size.d.ts +13 -5
- package/dist/SizedBox.d.ts +2 -2
- package/dist/Stack.d.ts +6 -4
- package/dist/Sticky.d.ts +1 -1
- package/dist/StyleProvider.d.ts +26 -0
- package/dist/TextStyle.d.ts +16 -7
- package/dist/Transform.d.ts +3 -3
- package/dist/Wrap.d.ts +4 -4
- package/dist/__tests__/IgnorePointerGesture.spec.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +482 -298
- package/dist/useGesture.d.ts +2 -0
- package/dist/usePosition.d.ts +7 -7
- package/dist/utils.d.ts +11 -0
- package/package.json +6 -6
- package/dist/useOpacity.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
# FlueKit
|
|
2
2
|
|
|
3
|
-
**FlueKit**
|
|
3
|
+
**FlueKit** is a Vue 3 component library that brings **Flutter's layout paradigm** to the web. It allows you to build complex, responsive user interfaces using declarative, composable widgets instead of struggling with CSS layout quirks.
|
|
4
4
|
|
|
5
|
-
## Features
|
|
5
|
+
## ✨ Features
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **Animations**: `AnimatedContainer`, `AnimatedOpacity`
|
|
7
|
+
- **Flutter-like API**: Familiar widget names and properties (`Row`, `Column`, `Stack`, `Container`, `Expanded`, etc.).
|
|
8
|
+
- **Responsive by Default**: Built-in `px` to `vw` conversion system for mobile-first development.
|
|
9
|
+
- **Type Safe**: Written in TypeScript with full type definitions.
|
|
10
|
+
- **Composable**: Build UIs by nesting components, just like in Flutter.
|
|
11
|
+
- **Zero-CSS Layouts**: Handle alignment, padding, margin, and positioning purely through props.
|
|
13
12
|
|
|
14
|
-
## Installation
|
|
13
|
+
## 📦 Installation
|
|
15
14
|
|
|
16
15
|
```bash
|
|
17
16
|
npm install fluekit
|
|
@@ -21,43 +20,92 @@ pnpm add fluekit
|
|
|
21
20
|
yarn add fluekit
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
##
|
|
23
|
+
## 🚀 Usage
|
|
24
|
+
|
|
25
|
+
### Basic Example
|
|
25
26
|
|
|
26
27
|
```vue
|
|
27
28
|
<script setup>
|
|
28
|
-
import { Container,
|
|
29
|
+
import { Container, Column, Row, Text, SizedBox, Alignment, MainAxisAlignment } from "fluekit";
|
|
29
30
|
</script>
|
|
30
31
|
|
|
31
32
|
<template>
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
<Container alignment="center" color="#f5f5f5" :height="400">
|
|
34
|
+
<Column :mainAxisAlignment="MainAxisAlignment.center">
|
|
35
|
+
<!-- Avatar -->
|
|
36
|
+
<Container
|
|
37
|
+
:width="80"
|
|
38
|
+
:height="80"
|
|
39
|
+
:decoration="{
|
|
40
|
+
color: 'blue',
|
|
41
|
+
borderRadius: { all: 40 },
|
|
42
|
+
boxShadow: [{ color: '#00000033', blurRadius: 10, offset: { x: 0, y: 5 } }],
|
|
43
|
+
}"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<SizedBox :height="20" />
|
|
47
|
+
|
|
48
|
+
<!-- Text Content -->
|
|
49
|
+
<Text :style="{ fontSize: 24, fontWeight: 'bold' }"> Hello FlueKit </Text>
|
|
50
|
+
|
|
51
|
+
<SizedBox :height="8" />
|
|
52
|
+
|
|
53
|
+
<Text :style="{ color: '#666' }"> Flutter-style layouts in Vue 3 </Text>
|
|
54
|
+
</Column>
|
|
55
|
+
</Container>
|
|
54
56
|
</template>
|
|
55
57
|
```
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
### Responsive Design (px to vw)
|
|
60
|
+
|
|
61
|
+
FlueKit automatically converts number values (e.g., `:width="100"`) to `vw` units based on a default design width of **750px**.
|
|
62
|
+
|
|
63
|
+
To change the design width (e.g., to 375px):
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { setDefaultVW } from "fluekit";
|
|
67
|
+
|
|
68
|
+
// Call this in your main.ts or App.vue setup
|
|
69
|
+
setDefaultVW(375);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
To disable automatic conversion:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { setTransform } from "fluekit";
|
|
76
|
+
|
|
77
|
+
setTransform(false); // Numbers will be treated as px
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 🧩 Component Overview
|
|
81
|
+
|
|
82
|
+
### Layout Widgets
|
|
83
|
+
|
|
84
|
+
- **Container**: A convenience widget that combines common painting, positioning, and sizing.
|
|
85
|
+
- **Row / Column**: Flexbox layouts for horizontal and vertical arrays.
|
|
86
|
+
- **Stack / Positioned**: Overlapping layouts.
|
|
87
|
+
- **Expanded**: Expands a child of a Row or Column to fill available space.
|
|
88
|
+
- **SizedBox**: A box with a specified size.
|
|
89
|
+
- **Center / Align**: Alignment widgets.
|
|
90
|
+
- **Wrap**: A widget that displays its children in multiple horizontal or vertical runs.
|
|
91
|
+
|
|
92
|
+
### Scrolling
|
|
93
|
+
|
|
94
|
+
- **ListView**: A scrollable list of widgets.
|
|
95
|
+
- **GridView**: A scrollable, 2D array of widgets.
|
|
96
|
+
- **ScrollView**: A box in which a single widget can be scrolled.
|
|
97
|
+
|
|
98
|
+
### Painting & Effects
|
|
99
|
+
|
|
100
|
+
- **Opacity / AnimatedOpacity**: Makes its child partially transparent.
|
|
101
|
+
- **Transform**: Applies a transformation before painting its child.
|
|
102
|
+
- **Decorations**: Rich styling support via `BoxDecoration` (borders, shadows, gradients, images).
|
|
103
|
+
|
|
104
|
+
### Interactions
|
|
58
105
|
|
|
59
|
-
|
|
106
|
+
- **GestureDetector**: Detects gestures (tap, double tap, pan, long press).
|
|
107
|
+
- **IgnorePointer**: Invisible widget that controls hit-testing.
|
|
60
108
|
|
|
61
|
-
## License
|
|
109
|
+
## 📄 License
|
|
62
110
|
|
|
63
111
|
MIT
|
package/dist/Align.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Alignment } from './Alignment';
|
|
2
2
|
interface Props {
|
|
3
|
-
alignment?:
|
|
3
|
+
alignment?: Alignment;
|
|
4
4
|
widthFactor?: number;
|
|
5
5
|
heightFactor?: number;
|
|
6
6
|
}
|
|
@@ -14,7 +14,7 @@ declare function __VLS_template(): {
|
|
|
14
14
|
};
|
|
15
15
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
16
16
|
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
17
|
-
alignment:
|
|
17
|
+
alignment: Alignment;
|
|
18
18
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
19
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
20
20
|
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CSSProperties } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Alignment Geometry
|
|
4
|
+
* 对应 Flutter 的 Alignment 常量
|
|
5
|
+
*/
|
|
6
|
+
export declare const Alignment: {
|
|
7
|
+
readonly topLeft: "topLeft";
|
|
8
|
+
readonly topCenter: "topCenter";
|
|
9
|
+
readonly topRight: "topRight";
|
|
10
|
+
readonly centerLeft: "centerLeft";
|
|
11
|
+
readonly center: "center";
|
|
12
|
+
readonly centerRight: "centerRight";
|
|
13
|
+
readonly bottomLeft: "bottomLeft";
|
|
14
|
+
readonly bottomCenter: "bottomCenter";
|
|
15
|
+
readonly bottomRight: "bottomRight";
|
|
16
|
+
};
|
|
17
|
+
export type Alignment = keyof typeof Alignment | string;
|
|
18
|
+
/**
|
|
19
|
+
* 将 Alignment 转换为 Flexbox 样式
|
|
20
|
+
* @param alignment
|
|
21
|
+
* @param direction "row" (default) or "column"
|
|
22
|
+
*/
|
|
23
|
+
export declare function alignmentToFlex(alignment: Alignment, direction?: "row" | "column"): CSSProperties;
|
|
24
|
+
export declare const alignmentToStyle: typeof alignmentToFlex;
|
|
25
|
+
/**
|
|
26
|
+
* 将 Alignment 转换为 CSS background-position / object-position 字符串
|
|
27
|
+
* e.g. "left top", "center", "right bottom"
|
|
28
|
+
*/
|
|
29
|
+
export declare function alignmentToCssPosition(alignment: Alignment): string;
|
|
30
|
+
/**
|
|
31
|
+
* 将 Alignment 转换为 CSS transform-origin
|
|
32
|
+
*/
|
|
33
|
+
export declare function alignmentToOrigin(alignment: Alignment): string;
|
|
34
|
+
/**
|
|
35
|
+
* 将 Alignment 转换为 Grid Alignment (justify-items / align-items)
|
|
36
|
+
* 用于 Stack
|
|
37
|
+
*/
|
|
38
|
+
export declare function alignmentToGrid(alignment: Alignment): CSSProperties;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { BoxConstraints } from './BoxConstraints';
|
|
2
2
|
import { BoxDecoration } from './BoxDecoration';
|
|
3
3
|
import { EdgeInsets } from './EdgeInsets';
|
|
4
|
-
import {
|
|
4
|
+
import { Alignment } from './FlexProps';
|
|
5
5
|
interface Props {
|
|
6
|
-
width?: number
|
|
7
|
-
height?: number
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
8
|
padding?: EdgeInsets;
|
|
9
9
|
margin?: EdgeInsets;
|
|
10
10
|
decoration?: BoxDecoration;
|
|
11
11
|
foregroundDecoration?: BoxDecoration;
|
|
12
12
|
color?: string;
|
|
13
|
-
alignment?:
|
|
13
|
+
alignment?: Alignment | string;
|
|
14
14
|
clipBehavior?: "none" | "hardEdge" | "antiAlias" | string;
|
|
15
15
|
transform?: string;
|
|
16
|
-
transformAlignment?:
|
|
16
|
+
transformAlignment?: Alignment | string;
|
|
17
17
|
constraints?: BoxConstraints;
|
|
18
18
|
duration?: number;
|
|
19
19
|
curve?: string;
|
|
@@ -1,25 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
opacity:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
declare function __VLS_template(): {
|
|
7
|
-
attrs: Partial<{}>;
|
|
8
|
-
slots: {
|
|
9
|
-
default?(_: {}): any;
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
opacity: {
|
|
3
|
+
type: NumberConstructor;
|
|
4
|
+
required: true;
|
|
10
5
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
duration: {
|
|
7
|
+
type: NumberConstructor;
|
|
8
|
+
default: number;
|
|
9
|
+
};
|
|
10
|
+
curve: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
17
|
+
opacity: {
|
|
18
|
+
type: NumberConstructor;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
duration: {
|
|
22
|
+
type: NumberConstructor;
|
|
23
|
+
default: number;
|
|
24
|
+
};
|
|
25
|
+
curve: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
29
|
+
}>> & Readonly<{}>, {
|
|
16
30
|
duration: number;
|
|
17
31
|
curve: string;
|
|
18
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions,
|
|
19
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
32
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
20
33
|
export default _default;
|
|
21
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
22
|
-
new (): {
|
|
23
|
-
$slots: S;
|
|
24
|
-
};
|
|
25
|
-
};
|
package/dist/Border.d.ts
CHANGED
|
@@ -1,16 +1,47 @@
|
|
|
1
1
|
import { CSSProperties } from 'vue';
|
|
2
2
|
export type BorderStyleType = "none" | "solid" | "dashed" | "dotted" | "double";
|
|
3
|
+
declare const BORDER_SIDE_SYMBOL: unique symbol;
|
|
4
|
+
declare const BORDERS_SYMBOL: unique symbol;
|
|
3
5
|
export type BorderSide = {
|
|
4
|
-
width?: number
|
|
6
|
+
width?: number;
|
|
5
7
|
color?: string;
|
|
6
8
|
style?: BorderStyleType;
|
|
9
|
+
[BORDER_SIDE_SYMBOL]?: true;
|
|
7
10
|
};
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
export interface Borders {
|
|
12
|
+
left?: BorderSide;
|
|
13
|
+
top?: BorderSide;
|
|
14
|
+
right?: BorderSide;
|
|
15
|
+
bottom?: BorderSide;
|
|
16
|
+
[BORDERS_SYMBOL]?: true;
|
|
17
|
+
}
|
|
18
|
+
export declare function Border(side: Omit<BorderSide, typeof BORDER_SIDE_SYMBOL>): BorderSide;
|
|
19
|
+
export declare namespace Border {
|
|
20
|
+
var all: ({ color, width, style, }?: {
|
|
21
|
+
color?: string;
|
|
22
|
+
width?: number;
|
|
23
|
+
style?: BorderStyleType;
|
|
24
|
+
}) => {
|
|
25
|
+
top: BorderSide;
|
|
26
|
+
bottom: BorderSide;
|
|
27
|
+
left: BorderSide;
|
|
28
|
+
right: BorderSide;
|
|
29
|
+
[BORDERS_SYMBOL]: true;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 类型守卫:检查对象是否通过 Border 构造函数创建(单个边框边)
|
|
34
|
+
*/
|
|
35
|
+
export declare function isBorderSide(value: any): value is BorderSide;
|
|
36
|
+
/**
|
|
37
|
+
* 类型守卫:检查对象是否通过 Border.all 创建(完整边框)
|
|
38
|
+
*/
|
|
39
|
+
export declare function isBorders(value: any): value is Borders;
|
|
40
|
+
export interface Borders {
|
|
11
41
|
left?: BorderSide;
|
|
12
42
|
top?: BorderSide;
|
|
13
43
|
right?: BorderSide;
|
|
14
44
|
bottom?: BorderSide;
|
|
15
45
|
}
|
|
16
46
|
export declare function borderToStyle(border: Borders): CSSProperties;
|
|
47
|
+
export {};
|
package/dist/BorderRadius.d.ts
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
1
|
import { CSSProperties } from 'vue';
|
|
2
|
-
export type BorderRadiusValue = number
|
|
3
|
-
export
|
|
2
|
+
export type BorderRadiusValue = number;
|
|
3
|
+
export interface BorderRadiusProps {
|
|
4
4
|
topLeft?: BorderRadiusValue;
|
|
5
5
|
bottom?: BorderRadiusValue;
|
|
6
6
|
topRight?: BorderRadiusValue;
|
|
7
7
|
bottomLeft?: BorderRadiusValue;
|
|
8
8
|
bottomRight?: BorderRadiusValue;
|
|
9
|
-
|
|
9
|
+
}
|
|
10
|
+
declare const BORDER_RADIUS_SYMBOL: unique symbol;
|
|
11
|
+
export type BorderRadius = BorderRadiusProps & {
|
|
12
|
+
[BORDER_RADIUS_SYMBOL]?: true;
|
|
10
13
|
};
|
|
11
|
-
export
|
|
12
|
-
export declare function
|
|
14
|
+
export type BorderRadiusType = BorderRadius;
|
|
15
|
+
export declare function BorderRadius(borderRadius: BorderRadiusProps): BorderRadius;
|
|
16
|
+
export declare namespace BorderRadius {
|
|
17
|
+
var all: (radius: BorderRadiusValue) => {
|
|
18
|
+
topLeft: number;
|
|
19
|
+
topRight: number;
|
|
20
|
+
bottomLeft: number;
|
|
21
|
+
bottomRight: number;
|
|
22
|
+
[BORDER_RADIUS_SYMBOL]: true;
|
|
23
|
+
};
|
|
24
|
+
var circular: (radius: BorderRadiusValue) => {
|
|
25
|
+
topLeft: number;
|
|
26
|
+
topRight: number;
|
|
27
|
+
bottomLeft: number;
|
|
28
|
+
bottomRight: number;
|
|
29
|
+
[BORDER_RADIUS_SYMBOL]: true;
|
|
30
|
+
};
|
|
31
|
+
var only: ({ topLeft, topRight, bottomLeft, bottomRight, }: {
|
|
32
|
+
topLeft?: BorderRadiusValue;
|
|
33
|
+
topRight?: BorderRadiusValue;
|
|
34
|
+
bottomLeft?: BorderRadiusValue;
|
|
35
|
+
bottomRight?: BorderRadiusValue;
|
|
36
|
+
}) => BorderRadius;
|
|
37
|
+
var zero: BorderRadius;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 类型守卫:检查对象是否通过 BorderRadius 构造函数创建
|
|
41
|
+
*/
|
|
42
|
+
export declare function isBorderRadius(value: any): value is BorderRadius;
|
|
43
|
+
export declare function borderRadiusToStyle(props?: BorderRadiusProps): CSSProperties;
|
|
44
|
+
export {};
|
package/dist/BoxConstraints.d.ts
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import { CSSProperties } from 'vue';
|
|
2
|
-
|
|
2
|
+
declare const BOX_CONSTRAINTS_SYMBOL: unique symbol;
|
|
3
|
+
export interface BoxConstraintsProps {
|
|
3
4
|
minWidth?: number;
|
|
4
5
|
maxWidth?: number;
|
|
5
6
|
minHeight?: number;
|
|
6
7
|
maxHeight?: number;
|
|
7
8
|
}
|
|
8
|
-
export
|
|
9
|
-
|
|
9
|
+
export type BoxConstraints = BoxConstraintsProps & {
|
|
10
|
+
[BOX_CONSTRAINTS_SYMBOL]?: true;
|
|
11
|
+
};
|
|
12
|
+
export declare function BoxConstraints(props?: BoxConstraintsProps): BoxConstraints;
|
|
13
|
+
export declare namespace BoxConstraints {
|
|
14
|
+
var tight: (size: {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}) => BoxConstraints;
|
|
18
|
+
var loose: (size: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}) => BoxConstraints;
|
|
22
|
+
var expand: ({ width, height, }?: {
|
|
23
|
+
width?: number;
|
|
24
|
+
height?: number;
|
|
25
|
+
}) => BoxConstraints;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 类型守卫:检查对象是否通过 BoxConstraints 创建
|
|
29
|
+
*/
|
|
30
|
+
export declare function isBoxConstraints(value: any): value is BoxConstraints;
|
|
31
|
+
export declare function boxConstraintsToStyle(constraints?: BoxConstraintsProps): CSSProperties;
|
|
32
|
+
export {};
|
package/dist/BoxDecoration.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { BorderRadiusType } from './BorderRadius';
|
|
2
1
|
import { CSSProperties } from 'vue';
|
|
2
|
+
import { Alignment } from './Alignment';
|
|
3
3
|
import { Borders } from './Border';
|
|
4
|
+
import { BorderRadius } from './BorderRadius';
|
|
5
|
+
import { BoxShadowProps } from './BoxShadow';
|
|
6
|
+
export * from './Gradient';
|
|
4
7
|
type Valueof<T> = T[keyof T];
|
|
5
8
|
export type BoxFit = Valueof<typeof BoxFit>;
|
|
6
9
|
export declare const BoxFit: {
|
|
@@ -13,31 +16,29 @@ export declare const BoxFit: {
|
|
|
13
16
|
readonly scaleDown: "scaleDown";
|
|
14
17
|
};
|
|
15
18
|
export type ImageRepeat = "repeat" | "repeat-x" | "repeat-y" | "no-repeat";
|
|
16
|
-
export type BorderRadiusValue = number | string;
|
|
17
|
-
export type BorderRadius = BorderRadiusType;
|
|
18
19
|
export type Overflow = "none" | "visible" | "hidden" | "scroll" | "auto";
|
|
19
|
-
export type BoxAlignment =
|
|
20
|
+
export type BoxAlignment = Alignment;
|
|
20
21
|
export declare const BoxAlignment: {
|
|
22
|
+
readonly topLeft: "topLeft";
|
|
23
|
+
readonly topCenter: "topCenter";
|
|
24
|
+
readonly topRight: "topRight";
|
|
25
|
+
readonly centerLeft: "centerLeft";
|
|
21
26
|
readonly center: "center";
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
24
|
-
readonly
|
|
25
|
-
readonly
|
|
26
|
-
readonly topLeft: "left top";
|
|
27
|
-
readonly topCenter: "center top";
|
|
28
|
-
readonly topRight: "right top";
|
|
29
|
-
readonly centerLeft: "left center";
|
|
30
|
-
readonly centerRight: "right center";
|
|
31
|
-
readonly bottomLeft: "left bottom";
|
|
32
|
-
readonly bottomCenter: "center bottom";
|
|
33
|
-
readonly bottomRight: "right bottom";
|
|
27
|
+
readonly centerRight: "centerRight";
|
|
28
|
+
readonly bottomLeft: "bottomLeft";
|
|
29
|
+
readonly bottomCenter: "bottomCenter";
|
|
30
|
+
readonly bottomRight: "bottomRight";
|
|
34
31
|
};
|
|
32
|
+
export declare enum BoxShape {
|
|
33
|
+
rectangle = "rectangle",
|
|
34
|
+
circle = "circle"
|
|
35
|
+
}
|
|
35
36
|
export declare function setBaseUrl(url: string): void;
|
|
36
37
|
export declare function normalizeSrc(src: string): string;
|
|
37
38
|
export type ImageProvider = string;
|
|
38
39
|
export declare const NetworkImage: (url: string) => string;
|
|
39
40
|
export declare const AssetImage: (url: string) => string;
|
|
40
|
-
export interface
|
|
41
|
+
export interface DecorationImageProps {
|
|
41
42
|
image: ImageProvider;
|
|
42
43
|
fit?: BoxFit;
|
|
43
44
|
alignment?: BoxAlignment;
|
|
@@ -47,34 +48,33 @@ export interface DecorationImage {
|
|
|
47
48
|
clip?: string;
|
|
48
49
|
origin?: string;
|
|
49
50
|
}
|
|
50
|
-
export
|
|
51
|
+
export type DecorationImage = DecorationImageProps;
|
|
52
|
+
export declare function DecorationImage(props: DecorationImageProps): DecorationImageProps;
|
|
51
53
|
/**
|
|
52
54
|
* BoxDecoration接口定义
|
|
53
55
|
*/
|
|
54
|
-
|
|
56
|
+
declare const BOX_DECORATION_SYMBOL: unique symbol;
|
|
57
|
+
export type BoxDecorationProps = {
|
|
55
58
|
color?: string;
|
|
56
59
|
border?: Borders;
|
|
57
60
|
borderRadius?: BorderRadius;
|
|
58
|
-
boxShadow?:
|
|
61
|
+
boxShadow?: BoxShadowProps | BoxShadowProps[];
|
|
59
62
|
gradient?: string;
|
|
60
|
-
image?:
|
|
63
|
+
image?: DecorationImageProps;
|
|
61
64
|
overflow?: Overflow;
|
|
62
|
-
opacity?: number
|
|
65
|
+
opacity?: number;
|
|
66
|
+
shape?: BoxShape;
|
|
63
67
|
};
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export declare function decorationImageToStyle(di: DecorationImage): CSSProperties;
|
|
75
|
-
export declare function boxDecorationToStyle(decoration?: BoxDecoration): CSSProperties;
|
|
76
|
-
export declare function BoxDecoration(props?: BoxDecoration): BoxDecoration;
|
|
77
|
-
export declare function LinearGradient(direction: string, ...colors: string[]): string;
|
|
68
|
+
export type BoxDecoration = BoxDecorationProps & {
|
|
69
|
+
[BOX_DECORATION_SYMBOL]?: true;
|
|
70
|
+
};
|
|
71
|
+
export declare function decorationImageToStyle(di: DecorationImageProps): CSSProperties;
|
|
72
|
+
export declare function boxDecorationToStyle(decoration?: BoxDecorationProps): CSSProperties;
|
|
73
|
+
export declare function BoxDecoration(props?: BoxDecorationProps): BoxDecoration;
|
|
74
|
+
/**
|
|
75
|
+
* 类型守卫:检查对象是否通过 BoxDecoration 构造函数创建
|
|
76
|
+
*/
|
|
77
|
+
export declare function isBoxDecoration(value: any): value is BoxDecoration;
|
|
78
78
|
/**
|
|
79
79
|
* Clip
|
|
80
80
|
* 对应 Flutter 的 Clip
|
|
@@ -86,4 +86,3 @@ export declare const Clip: {
|
|
|
86
86
|
readonly antiAliasWithSaveLayer: "antiAliasWithSaveLayer";
|
|
87
87
|
};
|
|
88
88
|
export type Clip = keyof typeof Clip;
|
|
89
|
-
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface Offset {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export declare enum BlurStyle {
|
|
6
|
+
normal = "normal",
|
|
7
|
+
solid = "solid",
|
|
8
|
+
outer = "outer",
|
|
9
|
+
inner = "inner"
|
|
10
|
+
}
|
|
11
|
+
export interface BoxShadowProps {
|
|
12
|
+
color?: string;
|
|
13
|
+
offset?: Offset;
|
|
14
|
+
blurRadius?: number;
|
|
15
|
+
spreadRadius?: number;
|
|
16
|
+
blurStyle?: BlurStyle;
|
|
17
|
+
}
|
|
18
|
+
declare const BOX_SHADOW_SYMBOL: unique symbol;
|
|
19
|
+
export type BoxShadow = BoxShadowProps & {
|
|
20
|
+
[BOX_SHADOW_SYMBOL]?: true;
|
|
21
|
+
};
|
|
22
|
+
export declare function BoxShadow(props?: BoxShadowProps): BoxShadow;
|
|
23
|
+
/**
|
|
24
|
+
* 类型守卫:检查对象是否通过 BoxShadow 构造函数创建
|
|
25
|
+
*/
|
|
26
|
+
export declare function isBoxShadow(value: any): value is BoxShadow;
|
|
27
|
+
export declare function boxShadowToCSS(shadow: BoxShadowProps): string;
|
|
28
|
+
export {};
|
package/dist/Container.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { BoxConstraints } from './BoxConstraints';
|
|
2
|
+
import { Alignment } from './Alignment';
|
|
2
3
|
import { BoxDecoration } from './BoxDecoration';
|
|
3
4
|
import { EdgeInsets } from './EdgeInsets';
|
|
4
|
-
import { FlexAlignment } from './FlexProps';
|
|
5
5
|
interface Props {
|
|
6
|
-
width?: number
|
|
7
|
-
height?: number
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
8
|
padding?: EdgeInsets;
|
|
9
9
|
margin?: EdgeInsets;
|
|
10
10
|
decoration?: BoxDecoration;
|
|
11
11
|
foregroundDecoration?: BoxDecoration;
|
|
12
12
|
color?: string;
|
|
13
|
-
alignment?:
|
|
13
|
+
alignment?: Alignment;
|
|
14
14
|
clipBehavior?: "none" | "hardEdge" | "antiAlias" | string;
|
|
15
15
|
transform?: string;
|
|
16
|
-
transformAlignment?:
|
|
16
|
+
transformAlignment?: Alignment;
|
|
17
17
|
constraints?: BoxConstraints;
|
|
18
18
|
}
|
|
19
19
|
declare function __VLS_template(): {
|
package/dist/EdgeInsets.d.ts
CHANGED
|
@@ -1,19 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
horizontal?: number
|
|
8
|
-
vertical?: number
|
|
1
|
+
declare const EDGE_INSETS_SYMBOL: unique symbol;
|
|
2
|
+
export interface EdgeInsetsProps {
|
|
3
|
+
top?: number;
|
|
4
|
+
right?: number;
|
|
5
|
+
bottom?: number;
|
|
6
|
+
left?: number;
|
|
7
|
+
horizontal?: number;
|
|
8
|
+
vertical?: number;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
10
|
+
export type EdgeInsets = EdgeInsetsProps & {
|
|
11
|
+
[EDGE_INSETS_SYMBOL]?: true;
|
|
12
|
+
};
|
|
13
|
+
export declare function EdgeInsets(edgeInsets: EdgeInsetsProps): EdgeInsets;
|
|
14
|
+
export declare namespace EdgeInsets {
|
|
15
|
+
var all: (value: number) => {
|
|
16
|
+
top: number;
|
|
17
|
+
right: number;
|
|
18
|
+
bottom: number;
|
|
19
|
+
left: number;
|
|
20
|
+
[EDGE_INSETS_SYMBOL]: true;
|
|
21
|
+
};
|
|
22
|
+
var symmetric: ({ vertical, horizontal }: {
|
|
23
|
+
vertical?: number;
|
|
24
|
+
horizontal?: number;
|
|
25
|
+
}) => EdgeInsets;
|
|
26
|
+
var only: ({ top, right, bottom, left, }: {
|
|
27
|
+
top?: number;
|
|
28
|
+
right?: number;
|
|
29
|
+
bottom?: number;
|
|
30
|
+
left?: number;
|
|
31
|
+
}) => EdgeInsets;
|
|
32
|
+
var zero: EdgeInsets;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 类型守卫:检查对象是否通过 EdgeInsets 创建
|
|
36
|
+
*/
|
|
37
|
+
export declare function isEdgeInsets(value: any): value is EdgeInsets;
|
|
38
|
+
export declare function edgeInsetsToStyle(type: "margin" | "padding", edgeInsets: EdgeInsetsProps | undefined): {
|
|
12
39
|
[x: string]: string;
|
|
13
40
|
};
|
|
14
|
-
export declare const paddingToStyle: (value?:
|
|
41
|
+
export declare const paddingToStyle: (value?: EdgeInsetsProps) => {
|
|
15
42
|
[x: string]: string;
|
|
16
43
|
};
|
|
17
|
-
export declare const marginToStyle: (value?:
|
|
44
|
+
export declare const marginToStyle: (value?: EdgeInsetsProps) => {
|
|
18
45
|
[x: string]: string;
|
|
19
46
|
};
|
|
47
|
+
export {};
|
package/dist/Expanded.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
interface Props {
|
|
2
2
|
flex?: number;
|
|
3
3
|
alignSelf?: "auto" | "start" | "end" | "center" | "stretch" | "baseline";
|
|
4
|
-
minSize?: number
|
|
5
|
-
maxSize?: number
|
|
4
|
+
minSize?: number;
|
|
5
|
+
maxSize?: number;
|
|
6
6
|
}
|
|
7
7
|
declare function __VLS_template(): {
|
|
8
8
|
attrs: Partial<{}>;
|