@stonecrop/stonecrop 0.2.5
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/dist/stonecrop.js +5319 -0
- package/dist/stonecrop.umd.cjs +5322 -0
- package/package.json +53 -0
- package/readme.md +62 -0
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stonecrop/stonecrop",
|
|
3
|
+
"version": "0.2.5",
|
|
4
|
+
"description": "schema helper",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/stonecrop.js",
|
|
10
|
+
"require": "./dist/stonecrop.umd.cjs"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"main": "dist/stonecrop.js",
|
|
14
|
+
"module": "dist/stonecrop.js",
|
|
15
|
+
"types": "src/index",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/*",
|
|
18
|
+
"src/**/*.vue"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@vueuse/core": "^9.13.0",
|
|
22
|
+
"immutable": "^4.3.0",
|
|
23
|
+
"pinia": "^2.0.32",
|
|
24
|
+
"pinia-shared-state": "^0.3.0",
|
|
25
|
+
"pinia-undo": "^0.1.9",
|
|
26
|
+
"pinia-xstate": "^1.0.9",
|
|
27
|
+
"vue": "^3.2.47",
|
|
28
|
+
"vue-router": "^4",
|
|
29
|
+
"xstate": "~4.37.2"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
33
|
+
"@typescript-eslint/parser": "^5.59.5",
|
|
34
|
+
"@vitejs/plugin-vue": "^4.2.1",
|
|
35
|
+
"eslint": "^8.40.0",
|
|
36
|
+
"eslint-config-prettier": "^8.8.0",
|
|
37
|
+
"eslint-plugin-vue": "^9.11.1",
|
|
38
|
+
"typescript": "^5.0.4",
|
|
39
|
+
"vite": "^4.3.5",
|
|
40
|
+
"@stonecrop/aform": "0.2.5",
|
|
41
|
+
"@stonecrop/atable": "0.2.5"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=20.11.0"
|
|
45
|
+
},
|
|
46
|
+
"umd": "dist/stonecrop.umd.cjs",
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "vite build",
|
|
49
|
+
"dev": "vite serve stories/ -c vite.config.ts",
|
|
50
|
+
"lint": "eslint . --ext .ts,.vue",
|
|
51
|
+
"preview": "vite preview"
|
|
52
|
+
}
|
|
53
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Stonecrop
|
|
2
|
+
_This package is under active development / design._
|
|
3
|
+
|
|
4
|
+
## Design
|
|
5
|
+
A context will define schema, workflow and actions.
|
|
6
|
+
- Schema describes the data model and layout of the document.
|
|
7
|
+
- Workflows are the events that are registered on it and will specific to the context. An application might have 'login', 'onAppLoad', 'beforeRouteChange' and 'logout' events. A form/document context might define CRUD events. A table component, nested inside the form component might define its own events. I think we want Events to be FSM
|
|
8
|
+
- Actions are an ordered set of functions, called by Workflow
|
|
9
|
+
- [Router integration](https://pinia.vuejs.org/core-concepts/plugins.html#adding-new-external-properties). Stonecrop setup should expect a router or provide a default implementation
|
|
10
|
+
|
|
11
|
+
The context will be tree-shaped with a single root. Adding more nodes at the root level isn't a problem, but multiple roots would be disallowed.
|
|
12
|
+
|
|
13
|
+
Example APIs and paths
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
app.schema <Record> // immutable
|
|
17
|
+
app.workflow <FSM> // immutable
|
|
18
|
+
app.actions <OrderedSet> // immutable
|
|
19
|
+
app.value <Store> // mutable
|
|
20
|
+
app.user // "tyler@agritheory.com"
|
|
21
|
+
app.name // "My First Application"
|
|
22
|
+
app.doctype.schema <Record> // `app.doctype` lazy loaded by Event in router?
|
|
23
|
+
app.doctype.workflow <FSM>
|
|
24
|
+
app.doctype.actions <OrderedSet>
|
|
25
|
+
app.doctype.actions.value <Store>
|
|
26
|
+
app.doctype.schema.field.workflow <FSM>
|
|
27
|
+
app.doctype.schema.field.actions <OrderedSet>
|
|
28
|
+
app.doctype.schema.field.value <Store>
|
|
29
|
+
app.doctype.schema.field.value.field.value <Store> // a "sub-form"
|
|
30
|
+
app.doctype.schema.field.value.field[0].value <Store> // also a "sub-form", likely representing a table or list
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
It may make sense to use [automatic injection aliasing](https://vuejs.org/guide/components/provide-inject.html#inject) at the doctype level
|
|
34
|
+
|
|
35
|
+
## Base Classes
|
|
36
|
+
The Doctype aligns with a row, record or object in a database. It is required to specify its schema, a Finite State Machine that informs its workflow and a set of functions that are triggered by that FSM's state transitions.
|
|
37
|
+
|
|
38
|
+
Registry is a map of all Doctypes, lazy loaded and is responsible for routing within the application
|
|
39
|
+
|
|
40
|
+
Stem is a composable singleton that wraps Registry and provides application level state management
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## Story / Network diagram
|
|
44
|
+
#### **Doctype | Record Story**
|
|
45
|
+
|
|
46
|
+
- User is redirected after successful login
|
|
47
|
+
- Base URL is configured at app level to serve a navigation page
|
|
48
|
+
- User navigates to list view of `doctype`
|
|
49
|
+
- Table component loads existing records of `doctype` from schema; record-level schema is added to registry with web worker
|
|
50
|
+
- User navigates to specific record of `doctype`: schema is loaded from registry, data is loaded from server
|
|
51
|
+
- User mutates data, changes are persisted to server / DB per FSM
|
|
52
|
+
|
|
53
|
+
#### **App Level**
|
|
54
|
+
- User is redirected after successful login
|
|
55
|
+
- Base URL is configured at app level to serve a navigation page
|
|
56
|
+
- User opens command palette from lower-right-docked tab interface
|
|
57
|
+
- User can search for `doctype` by name or other server-enabled capabilities
|
|
58
|
+
|
|
59
|
+
#### **Low Code**
|
|
60
|
+
- User can define `doctype` and schema from UI
|
|
61
|
+
- Fields are shown as rows in a table
|
|
62
|
+
- FSM is shown as an editable diagram that validates itself
|