mise 3.0.0 → 2026.6.0

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,82 +1,217 @@
1
- # Mise (_en place_)
2
-
3
- [![Build Status](https://travis-ci.org/blueseph/mise.svg?branch=develop)](https://travis-ci.org/blueseph/mise) [![codebeat badge](https://codebeat.co/badges/e3012ee9-f823-423a-a40b-ca759768952c)](https://codebeat.co/projects/github-com-blueseph-mise-develop) [![codecov](https://codecov.io/gh/blueseph/mise/branch/develop/graph/badge.svg)](https://codecov.io/gh/blueseph/mise)
4
-
5
-
6
-
7
- [Mise](https://en.wikipedia.org/wiki/Mise_en_place) is a fully-featured front-end application library with built-in state management. Mise uses component-based architecture to promote [constructing elegant hierarchies for maximum code reuse and extensibility](http://siliconvalleyism.com/silicon-valley-quote.php?id=206). By explicitly manipulating your state _only_ via actions, code paths are clearly defined and change in predictable ways. Applications lend themselves to being highly and rigorously testable.
8
-
9
- Mise has zero dependencies and strives for performance.
10
-
11
- * VDOM managed updates for fast, efficient rendering rendering.
12
- * Easy state management.
13
- * Highly testable.
14
- * Asynchronous rendering.
15
- * Small file size (4.6kb minified, 1478 bytes gzipped).
16
-
17
- #### Installation
18
- ```
19
- npm i mise
20
- ```
21
-
22
- In your actual project
23
-
24
- ```javascript
25
- import { dom, component } from 'mise';
26
- ```
27
-
28
- Or, if you prefer to use umd
29
-
30
- ```javascript
31
- <script async src="https://unpkg.com/mise"></script>
32
- <script type="javascript">
33
- const { dom, component } = mise;
34
- </script>
35
- ```
36
-
37
- Mise doesn't require compilation to run, but you won't be able to use JSX until you do.
38
-
39
- ##### Example
40
- ```javascript
41
- /** @jsx dom */
42
-
43
- import { dom, component } from 'mise';
44
-
45
- component({
46
- template: state => actions => (
47
- <div>
48
- <span>{state.counter}</span>
49
- <button onclick={actions.increment}>+</button>
50
- <button onclick={actions.decrement}>-</button>
51
- </div>
52
- ),
53
- state: {
54
- counter: 0,
55
- },
56
- actions: {
57
- increment: state => ({ counter: state.counter + 1 }),
58
- decrement: state => ({ counter: state.counter - 1 }),
59
- },
60
- root: document.querySelector('#app'),
61
- });
62
- ```
63
-
64
- ### FAQs
65
-
66
- **Do I have to use `/** @jsx dom */` on every file?**
67
-
68
- You can add the the `transform-react-jsx` plugin to your webpack config.
69
-
70
- ```javascript
71
- {
72
- "plugins": {
73
- [
74
- "transform-react-jsx", {
75
- "pragma": "dom",
76
- }
77
- ]
78
- }
79
- }
80
- ```
81
-
82
- You'll still have to `import dom` just like you would `import React`, though.
1
+ <div align="center">
2
+
3
+ <h1 align="center">
4
+ <a href="https://mise.en.dev">
5
+ <picture>
6
+ <source media="(prefers-color-scheme: dark)" srcset="docs/public/logo-dark.svg" />
7
+ <img src="docs/public/logo-light.svg" alt="mise" width="256" height="256" />
8
+ </picture>
9
+ <br>
10
+ mise-en-place
11
+ </a>
12
+ </h1>
13
+
14
+ <p>
15
+ <a href="https://crates.io/crates/mise"><img alt="Crates.io" src="https://img.shields.io/crates/v/mise?style=for-the-badge&color=8B2252"></a>
16
+ <a href="https://github.com/jdx/mise/blob/main/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/jdx/mise?style=for-the-badge&color=6B7F4E"></a>
17
+ <a href="https://github.com/jdx/mise/actions/workflows/test.yml"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/jdx/mise/test.yml?style=for-the-badge&color=C5975B"></a>
18
+ <a href="https://discord.gg/mABnUDvP57"><img alt="Discord" src="https://img.shields.io/discord/1066429325269794907?style=for-the-badge&color=8B2252"></a>
19
+ </p>
20
+
21
+ <p><b>Dev tools, env vars, and tasks in one CLI</b></p>
22
+
23
+ <p align="center">
24
+ <a href="https://mise.en.dev/getting-started.html">Getting Started</a> •
25
+ <a href="https://mise.en.dev">Documentation</a>
26
+ <a href="https://mise.en.dev/dev-tools/">Dev Tools</a> •
27
+ <a href="https://mise.en.dev/environments/">Environments</a> •
28
+ <a href="https://mise.en.dev/tasks/">Tasks</a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ Sponsored by <a href="https://37signals.com">37signals</a>.
33
+ </p>
34
+
35
+ <hr />
36
+
37
+ </div>
38
+
39
+ > [!TIP]
40
+ > My latest project, [aube](https://aube.en.dev) just hit stable! It's the fastest Node.js package manager with strong security defaults and is compatible with npm/pnpm/yarn lockfiles!
41
+
42
+ ## What is it?
43
+
44
+ `mise` prepares your development environment before each command runs. It keeps
45
+ project tools, environment variables, and tasks in one `mise.toml` file so new
46
+ shells, checkouts, and CI jobs all start from the same setup.
47
+
48
+ - Install and switch between [dev tools](https://mise.en.dev/dev-tools/) like node, python, cmake, terraform, and [hundreds more](https://mise.en.dev/registry.html).
49
+ - Load [environment variables](https://mise.en.dev/environments/) per project directory, including values from `.env` files and other sources.
50
+ - Define and run [tasks](https://mise.en.dev/tasks/) for building, testing, linting, and deploying projects.
51
+
52
+ ## Demo
53
+
54
+ The following demo shows how to install and use `mise` to manage multiple versions of `node` on the same system.
55
+ Note that calling `which node` gives us a real path to node, not a shim.
56
+
57
+ It also shows that you can use `mise` to install and many other tools such as `jq`, `terraform`, or `go`.
58
+
59
+ [![demo](./docs/tapes/demo.gif)](https://mise.en.dev/demo.html)
60
+
61
+ See [demo transcript](https://mise.en.dev/demo.html).
62
+
63
+ ## Quickstart
64
+
65
+ ### Install mise
66
+
67
+ See [Getting started](https://mise.en.dev/getting-started.html) for more options.
68
+
69
+ ```sh-session
70
+ $ curl https://mise.run | sh
71
+ $ ~/.local/bin/mise --version
72
+ _ __
73
+ ____ ___ (_)_______ ___ ____ ____ / /___ _________
74
+ / __ `__ \/ / ___/ _ \______/ _ \/ __ \______/ __ \/ / __ `/ ___/ _ \
75
+ / / / / / / (__ ) __/_____/ __/ / / /_____/ /_/ / / /_/ / /__/ __/
76
+ /_/ /_/ /_/_/____/\___/ \___/_/ /_/ / .___/_/\__,_/\___/\___/
77
+ /_/ by @jdx
78
+ 2026.6.0 macos-arm64 (2026-06-03)
79
+ ```
80
+
81
+ Hook mise into your shell (pick the right one for your shell):
82
+
83
+ ```sh-session
84
+ # note this assumes mise is located at ~/.local/bin/mise
85
+ # which is what https://mise.run does by default
86
+ echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
87
+ echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc
88
+ echo '~/.local/bin/mise activate fish | source' >> ~/.config/fish/config.fish
89
+ echo '~/.local/bin/mise activate pwsh | Out-String | Invoke-Expression' >> ~/.config/powershell/Microsoft.PowerShell_profile.ps1
90
+ ```
91
+
92
+ ### Execute commands with specific tools
93
+
94
+ ```sh-session
95
+ $ mise exec node@26 -- node -v
96
+ mise node@26.x.x ✓ installed
97
+ v26.x.x
98
+ ```
99
+
100
+ ### Install tools
101
+
102
+ ```sh-session
103
+ $ mise use --global node@26 go@1
104
+ $ node -v
105
+ v26.x.x
106
+ $ go version
107
+ go version go1.x.x macos/arm64
108
+ ```
109
+
110
+ See [dev tools](https://mise.en.dev/dev-tools/) for more examples.
111
+
112
+ ### Manage environment variables
113
+
114
+ ```toml
115
+ # mise.toml
116
+ [env]
117
+ SOME_VAR = "foo"
118
+ ```
119
+
120
+ ```sh-session
121
+ $ mise set SOME_VAR=bar
122
+ $ echo $SOME_VAR
123
+ bar
124
+ ```
125
+
126
+ Note that `mise` can also [load `.env` files](https://mise.en.dev/environments/#env-directives).
127
+
128
+ ### Run tasks
129
+
130
+ ```toml
131
+ # mise.toml
132
+ [tasks.build]
133
+ description = "build the project"
134
+ run = "echo building..."
135
+ ```
136
+
137
+ ```sh-session
138
+ $ mise run build
139
+ building...
140
+ ```
141
+
142
+ See [tasks](https://mise.en.dev/tasks/) for more information.
143
+
144
+ ### Example mise project
145
+
146
+ Here is a combined example to give you an idea of how you can use mise to manage your a project's tools, environment, and tasks.
147
+
148
+ ```toml
149
+ # mise.toml
150
+ [tools]
151
+ terraform = "1"
152
+ aws-cli = "2"
153
+
154
+ [env]
155
+ TF_WORKSPACE = "development"
156
+ AWS_REGION = "us-west-2"
157
+ AWS_PROFILE = "dev"
158
+
159
+ [tasks.plan]
160
+ description = "Run terraform plan with configured workspace"
161
+ run = """
162
+ terraform init
163
+ terraform workspace select $TF_WORKSPACE
164
+ terraform plan
165
+ """
166
+
167
+ [tasks.validate]
168
+ description = "Validate AWS credentials and terraform config"
169
+ run = """
170
+ aws sts get-caller-identity
171
+ terraform validate
172
+ """
173
+
174
+ [tasks.deploy]
175
+ description = "Deploy infrastructure after validation"
176
+ depends = ["validate", "plan"]
177
+ run = "terraform apply -auto-approve"
178
+ ```
179
+
180
+ Run it with:
181
+
182
+ ```sh-session
183
+ mise install # install tools specified in mise.toml
184
+ mise run deploy
185
+ ```
186
+
187
+ Find more examples in the [mise cookbook](https://mise.en.dev/mise-cookbook/).
188
+
189
+ ## Full Documentation
190
+
191
+ See [mise.en.dev](https://mise.en.dev)
192
+
193
+ ## GitHub Issues & Discussions
194
+
195
+ Due to the volume of issue submissions mise received, using GitHub Issues became unsustainable for
196
+ the project. Instead, mise uses GitHub Discussions which provide a more community-centric platform
197
+ for communication and require less management on the part of the maintainers.
198
+
199
+ Please note the following discussion categories, which match how issues are often used:
200
+
201
+ - [Announcements](https://github.com/jdx/mise/discussions/categories/announcements)
202
+ - [Ideas](https://github.com/jdx/mise/discussions/categories/ideas): for feature requests, etc.
203
+ - [Troubleshooting & Bug Reports](https://github.com/jdx/mise/discussions/categories/troubleshooting-and-bug-reports)
204
+
205
+ ## Special Thanks
206
+
207
+ <p>
208
+ <a href="https://namespace.so">
209
+ <img src="docs/public/namespace-logo.svg" alt="Namespace" width="64" height="64">
210
+ </a>
211
+ <br>
212
+ Thanks to <a href="https://namespace.so">Namespace</a> for providing CI services for mise.
213
+ </p>
214
+
215
+ ## Contributors
216
+
217
+ [![Contributors](https://contrib.rocks/image?repo=jdx/mise)](https://github.com/jdx/mise/graphs/contributors)
@@ -0,0 +1,57 @@
1
+ var spawn = require('child_process').spawn;
2
+ var path = require('path');
3
+ var fs = require('fs');
4
+
5
+ function installArchSpecificPackage(version) {
6
+
7
+ process.env.npm_config_global = 'false';
8
+
9
+ var platform = process.platform == 'win32' ? 'windows' : process.platform;
10
+ var arch = platform == 'windows' && process.arch == 'ia32' ? 'x86' : process.arch;
11
+
12
+ var cp = spawn(platform == 'windows' ? 'npm.cmd' : 'npm', ['install', '--no-save', ['@jdxcode/mise', platform, arch].join('-') + '@' + version], {
13
+ stdio: 'inherit',
14
+ shell: true
15
+ });
16
+
17
+ cp.on('close', function(code) {
18
+ var pkgJson = require.resolve(['@jdxcode/mise', platform, arch].join('-') + '/package.json');
19
+ var subpkg = JSON.parse(fs.readFileSync(pkgJson, 'utf8'));
20
+ var executable = subpkg.bin.mise;
21
+ var bin = path.resolve(path.dirname(pkgJson), executable);
22
+
23
+ try {
24
+ fs.mkdirSync(path.resolve(process.cwd(), 'bin'));
25
+ } catch (e) {
26
+ if (e.code != 'EEXIST') {
27
+ throw e;
28
+ }
29
+ }
30
+
31
+ linkSync(bin, path.resolve(process.cwd(), executable));
32
+
33
+ if (platform == 'windows') {
34
+ var pkg = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), 'package.json')));
35
+ fs.writeFileSync(path.resolve(process.cwd(), 'bin/mise'), 'This file intentionally left blank');
36
+ pkg.bin.mise = 'bin/mise.exe';
37
+ fs.writeFileSync(path.resolve(process.cwd(), 'package.json'), JSON.stringify(pkg, null, 2));
38
+ }
39
+
40
+ return process.exit(code);
41
+
42
+ });
43
+ }
44
+
45
+ function linkSync(src, dest) {
46
+ try {
47
+ fs.unlinkSync(dest);
48
+ } catch (e) {
49
+ if (e.code != 'ENOENT') {
50
+ throw e;
51
+ }
52
+ }
53
+ return fs.linkSync(src, dest);
54
+ }
55
+
56
+ const pjson = require('./package.json')
57
+ installArchSpecificPackage(pjson.version)
package/package.json CHANGED
@@ -1,49 +1,24 @@
1
- {
2
- "name": "mise",
3
- "version": "3.0.0",
4
- "description": "a small, no-frills library to build complex client-side applications and easily manage state",
5
- "main": "dist/mise.js",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/blueseph/mise.git"
9
- },
10
- "directories": {
11
- "example": "example"
12
- },
13
- "scripts": {
14
- "test": "jest --coverage --verbose",
15
- "test:watch": "jest --coverage --verbose --watch",
16
- "build": "webpack --optimize-minimize",
17
- "build:unoptimized": "webpack",
18
- "lint": "eslint ./src/",
19
- "lint:fix": "eslint --fix ./src/",
20
- "start": "npm run lint && npm run test && npm run build",
21
- "prepublish": "npm start"
22
- },
23
- "jest": {
24
- "coveragePathIgnorePatterns": [
25
- "/node_modules/",
26
- "/test/utils.js"
27
- ]
28
- },
29
- "author": "dan b.",
30
- "license": "MIT",
31
- "devDependencies": {
32
- "@types/jest": "^21.1.5",
33
- "awesome-typescript-loader": "^3.2.3",
34
- "babel-core": "^6.26.0",
35
- "babel-loader": "^7.1.2",
36
- "babel-plugin-transform-object-rest-spread": "^6.26.0",
37
- "babel-preset-env": "^1.6.1",
38
- "babel-preset-es2015": "^6.24.1",
39
- "eslint": "^4.10.0",
40
- "eslint-config-airbnb": "^16.1.0",
41
- "eslint-plugin-import": "^2.8.0",
42
- "eslint-plugin-jsx-a11y": "^6.0.2",
43
- "eslint-plugin-react": "^7.4.0",
44
- "jest": "^21.2.1",
45
- "typescript": "^2.5.3",
46
- "typescript-babel-jest": "^1.0.5",
47
- "webpack": "^3.8.1"
48
- }
49
- }
1
+ {
2
+ "name": "mise",
3
+ "description": "Dev tools, env vars, and tasks in one CLI",
4
+ "version": "2026.6.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/jdx/mise"
8
+ },
9
+ "files": [
10
+ "installArchSpecificPackage.js",
11
+ "README.md"
12
+ ],
13
+ "scripts": {
14
+ "prepack": "rm -rf bin",
15
+ "preinstall": "node installArchSpecificPackage.js"
16
+ },
17
+ "bin": {
18
+ "mise": "./bin/mise"
19
+ },
20
+ "license": "MIT",
21
+ "engines": {
22
+ "node": ">=5.0.0"
23
+ }
24
+ }
package/.babelrc DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "presets": [["es2015", { "modules": false }]],
3
- "env": {
4
- "test": {
5
- "presets": ["es2015"]
6
- }
7
- },
8
- "plugins": ["babel-plugin-transform-object-rest-spread"]
9
- }
package/.eslintrc.js DELETED
@@ -1,30 +0,0 @@
1
- module.exports = {
2
- "env": {
3
- "jest": true,
4
- "browser": true,
5
- "es6": true,
6
- "node": true
7
- },
8
- "extends": "airbnb",
9
- "rules": {
10
- "no-param-reassign": "off", /* sadly, we have to reassign params to deal with props */
11
- "import/prefer-default-export": "off", /* named exports allow for treeshaking */
12
- 'no-restricted-syntax': [ /* we're omitting for of loops for this. they're pretty neat! */
13
- 'error',
14
- {
15
- selector: 'ForInStatement',
16
- message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
17
- },
18
- {
19
- selector: 'LabeledStatement',
20
- message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
21
- },
22
- {
23
- selector: 'WithStatement',
24
- message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
25
- },
26
- ],
27
- "no-loop-func": "off", /* we create functions within a loop to close over our actions. this is intentional! */
28
- "linebreak-style": "off", /* we accept those of all line endings */
29
- }
30
- };
package/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: node_js
2
- dist: trusty
3
- sudo: required
4
- node_js: 8.8
5
- install:
6
- - npm install
7
- - npm install codecov
8
- script:
9
- - npm start
10
- after_success:
11
- - ./node_modules/.bin/codecov -e TRAVIS_NODE_VERSION -f coverage/lcov.info
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2017
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/changelist.md DELETED
@@ -1,24 +0,0 @@
1
- # 3.0.0 - Fiber
2
-
3
- Mise's architecture now supports asynchronous rendering. What's asynchronous rendering?
4
-
5
- #### The problem
6
-
7
- In VDOM implementations, there's two phases. There's the reconciliation phase where the VDOM engine figures out what changed, and the rendering phase where the DOM is changed to match what should exist.
8
-
9
- Browsers try and update themselves roughly every 16ms to achieve 60 fps. There's a little bit of housekeeping to be done, so you'd roughly get around 10ms to complete any work that needs to be done. Browsers are also single threaded. If you *don't* complete your work in the allotted timeframe, your framerate drops and there's a little bit of jank. Generally, a little jank isn't a problem.
10
-
11
- The problem lies in the fact that given a big enough template, Mise would *significantly* overrun its budget. Adding a thousand items would cause a tremendously noticeable amount of slowdown and it would feel as if the browser froze. Even though this is technically the fastest implementation, it felt slow.
12
-
13
- #### The solution
14
-
15
- Mise now splits the reconcilation phase and the rendering phase.
16
-
17
- Modern browsers provide a function that allows you to yield back the main thread to the browser every so often so that it gets to complete the work required to maintain 60 fps. By leveraging this API, Mise ensures that the reconcilation phase doesn't gobble up the main thread for too long.
18
-
19
- The rendering phase remains mostly unchanged. The browser itself provides an API to request an animation frame to render any changes.
20
-
21
- #### What does this mean to me?
22
-
23
- Mise now renders asyncronously. The first render for Mise used to be completely synchronous and would immediately be available for testing. The new architecture means you have to wait for the first render to occur. This likely means your tests will break. Your application will continue to work.
24
-
package/dist/mise.js DELETED
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("mise",[],t):"object"==typeof exports?exports.mise=t():e.mise=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={create:"CREATE",remove:"REMOVE",replace:"REPLACE",update:"UPDATE"},o=function(){return{children:[],empty:!0}},i=function(e){var t=e.parent,r=e.element,n=void 0===r?null:r,i=e.previous,a=void 0===i?o():i,u=e.next;return{parent:t,previous:{tree:a,element:n},next:{tree:void 0===u?o():u,element:null}}};t.create=i,t.types=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);Object.defineProperty(t,"component",{enumerable:!0,get:function(){return n.component}});var o=r(6);Object.defineProperty(t,"dom",{enumerable:!0,get:function(){return o.dom}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.component=void 0;var n=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(3),a=r(0),u=function(e){var t=e.template,r=e.state,u=e.actions,c=e.root,l=void 0===c?document.body:c,f=(0,i.reconciler)(),p=f.add,y=void 0,s=void 0,v=void 0,d=function(e){return function(r){var n=o({},e),i=o({},r);return t(n)(i)}},m=function(){var e=s;s=d(y)(v);var t=(0,a.create)({parent:l,element:l.childNodes[0],previous:e,next:s});p(t)},b=function(e){y=o({},y,e),m()},h=function(e){var t={},r=!0,o=!1,i=void 0;try{for(var a,u=Object.entries(e)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value,l=n(c,2),f=l[0],p=l[1];!function(e,r){t[e]=function(e){var t=r(y,v,e);"function"==typeof t?t(b):b(t)}}(f,p)}}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return t};!function(e){y=r,v=h(e),s=d(y)(v);var t=(0,a.create)({parent:l,next:s});p(t)}(u)};t.component=u},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function o(e){return Array.isArray(e)?e:Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.reconciler=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=r(0),u=r(4),c=function(){var e=!1,t=[],r=[],c=function(){var e=t,r=o(e),n=r[0],i=r.slice(1);return t=i,n},l=function(e,t){return(void 0===e?"undefined":i(e))!==(void 0===t?"undefined":i(t))||"string"==typeof e&&e!==t||e.type!==t.type},f=function(e){var t=e.previous.tree&&e.previous.tree.children||[],r=e.next.tree&&e.next.tree.children||[],n=Math.max(t.length,r.length);if(e.previous.element)for(var o=0;o<n;o+=1){var i=(0,a.create)({parent:e.previous.element,element:e.previous.element&&e.previous.element.childNodes[o]||null,previous:t[o],next:r[o]});v(i)}},p=function(e){return f(e),!e.previous.tree||e.previous.tree.empty?(e.action=a.types.create,e.next.element=(0,u.createElement)(e.next.tree),e.next.tree.props&&e.next.tree.props.oncreate&&(e.lifecycle=e.next.tree.props.oncreate),e):!e.next.tree||e.next.tree.empty?(e.action=a.types.remove,e.previous.tree.props&&e.previous.tree.props.onremove&&(e.lifecycle=e.previous.tree.props.onremove),e):l(e.previous.tree,e.next.tree)?(e.action=a.types.replace,e.next.element=(0,u.createElement)(e.next.tree),e.next.tree.props&&e.next.tree.props.onupdate&&(e.lifecycle=e.next.tree.props.onupdate),e):(e.action=a.types.update,e.next.tree.props&&e.next.tree.props.onupdate&&(e.lifecycle=e.next.tree.props.onupdate),e)},y=function(e){for(;e.timeRemaining()&&t.length;){var o=p(c());r=[].concat(n(r),[o])}},s=function n(o){if(y(o),t.length)requestIdleCallback(n);else{e=!1;var i=u.paint.bind(null,r);requestAnimationFrame(i),r=[]}},v=function(r){t=[].concat(n(t),[r]),e||(e=!0,requestIdleCallback(s))};return{add:v}};t.reconciler=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createElement=t.paint=void 0;var n=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(5),a=r(0),u=function(e,t,r,n){if("value"===t)return void(e[t]=n);if("boolean"==typeof n)return void(n&&(e.setAttribute(t,n),e[t]=n));if("function"!=typeof n){if(!n||"object"===(void 0===n?"undefined":o(n))&&!Object.keys(n).length)return void e.removeAttribute(t);if("style"!==t)e.setAttribute(t,n);else{var a=(0,i.getUniques)(n,r),u=!0,c=!1,l=void 0;try{for(var f,p=a[Symbol.iterator]();!(u=(f=p.next()).done);u=!0){var y=f.value;n[y]?r&&r[y]&&r[y]===n[y]||(e.style[y]=n[y]):e.style[y]=""}}catch(e){c=!0,l=e}finally{try{!u&&p.return&&p.return()}finally{if(c)throw l}}}}else try{e[t]=n}catch(e){}},c=function(e,t){var r=!0,o=!1,i=void 0;try{for(var a,c=Object.entries(t)[Symbol.iterator]();!(r=(a=c.next()).done);r=!0){var l=a.value,f=n(l,2),p=f[0],y=f[1];u(e,p,{},y)}}catch(e){o=!0,i=e}finally{try{!r&&c.return&&c.return()}finally{if(o)throw i}}},l=function e(t){if("string"==typeof t)return document.createTextNode(t);var r=t.type,n=t.props,o=t.children,i=document.createElement(r);return c(i,n),o.map(e).forEach(function(e){return i.appendChild(e)}),i},f=function(e,t,r){var n=(0,i.getUniques)(t,r),o=!0,a=!1,c=void 0;try{for(var l,f=n[Symbol.iterator]();!(o=(l=f.next()).done);o=!0){var p=l.value;u(e,p,t[p],r[p])}}catch(e){a=!0,c=e}finally{try{!o&&f.return&&f.return()}finally{if(a)throw c}}},p=function(e){var t=!0,r=!1,n=void 0;try{for(var o,i=e[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var u=o.value,c=u.action,l=u.next,p=u.previous,y=u.lifecycle,s=u.parent;switch(c){case a.types.create:s.appendChild(l.element),y&&y(l.element);break;case a.types.remove:y?y(l.element)(p.element.remove.bind(p.element)):p.element.remove();break;case a.types.replace:y&&y(l.element)(p.props),s.replaceChild(l.element,p.element);break;case a.types.update:y&&y(l.element)(p.props),f(p.element,p.tree.props,l.tree.props);break;default:return}}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}};t.paint=p,t.createElement=l},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(e,t){return new Set([].concat(n(Object.keys(e||{})),n(Object.keys(t||{}))))};t.getUniques=o},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){for(var t=arguments.length,r=Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=[],u=i,c=!0,l=!1,f=void 0;try{for(var p,y=r[Symbol.iterator]();!(c=(p=y.next()).done);c=!0){var s=p.value;a=Array.isArray(s)?[].concat(n(a),n(s)):[].concat(n(a),["number"==typeof s?String(s):s])}}catch(e){l=!0,f=e}finally{try{!c&&y.return&&y.return()}finally{if(l)throw f}}return null===i&&(u={}),u.className&&(u.class=u.className,u.className=void 0),"function"==typeof e?e(u,a):{type:e,props:u,children:a}};t.dom=o}])});
package/docs/actions.md DELETED
@@ -1,96 +0,0 @@
1
- # Actions
2
-
3
- Actions are how you generate change in Mise. By triggering an action, you modify the state and create a new template.
4
-
5
- ```javascript
6
- const actions = {
7
- increment: state => ({ state.counter + 1 }),
8
- decrement: state => ({ state.counter - 1 }),
9
- };
10
-
11
- ```
12
- #### State can only be modified by actions.
13
-
14
- If you intend to modify the state, this needs to be done via an action. The above example
15
-
16
- #### Actions can call other actions.
17
-
18
- ```javascript
19
- const actions = {
20
- clearInput = state => ({ input: '' }),
21
- submit = (state, actions) => {
22
- const todo = { text: state.input };
23
- actions.clearInput();
24
-
25
- return { todos : [ ...state.todos, todo ] };
26
- };
27
- }
28
- ```
29
-
30
- #### Actions can take additional parameters.
31
-
32
- ```javascript
33
- import { dom, component } from 'mise';
34
-
35
- component({
36
- template: state => actions => (
37
- <div onclick={e => actions.eventHandler(e)}>
38
- click me!
39
- </div>
40
- ),
41
- state:
42
- //...
43
- actions: {
44
- eventHandler = (state, actions, event) => {
45
- if (e.button === 2) {
46
- // ...
47
- }
48
- }
49
- })
50
- ```
51
-
52
- #### Actions can provide thunks
53
- > A thunk is a function that encapsulates synchronous or asynchronous code
54
-
55
- Thunks allow developers a little leeway into *when* an application should re-render. You can delay a re-render until a certain condition is met via thunks
56
-
57
- ``` javascript
58
- const actions = {
59
- getAlerts: (state, actions) => async update => {
60
- await data = actions.fetchAlerts(state.alertValue);
61
-
62
- if (data.shouldUpdate)
63
- update({ alerts: data.alerts });
64
- };
65
- }
66
- ```
67
-
68
- #### Testing
69
-
70
- Testing actions is very straightforward. All actions should strive to be pure functions.
71
-
72
- ```javascript
73
- import { actions } from './todos.actions';
74
-
75
- let state = {};
76
- beforeEach(
77
- state = {};
78
- )
79
-
80
- describe('todo actions', () => {
81
- it('should add the input to a todo', () => {
82
- const input = 'hello world!';
83
- expect(actions.addInput(state, actions, input)).toEqual({
84
- input,
85
- })
86
- });
87
-
88
- it ('should remove all todos', () => {
89
- state.todos = [{ id: 1, text: 'hello, world', } { id: 2, text: 'goodbye, world' }];
90
-
91
- expect(actions.removeTodos(state, actions)).toEqual({
92
- todos: [],
93
- });
94
- })
95
- })
96
- ```