@tramvai/tokens-render 1.35.6 → 1.37.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/README.md +2 -2
- package/lib/index.d.ts +27 -26
- package/lib/index.es.js +27 -26
- package/lib/index.js +27 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Render tokens
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Tramvai tokens for integration and extending render module.
|
|
4
4
|
|
|
5
5
|
## Список токенов
|
|
6
6
|
|
|
7
7
|
@inline src/index.ts
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Render slots
|
|
10
10
|
|
|
11
11
|
@inline src/slots.ts
|
package/lib/index.d.ts
CHANGED
|
@@ -3,18 +3,18 @@ import { StorageRecord } from '@tinkoff/htmlpagebuilder';
|
|
|
3
3
|
import * as ResourceSlot from './slots';
|
|
4
4
|
/**
|
|
5
5
|
* @description
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Token adding resources to specific render slots.
|
|
7
|
+
* Used only on server and it is equivalent to usage of RESOURCES_REGISTRY.
|
|
8
8
|
*
|
|
9
|
-
* [
|
|
9
|
+
* [Usage example](https://tramvai.dev/docs/how-to/render-add-resources)
|
|
10
10
|
*/
|
|
11
11
|
export declare const RENDER_SLOTS: PageResource | PageResource[];
|
|
12
12
|
/**
|
|
13
13
|
* @description
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
* Token for defining additional attributes for html, body and app container. Keep in mind that:
|
|
15
|
+
* - only raw html attributes are allowed (not react or anything else, e.g. do not use className use class)
|
|
16
|
+
* - new attributes overrides old one
|
|
17
|
+
* - only text values are supported
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
```tsx
|
|
@@ -33,60 +33,61 @@ export declare const RENDER_SLOTS: PageResource | PageResource[];
|
|
|
33
33
|
export declare const HTML_ATTRS: HtmlAttrs;
|
|
34
34
|
/**
|
|
35
35
|
* @description
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* Add node-style callback on render event in browser.
|
|
37
|
+
* Passes error instance as first argument if there was an error
|
|
38
38
|
*/
|
|
39
39
|
export declare const RENDERER_CALLBACK: ((e?: Error) => void)[];
|
|
40
40
|
/**
|
|
41
41
|
* @description
|
|
42
|
-
*
|
|
42
|
+
* Used as async function which overrides app render. This function may define render parameters or override render result.
|
|
43
43
|
*/
|
|
44
44
|
export declare const CUSTOM_RENDER: any;
|
|
45
45
|
/**
|
|
46
46
|
* @description
|
|
47
|
-
*
|
|
47
|
+
* Resources registry is used only on server for registering any additional assets for browser (scripts, styles, html) which should be added to response html page
|
|
48
48
|
*/
|
|
49
49
|
export declare const RESOURCES_REGISTRY: ResourcesRegistry;
|
|
50
50
|
/**
|
|
51
51
|
* @description
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* A string used for check of need to loading polyfills in the client browser.
|
|
53
|
+
* Polyfills are always loading for browsers without module support and if browser do support modules
|
|
54
|
+
* this check will called in order to find out the need of loading polyfills
|
|
55
|
+
* (by default checks for Promise.prototype.finally and implementations for URL and URLSearchParams)
|
|
55
56
|
*
|
|
56
|
-
* [
|
|
57
|
+
* [Polyfill documentation](https://tramvai.dev/docs/how-to/how-to-enable-polyfills)
|
|
57
58
|
*/
|
|
58
59
|
export declare const POLYFILL_CONDITION: string;
|
|
59
60
|
/**
|
|
60
61
|
* @description
|
|
61
|
-
*
|
|
62
|
+
* Allows to specify different modes for React Render - `strict`, `blocking`, `concurrent`, by default value `legacy` is used
|
|
62
63
|
*
|
|
63
|
-
* [
|
|
64
|
+
* [More details in doc for module-render](https://tramvai.dev/docs/references/modules/render)
|
|
64
65
|
*/
|
|
65
66
|
export declare const RENDER_MODE: RenderMode;
|
|
66
67
|
/**
|
|
67
68
|
* @description
|
|
68
|
-
*
|
|
69
|
-
*
|
|
69
|
+
* A wrapper for app render.
|
|
70
|
+
* Through that token is possible to specify for example React.Context.Provider for the app
|
|
70
71
|
*/
|
|
71
72
|
export declare const EXTEND_RENDER: ((current: ReactElement) => ReactElement)[];
|
|
72
73
|
/**
|
|
73
74
|
* @description
|
|
74
|
-
*
|
|
75
|
+
* Token for default layout for page
|
|
75
76
|
*/
|
|
76
77
|
export declare const DEFAULT_LAYOUT_COMPONENT: any;
|
|
77
78
|
/**
|
|
78
79
|
* @description
|
|
79
|
-
*
|
|
80
|
+
* Token for default header for page
|
|
80
81
|
*/
|
|
81
82
|
export declare const DEFAULT_HEADER_COMPONENT: any;
|
|
82
83
|
/**
|
|
83
84
|
* @description
|
|
84
|
-
*
|
|
85
|
+
* Token for default footer for page
|
|
85
86
|
*/
|
|
86
87
|
export declare const DEFAULT_FOOTER_COMPONENT: any;
|
|
87
88
|
/**
|
|
88
89
|
* @description
|
|
89
|
-
*
|
|
90
|
+
* Token for passing parameters for page layout
|
|
90
91
|
*/
|
|
91
92
|
export declare const LAYOUT_OPTIONS: LayoutOptions[];
|
|
92
93
|
declare type ReactComponent = ComponentType<any>;
|
|
@@ -118,9 +119,9 @@ declare type ResourceInlineOptions = {
|
|
|
118
119
|
};
|
|
119
120
|
/**
|
|
120
121
|
* @description
|
|
121
|
-
*
|
|
122
|
-
* * threshold
|
|
123
|
-
* * types
|
|
122
|
+
* Settings for HTML resources inlining
|
|
123
|
+
* * threshold Maximum value (in bytes) of the file which are getting inlined in HTML page
|
|
124
|
+
* * types Types of resources which should be inlined
|
|
124
125
|
*/
|
|
125
126
|
export declare const RESOURCE_INLINE_OPTIONS: ResourceInlineOptions;
|
|
126
127
|
export { ResourceSlot };
|
package/lib/index.es.js
CHANGED
|
@@ -34,20 +34,20 @@ var slots = {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* @description
|
|
37
|
-
*
|
|
38
|
-
*
|
|
37
|
+
* Token adding resources to specific render slots.
|
|
38
|
+
* Used only on server and it is equivalent to usage of RESOURCES_REGISTRY.
|
|
39
39
|
*
|
|
40
|
-
* [
|
|
40
|
+
* [Usage example](https://tramvai.dev/docs/how-to/render-add-resources)
|
|
41
41
|
*/
|
|
42
42
|
const RENDER_SLOTS = createToken('RENDER_SLOTS', {
|
|
43
43
|
multi: true,
|
|
44
44
|
});
|
|
45
45
|
/**
|
|
46
46
|
* @description
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
* Token for defining additional attributes for html, body and app container. Keep in mind that:
|
|
48
|
+
* - only raw html attributes are allowed (not react or anything else, e.g. do not use className use class)
|
|
49
|
+
* - new attributes overrides old one
|
|
50
|
+
* - only text values are supported
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
```tsx
|
|
@@ -66,71 +66,72 @@ const RENDER_SLOTS = createToken('RENDER_SLOTS', {
|
|
|
66
66
|
const HTML_ATTRS = createToken('HTML_ATTRS', { multi: true });
|
|
67
67
|
/**
|
|
68
68
|
* @description
|
|
69
|
-
*
|
|
70
|
-
*
|
|
69
|
+
* Add node-style callback on render event in browser.
|
|
70
|
+
* Passes error instance as first argument if there was an error
|
|
71
71
|
*/
|
|
72
72
|
const RENDERER_CALLBACK = createToken('RENDERER_CALLBACK', {
|
|
73
73
|
multi: true,
|
|
74
74
|
});
|
|
75
75
|
/**
|
|
76
76
|
* @description
|
|
77
|
-
*
|
|
77
|
+
* Used as async function which overrides app render. This function may define render parameters or override render result.
|
|
78
78
|
*/
|
|
79
79
|
const CUSTOM_RENDER = createToken('CUSTOM_RENDER');
|
|
80
80
|
/**
|
|
81
81
|
* @description
|
|
82
|
-
*
|
|
82
|
+
* Resources registry is used only on server for registering any additional assets for browser (scripts, styles, html) which should be added to response html page
|
|
83
83
|
*/
|
|
84
84
|
const RESOURCES_REGISTRY = createToken('resourcesRegistry');
|
|
85
85
|
/**
|
|
86
86
|
* @description
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
87
|
+
* A string used for check of need to loading polyfills in the client browser.
|
|
88
|
+
* Polyfills are always loading for browsers without module support and if browser do support modules
|
|
89
|
+
* this check will called in order to find out the need of loading polyfills
|
|
90
|
+
* (by default checks for Promise.prototype.finally and implementations for URL and URLSearchParams)
|
|
90
91
|
*
|
|
91
|
-
* [
|
|
92
|
+
* [Polyfill documentation](https://tramvai.dev/docs/how-to/how-to-enable-polyfills)
|
|
92
93
|
*/
|
|
93
94
|
const POLYFILL_CONDITION = createToken('POLYFILL_CONDITION');
|
|
94
95
|
/**
|
|
95
96
|
* @description
|
|
96
|
-
*
|
|
97
|
+
* Allows to specify different modes for React Render - `strict`, `blocking`, `concurrent`, by default value `legacy` is used
|
|
97
98
|
*
|
|
98
|
-
* [
|
|
99
|
+
* [More details in doc for module-render](https://tramvai.dev/docs/references/modules/render)
|
|
99
100
|
*/
|
|
100
101
|
const RENDER_MODE = createToken('RENDER_MODE');
|
|
101
102
|
/**
|
|
102
103
|
* @description
|
|
103
|
-
*
|
|
104
|
-
*
|
|
104
|
+
* A wrapper for app render.
|
|
105
|
+
* Through that token is possible to specify for example React.Context.Provider for the app
|
|
105
106
|
*/
|
|
106
107
|
const EXTEND_RENDER = createToken('EXTEND_RENDER', {
|
|
107
108
|
multi: true,
|
|
108
109
|
});
|
|
109
110
|
/**
|
|
110
111
|
* @description
|
|
111
|
-
*
|
|
112
|
+
* Token for default layout for page
|
|
112
113
|
*/
|
|
113
114
|
const DEFAULT_LAYOUT_COMPONENT = createToken('defaultLayoutComponent');
|
|
114
115
|
/**
|
|
115
116
|
* @description
|
|
116
|
-
*
|
|
117
|
+
* Token for default header for page
|
|
117
118
|
*/
|
|
118
119
|
const DEFAULT_HEADER_COMPONENT = createToken('defaultHeaderComponent');
|
|
119
120
|
/**
|
|
120
121
|
* @description
|
|
121
|
-
*
|
|
122
|
+
* Token for default footer for page
|
|
122
123
|
*/
|
|
123
124
|
const DEFAULT_FOOTER_COMPONENT = createToken('defaultFooterComponent');
|
|
124
125
|
/**
|
|
125
126
|
* @description
|
|
126
|
-
*
|
|
127
|
+
* Token for passing parameters for page layout
|
|
127
128
|
*/
|
|
128
129
|
const LAYOUT_OPTIONS = createToken('layoutOptions', { multi: true });
|
|
129
130
|
/**
|
|
130
131
|
* @description
|
|
131
|
-
*
|
|
132
|
-
* * threshold
|
|
133
|
-
* * types
|
|
132
|
+
* Settings for HTML resources inlining
|
|
133
|
+
* * threshold Maximum value (in bytes) of the file which are getting inlined in HTML page
|
|
134
|
+
* * types Types of resources which should be inlined
|
|
134
135
|
*/
|
|
135
136
|
const RESOURCE_INLINE_OPTIONS = createToken('resourceInlineThreshold');
|
|
136
137
|
|
package/lib/index.js
CHANGED
|
@@ -38,20 +38,20 @@ var slots = {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* @description
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* Token adding resources to specific render slots.
|
|
42
|
+
* Used only on server and it is equivalent to usage of RESOURCES_REGISTRY.
|
|
43
43
|
*
|
|
44
|
-
* [
|
|
44
|
+
* [Usage example](https://tramvai.dev/docs/how-to/render-add-resources)
|
|
45
45
|
*/
|
|
46
46
|
const RENDER_SLOTS = dippy.createToken('RENDER_SLOTS', {
|
|
47
47
|
multi: true,
|
|
48
48
|
});
|
|
49
49
|
/**
|
|
50
50
|
* @description
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
* Token for defining additional attributes for html, body and app container. Keep in mind that:
|
|
52
|
+
* - only raw html attributes are allowed (not react or anything else, e.g. do not use className use class)
|
|
53
|
+
* - new attributes overrides old one
|
|
54
|
+
* - only text values are supported
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
57
|
```tsx
|
|
@@ -70,71 +70,72 @@ const RENDER_SLOTS = dippy.createToken('RENDER_SLOTS', {
|
|
|
70
70
|
const HTML_ATTRS = dippy.createToken('HTML_ATTRS', { multi: true });
|
|
71
71
|
/**
|
|
72
72
|
* @description
|
|
73
|
-
*
|
|
74
|
-
*
|
|
73
|
+
* Add node-style callback on render event in browser.
|
|
74
|
+
* Passes error instance as first argument if there was an error
|
|
75
75
|
*/
|
|
76
76
|
const RENDERER_CALLBACK = dippy.createToken('RENDERER_CALLBACK', {
|
|
77
77
|
multi: true,
|
|
78
78
|
});
|
|
79
79
|
/**
|
|
80
80
|
* @description
|
|
81
|
-
*
|
|
81
|
+
* Used as async function which overrides app render. This function may define render parameters or override render result.
|
|
82
82
|
*/
|
|
83
83
|
const CUSTOM_RENDER = dippy.createToken('CUSTOM_RENDER');
|
|
84
84
|
/**
|
|
85
85
|
* @description
|
|
86
|
-
*
|
|
86
|
+
* Resources registry is used only on server for registering any additional assets for browser (scripts, styles, html) which should be added to response html page
|
|
87
87
|
*/
|
|
88
88
|
const RESOURCES_REGISTRY = dippy.createToken('resourcesRegistry');
|
|
89
89
|
/**
|
|
90
90
|
* @description
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
91
|
+
* A string used for check of need to loading polyfills in the client browser.
|
|
92
|
+
* Polyfills are always loading for browsers without module support and if browser do support modules
|
|
93
|
+
* this check will called in order to find out the need of loading polyfills
|
|
94
|
+
* (by default checks for Promise.prototype.finally and implementations for URL and URLSearchParams)
|
|
94
95
|
*
|
|
95
|
-
* [
|
|
96
|
+
* [Polyfill documentation](https://tramvai.dev/docs/how-to/how-to-enable-polyfills)
|
|
96
97
|
*/
|
|
97
98
|
const POLYFILL_CONDITION = dippy.createToken('POLYFILL_CONDITION');
|
|
98
99
|
/**
|
|
99
100
|
* @description
|
|
100
|
-
*
|
|
101
|
+
* Allows to specify different modes for React Render - `strict`, `blocking`, `concurrent`, by default value `legacy` is used
|
|
101
102
|
*
|
|
102
|
-
* [
|
|
103
|
+
* [More details in doc for module-render](https://tramvai.dev/docs/references/modules/render)
|
|
103
104
|
*/
|
|
104
105
|
const RENDER_MODE = dippy.createToken('RENDER_MODE');
|
|
105
106
|
/**
|
|
106
107
|
* @description
|
|
107
|
-
*
|
|
108
|
-
*
|
|
108
|
+
* A wrapper for app render.
|
|
109
|
+
* Through that token is possible to specify for example React.Context.Provider for the app
|
|
109
110
|
*/
|
|
110
111
|
const EXTEND_RENDER = dippy.createToken('EXTEND_RENDER', {
|
|
111
112
|
multi: true,
|
|
112
113
|
});
|
|
113
114
|
/**
|
|
114
115
|
* @description
|
|
115
|
-
*
|
|
116
|
+
* Token for default layout for page
|
|
116
117
|
*/
|
|
117
118
|
const DEFAULT_LAYOUT_COMPONENT = dippy.createToken('defaultLayoutComponent');
|
|
118
119
|
/**
|
|
119
120
|
* @description
|
|
120
|
-
*
|
|
121
|
+
* Token for default header for page
|
|
121
122
|
*/
|
|
122
123
|
const DEFAULT_HEADER_COMPONENT = dippy.createToken('defaultHeaderComponent');
|
|
123
124
|
/**
|
|
124
125
|
* @description
|
|
125
|
-
*
|
|
126
|
+
* Token for default footer for page
|
|
126
127
|
*/
|
|
127
128
|
const DEFAULT_FOOTER_COMPONENT = dippy.createToken('defaultFooterComponent');
|
|
128
129
|
/**
|
|
129
130
|
* @description
|
|
130
|
-
*
|
|
131
|
+
* Token for passing parameters for page layout
|
|
131
132
|
*/
|
|
132
133
|
const LAYOUT_OPTIONS = dippy.createToken('layoutOptions', { multi: true });
|
|
133
134
|
/**
|
|
134
135
|
* @description
|
|
135
|
-
*
|
|
136
|
-
* * threshold
|
|
137
|
-
* * types
|
|
136
|
+
* Settings for HTML resources inlining
|
|
137
|
+
* * threshold Maximum value (in bytes) of the file which are getting inlined in HTML page
|
|
138
|
+
* * types Types of resources which should be inlined
|
|
138
139
|
*/
|
|
139
140
|
const RESOURCE_INLINE_OPTIONS = dippy.createToken('resourceInlineThreshold');
|
|
140
141
|
|