@lbaz/tetr 0.0.26 → 0.0.28

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.
Files changed (73) hide show
  1. package/dist/cdk/transpiler/block-data-processor.d.ts +6 -0
  2. package/dist/cdk/transpiler/block-data-processor.js +7 -0
  3. package/dist/cdk/transpiler/block-data-processor.js.map +1 -0
  4. package/dist/cdk/transpiler/chunks-processor.d.ts +17 -0
  5. package/dist/cdk/transpiler/chunks-processor.js +44 -0
  6. package/dist/cdk/transpiler/chunks-processor.js.map +1 -0
  7. package/dist/cdk/transpiler/common-editable-style-processor.d.ts +6 -0
  8. package/dist/cdk/transpiler/common-editable-style-processor.js +10 -0
  9. package/dist/cdk/transpiler/common-editable-style-processor.js.map +1 -0
  10. package/dist/cdk/transpiler/expression-processor.d.ts +8 -0
  11. package/dist/cdk/transpiler/expression-processor.js +27 -0
  12. package/dist/cdk/transpiler/expression-processor.js.map +1 -0
  13. package/dist/cdk/transpiler/index.d.ts +6 -0
  14. package/dist/cdk/transpiler/index.js +7 -0
  15. package/dist/cdk/transpiler/index.js.map +1 -0
  16. package/dist/cdk/transpiler/template-replacer.d.ts +7 -0
  17. package/dist/cdk/transpiler/template-replacer.js +27 -0
  18. package/dist/cdk/transpiler/template-replacer.js.map +1 -0
  19. package/dist/cdk/transpiler/types.d.ts +7 -0
  20. package/dist/cdk/transpiler/types.js +2 -0
  21. package/dist/cdk/transpiler/types.js.map +1 -0
  22. package/dist/constants/index.d.ts +32 -0
  23. package/dist/constants/index.js +33 -0
  24. package/dist/constants/index.js.map +1 -0
  25. package/dist/core/common-wrap-styles-extractor.d.ts +30 -0
  26. package/dist/core/common-wrap-styles-extractor.js +60 -0
  27. package/dist/core/common-wrap-styles-extractor.js.map +1 -0
  28. package/dist/core/index.d.ts +3 -0
  29. package/dist/core/index.js +4 -0
  30. package/dist/core/index.js.map +1 -0
  31. package/dist/core/object-seeder.d.ts +10 -0
  32. package/dist/core/object-seeder.js +41 -0
  33. package/dist/core/object-seeder.js.map +1 -0
  34. package/dist/core/transpiler.d.ts +32 -0
  35. package/dist/core/transpiler.js +109 -0
  36. package/dist/core/transpiler.js.map +1 -0
  37. package/dist/index.d.ts +3 -0
  38. package/dist/index.js +4 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/tests/common-wrap-styles-extractor-mock/index.d.ts +6 -0
  41. package/dist/tests/common-wrap-styles-extractor-mock/index.js +51 -0
  42. package/dist/tests/common-wrap-styles-extractor-mock/index.js.map +1 -0
  43. package/dist/tests/common-wrap-styles-extractor.test.d.ts +1 -0
  44. package/dist/tests/common-wrap-styles-extractor.test.js +33 -0
  45. package/dist/tests/common-wrap-styles-extractor.test.js.map +1 -0
  46. package/dist/tests/object-seeder.test.d.ts +1 -0
  47. package/dist/tests/object-seeder.test.js +60 -0
  48. package/dist/tests/object-seeder.test.js.map +1 -0
  49. package/dist/tests/template-compiler.test.d.ts +1 -0
  50. package/dist/tests/template-compiler.test.js +143 -0
  51. package/dist/tests/template-compiler.test.js.map +1 -0
  52. package/dist/tests/templates-compiler-mocks/index.d.ts +36 -0
  53. package/dist/tests/templates-compiler-mocks/index.js +369 -0
  54. package/dist/tests/templates-compiler-mocks/index.js.map +1 -0
  55. package/dist/tests/tt-factory.test.d.ts +1 -0
  56. package/dist/tests/tt-factory.test.js +64 -0
  57. package/dist/tests/tt-factory.test.js.map +1 -0
  58. package/dist/types/block.d.ts +27 -0
  59. package/dist/types/block.js +2 -0
  60. package/dist/types/block.js.map +1 -0
  61. package/dist/types/chunk.d.ts +12 -0
  62. package/dist/types/chunk.js +2 -0
  63. package/dist/types/chunk.js.map +1 -0
  64. package/dist/types/data.d.ts +87 -0
  65. package/dist/types/data.js +3 -0
  66. package/dist/types/data.js.map +1 -0
  67. package/dist/types/index.d.ts +4 -0
  68. package/dist/types/index.js +5 -0
  69. package/dist/types/index.js.map +1 -0
  70. package/dist/types/template.d.ts +3 -0
  71. package/dist/types/template.js +2 -0
  72. package/dist/types/template.js.map +1 -0
  73. package/package.json +1 -1
