@imfusion/web-ui 0.5.1-dev.5.gb4de52d7 → 0.5.1-dev.51.gad24cd6e

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 (72) hide show
  1. package/README.md +156 -55
  2. package/bin/install.js +428 -0
  3. package/bin/install.test.ts +329 -0
  4. package/dist/build/vite-css-module-names/index.d.ts +20 -0
  5. package/dist/build/vite-css-module-names.js +17 -0
  6. package/dist/{code-qBbqAHK-.js → code-B83kAmnS.js} +21 -15
  7. package/dist/components/code/code.d.ts +10 -18
  8. package/dist/components/field/field.d.ts +104 -0
  9. package/dist/components/field/field.meta.d.ts +2 -0
  10. package/dist/components/field/index.d.ts +2 -0
  11. package/dist/components/fieldset/fieldset.d.ts +29 -0
  12. package/dist/components/fieldset/fieldset.meta.d.ts +2 -0
  13. package/dist/components/fieldset/index.d.ts +2 -0
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.js +4956 -4317
  16. package/dist/integrations/code-highlight/code-highlight.d.ts +8 -6
  17. package/dist/integrations/code-highlight/highlighter.d.ts +32 -3
  18. package/dist/integrations/code-highlight/language-patterns.d.ts +7 -0
  19. package/dist/integrations/code-highlight/languages/cmake.d.ts +1 -0
  20. package/dist/integrations/code-highlight/languages/cpp.d.ts +1 -0
  21. package/dist/integrations/code-highlight/languages/python.d.ts +1 -0
  22. package/dist/integrations/code-highlight.js +196 -58
  23. package/dist/integrations/image-display-options.js +1 -1
  24. package/dist/llms/gen-tokens.d.ts +7 -0
  25. package/dist/style.css +1 -1
  26. package/dist/{tabs-DqBFSqq6.js → tabs-CVp_SgBl.js} +1 -1
  27. package/package.json +39 -25
  28. package/src/docgen/doc.gen.json +341 -35
  29. package/src/llms/install-templates/AGENTS.md +34 -0
  30. package/src/llms/install-templates/codex-hooks.json +44 -0
  31. package/src/llms/install-templates/hooks/baseline-staleness.sh +17 -0
  32. package/src/llms/install-templates/hooks/session-start.sh +5 -0
  33. package/src/llms/install-templates/hooks/stop.sh +18 -0
  34. package/src/llms/install-templates/hooks/subagent-start.sh +5 -0
  35. package/src/llms/install-templates/hooks/user-prompt-submit.sh +5 -0
  36. package/src/llms/install-templates/settings.json +45 -0
  37. package/src/llms/llms.gen.txt +12 -0
  38. package/src/llms/skills/imf-web-ui/SKILL.md +13 -12
  39. package/src/llms/skills/imf-web-ui-audit/SKILL.md +119 -0
  40. package/src/llms/skills/imf-web-ui-components/SKILL.md +2 -1
  41. package/src/llms/skills/imf-web-ui-conventions/SKILL.md +57 -0
  42. package/src/llms/skills/imf-web-ui-conventions/templates/AUDIT_CHECKLIST.md +141 -0
  43. package/src/llms/skills/imf-web-ui-conventions/templates/REPORT.md +45 -0
  44. package/src/llms/skills/imf-web-ui-conventions/topics/agent-tooling.md +82 -0
  45. package/src/llms/skills/imf-web-ui-conventions/topics/assets.md +27 -0
  46. package/src/llms/skills/imf-web-ui-conventions/topics/authentication.md +65 -0
  47. package/src/llms/skills/imf-web-ui-conventions/topics/class-names.md +50 -0
  48. package/src/llms/skills/imf-web-ui-conventions/topics/components.md +101 -0
  49. package/src/llms/skills/imf-web-ui-conventions/topics/data.md +221 -0
  50. package/src/llms/skills/imf-web-ui-conventions/topics/docs-structure.md +40 -0
  51. package/src/llms/skills/imf-web-ui-conventions/topics/git.md +34 -0
  52. package/src/llms/skills/imf-web-ui-conventions/topics/library-boundary.md +33 -0
  53. package/src/llms/skills/imf-web-ui-conventions/topics/library-setup.md +26 -0
  54. package/src/llms/skills/imf-web-ui-conventions/topics/npm-project.md +53 -0
  55. package/src/llms/skills/imf-web-ui-conventions/topics/project-structure.md +44 -0
  56. package/src/llms/skills/imf-web-ui-conventions/topics/react.md +109 -0
  57. package/src/llms/skills/imf-web-ui-conventions/topics/styling.md +88 -0
  58. package/src/llms/skills/imf-web-ui-conventions/topics/testing.md +25 -0
  59. package/src/llms/skills/imf-web-ui-conventions/topics/tokens.md +7 -0
  60. package/src/llms/skills/imf-web-ui-conventions/topics/tooling.md +116 -0
  61. package/src/llms/skills/imf-web-ui-conventions/topics/typescript.md +73 -0
  62. package/src/llms/skills/imf-web-ui-conventions/topics/validation.md +62 -0
  63. package/src/llms/skills/imf-web-ui-setup/SKILL.md +67 -37
  64. package/src/llms/skills/imf-web-ui-update/SKILL.md +157 -0
  65. package/src/llms/skills/imf-web-ui-ux/SKILL.md +4 -4
  66. package/src/llms/skills/imf-web-ui-ux/references/forms.md +2 -2
  67. package/src/llms/tokens.gen.json +887 -0
  68. package/bin/install-skill.js +0 -180
  69. package/src/llms/skills/imf-web-ui-frontend-patterns/SKILL.md +0 -93
  70. package/src/llms/skills/imf-web-ui-frontend-patterns/references/code-conventions.md +0 -133
  71. package/src/llms/skills/imf-web-ui-frontend-patterns/references/react-patterns.md +0 -94
  72. package/src/llms/skills/imf-web-ui-imfusion-frontend-setup/SKILL.md +0 -201
