@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.
Files changed (195) hide show
  1. package/LICENSE +21 -149
  2. package/README.md +9 -51
  3. package/dist/components/AgentAvatar.d.mts +19 -0
  4. package/dist/components/AgentAvatar.d.mts.map +1 -0
  5. package/dist/components/AgentAvatar.mjs +88 -0
  6. package/dist/components/AgentAvatar.mjs.map +1 -0
  7. package/dist/components/AnnotationSurface.d.mts +69 -0
  8. package/dist/components/AnnotationSurface.d.mts.map +1 -0
  9. package/dist/components/AnnotationSurface.mjs +431 -0
  10. package/dist/components/AnnotationSurface.mjs.map +1 -0
  11. package/dist/components/Badge.d.mts +1 -1
  12. package/dist/components/Badge.mjs +1 -1
  13. package/dist/components/Button.mjs +3 -3
  14. package/dist/components/Button.mjs.map +1 -1
  15. package/dist/components/CodeBlock.d.mts +3 -1
  16. package/dist/components/CodeBlock.d.mts.map +1 -1
  17. package/dist/components/CodeBlock.mjs +42 -47
  18. package/dist/components/CodeBlock.mjs.map +1 -1
  19. package/dist/components/ComputerRow.d.mts +15 -0
  20. package/dist/components/ComputerRow.d.mts.map +1 -0
  21. package/dist/components/ComputerRow.mjs +107 -0
  22. package/dist/components/ComputerRow.mjs.map +1 -0
  23. package/dist/components/CopyButton.d.mts +13 -0
  24. package/dist/components/CopyButton.d.mts.map +1 -0
  25. package/dist/components/CopyButton.mjs +49 -0
  26. package/dist/components/CopyButton.mjs.map +1 -0
  27. package/dist/components/CountBadge.d.mts +15 -0
  28. package/dist/components/CountBadge.d.mts.map +1 -0
  29. package/dist/components/CountBadge.mjs +49 -0
  30. package/dist/components/CountBadge.mjs.map +1 -0
  31. package/dist/components/CtaCard.d.mts +19 -0
  32. package/dist/components/CtaCard.d.mts.map +1 -0
  33. package/dist/components/CtaCard.mjs +92 -0
  34. package/dist/components/CtaCard.mjs.map +1 -0
  35. package/dist/components/Dialog.d.mts +2 -2
  36. package/dist/components/Dialog.d.mts.map +1 -1
  37. package/dist/components/Dialog.mjs +16 -10
  38. package/dist/components/Dialog.mjs.map +1 -1
  39. package/dist/components/Dot.d.mts +1 -1
  40. package/dist/components/Dot.mjs +2 -2
  41. package/dist/components/DropdownMenu.d.mts +3 -1
  42. package/dist/components/DropdownMenu.d.mts.map +1 -1
  43. package/dist/components/DropdownMenu.mjs +21 -14
  44. package/dist/components/DropdownMenu.mjs.map +1 -1
  45. package/dist/components/EmptyState.d.mts +31 -3
  46. package/dist/components/EmptyState.d.mts.map +1 -1
  47. package/dist/components/EmptyState.mjs +303 -29
  48. package/dist/components/EmptyState.mjs.map +1 -1
  49. package/dist/components/FileList.d.mts +48 -0
  50. package/dist/components/FileList.d.mts.map +1 -0
  51. package/dist/components/FileList.mjs +737 -0
  52. package/dist/components/FileList.mjs.map +1 -0
  53. package/dist/components/FilePreview.d.mts +33 -0
  54. package/dist/components/FilePreview.d.mts.map +1 -0
  55. package/dist/components/FilePreview.mjs +102 -0
  56. package/dist/components/FilePreview.mjs.map +1 -0
  57. package/dist/components/FileViewer.d.mts +57 -0
  58. package/dist/components/FileViewer.d.mts.map +1 -0
  59. package/dist/components/FileViewer.mjs +345 -0
  60. package/dist/components/FileViewer.mjs.map +1 -0
  61. package/dist/components/HashlineLines.d.mts +13 -0
  62. package/dist/components/HashlineLines.d.mts.map +1 -0
  63. package/dist/components/HashlineLines.mjs +153 -0
  64. package/dist/components/HashlineLines.mjs.map +1 -0
  65. package/dist/components/HostFilter.d.mts +17 -0
  66. package/dist/components/HostFilter.d.mts.map +1 -0
  67. package/dist/components/HostFilter.mjs +68 -0
  68. package/dist/components/HostFilter.mjs.map +1 -0
  69. package/dist/components/HostTag.d.mts +7 -0
  70. package/dist/components/HostTag.d.mts.map +1 -0
  71. package/dist/components/HostTag.mjs +48 -0
  72. package/dist/components/HostTag.mjs.map +1 -0
  73. package/dist/components/InfoStrip.d.mts +9 -0
  74. package/dist/components/InfoStrip.d.mts.map +1 -0
  75. package/dist/components/InfoStrip.mjs +53 -0
  76. package/dist/components/InfoStrip.mjs.map +1 -0
  77. package/dist/components/Input.d.mts +3 -1
  78. package/dist/components/Input.d.mts.map +1 -1
  79. package/dist/components/Input.mjs +4 -3
  80. package/dist/components/Input.mjs.map +1 -1
  81. package/dist/components/Label.mjs +1 -1
  82. package/dist/components/LinkText.d.mts +13 -0
  83. package/dist/components/LinkText.d.mts.map +1 -0
  84. package/dist/components/LinkText.mjs +32 -0
  85. package/dist/components/LinkText.mjs.map +1 -0
  86. package/dist/components/List.d.mts.map +1 -1
  87. package/dist/components/List.mjs +50 -11
  88. package/dist/components/List.mjs.map +1 -1
  89. package/dist/components/LiveDuration.d.mts +30 -0
  90. package/dist/components/LiveDuration.d.mts.map +1 -0
  91. package/dist/components/LiveDuration.mjs +67 -0
  92. package/dist/components/LiveDuration.mjs.map +1 -0
  93. package/dist/components/LoadingState.d.mts +17 -0
  94. package/dist/components/LoadingState.d.mts.map +1 -0
  95. package/dist/components/LoadingState.mjs +90 -0
  96. package/dist/components/LoadingState.mjs.map +1 -0
  97. package/dist/components/Markdown.d.mts +24 -2
  98. package/dist/components/Markdown.d.mts.map +1 -1
  99. package/dist/components/Markdown.mjs +356 -27
  100. package/dist/components/Markdown.mjs.map +1 -1
  101. package/dist/components/MessageItem.d.mts +10 -15
  102. package/dist/components/MessageItem.d.mts.map +1 -1
  103. package/dist/components/MessageItem.mjs +94 -68
  104. package/dist/components/MessageItem.mjs.map +1 -1
  105. package/dist/components/NativeShellState.d.mts +30 -0
  106. package/dist/components/NativeShellState.d.mts.map +1 -0
  107. package/dist/components/NativeShellState.mjs +61 -0
  108. package/dist/components/NativeShellState.mjs.map +1 -0
  109. package/dist/components/RailItem.d.mts +13 -0
  110. package/dist/components/RailItem.d.mts.map +1 -0
  111. package/dist/components/RailItem.mjs +61 -0
  112. package/dist/components/RailItem.mjs.map +1 -0
  113. package/dist/components/ReferenceChip.d.mts +18 -0
  114. package/dist/components/ReferenceChip.d.mts.map +1 -0
  115. package/dist/components/ReferenceChip.mjs +38 -0
  116. package/dist/components/ReferenceChip.mjs.map +1 -0
  117. package/dist/components/SectionLabel.mjs +1 -1
  118. package/dist/components/SeekBar.d.mts +17 -0
  119. package/dist/components/SeekBar.d.mts.map +1 -0
  120. package/dist/components/SeekBar.mjs +97 -0
  121. package/dist/components/SeekBar.mjs.map +1 -0
  122. package/dist/components/Select.d.mts +39 -0
  123. package/dist/components/Select.d.mts.map +1 -0
  124. package/dist/components/Select.mjs +288 -0
  125. package/dist/components/Select.mjs.map +1 -0
  126. package/dist/components/Sheet.d.mts +17 -2
  127. package/dist/components/Sheet.d.mts.map +1 -1
  128. package/dist/components/Sheet.mjs +34 -11
  129. package/dist/components/Sheet.mjs.map +1 -1
  130. package/dist/components/SheetFrame.mjs +149 -28
  131. package/dist/components/SheetFrame.mjs.map +1 -1
  132. package/dist/components/SheetList.d.mts +14 -0
  133. package/dist/components/SheetList.d.mts.map +1 -0
  134. package/dist/components/SheetList.mjs +34 -0
  135. package/dist/components/SheetList.mjs.map +1 -0
  136. package/dist/components/ShowMore.d.mts +10 -0
  137. package/dist/components/ShowMore.d.mts.map +1 -0
  138. package/dist/components/ShowMore.mjs +44 -0
  139. package/dist/components/ShowMore.mjs.map +1 -0
  140. package/dist/components/Spinner.d.mts +1 -1
  141. package/dist/components/StatusBadge.d.mts +1 -1
  142. package/dist/components/Switch.d.mts +14 -0
  143. package/dist/components/Switch.d.mts.map +1 -0
  144. package/dist/components/Switch.mjs +37 -0
  145. package/dist/components/Switch.mjs.map +1 -0
  146. package/dist/components/SyntaxLine.d.mts +19 -0
  147. package/dist/components/SyntaxLine.d.mts.map +1 -0
  148. package/dist/components/SyntaxLine.mjs +134 -0
  149. package/dist/components/SyntaxLine.mjs.map +1 -0
  150. package/dist/components/Tabs.d.mts.map +1 -1
  151. package/dist/components/Tabs.mjs +8 -7
  152. package/dist/components/Tabs.mjs.map +1 -1
  153. package/dist/components/ToolPathLink.d.mts +10 -0
  154. package/dist/components/ToolPathLink.d.mts.map +1 -0
  155. package/dist/components/ToolPathLink.mjs +42 -0
  156. package/dist/components/ToolPathLink.mjs.map +1 -0
  157. package/dist/components/ToolResultImage.d.mts +21 -0
  158. package/dist/components/ToolResultImage.d.mts.map +1 -0
  159. package/dist/components/ToolResultImage.mjs +60 -0
  160. package/dist/components/ToolResultImage.mjs.map +1 -0
  161. package/dist/icons/IconColorContext.d.mts +2 -1
  162. package/dist/icons/IconColorContext.d.mts.map +1 -1
  163. package/dist/icons/IconColorContext.mjs.map +1 -1
  164. package/dist/icons/iconGlyphs.d.mts +132 -0
  165. package/dist/icons/iconGlyphs.d.mts.map +1 -1
  166. package/dist/icons/iconGlyphs.mjs +132 -0
  167. package/dist/icons/iconGlyphs.mjs.map +1 -1
  168. package/dist/icons/icons.d.mts +133 -1
  169. package/dist/icons/icons.d.mts.map +1 -1
  170. package/dist/icons/icons.mjs +35 -2
  171. package/dist/icons/icons.mjs.map +1 -1
  172. package/dist/index.d.mts +31 -7
  173. package/dist/index.mjs +36 -12
  174. package/dist/lib/fileKindLabel.mjs +17 -0
  175. package/dist/lib/fileKindLabel.mjs.map +1 -0
  176. package/dist/lib/fonts.d.mts +3 -1
  177. package/dist/lib/fonts.d.mts.map +1 -1
  178. package/dist/lib/fonts.mjs +4 -2
  179. package/dist/lib/fonts.mjs.map +1 -1
  180. package/dist/lib/insideSheet.d.mts +10 -0
  181. package/dist/lib/insideSheet.d.mts.map +1 -0
  182. package/dist/lib/markdown.mjs +310 -23
  183. package/dist/lib/markdown.mjs.map +1 -1
  184. package/dist/lib/reading.mjs +60 -0
  185. package/dist/lib/reading.mjs.map +1 -0
  186. package/dist/lib/useControllable.mjs +14 -6
  187. package/dist/lib/useControllable.mjs.map +1 -1
  188. package/dist/lib/useReadingPage.mjs +33 -0
  189. package/dist/lib/useReadingPage.mjs.map +1 -0
  190. package/dist/po-runtime-identity.json +1 -0
  191. package/dist/shell.d.mts +6 -0
  192. package/dist/shell.mjs +7 -0
  193. package/locales/vi.json +112 -0
  194. package/locales/zh-CN.json +112 -0
  195. package/package.json +43 -30
