@helpway/react 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpway/react",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Official React SDK for Helpway — drop-in AI chat support widget with headless hooks for custom UIs.",
5
5
  "keywords": [
6
6
  "helpway",
@@ -21,11 +21,15 @@
21
21
  "url": "https://github.com/better-i18n/helpway/issues"
22
22
  },
23
23
  "type": "module",
24
- "sideEffects": false,
25
- "main": "./src/index.ts",
26
- "types": "./src/index.ts",
24
+ "//sideEffects": "tsup injectStyle bundles CSS into JS as a runtime styleInject() call. Must be true (not an array) because some bundlers — notably Vite's esbuild pre-bundler — don't honor path-scoped sideEffects entries for npm deps. Widget bundle is tiny (~240KB), cost of losing tree-shaking is negligible.",
25
+ "sideEffects": true,
26
+ "main": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
27
28
  "exports": {
28
- ".": "./src/index.ts",
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js"
32
+ },
29
33
  "./styles.css": "./src/themed/styles.css"
30
34
  },
31
35
  "files": [
@@ -36,22 +40,11 @@
36
40
  "scripts": {
37
41
  "build": "tsup",
38
42
  "typecheck": "tsc --noEmit",
39
- "prepublishOnly": "bun run build"
43
+ "prepublishOnly": "bun run build",
44
+ "prepack": "bun run build && bun scripts/apply-publish-config.ts",
45
+ "postpack": "bun scripts/apply-publish-config.ts --restore"
40
46
  },
41
47
  "//": "publishConfig swaps main/types/exports to the built dist on publish. Workspace consumers get raw src (fast HMR, no build step); npm consumers get compiled dist with .d.ts. Standard monorepo pattern.",
42
- "publishConfig": {
43
- "access": "public",
44
- "main": "./dist/index.js",
45
- "module": "./dist/index.js",
46
- "types": "./dist/index.d.ts",
47
- "exports": {
48
- ".": {
49
- "types": "./dist/index.d.ts",
50
- "import": "./dist/index.js"
51
- },
52
- "./styles.css": "./src/themed/styles.css"
53
- }
54
- },
55
48
  "dependencies": {
56
49
  "@trpc/client": "^11.5.1",
57
50
  "zustand": "^5.0.11",
@@ -68,5 +61,7 @@
68
61
  "peerDependencies": {
69
62
  "react": "^18.0.0 || ^19.0.0",
70
63
  "react-dom": "^18.0.0 || ^19.0.0"
71
- }
64
+ },
65
+ "access": "public",
66
+ "module": "./dist/index.js"
72
67
  }
@@ -1,8 +1,12 @@
1
1
  /* ═══ Helpway Widget — Premium Intercom-Style ═══
2
- Vanilla CSS for Shadow DOM. Gradient hero, card-based actions,
2
+ Vanilla CSS. Works in both Shadow DOM (script embed) and regular
3
+ DOM (React native render). Gradient hero, card-based actions,
3
4
  avatar-first conversation rows, bottom tab navigation. */
4
5
 
5
6
  /* ── Reset ─────────────────────────────────────── */
7
+ /* Shadow DOM root — matches when the widget is mounted under a
8
+ <helpway-widget> custom element with shadow root. Regular-DOM
9
+ consumers ignore :host (selector never matches). */
6
10
  :host {
7
11
  all: initial;
8
12
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
@@ -14,6 +18,21 @@
14
18
  -moz-osx-font-smoothing: grayscale;
15
19
  }
16
20
 
21
+ /* Regular-DOM reset — applies the same typography baseline on the
22
+ `.hw-widget` root when there is no shadow DOM. Scoped so the
23
+ consumer's host page styles can't leak in and so we don't touch
24
+ anything outside `.hw-widget`. Don't use `all: initial` here —
25
+ it would wipe out `.hw-widget { position: fixed; z-index: ... }`. */
26
+ .hw-widget {
27
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
28
+ sans-serif;
29
+ font-size: 14px;
30
+ line-height: 1.5;
31
+ color: #1a1a1a;
32
+ -webkit-font-smoothing: antialiased;
33
+ -moz-osx-font-smoothing: grayscale;
34
+ }
35
+
17
36
  .hw-widget *,
18
37
  .hw-widget *::before,
19
38
  .hw-widget *::after {
@@ -45,7 +64,12 @@
45
64
  --hw-radius: 16px;
46
65
  --hw-visitor-bubble-bg: #f0f0f0;
47
66
  --hw-visitor-bubble-text: #1a1a1a;
48
- --hw-font: inherit;
67
+ /* Widget font stack. Consumers can override by setting --hw-font
68
+ on the `.hw-widget` element. Was `inherit` previously, which
69
+ meant "use host page font" — but in non-shadow-DOM that inherits
70
+ from <body>, often an unstyled fallback (Times New Roman). */
71
+ --hw-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
72
+ sans-serif;
49
73
  }
50
74
 
51
75
  /* ── Agent Avatar Image / Icon ────────────────── */