@expo/html-elements 0.0.0 → 0.0.1-canary-20231125-d600e44
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 +61 -0
- package/README.md +124 -53
- package/babel/__tests__/__snapshots__/transform.test.js.snap +55 -0
- package/babel/__tests__/fixtures/one.js +29 -0
- package/babel/__tests__/transform.test.js +96 -0
- package/babel/jest.config.js +12 -0
- package/babel.js +37 -3
- package/build/Elements.d.ts +1 -0
- package/build/Elements.d.ts.map +1 -0
- package/build/css/createSafeStyledView.d.ts +2 -0
- package/build/css/createSafeStyledView.d.ts.map +1 -0
- package/build/css/createSafeStyledView.js +5 -0
- package/build/css/createSafeStyledView.js.map +1 -0
- package/build/css/createSafeStyledView.native.d.ts +3 -0
- package/build/css/createSafeStyledView.native.d.ts.map +1 -0
- package/build/css/createSafeStyledView.native.js +10 -0
- package/build/css/createSafeStyledView.native.js.map +1 -0
- package/build/css/filterStyles.d.ts +2 -0
- package/build/css/filterStyles.d.ts.map +1 -0
- package/build/css/filterStyles.js +83 -0
- package/build/css/filterStyles.js.map +1 -0
- package/build/css/units.d.ts +1 -0
- package/build/css/units.d.ts.map +1 -0
- package/build/elements/Anchor.d.ts +3 -4
- package/build/elements/Anchor.d.ts.map +1 -0
- package/build/elements/Anchor.js +8 -4
- package/build/elements/Anchor.js.map +1 -1
- package/build/elements/Headings.d.ts +1 -0
- package/build/elements/Headings.d.ts.map +1 -0
- package/build/elements/Headings.js +26 -3
- package/build/elements/Headings.js.map +1 -1
- package/build/elements/Layout.d.ts +2 -0
- package/build/elements/Layout.d.ts.map +1 -0
- package/build/elements/Layout.js +9 -8
- package/build/elements/Layout.js.map +1 -1
- package/build/elements/Lists.d.ts +4 -1
- package/build/elements/Lists.d.ts.map +1 -0
- package/build/elements/Lists.js +8 -8
- package/build/elements/Lists.js.map +1 -1
- package/build/elements/Rules.d.ts +1 -0
- package/build/elements/Rules.d.ts.map +1 -0
- package/build/elements/Rules.js +1 -1
- package/build/elements/Rules.js.map +1 -1
- package/build/elements/Rules.web.d.ts +1 -0
- package/build/elements/Rules.web.d.ts.map +1 -0
- package/build/elements/Table.d.ts +1 -0
- package/build/elements/Table.d.ts.map +1 -0
- package/build/elements/Table.js +8 -8
- package/build/elements/Table.js.map +1 -1
- package/build/elements/Table.web.d.ts +10 -11
- package/build/elements/Table.web.d.ts.map +1 -0
- package/build/elements/Table.web.js +25 -33
- package/build/elements/Table.web.js.map +1 -1
- package/build/elements/Text.d.ts +7 -10
- package/build/elements/Text.d.ts.map +1 -0
- package/build/elements/Text.js +20 -16
- package/build/elements/Text.js.map +1 -1
- package/build/elements/Text.types.d.ts +9 -4
- package/build/elements/Text.types.d.ts.map +1 -0
- package/build/elements/Text.types.js +1 -0
- package/build/elements/Text.types.js.map +1 -1
- package/build/primitives/Image.d.ts +22 -0
- package/build/primitives/Image.d.ts.map +1 -0
- package/build/primitives/Image.js +5 -0
- package/build/primitives/Image.js.map +1 -0
- package/build/primitives/RNWView.d.ts +17 -0
- package/build/primitives/RNWView.d.ts.map +1 -0
- package/build/primitives/RNWView.js +118 -0
- package/build/primitives/RNWView.js.map +1 -0
- package/build/primitives/Table.d.ts +3 -2
- package/build/primitives/Table.d.ts.map +1 -0
- package/build/primitives/Text.d.ts +31 -8
- package/build/primitives/Text.d.ts.map +1 -0
- package/build/primitives/Text.js +3 -2
- package/build/primitives/Text.js.map +1 -1
- package/build/primitives/View.d.ts +11 -9
- package/build/primitives/View.d.ts.map +1 -0
- package/build/primitives/View.js +9 -3
- package/build/primitives/View.js.map +1 -1
- package/build/primitives/createDevView.d.ts +4 -0
- package/build/primitives/createDevView.d.ts.map +1 -0
- package/build/primitives/createDevView.js +41 -0
- package/build/primitives/createDevView.js.map +1 -0
- package/expo-html-elements-0.0.1-canary-20231125-d600e44.tgz +0 -0
- package/package.json +27 -9
- package/build/elements/_Text.web.d.ts +0 -23
- package/build/elements/_Text.web.js +0 -63
- package/build/elements/_Text.web.js.map +0 -1
package/babel.js
CHANGED
|
@@ -7,6 +7,7 @@ const elementToComponent = {
|
|
|
7
7
|
br: 'BR',
|
|
8
8
|
caption: 'Caption',
|
|
9
9
|
code: 'Code',
|
|
10
|
+
div: 'Div',
|
|
10
11
|
footer: 'Footer',
|
|
11
12
|
h1: 'H1',
|
|
12
13
|
h2: 'H2',
|
|
@@ -36,14 +37,39 @@ const elementToComponent = {
|
|
|
36
37
|
tr: 'TR',
|
|
37
38
|
ul: 'UL',
|
|
38
39
|
strong: 'Strong',
|
|
40
|
+
span: 'Span',
|
|
39
41
|
aside: 'Aside',
|
|
40
42
|
tfoot: 'TFoot',
|
|
43
|
+
blockquote: 'BlockQuote',
|
|
44
|
+
q: 'Q',
|
|
45
|
+
|
|
46
|
+
html: 'Div',
|
|
47
|
+
body: 'Div',
|
|
48
|
+
|
|
49
|
+
// TODO: img
|
|
50
|
+
// NOTE: head, meta, link should use some special component in the future.
|
|
41
51
|
};
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
function getPlatform(caller) {
|
|
54
|
+
return caller && caller.platform;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = ({ types: t, ...api }, { expo }) => {
|
|
58
|
+
const platform = api.caller(getPlatform);
|
|
59
|
+
|
|
44
60
|
function replaceElement(path, state) {
|
|
61
|
+
// Not supported in node modules
|
|
62
|
+
if (/\/node_modules\//.test(state.filename)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
45
66
|
const { name } = path.node.openingElement.name;
|
|
46
67
|
|
|
68
|
+
if (platform === 'web') {
|
|
69
|
+
if (['html', 'body'].includes(name)) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
47
73
|
// Replace element with @expo/html-elements
|
|
48
74
|
const component = elementToComponent[name];
|
|
49
75
|
|
|
@@ -76,11 +102,11 @@ module.exports = ({ types: t }, { expo }) => {
|
|
|
76
102
|
const importDeclarationVisitor = {
|
|
77
103
|
ImportDeclaration(path, state) {
|
|
78
104
|
if (path.get('source').isStringLiteral({ value: '@expo/html-elements' })) {
|
|
79
|
-
state.replacedComponents.forEach(component => {
|
|
105
|
+
state.replacedComponents.forEach((component) => {
|
|
80
106
|
if (
|
|
81
107
|
path
|
|
82
108
|
.get('specifiers')
|
|
83
|
-
.some(specifier => specifier.get('local').isIdentifier({ name: component }))
|
|
109
|
+
.some((specifier) => specifier.get('local').isIdentifier({ name: component }))
|
|
84
110
|
) {
|
|
85
111
|
return;
|
|
86
112
|
}
|
|
@@ -93,6 +119,7 @@ module.exports = ({ types: t }, { expo }) => {
|
|
|
93
119
|
},
|
|
94
120
|
};
|
|
95
121
|
|
|
122
|
+
const source = '@expo/html-elements';
|
|
96
123
|
return {
|
|
97
124
|
name: 'Rewrite React DOM to universal Expo elements',
|
|
98
125
|
visitor: {
|
|
@@ -101,6 +128,13 @@ module.exports = ({ types: t }, { expo }) => {
|
|
|
101
128
|
state.unsupportedComponents = new Set();
|
|
102
129
|
|
|
103
130
|
path.traverse(htmlElementVisitor, state);
|
|
131
|
+
|
|
132
|
+
// If state.replacedComponents is not empty, then ensure `import { ... } from '@expo/html-elements'` is present
|
|
133
|
+
if (state.replacedComponents.size > 0) {
|
|
134
|
+
const importDeclaration = t.importDeclaration([], t.stringLiteral(source));
|
|
135
|
+
path.unshiftContainer('body', importDeclaration);
|
|
136
|
+
}
|
|
137
|
+
|
|
104
138
|
path.traverse(importDeclarationVisitor, state);
|
|
105
139
|
},
|
|
106
140
|
},
|
package/build/Elements.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Elements.d.ts","sourceRoot":"","sources":["../src/Elements.tsx"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSafeStyledView.d.ts","sourceRoot":"","sources":["../../src/css/createSafeStyledView.tsx"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,SAGtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSafeStyledView.js","sourceRoot":"","sources":["../../src/css/createSafeStyledView.tsx"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB,CAAQ,IAAW;IACrD,wBAAwB;IACxB,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["export function createSafeStyledView<TView>(View: TView) {\n // Do nothing by default\n return View;\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare function createSafeStyledView<TView extends React.ComponentType<any>>(View: TView): React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<TView>>;
|
|
3
|
+
//# sourceMappingURL=createSafeStyledView.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSafeStyledView.native.d.ts","sourceRoot":"","sources":["../../src/css/createSafeStyledView.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,wBAAgB,oBAAoB,CAAC,KAAK,SAAS,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,qGAOvF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { filterStyles } from './filterStyles';
|
|
3
|
+
export function createSafeStyledView(View) {
|
|
4
|
+
return React.forwardRef(({ style, ...props }, forwardedRef) => {
|
|
5
|
+
// Filter and apply `center` prop.
|
|
6
|
+
const finalStyle = useMemo(() => filterStyles(style), [style]);
|
|
7
|
+
return <View ref={forwardedRef} style={finalStyle} {...props}/>;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=createSafeStyledView.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSafeStyledView.native.js","sourceRoot":"","sources":["../../src/css/createSafeStyledView.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,UAAU,oBAAoB,CAAyC,IAAW;IACtF,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAO,EAAE,YAA8B,EAAE,EAAE;QACnF,kCAAkC;QAClC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAE/D,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import React, { useMemo } from 'react';\n\nimport { filterStyles } from './filterStyles';\n\nexport function createSafeStyledView<TView extends React.ComponentType<any>>(View: TView) {\n return React.forwardRef(({ style, ...props }: any, forwardedRef: React.Ref<TView>) => {\n // Filter and apply `center` prop.\n const finalStyle = useMemo(() => filterStyles(style), [style]);\n\n return <View ref={forwardedRef} style={finalStyle} {...props} />;\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterStyles.d.ts","sourceRoot":"","sources":["../../src/css/filterStyles.ts"],"names":[],"mappings":"AA0DA,wBAAgB,YAAY,CAAC,SAAS,KAAA,OAWrC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
// Remove the unsupported web styles from the style object
|
|
3
|
+
// to prevent crashing.
|
|
4
|
+
const WEB_STYLES = [
|
|
5
|
+
'backdropFilter',
|
|
6
|
+
'animationDelay',
|
|
7
|
+
'animationDirection',
|
|
8
|
+
'animationDuration',
|
|
9
|
+
'animationFillMode',
|
|
10
|
+
'animationName',
|
|
11
|
+
'animationIterationCount',
|
|
12
|
+
'animationPlayState',
|
|
13
|
+
'animationTimingFunction',
|
|
14
|
+
'backgroundAttachment',
|
|
15
|
+
'backgroundBlendMode',
|
|
16
|
+
'backgroundClip',
|
|
17
|
+
'backgroundImage',
|
|
18
|
+
'backgroundOrigin',
|
|
19
|
+
'backgroundPosition',
|
|
20
|
+
'backgroundRepeat',
|
|
21
|
+
'backgroundSize',
|
|
22
|
+
'boxShadow',
|
|
23
|
+
'boxSizing',
|
|
24
|
+
'clip',
|
|
25
|
+
'cursor',
|
|
26
|
+
'filter',
|
|
27
|
+
'gridAutoColumns',
|
|
28
|
+
'gridAutoFlow',
|
|
29
|
+
'gridAutoRows',
|
|
30
|
+
'gridColumnEnd',
|
|
31
|
+
'gridColumnGap',
|
|
32
|
+
'gridColumnStart',
|
|
33
|
+
'gridRowEnd',
|
|
34
|
+
'gridRowGap',
|
|
35
|
+
'gridRowStart',
|
|
36
|
+
'gridTemplateColumns',
|
|
37
|
+
'gridTemplateRows',
|
|
38
|
+
'gridTemplateAreas',
|
|
39
|
+
'outline',
|
|
40
|
+
'outlineColor',
|
|
41
|
+
'overflowX',
|
|
42
|
+
'overflowY',
|
|
43
|
+
'overscrollBehavior',
|
|
44
|
+
'overscrollBehaviorX',
|
|
45
|
+
'overscrollBehaviorY',
|
|
46
|
+
'perspective',
|
|
47
|
+
'perspectiveOrigin',
|
|
48
|
+
'touchAction',
|
|
49
|
+
'transformOrigin',
|
|
50
|
+
'transitionDelay',
|
|
51
|
+
'transitionDuration',
|
|
52
|
+
'transitionProperty',
|
|
53
|
+
'transitionTimingFunction',
|
|
54
|
+
'userSelect',
|
|
55
|
+
'willChange',
|
|
56
|
+
];
|
|
57
|
+
export function filterStyles(styleProp) {
|
|
58
|
+
if (!styleProp) {
|
|
59
|
+
return styleProp;
|
|
60
|
+
}
|
|
61
|
+
const style = StyleSheet.flatten(styleProp);
|
|
62
|
+
const filteredStyle = Object.fromEntries(Object.entries(style).filter(([k]) => !WEB_STYLES.includes(k)));
|
|
63
|
+
return processNativeStyles(filteredStyle);
|
|
64
|
+
}
|
|
65
|
+
function processNativeStyles(style) {
|
|
66
|
+
if (!style)
|
|
67
|
+
return style;
|
|
68
|
+
if (style.visibility) {
|
|
69
|
+
if (style.visibility === 'hidden') {
|
|
70
|
+
// style.display = "none";
|
|
71
|
+
style.opacity = 0;
|
|
72
|
+
}
|
|
73
|
+
delete style.visibility;
|
|
74
|
+
}
|
|
75
|
+
if (style.position) {
|
|
76
|
+
if (!['absolute', 'relative'].includes(style.position)) {
|
|
77
|
+
console.warn(`Unsupported position: '${style.position}'`);
|
|
78
|
+
style.position = 'relative';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return style;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=filterStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterStyles.js","sourceRoot":"","sources":["../../src/css/filterStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,0DAA0D;AAC1D,uBAAuB;AACvB,MAAM,UAAU,GAAG;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,mBAAmB;IACnB,mBAAmB;IACnB,eAAe;IACf,yBAAyB;IACzB,oBAAoB;IACpB,yBAAyB;IACzB,sBAAsB;IACtB,qBAAqB;IACrB,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;IAClB,oBAAoB;IACpB,kBAAkB;IAClB,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,iBAAiB;I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0B,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;YAC1D,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;SAC7B;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { StyleSheet } from 'react-native';\n\n// Remove the unsupported web styles from the style object\n// to prevent crashing.\nconst WEB_STYLES = [\n 'backdropFilter',\n 'animationDelay',\n 'animationDirection',\n 'animationDuration',\n 'animationFillMode',\n 'animationName',\n 'animationIterationCount',\n 'animationPlayState',\n 'animationTimingFunction',\n 'backgroundAttachment',\n 'backgroundBlendMode',\n 'backgroundClip',\n 'backgroundImage',\n 'backgroundOrigin',\n 'backgroundPosition',\n 'backgroundRepeat',\n 'backgroundSize',\n 'boxShadow',\n 'boxSizing',\n 'clip',\n 'cursor',\n 'filter',\n 'gridAutoColumns',\n 'gridAutoFlow',\n 'gridAutoRows',\n 'gridColumnEnd',\n 'gridColumnGap',\n 'gridColumnStart',\n 'gridRowEnd',\n 'gridRowGap',\n 'gridRowStart',\n 'gridTemplateColumns',\n 'gridTemplateRows',\n 'gridTemplateAreas',\n 'outline',\n 'outlineColor',\n 'overflowX',\n 'overflowY',\n 'overscrollBehavior',\n 'overscrollBehaviorX',\n 'overscrollBehaviorY',\n 'perspective',\n 'perspectiveOrigin',\n 'touchAction',\n 'transformOrigin',\n 'transitionDelay',\n 'transitionDuration',\n 'transitionProperty',\n 'transitionTimingFunction',\n 'userSelect',\n 'willChange',\n];\n\nexport function filterStyles(styleProp) {\n if (!styleProp) {\n return styleProp;\n }\n const style = StyleSheet.flatten(styleProp);\n\n const filteredStyle = Object.fromEntries(\n Object.entries(style).filter(([k]) => !WEB_STYLES.includes(k))\n );\n\n return processNativeStyles(filteredStyle);\n}\n\nfunction processNativeStyles(style) {\n if (!style) return style;\n\n if (style.visibility) {\n if (style.visibility === 'hidden') {\n // style.display = \"none\";\n style.opacity = 0;\n }\n delete style.visibility;\n }\n\n if (style.position) {\n if (!['absolute', 'relative'].includes(style.position)) {\n console.warn(`Unsupported position: '${style.position}'`);\n style.position = 'relative';\n }\n }\n\n return style;\n}\n"]}
|
package/build/css/units.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/css/units.ts"],"names":[],"mappings":"AAEA,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAGlD;AAED,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAGjD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}>>;
|
|
2
|
+
import { LinkProps } from './Text.types';
|
|
3
|
+
export declare const A: React.ComponentType<LinkProps>;
|
|
4
|
+
//# sourceMappingURL=Anchor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../src/elements/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,eAAO,MAAM,CAAC,gCAoBgB,CAAC"}
|
package/build/elements/Anchor.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { Linking, Platform } from 'react-native';
|
|
3
3
|
import Text from '../primitives/Text';
|
|
4
|
-
export const A = forwardRef(({ href, target, ...props }, ref) => {
|
|
4
|
+
export const A = forwardRef(({ href, target, download, rel, ...props }, ref) => {
|
|
5
5
|
const nativeProps = Platform.select({
|
|
6
6
|
web: {
|
|
7
7
|
href,
|
|
8
|
-
|
|
8
|
+
hrefAttrs: {
|
|
9
|
+
target,
|
|
10
|
+
download,
|
|
11
|
+
rel,
|
|
12
|
+
},
|
|
9
13
|
},
|
|
10
14
|
default: {
|
|
11
|
-
onPress: event => {
|
|
15
|
+
onPress: (event) => {
|
|
12
16
|
props.onPress && props.onPress(event);
|
|
13
17
|
if (Platform.OS !== 'web' && href !== undefined) {
|
|
14
18
|
Linking.openURL(href);
|
|
@@ -16,6 +20,6 @@ export const A = forwardRef(({ href, target, ...props }, ref) => {
|
|
|
16
20
|
},
|
|
17
21
|
},
|
|
18
22
|
});
|
|
19
|
-
return
|
|
23
|
+
return <Text role="link" {...props} {...nativeProps} ref={ref}/>;
|
|
20
24
|
});
|
|
21
25
|
//# sourceMappingURL=Anchor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Anchor.js","sourceRoot":"","sources":["../../src/elements/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Anchor.js","sourceRoot":"","sources":["../../src/elements/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,MAAM,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,KAAK,EAAa,EAAE,GAAG,EAAE,EAAE;IACxF,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAY;QAC7C,GAAG,EAAE;YACH,IAAI;YACJ,SAAS,EAAE;gBACT,MAAM;gBACN,QAAQ;gBACR,GAAG;aACJ;SACF;QACD,OAAO,EAAE;YACP,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBACjB,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACtC,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,IAAI,KAAK,SAAS,EAAE;oBAC/C,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;iBACvB;YACH,CAAC;SACF;KACF,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;AACpE,CAAC,CAA6B,CAAC","sourcesContent":["import React, { ComponentType, forwardRef } from 'react';\nimport { Linking, Platform } from 'react-native';\n\nimport { LinkProps } from './Text.types';\nimport Text from '../primitives/Text';\n\nexport const A = forwardRef(({ href, target, download, rel, ...props }: LinkProps, ref) => {\n const nativeProps = Platform.select<LinkProps>({\n web: {\n href,\n hrefAttrs: {\n target,\n download,\n rel,\n },\n },\n default: {\n onPress: (event) => {\n props.onPress && props.onPress(event);\n if (Platform.OS !== 'web' && href !== undefined) {\n Linking.openURL(href);\n }\n },\n },\n });\n return <Text role=\"link\" {...props} {...nativeProps} ref={ref} />;\n}) as ComponentType<LinkProps>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Headings.d.ts","sourceRoot":"","sources":["../../src/elements/Headings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAIzD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAmBrD,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC"}
|
|
@@ -5,12 +5,15 @@ import Text from '../primitives/Text';
|
|
|
5
5
|
function createHeadingComponent(level) {
|
|
6
6
|
const nativeProps = Platform.select({
|
|
7
7
|
web: {
|
|
8
|
-
'aria-level':
|
|
8
|
+
'aria-level': level,
|
|
9
|
+
role: 'header',
|
|
10
|
+
},
|
|
11
|
+
default: {
|
|
12
|
+
accessibilityRole: 'header',
|
|
9
13
|
},
|
|
10
|
-
default: {},
|
|
11
14
|
});
|
|
12
15
|
return forwardRef((props, ref) => {
|
|
13
|
-
return (
|
|
16
|
+
return (<Text {...nativeProps} {...props} style={[styles[`h${level}`], props.style]} ref={ref}/>);
|
|
14
17
|
});
|
|
15
18
|
}
|
|
16
19
|
export const H1 = createHeadingComponent(1);
|
|
@@ -19,35 +22,55 @@ export const H3 = createHeadingComponent(3);
|
|
|
19
22
|
export const H4 = createHeadingComponent(4);
|
|
20
23
|
export const H5 = createHeadingComponent(5);
|
|
21
24
|
export const H6 = createHeadingComponent(6);
|
|
25
|
+
if (__DEV__) {
|
|
26
|
+
H1.displayName = 'H1';
|
|
27
|
+
H2.displayName = 'H2';
|
|
28
|
+
H3.displayName = 'H3';
|
|
29
|
+
H4.displayName = 'H4';
|
|
30
|
+
H5.displayName = 'H5';
|
|
31
|
+
H6.displayName = 'H6';
|
|
32
|
+
}
|
|
22
33
|
// Default web styles: http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css
|
|
23
34
|
const styles = StyleSheet.create({
|
|
24
35
|
h1: {
|
|
36
|
+
// @ts-ignore
|
|
25
37
|
fontSize: em(2),
|
|
38
|
+
// @ts-ignore
|
|
26
39
|
marginVertical: em(0.67),
|
|
27
40
|
fontWeight: 'bold',
|
|
28
41
|
},
|
|
29
42
|
h2: {
|
|
43
|
+
// @ts-ignore
|
|
30
44
|
fontSize: em(1.5),
|
|
45
|
+
// @ts-ignore
|
|
31
46
|
marginVertical: em(0.83),
|
|
32
47
|
fontWeight: 'bold',
|
|
33
48
|
},
|
|
34
49
|
h3: {
|
|
50
|
+
// @ts-ignore
|
|
35
51
|
fontSize: em(1.17),
|
|
52
|
+
// @ts-ignore
|
|
36
53
|
marginVertical: em(1),
|
|
37
54
|
fontWeight: 'bold',
|
|
38
55
|
},
|
|
39
56
|
h4: {
|
|
57
|
+
// @ts-ignore
|
|
40
58
|
fontSize: em(1),
|
|
59
|
+
// @ts-ignore
|
|
41
60
|
marginVertical: em(1.33),
|
|
42
61
|
fontWeight: 'bold',
|
|
43
62
|
},
|
|
44
63
|
h5: {
|
|
64
|
+
// @ts-ignore
|
|
45
65
|
fontSize: em(0.83),
|
|
66
|
+
// @ts-ignore
|
|
46
67
|
marginVertical: em(1.67),
|
|
47
68
|
fontWeight: 'bold',
|
|
48
69
|
},
|
|
49
70
|
h6: {
|
|
71
|
+
// @ts-ignore
|
|
50
72
|
fontSize: em(0.67),
|
|
73
|
+
// @ts-ignore
|
|
51
74
|
marginVertical: em(2.33),
|
|
52
75
|
fontWeight: 'bold',
|
|
53
76
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Headings.js","sourceRoot":"","sources":["../../src/elements/Headings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,IAAmB,MAAM,oBAAoB,CAAC;AAErD,SAAS,sBAAsB,CAAC,KAAa;IAC3C,MAAM,WAAW,GAAQ,QAAQ,CAAC,MAAM,CAAC;QACvC,GAAG,EAAE;YACH,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"Headings.js","sourceRoot":"","sources":["../../src/elements/Headings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,EAAE,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B,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC;IACtB,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC;CACvB;AAED,uFAAuF;AACvF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,EAAE,EAAE;QACF,aAAa;QACb,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;QACf,aAAa;QACb,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC;QACxB,UAAU,EAAE,MAAM;KACnB;IACD,EAAE,EAAE;QACF,aAAa;QACb,QAAQ,EAAE,EAAE,CAAC,GAAG,CAAC;QACjB,aAAa;QACb,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC;QACxB,UAAU,EAAE,MAAM;KACnB;IACD,EAAE,EAAE;QACF,aAAa;QACb,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC;QAClB,aAAa;QACb,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC;QACrB,UAAU,EAAE,MAAM;KACnB;IACD,EAAE,EAAE;QACF,aAAa;QACb,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;QACf,aAAa;QACb,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC;QACxB,UAAU,EAAE,MAAM;KACnB;IACD,EAAE,EAAE;QACF,aAAa;QACb,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC;QAClB,aAAa;QACb,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC;QACxB,UAAU,EAAE,MAAM;KACnB;IACD,EAAE,EAAE;QACF,aAAa;QACb,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC;QAClB,aAAa;QACb,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC;QACxB,UAAU,EAAE,MAAM;KACnB;CACF,CAAC,CAAC","sourcesContent":["import React, { ComponentType, forwardRef } from 'react';\nimport { Platform, StyleSheet } from 'react-native';\n\nimport { em } from '../css/units';\nimport Text, { TextProps } from '../primitives/Text';\n\nfunction createHeadingComponent(level: number): ComponentType<TextProps> {\n const nativeProps: any = Platform.select({\n web: {\n 'aria-level': level,\n role: 'header',\n },\n default: {\n accessibilityRole: 'header',\n },\n });\n return forwardRef((props: TextProps, ref) => {\n return (\n <Text {...nativeProps} {...props} style={[styles[`h${level}`], props.style]} ref={ref} />\n );\n }) as ComponentType<TextProps>;\n}\n\nexport const H1 = createHeadingComponent(1);\nexport const H2 = createHeadingComponent(2);\nexport const H3 = createHeadingComponent(3);\nexport const H4 = createHeadingComponent(4);\nexport const H5 = createHeadingComponent(5);\nexport const H6 = createHeadingComponent(6);\n\nif (__DEV__) {\n H1.displayName = 'H1';\n H2.displayName = 'H2';\n H3.displayName = 'H3';\n H4.displayName = 'H4';\n H5.displayName = 'H5';\n H6.displayName = 'H6';\n}\n\n// Default web styles: http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css\nconst styles = StyleSheet.create({\n h1: {\n // @ts-ignore\n fontSize: em(2),\n // @ts-ignore\n marginVertical: em(0.67),\n fontWeight: 'bold',\n },\n h2: {\n // @ts-ignore\n fontSize: em(1.5),\n // @ts-ignore\n marginVertical: em(0.83),\n fontWeight: 'bold',\n },\n h3: {\n // @ts-ignore\n fontSize: em(1.17),\n // @ts-ignore\n marginVertical: em(1),\n fontWeight: 'bold',\n },\n h4: {\n // @ts-ignore\n fontSize: em(1),\n // @ts-ignore\n marginVertical: em(1.33),\n fontWeight: 'bold',\n },\n h5: {\n // @ts-ignore\n fontSize: em(0.83),\n // @ts-ignore\n marginVertical: em(1.67),\n fontWeight: 'bold',\n },\n h6: {\n // @ts-ignore\n fontSize: em(0.67),\n // @ts-ignore\n marginVertical: em(2.33),\n fontWeight: 'bold',\n },\n});\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewProps } from '../primitives/View';
|
|
3
|
+
export declare const Div: React.ComponentType<ViewProps>;
|
|
3
4
|
export declare const Nav: React.ComponentType<ViewProps>;
|
|
4
5
|
export declare const Footer: React.ComponentType<ViewProps>;
|
|
5
6
|
export declare const Aside: React.ComponentType<ViewProps>;
|
|
@@ -7,3 +8,4 @@ export declare const Header: React.ComponentType<ViewProps>;
|
|
|
7
8
|
export declare const Main: React.ComponentType<ViewProps>;
|
|
8
9
|
export declare const Article: React.ComponentType<ViewProps>;
|
|
9
10
|
export declare const Section: React.ComponentType<ViewProps>;
|
|
11
|
+
//# sourceMappingURL=Layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/elements/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAGzD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQrD,eAAO,MAAM,GAAG,gCAAe,CAAC;AAEhC,eAAO,MAAM,GAAG,gCAMf,CAAC;AACF,eAAO,MAAM,MAAM,gCAMlB,CAAC;AACF,eAAO,MAAM,KAAK,gCAMjB,CAAC;AACF,eAAO,MAAM,MAAM,gCASlB,CAAC;AACF,eAAO,MAAM,IAAI,gCAMhB,CAAC;AACF,eAAO,MAAM,OAAO,gCAMnB,CAAC;AACF,eAAO,MAAM,OAAO,gCAElB,CAAC"}
|
package/build/elements/Layout.js
CHANGED
|
@@ -3,27 +3,28 @@ import { Platform } from 'react-native';
|
|
|
3
3
|
import View from '../primitives/View';
|
|
4
4
|
function createView(nativeProps = {}) {
|
|
5
5
|
return forwardRef((props, ref) => {
|
|
6
|
-
return
|
|
6
|
+
return <View {...nativeProps} {...props} ref={ref}/>;
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
|
+
export const Div = createView();
|
|
9
10
|
export const Nav = createView(Platform.select({
|
|
10
11
|
web: {
|
|
11
|
-
|
|
12
|
+
role: 'navigation',
|
|
12
13
|
},
|
|
13
14
|
}));
|
|
14
15
|
export const Footer = createView(Platform.select({
|
|
15
16
|
web: {
|
|
16
|
-
|
|
17
|
+
role: 'contentinfo',
|
|
17
18
|
},
|
|
18
19
|
}));
|
|
19
20
|
export const Aside = createView(Platform.select({
|
|
20
21
|
web: {
|
|
21
|
-
|
|
22
|
+
role: 'complementary',
|
|
22
23
|
},
|
|
23
24
|
}));
|
|
24
25
|
export const Header = createView(Platform.select({
|
|
25
26
|
web: {
|
|
26
|
-
|
|
27
|
+
role: 'banner',
|
|
27
28
|
},
|
|
28
29
|
default: {
|
|
29
30
|
accessibilityRole: 'header',
|
|
@@ -31,15 +32,15 @@ export const Header = createView(Platform.select({
|
|
|
31
32
|
}));
|
|
32
33
|
export const Main = createView(Platform.select({
|
|
33
34
|
web: {
|
|
34
|
-
|
|
35
|
+
role: 'main',
|
|
35
36
|
},
|
|
36
37
|
}));
|
|
37
38
|
export const Article = createView(Platform.select({
|
|
38
39
|
web: {
|
|
39
|
-
|
|
40
|
+
role: 'article',
|
|
40
41
|
},
|
|
41
42
|
}));
|
|
42
43
|
export const Section = createView({
|
|
43
|
-
|
|
44
|
+
role: 'summary', // region?
|
|
44
45
|
});
|
|
45
46
|
//# sourceMappingURL=Layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../src/elements/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,IAAmB,MAAM,oBAAoB,CAAC;AAErD,SAAS,UAAU,CAAC,cAAyB,EAAE;IAC7C,OAAO,UAAU,CAAC,CAAC,KAAgB,EAAE,GAAG,EAAE,EAAE;QAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../src/elements/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,IAAmB,MAAM,oBA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AC,MAAM,OAAO,GAAG,UAAU,CAAC;IAChC,IAAI,EAAE,SAAS,EAAE,UAAU;CAC5B,CAAC,CAAC","sourcesContent":["import React, { ComponentType, forwardRef } from 'react';\nimport { Platform } from 'react-native';\n\nimport View, { ViewProps } from '../primitives/View';\n\nfunction createView(nativeProps: ViewProps = {}): ComponentType<ViewProps> {\n return forwardRef((props: ViewProps, ref) => {\n return <View {...nativeProps} {...props} ref={ref} />;\n }) as ComponentType<ViewProps>;\n}\n\nexport const Div = createView();\n\nexport const Nav = createView(\n Platform.select({\n web: {\n role: 'navigation',\n },\n })\n);\nexport const Footer = createView(\n Platform.select({\n web: {\n role: 'contentinfo',\n },\n })\n);\nexport const Aside = createView(\n Platform.select({\n web: {\n role: 'complementary',\n },\n })\n);\nexport const Header = createView(\n Platform.select({\n web: {\n role: 'banner',\n },\n default: {\n accessibilityRole: 'header',\n },\n })\n);\nexport const Main = createView(\n Platform.select({\n web: {\n role: 'main',\n },\n })\n);\nexport const Article = createView(\n Platform.select({\n web: {\n role: 'article',\n },\n })\n);\nexport const Section = createView({\n role: 'summary', // region?\n});\n"]}
|
|
@@ -2,4 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { TextProps } from '../primitives/Text';
|
|
3
3
|
import { ViewProps } from '../primitives/View';
|
|
4
4
|
export declare const UL: React.ComponentType<ViewProps>;
|
|
5
|
-
|
|
5
|
+
type LIProps = TextProps | ViewProps;
|
|
6
|
+
export declare const LI: React.ComponentType<LIProps>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=Lists.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lists.d.ts","sourceRoot":"","sources":["../../src/elements/Lists.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAG5E,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQrD,eAAO,MAAM,EAAE,gCAMd,CAAC;AAOF,KAAK,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAErC,eAAO,MAAM,EAAE,8BAaa,CAAC"}
|
package/build/elements/Lists.js
CHANGED
|
@@ -4,12 +4,12 @@ import Text from '../primitives/Text';
|
|
|
4
4
|
import View from '../primitives/View';
|
|
5
5
|
function createView(nativeProps = {}) {
|
|
6
6
|
return forwardRef((props, ref) => {
|
|
7
|
-
return
|
|
7
|
+
return <View {...nativeProps} {...props} ref={ref}/>;
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
export const UL = createView(Platform.select({
|
|
11
11
|
web: {
|
|
12
|
-
|
|
12
|
+
role: 'list',
|
|
13
13
|
},
|
|
14
14
|
}));
|
|
15
15
|
function isTextProps(props) {
|
|
@@ -18,16 +18,16 @@ function isTextProps(props) {
|
|
|
18
18
|
}
|
|
19
19
|
export const LI = forwardRef((props, ref) => {
|
|
20
20
|
if (isTextProps(props)) {
|
|
21
|
-
const
|
|
21
|
+
const role = Platform.select({
|
|
22
22
|
web: 'listitem',
|
|
23
|
-
default: props.
|
|
23
|
+
default: props.role,
|
|
24
24
|
});
|
|
25
|
-
return
|
|
25
|
+
return <Text {...props} role={role} ref={ref}/>;
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const role = Platform.select({
|
|
28
28
|
web: 'listitem',
|
|
29
|
-
default: props.
|
|
29
|
+
default: props.role,
|
|
30
30
|
});
|
|
31
|
-
return
|
|
31
|
+
return <View {...props} role={role} ref={ref}/>;
|
|
32
32
|
});
|
|
33
33
|
//# sourceMappingURL=Lists.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lists.js","sourceRoot":"","sources":["../../src/elements/Lists.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAqB,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,IA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,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;KAClD;IACD,MAAM,IAAI,GAAoB,QAAQ,CAAC,MAAM,CAAC;QAC5C,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,KAAK,CAAC,IAAI;KACpB,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;AACnD,CAAC,CAA2B,CAAC","sourcesContent":["import React, { ComponentType, forwardRef, PropsWithChildren } from 'react';\nimport { Platform } from 'react-native';\n\nimport Text, { TextProps } from '../primitives/Text';\nimport View, { ViewProps } from '../primitives/View';\n\nfunction createView(nativeProps: ViewProps = {}): ComponentType<ViewProps> {\n return forwardRef((props: ViewProps, ref) => {\n return <View {...nativeProps} {...props} ref={ref} />;\n }) as ComponentType<ViewProps>;\n}\n\nexport const UL = createView(\n Platform.select({\n web: {\n role: 'list',\n },\n })\n);\n\nfunction isTextProps(props: any): props is TextProps {\n // Treat <li></li> as a Text element.\n return typeof props.children === 'string';\n}\n\ntype LIProps = TextProps | ViewProps;\n\nexport const LI = forwardRef((props: PropsWithChildren<LIProps>, ref: any) => {\n if (isTextProps(props)) {\n const role: LIProps['role'] = Platform.select({\n web: 'listitem',\n default: props.role,\n });\n return <Text {...props} role={role} ref={ref} />;\n }\n const role: LIProps['role'] = Platform.select({\n web: 'listitem',\n default: props.role,\n });\n return <View {...props} role={role} ref={ref} />;\n}) as ComponentType<LIProps>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rules.d.ts","sourceRoot":"","sources":["../../src/elements/Rules.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAGzD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAO,MAAM,EAAE,gCAEe,CAAC"}
|
package/build/elements/Rules.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
3
|
import View from '../primitives/View';
|
|
4
4
|
export const HR = forwardRef((props, ref) => {
|
|
5
|
-
return
|
|
5
|
+
return <View {...props} style={[styles.hr, props.style]} ref={ref}/>;
|
|
6
6
|
});
|
|
7
7
|
const styles = StyleSheet.create({
|
|
8
8
|
hr: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rules.js","sourceRoot":"","sources":["../../src/elements/Rules.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,IAAmB,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC,KAAgB,EAAE,GAAG,EAAE,EAAE;IACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"Rules.js","sourceRoot":"","sources":["../../src/elements/Rules.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,IAAmB,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC,KAAgB,EAAE,GAAG,EAAE,EAAE;IACrD,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;AACxE,CAAC,CAA6B,CAAC;AAE/B,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,EAAE,EAAE;QACF,cAAc,EAAE,UAAU,CAAC,aAAa;QACxC,iBAAiB,EAAE,UAAU,CAAC,aAAa;QAC3C,cAAc,EAAE,SAAS;QACzB,iBAAiB,EAAE,SAAS;QAC5B,cAAc,EAAE,CAAC;KAClB;CACF,CAAC,CAAC","sourcesContent":["import React, { ComponentType, forwardRef } from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport View, { ViewProps } from '../primitives/View';\n\nexport const HR = forwardRef((props: ViewProps, ref) => {\n return <View {...props} style={[styles.hr, props.style]} ref={ref} />;\n}) as ComponentType<ViewProps>;\n\nconst styles = StyleSheet.create({\n hr: {\n borderTopWidth: StyleSheet.hairlineWidth,\n borderBottomWidth: StyleSheet.hairlineWidth,\n borderTopColor: '#9A9A9A',\n borderBottomColor: '#EEEEEE',\n marginVertical: 8,\n },\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rules.web.d.ts","sourceRoot":"","sources":["../../src/elements/Rules.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,eAAO,MAAM,EAAE,0BAEe,CAAC"}
|
|
@@ -10,3 +10,4 @@ export declare const TH: React.ComponentType<TableTextProps>;
|
|
|
10
10
|
export declare const TR: React.ComponentType<ViewProps>;
|
|
11
11
|
export declare const TD: React.ComponentType<TableTextProps>;
|
|
12
12
|
export declare const Caption: React.ComponentType<TextProps>;
|
|
13
|
+
//# sourceMappingURL=Table.d.ts.map
|