@hanzogui/web 7.3.0 → 7.3.2
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.
|
@@ -199,7 +199,7 @@ function useMedia(componentContext, debug) {
|
|
|
199
199
|
}
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
|
-
const getServerSnapshot = () => initState;
|
|
202
|
+
const getServerSnapshot = () => initState ?? getMedia();
|
|
203
203
|
let disableMediaTouch = false;
|
|
204
204
|
function _disableMediaTouch(val) {
|
|
205
205
|
disableMediaTouch = val;
|
|
@@ -160,7 +160,7 @@ function useMedia(componentContext, debug) {
|
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
const getServerSnapshot = () => initState;
|
|
163
|
+
const getServerSnapshot = () => initState ?? getMedia();
|
|
164
164
|
let disableMediaTouch = false;
|
|
165
165
|
function _disableMediaTouch(val) {
|
|
166
166
|
disableMediaTouch = val;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/web",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.2",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"author": "Hanzo AI <dev@hanzo.ai>",
|
|
6
6
|
"repository": {
|
|
@@ -41,28 +41,21 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"build": "gui-build",
|
|
46
|
-
"watch": "gui-build --watch",
|
|
47
|
-
"clean": "gui-build clean",
|
|
48
|
-
"clean:build": "gui-build clean:build",
|
|
49
|
-
"test:web": "vitest --typecheck --run"
|
|
50
|
-
},
|
|
51
44
|
"dependencies": {
|
|
52
|
-
"@hanzogui/compose-refs": "7.3.
|
|
53
|
-
"@hanzogui/constants": "7.3.
|
|
54
|
-
"@hanzogui/helpers": "7.3.
|
|
55
|
-
"@hanzogui/is-equal-shallow": "7.3.
|
|
56
|
-
"@hanzogui/native": "7.3.
|
|
57
|
-
"@hanzogui/normalize-css-color": "7.3.
|
|
58
|
-
"@hanzogui/timer": "7.3.
|
|
45
|
+
"@hanzogui/compose-refs": "7.3.1",
|
|
46
|
+
"@hanzogui/constants": "7.3.1",
|
|
47
|
+
"@hanzogui/helpers": "7.3.1",
|
|
48
|
+
"@hanzogui/is-equal-shallow": "7.3.1",
|
|
49
|
+
"@hanzogui/native": "7.3.1",
|
|
50
|
+
"@hanzogui/normalize-css-color": "7.3.1",
|
|
51
|
+
"@hanzogui/timer": "7.3.1",
|
|
59
52
|
"@hanzogui/types": "7.3.0",
|
|
60
|
-
"@hanzogui/use-did-finish-ssr": "7.3.
|
|
61
|
-
"@hanzogui/use-event": "7.3.
|
|
62
|
-
"@hanzogui/use-force-update": "7.3.
|
|
53
|
+
"@hanzogui/use-did-finish-ssr": "7.3.1",
|
|
54
|
+
"@hanzogui/use-event": "7.3.1",
|
|
55
|
+
"@hanzogui/use-force-update": "7.3.1"
|
|
63
56
|
},
|
|
64
57
|
"devDependencies": {
|
|
65
|
-
"@hanzogui/build": "7.3.
|
|
58
|
+
"@hanzogui/build": "7.3.1",
|
|
66
59
|
"@testing-library/react": "^16.1.0",
|
|
67
60
|
"csstype": "^3.0.10",
|
|
68
61
|
"react": ">=19",
|
|
@@ -84,5 +77,17 @@
|
|
|
84
77
|
"*.mjs",
|
|
85
78
|
"*.css",
|
|
86
79
|
"README.md"
|
|
87
|
-
]
|
|
88
|
-
|
|
80
|
+
],
|
|
81
|
+
"peerDependenciesMeta": {
|
|
82
|
+
"react-native": {
|
|
83
|
+
"optional": true
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"scripts": {
|
|
87
|
+
"build": "gui-build",
|
|
88
|
+
"watch": "gui-build --watch",
|
|
89
|
+
"clean": "gui-build clean",
|
|
90
|
+
"clean:build": "gui-build clean:build",
|
|
91
|
+
"test:web": "vitest --typecheck --run"
|
|
92
|
+
}
|
|
93
|
+
}
|
package/src/createComponent.tsx
CHANGED
|
@@ -56,6 +56,26 @@ import { Slot } from './views/Slot'
|
|
|
56
56
|
import { getThemedChildren } from './views/Theme'
|
|
57
57
|
import type { ViewProps } from './views/View'
|
|
58
58
|
|
|
59
|
+
// data-slot: a neutral, standard structural annotation for zero-config analytics.
|
|
60
|
+
// Mirrors shadcn's convention — the component's name, kebab-cased — so a tracker
|
|
61
|
+
// like track.js's `annotate` can capture DOM structure with no per-app config.
|
|
62
|
+
// Only named components carry one (base View/Text/Stack have no componentName),
|
|
63
|
+
// matching shadcn's "named primitives only" rule.
|
|
64
|
+
// Memoized: names come from the fixed set of styled() definitions, so each is
|
|
65
|
+
// kebab-cased once — the render path is then an O(1) hit with no per-render regex.
|
|
66
|
+
const dataSlotCache = new Map<string, string>()
|
|
67
|
+
const dataSlotFor = (name: string): string => {
|
|
68
|
+
let slot = dataSlotCache.get(name)
|
|
69
|
+
if (slot === undefined) {
|
|
70
|
+
slot = name
|
|
71
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
|
|
72
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
73
|
+
.toLowerCase()
|
|
74
|
+
dataSlotCache.set(name, slot)
|
|
75
|
+
}
|
|
76
|
+
return slot
|
|
77
|
+
}
|
|
78
|
+
|
|
59
79
|
/**
|
|
60
80
|
* All things that need one-time setup after createGui is called
|
|
61
81
|
*/
|
|
@@ -1471,6 +1491,15 @@ export function createComponent<
|
|
|
1471
1491
|
|
|
1472
1492
|
if (process.env.NODE_ENV === 'development' && time) time`spaced-as-child`
|
|
1473
1493
|
|
|
1494
|
+
// Stamp a neutral, standard structural annotation (data-slot) on the web host
|
|
1495
|
+
// node so analytics can self-describe with zero app config. Named components
|
|
1496
|
+
// only; overridable — passing your own `data-slot` (any value) opts out.
|
|
1497
|
+
// No-op on native (isWeb compiles to false there). asChild flows via Slot,
|
|
1498
|
+
// which merges viewProps onto the child host, so it is covered too.
|
|
1499
|
+
if (isWeb && componentName && !('data-slot' in viewProps)) {
|
|
1500
|
+
viewProps['data-slot'] = dataSlotFor(componentName)
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1474
1503
|
let content: ReactNode | undefined
|
|
1475
1504
|
|
|
1476
1505
|
if (isPassthrough) {
|