-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.cjs.map
1 lines (1 loc) · 3.16 KB
/
index.cjs.map
1
{"version":3,"file":"index.cjs","sources":["index.jsx"],"sourcesContent":["import * as readline from 'node:readline';\nimport React, { useState, useEffect } from 'react';\nimport { Box, render, Text, useFocus, useFocusManager, useInput } from 'ink';\n\nreadline.emitKeypressEvents(process.stdin);\n\nprocess.stdin.on('keypress', function (str, key) {\n if (key && key.name === 'q') {\n process.stdin.pause();\n }\n});\nprocess.stdin.setRawMode(true);\n\nfunction Item(props) {\n const { id, label } = props;\n const { isFocused } = useFocus({ id });\n\n return (\n <Text inverse={isFocused}>{label}</Text>\n );\n}\n\nfunction App() {\n const { focus } = useFocusManager();\n\n useInput((input) => {\n switch (input) {\n case '1':\n focus('item-1');\n break;\n case '2':\n focus('item-2');\n break;\n case '3':\n focus('item-3');\n break;\n }\n });\n\n return (\n <Box width=\"100%\" height=\"100%\" flexDirection=\"column\">\n <Text>Press 1, 2 or 3 to focus an item. Press Tab to focus next item. Press q to exit.</Text>\n <Item id=\"item-1\" label=\"Item 1\" />\n <Item id=\"item-2\" label=\"Item 2\" />\n <Item id=\"item-3\" label=\"Item 3\" />\n </Box>\n );\n}\n\nrender(<App />);\n"],"names":["readline","emitKeypressEvents","process","stdin","on","str","key","name","pause","setRawMode","Item","props","id","label","isFocused","useFocus","React","createElement","Text","inverse","App","focus","useFocusManager","useInput","input","Box","width","height","flexDirection","render"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIAA,mBAAQ,CAACC,kBAAkB,CAACC,OAAO,CAACC,KAAK,CAAC,CAAA;AAE1CD,OAAO,CAACC,KAAK,CAACC,EAAE,CAAC,UAAU,EAAE,UAAUC,GAAG,EAAEC,GAAG,EAAE;AAC/C,EAAA,IAAIA,GAAG,IAAIA,GAAG,CAACC,IAAI,KAAK,GAAG,EAAE;AAC3BL,IAAAA,OAAO,CAACC,KAAK,CAACK,KAAK,EAAE,CAAA;AACvB,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