@opensumi/ide-core-browser 2.23.2 → 2.23.3-next-1680530132.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/lib/components/layout/layout.d.ts +4 -4
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +0 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/label.d.ts +1 -1
- package/lib/utils/label.d.ts.map +1 -1
- package/lib/utils/label.js +11 -4
- package/lib/utils/label.js.map +1 -1
- package/package.json +5 -5
- package/src/utils/index.ts +0 -1
- package/src/utils/label.tsx +17 -4
- package/lib/utils/parse.d.ts +0 -26
- package/lib/utils/parse.d.ts.map +0 -1
- package/lib/utils/parse.js +0 -81
- package/lib/utils/parse.js.map +0 -1
- package/src/utils/parse.ts +0 -82
|
@@ -9,11 +9,11 @@ export declare namespace Layout {
|
|
|
9
9
|
type direction = EDirection | `${EDirection}`;
|
|
10
10
|
type alignment = 'horizontal' | 'vertical';
|
|
11
11
|
function getFlexDirection(direction: Layout.direction): any;
|
|
12
|
-
function getSizeProperty(direction: Layout.direction): "
|
|
12
|
+
function getSizeProperty(direction: Layout.direction): "height" | "width";
|
|
13
13
|
function getDomSizeProperty(direction: Layout.direction): "clientHeight" | "clientWidth";
|
|
14
|
-
function getMinSizeProperty(direction: Layout.direction): "
|
|
15
|
-
function getMaxSizeProperty(direction: Layout.direction): "
|
|
14
|
+
function getMinSizeProperty(direction: Layout.direction): "minHeight" | "minWidth";
|
|
15
|
+
function getMaxSizeProperty(direction: Layout.direction): "maxHeight" | "maxWidth";
|
|
16
16
|
function getResizeHandle(direction: Layout.direction): (props: import("../resize/resize").ResizeHandleProps) => JSX.Element;
|
|
17
|
-
function getTabbarDirection(direction: Layout.direction): "
|
|
17
|
+
function getTabbarDirection(direction: Layout.direction): "column" | "row";
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=layout.d.ts.map
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/lib/utils/index.js
CHANGED
|
@@ -5,7 +5,6 @@ tslib_1.__exportStar(require("./env"), exports);
|
|
|
5
5
|
tslib_1.__exportStar(require("./electron"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./react-hooks"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./icon"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./parse"), exports);
|
|
9
8
|
tslib_1.__exportStar(require("./json"), exports);
|
|
10
9
|
tslib_1.__exportStar(require("./label"), exports);
|
|
11
10
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,qDAA2B;AAC3B,wDAA8B;AAC9B,iDAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,qDAA2B;AAC3B,wDAA8B;AAC9B,iDAAuB;AACvB,iDAAuB;AACvB,kDAAwB"}
|
package/lib/utils/label.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
|
-
export declare function transformLabelWithCodicon(label: string,
|
|
2
|
+
export declare function transformLabelWithCodicon(label: string, iconStyleProps?: CSSProperties | string, transformer?: (str: string) => string | undefined, renderText?: (str: string, index: number) => React.ReactNode): any;
|
|
3
3
|
//# sourceMappingURL=label.d.ts.map
|
package/lib/utils/label.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/utils/label.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/utils/label.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAO7C,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EACb,cAAc,GAAE,aAAa,GAAG,MAAW,EAC3C,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EACjD,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,OAsC7D"}
|
package/lib/utils/label.js
CHANGED
|
@@ -2,30 +2,37 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformLabelWithCodicon = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
5
6
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
7
|
const icon_1 = require("@opensumi/ide-components/lib/icon/icon");
|
|
7
8
|
const ide_core_common_1 = require("@opensumi/ide-core-common");
|
|
8
9
|
const SEPERATOR = ' ';
|
|
9
|
-
function transformLabelWithCodicon(label,
|
|
10
|
+
function transformLabelWithCodicon(label, iconStyleProps = {}, transformer, renderText) {
|
|
10
11
|
const ICON_REGX = /\$\(([a-z.]+\/)?([a-z-]+)(~[a-z]+)?\)/gi;
|
|
11
12
|
const ICON_WITH_ANIMATE_REGX = /\$\(([a-z.]+\/)?([a-z-]+)~([a-z]+)\)/gi;
|
|
13
|
+
// some string like $() $(~spin)
|
|
14
|
+
const ICON_ERROR_REGX = /\$\(([a-z.]+\/)?([a-z-]+)?(~[a-z]+)?\)/gi;
|
|
15
|
+
const generateIconStyle = (icon, styleProps) => typeof styleProps === 'string' ? { className: (0, classnames_1.default)(icon, styleProps) } : { className: icon, style: styleProps };
|
|
12
16
|
return label.split(SEPERATOR).map((e, index) => {
|
|
13
17
|
if (!transformer) {
|
|
14
18
|
return e;
|
|
15
19
|
}
|
|
16
20
|
const icon = transformer(e);
|
|
17
21
|
if (icon) {
|
|
18
|
-
return react_1.default.createElement(icon_1.Icon, {
|
|
22
|
+
return react_1.default.createElement(icon_1.Icon, Object.assign({}, generateIconStyle(icon, iconStyleProps), { key: `${index}-${icon}` }));
|
|
19
23
|
}
|
|
20
24
|
else if (ICON_REGX.test(e)) {
|
|
21
25
|
if (e.includes('~')) {
|
|
22
26
|
const [, , icon, animate] = ICON_WITH_ANIMATE_REGX.exec(e) || [];
|
|
23
27
|
if (animate && icon) {
|
|
24
|
-
return (react_1.default.createElement(icon_1.Icon, {
|
|
28
|
+
return (react_1.default.createElement(icon_1.Icon, Object.assign({}, generateIconStyle(transformer(`$(${icon})`), iconStyleProps), { animate: animate, key: `${index}-${icon}` })));
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
const newStr = e.replaceAll(ICON_REGX, (e) => `${SEPERATOR}${e}${SEPERATOR}`);
|
|
28
|
-
return transformLabelWithCodicon(newStr,
|
|
32
|
+
return transformLabelWithCodicon(newStr, iconStyleProps, transformer);
|
|
33
|
+
}
|
|
34
|
+
else if (ICON_ERROR_REGX.test(e)) {
|
|
35
|
+
return transformLabelWithCodicon(e.replaceAll(ICON_ERROR_REGX, ''), iconStyleProps, transformer, renderText);
|
|
29
36
|
}
|
|
30
37
|
else {
|
|
31
38
|
return (0, ide_core_common_1.isFunction)(renderText) ? renderText(e, index) : react_1.default.createElement("span", { key: `${index}-${e}` }, e);
|
package/lib/utils/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/utils/label.tsx"],"names":[],"mappings":";;;;AAAA,0DAA6C;AAE7C,iEAA8D;AAC9D,+DAAuD;AAEvD,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,SAAgB,yBAAyB,CACvC,KAAa,EACb,
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/utils/label.tsx"],"names":[],"mappings":";;;;AAAA,oEAA6B;AAC7B,0DAA6C;AAE7C,iEAA8D;AAC9D,+DAAuD;AAEvD,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,SAAgB,yBAAyB,CACvC,KAAa,EACb,iBAAyC,EAAE,EAC3C,WAAiD,EACjD,UAA4D;IAE5D,MAAM,SAAS,GAAG,yCAAyC,CAAC;IAC5D,MAAM,sBAAsB,GAAG,wCAAwC,CAAC;IACxE,gCAAgC;IAChC,MAAM,eAAe,GAAG,0CAA0C,CAAC;IAEnE,MAAM,iBAAiB,GAAG,CAAC,IAAa,EAAE,UAAmC,EAAE,EAAE,CAC/E,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAA,oBAAG,EAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;IAEjH,OAAO,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QAC7C,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,CAAC,CAAC;SACV;QACD,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,IAAI,EAAE;YACR,OAAO,8BAAC,WAAI,oBAAK,iBAAiB,CAAC,IAAI,EAAE,cAAc,CAAC,IAAE,GAAG,EAAE,GAAG,KAAK,IAAI,IAAI,EAAE,IAAI,CAAC;SACvF;aAAM,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YAC5B,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACnB,MAAM,CAAC,EAAE,AAAD,EAAG,IAAI,EAAE,OAAO,CAAC,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;gBACjE,IAAI,OAAO,IAAI,IAAI,EAAE;oBACnB,OAAO,CACL,8BAAC,WAAI,oBACC,iBAAiB,CAAC,WAAW,CAAC,KAAK,IAAI,GAAG,CAAC,EAAE,cAAc,CAAC,IAChE,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,KAAK,IAAI,IAAI,EAAE,IACvB,CACH,CAAC;iBACH;aACF;YACD,MAAM,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC;YAC9E,OAAO,yBAAyB,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;SACvE;aAAM,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YAClC,OAAO,yBAAyB,CAAC,CAAC,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;SAC9G;aAAM;YACL,OAAO,IAAA,4BAAU,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,wCAAM,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC,EAAE,IAAG,CAAC,CAAQ,CAAC;SAC/F;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA1CD,8DA0CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/ide-core-browser",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.3-next-1680530132.0",
|
|
4
4
|
"description": "@opensumi/ide-core-browser",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"build": "tsc --build ../../configs/ts/references/tsconfig.core-browser.json"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@opensumi/ide-components": "2.23.
|
|
22
|
-
"@opensumi/ide-connection": "2.23.
|
|
23
|
-
"@opensumi/ide-core-common": "2.23.
|
|
21
|
+
"@opensumi/ide-components": "2.23.3-next-1680530132.0",
|
|
22
|
+
"@opensumi/ide-connection": "2.23.3-next-1680530132.0",
|
|
23
|
+
"@opensumi/ide-core-common": "2.23.3-next-1680530132.0",
|
|
24
24
|
"@opensumi/vscode-debugprotocol": "1.49.0-beta.1",
|
|
25
25
|
"@vscode/codicons": "0.0.27",
|
|
26
26
|
"ajv": "^6.10.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"strip-json-comments": "3.0.1",
|
|
46
46
|
"vscode-textmate": "7.0.1"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "a86212933bd0076f0bbb814628b77f6dd3eef9c8"
|
|
49
49
|
}
|
package/src/utils/index.ts
CHANGED
package/src/utils/label.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import clx from 'classnames';
|
|
1
2
|
import React, { CSSProperties } from 'react';
|
|
2
3
|
|
|
3
4
|
import { Icon } from '@opensumi/ide-components/lib/icon/icon';
|
|
@@ -7,30 +8,42 @@ const SEPERATOR = ' ';
|
|
|
7
8
|
|
|
8
9
|
export function transformLabelWithCodicon(
|
|
9
10
|
label: string,
|
|
10
|
-
|
|
11
|
+
iconStyleProps: CSSProperties | string = {},
|
|
11
12
|
transformer?: (str: string) => string | undefined,
|
|
12
13
|
renderText?: (str: string, index: number) => React.ReactNode,
|
|
13
14
|
) {
|
|
14
15
|
const ICON_REGX = /\$\(([a-z.]+\/)?([a-z-]+)(~[a-z]+)?\)/gi;
|
|
15
16
|
const ICON_WITH_ANIMATE_REGX = /\$\(([a-z.]+\/)?([a-z-]+)~([a-z]+)\)/gi;
|
|
17
|
+
// some string like $() $(~spin)
|
|
18
|
+
const ICON_ERROR_REGX = /\$\(([a-z.]+\/)?([a-z-]+)?(~[a-z]+)?\)/gi;
|
|
19
|
+
|
|
20
|
+
const generateIconStyle = (icon?: string, styleProps?: CSSProperties | string) =>
|
|
21
|
+
typeof styleProps === 'string' ? { className: clx(icon, styleProps) } : { className: icon, style: styleProps };
|
|
22
|
+
|
|
16
23
|
return label.split(SEPERATOR).map((e, index) => {
|
|
17
24
|
if (!transformer) {
|
|
18
25
|
return e;
|
|
19
26
|
}
|
|
20
27
|
const icon = transformer(e);
|
|
21
28
|
if (icon) {
|
|
22
|
-
return <Icon
|
|
29
|
+
return <Icon {...generateIconStyle(icon, iconStyleProps)} key={`${index}-${icon}`} />;
|
|
23
30
|
} else if (ICON_REGX.test(e)) {
|
|
24
31
|
if (e.includes('~')) {
|
|
25
32
|
const [, , icon, animate] = ICON_WITH_ANIMATE_REGX.exec(e) || [];
|
|
26
33
|
if (animate && icon) {
|
|
27
34
|
return (
|
|
28
|
-
<Icon
|
|
35
|
+
<Icon
|
|
36
|
+
{...generateIconStyle(transformer(`$(${icon})`), iconStyleProps)}
|
|
37
|
+
animate={animate}
|
|
38
|
+
key={`${index}-${icon}`}
|
|
39
|
+
/>
|
|
29
40
|
);
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
const newStr = e.replaceAll(ICON_REGX, (e) => `${SEPERATOR}${e}${SEPERATOR}`);
|
|
33
|
-
return transformLabelWithCodicon(newStr,
|
|
44
|
+
return transformLabelWithCodicon(newStr, iconStyleProps, transformer);
|
|
45
|
+
} else if (ICON_ERROR_REGX.test(e)) {
|
|
46
|
+
return transformLabelWithCodicon(e.replaceAll(ICON_ERROR_REGX, ''), iconStyleProps, transformer, renderText);
|
|
34
47
|
} else {
|
|
35
48
|
return isFunction(renderText) ? renderText(e, index) : <span key={`${index}-${e}`}>{e}</span>;
|
|
36
49
|
}
|
package/lib/utils/parse.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/** ******************************************************************************
|
|
2
|
-
* Copyright (C) 2018 Red Hat, Inc. and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
export interface LabelIcon {
|
|
17
|
-
name: string;
|
|
18
|
-
owner?: string;
|
|
19
|
-
animation?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare namespace LabelIcon {
|
|
22
|
-
function is(val: object): val is LabelIcon;
|
|
23
|
-
}
|
|
24
|
-
export type LabelPart = string | LabelIcon;
|
|
25
|
-
export declare function parseLabel(text: string): LabelPart[];
|
|
26
|
-
//# sourceMappingURL=parse.d.ts.map
|
package/lib/utils/parse.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/utils/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,yBAAiB,SAAS,CAAC;IACzB,SAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,SAAS,CAEhD;CACF;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAE3C,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAkDpD"}
|
package/lib/utils/parse.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** ******************************************************************************
|
|
3
|
-
* Copyright (C) 2018 Red Hat, Inc. and others.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials are made available under the
|
|
6
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
*
|
|
9
|
-
* This Source Code may also be made available under the following Secondary
|
|
10
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
* with the GNU Classpath Exception which is available at
|
|
13
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
// Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/core/src/browser/label-parser.ts
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.parseLabel = exports.LabelIcon = void 0;
|
|
20
|
-
var LabelIcon;
|
|
21
|
-
(function (LabelIcon) {
|
|
22
|
-
function is(val) {
|
|
23
|
-
return 'name' in val;
|
|
24
|
-
}
|
|
25
|
-
LabelIcon.is = is;
|
|
26
|
-
})(LabelIcon = exports.LabelIcon || (exports.LabelIcon = {}));
|
|
27
|
-
function parseLabel(text) {
|
|
28
|
-
const parserArray = [];
|
|
29
|
-
let arrPointer = 0;
|
|
30
|
-
let potentialIcon = '';
|
|
31
|
-
for (let idx = 0; idx < text.length; idx++) {
|
|
32
|
-
const char = text.charAt(idx);
|
|
33
|
-
parserArray[arrPointer] = parserArray[arrPointer] || '';
|
|
34
|
-
if (potentialIcon === '') {
|
|
35
|
-
if (char === '$') {
|
|
36
|
-
potentialIcon += char;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
parserArray[arrPointer] += char;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
else if (potentialIcon === '$') {
|
|
43
|
-
if (char === '(') {
|
|
44
|
-
potentialIcon += char;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
parserArray[arrPointer] += potentialIcon + char;
|
|
48
|
-
potentialIcon = '';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
if (char === ')') {
|
|
53
|
-
const iconClassArr = potentialIcon.substring(2, potentialIcon.length).split('~');
|
|
54
|
-
let name = iconClassArr[0];
|
|
55
|
-
let owner;
|
|
56
|
-
if (name) {
|
|
57
|
-
const index = name.indexOf('/');
|
|
58
|
-
if (index !== -1) {
|
|
59
|
-
owner = name.substring(0, index);
|
|
60
|
-
name = name.substring(index + 1);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (parserArray[arrPointer] !== '') {
|
|
64
|
-
arrPointer++;
|
|
65
|
-
}
|
|
66
|
-
parserArray[arrPointer] = { name, owner, animation: iconClassArr[1] };
|
|
67
|
-
arrPointer++;
|
|
68
|
-
potentialIcon = '';
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
potentialIcon += char;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (potentialIcon !== '') {
|
|
76
|
-
parserArray[arrPointer] += potentialIcon;
|
|
77
|
-
}
|
|
78
|
-
return parserArray;
|
|
79
|
-
}
|
|
80
|
-
exports.parseLabel = parseLabel;
|
|
81
|
-
//# sourceMappingURL=parse.js.map
|
package/lib/utils/parse.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/utils/parse.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mIAAmI;;;AAQnI,IAAiB,SAAS,CAIzB;AAJD,WAAiB,SAAS;IACxB,SAAgB,EAAE,CAAC,GAAW;QAC5B,OAAO,MAAM,IAAI,GAAG,CAAC;IACvB,CAAC;IAFe,YAAE,KAEjB,CAAA;AACH,CAAC,EAJgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAIzB;AAID,SAAgB,UAAU,CAAC,IAAY;IACrC,MAAM,WAAW,GAAgB,EAAE,CAAC;IACpC,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,aAAa,GAAG,EAAE,CAAC;IAEvB,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,WAAW,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACxD,IAAI,aAAa,KAAK,EAAE,EAAE;YACxB,IAAI,IAAI,KAAK,GAAG,EAAE;gBAChB,aAAa,IAAI,IAAI,CAAC;aACvB;iBAAM;gBACL,WAAW,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;aACjC;SACF;aAAM,IAAI,aAAa,KAAK,GAAG,EAAE;YAChC,IAAI,IAAI,KAAK,GAAG,EAAE;gBAChB,aAAa,IAAI,IAAI,CAAC;aACvB;iBAAM;gBACL,WAAW,CAAC,UAAU,CAAC,IAAI,aAAa,GAAG,IAAI,CAAC;gBAChD,aAAa,GAAG,EAAE,CAAC;aACpB;SACF;aAAM;YACL,IAAI,IAAI,KAAK,GAAG,EAAE;gBAChB,MAAM,YAAY,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACjF,IAAI,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBAC3B,IAAI,KAAyB,CAAC;gBAC9B,IAAI,IAAI,EAAE;oBACR,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;oBAChC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;wBAChB,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;wBACjC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;qBAClC;iBACF;gBACD,IAAI,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE;oBAClC,UAAU,EAAE,CAAC;iBACd;gBACD,WAAW,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;gBACtE,UAAU,EAAE,CAAC;gBACb,aAAa,GAAG,EAAE,CAAC;aACpB;iBAAM;gBACL,aAAa,IAAI,IAAI,CAAC;aACvB;SACF;KACF;IAED,IAAI,aAAa,KAAK,EAAE,EAAE;QACxB,WAAW,CAAC,UAAU,CAAC,IAAI,aAAa,CAAC;KAC1C;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAlDD,gCAkDC"}
|
package/src/utils/parse.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/** ******************************************************************************
|
|
2
|
-
* Copyright (C) 2018 Red Hat, Inc. and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
// Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/core/src/browser/label-parser.ts
|
|
17
|
-
|
|
18
|
-
export interface LabelIcon {
|
|
19
|
-
name: string;
|
|
20
|
-
owner?: string;
|
|
21
|
-
animation?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export namespace LabelIcon {
|
|
25
|
-
export function is(val: object): val is LabelIcon {
|
|
26
|
-
return 'name' in val;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type LabelPart = string | LabelIcon;
|
|
31
|
-
|
|
32
|
-
export function parseLabel(text: string): LabelPart[] {
|
|
33
|
-
const parserArray: LabelPart[] = [];
|
|
34
|
-
let arrPointer = 0;
|
|
35
|
-
let potentialIcon = '';
|
|
36
|
-
|
|
37
|
-
for (let idx = 0; idx < text.length; idx++) {
|
|
38
|
-
const char = text.charAt(idx);
|
|
39
|
-
parserArray[arrPointer] = parserArray[arrPointer] || '';
|
|
40
|
-
if (potentialIcon === '') {
|
|
41
|
-
if (char === '$') {
|
|
42
|
-
potentialIcon += char;
|
|
43
|
-
} else {
|
|
44
|
-
parserArray[arrPointer] += char;
|
|
45
|
-
}
|
|
46
|
-
} else if (potentialIcon === '$') {
|
|
47
|
-
if (char === '(') {
|
|
48
|
-
potentialIcon += char;
|
|
49
|
-
} else {
|
|
50
|
-
parserArray[arrPointer] += potentialIcon + char;
|
|
51
|
-
potentialIcon = '';
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
if (char === ')') {
|
|
55
|
-
const iconClassArr = potentialIcon.substring(2, potentialIcon.length).split('~');
|
|
56
|
-
let name = iconClassArr[0];
|
|
57
|
-
let owner: string | undefined;
|
|
58
|
-
if (name) {
|
|
59
|
-
const index = name.indexOf('/');
|
|
60
|
-
if (index !== -1) {
|
|
61
|
-
owner = name.substring(0, index);
|
|
62
|
-
name = name.substring(index + 1);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (parserArray[arrPointer] !== '') {
|
|
66
|
-
arrPointer++;
|
|
67
|
-
}
|
|
68
|
-
parserArray[arrPointer] = { name, owner, animation: iconClassArr[1] };
|
|
69
|
-
arrPointer++;
|
|
70
|
-
potentialIcon = '';
|
|
71
|
-
} else {
|
|
72
|
-
potentialIcon += char;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (potentialIcon !== '') {
|
|
78
|
-
parserArray[arrPointer] += potentialIcon;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return parserArray;
|
|
82
|
-
}
|