@hozo/typography 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/dist/code/meta.d.ts +14 -0
  4. package/dist/code/meta.d.ts.map +1 -0
  5. package/dist/code/meta.js +62 -0
  6. package/dist/code/meta.js.map +1 -0
  7. package/dist/code/model.d.ts +66 -0
  8. package/dist/code/model.d.ts.map +1 -0
  9. package/dist/code/model.js +139 -0
  10. package/dist/code/model.js.map +1 -0
  11. package/dist/code/reuse.d.ts +22 -0
  12. package/dist/code/reuse.d.ts.map +1 -0
  13. package/dist/code/reuse.js +54 -0
  14. package/dist/code/reuse.js.map +1 -0
  15. package/dist/code/shiki.d.ts +12 -0
  16. package/dist/code/shiki.d.ts.map +1 -0
  17. package/dist/code/shiki.js +28 -0
  18. package/dist/code/shiki.js.map +1 -0
  19. package/dist/code-lines.d.ts +34 -0
  20. package/dist/code-lines.d.ts.map +1 -0
  21. package/dist/code-lines.js +192 -0
  22. package/dist/code-lines.js.map +1 -0
  23. package/dist/code-lines.native.d.ts +54 -0
  24. package/dist/code-lines.native.d.ts.map +1 -0
  25. package/dist/code-lines.native.js +114 -0
  26. package/dist/code-lines.native.js.map +1 -0
  27. package/dist/index.d.ts +3 -41
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +3 -69
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.native.d.ts +3 -82
  32. package/dist/index.native.d.ts.map +1 -1
  33. package/dist/index.native.js +3 -140
  34. package/dist/index.native.js.map +1 -1
  35. package/dist/text.d.ts +43 -0
  36. package/dist/text.d.ts.map +1 -0
  37. package/dist/text.js +75 -0
  38. package/dist/text.js.map +1 -0
  39. package/dist/text.native.d.ts +84 -0
  40. package/dist/text.native.d.ts.map +1 -0
  41. package/dist/text.native.js +144 -0
  42. package/dist/text.native.js.map +1 -0
  43. package/package.json +30 -4
  44. package/src/code/meta.ts +69 -0
  45. package/src/code/model.ts +189 -0
  46. package/src/code/reuse.ts +70 -0
  47. package/src/code/shiki.ts +38 -0
  48. package/src/code-lines.native.tsx +191 -0
  49. package/src/code-lines.tsx +310 -0
  50. package/src/index.native.tsx +4 -245
  51. package/src/index.tsx +4 -164
  52. package/src/text.native.tsx +250 -0
  53. package/src/text.tsx +179 -0
