@superblocksteam/custom-components 1.14.2 → 2.0.3-next.57
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 +8 -9
- package/dist/exportedTypes.d.ts +1 -0
- package/dist/exportedTypes.d.ts.map +1 -0
- package/dist/exportedTypes.js +1 -0
- package/dist/exportedTypes.js.map +1 -0
- package/dist/hooksPlumbing.d.ts +1 -0
- package/dist/hooksPlumbing.d.ts.map +1 -0
- package/dist/hooksPlumbing.js +1 -0
- package/dist/hooksPlumbing.js.map +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -0
- package/dist/useSuperblocksContext.d.ts +1 -0
- package/dist/useSuperblocksContext.d.ts.map +1 -0
- package/dist/useSuperblocksContext.js +3 -2
- package/dist/useSuperblocksContext.js.map +1 -0
- package/dist/useSuperblocksIsLoading.d.ts +1 -0
- package/dist/useSuperblocksIsLoading.d.ts.map +1 -0
- package/dist/useSuperblocksIsLoading.js +3 -2
- package/dist/useSuperblocksIsLoading.js.map +1 -0
- package/dist/useSuperblocksWidgetSize.d.ts +2 -1
- package/dist/useSuperblocksWidgetSize.d.ts.map +1 -0
- package/dist/useSuperblocksWidgetSize.js +3 -2
- package/dist/useSuperblocksWidgetSize.js.map +1 -0
- package/package.json +27 -27
package/README.md
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
@superblocksteam/custom-components
|
|
2
|
-
=================
|
|
1
|
+
# @superblocksteam/custom-components
|
|
3
2
|
|
|
4
3
|
Provides utility functions to help develop custom components that can be used in Superblocks Applications.
|
|
5
4
|
|
|
6
5
|
## Usage
|
|
6
|
+
|
|
7
7
|
<!-- usage -->
|
|
8
|
+
|
|
8
9
|
```typescript
|
|
9
10
|
import React from "react";
|
|
10
11
|
import { useSuperblocksContext } from "@superblocksteam/custom-components";
|
|
11
12
|
import { type Props, type EventTriggers } from "./types";
|
|
12
13
|
|
|
13
|
-
export default function Component({
|
|
14
|
-
count,
|
|
15
|
-
}: Props) {
|
|
14
|
+
export default function Component({ count }: Props) {
|
|
16
15
|
const {
|
|
17
16
|
updateProperties,
|
|
18
|
-
events: {
|
|
19
|
-
onChange,
|
|
20
|
-
},
|
|
17
|
+
events: { onChange },
|
|
21
18
|
} = useSuperblocksContext<Props, EventTriggers>();
|
|
22
19
|
|
|
23
20
|
return (
|
|
@@ -26,7 +23,9 @@ export default function Component({
|
|
|
26
23
|
updateProperties({ count: count + 1 });
|
|
27
24
|
onChange();
|
|
28
25
|
}}
|
|
29
|
-
>
|
|
26
|
+
>
|
|
27
|
+
Increment
|
|
28
|
+
</button>
|
|
30
29
|
);
|
|
31
30
|
}
|
|
32
31
|
```
|
package/dist/exportedTypes.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportedTypes.d.ts","sourceRoot":"","sources":["../src/exportedTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/exportedTypes.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportedTypes.js","sourceRoot":"","sources":["../src/exportedTypes.ts"],"names":[],"mappings":""}
|
package/dist/hooksPlumbing.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooksPlumbing.d.ts","sourceRoot":"","sources":["../src/hooksPlumbing.ts"],"names":[],"mappings":"AAGA,UAAU,gBAAgB,CAAC,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,C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CAAC;IACJ,CAAC;IACD,OAAO;QACL,KAAK;QACL,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export * from "./exportedTypes";
|
|
2
|
-
export * from "./useSuperblocksContext";
|
|
3
|
-
export * from "./useSuperblocksIsLoading";
|
|
4
|
-
export * from "./useSuperblocksWidgetSize";
|
|
1
|
+
export * from "./exportedTypes.js";
|
|
2
|
+
export * from "./useSuperblocksContext.js";
|
|
3
|
+
export * from "./useSuperblocksIsLoading.js";
|
|
4
|
+
export * from "./useSuperblocksWidgetSize.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./exportedTypes"), exports);
|
|
18
|
-
__exportStar(require("./useSuperblocksContext"), exports);
|
|
19
|
-
__exportStar(require("./useSuperblocksIsLoading"), exports);
|
|
20
|
-
__exportStar(require("./useSuperblocksWidgetSize"), exports);
|
|
17
|
+
__exportStar(require("./exportedTypes.js"), exports);
|
|
18
|
+
__exportStar(require("./useSuperblocksContext.js"), exports);
|
|
19
|
+
__exportStar(require("./useSuperblocksIsLoading.js"), exports);
|
|
20
|
+
__exportStar(require("./useSuperblocksWidgetSize.js"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,6DAA2C;AAC3C,+DAA6C;AAC7C,gEAA8C"}
|
|
@@ -19,3 +19,4 @@ export interface SuperblocksContext<Props, EventTriggers> {
|
|
|
19
19
|
* @returns The Superblocks context object
|
|
20
20
|
*/
|
|
21
21
|
export declare function useSuperblocksContext<Props, EventTriggers>(): SuperblocksContext<Props, EventTriggers>;
|
|
22
|
+
//# sourceMappingURL=useSuperblocksContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSuperblocksContext.d.ts","sourceRoot":"","sources":["../src/useSuperblocksContext.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,KAAK,EAAE,aAAa;IACtD;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IAClD;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EACL,aAAa,KACV,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAG5C"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSuperblocksContext = useSuperblocksContext;
|
|
4
|
-
const
|
|
4
|
+
const hooksPlumbing_js_1 = require("./hooksPlumbing.js");
|
|
5
5
|
/**
|
|
6
6
|
* A React hook that can be used to get the Superblocks context object that contains methods that enable custom components
|
|
7
7
|
* to interact with the Superblocks Application.
|
|
8
8
|
* @returns The Superblocks context object
|
|
9
9
|
*/
|
|
10
10
|
function useSuperblocksContext() {
|
|
11
|
-
const { ccRenderingContext } = (0,
|
|
11
|
+
const { ccRenderingContext } = (0, hooksPlumbing_js_1.useHooksInternalContext)();
|
|
12
12
|
return ccRenderingContext.superblocksContext;
|
|
13
13
|
}
|
|
14
|
+
//# sourceMappingURL=useSuperblocksContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSuperblocksContext.js","sourceRoot":"","sources":["../src/useSuperblocksContext.ts"],"names":[],"mappings":";;AAuBA,sDAMC;AA7BD,yDAA6D;AAkB7D;;;;GAIG;AACH,SAAgB,qBAAqB;IAInC,MAAM,EAAE,kBAAkB,EAAE,GAAG,IAAA,0CAAuB,GAAE,CAAC;IACzD,OAAO,kBAAkB,CAAC,kBAAkB,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSuperblocksIsLoading.d.ts","sourceRoot":"","sources":["../src/useSuperblocksIsLoading.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAajD"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSuperblocksIsLoading = useSuperblocksIsLoading;
|
|
4
|
-
const
|
|
4
|
+
const hooksPlumbing_js_1 = require("./hooksPlumbing.js");
|
|
5
5
|
/**
|
|
6
6
|
* A React hook that returns a boolean that indicates whether the current custom component depends on any data that is
|
|
7
7
|
* currently being loaded. This can be used to show a loading indicator in your custom component.
|
|
8
8
|
*/
|
|
9
9
|
function useSuperblocksIsLoading() {
|
|
10
|
-
const { React, ccRenderingContext } = (0,
|
|
10
|
+
const { React, ccRenderingContext } = (0, hooksPlumbing_js_1.useHooksInternalContext)();
|
|
11
11
|
const [isLoading, setIsLoading] = React.useState(ccRenderingContext.isLoadingRef.current);
|
|
12
12
|
// we need to subscribe to changes immediately, so use `useLayoutEffect` to subscribe right after the render phase is finished
|
|
13
13
|
React.useLayoutEffect(() => {
|
|
@@ -18,3 +18,4 @@ function useSuperblocksIsLoading() {
|
|
|
18
18
|
}, []);
|
|
19
19
|
return isLoading;
|
|
20
20
|
}
|
|
21
|
+
//# sourceMappingURL=useSuperblocksIsLoading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSuperblocksIsLoading.js","sourceRoot":"","sources":["../src/useSuperblocksIsLoading.ts"],"names":[],"mappings":";;AAMA,0DAaC;AAnBD,yDAA6D;AAE7D;;;GAGG;AACH,SAAgB,uBAAuB;IACrC,MAAM,EAAE,KAAK,EAAE,kBAAkB,EAAE,GAAG,IAAA,0CAAuB,GAAE,CAAC;IAChE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAC9C,kBAAkB,CAAC,YAAY,CAAC,OAAO,CACxC,CAAC;IACF,8HAA8H;IAC9H,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE;QACzB,kBAAkB,CAAC,oBAAoB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1D,OAAO,GAAG,EAAE;YACV,kBAAkB,CAAC,oBAAoB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC/D,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { WidgetSize } from "./hooksPlumbing";
|
|
1
|
+
import { WidgetSize } from "./hooksPlumbing.js";
|
|
2
2
|
export { WidgetSize };
|
|
3
3
|
/**
|
|
4
4
|
* A React hook that returns the size of the area that is available for the custom component to render in. Calling this
|
|
5
5
|
* hook will cause your custom component to be re-rendered whenever that size changes.
|
|
6
6
|
*/
|
|
7
7
|
export declare function useSuperblocksWidgetSize(): WidgetSize;
|
|
8
|
+
//# sourceMappingURL=useSuperblocksWidgetSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSuperblocksWidgetSize.d.ts","sourceRoot":"","sources":["../src/useSuperblocksWidgetSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,UAAU,CAarD"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSuperblocksWidgetSize = useSuperblocksWidgetSize;
|
|
4
|
-
const
|
|
4
|
+
const hooksPlumbing_js_1 = require("./hooksPlumbing.js");
|
|
5
5
|
/**
|
|
6
6
|
* A React hook that returns the size of the area that is available for the custom component to render in. Calling this
|
|
7
7
|
* hook will cause your custom component to be re-rendered whenever that size changes.
|
|
8
8
|
*/
|
|
9
9
|
function useSuperblocksWidgetSize() {
|
|
10
|
-
const { React, ccRenderingContext } = (0,
|
|
10
|
+
const { React, ccRenderingContext } = (0, hooksPlumbing_js_1.useHooksInternalContext)();
|
|
11
11
|
const [widgetSize, setWidgetSize] = React.useState(ccRenderingContext.widgetSizeRef.current);
|
|
12
12
|
// we need to subscribe to changes immediately, so use `useLayoutEffect` to subscribe right after the render phase is finished
|
|
13
13
|
React.useLayoutEffect(() => {
|
|
@@ -18,3 +18,4 @@ function useSuperblocksWidgetSize() {
|
|
|
18
18
|
}, []);
|
|
19
19
|
return widgetSize;
|
|
20
20
|
}
|
|
21
|
+
//# sourceMappingURL=useSuperblocksWidgetSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSuperblocksWidgetSize.js","sourceRoot":"","sources":["../src/useSuperblocksWidgetSize.ts"],"names":[],"mappings":";;AAQA,4DAaC;AArBD,yDAAyE;AAIzE;;;GAGG;AACH,SAAgB,wBAAwB;IACtC,MAAM,EAAE,KAAK,EAAE,kBAAkB,EAAE,GAAG,IAAA,0CAAuB,GAAE,CAAC;IAChE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAChD,kBAAkB,CAAC,aAAa,CAAC,OAAO,CACzC,CAAC;IACF,8HAA8H;IAC9H,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE;QACzB,kBAAkB,CAAC,qBAAqB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC5D,OAAO,GAAG,EAAE;YACV,kBAAkB,CAAC,qBAAqB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACjE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/custom-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.3-next.57",
|
|
4
4
|
"description": "Official Superblocks SDK for developing custom components",
|
|
5
5
|
"homepage": "https://www.superblocks.com/",
|
|
6
|
-
"keywords": [
|
|
7
|
-
"superblocks"
|
|
8
|
-
],
|
|
9
6
|
"license": "Superblocks Community Software License",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=20.0.0",
|
|
9
|
+
"npm": ">=9.0.0"
|
|
10
|
+
},
|
|
10
11
|
"main": "dist/index.js",
|
|
11
12
|
"types": "dist/index.d.ts",
|
|
12
13
|
"files": [
|
|
13
14
|
"/dist"
|
|
14
15
|
],
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
16
|
+
"keywords": [
|
|
17
|
+
"superblocks"
|
|
18
|
+
],
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@superblocksteam/util": "2.0.3-next.57",
|
|
21
|
+
"tslib": "^2.6.1"
|
|
18
22
|
},
|
|
19
23
|
"devDependencies": {
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
21
|
-
"@typescript-eslint/parser": "^
|
|
22
|
-
"eslint": "^
|
|
23
|
-
"eslint-config-prettier": "
|
|
24
|
-
"eslint-plugin-import": "2.
|
|
25
|
-
"eslint-plugin-
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
25
|
+
"@typescript-eslint/parser": "^8.25.0",
|
|
26
|
+
"eslint": "^9.21.0",
|
|
27
|
+
"eslint-config-prettier": "10.0.2",
|
|
28
|
+
"eslint-plugin-import": "2.31.0",
|
|
29
|
+
"eslint-plugin-mocha": "^10.5.0",
|
|
30
|
+
"eslint-plugin-prettier": "5.2.3",
|
|
26
31
|
"eslint-plugin-unicorn": "^47.0.0",
|
|
27
|
-
"prettier": "^
|
|
28
|
-
"typescript": "^5.1.6"
|
|
29
|
-
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"tslib": "^2.6.1",
|
|
32
|
-
"@superblocksteam/util": "1.14.2"
|
|
32
|
+
"prettier": "^3.5.3",
|
|
33
|
+
"typescript": "^5.1.6",
|
|
34
|
+
"typescript-eslint": "^8.18.0"
|
|
33
35
|
},
|
|
34
36
|
"scripts": {
|
|
35
|
-
"preinstall": "node -e \"if (process.versions.node.split('.')[0] < 20) { console.error('Incompatible Node version: Please use Node.js v16 or higher'); process.exit(1);}\"",
|
|
36
|
-
"dev": "tsc --watch",
|
|
37
37
|
"build": "tsc --build",
|
|
38
|
-
"
|
|
39
|
-
"clean
|
|
40
|
-
"
|
|
41
|
-
"lint
|
|
42
|
-
"
|
|
43
|
-
"
|
|
38
|
+
"check": "pnpm run lint && pnpm run typecheck",
|
|
39
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
40
|
+
"dev": "tsc --build --watch",
|
|
41
|
+
"lint": "eslint . --ext .ts --config eslint.config.js",
|
|
42
|
+
"lint:fix": "eslint . --ext .ts --config eslint.config.js --fix",
|
|
43
|
+
"typecheck": "tsc --noEmit"
|
|
44
44
|
}
|
|
45
45
|
}
|