@pyreon/document-primitives 0.11.5 → 0.11.6
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/lib/index.d.ts +1 -1
- package/lib/index.js +11 -11
- package/package.json +34 -33
- package/src/DocumentPreview.ts +24 -24
- package/src/__tests__/primitives-attrs.test.ts +238 -300
- package/src/__tests__/primitives.test.ts +61 -61
- package/src/__tests__/useDocumentExport.test.ts +28 -28
- package/src/index.ts +25 -25
- package/src/primitives/DocButton.ts +17 -17
- package/src/primitives/DocCode.ts +8 -8
- package/src/primitives/DocColumn.ts +5 -5
- package/src/primitives/DocDivider.ts +6 -6
- package/src/primitives/DocDocument.ts +5 -5
- package/src/primitives/DocHeading.ts +9 -9
- package/src/primitives/DocImage.ts +6 -6
- package/src/primitives/DocLink.ts +8 -8
- package/src/primitives/DocList.ts +5 -5
- package/src/primitives/DocListItem.ts +5 -5
- package/src/primitives/DocPage.ts +7 -7
- package/src/primitives/DocPageBreak.ts +5 -5
- package/src/primitives/DocQuote.ts +9 -9
- package/src/primitives/DocRow.ts +6 -6
- package/src/primitives/DocSection.ts +8 -8
- package/src/primitives/DocSpacer.ts +5 -5
- package/src/primitives/DocTable.ts +7 -7
- package/src/primitives/DocText.ts +12 -12
- package/src/theme.ts +11 -11
- package/src/useDocumentExport.ts +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -1006,7 +1006,7 @@ interface DocumentExportOptions extends ExtractOptions$1 {
|
|
|
1006
1006
|
/** Theme object to provide during extraction. */
|
|
1007
1007
|
theme?: Record<string, unknown>;
|
|
1008
1008
|
/** Mode: 'light' or 'dark'. */
|
|
1009
|
-
mode?:
|
|
1009
|
+
mode?: 'light' | 'dark';
|
|
1010
1010
|
}
|
|
1011
1011
|
interface DocumentExport {
|
|
1012
1012
|
/** Extract the DocNode tree from the template. */
|
package/lib/index.js
CHANGED
|
@@ -34,18 +34,18 @@ const DocumentPreview = rocketstyle({
|
|
|
34
34
|
minHeight: "14in"
|
|
35
35
|
}
|
|
36
36
|
}).styles((css) => css`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
align-items: center;
|
|
40
|
+
min-height: 100vh;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
& > * {
|
|
43
|
+
background: white;
|
|
44
|
+
padding: 25mm;
|
|
45
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
46
|
+
margin: 20px 0;
|
|
47
|
+
}
|
|
48
|
+
`).statics({ _documentType: "document" }).attrs((props) => ({
|
|
49
49
|
tag: "div",
|
|
50
50
|
_documentProps: {
|
|
51
51
|
...props.size ? { size: props.size } : { size: "A4" },
|
package/package.json
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/document-primitives",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.6",
|
|
4
|
+
"description": "Rocketstyle document components — render in browser, export to 18 formats",
|
|
5
|
+
"license": "MIT",
|
|
4
6
|
"repository": {
|
|
5
7
|
"type": "git",
|
|
6
8
|
"url": "https://github.com/pyreon/pyreon",
|
|
7
9
|
"directory": "packages/ui-system/document-primitives"
|
|
8
10
|
},
|
|
9
|
-
"description": "Rocketstyle document components — render in browser, export to 18 formats",
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"type": "module",
|
|
12
|
-
"sideEffects": false,
|
|
13
|
-
"exports": {
|
|
14
|
-
".": {
|
|
15
|
-
"bun": "./src/index.ts",
|
|
16
|
-
"import": "./lib/index.js",
|
|
17
|
-
"types": "./lib/index.d.ts"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"types": "./lib/index.d.ts",
|
|
21
|
-
"main": "./lib/index.js",
|
|
22
11
|
"files": [
|
|
23
12
|
"lib",
|
|
24
13
|
"!lib/**/*.map",
|
|
@@ -27,8 +16,16 @@
|
|
|
27
16
|
"LICENSE",
|
|
28
17
|
"src"
|
|
29
18
|
],
|
|
30
|
-
"
|
|
31
|
-
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"main": "./lib/index.js",
|
|
22
|
+
"types": "./lib/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"bun": "./src/index.ts",
|
|
26
|
+
"import": "./lib/index.js",
|
|
27
|
+
"types": "./lib/index.d.ts"
|
|
28
|
+
}
|
|
32
29
|
},
|
|
33
30
|
"publishConfig": {
|
|
34
31
|
"access": "public"
|
|
@@ -37,30 +34,34 @@
|
|
|
37
34
|
"prepublish": "bun run build",
|
|
38
35
|
"build": "bun run vl_rolldown_build",
|
|
39
36
|
"build:watch": "bun run vl_rolldown_build-watch",
|
|
40
|
-
"lint": "
|
|
37
|
+
"lint": "oxlint .",
|
|
41
38
|
"test": "vitest run",
|
|
42
39
|
"test:coverage": "vitest run --coverage",
|
|
43
40
|
"test:watch": "vitest",
|
|
44
41
|
"typecheck": "tsc --noEmit"
|
|
45
42
|
},
|
|
46
|
-
"peerDependencies": {
|
|
47
|
-
"@pyreon/core": "^0.11.5",
|
|
48
|
-
"@pyreon/document": "^0.11.5",
|
|
49
|
-
"@pyreon/elements": "^0.11.5",
|
|
50
|
-
"@pyreon/rocketstyle": "^0.11.5",
|
|
51
|
-
"@pyreon/styler": "^0.11.5",
|
|
52
|
-
"@pyreon/ui-core": "^0.11.5"
|
|
53
|
-
},
|
|
54
43
|
"dependencies": {
|
|
55
|
-
"@pyreon/connector-document": "^0.11.
|
|
44
|
+
"@pyreon/connector-document": "^0.11.6"
|
|
56
45
|
},
|
|
57
46
|
"devDependencies": {
|
|
58
|
-
"@pyreon/core": "^0.11.
|
|
59
|
-
"@pyreon/elements": "^0.11.
|
|
60
|
-
"@pyreon/rocketstyle": "^0.11.
|
|
61
|
-
"@pyreon/styler": "^0.11.
|
|
62
|
-
"@pyreon/
|
|
63
|
-
"@
|
|
64
|
-
"@pyreon/
|
|
47
|
+
"@pyreon/core": "^0.11.6",
|
|
48
|
+
"@pyreon/elements": "^0.11.6",
|
|
49
|
+
"@pyreon/rocketstyle": "^0.11.6",
|
|
50
|
+
"@pyreon/styler": "^0.11.6",
|
|
51
|
+
"@pyreon/test-utils": "^0.11.6",
|
|
52
|
+
"@pyreon/typescript": "^0.11.6",
|
|
53
|
+
"@pyreon/ui-core": "^0.11.6",
|
|
54
|
+
"@vitus-labs/tools-rolldown": "^1.15.4"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@pyreon/core": "^0.11.6",
|
|
58
|
+
"@pyreon/document": "^0.11.6",
|
|
59
|
+
"@pyreon/elements": "^0.11.6",
|
|
60
|
+
"@pyreon/rocketstyle": "^0.11.6",
|
|
61
|
+
"@pyreon/styler": "^0.11.6",
|
|
62
|
+
"@pyreon/ui-core": "^0.11.6"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">= 22"
|
|
65
66
|
}
|
|
66
67
|
}
|
package/src/DocumentPreview.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { Element } from
|
|
2
|
-
import rocketstyle from
|
|
1
|
+
import { Element } from '@pyreon/elements'
|
|
2
|
+
import rocketstyle from '@pyreon/rocketstyle'
|
|
3
3
|
|
|
4
4
|
const DocumentPreview = rocketstyle({
|
|
5
5
|
dimensions: {
|
|
6
|
-
sizes:
|
|
6
|
+
sizes: 'size',
|
|
7
7
|
},
|
|
8
8
|
useBooleans: true,
|
|
9
|
-
})({ name:
|
|
9
|
+
})({ name: 'DocumentPreview', component: Element })
|
|
10
10
|
.theme({
|
|
11
|
-
backgroundColor:
|
|
11
|
+
backgroundColor: '#f5f5f5',
|
|
12
12
|
padding: 40,
|
|
13
13
|
})
|
|
14
14
|
.sizes({
|
|
15
|
-
A4: { width:
|
|
16
|
-
A3: { width:
|
|
17
|
-
A5: { width:
|
|
18
|
-
letter: { width:
|
|
19
|
-
legal: { width:
|
|
15
|
+
A4: { width: '210mm', minHeight: '297mm' },
|
|
16
|
+
A3: { width: '297mm', minHeight: '420mm' },
|
|
17
|
+
A5: { width: '148mm', minHeight: '210mm' },
|
|
18
|
+
letter: { width: '8.5in', minHeight: '11in' },
|
|
19
|
+
legal: { width: '8.5in', minHeight: '14in' },
|
|
20
20
|
})
|
|
21
21
|
.styles(
|
|
22
22
|
(css: any) => css`
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: center;
|
|
26
|
+
min-height: 100vh;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
& > * {
|
|
29
|
+
background: white;
|
|
30
|
+
padding: 25mm;
|
|
31
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
32
|
+
margin: 20px 0;
|
|
33
|
+
}
|
|
34
|
+
`,
|
|
35
35
|
)
|
|
36
|
-
.statics({ _documentType:
|
|
36
|
+
.statics({ _documentType: 'document' as const })
|
|
37
37
|
.attrs<{
|
|
38
38
|
size?: string
|
|
39
39
|
showPageBreaks?: boolean
|
|
40
40
|
tag: string
|
|
41
41
|
_documentProps: Record<string, unknown>
|
|
42
42
|
}>((props) => ({
|
|
43
|
-
tag:
|
|
43
|
+
tag: 'div',
|
|
44
44
|
_documentProps: {
|
|
45
|
-
...(props.size ? { size: props.size } : { size:
|
|
45
|
+
...(props.size ? { size: props.size } : { size: 'A4' }),
|
|
46
46
|
...(props.showPageBreaks ? { showPageBreaks: props.showPageBreaks } : {}),
|
|
47
47
|
},
|
|
48
48
|
}))
|