open-index/open-npm huggingface dataset:
npm package: @ncodedcode/ncode_react_lib
Description: ncode react application context library
Author: iamchiwon@itsdcode.com
Latest version: 0.1.11

# ncode_react_lib

[![npm version](https://badge.fury.io/js/@ncodedcode%2Fncode_react_lib.svg)](https://badge.fury.io/js/@ncodedcode%2Fncode_react_lib)

## Install

```shell
yarn add @ncodedcode/ncode_react_lib
```

- index.tsx

```typescript
import React from "react";

// add this
NCApplicationContext.createContext(new NCDefaultApplicationConfiguration()); 

ReactDOM.render(
  <React.StrictMode>
      <App />
  </React.StrictMode>,
  document.getElementById("root")
);
```

## Custom Configuration

- implements NCApplicationConfiguration

```typescript
export class AppConfiguration implements NCApplicationConfiguration {
  application(app: NCApplicationContext): void {
    app.devMode = process.env.REACT_APP_ENV_TYPE === "dev";
    NCLog.setLogLevel(NCLogLevel.Debug);
  }

  config(container: ServiceLocator): void {
      // set up dependency injection
  }
}
```

- init Context with Custom Configuration

```typescript
NCApplicationContext.createContext(new AppConfiguration());
```

### Use LocalStorage as a default NCStorage

- implements NCStorage

```typescript
import { NCStorage } from "@ncodedcode/ncode_react_lib";

export class LocalStorage implements NCStorage {
  contains(key: string): Promise<boolean> {
    return Promise.resolve(!!localStorage.getItem(key));
  }

  delete(key: string): Promise<boolean> {
    return this.contains(key).then((exist) => {
      if (exist) localStorage.removeItem(key);
      return exist;
    });
  }

  load(key: string): Promise<string | null> {
    return Promise.resolve(localStorage.getItem(key) || null);
  }

  save(key: string, value: string): Promise<boolean> {
    if (!value) return this.delete(key);
    localStorage.setItem(key, value);
    return Promise.resolve(true);
  }
}
```

- regist instance

```typescript
export class AppConfiguration implements NCApplicationConfiguration {
  config(container: ServiceLocator): void {
    container.registFactory(NCStorageClassName, () => new LocalStorage());
  }
}
```

### Use dayjs as a default NCDating

- implements NCDating

```typescript
export class DayjsDating implements NCDating {
  private _day: Dayjs = dayjs();

  constructor() {
    dayjs.extend(utc);
    dayjs.extend(timezone);
    dayjs.extend(relativeTime);
    dayjs.extend(duration);
  }

  now(): NCDating {
    this._day = dayjs();
    return this;
  }

  create(m: number): NCDating {
    this._day = dayjs(m);
    return this;
  }
  ...
}
```

- regist instance

```typescript
export class AppConfiguration implements NCApplicationConfiguration {
  config(container: ServiceLocator): void {
    container.registFactory(NCDatingClassName, () => new DayjsDating());
  }
}
```

# TO-DO

[ ] Default FetchNetworking  
[ ] NCNetwork.setBaseUrl

# Example Project

- run

```shell
cd example
yarn install
yarn start
```
npm package: @ncodefactory/dotenv-wrapper
Description: a simple class that allows you to adapt environment variables from an .env file and conveniently share them in the application
Author: Bartosz Solarski
Latest version: 1.2.2

# dotenv-wrapper #

a simple class that allows you to adapt environment variables from an .env file and conveniently share them in the application

## installation: ##

### npm: ###
```
npm install @ncodefactory/dotenv-wrapper --save
```

### yarn: ###
```
yarn add @ncodefactory/dotenv-wrapper
```

## usage: ##

### create some environment module

```js
import dotEnvWrapper from '@ncodefactory/dotenv-wrapper';

const environment = new dotEnvWrapper();
environment.addNumber('HTTP_PORT', 80);
environment.addNumber('HTTPS_PORT', 443);
environment.addBoolean('USE_SSL', false);
environment.addString('PORT_INFO_MESSAGE', 'Current port no is:');

export default environment;
```

### or when you want use editor intellisense 

```js
import { addNumber, addBoolean, addString } from '@ncodefactory/dotenv-wrapper';

const environment = {
    HTTP_PORT: addNumber('HTTP_PORT', 80),
    HTTPS_PORT: addNumber('HTTPS_PORT', 443)
    USE_SSL: addBoolean('USE_SSL', false);
    PORT_INFO_MESSAGE: addString('PORT_INFO_MESSAGE', 'Current port no is:');
};

export default environment;
```

### use created module in your app

```js
import env from 'environment';

const port = env.USE_SSL ? env.HTTPS_PORT : env.HTTP_PORT;

console.log(`${env.PORT_INFO_MESSAGE} ${port}`);
```
npm package: @ncodefactory/gsprovider
Description: Golem stations communication provider
Author: Bartosz Solarski
Latest version: 3.1.1

# gsprovider

Golem stations communication provider

## installation:

### npm:

```
npm install @ncodefactory/gsprovider --save
```

### yarn:

```
yarn add @ncodefactory/gsprovider
```

## usage:

### gsstate - read state from golem station

```js
import { gsstatus } from "@ncodefactory/gsprovider";

const stateReader = gsstate(
  "golem_station_host",
  golem_station_pot,
  connection_milliseconds_timeout
);
const stateReader = gsstate("golem_station_host", golem_station_pot); // timeout is default 3000 milliseconds
const state = await stateReader(gole_station_sv_no);
```

### gscmd - write command to golem station

```js
import { gsstatus } from "@ncodefactory/gsprovider";

const cmdWriter = gscmd(
  "golem_station_host",
  golem_station_pot,
  connection_milliseconds_timeout
);
const cmdWriter = gscmd("golem_station_host", golem_station_pot); // timeout is default 3000 milliseconds
const command = {
  command: 1,
  sr: "bs-v5",
  sv: 1,
  nrstatus: 0,
  id_operatora: 1,
  operator_txt: "bsolarski"
};

const cmdOk = await cmdWriter(command);
```
npm package: @ncodefactory/morph-cli
Description: command-line interface for morph development env
Author: Bartosz Solarski
Latest version: 3.13.2

# morph-cli

Command line interface for **Morph** development framework.

## installation:

### npm:

```
npm install -g @ncodefactory/morph-cli
```

### yarn:

```
yarn global add @ncodefactory/morph-cli
```

## usage:

After installation type **mo --help** for help
npm package: @ncodefactory/morph-ctrls
Description: gui controls for morph applications
Author: Bartosz Solarski
Latest version: 0.3.0

# morph-ctrls

gui controls for morph applications

## installation:

### npm:

```
npm install @ncodefactory/morph-ctrls --save
```

### yarn:

```
yarn add @ncodefactory/morph-ctrls
```

## usage:

### ContentControl

```jsx
import React from "react";
import ReactDOM from "react-dom";
import { ContentControl } from "@ncodefactory/morph-ctrls";

ReactDOM.render(<ContentControl />, document.getElementById("root"));
```
### TextBlock

```jsx
import React from "react";
import ReactDOM from "react-dom";
import { TextBlock } from "@ncodefactory/morph-ctrls";

ReactDOM.render(<TextBlock text="Lorem ipsum" />, document.getElementById("root"));
```
npm package: @ncodefactory/pg-db-provider
Description: simple db-provider for pg
Author: Bartosz Solarski
Latest version: 0.1.3

# pg-db-provider

## connect/disconnect

```js
const dbConnProps = {
 dbHost: "127.0.0.1",
 dbPort: 5432,
 dbName: "db_name",
 dbUser: "db_user",
 dbPasswd: "db_password",
};

const dbProvider = new DBProvider({...dbConnProps});
await dbProvider.connect();
console.log(dbProvider.isConnected); // true
await dbProvider.disconnect();
console.log(dbProvider.isConnected); // false

```

## execute query

```js
const dbConnProps = {
 dbHost: "127.0.0.1",
 dbPort: 5432,
 dbName: "db_name",
 dbUser: "db_user",
 dbPasswd: "db_password",
};

const dbProvider = new DBProvider({...dbConnProps});
await dbProvider.connect();
const result = await dbProvider.executeQuery("select 1 num");
console.log(result?.rows[0].num); // 1
await dbProvider.disconnect();

```

## use client

```js
const dbConnProps = {
 dbHost: "127.0.0.1",
 dbPort: 5432,
 dbName: "db_name",
 dbUser: "db_user",
 dbPasswd: "db_password",
};

const dbProvider = new DBProvider({...dbConnProps});
await dbProvider.connect();
const result = await dbProvider.useClient(async (client) => {
    return await client.query("select 1 num");
});
console.log(result?.rows[0].num); // 1
await dbProvider.disconnect();

```

## open cursor

```js
const dbConnProps = {
 dbHost: "127.0.0.1",
 dbPort: 5432,
 dbName: "db_name",
 dbUser: "db_user",
 dbPasswd: "db_password",
};

const dbProvider = new DBProvider({...dbConnProps});
await dbProvider.connect();
const cursor = await dbProvider.openCursor("select 1 num");
const rows = await cursor?.read(1);
console.log(rows[0].num); // 1
await cursor?.close();
await dbProvider.disconnect();

```
npm package: @ncodefactory/prop-types-custom
Description: quick and easy creation custom prop types validators for react props
Author: Bartosz Solarski
Latest version: 1.0.0

# prop-types-custom #

quick and easy creation custom prop types validators for react props

## installation: ##

### npm: ###
```
npm install @ncodefactory/prop-types-custom --save
```

### yarn: ###
```
yarn add @ncodefactory/prop-types-custom
```

## usage: ##

```js
import default_export_from_the_module_being_used from '@ncodefactory/prop-types-custom';
```

or

```js
import { some_known_export_from_the_module_being_used } from '@ncodefactory/prop-types-custom';
```

```javascript
const validator = value => value.length === 3;
const validatedTypeName = "threeCharString";
const threeCharStringPropType = customPropType(validatedTypeName, validator);

Component.propTypes = {
  name: threeCharStringPropType.isRequired,
  subName: threeCharStringPropType
};
```
npm package: @ncodefactory/ramshorn-module-foundation
Description: @ncodefactory/ramshorn-module-foundation - an module created using morph-cli
Author: Bartosz Solarski
Latest version: 0.1.2

# @ncodefactory/ramshorn-module-foundation #

@ncodefactory/ramshorn-module-foundation - an module created using morph-cli

## installation: ##

### npm: ###
```
npm install @ncodefactory/ramshorn-module-foundation --save
```

### yarn: ###
```
yarn add @ncodefactory/ramshorn-module-foundation
```

## usage: ##

```js
import default_export_from_the_module_being_used from '@ncodefactory/ramshorn-module-foundation';
```

or

```js
import { some_known_export_from_the_module_being_used } from '@ncodefactory/ramshorn-module-foundation';
```
npm package: @ncodefactory/rmui-passwd
Description: Creates encryption and decryption functions.
Latest version: 5.2.0

# rmui-passwd #

Creates encryption and decryption functions.

## installation: ##

### yarn: ###
```
yarn add @ncodefactory/rmui-passwd
```
### npm: ###
```
npm install @ncodefactory/rmui-passwd --save
```

## usage: ##

```javascript
import { encoder, decoder } from './rmuiPasswd';

const secret = 'secret';
const encode = encoder(secret);
const decode = decoder(secret);

const toEncode = 'passwd';
const encoded = encode(toEncode);
// => E3C6D6E5DCD8

const decoded = decode(encoded);
// => passwd

console.log(`encode: ${toEncode} => ${encoded}, decode: ${encoded} => ${decoded}`); //eslint-disable-line
// => encode: passwd => E3C6D6E5DCD8, decode: E3C6D6E5DCD8 => passwd
```
npm package: @ncodefactory/rmui-themes
Description: Themes support for rmui project.
Latest version: 0.1.0

# rmui-themes

Themes support for rmui project.

## installation:

### yarn:

```
yarn add @ncodefactory/rmui-themes
```

### npm:

```
npm install @ncodefactory/rmui-themes --save
```

## usage:

```javascript
```
npm package: @ncodefactory/tcpipcli
Description: ## installation: ##
Author: Bartosz Solarski
Latest version: 1.0.0

# tcpipcli #

## installation: ##

### npm: ###
```
npm install @ncodefactory/tcpipcli --save
```

### yarn: ###
```
yarn add @ncodefactory/tcpipcli
```

## usage: ##

```js
import tcpipcli from '@ncodefactory/tcpipcli';

const host = 'localhost';
const port = 5000;
const timeout = 3000; // milliseconds

const client = tcpipcli(host, port, timeout);

const requestData = [74, 32, 91];
const request = Buffer.from(requestData); // request must have the Buffer type https://nodejs.org/dist/latest-v10.x/docs/api/buffer.html

const response = await client(request);

```
npm package: @ncodeuy/css-components
Description: A library that turns CSS module classes into components
Author: Nicolas Gonzalvez
Latest version: 1.0.2

# CSS Modules Components

Automatically generate React components from CSS Modules.

## Installation

```bash
npm install css-modules-components
```

## Usage

Let's consider the following CSS module file.

```scss
// styles.module.css
.Card { }
.Title { }
.Text { }
```

### Create Components

```tsx
// YourComponent.tsx
import styles from './styles.module.scss';
import cssComponents from '@ncodeuy/css-components';

// Components with the className prop already set.
const { Card, Title, Text} = cssComponents(styles);

function Component() {
  return (
    <Card>
      <Title>Main Title</Title>
      <Text>Some paragraph text</Text>
    </Card>
  );
}
```

### Use Custom Element Types

You can specify the default HTML element for each component:

```tsx
const components = cssComponents(styles, {
  Title: 'h1',
  Text: 'p',
  Button: 'button',
  Image: 'img'
});
```

### Overriding Element Type

In case you need an exception, you can override the element type with the `as` prop:

```tsx
<Title as="h3">Smaller Title</Title>
```

### Combining with Additional Classes

Every created component will have the corresponding className from the CSS module file. If you need
to provide any **additional** classes, you can simply add the `className` prop.

```tsx
<Card className="additional-class">
  This component will have both `styles.Card` and the given class.
</Card>
```

## Feature Requests

If you have any feature requests, suggestions or comments about this library, feel free to open an
issue. I'll do my best to address any issues you may be having.

## License

This project is licensed under the MIT License - see the LICENSE file for details.