@dosgato/templating 0.0.58 → 0.0.59
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/component.d.ts +9 -0
- package/dist/component.js +1 -0
- package/dist/provider.d.ts +13 -3
- package/dist/provider.js +0 -3
- package/dist/render.d.ts +8 -0
- package/package.json +1 -1
package/dist/component.d.ts
CHANGED
|
@@ -233,6 +233,15 @@ export interface RenderedComponent<C extends Component = Component> {
|
|
|
233
233
|
output: string;
|
|
234
234
|
}
|
|
235
235
|
export declare abstract class Page<DataType extends PageData = any, FetchedType = any, RenderContextType extends ContextBase = any> extends Component<DataType, FetchedType, RenderContextType> {
|
|
236
|
+
/**
|
|
237
|
+
* The page id in case you need to pass it to the API, e.g. this.api.getRootPage(this.id)
|
|
238
|
+
* in a page template or this.api.getRootPage(this.page.id) in a component template.
|
|
239
|
+
*/
|
|
240
|
+
id: string;
|
|
241
|
+
/**
|
|
242
|
+
* The page path, can also be used to figure out where the page is, but you'll likely prefer
|
|
243
|
+
* using the page id in API queries
|
|
244
|
+
*/
|
|
236
245
|
pagePath: string;
|
|
237
246
|
/**
|
|
238
247
|
* This will be filled by the rendering server. The template properties are described
|
package/dist/component.js
CHANGED
|
@@ -176,6 +176,7 @@ export class Page extends Component {
|
|
|
176
176
|
constructor(page, editMode) {
|
|
177
177
|
super(page.data, '', undefined, editMode);
|
|
178
178
|
this.pagePath = page.path;
|
|
179
|
+
this.id = page.id;
|
|
179
180
|
}
|
|
180
181
|
passError(e, path) {
|
|
181
182
|
console.warn(`Recoverable issue occured during render of ${this.pagePath}. Component at ${path} threw the following error:`, e);
|
package/dist/provider.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export interface CSSBlock {
|
|
|
5
5
|
css?: string;
|
|
6
6
|
/**
|
|
7
7
|
* A file path to the CSS. The rendering server will read the file on startup.
|
|
8
|
+
*
|
|
9
|
+
* Typically you will set this with import.meta.url so that the path will be relative
|
|
10
|
+
* to the javascript code where you are writing your template class:
|
|
11
|
+
* path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../static/mystyles.css')
|
|
8
12
|
*/
|
|
9
13
|
path?: string;
|
|
10
14
|
/**
|
|
@@ -35,6 +39,11 @@ export interface JSBlock {
|
|
|
35
39
|
js?: string;
|
|
36
40
|
/**
|
|
37
41
|
* A file path to the javascript. The rendering server will read the file on startup.
|
|
42
|
+
*
|
|
43
|
+
* Typically you will set this with import.meta.url so that the path will be relative
|
|
44
|
+
* to the javascript code where you are writing your template class:
|
|
45
|
+
* path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../static/myscript.js')
|
|
46
|
+
|
|
38
47
|
*/
|
|
39
48
|
path?: string;
|
|
40
49
|
/**
|
|
@@ -60,6 +69,10 @@ export interface JSBlock {
|
|
|
60
69
|
export interface FileDeclaration {
|
|
61
70
|
/**
|
|
62
71
|
* The path to the file.
|
|
72
|
+
*
|
|
73
|
+
* Typically you will set this with import.meta.url so that the path will be relative
|
|
74
|
+
* to the javascript code where you are writing your template class:
|
|
75
|
+
* path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../static/myfont.ttf')
|
|
63
76
|
*/
|
|
64
77
|
path: string;
|
|
65
78
|
/**
|
|
@@ -154,9 +167,6 @@ export declare abstract class ResourceProvider {
|
|
|
154
167
|
* server. Use the provided `webpaths` map to obtain the proper resource URLs. They will be
|
|
155
168
|
* available as soon as your template has been registered to the rendering server's templateRegistry.
|
|
156
169
|
*
|
|
157
|
-
* Typically you will set this to something like `${__dirname}/static` so that the path will be relative
|
|
158
|
-
* to where you are writing your template class.
|
|
159
|
-
*
|
|
160
170
|
* The map name you pick should be globally unique and only collide with other templates as
|
|
161
171
|
* intended. For instance, the fontawesome font only needs to be provided once, even though
|
|
162
172
|
* several templates might depend on it. Setting the name as 'fontawesome5' on all three
|
package/dist/provider.js
CHANGED
|
@@ -59,9 +59,6 @@ ResourceProvider.jsBlocks = new Map();
|
|
|
59
59
|
* server. Use the provided `webpaths` map to obtain the proper resource URLs. They will be
|
|
60
60
|
* available as soon as your template has been registered to the rendering server's templateRegistry.
|
|
61
61
|
*
|
|
62
|
-
* Typically you will set this to something like `${__dirname}/static` so that the path will be relative
|
|
63
|
-
* to where you are writing your template class.
|
|
64
|
-
*
|
|
65
62
|
* The map name you pick should be globally unique and only collide with other templates as
|
|
66
63
|
* intended. For instance, the fontawesome font only needs to be provided once, even though
|
|
67
64
|
* several templates might depend on it. Setting the name as 'fontawesome5' on all three
|
package/dist/render.d.ts
CHANGED
|
@@ -50,6 +50,14 @@ export interface APIClient {
|
|
|
50
50
|
absolute?: boolean;
|
|
51
51
|
extension?: string;
|
|
52
52
|
}) => Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Get a link href for a page
|
|
55
|
+
*
|
|
56
|
+
* By default this will generate relative links based on the page currently being rendered. Set
|
|
57
|
+
* absolute: true to generate a full URL suitable for a backend http request or non-HTML document
|
|
58
|
+
* like an RSS feed.
|
|
59
|
+
*/
|
|
60
|
+
getHref: (page: PageRecord, absolute?: boolean) => string;
|
|
53
61
|
/**
|
|
54
62
|
* This function will be provided by the rendering server and should be used inside your fetch
|
|
55
63
|
* method to prepare editor-provided HTML for rendering. It will do things like find and resolve
|