keycloakify 10.1.0-rc.0 → 10.1.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.
- package/PUBLIC_URL.js +2 -2
- package/PUBLIC_URL.js.map +1 -1
- package/account/KcContext/kcContextMocks.js +3 -3
- package/account/KcContext/kcContextMocks.js.map +1 -1
- package/bin/193.index.js +198 -62
- package/bin/{365.index.js → 20.index.js} +302 -263
- package/bin/31.index.js +15 -23
- package/bin/{430.index.js → 33.index.js} +579 -4
- package/bin/{678.index.js → 36.index.js} +2 -577
- package/bin/{440.index.js → 499.index.js} +259 -181
- package/bin/526.index.js +3 -784
- package/bin/599.index.js +4 -1
- package/bin/780.index.js +1 -1
- package/bin/{525.index.js → 903.index.js} +4840 -97
- package/bin/932.index.js +115 -886
- package/bin/main.js +4 -4
- package/bin/shared/buildContext.d.ts +0 -2
- package/bin/shared/buildContext.js.map +1 -1
- package/bin/shared/constants.d.ts +5 -6
- package/bin/shared/constants.js +5 -6
- package/bin/shared/constants.js.map +1 -1
- package/bin/shared/copyKeycloakResourcesToPublic.d.ts +2 -4
- package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -1
- package/login/KcContext/KcContext.d.ts +9 -18
- package/login/KcContext/KcContext.js.map +1 -1
- package/login/KcContext/kcContextMocks.js +6 -10
- package/login/KcContext/kcContextMocks.js.map +1 -1
- package/login/Template.js +4 -59
- package/login/Template.js.map +1 -1
- package/login/Template.useStylesAndScripts.d.ts +17 -0
- package/login/Template.useStylesAndScripts.js +69 -0
- package/login/Template.useStylesAndScripts.js.map +1 -0
- package/login/pages/Login.js +1 -1
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginIdpLinkConfirmOverride.js +0 -1
- package/login/pages/LoginIdpLinkConfirmOverride.js.map +1 -1
- package/login/pages/LoginPasskeysConditionalAuthenticate.js +6 -49
- package/login/pages/LoginPasskeysConditionalAuthenticate.js.map +1 -1
- package/login/pages/LoginPasskeysConditionalAuthenticate.useScript.d.ts +20 -0
- package/login/pages/LoginPasskeysConditionalAuthenticate.useScript.js +49 -0
- package/login/pages/LoginPasskeysConditionalAuthenticate.useScript.js.map +1 -0
- package/login/pages/LoginRecoveryAuthnCodeConfig.js +4 -126
- package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeConfig.useScript.d.ts +9 -0
- package/login/pages/LoginRecoveryAuthnCodeConfig.useScript.js +133 -0
- package/login/pages/LoginRecoveryAuthnCodeConfig.useScript.js.map +1 -0
- package/login/pages/LoginUsername.js +1 -1
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/Register.js +6 -3
- package/login/pages/Register.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.js +13 -116
- package/login/pages/WebauthnAuthenticate.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.useScript.d.ts +21 -0
- package/login/pages/WebauthnAuthenticate.useScript.js +41 -0
- package/login/pages/WebauthnAuthenticate.useScript.js.map +1 -0
- package/login/pages/WebauthnRegister.js +8 -178
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/login/pages/WebauthnRegister.useScript.d.ts +27 -0
- package/login/pages/WebauthnRegister.useScript.js +49 -0
- package/login/pages/WebauthnRegister.useScript.js.map +1 -0
- package/package.json +125 -15
- package/res/account-v1/account.ftl +70 -0
- package/res/account-v1/applications.ftl +76 -0
- package/res/account-v1/federatedIdentity.ftl +42 -0
- package/res/account-v1/log.ftl +35 -0
- package/res/account-v1/messages/messages_ar.properties +406 -0
- package/res/account-v1/messages/messages_ca.properties +147 -0
- package/res/account-v1/messages/messages_cs.properties +171 -0
- package/res/account-v1/messages/messages_da.properties +339 -0
- package/res/account-v1/messages/messages_de.properties +353 -0
- package/res/account-v1/messages/messages_en.properties +404 -0
- package/res/account-v1/messages/messages_es.properties +147 -0
- package/res/account-v1/messages/messages_fi.properties +400 -0
- package/res/account-v1/messages/messages_fr.properties +180 -0
- package/res/account-v1/messages/messages_hu.properties +334 -0
- package/res/account-v1/messages/messages_it.properties +336 -0
- package/res/account-v1/messages/messages_ja.properties +335 -0
- package/res/account-v1/messages/messages_lt.properties +154 -0
- package/res/account-v1/messages/messages_lv.properties +197 -0
- package/res/account-v1/messages/messages_nl.properties +371 -0
- package/res/account-v1/messages/messages_no.properties +152 -0
- package/res/account-v1/messages/messages_pl.properties +248 -0
- package/res/account-v1/messages/messages_pt_BR.properties +349 -0
- package/res/account-v1/messages/messages_ru.properties +235 -0
- package/res/account-v1/messages/messages_sk.properties +196 -0
- package/res/account-v1/messages/messages_sv.properties +150 -0
- package/res/account-v1/messages/messages_tr.properties +315 -0
- package/res/account-v1/messages/messages_zh_CN.properties +153 -0
- package/res/account-v1/password.ftl +59 -0
- package/res/account-v1/resource-detail.ftl +277 -0
- package/res/account-v1/resources/css/account.css +277 -0
- package/res/account-v1/resources/img/icon-sidebar-active.png +0 -0
- package/res/account-v1/resources/img/keycloak-logo.png +0 -0
- package/res/account-v1/resources/img/logo.png +0 -0
- package/res/account-v1/resources/resources-common/img/favicon.ico +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/css/patternfly-additions.min.css +5 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/css/patternfly.min.css +8 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff2 +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Light-webfont.woff2 +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Regular-webfont.woff2 +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Semibold-webfont.woff2 +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.ttf +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.woff +0 -0
- package/res/account-v1/resources.ftl +403 -0
- package/res/account-v1/sessions.ftl +44 -0
- package/res/account-v1/template.ftl +88 -0
- package/res/account-v1/theme.properties +14 -0
- package/res/account-v1/totp.ftl +141 -0
- package/res/public/.keycloakify/account/css/account.css +277 -0
- package/res/public/.keycloakify/account/img/icon-sidebar-active.png +0 -0
- package/res/public/.keycloakify/account/img/keycloak-logo.png +0 -0
- package/res/public/.keycloakify/account/img/logo.png +0 -0
- package/res/public/.keycloakify/account/resources-common/img/favicon.ico +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/css/patternfly-additions.min.css +5 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/css/patternfly.min.css +8 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff2 +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Light-webfont.woff2 +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Regular-webfont.woff2 +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Semibold-webfont.woff2 +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.ttf +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.woff +0 -0
- package/res/public/.keycloakify/login/css/login.css +629 -0
- package/res/public/.keycloakify/login/img/feedback-error-arrow-down.png +0 -0
- package/res/public/.keycloakify/login/img/feedback-error-sign.png +0 -0
- package/res/public/.keycloakify/login/img/feedback-success-arrow-down.png +0 -0
- package/res/public/.keycloakify/login/img/feedback-success-sign.png +0 -0
- package/res/public/.keycloakify/login/img/feedback-warning-arrow-down.png +0 -0
- package/res/public/.keycloakify/login/img/feedback-warning-sign.png +0 -0
- package/res/public/.keycloakify/login/img/keycloak-bg.png +0 -0
- package/res/public/.keycloakify/login/img/keycloak-logo-text.png +0 -0
- package/res/public/.keycloakify/login/img/keycloak-logo.png +0 -0
- package/res/public/.keycloakify/login/js/authChecker.js +49 -0
- package/res/public/.keycloakify/login/js/common.js +48 -0
- package/res/public/.keycloakify/login/js/kcMultivalued.js +106 -0
- package/res/public/.keycloakify/login/js/kcNumberFormat.js +21 -0
- package/res/public/.keycloakify/login/js/kcNumberUnFormat.js +19 -0
- package/res/public/.keycloakify/login/js/menu-button-links.js +315 -0
- package/{src/bin/shared/downloadKeycloakDefaultTheme/extra-assets → res/public/.keycloakify/login/js}/passkeysConditionalAuth.js +1 -1
- package/res/public/.keycloakify/login/js/passwordVisibility.js +15 -0
- package/res/public/.keycloakify/login/js/userProfile.js +71 -0
- package/res/public/.keycloakify/login/js/webauthnRegister.js +140 -0
- package/res/public/.keycloakify/login/resources-common/img/favicon.ico +0 -0
- package/res/public/.keycloakify/login/resources-common/lib/pficon/pficon.css +22 -0
- package/res/public/.keycloakify/login/resources-common/lib/pficon/pficon.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/@patternfly/patternfly/patternfly.min.css +2 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/jquery/dist/jquery.min.js +2 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/css/patternfly-additions.min.css +5 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/css/patternfly.min.css +8 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.ttf +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Light-webfont.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Regular-webfont.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Semibold-webfont.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.ttf +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.woff +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/fontawesome-webfont.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/img/bg-login.jpg +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/rfc4648/lib/rfc4648.js +178 -0
- package/src/PUBLIC_URL.ts +5 -3
- package/src/account/KcContext/kcContextMocks.ts +3 -3
- package/src/bin/copy-keycloak-resources-to-public.ts +1 -1
- package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +4 -1
- package/src/bin/initialize-email-theme.ts +28 -8
- package/src/bin/keycloakify/buildJars/buildJar.ts +3 -7
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +3 -7
- package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +65 -90
- package/src/bin/keycloakify/keycloakify.ts +38 -21
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +2 -2
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +3 -3
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +3 -3
- package/src/bin/shared/buildContext.ts +1 -8
- package/src/bin/shared/constants.ts +5 -7
- package/src/bin/shared/copyKeycloakResourcesToPublic.ts +30 -40
- package/src/bin/start-keycloak/start-keycloak.ts +3 -7
- package/src/login/KcContext/KcContext.ts +9 -18
- package/src/login/KcContext/kcContextMocks.ts +5 -13
- package/src/login/Template.tsx +4 -67
- package/src/login/Template.useStylesAndScripts.ts +94 -0
- package/src/login/pages/Login.tsx +1 -1
- package/src/login/pages/LoginIdpLinkConfirmOverride.tsx +0 -1
- package/src/login/pages/LoginPasskeysConditionalAuthenticate.tsx +6 -81
- package/src/login/pages/LoginPasskeysConditionalAuthenticate.useScript.tsx +72 -0
- package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +4 -126
- package/src/login/pages/LoginRecoveryAuthnCodeConfig.useScript.tsx +142 -0
- package/src/login/pages/LoginUsername.tsx +1 -1
- package/src/login/pages/Register.tsx +35 -13
- package/src/login/pages/WebauthnAuthenticate.tsx +20 -133
- package/src/login/pages/WebauthnAuthenticate.useScript.tsx +64 -0
- package/src/login/pages/WebauthnRegister.tsx +8 -195
- package/src/login/pages/WebauthnRegister.useScript.tsx +93 -0
- package/src/tools/useInsertScriptTags.ts +14 -4
- package/src/vite-plugin/vite-plugin.ts +11 -15
- package/tools/useInsertScriptTags.d.ts +2 -2
- package/tools/useInsertScriptTags.js +8 -2
- package/tools/useInsertScriptTags.js.map +1 -1
- package/vite-plugin/index.js +3357 -47132
- package/bin/697.index.js +0 -4749
- package/bin/shared/downloadKeycloakStaticResources.d.ts +0 -9
- package/bin/shared/downloadKeycloakStaticResources.js.map +0 -1
- package/src/bin/keycloakify/generateResources/bringInAccountV1.ts +0 -89
- package/src/bin/shared/downloadKeycloakDefaultTheme/downloadKeycloakDefaultTheme.ts +0 -337
- package/src/bin/shared/downloadKeycloakDefaultTheme/index.ts +0 -1
- package/src/bin/shared/downloadKeycloakStaticResources.ts +0 -53
- /package/{src/bin/shared/downloadKeycloakDefaultTheme/extra-assets → res/public/.keycloakify/login/js}/webauthnAuthenticate.js +0 -0
@@ -1,8 +1,147 @@
|
|
1
|
-
exports.id =
|
2
|
-
exports.ids = [
|
1
|
+
exports.id = 33;
|
2
|
+
exports.ids = [33];
|
3
3
|
exports.modules = {
|
4
4
|
|
5
|
-
/***/
|
5
|
+
/***/ 18512:
|
6
|
+
/***/ ((module) => {
|
7
|
+
|
8
|
+
"use strict";
|
9
|
+
|
10
|
+
const x = module.exports;
|
11
|
+
const ESC = '\u001B[';
|
12
|
+
const OSC = '\u001B]';
|
13
|
+
const BEL = '\u0007';
|
14
|
+
const SEP = ';';
|
15
|
+
const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
|
16
|
+
|
17
|
+
x.cursorTo = (x, y) => {
|
18
|
+
if (typeof x !== 'number') {
|
19
|
+
throw new TypeError('The `x` argument is required');
|
20
|
+
}
|
21
|
+
|
22
|
+
if (typeof y !== 'number') {
|
23
|
+
return ESC + (x + 1) + 'G';
|
24
|
+
}
|
25
|
+
|
26
|
+
return ESC + (y + 1) + ';' + (x + 1) + 'H';
|
27
|
+
};
|
28
|
+
|
29
|
+
x.cursorMove = (x, y) => {
|
30
|
+
if (typeof x !== 'number') {
|
31
|
+
throw new TypeError('The `x` argument is required');
|
32
|
+
}
|
33
|
+
|
34
|
+
let ret = '';
|
35
|
+
|
36
|
+
if (x < 0) {
|
37
|
+
ret += ESC + (-x) + 'D';
|
38
|
+
} else if (x > 0) {
|
39
|
+
ret += ESC + x + 'C';
|
40
|
+
}
|
41
|
+
|
42
|
+
if (y < 0) {
|
43
|
+
ret += ESC + (-y) + 'A';
|
44
|
+
} else if (y > 0) {
|
45
|
+
ret += ESC + y + 'B';
|
46
|
+
}
|
47
|
+
|
48
|
+
return ret;
|
49
|
+
};
|
50
|
+
|
51
|
+
x.cursorUp = count => ESC + (typeof count === 'number' ? count : 1) + 'A';
|
52
|
+
x.cursorDown = count => ESC + (typeof count === 'number' ? count : 1) + 'B';
|
53
|
+
x.cursorForward = count => ESC + (typeof count === 'number' ? count : 1) + 'C';
|
54
|
+
x.cursorBackward = count => ESC + (typeof count === 'number' ? count : 1) + 'D';
|
55
|
+
|
56
|
+
x.cursorLeft = ESC + 'G';
|
57
|
+
x.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's');
|
58
|
+
x.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u');
|
59
|
+
x.cursorGetPosition = ESC + '6n';
|
60
|
+
x.cursorNextLine = ESC + 'E';
|
61
|
+
x.cursorPrevLine = ESC + 'F';
|
62
|
+
x.cursorHide = ESC + '?25l';
|
63
|
+
x.cursorShow = ESC + '?25h';
|
64
|
+
|
65
|
+
x.eraseLines = count => {
|
66
|
+
let clear = '';
|
67
|
+
|
68
|
+
for (let i = 0; i < count; i++) {
|
69
|
+
clear += x.eraseLine + (i < count - 1 ? x.cursorUp() : '');
|
70
|
+
}
|
71
|
+
|
72
|
+
if (count) {
|
73
|
+
clear += x.cursorLeft;
|
74
|
+
}
|
75
|
+
|
76
|
+
return clear;
|
77
|
+
};
|
78
|
+
|
79
|
+
x.eraseEndLine = ESC + 'K';
|
80
|
+
x.eraseStartLine = ESC + '1K';
|
81
|
+
x.eraseLine = ESC + '2K';
|
82
|
+
x.eraseDown = ESC + 'J';
|
83
|
+
x.eraseUp = ESC + '1J';
|
84
|
+
x.eraseScreen = ESC + '2J';
|
85
|
+
x.scrollUp = ESC + 'S';
|
86
|
+
x.scrollDown = ESC + 'T';
|
87
|
+
|
88
|
+
x.clearScreen = '\u001Bc';
|
89
|
+
|
90
|
+
x.clearTerminal = process.platform === 'win32' ?
|
91
|
+
`${x.eraseScreen}${ESC}0f` :
|
92
|
+
// 1. Erases the screen (Only done in case `2` is not supported)
|
93
|
+
// 2. Erases the whole screen including scrollback buffer
|
94
|
+
// 3. Moves cursor to the top-left position
|
95
|
+
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
96
|
+
`${x.eraseScreen}${ESC}3J${ESC}H`;
|
97
|
+
|
98
|
+
x.beep = BEL;
|
99
|
+
|
100
|
+
x.link = (text, url) => {
|
101
|
+
return [
|
102
|
+
OSC,
|
103
|
+
'8',
|
104
|
+
SEP,
|
105
|
+
SEP,
|
106
|
+
url,
|
107
|
+
BEL,
|
108
|
+
text,
|
109
|
+
OSC,
|
110
|
+
'8',
|
111
|
+
SEP,
|
112
|
+
SEP,
|
113
|
+
BEL
|
114
|
+
].join('');
|
115
|
+
};
|
116
|
+
|
117
|
+
x.image = (buf, opts) => {
|
118
|
+
opts = opts || {};
|
119
|
+
|
120
|
+
let ret = OSC + '1337;File=inline=1';
|
121
|
+
|
122
|
+
if (opts.width) {
|
123
|
+
ret += `;width=${opts.width}`;
|
124
|
+
}
|
125
|
+
|
126
|
+
if (opts.height) {
|
127
|
+
ret += `;height=${opts.height}`;
|
128
|
+
}
|
129
|
+
|
130
|
+
if (opts.preserveAspectRatio === false) {
|
131
|
+
ret += ';preserveAspectRatio=0';
|
132
|
+
}
|
133
|
+
|
134
|
+
return ret + ':' + buf.toString('base64') + BEL;
|
135
|
+
};
|
136
|
+
|
137
|
+
x.iTerm = {};
|
138
|
+
|
139
|
+
x.iTerm.setCwd = cwd => OSC + '50;CurrentDir=' + (cwd || process.cwd()) + BEL;
|
140
|
+
|
141
|
+
|
142
|
+
/***/ }),
|
143
|
+
|
144
|
+
/***/ 34024:
|
6
145
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
7
146
|
|
8
147
|
var Buffer = (__webpack_require__(14300).Buffer);
|
@@ -118,6 +257,442 @@ crc32.unsigned = function () {
|
|
118
257
|
module.exports = crc32;
|
119
258
|
|
120
259
|
|
260
|
+
/***/ }),
|
261
|
+
|
262
|
+
/***/ 39340:
|
263
|
+
/***/ ((__unused_webpack_module, exports) => {
|
264
|
+
|
265
|
+
"use strict";
|
266
|
+
|
267
|
+
|
268
|
+
Object.defineProperty(exports, "__esModule", ({
|
269
|
+
value: true
|
270
|
+
}));
|
271
|
+
exports.withPromise = exports.withCallback = void 0;
|
272
|
+
|
273
|
+
/**
|
274
|
+
* Open the input with a normal callback function
|
275
|
+
*
|
276
|
+
* @param {Input} input - input object
|
277
|
+
* @param {function} valueMapper - function which maps the resulting id and value back to the expected format
|
278
|
+
* @param {function} callback - callback function
|
279
|
+
*/
|
280
|
+
const withCallback = (input, valueMapper, callback) => {
|
281
|
+
input.open();
|
282
|
+
input.onSelect((id, value) => callback(valueMapper(id, value)));
|
283
|
+
};
|
284
|
+
/**
|
285
|
+
* Open the input with a promise
|
286
|
+
*
|
287
|
+
* @param {Input} input - input object
|
288
|
+
* @param {function} valueMapper - function which maps the resulting id and value back to the expected format
|
289
|
+
*/
|
290
|
+
|
291
|
+
|
292
|
+
exports.withCallback = withCallback;
|
293
|
+
|
294
|
+
const withPromise = (input, valueMapper) => {
|
295
|
+
return new Promise((resolve, reject) => {
|
296
|
+
input.open();
|
297
|
+
input.onSelect((id, value) => {
|
298
|
+
if (id === null) {
|
299
|
+
reject();
|
300
|
+
} else {
|
301
|
+
resolve(valueMapper(id, value));
|
302
|
+
}
|
303
|
+
});
|
304
|
+
});
|
305
|
+
};
|
306
|
+
|
307
|
+
exports.withPromise = withPromise;
|
308
|
+
|
309
|
+
/***/ }),
|
310
|
+
|
311
|
+
/***/ 99398:
|
312
|
+
/***/ ((module, exports, __webpack_require__) => {
|
313
|
+
|
314
|
+
"use strict";
|
315
|
+
|
316
|
+
|
317
|
+
Object.defineProperty(exports, "__esModule", ({
|
318
|
+
value: true
|
319
|
+
}));
|
320
|
+
exports["default"] = void 0;
|
321
|
+
|
322
|
+
var _input = _interopRequireDefault(__webpack_require__(25730));
|
323
|
+
|
324
|
+
var _renderer = _interopRequireDefault(__webpack_require__(16059));
|
325
|
+
|
326
|
+
var _callbackMappers = __webpack_require__(39340);
|
327
|
+
|
328
|
+
var _valueMappers = __webpack_require__(26730);
|
329
|
+
|
330
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
331
|
+
|
332
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
333
|
+
|
334
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
335
|
+
|
336
|
+
/**
|
337
|
+
* Default options
|
338
|
+
*/
|
339
|
+
const defaultOptions = {
|
340
|
+
outputStream: process.stdout,
|
341
|
+
inputStream: process.stdin,
|
342
|
+
values: [],
|
343
|
+
defaultValue: 0,
|
344
|
+
selected: '(x)',
|
345
|
+
unselected: '( )',
|
346
|
+
indentation: 0,
|
347
|
+
cleanup: true,
|
348
|
+
valueRenderer: value => value
|
349
|
+
};
|
350
|
+
/**
|
351
|
+
* Create an instance of cli-select with the given options
|
352
|
+
*
|
353
|
+
* @param {object} options - options for cli-select
|
354
|
+
* @param {function} callback - if specified, a callback will be used, otherwise a promise gets returned (optional)
|
355
|
+
*/
|
356
|
+
|
357
|
+
const creator = (options, callback) => {
|
358
|
+
// merge options with default options
|
359
|
+
options = _objectSpread({}, defaultOptions, options); // create renderer and input instances
|
360
|
+
|
361
|
+
const renderer = new _renderer.default(options, options.outputStream);
|
362
|
+
const input = new _input.default(options.inputStream);
|
363
|
+
input.setDefaultValue(options.defaultValue);
|
364
|
+
input.attachRenderer(renderer); // handle array and object values
|
365
|
+
|
366
|
+
let valueMapper;
|
367
|
+
|
368
|
+
if (Array.isArray(options.values)) {
|
369
|
+
valueMapper = (0, _valueMappers.withArrayValues)(options);
|
370
|
+
} else {
|
371
|
+
valueMapper = (0, _valueMappers.withObjectValues)(options);
|
372
|
+
} // map values
|
373
|
+
|
374
|
+
|
375
|
+
options.values = valueMapper.input;
|
376
|
+
input.setValues(options.values); // handle different callback methods
|
377
|
+
|
378
|
+
if (typeof callback === 'function') {
|
379
|
+
return (0, _callbackMappers.withCallback)(input, valueMapper.output, callback);
|
380
|
+
} else {
|
381
|
+
return (0, _callbackMappers.withPromise)(input, valueMapper.output);
|
382
|
+
}
|
383
|
+
};
|
384
|
+
|
385
|
+
exports = module.exports = creator;
|
386
|
+
Object.defineProperty(exports, "__esModule", ({
|
387
|
+
value: true
|
388
|
+
}));
|
389
|
+
var _default = creator;
|
390
|
+
exports["default"] = _default;
|
391
|
+
|
392
|
+
/***/ }),
|
393
|
+
|
394
|
+
/***/ 25730:
|
395
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
396
|
+
|
397
|
+
"use strict";
|
398
|
+
|
399
|
+
|
400
|
+
Object.defineProperty(exports, "__esModule", ({
|
401
|
+
value: true
|
402
|
+
}));
|
403
|
+
exports["default"] = void 0;
|
404
|
+
|
405
|
+
var _readline = _interopRequireDefault(__webpack_require__(14521));
|
406
|
+
|
407
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
408
|
+
|
409
|
+
/**
|
410
|
+
* Handle cli input
|
411
|
+
*/
|
412
|
+
class Input {
|
413
|
+
/**
|
414
|
+
* Input constructor
|
415
|
+
*
|
416
|
+
* @param {any} stream - stream to catch (optional)
|
417
|
+
*/
|
418
|
+
constructor(stream = process.stdin) {
|
419
|
+
// set default values
|
420
|
+
this.stream = stream;
|
421
|
+
this.values = [];
|
422
|
+
this.selectedValue = 0;
|
423
|
+
|
424
|
+
this.onSelectListener = () => {};
|
425
|
+
|
426
|
+
this.onKeyPress = this.onKeyPress.bind(this);
|
427
|
+
}
|
428
|
+
/**
|
429
|
+
* Set the available values
|
430
|
+
*
|
431
|
+
* @param {array} values - all available values
|
432
|
+
*/
|
433
|
+
|
434
|
+
|
435
|
+
setValues(values) {
|
436
|
+
this.values = values;
|
437
|
+
|
438
|
+
if (this.renderer) {
|
439
|
+
this.renderer.setValues(values);
|
440
|
+
}
|
441
|
+
}
|
442
|
+
/**
|
443
|
+
* Set the default value
|
444
|
+
*
|
445
|
+
* @param {number} defaultValue - default value id
|
446
|
+
*/
|
447
|
+
|
448
|
+
|
449
|
+
setDefaultValue(defaultValue) {
|
450
|
+
this.selectedValue = defaultValue;
|
451
|
+
}
|
452
|
+
/**
|
453
|
+
* Attach a renderer to the input catcher
|
454
|
+
*
|
455
|
+
* @param {Renderer} renderer - renderer to use for rendering responses
|
456
|
+
*/
|
457
|
+
|
458
|
+
|
459
|
+
attachRenderer(renderer) {
|
460
|
+
this.renderer = renderer;
|
461
|
+
this.renderer.setValues(this.values);
|
462
|
+
}
|
463
|
+
/**
|
464
|
+
* Register an on select listener
|
465
|
+
*
|
466
|
+
* @param {function} listener - listener function which receives two parameters: valueId and value
|
467
|
+
*/
|
468
|
+
|
469
|
+
|
470
|
+
onSelect(listener) {
|
471
|
+
this.onSelectListener = listener;
|
472
|
+
}
|
473
|
+
/**
|
474
|
+
* Open the stream and listen for input
|
475
|
+
*/
|
476
|
+
|
477
|
+
|
478
|
+
open() {
|
479
|
+
// register keypress event
|
480
|
+
_readline.default.emitKeypressEvents(this.stream); // handle keypress
|
481
|
+
|
482
|
+
|
483
|
+
this.stream.on('keypress', this.onKeyPress); // initially render the response
|
484
|
+
|
485
|
+
if (this.renderer) {
|
486
|
+
this.renderer.render(this.selectedValue);
|
487
|
+
} // hide pressed keys and start listening on input
|
488
|
+
|
489
|
+
|
490
|
+
this.stream.setRawMode(true);
|
491
|
+
this.stream.resume();
|
492
|
+
}
|
493
|
+
/**
|
494
|
+
* Close the stream
|
495
|
+
*
|
496
|
+
* @param {boolean} cancelled - true if no value was selected (optional)
|
497
|
+
*/
|
498
|
+
|
499
|
+
|
500
|
+
close(cancelled = false) {
|
501
|
+
// reset stream properties
|
502
|
+
this.stream.setRawMode(false);
|
503
|
+
this.stream.pause(); // cleanup the output
|
504
|
+
|
505
|
+
if (this.renderer) {
|
506
|
+
this.renderer.cleanup();
|
507
|
+
} // call the on select listener
|
508
|
+
|
509
|
+
|
510
|
+
if (cancelled) {
|
511
|
+
this.onSelectListener(null);
|
512
|
+
} else {
|
513
|
+
this.onSelectListener(this.selectedValue, this.values[this.selectedValue]);
|
514
|
+
}
|
515
|
+
|
516
|
+
this.stream.removeListener('keypress', this.onKeyPress);
|
517
|
+
}
|
518
|
+
/**
|
519
|
+
* Render the response
|
520
|
+
*/
|
521
|
+
|
522
|
+
|
523
|
+
render() {
|
524
|
+
if (!this.renderer) {
|
525
|
+
return;
|
526
|
+
}
|
527
|
+
|
528
|
+
this.renderer.render(this.selectedValue);
|
529
|
+
}
|
530
|
+
/**
|
531
|
+
* Handle key press event
|
532
|
+
*
|
533
|
+
* @param {string} string - input string
|
534
|
+
* @param {object} key - object containing information about the pressed key
|
535
|
+
*/
|
536
|
+
|
537
|
+
|
538
|
+
onKeyPress(string, key) {
|
539
|
+
if (key) {
|
540
|
+
if (key.name === 'up' && this.selectedValue > 0) {
|
541
|
+
this.selectedValue--;
|
542
|
+
this.render();
|
543
|
+
} else if (key.name === 'down' && this.selectedValue + 1 < this.values.length) {
|
544
|
+
this.selectedValue++;
|
545
|
+
this.render();
|
546
|
+
} else if (key.name === 'return') {
|
547
|
+
this.close();
|
548
|
+
} else if (key.name === 'escape' || key.name === 'c' && key.ctrl) {
|
549
|
+
this.close(true);
|
550
|
+
}
|
551
|
+
}
|
552
|
+
}
|
553
|
+
|
554
|
+
}
|
555
|
+
|
556
|
+
exports["default"] = Input;
|
557
|
+
|
558
|
+
/***/ }),
|
559
|
+
|
560
|
+
/***/ 16059:
|
561
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
562
|
+
|
563
|
+
"use strict";
|
564
|
+
|
565
|
+
|
566
|
+
Object.defineProperty(exports, "__esModule", ({
|
567
|
+
value: true
|
568
|
+
}));
|
569
|
+
exports["default"] = void 0;
|
570
|
+
|
571
|
+
var _readline = _interopRequireDefault(__webpack_require__(14521));
|
572
|
+
|
573
|
+
var _ansiEscapes = __webpack_require__(18512);
|
574
|
+
|
575
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
576
|
+
|
577
|
+
/**
|
578
|
+
* Response renderer
|
579
|
+
*/
|
580
|
+
class Renderer {
|
581
|
+
/**
|
582
|
+
* Renderer constructor
|
583
|
+
*
|
584
|
+
* @param {object} options - renderer options
|
585
|
+
* @param {any} stream - stream to write to (optional)
|
586
|
+
*/
|
587
|
+
constructor(options, stream = process.stdout) {
|
588
|
+
this.options = options;
|
589
|
+
this.stream = stream;
|
590
|
+
this.values = [];
|
591
|
+
this.initialRender = true;
|
592
|
+
}
|
593
|
+
/**
|
594
|
+
* Set the available values
|
595
|
+
*
|
596
|
+
* @param {array} values - all available values
|
597
|
+
*/
|
598
|
+
|
599
|
+
|
600
|
+
setValues(values) {
|
601
|
+
this.values = values;
|
602
|
+
}
|
603
|
+
/**
|
604
|
+
* Render the values
|
605
|
+
*
|
606
|
+
* @param {number} selectedValue - selected value (optional)
|
607
|
+
*/
|
608
|
+
|
609
|
+
|
610
|
+
render(selectedValue = 0) {
|
611
|
+
if (this.initialRender) {
|
612
|
+
// hide the cursor initially
|
613
|
+
this.initialRender = false;
|
614
|
+
this.stream.write(_ansiEscapes.cursorHide);
|
615
|
+
} else {
|
616
|
+
// remove previous lines and values
|
617
|
+
this.stream.write((0, _ansiEscapes.eraseLines)(this.values.length));
|
618
|
+
} // output the current values
|
619
|
+
|
620
|
+
|
621
|
+
this.values.forEach((value, index) => {
|
622
|
+
const symbol = selectedValue === index ? this.options.selected : this.options.unselected;
|
623
|
+
const indentation = ' '.repeat(this.options.indentation);
|
624
|
+
const renderedValue = this.options.valueRenderer(value, selectedValue === index);
|
625
|
+
const end = index !== this.values.length - 1 ? '\n' : '';
|
626
|
+
this.stream.write(indentation + symbol + ' ' + renderedValue + end);
|
627
|
+
});
|
628
|
+
}
|
629
|
+
/**
|
630
|
+
* Cleanup the console at the end
|
631
|
+
*/
|
632
|
+
|
633
|
+
|
634
|
+
cleanup() {
|
635
|
+
this.stream.write((0, _ansiEscapes.eraseLines)(this.values.length));
|
636
|
+
this.stream.write(_ansiEscapes.cursorShow);
|
637
|
+
}
|
638
|
+
|
639
|
+
}
|
640
|
+
|
641
|
+
exports["default"] = Renderer;
|
642
|
+
|
643
|
+
/***/ }),
|
644
|
+
|
645
|
+
/***/ 26730:
|
646
|
+
/***/ ((__unused_webpack_module, exports) => {
|
647
|
+
|
648
|
+
"use strict";
|
649
|
+
|
650
|
+
|
651
|
+
Object.defineProperty(exports, "__esModule", ({
|
652
|
+
value: true
|
653
|
+
}));
|
654
|
+
exports.withObjectValues = exports.withArrayValues = void 0;
|
655
|
+
|
656
|
+
/**
|
657
|
+
* Map incoming and outgoing values if the initial values are an array
|
658
|
+
*
|
659
|
+
* @param {object} options - cli-select options
|
660
|
+
*/
|
661
|
+
const withArrayValues = options => {
|
662
|
+
return {
|
663
|
+
input: options.values,
|
664
|
+
output: (id, value) => {
|
665
|
+
return {
|
666
|
+
id,
|
667
|
+
value
|
668
|
+
};
|
669
|
+
}
|
670
|
+
};
|
671
|
+
};
|
672
|
+
/**
|
673
|
+
* Map incoming and outgoing values if the initial values are an object
|
674
|
+
*
|
675
|
+
* @param {object} options - cli-select options
|
676
|
+
*/
|
677
|
+
|
678
|
+
|
679
|
+
exports.withArrayValues = withArrayValues;
|
680
|
+
|
681
|
+
const withObjectValues = options => {
|
682
|
+
const originalValues = options.values;
|
683
|
+
return {
|
684
|
+
input: Object.values(originalValues),
|
685
|
+
output: (id, value) => {
|
686
|
+
return {
|
687
|
+
id: Object.keys(originalValues)[id],
|
688
|
+
value
|
689
|
+
};
|
690
|
+
}
|
691
|
+
};
|
692
|
+
};
|
693
|
+
|
694
|
+
exports.withObjectValues = withObjectValues;
|
695
|
+
|
121
696
|
/***/ }),
|
122
697
|
|
123
698
|
/***/ 50689:
|
@@ -548,7 +1123,7 @@ function pendGo(self, fn) {
|
|
548
1123
|
var fs = __webpack_require__(57147);
|
549
1124
|
var zlib = __webpack_require__(59796);
|
550
1125
|
var fd_slicer = __webpack_require__(65010);
|
551
|
-
var crc32 = __webpack_require__(
|
1126
|
+
var crc32 = __webpack_require__(34024);
|
552
1127
|
var util = __webpack_require__(73837);
|
553
1128
|
var EventEmitter = (__webpack_require__(82361).EventEmitter);
|
554
1129
|
var Transform = (__webpack_require__(12781).Transform);
|