@pyreon/elements 0.24.0 → 0.24.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/lib/index.js +7 -8
- package/package.json +9 -9
- package/src/Overlay/useOverlay.tsx +10 -2
- package/src/Text/component.tsx +5 -6
package/lib/index.js
CHANGED
|
@@ -951,6 +951,11 @@ const adjustForAncestor = (pos, ancestor) => {
|
|
|
951
951
|
* is coordinated through the overlay context.
|
|
952
952
|
*/
|
|
953
953
|
let modalOverflowCount = 0;
|
|
954
|
+
const CLICK_CLOSE_KINDS = new Set([
|
|
955
|
+
"click",
|
|
956
|
+
"clickOnTrigger",
|
|
957
|
+
"clickOutsideContent"
|
|
958
|
+
]);
|
|
954
959
|
const devWarn = (msg) => {
|
|
955
960
|
if (!IS_DEVELOPMENT) return;
|
|
956
961
|
console.warn(msg);
|
|
@@ -1085,11 +1090,7 @@ const useOverlay = ({ isOpen = false, openOn = "click", closeOn = "click", type
|
|
|
1085
1090
|
const setupListeners = () => {
|
|
1086
1091
|
if (typeof window === "undefined") return () => {};
|
|
1087
1092
|
const cleanups = [];
|
|
1088
|
-
if (openOn === "click" ||
|
|
1089
|
-
"click",
|
|
1090
|
-
"clickOnTrigger",
|
|
1091
|
-
"clickOutsideContent"
|
|
1092
|
-
].includes(closeOn)) {
|
|
1093
|
+
if (openOn === "click" || CLICK_CLOSE_KINDS.has(closeOn)) {
|
|
1093
1094
|
window.addEventListener("click", handleClick);
|
|
1094
1095
|
cleanups.push(() => window.removeEventListener("click", handleClick));
|
|
1095
1096
|
}
|
|
@@ -1328,9 +1329,7 @@ const Component$5 = (props) => {
|
|
|
1328
1329
|
"css",
|
|
1329
1330
|
"ref"
|
|
1330
1331
|
]);
|
|
1331
|
-
|
|
1332
|
-
if (own.paragraph) finalTag = "p";
|
|
1333
|
-
else finalTag = own.tag;
|
|
1332
|
+
const finalTag = own.paragraph ? "p" : own.tag;
|
|
1334
1333
|
return /* @__PURE__ */ jsx(styled_default, {
|
|
1335
1334
|
ref: own.ref,
|
|
1336
1335
|
as: finalTag,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/elements",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
4
4
|
"description": "Foundational UI components for Pyreon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"typecheck": "tsc --noEmit"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@pyreon/core": "^0.24.
|
|
45
|
+
"@pyreon/core": "^0.24.2",
|
|
46
46
|
"@pyreon/manifest": "0.13.1",
|
|
47
|
-
"@pyreon/reactivity": "^0.24.
|
|
48
|
-
"@pyreon/runtime-dom": "^0.24.
|
|
47
|
+
"@pyreon/reactivity": "^0.24.2",
|
|
48
|
+
"@pyreon/runtime-dom": "^0.24.2",
|
|
49
49
|
"@pyreon/test-utils": "^0.13.11",
|
|
50
|
-
"@pyreon/typescript": "^0.24.
|
|
50
|
+
"@pyreon/typescript": "^0.24.2",
|
|
51
51
|
"@vitest/browser-playwright": "^4.1.4",
|
|
52
52
|
"@vitus-labs/tools-rolldown": "^2.4.0"
|
|
53
53
|
},
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"node": ">= 22"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@pyreon/core": "^0.24.
|
|
59
|
-
"@pyreon/reactivity": "^0.24.
|
|
60
|
-
"@pyreon/ui-core": "^0.24.
|
|
61
|
-
"@pyreon/unistyle": "^0.24.
|
|
58
|
+
"@pyreon/core": "^0.24.2",
|
|
59
|
+
"@pyreon/reactivity": "^0.24.2",
|
|
60
|
+
"@pyreon/ui-core": "^0.24.2",
|
|
61
|
+
"@pyreon/unistyle": "^0.24.2"
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -46,6 +46,15 @@ export type UseOverlayProps = Partial<{
|
|
|
46
46
|
// Reference counter for nested modals sharing document.body overflow lock.
|
|
47
47
|
let modalOverflowCount = 0
|
|
48
48
|
|
|
49
|
+
// Hoisted: closeOn values that count as "click-driven close". Inlined
|
|
50
|
+
// previously, allocating a fresh 3-element array on each click-listener
|
|
51
|
+
// setupListeners re-run. Ported from vitus-labs `804dd0e2`.
|
|
52
|
+
const CLICK_CLOSE_KINDS: ReadonlySet<string> = new Set([
|
|
53
|
+
'click',
|
|
54
|
+
'clickOnTrigger',
|
|
55
|
+
'clickOutsideContent',
|
|
56
|
+
])
|
|
57
|
+
|
|
49
58
|
const devWarn = (msg: string) => {
|
|
50
59
|
if (!IS_DEVELOPMENT) return
|
|
51
60
|
// oxlint-disable-next-line no-console
|
|
@@ -300,8 +309,7 @@ const useOverlay = ({
|
|
|
300
309
|
const cleanups: (() => void)[] = []
|
|
301
310
|
|
|
302
311
|
// Click-based open/close
|
|
303
|
-
const enabledClick =
|
|
304
|
-
openOn === 'click' || ['click', 'clickOnTrigger', 'clickOutsideContent'].includes(closeOn)
|
|
312
|
+
const enabledClick = openOn === 'click' || CLICK_CLOSE_KINDS.has(closeOn)
|
|
305
313
|
|
|
306
314
|
if (enabledClick) {
|
|
307
315
|
window.addEventListener('click', handleClick)
|
package/src/Text/component.tsx
CHANGED
|
@@ -41,12 +41,11 @@ const Component: PyreonComponent<Props> & {
|
|
|
41
41
|
} = (props) => {
|
|
42
42
|
const [own, rest] = splitProps(props, ['paragraph', 'label', 'children', 'tag', 'css', 'ref'])
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
44
|
+
// `paragraph` shorthand maps to <p>; otherwise pass through `tag`. Ternary
|
|
45
|
+
// form replaces the prior `let finalTag` + if/else block — V8 prefers the
|
|
46
|
+
// single-assignment shape for inline-cache stability. Ported from
|
|
47
|
+
// vitus-labs `804dd0e2`.
|
|
48
|
+
const finalTag = own.paragraph ? 'p' : own.tag
|
|
50
49
|
|
|
51
50
|
return (
|
|
52
51
|
<Styled ref={own.ref} as={finalTag} $text={{ extraStyles: own.css }} {...rest}>
|