@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/elements/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAIzD,OAAO,EAAa,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAO,MAAM,KAAK,gCAEY,CAAC;AAE/B,eAAO,MAAM,KAAK,gCAEY,CAAC;AAE/B,eAAO,MAAM,KAAK,gCAEY,CAAC;AAE/B,eAAO,MAAM,KAAK,gCAEY,CAAC;AAE/B,eAAO,MAAM,EAAE,qCAEoB,CAAC;AAEpC,eAAO,MAAM,EAAE,gCAEe,CAAC;AAE/B,eAAO,MAAM,EAAE,qCAEoB,CAAC;AAEpC,eAAO,MAAM,OAAO,gCAEU,CAAC"}
|
package/build/elements/Table.js
CHANGED
|
@@ -5,28 +5,28 @@ import { TableText } from '../primitives/Table';
|
|
|
5
5
|
import Text from '../primitives/Text';
|
|
6
6
|
import View from '../primitives/View';
|
|
7
7
|
export const Table = forwardRef((props, ref) => {
|
|
8
|
-
return
|
|
8
|
+
return <View {...props} ref={ref}/>;
|
|
9
9
|
});
|
|
10
10
|
export const THead = forwardRef((props, ref) => {
|
|
11
|
-
return
|
|
11
|
+
return <View {...props} ref={ref}/>;
|
|
12
12
|
});
|
|
13
13
|
export const TBody = forwardRef((props, ref) => {
|
|
14
|
-
return
|
|
14
|
+
return <View {...props} ref={ref}/>;
|
|
15
15
|
});
|
|
16
16
|
export const TFoot = forwardRef((props, ref) => {
|
|
17
|
-
return
|
|
17
|
+
return <View {...props} ref={ref}/>;
|
|
18
18
|
});
|
|
19
19
|
export const TH = forwardRef((props, ref) => {
|
|
20
|
-
return
|
|
20
|
+
return <TableText {...props} style={[styles.th, props.style]} ref={ref}/>;
|
|
21
21
|
});
|
|
22
22
|
export const TR = forwardRef((props, ref) => {
|
|
23
|
-
return
|
|
23
|
+
return <View {...props} style={[styles.tr, props.style]} ref={ref}/>;
|
|
24
24
|
});
|
|
25
25
|
export const TD = forwardRef((props, ref) => {
|
|
26
|
-
return
|
|
26
|
+
return <TableText {...props} style={[styles.td, props.style]} ref={ref}/>;
|
|
27
27
|
});
|
|
28
28
|
export const Caption = forwardRef((props, ref) => {
|
|
29
|
-
return
|
|
29
|
+
return <Text {...props} style={[styles.caption, props.style]} ref={ref}/>;
|
|
30
30
|
});
|
|
31
31
|
const styles = StyleSheet.create({
|
|
32
32
|
caption: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/elements/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,SAAS,EAAkB,MAAM,qBAAqB,CAAC;AAChE,OAAO,IAAmB,MAAM,oBAAoB,CAAC;AACrD,OAAO,IAAmB,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,KAAgB,EAAE,GAAG,EAAE,EAAE;IACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/elements/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,SAAS,EAAkB,MAAM,qBAAqB,CAAC;AAChE,OAAO,IAAmB,MAAM,oBAAoB,CAAC;AACrD,OAAO,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C,CAAC","sourcesContent":["import React, { ComponentType, forwardRef } from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport { em } from '../css/units';\nimport { TableText, TableTextProps } from '../primitives/Table';\nimport Text, { TextProps } from '../primitives/Text';\nimport View, { ViewProps } from '../primitives/View';\n\nexport const Table = forwardRef((props: ViewProps, ref) => {\n return <View {...props} ref={ref} />;\n}) as ComponentType<ViewProps>;\n\nexport const THead = forwardRef((props: ViewProps, ref) => {\n return <View {...props} ref={ref} />;\n}) as ComponentType<ViewProps>;\n\nexport const TBody = forwardRef((props: ViewProps, ref) => {\n return <View {...props} ref={ref} />;\n}) as ComponentType<ViewProps>;\n\nexport const TFoot = forwardRef((props: ViewProps, ref) => {\n return <View {...props} ref={ref} />;\n}) as ComponentType<ViewProps>;\n\nexport const TH = forwardRef((props: TableTextProps, ref: any) => {\n return <TableText {...props} style={[styles.th, props.style]} ref={ref} />;\n}) as ComponentType<TableTextProps>;\n\nexport const TR = forwardRef((props: ViewProps, ref) => {\n return <View {...props} style={[styles.tr, props.style]} ref={ref} />;\n}) as ComponentType<ViewProps>;\n\nexport const TD = forwardRef((props: TableTextProps, ref: any) => {\n return <TableText {...props} style={[styles.td, props.style]} ref={ref} />;\n}) as ComponentType<TableTextProps>;\n\nexport const Caption = forwardRef((props: TextProps, ref: any) => {\n return <Text {...props} style={[styles.caption, props.style]} ref={ref} />;\n}) as ComponentType<TextProps>;\n\nconst styles = StyleSheet.create({\n caption: {\n textAlign: 'center',\n fontSize: em(1) as number,\n },\n th: {\n textAlign: 'center',\n fontWeight: 'bold',\n flex: 1,\n fontSize: em(1) as number,\n },\n tr: {\n flexDirection: 'row',\n },\n td: {\n flex: 1,\n fontSize: em(1) as number,\n },\n});\n"]}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TableTextProps } from '../primitives/Table';
|
|
3
|
-
import { TextProps } from '../primitives/Text';
|
|
1
|
+
import React from 'react';
|
|
4
2
|
import { ViewProps } from '../primitives/View';
|
|
5
|
-
export declare const Table: ComponentType<ViewProps>;
|
|
6
|
-
export declare const THead: ComponentType<ViewProps>;
|
|
7
|
-
export declare const TBody: ComponentType<ViewProps>;
|
|
8
|
-
export declare const TFoot: ComponentType<ViewProps>;
|
|
9
|
-
export declare const TH: ComponentType<
|
|
10
|
-
export declare const TR: ComponentType<ViewProps>;
|
|
11
|
-
export declare const TD: ComponentType<
|
|
12
|
-
export declare const Caption: ComponentType<
|
|
3
|
+
export declare const Table: React.ComponentType<ViewProps>;
|
|
4
|
+
export declare const THead: React.ComponentType<ViewProps>;
|
|
5
|
+
export declare const TBody: React.ComponentType<ViewProps>;
|
|
6
|
+
export declare const TFoot: React.ComponentType<ViewProps>;
|
|
7
|
+
export declare const TH: React.ComponentType<ViewProps>;
|
|
8
|
+
export declare const TR: React.ComponentType<ViewProps>;
|
|
9
|
+
export declare const TD: React.ComponentType<ViewProps>;
|
|
10
|
+
export declare const Caption: React.ComponentType<ViewProps>;
|
|
11
|
+
//# sourceMappingURL=Table.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.web.d.ts","sourceRoot":"","sources":["../../src/elements/Table.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQ/C,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,EAAE,gCAAkC,CAAC;AAElD,eAAO,MAAM,EAAE,gCAAkC,CAAC;AAElD,eAAO,MAAM,EAAE,gCAAkC,CAAC;AAElD,eAAO,MAAM,OAAO,gCAAuC,CAAC"}
|
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
export const TBody =
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
export const
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return createElement('caption', { ...props, style: [styles.reset, props.style], ref });
|
|
27
|
-
});
|
|
28
|
-
const styles = StyleSheet.create({
|
|
29
|
-
reset: {
|
|
30
|
-
fontFamily: 'System',
|
|
31
|
-
padding: 0,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import View from '../primitives/RNWView';
|
|
3
|
+
function createView(nativeProps) {
|
|
4
|
+
return forwardRef((props, ref) => {
|
|
5
|
+
return <View {...nativeProps} {...props} ref={ref}/>;
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export const Table = createView({ __element: 'table' });
|
|
9
|
+
export const THead = createView({ __element: 'thead' });
|
|
10
|
+
export const TBody = createView({ __element: 'tbody' });
|
|
11
|
+
export const TFoot = createView({ __element: 'tfoot' });
|
|
12
|
+
export const TH = createView({ __element: 'th' });
|
|
13
|
+
export const TR = createView({ __element: 'tr' });
|
|
14
|
+
export const TD = createView({ __element: 'td' });
|
|
15
|
+
export const Caption = createView({ __element: 'caption' });
|
|
16
|
+
if (__DEV__) {
|
|
17
|
+
Table.displayName = 'Table';
|
|
18
|
+
THead.displayName = 'THead';
|
|
19
|
+
TBody.displayName = 'TBody';
|
|
20
|
+
TFoot.displayName = 'TFoot';
|
|
21
|
+
TH.displayName = 'TH';
|
|
22
|
+
TR.displayName = 'TR';
|
|
23
|
+
TD.displayName = 'TD';
|
|
24
|
+
Caption.displayName = 'Caption';
|
|
25
|
+
}
|
|
34
26
|
//# sourceMappingURL=Table.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.web.js","sourceRoot":"","sources":["../../src/elements/Table.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Table.web.js","sourceRoot":"","sources":["../../src/elements/Table.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,IAAI,MAAM,uBAAuB,CAAC;AAGzC,SAAS,UAAU,CAAC,WAA8C;IAChE,OAAO,UAAU,CAAC,CAAC,KAAgB,EAAE,GAAG,EAAE,EAAE;QAC1C,OAAO,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;IACxD,CAAC,CAA6B,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAElD,MAAM,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAElD,MAAM,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAElD,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;AAE5D,IAAI,OAAO,EAAE;IACX,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;IAC5B,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;IAC5B,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;IAC5B,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;IAC5B,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC;IACtB,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC;IACtB,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;CACjC","sourcesContent":["import React, { ComponentType, forwardRef } from 'react';\n\nimport View from '../primitives/RNWView';\nimport { ViewProps } from '../primitives/View';\n\nfunction createView(nativeProps: ViewProps & { __element: string }): ComponentType<ViewProps> {\n return forwardRef((props: ViewProps, ref) => {\n return <View {...nativeProps} {...props} ref={ref} />;\n }) as ComponentType<ViewProps>;\n}\n\nexport const Table = createView({ __element: 'table' });\n\nexport const THead = createView({ __element: 'thead' });\n\nexport const TBody = createView({ __element: 'tbody' });\n\nexport const TFoot = createView({ __element: 'tfoot' });\n\nexport const TH = createView({ __element: 'th' });\n\nexport const TR = createView({ __element: 'tr' });\n\nexport const TD = createView({ __element: 'td' });\n\nexport const Caption = createView({ __element: 'caption' });\n\nif (__DEV__) {\n Table.displayName = 'Table';\n THead.displayName = 'THead';\n TBody.displayName = 'TBody';\n TFoot.displayName = 'TFoot';\n TH.displayName = 'TH';\n TR.displayName = 'TR';\n TD.displayName = 'TD';\n Caption.displayName = 'Caption';\n}\n"]}
|
package/build/elements/Text.d.ts
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { BlockQuoteProps, QuoteProps, TimeProps } from './Text.types';
|
|
2
3
|
import { TextProps } from '../primitives/Text';
|
|
3
4
|
import { ViewProps } from '../primitives/View';
|
|
4
5
|
export declare const P: React.ComponentType<TextProps>;
|
|
5
6
|
export declare const B: React.ComponentType<TextProps>;
|
|
6
7
|
export declare const S: React.ComponentType<TextProps>;
|
|
7
8
|
export declare const I: React.ComponentType<TextProps>;
|
|
8
|
-
export declare const Q: React.ComponentType<
|
|
9
|
-
|
|
10
|
-
}>>;
|
|
11
|
-
export declare const BlockQuote: React.ComponentType<React.PropsWithChildren<import("../primitives/View").WebViewProps & Pick<import("react-native").ViewProps & React.ClassAttributes<typeof import("react-native").View>, "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "key" | "ref" | "hitSlop" | "pointerEvents" | "removeClippedSubviews" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture"> & {
|
|
12
|
-
cite?: string | undefined;
|
|
13
|
-
}>>;
|
|
9
|
+
export declare const Q: React.ComponentType<QuoteProps>;
|
|
10
|
+
export declare const BlockQuote: React.ComponentType<BlockQuoteProps>;
|
|
14
11
|
export declare const BR: React.ComponentType<TextProps>;
|
|
15
12
|
export declare const Mark: React.ComponentType<TextProps>;
|
|
16
13
|
export declare const Code: React.ComponentType<TextProps>;
|
|
17
|
-
|
|
14
|
+
type PreProps = TextProps | ViewProps;
|
|
18
15
|
export declare const Pre: React.ComponentType<PreProps>;
|
|
19
|
-
export declare const Time: React.ComponentType<
|
|
20
|
-
dateTime?: string | undefined;
|
|
21
|
-
}>>;
|
|
16
|
+
export declare const Time: React.ComponentType<TimeProps>;
|
|
22
17
|
export declare const Strong: React.ComponentType<TextProps>;
|
|
23
18
|
export declare const Del: React.ComponentType<TextProps>;
|
|
24
19
|
export declare const EM: React.ComponentType<TextProps>;
|
|
20
|
+
export declare const Span: React.ComponentType<TextProps>;
|
|
25
21
|
export {};
|
|
22
|
+
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/elements/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAO,MAAM,CAAC,gCAEgB,CAAC;AAE/B,eAAO,MAAM,CAAC,gCAEgB,CAAC;AAE/B,eAAO,MAAM,CAAC,gCAEgB,CAAC;AAE/B,eAAO,MAAM,CAAC,gCAEgB,CAAC;AAE/B,eAAO,MAAM,CAAC,iCAMiB,CAAC;AAEhC,eAAO,MAAM,UAAU,sCAEa,CAAC;AAErC,eAAO,MAAM,EAAE,gCAEe,CAAC;AAE/B,eAAO,MAAM,IAAI,gCAEa,CAAC;AAE/B,eAAO,MAAM,IAAI,gCAEa,CAAC;AAM/B,KAAK,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtC,eAAO,MAAM,GAAG,+BAKa,CAAC;AAG9B,eAAO,MAAM,IAAI,gCAEa,CAAC;AAE/B,eAAO,MAAM,MAAM,gCAAI,CAAC;AACxB,eAAO,MAAM,GAAG,gCAAI,CAAC;AACrB,eAAO,MAAM,EAAE,gCAAI,CAAC;AACpB,eAAO,MAAM,IAAI,gCAAO,CAAC"}
|
package/build/elements/Text.js
CHANGED
|
@@ -4,53 +4,54 @@ import { em } from '../css/units';
|
|
|
4
4
|
import Text from '../primitives/Text';
|
|
5
5
|
import View from '../primitives/View';
|
|
6
6
|
export const P = forwardRef(({ style, ...props }, ref) => {
|
|
7
|
-
return
|
|
7
|
+
return <Text {...props} style={[styles.p, style]} ref={ref}/>;
|
|
8
8
|
});
|
|
9
9
|
export const B = forwardRef(({ style, ...props }, ref) => {
|
|
10
|
-
return
|
|
10
|
+
return <Text {...props} style={[styles.b, style]} ref={ref}/>;
|
|
11
11
|
});
|
|
12
12
|
export const S = forwardRef(({ style, ...props }, ref) => {
|
|
13
|
-
return
|
|
13
|
+
return <Text {...props} style={[styles.s, style]} ref={ref}/>;
|
|
14
14
|
});
|
|
15
15
|
export const I = forwardRef(({ style, ...props }, ref) => {
|
|
16
|
-
return
|
|
16
|
+
return <Text {...props} style={[styles.i, style]} ref={ref}/>;
|
|
17
17
|
});
|
|
18
18
|
export const Q = forwardRef(({ children, cite, style, ...props }, ref) => {
|
|
19
|
-
return (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"\""));
|
|
19
|
+
return (<Text {...props} style={[styles.q, style]} ref={ref}>
|
|
20
|
+
"{children}"
|
|
21
|
+
</Text>);
|
|
23
22
|
});
|
|
24
23
|
export const BlockQuote = forwardRef(({ style, cite, ...props }, ref) => {
|
|
25
|
-
return
|
|
24
|
+
return <View {...props} style={[styles.blockQuote, style]} ref={ref}/>;
|
|
26
25
|
});
|
|
27
26
|
export const BR = forwardRef(({ style, ...props }, ref) => {
|
|
28
|
-
return
|
|
27
|
+
return <Text {...props} style={[styles.br, style]} ref={ref}/>;
|
|
29
28
|
});
|
|
30
29
|
export const Mark = forwardRef(({ style, ...props }, ref) => {
|
|
31
|
-
return
|
|
30
|
+
return <Text {...props} style={[styles.mark, style]} ref={ref}/>;
|
|
32
31
|
});
|
|
33
32
|
export const Code = forwardRef(({ style, ...props }, ref) => {
|
|
34
|
-
return
|
|
33
|
+
return <Text {...props} style={[styles.code, style]} ref={ref}/>;
|
|
35
34
|
});
|
|
36
35
|
function isTextProps(props) {
|
|
37
36
|
return typeof props.children === 'string';
|
|
38
37
|
}
|
|
39
38
|
export const Pre = forwardRef((props, ref) => {
|
|
40
39
|
if (isTextProps(props)) {
|
|
41
|
-
return
|
|
40
|
+
return <Text {...props} style={[styles.code, styles.pre, props.style]} ref={ref}/>;
|
|
42
41
|
}
|
|
43
|
-
return
|
|
42
|
+
return <View {...props} style={[styles.pre, props.style]} ref={ref}/>;
|
|
44
43
|
});
|
|
45
44
|
// Extract dateTime to prevent passing it to the native Text element
|
|
46
45
|
export const Time = forwardRef(({ dateTime, ...props }, ref) => {
|
|
47
|
-
return
|
|
46
|
+
return <Text {...props} ref={ref}/>;
|
|
48
47
|
});
|
|
49
48
|
export const Strong = B;
|
|
50
49
|
export const Del = S;
|
|
51
50
|
export const EM = I;
|
|
51
|
+
export const Span = Text;
|
|
52
52
|
const styles = StyleSheet.create({
|
|
53
53
|
p: {
|
|
54
|
+
// @ts-ignore
|
|
54
55
|
marginVertical: em(1),
|
|
55
56
|
},
|
|
56
57
|
b: {
|
|
@@ -60,17 +61,20 @@ const styles = StyleSheet.create({
|
|
|
60
61
|
fontStyle: 'italic',
|
|
61
62
|
},
|
|
62
63
|
code: {
|
|
63
|
-
fontFamily: Platform.select({ default: 'Courier', android: 'monospace' }),
|
|
64
|
+
fontFamily: Platform.select({ default: 'Courier', ios: 'Courier New', android: 'monospace' }),
|
|
64
65
|
fontWeight: '500',
|
|
65
66
|
},
|
|
66
67
|
pre: {
|
|
68
|
+
// @ts-ignore
|
|
67
69
|
marginVertical: em(1),
|
|
68
70
|
},
|
|
69
71
|
blockQuote: {
|
|
72
|
+
// @ts-ignore
|
|
70
73
|
marginVertical: em(1),
|
|
71
74
|
},
|
|
72
75
|
br: {
|
|
73
76
|
width: 0,
|
|
77
|
+
// @ts-ignore
|
|
74
78
|
height: em(0.5),
|
|
75
79
|
},
|
|
76
80
|
s: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/elements/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/elements/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGpD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,IAAmB,MAAM,oBAAoB,CAAC;AACrD,OAAO,IAAmB,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAa,EAAE,GAAG,EAAE,EAAE;IAClE,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;AACjE,CAAC,CAA6B,CAAC;AAE/B,MAAM,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAa,EAAE,GAAG,EAAE,EAAE;IACl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EAAE,MAAM;KACnB;IACD,CAAC,EAAE;QACD,SAAS,EAAE,QAAQ;KACpB;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;QAC7F,UAAU,EAAE,KAAK;KAClB;IACD,GAAG,EAAE;QACH,aAAa;QACb,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC;KACtB;IACD,UAAU,EAAE;QACV,aAAa;QACb,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC;KACtB;IACD,EAAE,EAAE;QACF,KAAK,EAAE,CAAC;QACR,aAAa;QACb,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC;KAChB;IACD,CAAC,EAAE;QACD,kBAAkB,EAAE,cAAc;QAClC,mBAAmB,EAAE,OAAO;KAC7B;IACD,IAAI,EAAE;QACJ,eAAe,EAAE,QAAQ;QACzB,KAAK,EAAE,OAAO;KACf;IACD,CAAC,EAAE;QACD,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC","sourcesContent":["import React, { ComponentType, forwardRef } from 'react';\nimport { StyleSheet, Platform } from 'react-native';\n\nimport { BlockQuoteProps, QuoteProps, TimeProps } from './Text.types';\nimport { em } from '../css/units';\nimport Text, { TextProps } from '../primitives/Text';\nimport View, { ViewProps } from '../primitives/View';\n\nexport const P = forwardRef(({ style, ...props }: TextProps, ref) => {\n return <Text {...props} style={[styles.p, style]} ref={ref} />;\n}) as ComponentType<TextProps>;\n\nexport const B = forwardRef(({ style, ...props }: TextProps, ref) => {\n return <Text {...props} style={[styles.b, style]} ref={ref} />;\n}) as ComponentType<TextProps>;\n\nexport const S = forwardRef(({ style, ...props }: TextProps, ref) => {\n return <Text {...props} style={[styles.s, style]} ref={ref} />;\n}) as ComponentType<TextProps>;\n\nexport const I = forwardRef(({ style, ...props }: TextProps, ref) => {\n return <Text {...props} style={[styles.i, style]} ref={ref} />;\n}) as ComponentType<TextProps>;\n\nexport const Q = forwardRef(({ children, cite, style, ...props }: QuoteProps, ref) => {\n return (\n <Text {...props} style={[styles.q, style]} ref={ref}>\n \"{children}\"\n </Text>\n );\n}) as ComponentType<QuoteProps>;\n\nexport const BlockQuote = forwardRef(({ style, cite, ...props }: BlockQuoteProps, ref) => {\n return <View {...props} style={[styles.blockQuote, style]} ref={ref} />;\n}) as ComponentType<BlockQuoteProps>;\n\nexport const BR = forwardRef(({ style, ...props }: TextProps, ref) => {\n return <Text {...props} style={[styles.br, style]} ref={ref} />;\n}) as ComponentType<TextProps>;\n\nexport const Mark = forwardRef(({ style, ...props }: TextProps, ref) => {\n return <Text {...props} style={[styles.mark, style]} ref={ref} />;\n}) as ComponentType<TextProps>;\n\nexport const Code = forwardRef(({ style, ...props }: TextProps, ref) => {\n return <Text {...props} style={[styles.code, style]} ref={ref} />;\n}) as ComponentType<TextProps>;\n\nfunction isTextProps(props: any): props is TextProps {\n return typeof props.children === 'string';\n}\n\ntype PreProps = TextProps | ViewProps;\n\nexport const Pre = forwardRef((props: PreProps, ref: any) => {\n if (isTextProps(props)) {\n return <Text {...props} style={[styles.code, styles.pre, props.style]} ref={ref} />;\n }\n return <View {...props} style={[styles.pre, props.style]} ref={ref} />;\n}) as ComponentType<PreProps>;\n\n// Extract dateTime to prevent passing it to the native Text element\nexport const Time = forwardRef(({ dateTime, ...props }: TimeProps, ref) => {\n return <Text {...props} ref={ref} />;\n}) as ComponentType<TimeProps>;\n\nexport const Strong = B;\nexport const Del = S;\nexport const EM = I;\nexport const Span = Text;\n\nconst styles = StyleSheet.create({\n p: {\n // @ts-ignore\n marginVertical: em(1),\n },\n b: {\n fontWeight: 'bold',\n },\n q: {\n fontStyle: 'italic',\n },\n code: {\n fontFamily: Platform.select({ default: 'Courier', ios: 'Courier New', android: 'monospace' }),\n fontWeight: '500',\n },\n pre: {\n // @ts-ignore\n marginVertical: em(1),\n },\n blockQuote: {\n // @ts-ignore\n marginVertical: em(1),\n },\n br: {\n width: 0,\n // @ts-ignore\n height: em(0.5),\n },\n s: {\n textDecorationLine: 'line-through',\n textDecorationStyle: 'solid',\n },\n mark: {\n backgroundColor: 'yellow',\n color: 'black',\n },\n i: {\n fontStyle: 'italic',\n },\n});\n"]}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { TextProps } from '../primitives/Text';
|
|
2
2
|
import { ViewProps } from '../primitives/View';
|
|
3
|
-
export
|
|
3
|
+
export type QuoteProps = React.PropsWithChildren<TextProps & {
|
|
4
4
|
cite?: string;
|
|
5
5
|
}>;
|
|
6
|
-
export
|
|
6
|
+
export type BlockQuoteProps = React.PropsWithChildren<ViewProps & {
|
|
7
7
|
cite?: string;
|
|
8
8
|
}>;
|
|
9
|
-
export
|
|
9
|
+
export type TimeProps = React.PropsWithChildren<TextProps & {
|
|
10
10
|
dateTime?: string;
|
|
11
11
|
}>;
|
|
12
|
-
export
|
|
12
|
+
export type LinkProps = React.PropsWithChildren<TextProps & {
|
|
13
13
|
/** @platform web */
|
|
14
14
|
href?: string;
|
|
15
15
|
/** @platform web */
|
|
16
16
|
target?: string;
|
|
17
|
+
/** @platform web */
|
|
18
|
+
rel?: string;
|
|
19
|
+
/** @platform web */
|
|
20
|
+
download?: boolean | string;
|
|
17
21
|
}>;
|
|
22
|
+
//# sourceMappingURL=Text.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.types.d.ts","sourceRoot":"","sources":["../../src/elements/Text.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,iBAAiB,CAAC,SAAS,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEhF,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,iBAAiB,CAAC,SAAS,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAErF,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,iBAAiB,CAAC,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEnF,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,iBAAiB,CAC7C,SAAS,GAAG;IACV,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC7B,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.types.js","sourceRoot":"","sources":["../../src/elements/Text.types.ts"],"names":[],"mappings":"","sourcesContent":["import { TextProps } from '../primitives/Text';\nimport { ViewProps } from '../primitives/View';\n\nexport type QuoteProps = React.PropsWithChildren<TextProps & { cite?: string }>;\n\nexport type BlockQuoteProps = React.PropsWithChildren<ViewProps & { cite?: string }>;\n\nexport type TimeProps = React.PropsWithChildren<TextProps & { dateTime?: string }>;\n\nexport type LinkProps = React.PropsWithChildren<\n TextProps & {\n /** @platform web */\n href?: string;\n /** @platform web */\n target?: string;\n }\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"Text.types.js","sourceRoot":"","sources":["../../src/elements/Text.types.ts"],"names":[],"mappings":"","sourcesContent":["import { TextProps } from '../primitives/Text';\nimport { ViewProps } from '../primitives/View';\n\nexport type QuoteProps = React.PropsWithChildren<TextProps & { cite?: string }>;\n\nexport type BlockQuoteProps = React.PropsWithChildren<ViewProps & { cite?: string }>;\n\nexport type TimeProps = React.PropsWithChildren<TextProps & { dateTime?: string }>;\n\nexport type LinkProps = React.PropsWithChildren<\n TextProps & {\n /** @platform web */\n href?: string;\n /** @platform web */\n target?: string;\n /** @platform web */\n rel?: string;\n /** @platform web */\n download?: boolean | string;\n }\n>;\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ClassAttributes, ComponentProps, ComponentType } from 'react';
|
|
2
|
+
import { Image as NativeImage, ImageStyle as NativeImageStyle, StyleProp } from 'react-native';
|
|
3
|
+
import { WebViewStyle } from './View';
|
|
4
|
+
type NativeImageProps = ComponentProps<typeof NativeImage> & ClassAttributes<typeof NativeImage>;
|
|
5
|
+
export interface WebImageStyle {
|
|
6
|
+
opacity?: number;
|
|
7
|
+
}
|
|
8
|
+
export type ImageStyle = Omit<NativeImageStyle, 'position'> & WebImageStyle & WebViewStyle;
|
|
9
|
+
export type WebImageProps = {
|
|
10
|
+
style?: StyleProp<ImageStyle>;
|
|
11
|
+
/** @platform web */
|
|
12
|
+
tabIndex?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Set whether the image can be dragged with native browser behavior.
|
|
15
|
+
* @platform web
|
|
16
|
+
*/
|
|
17
|
+
draggable?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type ImageProps = Omit<NativeImageProps, 'style'> & WebImageProps;
|
|
20
|
+
declare const _default: ComponentType<ImageProps>;
|
|
21
|
+
export default _default;
|
|
22
|
+
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../src/primitives/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,UAAU,IAAI,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/F,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,KAAK,gBAAgB,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,GAAG,eAAe,CAAC,OAAO,WAAW,CAAC,CAAC;AAEjG,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,GAAG,aAAa,GAAG,YAAY,CAAC;AAE3F,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9B,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,GAAG,aAAa,CAAC;;AAIzE,wBAAwE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../src/primitives/Image.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,WAAW,EAA6C,MAAM,cAAc,CAAC;AAG/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAuBnE,MAAM,KAAK,GAAG,WAAwC,CAAC;AAEvD,eAAe,oBAAoB,CAAC,KAAK,CAA8B,CAAC","sourcesContent":["import { ClassAttributes, ComponentProps, ComponentType } from 'react';\nimport { Image as NativeImage, ImageStyle as NativeImageStyle, StyleProp } from 'react-native';\n\nimport { WebViewStyle } from './View';\nimport { createSafeStyledView } from '../css/createSafeStyledView';\n\ntype NativeImageProps = ComponentProps<typeof NativeImage> & ClassAttributes<typeof NativeImage>;\n\nexport interface WebImageStyle {\n opacity?: number;\n}\n\nexport type ImageStyle = Omit<NativeImageStyle, 'position'> & WebImageStyle & WebViewStyle;\n\nexport type WebImageProps = {\n style?: StyleProp<ImageStyle>;\n /** @platform web */\n tabIndex?: number;\n /**\n * Set whether the image can be dragged with native browser behavior.\n * @platform web\n */\n draggable?: boolean;\n};\n\nexport type ImageProps = Omit<NativeImageProps, 'style'> & WebImageProps;\n\nconst Image = NativeImage as ComponentType<ImageProps>;\n\nexport default createSafeStyledView(Image) as ComponentType<ImageProps>;\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Expo.
|
|
3
|
+
* Copyright (c) Nicolas Gallagher.
|
|
4
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* This is the View from react-native-web copied out in order to supply a custom `__element` property.
|
|
12
|
+
* In the past, you could use `createElement` to create an element with a custom HTML element, but this changed
|
|
13
|
+
* somewhere between 0.14...0.17.
|
|
14
|
+
*/
|
|
15
|
+
declare const View: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<ViewProps>>;
|
|
16
|
+
export default View;
|
|
17
|
+
//# sourceMappingURL=RNWView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RNWView.d.ts","sourceRoot":"","sources":["../../src/primitives/RNWView.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAoC/B;;;;GAIG;AAEH,QAAA,MAAM,IAAI,uGAuFR,CAAC;AA8BH,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Expo.
|
|
3
|
+
* Copyright (c) Nicolas Gallagher.
|
|
4
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import StyleSheet from 'react-native-web/dist/exports/StyleSheet';
|
|
11
|
+
import TextAncestorContext from 'react-native-web/dist/exports/Text/TextAncestorContext';
|
|
12
|
+
import createElement from 'react-native-web/dist/exports/createElement';
|
|
13
|
+
import * as forwardedProps from 'react-native-web/dist/modules/forwardedProps';
|
|
14
|
+
import pick from 'react-native-web/dist/modules/pick';
|
|
15
|
+
import useElementLayout from 'react-native-web/dist/modules/useElementLayout';
|
|
16
|
+
import { useLocaleContext, getLocaleDirection } from 'react-native-web/dist/modules/useLocale';
|
|
17
|
+
import useMergeRefs from 'react-native-web/dist/modules/useMergeRefs';
|
|
18
|
+
import usePlatformMethods from 'react-native-web/dist/modules/usePlatformMethods';
|
|
19
|
+
import useResponderEvents from 'react-native-web/dist/modules/useResponderEvents';
|
|
20
|
+
const forwardPropsList = Object.assign({}, forwardedProps.defaultProps, forwardedProps.accessibilityProps, forwardedProps.clickProps, forwardedProps.defaultProps, forwardedProps.accessibilityProps, forwardedProps.clickProps, forwardedProps.focusProps, forwardedProps.keyboardProps, forwardedProps.mouseProps, forwardedProps.touchProps, forwardedProps.styleProps, {
|
|
21
|
+
href: true,
|
|
22
|
+
lang: true,
|
|
23
|
+
onScroll: true,
|
|
24
|
+
onWheel: true,
|
|
25
|
+
pointerEvents: true,
|
|
26
|
+
});
|
|
27
|
+
const pickProps = (props) => pick(props, forwardPropsList);
|
|
28
|
+
/**
|
|
29
|
+
* This is the View from react-native-web copied out in order to supply a custom `__element` property.
|
|
30
|
+
* In the past, you could use `createElement` to create an element with a custom HTML element, but this changed
|
|
31
|
+
* somewhere between 0.14...0.17.
|
|
32
|
+
*/
|
|
33
|
+
const View = React.forwardRef((props, forwardedRef) => {
|
|
34
|
+
const { __element, hrefAttrs, onLayout, onMoveShouldSetResponder, onMoveShouldSetResponderCapture, onResponderEnd, onResponderGrant, onResponderMove, onResponderReject, onResponderRelease, onResponderStart, onResponderTerminate, onResponderTerminationRequest, onScrollShouldSetResponder, onScrollShouldSetResponderCapture, onSelectionChangeShouldSetResponder, onSelectionChangeShouldSetResponderCapture, onStartShouldSetResponder, onStartShouldSetResponderCapture, ...rest } = props;
|
|
35
|
+
// if (process.env.NODE_ENV !== 'production') {
|
|
36
|
+
// React.Children.toArray(props.children).forEach((item) => {
|
|
37
|
+
// if (typeof item === 'string') {
|
|
38
|
+
// console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
|
|
39
|
+
// }
|
|
40
|
+
// });
|
|
41
|
+
// }
|
|
42
|
+
const hasTextAncestor = React.useContext(TextAncestorContext);
|
|
43
|
+
const hostRef = React.useRef(null);
|
|
44
|
+
const { direction: contextDirection } = useLocaleContext();
|
|
45
|
+
useElementLayout(hostRef, onLayout);
|
|
46
|
+
useResponderEvents(hostRef, {
|
|
47
|
+
onMoveShouldSetResponder,
|
|
48
|
+
onMoveShouldSetResponderCapture,
|
|
49
|
+
onResponderEnd,
|
|
50
|
+
onResponderGrant,
|
|
51
|
+
onResponderMove,
|
|
52
|
+
onResponderReject,
|
|
53
|
+
onResponderRelease,
|
|
54
|
+
onResponderStart,
|
|
55
|
+
onResponderTerminate,
|
|
56
|
+
onResponderTerminationRequest,
|
|
57
|
+
onScrollShouldSetResponder,
|
|
58
|
+
onScrollShouldSetResponderCapture,
|
|
59
|
+
onSelectionChangeShouldSetResponder,
|
|
60
|
+
onSelectionChangeShouldSetResponderCapture,
|
|
61
|
+
onStartShouldSetResponder,
|
|
62
|
+
onStartShouldSetResponderCapture,
|
|
63
|
+
});
|
|
64
|
+
let component = __element ?? 'div';
|
|
65
|
+
const langDirection = props.lang != null ? getLocaleDirection(props.lang) : null;
|
|
66
|
+
const componentDirection = props.dir || langDirection;
|
|
67
|
+
const writingDirection = componentDirection || contextDirection;
|
|
68
|
+
const supportedProps = pickProps(rest);
|
|
69
|
+
supportedProps.dir = componentDirection;
|
|
70
|
+
supportedProps.style = [styles.view$raw, hasTextAncestor && styles.inline, props.style];
|
|
71
|
+
if (props.href != null) {
|
|
72
|
+
component = 'a';
|
|
73
|
+
if (hrefAttrs != null) {
|
|
74
|
+
const { download, rel, target } = hrefAttrs;
|
|
75
|
+
if (download != null) {
|
|
76
|
+
supportedProps.download = download;
|
|
77
|
+
}
|
|
78
|
+
if (rel != null) {
|
|
79
|
+
supportedProps.rel = rel;
|
|
80
|
+
}
|
|
81
|
+
if (typeof target === 'string') {
|
|
82
|
+
supportedProps.target = target.charAt(0) !== '_' ? '_' + target : target;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const platformMethodsRef = usePlatformMethods(supportedProps);
|
|
87
|
+
const setRef = useMergeRefs(hostRef, platformMethodsRef, forwardedRef);
|
|
88
|
+
supportedProps.ref = setRef;
|
|
89
|
+
return createElement(component, supportedProps, { writingDirection });
|
|
90
|
+
});
|
|
91
|
+
if (__DEV__) {
|
|
92
|
+
View.displayName = 'View';
|
|
93
|
+
}
|
|
94
|
+
const styles = StyleSheet.create({
|
|
95
|
+
view$raw: {
|
|
96
|
+
alignItems: 'stretch',
|
|
97
|
+
backgroundColor: 'transparent',
|
|
98
|
+
border: '0 solid black',
|
|
99
|
+
boxSizing: 'border-box',
|
|
100
|
+
display: 'flex',
|
|
101
|
+
flexBasis: 'auto',
|
|
102
|
+
flexDirection: 'column',
|
|
103
|
+
flexShrink: 0,
|
|
104
|
+
listStyle: 'none',
|
|
105
|
+
margin: 0,
|
|
106
|
+
minHeight: 0,
|
|
107
|
+
minWidth: 0,
|
|
108
|
+
padding: 0,
|
|
109
|
+
position: 'relative',
|
|
110
|
+
textDecoration: 'none',
|
|
111
|
+
zIndex: 0,
|
|
112
|
+
},
|
|
113
|
+
inline: {
|
|
114
|
+
display: 'inline-flex',
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
export default View;
|
|
118
|
+
//# sourceMappingURL=RNWView.js.map
|