@aglyn/plugins-forms 1.0.0-beta.143 → 1.0.0-beta.144
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 +45 -25
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -1,35 +1,55 @@
|
|
|
1
1
|
# @aglyn/plugins-forms
|
|
2
2
|
|
|
3
|
-
The Forms
|
|
3
|
+
The Forms plugin for Aglyn: the `form` and `formField` elements that draw a form on a site, and the console section that holds a workspace's form catalog. Install it if you render Aglyn documents that place forms, or run the Aglyn console; it is a first-party plugin, not a standalone library.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
`FORMS_BUNDLE` and offered in the besigner's element picker.
|
|
7
|
-
- **Console** — the Forms catalog and one form's own surface (declaration,
|
|
8
|
-
metrics, versions, promotion, design preview), contributed through the
|
|
9
|
-
`ConsoleExtension` registry and rendered by the shell's generic plugin
|
|
10
|
-
route at `/{orgSlug}/hosts/{host}/forms`.
|
|
5
|
+
> Beta. Published from the Aglyn monorepo under the `beta` dist-tag; APIs can change between beta releases.
|
|
11
6
|
|
|
12
|
-
##
|
|
7
|
+
## Install
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
`form` and `formField` never change. `pluginId` is persisted beside it and is
|
|
16
|
-
`forms` — see `src/lib/constants/bundle-common.ts` for why that field is not
|
|
17
|
-
cosmetic, and `tools/scripts/backfill-node-plugin-ids.mjs` for the script that
|
|
18
|
-
keeps saved nodes agreeing with it.
|
|
9
|
+
npm install @aglyn/plugins-forms@beta
|
|
19
10
|
|
|
20
|
-
|
|
11
|
+
Peer dependencies: `react`, `next`, `@mui/material`, `@mui/x-data-grid`, `firebase`.
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
forms.ts` and `form-contract.ts`. `apps/tenant/app/api/forms/submit/route.ts`
|
|
24
|
-
resolves a form at request time through `@aglyn/tenant-runtime`, which is
|
|
25
|
-
tagged `scope:aglyn` and so may depend only on `scope:aglyn` and
|
|
26
|
-
`scope:shared`; a plugin carries `aglyn:addons` alone, so no core lib can
|
|
27
|
-
reach it. The submit route, the publish-time contract check and the besigner
|
|
28
|
-
editor route are all on the core side of that line.
|
|
13
|
+
## What's in it
|
|
29
14
|
|
|
30
|
-
|
|
31
|
-
plugin owns what a form IS, and the inbox owns what it collected.
|
|
15
|
+
The plugin declares two registrars in `plugins.config.json`, plus a `site` module so a published page can load the canvas half alone.
|
|
32
16
|
|
|
33
|
-
|
|
17
|
+
**On a published site** (`registerFormsPlugin`, the `site` registrar, exported from `@aglyn/plugins-forms/site`). It adds the `forms` feature bundle to the plugin manager with two elements:
|
|
34
18
|
|
|
35
|
-
`
|
|
19
|
+
- `form`: the form itself, with what happens after a submit (a message, a redirect or a reveal).
|
|
20
|
+
- `formField`: a field inside a form. It ships with the form rather than with the generic elements because it reports its name and dataset mapping to the enclosing form; a field with no form around it submits nowhere.
|
|
21
|
+
|
|
22
|
+
Presets for both, including a composed contact section, appear in the Besigner's element picker. `FORMS_BUNDLE` is the list of entries the bundle registers.
|
|
23
|
+
|
|
24
|
+
**Console** (`registerFormsConsole`, the `console` registrar):
|
|
25
|
+
|
|
26
|
+
- A `Forms` nav item at `/forms`: the form catalog and one form's own page (declaration, metrics, versions, promotion, design preview). The nav item owns its subtree, because a form's URL names a document id. The page is code-split and loads when opened.
|
|
27
|
+
- Two zones the plugin hosts on a form's page for other plugins to fill, registered with `registerPluginZone`: `formSubmissions`, where a reader of that form's submissions is drawn, and a zone for mapping a form's fields onto a person's fields.
|
|
28
|
+
|
|
29
|
+
**Ids are persisted.** `componentId` (`form`, `formField`) is stored in every screen document and does not change. `pluginId` is stored beside it and is `forms` (`BUNDLE_ID`); the renderer reads it to decide which bundles must register before first paint, so a page with no form on it does not wait for this package.
|
|
30
|
+
|
|
31
|
+
**What is not here.** The plugin has no server entry. The form model and the publish-time contract check live in `@aglyn/aglyn`, and the submit endpoint belongs to the tenant app, which resolves a form through `@aglyn/tenant-runtime`. They sit on the core side because the core may not import a plugin. Switching Forms off for a site is therefore not a property of this bundle: every half, including the submit route and the publish check, asks the site's plugin set about the `forms` id. Submissions are read through the zone above by whichever plugin registers a reader there.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
The plugin is loaded through Aglyn's plugin manager: the generated loader manifests import the package and call the registrars named in `plugins.config.json`. An app that wires plugins by hand calls them once at startup:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// published site or editor canvas: the elements alone
|
|
39
|
+
import { registerFormsPlugin } from '@aglyn/plugins-forms/site'
|
|
40
|
+
registerFormsPlugin()
|
|
41
|
+
|
|
42
|
+
// console
|
|
43
|
+
import { registerFormsConsole } from '@aglyn/plugins-forms'
|
|
44
|
+
registerFormsConsole()
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Import the canvas half from `./site`, not from the root: the root entry also carries the console registrar and its page. The feature bundle depends on the `mui` bundle, so `@aglyn/plugins-mui` must be registered for the elements to load.
|
|
48
|
+
|
|
49
|
+
## How it fits
|
|
50
|
+
|
|
51
|
+
A plugin package (`scope:plugin`). It depends on the core (`@aglyn/aglyn`), the tenant client hooks (`@aglyn/tenant-feature-instance`) and generic `@aglyn/shared-*` packages. It imports no other plugin: it names the `mui` bundle by the id the core exports, and the plugins that read submissions or map fields onto a contact meet it through console zones. The core never imports this package.
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
Apache-2.0. Source: https://github.com/aglyn/aglyn/tree/main/libs/plugins/forms
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/plugins-forms",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.144",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/aglyn": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-data-enums": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-data-mdi": "1.0.0-beta.
|
|
31
|
-
"@aglyn/shared-ui-email-campaigns": "1.0.0-beta.
|
|
32
|
-
"@aglyn/shared-ui-jsx": "1.0.0-beta.
|
|
33
|
-
"@aglyn/shared-ui-jsx-forms": "1.0.0-beta.
|
|
34
|
-
"@aglyn/shared-ui-snackstack": "1.0.0-beta.
|
|
35
|
-
"@aglyn/shared-util-http": "1.0.0-beta.
|
|
36
|
-
"@aglyn/shared-util-timestamp": "1.0.0-beta.
|
|
37
|
-
"@aglyn/shared-util-tools": "1.0.0-beta.
|
|
38
|
-
"@aglyn/tenant-feature-instance": "1.0.0-beta.
|
|
28
|
+
"@aglyn/aglyn": "1.0.0-beta.144",
|
|
29
|
+
"@aglyn/shared-data-enums": "1.0.0-beta.144",
|
|
30
|
+
"@aglyn/shared-data-mdi": "1.0.0-beta.144",
|
|
31
|
+
"@aglyn/shared-ui-email-campaigns": "1.0.0-beta.144",
|
|
32
|
+
"@aglyn/shared-ui-jsx": "1.0.0-beta.144",
|
|
33
|
+
"@aglyn/shared-ui-jsx-forms": "1.0.0-beta.144",
|
|
34
|
+
"@aglyn/shared-ui-snackstack": "1.0.0-beta.144",
|
|
35
|
+
"@aglyn/shared-util-http": "1.0.0-beta.144",
|
|
36
|
+
"@aglyn/shared-util-timestamp": "1.0.0-beta.144",
|
|
37
|
+
"@aglyn/shared-util-tools": "1.0.0-beta.144",
|
|
38
|
+
"@aglyn/tenant-feature-instance": "1.0.0-beta.144",
|
|
39
39
|
"@swc/helpers": "0.5.23"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|