modern-idoc 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/LICENSE +21 -0
- package/README.md +67 -0
- package/dist/index.cjs +5 -0
- package/dist/index.d.cts +200 -0
- package/dist/index.d.mts +200 -0
- package/dist/index.d.ts +200 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +3 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-PRESENT wxm
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<h1 align="center">modern-idoc</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://unpkg.com/modern-idoc">
|
|
5
|
+
<img src="https://img.shields.io/bundlephobia/minzip/modern-idoc" alt="Minzip">
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://www.npmjs.com/package/modern-idoc">
|
|
8
|
+
<img src="https://img.shields.io/npm/v/modern-idoc.svg" alt="Version">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/modern-idoc">
|
|
11
|
+
<img src="https://img.shields.io/npm/dm/modern-idoc" alt="Downloads">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://github.com/qq15725/modern-idoc/issues">
|
|
14
|
+
<img src="https://img.shields.io/github/issues/qq15725/modern-idoc" alt="Issues">
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://github.com/qq15725/modern-idoc/blob/main/LICENSE">
|
|
17
|
+
<img src="https://img.shields.io/npm/l/modern-idoc.svg" alt="License">
|
|
18
|
+
</a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import type { IDoc } from 'modern-idoc'
|
|
25
|
+
|
|
26
|
+
const doc: IDoc = {
|
|
27
|
+
name: 'example.pptx',
|
|
28
|
+
children: [
|
|
29
|
+
{
|
|
30
|
+
name: 'ppt/slides/slide1.xml',
|
|
31
|
+
style: {
|
|
32
|
+
width: 960,
|
|
33
|
+
height: 540,
|
|
34
|
+
},
|
|
35
|
+
meta: {
|
|
36
|
+
layout: 'ppt/slideLayous/slideLayout1.xml',
|
|
37
|
+
},
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
type: 'image',
|
|
41
|
+
style: {
|
|
42
|
+
left: 100,
|
|
43
|
+
top: 100,
|
|
44
|
+
width: 300,
|
|
45
|
+
height: 400,
|
|
46
|
+
},
|
|
47
|
+
src: '/example.png',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: 'text',
|
|
51
|
+
style: {
|
|
52
|
+
left: 100,
|
|
53
|
+
top: 100,
|
|
54
|
+
},
|
|
55
|
+
content: 'TEXT',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'shape',
|
|
59
|
+
paths: [
|
|
60
|
+
{ fill: '#000', data: 'M 0 0 L 100 100' },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
}
|
|
67
|
+
```
|
package/dist/index.cjs
ADDED
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
interface IBackgroundStyle {
|
|
2
|
+
opacity: number;
|
|
3
|
+
}
|
|
4
|
+
interface IBackground extends Partial<IBackgroundStyle> {
|
|
5
|
+
src: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type Overflow = 'hidden' | 'visible';
|
|
9
|
+
type Visibility = 'hidden' | 'visible';
|
|
10
|
+
interface IElementStyle {
|
|
11
|
+
overflow: Overflow;
|
|
12
|
+
visibility: Visibility;
|
|
13
|
+
filter: string;
|
|
14
|
+
left: number;
|
|
15
|
+
top: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
rotate: number;
|
|
19
|
+
opacity: number;
|
|
20
|
+
scaleX: number;
|
|
21
|
+
scaleY: number;
|
|
22
|
+
transform: string;
|
|
23
|
+
transformOrigin: string;
|
|
24
|
+
backgroundImage: string;
|
|
25
|
+
backgroundColor: string;
|
|
26
|
+
shadowColor: string;
|
|
27
|
+
shadowOffsetX: number;
|
|
28
|
+
shadowOffsetY: number;
|
|
29
|
+
shadowBlur: number;
|
|
30
|
+
marginLeft: number;
|
|
31
|
+
marginTop: number;
|
|
32
|
+
marginRight: number;
|
|
33
|
+
marginBottom: number;
|
|
34
|
+
paddingLeft: number;
|
|
35
|
+
paddingTop: number;
|
|
36
|
+
paddingRight: number;
|
|
37
|
+
paddingBottom: number;
|
|
38
|
+
borderRadius: number;
|
|
39
|
+
borderColor: string;
|
|
40
|
+
borderWidth: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface IElement<T extends IElementStyle = IElementStyle> {
|
|
44
|
+
name?: string;
|
|
45
|
+
style?: Partial<T>;
|
|
46
|
+
background?: IBackground;
|
|
47
|
+
meta?: Record<string, any>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface IImage extends IElement {
|
|
51
|
+
type: 'image';
|
|
52
|
+
src: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
type FillRule = 'nonzero' | 'evenodd';
|
|
56
|
+
type StrokeLinecap = 'butt' | 'round' | 'square';
|
|
57
|
+
type StrokeLinejoin = 'arcs' | 'bevel' | 'miter' | 'miter-clip' | 'round';
|
|
58
|
+
interface IPathDrawStyle {
|
|
59
|
+
fill: string;
|
|
60
|
+
stroke: string;
|
|
61
|
+
shadowColor: string;
|
|
62
|
+
shadowOffsetX: number;
|
|
63
|
+
shadowOffsetY: number;
|
|
64
|
+
shadowBlur: number;
|
|
65
|
+
}
|
|
66
|
+
interface IPathStyle extends IPathDrawStyle {
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
fillOpacity: number;
|
|
69
|
+
fillRule: FillRule;
|
|
70
|
+
opacity: number;
|
|
71
|
+
strokeOpacity: number;
|
|
72
|
+
strokeWidth: number;
|
|
73
|
+
strokeLinecap: StrokeLinecap;
|
|
74
|
+
strokeLinejoin: StrokeLinejoin;
|
|
75
|
+
strokeMiterlimit: number;
|
|
76
|
+
strokeDasharray: number[];
|
|
77
|
+
strokeDashoffset: number;
|
|
78
|
+
visibility: string;
|
|
79
|
+
}
|
|
80
|
+
interface IPath extends Partial<IPathStyle> {
|
|
81
|
+
data: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface IShape extends IElement {
|
|
85
|
+
type: 'shape';
|
|
86
|
+
paths: IPath[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
90
|
+
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
91
|
+
type FontKerning = 'none' | 'auto' | 'normal';
|
|
92
|
+
type TextWrap = 'wrap' | 'nowrap';
|
|
93
|
+
type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
|
|
94
|
+
type TextTransform = 'none' | 'uppercase' | 'lowercase';
|
|
95
|
+
type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
|
|
96
|
+
type TextDecorationLine = 'none' | 'underline' | 'line-through' | 'overline';
|
|
97
|
+
type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
|
|
98
|
+
type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
|
|
99
|
+
type Sizeable = `${number}%` | `${number}rem` | number;
|
|
100
|
+
type ListStyleType = 'none' | 'disc';
|
|
101
|
+
type ListStyleImage = 'none' | string;
|
|
102
|
+
type ListStyleColormap = 'none' | Record<string, string>;
|
|
103
|
+
type ListStyleSize = 'cover' | Sizeable;
|
|
104
|
+
type ListStylePosition = 'inside' | 'outside';
|
|
105
|
+
interface ListStyle {
|
|
106
|
+
type: ListStyleType;
|
|
107
|
+
image: ListStyleImage;
|
|
108
|
+
colormap: ListStyleColormap;
|
|
109
|
+
size: ListStyleSize;
|
|
110
|
+
position: ListStylePosition;
|
|
111
|
+
}
|
|
112
|
+
type HighlightLine = TextDecorationLine | 'outline';
|
|
113
|
+
type HighlightImage = 'none' | string;
|
|
114
|
+
type HighlightReferImage = 'none' | string;
|
|
115
|
+
type HighlightColormap = 'none' | Record<string, string>;
|
|
116
|
+
type HighlightSize = 'cover' | Sizeable;
|
|
117
|
+
type HighlightThickness = Sizeable;
|
|
118
|
+
interface Highlight {
|
|
119
|
+
image: HighlightImage;
|
|
120
|
+
referImage: HighlightReferImage;
|
|
121
|
+
colormap: HighlightColormap;
|
|
122
|
+
line: HighlightLine;
|
|
123
|
+
size: HighlightSize;
|
|
124
|
+
thickness: HighlightThickness;
|
|
125
|
+
}
|
|
126
|
+
interface TextListStyle {
|
|
127
|
+
listStyle: Partial<ListStyle>;
|
|
128
|
+
listStyleType: ListStyleType;
|
|
129
|
+
listStyleImage: ListStyleImage;
|
|
130
|
+
listStyleColormap: ListStyleColormap;
|
|
131
|
+
listStyleSize: ListStyleSize;
|
|
132
|
+
listStylePosition: ListStylePosition;
|
|
133
|
+
}
|
|
134
|
+
interface TextHighlightStyle {
|
|
135
|
+
highlight: Partial<Highlight>;
|
|
136
|
+
highlightImage: HighlightImage;
|
|
137
|
+
highlightReferImage: HighlightReferImage;
|
|
138
|
+
highlightColormap: HighlightColormap;
|
|
139
|
+
highlightLine: HighlightLine;
|
|
140
|
+
highlightSize: HighlightSize;
|
|
141
|
+
highlightThickness: HighlightThickness;
|
|
142
|
+
}
|
|
143
|
+
interface TextLineStyle extends TextListStyle {
|
|
144
|
+
writingMode: WritingMode;
|
|
145
|
+
textWrap: TextWrap;
|
|
146
|
+
textAlign: TextAlign;
|
|
147
|
+
textIndent: number;
|
|
148
|
+
lineHeight: number;
|
|
149
|
+
}
|
|
150
|
+
interface TextInlineStyle extends TextHighlightStyle {
|
|
151
|
+
color: string;
|
|
152
|
+
verticalAlign: VerticalAlign;
|
|
153
|
+
letterSpacing: number;
|
|
154
|
+
fontSize: number;
|
|
155
|
+
fontWeight: FontWeight;
|
|
156
|
+
fontFamily: string;
|
|
157
|
+
fontStyle: FontStyle;
|
|
158
|
+
fontKerning: FontKerning;
|
|
159
|
+
textTransform: TextTransform;
|
|
160
|
+
textOrientation: TextOrientation;
|
|
161
|
+
textDecoration: TextDecorationLine;
|
|
162
|
+
}
|
|
163
|
+
interface TextDrawStyle {
|
|
164
|
+
textStrokeWidth: number;
|
|
165
|
+
textStrokeColor: string;
|
|
166
|
+
shadowColor: string;
|
|
167
|
+
shadowOffsetX: number;
|
|
168
|
+
shadowOffsetY: number;
|
|
169
|
+
shadowBlur: number;
|
|
170
|
+
translateX: number;
|
|
171
|
+
translateY: number;
|
|
172
|
+
skewX: number;
|
|
173
|
+
skewY: number;
|
|
174
|
+
}
|
|
175
|
+
interface ITextStyle extends TextLineStyle, TextInlineStyle, TextDrawStyle, IElementStyle {
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
interface IFragmentContent extends Partial<ITextStyle> {
|
|
179
|
+
content: string;
|
|
180
|
+
}
|
|
181
|
+
interface IParagraphContent extends Partial<ITextStyle> {
|
|
182
|
+
fragments: IFragmentContent[];
|
|
183
|
+
}
|
|
184
|
+
type ITextContent = string | IFragmentContent | IParagraphContent | (string | IFragmentContent | IParagraphContent | (string | IFragmentContent)[])[];
|
|
185
|
+
interface IText extends IElement<ITextStyle> {
|
|
186
|
+
type: 'text';
|
|
187
|
+
content: ITextContent;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
type IGroupElement = IImage | IText | IShape | IGroup;
|
|
191
|
+
interface IGroup extends IElement {
|
|
192
|
+
children: IGroupElement[];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface IDoc extends IGroup {
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare const _default: {};
|
|
199
|
+
|
|
200
|
+
export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type Highlight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IBackground, type IBackgroundStyle, type IDoc, type IElement, type IElementStyle, type IFragmentContent, type IGroup, type IGroupElement, type IImage, type IParagraphContent, type IPath, type IPathDrawStyle, type IPathStyle, type IShape, type IText, type ITextContent, type ITextStyle, type ListStyle, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type Sizeable, type StrokeLinecap, type StrokeLinejoin, type TextAlign, type TextDecorationLine, type TextDrawStyle, type TextHighlightStyle, type TextInlineStyle, type TextLineStyle, type TextListStyle, type TextOrientation, type TextTransform, type TextWrap, type VerticalAlign, type Visibility, type WritingMode, _default as default };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
interface IBackgroundStyle {
|
|
2
|
+
opacity: number;
|
|
3
|
+
}
|
|
4
|
+
interface IBackground extends Partial<IBackgroundStyle> {
|
|
5
|
+
src: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type Overflow = 'hidden' | 'visible';
|
|
9
|
+
type Visibility = 'hidden' | 'visible';
|
|
10
|
+
interface IElementStyle {
|
|
11
|
+
overflow: Overflow;
|
|
12
|
+
visibility: Visibility;
|
|
13
|
+
filter: string;
|
|
14
|
+
left: number;
|
|
15
|
+
top: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
rotate: number;
|
|
19
|
+
opacity: number;
|
|
20
|
+
scaleX: number;
|
|
21
|
+
scaleY: number;
|
|
22
|
+
transform: string;
|
|
23
|
+
transformOrigin: string;
|
|
24
|
+
backgroundImage: string;
|
|
25
|
+
backgroundColor: string;
|
|
26
|
+
shadowColor: string;
|
|
27
|
+
shadowOffsetX: number;
|
|
28
|
+
shadowOffsetY: number;
|
|
29
|
+
shadowBlur: number;
|
|
30
|
+
marginLeft: number;
|
|
31
|
+
marginTop: number;
|
|
32
|
+
marginRight: number;
|
|
33
|
+
marginBottom: number;
|
|
34
|
+
paddingLeft: number;
|
|
35
|
+
paddingTop: number;
|
|
36
|
+
paddingRight: number;
|
|
37
|
+
paddingBottom: number;
|
|
38
|
+
borderRadius: number;
|
|
39
|
+
borderColor: string;
|
|
40
|
+
borderWidth: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface IElement<T extends IElementStyle = IElementStyle> {
|
|
44
|
+
name?: string;
|
|
45
|
+
style?: Partial<T>;
|
|
46
|
+
background?: IBackground;
|
|
47
|
+
meta?: Record<string, any>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface IImage extends IElement {
|
|
51
|
+
type: 'image';
|
|
52
|
+
src: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
type FillRule = 'nonzero' | 'evenodd';
|
|
56
|
+
type StrokeLinecap = 'butt' | 'round' | 'square';
|
|
57
|
+
type StrokeLinejoin = 'arcs' | 'bevel' | 'miter' | 'miter-clip' | 'round';
|
|
58
|
+
interface IPathDrawStyle {
|
|
59
|
+
fill: string;
|
|
60
|
+
stroke: string;
|
|
61
|
+
shadowColor: string;
|
|
62
|
+
shadowOffsetX: number;
|
|
63
|
+
shadowOffsetY: number;
|
|
64
|
+
shadowBlur: number;
|
|
65
|
+
}
|
|
66
|
+
interface IPathStyle extends IPathDrawStyle {
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
fillOpacity: number;
|
|
69
|
+
fillRule: FillRule;
|
|
70
|
+
opacity: number;
|
|
71
|
+
strokeOpacity: number;
|
|
72
|
+
strokeWidth: number;
|
|
73
|
+
strokeLinecap: StrokeLinecap;
|
|
74
|
+
strokeLinejoin: StrokeLinejoin;
|
|
75
|
+
strokeMiterlimit: number;
|
|
76
|
+
strokeDasharray: number[];
|
|
77
|
+
strokeDashoffset: number;
|
|
78
|
+
visibility: string;
|
|
79
|
+
}
|
|
80
|
+
interface IPath extends Partial<IPathStyle> {
|
|
81
|
+
data: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface IShape extends IElement {
|
|
85
|
+
type: 'shape';
|
|
86
|
+
paths: IPath[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
90
|
+
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
91
|
+
type FontKerning = 'none' | 'auto' | 'normal';
|
|
92
|
+
type TextWrap = 'wrap' | 'nowrap';
|
|
93
|
+
type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
|
|
94
|
+
type TextTransform = 'none' | 'uppercase' | 'lowercase';
|
|
95
|
+
type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
|
|
96
|
+
type TextDecorationLine = 'none' | 'underline' | 'line-through' | 'overline';
|
|
97
|
+
type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
|
|
98
|
+
type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
|
|
99
|
+
type Sizeable = `${number}%` | `${number}rem` | number;
|
|
100
|
+
type ListStyleType = 'none' | 'disc';
|
|
101
|
+
type ListStyleImage = 'none' | string;
|
|
102
|
+
type ListStyleColormap = 'none' | Record<string, string>;
|
|
103
|
+
type ListStyleSize = 'cover' | Sizeable;
|
|
104
|
+
type ListStylePosition = 'inside' | 'outside';
|
|
105
|
+
interface ListStyle {
|
|
106
|
+
type: ListStyleType;
|
|
107
|
+
image: ListStyleImage;
|
|
108
|
+
colormap: ListStyleColormap;
|
|
109
|
+
size: ListStyleSize;
|
|
110
|
+
position: ListStylePosition;
|
|
111
|
+
}
|
|
112
|
+
type HighlightLine = TextDecorationLine | 'outline';
|
|
113
|
+
type HighlightImage = 'none' | string;
|
|
114
|
+
type HighlightReferImage = 'none' | string;
|
|
115
|
+
type HighlightColormap = 'none' | Record<string, string>;
|
|
116
|
+
type HighlightSize = 'cover' | Sizeable;
|
|
117
|
+
type HighlightThickness = Sizeable;
|
|
118
|
+
interface Highlight {
|
|
119
|
+
image: HighlightImage;
|
|
120
|
+
referImage: HighlightReferImage;
|
|
121
|
+
colormap: HighlightColormap;
|
|
122
|
+
line: HighlightLine;
|
|
123
|
+
size: HighlightSize;
|
|
124
|
+
thickness: HighlightThickness;
|
|
125
|
+
}
|
|
126
|
+
interface TextListStyle {
|
|
127
|
+
listStyle: Partial<ListStyle>;
|
|
128
|
+
listStyleType: ListStyleType;
|
|
129
|
+
listStyleImage: ListStyleImage;
|
|
130
|
+
listStyleColormap: ListStyleColormap;
|
|
131
|
+
listStyleSize: ListStyleSize;
|
|
132
|
+
listStylePosition: ListStylePosition;
|
|
133
|
+
}
|
|
134
|
+
interface TextHighlightStyle {
|
|
135
|
+
highlight: Partial<Highlight>;
|
|
136
|
+
highlightImage: HighlightImage;
|
|
137
|
+
highlightReferImage: HighlightReferImage;
|
|
138
|
+
highlightColormap: HighlightColormap;
|
|
139
|
+
highlightLine: HighlightLine;
|
|
140
|
+
highlightSize: HighlightSize;
|
|
141
|
+
highlightThickness: HighlightThickness;
|
|
142
|
+
}
|
|
143
|
+
interface TextLineStyle extends TextListStyle {
|
|
144
|
+
writingMode: WritingMode;
|
|
145
|
+
textWrap: TextWrap;
|
|
146
|
+
textAlign: TextAlign;
|
|
147
|
+
textIndent: number;
|
|
148
|
+
lineHeight: number;
|
|
149
|
+
}
|
|
150
|
+
interface TextInlineStyle extends TextHighlightStyle {
|
|
151
|
+
color: string;
|
|
152
|
+
verticalAlign: VerticalAlign;
|
|
153
|
+
letterSpacing: number;
|
|
154
|
+
fontSize: number;
|
|
155
|
+
fontWeight: FontWeight;
|
|
156
|
+
fontFamily: string;
|
|
157
|
+
fontStyle: FontStyle;
|
|
158
|
+
fontKerning: FontKerning;
|
|
159
|
+
textTransform: TextTransform;
|
|
160
|
+
textOrientation: TextOrientation;
|
|
161
|
+
textDecoration: TextDecorationLine;
|
|
162
|
+
}
|
|
163
|
+
interface TextDrawStyle {
|
|
164
|
+
textStrokeWidth: number;
|
|
165
|
+
textStrokeColor: string;
|
|
166
|
+
shadowColor: string;
|
|
167
|
+
shadowOffsetX: number;
|
|
168
|
+
shadowOffsetY: number;
|
|
169
|
+
shadowBlur: number;
|
|
170
|
+
translateX: number;
|
|
171
|
+
translateY: number;
|
|
172
|
+
skewX: number;
|
|
173
|
+
skewY: number;
|
|
174
|
+
}
|
|
175
|
+
interface ITextStyle extends TextLineStyle, TextInlineStyle, TextDrawStyle, IElementStyle {
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
interface IFragmentContent extends Partial<ITextStyle> {
|
|
179
|
+
content: string;
|
|
180
|
+
}
|
|
181
|
+
interface IParagraphContent extends Partial<ITextStyle> {
|
|
182
|
+
fragments: IFragmentContent[];
|
|
183
|
+
}
|
|
184
|
+
type ITextContent = string | IFragmentContent | IParagraphContent | (string | IFragmentContent | IParagraphContent | (string | IFragmentContent)[])[];
|
|
185
|
+
interface IText extends IElement<ITextStyle> {
|
|
186
|
+
type: 'text';
|
|
187
|
+
content: ITextContent;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
type IGroupElement = IImage | IText | IShape | IGroup;
|
|
191
|
+
interface IGroup extends IElement {
|
|
192
|
+
children: IGroupElement[];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface IDoc extends IGroup {
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare const _default: {};
|
|
199
|
+
|
|
200
|
+
export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type Highlight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IBackground, type IBackgroundStyle, type IDoc, type IElement, type IElementStyle, type IFragmentContent, type IGroup, type IGroupElement, type IImage, type IParagraphContent, type IPath, type IPathDrawStyle, type IPathStyle, type IShape, type IText, type ITextContent, type ITextStyle, type ListStyle, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type Sizeable, type StrokeLinecap, type StrokeLinejoin, type TextAlign, type TextDecorationLine, type TextDrawStyle, type TextHighlightStyle, type TextInlineStyle, type TextLineStyle, type TextListStyle, type TextOrientation, type TextTransform, type TextWrap, type VerticalAlign, type Visibility, type WritingMode, _default as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
interface IBackgroundStyle {
|
|
2
|
+
opacity: number;
|
|
3
|
+
}
|
|
4
|
+
interface IBackground extends Partial<IBackgroundStyle> {
|
|
5
|
+
src: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type Overflow = 'hidden' | 'visible';
|
|
9
|
+
type Visibility = 'hidden' | 'visible';
|
|
10
|
+
interface IElementStyle {
|
|
11
|
+
overflow: Overflow;
|
|
12
|
+
visibility: Visibility;
|
|
13
|
+
filter: string;
|
|
14
|
+
left: number;
|
|
15
|
+
top: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
rotate: number;
|
|
19
|
+
opacity: number;
|
|
20
|
+
scaleX: number;
|
|
21
|
+
scaleY: number;
|
|
22
|
+
transform: string;
|
|
23
|
+
transformOrigin: string;
|
|
24
|
+
backgroundImage: string;
|
|
25
|
+
backgroundColor: string;
|
|
26
|
+
shadowColor: string;
|
|
27
|
+
shadowOffsetX: number;
|
|
28
|
+
shadowOffsetY: number;
|
|
29
|
+
shadowBlur: number;
|
|
30
|
+
marginLeft: number;
|
|
31
|
+
marginTop: number;
|
|
32
|
+
marginRight: number;
|
|
33
|
+
marginBottom: number;
|
|
34
|
+
paddingLeft: number;
|
|
35
|
+
paddingTop: number;
|
|
36
|
+
paddingRight: number;
|
|
37
|
+
paddingBottom: number;
|
|
38
|
+
borderRadius: number;
|
|
39
|
+
borderColor: string;
|
|
40
|
+
borderWidth: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface IElement<T extends IElementStyle = IElementStyle> {
|
|
44
|
+
name?: string;
|
|
45
|
+
style?: Partial<T>;
|
|
46
|
+
background?: IBackground;
|
|
47
|
+
meta?: Record<string, any>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface IImage extends IElement {
|
|
51
|
+
type: 'image';
|
|
52
|
+
src: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
type FillRule = 'nonzero' | 'evenodd';
|
|
56
|
+
type StrokeLinecap = 'butt' | 'round' | 'square';
|
|
57
|
+
type StrokeLinejoin = 'arcs' | 'bevel' | 'miter' | 'miter-clip' | 'round';
|
|
58
|
+
interface IPathDrawStyle {
|
|
59
|
+
fill: string;
|
|
60
|
+
stroke: string;
|
|
61
|
+
shadowColor: string;
|
|
62
|
+
shadowOffsetX: number;
|
|
63
|
+
shadowOffsetY: number;
|
|
64
|
+
shadowBlur: number;
|
|
65
|
+
}
|
|
66
|
+
interface IPathStyle extends IPathDrawStyle {
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
fillOpacity: number;
|
|
69
|
+
fillRule: FillRule;
|
|
70
|
+
opacity: number;
|
|
71
|
+
strokeOpacity: number;
|
|
72
|
+
strokeWidth: number;
|
|
73
|
+
strokeLinecap: StrokeLinecap;
|
|
74
|
+
strokeLinejoin: StrokeLinejoin;
|
|
75
|
+
strokeMiterlimit: number;
|
|
76
|
+
strokeDasharray: number[];
|
|
77
|
+
strokeDashoffset: number;
|
|
78
|
+
visibility: string;
|
|
79
|
+
}
|
|
80
|
+
interface IPath extends Partial<IPathStyle> {
|
|
81
|
+
data: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface IShape extends IElement {
|
|
85
|
+
type: 'shape';
|
|
86
|
+
paths: IPath[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
90
|
+
type FontStyle = 'normal' | 'italic' | 'oblique' | `oblique ${string}`;
|
|
91
|
+
type FontKerning = 'none' | 'auto' | 'normal';
|
|
92
|
+
type TextWrap = 'wrap' | 'nowrap';
|
|
93
|
+
type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
|
|
94
|
+
type TextTransform = 'none' | 'uppercase' | 'lowercase';
|
|
95
|
+
type TextOrientation = 'mixed' | 'upright' | 'sideways-right' | 'sideways';
|
|
96
|
+
type TextDecorationLine = 'none' | 'underline' | 'line-through' | 'overline';
|
|
97
|
+
type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
|
|
98
|
+
type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
|
|
99
|
+
type Sizeable = `${number}%` | `${number}rem` | number;
|
|
100
|
+
type ListStyleType = 'none' | 'disc';
|
|
101
|
+
type ListStyleImage = 'none' | string;
|
|
102
|
+
type ListStyleColormap = 'none' | Record<string, string>;
|
|
103
|
+
type ListStyleSize = 'cover' | Sizeable;
|
|
104
|
+
type ListStylePosition = 'inside' | 'outside';
|
|
105
|
+
interface ListStyle {
|
|
106
|
+
type: ListStyleType;
|
|
107
|
+
image: ListStyleImage;
|
|
108
|
+
colormap: ListStyleColormap;
|
|
109
|
+
size: ListStyleSize;
|
|
110
|
+
position: ListStylePosition;
|
|
111
|
+
}
|
|
112
|
+
type HighlightLine = TextDecorationLine | 'outline';
|
|
113
|
+
type HighlightImage = 'none' | string;
|
|
114
|
+
type HighlightReferImage = 'none' | string;
|
|
115
|
+
type HighlightColormap = 'none' | Record<string, string>;
|
|
116
|
+
type HighlightSize = 'cover' | Sizeable;
|
|
117
|
+
type HighlightThickness = Sizeable;
|
|
118
|
+
interface Highlight {
|
|
119
|
+
image: HighlightImage;
|
|
120
|
+
referImage: HighlightReferImage;
|
|
121
|
+
colormap: HighlightColormap;
|
|
122
|
+
line: HighlightLine;
|
|
123
|
+
size: HighlightSize;
|
|
124
|
+
thickness: HighlightThickness;
|
|
125
|
+
}
|
|
126
|
+
interface TextListStyle {
|
|
127
|
+
listStyle: Partial<ListStyle>;
|
|
128
|
+
listStyleType: ListStyleType;
|
|
129
|
+
listStyleImage: ListStyleImage;
|
|
130
|
+
listStyleColormap: ListStyleColormap;
|
|
131
|
+
listStyleSize: ListStyleSize;
|
|
132
|
+
listStylePosition: ListStylePosition;
|
|
133
|
+
}
|
|
134
|
+
interface TextHighlightStyle {
|
|
135
|
+
highlight: Partial<Highlight>;
|
|
136
|
+
highlightImage: HighlightImage;
|
|
137
|
+
highlightReferImage: HighlightReferImage;
|
|
138
|
+
highlightColormap: HighlightColormap;
|
|
139
|
+
highlightLine: HighlightLine;
|
|
140
|
+
highlightSize: HighlightSize;
|
|
141
|
+
highlightThickness: HighlightThickness;
|
|
142
|
+
}
|
|
143
|
+
interface TextLineStyle extends TextListStyle {
|
|
144
|
+
writingMode: WritingMode;
|
|
145
|
+
textWrap: TextWrap;
|
|
146
|
+
textAlign: TextAlign;
|
|
147
|
+
textIndent: number;
|
|
148
|
+
lineHeight: number;
|
|
149
|
+
}
|
|
150
|
+
interface TextInlineStyle extends TextHighlightStyle {
|
|
151
|
+
color: string;
|
|
152
|
+
verticalAlign: VerticalAlign;
|
|
153
|
+
letterSpacing: number;
|
|
154
|
+
fontSize: number;
|
|
155
|
+
fontWeight: FontWeight;
|
|
156
|
+
fontFamily: string;
|
|
157
|
+
fontStyle: FontStyle;
|
|
158
|
+
fontKerning: FontKerning;
|
|
159
|
+
textTransform: TextTransform;
|
|
160
|
+
textOrientation: TextOrientation;
|
|
161
|
+
textDecoration: TextDecorationLine;
|
|
162
|
+
}
|
|
163
|
+
interface TextDrawStyle {
|
|
164
|
+
textStrokeWidth: number;
|
|
165
|
+
textStrokeColor: string;
|
|
166
|
+
shadowColor: string;
|
|
167
|
+
shadowOffsetX: number;
|
|
168
|
+
shadowOffsetY: number;
|
|
169
|
+
shadowBlur: number;
|
|
170
|
+
translateX: number;
|
|
171
|
+
translateY: number;
|
|
172
|
+
skewX: number;
|
|
173
|
+
skewY: number;
|
|
174
|
+
}
|
|
175
|
+
interface ITextStyle extends TextLineStyle, TextInlineStyle, TextDrawStyle, IElementStyle {
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
interface IFragmentContent extends Partial<ITextStyle> {
|
|
179
|
+
content: string;
|
|
180
|
+
}
|
|
181
|
+
interface IParagraphContent extends Partial<ITextStyle> {
|
|
182
|
+
fragments: IFragmentContent[];
|
|
183
|
+
}
|
|
184
|
+
type ITextContent = string | IFragmentContent | IParagraphContent | (string | IFragmentContent | IParagraphContent | (string | IFragmentContent)[])[];
|
|
185
|
+
interface IText extends IElement<ITextStyle> {
|
|
186
|
+
type: 'text';
|
|
187
|
+
content: ITextContent;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
type IGroupElement = IImage | IText | IShape | IGroup;
|
|
191
|
+
interface IGroup extends IElement {
|
|
192
|
+
children: IGroupElement[];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface IDoc extends IGroup {
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare const _default: {};
|
|
199
|
+
|
|
200
|
+
export { type FillRule, type FontKerning, type FontStyle, type FontWeight, type Highlight, type HighlightColormap, type HighlightImage, type HighlightLine, type HighlightReferImage, type HighlightSize, type HighlightThickness, type IBackground, type IBackgroundStyle, type IDoc, type IElement, type IElementStyle, type IFragmentContent, type IGroup, type IGroupElement, type IImage, type IParagraphContent, type IPath, type IPathDrawStyle, type IPathStyle, type IShape, type IText, type ITextContent, type ITextStyle, type ListStyle, type ListStyleColormap, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type Overflow, type Sizeable, type StrokeLinecap, type StrokeLinejoin, type TextAlign, type TextDecorationLine, type TextDrawStyle, type TextHighlightStyle, type TextInlineStyle, type TextLineStyle, type TextListStyle, type TextOrientation, type TextTransform, type TextWrap, type VerticalAlign, type Visibility, type WritingMode, _default as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis<"u"?globalThis:e||self,e.modernIdoc=n())})(this,function(){"use strict";return{}});
|
package/dist/index.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "modern-idoc",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"packageManager": "pnpm@9.9.0",
|
|
6
|
+
"description": "Intermediate document for modern codec libs",
|
|
7
|
+
"author": "wxm",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"homepage": "https://github.com/qq15725/modern-idoc",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/qq15725/modern-idoc.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/qq15725/modern-idoc/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"starter",
|
|
19
|
+
"template",
|
|
20
|
+
"typescript"
|
|
21
|
+
],
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"require": "./dist/index.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"main": "./dist/index.mjs",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"browser": "./dist/index.js",
|
|
34
|
+
"typesVersions": {
|
|
35
|
+
"*": {
|
|
36
|
+
"*": [
|
|
37
|
+
"./dist/*",
|
|
38
|
+
"./dist/index.d.ts"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "vite build && unbuild",
|
|
47
|
+
"dev": "vite docs",
|
|
48
|
+
"lint": "eslint .",
|
|
49
|
+
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
|
|
50
|
+
"release": "bumpp package.json --commit \"release: v%s\" --push --all --tag",
|
|
51
|
+
"start": "esno src/index.ts",
|
|
52
|
+
"test": "vitest",
|
|
53
|
+
"typecheck": "tsc --noEmit",
|
|
54
|
+
"prepare": "simple-git-hooks"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@antfu/eslint-config": "^3.12.1",
|
|
58
|
+
"@types/node": "^22.10.2",
|
|
59
|
+
"bumpp": "^9.9.2",
|
|
60
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
61
|
+
"eslint": "^9.17.0",
|
|
62
|
+
"lint-staged": "^15.2.11",
|
|
63
|
+
"simple-git-hooks": "^2.11.1",
|
|
64
|
+
"typescript": "^5.7.2",
|
|
65
|
+
"unbuild": "^3.0.1",
|
|
66
|
+
"vite": "^6.0.5",
|
|
67
|
+
"vitest": "^2.1.8"
|
|
68
|
+
},
|
|
69
|
+
"simple-git-hooks": {
|
|
70
|
+
"pre-commit": "pnpm lint-staged"
|
|
71
|
+
},
|
|
72
|
+
"lint-staged": {
|
|
73
|
+
"*": "eslint --fix"
|
|
74
|
+
}
|
|
75
|
+
}
|