@@ -1,201 +0,0 @@
1
- ---
2
- name: imf-web-ui-imfusion-frontend-setup
3
- description:
4
- "Set up or audit an ImFusion frontend's project tooling: the stack, package.json scripts, formatting, linting, typecheck,
5
- staged-file and pre-commit hooks, verification scopes, dependency pinning, tsconfig, folder structure. House conventions,
6
- not industry standards. Load when starting a new ImFusion frontend, or when asked what an existing one's setup is missing.
7
- Not for adding one config file on request — that's just the edit. Not for wiring the library itself (imf-web-ui-setup)."
8
- ---
9
-
10
- # imf-web-ui-imfusion-frontend-setup
11
-
12
- ImFusion house conventions, **not** industry standards. Report as "missing against the ImFusion baseline", never "against
13
- best practice". Only apply to an ImFusion frontend.
14
-
15
- Two modes, same list:
16
-
17
- - **New project** — work down the list and set each piece up.
18
- - **Existing project** — audit. Read the repo (don't ask what it has), report present / missing / broken, change nothing
19
- until the human picks. An established repo is where a forgotten piece hides.
20
-
21
- **The project wins.** Where the repo already decided, that stands. Report what's _absent_; a working convention you'd have
22
- chosen differently is not a finding.
23
-
24
- ## The stack
25
-
26
- | Concern | Tool | Notes |
27
- | ------------ | --------------------------------------------------------- | ----------------------------------------------------------------------------------- |
28
- | Format | [Prettier](https://prettier.io) | Values below are shared across repos |
29
- | Lint | [ESLint](https://eslint.org) flat config | `--cache --max-warnings=0` |
30
- | Types | `tsc --noEmit` | Own script, own CI step |
31
- | Staged files | [lint-staged](https://github.com/lint-staged/lint-staged) | [nano-staged](https://github.com/usmanyunusov/nano-staged) is a drop-in alternative |
32
- | Routing | [TanStack Router](https://tanstack.com/router) | File-based, `src/routes/` |
33
- | Server state | [TanStack Query](https://tanstack.com/query) | Query keys colocated per API topic |
34
- | Client state | [TanStack Store](https://tanstack.com/store) | Only for state that isn't URL- or server-owned |
35
- | Styling | CSS Modules | Colocated `<component>.module.css` |
36
- | Dead code | [knip](https://knipjs.dev) | Needs per-repo config |
37
- | Build | [Vite](https://vite.dev) | |
38
- | Test | [Vitest](https://vitest.dev) | |
39
-
40
- Either staged-file runner is fine; lint-staged is the larger project and the safer default when one misbehaves.
41
-
42
- ### Devtools come with the library
43
-
44
- Every TanStack library that ships a devtools package gets it as a dev dependency alongside the library itself, mounted in
45
- development only. Router is a given in any ImFusion frontend, so `@tanstack/react-router-devtools` is a given too; Query's
46
- goes in when Query does, and so on. Look for a `-devtools` sibling whenever you add a TanStack dependency rather than working
47
- from a fixed list — the set grows, and not every library has one yet (Store doesn't). Once a project has several,
48
- `@tanstack/devtools` hosts them in one panel.
49
-
50
- ## package.json
51
-
52
- `"type": "module"`, `"private": true`. Scripts — these names, in every repo:
53
-
54
- | Script | Runs |
55
- | ------------------ | -------------------------------------------------------- |
56
- | `dev` | dev server |
57
- | `build` | production build |
58
- | `verify:lint` | `eslint . --cache --max-warnings=0` |
59
- | `verify:format` | `prettier --check .` |
60
- | `verify:typecheck` | `tsc --noEmit` |
61
- | `verify:tests` | `vitest run` |
62
- | `verify:staged` | staged-file subset, called by the pre-commit hook |
63
- | `verify:full` | every check above plus the build; what CI runs |
64
- | `format` | `prettier --write .` |
65
- | `lint:fix` | `eslint . --cache --fix` |
66
- | `git:config` | `git config core.hooksPath …` + `pull.rebase`/`merge.ff` |
67
-
68
- **Every check is `verify:*`.** One namespace, so "what can I run to check this?" is answered by tab-completion. Write-mode
69
- scripts keep tool names — `format` and `lint:fix` change files, which isn't verifying. Same name, same meaning, every repo.
70
-
71
- **Git config is an explicit command.** `git:config` holds the real command, greppable and run by hand after cloning, and the
72
- README's setup steps name it. `ignore-scripts=true` disables the root package's own lifecycle scripts alongside its
73
- dependencies', so setup that matters is a command someone runs, not a hook that fires on install.
74
-
75
- **Dependencies pinned exactly.** No `^`, `~`, or `latest`, in `dependencies` and `devDependencies` alike. A check script in
76
- the verify chain enforces it, but that only catches drift after it lands — `save-exact=true` in `.npmrc` stops `npm install`
77
- reintroducing ranges in the first place.
78
-
79
- ## Config
80
-
81
- **Prettier** — config file shape is free (`.prettierrc`, `prettier.config.ts`); the values are not:
82
-
83
- ```
84
- printWidth: 125 tabWidth: 2 useTabs: false trailingComma: "none"
85
- arrowParens: "avoid" semi: true singleQuote: false proseWrap: "always"
86
- ```
87
-
88
- No config file at all means Prettier runs on defaults — flag it, the values silently differ.
89
-
90
- **ESLint** — flat config (`eslint.config.ts`), `strictTypeChecked` + `stylisticTypeChecked` with `projectService: true`, `as`
91
- and `!` banned outside tests, and `.gitignore` as the ignore source (`includeIgnoreFile` from `@eslint/compat`) so ignores
92
- aren't maintained twice.
93
-
94
- **tsconfig** — defaults:
95
-
96
- ```jsonc
97
- {
98
- "compilerOptions": {
99
- "strict": true,
100
- "moduleResolution": "bundler",
101
- "verbatimModuleSyntax": true, // import type stays import type
102
- "noUnusedLocals": true,
103
- "noUnusedParameters": true,
104
- "noFallthroughCasesInSwitch": true,
105
- "noUncheckedSideEffectImports": true,
106
- "skipLibCheck": true,
107
- "paths": { "#/*": ["./src/*"] }
108
- }
109
- }
110
- ```
111
-
112
- The alias is always `#/` → `src/`. `#` is Node's own subpath-import prefix, so it resolves without a bundler-specific
113
- convention, and it can't collide with an npm scope the way `@/` does.
114
-
115
- **Staged files** — runner config applying eslint `--fix` and prettier `--write` to staged files only.
116
-
117
- **Pre-commit** — the hook installs itself via `prepare` → `git:config`, which sets `core.hooksPath` to a tracked directory
118
- plus `pull.rebase true` and `merge.ff only`, so history strategy doesn't depend on personal git config. Two silent failure
119
- modes: no `prepare` at all (hooks exist only on the machine that ran `git config` by hand), and `core.hooksPath` pointing at
120
- a directory that doesn't exist. Check config **and** directory.
121
-
122
- **Verify scopes** — two blocking, one advisory:
123
-
124
- - **staged** — `verify:staged`, called by the pre-commit hook: lint, format, restage. Fast. A passing commit is not CI green.
125
- - **full** — `verify:full`: the build plus every `verify:*` check. What CI runs.
126
- - **files** — optional post-edit agent hook. Advisory, never exits non-zero, so a mid-flight refactor can't trap the agent.
127
-
128
- One script owns each scope's step list; npm scripts and hooks only launch them. Name by depth, not by occasion — a name like
129
- `preflight` needs explaining and invites a second, near-identical script beside it. Two of those drift, and the drift reads
130
- as "passes locally, fails in CI".
131
-
132
- **Node pinning** — `.nvmrc` or `engines.node`. Not a personal version manager's config; that pins it for you alone.
133
-
134
- ## Folder structure
135
-
136
- ```
137
- src/
138
- routes/ # TanStack Router file-based routes; nothing but routing
139
- api/<topic>/ # one folder per API topic
140
- <topic>.ts # queries/mutations
141
- query-key.ts # key factory
142
- types.ts # request/response types
143
- components/ # see below
144
- http/ # client, error normalisation — the only transport-aware place
145
- lib/ # framework-free helpers
146
- ```
147
-
148
- Everything is kebab-case, folders and files alike.
149
-
150
- **Inside `components/`, group by what kind of component it is** — `layouts/`, `primitives/`, `forms/`, or a domain name. Not
151
- a hard rule: a handful of components reads fine flat, and the grouping should follow what the project actually has rather
152
- than a structure imposed up front. But most codebases grow past flat, and a clear layout component belongs under `layouts/`
153
- rather than beside a domain widget.
154
-
155
- ```
156
- components/
157
- page-header/ # flat is fine
158
- layouts/
159
- page-shell/
160
- data-table/ # a component with sub-component files
161
- data-table.tsx
162
- data-table-row.tsx
163
- data-table.module.css
164
- index.ts
165
- ```
166
-
167
- A component gets a folder when it has more than one file — sub-components, styles, tests. Single-file components can stay
168
- single files. The folder's `index.ts` only re-exports, so imports read `#/components/data-table` and the inside can be
169
- restructured without touching call sites.
170
-
171
- Routes stay thin: they compose, they don't fetch inline. `api/<topic>/` holds the query and its key factory together so a key
172
- is never spelled out at a call site. Anything transport-level (base client, error normalisation) lives in `http/` and nowhere
173
- else.
174
-
175
- ## Styling
176
-
177
- CSS Modules by default, colocated as `<component>.module.css` next to the component. No CSS-in-JS, no utility-class
178
- framework.
179
-
180
- On a project using `@imfusion/web-ui`, style through the sanctioned seams — `--imf-ui-*` tokens and `data-imf-ui-component`
181
- attributes, never the library's generated class names. `imf-web-ui-frontend-patterns` covers that contract.
182
-
183
- If more than one tool compiles the CSS (app build plus Storybook), the generated class-name pattern must be defined **once**
184
- and imported by both, or the same source file gets different class names in each and styles silently don't apply.
185
- `build/css-modules-config.ts` in web-ui is the reference shape; pick your own prefix.
186
-
187
- ## Optional
188
-
189
- Recommend when the shape calls for it; absence is not a finding.
190
-
191
- - **knip** — once several people delete things independently.
192
- - **`ignore-scripts=true` in `.npmrc`** — blocks most supply-chain worm payloads; costs an explicit `npm rebuild` for native
193
- deps.
194
- - **`eslint-plugin-jsx-a11y`** — anything user-facing.
195
-
196
- Out of scope, project-specific: CI, env and secrets, error tracking, deploy, dependency updates.
197
-
198
- ## Not this skill
199
-
200
- - Library wiring (styles import, provider) → `imf-web-ui-setup`
201
- - Code conventions (TypeScript, naming, testing) → `imf-web-ui-frontend-patterns`, `references/code-conventions.md`