@aglyn/besigner-ui 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.
Files changed (2) hide show
  1. package/README.md +100 -3
  2. package/package.json +17 -17
package/README.md CHANGED
@@ -1,7 +1,104 @@
1
1
  # @aglyn/besigner-ui
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ The React UI of Besigner, Aglyn's visual editor, as it ships in the Aglyn
4
+ console: the workspace, canvas viewport, element tree, inspector forms,
5
+ toolbars, drag and drop, and working drafts. Install it if you want to mount
6
+ the Aglyn editor in your own app. If you want to build a different UI over the
7
+ same editing logic, take `@aglyn/besigner` instead.
4
8
 
5
- ## Running unit tests
9
+ > Beta. Published from the Aglyn monorepo under the `beta` dist-tag; APIs can change between beta releases.
6
10
 
7
- Run `nx test besigner-feature-designer` to execute the unit tests via [Jest](https://jestjs.io).
11
+ ## Install
12
+
13
+ npm install @aglyn/besigner-ui@beta
14
+
15
+ Peer dependencies, all required today:
16
+
17
+ - `react`
18
+ - `@mui/material`, `@mui/system`, `@mui/lab`
19
+ - `next`
20
+ - `firebase`
21
+
22
+ `next` and `firebase` are peers an embeddable editor should not need, and they
23
+ are still needed today. `next` is a peer because the viewport canvas and the
24
+ workspace editor load parts of themselves with `next/dynamic`. `firebase` is a
25
+ peer because the shared working-draft store (`drafts/besigner-server-draft`)
26
+ reads and writes Firestore itself. The package has been proven to install and
27
+ bundle from the registry with these peers present, together with `react-dom`
28
+ and MUI's Emotion packages, and without `firebase-admin`, any `@aglyn/tenant-*`
29
+ package or any `@aglyn/plugins-*` package.
30
+
31
+ ## What's in it
32
+
33
+ The pieces named below are exported from the package root unless a subpath is
34
+ given; every file under `src/lib` is also reachable by subpath.
35
+
36
+ - Root and providers: `BesignerRootProviderComponent` and the
37
+ `withBesignerContext` wrapper set up the editor app context, the
38
+ drag-and-drop context, the rendered-elements registry, the components drawer
39
+ and the clipboard shortcuts.
40
+ - Workspace and viewport: `WorkspaceEditorComponent`,
41
+ `WorkspacePanelComponent`, `AsidePanelComponent`, `ViewportRootComponent`,
42
+ `ViewportCanvasComponent` and `ViewportFrameComponent`. The frame renders
43
+ the canvas with `@aglyn/aglyn-node-renderer`, swapping in the editor's own
44
+ leaf (`NodeLeaf`) for selection and drag behavior.
45
+ - Toolbars and controls: `AppBarPrimaryComponent`, the secondary app bar and
46
+ breadcrumbs, `HistoryControlsComponent`, `DevicePreviewControlsComponent`,
47
+ `PanelControlsComponent`, and the scheme preview, zoom, interact and add
48
+ controls.
49
+ - Element tree and canvas chrome: `NodeTreeView`, `NodeOverlay`,
50
+ `NodeOutline`, `NodeContextMenu`, node quick actions and node cards.
51
+ - Inspector: `ElementPropsForm` for a component's attributes, the element
52
+ styles form, the properties dialog, property value forms, and token fields
53
+ (`token-text-field`, `token-pill`). The box styler (`BoxStyler`) is at the
54
+ subpath `@aglyn/besigner-ui/box-styler/index`.
55
+ - Documents and drafts: `useBesignerDocument` loads and saves the document
56
+ being edited through a source the caller supplies; `useBesignerDraft`,
57
+ the browser draft store (`readBesignerDraft`, `writeBesignerDraft`,
58
+ `clearBesignerDraft`) and the Firestore draft store (`readServerDraft`,
59
+ `writeServerDraft`, `clearServerDraft`) keep work in progress.
60
+ `BesignerDraftAlertComponent` and `BesignerConflictAlertComponent` surface
61
+ them.
62
+ - Hooks: `useAglynBesignerFlag`, `useAglynBesignerPanel`,
63
+ `useBesignerAppContext`, `useLeafDrag`, `useLeafDrop`,
64
+ `useDeleteElementCallback` and others.
65
+ - Host seams, as React contexts the embedding app fills:
66
+ `MediaPickerContext`, `BindingPickerContext`,
67
+ `BesignerInspectorExtrasContext`, `BesignerToolbarExtrasContext`, and the
68
+ component promotion, interactions and layout chrome contexts.
69
+
70
+ ## Usage
71
+
72
+ The editor is composed from these pieces rather than mounted as one component.
73
+ Import from the root:
74
+
75
+ ```tsx
76
+ import {
77
+ NodeTreeView,
78
+ ViewportCanvasComponent,
79
+ ViewportRootComponent,
80
+ WorkspaceEditorComponent,
81
+ useBesignerDocument,
82
+ withBesignerContext,
83
+ } from '@aglyn/besigner-ui'
84
+ ```
85
+
86
+ The reference composition is the console's screen editor page in the
87
+ monorepo, under
88
+ `apps/console/app/(editor)/[orgSlug]/hosts/[host]/screens/[screenId]/versions/[versionId]/besigner/page.tsx`.
89
+ It wraps the page with `withBesignerContext`, loads the document with
90
+ `useBesignerDocument`, and lays out the workspace, viewport and panels. The
91
+ components the canvas can render come from plugins registered with the core,
92
+ such as `@aglyn/plugins-mui`.
93
+
94
+ ## How it fits
95
+
96
+ This is the `besigner-ui` scope of the package map, the top of the designer
97
+ stack: it imports `@aglyn/besigner` (the logic), `@aglyn/aglyn-node-renderer`,
98
+ `@aglyn/aglyn-markdown-editor`, the core `@aglyn/aglyn`, and the generic
99
+ `@aglyn/shared-*` packages. It imports no plugin, and a plugin never imports
100
+ the designer UI.
101
+
102
+ ## License
103
+
104
+ Apache-2.0. Source: https://github.com/aglyn/aglyn/tree/main/libs/besigner/feature/designer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/besigner-ui",
3
- "version": "1.0.0-beta.143",
3
+ "version": "1.0.0-beta.144",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,22 +25,22 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.0.0-beta.143",
29
- "@aglyn/aglyn-markdown-editor": "1.0.0-beta.143",
30
- "@aglyn/aglyn-node-renderer": "1.0.0-beta.143",
31
- "@aglyn/besigner": "1.0.0-beta.143",
32
- "@aglyn/shared-data-enums": "1.0.0-beta.143",
33
- "@aglyn/shared-data-mdi": "1.0.0-beta.143",
34
- "@aglyn/shared-data-types": "1.0.0-beta.143",
35
- "@aglyn/shared-svg-icons": "1.0.0-beta.143",
36
- "@aglyn/shared-ui-json-editor": "1.0.0-beta.143",
37
- "@aglyn/shared-ui-jsx": "1.0.0-beta.143",
38
- "@aglyn/shared-ui-jsx-forms": "1.0.0-beta.143",
39
- "@aglyn/shared-ui-snackstack": "1.0.0-beta.143",
40
- "@aglyn/shared-ui-theme": "1.0.0-beta.143",
41
- "@aglyn/shared-util-dom": "1.0.0-beta.143",
42
- "@aglyn/shared-util-tools": "1.0.0-beta.143",
43
- "@aglyn/shared-util-vendor": "1.0.0-beta.143",
28
+ "@aglyn/aglyn": "1.0.0-beta.144",
29
+ "@aglyn/aglyn-markdown-editor": "1.0.0-beta.144",
30
+ "@aglyn/aglyn-node-renderer": "1.0.0-beta.144",
31
+ "@aglyn/besigner": "1.0.0-beta.144",
32
+ "@aglyn/shared-data-enums": "1.0.0-beta.144",
33
+ "@aglyn/shared-data-mdi": "1.0.0-beta.144",
34
+ "@aglyn/shared-data-types": "1.0.0-beta.144",
35
+ "@aglyn/shared-svg-icons": "1.0.0-beta.144",
36
+ "@aglyn/shared-ui-json-editor": "1.0.0-beta.144",
37
+ "@aglyn/shared-ui-jsx": "1.0.0-beta.144",
38
+ "@aglyn/shared-ui-jsx-forms": "1.0.0-beta.144",
39
+ "@aglyn/shared-ui-snackstack": "1.0.0-beta.144",
40
+ "@aglyn/shared-ui-theme": "1.0.0-beta.144",
41
+ "@aglyn/shared-util-dom": "1.0.0-beta.144",
42
+ "@aglyn/shared-util-tools": "1.0.0-beta.144",
43
+ "@aglyn/shared-util-vendor": "1.0.0-beta.144",
44
44
  "@dnd-kit/core": "^6.3.1",
45
45
  "@dnd-kit/utilities": "^3.2.2",
46
46
  "@react-aria/utils": "^3.34.1",