@plitzi/plitzi-builder 0.32.25 → 0.33.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 +41 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.html +4 -3
- package/dist/modules/App/AppContainer/containers/ContainerConnectors.d.ts +2 -0
- package/dist/modules/App/AppContainer/containers/ContainerCredentials.d.ts +2 -0
- package/dist/modules/App/AppProvider.d.ts +1 -2
- package/dist/modules/Builder/components/BuilderElementTools/ElementSettings.d.ts +5 -1
- package/dist/modules/Collaboration/CollaborationHelper.d.ts +53 -0
- package/dist/modules/Collaboration/components/CollaboratorArea/CollaboratorArea.d.ts +16 -0
- package/dist/modules/Collaboration/components/CollaboratorArea/CollaboratorCursor.d.ts +9 -0
- package/dist/modules/Collaboration/components/CollaboratorArea/index.d.ts +3 -0
- package/dist/modules/Collaboration/components/CollaboratorAvatar/CollaboratorAvatar.d.ts +10 -0
- package/dist/modules/Collaboration/components/CollaboratorAvatar/index.d.ts +3 -0
- package/dist/modules/Collaboration/hooks/useCollaboratorCursor.d.ts +22 -0
- package/dist/modules/Collaboration/hooks/useCollaboratorElements.d.ts +8 -0
- package/dist/modules/Collaboration/hooks/useCollaborators.d.ts +17 -0
- package/dist/modules/Connectors/Connectors.d.ts +2 -0
- package/dist/modules/Connectors/ConnectorsContext.d.ts +13 -0
- package/dist/modules/Connectors/ConnectorsContextProvider.d.ts +14 -0
- package/dist/modules/Connectors/components/ConnectorAdvancedEditor/ConnectorAdvancedEditor.d.ts +14 -0
- package/dist/modules/Connectors/components/ConnectorAdvancedEditor/index.d.ts +2 -0
- package/dist/modules/Connectors/components/ConnectorBasicEditor/ConnectorBasicEditor.d.ts +7 -0
- package/dist/modules/Connectors/components/ConnectorBasicEditor/index.d.ts +2 -0
- package/dist/modules/Connectors/components/ConnectorEndpointEditor/ConnectorEndpointEditor.d.ts +20 -0
- package/dist/modules/Connectors/components/ConnectorEndpointEditor/index.d.ts +2 -0
- package/dist/modules/Connectors/components/ConnectorEndpointsEditor/ConnectorEndpointsEditor.d.ts +13 -0
- package/dist/modules/Connectors/components/ConnectorEndpointsEditor/index.d.ts +2 -0
- package/dist/modules/Connectors/components/ConnectorForm/ConnectorForm.d.ts +8 -0
- package/dist/modules/Connectors/components/ConnectorForm/index.d.ts +3 -0
- package/dist/modules/Connectors/components/ConnectorList/ConnectorList.d.ts +9 -0
- package/dist/modules/Connectors/components/ConnectorList/index.d.ts +3 -0
- package/dist/modules/Connectors/components/ConnectorSection/ConnectorSection.d.ts +24 -0
- package/dist/modules/Connectors/components/ConnectorSection/ConnectorSectionContext.d.ts +8 -0
- package/dist/modules/Connectors/components/ConnectorSection/index.d.ts +3 -0
- package/dist/modules/Connectors/components/FieldGrid/FieldGrid.d.ts +22 -0
- package/dist/modules/Connectors/components/FieldGrid/index.d.ts +2 -0
- package/dist/modules/Connectors/components/FieldHelp/FieldHelp.d.ts +11 -0
- package/dist/modules/Connectors/components/FieldHelp/index.d.ts +2 -0
- package/dist/modules/Connectors/components/TokenInput/TokenInput.d.ts +19 -0
- package/dist/modules/Connectors/components/TokenInput/index.d.ts +2 -0
- package/dist/modules/Connectors/helpers/manifestDoc.d.ts +41 -0
- package/dist/modules/Connectors/helpers/parseManifest.d.ts +17 -0
- package/dist/modules/Connectors/helpers/summarizeManifest.d.ts +18 -0
- package/dist/modules/Connectors/helpers/updateManifest.d.ts +23 -0
- package/dist/modules/Connectors/helpers/validateManifest.d.ts +15 -0
- package/dist/modules/Connectors/index.d.ts +4 -0
- package/dist/modules/Credentials/Credentials.d.ts +9 -0
- package/dist/modules/Credentials/index.d.ts +1 -0
- package/dist/modules/Navigation/NavigationProvider.d.ts +6 -0
- package/dist/modules/Network/NetworkSubscriptionsContextProvider.d.ts +4 -0
- package/dist/modules/Network/contexts/BuilderSubscriptionsContext.d.ts +3 -4
- package/dist/modules/Network/hooks/useSubscriptionsManager.d.ts +9 -9
- package/dist/modules/Space/Models/SpaceCredentialForm.d.ts +4 -0
- package/dist/modules/Space/helpers/buildCredentialData.d.ts +17 -0
- package/dist/package.json.d.ts +15 -16
- package/dist/plitzi-builder-dev-vendor.js.map +1 -1
- package/dist/plitzi-builder-dev-vendor.js.map.gz +0 -0
- package/dist/plitzi-builder.css +1 -1
- package/dist/plitzi-builder.css.gz +0 -0
- package/dist/plitzi-builder.js +2234 -3054
- package/dist/plitzi-builder.js.gz +0 -0
- package/package.json +27 -28
- package/dist/modules/App/AppContainer/containers/ContainerCollections.d.ts +0 -2
- package/dist/modules/Builder/components/BuilderCollaborator/BuilderCollaboratorArea.d.ts +0 -13
- package/dist/modules/Builder/components/BuilderCollaborator/BuilderCollaboratorCursor.d.ts +0 -9
- package/dist/modules/Builder/components/BuilderCollaborator/BuilderCollaboratorHeaderUser.d.ts +0 -9
- package/dist/modules/Builder/hooks/useNormalizedCursor.d.ts +0 -25
- package/dist/modules/Collection/CollectionContextProvider.d.ts +0 -8
- package/dist/modules/Collection/Collections.d.ts +0 -2
- package/dist/modules/Collection/Models/CollectionFieldForm.d.ts +0 -41
- package/dist/modules/Collection/Models/CollectionForm.d.ts +0 -13
- package/dist/modules/Collection/Models/CollectionRecordForm/CollectionRecordForm.d.ts +0 -14
- package/dist/modules/Collection/Models/CollectionRecordForm/CollectionRecordFormHelper.d.ts +0 -19
- package/dist/modules/Collection/Models/CollectionRecordForm/index.d.ts +0 -3
- package/dist/modules/Collection/components/Collection/Collection.d.ts +0 -9
- package/dist/modules/Collection/components/Collection/index.d.ts +0 -3
- package/dist/modules/Collection/components/CollectionContainer/CollectionContainer.d.ts +0 -10
- package/dist/modules/Collection/components/CollectionContainer/CollectionRecord.d.ts +0 -13
- package/dist/modules/Collection/components/CollectionContainer/CollectionRecords.d.ts +0 -10
- package/dist/modules/Collection/components/CollectionContainer/index.d.ts +0 -3
- package/dist/modules/Collection/components/CollectionField.d.ts +0 -11
- package/dist/modules/Collection/index.d.ts +0 -1
- package/dist/modules/Navigation/NavigationContextProvider.d.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @plitzi/plitzi-builder
|
|
2
2
|
|
|
3
|
+
## 0.33.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- v0.33.1
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @plitzi/plitzi-sdk@0.33.1
|
|
10
|
+
- @plitzi/sdk-auth@0.33.1
|
|
11
|
+
- @plitzi/sdk-dev-tools@0.33.1
|
|
12
|
+
- @plitzi/sdk-elements@0.33.1
|
|
13
|
+
- @plitzi/sdk-event-bridge@0.33.1
|
|
14
|
+
- @plitzi/sdk-interactions@0.33.1
|
|
15
|
+
- @plitzi/sdk-navigation@0.33.1
|
|
16
|
+
- @plitzi/sdk-plugins@0.33.1
|
|
17
|
+
- @plitzi/sdk-schema@0.33.1
|
|
18
|
+
- @plitzi/sdk-shared@0.33.1
|
|
19
|
+
- @plitzi/sdk-style@0.33.1
|
|
20
|
+
- @plitzi/sdk-variables@0.33.1
|
|
21
|
+
|
|
22
|
+
## 0.33.0
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- v0.33.0
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
- @plitzi/plitzi-sdk@0.33.0
|
|
32
|
+
- @plitzi/sdk-auth@0.33.0
|
|
33
|
+
- @plitzi/sdk-dev-tools@0.33.0
|
|
34
|
+
- @plitzi/sdk-elements@0.33.0
|
|
35
|
+
- @plitzi/sdk-event-bridge@0.33.0
|
|
36
|
+
- @plitzi/sdk-interactions@0.33.0
|
|
37
|
+
- @plitzi/sdk-navigation@0.33.0
|
|
38
|
+
- @plitzi/sdk-plugins@0.33.0
|
|
39
|
+
- @plitzi/sdk-schema@0.33.0
|
|
40
|
+
- @plitzi/sdk-shared@0.33.0
|
|
41
|
+
- @plitzi/sdk-style@0.33.0
|
|
42
|
+
- @plitzi/sdk-variables@0.33.0
|
|
43
|
+
|
|
3
44
|
## 0.32.25
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { default as ReplicaProvider } from '@plitzi/sdk-elements/Element/Replica
|
|
|
9
9
|
import { default as RootElement } from '@plitzi/sdk-elements/Element/RootElement';
|
|
10
10
|
import { default as ComponentContext } from '@plitzi/sdk-shared/elements/ComponentContext';
|
|
11
11
|
import { default as usePlitziServiceContext, PlitziServiceProvider } from '@plitzi/sdk-shared/hooks/usePlitziServiceContext';
|
|
12
|
+
import { useBuilderStore } from '@plitzi/sdk-shared/store';
|
|
12
13
|
import { AppProps } from './App';
|
|
13
14
|
import { ComponentPlugin, RenderMode, Server } from '@plitzi/sdk-shared';
|
|
14
15
|
import { ReactNode } from 'react';
|
|
@@ -33,5 +34,5 @@ declare const PlitziBuilder: {
|
|
|
33
34
|
Plugin: (_props: import('./modules/Builder/BuilderPlugin').BuilderPluginProps) => undefined;
|
|
34
35
|
};
|
|
35
36
|
export declare const version: string;
|
|
36
|
-
export { ComponentProvider, ComponentContext, usePlitziServiceContext, PlitziServiceProvider, RootElement, withElement, JsxManager, PluginManager, PluginRemote, ReplicaProvider, useElement, useRscData };
|
|
37
|
+
export { useBuilderStore, ComponentProvider, ComponentContext, usePlitziServiceContext, PlitziServiceProvider, RootElement, withElement, JsxManager, PluginManager, PluginRemote, ReplicaProvider, useElement, useRscData };
|
|
37
38
|
export default PlitziBuilder;
|
package/dist/index.html
CHANGED
|
@@ -57,10 +57,11 @@
|
|
|
57
57
|
'plitzi',
|
|
58
58
|
{
|
|
59
59
|
webKey:
|
|
60
|
-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
60
|
+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwib3JpZ2lucyI6WyJodHRwczovL3dlYnNpdGUucGxpdHppLmFwcCIsImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCIsImh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImh0dHA6Ly8xMjcuMC4wLjE6ODA4MCJdLCJpc3MiOiJodHRwczovL3NlcnZlci5wbGl0emkubG9jYWwiLCJhdWQiOlsiaHR0cHM6Ly9wbGl0emkubG9jYWwiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWwiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMCIsImh0dHBzOi8vYXBwLnBsaXR6aS5sb2NhbDozMDAxIiwiaHR0cHM6Ly9hcGkucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9zc3IucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9tY3AucGxpdHppLmxvY2FsIl0sInNjb3BlIjoic3BhY2U6cmVuZGVyIiwiaWF0IjoxNzg2NjU5NTg5LCJqdGkiOiJjMjRhZjMwN2Q1YTgzZmNjIiwibmJmIjoxNzg2NjU5NTg5fQ.q3-yIi5TmY8SLghX5q3jpN2qqsGJbDIF9dcVJvfLbfY',
|
|
61
|
+
// The actor. Without it the builder loads and every write is refused, since authorization is
|
|
62
|
+
// can(actor, space, permission). Both halves come from `yarn token 1 --user admin` in plitzi-sdk-server.
|
|
63
|
+
userKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiaXNzIjoiaHR0cHM6Ly9zZXJ2ZXIucGxpdHppLmxvY2FsIiwiYXVkIjpbImh0dHBzOi8vcGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsIiwiaHR0cHM6Ly9hcHAucGxpdHppLmxvY2FsOjMwMDAiLCJodHRwczovL2FwcC5wbGl0emkubG9jYWw6MzAwMSIsImh0dHBzOi8vYXBpLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc3NyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vc2VydmVyLnBsaXR6aS5sb2NhbCIsImh0dHBzOi8vbWNwLnBsaXR6aS5sb2NhbCJdLCJzY29wZSI6InVzZXIiLCJleHAiOjE3ODY3NDU5OTYsImlhdCI6MTc4NjY1OTU5NiwianRpIjoiNzYzOWUxNTAwN2RkMjE1OCIsIm5iZiI6MTc4NjY1OTU5Nn0.z4MIFGgjwsULzmWQx-ICM-R-GxovVYz8An4u2Vfcfms',
|
|
61
64
|
environment: 'main',
|
|
62
|
-
revision: 0,
|
|
63
|
-
renderMode: 'raw',
|
|
64
65
|
server: {
|
|
65
66
|
basePath: '',
|
|
66
67
|
// Dashboard
|
|
@@ -10,8 +10,7 @@ export type AppProviderProps = {
|
|
|
10
10
|
server: Server;
|
|
11
11
|
includeSubscriptions: boolean;
|
|
12
12
|
includeRealTime: boolean;
|
|
13
|
-
previewMode: boolean;
|
|
14
13
|
debugMode?: boolean;
|
|
15
14
|
};
|
|
16
|
-
declare const AppProvider: ({ children, instanceId, webKey, webId, environment, userKey, server, includeSubscriptions, includeRealTime,
|
|
15
|
+
declare const AppProvider: ({ children, instanceId, webKey, webId, environment, userKey, server, includeSubscriptions, includeRealTime, debugMode }: AppProviderProps) => import("react").JSX.Element;
|
|
17
16
|
export default AppProvider;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { ElementRuntime } from '@plitzi/sdk-shared';
|
|
1
2
|
export type ElementSettingsProps = {
|
|
2
3
|
id?: string;
|
|
3
4
|
type?: string;
|
|
4
5
|
attributes?: Record<string, unknown>;
|
|
6
|
+
/** Where the element resolves its data. Lives on the definition, not the attributes, but a provider's settings
|
|
7
|
+
* panel has to show and change it — everything else about that panel depends on which side is fetching. */
|
|
8
|
+
runtime?: ElementRuntime;
|
|
5
9
|
handleChange?: (key: string, value: string | boolean | number | object, isDefinition?: boolean) => void;
|
|
6
10
|
};
|
|
7
|
-
declare const ElementSettings: ({ id, type, attributes, handleChange }: ElementSettingsProps) => import("react").JSX.Element;
|
|
11
|
+
declare const ElementSettings: ({ id, type, attributes, runtime, handleChange }: ElementSettingsProps) => import("react").JSX.Element;
|
|
8
12
|
export default ElementSettings;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { SubscriptionCollaboratorElementState } from '@plitzi/sdk-shared';
|
|
2
|
+
/**
|
|
3
|
+
* The coordinate protocol between collaborators, both ends of it in one place.
|
|
4
|
+
*
|
|
5
|
+
* A pointer cannot travel as a coordinate. Peers differ in window size, zoom level and scroll offset, and the
|
|
6
|
+
* canvas lays the page out at whatever width it is given — a zoomed builder lays it out narrower — so the same
|
|
7
|
+
* pixel, and the same fraction of the viewport, is a different place on each screen. It travels anchored to an
|
|
8
|
+
* element instead: a ratio inside the box of the element nearest the pointer, plus a pixel delta when the
|
|
9
|
+
* pointer is outside that box. The receiver resolves the anchor against its own DOM, in the same canvas space
|
|
10
|
+
* the overlays use, so a collaborator's cursor and their selection box can never disagree.
|
|
11
|
+
*/
|
|
12
|
+
export type CollaboratorCursorAnchor = {
|
|
13
|
+
anchorId: string;
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
dx: number;
|
|
17
|
+
dy: number;
|
|
18
|
+
};
|
|
19
|
+
export type CollaboratorCursorPosition = {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
export type CollaboratorCursorContext = {
|
|
24
|
+
rootId: string;
|
|
25
|
+
containerDOM?: HTMLElement | null;
|
|
26
|
+
iframeDOM?: HTMLIFrameElement | null;
|
|
27
|
+
zoom?: number;
|
|
28
|
+
};
|
|
29
|
+
/** The element pair both ends agree on: the sender picks anchors with it, the receiver looks them up with it. */
|
|
30
|
+
declare const collaboratorAnchorSelector: (rootId: string) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Sender: turns a pointer event into the anchored position to broadcast. Returns the chosen anchor too, so the
|
|
33
|
+
* caller can feed it back as `previous` and keep the choice stable between frames.
|
|
34
|
+
*/
|
|
35
|
+
declare const readCursorAnchor: (event: PointerEvent, { selector, previous, scale }: {
|
|
36
|
+
selector: string;
|
|
37
|
+
previous?: HTMLElement | null;
|
|
38
|
+
scale?: number;
|
|
39
|
+
}) => {
|
|
40
|
+
anchorDOM: HTMLElement;
|
|
41
|
+
position: CollaboratorCursorAnchor;
|
|
42
|
+
} | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Receiver: places an anchored position on this canvas, in unzoomed content pixels — the space `processContainer`
|
|
45
|
+
* gives the overlays.
|
|
46
|
+
*/
|
|
47
|
+
declare const resolveCursorPosition: ({ anchorId, x, y, dx, dy }: Partial<CollaboratorCursorAnchor> & CollaboratorCursorPosition, { rootId, containerDOM, iframeDOM, zoom }: CollaboratorCursorContext) => CollaboratorCursorPosition | undefined;
|
|
48
|
+
/** What the collaborator had hovered/selected when the snapshot was taken, kept only for the root being edited. */
|
|
49
|
+
declare const resolveElementState: (elementState: SubscriptionCollaboratorElementState | undefined, rootId: string) => {
|
|
50
|
+
hovered: string | undefined;
|
|
51
|
+
selected: string | undefined;
|
|
52
|
+
};
|
|
53
|
+
export { collaboratorAnchorSelector, readCursorAnchor, resolveCursorPosition, resolveElementState };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DisplayMode, SubscriptionCollaboratorElementState } from '@plitzi/sdk-shared';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
export type CollaboratorAreaProps = {
|
|
4
|
+
baseElementId?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
debugMode?: boolean;
|
|
7
|
+
elementState?: SubscriptionCollaboratorElementState;
|
|
8
|
+
instanceId: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
refIframe: RefObject<HTMLIFrameElement | null>;
|
|
11
|
+
trackingContainerRef: RefObject<HTMLDivElement | null>;
|
|
12
|
+
zoom?: number;
|
|
13
|
+
displayMode?: DisplayMode;
|
|
14
|
+
};
|
|
15
|
+
declare const _default: import('react').MemoExoticComponent<({ baseElementId, color, debugMode, elementState, instanceId, title, refIframe, trackingContainerRef, zoom, displayMode }: CollaboratorAreaProps) => import("react").JSX.Element>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type CollaboratorCursorProps = {
|
|
3
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
4
|
+
title?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
zoom?: number;
|
|
7
|
+
};
|
|
8
|
+
declare const CollaboratorCursor: ({ ref, title, color, zoom }: CollaboratorCursorProps) => import("react").JSX.Element;
|
|
9
|
+
export default CollaboratorCursor;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type CollaboratorAvatarProps = {
|
|
3
|
+
ref?: RefObject<HTMLDivElement | null>;
|
|
4
|
+
color?: string;
|
|
5
|
+
firstName: string;
|
|
6
|
+
surName: string;
|
|
7
|
+
};
|
|
8
|
+
/** The collaborator's initials in their presence color, as shown in the app header. */
|
|
9
|
+
declare const CollaboratorAvatar: ({ ref, color, firstName, surName }: CollaboratorAvatarProps) => import("react").JSX.Element;
|
|
10
|
+
export default CollaboratorAvatar;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type UseCollaboratorCursorProps = {
|
|
2
|
+
rootId: string;
|
|
3
|
+
zoom?: number;
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Broadcasts this user's pointer over a canvas. Returns the props to spread on the canvas element; the whole
|
|
8
|
+
* lifecycle (enter, sampled moves, leave) lives here, so a caller never has to remember that a cursor left
|
|
9
|
+
* behind on a peer's screen stays there forever.
|
|
10
|
+
*/
|
|
11
|
+
declare const useCollaboratorCursor: ({ rootId, zoom, enabled }: UseCollaboratorCursorProps) => {
|
|
12
|
+
bind: () => {
|
|
13
|
+
onPointerEnter?: undefined;
|
|
14
|
+
onPointerLeave?: undefined;
|
|
15
|
+
onPointerMove?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
onPointerEnter(): void;
|
|
18
|
+
onPointerLeave(): void;
|
|
19
|
+
onPointerMove(e: React.PointerEvent): void;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default useCollaboratorCursor;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type UseCollaboratorElementsProps = {
|
|
2
|
+
rootId: string;
|
|
3
|
+
elementHovered?: string;
|
|
4
|
+
elementSelected?: string;
|
|
5
|
+
};
|
|
6
|
+
/** Broadcasts what this user has hovered/selected, which is what draws their overlays on everyone else's canvas. */
|
|
7
|
+
declare const useCollaboratorElements: ({ rootId, elementHovered, elementSelected }: UseCollaboratorElementsProps) => void;
|
|
8
|
+
export default useCollaboratorElements;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SubscriptionCollaborator } from '@plitzi/sdk-shared';
|
|
2
|
+
import { BuilderSubscriptionsContextValue } from '../../Network/contexts/BuilderSubscriptionsContext';
|
|
3
|
+
export type UseCollaboratorsProps = {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
instanceId: string;
|
|
6
|
+
registerCallback: BuilderSubscriptionsContextValue['subscriptionsRegisterCallback'];
|
|
7
|
+
unregisterCallback: BuilderSubscriptionsContextValue['subscriptionsUnregisterCallback'];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Keeps `collaboration.collaborators` in sync with the connection: the INIT snapshot plus the join/leave events.
|
|
11
|
+
* It writes to the store and reads nothing back, so presence changes never re-render the transport that carries
|
|
12
|
+
* them — and every surface that wants presence reads the store instead of being handed it.
|
|
13
|
+
*/
|
|
14
|
+
declare const useCollaborators: ({ enabled, instanceId, registerCallback, unregisterCallback }: UseCollaboratorsProps) => {
|
|
15
|
+
resetCollaborators: (incoming: SubscriptionCollaborator[]) => void;
|
|
16
|
+
};
|
|
17
|
+
export default useCollaborators;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ConnectorManifestDraft, SpaceConnector } from '@plitzi/sdk-shared';
|
|
2
|
+
export type ConnectorsContextValue = {
|
|
3
|
+
connectors: Record<string, SpaceConnector>;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
error: string;
|
|
6
|
+
/** True when the space has at least one deployment that can run server code, which is what resolves connectors. */
|
|
7
|
+
hasServerRendering: boolean;
|
|
8
|
+
addConnector: (name: string, manifest: ConnectorManifestDraft) => Promise<SpaceConnector | undefined>;
|
|
9
|
+
updateConnector: (identifier: string, name: string, manifest: ConnectorManifestDraft) => Promise<SpaceConnector | undefined>;
|
|
10
|
+
removeConnector: (identifier: string) => Promise<boolean>;
|
|
11
|
+
};
|
|
12
|
+
declare const ConnectorsContext: import('react').Context<ConnectorsContextValue>;
|
|
13
|
+
export default ConnectorsContext;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ConnectorsContextProviderProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Loads the space's connector manifests and keeps them in the builder store.
|
|
7
|
+
*
|
|
8
|
+
* They live in the store rather than in this context alone because the provider element's settings panel — which
|
|
9
|
+
* renders far from here, inside the element inspector — needs the connector list and each manifest's operators to
|
|
10
|
+
* offer a picker and typed filters. The store is editor state and is never serialized into the published schema,
|
|
11
|
+
* so putting endpoints there does not put them on a visitor's page.
|
|
12
|
+
*/
|
|
13
|
+
declare const ConnectorsContextProvider: ({ children }: ConnectorsContextProviderProps) => import("react").JSX.Element;
|
|
14
|
+
export default ConnectorsContextProvider;
|
package/dist/modules/Connectors/components/ConnectorAdvancedEditor/ConnectorAdvancedEditor.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ConnectorAdvancedEditorProps = {
|
|
2
|
+
value: string;
|
|
3
|
+
error?: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The manifest as the server stores it.
|
|
8
|
+
*
|
|
9
|
+
* The basic editor covers the fields a CMS connector actually needs; this is here for the provider that does not fit
|
|
10
|
+
* — an extra endpoint, a hand-written operator, a field the form has no control for. Both edit the same document,
|
|
11
|
+
* so switching modes is not a conversion.
|
|
12
|
+
*/
|
|
13
|
+
declare const ConnectorAdvancedEditor: ({ value, error, onChange }: ConnectorAdvancedEditorProps) => import("react").JSX.Element;
|
|
14
|
+
export default ConnectorAdvancedEditor;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConnectorManifestDraft } from '@plitzi/sdk-shared';
|
|
2
|
+
export type ConnectorBasicEditorProps = {
|
|
3
|
+
manifest: ConnectorManifestDraft;
|
|
4
|
+
onChange: (manifest: ConnectorManifestDraft) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const ConnectorBasicEditor: ({ manifest, onChange }: ConnectorBasicEditorProps) => import("react").JSX.Element;
|
|
7
|
+
export default ConnectorBasicEditor;
|
package/dist/modules/Connectors/components/ConnectorEndpointEditor/ConnectorEndpointEditor.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EndpointKind } from '../../helpers/updateManifest';
|
|
2
|
+
import { ConnectorReadEndpoint, ConnectorWriteEndpoint } from '@plitzi/sdk-shared';
|
|
3
|
+
export type ConnectorEndpointEditorProps = {
|
|
4
|
+
kind: EndpointKind;
|
|
5
|
+
name: string;
|
|
6
|
+
endpoint: ConnectorReadEndpoint | ConnectorWriteEndpoint;
|
|
7
|
+
onChange: (name: string, endpoint: ConnectorReadEndpoint | ConnectorWriteEndpoint) => void;
|
|
8
|
+
/** Returns false when the new name is empty or already taken, so the field can snap back. */
|
|
9
|
+
onRename: (from: string, to: string) => boolean;
|
|
10
|
+
onRemove: (name: string) => void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* One named request.
|
|
14
|
+
*
|
|
15
|
+
* Reads and writes share this editor because they are the same thing to an author — a method, a path, and how to
|
|
16
|
+
* read the answer — and differ only in which extra fields apply. Splitting them into two components would duplicate
|
|
17
|
+
* the path, query and header rows, which are where the templating lives.
|
|
18
|
+
*/
|
|
19
|
+
declare const ConnectorEndpointEditor: ({ kind, name, endpoint, onChange, onRename, onRemove }: ConnectorEndpointEditorProps) => import("react").JSX.Element;
|
|
20
|
+
export default ConnectorEndpointEditor;
|
package/dist/modules/Connectors/components/ConnectorEndpointsEditor/ConnectorEndpointsEditor.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ConnectorManifestDraft } from '@plitzi/sdk-shared';
|
|
2
|
+
export type ConnectorEndpointsEditorProps = {
|
|
3
|
+
manifest: ConnectorManifestDraft;
|
|
4
|
+
onChange: (manifest: ConnectorManifestDraft) => void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Every request the connector can make, read and write.
|
|
8
|
+
*
|
|
9
|
+
* Both sides are lists an author adds to, because a connector talks to a REST API and an API has as many operations
|
|
10
|
+
* as it has — one read called `list` and three CRUD writes is the CMS special case, not the model.
|
|
11
|
+
*/
|
|
12
|
+
declare const ConnectorEndpointsEditor: ({ manifest, onChange }: ConnectorEndpointsEditorProps) => import("react").JSX.Element;
|
|
13
|
+
export default ConnectorEndpointsEditor;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConnectorManifestDraft, SpaceConnector } from '@plitzi/sdk-shared';
|
|
2
|
+
export type ConnectorFormProps = {
|
|
3
|
+
connector?: SpaceConnector;
|
|
4
|
+
onSubmit: (name: string, manifest: ConnectorManifestDraft) => Promise<void> | void;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
};
|
|
7
|
+
declare const ConnectorForm: ({ connector, onSubmit, onCancel }: ConnectorFormProps) => import("react").JSX.Element;
|
|
8
|
+
export default ConnectorForm;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SpaceConnector } from '@plitzi/sdk-shared';
|
|
2
|
+
export type ConnectorListProps = {
|
|
3
|
+
connectors: SpaceConnector[];
|
|
4
|
+
onSelect: (identifier: string) => void;
|
|
5
|
+
onRemove: (identifier: string) => void;
|
|
6
|
+
onCreate: () => void;
|
|
7
|
+
};
|
|
8
|
+
declare const ConnectorList: ({ connectors, onSelect, onRemove, onCreate }: ConnectorListProps) => import("react").JSX.Element;
|
|
9
|
+
export default ConnectorList;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ConnectorSectionProps = {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
/** Shown on the collapsed header: what this section currently holds, in a few words. */
|
|
6
|
+
summary: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
/** Marks a collapsed section whose contents were customized, so nothing hides silently. */
|
|
9
|
+
highlight?: boolean;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* One collapsible block of the manifest form.
|
|
15
|
+
*
|
|
16
|
+
* A connector has more areas than anyone edits at once and a preset fills most of them correctly, so the panel
|
|
17
|
+
* opens with the ones an author actually touches and keeps the rest one click away. Each closed header carries a
|
|
18
|
+
* summary of its own value — collapsing that hid the information would only trade scrolling for clicking.
|
|
19
|
+
*
|
|
20
|
+
* The prose for each field is opt-in behind the header's `?`, because an explanation is read once and then becomes
|
|
21
|
+
* the thing standing between the author and the next field.
|
|
22
|
+
*/
|
|
23
|
+
declare const ConnectorSection: ({ id, title, summary, description, highlight, defaultOpen, children }: ConnectorSectionProps) => import("react").JSX.Element;
|
|
24
|
+
export default ConnectorSection;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ConnectorSectionContextValue = {
|
|
2
|
+
/** Whether the surrounding section is currently showing its field-level prose. */
|
|
3
|
+
showHelp: boolean;
|
|
4
|
+
/** How deep this section sits. Sections read it to indent and tint themselves relative to their parent. */
|
|
5
|
+
depth: number;
|
|
6
|
+
};
|
|
7
|
+
declare const ConnectorSectionContext: import('react').Context<ConnectorSectionContextValue>;
|
|
8
|
+
export default ConnectorSectionContext;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type FieldGridProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Fixed number of columns. Omitted, the grid fits as many as the width allows.
|
|
6
|
+
*
|
|
7
|
+
* A fixed count does not adapt, so it is for rows whose fields belong together and should stay aligned — pick it
|
|
8
|
+
* when the layout is part of the meaning, not to hand-tune a breakpoint.
|
|
9
|
+
*/
|
|
10
|
+
columns?: 1 | 2 | 3 | 4;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Flows short fields into columns.
|
|
15
|
+
*
|
|
16
|
+
* The Connectors panel renders in the main area, not in a 350px dock, so on a wide monitor a single column of
|
|
17
|
+
* full-width inputs leaves most of the screen empty and stretches every field far past the length of what goes in
|
|
18
|
+
* it. The default `auto-fill` handles that without breakpoints: one column in a narrow panel, three in a wide one,
|
|
19
|
+
* and nothing to keep in step with the popup's resize handle.
|
|
20
|
+
*/
|
|
21
|
+
declare const FieldGrid: ({ children, columns, className }: FieldGridProps) => import("react").JSX.Element;
|
|
22
|
+
export default FieldGrid;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type FieldHelpProps = {
|
|
2
|
+
children: string;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* The explanation for one field, shown only while its section has help turned on.
|
|
6
|
+
*
|
|
7
|
+
* The same text is always on the field as a `title`, so hovering answers the question without turning anything on.
|
|
8
|
+
* This is the version for someone meeting the form for the first time.
|
|
9
|
+
*/
|
|
10
|
+
declare const FieldHelp: ({ children }: FieldHelpProps) => import("react").JSX.Element | null;
|
|
11
|
+
export default FieldHelp;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ConnectorTokenScope } from '@plitzi/sdk-shared';
|
|
2
|
+
export type TokenInputProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
/** Hover text. The same line is available in full under the section's help toggle via `FieldHelp`. */
|
|
5
|
+
title?: string;
|
|
6
|
+
value: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
scope?: ConnectorTokenScope;
|
|
9
|
+
onChange: (value: string) => void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A one-line field that completes the engine's template tokens.
|
|
13
|
+
*
|
|
14
|
+
* Every value in a manifest is a template, and the tokens are the part an author cannot guess — the difference
|
|
15
|
+
* between `{{offset}}` and `{{page}}` decides whether paging works at all. Ctrl+Space (or typing a prefix) lists
|
|
16
|
+
* what this position accepts, which is why these are CodeMirror fields rather than plain inputs.
|
|
17
|
+
*/
|
|
18
|
+
declare const TokenInput: ({ label, title, value, placeholder, scope, onChange }: TokenInputProps) => import("react").JSX.Element;
|
|
19
|
+
export default TokenInput;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ConnectorPagination } from '@plitzi/sdk-shared';
|
|
2
|
+
export type PaginationDoc = {
|
|
3
|
+
value: ConnectorPagination;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* What each paging style means in the provider's own terms.
|
|
9
|
+
*
|
|
10
|
+
* The names come from the CMS vendors, not from Plitzi, and "offset" versus "page" is the single choice most likely
|
|
11
|
+
* to be picked wrong — both look like paging, and getting it backwards returns the first window forever. The
|
|
12
|
+
* descriptions name the token each style makes available so the choice and the query template stay connected.
|
|
13
|
+
*/
|
|
14
|
+
export declare const paginationDocs: PaginationDoc[];
|
|
15
|
+
/**
|
|
16
|
+
* One line per manifest field, in the terms of the thing being described rather than the JSON key.
|
|
17
|
+
*
|
|
18
|
+
* These are the questions an author actually has — "where do the records live in the response?" — and answering them
|
|
19
|
+
* in the panel is the difference between the basic editor being usable and being a prettier JSON editor.
|
|
20
|
+
*/
|
|
21
|
+
export declare const fieldDocs: {
|
|
22
|
+
readonly baseUrl: "Where the CMS lives, e.g. https://cms.example.com. Every path below is appended to it.";
|
|
23
|
+
readonly credential: "The secret this connector authenticates with. It is stored encrypted and resolved on the server; the manifest only ever names it.";
|
|
24
|
+
readonly authIn: "Whether the credential travels as a request header or as a query parameter.";
|
|
25
|
+
readonly authName: "The header or parameter name, e.g. Authorization.";
|
|
26
|
+
readonly authValue: "The value to send. Reference the secret as {{credential.token}} — never paste the token itself.";
|
|
27
|
+
readonly headers: "Extra headers sent with every request. Values accept the same tokens.";
|
|
28
|
+
readonly method: "HTTP method this endpoint expects. Reading is usually GET; a search endpoint often takes POST.";
|
|
29
|
+
readonly path: "Path appended to the base URL, with {{resource}} where the collection name goes, e.g. /api/{{resource}}.";
|
|
30
|
+
readonly listQuery: "Query parameters sent on every read. This is where paging tokens go, e.g. limit = {{limit}}.";
|
|
31
|
+
readonly writeQuery: "Query parameters sent with this write.";
|
|
32
|
+
readonly endpointHeaders: "Headers for this endpoint only, merged over the connection headers.";
|
|
33
|
+
readonly itemsPath: "Where the records array lives in the response, e.g. data. Leave empty if the response is the array.";
|
|
34
|
+
readonly totalPath: "Where the total record count lives, e.g. meta.pagination.total. Without it a pager can only offer next and previous.";
|
|
35
|
+
readonly idPath: "Where the id of each record lives, relative to the record. Defaults to id.";
|
|
36
|
+
readonly valuesPath: "Where the fields of each record live, relative to the record. Use . when the record itself holds them.";
|
|
37
|
+
readonly operators: "How this provider spells each comparison. The element picks an operator by name; this template turns it into a query parameter.";
|
|
38
|
+
readonly mediaBaseUrl: "Host to prepend to relative image and file URLs the CMS returns. Only values under keys ending in url, src or href are rewritten.";
|
|
39
|
+
readonly writeBodyPath: "Key to wrap the submitted values in, e.g. data. Leave empty to send them at the root.";
|
|
40
|
+
};
|
|
41
|
+
export declare const CONNECTOR_SERVER_ONLY_NOTE = "Connectors resolve on the server before the page reaches the browser. A space published without server rendering has no server to resolve them.";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ConnectorManifestDraft } from '@plitzi/sdk-shared';
|
|
2
|
+
export type ParseManifestResult = {
|
|
3
|
+
manifest: ConnectorManifestDraft;
|
|
4
|
+
error?: undefined;
|
|
5
|
+
} | {
|
|
6
|
+
manifest?: undefined;
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Reads the advanced editor's text back into a manifest.
|
|
11
|
+
*
|
|
12
|
+
* The basic editor can only produce a well-formed document; hand-typed JSON can produce anything, so the shape is
|
|
13
|
+
* checked before it reaches code that assumes it. `endpoints.read` is the one part with no default worth guessing:
|
|
14
|
+
* a connector that cannot say how to read records is not a connector.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseManifest: (value: string) => ParseManifestResult;
|
|
17
|
+
export default parseManifest;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ConnectorManifestDraft, ConnectorReadEndpoint, ConnectorWriteEndpoint } from '@plitzi/sdk-shared';
|
|
2
|
+
/**
|
|
3
|
+
* One short line per section, shown on its collapsed header.
|
|
4
|
+
*
|
|
5
|
+
* Collapsing is only an improvement if a closed section still answers "what is in there". Without these the panel
|
|
6
|
+
* trades a wall of fields for a wall of chevrons, and the author has to open all of them to check their own work.
|
|
7
|
+
*/
|
|
8
|
+
export declare const summarize: {
|
|
9
|
+
auth: (manifest: ConnectorManifestDraft) => string;
|
|
10
|
+
endpoints: (manifest: ConnectorManifestDraft) => string;
|
|
11
|
+
pagination: (manifest: ConnectorManifestDraft) => string;
|
|
12
|
+
filters: (manifest: ConnectorManifestDraft) => string;
|
|
13
|
+
media: (manifest: ConnectorManifestDraft) => string;
|
|
14
|
+
};
|
|
15
|
+
/** `GET /api/posts` — the request itself, which is what identifies an endpoint at a glance. */
|
|
16
|
+
export declare const summarizeEndpoint: (endpoint: ConnectorReadEndpoint | ConnectorWriteEndpoint) => string;
|
|
17
|
+
/** True when a read endpoint maps the response by hand, so a collapsed header can say it was customized. */
|
|
18
|
+
export declare const hasResponseMapping: (endpoint: ConnectorReadEndpoint) => boolean;
|