tempest-react-sdk 0.58.0 → 0.60.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.
Files changed (93) hide show
  1. package/README.md +35 -3
  2. package/bin/lib/css/findings.mjs +1 -0
  3. package/bin/lib/css/semantic.mjs +70 -6
  4. package/bin/lib/css/semantic.test.mjs +52 -1
  5. package/dist/components/Alert/Alert.module.cjs.map +1 -1
  6. package/dist/components/Alert/Alert.module.js.map +1 -1
  7. package/dist/components/Badge/Badge.module.cjs.map +1 -1
  8. package/dist/components/Badge/Badge.module.js.map +1 -1
  9. package/dist/components/BarList/BarList.module.cjs.map +1 -1
  10. package/dist/components/BarList/BarList.module.js.map +1 -1
  11. package/dist/components/BottomSheet/BottomSheet.module.cjs.map +1 -1
  12. package/dist/components/BottomSheet/BottomSheet.module.js.map +1 -1
  13. package/dist/components/DataTable/DataTable.module.cjs.map +1 -1
  14. package/dist/components/DataTable/DataTable.module.js.map +1 -1
  15. package/dist/components/Dropzone/Dropzone.module.cjs.map +1 -1
  16. package/dist/components/Dropzone/Dropzone.module.js.map +1 -1
  17. package/dist/components/ErrorText/ErrorText.module.cjs.map +1 -1
  18. package/dist/components/ErrorText/ErrorText.module.js.map +1 -1
  19. package/dist/components/Markdown/Markdown.module.cjs.map +1 -1
  20. package/dist/components/Markdown/Markdown.module.js.map +1 -1
  21. package/dist/components/PasswordInput/PasswordInput.module.cjs.map +1 -1
  22. package/dist/components/PasswordInput/PasswordInput.module.js.map +1 -1
  23. package/dist/components/SegmentedControl/SegmentedControl.module.cjs.map +1 -1
  24. package/dist/components/SegmentedControl/SegmentedControl.module.js.map +1 -1
  25. package/dist/components/Sidebar/Sidebar.module.cjs.map +1 -1
  26. package/dist/components/Sidebar/Sidebar.module.js.map +1 -1
  27. package/dist/components/StepperInput/StepperInput.module.cjs.map +1 -1
  28. package/dist/components/StepperInput/StepperInput.module.js.map +1 -1
  29. package/dist/components/Tag/Tag.module.cjs.map +1 -1
  30. package/dist/components/Tag/Tag.module.js.map +1 -1
  31. package/dist/components/Timeline/Timeline.module.cjs.map +1 -1
  32. package/dist/components/Timeline/Timeline.module.js.map +1 -1
  33. package/dist/components/Toggle/Toggle.module.cjs.map +1 -1
  34. package/dist/components/Toggle/Toggle.module.js.map +1 -1
  35. package/dist/components/ToggleGroup/ToggleGroup.module.cjs.map +1 -1
  36. package/dist/components/ToggleGroup/ToggleGroup.module.js.map +1 -1
  37. package/dist/http/describe-api-error.cjs +1 -1
  38. package/dist/http/describe-api-error.cjs.map +1 -1
  39. package/dist/http/describe-api-error.js +12 -8
  40. package/dist/http/describe-api-error.js.map +1 -1
  41. package/dist/http/errors.cjs +1 -1
  42. package/dist/http/errors.cjs.map +1 -1
  43. package/dist/http/errors.js +21 -16
  44. package/dist/http/errors.js.map +1 -1
  45. package/dist/styles/Alert.css +1 -1
  46. package/dist/styles/Badge.css +1 -1
  47. package/dist/styles/BarList.css +3 -3
  48. package/dist/styles/BottomSheet.css +1 -1
  49. package/dist/styles/DataTable.css +1 -1
  50. package/dist/styles/Dropzone.css +1 -1
  51. package/dist/styles/ErrorText.css +1 -1
  52. package/dist/styles/Markdown.css +1 -1
  53. package/dist/styles/PasswordInput.css +1 -1
  54. package/dist/styles/SegmentedControl.css +1 -1
  55. package/dist/styles/Sidebar.css +2 -2
  56. package/dist/styles/StepperInput.css +1 -1
  57. package/dist/styles/Tag.css +1 -1
  58. package/dist/styles/Timeline.css +1 -1
  59. package/dist/styles/Toggle.css +1 -1
  60. package/dist/styles/ToggleGroup.css +1 -1
  61. package/dist/styles/advanced.css +2 -2
  62. package/dist/styles/auto.css +4 -0
  63. package/dist/styles/base.css +33 -0
  64. package/dist/styles/core.css +4 -2
  65. package/dist/styles/data.css +6 -6
  66. package/dist/styles/feedback.css +3 -3
  67. package/dist/styles/forms.css +3 -3
  68. package/dist/styles/manifest.json +496 -0
  69. package/dist/styles/navigation.css +3 -3
  70. package/dist/styles/overlay.css +1 -1
  71. package/dist/styles/scoped.css +131 -0
  72. package/dist/styles/tokens.css +10 -0
  73. package/dist/styles/utility.css +1 -1
  74. package/dist/styles.css +1 -1
  75. package/dist/tempest-react-sdk.cjs +1 -1
  76. package/dist/tempest-react-sdk.d.ts +81 -7
  77. package/dist/tempest-react-sdk.js +347 -346
  78. package/dist/theme/create-theme.cjs +3 -3
  79. package/dist/theme/create-theme.cjs.map +1 -1
  80. package/dist/theme/create-theme.js +15 -14
  81. package/dist/theme/create-theme.js.map +1 -1
  82. package/dist/utils/dev-mode.cjs +1 -1
  83. package/dist/utils/dev-mode.cjs.map +1 -1
  84. package/dist/utils/dev-mode.js +7 -2
  85. package/dist/utils/dev-mode.js.map +1 -1
  86. package/dist/vite/tempest-styles.cjs +5 -0
  87. package/dist/vite/tempest-styles.cjs.map +1 -0
  88. package/dist/vite/tempest-styles.js +103 -0
  89. package/dist/vite/tempest-styles.js.map +1 -0
  90. package/dist/vite.cjs +1 -1
  91. package/dist/vite.d.ts +82 -0
  92. package/dist/vite.js +2 -1
  93. package/package.json +3 -2
