A library for generating user interfaces based on JSON files or PSD/JPG images.
npm install ui-generator-lib```
npm install ui-generator-lib
`javascript`
import { UIBuilder, JsonParser, ImageParser, ApiConfig } from 'ui-generator-lib';
`javascript
const jsonParser = new JsonParser();
const uiBuilder = new UIBuilder();
const jsonData = jsonParser.parseJson('path/to/your/file.json');
uiBuilder.buildUI(jsonData);
`
`javascript
const imageParser = new ImageParser();
const uiBuilder = new UIBuilder();
const imageData = imageParser.parseImage('path/to/your/file.psd');
uiBuilder.buildUI(imageData);
`
`javascript`
const apiConfig = new ApiConfig();
apiConfig.configureApi({
endpoint: 'https://api.example.com/data',
method: 'GET',
});
`javascript
import { setAlignment } from './utils/alignment';
setAlignment('horizontal'); // or 'vertical'
`
`javascript`
uiBuilder.applyStyles({
backgroundColor: 'blue',
color: 'white',
});
: Parses the JSON file and returns the data.
- validateJson(jsonData): Validates the structure of the JSON data.- ImageParser
-
parseImage(filePath): Parses the image file and extracts UI components.
- validateImage(imageData): Validates the integrity of the image data.- UIBuilder
-
buildUI(data): Constructs the user interface based on the provided data.
- applyStyles(styles): Applies custom styles to the UI components.- ApiConfig
-
configureApi(config): Configures API endpoints and parameters.
- validateApi(apiConfig): Validates the API configuration.- Alignment
-
setAlignment(direction)`: Sets the alignment of UI components (horizontal or vertical).