@agimon-ai/po-native-components 0.0.0-alpha.21 → 0.0.0-alpha.210
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 -149
- package/README.md +9 -51
- package/dist/components/AgentAvatar.d.mts +19 -0
- package/dist/components/AgentAvatar.d.mts.map +1 -0
- package/dist/components/AgentAvatar.mjs +88 -0
- package/dist/components/AgentAvatar.mjs.map +1 -0
- package/dist/components/AnnotationSurface.d.mts +69 -0
- package/dist/components/AnnotationSurface.d.mts.map +1 -0
- package/dist/components/AnnotationSurface.mjs +431 -0
- package/dist/components/AnnotationSurface.mjs.map +1 -0
- package/dist/components/Badge.d.mts +1 -1
- package/dist/components/Badge.mjs +1 -1
- package/dist/components/Button.mjs +3 -3
- package/dist/components/Button.mjs.map +1 -1
- package/dist/components/CodeBlock.d.mts +3 -1
- package/dist/components/CodeBlock.d.mts.map +1 -1
- package/dist/components/CodeBlock.mjs +42 -47
- package/dist/components/CodeBlock.mjs.map +1 -1
- package/dist/components/ComputerRow.d.mts +15 -0
- package/dist/components/ComputerRow.d.mts.map +1 -0
- package/dist/components/ComputerRow.mjs +107 -0
- package/dist/components/ComputerRow.mjs.map +1 -0
- package/dist/components/CopyButton.d.mts +13 -0
- package/dist/components/CopyButton.d.mts.map +1 -0
- package/dist/components/CopyButton.mjs +49 -0
- package/dist/components/CopyButton.mjs.map +1 -0
- package/dist/components/CountBadge.d.mts +15 -0
- package/dist/components/CountBadge.d.mts.map +1 -0
- package/dist/components/CountBadge.mjs +49 -0
- package/dist/components/CountBadge.mjs.map +1 -0
- package/dist/components/CtaCard.d.mts +19 -0
- package/dist/components/CtaCard.d.mts.map +1 -0
- package/dist/components/CtaCard.mjs +92 -0
- package/dist/components/CtaCard.mjs.map +1 -0
- package/dist/components/Dialog.d.mts +2 -2
- package/dist/components/Dialog.d.mts.map +1 -1
- package/dist/components/Dialog.mjs +16 -10
- package/dist/components/Dialog.mjs.map +1 -1
- package/dist/components/Dot.d.mts +1 -1
- package/dist/components/Dot.mjs +2 -2
- package/dist/components/DropdownMenu.d.mts +3 -1
- package/dist/components/DropdownMenu.d.mts.map +1 -1
- package/dist/components/DropdownMenu.mjs +21 -14
- package/dist/components/DropdownMenu.mjs.map +1 -1
- package/dist/components/EmptyState.d.mts +31 -3
- package/dist/components/EmptyState.d.mts.map +1 -1
- package/dist/components/EmptyState.mjs +303 -29
- package/dist/components/EmptyState.mjs.map +1 -1
- package/dist/components/FileList.d.mts +48 -0
- package/dist/components/FileList.d.mts.map +1 -0
- package/dist/components/FileList.mjs +737 -0
- package/dist/components/FileList.mjs.map +1 -0
- package/dist/components/FilePreview.d.mts +33 -0
- package/dist/components/FilePreview.d.mts.map +1 -0
- package/dist/components/FilePreview.mjs +102 -0
- package/dist/components/FilePreview.mjs.map +1 -0
- package/dist/components/FileViewer.d.mts +57 -0
- package/dist/components/FileViewer.d.mts.map +1 -0
- package/dist/components/FileViewer.mjs +345 -0
- package/dist/components/FileViewer.mjs.map +1 -0
- package/dist/components/HashlineLines.d.mts +13 -0
- package/dist/components/HashlineLines.d.mts.map +1 -0
- package/dist/components/HashlineLines.mjs +153 -0
- package/dist/components/HashlineLines.mjs.map +1 -0
- package/dist/components/HostFilter.d.mts +17 -0
- package/dist/components/HostFilter.d.mts.map +1 -0
- package/dist/components/HostFilter.mjs +68 -0
- package/dist/components/HostFilter.mjs.map +1 -0
- package/dist/components/HostTag.d.mts +7 -0
- package/dist/components/HostTag.d.mts.map +1 -0
- package/dist/components/HostTag.mjs +48 -0
- package/dist/components/HostTag.mjs.map +1 -0
- package/dist/components/InfoStrip.d.mts +9 -0
- package/dist/components/InfoStrip.d.mts.map +1 -0
- package/dist/components/InfoStrip.mjs +53 -0
- package/dist/components/InfoStrip.mjs.map +1 -0
- package/dist/components/Input.d.mts +3 -1
- package/dist/components/Input.d.mts.map +1 -1
- package/dist/components/Input.mjs +4 -3
- package/dist/components/Input.mjs.map +1 -1
- package/dist/components/Label.mjs +1 -1
- package/dist/components/LinkText.d.mts +13 -0
- package/dist/components/LinkText.d.mts.map +1 -0
- package/dist/components/LinkText.mjs +32 -0
- package/dist/components/LinkText.mjs.map +1 -0
- package/dist/components/List.d.mts.map +1 -1
- package/dist/components/List.mjs +50 -11
- package/dist/components/List.mjs.map +1 -1
- package/dist/components/LiveDuration.d.mts +30 -0
- package/dist/components/LiveDuration.d.mts.map +1 -0
- package/dist/components/LiveDuration.mjs +67 -0
- package/dist/components/LiveDuration.mjs.map +1 -0
- package/dist/components/LoadingState.d.mts +17 -0
- package/dist/components/LoadingState.d.mts.map +1 -0
- package/dist/components/LoadingState.mjs +90 -0
- package/dist/components/LoadingState.mjs.map +1 -0
- package/dist/components/Markdown.d.mts +24 -2
- package/dist/components/Markdown.d.mts.map +1 -1
- package/dist/components/Markdown.mjs +356 -27
- package/dist/components/Markdown.mjs.map +1 -1
- package/dist/components/MessageItem.d.mts +10 -15
- package/dist/components/MessageItem.d.mts.map +1 -1
- package/dist/components/MessageItem.mjs +94 -68
- package/dist/components/MessageItem.mjs.map +1 -1
- package/dist/components/NativeShellState.d.mts +30 -0
- package/dist/components/NativeShellState.d.mts.map +1 -0
- package/dist/components/NativeShellState.mjs +61 -0
- package/dist/components/NativeShellState.mjs.map +1 -0
- package/dist/components/RailItem.d.mts +13 -0
- package/dist/components/RailItem.d.mts.map +1 -0
- package/dist/components/RailItem.mjs +61 -0
- package/dist/components/RailItem.mjs.map +1 -0
- package/dist/components/ReferenceChip.d.mts +18 -0
- package/dist/components/ReferenceChip.d.mts.map +1 -0
- package/dist/components/ReferenceChip.mjs +38 -0
- package/dist/components/ReferenceChip.mjs.map +1 -0
- package/dist/components/SectionLabel.mjs +1 -1
- package/dist/components/SeekBar.d.mts +17 -0
- package/dist/components/SeekBar.d.mts.map +1 -0
- package/dist/components/SeekBar.mjs +97 -0
- package/dist/components/SeekBar.mjs.map +1 -0
- package/dist/components/Select.d.mts +39 -0
- package/dist/components/Select.d.mts.map +1 -0
- package/dist/components/Select.mjs +288 -0
- package/dist/components/Select.mjs.map +1 -0
- package/dist/components/Sheet.d.mts +17 -2
- package/dist/components/Sheet.d.mts.map +1 -1
- package/dist/components/Sheet.mjs +34 -11
- package/dist/components/Sheet.mjs.map +1 -1
- package/dist/components/SheetFrame.mjs +149 -28
- package/dist/components/SheetFrame.mjs.map +1 -1
- package/dist/components/SheetList.d.mts +14 -0
- package/dist/components/SheetList.d.mts.map +1 -0
- package/dist/components/SheetList.mjs +34 -0
- package/dist/components/SheetList.mjs.map +1 -0
- package/dist/components/ShowMore.d.mts +10 -0
- package/dist/components/ShowMore.d.mts.map +1 -0
- package/dist/components/ShowMore.mjs +44 -0
- package/dist/components/ShowMore.mjs.map +1 -0
- package/dist/components/Spinner.d.mts +1 -1
- package/dist/components/StatusBadge.d.mts +1 -1
- package/dist/components/Switch.d.mts +14 -0
- package/dist/components/Switch.d.mts.map +1 -0
- package/dist/components/Switch.mjs +37 -0
- package/dist/components/Switch.mjs.map +1 -0
- package/dist/components/SyntaxLine.d.mts +19 -0
- package/dist/components/SyntaxLine.d.mts.map +1 -0
- package/dist/components/SyntaxLine.mjs +134 -0
- package/dist/components/SyntaxLine.mjs.map +1 -0
- package/dist/components/Tabs.d.mts.map +1 -1
- package/dist/components/Tabs.mjs +8 -7
- package/dist/components/Tabs.mjs.map +1 -1
- package/dist/components/ToolPathLink.d.mts +10 -0
- package/dist/components/ToolPathLink.d.mts.map +1 -0
- package/dist/components/ToolPathLink.mjs +42 -0
- package/dist/components/ToolPathLink.mjs.map +1 -0
- package/dist/components/ToolResultImage.d.mts +21 -0
- package/dist/components/ToolResultImage.d.mts.map +1 -0
- package/dist/components/ToolResultImage.mjs +60 -0
- package/dist/components/ToolResultImage.mjs.map +1 -0
- package/dist/icons/IconColorContext.d.mts +2 -1
- package/dist/icons/IconColorContext.d.mts.map +1 -1
- package/dist/icons/IconColorContext.mjs.map +1 -1
- package/dist/icons/iconGlyphs.d.mts +132 -0
- package/dist/icons/iconGlyphs.d.mts.map +1 -1
- package/dist/icons/iconGlyphs.mjs +132 -0
- package/dist/icons/iconGlyphs.mjs.map +1 -1
- package/dist/icons/icons.d.mts +133 -1
- package/dist/icons/icons.d.mts.map +1 -1
- package/dist/icons/icons.mjs +35 -2
- package/dist/icons/icons.mjs.map +1 -1
- package/dist/index.d.mts +31 -7
- package/dist/index.mjs +36 -12
- package/dist/lib/fileKindLabel.mjs +17 -0
- package/dist/lib/fileKindLabel.mjs.map +1 -0
- package/dist/lib/fonts.d.mts +3 -1
- package/dist/lib/fonts.d.mts.map +1 -1
- package/dist/lib/fonts.mjs +4 -2
- package/dist/lib/fonts.mjs.map +1 -1
- package/dist/lib/insideSheet.d.mts +10 -0
- package/dist/lib/insideSheet.d.mts.map +1 -0
- package/dist/lib/markdown.mjs +310 -23
- package/dist/lib/markdown.mjs.map +1 -1
- package/dist/lib/reading.mjs +60 -0
- package/dist/lib/reading.mjs.map +1 -0
- package/dist/lib/useControllable.mjs +14 -6
- package/dist/lib/useControllable.mjs.map +1 -1
- package/dist/lib/useReadingPage.mjs +33 -0
- package/dist/lib/useReadingPage.mjs.map +1 -0
- package/dist/po-runtime-identity.json +1 -0
- package/dist/shell.d.mts +6 -0
- package/dist/shell.mjs +7 -0
- package/locales/vi.json +112 -0
- package/locales/zh-CN.json +112 -0
- package/package.json +43 -30
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { clockRefreshMs, clockText } from "@agimon-ai/po-web-components/text";
|
|
2
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
3
|
+
import { AppState } from "react-native";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { TextInput as TextInput$1 } from "react-native-unistyles/components/native/TextInput";
|
|
7
|
+
import Animated, { useAnimatedProps, useSharedValue } from "react-native-reanimated";
|
|
8
|
+
|
|
9
|
+
//#region src/components/LiveDuration.tsx
|
|
10
|
+
const AnimatedTextInput = Animated.createAnimatedComponent(TextInput$1);
|
|
11
|
+
/**
|
|
12
|
+
* "running · 12m" that ages by itself, or any `clock` format. Each change writes a shared value the UI thread
|
|
13
|
+
* draws, so a list of running work re-renders nothing to keep its clocks current. It sleeps while the app is in
|
|
14
|
+
* the background and catches up on return. Read-only and not focusable: it sits inside a row whose own label
|
|
15
|
+
* speaks for it.
|
|
16
|
+
*/
|
|
17
|
+
function LiveDuration({ label, since, clock, style }) {
|
|
18
|
+
const read = (now) => clock ? clock(now) : {
|
|
19
|
+
text: clockText({
|
|
20
|
+
label,
|
|
21
|
+
since
|
|
22
|
+
}, now),
|
|
23
|
+
nextMs: clockRefreshMs(since, now)
|
|
24
|
+
};
|
|
25
|
+
const [initial] = useState(() => read(Date.now()).text);
|
|
26
|
+
const text = useSharedValue(initial);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
let timer;
|
|
29
|
+
const tick = () => {
|
|
30
|
+
clearTimeout(timer);
|
|
31
|
+
timer = void 0;
|
|
32
|
+
if (AppState.currentState !== "active") return;
|
|
33
|
+
const reading = read(Date.now());
|
|
34
|
+
text.value = reading.text;
|
|
35
|
+
if (reading.nextMs !== void 0) timer = setTimeout(tick, Math.max(1, reading.nextMs));
|
|
36
|
+
};
|
|
37
|
+
const subscription = AppState.addEventListener("change", tick);
|
|
38
|
+
tick();
|
|
39
|
+
return () => {
|
|
40
|
+
clearTimeout(timer);
|
|
41
|
+
subscription.remove();
|
|
42
|
+
};
|
|
43
|
+
}, [
|
|
44
|
+
label,
|
|
45
|
+
since,
|
|
46
|
+
clock,
|
|
47
|
+
text
|
|
48
|
+
]);
|
|
49
|
+
const animatedProps = useAnimatedProps(() => ({ text: text.value }));
|
|
50
|
+
return /* @__PURE__ */ jsx(AnimatedTextInput, {
|
|
51
|
+
editable: false,
|
|
52
|
+
focusable: false,
|
|
53
|
+
pointerEvents: "none",
|
|
54
|
+
underlineColorAndroid: "transparent",
|
|
55
|
+
defaultValue: initial,
|
|
56
|
+
animatedProps,
|
|
57
|
+
style: [styles.text, style]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const styles = StyleSheet.create({ text: {
|
|
61
|
+
padding: 0,
|
|
62
|
+
margin: 0
|
|
63
|
+
} });
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { LiveDuration };
|
|
67
|
+
//# sourceMappingURL=LiveDuration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveDuration.mjs","names":["clockRefreshMs","clockText","useEffect","useState","AppState","StyleProp","TextInputProps","TextStyle","Animated","useAnimatedProps","useSharedValue","StyleSheet","AnimatedTextInput","createAnimatedComponent","TextInput","LiveDurationReading","text","nextMs","LiveDurationProps","style","label","since","clock","now","LiveDuration","read","initial","Date","timer","ReturnType","setTimeout","tick","clearTimeout","undefined","currentState","reading","value","Math","max","subscription","addEventListener","remove","animatedProps","styles","create","padding","margin","TextInput"],"sources":["../../src/components/LiveDuration.tsx"],"sourcesContent":["import { clockRefreshMs, clockText } from '@agimon-ai/po-web-components/text';\nimport { useEffect, useState } from 'react';\nimport { AppState, type StyleProp, TextInput, type TextInputProps, type TextStyle } from 'react-native';\nimport Animated, { useAnimatedProps, useSharedValue } from 'react-native-reanimated';\nimport { StyleSheet } from 'react-native-unistyles';\n\nconst AnimatedTextInput = Animated.createAnimatedComponent(TextInput);\n\n/** What a custom clock shows at `now`, and how long until it changes; no `nextMs` freezes it. */\nexport interface LiveDurationReading {\n text: string;\n nextMs?: number;\n}\n\nexport type LiveDurationProps = {\n style?: StyleProp<TextStyle>;\n} & (\n | {\n /** The copy before the elapsed time, such as \"running\". */\n label: string;\n /** Epoch milliseconds the clock counts from. */\n since: number;\n clock?: undefined;\n }\n | {\n /** A custom format; keep it stable (useCallback), since a new function restarts the clock. */\n clock: (now: number) => LiveDurationReading;\n label?: undefined;\n since?: undefined;\n }\n);\n\n/**\n * \"running · 12m\" that ages by itself, or any `clock` format. Each change writes a shared value the UI thread\n * draws, so a list of running work re-renders nothing to keep its clocks current. It sleeps while the app is in\n * the background and catches up on return. Read-only and not focusable: it sits inside a row whose own label\n * speaks for it.\n */\nexport function LiveDuration({ label, since, clock, style }: LiveDurationProps) {\n const read = (now: number): LiveDurationReading =>\n clock ? clock(now) : { text: clockText({ label, since }, now), nextMs: clockRefreshMs(since, now) };\n // The first paint's text; the effect below keeps it current from then on.\n const [initial] = useState(() => read(Date.now()).text);\n const text = useSharedValue(initial);\n useEffect(() => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const tick = (): void => {\n clearTimeout(timer);\n timer = undefined;\n if (AppState.currentState !== 'active') return;\n const reading = read(Date.now());\n text.value = reading.text;\n if (reading.nextMs !== undefined) timer = setTimeout(tick, Math.max(1, reading.nextMs));\n };\n const subscription = AppState.addEventListener('change', tick);\n tick();\n return () => {\n clearTimeout(timer);\n subscription.remove();\n };\n // read is rebuilt each render from exactly these inputs.\n // oxlint-disable-next-line react-hooks/exhaustive-deps\n }, [label, since, clock, text]);\n const animatedProps = useAnimatedProps(() => ({ text: text.value }) as TextInputProps);\n return (\n <AnimatedTextInput\n editable={false}\n focusable={false}\n pointerEvents=\"none\"\n underlineColorAndroid=\"transparent\"\n defaultValue={initial}\n animatedProps={animatedProps}\n style={[styles.text, style]}\n />\n );\n}\n\nconst styles = StyleSheet.create({\n // A TextInput pads itself on Android; a status line sits flush like the Text beside it.\n text: { padding: 0, margin: 0 },\n});\n"],"mappings":";;;;;;;;;AAMA,MAAMY,oBAAoBJ,SAASK,wBAAwBC,WAAS;;;;;;;AAgCpE,SAAgBU,aAAa,EAAEJ,OAAOC,OAAOC,OAAOH,SAA4B;CAC9E,MAAMM,QAAQF,QACZD,QAAQA,MAAMC,GAAG,IAAI;EAAEP,MAAMf,UAAU;GAAEmB;GAAOC;EAAM,GAAGE,GAAG;EAAGN,QAAQjB,eAAeqB,OAAOE,GAAG;CAAE;CAEpG,MAAM,CAACG,WAAWvB,eAAesB,KAAKE,KAAKJ,IAAI,CAAC,CAAC,CAACP,IAAI;CACtD,MAAMA,OAAON,eAAegB,OAAO;CACnCxB,gBAAgB;EACd,IAAI0B;EACJ,MAAMG,aAAmB;GACvBC,aAAaJ,KAAK;GAClBA,QAAQK;GACR,IAAI7B,SAAS8B,iBAAiB,UAAU;GACxC,MAAMC,UAAUV,KAAKE,KAAKJ,IAAI,CAAC;GAC/BP,KAAKoB,QAAQD,QAAQnB;GACrB,IAAImB,QAAQlB,WAAWgB,QAAWL,QAAQE,WAAWC,MAAMM,KAAKC,IAAI,GAAGH,QAAQlB,MAAM,CAAC;EACxF;EACA,MAAMsB,eAAenC,SAASoC,iBAAiB,UAAUT,IAAI;EAC7DA,KAAK;EACL,aAAa;GACXC,aAAaJ,KAAK;GAClBW,aAAaE,OAAO;EACtB;CAGF,GAAG;EAACrB;EAAOC;EAAOC;EAAON;CAAI,CAAC;CAC9B,MAAM0B,gBAAgBjC,wBAAwB,EAAEO,MAAMA,KAAKoB,MAAM,EAAoB;CACrF,OACE,oBAAC,mBAAD;EACE,UAAU;EACV,WAAW;EACX,eAAc;EACd,uBAAsB;EACtB,cAAcV;EACCgB;EACf,OAAO,CAACC,OAAO3B,MAAMG,KAAK;CAAE;AAGlC;AAEA,MAAMwB,SAAShC,WAAWiC,OAAO,EAE/B5B,MAAM;CAAE6B,SAAS;CAAGC,QAAQ;AAAE,EAChC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
//#region src/components/LoadingState.d.ts
|
|
3
|
+
export type LoadingStateSize = 'page' | 'panel' | 'compact' | 'inline';
|
|
4
|
+
export interface LoadingStateProps {
|
|
5
|
+
/** What the wait is for, said once by screen readers: "Loading tasks". */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Placeholder rows shaped like the content that will arrive. Defaults to 3 (1 when inline). */
|
|
8
|
+
rows?: number;
|
|
9
|
+
/** Matches the EmptyState this stands in for, so the surface keeps its place when data lands. */
|
|
10
|
+
size?: LoadingStateSize;
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
testID?: string;
|
|
13
|
+
}
|
|
14
|
+
/** What a surface shows until its data arrives: quiet rows where the content will be, never the empty state. */
|
|
15
|
+
export declare function LoadingState({ label, rows, size, style, testID }: LoadingStateProps): import("react").JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
//# sourceMappingURL=LoadingState.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingState.d.mts","names":[],"sources":["../../src/components/LoadingState.tsx"],"mappings":";;YAGY;iBAEK;;EAEf;;EAEA;;EAEA,OAAO;EACP,QAAQ,UAAU;EAClB;;;wBAIc,eAAe,OAAO,MAAM,MAAgB,OAAO,UAAU,oCAAiB,IAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { View } from "react-native-unistyles/components/native/View";
|
|
2
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/LoadingState.tsx
|
|
6
|
+
/** What a surface shows until its data arrives: quiet rows where the content will be, never the empty state. */
|
|
7
|
+
function LoadingState({ label, rows, size = "panel", style, testID }) {
|
|
8
|
+
const _styles = styles;
|
|
9
|
+
{
|
|
10
|
+
const styles = _styles.useVariants({ size });
|
|
11
|
+
const count = Math.max(1, rows ?? (size === "inline" ? 1 : 3));
|
|
12
|
+
const lead = size === "page" || size === "panel";
|
|
13
|
+
return /* @__PURE__ */ jsx(View, {
|
|
14
|
+
testID,
|
|
15
|
+
accessible: true,
|
|
16
|
+
accessibilityRole: "progressbar",
|
|
17
|
+
accessibilityLabel: label,
|
|
18
|
+
accessibilityLiveRegion: "polite",
|
|
19
|
+
accessibilityState: { busy: true },
|
|
20
|
+
style: [styles.frame, style],
|
|
21
|
+
children: Array.from({ length: count }, (_, index) => /* @__PURE__ */ jsxs(View, {
|
|
22
|
+
style: styles.row,
|
|
23
|
+
children: [lead ? /* @__PURE__ */ jsx(View, { style: [styles.block, styles.lead] }) : null, /* @__PURE__ */ jsxs(View, {
|
|
24
|
+
style: styles.lines,
|
|
25
|
+
children: [/* @__PURE__ */ jsx(View, { style: [
|
|
26
|
+
styles.block,
|
|
27
|
+
styles.title,
|
|
28
|
+
{ width: index % 2 === 0 ? "60%" : "40%" }
|
|
29
|
+
] }), size === "inline" ? null : /* @__PURE__ */ jsx(View, { style: [styles.block, styles.meta] })]
|
|
30
|
+
})]
|
|
31
|
+
}, index))
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const styles = StyleSheet.create((theme) => ({
|
|
36
|
+
frame: {
|
|
37
|
+
alignSelf: "stretch",
|
|
38
|
+
minWidth: 0,
|
|
39
|
+
variants: { size: {
|
|
40
|
+
page: {
|
|
41
|
+
gap: theme.spacing(4),
|
|
42
|
+
paddingHorizontal: theme.spacing(3),
|
|
43
|
+
paddingVertical: theme.spacing(6)
|
|
44
|
+
},
|
|
45
|
+
panel: {
|
|
46
|
+
gap: theme.spacing(3),
|
|
47
|
+
paddingHorizontal: theme.spacing(3),
|
|
48
|
+
paddingVertical: theme.spacing(4)
|
|
49
|
+
},
|
|
50
|
+
compact: {
|
|
51
|
+
gap: theme.spacing(2.5),
|
|
52
|
+
padding: theme.spacing(3)
|
|
53
|
+
},
|
|
54
|
+
inline: { gap: theme.spacing(2) }
|
|
55
|
+
} },
|
|
56
|
+
uni__dependencies: [0, 4]
|
|
57
|
+
},
|
|
58
|
+
row: {
|
|
59
|
+
flexDirection: "row",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
gap: theme.spacing(3),
|
|
62
|
+
minWidth: 0,
|
|
63
|
+
uni__dependencies: [0]
|
|
64
|
+
},
|
|
65
|
+
lines: {
|
|
66
|
+
flex: 1,
|
|
67
|
+
gap: theme.spacing(1.5),
|
|
68
|
+
minWidth: 0,
|
|
69
|
+
uni__dependencies: [0]
|
|
70
|
+
},
|
|
71
|
+
block: {
|
|
72
|
+
backgroundColor: theme.colors["border-soft"],
|
|
73
|
+
borderRadius: theme.borderRadius.sm,
|
|
74
|
+
uni__dependencies: [0]
|
|
75
|
+
},
|
|
76
|
+
lead: {
|
|
77
|
+
width: 32,
|
|
78
|
+
height: 32,
|
|
79
|
+
borderRadius: 16
|
|
80
|
+
},
|
|
81
|
+
title: { height: 14 },
|
|
82
|
+
meta: {
|
|
83
|
+
height: 12,
|
|
84
|
+
width: "80%"
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
export { LoadingState };
|
|
90
|
+
//# sourceMappingURL=LoadingState.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingState.mjs","names":["StyleProp","ViewStyle","StyleSheet","LoadingStateSize","LoadingStateProps","label","rows","size","style","testID","LoadingState","_styles","styles","useVariants","count","Math","max","lead","busy","frame","Array","from","length","_","index","row","block","lines","title","width","meta","create","theme","alignSelf","minWidth","variants","page","gap","spacing","paddingHorizontal","paddingVertical","panel","compact","padding","inline","uni__dependencies","flexDirection","alignItems","flex","backgroundColor","colors","borderRadius","sm","height"],"sources":["../../src/components/LoadingState.tsx"],"sourcesContent":["import { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nexport type LoadingStateSize = 'page' | 'panel' | 'compact' | 'inline';\n\nexport interface LoadingStateProps {\n /** What the wait is for, said once by screen readers: \"Loading tasks\". */\n label: string;\n /** Placeholder rows shaped like the content that will arrive. Defaults to 3 (1 when inline). */\n rows?: number;\n /** Matches the EmptyState this stands in for, so the surface keeps its place when data lands. */\n size?: LoadingStateSize;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/** What a surface shows until its data arrives: quiet rows where the content will be, never the empty state. */\nexport function LoadingState({ label, rows, size = 'panel', style, testID }: LoadingStateProps) {\n styles.useVariants({ size });\n const count = Math.max(1, rows ?? (size === 'inline' ? 1 : 3));\n const lead = size === 'page' || size === 'panel';\n // ponytail: static blocks, no pulse. Add an Animated opacity loop gated on reduce-motion if a pulse is wanted.\n return (\n <View\n testID={testID}\n accessible\n accessibilityRole=\"progressbar\"\n accessibilityLabel={label}\n accessibilityLiveRegion=\"polite\"\n accessibilityState={{ busy: true }}\n style={[styles.frame, style]}\n >\n {Array.from({ length: count }, (_, index) => (\n <View key={index} style={styles.row}>\n {lead ? <View style={[styles.block, styles.lead]} /> : null}\n <View style={styles.lines}>\n <View style={[styles.block, styles.title, { width: index % 2 === 0 ? '60%' : '40%' }]} />\n {size === 'inline' ? null : <View style={[styles.block, styles.meta]} />}\n </View>\n </View>\n ))}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n frame: {\n alignSelf: 'stretch',\n minWidth: 0,\n variants: {\n size: {\n page: { gap: theme.spacing(4), paddingHorizontal: theme.spacing(3), paddingVertical: theme.spacing(6) },\n panel: { gap: theme.spacing(3), paddingHorizontal: theme.spacing(3), paddingVertical: theme.spacing(4) },\n compact: { gap: theme.spacing(2.5), padding: theme.spacing(3) },\n inline: { gap: theme.spacing(2) },\n },\n },\n },\n row: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(3), minWidth: 0 },\n lines: { flex: 1, gap: theme.spacing(1.5), minWidth: 0 },\n block: { backgroundColor: theme.colors['border-soft'], borderRadius: theme.borderRadius.sm },\n lead: { width: 32, height: 32, borderRadius: 16 },\n title: { height: 14 },\n meta: { height: 12, width: '80%' },\n}));\n"],"mappings":";;;;;;AAiBA,SAAgBU,aAAa,EAAEL,OAAOC,MAAMC,OAAO,SAASC,OAAOC,UAA6B;CAAA,MAAAE,UAAAC;CAAA;EAAA,MAAAA,SAAAD,QAAAE,YAC3E,EAAEN,KAAK,CAAC;EAC3B,MAAMO,QAAQC,KAAKC,IAAI,GAAGV,SAASC,SAAS,WAAW,IAAI,EAAE;EAC7D,MAAMU,OAAOV,SAAS,UAAUA,SAAS;EAEzC,OACE,oBAAC,MAAD;GACUE;GACR;GACA,mBAAkB;GAClB,oBAAoBJ;GACpB,yBAAwB;GACxB,oBAAoB,EAAEa,MAAM,KAAK;GACjC,OAAO,CAACN,OAAOO,OAAOX,KAAK;aAE1BY,MAAMC,KAAK,EAAEC,QAAQR,MAAM,IAAIS,GAAGC,UACjC,qBAAC,MAAD;IAAkB,OAAOZ,OAAOa;cAAhC,CACGR,OAAO,oBAAC,MAAD,EAAM,OAAO,CAACL,OAAOc,OAAOd,OAAOK,IAAI,EAAE,KAAM,MACvD,qBAAC,MAAD;KAAM,OAAOL,OAAOe;eAApB,CACE,oBAAC,MAAD,EAAM,OAAO;MAACf,OAAOc;MAAOd,OAAOgB;MAAO,EAAEC,OAAOL,QAAQ,MAAM,IAAI,QAAQ,MAAM;KAAC,EAAE,IACrFjB,SAAS,WAAW,OAAO,oBAAC,MAAD,EAAM,OAAO,CAACK,OAAOc,OAAOd,OAAOkB,IAAI,EAAE,EACjE;MACF;MANKN,KAML,CACP;EACG;CACN;AACJ;AAEA,MAAMZ,SAASV,WAAW6B,QAAQC,WAAW;CAC3Cb,OAAO;EACLc,WAAW;EACXC,UAAU;EACVC,UAAU,EACR5B,MAAM;GACJ6B,MAAM;IAAEC,KAAKL,MAAMM,QAAQ,CAAC;IAAGC,mBAAmBP,MAAMM,QAAQ,CAAC;IAAGE,iBAAiBR,MAAMM,QAAQ,CAAC;GAAE;GACtGG,OAAO;IAAEJ,KAAKL,MAAMM,QAAQ,CAAC;IAAGC,mBAAmBP,MAAMM,QAAQ,CAAC;IAAGE,iBAAiBR,MAAMM,QAAQ,CAAC;GAAE;GACvGI,SAAS;IAAEL,KAAKL,MAAMM,QAAQ,GAAG;IAAGK,SAASX,MAAMM,QAAQ,CAAC;GAAE;GAC9DM,QAAQ,EAAEP,KAAKL,MAAMM,QAAQ,CAAC,EAAE;EAClC,EACF;EAACO,mBAAA,CAAA,GAAA,CAAA;CACH;CACApB,KAAK;EAAEqB,eAAe;EAAOC,YAAY;EAAUV,KAAKL,MAAMM,QAAQ,CAAC;EAAGJ,UAAU;EAACW,mBAAA,CAAA,CAAA;CAAC;CACtFlB,OAAO;EAAEqB,MAAM;EAAGX,KAAKL,MAAMM,QAAQ,GAAG;EAAGJ,UAAU;EAACW,mBAAA,CAAA,CAAA;CAAC;CACvDnB,OAAO;EAAEuB,iBAAiBjB,MAAMkB,OAAO;EAAgBC,cAAcnB,MAAMmB,aAAaC;EAAEP,mBAAA,CAAA,CAAA;CAAC;CAC3F5B,MAAM;EAAEY,OAAO;EAAIwB,QAAQ;EAAIF,cAAc;CAAG;CAChDvB,OAAO,EAAEyB,QAAQ,GAAG;CACpBvB,MAAM;EAAEuB,QAAQ;EAAIxB,OAAO;CAAM;AACnC,EAAE"}
|
|
@@ -1,15 +1,37 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
1
2
|
//#region src/components/Markdown.d.ts
|
|
2
3
|
/**
|
|
3
|
-
* What a piece of inline code
|
|
4
|
+
* What a piece of inline code, a relative link or an `@scheme:value` reference
|
|
5
|
+
* (handed over as `scheme:value`) opens, when the host knows.
|
|
4
6
|
* Returning undefined leaves it as plain code or an ordinary link. The same
|
|
5
7
|
* contract as the web Markdown's handler.
|
|
6
8
|
*/
|
|
7
9
|
export type FileLinkHandler = (text: string, explicit?: boolean) => (() => void) | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* How an `@scheme:value` reference (handed over as `scheme:value`) is drawn, such as a chip that
|
|
12
|
+
* opens it. Undefined leaves it to `onFileLink`: a plain link when claimed, else text. The same
|
|
13
|
+
* contract as the web Markdown's renderer. What it returns sits inside Text, so it must be Text.
|
|
14
|
+
* `onLongPress` is the surrounding text's, such as a message's actions, for the chip to pass on.
|
|
15
|
+
*/
|
|
16
|
+
export type ReferenceRenderer = (reference: string, options?: {
|
|
17
|
+
onLongPress?: () => void;
|
|
18
|
+
}) => ReactNode | undefined;
|
|
19
|
+
/** Loads a relative image path from the host; the same contract as the web Markdown's `loadImage`. */
|
|
20
|
+
export type MarkdownImageLoader = (path: string) => Promise<{
|
|
21
|
+
url: string;
|
|
22
|
+
dispose(): void;
|
|
23
|
+
}>;
|
|
8
24
|
export interface MarkdownProps {
|
|
9
25
|
text: string;
|
|
10
26
|
onFileLink?: FileLinkHandler;
|
|
27
|
+
/** Draws `@scheme:value` references and code spans that are exactly one; without it they link plainly. */
|
|
28
|
+
renderReference?: ReferenceRenderer;
|
|
29
|
+
/** Loads relative image paths; without it they show as unavailable. */
|
|
30
|
+
loadImage?: MarkdownImageLoader;
|
|
31
|
+
/** Initial reveal pages for a restored reading position. Defaults to one. */
|
|
32
|
+
initialPage?: number;
|
|
11
33
|
}
|
|
12
34
|
/** Markdown in Po's shared presentation, parsed by the package's own small parser. */
|
|
13
|
-
export declare
|
|
35
|
+
export declare const Markdown: import("react").MemoExoticComponent<({ text, onFileLink, renderReference, loadImage, initialPage }: MarkdownProps) => import("react").JSX.Element>;
|
|
14
36
|
//#endregion
|
|
15
37
|
//# sourceMappingURL=Markdown.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.d.mts","names":[],"sources":["../../src/components/Markdown.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Markdown.d.mts","names":[],"sources":["../../src/components/Markdown.tsx"],"mappings":";;;;;;;;YAgCY,mBAAmB,cAAc;;;;;;;YAajC,qBAAqB,mBAAmB;EAAY;MAA+B;;YAInF,uBAAuB,iBAAiB;EAAU;EAAa;;iBAqX1D;EACf;EACA,aAAa;;EAEb,kBAAkB;;EAElB,YAAY;;EAEZ;;;qBAIW,0BAAQ,uBAAA,MAAA,YAAA,iBAAA,WAAA,eAMlB,kCAAa,IAAA"}
|