@contrail/documents 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ Supplies common data structures and logic for managing document definitions.
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './types';
package/lib/index.js ADDED
@@ -0,0 +1,13 @@
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" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,39 @@
1
+ export interface TextStyleDefinition {
2
+ valign?: string;
3
+ align?: string;
4
+ decoration?: string;
5
+ }
6
+ export interface FontStyleDefinition {
7
+ family?: string;
8
+ size?: number;
9
+ weight?: string;
10
+ style?: string;
11
+ }
12
+ export interface BorderStyleDefinition {
13
+ style?: string;
14
+ color?: string;
15
+ width?: string;
16
+ radius?: string;
17
+ }
18
+ export interface BackgroundStyleDefinition {
19
+ color?: string;
20
+ }
21
+ export interface StyleDefinition {
22
+ background?: BackgroundStyleDefinition;
23
+ text?: TextStyleDefinition;
24
+ font?: FontStyleDefinition;
25
+ border?: BorderStyleDefinition;
26
+ color?: string;
27
+ backgroundColor?: string;
28
+ borderColor?: string;
29
+ borderSize?: number;
30
+ }
31
+ export interface SizeDefinition {
32
+ width?: number;
33
+ height?: number;
34
+ }
35
+ export interface PositionDefinition {
36
+ x?: number;
37
+ y?: number;
38
+ z?: number;
39
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export interface DataObject {
2
+ entityRef?: string;
3
+ entity?: any;
4
+ viewDefinitionRef?: string;
5
+ viewDefinition?: any;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { DocumentElement } from './document-element';
2
+ import { Document } from './document';
3
+ export declare enum DocumentChangeType {
4
+ ADD = 0,
5
+ DELETE = 1,
6
+ MODIFY = 2
7
+ }
8
+ export interface DocumentChange {
9
+ type: string;
10
+ targetDocument?: Document;
11
+ priorState: Map<string, DocumentElement>;
12
+ newState: Map<string, DocumentElement>;
13
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentChangeType = void 0;
4
+ var DocumentChangeType;
5
+ (function (DocumentChangeType) {
6
+ DocumentChangeType[DocumentChangeType["ADD"] = 0] = "ADD";
7
+ DocumentChangeType[DocumentChangeType["DELETE"] = 1] = "DELETE";
8
+ DocumentChangeType[DocumentChangeType["MODIFY"] = 2] = "MODIFY";
9
+ })(DocumentChangeType = exports.DocumentChangeType || (exports.DocumentChangeType = {}));
@@ -0,0 +1,10 @@
1
+ import { PositionDefinition, SizeDefinition } from "./common";
2
+ import { DocumentElement } from "./document-element";
3
+ export interface DocumentElementEvent {
4
+ element: DocumentElement;
5
+ renderedElementPosition?: PositionDefinition;
6
+ renderedElementSize?: SizeDefinition;
7
+ eventType?: string;
8
+ sourceMouseEvent?: MouseEvent;
9
+ relativeMousePosition?: PositionDefinition;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { DocumentElement } from './document-element';
2
+ interface AddElement {
3
+ (elements: Array<DocumentElement>): Promise<any>;
4
+ }
5
+ export interface DocumentElementHolder {
6
+ addElements: AddElement;
7
+ }
8
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { PositionDefinition } from './common';
2
+ import { Document } from './document';
3
+ export interface DocumentElement extends Document {
4
+ id?: string;
5
+ type?: string;
6
+ position?: PositionDefinition;
7
+ text?: string;
8
+ url?: string;
9
+ propertyBindings?: any;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import { SizeDefinition, StyleDefinition } from "./common";
2
+ import { DocumentElement } from "./document-element";
3
+ export interface ImportReferenceDetail {
4
+ importedSlideReference?: string;
5
+ importedFileReference?: string;
6
+ }
7
+ export interface Document {
8
+ id?: string;
9
+ name?: string;
10
+ elements?: Array<DocumentElement>;
11
+ size?: SizeDefinition;
12
+ style?: StyleDefinition;
13
+ model?: any;
14
+ modelBindings?: any;
15
+ background?: Array<DocumentElement>;
16
+ importedFrom?: ImportReferenceDetail;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ export interface ScaleTrasformation {
2
+ x?: number;
3
+ y?: number;
4
+ }
5
+ export interface TranslateTrasformation {
6
+ x?: number;
7
+ y?: number;
8
+ }
9
+ export interface ElementTransformation {
10
+ translate?: TranslateTrasformation;
11
+ scale?: ScaleTrasformation;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export * from './common';
2
+ export * from './data-object';
3
+ export * from './document-change';
4
+ export * from './document-element-event';
5
+ export * from './document-element-holder';
6
+ export * from './document-element';
7
+ export * from './document';
8
+ export * from './element-transformation';
@@ -0,0 +1,20 @@
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" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./common"), exports);
14
+ __exportStar(require("./data-object"), exports);
15
+ __exportStar(require("./document-change"), exports);
16
+ __exportStar(require("./document-element-event"), exports);
17
+ __exportStar(require("./document-element-holder"), exports);
18
+ __exportStar(require("./document-element"), exports);
19
+ __exportStar(require("./document"), exports);
20
+ __exportStar(require("./element-transformation"), exports);
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@contrail/documents",
3
+ "version": "1.0.1",
4
+ "description": "Documents library for contrail platform",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
10
+ "lint": "tslint -p tsconfig.json",
11
+ "test": "jest"
12
+ },
13
+ "keywords": [],
14
+ "author": "",
15
+ "license": "ISC",
16
+ "files": [
17
+ "lib/**/*"
18
+ ],
19
+ "devDependencies": {
20
+ "@types/jest": "^23.3.14",
21
+ "jest": "^23.6.0",
22
+ "prettier": "^1.19.1",
23
+ "ts-jest": "^23.10.5",
24
+ "tslint": "^5.11.0",
25
+ "tslint-config-prettier": "^1.18.0",
26
+ "typescript": "^3.0.1"
27
+ },
28
+ "jest": {
29
+ "moduleFileExtensions": [
30
+ "js",
31
+ "json",
32
+ "ts"
33
+ ],
34
+ "rootDir": "src",
35
+ "testRegex": ".spec.ts$",
36
+ "transform": {
37
+ "^.+\\.(t|j)s$": "ts-jest"
38
+ },
39
+ "coverageDirectory": "../coverage",
40
+ "testEnvironment": "node"
41
+ },
42
+ "dependencies": {
43
+ "reflect-metadata": "^0.1.13"
44
+ }
45
+ }