@lessly/sdk-app 46.0.0 → 47.0.1

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 (62) hide show
  1. package/dist/analytics/index.d.cts +1 -1
  2. package/dist/analytics/index.d.ts +1 -1
  3. package/dist/brain/index.cjs +5 -0
  4. package/dist/brain/index.cjs.map +1 -1
  5. package/dist/brain/index.d.cts +6 -2
  6. package/dist/brain/index.d.ts +6 -2
  7. package/dist/brain/index.js +5 -1
  8. package/dist/brain/index.js.map +1 -1
  9. package/dist/{client.gen-BFHxhTU7.d.cts → client.gen-BsjxuDLy.d.cts} +403 -4706
  10. package/dist/{client.gen-BFHxhTU7.d.ts → client.gen-BsjxuDLy.d.ts} +403 -4706
  11. package/dist/consent/index.d.cts +1 -1
  12. package/dist/consent/index.d.ts +1 -1
  13. package/dist/deployment/index.d.cts +1 -1
  14. package/dist/deployment/index.d.ts +1 -1
  15. package/dist/index.cjs +140 -756
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +140 -756
  20. package/dist/index.js.map +1 -1
  21. package/dist/mail/index.d.cts +2 -2
  22. package/dist/mail/index.d.ts +2 -2
  23. package/dist/observe/index.d.cts +1 -1
  24. package/dist/observe/index.d.ts +1 -1
  25. package/dist/organization/index.d.cts +1 -1
  26. package/dist/organization/index.d.ts +1 -1
  27. package/dist/realtime/index.d.cts +1 -1
  28. package/dist/realtime/index.d.ts +1 -1
  29. package/dist/support/index.d.cts +1 -1
  30. package/dist/support/index.d.ts +1 -1
  31. package/dist/tracking/index.d.cts +1 -1
  32. package/dist/tracking/index.d.ts +1 -1
  33. package/dist/users/index.d.cts +1 -1
  34. package/dist/users/index.d.ts +1 -1
  35. package/dist/waitlist/index.d.cts +1 -1
  36. package/dist/waitlist/index.d.ts +1 -1
  37. package/docs/README.md +1 -1
  38. package/docs/recipes/federation.md +158 -10
  39. package/docs/rules.md +150 -4
  40. package/package.json +2 -12
  41. package/src/gen/bindings.gen.ts +140 -756
  42. package/src/gen/brain/index.ts +1 -1
  43. package/src/gen/brain/queryOptions.gen.ts +7 -0
  44. package/src/gen/client.gen.ts +5 -165
  45. package/src/gen/manifest.gen.ts +1 -1
  46. package/src/gen/types.gen.ts +230 -4319
  47. package/dist/content/index.cjs +0 -161
  48. package/dist/content/index.cjs.map +0 -1
  49. package/dist/content/index.d.cts +0 -128
  50. package/dist/content/index.d.ts +0 -128
  51. package/dist/content/index.js +0 -129
  52. package/dist/content/index.js.map +0 -1
  53. package/dist/playground/index.cjs +0 -66
  54. package/dist/playground/index.cjs.map +0 -1
  55. package/dist/playground/index.d.cts +0 -52
  56. package/dist/playground/index.d.ts +0 -52
  57. package/dist/playground/index.js +0 -53
  58. package/dist/playground/index.js.map +0 -1
  59. package/src/gen/content/index.ts +0 -3
  60. package/src/gen/content/queryOptions.gen.ts +0 -202
  61. package/src/gen/playground/index.ts +0 -3
  62. package/src/gen/playground/queryOptions.gen.ts +0 -86
package/docs/rules.md CHANGED
@@ -47,10 +47,22 @@ MUST be declared as shared singletons, never bundled (FED-005), using
47
47
  `@module-federation/vite` pinned at exactly `1.16.12` (FED-006). The asset
48
48
  base in federation mode is the absolute path `/~/<id>/`. The build MUST
49
49
  produce one merged dual-mode `dist/` covering both standalone and federation
50
- artifacts (FED-007). An App MAY additionally expose a data-only `./navigation`
51
- module (FED-011). This rule states the contract; it does not restate FED-001,
52
- FED-004, FED-005, FED-006, FED-007, or FED-011 see those rules for exact
53
- wording, rationale, and examples.
50
+ artifacts (FED-007).
51
+
52
+ `./App` is the **only** module an App exposes. There is no `./navigation`
53
+ contract: the shell no longer loads such a module, there is no
54
+ `subscribeNavItems` and no `navContractVersion` negotiation, and the extension
55
+ menu the shell renders is static (a single Home row). FED-011 is **RETIRED
56
+ (2026-08)**. Still mapping the expose is inert rather than an error — it just
57
+ ships a chunk nobody fetches — but a new App MUST NOT add it, and an existing
58
+ one SHOULD delete `src/federation/navigation.ts`, drop the expose, and move
59
+ whatever that module fed the menu (environment lists, tool groups, badges,
60
+ status dots, a settings gear) into its own pages under `./App`'s relative
61
+ routes (FED-003).
62
+
63
+ This rule states the contract; it does not restate FED-001, FED-004, FED-005,
64
+ FED-006, or FED-007 — see those rules for exact wording, rationale, and
65
+ examples.
54
66
 
