@lotics/ui 27.10.0 → 27.11.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/AGENTS.md CHANGED
@@ -14,7 +14,7 @@ CURRENT major only — upgrading an app across majors is `MIGRATION.md`.
14
14
 
15
15
  | Doc | Read it for |
16
16
  |---|---|
17
- | [docs/catalog.md](./docs/catalog.md) | **The complete inventory** — Reach-by-role (each data role → the ONE canonical component) + every `@lotics/ui/<module>` entry point (incl. `@lotics/ui/vite`'s `loticsOptimizeDeps` for a custom-code app's `vite.config.ts`). Read before building any screen; reuse first. |
17
+ | [docs/catalog.md](./docs/catalog.md) | **The complete inventory** — Reach-by-role (each data role → the ONE canonical component) + every `@lotics/ui/<module>` entry point (incl. `@lotics/ui/vite`'s `loticsOptimizeDeps` + `loticsResolve()` — the pre-bundle list and the whole `resolve` block a custom-code app's `vite.config.ts` imports rather than hand-carries, dev-link included). Read before building any screen; reuse first. |
18
18
  | [docs/data_entry.md](./docs/data_entry.md) | Which editing pattern for which job — inline edit, fieldset forms, browser-autofill suppression (search controls only), find-or-create (`Combobox`), line items, handoffs, phased records, billing, tags, dispositions, attachments (the `FilesEditor` COMPOUND — root owns selection/gallery/confirm, you compose the bar, a HOST verb reads `useFilesEditorSelection` — plus the three-way file INTAKE: CTA + `FileDropTarget` + `usePasteFiles`), stage gates, the commit-on-blur vs action-press ordering law (the kit gates the press — `pending_commits`). |
19
19
  | [docs/ai_patterns.md](./docs/ai_patterns.md) | AI acts, the human stays in charge — composer, live run feed (`AgentRun`), the one law's split (modify → review-before-apply; create → save-direct + the `ResultHeader` receipt), findings, provenance, confidence; the UI half of the SDK's [ai doc](../app-sdk/docs/ai.md)., the whole run in a dialog (`AgentRunScope`/`AgentRunPane`/`AgentRunActions` — a parked question REPLACES the feed, actions in the footer) |
20
20
  | [docs/composition.md](./docs/composition.md) | The design-language contract — canvas + content column, heading altitude (incl. eyebrow vs group lead — a label is one or the other), banded cards, register vs inset rows, master-detail `Drawer` on a LIST screen vs a child collection's row EXPANDING inside a record, view controls, RECORD EXTENT (one page, sections scrolled to and never routed to), color discipline, typography, whitespace, and how to TEST an overlay component (a `Popover`-backed surface never mounts under jsdom). |
package/docs/catalog.md CHANGED
@@ -325,6 +325,18 @@ source (`src/<module>.tsx`/`.ts`) is the API reference.
325
325
  `import { loticsOptimizeDeps } from "@lotics/ui/vite"` → `optimizeDeps: { include: loticsOptimizeDeps }`.
326
326
  To add app-specific entries, spread: `include: [...loticsOptimizeDeps, "my-dep"]`. A Node-loadable
