@lotics/ui 11.8.10 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/timeline.tsx CHANGED
@@ -76,9 +76,9 @@ export function Timeline(props: TimelineProps) {
76
76
  {/* Tinted disc: a low-alpha wash of the accent behind a full-color icon. */}
77
77
  <View style={[styles.node, { backgroundColor: withAlpha(item.iconColor, 0.1) }]}>
78
78
  {item.isLoading ? (
79
- <ActivityIndicator size={13} color={item.iconColor} />
79
+ <ActivityIndicator size={16} color={item.iconColor} />
80
80
  ) : (
81
- <Icon name={item.icon} size={13} color={item.iconColor} />
81
+ <Icon name={item.icon} size={16} color={item.iconColor} />
82
82
  )}
83
83
  </View>
84
84
  </AnimationFadeIn>
@@ -122,7 +122,7 @@ const styles = StyleSheet.create({
122
122
  // Stretches to the label row's height; the disc centers on it, half-spines
123
123
  // fill the remainder so the line never breaks on a tall row.
124
124
  discColumn: {
125
- width: 24,
125
+ width: 32,
126
126
  alignSelf: "stretch",
127
127
  alignItems: "center",
128
128
  },
@@ -138,9 +138,9 @@ const styles = StyleSheet.create({
138
138
  backgroundColor: colors.zinc[200],
139
139
  },
140
140
  node: {
141
- width: 24,
142
- height: 24,
143
- borderRadius: 12,
141
+ width: 32,
142
+ height: 32,
143
+ borderRadius: 16,
144
144
  justifyContent: "center",
145
145
  alignItems: "center",
146
146
  marginVertical: 3,
@@ -153,7 +153,7 @@ const styles = StyleSheet.create({
153
153
  gap: 12,
154
154
  },
155
155
  spineColumn: {
156
- width: 24,
156
+ width: 32,
157
157
  alignItems: "center",
158
158
  alignSelf: "stretch",
159
159
  },
@@ -178,13 +178,13 @@ const styles = StyleSheet.create({
178
178
  paddingHorizontal: 8,
179
179
  paddingVertical: 4,
180
180
  marginHorizontal: -8,
181
- minHeight: 28,
181
+ minHeight: 40,
182
182
  flexDirection: "row",
183
183
  alignItems: "center",
184
184
  },
185
185
  plainRow: {
186
186
  paddingVertical: 4,
187
- minHeight: 28,
187
+ minHeight: 40,
188
188
  flexDirection: "row",
189
189
  alignItems: "center",
190
190
  },
package/src/vite.d.mts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Types for the `@lotics/ui/vite` subpath (runtime lives in `vite.mjs`).
3
+ *
4
+ * `readonly` so a consumer can't mutate the shared canonical list; spread it to
5
+ * extend: `include: [...loticsOptimizeDeps, "my-extra-dep"]`.
6
+ */
7
+ export declare const loticsOptimizeDeps: readonly string[];
package/src/vite.mjs ADDED
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Vite dev-optimizer config for Lotics custom-code apps — the `@lotics/ui/vite` subpath.
3
+ *
4
+ * ZERO-IMPORT LEAF. This module is loaded inside Vite's Node config context
5
+ * (a scaffolded app's `vite.config.ts` imports it), so it must pull in NOTHING —
6
+ * no react-native-web, no kit components, no other module. It exports only a
7
+ * plain array of strings. It ships as `.mjs` (not `.ts`) on purpose: a Vite
8
+ * config bundle externalizes its bare imports to their on-disk paths and hands
9
+ * them to Node's `import()`, and Node refuses to strip types for a `.ts` file
10
+ * under `node_modules` — a source `.ts` export would fail the config load.
11
+ *
12
+ * `loticsOptimizeDeps` is the set of module specifiers a scaffolded app's
13
+ * `vite.config.ts` `optimizeDeps.include` MUST carry for `lotics app dev` to
14
+ * render. Vite's dev dep-optimizer pre-bundles these to synthesize the
15
+ * CJS-interop (`default` / named) exports the RN-ecosystem + markdown subtree
16
+ * ship un-prebundled — otherwise one of them blanks the dev iframe with "does
17
+ * not provide an export named 'default'/'parse'". Dev-ONLY: the production
18
+ * rollup build resolves the interop without it (typecheck/lint/build stay green
19
+ * while the dev iframe goes blank), which is exactly why this list ships WITH
20
+ * the kit — so it can never drift from what @lotics/ui's transitive deps
21
+ * require across a major bump.
22
+ *
23
+ * Why each family is here:
24
+ * - `react-native-svg` — @lotics/ui's svg charts (PieChart/LineChart/Sparkline/
25
+ * RingGauge) reach a named-export entry the dev optimizer won't resolve
26
+ * unbundled ("does not provide an export named 'parse'").
27
+ * - `react-native-web` + `@react-native/normalize-colors` + the `inline-style-
28
+ * prefixer` / `fbjs` / `styleq` / `postcss-value-parser` / `nullthrows` core —
29
+ * RN-Web's CJS deps; force-prebundling folds them into interop'd chunks, and
30
+ * the deep subpaths it reaches via *default* imports need an ESM shim.
31
+ * - `react-markdown` — @lotics/ui's Markdown renderer (AgentRun + any markdown
32
+ * surface) pulls a transitive CJS dep (`style-to-js`) whose default export the
33
+ * dev optimizer won't synthesize unbundled.
34
+ * - `react` / `react-dom` / `react-dom/client` — pinned into the pre-bundle so
35
+ * every kit subpath shares one React instance (else "Invalid hook call").
36
+ *
37
+ * Usage — consumed by a scaffolded app's `vite.config.ts`:
38
+ *
39
+ * import { loticsOptimizeDeps } from "@lotics/ui/vite";
40
+ * export default defineConfig({ optimizeDeps: { include: loticsOptimizeDeps } });
41
+ *
42
+ * To add app-specific pre-bundle entries, spread the list:
43
+ *
44
+ * optimizeDeps: { include: [...loticsOptimizeDeps, "my-extra-dep"] }
45
+ */
46
+ export const loticsOptimizeDeps = [
47
+ "react-native-svg",
48
+ "react-markdown",
49
+ "react-native-web",
50
+ "@react-native/normalize-colors",
51
+ "inline-style-prefixer/lib/createPrefixer",
52
+ "inline-style-prefixer/lib/plugins/crossFade",
53
+ "inline-style-prefixer/lib/plugins/imageSet",
54
+ "inline-style-prefixer/lib/plugins/logical",
55
+ "inline-style-prefixer/lib/plugins/position",
56
+ "inline-style-prefixer/lib/plugins/sizing",
57
+ "inline-style-prefixer/lib/plugins/transition",
58
+ "postcss-value-parser",
59
+ "fbjs/lib/invariant",
60
+ "fbjs/lib/warning",
61
+ "styleq",
62
+ "styleq/transform-localize-style",
63
+ "react",
64
+ "react-dom",
65
+ "react-dom/client",
66
+ "nullthrows",
67
+ ];
@@ -0,0 +1,41 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import * as fs from "node:fs";
3
+ import * as path from "node:path";
4
+ import { loticsOptimizeDeps } from "./vite.mjs";
5
+
6
+ describe("@lotics/ui/vite", () => {
7
+ it("exports a non-empty list of module-specifier strings", () => {
8
+ expect(Array.isArray(loticsOptimizeDeps)).toBe(true);
9
+ expect(loticsOptimizeDeps.length).toBeGreaterThan(0);
10
+ for (const entry of loticsOptimizeDeps) {
11
+ expect(typeof entry).toBe("string");
12
+ expect(entry.length).toBeGreaterThan(0);
13
+ }
14
+ });
15
+
16
+ it("is a zero-import leaf (it loads inside Vite's Node config context)", () => {
17
+ // The module is imported by an app's `vite.config.ts`, evaluated by Node
18
+ // before any resolve.alias or RN-Web shim exists. A single import would drag
19
+ // react-native-web (and its Metro globals) into the Node config load and
20
+ // crash it — so the runtime module must import nothing at all. Strip comments
21
+ // first so the usage example in the header (which shows an `import` line) is
22
+ // not mistaken for real code.
23
+ const raw = fs.readFileSync(path.join(__dirname, "vite.mjs"), "utf-8");
24
+ const code = raw
25
+ .replace(/\/\*[\s\S]*?\*\//g, "")
26
+ .replace(/(^|[^:])\/\/.*$/gm, "$1");
27
+ expect(code).not.toMatch(/^\s*import\b/m);
28
+ expect(code).not.toMatch(/\bfrom\s+["']/);
29
+ expect(code).not.toMatch(/\brequire\s*\(/);
30
+ });
31
+
32
+ test("carries the load-bearing RN-Web interop entries (a missing one blanks the dev iframe)", () => {
33
+ // RN-Web does `import normalizeColor from "@react-native/normalize-colors"`
34
+ // (nested CJS): un-prebundled, the dev server serves it as ESM with no
35
+ // default export and the iframe blanks the moment a colour-touching
36
+ // component mounts. These membership pins port the scaffold-era literal
37
+ // assertions to the list's owner.
38
+ expect(loticsOptimizeDeps).toContain("react-native-web");
39
+ expect(loticsOptimizeDeps).toContain("@react-native/normalize-colors");
40
+ });
41
+ });