@hozo/typography 0.1.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/LICENSE +21 -0
- package/README.md +162 -0
- package/dist/fonts-expo.d.ts +27 -0
- package/dist/fonts-expo.d.ts.map +1 -0
- package/dist/fonts-expo.js +63 -0
- package/dist/fonts-expo.js.map +1 -0
- package/dist/fonts-native.d.ts +28 -0
- package/dist/fonts-native.d.ts.map +1 -0
- package/dist/fonts-native.js +47 -0
- package/dist/fonts-native.js.map +1 -0
- package/dist/fonts.d.ts +62 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +172 -0
- package/dist/fonts.js.map +1 -0
- package/dist/generated/ruby.d.ts +2 -0
- package/dist/generated/ruby.d.ts.map +1 -0
- package/dist/generated/ruby.js +2 -0
- package/dist/generated/ruby.js.map +1 -0
- package/dist/generated/ruby.native.d.ts +2 -0
- package/dist/generated/ruby.native.d.ts.map +1 -0
- package/dist/generated/ruby.native.js +2 -0
- package/dist/generated/ruby.native.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/index.native.d.ts +82 -0
- package/dist/index.native.d.ts.map +1 -0
- package/dist/index.native.js +136 -0
- package/dist/index.native.js.map +1 -0
- package/dist/ruby.native.d.ts +43 -0
- package/dist/ruby.native.d.ts.map +1 -0
- package/dist/ruby.native.js +50 -0
- package/dist/ruby.native.js.map +1 -0
- package/dist/text-size.d.ts +35 -0
- package/dist/text-size.d.ts.map +1 -0
- package/dist/text-size.js +40 -0
- package/dist/text-size.js.map +1 -0
- package/package.json +93 -0
- package/src/fonts-expo.ts +90 -0
- package/src/fonts-native.ts +85 -0
- package/src/fonts.ts +240 -0
- package/src/generated/ruby.native.ts +6 -0
- package/src/generated/ruby.ts +1 -0
- package/src/index.native.tsx +240 -0
- package/src/index.tsx +152 -0
- package/src/ruby.native.tsx +91 -0
- package/src/text-size.ts +41 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruby.native.js","sourceRoot":"","sources":["../../src/generated/ruby.native.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,YAAY,GAEb,MAAM,mBAAoB,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Link, type LinkProps, Text, type TextProps } from '@hozo/primitives';
|
|
2
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
export { Link, type LinkProps, Text, type TextProps };
|
|
4
|
+
export interface TypographyUniversalProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
testID?: string;
|
|
9
|
+
nativeID?: string;
|
|
10
|
+
accessibilityLabel?: string;
|
|
11
|
+
accessibilityHint?: string;
|
|
12
|
+
'aria-hidden'?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type SemanticTextProps = TypographyUniversalProps;
|
|
15
|
+
export interface HeadingProps extends TypographyUniversalProps {
|
|
16
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
17
|
+
}
|
|
18
|
+
export declare function Paragraph({ className, children, style, ...props }: SemanticTextProps): import("react").JSX.Element;
|
|
19
|
+
export declare function Heading({ level, className, children, style, ...props }: HeadingProps): import("react").JSX.Element;
|
|
20
|
+
export declare function Strong({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
21
|
+
export declare function Emphasis({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
22
|
+
export declare function Underline({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
23
|
+
export declare function Strikethrough({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
24
|
+
export declare const Del: typeof Strikethrough;
|
|
25
|
+
export declare function Sub({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
26
|
+
export declare function Sup({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
27
|
+
export declare function Code({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
28
|
+
export declare function Small({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
29
|
+
export declare function Mark({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
30
|
+
export declare function NoBreak({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
31
|
+
export declare function Ruby({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
32
|
+
export declare namespace Ruby {
|
|
33
|
+
export { RubyText };
|
|
34
|
+
}
|
|
35
|
+
export declare function RubyText({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,CAAA;AAErD,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,MAA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KAAK,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,+BAMvF;AAED,wBAAgB,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,+BAMtF;AAED,wBAAgB,OAAO,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,+BAMzF;AAED,wBAAgB,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,+BAMtF;yBANe,IAAI;;;AAQpB,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,+BAM1F"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Link, Text } from '@hozo/primitives';
|
|
3
|
+
export { Link, Text };
|
|
4
|
+
function domProps(props) {
|
|
5
|
+
return {
|
|
6
|
+
'data-testid': props.testID,
|
|
7
|
+
id: props.nativeID,
|
|
8
|
+
'aria-label': props.accessibilityLabel,
|
|
9
|
+
'aria-description': props.accessibilityHint,
|
|
10
|
+
'aria-hidden': props['aria-hidden'],
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function Paragraph({ className, children, style, ...props }) {
|
|
14
|
+
return (_jsx("p", { className: className, style: style, ...domProps(props), children: children }));
|
|
15
|
+
}
|
|
16
|
+
export function Heading({ level = 1, className, children, style, ...props }) {
|
|
17
|
+
const Tag = `h${Math.min(6, Math.max(1, level))}`;
|
|
18
|
+
return (_jsx(Tag, { className: className, style: style, ...domProps(props), children: children }));
|
|
19
|
+
}
|
|
20
|
+
export function Strong({ className, children, style, ...props }) {
|
|
21
|
+
return (_jsx("strong", { className: className, style: style, ...domProps(props), children: children }));
|
|
22
|
+
}
|
|
23
|
+
export function Emphasis({ className, children, style, ...props }) {
|
|
24
|
+
return (_jsx("em", { className: className, style: style, ...domProps(props), children: children }));
|
|
25
|
+
}
|
|
26
|
+
export function Underline({ className, children, style, ...props }) {
|
|
27
|
+
return (_jsx("u", { className: className, style: style, ...domProps(props), children: children }));
|
|
28
|
+
}
|
|
29
|
+
export function Strikethrough({ className, children, style, ...props }) {
|
|
30
|
+
return (_jsx("s", { className: className, style: style, ...domProps(props), children: children }));
|
|
31
|
+
}
|
|
32
|
+
export const Del = Strikethrough;
|
|
33
|
+
export function Sub({ className, children, style, ...props }) {
|
|
34
|
+
return (_jsx("sub", { className: className, style: style, ...domProps(props), children: children }));
|
|
35
|
+
}
|
|
36
|
+
export function Sup({ className, children, style, ...props }) {
|
|
37
|
+
return (_jsx("sup", { className: className, style: style, ...domProps(props), children: children }));
|
|
38
|
+
}
|
|
39
|
+
export function Code({ className, children, style, ...props }) {
|
|
40
|
+
return (_jsx("code", { className: className, style: style, ...domProps(props), children: children }));
|
|
41
|
+
}
|
|
42
|
+
export function Small({ className, children, style, ...props }) {
|
|
43
|
+
return (_jsx("small", { className: className, style: style, ...domProps(props), children: children }));
|
|
44
|
+
}
|
|
45
|
+
export function Mark({ className, children, style, ...props }) {
|
|
46
|
+
return (_jsx("mark", { className: className, style: style, ...domProps(props), children: children }));
|
|
47
|
+
}
|
|
48
|
+
export function NoBreak({ className, children, style, ...props }) {
|
|
49
|
+
return (_jsx("span", { className: className, style: { whiteSpace: 'nowrap', ...style }, ...domProps(props), children: children }));
|
|
50
|
+
}
|
|
51
|
+
export function Ruby({ className, children, style, ...props }) {
|
|
52
|
+
return (_jsx("ruby", { className: className, style: style, ...domProps(props), children: children }));
|
|
53
|
+
}
|
|
54
|
+
export function RubyText({ className, children, style, ...props }) {
|
|
55
|
+
return (_jsx("rt", { className: className, style: style, ...domProps(props), children: children }));
|
|
56
|
+
}
|
|
57
|
+
// Both spellings, the way `TermList` reads both. The member keeps the
|
|
58
|
+
// full name rather than shortening to `Text`: a flat export has to be
|
|
59
|
+
// readable on its own, and a `<Text>` that meant the annotation would
|
|
60
|
+
// not be. The compiler recognises the pair in `hozo_parser`.
|
|
61
|
+
Ruby.RubyText = RubyText;
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,IAAI,EAAkB,MAAM,kBAAkB,CAAA;AAG7E,OAAO,EAAE,IAAI,EAAkB,IAAI,EAAkB,CAAA;AAmBrD,SAAS,QAAQ,CAAC,KAAyE;IACzF,OAAO;QACL,aAAa,EAAE,KAAK,CAAC,MAAM;QAC3B,EAAE,EAAE,KAAK,CAAC,QAAQ;QAClB,YAAY,EAAE,KAAK,CAAC,kBAAkB;QACtC,kBAAkB,EAAE,KAAK,CAAC,iBAAiB;QAC3C,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC;KACpC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAqB;IACnF,OAAO,CACL,YAAG,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAM,QAAQ,CAAC,KAAK,CAAC,YACvD,QAAQ,GACP,CACL,CAAA;AACH,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAgB;IACvF,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAA6C,CAAA;IAC5F,OAAO,CACL,KAAC,GAAG,IAAC,SAAS,EAAE,SAAS,EAAE,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,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAA4B;IACrF,OAAO,CACL,eAAM,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAM,QAAQ,CAAC,KAAK,CAAC,YAC1D,QAAQ,GACJ,CACR,CAAA;AACH,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAA4B;IACzF,OAAO,CACL,aAAI,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAM,QAAQ,CAAC,KAAK,CAAC,YACxD,QAAQ,GACN,CACN,CAAA;AACH,CAAC;AAED,sEAAsE;AACtE,sEAAsE;AACtE,sEAAsE;AACtE,6DAA6D;AAC7D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Link, Text } from '@hozo/primitives';
|
|
2
|
+
import React, { type ReactNode } from 'react';
|
|
3
|
+
import type { AccessibilityRole, StyleProp, TextStyle } from 'react-native';
|
|
4
|
+
export { BARE_TEXT_SIZE_RATIOS, TEXT_SIZE_RATIOS } from './text-size.ts';
|
|
5
|
+
export { Link, Text };
|
|
6
|
+
export interface TypographyNativeProps {
|
|
7
|
+
/**
|
|
8
|
+
* Tailwind classes, read by the compiler and gone by runtime.
|
|
9
|
+
*
|
|
10
|
+
* The Web half of this file has always declared it; this half never
|
|
11
|
+
* did, and nothing noticed because the `react-native` export condition
|
|
12
|
+
* carried no `types`, so a React Native app was type-checked against
|
|
13
|
+
* the Web declarations instead. Uncompiled, the prop is simply ignored
|
|
14
|
+
* here -- which is what the fallback components are for.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* React Native's own types rather than `any` and `string`.
|
|
20
|
+
*
|
|
21
|
+
* The Web half of this file says `CSSProperties`. This half agreed with
|
|
22
|
+
* anything, so a Web-only style reached a native `Text` in silence --
|
|
23
|
+
* the same erasure `@hozo/tailwind-conformance` exists to catch one
|
|
24
|
+
* layer down.
|
|
25
|
+
*/
|
|
26
|
+
style?: StyleProp<TextStyle>;
|
|
27
|
+
testID?: string;
|
|
28
|
+
nativeID?: string;
|
|
29
|
+
accessibilityLabel?: string;
|
|
30
|
+
accessibilityHint?: string;
|
|
31
|
+
accessibilityRole?: AccessibilityRole;
|
|
32
|
+
accessible?: boolean;
|
|
33
|
+
numberOfLines?: number;
|
|
34
|
+
ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';
|
|
35
|
+
}
|
|
36
|
+
export type TypographyUniversalProps = TypographyNativeProps;
|
|
37
|
+
export type TextProps = TypographyNativeProps;
|
|
38
|
+
export type SemanticTextProps = TypographyNativeProps;
|
|
39
|
+
export interface HeadingProps extends TypographyNativeProps {
|
|
40
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
41
|
+
}
|
|
42
|
+
/** Native declaration for the Link value re-exported from primitives. */
|
|
43
|
+
export interface LinkProps extends TypographyNativeProps {
|
|
44
|
+
href: string;
|
|
45
|
+
external?: boolean;
|
|
46
|
+
replace?: boolean;
|
|
47
|
+
prefetch?: boolean;
|
|
48
|
+
target?: string;
|
|
49
|
+
rel?: string;
|
|
50
|
+
download?: boolean | string;
|
|
51
|
+
onPress?: (event: {
|
|
52
|
+
defaultPrevented?: boolean;
|
|
53
|
+
}) => void;
|
|
54
|
+
}
|
|
55
|
+
export declare function Paragraph(props: SemanticTextProps): React.JSX.Element;
|
|
56
|
+
export declare function Heading({ level, accessibilityRole, style, ...props }: HeadingProps): React.JSX.Element;
|
|
57
|
+
export declare function Strong({ style, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
58
|
+
export declare function Emphasis({ style, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
59
|
+
export declare function Underline({ style, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
60
|
+
export declare function Strikethrough({ style, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
61
|
+
export declare const Del: typeof Strikethrough;
|
|
62
|
+
export declare function Sub({ style, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
63
|
+
export declare function Sup({ style, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
64
|
+
export declare function Code({ style, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
65
|
+
export declare function Small({ style, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
66
|
+
export declare function Mark({ style, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
67
|
+
export declare function NoBreak({ children, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
68
|
+
/**
|
|
69
|
+
* Ruby, sharing the pair the Native backend emits.
|
|
70
|
+
*
|
|
71
|
+
* React Native flattens nested `Text` into one accessibility node, so a
|
|
72
|
+
* screen reader read the base and then the reading: 「漢字かんじ」. The
|
|
73
|
+
* `accessible={false}` that used to be on the annotation could not stop
|
|
74
|
+
* it -- the flattening happens above, and the parent's label is built
|
|
75
|
+
* from the text it contains whatever the children say about themselves.
|
|
76
|
+
*/
|
|
77
|
+
export declare function Ruby({ children, accessibilityLabel, style, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
78
|
+
export declare namespace Ruby {
|
|
79
|
+
export { RubyText };
|
|
80
|
+
}
|
|
81
|
+
export declare function RubyText({ style, children, ...props }: TypographyNativeProps): React.JSX.Element;
|
|
82
|
+
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../src/index.native.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,EAAuB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AAS9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EA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,IAAI,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAM5F;yBANe,IAAI;;;AAQpB,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAY5E"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { HozoTextSizeContext } from '@hozo/engine';
|
|
3
|
+
import { hozoPreflight } from '@hozo/engine/project';
|
|
4
|
+
import { Link, Text } from '@hozo/primitives';
|
|
5
|
+
import React, { useContext } from 'react';
|
|
6
|
+
import { HozoRuby, HozoRubyText } from './ruby.native.js';
|
|
7
|
+
import { BARE_TEXT_SIZE_RATIOS, TEXT_SIZE_RATIOS } from './text-size.js';
|
|
8
|
+
export { BARE_TEXT_SIZE_RATIOS, TEXT_SIZE_RATIOS } from './text-size.js';
|
|
9
|
+
export { Link, Text };
|
|
10
|
+
/**
|
|
11
|
+
* The size the text around this is drawn at.
|
|
12
|
+
*
|
|
13
|
+
* `@hozo/engine`'s, not one of this package's own. The compiler emits
|
|
14
|
+
* `HozoTextSize` for an element whose size it could not read, and that
|
|
15
|
+
* publishes into this context -- so a compiled ancestor and one of the
|
|
16
|
+
* components below, rendered uncompiled, agree about the base. Two
|
|
17
|
+
* contexts would have been two answers.
|
|
18
|
+
*
|
|
19
|
+
* React Native offers nothing to build this on. Its `fontSize` is a
|
|
20
|
+
* number of points with no relative unit, a nested `Text` inherits
|
|
21
|
+
* visually but cannot read what it inherited, and the only ancestor
|
|
22
|
+
* context the platform exposes -- `TextAncestorContext` -- is a boolean
|
|
23
|
+
* saying whether there is a `Text` above at all.
|
|
24
|
+
*
|
|
25
|
+
* The default is React Native's own, and the constants this replaced --
|
|
26
|
+
* 11, 11, 12 -- are exactly the ratios applied to it.
|
|
27
|
+
*/
|
|
28
|
+
const TextSize = HozoTextSizeContext;
|
|
29
|
+
const NativeText = Text;
|
|
30
|
+
function relative(ratio, base) {
|
|
31
|
+
return Math.round(base * ratio);
|
|
32
|
+
}
|
|
33
|
+
export function Paragraph(props) {
|
|
34
|
+
return _jsx(NativeText, { ...props });
|
|
35
|
+
}
|
|
36
|
+
export function Heading({ level = 1, accessibilityRole = 'header', style, ...props }) {
|
|
37
|
+
// Preflight resets headings to inherited size and weight. Without it,
|
|
38
|
+
// reproduce the browser's heading defaults that Native does not have.
|
|
39
|
+
const base = useContext(TextSize);
|
|
40
|
+
const ratio = BARE_TEXT_SIZE_RATIOS.heading[Math.min(6, Math.max(1, level)) - 1];
|
|
41
|
+
const defaultStyle = hozoPreflight
|
|
42
|
+
? undefined
|
|
43
|
+
: { fontSize: relative(ratio, base), fontWeight: 'bold' };
|
|
44
|
+
return (_jsx(NativeText, { accessibilityRole: accessibilityRole, style: [defaultStyle, style], ...props }));
|
|
45
|
+
}
|
|
46
|
+
export function Strong({ style, ...props }) {
|
|
47
|
+
return _jsx(NativeText, { style: [{ fontWeight: 'bold' }, style], ...props });
|
|
48
|
+
}
|
|
49
|
+
export function Emphasis({ style, ...props }) {
|
|
50
|
+
return _jsx(NativeText, { style: [{ fontStyle: 'italic' }, style], ...props });
|
|
51
|
+
}
|
|
52
|
+
export function Underline({ style, ...props }) {
|
|
53
|
+
return _jsx(NativeText, { style: [{ textDecorationLine: 'underline' }, style], ...props });
|
|
54
|
+
}
|
|
55
|
+
export function Strikethrough({ style, ...props }) {
|
|
56
|
+
return _jsx(NativeText, { style: [{ textDecorationLine: 'line-through' }, style], ...props });
|
|
57
|
+
}
|
|
58
|
+
export const Del = Strikethrough;
|
|
59
|
+
export function Sub({ style, ...props }) {
|
|
60
|
+
const base = useContext(TextSize);
|
|
61
|
+
const ratios = hozoPreflight ? TEXT_SIZE_RATIOS : BARE_TEXT_SIZE_RATIOS;
|
|
62
|
+
return _jsx(NativeText, { style: [{ fontSize: relative(ratios.sub, base) }, style], ...props });
|
|
63
|
+
}
|
|
64
|
+
export function Sup({ style, ...props }) {
|
|
65
|
+
const base = useContext(TextSize);
|
|
66
|
+
const ratios = hozoPreflight ? TEXT_SIZE_RATIOS : BARE_TEXT_SIZE_RATIOS;
|
|
67
|
+
return _jsx(NativeText, { style: [{ fontSize: relative(ratios.sup, base) }, style], ...props });
|
|
68
|
+
}
|
|
69
|
+
export function Code({ style, ...props }) {
|
|
70
|
+
return _jsx(NativeText, { style: [{ fontFamily: 'monospace' }, style], ...props });
|
|
71
|
+
}
|
|
72
|
+
export function Small({ style, ...props }) {
|
|
73
|
+
const base = useContext(TextSize);
|
|
74
|
+
const ratios = hozoPreflight ? TEXT_SIZE_RATIOS : BARE_TEXT_SIZE_RATIOS;
|
|
75
|
+
return (_jsx(NativeText, { style: [{ fontSize: relative(ratios.small, base), opacity: 0.8 }, style], ...props }));
|
|
76
|
+
}
|
|
77
|
+
export function Mark({ style, ...props }) {
|
|
78
|
+
return _jsx(NativeText, { style: [{ backgroundColor: '#fef08a' }, style], ...props });
|
|
79
|
+
}
|
|
80
|
+
/** Recursively replaces normal spaces with Unicode non-breaking spaces (\u00A0) */
|
|
81
|
+
function replaceSpacesWithNbsp(node) {
|
|
82
|
+
if (typeof node === 'string') {
|
|
83
|
+
return node.replace(/ /g, '\u00A0');
|
|
84
|
+
}
|
|
85
|
+
if (Array.isArray(node)) {
|
|
86
|
+
return React.Children.map(node, replaceSpacesWithNbsp);
|
|
87
|
+
}
|
|
88
|
+
if (React.isValidElement(node)) {
|
|
89
|
+
const element = node;
|
|
90
|
+
if (element.props?.children) {
|
|
91
|
+
return React.cloneElement(element, {
|
|
92
|
+
children: replaceSpacesWithNbsp(element.props.children),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return node;
|
|
97
|
+
}
|
|
98
|
+
export function NoBreak({ children, ...props }) {
|
|
99
|
+
return _jsx(NativeText, { ...props, children: replaceSpacesWithNbsp(children) });
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A Native style handed over as if it were a Web one -- a resolver's
|
|
103
|
+
* limit rather than a claim about the value.
|
|
104
|
+
*
|
|
105
|
+
* A package resolves `@hozo/engine`'s types through the Web entry
|
|
106
|
+
* whichever platform it is building for, because `exports` carries a
|
|
107
|
+
* single `types` and this package compiles both halves in one `tsc` run.
|
|
108
|
+
* So these are seen with `style?: CSSProperties` here while the module
|
|
109
|
+
* Metro loads takes `StyleProp<TextStyle>`. `@hozo/semantics` has the
|
|
110
|
+
* same line for the same reason.
|
|
111
|
+
*/
|
|
112
|
+
const asWeb = (style) => style;
|
|
113
|
+
/**
|
|
114
|
+
* Ruby, sharing the pair the Native backend emits.
|
|
115
|
+
*
|
|
116
|
+
* React Native flattens nested `Text` into one accessibility node, so a
|
|
117
|
+
* screen reader read the base and then the reading: 「漢字かんじ」. The
|
|
118
|
+
* `accessible={false}` that used to be on the annotation could not stop
|
|
119
|
+
* it -- the flattening happens above, and the parent's label is built
|
|
120
|
+
* from the text it contains whatever the children say about themselves.
|
|
121
|
+
*/
|
|
122
|
+
export function Ruby({ children, accessibilityLabel, style, ...props }) {
|
|
123
|
+
return (_jsx(HozoRuby, { accessibilityLabel: accessibilityLabel, style: asWeb(style), ...props, children: children }));
|
|
124
|
+
}
|
|
125
|
+
export function RubyText({ style, children, ...props }) {
|
|
126
|
+
// Half the size of the text it annotates, against the size `Text`
|
|
127
|
+
// published; `fontSize: '0.65em'` was here and React Native ignored it.
|
|
128
|
+
const base = useContext(TextSize);
|
|
129
|
+
return (_jsx(HozoRubyText, { style: asWeb([{ fontSize: relative(TEXT_SIZE_RATIOS.rubyText, base), opacity: 0.85 }, style]), ...props, children: children }));
|
|
130
|
+
}
|
|
131
|
+
// Both spellings, the way `TermList` reads both. The member keeps the
|
|
132
|
+
// full name rather than shortening to `Text`: a flat export has to be
|
|
133
|
+
// readable on its own, and a `<Text>` that meant the annotation would
|
|
134
|
+
// not be. The compiler recognises the pair in `hozo_parser`.
|
|
135
|
+
Ruby.RubyText = RubyText;
|
|
136
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,EAAuC,UAAU,EAAE,MAAM,OAAO,CAAA;AAU9E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAmB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAExE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;AAwDrB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,QAAQ,GAAG,mBAAmB,CAAA;AACpC,MAAM,UAAU,GAAG,IAA6D,CAAA;AAEhF,SAAS,QAAQ,CAAC,KAAa,EAAE,IAAY;IAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,CAAA;AACjC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAwB;IAChD,OAAO,KAAC,UAAU,OAAK,KAAK,GAAI,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,EACtB,KAAK,GAAG,CAAC,EACT,iBAAiB,GAAG,QAAQ,EAC5B,KAAK,EACL,GAAG,KAAK,EACK;IACb,sEAAsE;IACtE,sEAAsE;IACtE,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAA;IACjC,MAAM,KAAK,GAAG,qBAAqB,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC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AC;AAED;;;;;;;;;;GAUG;AACH,MAAM,KAAK,GAAG,CAAC,KAAqC,EAAE,EAAE,CACtD,KAA4D,CAAA;AAC9D;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,KAAK,EAAyB;IAC3F,OAAO,CACL,KAAC,QAAQ,IAAC,kBAAkB,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAM,KAAK,YAC7E,QAAQ,GACA,CACZ,CAAA;AACH,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAyB;IAC3E,kEAAkE;IAClE,wEAAwE;IACxE,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAA;IACjC,OAAO,CACL,KAAC,YAAY,IACX,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,KACzF,KAAK,YAER,QAAQ,GACI,CAChB,CAAA;AACH,CAAC;AACD,sEAAsE;AACtE,sEAAsE;AACtE,sEAAsE;AACtE,6DAA6D;AAC7D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type StyleProp, type TextStyle } from 'react-native';
|
|
3
|
+
export interface HozoRubyProps {
|
|
4
|
+
/**
|
|
5
|
+
* Tailwind classes, the same prop the Web half takes.
|
|
6
|
+
*
|
|
7
|
+
* On a tag the compiler lowers it is gone by runtime, replaced by a
|
|
8
|
+
* `StyleSheet` entry. Anywhere else it is carried and ignored here --
|
|
9
|
+
* this side has no CSS engine to resolve a class list against -- and
|
|
10
|
+
* the type still has to accept it, because an app is type-checked
|
|
11
|
+
* against the source the compiler reads rather than its output.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
/** The author's own, which wins: they know what the word is. */
|
|
16
|
+
accessibilityLabel?: string;
|
|
17
|
+
style?: StyleProp<TextStyle>;
|
|
18
|
+
testID?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface HozoRubyTextProps {
|
|
21
|
+
/**
|
|
22
|
+
* Tailwind classes, the same prop the Web half takes.
|
|
23
|
+
*
|
|
24
|
+
* On a tag the compiler lowers it is gone by runtime, replaced by a
|
|
25
|
+
* `StyleSheet` entry. Anywhere else it is carried and ignored here --
|
|
26
|
+
* this side has no CSS engine to resolve a class list against -- and
|
|
27
|
+
* the type still has to accept it, because an app is type-checked
|
|
28
|
+
* against the source the compiler reads rather than its output.
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
style?: StyleProp<TextStyle>;
|
|
33
|
+
testID?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The reading, and the half that must not be announced.
|
|
37
|
+
*
|
|
38
|
+
* Declared before `HozoRuby` because that one compares against it by
|
|
39
|
+
* identity to decide what the word is.
|
|
40
|
+
*/
|
|
41
|
+
export declare function HozoRubyText({ children, ...props }: HozoRubyTextProps): import("react").JSX.Element;
|
|
42
|
+
export declare function HozoRuby({ children, accessibilityLabel, ...props }: HozoRubyProps): import("react").JSX.Element;
|
|
43
|
+
//# sourceMappingURL=ruby.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruby.native.d.ts","sourceRoot":"","sources":["../src/ruby.native.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAEnE,MAAM,WAAW,aAAa;IAC5B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,+BAMrE;AAeD,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,+BAOjF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Ruby that is read once.
|
|
3
|
+
//
|
|
4
|
+
// `<ruby>漢字<rt>かんじ</rt></ruby>` on the Web is one element a browser
|
|
5
|
+
// knows how to announce. React Native has no ruby layout, so both halves
|
|
6
|
+
// are `Text` -- and nested `Text` is flattened into a single
|
|
7
|
+
// accessibility node, so a screen reader reads the base and then the
|
|
8
|
+
// reading: 「漢字かんじ」. The word twice, the second time spelled out.
|
|
9
|
+
//
|
|
10
|
+
// `accessible={false}` on the annotation does not help, because the
|
|
11
|
+
// flattening happens above it: the parent's label is built from the text
|
|
12
|
+
// it contains, whatever the children say about themselves. The lever that
|
|
13
|
+
// does work is the parent's own `accessibilityLabel`, which replaces the
|
|
14
|
+
// children rather than being assembled from them.
|
|
15
|
+
//
|
|
16
|
+
// The compiler writes that label itself when the base text is static,
|
|
17
|
+
// which is most ruby. This pair is for when it is not -- the same
|
|
18
|
+
// arrangement `HozoRelativeText` has, and the same reason: a value only
|
|
19
|
+
// React Native can see.
|
|
20
|
+
import { Children, isValidElement } from 'react';
|
|
21
|
+
import { Text } from 'react-native';
|
|
22
|
+
/**
|
|
23
|
+
* The reading, and the half that must not be announced.
|
|
24
|
+
*
|
|
25
|
+
* Declared before `HozoRuby` because that one compares against it by
|
|
26
|
+
* identity to decide what the word is.
|
|
27
|
+
*/
|
|
28
|
+
export function HozoRubyText({ children, ...props }) {
|
|
29
|
+
return (_jsx(Text, { accessible: false, ...props, children: children }));
|
|
30
|
+
}
|
|
31
|
+
/** Every string under a node, with the readings left out. */
|
|
32
|
+
function baseText(children) {
|
|
33
|
+
return Children.toArray(children)
|
|
34
|
+
.map((child) => {
|
|
35
|
+
if (typeof child === 'string' || typeof child === 'number')
|
|
36
|
+
return String(child);
|
|
37
|
+
if (!isValidElement(child))
|
|
38
|
+
return '';
|
|
39
|
+
if (child.type === HozoRubyText)
|
|
40
|
+
return '';
|
|
41
|
+
const nested = child.props.children;
|
|
42
|
+
return nested === undefined ? '' : baseText(nested);
|
|
43
|
+
})
|
|
44
|
+
.join('');
|
|
45
|
+
}
|
|
46
|
+
export function HozoRuby({ children, accessibilityLabel, ...props }) {
|
|
47
|
+
const label = accessibilityLabel ?? baseText(children);
|
|
48
|
+
return (_jsx(Text, { accessibilityLabel: label === '' ? undefined : label, ...props, children: children }));
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=ruby.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruby.native.js","sourceRoot":"","sources":["../src/ruby.native.tsx"],"names":[],"mappings":";AAAA,0BAA0B;AAC1B,EAAE;AACF,oEAAoE;AACpE,yEAAyE;AACzE,6DAA6D;AAC7D,qEAAqE;AACrE,iEAAiE;AACjE,EAAE;AACF,oEAAoE;AACpE,yEAAyE;AACzE,0EAA0E;AAC1E,yEAAyE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CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,KAAM,KAAK,YAClE,QAAQ,GACJ,CACR,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How much smaller than the text around it each of these draws.
|
|
3
|
+
*
|
|
4
|
+
* The same table the compiler applies in `crates/hozo_native/src/text.rs`,
|
|
5
|
+
* and `ratios.test.ts` reads that file to check the two still agree. Two
|
|
6
|
+
* copies of a number is how a compiled build and an uncompiled one come
|
|
7
|
+
* to render the same source at different sizes -- which is what the
|
|
8
|
+
* constants these replace were already doing.
|
|
9
|
+
*
|
|
10
|
+
* These are the numbers a project shipping Tailwind's preflight renders,
|
|
11
|
+
* which is what `preflight: 'auto'` gives anything using Tailwind. The
|
|
12
|
+
* bare user agent is a second set below. `@hozo/metro` carries the resolved
|
|
13
|
+
* choice through `@hozo/engine/project`, so the compiler and fallback
|
|
14
|
+
* components select the same table (#336).
|
|
15
|
+
*
|
|
16
|
+
* `small` was 0.85 here and in the compiler, and 0.85 is neither number.
|
|
17
|
+
* Measured in headless Chrome at bases 16, 20 and 32: 0.80 with the
|
|
18
|
+
* reset, 0.8333 without it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const TEXT_SIZE_RATIOS: {
|
|
21
|
+
readonly sub: 0.75;
|
|
22
|
+
readonly sup: 0.75;
|
|
23
|
+
readonly small: 0.8;
|
|
24
|
+
readonly rubyText: 0.5;
|
|
25
|
+
readonly heading: readonly [2, 1.5, 1.17, 1, 0.83, 0.67];
|
|
26
|
+
};
|
|
27
|
+
/** Browser defaults when the project deliberately ships no reset. */
|
|
28
|
+
export declare const BARE_TEXT_SIZE_RATIOS: {
|
|
29
|
+
readonly sub: number;
|
|
30
|
+
readonly sup: number;
|
|
31
|
+
readonly small: number;
|
|
32
|
+
readonly rubyText: 0.5;
|
|
33
|
+
readonly heading: readonly [2, 1.5, 1.17, 1, 0.83, 0.67];
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=text-size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-size.d.ts","sourceRoot":"","sources":["../src/text-size.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB;aAC3B,GAAG,EAAE,IAAI;aACT,GAAG,EAAE,IAAI;aACT,KAAK,EAAE,GAAG;aACV,QAAQ,EAAE,GAAG;aACb,OAAO,YAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI;CAC7B,CAAA;AAEV,qEAAqE;AACrE,eAAO,MAAM,qBAAqB;aAChC,GAAG;aACH,GAAG;aACH,KAAK;aACL,QAAQ,EAAE,GAAG;aACb,OAAO;CACC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// The ratio table, kept in a file with no React Native in it.
|
|
2
|
+
//
|
|
3
|
+
// `ratios.test.ts` checks these against the compiler's copy, and a Node
|
|
4
|
+
// test cannot import `index.native.tsx`: React Native ships Flow-typed
|
|
5
|
+
// JavaScript that Node will not parse. The table is data either way.
|
|
6
|
+
/**
|
|
7
|
+
* How much smaller than the text around it each of these draws.
|
|
8
|
+
*
|
|
9
|
+
* The same table the compiler applies in `crates/hozo_native/src/text.rs`,
|
|
10
|
+
* and `ratios.test.ts` reads that file to check the two still agree. Two
|
|
11
|
+
* copies of a number is how a compiled build and an uncompiled one come
|
|
12
|
+
* to render the same source at different sizes -- which is what the
|
|
13
|
+
* constants these replace were already doing.
|
|
14
|
+
*
|
|
15
|
+
* These are the numbers a project shipping Tailwind's preflight renders,
|
|
16
|
+
* which is what `preflight: 'auto'` gives anything using Tailwind. The
|
|
17
|
+
* bare user agent is a second set below. `@hozo/metro` carries the resolved
|
|
18
|
+
* choice through `@hozo/engine/project`, so the compiler and fallback
|
|
19
|
+
* components select the same table (#336).
|
|
20
|
+
*
|
|
21
|
+
* `small` was 0.85 here and in the compiler, and 0.85 is neither number.
|
|
22
|
+
* Measured in headless Chrome at bases 16, 20 and 32: 0.80 with the
|
|
23
|
+
* reset, 0.8333 without it.
|
|
24
|
+
*/
|
|
25
|
+
export const TEXT_SIZE_RATIOS = {
|
|
26
|
+
sub: 0.75,
|
|
27
|
+
sup: 0.75,
|
|
28
|
+
small: 0.8,
|
|
29
|
+
rubyText: 0.5,
|
|
30
|
+
heading: [2, 1.5, 1.17, 1, 0.83, 0.67],
|
|
31
|
+
};
|
|
32
|
+
/** Browser defaults when the project deliberately ships no reset. */
|
|
33
|
+
export const BARE_TEXT_SIZE_RATIOS = {
|
|
34
|
+
sub: 1 / 1.2,
|
|
35
|
+
sup: 1 / 1.2,
|
|
36
|
+
small: 1 / 1.2,
|
|
37
|
+
rubyText: 0.5,
|
|
38
|
+
heading: TEXT_SIZE_RATIOS.heading,
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=text-size.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-size.js","sourceRoot":"","sources":["../src/text-size.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,wEAAwE;AACxE,uEAAuE;AACvE,qEAAqE;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;CAC9B,CAAA;AAEV,qEAAqE;AACrE,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,GAAG,EAAE,CAAC,GAAG,GAAG;IACZ,GAAG,EAAE,CAAC,GAAG,GAAG;IACZ,KAAK,EAAE,CAAC,GAAG,GAAG;IACd,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,gBAAgB,CAAC,OAAO;CACzB,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hozo/typography",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Universal typography, semantic text formatting, and accessible CJK ruby primitives for Hozo.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native",
|
|
7
|
+
"react",
|
|
8
|
+
"typography",
|
|
9
|
+
"cjk",
|
|
10
|
+
"ruby",
|
|
11
|
+
"accessibility"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/iray-tno/hozo.git",
|
|
17
|
+
"directory": "packages/typography"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://iray-tno.github.io/hozo/",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/iray-tno/hozo/issues"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"react-native": {
|
|
30
|
+
"types": "./dist/index.native.d.ts",
|
|
31
|
+
"default": "./dist/index.native.js"
|
|
32
|
+
},
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./fonts": {
|
|
37
|
+
"types": "./dist/fonts.d.ts",
|
|
38
|
+
"default": "./dist/fonts.js"
|
|
39
|
+
},
|
|
40
|
+
"./fonts/expo": {
|
|
41
|
+
"types": "./dist/fonts-expo.d.ts",
|
|
42
|
+
"default": "./dist/fonts-expo.js"
|
|
43
|
+
},
|
|
44
|
+
"./fonts/native": {
|
|
45
|
+
"types": "./dist/fonts-native.d.ts",
|
|
46
|
+
"default": "./dist/fonts-native.js"
|
|
47
|
+
},
|
|
48
|
+
"./generated/ruby": {
|
|
49
|
+
"react-native": {
|
|
50
|
+
"types": "./dist/generated/ruby.native.d.ts",
|
|
51
|
+
"default": "./dist/generated/ruby.native.js"
|
|
52
|
+
},
|
|
53
|
+
"types": "./dist/generated/ruby.d.ts",
|
|
54
|
+
"default": "./dist/generated/ruby.js"
|
|
55
|
+
},
|
|
56
|
+
"./package.json": "./package.json"
|
|
57
|
+
},
|
|
58
|
+
"files": [
|
|
59
|
+
"dist",
|
|
60
|
+
"src",
|
|
61
|
+
"!src/**/*.test.ts",
|
|
62
|
+
"!src/**/*.test.tsx",
|
|
63
|
+
"!src/**/*.bench.ts"
|
|
64
|
+
],
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public",
|
|
67
|
+
"provenance": true
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"@hozo/primitives": "^0.1.0",
|
|
71
|
+
"@hozo/engine": "^0.1.0"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"react": "^19.0.0",
|
|
75
|
+
"react-native": ">=0.86"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"react-native": {
|
|
79
|
+
"optional": true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@types/react": "^19.2.18",
|
|
84
|
+
"@types/react-dom": "^19.2.4",
|
|
85
|
+
"react-dom": "^19.2.8",
|
|
86
|
+
"react-native": "^0.87.1"
|
|
87
|
+
},
|
|
88
|
+
"scripts": {
|
|
89
|
+
"build": "node ../../scripts/clean-package-dist.mjs && tsc -p .",
|
|
90
|
+
"typecheck": "tsc -p . --noEmit",
|
|
91
|
+
"test": "node -e \"require('node:fs').rmSync('.test-build', { recursive: true, force: true })\" && tsc -p tsconfig.test.json && node --test .test-build/*.test.js"
|
|
92
|
+
}
|
|
93
|
+
}
|