55
67
  ### APP-005 (MUST) — Auth is ambient; an App does not own it
56
68
 
@@ -87,3 +99,137 @@ Use this exact `@latest` form — not `npm update`. `@lessly/sdk-app` is
87
99
  pre-1.0 and pinned with a caret range, so `npm update` never crosses a minor
88
100
  version; since this SDK also bumps its minor version whenever the platform
89
101
  ships a new tool, `npm update` would never actually deliver those updates.
102
+
103
+ ### APP-008 (MUST) — The federation CSS entry is slim and global-free
104
+
105
+ An App has two CSS entries: the **federation** entry (imported by the `./App`
106
+ remote module) and the **standalone** entry (imported by the SPA entry). The
107
+ federation entry's whole transitive graph — that stylesheet, everything it
108
+ `@import`s, and every `@layer base { … }` block the App writes itself — MUST
109
+ NOT contain:
110
+
111
+ - `@font-face`;
112
+ - a `@layer base { … }` block;
113
+ - any rule declaring an inherited or visual property — `font-family`,
114
+ `font-size`, `line-height`, `color`, `background`, `margin`, `padding`,
115
+ `border-*`, `box-sizing`, `-webkit-text-size-adjust` — on `html`, `body`,
116
+ `:root` or `*`;
117
+ - an `@import` of a web font, of `@lessly/ui/styles.css`, or of the full
118
+ `tailwindcss` entry (which bundles **preflight**).
119
+
120
+ The prohibition holds wherever the rule comes from, `@apply` included:
121
+ `body { @apply bg-bg-primary … }` in the App's own base layer is exactly as
122
+ forbidden as an imported reset. The App's base layer belongs in a separate
123
+ `src/base.css` that only the **standalone** entry imports. The standalone entry
124
+ is unconstrained by this rule: it keeps the fonts, `@lessly/ui/styles.css`, the
125
+ full `tailwindcss` import and the base layer, because there the App owns the
126
+ page.
127
+
128
+ **Custom properties are the boundary.** Declarations of `--*` on `html`,
129
+ `body`, `:root` or `*` are fine — they paint nothing until something inside the
130
+ App's own subtree reads them. Inherited and visual properties are what is
131
+ forbidden, because the App is composed inside the shell's already-painted page
132
+ and a `body` or `*` rule addresses the whole live document, shell chrome
133
+ included. This line is load-bearing: `@lessly/ui/styles-federated.css`
134
+ legitimately ships a `*, ::before, ::after, ::backdrop { --tw-*: … }` block
135
+ (Tailwind v4's internal variable shim), and a guard written against selectors
136
+ instead of declarations fails on the very import this rule prescribes.
137
+
138
+ **Kit tokens.** An App that needs the design-system variables MUST import
139
+ `@lessly/ui/styles-federated.css` — `styles.css` minus the `@font-face` blocks
140
+ and the `@layer base`, keeping the token variables, the `--color-*` aliases,
141
+ `.link`, the `.motion-*` helpers and the compiled tw-animate-css layer. Depend
142
+ on `@lessly/ui` at `^4.0.0`, the range the shell itself runs. An App MUST NOT
143
+ hand-copy the kit's tokens into a local `theme.css` (it silently drifts from
144
+ the kit), and MUST NOT hand-filter `@lessly/ui/styles.css` with a prebuild
145
+ script (it breaks on any restructure of a file the App does not own).
146
+
147
+ **Scanning.** Tailwind generates only the classes it finds, and it scans the
148
+ project, not `node_modules`. The federation entry MUST therefore
149
+ `@source` the kit's compiled output
150
+ (`@source '../node_modules/@lessly/ui/dist/index.js';`) or the classes
151
+ `@lessly/ui` components use are never emitted — and it SHOULD exclude test
152
+ files (`@source not '../src/**/*.test.tsx';`), since a utility class named as a
153
+ test fixture is just a string to Tailwind and would otherwise be compiled into
154
+ the shipped stylesheet.
155
+
156
+ **Gate test.** The repository MUST carry a test asserting all of the above over
157
+ the **built** federation CSS, not over the entry file's import list: the source
158
+ imports can read clean while an imported stylesheet carries the base layer. Two
159
+ shapes must not be confused — `@layer base, components;` (semicolon) only
160
+ declares layer order and is harmless; the forbidden shape is the block,
161
+ `@layer\s+base\s*\{`. And a universal rule is a violation only if it declares
162
+ more than custom properties.
163
+
164
+ For the production defect this comes from — a remote's late-loading `body`
165
+ rule re-fonting the shell's chrome — see FED-008 in the extensions-guide.
166
+ `recipes/federation.md` has the canonical stylesheets.
167
+
168
+ ### APP-009 (MUST) — One source of scale vocabulary: `lesslyPreset`
169
+
170
+ An App takes its **scale vocabulary** — type, spacing, radii, font weight,
171
+ line height, letter spacing — from the design-system preset the shell is built
172
+ on: `lesslyPreset`, exported by `@lessly/ui/tailwind-preset`. Concretely:
173
+
174
+ - `tailwind.config.ts` sets `presets: [lesslyPreset]`;
175
+ - **both** CSS entries carry `@config '../tailwind.config.ts'`;
176
+ - the App declares no scales of its own and keeps no `@theme` block bridging
177
+ to them;
178
+ - the federation graph MUST NOT import `tailwindcss/theme.css` at all — not in
179
+ `layer(theme)`, and not with `theme(reference)`.
180
+
181
+ **`theme(reference)` does not solve this.** It removes the `:root` emission,
182
+ but Tailwind still inlines the literal as the utility's fallback
183
+ (`var(--text-sm,.875rem)`), so the utility keeps its own value and keeps
184
+ landing on the shell's markup. Measured: the emission went away and the page
185
+ stayed broken.
186
+
187
+ **The norm is "one source of vocabulary", not "no variables on `:root`".**
188
+ Variables that coincide on `:root` between the App and the shell are expected
189
+ and harmless — that is one source reaching the page twice. The absence
190
+ criterion measures **green on a broken page**: the shell declares no `--text-*`
191
+ variable at all (its preset compiles literals into the utilities), so three
192
+ repositories passed that check while the shell's sidebar type was being resized
193
+ by their sheets. Do not write a guard that way.
194
+
195
+ When both sides build on the same preset, rules that share a class name compile
196
+ identically and the collision stops existing. See FED-013 in the
197
+ extensions-guide for the measurements (13px → 14px, line-height 19.5 → 20) and
198
+ for the three wrong fixes it rules out.
199
+
200
+ ### APP-010 (MUST) — Federation utilities land in `layer(remote-utilities)`
201
+
202
+ The **federation** entry MUST import Tailwind's utilities into a dedicated
203
+ layer:
204
+
205
+ ```css
206
+ @import 'tailwindcss/utilities.css' layer(remote-utilities);
207
+ ```
208
+
209
+ never `layer(utilities)`. The **standalone** entry is exempt — it keeps the
210
+ full `tailwindcss` import (APP-008), where the App owns the page and there is
211
+ nothing to rank against.
212
+
213
+ This works because the shell pre-declares the layer order in
214
+ `lessly-workspace:apps/web/src/index.css`:
215
+
216
+ ```css
217
+ @layer theme, base, components, remote-utilities, utilities;
218
+ ```
219
+
220
+ so every App utility ranks below every shell utility whatever order the sheets
221
+ happen to load in. The App's federation entry SHOULD repeat that same order
222
+ declaration as its first line, so the layer positions are fixed before Tailwind
223
+ emits its own.
224
+
225
+ **Rollout order is strict and asymmetric.** That shell-side declaration MUST be
226
+ in production before an App adopts the layer. Against a shell that has not
227
+ declared the order, `remote-utilities` becomes the last-declared — and
228
+ therefore **highest**-priority — layer, so every App utility beats every shell
229
+ utility: strictly worse than the defect. Verify the shell first; adopting early
230
+ is a regression, not a head start.
231
+
232
+ See FED-014 in the extensions-guide for the measurement (App `.px-2` against
233
+ shell `.sm:px-2.5` — different rule names, so no shared preset can reach them;
234
+ 5 of 283 shell chrome nodes affected) and for the accepted symmetric risk on
235
+ the App's own nodes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lessly/sdk-app",
3
- "version": "46.0.0",
3
+ "version": "47.0.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "engines": {
@@ -55,11 +55,6 @@
55
55
  "import": "./dist/consent/index.js",
