@plitzi/plitzi-builder 0.36.2 → 0.37.1
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/CHANGELOG.md +92 -0
- package/dist/index.html +2 -2
- package/dist/modules/App/helpers/modalSizes.d.ts +16 -0
- package/dist/modules/DataSource/models/BindingForm/BindingForm.d.ts +1 -1
- package/dist/modules/Export/ExportSpace.d.ts +9 -0
- package/dist/modules/Export/components/ExportChanges/ExportChanges.d.ts +13 -0
- package/dist/modules/Export/components/ExportChanges/components/ExportChangeGroup/ExportChangeGroup.d.ts +7 -0
- package/dist/modules/Export/components/ExportChanges/components/ExportChangeGroup/index.d.ts +3 -0
- package/dist/modules/Export/components/ExportChanges/index.d.ts +3 -0
- package/dist/modules/Export/components/ExportLocked/ExportLocked.d.ts +7 -0
- package/dist/modules/Export/components/ExportLocked/index.d.ts +3 -0
- package/dist/modules/Export/components/ExportToolbar/ExportToolbar.d.ts +13 -0
- package/dist/modules/Export/components/ExportToolbar/components/ExportFormatButton/ExportFormatButton.d.ts +8 -0
- package/dist/modules/Export/components/ExportToolbar/components/ExportFormatButton/index.d.ts +3 -0
- package/dist/modules/Export/components/ExportToolbar/index.d.ts +3 -0
- package/dist/modules/Export/components/ExportViewer/ExportViewer.d.ts +16 -0
- package/dist/modules/Export/components/ExportViewer/components/ExportFileFolder/ExportFileFolder.d.ts +9 -0
- package/dist/modules/Export/components/ExportViewer/components/ExportFileFolder/index.d.ts +3 -0
- package/dist/modules/Export/components/ExportViewer/components/ExportFileItem/ExportFileItem.d.ts +11 -0
- package/dist/modules/Export/components/ExportViewer/components/ExportFileItem/index.d.ts +3 -0
- package/dist/modules/Export/components/ExportViewer/components/ExportFileTab/ExportFileTab.d.ts +8 -0
- package/dist/modules/Export/components/ExportViewer/components/ExportFileTab/index.d.ts +3 -0
- package/dist/modules/Export/components/ExportViewer/components/ExportFileTree/ExportFileTree.d.ts +8 -0
- package/dist/modules/Export/components/ExportViewer/components/ExportFileTree/index.d.ts +3 -0
- package/dist/modules/Export/components/ExportViewer/components/ExportViewTab/ExportViewTab.d.ts +12 -0
- package/dist/modules/Export/components/ExportViewer/components/ExportViewTab/index.d.ts +3 -0
- package/dist/modules/Export/components/ExportViewer/index.d.ts +3 -0
- package/dist/modules/Export/helpers/editor.d.ts +8 -0
- package/dist/modules/Export/helpers/exportFiles.d.ts +43 -0
- package/dist/modules/Export/helpers/exportFiles.test.d.ts +1 -0
- package/dist/modules/Export/helpers/exportFormats.d.ts +11 -0
- package/dist/modules/Export/helpers/repairs.d.ts +28 -0
- package/dist/modules/Export/helpers/repairs.test.d.ts +1 -0
- package/dist/modules/Export/hooks/useExportSession.d.ts +22 -0
- package/dist/modules/Export/hooks/useSpaceExport.d.ts +23 -0
- package/dist/modules/Export/index.d.ts +7 -0
- package/dist/modules/Segments/SegmentsReducer.d.ts +3 -11
- package/dist/package.json.d.ts +2 -1
- package/dist/plitzi-builder.css +1 -1
- package/dist/plitzi-builder.css.gz +0 -0
- package/dist/plitzi-builder.js +1638 -1590
- package/dist/plitzi-builder.js.gz +0 -0
- package/package.json +14 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,97 @@
|
|
|
1
1
|
# @plitzi/plitzi-builder
|
|
2
2
|
|
|
3
|
+
## 0.37.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- v0.37.1
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @plitzi/plitzi-sdk@0.37.1
|
|
10
|
+
- @plitzi/sdk-auth@0.37.1
|
|
11
|
+
- @plitzi/sdk-authoring@0.37.1
|
|
12
|
+
- @plitzi/sdk-dev-tools@0.37.1
|
|
13
|
+
- @plitzi/sdk-elements@0.37.1
|
|
14
|
+
- @plitzi/sdk-event-bridge@0.37.1
|
|
15
|
+
- @plitzi/sdk-interactions@0.37.1
|
|
16
|
+
- @plitzi/sdk-navigation@0.37.1
|
|
17
|
+
- @plitzi/sdk-plugins@0.37.1
|
|
18
|
+
- @plitzi/sdk-schema@0.37.1
|
|
19
|
+
- @plitzi/sdk-shared@0.37.1
|
|
20
|
+
- @plitzi/sdk-style@0.37.1
|
|
21
|
+
- @plitzi/sdk-variables@0.37.1
|
|
22
|
+
|
|
23
|
+
## 0.37.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- - A `button` takes a `title`: shown as a tooltip, and its accessible name when it has no text of its own — an
|
|
28
|
+
icon-only button without one was announced as nothing. The builder's settings offer it as "Tooltip". The JSON export
|
|
29
|
+
is two files, `schema.json` and `style.json`, shown as tabs; each group of changes in the export folds away.
|
|
30
|
+
|
|
31
|
+
- `BindingTransformer.params` is `Record<string, string | number | boolean>`: a param the builder draws as a checkbox
|
|
32
|
+
(`styleVariant`'s `append`) is stored as the boolean it is and read as one, so the type now says so. The MCP compares
|
|
33
|
+
such a param with its catalog options as text. A `container` may be an `li`, for the rows of a list. The export
|
|
34
|
+
keeps every element id with `keepIds`, and the header's Publish dialog opens wider.
|
|
35
|
+
|
|
36
|
+
- **The builder exports the space on screen — on paid plans.** **Export** in the header opens a wide dialog: the
|
|
37
|
+
format as tabs (TypeScript in one file, TypeScript with a file per page as a `.zip`, or JSON), generated as soon as
|
|
38
|
+
it is picked, shown read-only in CodeMirror — beside a file list when there are several — with one row of actions,
|
|
39
|
+
**Copy** and **Download**. What the export tidied is a one-line note that unfolds into readable groups. On the free
|
|
40
|
+
plan the dialog explains what export is instead; the server refuses the code with a 402 (`limit: 'spaceExport'`)
|
|
41
|
+
whatever the builder shows. `useSpaceExport` is the one way into it, for anything else that needs the space as files.
|
|
42
|
+
|
|
43
|
+
- **A space document can be read back into code.** `specFromSpace(documents)` turns a `{ schema, style }` pair — a
|
|
44
|
+
builder export, a seed checked in as JSON — into the `SpaceSpec` that authors it, and `specToSource(spec, { exportName })`
|
|
45
|
+
writes that spec out as the TypeScript a person would write: one factory call per element, the attributes a type
|
|
46
|
+
already defaults to left out, the longhands the document stores written back as `padding: 10px 20px`, and every class
|
|
47
|
+
something names as a `styles()` declaration held in a variable. `split: true` writes one file per page and per layout.
|
|
48
|
+
`compareSpaces(expected, actual)` proves the round trip: it lists every way two pairs render differently — the tree,
|
|
49
|
+
the attributes, the rules that apply to each element whatever its selector is called, bindings, flows, pages, layouts
|
|
50
|
+
and settings — and nothing else. A selector used by one element becomes that element's own `css`; one shared, or
|
|
51
|
+
spelled out anywhere in the document (a `customCss` rule, a template), stays a class under its own name; an element id
|
|
52
|
+
nothing refers to is left out and derived again.
|
|
53
|
+
|
|
54
|
+
What an older builder left behind is repaired on the way, and every repair is reported in `corrections` rather than
|
|
55
|
+
made silently: element types that no longer exist (`navbar` → a `list` laid out in a row, `navbarItem` → `listItem`),
|
|
56
|
+
a hover stored as a class of its own (`card:hover`) folded into the class, fields and attributes no component reads,
|
|
57
|
+
a setting nothing reads, a link `target` of `_blank` (the component adds the underscore, so it rendered as `__blank`),
|
|
58
|
+
`null` or an empty list where an attribute is unset, a binding to a source nothing publishes, a flow with a step that
|
|
59
|
+
runs nothing, and a global callback registered on the wrong module. A CSS property the style editor cannot hold is
|
|
60
|
+
kept in `customCss` under the same selector, so the page still renders it.
|
|
61
|
+
|
|
62
|
+
- **What a spec can say grew to what a document holds.** A selector carries its states and variants beside its rules —
|
|
63
|
+
`styles('card', { css, states: { hover }, variants: { active } })`, and `states` on an element's own `css` — and the
|
|
64
|
+
selector cache is now written by `processSelector`, the function the style editor writes it with. An element type's
|
|
65
|
+
defaults (`elements`) take states, variants, per-breakpoint rules and `slots` for its other selectors (a modal's
|
|
66
|
+
`rootContainer`). A space declares `layouts` — shells that pages render inside, named by `layout: { id, slot }` on a
|
|
67
|
+
page or on another layout, with the slot checked to be inside the shell — and a page takes `keepState` and
|
|
68
|
+
`stateStorage`. `visible: false` starts an element hidden for a flow to reveal, and `loadStrategy` is carried through.
|
|
69
|
+
An element's own selector never takes the name of a declared class any more, however that class happens to be called.
|
|
70
|
+
|
|
71
|
+
- `elementAttributeNames` lists, as data, the attributes each built-in element can be authored with — `null` for one
|
|
72
|
+
that takes any. It is generated from the elements' attribute types (`yarn generate:attribute-names`) and a type test
|
|
73
|
+
fails when the two disagree. `defaultAttributes(type)` and `defaultLabel(type)` expose what a factory fills in.
|
|
74
|
+
|
|
75
|
+
- `CustomAttributes` accepts any attribute, because the component a custom element's `renderType` names reads its own
|
|
76
|
+
attributes off it; and `FormControlAttributes` declares `previewError`, which `withFieldValue` reads.
|
|
77
|
+
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
- Updated dependencies
|
|
81
|
+
- @plitzi/plitzi-sdk@0.37.0
|
|
82
|
+
- @plitzi/sdk-auth@0.37.0
|
|
83
|
+
- @plitzi/sdk-authoring@0.37.0
|
|
84
|
+
- @plitzi/sdk-dev-tools@0.37.0
|
|
85
|
+
- @plitzi/sdk-elements@0.37.0
|
|
86
|
+
- @plitzi/sdk-event-bridge@0.37.0
|
|
87
|
+
- @plitzi/sdk-interactions@0.37.0
|
|
88
|
+
- @plitzi/sdk-navigation@0.37.0
|
|
89
|
+
- @plitzi/sdk-plugins@0.37.0
|
|
90
|
+
- @plitzi/sdk-schema@0.37.0
|
|
91
|
+
- @plitzi/sdk-shared@0.37.0
|
|
92
|
+
- @plitzi/sdk-style@0.37.0
|
|
93
|
+
- @plitzi/sdk-variables@0.37.0
|
|
94
|
+
|
|
3
95
|
## 0.36.2
|
|
4
96
|
|
|
5
97
|
### Patch Changes
|
package/dist/index.html
CHANGED
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
render(
|
|
57
57
|
'plitzi',
|
|
58
58
|
{
|
|
59
|
-
webKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
59
|
+
webKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwib3JpZ2lucyI6WyJodHRwczovL3dlYnNpdGUucGxpdHppLmFwcCIsImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsImh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImh0dHA6Ly8xMjcuMC4wLjE6ODA4MCJdLCJpc3MiOiJodHRwczovL3NlcnZlci5wbGl0emkubG9jYWwiLCJhdWQiOlsiaHR0cHM6Ly9wbGl0emkubG9jYWwiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWwiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMCIsImh0dHBzOi8vYXBwLnBsaXR6aS5sb2NhbDozMDAxIiwiaHR0cHM6Ly9hcGkucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9zc3IucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9tY3AucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hdXRoLnBsaXR6aS5sb2NhbCIsImh0dHA6Ly8xMjcuMC4wLjE6NTMwMCIsImh0dHA6Ly9sb2NhbGhvc3Q6NTE4MCJdLCJzY29wZSI6InNwYWNlOnJlbmRlciIsImlhdCI6MTc4OTg0OTYyMywianRpIjoiMmM0ZTRkNDI1NzEzMTI4YyIsIm5iZiI6MTc4OTg0OTYyM30.VKxz7K9A8tvKnCwWLnB02NgAQY7Oftr6NzAXH8v4nsU',
|
|
60
60
|
// The actor. Without it the builder loads and every write is refused, since authorization is
|
|
61
61
|
// can(actor, space, permission). Both halves come from `yarn token 1 --user admin` in plitzi-sdk-server.
|
|
62
|
-
userKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
62
|
+
userKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiaXNzIjoiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiYXVkIjpbImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vYXBpLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vbWNwLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vYXV0aC5wbGl0emkubG9jYWwiLCJodHRwOi8vMTI3LjAuMC4xOjUzMDAiLCJodHRwOi8vbG9jYWxob3N0OjUxODAiXSwic2NvcGUiOiJ1c2VyIiwiZXhwIjoxNzg5OTA1NDg3LCJpYXQiOjE3ODk4MTkwODcsImp0aSI6ImQyZjAwNTE1ZTFiMzk1YzEiLCJuYmYiOjE3ODk4MTkwODd9.SGs05mrxeKWgi34XZ--vG_qtkwk8Pw7R2KEt5EU6rpc',
|
|
63
63
|
environment: 'main',
|
|
64
64
|
server: {
|
|
65
65
|
basePath: '',
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How wide the header's dialogs open, as settings for `showModal`.
|
|
3
|
+
*
|
|
4
|
+
* The modal's own card stops at `max-w-lg`, which suits a confirmation and cramps anything else: a form with a
|
|
5
|
+
* revision list, a domain and a credential needs room to read, and a code viewer needs room for a 120-column file.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FORM_MODAL: {
|
|
8
|
+
className: {
|
|
9
|
+
card: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const WIDE_MODAL: {
|
|
13
|
+
className: {
|
|
14
|
+
card: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -8,7 +8,7 @@ export declare const bindingForm: z.ZodObject<{
|
|
|
8
8
|
when: z.ZodOptional<z.ZodAny>;
|
|
9
9
|
transformers: z.ZodArray<z.ZodObject<{
|
|
10
10
|
action: z.ZodString;
|
|
11
|
-
params: z.ZodRecord<z.ZodString, z.ZodString
|
|
11
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
12
12
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
13
13
|
}, z.core.$strip>>;
|
|
14
14
|
}, z.core.$strip>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A copy of the space on screen, as JSON or as the code that authors it.
|
|
3
|
+
*
|
|
4
|
+
* Generated as soon as a format is picked and shown before anything is saved, so the code can be copied straight into
|
|
5
|
+
* an editor, or downloaded, from the one row of actions above it. A paid-plan capability: on the free plan the dialog
|
|
6
|
+
* says what export is instead.
|
|
7
|
+
*/
|
|
8
|
+
declare const ExportSpace: () => import("react").JSX.Element;
|
|
9
|
+
export default ExportSpace;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SpecCorrection } from '@plitzi/sdk-authoring';
|
|
2
|
+
export type ExportChangesProps = {
|
|
3
|
+
corrections: SpecCorrection[];
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* What the export tidied while reading the space, one change per row.
|
|
7
|
+
*
|
|
8
|
+
* Grouped by kind under a heading that folds it away, every change on its own line with the names in it set in code —
|
|
9
|
+
* so where one ends and the next begins is never a question. Nothing here is wrong with the space: these are the
|
|
10
|
+
* leftovers an older builder wrote that today's code has no word for.
|
|
11
|
+
*/
|
|
12
|
+
declare const ExportChanges: ({ corrections }: ExportChangesProps) => import("react").JSX.Element;
|
|
13
|
+
export default ExportChanges;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CorrectionGroup } from '../../../../helpers/repairs';
|
|
2
|
+
export type ExportChangeGroupProps = {
|
|
3
|
+
group: CorrectionGroup;
|
|
4
|
+
};
|
|
5
|
+
/** One kind of change: a heading that folds it away, and every change of that kind on its own row. */
|
|
6
|
+
declare const ExportChangeGroup: ({ group }: ExportChangeGroupProps) => import("react").JSX.Element;
|
|
7
|
+
export default ExportChangeGroup;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ExportLockedProps = {
|
|
2
|
+
/** The plan the workspace is on, to say what it is being compared with. */
|
|
3
|
+
planName?: string;
|
|
4
|
+
};
|
|
5
|
+
/** What export is and which plans have it — in place of the result, for a workspace on the free plan. */
|
|
6
|
+
declare const ExportLocked: ({ planName }: ExportLockedProps) => import("react").JSX.Element;
|
|
7
|
+
export default ExportLocked;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ExportFormat } from '../../helpers/exportFormats';
|
|
2
|
+
export type ExportToolbarProps = {
|
|
3
|
+
format: ExportFormat;
|
|
4
|
+
/** What the shown code can be copied as, and the file the export downloads as — absent until there is one. */
|
|
5
|
+
fileName?: string;
|
|
6
|
+
canCopy: boolean;
|
|
7
|
+
onChangeFormat: (format: ExportFormat) => void;
|
|
8
|
+
onCopy: () => void;
|
|
9
|
+
onDownload: () => void;
|
|
10
|
+
};
|
|
11
|
+
/** The format on the left, what can be done with the result on the right — one row, one place for every action. */
|
|
12
|
+
declare const ExportToolbar: ({ format, fileName, canCopy, onChangeFormat, onCopy, onDownload }: ExportToolbarProps) => import("react").JSX.Element;
|
|
13
|
+
export default ExportToolbar;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ExportFormat, ExportFormatOption } from '../../../../helpers/exportFormats';
|
|
2
|
+
export type ExportFormatButtonProps = {
|
|
3
|
+
option: ExportFormatOption;
|
|
4
|
+
selected: boolean;
|
|
5
|
+
onSelect: (format: ExportFormat) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const ExportFormatButton: ({ option, selected, onSelect }: ExportFormatButtonProps) => import("react").JSX.Element;
|
|
8
|
+
export default ExportFormatButton;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SpecCorrection } from '@plitzi/sdk-authoring';
|
|
2
|
+
export type ExportViewerProps = {
|
|
3
|
+
/** Every file of the export, by path: one shows alone, a few as tabs, many beside a list to pick from. */
|
|
4
|
+
paths: string[];
|
|
5
|
+
selectedPath?: string;
|
|
6
|
+
content?: string;
|
|
7
|
+
/** What the export tidied on the way; a view of its own when there is any. */
|
|
8
|
+
corrections: SpecCorrection[];
|
|
9
|
+
mode: 'js' | 'json';
|
|
10
|
+
theme: 'light' | 'dark';
|
|
11
|
+
loading: boolean;
|
|
12
|
+
onSelectPath: (path: string) => void;
|
|
13
|
+
};
|
|
14
|
+
/** The export itself, read-only — the code, and on a view of its own, what was tidied to write it. */
|
|
15
|
+
declare const ExportViewer: ({ paths, selectedPath, content, corrections, mode, theme, loading, onSelectPath }: ExportViewerProps) => import("react").JSX.Element;
|
|
16
|
+
export default ExportViewer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FileFolder } from '../../../../helpers/exportFiles';
|
|
2
|
+
export type ExportFileFolderProps = {
|
|
3
|
+
folder: FileFolder;
|
|
4
|
+
selectedPath?: string;
|
|
5
|
+
onSelect: (path: string) => void;
|
|
6
|
+
};
|
|
7
|
+
/** A folder of the export — the layouts, the pages — that folds away, its files indented under a guide line. */
|
|
8
|
+
declare const ExportFileFolder: ({ folder, selectedPath, onSelect }: ExportFileFolderProps) => import("react").JSX.Element;
|
|
9
|
+
export default ExportFileFolder;
|
package/dist/modules/Export/components/ExportViewer/components/ExportFileItem/ExportFileItem.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ExportFileItemProps = {
|
|
2
|
+
path: string;
|
|
3
|
+
/** What the file is shown as — its name inside a folder, since the folder already says where it is. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Inside a folder: indented under it, beside the guide line the folder draws. */
|
|
6
|
+
nested?: boolean;
|
|
7
|
+
selected: boolean;
|
|
8
|
+
onSelect: (path: string) => void;
|
|
9
|
+
};
|
|
10
|
+
declare const ExportFileItem: ({ path, label, nested, selected, onSelect }: ExportFileItemProps) => import("react").JSX.Element;
|
|
11
|
+
export default ExportFileItem;
|
package/dist/modules/Export/components/ExportViewer/components/ExportFileTab/ExportFileTab.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ExportFileTabProps = {
|
|
2
|
+
path: string;
|
|
3
|
+
selected: boolean;
|
|
4
|
+
onSelect: (path: string) => void;
|
|
5
|
+
};
|
|
6
|
+
/** One file of a small export — the schema, the style — as a tab, where a list of two would be a waste of a column. */
|
|
7
|
+
declare const ExportFileTab: ({ path, selected, onSelect }: ExportFileTabProps) => import("react").JSX.Element;
|
|
8
|
+
export default ExportFileTab;
|
package/dist/modules/Export/components/ExportViewer/components/ExportFileTree/ExportFileTree.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ExportFileTreeProps = {
|
|
2
|
+
paths: string[];
|
|
3
|
+
selectedPath?: string;
|
|
4
|
+
onSelect: (path: string) => void;
|
|
5
|
+
};
|
|
6
|
+
/** The export's files as the folders they are written into: the space's own files first, then each folder. */
|
|
7
|
+
declare const ExportFileTree: ({ paths, selectedPath, onSelect }: ExportFileTreeProps) => import("react").JSX.Element;
|
|
8
|
+
export default ExportFileTree;
|
package/dist/modules/Export/components/ExportViewer/components/ExportViewTab/ExportViewTab.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ExportView = 'code' | 'changes';
|
|
2
|
+
export type ExportViewTabProps = {
|
|
3
|
+
view: ExportView;
|
|
4
|
+
label: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
/** Shown beside the label as a count, when there is one. */
|
|
7
|
+
count?: number;
|
|
8
|
+
selected: boolean;
|
|
9
|
+
onSelect: (view: ExportView) => void;
|
|
10
|
+
};
|
|
11
|
+
declare const ExportViewTab: ({ view, label, icon, count, selected, onSelect }: ExportViewTabProps) => import("react").JSX.Element;
|
|
12
|
+
export default ExportViewTab;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodeMirror's wrappers take the whole height they are given, so the editor scrolls inside the viewer instead of
|
|
3
|
+
* growing past it — the viewer clips, and a clipped editor cannot be scrolled at all.
|
|
4
|
+
*/
|
|
5
|
+
export declare const FULL_HEIGHT_EDITOR: {
|
|
6
|
+
root: string;
|
|
7
|
+
inputContainer: string;
|
|
8
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ExportFormat } from './exportFormats';
|
|
2
|
+
import { SpaceDifference, SpecCorrection } from '@plitzi/sdk-authoring';
|
|
3
|
+
/**
|
|
4
|
+
* A space, exported: the files it became and what happened on the way.
|
|
5
|
+
*
|
|
6
|
+
* Kept as plain data rather than as a download, because what is done with it differs by caller — copied into an editor,
|
|
7
|
+
* saved as a file, handed to a deployment — and none of them should have to export the space again to do it.
|
|
8
|
+
*/
|
|
9
|
+
export type SpaceExport = {
|
|
10
|
+
format: ExportFormat;
|
|
11
|
+
/** What the export is saved as: the one file, or the archive holding several. */
|
|
12
|
+
fileName: string;
|
|
13
|
+
/** Source files by path. One entry unless the export was split. */
|
|
14
|
+
files: Record<string, string>;
|
|
15
|
+
/** What the export repaired in the space's documents. Empty for a JSON export, which changes nothing. */
|
|
16
|
+
corrections: SpecCorrection[];
|
|
17
|
+
/** How the exported code would differ from the space — each one a repair `corrections` names. */
|
|
18
|
+
differences: SpaceDifference[];
|
|
19
|
+
};
|
|
20
|
+
/** The one file of a single-file export, which is what can be shown and copied. */
|
|
21
|
+
export declare const singleFileOf: (spaceExport: SpaceExport) => string | undefined;
|
|
22
|
+
/** The export as one file to save: the file itself, or a zip of every file in its folder structure. */
|
|
23
|
+
export declare const exportBlob: (spaceExport: SpaceExport) => Promise<Blob>;
|
|
24
|
+
/** Saves a blob through the browser's own download, under the given name. */
|
|
25
|
+
export declare const downloadBlob: (fileName: string, blob: Blob) => void;
|
|
26
|
+
/** The files in reading order: the space first, then what sits beside it, then each folder's files by name. */
|
|
27
|
+
export declare const orderedPaths: (files: Record<string, string>) => string[];
|
|
28
|
+
/** How an export's files are offered: as tabs when there are a few, as a list when there are many, not at all when one. */
|
|
29
|
+
export declare const fileNavigationOf: (paths: string[]) => "none" | "tabs" | "list";
|
|
30
|
+
export type FileFolder = {
|
|
31
|
+
name: string;
|
|
32
|
+
paths: string[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* An export's files as a tree one folder deep — which is every shape an export has: the files beside the space, then a
|
|
36
|
+
* folder for the layouts and one for the pages. Files keep their full path; the folder is what they are shown under.
|
|
37
|
+
*/
|
|
38
|
+
export declare const fileTreeOf: (paths: string[]) => {
|
|
39
|
+
files: string[];
|
|
40
|
+
folders: FileFolder[];
|
|
41
|
+
};
|
|
42
|
+
/** The name a file is shown by inside its folder. */
|
|
43
|
+
export declare const fileNameOf: (path: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** What a space can be exported as. */
|
|
2
|
+
export type ExportFormat = 'authoring' | 'authoring-split' | 'json';
|
|
3
|
+
export type ExportFormatOption = {
|
|
4
|
+
value: ExportFormat;
|
|
5
|
+
label: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
description: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const EXPORT_FORMATS: readonly ExportFormatOption[];
|
|
10
|
+
export declare const DEFAULT_EXPORT_FORMAT: ExportFormat;
|
|
11
|
+
export declare const descriptionOf: (format: ExportFormat) => string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SpecCorrection } from '@plitzi/sdk-authoring';
|
|
2
|
+
export declare const repairLabel: (code: string) => string;
|
|
3
|
+
/** Removed, corrected or kept: what the reader DID, which is what the icon beside a kind of repair says. */
|
|
4
|
+
export declare const repairIcon: (code: string) => string;
|
|
5
|
+
/** A stretch of a message; `key` is its place in the message, which is fixed — a message is never reordered. */
|
|
6
|
+
export type MessagePart = {
|
|
7
|
+
key: string;
|
|
8
|
+
text: string;
|
|
9
|
+
code: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A repair message, with the names in it — `"listItem-bOPK"`, `"_blank"` — set apart from the prose around them.
|
|
13
|
+
*
|
|
14
|
+
* The reader quotes every name it mentions, so the quotes are what mark them: the parts between them are what a person
|
|
15
|
+
* scans a list of repairs for, and reading them as code is what tells one from the sentence around it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const messageParts: (message: string) => MessagePart[];
|
|
18
|
+
export type CorrectionGroup = {
|
|
19
|
+
code: string;
|
|
20
|
+
label: string;
|
|
21
|
+
total: number;
|
|
22
|
+
messages: {
|
|
23
|
+
text: string;
|
|
24
|
+
count: number;
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
/** The repairs by kind, in the order each kind first appeared — the same repair made several times listed once. */
|
|
28
|
+
export declare const groupCorrections: (corrections: SpecCorrection[]) => CorrectionGroup[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ExportFormat } from '../helpers/exportFormats';
|
|
2
|
+
/**
|
|
3
|
+
* One visit to the export dialog: the format picked, what each format came to, and which file is on screen.
|
|
4
|
+
*
|
|
5
|
+
* A format is generated the first time it is shown and kept, so going back to one already seen is instant — the dialog
|
|
6
|
+
* is short-lived, and nothing in it edits the space. Nothing is generated for a free plan: the dialog says what export
|
|
7
|
+
* is instead, and the server would refuse the code anyway.
|
|
8
|
+
*/
|
|
9
|
+
declare const useExportSession: () => {
|
|
10
|
+
format: ExportFormat;
|
|
11
|
+
changeFormat: (next: ExportFormat) => void;
|
|
12
|
+
planName: string | undefined;
|
|
13
|
+
locked: boolean;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
error: string;
|
|
16
|
+
spaceExport: import('..').SpaceExport | undefined;
|
|
17
|
+
paths: string[];
|
|
18
|
+
selectedPath: string;
|
|
19
|
+
selectPath: import('react').Dispatch<import('react').SetStateAction<string | undefined>>;
|
|
20
|
+
content: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
export default useExportSession;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SpaceExport } from '../helpers/exportFiles';
|
|
2
|
+
import { ExportFormat } from '../helpers/exportFormats';
|
|
3
|
+
/** What an export came to: the files, or why there are none — the plan, or anything else. */
|
|
4
|
+
export type SpaceExportResult = {
|
|
5
|
+
ok: true;
|
|
6
|
+
spaceExport: SpaceExport;
|
|
7
|
+
} | {
|
|
8
|
+
ok: false;
|
|
9
|
+
error: string;
|
|
10
|
+
requiresPaidPlan: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Exports the space the builder is showing, as it is on screen.
|
|
14
|
+
*
|
|
15
|
+
* The documents are the builder's own — the schema and the style it is editing — so the export is what the person sees,
|
|
16
|
+
* not the last copy something else saved. JSON is written here, from data the builder already holds; the code is
|
|
17
|
+
* written by the server (`/utils/transform-to-authoring`), which holds the reader, the formatter, the check that the
|
|
18
|
+
* code authors the same space, and the plan gate. Anything that needs the space as files calls this.
|
|
19
|
+
*/
|
|
20
|
+
declare const useSpaceExport: () => {
|
|
21
|
+
exportSpace: (format: ExportFormat) => Promise<SpaceExportResult>;
|
|
22
|
+
};
|
|
23
|
+
export default useSpaceExport;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as ExportSpace } from './ExportSpace';
|
|
2
|
+
export * from './ExportSpace';
|
|
3
|
+
export * from './helpers/exportFiles';
|
|
4
|
+
export * from './helpers/exportFormats';
|
|
5
|
+
export { default as useSpaceExport } from './hooks/useSpaceExport';
|
|
6
|
+
export type { SpaceExportResult } from './hooks/useSpaceExport';
|
|
7
|
+
export default ExportSpace;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DisplayMode, Element, ReducerActionOrigin, SchemaVariable, Segment, Style, StyleItem, TagType, DropPosition, StyleVariableCategory, StyleVariableValue, StyleCategory,
|
|
1
|
+
import { DisplayMode, Element, ReducerActionOrigin, SchemaVariable, Segment, Style, StyleItem, TagType, DropPosition, StyleVariableCategory, StyleVariableValue, StyleCategory, StyleTarget } from '@plitzi/sdk-shared';
|
|
2
2
|
export declare const SegmentsActions: {
|
|
3
3
|
readonly SEGMENTS_ADD: "SEGMENTS_ADD";
|
|
4
4
|
readonly SEGMENTS_UPDATE: "SEGMENTS_UPDATE";
|
|
@@ -80,23 +80,15 @@ export type SegmentsReducerActions = ({
|
|
|
80
80
|
selectorType: TagType;
|
|
81
81
|
path?: StyleCategory;
|
|
82
82
|
value?: StyleItem['attributes'];
|
|
83
|
-
params:
|
|
84
|
-
componentType?: string;
|
|
85
|
-
styleSelector?: string;
|
|
86
|
-
styleState?: StyleState;
|
|
87
|
-
styleVariant?: string;
|
|
88
|
-
};
|
|
83
|
+
params: StyleTarget;
|
|
89
84
|
} & SegmentsReducerActionsBase) | ({
|
|
90
85
|
type: 'SEGMENTS_STYLE_UPDATE_SELECTOR';
|
|
91
86
|
displayMode: DisplayMode;
|
|
92
87
|
selector: string;
|
|
93
88
|
path?: StyleCategory;
|
|
94
89
|
value?: StyleItem['attributes'];
|
|
95
|
-
params: {
|
|
96
|
-
componentType?: string;
|
|
90
|
+
params: StyleTarget & {
|
|
97
91
|
styleSelector: string;
|
|
98
|
-
styleState?: StyleState;
|
|
99
|
-
styleVariant?: string;
|
|
100
92
|
};
|
|
101
93
|
} & SegmentsReducerActionsBase) | ({
|
|
102
94
|
type: 'SEGMENTS_STYLE_REMOVE_SELECTOR';
|
package/dist/package.json.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
"name": "@plitzi/plitzi-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.1",
|
|
4
4
|
"homepage": "./",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"files": [
|
|
@@ -32,6 +32,7 @@ declare const _default: {
|
|
|
32
32
|
"@plitzi/plitzi-sdk": "workspace:*",
|
|
33
33
|
"@plitzi/plitzi-ui": "^1.6.21",
|
|
34
34
|
"@plitzi/sdk-auth": "workspace:*",
|
|
35
|
+
"@plitzi/sdk-authoring": "workspace:*",
|
|
35
36
|
"@plitzi/sdk-dev-tools": "workspace:*",
|
|
36
37
|
"@plitzi/sdk-elements": "workspace:*",
|
|
37
38
|
"@plitzi/sdk-event-bridge": "workspace:*",
|