@superblocksteam/util 0.0.21 → 0.0.22
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/dist/events.d.ts +9 -0
- package/dist/events.js +13 -0
- package/dist/file-uploader.d.ts +1 -0
- package/dist/file-uploader.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types.d.ts +45 -1
- package/dist/validation.js +2 -0
- package/package.json +1 -1
- package/src/events.ts +9 -0
- package/src/file-uploader.ts +2 -0
- package/src/index.ts +1 -0
- package/src/types.ts +47 -15
- package/src/validation.ts +2 -0
package/dist/events.d.ts
ADDED
package/dist/events.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComponentEvent = void 0;
|
|
4
|
+
var ComponentEvent;
|
|
5
|
+
(function (ComponentEvent) {
|
|
6
|
+
ComponentEvent["CREATE"] = "create";
|
|
7
|
+
ComponentEvent["INIT"] = "init";
|
|
8
|
+
ComponentEvent["LOGIN"] = "login";
|
|
9
|
+
ComponentEvent["MIGRATE"] = "migrate";
|
|
10
|
+
ComponentEvent["PULL"] = "pull";
|
|
11
|
+
ComponentEvent["REGISTER"] = "register";
|
|
12
|
+
ComponentEvent["UPLOAD"] = "upload";
|
|
13
|
+
})(ComponentEvent || (exports.ComponentEvent = ComponentEvent = {}));
|
package/dist/file-uploader.d.ts
CHANGED
package/dist/file-uploader.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBucketeerUrlFromSuperblocksUrl = void 0;
|
|
3
|
+
exports.getBucketeerUrlFromSuperblocksUrl = exports.COMPONENT_EVENT_HEADER = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
|
+
exports.COMPONENT_EVENT_HEADER = "x-superblocks-component-event";
|
|
5
6
|
// retrieves bucketeer base URL given the superblocks server base URL
|
|
6
7
|
const getBucketeerUrlFromSuperblocksUrl = (superblocksBaseUrl) => {
|
|
7
8
|
// if superblocks base URL is an EE, return bucketeer's dev URL
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./constants"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./component-configs"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./events"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./file-uploader"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./login"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./resource-configs"), exports);
|
package/dist/types.d.ts
CHANGED
|
@@ -2,25 +2,69 @@
|
|
|
2
2
|
import { type UUID } from "node:crypto";
|
|
3
3
|
import { type DataType } from "./data-types";
|
|
4
4
|
interface PropertiesPanelDisplay {
|
|
5
|
+
/**
|
|
6
|
+
* Determines what form item type is shown in the Superblocks properties panel.
|
|
7
|
+
*/
|
|
5
8
|
controlType: "text" | "js-expr" | "switch";
|
|
9
|
+
/**
|
|
10
|
+
* Determines form item label in the Superblocks properties panel.
|
|
11
|
+
*/
|
|
6
12
|
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Placeholder text appears as gray text in the properties panel. This only applies
|
|
15
|
+
* to text-like inputs.
|
|
16
|
+
*/
|
|
7
17
|
placeholder?: string;
|
|
18
|
+
/**
|
|
19
|
+
* This shows up in the popover as a user types into the properties panel.
|
|
20
|
+
* This is a documentation field that helps users understand what type of data is accepted
|
|
21
|
+
* by this property.
|
|
22
|
+
*/
|
|
8
23
|
exampleData?: string;
|
|
9
24
|
}
|
|
10
25
|
export interface Property {
|
|
11
26
|
path: string;
|
|
12
27
|
dataType: DataType;
|
|
28
|
+
/**
|
|
29
|
+
* The presence of this object determines whether or not this property
|
|
30
|
+
* shows up in the Superblocks properties panel.
|
|
31
|
+
**/
|
|
13
32
|
propertiesPanelDisplay?: PropertiesPanelDisplay;
|
|
33
|
+
/**
|
|
34
|
+
* A description of this property. This is used in the Superblocks properties panel
|
|
35
|
+
* as well as in the custom component's autocomplete.
|
|
36
|
+
**/
|
|
14
37
|
description?: string;
|
|
38
|
+
/**
|
|
39
|
+
* By default, all your properties are readable from anywhere in Superblocks using dot notation
|
|
40
|
+
* (e.g. `myComponent.myProperty`). If you want to hide a property from the outside world,
|
|
41
|
+
* set this to false
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
isExternallyReadable?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* By default, all properties can have be used with Set Component Property and Reset Component to Default.
|
|
47
|
+
* @default true
|
|
48
|
+
**/
|
|
49
|
+
isExternallySettable?: boolean;
|
|
15
50
|
}
|
|
16
51
|
export interface ComponentConfig {
|
|
17
52
|
id: UUID;
|
|
53
|
+
/**
|
|
54
|
+
* @example: "myComponent"
|
|
55
|
+
*/
|
|
18
56
|
name: string;
|
|
57
|
+
/**
|
|
58
|
+
* @example "My Component"
|
|
59
|
+
*/
|
|
19
60
|
displayName: string;
|
|
61
|
+
/**
|
|
62
|
+
* @example "components/myComponent/component.tsx"
|
|
63
|
+
*/
|
|
20
64
|
componentPath: string;
|
|
21
65
|
properties: Property[];
|
|
22
66
|
/**
|
|
23
|
-
*
|
|
67
|
+
* @example [{
|
|
24
68
|
* label: "On Click",
|
|
25
69
|
* path: "onClick",
|
|
26
70
|
* }]
|
package/dist/validation.js
CHANGED
package/package.json
CHANGED
package/src/events.ts
ADDED
package/src/file-uploader.ts
CHANGED
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -2,19 +2,27 @@ import { type UUID } from "node:crypto";
|
|
|
2
2
|
import { type DataType } from "./data-types";
|
|
3
3
|
|
|
4
4
|
interface PropertiesPanelDisplay {
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Determines what form item type is shown in the Superblocks properties panel.
|
|
7
|
+
*/
|
|
6
8
|
controlType: "text" | "js-expr" | "switch";
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Determines form item label in the Superblocks properties panel.
|
|
12
|
+
*/
|
|
9
13
|
label: string;
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Placeholder text appears as gray text in the properties panel. This only applies
|
|
17
|
+
* to text-like inputs.
|
|
18
|
+
*/
|
|
13
19
|
placeholder?: string;
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* This shows up in the popover as a user types into the properties panel.
|
|
23
|
+
* This is a documentation field that helps users understand what type of data is accepted
|
|
24
|
+
* by this property.
|
|
25
|
+
*/
|
|
18
26
|
exampleData?: string;
|
|
19
27
|
}
|
|
20
28
|
|
|
@@ -22,31 +30,55 @@ export interface Property {
|
|
|
22
30
|
path: string;
|
|
23
31
|
dataType: DataType;
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The presence of this object determines whether or not this property
|
|
35
|
+
* shows up in the Superblocks properties panel.
|
|
36
|
+
**/
|
|
27
37
|
propertiesPanelDisplay?: PropertiesPanelDisplay;
|
|
28
38
|
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
/**
|
|
40
|
+
* A description of this property. This is used in the Superblocks properties panel
|
|
41
|
+
* as well as in the custom component's autocomplete.
|
|
42
|
+
**/
|
|
31
43
|
description?: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* By default, all your properties are readable from anywhere in Superblocks using dot notation
|
|
47
|
+
* (e.g. `myComponent.myProperty`). If you want to hide a property from the outside world,
|
|
48
|
+
* set this to false
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
isExternallyReadable?: boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* By default, all properties can have be used with Set Component Property and Reset Component to Default.
|
|
55
|
+
* @default true
|
|
56
|
+
**/
|
|
57
|
+
isExternallySettable?: boolean;
|
|
32
58
|
}
|
|
33
59
|
|
|
34
60
|
export interface ComponentConfig {
|
|
35
61
|
id: UUID;
|
|
36
62
|
|
|
37
|
-
|
|
63
|
+
/**
|
|
64
|
+
* @example: "myComponent"
|
|
65
|
+
*/
|
|
38
66
|
name: string;
|
|
39
67
|
|
|
40
|
-
|
|
68
|
+
/**
|
|
69
|
+
* @example "My Component"
|
|
70
|
+
*/
|
|
41
71
|
displayName: string;
|
|
42
72
|
|
|
43
|
-
|
|
73
|
+
/**
|
|
74
|
+
* @example "components/myComponent/component.tsx"
|
|
75
|
+
*/
|
|
44
76
|
componentPath: string;
|
|
45
77
|
|
|
46
78
|
properties: Property[];
|
|
47
79
|
|
|
48
80
|
/**
|
|
49
|
-
*
|
|
81
|
+
* @example [{
|
|
50
82
|
* label: "On Click",
|
|
51
83
|
* path: "onClick",
|
|
52
84
|
* }]
|
package/src/validation.ts
CHANGED