Files
gui/pkgs/core/core-test/onlyShorthandStyleProps.web.test.tsx
zeekay 828edc8024 chore: rip all TAMAGUI/Tamagui/tamagui refs, replace with HANZOGUI/Hanzogui/hanzogui
Eradicate every upstream-fork token from source. Scope is the published
hanzogui ecosystem — the artifacts on npm (@hanzogui/*@7.0.0) are already
clean; this sweep brings the source tree to parity.

Categories handled (in sed precedence order to avoid token collisions):
- URL rewrites: github.com/tamagui/tamagui -> github.com/hanzoai/gui,
  tamagui.dev -> gui.hanzo.ai
- Package namespace: @tamagui/X -> @hanzogui/X (imports, package.json deps,
  __tests__ fixtures, build scripts)
- Env vars: NEXT_PUBLIC_IS_TAMAGUI_*, IS_TAMAGUI_*, DEBUG_TAMAGUI_*,
  TAMAGUI_* (TARGET, IS_SERVER/CLIENT, ENVIRONMENT, OPTIMIZE_THEMES,
  HEADLESS, DEBUG, KEEP_THEMES, PACKAGE_EXPORTS, PRO_SECRET, etc.) all
  collapse to GUI_* prefix (short, matches @hanzogui/ namespace ergonomics)
- Vite envPrefix: ['TAMAGUI_'] -> ['GUI_'] in pkgs/compiler/vite-plugin
- PascalCase identifiers: Tamagui -> Hanzogui (any remaining
  TamaguiCustomConfig, TamaguiInternalConfig, etc. in source)
- Lowercase strings/comments/log labels: tamagui -> hanzogui
- Filename: scripts/rename-from-tamagui.sh -> scripts/rename-from-tama.sh
  (and the script's internal rules were rewritten to be self-consistent —
  it still consumes upstream tamagui sources and produces hanzogui output)
- Dockerfile.local ARG names: ARG IS_TAMAGUI_DEV -> ARG IS_GUI_DEV,
  ARG TAMAGUI_PRO_SECRET -> ARG GUI_PRO_SECRET, etc.
- .env.development: NEXT_PUBLIC_IS_TAMAGUI_DEV -> NEXT_PUBLIC_IS_GUI_DEV
- bun.lock regenerated via bun install

Decisions on edge cases:
- .gitignore / .dockerignore / .oxfmtrc.jsonc / templates: kept .tamagui
  entries alongside the new .hanzogui entries as safety so legacy cache
  directories from older installations are still ignored. Net additive.
- pkgs/packages/build/__tests__/fixtures/{simple,watch}-package: the fixture
  + builder (hanzogui-build.js) + integration.test.ts all reference
  TAMAGUI_TARGET symmetrically (test asserts builder DCE-eliminates it).
  Renamed all three to GUI_TARGET — test contract is preserved end-to-end.
- pkgs/compiler/static/src/helpers/requireHanzoguiCore.ts: file was already
  renamed; internals already use HanzoguiPlatform / @hanzogui/core. No-op.
- plans/toast2.md: renamed to use hanzogui (no longer tracking upstream
  tamagui issues — this fork is independent).
- assets/banners.sketch: binary Sketch file (zip archive). Skipped — same
  treatment as svg/plist/pbxproj. Internal XML may still contain "tamagui"
  but it's only visible inside the design tool.
- bun.lock: 2 remaining @tamagui/constants references come from third-party
  transitive (@take-out/helpers depends on it). Cannot rewrite upstream
  package metadata.
- LICENSE files (root + per-pkg): preserved unchanged. MIT attribution to
  Tamagui Inc is a legal requirement.
- .git/config upstream remote: untouched (per task spec).
- pkgs/ui/switch/src/Switch.draggable-tmp: scratchpad, left alone.

Smoke tests:
- bun install: clean (lockfile regenerated, 1 package installed)
- @hanzogui/constants: builds in 302 ms
- @hanzogui/web (200+ source files): builds in 4187 ms
- @hanzogui/vite-plugin: builds in 997 ms
- @hanzogui/static: builds in 2547 ms

Residual count after sweep:
- git grep -ci tamagui (excluding LICENSE, lockfiles, binaries, draggable-tmp,
  rename script, intentional .gitignore safety entries): 0 source matches.

158 files changed.
2026-05-26 17:47:23 -07:00

99 lines
4.2 KiB
TypeScript

process.env.GUI_TARGET = 'web'
import { describe, expectTypeOf, test } from 'vitest'
import type { StackStyleBase } from '../web/src'
// the default config has onlyShorthandStyleProps unset (false),
// so the type-level behavior is: longhands are available.
// we test both the default and a simulated "true" case via conditional types.
type HasProp<T, K extends string> = K extends keyof T ? true : false
describe('onlyShorthandStyleProps - default (false)', () => {
// by default, both shorthands and longhands should be available
test('border shorthand is available', () => {
expectTypeOf<HasProp<StackStyleBase, 'border'>>().toEqualTypeOf<true>()
})
test('outline shorthand is available', () => {
expectTypeOf<HasProp<StackStyleBase, 'outline'>>().toEqualTypeOf<true>()
})
test('boxShadow shorthand is available', () => {
expectTypeOf<HasProp<StackStyleBase, 'boxShadow'>>().toEqualTypeOf<true>()
})
test('border longhands are available', () => {
expectTypeOf<HasProp<StackStyleBase, 'borderWidth'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<StackStyleBase, 'borderStyle'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<StackStyleBase, 'borderColor'>>().toEqualTypeOf<true>()
})
test('outline longhands are available', () => {
expectTypeOf<HasProp<StackStyleBase, 'outlineWidth'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<StackStyleBase, 'outlineStyle'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<StackStyleBase, 'outlineColor'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<StackStyleBase, 'outlineOffset'>>().toEqualTypeOf<true>()
})
test('shadow longhands are available', () => {
expectTypeOf<HasProp<StackStyleBase, 'shadowColor'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<StackStyleBase, 'shadowOffset'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<StackStyleBase, 'shadowOpacity'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<StackStyleBase, 'shadowRadius'>>().toEqualTypeOf<true>()
})
})
describe('onlyShorthandStyleProps - conditional type simulation', () => {
// simulate what happens when the setting is true by manually applying
// the same Omit that MaybeOmitLonghands does
type ShorthandLonghandProps =
| 'borderWidth'
| 'borderStyle'
| 'borderColor'
| 'outlineWidth'
| 'outlineStyle'
| 'outlineColor'
| 'outlineOffset'
| 'shadowColor'
| 'shadowOffset'
| 'shadowOpacity'
| 'shadowRadius'
type WithSettingEnabled = Omit<StackStyleBase, ShorthandLonghandProps>
test('shorthands are still available', () => {
expectTypeOf<HasProp<WithSettingEnabled, 'border'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<WithSettingEnabled, 'outline'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<WithSettingEnabled, 'boxShadow'>>().toEqualTypeOf<true>()
})
test('border longhands are removed', () => {
expectTypeOf<HasProp<WithSettingEnabled, 'borderWidth'>>().toEqualTypeOf<false>()
expectTypeOf<HasProp<WithSettingEnabled, 'borderStyle'>>().toEqualTypeOf<false>()
expectTypeOf<HasProp<WithSettingEnabled, 'borderColor'>>().toEqualTypeOf<false>()
})
test('outline longhands are removed', () => {
expectTypeOf<HasProp<WithSettingEnabled, 'outlineWidth'>>().toEqualTypeOf<false>()
expectTypeOf<HasProp<WithSettingEnabled, 'outlineStyle'>>().toEqualTypeOf<false>()
expectTypeOf<HasProp<WithSettingEnabled, 'outlineColor'>>().toEqualTypeOf<false>()
expectTypeOf<HasProp<WithSettingEnabled, 'outlineOffset'>>().toEqualTypeOf<false>()
})
test('shadow longhands are removed', () => {
expectTypeOf<HasProp<WithSettingEnabled, 'shadowColor'>>().toEqualTypeOf<false>()
expectTypeOf<HasProp<WithSettingEnabled, 'shadowOffset'>>().toEqualTypeOf<false>()
expectTypeOf<HasProp<WithSettingEnabled, 'shadowOpacity'>>().toEqualTypeOf<false>()
expectTypeOf<HasProp<WithSettingEnabled, 'shadowRadius'>>().toEqualTypeOf<false>()
})
test('unrelated props are not affected', () => {
expectTypeOf<HasProp<WithSettingEnabled, 'backgroundColor'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<WithSettingEnabled, 'padding'>>().toEqualTypeOf<true>()
expectTypeOf<HasProp<WithSettingEnabled, 'opacity'>>().toEqualTypeOf<true>()
})
})