hart-estate-widget 1.0.2 → 1.1.4

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 CHANGED
@@ -1,7 +1,147 @@
1
- # Компонент HART Estate
1
+ # HART Estate Widget Component
2
2
 
3
- ## Список доступных команд
4
3
 
5
- ### `npm start` - запуск приложения
4
+ ## Installation using NPM:
6
5
 
7
- ### `npm run build` - билд приложения
6
+ `npm install hart-estate-widget --save`
7
+
8
+ ## Usage example:
9
+
10
+ ```js
11
+ import React, { useEffect, useState } from 'react';
12
+ import { Widget, rotationModes } from 'hart-estate-widget';
13
+ // or
14
+ import 'hart-estate-widget/build/widget.bundle.js'; // in this case, a global variable WidgetLibrary is created
15
+
16
+ const WIDGET_OPTIONS = {
17
+ tabs: ['planImage', 'rotation', 'panorama'],
18
+ logo: '/path/to/logo.png',
19
+ planImage: '/path/to/plan.jpg',
20
+ rotationMode: rotationModes.DEFAULY,
21
+ rotationData: {
22
+ type: 'top_down',
23
+ items: [
24
+ '/path/to/rotation_image_1.jpg',
25
+ ...
26
+ '/path/to/rotation_image_5.jpg',
27
+ ],
28
+ },
29
+ panoramaData: {
30
+ type: 'sphere',
31
+ items: [
32
+ {
33
+ camera_id: '1234',
34
+ images: ['/path/to/panorama_image.jpg'],
35
+ room_id: '1234',
36
+ },
37
+ ],
38
+ },
39
+ };
40
+
41
+ const App = () => {
42
+ const [widget, setWidget] = useState(null);
43
+
44
+ useEffect(() => {
45
+ const createdWidget = new Widget('#widget-container', WIDGET_OPTIONS);
46
+ setState(createdWidget);
47
+ }, []);
48
+
49
+ return (
50
+ <div>
51
+ <div id="widget-container" />
52
+ </div>
53
+ );
54
+ }
55
+
56
+ export App;
57
+
58
+ ```
59
+
60
+
61
+ ## Parameters:
62
+
63
+ ```js
64
+ {
65
+ // elements
66
+ tabs: ['rotation', 'panorama'], // included elements
67
+
68
+ // logo
69
+ logo: '', // path to logo
70
+ logoUrl: '', // link opened when logo is clicked
71
+
72
+ // localization
73
+ locale: 'en', // ISO 639 language code
74
+
75
+ // width/height
76
+ width: 1920,
77
+ height: 1080,
78
+ resizable: true, // automatically resize the widget to the size of the container when the window is resized
79
+
80
+ // values
81
+ planImage: '', // path to the plan image (required for panoramic tour)
82
+ topViewImage: '', // path to the top view image
83
+ rotationMode: 'default', // mode of operation for plan images
84
+ rotationData: {}, // type of images and paths to circular view images (order is mandatory)
85
+ panoramaData: {}, // type of panorama and paths to 360° images
86
+ panoramaFov: 75, // camera field of view angle for panoramic tour
87
+
88
+ // colors
89
+ colors: {
90
+ main: '#HEX', // main color of buttons, elements
91
+ mainText: '#HEX', // text color for buttons, elements contrasting with the main color
92
+ },
93
+ }
94
+
95
+ ```
96
+
97
+ ## Types of elements
98
+ ```js
99
+ tabs: [
100
+ 'rotation', // circular view images (order is mandatory)
101
+ 'panorama', // 360° images
102
+ ],
103
+ rotationMode: [
104
+ rotationModes.DEFAULT, // top view mode (multiple perspectives) and stylized plan view
105
+ rotationModes.THREESIXTY, // image scrolling mode for circular view
106
+ ],
107
+ rotationData.type: [
108
+ 'top_down', // full model
109
+ 'middle_cut', // model with cut in the middle
110
+ ],
111
+ panoramaData.type: [
112
+ 'sphere', // 360° panorama
113
+ 'cube', // panorama with 6 images (top, down, left, right, front, back)
114
+ ],
115
+ locale: [
116
+ 'ru', // Russian language
117
+ 'en', // English language
118
+ ],
119
+ ```
120
+
121
+
122
+ ## Publishing with Nexus Registry NPM:
123
+ ```js
124
+ // in @hart-estate/widget package.json:
125
+ "publishConfig": {
126
+ "registry": "https://nexus.myhart.ru/repository/npm/"
127
+ },
128
+ ```
129
+ `npm adduser --auth-type=legacy --registry=https://nexus.myhart.ru/repository/npm/`
130
+ `npm install`
131
+ `npm run build`
132
+ `npm publish`
133
+
134
+
135
+ ## Installation using Nexus Registry NPM:
136
+
137
+ `npm adduser --auth-type=legacy --registry=https://nexus.myhart.ru/repository/npm/`
138
+
139
+ ```js
140
+ // when reinstalling (updating), delete node_modules and package-lock.json
141
+ // add .npmrc in root:
142
+ @hart-estate/widget:registry=https://nexus.myhart.ru/repository/npm/
143
+ registry=https://registry.npmjs.org/
144
+ ```
145
+
146
+ `npm config set @hart-estate:registry https://nexus.myhart.ru/repository/npm/`
147
+ `npm install`