open-index/open-npm huggingface dataset:
npm package: @mindgym/ui
Description: This is the Mindgym UI library featuring the components and themes we use.
Author: Mindgym Academy
Latest version: 1.0.6

# Mindgym UI

This is the Mindgym UI library featuring the components and themes we use.

## Usage

```shell
$ yarn add @mindgym/ui
```

```tsx
import { Button } from "@mindgym/ui";

export function App() {
  <div>
    <Button primary>Click Me!</Button>
  </div>;
}
```

## Documentation

Check out the [live documentation with examples](https://62abf4f085bb45dc2ec9506c-cywkhuyjto.chromatic.com/).

## Develop

- Clone the repo
- Install dependencies with `yarn install`
- Run the server with `yarn storybook`
- Visit [http://localhost:6006/](http://localhost:6006/)
- Write components and stories
npm package: @mindhive/di
Description: Super simple dependency injection
Latest version: 4.3.3

# Dependency injection

We have built our own super simple DI. 

## Install

`npm install @mindhive/di`

## Motivations and benefits

- Prefer pure functions
- Avoid ES6 imports as they are difficult to test
- Especially avoid Meteor package imports as most test runners don't understand Meteor's packaging
	(they can be accessed through Meteor globals but that's not a great idea either)
  	
## Lifecycle

1. Main file for the app should import all of it's modules using `initModules()` 

2. Modules should export a default function

	- For example: `export default () => { ...; return { serviceName: new Service(), ... } }`	
	- Return an object where the keys map service names to the service objects/functions to be 
		put into the app context
	- Modules further down thru the array passed to `initModules()` can use services added to the 
		appContext by earlier modules. The module function is passed the current appContext 
		(destructing works a treat), for example: 
		`export default ({ Meteor, Mongo }) => { ... }`
    - Modules don't have to return anything, you can use them to perform other initialization
    - Modules are called inside `Meteor.startup` so there is no need to manage that yourself

3. To access services in the appContext call `app()` to get the appContext

## Testing

In the example below `service` will be the only object in the appContext and available to any
code that calls `app()`. 

```javascript
import { mockAppContext } from '@mindhive/di'
const modules = () => ({ 
  service: { foo: sinon.spy() }  
}) 
it('should call service.foo()', 
  mockAppContext(modules, () => { 
    funcUnderTest()
    service.foo.should.have.been.calledOnce      	
  })
)
````

`modules` is a function so that the spys and dummy values used in it 
are recreated every test, avoiding any contamination to the next test.

However, if your test runner doesn't teardown the tests properly it 
may be necessary to use `resetAppContext`. 

You can also use `initModules` within the 'modules' function, it operates
exactly as it would in production code.
npm package: @mindhive/forms
Description: Simple, flexable, extendable form management
Author: Nick Virtue
Latest version: 0.0.1-2

##Simple to use form handling 

###Setup

In your app `src/modules/index.js`:

```javascript
import initModules from '@mindhive/App'
import xxxxFormModule from '@mindhive/Form/providers/xxxForm'

initModules([
  xxxFormModule,
])
```
Current providers:
* reduxForm
* ... easy to add more

###Usage
In your `SomeForm.jsx`:

```javascript
import Form from '@mindhive/Form'
import TextField from '@mindhive/Form/TextField'

...

<Form {...formProps}>
    <TextField
      name="name"
      label="Full Name"
      autoFocus
      required
    />
    <TextField
      name="email"
      email
      required
    />
</Form>
```

####Required properties for `<Form>`:
    
 ```
onSubmit:       (fields) => Promise     -- called with form values when user submits 
onCancel:       () => Promise           -- called when user cancels
initialValues:  {name: ..., email: ...} -- initial value for all fields, match 'name' attrib on fields
form:           'some-unique-key'       -- used internally
formId:         <form id={formId}>      -- optional
isNew:          is this a new entry, changes validation behavior
```   

####Things to note on `<TextField>`:
* `required` adds required validator
* `email` adds email validator and `type="email"`
* If no label, label is `name` with first cap: `name="email"` label is `Email`

* See `UserEdit` for a full example
npm package: @mindhive/meteor
Description: Our standard additions to Meteor
Latest version: 25.0.6


# Mindhive's base Meteor package

## Install

1. `npm install --save @mindhive/meteor`
2. `meteor add meteorhacks:unblock`

### Meteor package peer dependencies (optional)

1. `FocusedView`: `meteor add ejson`
2. `backdoorModule`: `meteor add xolvio:backdoor`
3. `SimpleSchema`: `meteor add aldeed:collection2-core`
4. `apiRegistry.publishComposite`: `meteor add reywood:publish-composite`
5. client `timeModule`: `meteor add mizzao:timesync` (optional, will default to local machine time otherwise)
6. `hasRole`: `meteor add alanning:roles`
7. `offlineModule`: `meteor add ground:db@2.0.0-rc.7`
8. `appMarketStore`: `meteor add cordova:cordova-plugin-device`,  
 	`meteor add cordova:cordova-plugin-appinfo` and
 	`meteor add cordova:cordova-plugin-market`

## How to use this
 
- See our [example webapp](https://github.com/mindhivenz/todos-basis-webapp)

## Dependency injection 

See our [DI package](https://github.com/mindhivenz/di-js).

This package also makes Meteor core services available in the appContext:
 
- `Meteor`
- `Mongo`: Meteor's Mongo, or in testing it is our own `TestMongo` (see below)
- `Accounts`: with appropriate internal data reset each test
- `Random`
- `EJSON`
- `Users`: Meteor's 'users' Mongo collection (`TestMongo` in testing)
- `apiRegistry`: see below

...and only on the client:

- `Tracker`: like Meteor's Tracker but will react to both Meteor *and Mobx* reactive changes
- `api`: how to call methods on the server 
- `storage`: HTML5 localStorage
- `mongoMirror`: high level mirroring of publications to Mobx domains and offline

## ApiRegistry

Rather than calling `Meteor.methods` and `Meteor.publish` to create methods and publications
inject `apiRegistry`. This has a cleaner callback (no use of `this`), calls 
[unblock](https://github.com/meteorhacks/unblock), and facilitates domain testing (see below).

## TestMongo

Uses in memory MiniMongo instead of real Mongo collections to increase test speed.
 But this can be override with `withRealMongoCollection` for cases where you need
 to use functions not available in MiniMongo. 

## Domain tests

An [example domain test](https://github.com/mindhivenz/todos-basis-webapp/blob/master/tests/specs/domain/tasks.spec.js).

- Use `mockServerContext` of `@mindhvie/meteor/test` to initialise modules in test
	- Most likely you'll want to import and pass `@mindhvie/meteor/test/mockMeteorCoreModuleFactory`
	  as the first module into `mockServerContext`
	- This also sets up a fiber so Meteor code can be run in your tests  
- From the returned context get the mock `apiRegistry` which can `call` and `subscribe` to methods and publications
  in the modules being tested
npm package: @mindhive/meteor-react-algoliasearch
Description: A react component for algolia autocomplete
Latest version: 2.0.0

# react-algoliasearch

A simple react component to integrate the Algolia search engine in your application.
You can configure your Algolia indices, app Id and api Key by passing props to the component.



## Installation

`npm install react-algoliasearch --save`

## Example

```js
import AgAutocomplete from 'react-algoliasearch'
  ...

  render() {
    return (
      <div>
        <AgAutocomplete
          apiKey={"6be0576ff61c053d5f9a3225e2a90f76"}
          appId={"latency"}
          displayKey="name"
          indices={[{index: 'contacts'}]}
          inputId="input-search"
          placeholder="Search..."
        />
      </div>
    )
}
```

## Props

- `appId` - Your algoliasearch app ID. (required)
- `apiKey` - Your algoliasearch api key. (required)
- `currentLanguage` - If using a multilanguage dataset, pass your current language through this prop. (optional)
- `displayKey` - For a given suggestion object, determines the string representation of it. This will be used when setting the value of the input control after a suggestion is selected.
Can be either a key string or a function that transforms a suggestion object into a string. Defaults to value. (optional)
- `keyName` - The key contained in your Algolia Dataset that you would like to use as result, default is `name`. (optional)
- `indices` - Array of Algolia indices you want to connect. (required)
- `inputId` - The Id of the generated input field. (required)
- `placeholder` - The input's placeholder. (optional)
- `hitsPerPage` - The number of results that your search will produce. Default is 10. (optional)
- `defaultValue` - The input's initial value will be set to the value of this prop. (optional)
- `options` - Pass any other [autocomplete.js](https://github.com/algolia/autocomplete.js) option through this object prop. (optional)

Any other React prop can be passed through `otherProps`

### Custom Events Props

- `opened` – Triggered when the dropdown menu of the autocomplete is opened. (optional)
- `shown` – Triggered when the dropdown menu of the autocomplete is shown (opened and non-empty). (optional)
- `closed` – Triggered when the dropdown menu of the autocomplete is closed. (optional)
- `updated` – Triggered when a dataset is rendered. (optional)
- `cursorchanged` – Triggered when the dropdown menu cursor is moved to a different suggestion. The event handler will be invoked with 3 arguments: the event object, the suggestion object, and the name of the dataset the suggestion belongs to. (optional)
- `selected` – Triggered when a suggestion from the dropdown menu is selected. The event handler will be invoked with 3 arguments: the event object, the suggestion object, and the name of the dataset the suggestion belongs to. (optional)
- `autocompleted` – Triggered when the query is autocompleted. Autocompleted means the query was changed to the hint. The event handler will be invoked with 3 arguments: the event object, the suggestion object, and the name of the dataset the suggestion belongs to. (optional)
npm package: @mindhive/meteor-react-instantsearch
Description: ⚡ Lightning-fast search for React and React Native apps, by Algolia
Author: Algolia, Inc.
Latest version: 4.2.0
Deprecated: false

# react-instantsearch

This is the [React](https://facebook.github.io/react/) version of
Algolia's `instantsearch` library.

Go to the [React InstantSearch website](https://community.algolia.com/react-instantsearch/) for more information.
npm package: @mindhive/module-sandbox
Description: ###Setup
Author: Nick Virtue
Latest version: 0.0.2-0

##Simple to use form handling 

###Setup

In your app `src/modules/index.js`:

```javascript
import initModules from '@mindhive/App'
import xxxxFormModule from '@mindhive/Form/providers/xxxForm'

initModules([
  xxxFormModule,
])
```
Current providers:
* reduxForm
* ... easy to add more

###Usage
In your `SomeForm.jsx`:

```javascript
import Form from '@mindhive/Form'
import TextField from '@mindhive/Form/TextField'

...

<Form {...formProps}>
    <TextField
      name="name"
      label="Full Name"
      autoFocus
      required
    />
    <TextField
      name="email"
      email
      required
    />
</Form>
```

####Required properties for `<Form>`:
    
 ```
onSubmit:       (fields) => Promise     -- called with form values when user submits 
onCancel:       () => Promise           -- called when user cancels
initialValues:  {name: ..., email: ...} -- initial value for all fields, match 'name' attrib on fields
form:           'some-unique-key'       -- used internally
formId:         <form id={formId}>      -- optional
isNew:          is this a new entry, changes validation behavior
```   

####Things to note on `<TextField>`:
* `required` adds required validator
* `email` adds email validator and `type="email"`
* If no label, label is `name` with first cap: `name="email"` label is `Email`

* See `UserEdit` for a full example
npm package: @mindhive/some
Description: Elegant language for test data
Latest version: 4.1.2

# Some

> Elegant language for test data

The code in each spec / test should be about conveying as elegantly as possibly
what the test is trying to prove. But what to do when you need to pass a value
in a test but that value has no meaning.
  
For example:

```javascript
const expected = true;
const actual = returnParam(expected);
actual.should.equal(expected);
```

Someone reading the test could ask "Is the value `true` important? Does `returnParam`
only work with the value `true`? Do non-boolean values work as well?". We could add
more tests to answer these questions but then the meaning of this test would be lost
amongst the noise of repetition.

This is where `some` comes in:

```javascript
const expected = some.bool();
const actual = returnParam(expected);
actual.should.equal(expected);
```

Now we make plain that the value itself is not important, and that we are explicitly
testing booleans. This is also more rigorous than passing a fixed value because over
multiple test runs both true and false will be tested.

`bool()` is just one of many functions in this package for producing test values.
See [`index.ts`](https://github.com/mindhivenz/some-js/blob/master/src/index.ts) for the complete list.

### Unique namespace

Sometimes you want values that aren't important, but are unique from each other.
For that there are various functions in the `unique` namespace.

For example:

```js
const obj = {};
obj[some.unique.string()] = some.primitive();
obj[some.unique.string()] = some.primitive();
Object.keys(obj).should.have.length(2);
```
npm package: @mindhive/wallaby-meteor-config
Description: Wallaby setup for our standard Meteor project layout
Latest version: 2.0.0

# Wallaby Meteor config

## Install

1. In the root of the project: `yarn add --dev @mindhive/wallaby-meteor-config`
2. Create `wallaby.js` in the root of the project something like the example below
3. Setup a IDEA Wallaby run configuration using `wallaby.js`

## Example wallaby.js

````js
module.exports = require('@mindhive/wallaby-meteor-config')({
  meteorPort: 3000,
  mongoUrl: 'mongodb://127.0.0.1:27017/project-wallaby',
})
````

Additional options can be seen at the top of [index.js](https://github.com/mindhivenz/wallaby-meteor-config/blob/master/index.js).

## Required project layout

- `src`
  - `.specs` (make sue `!.specs` is in your `.eslintignore`)
  - `imports`
  - `.meteor` (if you have multiple Meteor projects using this one source dir, 
  		symlink one to this to load Meteor packages from)
  - `.babelrc`

Test files match `*.spec.js/jsx` and can be under `.specs` or `imports`.

## Babel

If the project root has a `.babelrc` file then this is used. Otherwise:

This Wallaby setup uses Meteor's standard Babel setup supplemented with 
your app's `.babelrc` file (if it exists in `src`). This replicates 
Meteor's standard behaviour.