@contrail/documents 1.0.28 → 1.0.29

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.
@@ -1,123 +1,236 @@
1
- import { Document } from '../types/document';
2
- export interface ComponentDefinition {
3
- slug: string;
4
- defaultTemplate: Document;
5
- }
6
- export declare const ITEM_VIEW_TEMPLATE: {
7
- elements: ({
8
- type: string;
9
- size: {
10
- width: number;
11
- height: number;
12
- };
13
- propertyBindings: {
14
- url: string;
15
- text?: undefined;
16
- };
17
- position?: undefined;
18
- style?: undefined;
19
- } | {
20
- type: string;
21
- position: {
22
- x: number;
23
- y: number;
24
- };
25
- size: {
26
- height: number;
27
- width: number;
28
- };
29
- style: {
30
- font: {
31
- size: number;
32
- };
33
- color?: undefined;
34
- };
35
- propertyBindings: {
36
- text: string;
37
- url?: undefined;
38
- };
39
- } | {
40
- type: string;
41
- position: {
42
- x: number;
43
- y: number;
44
- };
45
- size: {
46
- height: number;
47
- width: number;
48
- };
49
- style: {
50
- font: {
51
- size: number;
52
- };
53
- color: string;
54
- };
55
- propertyBindings: {
56
- text: string;
57
- url?: undefined;
58
- };
59
- })[];
60
- };
61
- export declare const ITEM_VIEW: {
62
- slug: string;
63
- defaultTemplate: {
64
- elements: ({
65
- type: string;
66
- size: {
67
- width: number;
68
- height: number;
69
- };
70
- propertyBindings: {
71
- url: string;
72
- text?: undefined;
73
- };
74
- position?: undefined;
75
- style?: undefined;
76
- } | {
77
- type: string;
78
- position: {
79
- x: number;
80
- y: number;
81
- };
82
- size: {
83
- height: number;
84
- width: number;
85
- };
86
- style: {
87
- font: {
88
- size: number;
89
- };
90
- color?: undefined;
91
- };
92
- propertyBindings: {
93
- text: string;
94
- url?: undefined;
95
- };
96
- } | {
97
- type: string;
98
- position: {
99
- x: number;
100
- y: number;
101
- };
102
- size: {
103
- height: number;
104
- width: number;
105
- };
106
- style: {
107
- font: {
108
- size: number;
109
- };
110
- color: string;
111
- };
112
- propertyBindings: {
113
- text: string;
114
- url?: undefined;
115
- };
116
- })[];
117
- };
118
- };
119
- export declare class ComponentRegistry {
120
- private static componentDefinitionMap;
121
- static getComponentDefinition(slug: string): ComponentDefinition;
122
- private static initMap;
123
- }
1
+ import { Document } from '../types/document';
2
+ export interface ComponentDefinition {
3
+ slug: string;
4
+ defaultTemplate: Document;
5
+ }
6
+ export declare const ITEM_VIEW_TEMPLATE: {
7
+ elements: ({
8
+ type: string;
9
+ size: {
10
+ width: number;
11
+ height: number;
12
+ };
13
+ propertyBindings: {
14
+ url: string;
15
+ text?: undefined;
16
+ };
17
+ position?: undefined;
18
+ style?: undefined;
19
+ } | {
20
+ type: string;
21
+ position: {
22
+ x: number;
23
+ y: number;
24
+ };
25
+ size: {
26
+ height: number;
27
+ width: number;
28
+ };
29
+ style: {
30
+ font: {
31
+ size: number;
32
+ };
33
+ color?: undefined;
34
+ };
35
+ propertyBindings: {
36
+ text: string;
37
+ url?: undefined;
38
+ };
39
+ } | {
40
+ type: string;
41
+ position: {
42
+ x: number;
43
+ y: number;
44
+ };
45
+ size: {
46
+ height: number;
47
+ width: number;
48
+ };
49
+ style: {
50
+ font: {
51
+ size: number;
52
+ };
53
+ color: string;
54
+ };
55
+ propertyBindings: {
56
+ text: string;
57
+ url?: undefined;
58
+ };
59
+ })[];
60
+ };
61
+ export declare const ITEM_VIEW_TEMPLATE_V2: {
62
+ elements: ({
63
+ type: string;
64
+ size: {
65
+ width: number;
66
+ height: number;
67
+ };
68
+ propertyBindings: {
69
+ url: string;
70
+ text?: undefined;
71
+ };
72
+ position?: undefined;
73
+ style?: undefined;
74
+ } | {
75
+ type: string;
76
+ position: {
77
+ x: number;
78
+ y: number;
79
+ };
80
+ size: {
81
+ height: number;
82
+ width: number;
83
+ };
84
+ style: {
85
+ font: {
86
+ size: number;
87
+ };
88
+ color?: undefined;
89
+ };
90
+ propertyBindings: {
91
+ text: string;
92
+ url?: undefined;
93
+ };
94
+ } | {
95
+ type: string;
96
+ position: {
97
+ x: number;
98
+ y: number;
99
+ };
100
+ size: {
101
+ height: number;
102
+ width: number;
103
+ };
104
+ style: {
105
+ font: {
106
+ size: number;
107
+ };
108
+ color: string;
109
+ };
110
+ propertyBindings: {
111
+ text: string;
112
+ url?: undefined;
113
+ };
114
+ })[];
115
+ };
116
+ export declare const ITEM_VIEW: {
117
+ slug: string;
118
+ defaultTemplate: {
119
+ elements: ({
120
+ type: string;
121
+ size: {
122
+ width: number;
123
+ height: number;
124
+ };
125
+ propertyBindings: {
126
+ url: string;
127
+ text?: undefined;
128
+ };
129
+ position?: undefined;
130
+ style?: undefined;
131
+ } | {
132
+ type: string;
133
+ position: {
134
+ x: number;
135
+ y: number;
136
+ };
137
+ size: {
138
+ height: number;
139
+ width: number;
140
+ };
141
+ style: {
142
+ font: {
143
+ size: number;
144
+ };
145
+ color?: undefined;
146
+ };
147
+ propertyBindings: {
148
+ text: string;
149
+ url?: undefined;
150
+ };
151
+ } | {
152
+ type: string;
153
+ position: {
154
+ x: number;
155
+ y: number;
156
+ };
157
+ size: {
158
+ height: number;
159
+ width: number;
160
+ };
161
+ style: {
162
+ font: {
163
+ size: number;
164
+ };
165
+ color: string;
166
+ };
167
+ propertyBindings: {
168
+ text: string;
169
+ url?: undefined;
170
+ };
171
+ })[];
172
+ };
173
+ };
174
+ export declare const ITEM_VIEW_V2: {
175
+ slug: string;
176
+ defaultTemplate: {
177
+ elements: ({
178
+ type: string;
179
+ size: {
180
+ width: number;
181
+ height: number;
182
+ };
183
+ propertyBindings: {
184
+ url: string;
185
+ text?: undefined;
186
+ };
187
+ position?: undefined;
188
+ style?: undefined;
189
+ } | {
190
+ type: string;
191
+ position: {
192
+ x: number;
193
+ y: number;
194
+ };
195
+ size: {
196
+ height: number;
197
+ width: number;
198
+ };
199
+ style: {
200
+ font: {
201
+ size: number;
202
+ };
203
+ color?: undefined;
204
+ };
205
+ propertyBindings: {
206
+ text: string;
207
+ url?: undefined;
208
+ };
209
+ } | {
210
+ type: string;
211
+ position: {
212
+ x: number;
213
+ y: number;
214
+ };
215
+ size: {
216
+ height: number;
217
+ width: number;
218
+ };
219
+ style: {
220
+ font: {
221
+ size: number;
222
+ };
223
+ color: string;
224
+ };
225
+ propertyBindings: {
226
+ text: string;
227
+ url?: undefined;
228
+ };
229
+ })[];
230
+ };
231
+ };
232
+ export declare class ComponentRegistry {
233
+ private static componentDefinitionMap;
234
+ static getComponentDefinition(slug: string): ComponentDefinition;
235
+ private static initMap;
236
+ }
@@ -1,49 +1,83 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComponentRegistry = exports.ITEM_VIEW = exports.ITEM_VIEW_TEMPLATE = void 0;
4
- exports.ITEM_VIEW_TEMPLATE = {
5
- elements: [{
6
- type: "image",
7
- size: { width: 125, height: 125 },
8
- propertyBindings: { url: 'thumbnail.downloadUrl' }
9
- }, {
10
- type: "text",
11
- position: { x: 0, y: 126 },
12
- size: { height: 25, width: 125 },
13
- style: {
14
- font: {
15
- size: 8,
16
- }
17
- },
18
- propertyBindings: { text: 'item.name' }
19
- }, {
20
- type: "text",
21
- position: { x: 0, y: 151 },
22
- size: { height: 25, width: 125 },
23
- style: {
24
- font: {
25
- size: 8,
26
- },
27
- color: 'rgba(0,0,0,.5)',
28
- },
29
- propertyBindings: { text: 'item.optionName' }
30
- }
31
- ]
32
- };
33
- exports.ITEM_VIEW = {
34
- slug: 'item-view',
35
- defaultTemplate: exports.ITEM_VIEW_TEMPLATE,
36
- };
37
- class ComponentRegistry {
38
- static getComponentDefinition(slug) {
39
- if (!this.componentDefinitionMap) {
40
- this.initMap();
41
- }
42
- return this.componentDefinitionMap.get(slug);
43
- }
44
- static initMap() {
45
- this.componentDefinitionMap = new Map();
46
- this.componentDefinitionMap.set('item-view', exports.ITEM_VIEW);
47
- }
48
- }
49
- exports.ComponentRegistry = ComponentRegistry;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComponentRegistry = exports.ITEM_VIEW_V2 = exports.ITEM_VIEW = exports.ITEM_VIEW_TEMPLATE_V2 = exports.ITEM_VIEW_TEMPLATE = void 0;
4
+ exports.ITEM_VIEW_TEMPLATE = {
5
+ elements: [{
6
+ type: "image",
7
+ size: { width: 125, height: 125 },
8
+ propertyBindings: { url: 'thumbnail.downloadUrl' }
9
+ }, {
10
+ type: "text",
11
+ position: { x: 0, y: 126 },
12
+ size: { height: 25, width: 125 },
13
+ style: {
14
+ font: {
15
+ size: 8,
16
+ }
17
+ },
18
+ propertyBindings: { text: 'item.name' }
19
+ }, {
20
+ type: "text",
21
+ position: { x: 0, y: 151 },
22
+ size: { height: 25, width: 125 },
23
+ style: {
24
+ font: {
25
+ size: 8,
26
+ },
27
+ color: 'rgba(0,0,0,.5)',
28
+ },
29
+ propertyBindings: { text: 'item.optionName' }
30
+ }
31
+ ]
32
+ };
33
+ exports.ITEM_VIEW_TEMPLATE_V2 = {
34
+ elements: [{
35
+ type: "image",
36
+ size: { width: 125, height: 125 },
37
+ propertyBindings: { url: 'viewable.mediumViewableDownloadUrl' }
38
+ }, {
39
+ type: "text",
40
+ position: { x: 0, y: 126 },
41
+ size: { height: 25, width: 125 },
42
+ style: {
43
+ font: {
44
+ size: 8,
45
+ }
46
+ },
47
+ propertyBindings: { text: 'item.name' }
48
+ }, {
49
+ type: "text",
50
+ position: { x: 0, y: 151 },
51
+ size: { height: 25, width: 125 },
52
+ style: {
53
+ font: {
54
+ size: 8,
55
+ },
56
+ color: 'rgba(0,0,0,.5)',
57
+ },
58
+ propertyBindings: { text: 'item.optionName' }
59
+ }
60
+ ]
61
+ };
62
+ exports.ITEM_VIEW = {
63
+ slug: 'item-view',
64
+ defaultTemplate: exports.ITEM_VIEW_TEMPLATE,
65
+ };
66
+ exports.ITEM_VIEW_V2 = {
67
+ slug: 'item-view-v2',
68
+ defaultTemplate: exports.ITEM_VIEW_TEMPLATE_V2,
69
+ };
70
+ class ComponentRegistry {
71
+ static getComponentDefinition(slug) {
72
+ if (!this.componentDefinitionMap) {
73
+ this.initMap();
74
+ }
75
+ return this.componentDefinitionMap.get(slug);
76
+ }
77
+ static initMap() {
78
+ this.componentDefinitionMap = new Map();
79
+ this.componentDefinitionMap.set('item-view', exports.ITEM_VIEW);
80
+ this.componentDefinitionMap.set('item-view-v2', exports.ITEM_VIEW_V2);
81
+ }
82
+ }
83
+ exports.ComponentRegistry = ComponentRegistry;
@@ -1 +1 @@
1
- export * from './components';
1
+ export * from './components';
@@ -1,17 +1,17 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./components"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./components"), exports);
@@ -1,7 +1,7 @@
1
- import { Action } from '@contrail/actions';
2
- import { DocumentChange } from './types';
3
- export declare class DocumentAction extends Action {
4
- changeDefinition: DocumentChange;
5
- undoChangeDefinition: DocumentChange;
6
- constructor(change: any, undoChange?: any);
7
- }
1
+ import { Action } from '@contrail/actions';
2
+ import { DocumentChange } from './types';
3
+ export declare class DocumentAction extends Action {
4
+ changeDefinition: DocumentChange;
5
+ undoChangeDefinition: DocumentChange;
6
+ constructor(change: any, undoChange?: any);
7
+ }
@@ -1,10 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DocumentAction = void 0;
4
- const actions_1 = require("@contrail/actions");
5
- class DocumentAction extends actions_1.Action {
6
- constructor(change, undoChange = null) {
7
- super('document', change, undoChange);
8
- }
9
- }
10
- exports.DocumentAction = DocumentAction;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentAction = void 0;
4
+ const actions_1 = require("@contrail/actions");
5
+ class DocumentAction extends actions_1.Action {
6
+ constructor(change, undoChange = null) {
7
+ super('document', change, undoChange);
8
+ }
9
+ }
10
+ exports.DocumentAction = DocumentAction;
@@ -1,9 +1,9 @@
1
- import { DocumentElement } from './types/document-element';
2
- export declare class DocumentElementFactory {
3
- private static initNewElement;
4
- static createTextElement(text: string, options?: DocumentElement): DocumentElement;
5
- static createShapeElement(type: string, options?: DocumentElement): DocumentElement;
6
- static createElement(type: string, options?: DocumentElement): DocumentElement;
7
- static createImageElement(options: DocumentElement): DocumentElement;
8
- static createComponent(componentType: string, model: any, modelBindings: any, options?: DocumentElement): DocumentElement;
9
- }
1
+ import { DocumentElement } from './types/document-element';
2
+ export declare class DocumentElementFactory {
3
+ private static initNewElement;
4
+ static createTextElement(text: string, options?: DocumentElement): DocumentElement;
5
+ static createShapeElement(type: string, options?: DocumentElement): DocumentElement;
6
+ static createElement(type: string, options?: DocumentElement): DocumentElement;
7
+ static createImageElement(options: DocumentElement): DocumentElement;
8
+ static createComponent(componentType: string, model: any, modelBindings: any, options?: DocumentElement): DocumentElement;
9
+ }