@hozo/primitives 0.2.0 → 0.4.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/CHANGELOG.md +71 -0
- package/README.md +18 -1
- package/dist/button-host-attributes.d.ts +20 -0
- package/dist/button-host-attributes.d.ts.map +1 -0
- package/dist/button-host-attributes.js +47 -0
- package/dist/button-host-attributes.js.map +1 -0
- package/dist/button-host-props.native.d.ts +8 -0
- package/dist/button-host-props.native.d.ts.map +1 -0
- package/dist/button-host-props.native.js +20 -0
- package/dist/button-host-props.native.js.map +1 -0
- package/dist/foundation.d.ts +27 -6
- package/dist/foundation.d.ts.map +1 -1
- package/dist/foundation.js +72 -19
- package/dist/foundation.js.map +1 -1
- package/dist/foundation.native.d.ts +27 -7
- package/dist/foundation.native.d.ts.map +1 -1
- package/dist/foundation.native.js +18 -3
- package/dist/foundation.native.js.map +1 -1
- package/dist/generated/button-dom-props.d.ts +11 -0
- package/dist/generated/button-dom-props.d.ts.map +1 -0
- package/dist/generated/button-dom-props.js +132 -0
- package/dist/generated/button-dom-props.js.map +1 -0
- package/dist/generated/button-props.d.ts +3 -0
- package/dist/generated/button-props.d.ts.map +1 -0
- package/dist/generated/button-props.js +5 -0
- package/dist/generated/button-props.js.map +1 -0
- package/dist/generated/button-props.native.d.ts +2 -0
- package/dist/generated/button-props.native.d.ts.map +1 -0
- package/dist/generated/button-props.native.js +2 -0
- package/dist/generated/button-props.native.js.map +1 -0
- package/dist/generated/inherited-label.d.ts +2 -0
- package/dist/generated/inherited-label.d.ts.map +1 -0
- package/dist/generated/inherited-label.js +3 -0
- package/dist/generated/inherited-label.js.map +1 -0
- package/dist/generated/inherited-pressable.d.ts +2 -0
- package/dist/generated/inherited-pressable.d.ts.map +1 -0
- package/dist/generated/inherited-pressable.js +3 -0
- package/dist/generated/inherited-pressable.js.map +1 -0
- package/dist/generated/inherited-relative-text.d.ts +2 -0
- package/dist/generated/inherited-relative-text.d.ts.map +1 -0
- package/dist/generated/inherited-relative-text.js +3 -0
- package/dist/generated/inherited-relative-text.js.map +1 -0
- package/dist/generated/inherited-text.d.ts +2 -0
- package/dist/generated/inherited-text.d.ts.map +1 -0
- package/dist/generated/inherited-text.js +3 -0
- package/dist/generated/inherited-text.js.map +1 -0
- package/dist/generated/inherited-view.d.ts +2 -0
- package/dist/generated/inherited-view.d.ts.map +1 -0
- package/dist/generated/inherited-view.js +3 -0
- package/dist/generated/inherited-view.js.map +1 -0
- package/dist/generated/native-disabled.d.ts +2 -0
- package/dist/generated/native-disabled.d.ts.map +1 -0
- package/dist/generated/native-disabled.js +2 -0
- package/dist/generated/native-disabled.js.map +1 -0
- package/dist/generated/text-input-dom-props.d.ts +7 -0
- package/dist/generated/text-input-dom-props.d.ts.map +1 -0
- package/dist/generated/text-input-dom-props.js +130 -0
- package/dist/generated/text-input-dom-props.js.map +1 -0
- package/dist/generated/text-input.native.d.ts +1 -1
- package/dist/generated/text-input.native.d.ts.map +1 -1
- package/dist/generated/text-input.native.js +1 -1
- package/dist/generated/text-input.native.js.map +1 -1
- package/dist/generated/view-dom-props.d.ts +8 -0
- package/dist/generated/view-dom-props.d.ts.map +1 -0
- package/dist/generated/view-dom-props.js +241 -0
- package/dist/generated/view-dom-props.js.map +1 -0
- package/dist/inherited-label.native.d.ts +8 -0
- package/dist/inherited-label.native.d.ts.map +1 -0
- package/dist/inherited-label.native.js +12 -0
- package/dist/inherited-label.native.js.map +1 -0
- package/dist/inherited-pressable.native.d.ts +11 -0
- package/dist/inherited-pressable.native.d.ts.map +1 -0
- package/dist/inherited-pressable.native.js +75 -0
- package/dist/inherited-pressable.native.js.map +1 -0
- package/dist/inherited-relative-text.native.d.ts +13 -0
- package/dist/inherited-relative-text.native.d.ts.map +1 -0
- package/dist/inherited-relative-text.native.js +16 -0
- package/dist/inherited-relative-text.native.js.map +1 -0
- package/dist/inherited-text-scope.d.ts +8 -0
- package/dist/inherited-text-scope.d.ts.map +1 -0
- package/dist/inherited-text-scope.js +10 -0
- package/dist/inherited-text-scope.js.map +1 -0
- package/dist/inherited-text-style.native.d.ts +5 -0
- package/dist/inherited-text-style.native.d.ts.map +1 -0
- package/dist/inherited-text-style.native.js +30 -0
- package/dist/inherited-text-style.native.js.map +1 -0
- package/dist/inherited-text.native.d.ts +5 -0
- package/dist/inherited-text.native.d.ts.map +1 -0
- package/dist/inherited-text.native.js +18 -0
- package/dist/inherited-text.native.js.map +1 -0
- package/dist/inherited-view.native.d.ts +9 -0
- package/dist/inherited-view.native.d.ts.map +1 -0
- package/dist/inherited-view.native.js +17 -0
- package/dist/inherited-view.native.js.map +1 -0
- package/dist/link.d.ts +4 -3
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +9 -1
- package/dist/link.js.map +1 -1
- package/dist/link.native.d.ts +16 -7
- package/dist/link.native.d.ts.map +1 -1
- package/dist/link.native.js +15 -5
- package/dist/link.native.js.map +1 -1
- package/dist/native-disabled.d.ts +13 -0
- package/dist/native-disabled.d.ts.map +1 -0
- package/dist/native-disabled.js +13 -0
- package/dist/native-disabled.js.map +1 -0
- package/dist/presence.native.d.ts.map +1 -1
- package/dist/presence.native.js +1 -1
- package/dist/presence.native.js.map +1 -1
- package/dist/pressable.d.ts +1 -1
- package/dist/pressable.d.ts.map +1 -1
- package/dist/pressable.js +15 -5
- package/dist/pressable.js.map +1 -1
- package/dist/pressable.native.d.ts +10 -1
- package/dist/pressable.native.d.ts.map +1 -1
- package/dist/pressable.native.js +206 -221
- package/dist/pressable.native.js.map +1 -1
- package/dist/runtime-container.native.d.ts +11 -9
- package/dist/runtime-container.native.d.ts.map +1 -1
- package/dist/runtime-container.native.js +8 -6
- package/dist/runtime-container.native.js.map +1 -1
- package/dist/text-color-transition.native.d.ts +12 -0
- package/dist/text-color-transition.native.d.ts.map +1 -0
- package/dist/text-color-transition.native.js +87 -0
- package/dist/text-color-transition.native.js.map +1 -0
- package/dist/text-input-props.native.d.ts +10 -0
- package/dist/text-input-props.native.d.ts.map +1 -0
- package/dist/text-input-props.native.js +15 -0
- package/dist/text-input-props.native.js.map +1 -0
- package/dist/text-input.native.d.ts +19 -0
- package/dist/text-input.native.d.ts.map +1 -0
- package/dist/text-input.native.js +32 -0
- package/dist/text-input.native.js.map +1 -0
- package/dist/view.d.ts +1 -285
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js +5 -4
- package/dist/view.js.map +1 -1
- package/package.json +51 -7
- package/src/button-host-attributes.ts +56 -0
- package/src/button-host-props.native.ts +22 -0
- package/src/foundation.native.tsx +45 -6
- package/src/foundation.tsx +139 -28
- package/src/generated/button-dom-props.ts +127 -0
- package/src/generated/button-props.native.ts +1 -0
- package/src/generated/button-props.ts +4 -0
- package/src/generated/inherited-label.ts +2 -0
- package/src/generated/inherited-pressable.ts +2 -0
- package/src/generated/inherited-relative-text.ts +2 -0
- package/src/generated/inherited-text.ts +2 -0
- package/src/generated/inherited-view.ts +2 -0
- package/src/generated/native-disabled.ts +1 -0
- package/src/generated/text-input-dom-props.ts +128 -0
- package/src/generated/text-input.native.ts +1 -4
- package/src/generated/view-dom-props.ts +267 -0
- package/src/inherited-label.native.tsx +28 -0
- package/src/inherited-pressable.native.tsx +152 -0
- package/src/inherited-relative-text.native.tsx +22 -0
- package/src/inherited-text-scope.tsx +27 -0
- package/src/inherited-text-style.native.ts +35 -0
- package/src/inherited-text.native.tsx +32 -0
- package/src/inherited-view.native.tsx +37 -0
- package/src/link.native.tsx +43 -28
- package/src/link.ts +12 -0
- package/src/native-disabled.ts +23 -0
- package/src/presence.native.tsx +1 -1
- package/src/pressable.native.tsx +298 -262
- package/src/pressable.ts +34 -17
- package/src/runtime-container.native.tsx +30 -15
- package/src/text-color-transition.native.ts +96 -0
- package/src/text-input-props.native.ts +26 -0
- package/src/text-input.native.tsx +57 -0
- package/src/view.ts +34 -25
- package/dist/generated/animated.d.ts +0 -2
- package/dist/generated/animated.d.ts.map +0 -1
- package/dist/generated/animated.js +0 -3
- package/dist/generated/animated.js.map +0 -1
- package/dist/presence-context.d.ts +0 -15
- package/dist/presence-context.d.ts.map +0 -1
- package/dist/presence-context.js +0 -11
- package/dist/presence-context.js.map +0 -1
- package/dist/runtime-transition.native.d.ts +0 -30
- package/dist/runtime-transition.native.d.ts.map +0 -1
- package/dist/runtime-transition.native.js +0 -183
- package/dist/runtime-transition.native.js.map +0 -1
- package/src/generated/animated.ts +0 -6
- package/src/presence-context.ts +0 -27
- package/src/runtime-transition.native.tsx +0 -244
|
@@ -2,9 +2,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { hozoTextChildren } from '@hozo/behaviors';
|
|
3
3
|
import { HozoTextSizeContext } from '@hozo/engine';
|
|
4
4
|
import React, {} from 'react';
|
|
5
|
-
import { Pressable as RNPressable, Text as RNText, StyleSheet, } from 'react-native';
|
|
5
|
+
import { Pressable as RNPressable, Text as RNText, TextInput as RNTextInput, StyleSheet, } from 'react-native';
|
|
6
|
+
import { BUTTON_TRIGGER_PROPS_NATIVE, buttonDataProps, buttonTriggerProps, } from './button-host-attributes.js';
|
|
7
|
+
import { hozoButtonProps } from './button-host-props.native.js';
|
|
6
8
|
import { HozoLink } from './link.native.js';
|
|
7
|
-
|
|
9
|
+
import { nativeDisabledProps } from './native-disabled.js';
|
|
10
|
+
import { nativeTextInputProps } from './text-input-props.native.js';
|
|
11
|
+
export { Image, View } from 'react-native';
|
|
12
|
+
/** The canonical disabled contract also applies outside compiler-owned JSX. */
|
|
13
|
+
export function TextInput({ ref, ...props }) {
|
|
14
|
+
return _jsx(RNTextInput, { ...nativeTextInputProps(props), ref: ref });
|
|
15
|
+
}
|
|
8
16
|
export function Text({ children, style, ...props }) {
|
|
9
17
|
const size = StyleSheet.flatten(style)?.fontSize;
|
|
10
18
|
const text = React.createElement(RNText, { style, ...props }, children);
|
|
@@ -13,6 +21,7 @@ export function Text({ children, style, ...props }) {
|
|
|
13
21
|
return _jsx(HozoTextSizeContext.Provider, { value: size, children: text });
|
|
14
22
|
}
|
|
15
23
|
export function Pressable({ href, external, replace, prefetch, target: _target, rel: _rel, download: _download, ...props }) {
|
|
24
|
+
props = nativeDisabledProps(props);
|
|
16
25
|
if (href === undefined)
|
|
17
26
|
return _jsx(RNPressable, { ...props });
|
|
18
27
|
const Link = HozoLink;
|
|
@@ -22,14 +31,17 @@ export function Link({ href, external, replace, prefetch, target: _target, rel:
|
|
|
22
31
|
const NativeLink = HozoLink;
|
|
23
32
|
return (_jsx(NativeLink, { href: href, external: external, replace: replace, prefetch: prefetch, ...props }));
|
|
24
33
|
}
|
|
25
|
-
export function Button({ children, onPress, disabled, accessibilityLabel, accessibilityHint, href, external, replace, prefetch, style, testID, }) {
|
|
34
|
+
export function Button({ children, onPress, disabled, accessibilityLabel, accessibilityHint, href, external, replace, prefetch, style, testID, nativeID, ...metadata }) {
|
|
26
35
|
const shared = {
|
|
36
|
+
...hozoButtonProps(buttonDataProps(metadata)),
|
|
37
|
+
...buttonTriggerProps(metadata, BUTTON_TRIGGER_PROPS_NATIVE),
|
|
27
38
|
disabled,
|
|
28
39
|
accessibilityLabel,
|
|
29
40
|
accessibilityHint,
|
|
30
41
|
accessibilityState: disabled === undefined ? undefined : { disabled },
|
|
31
42
|
style,
|
|
32
43
|
testID,
|
|
44
|
+
nativeID,
|
|
33
45
|
};
|
|
34
46
|
if (href !== undefined) {
|
|
35
47
|
const NativeLink = HozoLink;
|
|
@@ -37,4 +49,7 @@ export function Button({ children, onPress, disabled, accessibilityLabel, access
|
|
|
37
49
|
}
|
|
38
50
|
return (_jsx(RNPressable, { accessibilityRole: "button", onPress: onPress, ...shared, children: hozoTextChildren(children) }));
|
|
39
51
|
}
|
|
52
|
+
// A label a pressable can hand its text styles to (#876); see `hozoTextStyle`.
|
|
53
|
+
;
|
|
54
|
+
Text.hozoLabelText = true;
|
|
40
55
|
//# sourceMappingURL=foundation.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foundation.native.js","sourceRoot":"","sources":["../src/foundation.native.tsx"],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AAQ,EACR,OAAO,EACP,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACR,GAAG,QAAQ,EACC;IACZ,MAAM,MAAM,GAAG;QACb,GAAG,eAAe,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC7C,GAAG,kBAAkB,CAAC,QAAQ,EAAE,2BAA2B,CAAC;QAC5D,QAAQ;QACR,kBAAkB;QAClB,iBAAiB;QACjB,kBAAkB,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE;QACrE,KAAK;QACL,MAAM;QACN,QAAQ;KACT,CAAA;IACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,QAElB,CAAA;QACD,OAAO,CACL,KAAC,UAAU,IACT,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,KACZ,MAAM,YAET,QAAQ,GACE,CACd,CAAA;IACH,CAAC;IACD,OAAO,CACL,KAAC,WAAW,IAAC,iBAAiB,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,KAAM,MAAM,YACjE,gBAAgB,CAAC,QAAQ,CAAC,GACf,CACf,CAAA;AACH,CAAC;AACD,+EAA+E;AAC/E,CAAC;AAAC,IAAoC,CAAC,aAAa,GAAG,IAAI,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** A Button's spread onto the `<button>` the compiler chose. */
|
|
2
|
+
export declare function hozoButtonDomProps<T>(props: T): T;
|
|
3
|
+
/**
|
|
4
|
+
* A Button's spread onto the `<a>` the compiler chose because it was given
|
|
5
|
+
* an `href`. An anchor has no disabled state, so a press is suppressed
|
|
6
|
+
* while disabled, as the compiler does for a named `onPress`. `disabled` is
|
|
7
|
+
* the one the compiler saw named on the element, if any; one inside the
|
|
8
|
+
* spread counts too.
|
|
9
|
+
*/
|
|
10
|
+
export declare function hozoLinkDomProps<T>(props: T, disabled?: unknown): T;
|
|
11
|
+
//# sourceMappingURL=button-dom-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-dom-props.d.ts","sourceRoot":"","sources":["../../src/generated/button-dom-props.ts"],"names":[],"mappings":"AA2DA,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAsBjD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAmCnE"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// What a Button's spread means on the Web, once the compiler has decided
|
|
2
|
+
// the element (#1096).
|
|
3
|
+
//
|
|
4
|
+
// `function B({ href, ...rest }) { return <Button {...rest} /> }` lowers to
|
|
5
|
+
// a `<button>` at build time (#656), but `rest` still holds the props in the
|
|
6
|
+
// primitive's vocabulary -- `onPress`, `accessibilityLabel` -- and spread raw
|
|
7
|
+
// onto the DOM they are unknown attributes. The click handler was the one
|
|
8
|
+
// that showed: an `@hozo/ui` Button that did nothing when clicked.
|
|
9
|
+
//
|
|
10
|
+
// So the spread goes through the same translation the uncompiled `Button`
|
|
11
|
+
// applies to its named props, and drops what that `Button` drops. Keys the
|
|
12
|
+
// spread does not hold are not set, because explicit attributes the
|
|
13
|
+
// compiler wrote before the spread must survive it.
|
|
14
|
+
import { hozoDomStyle } from '@hozo/engine';
|
|
15
|
+
const prevent = (event) => event.preventDefault();
|
|
16
|
+
function common(props, out, name, value) {
|
|
17
|
+
switch (name) {
|
|
18
|
+
case 'accessibilityLabel':
|
|
19
|
+
out['aria-label'] = value;
|
|
20
|
+
return true;
|
|
21
|
+
case 'accessibilityHint':
|
|
22
|
+
out['aria-description'] = value;
|
|
23
|
+
return true;
|
|
24
|
+
case 'testID':
|
|
25
|
+
out['data-testid'] = value;
|
|
26
|
+
return true;
|
|
27
|
+
case 'nativeID':
|
|
28
|
+
out.id = value;
|
|
29
|
+
return true;
|
|
30
|
+
case 'className':
|
|
31
|
+
case 'children':
|
|
32
|
+
// What a wrapper writes to make the Button a trigger: `Tooltip` clones
|
|
33
|
+
// its child with these (#1137). The uncompiled Button forwards the same
|
|
34
|
+
// list, `BUTTON_TRIGGER_PROPS_WEB`.
|
|
35
|
+
case 'ref':
|
|
36
|
+
case 'onFocus':
|
|
37
|
+
case 'onBlur':
|
|
38
|
+
case 'onKeyDown':
|
|
39
|
+
case 'onPointerEnter':
|
|
40
|
+
case 'onPointerLeave':
|
|
41
|
+
case 'aria-describedby':
|
|
42
|
+
out[name] = value;
|
|
43
|
+
return true;
|
|
44
|
+
case 'style':
|
|
45
|
+
out.style = hozoDomStyle(value);
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (name.startsWith('data-')) {
|
|
49
|
+
out[name] = props[name];
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
/** A Button's spread onto the `<button>` the compiler chose. */
|
|
55
|
+
export function hozoButtonDomProps(props) {
|
|
56
|
+
if (!props || typeof props !== 'object')
|
|
57
|
+
return props;
|
|
58
|
+
const source = props;
|
|
59
|
+
const out = {};
|
|
60
|
+
for (const name in source) {
|
|
61
|
+
if (!Object.hasOwn(source, name))
|
|
62
|
+
continue;
|
|
63
|
+
const value = source[name];
|
|
64
|
+
if (common(source, out, name, value))
|
|
65
|
+
continue;
|
|
66
|
+
if (name === 'tabIndex') {
|
|
67
|
+
// A roving tab stop, as `Toolbar` hands its items (BUTTON_TRIGGER_PROPS_WEB).
|
|
68
|
+
out.tabIndex = value;
|
|
69
|
+
}
|
|
70
|
+
else if (name === 'onPress') {
|
|
71
|
+
out.onClick = value;
|
|
72
|
+
if (value)
|
|
73
|
+
out['data-hozo-pressable'] = '';
|
|
74
|
+
}
|
|
75
|
+
else if (name === 'disabled') {
|
|
76
|
+
out.disabled = value;
|
|
77
|
+
out['data-hozo-disabled'] = value ? '' : undefined;
|
|
78
|
+
}
|
|
79
|
+
// Anything else -- link-only props with no href, unknown keys -- the
|
|
80
|
+
// uncompiled Button does not forward either.
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A Button's spread onto the `<a>` the compiler chose because it was given
|
|
86
|
+
* an `href`. An anchor has no disabled state, so a press is suppressed
|
|
87
|
+
* while disabled, as the compiler does for a named `onPress`. `disabled` is
|
|
88
|
+
* the one the compiler saw named on the element, if any; one inside the
|
|
89
|
+
* spread counts too.
|
|
90
|
+
*/
|
|
91
|
+
export function hozoLinkDomProps(props, disabled) {
|
|
92
|
+
if (!props || typeof props !== 'object')
|
|
93
|
+
return props;
|
|
94
|
+
const source = props;
|
|
95
|
+
const off = Boolean(disabled ?? source.disabled);
|
|
96
|
+
const out = {};
|
|
97
|
+
for (const name in source) {
|
|
98
|
+
if (!Object.hasOwn(source, name))
|
|
99
|
+
continue;
|
|
100
|
+
const value = source[name];
|
|
101
|
+
if (common(source, out, name, value))
|
|
102
|
+
continue;
|
|
103
|
+
switch (name) {
|
|
104
|
+
case 'onPress':
|
|
105
|
+
out.onClick = off ? prevent : value;
|
|
106
|
+
break;
|
|
107
|
+
case 'tabIndex':
|
|
108
|
+
// A roving tab stop, but never one while disabled.
|
|
109
|
+
out.tabIndex = off ? -1 : value;
|
|
110
|
+
break;
|
|
111
|
+
case 'disabled':
|
|
112
|
+
out['aria-disabled'] = value ? true : undefined;
|
|
113
|
+
out['data-hozo-disabled'] = value ? '' : undefined;
|
|
114
|
+
if (value)
|
|
115
|
+
out.tabIndex = -1;
|
|
116
|
+
else if (!Object.hasOwn(source, 'tabIndex'))
|
|
117
|
+
out.tabIndex = undefined;
|
|
118
|
+
if (value) {
|
|
119
|
+
out.onClick ??= prevent;
|
|
120
|
+
out.onAuxClick = prevent;
|
|
121
|
+
}
|
|
122
|
+
break;
|
|
123
|
+
case 'target':
|
|
124
|
+
case 'rel':
|
|
125
|
+
case 'download':
|
|
126
|
+
out[name] = value;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=button-dom-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-dom-props.js","sourceRoot":"","sources":["../../src/generated/button-dom-props.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,uBAAuB;AACvB,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,8EAA8E;AAC9E,0EAA0E;AAC1E,mEAAmE;AACnE,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,oEAAoE;AACpE,oDAAoD;AAEpD,OAAO,EAAqB,YAAY,EAAE,MAAM,cAAc,CAAA;AAI9D,MAAM,OAAO,GAAG,CAAC,KAAiC,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,CAAA;AAE7E,SAAS,MAAM,CAAC,KAAY,EAAE,GAAU,EAAE,IAAY,EAAE,KAAc;IACpE,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,oBAAoB;YACvB,GAAG,CAAC,YAAY,CAAC,GAAG,KAAK,CAAA;YACzB,OAAO,IAAI,CAAA;QACb,KAAK,mBAAmB;YACtB,GAAG,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAA;YAC/B,OAAO,IAAI,CAAA;QACb,KAAK,QAAQ;YACX,GAAG,CAAC,aAAa,CAAC,GAAG,KAAK,CAAA;YAC1B,OAAO,IAAI,CAAA;QACb,KAAK,UAAU;YACb,GAAG,CAAC,EAAE,GAAG,KAAK,CAAA;YACd,OAAO,IAAI,CAAA;QACb,KAAK,WAAW,CAAC;QACjB,KAAK,UAAU,CAAC;QAChB,uEAAuE;QACvE,wEAAwE;QACxE,oCAAoC;QACpC,KAAK,KAAK,CAAC;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,eAAe,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;gBAC/C,GAAG,CAAC,oBAAoB,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;gBAClD,IAAI,KAAK;oBAAE,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAA;qBACvB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;oBAAE,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAA;gBACrE,IAAI,KAAK,EAAE,CAAC;oBACV,GAAG,CAAC,OAAO,KAAK,OAAO,CAAA;oBACvB,GAAG,CAAC,UAAU,GAAG,OAAO,CAAA;gBAC1B,CAAC;gBACD,MAAK;YACP,KAAK,QAAQ,CAAC;YACd,KAAK,KAAK,CAAC;YACX,KAAK,UAAU;gBACb,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;gBACjB,MAAK;QACT,CAAC;IACH,CAAC;IACD,OAAO,GAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-props.d.ts","sourceRoot":"","sources":["../../src/generated/button-props.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-props.js","sourceRoot":"","sources":["../../src/generated/button-props.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,UAAU,eAAe,CAAI,KAAQ;IACzC,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-props.native.d.ts","sourceRoot":"","sources":["../../src/generated/button-props.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-props.native.js","sourceRoot":"","sources":["../../src/generated/button-props.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-label.d.ts","sourceRoot":"","sources":["../../src/generated/inherited-label.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-label.js","sourceRoot":"","sources":["../../src/generated/inherited-label.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA+B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-pressable.d.ts","sourceRoot":"","sources":["../../src/generated/inherited-pressable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-pressable.js","sourceRoot":"","sources":["../../src/generated/inherited-pressable.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAmC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-relative-text.d.ts","sourceRoot":"","sources":["../../src/generated/inherited-relative-text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-relative-text.js","sourceRoot":"","sources":["../../src/generated/inherited-relative-text.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAuC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-text.d.ts","sourceRoot":"","sources":["../../src/generated/inherited-text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-text.js","sourceRoot":"","sources":["../../src/generated/inherited-text.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA8B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-view.d.ts","sourceRoot":"","sources":["../../src/generated/inherited-view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inherited-view.js","sourceRoot":"","sources":["../../src/generated/inherited-view.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA8B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-disabled.d.ts","sourceRoot":"","sources":["../../src/generated/native-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-disabled.js","sourceRoot":"","sources":["../../src/generated/native-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A TextInput's spread onto the element the compiler chose. `multiline` is
|
|
3
|
+
* whether that element is a `<textarea>`, which the compiler knows and the
|
|
4
|
+
* spread may not say.
|
|
5
|
+
*/
|
|
6
|
+
export declare function hozoTextInputDomProps<T>(props: T, multiline?: boolean): T;
|
|
7
|
+
//# sourceMappingURL=text-input-dom-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-input-dom-props.d.ts","sourceRoot":"","sources":["../../src/generated/text-input-dom-props.ts"],"names":[],"mappings":"AA8DA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,UAAQ,GAAG,CAAC,CA4DvE"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// What a TextInput's spread means on the Web, once the compiler has lowered
|
|
2
|
+
// it to an `<input>` or a `<textarea>` (#1118).
|
|
3
|
+
//
|
|
4
|
+
// `function Field(props) { return <TextInput {...props} /> }` lowers at build
|
|
5
|
+
// time, but `props` still holds the primitive's vocabulary -- `onChangeText`,
|
|
6
|
+
// `editable`, `keyboardType` -- and spread raw onto the DOM those are unknown
|
|
7
|
+
// attributes. `onChangeText` was the one that showed: a controlled
|
|
8
|
+
// `@hozo/ui` Input that React reset on every keystroke, because nothing ever
|
|
9
|
+
// called the handler. #1096 was the same bug for Button.
|
|
10
|
+
//
|
|
11
|
+
// So the spread goes through the translation the uncompiled `HozoTextInput`
|
|
12
|
+
// applies to its named props. Unlike Button, everything the translation does
|
|
13
|
+
// not name passes through, as it does there: `placeholder`, `maxLength`,
|
|
14
|
+
// `onFocus` and the rest are already DOM props. Keys the spread does not
|
|
15
|
+
// hold are not set, because explicit attributes the compiler wrote before
|
|
16
|
+
// the spread must survive it.
|
|
17
|
+
import { hozoDomStyle } from '@hozo/engine';
|
|
18
|
+
const INPUT_MODES = {
|
|
19
|
+
'number-pad': 'numeric',
|
|
20
|
+
numeric: 'numeric',
|
|
21
|
+
'decimal-pad': 'decimal',
|
|
22
|
+
'email-address': 'email',
|
|
23
|
+
'phone-pad': 'tel',
|
|
24
|
+
url: 'url',
|
|
25
|
+
'web-search': 'search',
|
|
26
|
+
};
|
|
27
|
+
// React Native props with no DOM meaning, and the ones folded into another
|
|
28
|
+
// attribute below. The uncompiled TextInput drops them too.
|
|
29
|
+
const CONSUMED = new Set([
|
|
30
|
+
'accessibilityHint',
|
|
31
|
+
'accessibilityLabel',
|
|
32
|
+
'accessibilityLabelledBy',
|
|
33
|
+
'autoCorrect',
|
|
34
|
+
'blurOnSubmit',
|
|
35
|
+
'cursorColor',
|
|
36
|
+
'editable',
|
|
37
|
+
'hitSlop',
|
|
38
|
+
'keyboardAppearance',
|
|
39
|
+
'keyboardType',
|
|
40
|
+
'multiline',
|
|
41
|
+
'nativeID',
|
|
42
|
+
'numberOfLines',
|
|
43
|
+
'onChange',
|
|
44
|
+
'onChangeText',
|
|
45
|
+
'onKeyPress',
|
|
46
|
+
'onSubmitEditing',
|
|
47
|
+
'placeholderTextColor',
|
|
48
|
+
'returnKeyType',
|
|
49
|
+
'secureTextEntry',
|
|
50
|
+
'selectionColor',
|
|
51
|
+
'style',
|
|
52
|
+
'testID',
|
|
53
|
+
]);
|
|
54
|
+
/**
|
|
55
|
+
* A TextInput's spread onto the element the compiler chose. `multiline` is
|
|
56
|
+
* whether that element is a `<textarea>`, which the compiler knows and the
|
|
57
|
+
* spread may not say.
|
|
58
|
+
*/
|
|
59
|
+
export function hozoTextInputDomProps(props, multiline = false) {
|
|
60
|
+
if (!props || typeof props !== 'object')
|
|
61
|
+
return props;
|
|
62
|
+
const source = props;
|
|
63
|
+
const has = (name) => Object.hasOwn(source, name);
|
|
64
|
+
const out = {};
|
|
65
|
+
for (const name in source) {
|
|
66
|
+
if (has(name) && !CONSUMED.has(name))
|
|
67
|
+
out[name] = source[name];
|
|
68
|
+
}
|
|
69
|
+
if (has('accessibilityLabel'))
|
|
70
|
+
out['aria-label'] = source.accessibilityLabel;
|
|
71
|
+
if (has('accessibilityHint'))
|
|
72
|
+
out['aria-description'] = source.accessibilityHint;
|
|
73
|
+
if (has('accessibilityLabelledBy'))
|
|
74
|
+
out['aria-labelledby'] = source.accessibilityLabelledBy;
|
|
75
|
+
if (has('testID'))
|
|
76
|
+
out['data-testid'] = source.testID;
|
|
77
|
+
if (has('nativeID'))
|
|
78
|
+
out.id = source.nativeID;
|
|
79
|
+
if (has('onChange') || has('onChangeText')) {
|
|
80
|
+
const onChange = source.onChange;
|
|
81
|
+
const onChangeText = source.onChangeText;
|
|
82
|
+
out.onChange = (event) => {
|
|
83
|
+
onChange?.(event);
|
|
84
|
+
onChangeText?.(event.currentTarget.value);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
if (has('onKeyPress') || has('onSubmitEditing')) {
|
|
88
|
+
const onKeyPress = source.onKeyPress;
|
|
89
|
+
const onSubmitEditing = source.onSubmitEditing;
|
|
90
|
+
const blurOnSubmit = Boolean(source.blurOnSubmit);
|
|
91
|
+
out.onKeyDown = (event) => {
|
|
92
|
+
onKeyPress?.(event);
|
|
93
|
+
if (event.key !== 'Enter' || !onSubmitEditing)
|
|
94
|
+
return;
|
|
95
|
+
if (!multiline || blurOnSubmit) {
|
|
96
|
+
onSubmitEditing({ nativeEvent: { text: event.currentTarget.value } });
|
|
97
|
+
if (blurOnSubmit)
|
|
98
|
+
event.currentTarget.blur();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (has('readOnly'))
|
|
103
|
+
out.readOnly = source.readOnly;
|
|
104
|
+
else if (has('editable') && source.editable !== undefined)
|
|
105
|
+
out.readOnly = !source.editable;
|
|
106
|
+
if (has('autoCorrect') && source.autoCorrect !== undefined) {
|
|
107
|
+
out.autoCorrect = source.autoCorrect ? 'on' : 'off';
|
|
108
|
+
}
|
|
109
|
+
if (!has('inputMode') && has('keyboardType')) {
|
|
110
|
+
out.inputMode = INPUT_MODES[source.keyboardType];
|
|
111
|
+
}
|
|
112
|
+
if (has('returnKeyType'))
|
|
113
|
+
out.enterKeyHint = source.returnKeyType;
|
|
114
|
+
if (multiline) {
|
|
115
|
+
if (has('numberOfLines'))
|
|
116
|
+
out.rows = source.numberOfLines;
|
|
117
|
+
}
|
|
118
|
+
else if (has('secureTextEntry') && source.secureTextEntry) {
|
|
119
|
+
out.type = 'password';
|
|
120
|
+
}
|
|
121
|
+
const caret = source.cursorColor ?? source.selectionColor;
|
|
122
|
+
if (has('style') || caret) {
|
|
123
|
+
out.style = hozoDomStyle([
|
|
124
|
+
source.style,
|
|
125
|
+
caret ? { caretColor: caret } : undefined,
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
return out;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=text-input-dom-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-input-dom-props.js","sourceRoot":"","sources":["../../src/generated/text-input-dom-props.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gDAAgD;AAChD,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,mEAAmE;AACnE,6EAA6E;AAC7E,yDAAyD;AACzD,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAC1E,8BAA8B;AAE9B,OAAO,EAAqB,YAAY,EAAE,MAAM,cAAc,CAAA;AAO9D,MAAM,WAAW,GAA2B;IAC1C,YAAY,EAAE,SAAS;IACvB,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,SAAS;IACxB,eAAe,EAAE,OAAO;IACxB,WAAW,EAAE,KAAK;IAClB,GAAG,EAAE,KAAK;IACV,YAAY,EAAE,QAAQ;CACvB,CAAA;AAED,2EAA2E;AAC3E,4DAA4D;AAC5D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,mBAAmB;IACnB,oBAAoB;IACpB,yBAAyB;IACzB,aAAa;IACb,cAAc;IACd,aAAa;IACb,UAAU;IACV,SAAS;IACT,oBAAoB;IACpB,cAAc;IACd,WAAW;IACX,UAAU;IACV,eAAe;IACf,UAAU;IACV,cAAc;IACd,YAAY;IACZ,iBAAiB;IACjB,sBAAsB;IACtB,eAAe;IACf,iBAAiB;IAC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S,EAAE,CAAC;QAC3D,GAAG,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;IACrD,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;QAC7C,GAAG,CAAC,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,YAAsB,CAAC,CAAA;IAC5D,CAAC;IACD,IAAI,GAAG,CAAC,eAAe,CAAC;QAAE,GAAG,CAAC,YAAY,GAAG,MAAM,CAAC,aAAa,CAAA;IACjE,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,GAAG,CAAC,eAAe,CAAC;YAAE,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,aAAa,CAAA;IAC3D,CAAC;SAAM,IAAI,GAAG,CAAC,iBAAiB,CAAC,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAC5D,GAAG,CAAC,IAAI,GAAG,UAAU,CAAA;IACvB,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,cAAc,CAAA;IACzD,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,EAAE,CAAC;QAC1B,GAAG,CAAC,KAAK,GAAG,YAAY,CAAC;YACvB,MAAM,CAAC,KAAqB;YAC5B,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAe,EAAE,CAAC,CAAC,CAAC,SAAS;SACpD,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,GAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { HozoTextInput, type HozoTextInputProps } from '../text-input.native.tsx';
|
|
2
2
|
//# sourceMappingURL=text-input.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.native.d.ts","sourceRoot":"","sources":["../../src/generated/text-input.native.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"text-input.native.d.ts","sourceRoot":"","sources":["../../src/generated/text-input.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { HozoTextInput } from '../text-input.native.js';
|
|
2
2
|
//# sourceMappingURL=text-input.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.native.js","sourceRoot":"","sources":["../../src/generated/text-input.native.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"text-input.native.js","sourceRoot":"","sources":["../../src/generated/text-input.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA2B,MAAM,yBAA0B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A View's, Text's or document primitive's spread onto its element. */
|
|
2
|
+
export declare function hozoViewDomProps<T>(props: T): T;
|
|
3
|
+
/**
|
|
4
|
+
* An Image's spread onto its `<img>`. `src` may be an object or a list of
|
|
5
|
+
* them, and an accessibility label is the image's `alt`, as it is uncompiled.
|
|
6
|
+
*/
|
|
7
|
+
export declare function hozoImageDomProps<T>(props: T): T;
|
|
8
|
+
//# sourceMappingURL=view-dom-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-dom-props.d.ts","sourceRoot":"","sources":["../../src/generated/view-dom-props.ts"],"names":[],"mappings":"AAkNA,wEAAwE;AACxE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAG/C;AAwBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAwBhD"}
|