ink 3.0.7 → 3.2.0

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.
Files changed (58) hide show
  1. package/build/components/App.d.ts +1 -0
  2. package/build/components/App.js +19 -5
  3. package/build/components/App.js.map +1 -1
  4. package/build/components/FocusContext.d.ts +1 -0
  5. package/build/components/FocusContext.js +2 -1
  6. package/build/components/FocusContext.js.map +1 -1
  7. package/build/components/Static.d.ts +1 -1
  8. package/build/components/Text.d.ts +2 -2
  9. package/build/components/Text.js.map +1 -1
  10. package/build/{test.d.ts → devtools-window-polyfill.d.ts} +0 -0
  11. package/build/devtools-window-polyfill.js +72 -0
  12. package/build/devtools-window-polyfill.js.map +1 -0
  13. package/build/devtools.d.ts +1 -1
  14. package/build/devtools.js +2 -69
  15. package/build/devtools.js.map +1 -1
  16. package/build/hooks/use-focus-manager.d.ts +5 -0
  17. package/build/hooks/use-focus-manager.js +2 -1
  18. package/build/hooks/use-focus-manager.js.map +1 -1
  19. package/build/hooks/use-focus.d.ts +9 -1
  20. package/build/hooks/use-focus.js +7 -4
  21. package/build/hooks/use-focus.js.map +1 -1
  22. package/build/hooks/use-input.d.ts +1 -1
  23. package/build/hooks/use-input.js +1 -1
  24. package/build/ink.js +3 -1
  25. package/build/ink.js.map +1 -1
  26. package/build/output.js +3 -3
  27. package/build/output.js.map +1 -1
  28. package/build/reconciler.d.ts +1 -1
  29. package/build/reconciler.js +7 -4
  30. package/build/reconciler.js.map +1 -1
  31. package/package.json +12 -13
  32. package/readme.md +51 -7
  33. package/build/apply-styles.d.ts +0 -25
  34. package/build/apply-styles.js +0 -164
  35. package/build/apply-styles.js.map +0 -1
  36. package/build/build-layout.d.ts +0 -9
  37. package/build/build-layout.js +0 -63
  38. package/build/build-layout.js.map +0 -1
  39. package/build/calculate-wrapped-text.d.ts +0 -1
  40. package/build/calculate-wrapped-text.js +0 -34
  41. package/build/calculate-wrapped-text.js.map +0 -1
  42. package/build/components/Color.d.ts +0 -17
  43. package/build/components/Color.js +0 -91
  44. package/build/components/Color.js.map +0 -1
  45. package/build/components/DeprecatedStatic.d.ts +0 -33
  46. package/build/components/DeprecatedStatic.js +0 -84
  47. package/build/components/DeprecatedStatic.js.map +0 -1
  48. package/build/components/Error.d.ts +0 -0
  49. package/build/components/Error.js +0 -2
  50. package/build/components/Error.js.map +0 -1
  51. package/build/components/Focus.d.ts +0 -55
  52. package/build/components/Focus.js +0 -229
  53. package/build/components/Focus.js.map +0 -1
  54. package/build/draw-border.d.ts +0 -4
  55. package/build/draw-border.js +0 -48
  56. package/build/draw-border.js.map +0 -1
  57. package/build/test.js +0 -8
  58. package/build/test.js.map +0 -1
