@corenel/ui-kit 0.1.0 → 0.3.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/dist/FieldControls.d.ts +84 -0
- package/dist/FieldControls.d.ts.map +1 -0
- package/dist/FieldControls.js +93 -0
- package/dist/FieldControls.js.map +1 -0
- package/dist/basicLanguages.d.ts +26 -0
- package/dist/basicLanguages.d.ts.map +1 -0
- package/dist/basicLanguages.js +99 -0
- package/dist/basicLanguages.js.map +1 -0
- package/dist/host.d.ts +6 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js.map +1 -1
- package/dist/icons.d.ts +14 -2
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +18 -4
- package/dist/icons.js.map +1 -1
- package/dist/languages.d.ts +9 -0
- package/dist/languages.d.ts.map +1 -1
- package/dist/languages.js +18 -0
- package/dist/languages.js.map +1 -1
- package/dist/monacoColorize.d.ts +1 -2
- package/dist/monacoColorize.d.ts.map +1 -1
- package/dist/monacoColorize.js +36 -97
- package/dist/monacoColorize.js.map +1 -1
- package/dist/theme.d.ts +16 -0
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +44 -5
- package/dist/theme.js.map +1 -1
- package/dist/ui-helpers.d.ts +10 -0
- package/dist/ui-helpers.d.ts.map +1 -1
- package/dist/ui-helpers.js +71 -2
- package/dist/ui-helpers.js.map +1 -1
- package/dist/usage.d.ts +3 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +9 -0
- package/dist/usage.js.map +1 -1
- package/dist/useEscape.d.ts +2 -0
- package/dist/useEscape.d.ts.map +1 -0
- package/dist/useEscape.js +40 -0
- package/dist/useEscape.js.map +1 -0
- package/package.json +25 -31
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEscape.d.ts","sourceRoot":"","sources":["../useEscape.ts"],"names":[],"mappings":"AAsBA,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAgBpE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* Close-on-Escape for drawers/modals/popovers. Overlays register while active;
|
|
2
|
+
* ONE window listener fires only the TOPMOST (most recently activated) handler,
|
|
3
|
+
* so stacked surfaces (a modal above a drawer above a peeked panel) close one
|
|
4
|
+
* per keypress, top first — instead of every listener reacting to the same
|
|
5
|
+
* Escape. An Escape already consumed by an inner control (a completion popup,
|
|
6
|
+
* Monaco, a rename input — anything that called preventDefault before the event
|
|
7
|
+
* reached window) is ignored.
|
|
8
|
+
*
|
|
9
|
+
* This is the ONLY sanctioned Escape-close mechanism: a raw window/document
|
|
10
|
+
* keydown listener next to surfaces using this hook double-closes (all listeners
|
|
11
|
+
* on the same target fire in registration order, regardless of preventDefault). */
|
|
12
|
+
import { useEffect, useRef } from 'react';
|
|
13
|
+
const stack = [];
|
|
14
|
+
let bound = false;
|
|
15
|
+
function onKey(e) {
|
|
16
|
+
if (e.key !== 'Escape' || e.defaultPrevented || stack.length === 0)
|
|
17
|
+
return;
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
stack[stack.length - 1]();
|
|
20
|
+
}
|
|
21
|
+
export function useEscape(active, onClose) {
|
|
22
|
+
const ref = useRef(onClose);
|
|
23
|
+
ref.current = onClose;
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!active)
|
|
26
|
+
return;
|
|
27
|
+
const fn = () => ref.current();
|
|
28
|
+
stack.push(fn);
|
|
29
|
+
if (!bound) {
|
|
30
|
+
window.addEventListener('keydown', onKey);
|
|
31
|
+
bound = true;
|
|
32
|
+
}
|
|
33
|
+
return () => {
|
|
34
|
+
const i = stack.lastIndexOf(fn);
|
|
35
|
+
if (i >= 0)
|
|
36
|
+
stack.splice(i, 1);
|
|
37
|
+
};
|
|
38
|
+
}, [active]);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=useEscape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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GED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corenel/ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Corenel shared UI primitives — icons, theme, token-usage helpers, small UI helpers, monaco colorizer. Consumed by @corenel/web-ui and the prompd app alike.",
|
|
6
6
|
"exports": {
|
|
7
|
-
".":
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./*": {
|
|
12
|
+
"types": "./dist/*.d.ts",
|
|
13
|
+
"default": "./dist/*.js"
|
|
14
|
+
},
|
|
15
|
+
"./icons": {
|
|
16
|
+
"types": "./dist/icons.d.ts",
|
|
17
|
+
"default": "./dist/icons.js"
|
|
18
|
+
},
|
|
19
|
+
"./host": {
|
|
20
|
+
"types": "./dist/host.d.ts",
|
|
21
|
+
"default": "./dist/host.js"
|
|
22
|
+
}
|
|
15
23
|
},
|
|
16
24
|
"dependencies": {
|
|
17
|
-
"
|
|
25
|
+
"gpt-tokenizer": "^3.4.0",
|
|
26
|
+
"@corenel/protocol": "0.4.0"
|
|
18
27
|
},
|
|
19
28
|
"peerDependencies": {
|
|
20
29
|
"monaco-editor": "*",
|
|
@@ -24,27 +33,12 @@
|
|
|
24
33
|
"typescript": "^5.9.3"
|
|
25
34
|
},
|
|
26
35
|
"publishConfig": {
|
|
27
|
-
"access": "public"
|
|
28
|
-
"exports": {
|
|
29
|
-
".": {
|
|
30
|
-
"types": "./dist/index.d.ts",
|
|
31
|
-
"default": "./dist/index.js"
|
|
32
|
-
},
|
|
33
|
-
"./*": {
|
|
34
|
-
"types": "./dist/*.d.ts",
|
|
35
|
-
"default": "./dist/*.js"
|
|
36
|
-
},
|
|
37
|
-
"./icons": {
|
|
38
|
-
"types": "./dist/icons.d.ts",
|
|
39
|
-
"default": "./dist/icons.js"
|
|
40
|
-
},
|
|
41
|
-
"./host": {
|
|
42
|
-
"types": "./dist/host.d.ts",
|
|
43
|
-
"default": "./dist/host.js"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
36
|
+
"access": "public"
|
|
46
37
|
},
|
|
47
38
|
"files": [
|
|
48
39
|
"dist"
|
|
49
|
-
]
|
|
50
|
-
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -p tsconfig.build.json"
|
|
43
|
+
}
|
|
44
|
+
}
|