@askrjs/askr 0.0.7 → 0.0.8
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/{component-BBGWJdqJ.d.ts → component-DHAn9JxU.d.ts} +1 -1
- package/dist/foundations/index.d.ts +4 -3
- package/dist/foundations/index.js +32 -10
- package/dist/foundations/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +27 -13
- package/dist/index.js.map +1 -1
- package/dist/{jsx-AzPM8gMS.d.ts → jsx-CSWf4VFg.d.ts} +2 -2
- package/dist/jsx-dev-runtime.d.ts +3 -3
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +3 -3
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +3 -3
- package/dist/resources/index.js.map +1 -1
- package/dist/router/index.js +23 -6
- package/dist/router/index.js.map +1 -1
- package/dist/ssr/index.d.ts +1 -1
- package/dist/ssr/index.js +20 -6
- package/dist/ssr/index.js.map +1 -1
- package/dist/{types-uOPfcrdz.d.ts → types-DxdosFWx.d.ts} +1 -1
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { L as LayoutComponent, l as layout } from '../layout-BINPv-nz.js';
|
|
2
|
-
import '../types-
|
|
3
|
-
import { J as JSXElement } from '../jsx-
|
|
4
|
-
import { S as State } from '../component-
|
|
2
|
+
import '../types-DxdosFWx.js';
|
|
3
|
+
import { J as JSXElement } from '../jsx-CSWf4VFg.js';
|
|
4
|
+
import { S as State } from '../component-DHAn9JxU.js';
|
|
5
5
|
|
|
6
6
|
type SlotProps = {
|
|
7
7
|
asChild: true;
|
|
@@ -21,6 +21,7 @@ type SlotProps = {
|
|
|
21
21
|
* 1. asChild Pattern
|
|
22
22
|
* When asChild=true, merges props into the single child element.
|
|
23
23
|
* Child must be a valid JSXElement; non-element children return null.
|
|
24
|
+
* **Slot props override child props** (injection pattern).
|
|
24
25
|
*
|
|
25
26
|
* 2. Fallback Behavior
|
|
26
27
|
* When asChild=false, returns a Fragment (structural no-op).
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// src/foundations/structures/layout.tsx
|
|
2
2
|
function layout(Layout) {
|
|
3
|
-
return (children, props) =>
|
|
3
|
+
return (children, props) => {
|
|
4
|
+
const mergedProps = { ...props, children };
|
|
5
|
+
return Layout(mergedProps);
|
|
6
|
+
};
|
|
4
7
|
}
|
|
5
8
|
|
|
6
9
|
// src/common/jsx.ts
|
|
@@ -100,17 +103,22 @@ function isDefaultPrevented(value) {
|
|
|
100
103
|
return typeof value === "object" && value !== null && "defaultPrevented" in value && value.defaultPrevented === true;
|
|
101
104
|
}
|
|
102
105
|
function composeHandlers(first, second, options) {
|
|
106
|
+
if (!first && !second) {
|
|
107
|
+
return noop;
|
|
108
|
+
}
|
|
109
|
+
if (!first) return second;
|
|
110
|
+
if (!second) return first;
|
|
103
111
|
const checkDefaultPrevented = options?.checkDefaultPrevented !== false;
|
|
104
112
|
return function composed(...args) {
|
|
105
|
-
|
|
106
|
-
if (checkDefaultPrevented) {
|
|
107
|
-
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
113
|
+
first(...args);
|
|
114
|
+
if (checkDefaultPrevented && isDefaultPrevented(args[0])) {
|
|
115
|
+
return;
|
|
110
116
|
}
|
|
111
|
-
|
|
117
|
+
second(...args);
|
|
112
118
|
};
|
|
113
119
|
}
|
|
120
|
+
function noop() {
|
|
121
|
+
}
|
|
114
122
|
|
|
115
123
|
// src/foundations/utilities/mergeProps.ts
|
|
116
124
|
function isEventHandlerKey(key) {
|
|
@@ -982,7 +990,11 @@ function pressable({
|
|
|
982
990
|
props.role = "button";
|
|
983
991
|
props.tabIndex = disabled ? -1 : 0;
|
|
984
992
|
props.onKeyDown = (e) => {
|
|
985
|
-
if (disabled)
|
|
993
|
+
if (disabled) {
|
|
994
|
+
e.preventDefault?.();
|
|
995
|
+
e.stopPropagation?.();
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
986
998
|
if (e.key === "Enter") {
|
|
987
999
|
e.preventDefault?.();
|
|
988
1000
|
onPress?.(e);
|
|
@@ -993,7 +1005,11 @@ function pressable({
|
|
|
993
1005
|
}
|
|
994
1006
|
};
|
|
995
1007
|
props.onKeyUp = (e) => {
|
|
996
|
-
if (disabled)
|
|
1008
|
+
if (disabled) {
|
|
1009
|
+
e.preventDefault?.();
|
|
1010
|
+
e.stopPropagation?.();
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
997
1013
|
if (e.key === " ") {
|
|
998
1014
|
e.preventDefault?.();
|
|
999
1015
|
onPress?.(e);
|
|
@@ -1009,12 +1025,18 @@ function dismissable({ onDismiss, disabled }) {
|
|
|
1009
1025
|
// Prop for the component root to handle Escape
|
|
1010
1026
|
onKeyDown: disabled ? void 0 : (e) => {
|
|
1011
1027
|
if (e.key === "Escape") {
|
|
1028
|
+
e.preventDefault?.();
|
|
1029
|
+
e.stopPropagation?.();
|
|
1012
1030
|
onDismiss?.();
|
|
1013
1031
|
}
|
|
1014
1032
|
},
|
|
1015
1033
|
// Factory: runtime should attach this listener at the appropriate scope.
|
|
1016
1034
|
outsideListener: disabled ? void 0 : (isInside) => (e) => {
|
|
1017
|
-
if (!isInside(e.target))
|
|
1035
|
+
if (!isInside(e.target)) {
|
|
1036
|
+
e.preventDefault?.();
|
|
1037
|
+
e.stopPropagation?.();
|
|
1038
|
+
onDismiss?.();
|
|
1039
|
+
}
|
|
1018
1040
|
}
|
|
1019
1041
|
};
|
|
1020
1042
|
}
|