@teleporthq/teleport-uidl-validator 0.18.0
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/LICENSE +21 -0
- package/README.md +14 -0
- package/__tests__/parser/componennt-with-referenced-styles.json +111 -0
- package/__tests__/parser/component-parsing.ts +116 -0
- package/__tests__/parser/component-referenced.ts +50 -0
- package/__tests__/parser/component-with-primitive-values.json +61 -0
- package/__tests__/parser/component-with-proper-values.json +97 -0
- package/__tests__/parser/component-with-reusalble-styles.json +117 -0
- package/__tests__/validator/component-element-with-empty-name.json +36 -0
- package/__tests__/validator/component-invalid-sample.json +184 -0
- package/__tests__/validator/component-uidl-with-event-modifier-undefined.json +45 -0
- package/__tests__/validator/component-uidl-with-null-undefined.json +24 -0
- package/__tests__/validator/index.ts +216 -0
- package/__tests__/validator/old-project-invalid-sample.json +317 -0
- package/__tests__/validator/project-invalid-sample-no-route.json +667 -0
- package/__tests__/validator/project-invalid-sample.json +671 -0
- package/__tests__/validator/project-sample.json +667 -0
- package/dist/cjs/decoders/component-decoder.d.ts +4 -0
- package/dist/cjs/decoders/component-decoder.js +30 -0
- package/dist/cjs/decoders/component-decoder.js.map +1 -0
- package/dist/cjs/decoders/custom-combinators.d.ts +8 -0
- package/dist/cjs/decoders/custom-combinators.js +59 -0
- package/dist/cjs/decoders/custom-combinators.js.map +1 -0
- package/dist/cjs/decoders/index.d.ts +2 -0
- package/dist/cjs/decoders/index.js +9 -0
- package/dist/cjs/decoders/index.js.map +1 -0
- package/dist/cjs/decoders/project-decoder.d.ts +5 -0
- package/dist/cjs/decoders/project-decoder.js +38 -0
- package/dist/cjs/decoders/project-decoder.js.map +1 -0
- package/dist/cjs/decoders/utils.d.ts +59 -0
- package/dist/cjs/decoders/utils.js +305 -0
- package/dist/cjs/decoders/utils.js.map +1 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/parser/index.d.ts +10 -0
- package/dist/cjs/parser/index.js +156 -0
- package/dist/cjs/parser/index.js.map +1 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/dist/cjs/validator/index.d.ts +15 -0
- package/dist/cjs/validator/index.js +94 -0
- package/dist/cjs/validator/index.js.map +1 -0
- package/dist/cjs/validator/utils.d.ts +16 -0
- package/dist/cjs/validator/utils.js +373 -0
- package/dist/cjs/validator/utils.js.map +1 -0
- package/dist/esm/decoders/component-decoder.d.ts +4 -0
- package/dist/esm/decoders/component-decoder.js +27 -0
- package/dist/esm/decoders/component-decoder.js.map +1 -0
- package/dist/esm/decoders/custom-combinators.d.ts +8 -0
- package/dist/esm/decoders/custom-combinators.js +56 -0
- package/dist/esm/decoders/custom-combinators.js.map +1 -0
- package/dist/esm/decoders/index.d.ts +2 -0
- package/dist/esm/decoders/index.js +3 -0
- package/dist/esm/decoders/index.js.map +1 -0
- package/dist/esm/decoders/project-decoder.d.ts +5 -0
- package/dist/esm/decoders/project-decoder.js +35 -0
- package/dist/esm/decoders/project-decoder.js.map +1 -0
- package/dist/esm/decoders/utils.d.ts +59 -0
- package/dist/esm/decoders/utils.js +301 -0
- package/dist/esm/decoders/utils.js.map +1 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/parser/index.d.ts +10 -0
- package/dist/esm/parser/index.js +151 -0
- package/dist/esm/parser/index.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/validator/index.d.ts +15 -0
- package/dist/esm/validator/index.js +73 -0
- package/dist/esm/validator/index.js.map +1 -0
- package/dist/esm/validator/utils.d.ts +16 -0
- package/dist/esm/validator/utils.js +359 -0
- package/dist/esm/validator/utils.js.map +1 -0
- package/package.json +32 -0
- package/src/decoders/component-decoder.ts +48 -0
- package/src/decoders/custom-combinators.ts +59 -0
- package/src/decoders/index.ts +2 -0
- package/src/decoders/project-decoder.ts +40 -0
- package/src/decoders/utils.ts +571 -0
- package/src/index.ts +9 -0
- package/src/parser/index.ts +227 -0
- package/src/validator/index.ts +105 -0
- package/src/validator/utils.ts +463 -0
- package/tsconfig.json +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 teleporthq
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# teleport-uidl-validator
|
|
2
|
+
|
|
3
|
+
A module that offers validation and parsing for non-standard UIDL structures.
|
|
4
|
+
|
|
5
|
+
> This package is part of the [teleport ecosystem](https://github.com/teleporthq/teleport-code-generators). For a complete guide, check out the [official documentation](https://docs.teleporthq.io/).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
```bash
|
|
9
|
+
npm install @teleporthq/teleport-uidl-validator
|
|
10
|
+
```
|
|
11
|
+
or
|
|
12
|
+
```bash
|
|
13
|
+
yarn add @teleporthq/teleport-uidl-validator
|
|
14
|
+
```
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ComponentWithPrimitiveProps",
|
|
3
|
+
"propDefinitions": {
|
|
4
|
+
"test": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"defaultValue": "123"
|
|
7
|
+
},
|
|
8
|
+
"content": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"defaultValue": {
|
|
11
|
+
"heading": "Hello World"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"node": {
|
|
16
|
+
"type": "element",
|
|
17
|
+
"content": {
|
|
18
|
+
"elementType": "container",
|
|
19
|
+
"referencedStyles": {
|
|
20
|
+
"5ed0cb9ff4fd989551c4edc0": {
|
|
21
|
+
"id": "5ed0cb9ff4fd989551c4edc0",
|
|
22
|
+
"type": "style-map",
|
|
23
|
+
"content": {
|
|
24
|
+
"mapType": "inlined",
|
|
25
|
+
"conditions": [
|
|
26
|
+
{ "conditionType": "screen-size", "maxWidth": 991 }
|
|
27
|
+
],
|
|
28
|
+
"styles": {
|
|
29
|
+
"flex-wrap": "wrap"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"style": {
|
|
35
|
+
"flexDirection": {
|
|
36
|
+
"type": "dynamic",
|
|
37
|
+
"content": {
|
|
38
|
+
"referenceType":"prop",
|
|
39
|
+
"id": "test"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"alignSelf": {"type":"static", "content": "center"}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
"attrs": {
|
|
46
|
+
"data-test": {
|
|
47
|
+
"type": "dynamic",
|
|
48
|
+
"content": {
|
|
49
|
+
"referenceType":"prop",
|
|
50
|
+
"id": "test"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"data-static": { "type":"static", "content":"I am just a static string"},
|
|
54
|
+
"data-inner-value": {
|
|
55
|
+
"type": "dynamic",
|
|
56
|
+
"content": {
|
|
57
|
+
"referenceType":"prop",
|
|
58
|
+
"id": "content.heading"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
"children": [
|
|
64
|
+
{"type":"static", "content": "hello I am a test"},
|
|
65
|
+
{"type": "dynamic", "content": {"referenceType": "prop", "id": "content.heading"}},
|
|
66
|
+
{"type": "dynamic", "content": {"referenceType":"prop", "id": "children"}},
|
|
67
|
+
{
|
|
68
|
+
"type": "element",
|
|
69
|
+
"content": {
|
|
70
|
+
"elementType": "container",
|
|
71
|
+
|
|
72
|
+
"style": {
|
|
73
|
+
"flexDirection": {
|
|
74
|
+
"type": "dynamic",
|
|
75
|
+
"content": {
|
|
76
|
+
"referenceType":"prop",
|
|
77
|
+
"id": "test"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"alignSelf": {"type":"static", "content": "center"}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
"attrs": {
|
|
84
|
+
"data-test": {
|
|
85
|
+
"type": "dynamic",
|
|
86
|
+
"content": {
|
|
87
|
+
"referenceType":"prop",
|
|
88
|
+
"id": "test"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"data-static": { "type":"static", "content":"I am just a static string"},
|
|
92
|
+
"data-inner-value": {
|
|
93
|
+
"type": "dynamic",
|
|
94
|
+
"content": {
|
|
95
|
+
"referenceType":"prop",
|
|
96
|
+
"id": "content.heading"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
"children": [
|
|
102
|
+
{"type":"static", "content": "hello I am a test"},
|
|
103
|
+
{"type": "dynamic", "content": {"referenceType": "prop", "id": "content.heading"}},
|
|
104
|
+
{"type": "dynamic", "content": {"referenceType": "prop", "id": "children"}}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import componentInputJSON from './component-with-primitive-values.json'
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import componentResultJSON from './component-with-proper-values.json'
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import componentStyleSetsInputJSON from './component-with-reusalble-styles.json'
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import componentWithReferencedStylesJSON from './componennt-with-referenced-styles.json'
|
|
9
|
+
|
|
10
|
+
import { parseComponentJSON, parseProjectJSON } from '../../src/parser'
|
|
11
|
+
import { ComponentUIDL } from '@teleporthq/teleport-types'
|
|
12
|
+
|
|
13
|
+
describe('parseComponentJSON', () => {
|
|
14
|
+
it('transforms primitive component values', () => {
|
|
15
|
+
const componentResult = parseComponentJSON(componentInputJSON)
|
|
16
|
+
expect(componentResult).toEqual(componentResultJSON)
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
describe('parseProjectJSON', () => {
|
|
21
|
+
it('transforms primitive project values', () => {
|
|
22
|
+
const componentResult = parseProjectJSON({
|
|
23
|
+
root: componentInputJSON,
|
|
24
|
+
components: {
|
|
25
|
+
test: componentInputJSON,
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
expect(componentResult).toEqual({
|
|
29
|
+
root: componentResultJSON,
|
|
30
|
+
components: {
|
|
31
|
+
test: componentResultJSON,
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('styleSetDefinitions in root of Project UIDL', () => {
|
|
38
|
+
it('Parses and convertes string styles to static nodes in styleSetDefinitions', () => {
|
|
39
|
+
const result = parseProjectJSON({
|
|
40
|
+
root: componentStyleSetsInputJSON,
|
|
41
|
+
components: {},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
expect(result.root.styleSetDefinitions).toStrictEqual({
|
|
45
|
+
primaryButton: {
|
|
46
|
+
type: 'reusable-project-style-map',
|
|
47
|
+
content: {
|
|
48
|
+
background: {
|
|
49
|
+
type: 'static',
|
|
50
|
+
content: 'blue',
|
|
51
|
+
},
|
|
52
|
+
width: {
|
|
53
|
+
type: 'static',
|
|
54
|
+
content: 'auto',
|
|
55
|
+
},
|
|
56
|
+
color: {
|
|
57
|
+
type: 'static',
|
|
58
|
+
content: '#fff',
|
|
59
|
+
},
|
|
60
|
+
border: {
|
|
61
|
+
type: 'static',
|
|
62
|
+
content: '1px solid #fff',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
secondaryButton: {
|
|
67
|
+
type: 'reusable-project-style-map',
|
|
68
|
+
content: {
|
|
69
|
+
background: {
|
|
70
|
+
type: 'static',
|
|
71
|
+
content: 'red',
|
|
72
|
+
},
|
|
73
|
+
width: {
|
|
74
|
+
type: 'static',
|
|
75
|
+
content: 'auto',
|
|
76
|
+
},
|
|
77
|
+
color: {
|
|
78
|
+
type: 'static',
|
|
79
|
+
content: '#fff',
|
|
80
|
+
},
|
|
81
|
+
border: {
|
|
82
|
+
type: 'static',
|
|
83
|
+
content: '1px solid #fff',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
describe('RefernecedStyles for ComponentUIDL', () => {
|
|
92
|
+
it('Parser referencedStyles and generate static nodes for string based styles', () => {
|
|
93
|
+
const result = parseComponentJSON(componentWithReferencedStylesJSON)
|
|
94
|
+
|
|
95
|
+
expect(
|
|
96
|
+
result.node.content.referencedStyles['5ed0cb9ff4fd989551c4edc0'].content.styles
|
|
97
|
+
).toStrictEqual({ 'flex-wrap': { type: 'static', content: 'wrap' } })
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it('Parses referencedStyles with project-referenced nodes', () => {
|
|
101
|
+
const uidl = componentStyleSetsInputJSON as unknown as ComponentUIDL
|
|
102
|
+
uidl.node.content.referencedStyles = {
|
|
103
|
+
...uidl.node.content.referencedStyles,
|
|
104
|
+
'5ed6146d471fde6d6a47ba16': {
|
|
105
|
+
type: 'style-map',
|
|
106
|
+
content: {
|
|
107
|
+
mapType: 'project-referenced',
|
|
108
|
+
referenceId: 'secondaryButton',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const result = parseComponentJSON(uidl as unknown as Record<string, unknown>)
|
|
114
|
+
expect(result).toEqual(result)
|
|
115
|
+
})
|
|
116
|
+
})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { component, elementNode } from '@teleporthq/teleport-uidl-builders'
|
|
2
|
+
import { parseComponentJSON } from '../../src/parser'
|
|
3
|
+
|
|
4
|
+
describe('Parses referenced Styles and parsers static or number', () => {
|
|
5
|
+
it('Converts the static values to Static Nodes', () => {
|
|
6
|
+
const componentUIDL = component(
|
|
7
|
+
'MyComponent',
|
|
8
|
+
elementNode('container', {}, [], null, {}, null, {})
|
|
9
|
+
)
|
|
10
|
+
componentUIDL.node.content.referencedStyles = {
|
|
11
|
+
'12345678': {
|
|
12
|
+
type: 'style-map',
|
|
13
|
+
content: {
|
|
14
|
+
mapType: 'component-referenced',
|
|
15
|
+
content: {
|
|
16
|
+
type: 'static',
|
|
17
|
+
content: 'md-8',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
const result = parseComponentJSON(componentUIDL as unknown as Record<string, unknown>)
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
expect(Object.values(result.node.content.referencedStyles)[0].content.content.type).toBe(
|
|
25
|
+
'static'
|
|
26
|
+
)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('Throws error if the mapType is invalid', () => {
|
|
30
|
+
const componentUIDL = component(
|
|
31
|
+
'MyComponent',
|
|
32
|
+
elementNode('container', {}, [], null, {}, null, {})
|
|
33
|
+
)
|
|
34
|
+
componentUIDL.node.content.referencedStyles = {
|
|
35
|
+
'12345678': {
|
|
36
|
+
type: 'style-map',
|
|
37
|
+
content: {
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
mapType: 'invalid-type',
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
content: 'md-8',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
expect(() => parseComponentJSON(componentUIDL as unknown as Record<string, unknown>)).toThrow(
|
|
47
|
+
'Un-expected mapType passed in referencedStyles - invalid-type'
|
|
48
|
+
)
|
|
49
|
+
})
|
|
50
|
+
})
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ComponentWithPrimitiveProps",
|
|
3
|
+
"propDefinitions": {
|
|
4
|
+
"test": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"defaultValue": "123"
|
|
7
|
+
},
|
|
8
|
+
"content": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"defaultValue": {
|
|
11
|
+
"heading": "Hello World"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"node": {
|
|
16
|
+
"type": "element",
|
|
17
|
+
"content": {
|
|
18
|
+
"elementType": "container",
|
|
19
|
+
|
|
20
|
+
"style": {
|
|
21
|
+
"flexDirection": "$props.test",
|
|
22
|
+
"alignSelf": "center"
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
"attrs": {
|
|
26
|
+
"data-test": "$props.test",
|
|
27
|
+
"data-static": "I am just a static string",
|
|
28
|
+
"data-inner-value": "$props.content.heading"
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
"children": [
|
|
32
|
+
"hello I am a test",
|
|
33
|
+
"$props.content.heading",
|
|
34
|
+
"$props.children",
|
|
35
|
+
{
|
|
36
|
+
"type": "element",
|
|
37
|
+
"content": {
|
|
38
|
+
"elementType": "container",
|
|
39
|
+
|
|
40
|
+
"style": {
|
|
41
|
+
"flexDirection": "$props.test",
|
|
42
|
+
"alignSelf": "center"
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
"attrs": {
|
|
46
|
+
"data-test": "$props.test",
|
|
47
|
+
"data-static": "I am just a static string",
|
|
48
|
+
"data-inner-value": "$props.content.heading"
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
"children": [
|
|
52
|
+
"hello I am a test",
|
|
53
|
+
"$props.content.heading",
|
|
54
|
+
"$props.children"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ComponentWithPrimitiveProps",
|
|
3
|
+
"propDefinitions": {
|
|
4
|
+
"test": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"defaultValue": "123"
|
|
7
|
+
},
|
|
8
|
+
"content": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"defaultValue": {
|
|
11
|
+
"heading": "Hello World"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"node": {
|
|
16
|
+
"type": "element",
|
|
17
|
+
"content": {
|
|
18
|
+
"elementType": "container",
|
|
19
|
+
|
|
20
|
+
"style": {
|
|
21
|
+
"flexDirection": {
|
|
22
|
+
"type": "dynamic",
|
|
23
|
+
"content": {
|
|
24
|
+
"referenceType":"prop",
|
|
25
|
+
"id": "test"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"alignSelf": {"type":"static", "content": "center"}
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
"attrs": {
|
|
32
|
+
"data-test": {
|
|
33
|
+
"type": "dynamic",
|
|
34
|
+
"content": {
|
|
35
|
+
"referenceType":"prop",
|
|
36
|
+
"id": "test"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"data-static": { "type":"static", "content":"I am just a static string"},
|
|
40
|
+
"data-inner-value": {
|
|
41
|
+
"type": "dynamic",
|
|
42
|
+
"content": {
|
|
43
|
+
"referenceType":"prop",
|
|
44
|
+
"id": "content.heading"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
"children": [
|
|
50
|
+
{"type":"static", "content": "hello I am a test"},
|
|
51
|
+
{"type": "dynamic", "content": {"referenceType": "prop", "id": "content.heading"}},
|
|
52
|
+
{"type": "dynamic", "content": {"referenceType":"prop", "id": "children"}},
|
|
53
|
+
{
|
|
54
|
+
"type": "element",
|
|
55
|
+
"content": {
|
|
56
|
+
"elementType": "container",
|
|
57
|
+
|
|
58
|
+
"style": {
|
|
59
|
+
"flexDirection": {
|
|
60
|
+
"type": "dynamic",
|
|
61
|
+
"content": {
|
|
62
|
+
"referenceType":"prop",
|
|
63
|
+
"id": "test"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"alignSelf": {"type":"static", "content": "center"}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
"attrs": {
|
|
70
|
+
"data-test": {
|
|
71
|
+
"type": "dynamic",
|
|
72
|
+
"content": {
|
|
73
|
+
"referenceType":"prop",
|
|
74
|
+
"id": "test"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"data-static": { "type":"static", "content":"I am just a static string"},
|
|
78
|
+
"data-inner-value": {
|
|
79
|
+
"type": "dynamic",
|
|
80
|
+
"content": {
|
|
81
|
+
"referenceType":"prop",
|
|
82
|
+
"id": "content.heading"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
"children": [
|
|
88
|
+
{"type":"static", "content": "hello I am a test"},
|
|
89
|
+
{"type": "dynamic", "content": {"referenceType": "prop", "id": "content.heading"}},
|
|
90
|
+
{"type": "dynamic", "content": {"referenceType": "prop", "id": "children"}}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ComponentWithPrimitiveProps",
|
|
3
|
+
"styleSetDefinitions": {
|
|
4
|
+
"primaryButton": {
|
|
5
|
+
"type": "reusable-project-style-map",
|
|
6
|
+
"content": {
|
|
7
|
+
"background": "blue",
|
|
8
|
+
"width": "auto",
|
|
9
|
+
"color": "#fff",
|
|
10
|
+
"border": "1px solid #fff"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"secondaryButton": {
|
|
14
|
+
"type": "reusable-project-style-map",
|
|
15
|
+
"content": {
|
|
16
|
+
"background": "red",
|
|
17
|
+
"width": "auto",
|
|
18
|
+
"color": "#fff",
|
|
19
|
+
"border": "1px solid #fff"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"propDefinitions": {
|
|
24
|
+
"test": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"defaultValue": "123"
|
|
27
|
+
},
|
|
28
|
+
"content": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"defaultValue": {
|
|
31
|
+
"heading": "Hello World"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"node": {
|
|
36
|
+
"type": "element",
|
|
37
|
+
"content": {
|
|
38
|
+
"elementType": "container",
|
|
39
|
+
"referencedStyles": {},
|
|
40
|
+
"style": {
|
|
41
|
+
"flexDirection": {
|
|
42
|
+
"type": "dynamic",
|
|
43
|
+
"content": {
|
|
44
|
+
"referenceType":"prop",
|
|
45
|
+
"id": "test"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"alignSelf": {"type":"static", "content": "center"}
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
"attrs": {
|
|
52
|
+
"data-test": {
|
|
53
|
+
"type": "dynamic",
|
|
54
|
+
"content": {
|
|
55
|
+
"referenceType":"prop",
|
|
56
|
+
"id": "test"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"data-static": { "type":"static", "content":"I am just a static string"},
|
|
60
|
+
"data-inner-value": {
|
|
61
|
+
"type": "dynamic",
|
|
62
|
+
"content": {
|
|
63
|
+
"referenceType":"prop",
|
|
64
|
+
"id": "content.heading"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
"children": [
|
|
70
|
+
{"type":"static", "content": "hello I am a test"},
|
|
71
|
+
{"type": "dynamic", "content": {"referenceType": "prop", "id": "content.heading"}},
|
|
72
|
+
{"type": "dynamic", "content": {"referenceType":"prop", "id": "children"}},
|
|
73
|
+
{
|
|
74
|
+
"type": "element",
|
|
75
|
+
"content": {
|
|
76
|
+
"elementType": "container",
|
|
77
|
+
|
|
78
|
+
"style": {
|
|
79
|
+
"flexDirection": {
|
|
80
|
+
"type": "dynamic",
|
|
81
|
+
"content": {
|
|
82
|
+
"referenceType":"prop",
|
|
83
|
+
"id": "test"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"alignSelf": {"type":"static", "content": "center"}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
"attrs": {
|
|
90
|
+
"data-test": {
|
|
91
|
+
"type": "dynamic",
|
|
92
|
+
"content": {
|
|
93
|
+
"referenceType":"prop",
|
|
94
|
+
"id": "test"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"data-static": { "type":"static", "content":"I am just a static string"},
|
|
98
|
+
"data-inner-value": {
|
|
99
|
+
"type": "dynamic",
|
|
100
|
+
"content": {
|
|
101
|
+
"referenceType":"prop",
|
|
102
|
+
"id": "content.heading"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
"children": [
|
|
108
|
+
{"type":"static", "content": "hello I am a test"},
|
|
109
|
+
{"type": "dynamic", "content": {"referenceType": "prop", "id": "content.heading"}},
|
|
110
|
+
{"type": "dynamic", "content": {"referenceType": "prop", "id": "children"}}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Simple Component",
|
|
3
|
+
"propDefinitions": {
|
|
4
|
+
"heading": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"defaultValue": "Hello"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"node": {
|
|
10
|
+
"type": "element",
|
|
11
|
+
"content": {
|
|
12
|
+
"elementType": "container",
|
|
13
|
+
"name": "",
|
|
14
|
+
"referencedStyles": {},
|
|
15
|
+
"abilities": {},
|
|
16
|
+
"children": [
|
|
17
|
+
{
|
|
18
|
+
"type": "element",
|
|
19
|
+
"content": {
|
|
20
|
+
"elementType": "text",
|
|
21
|
+
"referencedStyles": {},
|
|
22
|
+
"abilities": {},
|
|
23
|
+
"children": [
|
|
24
|
+
{
|
|
25
|
+
"type": "static",
|
|
26
|
+
"content": "Hello"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"semanticType": "span"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"semanticType": "div"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|