-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b30a68b
commit 75d7e62
Showing
7 changed files
with
119 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @typedef {import("@farjs/blessed").Widgets.BlessedElement} BlessedElement | ||
*/ | ||
import PanelStack from "./PanelStack.mjs"; | ||
|
||
/** | ||
* @typedef {{ | ||
* readonly stack: PanelStack; | ||
* readonly input: BlessedElement; | ||
* }} WithStacksData | ||
*/ | ||
|
||
/** | ||
* @param {PanelStack} stack | ||
* @param {BlessedElement} [input] | ||
* @returns {WithStacksData} | ||
*/ | ||
function WithStacksData(stack, input) { | ||
return { stack, input: input ?? /** @type {BlessedElement} */ ({}) }; | ||
} | ||
|
||
export default WithStacksData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @typedef {import("./WithStacksProps.mjs").WithStacksProps} WithStacksProps | ||
*/ | ||
import React from "react"; | ||
import WithStacks from "./WithStacks.mjs"; | ||
|
||
const h = React.createElement; | ||
|
||
/** | ||
* Common test util. | ||
* | ||
* @param {React.ReactElement<any>} element | ||
* @param {WithStacksProps} props | ||
* @returns {React.ReactElement<any>} | ||
*/ | ||
const withStacksContext = (element, props) => { | ||
return h( | ||
WithStacks.Context.Provider, | ||
{ | ||
value: props, | ||
}, | ||
element | ||
); | ||
}; | ||
|
||
export default withStacksContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export default WithStacksData; | ||
export type WithStacksData = { | ||
readonly stack: PanelStack; | ||
readonly input: BlessedElement; | ||
}; | ||
export type BlessedElement = import("@farjs/blessed").Widgets.BlessedElement; | ||
/** | ||
* @typedef {{ | ||
* readonly stack: PanelStack; | ||
* readonly input: BlessedElement; | ||
* }} WithStacksData | ||
*/ | ||
/** | ||
* @param {PanelStack} stack | ||
* @param {BlessedElement} [input] | ||
* @returns {WithStacksData} | ||
*/ | ||
declare function WithStacksData(stack: PanelStack, input?: import("blessed").Widgets.BlessedElement | undefined): WithStacksData; | ||
import PanelStack from "./PanelStack.mjs"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default withStacksContext; | ||
export type WithStacksProps = import("./WithStacksProps.mjs").WithStacksProps; | ||
/** | ||
* Common test util. | ||
* | ||
* @param {React.ReactElement<any>} element | ||
* @param {WithStacksProps} props | ||
* @returns {React.ReactElement<any>} | ||
*/ | ||
declare function withStacksContext(element: React.ReactElement<any>, props: WithStacksProps): React.ReactElement<any>; | ||
import React from "react"; |