raain-ui 2.3.6 → 2.3.7
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/CHANGELOG.md +55 -0
- package/GUIDELINES.md +168 -0
- package/README.md +61 -7
- package/RELEASE_PROCESS.md +92 -0
- package/package.json +1 -1
- package/RELEASE.md +0 -10
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the raain-ui project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [2.3.x] - Current
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Cartesian earth optimization for improved performance
|
|
12
|
+
|
|
13
|
+
## [2.2.x]
|
|
14
|
+
|
|
15
|
+
### Enhanced
|
|
16
|
+
- Model polar visualization improvements
|
|
17
|
+
|
|
18
|
+
## [2.1.x]
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- Support for icons in composite layers
|
|
22
|
+
|
|
23
|
+
## [2.0.x]
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- Updated raain-model integration
|
|
27
|
+
|
|
28
|
+
## [1.11.x]
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- Refactored Factory components
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
- Performance monitoring capabilities
|
|
35
|
+
|
|
36
|
+
## [1.10.x]
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- Cartesian visualization issues
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- Show/hide capability for UI elements
|
|
43
|
+
|
|
44
|
+
## [1.0.x - 1.9.x]
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
- Various factories for UI components:
|
|
48
|
+
- Map integration
|
|
49
|
+
- Compare functionality
|
|
50
|
+
- Configuration options
|
|
51
|
+
|
|
52
|
+
## [0.x.x]
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
- Initial release with core components extracted from RAAIN project
|
package/GUIDELINES.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# raain-ui Development Guidelines
|
|
2
|
+
|
|
3
|
+
This document provides essential information for developers working on the raain-ui project.
|
|
4
|
+
|
|
5
|
+
## Build and Configuration Instructions
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
- Node.js and npm
|
|
9
|
+
|
|
10
|
+
### Setup
|
|
11
|
+
1. Clone the repository
|
|
12
|
+
2. Install dependencies:
|
|
13
|
+
```bash
|
|
14
|
+
npm install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Build Commands
|
|
18
|
+
- **Build the project**:
|
|
19
|
+
```bash
|
|
20
|
+
npm run build
|
|
21
|
+
```
|
|
22
|
+
This command:
|
|
23
|
+
- Removes the existing `dist` directory
|
|
24
|
+
- Compiles TypeScript files according to `tsconfig.json`
|
|
25
|
+
- Copies markdown files and package.json to the dist directory
|
|
26
|
+
|
|
27
|
+
- **Clean and reinstall**:
|
|
28
|
+
```bash
|
|
29
|
+
npm run _clean
|
|
30
|
+
```
|
|
31
|
+
This removes generated directories, logs, and node_modules, then reinstalls dependencies.
|
|
32
|
+
|
|
33
|
+
- **Build with version increment**:
|
|
34
|
+
```bash
|
|
35
|
+
npm run build-version
|
|
36
|
+
```
|
|
37
|
+
This increments the patch version in package.json before building.
|
|
38
|
+
|
|
39
|
+
### TypeScript Configuration
|
|
40
|
+
The project uses TypeScript with the following key configurations:
|
|
41
|
+
- Target: ES2017
|
|
42
|
+
- Module: CommonJS
|
|
43
|
+
- Declaration files are generated
|
|
44
|
+
- Entry point: `./src/index.ts`
|
|
45
|
+
- Output directory: `./dist/`
|
|
46
|
+
|
|
47
|
+
## Testing Information
|
|
48
|
+
|
|
49
|
+
### Test Configuration
|
|
50
|
+
The project uses:
|
|
51
|
+
- **Mocha**: Test runner
|
|
52
|
+
- **Chai**: Assertion library
|
|
53
|
+
- **NYC (Istanbul)**: Code coverage tool
|
|
54
|
+
- **Mock-Browser**: For mocking browser environment in tests
|
|
55
|
+
|
|
56
|
+
### Running Tests
|
|
57
|
+
- **Run all tests**:
|
|
58
|
+
```bash
|
|
59
|
+
npm test
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- **Run specific tests** (using grep pattern):
|
|
63
|
+
```bash
|
|
64
|
+
npm test -- -g "pattern"
|
|
65
|
+
```
|
|
66
|
+
Example:
|
|
67
|
+
```bash
|
|
68
|
+
npm test -- -g "should convert RGB string to hex"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Test Environment
|
|
72
|
+
Tests run in a Node.js environment with:
|
|
73
|
+
- A mocked browser environment for Leaflet and Pixi.js components
|
|
74
|
+
- TypeScript support via ts-node
|
|
75
|
+
|
|
76
|
+
### Adding New Tests
|
|
77
|
+
1. Create test files in the `specs` directory, mirroring the structure of the `src` directory
|
|
78
|
+
2. Name test files with `.spec.ts` extension
|
|
79
|
+
3. Use Mocha's `describe` and `it` functions for test organization
|
|
80
|
+
4. Use Chai's `expect` for assertions
|
|
81
|
+
|
|
82
|
+
### Example Test
|
|
83
|
+
Here's a simple test for the `rgbStringToHex` method in the `Tools` class:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import {expect} from 'chai';
|
|
87
|
+
import {Tools} from '../../src';
|
|
88
|
+
|
|
89
|
+
describe('Factories.Tools', () => {
|
|
90
|
+
it('should convert RGB string to hex', async () => {
|
|
91
|
+
// Test basic RGB to hex conversion
|
|
92
|
+
expect(Tools.rgbStringToHex('rgb(255, 0, 0)')).eq('#ff0000');
|
|
93
|
+
expect(Tools.rgbStringToHex('rgb(0, 255, 0)')).eq('#00ff00');
|
|
94
|
+
|
|
95
|
+
// Test error cases
|
|
96
|
+
try {
|
|
97
|
+
Tools.rgbStringToHex('invalid');
|
|
98
|
+
expect.fail('Should have thrown an error for invalid RGB string');
|
|
99
|
+
} catch (error) {
|
|
100
|
+
expect(error.message).eq('Invalid RGB string format');
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Code Style and Development Guidelines
|
|
107
|
+
|
|
108
|
+
### Code Style
|
|
109
|
+
The project uses TSLint with the following key rules:
|
|
110
|
+
- Single quotes for strings
|
|
111
|
+
- Maximum line length of 140 characters
|
|
112
|
+
- Member ordering: static fields, instance fields, static methods, instance methods
|
|
113
|
+
- No requirement for interface names to start with "I"
|
|
114
|
+
- No requirement for explicit member access modifiers
|
|
115
|
+
|
|
116
|
+
### Documentation
|
|
117
|
+
- Use JSDoc comments for classes, methods, and properties
|
|
118
|
+
- Include parameter descriptions and return types
|
|
119
|
+
- Document thrown exceptions
|
|
120
|
+
|
|
121
|
+
### Project Structure
|
|
122
|
+
- `src/`: Source code
|
|
123
|
+
- `drawers/`: Drawing components
|
|
124
|
+
- `factories/`: Factory classes
|
|
125
|
+
- `layers/`: Layer components
|
|
126
|
+
- `timeframes/`: Time-related components
|
|
127
|
+
- `tools/`: Utility tools
|
|
128
|
+
- `specs/`: Test files (mirrors src structure)
|
|
129
|
+
- `example/`: Example usage
|
|
130
|
+
- `tools/`: Build and test utilities
|
|
131
|
+
- `dist/`: Compiled output (generated)
|
|
132
|
+
|
|
133
|
+
### Dependencies
|
|
134
|
+
The project uses:
|
|
135
|
+
- Chart.js for charting
|
|
136
|
+
- Leaflet for maps
|
|
137
|
+
- Pixi.js for rendering
|
|
138
|
+
- raain-model for data models
|
|
139
|
+
|
|
140
|
+
### Example Usage
|
|
141
|
+
The project includes an example application in the `example` directory that demonstrates how to use the library:
|
|
142
|
+
|
|
143
|
+
1. **Build the library first**:
|
|
144
|
+
```bash
|
|
145
|
+
npm run build
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
2. **Run the example**:
|
|
149
|
+
```bash
|
|
150
|
+
cd example
|
|
151
|
+
npm start
|
|
152
|
+
```
|
|
153
|
+
This will:
|
|
154
|
+
- Clean the example directory
|
|
155
|
+
- Install dependencies
|
|
156
|
+
- Start a Parcel development server
|
|
157
|
+
- Open the example in your browser
|
|
158
|
+
|
|
159
|
+
3. **Build the example for production**:
|
|
160
|
+
```bash
|
|
161
|
+
cd example
|
|
162
|
+
npm run build
|
|
163
|
+
```
|
|
164
|
+
This creates a production build in the `example/dist` directory.
|
|
165
|
+
|
|
166
|
+
### Common Issues and Solutions
|
|
167
|
+
- When testing components that use browser APIs, ensure the mock browser environment is properly set up
|
|
168
|
+
- Some tests may fail due to timezone differences; use timezone-independent assertions when testing date formatting
|
package/README.md
CHANGED
|
@@ -1,19 +1,73 @@
|
|
|
1
1
|
# raain-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
UI components and visualization layers for raain.io applications.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
raain-ui is a library that provides UI components and visualization layers for displaying and interacting with rainfall data. It uses Leaflet for maps, Pixi.js for rendering, and Chart.js for charting.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
4
10
|
|
|
5
|
-
or try the [example](./example) :
|
|
6
11
|
```bash
|
|
7
|
-
npm
|
|
12
|
+
npm install raain-ui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Basic Setup
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
import { MapElement } from 'raain-ui';
|
|
21
|
+
|
|
22
|
+
// Create a map element
|
|
23
|
+
const mapElement = new MapElement({
|
|
24
|
+
container: 'map-container',
|
|
25
|
+
center: [51.505, -0.09],
|
|
26
|
+
zoom: 13
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Example Application
|
|
31
|
+
|
|
32
|
+
The project includes an example application that demonstrates how to use the library:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Clone the repository
|
|
36
|
+
git clone https://github.com/raainio/raain-ui.git
|
|
37
|
+
cd raain-ui
|
|
38
|
+
|
|
39
|
+
# Install dependencies and build the library
|
|
40
|
+
npm install
|
|
8
41
|
npm run build
|
|
42
|
+
|
|
43
|
+
# Run the example
|
|
9
44
|
cd example/
|
|
10
|
-
npm start
|
|
45
|
+
npm start
|
|
11
46
|
```
|
|
12
|
-
=> http://localhost:1234
|
|
13
47
|
|
|
14
|
-
|
|
48
|
+
This will open the example application at http://localhost:1234
|
|
49
|
+
|
|
50
|
+
## Development
|
|
51
|
+
|
|
52
|
+
Please read the [Development Guidelines](./GUIDELINES.md) for detailed information about:
|
|
53
|
+
- Build and configuration instructions
|
|
54
|
+
- Testing information
|
|
55
|
+
- Code style and development guidelines
|
|
56
|
+
- Project structure
|
|
57
|
+
- Dependencies
|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
15
60
|
|
|
16
|
-
|
|
61
|
+
API documentation is available in the [specifications](./specs) directory.
|
|
62
|
+
|
|
63
|
+
## Changelog
|
|
64
|
+
|
|
65
|
+
See the [Changelog](./CHANGELOG.md) for a list of changes in each version.
|
|
66
|
+
|
|
67
|
+
## Release Process
|
|
68
|
+
|
|
69
|
+
See the [Release Process](./RELEASE_PROCESS.md) for information about how releases are managed.
|
|
17
70
|
|
|
18
71
|
## License
|
|
72
|
+
|
|
19
73
|
MIT
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
This document outlines the process for creating and publishing new releases of the raain-ui library.
|
|
4
|
+
|
|
5
|
+
## Version Numbering
|
|
6
|
+
|
|
7
|
+
raain-ui follows [Semantic Versioning](https://semver.org/) (SemVer):
|
|
8
|
+
|
|
9
|
+
- **MAJOR** version for incompatible API changes (X.y.z)
|
|
10
|
+
- **MINOR** version for backwards-compatible functionality additions (x.Y.z)
|
|
11
|
+
- **PATCH** version for backwards-compatible bug fixes (x.y.Z)
|
|
12
|
+
|
|
13
|
+
## Release Steps
|
|
14
|
+
|
|
15
|
+
### 1. Preparation
|
|
16
|
+
|
|
17
|
+
1. Ensure all tests pass:
|
|
18
|
+
```bash
|
|
19
|
+
npm test
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. Update documentation if necessary:
|
|
23
|
+
- README.md
|
|
24
|
+
- API documentation
|
|
25
|
+
- Example code
|
|
26
|
+
|
|
27
|
+
3. Update the CHANGELOG.md file:
|
|
28
|
+
- Add a new section for the release version
|
|
29
|
+
- Document all notable changes since the last release
|
|
30
|
+
- Categorize changes as Added, Changed, Fixed, etc.
|
|
31
|
+
|
|
32
|
+
### 2. Version Bump
|
|
33
|
+
|
|
34
|
+
1. Use the built-in version increment script for patch releases:
|
|
35
|
+
```bash
|
|
36
|
+
npm run build-version
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or manually update the version in package.json for minor or major releases.
|
|
40
|
+
|
|
41
|
+
### 3. Build and Test the Release
|
|
42
|
+
|
|
43
|
+
1. Clean the project and reinstall dependencies:
|
|
44
|
+
```bash
|
|
45
|
+
npm run _clean
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
2. Build the project:
|
|
49
|
+
```bash
|
|
50
|
+
npm run build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
3. Run tests again to ensure everything works with the built version:
|
|
54
|
+
```bash
|
|
55
|
+
npm test
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 4. Publish to npm
|
|
59
|
+
|
|
60
|
+
Do not it manually, it's done by GitHub CI by pushing in the master branch.
|
|
61
|
+
|
|
62
|
+
### 5. Create a Git Tag and Release
|
|
63
|
+
|
|
64
|
+
1. Create a git tag for the release:
|
|
65
|
+
```bash
|
|
66
|
+
git tag -a v<version> -m "Release v<version>"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. Push the tag to the repository:
|
|
70
|
+
```bash
|
|
71
|
+
git push origin v<version>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
3. Create a release on GitHub:
|
|
75
|
+
- Go to the repository's Releases page
|
|
76
|
+
- Create a new release using the tag
|
|
77
|
+
- Copy the relevant section from CHANGELOG.md as the release description
|
|
78
|
+
|
|
79
|
+
## Hotfix Process
|
|
80
|
+
|
|
81
|
+
For critical bug fixes that need to be released outside the normal release cycle:
|
|
82
|
+
|
|
83
|
+
1. Create a hotfix branch from the latest release tag
|
|
84
|
+
2. Fix the issue and commit the changes
|
|
85
|
+
3. Follow the normal release process, but increment only the patch version
|
|
86
|
+
4. After publishing, merge the hotfix back into the main development branch
|
|
87
|
+
|
|
88
|
+
## Post-Release
|
|
89
|
+
|
|
90
|
+
1. Update the example application to use the new version if necessary
|
|
91
|
+
2. Notify users of the new release through appropriate channels
|
|
92
|
+
3. Monitor for any issues reported by users
|
package/package.json
CHANGED
package/RELEASE.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Release notes
|
|
2
|
-
|
|
3
|
-
- 0.x.x : first extracts from RAAIN
|
|
4
|
-
- 1.(-)9.x : factories uses in UI (map, compare, config)
|
|
5
|
-
- 1.10.x : UI feedbacks (fix cartesians, add show/hide capability)
|
|
6
|
-
- 1.11.x : Factory refactored, perf monitoring added
|
|
7
|
-
- 2.0.x : change raain-model
|
|
8
|
-
- 2.1.x : composite layer could include icons
|
|
9
|
-
- 2.2.x : model polar enhancement
|
|
10
|
-
- 2.3.x : cartesian earth optimization
|