@@ -0,0 +1,19 @@
1
+ import { SyntaxSpan } from "@agimon-ai/po-web-components/text";
2
+ import { TextProps } from "react-native";
3
+ //#region src/components/SyntaxLine.d.ts
4
+ /**
5
+ * Colours `text` as lines of spans, or undefined while loading and for text with
6
+ * no grammar. Pass a whole block, not one line: a line is not a parse unit.
7
+ */
8
+ export declare function useSyntaxLines(text: string, query?: {
9
+ path?: string | undefined;
10
+ }): readonly (readonly SyntaxSpan[])[] | undefined;
11
+ export interface SyntaxLineProps extends Omit<TextProps, 'children'> {
12
+ /** The line's spans from `useSyntaxLines`, or undefined to show `text` plain. */
13
+ spans?: readonly SyntaxSpan[] | undefined;
14
+ text: string;
15
+ }
16
+ /** One line: coloured when its spans are in, the plain text until then. */
17
+ export declare function SyntaxLine({ spans, text, ...props }: SyntaxLineProps): import("react").JSX.Element;
18
+ //#endregion
19
+ //# sourceMappingURL=SyntaxLine.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyntaxLine.d.mts","names":[],"sources":["../../src/components/SyntaxLine.tsx"],"mappings":";;;;;;;wBAgBgB,eAAe,cAAc;EAAS;uBAAgC;iBAyBrE,wBAAwB,KAAK;;EAE5C,iBAAiB;EACjB;;;wBAIc,aAAa,OAAO,SAAS,SAAS,kCAAe,IAAA"}
@@ -0,0 +1,134 @@
1
+ import { detectGrammar, highlightToLines } from "@agimon-ai/po-web-components/text";
2
+ import { Text } from "react-native-unistyles/components/native/Text";
3
+ import { StyleSheet } from "react-native-unistyles";
4
+ import { useEffect, useState } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/components/SyntaxLine.tsx
8
+ /**
9
+ * Colours `text` as lines of spans, or undefined while loading and for text with
10
+ * no grammar. Pass a whole block, not one line: a line is not a parse unit.
11
+ */
12
+ function useSyntaxLines(text, query = {}) {
13
+ const grammar = detectGrammar({
14
+ path: query.path,
15
+ text
16
+ });
17
+ const signature = `${grammar ?? ""}\u0000${text}`;
18
+ const [done, setDone] = useState();
19
+ useEffect(() => {
20
+ if (grammar === void 0) return;
21
+ let live = true;
22
+ const controller = new AbortController();
23
+ highlightToLines(text, grammar, controller.signal).then((lines) => {
24
+ if (live && lines !== void 0) setDone({
25
+ signature,
26
+ lines
27
+ });
28
+ }, () => void 0);
29
+ return () => {
30
+ live = false;
31
+ controller.abort();
32
+ };
33
+ }, [
34
+ text,
35
+ grammar,
36
+ signature
37
+ ]);
38
+ return done?.signature === signature ? done.lines : void 0;
39
+ }
40
+ /** One line: coloured when its spans are in, the plain text until then. */
41
+ function SyntaxLine({ spans, text, ...props }) {
42
+ return /* @__PURE__ */ jsx(Text, {
43
+ ...props,
44
+ children: spans?.map((span, index) => /* @__PURE__ */ jsx(Text, {
45
+ style: span.token === void 0 ? void 0 : syntax[span.token],
46
+ children: span.text
47
+ }, index)) ?? text
48
+ });
49
+ }
50
+ /** The web's `PO_SYNTAX_STYLES`, on the native theme's colours. */
51
+ const syntax = StyleSheet.create((theme) => ({
52
+ comment: {
53
+ color: theme.colors.faint,
54
+ fontStyle: "italic",
55
+ uni__dependencies: [0]
56
+ },
57
+ keyword: {
58
+ color: theme.colors.magenta,
59
+ uni__dependencies: [0]
60
+ },
61
+ constant: {
62
+ color: theme.colors.violet,
63
+ uni__dependencies: [0]
64
+ },
65
+ literal: {
66
+ color: theme.colors.orange,
67
+ uni__dependencies: [0]
68
+ },
69
+ string: {
70
+ color: theme.colors.green,
71
+ uni__dependencies: [0]
72
+ },
73
+ regexp: {
74
+ color: theme.colors.teal,
75
+ uni__dependencies: [0]
76
+ },
77
+ operator: {
78
+ color: theme.colors.blue,
79
+ uni__dependencies: [0]
80
+ },
81
+ punctuation: {
82
+ color: theme.colors.dim,
83
+ uni__dependencies: [0]
84
+ },
85
+ variable: {
86
+ color: theme.colors.text,
87
+ uni__dependencies: [0]
88
+ },
89
+ property: {
90
+ color: theme.colors.cyan,
91
+ uni__dependencies: [0]
92
+ },
93
+ callable: {
94
+ color: theme.colors.blue,
95
+ uni__dependencies: [0]
96
+ },
97
+ type: {
98
+ color: theme.colors.yellow,
99
+ uni__dependencies: [0]
100
+ },
101
+ tag: {
102
+ color: theme.colors.red,
103
+ uni__dependencies: [0]
104
+ },
105
+ attribute: {
106
+ color: theme.colors.yellow,
107
+ uni__dependencies: [0]
108
+ },
109
+ meta: {
110
+ color: theme.colors.faint,
111
+ uni__dependencies: [0]
112
+ },
113
+ heading: {
114
+ color: theme.colors.hi,
115
+ fontWeight: "bold",
116
+ uni__dependencies: [0]
117
+ },
118
+ link: {
119
+ color: theme.colors.cyan,
120
+ textDecorationLine: "underline",
121
+ uni__dependencies: [0]
122
+ },
123
+ emphasis: { fontStyle: "italic" },
124
+ strong: { fontWeight: "bold" },
125
+ strikethrough: { textDecorationLine: "line-through" },
126
+ invalid: {
127
+ color: theme.colors.red,
128
+ uni__dependencies: [0]
129
+ }
130
+ }));
131
+
132
+ //#endregion
133
+ export { SyntaxLine, useSyntaxLines };
134
+ //# sourceMappingURL=SyntaxLine.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyntaxLine.mjs","names":["detectGrammar","highlightToLines","SyntaxSpan","useEffect","useState","TextProps","StyleSheet","useSyntaxLines","text","query","path","grammar","signature","done","setDone","lines","undefined","live","controller","AbortController","signal","then","abort","SyntaxLineProps","Omit","spans","SyntaxLine","props","map","span","index","token","syntax","create","theme","comment","color","colors","faint","fontStyle","uni__dependencies","keyword","magenta","constant","violet","literal","orange","string","green","regexp","teal","operator","blue","punctuation","dim","variable","property","cyan","callable","type","yellow","tag","red","attribute","meta","heading","hi","fontWeight","link","textDecorationLine","emphasis","strong","strikethrough","invalid"],"sources":["../../src/components/SyntaxLine.tsx"],"sourcesContent":["import { detectGrammar, highlightToLines, type SyntaxSpan } from '@agimon-ai/po-web-components/text';\nimport { useEffect, useState } from 'react';\nimport { Text, type TextProps } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\n/*\n * Read-only code with the editor's colours, as the web's SyntaxText: the same\n * lezer grammars through `@agimon-ai/po-web-components/text`, and the web's\n * `PO_SYNTAX_STYLES` palette on the native theme. Highlighting is async, so the\n * plain text shows first and a result that never highlights stays plain.\n */\n\n/**\n * Colours `text` as lines of spans, or undefined while loading and for text with\n * no grammar. Pass a whole block, not one line: a line is not a parse unit.\n */\nexport function useSyntaxLines(text: string, query: { path?: string | undefined } = {}) {\n const grammar = detectGrammar({ path: query.path, text });\n const signature = `${grammar ?? ''}\\u0000${text}`;\n const [done, setDone] = useState<{ signature: string; lines: readonly (readonly SyntaxSpan[])[] }>();\n\n useEffect(() => {\n if (grammar === undefined) return;\n let live = true;\n const controller = new AbortController();\n void highlightToLines(text, grammar, controller.signal).then(\n (lines) => {\n if (live && lines !== undefined) setDone({ signature, lines });\n },\n // A grammar that fails to load leaves the plain text in place: colour is decoration.\n () => undefined,\n );\n return () => {\n live = false;\n controller.abort();\n };\n }, [text, grammar, signature]);\n\n return done?.signature === signature ? done.lines : undefined;\n}\n\nexport interface SyntaxLineProps extends Omit<TextProps, 'children'> {\n /** The line's spans from `useSyntaxLines`, or undefined to show `text` plain. */\n spans?: readonly SyntaxSpan[] | undefined;\n text: string;\n}\n\n/** One line: coloured when its spans are in, the plain text until then. */\nexport function SyntaxLine({ spans, text, ...props }: SyntaxLineProps) {\n return (\n <Text {...props}>\n {spans?.map((span, index) => (\n <Text key={index} style={span.token === undefined ? undefined : syntax[span.token]}>\n {span.text}\n </Text>\n )) ?? text}\n </Text>\n );\n}\n\n/** The web's `PO_SYNTAX_STYLES`, on the native theme's colours. */\nconst syntax = StyleSheet.create((theme) => ({\n comment: { color: theme.colors.faint, fontStyle: 'italic' },\n keyword: { color: theme.colors.magenta },\n constant: { color: theme.colors.violet },\n literal: { color: theme.colors.orange },\n string: { color: theme.colors.green },\n regexp: { color: theme.colors.teal },\n operator: { color: theme.colors.blue },\n punctuation: { color: theme.colors.dim },\n variable: { color: theme.colors.text },\n property: { color: theme.colors.cyan },\n callable: { color: theme.colors.blue },\n type: { color: theme.colors.yellow },\n tag: { color: theme.colors.red },\n attribute: { color: theme.colors.yellow },\n meta: { color: theme.colors.faint },\n heading: { color: theme.colors.hi, fontWeight: 'bold' },\n link: { color: theme.colors.cyan, textDecorationLine: 'underline' },\n emphasis: { fontStyle: 'italic' },\n strong: { fontWeight: 'bold' },\n strikethrough: { textDecorationLine: 'line-through' },\n invalid: { color: theme.colors.red },\n}));\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgBO,eAAeC,MAAcC,QAAuC,CAAC,GAAG;CACtF,MAAME,UAAUX,cAAc;EAAEU,MAAMD,MAAMC;EAAMF;CAAK,CAAC;CACxD,MAAMI,YAAY,GAAGD,WAAW,GAAE,QAASH;CAC3C,MAAM,CAACK,MAAMC,WAAWV,SAA2E;CAEnGD,gBAAgB;EACd,IAAIQ,YAAYK,QAAW;EAC3B,IAAIC,OAAO;EACX,MAAMC,aAAa,IAAIC,gBAAgB;EACvC,AAAKlB,iBAAiBO,MAAMG,SAASO,WAAWE,MAAM,CAAC,CAACC,MACrDN,UAAU;GACT,IAAIE,QAAQF,UAAUC,QAAWF,QAAQ;IAAEF;IAAWG;GAAM,CAAC;EAC/D,SAEMC,MACR;EACA,aAAa;GACXC,OAAO;GACPC,WAAWI,MAAM;EACnB;CACF,GAAG;EAACd;EAAMG;EAASC;CAAS,CAAC;CAE7B,OAAOC,MAAMD,cAAcA,YAAYC,KAAKE,QAAQC;AACtD;;AASA,SAAgBU,WAAW,EAAED,OAAOjB,MAAM,GAAGmB,SAA0B;CACrE,OACE,oBAAC,MAAD;EAAM,GAAIA;YACPF,OAAOG,KAAKC,MAAMC,UACjB,oBAAC,MAAD;GAAkB,OAAOD,KAAKE,UAAUf,SAAYA,SAAYgB,OAAOH,KAAKE;aACzEF,KAAKrB;EACF,GAFKsB,KAEL,CACP,KAAKtB;CACF;AAEV;;AAGA,MAAMwB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MAAMG,OAAO6B;EAAIC,YAAY;EAAM3B,mBAAA,CAAA,CAAA;CAAC;CACtD4B,MAAM;EAAEhC,OAAOF,MAAMG,OAAOoB;EAAMY,oBAAoB;EAAW7B,mBAAA,CAAA,CAAA;CAAC;CAClE8B,UAAU,EAAE/B,WAAW,SAAS;CAChCgC,QAAQ,EAAEJ,YAAY,OAAO;CAC7BK,eAAe,EAAEH,oBAAoB,eAAe;CACpDI,SAAS;EAAErC,OAAOF,MAAMG,OAAOyB;EAAGtB,mBAAA,CAAA,CAAA;CAAC;AACrC,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.d.mts","names":[],"sources":["../../src/components/Tabs.tsx"],"mappings":";;;iBA8BiB,kBAAkB,KAAK;;EAEtC;EACA;EACA,iBAAiB;EACjB,WAAW;EACX,QAAQ,UAAU;;wBAGJ,OAAO,OAAO,cAAc,eAAe,UAAU,UAAU,SAAS,4BAAS,IAAA;iBAehF;EACf,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,WAAW,UAAU,SAAS,gCAAa,IAAA;iBAc1C;EACf;EACA;;EAEA,WAAW;EACX;EACA,QAAQ,UAAU;;wBAGJ,cAAc,OAAO,UAAkB,UAAU,oBAAoB,SAAS,mCAAgB,IAAA;iBA2B7F,yBAAyB,KAAK;EAC7C;EACA,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,cAAc,OAAO,UAAU,UAAU,SAAS,mCAAgB,IAAA;iBAUjE;;EAEf;EACA,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,WAAW,QAAQ,UAAU,SAAS,gCAAa,IAAA"}
1
+ {"version":3,"file":"Tabs.d.mts","names":[],"sources":["../../src/components/Tabs.tsx"],"mappings":";;;iBA8BiB,kBAAkB,KAAK;;EAEtC;EACA;EACA,iBAAiB;EACjB,WAAW;EACX,QAAQ,UAAU;;wBAGJ,OAAO,OAAO,cAAc,eAAe,UAAU,UAAU,SAAS,4BAAS,IAAA;iBAgBhF;EACf,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,WAAW,UAAU,SAAS,gCAAa,IAAA;iBAc1C;EACf;EACA;;EAEA,WAAW;EACX;EACA,QAAQ,UAAU;;wBAGJ,cAAc,OAAO,UAAkB,UAAU,oBAAoB,SAAS,mCAAgB,IAAA;iBA2B7F,yBAAyB,KAAK;EAC7C;EACA,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,cAAc,OAAO,UAAU,UAAU,SAAS,mCAAgB,IAAA;iBAUjE;;EAEf;EACA,WAAW;EACX,QAAQ,UAAU;;;wBAIJ,WAAW,QAAQ,UAAU,SAAS,gCAAa,IAAA"}
@@ -1,11 +1,11 @@
1
1
  import { fontOf } from "../lib/fonts.mjs";