@@ -0,0 +1,369 @@
1
+ import { DATA_TYPES, DEFINITION_TYPES } from "../../constants";
2
+ export const test01 = {
3
+ id: 'test01',
4
+ previewName: 'Test 01',
5
+ template: {
6
+ markup: `<div>{{name}}</div>`
7
+ },
8
+ data: {
9
+ type: DATA_TYPES.DICT,
10
+ definitions: {
11
+ name: {
12
+ type: DEFINITION_TYPES.String,
13
+ defaultValue: 'test'
14
+ }
15
+ }
16
+ }
17
+ };
18
+ export const test01ModelData = {
19
+ id: 'test01',
20
+ uniqId: 'weqwe',
21
+ isVisible: true,
22
+ data: {
23
+ name: 'patch'
24
+ }
25
+ };
26
+ export const test02 = {
27
+ id: 'test02',
28
+ previewName: 'Test 02',
29
+ template: {
30
+ markup: `<section><div>{{name}}</div>[[paragraph]]</section>`
31
+ },
32
+ data: {
33
+ type: DATA_TYPES.DICT,
34
+ definitions: {
35
+ name: {
36
+ type: DEFINITION_TYPES.String,
37
+ defaultValue: 'test'
38
+ }
39
+ }
40
+ },
41
+ chunks: {
42
+ paragraph: {
43
+ template: {
44
+ markup: `<p>{{descriptionValue}}</p>`
45
+ },
46
+ data: {
47
+ type: DATA_TYPES.DICT,
48
+ definitions: {
49
+ descriptionValue: {
50
+ type: DEFINITION_TYPES.String,
51
+ defaultValue: 'Test paragraph'
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ };
58
+ export const test02ModelData = {
59
+ id: 'test02',
60
+ uniqId: 'sdfsdf',
61
+ isVisible: true,
62
+ data: {
63
+ name: 'patch'
64
+ },
65
+ chunks: {
66
+ paragraph: {
67
+ data: {
68
+ descriptionValue: 'Patch paragraph value'
69
+ }
70
+ }
71
+ }
72
+ };
73
+ export const chunkTestModel00 = {
74
+ id: 'tst01',
75
+ uniqId: 'asdasd1',
76
+ isVisible: true,
77
+ chunks: {
78
+ test: {
79
+ data: [{ value: 'patched01' }, { value: 'patched02' }]
80
+ }
81
+ }
82
+ };
83
+ export const chunksTest01 = {
84
+ test: {
85
+ template: {
86
+ markup: '<div>{{value}}</div>'
87
+ },
88
+ data: {
89
+ type: 'DICT',
90
+ definitions: {
91
+ value: {
92
+ type: "String",
93
+ defaultValue: '__test'
94
+ }
95
+ }
96
+ }
97
+ }
98
+ };
99
+ export const chunkTestModel01 = {
100
+ id: 'tst01',
101
+ uniqId: 'qweq',
102
+ isVisible: true,
103
+ chunks: {
104
+ test: {
105
+ data: {
106
+ value: 'patched'
107
+ }
108
+ }
109
+ }
110
+ };
111
+ export const chunksTest02 = {
112
+ test: {
113
+ template: {
114
+ markup: '<div>{{value}}</div>'
115
+ },
116
+ data: {
117
+ type: 'LIST',
118
+ definitions: {
119
+ value: {
120
+ type: "String",
121
+ defaultValue: '__test'
122
+ }
123
+ }
124
+ }
125
+ }
126
+ };
127
+ export const chunkTestModel02 = {
128
+ id: 'tst01',
129
+ uniqId: 'qweqd',
130
+ isVisible: true,
131
+ chunks: {
132
+ test: {
133
+ data: [{ value: 'patched01' }, { value: 'patched02' }]
134
+ }
135
+ }
136
+ };
137
+ export const chunksTest03 = {
138
+ test: {
139
+ template: {
140
+ markup: '<div>{{value}}</div>'
141
+ },
142
+ data: {
143
+ type: 'LIST',
144
+ definitions: {
145
+ value: {
146
+ type: "String",
147
+ defaultValue: '__test'
148
+ }
149
+ }
150
+ },
151
+ styles: `div{color: red};div.test{color: blue};`
152
+ }
153
+ };
154
+ export const chunkTestModel03 = {
155
+ id: 'tst01',
156
+ uniqId: 'qweqdds',
157
+ isVisible: true,
158
+ chunks: {
159
+ test: {
160
+ data: [{ value: 'patched01' }, { value: 'patched02' }]
161
+ }
162
+ }
163
+ };
164
+ export const chunksTest04 = {
165
+ test: {
166
+ template: {
167
+ markup: '<div>{{value}}</div>'
168
+ },
169
+ data: {
170
+ type: 'LIST',
171
+ definitions: {
172
+ value: {
173
+ type: "String",
174
+ defaultValue: '__test'
175
+ }
176
+ }
177
+ },
178
+ styles: `div{color: red};div.test{color: blue};`
179
+ },
180
+ label: {
181
+ template: {
182
+ markup: `<label>{{label}}</label>`
183
+ },
184
+ data: {
185
+ type: 'DICT',
186
+ definitions: {
187
+ label: {
188
+ type: 'String',
189
+ defaultValue: 'label'
190
+ }
191
+ }
192
+ },
193
+ styles: `label{color: red};`
194
+ }
195
+ };
196
+ export const chunkTestModel04 = {
197
+ id: 'tst01',
198
+ uniqId: 'qweqas',
199
+ isVisible: true,
200
+ chunks: {
201
+ test: {
202
+ data: [{ value: 'patched01' }, { value: 'patched02' }]
203
+ },
204
+ label: {
205
+ data: { label: '_label_' }
206
+ }
207
+ }
208
+ };
209
+ export const chunksTest05 = {
210
+ test: {
211
+ template: {
212
+ markup: '<div>{{value}}</div>'
213
+ },
214
+ data: {
215
+ type: 'LIST',
216
+ definitions: {
217
+ value: {
218
+ type: "String",
219
+ defaultValue: '__test'
220
+ }
221
+ }
222
+ },
223
+ styles: `div{color: red};div.test{color: blue};`
224
+ },
225
+ label: {
226
+ template: {
227
+ markup: `<label>{{label}}</label>`
228
+ },
229
+ data: {
230
+ type: 'DICT',
231
+ definitions: {
232
+ label: {
233
+ type: 'String',
234
+ defaultValue: 'label'
235
+ }
236
+ }
237
+ },
238
+ styles: `label{color: red};`
239
+ }
240
+ };
241
+ export const chunkTestModel05 = {
242
+ id: 'tst01',
243
+ uniqId: 'qweq123',
244
+ isVisible: true,
245
+ chunks: {
246
+ test: {
247
+ data: [{ value: 'patched01' }, { value: 'patched02' }],
248
+ styles: '.modelStylesTEST_PROP{color: red};'
249
+ },
250
+ label: {
251
+ data: { label: '_label_' },
252
+ styles: '.modelStylesLABEL_PROP{color: green};'
253
+ }
254
+ }
255
+ };
256
+ export const blockCommonStyles01 = {
257
+ id: 'tst01',
258
+ previewName: 'asdasd',
259
+ template: {
260
+ markup: `<div style="[{c_s_t_a}]"></div>`
261
+ }
262
+ };
263
+ export const commonStyles01 = {
264
+ id: 'tst01',
265
+ uniqId: 'qweq123df',
266
+ isVisible: true,
267
+ commonEditableBlockWrapStyles: {
268
+ color: '',
269
+ backgroundSize: '',
270
+ backgroundRepeat: '',
271
+ backgroundPosition: '',
272
+ backgroundImage: '',
273
+ backgroundColor: '',
274
+ backgroundAttachment: '',
275
+ textAlign: ''
276
+ }
277
+ };
278
+ export const commonStyles02 = {
279
+ id: 'tst01',
280
+ uniqId: 'qweq123df',
281
+ isVisible: true,
282
+ commonEditableBlockWrapStyles: {
283
+ color: '',
284
+ backgroundSize: '',
285
+ backgroundRepeat: '',
286
+ backgroundPosition: '',
287
+ backgroundImage: '',
288
+ backgroundColor: 'red',
289
+ backgroundAttachment: '',
290
+ textAlign: ''
291
+ }
292
+ };
293
+ export const commonStyles03 = {
294
+ id: 'tst01',
295
+ uniqId: 'qweq123df',
296
+ isVisible: true,
297
+ commonEditableBlockWrapStyles: {
298
+ color: '',
299
+ backgroundSize: '',
300
+ backgroundRepeat: '',
301
+ backgroundPosition: '',
302
+ backgroundImage: '',
303
+ backgroundColor: 'red',
304
+ backgroundAttachment: '',
305
+ textAlign: 'left'
306
+ }
307
+ };
308
+ export const commonStyles04 = {
309
+ id: 'tst01',
310
+ uniqId: 'qweq123df',
311
+ isVisible: true,
312
+ commonEditableBlockWrapStyles: {
313
+ color: '',
314
+ backgroundSize: '',
315
+ backgroundRepeat: '',
316
+ backgroundPosition: '',
317
+ backgroundImage: 'https://',
318
+ backgroundColor: 'red',
319
+ backgroundAttachment: '',
320
+ textAlign: 'left'
321
+ }
322
+ };
323
+ export const blockEmptyTemplate01 = {
324
+ id: 'tst01',
325
+ previewName: 'asdasd',
326
+ template: {
327
+ markup: ``
328
+ }
329
+ };
330
+ export const blockExpression01 = {
331
+ id: 'adasd',
332
+ previewName: 'asdfasdasd',
333
+ template: {
334
+ markup: `<{{tag}} [(tag:a:href="{{href}}":EMPTY)]>link</{{tag}}>`
335
+ },
336
+ data: {
337
+ type: 'DICT',
338
+ definitions: {
339
+ tag: {
340
+ type: "String",
341
+ defaultValue: 'a'
342
+ },
343
+ href: {
344
+ type: "NavigationLink",
345
+ defaultValue: '#'
346
+ }
347
+ }
348
+ }
349
+ };
350
+ export const expressionData01 = {
351
+ id: 'asdasd',
352
+ uniqId: 'sadasd',
353
+ isVisible: true,
354
+ data: {
355
+ tag: 'a',
356
+ href: 'https://some-link.com#hash'
357
+ }
358
+ };
359
+ export const blockExpression02 = blockExpression01;
360
+ export const expressionData02 = {
361
+ id: 'asdasd',
362
+ uniqId: 'sadasd',
363
+ isVisible: true,
364
+ data: {
365
+ tag: 'div',
366
+ href: 'https://some-link.com#hash'
367
+ }
368
+ };
369
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tests/templates-compiler-mocks/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAE7D,MAAM,CAAC,MAAM,MAAM,GAAU;IAC3B,EAAE,EAAE,QAAQ;IACZ,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE;QACR,MAAM,EAAE,qBAAqB;KAC9B;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU,CAAC,IAAgB;QACjC,WAAW,EAAE;YACX,IAAI,EAAE;gBACJ,IAAI,EAAE,gBAAgB,CAAC,MAAwB;gBAC/C,YAAY,EAAE,MAAM;aACH;SACpB;KACgB;CACpB,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAa;IACvC,EAAE,EAAE,QAAQ;IACZ,MAAM,EAAE,OAAO;IACf,SAAS,EAAE,IAAI;IACf,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;KACd;CACF,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAU;IAC3B,EAAE,EAAE,QAAQ;IACZ,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE;QACR,MAAM,EAAE,qDAAqD;KAC9D;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU,CAAC,IAAgB;QACjC,WAAW,EAAE;YAC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Y,EAAE,GAAG;aAClB;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,gBAAgB;gBACtB,YAAY,EAAE,GAAG;aAClB;SACF;KACF;CACF,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAa;IACxC,EAAE,EAAE,QAAQ;IACZ,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE;QACJ,GAAG,EAAE,GAAG;QACR,IAAI,EAAE,4BAA4B;KACnC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAU,iBAAiB,CAAC;AAE1D,MAAM,CAAC,MAAM,gBAAgB,GAAa;IACxC,EAAE,EAAE,QAAQ;IACZ,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE;QACJ,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,4BAA4B;KACnC;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,64 @@
1
+ import { TTFactory } from "../core";
2
+ import { blockCommonStyles01, blockEmptyTemplate01, blockExpression01, commonStyles01, commonStyles02, commonStyles03, commonStyles04, expressionData01, expressionData02, test01, test01ModelData, test02, test02ModelData } from "./templates-compiler-mocks";
3
+ import { ExpressionsProcessor } from "../cdk/transpiler";
4
+ describe('TRANSPILER Empty template markup', () => {
5
+ test('01', () => {
6
+ const tt = new TTFactory(blockEmptyTemplate01, test01ModelData);
7
+ expect(tt.execute()).toBeNull();
8
+ });
9
+ });
10
+ describe('TRANSPILER replace root data', () => {
11
+ test('Simple replace (model data exist)', () => {
12
+ const blockCopy = JSON.parse(JSON.stringify(test01));
13
+ blockCopy.template.markup = null;
14
+ const tt = new TTFactory(blockCopy, test01ModelData);
15
+ expect(tt.execute()).toBeNull();
16
+ });
17
+ });
18
+ describe('TRANSPILER #2', () => {
19
+ test('block data', () => {
20
+ const tt = new TTFactory(test01, test01ModelData);
21
+ expect(tt.execute()).toBe('<div>patch</div>');
22
+ });
23
+ });
24
+ describe('TRANSPILER replace root data & exist chunks', () => {
25
+ test('Simple replace (model data exist & chunks)', () => {
26
+ const tt = new TTFactory(test02, test02ModelData);
27
+ expect(tt.execute()).toEqual('<section><div>patch</div><p>Patch paragraph value</p></section>');
28
+ });
29
+ });
30
+ describe('_Common styles extractor', () => {
31
+ test('Empty', () => {
32
+ const tt = new TTFactory(blockCommonStyles01, commonStyles01);
33
+ expect(tt.execute()).toEqual(`<div style=""></div>`);
34
+ });
35
+ test('only background color', () => {
36
+ const tt = new TTFactory(blockCommonStyles01, commonStyles02);
37
+ expect(tt.execute()).toEqual(`<div style="background-color:red;"></div>`);
38
+ });
39
+ test('background color && text align', () => {
40
+ const tt = new TTFactory(blockCommonStyles01, commonStyles03);
41
+ expect(tt.execute()).toEqual(`<div style="background-color:red;text-align:left;"></div>`);
42
+ });
43
+ test('background color && text align with background image', () => {
44
+ const tt = new TTFactory(blockCommonStyles01, commonStyles04);
45
+ expect(tt.execute()).toEqual(`<div style="background-image:url(https://);text-align:left;"></div>`);
46
+ });
47
+ });
48
+ describe('Expression processor', () => {
49
+ test('expression processor #1', () => {
50
+ const tt = new ExpressionsProcessor();
51
+ expect(tt.execute(blockExpression01.template.markup, expressionData01)).toBe(`<{{tag}} href="{{href}}">link</{{tag}}>`);
52
+ });
53
+ });
54
+ describe('Expression processing', () => {
55
+ test('positive ternary branch', () => {
56
+ const tt = new TTFactory(blockExpression01, expressionData01);
57
+ expect(tt.execute()).toEqual(`<a href="https://some-link.com#hash">link</a>`);
58
+ });
59
+ test('negative ternary branch', () => {
60
+ const tt = new TTFactory(blockExpression01, expressionData02);
61
+ expect(tt.execute()).toEqual(`<div >link</div>`);
62
+ });
63
+ });
64
+ //# sourceMappingURL=tt-factory.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tt-factory.test.js","sourceRoot":"","sources":["../../src/tests/tt-factory.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAC,MAAM,SAAS,CAAC;AAC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,CAAC,CAAC,OAAO,CAAC,qEAAqE,CAAC,CAAA;IACrG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACnC,MAAM,EAAE,GAAG,IAAI,oBAAoB,EAAE,CAAC;QACtC,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAC1E,yCAAyC,CAC1C,CAAA;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACnC,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;QAC9D,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,+CAA+C,CAAC,CAAA;IAC/E,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACnC,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;QAC9D,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { Template } from "./template";
2
+ import { Chunk, PatchChunk } from "./chunk";
3
+ import { Data, DataDefinition } from "./data";
4
+ export type BlockId = string;
5
+ export type BlockPreview = string;
6
+ export interface BaseBlock<T, D> {
7
+ id: BlockId;
8
+ previewName: BlockPreview;
9
+ chunks?: {
10
+ [key: string]: T;
11
+ };
12
+ commonEditableBlockWrapStyles?: D;
13
+ data?: D;
14
+ styles?: string;
15
+ }
16
+ export interface Block extends BaseBlock<Chunk, DataDefinition> {
17
+ template: Template;
18
+ }
19
+ export interface PatchBlock extends BaseBlock<PatchChunk, Data> {
20
+ }
21
+ export interface CreateBlockOutput {
22
+ markup: string;
23
+ styles: string;
24
+ }
25
+ export interface BlockMarkupOutput {
26
+ markup: string;
27
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block.js","sourceRoot":"","sources":["../../src/types/block.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { Template } from "./template";
2
+ import { DataDefinition, PossibleDataPayload } from "./data";
3
+ export interface BaseChunk {
4
+ styles?: string;
5
+ }
6
+ export interface Chunk extends BaseChunk {
7
+ template: Template;
8
+ data?: DataDefinition;
9
+ }
10
+ export interface PatchChunk extends BaseChunk {
11
+ data?: PossibleDataPayload;
12
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=chunk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../src/types/chunk.ts"],"names":[],"mappings":""}
@@ -0,0 +1,87 @@
1
+ import { DATA_TYPES, DEFINITION_TYPES } from "../constants";
2
+ export type Data<T = unknown> = {
3
+ [key: string]: T;
4
+ };
5
+ export type DefinitionType = keyof typeof DEFINITION_TYPES;
6
+ export type DataType = keyof typeof DATA_TYPES;
7
+ export interface PossibleVariant {
8
+ value: string;
9
+ label: string;
10
+ }
11
+ export interface ItemDefinition {
12
+ type: DefinitionType;
13
+ defaultValue: string;
14
+ possibleVariants?: Array<PossibleVariant>;
15
+ }
16
+ export interface DataDefinition {
17
+ type: DataType;
18
+ defaultValue?: unknown;
19
+ definitions: Data<ItemDefinition>;
20
+ }
21
+ export type PossibleDataPayload<T = any> = Data<T> | Array<Data<T>>;
22
+ export interface CommonEditableBlockWrapStyles {
23
+ color: string | null;
24
+ backgroundColor: string | null;
25
+ backgroundImage: string | null;
26
+ backgroundSize: string | null;
27
+ backgroundPosition: string | null;
28
+ backgroundRepeat: string | null;
29
+ backgroundAttachment: string | null;
30
+ textAlign: string | null;
31
+ }
32
+ export interface PageBody {
33
+ id: string;
34
+ uniqId: string;
35
+ isVisible: any;
36
+ commonEditableBlockWrapStyles?: CommonEditableBlockWrapStyles;
37
+ data?: {
38
+ [key: string]: unknown;
39
+ };
40
+ chunks?: {
41
+ [key: string]: {
42
+ data: {
43
+ [key: string]: unknown;
44
+ } | Array<{
45
+ [key: string]: unknown;
46
+ }>;
47
+ styles?: string;
48
+ };
49
+ };
50
+ }
51
+ export type PageTitle = string;
52
+ export interface PageThemeRecord {
53
+ fieldName: string;
54
+ type: string;
55
+ varName: string;
56
+ value: string;
57
+ }
58
+ export interface PageMeta {
59
+ name?: string;
60
+ property?: string;
61
+ content: string;
62
+ }
63
+ export interface PageHead {
64
+ title: PageTitle;
65
+ meta: Array<PageMeta>;
66
+ theme: Array<PageThemeRecord>;
67
+ }
68
+ export interface Page {
69
+ id: string;
70
+ name: string;
71
+ path: string;
72
+ head: {
73
+ title: string;
74
+ meta: Array<PageMeta>;
75
+ styles: Array<string>;
76
+ scripts: Array<string>;
77
+ includes: {
78
+ styles: Array<string>;
79
+ scripts: Array<string>;
80
+ };
81
+ };
82
+ body: Array<PageBody>;
83
+ }
84
+ export interface SiteSourceData {
85
+ robots?: string;
86
+ pages: Array<Page>;
87
+ }
@@ -0,0 +1,3 @@
1
+ ;
2
+ export {};
3
+ //# sourceMappingURL=data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/types/data.ts"],"names":[],"mappings":"AAwBC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './template';
2
+ export * from './block';
3
+ export * from './chunk';
4
+ export * from './data';
@@ -0,0 +1,5 @@
1
+ export * from './template';
2
+ export * from './block';
3
+ export * from './chunk';
4
+ export * from './data';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export interface Template {
2
+ markup: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/types/template.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lbaz/tetr",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "Template transpiler",
5
5
  "main": "dist/index.js",
6
6