@muze-labs/simplyflow 0.9.0 → 0.10.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 +72 -16
- package/dist/simply.flow.js +458 -298
- package/dist/simply.flow.min.js +1 -1
- package/dist/simply.flow.min.js.map +4 -4
- package/package.json +29 -42
- package/src/action.mjs +1 -64
- package/src/app.mjs +1 -282
- package/src/behavior.mjs +1 -121
- package/src/bind-render.mjs +1 -0
- package/src/bind-transformers.mjs +1 -0
- package/src/bind.mjs +1 -522
- package/src/command.mjs +1 -225
- package/src/dom.mjs +1 -274
- package/src/highlight.mjs +1 -11
- package/src/include.mjs +1 -239
- package/src/{flow.mjs → index.mjs} +13 -13
- package/src/model.mjs +1 -290
- package/src/path.mjs +1 -47
- package/src/route.mjs +1 -418
- package/src/shortcut.mjs +1 -146
- package/src/state.mjs +1 -1347
- package/src/suggest.mjs +1 -68
- package/src/symbols.mjs +1 -9
- package/MUZE_ALIGNMENT.md +0 -118
- package/src/bind.render.mjs +0 -694
- package/src/bind.transformers.mjs +0 -25
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ SimplyFlow is an experimental browser library for building small reactive web ap
|
|
|
5
5
|
The intended beginner-facing API is:
|
|
6
6
|
|
|
7
7
|
```javascript
|
|
8
|
-
import { app } from 'simplyflow
|
|
8
|
+
import { app } from '@muze-labs/simplyflow'
|
|
9
9
|
|
|
10
10
|
const counter = app({
|
|
11
11
|
container: document.getElementById('counter'),
|
|
@@ -108,19 +108,19 @@ const notes = simply.app({
|
|
|
108
108
|
## Install
|
|
109
109
|
|
|
110
110
|
```shell
|
|
111
|
-
npm install simplyflow
|
|
111
|
+
npm install @muze-labs/simplyflow
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
or using Git:
|
|
115
115
|
|
|
116
116
|
```shell
|
|
117
|
-
git clone https://github.com/
|
|
117
|
+
git clone https://github.com/muze-labs/simplyflow.git
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
## Browser bundle
|
|
121
121
|
|
|
122
122
|
```html
|
|
123
|
-
<script src="https://cdn.jsdelivr.net/npm/simplyflow/dist/simply.flow.js"></script>
|
|
123
|
+
<script src="https://cdn.jsdelivr.net/npm/@muze-labs/simplyflow/dist/simply.flow.js"></script>
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
Then use the beginner-facing `simply.app()` API:
|
|
@@ -159,32 +159,88 @@ const page = simply.app({
|
|
|
159
159
|
})
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
+
|
|
163
|
+
For no-build module examples that use an import map, prefer mapping the complete browser bundle instead of every split workspace package:
|
|
164
|
+
|
|
165
|
+
```html
|
|
166
|
+
<script type="importmap">
|
|
167
|
+
{
|
|
168
|
+
"imports": {
|
|
169
|
+
"@muze-labs/simplyflow": "https://cdn.jsdelivr.net/npm/@muze-labs/simplyflow/dist/simply.flow.js",
|
|
170
|
+
"@muze-nl/metro": "https://cdn.jsdelivr.net/npm/@muze-nl/metro@0.6.19/src/everything.mjs"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
</script>
|
|
174
|
+
<script type="module">
|
|
175
|
+
import '@muze-labs/simplyflow'
|
|
176
|
+
import '@muze-nl/metro'
|
|
177
|
+
|
|
178
|
+
const hnpwa = simply.app({
|
|
179
|
+
data: { items: [] }
|
|
180
|
+
})
|
|
181
|
+
</script>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
This is the recommended beginner/example path: import the complete SimplyFlow bundle, plus any external library the example directly uses. Advanced users can still use the split packages or subpath imports below when they want smaller, tree-shakeable bundles with a build step.
|
|
185
|
+
|
|
162
186
|
Module imports are still available when you prefer explicit imports:
|
|
163
187
|
|
|
164
188
|
```javascript
|
|
165
|
-
import { signal, effect, batch } from 'simplyflow/
|
|
166
|
-
import { bind } from 'simplyflow/
|
|
167
|
-
import { model, paging, sort, filter, columns } from 'simplyflow/
|
|
189
|
+
import { signal, effect, batch } from '@muze-labs/simplyflow/state'
|
|
190
|
+
import { bind } from '@muze-labs/simplyflow/bind'
|
|
191
|
+
import { model, paging, sort, filter, columns } from '@muze-labs/simplyflow/model'
|
|
168
192
|
|
|
169
193
|
const data = signal({ title: 'Hello' })
|
|
170
194
|
bind({ root: data })
|
|
171
195
|
```
|
|
172
196
|
|
|
197
|
+
## Package structure and tree-shakeable imports
|
|
198
|
+
|
|
199
|
+
SimplyFlow is maintained as a small monorepo. The main `@muze-labs/simplyflow` package is a convenience package for beginners and script-tag users. The implementation is split into smaller ESM packages that can also be imported directly:
|
|
200
|
+
|
|
201
|
+
```javascript
|
|
202
|
+
import { signal, effect } from '@muze-labs/simplyflow-state'
|
|
203
|
+
import { bind } from '@muze-labs/simplyflow-bind'
|
|
204
|
+
import { model } from '@muze-labs/simplyflow-model'
|
|
205
|
+
import { app } from '@muze-labs/simplyflow-app'
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
For projects that prefer one dependency, the main package keeps stable subpath exports:
|
|
209
|
+
|
|
210
|
+
```javascript
|
|
211
|
+
import { signal, effect } from '@muze-labs/simplyflow/state'
|
|
212
|
+
import { bind } from '@muze-labs/simplyflow/bind'
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
The `state`, `bind`, `model`, and `app` packages are pure ESM and marked as side-effect-free so bundlers can tree-shake unused exports. The main `@muze-labs/simplyflow` entry point still intentionally initializes the browser global API and registers `<simply-render>`, so use subpath or direct package imports when minimum bundle size matters.
|
|
216
|
+
|
|
173
217
|
|
|
174
218
|
## Documentation
|
|
175
219
|
|
|
176
|
-
- [App API](docs/app.md)
|
|
177
|
-
- [Binding API](docs/bind.md)
|
|
178
|
-
- [Model API](docs/model.md)
|
|
179
|
-
- [State API](docs/state.md)
|
|
180
|
-
- [Commands](docs/command.md)
|
|
181
|
-
- [Actions](docs/action.md)
|
|
182
|
-
- [Routes](docs/route.md)
|
|
183
|
-
- [Behaviors](docs/behavior.md)
|
|
184
|
-
- [Includes](docs/include.md)
|
|
220
|
+
- [App API](docs/reference/app.md)
|
|
221
|
+
- [Binding API](docs/reference/bind.md)
|
|
222
|
+
- [Model API](docs/reference/model.md)
|
|
223
|
+
- [State API](docs/reference/state.md)
|
|
224
|
+
- [Commands](docs/reference/command.md)
|
|
225
|
+
- [Actions](docs/reference/action.md)
|
|
226
|
+
- [Routes](docs/reference/route.md)
|
|
227
|
+
- [Behaviors](docs/reference/behavior.md)
|
|
228
|
+
- [Includes](docs/reference/include.md)
|
|
185
229
|
|
|
186
230
|
Or check the [examples](examples/) for more information.
|
|
187
231
|
|
|
232
|
+
## Development
|
|
233
|
+
|
|
234
|
+
This repository is a private npm workspace root. The published main package lives in `packages/simplyflow`; the smaller layer packages live in `packages/state`, `packages/bind`, `packages/model`, and `packages/app`.
|
|
235
|
+
|
|
236
|
+
```shell
|
|
237
|
+
npm install
|
|
238
|
+
npm test
|
|
239
|
+
npm run build
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
When publishing the split packages, publish the dependency packages first (`state`, then `bind`/`model`, then `app`, then `simplyflow`) so the main package can resolve its package dependencies.
|
|
243
|
+
|
|
188
244
|
## License
|
|
189
245
|
|
|
190
246
|
[MIT](LICENSE) © Muze.nl
|