@kispace-io/extension-memory-usage 0.8.1 → 0.8.2
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/{src/i18n.json → dist/i18n.json.d.ts} +4 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/k-memory-usage.d.ts +13 -0
- package/dist/k-memory-usage.d.ts.map +1 -0
- package/dist/memory-usage-extension-nWZCeWFU.js +63 -0
- package/dist/memory-usage-extension-nWZCeWFU.js.map +1 -0
- package/dist/memory-usage-extension.d.ts +1 -0
- package/dist/memory-usage-extension.d.ts.map +1 -0
- package/package.json +15 -5
- package/src/index.ts +0 -16
- package/src/k-memory-usage.ts +0 -59
- package/src/memory-usage-extension.ts +0 -10
- package/tsconfig.json +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
1
|
+
declare const _default: {
|
|
2
2
|
"namespace": "extensions",
|
|
3
3
|
"en": {
|
|
4
4
|
"EXT_MEMORYUSAGE_NAME": "Memory Usage Monitor",
|
|
@@ -8,4 +8,6 @@
|
|
|
8
8
|
"EXT_MEMORYUSAGE_NAME": "Speicherverbrauch-Monitor",
|
|
9
9
|
"EXT_MEMORYUSAGE_DESC": "Zeigt die JavaScript-Heap-Speichernutzung in der unteren Symbolleiste an"
|
|
10
10
|
}
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default _default;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { contributionRegistry, SYSTEM_LANGUAGE_BUNDLES, i18nLazy, extensionRegistry } from "@kispace-io/core";
|
|
2
|
+
const namespace = "extensions";
|
|
3
|
+
const en = { "EXT_MEMORYUSAGE_NAME": "Memory Usage Monitor", "EXT_MEMORYUSAGE_DESC": "Displays JavaScript heap memory usage in the bottom toolbar" };
|
|
4
|
+
const de = { "EXT_MEMORYUSAGE_NAME": "Speicherverbrauch-Monitor", "EXT_MEMORYUSAGE_DESC": "Zeigt die JavaScript-Heap-Speichernutzung in der unteren Symbolleiste an" };
|
|
5
|
+
const bundle = {
|
|
6
|
+
namespace,
|
|
7
|
+
en,
|
|
8
|
+
de
|
|
9
|
+
};
|
|
10
|
+
contributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle);
|
|
11
|
+
const t = i18nLazy("extensions");
|
|
12
|
+
extensionRegistry.registerExtension({
|
|
13
|
+
id: "system.memoryusage",
|
|
14
|
+
name: t("EXT_MEMORYUSAGE_NAME"),
|
|
15
|
+
description: t("EXT_MEMORYUSAGE_DESC"),
|
|
16
|
+
loader: () => import("./memory-usage-extension-nWZCeWFU.js"),
|
|
17
|
+
icon: "microchip"
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { extensionRegistry, i18nLazy, contributionRegistry, SYSTEM_LANGUAGE_BUNDLES } from '@kispace-io/core';\nimport bundle from './i18n.json';\n\ncontributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle as any);\n\nconst t = i18nLazy('extensions');\n\nextensionRegistry.registerExtension({\n id: \"system.memoryusage\",\n name: t('EXT_MEMORYUSAGE_NAME'),\n description: t('EXT_MEMORYUSAGE_DESC'),\n loader: () => import(\"./memory-usage-extension\"),\n icon: \"microchip\",\n \n \n});\n"],"names":[],"mappings":";;;;;;;;;AAGA,qBAAqB,qBAAqB,yBAAyB,MAAa;AAEhF,MAAM,IAAI,SAAS,YAAY;AAE/B,kBAAkB,kBAAkB;AAAA,EAClC,IAAI;AAAA,EACJ,MAAM,EAAE,sBAAsB;AAAA,EAC9B,aAAa,EAAE,sBAAsB;AAAA,EACrC,QAAQ,MAAM,OAAO,sCAA0B;AAAA,EAC/C,MAAM;AAGR,CAAC;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KElement } from '@kispace-io/core';
|
|
2
|
+
export declare class KMemoryUsage extends KElement {
|
|
3
|
+
private updateInterval;
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
disconnectedCallback(): void;
|
|
6
|
+
protected render(): import('lit-html').TemplateResult<1>;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'k-memory-usage': KMemoryUsage;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=k-memory-usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"k-memory-usage.d.ts","sourceRoot":"","sources":["../src/k-memory-usage.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAG1C,qBACa,YAAa,SAAQ,QAAQ;IAEtC,OAAO,CAAC,cAAc,CAAuB;IAE7C,iBAAiB;IAOjB,oBAAoB;IAQpB,SAAS,CAAC,MAAM;CA2BnB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,gBAAgB,EAAE,YAAY,CAAA;KACjC;CACJ"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { KElement, contributionRegistry, TOOLBAR_BOTTOM } from "@kispace-io/core";
|
|
2
|
+
import { customElement } from "lit/decorators.js";
|
|
3
|
+
import { html } from "lit";
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
6
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
7
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8
|
+
if (decorator = decorators[i])
|
|
9
|
+
result = decorator(result) || result;
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
let KMemoryUsage = class extends KElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.updateInterval = null;
|
|
16
|
+
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
super.connectedCallback();
|
|
19
|
+
this.updateInterval = window.setInterval(() => {
|
|
20
|
+
this.requestUpdate();
|
|
21
|
+
}, 2e3);
|
|
22
|
+
}
|
|
23
|
+
disconnectedCallback() {
|
|
24
|
+
super.disconnectedCallback();
|
|
25
|
+
if (this.updateInterval !== null) {
|
|
26
|
+
clearInterval(this.updateInterval);
|
|
27
|
+
this.updateInterval = null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const memory = performance.memory;
|
|
32
|
+
if (!memory) {
|
|
33
|
+
return html``;
|
|
34
|
+
}
|
|
35
|
+
const usedMB = (memory.usedJSHeapSize / 1048576).toFixed(1);
|
|
36
|
+
const limitMB = (memory.jsHeapSizeLimit / 1048576).toFixed(0);
|
|
37
|
+
const percentageNum = memory.usedJSHeapSize / memory.jsHeapSizeLimit * 100;
|
|
38
|
+
const percentage = percentageNum.toFixed(0);
|
|
39
|
+
const barColor = percentageNum > 80 ? "#ff4444" : percentageNum > 60 ? "#ffaa00" : "#44aa44";
|
|
40
|
+
return html`
|
|
41
|
+
<span style="display: inline-flex; align-items: center; justify-content: center; height: 100%; padding-left: 0.5rem; gap: 0.25rem; font-size: 0.85em; color: var(--wa-color-neutral-text);" title="Main thread memory consumption only (excludes web workers)">
|
|
42
|
+
<wa-icon name="microchip" label="Memory usage"></wa-icon>
|
|
43
|
+
<span style="display: flex; align-items: center; gap: 0.25rem;">
|
|
44
|
+
<span>${usedMB} / ${limitMB} MB</span>
|
|
45
|
+
<span style="position: relative; display: inline-block; width: 60px; height: 14px; vertical-align: middle;">
|
|
46
|
+
<span style="display: block; position: absolute; width: 100%; height: 100%; background: rgba(255,255,255,0.1); border-radius: 4px;"></span>
|
|
47
|
+
<span style="display: block; position: absolute; width: ${percentage}%; height: 100%; background: ${barColor}; border-radius: 4px; transition: width 0.3s ease;"></span>
|
|
48
|
+
<span style="position: absolute; width: 100%; text-align: center; font-size: 0.7em; line-height: 14px; font-weight: 600; color: white; text-shadow: 0 0 2px rgba(0,0,0,0.8);">${percentage}%</span>
|
|
49
|
+
</span>
|
|
50
|
+
</span>
|
|
51
|
+
</span>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
KMemoryUsage = __decorateClass([
|
|
56
|
+
customElement("k-memory-usage")
|
|
57
|
+
], KMemoryUsage);
|
|
58
|
+
contributionRegistry.registerContribution(TOOLBAR_BOTTOM, {
|
|
59
|
+
target: TOOLBAR_BOTTOM,
|
|
60
|
+
label: "Memory",
|
|
61
|
+
html: `<k-memory-usage></k-memory-usage>`
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=memory-usage-extension-nWZCeWFU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-usage-extension-nWZCeWFU.js","sources":["../src/k-memory-usage.ts","../src/memory-usage-extension.ts"],"sourcesContent":["import {customElement} from \"lit/decorators.js\";\nimport {KElement} from \"@kispace-io/core\";\nimport {html} from \"lit\";\n\n@customElement('k-memory-usage')\nexport class KMemoryUsage extends KElement {\n \n private updateInterval: number | null = null;\n\n connectedCallback() {\n super.connectedCallback();\n this.updateInterval = window.setInterval(() => {\n this.requestUpdate();\n }, 2000);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n if (this.updateInterval !== null) {\n clearInterval(this.updateInterval);\n this.updateInterval = null;\n }\n }\n\n protected render() {\n const memory = (performance as any).memory;\n if (!memory) {\n return html``;\n }\n \n const usedMB = (memory.usedJSHeapSize / 1048576).toFixed(1);\n const limitMB = (memory.jsHeapSizeLimit / 1048576).toFixed(0);\n const percentageNum = (memory.usedJSHeapSize / memory.jsHeapSizeLimit) * 100;\n const percentage = percentageNum.toFixed(0);\n \n const barColor = percentageNum > 80 ? '#ff4444' : percentageNum > 60 ? '#ffaa00' : '#44aa44';\n \n return html`\n <span style=\"display: inline-flex; align-items: center; justify-content: center; height: 100%; padding-left: 0.5rem; gap: 0.25rem; font-size: 0.85em; color: var(--wa-color-neutral-text);\" title=\"Main thread memory consumption only (excludes web workers)\">\n <wa-icon name=\"microchip\" label=\"Memory usage\"></wa-icon>\n <span style=\"display: flex; align-items: center; gap: 0.25rem;\">\n <span>${usedMB} / ${limitMB} MB</span>\n <span style=\"position: relative; display: inline-block; width: 60px; height: 14px; vertical-align: middle;\">\n <span style=\"display: block; position: absolute; width: 100%; height: 100%; background: rgba(255,255,255,0.1); border-radius: 4px;\"></span>\n <span style=\"display: block; position: absolute; width: ${percentage}%; height: 100%; background: ${barColor}; border-radius: 4px; transition: width 0.3s ease;\"></span>\n <span style=\"position: absolute; width: 100%; text-align: center; font-size: 0.7em; line-height: 14px; font-weight: 600; color: white; text-shadow: 0 0 2px rgba(0,0,0,0.8);\">${percentage}%</span>\n </span>\n </span>\n </span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'k-memory-usage': KMemoryUsage\n }\n}\n\n","import {contributionRegistry, HTMLContribution} from \"@kispace-io/core\";\nimport {TOOLBAR_BOTTOM} from \"@kispace-io/core\";\nimport \"./k-memory-usage\";\n\ncontributionRegistry.registerContribution(TOOLBAR_BOTTOM, {\n target: TOOLBAR_BOTTOM,\n label: \"Memory\",\n html: `<k-memory-usage></k-memory-usage>`\n} as HTMLContribution)\n\n"],"names":[],"mappings":";;;;;;;;;;;AAKO,IAAM,eAAN,cAA2B,SAAS;AAAA,EAApC,cAAA;AAAA,UAAA,GAAA,SAAA;AAEH,SAAQ,iBAAgC;AAAA,EAAA;AAAA,EAExC,oBAAoB;AAChB,UAAM,kBAAA;AACN,SAAK,iBAAiB,OAAO,YAAY,MAAM;AAC3C,WAAK,cAAA;AAAA,IACT,GAAG,GAAI;AAAA,EACX;AAAA,EAEA,uBAAuB;AACnB,UAAM,qBAAA;AACN,QAAI,KAAK,mBAAmB,MAAM;AAC9B,oBAAc,KAAK,cAAc;AACjC,WAAK,iBAAiB;AAAA,IAC1B;AAAA,EACJ;AAAA,EAEU,SAAS;AACf,UAAM,SAAU,YAAoB;AACpC,QAAI,CAAC,QAAQ;AACT,aAAO;AAAA,IACX;AAEA,UAAM,UAAU,OAAO,iBAAiB,SAAS,QAAQ,CAAC;AAC1D,UAAM,WAAW,OAAO,kBAAkB,SAAS,QAAQ,CAAC;AAC5D,UAAM,gBAAiB,OAAO,iBAAiB,OAAO,kBAAmB;AACzE,UAAM,aAAa,cAAc,QAAQ,CAAC;AAE1C,UAAM,WAAW,gBAAgB,KAAK,YAAY,gBAAgB,KAAK,YAAY;AAEnF,WAAO;AAAA;AAAA;AAAA;AAAA,4BAIa,MAAM,MAAM,OAAO;AAAA;AAAA;AAAA,kFAGmC,UAAU,gCAAgC,QAAQ;AAAA,wMACoE,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK9M;AACJ;AA9Ca,eAAN,gBAAA;AAAA,EADN,cAAc,gBAAgB;AAAA,GAClB,YAAA;ACDb,qBAAqB,qBAAqB,gBAAgB;AAAA,EACtD,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AACV,CAAqB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=memory-usage-extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-usage-extension.d.ts","sourceRoot":"","sources":["../src/memory-usage-extension.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kispace-io/extension-memory-usage",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "./
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@kispace-io/core": "*"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"typescript": "^5.9.3"
|
|
16
|
+
"typescript": "^5.9.3",
|
|
17
|
+
"vite": "^7.1.12",
|
|
18
|
+
"vite-plugin-dts": "^4.5.4"
|
|
19
|
+
},
|
|
20
|
+
"module": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "vite build"
|
|
17
27
|
}
|
|
18
28
|
}
|
package/src/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { extensionRegistry, i18nLazy, contributionRegistry, SYSTEM_LANGUAGE_BUNDLES } from '@kispace-io/core';
|
|
2
|
-
import bundle from './i18n.json';
|
|
3
|
-
|
|
4
|
-
contributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle as any);
|
|
5
|
-
|
|
6
|
-
const t = i18nLazy('extensions');
|
|
7
|
-
|
|
8
|
-
extensionRegistry.registerExtension({
|
|
9
|
-
id: "system.memoryusage",
|
|
10
|
-
name: t('EXT_MEMORYUSAGE_NAME'),
|
|
11
|
-
description: t('EXT_MEMORYUSAGE_DESC'),
|
|
12
|
-
loader: () => import("./memory-usage-extension"),
|
|
13
|
-
icon: "microchip",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
package/src/k-memory-usage.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {customElement} from "lit/decorators.js";
|
|
2
|
-
import {KElement} from "@kispace-io/core";
|
|
3
|
-
import {html} from "lit";
|
|
4
|
-
|
|
5
|
-
@customElement('k-memory-usage')
|
|
6
|
-
export class KMemoryUsage extends KElement {
|
|
7
|
-
|
|
8
|
-
private updateInterval: number | null = null;
|
|
9
|
-
|
|
10
|
-
connectedCallback() {
|
|
11
|
-
super.connectedCallback();
|
|
12
|
-
this.updateInterval = window.setInterval(() => {
|
|
13
|
-
this.requestUpdate();
|
|
14
|
-
}, 2000);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
disconnectedCallback() {
|
|
18
|
-
super.disconnectedCallback();
|
|
19
|
-
if (this.updateInterval !== null) {
|
|
20
|
-
clearInterval(this.updateInterval);
|
|
21
|
-
this.updateInterval = null;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
protected render() {
|
|
26
|
-
const memory = (performance as any).memory;
|
|
27
|
-
if (!memory) {
|
|
28
|
-
return html``;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const usedMB = (memory.usedJSHeapSize / 1048576).toFixed(1);
|
|
32
|
-
const limitMB = (memory.jsHeapSizeLimit / 1048576).toFixed(0);
|
|
33
|
-
const percentageNum = (memory.usedJSHeapSize / memory.jsHeapSizeLimit) * 100;
|
|
34
|
-
const percentage = percentageNum.toFixed(0);
|
|
35
|
-
|
|
36
|
-
const barColor = percentageNum > 80 ? '#ff4444' : percentageNum > 60 ? '#ffaa00' : '#44aa44';
|
|
37
|
-
|
|
38
|
-
return html`
|
|
39
|
-
<span style="display: inline-flex; align-items: center; justify-content: center; height: 100%; padding-left: 0.5rem; gap: 0.25rem; font-size: 0.85em; color: var(--wa-color-neutral-text);" title="Main thread memory consumption only (excludes web workers)">
|
|
40
|
-
<wa-icon name="microchip" label="Memory usage"></wa-icon>
|
|
41
|
-
<span style="display: flex; align-items: center; gap: 0.25rem;">
|
|
42
|
-
<span>${usedMB} / ${limitMB} MB</span>
|
|
43
|
-
<span style="position: relative; display: inline-block; width: 60px; height: 14px; vertical-align: middle;">
|
|
44
|
-
<span style="display: block; position: absolute; width: 100%; height: 100%; background: rgba(255,255,255,0.1); border-radius: 4px;"></span>
|
|
45
|
-
<span style="display: block; position: absolute; width: ${percentage}%; height: 100%; background: ${barColor}; border-radius: 4px; transition: width 0.3s ease;"></span>
|
|
46
|
-
<span style="position: absolute; width: 100%; text-align: center; font-size: 0.7em; line-height: 14px; font-weight: 600; color: white; text-shadow: 0 0 2px rgba(0,0,0,0.8);">${percentage}%</span>
|
|
47
|
-
</span>
|
|
48
|
-
</span>
|
|
49
|
-
</span>
|
|
50
|
-
`;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
declare global {
|
|
55
|
-
interface HTMLElementTagNameMap {
|
|
56
|
-
'k-memory-usage': KMemoryUsage
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {contributionRegistry, HTMLContribution} from "@kispace-io/core";
|
|
2
|
-
import {TOOLBAR_BOTTOM} from "@kispace-io/core";
|
|
3
|
-
import "./k-memory-usage";
|
|
4
|
-
|
|
5
|
-
contributionRegistry.registerContribution(TOOLBAR_BOTTOM, {
|
|
6
|
-
target: TOOLBAR_BOTTOM,
|
|
7
|
-
label: "Memory",
|
|
8
|
-
html: `<k-memory-usage></k-memory-usage>`
|
|
9
|
-
} as HTMLContribution)
|
|
10
|
-
|