327
327
  `.mjs` leaf (a Vite config can't import a `.ts` from `node_modules`), zero-import by contract.
328
+ - **`vite`** — `loticsResolve()`: the whole `resolve` block, for the same reason and on the same
329
+ terms — `resolve: loticsResolve()`. Every entry is dictated by the kit's internals, so the kit
330
+ owns them: the `react-native` → `react-native-web` alias (**load-bearing** — without it the RN
331
+ primitives have no web implementation and the app does not build), `.web.tsx`-first `extensions`
332
+ (per-target variants win; `.mjs`/`.mts` kept for parity with Vite's default resolver), `dedupe`
333
+ for React + RN-Web (the kit is consumed across many subpaths, and a second React copy in one
334
+ chunk nulls the hooks dispatcher — "Invalid hook call"), and the `LOTICS_UI_SRC` **dev-link**,
335
+ read at call time so it lasts exactly one command. To add your own alias, spread:
336
+ `const base = loticsResolve(); resolve: { ...base, alias: [...base.alias, entry] }`.
337
+ `lotics app codegen` writes the matching `paths` into the app's `.lotics/tsconfig.link.json`,
338
+ so `tsc`, vitest, eslint and the editor resolve the same kit Vite does — the dev-link is not a
339
+ Vite-only trick that leaves every other tool checking the published package.
328
340
 
329
341
  ### Text & formatting
330
342
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/ui",
3
- "version": "27.10.0",
3
+ "version": "27.11.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./vite": {
@@ -4,11 +4,14 @@ import "react-native";
4
4
  // Pressable's `hovered` callback state, plus web-only ViewStyle / TextStyle
5
5
  // properties (cursor, outline, boxShadow, etc.) used by its primitives.
6
6
  //
7
- // Each consumer (frontend, container-invoices, future iframe
8
- // apps) ships its own copy of this file in its `src/`. TypeScript doesn't
9
- // auto-pick-up `.d.ts` files inside node_modules dependencies; the augmentation
10
- // has to be visible in the consumer's `include`. The CLI starter template
11
- // (`lotics app create`) generates this file as part of every new app.
7
+ // TypeScript does not auto-load a `.d.ts` from inside a dependency — the
8
+ // augmentation has to be visible in the consumer's own `include`. In-repo
9
+ // consumers (frontend) keep a copy in `src/`; a custom-code app does NOT, because
10
+ // `lotics app codegen` copies THIS file into its `.lotics/` on every run. That
11
+ // direction matters: a scaffolded snapshot silently falls behind whatever the kit
12
+ // adds here — the starter's copy was already missing `TextStyle`'s `boxShadow`,
13
+ // `transitionDuration` and `transitionProperty`, so an app author writing one got
14
+ // a type error the kit itself does not have.
12
15
  declare module "react-native" {
13
16
  interface PressableStateCallbackType {
14
17
  hovered: boolean;
package/src/vite.d.mts CHANGED
@@ -5,3 +5,13 @@
5
5
  * extend: `include: [...loticsOptimizeDeps, "my-extra-dep"]`.
6
6
  */
7
7
  export declare const loticsOptimizeDeps: readonly string[];
8
+
9
+ /**
10
+ * The Vite `resolve` block for a Lotics custom-code app (runtime in `vite.mjs`).
11
+ * Reads `LOTICS_UI_SRC` at call time, so the dev-link is decided per command.
12
+ */
13
+ export declare function loticsResolve(): {
14
+ alias: ({ find: RegExp; replacement: string } | { find: string; replacement: string })[];
15
+ extensions: string[];
16
+ dedupe: string[];
17
+ };
package/src/vite.mjs CHANGED
@@ -71,3 +71,45 @@ export const loticsOptimizeDeps = [
71
71
  "fast-formula-parser",
72
72
  "@formulajs/formulajs",
73
73
  ];
74
+
75
+ /**
76
+ * The complete Vite `resolve` block a Lotics custom-code app needs — the second
77
+ * half of the same contract `loticsOptimizeDeps` carries, and shipped here for
78
+ * the same reason: it tracks the installed @lotics/ui and cannot drift.
79
+ *
80
+ * Everything in it exists because the kit ships RN-Web SOURCE:
81
+ * - the `react-native` → `react-native-web` alias, so the kit's RN primitives
82
+ * (View/Text/Pressable/StyleSheet) render on the web at all. This entry is
83
+ * LOAD-BEARING: the deleted `lotics ui link` edited it by regex and twice
84
+ * deleted it along with the array's closing bracket (GAP-133/142), which is
85
+ * why the dev-link below is computed here rather than written into an app.
86
+ * - `.web.tsx`-first `extensions`, so per-target variants (avatar.web.tsx) win,
87
+ * plus `.mjs`/`.mts` to keep parity with Vite's default resolver — an override
88
+ * otherwise drops them and a package shipping only `.mjs` (lucide-react/dynamic,
89
+ * reached by DynamicIcon/AppIcon) fails to resolve under `lotics app dev` while
90
+ * the prod build resolves it, so the gap is dev-only and silent.
91
+ * - `dedupe`, because the kit is consumed across many subpath entries and Vite
92
+ * can otherwise pre-bundle one into its own chunk with a second React copy —
93
+ * a hook called from there hits a null dispatcher ("Invalid hook call").
94
+ * - the `LOTICS_UI_SRC` dev-link, when set: kit edits go live under
95
+ * `lotics app dev` (HMR) and bundle under `lotics app deploy`, with no publish
96
+ * round-trip. `lotics app codegen` writes the matching `paths` into
97
+ * `.lotics/tsconfig.link.json` from the same variable, so `tsc`, vitest, eslint
98
+ * and the editor resolve the same copy Vite does — the dev-link is not a
99
+ * Vite-only trick that lies to every other tool.
100
+ *
101
+ * An app that needs its own alias spreads the result:
102
+ * const base = loticsResolve();
103
+ * resolve: { ...base, alias: [...base.alias, { find: "x", replacement: "y" }] }
104
+ */
105
+ export function loticsResolve() {
106
+ const uiSrc = process.env.LOTICS_UI_SRC;
107
+ return {
108
+ alias: [
109
+ ...(uiSrc ? [{ find: /^@lotics\/ui\/(.+)$/, replacement: `${uiSrc}/$1` }] : []),
110
+ { find: "react-native", replacement: "react-native-web" },
111
+ ],
112
+ extensions: [".web.tsx", ".web.ts", ".web.js", ".tsx", ".ts", ".jsx", ".js", ".mjs", ".mts"],
113
+ dedupe: ["react", "react-dom", "react-native-web"],
114
+ };
115
+ }