@rbxts/uiblox 0.1.29 → 0.1.30
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/out/ui/index.d.ts +3 -0
- package/out/ui/init.luau +1 -0
- package/out/ui/packages/errorBoundary/components/ErrorBoundary.d.ts +17 -0
- package/out/ui/packages/errorBoundary/components/ErrorBoundary.luau +46 -0
- package/out/ui/packages/errorBoundary/index.d.ts +4 -0
- package/out/ui/packages/errorBoundary/init.luau +8 -0
- package/out/ui/packages/index.d.ts +1 -0
- package/out/ui/packages/init.luau +3 -0
- package/package.json +1 -1
package/out/ui/index.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export * from "./constants/index";
|
|
|
2
2
|
export * from "./enums/index";
|
|
3
3
|
export { Divider } from "./packages/index";
|
|
4
4
|
export { DividerProps } from "./packages/index";
|
|
5
|
+
export { ErrorBoundary } from "./packages/index";
|
|
6
|
+
export { ErrorBoundaryProps } from "./packages/index";
|
|
7
|
+
export { ErrorBoundaryState } from "./packages/index";
|
|
5
8
|
export { Icon } from "./packages/index";
|
|
6
9
|
export { IconProps } from "./packages/index";
|
|
7
10
|
export { IconButton } from "./packages/index";
|
package/out/ui/init.luau
CHANGED
|
@@ -8,6 +8,7 @@ for _k, _v in TS.import(script, script, "enums") or {} do
|
|
|
8
8
|
exports[_k] = _v
|
|
9
9
|
end
|
|
10
10
|
exports.Divider = TS.import(script, script, "packages").Divider
|
|
11
|
+
exports.ErrorBoundary = TS.import(script, script, "packages").ErrorBoundary
|
|
11
12
|
exports.Icon = TS.import(script, script, "packages").Icon
|
|
12
13
|
exports.IconButton = TS.import(script, script, "packages").IconButton
|
|
13
14
|
exports.Input = TS.import(script, script, "packages").Input
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { Component, ErrorInfo } from "@rbxts/react";
|
|
2
|
+
export interface ErrorBoundaryProps {
|
|
3
|
+
fallback?: (error: unknown) => React.Element;
|
|
4
|
+
}
|
|
5
|
+
export interface ErrorBoundaryState {
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
message?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
10
|
+
state: ErrorBoundaryState;
|
|
11
|
+
componentDidCatch(message: unknown, info: ErrorInfo): void;
|
|
12
|
+
render(): boolean | ReadonlyMap<React.Key, React.ReactNode> | {
|
|
13
|
+
readonly [key: string]: React.ReactNode;
|
|
14
|
+
readonly [key: number]: React.ReactNode;
|
|
15
|
+
} | readonly React.ReactNode[] | JSX.Element | undefined;
|
|
16
|
+
}
|
|
17
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local Component = _react.Component
|
|
6
|
+
local ReactComponent = _react.ReactComponent
|
|
7
|
+
local ErrorBoundary
|
|
8
|
+
do
|
|
9
|
+
local super = Component
|
|
10
|
+
ErrorBoundary = setmetatable({}, {
|
|
11
|
+
__tostring = function()
|
|
12
|
+
return "ErrorBoundary"
|
|
13
|
+
end,
|
|
14
|
+
__index = super,
|
|
15
|
+
})
|
|
16
|
+
ErrorBoundary.__index = ErrorBoundary
|
|
17
|
+
function ErrorBoundary.new(...)
|
|
18
|
+
local self = setmetatable({}, ErrorBoundary)
|
|
19
|
+
return self:constructor(...) or self
|
|
20
|
+
end
|
|
21
|
+
function ErrorBoundary:constructor(...)
|
|
22
|
+
super.constructor(self, ...)
|
|
23
|
+
self.state = {
|
|
24
|
+
hasError = false,
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
function ErrorBoundary:componentDidCatch(message, info)
|
|
28
|
+
warn(message, info.componentStack)
|
|
29
|
+
self:setState({
|
|
30
|
+
hasError = true,
|
|
31
|
+
message = `{message} {info.componentStack}`,
|
|
32
|
+
})
|
|
33
|
+
end
|
|
34
|
+
function ErrorBoundary:render()
|
|
35
|
+
if self.state.hasError then
|
|
36
|
+
return if self.props.fallback ~= nil then self.props.fallback(self.state.message) else React.createElement(React.Fragment)
|
|
37
|
+
end
|
|
38
|
+
return self.props.children
|
|
39
|
+
end
|
|
40
|
+
ErrorBoundary = ReactComponent(ErrorBoundary) or ErrorBoundary
|
|
41
|
+
end
|
|
42
|
+
local default = ErrorBoundary
|
|
43
|
+
return {
|
|
44
|
+
ErrorBoundary = ErrorBoundary,
|
|
45
|
+
default = default,
|
|
46
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
exports.ErrorBoundary = TS.import(script, script, "components", "ErrorBoundary").default
|
|
5
|
+
for _k, _v in TS.import(script, script, "components", "ErrorBoundary") or {} do
|
|
6
|
+
exports[_k] = _v
|
|
7
|
+
end
|
|
8
|
+
return exports
|
|
@@ -4,6 +4,9 @@ local exports = {}
|
|
|
4
4
|
for _k, _v in TS.import(script, script, "divider") or {} do
|
|
5
5
|
exports[_k] = _v
|
|
6
6
|
end
|
|
7
|
+
for _k, _v in TS.import(script, script, "errorBoundary") or {} do
|
|
8
|
+
exports[_k] = _v
|
|
9
|
+
end
|
|
7
10
|
for _k, _v in TS.import(script, script, "icon") or {} do
|
|
8
11
|
exports[_k] = _v
|
|
9
12
|
end
|