@awc-ui/react 1.0.0-beta.2 → 1.0.0-beta.4

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 (2) hide show
  1. package/README.md +32 -0
  2. package/package.json +19 -4
package/README.md CHANGED
@@ -30,6 +30,38 @@ For styled markup on first paint (Next.js App Router and other SSR setups), impo
30
30
  import { MdButton } from '@awc-ui/react/server';
31
31
  ```
32
32
 
33
+ ## Smaller bundles
34
+
35
+ Tree-shaking works out of the box: importing a component ships only that component plus the shared runtime. Two opt-ins shrink things further.
36
+
37
+ **Client-only build** — if your app never server-renders, alias the core components to the CSR build, which compiles out the Declarative-Shadow-DOM hydration support (≈3 kB gz):
38
+
39
+ ```ts
40
+ // vite.config.ts
41
+ resolve: {
42
+ alias: [
43
+ { find: '@awc-ui/core/dist/components', replacement: '@awc-ui/core/dist/components-csr' },
44
+ ],
45
+ },
46
+ ```
47
+
48
+ Remove the alias if you adopt SSR — the hydrating build is the default for a reason.
49
+
50
+ **Preact** — the wrappers are `preact/compat`-safe. Since the components are web components, React only provides thin glue, and swapping it for Preact saves ≈50 kB gz with three aliases (most specific first; `react/jsx-runtime` maps automatically):
51
+
52
+ ```ts
53
+ // vite.config.ts — and `npm i preact` (keep react + @types for type-checking)
54
+ resolve: {
55
+ alias: [
56
+ { find: 'react-dom/client', replacement: 'preact/compat/client' },
57
+ { find: 'react-dom', replacement: 'preact/compat' },
58
+ { find: 'react', replacement: 'preact/compat' },
59
+ ],
60
+ },
61
+ ```
62
+
63
+ Caveats: no React DevTools/concurrent features, and libraries that touch React internals may misbehave — evaluate for your app.
64
+
33
65
  ## Documentation
34
66
 
35
67
  Component docs, theming, and per-component manuals ship with [`@awc-ui/core`](https://www.npmjs.com/package/@awc-ui/core).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awc-ui/react",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "React wrapper for AWC UI Material Design 3 components",
5
5
  "keywords": [
6
6
  "react",
@@ -40,20 +40,34 @@
40
40
  "src",
41
41
  "LICENSE"
42
42
  ],
43
+ "size-limit": [
44
+ {
45
+ "name": "import { MdButton } from '@awc-ui/react' — wrapper share only (react and @awc-ui/core are peers, excluded). Tripwire: if barrel tree-shaking breaks, all 81 wrappers land here.",
46
+ "path": "dist/index.js",
47
+ "import": "{ MdButton }",
48
+ "ignore": [
49
+ "react",
50
+ "react-dom"
51
+ ],
52
+ "limit": "2 kB"
53
+ }
54
+ ],
43
55
  "dependencies": {
44
56
  "@stencil/react-output-target": "^1.6.1"
45
57
  },
46
58
  "peerDependencies": {
47
59
  "react": ">=18",
48
60
  "react-dom": ">=18",
49
- "@awc-ui/core": "1.0.0-beta.2"
61
+ "@awc-ui/core": "1.0.0-beta.4"
50
62
  },
51
63
  "devDependencies": {
64
+ "@size-limit/preset-small-lib": "^11.1.6",
52
65
  "@types/node": "^20.14.0",
53
66
  "@types/react": "~18.2.79",
54
67
  "@types/react-dom": "~18.2.25",
68
+ "size-limit": "^11.1.6",
55
69
  "typescript": "^5.4.0",
56
- "@awc-ui/core": "1.0.0-beta.2"
70
+ "@awc-ui/core": "1.0.0-beta.4"
57
71
  },
58
72
  "license": "MIT",
59
73
  "author": "AWC UI",
@@ -67,6 +81,7 @@
67
81
  "url": "https://github.com/awc-ui/core/issues"
68
82
  },
69
83
  "scripts": {
70
- "build": "rm -rf dist && tsc -p tsconfig.json"
84
+ "build": "rm -rf dist && tsc -p tsconfig.json",
85
+ "size": "size-limit"
71
86
  }
72
87
  }