mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
This repo could never sync. There was NO merge-base with tamagui — 372 commits
here against 15,791 there, unrelated histories — because it began as a
copy-paste rebrand with a flattened layout. Every "sync" since was a hand
re-application that drifted, which is why the tree sat on 7.3.1 while upstream
shipped fixes we then rediscovered by hand.
This commit's PARENT IS TAMAGUI. A future sync is `git merge tama/main` then
`node scripts/rebrand.mjs` — a real merge, because the history is now shared.
174 packages: 166 upstream, our 8 restored (chrome, shell, telemetry, recipes,
get, font-geist-{sans,mono}, @hanzo/booker), bento-get gained. 170/170 build.
Our patches to files UPSTREAM ALSO OWNS are carried, which the package-level
delta missed and which was where the value actually was:
- useMedia's server snapshot (`initState ?? getMedia()`). Upstream still
returns undefined there, so every Tamagui Dialog kills a prerender — the
exact crash hanzo.app spent a day on.
- data-slot on web host nodes, absent upstream entirely.
Both applied ONTO upstream's newer files (it rewrote useMedia +150/-63 and
createComponent +160/-55), marked `PATCH (ours, carried across the transplant)`.
Seven traps are encoded in scripts/rebrand.mjs, each found by a gate:
skip itself and lockfiles; special-case the double-branded names in BOTH scoped
and bare form; map path strings, not just paths; drop a level for the flattened
group; check disk rather than a stale index.
Rust build artifacts are NOT committed. An earlier draft of this commit swept
apps/desktop/src-tauri/target/debug in via `git add -A` — 3,859 files including
a 272MB .a, over GitHub's 100MB cap, so the push could never have landed. They
are gitignored now.
Co-Authored-By: Hanzo Dev <[email protected]>
81 lines
2.7 KiB
TypeScript
81 lines
2.7 KiB
TypeScript
import { concatClassName } from '@hanzogui/static'
|
|
import { expect, test } from 'vitest'
|
|
|
|
test(`concatClassName - leave regular`, () => {
|
|
expect(concatClassName(`_width-10 _height-20`)).toEqual(`_width-10 _height-20`)
|
|
})
|
|
|
|
test(`concatClassName - merge regular`, () => {
|
|
expect(concatClassName(`_width-10 _width-20`)).toEqual(`_width-20`)
|
|
})
|
|
|
|
test(`concatClassName - merge media`, () => {
|
|
expect(
|
|
concatClassName(`_width-_pointerTouch_200vw _width-_pointerTouch_300vw`)
|
|
).toEqual(`_width-_pointerTouch_300vw`)
|
|
})
|
|
|
|
test(`concatClassName - leave media`, () => {
|
|
expect(
|
|
concatClassName(`_height-_pointerTouch_200vw _width-_pointerTouch_300vw`)
|
|
).toEqual(`_height-_pointerTouch_200vw _width-_pointerTouch_300vw`)
|
|
})
|
|
|
|
test(`concatClassName - keeps base and pseudo styles for the same property`, () => {
|
|
expect(concatClassName(`_col-0hover-color _col-color11`)).toEqual(
|
|
`_col-0hover-color _col-color11`
|
|
)
|
|
})
|
|
|
|
test(`concatClassName - merges duplicate pseudo styles for the same property`, () => {
|
|
expect(concatClassName(`_col-0hover-color11 _col-0hover-color12`)).toEqual(
|
|
`_col-0hover-color12`
|
|
)
|
|
})
|
|
|
|
test(`concatClassName - scopes pseudo styles inside media queries`, () => {
|
|
expect(concatClassName(`_col-_sm_0hover-color11 _col-_sm_color12`)).toEqual(
|
|
`_col-_sm_0hover-color11 _col-_sm_color12`
|
|
)
|
|
})
|
|
|
|
test(`concatClassName - keeps hyphenated pseudo names distinct`, () => {
|
|
expect(concatClassName(`_col-0focus-visible-red _col-0focus-blue`)).toEqual(
|
|
`_col-0focus-visible-red _col-0focus-blue`
|
|
)
|
|
})
|
|
|
|
test(`concatClassName - merges duplicate hyphenated pseudo styles`, () => {
|
|
expect(concatClassName(`_col-0focus-visible-red _col-0focus-visible-blue`)).toEqual(
|
|
`_col-0focus-visible-blue`
|
|
)
|
|
})
|
|
|
|
test(`concatClassName - keeps enter and exit pseudo styles distinct from base`, () => {
|
|
expect(concatClassName(`_op-0enter-0 _op-0exit-0 _op-1`)).toEqual(
|
|
`_op-0enter-0 _op-0exit-0 _op-1`
|
|
)
|
|
})
|
|
|
|
test(`concatClassName - merge media queries with same property and breakpoint`, () => {
|
|
// this is the bug: _pr-_lg_0px and _pr-_lg_260px should merge to just _pr-_lg_260px
|
|
// because they both target the same property (pr) at the same breakpoint (lg)
|
|
expect(concatClassName(`_pr-_lg_0px _dsp-flex _pr-_lg_260px`)).toEqual(
|
|
`_dsp-flex _pr-_lg_260px`
|
|
)
|
|
})
|
|
|
|
test(`concatClassName - keep media queries with different breakpoints`, () => {
|
|
// different breakpoints should be kept
|
|
expect(concatClassName(`_pr-_lg_0px _pr-_md_260px`)).toEqual(
|
|
`_pr-_lg_0px _pr-_md_260px`
|
|
)
|
|
})
|
|
|
|
test(`concatClassName - keep media queries with different properties`, () => {
|
|
// different properties should be kept
|
|
expect(concatClassName(`_pr-_lg_0px _pl-_lg_260px`)).toEqual(
|
|
`_pr-_lg_0px _pl-_lg_260px`
|
|
)
|
|
})
|