@teleporthq/teleport-uidl-builders 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__/component-builders.ts +110 -0
- package/__tests__/project-builders.ts +28 -0
- package/dist/cjs/component-builders.d.ts +15 -0
- package/dist/cjs/component-builders.js +119 -0
- package/dist/cjs/component-builders.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/project-builders.d.ts +47 -0
- package/dist/cjs/project-builders.js +91 -0
- package/dist/cjs/project-builders.js.map +1 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/component-builders.d.ts +15 -0
- package/dist/esm/component-builders.js +105 -0
- package/dist/esm/component-builders.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/project-builders.d.ts +47 -0
- package/dist/esm/project-builders.js +77 -0
- package/dist/esm/project-builders.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/package.json +30 -0
- package/src/component-builders.ts +181 -0
- package/src/index.ts +2 -0
- package/src/project-builders.ts +120 -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-builders
|
|
2
|
+
|
|
3
|
+
A set of functions used for constructing 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-builders
|
|
10
|
+
```
|
|
11
|
+
or
|
|
12
|
+
```bash
|
|
13
|
+
yarn add @teleporthq/teleport-uidl-builders
|
|
14
|
+
```
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
component,
|
|
3
|
+
definition,
|
|
4
|
+
elementNode,
|
|
5
|
+
staticNode,
|
|
6
|
+
dynamicNode,
|
|
7
|
+
repeatNode,
|
|
8
|
+
conditionalNode,
|
|
9
|
+
} from '../src/component-builders'
|
|
10
|
+
import { UIDLStaticValue, UIDLElement, UIDLDynamicReference } from '@teleporthq/teleport-types'
|
|
11
|
+
|
|
12
|
+
describe('UIDL Builders', () => {
|
|
13
|
+
describe('component', () => {
|
|
14
|
+
const dummyNode: UIDLStaticValue = { type: 'static', content: 'test' }
|
|
15
|
+
|
|
16
|
+
it('returns a new ComponentUIDL object', () => {
|
|
17
|
+
const testComponent = component('uidl-test', dummyNode)
|
|
18
|
+
|
|
19
|
+
expect(testComponent.name).toBe('uidl-test')
|
|
20
|
+
expect(testComponent.node.content).toBe('test')
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('adds prop and state definitions', () => {
|
|
24
|
+
const testComponent = component(
|
|
25
|
+
'uidl-test',
|
|
26
|
+
dummyNode,
|
|
27
|
+
{
|
|
28
|
+
'test-prop': definition('string', 'empty-string'),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
'test-state': definition('boolean', false),
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
expect(testComponent.name).toBe('uidl-test')
|
|
36
|
+
expect(testComponent.node.content).toBe('test')
|
|
37
|
+
expect(testComponent.propDefinitions['test-prop'].defaultValue).toBe('empty-string')
|
|
38
|
+
expect(testComponent.stateDefinitions['test-state'].defaultValue).toBe(false)
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
describe('elementNode', () => {
|
|
43
|
+
it('returns a new UIDLElement node', () => {
|
|
44
|
+
const element = elementNode('div', {
|
|
45
|
+
test: staticNode('test-value'),
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
expect(element.type).toBe('element')
|
|
49
|
+
expect(element.content.attrs.test.content).toBe('test-value')
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('adds children inside the root node', () => {
|
|
53
|
+
const element = elementNode('div', {}, [elementNode('span', {})])
|
|
54
|
+
|
|
55
|
+
expect(element.type).toBe('element')
|
|
56
|
+
expect(element.content.children[0].type).toBe('element')
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('adds dependencies', () => {
|
|
60
|
+
const dependency = {
|
|
61
|
+
type: 'package',
|
|
62
|
+
path: 'npm-dependency',
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const element = elementNode('div', {}, [elementNode('span', {})], dependency)
|
|
66
|
+
|
|
67
|
+
expect(element.content.dependency.type).toBe('package')
|
|
68
|
+
expect(element.content.dependency.path).toBe('npm-dependency')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('adds style', () => {
|
|
72
|
+
const element = elementNode('div', {}, [elementNode('span', {})], null, {
|
|
73
|
+
height: staticNode('100px'),
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
expect(element.content.style.height.content).toBe('100px')
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
describe('dynamic node', () => {
|
|
81
|
+
it('returns a dynamic node', () => {
|
|
82
|
+
const node = dynamicNode('prop', 'title')
|
|
83
|
+
|
|
84
|
+
expect(node.content.id).toBe('title')
|
|
85
|
+
expect(node.content.referenceType).toBe('prop')
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
describe('conditional node', () => {
|
|
90
|
+
it('returns a conditional node', () => {
|
|
91
|
+
const node = conditionalNode(dynamicNode('state', 'isVisible'), elementNode('div'), true)
|
|
92
|
+
|
|
93
|
+
expect(node.content.value).toBe(true)
|
|
94
|
+
expect((node.content.node.content as UIDLElement).elementType).toBe('div')
|
|
95
|
+
expect(node.content.reference.content.id).toBe('isVisible')
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
describe('repeat node', () => {
|
|
100
|
+
it('returns a repeat node', () => {
|
|
101
|
+
const node = repeatNode(elementNode('div'), dynamicNode('prop', 'items'), {
|
|
102
|
+
useIndex: true,
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
expect((node.content.dataSource as UIDLDynamicReference).content.id).toBe('items')
|
|
106
|
+
expect((node.content.node.content as UIDLElement).elementType).toBe('div')
|
|
107
|
+
expect(node.content.meta.useIndex).toBe(true)
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { component } from '../src/component-builders'
|
|
2
|
+
import { ProjectUIDL, ComponentUIDL, UIDLStaticValue } from '@teleporthq/teleport-types'
|
|
3
|
+
import { project, simpleProjectGlobals } from '../src/project-builders'
|
|
4
|
+
|
|
5
|
+
describe('Project Builders', () => {
|
|
6
|
+
const dummyNode: UIDLStaticValue = { type: 'static', content: 'test' }
|
|
7
|
+
const dummyRootComponent: ComponentUIDL = component('component-root-test', dummyNode)
|
|
8
|
+
const dummyComponent: ComponentUIDL = component('component-test', dummyNode)
|
|
9
|
+
|
|
10
|
+
it('returns a new simpleProjectGlobals object', () => {
|
|
11
|
+
const testProjectGlobals = simpleProjectGlobals('test-globals')
|
|
12
|
+
|
|
13
|
+
expect(testProjectGlobals.settings.title).toBe('test-globals')
|
|
14
|
+
expect(testProjectGlobals.settings.language).toBe('en')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('returns a new ProjectUIDL object', () => {
|
|
18
|
+
const testProjectUIDL: ProjectUIDL = project(
|
|
19
|
+
'project-uidl-test',
|
|
20
|
+
dummyRootComponent,
|
|
21
|
+
[dummyComponent],
|
|
22
|
+
simpleProjectGlobals('test-globals')
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
expect(testProjectUIDL.name).toBe('project-uidl-test')
|
|
26
|
+
expect(testProjectUIDL.root.name).toBe('component-root-test')
|
|
27
|
+
})
|
|
28
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentUIDL, ReferenceType, UIDLDependency, UIDLNode, UIDLSlotNode, UIDLStyleValue, UIDLRepeatNode, UIDLElementNode, UIDLStaticValue, UIDLAttributeValue, UIDLPropDefinition, UIDLStateDefinition, UIDLConditionalNode, UIDLDynamicReference, UIDLEventDefinitions, UIDLRawValue, UIDLReferencedStyles, UIDLElement } from '@teleporthq/teleport-types';
|
|
2
|
+
export declare const component: (name: string, node: UIDLElementNode, propDefinitions?: Record<string, UIDLPropDefinition>, stateDefinitions?: Record<string, UIDLStateDefinition>) => ComponentUIDL;
|
|
3
|
+
export declare const definition: (type: string, defaultValue: string | number | boolean | unknown[] | object) => {
|
|
4
|
+
type: string;
|
|
5
|
+
defaultValue: string | number | boolean | object | unknown[];
|
|
6
|
+
};
|
|
7
|
+
export declare const elementNode: (elementType: string, attrs?: Record<string, UIDLAttributeValue>, children?: UIDLNode[], dependency?: UIDLDependency, style?: Record<string, UIDLStyleValue>, events?: UIDLEventDefinitions, referencedStyles?: UIDLReferencedStyles) => UIDLElementNode;
|
|
8
|
+
export declare const element: (elementType: string, attrs?: Record<string, UIDLAttributeValue>, children?: UIDLNode[], dependency?: UIDLDependency, events?: UIDLEventDefinitions, style?: Record<string, UIDLStyleValue>, referencedStyles?: UIDLReferencedStyles) => UIDLElement;
|
|
9
|
+
export declare const componentDependency: (type: 'library' | 'package' | 'local', path?: string, version?: string, meta?: Record<string, string | boolean>) => UIDLDependency;
|
|
10
|
+
export declare const staticNode: (content: string) => UIDLStaticValue;
|
|
11
|
+
export declare const dynamicNode: (referenceType: ReferenceType, id: string) => UIDLDynamicReference;
|
|
12
|
+
export declare const slotNode: (fallback?: UIDLElementNode | UIDLStaticValue | UIDLDynamicReference, name?: string) => UIDLSlotNode;
|
|
13
|
+
export declare const conditionalNode: (reference: UIDLDynamicReference, node: UIDLNode, value: string | number | boolean) => UIDLConditionalNode;
|
|
14
|
+
export declare const repeatNode: (node: UIDLElementNode, dataSource: UIDLAttributeValue, meta?: Record<string, unknown>) => UIDLRepeatNode;
|
|
15
|
+
export declare const rawNode: (content: string) => UIDLRawValue;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rawNode = exports.repeatNode = exports.conditionalNode = exports.slotNode = exports.dynamicNode = exports.staticNode = exports.componentDependency = exports.element = exports.elementNode = exports.definition = exports.component = void 0;
|
|
4
|
+
var component = function (name, node, propDefinitions, stateDefinitions) {
|
|
5
|
+
return {
|
|
6
|
+
name: name,
|
|
7
|
+
node: node,
|
|
8
|
+
stateDefinitions: stateDefinitions,
|
|
9
|
+
propDefinitions: propDefinitions,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.component = component;
|
|
13
|
+
var definition = function (type, defaultValue) {
|
|
14
|
+
return {
|
|
15
|
+
type: type,
|
|
16
|
+
defaultValue: defaultValue,
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.definition = definition;
|
|
20
|
+
var elementNode = function (elementType, attrs, children, dependency, style, events, referencedStyles) {
|
|
21
|
+
return {
|
|
22
|
+
type: 'element',
|
|
23
|
+
content: exports.element(elementType, attrs, children, dependency, events, style, referencedStyles),
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.elementNode = elementNode;
|
|
27
|
+
var element = function (elementType, attrs, children, dependency, events, style, referencedStyles) {
|
|
28
|
+
var elementObj = {
|
|
29
|
+
key: elementType,
|
|
30
|
+
elementType: elementType,
|
|
31
|
+
name: elementType,
|
|
32
|
+
children: children,
|
|
33
|
+
};
|
|
34
|
+
if (attrs) {
|
|
35
|
+
elementObj.attrs = attrs;
|
|
36
|
+
}
|
|
37
|
+
if (events) {
|
|
38
|
+
elementObj.events = events;
|
|
39
|
+
}
|
|
40
|
+
if (dependency) {
|
|
41
|
+
elementObj.elementType = 'component';
|
|
42
|
+
elementObj.semanticType = elementType;
|
|
43
|
+
elementObj.dependency = dependency;
|
|
44
|
+
}
|
|
45
|
+
if (style) {
|
|
46
|
+
elementObj.style = style;
|
|
47
|
+
}
|
|
48
|
+
if (referencedStyles) {
|
|
49
|
+
elementObj.referencedStyles = referencedStyles;
|
|
50
|
+
}
|
|
51
|
+
return elementObj;
|
|
52
|
+
};
|
|
53
|
+
exports.element = element;
|
|
54
|
+
var componentDependency = function (type, path, version, meta) {
|
|
55
|
+
return {
|
|
56
|
+
type: type,
|
|
57
|
+
path: path,
|
|
58
|
+
version: version,
|
|
59
|
+
meta: meta,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
exports.componentDependency = componentDependency;
|
|
63
|
+
var staticNode = function (content) {
|
|
64
|
+
return {
|
|
65
|
+
type: 'static',
|
|
66
|
+
content: content,
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
exports.staticNode = staticNode;
|
|
70
|
+
var dynamicNode = function (referenceType, id) {
|
|
71
|
+
return {
|
|
72
|
+
type: 'dynamic',
|
|
73
|
+
content: {
|
|
74
|
+
referenceType: referenceType,
|
|
75
|
+
id: id,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
exports.dynamicNode = dynamicNode;
|
|
80
|
+
var slotNode = function (fallback, name) {
|
|
81
|
+
return {
|
|
82
|
+
type: 'slot',
|
|
83
|
+
content: {
|
|
84
|
+
fallback: fallback,
|
|
85
|
+
name: name,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
exports.slotNode = slotNode;
|
|
90
|
+
var conditionalNode = function (reference, node, value) {
|
|
91
|
+
return {
|
|
92
|
+
type: 'conditional',
|
|
93
|
+
content: {
|
|
94
|
+
reference: reference,
|
|
95
|
+
node: node,
|
|
96
|
+
value: value,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
exports.conditionalNode = conditionalNode;
|
|
101
|
+
var repeatNode = function (node, dataSource, meta) {
|
|
102
|
+
return {
|
|
103
|
+
type: 'repeat',
|
|
104
|
+
content: {
|
|
105
|
+
node: node,
|
|
106
|
+
dataSource: dataSource,
|
|
107
|
+
meta: meta,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
exports.repeatNode = repeatNode;
|
|
112
|
+
var rawNode = function (content) {
|
|
113
|
+
return {
|
|
114
|
+
type: 'raw',
|
|
115
|
+
content: content,
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
exports.rawNode = rawNode;
|
|
119
|
+
//# sourceMappingURL=component-builders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-builders.js","sourceRoot":"","sources":["../../src/component-builders.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./project-builders"), exports);
|
|
14
|
+
__exportStar(require("./component-builders"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkC;AAClC,uDAAoC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ComponentUIDL, ProjectUIDL, UIDLGlobalAsset, WebManifest, UIDLGlobalProjectValues } from '@teleporthq/teleport-types';
|
|
2
|
+
export declare const project: (name: string, root: ComponentUIDL, components: ComponentUIDL[], globals?: {
|
|
3
|
+
settings: {
|
|
4
|
+
title: string;
|
|
5
|
+
language: string;
|
|
6
|
+
};
|
|
7
|
+
meta: Array<Record<string, string>>;
|
|
8
|
+
assets: UIDLGlobalAsset[];
|
|
9
|
+
manifest?: WebManifest;
|
|
10
|
+
variables?: Record<string, string>;
|
|
11
|
+
}) => ProjectUIDL;
|
|
12
|
+
export declare const UIDLArrayToRecord: (array: ComponentUIDL[]) => Record<string, ComponentUIDL>;
|
|
13
|
+
export declare const simpleProjectGlobals: (title?: string) => UIDLGlobalProjectValues;
|
|
14
|
+
export declare const explicitProjectGlobals: (title: string, language: string, meta: Array<Record<string, string>>, assets: UIDLGlobalAsset[], manifest?: WebManifest) => {
|
|
15
|
+
settings: {
|
|
16
|
+
title: string;
|
|
17
|
+
language: string;
|
|
18
|
+
};
|
|
19
|
+
assets: UIDLGlobalAsset[];
|
|
20
|
+
meta: Record<string, string>[];
|
|
21
|
+
manifest: WebManifest;
|
|
22
|
+
};
|
|
23
|
+
export declare const socialMediaMeta: (property: string, content: string) => {
|
|
24
|
+
property: string;
|
|
25
|
+
content: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const metaTag: (name: string, content: string) => {
|
|
28
|
+
name: string;
|
|
29
|
+
content: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const projectMeta: (meta: Array<Record<string, string>>) => Record<string, string>[];
|
|
32
|
+
export declare const manifestIcon: (src: string, type: string, sizes: string) => {
|
|
33
|
+
src: string;
|
|
34
|
+
type: string;
|
|
35
|
+
sizes: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const projectAssetPath: (type: string, path?: string, meta?: Record<string, string>) => {
|
|
38
|
+
type: string;
|
|
39
|
+
path: string;
|
|
40
|
+
meta: Record<string, string>;
|
|
41
|
+
};
|
|
42
|
+
export declare const projectAssetContent: (type: string, content?: string, meta?: Record<string, string>) => {
|
|
43
|
+
type: string;
|
|
44
|
+
content: string;
|
|
45
|
+
meta: Record<string, string>;
|
|
46
|
+
};
|
|
47
|
+
export declare const projectAssets: (assets: UIDLGlobalAsset[]) => UIDLGlobalAsset[];
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.projectAssets = exports.projectAssetContent = exports.projectAssetPath = exports.manifestIcon = exports.projectMeta = exports.metaTag = exports.socialMediaMeta = exports.explicitProjectGlobals = exports.simpleProjectGlobals = exports.UIDLArrayToRecord = exports.project = void 0;
|
|
4
|
+
var project = function (name, root, components, globals) {
|
|
5
|
+
return {
|
|
6
|
+
name: name,
|
|
7
|
+
root: root,
|
|
8
|
+
components: exports.UIDLArrayToRecord(components),
|
|
9
|
+
globals: globals || exports.simpleProjectGlobals(),
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.project = project;
|
|
13
|
+
var UIDLArrayToRecord = function (array) {
|
|
14
|
+
var record = {};
|
|
15
|
+
array.forEach(function (element) {
|
|
16
|
+
record[element.name] = element;
|
|
17
|
+
});
|
|
18
|
+
return record;
|
|
19
|
+
};
|
|
20
|
+
exports.UIDLArrayToRecord = UIDLArrayToRecord;
|
|
21
|
+
var simpleProjectGlobals = function (title) {
|
|
22
|
+
if (title === void 0) { title = 'My teleport project'; }
|
|
23
|
+
return {
|
|
24
|
+
settings: {
|
|
25
|
+
title: title,
|
|
26
|
+
language: 'en',
|
|
27
|
+
},
|
|
28
|
+
assets: [],
|
|
29
|
+
meta: [],
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.simpleProjectGlobals = simpleProjectGlobals;
|
|
33
|
+
var explicitProjectGlobals = function (title, language, meta, assets, manifest) {
|
|
34
|
+
return {
|
|
35
|
+
settings: {
|
|
36
|
+
title: title,
|
|
37
|
+
language: language,
|
|
38
|
+
},
|
|
39
|
+
assets: assets,
|
|
40
|
+
meta: meta,
|
|
41
|
+
manifest: manifest,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.explicitProjectGlobals = explicitProjectGlobals;
|
|
45
|
+
var socialMediaMeta = function (property, content) {
|
|
46
|
+
return {
|
|
47
|
+
property: property,
|
|
48
|
+
content: content,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.socialMediaMeta = socialMediaMeta;
|
|
52
|
+
var metaTag = function (name, content) {
|
|
53
|
+
return {
|
|
54
|
+
name: name,
|
|
55
|
+
content: content,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
exports.metaTag = metaTag;
|
|
59
|
+
var projectMeta = function (meta) {
|
|
60
|
+
return meta;
|
|
61
|
+
};
|
|
62
|
+
exports.projectMeta = projectMeta;
|
|
63
|
+
var manifestIcon = function (src, type, sizes) {
|
|
64
|
+
return {
|
|
65
|
+
src: src,
|
|
66
|
+
type: type,
|
|
67
|
+
sizes: sizes,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
exports.manifestIcon = manifestIcon;
|
|
71
|
+
var projectAssetPath = function (type, path, meta) {
|
|
72
|
+
return {
|
|
73
|
+
type: type,
|
|
74
|
+
path: path,
|
|
75
|
+
meta: meta,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
exports.projectAssetPath = projectAssetPath;
|
|
79
|
+
var projectAssetContent = function (type, content, meta) {
|
|
80
|
+
return {
|
|
81
|
+
type: type,
|
|
82
|
+
content: content,
|
|
83
|
+
meta: meta,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
exports.projectAssetContent = projectAssetContent;
|
|
87
|
+
var projectAssets = function (assets) {
|
|
88
|
+
return assets;
|
|
89
|
+
};
|
|
90
|
+
exports.projectAssets = projectAssets;
|
|
91
|
+
//# sourceMappingURL=project-builders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-builders.js","sourceRoot":"","sources":["../../src/project-builders.ts"],"names":[],"mappings":";;;AAQO,IAAM,OAAO,GAAG,UACrB,IAAY,EACZ,IAAmB,EACnB,UAA2B,EAC3B,OASC;IAED,OAAO;QACL,IAAI,MAAA;QACJ,IAAI,MAAA;QACJ,UAAU,EAAE,yBAAiB,CAAC,UAAU,CAAC;QACzC,OAAO,EAAE,OAAO,IAAI,4BAAoB,EAAE;KAC3C,CAAA;AACH,CAAC,CAAA;AArBY,QAAA,OAAO,WAqBnB;AAEM,IAAM,iBAAiB,GAAG,UAAC,KAAsB;IACtD,IAAM,MAAM,GAAkC,EAAE,CAAA;IAChD,KAAK,CAAC,OAAO,CAAC,UAAC,OAAO;QACpB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAPY,QAAA,iBAAiB,qBAO7B;AAEM,IAAM,oBAAoB,GAAG,UAClC,KAAqC;IAArC,sBAAA,EAAA,6BAAqC;IAErC,OAAO;QACL,QAAQ,EAAE;YACR,KAAK,OAAA;YACL,QAAQ,EAAE,IAAI;SACf;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,EAAE;KACT,CAAA;AACH,CAAC,CAAA;AAXY,QAAA,oBAAoB,wBAWhC;AAEM,IAAM,sBAAsB,GAAG,UACpC,KAAa,EACb,QAAgB,EAChB,IAAmC,EACnC,MAAyB,EACzB,QAAsB;IAEtB,OAAO;QACL,QAAQ,EAAE;YACR,KAAK,OAAA;YACL,QAAQ,UAAA;SACT;QACD,MAAM,QAAA;QACN,IAAI,MAAA;QACJ,QAAQ,UAAA;KACT,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,sBAAsB,0BAgBlC;AAEM,IAAM,eAAe,GAAG,UAAC,QAAgB,EAAE,OAAe;IAC/D,OAAO;QACL,QAAQ,UAAA;QACR,OAAO,SAAA;KACR,CAAA;AACH,CAAC,CAAA;AALY,QAAA,eAAe,mBAK3B;AAEM,IAAM,OAAO,GAAG,UAAC,IAAY,EAAE,OAAe;IACnD,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,SAAA;KACR,CAAA;AACH,CAAC,CAAA;AALY,QAAA,OAAO,WAKnB;AAEM,IAAM,WAAW,GAAG,UAAC,IAAmC;IAC7D,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAFY,QAAA,WAAW,eAEvB;AAEM,IAAM,YAAY,GAAG,UAAC,GAAW,EAAE,IAAY,EAAE,KAAa;IACnE,OAAO;QACL,GAAG,KAAA;QACH,IAAI,MAAA;QACJ,KAAK,OAAA;KACN,CAAA;AACH,CAAC,CAAA;AANY,QAAA,YAAY,gBAMxB;AAEM,IAAM,gBAAgB,GAAG,UAAC,IAAY,EAAE,IAAa,EAAE,IAA6B;IACzF,OAAO;QACL,IAAI,MAAA;QACJ,IAAI,MAAA;QACJ,IAAI,MAAA;KACL,CAAA;AACH,CAAC,CAAA;AANY,QAAA,gBAAgB,oBAM5B;AAEM,IAAM,mBAAmB,GAAG,UACjC,IAAY,EACZ,OAAgB,EAChB,IAA6B;IAE7B,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,SAAA;QACP,IAAI,MAAA;KACL,CAAA;AACH,CAAC,CAAA;AAVY,QAAA,mBAAmB,uBAU/B;AAEM,IAAM,aAAa,GAAG,UAAC,MAAyB;IACrD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAFY,QAAA,aAAa,iBAEzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../teleport-types/dist/cjs/uidl.d.ts","../../../teleport-types/dist/cjs/generators.d.ts","../../../teleport-types/dist/cjs/errors.d.ts","../../../teleport-types/dist/cjs/vuidl.d.ts","../../../teleport-types/dist/cjs/index.d.ts","../../src/component-builders.ts","../../src/project-builders.ts","../../src/index.ts","../../../../node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/@types/node/globals.d.ts","../../../../node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/@types/node/buffer.d.ts","../../../../node_modules/@types/node/child_process.d.ts","../../../../node_modules/@types/node/cluster.d.ts","../../../../node_modules/@types/node/console.d.ts","../../../../node_modules/@types/node/constants.d.ts","../../../../node_modules/@types/node/crypto.d.ts","../../../../node_modules/@types/node/dgram.d.ts","../../../../node_modules/@types/node/diagnostic_channel.d.ts","../../../../node_modules/@types/node/dns.d.ts","../../../../node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/@types/node/domain.d.ts","../../../../node_modules/@types/node/events.d.ts","../../../../node_modules/@types/node/fs.d.ts","../../../../node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/@types/node/http.d.ts","../../../../node_modules/@types/node/http2.d.ts","../../../../node_modules/@types/node/https.d.ts","../../../../node_modules/@types/node/inspector.d.ts","../../../../node_modules/@types/node/module.d.ts","../../../../node_modules/@types/node/net.d.ts","../../../../node_modules/@types/node/os.d.ts","../../../../node_modules/@types/node/path.d.ts","../../../../node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/@types/node/process.d.ts","../../../../node_modules/@types/node/punycode.d.ts","../../../../node_modules/@types/node/querystring.d.ts","../../../../node_modules/@types/node/readline.d.ts","../../../../node_modules/@types/node/repl.d.ts","../../../../node_modules/@types/node/stream.d.ts","../../../../node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/@types/node/timers.d.ts","../../../../node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/@types/node/tls.d.ts","../../../../node_modules/@types/node/trace_events.d.ts","../../../../node_modules/@types/node/tty.d.ts","../../../../node_modules/@types/node/url.d.ts","../../../../node_modules/@types/node/util.d.ts","../../../../node_modules/@types/node/util/types.d.ts","../../../../node_modules/@types/node/v8.d.ts","../../../../node_modules/@types/node/vm.d.ts","../../../../node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/@types/node/zlib.d.ts","../../../../node_modules/@types/node/globals.global.d.ts","../../../../node_modules/@types/node/wasi.d.ts","../../../../node_modules/@types/node/ts3.6/base.d.ts","../../../../node_modules/@types/node/assert.d.ts","../../../../node_modules/@types/node/base.d.ts","../../../../node_modules/@types/node/index.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../../node_modules/@types/jest/index.d.ts","../../../../node_modules/@types/jest/ts3.2/index.d.ts"],"fileInfos":[{"version":"ac3a8c4040e183ce38da69d23b96939112457d1936198e6542672b7963cf0fce","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06",{"version":"1dad4fe1561d99dfd6709127608b99a76e5c2643626c800434f99c48038567ee","affectsGlobalScope":true},{"version":"cce43d02223f8049864f8568bed322c39424013275cd3bcc3f51492d8b546cb3","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"8dff1b4c2df638fcd976cbb0e636f23ab5968e836cd45084cc31d47d1ab19c49","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"8f4c9f651c8294a2eb1cbd12581fe25bfb901ab1d474bb93cd38c7e2f4be7a30","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"60761e6ea886034af0f294f025a7199360ce4e2c8ba4ec6408bc049cf9b89799","affectsGlobalScope":true},{"version":"506b80b9951c9381dc5f11897b31fca5e2a65731d96ddefa19687fbc26b23c6e","affectsGlobalScope":true},"d1e076bd03d792a96993f458172927e0c5ac3cb8e1b566f54f925e6ef19bbebb","6a55786dc1b8e3c25bc00e1700a7eb297e20bccae7d4bb5e4a020b97daa2052f","eccf9c0b6e420c47b3e3eb87e8f0dc9df312a9583a6cce96756b18ebff176b70","75ecadee387dde7be130c85ed277fdfcee3923e452260ffaf217ebaefe7bd305","cd619820771edb23926bb084906215ab9c491255fa707488d15748b38909b747","1749347583ff3465dbec9f37b2349b2ce40ec6281c0580b4892ab968e2c3758b","3d55998c902f4d0c3476e6e7c0bb4c7e02240c25764241e41caa50972db36922","eea24f7fac616e730bb8058340da46875251d67cdd509e0fd7b0fa3aaf4fa99c","c7bdc99177a2a94d25fb13722adaaf5b3291bf70b4d1b27584ba189dd3889ba3",{"version":"d1c92b66c4105659fcad4eb76a1481f7311033e117d0678a1ec545e8ddb8d4c6","affectsGlobalScope":true},"e23424b97418eca3226fd24de079f1203eb70360622e4e093af2aff14d4be6ec","dee93c07b4df5e26010dc9ec4cdf4d6e4076bb4474d2a8371529217c8b2740a4","d55bc773f71c50f55decb39b64a5d8b9889a7c9e94305b36656ebf30e4f47469","04eaa93bd75f937f9184dcb95a7983800c5770cf8ddd8ac0f3734dc02f5b20ef",{"version":"c8155caf28fc7b0a564156a5df28ad8a844a3bd32d331d148d8f3ce88025c870","affectsGlobalScope":true},"45ac321f2e15d268fd74a90ddaa6467dcaaff2c5b13f95b4b85831520fb7a491","dfc747ab8dd5f623055a4c26fd35e8cceca869fd3f1cf09701c941ca3679665a","c9f5f2920ff61d7158417b8440d5181ddc34a3dfef811a5677dd8a9fb91471e9","5cc0a492da3602510b8f5ed1852b1e0390002780d8758fbc8c0cd023ca7085f8","ec7dafafe751a5121f8f1c80201ebe7e7238c47e6329280a73c4d1ca4bb7fa28","64debeb10e4b7ae4ec9e89bfb4e04c6101ab98c3cc806d14e5488607cfec2753",{"version":"2866a528b2708aa272ec3eaafd3c980abb23aec1ef831cfc5eb2186b98c37ce5","affectsGlobalScope":true},{"version":"a5782d6cea81fe43d2db7ed41e789458c933ab3ab60602f7b5b14c4da3370496","affectsGlobalScope":true},"b86b7ff709a82ef3cba2184136c025989958bad483ffb13e4ca35d720245adf4","6194335ee3353f7226ba31f31d6301d0c6be87228419c0a08976ccd9d4f1213e","5a173b7da4e6d073f9c18a02f387816a934614e7af306193995935fbb95f10b8","b447e123210c68f205f67b20c996c04a1eb64b0e591c5e06e164cd3d3a869b28","13257840c0850d4ebd7c2b17604a9e006f752de76c2400ebc752bc465c330452","42176966283d3835c34278b9b5c0f470d484c0c0c6a55c20a2c916a1ce69b6e8","0cff7901aedfe78e314f7d44088f07e2afa1b6e4f0473a4169b8456ca2fb245d","c55776aa1db2b963a5fb820c0650362e721cba51ebf83b069696f2501378c0f3","e2236264a811ed1d09a2487a433e8f5216ae62378cf233954ae220cf886f6717","3ec1e108d587a5661ec790db607f482605ba9f3830e118ce578e3ffa3c42e22b","100b3bb9d39d2b1b5340f1bf45a52e94ef1692b45232b4ba00fac5c3cc56d331",{"version":"ec1a29ddaecb683aa360df0bd98ab5d4171d2d549554f7c5ab2a5c183a3dcb67","affectsGlobalScope":true},"7f77304372efe3c9967e5f9ea2061f1b4bf41dc3cda3c83cdd676f2e5af6b7e6","992c6f6be16c0a1d2eec13ece33adeea2c747ba27fcd078353a8f4bb5b4fea58","2597718d91e306949d89e285bf34c44192014ef541c3bd7cbb825c022749e974","a6b0abdb67d63ebe964ba5fee31bc3daf10c12eecd46b24d778426010c04c67e","ac4801ebc2355ba32329070123b1cd15891bf71b41dcaf9e75b4744832126a59","fd2298fba0640e7295e7bd545e2dfbfcccbb00c27019e501c87965a02bbdebf6","4fd3c4debadce3e9ab9dec3eb45f7f5e2e3d4ad65cf975a6d938d883cfb25a50","71ddd49185b68f27bfac127ef5d22cb2672c278e53e5370d9020ef50ca9c377d","b1ea7a6eaa7608e0e0529aebd323b526a79c6c05a4e519ae5c779675004dcdf1","9fcb033a6208485d8f3fadde31eb5cbcaf99149cff3e40c0dc53ebc6d0dff4e9","7df562288f949945cf69c21cd912100c2afedeeb7cdb219085f7f4b46cb7dde4","9d16690485ff1eb4f6fc57aebe237728fd8e03130c460919da3a35f4d9bd97f5","dcc6910d95a3625fd2b0487fda055988e46ab46c357a1b3618c27b4a8dd739c9","f4149f1aa299474c7040a35fe8f8ac2ad078cc1b190415adc1fff3ed52d490ea","3730099ed008776216268a97771de31753ef71e0a7d0ec650f588cba2a06ce44","8d649dbc429d7139a1d9a14ea2bf8af1dc089e0a879447539587463d4b6c248c","60c9e27816ec8ac8df7240598bb086e95b47edfb454c5cbf4003c812e0ed6e39","e361aecf17fc4034b4c122a1564471cdcd22ef3a51407803cb5a5fc020c04d02","4926467de88a92a4fc9971d8c6f21b91eca1c0e7fc2a46cc4638ab9440c73875",{"version":"2708349d5a11a5c2e5f3a0765259ebe7ee00cdcc8161cb9990cb4910328442a1","affectsGlobalScope":true},"fc0ae4a8ad3c762b96f9d2c3700cb879a373458cb0bf3175478e3b4f85f7ef2f","fabbec378e1ddd86fcf2662e716c2b8318acedb664ee3a4cba6f9e8ee8269cf1","b3593bd345ebea5e4d0a894c03251a3774b34df3d6db57075c18e089a599ba76","e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","efd55e8ca79171bf26c0d0e30221cb8ee1f5a31dd0c791ec4b2e886f42bab124","e222104af6cb9415238ad358488b74d76eceeff238c1268ec6e85655b05341da","69da61a7b5093dac77fa3bec8be95dcf9a74c95a0e9161edb98bb24e30e439d2","eba230221317c985ab1953ccc3edc517f248b37db4fef7875cb2c8d08aff7be7","b83e796810e475da3564c6515bc0ae9577070596a33d89299b7d99f94ecfd921","b4439890c168d646357928431100daac5cbdee1d345a34e6bf6eca9f3abe22bc","5d72971a459517c44c1379dab9ed248e87a61ba0a1e0f25c9d67e1e640cd9a09","02d734976af36f4273d930bea88b3e62adf6b078cf120c1c63d49aa8d8427c5c",{"version":"f624e578325b8c58e55b30c998b1f4c3ec1b61a9fa66373da4250c89b7880d44","affectsGlobalScope":true},{"version":"d3002f620eab4bf6476c9da5c0efb2041d46f7df8b3032a5631bd206abef2c75","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"module":1,"noImplicitAny":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","sourceMap":true,"target":1},"fileIdsList":[[93,95],[89,90],[89,90,91,92],[94],[96],[86],[85,86],[40,45],[51,52,59,68],[41,51,59],[77],[45,52,60],[68,73],[48,51,59],[49],[48],[51],[51,53,68,76],[51,52,68],[59,68,76],[51,52,54,59,68,73,76],[54,73,76],[87],[76],[48,51,68],[61],[39],[75],[66,77,80],[51,69],[68],[71],[45,59],[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],[59],[65],[78],[40,45,51,53,62,68,76,80],[29],[29,30,31,32],[33],[34,35]],"referencedMap":[[96,1],[91,2],[93,3],[92,2],[95,4],[97,5],[37,6],[87,7],[40,8],[41,9],[42,10],[43,11],[44,12],[45,13],[46,14],[48,15],[49,16],[50,17],[51,17],[52,18],[53,19],[54,20],[55,21],[56,22],[88,23],[57,17],[58,24],[59,25],[61,26],[62,27],[63,28],[66,17],[67,29],[68,30],[69,31],[71,17],[72,32],[73,33],[85,34],[75,35],[76,36],[77,37],[79,31],[81,38],[82,31],[30,39],[33,40],[32,39],[34,41],[36,42],[35,41]],"exportedModulesMap":[[96,1],[91,2],[93,3],[92,2],[95,4],[97,5],[37,6],[87,7],[40,8],[41,9],[42,10],[43,11],[44,12],[45,13],[46,14],[48,15],[49,16],[50,17],[51,17],[52,18],[53,19],[54,20],[55,21],[56,22],[88,23],[57,17],[58,24],[59,25],[61,26],[62,27],[63,28],[66,17],[67,29],[68,30],[69,31],[71,17],[72,32],[73,33],[85,34],[75,35],[76,36],[77,37],[79,31],[81,38],[82,31],[30,39],[33,40],[32,39],[34,41],[36,42],[35,41]],"semanticDiagnosticsPerFile":[96,89,91,93,92,90,95,94,97,86,37,39,87,40,41,42,43,44,45,46,47,48,49,50,51,52,53,38,83,54,55,56,88,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,85,75,76,77,78,79,80,84,81,82,6,8,7,2,9,10,11,12,13,14,15,16,3,4,20,17,18,19,21,22,23,5,24,25,26,27,1,28,31,30,33,29,32,34,36,35]},"version":"4.3.5"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentUIDL, ReferenceType, UIDLDependency, UIDLNode, UIDLSlotNode, UIDLStyleValue, UIDLRepeatNode, UIDLElementNode, UIDLStaticValue, UIDLAttributeValue, UIDLPropDefinition, UIDLStateDefinition, UIDLConditionalNode, UIDLDynamicReference, UIDLEventDefinitions, UIDLRawValue, UIDLReferencedStyles, UIDLElement } from '@teleporthq/teleport-types';
|
|
2
|
+
export declare const component: (name: string, node: UIDLElementNode, propDefinitions?: Record<string, UIDLPropDefinition>, stateDefinitions?: Record<string, UIDLStateDefinition>) => ComponentUIDL;
|
|
3
|
+
export declare const definition: (type: string, defaultValue: string | number | boolean | unknown[] | object) => {
|
|
4
|
+
type: string;
|
|
5
|
+
defaultValue: string | number | boolean | object | unknown[];
|
|
6
|
+
};
|
|
7
|
+
export declare const elementNode: (elementType: string, attrs?: Record<string, UIDLAttributeValue>, children?: UIDLNode[], dependency?: UIDLDependency, style?: Record<string, UIDLStyleValue>, events?: UIDLEventDefinitions, referencedStyles?: UIDLReferencedStyles) => UIDLElementNode;
|
|
8
|
+
export declare const element: (elementType: string, attrs?: Record<string, UIDLAttributeValue>, children?: UIDLNode[], dependency?: UIDLDependency, events?: UIDLEventDefinitions, style?: Record<string, UIDLStyleValue>, referencedStyles?: UIDLReferencedStyles) => UIDLElement;
|
|
9
|
+
export declare const componentDependency: (type: 'library' | 'package' | 'local', path?: string, version?: string, meta?: Record<string, string | boolean>) => UIDLDependency;
|
|
10
|
+
export declare const staticNode: (content: string) => UIDLStaticValue;
|
|
11
|
+
export declare const dynamicNode: (referenceType: ReferenceType, id: string) => UIDLDynamicReference;
|
|
12
|
+
export declare const slotNode: (fallback?: UIDLElementNode | UIDLStaticValue | UIDLDynamicReference, name?: string) => UIDLSlotNode;
|
|
13
|
+
export declare const conditionalNode: (reference: UIDLDynamicReference, node: UIDLNode, value: string | number | boolean) => UIDLConditionalNode;
|
|
14
|
+
export declare const repeatNode: (node: UIDLElementNode, dataSource: UIDLAttributeValue, meta?: Record<string, unknown>) => UIDLRepeatNode;
|
|
15
|
+
export declare const rawNode: (content: string) => UIDLRawValue;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export var component = function (name, node, propDefinitions, stateDefinitions) {
|
|
2
|
+
return {
|
|
3
|
+
name: name,
|
|
4
|
+
node: node,
|
|
5
|
+
stateDefinitions: stateDefinitions,
|
|
6
|
+
propDefinitions: propDefinitions,
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export var definition = function (type, defaultValue) {
|
|
10
|
+
return {
|
|
11
|
+
type: type,
|
|
12
|
+
defaultValue: defaultValue,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export var elementNode = function (elementType, attrs, children, dependency, style, events, referencedStyles) {
|
|
16
|
+
return {
|
|
17
|
+
type: 'element',
|
|
18
|
+
content: element(elementType, attrs, children, dependency, events, style, referencedStyles),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export var element = function (elementType, attrs, children, dependency, events, style, referencedStyles) {
|
|
22
|
+
var elementObj = {
|
|
23
|
+
key: elementType,
|
|
24
|
+
elementType: elementType,
|
|
25
|
+
name: elementType,
|
|
26
|
+
children: children,
|
|
27
|
+
};
|
|
28
|
+
if (attrs) {
|
|
29
|
+
elementObj.attrs = attrs;
|
|
30
|
+
}
|
|
31
|
+
if (events) {
|
|
32
|
+
elementObj.events = events;
|
|
33
|
+
}
|
|
34
|
+
if (dependency) {
|
|
35
|
+
elementObj.elementType = 'component';
|
|
36
|
+
elementObj.semanticType = elementType;
|
|
37
|
+
elementObj.dependency = dependency;
|
|
38
|
+
}
|
|
39
|
+
if (style) {
|
|
40
|
+
elementObj.style = style;
|
|
41
|
+
}
|
|
42
|
+
if (referencedStyles) {
|
|
43
|
+
elementObj.referencedStyles = referencedStyles;
|
|
44
|
+
}
|
|
45
|
+
return elementObj;
|
|
46
|
+
};
|
|
47
|
+
export var componentDependency = function (type, path, version, meta) {
|
|
48
|
+
return {
|
|
49
|
+
type: type,
|
|
50
|
+
path: path,
|
|
51
|
+
version: version,
|
|
52
|
+
meta: meta,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export var staticNode = function (content) {
|
|
56
|
+
return {
|
|
57
|
+
type: 'static',
|
|
58
|
+
content: content,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export var dynamicNode = function (referenceType, id) {
|
|
62
|
+
return {
|
|
63
|
+
type: 'dynamic',
|
|
64
|
+
content: {
|
|
65
|
+
referenceType: referenceType,
|
|
66
|
+
id: id,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export var slotNode = function (fallback, name) {
|
|
71
|
+
return {
|
|
72
|
+
type: 'slot',
|
|
73
|
+
content: {
|
|
74
|
+
fallback: fallback,
|
|
75
|
+
name: name,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export var conditionalNode = function (reference, node, value) {
|
|
80
|
+
return {
|
|
81
|
+
type: 'conditional',
|
|
82
|
+
content: {
|
|
83
|
+
reference: reference,
|
|
84
|
+
node: node,
|
|
85
|
+
value: value,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export var repeatNode = function (node, dataSource, meta) {
|
|
90
|
+
return {
|
|
91
|
+
type: 'repeat',
|
|
92
|
+
content: {
|
|
93
|
+
node: node,
|
|
94
|
+
dataSource: dataSource,
|
|
95
|
+
meta: meta,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
export var rawNode = function (content) {
|
|
100
|
+
return {
|
|
101
|
+
type: 'raw',
|
|
102
|
+
content: content,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=component-builders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-builders.js","sourceRoot":"","sources":["../../src/component-builders.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ComponentUIDL, ProjectUIDL, UIDLGlobalAsset, WebManifest, UIDLGlobalProjectValues } from '@teleporthq/teleport-types';
|
|
2
|
+
export declare const project: (name: string, root: ComponentUIDL, components: ComponentUIDL[], globals?: {
|
|
3
|
+
settings: {
|
|
4
|
+
title: string;
|
|
5
|
+
language: string;
|
|
6
|
+
};
|
|
7
|
+
meta: Array<Record<string, string>>;
|
|
8
|
+
assets: UIDLGlobalAsset[];
|
|
9
|
+
manifest?: WebManifest;
|
|
10
|
+
variables?: Record<string, string>;
|
|
11
|
+
}) => ProjectUIDL;
|
|
12
|
+
export declare const UIDLArrayToRecord: (array: ComponentUIDL[]) => Record<string, ComponentUIDL>;
|
|
13
|
+
export declare const simpleProjectGlobals: (title?: string) => UIDLGlobalProjectValues;
|
|
14
|
+
export declare const explicitProjectGlobals: (title: string, language: string, meta: Array<Record<string, string>>, assets: UIDLGlobalAsset[], manifest?: WebManifest) => {
|
|
15
|
+
settings: {
|
|
16
|
+
title: string;
|
|
17
|
+
language: string;
|
|
18
|
+
};
|
|
19
|
+
assets: UIDLGlobalAsset[];
|
|
20
|
+
meta: Record<string, string>[];
|
|
21
|
+
manifest: WebManifest;
|
|
22
|
+
};
|
|
23
|
+
export declare const socialMediaMeta: (property: string, content: string) => {
|
|
24
|
+
property: string;
|
|
25
|
+
content: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const metaTag: (name: string, content: string) => {
|
|
28
|
+
name: string;
|
|
29
|
+
content: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const projectMeta: (meta: Array<Record<string, string>>) => Record<string, string>[];
|
|
32
|
+
export declare const manifestIcon: (src: string, type: string, sizes: string) => {
|
|
33
|
+
src: string;
|
|
34
|
+
type: string;
|
|
35
|
+
sizes: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const projectAssetPath: (type: string, path?: string, meta?: Record<string, string>) => {
|
|
38
|
+
type: string;
|
|
39
|
+
path: string;
|
|
40
|
+
meta: Record<string, string>;
|
|
41
|
+
};
|
|
42
|
+
export declare const projectAssetContent: (type: string, content?: string, meta?: Record<string, string>) => {
|
|
43
|
+
type: string;
|
|
44
|
+
content: string;
|
|
45
|
+
meta: Record<string, string>;
|
|
46
|
+
};
|
|
47
|
+
export declare const projectAssets: (assets: UIDLGlobalAsset[]) => UIDLGlobalAsset[];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export var project = function (name, root, components, globals) {
|
|
2
|
+
return {
|
|
3
|
+
name: name,
|
|
4
|
+
root: root,
|
|
5
|
+
components: UIDLArrayToRecord(components),
|
|
6
|
+
globals: globals || simpleProjectGlobals(),
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export var UIDLArrayToRecord = function (array) {
|
|
10
|
+
var record = {};
|
|
11
|
+
array.forEach(function (element) {
|
|
12
|
+
record[element.name] = element;
|
|
13
|
+
});
|
|
14
|
+
return record;
|
|
15
|
+
};
|
|
16
|
+
export var simpleProjectGlobals = function (title) {
|
|
17
|
+
if (title === void 0) { title = 'My teleport project'; }
|
|
18
|
+
return {
|
|
19
|
+
settings: {
|
|
20
|
+
title: title,
|
|
21
|
+
language: 'en',
|
|
22
|
+
},
|
|
23
|
+
assets: [],
|
|
24
|
+
meta: [],
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export var explicitProjectGlobals = function (title, language, meta, assets, manifest) {
|
|
28
|
+
return {
|
|
29
|
+
settings: {
|
|
30
|
+
title: title,
|
|
31
|
+
language: language,
|
|
32
|
+
},
|
|
33
|
+
assets: assets,
|
|
34
|
+
meta: meta,
|
|
35
|
+
manifest: manifest,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export var socialMediaMeta = function (property, content) {
|
|
39
|
+
return {
|
|
40
|
+
property: property,
|
|
41
|
+
content: content,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export var metaTag = function (name, content) {
|
|
45
|
+
return {
|
|
46
|
+
name: name,
|
|
47
|
+
content: content,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export var projectMeta = function (meta) {
|
|
51
|
+
return meta;
|
|
52
|
+
};
|
|
53
|
+
export var manifestIcon = function (src, type, sizes) {
|
|
54
|
+
return {
|
|
55
|
+
src: src,
|
|
56
|
+
type: type,
|
|
57
|
+
sizes: sizes,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export var projectAssetPath = function (type, path, meta) {
|
|
61
|
+
return {
|
|
62
|
+
type: type,
|
|
63
|
+
path: path,
|
|
64
|
+
meta: meta,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export var projectAssetContent = function (type, content, meta) {
|
|
68
|
+
return {
|
|
69
|
+
type: type,
|
|
70
|
+
content: content,
|
|
71
|
+
meta: meta,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export var projectAssets = function (assets) {
|
|
75
|
+
return assets;
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=project-builders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-builders.js","sourceRoot":"","sources":["../../src/project-builders.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,IAAM,OAAO,GAAG,UACrB,IAAY,EACZ,IAAmB,EACnB,UAA2B,EAC3B,OASC;IAED,OAAO;QACL,IAAI,MAAA;QACJ,IAAI,MAAA;QACJ,UAAU,EAAE,iBAAiB,CAAC,UAAU,CAAC;QACzC,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE;KAC3C,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAC,KAAsB;IACtD,IAAM,MAAM,GAAkC,EAAE,CAAA;IAChD,KAAK,CAAC,OAAO,CAAC,UAAC,OAAO;QACpB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAClC,KAAqC;IAArC,sBAAA,EAAA,6BAAqC;IAErC,OAAO;QACL,QAAQ,EAAE;YACR,KAAK,OAAA;YACL,QAAQ,EAAE,IAAI;SACf;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,EAAE;KACT,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,sBAAsB,GAAG,UACpC,KAAa,EACb,QAAgB,EAChB,IAAmC,EACnC,MAAyB,EACzB,QAAsB;IAEtB,OAAO;QACL,QAAQ,EAAE;YACR,KAAK,OAAA;YACL,QAAQ,UAAA;SACT;QACD,MAAM,QAAA;QACN,IAAI,MAAA;QACJ,QAAQ,UAAA;KACT,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,eAAe,GAAG,UAAC,QAAgB,EAAE,OAAe;IAC/D,OAAO;QACL,QAAQ,UAAA;QACR,OAAO,SAAA;KACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,OAAO,GAAG,UAAC,IAAY,EAAE,OAAe;IACnD,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,SAAA;KACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,IAAmC;IAC7D,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,YAAY,GAAG,UAAC,GAAW,EAAE,IAAY,EAAE,KAAa;IACnE,OAAO;QACL,GAAG,KAAA;QACH,IAAI,MAAA;QACJ,KAAK,OAAA;KACN,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,IAAY,EAAE,IAAa,EAAE,IAA6B;IACzF,OAAO;QACL,IAAI,MAAA;QACJ,IAAI,MAAA;QACJ,IAAI,MAAA;KACL,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,mBAAmB,GAAG,UACjC,IAAY,EACZ,OAAgB,EAChB,IAA6B;IAE7B,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,SAAA;QACP,IAAI,MAAA;KACL,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,aAAa,GAAG,UAAC,MAAyB;IACrD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../teleport-types/dist/cjs/uidl.d.ts","../../../teleport-types/dist/cjs/generators.d.ts","../../../teleport-types/dist/cjs/errors.d.ts","../../../teleport-types/dist/cjs/vuidl.d.ts","../../../teleport-types/dist/cjs/index.d.ts","../../src/component-builders.ts","../../src/project-builders.ts","../../src/index.ts","../../../../node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/@types/node/globals.d.ts","../../../../node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/@types/node/buffer.d.ts","../../../../node_modules/@types/node/child_process.d.ts","../../../../node_modules/@types/node/cluster.d.ts","../../../../node_modules/@types/node/console.d.ts","../../../../node_modules/@types/node/constants.d.ts","../../../../node_modules/@types/node/crypto.d.ts","../../../../node_modules/@types/node/dgram.d.ts","../../../../node_modules/@types/node/diagnostic_channel.d.ts","../../../../node_modules/@types/node/dns.d.ts","../../../../node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/@types/node/domain.d.ts","../../../../node_modules/@types/node/events.d.ts","../../../../node_modules/@types/node/fs.d.ts","../../../../node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/@types/node/http.d.ts","../../../../node_modules/@types/node/http2.d.ts","../../../../node_modules/@types/node/https.d.ts","../../../../node_modules/@types/node/inspector.d.ts","../../../../node_modules/@types/node/module.d.ts","../../../../node_modules/@types/node/net.d.ts","../../../../node_modules/@types/node/os.d.ts","../../../../node_modules/@types/node/path.d.ts","../../../../node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/@types/node/process.d.ts","../../../../node_modules/@types/node/punycode.d.ts","../../../../node_modules/@types/node/querystring.d.ts","../../../../node_modules/@types/node/readline.d.ts","../../../../node_modules/@types/node/repl.d.ts","../../../../node_modules/@types/node/stream.d.ts","../../../../node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/@types/node/timers.d.ts","../../../../node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/@types/node/tls.d.ts","../../../../node_modules/@types/node/trace_events.d.ts","../../../../node_modules/@types/node/tty.d.ts","../../../../node_modules/@types/node/url.d.ts","../../../../node_modules/@types/node/util.d.ts","../../../../node_modules/@types/node/util/types.d.ts","../../../../node_modules/@types/node/v8.d.ts","../../../../node_modules/@types/node/vm.d.ts","../../../../node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/@types/node/zlib.d.ts","../../../../node_modules/@types/node/globals.global.d.ts","../../../../node_modules/@types/node/wasi.d.ts","../../../../node_modules/@types/node/ts3.6/base.d.ts","../../../../node_modules/@types/node/assert.d.ts","../../../../node_modules/@types/node/base.d.ts","../../../../node_modules/@types/node/index.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../../node_modules/@types/jest/index.d.ts","../../../../node_modules/@types/jest/ts3.2/index.d.ts"],"fileInfos":[{"version":"ac3a8c4040e183ce38da69d23b96939112457d1936198e6542672b7963cf0fce","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06",{"version":"1dad4fe1561d99dfd6709127608b99a76e5c2643626c800434f99c48038567ee","affectsGlobalScope":true},{"version":"cce43d02223f8049864f8568bed322c39424013275cd3bcc3f51492d8b546cb3","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"8dff1b4c2df638fcd976cbb0e636f23ab5968e836cd45084cc31d47d1ab19c49","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"8f4c9f651c8294a2eb1cbd12581fe25bfb901ab1d474bb93cd38c7e2f4be7a30","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"60761e6ea886034af0f294f025a7199360ce4e2c8ba4ec6408bc049cf9b89799","affectsGlobalScope":true},{"version":"506b80b9951c9381dc5f11897b31fca5e2a65731d96ddefa19687fbc26b23c6e","affectsGlobalScope":true},"d1e076bd03d792a96993f458172927e0c5ac3cb8e1b566f54f925e6ef19bbebb","6a55786dc1b8e3c25bc00e1700a7eb297e20bccae7d4bb5e4a020b97daa2052f","eccf9c0b6e420c47b3e3eb87e8f0dc9df312a9583a6cce96756b18ebff176b70","75ecadee387dde7be130c85ed277fdfcee3923e452260ffaf217ebaefe7bd305","cd619820771edb23926bb084906215ab9c491255fa707488d15748b38909b747","1749347583ff3465dbec9f37b2349b2ce40ec6281c0580b4892ab968e2c3758b","3d55998c902f4d0c3476e6e7c0bb4c7e02240c25764241e41caa50972db36922","eea24f7fac616e730bb8058340da46875251d67cdd509e0fd7b0fa3aaf4fa99c","c7bdc99177a2a94d25fb13722adaaf5b3291bf70b4d1b27584ba189dd3889ba3",{"version":"d1c92b66c4105659fcad4eb76a1481f7311033e117d0678a1ec545e8ddb8d4c6","affectsGlobalScope":true},"e23424b97418eca3226fd24de079f1203eb70360622e4e093af2aff14d4be6ec","dee93c07b4df5e26010dc9ec4cdf4d6e4076bb4474d2a8371529217c8b2740a4","d55bc773f71c50f55decb39b64a5d8b9889a7c9e94305b36656ebf30e4f47469","04eaa93bd75f937f9184dcb95a7983800c5770cf8ddd8ac0f3734dc02f5b20ef",{"version":"c8155caf28fc7b0a564156a5df28ad8a844a3bd32d331d148d8f3ce88025c870","affectsGlobalScope":true},"45ac321f2e15d268fd74a90ddaa6467dcaaff2c5b13f95b4b85831520fb7a491","dfc747ab8dd5f623055a4c26fd35e8cceca869fd3f1cf09701c941ca3679665a","c9f5f2920ff61d7158417b8440d5181ddc34a3dfef811a5677dd8a9fb91471e9","5cc0a492da3602510b8f5ed1852b1e0390002780d8758fbc8c0cd023ca7085f8","ec7dafafe751a5121f8f1c80201ebe7e7238c47e6329280a73c4d1ca4bb7fa28","64debeb10e4b7ae4ec9e89bfb4e04c6101ab98c3cc806d14e5488607cfec2753",{"version":"2866a528b2708aa272ec3eaafd3c980abb23aec1ef831cfc5eb2186b98c37ce5","affectsGlobalScope":true},{"version":"a5782d6cea81fe43d2db7ed41e789458c933ab3ab60602f7b5b14c4da3370496","affectsGlobalScope":true},"b86b7ff709a82ef3cba2184136c025989958bad483ffb13e4ca35d720245adf4","6194335ee3353f7226ba31f31d6301d0c6be87228419c0a08976ccd9d4f1213e","5a173b7da4e6d073f9c18a02f387816a934614e7af306193995935fbb95f10b8","b447e123210c68f205f67b20c996c04a1eb64b0e591c5e06e164cd3d3a869b28","13257840c0850d4ebd7c2b17604a9e006f752de76c2400ebc752bc465c330452","42176966283d3835c34278b9b5c0f470d484c0c0c6a55c20a2c916a1ce69b6e8","0cff7901aedfe78e314f7d44088f07e2afa1b6e4f0473a4169b8456ca2fb245d","c55776aa1db2b963a5fb820c0650362e721cba51ebf83b069696f2501378c0f3","e2236264a811ed1d09a2487a433e8f5216ae62378cf233954ae220cf886f6717","3ec1e108d587a5661ec790db607f482605ba9f3830e118ce578e3ffa3c42e22b","100b3bb9d39d2b1b5340f1bf45a52e94ef1692b45232b4ba00fac5c3cc56d331",{"version":"ec1a29ddaecb683aa360df0bd98ab5d4171d2d549554f7c5ab2a5c183a3dcb67","affectsGlobalScope":true},"7f77304372efe3c9967e5f9ea2061f1b4bf41dc3cda3c83cdd676f2e5af6b7e6","992c6f6be16c0a1d2eec13ece33adeea2c747ba27fcd078353a8f4bb5b4fea58","2597718d91e306949d89e285bf34c44192014ef541c3bd7cbb825c022749e974","a6b0abdb67d63ebe964ba5fee31bc3daf10c12eecd46b24d778426010c04c67e","ac4801ebc2355ba32329070123b1cd15891bf71b41dcaf9e75b4744832126a59","fd2298fba0640e7295e7bd545e2dfbfcccbb00c27019e501c87965a02bbdebf6","4fd3c4debadce3e9ab9dec3eb45f7f5e2e3d4ad65cf975a6d938d883cfb25a50","71ddd49185b68f27bfac127ef5d22cb2672c278e53e5370d9020ef50ca9c377d","b1ea7a6eaa7608e0e0529aebd323b526a79c6c05a4e519ae5c779675004dcdf1","9fcb033a6208485d8f3fadde31eb5cbcaf99149cff3e40c0dc53ebc6d0dff4e9","7df562288f949945cf69c21cd912100c2afedeeb7cdb219085f7f4b46cb7dde4","9d16690485ff1eb4f6fc57aebe237728fd8e03130c460919da3a35f4d9bd97f5","dcc6910d95a3625fd2b0487fda055988e46ab46c357a1b3618c27b4a8dd739c9","f4149f1aa299474c7040a35fe8f8ac2ad078cc1b190415adc1fff3ed52d490ea","3730099ed008776216268a97771de31753ef71e0a7d0ec650f588cba2a06ce44","8d649dbc429d7139a1d9a14ea2bf8af1dc089e0a879447539587463d4b6c248c","60c9e27816ec8ac8df7240598bb086e95b47edfb454c5cbf4003c812e0ed6e39","e361aecf17fc4034b4c122a1564471cdcd22ef3a51407803cb5a5fc020c04d02","4926467de88a92a4fc9971d8c6f21b91eca1c0e7fc2a46cc4638ab9440c73875",{"version":"2708349d5a11a5c2e5f3a0765259ebe7ee00cdcc8161cb9990cb4910328442a1","affectsGlobalScope":true},"fc0ae4a8ad3c762b96f9d2c3700cb879a373458cb0bf3175478e3b4f85f7ef2f","fabbec378e1ddd86fcf2662e716c2b8318acedb664ee3a4cba6f9e8ee8269cf1","b3593bd345ebea5e4d0a894c03251a3774b34df3d6db57075c18e089a599ba76","e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","efd55e8ca79171bf26c0d0e30221cb8ee1f5a31dd0c791ec4b2e886f42bab124","e222104af6cb9415238ad358488b74d76eceeff238c1268ec6e85655b05341da","69da61a7b5093dac77fa3bec8be95dcf9a74c95a0e9161edb98bb24e30e439d2","eba230221317c985ab1953ccc3edc517f248b37db4fef7875cb2c8d08aff7be7","b83e796810e475da3564c6515bc0ae9577070596a33d89299b7d99f94ecfd921","b4439890c168d646357928431100daac5cbdee1d345a34e6bf6eca9f3abe22bc","5d72971a459517c44c1379dab9ed248e87a61ba0a1e0f25c9d67e1e640cd9a09","02d734976af36f4273d930bea88b3e62adf6b078cf120c1c63d49aa8d8427c5c",{"version":"f624e578325b8c58e55b30c998b1f4c3ec1b61a9fa66373da4250c89b7880d44","affectsGlobalScope":true},{"version":"d3002f620eab4bf6476c9da5c0efb2041d46f7df8b3032a5631bd206abef2c75","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"module":99,"noImplicitAny":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","sourceMap":true,"target":1},"fileIdsList":[[93,95],[89,90],[89,90,91,92],[94],[96],[86],[85,86],[40,45],[51,52,59,68],[41,51,59],[77],[45,52,60],[68,73],[48,51,59],[49],[48],[51],[51,53,68,76],[51,52,68],[59,68,76],[51,52,54,59,68,73,76],[54,73,76],[87],[76],[48,51,68],[61],[39],[75],[66,77,80],[51,69],[68],[71],[45,59],[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],[59],[65],[78],[40,45,51,53,62,68,76,80],[29],[29,30,31,32],[33],[34,35]],"referencedMap":[[96,1],[91,2],[93,3],[92,2],[95,4],[97,5],[37,6],[87,7],[40,8],[41,9],[42,10],[43,11],[44,12],[45,13],[46,14],[48,15],[49,16],[50,17],[51,17],[52,18],[53,19],[54,20],[55,21],[56,22],[88,23],[57,17],[58,24],[59,25],[61,26],[62,27],[63,28],[66,17],[67,29],[68,30],[69,31],[71,17],[72,32],[73,33],[85,34],[75,35],[76,36],[77,37],[79,31],[81,38],[82,31],[30,39],[33,40],[32,39],[34,41],[36,42],[35,41]],"exportedModulesMap":[[96,1],[91,2],[93,3],[92,2],[95,4],[97,5],[37,6],[87,7],[40,8],[41,9],[42,10],[43,11],[44,12],[45,13],[46,14],[48,15],[49,16],[50,17],[51,17],[52,18],[53,19],[54,20],[55,21],[56,22],[88,23],[57,17],[58,24],[59,25],[61,26],[62,27],[63,28],[66,17],[67,29],[68,30],[69,31],[71,17],[72,32],[73,33],[85,34],[75,35],[76,36],[77,37],[79,31],[81,38],[82,31],[30,39],[33,40],[32,39],[34,41],[36,42],[35,41]],"semanticDiagnosticsPerFile":[96,89,91,93,92,90,95,94,97,86,37,39,87,40,41,42,43,44,45,46,47,48,49,50,51,52,53,38,83,54,55,56,88,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,85,75,76,77,78,79,80,84,81,82,6,8,7,2,9,10,11,12,13,14,15,16,3,4,20,17,18,19,21,22,23,5,24,25,26,27,1,28,31,30,33,29,32,34,36,35]},"version":"4.3.5"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teleporthq/teleport-uidl-builders",
|
|
3
|
+
"version": "0.18.0",
|
|
4
|
+
"description": "A set of functions used for constructing UIDL structures",
|
|
5
|
+
"author": "teleportHQ",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://teleporthq.io/",
|
|
8
|
+
"main": "dist/cjs/index.js",
|
|
9
|
+
"module": "dist/esm/index.js",
|
|
10
|
+
"types": "dist/cjs/index.d.ts",
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+ssh://git@github.com/teleporthq/teleport-code-generators.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/teleporthq/teleport-code-generators/issues"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"clean": "rimraf dist",
|
|
24
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig.json --module commonjs --outDir dist/cjs"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@teleporthq/teleport-types": "^0.18.0"
|
|
28
|
+
},
|
|
29
|
+
"gitHead": "7b47f013bf1889e19b31875a8f3abdc43b22615a"
|
|
30
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ComponentUIDL,
|
|
3
|
+
ReferenceType,
|
|
4
|
+
UIDLDependency,
|
|
5
|
+
UIDLNode,
|
|
6
|
+
UIDLSlotNode,
|
|
7
|
+
UIDLStyleValue,
|
|
8
|
+
UIDLRepeatNode,
|
|
9
|
+
UIDLElementNode,
|
|
10
|
+
UIDLStaticValue,
|
|
11
|
+
UIDLAttributeValue,
|
|
12
|
+
UIDLPropDefinition,
|
|
13
|
+
UIDLStateDefinition,
|
|
14
|
+
UIDLConditionalNode,
|
|
15
|
+
UIDLDynamicReference,
|
|
16
|
+
UIDLEventDefinitions,
|
|
17
|
+
UIDLRawValue,
|
|
18
|
+
UIDLReferencedStyles,
|
|
19
|
+
UIDLElement,
|
|
20
|
+
} from '@teleporthq/teleport-types'
|
|
21
|
+
|
|
22
|
+
export const component = (
|
|
23
|
+
name: string,
|
|
24
|
+
node: UIDLElementNode,
|
|
25
|
+
propDefinitions?: Record<string, UIDLPropDefinition>,
|
|
26
|
+
stateDefinitions?: Record<string, UIDLStateDefinition>
|
|
27
|
+
): ComponentUIDL => {
|
|
28
|
+
return {
|
|
29
|
+
name,
|
|
30
|
+
node,
|
|
31
|
+
stateDefinitions,
|
|
32
|
+
propDefinitions,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const definition = (
|
|
37
|
+
type: string,
|
|
38
|
+
defaultValue: string | number | boolean | unknown[] | object
|
|
39
|
+
) => {
|
|
40
|
+
return {
|
|
41
|
+
type,
|
|
42
|
+
defaultValue,
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const elementNode = (
|
|
47
|
+
elementType: string,
|
|
48
|
+
attrs?: Record<string, UIDLAttributeValue>,
|
|
49
|
+
children?: UIDLNode[],
|
|
50
|
+
dependency?: UIDLDependency,
|
|
51
|
+
style?: Record<string, UIDLStyleValue>,
|
|
52
|
+
events?: UIDLEventDefinitions,
|
|
53
|
+
referencedStyles?: UIDLReferencedStyles
|
|
54
|
+
): UIDLElementNode => {
|
|
55
|
+
return {
|
|
56
|
+
type: 'element',
|
|
57
|
+
content: element(elementType, attrs, children, dependency, events, style, referencedStyles),
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const element = (
|
|
62
|
+
elementType: string,
|
|
63
|
+
attrs?: Record<string, UIDLAttributeValue>,
|
|
64
|
+
children?: UIDLNode[],
|
|
65
|
+
dependency?: UIDLDependency,
|
|
66
|
+
events?: UIDLEventDefinitions,
|
|
67
|
+
style?: Record<string, UIDLStyleValue>,
|
|
68
|
+
referencedStyles?: UIDLReferencedStyles
|
|
69
|
+
) => {
|
|
70
|
+
const elementObj: UIDLElement = {
|
|
71
|
+
key: elementType,
|
|
72
|
+
elementType,
|
|
73
|
+
name: elementType,
|
|
74
|
+
children,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (attrs) {
|
|
78
|
+
elementObj.attrs = attrs
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (events) {
|
|
82
|
+
elementObj.events = events
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (dependency) {
|
|
86
|
+
elementObj.elementType = 'component'
|
|
87
|
+
elementObj.semanticType = elementType
|
|
88
|
+
elementObj.dependency = dependency
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (style) {
|
|
92
|
+
elementObj.style = style
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (referencedStyles) {
|
|
96
|
+
elementObj.referencedStyles = referencedStyles
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return elementObj
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const componentDependency = (
|
|
103
|
+
type: 'library' | 'package' | 'local',
|
|
104
|
+
path?: string,
|
|
105
|
+
version?: string,
|
|
106
|
+
meta?: Record<string, string | boolean>
|
|
107
|
+
): UIDLDependency => {
|
|
108
|
+
return {
|
|
109
|
+
type,
|
|
110
|
+
path,
|
|
111
|
+
version,
|
|
112
|
+
meta,
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const staticNode = (content: string): UIDLStaticValue => {
|
|
117
|
+
return {
|
|
118
|
+
type: 'static',
|
|
119
|
+
content,
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const dynamicNode = (referenceType: ReferenceType, id: string): UIDLDynamicReference => {
|
|
124
|
+
return {
|
|
125
|
+
type: 'dynamic',
|
|
126
|
+
content: {
|
|
127
|
+
referenceType,
|
|
128
|
+
id,
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export const slotNode = (
|
|
134
|
+
fallback?: UIDLElementNode | UIDLStaticValue | UIDLDynamicReference,
|
|
135
|
+
name?: string
|
|
136
|
+
): UIDLSlotNode => {
|
|
137
|
+
return {
|
|
138
|
+
type: 'slot',
|
|
139
|
+
content: {
|
|
140
|
+
fallback,
|
|
141
|
+
name,
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const conditionalNode = (
|
|
147
|
+
reference: UIDLDynamicReference,
|
|
148
|
+
node: UIDLNode,
|
|
149
|
+
value: string | number | boolean
|
|
150
|
+
): UIDLConditionalNode => {
|
|
151
|
+
return {
|
|
152
|
+
type: 'conditional',
|
|
153
|
+
content: {
|
|
154
|
+
reference,
|
|
155
|
+
node,
|
|
156
|
+
value,
|
|
157
|
+
},
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export const repeatNode = (
|
|
162
|
+
node: UIDLElementNode,
|
|
163
|
+
dataSource: UIDLAttributeValue,
|
|
164
|
+
meta?: Record<string, unknown>
|
|
165
|
+
): UIDLRepeatNode => {
|
|
166
|
+
return {
|
|
167
|
+
type: 'repeat',
|
|
168
|
+
content: {
|
|
169
|
+
node,
|
|
170
|
+
dataSource,
|
|
171
|
+
meta,
|
|
172
|
+
},
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export const rawNode = (content: string): UIDLRawValue => {
|
|
177
|
+
return {
|
|
178
|
+
type: 'raw',
|
|
179
|
+
content,
|
|
180
|
+
}
|
|
181
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ComponentUIDL,
|
|
3
|
+
ProjectUIDL,
|
|
4
|
+
UIDLGlobalAsset,
|
|
5
|
+
WebManifest,
|
|
6
|
+
UIDLGlobalProjectValues,
|
|
7
|
+
} from '@teleporthq/teleport-types'
|
|
8
|
+
|
|
9
|
+
export const project = (
|
|
10
|
+
name: string,
|
|
11
|
+
root: ComponentUIDL,
|
|
12
|
+
components: ComponentUIDL[],
|
|
13
|
+
globals?: {
|
|
14
|
+
settings: {
|
|
15
|
+
title: string
|
|
16
|
+
language: string
|
|
17
|
+
}
|
|
18
|
+
meta: Array<Record<string, string>>
|
|
19
|
+
assets: UIDLGlobalAsset[]
|
|
20
|
+
manifest?: WebManifest
|
|
21
|
+
variables?: Record<string, string>
|
|
22
|
+
}
|
|
23
|
+
): ProjectUIDL => {
|
|
24
|
+
return {
|
|
25
|
+
name,
|
|
26
|
+
root,
|
|
27
|
+
components: UIDLArrayToRecord(components),
|
|
28
|
+
globals: globals || simpleProjectGlobals(),
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const UIDLArrayToRecord = (array: ComponentUIDL[]): Record<string, ComponentUIDL> => {
|
|
33
|
+
const record: Record<string, ComponentUIDL> = {}
|
|
34
|
+
array.forEach((element) => {
|
|
35
|
+
record[element.name] = element
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return record
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const simpleProjectGlobals = (
|
|
42
|
+
title: string = 'My teleport project'
|
|
43
|
+
): UIDLGlobalProjectValues => {
|
|
44
|
+
return {
|
|
45
|
+
settings: {
|
|
46
|
+
title,
|
|
47
|
+
language: 'en',
|
|
48
|
+
},
|
|
49
|
+
assets: [],
|
|
50
|
+
meta: [],
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const explicitProjectGlobals = (
|
|
55
|
+
title: string,
|
|
56
|
+
language: string,
|
|
57
|
+
meta: Array<Record<string, string>>,
|
|
58
|
+
assets: UIDLGlobalAsset[],
|
|
59
|
+
manifest?: WebManifest
|
|
60
|
+
) => {
|
|
61
|
+
return {
|
|
62
|
+
settings: {
|
|
63
|
+
title,
|
|
64
|
+
language,
|
|
65
|
+
},
|
|
66
|
+
assets,
|
|
67
|
+
meta,
|
|
68
|
+
manifest,
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const socialMediaMeta = (property: string, content: string) => {
|
|
73
|
+
return {
|
|
74
|
+
property,
|
|
75
|
+
content,
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const metaTag = (name: string, content: string) => {
|
|
80
|
+
return {
|
|
81
|
+
name,
|
|
82
|
+
content,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const projectMeta = (meta: Array<Record<string, string>>) => {
|
|
87
|
+
return meta
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const manifestIcon = (src: string, type: string, sizes: string) => {
|
|
91
|
+
return {
|
|
92
|
+
src,
|
|
93
|
+
type,
|
|
94
|
+
sizes,
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const projectAssetPath = (type: string, path?: string, meta?: Record<string, string>) => {
|
|
99
|
+
return {
|
|
100
|
+
type,
|
|
101
|
+
path,
|
|
102
|
+
meta,
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const projectAssetContent = (
|
|
107
|
+
type: string,
|
|
108
|
+
content?: string,
|
|
109
|
+
meta?: Record<string, string>
|
|
110
|
+
) => {
|
|
111
|
+
return {
|
|
112
|
+
type,
|
|
113
|
+
content,
|
|
114
|
+
meta,
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const projectAssets = (assets: UIDLGlobalAsset[]) => {
|
|
119
|
+
return assets
|
|
120
|
+
}
|