@qkix/strapi-plugin-blueprint 0.1.0 → 0.1.2
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 +11 -6
- package/dist/admin/src/components/Canvas.d.ts +2 -2
- package/dist/server/index.mjs +3 -3
- package/dist/server/src/config/index.d.ts +1 -1
- package/dist/server/src/controllers/diagram.d.ts +1 -1
- package/dist/server/src/services/graph.d.ts +1 -1
- package/dist/server/src/services/svg.d.ts +2 -2
- package/dist/server/src/types.d.ts +6 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<h1 align="center">Blueprint for Strapi</h1>
|
|
6
6
|
|
|
7
|
-
<p align="center">A diagram of your content types
|
|
7
|
+
<p align="center">A diagram of your content types - <strong>including the components and dynamic zones everything else leaves out</strong>.</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
<a href="https://www.npmjs.com/package/@qkix/strapi-plugin-blueprint">
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
Every schema diagram for Strapi draws **relations only**. That is fine for a
|
|
31
31
|
schema built out of relations, and useless for the way most Strapi projects are
|
|
32
|
-
actually built
|
|
32
|
+
actually built - a handful of content types, and the real structure living in
|
|
33
33
|
components and dynamic zones. Draw relations only and a modern schema comes out
|
|
34
34
|
as a scattering of disconnected boxes.
|
|
35
35
|
|
|
@@ -69,7 +69,7 @@ Builder. The view fits the whole diagram when it opens and whenever what is
|
|
|
69
69
|
drawn changes.
|
|
70
70
|
|
|
71
71
|
Boxes that have nowhere to go do not pretend otherwise: a plugin's internal
|
|
72
|
-
tables
|
|
72
|
+
tables - Rewind's versions, upload's folders, anything under `admin::` - belong
|
|
73
73
|
on the diagram because they are part of the schema, but the Content-Type Builder
|
|
74
74
|
has no page for them, so they take no pointer and no hover.
|
|
75
75
|
|
|
@@ -77,7 +77,7 @@ has no page for them, so they take no pointer and no hover.
|
|
|
77
77
|
own `createdAt`-style fields, and the content types belonging to Strapi and to
|
|
78
78
|
other plugins. Layout runs top-to-bottom or left-to-right.
|
|
79
79
|
|
|
80
|
-
**Download SVG**
|
|
80
|
+
**Download SVG** - an actual vector, not a screenshot of one. It is a standalone
|
|
81
81
|
document with its styles and arrowheads inline and nothing fetched from
|
|
82
82
|
anywhere, so it works pasted into a README, opened from a downloads folder, or
|
|
83
83
|
embedded in a docs site, and it stays sharp at any size.
|
|
@@ -94,7 +94,7 @@ The diagram is laid out and rendered to SVG by the server, and the admin panel
|
|
|
94
94
|
displays what it is given. Two things follow from that.
|
|
95
95
|
|
|
96
96
|
The first is that **anything that can make an HTTP request can have the
|
|
97
|
-
diagram**
|
|
97
|
+
diagram** - a docs build, a CI job, a script that commits the current schema
|
|
98
98
|
next to your code:
|
|
99
99
|
|
|
100
100
|
```
|
|
@@ -129,7 +129,7 @@ blueprint: {
|
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
The toolbar can hide things too. The difference is that this survives a reload
|
|
132
|
-
and applies to the API as well
|
|
132
|
+
and applies to the API as well - it is the answer to "this never belongs on the
|
|
133
133
|
picture", not to "not right now".
|
|
134
134
|
|
|
135
135
|
## Known limitations
|
|
@@ -146,6 +146,11 @@ is not built yet.
|
|
|
146
146
|
point at, so there is no honest line to draw for it. The field is still listed on
|
|
147
147
|
its box.
|
|
148
148
|
|
|
149
|
+
## Roadmap
|
|
150
|
+
|
|
151
|
+
What is worth building next, what is deliberately not planned, and why:
|
|
152
|
+
[ROADMAP.md](https://github.com/qkix/strapi-plugins/blob/main/packages/strapi-plugin-blueprint/ROADMAP.md).
|
|
153
|
+
|
|
149
154
|
## License
|
|
150
155
|
|
|
151
156
|
MIT © [qkix](https://github.com/qkix)
|
|
@@ -9,7 +9,7 @@ interface View {
|
|
|
9
9
|
*
|
|
10
10
|
* A schema of any size is bigger than the panel, so opening at 1:1 in the
|
|
11
11
|
* top-left corner shows a corner of one box and reads as broken. Never zooms
|
|
12
|
-
* *in* past 1:1
|
|
12
|
+
* *in* past 1:1 - a two-box schema blown up to fill the screen looks like a
|
|
13
13
|
* mistake too.
|
|
14
14
|
*/
|
|
15
15
|
export declare const fitView: (content: {
|
|
@@ -39,7 +39,7 @@ export declare const Canvas: ({ svg, onOpen, view, onViewChange, fitTo, refit, }
|
|
|
39
39
|
width: number;
|
|
40
40
|
height: number;
|
|
41
41
|
};
|
|
42
|
-
/** Bump to refit on demand
|
|
42
|
+
/** Bump to refit on demand - what the "Reset view" button changes. */
|
|
43
43
|
refit: number;
|
|
44
44
|
}) => React.JSX.Element;
|
|
45
45
|
export declare const INITIAL_VIEW: View;
|
package/dist/server/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ const E = {
|
|
|
4
4
|
/**
|
|
5
5
|
* Uids never to draw, whatever the UI asks for.
|
|
6
6
|
*
|
|
7
|
-
* For schemas with a corner nobody wants on the picture
|
|
7
|
+
* For schemas with a corner nobody wants on the picture - a bulky
|
|
8
8
|
* integration type, a legacy import table. The UI can hide things too; this
|
|
9
9
|
* is the version that survives a page reload and applies to the API as well.
|
|
10
10
|
*
|
|
@@ -211,7 +211,7 @@ const E = {
|
|
|
211
211
|
* The admin panel receives finished SVG rather than a graph to render itself.
|
|
212
212
|
* That is the design: one renderer, on the server, so what you see in the
|
|
213
213
|
* panel and what you download are the same bytes, and so the diagram can be
|
|
214
|
-
* produced by anything that can make an HTTP request
|
|
214
|
+
* produced by anything that can make an HTTP request - a docs build, CI - and
|
|
215
215
|
* not only by a browser running the admin panel.
|
|
216
216
|
*/
|
|
217
217
|
async svg(t) {
|
|
@@ -355,7 +355,7 @@ const E = {
|
|
|
355
355
|
*
|
|
356
356
|
* Both ends of a two-sided relation describe the same line. Strapi marks
|
|
357
357
|
* the non-owning end with `mappedBy`, so skipping those leaves exactly one
|
|
358
|
-
* edge
|
|
358
|
+
* edge - deduplicating by node pair instead would silently merge two
|
|
359
359
|
* genuinely different relations between the same two types.
|
|
360
360
|
*
|
|
361
361
|
* Edges to something not on the diagram are dropped rather than drawn into
|
|
@@ -3,7 +3,7 @@ declare const _default: {
|
|
|
3
3
|
/**
|
|
4
4
|
* Uids never to draw, whatever the UI asks for.
|
|
5
5
|
*
|
|
6
|
-
* For schemas with a corner nobody wants on the picture
|
|
6
|
+
* For schemas with a corner nobody wants on the picture - a bulky
|
|
7
7
|
* integration type, a legacy import table. The UI can hide things too; this
|
|
8
8
|
* is the version that survives a page reload and applies to the API as well.
|
|
9
9
|
*
|
|
@@ -8,7 +8,7 @@ declare const controller: ({ strapi }: {
|
|
|
8
8
|
* The admin panel receives finished SVG rather than a graph to render itself.
|
|
9
9
|
* That is the design: one renderer, on the server, so what you see in the
|
|
10
10
|
* panel and what you download are the same bytes, and so the diagram can be
|
|
11
|
-
* produced by anything that can make an HTTP request
|
|
11
|
+
* produced by anything that can make an HTTP request - a docs build, CI - and
|
|
12
12
|
* not only by a browser running the admin panel.
|
|
13
13
|
*/
|
|
14
14
|
svg(ctx: any): Promise<void>;
|
|
@@ -46,7 +46,7 @@ declare const graph: ({ strapi }: {
|
|
|
46
46
|
*
|
|
47
47
|
* Both ends of a two-sided relation describe the same line. Strapi marks
|
|
48
48
|
* the non-owning end with `mappedBy`, so skipping those leaves exactly one
|
|
49
|
-
* edge
|
|
49
|
+
* edge - deduplicating by node pair instead would silently merge two
|
|
50
50
|
* genuinely different relations between the same two types.
|
|
51
51
|
*
|
|
52
52
|
* Edges to something not on the diagram are dropped rather than drawn into
|
|
@@ -3,7 +3,7 @@ import type { Layout } from '../types';
|
|
|
3
3
|
* Every string that reaches the output goes through here.
|
|
4
4
|
*
|
|
5
5
|
* Content-type names come from developers rather than from the public, so this
|
|
6
|
-
* is not the front line of anything
|
|
6
|
+
* is not the front line of anything - but the SVG is injected into the admin
|
|
7
7
|
* panel's DOM and also handed to people to commit into a repository, and a
|
|
8
8
|
* display name containing `</text><script>` must not become script in either
|
|
9
9
|
* place. Escaping at the boundary is the only version of this that stays true
|
|
@@ -13,7 +13,7 @@ export declare const escapeXml: (value: string) => string;
|
|
|
13
13
|
/**
|
|
14
14
|
* The diagram, as a standalone SVG document.
|
|
15
15
|
*
|
|
16
|
-
* Standalone on purpose
|
|
16
|
+
* Standalone on purpose - styles and marker inline, no external references - so
|
|
17
17
|
* the same bytes work in the admin panel, in a README, and opened straight from
|
|
18
18
|
* a downloads folder. An `<img>` tag will not fetch anything an SVG refers to,
|
|
19
19
|
* which is what makes the usual "export" of this category a raster screenshot
|
|
@@ -9,10 +9,10 @@ export interface Field {
|
|
|
9
9
|
required?: boolean;
|
|
10
10
|
}
|
|
11
11
|
export interface Node {
|
|
12
|
-
/** The content-type or component uid
|
|
12
|
+
/** The content-type or component uid - unique, and what edges point at. */
|
|
13
13
|
uid: string;
|
|
14
14
|
kind: NodeKind;
|
|
15
|
-
/** `Article`, `Shared / Seo`
|
|
15
|
+
/** `Article`, `Shared / Seo` - what the admin panel calls it. */
|
|
16
16
|
label: string;
|
|
17
17
|
/** `api`, `plugin::users-permissions`, or the component category. */
|
|
18
18
|
group: string;
|
|
@@ -22,8 +22,8 @@ export interface Node {
|
|
|
22
22
|
/**
|
|
23
23
|
* Whether this box has a page in the Content-Type Builder to open.
|
|
24
24
|
*
|
|
25
|
-
* A plugin's internal tables
|
|
26
|
-
* every `admin::` type
|
|
25
|
+
* A plugin's internal tables - Greenlight's transition log, upload's folders,
|
|
26
|
+
* every `admin::` type - are real content types and belong on the diagram, but
|
|
27
27
|
* there is nowhere to send someone who clicks one.
|
|
28
28
|
*/
|
|
29
29
|
navigable: boolean;
|
|
@@ -33,7 +33,7 @@ export interface Node {
|
|
|
33
33
|
*
|
|
34
34
|
* `relation` is the classic ERD edge. The other two are the reason this plugin
|
|
35
35
|
* exists: every diagram in this category draws relations only, so a schema built
|
|
36
|
-
* out of components
|
|
36
|
+
* out of components - which is most of them - shows up as a handful of
|
|
37
37
|
* disconnected boxes and tells you nothing.
|
|
38
38
|
*/
|
|
39
39
|
export type EdgeKind = 'relation' | 'component' | 'dynamiczone';
|
|
@@ -54,7 +54,7 @@ export interface Graph {
|
|
|
54
54
|
}
|
|
55
55
|
/** What the caller asked to see. Everything defaults to the useful answer. */
|
|
56
56
|
export interface GraphOptions {
|
|
57
|
-
/** Content types owned by Strapi or by plugins
|
|
57
|
+
/** Content types owned by Strapi or by plugins - noise for most people. */
|
|
58
58
|
includeForeign: boolean;
|
|
59
59
|
/** Components and dynamic zones, and the edges into them. */
|
|
60
60
|
includeComponents: boolean;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qkix/strapi-plugin-blueprint",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "A diagram of your Strapi v5 content types, components and dynamic zones
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "A diagram of your Strapi v5 content types, components and dynamic zones - rendered as real SVG",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"kind": "plugin",
|
|
7
7
|
"name": "blueprint",
|
|
8
8
|
"displayName": "Blueprint",
|
|
9
|
-
"description": "A diagram of your Strapi v5 content types, components and dynamic zones
|
|
9
|
+
"description": "A diagram of your Strapi v5 content types, components and dynamic zones - rendered as real SVG"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
12
12
|
"strapi",
|