@json-to-office/core-docx 2.0.0 → 2.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/dist/plugin/example/index.d.ts.map +1 -1
- package/dist/plugin/example/index.js +232 -318
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/plugin/example/plugin-demo.json +16 -93
- package/dist/plugin/example/weather.component.d.ts +73 -9
- package/dist/plugin/example/weather.component.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/plugin/example/columns-layout.component.d.ts +0 -29
- package/dist/plugin/example/columns-layout.component.d.ts.map +0 -1
- package/dist/plugin/example/eldermoor-census.component.d.ts +0 -32
- package/dist/plugin/example/eldermoor-census.component.d.ts.map +0 -1
- package/dist/plugin/example/nested-section.component.d.ts +0 -16
- package/dist/plugin/example/nested-section.component.d.ts.map +0 -1
- package/dist/plugin/example/text-space-after.component.d.ts +0 -22
- package/dist/plugin/example/text-space-after.component.d.ts.map +0 -1
|
@@ -2,48 +2,43 @@
|
|
|
2
2
|
"$schema": "../../../../../output/examples/plugin-demo-schema.json",
|
|
3
3
|
"name": "docx",
|
|
4
4
|
"props": {
|
|
5
|
-
"title": "Plugin Demo"
|
|
5
|
+
"title": "Weather Plugin Demo"
|
|
6
6
|
},
|
|
7
7
|
"children": [
|
|
8
|
-
{
|
|
9
|
-
"name": "nestedSections",
|
|
10
|
-
"props": {}
|
|
11
|
-
},
|
|
12
8
|
{
|
|
13
9
|
"name": "section",
|
|
14
10
|
"props": {
|
|
15
11
|
"meta": {
|
|
16
|
-
"title": "
|
|
12
|
+
"title": "Today"
|
|
17
13
|
}
|
|
18
14
|
},
|
|
19
15
|
"children": [
|
|
20
16
|
{
|
|
21
17
|
"name": "heading",
|
|
22
18
|
"props": {
|
|
23
|
-
"text": "
|
|
19
|
+
"text": "Today",
|
|
24
20
|
"level": 1,
|
|
25
|
-
"spacing": {
|
|
26
|
-
"before": 0,
|
|
27
|
-
"after": 0
|
|
28
|
-
}
|
|
21
|
+
"spacing": { "before": 0, "after": 0 }
|
|
29
22
|
}
|
|
30
23
|
},
|
|
31
24
|
{
|
|
32
25
|
"name": "paragraph",
|
|
33
26
|
"props": {
|
|
34
|
-
"content": "
|
|
27
|
+
"content": "Each block below is rendered by the weather plugin, which calls Open-Meteo while the document is generated."
|
|
35
28
|
}
|
|
36
29
|
},
|
|
37
30
|
{
|
|
38
31
|
"name": "weather",
|
|
32
|
+
"version": "1.0.0",
|
|
39
33
|
"props": {
|
|
40
|
-
"city": "
|
|
34
|
+
"city": "Milan",
|
|
41
35
|
"units": "metric",
|
|
42
36
|
"showDetails": true
|
|
43
37
|
}
|
|
44
38
|
},
|
|
45
39
|
{
|
|
46
40
|
"name": "weather",
|
|
41
|
+
"version": "1.0.0",
|
|
47
42
|
"props": {
|
|
48
43
|
"city": "New York",
|
|
49
44
|
"units": "imperial",
|
|
@@ -56,97 +51,25 @@
|
|
|
56
51
|
"name": "section",
|
|
57
52
|
"props": {
|
|
58
53
|
"meta": {
|
|
59
|
-
"title": "
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"children": [
|
|
63
|
-
{
|
|
64
|
-
"name": "heading",
|
|
65
|
-
"props": {
|
|
66
|
-
"text": "Sales Data",
|
|
67
|
-
"level": 1,
|
|
68
|
-
"spacing": {
|
|
69
|
-
"before": 0,
|
|
70
|
-
"after": 0
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"name": "paragraph",
|
|
76
|
-
"props": {
|
|
77
|
-
"content": "Recent sales performance:"
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"name": "dataTable",
|
|
82
|
-
"props": {
|
|
83
|
-
"query": "SELECT * FROM sales ORDER BY date DESC",
|
|
84
|
-
"title": "Q1 Sales Report",
|
|
85
|
-
"showRowNumbers": true,
|
|
86
|
-
"maxRows": 10
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"name": "section",
|
|
93
|
-
"props": {
|
|
94
|
-
"meta": {
|
|
95
|
-
"title": "Quick Links"
|
|
54
|
+
"title": "The week ahead"
|
|
96
55
|
}
|
|
97
56
|
},
|
|
98
57
|
"children": [
|
|
99
58
|
{
|
|
100
59
|
"name": "heading",
|
|
101
60
|
"props": {
|
|
102
|
-
"text": "
|
|
61
|
+
"text": "The week ahead",
|
|
103
62
|
"level": 1,
|
|
104
|
-
"spacing": {
|
|
105
|
-
"before": 0,
|
|
106
|
-
"after": 0
|
|
107
|
-
}
|
|
63
|
+
"spacing": { "before": 0, "after": 0 }
|
|
108
64
|
}
|
|
109
65
|
},
|
|
110
66
|
{
|
|
111
|
-
"name": "
|
|
112
|
-
"
|
|
113
|
-
"content": "Scan these QR codes to access our resources:"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
]
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
"name": "section",
|
|
120
|
-
"props": {
|
|
121
|
-
"meta": {
|
|
122
|
-
"title": "More Data Examples"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"children": [
|
|
126
|
-
{
|
|
127
|
-
"name": "heading",
|
|
128
|
-
"props": {
|
|
129
|
-
"text": "More Data Examples",
|
|
130
|
-
"level": 1,
|
|
131
|
-
"spacing": {
|
|
132
|
-
"before": 0,
|
|
133
|
-
"after": 0
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"name": "dataTable",
|
|
139
|
-
"props": {
|
|
140
|
-
"query": "SELECT * FROM users WHERE role = \"Admin\"",
|
|
141
|
-
"title": "System Administrators"
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"name": "dataTable",
|
|
67
|
+
"name": "weather",
|
|
68
|
+
"version": "2.0.0",
|
|
146
69
|
"props": {
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
70
|
+
"city": "Tokyo",
|
|
71
|
+
"units": "metric",
|
|
72
|
+
"days": 5
|
|
150
73
|
}
|
|
151
74
|
}
|
|
152
75
|
]
|
|
@@ -1,26 +1,90 @@
|
|
|
1
1
|
import type { ComponentDefinition } from '@json-to-office/shared-docx';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The reference example for a plugin that calls a real API.
|
|
4
|
+
*
|
|
5
|
+
* Weather comes from Open-Meteo (https://open-meteo.com) — free, no key, no
|
|
6
|
+
* attribution requirement — over two endpoints: a geocoding search that turns
|
|
7
|
+
* a city name into coordinates, then the forecast itself. Everything it needs
|
|
8
|
+
* is in the two hosts below, which is the point of the example: a plugin
|
|
9
|
+
* should be able to name what it talks to.
|
|
10
|
+
*
|
|
11
|
+
* In the playground this runs inside the browser sandbox, so both hosts have
|
|
12
|
+
* to be listed against the plugin's Network switch before either call is
|
|
13
|
+
* allowed. On disk it runs in Node, where `fetch` is global from 18 on.
|
|
14
|
+
*/
|
|
15
|
+
/** The hosts this component calls. Paste these into its Network allowlist. */
|
|
16
|
+
export declare const WEATHER_API_HOSTS: readonly ["https://geocoding-api.open-meteo.com", "https://api.open-meteo.com"];
|
|
17
|
+
export declare class WeatherLookupError extends Error {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
export interface CurrentWeather {
|
|
21
|
+
temperature: number;
|
|
22
|
+
apparent: number;
|
|
23
|
+
conditions: string;
|
|
24
|
+
humidity: number;
|
|
25
|
+
windSpeed: number;
|
|
26
|
+
pressure: number;
|
|
27
|
+
observedAt: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ForecastDay {
|
|
30
|
+
date: string;
|
|
31
|
+
high: number;
|
|
32
|
+
low: number;
|
|
33
|
+
conditions: string;
|
|
34
|
+
precipitation: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Live weather, from Open-Meteo.
|
|
4
38
|
*
|
|
5
39
|
* @example
|
|
6
40
|
* ```json
|
|
7
41
|
* {
|
|
8
42
|
* "name": "weather",
|
|
9
|
-
* "props": {
|
|
10
|
-
* "city": "London",
|
|
11
|
-
* "units": "metric",
|
|
12
|
-
* "showDetails": true
|
|
13
|
-
* }
|
|
43
|
+
* "props": { "city": "Milan", "units": "metric", "showDetails": true }
|
|
14
44
|
* }
|
|
15
45
|
* ```
|
|
16
46
|
*/
|
|
17
|
-
export declare const weatherComponent: import("
|
|
18
|
-
'1.0.0': import("
|
|
47
|
+
export declare const weatherComponent: import("@json-to-office/core-docx").CustomComponent<ComponentDefinition, {
|
|
48
|
+
'1.0.0': import("@json-to-office/core-docx").ComponentVersion<ComponentDefinition, import("@sinclair/typebox").TObject<{
|
|
19
49
|
city: import("@sinclair/typebox").TString;
|
|
20
50
|
units: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"metric">, import("@sinclair/typebox").TLiteral<"imperial">]>>;
|
|
21
51
|
showDetails: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
22
52
|
}>>;
|
|
23
|
-
'2.0.0': import("
|
|
53
|
+
'2.0.0': import("@json-to-office/core-docx").ComponentVersion<{
|
|
54
|
+
name: "heading";
|
|
55
|
+
props: {
|
|
56
|
+
level: 3;
|
|
57
|
+
text: string;
|
|
58
|
+
columns?: undefined;
|
|
59
|
+
font?: undefined;
|
|
60
|
+
};
|
|
61
|
+
} | {
|
|
62
|
+
name: "table";
|
|
63
|
+
props: {
|
|
64
|
+
columns: {
|
|
65
|
+
header: {
|
|
66
|
+
content: string;
|
|
67
|
+
};
|
|
68
|
+
cells: {
|
|
69
|
+
content: string;
|
|
70
|
+
}[];
|
|
71
|
+
}[];
|
|
72
|
+
level?: undefined;
|
|
73
|
+
text?: undefined;
|
|
74
|
+
font?: undefined;
|
|
75
|
+
};
|
|
76
|
+
} | {
|
|
77
|
+
name: "paragraph";
|
|
78
|
+
props: {
|
|
79
|
+
text: string;
|
|
80
|
+
font: {
|
|
81
|
+
size: number;
|
|
82
|
+
italic: true;
|
|
83
|
+
};
|
|
84
|
+
level?: undefined;
|
|
85
|
+
columns?: undefined;
|
|
86
|
+
};
|
|
87
|
+
}, import("@sinclair/typebox").TObject<{
|
|
24
88
|
city: import("@sinclair/typebox").TString;
|
|
25
89
|
units: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"metric">, import("@sinclair/typebox").TLiteral<"imperial">]>>;
|
|
26
90
|
days: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weather.component.d.ts","sourceRoot":"","sources":["../../../src/plugin/example/weather.component.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"weather.component.d.ts","sourceRoot":"","sources":["../../../src/plugin/example/weather.component.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE;;;;;;;;;;;;GAYG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,iFAGpB,CAAC;AA6FX,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAsED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAmCD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAiDD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA+H3B,CAAC"}
|