@@ -1,141 +1,4 @@
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
- // A `Text` keeps spaces and line breaks as written already; what `<pre>`
73
- // adds on the Web that a `Text` lacks is the monospace face.
74
- export function Preformatted({ style, ...props }) {
75
- return _jsx(NativeText, { style: [{ fontFamily: 'monospace' }, style], ...props });
76
- }
77
- export function Small({ style, ...props }) {
78
- const base = useContext(TextSize);
79
- const ratios = hozoPreflight ? TEXT_SIZE_RATIOS : BARE_TEXT_SIZE_RATIOS;
80
- return (_jsx(NativeText, { style: [{ fontSize: relative(ratios.small, base), opacity: 0.8 }, style], ...props }));
81
- }
82
- export function Mark({ style, ...props }) {
83
- return _jsx(NativeText, { style: [{ backgroundColor: '#fef08a' }, style], ...props });
84
- }
85
- /** Recursively replaces normal spaces with Unicode non-breaking spaces (\u00A0) */
86
- function replaceSpacesWithNbsp(node) {
87
- if (typeof node === 'string') {
88
- return node.replace(/ /g, '\u00A0');
89
- }
90
- if (Array.isArray(node)) {
91
- return React.Children.map(node, replaceSpacesWithNbsp);
92
- }
93
- if (React.isValidElement(node)) {
94
- const element = node;
95
- if (element.props?.children) {
96
- return React.cloneElement(element, {
97
- children: replaceSpacesWithNbsp(element.props.children),
98
- });
99
- }
100
- }
101
- return node;
102
- }
103
- export function NoBreak({ children, ...props }) {
104
- return _jsx(NativeText, { ...props, children: replaceSpacesWithNbsp(children) });
105
- }
106
- /**
107
- * A Native style handed over as if it were a Web one -- a resolver's
108
- * limit rather than a claim about the value.
109
- *
110
- * A package resolves `@hozo/engine`'s types through the Web entry
111
- * whichever platform it is building for, because `exports` carries a
112
- * single `types` and this package compiles both halves in one `tsc` run.
113
- * So these are seen with `style?: CSSProperties` here while the module
114
- * Metro loads takes `StyleProp<TextStyle>`. `@hozo/semantics` has the
115
- * same line for the same reason.
116
- */
117
- const asWeb = (style) => style;
118
- /**
119
- * Ruby, sharing the pair the Native backend emits.
120
- *
121
- * React Native flattens nested `Text` into one accessibility node, so a
122
- * screen reader read the base and then the reading: 「漢字かんじ」. The
123
- * `accessible={false}` that used to be on the annotation could not stop
124
- * it -- the flattening happens above, and the parent's label is built
125
- * from the text it contains whatever the children say about themselves.
126
- */
127
- export function Ruby({ children, accessibilityLabel, style, ...props }) {
128
- return (_jsx(HozoRuby, { accessibilityLabel: accessibilityLabel, style: asWeb(style), ...props, children: children }));
129
- }
130
- export function RubyText({ style, children, ...props }) {
131
- // Half the size of the text it annotates, against the size `Text`
132
- // published; `fontSize: '0.65em'` was here and React Native ignored it.
133
- const base = useContext(TextSize);
134
- return (_jsx(HozoRubyText, { style: asWeb([{ fontSize: relative(TEXT_SIZE_RATIOS.rubyText, base), opacity: 0.85 }, style]), ...props, children: children }));
135
- }
136
- // Both spellings, the way `TermList` reads both. The member keeps the
137
- // full name rather than shortening to `Text`: a flat export has to be
138
- // readable on its own, and a `<Text>` that meant the annotation would
139
- // not be. The compiler recognises the pair in `hozo_parser`.
140
- Ruby.RubyText = RubyText;
1
+ // Keep data-driven code rendering out of apps that only use semantic text.
2
+ export { CodeLines } from './code-lines.native.js';
3
+ export * from './text.native.js';
141
4
  //# sourceMappingURL=index.native.js.map
