@doubao-dev/plugin-app-dev 0.0.0-stage → 0.0.40-canary-dea0ddc73-20261026073950
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 +10 -2
- package/dist/147.js +9 -0
- package/dist/assets.d.ts +5 -0
- package/dist/assets.js +4 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +1378 -0
- package/dist/plugin.d.ts +102 -0
- package/dist/plugin.js +4995 -0
- package/dist/preview.js +16 -0
- package/dist/rslib-runtime.js +33 -0
- package/dist/skills/doubao-plugin-app/SKILL.md +21 -0
- package/dist/skills/doubao-plugin-app/references/app-development.md +85 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/container-overlay.md +131 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/form-controls.md +146 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/interactive-controls.md +120 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/map-canvas.md +107 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/overview.md +43 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/scroll-list.md +149 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/text-media.md +209 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/01-/345/237/272/347/241/200.md +1389 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/02-/347/263/273/347/273/237.md +1376 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/03-/350/207/252/345/256/232/344/271/211/351/200/232/344/277/241.md +127 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/04-/345/256/232/344/275/215.md +784 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/05-/345/255/230/345/202/250.md +1176 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/06-/350/267/257/347/224/261.md +839 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/07-/347/225/214/351/235/242.md +376 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/08-/344/272/244/344/272/222.md +1319 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/09-/350/276/223/345/205/245.md +192 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/10-/347/275/221/347/273/234.md +900 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/11-/345/252/222/344/275/223.md +1496 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/12-/344/270/232/345/212/241/350/203/275/345/212/233.md +1281 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/13-/347/231/273/345/275/225.md +511 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/14-/346/224/257/344/273/230.md +943 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/15-/346/225/260/346/215/256/345/210/206/346/236/220.md +124 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/16-/350/223/235/347/211/231.md +3364 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/17-wi-fi.md +1028 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/18-/345/212/240/351/200/237/345/272/246/350/256/241.md +354 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/19-ibeacon.md +508 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/20-/347/275/227/347/233/230.md +320 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/21-/350/256/276/345/244/207/346/226/271/345/220/221.md +351 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/22-/351/231/200/350/236/272/344/273/252.md +354 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/23-/345/252/222/344/275/223-/350/256/276/345/244/207-/347/275/221/347/273/234.md +264 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/24-/347/237/255/344/277/241.md +155 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/25-/346/227/240/351/232/234/347/242/215.md +144 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/26-/345/237/272/347/241/200/344/277/241/346/201/257.md +238 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/27-/347/224/265/346/261/240.md +235 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/28-/345/211/252/350/264/264/346/235/277.md +303 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/29-/345/212/240/345/257/206.md +126 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/30-/346/227/245/345/216/206.md +417 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/31-/347/224/265/350/257/235.md +144 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/32-/346/211/253/347/240/201.md +236 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/33-/345/261/217/345/271/225.md +747 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/34-/351/234/207/345/212/250.md +277 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/35-/346/226/207/344/273/266/347/263/273/347/273/237.md +431 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/common-errors.md +69 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/groups.md +43 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/quick-reference.md +436 -0
- package/dist/skills/doubao-plugin-app/references/frontend/examples/common-patterns.md +590 -0
- package/dist/skills/doubao-plugin-app/references/frontend/examples/doubao-agentic-service-api-recipes.md +209 -0
- package/dist/skills/doubao-plugin-app/references/frontend/examples/page-widget-basics.md +368 -0
- package/dist/skills/doubao-plugin-app/references/frontend/examples/page-widget-recipes.md +65 -0
- package/dist/skills/doubao-plugin-app/references/frontend/framework/core.md +283 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/auth.md +277 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/best-practices.md +574 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/client-tools-and-events.md +209 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/component-development.md +832 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/debugger-mcp.md +537 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/expired-widget.md +101 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/performance-optimization.md +417 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/troubleshooting.md +278 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/best-practices.md +720 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/pseudo-classes.md +149 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/selectors.md +224 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/supported-properties.md +269 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/values-and-units.md +314 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/flex-layout.md +334 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/grid-layout.md +408 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/linear-layout.md +355 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/relative-layout.md +189 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/css-differences.md +737 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/migration-guide.md +669 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/unsupported-features.md +290 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/overview.md +60 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/animation.md +243 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/responsive.md +194 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/theming.md +143 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/quick-reference.md +229 -0
- package/dist/skills/doubao-plugin-app/references/frontend/rules/dos-and-donts.md +479 -0
- package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/design-boundary.md +46 -0
- package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/overview.md +118 -0
- package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/props.md +301 -0
- package/dist/skills/doubao-plugin-app/references/mcp-and-cards.md +38 -0
- package/dist/templates/README.md.template +11 -0
- package/dist/templates/com.doubao/app/manifest.yaml +41 -0
- package/dist/templates/com.doubao/app/package.json.template +13 -0
- package/dist/templates/com.doubao/app/src/app.config.ts.template +5 -0
- package/dist/templates/com.doubao/app/src/app.ts.template +3 -0
- package/dist/templates/com.doubao/app/src/pages/home/index.css +14 -0
- package/dist/templates/com.doubao/app/src/pages/home/index.tsx.template +14 -0
- package/dist/templates/com.doubao/app/src/widgets/example/index.tsx.template +29 -0
- package/dist/templates/com.doubao/app/tsconfig.json +19 -0
- package/dist/templates/mcp.json +9 -0
- package/dist/templates/plugin.json.template +29 -0
- package/dist/templates/skills/example/SKILL.md.template +14 -0
- package/dist/upload.d.ts +44 -0
- package/dist/upload.js +38 -0
- package/package.json +60 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,1378 @@
|
|
|
1
|
+
import { Box as external_ink_Box, Text as external_ink_Text, render, useInput as external_ink_useInput, useWindowSize } from "ink";
|
|
2
|
+
import react, { createContext, isValidElement, useCallback as external_react_useCallback, useContext, useEffect as external_react_useEffect, useMemo as external_react_useMemo, useReducer as external_react_useReducer, useState as external_react_useState } from "react";
|
|
3
|
+
import node_process from "node:process";
|
|
4
|
+
import { isDeepStrictEqual as external_node_util_isDeepStrictEqual } from "node:util";
|
|
5
|
+
import chalk_0 from "chalk";
|
|
6
|
+
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
7
|
+
import { DEV_STATUS_COLORS } from "./147.js";
|
|
8
|
+
import * as __rspack_external_react from "react";
|
|
9
|
+
__webpack_require__.add({
|
|
10
|
+
"../../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js" (module) {
|
|
11
|
+
var isMergeableObject = function(value) {
|
|
12
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
13
|
+
};
|
|
14
|
+
function isNonNullObject(value) {
|
|
15
|
+
return !!value && 'object' == typeof value;
|
|
16
|
+
}
|
|
17
|
+
function isSpecial(value) {
|
|
18
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
19
|
+
return '[object RegExp]' === stringValue || '[object Date]' === stringValue || isReactElement(value);
|
|
20
|
+
}
|
|
21
|
+
var canUseSymbol = 'function' == typeof Symbol && Symbol.for;
|
|
22
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
23
|
+
function isReactElement(value) {
|
|
24
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
25
|
+
}
|
|
26
|
+
function emptyTarget(val) {
|
|
27
|
+
return Array.isArray(val) ? [] : {};
|
|
28
|
+
}
|
|
29
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
30
|
+
return false !== options.clone && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
31
|
+
}
|
|
32
|
+
function defaultArrayMerge(target, source, options) {
|
|
33
|
+
return target.concat(source).map(function(element) {
|
|
34
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function getMergeFunction(key, options) {
|
|
38
|
+
if (!options.customMerge) return deepmerge;
|
|
39
|
+
var customMerge = options.customMerge(key);
|
|
40
|
+
return 'function' == typeof customMerge ? customMerge : deepmerge;
|
|
41
|
+
}
|
|
42
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
43
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
44
|
+
return Object.propertyIsEnumerable.call(target, symbol);
|
|
45
|
+
}) : [];
|
|
46
|
+
}
|
|
47
|
+
function getKeys(target) {
|
|
48
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
49
|
+
}
|
|
50
|
+
function propertyIsOnObject(object, property) {
|
|
51
|
+
try {
|
|
52
|
+
return property in object;
|
|
53
|
+
} catch (_) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function propertyIsUnsafe(target, key) {
|
|
58
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
59
|
+
}
|
|
60
|
+
function mergeObject(target, source, options) {
|
|
61
|
+
var destination = {};
|
|
62
|
+
if (options.isMergeableObject(target)) getKeys(target).forEach(function(key) {
|
|
63
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
64
|
+
});
|
|
65
|
+
getKeys(source).forEach(function(key) {
|
|
66
|
+
if (propertyIsUnsafe(target, key)) return;
|
|
67
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
68
|
+
else destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
69
|
+
});
|
|
70
|
+
return destination;
|
|
71
|
+
}
|
|
72
|
+
function deepmerge(target, source, options) {
|
|
73
|
+
options = options || {};
|
|
74
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
75
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
76
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
77
|
+
var sourceIsArray = Array.isArray(source);
|
|
78
|
+
var targetIsArray = Array.isArray(target);
|
|
79
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
80
|
+
if (!sourceAndTargetTypesMatch) return cloneUnlessOtherwiseSpecified(source, options);
|
|
81
|
+
if (sourceIsArray) return options.arrayMerge(target, source, options);
|
|
82
|
+
return mergeObject(target, source, options);
|
|
83
|
+
}
|
|
84
|
+
deepmerge.all = function(array, options) {
|
|
85
|
+
if (!Array.isArray(array)) throw new Error('first argument should be an array');
|
|
86
|
+
return array.reduce(function(prev, next) {
|
|
87
|
+
return deepmerge(prev, next, options);
|
|
88
|
+
}, {});
|
|
89
|
+
};
|
|
90
|
+
var deepmerge_1 = deepmerge;
|
|
91
|
+
module.exports = deepmerge_1;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
function isUnicodeSupported() {
|
|
95
|
+
const { env } = node_process;
|
|
96
|
+
const { TERM, TERM_PROGRAM } = env;
|
|
97
|
+
if ('win32' !== node_process.platform) return 'linux' !== TERM;
|
|
98
|
+
return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || '{cmd::Cmder}' === env.ConEmuTask || 'Terminus-Sublime' === TERM_PROGRAM || 'vscode' === TERM_PROGRAM || 'xterm-256color' === TERM || 'alacritty' === TERM || 'rxvt-unicode' === TERM || 'rxvt-unicode-256color' === TERM || 'JetBrains-JediTerm' === env.TERMINAL_EMULATOR;
|
|
99
|
+
}
|
|
100
|
+
const common = {
|
|
101
|
+
circleQuestionMark: '(?)',
|
|
102
|
+
questionMarkPrefix: '(?)',
|
|
103
|
+
square: '█',
|
|
104
|
+
squareDarkShade: '▓',
|
|
105
|
+
squareMediumShade: '▒',
|
|
106
|
+
squareLightShade: '░',
|
|
107
|
+
squareTop: '▀',
|
|
108
|
+
squareBottom: '▄',
|
|
109
|
+
squareLeft: '▌',
|
|
110
|
+
squareRight: '▐',
|
|
111
|
+
squareCenter: '■',
|
|
112
|
+
bullet: '●',
|
|
113
|
+
dot: '․',
|
|
114
|
+
ellipsis: '…',
|
|
115
|
+
pointerSmall: '›',
|
|
116
|
+
triangleUp: '▲',
|
|
117
|
+
triangleUpSmall: '▴',
|
|
118
|
+
triangleDown: '▼',
|
|
119
|
+
triangleDownSmall: '▾',
|
|
120
|
+
triangleLeftSmall: '◂',
|
|
121
|
+
triangleRightSmall: '▸',
|
|
122
|
+
home: '⌂',
|
|
123
|
+
heart: '♥',
|
|
124
|
+
musicNote: '♪',
|
|
125
|
+
musicNoteBeamed: '♫',
|
|
126
|
+
arrowUp: '↑',
|
|
127
|
+
arrowDown: '↓',
|
|
128
|
+
arrowLeft: '←',
|
|
129
|
+
arrowRight: '→',
|
|
130
|
+
arrowLeftRight: '↔',
|
|
131
|
+
arrowUpDown: '↕',
|
|
132
|
+
almostEqual: '≈',
|
|
133
|
+
notEqual: '≠',
|
|
134
|
+
lessOrEqual: '≤',
|
|
135
|
+
greaterOrEqual: '≥',
|
|
136
|
+
identical: '≡',
|
|
137
|
+
infinity: '∞',
|
|
138
|
+
subscriptZero: '₀',
|
|
139
|
+
subscriptOne: '₁',
|
|
140
|
+
subscriptTwo: '₂',
|
|
141
|
+
subscriptThree: '₃',
|
|
142
|
+
subscriptFour: '₄',
|
|
143
|
+
subscriptFive: '₅',
|
|
144
|
+
subscriptSix: '₆',
|
|
145
|
+
subscriptSeven: '₇',
|
|
146
|
+
subscriptEight: '₈',
|
|
147
|
+
subscriptNine: '₉',
|
|
148
|
+
oneHalf: '½',
|
|
149
|
+
oneThird: '⅓',
|
|
150
|
+
oneQuarter: '¼',
|
|
151
|
+
oneFifth: '⅕',
|
|
152
|
+
oneSixth: '⅙',
|
|
153
|
+
oneEighth: '⅛',
|
|
154
|
+
twoThirds: '⅔',
|
|
155
|
+
twoFifths: '⅖',
|
|
156
|
+
threeQuarters: '¾',
|
|
157
|
+
threeFifths: '⅗',
|
|
158
|
+
threeEighths: '⅜',
|
|
159
|
+
fourFifths: '⅘',
|
|
160
|
+
fiveSixths: '⅚',
|
|
161
|
+
fiveEighths: '⅝',
|
|
162
|
+
sevenEighths: '⅞',
|
|
163
|
+
line: '─',
|
|
164
|
+
lineBold: '━',
|
|
165
|
+
lineDouble: '═',
|
|
166
|
+
lineDashed0: '┄',
|
|
167
|
+
lineDashed1: '┅',
|
|
168
|
+
lineDashed2: '┈',
|
|
169
|
+
lineDashed3: '┉',
|
|
170
|
+
lineDashed4: '╌',
|
|
171
|
+
lineDashed5: '╍',
|
|
172
|
+
lineDashed6: '╴',
|
|
173
|
+
lineDashed7: '╶',
|
|
174
|
+
lineDashed8: '╸',
|
|
175
|
+
lineDashed9: '╺',
|
|
176
|
+
lineDashed10: '╼',
|
|
177
|
+
lineDashed11: '╾',
|
|
178
|
+
lineDashed12: '−',
|
|
179
|
+
lineDashed13: '–',
|
|
180
|
+
lineDashed14: '‐',
|
|
181
|
+
lineDashed15: '⁃',
|
|
182
|
+
lineVertical: '│',
|
|
183
|
+
lineVerticalBold: '┃',
|
|
184
|
+
lineVerticalDouble: '║',
|
|
185
|
+
lineVerticalDashed0: '┆',
|
|
186
|
+
lineVerticalDashed1: '┇',
|
|
187
|
+
lineVerticalDashed2: '┊',
|
|
188
|
+
lineVerticalDashed3: '┋',
|
|
189
|
+
lineVerticalDashed4: '╎',
|
|
190
|
+
lineVerticalDashed5: '╏',
|
|
191
|
+
lineVerticalDashed6: '╵',
|
|
192
|
+
lineVerticalDashed7: '╷',
|
|
193
|
+
lineVerticalDashed8: '╹',
|
|
194
|
+
lineVerticalDashed9: '╻',
|
|
195
|
+
lineVerticalDashed10: '╽',
|
|
196
|
+
lineVerticalDashed11: '╿',
|
|
197
|
+
lineDownLeft: '┐',
|
|
198
|
+
lineDownLeftArc: '╮',
|
|
199
|
+
lineDownBoldLeftBold: '┓',
|
|
200
|
+
lineDownBoldLeft: '┒',
|
|
201
|
+
lineDownLeftBold: '┑',
|
|
202
|
+
lineDownDoubleLeftDouble: '╗',
|
|
203
|
+
lineDownDoubleLeft: '╖',
|
|
204
|
+
lineDownLeftDouble: '╕',
|
|
205
|
+
lineDownRight: '┌',
|
|
206
|
+
lineDownRightArc: '╭',
|
|
207
|
+
lineDownBoldRightBold: '┏',
|
|
208
|
+
lineDownBoldRight: '┎',
|
|
209
|
+
lineDownRightBold: '┍',
|
|
210
|
+
lineDownDoubleRightDouble: '╔',
|
|
211
|
+
lineDownDoubleRight: '╓',
|
|
212
|
+
lineDownRightDouble: '╒',
|
|
213
|
+
lineUpLeft: '┘',
|
|
214
|
+
lineUpLeftArc: '╯',
|
|
215
|
+
lineUpBoldLeftBold: '┛',
|
|
216
|
+
lineUpBoldLeft: '┚',
|
|
217
|
+
lineUpLeftBold: '┙',
|
|
218
|
+
lineUpDoubleLeftDouble: '╝',
|
|
219
|
+
lineUpDoubleLeft: '╜',
|
|
220
|
+
lineUpLeftDouble: '╛',
|
|
221
|
+
lineUpRight: '└',
|
|
222
|
+
lineUpRightArc: '╰',
|
|
223
|
+
lineUpBoldRightBold: '┗',
|
|
224
|
+
lineUpBoldRight: '┖',
|
|
225
|
+
lineUpRightBold: '┕',
|
|
226
|
+
lineUpDoubleRightDouble: '╚',
|
|
227
|
+
lineUpDoubleRight: '╙',
|
|
228
|
+
lineUpRightDouble: '╘',
|
|
229
|
+
lineUpDownLeft: '┤',
|
|
230
|
+
lineUpBoldDownBoldLeftBold: '┫',
|
|
231
|
+
lineUpBoldDownBoldLeft: '┨',
|
|
232
|
+
lineUpDownLeftBold: '┥',
|
|
233
|
+
lineUpBoldDownLeftBold: '┩',
|
|
234
|
+
lineUpDownBoldLeftBold: '┪',
|
|
235
|
+
lineUpDownBoldLeft: '┧',
|
|
236
|
+
lineUpBoldDownLeft: '┦',
|
|
237
|
+
lineUpDoubleDownDoubleLeftDouble: '╣',
|
|
238
|
+
lineUpDoubleDownDoubleLeft: '╢',
|
|
239
|
+
lineUpDownLeftDouble: '╡',
|
|
240
|
+
lineUpDownRight: '├',
|
|
241
|
+
lineUpBoldDownBoldRightBold: '┣',
|
|
242
|
+
lineUpBoldDownBoldRight: '┠',
|
|
243
|
+
lineUpDownRightBold: '┝',
|
|
244
|
+
lineUpBoldDownRightBold: '┡',
|
|
245
|
+
lineUpDownBoldRightBold: '┢',
|
|
246
|
+
lineUpDownBoldRight: '┟',
|
|
247
|
+
lineUpBoldDownRight: '┞',
|
|
248
|
+
lineUpDoubleDownDoubleRightDouble: '╠',
|
|
249
|
+
lineUpDoubleDownDoubleRight: '╟',
|
|
250
|
+
lineUpDownRightDouble: '╞',
|
|
251
|
+
lineDownLeftRight: '┬',
|
|
252
|
+
lineDownBoldLeftBoldRightBold: '┳',
|
|
253
|
+
lineDownLeftBoldRightBold: '┯',
|
|
254
|
+
lineDownBoldLeftRight: '┰',
|
|
255
|
+
lineDownBoldLeftBoldRight: '┱',
|
|
256
|
+
lineDownBoldLeftRightBold: '┲',
|
|
257
|
+
lineDownLeftRightBold: '┮',
|
|
258
|
+
lineDownLeftBoldRight: '┭',
|
|
259
|
+
lineDownDoubleLeftDoubleRightDouble: '╦',
|
|
260
|
+
lineDownDoubleLeftRight: '╥',
|
|
261
|
+
lineDownLeftDoubleRightDouble: '╤',
|
|
262
|
+
lineUpLeftRight: '┴',
|
|
263
|
+
lineUpBoldLeftBoldRightBold: '┻',
|
|
264
|
+
lineUpLeftBoldRightBold: '┷',
|
|
265
|
+
lineUpBoldLeftRight: '┸',
|
|
266
|
+
lineUpBoldLeftBoldRight: '┹',
|
|
267
|
+
lineUpBoldLeftRightBold: '┺',
|
|
268
|
+
lineUpLeftRightBold: '┶',
|
|
269
|
+
lineUpLeftBoldRight: '┵',
|
|
270
|
+
lineUpDoubleLeftDoubleRightDouble: '╩',
|
|
271
|
+
lineUpDoubleLeftRight: '╨',
|
|
272
|
+
lineUpLeftDoubleRightDouble: '╧',
|
|
273
|
+
lineUpDownLeftRight: '┼',
|
|
274
|
+
lineUpBoldDownBoldLeftBoldRightBold: '╋',
|
|
275
|
+
lineUpDownBoldLeftBoldRightBold: '╈',
|
|
276
|
+
lineUpBoldDownLeftBoldRightBold: '╇',
|
|
277
|
+
lineUpBoldDownBoldLeftRightBold: '╊',
|
|
278
|
+
lineUpBoldDownBoldLeftBoldRight: '╉',
|
|
279
|
+
lineUpBoldDownLeftRight: '╀',
|
|
280
|
+
lineUpDownBoldLeftRight: '╁',
|
|
281
|
+
lineUpDownLeftBoldRight: '┽',
|
|
282
|
+
lineUpDownLeftRightBold: '┾',
|
|
283
|
+
lineUpBoldDownBoldLeftRight: '╂',
|
|
284
|
+
lineUpDownLeftBoldRightBold: '┿',
|
|
285
|
+
lineUpBoldDownLeftBoldRight: '╃',
|
|
286
|
+
lineUpBoldDownLeftRightBold: '╄',
|
|
287
|
+
lineUpDownBoldLeftBoldRight: '╅',
|
|
288
|
+
lineUpDownBoldLeftRightBold: '╆',
|
|
289
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: '╬',
|
|
290
|
+
lineUpDoubleDownDoubleLeftRight: '╫',
|
|
291
|
+
lineUpDownLeftDoubleRightDouble: '╪',
|
|
292
|
+
lineCross: '╳',
|
|
293
|
+
lineBackslash: '╲',
|
|
294
|
+
lineSlash: '╱'
|
|
295
|
+
};
|
|
296
|
+
const specialMainSymbols = {
|
|
297
|
+
tick: '✔',
|
|
298
|
+
info: 'ℹ',
|
|
299
|
+
warning: '⚠',
|
|
300
|
+
cross: '✘',
|
|
301
|
+
squareSmall: '◻',
|
|
302
|
+
squareSmallFilled: '◼',
|
|
303
|
+
circle: '◯',
|
|
304
|
+
circleFilled: '◉',
|
|
305
|
+
circleDotted: '◌',
|
|
306
|
+
circleDouble: '◎',
|
|
307
|
+
circleCircle: 'ⓞ',
|
|
308
|
+
circleCross: 'ⓧ',
|
|
309
|
+
circlePipe: 'Ⓘ',
|
|
310
|
+
radioOn: '◉',
|
|
311
|
+
radioOff: '◯',
|
|
312
|
+
checkboxOn: '☒',
|
|
313
|
+
checkboxOff: '☐',
|
|
314
|
+
checkboxCircleOn: 'ⓧ',
|
|
315
|
+
checkboxCircleOff: 'Ⓘ',
|
|
316
|
+
pointer: '❯',
|
|
317
|
+
triangleUpOutline: '△',
|
|
318
|
+
triangleLeft: '◀',
|
|
319
|
+
triangleRight: '▶',
|
|
320
|
+
lozenge: '◆',
|
|
321
|
+
lozengeOutline: '◇',
|
|
322
|
+
hamburger: '☰',
|
|
323
|
+
smiley: '㋡',
|
|
324
|
+
mustache: '෴',
|
|
325
|
+
star: '★',
|
|
326
|
+
play: '▶',
|
|
327
|
+
nodejs: '⬢',
|
|
328
|
+
oneSeventh: '⅐',
|
|
329
|
+
oneNinth: '⅑',
|
|
330
|
+
oneTenth: '⅒'
|
|
331
|
+
};
|
|
332
|
+
const specialFallbackSymbols = {
|
|
333
|
+
tick: '√',
|
|
334
|
+
info: 'i',
|
|
335
|
+
warning: '‼',
|
|
336
|
+
cross: '×',
|
|
337
|
+
squareSmall: '□',
|
|
338
|
+
squareSmallFilled: '■',
|
|
339
|
+
circle: '( )',
|
|
340
|
+
circleFilled: '(*)',
|
|
341
|
+
circleDotted: '( )',
|
|
342
|
+
circleDouble: '( )',
|
|
343
|
+
circleCircle: '(○)',
|
|
344
|
+
circleCross: '(×)',
|
|
345
|
+
circlePipe: '(│)',
|
|
346
|
+
radioOn: '(*)',
|
|
347
|
+
radioOff: '( )',
|
|
348
|
+
checkboxOn: '[×]',
|
|
349
|
+
checkboxOff: '[ ]',
|
|
350
|
+
checkboxCircleOn: '(×)',
|
|
351
|
+
checkboxCircleOff: '( )',
|
|
352
|
+
pointer: '>',
|
|
353
|
+
triangleUpOutline: '∆',
|
|
354
|
+
triangleLeft: '◄',
|
|
355
|
+
triangleRight: '►',
|
|
356
|
+
lozenge: '♦',
|
|
357
|
+
lozengeOutline: '◊',
|
|
358
|
+
hamburger: '≡',
|
|
359
|
+
smiley: '☺',
|
|
360
|
+
mustache: '┌─┐',
|
|
361
|
+
star: '✶',
|
|
362
|
+
play: '►',
|
|
363
|
+
nodejs: '♦',
|
|
364
|
+
oneSeventh: '1/7',
|
|
365
|
+
oneNinth: '1/9',
|
|
366
|
+
oneTenth: '1/10'
|
|
367
|
+
};
|
|
368
|
+
const mainSymbols = {
|
|
369
|
+
...common,
|
|
370
|
+
...specialMainSymbols
|
|
371
|
+
};
|
|
372
|
+
const fallbackSymbols = {
|
|
373
|
+
...common,
|
|
374
|
+
...specialFallbackSymbols
|
|
375
|
+
};
|
|
376
|
+
const shouldUseMain = isUnicodeSupported();
|
|
377
|
+
const figures_figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
378
|
+
const node_modules_figures = figures_figures;
|
|
379
|
+
Object.entries(specialMainSymbols);
|
|
380
|
+
const colorByVariant = {
|
|
381
|
+
info: 'blue',
|
|
382
|
+
success: 'green',
|
|
383
|
+
error: 'red',
|
|
384
|
+
warning: 'yellow'
|
|
385
|
+
};
|
|
386
|
+
const theme_theme = {
|
|
387
|
+
styles: {
|
|
388
|
+
container: ({ variant })=>({
|
|
389
|
+
flexGrow: 1,
|
|
390
|
+
borderStyle: 'round',
|
|
391
|
+
borderColor: colorByVariant[variant],
|
|
392
|
+
gap: 1,
|
|
393
|
+
paddingX: 1
|
|
394
|
+
}),
|
|
395
|
+
iconContainer: ()=>({
|
|
396
|
+
flexShrink: 0
|
|
397
|
+
}),
|
|
398
|
+
icon: ({ variant })=>({
|
|
399
|
+
color: colorByVariant[variant]
|
|
400
|
+
}),
|
|
401
|
+
content: ()=>({
|
|
402
|
+
flexShrink: 1,
|
|
403
|
+
flexGrow: 1,
|
|
404
|
+
minWidth: 0,
|
|
405
|
+
flexDirection: 'column',
|
|
406
|
+
gap: 1
|
|
407
|
+
}),
|
|
408
|
+
title: ()=>({
|
|
409
|
+
bold: true
|
|
410
|
+
}),
|
|
411
|
+
message: ()=>({})
|
|
412
|
+
},
|
|
413
|
+
config ({ variant }) {
|
|
414
|
+
let icon;
|
|
415
|
+
if ('info' === variant) icon = node_modules_figures.info;
|
|
416
|
+
if ('success' === variant) icon = node_modules_figures.tick;
|
|
417
|
+
if ('error' === variant) icon = node_modules_figures.cross;
|
|
418
|
+
if ('warning' === variant) icon = node_modules_figures.warning;
|
|
419
|
+
return {
|
|
420
|
+
icon
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
const alert_theme = theme_theme;
|
|
425
|
+
const badge_theme_theme = {
|
|
426
|
+
styles: {
|
|
427
|
+
container: ({ color })=>({
|
|
428
|
+
backgroundColor: color
|
|
429
|
+
}),
|
|
430
|
+
label: ()=>({
|
|
431
|
+
color: 'black'
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
const badge_theme = badge_theme_theme;
|
|
436
|
+
const confirm_input_theme_theme = {
|
|
437
|
+
styles: {
|
|
438
|
+
input: ({ isFocused })=>({
|
|
439
|
+
dimColor: !isFocused
|
|
440
|
+
})
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
const confirm_input_theme = confirm_input_theme_theme;
|
|
444
|
+
const multi_select_theme_theme = {
|
|
445
|
+
styles: {
|
|
446
|
+
container: ()=>({
|
|
447
|
+
flexDirection: 'column'
|
|
448
|
+
}),
|
|
449
|
+
option: ({ isFocused })=>({
|
|
450
|
+
gap: 1,
|
|
451
|
+
paddingLeft: isFocused ? 0 : 2
|
|
452
|
+
}),
|
|
453
|
+
selectedIndicator: ()=>({
|
|
454
|
+
color: 'green'
|
|
455
|
+
}),
|
|
456
|
+
focusIndicator: ()=>({
|
|
457
|
+
color: 'blue'
|
|
458
|
+
}),
|
|
459
|
+
label ({ isFocused, isSelected }) {
|
|
460
|
+
let color;
|
|
461
|
+
if (isSelected) color = 'green';
|
|
462
|
+
if (isFocused) color = 'blue';
|
|
463
|
+
return {
|
|
464
|
+
color
|
|
465
|
+
};
|
|
466
|
+
},
|
|
467
|
+
highlightedText: ()=>({
|
|
468
|
+
bold: true
|
|
469
|
+
})
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
const multi_select_theme = multi_select_theme_theme;
|
|
473
|
+
const ordered_list_theme_theme = {
|
|
474
|
+
styles: {
|
|
475
|
+
list: ()=>({
|
|
476
|
+
flexDirection: 'column'
|
|
477
|
+
}),
|
|
478
|
+
listItem: ()=>({
|
|
479
|
+
gap: 1
|
|
480
|
+
}),
|
|
481
|
+
marker: ()=>({
|
|
482
|
+
dimColor: true
|
|
483
|
+
}),
|
|
484
|
+
content: ()=>({
|
|
485
|
+
flexDirection: 'column'
|
|
486
|
+
})
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
const ordered_list_theme = ordered_list_theme_theme;
|
|
490
|
+
const progress_bar_theme_theme = {
|
|
491
|
+
styles: {
|
|
492
|
+
container: ()=>({
|
|
493
|
+
flexGrow: 1,
|
|
494
|
+
minWidth: 0
|
|
495
|
+
}),
|
|
496
|
+
completed: ()=>({
|
|
497
|
+
color: 'magenta'
|
|
498
|
+
}),
|
|
499
|
+
remaining: ()=>({
|
|
500
|
+
dimColor: true
|
|
501
|
+
})
|
|
502
|
+
},
|
|
503
|
+
config: ()=>({
|
|
504
|
+
completedCharacter: node_modules_figures.square,
|
|
505
|
+
remainingCharacter: node_modules_figures.squareLightShade
|
|
506
|
+
})
|
|
507
|
+
};
|
|
508
|
+
const progress_bar_theme = progress_bar_theme_theme;
|
|
509
|
+
const select_theme_theme = {
|
|
510
|
+
styles: {
|
|
511
|
+
container: ()=>({
|
|
512
|
+
flexDirection: 'column'
|
|
513
|
+
}),
|
|
514
|
+
option: ({ isFocused })=>({
|
|
515
|
+
gap: 1,
|
|
516
|
+
paddingLeft: isFocused ? 0 : 2
|
|
517
|
+
}),
|
|
518
|
+
selectedIndicator: ()=>({
|
|
519
|
+
color: 'green'
|
|
520
|
+
}),
|
|
521
|
+
focusIndicator: ()=>({
|
|
522
|
+
color: 'blue'
|
|
523
|
+
}),
|
|
524
|
+
label ({ isFocused, isSelected }) {
|
|
525
|
+
let color;
|
|
526
|
+
if (isSelected) color = 'green';
|
|
527
|
+
if (isFocused) color = 'blue';
|
|
528
|
+
return {
|
|
529
|
+
color
|
|
530
|
+
};
|
|
531
|
+
},
|
|
532
|
+
highlightedText: ()=>({
|
|
533
|
+
bold: true
|
|
534
|
+
})
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
const select_theme = select_theme_theme;
|
|
538
|
+
const spinner_theme_theme = {
|
|
539
|
+
styles: {
|
|
540
|
+
container: ()=>({
|
|
541
|
+
gap: 1
|
|
542
|
+
}),
|
|
543
|
+
frame: ()=>({
|
|
544
|
+
color: 'blue'
|
|
545
|
+
}),
|
|
546
|
+
label: ()=>({})
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
const spinner_theme = spinner_theme_theme;
|
|
550
|
+
const theme_colorByVariant = {
|
|
551
|
+
success: 'green',
|
|
552
|
+
error: 'red',
|
|
553
|
+
warning: 'yellow',
|
|
554
|
+
info: 'blue'
|
|
555
|
+
};
|
|
556
|
+
const iconByVariant = {
|
|
557
|
+
success: node_modules_figures.tick,
|
|
558
|
+
error: node_modules_figures.cross,
|
|
559
|
+
warning: node_modules_figures.warning,
|
|
560
|
+
info: node_modules_figures.info
|
|
561
|
+
};
|
|
562
|
+
const status_message_theme_theme = {
|
|
563
|
+
styles: {
|
|
564
|
+
container: ()=>({
|
|
565
|
+
gap: 1
|
|
566
|
+
}),
|
|
567
|
+
iconContainer: ()=>({
|
|
568
|
+
flexShrink: 0
|
|
569
|
+
}),
|
|
570
|
+
icon: ({ variant })=>({
|
|
571
|
+
color: theme_colorByVariant[variant]
|
|
572
|
+
}),
|
|
573
|
+
message: ()=>({})
|
|
574
|
+
},
|
|
575
|
+
config: ({ variant })=>({
|
|
576
|
+
icon: iconByVariant[variant]
|
|
577
|
+
})
|
|
578
|
+
};
|
|
579
|
+
const status_message_theme = status_message_theme_theme;
|
|
580
|
+
const unordered_list_theme_theme = {
|
|
581
|
+
styles: {
|
|
582
|
+
list: ()=>({
|
|
583
|
+
flexDirection: 'column'
|
|
584
|
+
}),
|
|
585
|
+
listItem: ()=>({
|
|
586
|
+
gap: 1
|
|
587
|
+
}),
|
|
588
|
+
marker: ()=>({
|
|
589
|
+
dimColor: true
|
|
590
|
+
}),
|
|
591
|
+
content: ()=>({
|
|
592
|
+
flexDirection: 'column'
|
|
593
|
+
})
|
|
594
|
+
},
|
|
595
|
+
config: ()=>({
|
|
596
|
+
marker: node_modules_figures.line
|
|
597
|
+
})
|
|
598
|
+
};
|
|
599
|
+
const unordered_list_theme = unordered_list_theme_theme;
|
|
600
|
+
const text_input_theme_theme = {
|
|
601
|
+
styles: {
|
|
602
|
+
value: ()=>({})
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
const text_input_theme = text_input_theme_theme;
|
|
606
|
+
const email_input_theme_theme = {
|
|
607
|
+
styles: {
|
|
608
|
+
value: ()=>({})
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
const email_input_theme = email_input_theme_theme;
|
|
612
|
+
const password_input_theme_theme = {
|
|
613
|
+
styles: {
|
|
614
|
+
value: ()=>({})
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
const password_input_theme = password_input_theme_theme;
|
|
618
|
+
__webpack_require__("../../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
|
|
619
|
+
const defaultTheme = {
|
|
620
|
+
components: {
|
|
621
|
+
Alert: alert_theme,
|
|
622
|
+
Badge: badge_theme,
|
|
623
|
+
ConfirmInput: confirm_input_theme,
|
|
624
|
+
MultiSelect: multi_select_theme,
|
|
625
|
+
OrderedList: ordered_list_theme,
|
|
626
|
+
ProgressBar: progress_bar_theme,
|
|
627
|
+
Select: select_theme,
|
|
628
|
+
Spinner: spinner_theme,
|
|
629
|
+
StatusMessage: status_message_theme,
|
|
630
|
+
UnorderedList: unordered_list_theme,
|
|
631
|
+
TextInput: text_input_theme,
|
|
632
|
+
EmailInput: email_input_theme,
|
|
633
|
+
PasswordInput: password_input_theme
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
const ThemeContext = createContext(defaultTheme);
|
|
637
|
+
const theme_useComponentTheme = (component)=>{
|
|
638
|
+
const theme = useContext(ThemeContext);
|
|
639
|
+
return theme.components[component];
|
|
640
|
+
};
|
|
641
|
+
const defaultMarker = node_modules_figures.line;
|
|
642
|
+
const UnorderedListItemContext = createContext({
|
|
643
|
+
marker: defaultMarker
|
|
644
|
+
});
|
|
645
|
+
function UnorderedListItem({ children }) {
|
|
646
|
+
const { marker } = useContext(UnorderedListItemContext);
|
|
647
|
+
const { styles } = theme_useComponentTheme('UnorderedList');
|
|
648
|
+
return react.createElement(external_ink_Box, {
|
|
649
|
+
...styles.listItem()
|
|
650
|
+
}, react.createElement(external_ink_Text, {
|
|
651
|
+
...styles.marker()
|
|
652
|
+
}, marker), react.createElement(external_ink_Box, {
|
|
653
|
+
...styles.content()
|
|
654
|
+
}, children));
|
|
655
|
+
}
|
|
656
|
+
const UnorderedListContext = createContext({
|
|
657
|
+
depth: 0
|
|
658
|
+
});
|
|
659
|
+
function UnorderedList({ children }) {
|
|
660
|
+
const { depth } = useContext(UnorderedListContext);
|
|
661
|
+
const { styles, config } = theme_useComponentTheme('UnorderedList');
|
|
662
|
+
const listContext = external_react_useMemo(()=>({
|
|
663
|
+
depth: depth + 1
|
|
664
|
+
}), [
|
|
665
|
+
depth
|
|
666
|
+
]);
|
|
667
|
+
const listItemContext = external_react_useMemo(()=>{
|
|
668
|
+
const { marker } = config();
|
|
669
|
+
if ('string' == typeof marker) return {
|
|
670
|
+
marker
|
|
671
|
+
};
|
|
672
|
+
if (Array.isArray(marker)) return {
|
|
673
|
+
marker: marker[depth] ?? marker.at(-1) ?? defaultMarker
|
|
674
|
+
};
|
|
675
|
+
return {
|
|
676
|
+
marker: defaultMarker
|
|
677
|
+
};
|
|
678
|
+
}, [
|
|
679
|
+
config,
|
|
680
|
+
depth
|
|
681
|
+
]);
|
|
682
|
+
return react.createElement(UnorderedListContext.Provider, {
|
|
683
|
+
value: listContext
|
|
684
|
+
}, react.createElement(UnorderedListItemContext.Provider, {
|
|
685
|
+
value: listItemContext
|
|
686
|
+
}, react.createElement(external_ink_Box, {
|
|
687
|
+
...styles.list()
|
|
688
|
+
}, children)));
|
|
689
|
+
}
|
|
690
|
+
UnorderedList.Item = UnorderedListItem;
|
|
691
|
+
class option_map_OptionMap extends Map {
|
|
692
|
+
first;
|
|
693
|
+
constructor(options){
|
|
694
|
+
const items = [];
|
|
695
|
+
let firstItem;
|
|
696
|
+
let previous;
|
|
697
|
+
let index = 0;
|
|
698
|
+
for (const option of options){
|
|
699
|
+
const item = {
|
|
700
|
+
...option,
|
|
701
|
+
previous,
|
|
702
|
+
next: void 0,
|
|
703
|
+
index
|
|
704
|
+
};
|
|
705
|
+
if (previous) previous.next = item;
|
|
706
|
+
firstItem ||= item;
|
|
707
|
+
items.push([
|
|
708
|
+
option.value,
|
|
709
|
+
item
|
|
710
|
+
]);
|
|
711
|
+
index++;
|
|
712
|
+
previous = item;
|
|
713
|
+
}
|
|
714
|
+
super(items);
|
|
715
|
+
this.first = firstItem;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
function SelectOption({ isFocused, isSelected, children }) {
|
|
719
|
+
const { styles } = theme_useComponentTheme('Select');
|
|
720
|
+
return react.createElement(external_ink_Box, {
|
|
721
|
+
...styles.option({
|
|
722
|
+
isFocused
|
|
723
|
+
})
|
|
724
|
+
}, isFocused && react.createElement(external_ink_Text, {
|
|
725
|
+
...styles.focusIndicator()
|
|
726
|
+
}, node_modules_figures.pointer), react.createElement(external_ink_Text, {
|
|
727
|
+
...styles.label({
|
|
728
|
+
isFocused,
|
|
729
|
+
isSelected
|
|
730
|
+
})
|
|
731
|
+
}, children), isSelected && react.createElement(external_ink_Text, {
|
|
732
|
+
...styles.selectedIndicator()
|
|
733
|
+
}, node_modules_figures.tick));
|
|
734
|
+
}
|
|
735
|
+
const use_select_state_reducer = (state, action)=>{
|
|
736
|
+
switch(action.type){
|
|
737
|
+
case 'focus-next-option':
|
|
738
|
+
{
|
|
739
|
+
if (!state.focusedValue) return state;
|
|
740
|
+
const item = state.optionMap.get(state.focusedValue);
|
|
741
|
+
if (!item) return state;
|
|
742
|
+
const next = item.next;
|
|
743
|
+
if (!next) return state;
|
|
744
|
+
const needsToScroll = next.index >= state.visibleToIndex;
|
|
745
|
+
if (!needsToScroll) return {
|
|
746
|
+
...state,
|
|
747
|
+
focusedValue: next.value
|
|
748
|
+
};
|
|
749
|
+
const nextVisibleToIndex = Math.min(state.optionMap.size, state.visibleToIndex + 1);
|
|
750
|
+
const nextVisibleFromIndex = nextVisibleToIndex - state.visibleOptionCount;
|
|
751
|
+
return {
|
|
752
|
+
...state,
|
|
753
|
+
focusedValue: next.value,
|
|
754
|
+
visibleFromIndex: nextVisibleFromIndex,
|
|
755
|
+
visibleToIndex: nextVisibleToIndex
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
case 'focus-previous-option':
|
|
759
|
+
{
|
|
760
|
+
if (!state.focusedValue) return state;
|
|
761
|
+
const item = state.optionMap.get(state.focusedValue);
|
|
762
|
+
if (!item) return state;
|
|
763
|
+
const previous = item.previous;
|
|
764
|
+
if (!previous) return state;
|
|
765
|
+
const needsToScroll = previous.index <= state.visibleFromIndex;
|
|
766
|
+
if (!needsToScroll) return {
|
|
767
|
+
...state,
|
|
768
|
+
focusedValue: previous.value
|
|
769
|
+
};
|
|
770
|
+
const nextVisibleFromIndex = Math.max(0, state.visibleFromIndex - 1);
|
|
771
|
+
const nextVisibleToIndex = nextVisibleFromIndex + state.visibleOptionCount;
|
|
772
|
+
return {
|
|
773
|
+
...state,
|
|
774
|
+
focusedValue: previous.value,
|
|
775
|
+
visibleFromIndex: nextVisibleFromIndex,
|
|
776
|
+
visibleToIndex: nextVisibleToIndex
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
case 'select-focused-option':
|
|
780
|
+
return {
|
|
781
|
+
...state,
|
|
782
|
+
previousValue: state.value,
|
|
783
|
+
value: state.focusedValue
|
|
784
|
+
};
|
|
785
|
+
case 'reset':
|
|
786
|
+
return action.state;
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
const use_select_state_createDefaultState = ({ visibleOptionCount: customVisibleOptionCount, defaultValue, options })=>{
|
|
790
|
+
const visibleOptionCount = 'number' == typeof customVisibleOptionCount ? Math.min(customVisibleOptionCount, options.length) : options.length;
|
|
791
|
+
const optionMap = new option_map_OptionMap(options);
|
|
792
|
+
return {
|
|
793
|
+
optionMap,
|
|
794
|
+
visibleOptionCount,
|
|
795
|
+
focusedValue: optionMap.first?.value,
|
|
796
|
+
visibleFromIndex: 0,
|
|
797
|
+
visibleToIndex: visibleOptionCount,
|
|
798
|
+
previousValue: defaultValue,
|
|
799
|
+
value: defaultValue
|
|
800
|
+
};
|
|
801
|
+
};
|
|
802
|
+
const useSelectState = ({ visibleOptionCount = 5, options, defaultValue, onChange })=>{
|
|
803
|
+
const [state, dispatch] = external_react_useReducer(use_select_state_reducer, {
|
|
804
|
+
visibleOptionCount,
|
|
805
|
+
defaultValue,
|
|
806
|
+
options
|
|
807
|
+
}, use_select_state_createDefaultState);
|
|
808
|
+
const [lastOptions, setLastOptions] = external_react_useState(options);
|
|
809
|
+
if (options !== lastOptions && !external_node_util_isDeepStrictEqual(options, lastOptions)) {
|
|
810
|
+
dispatch({
|
|
811
|
+
type: 'reset',
|
|
812
|
+
state: use_select_state_createDefaultState({
|
|
813
|
+
visibleOptionCount,
|
|
814
|
+
defaultValue,
|
|
815
|
+
options
|
|
816
|
+
})
|
|
817
|
+
});
|
|
818
|
+
setLastOptions(options);
|
|
819
|
+
}
|
|
820
|
+
const focusNextOption = external_react_useCallback(()=>{
|
|
821
|
+
dispatch({
|
|
822
|
+
type: 'focus-next-option'
|
|
823
|
+
});
|
|
824
|
+
}, []);
|
|
825
|
+
const focusPreviousOption = external_react_useCallback(()=>{
|
|
826
|
+
dispatch({
|
|
827
|
+
type: 'focus-previous-option'
|
|
828
|
+
});
|
|
829
|
+
}, []);
|
|
830
|
+
const selectFocusedOption = external_react_useCallback(()=>{
|
|
831
|
+
dispatch({
|
|
832
|
+
type: 'select-focused-option'
|
|
833
|
+
});
|
|
834
|
+
}, []);
|
|
835
|
+
const visibleOptions = external_react_useMemo(()=>options.map((option, index)=>({
|
|
836
|
+
...option,
|
|
837
|
+
index
|
|
838
|
+
})).slice(state.visibleFromIndex, state.visibleToIndex), [
|
|
839
|
+
options,
|
|
840
|
+
state.visibleFromIndex,
|
|
841
|
+
state.visibleToIndex
|
|
842
|
+
]);
|
|
843
|
+
external_react_useEffect(()=>{
|
|
844
|
+
if (state.value && state.previousValue !== state.value) onChange?.(state.value);
|
|
845
|
+
}, [
|
|
846
|
+
state.previousValue,
|
|
847
|
+
state.value,
|
|
848
|
+
options,
|
|
849
|
+
onChange
|
|
850
|
+
]);
|
|
851
|
+
return {
|
|
852
|
+
focusedValue: state.focusedValue,
|
|
853
|
+
visibleFromIndex: state.visibleFromIndex,
|
|
854
|
+
visibleToIndex: state.visibleToIndex,
|
|
855
|
+
value: state.value,
|
|
856
|
+
visibleOptions,
|
|
857
|
+
focusNextOption,
|
|
858
|
+
focusPreviousOption,
|
|
859
|
+
selectFocusedOption
|
|
860
|
+
};
|
|
861
|
+
};
|
|
862
|
+
const useSelect = ({ isDisabled = false, state })=>{
|
|
863
|
+
external_ink_useInput((_input, key)=>{
|
|
864
|
+
if (key.downArrow) state.focusNextOption();
|
|
865
|
+
if (key.upArrow) state.focusPreviousOption();
|
|
866
|
+
if (key.return) state.selectFocusedOption();
|
|
867
|
+
}, {
|
|
868
|
+
isActive: !isDisabled
|
|
869
|
+
});
|
|
870
|
+
};
|
|
871
|
+
function Select({ isDisabled = false, visibleOptionCount = 5, highlightText, options, defaultValue, onChange }) {
|
|
872
|
+
const state = useSelectState({
|
|
873
|
+
visibleOptionCount,
|
|
874
|
+
options,
|
|
875
|
+
defaultValue,
|
|
876
|
+
onChange
|
|
877
|
+
});
|
|
878
|
+
useSelect({
|
|
879
|
+
isDisabled,
|
|
880
|
+
state
|
|
881
|
+
});
|
|
882
|
+
const { styles } = theme_useComponentTheme('Select');
|
|
883
|
+
return react.createElement(external_ink_Box, {
|
|
884
|
+
...styles.container()
|
|
885
|
+
}, state.visibleOptions.map((option)=>{
|
|
886
|
+
let label = option.label;
|
|
887
|
+
if (highlightText && option.label.includes(highlightText)) {
|
|
888
|
+
const index = option.label.indexOf(highlightText);
|
|
889
|
+
label = react.createElement(react.Fragment, null, option.label.slice(0, index), react.createElement(external_ink_Text, {
|
|
890
|
+
...styles.highlightedText()
|
|
891
|
+
}, highlightText), option.label.slice(index + highlightText.length));
|
|
892
|
+
}
|
|
893
|
+
return react.createElement(SelectOption, {
|
|
894
|
+
key: option.value,
|
|
895
|
+
isFocused: !isDisabled && state.focusedValue === option.value,
|
|
896
|
+
isSelected: state.value === option.value
|
|
897
|
+
}, label);
|
|
898
|
+
}));
|
|
899
|
+
}
|
|
900
|
+
var spinners_namespaceObject = /*#__PURE__*/ JSON.parse('{"dots":{"interval":80,"frames":["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]},"dots2":{"interval":80,"frames":["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"]},"dots3":{"interval":80,"frames":["⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓"]},"dots4":{"interval":80,"frames":["⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆"]},"dots5":{"interval":80,"frames":["⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋"]},"dots6":{"interval":80,"frames":["⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁"]},"dots7":{"interval":80,"frames":["⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈"]},"dots8":{"interval":80,"frames":["⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈"]},"dots9":{"interval":80,"frames":["⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏"]},"dots10":{"interval":80,"frames":["⢄","⢂","⢁","⡁","⡈","⡐","⡠"]},"dots11":{"interval":100,"frames":["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"]},"dots12":{"interval":80,"frames":["⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐","⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩","⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀"]},"dots13":{"interval":80,"frames":["⣼","⣹","⢻","⠿","⡟","⣏","⣧","⣶"]},"dots14":{"interval":80,"frames":["⠉⠉","⠈⠙","⠀⠹","⠀⢸","⠀⣰","⢀⣠","⣀⣀","⣄⡀","⣆⠀","⡇⠀","⠏⠀","⠋⠁"]},"dots8Bit":{"interval":80,"frames":["⠀","⠁","⠂","⠃","⠄","⠅","⠆","⠇","⡀","⡁","⡂","⡃","⡄","⡅","⡆","⡇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⡈","⡉","⡊","⡋","⡌","⡍","⡎","⡏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⡐","⡑","⡒","⡓","⡔","⡕","⡖","⡗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⡘","⡙","⡚","⡛","⡜","⡝","⡞","⡟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⡠","⡡","⡢","⡣","⡤","⡥","⡦","⡧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⡨","⡩","⡪","⡫","⡬","⡭","⡮","⡯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⡰","⡱","⡲","⡳","⡴","⡵","⡶","⡷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿","⡸","⡹","⡺","⡻","⡼","⡽","⡾","⡿","⢀","⢁","⢂","⢃","⢄","⢅","⢆","⢇","⣀","⣁","⣂","⣃","⣄","⣅","⣆","⣇","⢈","⢉","⢊","⢋","⢌","⢍","⢎","⢏","⣈","⣉","⣊","⣋","⣌","⣍","⣎","⣏","⢐","⢑","⢒","⢓","⢔","⢕","⢖","⢗","⣐","⣑","⣒","⣓","⣔","⣕","⣖","⣗","⢘","⢙","⢚","⢛","⢜","⢝","⢞","⢟","⣘","⣙","⣚","⣛","⣜","⣝","⣞","⣟","⢠","⢡","⢢","⢣","⢤","⢥","⢦","⢧","⣠","⣡","⣢","⣣","⣤","⣥","⣦","⣧","⢨","⢩","⢪","⢫","⢬","⢭","⢮","⢯","⣨","⣩","⣪","⣫","⣬","⣭","⣮","⣯","⢰","⢱","⢲","⢳","⢴","⢵","⢶","⢷","⣰","⣱","⣲","⣳","⣴","⣵","⣶","⣷","⢸","⢹","⢺","⢻","⢼","⢽","⢾","⢿","⣸","⣹","⣺","⣻","⣼","⣽","⣾","⣿"]},"dotsCircle":{"interval":80,"frames":["⢎ ","⠎⠁","⠊⠑","⠈⠱"," ⡱","⢀⡰","⢄⡠","⢆⡀"]},"sand":{"interval":80,"frames":["⠁","⠂","⠄","⡀","⡈","⡐","⡠","⣀","⣁","⣂","⣄","⣌","⣔","⣤","⣥","⣦","⣮","⣶","⣷","⣿","⡿","⠿","⢟","⠟","⡛","⠛","⠫","⢋","⠋","⠍","⡉","⠉","⠑","⠡","⢁"]},"line":{"interval":130,"frames":["-","\\\\","|","/"]},"line2":{"interval":100,"frames":["⠂","-","–","—","–","-"]},"rollingLine":{"interval":80,"frames":["/ "," - "," \\\\ "," |"," |"," \\\\ "," - ","/ "]},"pipe":{"interval":100,"frames":["┤","┘","┴","└","├","┌","┬","┐"]},"simpleDots":{"interval":400,"frames":[". ",".. ","..."," "]},"simpleDotsScrolling":{"interval":200,"frames":[". ",".. ","..."," .."," ."," "]},"star":{"interval":70,"frames":["✶","✸","✹","✺","✹","✷"]},"star2":{"interval":80,"frames":["+","x","*"]},"flip":{"interval":70,"frames":["_","_","_","-","`","`","\'","´","-","_","_","_"]},"hamburger":{"interval":100,"frames":["☱","☲","☴"]},"growVertical":{"interval":120,"frames":["▁","▃","▄","▅","▆","▇","▆","▅","▄","▃"]},"growHorizontal":{"interval":120,"frames":["▏","▎","▍","▌","▋","▊","▉","▊","▋","▌","▍","▎"]},"balloon":{"interval":140,"frames":[" ",".","o","O","@","*"," "]},"balloon2":{"interval":120,"frames":[".","o","O","°","O","o","."]},"noise":{"interval":100,"frames":["▓","▒","░"]},"bounce":{"interval":120,"frames":["⠁","⠂","⠄","⠂"]},"boxBounce":{"interval":120,"frames":["▖","▘","▝","▗"]},"boxBounce2":{"interval":100,"frames":["▌","▀","▐","▄"]},"triangle":{"interval":50,"frames":["◢","◣","◤","◥"]},"binary":{"interval":80,"frames":["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},"arc":{"interval":100,"frames":["◜","◠","◝","◞","◡","◟"]},"circle":{"interval":120,"frames":["◡","⊙","◠"]},"squareCorners":{"interval":180,"frames":["◰","◳","◲","◱"]},"circleQuarters":{"interval":120,"frames":["◴","◷","◶","◵"]},"circleHalves":{"interval":50,"frames":["◐","◓","◑","◒"]},"squish":{"interval":100,"frames":["╫","╪"]},"toggle":{"interval":250,"frames":["⊶","⊷"]},"toggle2":{"interval":80,"frames":["▫","▪"]},"toggle3":{"interval":120,"frames":["□","■"]},"toggle4":{"interval":100,"frames":["■","□","▪","▫"]},"toggle5":{"interval":100,"frames":["▮","▯"]},"toggle6":{"interval":300,"frames":["ဝ","၀"]},"toggle7":{"interval":80,"frames":["⦾","⦿"]},"toggle8":{"interval":100,"frames":["◍","◌"]},"toggle9":{"interval":100,"frames":["◉","◎"]},"toggle10":{"interval":100,"frames":["㊂","㊀","㊁"]},"toggle11":{"interval":50,"frames":["⧇","⧆"]},"toggle12":{"interval":120,"frames":["☗","☖"]},"toggle13":{"interval":80,"frames":["=","*","-"]},"arrow":{"interval":100,"frames":["←","↖","↑","↗","→","↘","↓","↙"]},"arrow2":{"interval":80,"frames":["⬆️ ","↗️ ","➡️ ","↘️ ","⬇️ ","↙️ ","⬅️ ","↖️ "]},"arrow3":{"interval":120,"frames":["▹▹▹▹▹","▸▹▹▹▹","▹▸▹▹▹","▹▹▸▹▹","▹▹▹▸▹","▹▹▹▹▸"]},"bouncingBar":{"interval":80,"frames":["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},"bouncingBall":{"interval":80,"frames":["( ● )","( ● )","( ● )","( ● )","( ●)","( ● )","( ● )","( ● )","( ● )","(● )"]},"smiley":{"interval":200,"frames":["😄 ","😝 "]},"monkey":{"interval":300,"frames":["🙈 ","🙈 ","🙉 ","🙊 "]},"hearts":{"interval":100,"frames":["💛 ","💙 ","💜 ","💚 ","💗 "]},"clock":{"interval":100,"frames":["🕛 ","🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]},"earth":{"interval":180,"frames":["🌍 ","🌎 ","🌏 "]},"material":{"interval":17,"frames":["█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███████▁▁▁▁▁▁▁▁▁▁▁▁▁","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","██████████▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","█████████████▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁██████████████▁▁▁▁","▁▁▁██████████████▁▁▁","▁▁▁▁█████████████▁▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁▁▁████████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","██████▁▁▁▁▁▁▁▁▁▁▁▁▁█","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁▁█████████████▁▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁▁███████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁▁█████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"]},"moon":{"interval":80,"frames":["🌑 ","🌒 ","🌓 ","🌔 ","🌕 ","🌖 ","🌗 ","🌘 "]},"runner":{"interval":140,"frames":["🚶 ","🏃 "]},"pong":{"interval":80,"frames":["▐⠂ ▌","▐⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂▌","▐ ⠠▌","▐ ⡀▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐⠠ ▌"]},"shark":{"interval":120,"frames":["▐|\\\\____________▌","▐_|\\\\___________▌","▐__|\\\\__________▌","▐___|\\\\_________▌","▐____|\\\\________▌","▐_____|\\\\_______▌","▐______|\\\\______▌","▐_______|\\\\_____▌","▐________|\\\\____▌","▐_________|\\\\___▌","▐__________|\\\\__▌","▐___________|\\\\_▌","▐____________|\\\\▌","▐____________/|▌","▐___________/|_▌","▐__________/|__▌","▐_________/|___▌","▐________/|____▌","▐_______/|_____▌","▐______/|______▌","▐_____/|_______▌","▐____/|________▌","▐___/|_________▌","▐__/|__________▌","▐_/|___________▌","▐/|____________▌"]},"dqpb":{"interval":100,"frames":["d","q","p","b"]},"weather":{"interval":100,"frames":["☀️ ","☀️ ","☀️ ","🌤 ","⛅️ ","🌥 ","☁️ ","🌧 ","🌨 ","🌧 ","🌨 ","🌧 ","🌨 ","⛈ ","🌨 ","🌧 ","🌨 ","☁️ ","🌥 ","⛅️ ","🌤 ","☀️ ","☀️ "]},"christmas":{"interval":400,"frames":["🌲","🎄"]},"grenade":{"interval":80,"frames":["، ","′ "," ´ "," ‾ "," ⸌"," ⸊"," |"," ⁎"," ⁕"," ෴ "," ⁓"," "," "," "]},"point":{"interval":125,"frames":["∙∙∙","●∙∙","∙●∙","∙∙●","∙∙∙"]},"layer":{"interval":150,"frames":["-","=","≡"]},"betaWave":{"interval":80,"frames":["ρββββββ","βρβββββ","ββρββββ","βββρβββ","ββββρββ","βββββρβ","ββββββρ"]},"fingerDance":{"interval":160,"frames":["🤘 ","🤟 ","🖖 ","✋ ","🤚 ","👆 "]},"fistBump":{"interval":80,"frames":["🤜 🤛 ","🤜 🤛 ","🤜 🤛 "," 🤜 🤛 "," 🤜🤛 "," 🤜✨🤛 ","🤜 ✨ 🤛 "]},"soccerHeader":{"interval":80,"frames":[" 🧑⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 "]},"mindblown":{"interval":160,"frames":["😐 ","😐 ","😮 ","😮 ","😦 ","😦 ","😧 ","😧 ","🤯 ","💥 ","✨ "," "," "," "]},"speaker":{"interval":160,"frames":["🔈 ","🔉 ","🔊 ","🔉 "]},"orangePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 "]},"bluePulse":{"interval":100,"frames":["🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"orangeBluePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 ","🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"timeTravel":{"interval":100,"frames":["🕛 ","🕚 ","🕙 ","🕘 ","🕗 ","🕖 ","🕕 ","🕔 ","🕓 ","🕒 ","🕑 ","🕐 "]},"aesthetic":{"interval":80,"frames":["▰▱▱▱▱▱▱","▰▰▱▱▱▱▱","▰▰▰▱▱▱▱","▰▰▰▰▱▱▱","▰▰▰▰▰▱▱","▰▰▰▰▰▰▱","▰▰▰▰▰▰▰","▰▱▱▱▱▱▱"]},"dwarfFortress":{"interval":80,"frames":[" ██████£££ ","☺██████£££ ","☺██████£££ ","☺▓█████£££ ","☺▓█████£££ ","☺▒█████£££ ","☺▒█████£££ ","☺░█████£££ ","☺░█████£££ ","☺ █████£££ "," ☺█████£££ "," ☺█████£££ "," ☺▓████£££ "," ☺▓████£££ "," ☺▒████£££ "," ☺▒████£££ "," ☺░████£££ "," ☺░████£££ "," ☺ ████£££ "," ☺████£££ "," ☺████£££ "," ☺▓███£££ "," ☺▓███£££ "," ☺▒███£££ "," ☺▒███£££ "," ☺░███£££ "," ☺░███£££ "," ☺ ███£££ "," ☺███£££ "," ☺███£££ "," ☺▓██£££ "," ☺▓██£££ "," ☺▒██£££ "," ☺▒██£££ "," ☺░██£££ "," ☺░██£££ "," ☺ ██£££ "," ☺██£££ "," ☺██£££ "," ☺▓█£££ "," ☺▓█£££ "," ☺▒█£££ "," ☺▒█£££ "," ☺░█£££ "," ☺░█£££ "," ☺ █£££ "," ☺█£££ "," ☺█£££ "," ☺▓£££ "," ☺▓£££ "," ☺▒£££ "," ☺▒£££ "," ☺░£££ "," ☺░£££ "," ☺ £££ "," ☺£££ "," ☺£££ "," ☺▓££ "," ☺▓££ "," ☺▒££ "," ☺▒££ "," ☺░££ "," ☺░££ "," ☺ ££ "," ☺££ "," ☺££ "," ☺▓£ "," ☺▓£ "," ☺▒£ "," ☺▒£ "," ☺░£ "," ☺░£ "," ☺ £ "," ☺£ "," ☺£ "," ☺▓ "," ☺▓ "," ☺▒ "," ☺▒ "," ☺░ "," ☺░ "," ☺ "," ☺ &"," ☺ ☼&"," ☺ ☼ &"," ☺☼ &"," ☺☼ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & ","‼ & "," & "," & "," & ░ "," & ▒ "," & ▓ "," & £ "," & ░£ "," & ▒£ "," & ▓£ "," & ££ "," & ░££ "," & ▒££ ","& ▓££ ","& £££ "," ░£££ "," ▒£££ "," ▓£££ "," █£££ "," ░█£££ "," ▒█£££ "," ▓█£££ "," ██£££ "," ░██£££ "," ▒██£££ "," ▓██£££ "," ███£££ "," ░███£££ "," ▒███£££ "," ▓███£££ "," ████£££ "," ░████£££ "," ▒████£££ "," ▓████£££ "," █████£££ "," ░█████£££ "," ▒█████£££ "," ▓█████£££ "," ██████£££ "," ██████£££ "]},"fish":{"interval":80,"frames":["~~~~~~~~~~~~~~~~~~~~","> ~~~~~~~~~~~~~~~~~~","º> ~~~~~~~~~~~~~~~~~","(º> ~~~~~~~~~~~~~~~~","((º> ~~~~~~~~~~~~~~~","<((º> ~~~~~~~~~~~~~~","><((º> ~~~~~~~~~~~~~"," ><((º> ~~~~~~~~~~~~","~ ><((º> ~~~~~~~~~~~","~~ <>((º> ~~~~~~~~~~","~~~ ><((º> ~~~~~~~~~","~~~~ <>((º> ~~~~~~~~","~~~~~ ><((º> ~~~~~~~","~~~~~~ <>((º> ~~~~~~","~~~~~~~ ><((º> ~~~~~","~~~~~~~~ <>((º> ~~~~","~~~~~~~~~ ><((º> ~~~","~~~~~~~~~~ <>((º> ~~","~~~~~~~~~~~ ><((º> ~","~~~~~~~~~~~~ <>((º> ","~~~~~~~~~~~~~ ><((º>","~~~~~~~~~~~~~~ <>((º","~~~~~~~~~~~~~~~ ><((","~~~~~~~~~~~~~~~~ <>(","~~~~~~~~~~~~~~~~~ ><","~~~~~~~~~~~~~~~~~~ <","~~~~~~~~~~~~~~~~~~~~"]}}');
|
|
901
|
+
const cli_spinners = spinners_namespaceObject;
|
|
902
|
+
Object.keys(spinners_namespaceObject);
|
|
903
|
+
function useSpinner({ type = 'dots' }) {
|
|
904
|
+
const [frame, setFrame] = external_react_useState(0);
|
|
905
|
+
const spinner = cli_spinners[type];
|
|
906
|
+
external_react_useEffect(()=>{
|
|
907
|
+
const timer = setInterval(()=>{
|
|
908
|
+
setFrame((previousFrame)=>{
|
|
909
|
+
const isLastFrame = previousFrame === spinner.frames.length - 1;
|
|
910
|
+
return isLastFrame ? 0 : previousFrame + 1;
|
|
911
|
+
});
|
|
912
|
+
}, spinner.interval);
|
|
913
|
+
return ()=>{
|
|
914
|
+
clearInterval(timer);
|
|
915
|
+
};
|
|
916
|
+
}, [
|
|
917
|
+
spinner
|
|
918
|
+
]);
|
|
919
|
+
return {
|
|
920
|
+
frame: spinner.frames[frame] ?? ''
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
function Spinner({ label, type }) {
|
|
924
|
+
const { frame } = useSpinner({
|
|
925
|
+
type
|
|
926
|
+
});
|
|
927
|
+
const { styles } = theme_useComponentTheme('Spinner');
|
|
928
|
+
return react.createElement(external_ink_Box, {
|
|
929
|
+
...styles.container()
|
|
930
|
+
}, react.createElement(external_ink_Text, {
|
|
931
|
+
...styles.frame()
|
|
932
|
+
}, frame), label && react.createElement(external_ink_Text, {
|
|
933
|
+
...styles.label()
|
|
934
|
+
}, label));
|
|
935
|
+
}
|
|
936
|
+
const use_text_input_state_reducer = (state, action)=>{
|
|
937
|
+
switch(action.type){
|
|
938
|
+
case 'move-cursor-left':
|
|
939
|
+
return {
|
|
940
|
+
...state,
|
|
941
|
+
cursorOffset: Math.max(0, state.cursorOffset - 1)
|
|
942
|
+
};
|
|
943
|
+
case 'move-cursor-right':
|
|
944
|
+
return {
|
|
945
|
+
...state,
|
|
946
|
+
cursorOffset: Math.min(state.value.length, state.cursorOffset + 1)
|
|
947
|
+
};
|
|
948
|
+
case 'insert':
|
|
949
|
+
return {
|
|
950
|
+
...state,
|
|
951
|
+
previousValue: state.value,
|
|
952
|
+
value: state.value.slice(0, state.cursorOffset) + action.text + state.value.slice(state.cursorOffset),
|
|
953
|
+
cursorOffset: state.cursorOffset + action.text.length
|
|
954
|
+
};
|
|
955
|
+
case 'delete':
|
|
956
|
+
{
|
|
957
|
+
const newCursorOffset = Math.max(0, state.cursorOffset - 1);
|
|
958
|
+
return {
|
|
959
|
+
...state,
|
|
960
|
+
previousValue: state.value,
|
|
961
|
+
value: state.value.slice(0, newCursorOffset) + state.value.slice(newCursorOffset + 1),
|
|
962
|
+
cursorOffset: newCursorOffset
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
const useTextInputState = ({ defaultValue = '', suggestions, onChange, onSubmit })=>{
|
|
968
|
+
const [state, dispatch] = external_react_useReducer(use_text_input_state_reducer, {
|
|
969
|
+
previousValue: defaultValue,
|
|
970
|
+
value: defaultValue,
|
|
971
|
+
cursorOffset: defaultValue.length
|
|
972
|
+
});
|
|
973
|
+
const suggestion = external_react_useMemo(()=>{
|
|
974
|
+
if (0 === state.value.length) return;
|
|
975
|
+
return suggestions?.find((suggestion)=>suggestion.startsWith(state.value))?.replace(state.value, '');
|
|
976
|
+
}, [
|
|
977
|
+
state.value,
|
|
978
|
+
suggestions
|
|
979
|
+
]);
|
|
980
|
+
const moveCursorLeft = external_react_useCallback(()=>{
|
|
981
|
+
dispatch({
|
|
982
|
+
type: 'move-cursor-left'
|
|
983
|
+
});
|
|
984
|
+
}, []);
|
|
985
|
+
const moveCursorRight = external_react_useCallback(()=>{
|
|
986
|
+
dispatch({
|
|
987
|
+
type: 'move-cursor-right'
|
|
988
|
+
});
|
|
989
|
+
}, []);
|
|
990
|
+
const insert = external_react_useCallback((text)=>{
|
|
991
|
+
dispatch({
|
|
992
|
+
type: 'insert',
|
|
993
|
+
text
|
|
994
|
+
});
|
|
995
|
+
}, []);
|
|
996
|
+
const deleteCharacter = external_react_useCallback(()=>{
|
|
997
|
+
dispatch({
|
|
998
|
+
type: 'delete'
|
|
999
|
+
});
|
|
1000
|
+
}, []);
|
|
1001
|
+
const submit = external_react_useCallback(()=>{
|
|
1002
|
+
if (suggestion) {
|
|
1003
|
+
insert(suggestion);
|
|
1004
|
+
onSubmit?.(state.value + suggestion);
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
onSubmit?.(state.value);
|
|
1008
|
+
}, [
|
|
1009
|
+
state.value,
|
|
1010
|
+
suggestion,
|
|
1011
|
+
insert,
|
|
1012
|
+
onSubmit
|
|
1013
|
+
]);
|
|
1014
|
+
external_react_useEffect(()=>{
|
|
1015
|
+
if (state.value !== state.previousValue) onChange?.(state.value);
|
|
1016
|
+
}, [
|
|
1017
|
+
state.previousValue,
|
|
1018
|
+
state.value,
|
|
1019
|
+
onChange
|
|
1020
|
+
]);
|
|
1021
|
+
return {
|
|
1022
|
+
...state,
|
|
1023
|
+
suggestion,
|
|
1024
|
+
moveCursorLeft,
|
|
1025
|
+
moveCursorRight,
|
|
1026
|
+
insert,
|
|
1027
|
+
delete: deleteCharacter,
|
|
1028
|
+
submit
|
|
1029
|
+
};
|
|
1030
|
+
};
|
|
1031
|
+
const cursor = chalk_0.inverse(' ');
|
|
1032
|
+
const useTextInput = ({ isDisabled = false, state, placeholder = '' })=>{
|
|
1033
|
+
const renderedPlaceholder = external_react_useMemo(()=>{
|
|
1034
|
+
if (isDisabled) return placeholder ? chalk_0.dim(placeholder) : '';
|
|
1035
|
+
return placeholder && placeholder.length > 0 ? chalk_0.inverse(placeholder[0]) + chalk_0.dim(placeholder.slice(1)) : cursor;
|
|
1036
|
+
}, [
|
|
1037
|
+
isDisabled,
|
|
1038
|
+
placeholder
|
|
1039
|
+
]);
|
|
1040
|
+
const renderedValue = external_react_useMemo(()=>{
|
|
1041
|
+
if (isDisabled) return state.value;
|
|
1042
|
+
let index = 0;
|
|
1043
|
+
let result = state.value.length > 0 ? '' : cursor;
|
|
1044
|
+
for (const char of state.value){
|
|
1045
|
+
result += index === state.cursorOffset ? chalk_0.inverse(char) : char;
|
|
1046
|
+
index++;
|
|
1047
|
+
}
|
|
1048
|
+
if (state.suggestion) {
|
|
1049
|
+
if (state.cursorOffset === state.value.length) result += chalk_0.inverse(state.suggestion[0]) + chalk_0.dim(state.suggestion.slice(1));
|
|
1050
|
+
else result += chalk_0.dim(state.suggestion);
|
|
1051
|
+
return result;
|
|
1052
|
+
}
|
|
1053
|
+
if (state.value.length > 0 && state.cursorOffset === state.value.length) result += cursor;
|
|
1054
|
+
return result;
|
|
1055
|
+
}, [
|
|
1056
|
+
isDisabled,
|
|
1057
|
+
state.value,
|
|
1058
|
+
state.cursorOffset,
|
|
1059
|
+
state.suggestion
|
|
1060
|
+
]);
|
|
1061
|
+
external_ink_useInput((input, key)=>{
|
|
1062
|
+
if (key.upArrow || key.downArrow || key.ctrl && 'c' === input || key.tab || key.shift && key.tab) return;
|
|
1063
|
+
if (key.return) return void state.submit();
|
|
1064
|
+
if (key.leftArrow) state.moveCursorLeft();
|
|
1065
|
+
else if (key.rightArrow) state.moveCursorRight();
|
|
1066
|
+
else if (key.backspace || key.delete) state.delete();
|
|
1067
|
+
else state.insert(input);
|
|
1068
|
+
}, {
|
|
1069
|
+
isActive: !isDisabled
|
|
1070
|
+
});
|
|
1071
|
+
return {
|
|
1072
|
+
inputValue: state.value.length > 0 ? renderedValue : renderedPlaceholder
|
|
1073
|
+
};
|
|
1074
|
+
};
|
|
1075
|
+
function TextInput({ isDisabled = false, defaultValue, placeholder = '', suggestions, onChange, onSubmit }) {
|
|
1076
|
+
const state = useTextInputState({
|
|
1077
|
+
defaultValue,
|
|
1078
|
+
suggestions,
|
|
1079
|
+
onChange,
|
|
1080
|
+
onSubmit
|
|
1081
|
+
});
|
|
1082
|
+
const { inputValue } = useTextInput({
|
|
1083
|
+
isDisabled,
|
|
1084
|
+
placeholder,
|
|
1085
|
+
state
|
|
1086
|
+
});
|
|
1087
|
+
const { styles } = theme_useComponentTheme('TextInput');
|
|
1088
|
+
return react.createElement(external_ink_Text, {
|
|
1089
|
+
...styles.value()
|
|
1090
|
+
}, inputValue);
|
|
1091
|
+
}
|
|
1092
|
+
const OrderedListItemContext = createContext({
|
|
1093
|
+
marker: node_modules_figures.line
|
|
1094
|
+
});
|
|
1095
|
+
function OrderedListItem({ children }) {
|
|
1096
|
+
const { marker } = useContext(OrderedListItemContext);
|
|
1097
|
+
const { styles } = theme_useComponentTheme('OrderedList');
|
|
1098
|
+
return react.createElement(external_ink_Box, {
|
|
1099
|
+
...styles.listItem()
|
|
1100
|
+
}, react.createElement(external_ink_Text, {
|
|
1101
|
+
...styles.marker()
|
|
1102
|
+
}, marker), react.createElement(external_ink_Box, {
|
|
1103
|
+
...styles.content()
|
|
1104
|
+
}, children));
|
|
1105
|
+
}
|
|
1106
|
+
const OrderedListContext = createContext({
|
|
1107
|
+
marker: ''
|
|
1108
|
+
});
|
|
1109
|
+
function OrderedList({ children }) {
|
|
1110
|
+
const { marker: parentMarker } = useContext(OrderedListContext);
|
|
1111
|
+
const { styles } = theme_useComponentTheme('OrderedList');
|
|
1112
|
+
let numberOfItems = 0;
|
|
1113
|
+
for (const child of react.Children.toArray(children))if (isValidElement(child) && child.type === OrderedListItem) numberOfItems++;
|
|
1114
|
+
const maxMarkerWidth = String(numberOfItems).length;
|
|
1115
|
+
return react.createElement(external_ink_Box, {
|
|
1116
|
+
...styles.list()
|
|
1117
|
+
}, react.Children.map(children, (child, index)=>{
|
|
1118
|
+
if (!isValidElement(child) || child.type !== OrderedListItem) return child;
|
|
1119
|
+
const paddedMarker = `${String(index + 1).padStart(maxMarkerWidth)}.`;
|
|
1120
|
+
const marker = `${parentMarker}${paddedMarker}`;
|
|
1121
|
+
return react.createElement(OrderedListContext.Provider, {
|
|
1122
|
+
value: {
|
|
1123
|
+
marker
|
|
1124
|
+
}
|
|
1125
|
+
}, react.createElement(OrderedListItemContext.Provider, {
|
|
1126
|
+
value: {
|
|
1127
|
+
marker
|
|
1128
|
+
}
|
|
1129
|
+
}, child));
|
|
1130
|
+
}));
|
|
1131
|
+
}
|
|
1132
|
+
OrderedList.Item = OrderedListItem;
|
|
1133
|
+
chalk_0.inverse(' ');
|
|
1134
|
+
chalk_0.inverse(' ');
|
|
1135
|
+
function createAppUI(options) {
|
|
1136
|
+
let services = [];
|
|
1137
|
+
let lines = [];
|
|
1138
|
+
let app;
|
|
1139
|
+
const append = (line)=>{
|
|
1140
|
+
lines = [
|
|
1141
|
+
...lines,
|
|
1142
|
+
line
|
|
1143
|
+
];
|
|
1144
|
+
app?.rerender(view());
|
|
1145
|
+
};
|
|
1146
|
+
const command = (input)=>{
|
|
1147
|
+
const name = input.trim();
|
|
1148
|
+
if (!name) return;
|
|
1149
|
+
if ('status' === name) return void append({
|
|
1150
|
+
title: '调试状态',
|
|
1151
|
+
message: services.map((service)=>[
|
|
1152
|
+
`${service.title} ${statusDot(service.status)} ${service.message}`,
|
|
1153
|
+
...void 0 === service.progress ? [] : [
|
|
1154
|
+
` 进度 ${service.progress}%`
|
|
1155
|
+
],
|
|
1156
|
+
...Object.entries(service.details ?? {}).map(([key, value])=>` ${key} ${value}`),
|
|
1157
|
+
...Object.entries(service.links ?? {}).map(([key, value])=>` ${key} ${value}`)
|
|
1158
|
+
].join('\n')).join('\n\n')
|
|
1159
|
+
});
|
|
1160
|
+
const action = services.flatMap((service)=>Object.entries(service.actions ?? {})).find(([key])=>key === name)?.[1];
|
|
1161
|
+
if (!action) return void append({
|
|
1162
|
+
message: '未知命令,请输入下方列出的命令。'
|
|
1163
|
+
});
|
|
1164
|
+
Promise.resolve().then(()=>action.run()).catch((error)=>append({
|
|
1165
|
+
title: '操作失败',
|
|
1166
|
+
message: error instanceof Error ? error.message : String(error),
|
|
1167
|
+
status: 'error'
|
|
1168
|
+
}));
|
|
1169
|
+
};
|
|
1170
|
+
const view = ()=>/*#__PURE__*/ __rspack_external_react.createElement(DevPanel, {
|
|
1171
|
+
...options,
|
|
1172
|
+
services: services,
|
|
1173
|
+
lines: lines,
|
|
1174
|
+
onCommand: command
|
|
1175
|
+
});
|
|
1176
|
+
app = render(view(), {
|
|
1177
|
+
exitOnCtrlC: false,
|
|
1178
|
+
maxFps: 15
|
|
1179
|
+
});
|
|
1180
|
+
return {
|
|
1181
|
+
log: {
|
|
1182
|
+
info: (message)=>append({
|
|
1183
|
+
message
|
|
1184
|
+
}),
|
|
1185
|
+
success: (message)=>append({
|
|
1186
|
+
message,
|
|
1187
|
+
status: 'success'
|
|
1188
|
+
}),
|
|
1189
|
+
warn: (message)=>append({
|
|
1190
|
+
message,
|
|
1191
|
+
status: 'pending'
|
|
1192
|
+
}),
|
|
1193
|
+
error: (message)=>append({
|
|
1194
|
+
message,
|
|
1195
|
+
status: 'error'
|
|
1196
|
+
})
|
|
1197
|
+
},
|
|
1198
|
+
update: (value)=>{
|
|
1199
|
+
services = value;
|
|
1200
|
+
app?.rerender(view());
|
|
1201
|
+
},
|
|
1202
|
+
close: async ()=>{
|
|
1203
|
+
app?.rerender(/*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1204
|
+
width: Math.min(process.stdout.columns ?? 88, 88),
|
|
1205
|
+
flexDirection: "column"
|
|
1206
|
+
}, lines.map((line, index)=>/*#__PURE__*/ __rspack_external_react.createElement(DevMessage, {
|
|
1207
|
+
key: index,
|
|
1208
|
+
line: line
|
|
1209
|
+
}))));
|
|
1210
|
+
await app?.waitUntilRenderFlush();
|
|
1211
|
+
app?.unmount();
|
|
1212
|
+
app = void 0;
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1216
|
+
function statusDot(status) {
|
|
1217
|
+
return chalk_0[DEV_STATUS_COLORS[status]]('●');
|
|
1218
|
+
}
|
|
1219
|
+
function DevPanel({ name, version, metadata, services, lines, onCommand, onExit }) {
|
|
1220
|
+
const { columns } = useWindowSize();
|
|
1221
|
+
const labelWidth = Math.min(26, Math.max(8, Math.floor(columns / 2) - 2));
|
|
1222
|
+
const [revision, setRevision] = __rspack_external_react.useState(0);
|
|
1223
|
+
const command = __rspack_external_react.useRef('');
|
|
1224
|
+
const actions = services.flatMap((service)=>Object.entries(service.actions ?? {}));
|
|
1225
|
+
const panel = services.find((service)=>service.panel)?.panel;
|
|
1226
|
+
const width = Math.min(columns, Math.max(88, (panel?.qr?.split('\n')[0]?.length ?? 0) + 6));
|
|
1227
|
+
const preparing = !services.length || services.some((service)=>service.busy);
|
|
1228
|
+
const commands = [
|
|
1229
|
+
...actions.filter(([name])=>'back' !== name).map(([name, action])=>[
|
|
1230
|
+
name,
|
|
1231
|
+
action.label
|
|
1232
|
+
]),
|
|
1233
|
+
...panel ? [] : [
|
|
1234
|
+
[
|
|
1235
|
+
'status',
|
|
1236
|
+
'查看调试详情'
|
|
1237
|
+
]
|
|
1238
|
+
],
|
|
1239
|
+
...actions.filter(([name])=>'back' === name).map(([name, action])=>[
|
|
1240
|
+
name,
|
|
1241
|
+
action.label
|
|
1242
|
+
])
|
|
1243
|
+
];
|
|
1244
|
+
external_ink_useInput((input, key)=>{
|
|
1245
|
+
if (key.ctrl && 'c' === input) onExit(true);
|
|
1246
|
+
if (key.escape && panel && !preparing) {
|
|
1247
|
+
command.current = '';
|
|
1248
|
+
setRevision((revision)=>revision + 1);
|
|
1249
|
+
onCommand('back');
|
|
1250
|
+
}
|
|
1251
|
+
if (key.tab && !key.shift && !preparing && !panel?.select && command.current) {
|
|
1252
|
+
const match = commands.find(([name])=>name.startsWith(command.current));
|
|
1253
|
+
if (match && match[0] !== command.current) {
|
|
1254
|
+
command.current = match[0];
|
|
1255
|
+
setRevision((revision)=>revision + 1);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1259
|
+
return /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1260
|
+
width: width,
|
|
1261
|
+
flexDirection: "column"
|
|
1262
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1263
|
+
borderStyle: "single",
|
|
1264
|
+
borderColor: "gray",
|
|
1265
|
+
paddingX: 1,
|
|
1266
|
+
flexDirection: "column"
|
|
1267
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1268
|
+
bold: true
|
|
1269
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1270
|
+
color: "blue"
|
|
1271
|
+
}, "› "), "Doubao Dev CLI", /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1272
|
+
dimColor: true
|
|
1273
|
+
}, ` (v${version})`)), Object.entries({
|
|
1274
|
+
项目: name,
|
|
1275
|
+
...metadata
|
|
1276
|
+
}).map(([label, value])=>/*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1277
|
+
key: label
|
|
1278
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1279
|
+
width: labelWidth,
|
|
1280
|
+
flexShrink: 0,
|
|
1281
|
+
paddingRight: 2
|
|
1282
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1283
|
+
dimColor: true,
|
|
1284
|
+
wrap: "truncate-end"
|
|
1285
|
+
}, label)), /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1286
|
+
flexGrow: 1,
|
|
1287
|
+
flexBasis: 0
|
|
1288
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, null, value)))), /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1289
|
+
marginTop: 1,
|
|
1290
|
+
flexDirection: "column"
|
|
1291
|
+
}, services.map((service)=>/*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1292
|
+
key: service.name
|
|
1293
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1294
|
+
width: labelWidth,
|
|
1295
|
+
flexShrink: 0,
|
|
1296
|
+
paddingRight: 2
|
|
1297
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1298
|
+
dimColor: true,
|
|
1299
|
+
wrap: "truncate-end"
|
|
1300
|
+
}, service.title)), /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1301
|
+
flexGrow: 1,
|
|
1302
|
+
flexBasis: 0
|
|
1303
|
+
}, 'pending' === service.status ? /*#__PURE__*/ __rspack_external_react.createElement(Spinner, {
|
|
1304
|
+
label: service.message
|
|
1305
|
+
}) : /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, null, statusDot(service.status), " ", service.message)))))), lines.map((line, index)=>/*#__PURE__*/ __rspack_external_react.createElement(DevMessage, {
|
|
1306
|
+
key: index,
|
|
1307
|
+
line: line
|
|
1308
|
+
})), panel && /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1309
|
+
marginTop: 1,
|
|
1310
|
+
borderStyle: "single",
|
|
1311
|
+
borderColor: "gray",
|
|
1312
|
+
paddingX: 1,
|
|
1313
|
+
flexDirection: "column"
|
|
1314
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1315
|
+
bold: true,
|
|
1316
|
+
color: "blue"
|
|
1317
|
+
}, panel.title), /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1318
|
+
marginTop: 1
|
|
1319
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, null, statusDot(panel.status), " ", panel.message)), panel.qr && /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1320
|
+
marginTop: 1
|
|
1321
|
+
}, panel.qr.split('\n').some((row)=>row.length > width - 6) ? /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, null, "窗口过窄,请拉宽终端查看二维码。") : /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1322
|
+
color: "black",
|
|
1323
|
+
backgroundColor: "white"
|
|
1324
|
+
}, panel.qr))), panel?.select ? /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1325
|
+
marginTop: 1,
|
|
1326
|
+
flexDirection: "column"
|
|
1327
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(Select, {
|
|
1328
|
+
options: actions.map(([value, action])=>({
|
|
1329
|
+
value,
|
|
1330
|
+
label: action.label
|
|
1331
|
+
})),
|
|
1332
|
+
visibleOptionCount: 6,
|
|
1333
|
+
onChange: onCommand
|
|
1334
|
+
})) : /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external_react.Fragment, null, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1335
|
+
marginTop: 1,
|
|
1336
|
+
flexDirection: "column"
|
|
1337
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1338
|
+
bold: true,
|
|
1339
|
+
color: "blue"
|
|
1340
|
+
}, "可用命令"), commands.map(([name, label])=>/*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1341
|
+
key: name,
|
|
1342
|
+
paddingLeft: 2
|
|
1343
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1344
|
+
width: 18
|
|
1345
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1346
|
+
color: "blue"
|
|
1347
|
+
}, name)), /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, null, label)))), /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1348
|
+
marginTop: 1
|
|
1349
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1350
|
+
bold: true,
|
|
1351
|
+
color: "blue"
|
|
1352
|
+
}, panel ? '真机 › ' : '› '), /*#__PURE__*/ __rspack_external_react.createElement(TextInput, {
|
|
1353
|
+
key: revision,
|
|
1354
|
+
defaultValue: command.current,
|
|
1355
|
+
onChange: (value)=>{
|
|
1356
|
+
command.current = value;
|
|
1357
|
+
},
|
|
1358
|
+
isDisabled: preparing,
|
|
1359
|
+
placeholder: preparing ? '正在准备开发环境,Ctrl+C 取消' : panel ? 'back / Esc 返回,Ctrl+C 退出' : '输入命令,Ctrl+C 退出',
|
|
1360
|
+
onSubmit: (value)=>{
|
|
1361
|
+
command.current = '';
|
|
1362
|
+
setRevision((revision)=>revision + 1);
|
|
1363
|
+
onCommand(value);
|
|
1364
|
+
}
|
|
1365
|
+
}))));
|
|
1366
|
+
}
|
|
1367
|
+
function DevMessage({ line }) {
|
|
1368
|
+
return /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1369
|
+
marginTop: 1,
|
|
1370
|
+
flexDirection: "column"
|
|
1371
|
+
}, line.title && /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, {
|
|
1372
|
+
bold: true,
|
|
1373
|
+
color: 'error' === line.status ? 'red' : 'blue'
|
|
1374
|
+
}, line.status && `${statusDot(line.status)} `, line.title), /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Box, {
|
|
1375
|
+
marginTop: line.title ? 1 : 0
|
|
1376
|
+
}, /*#__PURE__*/ __rspack_external_react.createElement(external_ink_Text, null, !line.title && line.status && `${statusDot(line.status)} `, line.message.replace(/;\s+(?=\[)/g, ';\n\n'))));
|
|
1377
|
+
}
|
|
1378
|
+
export { createAppUI };
|