@@ -1,33 +0,0 @@
1
- import { Component, ReactNode } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Styles } from '../styles';
4
- interface State {
5
- lastIndex: number | null;
6
- }
7
- /**
8
- * `<Static>` component allows permanently rendering output to stdout and preserving it across renders. Components passed to `<Static>` as children will be written to stdout only once and will never be rerendered. `<Static>` output comes first, before any other output from your components, no matter where it is in the tree. In order for this mechanism to work properly, at most one `<Static>` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `<Static>` and render them to stdout.
9
- *
10
- * __Note__: `<Static>` accepts only an array of children and each of them must have a unique key.
11
- *
12
- * This component allows developers to render output before main output from all the other components.
13
- * The reason it's called <Static> is it's append-only output. Output from <Static> components
14
- * is written permanently to stdout and is never updated afterwards. If <Static> component
15
- * receives new children, Ink will detect the changes and write them to stdout.
16
- * In order for this mechanism to work perfectly, <Static> children must never update their output
17
- * once they've been appended to <Static>.
18
- *
19
- * A good example of where this component might be useful is interface like Jest's.
20
- * When running tests, Jest keeps writing completed tests to output, while continuously
21
- * rendering test stats at the end of the output.
22
- */
23
- export declare class DeprecatedStatic extends Component<Styles, State> {
24
- static propTypes: {
25
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
26
- };
27
- state: State;
28
- render(): JSX.Element;
29
- componentDidMount(): void;
30
- componentDidUpdate(_prevProps: Styles, prevState: State): void;
31
- saveLastIndex(children: ReactNode): void;
32
- }
33
- export {};
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importStar = (this && this.__importStar) || function (mod) {
14
- if (mod && mod.__esModule) return mod;
15
- var result = {};
16
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
17
- result["default"] = mod;
18
- return result;
19
- };
20
- var __importDefault = (this && this.__importDefault) || function (mod) {
21
- return (mod && mod.__esModule) ? mod : { "default": mod };
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- const react_1 = __importStar(require("react"));
25
- const prop_types_1 = __importDefault(require("prop-types"));
26
- const childrenToArray = (children) => {
27
- return Array.isArray(children) ? children : [children];
28
- };
29
- /**
30
- * `<Static>` component allows permanently rendering output to stdout and preserving it across renders. Components passed to `<Static>` as children will be written to stdout only once and will never be rerendered. `<Static>` output comes first, before any other output from your components, no matter where it is in the tree. In order for this mechanism to work properly, at most one `<Static>` component must be present in your node tree and components that were rendered must never update their output. Ink will detect new children appended to `<Static>` and render them to stdout.
31
- *
32
- * __Note__: `<Static>` accepts only an array of children and each of them must have a unique key.
33
- *
34
- * This component allows developers to render output before main output from all the other components.
35
- * The reason it's called <Static> is it's append-only output. Output from <Static> components
36
- * is written permanently to stdout and is never updated afterwards. If <Static> component
37
- * receives new children, Ink will detect the changes and write them to stdout.
38
- * In order for this mechanism to work perfectly, <Static> children must never update their output
39
- * once they've been appended to <Static>.
40
- *
41
- * A good example of where this component might be useful is interface like Jest's.
42
- * When running tests, Jest keeps writing completed tests to output, while continuously
43
- * rendering test stats at the end of the output.
44
- */
45
- class DeprecatedStatic extends react_1.Component {
46
- constructor() {
47
- super(...arguments);
48
- this.state = {
49
- lastIndex: null
50
- };
51
- }
52
- render() {
53
- const _a = this.props, { children } = _a, otherProps = __rest(_a, ["children"]);
54
- const { lastIndex } = this.state;
55
- let newChildren = children;
56
- if (typeof lastIndex === 'number') {
57
- newChildren = childrenToArray(children).slice(lastIndex);
58
- }
59
- return (react_1.default.createElement("div", {
60
- // @ts-ignore
61
- unstable__static: true, style: Object.assign({ position: 'absolute', flexDirection: 'column' }, otherProps) }, newChildren));
62
- }
63
- componentDidMount() {
64
- this.saveLastIndex(this.props.children);
65
- }
66
- componentDidUpdate(_prevProps, prevState) {
67
- if (prevState.lastIndex === this.state.lastIndex) {
68
- this.saveLastIndex(this.props.children);
69
- }
70
- }
71
- saveLastIndex(children) {
72
- const nextIndex = childrenToArray(children).length;
73
- if (this.state.lastIndex !== nextIndex) {
74
- this.setState({
75
- lastIndex: nextIndex
76
- });
77
- }
78
- }
79
- }
80
- exports.DeprecatedStatic = DeprecatedStatic;
81
- DeprecatedStatic.propTypes = {
82
- children: prop_types_1.default.node
83
- };
84
- //# sourceMappingURL=DeprecatedStatic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DeprecatedStatic.js","sourceRoot":"","sources":["../../src/components/DeprecatedStatic.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAkD;AAClD,4DAAmC;AAGnC,MAAM,eAAe,GAAG,CAAC,QAAmB,EAAE,EAAE;IAC/C,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACxD,CAAC,CAAC;AAMF;;;;;;;;;;;;;;;GAeG;AACH,MAAa,gBAAiB,SAAQ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=Error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Error.js","sourceRoot":"","sources":["../../src/components/Error.tsx"],"names":[],"mappings":""}
@@ -1,55 +0,0 @@
1
- /// <reference types="node" />
2
- import { PureComponent } from 'react';
3
- import type { ReactNode } from 'react';
4
- import PropTypes from 'prop-types';
5
- interface Props {
6
- children: ReactNode;
7
- stdin: NodeJS.ReadStream;
8
- stdout: NodeJS.WriteStream;
9
- stderr: NodeJS.WriteStream;
10
- writeToStdout: (data: string) => void;
11
- writeToStderr: (data: string) => void;
12
- exitOnCtrlC: boolean;
13
- onExit: (error?: Error) => void;
14
- }
15
- interface State {
16
- isFocusEnabled: boolean;
17
- activeFocusId?: string;
18
- focusIds: string[];
19
- disabledFocusIds: string[];
20
- }
21
- export default class App extends PureComponent<Props, State> {
22
- static displayName: string;
23
- static propTypes: {
24
- children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
25
- stdin: PropTypes.Validator<object>;
26
- stdout: PropTypes.Validator<object>;
27
- stderr: PropTypes.Validator<object>;
28
- writeToStdout: PropTypes.Validator<(...args: any[]) => any>;
29
- writeToStderr: PropTypes.Validator<(...args: any[]) => any>;
30
- exitOnCtrlC: PropTypes.Validator<boolean>;
31
- onExit: PropTypes.Validator<(...args: any[]) => any>;
32
- };
33
- state: {
34
- isFocusEnabled: boolean;
35
- activeFocusId: undefined;
36
- focusIds: never[];
37
- disabledFocusIds: never[];
38
- };
39
- rawModeEnabledCount: number;
40
- isRawModeSupported(): boolean;
41
- render(): JSX.Element;
42
- componentDidMount(): void;
43
- componentWillUnmount(): void;
44
- componentDidCatch(error: Error): void;
45
- handleSetRawMode: (isEnabled: boolean) => void;
46
- handleInput: (input: string) => void;
47
- handleExit: (error?: Error | undefined) => void;
48
- enableFocus: () => void;
49
- disableFocus: () => void;
50
- registerFocusComponent: (id: string) => void;
51
- unregisterFocusComponent: (id: string) => void;
52
- enableFocusComponent: (id: string) => void;
53
- disableFocusComponent: (id: string) => void;
54
- }
55
- export {};
@@ -1,229 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- const react_1 = __importStar(require("react"));
26
- const prop_types_1 = __importDefault(require("prop-types"));
27
- const cli_cursor_1 = __importDefault(require("cli-cursor"));
28
- const AppContext_1 = __importDefault(require("./AppContext"));
29
- const StdinContext_1 = __importDefault(require("./StdinContext"));
30
- const StdoutContext_1 = __importDefault(require("./StdoutContext"));
31
- const StderrContext_1 = __importDefault(require("./StderrContext"));
32
- const FocusContext_1 = __importDefault(require("./FocusContext"));
33
- const TAB = '\t';
34
- const SHIFT_TAB = '\u001B[Z';
35
- const ESC = '\u001B';
36
- // Root component for all Ink apps
37
- // It renders stdin and stdout contexts, so that children can access them if needed
38
- // It also handles Ctrl+C exiting and cursor visibility
39
- let App = /** @class */ (() => {
40
- class App extends react_1.PureComponent {
41
- constructor() {
42
- super(...arguments);
43
- this.state = {
44
- isFocusEnabled: true,
45
- activeFocusId: undefined,
46
- focusIds: [],
47
- disabledFocusIds: []
48
- };
49
- // Count how many components enabled raw mode to avoid disabling
50
- // raw mode until all components don't need it anymore
51
- this.rawModeEnabledCount = 0;
52
- this.handleSetRawMode = (isEnabled) => {
53
- const { stdin } = this.props;
54
- if (!this.isRawModeSupported()) {
55
- if (stdin === process.stdin) {
56
- throw new Error('Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported');
57
- }
58
- else {
59
- throw new Error('Raw mode is not supported on the stdin provided to Ink.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported');
60
- }
61
- }
62
- stdin.setEncoding('utf8');
63
- if (isEnabled) {
64
- // Ensure raw mode is enabled only once
65
- if (this.rawModeEnabledCount === 0) {
66
- stdin.addListener('data', this.handleInput);
67
- stdin.resume();
68
- stdin.setRawMode(true);
69
- }
70
- this.rawModeEnabledCount++;
71
- return;
72
- }
73
- // Disable raw mode only when no components left that are using it
74
- if (--this.rawModeEnabledCount === 0) {
75
- stdin.setRawMode(false);
76
- stdin.removeListener('data', this.handleInput);
77
- stdin.pause();
78
- }
79
- };
80
- this.handleInput = (input) => {
81
- // Exit on Ctrl+C
82
- // eslint-disable-next-line unicorn/no-hex-escape
83
- if (input === '\x03' && this.props.exitOnCtrlC) {
84
- this.handleExit();
85
- }
86
- // Reset focus when there's an active focused component on Esc
87
- if (input === ESC && this.state.activeFocusId) {
88
- this.setState({
89
- activeFocusId: undefined
90
- });
91
- }
92
- if (this.state.isFocusEnabled && this.state.focusIds.length > 0) {
93
- if (input === TAB) {
94
- this.setState(({ activeFocusId, focusIds }) => {
95
- if (!activeFocusId) {
96
- return {
97
- activeFocusId: focusIds[0]
98
- };
99
- }
100
- const index = focusIds.indexOf(activeFocusId);
101
- const nextId = focusIds[index + 1] || focusIds[0];
102
- return {
103
- activeFocusId: nextId
104
- };
105
- });
106
- }
107
- if (input === SHIFT_TAB) {
108
- this.setState(({ activeFocusId, focusIds }) => {
109
- if (!activeFocusId) {
110
- return {
111
- activeFocusId: focusIds[0]
112
- };
113
- }
114
- const index = focusIds.indexOf(activeFocusId);
115
- const nextId = focusIds[index - 1] || focusIds[focusIds.length - 1];
116
- return {
117
- activeFocusId: nextId
118
- };
119
- });
120
- }
121
- }
122
- };
123
- this.handleExit = (error) => {
124
- if (this.isRawModeSupported()) {
125
- this.handleSetRawMode(false);
126
- }
127
- this.props.onExit(error);
128
- };
129
- this.enableFocus = () => {
130
- this.setState({
131
- isFocusEnabled: true
132
- });
133
- };
134
- this.disableFocus = () => {
135
- this.setState({
136
- isFocusEnabled: false
137
- });
138
- };
139
- this.registerFocusComponent = (id) => {
140
- // If this is a first component to register, make it active immediately
141
- this.setState(({ activeFocusId, focusIds }) => ({
142
- activeFocusId: focusIds.length === 0 ? id : activeFocusId,
143
- focusIds: [...focusIds, id]
144
- }));
145
- };
146
- this.unregisterFocusComponent = (id) => {
147
- this.setState(previousState => ({
148
- activeFocusId: previousState.activeFocusId === id
149
- ? undefined
150
- : previousState.activeFocusId,
151
- focusIds: previousState.focusIds.filter(focusId => focusId !== id)
152
- }));
153
- };
154
- this.enableFocusComponent = (id) => {
155
- this.setState(previousState => ({
156
- disabledFocusIds: previousState.disabledFocusIds.filter(disabledId => {
157
- return disabledId !== id;
158
- })
159
- }));
160
- };
161
- this.disableFocusComponent = (id) => {
162
- this.setState(previousState => ({
163
- activeFocusId: previousState.activeFocusId === id
164
- ? undefined
165
- : previousState.activeFocusId,
166
- disabledFocusIds: [...previousState.disabledFocusIds, id]
167
- }));
168
- };
169
- }
170
- // Determines if TTY is supported on the provided stdin
171
- isRawModeSupported() {
172
- return this.props.stdin.isTTY;
173
- }
174
- render() {
175
- return (react_1.default.createElement(AppContext_1.default.Provider, { value: {
176
- exit: this.handleExit,
177
- enableFocus: this.enableFocus,
178
- disableFocus: this.disableFocus
179
- } },
180
- react_1.default.createElement(StdinContext_1.default.Provider, { value: {
181
- stdin: this.props.stdin,
182
- setRawMode: this.handleSetRawMode,
183
- isRawModeSupported: this.isRawModeSupported()
184
- } },
185
- react_1.default.createElement(StdoutContext_1.default.Provider, { value: {
186
- stdout: this.props.stdout,
187
- write: this.props.writeToStdout
188
- } },
189
- react_1.default.createElement(StderrContext_1.default.Provider, { value: {
190
- stderr: this.props.stderr,
191
- write: this.props.writeToStderr
192
- } },
193
- react_1.default.createElement(FocusContext_1.default.Provider, { value: {
194
- activeId: this.state.activeFocusId,
195
- register: this.registerFocusComponent,
196
- unregister: this.unregisterFocusComponent,
197
- enable: this.enableFocusComponent,
198
- disable: this.disableFocusComponent
199
- } }, this.props.children))))));
200
- }
201
- componentDidMount() {
202
- cli_cursor_1.default.hide(this.props.stdout);
203
- }
204
- componentWillUnmount() {
205
- cli_cursor_1.default.show(this.props.stdout);
206
- // ignore calling setRawMode on an handle stdin it cannot be called
207
- if (this.isRawModeSupported()) {
208
- this.handleSetRawMode(false);
209
- }
210
- }
211
- componentDidCatch(error) {
212
- this.handleExit(error);
213
- }
214
- }
215
- App.displayName = 'InternalApp';
216
- App.propTypes = {
217
- children: prop_types_1.default.node.isRequired,
218
- stdin: prop_types_1.default.object.isRequired,
219
- stdout: prop_types_1.default.object.isRequired,
220
- stderr: prop_types_1.default.object.isRequired,
221
- writeToStdout: prop_types_1.default.func.isRequired,
222
- writeToStderr: prop_types_1.default.func.isRequired,
223
- exitOnCtrlC: prop_types_1.default.bool.isRequired,
224
- onExit: prop_types_1.default.func.isRequired
225
- };
226
- return App;
227
- })();
228
- exports.default = App;
229
- //# sourceMappingURL=Focus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Focus.js","sourceRoot":"","sources":["../../src/components/Focus.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2C;AAE3C,4DAAmC;AACnC,4DAAmC;AACnC,8DAAsC;AACtC,kEAA0C;AAC1C,oEAA4C;AAC5C,oEAA4C;AAC5C,kEAA0C;AAE1C,MAAM,GAAG,GAAG,IAAI,CAAC;AACjB,MAAM,SAAS,GA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AC,KAAK,CAAC,CAAC;QACxB,CAAC;;IAzFM,eAAW,GAAG,aAAa,CAAC;IAC5B,aAAS,GAAG;QAClB,QAAQ,EAAE,oBAAS,CAAC,IAAI,CAAC,UAAU;QACnC,KAAK,EAAE,oBAAS,CAAC,MAAM,CAAC,UAAU;QAClC,MAAM,EAAE,oBAAS,CAAC,MAAM,CAAC,UAAU;QACnC,MAAM,EAAE,oBAAS,CAAC,MAAM,CAAC,UAAU;QACnC,aAAa,EAAE,oBAAS,CAAC,IAAI,CAAC,UAAU;QACxC,aAAa,EAAE,oBAAS,CAAC,IAAI,CAAC,UAAU;QACxC,WAAW,EAAE,oBAAS,CAAC,IAAI,CAAC,UAAU;QACtC,MAAM,EAAE,oBAAS,CAAC,IAAI,CAAC,UAAU;KACjC,CAAC;IAgOH,UAAC;KAAA;kBA3OoB,GAAG"}
@@ -1,4 +0,0 @@
1
- import type { DOMNode } from './dom';
2
- import type Output from './output';
3
- declare const _default: (x: number, y: number, node: DOMNode, output: Output) => void;
4
- export default _default;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const cli_boxes_1 = __importDefault(require("cli-boxes"));
7
- const chalk_1 = __importDefault(require("chalk"));
8
- exports.default = (x, y, node, output) => {
9
- if (typeof node.style.borderStyle === 'string') {
10
- const style = node.style.borderStyle;
11
- const color = node.style.borderColor;
12
- const topLeftCharacter = color
13
- ? chalk_1.default[color](cli_boxes_1.default[style].topLeft)
14
- : cli_boxes_1.default[style].topLeft;
15
- const topRightCharacter = color
16
- ? chalk_1.default[color](cli_boxes_1.default[style].topRight)
17
- : cli_boxes_1.default[style].topRight;
18
- const bottomLeftCharacter = color
19
- ? chalk_1.default[color](cli_boxes_1.default[style].bottomLeft)
20
- : cli_boxes_1.default[style].bottomLeft;
21
- const bottomRightCharacter = color
22
- ? chalk_1.default[color](cli_boxes_1.default[style].bottomRight)
23
- : cli_boxes_1.default[style].bottomRight;
24
- const horizontalCharacter = color
25
- ? chalk_1.default[color](cli_boxes_1.default[style].horizontal)
26
- : cli_boxes_1.default[style].horizontal;
27
- const verticalCharacter = color
28
- ? chalk_1.default[color](cli_boxes_1.default[style].vertical)
29
- : cli_boxes_1.default[style].vertical;
30
- const width = node.yogaNode.getComputedWidth();
31
- const height = node.yogaNode.getComputedHeight();
32
- const topBorder = topLeftCharacter +
33
- horizontalCharacter.repeat(width - 2) +
34
- topRightCharacter;
35
- let verticalBorder = '';
36
- for (let index = 0; index < height - 2; index++) {
37
- verticalBorder += verticalCharacter + '\n';
38
- }
39
- const bottomBorder = bottomLeftCharacter +
40
- horizontalCharacter.repeat(width - 2) +
41
- bottomRightCharacter;
42
- output.write(x, y, topBorder, { transformers: [] });
43
- output.write(x, y + 1, verticalBorder, { transformers: [] });
44
- output.write(x + width - 1, y + 1, verticalBorder, { transformers: [] });
45
- output.write(x, y + height - 1, bottomBorder, { transformers: [] });
46
- }
47
- };
48
- //# sourceMappingURL=draw-border.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"draw-border.js","sourceRoot":"","sources":["../src/draw-border.ts"],"names":[],"mappings":";;;;;AAAA,0DAAiC;AACjC,kDAA0B;AAI1B,kBAAe,CAAC,CAAS,EAAE,CAAS,EAAE,IAAa,EAAE,MAAc,EAAQ,EAAE;IAC5E,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,QAAQ,EAAE;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QACrC,MAAM,gBAAgB,GAAG,KAAK;YAC7B,CAAC,CAAC,eAAK,CAAC,KAAK,CAAC,CAAC,mBAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YACvC,CAAC,CAAC,mBAAQ,CAAC,KAA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nB,IAAI,cAAc,GAAG,EAAE,CAAC;QAExB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE;YAChD,cAAc,IAAI,iBAAiB,GAAG,IAAI,CAAC;SAC3C;QAED,MAAM,YAAY,GACjB,mBAAmB;YACnB,mBAAmB,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;YACrC,oBAAoB,CAAC;QAEtB,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,EAAC,YAAY,EAAE,EAAE,EAAC,CAAC,CAAC;QAClD,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,EAAC,YAAY,EAAE,EAAE,EAAC,CAAC,CAAC;QAC3D,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,EAAC,YAAY,EAAE,EAAE,EAAC,CAAC,CAAC;QACvE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,YAAY,EAAE,EAAC,YAAY,EAAE,EAAE,EAAC,CAAC,CAAC;KAClE;AACF,CAAC,CAAC"}
package/build/test.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const use_focus_1 = __importDefault(require("./hooks/use-focus"));
7
- use_focus_1.default({ isActive: false }).isFocused;
8
- //# sourceMappingURL=test.js.map
package/build/test.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;;;;AAAA,kEAAyC;AAEzC,mBAAQ,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC,CAAC,SAAS,CAAA"}