56
56
  "require": "./dist/consent/index.cjs"
57
57
  },
58
- "./content": {
59
- "types": "./dist/content/index.d.ts",
60
- "import": "./dist/content/index.js",
61
- "require": "./dist/content/index.cjs"
62
- },
63
58
  "./deployment": {
64
59
  "types": "./dist/deployment/index.d.ts",
65
60
  "import": "./dist/deployment/index.js",
@@ -80,11 +75,6 @@
80
75
  "import": "./dist/organization/index.js",
81
76
  "require": "./dist/organization/index.cjs"
82
77
  },
83
- "./playground": {
84
- "types": "./dist/playground/index.d.ts",
85
- "import": "./dist/playground/index.js",
86
- "require": "./dist/playground/index.cjs"
87
- },
88
78
  "./realtime": {
89
79
  "types": "./dist/realtime/index.d.ts",
90
80
  "import": "./dist/realtime/index.js",
@@ -111,5 +101,5 @@
111
101
  "require": "./dist/waitlist/index.cjs"
112
102
  }
113
103
  },
114
- "sdkContentHash": "sha256:4ceab38f2b4d4f07cc616a9ddd1df7f87e94a00c24317add22bfb36fa2c3bc97"
104
+ "sdkContentHash": "sha256:82da00e2c226a8955611954633868a0b341f2c4448c844865f0281540a68671b"
115
105
  }