@dosgato/templating 0.0.5 → 0.0.8
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/links.d.ts +4 -6
- package/dist/provider.d.ts +30 -16
- package/dist/provider.js +10 -1
- package/dist/uitemplate.d.ts +8 -0
- package/dist/uitemplate.js +2 -0
- package/package.json +5 -2
package/dist/links.d.ts
CHANGED
|
@@ -7,9 +7,8 @@ export interface AssetLink {
|
|
|
7
7
|
type: 'asset';
|
|
8
8
|
source: string;
|
|
9
9
|
id: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
checksum: string;
|
|
10
|
+
path?: string;
|
|
11
|
+
checksum?: string;
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
14
|
* Some components (e.g. document list) can point at a folder instead of individual
|
|
@@ -20,7 +19,6 @@ export interface AssetFolderLink {
|
|
|
20
19
|
type: 'assetfolder';
|
|
21
20
|
source: string;
|
|
22
21
|
id: string;
|
|
23
|
-
siteId: string;
|
|
24
22
|
path: string;
|
|
25
23
|
}
|
|
26
24
|
/**
|
|
@@ -29,7 +27,6 @@ export interface AssetFolderLink {
|
|
|
29
27
|
export interface PageLink {
|
|
30
28
|
type: 'page';
|
|
31
29
|
linkId: string;
|
|
32
|
-
siteId: string;
|
|
33
30
|
path: string;
|
|
34
31
|
}
|
|
35
32
|
/**
|
|
@@ -50,8 +47,9 @@ export interface WebLink {
|
|
|
50
47
|
*/
|
|
51
48
|
export interface DataLink {
|
|
52
49
|
type: 'data';
|
|
50
|
+
templateKey: string;
|
|
53
51
|
id: string;
|
|
54
|
-
siteId
|
|
52
|
+
siteId?: string;
|
|
55
53
|
path: string;
|
|
56
54
|
}
|
|
57
55
|
/**
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
export interface CSSBlock {
|
|
2
|
+
css?: string;
|
|
3
|
+
path?: string;
|
|
4
|
+
version?: string;
|
|
5
|
+
async?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface JSBlock {
|
|
8
|
+
js?: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
version?: string;
|
|
11
|
+
async?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface FileDeclaration {
|
|
14
|
+
path: string;
|
|
15
|
+
version?: string;
|
|
16
|
+
mime: string;
|
|
17
|
+
}
|
|
1
18
|
/**
|
|
2
19
|
* This class is a parent class for Component, but it can also be used as a standalone
|
|
3
20
|
* if you are creating a set of templates with shared resources. This will be fairly
|
|
@@ -20,22 +37,23 @@ export declare abstract class ResourceProvider {
|
|
|
20
37
|
* version number of any given name will be used. Other versions of that name will be ignored.
|
|
21
38
|
*
|
|
22
39
|
* For convenience you can either provide the `css` property with the CSS as a string, or the
|
|
23
|
-
* `path` property with the full server path to a CSS file (node's __dirname function will
|
|
40
|
+
* `path` property with the full server path (NOT URL) to a CSS file (node's __dirname function will
|
|
24
41
|
* help you determine it). You MUST provide one or the other.
|
|
42
|
+
*
|
|
43
|
+
* You may also set `async` to true if a css block is not needed for the initial render of
|
|
44
|
+
* the page. For instance, if your component has a modal that the user can trigger, you can
|
|
45
|
+
* defer the CSS for that modal since it will not be needed until the page has gone interactive
|
|
46
|
+
* and the user has clicked something.
|
|
25
47
|
*/
|
|
26
|
-
static cssBlocks: Map<string,
|
|
27
|
-
css?: string;
|
|
28
|
-
path?: string;
|
|
29
|
-
version?: string;
|
|
30
|
-
}>;
|
|
48
|
+
static cssBlocks: Map<string, CSSBlock>;
|
|
31
49
|
/**
|
|
32
50
|
* Same as cssBlocks() but for javascript.
|
|
51
|
+
*
|
|
52
|
+
* In this case `async` is much more useful, as most javascript is interactive and could run
|
|
53
|
+
* after the page renders. Any code that adds event observers or the like should be marked with
|
|
54
|
+
* async to improve the initial render time.
|
|
33
55
|
*/
|
|
34
|
-
static jsBlocks: Map<string,
|
|
35
|
-
js?: string;
|
|
36
|
-
path?: string;
|
|
37
|
-
version?: string;
|
|
38
|
-
}>;
|
|
56
|
+
static jsBlocks: Map<string, JSBlock>;
|
|
39
57
|
/**
|
|
40
58
|
* If your template needs to serve any files, like fonts or images, you can provide
|
|
41
59
|
* a filesystem path in this static property and the files will be served by the rendering
|
|
@@ -58,11 +76,7 @@ export declare abstract class ResourceProvider {
|
|
|
58
76
|
* DO NOT change the mime type without changing the name. Other templates could end up with
|
|
59
77
|
* the wrong file extension.
|
|
60
78
|
*/
|
|
61
|
-
static files: Map<string,
|
|
62
|
-
path: string;
|
|
63
|
-
version?: string;
|
|
64
|
-
mime: string;
|
|
65
|
-
}>;
|
|
79
|
+
static files: Map<string, FileDeclaration>;
|
|
66
80
|
/**
|
|
67
81
|
* Template code will need to generate HTML and CSS that points at the static files
|
|
68
82
|
* provided above. In order to do so, we need information from the template registry (since
|
package/dist/provider.js
CHANGED
|
@@ -27,12 +27,21 @@ exports.ResourceProvider = ResourceProvider;
|
|
|
27
27
|
* version number of any given name will be used. Other versions of that name will be ignored.
|
|
28
28
|
*
|
|
29
29
|
* For convenience you can either provide the `css` property with the CSS as a string, or the
|
|
30
|
-
* `path` property with the full server path to a CSS file (node's __dirname function will
|
|
30
|
+
* `path` property with the full server path (NOT URL) to a CSS file (node's __dirname function will
|
|
31
31
|
* help you determine it). You MUST provide one or the other.
|
|
32
|
+
*
|
|
33
|
+
* You may also set `async` to true if a css block is not needed for the initial render of
|
|
34
|
+
* the page. For instance, if your component has a modal that the user can trigger, you can
|
|
35
|
+
* defer the CSS for that modal since it will not be needed until the page has gone interactive
|
|
36
|
+
* and the user has clicked something.
|
|
32
37
|
*/
|
|
33
38
|
ResourceProvider.cssBlocks = new Map();
|
|
34
39
|
/**
|
|
35
40
|
* Same as cssBlocks() but for javascript.
|
|
41
|
+
*
|
|
42
|
+
* In this case `async` is much more useful, as most javascript is interactive and could run
|
|
43
|
+
* after the page renders. Any code that adds event observers or the like should be marked with
|
|
44
|
+
* async to improve the initial render time.
|
|
36
45
|
*/
|
|
37
46
|
ResourceProvider.jsBlocks = new Map();
|
|
38
47
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dosgato/templating",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "A library to support building templates for dosgato CMS.",
|
|
5
5
|
"exports": {
|
|
6
6
|
"require": "./dist/index.js",
|
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
"prepublishOnly": "npm run build",
|
|
12
12
|
"build": "rm -rf dist && tsc"
|
|
13
13
|
},
|
|
14
|
-
"dependencies": {
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@iconify/svelte": "^2.2.1",
|
|
16
|
+
"svelte": "^3.48.0"
|
|
17
|
+
},
|
|
15
18
|
"devDependencies": {
|
|
16
19
|
"eslint-config-standard-with-typescript": "^21.0.1",
|
|
17
20
|
"typescript": "^4.4.2"
|