@@ -1 +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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O,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"}
1
+ {"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.tsx"],"names":[],"mappings":"AAAA,2EAA2E;AAG3E,OAAO,EAAE,SAAS,EAAuB,MAAM,wBAAyB,CAAA;AACxE,cAAc,kBAAmB,CAAA"}
package/dist/text.d.ts ADDED
@@ -0,0 +1,43 @@
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 function Ins({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
25
+ export declare function Del({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
26
+ export declare function Sub({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
27
+ export declare function Sup({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
28
+ export declare function Code({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
29
+ /**
30
+ * A block whose spaces and line breaks are the content, a code sample above
31
+ * all. Holds phrasing content -- put a `Code` inside for code, as `<pre><code>`
32
+ * is written by hand.
33
+ */
34
+ export declare function Preformatted({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
35
+ export declare function Small({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
36
+ export declare function Mark({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
37
+ export declare function NoBreak({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
38
+ export declare function Ruby({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
39
+ export declare namespace Ruby {
40
+ export { RubyText };
41
+ }
42
+ export declare function RubyText({ className, children, style, ...props }: TypographyUniversalProps): import("react").JSX.Element;
43
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.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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CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,+BAMrF;AAED,wBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,+BAMrF;AAED,wBAAgB,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,+BAMtF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,+BAM9F;AAED,wBAAgB,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/text.js ADDED
@@ -0,0 +1,75 @@
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 function Ins({ className, children, style, ...props }) {
33
+ return (_jsx("ins", { className: className, style: style, ...domProps(props), children: children }));
34
+ }
35
+ export function Del({ className, children, style, ...props }) {
36
+ return (_jsx("del", { className: className, style: style, ...domProps(props), children: children }));
37
+ }
38
+ export function Sub({ className, children, style, ...props }) {
39
+ return (_jsx("sub", { className: className, style: style, ...domProps(props), children: children }));
40
+ }
41
+ export function Sup({ className, children, style, ...props }) {
42
+ return (_jsx("sup", { className: className, style: style, ...domProps(props), children: children }));
43
+ }
44
+ export function Code({ className, children, style, ...props }) {
45
+ return (_jsx("code", { className: className, style: style, ...domProps(props), children: children }));
46
+ }
47
+ /**
48
+ * A block whose spaces and line breaks are the content, a code sample above
49
+ * all. Holds phrasing content -- put a `Code` inside for code, as `<pre><code>`
50
+ * is written by hand.
51
+ */
52
+ export function Preformatted({ className, children, style, ...props }) {
53
+ return (_jsx("pre", { className: className, style: style, ...domProps(props), children: children }));
54
+ }
55
+ export function Small({ className, children, style, ...props }) {
56
+ return (_jsx("small", { className: className, style: style, ...domProps(props), children: children }));
57
+ }
58
+ export function Mark({ className, children, style, ...props }) {
59
+ return (_jsx("mark", { className: className, style: style, ...domProps(props), children: children }));
60
+ }
61
+ export function NoBreak({ className, children, style, ...props }) {
62
+ return (_jsx("span", { className: className, style: { whiteSpace: 'nowrap', ...style }, ...domProps(props), children: children }));
63
+ }
64
+ export function Ruby({ className, children, style, ...props }) {
65
+ return (_jsx("ruby", { className: className, style: style, ...domProps(props), children: children }));
66
+ }
67
+ export function RubyText({ className, children, style, ...props }) {
68
+ return (_jsx("rt", { className: className, style: style, ...domProps(props), children: children }));
69
+ }
70
+ // Both spellings, the way `TermList` reads both. The member keeps the
71
+ // full name rather than shortening to `Text`: a flat export has to be
72
+ // readable on its own, and a `<Text>` that meant the annotation would
73
+ // not be. The compiler recognises the pair in `hozo_parser`.
74
+ Ruby.RubyText = RubyText;
75
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../src/text.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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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,84 @@
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 function Ins({ style, ...props }: TypographyNativeProps): React.JSX.Element;
62
+ export declare const Del: typeof Strikethrough;
63
+ export declare function Sub({ style, ...props }: TypographyNativeProps): React.JSX.Element;
64
+ export declare function Sup({ style, ...props }: TypographyNativeProps): React.JSX.Element;
65
+ export declare function Code({ style, ...props }: TypographyNativeProps): React.JSX.Element;
66
+ export declare function Preformatted({ style, ...props }: TypographyNativeProps): React.JSX.Element;
67
+ export declare function Small({ style, ...props }: TypographyNativeProps): React.JSX.Element;
68
+ export declare function Mark({ style, ...props }: TypographyNativeProps): React.JSX.Element;
69
+ export declare function NoBreak({ children, ...props }: TypographyNativeProps): React.JSX.Element;
70
+ /**
71
+ * Ruby, sharing the pair the Native backend emits.
72
+ *
73
+ * React Native flattens nested `Text` into one accessibility node, so a
74
+ * screen reader read the base and then the reading: 「漢字かんじ」. The
75
+ * `accessible={false}` that used to be on the annotation could not stop
76
+ * it -- the flattening happens above, and the parent's label is built
77
+ * from the text it contains whatever the children say about themselves.
78
+ */
79
+ export declare function Ruby({ children, accessibilityLabel, style, ...props }: TypographyNativeProps): React.JSX.Element;
80
+ export declare namespace Ruby {
81
+ export { RubyText };
82
+ }
83
+ export declare function RubyText({ style, children, ...props }: TypographyNativeProps): React.JSX.Element;
84
+ //# sourceMappingURL=text.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.native.d.ts","sourceRoot":"","sources":["../src/text.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,EAAE,MAAM,cAAc,CAAA;AAI3E,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;AAErB,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;CACpD;AAID,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,CAAA;AAE5D,MAAM,MAAM,SAAS,GAAG,qBAAqB,CAAA;AAC7C,MAAM,MAAM,iBAAi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G,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAI7D;AAED,wBAAgB,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAI7D;AAED,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAE9D;AAID,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAEtE;AAED,wBAAgB,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAS/D;AAED,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAE9D;AAqBD,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAEpE;AAeD;;;;;;;;GAQG;AACH,wBAAgB,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,144 @@
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 function Ins({ style, ...props }) {
59
+ return _jsx(NativeText, { style: [{ textDecorationLine: 'underline' }, style], ...props });
60
+ }
61
+ export const Del = Strikethrough;
62
+ export function Sub({ style, ...props }) {
63
+ const base = useContext(TextSize);
64
+ const ratios = hozoPreflight ? TEXT_SIZE_RATIOS : BARE_TEXT_SIZE_RATIOS;
65
+ return _jsx(NativeText, { style: [{ fontSize: relative(ratios.sub, base) }, style], ...props });
66
+ }
67
+ export function Sup({ style, ...props }) {
68
+ const base = useContext(TextSize);
69
+ const ratios = hozoPreflight ? TEXT_SIZE_RATIOS : BARE_TEXT_SIZE_RATIOS;
70
+ return _jsx(NativeText, { style: [{ fontSize: relative(ratios.sup, base) }, style], ...props });
71
+ }
72
+ export function Code({ style, ...props }) {
73
+ return _jsx(NativeText, { style: [{ fontFamily: 'monospace' }, style], ...props });
74
+ }
75
+ // A `Text` keeps spaces and line breaks as written already; what `<pre>`
76
+ // adds on the Web that a `Text` lacks is the monospace face.
77
+ export function Preformatted({ style, ...props }) {
78
+ return _jsx(NativeText, { style: [{ fontFamily: 'monospace' }, style], ...props });
79
+ }
80
+ export function Small({ style, ...props }) {
81
+ const base = useContext(TextSize);
82
+ const ratios = hozoPreflight ? TEXT_SIZE_RATIOS : BARE_TEXT_SIZE_RATIOS;
83
+ return (_jsx(NativeText, { style: [{ fontSize: relative(ratios.small, base), opacity: 0.8 }, style], ...props }));
84
+ }
85
+ export function Mark({ style, ...props }) {
86
+ return _jsx(NativeText, { style: [{ backgroundColor: '#fef08a' }, style], ...props });
87
+ }
88
+ /** Recursively replaces normal spaces with Unicode non-breaking spaces (\u00A0) */
89
+ function replaceSpacesWithNbsp(node) {
90
+ if (typeof node === 'string') {
91
+ return node.replace(/ /g, '\u00A0');
92
+ }
93
+ if (Array.isArray(node)) {
94
+ return React.Children.map(node, replaceSpacesWithNbsp);
95
+ }
96
+ if (React.isValidElement(node)) {
97
+ const element = node;
98
+ if (element.props?.children) {
99
+ return React.cloneElement(element, {
100
+ children: replaceSpacesWithNbsp(element.props.children),
101
+ });
102
+ }
103
+ }
104
+ return node;
105
+ }
106
+ export function NoBreak({ children, ...props }) {
107
+ return _jsx(NativeText, { ...props, children: replaceSpacesWithNbsp(children) });
108
+ }
109
+ /**
110
+ * A Native style handed over as if it were a Web one -- a resolver's
111
+ * limit rather than a claim about the value.
112
+ *
113
+ * A package resolves `@hozo/engine`'s types through the Web entry
114
+ * whichever platform it is building for, because `exports` carries a
115
+ * single `types` and this package compiles both halves in one `tsc` run.
116
+ * So these are seen with `style?: CSSProperties` here while the module
117
+ * Metro loads takes `StyleProp<TextStyle>`. `@hozo/semantics` has the
118
+ * same line for the same reason.
119
+ */
120
+ const asWeb = (style) => style;
121
+ /**
122
+ * Ruby, sharing the pair the Native backend emits.
123
+ *
124
+ * React Native flattens nested `Text` into one accessibility node, so a
125
+ * screen reader read the base and then the reading: 「漢字かんじ」. The
126
+ * `accessible={false}` that used to be on the annotation could not stop
127
+ * it -- the flattening happens above, and the parent's label is built
128
+ * from the text it contains whatever the children say about themselves.
129
+ */
130
+ export function Ruby({ children, accessibilityLabel, style, ...props }) {
131
+ return (_jsx(HozoRuby, { accessibilityLabel: accessibilityLabel, style: asWeb(style), ...props, children: children }));
132
+ }
133
+ export function RubyText({ style, children, ...props }) {
134
+ // Half the size of the text it annotates, against the size `Text`
135
+ // published; `fontSize: '0.65em'` was here and React Native ignored it.
136
+ const base = useContext(TextSize);
137
+ return (_jsx(HozoRubyText, { style: asWeb([{ fontSize: relative(TEXT_SIZE_RATIOS.rubyText, base), opacity: 0.85 }, style]), ...props, children: children }));
138
+ }
139
+ // Both spellings, the way `TermList` reads both. The member keeps the
140
+ // full name rather than shortening to `Text`: a flat export has to be
141
+ // readable on its own, and a `<Text>` that meant the annotation would
142
+ // not be. The compiler recognises the pair in `hozo_parser`.
143
+ Ruby.RubyText = RubyText;
144
+ //# sourceMappingURL=text.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.native.js","sourceRoot":"","sources":["../src/text.native.tsx"],"names":[],"mappings":";A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3
+ "version": "0.4.0",
4
4
  "description": "Universal typography, semantic text formatting, and accessible CJK ruby primitives for Hozo.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -33,6 +33,30 @@
33
33
  "types": "./dist/index.d.ts",
34
34
  "default": "./dist/index.js"
35
35
  },
36
+ "./code/model": {
37
+ "types": "./dist/code/model.d.ts",
38
+ "default": "./dist/code/model.js"
39
+ },
40
+ "./code/shiki": {
41
+ "types": "./dist/code/shiki.d.ts",
42
+ "default": "./dist/code/shiki.js"
43
+ },
44
+ "./code/meta": {
45
+ "types": "./dist/code/meta.d.ts",
46
+ "default": "./dist/code/meta.js"
47
+ },
48
+ "./code/lines": {
49
+ "react-native": {
50
+ "types": "./dist/code-lines.native.d.ts",
51
+ "default": "./dist/code-lines.native.js"
52
+ },
53
+ "types": "./dist/code-lines.d.ts",
54
+ "default": "./dist/code-lines.js"
55
+ },
56
+ "./code/lines/native": {
57
+ "types": "./dist/code-lines.native.d.ts",
58
+ "default": "./dist/code-lines.native.js"
59
+ },
36
60
  "./fonts": {
37
61
  "types": "./dist/fonts.d.ts",
38
62
  "default": "./dist/fonts.js"
@@ -68,12 +92,13 @@
68
92
  "provenance": true
69
93
  },
70
94
  "dependencies": {
71
- "@hozo/primitives": "^0.3.0",
72
- "@hozo/engine": "^0.3.0"
95
+ "@hozo/primitives": "^0.4.0",
96
+ "@hozo/engine": "^0.4.0",
97
+ "@hozo/behaviors": "^0.4.0"
73
98
  },
74
99
  "peerDependencies": {
75
100
  "react": "^19.0.0",
76
- "react-native": ">=0.86"
101
+ "react-native": ">=0.87"
77
102
  },
78
103
  "peerDependenciesMeta": {
79
104
  "react-native": {
@@ -81,6 +106,7 @@
81
106
  }
82
107
  },
83
108
  "devDependencies": {
109
+ "shiki": "4.4.3",
84
110
  "@types/react": "^19.2.18",
85
111
  "@types/react-dom": "^19.2.4",
86
112
  "react-dom": "^19.2.8",