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.
- package/README.md +35 -3
- package/bin/lib/css/findings.mjs +1 -0
- package/bin/lib/css/semantic.mjs +70 -6
- package/bin/lib/css/semantic.test.mjs +52 -1
- package/dist/components/Alert/Alert.module.cjs.map +1 -1
- package/dist/components/Alert/Alert.module.js.map +1 -1
- package/dist/components/Badge/Badge.module.cjs.map +1 -1
- package/dist/components/Badge/Badge.module.js.map +1 -1
- package/dist/components/BarList/BarList.module.cjs.map +1 -1
- package/dist/components/BarList/BarList.module.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.module.cjs.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.module.js.map +1 -1
- package/dist/components/DataTable/DataTable.module.cjs.map +1 -1
- package/dist/components/DataTable/DataTable.module.js.map +1 -1
- package/dist/components/Dropzone/Dropzone.module.cjs.map +1 -1
- package/dist/components/Dropzone/Dropzone.module.js.map +1 -1
- package/dist/components/ErrorText/ErrorText.module.cjs.map +1 -1
- package/dist/components/ErrorText/ErrorText.module.js.map +1 -1
- package/dist/components/Markdown/Markdown.module.cjs.map +1 -1
- package/dist/components/Markdown/Markdown.module.js.map +1 -1
- package/dist/components/PasswordInput/PasswordInput.module.cjs.map +1 -1
- package/dist/components/PasswordInput/PasswordInput.module.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.module.cjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.module.js.map +1 -1
- package/dist/components/Sidebar/Sidebar.module.cjs.map +1 -1
- package/dist/components/Sidebar/Sidebar.module.js.map +1 -1
- package/dist/components/StepperInput/StepperInput.module.cjs.map +1 -1
- package/dist/components/StepperInput/StepperInput.module.js.map +1 -1
- package/dist/components/Tag/Tag.module.cjs.map +1 -1
- package/dist/components/Tag/Tag.module.js.map +1 -1
- package/dist/components/Timeline/Timeline.module.cjs.map +1 -1
- package/dist/components/Timeline/Timeline.module.js.map +1 -1
- package/dist/components/Toggle/Toggle.module.cjs.map +1 -1
- package/dist/components/Toggle/Toggle.module.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.module.cjs.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.module.js.map +1 -1
- package/dist/http/describe-api-error.cjs +1 -1
- package/dist/http/describe-api-error.cjs.map +1 -1
- package/dist/http/describe-api-error.js +12 -8
- package/dist/http/describe-api-error.js.map +1 -1
- package/dist/http/errors.cjs +1 -1
- package/dist/http/errors.cjs.map +1 -1
- package/dist/http/errors.js +21 -16
- package/dist/http/errors.js.map +1 -1
- package/dist/styles/Alert.css +1 -1
- package/dist/styles/Badge.css +1 -1
- package/dist/styles/BarList.css +3 -3
- package/dist/styles/BottomSheet.css +1 -1
- package/dist/styles/DataTable.css +1 -1
- package/dist/styles/Dropzone.css +1 -1
- package/dist/styles/ErrorText.css +1 -1
- package/dist/styles/Markdown.css +1 -1
- package/dist/styles/PasswordInput.css +1 -1
- package/dist/styles/SegmentedControl.css +1 -1
- package/dist/styles/Sidebar.css +2 -2
- package/dist/styles/StepperInput.css +1 -1
- package/dist/styles/Tag.css +1 -1
- package/dist/styles/Timeline.css +1 -1
- package/dist/styles/Toggle.css +1 -1
- package/dist/styles/ToggleGroup.css +1 -1
- package/dist/styles/advanced.css +2 -2
- package/dist/styles/auto.css +4 -0
- package/dist/styles/base.css +33 -0
- package/dist/styles/core.css +4 -2
- package/dist/styles/data.css +6 -6
- package/dist/styles/feedback.css +3 -3
- package/dist/styles/forms.css +3 -3
- package/dist/styles/manifest.json +496 -0
- package/dist/styles/navigation.css +3 -3
- package/dist/styles/overlay.css +1 -1
- package/dist/styles/scoped.css +131 -0
- package/dist/styles/tokens.css +10 -0
- package/dist/styles/utility.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/tempest-react-sdk.cjs +1 -1
- package/dist/tempest-react-sdk.d.ts +81 -7
- package/dist/tempest-react-sdk.js +347 -346
- package/dist/theme/create-theme.cjs +3 -3
- package/dist/theme/create-theme.cjs.map +1 -1
- package/dist/theme/create-theme.js +15 -14
- package/dist/theme/create-theme.js.map +1 -1
- package/dist/utils/dev-mode.cjs +1 -1
- package/dist/utils/dev-mode.cjs.map +1 -1
- package/dist/utils/dev-mode.js +7 -2
- package/dist/utils/dev-mode.js.map +1 -1
- package/dist/vite/tempest-styles.cjs +5 -0
- package/dist/vite/tempest-styles.cjs.map +1 -0
- package/dist/vite/tempest-styles.js +103 -0
- package/dist/vite/tempest-styles.js.map +1 -0
- package/dist/vite.cjs +1 -1
- package/dist/vite.d.ts +82 -0
- package/dist/vite.js +2 -1
- 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
|
-
|
|
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.
|
|
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/
|
|
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 .",
|