2
- import { wrapText } from "../lib/wrapText.mjs";
3
2
  import { selectionTick } from "../lib/haptics.mjs";
3
+ import { wrapText } from "../lib/wrapText.mjs";
4
4
  import { useControllable } from "../lib/useControllable.mjs";
5
5
  import { View } from "react-native-unistyles/components/native/View";
6
- import { StyleSheet } from "react-native-unistyles";
7
6
  import { Text } from "react-native-unistyles/components/native/Text";
8
- import { createContext, useContext } from "react";
7
+ import { StyleSheet } from "react-native-unistyles";
8
+ import { createContext, useContext, useMemo } from "react";
9
9
  import { jsx } from "react/jsx-runtime";
10
10
  import { Pressable } from "react-native-unistyles/components/native/Pressable";
11
11
  import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
@@ -23,11 +23,12 @@ const TabsContext = createContext({
23
23
  const TabActiveContext = createContext(false);
24
24
  function Tabs({ value, defaultValue, onValueChange, children, style, ...props }) {
25
25
  const [current, setValue] = useControllable(value, defaultValue, onValueChange);
26
+ const context = useMemo(() => ({
27
+ value: current,
28
+ setValue
29
+ }), [current, setValue]);
26
30
  return /* @__PURE__ */ jsx(TabsContext.Provider, {
27
- value: {
28
- value: current,
29
- setValue
30
- },
31
+ value: context,
31
32
  children: /* @__PURE__ */ jsx(View, {
32
33
  style: [styles.tabs, style],
33
34
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.mjs","names":["createContext","ReactNode","useContext","StyleProp","ViewProps","ViewStyle","StyleSheet","fontOf","selectionTick","useControllable","wrapText","TAB_HEIGHT","MIN_TAP_TARGET","DISABLED_OPACITY","BADGE_SIZE","TabsState","value","setValue","TabsContext","undefined","TabActiveContext","TabsProps","Omit","defaultValue","onValueChange","children","style","Tabs","props","current","next","styles","tabs","TabsListProps","TabsList","listScroll","list","TabsTriggerProps","disabled","accessibilityLabel","TabsTrigger","active","_styles","useVariants","selected","pressed","tab","label","labelPressed","TabsContentProps","TabsContent","content","contentText","TabBadgeProps","TabBadge","inherited","_styles2","badge","badgeText","create","theme","gap","spacing","uni__dependencies","flexGrow","flexDirection","alignItems","minHeight","minWidth","borderRadius","DEFAULT","paddingHorizontal","paddingVertical","variants","true","backgroundColor","colors","false","panel","opacity","fontFamily","sans","fontSize","base","lineHeight","color","green","fontWeight","semibold","dim","medium","hi","sm","justifyContent","height","full","idle","rail"],"sources":["../../src/components/Tabs.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext } from 'react';\nimport { Pressable, ScrollView, type StyleProp, Text, View, type ViewProps, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { selectionTick } from '../lib/haptics';\nimport { useControllable } from '../lib/useControllable';\nimport { wrapText } from '../lib/wrapText';\n\n/*\n * The web Tabs on a horizontal ScrollView: a strip that scrolls when the tabs\n * outgrow the screen, the active tab in a green tint, and a selection tick on\n * each change. The panels swap in place.\n */\n\n/** `min-h-6`, padded to Apple's 44pt tap target by hitSlop. */\nconst TAB_HEIGHT = 24;\nconst MIN_TAP_TARGET = 44;\nconst DISABLED_OPACITY = 0.4;\nconst BADGE_SIZE = 15;\n\ninterface TabsState {\n value: string | undefined;\n setValue: (value: string) => void;\n}\n\nconst TabsContext = createContext<TabsState>({ value: undefined, setValue: () => undefined });\n/** Whether the enclosing trigger is active, so a TabBadge inverts without being told. */\nconst TabActiveContext = createContext(false);\n\nexport interface TabsProps extends Omit<ViewProps, 'children' | 'style'> {\n /** Controlled mode; pair with onValueChange. Omit it and the tabs keep their own state. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function Tabs({ value, defaultValue, onValueChange, children, style, ...props }: TabsProps) {\n const [current, setValue] = useControllable<string | undefined>(\n value,\n defaultValue,\n onValueChange as ((next: string | undefined) => void) | undefined,\n );\n return (\n <TabsContext.Provider value={{ value: current, setValue }}>\n <View style={[styles.tabs, style]} {...props}>\n {children}\n </View>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabsListProps {\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The tab strip; it scrolls sideways when the tabs outgrow it. */\nexport function TabsList({ children, style }: TabsListProps) {\n return (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n accessibilityRole=\"tablist\"\n style={styles.listScroll}\n contentContainerStyle={[styles.list, style]}\n >\n {children}\n </ScrollView>\n );\n}\n\nexport interface TabsTriggerProps {\n value: string;\n disabled?: boolean;\n /** The label; a bare string is drawn in the tab's type, and a TabBadge may follow it. */\n children?: ReactNode;\n accessibilityLabel?: string;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function TabsTrigger({ value, disabled = false, children, accessibilityLabel, style }: TabsTriggerProps) {\n const tabs = useContext(TabsContext);\n const active = tabs.value === value;\n styles.useVariants({ active });\n return (\n <Pressable\n accessibilityRole=\"tab\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected: active, disabled }}\n disabled={disabled}\n hitSlop={(MIN_TAP_TARGET - TAB_HEIGHT) / 2}\n onPress={() => {\n if (active) return;\n selectionTick();\n tabs.setValue(value);\n }}\n style={({ pressed }) => [styles.tab, pressed && !active && styles.pressed, disabled && styles.disabled, style]}\n >\n {({ pressed }) => (\n <TabActiveContext.Provider value={active}>\n {wrapText(children, [styles.label, pressed && !active && styles.labelPressed])}\n </TabActiveContext.Provider>\n )}\n </Pressable>\n );\n}\n\nexport interface TabsContentProps extends Omit<ViewProps, 'children' | 'style'> {\n value: string;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The panel for one tab; only the active one renders. */\nexport function TabsContent({ value, children, style, ...props }: TabsContentProps) {\n const tabs = useContext(TabsContext);\n if (tabs.value !== value) return null;\n return (\n <View style={[styles.content, style]} {...props}>\n {wrapText(children, styles.contentText)}\n </View>\n );\n}\n\nexport interface TabBadgeProps {\n /** Defaults to the enclosing tab's state: it inverts on the active tab so it stays readable on the tint. */\n active?: boolean;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The count beside a tab's label. */\nexport function TabBadge({ active, children, style }: TabBadgeProps) {\n const inherited = useContext(TabActiveContext);\n styles.useVariants({ badge: (active ?? inherited) ? 'active' : 'idle' });\n return (\n <View style={[styles.badge, style]}>\n <Text style={styles.badgeText}>{children}</Text>\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n tabs: { gap: theme.spacing(2) },\n listScroll: { flexGrow: 0 },\n list: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(1) },\n tab: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n minHeight: TAB_HEIGHT,\n minWidth: TAB_HEIGHT,\n borderRadius: theme.borderRadius.DEFAULT,\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1),\n variants: {\n active: {\n true: { backgroundColor: theme.colors['tint-green'] },\n false: {},\n },\n },\n },\n pressed: { backgroundColor: theme.colors.panel },\n disabled: { opacity: DISABLED_OPACITY },\n label: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n variants: {\n active: {\n true: { color: theme.colors.green, fontWeight: theme.fontWeight.semibold },\n false: { color: theme.colors.dim, fontWeight: theme.fontWeight.medium },\n },\n },\n },\n labelPressed: { color: theme.colors.hi },\n content: { flexGrow: 1, minHeight: 0 },\n contentText: {\n color: theme.colors.dim,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n badge: {\n alignItems: 'center',\n justifyContent: 'center',\n height: BADGE_SIZE,\n minWidth: BADGE_SIZE,\n borderRadius: theme.borderRadius.full,\n paddingHorizontal: theme.spacing(1),\n variants: {\n badge: {\n active: { backgroundColor: theme.colors.green },\n idle: { backgroundColor: theme.colors.panel },\n },\n },\n },\n badgeText: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize['2xs'],\n lineHeight: theme.lineHeight['2xs'],\n fontWeight: theme.fontWeight.semibold,\n variants: {\n badge: {\n active: { color: theme.colors.rail },\n idle: { color: theme.colors.dim },\n },\n },\n },\n}));\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAMW,aAAa;AAEnB,MAAME,mBAAmB;AACzB,MAAMC,aAAa;AAOnB,MAAMI,cAAclB,cAAyB;CAAEgB,OAAOG;CAAWF,gBAAgBE;AAAU,CAAC;;AAE5F,MAAMC,mBAAmBpB,cAAc,KAAK;AAW5C,SAAgB2B,KAAK,EAAEX,OAAOO,cAAcC,eAAeC,UAAUC,OAAO,GAAGE,SAAoB;CACjG,MAAM,CAACC,SAASZ,YAAYR,gBAC1BO,OACAO,cACAC,aACF;CACA,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAO;GAAER,OAAOa;GAASZ;EAAS;YACtD,oBAAC,MAAD;GAAM,OAAO,CAACc,OAAOC,MAAMN,KAAK;GAAG,GAAIE;GACpCH;EACG;CACc;AAE1B;;AAQA,SAAgBS,SAAS,EAAET,UAAUC,SAAwB;CAC3D,OACE,oBAAC,YAAD;EACE;EACA,gCAAgC;EAChC,mBAAkB;EAClB,OAAOK,OAAOI;EACd,uBAAuB,CAACJ,OAAOK,MAAMV,KAAK;EAEzCD;CACS;AAEhB;AAWA,SAAgBe,YAAY,EAAExB,OAAOsB,WAAW,O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Cf,aAAa;EACXiC,OAAOzB,MAAMgB,OAAOa;EACpBT,YAAYzE,OAAOqD,MAAMoB,WAAWC,IAAI;EACxCC,UAAUtB,MAAMsB,SAASU;EACzBR,YAAYxB,MAAMwB,WAAWQ;EAAE7B,mBAAA,CAAA,CAAA;CACjC;CACAN,OAAO;EACLS,YAAY;EACZ2B,gBAAgB;EAChBC,QAAQhF;EACRsD,UAAUtD;EACVuD,cAAcT,MAAMS,aAAa0B;EACjCxB,mBAAmBX,MAAME,QAAQ,CAAC;EAClCW,UAAU,EACRhB,OAAO;GACLhB,QAAQ,EAAEkC,iBAAiBf,MAAMgB,OAAOU,MAAM;GAC9CU,MAAM,EAAErB,iBAAiBf,MAAMgB,OAAOE,MAAM;EAC9C,EACF;EAACf,mBAAA,CAAA,GAAA,CAAA;CACH;CACAL,WAAW;EACTsB,YAAYzE,OAAOqD,MAAMoB,WAAWC,IAAI;EACxCC,UAAUtB,MAAMsB,SAAS;EACzBE,YAAYxB,MAAMwB,WAAW;EAC7BG,YAAY3B,MAAM2B,WAAWC;EAC7Bf,UAAU,EACRhB,OAAO;GACLhB,QAAQ,EAAE4C,OAAOzB,MAAMgB,OAAOqB,KAAK;GACnCD,MAAM,EAAEX,OAAOzB,MAAMgB,OAAOa,IAAI;EAClC,EACF;EAAC1B,mBAAA,CAAA,GAAA,CAAA;CACH;AACF,EAAE"}
1
+ {"version":3,"file":"Tabs.mjs","names":["createContext","ReactNode","useContext","useMemo","StyleProp","ViewProps","ViewStyle","StyleSheet","fontOf","selectionTick","useControllable","wrapText","TAB_HEIGHT","MIN_TAP_TARGET","DISABLED_OPACITY","BADGE_SIZE","TabsState","value","setValue","TabsContext","undefined","TabActiveContext","TabsProps","Omit","defaultValue","onValueChange","children","style","Tabs","props","current","next","context","styles","tabs","TabsListProps","TabsList","listScroll","list","TabsTriggerProps","disabled","accessibilityLabel","TabsTrigger","active","_styles","useVariants","selected","pressed","tab","label","labelPressed","TabsContentProps","TabsContent","content","contentText","TabBadgeProps","TabBadge","inherited","_styles2","badge","badgeText","create","theme","gap","spacing","uni__dependencies","flexGrow","flexDirection","alignItems","minHeight","minWidth","borderRadius","DEFAULT","paddingHorizontal","paddingVertical","variants","true","backgroundColor","colors","false","panel","opacity","fontFamily","sans","fontSize","base","lineHeight","color","green","fontWeight","semibold","dim","medium","hi","sm","justifyContent","height","full","idle","rail"],"sources":["../../src/components/Tabs.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { Pressable, ScrollView, type StyleProp, Text, View, type ViewProps, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { selectionTick } from '../lib/haptics';\nimport { useControllable } from '../lib/useControllable';\nimport { wrapText } from '../lib/wrapText';\n\n/*\n * The web Tabs on a horizontal ScrollView: a strip that scrolls when the tabs\n * outgrow the screen, the active tab in a green tint, and a selection tick on\n * each change. The panels swap in place.\n */\n\n/** `min-h-6`, padded to Apple's 44pt tap target by hitSlop. */\nconst TAB_HEIGHT = 24;\nconst MIN_TAP_TARGET = 44;\nconst DISABLED_OPACITY = 0.4;\nconst BADGE_SIZE = 15;\n\ninterface TabsState {\n value: string | undefined;\n setValue: (value: string) => void;\n}\n\nconst TabsContext = createContext<TabsState>({ value: undefined, setValue: () => undefined });\n/** Whether the enclosing trigger is active, so a TabBadge inverts without being told. */\nconst TabActiveContext = createContext(false);\n\nexport interface TabsProps extends Omit<ViewProps, 'children' | 'style'> {\n /** Controlled mode; pair with onValueChange. Omit it and the tabs keep their own state. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function Tabs({ value, defaultValue, onValueChange, children, style, ...props }: TabsProps) {\n const [current, setValue] = useControllable<string | undefined>(\n value,\n defaultValue,\n onValueChange as ((next: string | undefined) => void) | undefined,\n );\n const context = useMemo(() => ({ value: current, setValue }), [current, setValue]);\n return (\n <TabsContext.Provider value={context}>\n <View style={[styles.tabs, style]} {...props}>\n {children}\n </View>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabsListProps {\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The tab strip; it scrolls sideways when the tabs outgrow it. */\nexport function TabsList({ children, style }: TabsListProps) {\n return (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n accessibilityRole=\"tablist\"\n style={styles.listScroll}\n contentContainerStyle={[styles.list, style]}\n >\n {children}\n </ScrollView>\n );\n}\n\nexport interface TabsTriggerProps {\n value: string;\n disabled?: boolean;\n /** The label; a bare string is drawn in the tab's type, and a TabBadge may follow it. */\n children?: ReactNode;\n accessibilityLabel?: string;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function TabsTrigger({ value, disabled = false, children, accessibilityLabel, style }: TabsTriggerProps) {\n const tabs = useContext(TabsContext);\n const active = tabs.value === value;\n styles.useVariants({ active });\n return (\n <Pressable\n accessibilityRole=\"tab\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected: active, disabled }}\n disabled={disabled}\n hitSlop={(MIN_TAP_TARGET - TAB_HEIGHT) / 2}\n onPress={() => {\n if (active) return;\n selectionTick();\n tabs.setValue(value);\n }}\n style={({ pressed }) => [styles.tab, pressed && !active && styles.pressed, disabled && styles.disabled, style]}\n >\n {({ pressed }) => (\n <TabActiveContext.Provider value={active}>\n {wrapText(children, [styles.label, pressed && !active && styles.labelPressed])}\n </TabActiveContext.Provider>\n )}\n </Pressable>\n );\n}\n\nexport interface TabsContentProps extends Omit<ViewProps, 'children' | 'style'> {\n value: string;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The panel for one tab; only the active one renders. */\nexport function TabsContent({ value, children, style, ...props }: TabsContentProps) {\n const tabs = useContext(TabsContext);\n if (tabs.value !== value) return null;\n return (\n <View style={[styles.content, style]} {...props}>\n {wrapText(children, styles.contentText)}\n </View>\n );\n}\n\nexport interface TabBadgeProps {\n /** Defaults to the enclosing tab's state: it inverts on the active tab so it stays readable on the tint. */\n active?: boolean;\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The count beside a tab's label. */\nexport function TabBadge({ active, children, style }: TabBadgeProps) {\n const inherited = useContext(TabActiveContext);\n styles.useVariants({ badge: (active ?? inherited) ? 'active' : 'idle' });\n return (\n <View style={[styles.badge, style]}>\n <Text style={styles.badgeText}>{children}</Text>\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n tabs: { gap: theme.spacing(2) },\n listScroll: { flexGrow: 0 },\n list: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(1) },\n tab: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n minHeight: TAB_HEIGHT,\n minWidth: TAB_HEIGHT,\n borderRadius: theme.borderRadius.DEFAULT,\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1),\n variants: {\n active: {\n true: { backgroundColor: theme.colors['tint-green'] },\n false: {},\n },\n },\n },\n pressed: { backgroundColor: theme.colors.panel },\n disabled: { opacity: DISABLED_OPACITY },\n label: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n variants: {\n active: {\n true: { color: theme.colors.green, fontWeight: theme.fontWeight.semibold },\n false: { color: theme.colors.dim, fontWeight: theme.fontWeight.medium },\n },\n },\n },\n labelPressed: { color: theme.colors.hi },\n content: { flexGrow: 1, minHeight: 0 },\n contentText: {\n color: theme.colors.dim,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n badge: {\n alignItems: 'center',\n justifyContent: 'center',\n height: BADGE_SIZE,\n minWidth: BADGE_SIZE,\n borderRadius: theme.borderRadius.full,\n paddingHorizontal: theme.spacing(1),\n variants: {\n badge: {\n active: { backgroundColor: theme.colors.green },\n idle: { backgroundColor: theme.colors.panel },\n },\n },\n },\n badgeText: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize['2xs'],\n lineHeight: theme.lineHeight['2xs'],\n fontWeight: theme.fontWeight.semibold,\n variants: {\n badge: {\n active: { color: theme.colors.rail },\n idle: { color: theme.colors.dim },\n },\n },\n },\n}));\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAMY,aAAa;AAEnB,MAAME,mBAAmB;AACzB,MAAMC,aAAa;AAOnB,MAAMI,cAAcnB,cAAyB;CAAEiB,OAAOG;CAAWF,gBAAgBE;AAAU,CAAC;;AAE5F,MAAMC,mBAAmBrB,cAAc,KAAK;AAW5C,SAAgB4B,KAAK,EAAEX,OAAOO,cAAcC,eAAeC,UAAUC,OAAO,GAAGE,SAAoB;CACjG,MAAM,CAACC,SAASZ,YAAYR,gBAC1BO,OACAO,cACAC,aACF;CACA,MAAMO,UAAU7B,eAAe;EAAEc,OAAOa;EAASZ;CAAS,IAAI,CAACY,SAASZ,QAAQ,CAAC;CACjF,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAOc;YAC3B,oBAAC,MAAD;GAAM,OAAO,CAACC,OAAOC,MAAMP,KAAK;GAAG,GAAIE;GACpCH;EACG;CACc;AAE1B;;AAQA,SAAgBU,SAAS,EAAEV,UAAUC,SAAwB;CAC3D,OACE,oBAAC,YAAD;EACE;EACA,gCAAgC;EAChC,mBAAkB;EAClB,OAAOM,OAAOI;EACd,uBAAuB,CAACJ,OAAOK,MAAMX,KAAK;EAEzCD;CACS;AAEhB;AAWA,SAAgBgB,YAAY,EAAEzB,OAAOuB,WAAW,OAAOd,UAAUe,oBAAoBd,SAA2B;CAC9G,MAAMO,OAAOhC,WAAWiB,WAAW;CACnC,MAAMwB,SAAST,KAAKjB,UAAUA;CAAM,MAAA2B,UAAAX;CAAA;EAAA,MAAAA,SAAAW,QAAAC,YACjB,EAAEF,OAAO,CAAC;EAC7B,OACE,oBAAC,WAAD;GACE,mBAAkB;GACEF;GACpB,oBAAoB;IAAEK,UAAUH;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D;EACVwD,cAAcT,MAAMS,aAAa0B;EACjCxB,mBAAmBX,MAAME,QAAQ,CAAC;EAClCW,UAAU,EACRhB,OAAO;GACLhB,QAAQ,EAAEkC,iBAAiBf,MAAMgB,OAAOU,MAAM;GAC9CU,MAAM,EAAErB,iBAAiBf,MAAMgB,OAAOE,MAAM;EAC9C,EACF;EAACf,mBAAA,CAAA,GAAA,CAAA;CACH;CACAL,WAAW;EACTsB,YAAY1E,OAAOsD,MAAMoB,WAAWC,IAAI;EACxCC,UAAUtB,MAAMsB,SAAS;EACzBE,YAAYxB,MAAMwB,WAAW;EAC7BG,YAAY3B,MAAM2B,WAAWC;EAC7Bf,UAAU,EACRhB,OAAO;GACLhB,QAAQ,EAAE4C,OAAOzB,MAAMgB,OAAOqB,KAAK;GACnCD,MAAM,EAAEX,OAAOzB,MAAMgB,OAAOa,IAAI;EAClC,EACF;EAAC1B,mBAAA,CAAA,GAAA,CAAA;CACH;AACF,EAAE"}
@@ -0,0 +1,10 @@
1
+ import { TextProps } from "react-native";
2
+ //#region src/components/ToolPathLink.d.ts
3
+ export interface ToolPathLinkProps extends Omit<TextProps, 'children' | 'onPress'> {
4
+ path: string;
5
+ /** Opens the file; omitted when nothing installed can show it. */
6
+ onOpen?: () => void;
7
+ }
8
+ export declare function ToolPathLink({ path, onOpen, style, ...props }: ToolPathLinkProps): import("react").JSX.Element;
9
+ //#endregion
10
+ //# sourceMappingURL=ToolPathLink.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolPathLink.d.mts","names":[],"sources":["../../src/components/ToolPathLink.tsx"],"mappings":";;iBAaiB,0BAA0B,KAAK;EAC9C;;EAEA;;wBAGc,eAAe,MAAM,QAAQ,UAAU,SAAS,oCAAiB,IAAA"}
@@ -0,0 +1,42 @@
1
+ import { fontOf } from "../lib/fonts.mjs";
2
+ import { Text } from "react-native-unistyles/components/native/Text";
3
+ import { StyleSheet } from "react-native-unistyles";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { useT } from "@agimon-ai/po-core/native";
6
+
7
+ //#region src/components/ToolPathLink.tsx
8
+ function ToolPathLink({ path, onOpen, style, ...props }) {
9
+ const t = useT();
10
+ return /* @__PURE__ */ jsx(Text, {
11
+ numberOfLines: 1,
12
+ ellipsizeMode: "middle",
13
+ testID: "tool-path",
14
+ ...onOpen === void 0 ? {} : {
15
+ accessibilityRole: "link",
16
+ accessibilityHint: t("nativeComponents.markdown.openHint", "open {target}", { target: path }),
17
+ onPress: onOpen
18
+ },
19
+ style: [
20
+ styles.path,
21
+ onOpen !== void 0 && styles.link,
22
+ style
23
+ ],
24
+ ...props,
25
+ children: path
26
+ });
27
+ }
28
+ const styles = StyleSheet.create((theme) => ({
29
+ path: {
30
+ flexShrink: 1,
31
+ color: theme.colors.text,
32
+ fontFamily: fontOf(theme.fontFamily.sans),
33
+ fontSize: theme.fontSize.base,
34
+ lineHeight: theme.lineHeight.base,
35
+ uni__dependencies: [0]
36
+ },
37
+ link: { textDecorationLine: "underline" }
38
+ }));
39
+
40
+ //#endregion
41
+ export { ToolPathLink };
42
+ //# sourceMappingURL=ToolPathLink.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolPathLink.mjs","names":["useT","TextProps","StyleSheet","fontOf","ToolPathLinkProps","Omit","path","onOpen","ToolPathLink","style","props","t","undefined","accessibilityRole","const","accessibilityHint","target","onPress","styles","link","create","theme","flexShrink","color","colors","text","fontFamily","sans","fontSize","base","lineHeight","uni__dependencies","textDecorationLine"],"sources":["../../src/components/ToolPathLink.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/native';\nimport { Text, type TextProps } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\n\n/*\n * The file path in a tool call's header, as a link when something can open it,\n * as the web's ToolPathLink. The host decides whether the path opens and hands\n * the answer down as `onOpen`; without one the path stays plain text, because\n * a link that opens nothing is worse than no link.\n */\n\nexport interface ToolPathLinkProps extends Omit<TextProps, 'children' | 'onPress'> {\n path: string;\n /** Opens the file; omitted when nothing installed can show it. */\n onOpen?: () => void;\n}\n\nexport function ToolPathLink({ path, onOpen, style, ...props }: ToolPathLinkProps) {\n const t = useT();\n return (\n <Text\n numberOfLines={1}\n ellipsizeMode=\"middle\"\n testID=\"tool-path\"\n {...(onOpen === undefined\n ? {}\n : {\n accessibilityRole: 'link' as const,\n accessibilityHint: t('nativeComponents.markdown.openHint', 'open {target}', { target: path }),\n onPress: onOpen,\n })}\n style={[styles.path, onOpen !== undefined && styles.link, style]}\n {...props}\n >\n {path}\n </Text>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n path: {\n flexShrink: 1,\n color: theme.colors.text,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n link: { textDecorationLine: 'underline' },\n}));\n"],"mappings":";;;;;;;AAmBA,SAAgBQ,aAAa,EAAEF,MAAMC,QAAQE,OAAO,GAAGC,SAA4B;CACjF,MAAMC,IAAIX,KAAK;CACf,OACE,oBAAC,MAAD;EACE,eAAe;EACf,eAAc;EACd,QAAO;EACP,GAAKO,WAAWK,SACZ,CAAC,IACD;GACEC,mBAAmB;GACnBE,mBAAmBJ,EAAE,sCAAsC,iBAAiB,EAAEK,QAAQV,KAAK,CAAC;GAC5FW,SAASV;EACX;EACJ,OAAO;GAACW,OAAOZ;GAAMC,WAAWK,UAAaM,OAAOC;GAAMV;EAAK;EAC/D,GAAIC;YAEHJ;CACG;AAEV;AAEA,MAAMY,SAAShB,WAAWkB,QAAQC,WAAW;CAC3Cf,MAAM;EACJgB,YAAY;EACZC,OAAOF,MAAMG,OAAOC;EACpBC,YAAYvB,OAAOkB,MAAMK,WAAWC,IAAI;EACxCC,UAAUP,MAAMO,SAASC;EACzBC,YAAYT,MAAMS,WAAWD;EAAIE,mBAAA,CAAA,CAAA;CACnC;CACAZ,MAAM,EAAEa,oBAAoB,YAAY;AAC1C,EAAE"}
@@ -0,0 +1,21 @@
1
+ import { ImageProps } from "react-native";
2
+ import { WebPluginSlotProps } from "@agimon-ai/po-core/native";
3
+ //#region src/components/ToolResultImage.d.ts
4
+ interface ImageSource {
5
+ sessionId: string;
6
+ data: string;
7
+ mimeType: string;
8
+ title: string;
9
+ }
10
+ export interface ToolResultImageProps extends Omit<ImageProps, 'source'> {
11
+ host: Pick<WebPluginSlotProps, 'sessionId' | 'slotData' | 'openTransientTab' | 'openTab'>;
12
+ data: string;
13
+ mimeType: string;
14
+ }
15
+ /** With Author installed, opens a picture in its feedback canvas; undefined without Author or a session. */
16
+ export declare function authorImageOpener(host: ToolResultImageProps['host']): ((image: Omit<ImageSource, "sessionId">) => Promise<void>) | undefined;
17
+ /** Keeps the thumbnail's appearance; with Author installed, a tap opens its feedback canvas. */
18
+ export declare function ToolResultImage({ host, data, mimeType, accessibilityLabel: accessibilityLabelProp, ...props }: ToolResultImageProps): import("react").JSX.Element;
19
+ //#endregion
20
+ export {};
21
+ //# sourceMappingURL=ToolResultImage.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolResultImage.d.mts","names":[],"sources":["../../src/components/ToolResultImage.tsx"],"mappings":";;;UAIU;EACR;EACA;EACA;EACA;;iBAiBe,6BAA6B,KAAK;EACjD,MAAM,KAAK;EACX;EACA;;;wBAIc,kBAAkB,MAAM,iCAA4B,OAI7C,KAAK,8BAAyB;;wBAerC,kBACd,MACA,MACA,UACA,oBAAoB,2BACjB,SACF,uCAAoB,IAAA"}
@@ -0,0 +1,60 @@
1
+ import { Alert } from "react-native";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Pressable } from "react-native-unistyles/components/native/Pressable";
4
+ import { t, useT } from "@agimon-ai/po-core/native";
5
+ import { Image } from "react-native-unistyles/components/native/Image";
6
+
7
+ //#region src/components/ToolResultImage.tsx
8
+ const authorImages = {
9
+ slot: "author.open-source",
10
+ parse(input) {
11
+ if (typeof input !== "object" || input === null) return null;
12
+ const action = input;
13
+ return action.version === 1 && typeof action.createImageTab === "function" ? action : null;
14
+ }
15
+ };
16
+ /** With Author installed, opens a picture in its feedback canvas; undefined without Author or a session. */
17
+ function authorImageOpener(host) {
18
+ const { sessionId } = host;
19
+ const action = sessionId === null ? void 0 : host.slotData?.(authorImages)[0]?.data;
20
+ if (sessionId === null || action === void 0) return void 0;
21
+ return async (image) => {
22
+ try {
23
+ const tab = await action.createImageTab({
24
+ sessionId,
25
+ ...image
26
+ });
27
+ host.openTransientTab(tab);
28
+ host.openTab(tab.id);
29
+ } catch (error) {
30
+ Alert.alert(t("nativeComponents.toolResultImage.openFailed", "Couldn't open this image"), error instanceof Error ? error.message : String(error));
31
+ }
32
+ };
33
+ }
34
+ /** Keeps the thumbnail's appearance; with Author installed, a tap opens its feedback canvas. */
35
+ function ToolResultImage({ host, data, mimeType, accessibilityLabel: accessibilityLabelProp, ...props }) {
36
+ const t = useT();
37
+ const accessibilityLabel = accessibilityLabelProp ?? t("nativeComponents.markdown.image", "Image");
38
+ const open = authorImageOpener(host);
39
+ const image = /* @__PURE__ */ jsx(Image, {
40
+ ...props,
41
+ source: { uri: `data:${mimeType};base64,${data}` },
42
+ accessibilityLabel
43
+ });
44
+ if (open === void 0) return image;
45
+ return /* @__PURE__ */ jsx(Pressable, {
46
+ accessibilityRole: "button",
47
+ accessibilityLabel: t("nativeComponents.toolResultImage.open", "Open {name} in Author", { name: accessibilityLabel }),
48
+ accessibilityHint: t("nativeComponents.toolResultImage.openHint", "View full size and give feedback"),
49
+ onPress: () => open({
50
+ data,
51
+ mimeType,
52
+ title: accessibilityLabel
53
+ }),
54
+ children: image
55
+ });
56
+ }
57
+
58
+ //#endregion
59
+ export { ToolResultImage, authorImageOpener };
60
+ //# sourceMappingURL=ToolResultImage.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolResultImage.mjs","names":["t","useT","SlotDeclaration","WebPluginSlotProps","TransientTab","Alert","ImageProps","ImageSource","sessionId","data","mimeType","title","authorImages","createImageTab","input","Promise","slot","parse","action","version","ToolResultImageProps","Omit","host","Pick","authorImageOpener","undefined","slotData","image","tab","openTransientTab","openTab","id","error","alert","Error","message","String","ToolResultImage","accessibilityLabel","accessibilityLabelProp","props","open","uri","name"],"sources":["../../src/components/ToolResultImage.tsx"],"sourcesContent":["import { t, useT, type SlotDeclaration, type WebPluginSlotProps } from '@agimon-ai/po-core/native';\nimport type { TransientTab } from '@agimon-ai/po-core/web';\nimport { Alert, Image, Pressable, type ImageProps } from 'react-native';\n\ninterface ImageSource {\n sessionId: string;\n data: string;\n mimeType: string;\n title: string;\n}\n\n// Duck-typed like the artifact browser: shared UI never imports an optional mode.\nconst authorImages: SlotDeclaration<{\n createImageTab(input: ImageSource): Promise<TransientTab>;\n}> = {\n slot: 'author.open-source',\n parse(input) {\n if (typeof input !== 'object' || input === null) return null;\n const action = input as { version?: unknown; createImageTab?: unknown };\n return action.version === 1 && typeof action.createImageTab === 'function'\n ? (action as { createImageTab(input: ImageSource): Promise<TransientTab> })\n : null;\n },\n};\n\nexport interface ToolResultImageProps extends Omit<ImageProps, 'source'> {\n host: Pick<WebPluginSlotProps, 'sessionId' | 'slotData' | 'openTransientTab' | 'openTab'>;\n data: string;\n mimeType: string;\n}\n\n/** With Author installed, opens a picture in its feedback canvas; undefined without Author or a session. */\nexport function authorImageOpener(host: ToolResultImageProps['host']) {\n const { sessionId } = host;\n const action = sessionId === null ? undefined : host.slotData?.(authorImages)[0]?.data;\n if (sessionId === null || action === undefined) return undefined;\n return async (image: Omit<ImageSource, 'sessionId'>) => {\n try {\n const tab = await action.createImageTab({ sessionId, ...image });\n host.openTransientTab(tab);\n host.openTab(tab.id);\n } catch (error) {\n Alert.alert(\n t('nativeComponents.toolResultImage.openFailed', \"Couldn't open this image\"),\n error instanceof Error ? error.message : String(error),\n );\n }\n };\n}\n\n/** Keeps the thumbnail's appearance; with Author installed, a tap opens its feedback canvas. */\nexport function ToolResultImage({\n host,\n data,\n mimeType,\n accessibilityLabel: accessibilityLabelProp,\n ...props\n}: ToolResultImageProps) {\n const t = useT();\n const accessibilityLabel = accessibilityLabelProp ?? t('nativeComponents.markdown.image', 'Image');\n const open = authorImageOpener(host);\n const image = (\n <Image {...props} source={{ uri: `data:${mimeType};base64,${data}` }} accessibilityLabel={accessibilityLabel} />\n );\n if (open === undefined) return image;\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={t('nativeComponents.toolResultImage.open', 'Open {name} in Author', {\n name: accessibilityLabel,\n })}\n accessibilityHint={t('nativeComponents.toolResultImage.openHint', 'View full size and give feedback')}\n onPress={() => open({ data, mimeType, title: accessibilityLabel })}\n >\n {image}\n </Pressable>\n );\n}\n"],"mappings":";;;;;;;AAYA,MAAMY,eAED;CACHI,MAAM;CACNC,MAAMH,OAAO;EACX,IAAI,OAAOA,UAAU,YAAYA,UAAU,MAAM,OAAO;EACxD,MAAMI,SAASJ;EACf,OAAOI,OAAOC,YAAY,KAAK,OAAOD,OAAOL,mBAAmB,aAC3DK,SACD;CACN;AACF;;AASA,SAAgBM,kBAAkBF,MAAoC;CACpE,MAAM,EAAEd,cAAcc;CACtB,MAAMJ,SAASV,cAAc,OAAOiB,SAAYH,KAAKI,WAAWd,YAAY,CAAC,CAAC,EAAE,EAAEH;CAClF,IAAID,cAAc,QAAQU,WAAWO,QAAW,OAAOA;CACvD,OAAO,OAAOE,UAA0C;EACtD,IAAI;GACF,MAAMC,MAAM,MAAMV,OAAOL,eAAe;IAAEL;IAAW,GAAGmB;GAAM,CAAC;GAC/DL,KAAKO,iBAAiBD,GAAG;GACzBN,KAAKQ,QAAQF,IAAIG,EAAE;EACrB,SAASC,OAAO;GACd3B,MAAM4B,MACJjC,EAAE,+CAA+C,0BAA0B,GAC3EgC,iBAAiBE,QAAQF,MAAMG,UAAUC,OAAOJ,KAAK,CACvD;EACF;CACF;AACF;;AAGA,SAAgBK,gBAAgB,EAC9Bf,MACAb,MACAC,UACA4B,oBAAoBC,wBACpB,GAAGC,SACoB;CACvB,MAAMxC,IAAIC,KAAK;CACf,MAAMqC,qBAAqBC,0BAA0BvC,EAAE,mCAAmC,OAAO;CACjG,MAAMyC,OAAOjB,kBAAkBF,IAAI;CACnC,MAAMK,QACJ,oBAAC,OAAD;EAAO,GAAIa;EAAO,QAAQ,EAAEE,KAAK,QAAQhC,SAAQ,UAAWD,OAAO;EAAuB6B;CAAmB;CAE/G,IAAIG,SAAShB,QAAW,OAAOE;CAC/B,OACE,oBAAC,WAAD;EACE,mBAAkB;EAClB,oBAAoB3B,EAAE,yCAAyC,yBAAyB,EACtF2C,MAAML,mBACR,CAAC;EACD,mBAAmBtC,EAAE,6CAA6C,kCAAkC;EACpG,eAAeyC,KAAK;GAAEhC;GAAMC;GAAUC,OAAO2B;EAAmB,CAAC;YAEhEX;CACQ;AAEf"}
@@ -1,10 +1,11 @@
1
1
  import { NativeColorToken } from "@agimon-ai/po-web-components/nativeTheme";
2
+ import { Context } from "react";
2
3
  //#region src/icons/IconColorContext.d.ts
3
4
  /**
4
5
  * The ink an icon takes when its caller names none. A web icon inherits
5
6
  * `currentColor`; a native one cannot, so a Button provides its label colour
6
7
  * here and an icon inside it matches the label without being told.
7
8
  */
8
- export declare const IconColorContext: import("react").Context<NativeColorToken | undefined>;
9
+ export declare const IconColorContext: Context<NativeColorToken | undefined>;
9
10
  //#endregion
10
11
  //# sourceMappingURL=IconColorContext.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IconColorContext.d.mts","names":[],"sources":["../../src/icons/IconColorContext.ts"],"mappings":";;;;;;;qBAQa,kCAAgB,QAAA"}
1
+ {"version":3,"file":"IconColorContext.d.mts","names":[],"sources":["../../src/icons/IconColorContext.ts"],"mappings":";;;;;;;;qBASa,kBAAkB,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconColorContext.mjs","names":[],"sources":["../../src/icons/IconColorContext.ts"],"sourcesContent":["import type { NativeColorToken } from '@agimon-ai/po-web-components/nativeTheme';\nimport { createContext } from 'react';\n\n/**\n * The ink an icon takes when its caller names none. A web icon inherits\n * `currentColor`; a native one cannot, so a Button provides its label colour\n * here and an icon inside it matches the label without being told.\n */\nexport const IconColorContext = createContext<NativeColorToken | undefined>(undefined);\n"],"mappings":";;;;;;;;AAQA,MAAa,mBAAmB,cAA4C,MAAS"}
1
+ {"version":3,"file":"IconColorContext.mjs","names":[],"sources":["../../src/icons/IconColorContext.ts"],"sourcesContent":["import type { NativeColorToken } from '@agimon-ai/po-web-components/nativeTheme';\nimport { type Context, createContext } from 'react';\n\n/**\n * The ink an icon takes when its caller names none. A web icon inherits\n * `currentColor`; a native one cannot, so a Button provides its label colour\n * here and an icon inside it matches the label without being told.\n */\n// Annotated: the declaration build otherwise emits `Context<any>` here.\nexport const IconColorContext: Context<NativeColorToken | undefined> = createContext<NativeColorToken | undefined>(\n undefined,\n);\n"],"mappings":";;;;;;;;AASA,MAAa,mBAA0D,cACrE,MACF"}
@@ -18,6 +18,10 @@ export declare const ICON_GLYPHS: {
18
18
  readonly sf: "chevron.right";
19
19
  readonly material: "chevron-right";
20
20
  };
21
+ readonly ChevronUp: {
22
+ readonly sf: "chevron.up";
23
+ readonly material: "expand-less";
24
+ };
21
25
  readonly Alert: {
22
26
  readonly sf: "exclamationmark.circle";
23
27
  readonly material: "error-outline";
@@ -34,6 +38,10 @@ export declare const ICON_GLYPHS: {
34
38
  readonly sf: "ellipsis";
35
39
  readonly material: "more-vert";
36
40
  };
41
+ readonly Menu: {
42
+ readonly sf: "line.3.horizontal";
43
+ readonly material: "menu";
44
+ };
37
45
  readonly Edit: {
38
46
  readonly sf: "pencil";
39
47
  readonly material: "edit";
@@ -82,6 +90,14 @@ export declare const ICON_GLYPHS: {
82
90
  readonly sf: "folder";
83
91
  readonly material: "folder";
84
92
  };
93
+ readonly Globe: {
94
+ readonly sf: "globe";
95
+ readonly material: "public";
96
+ };
97
+ readonly Languages: {
98
+ readonly sf: "translate";
99
+ readonly material: "translate";
100
+ };
85
101
  readonly Branch: {
86
102
  readonly sf: "arrow.triangle.branch";
87
103
  readonly material: "call-split";
@@ -106,10 +122,18 @@ export declare const ICON_GLYPHS: {
106
122
  readonly sf: "plus";
107
123
  readonly material: "add";
108
124
  };
125
+ readonly User: {
126
+ readonly sf: "person";
127
+ readonly material: "person-outline";
128
+ };
109
129
  readonly Users: {
110
130
  readonly sf: "person.2";
111
131
  readonly material: "group";
112
132
  };
133
+ readonly IdCard: {
134
+ readonly sf: "person.text.rectangle";
135
+ readonly material: "badge";
136
+ };
113
137
  readonly PlayCircle: {
114
138
  readonly sf: "play.circle";
115
139
  readonly material: "play-circle-outline";
@@ -134,6 +158,114 @@ export declare const ICON_GLYPHS: {
134
158
  readonly sf: "lock";
135
159
  readonly material: "lock-outline";
136
160
  };
161
+ readonly Shield: {
162
+ readonly sf: "checkmark.shield";
163
+ readonly material: "verified-user";
164
+ };
165
+ readonly Download: {
166
+ readonly sf: "square.and.arrow.down";
167
+ readonly material: "file-download";
168
+ };
169
+ readonly Mic: {
170
+ readonly sf: "mic";
171
+ readonly material: "mic";
172
+ };
173
+ readonly Monitor: {
174
+ readonly sf: "laptopcomputer";
175
+ readonly material: "laptop";
176
+ };
177
+ readonly Server: {
178
+ readonly sf: "server.rack";
179
+ readonly material: "dns";
180
+ };
181
+ readonly Smartphone: {
182
+ readonly sf: "iphone";
183
+ readonly material: "smartphone";
184
+ };
185
+ readonly AudioLines: {
186
+ readonly sf: "waveform";
187
+ readonly material: "graphic-eq";
188
+ };
189
+ readonly Stop: {
190
+ readonly sf: "stop.fill";
191
+ readonly material: "stop";
192
+ };
193
+ readonly Terminal: {
194
+ readonly sf: "apple.terminal";
195
+ readonly material: "terminal";
196
+ };
197
+ readonly Hand: {
198
+ readonly sf: "hand.raised";
199
+ readonly material: "pan-tool";
200
+ };
201
+ readonly Pin: {
202
+ readonly sf: "mappin";
203
+ readonly material: "place";
204
+ };
205
+ readonly Box: {
206
+ readonly sf: "square";
207
+ readonly material: "crop-square";
208
+ };
209
+ readonly Undo: {
210
+ readonly sf: "arrow.uturn.backward";
211
+ readonly material: "undo";
212
+ };
213
+ readonly Redo: {
214
+ readonly sf: "arrow.uturn.forward";
215
+ readonly material: "redo";
216
+ };
217
+ readonly ArrowUpRight: {
218
+ readonly sf: "arrow.up.right";
219
+ readonly material: "north-east";
220
+ };
221
+ readonly Highlighter: {
222
+ readonly sf: "highlighter";
223
+ readonly material: "border-color";
224
+ };
225
+ readonly Eraser: {
226
+ readonly sf: "eraser";
227
+ readonly material: "auto-fix-normal";
228
+ };
229
+ readonly Minus: {
230
+ readonly sf: "minus";
231
+ readonly material: "remove";
232
+ };
233
+ readonly Fit: {
234
+ readonly sf: "viewfinder";
235
+ readonly material: "fit-screen";
236
+ };
237
+ readonly Refresh: {
238
+ readonly sf: "arrow.clockwise";
239
+ readonly material: "refresh";
240
+ };
241
+ readonly Calendar: {
242
+ readonly sf: "calendar";
243
+ readonly material: "event";
244
+ };
245
+ readonly Play: {
246
+ readonly sf: "play.fill";
247
+ readonly material: "play-arrow";
248
+ };
249
+ readonly Pause: {
250
+ readonly sf: "pause.fill";
251
+ readonly material: "pause";
252
+ };
253
+ readonly Back10: {
254
+ readonly sf: "gobackward.10";
255
+ readonly material: "replay-10";
256
+ };
257
+ readonly Forward10: {
258
+ readonly sf: "goforward.10";
259
+ readonly material: "forward-10";
260
+ };
261
+ readonly StepBack: {
262
+ readonly sf: "backward.frame";
263
+ readonly material: "skip-previous";
264
+ };
265
+ readonly StepForward: {
266
+ readonly sf: "forward.frame";
267
+ readonly material: "skip-next";
268
+ };
137
269
  };
138
270
  export type IconName = keyof typeof ICON_GLYPHS;
139
271
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"iconGlyphs.d.mts","names":[],"sources":["../../src/icons/iconGlyphs.ts"],"mappings":";;;;;;;qBAMa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqCD,wBAAwB"}
1
+ {"version":3,"file":"iconGlyphs.d.mts","names":[],"sources":["../../src/icons/iconGlyphs.ts"],"mappings":";;;;;;;qBAMa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAsED,wBAAwB"}