package/dist/vite.d.ts CHANGED
@@ -69,6 +69,25 @@ export declare interface CreateViteConfigOptions {
69
69
  */
70
70
  export declare type ProxyEntry = string | Record<string, unknown>;
71
71
 
72
+ /**
73
+ * How much of the reset an app takes.
74
+ *
75
+ * The components are written against the reset — `.tempest_button` assumes
76
+ * `button { background: none; border: 0; padding: 0 }`, every width assumes
77
+ * `box-sizing: border-box` — so `"none"` is not "unstyled document, styled
78
+ * components": it is components missing their box model. It exists for the app
79
+ * that already ships an equivalent reset of its own.
80
+ */
81
+ export declare type ResetMode = "scoped" | "global" | "none";
82
+
83
+ /** Shape of `dist/styles/manifest.json`. */
84
+ export declare interface StyleManifest {
85
+ /** The foundation sheet — tokens and reset together, the pre-split default. */
86
+ core: string;
87
+ /** Public export name → the stylesheets it needs, transitive closure included. */
88
+ components: Record<string, readonly string[]>;
89
+ }
90
+
72
91
  /**
73
92
  * Generate a static icon registry from the slugs your source mentions.
74
93
  *
@@ -250,6 +269,69 @@ export declare interface TempestPwaManifestOptions {
250
269
  appShell?: string | false;
251
270
  }
252
271
 
272
+ /**
273
+ * Import only the SDK stylesheets your app can actually reach.
274
+ *
275
+ * `styles.css` carries every component the SDK ships — measured at 236.71 kB raw
276
+ * against the 38.94 kB an app mounting twelve of them can reach. The per-component
277
+ * sheets under `styles/` have always closed that gap, but by hand: the app lists
278
+ * them and keeps the list honest as it grows. This plugin makes the list the build's
279
+ * problem, resolving it from the imports the source already writes.
280
+ *
281
+ * The closure matters more than the scan. A component pays for the CSS of every SDK
282
+ * component it renders internally, so `<DataTable>` alone needs six sheets and
283
+ * `<AIChat>` seven — a hand-kept list of one sheet per component the app names is
284
+ * wrong in a way that only shows up as an unstyled child.
285
+ *
286
+ * The reset is the other half, and the half that breaks apps. `styles.css` claims
287
+ * `html`, `body` and `#root`; an app with its own layout that imports it loses its
288
+ * document surface, and an app that drops the import loses the box model its
289
+ * components are written against — components render unstyled, which is what the
290
+ * "just remove the import" fix actually costs. The default `reset: "scoped"` is the
291
+ * third option: the same normalisation, confined to
292
+ * `:where([class*="tempest_"])`, so it reaches inside a Tempest component and
293
+ * nowhere else.
294
+ *
295
+ * `tempest-react-sdk/styles/auto.css` is a real file, so it resolves without the
296
+ * plugin too — to the complete sheet. Dropping the plugin costs bytes, never
297
+ * correctness.
298
+ *
299
+ * @param options - Scan configuration.
300
+ * @returns The Vite plugin.
301
+ *
302
+ * @example
303
+ * // vite.config.ts
304
+ * import { createViteConfig, tempestStyles } from "tempest-react-sdk/vite";
305
+ *
306
+ * export default createViteConfig({ plugins: [tempestStyles()] });
307
+ *
308
+ * @example
309
+ * // src/main.tsx — the one import, instead of a maintained list
310
+ * import "tempest-react-sdk/styles/auto.css";
311
+ */
312
+ export declare function tempestStyles(options?: TempestStylesOptions): TempestVitePlugin;
313
+
314
+ export declare interface TempestStylesOptions {
315
+ /** Directory to scan, relative to the Vite root. Default: `"src"`. */
316
+ dir?: string;
317
+ /**
318
+ * Which reset to emit alongside the tokens. Default: `"scoped"`.
319
+ *
320
+ * `"scoped"` confines the reset to `:where([class*="tempest_"])`, so components
321
+ * keep the normalisation they are written against and the app keeps `html`,
322
+ * `body` and `#root`. `"global"` is the pre-split behaviour, correct when the
323
+ * SDK owns the whole page. `"none"` emits tokens only.
324
+ */
325
+ reset?: ResetMode;
326
+ /**
327
+ * Extra export names to style even when the scan cannot see them — a component
328
+ * reached only through a namespace import, or rendered by a sibling package.
329
+ */
330
+ include?: readonly string[];
331
+ /** Directory names to skip. Default: `node_modules`, `dist`, `build`, `coverage`. */
332
+ skipDirs?: readonly string[];
333
+ }
334
+
253
335
  /**
254
336
  * The resulting Vite config object. Typed loosely so the SDK's published
255
337
  * declarations stay free of `vite`'s internal types; assign it straight to a
package/dist/vite.js CHANGED
@@ -3,4 +3,5 @@ import { createViteConfig as t } from "./vite/create-vite-config.js";
3
3
  import { tempestPwaManifest as n } from "./vite/tempest-pwa-manifest.js";
4
4
  import { tempestPwaIcons as r } from "./vite/tempest-pwa-icons.js";
5
5
  import { tempestPwaDevSw as i } from "./vite/tempest-pwa-dev-sw.js";
6
- export { t as createViteConfig, e as tempestIcons, i as tempestPwaDevSw, r as tempestPwaIcons, n as tempestPwaManifest };
6
+ import { tempestStyles as a } from "./vite/tempest-styles.js";
7
+ export { t as createViteConfig, e as tempestIcons, i as tempestPwaDevSw, r as tempestPwaIcons, n as tempestPwaManifest, a as tempestStyles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tempest-react-sdk",
3
- "version": "0.58.0",
3
+ "version": "0.60.0",
4
4
  "description": "SDK público da Tempest com componentes, hooks e integrações para projetos React.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -102,12 +102,13 @@
102
102
  },
103
103
  "./styles.css": "./dist/styles.css",
104
104
  "./styles/*.css": "./dist/styles/*.css",
105
+ "./styles/manifest.json": "./dist/styles/manifest.json",
105
106
  "./package.json": "./package.json",
106
107
  "./utilities.css": "./dist/utilities.css"
107
108
  },
108
109
  "scripts": {
109
110
  "dev": "vite build --watch",
110
- "build": "tsc -b tsconfig.build.json && node --max-old-space-size=6144 ./node_modules/vite/bin/vite.js build && node scripts/copy-css-assets.mjs && node scripts/split-css.mjs",
111
+ "build": "node scripts/gen-scoped-reset.mjs && tsc -b tsconfig.build.json && node --max-old-space-size=6144 ./node_modules/vite/bin/vite.js build && node scripts/split-css.mjs && node scripts/gen-style-manifest.mjs && node scripts/copy-css-assets.mjs",
111
112
  "postbuild": "node scripts/check-dist-guards.mjs",
112
113
  "typecheck": "tsc -b tsconfig.json --noEmit",
113
114
  "lint": "eslint .",